jistr / vim-nerdtree-tabs

NERDTree and tabs together in Vim, painlessly
Apache License 2.0
1.43k stars 130 forks source link

Always open in tabs #47

Open claudioscordino opened 11 years ago

claudioscordino commented 11 years ago

Hi.

Is there any way of always opening files in tabs instead of splits ? (i.e., open the file in a tab when the user press Return).

Some users, in fact, prefer to use tabs, and would let to open a new tab instead of splitting the window.

Note that this feature has been asked a couple of years ago on Stack Overflow:

http://stackoverflow.com/questions/8680752/how-to-open-a-file-in-new-tab-by-default-in-nerdtree

Can you please add a simple mechanism (a variable or an explanation about how to modify the script) to have this behavior ?

Many thanks.

jistr commented 11 years ago

Hi Claudio,

hmm I don't think I can do any better than what the Stack Overflow page suggests (and the solution there is already quite simple :) ).

Btw I prefer to open files in tabs as well, and the default shortcut for that in nerdtree is t, which is actually easier to reach on keyboard than enter, if you are a touch typist :) And shift-t opens the file in a new tab on background. Maybe we should add this information to the readme in case some users are not aware of it.

claudioscordino commented 11 years ago

You're right. However, I prefer using gvim, where I usually open files through the mouse. In this case, the plugin opens the file using a split instead of a tab.

KarolS commented 10 years ago
let g:NERDTreeMapOpenInTab = '<2-LeftMouse>'

in ~/.vimrc.

Nopik commented 10 years ago

So far I've got ugly (but working) hack: added this:

 call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': "DirNode", 'callback': s."activateDirNode" })

in .vim/bundle/nerdtree/autoload/nerdtree/ui_glue.vim in line 72 (after Enter is mapped to open in tab). Together with

let NERDTreeMapOpenInTab='<Enter>'

I've got what I wanted: enter on file opens file in new tab, but on the directory just expands the directory.

jondkinney commented 9 years ago

Seems like the solution was editing nerdtree source code. Surely there's a better way to allow open in tab support, right? Specifically I'm looking for double click a folder expands folder (as per default) but double click a file opens the file in a new tab. It doesn't seem configurable at the moment since https://github.com/scrooloose/nerdtree/issues/323 appears to be broken.