commit b702500f7775581fe5ff4fc23aca6f00a141a75b
parent ed446e5cbe0733a8f98befc88d33e42edebb67d2
Author: Phil Runninger <PhilRunninger@users.noreply.github.com>
Date: Tue, 13 Mar 2018 08:41:08 -0400
Merge pull request #816 from kutsan/master
Add new variable g:NERDTreeRemoveFileCmd
Diffstat:
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/doc/NERDTree.txt b/doc/NERDTree.txt
@@ -694,6 +694,12 @@ NERD tree. These options should be set in your vimrc.
|'NERDTreeCreatePrefix'| Specify a prefix to be used when creating the
NERDTree window.
+|'NERDTreeRemoveFileCmd'| Specify a custom shell command that will used
+ when deleting files with delete action. Note
+ that, it should be one space character at the
+ end of the command and it applies only for files.
+ See |g:NERDTreeRemoveDirCmd| for directories.
+
------------------------------------------------------------------------------
3.2. Customisation details *NERDTreeOptionDetails*
diff --git a/lib/nerdtree/path.vim b/lib/nerdtree/path.vim
@@ -246,7 +246,13 @@ function! s:Path.delete()
throw "NERDTree.PathDeletionError: Could not delete directory: '" . self.str() . "'"
endif
else
- let success = delete(self.str())
+ if exists('g:NERDTreeRemoveFileCmd')
+ let cmd = g:NERDTreeRemoveFileCmd . self.str({'escape': 1})
+ let success = system(cmd)
+ else
+ let success = delete(self.str())
+ endif
+
if success != 0
throw "NERDTree.PathDeletionError: Could not delete file: '" . self.str() . "'"
endif
@@ -409,7 +415,7 @@ endfunction
" FUNCTION: Path.isHiddenUnder(path) {{{1
function! s:Path.isHiddenUnder(path)
-
+
if !self.isUnder(a:path)
return 0
endif
@@ -418,7 +424,7 @@ function! s:Path.isHiddenUnder(path)
let l:segments = self.pathSegments[l:startIndex : ]
for l:segment in l:segments
-
+
if l:segment =~# '^\.'
return 1
endif