Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

They are documented in :help left-right-motions, which you can also read at http://vimdoc.sourceforge.net/htmldoc/motion.html#left-right....

fx moves the cursor to the next occurrence of x, and semicolon repeats the search. To repeat the search in the opposite direction, use comma. 4tx moves the cursor right before the 4th occurrence of x right of the cursor in the line. F and T move backwards instead of forwards; in that case, semicolon continues moving backwards and comma moves forwards (similar to / ? n N).

It takes a while to get used to, but it has made me much more efficient compared to when I just pressed wwwww or eeeee or bbbb to get where I wanted in a line.



I also make liberal use of '/' to get around. Sometimes the bit you want is a line or two down so 't' doesn't quite cut it.

I use t / f a lot when cutting things, though there's probably a better way (from the article, I just discovered gn to visually select the next item matching the previous search).

eg, I might have a name that I want to replace in a couple of spots so I find it easy to do something like:

    /AIDOS<CR>cfSNEWNAME<ESC>n.n.n.
It's generally when it's a bit less calculated. If I knew I was replacing a load of stuff I'd use :%s/AIDOS/NEWNAME/gc


Oh my god this is amazing. Thank you!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: