When my abbreviations are expanded, an additional space character is
added at the end of the expanded text. How do I avoid this character? To avoid an additional space character at the end of the expanded text, you can expand the abbreviation by pressing the CTRL-] key. The abbreviation will be expanded without adding a space character at the end. Another alternative is to use the following function and command:
function! Eatchar(pat) let c = nr2char(getchar()) return (c =~ a:pat) ? '' : c endfunction command! -nargs=+ Iabbr execute "iabbr" . "=Eatchar('\\s')"
Now, define your abbreviations using the new “Iabbr” command instead of the builtin “iabbrev” command. With this command, after expanding the abbreviated text, the next typed space character will be discarded. For more information, read: abbreviations