diff --git a/plugin/nerdtree/bookmark.vim b/plugin/nerdtree/bookmark.vim index 77a5023..603da53 100644 --- a/plugin/nerdtree/bookmark.vim +++ b/plugin/nerdtree/bookmark.vim @@ -1,12 +1,14 @@ -"CLASS: Bookmark {{{2 +"CLASS: Bookmark "============================================================ let s:Bookmark = {} let g:NERDTreeBookmark = s:Bookmark -" FUNCTION: Bookmark.activate() {{{3 + +" FUNCTION: Bookmark.activate() {{{1 function! s:Bookmark.activate(...) call self.open(a:0 ? a:1 : {}) endfunction -" FUNCTION: Bookmark.AddBookmark(name, path) {{{3 + +" FUNCTION: Bookmark.AddBookmark(name, path) {{{1 " Class method to add a new bookmark to the list, if a previous bookmark exists " with the same name, just update the path for that bookmark function! s:Bookmark.AddBookmark(name, path) @@ -19,7 +21,8 @@ function! s:Bookmark.AddBookmark(name, path) call add(s:Bookmark.Bookmarks(), s:Bookmark.New(a:name, a:path)) call s:Bookmark.Sort() endfunction -" Function: Bookmark.Bookmarks() {{{3 + +" FUNCTION: Bookmark.Bookmarks() {{{1 " Class method to get all bookmarks. Lazily initializes the bookmarks global " variable function! s:Bookmark.Bookmarks() @@ -28,7 +31,8 @@ function! s:Bookmark.Bookmarks() endif return g:NERDTreeBookmarks endfunction -" Function: Bookmark.BookmarkExistsFor(name) {{{3 + +" FUNCTION: Bookmark.BookmarkExistsFor(name) {{{1 " class method that returns 1 if a bookmark with the given name is found, 0 " otherwise function! s:Bookmark.BookmarkExistsFor(name) @@ -39,7 +43,8 @@ function! s:Bookmark.BookmarkExistsFor(name) return 0 endtry endfunction -" Function: Bookmark.BookmarkFor(name) {{{3 + +" FUNCTION: Bookmark.BookmarkFor(name) {{{1 " Class method to get the bookmark that has the given name. {} is return if no " bookmark is found function! s:Bookmark.BookmarkFor(name) @@ -50,7 +55,8 @@ function! s:Bookmark.BookmarkFor(name) endfor throw "NERDTree.BookmarkNotFoundError: no bookmark found for name: \"". a:name .'"' endfunction -" Function: Bookmark.BookmarkNames() {{{3 + +" FUNCTION: Bookmark.BookmarkNames() {{{1 " Class method to return an array of all bookmark names function! s:Bookmark.BookmarkNames() let names = [] @@ -59,7 +65,8 @@ function! s:Bookmark.BookmarkNames() endfor return names endfunction -" FUNCTION: Bookmark.CacheBookmarks(silent) {{{3 + +" FUNCTION: Bookmark.CacheBookmarks(silent) {{{1 " Class method to read all bookmarks from the bookmarks file intialize " bookmark objects for each one. " @@ -97,12 +104,13 @@ function! s:Bookmark.CacheBookmarks(silent) call s:Bookmark.Sort() endif endfunction -" FUNCTION: Bookmark.compareTo(otherbookmark) {{{3 + +" FUNCTION: Bookmark.compareTo(otherbookmark) {{{1 " Compare these two bookmarks for sorting purposes function! s:Bookmark.compareTo(otherbookmark) return a:otherbookmark.name < self.name endfunction -" FUNCTION: Bookmark.ClearAll() {{{3 +" FUNCTION: Bookmark.ClearAll() {{{1 " Class method to delete all bookmarks. function! s:Bookmark.ClearAll() for i in s:Bookmark.Bookmarks() @@ -110,7 +118,8 @@ function! s:Bookmark.ClearAll() endfor call s:Bookmark.Write() endfunction -" FUNCTION: Bookmark.delete() {{{3 + +" FUNCTION: Bookmark.delete() {{{1 " Delete this bookmark. If the node for this bookmark is under the current " root, then recache bookmarks for its Path object function! s:Bookmark.delete() @@ -125,7 +134,8 @@ function! s:Bookmark.delete() endif call s:Bookmark.Write() endfunction -" FUNCTION: Bookmark.getNode(searchFromAbsoluteRoot) {{{3 + +" FUNCTION: Bookmark.getNode(searchFromAbsoluteRoot) {{{1 " Gets the treenode for this bookmark " " Args: @@ -139,14 +149,16 @@ function! s:Bookmark.getNode(searchFromAbsoluteRoot) endif return targetNode endfunction -" FUNCTION: Bookmark.GetNodeForName(name, searchFromAbsoluteRoot) {{{3 + +" FUNCTION: Bookmark.GetNodeForName(name, searchFromAbsoluteRoot) {{{1 " Class method that finds the bookmark with the given name and returns the " treenode for it. function! s:Bookmark.GetNodeForName(name, searchFromAbsoluteRoot) let bookmark = s:Bookmark.BookmarkFor(a:name) return bookmark.getNode(a:searchFromAbsoluteRoot) endfunction -" FUNCTION: Bookmark.GetSelected() {{{3 + +" FUNCTION: Bookmark.GetSelected() {{{1 " returns the Bookmark the cursor is over, or {} function! s:Bookmark.GetSelected() let line = getline(".") @@ -161,7 +173,7 @@ function! s:Bookmark.GetSelected() return {} endfunction -" Function: Bookmark.InvalidBookmarks() {{{3 +" FUNCTION: Bookmark.InvalidBookmarks() {{{1 " Class method to get all invalid bookmark strings read from the bookmarks " file function! s:Bookmark.InvalidBookmarks() @@ -170,7 +182,8 @@ function! s:Bookmark.InvalidBookmarks() endif return g:NERDTreeInvalidBookmarks endfunction -" FUNCTION: Bookmark.mustExist() {{{3 + +" FUNCTION: Bookmark.mustExist() {{{1 function! s:Bookmark.mustExist() if !self.path.exists() call s:Bookmark.CacheBookmarks(1) @@ -178,7 +191,8 @@ function! s:Bookmark.mustExist() \ self.name ."\" points to a non existing location: \"". self.path.str() endif endfunction -" FUNCTION: Bookmark.New(name, path) {{{3 + +" FUNCTION: Bookmark.New(name, path) {{{1 " Create a new bookmark object with the given name and path object function! s:Bookmark.New(name, path) if a:name =~# ' ' @@ -190,7 +204,8 @@ function! s:Bookmark.New(name, path) let newBookmark.path = a:path return newBookmark endfunction -" FUNCTION: Bookmark.open([options]) {{{3 + +" FUNCTION: Bookmark.open([options]) {{{1 "Args: "A dictionary containing the following keys (all optional): " 'where': Specifies whether the node should be opened in new split/tab or in @@ -210,24 +225,28 @@ function! s:Bookmark.open(...) call opener.open(self) endif endfunction -" FUNCTION: Bookmark.openInNewTab(options) {{{3 + +" FUNCTION: Bookmark.openInNewTab(options) {{{1 " Create a new bookmark object with the given name and path object function! s:Bookmark.openInNewTab(options) call nerdtree#deprecated('Bookmark.openInNewTab', 'is deprecated, use open() instead') call self.open(a:options) endfunction -" Function: Bookmark.setPath(path) {{{3 + +" FUNCTION: Bookmark.setPath(path) {{{1 " makes this bookmark point to the given path function! s:Bookmark.setPath(path) let self.path = a:path endfunction -" Function: Bookmark.Sort() {{{3 + +" FUNCTION: Bookmark.Sort() {{{1 " Class method that sorts all bookmarks function! s:Bookmark.Sort() let CompareFunc = function("nerdtree#compareBookmarks") call sort(s:Bookmark.Bookmarks(), CompareFunc) endfunction -" Function: Bookmark.str() {{{3 + +" FUNCTION: Bookmark.str() {{{1 " Get the string that should be rendered in the view for this bookmark function! s:Bookmark.str() let pathStrMaxLen = winwidth(nerdtree#getTreeWinNum()) - 4 - len(self.name) @@ -241,7 +260,8 @@ function! s:Bookmark.str() endif return '>' . self.name . ' ' . pathStr endfunction -" FUNCTION: Bookmark.toRoot() {{{3 + +" FUNCTION: Bookmark.toRoot() {{{1 " Make the node for this bookmark the new tree root function! s:Bookmark.toRoot() if self.validate() @@ -255,15 +275,15 @@ function! s:Bookmark.toRoot() call targetNode.putCursorHere(0, 0) endif endfunction -" FUNCTION: Bookmark.ToRoot(name) {{{3 + +" FUNCTION: Bookmark.ToRoot(name) {{{1 " Make the node for this bookmark the new tree root function! s:Bookmark.ToRoot(name) let bookmark = s:Bookmark.BookmarkFor(a:name) call bookmark.toRoot() endfunction - -"FUNCTION: Bookmark.validate() {{{3 +" FUNCTION: Bookmark.validate() {{{1 function! s:Bookmark.validate() if self.path.exists() return 1 @@ -275,7 +295,7 @@ function! s:Bookmark.validate() endif endfunction -" Function: Bookmark.Write() {{{3 +" FUNCTION: Bookmark.Write() {{{1 " Class method to write all bookmarks to the bookmarks file function! s:Bookmark.Write() let bookmarkStrings = [] @@ -291,3 +311,5 @@ function! s:Bookmark.Write() endfor call writefile(bookmarkStrings, g:NERDTreeBookmarksFile) endfunction + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/plugin/nerdtree/key_map.vim b/plugin/nerdtree/key_map.vim index deecea8..8645765 100644 --- a/plugin/nerdtree/key_map.vim +++ b/plugin/nerdtree/key_map.vim @@ -1,8 +1,9 @@ -"CLASS: KeyMap {{{2 +"CLASS: KeyMap "============================================================ let s:KeyMap = {} let g:NERDTreeKeyMap = s:KeyMap -"FUNCTION: KeyMap.All() {{{3 + +"FUNCTION: KeyMap.All() {{{1 function! s:KeyMap.All() if !exists("s:keyMaps") let s:keyMaps = [] @@ -10,7 +11,7 @@ function! s:KeyMap.All() return s:keyMaps endfunction -"FUNCTION: KeyMap.FindFor(key, scope) {{{3 +"FUNCTION: KeyMap.FindFor(key, scope) {{{1 function! s:KeyMap.FindFor(key, scope) for i in s:KeyMap.All() if i.key ==# a:key && i.scope ==# a:scope @@ -20,14 +21,14 @@ function! s:KeyMap.FindFor(key, scope) return {} endfunction -"FUNCTION: KeyMap.BindAll() {{{3 +"FUNCTION: KeyMap.BindAll() {{{1 function! s:KeyMap.BindAll() for i in s:KeyMap.All() call i.bind() endfor endfunction -"FUNCTION: KeyMap.bind() {{{3 +"FUNCTION: KeyMap.bind() {{{1 function! s:KeyMap.bind() " If the key sequence we're trying to map contains any '<>' notation, we " must replace each of the '<' characters with '' to ensure the string @@ -46,7 +47,7 @@ function! s:KeyMap.bind() exec 'nnoremap '. self.key . premap . ':call nerdtree#invokeKeyMap("'. keymapInvokeString .'")' endfunction -"FUNCTION: KeyMap.Remove(key, scope) {{{3 +"FUNCTION: KeyMap.Remove(key, scope) {{{1 function! s:KeyMap.Remove(key, scope) let maps = s:KeyMap.All() for i in range(len(maps)) @@ -55,7 +56,8 @@ function! s:KeyMap.Remove(key, scope) endif endfor endfunction -"FUNCTION: KeyMap.invoke() {{{3 + +"FUNCTION: KeyMap.invoke() {{{1 "Call the KeyMaps callback function function! s:KeyMap.invoke(...) let Callback = function(self.callback) @@ -66,8 +68,7 @@ function! s:KeyMap.invoke(...) endif endfunction - -"FUNCTION: KeyMap.Invoke() {{{3 +"FUNCTION: KeyMap.Invoke() {{{1 "Find a keymapping for a:key and the current scope invoke it. " "Scope is determined as follows: @@ -121,7 +122,7 @@ function! s:KeyMap.Invoke(key) endif endfunction -"FUNCTION: KeyMap.Create(options) {{{3 +"FUNCTION: KeyMap.Create(options) {{{1 function! s:KeyMap.Create(options) let newKeyMap = copy(self) let opts = extend({'scope': 'all', 'quickhelpText': ''}, copy(a:options)) @@ -133,7 +134,7 @@ function! s:KeyMap.Create(options) call s:KeyMap.Add(newKeyMap) endfunction -"FUNCTION: KeyMap.Add(keymap) {{{3 +"FUNCTION: KeyMap.Add(keymap) {{{1 function! s:KeyMap.Add(keymap) call s:KeyMap.Remove(a:keymap.key, a:keymap.scope) call add(s:KeyMap.All(), a:keymap) diff --git a/plugin/nerdtree/menu_controller.vim b/plugin/nerdtree/menu_controller.vim index a7bfb95..ae0ee84 100644 --- a/plugin/nerdtree/menu_controller.vim +++ b/plugin/nerdtree/menu_controller.vim @@ -1,8 +1,9 @@ -"CLASS: MenuController {{{2 +"CLASS: MenuController "============================================================ let s:MenuController = {} let g:NERDTreeMenuController = s:MenuController -"FUNCTION: MenuController.New(menuItems) {{{3 + +"FUNCTION: MenuController.New(menuItems) {{{1 "create a new menu controller that operates on the given menu items function! s:MenuController.New(menuItems) let newMenuController = copy(self) @@ -14,7 +15,7 @@ function! s:MenuController.New(menuItems) return newMenuController endfunction -"FUNCTION: MenuController.showMenu() {{{3 +"FUNCTION: MenuController.showMenu() {{{1 "start the main loop of the menu and get the user to choose/execute a menu "item function! s:MenuController.showMenu() @@ -40,7 +41,7 @@ function! s:MenuController.showMenu() endif endfunction -"FUNCTION: MenuController._echoPrompt() {{{3 +"FUNCTION: MenuController._echoPrompt() {{{1 function! s:MenuController._echoPrompt() echo "NERDTree Menu. Use j/k/enter and the shortcuts indicated" echo "==========================================================" @@ -54,13 +55,13 @@ function! s:MenuController._echoPrompt() endfor endfunction -"FUNCTION: MenuController._current(key) {{{3 +"FUNCTION: MenuController._current(key) {{{1 "get the MenuItem that is currently selected function! s:MenuController._current() return self.menuItems[self.selection] endfunction -"FUNCTION: MenuController._handleKeypress(key) {{{3 +"FUNCTION: MenuController._handleKeypress(key) {{{1 "change the selection (if appropriate) and return 1 if the user has made "their choice, 0 otherwise function! s:MenuController._handleKeypress(key) @@ -86,7 +87,7 @@ function! s:MenuController._handleKeypress(key) return 0 endfunction -"FUNCTION: MenuController._allIndexesFor(shortcut) {{{3 +"FUNCTION: MenuController._allIndexesFor(shortcut) {{{1 "get indexes to all menu items with the given shortcut function! s:MenuController._allIndexesFor(shortcut) let toReturn = [] @@ -100,7 +101,7 @@ function! s:MenuController._allIndexesFor(shortcut) return toReturn endfunction -"FUNCTION: MenuController._nextIndexFor(shortcut) {{{3 +"FUNCTION: MenuController._nextIndexFor(shortcut) {{{1 "get the index to the next menu item with the given shortcut, starts from the "current cursor location and wraps around to the top again if need be function! s:MenuController._nextIndexFor(shortcut) @@ -119,13 +120,13 @@ function! s:MenuController._nextIndexFor(shortcut) return -1 endfunction -"FUNCTION: MenuController._setCmdheight() {{{3 +"FUNCTION: MenuController._setCmdheight() {{{1 "sets &cmdheight to whatever is needed to display the menu function! s:MenuController._setCmdheight() let &cmdheight = len(self.menuItems) + 3 endfunction -"FUNCTION: MenuController._saveOptions() {{{3 +"FUNCTION: MenuController._saveOptions() {{{1 "set any vim options that are required to make the menu work (saving their old "values) function! s:MenuController._saveOptions() @@ -135,14 +136,14 @@ function! s:MenuController._saveOptions() call self._setCmdheight() endfunction -"FUNCTION: MenuController._restoreOptions() {{{3 +"FUNCTION: MenuController._restoreOptions() {{{1 "restore the options we saved in _saveOptions() function! s:MenuController._restoreOptions() let &cmdheight = self._oldCmdheight let &lazyredraw = self._oldLazyredraw endfunction -"FUNCTION: MenuController._cursorDown() {{{3 +"FUNCTION: MenuController._cursorDown() {{{1 "move the cursor to the next menu item, skipping separators function! s:MenuController._cursorDown() let done = 0 @@ -159,7 +160,7 @@ function! s:MenuController._cursorDown() endwhile endfunction -"FUNCTION: MenuController._cursorUp() {{{3 +"FUNCTION: MenuController._cursorUp() {{{1 "move the cursor to the previous menu item, skipping separators function! s:MenuController._cursorUp() let done = 0 @@ -176,3 +177,4 @@ function! s:MenuController._cursorUp() endwhile endfunction +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/plugin/nerdtree/menu_item.vim b/plugin/nerdtree/menu_item.vim index 234bded..6fb9d9e 100644 --- a/plugin/nerdtree/menu_item.vim +++ b/plugin/nerdtree/menu_item.vim @@ -1,8 +1,9 @@ -"CLASS: MenuItem {{{2 +"CLASS: MenuItem "============================================================ let s:MenuItem = {} let g:NERDTreeMenuItem = s:MenuItem -"FUNCTION: MenuItem.All() {{{3 + +"FUNCTION: MenuItem.All() {{{1 "get all top level menu items function! s:MenuItem.All() if !exists("s:menuItems") @@ -11,7 +12,7 @@ function! s:MenuItem.All() return s:menuItems endfunction -"FUNCTION: MenuItem.AllEnabled() {{{3 +"FUNCTION: MenuItem.AllEnabled() {{{1 "get all top level menu items that are currently enabled function! s:MenuItem.AllEnabled() let toReturn = [] @@ -23,7 +24,7 @@ function! s:MenuItem.AllEnabled() return toReturn endfunction -"FUNCTION: MenuItem.Create(options) {{{3 +"FUNCTION: MenuItem.Create(options) {{{1 "make a new menu item and add it to the global list function! s:MenuItem.Create(options) let newMenuItem = copy(self) @@ -51,7 +52,7 @@ function! s:MenuItem.Create(options) return newMenuItem endfunction -"FUNCTION: MenuItem.CreateSeparator(options) {{{3 +"FUNCTION: MenuItem.CreateSeparator(options) {{{1 "make a new separator menu item and add it to the global list function! s:MenuItem.CreateSeparator(options) let standard_options = { 'text': '--------------------', @@ -62,7 +63,7 @@ function! s:MenuItem.CreateSeparator(options) return s:MenuItem.Create(options) endfunction -"FUNCTION: MenuItem.CreateSubmenu(options) {{{3 +"FUNCTION: MenuItem.CreateSubmenu(options) {{{1 "make a new submenu and add it to global list function! s:MenuItem.CreateSubmenu(options) let standard_options = { 'callback': -1 } @@ -71,7 +72,7 @@ function! s:MenuItem.CreateSubmenu(options) return s:MenuItem.Create(options) endfunction -"FUNCTION: MenuItem.enabled() {{{3 +"FUNCTION: MenuItem.enabled() {{{1 "return 1 if this menu item should be displayed " "delegates off to the isActiveCallback, and defaults to 1 if no callback was @@ -83,7 +84,7 @@ function! s:MenuItem.enabled() return 1 endfunction -"FUNCTION: MenuItem.execute() {{{3 +"FUNCTION: MenuItem.execute() {{{1 "perform the action behind this menu item, if this menuitem has children then "display a new menu for them, otherwise deletegate off to the menuitem's "callback @@ -98,15 +99,16 @@ function! s:MenuItem.execute() endif endfunction -"FUNCTION: MenuItem.isSeparator() {{{3 +"FUNCTION: MenuItem.isSeparator() {{{1 "return 1 if this menuitem is a separator function! s:MenuItem.isSeparator() return self.callback == -1 && self.children == [] endfunction -"FUNCTION: MenuItem.isSubmenu() {{{3 +"FUNCTION: MenuItem.isSubmenu() {{{1 "return 1 if this menuitem is a submenu function! s:MenuItem.isSubmenu() return self.callback == -1 && !empty(self.children) endfunction +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/plugin/nerdtree/opener.vim b/plugin/nerdtree/opener.vim index df8978f..947d5e1 100644 --- a/plugin/nerdtree/opener.vim +++ b/plugin/nerdtree/opener.vim @@ -1,9 +1,9 @@ -"CLASS: Opener {{{2 +"CLASS: Opener "============================================================ let s:Opener = {} let g:NERDTreeOpener = s:Opener -"FUNCTION: Opener._checkToCloseTree(newtab) {{{3 +"FUNCTION: Opener._checkToCloseTree(newtab) {{{1 "Check the class options and global options (i.e. NERDTreeQuitOnOpen) to see "if the tree should be closed now. " @@ -21,7 +21,7 @@ function! s:Opener._checkToCloseTree(newtab) endif endfunction -"FUNCTION: Opener._gotoTargetWin() {{{3 +"FUNCTION: Opener._gotoTargetWin() {{{1 function! s:Opener._gotoTargetWin() if b:NERDTreeType ==# "secondary" if self._where == 'v' @@ -48,7 +48,7 @@ function! s:Opener._gotoTargetWin() endif endfunction -"FUNCTION: Opener.New(path, opts) {{{3 +"FUNCTION: Opener.New(path, opts) {{{1 "Args: " "a:path: The path object that is to be opened. @@ -76,7 +76,7 @@ function! s:Opener.New(path, opts) return newObj endfunction -"FUNCTION: Opener._newSplit() {{{3 +"FUNCTION: Opener._newSplit() {{{1 function! s:Opener._newSplit() " Save the user's settings for splitbelow and splitright let savesplitbelow=&splitbelow @@ -136,7 +136,7 @@ function! s:Opener._newSplit() let &splitright=savesplitright endfunction -"FUNCTION: Opener._newVSplit() {{{3 +"FUNCTION: Opener._newVSplit() {{{1 function! s:Opener._newVSplit() let winwidth = winwidth(".") if winnr("$")==#1 @@ -152,7 +152,7 @@ function! s:Opener._newVSplit() call nerdtree#exec('wincmd p') endfunction -"FUNCTION: Opener.open(target) {{{3 +"FUNCTION: Opener.open(target) {{{1 function! s:Opener.open(target) if self._path.isDirectory call self._openDirectory(a:target) @@ -161,7 +161,7 @@ function! s:Opener.open(target) endif endfunction -"FUNCTION: Opener._openFile() {{{3 +"FUNCTION: Opener._openFile() {{{1 function! s:Opener._openFile() if self._reuse && self._reuseWindow() return @@ -181,7 +181,7 @@ function! s:Opener._openFile() endif endfunction -"FUNCTION: Opener._openDirectory(node) {{{3 +"FUNCTION: Opener._openDirectory(node) {{{1 function! s:Opener._openDirectory(node) if self._treetype ==# "secondary" call self._gotoTargetWin() @@ -204,7 +204,7 @@ function! s:Opener._openDirectory(node) endif endfunction -"FUNCTION: Opener._previousWindow() {{{3 +"FUNCTION: Opener._previousWindow() {{{1 function! s:Opener._previousWindow() if !nerdtree#isWindowUsable(winnr("#")) && nerdtree#firstUsableWindow() ==# -1 call self._newSplit() @@ -224,13 +224,13 @@ function! s:Opener._previousWindow() endif endfunction -"FUNCTION: Opener._restoreCursorPos(){{{3 +"FUNCTION: Opener._restoreCursorPos(){{{1 function! s:Opener._restoreCursorPos() call nerdtree#exec('normal ' . self._tabnr . 'gt') call nerdtree#exec(bufwinnr(self._bufnr) . 'wincmd w') endfunction -"FUNCTION: Opener._reuseWindow(){{{3 +"FUNCTION: Opener._reuseWindow(){{{1 "put the cursor in the first window we find for this file " "return 1 if we were successful @@ -255,9 +255,10 @@ function! s:Opener._reuseWindow() return 0 endfunction -"FUNCTION: Opener._saveCursorPos(){{{3 +"FUNCTION: Opener._saveCursorPos(){{{1 function! s:Opener._saveCursorPos() let self._bufnr = bufnr("") let self._tabnr = tabpagenr() endfunction +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/plugin/nerdtree/path.vim b/plugin/nerdtree/path.vim index 8c01339..68d5021 100644 --- a/plugin/nerdtree/path.vim +++ b/plugin/nerdtree/path.vim @@ -2,11 +2,12 @@ "once here let s:NERDTreeSortStarIndex = index(g:NERDTreeSortOrder, '*') -"CLASS: Path {{{2 +"CLASS: Path "============================================================ let s:Path = {} let g:NERDTreePath = s:Path -"FUNCTION: Path.AbsolutePathFor(str) {{{3 + +"FUNCTION: Path.AbsolutePathFor(str) {{{1 function! s:Path.AbsolutePathFor(str) let prependCWD = 0 if nerdtree#runningWindows() @@ -22,14 +23,16 @@ function! s:Path.AbsolutePathFor(str) return toReturn endfunction -"FUNCTION: Path.bookmarkNames() {{{3 + +"FUNCTION: Path.bookmarkNames() {{{1 function! s:Path.bookmarkNames() if !exists("self._bookmarkNames") call self.cacheDisplayString() endif return self._bookmarkNames endfunction -"FUNCTION: Path.cacheDisplayString() {{{3 + +"FUNCTION: Path.cacheDisplayString() {{{1 function! s:Path.cacheDisplayString() let self.cachedDisplayString = self.getLastPathComponent(1) @@ -55,7 +58,8 @@ function! s:Path.cacheDisplayString() let self.cachedDisplayString .= ' [RO]' endif endfunction -"FUNCTION: Path.changeToDir() {{{3 + +"FUNCTION: Path.changeToDir() {{{1 function! s:Path.changeToDir() let dir = self.str({'format': 'Cd'}) if self.isDirectory ==# 0 @@ -70,7 +74,7 @@ function! s:Path.changeToDir() endtry endfunction -"FUNCTION: Path.compareTo() {{{3 +"FUNCTION: Path.compareTo() {{{1 " "Compares this Path to the given path and returns 0 if they are equal, -1 if "this Path is "less than" the given path, or 1 if it is "greater". @@ -110,7 +114,7 @@ function! s:Path.compareTo(path) endif endfunction -"FUNCTION: Path.Create(fullpath) {{{3 +"FUNCTION: Path.Create(fullpath) {{{1 " "Factory method. " @@ -146,7 +150,7 @@ function! s:Path.Create(fullpath) return s:Path.New(a:fullpath) endfunction -"FUNCTION: Path.copy(dest) {{{3 +"FUNCTION: Path.copy(dest) {{{1 " "Copies the file/dir represented by this Path to the given location " @@ -166,15 +170,14 @@ function! s:Path.copy(dest) endif endfunction -"FUNCTION: Path.CopyingSupported() {{{3 +"FUNCTION: Path.CopyingSupported() {{{1 " "returns 1 if copying is supported for this OS function! s:Path.CopyingSupported() return exists('g:NERDTreeCopyCmd') endfunction - -"FUNCTION: Path.copyingWillOverwrite(dest) {{{3 +"FUNCTION: Path.copyingWillOverwrite(dest) {{{1 " "returns 1 if copy this path to the given location will cause files to "overwritten @@ -194,7 +197,7 @@ function! s:Path.copyingWillOverwrite(dest) endif endfunction -"FUNCTION: Path.delete() {{{3 +"FUNCTION: Path.delete() {{{1 " "Deletes the file represented by this path. "Deletion of directories is not supported @@ -223,7 +226,7 @@ function! s:Path.delete() endfor endfunction -"FUNCTION: Path.displayString() {{{3 +"FUNCTION: Path.displayString() {{{1 " "Returns a string that specifies how the path should be represented as a "string @@ -234,11 +237,13 @@ function! s:Path.displayString() return self.cachedDisplayString endfunction -"FUNCTION: Path.edit() {{{3 + +"FUNCTION: Path.edit() {{{1 function! s:Path.edit() exec "edit " . self.str({'format': 'Edit'}) endfunction -"FUNCTION: Path.extractDriveLetter(fullpath) {{{3 + +"FUNCTION: Path.extractDriveLetter(fullpath) {{{1 " "If running windows, cache the drive letter for this path function! s:Path.extractDriveLetter(fullpath) @@ -255,13 +260,15 @@ function! s:Path.extractDriveLetter(fullpath) endif endfunction -"FUNCTION: Path.exists() {{{3 + +"FUNCTION: Path.exists() {{{1 "return 1 if this path points to a location that is readable or is a directory function! s:Path.exists() let p = self.str() return filereadable(p) || isdirectory(p) endfunction -"FUNCTION: Path.getDir() {{{3 + +"FUNCTION: Path.getDir() {{{1 " "Returns this path if it is a directory, else this paths parent. " @@ -274,7 +281,8 @@ function! s:Path.getDir() return self.getParent() endif endfunction -"FUNCTION: Path.getParent() {{{3 + +"FUNCTION: Path.getParent() {{{1 " "Returns a new path object for this paths parent " @@ -289,7 +297,8 @@ function! s:Path.getParent() return s:Path.New(path) endfunction -"FUNCTION: Path.getLastPathComponent(dirSlash) {{{3 + +"FUNCTION: Path.getLastPathComponent(dirSlash) {{{1 " "Gets the last part of this path. " @@ -307,7 +316,7 @@ function! s:Path.getLastPathComponent(dirSlash) return toReturn endfunction -"FUNCTION: Path.getSortOrderIndex() {{{3 +"FUNCTION: Path.getSortOrderIndex() {{{1 "returns the index of the pattern in g:NERDTreeSortOrder that this path matches function! s:Path.getSortOrderIndex() let i = 0 @@ -320,14 +329,13 @@ function! s:Path.getSortOrderIndex() return s:NERDTreeSortStarIndex endfunction - -"FUNCTION: Path.isUnixHiddenFile() {{{3 +"FUNCTION: Path.isUnixHiddenFile() {{{1 "check for unix hidden files function! s:Path.isUnixHiddenFile() return self.getLastPathComponent(0) =~# '^\.' endfunction -"FUNCTION: Path.isUnixHiddenPath() {{{3 +"FUNCTION: Path.isUnixHiddenPath() {{{1 "check for unix path with hidden components function! s:Path.isUnixHiddenPath() if self.getLastPathComponent(0) =~# '^\.' @@ -342,7 +350,7 @@ function! s:Path.isUnixHiddenPath() endif endfunction -"FUNCTION: Path.ignore() {{{3 +"FUNCTION: Path.ignore() {{{1 "returns true if this path should be ignored function! s:Path.ignore() "filter out the user specified paths to ignore @@ -370,7 +378,7 @@ function! s:Path.ignore() return 0 endfunction -"FUNCTION: Path._ignorePatternMatches(pattern) {{{3 +"FUNCTION: Path._ignorePatternMatches(pattern) {{{1 "returns true if this path matches the given ignore pattern function! s:Path._ignorePatternMatches(pattern) let pat = a:pattern @@ -388,7 +396,8 @@ function! s:Path._ignorePatternMatches(pattern) return self.getLastPathComponent(0) =~# pat endfunction -"FUNCTION: Path.isUnder(path) {{{3 + +"FUNCTION: Path.isUnder(path) {{{1 "return 1 if this path is somewhere under the given path in the filesystem. " "a:path should be a dir @@ -402,7 +411,7 @@ function! s:Path.isUnder(path) return stridx(this, that . s:Path.Slash()) == 0 endfunction -"FUNCTION: Path.JoinPathStrings(...) {{{3 +"FUNCTION: Path.JoinPathStrings(...) {{{1 function! s:Path.JoinPathStrings(...) let components = [] for i in a:000 @@ -411,7 +420,7 @@ function! s:Path.JoinPathStrings(...) return '/' . join(components, '/') endfunction -"FUNCTION: Path.equals() {{{3 +"FUNCTION: Path.equals() {{{1 " "Determines whether 2 path objects are "equal". "They are equal if the paths they represent are the same @@ -422,7 +431,7 @@ function! s:Path.equals(path) return self.str() ==# a:path.str() endfunction -"FUNCTION: Path.New() {{{3 +"FUNCTION: Path.New() {{{1 "The Constructor for the Path object function! s:Path.New(path) let newPath = copy(self) @@ -434,13 +443,13 @@ function! s:Path.New(path) return newPath endfunction -"FUNCTION: Path.Slash() {{{3 +"FUNCTION: Path.Slash() {{{1 "return the slash to use for the current OS function! s:Path.Slash() return nerdtree#runningWindows() ? '\' : '/' endfunction -"FUNCTION: Path.Resolve() {{{3 +"FUNCTION: Path.Resolve() {{{1 "Invoke the vim resolve() function and return the result "This is necessary because in some versions of vim resolve() removes trailing "slashes while in other versions it doesn't. This always removes the trailing @@ -450,7 +459,7 @@ function! s:Path.Resolve(path) return tmp =~# '.\+/$' ? substitute(tmp, '/$', '', '') : tmp endfunction -"FUNCTION: Path.readInfoFromDisk(fullpath) {{{3 +"FUNCTION: Path.readInfoFromDisk(fullpath) {{{1 " " "Throws NERDTree.Path.InvalidArguments exception. @@ -504,13 +513,13 @@ function! s:Path.readInfoFromDisk(fullpath) endif endfunction -"FUNCTION: Path.refresh() {{{3 +"FUNCTION: Path.refresh() {{{1 function! s:Path.refresh() call self.readInfoFromDisk(self.str()) call self.cacheDisplayString() endfunction -"FUNCTION: Path.rename() {{{3 +"FUNCTION: Path.rename() {{{1 " "Renames this node on the filesystem function! s:Path.rename(newPath) @@ -531,7 +540,7 @@ function! s:Path.rename(newPath) call g:NERDTreeBookmark.Write() endfunction -"FUNCTION: Path.str() {{{3 +"FUNCTION: Path.str() {{{1 " "Returns a string representation of this Path " @@ -582,7 +591,7 @@ function! s:Path.str(...) return toReturn endfunction -"FUNCTION: Path._strForUI() {{{3 +"FUNCTION: Path._strForUI() {{{1 function! s:Path._strForUI() let toReturn = '/' . join(self.pathSegments, '/') if self.isDirectory && toReturn != '/' @@ -591,13 +600,14 @@ function! s:Path._strForUI() return toReturn endfunction -"FUNCTION: Path._strForCd() {{{3 +"FUNCTION: Path._strForCd() {{{1 " " returns a string that can be used with :cd function! s:Path._strForCd() return escape(self.str(), nerdtree#escChars()) endfunction -"FUNCTION: Path._strForEdit() {{{3 + +"FUNCTION: Path._strForEdit() {{{1 " "Return: the string for this path that is suitable to be used with the :edit "command @@ -629,7 +639,8 @@ function! s:Path._strForEdit() return p endfunction -"FUNCTION: Path._strForGlob() {{{3 + +"FUNCTION: Path._strForGlob() {{{1 function! s:Path._strForGlob() let lead = s:Path.Slash() @@ -645,7 +656,8 @@ function! s:Path._strForGlob() endif return toReturn endfunction -"FUNCTION: Path._str() {{{3 + +"FUNCTION: Path._str() {{{1 " "Gets the string path for this path object that is appropriate for the OS. "EG, in windows c:\foo\bar @@ -661,13 +673,13 @@ function! s:Path._str() return lead . join(self.pathSegments, s:Path.Slash()) endfunction -"FUNCTION: Path.strTrunk() {{{3 +"FUNCTION: Path.strTrunk() {{{1 "Gets the path without the last segment on the end. function! s:Path.strTrunk() return self.drive . '/' . join(self.pathSegments[0:-2], '/') endfunction -" FUNCTION: Path.tabnr() {{{3 +" FUNCTION: Path.tabnr() {{{1 " return the number of the first tab that is displaying this file " " return 0 if no tab was found @@ -682,7 +694,8 @@ function! s:Path.tabnr() endfor return 0 endfunction -"FUNCTION: Path.WinToUnixPath(pathstr){{{3 + +"FUNCTION: Path.WinToUnixPath(pathstr){{{1 "Takes in a windows path and returns the unix equiv " "A class level method diff --git a/plugin/nerdtree/tree_dir_node.vim b/plugin/nerdtree/tree_dir_node.vim index 85688be..25f1034 100644 --- a/plugin/nerdtree/tree_dir_node.vim +++ b/plugin/nerdtree/tree_dir_node.vim @@ -1,11 +1,12 @@ -"CLASS: TreeDirNode {{{2 -"This class is a child of the TreeFileNode class and constitutes the -"'Composite' part of the composite design pattern between the treenode -"classes. +"CLASS: TreeDirNode +"A subclass of NERDTreeFileNode. +" +"The 'composite' part of the file/dir composite. "============================================================ let s:TreeDirNode = copy(g:NERDTreeFileNode) let g:NERDTreeDirNode = s:TreeDirNode -"FUNCTION: TreeDirNode.AbsoluteTreeRoot(){{{3 + +"FUNCTION: TreeDirNode.AbsoluteTreeRoot(){{{1 "class method that returns the highest cached ancestor of the current root function! s:TreeDirNode.AbsoluteTreeRoot() let currentNode = b:NERDTreeRoot @@ -14,7 +15,8 @@ function! s:TreeDirNode.AbsoluteTreeRoot() endwhile return currentNode endfunction -"FUNCTION: TreeDirNode.activate([options]) {{{3 + +"FUNCTION: TreeDirNode.activate([options]) {{{1 unlet s:TreeDirNode.activate function! s:TreeDirNode.activate(...) let opts = a:0 ? a:1 : {} @@ -22,7 +24,8 @@ function! s:TreeDirNode.activate(...) call nerdtree#renderView() call self.putCursorHere(0, 0) endfunction -"FUNCTION: TreeDirNode.addChild(treenode, inOrder) {{{3 + +"FUNCTION: TreeDirNode.addChild(treenode, inOrder) {{{1 "Adds the given treenode to the list of children for this node " "Args: @@ -37,13 +40,13 @@ function! s:TreeDirNode.addChild(treenode, inOrder) endif endfunction -"FUNCTION: TreeDirNode.close() {{{3 +"FUNCTION: TreeDirNode.close() {{{1 "Closes this directory function! s:TreeDirNode.close() let self.isOpen = 0 endfunction -"FUNCTION: TreeDirNode.closeChildren() {{{3 +"FUNCTION: TreeDirNode.closeChildren() {{{1 "Closes all the child dir nodes of this node function! s:TreeDirNode.closeChildren() for i in self.children @@ -54,7 +57,7 @@ function! s:TreeDirNode.closeChildren() endfor endfunction -"FUNCTION: TreeDirNode.createChild(path, inOrder) {{{3 +"FUNCTION: TreeDirNode.createChild(path, inOrder) {{{1 "Instantiates a new child node for this node with the given path. The new "nodes parent is set to this node. " @@ -70,7 +73,7 @@ function! s:TreeDirNode.createChild(path, inOrder) return newTreeNode endfunction -"FUNCTION: TreeDirNode.findNode(path) {{{3 +"FUNCTION: TreeDirNode.findNode(path) {{{1 "Will find one of the children (recursively) that has the given path " "Args: @@ -94,13 +97,14 @@ function! s:TreeDirNode.findNode(path) endif return {} endfunction -"FUNCTION: TreeDirNode.getChildCount() {{{3 + +"FUNCTION: TreeDirNode.getChildCount() {{{1 "Returns the number of children this node has function! s:TreeDirNode.getChildCount() return len(self.children) endfunction -"FUNCTION: TreeDirNode.getChild(path) {{{3 +"FUNCTION: TreeDirNode.getChild(path) {{{1 "Returns child node of this node that has the given path or {} if no such node "exists. " @@ -122,7 +126,7 @@ function! s:TreeDirNode.getChild(path) endfunction -"FUNCTION: TreeDirNode.getChildByIndex(indx, visible) {{{3 +"FUNCTION: TreeDirNode.getChildByIndex(indx, visible) {{{1 "returns the child at the given index "Args: "indx: the index to get the child from @@ -136,7 +140,7 @@ function! s:TreeDirNode.getChildByIndex(indx, visible) return array_to_search[a:indx] endfunction -"FUNCTION: TreeDirNode.getChildIndex(path) {{{3 +"FUNCTION: TreeDirNode.getChildIndex(path) {{{1 "Returns the index of the child node of this node that has the given path or "-1 if no such node exists. " @@ -167,7 +171,7 @@ function! s:TreeDirNode.getChildIndex(path) return -1 endfunction -"FUNCTION: TreeDirNode.GetSelected() {{{3 +"FUNCTION: TreeDirNode.GetSelected() {{{1 "Returns the current node if it is a dir node, or else returns the current "nodes parent unlet s:TreeDirNode.GetSelected @@ -180,13 +184,14 @@ function! s:TreeDirNode.GetSelected() endif return currentDir endfunction -"FUNCTION: TreeDirNode.getVisibleChildCount() {{{3 + +"FUNCTION: TreeDirNode.getVisibleChildCount() {{{1 "Returns the number of visible children this node has function! s:TreeDirNode.getVisibleChildCount() return len(self.getVisibleChildren()) endfunction -"FUNCTION: TreeDirNode.getVisibleChildren() {{{3 +"FUNCTION: TreeDirNode.getVisibleChildren() {{{1 "Returns a list of children to display for this node, in the correct order " "Return: @@ -201,13 +206,13 @@ function! s:TreeDirNode.getVisibleChildren() return toReturn endfunction -"FUNCTION: TreeDirNode.hasVisibleChildren() {{{3 +"FUNCTION: TreeDirNode.hasVisibleChildren() {{{1 "returns 1 if this node has any childre, 0 otherwise.. function! s:TreeDirNode.hasVisibleChildren() return self.getVisibleChildCount() != 0 endfunction -"FUNCTION: TreeDirNode._initChildren() {{{3 +"FUNCTION: TreeDirNode._initChildren() {{{1 "Removes all childen from this node and re-reads them " "Args: @@ -264,7 +269,8 @@ function! s:TreeDirNode._initChildren(silent) endif return self.getChildCount() endfunction -"FUNCTION: TreeDirNode.New(path) {{{3 + +"FUNCTION: TreeDirNode.New(path) {{{1 "Returns a new TreeNode object with the given path and parent " "Args: @@ -285,7 +291,8 @@ function! s:TreeDirNode.New(path) return newTreeNode endfunction -"FUNCTION: TreeDirNode.open([opts]) {{{3 + +"FUNCTION: TreeDirNode.open([opts]) {{{1 "Open the dir in the current tree or in a new tree elsewhere. " "If opening in the current tree, return the number of cached nodes. @@ -305,7 +312,8 @@ function! s:TreeDirNode.open(...) endif endif endfunction -"FUNCTION: TreeDirNode.openAlong([opts]) {{{3 + +"FUNCTION: TreeDirNode.openAlong([opts]) {{{1 "recursive open the dir if it has only one directory child. " "return the level of opened directories. @@ -325,24 +333,28 @@ function! s:TreeDirNode.openAlong(...) endwhile return level endfunction -" FUNCTION: TreeDirNode.openExplorer() {{{3 + +" FUNCTION: TreeDirNode.openExplorer() {{{1 " opens an explorer window for this node in the previous window (could be a " nerd tree or a netrw) function! s:TreeDirNode.openExplorer() call self.open({'where': 'p'}) endfunction -"FUNCTION: TreeDirNode.openInNewTab(options) {{{3 + +"FUNCTION: TreeDirNode.openInNewTab(options) {{{1 unlet s:TreeDirNode.openInNewTab function! s:TreeDirNode.openInNewTab(options) call nerdtree#deprecated('TreeDirNode.openInNewTab', 'is deprecated, use open() instead') call self.open({'where': 't'}) endfunction -"FUNCTION: TreeDirNode._openInNewTab() {{{3 + +"FUNCTION: TreeDirNode._openInNewTab() {{{1 function! s:TreeDirNode._openInNewTab() tabnew call nerdtree#initNerdTree(self.path.str()) endfunction -"FUNCTION: TreeDirNode.openRecursively() {{{3 + +"FUNCTION: TreeDirNode.openRecursively() {{{1 "Opens this treenode and all of its children whose paths arent 'ignored' "because of the file filters. " @@ -352,7 +364,7 @@ function! s:TreeDirNode.openRecursively() call self._openRecursively2(1) endfunction -"FUNCTION: TreeDirNode._openRecursively2() {{{3 +"FUNCTION: TreeDirNode._openRecursively2() {{{1 "Opens this all children of this treenode recursively if either: " *they arent filtered by file filters " *a:forceOpen is 1 @@ -374,7 +386,7 @@ function! s:TreeDirNode._openRecursively2(forceOpen) endif endfunction -"FUNCTION: TreeDirNode.refresh() {{{3 +"FUNCTION: TreeDirNode.refresh() {{{1 unlet s:TreeDirNode.refresh function! s:TreeDirNode.refresh() call self.path.refresh() @@ -426,7 +438,7 @@ function! s:TreeDirNode.refresh() endif endfunction -"FUNCTION: TreeDirNode.reveal(path) {{{3 +"FUNCTION: TreeDirNode.reveal(path) {{{1 "reveal the given path, i.e. cache and open all treenodes needed to display it "in the UI function! s:TreeDirNode.reveal(path) @@ -451,7 +463,8 @@ function! s:TreeDirNode.reveal(path) let n = self.findNode(p) call n.reveal(a:path) endfunction -"FUNCTION: TreeDirNode.removeChild(treenode) {{{3 + +"FUNCTION: TreeDirNode.removeChild(treenode) {{{1 " "Removes the given treenode from this nodes set of children " @@ -470,7 +483,7 @@ function! s:TreeDirNode.removeChild(treenode) throw "NERDTree.ChildNotFoundError: child node was not found" endfunction -"FUNCTION: TreeDirNode.sortChildren() {{{3 +"FUNCTION: TreeDirNode.sortChildren() {{{1 " "Sorts the children of this node according to alphabetical order and the "directory priority. @@ -480,7 +493,7 @@ function! s:TreeDirNode.sortChildren() call sort(self.children, CompareFunc) endfunction -"FUNCTION: TreeDirNode.toggleOpen([options]) {{{3 +"FUNCTION: TreeDirNode.toggleOpen([options]) {{{1 "Opens this directory if it is closed and vice versa function! s:TreeDirNode.toggleOpen(...) let opts = a:0 ? a:1 : {} @@ -494,7 +507,8 @@ function! s:TreeDirNode.toggleOpen(...) endif endif endfunction -"FUNCTION: TreeDirNode.transplantChild(newNode) {{{3 + +"FUNCTION: TreeDirNode.transplantChild(newNode) {{{1 "Replaces the child of this with the given node (where the child node's full "path matches a:newNode's fullpath). The search for the matching node is "non-recursive @@ -510,4 +524,5 @@ function! s:TreeDirNode.transplantChild(newNode) endif endfor endfunction -"============================================================ + +" vim: set sw=4 sts=4 et fdm=marker: diff --git a/plugin/nerdtree/tree_file_node.vim b/plugin/nerdtree/tree_file_node.vim index 2cecedf..6b5246f 100644 --- a/plugin/nerdtree/tree_file_node.vim +++ b/plugin/nerdtree/tree_file_node.vim @@ -1,15 +1,17 @@ -"CLASS: TreeFileNode {{{2 -"This class is the parent of the TreeDirNode class and constitures the +"CLASS: TreeFileNode +"This class is the parent of the TreeDirNode class and is the "'Component' part of the composite design pattern between the treenode "classes. "============================================================ let s:TreeFileNode = {} let g:NERDTreeFileNode = s:TreeFileNode -"FUNCTION: TreeFileNode.activate(...) {{{3 + +"FUNCTION: TreeFileNode.activate(...) {{{1 function! s:TreeFileNode.activate(...) call self.open(a:0 ? a:1 : {}) endfunction -"FUNCTION: TreeFileNode.bookmark(name) {{{3 + +"FUNCTION: TreeFileNode.bookmark(name) {{{1 "bookmark this node with a:name function! s:TreeFileNode.bookmark(name) @@ -30,7 +32,8 @@ function! s:TreeFileNode.bookmark(name) call oldMarkedNode.path.cacheDisplayString() endif endfunction -"FUNCTION: TreeFileNode.cacheParent() {{{3 + +"FUNCTION: TreeFileNode.cacheParent() {{{1 "initializes self.parent if it isnt already function! s:TreeFileNode.cacheParent() if empty(self.parent) @@ -42,7 +45,7 @@ function! s:TreeFileNode.cacheParent() endif endfunction -"FUNCTION: TreeFileNode.clearBookmarks() {{{3 +"FUNCTION: TreeFileNode.clearBookmarks() {{{1 function! s:TreeFileNode.clearBookmarks() for i in g:NERDTreeBookmark.Bookmarks() if i.path.equals(self.path) @@ -51,7 +54,8 @@ function! s:TreeFileNode.clearBookmarks() endfor call self.path.cacheDisplayString() endfunction -"FUNCTION: TreeFileNode.copy(dest) {{{3 + +"FUNCTION: TreeFileNode.copy(dest) {{{1 function! s:TreeFileNode.copy(dest) call self.path.copy(a:dest) let newPath = s:NERDTreePath.New(a:dest) @@ -64,14 +68,14 @@ function! s:TreeFileNode.copy(dest) endif endfunction -"FUNCTION: TreeFileNode.delete {{{3 +"FUNCTION: TreeFileNode.delete {{{1 "Removes this node from the tree and calls the Delete method for its path obj function! s:TreeFileNode.delete() call self.path.delete() call self.parent.removeChild(self) endfunction -"FUNCTION: TreeFileNode.displayString() {{{3 +"FUNCTION: TreeFileNode.displayString() {{{1 " "Returns a string that specifies how the node should be represented as a "string @@ -82,7 +86,7 @@ function! s:TreeFileNode.displayString() return self.path.displayString() endfunction -"FUNCTION: TreeFileNode.equals(treenode) {{{3 +"FUNCTION: TreeFileNode.equals(treenode) {{{1 " "Compares this treenode to the input treenode and returns 1 if they are the "same node. @@ -96,7 +100,7 @@ function! s:TreeFileNode.equals(treenode) return self.path.str() ==# a:treenode.path.str() endfunction -"FUNCTION: TreeFileNode.findNode(path) {{{3 +"FUNCTION: TreeFileNode.findNode(path) {{{1 "Returns self if this node.path.Equals the given path. "Returns {} if not equal. " @@ -108,7 +112,8 @@ function! s:TreeFileNode.findNode(path) endif return {} endfunction -"FUNCTION: TreeFileNode.findOpenDirSiblingWithVisibleChildren(direction) {{{3 + +"FUNCTION: TreeFileNode.findOpenDirSiblingWithVisibleChildren(direction) {{{1 " "Finds the next sibling for this node in the indicated direction. This sibling "must be a directory and may/may not have children as specified. @@ -133,7 +138,8 @@ function! s:TreeFileNode.findOpenDirSiblingWithVisibleChildren(direction) return {} endfunction -"FUNCTION: TreeFileNode.findSibling(direction) {{{3 + +"FUNCTION: TreeFileNode.findSibling(direction) {{{1 " "Finds the next sibling for this node in the indicated direction " @@ -172,7 +178,7 @@ function! s:TreeFileNode.findSibling(direction) return {} endfunction -"FUNCTION: TreeFileNode.getLineNum(){{{3 +"FUNCTION: TreeFileNode.getLineNum(){{{1 "returns the line number this node is rendered on, or -1 if it isnt rendered function! s:TreeFileNode.getLineNum() "if the node is the root then return the root line no. @@ -221,7 +227,7 @@ function! s:TreeFileNode.getLineNum() return -1 endfunction -"FUNCTION: TreeFileNode.GetRootForTab(){{{3 +"FUNCTION: TreeFileNode.GetRootForTab(){{{1 "get the root node for this tab function! s:TreeFileNode.GetRootForTab() if nerdtree#treeExistsForTab() @@ -229,7 +235,8 @@ function! s:TreeFileNode.GetRootForTab() end return {} endfunction -"FUNCTION: TreeFileNode.GetRootLineNum(){{{3 + +"FUNCTION: TreeFileNode.GetRootLineNum(){{{1 "gets the line number of the root node function! s:TreeFileNode.GetRootLineNum() let rootLine = 1 @@ -239,7 +246,7 @@ function! s:TreeFileNode.GetRootLineNum() return rootLine endfunction -"FUNCTION: TreeFileNode.GetSelected() {{{3 +"FUNCTION: TreeFileNode.GetSelected() {{{1 "gets the treenode that the cursor is currently over function! s:TreeFileNode.GetSelected() try @@ -252,13 +259,15 @@ function! s:TreeFileNode.GetSelected() return {} endtry endfunction -"FUNCTION: TreeFileNode.isVisible() {{{3 + +"FUNCTION: TreeFileNode.isVisible() {{{1 "returns 1 if this node should be visible according to the tree filters and "hidden file filters (and their on/off status) function! s:TreeFileNode.isVisible() return !self.path.ignore() endfunction -"FUNCTION: TreeFileNode.isRoot() {{{3 + +"FUNCTION: TreeFileNode.isRoot() {{{1 "returns 1 if this node is b:NERDTreeRoot function! s:TreeFileNode.isRoot() if !nerdtree#treeExistsForBuf() @@ -268,7 +277,7 @@ function! s:TreeFileNode.isRoot() return self.equals(b:NERDTreeRoot) endfunction -"FUNCTION: TreeFileNode.makeRoot() {{{3 +"FUNCTION: TreeFileNode.makeRoot() {{{1 "Make this node the root of the tree function! s:TreeFileNode.makeRoot() if self.path.isDirectory @@ -287,7 +296,8 @@ function! s:TreeFileNode.makeRoot() silent doautocmd User NERDTreeNewRoot endfunction -"FUNCTION: TreeFileNode.New(path) {{{3 + +"FUNCTION: TreeFileNode.New(path) {{{1 "Returns a new TreeNode object with the given path and parent " "Args: @@ -303,31 +313,34 @@ function! s:TreeFileNode.New(path) endif endfunction -"FUNCTION: TreeFileNode.open() {{{3 +"FUNCTION: TreeFileNode.open() {{{1 function! s:TreeFileNode.open(...) let opts = a:0 ? a:1 : {} let opener = g:NERDTreeOpener.New(self.path, opts) call opener.open(self) endfunction -"FUNCTION: TreeFileNode.openSplit() {{{3 +"FUNCTION: TreeFileNode.openSplit() {{{1 "Open this node in a new window function! s:TreeFileNode.openSplit() call nerdtree#deprecated('TreeFileNode.openSplit', 'is deprecated, use .open() instead.') call self.open({'where': 'h'}) endfunction -"FUNCTION: TreeFileNode.openVSplit() {{{3 + +"FUNCTION: TreeFileNode.openVSplit() {{{1 "Open this node in a new vertical window function! s:TreeFileNode.openVSplit() call nerdtree#deprecated('TreeFileNode.openVSplit', 'is deprecated, use .open() instead.') call self.open({'where': 'v'}) endfunction -"FUNCTION: TreeFileNode.openInNewTab(options) {{{3 + +"FUNCTION: TreeFileNode.openInNewTab(options) {{{1 function! s:TreeFileNode.openInNewTab(options) echomsg 'TreeFileNode.openInNewTab is deprecated' call self.open(extend({'where': 't'}, a:options)) endfunction -"FUNCTION: TreeFileNode.putCursorHere(isJump, recurseUpward){{{3 + +"FUNCTION: TreeFileNode.putCursorHere(isJump, recurseUpward){{{1 "Places the cursor on the line number this node is rendered on " "Args: @@ -354,11 +367,12 @@ function! s:TreeFileNode.putCursorHere(isJump, recurseUpward) endif endfunction -"FUNCTION: TreeFileNode.refresh() {{{3 +"FUNCTION: TreeFileNode.refresh() {{{1 function! s:TreeFileNode.refresh() call self.path.refresh() endfunction -"FUNCTION: TreeFileNode.rename() {{{3 + +"FUNCTION: TreeFileNode.rename() {{{1 "Calls the rename method for this nodes path obj function! s:TreeFileNode.rename(newName) let newName = substitute(a:newName, '\(\\\|\/\)$', '', '') @@ -373,13 +387,13 @@ function! s:TreeFileNode.rename(newName) call newParent.refresh() endif endfunction -"FUNCTION: TreeFileNode.renderToString {{{3 + +"FUNCTION: TreeFileNode.renderToString {{{1 "returns a string representation for this tree to be rendered in the view function! s:TreeFileNode.renderToString() return self._renderToString(0, 0, [], self.getChildCount() ==# 1) endfunction - "Args: "depth: the current depth in the tree for this call "drawText: 1 if we should actually draw the line for this node (if 0 then the @@ -467,3 +481,5 @@ function! s:TreeFileNode._renderToString(depth, drawText, vertMap, isLastChild) return output endfunction + +" vim: set sw=4 sts=4 et fdm=marker: