快速使用Gvim而不是Gedit

如何快速使用Gvim(或只是在终端中使用vim)作为默认文本编辑器而不是Gedit?

如果可以做到这一点,我一定是做错了……

Ubuntu 10.10 AMD64。

我假设你的意思是你要更改快速加载的编辑器。

好吧,我做了一些调查…我会告诉你我做了什么然后回答。

  1. 我解雇了这个命令:

    sudo find / -name "*quickly*" -exec grep gedit {} \; 

    它会快速搜索所有文件,然后将其格式化为gedit。 这是一个很长的镜头 – 我应该改进搜索,所以它是快速进入的任何路径 ,但它匹配!

     Binary file /usr/share/quickly/templates/ubuntu-application/internal/quicklyutils.pyc matches editor = "gedit" 
  2. 我在nano中打开/usr/share/quickly/templates/ubuntu-application/internal/quicklyutils.py (不是编译版本),搜索gedit并看到:

     def get_quickly_editors(): '''Return prefered editor for ubuntu-application template''' editor = "gedit" default_editor = os.environ.get("EDITOR") if not default_editor: default_editor = os.environ.get("SELECTED_EDITOR") if default_editor: editor = default_editor return editor 
  3. 从那你可以看到它要求环境价值EDITOR

    只需运行快速命令:

     env EDITOR=gvim quickly edit 

    或导出它以保持

     export EDITOR=gvim quickly edit 

    如果要在会话之间保留导出行,请将导出行添加到~/.bashrc行。

使用Synaptic Package Manager安装GVim后,应该可以在“应用程序”菜单中找到它,您可以右键单击它并将应用程序快捷方式添加到桌面。

那么sudo update-alternatives –config editor呢? 它将更改系统默认编辑器,因此您无需更改单个程序首选项。

来自: 旧文章,但应该仍然有效..