Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NERDTree open in a new tab, as last tab in gvim?

Tags:

vim

In NERDTree ShiftT opens file in a new tab, but tab is positioned after the tab in which NERDTree is opened.

It is possible to open the new tab at the end of tabs?

like image 667
kfl62 Avatar asked Oct 22 '10 16:10

kfl62


People also ask

How do I open a NERDTree file in a new tab?

7 Answers. Show activity on this post. s will open the file currently under the cursor in a new vertically split window. Use t to open in a new tab.

How do you switch between tabs in NERDTree?

Ctrl + → arrow will switch to tab that is on the right of current tab.


1 Answers

Create the file ~/.vim/ftplugin/nerdtree.vim with the following contents, then you will not have to edit NERDTree itself:

if exists('b:haveRemappedT')
    finish
endif
let b:haveRemappedT=1
let s:oldmap=maparg('T', 'n')
function! s:LastTab()
    let tab=tabpagenr()
    tabnext
    execute "tabmove ".tabpagenr('$')
    execute "tabn ".tab
endfunction
execute 'nnoremap <buffer> T '.s:oldmap.':call <SID>LastTab()<CR>'
like image 187
ZyX Avatar answered Oct 09 '22 21:10

ZyX