blob: 5e28ed62c9b763e8e91c18128a06079125c1b05f [file] [log] [blame]
Bram Moolenaar843ee412004-06-30 16:16:41 +00001*pi_netrw.txt For Vim version 6.2. Last change: Jun 25, 2004
Bram Moolenaar071d4272004-06-13 20:20:40 +00002
3
4 VIM REFERENCE MANUAL by Charles E. Campbell, Jr.
5
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00006*dav* *http* *network* *rcp* *scp*
7*fetch* *netrw* *Nread* *rsync* *sftp*
8*ftp* *netrw.vim* *Nwrite* *netrw-file*
Bram Moolenaar071d4272004-06-13 20:20:40 +00009
10==============================================================================
110. Contents *netrw-contents*
12
131. Netrw Reference.....................................|netrw-ref|
142. Network-Oriented File Transfer......................|netrw-xfer|
153. Activation..........................................|netrw-activate|
164. Transparent File Transfer...........................|netrw-transparent|
175. Ex Commands.........................................|netrw-ex|
186. Variables and Options...............................|netrw-var|
Bram Moolenaar843ee412004-06-30 16:16:41 +0000197. Remote Directory Browser............................|netrw-browse|
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +000020 ?..........Help....................................|netrw-help|
21 <cr>.......Browsing................................|netrw-cr|
22 <c-l>......Refreshing the Listing..................|netrw-c-l|
23 <del>......Removing Files or Directories...........|netrw-delete|
24 D..........Removing Files or Directories...........|netrw-D|
25 R..........Renaming Files or Directories...........|netrw-R|
26 -..........Going Up................................|netrw--|
27 a..........Hiding Files or Directories.............|netrw-a|
28 h..........Edit File/Directory Hiding..............|netrw-h|
29 o..........Browsing with a Horizontal Split........|netrw-o|
30 r..........Reversing Sorting Order.................|netrw-r|
31 s..........Selecting Sorting Style.................|netrw-s|
32 v..........Browsing with a Vertical Split..........|netrw-v|
33 x..........Customizing Browsing....................|netrw-x|
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000348. Debugging...........................................|netrw-debug|
359. History.............................................|netrw-history|
3610. Credits.............................................|netrw-credits|
Bram Moolenaar071d4272004-06-13 20:20:40 +000037
38The functionality mentioned here is done via using |standard-plugin|
39techniques. This plugin is only available if
40
Bram Moolenaar69a7cb42004-06-20 12:51:53 +000041 set nocp " 'compatible' is not set
42 filetype plugin on " plugins are enabled
Bram Moolenaar071d4272004-06-13 20:20:40 +000043
44You can avoid loading this plugin by setting the "loaded_netrw" variable
45in your <.vimrc> file: >
46
47 :let loaded_netrw = 1
48
49{Vi does not have any of this}
50
51==============================================================================
521. Netrw Reference *netrw-ref*
53
54 OPTIONS
55 let g:netrw_ftp =0 use ftp (default) (uid password)
56 =1 use alternate ftp method (user uid password)
57 If you're having trouble with ftp, try changing the value
58 of this variable in your <.vimrc> to change methods
59
60 let g:netrw_ignorenetrc= 1
61 If you have a <.netrc> file but it doesn't work and you
62 want it ignored, then set this variable as shown. Its mere
63 existence is enough to cause <.netrc> to be ignored.
64
65 Controlling External Applications
66
Bram Moolenaar69a7cb42004-06-20 12:51:53 +000067 Protocol Variable Default Value
68 -------- ---------------- -------------
69 dav: g:netrw_dav_cmd = "cadaver"
70 fetch: g:netrw_fetch_cmd = "fetch -o"
71 ftp: g:netrw_ftp_cmd = "ftp"
72 http: g:netrw_http_cmd = "fetch -o" if fetch is available
73 http: g:netrw_http_cmd = "wget -q -O" If wget is available
74 rcp: g:netrw_rcp_cmd = "rcp"
75 rsync: g:netrw_rsync_cmd = "rsync -a"
76 scp: g:netrw_scp_cmd = "scp -q"
Bram Moolenaar071d4272004-06-13 20:20:40 +000077 sftp: g:netrw_sftp_cmd = "sftp"
78
79 READING
80 :Nread ? give help
81 :Nread "machine:file" uses rcp
82 :Nread "machine file" uses ftp with <.netrc>
83 :Nread "machine id password file" uses ftp
84 :Nread "dav://machine[:port]/file" uses cadaver
85 :Nread "fetch://[user@]machine/file" uses fetch
86 :Nread "ftp://[user@]machine[[:#]port]/file" uses ftp autodetects <.netrc>
87 :Nread "http://[user@]machine/file" uses http uses wget
88 :Nread "rcp://[user@]machine/file" uses rcp
89 :Nread "rsync://[user@]machine[:port]/file" uses rsync
90 :Nread "scp://[user@]machine[[:#]port]/file" uses scp
91 :Nread "sftp://[user@]machine/file" uses sftp
92
93 WRITING
Bram Moolenaar69a7cb42004-06-20 12:51:53 +000094 :Nwrite ? give help
Bram Moolenaar071d4272004-06-13 20:20:40 +000095 :Nwrite "machine:file" uses rcp
96 :Nwrite "machine file" uses ftp with <.netrc>
97 :Nwrite "machine id password file" uses ftp
98 :Nwrite "dav://machine[:port]/file" uses cadaver
99 :Nwrite "ftp://[user@]machine[[:#]port]/file" uses ftp autodetects <.netrc>
100 :Nwrite "rcp://[user@]machine/file" uses rcp
101 :Nwrite "rsync://[user@]machine[:port]/file" uses rsync
102 :Nwrite "scp://[user@]machine[[:#]port]/file" uses scp
103 :Nwrite "sftp://[user@]machine/file" uses sftp
104 http: not supported!
105
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000106 DIRECTORY LISTING
107 :Nread [protocol]://[user]@hostname/path/
108
Bram Moolenaar071d4272004-06-13 20:20:40 +0000109 USER AND PASSWORD CHANGING
110 Attempts to use ftp will prompt you for a user-id and a password.
111 These will be saved in g:netrw_uid and g:netrw_passwd Subsequent uses
112 of ftp will re-use those. If you need to use a different user id
113 and/or password, you'll want to call NetUserPass() first.
114
115 :NetUserPass [uid [password]] -- prompts as needed
116 :call NetUserPass() -- prompts for uid and password
117 :call NetUserPass("uid") -- prompts for password
118 :call NetUserPass("uid","password") -- sets global uid and password
119
120 VARIABLES
121 b:netrw_lastfile last file Network-read/written retained on
122 a per-buffer basis (supports plain :Nw )
123 s:netrw_line during Nw/NetWrite, holds current line number
124 s:netrw_col during Nw/NetWrite, holds current column number
125 s:netrw_line and s:netrw_col are used to
126 restore the cursor position on writes
127 g:netrw_ftp if it doesn't exist, use default ftp
128 =0 use default ftp (uid password)
129 =1 use alternate ftp method (user uid password)
130 g:netrw_ftpmode ="binary" (default)
131 ="ascii" (or your choice)
132 g:netrw_uid (ftp) user-id, retained on a per-session basis
133 g:netrw_passwd (ftp) password, retained on a per-session basis
134 g:netrw_win95ftp =0 use unix-style ftp even if win95/win98/winME
135 =1 use default method to do ftp
136 g:netrw_cygwin =1 assume scp under windows is from cygwin
137 (default if windows)
138 =0 assume scp under windows accepts
139 windows-style paths (default otherwise)
140 g:netrw_use_nt_rcp=0 don't use the rcp of WinNT, Win2000 and WinXP (default)
141 =1 use the rcp of WinNT,... in binary mode
142
143
144==============================================================================
1452. Network-Oriented File Transfer *netrw-xfer*
146
147Network-oriented file transfer under Vim is implemented by a VimL-based script
148(<netrw.vim>) using plugin techniques. It currently supports both reading
149and writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch,
150dav/cadaver, rsync, or sftp.
151
152http is currently supported read-only via use of wget or fetch.
153
154<netrw.vim> is a standard plugin which acts as glue between Vim and the
155various file transfer programs. It uses autocommand events (BufReadCmd,
156FileReadCmd, BufWriteCmd) to intercept reads/writes with url-like filenames. >
157
158 ex. vim ftp://hostname/path/to/file
159<
160The characters preceding the colon specify the protocol to use;
161in the example, its ftp. The <netrw.vim> script then formulates
162a command or a series of commands (typically ftp) which it issues
163to an external program (ftp, scp, etc) which does the actual file
164transfer/protocol. Files are read from/written to a temporary file
165(under Unix/Linux, /tmp/...) which the <netrw.vim> script will
166clean up.
167
168One may modify any protocol's implementing external application
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000169by settinbg a variable (ex. scp uses the variable g:netrw_scp_cmd,
Bram Moolenaar071d4272004-06-13 20:20:40 +0000170which is defaulted to "scp -q").
171
172Ftp, an old protocol, seems to be blessed by numerous implementations.
173Unfortunately, some implementations are noisy (ie., add junk to the end
174of the file). Thus, concerned users may decide to write a NetReadFixup()
175function that will clean up after reading with their ftp. Some Unix systems
176(ie., FreeBSD) provide a utility called "fetch" which uses the ftp protocol
177but is not noisy and more convenient, actually, for <netrw.vim> to use.
178Consequently, if "fetch" is executable, it will be used to do reads for
179ftp://... (and http://...) . See |netrw-var| for more about this.
180
181For rcp, scp, sftp, and http, one may use network-oriented file transfers
182transparently; ie.
183>
184 vim rcp://[user@]machine/path
185 vim scp://[user@]machine/path
186<
187If your ftp supports <.netrc>, then it too can be just as transparently used
188if the needed triad of machine name, user id, and password are present in
189that file. Your ftp must be able to use the <.netrc> file on its own, however.
190>
191 vim ftp://[user@]machine[[:#]portnumber]/path
192<
193However, ftp will often need to query the user for the userid and password.
194The latter will be done "silently"; ie. asterisks will show up instead of
195the actually-typed-in password. Netrw will retain the userid and password
196for subsequent read/writes from the most recent transfer so subsequent
197transfers (read/write) to or from that machine will take place without
198additional prompting.
199
200 *netrw-urls*
201 +=================================+============================+============+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000202 | Reading | Writing | Uses |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000203 +=================================+============================+============+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000204 | DAV: | | |
205 | dav://host/path | | cadaver |
206 | :Nread dav://host/path | :Nwrite dav://host/path | cadaver |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000207 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000208 | FETCH: | | |
209 | fetch://[user@]host/path | | |
210 | fetch://[user@]host:http/path | Not Available | fetch |
211 | :Nread fetch://[user@]host/path| | |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000212 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000213 | FILE: | | |
214 | file:///* | file:///* | |
215 | file://localhost/* | file://localhost/* | |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000216 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000217 | FTP: (*3) | (*3) | |
218 | ftp://[user@]host/path | ftp://[user@]host/path | ftp (*2) |
219 | :Nread ftp://host/path | :Nwrite ftp://host/path | ftp+.netrc |
220 | :Nread host path | :Nwrite host path | ftp+.netrc |
221 | :Nread host uid pass path | :Nwrite host uid pass path | ftp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000222 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000223 | HTTP: wget is executable: (*4) | | |
224 | http://[user@]host/path | Not Available | wget |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000225 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000226 | HTTP: fetch is executable (*4) | | |
227 | http://[user@]host/path | Not Available | fetch |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000228 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000229 | RCP: | | |
230 | rcp://[user@]host/path | rcp://[user@]host/path | rcp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000231 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000232 | RSYNC: | | |
233 | rsync://[user@]host/path | rsync://[user@]host/path | rsync |
234 | :Nread rsync://host/path | :Nwrite rsync://host/path | rsync |
235 | :Nread rcp://host/path | :Nwrite rcp://host/path | rcp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000236 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000237 | SCP: | | |
238 | scp://[user@]host/path | scp://[user@]host/path | scp |
239 | :Nread scp://host/path | :Nwrite scp://host/path | scp (*1) |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000240 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000241 | SFTP: | | |
242 | sftp://[user@]host/path | sftp://[user@]host/path | sftp |
243 | :Nread sftp://host/path | :Nwrite sftp://host/path | sftp (*1) |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000244 +=================================+============================+============+
245
246 (*1) For an absolute path use scp://machine//path.
247
248 (*2) if <.netrc> is present, it is assumed that it will
249 work with your ftp client. Otherwise the script will
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000250 prompt for user-id and pasword.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000251
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000252 (*3) for ftp, "machine" may be machine#port or machine:port
Bram Moolenaar071d4272004-06-13 20:20:40 +0000253 if a different port is needed than the standard ftp port
254
255 (*4) for http:..., if wget is available it will be used. Otherwise,
256 if fetch is available it will be used.
257
258Both the :Nread and the :Nwrite ex-commands can accept multiple filenames.
259
260
261NETRC *netrw-netrc*
262
263The typical syntax for lines in a <.netrc> file is given as shown below.
264Ftp under Unix usually support <.netrc>; Windows' ftp usually doesn't.
265>
266 machine {full machine name} login {user-id} password "{password}"
267 default login {user-id} password "{password}"
268
269Your ftp client must handle the use of <.netrc> on its own, but if the
270<.netrc> file exists, an ftp transfer will not ask for the user-id or
271password.
272
273 Note:
274 Since this file contains passwords, make very sure nobody else can
275 read this file! Most programs will refuse to use a .netrc that is
276 readable for others. Don't forget that the system administrator can
277 still read the file!
278
279
280PASSWORD *netrw-passwd*
281
282The script attempts to get passwords for ftp invisibly using |inputsecret()|,
283a built-in Vim function. See |netrw-uidpass| for how to change the password
284after one has set it.
285
286Unfortunately there doesn't appear to be a way for netrw to feed a password
287to scp. Thus every transfer via scp will require re-entry of the password.
288
289
290==============================================================================
2913. Activation *netrw-activate*
292
293Network-oriented file transfers are available by default whenever
294|'nocompatible'| mode is enabled. The <netrw.vim> file resides in your
295system's vim-plugin directory and is sourced automatically whenever you
296bring up vim.
297
298
299==============================================================================
3004. Transparent File Transfer *netrw-transparent*
301
302Transparent file transfers occur whenever a regular file read or write
303(invoked via an |:autocmd| for |BufReadCmd| or |BufWriteCmd| events) is made.
304Thus one may use files across networks as if they were local. >
305
306 vim ftp://[user@]machine/path
307 ...
308 :wq
309
310
311==============================================================================
3125. Ex Commands *netrw-ex*
313
314The usual read/write commands are supported. There are also a couple of
315additional commands available.
316
317:[range]Nw Write the specified lines to the current
318 file as specified in b:netrw_lastfile.
319
320:[range]Nw {netfile} [{netfile}]...
321 Write the specified lines to the {netfile}.
322
323:Nread
324 Read the specified lines into the current
325 buffer from the file specified in
326 b:netrw_lastfile.
327
328:Nread {netfile} {netfile}...
329 Read the {netfile} after the current line.
330
331 *netrw-uidpass*
332:call NetUserPass()
333 If b:netrw_uid and b:netrw_passwd don't exist,
334 this function query the user for them.
335
336:call NetUserPass("userid")
337 This call will set the b:netrw_uid and, if
338 the password doesn't exist, will query the user for it.
339
340:call NetUserPass("userid","passwd")
341 This call will set both the b:netrw_uid and b:netrw_passwd.
342 The user-id and password are used by ftp transfers. One may
343 effectively remove the user-id and password by using ""
344 strings.
345
346
347==============================================================================
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00003486. Variables and Options *netrw-options* *netrw-var*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000349
350The script <netrw.vim> uses several variables which can affect <netrw.vim>'s
351behavior. These variables typically may be set in the user's <.vimrc> file:
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000352>
353 -------------
354 Netrw Options
355 -------------
356 Option Meaning
357 -------------- -----------------------------------------------
358<
359 b:netrw_col Holds current cursor position (during NetWrite)
360 g:netrw_cygwin =1 assume scp under windows is from cygwin
361 (default/windows)
362 =0 assume scp under windows accepts windows
363 style paths (default/else)
364 g:netrw_ftp =0 use default ftp (uid password)
365 g:netrw_ftpmode ="binary" (default)
366 ="ascii" (your choice)
367 g:netrw_ignorenetrc =1 (default)
368 if you have a <.netrc> file but you don't
Bram Moolenaar071d4272004-06-13 20:20:40 +0000369 want it used, then set this variable. Its
370 mere existence is enough to cause <.netrc>
371 to be ignored.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000372 b:netrw_lastfile Holds latest method/machine/path.
373 b:netrw_line Holds current line number (during NetWrite)
374 g:netrw_passwd Holds current password for ftp.
375 g:netrw_silent =0 transfers done normally
376 =1 transfers done silently
377 g:netrw_uid Holds current user-id for ftp.
378 =1 use alternate ftp (user uid password)
379 (see |netrw-options|)
380 g:netrw_use_nt_rcp =0 don't use WinNT/2K/XP's rcp (default)
381 =1 use WinNT/2K/XP's rcp, binary mode
382 g:netrw_win95ftp =0 use unix-style ftp even if win95/98/ME/etc
383 =1 use default method to do ftp >
384 -----------------------------------------------------------------------
385<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000386The script will also make use of the following variables internally, albeit
387temporarily.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000388>
389 -------------------
390 Temporary Variables
391 -------------------
392 Variable Meaning
393 -------- ------------------------------------
394<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000395 g:netrw_method Index indicating rcp/ftp+.netrc/ftp
396 g:netrw_machine Holds machine name parsed from input
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000397 g:netrw_fname Holds filename being accessed >
398 ------------------------------------------------------------
399<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000400 *netrw-protocol*
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000401
402Netrw supports a number of protocols. These protocols are invoked using the
403variables listed below, and may be modified by the user.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000404>
405 ------------------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000406 Protocol Control Options
Bram Moolenaar071d4272004-06-13 20:20:40 +0000407 ------------------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000408 Option Type Setting Meaning
409 --------- -------- -------------- ---------------------------
410<
411 netrw_ftp variable =doesn't exist userid set by "user userid"
412 =0 userid set by "user userid"
413 =1 userid set by "userid"
414 NetReadFixup function =doesn't exist no change
415 =exists Allows user to have files
416 read via ftp automatically
417 transformed however they wish
418 by NetReadFixup()
Bram Moolenaar071d4272004-06-13 20:20:40 +0000419 g:netrw_dav_cmd variable ="cadaver"
420 g:netrw_fetch_cmd variable ="fetch -o"
421 g:netrw_ftp_cmd variable ="ftp"
422 g:netrw_http_cmd variable ="fetch -o" else if fetch is executable
423 g:netrw_http_cmd variable ="wget -O" if wget is executable
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000424 g:netrw_list_cmd variable ="ssh HOSTNAME ls -Fa"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000425 g:netrw_rcp_cmd variable ="rcp"
426 g:netrw_rsync_cmd variable ="rsync -a"
427 g:netrw_scp_cmd variable ="scp -q"
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000428 g:netrw_sftp_cmd variable ="sftp" >
429 -------------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000430<
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000431 *netrw-ftp*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000432The first two options both help with certain ftp's that give trouble otherwise.
433In order to best understand how to use these options if ftp is giving you
434troubles, a bit of discussion follows on how netrw does ftp reads.
435
436The g:netrw_..._cmd variables specify the external program to use handle
437the associated protocol (rcp, ftp, etc), plus any options.
438
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000439The g:netrw_list_cmd's HOSTNAME entry will be changed via substitution with
440whatever the current request is for a hostname.
441
442For ftp, netrw typically builds up lines of one of the following formats in a
Bram Moolenaar071d4272004-06-13 20:20:40 +0000443temporary file:
444>
445 IF g:netrw_ftp !exists or is not 1 IF g:netrw_ftp exists and is 1
446 ---------------------------------- ------------------------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000447<
448 open machine [port] open machine [port]
449 user userid password userid password
450 [g:netrw_ftpmode] password
451 get filename tempfile [g:netrw_ftpmode]
452 get filename tempfile >
453 ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000454<
455Netrw then executes the lines above by use of a filter:
456>
457 :%! {g:netrw_ftp_cmd} -i [-n]
458<
459
460where
461 g:netrw_ftp_cmd is usually "ftp",
462 -i tells ftp not to be interactive
463 -n means don't use netrc and is used for Method #3 (ftp w/o <.netrc>)
464
465If <.netrc> exists it will be used to avoid having to query the user for
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000466userid and password. The transferred file is put into a temporary file.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000467The temporary file is then read into the main editing session window that
468requested it and the temporary file deleted.
469
470If your ftp doesn't accept the "user" command and immediately just demands
471a userid, then try putting "let netrw_ftp=1" in your <.vimrc>.
472
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000473 *netrw-cadaver*
474To handle the SSL certificate dialog for untrusted servers, one may pull
475down the certificate and place it into /usr/ssl/cert.pem. This operation
476renders the server treatment as "trusted".
477
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000478 *netrw-fixup*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000479If your ftp for whatever reason generates unwanted lines (such as AUTH
480messages) you may write a NetReadFixup(tmpfile) function:
481>
482 function! NetReadFixup(method,line1,line2)
483 " a:line1: first new line in current file
484 " a:line2: last new line in current file
485 if a:method == 1 "rcp
486 elseif a:method == 2 "ftp + <.netrc>
487 elseif a:method == 3 "ftp + machine,uid,password,filename
488 elseif a:method == 4 "scp
489 elseif a:method == 5 "http/wget
490 elseif a:method == 6 "dav/cadaver
491 elseif a:method == 7 "rsync
492 elseif a:method == 8 "fetch
493 elseif a:method == 9 "sftp
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000494 else " complain
Bram Moolenaar071d4272004-06-13 20:20:40 +0000495 endif
496 endfunction
497>
498The NetReadFixup() function will be called if it exists and thus allows
499you to customize your reading process. As a further example, <netrw.vim>
500contains just such a function to handle Windows 95 ftp. For whatever
501reason, Windows 95's ftp dumps four blank lines at the end of a transfer,
502and so it is desirable to automate their removal. Here's some code taken
503from <netrw.vim> itself:
504>
505 if has("win95") && g:netrw_win95ftp
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000506 fun! NetReadFixup(method, line1, line2)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000507 if method == 3 " ftp (no <.netrc>)
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000508 let fourblanklines= line2 - 3
509 silent fourblanklines.",".line2."g/^\s*/d"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000510 endif
511 endfunction
512 endif
513>
514
515==============================================================================
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00005167. Remote Directory Browser *netrw-browse* *netrw-dir* *netrw-list* *netrw-help*
Bram Moolenaar843ee412004-06-30 16:16:41 +0000517>
Bram Moolenaar843ee412004-06-30 16:16:41 +0000518 Command Explanation
519 ------- -----------
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000520 ? Causes Netrw to issue help
Bram Moolenaar843ee412004-06-30 16:16:41 +0000521 <cr> Netrw will enter the directory or read the file
522 <del> Netrw will attempt to remove the file/directory
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000523 <c-l> Causes Netrw to refresh the directory listing
Bram Moolenaar843ee412004-06-30 16:16:41 +0000524 D Netrw will attempt to remove the file(s)/directory(ies)
525 R Netrw will attempt to rename the file(s)/directory(ies)
526 - Makes Netrw go up one directory
527 a Show all of a directory (temporarily ignore g:netrw_list_hide)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000528 h Edit file hiding list
Bram Moolenaar843ee412004-06-30 16:16:41 +0000529 o Enter the file/directory under the cursor in a new browser
530 window. A horizontal split is used.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000531 r Reverse sorting order
532 s Select sorting style: by name, time, or file size
Bram Moolenaar843ee412004-06-30 16:16:41 +0000533 v Enter the file/directory under the cursor in a new browser
534 window. A vertical split is used.
535 x Apply a function to a file.
Bram Moolenaar843ee412004-06-30 16:16:41 +0000536<
537 *netrw-browse-var*
538>
539 --- -----------
540 Var Explanation
541 --- -----------
542 g:netrw_list_cmd supports listing
543 g:netrw_rm_cmd supports removing files
544 g:netrw_rmf_cmd supports removing softlinks to directories
545 g:netrw_rmdir_cmd supports removing directories
546 g:netrw_winsize specify initial size of new o/v windows
547 g:netrw_list_hide comma separated list of patterns for
548 hiding files
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000549 g:netrw_sort_by sort by "name", "time", or "size"
550 g:netrw_sort_direction sorting direction: "normal" or "reverse"
551 g:netrw_sort_sequence when sorting by name, first sort by the
552 comma-separated pattern sequence
Bram Moolenaar843ee412004-06-30 16:16:41 +0000553<
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000554INTRODUCTION TO REMOTE DIRECTORY BROWSING
555
Bram Moolenaar843ee412004-06-30 16:16:41 +0000556Netrw supports the browsing of directories on remote hosts, including
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000557generating listing directories, entering directories, editing files therein,
558deleting files/directories, and moving (renaming) files and directories. The
559Netrw browser generally implements the file explorer methods but for remote
560directories, although details (such as pertinent global variable names)
561necessarily differ.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000562
Bram Moolenaar843ee412004-06-30 16:16:41 +0000563To enter the netrw directory browser, simply attempt to read a "file" with a
564trailing slash and it will be interpreted as a request to list a directory:
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000565
566 vim [protocol]://[user@]hostname/path/
567
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000568
569REFRESHING THE LISTING *netrw-c-l*
570
571To refresh the directory listing, press ctrl-l (<c-l>) or hit the <cr>
572when atop the ./ directory entry in the listing.
573
574
575GOING UP *netrw--*
576
577To go up a directory, press - or his the <cr> when atop the ../ directory
578entry in the listing.
579
580Netrw will modify the command in *g:netrw_list_cmd* to perform the directory
Bram Moolenaar843ee412004-06-30 16:16:41 +0000581listing operation. By default the command is:
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000582
Bram Moolenaar843ee412004-06-30 16:16:41 +0000583 ssh HOSTNAME ls -FLa
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000584
Bram Moolenaar843ee412004-06-30 16:16:41 +0000585where the HOSTNAME becomes the [user@]hostname as requested by the attempt
586to read. Naturally, the user may override this command with whatever is
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000587preferred. The NetList function which implements remote directory
588browsing expects that directories will be flagged by a trailing slash.
589
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000590
591BROWSING *netrw-cr*
592
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000593Browsing is simple: move the cursor onto a file or directory of interest.
Bram Moolenaar843ee412004-06-30 16:16:41 +0000594Hitting the <cr> (the return key) will select the file or directory.
595Directories will themselves be listed, and files will be opened using the
596protocol given in the original read request.
597
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000598
599REMOVING FILES OR DIRECTORIES *netrw-delete* *netrw-remove* *netrw-D*
Bram Moolenaar843ee412004-06-30 16:16:41 +0000600
601Deleting/removing files and directories involves moving the cursor to the
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000602file/directory to be deleted and pressing "D". Directories must be empty first
603before they can be successfully removed. If the directory is a softlink to a
604directory, then netrw will make two requests to remove the directory before
605succeeding. Netrw will ask for confirmation before doing the removal(s).
606You may select a range of lines with the "V" command (visual selection),
607and then pressing "D".
Bram Moolenaar843ee412004-06-30 16:16:41 +0000608
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000609 *g:netrw_rm_cmd*
610The g:netrw_rm_cmd, g:netrw_rmf_cmd, and g:netrw_rmdir_cmd variables are used
611to control the attempts to remove files and directories. The g:netrw_rm_cmd
612is used with files, and its default value is:
Bram Moolenaar843ee412004-06-30 16:16:41 +0000613
614 g:netrw_rm_cmd: ssh HOSTNAME rm
615
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000616 *g:netrw_rmdir_cmd*
617The g:netrw_rmdir_cmd variable is used to support the removal of directories.
618Its default value is:
Bram Moolenaar843ee412004-06-30 16:16:41 +0000619
620 g:netrw_rmdir_cmd: ssh HOSTNAME rmdir
621
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000622 *g:netrw_rmf_cmd*
Bram Moolenaar843ee412004-06-30 16:16:41 +0000623If removing a directory fails with g:netrw_rmdir_cmd, netrw then will attempt
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000624to remove it again using the g:netrw_rmf_cmd variable. Its default value is:
Bram Moolenaar843ee412004-06-30 16:16:41 +0000625
626 g:netrw_rmf_cmd: ssh HOSTNAME rm -f
627
Bram Moolenaar843ee412004-06-30 16:16:41 +0000628
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000629RENAMING FILES OR DIRECTORIES *netrw-move* *netrw-rename*
Bram Moolenaar843ee412004-06-30 16:16:41 +0000630
631Renaming/moving files and directories involves moving the cursor to the
632file/directory to be moved (renamed) and pressing "R". You will then be
633queried for where you want the file/directory to be moved. You may select a
634range of lines with the "V" command (visual selection), and then pressing "R".
635
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000636The g:netrw_rename_cmd variable is used to implement renaming. By default its
Bram Moolenaar843ee412004-06-30 16:16:41 +0000637value is:
638
639 ssh HOSTNAME mv
640
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000641
642HIDING FILES OR DIRECTORIES *g:netrw_a* *g:netrw_list_hide*
643
644The "a" map lets the browser ignore the g:netrw_list_hide variable. Normally
645the g:netrw_list_hide variable holds a comma separated list of patterns which
646will be hidden (removed) from the directory listing.
647
648
649EDIT FILE OR DIRECTORY HIDING *netrw-h*
650
651The "h" map brings up a requestor allowing the user to change the
652file/directory hiding list.
653
654
655BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o*
656
657Normally one enters a file or directory using the <cr>. However, the "o"
658map allows one to open a new window to hold the new directory listing or
659file. A horizontal split is used. (also see |netrw-v|)
660
661
662SELECTING SORTING STYLE *netrw-s*
663
664One may select the sorting style by name, time, or (file) size. The
665"s" map allows one to circulate among the three choices; the directory
666listing will automatically be refreshed to reflect the selected style.
667
668
669REVERSING SORTING ORDER *netrw-r*
670
671One may toggle between normal and reverse sorting order by pressing the
672"r" key.
673
674
675BROWSING WITH A VERTICALLY SPLIT WINDOW *netrw-v*
676
677Normally one enters a file or directory using the <cr>. However, the "v"
678map allows one to open a new window to hold the new directory listing or
679file. A vertical split is used. (also see |netrw-o|)
680
681
682CUSTOMIZING BROWSING WITH A USER FUNCTION *netrw-x*
683
684One may "enter" a file with a special handler, thereby firing up a browser or
685other application, for example, on a file by hitting the "x" key. Presumably
686one could write handlers that would start OpenOffice programs (oowriter), etc,
687based on the file's extension coupled with the user's hitting the "x" key atop
688the file.
689
690The Netrw executor applies a user-defined function to a file, based on its
691extension. Of course, the handler function must exist for it to be called!
692>
693 Ex. mypgm.html x ->
694 NetrwFileHandler_html("scp://user@host/some/path/mypgm.html")
695<
696See the <plugin/NetrwFileHandlers.vim> for an example of how to handle an html
697file with mozilla.
698
699
700IMPROVING DIRECTORY BROWSING *netrw-list-hack*
701
702Especially with the remote directory browser, constantly entering the password
703is tedious.
704
Bram Moolenaar843ee412004-06-30 16:16:41 +0000705For Linux/Unix systems, I suggest looking into
706
707 http://hacks.oreilly.com/pub/h/66
708
709It gives a tip for setting up password-less use of ssh and scp, and discusses
710the associated security issues.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000711
712
713==============================================================================
7148. Debugging *netrw-debug*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000715
716The <netrw.vim> script is typically available as:
717
718 /usr/local/share/vim/vim6x/plugin/netrw.vim
719
720which is loaded automatically at startup (assuming :set nocp).
721
722 1. Get the <Decho.vim> script, available as:
723
724 http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_scripts
725 as "Decho, a vimL debugging aid"
726 or
727 http://vim.sourceforge.net/scripts/script.php?script_id=120
728
729 and put it into your local plugin directory
730
731 2. Edit the <netrw.vim> file as follows:
732
733 :DechoOn
734
735 (to restore to normal, use :DechoOff )
736
737 3. Then bring up vim and attempt a transfer. A set of messages
738 should appear concerning the steps that <netrw.vim> took in
739 attempting to read/write your file over the network. Please
740 send that information to <netrw.vim>'s maintainer,
741
742 drchipNOSPAM at campbellfamily.biz - NOSPAM
743
744==============================================================================
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00007459. History *netrw-history*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000746
Bram Moolenaar843ee412004-06-30 16:16:41 +0000747 v47: *
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000748 v46: * now handles remote directory browsing
749 * g:netrw_silent (if 1) will cause all transfers to be silent'd
750 v45: * made the [user@]hostname:path form a bit more restrictive
751 to better handle errors in using protocols
752 (e.g. scp:usr@host:file was being recognized as an rcp request)
753 v44: * changed from "rsync -a" to just "rsync"
754 * somehow an editing error messed up the test to recognize
755 use of the fetch method for NetRead.
756 * more debugging statements included
757 v43: * moved "Explanation" comments to <pi_netrw.txt> help file
758 as "Network Reference" (|netrw-ref|)
759 * <netrw.vim> now uses Dfunc() Decho() and Dret() for debugging
760 * removed superfluous NetRestorePosn() calls
761 v42: * now does BufReadPre and BufReadPost events on file:///*
762 and file://localhost/*
763 v41: * installed file:///* and file://localhost/* handling
764 v40: * prevents redraw when a protocol error occurs so that the
765 user may see it
766 v39: * sftp support
767 v38: * Now uses NetRestorePosn() calls with Nread/Nwrite commands
768 * Temporary files now removed via bwipe! instead of bwipe
769 (thanks to Dave Roberts)
770 v37: * Claar's modifications which test if ftp is successful, otherwise
771 give an error message
772 * After a read, the alternate file was pointing to the temp file.
773 The temp file buffer is now wiped out.
774 * removed silent from transfer methods so user can see what's
775 happening
Bram Moolenaar071d4272004-06-13 20:20:40 +0000776
777
778==============================================================================
Bram Moolenaar69a7cb42004-06-20 12:51:53 +000077910. Credits *netrw-credits*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000780
781 Vim editor by Bram Moolenaar (Thanks, Bram!)
782 dav support by C Campbell
783 fetch support by Bram Moolenaar and C Campbell
784 ftp support by C Campbell <NdrOchip@ScampbellPfamily.AbizM> - NOSPAM
785 http support by Bram Moolenaar <bram@moolenaar.net>
786 rcp
787 rsync support by C Campbell (suggested by Erik Warendorph)
788 scp support by raf <raf@comdyn.com.au>
789 sftp support by C Campbell
790
791 inputsecret(), BufReadCmd, BufWriteCmd contributed by C Campbell
792
793 Jérôme Augé -- also using new buffer method with ftp+.netrc
794 Bram Moolenaar -- obviously vim itself, :e and v:cmdarg use, fetch,...
795 Yasuhiro Matsumoto -- pointing out undo+0r problem and a solution
796 Erik Warendorph -- for several suggestions (g:netrw_..._cmd
797 variables, rsync etc)
798 Doug Claar -- modifications to test for success with ftp operation
799
800==============================================================================
801 vim:tw=78:ts=8:ft=help:norl: