logoalt Hacker News

RMPRyesterday at 9:48 AM3 repliesview on HN

> For Vim users, I also suggest enabling Vim mode in Zsh. It makes editing commands much faster.

I am also an avid Vim user but I disagree. The default readline is perfectly fine for single line commands (you do have to know your way around some basic commands though C-a/u/k/l/w...). To edit long commands in $EDITOR you can always do C-x C-e in bash/zsh (M-v in Fish). As a matter of fact everytime I pair program with my colleague I always think he is editing those short commands slower than I would have because he has to change modes all the time.


Replies

Loeffelmannyesterday at 12:34 PM

> you can always do C-x C-e in bash/zsh (M-v in Fish).

Thanks I didn't know!

opanyesterday at 10:24 AM

I like to re-add the readline binds after enabling vim mode, and then I only leave insert mode occasionally. C-x C-e really is great, though, I think I do tend to reach for that if I need to do a big edit of a one-liner.

imiricyesterday at 4:53 PM

Changing modes is a single key stroke away. That's hardly a reason to be slow.

Readline settings depend on what you're already used to. If you're comfortable with vi key bindings, then being in normal mode, navigating with `w`/`b`, deleting a word with `dw`, deleting up to a quote with `dt"`, etc., are all done with muscle memory, and should be much faster than learning the equivalent Emacs bindings, pressing unintuitive key chords, or opening the command in an editor. I don't like opening an editor since it's an interruption, and it hides the output of the previous command.

I wish I could have the full power of Vim in my shells. For example, I miss the delete between characters binding. `di"` or `di'` are great for modifying argument values.