nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit 30a770aab0cacaea991a1b9ded1c9fdfbe8e5131
parent 36cd8bfea733659684aae54202b31c81bb74e790
Author: Martin Grenfell <martin.grenfell@gmail.com>
Date:   Mon, 12 Nov 2012 09:55:50 +0000

add Path.isUnixHiddenFile and refactor to use it

Diffstat:
Mplugin/NERD_tree.vim | 13++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -2486,6 +2486,13 @@ function! s:Path.getSortOrderIndex()
     return s:NERDTreeSortStarIndex
 endfunction
 
+
+"FUNCTION: Path.isUnixHiddenFile() {{{3
+"check for unix hidden files
+function! s:Path.isUnixHiddenFile()
+    return self.getLastPathComponent(0) =~# '^\.'
+endfunction
+
 "FUNCTION: Path.ignore() {{{3
 "returns true if this path should be ignored
 function! s:Path.ignore()
@@ -2499,7 +2506,7 @@ function! s:Path.ignore()
     endif
 
     "dont show hidden files unless instructed to
-    if b:NERDTreeShowHidden ==# 0 && self.getLastPathComponent(0) =~# '^\.'
+    if b:NERDTreeShowHidden ==# 0 && self.isUnixHiddenFile()
         return 1
     endif
 
@@ -2999,7 +3006,7 @@ function! s:findAndRevealPath()
         return
     endtry
 
-    if p.getLastPathComponent(0) =~# '^\.'
+    if p.isUnixHiddenFile()
         let showhidden=g:NERDTreeShowHidden
         let g:NERDTreeShowHidden = 1
     endif
@@ -3029,7 +3036,7 @@ function! s:findAndRevealPath()
     call s:putCursorInTreeWin()
     call b:NERDTreeRoot.reveal(p)
 
-    if p.getLastPathComponent(0) =~# '^\.'
+    if p.isUnixHiddenFile()
         let g:NERDTreeShowHidden = showhidden
     endif
 endfunction