" Wanna grep your buffer and be able to jump to one of the matches quickly? " " Use bg or the :G command " In the overlay window: " You're prompted with a filter pattern. Use to cancel. " jumps to the current-line match " q closes the overlay without action function! BufGrep(pattern) let pattern = a:pattern let fc = pattern[0] let lc = pattern[-1] if fc !~ '[[:punct:]]' let fc = '/' let lc = '/' elseif fc != lc let lc = fc let pattern = pattern[1:] else let pattern = pattern[1:-2] endif let pattern = escape(pattern, fc) let data = vimple#redir('global ' . fc . pattern . lc . '#') if data[0] =~ 'Pattern not found:' echohl Warning echo data[0] echohl None return endif call overlay#show( \ data \, { \ '' : ':call BufGrepAccept()' \ , 'q' : ':call overlay#close()' \ } \, {'filter' : 1, 'use_split' : 1}) endfunction function! BufGrepAccept() let num = matchstr(overlay#select_line(), '\d\+') exe 'silent! norm! ' . num . "G" endfunction nnoremap bg :call BufGrep(input('', '/')) command! -nargs=* G call BufGrep()