vim:keys: Only map v_* & v_# if they don't exist
I learned just now that neovim added mappings for these by default in v0.8.0. But instead of checking for neovim, check for the existence of mappings in case vim adds these in the future too.
This commit is contained in:
@@ -124,8 +124,12 @@ function! GetVisualSelection(escape = "", byteescape = 'n')
|
||||
return l:sel
|
||||
endfunction
|
||||
|
||||
vmap * /\V<C-R>=GetVisualSelection('/\')<CR><CR>
|
||||
vmap # ?\V<C-R>=GetVisualSelection('?\')<CR><CR>
|
||||
" In case these do not exist already (At the time of writing only Neovim adds
|
||||
" mappings for these)
|
||||
if maparg('*', 'v', 0, 1) == {}
|
||||
vmap * /\V<C-R>=GetVisualSelection('/\')<CR><CR>
|
||||
vmap # ?\V<C-R>=GetVisualSelection('?\')<CR><CR>
|
||||
endif
|
||||
|
||||
" Extended `*`. Starts vim search (without jump) and ripgrep
|
||||
nmap <leader>* :let @/ = '\<' . expand('<cword>') . '\>' <bar>
|
||||
|
||||
Reference in New Issue
Block a user