The current working directory is ./A/B/. An empty document is opened when I type vim, and the netrw is opened with command :e. The window is split by vs., and I can navigate to the upper level directory, i.e., ./A/. Now I'd like to copy a file a_file.jpg from ./A/B/ to ./A/.

I tried yy on the target file and p in the target window (directory), but it did not achieve my goal.

Is there any way that can achieve the goal without installing extra plugins?

  • 1
    Try the following: hit mt on the target directory in which you want to make a copy of a file (to mark it ; the path to the folder should appear in the banner after Copy/Move Tgt:), hit mf on the file you want to copy to mark it as well, then hit mc to actually perform the copy.
    – saginaw
    Commented Jan 26, 2016 at 7:38

3 Answers 3


You cannot use y, p etc., to copy files in netrw - it comes with its own commands. See :h netrw-mc:

MARKED FILES: COPYING                                           netrw-mc {{{2
            (See netrw-mf and netrw-mr for how to mark files)
                      (Uses the global marked file list)

Select a target directory with mt (netrw-mt).  Then change directory,
select file(s) (see netrw-mf), and press "mc".  The copy is done
from the current window (where one does the mf) to the target.

If one does not have a target directory set with netrw-mt, then netrw
will query you for a directory to copy to.

One may also copy directories and their contents (local only) to a target

Your case is simplified since ./A is the parent of ./A/B:

  1. Open ./A/B, move to the line having ../,
  2. Mark it with mt
  3. Move to the line with the file you want to copy.
  4. Press mf, and then mc.


$ tree foo
└── bar
    └── test

1 directory, 1 file
$ vim foo/bar


  1. Move to .. and press mt:

    enter image description here

  2. The header will change to show the current target:

    enter image description here

  3. Move to the file (here test) and press mf. It gets highlighted for me:

    enter image description here

  4. Press mc - the highlighting goes away. Now navigate to the parent folder - the file should be present:

    enter image description here


I would do this from the command line mode:

  • Select the file you need in netrw
  • Open command the line and type - :!mv <C-R><C-F> ../<C-R><C-F>

Here <C-R><C-F> inserts file name under cursor, so you don't have to type the file name.

  • 1
    Very cool. Doesn't include the full path if you've traversed into your tree in netrw...
    – J0hnG4lt
    Commented Mar 8, 2016 at 14:38
  • Set cursor on ./ (or directory in which you want to copy) , press mt
  • Set cursor on file you want copy, press mf, then mc, type a name of new file, enter
  • 2
    I got (netrw) tried using g:netrw_localcopycmd<cp>; it doesn't work!$ Commented Feb 21, 2018 at 18:13
  • solution for osx stackoverflow.com/questions/31811335/… Commented Feb 21, 2018 at 18:20
  • @HarryMoreno it worked on my osx iTerm2
    – itsnikolay
    Commented Feb 22, 2018 at 7:37
  • I got the same error as @HarryMoreno. The answer from Boris Serebrov worked for me instead. Commented Sep 5, 2022 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.