mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated vim plugins
This commit is contained in:
@ -1,4 +1,8 @@
|
||||
Next
|
||||
- Reuse/reopen existing window trees where possible #244
|
||||
- Remove NERDTree.previousBuf()
|
||||
- Change color of arrow (Leeiio) #630
|
||||
- Improved a tip in README.markdown (ggicci) #628
|
||||
- Shorten delete confimration of empty directory to 'y' (mikeperri) #530
|
||||
- Fix API call to open directory tree in window (devm33) #533
|
||||
- Change default arrows on non-Windows platforms (gwilk) #546
|
||||
|
@ -101,15 +101,13 @@ Stick this in your vimrc:
|
||||
Note: Now start vim with plain `vim`, not `vim .`
|
||||
|
||||
---
|
||||
> How can I open NERDTree on startup, and have my cursor start in the other window?
|
||||
> How can I open NERDTree automatically when vim starts up on opening a directory?
|
||||
|
||||
Stick this in your vimrc:
|
||||
autocmd StdinReadPre * let s:std_in=1
|
||||
autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | endif
|
||||
|
||||
autocmd vimenter * NERDTree
|
||||
autocmd vimenter * wincmd p
|
||||
This window is tab-specific, meaning it's used by all windows in the tab. This trick also prevents NERDTree from hiding when first selecting a file.
|
||||
|
||||
*via [stackoverflow/Yohann](http://stackoverflow.com/questions/4277808/nerdtree-auto-focus-to-file-when-opened-in-new-tab/19330023#19330023)*
|
||||
|
||||
---
|
||||
> How can I map a specific key or shortcut to open NERDTree?
|
||||
|
||||
@ -134,5 +132,5 @@ See here: https://github.com/scrooloose/nerdtree/issues/433#issuecomment-9259069
|
||||
|
||||
Use these variables in your vimrc. Note that below are default arrow symbols
|
||||
|
||||
let g:NERDTreeDirArrowExpandable = '►'
|
||||
let g:NERDTreeDirArrowCollapsible = '▼'
|
||||
let g:NERDTreeDirArrowExpandable = '▸'
|
||||
let g:NERDTreeDirArrowCollapsible = '▾'
|
||||
|
@ -13,9 +13,37 @@ endfunction
|
||||
"FUNCTION: nerdtree#checkForBrowse(dir) {{{2
|
||||
"inits a window tree in the current buffer if appropriate
|
||||
function! nerdtree#checkForBrowse(dir)
|
||||
if a:dir != '' && isdirectory(a:dir)
|
||||
call g:NERDTreeCreator.CreateWindowTree(a:dir)
|
||||
if !isdirectory(a:dir)
|
||||
return
|
||||
endif
|
||||
|
||||
if s:reuseWin(a:dir)
|
||||
return
|
||||
endif
|
||||
|
||||
call g:NERDTreeCreator.CreateWindowTree(a:dir)
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:reuseWin(dir) {{{2
|
||||
"finds a NERDTree buffer with root of dir, and opens it.
|
||||
function! s:reuseWin(dir) abort
|
||||
let path = g:NERDTreePath.New(fnamemodify(a:dir, ":p"))
|
||||
|
||||
for i in range(1, bufnr("$"))
|
||||
unlet! nt
|
||||
let nt = getbufvar(i, "NERDTree")
|
||||
if empty(nt)
|
||||
continue
|
||||
endif
|
||||
|
||||
if nt.isWinTree() && nt.root.path.equals(path)
|
||||
call nt.setPreviousBuf(bufnr("#"))
|
||||
exec "buffer " . i
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
" FUNCTION: nerdtree#completeBookmarks(A,L,P) {{{2
|
||||
|
@ -186,6 +186,10 @@ function! s:NERDTree.previousBuf()
|
||||
return self._previousBuf
|
||||
endfunction
|
||||
|
||||
function! s:NERDTree.setPreviousBuf(bnum)
|
||||
let self._previousBuf = a:bnum
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:NERDTree.render() {{{1
|
||||
"A convenience function - since this is called often
|
||||
function! s:NERDTree.render()
|
||||
|
@ -74,7 +74,7 @@ endfunction
|
||||
function! s:promptToRenameBuffer(bufnum, msg, newFileName)
|
||||
echo a:msg
|
||||
if g:NERDTreeAutoDeleteBuffer || nr2char(getchar()) ==# 'y'
|
||||
let quotedFileName = fnameescape(a:newFilename)
|
||||
let quotedFileName = fnameescape(a:newFileName)
|
||||
" 1. ensure that a new buffer is loaded
|
||||
exec "badd " . quotedFileName
|
||||
" 2. ensure that all windows which display the just deleted filename
|
||||
|
@ -68,8 +68,8 @@ call s:initVariable("g:NERDTreeShowLineNumbers", 0)
|
||||
call s:initVariable("g:NERDTreeSortDirs", 1)
|
||||
|
||||
if !nerdtree#runningWindows()
|
||||
call s:initVariable("g:NERDTreeDirArrowExpandable", "►")
|
||||
call s:initVariable("g:NERDTreeDirArrowCollapsible", "▼")
|
||||
call s:initVariable("g:NERDTreeDirArrowExpandable", "▸")
|
||||
call s:initVariable("g:NERDTreeDirArrowCollapsible", "▾")
|
||||
else
|
||||
call s:initVariable("g:NERDTreeDirArrowExpandable", "+")
|
||||
call s:initVariable("g:NERDTreeDirArrowCollapsible", "~")
|
||||
|
@ -72,8 +72,8 @@ hi def link NERDTreeDir Directory
|
||||
hi def link NERDTreeUp Directory
|
||||
hi def link NERDTreeFile Normal
|
||||
hi def link NERDTreeCWD Statement
|
||||
hi def link NERDTreeOpenable Title
|
||||
hi def link NERDTreeClosable Title
|
||||
hi def link NERDTreeOpenable Directory
|
||||
hi def link NERDTreeClosable Directory
|
||||
hi def link NERDTreeIgnore ignore
|
||||
hi def link NERDTreeRO WarningMsg
|
||||
hi def link NERDTreeBookmark Statement
|
||||
|
Reference in New Issue
Block a user