3 ms·
Both this website and vimtutor teach basic commands (finger mechanics) but some learn more effectively if they have some of the philosophy and logic of why vi/v
by jasode 5y ago
Both this website and vimtutor teach basic commands (finger mechanics) but some learn more effectively if they have some of the philosophy and logic of why vi/vim works the way it does. For example, this popular Stackoverflow answer explains vim's concepts of "verb + noun" commands: https://stackoverflow.com/questions/1218390/what-is-your-most-productive-shortcut-with-vim/1220118#1220118 https://stackoverflow.com/questions/1218390/what-is-your-mos...
Also, a lot of beginners are perplexed why vi uses "hjkl" keys for cursor movement. It's because the 1976 ADM-3A terminal didn't have any dedicated arrow keys like the 1986 IBM PC 101-key layout: https://catonmat.net/why-vim-uses-hjkl-as-arrow-keys https://catonmat.net/why-vim-uses-hjkl-as-arrow-keys
Without background info like that, learning vi can seem like memorizing random incoherent trivia.
- tinalumfoil 5y ago> Also, a lot of beginners are perplexed why vi uses "hjkl" keys for cursor movement. I really don't understand why people get hung up on this. Vim supports arrow keys. hjkl are convenient alternatives but if you're at the point of not being comfortable switching between normal and insert mode just use the arrow keys. Insisting othereise is insisting you learn everything at once, which is demotivating and unnecessary. Arrow keys are more versatile too. They do the behavior you expect in pretty much any mode.
- agentwiggles 5y agoI knew a vim-evangelist developer once who added bindings to his .vimrc file so that, if you pressed an arrow key in insert mode, it would insert the appropriate arrow symbol. I think this was meant to train the user _not_ to use the arrow keys to navigate around, but rather to switch to normal mode and use hjkl or other movement commands. While I don't approve of this on a practical level, I have to admit that I find the logic of the joke hilarious. You were in insert mode, and you pressed the arrow key, so it ... inserted an arrow.
- jasode 5y ago>I really don't understand why people get hung up on this. Vim supports arrow keys. hjkl are convenient alternatives [...] Maybe because tutorials like vimtutor and this thread's website immediately blast hjkl finger exercises at the brand new user with no context whatsoever. The student is now wondering why they are pressing a seemingly arbitrary and random alphabet key just to move a cursor around. E.g. vimtutor 1st screen: Now, make sure that your Caps-Lock key is NOT depressed and press the j key enough times to move the cursor so that lesson 1.1 completely fills the screen. E.g. this website's 1st instructions: You can use the h and l keys to move the cursor. For learners that need a little bit of scaffolding in the brain to make sense of what keys to press, a little bit of history about the origins of "hjkl" helps. Also, in my case, I learned classic vi (not vim) on DEC UNIX and the arrow keys did not work. Instead, the arrow keys inserted funny control characters depending the terminal emulation. So people used to be forced into using hjkl.
- vram22 5y agoYes, and because the control characters sometimes included the Esc key, this could even take you out of insert mode willy-nilly, and maybe delete / change some of your text, suddenly.
- sureaboutthis 5y agoIf it takes someone that long to figure out these four commands, I'm not sure they should be a programmer at all.
- dbrueck 5y agoOn the hjkl thing, I think it's also good to explain why it was a good idea that the ADM-3A used hjkl, and that's because it allows directional navigation (an extremely common operation) without moving your fingers away from their "home row" position. So vi/vim use those keys not /only/ because some old terminal, but because some old terminal used those keys /and/ there was a benefit to it.
- nojster 5y agoThank you for pointing this out! Having my fingers leave home row as little as possible is vastly superior to reaching for arrow keys and having to reposition my fingers on home row. With vi that made immediate sense to me. Switching to HHKB layout made even more sense, because I now can reach both CTRL and backspace easily without lifting my fingers from home row. I did change my keymap even further, so that arrow keys are mapped to fn+hjkl. This way, I can navigate everything just with hjkl (:
- fzil 5y ago>I did change my keymap even further, so that arrow keys are mapped to fn+hjkl. This way, I can navigate everything just with hjkl (: Yeah once you get used to vim way of working with text you can essentially never go back.