21

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.

4
  • 1
    Do you have VISUAL set? Jun 8, 2012 at 9:02
  • 2
    thanks! setenv worked for me too when trying to set $BUNDLER_EDITOR Sep 28, 2012 at 13:22
  • 3
    You should make your solution a proper answer and mark it as correct.
    – RazerM
    Oct 25, 2013 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. Jun 22, 2016 at 14:32

3 Answers 3

31

This is the canonical way to do so

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

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

7

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

git config --global core.editor pico

You must log in to answer this question.

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