Your Vim Tips!


^[ is also a good alternative to escape key. I use it even on keyboards which have an escape key, because it’s nearer, and is available by default in Vim and Vim emulators.

Edit: I just practiced for a minute and jj/jk are more pleasant than ^[. I added settings for it to my vimrc as well as VSCode and I’m planning to use it instead of ^[ in future.

Thank you for this tip!

1 Like

I think I prefer jk too. I first heard it mentioned in the video here (well worth a watch):

Do you find there’s a trade-off? I stopped using things like jj in insert mode because then if I recall, my j key would hang while waiting for the next keypress. Does that match your experience? And then I think there were a few times when I actually wanted to write “jj”. (Nice quick variable name, for example.)

So now I’ve settled on Caps-Lock set to Control (Mac) but additionally Caps-Lock without a chord or simultaneous keypress I have set to return to normal. That seems to work alright.

Ha, in the goofyness of my dreams I’d like some kind of Vim toe ring, ah, or maybe a sensor on the nose-rests of my glasses so that I could just scrunch my sniffer and return to normal mode. Come to think of it, I believe we’ve found original itch that Elon Musk is desperate to scratch, leading to his infatuation the ultimate in Vim remappings: brain-computer interfaces. First principles or mere yak shaving? :face_with_monocle:

As for Vim tips, I’m not a power user (and mostly use Vim bindings outside of Vim) but I’ve been enjoying getting familiar with registers.

At the same time I’m advancing very slowly because I fear being (again) like a kid at the procrastination playground of editor configuration, playing with productivity tools instead of being productive…

1 Like

Just ran into my first ever issue with using jk when I tried to write Dijkstra in a comment :slight_smile:

1 Like

Haha… hopefully it’s not a word you’ll need to type often? :upside_down_face:

1 Like

:3,4co. copies lines 3 to 4, where . (full stop) means below your cursor

or

:3,4co14 pastes it below line 14. quite handy instead of manually yank

3 Likes

Ah that’s awesome @jaeyson!! I’ve not seen that one before but it’s super handy :sunglasses:

Here is one of them. When in insert mode pressing ctrl+r allows you to insert your register contents. For example Ctrl+r 0 allows you to paste recently yanked text. Also "0 register holds only yanked text and not deleted texts. So you can dd all those blank lines and still be able to paste the copied text.

2 Likes

Helpful tip. Also works with "0p in command mode.
No need to check the register, to see where the yanked text went after deleting those blank lines.
Thank you!

1 Like