简体   繁体   English

Vim中使用NERDTree菜单后如何恢复原大小?

[英]how to restore the original size after using the NERDTree Menu in Vim?

I use NERDTree as a file explorer and after using its Menu, Vim does not return to its original size, see screenshots below.我使用 NERDTree 作为文件浏览器,在使用它的菜单后,Vim 没有恢复到原来的大小,见下面的截图。

Using NERDTree Menu:使用 NERDTree 菜单: 在此处输入图像描述

After using the Menu:使用菜单后: 在此处输入图像描述

The editor returns to normal only if I resize the terminal window.仅当我调整终端 window 的大小时,编辑器才恢复正常。

My system config我的系统配置

  • Vim-GTK3 9.0 Vim-GTK3 9.0
  • Terminal: Konsole终端:控制台
  • Debian 11 Debian 11

NERDTree Config NERD树配置

  • nmap <Leader>nt:NERDTreeFind<CR>
  • let NERDTreeQuitOnOpen=1
  • let NERDTreeShowHidden=1
  • let g:NERDTreeDirArrowExpandable = '▸'
  • let g:NERDTreeDirArrowCollapsible = '▾'
  • let g:NERDTreeIgnore = ['^node_modules$']

I have a same issue and I have remove vim v9 and install from source last v8 and it's work, I don't know what is happen in 9 version vim with the bottom pane.我有同样的问题,我已经删除了 vim v9 并从源代码安装了最后一个 v8,它工作正常,我不知道底部窗格的 9 版本 vim 中发生了什么。 but I have observe that vim v8 on my remote server have a perfect working.但我观察到远程服务器上的 vim v8 运行良好。

UPD: And I founded issue on the NERDTree repo with the issue: https://github.com/preservim/nerdtree/issues/1321 UPD:我在 NERDTree 回购中发现了问题: https://github.com/preservim/nerdtree/issues/1321

You can set cmdheight to 2 to solve the problem.您可以将cmdheight 设置为2 来解决问题。 Add the following line into your.vimrc将以下行添加到 your.vimrc

set cmdheight=2

This is caused by an incompatibility between NERDTree and Vim 9.0.这是由于 NERDTree 和 Vim 9.0 不兼容造成的。

You can fix it by applying this hotfix to your local copy of NERDTree.您可以通过将此修补程序应用到 NERDTree 的本地副本来修复它。

Some alternatives:一些选择:

  • Add let g:NERDTreeMinimalMenu=1 to your .vimrc to set menu to display in a single linelet g:NERDTreeMinimalMenu=1添加到您的.vimrc以将菜单设置为在一行中显示
  • Use a version of Vim earlier than the 9.0 release使用早于9.0版本的Vim版本

See issue #1321 in the NERDTree repo for more info.有关详细信息,请参阅 NERDTree 存储库中的问题 #1321

This problem remains relevant.这个问题仍然相关。 To restore the window size, you can try these shortcuts:要恢复 window 大小,您可以尝试以下快捷方式:

  • Ctrl+w _
  • Ctrl+w |
  • Ctrl+w =

Source: https://vim.fandom.com/wiki/Resize_splits_more_quickly资料来源: https://vim.fandom.com/wiki/Resize_splits_more_quickly

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM