在垂直分割的水平分割中打开窗口

ske*_*key 7 vim

我希望同时打开NERDTree和TagList,但我不需要它们具有整个屏幕高度.相反,我想让它们在一个垂直分割中水平分割.

更具体地说,我希望能够打开一个,比如NERDTree,让它占据屏幕的整个高度.然后当我打开TagList时,让它与已经打开的NERDTree窗口水平分割.

有没有办法做到这一点?可能甚至不是"特定于这两个插件"的方式?

小智 8

NERDTree和Taglist不会在拆分内部打开.

假设你左边有一个分割缓冲区(例如源代码),右边有Taglist.

您可以将它放在一个函数中,并使用映射调用它:

NERDTree    " open NERDTree
wincmd J    " move NERDTree to the very bottom
wincmd k    " move the cursor to the above split (the source code buffer)
wincmd H    " move the split to the very left
wincmd l    " move the cursor back to the NERDTree split
resize 20   " resize the split height to 20
exe 'vertical resize ' . g:NERDTreeWinSize    " reset the split width
Run Code Online (Sandbox Code Playgroud)

这很狡猾,但它确实有效.当分割在屏幕周围跳跃时,您会看到一个短暂的视觉故障.