nvim: plugin/visual-star-search: Set mark when doing backward search
While at it, drop calling set hlsearch for * and g* as hlsearch is enabled by default and does not seem to be required.
This commit is contained in:
parent
68581433e3
commit
d4f81fe865
1 changed files with 9 additions and 5 deletions
|
@ -15,9 +15,13 @@ func! s:get_visual_selection_searchpattern() abort
|
|||
endf
|
||||
|
||||
" Read last visual-selection into command line
|
||||
cnoremap <c-r><c-v> <c-r>=join(<sid>get_visual_selection_list(), " ")<cr>
|
||||
inoremap <c-r><c-v> <c-r>=join(<sid>get_visual_selection_list(), " ")<cr>
|
||||
cnoremap <c-r><c-v> <c-r>=join(<sid>get_visual_selection_list(), " ")<CR>
|
||||
inoremap <c-r><c-v> <c-r>=join(<sid>get_visual_selection_list(), " ")<CR>
|
||||
|
||||
xnoremap * <esc>ms/\V<c-r>=<sid>get_visual_selection_searchpattern()<cr><cr>
|
||||
nnoremap <silent> * ms:<c-u>let @/='\V\<'.escape(expand('<cword>'), '/\').'\>'<bar>call histadd('/',@/)<bar>set hlsearch<cr>
|
||||
nnoremap <silent> g* ms:<c-u>let @/='\V' . escape(expand('<cword>'), '/\') <bar>call histadd('/',@/)<bar>set hlsearch<cr>
|
||||
xnoremap * <esc>ms/\V<c-r>=<sid>get_visual_selection_searchpattern()<CR><CR>
|
||||
nnoremap <silent> * ms:<c-u>let @/='\V\<'.escape(expand('<cword>'), '/\').'\>'<Bar>call histadd('/',@/)<CR>
|
||||
nnoremap <silent> g* ms:<c-u>let @/='\V' . escape(expand('<cword>'), '/\') <Bar>call histadd('/',@/)<CR>
|
||||
|
||||
" Use the setting of mark trick for backward search as well.
|
||||
nnoremap <silent> # ms#<CR>
|
||||
nnoremap <silent> g# msg#<CR>
|
||||
|
|
Loading…
Reference in a new issue