Stack Overflow for Teams is moving to its own domain! When the migration is complete, you will access your Teams at stackoverflowteams.com , and they

Simple Vim commands you wish you'd known earlier [closed]

submited by
Style Pass
2022-12-03 18:00:36

Stack Overflow for Teams is moving to its own domain! When the migration is complete, you will access your Teams at stackoverflowteams.com , and they will no longer appear in the left sidebar on stackoverflow.com .

I'm learning new commands in Vim all the time, but I'm sure everyone learns something new once in a while. I just recently learned about this:

I really wish I'd known that you can use Ctrl+C instead of Esc to switch out of insert mode. That's been a real productivity boost for me.

The most recent "wow" trick that I learnt is a method of doing complicated search-and-replace. Quite often in the past, I've had a really complicated regexp to do substitutions on and it's not worked. There is a better way:

The "trick" here (for want of a better word) is the way that you can use the search to create the regexp (and 'incsearch' highlights it as you enter characters) and then use an empty pattern in the substitution: the empty pattern defaults to the last search pattern.

^X-F completes using filenames from the current directory. No more copying/pasting from the terminal or painful double checking.

Leave a Comment