Reputation: 12413
I wrote a small function and added a map to jump to the next line that does not match the two first chars in the current line:
function! JumpToNextNonMatching()
let curr_line = getline('.')
let spattern = '^[^' . curr_line[0] . '][^' . curr_line[1] . ']'
call search(spattern)
endfunction
nnoremap ,n :<C-U>call JumpToNextNonMatching()<CR><C-L>
so if I hit ,n
it will jump to next line that doesn't match the criteria. I would like to use the repeat.vim plugin to use .
to repeat this operation, i.e., jump to the next line that doesn't match the criteria.
How can I do this with the plugin mentioned or are there better alternatives that I can use?
Upvotes: 0
Views: 299
Reputation: 172648
You should have told us what exactly you're struggling with. Using repeat.vim doesn't require many changes:
<Plug>
mapping for repeat to invoke.Here you are:
function! JumpToNextNonMatching()
let curr_line = getline('.')
let spattern = '^[^' . curr_line[0] . '][^' . curr_line[1] . ']'
call search(spattern)
silent! call repeat#set("\<Plug>JumpToNextNonMatching")
endfunction
nnoremap <Plug>JumpToNextNonMatching :<C-U>call JumpToNextNonMatching()<CR><C-L>
nmap ,n <Plug>JumpToNextNonMatching
Upvotes: 3