Skip to content

Latest commit

 

History

History
23 lines (14 loc) · 805 Bytes

edit_complex_cli_in_editor.md

File metadata and controls

23 lines (14 loc) · 805 Bytes

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 fc it takes the last command from your history. Do note that is does not respect $VISUAL and uses $EDITOR.

Resources and References