On 06/22/2010 08:23 AM, Jeremy wrote: > > > On Jun 21, 10:53 pm, aleCodd <[email protected]> wrote: >> Jeremy Conlin-2 wrote: >> >>> I have defined an abbreviation as: >> >>> :iab bi Bible >> >>> This works fine when I type <space>ib<space> but doesn't work when ib >>> is preceded by a parenthesis or any other character. How can I create >>> an abbreviation that will work regardless of what precedes it? >> >> as long as the character before the left-hand-side(lhs) is not a keyword, >> there sould NOT be a problem. >> please check the output for the following command: >> :echo &iskeyword > > The result of doing this command seems to change depending on where I > am in the file. I get one of two responses: > @,48-57,192-255,: > or > !_~,^*,^|,^",192-255 > > I don't understand what either of those mean, but maybe it has > significance to you. > >> the other thing you may want to notice is that if the lhs is only one >> character (for example: iab q Quran) it will work ONLY after a space or a >> tab or -otherwise, when you want still the abbreviation after any character- >> you would have to exit insert mode (i.e. <esc>), and then start insert mode >> again BEFORE you type the lhs. >> see :help :ab. (map.txt, look from line 847). > > Thanks for pointing me to that part of the help section. After > reading, I realized that the problem is not what comes before I enter > the abbreviation, but what is already after it. For example, I will > often (but not always) open and close a parenthesis, then move inside > it to execute my abbreviation. I believe Vim doesn't expand the > abbreviation because there is a close parenthesis immediately after > the abbreviation. If I close the abbreviation with a <CR> instead of > a space, then it works, but I get an extra <CR> which is not wanted > either. Any idea how to get around this? > > Jeremy >
You probably want :imap. imaps will execute without space and no matter what's in front or after. See :help imap. However imap will not show up in the file until you finish typing all of it. It also will lead to a delay after you type leading letters as you're typing some other word. Usually you want to precede it by some char you don't type often, e.g. imap ^b bible. -ak -- Python plugins for vim: outliner, todo list, project manager, calendar, expenses tracker, sortable table, and more | http://lightbird.net/pysuite/ -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
