Skip to content
Advertisement

Terminal edit command in a editor [closed]

I am coming from the postgres world, and am not very new to UNIX. My question is, if there is a way to invoke a editor from command line, and when I close the editor the output flows to the shell. Something similar to e command available in postgres, where I type in a query, edit it easily in a editor instead of in the repl, and then I quit the editor to see the output of what I typed in, along with the query.

Advertisement

Answer

In bash you can ctrl+x, ctrl+e (two stroke combo) to send the shell’s readline to your $EDITOR. On exit of the editor, the command is executed.

Zsh and other shells have similar functionality, that may need to be configured.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement