blob: 47d0d7e7eb63cf89df19311fb2560043d7254bad [file] [log] [blame]
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001*pi_netrw.txt For Vim version 6.2. Last change: Sep 13, 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.
180Unfortunately, some implementations are noisy (ie., add junk to the end
181of the file). Thus, concerned users may decide to write a NetReadFixup()
182function that will clean up after reading with their ftp. Some Unix systems
183(ie., FreeBSD) provide a utility called "fetch" which uses the ftp protocol
184but 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
189transparently; ie.
190>
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.
201The latter will be done "silently"; ie. asterisks will show up instead of
202the 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 Moolenaard4755bb2004-09-02 19:12:26 +0000539 q..........Listing Bookmarks.......................|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 Moolenaar8299df92004-07-10 09:47:34 +0000544 v..........Browsing with a Vertical Split..........|netrw-v|
545 x..........Customizing Browsing....................|netrw-x|
Bram Moolenaar269ec652004-07-29 08:43:53 +0000546
547QUICK REFERENCE COMMANDS TABLE *netrw-browse-cmds*
Bram Moolenaar843ee412004-06-30 16:16:41 +0000548>
Bram Moolenaar8299df92004-07-10 09:47:34 +0000549 ------- -----------
Bram Moolenaar843ee412004-06-30 16:16:41 +0000550 Command Explanation
551 ------- -----------
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000552< ? Causes Netrw to issue help
Bram Moolenaar843ee412004-06-30 16:16:41 +0000553 <cr> Netrw will enter the directory or read the file
554 <del> Netrw will attempt to remove the file/directory
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000555 d Make a directory
Bram Moolenaar843ee412004-06-30 16:16:41 +0000556 D Netrw will attempt to remove the file(s)/directory(ies)
557 R Netrw will attempt to rename the file(s)/directory(ies)
558 - Makes Netrw go up one directory
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000559 a Toggles between normal display,
560 hiding (suppress display of files matching g:netrw_list_hide)
561 showing (display only files which match g:netrw_list_hide)
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000562 c Make current browsing directory the current directory
563 <c-h> Edit file hiding list
Bram Moolenaar8299df92004-07-10 09:47:34 +0000564 i Toggles between long and short listing
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000565 <c-l> Causes Netrw to refresh the directory listing
Bram Moolenaar843ee412004-06-30 16:16:41 +0000566 o Enter the file/directory under the cursor in a new browser
567 window. A horizontal split is used.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000568 r Reverse sorting order
569 s Select sorting style: by name, time, or file size
Bram Moolenaar843ee412004-06-30 16:16:41 +0000570 v Enter the file/directory under the cursor in a new browser
571 window. A vertical split is used.
572 x Apply a function to a file.
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000573
Bram Moolenaar269ec652004-07-29 08:43:53 +0000574NETRW BROWSER VARIABLES *netrw-browse-var*
Bram Moolenaar843ee412004-06-30 16:16:41 +0000575>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000576 --- -----------
577 Var Explanation
578 --- -----------
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000579< g:netrw_alto change from above splitting to
580 below splitting by setting this
581 variable (see |netrw-o|)
582 g:netrw_altv change from left splitting to
583 right splitting by setting this
584 variable (see |netrw-v|)
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000585 g:netrw_ftp_browse_reject ftp can produce a number of errors
586 and warnings that can show up as
587 "directories" and "files" in the
588 listing. This pattern is used to
589 remove such embedded messages.
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000590 g:netrw_keepdir =1 (default) keep current directory
591 immune from the browsing directory.
592 =0 keep the current directory the
593 same as the browsing directory.
594 The browsing directory is contained in
595 b:netrw_curdir
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000596 g:netrw_list_cmd command for listing remote directories
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000597 g:netrw_longlist if =1, then long listing will be default
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000598 g:netrw_ftp_list_cmd options for passing along to ftp for
599 directory listing. Defaults:
600 unix or g:netrw_cygwin set: : "ls -lF"
601 otherwise "dir"
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000602 g:netrw_list_hide comma separated list of patterns for
603 hiding files
604 g:netrw_local_mkdir command for making a local directory
605 g:netrw_local_rmdir remove directory command (rmdir)
606 g:netrw_local_rename rename file/directory command
607 unix-default: rm win32-default: ren
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000608 g:netrw_maxfilenamelen =32 by default, selected so as to make
609 long listings fit on 80 column displays.
610 If your screen is wider, and you have
611 file/directory names longer than 32 bytes,
612 you may set this option to keep listings
613 columnar.
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000614 g:netrw_mkdir_cmd command for making a remote directory
615 g:netrw_rm_cmd command for removing files
616 g:netrw_rmdir_cmd command for removing directories
617 g:netrw_rmf_cmd command for removing softlinks
618 g:netrw_hide if true, the hiding list is used
619 g:netrw_sort_by sort by "name", "time", or "size"
620 g:netrw_sort_direction sorting direction: "normal" or "reverse"
621 g:netrw_sort_sequence when sorting by name, first sort by the
622 comma-separated pattern sequence
623 g:netrw_timefmt specify format string to strftime() (%c)
624 g:netrw_winsize specify initial size of new o/v windows
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000625
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000626INTRODUCTION TO DIRECTORY BROWSING
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000627
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000628Netrw supports the browsing of directories on the local system and on remote
629hosts, including generating listing directories, entering directories, editing
630files therein, deleting files/directories, making new directories, and moving
631(renaming) files and directories. The Netrw browser generally implements the
632previous explorer maps and commands for remote directories, although details
633(such as pertinent global variable names) necessarily differ.
634
635The Netrw remote file and directory browser handles two protocols: ssh and
636ftp. The protocol in the url, if it is ftp, will cause netrw to use ftp
637in its remote browsing. Any other protocol will be used for file transfers,
638but otherwise the ssh protocol will be used to do remote directory browsing.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000639
Bram Moolenaar843ee412004-06-30 16:16:41 +0000640To enter the netrw directory browser, simply attempt to read a "file" with a
641trailing slash and it will be interpreted as a request to list a directory:
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000642
643 vim [protocol]://[user@]hostname/path/
644
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000645If you'd like to avoid entering the password in for directory listings, scp,
646ssh interaction, etc, see |netrw-list-hack|.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000647
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000648REFRESHING THE LISTING *netrw-ctrl-l*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000649
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000650To refresh either a local or remote directory listing, press ctrl-l (<c-l>) or
651hit the <cr> when atop the ./ directory entry in the listing. One may also
652refresh a local directory by using ":e .".
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000653
654
655GOING UP *netrw--*
656
657To go up a directory, press - or his the <cr> when atop the ../ directory
658entry in the listing.
659
660Netrw will modify the command in *g:netrw_list_cmd* to perform the directory
Bram Moolenaar843ee412004-06-30 16:16:41 +0000661listing operation. By default the command is:
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000662
Bram Moolenaar843ee412004-06-30 16:16:41 +0000663 ssh HOSTNAME ls -FLa
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000664
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000665where the HOSTNAME becomes the [user@]hostname as requested by the attempt to
666read. Naturally, the user may override this command with whatever is
667preferred. The NetList function which implements remote directory browsing
668expects that directories will be flagged by a trailing slash.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000669
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000670
Bram Moolenaar8299df92004-07-10 09:47:34 +0000671BROWSING *netrw-cr*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000672
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000673Browsing is simple: move the cursor onto a file or directory of interest.
Bram Moolenaar843ee412004-06-30 16:16:41 +0000674Hitting the <cr> (the return key) will select the file or directory.
675Directories will themselves be listed, and files will be opened using the
676protocol given in the original read request.
677
Bram Moolenaar8299df92004-07-10 09:47:34 +0000678LONG VS SHORT LISTING *netrw-i*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000679
Bram Moolenaar8299df92004-07-10 09:47:34 +0000680The short listing format gives just the files' and directories' names.
681The long listing is either based on the "ls" command via ssh for remote
682directories or displays the filename, file size (in bytes), and the
683time and date of last modification for local directories.
684
685
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000686MAKING A NEW DIRECTORY *netrw-d*
Bram Moolenaar8299df92004-07-10 09:47:34 +0000687
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000688With the "d" map one may make a new directory either remotely (which
Bram Moolenaar8299df92004-07-10 09:47:34 +0000689depends on the global variable g:netrw_mkdir_cmd) or locally (which depends on
690the global variable g:netrw_local_mkdir). Netrw will issue a request for the
691new directory's name. A bare <CR> at that point will abort the making of the
692directory. Attempts to make a local directory that already exists (as either
693a file or a directory) will be detected, reported on, and ignored.
694
Bram Moolenaar269ec652004-07-29 08:43:53 +0000695DELETING FILES OR DIRECTORIES *netrw-delete* *netrw-D*
Bram Moolenaar843ee412004-06-30 16:16:41 +0000696
697Deleting/removing files and directories involves moving the cursor to the
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000698file/directory to be deleted and pressing "D". Directories must be empty first
699before they can be successfully removed. If the directory is a softlink to a
700directory, then netrw will make two requests to remove the directory before
701succeeding. Netrw will ask for confirmation before doing the removal(s).
702You may select a range of lines with the "V" command (visual selection),
703and then pressing "D".
Bram Moolenaar843ee412004-06-30 16:16:41 +0000704
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000705 *g:netrw_rm_cmd*
706The g:netrw_rm_cmd, g:netrw_rmf_cmd, and g:netrw_rmdir_cmd variables are used
707to control the attempts to remove files and directories. The g:netrw_rm_cmd
708is used with files, and its default value is:
Bram Moolenaar843ee412004-06-30 16:16:41 +0000709
710 g:netrw_rm_cmd: ssh HOSTNAME rm
711
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000712 *g:netrw_rmdir_cmd*
713The g:netrw_rmdir_cmd variable is used to support the removal of directories.
714Its default value is:
Bram Moolenaar843ee412004-06-30 16:16:41 +0000715
716 g:netrw_rmdir_cmd: ssh HOSTNAME rmdir
717
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000718 *g:netrw_rmf_cmd*
Bram Moolenaar843ee412004-06-30 16:16:41 +0000719If removing a directory fails with g:netrw_rmdir_cmd, netrw then will attempt
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000720to remove it again using the g:netrw_rmf_cmd variable. Its default value is:
Bram Moolenaar843ee412004-06-30 16:16:41 +0000721
722 g:netrw_rmf_cmd: ssh HOSTNAME rm -f
723
Bram Moolenaar843ee412004-06-30 16:16:41 +0000724
Bram Moolenaar8299df92004-07-10 09:47:34 +0000725RENAMING FILES OR DIRECTORIES *netrw-move* *netrw-rename* *netrw-R*
Bram Moolenaar843ee412004-06-30 16:16:41 +0000726
727Renaming/moving files and directories involves moving the cursor to the
728file/directory to be moved (renamed) and pressing "R". You will then be
729queried for where you want the file/directory to be moved. You may select a
730range of lines with the "V" command (visual selection), and then pressing "R".
731
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000732The g:netrw_rename_cmd variable is used to implement renaming. By default its
Bram Moolenaar843ee412004-06-30 16:16:41 +0000733value is:
734
735 ssh HOSTNAME mv
736
Bram Moolenaar269ec652004-07-29 08:43:53 +0000737One may rename a block of files and directories by selecting them with
738the V (|linewise-visual|).
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000739
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000740
Bram Moolenaar269ec652004-07-29 08:43:53 +0000741HIDING FILES OR DIRECTORIES *g:netrw-a* *g:netrw_list_hide*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000742
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000743Netrw's browsing facility allows one to use the hiding list in one of
744three ways: ignore it, hide files which match, and show only those files
745which match. The g:netrw_list_hide variable holds a comma delimited list
746of patterns (ex. \.obj) which specify the hiding list. (also see |netrw-h|)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000747
748
Bram Moolenaar269ec652004-07-29 08:43:53 +0000749EDIT FILE OR DIRECTORY HIDING LIST *netrw-h*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000750
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000751The "<ctrl-h>" map brings up a requestor allowing the user to change the
Bram Moolenaar269ec652004-07-29 08:43:53 +0000752file/directory hiding list. The hiding list consists of one or more patterns
753delimited by commas. Files and/or directories satisfying these patterns will
754be hidden (ie. not shown).
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000755
756
757BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o*
758
Bram Moolenaar269ec652004-07-29 08:43:53 +0000759Normally one enters a file or directory using the <cr>. However, the "o" map
760allows one to open a new window to hold the new directory listing or file. A
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000761horizontal split is used. (for vertical splitting, see |netrw-v|)
762
763Normally, the o key splits the window horizontally with the new window
764and cursor at the top. To change to splitting the window horizontally
765with the new window and cursor at the bottom, have
766
767 let g:netrw_alto = 1
768
769in your <.vimrc>.
770
771PREVIEW WINDOW
772
773One may use a preview window (currently only for local browsing) by using
774the "p" key when the cursor is atop the desired filename to be previewed.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000775
776
777SELECTING SORTING STYLE *netrw-s*
778
779One may select the sorting style by name, time, or (file) size. The
780"s" map allows one to circulate among the three choices; the directory
781listing will automatically be refreshed to reflect the selected style.
782
783
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000784EDITING THE SORTING SEQUENCE *netrw-S*
785
786When "Sorted by" is name, one may specify priority via the sorting
787sequence (g:netrw_sort_sequence). The sorting sequence typically
788prioritizes the name-listing by suffix, although any pattern will do.
789Patterns are delimited by commas. The default sorting sequence is:
790>
791 /$,*,\.bak$,\.o$,\.h$,\.info$,\.swp$,\.obj$
792<
793The lone * is where all filenames not covered by one of the other
794patterns will end up. One may change the sorting sequence by modifying
795the g:netrw_sort_sequence variable (either manually or in your <.vimrc>)
796or by using the "S" map.
797
798
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000799REVERSING SORTING ORDER *netrw-r*
800
801One may toggle between normal and reverse sorting order by pressing the
802"r" key.
803
804
805BROWSING WITH A VERTICALLY SPLIT WINDOW *netrw-v*
806
807Normally one enters a file or directory using the <cr>. However, the "v"
808map allows one to open a new window to hold the new directory listing or
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000809file. A vertical split is used. (for horizontal splitting, see |netrw-o|)
810
811Normally, the v key splits the window vertically with the new window
812and cursor at the left. To change to splitting the window vertically
813with the new window and cursor at the right, have
814
815 let g:netrw_altv = 1
816
817in your <.vimrc>.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000818
819
820CUSTOMIZING BROWSING WITH A USER FUNCTION *netrw-x*
821
822One may "enter" a file with a special handler, thereby firing up a browser or
823other application, for example, on a file by hitting the "x" key. Presumably
824one could write handlers that would start OpenOffice programs (oowriter), etc,
825based on the file's extension coupled with the user's hitting the "x" key atop
826the file.
827
828The Netrw executor applies a user-defined function to a file, based on its
829extension. Of course, the handler function must exist for it to be called!
830>
831 Ex. mypgm.html x ->
832 NetrwFileHandler_html("scp://user@host/some/path/mypgm.html")
833<
834See the <plugin/NetrwFileHandlers.vim> for an example of how to handle an html
835file with mozilla.
836
837
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000838MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-c* *netrw-curdir*
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000839
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000840By default, g:netrw_keepdir is 1. This setting means that the current
841directory will not track the browsing directory. However, setting
842g:netrw_keepdir to 0 (say, in your <.vimrc>) will tell netrw to have the
843currently browsed directory be the current directory.
844
845With the default setting for g:netrw_keepdir, in order to make the two
846directories the same, use the "c" map (just type c). That map will set
847the current directory to the current browsing directory.
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000848
849
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000850BOOKMARKING A DIRECTORY *netrw-b* *netrw-bookmark* *netrw-bookmarks*
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000851
852One may easily "bookmark" a directory by using
853
854 {cnt}b
855
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000856Any count may be used. One may use viminfo's "!" option to retain bookmarks
857between vim sessions.
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000858
859
860CHANGING TO A BOOKMARKED DIRECTORY *netrw-B*
861
862To change directory back to a bookmarked directory, use
863
864 {cnt}B
865
866Any count may be used.
867
868
869LISTING BOOKMARKS *netrw-q*
870
871Pressing "q" will list the bookmarked directories. (query)
872
873
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000874IMPROVING DIRECTORY BROWSING *netrw-list-hack*
875
876Especially with the remote directory browser, constantly entering the password
877is tedious.
878
Bram Moolenaar843ee412004-06-30 16:16:41 +0000879For Linux/Unix systems, I suggest looking into
880
881 http://hacks.oreilly.com/pub/h/66
882
883It gives a tip for setting up password-less use of ssh and scp, and discusses
884the associated security issues.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000885
886
887==============================================================================
Bram Moolenaarc0197e22004-09-13 20:26:32 +00008888. Problems and Fixes *netrw-problems*
889
890 (This section is likely to grow as I get feedback)
891 (also see |netrw-debug|)
892
893 P1. I use windows 95, and my ftp dumps four blank lines at the
894 end of every read.
895
896 See |netrw-fixup|, and put the following into your
897 <.vimrc> file:
898
899 let g:netrw_win95ftp= 1
900
901
902
903 P2. I use windows, and my network browsing with ftp doesn't sort by
904 time or size
905
906 Windows' ftp has a minimal support for ls (ie. it doesn't
907 accept sorting options). It doesn't support the -F which
908 gives an explanatory character (ABC/ for "ABC is a directory").
909 Netrw uses dir to get its short and long listings. If you
910 think your ftp does support a full-up ls, put the following
911 into your <.vimrc>:
912
913 let g:netrw_ftp_list_cmd= "ls -lF"
914
915 Alternatively, if you have cygwin on your Windows box, put
916 into your <.vimrc>:
917
918 let g:netrw_cygwin= 1
919
920 P3. I tried rcp://user@host/ (or protocol other than ftp) and netrw
921 used ssh! That wasn't what I asked for...
922
923 Netrw has two methods for browsing remote directories: ssh
924 and ftp. Unless you specify ftp specifically, ssh is used.
925 When it comes time to do download a file (not just a directory
926 listing), netrw will use the given protocol to do so.
927
928 P4. I would like long listings to be the default.
929
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000930 let g:netrw_longlist=1
931
932 Check out |netrw-browse-var| for more customizations that
933 you can set.
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000934
935 P5. My times come up oddly in local browsing
936
937 Does your system's strftime() accept the "%c" to yield dates
938 such as "Sun Apr 27 11:49:23 1997"? If not, do a "man strftime"
939 and find out what option should be used. Then put it into
940 your <.vimrc>:
941 let g:netrw_timefmt= "%X" (where X is the option)
942
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000943 P6. I want my current directory to track my browsing.
944 How do I do that?
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000945
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000946 let g:netrw_keepdir= 0
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000947
948
949==============================================================================
9509. Debugging *netrw-debug*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000951
952The <netrw.vim> script is typically available as:
953
954 /usr/local/share/vim/vim6x/plugin/netrw.vim
955
956which is loaded automatically at startup (assuming :set nocp).
957
958 1. Get the <Decho.vim> script, available as:
959
960 http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_scripts
961 as "Decho, a vimL debugging aid"
962 or
963 http://vim.sourceforge.net/scripts/script.php?script_id=120
964
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000965 and put it into your local plugin directory.
966
967 2. <Decho.vim> itself needs the <cecutil.vim> script, so you'll need
968 to put it into your .vim/plugin, too. You may obtain it from:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000969
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000970 http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs
971 as "DrC's Utilities"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000972
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000973 3. Edit the <netrw.vim> file by typing:
974
975 vim netrw.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +0000976 :DechoOn
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000977 :wq
Bram Moolenaar071d4272004-06-13 20:20:40 +0000978
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000979 To restore to normal non-debugging behavior, edit <netrw.vim>
980 by typing
Bram Moolenaar071d4272004-06-13 20:20:40 +0000981
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000982 vim netrw.vim
983 :DechoOff
984 :wq
985
986 This command, provided by <Decho.vim>, will comment out all
987 Decho-debugging statements (Dfunc(), Dret(), Decho(), Dredir()).
988
989 4. Then bring up vim and attempt a transfer. A set of messages
Bram Moolenaar071d4272004-06-13 20:20:40 +0000990 should appear concerning the steps that <netrw.vim> took in
991 attempting to read/write your file over the network. Please
992 send that information to <netrw.vim>'s maintainer,
993
994 drchipNOSPAM at campbellfamily.biz - NOSPAM
995
996==============================================================================
Bram Moolenaarc0197e22004-09-13 20:26:32 +000099710. History *netrw-history*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000998
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +0000999 v50: * directories now displayed using buftype=nofile; should keep the
1000 directory names as-is
1001 * attempts to remove empty "[No File]" buffers leftover
1002 from :file ..name.. commands
1003 * bugfix: a "caps-lock" editing difficulty left in v49 was fixed
1004 * syntax highlighting for "Showing:" the hiding list included
1005 * bookmarks can now be retained if "!" is in the viminfo option
1006 v49: * will use ftp for http://.../ browsing v48: * One may use ftp to
1007 do remote host file browsing
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001008 * (windows and !cygwin) remote browsing with ftp can now use
1009 the "dir" command internally to provide listings
1010 * g:netrw_keepdir now allows one to keep the initial current
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001011 directory as the current directory (normally the local file
1012 browser makes the currently viewed directory the current
1013 directory)
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001014 * g:netrw_alto and g:netrw_altv now support alternate placement
1015 of windows started with o or v
1016 * Nread ? and Nwrite ? now uses echomsg (instead of echo) so
1017 :messages can repeat showing the help
1018 * bugfix: avoids problems with partial matches of directory names
1019 to prior buffers with longer names
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001020 * one can suppress error messages with g:netrw_quiet ctrl-h used
1021 * instead of <Leader>h for editing hiding list one may edit the
1022 * sorting sequence with the S map now allows confirmation of
1023 * deletion with [y(es) n(o) a(ll) q(uit)] the "x" map now handles
1024 * special file viewing with:
1025 (windows) rundll32 url.dll (gnome) gnome-open (kde)
1026 kfmclient If none of these are on the executable path, then
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001027 NetrwFileHandlers.vim is used.
1028 * directory bookmarking during both local and remote browsing
1029 implemented
1030 * one may view all, use the hiding list to suppress, or use the
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001031 hiding list to show-only remote and local file/directory
1032 listings
1033 * improved unusual file and directory name handling preview
1034 * window support
1035 v47: * now handles local directory browsing. v46: * now handles
1036 remote directory browsing
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001037 * g:netrw_silent (if 1) will cause all transfers to be silent'd
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001038 v45: * made the [user@]hostname:path form a bit more restrictive to
1039 better handle errors in using protocols (e.g. scp:usr@host:file
1040 was being recognized as an rcp request) v44: * changed from
1041 "rsync -a" to just "rsync"
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001042 * somehow an editing error messed up the test to recognize
1043 use of the fetch method for NetRead.
1044 * more debugging statements included
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001045 v43: * moved "Explanation" comments to <pi_netrw.txt> help file as
1046 "Network Reference" (|netrw-ref|)
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001047 * <netrw.vim> now uses Dfunc() Decho() and Dret() for debugging
1048 * removed superfluous NetRestorePosn() calls
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001049 v42: * now does BufReadPre and BufReadPost events on file:///* and
1050 file://localhost/* v41: * installed file:///* and
1051 file://localhost/* handling v40: * prevents redraw when a
1052 protocol error occurs so that the user may see it v39: * sftp
1053 support v38: * Now uses NetRestorePosn() calls with
1054 Nread/Nwrite commands
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001055 * Temporary files now removed via bwipe! instead of bwipe
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001056 (thanks to Dave Roberts) v37: * Claar's modifications which
1057 test if ftp is successful, otherwise give an error message
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001058 * After a read, the alternate file was pointing to the temp file.
1059 The temp file buffer is now wiped out.
1060 * removed silent from transfer methods so user can see what's
1061 happening
Bram Moolenaar071d4272004-06-13 20:20:40 +00001062
1063
1064==============================================================================
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000106511. Credits *netrw-credits*
Bram Moolenaar071d4272004-06-13 20:20:40 +00001066
1067 Vim editor by Bram Moolenaar (Thanks, Bram!)
1068 dav support by C Campbell
1069 fetch support by Bram Moolenaar and C Campbell
1070 ftp support by C Campbell <NdrOchip@ScampbellPfamily.AbizM> - NOSPAM
1071 http support by Bram Moolenaar <bram@moolenaar.net>
1072 rcp
1073 rsync support by C Campbell (suggested by Erik Warendorph)
1074 scp support by raf <raf@comdyn.com.au>
1075 sftp support by C Campbell
1076
1077 inputsecret(), BufReadCmd, BufWriteCmd contributed by C Campbell
1078
1079 Jérôme Augé -- also using new buffer method with ftp+.netrc
1080 Bram Moolenaar -- obviously vim itself, :e and v:cmdarg use, fetch,...
1081 Yasuhiro Matsumoto -- pointing out undo+0r problem and a solution
1082 Erik Warendorph -- for several suggestions (g:netrw_..._cmd
1083 variables, rsync etc)
1084 Doug Claar -- modifications to test for success with ftp operation
1085
1086==============================================================================
1087 vim:tw=78:ts=8:ft=help:norl: