blob: bc820e11e195d93d6f18ee8a4024114e79686694 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
" Search within a text object. Useful for finding variables scoped to a loop or
" a function or something.
function! s:search_within(t)
if a:t == "char"
let vtype = 'v'
elseif a:t == "block"
let vtype = ''
else
let vtype = 'V'
endif
call feedkeys('`[' .. vtype .. '`]/\%V', 'n')
endfunction
" g/ followed by a text object will start a search, but limit it to the lines
noremap <silent> g/ <cmd>set operatorfunc=<sid>search_within<cr>g@
vnoremap <silent> g/ <esc>/\%V
|