Last Updated: February 25, 2016
·
477
· hlissner

Repeat f/F/t/T in vim with .

If you're like me, you've done:

let mapleader = ','
noremap ; :

But it robs you of ; and ,'s native function, which is to navigate matches for f/F/t/T, like n and N do for / and ? searches.

This is the workaround I use, which requires vim-repeat:

nnoremap <Plug>NextMatch ;
nnoremap <silent> f :<C-u>call repeat#set("\<lt>Plug>NextMatch")<CR>f
nnoremap <silent> F :<C-u>call repeat#set("\<lt>Plug>NextMatch")<CR>F
nnoremap <silent> t :<C-u>call repeat#set("\<lt>Plug>NextMatch")<CR>t
nnoremap <silent> T :<C-u>call repeat#set("\<lt>Plug>NextMatch")<CR>T

This allows you to repeat the last f/F/t/T with .