仅在以下情况下启用Nerdtree:调用NERDtree

时间:2014-08-13 10:42:37

标签: vim nerdtree

NERDTree插件很棒,但在以下情况下我不需要它:

  • :前
  • CTRL + W Left Right
  • 启用了书呆子树。我想保留内置的VIM导航工具。

我怎样才能在时启用NERDTree:NERDTree

1 个答案:

答案 0 :(得分:1)

NeoBundle支持延迟加载插件。文档甚至引用了NERDTree。

请参阅:h NeoBundleLazy

                                                :NeoBundleLazy
:NeoBundleLazy {repository} [[,{revision}] [,{options}]]
:NeoBundleLazy {repository} ,{revision}, {default} [,{options}]]
                Registers a bundle, but doesn't add it to 'runtimepath'.

                NeoBundleLazy 'The-NERD-tree', {'augroup' : 'NERDTree'}
                NeoBundleSource The-NERD-tree

                You can use it to load plugins for specific filetypes.

                NeoBundleLazy 'Rip-Rip/clang_complete'
                autocmd FileType c,cpp NeoBundleSource clang_complete

:NeoBundleSource [{name}...]                    :NeoBundleSource
                :source  the bundles specified by {name}.
                If {name} is omitted, :source all lazy bundles.
                Note: This command is used to load the bundles configured with
                :NeoBundleLazy.

因此,要自动启用NERDTree,您只需将以下行添加到.vimrc

NeoBundleLazy 'The-NERD-tree', {'augroup' : 'NERDTree'}

然后,当您想要加载NERDTree时,您需要致电NeoBundleSource The-NERD-tree。由于:NERDTree命令在您实际加载The-NERD树之前不存在,因此您需要在.vimrc中定义一个。{1}}命令。在它运行后它会被覆盖。

command! NERDTree :call NERDTree()
function! NERDTree()
    NeoBundleSource The-NERD-tree
    NERDTree
endfunction
相关问题