diff --git a/CHANGELOG.md b/CHANGELOG.md index a21b7b5..48204fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR) --> #### 6.10 +- **.14**: Replace trim() with a version-compatible alternative. (PhilRunninger) [#1265](https://github.com/preservim/nerdtree/pull/1265) - **.13**: Change highlighting of bookmarks in the tree. (PhilRunninger) [#1261](https://github.com/preservim/nerdtree/pull/1261) - **.12**: Answer the question about accessing files over scp or ftp. (PhilRunninger) [#1259](https://github.com/preservim/nerdtree/pull/1259) - **.11**: Trim filenames created via the fs_menu (elanorigby) [#1243](https://github.com/preservim/nerdtree/pull/1243) diff --git a/nerdtree_plugin/fs_menu.vim b/nerdtree_plugin/fs_menu.vim index 33ff667..05bee60 100644 --- a/nerdtree_plugin/fs_menu.vim +++ b/nerdtree_plugin/fs_menu.vim @@ -169,7 +169,7 @@ endfunction function! NERDTreeAddNode() let curDirNode = g:NERDTreeDirNode.GetSelected() let prompt = s:inputPrompt('add') - let newNodeName = trim(input(prompt, curDirNode.path.str() . nerdtree#slash(), 'file')) + let newNodeName = substitute(input(prompt, curDirNode.path.str() . nerdtree#slash(), 'file'), '\(^\s*\|\s*$\)', '', 'g') if newNodeName ==# '' call nerdtree#echo('Node Creation Aborted.') @@ -206,7 +206,7 @@ function! NERDTreeMoveNode() let newNodePath = input(prompt, curNode.path.str(), 'file') while filereadable(newNodePath) call nerdtree#echoWarning('This destination already exists. Try again.') - let newNodePath = trim(input(prompt, curNode.path.str(), 'file')) + let newNodePath = substitute(input(prompt, curNode.path.str(), 'file'), '\(^\s*\|\s*$\)', '', 'g') endwhile @@ -337,7 +337,7 @@ endfunction function! NERDTreeCopyNode() let currentNode = g:NERDTreeFileNode.GetSelected() let prompt = s:inputPrompt('copy') - let newNodePath = trim(input(prompt, currentNode.path.str(), 'file')) + let newNodePath = substitute(input(prompt, currentNode.path.str(), 'file'), '\(^\s*\|\s*$\)', '', 'g') if newNodePath !=# '' "strip trailing slash