remap NERDTree Double Click to 'T'

后端 未结 2 1839
别跟我提以往
别跟我提以往 2021-02-05 21:08

Using VIM NERDTree Plugin.

Is there any way to remap the Double Click on a File action to open the file silently in a new tab (T)?

2条回答
  •  有刺的猬
    2021-02-05 21:34

    Although my NERDtree version is also reported as 4.2.0 (git cloned 2015-07-22), there seems to have been some major refactoring in the mean time, hence the solution by jens-na in section (3) did not transfer (but there still doesn't seem to be an out-of-the-box solution, either). I had to replace a line in autoload/nerdtree/ui_glue.vim, as per the diff below. (Note: tested on MacVim)

    --- .vim/bundle/nerdtree/autoload/nerdtree/ui_glue.vim.backup    2015-07-22 19:39:53.000000000 +0200
    +++ .vim/bundle/nerdtree/autoload/nerdtree/ui_glue.vim  2015-07-22 19:40:44.000000000 +0200
    @@ -10,7 +10,7 @@
         call NERDTreeAddKeyMap({ 'key': '', 'scope': "all", 'callback': s."handleMiddleMouse" })
         call NERDTreeAddKeyMap({ 'key': '', 'scope': "all", 'callback': s."handleLeftClick" })
         call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "DirNode", 'callback': s."activateDirNode" })
    -    call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "FileNode", 'callback': s."activateFileNode" })
    +    call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "FileNode", 'callback': s."openInNewTab" })
         call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "Bookmark", 'callback': s."activateBookmark" })
         call NERDTreeAddKeyMap({ 'key': '<2-LeftMouse>', 'scope': "all", 'callback': s."activateAll" })
    

提交回复
热议问题