【问题标题】:VIM ubuntu system wide plugin directoryVIM ubuntu 系统范围的插件目录
【发布时间】:2011-10-03 21:20:55
【问题描述】:

ubuntu 中的 vim 插件目录在哪里。我需要删除 autoclose.vim 插件来解决这里描述的问题: Arrow keys type capital letters instead of moving the cursor

【问题讨论】:

  • 检查~/.vim/bundle/autoclose~/.vim/plugin/autoclose.vim
  • 这是给root用户的,我的目录中没有.vim文件夹。

标签: vim


【解决方案1】:

查看:h runtimepath 以获取有关可能位置的完整描述 您的文件夹(考虑到您没有使用捆绑插件)。摘录如下:

                                *'runtimepath'* *'rtp'* *vimfiles*
'runtimepath' 'rtp'     string  (default:
                                        Unix, Mac OS X: "$HOME/.vim,
                                                $VIM/vimfiles,
                                                $VIMRUNTIME,
                                                $VIM/vimfiles/after,
                                                $HOME/.vim/after"
                                        ...
                        global
                        {not in Vi}
        This is a list of directories which will be searched for runtime
        files:
          filetype.vim  filetypes by file name |new-filetype|
          scripts.vim   filetypes by file contents |new-filetype-scripts|
          autoload/     automatically loaded scripts |autoload-functions|
          colors/       color scheme files |:colorscheme|
          compiler/     compiler files |:compiler|
          doc/          documentation |write-local-help|
          ftplugin/     filetype plugins |write-filetype-plugin|
          indent/       indent scripts |indent-expression|
          keymap/       key mapping files |mbyte-keymap|
          lang/         menu translations |:menutrans|
          menu.vim      GUI menus |menu.vim|
          plugin/       plugin scripts |write-plugin|
          print/        files for printing |postscript-print-encoding|
          spell/        spell checking files |spell|
          syntax/       syntax files |mysyntaxfile|
          tutor/        files for vimtutor |tutor|

        And any other file searched for with the |:runtime| command.

        The defaults for most systems are setup to search five locations:
        1. In your home directory, for your personal preferences.
        2. In a system-wide Vim directory, for preferences from the system
           administrator.
        3. In $VIMRUNTIME, for files distributed with Vim.
                                                        *after-directory*
        4. In the "after" directory in the system-wide Vim directory.  This is
           for the system administrator to overrule or add to the distributed
           defaults (rarely needed)
        5. In the "after" directory in your home directory.  This is for
           personal preferences to overrule or add to the distributed defaults
           or system-wide settings (rarely needed).

        ...

【讨论】:

    【解决方案2】:

    您应该关注 Eric 的评论。

    也就是说,我的 .vimrc 中有这些行:

    --编辑--

    我知道这个答案不是我选择的答案,但感谢 ZyX cmets 我学到了一些东西,所以这里是一个编辑。

    下面几行应该写成:

    nnoremap <Esc>A <up>
    nnoremap <Esc>B <down>
    nnoremap <Esc>C <right>
    nnoremap <Esc>D <left>
    inoremap <Esc>A <up>
    inoremap <Esc>B <down>
    inoremap <Esc>C <right>
    inoremap <Esc>D <left>
    

    恐怕很多人会犯和我一样的错误:原始转义码解决方案就像网络上的任何地方一样,从 Vim wiki 到 SO 通过许多论坛。 p>

    --结束编辑--

    nnoremap <type ctrl+v then Esc to obtain a single char that looks like ^[>A <up>
    nnoremap <type ctrl+v then Esc to obtain a single char that looks like ^[>B <down>
    nnoremap <type ctrl+v then Esc to obtain a single char that looks like ^[>C <right>
    nnoremap <type ctrl+v then Esc to obtain a single char that looks like ^[>D <left>
    inoremap <type ctrl+v then Esc to obtain a single char that looks like ^[>A <up>
    inoremap <type ctrl+v then Esc to obtain a single char that looks like ^[>B <down>
    inoremap <type ctrl+v then Esc to obtain a single char that looks like ^[>C <right>
    inoremap <type ctrl+v then Esc to obtain a single char that looks like ^[>D <left>
    

    并且不需要删除任何插件。

    【讨论】:

    • 不要将原始命令代码添加到文件中,您已经有&lt;...&gt; 表示法和«看起来像^[»的字符表示为&lt;Esc&gt;。令人惊讶,不是吗?请注意,每当我看到此类问题时,&lt;Arrow&gt; 输出的是&lt;Esc&gt;O[A-D],而不是&lt;Esc&gt;[A-D]
    • 当您盲目地关注随机论坛帖子时,您会得到这样的结果。当然,我知道^[ 的意思是&lt;Esc&gt;,但我相信这两种表示法具有不同的“重量”(由于没有更好的词),使用一种而不是另一种是由特定上下文决定的。谢谢你的信息,我马上去试试。您是否有特定的理由将原始命令代码保留在 .vimrc 之外?除了我们已经拥有&lt;...&gt; 的完美理由之外,我的意思是。
    • 除了一些 h/l 移动不便之外,您拥有的原始控制代码越多,保留我的配置的 mercurial 就越有可能将此文件作为二进制文件(因此不会显示差异) .此外,如果您使用:TOhtml:Format 或类似格式格式化您的插件,您将得到这些字符不显示或显示为^[(同样会被复制)。你自己没看到吗:不是写&lt;Esc&gt;,而是写&lt;type ctrl+v then Esc to obtain a single char that looks like ^[&gt;
    • 我不记得 bitbucket/github/{VCS hosting that you are using} 是如何显示这些字符的......但我敢打赌,无论他们选择什么,它都不会被复制为控制代码(虽然我可能错了)。
    • 我可以说一下 bitbucket:它将原始转义显示为一个矩形(对于任何未知字符)并且它被复制为一个转义(所以我在之前的评论中错了),但还有另一个不便之处: 你不能使用&lt;C-r&gt;+ 粘贴逃逸,你需要&lt;C-r&gt;&lt;C-r&gt;+。它也不会从 Opera 中粘贴(猜测它与 Opera 切换到自写工具包并将 vim 更新到 7.3 时引入的非 ASCII 字符粘贴问题有关,并且对 X 剪贴板处理更加严格)。
    【解决方案3】:

    与其阅读'runtimepath'上的规则,我认为获取所有已安装脚本的列表更容易:

    :scriptnames
    

    这将显示 vim 已加载的每个脚本的完整路径。如果只有几个,那么您可以找到您正在寻找的那个(autoclose.vim 用于 OP)。

    如果列表很长,那么您可以在a 寄存器(或任何其他)中捕获scriptnames 的输出,将其粘贴到空缓冲区中,然后搜索您的插件名称:

    :redir @a
    :scriptnames
    :redir END
    :new
    :put a
    :/autoclose\.vim
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-16
      • 1970-01-01
      • 2016-11-12
      • 2015-09-09
      • 1970-01-01
      • 1970-01-01
      • 2016-11-12
      • 2010-10-28
      相关资源
      最近更新 更多