From 7522cbf4f0143a2b4b6e1e81e3cde44010162ed3 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Thu, 15 Jan 2009 14:41:52 +1300 Subject: [PATCH] add g:NERDTreeStatusline option allows the statusline to be customised for the nerd tree window --- doc/NERD_tree.txt | 16 ++++++++++++++++ plugin/NERD_tree.vim | 11 ++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/doc/NERD_tree.txt b/doc/NERD_tree.txt index 7420045..c760034 100644 --- a/doc/NERD_tree.txt +++ b/doc/NERD_tree.txt @@ -641,6 +641,8 @@ NERD tree. These options should be set in your vimrc. |'NERDTreeSortOrder'| Tell the NERD tree how to sort the nodes in the tree. +|'NERDTreeStatusline'| Set a statusline for NERD tree windows. + |'NERDTreeWinPos'| Tells the script where to put the NERD tree window. @@ -893,6 +895,20 @@ Other examples: > 3. Dirs will appear first, then ruby and php. Swap files, bak files and vim backup files will appear last with everything else preceding them. +------------------------------------------------------------------------------ + *'NERDTreeStatusline'* +Values: Any valid statusline setting. +Default: %{b:NERDTreeRoot.path.strForOS(0)} + +Tells the script what to use as the |'statusline'| setting for NERD tree +windows. + +Note that the statusline is set using |:let-&| not |:set| so escaping spaces +isn't necessary. + +Setting this option to -1 will will deactivate it so that your global +statusline setting is used instead. + ------------------------------------------------------------------------------ *'NERDTreeWinPos'* Values: "left" or "right" diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index a31a9f7..2f8f586 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -79,6 +79,7 @@ endif "once here let s:NERDTreeSortStarIndex = index(g:NERDTreeSortOrder, '*') +call s:initVariable("g:NERDTreeStatusline", "%{b:NERDTreeRoot.path.strForOS(0)}") call s:initVariable("g:NERDTreeWinPos", "left") call s:initVariable("g:NERDTreeWinSize", 31) @@ -2142,6 +2143,8 @@ function! s:initNerdTreeInPlace(dir) setlocal cursorline endif + call s:setupStatusline() + let b:treeShowHelp = 0 let b:NERDTreeIgnoreEnabled = 1 let b:NERDTreeShowFiles = g:NERDTreeShowFiles @@ -2378,7 +2381,7 @@ function! s:createTreeWin() setlocal cursorline endif - + call s:setupStatusline() call s:bindMappings() setfiletype nerdtree @@ -2847,6 +2850,12 @@ function! s:saveScreenState() endtry endfunction +"FUNCTION: s:setupStatusline() {{{2 +function! s:setupStatusline() + if g:NERDTreeStatusline != -1 + let &l:statusline = g:NERDTreeStatusline + endif +endfunction "FUNCTION: s:setupSyntaxHighlighting() {{{2 function! s:setupSyntaxHighlighting() "treeFlags are syntax items that should be invisible, but give clues as to