Skip to content

Commit

Permalink
move s:getSelectedBookmark in to the Bookmark model
Browse files Browse the repository at this point in the history
  • Loading branch information
marty committed Nov 23, 2009
1 parent 4b566f1 commit 1537d42
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions plugin/NERD_tree.vim
Expand Up @@ -333,6 +333,21 @@ function! s:Bookmark.GetNodeForName(name, searchFromAbsoluteRoot)
let bookmark = s:Bookmark.BookmarkFor(a:name)
return bookmark.getNode(a:searchFromAbsoluteRoot)
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
" Class method to get all invalid bookmark strings read from the bookmarks
" file
Expand Down Expand Up @@ -3032,21 +3047,6 @@ function! s:getPath(ln)
return toReturn
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
"gets the nerd tree window number for this tab
function! s:getTreeWinNum()
Expand Down Expand Up @@ -3463,7 +3463,7 @@ function! s:activateNode(forceKeepWindowOpen)
if treenode != {}
call treenode.activate(a:forceKeepWindowOpen)
else
let bookmark = s:getSelectedBookmark()
let bookmark = s:Bookmark.GetSelected()
if !empty(bookmark)
call bookmark.activate()
endif
Expand Down Expand Up @@ -3673,7 +3673,7 @@ endfunction
" FUNCTION: s:deleteBookmark() {{{2
" if the cursor is on a bookmark, prompt to delete
function! s:deleteBookmark()
let bookmark = s:getSelectedBookmark()
let bookmark = s:Bookmark.GetSelected()
if bookmark ==# {}
call s:echo("Put the cursor on a bookmark")
return
Expand Down

0 comments on commit 1537d42

Please sign in to comment.