mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Replace YanRing with yank-stack and update plugins
This commit is contained in:
@ -227,24 +227,30 @@ function! s:closeTreeWindow()
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:deleteBookmark(bm) {{{1
|
||||
" if the cursor is on a bookmark, prompt to delete
|
||||
function! s:deleteBookmark(bm)
|
||||
echo "Are you sure you wish to delete the bookmark:\n\"" . a:bm.name . "\" (yN):"
|
||||
" FUNCTION: s:deleteBookmark(bookmark) {{{1
|
||||
" Prompt the user to confirm the deletion of the selected bookmark.
|
||||
function! s:deleteBookmark(bookmark)
|
||||
let l:message = "Delete the bookmark \"" . a:bookmark.name
|
||||
\ . "\" from the bookmark list?"
|
||||
|
||||
if nr2char(getchar()) ==# 'y'
|
||||
try
|
||||
call a:bm.delete()
|
||||
call b:NERDTree.root.refresh()
|
||||
call b:NERDTree.render()
|
||||
redraw
|
||||
catch /^NERDTree/
|
||||
call nerdtree#echoWarning("Could not remove bookmark")
|
||||
endtry
|
||||
else
|
||||
call nerdtree#echo("delete aborted" )
|
||||
let l:choices = "&Yes\n&No"
|
||||
|
||||
echo | redraw
|
||||
let l:selection = confirm(l:message, l:choices, 1, 'Warning')
|
||||
|
||||
if l:selection != 1
|
||||
call nerdtree#echo('bookmark not deleted')
|
||||
return
|
||||
endif
|
||||
|
||||
try
|
||||
call a:bookmark.delete()
|
||||
silent call b:NERDTree.root.refresh()
|
||||
call b:NERDTree.render()
|
||||
echo | redraw
|
||||
catch /^NERDTree/
|
||||
call nerdtree#echoWarning('could not remove bookmark')
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:displayHelp() {{{1
|
||||
@ -255,10 +261,16 @@ function! s:displayHelp()
|
||||
call b:NERDTree.ui.centerView()
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:findAndRevealPath() {{{1
|
||||
function! s:findAndRevealPath()
|
||||
" FUNCTION: s:findAndRevealPath(path) {{{1
|
||||
function! s:findAndRevealPath(path)
|
||||
let l:path = a:path
|
||||
|
||||
if empty(l:path)
|
||||
let l:path = expand('%:p')
|
||||
endif
|
||||
|
||||
try
|
||||
let p = g:NERDTreePath.New(expand("%:p"))
|
||||
let p = g:NERDTreePath.New(l:path)
|
||||
catch /^NERDTree.InvalidArgumentsError/
|
||||
call nerdtree#echo("no file for the current buffer")
|
||||
return
|
||||
@ -581,7 +593,7 @@ function! nerdtree#ui_glue#setupCommands()
|
||||
command! -n=0 -bar NERDTreeClose :call g:NERDTree.Close()
|
||||
command! -n=1 -complete=customlist,nerdtree#completeBookmarks -bar NERDTreeFromBookmark call g:NERDTreeCreator.CreateTabTree('<args>')
|
||||
command! -n=0 -bar NERDTreeMirror call g:NERDTreeCreator.CreateMirror()
|
||||
command! -n=0 -bar NERDTreeFind call s:findAndRevealPath()
|
||||
command! -n=? -complete=file -bar NERDTreeFind call s:findAndRevealPath('<args>')
|
||||
command! -n=0 -bar NERDTreeFocus call NERDTreeFocus()
|
||||
command! -n=0 -bar NERDTreeCWD call NERDTreeCWD()
|
||||
endfunction
|
||||
|
@ -164,20 +164,14 @@ function! s:UI.getPath(ln)
|
||||
let indent = self._indentLevelFor(line)
|
||||
|
||||
"remove the tree parts and the leading space
|
||||
let curFile = self._stripMarkup(line, 0)
|
||||
|
||||
let wasdir = 0
|
||||
if curFile =~# '/$'
|
||||
let wasdir = 1
|
||||
let curFile = substitute(curFile, '/\?$', '/', "")
|
||||
endif
|
||||
let curFile = self._stripMarkup(line)
|
||||
|
||||
let dir = ""
|
||||
let lnum = a:ln
|
||||
while lnum > 0
|
||||
let lnum = lnum - 1
|
||||
let curLine = getline(lnum)
|
||||
let curLineStripped = self._stripMarkup(curLine, 1)
|
||||
let curLineStripped = self._stripMarkup(curLine)
|
||||
|
||||
"have we reached the top of the tree?
|
||||
if lnum == rootLine
|
||||
@ -228,7 +222,7 @@ function! s:UI.getLineNum(file_node)
|
||||
|
||||
let indent = self._indentLevelFor(curLine)
|
||||
if indent ==# curPathComponent
|
||||
let curLine = self._stripMarkup(curLine, 1)
|
||||
let curLine = self._stripMarkup(curLine)
|
||||
|
||||
let curPath = join(pathcomponents, '/') . '/' . curLine
|
||||
if stridx(fullpath, curPath, 0) ==# 0
|
||||
@ -366,14 +360,12 @@ function! s:UI.setShowHidden(val)
|
||||
let self._showHidden = a:val
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:UI._stripMarkup(line, removeLeadingSpaces){{{1
|
||||
"FUNCTION: s:UI._stripMarkup(line){{{1
|
||||
"returns the given line with all the tree parts stripped off
|
||||
"
|
||||
"Args:
|
||||
"line: the subject line
|
||||
"removeLeadingSpaces: 1 if leading spaces are to be removed (leading spaces =
|
||||
"any spaces before the actual text of the node)
|
||||
function! s:UI._stripMarkup(line, removeLeadingSpaces)
|
||||
function! s:UI._stripMarkup(line)
|
||||
let line = a:line
|
||||
"remove the tree parts and the leading space
|
||||
let line = substitute (line, g:NERDTreeUI.MarkupReg(),"","")
|
||||
@ -390,18 +382,7 @@ function! s:UI._stripMarkup(line, removeLeadingSpaces)
|
||||
"strip off any generic flags
|
||||
let line = substitute (line, '\[[^]]*\]', "","")
|
||||
|
||||
let wasdir = 0
|
||||
if line =~# '/$'
|
||||
let wasdir = 1
|
||||
endif
|
||||
let line = substitute (line,' -> .*',"","") " remove link to
|
||||
if wasdir ==# 1
|
||||
let line = substitute (line, '/\?$', '/', "")
|
||||
endif
|
||||
|
||||
if a:removeLeadingSpaces
|
||||
let line = substitute (line, '^ *', '', '')
|
||||
endif
|
||||
|
||||
return line
|
||||
endfunction
|
||||
|
Reference in New Issue
Block a user