本文介绍了当 VIM 启动时,让 NERDtree 不是默认窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始玩 NERDtree 和 VIM,不知道如何让 NERDtree NOT 成为打开时的默认窗口.

I just started playing around with NERDtree and VIM and can't figure out how to make NERDtree NOT be the default window when it opens.

我想在一个窗格中打开 NERDTree,在另一个窗格中打开相关文件,但不是让 NERDTree 选项卡在打开时成为焦点,而是让我正在编辑的文件成为默认焦点.

I'd like to open NERDTree in one pane and the relevant file in another but instead of having the NERDTree tab take focus when it opens, have the file I am editiing by the default focus.

我已经查看了 github 项目,但是对于如何改变这一点的行为并不明显我.其他一切都运行良好.

I have looked at the github project but the behavior for how to change this isn't obvious to me. Everything else is working perfectly.

是否有一个配置指定 VIM 本身启动时要关注哪个窗口,或者这是一个需要设置的 NERDtree 特定配置?

Is there a configuration that specifies which window to focus on in VIM itself when it starts or is this a NERDtree specific configuration that needs to be set?

相关.vimrc配置:

" Open Nerdtree automatically
autocmd vimenter * NERDTree
" Close Nerdtree if no files specified
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" Nerdtree behavior
map <C-n> :NERDTreeToggle<CR>
let NERDTreeHighlightCursorline=1

推荐答案

你试过了吗?

" Start NERDTree
autocmd VimEnter * NERDTree
" Jump to the main window.
autocmd VimEnter * wincmd p

在我看来,根据您的 .vimrc,您正在打开 NERDTree.之后您只想跳到另一个窗口.

It seems to me, based on your .vimrc, that you are opening NERDTree. You just want to jump to the other window afterwards.

这篇关于当 VIM 启动时,让 NERDtree 不是默认窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-09 22:30