feat(neovim): add fix for vim-surround

This commit is contained in:
Felix Schröter 2020-08-14 23:53:15 +02:00
parent 63e5929131
commit 511f115f65
No known key found for this signature in database
GPG key ID: 910ACB9F6BD26F58
2 changed files with 23 additions and 0 deletions

View file

@ -99,6 +99,7 @@ in
]; ];
extraConfig = with builtins; extraConfig = with builtins;
readFile ./init.vim + readFile ./init.vim +
readFile ./vim-surround-fix.vim +
readFile ./which-key.vim + readFile ./which-key.vim +
readFile ./coc.vim; readFile ./coc.vim;
# readFile ./lsp.vim; # readFile ./lsp.vim;

View file

@ -0,0 +1,22 @@
" fix for vim-surround in neovim
" https://github.com/tpope/vim-surround/issues/272
let g:surround_no_mappings = 1
function! SurroundOp(char)
if v:operator ==# 'd'
return "\<plug>D" . a:char . "urround"
elseif v:operator ==# 'c'
return "\<plug>C" . a:char . "urround"
elseif v:operator ==# 'y'
return "\<plug>Y" . a:char . "urround"
endif
return ''
endfunction
omap <expr> s '<esc>'.SurroundOp('s')
omap <expr> S '<esc>'.SurroundOp('S')
imap <C-S> <Plug>Isurround
imap <C-G>s <Plug>Isurround
imap <C-G>S <Plug>ISurround