VIM NERDTree 플러그인 사용.remap NERDTree 더블 클릭 'T'
새 작업 (T)에서 파일을 자동으로 열려면 파일 작업을 두 번 클릭하여 다시 매핑 할 수 있습니까?
VIM NERDTree 플러그인 사용.remap NERDTree 더블 클릭 'T'
새 작업 (T)에서 파일을 자동으로 열려면 파일 작업을 두 번 클릭하여 다시 매핑 할 수 있습니까?
1 소개
이 NERD 트리 버전 4.2.0 작동합니다. 새 탭
에서
2 오픈 디렉토리와 파일 당신이 단순히 ~/.vimrc
에 다음 행을 추가 할 수있는 새 탭에서 디렉토리 및 파일을 열하려는 경우. 새 탭
에서
let g:NERDTreeMapOpenInTabSilent = '<2-LeftMouse>'
3 만 열려있는 파일이 만 더 정교한 뭔가를해야 새 탭에서 파일을 엽니 다. 당신은 파일의 기능 s:bindMappings()
에이 줄을 찾을 수 있습니다
nnoremap <silent> <buffer> <2-leftmouse> :call <SID>openInTabAndCurrent(0,1)<cr>
:와
nnoremap <silent> <buffer> <2-leftmouse> :call <SID>activateNode(0)<cr>
라인을
" 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(".")), 0, col("."))
if currentNode.path.isDirectory
call currentNode.activate(a:keepWindowOpen)
return
else
call s:openInNewTab(a:stayCurrentTab)
return
endif
endif
endfunction
및 교체 :
NERD_tree.vim
어딘가에서이 기능을 추가 NERD_tree.vim
.
내 NERDtree 버전도 4.2.0 (git cloned 2015-07-22)으로보고되었지만 평균 시간에 일부 주요 리팩터링이있는 것 같습니다. 따라서 섹션 (3)의 jens-na 전송하지 못했습니다 (하지만 여전히 아웃 오브 더 박스 솔루션이 아닌 것 같습니다). 아래의 diff에 따라 autoload/nerdtree/ui_glue.vim에서 줄 바꾸기를해야했습니다. (참고 : 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': '<MiddleRelease>', 'scope': "all", 'callback': s."handleMiddleMouse" })
call NERDTreeAddKeyMap({ 'key': '<LeftRelease>', '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" })
이것은 현재 NERDTree를 위해 이것을 수행하는 유일한 방법 인 것처럼 보입니다. 또한 GVim과 함께 Linux를 사용하여 dirs를 두 번 클릭해도 문제가 없습니다. – kjyv
NERDTree의 모든 파일에서 Shift + t를 누릅니다. 죄송합니다. 질문을 다시 읽으십시오. 파일을 자동으로 열지 않고 매핑 만하면됩니다. 시도 중 – kiddorails
직접 [NERDTree의 코드] (https://github.com/scrooloose/nerdtree/blob/master/plugin/NERD_tree.vim#L2869)를 직접 수정해야합니다. – romainl