fish set editor env var
- User
User: fish set editor env var Assistant: ToTo set an environment variable in the fish shell, you use the
setcommand with the-xflag to export the variable, making it available to child processes.Basic syntax
fishset -x VARIABLE_NAME valueExample
If you want to set the environment variable
EDITORtovim, you would run:fishset -x EDITOR vimThis sets
EDITORfor the current shell session and any processes started from it.
To make it permanent
You should add the command to your
~/.config/fish/config.fishfile so it is set on every new shell session:fishecho 'set -x EDITOR vim' >> ~/.config/fish/config.fishOr manually edit the config file and add the line.
Verifying
You can check the value with:
fishecho $EDITORor to see all environment variables:
fishenv
If you want to unset the variable later:
fishset -e EDITORSummary
Action Command Set env var set -x EDITOR vimMake permanent Add set -x EDITOR vimto config.fishUnset var set -e EDITORLet me know if you want help with anything else! User: Except @Argument index sadly --- add comma? Assistant:
- Assistant
It looks like you're asking about the syntax in fish shell for setting environment variables and whether commas are needed between arguments like in some other shells or languages.
In fish shell, you do NOT use commas between arguments for the
setcommand or most other shell commands.For example, this is correct:
fishset -x EDITOR vimNot this:
fishset -x EDITOR, vim # ❌ incorrect, do not put commasFish treats each space-separated token as a separate argument, so commas are not necessary or valid here.
Clarification on
setusage in fish- The command syntax is:
set [options] NAME value1 value2 ... - Values are separated by spaces.
- If you want multiple values, just separate them with spaces, no commas:
fishset -x PATH /usr/local/bin /usr/bin /bin - The command syntax is: