Skip to content

Commit

Permalink
add Path.isUnixHiddenFile and refactor to use it
Browse files Browse the repository at this point in the history
  • Loading branch information
scrooloose committed Nov 12, 2012
1 parent 36cd8bf commit 30a770a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions plugin/NERD_tree.vim
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 30a770a

Please sign in to comment.