Skip to content

Bad practice to configure Fish without universal variables? #9317

Closed Answered by faho
trallnag asked this question in Q&A
Discussion options

You must be logged in to vote

These aren't the same thing.

set -x EDITOR nano creates a variable and marks it to be exported. That means it will be passed to external processes, so if you do git commit it will know your $EDITOR and will run nano to edit your commit message. In this case, because your variable doesn't already exist, it will be made global. It's good practice to spell this out like set -gx EDITOR nano and make it global and exported explicitly.

set -U EDITOR nano makes a universal variable $EDITOR and sets it to nano. It won't be exported unless it's set to be exported somewhere else. And exported universal variables can sometimes be annoyingly sticky, see https://fishshell.com/docs/current/faq.html#why…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@trallnag
Comment options

Answer selected by trallnag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants