I would like to invoke my own command line editor in bash
or zsh
when Alt+Enter
is being pressed. It should do some editing and submit result to the shell on Enter
. So basically my editor takes current command line content and returns a modified one. Any ideas how to approach integration? I do know how to work with ANSI terminals, just wondering how to integrate my editor console app to the shell in this way.
Custom command line editor in Linux
223 views Asked by Dmitry Nogin At
2
For Bash:
There is a Readline command that opens the current command in an editor,
edit-and-execute-command
. By default, it is bound toC-x C-e
, and it opens the command in what$VISUAL
is set to, or$EDITOR
, or with Emacs.You can set
$VISUAL
to your editor by exporting it into the environment, for example in~/.bashrc
:and bind it to Alt+Enter with
on the command line, or
in
~/.inputrc
.