Live data from Hacker News

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

github.com

31–40 of 134 posts

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

#31
post #13

In my opinion, the greatest benefit of using Vim, Emacs or even Acme is how easy it is to create custom tools for your problem at hand, even for one-shot tasks. VSCode is very capable, but it can't compete in this regard (and maybe that's what they want and maybe it's a good call as well).

I've tried using the vim plugin for VSCode many times, and every time I come back to it, it just feels... off? The actual vim keybindings work fine when you're editing the document , but I find that when you want to use some of the other features of the editor, it becomes a bit more tricky/hacky. If MS made an official set of vim keybindings that had better editor support, or even if there was some sort of kill switc…

Have you tried the neovim _integration_ VS Code extension? [0] It's not perfect (I'm still in a terminal 95% of the time, but my current VSCode set up is surprisingly not painful and I find myself using it more frequently) but it gets a lot further along than VsVim did for me (which is probably not a far comparison because I have not actually used VsVim in many years) or VSCodeVim when I tried it recently. YMMV, of course.

A word of advice, though, if you plan to check this out... I'd recommend maintaining a separate neovim install specifically for the VS Code integration and make sure that it has fairly basic vimrc with limited plugins. You have to take care with this because (neo)vim plugins don't always play nicely with VS Code and vice versa.

[0]: https://github.com/asvetliakov/vscode-neovim

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

#32
post #27

The best way to understand and use vim is to learn the "grammar" of vim and then practice using it until you have muscle memory for common movement and editing commands. This stackoverfow post explains how the vi/vim "grammar" works: https://stackoverflow.com/questions/1218390/what-is-your-mos... . A fun way to develop the muscle memory for the normal mode movement keys is to play Nethack ( https://www.nethack.org/ )…

Another fun game to play that focuses a bit more on vim itself: https://vim-adventures.com/ I definitely second playing nethack, whether you want to improve your vim skills or not.

That game is a labor of love by someone - I spent weeks playing it. So much fun solving puzzles and learning at the same time. If I had a criticism is that I'm not sure much has stuck with me. I still use the same 10-15 commands and all the obscure tricks it taught me are gone. Its worth the money just for the fun alone. Great to mess with on a laptop when you're on a plane.

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

#33

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

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 thought I was the only one. That visual delay made me nuts.

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

#34
post #3

Ah Vim, one of the root causes of my imposter syndrome. (The others are CSS Grid, and Kubernetes)

Add real-time safety critical systems, realistic 3D rendering, reverse engineering, quines, Paxos, deep learning, production-quality Haskell, and Boston Dynamics.

- Realistic 3D rendering: start with Ray-Tracing. It's fun!

- Quines: those are dark magic, but not very useful.

- Deep learning: A fancy word for multi-layerd neural network. Interesting concept, but nothing scary.

- Production-quality Haskell: You would be surprised how low-quality some production codes are.

- Boston dynamics: that happens when a group of smart people focus on a subject with no hinderance.

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

#35

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…

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

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

#36

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). Aside from not having to press shift to enter command-mode, this also has the advantage of being more similar to the German layout, which I often have to use.

- And finally I changed ^H and ^I to work outside of terminal emulators (i.e. they send keycodes for Backspace and Tab, respectively).

While this layout is somewhat inconvenient for navigating CUA-derived UIs, I've found it great for use with vi clones and other TUIs.

[1] https://qmk.fm/

[2] https://upload.wikimedia.org/wikipedia/commons/a/a0/KB_Termi...

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

#37

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 think this is a bad idea because remapping keys has significant consequences with compatibility as you develop across more platforms. A good vi user is trying to build universal muscle memory, and making personal exceptions kinda ruins the efficacy of the editor.

For example: I switch between dozens of computers, some are transient VMs or cloud instances, and I cannot afford the time (or simply cannot alter the system) to set each one up to my personal VI specs.

(Ironically, I'm a mac fan, but this is my biggest gripe going between every OS and Apple: the command key is absurd; I tried to remap to make everything work like Ctrl but that hoses the entire system and screws up VNC/RemoteDesktop...)

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

#38
post #27

Earlier quoted context omitted.

Another fun game to play that focuses a bit more on vim itself: https://vim-adventures.com/ I definitely second playing nethack, whether you want to improve your vim skills or not.

That game is a labor of love by someone - I spent weeks playing it. So much fun solving puzzles and learning at the same time. If I had a criticism is that I'm not sure much has stuck with me. I still use the same 10-15 commands and all the obscure tricks it taught me are gone. Its worth the money just for the fun alone. Great to mess with on a laptop when you're on a plane.

the biggest problem is you buy the game for $25 and it only lasts 6 months, that seems a bit crap, doesn't really make sense to me to sell it as a limited time license, which is why I never bought it. But then I'm not exactly the target audience, I already know Vim, but I did enjoy the intro levels when I tried it a while back.

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

#39

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…

my leader character is space, makes things super easy

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

#40
post #22

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 tried mapping both jk and kj to Esc for a while (so I could just mash them in any order), but the slight delay it added to the letters always threw me off my loop.

[deleted]
Post reply on HN