Home Explore Blog CI



neovim

19th chunk of `runtime/pack/dist/opt/netrw/doc/netrw.txt`
3c67293dbe1d7b2715d3cc562af1ba3509a03fdb9d1d01970000000100000fb1
 typically stored in the first directory on the user's
'runtimepath'; entries are kept in sorted order.

If there are marked files and/or directories, mb will add them to the bookmark
list.

								*netrw-:NetrwMB*
Additionally, one may use :NetrwMB to bookmark files or directories. >

	:NetrwMB[!] [files/directories]

< No bang: enters files/directories into Netrw's bookmark system

   No argument and in netrw buffer:
     if there are marked files        : bookmark marked files
     otherwise                        : bookmark file/directory under cursor
   No argument and not in netrw buffer: bookmarks current open file
   Has arguments                      : |glob()|s each arg and bookmarks them

 With bang: deletes files/directories from Netrw's bookmark system

The :NetrwMB command is available outside of netrw buffers (once netrw has been
invoked in the session).

The file ".netrwbook" holds bookmarks when netrw (and vim) is not active.  By
default, its stored on the first directory on the user's |'runtimepath'|.

Related Topics:
	|netrw-gb| how to return (go) to a bookmark
	|netrw-mB| how to delete bookmarks
	|netrw-qb| how to list bookmarks
	|g:netrw_home| controls where .netrwbook is kept


BROWSING					*netrw-enter*	*netrw-cr* {{{2

Browsing is simple: move the cursor onto a file or directory of interest.
Hitting the <cr> (the return key) will select the file or directory.
Directories will themselves be listed, and files will be opened using the
protocol given in the original read request.

  CAVEAT: There are four forms of listing (see |netrw-i|).  Netrw assumes that
  two or more spaces delimit filenames and directory names for the long and
  wide listing formats.  Thus, if your filename or directory name has two or
  more sequential spaces embedded in it, or any trailing spaces, then you'll
  need to use the "thin" format to select it.

The |g:netrw_browse_split| option, which is zero by default, may be used to
cause the opening of files to be done in a new window or tab instead of the
default.  When the option is one or two, the splitting will be taken
horizontally or vertically, respectively.  When the option is set to three, a
<cr> will cause the file to appear in a new tab.


When using the gui (gvim), one may select a file by pressing the <leftmouse>
button.  In addition, if

 * |g:netrw_retmap| == 1       AND   (its default value is 0)
 * in a netrw-selected file, AND
 * the user doesn't already have a <2-leftmouse> mapping defined before
   netrw is loaded

then a doubly-clicked leftmouse button will return to the netrw browser
window.

Netrw attempts to speed up browsing, especially for remote browsing where one
may have to enter passwords, by keeping and re-using previously obtained
directory listing buffers.  The |g:netrw_fastbrowse| variable is used to
control this behavior; one may have slow browsing (no buffer re-use), medium
speed browsing (re-use directory buffer listings only for remote directories),
and fast browsing (re-use directory buffer listings as often as possible).
The price for such re-use is that when changes are made (such as new files
are introduced into a directory), the listing may become out-of-date.  One may
always refresh directory listing buffers by pressing ctrl-L (see
|netrw-ctrl-l|).

								*netrw-s-cr*
Squeezing the Current Tree-Listing Directory~

When the tree listing style is enabled (see |netrw-i|) and one is using
gvim, then the <s-cr> mapping may be used to squeeze (close) the
directory currently containing the cursor.

Otherwise, one may remap a key combination of one's own choice to get
this effect: >

    nmap <buffer> <silent> <nowait> YOURKEYCOMBO  <Plug>NetrwTreeSqueeze
<
Put this line in $HOME/ftplugin/netrw/netrw.vim; it needs to be generated
for netrw buffers only.

Related topics:
	|netrw-ctrl-r|	|netrw-o|	|netrw-p|
	|netrw-P|	|netrw-t|	|netrw-v|
Associated setting variables:
   |g:netrw_browse_split|	|g:netrw_fastbrowse|
   |g:netrw_ftp_list_cmd|	|g:netrw_ftp_sizelist_cmd|

Title: Bookmarking Details and Browsing in Netrw
Summary
This section elaborates on bookmarking in Netrw, explaining the usage of the `:NetrwMB` command with and without a bang (!) to add or remove bookmarks. It details how browsing works in Netrw, including selecting files and directories with the return key, and the impact of filename formatting on selection. It also explains how to open files in new windows or tabs using the `g:netrw_browse_split` option and the functionality of double-clicking in gvim. Finally, it covers how Netrw speeds up browsing by reusing directory listing buffers, and how to refresh those buffers. It also discusses squeezing the current tree-listing directory, including how to configure a custom key mapping for this action.