blob: 3d48b7728afa17ea4f5c4c6a1c20f136ea77772f [file] [log] [blame]
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001*pi_netrw.txt* For Vim version 6.3. Last change: Oct 08, 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 Moolenaard4755bb2004-09-02 19:12:26 +0000197. Directory Browser...................................|netrw-browse|
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000208. Problems and Fixes..................................|netrw-problems|
219. Debugging...........................................|netrw-debug|
2210. History.............................................|netrw-history|
2311. Credits.............................................|netrw-credits|
Bram Moolenaar071d4272004-06-13 20:20:40 +000024
25The functionality mentioned here is done via using |standard-plugin|
26techniques. This plugin is only available if
27
Bram Moolenaar69a7cb42004-06-20 12:51:53 +000028 set nocp " 'compatible' is not set
29 filetype plugin on " plugins are enabled
Bram Moolenaar071d4272004-06-13 20:20:40 +000030
31You can avoid loading this plugin by setting the "loaded_netrw" variable
32in your <.vimrc> file: >
33
34 :let loaded_netrw = 1
35
36{Vi does not have any of this}
37
38==============================================================================
391. Netrw Reference *netrw-ref*
40
41 OPTIONS
42 let g:netrw_ftp =0 use ftp (default) (uid password)
43 =1 use alternate ftp method (user uid password)
44 If you're having trouble with ftp, try changing the value
45 of this variable in your <.vimrc> to change methods
46
47 let g:netrw_ignorenetrc= 1
48 If you have a <.netrc> file but it doesn't work and you
49 want it ignored, then set this variable as shown. Its mere
50 existence is enough to cause <.netrc> to be ignored.
51
52 Controlling External Applications
53
Bram Moolenaar69a7cb42004-06-20 12:51:53 +000054 Protocol Variable Default Value
55 -------- ---------------- -------------
56 dav: g:netrw_dav_cmd = "cadaver"
57 fetch: g:netrw_fetch_cmd = "fetch -o"
58 ftp: g:netrw_ftp_cmd = "ftp"
59 http: g:netrw_http_cmd = "fetch -o" if fetch is available
60 http: g:netrw_http_cmd = "wget -q -O" If wget is available
61 rcp: g:netrw_rcp_cmd = "rcp"
62 rsync: g:netrw_rsync_cmd = "rsync -a"
63 scp: g:netrw_scp_cmd = "scp -q"
Bram Moolenaar071d4272004-06-13 20:20:40 +000064 sftp: g:netrw_sftp_cmd = "sftp"
65
Bram Moolenaard4755bb2004-09-02 19:12:26 +000066 READING *netrw-read* *netrw-nread*
Bram Moolenaar071d4272004-06-13 20:20:40 +000067 :Nread ? give help
Bram Moolenaard4755bb2004-09-02 19:12:26 +000068 :Nread "machine:path" uses rcp
69 :Nread "machine path" uses ftp with <.netrc>
70 :Nread "machine id password path" uses ftp
71 :Nread "dav://machine[:port]/path" uses cadaver
72 :Nread "fetch://[user@]machine/path" uses fetch
73 :Nread "ftp://[user@]machine[[:#]port]/path" uses ftp autodetects <.netrc>
74 :Nread "http://[user@]machine/path" uses http uses wget
75 :Nread "rcp://[user@]machine/path" uses rcp
76 :Nread "rsync://[user@]machine[:port]/path" uses rsync
77 :Nread "scp://[user@]machine[[:#]port]/path" uses scp
78 :Nread "sftp://[user@]machine/path" uses sftp
Bram Moolenaar071d4272004-06-13 20:20:40 +000079
Bram Moolenaard4755bb2004-09-02 19:12:26 +000080 WRITING *netrw-write* *netrw-nwrite*
Bram Moolenaar69a7cb42004-06-20 12:51:53 +000081 :Nwrite ? give help
Bram Moolenaard4755bb2004-09-02 19:12:26 +000082 :Nwrite "machine:path" uses rcp
83 :Nwrite "machine path" uses ftp with <.netrc>
84 :Nwrite "machine id password path" uses ftp
85 :Nwrite "dav://machine[:port]/path" uses cadaver
86 :Nwrite "ftp://[user@]machine[[:#]port]/path" uses ftp autodetects <.netrc>
87 :Nwrite "rcp://[user@]machine/path" uses rcp
88 :Nwrite "rsync://[user@]machine[:port]/path" uses rsync
89 :Nwrite "scp://[user@]machine[[:#]port]/path" uses scp
90 :Nwrite "sftp://[user@]machine/path" uses sftp
Bram Moolenaar071d4272004-06-13 20:20:40 +000091 http: not supported!
92
Bram Moolenaar69a7cb42004-06-20 12:51:53 +000093 DIRECTORY LISTING
94 :Nread [protocol]://[user]@hostname/path/
95
Bram Moolenaar071d4272004-06-13 20:20:40 +000096 USER AND PASSWORD CHANGING
97 Attempts to use ftp will prompt you for a user-id and a password.
98 These will be saved in g:netrw_uid and g:netrw_passwd Subsequent uses
99 of ftp will re-use those. If you need to use a different user id
100 and/or password, you'll want to call NetUserPass() first.
101
102 :NetUserPass [uid [password]] -- prompts as needed
103 :call NetUserPass() -- prompts for uid and password
104 :call NetUserPass("uid") -- prompts for password
105 :call NetUserPass("uid","password") -- sets global uid and password
106
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000107 VARIABLES *netrw-variables*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000108 b:netrw_lastfile last file Network-read/written retained on
109 a per-buffer basis (supports plain :Nw )
110 s:netrw_line during Nw/NetWrite, holds current line number
111 s:netrw_col during Nw/NetWrite, holds current column number
112 s:netrw_line and s:netrw_col are used to
113 restore the cursor position on writes
114 g:netrw_ftp if it doesn't exist, use default ftp
115 =0 use default ftp (uid password)
116 =1 use alternate ftp method (user uid password)
117 g:netrw_ftpmode ="binary" (default)
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000118 ="ascii"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000119 g:netrw_uid (ftp) user-id, retained on a per-session basis
120 g:netrw_passwd (ftp) password, retained on a per-session basis
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000121 g:netrw_win95ftp =1 if using Win95, will remove four trailing blank
122 lines that o/s's ftp "provides" on transfers
123 =0 force normal ftp behavior (no trailing line
124 removal)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000125 g:netrw_cygwin =1 assume scp under windows is from cygwin
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000126 Also permits network browsing to use
127 ls with time and size sorting
Bram Moolenaar071d4272004-06-13 20:20:40 +0000128 (default if windows)
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000129 =0 assume Windows' scp accepts windows-style paths
130 Network browsing uses dir instead of ls
131 This option is ignored if you're using unix
132 g:netrw_use_nt_rcp=0 don't use the rcp of WinNT, Win2000 and WinXP
133 =1 use WinNT's rcp in binary mode (default)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000134
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000135 PATHS *netrw-path*
136
137 Paths to files are generally user-directory relative for most protocols.
138 It is possible that some protocol will make paths relative to some
139 associated directory, however.
140
141 example: vim scp://user@host/somefile
142 example: vim scp://user@host/subdir1/subdir2/somefile
143
144 where "somefile" is the "user"'s home directory. If you wish to get a
145 file using root-relative paths, use the full path:
146
147 example: vim scp://user@host//somefile
148 example: vim scp://user@host//subdir1/subdir2/somefile
149
Bram Moolenaar071d4272004-06-13 20:20:40 +0000150
151==============================================================================
1522. Network-Oriented File Transfer *netrw-xfer*
153
154Network-oriented file transfer under Vim is implemented by a VimL-based script
155(<netrw.vim>) using plugin techniques. It currently supports both reading
156and writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch,
157dav/cadaver, rsync, or sftp.
158
159http is currently supported read-only via use of wget or fetch.
160
161<netrw.vim> is a standard plugin which acts as glue between Vim and the
162various file transfer programs. It uses autocommand events (BufReadCmd,
163FileReadCmd, BufWriteCmd) to intercept reads/writes with url-like filenames. >
164
165 ex. vim ftp://hostname/path/to/file
166<
167The characters preceding the colon specify the protocol to use;
168in the example, its ftp. The <netrw.vim> script then formulates
169a command or a series of commands (typically ftp) which it issues
170to an external program (ftp, scp, etc) which does the actual file
171transfer/protocol. Files are read from/written to a temporary file
172(under Unix/Linux, /tmp/...) which the <netrw.vim> script will
173clean up.
174
175One may modify any protocol's implementing external application
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000176by setting a variable (ex. scp uses the variable g:netrw_scp_cmd,
Bram Moolenaar071d4272004-06-13 20:20:40 +0000177which is defaulted to "scp -q").
178
179Ftp, an old protocol, seems to be blessed by numerous implementations.
Bram Moolenaar402d2fe2005-04-15 21:00:38 +0000180Unfortunately, some implementations are noisy (i.e., add junk to the end
Bram Moolenaar071d4272004-06-13 20:20:40 +0000181of the file). Thus, concerned users may decide to write a NetReadFixup()
182function that will clean up after reading with their ftp. Some Unix systems
Bram Moolenaar402d2fe2005-04-15 21:00:38 +0000183(i.e., FreeBSD) provide a utility called "fetch" which uses the ftp protocol
Bram Moolenaar071d4272004-06-13 20:20:40 +0000184but is not noisy and more convenient, actually, for <netrw.vim> to use.
185Consequently, if "fetch" is executable, it will be used to do reads for
186ftp://... (and http://...) . See |netrw-var| for more about this.
187
188For rcp, scp, sftp, and http, one may use network-oriented file transfers
Bram Moolenaar402d2fe2005-04-15 21:00:38 +0000189transparently; i.e.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000190>
191 vim rcp://[user@]machine/path
192 vim scp://[user@]machine/path
193<
194If your ftp supports <.netrc>, then it too can be just as transparently used
195if the needed triad of machine name, user id, and password are present in
196that file. Your ftp must be able to use the <.netrc> file on its own, however.
197>
198 vim ftp://[user@]machine[[:#]portnumber]/path
199<
200However, ftp will often need to query the user for the userid and password.
Bram Moolenaar402d2fe2005-04-15 21:00:38 +0000201The latter will be done "silently"; i.e. asterisks will show up instead of
Bram Moolenaar071d4272004-06-13 20:20:40 +0000202the actually-typed-in password. Netrw will retain the userid and password
203for subsequent read/writes from the most recent transfer so subsequent
204transfers (read/write) to or from that machine will take place without
205additional prompting.
206
207 *netrw-urls*
208 +=================================+============================+============+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000209 | Reading | Writing | Uses |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000210 +=================================+============================+============+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000211 | DAV: | | |
212 | dav://host/path | | cadaver |
213 | :Nread dav://host/path | :Nwrite dav://host/path | cadaver |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000214 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000215 | FETCH: | | |
216 | fetch://[user@]host/path | | |
217 | fetch://[user@]host:http/path | Not Available | fetch |
218 | :Nread fetch://[user@]host/path| | |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000219 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000220 | FILE: | | |
221 | file:///* | file:///* | |
222 | file://localhost/* | file://localhost/* | |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000223 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000224 | FTP: (*3) | (*3) | |
225 | ftp://[user@]host/path | ftp://[user@]host/path | ftp (*2) |
226 | :Nread ftp://host/path | :Nwrite ftp://host/path | ftp+.netrc |
227 | :Nread host path | :Nwrite host path | ftp+.netrc |
228 | :Nread host uid pass path | :Nwrite host uid pass path | ftp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000229 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000230 | HTTP: wget is executable: (*4) | | |
231 | http://[user@]host/path | Not Available | wget |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000232 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000233 | HTTP: fetch is executable (*4) | | |
234 | http://[user@]host/path | Not Available | fetch |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000235 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000236 | RCP: | | |
237 | rcp://[user@]host/path | rcp://[user@]host/path | rcp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000238 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000239 | RSYNC: | | |
240 | rsync://[user@]host/path | rsync://[user@]host/path | rsync |
241 | :Nread rsync://host/path | :Nwrite rsync://host/path | rsync |
242 | :Nread rcp://host/path | :Nwrite rcp://host/path | rcp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000243 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000244 | SCP: | | |
245 | scp://[user@]host/path | scp://[user@]host/path | scp |
246 | :Nread scp://host/path | :Nwrite scp://host/path | scp (*1) |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000247 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000248 | SFTP: | | |
249 | sftp://[user@]host/path | sftp://[user@]host/path | sftp |
250 | :Nread sftp://host/path | :Nwrite sftp://host/path | sftp (*1) |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000251 +=================================+============================+============+
252
253 (*1) For an absolute path use scp://machine//path.
254
255 (*2) if <.netrc> is present, it is assumed that it will
256 work with your ftp client. Otherwise the script will
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000257 prompt for user-id and pasword.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000258
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000259 (*3) for ftp, "machine" may be machine#port or machine:port
Bram Moolenaar071d4272004-06-13 20:20:40 +0000260 if a different port is needed than the standard ftp port
261
262 (*4) for http:..., if wget is available it will be used. Otherwise,
263 if fetch is available it will be used.
264
265Both the :Nread and the :Nwrite ex-commands can accept multiple filenames.
266
267
268NETRC *netrw-netrc*
269
270The typical syntax for lines in a <.netrc> file is given as shown below.
271Ftp under Unix usually support <.netrc>; Windows' ftp usually doesn't.
272>
273 machine {full machine name} login {user-id} password "{password}"
274 default login {user-id} password "{password}"
275
276Your ftp client must handle the use of <.netrc> on its own, but if the
277<.netrc> file exists, an ftp transfer will not ask for the user-id or
278password.
279
280 Note:
281 Since this file contains passwords, make very sure nobody else can
282 read this file! Most programs will refuse to use a .netrc that is
283 readable for others. Don't forget that the system administrator can
284 still read the file!
285
286
287PASSWORD *netrw-passwd*
288
289The script attempts to get passwords for ftp invisibly using |inputsecret()|,
290a built-in Vim function. See |netrw-uidpass| for how to change the password
291after one has set it.
292
293Unfortunately there doesn't appear to be a way for netrw to feed a password
294to scp. Thus every transfer via scp will require re-entry of the password.
295
296
297==============================================================================
2983. Activation *netrw-activate*
299
300Network-oriented file transfers are available by default whenever
301|'nocompatible'| mode is enabled. The <netrw.vim> file resides in your
302system's vim-plugin directory and is sourced automatically whenever you
303bring up vim.
304
305
306==============================================================================
3074. Transparent File Transfer *netrw-transparent*
308
309Transparent file transfers occur whenever a regular file read or write
310(invoked via an |:autocmd| for |BufReadCmd| or |BufWriteCmd| events) is made.
311Thus one may use files across networks as if they were local. >
312
313 vim ftp://[user@]machine/path
314 ...
315 :wq
316
317
318==============================================================================
3195. Ex Commands *netrw-ex*
320
321The usual read/write commands are supported. There are also a couple of
322additional commands available.
323
324:[range]Nw Write the specified lines to the current
325 file as specified in b:netrw_lastfile.
326
327:[range]Nw {netfile} [{netfile}]...
328 Write the specified lines to the {netfile}.
329
330:Nread
331 Read the specified lines into the current
332 buffer from the file specified in
333 b:netrw_lastfile.
334
335:Nread {netfile} {netfile}...
336 Read the {netfile} after the current line.
337
338 *netrw-uidpass*
339:call NetUserPass()
340 If b:netrw_uid and b:netrw_passwd don't exist,
341 this function query the user for them.
342
343:call NetUserPass("userid")
344 This call will set the b:netrw_uid and, if
345 the password doesn't exist, will query the user for it.
346
347:call NetUserPass("userid","passwd")
348 This call will set both the b:netrw_uid and b:netrw_passwd.
349 The user-id and password are used by ftp transfers. One may
350 effectively remove the user-id and password by using ""
351 strings.
352
353
354==============================================================================
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00003556. Variables and Options *netrw-options* *netrw-var*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000356
357The script <netrw.vim> uses several variables which can affect <netrw.vim>'s
358behavior. These variables typically may be set in the user's <.vimrc> file:
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000359>
360 -------------
361 Netrw Options
362 -------------
363 Option Meaning
364 -------------- -----------------------------------------------
365<
366 b:netrw_col Holds current cursor position (during NetWrite)
367 g:netrw_cygwin =1 assume scp under windows is from cygwin
368 (default/windows)
369 =0 assume scp under windows accepts windows
370 style paths (default/else)
371 g:netrw_ftp =0 use default ftp (uid password)
372 g:netrw_ftpmode ="binary" (default)
373 ="ascii" (your choice)
374 g:netrw_ignorenetrc =1 (default)
375 if you have a <.netrc> file but you don't
Bram Moolenaar071d4272004-06-13 20:20:40 +0000376 want it used, then set this variable. Its
377 mere existence is enough to cause <.netrc>
378 to be ignored.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000379 b:netrw_lastfile Holds latest method/machine/path.
380 b:netrw_line Holds current line number (during NetWrite)
381 g:netrw_passwd Holds current password for ftp.
382 g:netrw_silent =0 transfers done normally
383 =1 transfers done silently
384 g:netrw_uid Holds current user-id for ftp.
385 =1 use alternate ftp (user uid password)
386 (see |netrw-options|)
387 g:netrw_use_nt_rcp =0 don't use WinNT/2K/XP's rcp (default)
388 =1 use WinNT/2K/XP's rcp, binary mode
389 g:netrw_win95ftp =0 use unix-style ftp even if win95/98/ME/etc
390 =1 use default method to do ftp >
391 -----------------------------------------------------------------------
392<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000393The script will also make use of the following variables internally, albeit
394temporarily.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000395>
396 -------------------
397 Temporary Variables
398 -------------------
399 Variable Meaning
400 -------- ------------------------------------
401<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000402 g:netrw_method Index indicating rcp/ftp+.netrc/ftp
403 g:netrw_machine Holds machine name parsed from input
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000404 g:netrw_fname Holds filename being accessed >
405 ------------------------------------------------------------
406<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000407 *netrw-protocol*
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000408
409Netrw supports a number of protocols. These protocols are invoked using the
410variables listed below, and may be modified by the user.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000411>
412 ------------------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000413 Protocol Control Options
Bram Moolenaar071d4272004-06-13 20:20:40 +0000414 ------------------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000415 Option Type Setting Meaning
416 --------- -------- -------------- ---------------------------
417<
418 netrw_ftp variable =doesn't exist userid set by "user userid"
419 =0 userid set by "user userid"
420 =1 userid set by "userid"
421 NetReadFixup function =doesn't exist no change
422 =exists Allows user to have files
423 read via ftp automatically
424 transformed however they wish
425 by NetReadFixup()
Bram Moolenaar071d4272004-06-13 20:20:40 +0000426 g:netrw_dav_cmd variable ="cadaver"
427 g:netrw_fetch_cmd variable ="fetch -o"
428 g:netrw_ftp_cmd variable ="ftp"
429 g:netrw_http_cmd variable ="fetch -o" else if fetch is executable
430 g:netrw_http_cmd variable ="wget -O" if wget is executable
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000431 g:netrw_list_cmd variable ="ssh HOSTNAME ls -Fa"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000432 g:netrw_rcp_cmd variable ="rcp"
433 g:netrw_rsync_cmd variable ="rsync -a"
434 g:netrw_scp_cmd variable ="scp -q"
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000435 g:netrw_sftp_cmd variable ="sftp" >
436 -------------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000437<
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000438 *netrw-ftp*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000439The first two options both help with certain ftp's that give trouble otherwise.
440In order to best understand how to use these options if ftp is giving you
441troubles, a bit of discussion follows on how netrw does ftp reads.
442
443The g:netrw_..._cmd variables specify the external program to use handle
444the associated protocol (rcp, ftp, etc), plus any options.
445
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000446The g:netrw_list_cmd's HOSTNAME entry will be changed via substitution with
447whatever the current request is for a hostname.
448
449For ftp, netrw typically builds up lines of one of the following formats in a
Bram Moolenaar071d4272004-06-13 20:20:40 +0000450temporary file:
451>
452 IF g:netrw_ftp !exists or is not 1 IF g:netrw_ftp exists and is 1
453 ---------------------------------- ------------------------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000454<
455 open machine [port] open machine [port]
456 user userid password userid password
457 [g:netrw_ftpmode] password
458 get filename tempfile [g:netrw_ftpmode]
459 get filename tempfile >
460 ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000461<
462Netrw then executes the lines above by use of a filter:
463>
464 :%! {g:netrw_ftp_cmd} -i [-n]
465<
466
467where
468 g:netrw_ftp_cmd is usually "ftp",
469 -i tells ftp not to be interactive
470 -n means don't use netrc and is used for Method #3 (ftp w/o <.netrc>)
471
472If <.netrc> exists it will be used to avoid having to query the user for
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000473userid and password. The transferred file is put into a temporary file.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000474The temporary file is then read into the main editing session window that
475requested it and the temporary file deleted.
476
477If your ftp doesn't accept the "user" command and immediately just demands
478a userid, then try putting "let netrw_ftp=1" in your <.vimrc>.
479
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000480 *netrw-cadaver*
481To handle the SSL certificate dialog for untrusted servers, one may pull
482down the certificate and place it into /usr/ssl/cert.pem. This operation
483renders the server treatment as "trusted".
484
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000485 *netrw-fixup*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000486If your ftp for whatever reason generates unwanted lines (such as AUTH
487messages) you may write a NetReadFixup(tmpfile) function:
488>
489 function! NetReadFixup(method,line1,line2)
490 " a:line1: first new line in current file
491 " a:line2: last new line in current file
492 if a:method == 1 "rcp
493 elseif a:method == 2 "ftp + <.netrc>
494 elseif a:method == 3 "ftp + machine,uid,password,filename
495 elseif a:method == 4 "scp
496 elseif a:method == 5 "http/wget
497 elseif a:method == 6 "dav/cadaver
498 elseif a:method == 7 "rsync
499 elseif a:method == 8 "fetch
500 elseif a:method == 9 "sftp
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000501 else " complain
Bram Moolenaar071d4272004-06-13 20:20:40 +0000502 endif
503 endfunction
504>
505The NetReadFixup() function will be called if it exists and thus allows
506you to customize your reading process. As a further example, <netrw.vim>
507contains just such a function to handle Windows 95 ftp. For whatever
508reason, Windows 95's ftp dumps four blank lines at the end of a transfer,
509and so it is desirable to automate their removal. Here's some code taken
510from <netrw.vim> itself:
511>
512 if has("win95") && g:netrw_win95ftp
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000513 fun! NetReadFixup(method, line1, line2)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000514 if method == 3 " ftp (no <.netrc>)
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000515 let fourblanklines= line2 - 3
516 silent fourblanklines.",".line2."g/^\s*/d"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000517 endif
518 endfunction
519 endif
520>
521
522==============================================================================
Bram Moolenaard4755bb2004-09-02 19:12:26 +00005237. Directory Browser *netrw-browse* *netrw-dir* *netrw-list* *netrw-help*
Bram Moolenaar8299df92004-07-10 09:47:34 +0000524 ?..........Help....................................|netrw-help|
525 <cr>.......Browsing................................|netrw-cr|
Bram Moolenaar269ec652004-07-29 08:43:53 +0000526 <del>......Deleting Files or Directories...........|netrw-delete|
Bram Moolenaar8299df92004-07-10 09:47:34 +0000527 -..........Going Up................................|netrw--|
528 a..........Hiding Files or Directories.............|netrw-a|
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000529 b..........Bookmarking a Directory.................|netrw-b|
530 B..........Changing to a Bookmarked Directory......|netrw-B|
531 c..........Make Browsing Directory The Current Dir.|netrw-c|
532 d..........Make A New Directory....................|netrw-d|
Bram Moolenaar269ec652004-07-29 08:43:53 +0000533 D..........Deleting Files or Directories...........|netrw-D|
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000534 <c-h>......Edit File/Directory Hiding List.........|netrw-h|
Bram Moolenaar8299df92004-07-10 09:47:34 +0000535 i..........Long Listing............................|netrw-i|
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000536 <c-l>......Refreshing the Listing..................|netrw-ctrl-l|
Bram Moolenaar8299df92004-07-10 09:47:34 +0000537 o..........Browsing with a Horizontal Split........|netrw-o|
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000538 p..........Preview Window..........................|netrw-p|
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000539 q..........Listing Bookmarks and History...........|netrw-q|
Bram Moolenaar8299df92004-07-10 09:47:34 +0000540 r..........Reversing Sorting Order.................|netrw-r|
Bram Moolenaar269ec652004-07-29 08:43:53 +0000541 R..........Renaming Files or Directories...........|netrw-R|
Bram Moolenaar8299df92004-07-10 09:47:34 +0000542 s..........Selecting Sorting Style.................|netrw-s|
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000543 S..........Editing the Sorting Sequence............|netrw-S|
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000544 u..........Changing to a Predecessor Directory.....|netrw-u|
545 U..........Changing to a Successor Directory.......|netrw-U|
Bram Moolenaar8299df92004-07-10 09:47:34 +0000546 v..........Browsing with a Vertical Split..........|netrw-v|
547 x..........Customizing Browsing....................|netrw-x|
Bram Moolenaar269ec652004-07-29 08:43:53 +0000548
549QUICK REFERENCE COMMANDS TABLE *netrw-browse-cmds*
Bram Moolenaar843ee412004-06-30 16:16:41 +0000550>
Bram Moolenaar8299df92004-07-10 09:47:34 +0000551 ------- -----------
Bram Moolenaar843ee412004-06-30 16:16:41 +0000552 Command Explanation
553 ------- -----------
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000554< ? Causes Netrw to issue help
Bram Moolenaar843ee412004-06-30 16:16:41 +0000555 <cr> Netrw will enter the directory or read the file
556 <del> Netrw will attempt to remove the file/directory
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000557 d Make a directory
Bram Moolenaar843ee412004-06-30 16:16:41 +0000558 D Netrw will attempt to remove the file(s)/directory(ies)
559 R Netrw will attempt to rename the file(s)/directory(ies)
560 - Makes Netrw go up one directory
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000561 a Toggles between normal display,
562 hiding (suppress display of files matching g:netrw_list_hide)
563 showing (display only files which match g:netrw_list_hide)
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000564 c Make current browsing directory the current directory
565 <c-h> Edit file hiding list
Bram Moolenaar8299df92004-07-10 09:47:34 +0000566 i Toggles between long and short listing
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000567 <c-l> Causes Netrw to refresh the directory listing
Bram Moolenaar843ee412004-06-30 16:16:41 +0000568 o Enter the file/directory under the cursor in a new browser
569 window. A horizontal split is used.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000570 r Reverse sorting order
571 s Select sorting style: by name, time, or file size
Bram Moolenaar843ee412004-06-30 16:16:41 +0000572 v Enter the file/directory under the cursor in a new browser
573 window. A vertical split is used.
574 x Apply a function to a file.
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000575
Bram Moolenaar269ec652004-07-29 08:43:53 +0000576NETRW BROWSER VARIABLES *netrw-browse-var*
Bram Moolenaar843ee412004-06-30 16:16:41 +0000577>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000578 --- -----------
579 Var Explanation
580 --- -----------
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000581< g:netrw_alto change from above splitting to
582 below splitting by setting this
583 variable (see |netrw-o|)
584 g:netrw_altv change from left splitting to
585 right splitting by setting this
586 variable (see |netrw-v|)
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000587 g:netrw_ftp_browse_reject ftp can produce a number of errors
588 and warnings that can show up as
589 "directories" and "files" in the
590 listing. This pattern is used to
591 remove such embedded messages.
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000592 g:netrw_keepdir =1 (default) keep current directory
593 immune from the browsing directory.
594 =0 keep the current directory the
595 same as the browsing directory.
596 The browsing directory is contained in
597 b:netrw_curdir
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000598 g:netrw_list_cmd command for listing remote directories
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000599 g:netrw_longlist if =1, then long listing will be default
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000600 g:netrw_ftp_list_cmd options for passing along to ftp for
601 directory listing. Defaults:
602 unix or g:netrw_cygwin set: : "ls -lF"
603 otherwise "dir"
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000604 g:netrw_list_hide comma separated list of patterns for
605 hiding files
606 g:netrw_local_mkdir command for making a local directory
607 g:netrw_local_rmdir remove directory command (rmdir)
608 g:netrw_local_rename rename file/directory command
609 unix-default: rm win32-default: ren
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000610 g:netrw_maxfilenamelen =32 by default, selected so as to make
611 long listings fit on 80 column displays.
612 If your screen is wider, and you have
613 file/directory names longer than 32 bytes,
614 you may set this option to keep listings
615 columnar.
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000616 g:netrw_mkdir_cmd command for making a remote directory
617 g:netrw_rm_cmd command for removing files
618 g:netrw_rmdir_cmd command for removing directories
619 g:netrw_rmf_cmd command for removing softlinks
620 g:netrw_hide if true, the hiding list is used
621 g:netrw_sort_by sort by "name", "time", or "size"
622 g:netrw_sort_direction sorting direction: "normal" or "reverse"
623 g:netrw_sort_sequence when sorting by name, first sort by the
624 comma-separated pattern sequence
625 g:netrw_timefmt specify format string to strftime() (%c)
626 g:netrw_winsize specify initial size of new o/v windows
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000627
Bram Moolenaar402d2fe2005-04-15 21:00:38 +0000628INTRODUCTION TO DIRECTORY BROWSING *file-explorer*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000629
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000630Netrw supports the browsing of directories on the local system and on remote
631hosts, including generating listing directories, entering directories, editing
632files therein, deleting files/directories, making new directories, and moving
633(renaming) files and directories. The Netrw browser generally implements the
634previous explorer maps and commands for remote directories, although details
635(such as pertinent global variable names) necessarily differ.
636
637The Netrw remote file and directory browser handles two protocols: ssh and
638ftp. The protocol in the url, if it is ftp, will cause netrw to use ftp
639in its remote browsing. Any other protocol will be used for file transfers,
640but otherwise the ssh protocol will be used to do remote directory browsing.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000641
Bram Moolenaar843ee412004-06-30 16:16:41 +0000642To enter the netrw directory browser, simply attempt to read a "file" with a
643trailing slash and it will be interpreted as a request to list a directory:
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000644
645 vim [protocol]://[user@]hostname/path/
646
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000647If you'd like to avoid entering the password in for directory listings, scp,
648ssh interaction, etc, see |netrw-list-hack|.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000649
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000650REFRESHING THE LISTING *netrw-ctrl-l*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000651
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000652To refresh either a local or remote directory listing, press ctrl-l (<c-l>) or
653hit the <cr> when atop the ./ directory entry in the listing. One may also
654refresh a local directory by using ":e .".
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000655
656
657GOING UP *netrw--*
658
659To go up a directory, press - or his the <cr> when atop the ../ directory
660entry in the listing.
661
662Netrw will modify the command in *g:netrw_list_cmd* to perform the directory
Bram Moolenaar843ee412004-06-30 16:16:41 +0000663listing operation. By default the command is:
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000664
Bram Moolenaar843ee412004-06-30 16:16:41 +0000665 ssh HOSTNAME ls -FLa
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000666
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000667where the HOSTNAME becomes the [user@]hostname as requested by the attempt to
668read. Naturally, the user may override this command with whatever is
669preferred. The NetList function which implements remote directory browsing
670expects that directories will be flagged by a trailing slash.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000671
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000672
Bram Moolenaar8299df92004-07-10 09:47:34 +0000673BROWSING *netrw-cr*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000674
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000675Browsing is simple: move the cursor onto a file or directory of interest.
Bram Moolenaar843ee412004-06-30 16:16:41 +0000676Hitting the <cr> (the return key) will select the file or directory.
677Directories will themselves be listed, and files will be opened using the
678protocol given in the original read request.
679
Bram Moolenaar8299df92004-07-10 09:47:34 +0000680LONG VS SHORT LISTING *netrw-i*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000681
Bram Moolenaar8299df92004-07-10 09:47:34 +0000682The short listing format gives just the files' and directories' names.
683The long listing is either based on the "ls" command via ssh for remote
684directories or displays the filename, file size (in bytes), and the
685time and date of last modification for local directories.
686
687
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000688MAKING A NEW DIRECTORY *netrw-d*
Bram Moolenaar8299df92004-07-10 09:47:34 +0000689
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000690With the "d" map one may make a new directory either remotely (which
Bram Moolenaar8299df92004-07-10 09:47:34 +0000691depends on the global variable g:netrw_mkdir_cmd) or locally (which depends on
692the global variable g:netrw_local_mkdir). Netrw will issue a request for the
693new directory's name. A bare <CR> at that point will abort the making of the
694directory. Attempts to make a local directory that already exists (as either
695a file or a directory) will be detected, reported on, and ignored.
696
Bram Moolenaar269ec652004-07-29 08:43:53 +0000697DELETING FILES OR DIRECTORIES *netrw-delete* *netrw-D*
Bram Moolenaar843ee412004-06-30 16:16:41 +0000698
699Deleting/removing files and directories involves moving the cursor to the
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000700file/directory to be deleted and pressing "D". Directories must be empty first
701before they can be successfully removed. If the directory is a softlink to a
702directory, then netrw will make two requests to remove the directory before
703succeeding. Netrw will ask for confirmation before doing the removal(s).
704You may select a range of lines with the "V" command (visual selection),
705and then pressing "D".
Bram Moolenaar843ee412004-06-30 16:16:41 +0000706
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000707 *g:netrw_rm_cmd*
708The g:netrw_rm_cmd, g:netrw_rmf_cmd, and g:netrw_rmdir_cmd variables are used
709to control the attempts to remove files and directories. The g:netrw_rm_cmd
710is used with files, and its default value is:
Bram Moolenaar843ee412004-06-30 16:16:41 +0000711
712 g:netrw_rm_cmd: ssh HOSTNAME rm
713
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000714 *g:netrw_rmdir_cmd*
715The g:netrw_rmdir_cmd variable is used to support the removal of directories.
716Its default value is:
Bram Moolenaar843ee412004-06-30 16:16:41 +0000717
718 g:netrw_rmdir_cmd: ssh HOSTNAME rmdir
719
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000720 *g:netrw_rmf_cmd*
Bram Moolenaar843ee412004-06-30 16:16:41 +0000721If removing a directory fails with g:netrw_rmdir_cmd, netrw then will attempt
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000722to remove it again using the g:netrw_rmf_cmd variable. Its default value is:
Bram Moolenaar843ee412004-06-30 16:16:41 +0000723
724 g:netrw_rmf_cmd: ssh HOSTNAME rm -f
725
Bram Moolenaar843ee412004-06-30 16:16:41 +0000726
Bram Moolenaar8299df92004-07-10 09:47:34 +0000727RENAMING FILES OR DIRECTORIES *netrw-move* *netrw-rename* *netrw-R*
Bram Moolenaar843ee412004-06-30 16:16:41 +0000728
729Renaming/moving files and directories involves moving the cursor to the
730file/directory to be moved (renamed) and pressing "R". You will then be
731queried for where you want the file/directory to be moved. You may select a
732range of lines with the "V" command (visual selection), and then pressing "R".
733
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000734The g:netrw_rename_cmd variable is used to implement renaming. By default its
Bram Moolenaar843ee412004-06-30 16:16:41 +0000735value is:
736
737 ssh HOSTNAME mv
738
Bram Moolenaar269ec652004-07-29 08:43:53 +0000739One may rename a block of files and directories by selecting them with
740the V (|linewise-visual|).
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000741
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000742
Bram Moolenaar677ee682005-01-27 14:41:15 +0000743HIDING FILES OR DIRECTORIES *netrw-a* *g:netrw_list_hide*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000744
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000745Netrw's browsing facility allows one to use the hiding list in one of
746three ways: ignore it, hide files which match, and show only those files
747which match. The g:netrw_list_hide variable holds a comma delimited list
748of patterns (ex. \.obj) which specify the hiding list. (also see |netrw-h|)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000749
750
Bram Moolenaar269ec652004-07-29 08:43:53 +0000751EDIT FILE OR DIRECTORY HIDING LIST *netrw-h*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000752
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000753The "<ctrl-h>" map brings up a requestor allowing the user to change the
Bram Moolenaar269ec652004-07-29 08:43:53 +0000754file/directory hiding list. The hiding list consists of one or more patterns
755delimited by commas. Files and/or directories satisfying these patterns will
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000756either be hidden (ie. not shown) or be the only ones displayed (see |netrw-a|).
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000757
758
759BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o*
760
Bram Moolenaar269ec652004-07-29 08:43:53 +0000761Normally one enters a file or directory using the <cr>. However, the "o" map
762allows one to open a new window to hold the new directory listing or file. A
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000763horizontal split is used. (for vertical splitting, see |netrw-v|)
764
765Normally, the o key splits the window horizontally with the new window
766and cursor at the top. To change to splitting the window horizontally
767with the new window and cursor at the bottom, have
768
769 let g:netrw_alto = 1
770
771in your <.vimrc>.
772
773PREVIEW WINDOW
774
775One may use a preview window (currently only for local browsing) by using
776the "p" key when the cursor is atop the desired filename to be previewed.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000777
778
779SELECTING SORTING STYLE *netrw-s*
780
781One may select the sorting style by name, time, or (file) size. The
782"s" map allows one to circulate among the three choices; the directory
783listing will automatically be refreshed to reflect the selected style.
784
785
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000786EDITING THE SORTING SEQUENCE *netrw-S*
787
788When "Sorted by" is name, one may specify priority via the sorting
789sequence (g:netrw_sort_sequence). The sorting sequence typically
790prioritizes the name-listing by suffix, although any pattern will do.
791Patterns are delimited by commas. The default sorting sequence is:
792>
793 /$,*,\.bak$,\.o$,\.h$,\.info$,\.swp$,\.obj$
794<
795The lone * is where all filenames not covered by one of the other
796patterns will end up. One may change the sorting sequence by modifying
797the g:netrw_sort_sequence variable (either manually or in your <.vimrc>)
798or by using the "S" map.
799
800
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000801REVERSING SORTING ORDER *netrw-r*
802
803One may toggle between normal and reverse sorting order by pressing the
804"r" key.
805
806
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000807CHANGING TO A PREDECESSOR DIRECTORY *netrw-u*
808
809Every time you change to a new directory (new for the current session),
810netrw will save the directory in a recently-visited directory history
811list (unless g:netrw_dirhistmax is zero; by default, its ten). With the
812"u" map, one can change to an earlier directory (predecessor). To do
813the opposite, see |netrw-U|.
814
815
816CHANGING TO A SUCCESSOR DIRECTORY *netrw-U*
817
818With the "U" map, one can change to a later directory (successor).
819This map is the opposite of the "u" map. (see |netrw-u|) Use the
820q map to list both the bookmarks and history. (see |netrw-q|)
821
822
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000823BROWSING WITH A VERTICALLY SPLIT WINDOW *netrw-v*
824
825Normally one enters a file or directory using the <cr>. However, the "v"
826map allows one to open a new window to hold the new directory listing or
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000827file. A vertical split is used. (for horizontal splitting, see |netrw-o|)
828
829Normally, the v key splits the window vertically with the new window
830and cursor at the left. To change to splitting the window vertically
831with the new window and cursor at the right, have
832
833 let g:netrw_altv = 1
834
835in your <.vimrc>.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000836
837
838CUSTOMIZING BROWSING WITH A USER FUNCTION *netrw-x*
839
840One may "enter" a file with a special handler, thereby firing up a browser or
841other application, for example, on a file by hitting the "x" key. Presumably
842one could write handlers that would start OpenOffice programs (oowriter), etc,
843based on the file's extension coupled with the user's hitting the "x" key atop
844the file.
845
846The Netrw executor applies a user-defined function to a file, based on its
847extension. Of course, the handler function must exist for it to be called!
848>
849 Ex. mypgm.html x ->
850 NetrwFileHandler_html("scp://user@host/some/path/mypgm.html")
851<
852See the <plugin/NetrwFileHandlers.vim> for an example of how to handle an html
853file with mozilla.
854
855
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000856MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-c* *netrw-curdir*
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000857
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000858By default, g:netrw_keepdir is 1. This setting means that the current
859directory will not track the browsing directory. However, setting
860g:netrw_keepdir to 0 (say, in your <.vimrc>) will tell netrw to have the
861currently browsed directory be the current directory.
862
863With the default setting for g:netrw_keepdir, in order to make the two
864directories the same, use the "c" map (just type c). That map will set
865the current directory to the current browsing directory.
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000866
867
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000868BOOKMARKING A DIRECTORY *netrw-b* *netrw-bookmark* *netrw-bookmarks*
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000869
870One may easily "bookmark" a directory by using
871
872 {cnt}b
873
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000874Any count may be used. One may use viminfo's "!" option to retain bookmarks
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000875between vim sessions. See |netrw-B| for how to return to a bookmark and
876|netrw-q| for how to list them.
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000877
878
879CHANGING TO A BOOKMARKED DIRECTORY *netrw-B*
880
881To change directory back to a bookmarked directory, use
882
883 {cnt}B
884
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000885Any count may be used to reference any of the bookmarks. See |netrw-b|
886for how to bookmark a directory and |netrw-q| for how to list them.
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000887
888
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000889LISTING BOOKMARKS AND HISTORY *netrw-q*
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000890
Bram Moolenaar293ee4d2004-12-09 21:34:53 +0000891Pressing "q" will list the bookmarked directories and directory traversal
892history (query). (see |netrw-b|, |netrw-B|, |netrw-u|, and |netrw-U|)
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000893
894
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000895IMPROVING DIRECTORY BROWSING *netrw-list-hack*
896
897Especially with the remote directory browser, constantly entering the password
898is tedious.
899
Bram Moolenaar843ee412004-06-30 16:16:41 +0000900For Linux/Unix systems, I suggest looking into
901
902 http://hacks.oreilly.com/pub/h/66
903
904It gives a tip for setting up password-less use of ssh and scp, and discusses
905the associated security issues.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000906
907
908==============================================================================
Bram Moolenaarc0197e22004-09-13 20:26:32 +00009098. Problems and Fixes *netrw-problems*
910
911 (This section is likely to grow as I get feedback)
912 (also see |netrw-debug|)
913
914 P1. I use windows 95, and my ftp dumps four blank lines at the
915 end of every read.
916
917 See |netrw-fixup|, and put the following into your
918 <.vimrc> file:
919
920 let g:netrw_win95ftp= 1
921
922
923
924 P2. I use windows, and my network browsing with ftp doesn't sort by
925 time or size
926
927 Windows' ftp has a minimal support for ls (ie. it doesn't
928 accept sorting options). It doesn't support the -F which
929 gives an explanatory character (ABC/ for "ABC is a directory").
930 Netrw uses dir to get its short and long listings. If you
931 think your ftp does support a full-up ls, put the following
932 into your <.vimrc>:
933
934 let g:netrw_ftp_list_cmd= "ls -lF"
935
936 Alternatively, if you have cygwin on your Windows box, put
937 into your <.vimrc>:
938
939 let g:netrw_cygwin= 1
940
941 P3. I tried rcp://user@host/ (or protocol other than ftp) and netrw
942 used ssh! That wasn't what I asked for...
943
944 Netrw has two methods for browsing remote directories: ssh
945 and ftp. Unless you specify ftp specifically, ssh is used.
946 When it comes time to do download a file (not just a directory
947 listing), netrw will use the given protocol to do so.
948
949 P4. I would like long listings to be the default.
950
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000951 let g:netrw_longlist=1
952
953 Check out |netrw-browse-var| for more customizations that
954 you can set.
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000955
956 P5. My times come up oddly in local browsing
957
958 Does your system's strftime() accept the "%c" to yield dates
959 such as "Sun Apr 27 11:49:23 1997"? If not, do a "man strftime"
960 and find out what option should be used. Then put it into
961 your <.vimrc>:
962 let g:netrw_timefmt= "%X" (where X is the option)
963
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000964 P6. I want my current directory to track my browsing.
965 How do I do that?
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000966
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000967 let g:netrw_keepdir= 0
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000968
969
970==============================================================================
9719. Debugging *netrw-debug*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000972
973The <netrw.vim> script is typically available as:
974
975 /usr/local/share/vim/vim6x/plugin/netrw.vim
976
977which is loaded automatically at startup (assuming :set nocp).
978
979 1. Get the <Decho.vim> script, available as:
980
981 http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_scripts
982 as "Decho, a vimL debugging aid"
983 or
984 http://vim.sourceforge.net/scripts/script.php?script_id=120
985
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000986 and put it into your local plugin directory.
987
988 2. <Decho.vim> itself needs the <cecutil.vim> script, so you'll need
989 to put it into your .vim/plugin, too. You may obtain it from:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000990
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000991 http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs
992 as "DrC's Utilities"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000993
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000994 3. Edit the <netrw.vim> file by typing:
995
996 vim netrw.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000997 :DechoOn
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000998 :wq
Bram Moolenaar071d4272004-06-13 20:20:40 +0000999
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001000 To restore to normal non-debugging behavior, edit <netrw.vim>
1001 by typing
Bram Moolenaar071d4272004-06-13 20:20:40 +00001002
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001003 vim netrw.vim
1004 :DechoOff
1005 :wq
1006
1007 This command, provided by <Decho.vim>, will comment out all
1008 Decho-debugging statements (Dfunc(), Dret(), Decho(), Dredir()).
1009
1010 4. Then bring up vim and attempt a transfer. A set of messages
Bram Moolenaar071d4272004-06-13 20:20:40 +00001011 should appear concerning the steps that <netrw.vim> took in
1012 attempting to read/write your file over the network. Please
1013 send that information to <netrw.vim>'s maintainer,
1014
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001015 NdrOchip at ScampbellPfamily.AbizM - NOSPAM
Bram Moolenaar071d4272004-06-13 20:20:40 +00001016
1017==============================================================================
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000101810. History *netrw-history*
Bram Moolenaar071d4272004-06-13 20:20:40 +00001019
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001020 v52: * nonumber'ing now set for browsing buffers
1021 * when the hiding list hid all files, error messages ensued. Fixed
1022 * when browsing, swf is set, but directory is not set, when netrw
1023 was attempting to restore options, vim wanted to save a swapfile
1024 to a local directory using an url-style path. Fixed
1025 v51: * cygwin detection now automated (using windows and &shell is bash)
1026 * customizable browser "file" rejection patterns
1027 * directory history
1028 * :[range]w url now supported (ie. netrw has a FileWriteCmd event)
1029 * error messages have a "Press <cr> to continue" to allow them
1030 to be seen
1031 * directory browser displays no longer bother the swapfile
1032 * u/U commands to go up and down the history stack
1033 * history stack may be saved with viminfo with its "!" option
1034 * bugfixes associated with unwanted [No Files] entries
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001035 v50: * directories now displayed using buftype=nofile; should keep the
1036 directory names as-is
1037 * attempts to remove empty "[No File]" buffers leftover
1038 from :file ..name.. commands
1039 * bugfix: a "caps-lock" editing difficulty left in v49 was fixed
1040 * syntax highlighting for "Showing:" the hiding list included
1041 * bookmarks can now be retained if "!" is in the viminfo option
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001042 v49: * will use ftp for http://.../ browsing v48:
1043 * One may use ftp to do remote host file browsing
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001044 * (windows and !cygwin) remote browsing with ftp can now use
1045 the "dir" command internally to provide listings
1046 * g:netrw_keepdir now allows one to keep the initial current
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001047 directory as the current directory (normally the local file
1048 browser makes the currently viewed directory the current
1049 directory)
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001050 * g:netrw_alto and g:netrw_altv now support alternate placement
1051 of windows started with o or v
1052 * Nread ? and Nwrite ? now uses echomsg (instead of echo) so
1053 :messages can repeat showing the help
1054 * bugfix: avoids problems with partial matches of directory names
1055 to prior buffers with longer names
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001056 * one can suppress error messages with g:netrw_quiet ctrl-h used
1057 * instead of <Leader>h for editing hiding list one may edit the
1058 * sorting sequence with the S map now allows confirmation of
1059 * deletion with [y(es) n(o) a(ll) q(uit)] the "x" map now handles
1060 * special file viewing with:
1061 (windows) rundll32 url.dll (gnome) gnome-open (kde)
1062 kfmclient If none of these are on the executable path, then
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001063 NetrwFileHandlers.vim is used.
1064 * directory bookmarking during both local and remote browsing
1065 implemented
1066 * one may view all, use the hiding list to suppress, or use the
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001067 hiding list to show-only remote and local file/directory
1068 listings
1069 * improved unusual file and directory name handling preview
1070 * window support
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001071 v47: * now handles local directory browsing.
1072 v46: * now handles remote directory browsing
1073 * g:netrw_silent (if 1) will cause all transfers to be silent
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001074 v45: * made the [user@]hostname:path form a bit more restrictive to
1075 better handle errors in using protocols (e.g. scp:usr@host:file
1076 was being recognized as an rcp request) v44: * changed from
1077 "rsync -a" to just "rsync"
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001078 * somehow an editing error messed up the test to recognize
1079 use of the fetch method for NetRead.
1080 * more debugging statements included
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001081 v43: * moved "Explanation" comments to <pi_netrw.txt> help file as
1082 "Network Reference" (|netrw-ref|)
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001083 * <netrw.vim> now uses Dfunc() Decho() and Dret() for debugging
1084 * removed superfluous NetRestorePosn() calls
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001085 v42: * now does BufReadPre and BufReadPost events on file:///* and
1086 file://localhost/* v41: * installed file:///* and
1087 file://localhost/* handling v40: * prevents redraw when a
1088 protocol error occurs so that the user may see it v39: * sftp
1089 support v38: * Now uses NetRestorePosn() calls with
1090 Nread/Nwrite commands
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001091 * Temporary files now removed via bwipe! instead of bwipe
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001092 (thanks to Dave Roberts) v37: * Claar's modifications which
1093 test if ftp is successful, otherwise give an error message
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001094 * After a read, the alternate file was pointing to the temp file.
1095 The temp file buffer is now wiped out.
1096 * removed silent from transfer methods so user can see what's
1097 happening
Bram Moolenaar071d4272004-06-13 20:20:40 +00001098
1099
1100==============================================================================
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000110111. Credits *netrw-credits*
Bram Moolenaar071d4272004-06-13 20:20:40 +00001102
1103 Vim editor by Bram Moolenaar (Thanks, Bram!)
1104 dav support by C Campbell
1105 fetch support by Bram Moolenaar and C Campbell
1106 ftp support by C Campbell <NdrOchip@ScampbellPfamily.AbizM> - NOSPAM
1107 http support by Bram Moolenaar <bram@moolenaar.net>
1108 rcp
1109 rsync support by C Campbell (suggested by Erik Warendorph)
1110 scp support by raf <raf@comdyn.com.au>
1111 sftp support by C Campbell
1112
1113 inputsecret(), BufReadCmd, BufWriteCmd contributed by C Campbell
1114
1115 Jérôme Augé -- also using new buffer method with ftp+.netrc
1116 Bram Moolenaar -- obviously vim itself, :e and v:cmdarg use, fetch,...
1117 Yasuhiro Matsumoto -- pointing out undo+0r problem and a solution
1118 Erik Warendorph -- for several suggestions (g:netrw_..._cmd
1119 variables, rsync etc)
1120 Doug Claar -- modifications to test for success with ftp operation
1121
1122==============================================================================
1123 vim:tw=78:ts=8:ft=help:norl: