Hacker News new | past | comments | ask | show | jobs | submit login

Everyone I've seen has trouble with this in the beginning. I'm not an advanced vim user, would it really be impossible to make it modeless without losing too much power?



I'm a vim user myself and I prefer modes.

Part of the vim cult's belief is the Never-Leave-Home-Row. That is, where you first rest most of your fingers on the asdfjkl; keys. Your hands are 99% of the time if you're not actively typing in the document. If Vim didn't have modes then you'd have to drop this concept. But of course, mistakes in vim don't normally result in dozens of people dying. If something happens that I didn't expect I just glance to the lower-left corner of my terminal to see what mode I'm in.


Raskin had a shot at building an editor along these lines but died too soon. His attempt to remove the pain of vi-style modes was by having users hold keys down to get the modal effects. As soon as you release, you're back in command mode. There's a problem with this for frequent interaction: holding down keys contributes to rsi.

A common path to fluency with vi is to live in command mode. When you type something, immediately press escape out of habit. When you want to type something new, develop a habit of pressing a/i/o with confidence that you're already in cmd mode.

If you find yourself navigating in insert mode, that's a red flag.


About RSI, I believe chorded keybindings can alleviate it. And I've seen some nice vi configs where 'jj' == escape, so you're easily back to command mode. Cute idea.


Wow. That jj idea is a good one. I've been down a similar path to that for other purposes. I changed my leader key to space, and now I can save with <leader>w instead of having to do shift to get :w. But I hadn't thought of making escape more convenient. That's an excellent idea.


I also took a moment to appreciate the full beauty of that trick the first time I saw it. And I'm an Emacs user.


In direct contrast to Vim is Emacs, a modeless editor which uses modifier keys to distinguish inserting text from navigation commands. From my perspective, there doesn't appear to be any other way of choosing keybindings that keep Vim's mnemonic/composable command structure without introducing the slight mental overhead of modes.


Right. I wasn't saying that you can't make a modeless editor, only that vim is a modal one.

I find vim's shorthand notation for commands far easier to deal with than emacs's long alt-meta-command constructs. After a quarter-century, I've pretty much got over the weirdness.


Emacs is not modeless. Firstly, it obviously has numerous modes, which have names like fundamental-mode.

Secondly, its commands are modal. When you begin a command with Meta-X or Ctrl-X, Emacs goes into a different mode: the next character typed will not self-insert.

All command parsing is modal.


>All command parsing is modal.

Are you sure? Consider the way command lines are executed in Plan's Acme editor: you drag the pointing device to select the text you want to execute, then you click on the selection with the middle mouse button. (Alternatively, drag with the middle mouse button, then release that button.) There is an one-line-high area (called the tag) at the start of every editor window for typing in commands when you do not want the typing to mess up the buffer (the in-memory copy of the file being edited) itself.


Excellent point. Emacs's modality is in a different dimension than vim's. And includes vim. :)


Well now you're just nitpicking. Vim's notion of a mode is far more central to its operation than that of Emacs. Major/minor modes work differently than do vim's modes.


You could probably make an equally powerful modeless editor but I don't see how it could be anywhere near vim-like. Maybe if you had a foot pedal to indicate what modes to interpret input sequences in.


Some built such a foot pedal: https://github.com/alevchuk/vim-clutch


Use of this silly pedal will hamper the user from learning various insert commands like a, A, o and O, and ones that combine motions with insert like C, cw, and so on.

A switch built into the chair seat which generates ESC when the user gets up could be useful, though.


I should have known. Still made my day.


Vim kinda has this. You can spend your entire time in insert mode, and then use <CTRL>-O to run an individual command.


What about ditching the caps-lock key and making it a "command" key, that you hold down to type in a command?


Typing ":%s/<complex regex>/<replacement>" while holding caps-lock would get old rather fast, in my opinion.


You'd really only need to hold it for the first character of any command, I guess. Though holding shift+capslock+; to write a capslock-: feels weird.


That's not a mode trigger?


But isn't it interesting that people would find that easy to use, despite being modal? This suggests that the conclusion from the article - to avoid modes - misses the point.


Which was precisely my point :)


imo not any more than hitting ctrl-f in notepad to bring up the search dialog is a mode trigger. Meaning I guess technically it is one but I don't parse it as such.


Note that on Mac and Windows, at least, you can trivially do this remapping. I do it on all my computers.

On a Mac, the keyboard preference pane in system prefs has a "modifier keys" section, which is bizarrely separately configurable for the built-in keyboard vs. a USB keyboard on their laptops. On Linux, the configuration is different for the VT vs. window managers.


It's configurable per-keyboard because not all keyboards have modifiers laid out the same way. Mac keyboards have the bottom row ordered Ctrl, Alt, Cmd; Windows keyboards are ordered as Ctrl, Win, Alt. So, if you're using a Windows USB keyboard on an Apple laptop, you'll often want to swap Cmd (= Win) and Alt on the USB keyboard, but leave them alone on the internal one.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: