Implement the "isHiddenUnder()" method for Path
This commit is contained in:
parent
57788abd6f
commit
0ff697eb40
@ -277,11 +277,6 @@ function! s:findAndRevealPath(pathStr)
|
|||||||
return
|
return
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
if l:pathObj.isUnixHiddenPath()
|
|
||||||
let l:showHidden = g:NERDTreeShowHidden
|
|
||||||
let g:NERDTreeShowHidden = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !g:NERDTree.ExistsForTab()
|
if !g:NERDTree.ExistsForTab()
|
||||||
try
|
try
|
||||||
let l:cwd = g:NERDTreePath.New(getcwd())
|
let l:cwd = g:NERDTreePath.New(getcwd())
|
||||||
@ -298,19 +293,18 @@ function! s:findAndRevealPath(pathStr)
|
|||||||
else
|
else
|
||||||
NERDTreeFocus
|
NERDTreeFocus
|
||||||
|
|
||||||
if !l:pathObj.isUnder(g:NERDTreeFileNode.GetRootForTab().path)
|
if !l:pathObj.isUnder(b:NERDTree.root.path)
|
||||||
call b:NERDTree.ui.setShowHidden(g:NERDTreeShowHidden)
|
|
||||||
call s:chRoot(g:NERDTreeDirNode.New(l:pathObj.getParent(), b:NERDTree))
|
call s:chRoot(g:NERDTreeDirNode.New(l:pathObj.getParent(), b:NERDTree))
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if l:pathObj.isHiddenUnder(b:NERDTree.root.path)
|
||||||
|
call b:NERDTree.ui.setShowHidden(1)
|
||||||
|
endif
|
||||||
|
|
||||||
let l:node = b:NERDTree.root.reveal(l:pathObj)
|
let l:node = b:NERDTree.root.reveal(l:pathObj)
|
||||||
call b:NERDTree.render()
|
call b:NERDTree.render()
|
||||||
call l:node.putCursorHere(1, 0)
|
call l:node.putCursorHere(1, 0)
|
||||||
|
|
||||||
if l:pathObj.isUnixHiddenFile()
|
|
||||||
let g:NERDTreeShowHidden = l:showHidden
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:handleLeftClick() {{{1
|
"FUNCTION: s:handleLeftClick() {{{1
|
||||||
|
@ -405,6 +405,25 @@ function! s:Path.getSortKey()
|
|||||||
return self._sortKey
|
return self._sortKey
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: Path.isHiddenUnder(path) {{{1
|
||||||
|
function! s:Path.isHiddenUnder(path)
|
||||||
|
|
||||||
|
if !self.isUnder(a:path)
|
||||||
|
return 0
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:startIndex = len(a:path.pathSegments)
|
||||||
|
let l:segments = self.pathSegments[l:startIndex:]
|
||||||
|
|
||||||
|
for l:segment in l:segments
|
||||||
|
|
||||||
|
if l:segment =~# '^\.'
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return 0
|
||||||
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: Path.isUnixHiddenFile() {{{1
|
" FUNCTION: Path.isUnixHiddenFile() {{{1
|
||||||
" check for unix hidden files
|
" check for unix hidden files
|
||||||
|
Loading…
x
Reference in New Issue
Block a user