Home Explore Blog CI



neovim

44th chunk of `runtime/pack/dist/opt/netrw/doc/netrw.txt`
45f7e252eaf12fc588f177d8d9a29b487c4e0b55e67b6eff0000000100000fa2
 : >

	mr  [query: reply with *.c]
	R   [query: reply with s/^\(.*\)\.c$/\1.cpp/]
<
    This example will mark all "*.c" files and then rename them to "*.cpp"
    files.  Netrw will protect you from overwriting local files without
    confirmation, but not remote ones.

    The ctrl-X character has special meaning for renaming files: >

	<c-x>      : a single ctrl-x tells netrw to ignore the portion of the response
	             lying between the last '/' and the ctrl-x.

	<c-x><c-x> : a pair of contiguous ctrl-x's tells netrw to ignore any
		     portion of the string preceding the double ctrl-x's.
<
    WARNING: ~

    Note that moving files is a dangerous operation; copies are safer.  That's
    because a "move" for remote files is actually a copy + delete -- and if
    the copy fails and the delete succeeds you may lose the file.
    Use at your own risk.

The *g:netrw_rename_cmd* variable is used to implement remote renaming.  By
default its value is: >

	ssh HOSTNAME mv
<
One may rename a block of files and directories by selecting them with
V (|linewise-visual|) when using thin style.

See |cmdline-editing| for more on how to edit the command line; in particular,
you'll find <ctrl-f> (initiates cmdline window editing) and <ctrl-c> (uses the
command line under the cursor) useful in conjunction with the R command.


SELECTING SORTING STYLE			*netrw-s* *netrw-sort* {{{2

One may select the sorting style by name, time, or (file) size.  The "s" map
allows one to circulate amongst the three choices; the directory listing will
automatically be refreshed to reflect the selected style.

Related topics:               |netrw-r| |netrw-S|
Associated setting variables: |g:netrw_sort_by| |g:netrw_sort_sequence|


SETTING EDITING WINDOW		*netrw-editwindow* *netrw-C* *netrw-:NetrwC* {{{2

One may select a netrw window for editing with the "C" mapping, using the
:NetrwC [win#] command, or by setting |g:netrw_chgwin| to the selected window
number.  Subsequent selection of a file to edit (|netrw-cr|) will use that
window.

	* C : by itself, will select the current window holding a netrw buffer
	  for subsequent editing via |netrw-cr|.  The C mapping is only available
	  while in netrw buffers.

	* [count]C : the count will be used as the window number to be used
	  for subsequent editing via |netrw-cr|.

	* :NetrwC will set |g:netrw_chgwin| to the current window

	* :NetrwC win#  will set |g:netrw_chgwin| to the specified window
	  number

Using >
	let g:netrw_chgwin= -1
will restore the default editing behavior
(ie. subsequent editing will use the current window).

Related topics:			|netrw-cr| |g:netrw_browse_split|
Associated setting variables:	|g:netrw_chgwin|


SHRINKING OR EXPANDING A NETRW OR LEXPLORE WINDOW	*netrw-c-tab* {{{2

The <c-tab> key will toggle a netrw or |:Lexplore| window's width,
but only if |g:netrw_usetab| exists and is non-zero (and, of course,
only if your terminal supports differentiating <c-tab> from a plain
<tab>).

  * If the current window is a netrw window, toggle its width
    (between |g:netrw_wiw| and its original width)

  * Else if there is a |:Lexplore| window in the current tab, toggle
    its width

  * Else bring up a |:Lexplore| window

If |g:netrw_usetab| exists and is zero, or if there is a pre-existing mapping
for <c-tab>, then the <c-tab> will not be mapped.  One may map something other
than a <c-tab>, too: (but you'll still need to have had |g:netrw_usetab| set). >

	nmap <unique> (whatever)	<Plug>NetrwShrink
<
Related topics:			|:Lexplore|
Associated setting variable:	|g:netrw_usetab|


USER SPECIFIED MAPS					*netrw-usermaps* {{{1

One may make customized user maps.  Specify a variable, |g:Netrw_UserMaps|,
to hold a |List| of lists of keymap strings and function names: >

	[["keymap-sequence","ExampleUserMapFunc"],...]
<
When netrw is setting up maps for a netrw buffer, if |g:Netrw_UserMaps|
exists, then the internal function netrw#UserMaps(islocal) is called.
This function goes through all the

Title: Netrw: Renaming, Sorting, Editing Windows, Shrinking Windows, and User Maps
Summary
This section of the netrw documentation provides information on advanced file renaming techniques using regular expressions and the ctrl-X character. It also covers how to select sorting styles, set the editing window for subsequent file selection, shrink or expand netrw or Lexplore windows using <c-tab> and customize user mappings for netrw buffers. It includes details on the g:netrw_rename_cmd variable and provides examples of batch renaming and user map configuration.