Advertisement
Guest User

Untitled

a guest
May 26th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. " Tab to cycle through instances of partially complete search pattern {{{
  2. set wildcharm=<Tab>
  3. cnoremap <expr> <Tab> BetterIncSearch('tab')
  4. cnoremap <expr> <S-Tab> BetterIncSearch('stab')
  5.  
  6. " better incremental search
  7. function! BetterIncSearch(key) abort
  8. if getcmdtype() ==# '/' || getcmdtype() ==# '?'
  9. if (a:key ==# 'tab' && v:searchforward) || (a:key ==# 'stab' && !v:searchforward)
  10. return "\<CR>/\<C-r>/"
  11. else
  12. return "\<CR>?\<C-r>/"
  13. endif
  14. else
  15. if a:key ==# 'tab'
  16. return "\<Tab>"
  17. else
  18. return "\<S-Tab>"
  19. endif
  20. endif
  21. endfunction
  22. " }}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement