Something I learned recently from reading HN comments.

If you're writing a command in Bash, you can actually edit it in VIM (or whatever you have set as $EDITOR in .bashrc).

While writing the command in your terminal, type <ctrl>-x and then <ctr>-e and your editor will open with the already written command text in it.

Once you're done, exit VIM (left as an exercise for the reader), and your command will execute.

@jcbrand set -o vi and you have vi's way of editing in command line itself.


Thanks, that's cool. I did find myself wanting to go back to the default mode because <ctrl>-c doesn't clear the terminal.

set -o emacs appears to do the trick (I remember someone saying that the Bash CLI has emacs bindings by default).

@jcbrand @brie cool stuff, works on ZSH as well.

I used to follow a Linux CMD line account on Twitter, which there was one here. If you know such, I would like to follow:)

@jcbrand unless you have readline set to use vim mode, in which case you just go to normal mode and press "v".

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!