I can’t get Mercurial (hg) to use pico as my EDITOR when I’m using fish shell.

I’ve tried using this and other variations, but nothing seems to help:

set -U EDITOR pico

hg commit will always open vi as the editor, and I do not want that.

UPDATE: Adding setenv EDITOR pico to the file ~/.config/fish/config.fish did what I wanted.

  • 1
    Do you have VISUAL set? – user1686 Jun 8 '12 at 9:02
  • 2
    thanks! setenv worked for me too when trying to set $BUNDLER_EDITOR – Milovan Zogovic Sep 28 '12 at 13:22
  • 3
    You should make your solution a proper answer and mark it as correct. – RazerM Oct 25 '13 at 17:53
  • 1
    Note that setenv is just a compatibility alias for set -gx. In the long wrong you'll be better off avoiding the use of such shims and doing things "the fish way"; e.g., set -gx EDITOR pico. – Kurtis Rader Jun 22 '16 at 14:32

This is the canonical way to do so

set -Ux EDITOR pico
  • U for universal variable
  • x to export it

This FAQ suggests adding set -gx EDITOR pico to ~/.config/fish/config.fish


You can also set a default editor just for git, which will ignore your default setup:

git config --global core.editor pico

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.