Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 1.23 KB

File metadata and controls

26 lines (17 loc) · 1.23 KB

Edit Complex CLI in Editor

When you are writing or editing a particularly long command line in the shell, you can enter the following key combination and spawn of an editor to assist your.

<ctrl>-x-e

When closing the editor the command line entered is executed.

You can specify what editor to use using two different variables.

$ env | grep -e 'EDITOR\|VISUAL'
EDITOR=/usr/local/bin/vim
VISUAL=code --wait --new-window

The shell should pick the appropriate one.

An alternative to <ctrl>-x-e is the command fc (fix command) which can do a lot of things, by default takes the last command from your history. Do note that is does not respect $VISUAL and uses $EDITOR, or: $FCEDIT.

Resources and References