mirror of
https://github.com/amix/vimrc
synced 2025-06-16 17:45:00 +08:00
Updated plugins
This commit is contained in:
@ -62,9 +62,10 @@ function! s:MenuController._echoPrompt()
|
||||
|
||||
if self.isMinimal()
|
||||
let selection = self.menuItems[self.selection].text
|
||||
let keyword = matchstr(selection, "\([^ ]*")
|
||||
|
||||
let shortcuts = map(copy(self.menuItems), "v:val['shortcut']")
|
||||
let shortcuts[self.selection] = " " . split(selection)[0] . " "
|
||||
let shortcuts[self.selection] = " " . keyword . " "
|
||||
|
||||
echo "Menu: [" . join(shortcuts, ",") . "] (" . navHelp . " or shortcut): "
|
||||
else
|
||||
|
@ -20,7 +20,7 @@ function! s:NERDTree.changeRoot(node)
|
||||
call self.root.open()
|
||||
|
||||
"change dir to the dir of the new root if instructed to
|
||||
if g:NERDTreeChDirMode ==# 2
|
||||
if g:NERDTreeChDirMode >= 2
|
||||
call self.root.path.changeToDir()
|
||||
endif
|
||||
|
||||
@ -52,7 +52,7 @@ function! s:NERDTree.Close()
|
||||
endif
|
||||
|
||||
call nerdtree#exec(s:NERDTree.GetWinNum() . " wincmd w", 1)
|
||||
call nerdtree#exec("close", 1)
|
||||
call nerdtree#exec("close", 0)
|
||||
if l:useWinId
|
||||
call nerdtree#exec("call win_gotoid(" . l:activeBufOrWin . ")", 0)
|
||||
else
|
||||
@ -148,12 +148,19 @@ function! s:NERDTree.GetWinNum()
|
||||
return bufwinnr(t:NERDTreeBufName)
|
||||
endif
|
||||
|
||||
" If WindowTree, there is no t:NERDTreeBufName variable. Search all windows.
|
||||
for w in range(1,winnr('$'))
|
||||
if bufname(winbufnr(w)) =~# '^' . g:NERDTreeCreator.BufNamePrefix() . '\d\+$'
|
||||
return w
|
||||
endif
|
||||
endfor
|
||||
|
||||
return -1
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:NERDTree.IsOpen() {{{1
|
||||
function! s:NERDTree.IsOpen()
|
||||
return s:NERDTree.GetWinNum() != -1 || bufname('%') =~# '^' . g:NERDTreeCreator.BufNamePrefix() . '\d\+$'
|
||||
return s:NERDTree.GetWinNum() != -1
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:NERDTree.isTabTree() {{{1
|
||||
|
@ -71,9 +71,9 @@ endfunction
|
||||
function! s:Opener._gotoTargetWin()
|
||||
if b:NERDTree.isWinTree()
|
||||
if self._where == 'v'
|
||||
vsplit
|
||||
call self._newVSplit()
|
||||
elseif self._where == 'h'
|
||||
split
|
||||
call self._newSplit()
|
||||
elseif self._where == 't'
|
||||
tabnew
|
||||
endif
|
||||
@ -153,44 +153,18 @@ endfunction
|
||||
|
||||
" FUNCTION: Opener._newSplit() {{{1
|
||||
function! s:Opener._newSplit()
|
||||
" Save the user's settings for splitbelow and splitright
|
||||
let savesplitbelow=&splitbelow
|
||||
let savesplitright=&splitright
|
||||
|
||||
" 'there' will be set to a command to move from the split window
|
||||
" back to the explorer window
|
||||
"
|
||||
" 'back' will be set to a command to move from the explorer window
|
||||
" back to the newly split window
|
||||
"
|
||||
" 'right' and 'below' will be set to the settings needed for
|
||||
" splitbelow and splitright IF the explorer is the only window.
|
||||
"
|
||||
let there= g:NERDTreeWinPos ==# "left" ? "wincmd h" : "wincmd l"
|
||||
let back = g:NERDTreeWinPos ==# "left" ? "wincmd l" : "wincmd h"
|
||||
let right= g:NERDTreeWinPos ==# "left"
|
||||
let below=0
|
||||
|
||||
" Attempt to go to adjacent window
|
||||
call nerdtree#exec(back, 1)
|
||||
|
||||
let onlyOneWin = (winnr("$") ==# 1)
|
||||
|
||||
" If no adjacent window, set splitright and splitbelow appropriately
|
||||
let savesplitright = &splitright
|
||||
if onlyOneWin
|
||||
let &splitright=right
|
||||
let &splitbelow=below
|
||||
else
|
||||
" found adjacent window - invert split direction
|
||||
let &splitright=!right
|
||||
let &splitbelow=!below
|
||||
let &splitright = (g:NERDTreeWinPos ==# "left")
|
||||
endif
|
||||
|
||||
" If only one window (ie. NERDTree), split vertically instead.
|
||||
let splitMode = onlyOneWin ? "vertical" : ""
|
||||
|
||||
" Open the new window
|
||||
try
|
||||
exec(splitMode." sp ")
|
||||
call nerdtree#exec('wincmd p', 1)
|
||||
call nerdtree#exec(splitMode . " split",1)
|
||||
catch /^Vim\%((\a\+)\)\=:E37/
|
||||
call g:NERDTree.CursorToTreeWin()
|
||||
throw "NERDTree.FileAlreadyOpenAndModifiedError: ". self._path.str() ." is already open and modified."
|
||||
@ -200,14 +174,12 @@ function! s:Opener._newSplit()
|
||||
|
||||
"resize the tree window if no other window was open before
|
||||
if onlyOneWin
|
||||
let size = exists("b:NERDTreeOldWindowSize") ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize
|
||||
call nerdtree#exec(there, 1)
|
||||
exec("silent ". splitMode ." resize ". size)
|
||||
let size = exists('b:NERDTreeOldWindowSize') ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize
|
||||
call nerdtree#exec('wincmd p', 1)
|
||||
call nerdtree#exec('silent '. splitMode .' resize '. size, 1)
|
||||
call nerdtree#exec('wincmd p', 0)
|
||||
endif
|
||||
|
||||
" Restore splitmode settings
|
||||
let &splitbelow=savesplitbelow
|
||||
let &splitright=savesplitright
|
||||
endfunction
|
||||
|
||||
@ -215,7 +187,10 @@ endfunction
|
||||
function! s:Opener._newVSplit()
|
||||
let l:winwidth = winwidth('.')
|
||||
|
||||
if winnr('$') == 1
|
||||
let onlyOneWin = (winnr("$") ==# 1)
|
||||
let savesplitright = &splitright
|
||||
if onlyOneWin
|
||||
let &splitright = (g:NERDTreeWinPos ==# "left")
|
||||
let l:winwidth = g:NERDTreeWinSize
|
||||
endif
|
||||
|
||||
@ -229,6 +204,7 @@ function! s:Opener._newVSplit()
|
||||
execute 'silent vertical resize ' . l:winwidth
|
||||
|
||||
call nerdtree#exec(l:currentWindowNumber . 'wincmd w', 0)
|
||||
let &splitright=savesplitright
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Opener.open(target) {{{1
|
||||
|
@ -87,8 +87,13 @@ function! s:Path.changeToDir()
|
||||
endif
|
||||
|
||||
try
|
||||
execute "cd " . dir
|
||||
call nerdtree#echo("CWD is now: " . getcwd())
|
||||
if g:NERDTreeUseTCD && exists(":tcd") == 2
|
||||
execute "tcd " . dir
|
||||
call nerdtree#echo("Tab's CWD is now: " . getcwd())
|
||||
else
|
||||
execute "cd " . dir
|
||||
call nerdtree#echo("CWD is now: " . getcwd())
|
||||
endif
|
||||
catch
|
||||
throw "NERDTree.PathChangeError: cannot change CWD to " . dir
|
||||
endtry
|
||||
|
@ -523,7 +523,8 @@ endfunction
|
||||
" Open an explorer window for this node in the previous window. The explorer
|
||||
" can be a NERDTree window or a netrw window.
|
||||
function! s:TreeDirNode.openExplorer()
|
||||
call self.open({'where': 'p'})
|
||||
execute "wincmd p"
|
||||
execute "edit ".self.path.str({'format':'Edit'})
|
||||
endfunction
|
||||
|
||||
" FUNCTION: TreeDirNode.openInNewTab(options) {{{1
|
||||
|
@ -246,6 +246,12 @@ function! s:TreeFileNode.openInNewTab(options)
|
||||
call self.open(extend({'where': 't'}, a:options))
|
||||
endfunction
|
||||
|
||||
" FUNCTION: TreeFileNode.openExplorer()
|
||||
function! s:TreeFileNode.openExplorer()
|
||||
execute "wincmd p"
|
||||
execute "edit ".self.path.getParent().str({'format':'Edit'})
|
||||
endfunction
|
||||
|
||||
" FUNCTION: TreeFileNode.putCursorHere(isJump, recurseUpward){{{1
|
||||
" Places the cursor on the line number this node is rendered on
|
||||
"
|
||||
|
@ -355,12 +355,15 @@ endfunction
|
||||
" scroll position
|
||||
function! s:UI.saveScreenState()
|
||||
let win = winnr()
|
||||
call g:NERDTree.CursorToTreeWin()
|
||||
let self._screenState = {}
|
||||
let self._screenState['oldPos'] = getpos(".")
|
||||
let self._screenState['oldTopLine'] = line("w0")
|
||||
let self._screenState['oldWindowSize']= winwidth("")
|
||||
call nerdtree#exec(win . "wincmd w", 1)
|
||||
try
|
||||
call g:NERDTree.CursorToTreeWin()
|
||||
let self._screenState['oldPos'] = getpos(".")
|
||||
let self._screenState['oldTopLine'] = line("w0")
|
||||
let self._screenState['oldWindowSize']= winwidth("")
|
||||
call nerdtree#exec(win . "wincmd w", 1)
|
||||
catch
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:UI.setShowHidden(val) {{{1
|
||||
|
Reference in New Issue
Block a user