blob: 51688b705f84be35c3f36fba8dd9080415b1d20d [file] [log] [blame]
Christian Brabandt721be7f2025-03-26 18:53:46 +01001*netrw.txt* *pi_netrw.txt*
Christian Brabandt5f2a9592025-03-15 10:04:39 +01002
3 ------------------------------------------------
4 NETRW REFERENCE MANUAL by Charles E. Campbell
5 ------------------------------------------------
6Original Author: Charles E. Campbell
7
8Copyright: Copyright (C) 2017 Charles E Campbell *netrw-copyright*
9 The VIM LICENSE applies to the files in this package, including
10 netrw.vim, netrw.txt, netrwSettings.vim, and
11 syntax/netrw.vim. Like anything else that's free, netrw.vim and its
12 associated files are provided *as is* and comes with no warranty of
13 any kind, either expressed or implied. No guarantees of
14 merchantability. No guarantees of suitability for any purpose. By
15 using this plugin, you agree that in no event will the copyright
16 holder be liable for any damages resulting from the use of this
17 software. Use at your own risk! For bug reports, see |bugs|.
18
19 *netrw*
20 *dav* *ftp* *netrw-file* *rcp* *scp*
21 *davs* *http* *netrw.vim* *rsync* *sftp*
22 *fetch* *network*
23
24==============================================================================
251. Contents *netrw-contents* {{{1
26
271. Contents..............................................|netrw-contents|
282. Starting With Netrw...................................|netrw-start|
293. Netrw Reference.......................................|netrw-ref|
30 EXTERNAL APPLICATIONS AND PROTOCOLS.................|netrw-externapp|
31 READING.............................................|netrw-read|
32 WRITING.............................................|netrw-write|
33 SOURCING............................................|netrw-source|
34 DIRECTORY LISTING...................................|netrw-dirlist|
35 CHANGING THE USERID AND PASSWORD....................|netrw-chgup|
36 VARIABLES AND SETTINGS..............................|netrw-variables|
37 PATHS...............................................|netrw-path|
384. Network-Oriented File Transfer........................|netrw-xfer|
39 NETRC...............................................|netrw-netrc|
40 PASSWORD............................................|netrw-passwd|
415. Activation............................................|netrw-activate|
426. Transparent Remote File Editing.......................|netrw-transparent|
437. Ex Commands...........................................|netrw-ex|
448. Variables and Options.................................|netrw-variables|
459. Browsing..............................................|netrw-browse|
46 Introduction To Browsing............................|netrw-intro-browse|
47 Quick Reference: Maps...............................|netrw-browse-maps|
48 Quick Reference: Commands...........................|netrw-browse-cmds|
49 Banner Display......................................|netrw-I|
50 Bookmarking A Directory.............................|netrw-mb|
51 Browsing............................................|netrw-cr|
52 Squeezing the Current Tree-Listing Directory........|netrw-s-cr|
53 Browsing With A Horizontally Split Window...........|netrw-o|
54 Browsing With A New Tab.............................|netrw-t|
55 Browsing With A Vertically Split Window.............|netrw-v|
56 Change Listing Style (thin wide long tree)..........|netrw-i|
57 Changing To A Bookmarked Directory..................|netrw-gb|
58 Quick hide/unhide of dot-files......................|netrw-gh|
59 Changing local-only File Permission.................|netrw-gp|
60 Changing To A Predecessor Directory.................|netrw-u|
61 Changing To A Successor Directory...................|netrw-U|
62 Deleting Bookmarks..................................|netrw-mB|
63 Deleting Files Or Directories.......................|netrw-D|
64 Directory Exploring Commands........................|netrw-explore|
65 Exploring With Stars and Patterns...................|netrw-star|
66 Displaying Information About File...................|netrw-qf|
67 Edit File Or Directory Hiding List..................|netrw-ctrl-h|
68 Editing The Sorting Sequence........................|netrw-S|
69 Forcing treatment as a file or directory............|netrw-gd| |netrw-gf|
70 Going Up............................................|netrw--|
71 Hiding Files Or Directories.........................|netrw-a|
72 Improving Browsing..................................|netrw-ssh-hack|
73 Listing Bookmarks And History.......................|netrw-qb|
74 Making A New Directory..............................|netrw-d|
75 Making The Browsing Directory The Current Directory.|netrw-cd|
76 Marking Files.......................................|netrw-mf|
77 Unmarking Files.....................................|netrw-mF|
78 Marking Files By Location List......................|netrw-qL|
79 Marking Files By QuickFix List......................|netrw-qF|
80 Marking Files By Regular Expression.................|netrw-mr|
81 Marked Files: Arbitrary Shell Command...............|netrw-mx|
82 Marked Files: Arbitrary Shell Command, En Bloc......|netrw-mX|
83 Marked Files: Arbitrary Vim Command.................|netrw-mv|
84 Marked Files: Argument List.........................|netrw-ma| |netrw-mA|
85 Marked Files: Buffer List...........................|netrw-cb| |netrw-cB|
86 Marked Files: Compression And Decompression.........|netrw-mz|
87 Marked Files: Copying...............................|netrw-mc|
88 Marked Files: Diff..................................|netrw-md|
89 Marked Files: Editing...............................|netrw-me|
90 Marked Files: Grep..................................|netrw-mg|
91 Marked Files: Hiding and Unhiding by Suffix.........|netrw-mh|
92 Marked Files: Moving................................|netrw-mm|
93 Marked Files: Printing..............................|netrw-mp|
94 Marked Files: Sourcing..............................|netrw-ms|
95 Marked Files: Setting the Target Directory..........|netrw-mt|
96 Marked Files: Tagging...............................|netrw-mT|
97 Marked Files: Target Directory Using Bookmarks......|netrw-Tb|
98 Marked Files: Target Directory Using History........|netrw-Th|
99 Marked Files: Unmarking.............................|netrw-mu|
100 Netrw Browser Variables.............................|netrw-browser-var|
101 Netrw Browsing And Option Incompatibilities.........|netrw-incompatible|
102 Netrw Settings Window...............................|netrw-settings-window|
103 Obtaining A File....................................|netrw-O|
104 Preview Window......................................|netrw-p|
105 Previous Window.....................................|netrw-P|
106 Refreshing The Listing..............................|netrw-ctrl-l|
107 Reversing Sorting Order.............................|netrw-r|
108 Renaming Files Or Directories.......................|netrw-R|
109 Selecting Sorting Style.............................|netrw-s|
110 Setting Editing Window..............................|netrw-C|
11110. Problems and Fixes....................................|netrw-problems|
11211. Credits...............................................|netrw-credits|
113
114==============================================================================
1152. Starting With Netrw *netrw-start* {{{1
116
117Netrw makes reading files, writing files, browsing over a network, and
118local browsing easy! First, make sure that you have plugins enabled, so
119you'll need to have at least the following in your <.vimrc>:
120(or see |netrw-activate|) >
121
122 set nocp " 'compatible' is not set
123 filetype plugin on " plugins are enabled
124<
125(see |'cp'| and |:filetype-plugin-on|)
126
127Netrw supports "transparent" editing of files on other machines using urls
128(see |netrw-transparent|). As an example of this, let's assume you have an
129account on some other machine; if you can use scp, try: >
130
131 vim scp://hostname/path/to/file
132<
133Want to make ssh/scp easier to use? Check out |netrw-ssh-hack|!
134
135So, what if you have ftp, not ssh/scp? That's easy, too; try >
136
137 vim ftp://hostname/path/to/file
138<
139Want to make ftp simpler to use? See if your ftp supports a file called
140<.netrc> -- typically it goes in your home directory, has read/write
141permissions for only the user to read (ie. not group, world, other, etc),
142and has lines resembling >
143
144 machine HOSTNAME login USERID password "PASSWORD"
145 machine HOSTNAME login USERID password "PASSWORD"
146 ...
147 default login USERID password "PASSWORD"
148<
149Windows' ftp doesn't support .netrc; however, one may have in one's .vimrc: >
150
151 let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\MyUserName\MACHINE'
152<
153Netrw will substitute the host's machine name for "MACHINE" from the URL it is
154attempting to open, and so one may specify >
155 userid
156 password
157for each site in a separate file: c:\Users\MyUserName\MachineName.
158
159Now about browsing -- when you just want to look around before editing a
160file. For browsing on your current host, just "edit" a directory: >
161
162 vim .
163 vim /home/userid/path
164<
165For browsing on a remote host, "edit" a directory (but make sure that
166the directory name is followed by a "/"): >
167
168 vim scp://hostname/
169 vim ftp://hostname/path/to/dir/
170<
171See |netrw-browse| for more!
172
173There are more protocols supported by netrw than just scp and ftp, too: see the
174next section, |netrw-externapp|, on how to use these external applications with
175netrw and vim.
176
177PREVENTING LOADING *netrw-noload*
178
179If you want to use plugins, but for some reason don't wish to use netrw, then
180you need to avoid loading both the plugin and the autoload portions of netrw.
181You may do so by placing the following two lines in your <.vimrc>: >
182
183 :let g:loaded_netrw = 1
184 :let g:loaded_netrwPlugin = 1
185<
186
187==============================================================================
1883. Netrw Reference *netrw-ref* {{{1
189
190 Netrw supports several protocols in addition to scp and ftp as mentioned
191 in |netrw-start|. These include dav, fetch, http,... well, just look
192 at the list in |netrw-externapp|. Each protocol is associated with a
193 variable which holds the default command supporting that protocol.
194
195EXTERNAL APPLICATIONS AND PROTOCOLS *netrw-externapp* {{{2
196
197 Protocol Variable Default Value
198 -------- ---------------- -------------
199 dav: *g:netrw_dav_cmd* = "cadaver" if cadaver is executable
200 dav: g:netrw_dav_cmd = "curl -o" elseif curl is available
201 fetch: *g:netrw_fetch_cmd* = "fetch -o" if fetch is available
202 ftp: *g:netrw_ftp_cmd* = "ftp"
203 http: *g:netrw_http_cmd* = "elinks" if elinks is available
204 http: g:netrw_http_cmd = "links" elseif links is available
205 http: g:netrw_http_cmd = "curl" elseif curl is available
206 http: g:netrw_http_cmd = "wget" elseif wget is available
207 http: g:netrw_http_cmd = "fetch" elseif fetch is available
208 http: *g:netrw_http_put_cmd* = "curl -T"
209 rcp: *g:netrw_rcp_cmd* = "rcp"
210 rsync: *g:netrw_rsync_cmd* = "rsync" (see |g:netrw_rsync_sep|)
211 scp: *g:netrw_scp_cmd* = "scp -q"
212 sftp: *g:netrw_sftp_cmd* = "sftp"
213 file: *g:netrw_file_cmd* = "elinks" or "links"
214
215 *g:netrw_http_xcmd* : the option string for http://... protocols are
216 specified via this variable and may be independently overridden. By
217 default, the option arguments for the http-handling commands are: >
218
219 elinks : "-source >"
220 links : "-dump >"
221 curl : "-L -o"
222 wget : "-q -O"
223 fetch : "-o"
224<
225 For example, if your system has elinks, and you'd rather see the
226 page using an attempt at rendering the text, you may wish to have >
227 let g:netrw_http_xcmd= "-dump >"
228< in your .vimrc.
229
230 g:netrw_http_put_cmd: this option specifies both the executable and
231 any needed options. This command does a PUT operation to the url.
232
233
234READING *netrw-read* *netrw-nread* {{{2
235
236 Generally, one may just use the URL notation with a normal editing
237 command, such as >
238
239 :e ftp://[user@]machine/path
240<
241 Netrw also provides the Nread command:
242
243 :Nread ? give help
244 :Nread "machine:path" uses rcp
245 :Nread "machine path" uses ftp w/ <.netrc>
246 :Nread "machine id password path" uses ftp
247 :Nread "dav://machine[:port]/path" uses cadaver
248 :Nread "fetch://[user@]machine/path" uses fetch
249 :Nread "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc>
250 :Nread "http://[user@]machine/path" uses http uses wget
251 :Nread "rcp://[user@]machine/path" uses rcp
252 :Nread "rsync://[user@]machine[:port]/path" uses rsync
253 :Nread "scp://[user@]machine[[:#]port]/path" uses scp
254 :Nread "sftp://[user@]machine/path" uses sftp
255
256WRITING *netrw-write* *netrw-nwrite* {{{2
257
258 One may just use the URL notation with a normal file writing
259 command, such as >
260
261 :w ftp://[user@]machine/path
262<
263 Netrw also provides the Nwrite command:
264
265 :Nwrite ? give help
266 :Nwrite "machine:path" uses rcp
267 :Nwrite "machine path" uses ftp w/ <.netrc>
268 :Nwrite "machine id password path" uses ftp
269 :Nwrite "dav://machine[:port]/path" uses cadaver
270 :Nwrite "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc>
271 :Nwrite "rcp://[user@]machine/path" uses rcp
272 :Nwrite "rsync://[user@]machine[:port]/path" uses rsync
273 :Nwrite "scp://[user@]machine[[:#]port]/path" uses scp
274 :Nwrite "sftp://[user@]machine/path" uses sftp
275 http: not supported!
276
277SOURCING *netrw-source* {{{2
278
279 One may just use the URL notation with the normal file sourcing
280 command, such as >
281
282 :so ftp://[user@]machine/path
283<
284 Netrw also provides the Nsource command:
285
286 :Nsource ? give help
287 :Nsource "dav://machine[:port]/path" uses cadaver
288 :Nsource "fetch://[user@]machine/path" uses fetch
289 :Nsource "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc>
290 :Nsource "http://[user@]machine/path" uses http uses wget
291 :Nsource "rcp://[user@]machine/path" uses rcp
292 :Nsource "rsync://[user@]machine[:port]/path" uses rsync
293 :Nsource "scp://[user@]machine[[:#]port]/path" uses scp
294 :Nsource "sftp://[user@]machine/path" uses sftp
295
296DIRECTORY LISTING *netrw-trailingslash* *netrw-dirlist* {{{2
297
298 One may browse a directory to get a listing by simply attempting to
299 edit the directory: >
300
301 :e scp://[user]@hostname/path/
302 :e ftp://[user]@hostname/path/
303<
304 For remote directory listings (ie. those using scp or ftp), that
305 trailing "/" is necessary (the slash tells netrw to treat the argument
306 as a directory to browse instead of as a file to download).
307
308 The Nread command may also be used to accomplish this (again, that
309 trailing slash is necessary): >
310
311 :Nread [protocol]://[user]@hostname/path/
312<
313 *netrw-login* *netrw-password*
314CHANGING USERID AND PASSWORD *netrw-chgup* *netrw-userpass* {{{2
315
316 Attempts to use ftp will prompt you for a user-id and a password.
317 These will be saved in global variables |g:netrw_uid| and
318 |s:netrw_passwd|; subsequent use of ftp will re-use those two strings,
319 thereby simplifying use of ftp. However, if you need to use a
320 different user id and/or password, you'll want to call |NetUserPass()|
321 first. To work around the need to enter passwords, check if your ftp
322 supports a <.netrc> file in your home directory. Also see
323 |netrw-passwd| (and if you're using ssh/scp hoping to figure out how
324 to not need to use passwords for scp, look at |netrw-ssh-hack|).
325
326 :NetUserPass [uid [password]] -- prompts as needed
327 :call NetUserPass() -- prompts for uid and password
328 :call NetUserPass("uid") -- prompts for password
329 :call NetUserPass("uid","password") -- sets global uid and password
330
331(Related topics: |ftp| |netrw-userpass| |netrw-start|)
332
333NETRW VARIABLES AND SETTINGS *netrw-variables* {{{2
334 (Also see:
335 |netrw-browser-var| : netrw browser option variables
336 |netrw-protocol| : file transfer protocol option variables
337 |netrw-settings| : additional file transfer options
338 |netrw-browser-options| : these options affect browsing directories
339 )
340
341Netrw provides a lot of variables which allow you to customize netrw to your
342preferences. One way to look at them is via the command :NetrwSettings (see
343|netrw-settings|) which will display your current netrw settings. Most such
344settings are described below, in |netrw-browser-options|, and in
345|netrw-externapp|:
346
347 *b:netrw_lastfile* last file Network-read/written retained on a
348 per-buffer basis (supports plain :Nw )
349
350 *g:netrw_bufsettings* the settings that netrw buffers have
351 (default) noma nomod nonu nowrap ro nobl
352
353 *g:netrw_chgwin* specifies a window number where subsequent file edits
354 will take place. (also see |netrw-C|)
355 (default) -1
356
357 *g:Netrw_funcref* specifies a function (or functions) to be called when
358 netrw edits a file. The file is first edited, and
359 then the function reference (|Funcref|) is called.
360 This variable may also hold a |List| of Funcrefs.
361 (default) not defined. (the capital in g:Netrw...
362 is required by its holding a function reference)
363>
364 Example: place in .vimrc; affects all file opening
365 fun! MyFuncRef()
366 endfun
367 let g:Netrw_funcref= function("MyFuncRef")
368
369<
370 *g:Netrw_UserMaps* specifies a function or |List| of functions which can
371 be used to set up user-specified maps and functionality.
372 See |netrw-usermaps|
373
374 *g:netrw_ftp* if it doesn't exist, use default ftp
375 =0 use default ftp (uid password)
376 =1 use alternate ftp method (user uid password)
377 If you're having trouble with ftp, try changing the
378 value of this variable to see if the alternate ftp
379 method works for your setup.
380
381 *g:netrw_ftp_options* Chosen by default, these options are supposed to
382 turn interactive prompting off and to restrain ftp
383 from attempting auto-login upon initial connection.
384 However, it appears that not all ftp implementations
385 support this (ex. ncftp).
386 ="-i -n"
387
388 *g:netrw_ftpextracmd* default: doesn't exist
389 If this variable exists, then any string it contains
390 will be placed into the commands set to your ftp
391 client. As an example:
392 ="passive"
393
394 *g:netrw_ftpmode* ="binary" (default)
395 ="ascii"
396
397 *g:netrw_ignorenetrc* =0 (default for linux, cygwin)
398 =1 If you have a <.netrc> file but it doesn't work and
399 you want it ignored, then set this variable as
400 shown. (default for Windows + cmd.exe)
401
402 *g:netrw_menu* =0 disable netrw's menu
403 =1 (default) netrw's menu enabled
404
405 *g:netrw_uid* (ftp) user-id, retained on a per-vim-session basis
406 *s:netrw_passwd* (ftp) password, retained on a per-vim-session basis
407
408 *g:netrw_preview* =0 (default) preview window shown in a horizontally
409 split window
410 =1 preview window shown in a vertically split window.
411 Also affects the "previous window" (see |netrw-P|)
412 in the same way.
413 The |g:netrw_alto| variable may be used to provide
414 additional splitting control:
415 g:netrw_preview g:netrw_alto result
416 0 0 |:aboveleft|
417 0 1 |:belowright|
418 1 0 |:topleft|
419 1 1 |:botright|
420 To control sizing, see |g:netrw_winsize|
421
422 *g:netrw_scpport* = "-P" : option to use to set port for scp
423 *g:netrw_sshport* = "-p" : option to use to set port for ssh
424
425 *g:netrw_sepchr* =\0xff
426 =\0x01 for enc == euc-jp (and perhaps it should be for
427 others, too, please let me know)
428 Separates priority codes from filenames internally.
429 See |netrw-p12|.
430
431 *g:netrw_silent* =0 : transfers done normally
432 =1 : transfers done silently
433
Christian Brabandt5f2a9592025-03-15 10:04:39 +0100434 *g:netrw_cygwin* =1 assume scp under windows is from cygwin. Also
435 permits network browsing to use ls with time and
436 size sorting (default if windows)
437 =0 assume Windows' scp accepts windows-style paths
438 Network browsing uses dir instead of ls
439 This option is ignored if you're using unix
440
441 *g:netrw_use_nt_rcp* =0 don't use the rcp of WinNT, Win2000 and WinXP
442 =1 use WinNT's rcp in binary mode (default)
443
444PATHS *netrw-path* {{{2
445
446Paths to files are generally user-directory relative for most protocols.
447It is possible that some protocol will make paths relative to some
448associated directory, however.
449>
450 example: vim scp://user@host/somefile
451 example: vim scp://user@host/subdir1/subdir2/somefile
452<
453where "somefile" is in the "user"'s home directory. If you wish to get a
454file using root-relative paths, use the full path:
455>
456 example: vim scp://user@host//somefile
457 example: vim scp://user@host//subdir1/subdir2/somefile
458<
459
460==============================================================================
4614. Network-Oriented File Transfer *netrw-xfer* {{{1
462
463Network-oriented file transfer under Vim is implemented by a vim script
464(<netrw.vim>) using plugin techniques. It currently supports both reading and
465writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch,
466dav/cadaver, rsync, or sftp.
467
468http is currently supported read-only via use of wget or fetch.
469
470<netrw.vim> is a standard plugin which acts as glue between Vim and the
471various file transfer programs. It uses autocommand events (BufReadCmd,
472FileReadCmd, BufWriteCmd) to intercept reads/writes with url-like filenames. >
473
474 ex. vim ftp://hostname/path/to/file
475<
476The characters preceding the colon specify the protocol to use; in the
477example, it's ftp. The <netrw.vim> script then formulates a command or a
478series of commands (typically ftp) which it issues to an external program
479(ftp, scp, etc) which does the actual file transfer/protocol. Files are read
480from/written to a temporary file (under Unix/Linux, /tmp/...) which the
481<netrw.vim> script will clean up.
482
483Now, a word about Jan Minář's "FTP User Name and Password Disclosure"; first,
484ftp is not a secure protocol. User names and passwords are transmitted "in
485the clear" over the internet; any snooper tool can pick these up; this is not
486a netrw thing, this is a ftp thing. If you're concerned about this, please
487try to use scp or sftp instead.
488
489Netrw re-uses the user id and password during the same vim session and so long
490as the remote hostname remains the same.
491
492Jan seems to be a bit confused about how netrw handles ftp; normally multiple
493commands are performed in a "ftp session", and he seems to feel that the
494uid/password should only be retained over one ftp session. However, netrw
495does every ftp operation in a separate "ftp session"; so remembering the
496uid/password for just one "ftp session" would be the same as not remembering
497the uid/password at all. IMHO this would rapidly grow tiresome as one
498browsed remote directories, for example.
499
500On the other hand, thanks go to Jan M. for pointing out the many
501vulnerabilities that netrw (and vim itself) had had in handling "crafted"
502filenames. The |shellescape()| and |fnameescape()| functions were written in
503response by Bram Moolenaar to handle these sort of problems, and netrw has
504been modified to use them. Still, my advice is, if the "filename" looks like
505a vim command that you aren't comfortable with having executed, don't open it.
506
507 *netrw-putty* *netrw-pscp* *netrw-psftp*
508One may modify any protocol's implementing external application by setting a
509variable (ex. scp uses the variable g:netrw_scp_cmd, which is defaulted to
510"scp -q"). As an example, consider using PuTTY: >
511
512 let g:netrw_scp_cmd = '"c:\Program Files\PuTTY\pscp.exe" -q -batch'
513 let g:netrw_sftp_cmd= '"c:\Program Files\PuTTY\psftp.exe"'
514<
515(note: it has been reported that windows 7 with putty v0.6's "-batch" option
516 doesn't work, so its best to leave it off for that system)
517
518See |netrw-p8| for more about putty, pscp, psftp, etc.
519
520Ftp, an old protocol, seems to be blessed by numerous implementations.
521Unfortunately, some implementations are noisy (ie., add junk to the end of the
522file). Thus, concerned users may decide to write a NetReadFixup() function
523that will clean up after reading with their ftp. Some Unix systems (ie.,
524FreeBSD) provide a utility called "fetch" which uses the ftp protocol but is
525not noisy and more convenient, actually, for <netrw.vim> to use.
526Consequently, if "fetch" is available (ie. executable), it may be preferable
527to use it for ftp://... based transfers.
528
529For rcp, scp, sftp, and http, one may use network-oriented file transfers
530transparently; ie.
531>
532 vim rcp://[user@]machine/path
533 vim scp://[user@]machine/path
534<
535If your ftp supports <.netrc>, then it too can be transparently used
536if the needed triad of machine name, user id, and password are present in
537that file. Your ftp must be able to use the <.netrc> file on its own, however.
538>
539 vim ftp://[user@]machine[[:#]portnumber]/path
540<
541Windows provides an ftp (typically c:\Windows\System32\ftp.exe) which uses
542an option, -s:filename (filename can and probably should be a full path)
543which contains ftp commands which will be automatically run whenever ftp
544starts. You may use this feature to enter a user and password for one site: >
545 userid
546 password
547< *netrw-windows-netrc* *netrw-windows-s*
548If |g:netrw_ftp_cmd| contains -s:[path/]MACHINE, then (on Windows machines
549only) netrw will substitute the current machine name requested for ftp
550connections for MACHINE. Hence one can have multiple machine.ftp files
551containing login and password for ftp. Example: >
552
553 let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\Myself\MACHINE'
554 vim ftp://myhost.somewhere.net/
555
556will use a file >
557
558 C:\Users\Myself\myhost.ftp
559<
560Often, ftp will need to query the user for the userid and password.
561The latter will be done "silently"; ie. asterisks will show up instead of
562the actually-typed-in password. Netrw will retain the userid and password
563for subsequent read/writes from the most recent transfer so subsequent
564transfers (read/write) to or from that machine will take place without
565additional prompting.
566
567 *netrw-urls*
568 +=================================+============================+============+
569 | Reading | Writing | Uses |
570 +=================================+============================+============+
571 | DAV: | | |
572 | dav://host/path | | cadaver |
573 | :Nread dav://host/path | :Nwrite dav://host/path | cadaver |
574 +---------------------------------+----------------------------+------------+
575 | DAV + SSL: | | |
576 | davs://host/path | | cadaver |
577 | :Nread davs://host/path | :Nwrite davs://host/path | cadaver |
578 +---------------------------------+----------------------------+------------+
579 | FETCH: | | |
580 | fetch://[user@]host/path | | |
581 | fetch://[user@]host:http/path | Not Available | fetch |
582 | :Nread fetch://[user@]host/path| | |
583 +---------------------------------+----------------------------+------------+
584 | FILE: | | |
585 | file:///* | file:///* | |
586 | file://localhost/* | file://localhost/* | |
587 +---------------------------------+----------------------------+------------+
588 | FTP: (*3) | (*3) | |
589 | ftp://[user@]host/path | ftp://[user@]host/path | ftp (*2) |
590 | :Nread ftp://host/path | :Nwrite ftp://host/path | ftp+.netrc |
591 | :Nread host path | :Nwrite host path | ftp+.netrc |
592 | :Nread host uid pass path | :Nwrite host uid pass path | ftp |
593 +---------------------------------+----------------------------+------------+
594 | HTTP: wget is executable: (*4) | | |
595 | http://[user@]host/path | Not Available | wget |
596 +---------------------------------+----------------------------+------------+
597 | HTTP: fetch is executable (*4) | | |
598 | http://[user@]host/path | Not Available | fetch |
599 +---------------------------------+----------------------------+------------+
600 | RCP: | | |
601 | rcp://[user@]host/path | rcp://[user@]host/path | rcp |
602 +---------------------------------+----------------------------+------------+
603 | RSYNC: | | |
604 | rsync://[user@]host/path | rsync://[user@]host/path | rsync |
605 | :Nread rsync://host/path | :Nwrite rsync://host/path | rsync |
606 | :Nread rcp://host/path | :Nwrite rcp://host/path | rcp |
607 +---------------------------------+----------------------------+------------+
608 | SCP: | | |
609 | scp://[user@]host/path | scp://[user@]host/path | scp |
610 | :Nread scp://host/path | :Nwrite scp://host/path | scp (*1) |
611 +---------------------------------+----------------------------+------------+
612 | SFTP: | | |
613 | sftp://[user@]host/path | sftp://[user@]host/path | sftp |
614 | :Nread sftp://host/path | :Nwrite sftp://host/path | sftp (*1) |
615 +=================================+============================+============+
616
617 (*1) For an absolute path use scp://machine//path.
618
619 (*2) if <.netrc> is present, it is assumed that it will
620 work with your ftp client. Otherwise the script will
621 prompt for user-id and password.
622
623 (*3) for ftp, "machine" may be machine#port or machine:port
624 if a different port is needed than the standard ftp port
625
626 (*4) for http:..., if wget is available it will be used. Otherwise,
627 if fetch is available it will be used.
628
629Both the :Nread and the :Nwrite ex-commands can accept multiple filenames.
630
631
632NETRC *netrw-netrc*
633
634The <.netrc> file, typically located in your home directory, contains lines
635therein which map a hostname (machine name) to the user id and password you
636prefer to use with it.
637
638The typical syntax for lines in a <.netrc> file is given as shown below.
639Ftp under Unix usually supports <.netrc>; ftp under Windows usually doesn't.
640>
641 machine {full machine name} login {user-id} password "{password}"
642 default login {user-id} password "{password}"
643
644Your ftp client must handle the use of <.netrc> on its own, but if the
645<.netrc> file exists, an ftp transfer will not ask for the user-id or
646password.
647
648 Note:
649 Since this file contains passwords, make very sure nobody else can
650 read this file! Most programs will refuse to use a .netrc that is
651 readable for others. Don't forget that the system administrator can
652 still read the file! Ie. for Linux/Unix: chmod 600 .netrc
653
654Even though Windows' ftp clients typically do not support .netrc, netrw has
655a work-around: see |netrw-windows-s|.
656
657
658PASSWORD *netrw-passwd*
659
660The script attempts to get passwords for ftp invisibly using |inputsecret()|,
661a built-in Vim function. See |netrw-userpass| for how to change the password
662after one has set it.
663
664Unfortunately there doesn't appear to be a way for netrw to feed a password to
665scp. Thus every transfer via scp will require re-entry of the password.
666However, |netrw-ssh-hack| can help with this problem.
667
668
669==============================================================================
6705. Activation *netrw-activate* {{{1
671
672Network-oriented file transfers are available by default whenever Vim's
673|'nocompatible'| mode is enabled. Netrw's script files reside in your
674system's plugin, autoload, and syntax directories; just the
675plugin/netrwPlugin.vim script is sourced automatically whenever you bring up
676vim. The main script in autoload/netrw.vim is only loaded when you actually
677use netrw. I suggest that, at a minimum, you have at least the following in
678your <.vimrc> customization file: >
679
680 set nocp
681 if version >= 600
682 filetype plugin indent on
683 endif
684<
685By also including the following lines in your .vimrc, one may have netrw
686immediately activate when using [g]vim without any filenames, showing the
687current directory: >
688
689 " Augroup VimStartup:
690 augroup VimStartup
691 au!
692 au VimEnter * if expand("%") == "" | e . | endif
693 augroup END
694<
695
696==============================================================================
6976. Transparent Remote File Editing *netrw-transparent* {{{1
698
699Transparent file transfers occur whenever a regular file read or write
700(invoked via an |:autocmd| for |BufReadCmd|, |BufWriteCmd|, or |SourceCmd|
701events) is made. Thus one may read, write, or source files across networks
702just as easily as if they were local files! >
703
704 vim ftp://[user@]machine/path
705 ...
706 :wq
707
708See |netrw-activate| for more on how to encourage your vim to use plugins
709such as netrw.
710
711For password-free use of scp:, see |netrw-ssh-hack|.
712
713
714==============================================================================
7157. Ex Commands *netrw-ex* {{{1
716
717The usual read/write commands are supported. There are also a few
718additional commands available. Often you won't need to use Nwrite or
719Nread as shown in |netrw-transparent| (ie. simply use >
720 :e URL
721 :r URL
722 :w URL
723instead, as appropriate) -- see |netrw-urls|. In the explanations
724below, a {netfile} is a URL to a remote file.
725
726 *:Nwrite* *:Nw*
727:[range]Nw[rite] Write the specified lines to the current
728 file as specified in b:netrw_lastfile.
729 (related: |netrw-nwrite|)
730
731:[range]Nw[rite] {netfile} [{netfile}]...
732 Write the specified lines to the {netfile}.
733
734 *:Nread* *:Nr*
735:Nr[ead] Read the lines from the file specified in b:netrw_lastfile
736 into the current buffer. (related: |netrw-nread|)
737
738:Nr[ead] {netfile} {netfile}...
739 Read the {netfile} after the current line.
740
741 *:Nsource* *:Ns*
742:Ns[ource] {netfile}
743 Source the {netfile}.
744 To start up vim using a remote .vimrc, one may use
745 the following (all on one line) (tnx to Antoine Mechelynck) >
746 vim -u NORC -N
747 --cmd "runtime plugin/netrwPlugin.vim"
748 --cmd "source scp://HOSTNAME/.vimrc"
749< (related: |netrw-source|)
750
751:call NetUserPass() *NetUserPass()*
752 If g:netrw_uid and s:netrw_passwd don't exist,
753 this function will query the user for them.
754 (related: |netrw-userpass|)
755
756:call NetUserPass("userid")
757 This call will set the g:netrw_uid and, if
758 the password doesn't exist, will query the user for it.
759 (related: |netrw-userpass|)
760
761:call NetUserPass("userid","passwd")
762 This call will set both the g:netrw_uid and s:netrw_passwd.
763 The user-id and password are used by ftp transfers. One may
764 effectively remove the user-id and password by using empty
765 strings (ie. "").
766 (related: |netrw-userpass|)
767
768:NetrwSettings This command is described in |netrw-settings| -- used to
769 display netrw settings and change netrw behavior.
770
771
772==============================================================================
7738. Variables and Options *netrw-var* *netrw-settings* {{{1
774
775(also see: |netrw-options| |netrw-variables| |netrw-protocol|
776 |netrw-browser-settings| |netrw-browser-options| )
777
778The <netrw.vim> script provides several variables which act as options to
779affect <netrw.vim>'s file transfer behavior. These variables typically may be
780set in the user's <.vimrc> file: (see also |netrw-settings| |netrw-protocol|)
781 *netrw-options*
782>
783 -------------
784 Netrw Options
785 -------------
786 Option Meaning
787 -------------- -----------------------------------------------
788<
789 b:netrw_col Holds current cursor position (during NetWrite)
790 g:netrw_cygwin =1 assume scp under windows is from cygwin
791 (default/windows)
792 =0 assume scp under windows accepts windows
793 style paths (default/else)
794 g:netrw_ftp =0 use default ftp (uid password)
795 g:netrw_ftpmode ="binary" (default)
796 ="ascii" (your choice)
797 g:netrw_ignorenetrc =1 (default)
798 if you have a <.netrc> file but you don't
799 want it used, then set this variable. Its
800 mere existence is enough to cause <.netrc>
801 to be ignored.
802 b:netrw_lastfile Holds latest method/machine/path.
803 b:netrw_line Holds current line number (during NetWrite)
804 g:netrw_silent =0 transfers done normally
805 =1 transfers done silently
806 g:netrw_uid Holds current user-id for ftp.
807 g:netrw_use_nt_rcp =0 don't use WinNT/2K/XP's rcp (default)
808 =1 use WinNT/2K/XP's rcp, binary mode
809 -----------------------------------------------------------------------
810<
811 *netrw-internal-variables*
812The script will also make use of the following variables internally, albeit
813temporarily.
814>
815 -------------------
816 Temporary Variables
817 -------------------
818 Variable Meaning
819 -------- ------------------------------------
820<
821 b:netrw_method Index indicating rcp/ftp+.netrc/ftp
822 w:netrw_method (same as b:netrw_method)
823 g:netrw_machine Holds machine name parsed from input
824 b:netrw_fname Holds filename being accessed >
825 ------------------------------------------------------------
826<
827 *netrw-protocol*
828
829Netrw supports a number of protocols. These protocols are invoked using the
830variables listed below, and may be modified by the user.
831>
832 ------------------------
833 Protocol Control Options
834 ------------------------
835 Option Type Setting Meaning
836 --------- -------- -------------- ---------------------------
837< netrw_ftp variable =doesn't exist userid set by "user userid"
838 =0 userid set by "user userid"
839 =1 userid set by "userid"
840 NetReadFixup function =doesn't exist no change
841 =exists Allows user to have files
842 read via ftp automatically
843 transformed however they wish
844 by NetReadFixup()
845 g:netrw_dav_cmd var ="cadaver" if cadaver is executable
846 g:netrw_dav_cmd var ="curl -o" elseif curl is executable
847 g:netrw_fetch_cmd var ="fetch -o" if fetch is available
848 g:netrw_ftp_cmd var ="ftp"
849 g:netrw_http_cmd var ="fetch -o" if fetch is available
850 g:netrw_http_cmd var ="wget -O" else if wget is available
851 g:netrw_http_put_cmd var ="curl -T"
852 |g:netrw_list_cmd| var ="ssh USEPORT HOSTNAME ls -Fa"
853 g:netrw_rcp_cmd var ="rcp"
854 g:netrw_rsync_cmd var ="rsync"
855 *g:netrw_rsync_sep* var ="/" used to separate the hostname
856 from the file spec
857 g:netrw_scp_cmd var ="scp -q"
858 g:netrw_sftp_cmd var ="sftp" >
859 -------------------------------------------------------------------------
860<
861 *netrw-ftp*
862
863The g:netrw_..._cmd options (|g:netrw_ftp_cmd| and |g:netrw_sftp_cmd|)
864specify the external program to use handle the ftp protocol. They may
865include command line options (such as -p for passive mode). Example: >
866
867 let g:netrw_ftp_cmd= "ftp -p"
868<
869Browsing is supported by using the |g:netrw_list_cmd|; the substring
870"HOSTNAME" will be changed via substitution with whatever the current request
871is for a hostname.
872
873Two options (|g:netrw_ftp| and |netrw-fixup|) both help with certain ftp's
874that give trouble . In order to best understand how to use these options if
875ftp is giving you troubles, a bit of discussion is provided on how netrw does
876ftp reads.
877
878For ftp, netrw typically builds up lines of one of the following formats in a
879temporary file:
880>
881 IF g:netrw_ftp !exists or is not 1 IF g:netrw_ftp exists and is 1
882 ---------------------------------- ------------------------------
883<
884 open machine [port] open machine [port]
885 user userid password userid password
886 [g:netrw_ftpmode] password
887 [g:netrw_ftpextracmd] [g:netrw_ftpmode]
888 get filename tempfile [g:netrw_extracmd]
889 get filename tempfile >
890 ---------------------------------------------------------------------
891<
892The |g:netrw_ftpmode| and |g:netrw_ftpextracmd| are optional.
893
894Netrw then executes the lines above by use of a filter:
895>
896 :%! {g:netrw_ftp_cmd} -i [-n]
897<
898where
899 g:netrw_ftp_cmd is usually "ftp",
900 -i tells ftp not to be interactive
901 -n means don't use netrc and is used for Method #3 (ftp w/o <.netrc>)
902
903If <.netrc> exists it will be used to avoid having to query the user for
904userid and password. The transferred file is put into a temporary file.
905The temporary file is then read into the main editing session window that
906requested it and the temporary file deleted.
907
908If your ftp doesn't accept the "user" command and immediately just demands a
909userid, then try putting "let netrw_ftp=1" in your <.vimrc>.
910
911 *netrw-cadaver*
912To handle the SSL certificate dialog for untrusted servers, one may pull
913down the certificate and place it into /usr/ssl/cert.pem. This operation
914renders the server treatment as "trusted".
915
916 *netrw-fixup* *netreadfixup*
917If your ftp for whatever reason generates unwanted lines (such as AUTH
918messages) you may write a NetReadFixup() function:
919>
920 function! NetReadFixup(method,line1,line2)
921 " a:line1: first new line in current file
922 " a:line2: last new line in current file
923 if a:method == 1 "rcp
924 elseif a:method == 2 "ftp + <.netrc>
925 elseif a:method == 3 "ftp + machine,uid,password,filename
926 elseif a:method == 4 "scp
927 elseif a:method == 5 "http/wget
928 elseif a:method == 6 "dav/cadaver
929 elseif a:method == 7 "rsync
930 elseif a:method == 8 "fetch
931 elseif a:method == 9 "sftp
932 else " complain
933 endif
934 endfunction
935>
936The NetReadFixup() function will be called if it exists and thus allows you to
937customize your reading process.
938
939(Related topics: |ftp| |netrw-userpass| |netrw-start|)
940
941==============================================================================
9429. Browsing *netrw-browsing* *netrw-browse* *netrw-help* {{{1
943 *netrw-browser* *netrw-dir* *netrw-list*
944
945INTRODUCTION TO BROWSING *netrw-intro-browse* {{{2
946 (Quick References: |netrw-quickmaps| |netrw-quickcoms|)
947
948Netrw supports the browsing of directories on your local system and on remote
949hosts; browsing includes listing files and directories, entering directories,
950editing files therein, deleting files/directories, making new directories,
951moving (renaming) files and directories, copying files and directories, etc.
952One may mark files and execute any system command on them! The Netrw browser
953generally implements the previous explorer's maps and commands for remote
954directories, although details (such as pertinent global variable names)
955necessarily differ. To browse a directory, simply "edit" it! >
956
957 vim /your/directory/
958 vim .
959 vim c:\your\directory\
960<
961(Related topics: |netrw-cr| |netrw-o| |netrw-p| |netrw-P| |netrw-t|
962 |netrw-mf| |netrw-mx| |netrw-D| |netrw-R| |netrw-v| )
963
964The Netrw remote file and directory browser handles two protocols: ssh and
965ftp. The protocol in the url, if it is ftp, will cause netrw also to use ftp
966in its remote browsing. Specifying any other protocol will cause it to be
967used for file transfers; but the ssh protocol will be used to do remote
968browsing.
969
970To use Netrw's remote directory browser, simply attempt to read a "file" with
971a trailing slash and it will be interpreted as a request to list a directory:
972>
973 vim [protocol]://[user@]hostname/path/
974<
975where [protocol] is typically scp or ftp. As an example, try: >
976
977 vim ftp://ftp.home.vim.org/pub/vim/
978<
979For local directories, the trailing slash is not required. Again, because it's
980easy to miss: to browse remote directories, the URL must terminate with a
981slash!
982
983If you'd like to avoid entering the password repeatedly for remote directory
984listings with ssh or scp, see |netrw-ssh-hack|. To avoid password entry with
985ftp, see |netrw-netrc| (if your ftp supports it).
986
987There are several things you can do to affect the browser's display of files:
988
989 * To change the listing style, press the "i" key (|netrw-i|).
990 Currently there are four styles: thin, long, wide, and tree.
991 To make that change "permanent", see |g:netrw_liststyle|.
992
993 * To hide files (don't want to see those xyz~ files anymore?) see
994 |netrw-ctrl-h|.
995
996 * Press s to sort files by name, time, or size.
997
998See |netrw-browse-cmds| for all the things you can do with netrw!
999
1000 *netrw-getftype* *netrw-filigree* *netrw-ftype*
1001The |getftype()| function is used to append a bit of filigree to indicate
1002filetype to locally listed files:
1003
1004 directory : /
1005 executable : *
1006 fifo : |
1007 links : @
1008 sockets : =
1009
1010The filigree also affects the |g:netrw_sort_sequence|.
1011
1012
1013QUICK HELP *netrw-quickhelp* {{{2
1014 (Use ctrl-] to select a topic)~
1015 Intro to Browsing...............................|netrw-intro-browse|
1016 Quick Reference: Maps.........................|netrw-quickmap|
1017 Quick Reference: Commands.....................|netrw-browse-cmds|
1018 Hiding
1019 Edit hiding list..............................|netrw-ctrl-h|
1020 Hiding Files or Directories...................|netrw-a|
1021 Hiding/Unhiding by suffix.....................|netrw-mh|
1022 Hiding dot-files.............................|netrw-gh|
1023 Listing Style
1024 Select listing style (thin/long/wide/tree)....|netrw-i|
1025 Associated setting variable...................|g:netrw_liststyle|
1026 Shell command used to perform listing.........|g:netrw_list_cmd|
1027 Quick file info...............................|netrw-qf|
1028 Sorted by
1029 Select sorting style (name/time/size).........|netrw-s|
1030 Editing the sorting sequence..................|netrw-S|
1031 Sorting options...............................|g:netrw_sort_options|
1032 Associated setting variable...................|g:netrw_sort_sequence|
1033 Reverse sorting order.........................|netrw-r|
1034
1035
1036 *netrw-quickmap* *netrw-quickmaps*
1037QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2
1038>
1039 --- ----------------- ----
1040 Map Quick Explanation Link
1041 --- ----------------- ----
1042< <F1> Causes Netrw to issue help
1043 <cr> Netrw will enter the directory or read the file |netrw-cr|
1044 <del> Netrw will attempt to remove the file/directory |netrw-del|
1045 <c-h> Edit file hiding list |netrw-ctrl-h|
1046 <c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l|
1047 <c-r> Browse using a gvim server |netrw-ctrl-r|
1048 <c-tab> Shrink/expand a netrw/explore window |netrw-c-tab|
1049 - Makes Netrw go up one directory |netrw--|
1050 a Cycles between normal display, |netrw-a|
1051 hiding (suppress display of files matching g:netrw_list_hide)
1052 and showing (display only files which match g:netrw_list_hide)
1053 cd Make browsing directory the current directory |netrw-cd|
1054 C Setting the editing window |netrw-C|
1055 d Make a directory |netrw-d|
1056 D Attempt to remove the file(s)/directory(ies) |netrw-D|
1057 gb Go to previous bookmarked directory |netrw-gb|
1058 gd Force treatment as directory |netrw-gd|
1059 gf Force treatment as file |netrw-gf|
1060 gh Quick hide/unhide of dot-files |netrw-gh|
1061 gn Make top of tree the directory below the cursor |netrw-gn|
1062 gp Change local-only file permissions |netrw-gp|
1063 i Cycle between thin, long, wide, and tree listings |netrw-i|
1064 I Toggle the displaying of the banner |netrw-I|
1065 mb Bookmark current directory |netrw-mb|
1066 mc Copy marked files to marked-file target directory |netrw-mc|
1067 md Apply diff to marked files (up to 3) |netrw-md|
1068 me Place marked files on arg list and edit them |netrw-me|
1069 mf Mark a file |netrw-mf|
1070 mF Unmark files |netrw-mF|
1071 mg Apply vimgrep to marked files |netrw-mg|
1072 mh Toggle marked file suffices' presence on hiding list |netrw-mh|
1073 mm Move marked files to marked-file target directory |netrw-mm|
1074 mp Print marked files |netrw-mp|
1075 mr Mark files using a shell-style |regexp| |netrw-mr|
1076 mt Current browsing directory becomes markfile target |netrw-mt|
1077 mT Apply ctags to marked files |netrw-mT|
1078 mu Unmark all marked files |netrw-mu|
1079 mv Apply arbitrary vim command to marked files |netrw-mv|
1080 mx Apply arbitrary shell command to marked files |netrw-mx|
1081 mX Apply arbitrary shell command to marked files en bloc|netrw-mX|
1082 mz Compress/decompress marked files |netrw-mz|
1083 o Enter the file/directory under the cursor in a new |netrw-o|
1084 browser window. A horizontal split is used.
1085 O Obtain a file specified by cursor |netrw-O|
1086 p Preview the file |netrw-p|
1087 P Browse in the previously used window |netrw-P|
1088 qb List bookmarked directories and history |netrw-qb|
1089 qf Display information on file |netrw-qf|
1090 qF Mark files using a quickfix list |netrw-qF|
1091 qL Mark files using a |location-list| |netrw-qL|
1092 r Reverse sorting order |netrw-r|
1093 R Rename the designated file(s)/directory(ies) |netrw-R|
1094 s Select sorting style: by name, time, or file size |netrw-s|
1095 S Specify suffix priority for name-sorting |netrw-S|
1096 t Enter the file/directory under the cursor in a new tab|netrw-t|
1097 u Change to recently-visited directory |netrw-u|
1098 U Change to subsequently-visited directory |netrw-U|
1099 v Enter the file/directory under the cursor in a new |netrw-v|
1100 browser window. A vertical split is used.
1101 x View file with an associated program |:Open|
1102 X Execute filename under cursor via |system()| |netrw-X|
1103
1104 % Open a new file in netrw's current directory |netrw-%|
1105
1106 *netrw-mouse* *netrw-leftmouse* *netrw-middlemouse* *netrw-rightmouse*
1107 <leftmouse> (gvim only) selects word under mouse as if a <cr>
1108 had been pressed (ie. edit file, change directory)
1109 <middlemouse> (gvim only) same as P selecting word under mouse;
1110 see |netrw-P|
1111 <rightmouse> (gvim only) delete file/directory using word under
1112 mouse
1113 <2-leftmouse> (gvim only) when:
1114 * in a netrw-selected file, AND
1115 * |g:netrw_retmap| == 1 AND
1116 * the user doesn't already have a <2-leftmouse>
1117 mapping defined before netrw is autoloaded,
1118 then a double clicked leftmouse button will return
1119 to the netrw browser window. See |g:netrw_retmap|.
1120 <s-leftmouse> (gvim only) like mf, will mark files. Dragging
1121 the shifted leftmouse will mark multiple files.
1122 (see |netrw-mf|)
1123
1124 (to disable mouse buttons while browsing: |g:netrw_mousemaps|)
1125
1126 *netrw-quickcom* *netrw-quickcoms*
1127QUICK REFERENCE: COMMANDS *netrw-explore-cmds* *netrw-browse-cmds* {{{2
1128 :NetrwSettings............................................|netrw-settings|
1129 :Ntree....................................................|netrw-ntree|
1130 :Explore[!] [dir] Explore directory of current file......|netrw-explore|
1131 :Hexplore[!] [dir] Horizontal Split & Explore.............|netrw-explore|
1132 :Lexplore[!] [dir] Left Explorer Toggle...................|netrw-explore|
1133 :Nexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
1134 :Pexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
1135 :Rexplore Return to Explorer.....................|netrw-explore|
1136 :Sexplore[!] [dir] Split & Explore directory .............|netrw-explore|
1137 :Texplore[!] [dir] Tab & Explore..........................|netrw-explore|
1138 :Vexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
1139
1140
1141BANNER DISPLAY *netrw-I*
1142
1143One may toggle the displaying of the banner by pressing "I".
1144
1145Also See: |g:netrw_banner|
1146
1147
1148BOOKMARKING A DIRECTORY *netrw-mb* *netrw-bookmark* *netrw-bookmarks* {{{2
1149
1150One may easily "bookmark" the currently browsed directory by using >
1151
1152 mb
1153<
1154 *.netrwbook*
1155Bookmarks are retained in between sessions of vim in a file called .netrwbook
1156as a |List|, which is typically stored in the first directory on the user's
1157'runtimepath'; entries are kept in sorted order.
1158
1159If there are marked files and/or directories, mb will add them to the bookmark
1160list.
1161
1162 *netrw-:NetrwMB*
1163Additionally, one may use :NetrwMB to bookmark files or directories. >
1164
1165 :NetrwMB[!] [files/directories]
1166
1167< No bang: enters files/directories into Netrw's bookmark system
1168
1169 No argument and in netrw buffer:
1170 if there are marked files : bookmark marked files
1171 otherwise : bookmark file/directory under cursor
1172 No argument and not in netrw buffer: bookmarks current open file
1173 Has arguments : |glob()|s each arg and bookmarks them
1174
1175 With bang: deletes files/directories from Netrw's bookmark system
1176
1177The :NetrwMB command is available outside of netrw buffers (once netrw has been
1178invoked in the session).
1179
1180The file ".netrwbook" holds bookmarks when netrw (and vim) is not active. By
1181default, its stored on the first directory on the user's |'runtimepath'|.
1182
1183Related Topics:
1184 |netrw-gb| how to return (go) to a bookmark
1185 |netrw-mB| how to delete bookmarks
1186 |netrw-qb| how to list bookmarks
1187 |g:netrw_home| controls where .netrwbook is kept
1188
1189
1190BROWSING *netrw-enter* *netrw-cr* {{{2
1191
1192Browsing is simple: move the cursor onto a file or directory of interest.
1193Hitting the <cr> (the return key) will select the file or directory.
1194Directories will themselves be listed, and files will be opened using the
1195protocol given in the original read request.
1196
1197 CAVEAT: There are four forms of listing (see |netrw-i|). Netrw assumes that
1198 two or more spaces delimit filenames and directory names for the long and
1199 wide listing formats. Thus, if your filename or directory name has two or
1200 more sequential spaces embedded in it, or any trailing spaces, then you'll
1201 need to use the "thin" format to select it.
1202
1203The |g:netrw_browse_split| option, which is zero by default, may be used to
1204cause the opening of files to be done in a new window or tab instead of the
1205default. When the option is one or two, the splitting will be taken
1206horizontally or vertically, respectively. When the option is set to three, a
1207<cr> will cause the file to appear in a new tab.
1208
1209
1210When using the gui (gvim), one may select a file by pressing the <leftmouse>
1211button. In addition, if
1212
1213 * |g:netrw_retmap| == 1 AND (its default value is 0)
1214 * in a netrw-selected file, AND
1215 * the user doesn't already have a <2-leftmouse> mapping defined before
1216 netrw is loaded
1217
1218then a doubly-clicked leftmouse button will return to the netrw browser
1219window.
1220
1221Netrw attempts to speed up browsing, especially for remote browsing where one
1222may have to enter passwords, by keeping and re-using previously obtained
1223directory listing buffers. The |g:netrw_fastbrowse| variable is used to
1224control this behavior; one may have slow browsing (no buffer re-use), medium
1225speed browsing (re-use directory buffer listings only for remote directories),
1226and fast browsing (re-use directory buffer listings as often as possible).
1227The price for such re-use is that when changes are made (such as new files
1228are introduced into a directory), the listing may become out-of-date. One may
1229always refresh directory listing buffers by pressing ctrl-L (see
1230|netrw-ctrl-l|).
1231
1232 *netrw-s-cr*
1233Squeezing the Current Tree-Listing Directory~
1234
1235When the tree listing style is enabled (see |netrw-i|) and one is using
1236gvim, then the <s-cr> mapping may be used to squeeze (close) the
1237directory currently containing the cursor.
1238
1239Otherwise, one may remap a key combination of one's own choice to get
1240this effect: >
1241
1242 nmap <buffer> <silent> <nowait> YOURKEYCOMBO <Plug>NetrwTreeSqueeze
1243<
1244Put this line in $HOME/ftplugin/netrw/netrw.vim; it needs to be generated
1245for netrw buffers only.
1246
1247Related topics:
1248 |netrw-ctrl-r| |netrw-o| |netrw-p|
1249 |netrw-P| |netrw-t| |netrw-v|
1250Associated setting variables:
1251 |g:netrw_browse_split| |g:netrw_fastbrowse|
1252 |g:netrw_ftp_list_cmd| |g:netrw_ftp_sizelist_cmd|
1253 |g:netrw_ftp_timelist_cmd| |g:netrw_ssh_browse_reject|
1254 |g:netrw_ssh_cmd| |g:netrw_use_noswf|
1255
1256
1257BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o* *netrw-horiz* {{{2
1258
1259Normally one enters a file or directory using the <cr>. However, the "o" map
1260allows one to open a new window to hold the new directory listing or file. A
1261horizontal split is used. (for vertical splitting, see |netrw-v|)
1262
1263Normally, the o key splits the window horizontally with the new window and
1264cursor at the top.
1265
1266Associated setting variables: |g:netrw_alto| |g:netrw_winsize|
1267
1268Related topics:
1269 |netrw-ctrl-r| |netrw-o| |netrw-p|
1270 |netrw-P| |netrw-t| |netrw-v|
1271Associated setting variables:
1272 |g:netrw_alto| control above/below splitting
1273 |g:netrw_winsize| control initial sizing
1274
1275BROWSING WITH A NEW TAB *netrw-t* {{{2
1276
1277Normally one enters a file or directory using the <cr>. The "t" map
1278allows one to open a new window holding the new directory listing or file in
1279a new tab.
1280
1281If you'd like to have the new listing in a background tab, use |gT|.
1282
1283Related topics:
1284 |netrw-ctrl-r| |netrw-o| |netrw-p|
1285 |netrw-P| |netrw-t| |netrw-v|
1286Associated setting variables:
1287 |g:netrw_winsize| control initial sizing
1288
1289BROWSING WITH A VERTICALLY SPLIT WINDOW *netrw-v* {{{2
1290
1291Normally one enters a file or directory using the <cr>. However, the "v" map
1292allows one to open a new window to hold the new directory listing or file. A
1293vertical split is used. (for horizontal splitting, see |netrw-o|)
1294
1295Normally, the v key splits the window vertically with the new window and
1296cursor at the left.
1297
1298There is only one tree listing buffer; using "v" on a displayed subdirectory
1299will split the screen, but the same buffer will be shown twice.
1300
1301Related topics:
1302 |netrw-ctrl-r| |netrw-o| |netrw-p|
1303 |netrw-P| |netrw-t| |netrw-v|
1304Associated setting variables:
1305 |g:netrw_altv| control right/left splitting
1306 |g:netrw_winsize| control initial sizing
1307
1308
1309BROWSING USING A GVIM SERVER *netrw-ctrl-r* {{{2
1310
1311One may keep a browsing gvim separate from the gvim being used to edit.
1312Use the <c-r> map on a file (not a directory) in the netrw browser, and it
1313will use a gvim server (see |g:netrw_servername|). Subsequent use of <cr>
1314(see |netrw-cr|) will re-use that server for editing files.
1315
1316Related topics:
1317 |netrw-ctrl-r| |netrw-o| |netrw-p|
1318 |netrw-P| |netrw-t| |netrw-v|
1319Associated setting variables:
1320 |g:netrw_servername| : sets name of server
1321 |g:netrw_browse_split| : controls how <cr> will open files
1322
1323
1324CHANGE LISTING STYLE (THIN LONG WIDE TREE) *netrw-i* {{{2
1325
1326The "i" map cycles between the thin, long, wide, and tree listing formats.
1327
1328The thin listing format gives just the files' and directories' names.
1329
1330The long listing is either based on the "ls" command via ssh for remote
1331directories or displays the filename, file size (in bytes), and the time and
1332date of last modification for local directories. With the long listing
1333format, netrw is not able to recognize filenames which have trailing spaces.
1334Use the thin listing format for such files.
1335
1336The wide listing format uses two or more contiguous spaces to delineate
1337filenames; when using that format, netrw won't be able to recognize or use
1338filenames which have two or more contiguous spaces embedded in the name or any
1339trailing spaces. The thin listing format will, however, work with such files.
1340The wide listing format is the most compact.
1341
1342The tree listing format has a top directory followed by files and directories
1343preceded by one or more "|"s, which indicate the directory depth. One may
1344open and close directories by pressing the <cr> key while atop the directory
1345name.
1346
1347One may make a preferred listing style your default; see |g:netrw_liststyle|.
1348As an example, by putting the following line in your .vimrc, >
1349 let g:netrw_liststyle= 3
1350the tree style will become your default listing style.
1351
1352One typical way to use the netrw tree display is to: >
1353
1354 vim .
1355 (use i until a tree display shows)
1356 navigate to a file
1357 v (edit as desired in vertically split window)
1358 ctrl-w h (to return to the netrw listing)
1359 P (edit newly selected file in the previous window)
1360 ctrl-w h (to return to the netrw listing)
1361 P (edit newly selected file in the previous window)
1362 ...etc...
1363<
1364Associated setting variables: |g:netrw_liststyle| |g:netrw_maxfilenamelen|
1365 |g:netrw_timefmt| |g:netrw_list_cmd|
1366
1367CHANGE FILE PERMISSION *netrw-gp* {{{2
1368
1369"gp" will ask you for a new permission for the file named under the cursor.
1370Currently, this only works for local files.
1371
1372Associated setting variables: |g:netrw_chgperm|
1373
1374
1375CHANGING TO A BOOKMARKED DIRECTORY *netrw-gb* {{{2
1376
1377To change directory back to a bookmarked directory, use
1378
1379 {cnt}gb
1380
1381Any count may be used to reference any of the bookmarks.
1382Note that |netrw-qb| shows both bookmarks and history; to go
1383to a location stored in the history see |netrw-u| and |netrw-U|.
1384
1385Related Topics:
1386 |netrw-mB| how to delete bookmarks
1387 |netrw-mb| how to make a bookmark
1388 |netrw-qb| how to list bookmarks
1389
1390
1391CHANGING TO A PREDECESSOR DIRECTORY *netrw-u* *netrw-updir* {{{2
1392
1393Every time you change to a new directory (new for the current session), netrw
1394will save the directory in a recently-visited directory history list (unless
1395|g:netrw_dirhistmax| is zero; by default, it holds ten entries). With the "u"
1396map, one can change to an earlier directory (predecessor). To do the
1397opposite, see |netrw-U|.
1398
1399The "u" map also accepts counts to go back in the history several slots. For
1400your convenience, qb (see |netrw-qb|) lists the history number which may be
1401used in that count.
1402
1403 *.netrwhist*
1404See |g:netrw_dirhistmax| for how to control the quantity of history stack
1405slots. The file ".netrwhist" holds history when netrw (and vim) is not
1406active. By default, its stored on the first directory on the user's
1407|'runtimepath'|.
1408
1409Related Topics:
1410 |netrw-U| changing to a successor directory
1411 |g:netrw_home| controls where .netrwhist is kept
1412
1413
1414CHANGING TO A SUCCESSOR DIRECTORY *netrw-U* *netrw-downdir* {{{2
1415
1416With the "U" map, one can change to a later directory (successor).
1417This map is the opposite of the "u" map. (see |netrw-u|) Use the
1418qb map to list both the bookmarks and history. (see |netrw-qb|)
1419
1420The "U" map also accepts counts to go forward in the history several slots.
1421
1422See |g:netrw_dirhistmax| for how to control the quantity of history stack
1423slots.
1424
1425
1426CHANGING TREE TOP *netrw-ntree* *:Ntree* *netrw-gn* {{{2
1427
1428One may specify a new tree top for tree listings using >
1429
1430 :Ntree [dirname]
1431
1432Without a "dirname", the current line is used (and any leading depth
1433information is elided).
1434With a "dirname", the specified directory name is used.
1435
1436The "gn" map will take the word below the cursor and use that for
1437changing the top of the tree listing.
1438
1439 *netrw-curdir*
1440DELETING BOOKMARKS *netrw-mB* {{{2
1441
1442To delete a bookmark, use >
1443
1444 {cnt}mB
1445
1446If there are marked files, then mB will remove them from the
1447bookmark list.
1448
1449Alternatively, one may use :NetrwMB! (see |netrw-:NetrwMB|). >
1450
1451 :NetrwMB! [files/directories]
1452
1453Related Topics:
1454 |netrw-gb| how to return (go) to a bookmark
1455 |netrw-mb| how to make a bookmark
1456 |netrw-qb| how to list bookmarks
1457
1458
1459DELETING FILES OR DIRECTORIES *netrw-delete* *netrw-D* *netrw-del* {{{2
1460
1461If files have not been marked with |netrw-mf|: (local marked file list)
1462
1463 Deleting/removing files and directories involves moving the cursor to the
1464 file/directory to be deleted and pressing "D". Directories must be empty
1465 first before they can be successfully removed. If the directory is a
1466 softlink to a directory, then netrw will make two requests to remove the
1467 directory before succeeding. Netrw will ask for confirmation before doing
1468 the removal(s). You may select a range of lines with the "V" command
1469 (visual selection), and then pressing "D".
1470
1471If files have been marked with |netrw-mf|: (local marked file list)
1472
1473 Marked files (and empty directories) will be deleted; again, you'll be
1474 asked to confirm the deletion before it actually takes place.
1475
1476A further approach is to delete files which match a pattern.
1477
1478 * use :MF pattern (see |netrw-:MF|); then press "D".
1479
1480 * use mr (see |netrw-mr|) which will prompt you for pattern.
1481 This will cause the matching files to be marked. Then,
1482 press "D".
1483
1484Please note that only empty directories may be deleted with the "D" mapping.
1485Regular files are deleted with |delete()|, too.
1486
1487The |g:netrw_rm_cmd|, |g:netrw_rmf_cmd|, and |g:netrw_rmdir_cmd| variables are
1488used to control the attempts to remove remote files and directories. The
1489g:netrw_rm_cmd is used with files, and its default value is:
1490
1491 g:netrw_rm_cmd: ssh HOSTNAME rm
1492
1493The g:netrw_rmdir_cmd variable is used to support the removal of directories.
1494Its default value is:
1495
1496 |g:netrw_rmdir_cmd|: ssh HOSTNAME rmdir
1497
1498If removing a directory fails with g:netrw_rmdir_cmd, netrw then will attempt
1499to remove it again using the g:netrw_rmf_cmd variable. Its default value is:
1500
1501 |g:netrw_rmf_cmd|: ssh HOSTNAME rm -f
1502
1503Related topics: |netrw-d|
1504Associated setting variable: |g:netrw_rm_cmd| |g:netrw_ssh_cmd|
1505
1506
1507*netrw-explore* *netrw-hexplore* *netrw-nexplore* *netrw-pexplore*
1508*netrw-rexplore* *netrw-sexplore* *netrw-texplore* *netrw-vexplore* *netrw-lexplore*
1509DIRECTORY EXPLORATION COMMANDS {{{2
1510
1511 :[N]Explore[!] [dir]... Explore directory of current file *:Explore*
1512 :[N]Hexplore[!] [dir]... Horizontal Split & Explore *:Hexplore*
1513 :[N]Lexplore[!] [dir]... Left Explorer Toggle *:Lexplore*
1514 :[N]Sexplore[!] [dir]... Split&Explore current file's directory *:Sexplore*
1515 :[N]Vexplore[!] [dir]... Vertical Split & Explore *:Vexplore*
1516 :Texplore [dir]... Tab & Explore *:Texplore*
1517 :Rexplore ... Return to/from Explorer *:Rexplore*
1518
1519 Used with :Explore **/pattern : (also see |netrw-starstar|)
1520 :Nexplore............. go to next matching file *:Nexplore*
1521 :Pexplore............. go to previous matching file *:Pexplore*
1522
1523 *netrw-:Explore*
1524:Explore will open the local-directory browser on the current file's
1525 directory (or on directory [dir] if specified). The window will be
1526 split only if the file has been modified and |'hidden'| is not set,
1527 otherwise the browsing window will take over that window. Normally
1528 the splitting is taken horizontally.
1529 Also see: |netrw-:Rexplore|
1530:Explore! is like :Explore, but will use vertical splitting.
1531
1532 *netrw-:Hexplore*
1533:Hexplore [dir] does an :Explore with |:belowright| horizontal splitting.
1534:Hexplore! [dir] does an :Explore with |:aboveleft| horizontal splitting.
1535
1536 *netrw-:Lexplore*
1537:[N]Lexplore [dir] toggles a full height Explorer window on the left hand side
1538 of the current tab. It will open a netrw window on the current
1539 directory if [dir] is omitted; a :Lexplore [dir] will show the
1540 specified directory in the left-hand side browser display no matter
1541 from which window the command is issued.
1542
1543 By default, :Lexplore will change an uninitialized |g:netrw_chgwin|
1544 to 2; edits will thus preferentially be made in window#2.
1545
1546 The [N] specifies a |g:netrw_winsize| just for the new :Lexplore
1547 window. That means that
1548 if [N] < 0 : use |N| columns for the Lexplore window
1549 if [N] = 0 : a normal split is made
1550 if [N] > 0 : use N% of the current window will be used for the
1551 new window
1552
1553 Those who like this method often also like tree style displays;
1554 see |g:netrw_liststyle|.
1555
1556:[N]Lexplore! [dir] is similar to :Lexplore, except that the full-height
1557 Explorer window will open on the right hand side and an
1558 uninitialized |g:netrw_chgwin| will be set to 1 (eg. edits will
1559 preferentially occur in the leftmost window).
1560
1561 Also see: |netrw-C| |g:netrw_browse_split| |g:netrw_wiw|
1562 |netrw-p| |netrw-P| |g:netrw_chgwin|
1563 |netrw-c-tab| |g:netrw_winsize|
1564
1565 *netrw-:Sexplore*
1566:[N]Sexplore will always split the window before invoking the local-directory
1567 browser. As with Explore, the splitting is normally done
1568 horizontally.
1569:[N]Sexplore! [dir] is like :Sexplore, but the splitting will be done vertically.
1570
1571 *netrw-:Texplore*
1572:Texplore [dir] does a |:tabnew| before generating the browser window
1573
1574 *netrw-:Vexplore*
1575:[N]Vexplore [dir] does an :Explore with |:leftabove| vertical splitting.
1576:[N]Vexplore! [dir] does an :Explore with |:rightbelow| vertical splitting.
1577
1578The optional parameters are:
1579
1580 [N]: This parameter will override |g:netrw_winsize| to specify the quantity of
1581 rows and/or columns the new explorer window should have.
1582 Otherwise, the |g:netrw_winsize| variable, if it has been specified by the
1583 user, is used to control the quantity of rows and/or columns new
1584 explorer windows should have.
1585
1586 [dir]: By default, these explorer commands use the current file's directory.
1587 However, one may explicitly provide a directory (path) to use instead;
1588 ie. >
1589
1590 :Explore /some/path
1591<
1592 *netrw-:Rexplore*
1593:Rexplore This command is a little different from the other Explore commands
1594 as it doesn't necessarily open an Explorer window.
1595
1596 Return to Explorer~
1597 When one edits a file using netrw which can occur, for example,
1598 when pressing <cr> while the cursor is atop a filename in a netrw
1599 browser window, a :Rexplore issued while editing that file will
1600 return the display to that of the last netrw browser display in
1601 that window.
1602
1603 Return from Explorer~
1604 Conversely, when one is editing a directory, issuing a :Rexplore
1605 will return to editing the file that was last edited in that
1606 window.
1607
1608 The <2-leftmouse> map (which is only available under gvim and
1609 cooperative terms) does the same as :Rexplore.
1610
1611Also see: |g:netrw_alto| |g:netrw_altv| |g:netrw_winsize|
1612
1613
1614*netrw-star* *netrw-starpat* *netrw-starstar* *netrw-starstarpat* *netrw-grep*
1615EXPLORING WITH STARS AND PATTERNS {{{2
1616
1617When Explore, Sexplore, Hexplore, or Vexplore are used with one of the
1618following four patterns Explore generates a list of files which satisfy the
1619request for the local file system. These exploration patterns will not work
1620with remote file browsing.
1621
1622 */filepat files in current directory which satisfy filepat
1623 **/filepat files in current directory or below which satisfy the
1624 file pattern
1625 *//pattern files in the current directory which contain the
1626 pattern (vimgrep is used)
1627 **//pattern files in the current directory or below which contain
1628 the pattern (vimgrep is used)
1629<
1630The cursor will be placed on the first file in the list. One may then
1631continue to go to subsequent files on that list via |:Nexplore| or to
1632preceding files on that list with |:Pexplore|. Explore will update the
1633directory and place the cursor appropriately.
1634
1635A plain >
1636 :Explore
1637will clear the explore list.
1638
1639If your console or gui produces recognizable shift-up or shift-down sequences,
1640then you'll likely find using shift-downarrow and shift-uparrow convenient.
1641They're mapped by netrw as follows:
1642
1643 <s-down> == Nexplore, and
1644 <s-up> == Pexplore.
1645
1646As an example, consider
1647>
1648 :Explore */*.c
1649 :Nexplore
1650 :Nexplore
1651 :Pexplore
1652<
1653The status line will show, on the right hand side of the status line, a
1654message like "Match 3 of 20".
1655
1656Associated setting variables:
1657 |g:netrw_keepdir| |g:netrw_browse_split|
1658 |g:netrw_fastbrowse| |g:netrw_ftp_browse_reject|
1659 |g:netrw_ftp_list_cmd| |g:netrw_ftp_sizelist_cmd|
1660 |g:netrw_ftp_timelist_cmd| |g:netrw_list_cmd|
1661 |g:netrw_liststyle|
1662
1663
1664DISPLAYING INFORMATION ABOUT FILE *netrw-qf* {{{2
1665
1666With the cursor atop a filename, pressing "qf" will reveal the file's size
1667and last modification timestamp. Currently this capability is only available
1668for local files.
1669
1670
1671EDIT FILE OR DIRECTORY HIDING LIST *netrw-ctrl-h* *netrw-edithide* {{{2
1672
1673The "<ctrl-h>" map brings up a requestor allowing the user to change the
1674file/directory hiding list contained in |g:netrw_list_hide|. The hiding list
1675consists of one or more patterns delimited by commas. Files and/or
1676directories satisfying these patterns will either be hidden (ie. not shown) or
1677be the only ones displayed (see |netrw-a|).
1678
1679The "gh" mapping (see |netrw-gh|) quickly alternates between the usual
1680hiding list and the hiding of files or directories that begin with ".".
1681
1682As an example, >
1683 let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+'
1684Effectively, this makes the effect of a |netrw-gh| command the initial setting.
1685What it means:
1686
1687 \(^\|\s\s\) : if the line begins with the following, -or-
1688 two consecutive spaces are encountered
1689 \zs : start the hiding match now
1690 \. : if it now begins with a dot
1691 \S\+ : and is followed by one or more non-whitespace
1692 characters
1693
1694Associated setting variables: |g:netrw_hide| |g:netrw_list_hide|
1695Associated topics: |netrw-a| |netrw-gh| |netrw-mh|
1696
1697 *netrw-sort-sequence*
1698EDITING THE SORTING SEQUENCE *netrw-S* *netrw-sortsequence* {{{2
1699
1700When "Sorted by" is name, one may specify priority via the sorting sequence
1701(g:netrw_sort_sequence). The sorting sequence typically prioritizes the
1702name-listing by suffix, although any pattern will do. Patterns are delimited
1703by commas. The default sorting sequence is (all one line):
1704
1705For Unix: >
1706 '[\/]$,\<core\%(\.\d\+\)\=,\.[a-np-z]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,
1707 \.info$,\.swp$,\.bak$,\~$'
1708<
1709Otherwise: >
1710 '[\/]$,\.[a-np-z]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,
1711 \.swp$,\.bak$,\~$'
1712<
1713The lone * is where all filenames not covered by one of the other patterns
1714will end up. One may change the sorting sequence by modifying the
1715g:netrw_sort_sequence variable (either manually or in your <.vimrc>) or by
1716using the "S" map.
1717
1718Related topics: |netrw-s| |netrw-S|
1719Associated setting variables: |g:netrw_sort_sequence| |g:netrw_sort_options|
1720
1721
1722EXECUTING FILE UNDER CURSOR VIA SYSTEM() *netrw-X* {{{2
1723
1724Pressing X while the cursor is atop an executable file will yield a prompt
1725using the filename asking for any arguments. Upon pressing a [return], netrw
1726will then call |system()| with that command and arguments. The result will be
1727displayed by |:echomsg|, and so |:messages| will repeat display of the result.
1728Ansi escape sequences will be stripped out.
1729
1730See |cmdline-window| for directions for more on how to edit the arguments.
1731
1732
1733FORCING TREATMENT AS A FILE OR DIRECTORY *netrw-gd* *netrw-gf* {{{2
1734
1735Remote symbolic links (ie. those listed via ssh or ftp) are problematic
1736in that it is difficult to tell whether they link to a file or to a
1737directory.
1738
1739To force treatment as a file: use >
1740 gf
1741<
1742To force treatment as a directory: use >
1743 gd
1744<
1745
1746GOING UP *netrw--* {{{2
1747
1748To go up a directory, press "-" or press the <cr> when atop the ../ directory
1749entry in the listing.
1750
1751Netrw will use the command in |g:netrw_list_cmd| to perform the directory
1752listing operation after changing HOSTNAME to the host specified by the
1753user-prpvided url. By default netrw provides the command as: >
1754
1755 ssh HOSTNAME ls -FLa
1756<
1757where the HOSTNAME becomes the [user@]hostname as requested by the attempt to
1758read. Naturally, the user may override this command with whatever is
1759preferred. The NetList function which implements remote browsing
1760expects that directories will be flagged by a trailing slash.
1761
1762
1763HIDING FILES OR DIRECTORIES *netrw-a* *netrw-hiding* {{{2
1764
1765Netrw's browsing facility allows one to use the hiding list in one of three
1766ways: ignore it, hide files which match, and show only those files which
1767match.
1768
1769If no files have been marked via |netrw-mf|:
1770
1771The "a" map allows the user to cycle through the three hiding modes.
1772
1773The |g:netrw_list_hide| variable holds a comma delimited list of patterns
1774based on regular expressions (ex. ^.*\.obj$,^\.) which specify the hiding list.
1775(also see |netrw-ctrl-h|) To set the hiding list, use the <c-h> map. As an
1776example, to hide files which begin with a ".", one may use the <c-h> map to
1777set the hiding list to '^\..*' (or one may put let g:netrw_list_hide= '^\..*'
1778in one's <.vimrc>). One may then use the "a" key to show all files, hide
1779matching files, or to show only the matching files.
1780
1781 Example: \.[ch]$
1782 This hiding list command will hide/show all *.c and *.h files.
1783
1784 Example: \.c$,\.h$
1785 This hiding list command will also hide/show all *.c and *.h
1786 files.
1787
1788Don't forget to use the "a" map to select the mode (normal/hiding/show) you
1789want!
1790
1791If files have been marked using |netrw-mf|, then this command will:
1792
1793 if showing all files or non-hidden files:
1794 modify the g:netrw_list_hide list by appending the marked files to it
1795 and showing only non-hidden files.
1796
1797 else if showing hidden files only:
1798 modify the g:netrw_list_hide list by removing the marked files from it
1799 and showing only non-hidden files.
1800 endif
1801
1802 *netrw-gh* *netrw-hide*
1803As a quick shortcut, one may press >
1804 gh
1805to toggle between hiding files which begin with a period (dot) and not hiding
1806them.
1807
1808Associated setting variables: |g:netrw_list_hide| |g:netrw_hide|
1809Associated topics: |netrw-a| |netrw-ctrl-h| |netrw-mh|
1810
1811 *netrw-gitignore*
1812Netrw provides a helper function 'netrw_gitignore#Hide()' that, when used with
1813|g:netrw_list_hide| automatically hides all git-ignored files.
1814
1815'netrw_gitignore#Hide' searches for patterns in the following files: >
1816
1817 './.gitignore'
1818 './.git/info/exclude'
1819 global gitignore file: `git config --global core.excludesfile`
1820 system gitignore file: `git config --system core.excludesfile`
1821<
1822Files that do not exist, are ignored.
1823Git-ignore patterns are taken from existing files, and converted to patterns for
1824hiding files. For example, if you had '*.log' in your '.gitignore' file, it
1825would be converted to '.*\.log'.
1826
1827To use this function, simply assign its output to |g:netrw_list_hide| option. >
1828
1829 Example: let g:netrw_list_hide= netrw_gitignore#Hide()
1830 Git-ignored files are hidden in Netrw.
1831
1832 Example: let g:netrw_list_hide= netrw_gitignore#Hide('my_gitignore_file')
1833 Function can take additional files with git-ignore patterns.
1834
1835 Example: let g:netrw_list_hide= netrw_gitignore#Hide() .. '.*\.swp$'
1836 Combining 'netrw_gitignore#Hide' with custom patterns.
1837<
1838
1839IMPROVING BROWSING *netrw-listhack* *netrw-ssh-hack* {{{2
1840
1841Especially with the remote directory browser, constantly entering the password
1842is tedious.
1843
1844For Linux/Unix systems, the book "Linux Server Hacks - 100 industrial strength
1845tips & tools" by Rob Flickenger (O'Reilly, ISBN 0-596-00461-3) gives a tip
1846for setting up no-password ssh and scp and discusses associated security
1847issues. It used to be available at http://hacks.oreilly.com/pub/h/66 ,
1848but apparently that address is now being redirected to some "hackzine".
1849I'll attempt a summary based on that article and on a communication from
1850Ben Schmidt:
1851
1852 1. Generate a public/private key pair on the local machine
1853 (ssh client): >
1854 ssh-keygen -t rsa
1855 (saving the file in ~/.ssh/id_rsa as prompted)
1856<
1857 2. Just hit the <CR> when asked for passphrase (twice) for no
1858 passphrase. If you do use a passphrase, you will also need to use
1859 ssh-agent so you only have to type the passphrase once per session.
1860 If you don't use a passphrase, simply logging onto your local
1861 computer or getting access to the keyfile in any way will suffice
1862 to access any ssh servers which have that key authorized for login.
1863
1864 3. This creates two files: >
1865 ~/.ssh/id_rsa
1866 ~/.ssh/id_rsa.pub
1867<
1868 4. On the target machine (ssh server): >
1869 cd
1870 mkdir -p .ssh
1871 chmod 0700 .ssh
1872<
1873 5. On your local machine (ssh client): (one line) >
1874 ssh {serverhostname}
1875 cat '>>' '~/.ssh/authorized_keys2' < ~/.ssh/id_rsa.pub
1876<
1877 or, for OpenSSH, (one line) >
1878 ssh {serverhostname}
1879 cat '>>' '~/.ssh/authorized_keys' < ~/.ssh/id_rsa.pub
1880<
1881You can test it out with >
1882 ssh {serverhostname}
1883and you should be log onto the server machine without further need to type
1884anything.
1885
1886If you decided to use a passphrase, do: >
1887 ssh-agent $SHELL
1888 ssh-add
1889 ssh {serverhostname}
1890You will be prompted for your key passphrase when you use ssh-add, but not
1891subsequently when you use ssh. For use with vim, you can use >
1892 ssh-agent vim
1893and, when next within vim, use >
1894 :!ssh-add
1895Alternatively, you can apply ssh-agent to the terminal you're planning on
1896running vim in: >
1897 ssh-agent xterm &
1898and do ssh-add whenever you need.
1899
1900For Windows, folks on the vim mailing list have mentioned that Pageant helps
1901with avoiding the constant need to enter the password.
1902
1903Kingston Fung wrote about another way to avoid constantly needing to enter
1904passwords:
1905
1906 In order to avoid the need to type in the password for scp each time, you
1907 provide a hack in the docs to set up a non password ssh account. I found a
1908 better way to do that: I can use a regular ssh account which uses a
1909 password to access the material without the need to key-in the password
1910 each time. It's good for security and convenience. I tried ssh public key
1911 authorization + ssh-agent, implementing this, and it works!
1912
1913
1914 Ssh hints:
1915
1916 Thomer Gil has provided a hint on how to speed up netrw+ssh:
1917 http://thomer.com/howtos/netrw_ssh.html
1918
1919 Alex Young has several hints on speeding ssh up:
1920 http://usevim.com/2012/03/16/editing-remote-files/
1921
1922
1923LISTING BOOKMARKS AND HISTORY *netrw-qb* *netrw-listbookmark* {{{2
1924
1925Pressing "qb" (query bookmarks) will list both the bookmarked directories and
1926directory traversal history.
1927
1928Related Topics:
1929 |netrw-gb| how to return (go) to a bookmark
1930 |netrw-mb| how to make a bookmark
1931 |netrw-mB| how to delete bookmarks
1932 |netrw-u| change to a predecessor directory via the history stack
1933 |netrw-U| change to a successor directory via the history stack
1934
1935MAKING A NEW DIRECTORY *netrw-d* {{{2
1936
1937With the "d" map one may make a new directory either remotely (which depends
1938on the global variable g:netrw_mkdir_cmd) or locally (which depends on the
1939global variable g:netrw_localmkdir). Netrw will issue a request for the new
1940directory's name. A bare <CR> at that point will abort the making of the
1941directory. Attempts to make a local directory that already exists (as either
1942a file or a directory) will be detected, reported on, and ignored.
1943
1944Related topics: |netrw-D|
1945Associated setting variables: |g:netrw_localmkdir| |g:netrw_mkdir_cmd|
1946 |g:netrw_remote_mkdir| |netrw-%|
1947
1948
1949MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-cd* {{{2
1950
1951By default, |g:netrw_keepdir| is 1. This setting means that the current
1952directory will not track the browsing directory. (done for backwards
1953compatibility with v6's file explorer).
1954
1955Setting g:netrw_keepdir to 0 tells netrw to make vim's current directory
1956track netrw's browsing directory.
1957
1958However, given the default setting for g:netrw_keepdir of 1 where netrw
1959maintains its own separate notion of the current directory, in order to make
1960the two directories the same, use the "cd" map (type cd). That map will
1961set Vim's notion of the current directory to netrw's current browsing
1962directory.
1963
1964|netrw-cd| : This map's name was changed from "c" to cd (see |netrw-cd|).
1965 This change was done to allow for |netrw-cb| and |netrw-cB| maps.
1966
1967Associated setting variable: |g:netrw_keepdir|
1968
1969MARKING FILES *netrw-:MF* *netrw-mf* {{{2
1970 (also see |netrw-mr|)
1971
1972Netrw provides several ways to mark files:
1973
1974 * One may mark files with the cursor atop a filename and
1975 then pressing "mf".
1976
1977 * With gvim, in addition one may mark files with
1978 <s-leftmouse>. (see |netrw-mouse|)
1979
1980 * One may use the :MF command, which takes a list of
1981 files (for local directories, the list may include
1982 wildcards -- see |glob()|) >
1983
1984 :MF *.c
1985<
1986 (Note that :MF uses |<f-args>| to break the line
1987 at spaces)
1988
1989 * Mark files using the |argument-list| (|netrw-mA|)
1990
1991 * Mark files based upon a |location-list| (|netrw-qL|)
1992
1993 * Mark files based upon the quickfix list (|netrw-qF|)
1994 (|quickfix-error-lists|)
1995
1996The following netrw maps make use of marked files:
1997
1998 |netrw-a| Hide marked files/directories
1999 |netrw-D| Delete marked files/directories
2000 |netrw-ma| Move marked files' names to |arglist|
2001 |netrw-mA| Move |arglist| filenames to marked file list
2002 |netrw-mb| Append marked files to bookmarks
2003 |netrw-mB| Delete marked files from bookmarks
2004 |netrw-mc| Copy marked files to target
2005 |netrw-md| Apply vimdiff to marked files
2006 |netrw-me| Edit marked files
2007 |netrw-mF| Unmark marked files
2008 |netrw-mg| Apply vimgrep to marked files
2009 |netrw-mm| Move marked files to target
2010 |netrw-mp| Print marked files
2011 |netrw-ms| Netrw will source marked files
2012 |netrw-mt| Set target for |netrw-mm| and |netrw-mc|
2013 |netrw-mT| Generate tags using marked files
2014 |netrw-mv| Apply vim command to marked files
2015 |netrw-mx| Apply shell command to marked files
2016 |netrw-mX| Apply shell command to marked files, en bloc
2017 |netrw-mz| Compress/Decompress marked files
2018 |netrw-O| Obtain marked files
2019 |netrw-R| Rename marked files
2020
2021One may unmark files one at a time the same way one marks them; ie. place
2022the cursor atop a marked file and press "mf". This process also works
2023with <s-leftmouse> using gvim. One may unmark all files by pressing
2024"mu" (see |netrw-mu|).
2025
2026Marked files are highlighted using the "netrwMarkFile" highlighting group,
2027which by default is linked to "Identifier" (see Identifier under
2028|group-name|). You may change the highlighting group by putting something
2029like >
2030
2031 highlight clear netrwMarkFile
2032 hi link netrwMarkFile ..whatever..
2033<
2034into $HOME/.vim/after/syntax/netrw.vim .
2035
2036If the mouse is enabled and works with your vim, you may use <s-leftmouse> to
2037mark one or more files. You may mark multiple files by dragging the shifted
2038leftmouse. (see |netrw-mouse|)
2039
2040 *markfilelist* *global_markfilelist* *local_markfilelist*
2041All marked files are entered onto the global marked file list; there is only
2042one such list. In addition, every netrw buffer also has its own buffer-local
2043marked file list; since netrw buffers are associated with specific
2044directories, this means that each directory has its own local marked file
2045list. The various commands which operate on marked files use one or the other
2046of the marked file lists.
2047
2048Known Problem: if one is using tree mode (|g:netrw_liststyle|) and several
2049directories have files with the same name, then marking such a file will
2050result in all such files being highlighted as if they were all marked. The
2051|markfilelist|, however, will only have the selected file in it. This problem
2052is unlikely to be fixed.
2053
2054
2055UNMARKING FILES *netrw-mF* {{{2
2056 (also see |netrw-mf|, |netrw-mu|)
2057
2058The "mF" command will unmark all files in the current buffer. One may also use
2059mf (|netrw-mf|) on a specific, already marked, file to unmark just that file.
2060
2061MARKING FILES BY LOCATION LIST *netrw-qL* {{{2
2062 (also see |netrw-mf|)
2063
2064One may convert |location-list|s into a marked file list using "qL".
2065You may then proceed with commands such as me (|netrw-me|) to edit them.
2066
2067
2068MARKING FILES BY QUICKFIX LIST *netrw-qF* {{{2
2069 (also see |netrw-mf|)
2070
2071One may convert |quickfix-error-lists| into a marked file list using "qF".
2072You may then proceed with commands such as me (|netrw-me|) to edit them.
2073Quickfix error lists are generated, for example, by calls to |:vimgrep|.
2074
2075
2076MARKING FILES BY REGULAR EXPRESSION *netrw-mr* {{{2
2077 (also see |netrw-mf|)
2078
2079One may also mark files by pressing "mr"; netrw will then issue a prompt,
2080"Enter regexp: ". You may then enter a shell-style regular expression such
2081as *.c$ (see |glob()|). For remote systems, glob() doesn't work -- so netrw
2082converts "*" into ".*" (see |regexp|) and marks files based on that. In the
2083future I may make it possible to use |regexp|s instead of glob()-style
2084expressions (yet-another-option).
2085
2086See |cmdline-window| for directions on more on how to edit the regular
2087expression.
2088
2089
2090MARKED FILES, ARBITRARY VIM COMMAND *netrw-mv* {{{2
2091 (See |netrw-mf| and |netrw-mr| for how to mark files)
2092 (uses the local marked-file list)
2093
2094The "mv" map causes netrw to execute an arbitrary vim command on each file on
2095the local marked file list, individually:
2096
2097 * 1split
2098 * sil! keepalt e file
2099 * run vim command
2100 * sil! keepalt wq!
2101
2102A prompt, "Enter vim command: ", will be issued to elicit the vim command you
2103wish used. See |cmdline-window| for directions for more on how to edit the
2104command.
2105
2106
2107MARKED FILES, ARBITRARY SHELL COMMAND *netrw-mx* {{{2
2108 (See |netrw-mf| and |netrw-mr| for how to mark files)
2109 (uses the local marked-file list)
2110
2111Upon activation of the "mx" map, netrw will query the user for some (external)
2112command to be applied to all marked files. All "%"s in the command will be
2113substituted with the name of each marked file in turn. If no "%"s are in the
2114command, then the command will be followed by a space and a marked filename.
2115
2116Example:
2117 (mark files)
2118 mx
2119 Enter command: cat
2120
2121 The result is a series of shell commands:
2122 cat 'file1'
2123 cat 'file2'
2124 ...
2125
2126
2127MARKED FILES, ARBITRARY SHELL COMMAND, EN BLOC *netrw-mX* {{{2
2128 (See |netrw-mf| and |netrw-mr| for how to mark files)
2129 (uses the global marked-file list)
2130
2131Upon activation of the 'mX' map, netrw will query the user for some (external)
2132command to be applied to all marked files on the global marked file list. The
2133"en bloc" means that one command will be executed on all the files at once: >
2134
2135 command files
2136
2137This approach is useful, for example, to select files and make a tarball: >
2138
2139 (mark files)
2140 mX
2141 Enter command: tar cf mynewtarball.tar
2142<
2143The command that will be run with this example:
2144
2145 tar cf mynewtarball.tar 'file1' 'file2' ...
2146
2147
2148MARKED FILES: ARGUMENT LIST *netrw-ma* *netrw-mA*
2149 (See |netrw-mf| and |netrw-mr| for how to mark files)
2150 (uses the global marked-file list)
2151
2152Using ma, one moves filenames from the marked file list to the argument list.
2153Using mA, one moves filenames from the argument list to the marked file list.
2154
2155See Also: |netrw-cb| |netrw-cB| |netrw-qF| |argument-list| |:args|
2156
2157
2158MARKED FILES: BUFFER LIST *netrw-cb* *netrw-cB*
2159 (See |netrw-mf| and |netrw-mr| for how to mark files)
2160 (uses the global marked-file list)
2161
2162Using cb, one moves filenames from the marked file list to the buffer list.
2163Using cB, one copies filenames from the buffer list to the marked file list.
2164
2165See Also: |netrw-ma| |netrw-mA| |netrw-qF| |buffer-list| |:buffers|
2166
2167
2168MARKED FILES: COMPRESSION AND DECOMPRESSION *netrw-mz* {{{2
2169 (See |netrw-mf| and |netrw-mr| for how to mark files)
2170 (uses the local marked file list)
2171
2172If any marked files are compressed, then "mz" will decompress them.
2173If any marked files are decompressed, then "mz" will compress them
2174using the command specified by |g:netrw_compress|; by default,
2175that's "gzip".
2176
2177For decompression, netrw uses a |Dictionary| of suffices and their
2178associated decompressing utilities; see |g:netrw_decompress|.
2179
2180Remember that one can mark multiple files by regular expression
2181(see |netrw-mr|); this is particularly useful to facilitate compressing and
2182decompressing a large number of files.
2183
2184Associated setting variables: |g:netrw_compress| |g:netrw_decompress|
2185
2186MARKED FILES: COPYING *netrw-mc* {{{2
2187 (See |netrw-mf| and |netrw-mr| for how to mark files)
2188 (Uses the global marked file list)
2189
2190Select a target directory with mt (|netrw-mt|). Then change directory,
2191select file(s) (see |netrw-mf|), and press "mc". The copy is done
2192from the current window (where one does the mf) to the target.
2193
2194If one does not have a target directory set with |netrw-mt|, then netrw
2195will query you for a directory to copy to.
2196
2197One may also copy directories and their contents (local only) to a target
2198directory.
2199
2200Associated setting variables:
2201 |g:netrw_localcopycmd| |g:netrw_localcopycmdopt|
2202 |g:netrw_localcopydircmd| |g:netrw_localcopydircmdopt|
2203 |g:netrw_ssh_cmd|
2204
2205MARKED FILES: DIFF *netrw-md* {{{2
2206 (See |netrw-mf| and |netrw-mr| for how to mark files)
2207 (uses the global marked file list)
2208
2209Use |vimdiff| to visualize difference between selected files (two or
2210three may be selected for this). Uses the global marked file list.
2211
2212MARKED FILES: EDITING *netrw-me* {{{2
2213 (See |netrw-mf| and |netrw-mr| for how to mark files)
2214 (uses the global marked file list)
2215
2216The "me" command will place the marked files on the |arglist| and commence
2217editing them. One may return the to explorer window with |:Rexplore|.
2218(use |:n| and |:p| to edit next and previous files in the arglist)
2219
2220MARKED FILES: GREP *netrw-mg* {{{2
2221 (See |netrw-mf| and |netrw-mr| for how to mark files)
2222 (uses the global marked file list)
2223
2224The "mg" command will apply |:vimgrep| to the marked files.
2225The command will ask for the requested pattern; one may then enter: >
2226
2227 /pattern/[g][j]
2228 ! /pattern/[g][j]
2229 pattern
2230<
2231With /pattern/, editing will start with the first item on the |quickfix| list
2232that vimgrep sets up (see |:copen|, |:cnext|, |:cprevious|, |:cclose|). The |:vimgrep|
2233command is in use, so without 'g' each line is added to quickfix list only
2234once; with 'g' every match is included.
2235
2236With /pattern/j, "mg" will winnow the current marked file list to just those
2237marked files also possessing the specified pattern. Thus, one may use >
2238
2239 mr ...file-pattern...
2240 mg /pattern/j
2241<
2242to have a marked file list satisfying the file-pattern but also restricted to
2243files containing some desired pattern.
2244
2245
2246MARKED FILES: HIDING AND UNHIDING BY SUFFIX *netrw-mh* {{{2
2247 (See |netrw-mf| and |netrw-mr| for how to mark files)
2248 (uses the local marked file list)
2249
2250The "mh" command extracts the suffices of the marked files and toggles their
2251presence on the hiding list. Please note that marking the same suffix
2252this way multiple times will result in the suffix's presence being toggled
2253for each file (so an even quantity of marked files having the same suffix
2254is the same as not having bothered to select them at all).
2255
2256Related topics: |netrw-a| |g:netrw_list_hide|
2257
2258MARKED FILES: MOVING *netrw-mm* {{{2
2259 (See |netrw-mf| and |netrw-mr| for how to mark files)
2260 (uses the global marked file list)
2261
2262 WARNING: moving files is more dangerous than copying them.
2263 A file being moved is first copied and then deleted; if the
2264 copy operation fails and the delete succeeds, you will lose
2265 the file. Either try things out with unimportant files
2266 first or do the copy and then delete yourself using mc and D.
2267 Use at your own risk!
2268
2269Select a target directory with mt (|netrw-mt|). Then change directory,
2270select file(s) (see |netrw-mf|), and press "mm". The move is done
2271from the current window (where one does the mf) to the target.
2272
2273Associated setting variable: |g:netrw_localmovecmd| |g:netrw_ssh_cmd|
2274
2275MARKED FILES: PRINTING *netrw-mp* {{{2
2276 (See |netrw-mf| and |netrw-mr| for how to mark files)
2277 (uses the local marked file list)
2278
2279When "mp" is used, netrw will apply the |:hardcopy| command to marked files.
2280What netrw does is open each file in a one-line window, execute hardcopy, then
2281close the one-line window.
2282
2283
2284MARKED FILES: SOURCING *netrw-ms* {{{2
2285 (See |netrw-mf| and |netrw-mr| for how to mark files)
2286 (uses the local marked file list)
2287
2288With "ms", netrw will source the marked files (using vim's |:source| command)
2289
2290
2291MARKED FILES: SETTING THE TARGET DIRECTORY *netrw-mt* {{{2
2292 (See |netrw-mf| and |netrw-mr| for how to mark files)
2293
2294Set the marked file copy/move-to target (see |netrw-mc| and |netrw-mm|):
2295
2296 * If the cursor is atop a file name, then the netrw window's currently
2297 displayed directory is used for the copy/move-to target.
2298
2299 * Also, if the cursor is in the banner, then the netrw window's currently
2300 displayed directory is used for the copy/move-to target.
2301 Unless the target already is the current directory. In which case,
2302 typing "mf" clears the target.
2303
2304 * However, if the cursor is atop a directory name, then that directory is
2305 used for the copy/move-to target
2306
2307 * One may use the :MT [directory] command to set the target *netrw-:MT*
2308 This command uses |<q-args>|, so spaces in the directory name are
2309 permitted without escaping.
2310
2311 * With mouse-enabled vim or with gvim, one may select a target by using
2312 <c-leftmouse>
2313
2314There is only one copy/move-to target at a time in a vim session; ie. the
2315target is a script variable (see |s:var|) and is shared between all netrw
2316windows (in an instance of vim).
2317
2318When using menus and gvim, netrw provides a "Targets" entry which allows one
2319to pick a target from the list of bookmarks and history.
2320
2321Related topics:
2322 Marking Files......................................|netrw-mf|
2323 Marking Files by Regular Expression................|netrw-mr|
2324 Marked Files: Target Directory Using Bookmarks.....|netrw-Tb|
2325 Marked Files: Target Directory Using History.......|netrw-Th|
2326
2327
2328MARKED FILES: TAGGING *netrw-mT* {{{2
2329 (See |netrw-mf| and |netrw-mr| for how to mark files)
2330 (uses the global marked file list)
2331
2332The "mT" mapping will apply the command in |g:netrw_ctags| (by default, it is
2333"ctags") to marked files. For remote browsing, in order to create a tags file
2334netrw will use ssh (see |g:netrw_ssh_cmd|), and so ssh must be available for
2335this to work on remote systems. For your local system, see |ctags| on how to
2336get a version. I myself use hdrtags, currently available at
2337http://www.drchip.org/astronaut/src/index.html , and have >
2338
2339 let g:netrw_ctags= "hdrtag"
2340<
2341in my <.vimrc>.
2342
2343When a remote set of files are tagged, the resulting tags file is "obtained";
2344ie. a copy is transferred to the local system's directory. The now local tags
2345file is then modified so that one may use it through the network. The
2346modification made concerns the names of the files in the tags; each filename is
2347preceded by the netrw-compatible URL used to obtain it. When one subsequently
2348uses one of the go to tag actions (|tags|), the URL will be used by netrw to
2349edit the desired file and go to the tag.
2350
2351Associated setting variables: |g:netrw_ctags| |g:netrw_ssh_cmd|
2352
2353MARKED FILES: TARGET DIRECTORY USING BOOKMARKS *netrw-Tb* {{{2
2354
2355Sets the marked file copy/move-to target.
2356
2357The |netrw-qb| map will give you a list of bookmarks (and history).
2358One may choose one of the bookmarks to become your marked file
2359target by using [count]Tb (default count: 1).
2360
2361Related topics:
2362 Copying files to target............................|netrw-mc|
2363 Listing Bookmarks and History......................|netrw-qb|
2364 Marked Files: Setting The Target Directory.........|netrw-mt|
2365 Marked Files: Target Directory Using History.......|netrw-Th|
2366 Marking Files......................................|netrw-mf|
2367 Marking Files by Regular Expression................|netrw-mr|
2368 Moving files to target.............................|netrw-mm|
2369
2370
2371MARKED FILES: TARGET DIRECTORY USING HISTORY *netrw-Th* {{{2
2372
2373Sets the marked file copy/move-to target.
2374
2375The |netrw-qb| map will give you a list of history (and bookmarks).
2376One may choose one of the history entries to become your marked file
2377target by using [count]Th (default count: 0; ie. the current directory).
2378
2379Related topics:
2380 Copying files to target............................|netrw-mc|
2381 Listing Bookmarks and History......................|netrw-qb|
2382 Marked Files: Setting The Target Directory.........|netrw-mt|
2383 Marked Files: Target Directory Using Bookmarks.....|netrw-Tb|
2384 Marking Files......................................|netrw-mf|
2385 Marking Files by Regular Expression................|netrw-mr|
2386 Moving files to target.............................|netrw-mm|
2387
2388
2389MARKED FILES: UNMARKING *netrw-mu* {{{2
2390 (See |netrw-mf|, |netrw-mF|)
2391
2392The "mu" mapping will unmark all currently marked files. This command differs
2393from "mF" as the latter only unmarks files in the current directory whereas
2394"mu" will unmark global and all buffer-local marked files.
2395(see |netrw-mF|)
2396
2397
2398 *netrw-browser-settings*
2399NETRW BROWSER VARIABLES *netrw-browser-options* *netrw-browser-var* {{{2
2400
2401(if you're interested in the netrw file transfer settings, see |netrw-options|
2402 and |netrw-protocol|)
2403
2404The <netrw.vim> browser provides settings in the form of variables which
2405you may modify; by placing these settings in your <.vimrc>, you may customize
2406your browsing preferences. (see also: |netrw-settings|)
2407>
2408 --- -----------
2409 Var Explanation
2410 --- -----------
2411< *g:netrw_altfile* some like |CTRL-^| to return to the last
2412 edited file. Choose that by setting this
2413 parameter to 1.
2414 Others like |CTRL-^| to return to the
2415 netrw browsing buffer. Choose that by setting
2416 this parameter to 0.
2417 default: =0
2418
2419 *g:netrw_alto* change from above splitting to below splitting
2420 by setting this variable (see |netrw-o|)
2421 default: =&sb (see |'sb'|)
2422
2423 *g:netrw_altv* change from left splitting to right splitting
2424 by setting this variable (see |netrw-v|)
2425 default: =&spr (see |'spr'|)
2426
2427 *g:netrw_banner* enable/suppress the banner
2428 =0: suppress the banner
2429 =1: banner is enabled (default)
2430
2431 *g:netrw_bannerbackslash* if this variable exists and is not zero, the
2432 banner will be displayed with backslashes
2433 rather than forward slashes.
2434
2435 *g:netrw_browse_split* when browsing, <cr> will open the file by:
2436 =0: re-using the same window (default)
2437 =1: horizontally splitting the window first
2438 =2: vertically splitting the window first
2439 =3: open file in new tab
2440 =4: act like "P" (ie. open previous window)
2441 Note that |g:netrw_preview| may be used
2442 to get vertical splitting instead of
2443 horizontal splitting.
2444 =[servername,tab-number,window-number]
2445 Given a |List| such as this, a remote server
2446 named by the "servername" will be used for
2447 editing. It will also use the specified tab
2448 and window numbers to perform editing
2449 (see |clientserver|, |netrw-ctrl-r|)
2450 This option does not affect the production of
2451 |:Lexplore| windows.
2452
2453 Related topics:
2454 |g:netrw_alto| |g:netrw_altv|
2455 |netrw-C| |netrw-cr|
2456 |netrw-ctrl-r|
2457
2458 *g:netrw_chgperm* Unix/Linux: "chmod PERM FILENAME"
2459 Windows: "cacls FILENAME /e /p PERM"
2460 Used to change access permission for a file.
2461
2462 *g:netrw_clipboard* =1
2463 By default, netrw will attempt to insure that
2464 the clipboard's values will remain unchanged.
2465 However, some users report that they have
2466 speed problems with this; consequently, this
2467 option, when set to zero, lets such users
2468 prevent netrw from saving and restoring the
2469 clipboard (the latter is done only as needed).
2470 That means that if the clipboard is changed
2471 (inadvertently) by normal netrw operation that
2472 it will not be restored to its prior state.
2473
2474 *g:netrw_compress* ="gzip"
2475 Will compress marked files with this
2476 command
2477
2478 *g:Netrw_corehandler* Allows one to specify something additional
2479 to do when handling <core> files via netrw's
2480 browser's "x" command. If present,
2481 g:Netrw_corehandler specifies either one or
2482 more function references (see |Funcref|).
2483 (the capital g:Netrw... is required its
2484 holding a function reference)
2485
2486
2487 *g:netrw_ctags* ="ctags"
2488 The default external program used to create
2489 tags
2490
2491 *g:netrw_cursor* = 2 (default)
2492 This option controls the use of the
2493 |'cursorline'| (cul) and |'cursorcolumn'|
2494 (cuc) settings by netrw:
2495
2496 Value Thin-Long-Tree Wide
2497 =0 u-cul u-cuc u-cul u-cuc
2498 =1 u-cul u-cuc cul u-cuc
2499 =2 cul u-cuc cul u-cuc
2500 =3 cul u-cuc cul cuc
2501 =4 cul cuc cul cuc
2502 =5 U-cul U-cuc U-cul U-cuc
2503 =6 U-cul U-cuc cul U-cuc
2504 =7 cul U-cuc cul U-cuc
2505 =8 cul U-cuc cul cuc
2506
2507 Where
2508 u-cul : user's |'cursorline'| initial setting used
2509 u-cuc : user's |'cursorcolumn'| initial setting used
2510 U-cul : user's |'cursorline'| current setting used
2511 U-cuc : user's |'cursorcolumn'| current setting used
2512 cul : |'cursorline'| will be locally set
2513 cuc : |'cursorcolumn'| will be locally set
2514
2515 The "initial setting" means the values of
2516 the |'cuc'| and |'cul'| settings in effect when
2517 netrw last saw |g:netrw_cursor| >= 5 or when
2518 netrw was initially run.
2519
2520 *g:netrw_decompress* = { '.lz4': 'lz4 -d',
2521 '.lzo': 'lzop -d',
2522 '.lz': 'lzip -dk',
2523 '.7z': '7za x',
2524 '.001': '7za x',
2525 '.tar.bz': 'tar -xvjf',
2526 '.tar.bz2': 'tar -xvjf',
2527 '.tbz': 'tar -xvjf',
2528 '.tbz2': 'tar -xvjf',
2529 '.tar.gz': 'tar -xvzf',
2530 '.tgz': 'tar -xvzf',
2531 '.tar.zst': 'tar --use-compress-program=unzstd -xvf',
2532 '.tzst': 'tar --use-compress-program=unzstd -xvf',
2533 '.tar': 'tar -xvf',
2534 '.zip': 'unzip',
2535 '.bz': 'bunzip2 -k',
2536 '.bz2': 'bunzip2 -k',
2537 '.gz': 'gunzip -k',
2538 '.lzma': 'unlzma -T0 -k',
2539 '.xz': 'unxz -T0 -k',
2540 '.zst': 'zstd -T0 -d',
2541 '.Z': 'uncompress -k',
2542 '.rar': 'unrar x -ad',
2543 '.tar.lzma': 'tar --lzma -xvf',
2544 '.tlz': 'tar --lzma -xvf',
2545 '.tar.xz': 'tar -xvJf',
2546 '.txz': 'tar -xvJf'}
2547
2548 A dictionary mapping suffices to
2549 decompression programs.
2550
2551 *g:netrw_dirhistmax* =10: controls maximum quantity of past
2552 history. May be zero to suppress
2553 history.
2554 (related: |netrw-qb| |netrw-u| |netrw-U|)
2555
2556 *g:netrw_dynamic_maxfilenamelen* =32: enables dynamic determination of
2557 |g:netrw_maxfilenamelen|, which affects
2558 local file long listing.
2559
2560 *g:netrw_errorlvl* =0: error levels greater than or equal to
2561 this are permitted to be displayed
2562 0: notes
2563 1: warnings
2564 2: errors
2565
2566 *g:netrw_fastbrowse* =0: slow speed directory browsing;
2567 never re-uses directory listings;
2568 always obtains directory listings.
2569 =1: medium speed directory browsing;
2570 re-use directory listings only
2571 when remote directory browsing.
2572 (default value)
2573 =2: fast directory browsing;
2574 only obtains directory listings when the
2575 directory hasn't been seen before
2576 (or |netrw-ctrl-l| is used).
2577
2578 Fast browsing retains old directory listing
2579 buffers so that they don't need to be
2580 re-acquired. This feature is especially
2581 important for remote browsing. However, if
2582 a file is introduced or deleted into or from
2583 such directories, the old directory buffer
2584 becomes out-of-date. One may always refresh
2585 such a directory listing with |netrw-ctrl-l|.
2586 This option gives the user the choice of
2587 trading off accuracy (ie. up-to-date listing)
2588 versus speed.
2589
2590 *g:netrw_ffkeep* (default: doesn't exist)
2591 If this variable exists and is zero, then
2592 netrw will not do a save and restore for
2593 |'fileformat'|.
2594
2595 *g:netrw_fname_escape* =' ?&;%'
2596 Used on filenames before remote reading/writing
2597
2598 *g:netrw_ftp_browse_reject* ftp can produce a number of errors and warnings
2599 that can show up as "directories" and "files"
2600 in the listing. This pattern is used to
2601 remove such embedded messages. By default its
2602 value is:
2603 '^total\s\+\d\+$\|
2604 ^Trying\s\+\d\+.*$\|
2605 ^KERBEROS_V\d rejected\|
2606 ^Security extensions not\|
2607 No such file\|
2608 : connect to address [0-9a-fA-F:]*
2609 : No route to host$'
2610
2611 *g:netrw_ftp_list_cmd* options for passing along to ftp for directory
2612 listing. Defaults:
2613 unix or g:netrw_cygwin set: : "ls -lF"
2614 otherwise "dir"
2615
2616
2617 *g:netrw_ftp_sizelist_cmd* options for passing along to ftp for directory
2618 listing, sorted by size of file.
2619 Defaults:
2620 unix or g:netrw_cygwin set: : "ls -slF"
2621 otherwise "dir"
2622
2623 *g:netrw_ftp_timelist_cmd* options for passing along to ftp for directory
2624 listing, sorted by time of last modification.
2625 Defaults:
2626 unix or g:netrw_cygwin set: : "ls -tlF"
2627 otherwise "dir"
2628
2629 *g:netrw_glob_escape* ='[]*?`{~$' (unix)
2630 ='[]*?`{$' (windows
2631 These characters in directory names are
2632 escaped before applying glob()
2633
2634 *g:netrw_hide* Controlled by the "a" map (see |netrw-a|)
2635 =0 : show all
2636 =1 : show not-hidden files
2637 =2 : show hidden files only
2638 default: =1
2639
2640 *g:netrw_home* The home directory for where bookmarks and
2641 history are saved (as .netrwbook and
2642 .netrwhist).
2643 Netrw uses |expand()|on the string.
2644 default: the first directory on the
2645 |'runtimepath'|
2646
2647 *g:netrw_keepdir* =1 (default) keep current directory immune from
2648 the browsing directory.
2649 =0 keep the current directory the same as the
2650 browsing directory.
2651 The current browsing directory is contained in
2652 b:netrw_curdir (also see |netrw-cd|)
2653
2654 *g:netrw_keepj* ="keepj" (default) netrw attempts to keep the
2655 |:jumps| table unaffected.
2656 ="" netrw will not use |:keepjumps| with
2657 exceptions only for the
2658 saving/restoration of position.
2659
2660 *g:netrw_list_cmd* command for listing remote directories
2661 default: (if ssh is executable)
2662 "ssh HOSTNAME ls -FLa"
2663
2664 *g:netrw_list_cmd_options* If this variable exists, then its contents are
2665 appended to the g:netrw_list_cmd. For
2666 example, use "2>/dev/null" to get rid of banner
2667 messages on unix systems.
2668
2669
2670 *g:netrw_liststyle* Set the default listing style:
2671 = 0: thin listing (one file per line)
2672 = 1: long listing (one file per line with time
2673 stamp information and file size)
2674 = 2: wide listing (multiple files in columns)
2675 = 3: tree style listing
2676
2677 *g:netrw_list_hide* comma-separated pattern list for hiding files
2678 Patterns are regular expressions (see |regexp|)
2679 There's some special support for git-ignore
2680 files: you may add the output from the helper
2681 function 'netrw_gitignore#Hide() automatically
2682 hiding all gitignored files.
2683 For more details see |netrw-gitignore|.
2684
2685 Examples:
2686 let g:netrw_list_hide= '.*\.swp$'
2687 let g:netrw_list_hide= netrw_gitignore#Hide() .. '.*\.swp$'
2688 default: ""
2689
2690 *g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin
2691 =expand("$COMSPEC") Windows
2692 Copies marked files (|netrw-mf|) to target
2693 directory (|netrw-mt|, |netrw-mc|)
2694
2695 *g:netrw_localcopycmdopt* ='' Linux/Unix/MacOS/Cygwin
2696 =' \c copy' Windows
2697 Options for the |g:netrw_localcopycmd|
2698
2699 *g:netrw_localcopydircmd* ="cp" Linux/Unix/MacOS/Cygwin
2700 =expand("$COMSPEC") Windows
2701 Copies directories to target directory.
2702 (|netrw-mc|, |netrw-mt|)
2703
2704 *g:netrw_localcopydircmdopt* =" -R" Linux/Unix/MacOS/Cygwin
2705 =" /c xcopy /e /c /h/ /i /k" Windows
2706 Options for |g:netrw_localcopydircmd|
2707
2708 *g:netrw_localmkdir* ="mkdir" Linux/Unix/MacOS/Cygwin
2709 =expand("$COMSPEC") Windows
2710 command for making a local directory
2711
2712 *g:netrw_localmkdiropt* ="" Linux/Unix/MacOS/Cygwin
2713 =" /c mkdir" Windows
2714 Options for |g:netrw_localmkdir|
2715
2716 *g:netrw_localmovecmd* ="mv" Linux/Unix/MacOS/Cygwin
2717 =expand("$COMSPEC") Windows
2718 Moves marked files (|netrw-mf|) to target
2719 directory (|netrw-mt|, |netrw-mm|)
2720
2721 *g:netrw_localmovecmdopt* ="" Linux/Unix/MacOS/Cygwin
2722 =" /c move" Windows
2723 Options for |g:netrw_localmovecmd|
2724
2725 *g:netrw_maxfilenamelen* =32 by default, selected so as to make long
2726 listings fit on 80 column displays.
2727 If your screen is wider, and you have file
2728 or directory names longer than 32 bytes,
2729 you may set this option to keep listings
2730 columnar.
2731
2732 *g:netrw_mkdir_cmd* command for making a remote directory
2733 via ssh (also see |g:netrw_remote_mkdir|)
2734 default: "ssh USEPORT HOSTNAME mkdir"
2735
2736 *g:netrw_mousemaps* =1 (default) enables mouse buttons while
2737 browsing to:
2738 leftmouse : open file/directory
2739 shift-leftmouse : mark file
2740 middlemouse : same as P
2741 rightmouse : remove file/directory
2742 =0: disables mouse maps
2743
2744 *g:netrw_nobeval* doesn't exist (default)
2745 If this variable exists, then balloon
2746 evaluation will be suppressed
2747 (see |'ballooneval'|)
2748
2749 *g:netrw_sizestyle* not defined: actual bytes (default)
2750 ="b" : actual bytes (default)
2751 ="h" : human-readable (ex. 5k, 4m, 3g)
2752 uses 1000 base
2753 ="H" : human-readable (ex. 5K, 4M, 3G)
2754 uses 1024 base
2755 The long listing (|netrw-i|) and query-file
2756 maps (|netrw-qf|) will display file size
2757 using the specified style.
2758
2759 *g:netrw_usetab* if this variable exists and is non-zero, then
2760 the <tab> map supporting shrinking/expanding a
2761 Lexplore or netrw window will be enabled.
2762 (see |netrw-c-tab|)
2763
2764 *g:netrw_remote_mkdir* command for making a remote directory
2765 via ftp (also see |g:netrw_mkdir_cmd|)
2766 default: "mkdir"
2767
2768 *g:netrw_retmap* if it exists and is set to one, then:
2769 * if in a netrw-selected file, AND
2770 * no normal-mode <2-leftmouse> mapping exists,
2771 then the <2-leftmouse> will be mapped for easy
2772 return to the netrw browser window.
2773 example: click once to select and open a file,
2774 double-click to return.
2775
2776 Note that one may instead choose to:
2777 * let g:netrw_retmap= 1, AND
2778 * nmap <silent> YourChoice <Plug>NetrwReturn
2779 and have another mapping instead of
2780 <2-leftmouse> to invoke the return.
2781
2782 You may also use the |:Rexplore| command to do
2783 the same thing.
2784
2785 default: =0
2786
2787 *g:netrw_rm_cmd* command for removing remote files
2788 default: "ssh USEPORT HOSTNAME rm"
2789
2790 *g:netrw_rmdir_cmd* command for removing remote directories
2791 default: "ssh USEPORT HOSTNAME rmdir"
2792
2793 *g:netrw_rmf_cmd* command for removing remote softlinks
2794 default: "ssh USEPORT HOSTNAME rm -f"
2795
2796 *g:netrw_servername* use this variable to provide a name for
2797 |netrw-ctrl-r| to use for its server.
2798 default: "NETRWSERVER"
2799
2800 *g:netrw_sort_by* sort by "name", "time", "size", or
2801 "exten".
2802 default: "name"
2803
2804 *g:netrw_sort_direction* sorting direction: "normal" or "reverse"
2805 default: "normal"
2806
2807 *g:netrw_sort_options* sorting is done using |:sort|; this
2808 variable's value is appended to the
2809 sort command. Thus one may ignore case,
2810 for example, with the following in your
2811 .vimrc: >
2812 let g:netrw_sort_options="i"
2813< default: ""
2814
2815 *g:netrw_sort_sequence* when sorting by name, first sort by the
2816 comma-separated pattern sequence. Note that
2817 any filigree added to indicate filetypes
2818 should be accounted for in your pattern.
2819 default: '[\/]$,*,\.bak$,\.o$,\.h$,
2820 \.info$,\.swp$,\.obj$'
2821
2822 *g:netrw_special_syntax* If true, then certain files will be shown
2823 using special syntax in the browser:
2824
2825 netrwBak : *.bak
2826 netrwCompress: *.gz *.bz2 *.Z *.zip
2827 netrwCoreDump: core.\d\+
2828 netrwData : *.dat
2829 netrwDoc : *.doc,*.txt,*.pdf,
2830 *.pdf,*.docx
2831 netrwHdr : *.h
2832 netrwLex : *.l *.lex
2833 netrwLib : *.a *.so *.lib *.dll
2834 netrwMakefile: [mM]akefile *.mak
2835 netrwObj : *.o *.obj
2836 netrwPix : *.bmp,*.fit,*.fits,*.gif,
2837 *.jpg,*.jpeg,*.pcx,*.ppc
2838 *.pgm,*.png,*.psd,*.rgb
2839 *.tif,*.xbm,*.xcf
2840 netrwTags : tags ANmenu ANtags
2841 netrwTilde : *
2842 netrwTmp : tmp* *tmp
2843 netrwYacc : *.y
2844
2845 In addition, those groups mentioned in
2846 |'suffixes'| are also added to the special
2847 file highlighting group.
2848 These syntax highlighting groups are linked
2849 to netrwGray or Folded by default
2850 (see |hl-Folded|), but one may put lines like >
2851 hi link netrwCompress Visual
2852< into one's <.vimrc> to use one's own
2853 preferences. Alternatively, one may
2854 put such specifications into >
2855 .vim/after/syntax/netrw.vim.
2856< The netrwGray highlighting is set up by
2857 netrw when >
2858 * netrwGray has not been previously
2859 defined
2860 * the gui is running
2861< As an example, I myself use a dark-background
2862 colorscheme with the following in
2863 .vim/after/syntax/netrw.vim: >
2864
2865 hi netrwCompress term=NONE cterm=NONE gui=NONE ctermfg=10 guifg=green ctermbg=0 guibg=black
2866 hi netrwData term=NONE cterm=NONE gui=NONE ctermfg=9 guifg=blue ctermbg=0 guibg=black
2867 hi netrwHdr term=NONE cterm=NONE,italic gui=NONE guifg=SeaGreen1
2868 hi netrwLex term=NONE cterm=NONE,italic gui=NONE guifg=SeaGreen1
2869 hi netrwYacc term=NONE cterm=NONE,italic gui=NONE guifg=SeaGreen1
2870 hi netrwLib term=NONE cterm=NONE gui=NONE ctermfg=14 guifg=yellow
2871 hi netrwObj term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
2872 hi netrwTilde term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
2873 hi netrwTmp term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
2874 hi netrwTags term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
2875 hi netrwDoc term=NONE cterm=NONE gui=NONE ctermfg=220 ctermbg=27 guifg=yellow2 guibg=Blue3
2876 hi netrwSymLink term=NONE cterm=NONE gui=NONE ctermfg=220 ctermbg=27 guifg=grey60
2877<
2878 *g:netrw_ssh_browse_reject* ssh can sometimes produce unwanted lines,
2879 messages, banners, and whatnot that one doesn't
2880 want masquerading as "directories" and "files".
2881 Use this pattern to remove such embedded
2882 messages. By default its value is:
2883 '^total\s\+\d\+$'
2884
2885 *g:netrw_ssh_cmd* One may specify an executable command
2886 to use instead of ssh for remote actions
2887 such as listing, file removal, etc.
2888 default: ssh
2889
2890 *g:netrw_tmpfile_escape* =' &;'
2891 escape() is applied to all temporary files
2892 to escape these characters.
2893
2894 *g:netrw_timefmt* specify format string to vim's strftime().
2895 The default, "%c", is "the preferred date
2896 and time representation for the current
2897 locale" according to my manpage entry for
2898 strftime(); however, not all are satisfied
2899 with it. Some alternatives:
2900 "%a %d %b %Y %T",
2901 " %a %Y-%m-%d %I-%M-%S %p"
2902 default: "%c"
2903
2904 *g:netrw_use_noswf* netrw normally avoids writing swapfiles
2905 for browser buffers. However, under some
2906 systems this apparently is causing nasty
2907 ml_get errors to appear; if you're getting
2908 ml_get errors, try putting
2909 let g:netrw_use_noswf= 0
2910 in your .vimrc.
2911 default: 1
2912
2913 *g:netrw_winsize* specify initial size of new windows made with
2914 "o" (see |netrw-o|), "v" (see |netrw-v|),
2915 |:Hexplore| or |:Vexplore|. The g:netrw_winsize
2916 is an integer describing the percentage of the
2917 current netrw buffer's window to be used for
2918 the new window.
2919 If g:netrw_winsize is less than zero, then
2920 the absolute value of g:netrw_winsize will be
2921 used to specify the quantity of lines or
2922 columns for the new window.
2923 If g:netrw_winsize is zero, then a normal
2924 split will be made (ie. |'equalalways'| will
2925 take effect, for example).
2926 default: 50 (for 50%)
2927
2928 *g:netrw_wiw* =1 specifies the minimum window width to use
2929 when shrinking a netrw/Lexplore window
2930 (see |netrw-c-tab|).
2931
2932 *g:netrw_xstrlen* Controls how netrw computes string lengths,
2933 including multi-byte characters' string
2934 length. (thanks to N Weibull, T Mechelynck)
2935 =0: uses Vim's built-in strlen()
2936 =1: number of codepoints (Latin a + combining
2937 circumflex is two codepoints) (DEFAULT)
2938 =2: number of spacing codepoints (Latin a +
2939 combining circumflex is one spacing
2940 codepoint; a hard tab is one; wide and
2941 narrow CJK are one each; etc.)
2942 =3: virtual length (counting tabs as anything
2943 between 1 and |'tabstop'|, wide CJK as 2
2944 rather than 1, Arabic alif as zero when
2945 immediately preceded by lam, one
2946 otherwise, etc)
2947
2948 *g:NetrwTopLvlMenu* This variable specifies the top level
2949 menu name; by default, it's "Netrw.". If
2950 you wish to change this, do so in your
2951 .vimrc.
2952
2953NETRW BROWSING AND OPTION INCOMPATIBILITIES *netrw-incompatible* {{{2
2954
2955Netrw has been designed to handle user options by saving them, setting the
2956options to something that's compatible with netrw's needs, and then restoring
2957them. However, the autochdir option: >
2958 :set acd
2959is problematic. Autochdir sets the current directory to that containing the
2960file you edit; this apparently also applies to directories. In other words,
2961autochdir sets the current directory to that containing the "file" (even if
2962that "file" is itself a directory).
2963
2964NETRW SETTINGS WINDOW *netrw-settings-window* {{{2
2965
2966With the NetrwSettings.vim plugin, >
2967 :NetrwSettings
2968will bring up a window with the many variables that netrw uses for its
2969settings. You may change any of their values; when you save the file, the
2970settings therein will be used. One may also press "?" on any of the lines for
2971help on what each of the variables do.
2972
2973(also see: |netrw-browser-var| |netrw-protocol| |netrw-variables|)
2974
2975
2976==============================================================================
2977OBTAINING A FILE *netrw-obtain* *netrw-O* {{{2
2978
2979If there are no marked files:
2980
2981 When browsing a remote directory, one may obtain a file under the cursor
2982 (ie. get a copy on your local machine, but not edit it) by pressing the O
2983 key.
2984
2985If there are marked files:
2986
2987 The marked files will be obtained (ie. a copy will be transferred to your
2988 local machine, but not set up for editing).
2989
2990Only ftp and scp are supported for this operation (but since these two are
2991available for browsing, that shouldn't be a problem). The status bar will
2992then show, on its right hand side, a message like "Obtaining filename". The
2993statusline will be restored after the transfer is complete.
2994
2995Netrw can also "obtain" a file using the local browser. Netrw's display
2996of a directory is not necessarily the same as Vim's "current directory",
2997unless |g:netrw_keepdir| is set to 0 in the user's <.vimrc>. One may select
2998a file using the local browser (by putting the cursor on it) and pressing
2999"O" will then "obtain" the file; ie. copy it to Vim's current directory.
3000
3001Related topics:
3002 * To see what the current directory is, use |:pwd|
3003 * To make the currently browsed directory the current directory, see
3004 |netrw-cd|
3005 * To automatically make the currently browsed directory the current
3006 directory, see |g:netrw_keepdir|.
3007
3008 *netrw-newfile* *netrw-createfile*
3009OPEN A NEW FILE IN NETRW'S CURRENT DIRECTORY *netrw-%* {{{2
3010
3011To open a new file in netrw's current directory, press "%". This map
3012will query the user for a new filename; an empty file by that name will
3013be placed in the netrw's current directory (ie. b:netrw_curdir).
3014
3015If Lexplore (|netrw-:Lexplore|) is in use, the new file will be generated
3016in the |g:netrw_chgwin| window.
3017
3018Related topics: |netrw-d|
3019
3020
3021PREVIEW WINDOW *netrw-p* *netrw-preview* {{{2
3022
3023One may use a preview window by using the "p" key when the cursor is atop the
3024desired filename to be previewed. The display will then split to show both
3025the browser (where the cursor will remain) and the file (see |:pedit|). By
3026default, the split will be taken horizontally; one may use vertical splitting
3027if one has set |g:netrw_preview| first.
3028
3029An interesting set of netrw settings is: >
3030
3031 let g:netrw_preview = 1
3032 let g:netrw_liststyle = 3
3033 let g:netrw_winsize = 30
3034
3035These will:
3036
3037 1. Make vertical splitting the default for previewing files
3038 2. Make the default listing style "tree"
3039 3. When a vertical preview window is opened, the directory listing
3040 will use only 30% of the columns available; the rest of the window
3041 is used for the preview window.
3042
3043 Related: if you like this idea, you may also find :Lexplore
3044 (|netrw-:Lexplore|) or |g:netrw_chgwin| of interest
3045
3046Also see: |g:netrw_chgwin| |netrw-P| |'previewwindow'| |CTRL-W_z| |:pclose|
3047
3048
3049PREVIOUS WINDOW *netrw-P* *netrw-prvwin* {{{2
3050
3051To edit a file or directory under the cursor in the previously used (last
3052accessed) window (see :he |CTRL-W_p|), press a "P". If there's only one
3053window, then the one window will be horizontally split (by default).
3054
3055If there's more than one window, the previous window will be re-used on
3056the selected file/directory. If the previous window's associated buffer
3057has been modified, and there's only one window with that buffer, then
3058the user will be asked if s/he wishes to save the buffer first (yes,
3059no, or cancel).
3060
3061Related Actions |netrw-cr| |netrw-o| |netrw-t| |netrw-v|
3062Associated setting variables:
3063 |g:netrw_alto| control above/below splitting
3064 |g:netrw_altv| control right/left splitting
3065 |g:netrw_preview| control horizontal vs vertical splitting
3066 |g:netrw_winsize| control initial sizing
3067
3068Also see: |g:netrw_chgwin| |netrw-p|
3069
3070
3071REFRESHING THE LISTING *netrw-refresh* *netrw-ctrl-l* *netrw-ctrl_l* {{{2
3072
3073To refresh either a local or remote directory listing, press ctrl-l (<c-l>) or
3074hit the <cr> when atop the ./ directory entry in the listing. One may also
3075refresh a local directory by using ":e .".
3076
3077
3078REVERSING SORTING ORDER *netrw-r* *netrw-reverse* {{{2
3079
3080One may toggle between normal and reverse sorting order by pressing the
3081"r" key.
3082
3083Related topics: |netrw-s|
3084Associated setting variable: |g:netrw_sort_direction|
3085
3086
3087RENAMING FILES OR DIRECTORIES *netrw-move* *netrw-rename* *netrw-R* {{{2
3088
3089If there are no marked files: (see |netrw-mf|)
3090
3091 Renaming files and directories involves moving the cursor to the
3092 file/directory to be moved (renamed) and pressing "R". You will then be
3093 queried for what you want the file/directory to be renamed to. You may
3094 select a range of lines with the "V" command (visual selection), and then
3095 press "R"; you will be queried for each file as to what you want it
3096 renamed to.
3097
3098If there are marked files: (see |netrw-mf|)
3099
3100 Marked files will be renamed (moved). You will be queried as above in
3101 order to specify where you want the file/directory to be moved.
3102
3103 If you answer a renaming query with a "s/frompattern/topattern/", then
3104 subsequent files on the marked file list will be renamed by taking each
3105 name, applying that substitute, and renaming each file to the result.
3106 As an example : >
3107
3108 mr [query: reply with *.c]
3109 R [query: reply with s/^\(.*\)\.c$/\1.cpp/]
3110<
3111 This example will mark all *.c files and then rename them to *.cpp
3112 files. Netrw will protect you from overwriting local files without
3113 confirmation, but not remote ones.
3114
3115 The ctrl-X character has special meaning for renaming files: >
3116
3117 <c-x> : a single ctrl-x tells netrw to ignore the portion of the response
3118 lying between the last '/' and the ctrl-x.
3119
3120 <c-x><c-x> : a pair of contiguous ctrl-x's tells netrw to ignore any
3121 portion of the string preceding the double ctrl-x's.
3122<
3123 WARNING:~
3124
3125 Note that moving files is a dangerous operation; copies are safer. That's
3126 because a "move" for remote files is actually a copy + delete -- and if
3127 the copy fails and the delete succeeds you may lose the file.
3128 Use at your own risk.
3129
3130The *g:netrw_rename_cmd* variable is used to implement remote renaming. By
3131default its value is: >
3132
3133 ssh HOSTNAME mv
3134<
3135One may rename a block of files and directories by selecting them with
3136V (|linewise-visual|) when using thin style.
3137
3138See |cmdline-editing| for more on how to edit the command line; in particular,
3139you'll find <ctrl-f> (initiates cmdline window editing) and <ctrl-c> (uses the
3140command line under the cursor) useful in conjunction with the R command.
3141
3142
3143SELECTING SORTING STYLE *netrw-s* *netrw-sort* {{{2
3144
3145One may select the sorting style by name, time, or (file) size. The "s" map
3146allows one to circulate amongst the three choices; the directory listing will
3147automatically be refreshed to reflect the selected style.
3148
3149Related topics: |netrw-r| |netrw-S|
3150Associated setting variables: |g:netrw_sort_by| |g:netrw_sort_sequence|
3151
3152
3153SETTING EDITING WINDOW *netrw-editwindow* *netrw-C* *netrw-:NetrwC* {{{2
3154
3155One may select a netrw window for editing with the "C" mapping, using the
3156:NetrwC [win#] command, or by setting |g:netrw_chgwin| to the selected window
3157number. Subsequent selection of a file to edit (|netrw-cr|) will use that
3158window.
3159
3160 * C : by itself, will select the current window holding a netrw buffer
3161 for subsequent editing via |netrw-cr|. The C mapping is only available
3162 while in netrw buffers.
3163
3164 * [count]C : the count will be used as the window number to be used
3165 for subsequent editing via |netrw-cr|.
3166
3167 * :NetrwC will set |g:netrw_chgwin| to the current window
3168
3169 * :NetrwC win# will set |g:netrw_chgwin| to the specified window
3170 number
3171
3172Using >
3173 let g:netrw_chgwin= -1
3174will restore the default editing behavior
3175(ie. subsequent editing will use the current window).
3176
3177Related topics: |netrw-cr| |g:netrw_browse_split|
3178Associated setting variables: |g:netrw_chgwin|
3179
3180
3181SHRINKING OR EXPANDING A NETRW OR LEXPLORE WINDOW *netrw-c-tab* {{{2
3182
3183The <c-tab> key will toggle a netrw or |:Lexplore| window's width,
3184but only if |g:netrw_usetab| exists and is non-zero (and, of course,
3185only if your terminal supports differentiating <c-tab> from a plain
3186<tab>).
3187
3188 * If the current window is a netrw window, toggle its width
3189 (between |g:netrw_wiw| and its original width)
3190
3191 * Else if there is a |:Lexplore| window in the current tab, toggle
3192 its width
3193
3194 * Else bring up a |:Lexplore| window
3195
3196If |g:netrw_usetab| exists and is zero, or if there is a pre-existing mapping
3197for <c-tab>, then the <c-tab> will not be mapped. One may map something other
3198than a <c-tab>, too: (but you'll still need to have had |g:netrw_usetab| set). >
3199
3200 nmap <unique> (whatever) <Plug>NetrwShrink
3201<
3202Related topics: |:Lexplore|
3203Associated setting variable: |g:netrw_usetab|
3204
3205
3206USER SPECIFIED MAPS *netrw-usermaps* {{{1
3207
3208One may make customized user maps. Specify a variable, |g:Netrw_UserMaps|,
3209to hold a |List| of lists of keymap strings and function names: >
3210
3211 [["keymap-sequence","ExampleUserMapFunc"],...]
3212<
3213When netrw is setting up maps for a netrw buffer, if |g:Netrw_UserMaps|
3214exists, then the internal function netrw#UserMaps(islocal) is called.
3215This function goes through all the entries in the |g:Netrw_UserMaps| list:
3216
3217 * sets up maps: >
3218 nno <buffer> <silent> KEYMAP-SEQUENCE
3219 :call s:UserMaps(islocal,"ExampleUserMapFunc")
3220< * refreshes if result from that function call is the string
3221 "refresh"
3222 * if the result string is not "", then that string will be
3223 executed (:exe result)
3224 * if the result is a List, then the above two actions on results
3225 will be taken for every string in the result List
3226
3227The user function is passed one argument; it resembles >
3228
3229 fun! ExampleUserMapFunc(islocal)
3230<
3231where a:islocal is 1 if its a local-directory system call or 0 when
3232remote-directory system call.
3233
3234 *netrw-call* *netrw-expose* *netrw-modify*
3235Use netrw#Expose("varname") to access netrw-internal (script-local)
3236 variables.
3237Use netrw#Modify("varname",newvalue) to change netrw-internal variables.
3238Use netrw#Call("funcname"[,args]) to call a netrw-internal function with
3239 specified arguments.
3240
3241Example: Get a copy of netrw's marked file list: >
3242
3243 let netrwmarkfilelist= netrw#Expose("netrwmarkfilelist")
3244<
3245Example: Modify the value of netrw's marked file list: >
3246
3247 call netrw#Modify("netrwmarkfilelist",[])
3248<
3249Example: Clear netrw's marked file list via a mapping on gu >
3250 " ExampleUserMap: {{{2
3251 fun! ExampleUserMap(islocal)
3252 call netrw#Modify("netrwmarkfilelist",[])
3253 call netrw#Modify('netrwmarkfilemtch_{bufnr("%")}',"")
3254 let retval= ["refresh"]
3255 return retval
3256 endfun
3257 let g:Netrw_UserMaps= [["gu","ExampleUserMap"]]
3258<
3259
326010. Problems and Fixes *netrw-problems* {{{1
3261
3262 (This section is likely to grow as I get feedback)
3263 *netrw-p1*
3264 P1. I use Windows, and my network browsing with ftp doesn't sort by {{{2
3265 time or size! -or- The remote system is a Windows server; why
3266 don't I get sorts by time or size?
3267
3268 Windows' ftp has a minimal support for ls (ie. it doesn't
3269 accept sorting options). It doesn't support the -F which
3270 gives an explanatory character (ABC/ for "ABC is a directory").
3271 Netrw then uses "dir" to get both its thin and long listings.
3272 If you think your ftp does support a full-up ls, put the
3273 following into your <.vimrc>: >
3274
3275 let g:netrw_ftp_list_cmd = "ls -lF"
3276 let g:netrw_ftp_timelist_cmd= "ls -tlF"
3277 let g:netrw_ftp_sizelist_cmd= "ls -slF"
3278<
3279 Alternatively, if you have cygwin on your Windows box, put
3280 into your <.vimrc>: >
3281
3282 let g:netrw_cygwin= 1
3283<
3284 This problem also occurs when the remote system is Windows.
3285 In this situation, the various g:netrw_ftp_[time|size]list_cmds
3286 are as shown above, but the remote system will not correctly
3287 modify its listing behavior.
3288
3289
3290 *netrw-p2*
3291 P2. I tried rcp://user@host/ (or protocol other than ftp) and netrw {{{2
3292 used ssh! That wasn't what I asked for...
3293
3294 Netrw has two methods for browsing remote directories: ssh
3295 and ftp. Unless you specify ftp specifically, ssh is used.
3296 When it comes time to do download a file (not just a directory
3297 listing), netrw will use the given protocol to do so.
3298
3299 *netrw-p3*
3300 P3. I would like long listings to be the default. {{{2
3301
3302 Put the following statement into your |.vimrc|: >
3303
3304 let g:netrw_liststyle= 1
3305<
3306 Check out |netrw-browser-var| for more customizations that
3307 you can set.
3308
3309 *netrw-p4*
3310 P4. My times come up oddly in local browsing {{{2
3311
3312 Does your system's strftime() accept the "%c" to yield dates
3313 such as "Sun Apr 27 11:49:23 1997"? If not, do a
3314 "man strftime" and find out what option should be used. Then
3315 put it into your |.vimrc|: >
3316
3317 let g:netrw_timefmt= "%X" (where X is the option)
3318<
3319 *netrw-p5*
3320 P5. I want my current directory to track my browsing. {{{2
3321 How do I do that?
3322
3323 Put the following line in your |.vimrc|:
3324>
3325 let g:netrw_keepdir= 0
3326<
3327 *netrw-p6*
3328 P6. I use Chinese (or other non-ascii) characters in my filenames, {{{2
3329 and netrw (Explore, Sexplore, Hexplore, etc) doesn't display them!
3330
3331 (taken from an answer provided by Wu Yongwei on the vim
3332 mailing list)
3333 I now see the problem. Your code page is not 936, right? Vim
3334 seems only able to open files with names that are valid in the
3335 current code page, as are many other applications that do not
3336 use the Unicode version of Windows APIs. This is an OS-related
3337 issue. You should not have such problems when the system
3338 locale uses UTF-8, such as modern Linux distros.
3339
3340 (...it is one more reason to recommend that people use utf-8!)
3341
3342 *netrw-p7*
3343 P7. I'm getting "ssh is not executable on your system" -- what do I {{{2
3344 do?
3345
3346 (Dudley Fox) Most people I know use putty for windows ssh. It
3347 is a free ssh/telnet application. You can read more about it
3348 here:
3349
3350 http://www.chiark.greenend.org.uk/~sgtatham/putty/ Also:
3351
3352 (Marlin Unruh) This program also works for me. It's a single
3353 executable, so he/she can copy it into the Windows\System32
3354 folder and create a shortcut to it.
3355
3356 (Dudley Fox) You might also wish to consider plink, as it
3357 sounds most similar to what you are looking for. plink is an
3358 application in the putty suite.
3359
3360 http://the.earth.li/~sgtatham/putty/0.58/htmldoc/Chapter7.html#plink
3361
3362 (Vissale Neang) Maybe you can try OpenSSH for windows, which
3363 can be obtained from:
3364
3365 http://sshwindows.sourceforge.net/
3366
3367 It doesn't need the full Cygwin package.
3368
3369 (Antoine Mechelynck) For individual Unix-like programs needed
3370 for work in a native-Windows environment, I recommend getting
3371 them from the GnuWin32 project on sourceforge if it has them:
3372
3373 http://gnuwin32.sourceforge.net/
3374
3375 Unlike Cygwin, which sets up a Unix-like virtual machine on
3376 top of Windows, GnuWin32 is a rewrite of Unix utilities with
3377 Windows system calls, and its programs works quite well in the
3378 cmd.exe "Dos box".
3379
3380 (dave) Download WinSCP and use that to connect to the server.
3381 In Preferences > Editors, set gvim as your editor:
3382
3383 - Click "Add..."
3384 - Set External Editor (adjust path as needed, include
3385 the quotes and !.! at the end):
3386 "c:\Program Files\Vim\vim82\gvim.exe" !.!
3387 - Check that the filetype in the box below is
3388 {asterisk}.{asterisk} (all files), or whatever types
3389 you want (cec: change {asterisk} to * ; I had to
3390 write it that way because otherwise the helptags
3391 system thinks it's a tag)
3392 - Make sure it's at the top of the listbox (click it,
3393 then click "Up" if it's not)
3394 If using the Norton Commander style, you just have to hit <F4>
3395 to edit a file in a local copy of gvim.
3396
3397 (Vit Gottwald) How to generate public/private key and save
3398 public key it on server: >
3399 http://www.chiark.greenend.org.uk/~sgtatham/putty/0.60/htmldoc/Chapter8.html#pubkey-gettingready
3400 (8.3 Getting ready for public key authentication)
3401<
3402 How to use a private key with 'pscp': >
3403
3404 http://www.chiark.greenend.org.uk/~sgtatham/putty/0.60/htmldoc/Chapter5.html
3405 (5.2.4 Using public key authentication with PSCP)
3406<
3407 (Ben Schmidt) I find the ssh included with cwRsync is
3408 brilliant, and install cwRsync or cwRsyncServer on most
3409 Windows systems I come across these days. I guess COPSSH,
3410 packed by the same person, is probably even better for use as
3411 just ssh on Windows, and probably includes sftp, etc. which I
3412 suspect the cwRsync doesn't, though it might
3413
3414 (cec) To make proper use of these suggestions above, you will
3415 need to modify the following user-settable variables in your
3416 .vimrc:
3417
3418 |g:netrw_ssh_cmd| |g:netrw_list_cmd| |g:netrw_mkdir_cmd|
3419 |g:netrw_rm_cmd| |g:netrw_rmdir_cmd| |g:netrw_rmf_cmd|
3420
3421 The first one (|g:netrw_ssh_cmd|) is the most important; most
3422 of the others will use the string in g:netrw_ssh_cmd by
3423 default.
3424
3425 *netrw-p8* *netrw-ml_get*
3426 P8. I'm browsing, changing directory, and bang! ml_get errors {{{2
3427 appear and I have to kill vim. Any way around this?
3428
3429 Normally netrw attempts to avoid writing swapfiles for
3430 its temporary directory buffers. However, on some systems
3431 this attempt appears to be causing ml_get errors to
3432 appear. Please try setting |g:netrw_use_noswf| to 0
3433 in your <.vimrc>: >
3434 let g:netrw_use_noswf= 0
3435<
3436 *netrw-p9*
3437 P9. I'm being pestered with "[something] is a directory" and {{{2
3438 "Press ENTER or type command to continue" prompts...
3439
3440 The "[something] is a directory" prompt is issued by Vim,
3441 not by netrw, and there appears to be no way to work around
3442 it. Coupled with the default cmdheight of 1, this message
3443 causes the "Press ENTER..." prompt. So: read |hit-enter|;
3444 I also suggest that you set your |'cmdheight'| to 2 (or more) in
3445 your <.vimrc> file.
3446
3447 *netrw-p10*
3448 P10. I want to have two windows; a thin one on the left and my {{{2
3449 editing window on the right. How may I accomplish this?
3450
3451 You probably want netrw running as in a side window. If so, you
3452 will likely find that ":[N]Lexplore" does what you want. The
3453 optional "[N]" allows you to select the quantity of columns you
3454 wish the |:Lexplore|r window to start with (see |g:netrw_winsize|
3455 for how this parameter works).
3456
3457 Previous solution:
3458
3459 * Put the following line in your <.vimrc>:
3460 let g:netrw_altv = 1
3461 * Edit the current directory: :e .
3462 * Select some file, press v
3463 * Resize the windows as you wish (see |CTRL-W_<| and
3464 |CTRL-W_>|). If you're using gvim, you can drag
3465 the separating bar with your mouse.
3466 * When you want a new file, use ctrl-w h to go back to the
3467 netrw browser, select a file, then press P (see |CTRL-W_h|
3468 and |netrw-P|). If you're using gvim, you can press
3469 <leftmouse> in the browser window and then press the
3470 <middlemouse> to select the file.
3471
3472
3473 *netrw-p11*
3474 P11. My directory isn't sorting correctly, or unwanted letters are {{{2
3475 appearing in the listed filenames, or things aren't lining
3476 up properly in the wide listing, ...
3477
3478 This may be due to an encoding problem. I myself usually use
3479 utf-8, but really only use ascii (ie. bytes from 32-126).
3480 Multibyte encodings use two (or more) bytes per character.
3481 You may need to change |g:netrw_sepchr| and/or |g:netrw_xstrlen|.
3482
3483 *netrw-p12*
3484 P12. I'm a Windows + putty + ssh user, and when I attempt to {{{2
3485 browse, the directories are missing trailing "/"s so netrw treats
3486 them as file transfers instead of as attempts to browse
3487 subdirectories. How may I fix this?
3488
3489 (mikeyao) If you want to use vim via ssh and putty under Windows,
3490 try combining the use of pscp/psftp with plink. pscp/psftp will
3491 be used to connect and plink will be used to execute commands on
3492 the server, for example: list files and directory using 'ls'.
3493
3494 These are the settings I use to do this:
3495>
3496 " list files, it's the key setting, if you haven't set,
3497 " you will get a blank buffer
3498 let g:netrw_list_cmd = "plink HOSTNAME ls -Fa"
3499 " if you haven't add putty directory in system path, you should
3500 " specify scp/sftp command. For examples:
3501 "let g:netrw_sftp_cmd = "d:\\dev\\putty\\PSFTP.exe"
3502 "let g:netrw_scp_cmd = "d:\\dev\\putty\\PSCP.exe"
3503<
3504 *netrw-p13*
3505 P13. I would like to speed up writes using Nwrite and scp/ssh {{{2
3506 style connections. How? (Thomer M. Gil)
3507
3508 Try using ssh's ControlMaster and ControlPath (see the ssh_config
3509 man page) to share multiple ssh connections over a single network
3510 connection. That cuts out the cryptographic handshake on each
3511 file write, sometimes speeding it up by an order of magnitude.
3512 (see http://thomer.com/howtos/netrw_ssh.html)
3513 (included by permission)
3514
3515 Add the following to your ~/.ssh/config: >
3516
3517 # you change "*" to the hostname you care about
3518 Host *
3519 ControlMaster auto
3520 ControlPath /tmp/%r@%h:%p
3521
3522< Then create an ssh connection to the host and leave it running: >
3523
3524 ssh -N host.domain.com
3525
3526< Now remotely open a file with Vim's Netrw and enjoy the
3527 zippiness: >
3528
3529 vim scp://host.domain.com//home/user/.bashrc
3530<
3531 *netrw-p14*
3532 P14. How may I use a double-click instead of netrw's usual single {{{2
3533 click to open a file or directory? (Ben Fritz)
3534
3535 First, disable netrw's mapping with >
3536 let g:netrw_mousemaps= 0
3537< and then create a netrw buffer only mapping in
3538 $HOME/.vim/after/ftplugin/netrw.vim: >
3539 nmap <buffer> <2-leftmouse> <CR>
3540< Note that setting g:netrw_mousemaps to zero will turn off
3541 all netrw's mouse mappings, not just the <leftmouse> one.
3542 (see |g:netrw_mousemaps|)
3543
3544 *netrw-p15*
3545 P15. When editing remote files (ex. :e ftp://hostname/path/file), {{{2
3546 under Windows I get an |E303| message complaining that its unable
3547 to open a swap file.
3548
3549 (romainl) It looks like you are starting Vim from a protected
3550 directory. Start netrw from your $HOME or other writable
3551 directory.
3552
3553 *netrw-p16*
3554 P16. Netrw is closing buffers on its own. {{{2
3555 What steps will reproduce the problem?
3556 1. :Explore, navigate directories, open a file
3557 2. :Explore, open another file
3558 3. Buffer opened in step 1 will be closed. o
3559 What is the expected output? What do you see instead?
3560 I expect both buffers to exist, but only the last one does.
3561
3562 (Lance) Problem is caused by "set autochdir" in .vimrc.
3563 (drchip) I am able to duplicate this problem with |'acd'| set.
3564 It appears that the buffers are not exactly closed;
3565 a ":ls!" will show them (although ":ls" does not).
3566
3567 *netrw-P17*
3568 P17. How to locally edit a file that's only available via {{{2
3569 another server accessible via ssh?
3570 See http://stackoverflow.com/questions/12469645/
3571 "Using Vim to Remotely Edit A File on ServerB Only
3572 Accessible From ServerA"
3573
3574 *netrw-P18*
3575 P18. How do I get numbering on in directory listings? {{{2
3576 With |g:netrw_bufsettings|, you can control netrw's buffer
3577 settings; try putting >
3578 let g:netrw_bufsettings="noma nomod nu nobl nowrap ro nornu"
3579< in your .vimrc. If you'd like to have relative numbering
3580 instead, try >
3581 let g:netrw_bufsettings="noma nomod nonu nobl nowrap ro rnu"
3582<
3583 *netrw-P19*
3584 P19. How may I have gvim start up showing a directory listing? {{{2
3585 Try putting the following code snippet into your .vimrc: >
3586 augroup VimStartup
3587 au!
3588 au VimEnter * if expand("%") == "" && argc() == 0 &&
3589 \ (v:servername =~ 'GVIM\d*' || v:servername == "")
3590 \ | e . | endif
3591 augroup END
3592< You may use Lexplore instead of "e" if you're so inclined.
3593 This snippet assumes that you have client-server enabled
3594 (ie. a "huge" vim version).
3595
3596 *netrw-P20*
3597 P20. I've made a directory (or file) with an accented character, {{{2
3598 but netrw isn't letting me enter that directory/read that file:
3599
3600 Its likely that the shell or o/s is using a different encoding
3601 than you have vim (netrw) using. A patch to vim supporting
3602 "systemencoding" may address this issue in the future; for
3603 now, just have netrw use the proper encoding. For example: >
3604
3605 au FileType netrw set enc=latin1
3606<
3607 *netrw-P21*
3608 P21. I get an error message when I try to copy or move a file: {{{2
3609
3610 **error** (netrw) tried using g:netrw_localcopycmd<cp>; it doesn't work!
3611
3612 What's wrong?
3613
3614 Netrw uses several system level commands to do things (see
3615
3616 |g:netrw_localcopycmd|, |g:netrw_localmovecmd|,
3617 |g:netrw_mkdir_cmd|).
3618
3619 You may need to adjust the default commands for one or more of
3620 these commands by setting them properly in your .vimrc. Another
3621 source of difficulty is that these commands use vim's local
3622 directory, which may not be the same as the browsing directory
3623 shown by netrw (see |g:netrw_keepdir|).
3624
3625
3626==============================================================================
362711. Credits *netrw-credits* {{{1
3628
3629 Vim editor by Bram Moolenaar (Thanks, Bram!)
3630 dav support by C Campbell
3631 fetch support by Bram Moolenaar and C Campbell
3632 ftp support by C Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
3633 http support by Bram Moolenaar <bram@moolenaar.net>
3634 rcp
3635 rsync support by C Campbell (suggested by Erik Warendorph)
3636 scp support by raf <raf@comdyn.com.au>
3637 sftp support by C Campbell
3638
3639 inputsecret(), BufReadCmd, BufWriteCmd contributed by C Campbell
3640
3641 Jérôme Augé -- also using new buffer method with ftp+.netrc
3642 Bram Moolenaar -- obviously vim itself, :e and v:cmdarg use,
3643 fetch,...
3644 Yasuhiro Matsumoto -- pointing out undo+0r problem and a solution
3645 Erik Warendorph -- for several suggestions (g:netrw_..._cmd
3646 variables, rsync etc)
3647 Doug Claar -- modifications to test for success with ftp
3648 operation
3649
3650==============================================================================
3651Modelines: {{{1
3652vim:tw=78:ts=8:ft=help:noet:norl:fdm=marker