From e4efdb3bd4fb9281720c459123ff4f7f3e7a434a Mon Sep 17 00:00:00 2001 From: Cam Thompson Date: Thu, 13 Jan 2011 17:13:29 -0500 Subject: [PATCH 01/15] add option to hide 'Press ? for help' --- plugin/NERD_tree.vim | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 0dfc36f..874035a 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -51,6 +51,7 @@ call s:initVariable("g:NERDTreeAutoCenter", 1) call s:initVariable("g:NERDTreeAutoCenterThreshold", 3) call s:initVariable("g:NERDTreeCaseSensitiveSort", 0) call s:initVariable("g:NERDTreeChDirMode", 0) +call s:initVariable("g:NERDTreeShowPressForHelp", 1) if !exists("g:NERDTreeIgnore") let g:NERDTreeIgnore = ['\~$'] endif @@ -2996,12 +2997,12 @@ function! s:dumpHelp() let @h=@h."\" :OpenBookmark \n" let @h=@h."\" :ClearBookmarks []\n" let @h=@h."\" :ClearAllBookmarks\n" - else + silent! put h + elseif g:NERDTreeShowPressForHelp == 1 let @h="\" Press ". g:NERDTreeMapHelp ." for help\n" + silent! put h endif - silent! put h - let @h = old_h endfunction "FUNCTION: s:echo {{{2 @@ -3268,8 +3269,10 @@ function! s:renderView() call s:dumpHelp() "delete the blank line before the help and add one after it - call setline(line(".")+1, "") - call cursor(line(".")+1, col(".")) + if g:NERDTreeShowPressForHelp == 1 + call setline(line(".")+1, "") + call cursor(line(".")+1, col(".")) + endif if b:NERDTreeShowBookmarks call s:renderBookmarks() From 9e415dcc6d759ef01993041cdf142db5add9deb7 Mon Sep 17 00:00:00 2001 From: Cam Thompson Date: Thu, 13 Jan 2011 18:00:41 -0500 Subject: [PATCH 02/15] add option to hide bookmarks label --- plugin/NERD_tree.vim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 874035a..f0762c5 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -52,6 +52,7 @@ call s:initVariable("g:NERDTreeAutoCenterThreshold", 3) call s:initVariable("g:NERDTreeCaseSensitiveSort", 0) call s:initVariable("g:NERDTreeChDirMode", 0) call s:initVariable("g:NERDTreeShowPressForHelp", 1) +call s:initVariable("g:NERDTreeShowBookmarksLabel", 1) if !exists("g:NERDTreeIgnore") let g:NERDTreeIgnore = ['\~$'] endif @@ -3241,8 +3242,10 @@ endfunction "FUNCTION: s:renderBookmarks {{{2 function! s:renderBookmarks() - call setline(line(".")+1, ">----------Bookmarks----------") - call cursor(line(".")+1, col(".")) + if g:NERDTreeShowBookmarksLabel == 1 + call setline(line(".")+1, ">----------Bookmarks----------") + call cursor(line(".")+1, col(".")) + endif for i in s:Bookmark.Bookmarks() call setline(line(".")+1, i.str()) From 37bfae0d2f756dc307e1512b594063417058d2e1 Mon Sep 17 00:00:00 2001 From: Cam Thompson Date: Fri, 11 Feb 2011 18:49:42 -0500 Subject: [PATCH 03/15] rename press for help and bmark label options --- plugin/NERD_tree.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index f0762c5..a137e7c 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -51,8 +51,8 @@ call s:initVariable("g:NERDTreeAutoCenter", 1) call s:initVariable("g:NERDTreeAutoCenterThreshold", 3) call s:initVariable("g:NERDTreeCaseSensitiveSort", 0) call s:initVariable("g:NERDTreeChDirMode", 0) -call s:initVariable("g:NERDTreeShowPressForHelp", 1) -call s:initVariable("g:NERDTreeShowBookmarksLabel", 1) +call s:initVariable("g:NERDTreePressHelp", 1) +call s:initVariable("g:NERDTreeBmarksLabel", 1) if !exists("g:NERDTreeIgnore") let g:NERDTreeIgnore = ['\~$'] endif @@ -2999,7 +2999,7 @@ function! s:dumpHelp() let @h=@h."\" :ClearBookmarks []\n" let @h=@h."\" :ClearAllBookmarks\n" silent! put h - elseif g:NERDTreeShowPressForHelp == 1 + elseif g:NERDTreePressHelp == 1 let @h="\" Press ". g:NERDTreeMapHelp ." for help\n" silent! put h endif @@ -3242,7 +3242,7 @@ endfunction "FUNCTION: s:renderBookmarks {{{2 function! s:renderBookmarks() - if g:NERDTreeShowBookmarksLabel == 1 + if g:NERDTreeBmarksLabel == 1 call setline(line(".")+1, ">----------Bookmarks----------") call cursor(line(".")+1, col(".")) endif @@ -3272,7 +3272,7 @@ function! s:renderView() call s:dumpHelp() "delete the blank line before the help and add one after it - if g:NERDTreeShowPressForHelp == 1 + if g:NERDTreePressHelp == 1 call setline(line(".")+1, "") call cursor(line(".")+1, col(".")) endif From eac32148a435157ee911361082d78789b1ea7364 Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sat, 19 Feb 2011 12:36:14 +0100 Subject: [PATCH 04/15] Use small triangles for directories and get rid of ascii bars --- plugin/NERD_tree.vim | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 1d481ac..4a09df3 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -147,7 +147,7 @@ endif let s:NERDTreeBufName = 'NERD_tree_' let s:tree_wid = 2 -let s:tree_markup_reg = '^[ `|]*[\-+~]' +let s:tree_markup_reg = '^[ `|▾▸]*[\-+~ ]*' let s:tree_up_dir_line = '.. (up a dir)' "the number to add to the nerd tree buffer name to make the buf name unique @@ -1313,33 +1313,20 @@ function! s:TreeFileNode._renderToString(depth, drawText, vertMap, isLastChild) "get all the leading spaces and vertical tree parts for this line if a:depth > 1 for j in a:vertMap[0:-2] - if j ==# 1 - let treeParts = treeParts . '| ' - else - let treeParts = treeParts . ' ' - endif + let treeParts = treeParts . ' ' endfor endif - "get the last vertical tree part for this line which will be different - "if this node is the last child of its parent - if a:isLastChild - let treeParts = treeParts . '`' - else - let treeParts = treeParts . '|' - endif - - "smack the appropriate dir/file symbol on the line before the file/dir "name itself if self.path.isDirectory if self.isOpen - let treeParts = treeParts . '~' + let treeParts = treeParts . '▾ ' else - let treeParts = treeParts . '+' + let treeParts = treeParts . '▸ ' endif else - let treeParts = treeParts . '-' + let treeParts = treeParts . '' endif let line = treeParts . self.displayString() @@ -3068,9 +3055,9 @@ function! s:getPath(ln) endif " in case called from outside the tree - if line !~# '^ *[|`]' || line =~# '^$' - return {} - endif + " if line !~# '^ *[|`▸▾ ]' || line =~# '^$' + " return {} + " endif if line ==# s:tree_up_dir_line return b:NERDTreeRoot.path.getParent() From 867de9164322ac363baa5ef8bded68a95e7979ad Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Sun, 20 Feb 2011 20:42:03 +0100 Subject: [PATCH 05/15] Make indentation of file nodes more intuitive --- plugin/NERD_tree.vim | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 4a09df3..42f6445 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -1326,7 +1326,7 @@ function! s:TreeFileNode._renderToString(depth, drawText, vertMap, isLastChild) let treeParts = treeParts . '▸ ' endif else - let treeParts = treeParts . '' + let treeParts = treeParts . ' ' endif let line = treeParts . self.displayString() @@ -3112,7 +3112,13 @@ function! s:getTreeWinNum() endfunction "FUNCTION: s:indentLevelFor(line) {{{2 function! s:indentLevelFor(line) - return match(a:line, '[^ \-+~`|]') / s:tree_wid + let level = match(a:line, '[^ \-+~▸▾`|]') / s:tree_wid + " check if line includes arrows + if match(a:line, '[▸▾]') > -1 + " decrement level as arrow uses 3 ascii chars + let level = level - 1 + endif + return level endfunction "FUNCTION: s:isTreeOpen() {{{2 function! s:isTreeOpen() From 8accb0978e1b7dd7a1dde62fb76fd8445ace3b9a Mon Sep 17 00:00:00 2001 From: Marcin Kulik Date: Wed, 23 Feb 2011 18:30:42 +0100 Subject: [PATCH 06/15] Make tree style (|+~ or arrows) configurable --- doc/NERD_tree.txt | 16 ++++++++++++++ plugin/NERD_tree.vim | 51 ++++++++++++++++++++++++++++++++++++-------- 2 files changed, 58 insertions(+), 9 deletions(-) diff --git a/doc/NERD_tree.txt b/doc/NERD_tree.txt index 5ff0651..757b20a 100644 --- a/doc/NERD_tree.txt +++ b/doc/NERD_tree.txt @@ -642,6 +642,9 @@ NERD tree. These options should be set in your vimrc. |'NERDTreeWinSize'| Sets the window size when the NERD tree is opened. +|'NERDTreeDirArrows'| Tells the NERD tree to use arrows instead of + + ~ chars when displaying directories. + ------------------------------------------------------------------------------ 3.2. Customisation details *NERDTreeOptionDetails* @@ -921,6 +924,19 @@ Default: 31. This option is used to change the size of the NERD tree when it is loaded. +------------------------------------------------------------------------------ + *'NERDTreeDirArrows'* +Values: 0 or 1 +Default: 0. + +This option is used to change the default look of directory nodes displayed in +the tree. When set to 0 it shows old-school bars (|), + and ~ chars. If set to +1 it shows right and down arrows. Use one of the follow lines to set this +option: > + let NERDTreeDirArrows=0 + let NERDTreeDirArrows=1 +< + ============================================================================== 4. The NERD tree API *NERDTreeAPI* diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 42f6445..064b3f1 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -65,6 +65,7 @@ call s:initVariable("g:NERDTreeShowFiles", 1) call s:initVariable("g:NERDTreeShowHidden", 0) call s:initVariable("g:NERDTreeShowLineNumbers", 0) call s:initVariable("g:NERDTreeSortDirs", 1) +call s:initVariable("g:NERDTreeDirArrows", 0) if !exists("g:NERDTreeSortOrder") let g:NERDTreeSortOrder = ['\/$', '*', '\.swp$', '\.bak$', '\~$'] @@ -147,7 +148,7 @@ endif let s:NERDTreeBufName = 'NERD_tree_' let s:tree_wid = 2 -let s:tree_markup_reg = '^[ `|▾▸]*[\-+~ ]*' +let s:tree_markup_reg = '^[ `|]*[\-+~▾▸ ]*' let s:tree_up_dir_line = '.. (up a dir)' "the number to add to the nerd tree buffer name to make the buf name unique @@ -1313,20 +1314,50 @@ function! s:TreeFileNode._renderToString(depth, drawText, vertMap, isLastChild) "get all the leading spaces and vertical tree parts for this line if a:depth > 1 for j in a:vertMap[0:-2] - let treeParts = treeParts . ' ' + if g:NERDTreeDirArrows + let treeParts = treeParts . ' ' + else + if j ==# 1 + let treeParts = treeParts . '| ' + else + let treeParts = treeParts . ' ' + endif + endif endfor endif + "get the last vertical tree part for this line which will be different + "if this node is the last child of its parent + if !g:NERDTreeDirArrows + if a:isLastChild + let treeParts = treeParts . '`' + else + let treeParts = treeParts . '|' + endif + endif + "smack the appropriate dir/file symbol on the line before the file/dir "name itself if self.path.isDirectory if self.isOpen - let treeParts = treeParts . '▾ ' + if g:NERDTreeDirArrows + let treeParts = treeParts . '▾ ' + else + let treeParts = treeParts . '~' + endif else - let treeParts = treeParts . '▸ ' + if g:NERDTreeDirArrows + let treeParts = treeParts . '▸ ' + else + let treeParts = treeParts . '+' + endif endif else - let treeParts = treeParts . ' ' + if g:NERDTreeDirArrows + let treeParts = treeParts . ' ' + else + let treeParts = treeParts . '-' + endif endif let line = treeParts . self.displayString() @@ -3054,10 +3085,12 @@ function! s:getPath(ln) return b:NERDTreeRoot.path endif - " in case called from outside the tree - " if line !~# '^ *[|`▸▾ ]' || line =~# '^$' - " return {} - " endif + if !g:NERDTreeDirArrows + " in case called from outside the tree + if line !~# '^ *[|`▸▾ ]' || line =~# '^$' + return {} + endif + endif if line ==# s:tree_up_dir_line return b:NERDTreeRoot.path.getParent() From 2d17132f48d9af6ed8cc95021efc4624b76be21b Mon Sep 17 00:00:00 2001 From: Cam Thompson Date: Fri, 25 Feb 2011 13:14:49 -0500 Subject: [PATCH 07/15] add bookmarks and press help documentation --- doc/NERD_tree.txt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/doc/NERD_tree.txt b/doc/NERD_tree.txt index 5ff0651..155f187 100644 --- a/doc/NERD_tree.txt +++ b/doc/NERD_tree.txt @@ -642,6 +642,12 @@ NERD tree. These options should be set in your vimrc. |'NERDTreeWinSize'| Sets the window size when the NERD tree is opened. +|'NERDTreeBmarksLabel'| Enables display of the Bookmarks label in + the NERD tree. + +|'NERDTreePressHelp'| Enables display of the 'Press ? for help' at + the top of the NERD tree. + ------------------------------------------------------------------------------ 3.2. Customisation details *NERDTreeOptionDetails* @@ -921,6 +927,28 @@ Default: 31. This option is used to change the size of the NERD tree when it is loaded. +------------------------------------------------------------------------------ + *'NERDTreeBmarksLabel'* +Values: 0 or 1 +Default: 1 + +This options enables the 'Bookmarks' label. Use one of the following lines +to set this option: > + let NERDTreeBmarksLabel=0 + let NERDTreeBmarksLabel=1 +< + +------------------------------------------------------------------------------ + *'NERDTreePressHelp'* +Values: 0 or 1 +Default: 1 + +This options enables the 'Press ? for help' text. Use one of the following +lines to set this option: > + let NERDTreePressHelp=0 + let NERDTreePressHelp=1 +< + ============================================================================== 4. The NERD tree API *NERDTreeAPI* From 21bd1418667e2ae31c44400b0d51902eb27fb0dd Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Mon, 28 Feb 2011 10:55:15 +1300 Subject: [PATCH 08/15] fix highlighting of executable files with NERDTreeDirArrows --- plugin/NERD_tree.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 064b3f1..5248d5b 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -3428,7 +3428,7 @@ function! s:setupSyntaxHighlighting() "highlighing for directory nodes and file nodes syn match NERDTreeDirSlash #/# syn match NERDTreeDir #[^-| `].*/# contains=NERDTreeLink,NERDTreeDirSlash,NERDTreeOpenable,NERDTreeClosable - syn match NERDTreeExecFile #[|`]-.*\*\($\| \)# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark + syn match NERDTreeExecFile #[|` ].*\*\($\| \)# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark syn match NERDTreeFile #|-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile syn match NERDTreeFile #`-.*# contains=NERDTreeLink,NERDTreePart,NERDTreeRO,NERDTreePartFile,NERDTreeBookmark,NERDTreeExecFile syn match NERDTreeCWD #^/.*$# From 999ba4985752df5663ca2ebe2d89f951e47598bd Mon Sep 17 00:00:00 2001 From: Cam Thompson Date: Sun, 27 Feb 2011 20:36:06 -0500 Subject: [PATCH 09/15] merge hide bookmarks and press ? options --- doc/NERD_tree.txt | 30 ++++++++---------------------- plugin/NERD_tree.vim | 9 ++++----- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/doc/NERD_tree.txt b/doc/NERD_tree.txt index 155f187..171ee47 100644 --- a/doc/NERD_tree.txt +++ b/doc/NERD_tree.txt @@ -642,11 +642,8 @@ NERD tree. These options should be set in your vimrc. |'NERDTreeWinSize'| Sets the window size when the NERD tree is opened. -|'NERDTreeBmarksLabel'| Enables display of the Bookmarks label in - the NERD tree. - -|'NERDTreePressHelp'| Enables display of the 'Press ? for help' at - the top of the NERD tree. +|'NERDTreeMinimalUI'| Disables display of the 'Bookmarks' label and + 'Press ? for help' text. ------------------------------------------------------------------------------ 3.2. Customisation details *NERDTreeOptionDetails* @@ -928,25 +925,14 @@ Default: 31. This option is used to change the size of the NERD tree when it is loaded. ------------------------------------------------------------------------------ - *'NERDTreeBmarksLabel'* + *'NERDTreeMinimalUI'* Values: 0 or 1 -Default: 1 +Default: 0 -This options enables the 'Bookmarks' label. Use one of the following lines -to set this option: > - let NERDTreeBmarksLabel=0 - let NERDTreeBmarksLabel=1 -< - ------------------------------------------------------------------------------- - *'NERDTreePressHelp'* -Values: 0 or 1 -Default: 1 - -This options enables the 'Press ? for help' text. Use one of the following -lines to set this option: > - let NERDTreePressHelp=0 - let NERDTreePressHelp=1 +This options disables the 'Bookmarks' label 'Press ? for help' text. Use one +of the following lines to set this option: > + let NERDTreeMinimalUI=0 + let NERDTreeMinimalUI=1 < ============================================================================== diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index bec9b5a..dece7f5 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -51,8 +51,7 @@ call s:initVariable("g:NERDTreeAutoCenter", 1) call s:initVariable("g:NERDTreeAutoCenterThreshold", 3) call s:initVariable("g:NERDTreeCaseSensitiveSort", 0) call s:initVariable("g:NERDTreeChDirMode", 0) -call s:initVariable("g:NERDTreePressHelp", 1) -call s:initVariable("g:NERDTreeBmarksLabel", 1) +call s:initVariable("g:NERDTreeMinimalUI", 0) if !exists("g:NERDTreeIgnore") let g:NERDTreeIgnore = ['\~$'] endif @@ -2999,7 +2998,7 @@ function! s:dumpHelp() let @h=@h."\" :ClearBookmarks []\n" let @h=@h."\" :ClearAllBookmarks\n" silent! put h - elseif g:NERDTreePressHelp == 1 + elseif g:NERDTreeMinimalUI == 0 let @h="\" Press ". g:NERDTreeMapHelp ." for help\n" silent! put h endif @@ -3242,7 +3241,7 @@ endfunction "FUNCTION: s:renderBookmarks {{{2 function! s:renderBookmarks() - if g:NERDTreeBmarksLabel == 1 + if g:NERDTreeMinimalUI == 0 call setline(line(".")+1, ">----------Bookmarks----------") call cursor(line(".")+1, col(".")) endif @@ -3272,7 +3271,7 @@ function! s:renderView() call s:dumpHelp() "delete the blank line before the help and add one after it - if g:NERDTreePressHelp == 1 + if g:NERDTreeMinimalUI == 0 call setline(line(".")+1, "") call cursor(line(".")+1, col(".")) endif From d595605ff17b18fbc2addffb716e1a184b48f3eb Mon Sep 17 00:00:00 2001 From: Cam Thompson Date: Sun, 27 Feb 2011 21:18:28 -0500 Subject: [PATCH 10/15] hide (up a dir) when using minimal ui --- plugin/NERD_tree.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 9a11d34..44317da 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -150,7 +150,11 @@ let s:NERDTreeBufName = 'NERD_tree_' let s:tree_wid = 2 let s:tree_markup_reg = '^[ `|]*[\-+~▾▸ ]*' -let s:tree_up_dir_line = '.. (up a dir)' +if g:NERDTreeMinimalUI == 0 + let s:tree_up_dir_line = '.. (up a dir)' +else + let s:tree_up_dir_line = '..' +endif "the number to add to the nerd tree buffer name to make the buf name unique let s:next_buffer_number = 1 From e697444f29bbe2fb38f2274b6a136ad06ac3d755 Mon Sep 17 00:00:00 2001 From: Cam Thompson Date: Sun, 27 Feb 2011 21:30:43 -0500 Subject: [PATCH 11/15] set nornu when line numbers aren't shown --- plugin/NERD_tree.vim | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 44317da..fa8f182 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -2668,6 +2668,7 @@ function! s:initNerdTreeInPlace(dir) setlocal nu else setlocal nonu + setlocal nornu endif iabc @@ -2904,6 +2905,7 @@ function! s:createTreeWin() setlocal nu else setlocal nonu + setlocal nornu endif iabc From fad6f06ace98628bbfb0011fe9597ebecc9feb83 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Tue, 1 Mar 2011 10:54:06 +1300 Subject: [PATCH 12/15] fix a bug with NERDTreeMinimalUI and syntax highlighting Use \V for the updir text regex. Otherwise '..' is treated as a regex rather than 2 literal dots. --- plugin/NERD_tree.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index fa8f182..1321a17 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -3408,7 +3408,7 @@ function! s:setupSyntaxHighlighting() syn match NERDTreeFlag #\[RO\]# "highlighting for the .. (up dir) line at the top of the tree - execute "syn match NERDTreeUp #". s:tree_up_dir_line ."#" + execute "syn match NERDTreeUp #\\V". s:tree_up_dir_line ."#" "highlighting for the ~/+ symbols for the directory nodes syn match NERDTreeClosable #\~\<# From 702a88956bfc24a190f78bcfa98e387db6320160 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Tue, 1 Mar 2011 11:03:05 +1300 Subject: [PATCH 13/15] remove '.. (up a dir)' when NERDTreeMinimalUI is set Shortening this line doesnt add anything to the UI (functionally speaking), but removing frees up an extra line. Anyone who sets NERDTreeMinimalUI probably uses the u/U mappings anyway. --- plugin/NERD_tree.vim | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 1321a17..4a1d1e2 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -150,11 +150,7 @@ let s:NERDTreeBufName = 'NERD_tree_' let s:tree_wid = 2 let s:tree_markup_reg = '^[ `|]*[\-+~▾▸ ]*' -if g:NERDTreeMinimalUI == 0 - let s:tree_up_dir_line = '.. (up a dir)' -else - let s:tree_up_dir_line = '..' -endif +let s:tree_up_dir_line = '.. (up a dir)' "the number to add to the nerd tree buffer name to make the buf name unique let s:next_buffer_number = 1 @@ -3313,8 +3309,10 @@ function! s:renderView() endif "add the 'up a dir' line - call setline(line(".")+1, s:tree_up_dir_line) - call cursor(line(".")+1, col(".")) + if !g:NERDTreeMinimalUI + call setline(line(".")+1, s:tree_up_dir_line) + call cursor(line(".")+1, col(".")) + endif "draw the header line let header = b:NERDTreeRoot.path.str({'format': 'UI', 'truncateTo': winwidth(0)}) From bc0c64ef82dce34f904520477c861f4d2d3d5f9e Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Tue, 1 Mar 2011 11:28:57 +1300 Subject: [PATCH 14/15] fix a bug when the bookmarks are toggled with NERDTreeMinimalUI --- plugin/NERD_tree.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 4a1d1e2..e490ba8 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -3244,6 +3244,10 @@ function! s:putCursorOnBookmarkTable() throw "NERDTree.IllegalOperationError: cant find bookmark table, bookmarks arent active" endif + if g:NERDTreeMinimalUI + return cursor(1, 2) + endif + let rootNodeLine = s:TreeFileNode.GetRootLineNum() let line = 1 @@ -3253,7 +3257,7 @@ function! s:putCursorOnBookmarkTable() throw "NERDTree.BookmarkTableNotFoundError: didnt find the bookmarks table" endif endwhile - call cursor(line, 0) + call cursor(line, 2) endfunction "FUNCTION: s:putCursorInTreeWin(){{{2 From 1dd345c56db1d11e1c1c7838587b03df7cbd5733 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Thu, 3 Mar 2011 12:18:04 +1300 Subject: [PATCH 15/15] only set relativenumber for vim >= 7.3 --- plugin/NERD_tree.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index e490ba8..5612e81 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -2664,7 +2664,9 @@ function! s:initNerdTreeInPlace(dir) setlocal nu else setlocal nonu - setlocal nornu + if v:version >= 703 + setlocal nornu + endif endif iabc @@ -2901,7 +2903,9 @@ function! s:createTreeWin() setlocal nu else setlocal nonu - setlocal nornu + if v:version >= 703 + setlocal nornu + endif endif iabc