Using the terminal becomes much more cozy and comfortable after I activate vim-mode.
A mistake 3 words earlier? No problem: <esc>3bcw and I'm good to go.
Want to delete the whole thing? Even easier: <esc>cc
I can even use <esc>v to open the command inside a fully-fledged (neo)vim instance for more complex rework.
If you use (neo)vim already, this is the best way to go as there are no new shortcuts to learn and memorize.
I've been a (n)vim user for 20+ years now, but I hate vi-mode in the shell. However if I feel that I need to do a complex command, I just do ctrl-x+e to open up in neovim (with EDITOR=nvim set). I find it a good middle ground.
Oh wow I didn't know about this, thank you. The underlying feature is called "readline vi-mode" for folks who want to search more about it.
> <esc>cc
Doing control+o in insert mode temporarily places you into normal mode so that you can execute one normal-mode command, and then go back to insert mode again--no need to hit 'i' again.
So, instead of '<esc>cc', '<c-o>S'.
I use vim a lot but not on the shell
A mistake 3 words earlier?
meta-bbbd (not as elegant, I admit)
delete the whole thing?
ctrl-ak (this is even quicker than vim, especially if capslock is mapped to ctrl)
the control-based emacs movements work system-wide on macos btw. I am using ctrl-p and ctrl-n to go up and down lines, ctrl-a and ctrl-e to go to beginning and end of lines while writing this comment in by browser (which has vimium extension)
Sometimes I wish vim just had full emacs bindings while in insert mode. But I don't like to mess with defaults too much.
I keep thinking I should give vim readline a try though, so maybe today. Thanks for the comment.
I've never understood why emacs mode became the default. "set -o vi" is the _first_ command I type in a new shell.
I've been a vim/nvim casual user for the past year or two, and I still feel as if I'm slightly less proficient in it for the amount of time that I put into it.
I really need to get around to playing with it more. I just hope that especially now with genAI that it's not too late for learning it further.
<esc>3bcw
What is your keyboard layout? This looks like a crime against humanity on a regular qwerty kb.The <esc>v has been such a lifesaver at times when having to execute/modify super complex commands!
i went even further and use neovim as my multiplexer
Eh, it's not that different from the default readline commands
A mistake 3 words earlier? No problem: <esc>3 Alt-b Alt-d
Want to delete the whole thing? Even easier: Ctrl-U
I can even use Ctrl-X Ctrl-e to open the command inside a fully-fledged EDITOR instance for more complex rework.
This reminds me of an excerpt from an old Emacs manual:
This weird command is presented with such a benevolent innocence as if it's the simplest thing in the world.I think the better advice for command-line editing would be to set up the mouse.