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