How can I use xonsh with edit-command-line in ZSH?

377 Views Asked by At

I'd like to open an editor buffer in ZSH using edit-command-line and have the contents of the buffer executed by xonsh. Is it possible to do this cleanly?

The edit-command-line command in ZSH lets you edit a command line using your editor, which can then be executed by the ZSH interpreter. It is especially useful for complicated, multi-line, commands.

xonsh is a Python-powered shell using Python as the scripting language. I prefer Python to the ZSH language when writing complicated commands.

Extra-credit: It would be nice to tell the editor to use Python syntax highlighting, instead of ZSH.

Thanks!

Note: I can invoke xonsh in the following manner, but it's ugly and the syntax highlighting is wrong:

echo "
<python code>
" | xonsh
0

There are 0 best solutions below