I've been using Vim for years (well, decades really...) and a couple of years ago I decided I was going to go all in and learn to do it all from the the home keys. I did the Vim snake game, daily practices, the whole nine yards. So now I am slightly more productive inside Vim and fucking type strings of j's all over everything else I use.
> and fucking type strings of j's all over everything else I use
I have vim navigation setup for navigating tmux, i.e. ctrl-a + h/j/k/l nav left, up, down, right. There are so many times I miss the ctrl-a, and just spam "kkk". I'm vaguely terrified I'm going to be reported to HR.
caps lock + j -> screwed up document too many times
(I don't recall vi having multiple undo, just one level)
Finally switched to emacs. Pleasantly surprised when emacs keystrokes worked all through macos.
I do use vi quite a bit for quick edits of config files. My fingers just figure out that i'm in vi. (and vi supports some emacs keystrokes, like c-n, c-p)
I learned Emacs first, then Vi(m), then I went back to Emacs but with Evil-mode. It's truly the best of both worlds in my opinion.
Much like you, if I need to edit a quick file, I can just fire up Vi or Vim and be on my way. What's nice about Evil, for those unaware, is that I can turn it off whenever I want and go back to Emacs' key-bindings.
However, I have Emacs bindings set-up to work while in 'insert mode' in Evil.I think the package is called 'hybrid-mode' if I am not mistaken? It's been a while since I looked at it, so I apologize.
I find that both styles have certain advantages. For example, If I want to jump to the end of a line to add a semi-colon or something, I rather just Crtl+e while I am in 'insert mode' vs Esc -> shift + a
Though if I want to jump to the corresponding open/close curl brace, I rather use Vi(m) bindings.
I've actually used terminals that didn't have cursor keys, as well as systems with original vi where the cursor keys didn't work because the sysop didn't have termcap set up correctly; and I regard it as somewhat masochistic to deliberately constrain oneself in this way, in the modern world where (in comparison) everyone (who has a serious keyboard) has cursor keys.
Heck, home computers of the early 1980s had cursor keys. And nowadays we don't even have the excuse that there are some barmy terminals around that produce really odd character sequences from the cursor keys that we don't get configurations for out of the box. Even the world of terminals and terminal emulators is mostly DEC-ish now.
I realize that people do it as an exercise, or out of curiosity, sometimes. But I have no intention of ever going back to that world. (-:
To each their own, but it's not that there aren't cursor keys (well, sometimes), but that the move off of home row is too disruptive, mentally. Same thing with the Thinkpad track point. it's not the most accurate, but it's worth it need because it's even closer to home row than even a touchpad.
I used Colemak, and I use unmodified vim bindings. Once you get used to it, it works just fine. I find that after the transition it starts to feel like I'm talking to vim with a shorthand language, rather than muscle memory associations with commands. Instead of the three keys, I now think 'ciw' if I need to change this word, and it isn't any harder to type than on qwerty. On colemak hjkl are still all accessible by your right hand, so the change isn't that bad, even if unintuitive at first.
> it starts to feel like I'm talking to vim with a shorthand language
This is like, the whole _point_ of Vim to me - much less about muscle memory and more about mnemonic ways of interacting with text. `ciw` is "change inside word", `da{` is "delete a tag", `yat` is yank a tag, etc. t and f are "to" and "through" (I think "froo" for that one). vf; is "visually select thru the next semicolon" for example.
The whole combination of motions and text objects is the real magic of Vim for me. Also the g ex command is pretty great too.
With more convenient keybinds you'd get the same associations, just with different keycaps/fingers (like cat would be cut a tag or xat could be aXe a tag), so it's not worth it using the bad defaults on account of this
This was one of the most painful things when learning Colemak, and ultimately probably contributed to me stopping. It's a shame, because it felt really comfortable otherwise.
One fun tidbit about using Vi keybindings in readline is: you can use '*' as a wildcard when searching history. You can't do it in the default Emacs mode. I use this all the time!
Originally I read about this feature in a POSIX spec, noticed it did not work, and filed a bug with readline about it.
They fixed the bug, but since it was only mentioned in the spec for Vi mode, they did not add the feature to Emacs mode.
I'm glad to have done my part to make Vi mode strictly superior to Emacs mode (:
I really like using NeoVim for programmatic text manipulation.[1] I use Spacemacs as my main non-IDE editor and I want to reuse that basic Vim knowledge instead of having to worry about the differences between sed et al.
Typically I will insert a step in the pipeline like for example `nvim -Es +':%s/^/go home/' +'%p'`.
NeoVim rather than Vim since Vim is painful for pipeline text manipulation.
Joey Hess' excellent moreutils¹ comes with vipe which is a generalised solution for these types of tasks. It allows you to run whatever $EDITOR you've configured mid-pipe, making it possible to work your changes up in an interactive editor session. Useful for those of us not smart enough to write up our changes as a series of -c arguments ;)
(It fixes the vim issue by virtue of using a temporary file to do the magic)
Fails to mention my favourite text editor, Sublime Text which has an optional Vim mode built in (Vintage). I personally am using NeoVintageous[0] which allows you to run various ex commands and shell commands, as well as incorporating features from popular plugins such as vim-surround.
Sublime is excellent precisely because it has such excellent non-modal hotkeys out of the box.
I swear, I spent over a year training vim. I still wasn't as quick as I was after a week of sublime. It's pretty much the only proprietary software I shill for.
I also find Sublime Text to have the most well-designed non-Vim keybindings I’ve used. Having used Vim for a decade before trying Sublime, I initially underestimated how well it works even without a Vim plugin.
Two of my favorite tricks: (i) Search in file (Cmd-F), turn on regex mode if it’s not already on (Cmd-Opt-R), search for a pattern (with regex syntax highlighting!), and press Opt-Enter. This places one cursor / selection at every regexp match.(ii) Press Cmd-R to get a list of classes/functions in the file, and navigate with arrow keys (or type to search). Performs roughly the same function as I used code folding for in Vim or imenu for in Emacs. (Sublime also has code folding, but I don’t like the implementation much.)
The VSCode vim plugin gets way too much credit in my opinion. All the core tasks navigating tabs, creating new tabs, dealing with file managers, aren't handled in that plugin nor the nvim plugin. I've actually built my own "vim-esque" hotkeys into VSCode for the core tasks that don't pertain to editing individual files. Maybe I'll drop it someday...
> Once your fingers have learned to speak Vim, they don't want to speak anything else!
My experience is that this definitely isn't true. Not only have I happily used all sorts of text editors in my life; I use emacs keybindings in Unix shells.
> Search in your browser with ctrl/cmd + f.
The irony is not lost that this doesn't say to search in my browser using slash. (-:
The page is also unconsciously right that it should be talking about VIM, not vi. VIM happily recognizes the [Insert] key on my keyboard. Original Joy vi would not have. Even today, nvi ends up swapping the case of a character when I press the [Insert] key in one terminal emulator.
The standard POSIX specification describes the vi line editing mode for the shell command line. They tried to add an emacs mode but... [1]
"In early proposals, the KornShell-derived emacs mode of command line editing was included, even though the emacs editor itself was not. The community of emacs proponents was adamant that the full emacs editor not be standardized because they were concerned that an attempt to standardize this very powerful environment would encourage vendors to ship strictly conforming versions lacking the extensibility required by the community. The author of the original emacs program also expressed his desire to omit the program. Furthermore, there were a number of historical systems that did not include emacs, or included it without supporting it, but there were very few that did not include and support vi. The shell emacs command line editing mode was finally omitted because it became apparent that the KornShell version and the editor being distributed with the GNU system had diverged in some respects. The author of emacs requested that the POSIX emacs mode either be deleted or have a significant number of unspecified conditions. Although the KornShell author agreed to consider changes to bring the shell into alignment, the standard developers decided to defer specification at that time. At the time, it was assumed that convergence on an acceptable definition would occur for a subsequent draft, but that has not happened, and there appears to be no impetus to do so. In any case, implementations are free to offer additional command line editing modes based on the exact models of editors their users are most comfortable with."
For me, it's Emacs keybindings everywhere. Well really readline commands. I don't use super heavily (mainly just C-a, C-b, C-e, C-p, and C-n)
Every computer I use, I remap control to caps lock. On my work Mac, nothing really changes since these commands work globally.
On my home PC, I run stock Ubuntu and use gnome-tweaks to set emacs commands.
These commands are so ingrained on how I edit text, I feel extremely uncomfortable without them. The deal breaker when using a new desktop environment or Windows, is whether I can get this setup up and running.
Does anyone have any hacks for supporting Readline out of Gnome or MacOS?
I made emacs bindings for my video editor (Da Vinci Resolve)...
Muscle memory makes you do weird things.
The emacs bindings for Mac are too limited. After using emacs everywhere on Windows (with autohotkeys), I found going back to Mac quite limiting. Ended up using some hammerspoon to address done of the faults.
Curious, where do you find them lacking? AFAIK they’re present in all cocoa apps. Are there other apps where you wish they were supported, or is it that you wish for more bindings besides the mentioned C-a, C-e, etc?
For me, the lack of incremental search with C-s/C-r is the big one — would love to jump around inside any text field using C-s pattern C-s C-s … CR (especially ergonomic if you use Caps as Ctrl). That’s a bit different than navigating with Cmd-F, which in most apps is (i) not incremental and (ii) often throws the cursor out of the text field.
It is also worth noting that macOS also uses Cmd+Opt as its Meta key (so Cmd-Opt-F and Cmd-Opt-B are the word-wise motions).
This sounds really, really dumb, but learning vim keybindings is the type of subject matter that would lend itself to 'tiktok' video ('influencer' video). A video spending <5 seconds per shortcut could cover ~100 shortcuts in 2-3 minutes, - much faster than reading lists or docs - with the primary advantage of this learning approach being the effortlessness of watching some silly video while flippantly killing time.
There's someone who does the equivalent for hardware fixes. Okay it's not exactly an MIT lecture but I learned a lot from it, and in such a light-hearted way.
If you're using chrome, and have the addon Video Speed Controller [1], you can always reload the page (to get the video back at the start), hit 'd' a bunch of times to speed up the video to something like 10x to get to the part you need quickly (then 'r' to go back to regular speed).
But you're right it's not perfectly convenient. Great for surveying information rapidly though. If you don't catch the precise information, at least you know of it, which I think is half the battle with vim keybindings.
If you like vimium, there's an app called Vimac that's like vimium but for macOS. So you can control all kinds of apps with they keyboard like in vimium.
They mention 'readline' under 'shells', but it's really more general than that. For instance, you can configure plain commandline GDB to use vim key bindings that way, and any other program that uses readline.
Similar can be done for 'editline' (a readline alternative sometimes seen on BSD systems).
Meow inverts the order of commands: instead of vim's verb-count-object order, meow does object-count-verb, if I'm remember David Wilson's video right. This lets it pop up an avy-like overlay (I think it calls them "rulers") so you can see more clearly exactly how far of an extent an action is going to have. Kinda cool. Might try it some day.
> ~evil-mode~ Deprecated, check out Vimpulse or Vim Mode.
Lol, the linked pages for Vimpulse and Vim Mode both start with the statement:
> Superceded by Evil
Though frankly, any Vimmer using Emacs knows this already. Someone's either trolling, or never saw any reason to leave Vim and find out what these are options are really like, picking up the misunderstanding along the way.
I'd totally get that, these lists are awesome and maintaining them is hard work-- it's otherwise pretty great, and congratulations to everyone involved! I've always felt jealous of the folks funning neovim in their browser text-areas.
As an aside: I stick with emacs because of the modal and recursive minibuffer(s) (ie. command-line(s)). What vim setting do I change to be able to use normal mode down there?
> I stick with emacs because of the modal and recursive minibuffer(s) (ie. command-line(s)). What vim setting do I change to be able to use normal mode down there?
Not a setting. Just press Ctrl+F when your cursor is in the command line. After that, and until you finish entering the command, you will be able to use Esc to go into normal mode again.
Emacs is modeless and none of its commands are printing characters so you can just have a buffer and as a command keystroke arrives, just handle it immediately.
(Emacs does have a thing called “modes” but they are unrelated to the use of the term in UI discussions).
I think that is what he said, but about the hard part with vi as opposed to my comment about why emacs would be easier: "...vi’s compound command structure and the awkward access to data in BSD queues..." in other words vi's commands are printing characters, and you have to consume a few before you know what to do, rather than direct, modeless execution, which is painful due to lookahead issues in the input buffer. Then the rest are examples. At least that's how it reads to me.
I use a substantial amount of those products except IDEs (I just use neovim).
When I was forced to use mainstream IDEs, I was thinking it's okay, just slap vim extension and it should be the same. However, I forgot that my snippets are not there, advanced semantic navigation and refactoring is not handled the
way vim does with the config and extensions, ... The conclusion was that, it will look like Vim but it's definitely not the same.
A Kinesis Advantage keyboard with the foot pedal to activate keypad mode and the necessary settings gets you home row navigation, '0', '/', 'y' -- any single key operation that can be implemented as a sequence of keys. Limited, but that's truly every app, even for computers on which you don't have admin/sudo (or just don't want to bother customizing).
That is really nice but not quite the same thing imho, "vim-keybindings" is more than just mashing hjkl. Is is putting keybindings up front and a way to reason about shortcuts. You can often imagine shortcuts you've never even used before and be right surprisingly often.
As a result I also remember shortcuts in apps with vim-keybindings much better.
Those keybindings tend to deviate quite a lot in what they do from the originals, to the point of feeling almost random. Using the same keys as Vim for your custom keybindings doesn't make them "Vim Keybindings".
`j` to jump to next post in Reddit is not "Vim-like" at all for someone familiar with Vim.
That's where the deviation occurs and where the idea of shared keybindings universe falls appart. Yes you have `j` in vi and Vim and `j` in Reddit, but they actually do different things, which requires a tiny bit of mental gymnastics… which is exactly what having the same keybindings everywhere is supposed to prevent.
j to go to the next item in a list is sufficiently Vim-like. Even j is not just one screen line like you’re expecting if you have 'wrap' enabled—that’s gj.
Really, it’s simple domain mismatch. In Vim, gj/gk for physical lines, j/k for logical lines, (/) for sentences, {/} for paragraphs, [[/][/][/]] for sections as they are in certain families of languages. It’s all clearly designed for plain text navigation.
Things like Reddit or an email client or whatever, {/} might be semantically a touch closer, but they’re still not exact matches, and all up j/k is extremely reasonable.
Vi's and Vim's commands are the result of decades of extreme specialization. To the point that it seems ludicrous to even consider going the other way and generalizing them to all kinds of unrelated problems. There is too much domain mismatch, as you put it, for such a thing to be really _useful_.
Somewhat bizarre to make a list of apps with vim keybindings, when most of the functionality of those apps can be achieved already in vim, or the terminal. Obsidian in particular is a terrible experience; even with vim mode on, you still have to switch to the mouse for a lot of GUI operations.
This is a cool list. I built my own chat client a little while back to get vim bindings in the last place it was missing that I spent a lot of time: https://github.com/pkulak/matui
I'm going to give another shot at adding a vim extension to the browser and getting it into muscle memory. I spend too much time there (mickey) mousing around. It looks like the main options on Chrome/Brave are Vimium and cVim. Anyone have any preferences?
Definetly Vimium. I have tested it on both Firefox and Chrome (-ium) and it just works. Remember to blacklist sites that need you to press random keys.
And then there's i3wm that by default uses jkl; not hjkl because that keeps your fingers home. Between that and leaning on emacs/readline bindings I'd probably have a bit of trouble with vim these days.
I don't mind switching depending on context. But I wonder how it works, how can the brain be wired for vim keys in some programs and not in others, how does it do it? I'm vaguely impressed.
When I was using both PCs and (normal) Macs regularly, using a certain MacBook Pro I have set up to run Boot Camp was really annoying. I realized that the laptop itself controlled the mental wiring for me. On a "real" PC I would reach for Control for things like copy, paste, etc. But when I felt an Apple keyboard, my finger reaches for the...Windows Key. D'OH!
Yes, I came across a similar experience. My UHK keyboard has by default, movement mapped to ijkl. I remapped it to hjkl because I figured I'd find that easier, but it turns out there isn't a space in my brain for 'navigating just using hjkl and not the other vim keybindings'. It was easily solved by reverting it back to the default.
I use these all the time. Looks like the article has some hacks to use vim style on macOS but I'm happy using Emacs-ish keybindings by default in Bash and macOS.
This annoyed me, so I used a program called Ukelele to create a custom macOS keyboard layout that modified Option-F, Option-B, and Option-D to not emit symbols and diacritical marks, so I'd get the Emacs style editing functionality for those keys.
Hmm, `man 7 environ` on Linux says “The user's preferred utility to edit text files”, which matches my long-term understanding. The original distinction between `EDITOR` and `VISUAL` was that the latter need not work on a printing terminal. The name `VISUAL` comes from the `ex` command `:visual` — i.e, vi.
Not sure about the URL bar specifically, but Tridactyl is good, despite needing to fight an uphill battle from the Webextention add-on extinction event.
Gmail doesn't have a standalone Desktop app, does it? You're either going to interact with it in a browser tab or a mail client, in which case any of the email clients in the list would work, or the Firefox add-ons.
What's interesting is that Gmail has some limited vim key bindings, just not for editing text, e.g. j and k for moving up and down a list of emails, slash for search.