The Compositional Nature of Vim (2014)
ismail.badawi.io
ismail.badawi.io
>Composition: The magic of vim is that it’s comprised of lots of small primitives that compose well together. Among these primitives are motions, operators, and text objects.
This popular Stackoverflow answer also explains vim's concepts of "verb + noun": https://stackoverflow.com/a/1220118
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://en.wikipedia.org/wiki/IBM_PC_keyboard#Keyboard_layou...
The "hjkl" overloaded with arrow movements is also related to why vi requires a "insert/append mode" that more modern text editors don't need. In vi, you're initially in "command mode" and you have to press 'i' or 'a' to insert or append text. In contrast, if you develop a new text editor after the introduction of keyboard hardware that has dedicated arrows/PgUp/PgDn/Home/End/Ins/Del/Fn1-Fn12, you no longer need to architect the editor software to have 2 special modes. Overloading the A-Z alphabet keys with non-text commands is what motivates having to switch between 2 modes. This leads to vi users repeatedly pressing the Esc key multiple times to really make sure they're no longer in text input mode. Instead of "<Esc>:wq<Enter>", the vi "wrong mode by accident" paranoia leads to "<Esc><Esc>:wq<Enter>".
(EDIT ADD: the Esc key double-tap as reflexive muscle-memory may also be related to timeoutlen which many vi users are unaware of and don't change: https://stackoverflow.com/questions/15550100/exit-visual-mod...)
I suppose you could remap most of the vim keys to function keys and so on and do the same thing, but it sure would be a pain to type.
Pressing Esc multiple times might be an issue for terminal vim, but gvim uses different cursors to show what mode you're in.
Then you just end up with emacs.
The modal editing is the defining characteristic of VIM for me, and why I use it everywhere. (directly or emulator plugins)
Rebinding ESC to CAPSLOCK is essential for me though.
I've been using vi/vim/nvim for nearly two decades now and I only press escape (actually C-[, since I mapped caps to control) once each time I need to get out of insert mode. I don't have "wrong mode paranoia" because I can see at a glance what mode I'm in by the appearance of the cursor. When I finish inserting, the cursor moves one place to the left and highlights the last character I inserted. In vim it's even easier because the cursor changes appearance in insert mode.
You misinterpreted. I wasn't taking a cheap shot at vi users. When _I_ use vi, I press Esc multiple times. My behavior is common and this is apparently somewhat of an "in joke" among vi users.
It's a behavior similar to pressing 'C' multiple times on calculators to really really clear out the entry. Pointing out that common behavior is not "taking a cheap shot at calculator users". Out of habit, I also press C multiple times on calculators and I don't know why I do that even though my brain's logic says it's redundant.
https://www.reddit.com/r/Showerthoughts/comments/a7qeye/the_...
EDIT ADD: related HN thread about the ":wq" string accidentally being saved in source files because some vi users didn't realize they didn't escape text insert mode: https://news.ycombinator.com/item?id=7798529
Is this a GVim/MacVim thing maybe? Is that slower? Or do all these people hitting ESC twice somehow have bad keyboards which don’t often transmit the ESC key signal?
Also, the reason you hit C on calculators twice is because there is actually a reason to hit it in many calculators, and has no connection with Vim, and the difference between the 2 modes isn’t obvious. Hitting C once only clears the current result, but doesn’t clear the previous results. So if you type in 45+ the calculator after hitting C once (assuming you had 46 typed in), the calculator will add 45 to whatever you had originally. OTOH if you hit it twice, in many calculators it will also additionally clear out the previous results, so the 45+ only adds to 0.
I learned vi (not vim) on old DEC and IBM AIX machines via Telnet (not local GUI). With those more primitive console emulators, the cursor change for different modes wasn't obvious.
>Or do all these people hitting ESC twice somehow have bad keyboards which don’t often transmit the ESC key signal?
The Esc-double-tap was a very common way to make sure you're not in text insert mode: https://www.google.com/search?q=vi+"press+esc+twice"+command
For whatever reason (e.g. possibly unawareness of timeoutlen delay causing Esc to behave in unexpected ways), many vi users end up redundantly pressing Esc twice.
>Hitting C once only clears the current result, but doesn’t clear the previous results.
I thought the newer calculators with dedicated "C" (clear) and "CE" (clear entry) didn't require pressing "C" multiple times. (I just tested this on a Texas Instruments desk calculator with dedicated C & CE buttons and it only requires pressing C once to clear out everything. (But I still press C multiple times out of habit.))
Also newer calculators have a distinction. But I’ve definitely used older ones where both keys were on the same button (separated by a slash?) but I know I habitually press C twice and it’s likely because the calculator I used most growing up needed you to press C twice for CE.
I also use “hjkl” for navigation instead of the arrow keys by force of habit because back when I was learning Vi/Vim the arrow keys would sometimes result in odd behavior depending on what system I was in. But “hjkl” always works. Also, modern Mac keyboards...
I dunno if accommodating a key layout out of use for decades is going to address the above perplexed reaction..
The only thing preventing me from switching to evil (I would never switch to vim because it honestly just seems strictly inferior) is that I use Dvorak on a Kinesis keyboard. I’m not sure how well vim keybindings work on Dvorak, but I suspect not very well (atleast the hjkl part). Does anyone have experience with Dvorak and vim/evil? Is it acceptable?
http://ergoemacs.org/emacs/emacs_pinky.html for more about keeping your hands pain-free.
Sorry, no experience with Dvorak and vim or spacemacs.
I do know people who have had wrist problems and found vi more comfortable. I know when I have to type control sequences I find it painful if I do too much.
I'd say just try it and see if you find it more comfortable. Spend a couple weeks suffering through a bit less productivity and see where you are at. I did that a few years ago and am super happy with the results. In my case it was ditching some bad touch-typing habits and switching to a custom keyboard layout to optimize for my environment.
As far as Dvorak, I've heard of people typing in Dvorak but doing command-mode in qwerty. That seems crazy to me, but would definitely work. I can't imaging switching layouts that frequently in my head, but I guess once you got used to it it'd be no big deal.
Emacs is only a bunch of defaults which you should adapt to your needs.