bairui

List abbreviation under cursor - vim

Jan 3rd, 2012
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 0.32 KB | None | 0 0
  1. " List Abbreviations for word behind cursor
  2. " Barry Arthur, Jan 04 2012
  3.  
  4. function! CursorWord()
  5.   return matchstr(strpart(getline('.'), 0, col('.')), '\w\+\ze\s*$')
  6. endfunction
  7.  
  8. function! AbbrList(word)
  9.   exe "iabbr ".a:word
  10.   return "\<c-w>".a:word
  11. endfunction
  12.  
  13. inoremap <expr> <leader>a AbbrList(CursorWord())
Advertisement
Add Comment
Please, Sign In to add comment