1介绍
这适用于NERD树版本4.2.0.
2在新选项卡中打开目录和文件
如果要在新选项卡中打开目录和文件,只需将以下行添加到〜/ .vimrc.
let g:NERDTreeMapOpenInTabSilent = '<2-LeftMouse>'
3仅在新选项卡中打开文件
" opens a file in a new tab " KeepWindowOpen - dont close the window even if NERDTreeQuitOnopen is set " stayCurrentTab: if 1 then vim will stay in the current tab,if 0 then vim " will go to the tab where the new file is opened function! s:openInTabAndCurrent(keepWindowOpen,stayCurrentTab) if getline(".") ==# s:tree_up_dir_line return s:upDir(0) endif let currentNode = s:TreeFileNode.GetSelected() if currentNode != {} let startToCur = strpart(getline(line(".")),col(".")) if currentNode.path.isDirectory call currentNode.activate(a:keepWindowOpen) return else call s:openInNewTab(a:stayCurrentTab) return endif endif endfunction
并更换线
nnoremap <silent> <buffer> <2-leftmouse> :call <SID>activateNode(0)<cr>
有:
nnoremap <silent> <buffer> <2-leftmouse> :call <SID>openInTabAndCurrent(0,1)<cr>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。