Home Explore Blog CI



neovim

12th chunk of `runtime/pack/dist/opt/netrw/doc/netrw.txt`
ca0dd0e2325771da1fc0e2fd420ebceb83cd50e2ee949f140000000100000fa2

==============================================================================
6. Transparent Remote File Editing		*netrw-transparent* {{{1

Transparent file transfers occur whenever a regular file read or write
(invoked via an |:autocmd| for |BufReadCmd|, |BufWriteCmd|, or |SourceCmd|
events) is made.  Thus one may read, write, or source  files across networks
just as easily as if they were local files! >

	vim ftp://[user@]machine/path
	...
	:wq

See |netrw-activate| for more on how to encourage your vim to use plugins
such as netrw.

For password-free use of scp:, see |netrw-ssh-hack|.


==============================================================================
7. Ex Commands						*netrw-ex* {{{1

The usual read/write commands are supported.  There are also a few
additional commands available.  Often you won't need to use Nwrite or
Nread as shown in |netrw-transparent| (ie. simply use >
  :e URL
  :r URL
  :w URL
instead, as appropriate) -- see |netrw-urls|.  In the explanations
below, a {netfile} is a URL to a remote file.

						*:Nwrite*  *:Nw*
:[range]Nw[rite]	Write the specified lines to the current
		file as specified in b:netrw_lastfile.
		(related: |netrw-nwrite|)

:[range]Nw[rite] {netfile} [{netfile}]...
		Write the specified lines to the {netfile}.

						*:Nread*   *:Nr*
:Nr[ead]	Read the lines from the file specified in b:netrw_lastfile
		into the current buffer.  (related: |netrw-nread|)

:Nr[ead] {netfile} {netfile}...
		Read the {netfile} after the current line.

						*:Nsource* *:Ns*
:Ns[ource] {netfile}
		Source the {netfile}.
		To start up vim using a remote .vimrc, one may use
		the following (all on one line) (tnx to Antoine Mechelynck) >
		vim -u NORC -N
		 --cmd "runtime plugin/netrwPlugin.vim"
		 --cmd "source scp://HOSTNAME/.vimrc"
<		 (related: |netrw-source|)

:call NetUserPass()				*NetUserPass()*
		If g:netrw_uid and s:netrw_passwd don't exist,
		this function will query the user for them.
		(related: |netrw-userpass|)

:call NetUserPass("userid")
		This call will set the g:netrw_uid and, if
		the password doesn't exist, will query the user for it.
		(related: |netrw-userpass|)

:call NetUserPass("userid","passwd")
		This call will set both the g:netrw_uid and s:netrw_passwd.
		The user-id and password are used by ftp transfers.  One may
		effectively remove the user-id and password by using empty
		strings (ie. "").
		(related: |netrw-userpass|)

:NetrwSettings  This command is described in |netrw-settings| -- used to
		display netrw settings and change netrw behavior.


==============================================================================
8. Variables and Options		*netrw-var* *netrw-settings* {{{1

(also see: |netrw-options| |netrw-variables| |netrw-protocol|
           |netrw-browser-settings| |netrw-browser-options| )

The <netrw.vim> script provides several variables which act as options to
affect <netrw.vim>'s file transfer behavior.  These variables typically may be
set in the user's <.vimrc> file: (see also |netrw-settings| |netrw-protocol|)
						*netrw-options*
>
                        -------------
                        Netrw Options
                        -------------
	Option			Meaning
	--------------		-----------------------------------------------
<
        b:netrw_col             Holds current cursor position (during NetWrite)
        g:netrw_cygwin          =1 assume scp under windows is from cygwin
                                                              (default/windows)
                                =0 assume scp under windows accepts windows
                                   style paths                (default/else)
        g:netrw_ftp             =0 use default ftp            (uid password)
        g:netrw_ftpmode         ="binary"                     (default)
                                ="ascii"                      (your choice)
	g:netrw_ignorenetrc     =1                            (default)
	                           if you have a <.netrc>

Title: Netrw: Transparent Remote File Editing, Ex Commands, and Configuration Variables
Summary
This section explains how netrw enables transparent remote file editing using autocmds for BufReadCmd, BufWriteCmd, and SourceCmd events. It details several Ex commands such as :Nwrite, :Nread, :Nsource, and :call NetUserPass(), along with their respective functionalities. It also covers various variables and options that can be set in the user's .vimrc file to customize netrw's file transfer behavior, including settings for Cygwin, FTP mode, and .netrc usage. The section also links to other relevant settings such as browser settings and variables.