i have this problem: i have this in my _vimrc:
iab dd \mathrm{d}
and it works fine, except when I am editing a line and there is text on the right of the cursor (space or no space in between). Is there anything I can do to fix this? I couldn't find anything in the help files (or here!)..
tha开发者_如何学JAVAnks!
s.franky
This is not directly related to your question but regarding easy text completion, if you don't know it already, you should have a look at the SnipMate plugin.
It inserts snippets of code depending on the context by a simple press of <Tab>
key.
There is already a Tex snippet file that you can easily expand with your own abbreviations.
Your solution works fine, except that I want this to work only after I press space (this is what is meant by non-word character, right? So, I am typing a non-word character, only it doesn't work in all cases) I don't get it. Why does it matter that other text follows, if I still press space? thanks though, this is much better than the previous one not working at all!
@chris morgan: oddly, it's working for me too, sometimes, in an empty document. If I load up a tex document (latex-suite package), it's impossible. But I m not sure it's latex-suite specific. Sometimes this happens for .txt documents, too..
abbreviations like this will trigger when you enter a non-word character. Maybe what you want is rather an inoremap
?
From the documentation:
An abbreviation is only recognized when you type a non-keyword character. This can also be the <Esc> that ends insert mode or the <CR> that ends a command. The non-keyword character which ends the abbreviation is inserted after the expanded abbreviation. An exception to this is the character <C-]>, which is used to expand an abbreviation without inserting any extra characters.
精彩评论