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