Anyone knows how to quickly find the next occurrence of a character (like the f command) but multi-line? I.e. to quickly jump to the next occurrence of some character in a file?
Isn't that what "/" does?
If you're looking for the next "x" then do /x while in command mode.
Then you can hit "n" to advance to the next x, and then the next x, etc.
There are lots of vim cheat sheets out there with all kinds of tips.
There's an example of redefining f
to ignore case in the 'eval.txt' help file.
:h eval.txt
(search for "ignore case" a couple times)
We can modify that to do what you want. Add the following function to your ~/.vimrc
file or better yet, create a plugin file: ~/.vim/plugin/find-char.vim
(create the directories if you do not already have them).
function FindChar() let c = nr2char( getchar() ) let match = search('\V' . c) endfunction
Then, in your ~/.vimrc
add the following line:
nmap f :call FindChar()<CR>
Now, f
should work like you want it to.
BTW, this was tested with Vim 7.2 on Ubuntu 10.04.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With