From f93d2c79e5b99f8c7326bfc6bb940fed1212c6a1 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Wed, 3 Apr 2013 13:35:31 +0100 Subject: [PATCH 1/6] fix NERDTreeCWD Closes #233 --- autoload/nerdtree.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/nerdtree.vim b/autoload/nerdtree.vim index b8f69dc..3da5566 100644 --- a/autoload/nerdtree.vim +++ b/autoload/nerdtree.vim @@ -98,7 +98,7 @@ function! nerdtree#createDefaultBindings() call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapQuit, 'scope': "all", 'callback': s."closeTreeWindow" }) - call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCWD, 'scope': "all", 'callback': s."chRootCwd" }) + call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapCWD, 'scope': "all", 'callback': "nerdtree#chRootCwd" }) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefreshRoot, 'scope': "all", 'callback': s."refreshRoot" }) call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapRefresh, 'scope': "Node", 'callback': s."refreshCurrent" }) @@ -1011,7 +1011,7 @@ endfunction " FUNCTION: s:chRootCwd() {{{2 " changes the current root to CWD -function! s:chRootCwd() +function! nerdtree#chRootCwd() try let cwd = g:NERDTreePath.New(getcwd()) catch /^NERDTree.InvalidArgumentsError/ From 9a341ec18f631e58398350cc9665b8ec4d50954d Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Tue, 9 Apr 2013 10:10:14 +0100 Subject: [PATCH 2/6] fix a bug where the user couldnt override the mapping for --- plugin/nerdtree/creator.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/nerdtree/creator.vim b/plugin/nerdtree/creator.vim index ee5f740..7f0721f 100644 --- a/plugin/nerdtree/creator.vim +++ b/plugin/nerdtree/creator.vim @@ -7,11 +7,11 @@ let g:NERDTreeCreator = s:Creator "FUNCTION: s:Creator._bindMappings() {{{1 function! s:Creator._bindMappings() - call g:NERDTreeKeyMap.BindAll() - "make do the same as the default 'o' mapping exec "nnoremap :call nerdtree#invokeKeyMap('". g:NERDTreeMapActivateNode ."')" + call g:NERDTreeKeyMap.BindAll() + command! -buffer -nargs=? Bookmark :call nerdtree#bookmarkNode('') command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 RevealBookmark :call nerdtree#revealBookmark('') command! -buffer -complete=customlist,nerdtree#completeBookmarks -nargs=1 OpenBookmark :call nerdtree#openBookmark('') From eaf19734e73dbaa5b30f10591079043b0eba0aab Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Sat, 13 Apr 2013 20:32:25 +0100 Subject: [PATCH 3/6] move the class files out of the plugin dir On some new versions of vim these files were being loaded before the main NERD_tree.vim which was causing errors as dependencies werent loaded in time. Move the classes into lib - so vim wont try to load them until we tell it --- autoload/nerdtree.vim | 13 +++++++++++++ {plugin => lib}/nerdtree/bookmark.vim | 0 {plugin => lib}/nerdtree/creator.vim | 0 {plugin => lib}/nerdtree/key_map.vim | 0 {plugin => lib}/nerdtree/menu_controller.vim | 0 {plugin => lib}/nerdtree/menu_item.vim | 0 {plugin => lib}/nerdtree/opener.vim | 0 {plugin => lib}/nerdtree/path.vim | 0 {plugin => lib}/nerdtree/tree_dir_node.vim | 0 {plugin => lib}/nerdtree/tree_file_node.vim | 0 plugin/NERD_tree.vim | 10 +--------- 11 files changed, 14 insertions(+), 9 deletions(-) rename {plugin => lib}/nerdtree/bookmark.vim (100%) rename {plugin => lib}/nerdtree/creator.vim (100%) rename {plugin => lib}/nerdtree/key_map.vim (100%) rename {plugin => lib}/nerdtree/menu_controller.vim (100%) rename {plugin => lib}/nerdtree/menu_item.vim (100%) rename {plugin => lib}/nerdtree/opener.vim (100%) rename {plugin => lib}/nerdtree/path.vim (100%) rename {plugin => lib}/nerdtree/tree_dir_node.vim (100%) rename {plugin => lib}/nerdtree/tree_file_node.vim (100%) diff --git a/autoload/nerdtree.vim b/autoload/nerdtree.vim index 3da5566..3a2d71a 100644 --- a/autoload/nerdtree.vim +++ b/autoload/nerdtree.vim @@ -227,6 +227,19 @@ function! nerdtree#invokeKeyMap(key) call g:NERDTreeKeyMap.Invoke(a:key) endfunction +" FUNCTION: nerdtree#loadClassFiles() {{{2 +function! nerdtree#loadClassFiles() + runtime lib/nerdtree/path.vim + runtime lib/nerdtree/menu_controller.vim + runtime lib/nerdtree/menu_item.vim + runtime lib/nerdtree/key_map.vim + runtime lib/nerdtree/bookmark.vim + runtime lib/nerdtree/tree_file_node.vim + runtime lib/nerdtree/tree_dir_node.vim + runtime lib/nerdtree/opener.vim + runtime lib/nerdtree/creator.vim +endfunction + " FUNCTION: nerdtree#postSourceActions() {{{2 function! nerdtree#postSourceActions() call g:NERDTreeBookmark.CacheBookmarks(0) diff --git a/plugin/nerdtree/bookmark.vim b/lib/nerdtree/bookmark.vim similarity index 100% rename from plugin/nerdtree/bookmark.vim rename to lib/nerdtree/bookmark.vim diff --git a/plugin/nerdtree/creator.vim b/lib/nerdtree/creator.vim similarity index 100% rename from plugin/nerdtree/creator.vim rename to lib/nerdtree/creator.vim diff --git a/plugin/nerdtree/key_map.vim b/lib/nerdtree/key_map.vim similarity index 100% rename from plugin/nerdtree/key_map.vim rename to lib/nerdtree/key_map.vim diff --git a/plugin/nerdtree/menu_controller.vim b/lib/nerdtree/menu_controller.vim similarity index 100% rename from plugin/nerdtree/menu_controller.vim rename to lib/nerdtree/menu_controller.vim diff --git a/plugin/nerdtree/menu_item.vim b/lib/nerdtree/menu_item.vim similarity index 100% rename from plugin/nerdtree/menu_item.vim rename to lib/nerdtree/menu_item.vim diff --git a/plugin/nerdtree/opener.vim b/lib/nerdtree/opener.vim similarity index 100% rename from plugin/nerdtree/opener.vim rename to lib/nerdtree/opener.vim diff --git a/plugin/nerdtree/path.vim b/lib/nerdtree/path.vim similarity index 100% rename from plugin/nerdtree/path.vim rename to lib/nerdtree/path.vim diff --git a/plugin/nerdtree/tree_dir_node.vim b/lib/nerdtree/tree_dir_node.vim similarity index 100% rename from plugin/nerdtree/tree_dir_node.vim rename to lib/nerdtree/tree_dir_node.vim diff --git a/plugin/nerdtree/tree_file_node.vim b/lib/nerdtree/tree_file_node.vim similarity index 100% rename from plugin/nerdtree/tree_file_node.vim rename to lib/nerdtree/tree_file_node.vim diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 6c19a3f..5bee03a 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -136,15 +136,7 @@ call s:initVariable("g:NERDTreeMapUpdirKeepOpen", "U") call s:initVariable("g:NERDTreeMapCWD", "CD") "SECTION: Load class files{{{2 -runtime plugin/nerdtree/path.vim -runtime plugin/nerdtree/menu_controller.vim -runtime plugin/nerdtree/menu_item.vim -runtime plugin/nerdtree/key_map.vim -runtime plugin/nerdtree/bookmark.vim -runtime plugin/nerdtree/tree_file_node.vim -runtime plugin/nerdtree/tree_dir_node.vim -runtime plugin/nerdtree/opener.vim -runtime plugin/nerdtree/creator.vim +call nerdtree#loadClassFiles() " SECTION: Commands {{{1 "============================================================ From 2fa35fb4949f670f1c137dc26a779f6e0515b330 Mon Sep 17 00:00:00 2001 From: Josh Hoff Date: Thu, 25 Apr 2013 21:34:36 -0500 Subject: [PATCH 4/6] don't redefine user-defined mappings As a user it's a little jarring when a plugin maps over something I've already defined. This patch fixes that problem, by using `` to ensure unique mappings. For more info see `:help ` Note: This has no effect if the mapping isn't already defined (that is, NERDTree is defining a unique mapping), so this won't break for normal users of the plugin. Note: `:silent!` is needed to ignore the error that occurs when a mapping is already defined. Fixes #252 --- lib/nerdtree/key_map.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nerdtree/key_map.vim b/lib/nerdtree/key_map.vim index 8645765..6066275 100644 --- a/lib/nerdtree/key_map.vim +++ b/lib/nerdtree/key_map.vim @@ -44,7 +44,7 @@ function! s:KeyMap.bind() let premap = self.key == "" ? " " : " " - exec 'nnoremap '. self.key . premap . ':call nerdtree#invokeKeyMap("'. keymapInvokeString .'")' + exec 'silent! nnoremap '. self.key . premap . ':call nerdtree#invokeKeyMap("'. keymapInvokeString .'")' endfunction "FUNCTION: KeyMap.Remove(key, scope) {{{1 From 6697bb7bede42dd180dbb2b62c04cf86aeab1e2e Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Mon, 13 May 2013 10:00:40 +0100 Subject: [PATCH 5/6] Revert "don't redefine user-defined mappings" This reverts commit 2fa35fb4949f670f1c137dc26a779f6e0515b330. --- lib/nerdtree/key_map.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nerdtree/key_map.vim b/lib/nerdtree/key_map.vim index 6066275..8645765 100644 --- a/lib/nerdtree/key_map.vim +++ b/lib/nerdtree/key_map.vim @@ -44,7 +44,7 @@ function! s:KeyMap.bind() let premap = self.key == "" ? " " : " " - exec 'silent! nnoremap '. self.key . premap . ':call nerdtree#invokeKeyMap("'. keymapInvokeString .'")' + exec 'nnoremap '. self.key . premap . ':call nerdtree#invokeKeyMap("'. keymapInvokeString .'")' endfunction "FUNCTION: KeyMap.Remove(key, scope) {{{1 From 21af5e0abd3bde9eebf5ab758fb2e6defe0b80c1 Mon Sep 17 00:00:00 2001 From: Volodymyr Medvid Date: Tue, 14 May 2013 16:39:46 +0300 Subject: [PATCH 6/6] fix spelling in documentation --- README.markdown | 6 +++--- doc/NERD_tree.txt | 10 +++++----- lib/nerdtree/bookmark.vim | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.markdown b/README.markdown index 60869de..e617809 100644 --- a/README.markdown +++ b/README.markdown @@ -44,11 +44,11 @@ The following features and functionality are provided by the NERD tree: as you left it * You can have a separate NERD tree for each tab, share trees across tabs, or a mix of both. - * By default the script overrides the default file browser (netw), so if - you :edit a directory a (slighly modified) NERD tree will appear in the + * By default the script overrides the default file browser (netrw), so if + you :edit a directory a (slightly modified) NERD tree will appear in the current window * A programmable menu system is provided (simulates right clicking on a node) - * one default menu plugin is provided to perform basic filesytem + * one default menu plugin is provided to perform basic filesystem operations (create/delete/move/copy files/directories) * There's an API for adding your own keymappings diff --git a/doc/NERD_tree.txt b/doc/NERD_tree.txt index 47f3472..bf03896 100644 --- a/doc/NERD_tree.txt +++ b/doc/NERD_tree.txt @@ -83,12 +83,12 @@ The following features and functionality are provided by the NERD tree: as you left it * You can have a separate NERD tree for each tab, share trees across tabs, or a mix of both. - * By default the script overrides the default file browser (netw), so if - you :edit a directory a (slighly modified) NERD tree will appear in the + * By default the script overrides the default file browser (netrw), so if + you :edit a directory a (slightly modified) NERD tree will appear in the current window * A programmable menu system is provided (simulates right clicking on a node) - * one default menu plugin is provided to perform basic filesytem + * one default menu plugin is provided to perform basic filesystem operations (create/delete/move/copy files/directories) * There's an API for adding your own keymappings @@ -228,7 +228,7 @@ gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs| O.......Recursively open the selected directory..................|NERDTree-O| x.......Close the current nodes parent...........................|NERDTree-x| X.......Recursively close all children of the current node.......|NERDTree-X| -e.......Edit the current dif.....................................|NERDTree-e| +e.......Edit the current dir.....................................|NERDTree-e| ...............same as |NERDTree-o|. double-click.......same as the |NERDTree-o| map. @@ -780,7 +780,7 @@ If set to 1, doing a > < will open up a "secondary" NERD tree instead of a netrw in the target window. -Secondary NERD trees behaves slighly different from a regular trees in the +Secondary NERD trees behaves slightly different from a regular trees in the following respects: 1. 'o' will open the selected file in the same window as the tree, replacing it. diff --git a/lib/nerdtree/bookmark.vim b/lib/nerdtree/bookmark.vim index 0d37b47..5b845d8 100644 --- a/lib/nerdtree/bookmark.vim +++ b/lib/nerdtree/bookmark.vim @@ -67,7 +67,7 @@ function! s:Bookmark.BookmarkNames() endfunction " FUNCTION: Bookmark.CacheBookmarks(silent) {{{1 -" Class method to read all bookmarks from the bookmarks file intialize +" Class method to read all bookmarks from the bookmarks file initialize " bookmark objects for each one. " " Args: