Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " Tab to cycle through instances of partially complete search pattern {{{
- set wildcharm=<Tab>
- cnoremap <expr> <Tab> BetterIncSearch('tab')
- cnoremap <expr> <S-Tab> BetterIncSearch('stab')
- " better incremental search
- function! BetterIncSearch(key) abort
- if getcmdtype() ==# '/' || getcmdtype() ==# '?'
- if (a:key ==# 'tab' && v:searchforward) || (a:key ==# 'stab' && !v:searchforward)
- return "\<CR>/\<C-r>/"
- else
- return "\<CR>?\<C-r>/"
- endif
- else
- if a:key ==# 'tab'
- return "\<Tab>"
- else
- return "\<S-Tab>"
- endif
- endif
- endfunction
- " }}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement