Translate

Friday, November 10, 2023

Vim search for the escaped string of a line

command! -nargs=1 SH let @/ = '\V'.escape(<q-args>, '\')|set hlsearch
nnoremap <C-y> _vg_y<Esc>:SH <C-r>"<CR>

_    go to first non-space character in line
g_   go to last non-space character in line
v    start visual selection
y     copy selection
<C-r>" paste copied selection 






No comments:

Blog Archive