1. 7
  1.  

  2. 3

    Don’t all of those Control keymaps historically come from Emacs anyway?

    I hate Emacs as an editor but I also hate using vi-mode in my shell.

    1. 1

      Same here. I gave it a good try, but for some reason I just can’t do it!

      1. 2

        I use vi mode, mostly because I find it to be less annoying and more efficient. I ended up trying emacs mode again (switching back to ksh) and I didn’t make it a week. I’ve had my shell in vi mode for years though, and that might be a part of it.

        1. 1

          For me the most immediate** reason is that readline gives you no indication of the mode you’re in. (Zsh does provide that, but for some irrational reason I’ve always been reluctant to switch.)

          ** That is to say, there may be other reasons that keep me from using it; I have yet to discover them, however, for failure to get past this initial hurdle.

          1. 1

            That may be why I don’t use vi-mode in my shell. It may also be that I used emacsish command-line editing in tcsh for a couple of years before I learned to use vi, but ① I switched to bash, which is a bigger change anyway, and ② that was 18 years ago.

        2. 1

          The classic ^U, ^W, ^H from the Unix line driver are older than Emacs and vi.

          1. 1

            I could be mistaken, but I think that in 1975, when EMACS was being standardized, the Unix standard for ^U was @ and for ^H was #. These work better on half-duplex printing terminals, you see.

        3. 2

          Be warned that this mode of Zsh is a rather shoddy emulation of Vi’s bindings. A limitation I run into often is the lack of text objects support. You can ce to change to the end of a word, but you can’t ciw to change the current word. That just ignores the c, enters Insert mode with i, and then types a ‘w’ that you don’t want. It’s no worse than Emacs mode, which doesn’t have a keybinding for changing the current word either, but it does get annoying to constantly be reminded that this isn’t really Vi.


          If you use Prezto, you can enable Vi mode by changing this line in your zpreztorc:

          zstyle ':prezto:module:editor' keymap 'vi'
          
          1. 4

            Text objects are a vim feature.

            And perhaps you want https://github.com/hchbaw/opp.zsh