Removed FindInNERDTree, now replaced with native function
This commit is contained in:
parent
2a20f5f863
commit
80102f504b
@ -1,61 +0,0 @@
|
|||||||
" FindInNERDTree
|
|
||||||
"
|
|
||||||
" Description: Moves the cursor to the node in the NERDTree that
|
|
||||||
" represents the current file. Will open directories
|
|
||||||
" to find it.
|
|
||||||
" Last Change: 11/9/09
|
|
||||||
" Version: 1.0
|
|
||||||
" Author: Doug McInnes <doug@dougmcinnes.com>
|
|
||||||
" URL: http://github.com/dmcinnes/find_in_nerd_tree/tree
|
|
||||||
"
|
|
||||||
" A plugin for NERDTree
|
|
||||||
" http://www.vim.org/scripts/script.php?script_id=1658
|
|
||||||
|
|
||||||
function! FindInNERDTree(...)
|
|
||||||
if a:0
|
|
||||||
let l:path = a:1
|
|
||||||
else
|
|
||||||
let l:nerdbuf = 0
|
|
||||||
for item in tabpagebuflist()
|
|
||||||
if bufname(item) =~ "^NERD_tree_"
|
|
||||||
let l:nerdbuf = item
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
|
|
||||||
if l:nerdbuf == bufnr('%')
|
|
||||||
" already in the tree
|
|
||||||
return 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:path = g:NERDTreePath.New(bufname('%'))
|
|
||||||
|
|
||||||
if l:nerdbuf
|
|
||||||
silent! exec bufwinnr(l:nerdbuf) . "wincmd w"
|
|
||||||
else
|
|
||||||
silent! exec "NERDTreeToggle"
|
|
||||||
endif
|
|
||||||
|
|
||||||
call cursor(g:NERDTreeFileNode.GetRootLineNum(), 1)
|
|
||||||
endif
|
|
||||||
let l:root = g:NERDTreeDirNode.GetSelected()
|
|
||||||
|
|
||||||
if l:root.path.compareTo(l:path) == 0
|
|
||||||
return l:root.findNode(l:path)
|
|
||||||
elseif l:path.str() !~ '^' . l:root.path.str()
|
|
||||||
echo "Not in the current NERD tree!"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
let l:node = FindInNERDTree(l:path.getParent())
|
|
||||||
if !empty(l:node)
|
|
||||||
call l:node.open()
|
|
||||||
if a:0
|
|
||||||
return l:node.findNode(l:path)
|
|
||||||
else
|
|
||||||
call NERDTreeRender()
|
|
||||||
call g:NERDTreeFileNode.New(l:path).putCursorHere(1, 0)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
return {}
|
|
||||||
endfunction
|
|
2
vimrc
2
vimrc
@ -174,7 +174,7 @@ endfunction
|
|||||||
" Open the project tree and expose current file in the nerdtree with Ctrl-\
|
" Open the project tree and expose current file in the nerdtree with Ctrl-\
|
||||||
" the winfixwidth call ensures that nerdtree will not resize
|
" the winfixwidth call ensures that nerdtree will not resize
|
||||||
" if we create or remove other windows
|
" if we create or remove other windows
|
||||||
nnoremap <silent> <C-\> :call FindInNERDTree()<CR>:set winfixwidth<CR>
|
nnoremap <silent> <C-\> :NERDTreeFind<CR>:set winfixwidth<CR>
|
||||||
|
|
||||||
" move up/down quickly by using Ctrl-j, Ctrl-k
|
" move up/down quickly by using Ctrl-j, Ctrl-k
|
||||||
" which will move us around by functions
|
" which will move us around by functions
|
||||||
|
Loading…
Reference in New Issue
Block a user