Skip to content

Instantly share code, notes, and snippets.

Last active June 8, 2023 15:42
Star You must be signed in to star a gist
What would you like to do?
A quick reference for Vim's built-in netrw file selector.
Map Action
<F1> Causes Netrw to issue help
<cr> Netrw will enter the directory or read the file
<del> Netrw will attempt to remove the file/directory
- Makes Netrw go up one directory
a Toggles between normal display, hiding (suppress display of files matching g:netrw_list_hide) showing (display only files which match g:netrw_list_hide)
c Make browsing directory the current directory
C Setting the editing window
d Make a directory
D Attempt to remove the file(s)/directory(ies)
gb Go to previous bookmarked directory
gh Quick hide/unhide of dot-files
<c-h> Edit file hiding list
i Cycle between thin, long, wide and tree listings
<c-l> Causes Netrw to refresh the directory listing
mb Bookmark current directory
mc Copy marked files to marked-file target directory
md Apply diff to marked files (up to 3)
me Place marked files on arg list and edit them
mf Mark a file
mh Toggle marked file suffices' presence on hiding list
mm Move marked files to marked-file target directory
mp Print marked files
mr Mark files satisfying a shell-style
mt Current browsing directory becomes markfile target
mT Apply ctags to marked files
mu Unmark all marked files
mx Apply arbitrary shell command to marked files
mz Compress/decompress marked files
o Enter the file/directory under the cursor in a new browser window. A horizontal split is used.
O Obtain a file specified by cursor
p Preview the file
P Browse in the previously used window
qb List bookmarked directories and history
qf Display information on file
r Reverse sorting order
R Rename the designed file(s)/directory(ies)
s Select sorting style: by name, time or file size
S Specify suffix priority for name-sorting
t Enter the file/directory under the cursor in a new tab
u Change to recently-visited directory
U Change to subsequently-visited directory
v Enter the file/directory under the cursor in a new browser window. A vertical split is used.
x View file with an associated program
X Execute filename under cursor via
% Open a new file in netrw's current directory
Copy link

Amine26 commented Nov 4, 2017


Copy link

Just what I needed!

Copy link

ArtBIT commented Mar 29, 2018

Or simply bind ? to show netrw quickmaps help entry:

autocmd FileType netrw nnoremap ? :help netrw-quickmap<CR>

Copy link

vmnair commented Apr 29, 2018

Thank you

Copy link

Starring — great reference and super helpful comment by @ArtBIT 👍

Copy link

vysogot commented Feb 21, 2020

Thank you!

Copy link


Copy link

pseyfert commented Aug 10, 2021

@ArtBIT iiuc that command binding persists in other buffers


  • open a file in vim
  • ? is search
  • split view (^Wv)
  • open netrw (:e ./)
  • ? opens netrw quickmap
  • go back to the file buffer ^w^w
  • ? still opens netrw quickmap. imo it should (meaning it would be more intuitive and more desirable) search again.

Copy link

ArtBIT commented Aug 10, 2021

@pseyfert you could try something like this, then:

autocmd BufEnter * if &ft == "netrw" | execute 'nmap ? :help netrw-quickmap<CR>' | endif
autocmd BufEnter * if &ft != "netrw" | execute 'silent! nunmap ?' | endif

Copy link

gn -- make netrw move the currently selected directory to the root of the buffer view

Copy link

I wonder if there's a way to print this gist without all the github fluff around it.

Copy link

@davidmaxwaterman There are a few options:

  • Fork the gist, then no comments will remain in the new fork
  • Open web developer tools and you delete the nodes you want to take out

Copy link

MK-314 commented Jul 15, 2022

In order to copy the content of directory/folder A to folder B:

  1. mark A with "mf"
  2. mark B with "mf" (order matters)
  3. press "mX" and enter: cp -r % %

To remove directory/folder A:

  1. mark A with "mf"
  2. press "mX" and enter: rm -r %

Copy link

Hey @davidmaxwaterman I created a bookmarklet that lets you remove all the "github fluff" here:

Copy link

realwitt commented Jun 8, 2023

I could never get c to set the browsing directory as the current working directory, the command that worked for me was actually cd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment