vimnerdtreetaglist

vim:how to set taglist and nerdtree at one vertical split screen


As pictrue,I think you can understand me. I try to set .vimrc for taglist:

let Tlist_Use_Horiz_Window=1

or

let Tlist_Use_Right_Window = 1

it does work of course.

I try to C+W + H|J|K|L,fail again...

Who is familiar with vim, help me please. enter image description here


Solution

  • There is a vim plugin 'winmanager'. It can set the layout like your description. There are lots of blogs introducing how to set it work with NERDTree and taglist/tagbar. Well, there are also some complaints that winmanager is not under good maintenance . Sometimes it needs modification to the source code to work with NERDTree.

    I would suggest you try winmanager first. If it does not work, you may try my stupid but useful work around:

    function! ToggleNerdtreeTagbar()
    
        " check if NERDTree and Tagbar are opened
        let NERDTree_close = (bufwinnr('NERD_tree') == -1) 
        let Tagbar_close   = (bufwinnr('__Tagbar__') == -1) 
    
        TagbarToggle
        NERDTreeToggle
    
        if NERDTree_close && Tagbar_close
            wincmd K
            wincmd b
            wincmd L
            wincmd h
            exe 'vertical resize 30'
        endif
    
    endfunction
    nmap <C-e> :call ToggleNerdtreeTagbar()<CR>
    

    This will work if 1) taglist or tagbar is on the leftside, 2) you open only one a window at first, then press CTRL-e. You can open other windows then.