I don't see the menu option for Copy
command. Here is the menu that I see on my Windows 7 machine:
NERDTree Menu. Use j/k/enter and the shortcuts indicated
==========================================================
> (a)dd a childnode
(m)ove the curent node
(d)elete the curent node
According to the plugin documentation, the Copy
command is not supported on all platforms.
A textual filesystem menu is provided which allows you to create/delete/move file
and directory nodes as well as copy (for supported OSs)
Has anybody managed to get this to work in Windows?
I got it working by installing Gow
choco install -y gow
Then adding this line to vim
let g:NERDTreeCopyCmd= 'cp -r'
Thanks: https://github.com/scrooloose/nerdtree/issues/152
PS: The choco command comes from https://chocolatey.org/
The root cause for the issue is discussed in detail(rather colorfully) in this blog post.(ht romainl).
I managed to find a solution by using the cp.exe
shipped with msygit.
Ensure cp.exe
is in your path
The cp.exe
file can be found in <GIT_HOME>\bin
directory. My path didn't not contain the <GIT_HOME>\bin
directory. So I copied cp.exe
and msys-1.0.dll
to a directory in my path.
Set the g:NERDTreeCopyCmd
variable
Add the line below to the end of the _vimrc
file
let g:NERDTreeCopyCmd= 'cp -r '
Fix the implementation of s:Path.copy
function.
Replace the lines 2297-2299 of ~/vimfiles/bundle/nerdtree/plugin/NERD_tree.vim
(assuming you used pathogen for managing vim plugins)
Replace the lines 2297-2299
let dest = s:Path.WinToUnixPath(a:dest)
let cmd = g:NERDTreeCopyCmd . " " . escape(self.str(), s:escape_chars) . " " . escape(dest, s:escape_chars)
With the lines below
let dest = a:dest
let cmd = 0
if s:running_windows
let cmd = g:NERDTreeCopyCmd . '"' . self.str() . '" "' . dest . '"'
else
let cmd = g:NERDTreeCopyCmd . " " . escape(self.str(), s:escape_chars) . " " . escape(dest, s:escape_chars)
endif
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With