In my current environment, I open a file with return key in NERDTree, but sometimes I want to open it in a new tab. That being said, there is still more case where I want to open a file in the current buffer, so I don't like to swap it.

So I rather want to open it in a new tab with a separate key, possibly ctrl + return. Is it possible in NERDTree?


It's right there in the NERDTree help. Like it says at the top of the NERDTree window: Press ? for help

" File node mappings~
" double-click,<CR>,o: open in prev window
" t: open in new tab
" T: open in new tab silently

B Layer already answered how to open a file in a new tab. That just leaves: Is it possible with <Ctrl-Enter>. The short answer is: No.

To check if a key or key-combination is mappable, do the following. Start Vim and change into insert mode. Then hit Ctrl-V followed by the key/key-kombination you plan to map.

If you try that with Ctrl-Enter the resulting input in Vim will be ^M (one character) usually displayed in light blue (depends on colorscheme). Now do the same with just Enter. The result is the same ^M as above.

Conclusion: Vim can't distinguish between Ctrl-Enter and Enter, so Ctrl-Enter can't be mapped.


Ctrl-Return, as @Ralf said, you cannot. But other ways yes. Add this to ~/.vimrc:

" in NERDTree, to open-silently file in newtab with Enter, instead of default pressing "T" (same for not silently with Tab instead of t) 
let NERDTreeMapOpenInTab='<TAB>'
let NERDTreeMapOpenInTabSilent='<ENTER>'


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.