Hacker News new | past | comments | ask | show | jobs | submit login

I consider myself at least an intermediate user of Vim, and I'm glad that you mentioned the "f" motion (along with its cousins "t" and ";"). I don't think these keys get enough exposure among beginner Vim users (they aren't mentioned in vimtutor), but they allow you to quickly and efficiently move across files and do things like "ct(" (change text up to first left parentheses), which is super useful for changing function names.

Shameless plug: I wrote a plugin (https://github.com/unblevable/quick-scope) that facilitates the use of "f" and family that even beginners can take advantage of.




The commands you mentioned along with "ci'", "ci[", and "ciW" to replace all text between delimiters have been some of my favorite to use. It really annoys me when my terminal's vi-mode doesn't support "ci" (I think it's vim-only).


The "ci" and "ca" commands are part of a Vim-only feature called Text Objects (type :help objects in Vim's command mode, or search the web).

I like using yap and dap to copy/move paragraphs around when I'm editing markdown text.


By the way, in your specific example, "ct(" is not necessarily the most efficient, because most of the time a function name will be a nice alphanumeric string; hence you can use "ciw" which will work anywhere in the string, not only at the beginning.


% is really useful for dealing with functions too. For example, deleting "foo(a + bar(x, y) + c)" by placing the cursor on the "f" and executing "d%".




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

Search: