mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
feat: support for unresolved symlinks.
This commit is contained in:
@@ -62,7 +62,11 @@ function! s:Path.cacheDisplayString() abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
if self.isSymLink
|
if self.isSymLink
|
||||||
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' -> ' . self.symLinkDest
|
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' -> '
|
||||||
|
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . self.symLinkDest
|
||||||
|
if self.isUnresolved
|
||||||
|
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . g:NERDTreeGlyphBroken
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !self.isDirectory && b:NERDTree.ui.getShowFileLines() != 0
|
if !self.isDirectory && b:NERDTree.ui.getShowFileLines() != 0
|
||||||
@@ -607,24 +611,33 @@ function! s:Path.readInfoFromDisk(fullpath)
|
|||||||
|
|
||||||
let fullpath = s:Path.WinToUnixPath(a:fullpath)
|
let fullpath = s:Path.WinToUnixPath(a:fullpath)
|
||||||
|
|
||||||
if getftype(fullpath) ==# 'fifo'
|
let ftype = getftype(fullpath)
|
||||||
|
|
||||||
|
if ftype ==# 'fifo'
|
||||||
throw 'NERDTree.InvalidFiletypeError: Cant handle FIFO files: ' . a:fullpath
|
throw 'NERDTree.InvalidFiletypeError: Cant handle FIFO files: ' . a:fullpath
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let self.pathSegments = filter(split(fullpath, '/'), '!empty(v:val)')
|
let self.pathSegments = filter(split(fullpath, '/'), '!empty(v:val)')
|
||||||
|
|
||||||
let self.isReadOnly = 0
|
|
||||||
if isdirectory(a:fullpath)
|
if isdirectory(a:fullpath)
|
||||||
let self.isDirectory = 1
|
let self.isDirectory = 1
|
||||||
|
let self.isReadOnly = 0
|
||||||
|
let self.isUnresolved = 0
|
||||||
elseif filereadable(a:fullpath)
|
elseif filereadable(a:fullpath)
|
||||||
let self.isDirectory = 0
|
let self.isDirectory = 0
|
||||||
let self.isReadOnly = filewritable(a:fullpath) ==# 0
|
let self.isReadOnly = filewritable(a:fullpath) ==# 0
|
||||||
|
let self.isUnresolved = 0
|
||||||
|
elseif ftype ==# 'link'
|
||||||
|
let self.isDirectory = 0
|
||||||
|
let self.isReadOnly = 0
|
||||||
|
let self.isUnresolved = 1
|
||||||
else
|
else
|
||||||
|
call nerdtree#echoWarning('invalid ' . a:fullpath . 'file type: ' . ftype)
|
||||||
throw 'NERDTree.InvalidArgumentsError: Invalid path = ' . a:fullpath
|
throw 'NERDTree.InvalidArgumentsError: Invalid path = ' . a:fullpath
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let self.isExecutable = 0
|
let self.isExecutable = 0
|
||||||
if !self.isDirectory
|
if !self.isDirectory && !self.isUnresolved
|
||||||
let self.isExecutable = getfperm(a:fullpath) =~# 'x'
|
let self.isExecutable = getfperm(a:fullpath) =~# 'x'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ function! s:TreeDirNode._glob(pattern, all)
|
|||||||
" See ':h version7.txt' and ':h version8.txt' for details on the
|
" See ':h version7.txt' and ':h version8.txt' for details on the
|
||||||
" development of the glob() and globpath() functions.
|
" development of the glob() and globpath() functions.
|
||||||
if v:version > 704 || (v:version ==# 704 && has('patch654'))
|
if v:version > 704 || (v:version ==# 704 && has('patch654'))
|
||||||
let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1, 0)
|
let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1, 1)
|
||||||
elseif v:version ==# 704 && has('patch279')
|
elseif v:version ==# 704 && has('patch279')
|
||||||
let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1)
|
let l:globList = globpath(l:pathSpec, a:pattern, !g:NERDTreeRespectWildIgnore, 1)
|
||||||
elseif v:version > 702 || (v:version ==# 702 && has('patch051'))
|
elseif v:version > 702 || (v:version ==# 702 && has('patch051'))
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ let g:NERDTreeSortOrder = get(g:, 'NERDTreeSortOrder', ['\/$', '*', '\.swp$',
|
|||||||
let g:NERDTreeOldSortOrder = []
|
let g:NERDTreeOldSortOrder = []
|
||||||
|
|
||||||
let g:NERDTreeGlyphReadOnly = get(g:, 'NERDTreeGlyphReadOnly', 'RO')
|
let g:NERDTreeGlyphReadOnly = get(g:, 'NERDTreeGlyphReadOnly', 'RO')
|
||||||
|
let g:NERDTreeGlyphBroken = get(g:, 'NERDTreeGlyphBroken', ' [*broken]')
|
||||||
|
|
||||||
if has('conceal')
|
if has('conceal')
|
||||||
let g:NERDTreeNodeDelimiter = get(g:, 'NERDTreeNodeDelimiter', "\x07")
|
let g:NERDTreeNodeDelimiter = get(g:, 'NERDTreeNodeDelimiter', "\x07")
|
||||||
|
|||||||
Reference in New Issue
Block a user