blob: 0a13dc251073cf2f75998770a71bc55e5cf5edd7 [file] [log] [blame]
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001*pi_netrw.txt* For Vim version 6.2. Last change: Jun 15, 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 Moolenaar69a7cb42004-06-20 12:51:53 +0000197. Remote Directory Listing............................|netrw-dir|
208. Debugging...........................................|netrw-debug|
219. History.............................................|netrw-history|
2210. Credits.............................................|netrw-credits|
Bram Moolenaar071d4272004-06-13 20:20:40 +000023
24The functionality mentioned here is done via using |standard-plugin|
25techniques. This plugin is only available if
26
Bram Moolenaar69a7cb42004-06-20 12:51:53 +000027 set nocp " 'compatible' is not set
28 filetype plugin on " plugins are enabled
Bram Moolenaar071d4272004-06-13 20:20:40 +000029
30You can avoid loading this plugin by setting the "loaded_netrw" variable
31in your <.vimrc> file: >
32
33 :let loaded_netrw = 1
34
35{Vi does not have any of this}
36
37==============================================================================
381. Netrw Reference *netrw-ref*
39
40 OPTIONS
41 let g:netrw_ftp =0 use ftp (default) (uid password)
42 =1 use alternate ftp method (user uid password)
43 If you're having trouble with ftp, try changing the value
44 of this variable in your <.vimrc> to change methods
45
46 let g:netrw_ignorenetrc= 1
47 If you have a <.netrc> file but it doesn't work and you
48 want it ignored, then set this variable as shown. Its mere
49 existence is enough to cause <.netrc> to be ignored.
50
51 Controlling External Applications
52
Bram Moolenaar69a7cb42004-06-20 12:51:53 +000053 Protocol Variable Default Value
54 -------- ---------------- -------------
55 dav: g:netrw_dav_cmd = "cadaver"
56 fetch: g:netrw_fetch_cmd = "fetch -o"
57 ftp: g:netrw_ftp_cmd = "ftp"
58 http: g:netrw_http_cmd = "fetch -o" if fetch is available
59 http: g:netrw_http_cmd = "wget -q -O" If wget is available
60 rcp: g:netrw_rcp_cmd = "rcp"
61 rsync: g:netrw_rsync_cmd = "rsync -a"
62 scp: g:netrw_scp_cmd = "scp -q"
Bram Moolenaar071d4272004-06-13 20:20:40 +000063 sftp: g:netrw_sftp_cmd = "sftp"
64
65 READING
66 :Nread ? give help
67 :Nread "machine:file" uses rcp
68 :Nread "machine file" uses ftp with <.netrc>
69 :Nread "machine id password file" uses ftp
70 :Nread "dav://machine[:port]/file" uses cadaver
71 :Nread "fetch://[user@]machine/file" uses fetch
72 :Nread "ftp://[user@]machine[[:#]port]/file" uses ftp autodetects <.netrc>
73 :Nread "http://[user@]machine/file" uses http uses wget
74 :Nread "rcp://[user@]machine/file" uses rcp
75 :Nread "rsync://[user@]machine[:port]/file" uses rsync
76 :Nread "scp://[user@]machine[[:#]port]/file" uses scp
77 :Nread "sftp://[user@]machine/file" uses sftp
78
79 WRITING
Bram Moolenaar69a7cb42004-06-20 12:51:53 +000080 :Nwrite ? give help
Bram Moolenaar071d4272004-06-13 20:20:40 +000081 :Nwrite "machine:file" uses rcp
82 :Nwrite "machine file" uses ftp with <.netrc>
83 :Nwrite "machine id password file" uses ftp
84 :Nwrite "dav://machine[:port]/file" uses cadaver
85 :Nwrite "ftp://[user@]machine[[:#]port]/file" uses ftp autodetects <.netrc>
86 :Nwrite "rcp://[user@]machine/file" uses rcp
87 :Nwrite "rsync://[user@]machine[:port]/file" uses rsync
88 :Nwrite "scp://[user@]machine[[:#]port]/file" uses scp
89 :Nwrite "sftp://[user@]machine/file" uses sftp
90 http: not supported!
91
Bram Moolenaar69a7cb42004-06-20 12:51:53 +000092 DIRECTORY LISTING
93 :Nread [protocol]://[user]@hostname/path/
94
Bram Moolenaar071d4272004-06-13 20:20:40 +000095 USER AND PASSWORD CHANGING
96 Attempts to use ftp will prompt you for a user-id and a password.
97 These will be saved in g:netrw_uid and g:netrw_passwd Subsequent uses
98 of ftp will re-use those. If you need to use a different user id
99 and/or password, you'll want to call NetUserPass() first.
100
101 :NetUserPass [uid [password]] -- prompts as needed
102 :call NetUserPass() -- prompts for uid and password
103 :call NetUserPass("uid") -- prompts for password
104 :call NetUserPass("uid","password") -- sets global uid and password
105
106 VARIABLES
107 b:netrw_lastfile last file Network-read/written retained on
108 a per-buffer basis (supports plain :Nw )
109 s:netrw_line during Nw/NetWrite, holds current line number
110 s:netrw_col during Nw/NetWrite, holds current column number
111 s:netrw_line and s:netrw_col are used to
112 restore the cursor position on writes
113 g:netrw_ftp if it doesn't exist, use default ftp
114 =0 use default ftp (uid password)
115 =1 use alternate ftp method (user uid password)
116 g:netrw_ftpmode ="binary" (default)
117 ="ascii" (or your choice)
118 g:netrw_uid (ftp) user-id, retained on a per-session basis
119 g:netrw_passwd (ftp) password, retained on a per-session basis
120 g:netrw_win95ftp =0 use unix-style ftp even if win95/win98/winME
121 =1 use default method to do ftp
122 g:netrw_cygwin =1 assume scp under windows is from cygwin
123 (default if windows)
124 =0 assume scp under windows accepts
125 windows-style paths (default otherwise)
126 g:netrw_use_nt_rcp=0 don't use the rcp of WinNT, Win2000 and WinXP (default)
127 =1 use the rcp of WinNT,... in binary mode
128
129
130==============================================================================
1312. Network-Oriented File Transfer *netrw-xfer*
132
133Network-oriented file transfer under Vim is implemented by a VimL-based script
134(<netrw.vim>) using plugin techniques. It currently supports both reading
135and writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch,
136dav/cadaver, rsync, or sftp.
137
138http is currently supported read-only via use of wget or fetch.
139
140<netrw.vim> is a standard plugin which acts as glue between Vim and the
141various file transfer programs. It uses autocommand events (BufReadCmd,
142FileReadCmd, BufWriteCmd) to intercept reads/writes with url-like filenames. >
143
144 ex. vim ftp://hostname/path/to/file
145<
146The characters preceding the colon specify the protocol to use;
147in the example, its ftp. The <netrw.vim> script then formulates
148a command or a series of commands (typically ftp) which it issues
149to an external program (ftp, scp, etc) which does the actual file
150transfer/protocol. Files are read from/written to a temporary file
151(under Unix/Linux, /tmp/...) which the <netrw.vim> script will
152clean up.
153
154One may modify any protocol's implementing external application
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000155by settinbg a variable (ex. scp uses the variable g:netrw_scp_cmd,
Bram Moolenaar071d4272004-06-13 20:20:40 +0000156which is defaulted to "scp -q").
157
158Ftp, an old protocol, seems to be blessed by numerous implementations.
159Unfortunately, some implementations are noisy (ie., add junk to the end
160of the file). Thus, concerned users may decide to write a NetReadFixup()
161function that will clean up after reading with their ftp. Some Unix systems
162(ie., FreeBSD) provide a utility called "fetch" which uses the ftp protocol
163but is not noisy and more convenient, actually, for <netrw.vim> to use.
164Consequently, if "fetch" is executable, it will be used to do reads for
165ftp://... (and http://...) . See |netrw-var| for more about this.
166
167For rcp, scp, sftp, and http, one may use network-oriented file transfers
168transparently; ie.
169>
170 vim rcp://[user@]machine/path
171 vim scp://[user@]machine/path
172<
173If your ftp supports <.netrc>, then it too can be just as transparently used
174if the needed triad of machine name, user id, and password are present in
175that file. Your ftp must be able to use the <.netrc> file on its own, however.
176>
177 vim ftp://[user@]machine[[:#]portnumber]/path
178<
179However, ftp will often need to query the user for the userid and password.
180The latter will be done "silently"; ie. asterisks will show up instead of
181the actually-typed-in password. Netrw will retain the userid and password
182for subsequent read/writes from the most recent transfer so subsequent
183transfers (read/write) to or from that machine will take place without
184additional prompting.
185
186 *netrw-urls*
187 +=================================+============================+============+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000188 | Reading | Writing | Uses |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000189 +=================================+============================+============+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000190 | DAV: | | |
191 | dav://host/path | | cadaver |
192 | :Nread dav://host/path | :Nwrite dav://host/path | cadaver |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000193 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000194 | FETCH: | | |
195 | fetch://[user@]host/path | | |
196 | fetch://[user@]host:http/path | Not Available | fetch |
197 | :Nread fetch://[user@]host/path| | |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000198 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000199 | FILE: | | |
200 | file:///* | file:///* | |
201 | file://localhost/* | file://localhost/* | |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000202 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000203 | FTP: (*3) | (*3) | |
204 | ftp://[user@]host/path | ftp://[user@]host/path | ftp (*2) |
205 | :Nread ftp://host/path | :Nwrite ftp://host/path | ftp+.netrc |
206 | :Nread host path | :Nwrite host path | ftp+.netrc |
207 | :Nread host uid pass path | :Nwrite host uid pass path | ftp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000208 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000209 | HTTP: wget is executable: (*4) | | |
210 | http://[user@]host/path | Not Available | wget |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000211 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000212 | HTTP: fetch is executable (*4) | | |
213 | http://[user@]host/path | Not Available | fetch |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000214 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000215 | RCP: | | |
216 | rcp://[user@]host/path | rcp://[user@]host/path | rcp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000217 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000218 | RSYNC: | | |
219 | rsync://[user@]host/path | rsync://[user@]host/path | rsync |
220 | :Nread rsync://host/path | :Nwrite rsync://host/path | rsync |
221 | :Nread rcp://host/path | :Nwrite rcp://host/path | rcp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000222 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000223 | SCP: | | |
224 | scp://[user@]host/path | scp://[user@]host/path | scp |
225 | :Nread scp://host/path | :Nwrite scp://host/path | scp (*1) |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000226 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000227 | SFTP: | | |
228 | sftp://[user@]host/path | sftp://[user@]host/path | sftp |
229 | :Nread sftp://host/path | :Nwrite sftp://host/path | sftp (*1) |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000230 +=================================+============================+============+
231
232 (*1) For an absolute path use scp://machine//path.
233
234 (*2) if <.netrc> is present, it is assumed that it will
235 work with your ftp client. Otherwise the script will
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000236 prompt for user-id and pasword.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000237
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000238 (*3) for ftp, "machine" may be machine#port or machine:port
Bram Moolenaar071d4272004-06-13 20:20:40 +0000239 if a different port is needed than the standard ftp port
240
241 (*4) for http:..., if wget is available it will be used. Otherwise,
242 if fetch is available it will be used.
243
244Both the :Nread and the :Nwrite ex-commands can accept multiple filenames.
245
246
247NETRC *netrw-netrc*
248
249The typical syntax for lines in a <.netrc> file is given as shown below.
250Ftp under Unix usually support <.netrc>; Windows' ftp usually doesn't.
251>
252 machine {full machine name} login {user-id} password "{password}"
253 default login {user-id} password "{password}"
254
255Your ftp client must handle the use of <.netrc> on its own, but if the
256<.netrc> file exists, an ftp transfer will not ask for the user-id or
257password.
258
259 Note:
260 Since this file contains passwords, make very sure nobody else can
261 read this file! Most programs will refuse to use a .netrc that is
262 readable for others. Don't forget that the system administrator can
263 still read the file!
264
265
266PASSWORD *netrw-passwd*
267
268The script attempts to get passwords for ftp invisibly using |inputsecret()|,
269a built-in Vim function. See |netrw-uidpass| for how to change the password
270after one has set it.
271
272Unfortunately there doesn't appear to be a way for netrw to feed a password
273to scp. Thus every transfer via scp will require re-entry of the password.
274
275
276==============================================================================
2773. Activation *netrw-activate*
278
279Network-oriented file transfers are available by default whenever
280|'nocompatible'| mode is enabled. The <netrw.vim> file resides in your
281system's vim-plugin directory and is sourced automatically whenever you
282bring up vim.
283
284
285==============================================================================
2864. Transparent File Transfer *netrw-transparent*
287
288Transparent file transfers occur whenever a regular file read or write
289(invoked via an |:autocmd| for |BufReadCmd| or |BufWriteCmd| events) is made.
290Thus one may use files across networks as if they were local. >
291
292 vim ftp://[user@]machine/path
293 ...
294 :wq
295
296
297==============================================================================
2985. Ex Commands *netrw-ex*
299
300The usual read/write commands are supported. There are also a couple of
301additional commands available.
302
303:[range]Nw Write the specified lines to the current
304 file as specified in b:netrw_lastfile.
305
306:[range]Nw {netfile} [{netfile}]...
307 Write the specified lines to the {netfile}.
308
309:Nread
310 Read the specified lines into the current
311 buffer from the file specified in
312 b:netrw_lastfile.
313
314:Nread {netfile} {netfile}...
315 Read the {netfile} after the current line.
316
317 *netrw-uidpass*
318:call NetUserPass()
319 If b:netrw_uid and b:netrw_passwd don't exist,
320 this function query the user for them.
321
322:call NetUserPass("userid")
323 This call will set the b:netrw_uid and, if
324 the password doesn't exist, will query the user for it.
325
326:call NetUserPass("userid","passwd")
327 This call will set both the b:netrw_uid and b:netrw_passwd.
328 The user-id and password are used by ftp transfers. One may
329 effectively remove the user-id and password by using ""
330 strings.
331
332
333==============================================================================
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00003346. Variables and Options *netrw-options* *netrw-var*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000335
336The script <netrw.vim> uses several variables which can affect <netrw.vim>'s
337behavior. These variables typically may be set in the user's <.vimrc> file:
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000338>
339 -------------
340 Netrw Options
341 -------------
342 Option Meaning
343 -------------- -----------------------------------------------
344<
345 b:netrw_col Holds current cursor position (during NetWrite)
346 g:netrw_cygwin =1 assume scp under windows is from cygwin
347 (default/windows)
348 =0 assume scp under windows accepts windows
349 style paths (default/else)
350 g:netrw_ftp =0 use default ftp (uid password)
351 g:netrw_ftpmode ="binary" (default)
352 ="ascii" (your choice)
353 g:netrw_ignorenetrc =1 (default)
354 if you have a <.netrc> file but you don't
Bram Moolenaar071d4272004-06-13 20:20:40 +0000355 want it used, then set this variable. Its
356 mere existence is enough to cause <.netrc>
357 to be ignored.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000358 b:netrw_lastfile Holds latest method/machine/path.
359 b:netrw_line Holds current line number (during NetWrite)
360 g:netrw_passwd Holds current password for ftp.
361 g:netrw_silent =0 transfers done normally
362 =1 transfers done silently
363 g:netrw_uid Holds current user-id for ftp.
364 =1 use alternate ftp (user uid password)
365 (see |netrw-options|)
366 g:netrw_use_nt_rcp =0 don't use WinNT/2K/XP's rcp (default)
367 =1 use WinNT/2K/XP's rcp, binary mode
368 g:netrw_win95ftp =0 use unix-style ftp even if win95/98/ME/etc
369 =1 use default method to do ftp >
370 -----------------------------------------------------------------------
371<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000372The script will also make use of the following variables internally, albeit
373temporarily.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000374>
375 -------------------
376 Temporary Variables
377 -------------------
378 Variable Meaning
379 -------- ------------------------------------
380<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000381 g:netrw_method Index indicating rcp/ftp+.netrc/ftp
382 g:netrw_machine Holds machine name parsed from input
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000383 g:netrw_fname Holds filename being accessed >
384 ------------------------------------------------------------
385<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000386 *netrw-protocol*
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000387
388Netrw supports a number of protocols. These protocols are invoked using the
389variables listed below, and may be modified by the user.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000390>
391 ------------------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000392 Protocol Control Options
Bram Moolenaar071d4272004-06-13 20:20:40 +0000393 ------------------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000394 Option Type Setting Meaning
395 --------- -------- -------------- ---------------------------
396<
397 netrw_ftp variable =doesn't exist userid set by "user userid"
398 =0 userid set by "user userid"
399 =1 userid set by "userid"
400 NetReadFixup function =doesn't exist no change
401 =exists Allows user to have files
402 read via ftp automatically
403 transformed however they wish
404 by NetReadFixup()
Bram Moolenaar071d4272004-06-13 20:20:40 +0000405 g:netrw_dav_cmd variable ="cadaver"
406 g:netrw_fetch_cmd variable ="fetch -o"
407 g:netrw_ftp_cmd variable ="ftp"
408 g:netrw_http_cmd variable ="fetch -o" else if fetch is executable
409 g:netrw_http_cmd variable ="wget -O" if wget is executable
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000410 g:netrw_list_cmd variable ="ssh HOSTNAME ls -Fa"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000411 g:netrw_rcp_cmd variable ="rcp"
412 g:netrw_rsync_cmd variable ="rsync -a"
413 g:netrw_scp_cmd variable ="scp -q"
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000414 g:netrw_sftp_cmd variable ="sftp" >
415 -------------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000416<
417The first two options both help with certain ftp's that give trouble otherwise.
418In order to best understand how to use these options if ftp is giving you
419troubles, a bit of discussion follows on how netrw does ftp reads.
420
421The g:netrw_..._cmd variables specify the external program to use handle
422the associated protocol (rcp, ftp, etc), plus any options.
423
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000424The g:netrw_list_cmd's HOSTNAME entry will be changed via substitution with
425whatever the current request is for a hostname.
426
427For ftp, netrw typically builds up lines of one of the following formats in a
Bram Moolenaar071d4272004-06-13 20:20:40 +0000428temporary file:
429>
430 IF g:netrw_ftp !exists or is not 1 IF g:netrw_ftp exists and is 1
431 ---------------------------------- ------------------------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000432<
433 open machine [port] open machine [port]
434 user userid password userid password
435 [g:netrw_ftpmode] password
436 get filename tempfile [g:netrw_ftpmode]
437 get filename tempfile >
438 ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000439<
440Netrw then executes the lines above by use of a filter:
441>
442 :%! {g:netrw_ftp_cmd} -i [-n]
443<
444
445where
446 g:netrw_ftp_cmd is usually "ftp",
447 -i tells ftp not to be interactive
448 -n means don't use netrc and is used for Method #3 (ftp w/o <.netrc>)
449
450If <.netrc> exists it will be used to avoid having to query the user for
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000451userid and password. The transferred file is put into a temporary file.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000452The temporary file is then read into the main editing session window that
453requested it and the temporary file deleted.
454
455If your ftp doesn't accept the "user" command and immediately just demands
456a userid, then try putting "let netrw_ftp=1" in your <.vimrc>.
457
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000458 *netrw-fixup*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000459If your ftp for whatever reason generates unwanted lines (such as AUTH
460messages) you may write a NetReadFixup(tmpfile) function:
461>
462 function! NetReadFixup(method,line1,line2)
463 " a:line1: first new line in current file
464 " a:line2: last new line in current file
465 if a:method == 1 "rcp
466 elseif a:method == 2 "ftp + <.netrc>
467 elseif a:method == 3 "ftp + machine,uid,password,filename
468 elseif a:method == 4 "scp
469 elseif a:method == 5 "http/wget
470 elseif a:method == 6 "dav/cadaver
471 elseif a:method == 7 "rsync
472 elseif a:method == 8 "fetch
473 elseif a:method == 9 "sftp
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000474 else " complain
Bram Moolenaar071d4272004-06-13 20:20:40 +0000475 endif
476 endfunction
477>
478The NetReadFixup() function will be called if it exists and thus allows
479you to customize your reading process. As a further example, <netrw.vim>
480contains just such a function to handle Windows 95 ftp. For whatever
481reason, Windows 95's ftp dumps four blank lines at the end of a transfer,
482and so it is desirable to automate their removal. Here's some code taken
483from <netrw.vim> itself:
484>
485 if has("win95") && g:netrw_win95ftp
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000486 fun! NetReadFixup(method, line1, line2)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000487 if method == 3 " ftp (no <.netrc>)
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000488 let fourblanklines= line2 - 3
489 silent fourblanklines.",".line2."g/^\s*/d"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000490 endif
491 endfunction
492 endif
493>
494
495==============================================================================
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00004967. Remote Directory Listing *netrw-dir* *netrw-list*
497
498Netrw supports listing (browsing) directories on remote hosts; simply attempt
499to read a "file" with a trailing slash and it will be interpreted as a
500request to browse a directory:
501
502 vim [protocol]://[user@]hostname/path/
503
504Netrw will modify the command in g:netrw_list to perform the directory listing
505operation. By default the command is:
506
507 ssh HOSTNAME ls -Fa
508
509where the HOSTNAME becomes the hostname as requested by the attempted
510read. Naturally, the user may override this command with whatever is
511preferred. The NetList function which implements remote directory
512browsing expects that directories will be flagged by a trailing slash.
513
514Browsing is simple: move the cursor onto a file or directory of interest.
515Hitting the <cr> (the return key) will select the file or directory. Directories
516will themselves be listed, and files will be opened using the protocol given
517in the original read request.
518
519
520==============================================================================
5218. Debugging *netrw-debug*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000522
523The <netrw.vim> script is typically available as:
524
525 /usr/local/share/vim/vim6x/plugin/netrw.vim
526
527which is loaded automatically at startup (assuming :set nocp).
528
529 1. Get the <Decho.vim> script, available as:
530
531 http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_scripts
532 as "Decho, a vimL debugging aid"
533 or
534 http://vim.sourceforge.net/scripts/script.php?script_id=120
535
536 and put it into your local plugin directory
537
538 2. Edit the <netrw.vim> file as follows:
539
540 :DechoOn
541
542 (to restore to normal, use :DechoOff )
543
544 3. Then bring up vim and attempt a transfer. A set of messages
545 should appear concerning the steps that <netrw.vim> took in
546 attempting to read/write your file over the network. Please
547 send that information to <netrw.vim>'s maintainer,
548
549 drchipNOSPAM at campbellfamily.biz - NOSPAM
550
551==============================================================================
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00005529. History *netrw-history*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000553
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000554 v46: * now handles remote directory browsing
555 * g:netrw_silent (if 1) will cause all transfers to be silent'd
556 v45: * made the [user@]hostname:path form a bit more restrictive
557 to better handle errors in using protocols
558 (e.g. scp:usr@host:file was being recognized as an rcp request)
559 v44: * changed from "rsync -a" to just "rsync"
560 * somehow an editing error messed up the test to recognize
561 use of the fetch method for NetRead.
562 * more debugging statements included
563 v43: * moved "Explanation" comments to <pi_netrw.txt> help file
564 as "Network Reference" (|netrw-ref|)
565 * <netrw.vim> now uses Dfunc() Decho() and Dret() for debugging
566 * removed superfluous NetRestorePosn() calls
567 v42: * now does BufReadPre and BufReadPost events on file:///*
568 and file://localhost/*
569 v41: * installed file:///* and file://localhost/* handling
570 v40: * prevents redraw when a protocol error occurs so that the
571 user may see it
572 v39: * sftp support
573 v38: * Now uses NetRestorePosn() calls with Nread/Nwrite commands
574 * Temporary files now removed via bwipe! instead of bwipe
575 (thanks to Dave Roberts)
576 v37: * Claar's modifications which test if ftp is successful, otherwise
577 give an error message
578 * After a read, the alternate file was pointing to the temp file.
579 The temp file buffer is now wiped out.
580 * removed silent from transfer methods so user can see what's
581 happening
Bram Moolenaar071d4272004-06-13 20:20:40 +0000582
583
584==============================================================================
Bram Moolenaar69a7cb42004-06-20 12:51:53 +000058510. Credits *netrw-credits*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000586
587 Vim editor by Bram Moolenaar (Thanks, Bram!)
588 dav support by C Campbell
589 fetch support by Bram Moolenaar and C Campbell
590 ftp support by C Campbell <NdrOchip@ScampbellPfamily.AbizM> - NOSPAM
591 http support by Bram Moolenaar <bram@moolenaar.net>
592 rcp
593 rsync support by C Campbell (suggested by Erik Warendorph)
594 scp support by raf <raf@comdyn.com.au>
595 sftp support by C Campbell
596
597 inputsecret(), BufReadCmd, BufWriteCmd contributed by C Campbell
598
599 Jérôme Augé -- also using new buffer method with ftp+.netrc
600 Bram Moolenaar -- obviously vim itself, :e and v:cmdarg use, fetch,...
601 Yasuhiro Matsumoto -- pointing out undo+0r problem and a solution
602 Erik Warendorph -- for several suggestions (g:netrw_..._cmd
603 variables, rsync etc)
604 Doug Claar -- modifications to test for success with ftp operation
605
606==============================================================================
607 vim:tw=78:ts=8:ft=help:norl: