54

So my co-worker felt it necessary to go onto my development box and do some code changes, then submit his work to subversion. I never set the commit message editor, and all of a sudden, one day I forgot to add the -m handle and apparently he set the default editor to emacs.

Being that I don't know the first thing about emacs and prefer vim myself, how do I go about changing the default editor for SVN commands to vim after it's already been set? I deleted the .subversion directory under the home directory, and it still prompts me.

6 Answers 6

44

You can add corresponding setting in your $HOME/.subversion/config or %USERPROFILE%\Subversion\config. e.g. for my Windows VM I have got:

[helpers]
editor-cmd = c:/emacs-24.3/bin/runemacs.exe
0
34

Update your SVN_EDITOR environment variable. You can try

echo $SVN_EDITOR

to see if this is set to something else in your shell - in which case you might want to take a look at your .bashrc (or similar) file.

1
  • Thanks! Turns out it was being set in the .bash_profile file.
    – Scott
    Commented Jun 28, 2011 at 12:56
24

The editor to be used by SVN can be set at the Subversion config, as vvlevchenko suggested. Edit the corresponding setting in your %USERPROFILE%\Subversion\config on Windows respectively ~/.subversion/config on BSD, Linux, Mac OS.

To use Emacs with SVN on Windows:

[helpers]
editor-cmd = c:/emacs-24.3/bin/runemacs.exe

To use Nano with SVN on BSD, Linux or Mac OS:

[helpers]
editor-cmd = nano
15

I also found this here (but changed from vim to gedit):

Command:

export SVN_EDITOR=gedit

To permanently set this environment variable, put the below line in your ~/.bash_profile file:

sudo gedit ~/.bash_profile
export SVN_EDITOR=gedit

(save file)

4
  • 4
    Why would you need sudo? Commented May 26, 2015 at 1:06
  • 1
    If gedit is already open, a new tab opens, but the commit message is empty. You have to start gedit in standalone mode with the flag s: export SVN_EDITOR="gedit -s"
    – phobic
    Commented Feb 10, 2017 at 16:37
  • The url is getting 404, maybe the post is being removed?
    – ad3luc
    Commented Jun 26, 2018 at 8:41
  • @ad3luc You don't need to view that person's original post since I already wrote the relevant parts in my answer. (If it helped you, you could upvote it.) If you still did want to see the original post, you could use archive.org: web.archive.org/web/20100611212614/http://techchorus.net/…
    – Ryan
    Commented Jun 26, 2018 at 16:01
3

vim ~/.bashrc

export SVN_EDITOR=vim   

source ~/.bashrc

2

On Ubuntu, default editor for Subversion commit messages can be also changed by selecting default general command line text editor as described here: https://askubuntu.com/a/615181

sudo update-alternatives --config editor

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /bin/nano            40        auto mode
  1            /bin/ed             -100       manual mode
  2            /bin/nano            40        manual mode
  3            /usr/bin/vim.basic   30        manual mode
  4            /usr/bin/vim.tiny    10        manual mode

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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