快速使用 Gvim 而不是 Gedit

bre*_*ews 6 vim gedit gvim quickly application-development

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

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

Ubuntu 10.10 AMD64。

Oli*_*Oli 7

我假设您的意思是要更改在您要求时快速加载的编辑器。

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

  1. 我发射了这个命令:

    sudo find / -name "*quickly*" -exec grep gedit {} \;
    
    Run Code Online (Sandbox Code Playgroud)

    快速搜索所有文件,然后使用 gedit 搜索它们。这是一个很长的镜头——我应该改进搜索,所以它是任何快速进入但匹配的路径

    Binary file /usr/share/quickly/templates/ubuntu-application/internal/quicklyutils.pyc matches
        editor = "gedit"
    
    Run Code Online (Sandbox Code Playgroud)
  2. /usr/share/quickly/templates/ubuntu-application/internal/quicklyutils.py在nano中打开(不是编译版本),搜索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
    
    Run Code Online (Sandbox Code Playgroud)
  3. 从中你可以看到它要求环境值EDITOR

    只需运行您的快速命令:

    env EDITOR=gvim quickly edit
    
    Run Code Online (Sandbox Code Playgroud)

    或将其导出以保留

    export EDITOR=gvim
    quickly edit
    
    Run Code Online (Sandbox Code Playgroud)

    ~/.bashrc如果您希望它在会话之间保持不变,请将导出行添加到您的行中。