如何让窗口大小固定?
当我使用 nerdtree 浏览我的文件时,它总是碰巧使 NerdTree 调整大小以完全填充当前窗口,并且我不知道如何更改其默认宽度。有没有办法让nerdtree窗口的大小固定?或者将窗口大小重置为默认值?
When i am using nerdtree to browse my file, it always happened to make NerdTree to resize to full fill current window, and i don't know how to change to its default width. Is there a method to make the size of nerdtree window fixed? Or reset the window size to default?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
很奇怪你有这个问题,但窗口宽度似乎是通过 g:NERDTreeWinSize 变量设置的,应该是 31 (你可以在插件源代码中看到这一点(参见第 44 行:https://github.com/scrooloose/nerdtree/blob/master/plugin/NERD_tree.vim)
显然,在源脚本中设置这个变量是可行的,但应该有更好的方法在您的
.vimrc
中设置它,您是否尝试过使用
A
来切换 nerdtree 窗口?it is strange that you have this issue, but the widow width seems to be set via
g:NERDTreeWinSize
variable and should be 31 (you can see this in the plugin source (see line 44 here: https://github.com/scrooloose/nerdtree/blob/master/plugin/NERD_tree.vim)obviously, setting this variable in the source script will work, but there should be better ways of setting it in your
.vimrc
.have you tried toggling the nerdtree window using
A
? does that set the correct window size?您可以通过将以下内容添加到 .vimrc 文件中来设置 NERDTree 窗口大小,例如设置为 26:
You can set the NERDTree window size, e.g. to 26, by adding the following to your .vimrc file:
NERDTree 内部使用 winfixwidth。另一个有用的选项是 equalalways,如果关闭,则会禁用自动调整窗口大小创建或关闭窗口时。
Internally NERDTree uses winfixwidth. Another useful option is equalalways, if turned off, disables automatic window resizing when creating or closing windows.