在Vim中彼此上方打开NERDTree和Tlist [英] Open NERDTree and Tlist above each other in Vim
问题描述
我正在寻找一种方法(自动)在彼此正上方的左侧打开NERDTree和Tlist,以便每个插件占用屏幕高度的一半.我已经找到了这个问题,穆罕默德(Mohammed)的答案正是我所寻找的.但是,我想知道是否有更直接的方法可以做到这一点.
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.
推荐答案
这是一个需要对'taglist.vim'脚本进行少量编辑的解决方案.我还没有解决所有潜在的问题,但是到目前为止,它似乎还不错.修改'taglist.vim'中的'Tlist_Window_Create'函数,使其包含如下所示的elseif
语句:
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
...
我从最新的TagList(v4.5)的第1290行开始插入了此代码. 然后将以下内容添加到您的.vimrc
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
现在,:TT
命令在单个垂直窗口中打开NERDTree上方的TagList.因为它并没有完全分开,但是已经接近了.如果您更喜欢顶部的树,请将上面的abo
更改为split
.
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
.
这篇关于在Vim中彼此上方打开NERDTree和Tlist的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!