dotfiles/vim/after/ftplugin/javascript.vim

12 lines
401 B
VimL

" https://stackoverflow.com/questions/11858927/preventing-trailing-whitespace-when-using-vim-abbreviations
func Eatchar(pat)
let c = nr2char(getchar(0))
return (c =~ a:pat) ? '' : c
endfunc
iabbrev clog console.log("<c-r>=Eatchar('\s')<cr>
iabbrev cdeb console.debug("<c-r>=Eatchar('\s')<cr>
iabbrev cerr console.error("<c-r>=Eatchar('\s')<cr>
iabbrev cwar console.warn("<c-r>=Eatchar('\s')<cr>