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