Live data from Hacker News

Learn Vim (the Smart Way): a book to learn the good parts of Vim

github.com

111–120 of 134 posts

Re: Learn Vim (the Smart Way): a book to learn the good parts of Vim

#111
post #62

I recommend swapping your left CTRL and ALT keys when using vim, as well as CAPS and ESC to avoid RSI. Also, the dot operator is king.

I was using vim for years before discovering the dot operator. Truly a game changer.

Yeah, I use combinations like 'dw...' and 'dd...' a lot. So simple, but a lot of people don't know that's built in.

Re: Learn Vim (the Smart Way): a book to learn the good parts of Vim

#112
post #68

Two things that helped me more than anything with "learning" vim and or ever wanting to use it: 1. Remap your "capslock" key to "escape." Vi was written using an ADM-3A terminal and its keyboard, which you can see here: https://catonmat.net/why-vim-uses-hjkl-as-arrow-keys has the escape-key in a sane place. On modern keyboards, if you can, remap "capslock" to "escape" when pressed alone, and "ctrl" when pressed with…

I just use ctrl-c instead of esc. Infinitely more accessible than esc or even ctrl bracket - it mystifies me why it’s not more commonly known. Only problem is that it quits you out of macros, so you need to use esc then, but that’s easy to remember and I use ctrl-c probably 4 orders of magnitude more than I use macros. (In fact, multi cursor mode in vscode vim obsoletes them for me entirely!)

It’s not that ctrl-c isn’t widely known it’s that Escape and ctrl-c are not equivalent in Vim.

Ctrl-c breaks all kinds of things including repeats, so ctrl-[ is usually a better choice.

Re: Learn Vim (the Smart Way): a book to learn the good parts of Vim

#113

Two things that helped me more than anything with "learning" vim and or ever wanting to use it: 1. Remap your "capslock" key to "escape." Vi was written using an ADM-3A terminal and its keyboard, which you can see here: https://catonmat.net/why-vim-uses-hjkl-as-arrow-keys has the escape-key in a sane place. On modern keyboards, if you can, remap "capslock" to "escape" when pressed alone, and "ctrl" when pressed with…

Remap esc to ‘kj‘ instead. It’s faster to type than ‘jj’ it’s on the home row and doesn’t require a custom binding. The sequence kj is rarely used in English or coding.

What a hackjob that is.

Re: Learn Vim (the Smart Way): a book to learn the good parts of Vim

#114

Earlier quoted context omitted.

When I was first learning Vim I remapped caps lock to escape, and it was a huge improvement. But as I became more comfortable in Vim I realized I was using the control key a lot. I've since remapped caps lock to control, and use ctrl-[ as escape (this is default behavior). I find having an easily accesible control key is very useful, even outside Vim. You can see in your link that it is actually the control key that…

I recently learned this trick since getting a new MacBook pro with the touch bar esc key. I couldn't stand the lack of travel and didn't want to remap keys, now I use the ctrl-[ combo on all keyboards out of habit

that's funny - I'm currently trying the jj remap, but I keep going for esc out of habit

Re: Learn Vim (the Smart Way): a book to learn the good parts of Vim

#116

Earlier quoted context omitted.

Sure, I use VSCode and Intellij and all the beautiful modern IDEs. But I use them with Vim keybindings turned on. Because extremely common things that you do while programming are extremely quick for me to do with vim commands. ci" == delete everything within these quotes, and put me in insert mode. vi{:%s/old_var_name/new_var_name/g == rename a variable within a block qaI" A", jq == make a new macro to quote a line…

Just started doing this for RSI reasons. Not having to constantly reach down to those arrow keys is fabulous .

That's funny - I'd have thought using arrow keys would help prevent RSI 'cos you're having to move your whole arm out of a static position. (Or maybe you don't? Do you just twist your wrist in an awkward position?)

Re: Learn Vim (the Smart Way): a book to learn the good parts of Vim

#117
post #74

Earlier quoted context omitted.

I'm personally a fan of remapping jk or jj to esc, there barely any instances in the english language where you would use those two letters together, and it means you can leave insert mode whilst barely moving your hands :D

I use zz, it's similarly rare and compliments ZZ (save and quit) well.

But how are you gonna solve fizzbuzz?

Re: Learn Vim (the Smart Way): a book to learn the good parts of Vim

#118

Earlier quoted context omitted.

My issue with this is that it causes a delay with every single j that is entered. Only a visual delay that freezes the cursor and then lets it jump by two characters, but irritating for me regardless. Otherwise it's very practical though.

I don’t use it either but I think you can change the delay. Check out :h 'ttimeout' and :h 'ttimeoutlen' Haven’t touched that part of my vimrc in years

Changing the delay will not completely get rid of this phenomenon but will definitely make a ton of my other shortcuts harder to use. That visual delay makes a lot of sense, it's just not a feature that was intended with this specific use in mind and so it seems to behave strange for jj/jk/etc shortcuts.

Re: Learn Vim (the Smart Way): a book to learn the good parts of Vim

#119

Two things that helped me more than anything with "learning" vim and or ever wanting to use it: 1. Remap your "capslock" key to "escape." Vi was written using an ADM-3A terminal and its keyboard, which you can see here: https://catonmat.net/why-vim-uses-hjkl-as-arrow-keys has the escape-key in a sane place. On modern keyboards, if you can, remap "capslock" to "escape" when pressed alone, and "ctrl" when pressed with…

I sort of got obsessed with the aforementioned ADM-3A keyboard layout, so I got myself a keyboard with unofficial QMK[1] support, and with that I remapped my keys as follows: - Tab functions as Escape, Caps Lock as Control. That makes both keys well in reach of my pinky, and I can still use ^I for Tab. - I remapped symbols according to an illustration[2] of the ADM-3A layout on Wikimedia (with some small adjustments)…

I also remap shift-tab to tab in Vim, and then somehow manage to live without being able to actually shift-tab in Vim. I should probably think of some solution for that at some point...

Re: Learn Vim (the Smart Way): a book to learn the good parts of Vim

#120
This book looks really cool, and I appreciate what they're doing.

If I could humbly add, one of the hardest things about learning Vim isn't reading a list of commands, but rather _practicing_ them. So I wrote a list of Vim exercises (or études for the musicians), files requiring various edits, and a daily practice schedule that can be used to drill each distinct skill. Once you've mastered it, you can drop it from your schedule. I found it was really the only way to actually commit some of the more esoteric skills to muscle memory.

Here's a sample for how to practice muscle memory around named registers for yank and put, a skill almost no one I know regularly uses because it's hard to learn just by reading. After writing this and working through the ten minute exercise daily for a couple weeks, it became second nature, and now I can't live without it.

https://github.com/steveshogren/10-minute-vim-exercises/blob...

Post reply on HN