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.
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