logoalt Hacker News

ahmedfromtunistoday at 9:18 AM4 repliesview on HN

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.


Replies

piekvorsttoday at 11:18 AM

This reminds me of an excerpt from an old Emacs manual:

    . . . if you forget which commands deal with windows, just type @b[ESC-?]@t[window]@b[ESC].
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.

commandersakitoday at 10:07 AM

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.

show 2 replies
exceptionetoday at 10:32 AM

   <esc>3bcw
What is your keyboard layout? This looks like a crime against humanity on a regular qwerty kb.
show 1 reply
rzmmmtoday at 9:59 AM

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.