by thezorg · 3y ago · 0 comments
I used to rely on e.g. `df)` to delete function parameters. The problem is that 1. it doesn't work when the function call spans multiple lines, and 2. it doesn't work if there's a nested function call.
With `d])`, Vim will delete until the next unmatched ')', regardless of which line it's on! And to think this motion is buried under "Various motions": https://vimhelp.org/motion.txt.html#%5D%29.
Edit: an example:
// This will become my_func(foo);
my_func(foo, MakeBar(), MakeBaz());
^One day I used the key binding and then realized a few minutes that I hadn't installed the script on that computer yet. After some searching in :help I realized that I'd not only reimplemented a feature that already exists in vim, but I mapped it to the exact same keys.
Two very useful ones I just saw on there, for undoing movement mistakes:
`` to jump back to where you jumped from
`< to go to the starting character of the last selected visual mode region
These will allow you to go back and forward in your jumplist.
I mapped them to <Tab> and <S-Tab>, this way I can easily move to previous locations.
This is BY FAR my most used shortcut.
ci)
Will delete everything inside parentheses and put you in insert mode.Even works for HTML tags with t I think.
Edit: should be ci) to preserve the parentheses.