Koepnick

Untitled

Jan 29th, 2019
455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 0.46 KB | None | 0 0
  1. " A simple wrapper for using vim-sandwich interactively
  2.  
  3. nnoremap <expr> <leader>c ":normal saiw" . input("Type: ") . "<cr>"
  4.  
  5. " Or using a custom function
  6. function! Wrap(character)
  7.     let save_pos = getpos(".")
  8.     exec "normal saiw" . a:character
  9.     call setpos(".", save_pos)
  10. endfunction
  11.  
  12. inoremap <c-s>" <c-\><c-O>:call Wrap('"')<cr>
  13. inoremap <c-s>( <c-\><c-O>:call Wrap('(')<cr>
  14. etc.
  15.  
  16. nnoremap <expr> <leader>c ":call Wrap('" . input("Type: ") . "')<cr>"
Add Comment
Please, Sign In to add comment