How to open a file in new tab by default in NERDTr

2020-05-21 07:50发布

I want a file to be opened in a new tab when I enter or double click it. I know there is t shortcut but I always open a file in a new tab and enter is more confortable for me.

标签: vim nerdtree
7条回答
萌系小妹纸
2楼-- · 2020-05-21 08:04

s will open the file currently under the cursor in a new vertically split window. Use t to open in a new tab.

查看更多
看我几分像从前
3楼-- · 2020-05-21 08:06

You may want to add https://github.com/Nopik/vim-nerdtree-direnter plugin as well - it fixes the directory opening problem, so enter on directory node will just expand/collapse, not open new tab.

查看更多
\"骚年 ilove
4楼-- · 2020-05-21 08:10

Try adding

let NERDTreeMapOpenInTab='\r'

or

let NERDTreeMapOpenInTab='<ENTER>'

to your .vimrc.

HTH

查看更多
Bombasti
5楼-- · 2020-05-21 08:10

As described in section NERDTreeCustomOpenArgs of the NerdTree help, you can use this option to control the opening behavior of files and directories. Add the following statement to your .vimrc:

let NERDTreeCustomOpenArgs={'file':{'where': 't'}}

This ensures in this case that only files in a new tab are opened. All other combinations can be found in the help.

查看更多
Evening l夕情丶
6楼-- · 2020-05-21 08:15

I use following map to do tab traverse :

nnoremap <C-l> gt
nnoremap <C-h> gT
查看更多
Juvenile、少年°
7楼-- · 2020-05-21 08:16

For the double-click event specifically, it is (only?) possible by slightly changing the NERDtree source code (posted here):

https://stackoverflow.com/a/31570970/5144840

查看更多
登录 后发表回答