mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-09 20:03:48 -05:00
Enable full path specifications for NERDTreeIgnore (#1207)
* Add ability to specify a path to be ignored. This ignore expression compares itself against the whole path of the node, instead of just the tail component of the node. * Remove debug statements and make it work on Windows. * Restore the original self.str() to get OS-specific paths for comparing. Using the UI-formatted path had two problems. 1. It always appended a forward slash at the end of the path, which was unnecessary and made patterns like '/tmp/cache$[[path]]' not work as expected. 2. It always used forward slashes to join the path components. I thought this would be a good thing, but there's no reason to force Windows users to use that syntax. They'll just need to remember to escape the backslashes, like so: '\\Temp\\cache$[[path]]' * Add documentation for the new [[path]] tag for NERDTreeIgnore. * Replace the abbreviation 'dir' with the full word 'directory'. * Update version number in change log.
This commit is contained in:
@@ -483,7 +483,10 @@ endfunction
|
||||
" returns true if this path matches the given ignore pattern
|
||||
function! s:Path._ignorePatternMatches(pattern)
|
||||
let pat = a:pattern
|
||||
if strpart(pat,len(pat)-7) ==# '[[dir]]'
|
||||
if strpart(pat,len(pat)-8) ==# '[[path]]'
|
||||
let pat = strpart(pat,0, len(pat)-8)
|
||||
return self.str() =~# pat
|
||||
elseif strpart(pat,len(pat)-7) ==# '[[dir]]'
|
||||
if !self.isDirectory
|
||||
return 0
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user