分页: 1 / 1

好奇:怎么默认编辑器被修改了

发表于 : 2007-08-23 11:02
smartcar
有两次类似经历了,这次要想法搞清楚!
我以前默认的编辑器是vim,cvs commit的时候就会叫出来写注释,不过在mutt中写信的时候都是用nano,我自己没有做默认编辑器修改的事情(比如执行 sudo update-alternatives --config editor ),忽然就发现我自己的默认编辑器编程nano了,感觉比较奇怪!
问问大家有无类似经历,或者可以告诉我可以去哪里顺藤摸瓜一下?

发表于 : 2007-08-23 11:05
eexpress
系统默认的就是nano啊。链接而已。

/usr/bin/editor -> /etc/alternatives/editor -> /bin/nano

发表于 : 2007-08-23 11:10
smartcar
多谢!不过确实以前是vim的!
eexpress 写了:系统默认的就是nano啊。链接而已。

/usr/bin/editor -> /etc/alternatives/editor -> /bin/nano

Re: 好奇:怎么默认编辑器被修改了

发表于 : 2011-03-09 10:18
hunterzhu
原来是这样,那我就可以直接
sudo rm /etc/alternatives/editor

sudo ln -s /usr/local/bin/vim /etc/alternatives/editor
就可以改编辑器了?

Re: 好奇:怎么默认编辑器被修改了

发表于 : 2011-03-09 10:21
hunterzhu
改完了之后..
hunter@ser:~$ sudo update-alternatives --config editor

There are 3 alternatives which provide `editor'.

Selection Alternative
-----------------------------------------------
1 /usr/bin/vim.tiny
2 /bin/ed
+ 3 /bin/nano

Press enter to keep the default[*], or type selection number:

囧......
难道就不能加入一个吗?

Re: 好奇:怎么默认编辑器被修改了

发表于 : 2011-03-09 14:12
lilydjwg
hunterzhu 写了:改完了之后..
hunter@ser:~$ sudo update-alternatives --config editor

There are 3 alternatives which provide `editor'.

Selection Alternative
-----------------------------------------------
1 /usr/bin/vim.tiny
2 /bin/ed
+ 3 /bin/nano

Press enter to keep the default[*], or type selection number:

囧......
难道就不能加入一个吗?
可以。不过不用这么折腾吧,设置环境变量 $EDITOR 就 OK 了。

Re: 好奇:怎么默认编辑器被修改了

发表于 : 2011-03-09 20:53
stesen
lilydjwg 写了:
hunterzhu 写了:改完了之后..
hunter@ser:~$ sudo update-alternatives --config editor

There are 3 alternatives which provide `editor'.

Selection Alternative
-----------------------------------------------
1 /usr/bin/vim.tiny
2 /bin/ed
+ 3 /bin/nano

Press enter to keep the default[*], or type selection number:

囧......
难道就不能加入一个吗?
可以。不过不用这么折腾吧,设置环境变量 $EDITOR 就 OK 了。
改$EDITOR是通用的方法, update-alternatives是debian的做法, 直接改/etc/alternatives/editor是山寨的做法, 结果都行