vim - Repeating last function call with dot -


i wrote small function , added map jump next line not match 2 first chars in 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 hit ,n jump next line doesn't match criteria. use repeat.vim plugin use . repeat operation, i.e., jump next line doesn't match criteria.

how can plugin mentioned or there better alternatives can use?

you should have told you're struggling with. using repeat.vim doesn't require many changes:

  1. you need introduce intermediate <plug> mapping repeat invoke.
  2. you need register mapping plugin @ end of command's execution.

here 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 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -