blob: 5bce52c14b4b599609a63e674d7feff11f70e775 [file] [log] [blame]
Bram Moolenaar61036992005-10-12 20:54:52 +00001*pi_netrw.txt* For Vim version 7.0. Last change: Oct 03, 2005
Bram Moolenaar071d4272004-06-13 20:20:40 +00002
3 VIM REFERENCE MANUAL by Charles E. Campbell, Jr.
4
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00005
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
Bram Moolenaar83bab712005-08-01 21:58:57 +0000131. Netrw Reference......................................|netrw-ref|
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +000014 CONTROLLING EXTERNAL APPLICTIONS...................|netrw-externapp|
15 READING............................................|netrw-read|
16 WRITING............................................|netrw-write|
17 DIRECTORY LISTING..................................|netrw-dirlist|
18 CHANGING THE USERID AND PASSWORD...................|netrw-chgup|
19 VARIABLES..........................................|netrw-variables|
20 PATHS..............................................|netrw-path|
Bram Moolenaar83bab712005-08-01 21:58:57 +0000212. Network-Oriented File Transfer.......................|netrw-xfer|
22 NETRC..............................................|netrw-netrc|
23 PASSWORD...........................................|netrw-passwd|
243. Activation...........................................|netrw-activate|
254. Transparent File Transfer............................|netrw-transparent|
265. Ex Commands..........................................|netrw-ex|
276. Variables and Options................................|netrw-var|
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000287. Directory Browsing...................................|netrw-browse| {{{1
Bram Moolenaar83bab712005-08-01 21:58:57 +000029 Maps...............................................|netrw-maps|
30 Exploring..........................................|netrw-explore-cmds|
31 Quick Reference Commands Table.....................|netrw-browse-cmds|
32 Netrw Browser Variables............................|netrw-browse-var|
33 Introduction To Directory Browsing.................|netrw-browse-intro|
34 Directory Exploring Commands.......................|netrw-explore|
35 Refreshing The Listing.............................|netrw-ctrl-l|
36 Going Up...........................................|netrw--|
37 Browsing...........................................|netrw-cr|
Bram Moolenaar578b49e2005-09-10 19:22:57 +000038 Obtaining A File...................................|netrw-O|
39 Thin, Long, and Wide Listings......................|netrw-i|
Bram Moolenaar83bab712005-08-01 21:58:57 +000040 Making A New Directory.............................|netrw-d|
41 Deleting Files Or Directories......................|netrw-delete|
42 Renaming Files Or Directories......................|netrw-move|
Bram Moolenaar482aaeb2005-09-29 18:26:07 +000043 Hiding Files Or Directories........................|netrw-a|
Bram Moolenaar83bab712005-08-01 21:58:57 +000044 Edit File Or Directory Hiding List.................|netrw-h|
45 Browsing With A Horizontally Split Window..........|netrw-o|
46 Preview Window.....................................|netrw-p|
47 Selecting Sorting Style............................|netrw-s|
48 Editing The Sorting Sequence.......................|netrw-S|
49 Reversing Sorting Order............................|netrw-r|
50 Changing To A Predecessor Directory................|netrw-u|
51 Changing To A Successor Directory..................|netrw-U|
52 Browsing With A Vertically Split Window............|netrw-v|
53 Customizing Browsing With A User Function..........|netrw-x|
54 Making The Browsing Directory The Current Directory|netrw-c|
Bram Moolenaar578b49e2005-09-10 19:22:57 +000055 Bookmarking A Directory............................|netrw-b| |netrw-Nb|
56 Changing To A Bookmarked Directory.................|netrw-B| |netrw-NB|
Bram Moolenaar83bab712005-08-01 21:58:57 +000057 Listing Bookmarks And History......................|netrw-q|
Bram Moolenaar578b49e2005-09-10 19:22:57 +000058 Improving Directory Browsing.......................|netrw-listhack| }}}1
Bram Moolenaar83bab712005-08-01 21:58:57 +0000598. Problems and Fixes...................................|netrw-problems|
609. Debugging............................................|netrw-debug|
6110. History..............................................|netrw-history|
6211. Credits..............................................|netrw-credits|
Bram Moolenaar071d4272004-06-13 20:20:40 +000063
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +000064The Netrw plugin is generally sourced automatically as it is a
65|standard-plugin|. That said, to make use of netrw, one must
66have plugins available which can be done with the following
67two lines in your <.vimrc>:
Bram Moolenaar071d4272004-06-13 20:20:40 +000068
Bram Moolenaar69a7cb42004-06-20 12:51:53 +000069 set nocp " 'compatible' is not set
70 filetype plugin on " plugins are enabled
Bram Moolenaar071d4272004-06-13 20:20:40 +000071
72You can avoid loading this plugin by setting the "loaded_netrw" variable
73in your <.vimrc> file: >
74
75 :let loaded_netrw = 1
76
77{Vi does not have any of this}
78
79==============================================================================
801. Netrw Reference *netrw-ref*
81
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +000082CONTROLLING EXTERNAL APPLICTIONS *netrw-externapp*
Bram Moolenaar071d4272004-06-13 20:20:40 +000083
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +000084 Protocol Variable Default Value
85 -------- ---------------- -------------
86 dav: *g:netrw_dav_cmd* = "cadaver"
87 fetch: *g:netrw_fetch_cmd* = "fetch -o"
88 ftp: *g:netrw_ftp_cmd* = "ftp"
89 http: *g:netrw_http_cmd* = "fetch -o" if fetch is available
90 http: g:netrw_http_cmd = "wget -q -O" If wget is available
91 rcp: *g:netrw_rcp_cmd* = "rcp"
92 rsync: *g:netrw_rsync_cmd* = "rsync -a"
93 scp: *g:netrw_scp_cmd* = "scp -q"
94 sftp: *g:netrw_sftp_cmd* = "sftp"
Bram Moolenaar071d4272004-06-13 20:20:40 +000095
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +000096READING *netrw-read* *netrw-nread*
Bram Moolenaar071d4272004-06-13 20:20:40 +000097 :Nread ? give help
Bram Moolenaard4755bb2004-09-02 19:12:26 +000098 :Nread "machine:path" uses rcp
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +000099 :Nread "machine path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000100 :Nread "machine id password path" uses ftp
101 :Nread "dav://machine[:port]/path" uses cadaver
102 :Nread "fetch://[user@]machine/path" uses fetch
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000103 :Nread "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000104 :Nread "http://[user@]machine/path" uses http uses wget
105 :Nread "rcp://[user@]machine/path" uses rcp
106 :Nread "rsync://[user@]machine[:port]/path" uses rsync
107 :Nread "scp://[user@]machine[[:#]port]/path" uses scp
108 :Nread "sftp://[user@]machine/path" uses sftp
Bram Moolenaar071d4272004-06-13 20:20:40 +0000109
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000110WRITING *netrw-write* *netrw-nwrite*
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000111 :Nwrite ? give help
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000112 :Nwrite "machine:path" uses rcp
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000113 :Nwrite "machine path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000114 :Nwrite "machine id password path" uses ftp
115 :Nwrite "dav://machine[:port]/path" uses cadaver
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000116 :Nwrite "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000117 :Nwrite "rcp://[user@]machine/path" uses rcp
118 :Nwrite "rsync://[user@]machine[:port]/path" uses rsync
119 :Nwrite "scp://[user@]machine[[:#]port]/path" uses scp
120 :Nwrite "sftp://[user@]machine/path" uses sftp
Bram Moolenaar071d4272004-06-13 20:20:40 +0000121 http: not supported!
122
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000123DIRECTORY LISTING *netrw-dirlist*
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000124 :Nread [protocol]://[user]@hostname/path/
125
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000126 CHANGING USERID AND PASSWORD *netrw-chgup*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000127 Attempts to use ftp will prompt you for a user-id and a password.
128 These will be saved in g:netrw_uid and g:netrw_passwd Subsequent uses
129 of ftp will re-use those. If you need to use a different user id
130 and/or password, you'll want to call NetUserPass() first.
131
132 :NetUserPass [uid [password]] -- prompts as needed
133 :call NetUserPass() -- prompts for uid and password
134 :call NetUserPass("uid") -- prompts for password
135 :call NetUserPass("uid","password") -- sets global uid and password
136
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000137VARIABLES *netrw-variables*
138 *b:netrw_lastfile* last file Network-read/written retained on a per-buffer
139 basis (supports plain :Nw )
Bram Moolenaar071d4272004-06-13 20:20:40 +0000140
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000141 *s:netrw_line* during :Nw/NetWrite, holds current line number
142 *s:netrw_col* during :Nw/NetWrite, holds current column number
143 s:netrw_line and s:netrw_col are used to
144 restore the cursor position on writes
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000145
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000146 *g:netrw_ftp* if it doesn't exist, use default ftp
147 =0 use default ftp (uid password)
148 =1 use alternate ftp method (user uid password)
149 If you're having trouble with ftp, try changing the
150 value of this variable to see if the alternate ftp
151 method works for your setup.
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000152
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000153 *g:netrw_ftpmode* ="binary" (default)
154 ="ascii"
Bram Moolenaarf6cf9872005-08-08 22:00:59 +0000155
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000156 *g:netrw_ignorenetrc* =0 (default)
157 =1 If you have a <.netrc> file but it doesn't work and
158 you want it ignored, then set this variable as shown.
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000159
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000160 *g:netrw_uid* (ftp) user-id, retained on a per-session basis
161 *g:netrw_passwd* (ftp) password, retained on a per-session basis
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000162
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000163 *g:netrw_win95ftp* =1 if using Win95, will remove four trailing blank
164 lines that o/s's ftp "provides" on transfers
165 =0 force normal ftp behavior (no trailing line removal)
166
167 *g:netrw_cygwin* =1 assume scp under windows is from cygwin. Also
168 permits network browsing to use ls with time and
169 size sorting (default if windows)
170 =0 assume Windows' scp accepts windows-style paths
171 Network browsing uses dir instead of ls
172 This option is ignored if you're using unix
173
174 *g:netrw_use_nt_rcp* =0 don't use the rcp of WinNT, Win2000 and WinXP
175 =1 use WinNT's rcp in binary mode (default)
176
177PATHS *netrw-path*
178
179Paths to files are generally user-directory relative for most protocols.
180It is possible that some protocol will make paths relative to some
181associated directory, however.
182>
183 example: vim scp://user@host/somefile
184 example: vim scp://user@host/subdir1/subdir2/somefile
185<
186where "somefile" is the "user"'s home directory. If you wish to get a
187file using root-relative paths, use the full path:
188>
189 example: vim scp://user@host//somefile
190 example: vim scp://user@host//subdir1/subdir2/somefile
191<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000192
193==============================================================================
1942. Network-Oriented File Transfer *netrw-xfer*
195
196Network-oriented file transfer under Vim is implemented by a VimL-based script
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000197(<netrw.vim>) using plugin techniques. It currently supports both reading and
198writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch,
Bram Moolenaar071d4272004-06-13 20:20:40 +0000199dav/cadaver, rsync, or sftp.
200
201http is currently supported read-only via use of wget or fetch.
202
203<netrw.vim> is a standard plugin which acts as glue between Vim and the
204various file transfer programs. It uses autocommand events (BufReadCmd,
205FileReadCmd, BufWriteCmd) to intercept reads/writes with url-like filenames. >
206
207 ex. vim ftp://hostname/path/to/file
208<
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000209The characters preceding the colon specify the protocol to use; in the
210example, its ftp. The <netrw.vim> script then formulates a command or a
211series of commands (typically ftp) which it issues to an external program
212(ftp, scp, etc) which does the actual file transfer/protocol. Files are read
213from/written to a temporary file (under Unix/Linux, /tmp/...) which the
214<netrw.vim> script will clean up.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000215
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000216One may modify any protocol's implementing external application by setting a
217variable (ex. scp uses the variable g:netrw_scp_cmd, which is defaulted to
218"scp -q").
Bram Moolenaar071d4272004-06-13 20:20:40 +0000219
220Ftp, an old protocol, seems to be blessed by numerous implementations.
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000221Unfortunately, some implementations are noisy (ie., add junk to the end of the
222file). Thus, concerned users may decide to write a NetReadFixup() function
223that will clean up after reading with their ftp. Some Unix systems (ie.,
224FreeBSD) provide a utility called "fetch" which uses the ftp protocol but is
225not noisy and more convenient, actually, for <netrw.vim> to use.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000226Consequently, if "fetch" is executable, it will be used to do reads for
227ftp://... (and http://...) . See |netrw-var| for more about this.
228
229For rcp, scp, sftp, and http, one may use network-oriented file transfers
Bram Moolenaar83bab712005-08-01 21:58:57 +0000230transparently; ie.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000231>
232 vim rcp://[user@]machine/path
233 vim scp://[user@]machine/path
234<
235If your ftp supports <.netrc>, then it too can be just as transparently used
236if the needed triad of machine name, user id, and password are present in
237that file. Your ftp must be able to use the <.netrc> file on its own, however.
238>
239 vim ftp://[user@]machine[[:#]portnumber]/path
240<
241However, ftp will often need to query the user for the userid and password.
Bram Moolenaar83bab712005-08-01 21:58:57 +0000242The latter will be done "silently"; ie. asterisks will show up instead of
Bram Moolenaar071d4272004-06-13 20:20:40 +0000243the actually-typed-in password. Netrw will retain the userid and password
244for subsequent read/writes from the most recent transfer so subsequent
245transfers (read/write) to or from that machine will take place without
246additional prompting.
247
248 *netrw-urls*
249 +=================================+============================+============+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000250 | Reading | Writing | Uses |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000251 +=================================+============================+============+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000252 | DAV: | | |
253 | dav://host/path | | cadaver |
254 | :Nread dav://host/path | :Nwrite dav://host/path | cadaver |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000255 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000256 | FETCH: | | |
257 | fetch://[user@]host/path | | |
258 | fetch://[user@]host:http/path | Not Available | fetch |
259 | :Nread fetch://[user@]host/path| | |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000260 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000261 | FILE: | | |
262 | file:///* | file:///* | |
263 | file://localhost/* | file://localhost/* | |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000264 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000265 | FTP: (*3) | (*3) | |
266 | ftp://[user@]host/path | ftp://[user@]host/path | ftp (*2) |
267 | :Nread ftp://host/path | :Nwrite ftp://host/path | ftp+.netrc |
268 | :Nread host path | :Nwrite host path | ftp+.netrc |
269 | :Nread host uid pass path | :Nwrite host uid pass path | ftp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000270 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000271 | HTTP: wget is executable: (*4) | | |
272 | http://[user@]host/path | Not Available | wget |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000273 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000274 | HTTP: fetch is executable (*4) | | |
275 | http://[user@]host/path | Not Available | fetch |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000276 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000277 | RCP: | | |
278 | rcp://[user@]host/path | rcp://[user@]host/path | rcp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000279 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000280 | RSYNC: | | |
281 | rsync://[user@]host/path | rsync://[user@]host/path | rsync |
282 | :Nread rsync://host/path | :Nwrite rsync://host/path | rsync |
283 | :Nread rcp://host/path | :Nwrite rcp://host/path | rcp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000284 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000285 | SCP: | | |
286 | scp://[user@]host/path | scp://[user@]host/path | scp |
287 | :Nread scp://host/path | :Nwrite scp://host/path | scp (*1) |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000288 +---------------------------------+----------------------------+------------+
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000289 | SFTP: | | |
290 | sftp://[user@]host/path | sftp://[user@]host/path | sftp |
291 | :Nread sftp://host/path | :Nwrite sftp://host/path | sftp (*1) |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000292 +=================================+============================+============+
293
294 (*1) For an absolute path use scp://machine//path.
295
296 (*2) if <.netrc> is present, it is assumed that it will
297 work with your ftp client. Otherwise the script will
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000298 prompt for user-id and pasword.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000299
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000300 (*3) for ftp, "machine" may be machine#port or machine:port
Bram Moolenaar071d4272004-06-13 20:20:40 +0000301 if a different port is needed than the standard ftp port
302
303 (*4) for http:..., if wget is available it will be used. Otherwise,
304 if fetch is available it will be used.
305
306Both the :Nread and the :Nwrite ex-commands can accept multiple filenames.
307
308
309NETRC *netrw-netrc*
310
311The typical syntax for lines in a <.netrc> file is given as shown below.
312Ftp under Unix usually support <.netrc>; Windows' ftp usually doesn't.
313>
314 machine {full machine name} login {user-id} password "{password}"
315 default login {user-id} password "{password}"
316
317Your ftp client must handle the use of <.netrc> on its own, but if the
318<.netrc> file exists, an ftp transfer will not ask for the user-id or
319password.
320
321 Note:
322 Since this file contains passwords, make very sure nobody else can
323 read this file! Most programs will refuse to use a .netrc that is
324 readable for others. Don't forget that the system administrator can
325 still read the file!
326
327
328PASSWORD *netrw-passwd*
329
330The script attempts to get passwords for ftp invisibly using |inputsecret()|,
331a built-in Vim function. See |netrw-uidpass| for how to change the password
332after one has set it.
333
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000334Unfortunately there doesn't appear to be a way for netrw to feed a password to
335scp. Thus every transfer via scp will require re-entry of the password.
336However, |netrw-listhack| can help with this problem.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000337
338
339==============================================================================
3403. Activation *netrw-activate*
341
342Network-oriented file transfers are available by default whenever
343|'nocompatible'| mode is enabled. The <netrw.vim> file resides in your
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000344system's vim-plugin directory and is sourced automatically whenever you bring
345up vim. I suggest that, at a minimum, you have at least the following in your
346<.vimrc> customization file: >
347 set nocp
348 if version >= 600
349 filetype plugin indent on
350 endif
351<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000352
353==============================================================================
3544. Transparent File Transfer *netrw-transparent*
355
356Transparent file transfers occur whenever a regular file read or write
357(invoked via an |:autocmd| for |BufReadCmd| or |BufWriteCmd| events) is made.
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000358Thus one may use files across networks just as simply as if they were local. >
Bram Moolenaar071d4272004-06-13 20:20:40 +0000359
360 vim ftp://[user@]machine/path
361 ...
362 :wq
363
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000364See |netrw-activate| for more on how to encourage your vim to use plugins
365such as netrw.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000366
367==============================================================================
3685. Ex Commands *netrw-ex*
369
370The usual read/write commands are supported. There are also a couple of
371additional commands available.
372
373:[range]Nw Write the specified lines to the current
374 file as specified in b:netrw_lastfile.
375
376:[range]Nw {netfile} [{netfile}]...
377 Write the specified lines to the {netfile}.
378
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000379:Nread Read the specified lines into the current
Bram Moolenaar071d4272004-06-13 20:20:40 +0000380 buffer from the file specified in
381 b:netrw_lastfile.
382
383:Nread {netfile} {netfile}...
384 Read the {netfile} after the current line.
385
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000386 *netrw-uidpass*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000387:call NetUserPass()
388 If b:netrw_uid and b:netrw_passwd don't exist,
389 this function query the user for them.
390
391:call NetUserPass("userid")
392 This call will set the b:netrw_uid and, if
393 the password doesn't exist, will query the user for it.
394
395:call NetUserPass("userid","passwd")
396 This call will set both the b:netrw_uid and b:netrw_passwd.
397 The user-id and password are used by ftp transfers. One may
398 effectively remove the user-id and password by using ""
399 strings.
400
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000401:NetrwSettings This command is desribed in |netrw-settings| -- used to
402 display netrw settings and change netrw behavior
403
Bram Moolenaar071d4272004-06-13 20:20:40 +0000404
405==============================================================================
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00004066. Variables and Options *netrw-options* *netrw-var*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000407
408The script <netrw.vim> uses several variables which can affect <netrw.vim>'s
409behavior. These variables typically may be set in the user's <.vimrc> file:
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000410(also see |netrw-settings|) >
411
412 -------------
413 Netrw Options
414 -------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000415 Option Meaning
416 -------------- -----------------------------------------------
417<
418 b:netrw_col Holds current cursor position (during NetWrite)
419 g:netrw_cygwin =1 assume scp under windows is from cygwin
420 (default/windows)
421 =0 assume scp under windows accepts windows
422 style paths (default/else)
423 g:netrw_ftp =0 use default ftp (uid password)
424 g:netrw_ftpmode ="binary" (default)
425 ="ascii" (your choice)
426 g:netrw_ignorenetrc =1 (default)
427 if you have a <.netrc> file but you don't
Bram Moolenaar071d4272004-06-13 20:20:40 +0000428 want it used, then set this variable. Its
429 mere existence is enough to cause <.netrc>
430 to be ignored.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000431 b:netrw_lastfile Holds latest method/machine/path.
432 b:netrw_line Holds current line number (during NetWrite)
433 g:netrw_passwd Holds current password for ftp.
434 g:netrw_silent =0 transfers done normally
435 =1 transfers done silently
436 g:netrw_uid Holds current user-id for ftp.
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000437 =1 use alternate ftp (user uid password)
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000438 (see |netrw-options|)
439 g:netrw_use_nt_rcp =0 don't use WinNT/2K/XP's rcp (default)
440 =1 use WinNT/2K/XP's rcp, binary mode
441 g:netrw_win95ftp =0 use unix-style ftp even if win95/98/ME/etc
442 =1 use default method to do ftp >
443 -----------------------------------------------------------------------
444<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000445The script will also make use of the following variables internally, albeit
446temporarily.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000447>
448 -------------------
449 Temporary Variables
450 -------------------
451 Variable Meaning
452 -------- ------------------------------------
453<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000454 g:netrw_method Index indicating rcp/ftp+.netrc/ftp
455 g:netrw_machine Holds machine name parsed from input
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000456 g:netrw_fname Holds filename being accessed >
457 ------------------------------------------------------------
458<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000459 *netrw-protocol*
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000460
461Netrw supports a number of protocols. These protocols are invoked using the
462variables listed below, and may be modified by the user.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000463>
464 ------------------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000465 Protocol Control Options
Bram Moolenaar071d4272004-06-13 20:20:40 +0000466 ------------------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000467 Option Type Setting Meaning
468 --------- -------- -------------- ---------------------------
469<
470 netrw_ftp variable =doesn't exist userid set by "user userid"
471 =0 userid set by "user userid"
472 =1 userid set by "userid"
473 NetReadFixup function =doesn't exist no change
474 =exists Allows user to have files
475 read via ftp automatically
476 transformed however they wish
477 by NetReadFixup()
Bram Moolenaar071d4272004-06-13 20:20:40 +0000478 g:netrw_dav_cmd variable ="cadaver"
479 g:netrw_fetch_cmd variable ="fetch -o"
480 g:netrw_ftp_cmd variable ="ftp"
481 g:netrw_http_cmd variable ="fetch -o" else if fetch is executable
482 g:netrw_http_cmd variable ="wget -O" if wget is executable
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000483 g:netrw_list_cmd variable ="ssh HOSTNAME ls -Fa"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000484 g:netrw_rcp_cmd variable ="rcp"
485 g:netrw_rsync_cmd variable ="rsync -a"
486 g:netrw_scp_cmd variable ="scp -q"
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000487 g:netrw_sftp_cmd variable ="sftp" >
488 -------------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000489<
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000490 *netrw-ftp*
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000491The first two options both help with certain ftp's that give trouble
492otherwise. In order to best understand how to use these options if ftp is
493giving you troubles, a bit of discussion follows on how netrw does ftp reads.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000494
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000495The g:netrw_..._cmd variables specify the external program to use handle the
496associated protocol (rcp, ftp, etc), plus any options.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000497
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000498The g:netrw_list_cmd's HOSTNAME entry will be changed via substitution with
499whatever the current request is for a hostname.
500
501For ftp, netrw typically builds up lines of one of the following formats in a
Bram Moolenaar071d4272004-06-13 20:20:40 +0000502temporary file:
503>
504 IF g:netrw_ftp !exists or is not 1 IF g:netrw_ftp exists and is 1
505 ---------------------------------- ------------------------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000506<
507 open machine [port] open machine [port]
508 user userid password userid password
509 [g:netrw_ftpmode] password
510 get filename tempfile [g:netrw_ftpmode]
511 get filename tempfile >
512 ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000513<
514Netrw then executes the lines above by use of a filter:
515>
516 :%! {g:netrw_ftp_cmd} -i [-n]
517<
518
519where
520 g:netrw_ftp_cmd is usually "ftp",
521 -i tells ftp not to be interactive
522 -n means don't use netrc and is used for Method #3 (ftp w/o <.netrc>)
523
524If <.netrc> exists it will be used to avoid having to query the user for
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000525userid and password. The transferred file is put into a temporary file.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000526The temporary file is then read into the main editing session window that
527requested it and the temporary file deleted.
528
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000529If your ftp doesn't accept the "user" command and immediately just demands a
530userid, then try putting "let netrw_ftp=1" in your <.vimrc>.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000531
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000532 *netrw-cadaver*
533To handle the SSL certificate dialog for untrusted servers, one may pull
534down the certificate and place it into /usr/ssl/cert.pem. This operation
535renders the server treatment as "trusted".
536
Bram Moolenaar83bab712005-08-01 21:58:57 +0000537 *netrw-fixup* *netreadfixup*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000538If your ftp for whatever reason generates unwanted lines (such as AUTH
539messages) you may write a NetReadFixup(tmpfile) function:
540>
541 function! NetReadFixup(method,line1,line2)
542 " a:line1: first new line in current file
543 " a:line2: last new line in current file
544 if a:method == 1 "rcp
545 elseif a:method == 2 "ftp + <.netrc>
546 elseif a:method == 3 "ftp + machine,uid,password,filename
547 elseif a:method == 4 "scp
548 elseif a:method == 5 "http/wget
549 elseif a:method == 6 "dav/cadaver
550 elseif a:method == 7 "rsync
551 elseif a:method == 8 "fetch
552 elseif a:method == 9 "sftp
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000553 else " complain
Bram Moolenaar071d4272004-06-13 20:20:40 +0000554 endif
555 endfunction
556>
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000557The NetReadFixup() function will be called if it exists and thus allows you to
558customize your reading process. As a further example, <netrw.vim> contains
559just such a function to handle Windows 95 ftp. For whatever reason, Windows
56095's ftp dumps four blank lines at the end of a transfer, and so it is
561desirable to automate their removal. Here's some code taken from <netrw.vim>
562itself:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000563>
564 if has("win95") && g:netrw_win95ftp
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000565 fun! NetReadFixup(method, line1, line2)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000566 if method == 3 " ftp (no <.netrc>)
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000567 let fourblanklines= line2 - 3
568 silent fourblanklines.",".line2."g/^\s*/d"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000569 endif
570 endfunction
571 endif
572>
573
574==============================================================================
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00005757. Directory Browsing *netrw-browse* *netrw-dir* *netrw-list* *netrw-help*
Bram Moolenaar83bab712005-08-01 21:58:57 +0000576
577MAPS *netrw-maps*
578 ?................Help.......................................|netrw-help|
579 <cr>.............Browsing...................................|netrw-cr|
580 <del>............Deleting Files or Directories..............|netrw-delete|
581 -................Going Up...................................|netrw--|
582 a................Hiding Files or Directories................|netrw-a|
583 b................Bookmarking a Directory....................|netrw-b|
584 B................Changing to a Bookmarked Directory.........|netrw-B|
585 c................Make Browsing Directory The Current Dir....|netrw-c|
586 d................Make A New Directory.......................|netrw-d|
587 D................Deleting Files or Directories..............|netrw-D|
588 <c-h>............Edit File/Directory Hiding List............|netrw-h|
589 i................Long Listing...............................|netrw-i|
590 <c-l>............Refreshing the Listing.....................|netrw-ctrl-l|
591 o................Browsing with a Horizontal Split...........|netrw-o|
592 p................Preview Window.............................|netrw-p|
593 q................Listing Bookmarks and History..............|netrw-q|
594 r................Reversing Sorting Order....................|netrw-r|
595 R................Renaming Files or Directories..............|netrw-R|
596 s................Selecting Sorting Style....................|netrw-s|
597 S................Editing the Sorting Sequence...............|netrw-S|
598 u................Changing to a Predecessor Directory........|netrw-u|
599 U................Changing to a Successor Directory..........|netrw-U|
600 v................Browsing with a Vertical Split.............|netrw-v|
601 x................Customizing Browsing.......................|netrw-x|
602
603 COMMANDS *netrw-explore-cmds*
Bram Moolenaar488c6512005-08-11 20:09:58 +0000604 :Explore[!] [dir] Explore directory of current file........|netrw-explore|
605 :Sexplore[!] [dir] Split & Explore directory ...............|netrw-explore|
606 :Hexplore[!] [dir] Horizontal Split & Explore...............|netrw-explore|
607 :Vexplore[!] [dir] Vertical Split & Explore.................|netrw-explore|
608 :Pexplore[!] [dir] Vertical Split & Explore.................|netrw-explore|
609 :Nexplore[!] [dir] Vertical Split & Explore.................|netrw-explore|
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000610 :NetrwSettings.............................................|netrw-settings|
Bram Moolenaar269ec652004-07-29 08:43:53 +0000611
612QUICK REFERENCE COMMANDS TABLE *netrw-browse-cmds*
Bram Moolenaar843ee412004-06-30 16:16:41 +0000613>
Bram Moolenaar8299df92004-07-10 09:47:34 +0000614 ------- -----------
Bram Moolenaar843ee412004-06-30 16:16:41 +0000615 Command Explanation
616 ------- -----------
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000617< ? Causes Netrw to issue help
Bram Moolenaar843ee412004-06-30 16:16:41 +0000618 <cr> Netrw will enter the directory or read the file
619 <del> Netrw will attempt to remove the file/directory
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000620 d Make a directory
Bram Moolenaar843ee412004-06-30 16:16:41 +0000621 D Netrw will attempt to remove the file(s)/directory(ies)
622 R Netrw will attempt to rename the file(s)/directory(ies)
623 - Makes Netrw go up one directory
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000624 a Toggles between normal display,
625 hiding (suppress display of files matching g:netrw_list_hide)
626 showing (display only files which match g:netrw_list_hide)
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000627 c Make current browsing directory the current directory
628 <c-h> Edit file hiding list
Bram Moolenaar8299df92004-07-10 09:47:34 +0000629 i Toggles between long and short listing
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000630 <c-l> Causes Netrw to refresh the directory listing
Bram Moolenaar843ee412004-06-30 16:16:41 +0000631 o Enter the file/directory under the cursor in a new browser
632 window. A horizontal split is used.
Bram Moolenaar572cb562005-08-05 21:35:02 +0000633 p Preview the file
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000634 r Reverse sorting order
635 s Select sorting style: by name, time, or file size
Bram Moolenaar843ee412004-06-30 16:16:41 +0000636 v Enter the file/directory under the cursor in a new browser
637 window. A vertical split is used.
638 x Apply a function to a file.
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000639
Bram Moolenaar269ec652004-07-29 08:43:53 +0000640NETRW BROWSER VARIABLES *netrw-browse-var*
Bram Moolenaar843ee412004-06-30 16:16:41 +0000641>
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000642 --- -----------
643 Var Explanation
644 --- -----------
645< *g:netrw_alto* change from above splitting to below splitting
646 by setting this variable (see |netrw-o|)
647 default: =0
Bram Moolenaar83bab712005-08-01 21:58:57 +0000648
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000649 *g:netrw_altv* change from left splitting to right splitting
650 by setting this variable (see |netrw-v|)
651 default: =0
Bram Moolenaar83bab712005-08-01 21:58:57 +0000652
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000653 *g:netrw_ftp_browse_reject* ftp can produce a number of errors and warnings
654 that can show up as "directories" and "files"
655 in the listing. This pattern is used to
656 remove such embedded messages. By default its
657 value is:
658 '^total\s\+\d\+$\|
659 ^Trying\s\+\d\+.*$\|
660 ^KERBEROS_V\d rejected\|
661 ^Security extensions not\|
662 No such file\|
663 : connect to address [0-9a-fA-F:]*
664 : No route to host$'
Bram Moolenaar83bab712005-08-01 21:58:57 +0000665
Bram Moolenaar61036992005-10-12 20:54:52 +0000666 *g:netrw_ftp_list_cmd* options for passing along to ftp for directory
667 listing. Defaults:
668 unix or g:netrw_cygwin set: : "ls -lF"
669 otherwise "dir"
670
671 *g:netrw_hide* if true, the hiding list is used
672 default: =0
Bram Moolenaar83bab712005-08-01 21:58:57 +0000673
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000674 *g:netrw_keepdir* =1 (default) keep current directory immune from
675 the browsing directory.
676 =0 keep the current directory the same as the
677 browsing directory.
678 The current browsing directory is contained in
679 b:netrw_curdir
Bram Moolenaar83bab712005-08-01 21:58:57 +0000680
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000681 *g:netrw_list_cmd* command for listing remote directories
682 default: (if ssh is executable)
683 "ssh HOSTNAME ls -FLa"
Bram Moolenaar83bab712005-08-01 21:58:57 +0000684
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000685 *g:netrw_longlist* if =1, then long listing will be default
Bram Moolenaar83bab712005-08-01 21:58:57 +0000686
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000687 *g:netrw_list_hide* comma separated pattern list for hiding files
688 default: ""
Bram Moolenaar83bab712005-08-01 21:58:57 +0000689
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000690 *g:netrw_local_mkdir* command for making a local directory
Bram Moolenaar61036992005-10-12 20:54:52 +0000691 default: "mkdir"
Bram Moolenaar83bab712005-08-01 21:58:57 +0000692
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000693 *g:netrw_local_rmdir* remove directory command (rmdir)
694 default: "rmdir"
Bram Moolenaar83bab712005-08-01 21:58:57 +0000695
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000696 *g:netrw_maxfilenamelen* =32 by default, selected so as to make long
697 listings fit on 80 column displays.
698 If your screen is wider, and you have file
699 or directory names longer than 32 bytes,
700 you may set this option to keep listings
701 columnar.
Bram Moolenaar83bab712005-08-01 21:58:57 +0000702
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000703 *g:netrw_mkdir_cmd* command for making a remote directory
704 default: "ssh HOSTNAME mkdir"
Bram Moolenaar83bab712005-08-01 21:58:57 +0000705
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000706 *g:netrw_rm_cmd* command for removing files
707 default: "ssh HOSTNAME rm"
Bram Moolenaar83bab712005-08-01 21:58:57 +0000708
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000709 *g:netrw_rmdir_cmd* command for removing directories
710 default: "ssh HOSTNAME rmdir"
Bram Moolenaar83bab712005-08-01 21:58:57 +0000711
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000712 *g:netrw_rmf_cmd* command for removing softlinks
713 default: "ssh HOSTNAME rm -f"
Bram Moolenaar83bab712005-08-01 21:58:57 +0000714
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000715 *g:netrw_sort_by* sort by "name", "time", or "size"
716 default: "name"
Bram Moolenaar83bab712005-08-01 21:58:57 +0000717
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000718 *g:netrw_sort_direction* sorting direction: "normal" or "reverse"
719 default: "normal"
Bram Moolenaar83bab712005-08-01 21:58:57 +0000720
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000721 *g:netrw_sort_sequence* when sorting by name, first sort by the
722 comma-separated pattern sequence
723 default: '[\/]$,*,\.bak$,\.o$,\.h$,
724 \.info$,\.swp$,\.obj$'
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000725
Bram Moolenaar61036992005-10-12 20:54:52 +0000726 *g:netrw_ssh_cmd* One may specify an executable command
727 to use instead of ssh for remote actions
728 such as listing, file removal, etc.
729 default: ssh
730
731 *g:netrw_ssh_browse_reject* ssh can sometimes produce unwanted lines,
732 messages, banners, and whatnot that one doesn't
733 want masquerading as "directories" and "files".
734 Use this pattern to remove such embedded
735 messages. By default its value is:
736 '^total\s\+\d\+$'
737
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000738 *g:netrw_timefmt* specify format string to strftime() (%c)
739 default: "%c"
Bram Moolenaar83bab712005-08-01 21:58:57 +0000740
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000741 *g:netrw_winsize* specify initial size of new o/v windows
742 default: ""
Bram Moolenaar83bab712005-08-01 21:58:57 +0000743
744INTRODUCTION TO DIRECTORY BROWSING *netrw-browse-intro*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000745
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000746Netrw supports the browsing of directories on the local system and on remote
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000747hosts, including listing files and directories, entering directories, editing
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000748files therein, deleting files/directories, making new directories, and moving
749(renaming) files and directories. The Netrw browser generally implements the
750previous explorer maps and commands for remote directories, although details
751(such as pertinent global variable names) necessarily differ.
752
753The Netrw remote file and directory browser handles two protocols: ssh and
754ftp. The protocol in the url, if it is ftp, will cause netrw to use ftp
755in its remote browsing. Any other protocol will be used for file transfers,
756but otherwise the ssh protocol will be used to do remote directory browsing.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000757
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000758To use Netrw's remote directory browser, simply attempt to read a "file" with a
Bram Moolenaar843ee412004-06-30 16:16:41 +0000759trailing slash and it will be interpreted as a request to list a directory:
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000760
761 vim [protocol]://[user@]hostname/path/
762
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000763For local directories, the trailing slash is not required.
764
765If you'd like to avoid entering the password in for remote directory listings
766with ssh or scp, see |netrw-listhack|.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000767
Bram Moolenaarf6cf9872005-08-08 22:00:59 +0000768 *netrw-explore* *netrw-pexplore*
769 *netrw-hexplore* *netrw-sexplore*
770DIRECTORY EXPLORING COMMANDS *netrw-nexplore* *netrw-vexplore*
Bram Moolenaar83bab712005-08-01 21:58:57 +0000771
Bram Moolenaar488c6512005-08-11 20:09:58 +0000772 :Explore[!] [dir]... Explore directory of current file *:Explore*
773 :Sexplore[!] [dir]... Split&Explore directory of current file *:Sexplore*
774 :Hexplore[!] [dir]... Horizontal Split & Explore *:Hexplore*
775 :Vexplore[!] [dir]... Vertical Split & Explore *:Vexplore*
Bram Moolenaar83bab712005-08-01 21:58:57 +0000776
Bram Moolenaar488c6512005-08-11 20:09:58 +0000777 Used with :Explore **/pattern :
778 :Nexplore............. go to next matching file *:Nexplore*
779 :Pexplore............. go to previous matching file *:Pexplore*
Bram Moolenaar83bab712005-08-01 21:58:57 +0000780
Bram Moolenaar488c6512005-08-11 20:09:58 +0000781:Explore will open the local-directory browser on the current file's
782 directory (or on directory [dir] if specified). The window will be
783 split only if the file has been modified, otherwise the browsing
784 window will take over that window. Normally the splitting is taken
785 horizontally.
786:Explore! is like :Explore, but will use vertical splitting.
787:Sexplore will always split the window before invoking the local-directory
788 browser. As with Explore, the splitting is normally done
789 horizontally.
790:Sexplore! [dir] is like :Sexplore, but the splitting will be done vertically.
791:Hexplore [dir] does an :Explore with |:belowright| horizontal splitting.
792:Hexplore! [dir] does an :Explore with |:aboveleft| horizontal splitting.
793:Vexplore [dir] does an :Explore with |:leftabove| vertical splitting.
794:Vexplore! [dir] does an :Explore with |:rightbelow| vertical splitting.
Bram Moolenaar83bab712005-08-01 21:58:57 +0000795
Bram Moolenaar488c6512005-08-11 20:09:58 +0000796By default, these commands use the current file's directory. However, one
797may explicitly provide a directory (path) to use.
Bram Moolenaar83bab712005-08-01 21:58:57 +0000798
Bram Moolenaarf6cf9872005-08-08 22:00:59 +0000799(Following needs v7.0 or later) *netrw-starstar*
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000800When Explore, Sexplore, Hexplore, or Vexplore are used with a **,
801such as:
Bram Moolenaarf6cf9872005-08-08 22:00:59 +0000802>
803 :Explore **/filename_pattern
804<
805netrw will attempt to find a (sub)directory which matches the filename
806pattern. Internally, it produces a list of files which match the pattern
807and their paths; to that extent it resembles the Unix operation:
808>
809 find $(pwd) -name "$1" -exec "echo" "{}" ";" 2> /dev/null
810<
811The directory display is updated to show the subdirectory containing a
812matching file. One may then proceed to the next (or previous) matching files'
813directories by using Nexplore or Pexplore, respectively. If your console or
814gui produces recognizable shift-up or shift-down sequences, then you'll likely
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000815find using shift-downarrow and shift-uparrow convenient. They're mapped by
816netrw:
Bram Moolenaar572cb562005-08-05 21:35:02 +0000817
818 <s-down> == Nexplore, and
819 <s-up> == Pexplore.
820
Bram Moolenaarf6cf9872005-08-08 22:00:59 +0000821As an example, consider
822>
Bram Moolenaar572cb562005-08-05 21:35:02 +0000823 :Explore **/*.c
824 :Nexplore
825 :Nexplore
826 :Pexplore
827<
Bram Moolenaarf6cf9872005-08-08 22:00:59 +0000828The status line will show, on the right hand side of the status line, a
829message like "Match 3 of 20".
830
Bram Moolenaar83bab712005-08-01 21:58:57 +0000831
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000832REFRESHING THE LISTING *netrw-ctrl-l*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000833
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000834To refresh either a local or remote directory listing, press ctrl-l (<c-l>) or
835hit the <cr> when atop the ./ directory entry in the listing. One may also
836refresh a local directory by using ":e .".
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000837
838
839GOING UP *netrw--*
840
Bram Moolenaar61036992005-10-12 20:54:52 +0000841To go up a directory, press "-" or press the <cr> when atop the ../ directory
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000842entry in the listing.
843
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000844Netrw will use the command in |g:netrw_list_cmd| to perform the directory
845listing operation after changing HOSTNAME to the host specified by the
846user-provided url. By default netrw provides the command as:
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000847
Bram Moolenaar843ee412004-06-30 16:16:41 +0000848 ssh HOSTNAME ls -FLa
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000849
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000850where the HOSTNAME becomes the [user@]hostname as requested by the attempt to
851read. Naturally, the user may override this command with whatever is
852preferred. The NetList function which implements remote directory browsing
853expects that directories will be flagged by a trailing slash.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000854
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000855
Bram Moolenaar8299df92004-07-10 09:47:34 +0000856BROWSING *netrw-cr*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000857
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000858Browsing is simple: move the cursor onto a file or directory of interest.
Bram Moolenaar843ee412004-06-30 16:16:41 +0000859Hitting the <cr> (the return key) will select the file or directory.
860Directories will themselves be listed, and files will be opened using the
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000861protocol given in the original read request.
862
863 CAVEAT: There are three forms of listing (see |netrw-i|). Netrw assumes
864 that two or more spaces delimit filenames and directory names for the long
865 and wide listing formats. Thus, if your filename or directory name has two
866 or more spaces embedded in it, or any trailing spaces, then you'll need to
867 use the "thin" format to select it.
Bram Moolenaar843ee412004-06-30 16:16:41 +0000868
Bram Moolenaar83bab712005-08-01 21:58:57 +0000869
Bram Moolenaar578b49e2005-09-10 19:22:57 +0000870OBTAINING A FILE *netrw-O*
871
872When browsing a remote directory, one may obtain a file under the cursor (ie.
873get a copy on your local machine, but not edit it) by pressing the O key.
874Only ftp and scp are supported for this operation (but since these two are
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000875available for browsing, that shouldn't be a problem). The status bar
876will then show, on its right hand side, a message like "Obtaining filename".
877The statusline will be restored after the transfer is complete.
878
879Netrw can also "obtain" a file using the local browser. Netrw's display
880of a directory is not necessarily the same as Vim's "current directory",
881unless |g:netrw_keepdir| is set to 0 in the user's <.vimrc>. One may select
882a file using the local browser (by putting the cursor on it) and pressing
883"O" will then "obtain" the file; ie. copy it to Vim's current directory.
884
885Related topics:
886 * To see what the current directory is, use |:pwd|
887 * To make the currently browsed directory the current directory, see |netrw-c|
888 * To automatically make the currently browsed directory the current
889 directory, see |g:netrw_keepdir|.
Bram Moolenaar578b49e2005-09-10 19:22:57 +0000890
891
892THIN, LONG, AND WIDE LISTINGS *netrw-i*
893
894The "i" map cycles between the thin, long, and wide listing formats.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000895
Bram Moolenaar8299df92004-07-10 09:47:34 +0000896The short listing format gives just the files' and directories' names.
Bram Moolenaar578b49e2005-09-10 19:22:57 +0000897
Bram Moolenaar8299df92004-07-10 09:47:34 +0000898The long listing is either based on the "ls" command via ssh for remote
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000899directories or displays the filename, file size (in bytes), and the time and
900date of last modification for local directories. With the long listing
901format, netrw is not able to recognize filenames which have trailing spaces.
902Use the thin listing format for such files.
Bram Moolenaar578b49e2005-09-10 19:22:57 +0000903
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000904The wide listing format has a multi-column display of the various files in the
905netrw current directory, rather like the Unix "ls" presents. In this mode the
906"b" and "B" maps are not available; instead, use Nb (|netrw-Nb|) and NB
907(|netrw-NB|). The wide listing format uses two or more contiguous spaces to
908delineate filenames; when using that format, netrw won't be able to recognize
909or use filenames which have two or more contiguous spaces embedded in the name
910or any trailing spaces. The thin listing format will, however, work with such
911files.
Bram Moolenaar8299df92004-07-10 09:47:34 +0000912
913
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000914MAKING A NEW DIRECTORY *netrw-d*
Bram Moolenaar8299df92004-07-10 09:47:34 +0000915
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000916With the "d" map one may make a new directory either remotely (which depends
917on the global variable g:netrw_mkdir_cmd) or locally (which depends on the
918global variable g:netrw_local_mkdir). Netrw will issue a request for the new
919directory's name. A bare <CR> at that point will abort the making of the
Bram Moolenaar8299df92004-07-10 09:47:34 +0000920directory. Attempts to make a local directory that already exists (as either
921a file or a directory) will be detected, reported on, and ignored.
922
Bram Moolenaar83bab712005-08-01 21:58:57 +0000923
Bram Moolenaar269ec652004-07-29 08:43:53 +0000924DELETING FILES OR DIRECTORIES *netrw-delete* *netrw-D*
Bram Moolenaar843ee412004-06-30 16:16:41 +0000925
926Deleting/removing files and directories involves moving the cursor to the
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000927file/directory to be deleted and pressing "D". Directories must be empty
928first before they can be successfully removed. If the directory is a softlink
929to a directory, then netrw will make two requests to remove the directory
930before succeeding. Netrw will ask for confirmation before doing the
931removal(s). You may select a range of lines with the "V" command (visual
932selection), and then pressing "D".
Bram Moolenaar843ee412004-06-30 16:16:41 +0000933
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000934The g:netrw_rm_cmd, g:netrw_rmf_cmd, and g:netrw_rmdir_cmd variables are used
935to control the attempts to remove files and directories. The g:netrw_rm_cmd
936is used with files, and its default value is:
Bram Moolenaar843ee412004-06-30 16:16:41 +0000937
938 g:netrw_rm_cmd: ssh HOSTNAME rm
939
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000940The g:netrw_rmdir_cmd variable is used to support the removal of directories.
941Its default value is:
Bram Moolenaar843ee412004-06-30 16:16:41 +0000942
943 g:netrw_rmdir_cmd: ssh HOSTNAME rmdir
944
945If removing a directory fails with g:netrw_rmdir_cmd, netrw then will attempt
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000946to remove it again using the g:netrw_rmf_cmd variable. Its default value is:
Bram Moolenaar843ee412004-06-30 16:16:41 +0000947
948 g:netrw_rmf_cmd: ssh HOSTNAME rm -f
949
Bram Moolenaar843ee412004-06-30 16:16:41 +0000950
Bram Moolenaar8299df92004-07-10 09:47:34 +0000951RENAMING FILES OR DIRECTORIES *netrw-move* *netrw-rename* *netrw-R*
Bram Moolenaar843ee412004-06-30 16:16:41 +0000952
953Renaming/moving files and directories involves moving the cursor to the
954file/directory to be moved (renamed) and pressing "R". You will then be
955queried for where you want the file/directory to be moved. You may select a
956range of lines with the "V" command (visual selection), and then pressing "R".
957
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000958The g:netrw_rename_cmd variable is used to implement renaming. By default its
Bram Moolenaar843ee412004-06-30 16:16:41 +0000959value is:
960
961 ssh HOSTNAME mv
962
Bram Moolenaar269ec652004-07-29 08:43:53 +0000963One may rename a block of files and directories by selecting them with
964the V (|linewise-visual|).
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000965
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000966
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000967HIDING FILES OR DIRECTORIES *netrw-a*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000968
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000969Netrw's browsing facility allows one to use the hiding list in one of three
970ways: ignore it, hide files which match, and show only those files which
971match. The "a" map allows the user to cycle about these three ways.
Bram Moolenaar83bab712005-08-01 21:58:57 +0000972
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000973The g:netrw_list_hide variable holds a comma delimited list of patterns (ex.
974\.obj) which specify the hiding list. (also see |netrw-h|) To set the hiding
975list, use the <c-h> map. As an example, to hide files which begin with a ".",
976one may use the <c-h> map to set the hiding list to '^\..*' (or one may put
977let g:netrw_list_hide= '^\..*' in one's <.vimrc>). One may then use the "a"
978key to show all files, hide matching files, or to show only the matching
979files.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000980
981
Bram Moolenaar83bab712005-08-01 21:58:57 +0000982EDIT FILE OR DIRECTORY HIDING LIST *netrw-h* *netrw-edithide*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000983
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000984The "<ctrl-h>" map brings up a requestor allowing the user to change the
Bram Moolenaar269ec652004-07-29 08:43:53 +0000985file/directory hiding list. The hiding list consists of one or more patterns
986delimited by commas. Files and/or directories satisfying these patterns will
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000987either be hidden (ie. not shown) or be the only ones displayed (see
988|netrw-a|).
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000989
990
Bram Moolenaar83bab712005-08-01 21:58:57 +0000991BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o* *netrw-horiz*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000992
Bram Moolenaar269ec652004-07-29 08:43:53 +0000993Normally one enters a file or directory using the <cr>. However, the "o" map
994allows one to open a new window to hold the new directory listing or file. A
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000995horizontal split is used. (for vertical splitting, see |netrw-v|)
996
Bram Moolenaar482aaeb2005-09-29 18:26:07 +0000997Normally, the o key splits the window horizontally with the new window and
998cursor at the top. To change to splitting the window horizontally with the
999new window and cursor at the bottom, have
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001000
1001 let g:netrw_alto = 1
1002
1003in your <.vimrc>.
1004
Bram Moolenaar83bab712005-08-01 21:58:57 +00001005
1006PREVIEW WINDOW *netrw-p* *netrw-preview*
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001007
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00001008One may use a preview window (currently only for local browsing) by using the
1009"p" key when the cursor is atop the desired filename to be previewed.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001010
1011
Bram Moolenaar83bab712005-08-01 21:58:57 +00001012SELECTING SORTING STYLE *netrw-s* *netrw-sort*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001013
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00001014One may select the sorting style by name, time, or (file) size. The "s" map
1015allows one to circulate amongst the three choices; the directory listing will
1016automatically be refreshed to reflect the selected style.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001017
1018
Bram Moolenaar83bab712005-08-01 21:58:57 +00001019EDITING THE SORTING SEQUENCE *netrw-S* *netrw-sortsequence*
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001020
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00001021When "Sorted by" is name, one may specify priority via the sorting sequence
1022(g:netrw_sort_sequence). The sorting sequence typically prioritizes the
1023name-listing by suffix, although any pattern will do. Patterns are delimited
1024by commas. The default sorting sequence is:
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001025>
Bram Moolenaar488c6512005-08-11 20:09:58 +00001026 [\/]$,*,\.bak$,\.o$,\.h$,\.info$,\.swp$,\.obj$
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001027<
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00001028The lone * is where all filenames not covered by one of the other patterns
1029will end up. One may change the sorting sequence by modifying the
1030g:netrw_sort_sequence variable (either manually or in your <.vimrc>) or by
1031using the "S" map.
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001032
1033
Bram Moolenaar83bab712005-08-01 21:58:57 +00001034REVERSING SORTING ORDER *netrw-r* *netrw-reverse*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001035
1036One may toggle between normal and reverse sorting order by pressing the
1037"r" key.
1038
1039
Bram Moolenaar83bab712005-08-01 21:58:57 +00001040CHANGING TO A PREDECESSOR DIRECTORY *netrw-u* *netrw-updir*
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001041
1042Every time you change to a new directory (new for the current session),
1043netrw will save the directory in a recently-visited directory history
1044list (unless g:netrw_dirhistmax is zero; by default, its ten). With the
1045"u" map, one can change to an earlier directory (predecessor). To do
1046the opposite, see |netrw-U|.
1047
1048
Bram Moolenaar83bab712005-08-01 21:58:57 +00001049CHANGING TO A SUCCESSOR DIRECTORY *netrw-U* *netrw-downdir*
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001050
1051With the "U" map, one can change to a later directory (successor).
1052This map is the opposite of the "u" map. (see |netrw-u|) Use the
1053q map to list both the bookmarks and history. (see |netrw-q|)
1054
1055
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001056BROWSING WITH A VERTICALLY SPLIT WINDOW *netrw-v*
1057
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00001058Normally one enters a file or directory using the <cr>. However, the "v" map
1059allows one to open a new window to hold the new directory listing or file. A
1060vertical split is used. (for horizontal splitting, see |netrw-o|)
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001061
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00001062Normally, the v key splits the window vertically with the new window and
1063cursor at the left. To change to splitting the window vertically with the new
1064window and cursor at the right, have
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001065
1066 let g:netrw_altv = 1
1067
1068in your <.vimrc>.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001069
1070
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00001071CUSTOMIZING BROWSING WITH A USER FUNCTION *netrw-x* *netrw-handler*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001072
1073One may "enter" a file with a special handler, thereby firing up a browser or
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001074other application, for example, on a file by hitting the "x" key. The special
1075handler varies:
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001076
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001077 * for Windows 32 or 64, the url and FileProtocolHandler dlls are used.
1078 * for KDE (with kfmclient): kfmclient is used.
1079 * for Gnome (with gnome-open): gnome-open is used.
Bram Moolenaar61036992005-10-12 20:54:52 +00001080 * otherwise the netrwFileHandler plugin is used.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001081
1082The file's suffix is used by these various approaches to determine an
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00001083appropriate application to use to "handle" these files. Such things as
1084OpenOffice (*.sfx), visualization (*.jpg, *.gif, etc), and PostScript (*.ps,
1085*.eps) can be handled.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001086
Bram Moolenaar61036992005-10-12 20:54:52 +00001087The netrwFileHandler applies a user-defined function to a file, based on its
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001088extension. Of course, the handler function must exist for it to be called!
1089>
1090 Ex. mypgm.html x ->
Bram Moolenaar61036992005-10-12 20:54:52 +00001091 netrwFileHandler_html("scp://user@host/some/path/mypgm.html")
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001092<
Bram Moolenaar61036992005-10-12 20:54:52 +00001093See the <plugin/netrwFileHandlers.vim> for an example of how to handle an html
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001094file with mozilla.
1095
Bram Moolenaar61036992005-10-12 20:54:52 +00001096One may write custom netrwFileHandlers; please look at the
1097plugin/netrwFileHandlers.vim script for examples. If its likely to be
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001098generally useful, please feel free to forward a copy to me for future
1099inclusion in the distribution.
1100
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001101
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001102MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-c* *netrw-curdir*
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001103
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001104By default, g:netrw_keepdir is 1. This setting means that the current
1105directory will not track the browsing directory. However, setting
1106g:netrw_keepdir to 0 (say, in your <.vimrc>) will tell netrw to have the
1107currently browsed directory be the current directory.
1108
1109With the default setting for g:netrw_keepdir, in order to make the two
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00001110directories the same, use the "c" map (just type c). That map will set the
1111current directory to the current browsing directory.
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001112
1113
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001114BOOKMARKING A DIRECTORY *netrw-b* *netrw-bookmark* *netrw-bookmarks*
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001115 *netrw-Nb*
Bram Moolenaar572cb562005-08-05 21:35:02 +00001116One may easily "bookmark" a directory by using >
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001117
1118 {cnt}b
Bram Moolenaar572cb562005-08-05 21:35:02 +00001119<
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001120Any count may be used. One may use viminfo's "!" option to retain bookmarks
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001121between vim sessions. See |netrw-B| for how to return to a bookmark and
1122|netrw-q| for how to list them.
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001123
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001124When wide listing is in use (see |netrw-i|), then the b map is not available;
1125instead, use {cnt}Nb.
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001126
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001127
1128CHANGING TO A BOOKMARKED DIRECTORY *netrw-NB* *netrw-B*
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001129
1130To change directory back to a bookmarked directory, use
1131
1132 {cnt}B
1133
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00001134Any count may be used to reference any of the bookmarks. See |netrw-b| on
1135how to bookmark a directory and |netrw-q| on how to list bookmarks.
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001136
1137When wide listing is in use (see |netrw-i|), then the B map is not available;
1138instead, use {cnt}NB.
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001139
1140
Bram Moolenaar83bab712005-08-01 21:58:57 +00001141LISTING BOOKMARKS AND HISTORY *netrw-q* *netrw-listbookmark*
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001142
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001143Pressing "q" will list the bookmarked directories and directory traversal
1144history (query). (see |netrw-b|, |netrw-B|, |netrw-u|, and |netrw-U|)
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001145
1146
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001147IMPROVING DIRECTORY BROWSING *netrw-listhack*
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001148
1149Especially with the remote directory browser, constantly entering the password
1150is tedious.
1151
Bram Moolenaar843ee412004-06-30 16:16:41 +00001152For Linux/Unix systems, I suggest looking into
1153
1154 http://hacks.oreilly.com/pub/h/66
1155
1156It gives a tip for setting up password-less use of ssh and scp, and discusses
1157the associated security issues.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001158
1159
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001160NETRW SETTINGS *netrw-settings*
1161
1162With the NetrwSettings.vim plugin, >
1163 :NetrwSettings
1164will bring up a window with the many variables that netrw uses for its
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00001165settings. You may change any of their values; when you save the file, the
1166settings therein will be used. One may also press "?" on any of the lines for
1167help on what each of the variables do.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001168
1169
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001170==============================================================================
Bram Moolenaarc0197e22004-09-13 20:26:32 +000011718. Problems and Fixes *netrw-problems*
1172
1173 (This section is likely to grow as I get feedback)
1174 (also see |netrw-debug|)
Bram Moolenaar488c6512005-08-11 20:09:58 +00001175 *netrw-p1*
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001176 P1. I use windows 95, and my ftp dumps four blank lines at the
1177 end of every read.
1178
1179 See |netrw-fixup|, and put the following into your
1180 <.vimrc> file:
1181
1182 let g:netrw_win95ftp= 1
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00001183
Bram Moolenaar488c6512005-08-11 20:09:58 +00001184 *netrw-p2*
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001185 P2. I use windows, and my network browsing with ftp doesn't sort by
1186 time or size
1187
1188 Windows' ftp has a minimal support for ls (ie. it doesn't
1189 accept sorting options). It doesn't support the -F which
1190 gives an explanatory character (ABC/ for "ABC is a directory").
1191 Netrw uses dir to get its short and long listings. If you
1192 think your ftp does support a full-up ls, put the following
1193 into your <.vimrc>:
1194
1195 let g:netrw_ftp_list_cmd= "ls -lF"
1196
1197 Alternatively, if you have cygwin on your Windows box, put
1198 into your <.vimrc>:
1199
1200 let g:netrw_cygwin= 1
1201
Bram Moolenaar488c6512005-08-11 20:09:58 +00001202 *netrw-p3*
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001203 P3. I tried rcp://user@host/ (or protocol other than ftp) and netrw
1204 used ssh! That wasn't what I asked for...
1205
1206 Netrw has two methods for browsing remote directories: ssh
1207 and ftp. Unless you specify ftp specifically, ssh is used.
1208 When it comes time to do download a file (not just a directory
1209 listing), netrw will use the given protocol to do so.
1210
Bram Moolenaar488c6512005-08-11 20:09:58 +00001211 *netrw-p4*
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001212 P4. I would like long listings to be the default.
1213
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001214 let g:netrw_longlist=1
1215
1216 Check out |netrw-browse-var| for more customizations that
1217 you can set.
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001218
Bram Moolenaar488c6512005-08-11 20:09:58 +00001219 *netrw-p5*
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001220 P5. My times come up oddly in local browsing
1221
1222 Does your system's strftime() accept the "%c" to yield dates
1223 such as "Sun Apr 27 11:49:23 1997"? If not, do a "man strftime"
1224 and find out what option should be used. Then put it into
1225 your <.vimrc>:
1226 let g:netrw_timefmt= "%X" (where X is the option)
1227
Bram Moolenaar488c6512005-08-11 20:09:58 +00001228 *netrw-p6*
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001229 P6. I want my current directory to track my browsing.
1230 How do I do that?
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001231
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001232 let g:netrw_keepdir= 0
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00001233
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001234
1235==============================================================================
12369. Debugging *netrw-debug*
Bram Moolenaar071d4272004-06-13 20:20:40 +00001237
1238The <netrw.vim> script is typically available as:
Bram Moolenaar488c6512005-08-11 20:09:58 +00001239>
Bram Moolenaar071d4272004-06-13 20:20:40 +00001240 /usr/local/share/vim/vim6x/plugin/netrw.vim
Bram Moolenaar488c6512005-08-11 20:09:58 +00001241< -or- >
1242 /usr/local/share/vim/vim7x/plugin/netrw.vim
1243<
Bram Moolenaar071d4272004-06-13 20:20:40 +00001244which is loaded automatically at startup (assuming :set nocp).
1245
1246 1. Get the <Decho.vim> script, available as:
1247
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00001248 http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_scripts
1249 as "Decho, a vimL debugging aid"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001250 or
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00001251 http://vim.sourceforge.net/scripts/script.php?script_id=120
Bram Moolenaar071d4272004-06-13 20:20:40 +00001252
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001253 and put it into your local plugin directory.
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00001254
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001255 2. <Decho.vim> itself needs the <cecutil.vim> script, so you'll need
1256 to put it into your .vim/plugin, too. You may obtain it from:
Bram Moolenaar071d4272004-06-13 20:20:40 +00001257
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001258 http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs
1259 as "DrC's Utilities"
Bram Moolenaar071d4272004-06-13 20:20:40 +00001260
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001261 3. Edit the <netrw.vim> file by typing:
1262
1263 vim netrw.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +00001264 :DechoOn
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001265 :wq
Bram Moolenaar071d4272004-06-13 20:20:40 +00001266
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001267 To restore to normal non-debugging behavior, edit <netrw.vim>
1268 by typing
Bram Moolenaar071d4272004-06-13 20:20:40 +00001269
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001270 vim netrw.vim
1271 :DechoOff
1272 :wq
1273
1274 This command, provided by <Decho.vim>, will comment out all
1275 Decho-debugging statements (Dfunc(), Dret(), Decho(), Dredir()).
1276
1277 4. Then bring up vim and attempt a transfer. A set of messages
Bram Moolenaar071d4272004-06-13 20:20:40 +00001278 should appear concerning the steps that <netrw.vim> took in
1279 attempting to read/write your file over the network. Please
1280 send that information to <netrw.vim>'s maintainer,
1281
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001282 NdrOchip at ScampbellPfamily.AbizM - NOSPAM
Bram Moolenaar071d4272004-06-13 20:20:40 +00001283
1284==============================================================================
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000128510. History *netrw-history*
Bram Moolenaar071d4272004-06-13 20:20:40 +00001286
Bram Moolenaar61036992005-10-12 20:54:52 +00001287 v73: * bugfix -- scp://host/path/file was getting named incorrectly
1288 * netrw detects use of earlier-than-7.0 version of vim and issues
1289 a pertinent error message.
1290 * netrwSettings.vim is now uses autoloading. Only
1291 <netrwPlugin.vim> is needed as a pure plugin
1292 (ie. always loaded).
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00001293 v72: * bugfix -- formerly, one could prevent the loading of netrw
1294 by "let g:loaded_netrw=1"; when autoloading became supported,
1295 this feature was lost. It is now restored.
1296 v71: * bugfix -- made some "set nomodifiable"s into setlocal variants
1297 (allows :e somenewfile to be modifiable as usual)
1298 * NetrwSettings calls a netrw function, thereby assuring that
1299 netrw has loaded. However, if netrw does not load for whatever
1300 reason, then NetrwSettings will now issue a warning message.
1301 * For what reason I don't recall, when wget and fetch are both
1302 not present, and an attempt to read a http://... url is made,
1303 netrw exited. It now only returns.
1304 * When ch=1, on the second and subsequent uses of browsing Netrw
1305 would issue a blank line to clear the echo'd messages. This
1306 caused an annoying "Hit-Enter" prompt; now a blank line message
1307 is echo'd only if &ch>1.
1308 v70: * when using |netrw-O|, the "Obtaining filename" message is now
1309 shown using |hl-User9|. If User9 has not been defined, netrw
1310 will define it.
1311 v69: * Bugfix: win95/98 machines were experiencing a
1312 "E121: Undefined variable: g:netrw_win95ftp" message
1313 v68: * double-click-leftmouse selects word under mouse
1314 v67: * Passwords which contain blanks will now be surrounded by
1315 double-quotes automatically (Yongwei)
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001316 v66: * Netrw now seems to work with a few more Windows situations
1317 * O now obtains a file: remote browsing file -> local copy,
1318 locally browsing file -> current directory (see :pwd)
1319 * i now cycles between thin, long, and wide listing styles
1320 * NB and Nb are maps that are always available; corresponding
1321 B and b maps are only available when not using wide listing
1322 in order to allow them to be used for motions
1323 v65: * Browser functions now use NetOptionSave/Restore; in particular,
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001324 netrw now works around the report setting
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001325 v64: * Bugfix - browsing a "/" directory (Unix) yielded buffers
Bram Moolenaar8aff23a2005-08-19 20:40:30 +00001326 named "[Scratch]" instead of "/"
1327 * Bugfix - remote browsing with ftp was omitting the ./ and ../
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001328 v63: * netrw now takes advantage of autoload (and requires 7.0)
1329 * Bugfix - using r (to reverse sort) working again
1330 v62: * Bugfix - spaces allowed again in directory names with
1331 g:netrw_keepdir=0. In fact, I've tested netrw (again)
1332 with most ANSI punctuation marks for directory names.
1333 * Bugfix - NetrwSettings gave errors when g:netrw_silent
1334 had not be set.
Bram Moolenaar90cfdbe2005-08-12 19:59:19 +00001335 v61: * document upgrade -- netrw variable-based settings all should
1336 have tags. Supports NetrwSettings command.
1337 * several important variables are window-oriented. Netrw has
1338 to transfer these across a window split. See s:BufWinVars()
1339 and s:UseBufWinVars().
Bram Moolenaar488c6512005-08-11 20:09:58 +00001340 v60: * when using the i map to switch between long and short listings,
1341 netrw will now keep cursor on same line
1342 * "Match # of #" now uses status line
1343 * :Explore **/*.c will now work from a non-netrw-browser window
1344 * :Explore **/patterns can now be run in separate browser windows
1345 * active banner (hit <cr> will cause various things to happen)
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00001346 v59: * bugfix -- another keepalt work-around installed (for vim6.3)
1347 * "Match # of #" for Explore **/pattern matches
Bram Moolenaar572cb562005-08-05 21:35:02 +00001348 v58: * Explore and relatives can now handle **/somefilepattern (v7)
1349 * Nexplore and Pexplore introduced (v7). shift-down and shift-up
1350 cursor keys will invoke Nexplore and Pexplore, respectively.
1351 * bug fixed with o and v
1352 * autochdir only worked around for vim when it has been
1353 compiled with either |+netbeans_intg| or |+sun_workshop|
1354 * Under Windows, all directories and files were being preceded
1355 with a "/" when local browsing. Fixed.
1356 * When: syntax highlighting is off, laststatus=2, and remote
1357 browsing is used, sometimes the laststatus highlighting
1358 bleeds into the entire display. Work around - do an extra
1359 redraw in that case.
1360 * Bugfix: when g:netrw_keepdir=0, due to re-use of buffers,
1361 netrw didn't change the directory when it should've
1362 * Bugfix: D and R commands work again
Bram Moolenaar1d94f9b2005-08-04 21:29:45 +00001363 v57: * Explore and relatives can now handle RO files
1364 * reverse sort restored with vim7's sort command
1365 * g:netrw_keepdir now being used to keep the current directory
1366 unchanged as intended (sense change)
1367 * vim 6.3 still supported
Bram Moolenaar83bab712005-08-01 21:58:57 +00001368 v56: * LocalBrowse now saves autochdir setting, unsets it, and
1369 restores it before returning.
1370 * using vim's rename() instead of system + local_rename variable
Bram Moolenaar1d94f9b2005-08-04 21:29:45 +00001371 * avoids changing directory when g:netrw_keepdir is false
Bram Moolenaar83bab712005-08-01 21:58:57 +00001372 v55: * -bar used with :Explore :Sexplore etc to allow multiple
1373 commands to be separated by |s
1374 * browser listings now use the "nowrap" option
1375 * browser: some unuseful error messages now suppressed
1376 v54: * For backwards compatibility, Explore and Sexplore have been
1377 implemented. In addition, Hexplore and Vexplore commands
1378 are available, too.
1379 * <amatch> used instead of <afile> in the transparency
1380 support (BufReadCmd, FileReadCmd, FileWriteCmd)
1381 * ***netrw*** prepended to various error messages netrw may emit
1382 * g:netrw_port used instead of b:netrw_port for scp
1383 * any leading [:#] is removed from port numbers
1384 v53: * backslashes as well as slashes placed in various patterns
1385 (ex. g:netrw_sort_sequence) to better support Windows
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001386 v52: * nonumber'ing now set for browsing buffers
1387 * when the hiding list hid all files, error messages ensued. Fixed
1388 * when browsing, swf is set, but directory is not set, when netrw
1389 was attempting to restore options, vim wanted to save a swapfile
1390 to a local directory using an url-style path. Fixed
1391 v51: * cygwin detection now automated (using windows and &shell is bash)
1392 * customizable browser "file" rejection patterns
1393 * directory history
1394 * :[range]w url now supported (ie. netrw has a FileWriteCmd event)
1395 * error messages have a "Press <cr> to continue" to allow them
1396 to be seen
1397 * directory browser displays no longer bother the swapfile
1398 * u/U commands to go up and down the history stack
1399 * history stack may be saved with viminfo with its "!" option
1400 * bugfixes associated with unwanted [No Files] entries
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001401 v50: * directories now displayed using buftype=nofile; should keep the
1402 directory names as-is
1403 * attempts to remove empty "[No File]" buffers leftover
1404 from :file ..name.. commands
1405 * bugfix: a "caps-lock" editing difficulty left in v49 was fixed
1406 * syntax highlighting for "Showing:" the hiding list included
1407 * bookmarks can now be retained if "!" is in the viminfo option
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001408 v49: * will use ftp for http://.../ browsing v48:
1409 * One may use ftp to do remote host file browsing
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001410 * (windows and !cygwin) remote browsing with ftp can now use
1411 the "dir" command internally to provide listings
1412 * g:netrw_keepdir now allows one to keep the initial current
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001413 directory as the current directory (normally the local file
1414 browser makes the currently viewed directory the current
1415 directory)
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001416 * g:netrw_alto and g:netrw_altv now support alternate placement
1417 of windows started with o or v
1418 * Nread ? and Nwrite ? now uses echomsg (instead of echo) so
1419 :messages can repeat showing the help
1420 * bugfix: avoids problems with partial matches of directory names
1421 to prior buffers with longer names
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001422 * one can suppress error messages with g:netrw_quiet ctrl-h used
1423 * instead of <Leader>h for editing hiding list one may edit the
1424 * sorting sequence with the S map now allows confirmation of
1425 * deletion with [y(es) n(o) a(ll) q(uit)] the "x" map now handles
1426 * special file viewing with:
1427 (windows) rundll32 url.dll (gnome) gnome-open (kde)
1428 kfmclient If none of these are on the executable path, then
Bram Moolenaar61036992005-10-12 20:54:52 +00001429 netrwFileHandlers.vim is used.
Bram Moolenaarc0197e22004-09-13 20:26:32 +00001430 * directory bookmarking during both local and remote browsing
1431 implemented
1432 * one may view all, use the hiding list to suppress, or use the
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001433 hiding list to show-only remote and local file/directory
1434 listings
1435 * improved unusual file and directory name handling preview
1436 * window support
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001437 v47: * now handles local directory browsing.
1438 v46: * now handles remote directory browsing
1439 * g:netrw_silent (if 1) will cause all transfers to be silent
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001440 v45: * made the [user@]hostname:path form a bit more restrictive to
1441 better handle errors in using protocols (e.g. scp:usr@host:file
1442 was being recognized as an rcp request) v44: * changed from
1443 "rsync -a" to just "rsync"
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001444 * somehow an editing error messed up the test to recognize
1445 use of the fetch method for NetRead.
1446 * more debugging statements included
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001447 v43: * moved "Explanation" comments to <pi_netrw.txt> help file as
1448 "Network Reference" (|netrw-ref|)
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001449 * <netrw.vim> now uses Dfunc() Decho() and Dret() for debugging
1450 * removed superfluous NetRestorePosn() calls
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001451 v42: * now does BufReadPre and BufReadPost events on file:///* and
1452 file://localhost/* v41: * installed file:///* and
1453 file://localhost/* handling v40: * prevents redraw when a
1454 protocol error occurs so that the user may see it v39: * sftp
1455 support v38: * Now uses NetRestorePosn() calls with
1456 Nread/Nwrite commands
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001457 * Temporary files now removed via bwipe! instead of bwipe
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001458 (thanks to Dave Roberts) v37: * Claar's modifications which
1459 test if ftp is successful, otherwise give an error message
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001460 * After a read, the alternate file was pointing to the temp file.
1461 The temp file buffer is now wiped out.
1462 * removed silent from transfer methods so user can see what's
1463 happening
Bram Moolenaar071d4272004-06-13 20:20:40 +00001464
1465
1466==============================================================================
Bram Moolenaarc0197e22004-09-13 20:26:32 +0000146711. Credits *netrw-credits*
Bram Moolenaar071d4272004-06-13 20:20:40 +00001468
1469 Vim editor by Bram Moolenaar (Thanks, Bram!)
1470 dav support by C Campbell
1471 fetch support by Bram Moolenaar and C Campbell
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00001472 ftp support by C Campbell <NdrOchip@ScampbellPfamily.AbizM>
Bram Moolenaar071d4272004-06-13 20:20:40 +00001473 http support by Bram Moolenaar <bram@moolenaar.net>
1474 rcp
1475 rsync support by C Campbell (suggested by Erik Warendorph)
1476 scp support by raf <raf@comdyn.com.au>
1477 sftp support by C Campbell
1478
1479 inputsecret(), BufReadCmd, BufWriteCmd contributed by C Campbell
1480
1481 Jérôme Augé -- also using new buffer method with ftp+.netrc
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00001482 Bram Moolenaar -- obviously vim itself, :e and v:cmdarg use,
1483 fetch,...
Bram Moolenaar071d4272004-06-13 20:20:40 +00001484 Yasuhiro Matsumoto -- pointing out undo+0r problem and a solution
1485 Erik Warendorph -- for several suggestions (g:netrw_..._cmd
1486 variables, rsync etc)
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00001487 Doug Claar -- modifications to test for success with ftp
1488 operation
Bram Moolenaar071d4272004-06-13 20:20:40 +00001489
1490==============================================================================
Bram Moolenaar83bab712005-08-01 21:58:57 +00001491 vim:tw=78:ts=8:ft=help:norl:fdm=marker