nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit 960fda6299188eb82e2307c1b377e2c3e2dc7501
parent fec3e57ad23e4c268d07181d6afb858925b647a1
Author: jhzn <jhakanzon@gmail.com>
Date:   Wed, 13 Nov 2019 14:58:42 +0100

Menu option, 'copy path to clipboard' is aware of VIM clipboard option (#1056)

VIM noob here, so code might not be optimal.

My setup is as follows.
NVIM v0.5.0-95-g2e14dffbb, Linux Mint 19.2.

I have this in init.vim
```vim
set clipboard=unnamedplus
```
This enables me to share clipboard between VIM and X clipboard.

The problem is that the menu option in NERDTree copies the file path to the "* register.
This means I can't access the value in the X clipboard.
Diffstat:
Mnerdtree_plugin/fs_menu.vim | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/nerdtree_plugin/fs_menu.vim b/nerdtree_plugin/fs_menu.vim
@@ -369,7 +369,11 @@ endfunction
 function! NERDTreeCopyPath()
     let l:nodePath = g:NERDTreeFileNode.GetSelected().path.str()
     if has("clipboard")
-        let @* = l:nodePath
+        if &clipboard == "unnamedplus"
+            let @+ = l:nodePath
+        else
+            let @* = l:nodePath
+        endif
         call nerdtree#echo("The path [" . l:nodePath . "] was copied to your clipboard.")
     else
         call nerdtree#echo("The full path is: " . l:nodePath)