mirror of
https://github.com/amix/vimrc
synced 2025-07-18 17:44:59 +08:00
merge
This commit is contained in:
@ -1,8 +1,6 @@
|
||||
" ============================================================================
|
||||
" File: NERD_tree.vim
|
||||
" Description: vim global plugin that provides a nice tree explorer
|
||||
" Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
" Last Change: 28 December, 2011
|
||||
" License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
@ -50,6 +48,7 @@ call s:initVariable("g:NERDTreeAutoCenterThreshold", 3)
|
||||
call s:initVariable("g:NERDTreeCaseSensitiveSort", 0)
|
||||
call s:initVariable("g:NERDTreeSortHiddenFirst", 1)
|
||||
call s:initVariable("g:NERDTreeChDirMode", 0)
|
||||
call s:initVariable("g:NERDTreeCreatePrefix", "silent")
|
||||
call s:initVariable("g:NERDTreeMinimalUI", 0)
|
||||
if !exists("g:NERDTreeIgnore")
|
||||
let g:NERDTreeIgnore = ['\~$']
|
||||
@ -67,8 +66,16 @@ call s:initVariable("g:NERDTreeShowFiles", 1)
|
||||
call s:initVariable("g:NERDTreeShowHidden", 0)
|
||||
call s:initVariable("g:NERDTreeShowLineNumbers", 0)
|
||||
call s:initVariable("g:NERDTreeSortDirs", 1)
|
||||
call s:initVariable("g:NERDTreeDirArrows", !nerdtree#runningWindows())
|
||||
|
||||
if !nerdtree#runningWindows()
|
||||
call s:initVariable("g:NERDTreeDirArrowExpandable", "▸")
|
||||
call s:initVariable("g:NERDTreeDirArrowCollapsible", "▾")
|
||||
else
|
||||
call s:initVariable("g:NERDTreeDirArrowExpandable", "+")
|
||||
call s:initVariable("g:NERDTreeDirArrowCollapsible", "~")
|
||||
endif
|
||||
call s:initVariable("g:NERDTreeCascadeOpenSingleChildDir", 1)
|
||||
call s:initVariable("g:NERDTreeCascadeSingleChildDir", 1)
|
||||
|
||||
if !exists("g:NERDTreeSortOrder")
|
||||
let g:NERDTreeSortOrder = ['\/$', '*', '\.swp$', '\.bak$', '\~$']
|
||||
@ -79,12 +86,14 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
call s:initVariable("g:NERDTreeGlyphReadOnly", "RO")
|
||||
|
||||
if !exists('g:NERDTreeStatusline')
|
||||
|
||||
"the exists() crap here is a hack to stop vim spazzing out when
|
||||
"loading a session that was created with an open nerd tree. It spazzes
|
||||
"because it doesnt store b:NERDTreeRoot (its a b: var, and its a hash)
|
||||
let g:NERDTreeStatusline = "%{exists('b:NERDTreeRoot')?b:NERDTreeRoot.path.str():''}"
|
||||
"because it doesnt store b:NERDTree(its a b: var, and its a hash)
|
||||
let g:NERDTreeStatusline = "%{exists('b:NERDTree')?b:NERDTree.root.path.str():''}"
|
||||
|
||||
endif
|
||||
call s:initVariable("g:NERDTreeWinPos", "left")
|
||||
@ -95,6 +104,8 @@ call s:initVariable("g:NERDTreeWinSize", 31)
|
||||
"Note: the space after the command is important
|
||||
if nerdtree#runningWindows()
|
||||
call s:initVariable("g:NERDTreeRemoveDirCmd", 'rmdir /s /q ')
|
||||
call s:initVariable("g:NERDTreeCopyDirCmd", 'xcopy /s /e /i /y /q ')
|
||||
call s:initVariable("g:NERDTreeCopyFileCmd", 'copy /y ')
|
||||
else
|
||||
call s:initVariable("g:NERDTreeRemoveDirCmd", 'rm -rf ')
|
||||
call s:initVariable("g:NERDTreeCopyCmd", 'cp -r ')
|
||||
@ -148,7 +159,7 @@ call nerdtree#ui_glue#setupCommands()
|
||||
"============================================================
|
||||
augroup NERDTree
|
||||
"Save the cursor position whenever we close the nerd tree
|
||||
exec "autocmd BufLeave ". g:NERDTreeCreator.BufNamePrefix() ."* call b:NERDTree.ui.saveScreenState()"
|
||||
exec "autocmd BufLeave ". g:NERDTreeCreator.BufNamePrefix() ."* if g:NERDTree.IsOpen() | call b:NERDTree.ui.saveScreenState() | endif"
|
||||
|
||||
"disallow insert mode in the NERDTree
|
||||
exec "autocmd BufEnter ". g:NERDTreeCreator.BufNamePrefix() ."* stopinsert"
|
||||
@ -185,10 +196,10 @@ function! NERDTreeRender()
|
||||
endfunction
|
||||
|
||||
function! NERDTreeFocus()
|
||||
if nerdtree#isTreeOpen()
|
||||
call nerdtree#putCursorInTreeWin()
|
||||
if g:NERDTree.IsOpen()
|
||||
call g:NERDTree.CursorToTreeWin()
|
||||
else
|
||||
call g:NERDTreeCreator.TogglePrimary("")
|
||||
call g:NERDTreeCreator.ToggleTabTree("")
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@ -196,6 +207,11 @@ function! NERDTreeCWD()
|
||||
call NERDTreeFocus()
|
||||
call nerdtree#ui_glue#chRootCwd()
|
||||
endfunction
|
||||
|
||||
function! NERDTreeAddPathFilter(callback)
|
||||
call g:NERDTree.AddPathFilter(a:callback)
|
||||
endfunction
|
||||
|
||||
" SECTION: Post Source Actions {{{1
|
||||
call nerdtree#postSourceActions()
|
||||
|
||||
|
Reference in New Issue
Block a user