The vim-latex
plugin uses its own implementation of the :imap
command, which here is responsible for detecting patterns that should be replaced.
According to the documentation, the timeout functionality of :imap
, which would have allowed it to wait some time before checking for known patterns and allowing your usage of `bf
was removed in vim-latex‘
own IMAP()
function to allow for slower typing while still recognizing patterns.
IMAP()
does not have the ability to wait until you probably finished typing and instead tries to match what it sees right now.
Currently, I have no idea as to how one would either add that functionality to IMAP()
or use its mappings with :imap
.
So, simply put, this happens because `b
gets already replaced before you type f
.
Or as the section 3.12 Making your own Macros via IMAP()
of the vim-latex documentation
puts it:
If you have two mappings which end in a common lhs
, then the mapping with the longer lhs
is used. For example, if you do
call IMAP('BarFoo', 'something', 'tex')
call IMAP('Foo', 'something else', 'tex')
Then typing BarFoo
inserts "something"
, whereas Foo
by itself inserts "something else"
.
Also, the nature of IMAP()
makes creating certain combination of mappings impossible. For example if you have
call IMAP('foo', 'something', 'tex')
call IMAP('foobar', 'something else', 'tex')
Then you will never be able to trigger "foobar"
because typing "foo"
will immediately insert "something"
. This is the "cost" which you incur over the normal :imap
command for the convenience of no 'timeout' problems, the ability to correct lhs
etc.
Using IMAP()
you could try looking into ~/.vim/ftplugin/latex-suite/main.vim
and adjust the mappings to your convenience with the above explained restrictions.
For example make the following changes:
line 93 b
→ bg
and add a definition for bf
.
I am not entirely sure, that bg
is unused by default. And the above would break the consistency of the greek-letter-mappings.
On my system a .bind
file was created in the user folder of LyX. You can find out where this folder is located by choosing Help --> About LyX, where the path to the User directory is given.
Here (in Kubuntu) the folder is located in ~/.lyx
, and there is a file called user.bind
in ~/.lyx/bind/
.
Best Answer
As morbusg mentioned, the surround plugin is the way to go.
You select the text eg. using visual mode, then you press
S
and the closing brace}
. You can use any character with a matching partner:]
,>
,)
, etc. If you use the left part of the pair, it additionally surrounds the selected text with a space. Example:Assuming the cursor is on the “C” in “Computational”, then you press
vf:S}
and you get this result:If you press
vf:S[
the result is:Note: In older versions the small
s
was used, but it has been changed in favour of the capitalS
.