Merge pull request #822 from scrooloose/821-better_delete_confirmation

If node isn't open, count children on disk before deleting.
This commit is contained in:
Phil Runninger 2018-04-02 14:01:00 -04:00 committed by GitHub
commit a0e49c9b11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -175,7 +175,8 @@ function! NERDTreeDeleteNode()
let currentNode = g:NERDTreeFileNode.GetSelected() let currentNode = g:NERDTreeFileNode.GetSelected()
let confirmed = 0 let confirmed = 0
if currentNode.path.isDirectory && currentNode.getChildCount() > 0 if currentNode.path.isDirectory && ((currentNode.isOpen && currentNode.getChildCount() > 0) ||
\ (len(currentNode._glob('*', 1)) > 0))
let choice =input("Delete the current node\n" . let choice =input("Delete the current node\n" .
\ "==========================================================\n" . \ "==========================================================\n" .
\ "STOP! Directory is not empty! To delete, type 'yes'\n" . \ "STOP! Directory is not empty! To delete, type 'yes'\n" .