move s:getSelectedBookmark in to the Bookmark model
This commit is contained in:
parent
4b566f153f
commit
1537d42706
@ -333,6 +333,21 @@ function! s:Bookmark.GetNodeForName(name, searchFromAbsoluteRoot)
|
|||||||
let bookmark = s:Bookmark.BookmarkFor(a:name)
|
let bookmark = s:Bookmark.BookmarkFor(a:name)
|
||||||
return bookmark.getNode(a:searchFromAbsoluteRoot)
|
return bookmark.getNode(a:searchFromAbsoluteRoot)
|
||||||
endfunction
|
endfunction
|
||||||
|
" FUNCTION: Bookmark.GetSelected() {{{3
|
||||||
|
" returns the Bookmark the cursor is over, or {}
|
||||||
|
function! s:Bookmark.GetSelected()
|
||||||
|
let line = getline(".")
|
||||||
|
let name = substitute(line, '^>\(.\{-}\) .\+$', '\1', '')
|
||||||
|
if name != line
|
||||||
|
try
|
||||||
|
return s:Bookmark.BookmarkFor(name)
|
||||||
|
catch /^NERDTree.BookmarkNotFoundError/
|
||||||
|
return {}
|
||||||
|
endtry
|
||||||
|
endif
|
||||||
|
return {}
|
||||||
|
endfunction
|
||||||
|
|
||||||
" Function: Bookmark.InvalidBookmarks() {{{3
|
" Function: Bookmark.InvalidBookmarks() {{{3
|
||||||
" Class method to get all invalid bookmark strings read from the bookmarks
|
" Class method to get all invalid bookmark strings read from the bookmarks
|
||||||
" file
|
" file
|
||||||
@ -3032,21 +3047,6 @@ function! s:getPath(ln)
|
|||||||
return toReturn
|
return toReturn
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:getSelectedBookmark() {{{2
|
|
||||||
"returns the bookmark the cursor is over in the bookmarks table or {}
|
|
||||||
function! s:getSelectedBookmark()
|
|
||||||
let line = getline(".")
|
|
||||||
let name = substitute(line, '^>\(.\{-}\) .\+$', '\1', '')
|
|
||||||
if name != line
|
|
||||||
try
|
|
||||||
return s:Bookmark.BookmarkFor(name)
|
|
||||||
catch /^NERDTree.BookmarkNotFoundError/
|
|
||||||
return {}
|
|
||||||
endtry
|
|
||||||
endif
|
|
||||||
return {}
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
"FUNCTION: s:getTreeWinNum() {{{2
|
"FUNCTION: s:getTreeWinNum() {{{2
|
||||||
"gets the nerd tree window number for this tab
|
"gets the nerd tree window number for this tab
|
||||||
function! s:getTreeWinNum()
|
function! s:getTreeWinNum()
|
||||||
@ -3463,7 +3463,7 @@ function! s:activateNode(forceKeepWindowOpen)
|
|||||||
if treenode != {}
|
if treenode != {}
|
||||||
call treenode.activate(a:forceKeepWindowOpen)
|
call treenode.activate(a:forceKeepWindowOpen)
|
||||||
else
|
else
|
||||||
let bookmark = s:getSelectedBookmark()
|
let bookmark = s:Bookmark.GetSelected()
|
||||||
if !empty(bookmark)
|
if !empty(bookmark)
|
||||||
call bookmark.activate()
|
call bookmark.activate()
|
||||||
endif
|
endif
|
||||||
@ -3673,7 +3673,7 @@ endfunction
|
|||||||
" FUNCTION: s:deleteBookmark() {{{2
|
" FUNCTION: s:deleteBookmark() {{{2
|
||||||
" if the cursor is on a bookmark, prompt to delete
|
" if the cursor is on a bookmark, prompt to delete
|
||||||
function! s:deleteBookmark()
|
function! s:deleteBookmark()
|
||||||
let bookmark = s:getSelectedBookmark()
|
let bookmark = s:Bookmark.GetSelected()
|
||||||
if bookmark ==# {}
|
if bookmark ==# {}
|
||||||
call s:echo("Put the cursor on a bookmark")
|
call s:echo("Put the cursor on a bookmark")
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user