0

How can I add args to the command I use as the $EDITOR in fish shell? Specifically using the export EDITOR=... syntax rather than the set command.

I want to do something like export EDITOR='code --wait', but this doesn't work:

> $EDITOR
code --wait: command not found
1
  • You cannot. Many programs simply pass $EDITOR to execve and don't strip the arguments first. You could point $EDITOR to a script that invokes your editor with the additional parameters. Also, $EDITOR is used in the non-GUI context, $VISUAL is used in the GUI context. You should set them both.
    – waltinator
    Commented Aug 27 at 13:22

1 Answer 1

1

export is a compatibility function only, and won't split the argument into multiple elements. If you can't use set -gx for some reason, try a small script:

#! fish
code --wait $argv

and set $EDITOR to the path of the script.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .