Open NERDTree and Tlist above each other in Vim

折月煮酒 提交于 2019-12-06 07:00:03

问题


I'm looking for a way to (automatically) open NERDTree and Tlist on the left side directly above each other, so that each plugin takes up half of the screen height. I already found this question, in which the answer of Mohammed is kind of what I'm looking for. However, I'm wondering if maybe there is a more direct way of doing this.


回答1:


Here's a solution that requires a small edit to the 'taglist.vim' script. I haven't worked out all the potential ramifications, but it seems to work nicely so far. Modify the 'Tlist_Window_Create' function in 'taglist.vim' to include the elseif statement shown here:

...
" Create a new window. If user prefers a horizontal window, then open
" a horizontally split window. Otherwise open a vertically split
" window
if g:Tlist_Use_Horiz_Window
    " Open a horizontally split window
    let win_dir = 'botright'
    " Horizontal window height
    let win_size = g:Tlist_WinHeight
elseif g:Tlist_Use_Split_Window
    " Open the window in a horizontal split  of current window
    let win_dir = 'abo'
    let win_size = g:Tlist_WinWidth
else
...

I inserted this starting at line 1290 in the latest TagList (v4.5). Then add the following to your .vimrc

let Tlist_Use_Split_Window = 1
com TT NERDTree | TlistToggle

Now the :TT command opens the TagList above the NERDTree in a single vertical window. As is it doesn't quite split halfway, but it's close. If you prefer the tree on top change the abo above to split.



来源:https://stackoverflow.com/questions/8173082/open-nerdtree-and-tlist-above-each-other-in-vim

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!