Last Updated: February 25, 2016
·
301
· rrix

Edit your commands in bash before running them

Writing long commands in bash is a PITA, escape to vim to make them shine!

Set EDITOR and VISUAL in your .bashrc to vim:
EDITOR=/usr/bin/vim
VISUAL=/usr/bin/vim

and when you need to delve in to a large command, hit Ctrl-X, then Ctrl-E and your vim will open up, and you can :wq your edited command to run it. Multi-line commands are run as multiple commands when you return to bash, as well.