From c4f8a0f370f31e90b1dc20868db6150cb80c1b30 Mon Sep 17 00:00:00 2001 From: "Phil Runninger (mac)" Date: Wed, 16 May 2018 13:09:20 -0400 Subject: [PATCH] Like m-c did before, create parent directories if needed on m-m. --- lib/nerdtree/path.vim | 2 ++ nerdtree_plugin/fs_menu.vim | 1 + 2 files changed, 3 insertions(+) diff --git a/lib/nerdtree/path.vim b/lib/nerdtree/path.vim index 80607c5..2d8de23 100644 --- a/lib/nerdtree/path.vim +++ b/lib/nerdtree/path.vim @@ -663,6 +663,8 @@ function! s:Path.rename(newPath) throw "NERDTree.InvalidArgumentsError: Invalid newPath for renaming = ". a:newPath endif + call s:Path.createParentDirectories(a:newPath) + let success = rename(self.str(), a:newPath) if success != 0 throw "NERDTree.PathRenameError: Could not rename: '" . self.str() . "'" . 'to:' . a:newPath diff --git a/nerdtree_plugin/fs_menu.vim b/nerdtree_plugin/fs_menu.vim index e963a5f..ecca9cd 100644 --- a/nerdtree_plugin/fs_menu.vim +++ b/nerdtree_plugin/fs_menu.vim @@ -158,6 +158,7 @@ function! NERDTreeMoveNode() let bufnum = bufnr("^".curNode.path.str()."$") call curNode.rename(newNodePath) + call b:NERDTree.root.refresh() call NERDTreeRender() "if the node is open in a buffer, ask the user if they want to