Hacker News new | ask | show | jobs
by kaushiks 3030 days ago
You can do this in Bash already (Ctrl x Ctrl e is bound to readline's edit-and-execute-command, which will open $EDITOR with the current command), but being able to do this everywhere is nice!
4 comments

What?! That's amazing! You never stop learning bash I guess :)
Similar...look into rlwrap[1]

It attempts to launch an external program with your $EDITOR (vi or emacs) preferred key bindings.

[1] https://linux.die.net/man/1/rlwrap

Thank you! I tried to google how to do this some time ago with no success!

However it looks like it only works with emacs editing mode (set -o emacs). Is there a way to do this in vim editing mode (set -o vi)?

Also it doesn't appear to work in zsh. Is there a zsh equivalent?

For Zsh, add “bindkey '^x^e' edit-command-line” somewhere in your ~/.zshrc and you have it.
In vim editing mode, enter normal mode and push v and the line will be opened in a temp file.
For those of us who use Zsh, the equivalent is “Alt-x edit-command-line”, which can easily be bound to “Ctrl x, Ctrl e” by adding “bindkey '^x^e' edit-commandline” in ~/.zshrc.
I'm using 25.2 and that command is not defined in my emacs.
Sorry if I've misunderstood your comment, but the parent was mentioning a bash key binding, not an emacs one.