开发者

Change SVN message editor

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 .subv开发者_高级运维ersion directory under the home directory, and it still prompts me.


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


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.


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


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)


vim ~/.bashrc

export SVN_EDITOR=vim   

source ~/.bashrc


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜