blob: c22aad354455fa8d9540128a652de3f5850c9eaf [file] [log] [blame]
Christian Brabandtcacfccf2024-11-23 13:28:01 +01001*pi_netrw.txt* For Vim version 9.1. Last change: 2024 Nov 23
Bram Moolenaar071d4272004-06-13 20:20:40 +00002
Bram Moolenaarff034192013-04-24 18:51:19 +02003 ------------------------------------------------
4 NETRW REFERENCE MANUAL by Charles E. Campbell
5 ------------------------------------------------
Christian Brabandtcacfccf2024-11-23 13:28:01 +01006Original Author: Charles E. Campbell
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01007
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01008Copyright: Copyright (C) 2017 Charles E Campbell *netrw-copyright*
Bram Moolenaar5b435d62012-04-05 17:33:26 +02009 The VIM LICENSE applies to the files in this package, including
Konfekt3d7e5672024-10-27 22:16:49 +010010 netrw.vim, pi_netrw.txt, netrwSettings.vim, and
Bram Moolenaar5b435d62012-04-05 17:33:26 +020011 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
Christian Brabandtc5e24ee2024-07-13 18:19:03 +020017 software. Use at your own risk! For bug reports, see |bugs|.
Bram Moolenaar071d4272004-06-13 20:20:40 +000018
Bram Moolenaar8feef4f2015-01-07 16:57:10 +010019 *netrw*
Bram Moolenaar00a927d2010-05-14 23:24:24 +020020 *dav* *ftp* *netrw-file* *rcp* *scp*
21 *davs* *http* *netrw.vim* *rsync* *sftp*
Bram Moolenaar8feef4f2015-01-07 16:57:10 +010022 *fetch* *network*
Bram Moolenaar071d4272004-06-13 20:20:40 +000023
24==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +0000251. Contents *netrw-contents* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000026
Bram Moolenaarff034192013-04-24 18:51:19 +0200271. 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|
Bram Moolenaare0fa3742016-02-20 15:47:01 +010049 Banner Display......................................|netrw-I|
Bram Moolenaarff034192013-04-24 18:51:19 +020050 Bookmarking A Directory.............................|netrw-mb|
51 Browsing............................................|netrw-cr|
Bram Moolenaare0fa3742016-02-20 15:47:01 +010052 Squeezing the Current Tree-Listing Directory........|netrw-s-cr|
Bram Moolenaarff034192013-04-24 18:51:19 +020053 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|
Ernesto Elsäßer26113e52024-11-01 23:17:03 +010056 Change Listing Style (thin wide long tree)..........|netrw-i|
Bram Moolenaarff034192013-04-24 18:51:19 +020057 Changing To A Bookmarked Directory..................|netrw-gb|
Ernesto Elsäßer26113e52024-11-01 23:17:03 +010058 Quick hide/unhide of dot-files......................|netrw-gh|
59 Changing local-only File Permission.................|netrw-gp|
Bram Moolenaarff034192013-04-24 18:51:19 +020060 Changing To A Predecessor Directory.................|netrw-u|
61 Changing To A Successor Directory...................|netrw-U|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +010062 Customizing Browsing With A Special Handler.........|netrw-x|
Bram Moolenaarff034192013-04-24 18:51:19 +020063 Deleting Bookmarks..................................|netrw-mB|
64 Deleting Files Or Directories.......................|netrw-D|
65 Directory Exploring Commands........................|netrw-explore|
66 Exploring With Stars and Patterns...................|netrw-star|
67 Displaying Information About File...................|netrw-qf|
68 Edit File Or Directory Hiding List..................|netrw-ctrl-h|
69 Editing The Sorting Sequence........................|netrw-S|
70 Forcing treatment as a file or directory............|netrw-gd| |netrw-gf|
71 Going Up............................................|netrw--|
72 Hiding Files Or Directories.........................|netrw-a|
73 Improving Browsing..................................|netrw-ssh-hack|
74 Listing Bookmarks And History.......................|netrw-qb|
75 Making A New Directory..............................|netrw-d|
Bram Moolenaarb0d45e72017-11-05 18:19:24 +010076 Making The Browsing Directory The Current Directory.|netrw-cd|
Bram Moolenaarff034192013-04-24 18:51:19 +020077 Marking Files.......................................|netrw-mf|
78 Unmarking Files.....................................|netrw-mF|
Bram Moolenaare0fa3742016-02-20 15:47:01 +010079 Marking Files By Location List......................|netrw-qL|
Bram Moolenaarff034192013-04-24 18:51:19 +020080 Marking Files By QuickFix List......................|netrw-qF|
81 Marking Files By Regular Expression.................|netrw-mr|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +010082 Marked Files: Arbitrary Shell Command...............|netrw-mx|
83 Marked Files: Arbitrary Shell Command, En Bloc......|netrw-mX|
84 Marked Files: Arbitrary Vim Command.................|netrw-mv|
Bram Moolenaare0fa3742016-02-20 15:47:01 +010085 Marked Files: Argument List.........................|netrw-ma| |netrw-mA|
Bram Moolenaarb0d45e72017-11-05 18:19:24 +010086 Marked Files: Buffer List...........................|netrw-cb| |netrw-cB|
Bram Moolenaarff034192013-04-24 18:51:19 +020087 Marked Files: Compression And Decompression.........|netrw-mz|
88 Marked Files: Copying...............................|netrw-mc|
89 Marked Files: Diff..................................|netrw-md|
90 Marked Files: Editing...............................|netrw-me|
91 Marked Files: Grep..................................|netrw-mg|
92 Marked Files: Hiding and Unhiding by Suffix.........|netrw-mh|
93 Marked Files: Moving................................|netrw-mm|
94 Marked Files: Printing..............................|netrw-mp|
95 Marked Files: Sourcing..............................|netrw-ms|
96 Marked Files: Setting the Target Directory..........|netrw-mt|
97 Marked Files: Tagging...............................|netrw-mT|
98 Marked Files: Target Directory Using Bookmarks......|netrw-Tb|
99 Marked Files: Target Directory Using History........|netrw-Th|
100 Marked Files: Unmarking.............................|netrw-mu|
101 Netrw Browser Variables.............................|netrw-browser-var|
102 Netrw Browsing And Option Incompatibilities.........|netrw-incompatible|
103 Netrw Settings Window...............................|netrw-settings-window|
104 Obtaining A File....................................|netrw-O|
105 Preview Window......................................|netrw-p|
106 Previous Window.....................................|netrw-P|
107 Refreshing The Listing..............................|netrw-ctrl-l|
108 Reversing Sorting Order.............................|netrw-r|
109 Renaming Files Or Directories.......................|netrw-R|
110 Selecting Sorting Style.............................|netrw-s|
111 Setting Editing Window..............................|netrw-C|
11210. Problems and Fixes....................................|netrw-problems|
11311. Debugging Netrw Itself................................|netrw-debug|
11412. History...............................................|netrw-history|
11513. Todo..................................................|netrw-todo|
11614. Credits...............................................|netrw-credits|
Bram Moolenaar071d4272004-06-13 20:20:40 +0000117
Bram Moolenaar071d4272004-06-13 20:20:40 +0000118==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00001192. Starting With Netrw *netrw-start* {{{1
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000120
Bram Moolenaar446cb832008-06-24 21:56:24 +0000121Netrw makes reading files, writing files, browsing over a network, and
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100122local browsing easy! First, make sure that you have plugins enabled, so
Bram Moolenaar446cb832008-06-24 21:56:24 +0000123you'll need to have at least the following in your <.vimrc>:
124(or see |netrw-activate|) >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000125
Bram Moolenaar9964e462007-05-05 17:54:07 +0000126 set nocp " 'compatible' is not set
127 filetype plugin on " plugins are enabled
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000128<
129(see |'cp'| and |:filetype-plugin-on|)
130
131Netrw supports "transparent" editing of files on other machines using urls
132(see |netrw-transparent|). As an example of this, let's assume you have an
Bram Moolenaar446cb832008-06-24 21:56:24 +0000133account on some other machine; if you can use scp, try: >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000134
135 vim scp://hostname/path/to/file
136<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000137Want to make ssh/scp easier to use? Check out |netrw-ssh-hack|!
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000138
Bram Moolenaar446cb832008-06-24 21:56:24 +0000139So, what if you have ftp, not ssh/scp? That's easy, too; try >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000140
141 vim ftp://hostname/path/to/file
142<
143Want to make ftp simpler to use? See if your ftp supports a file called
144<.netrc> -- typically it goes in your home directory, has read/write
145permissions for only the user to read (ie. not group, world, other, etc),
146and has lines resembling >
147
148 machine HOSTNAME login USERID password "PASSWORD"
149 machine HOSTNAME login USERID password "PASSWORD"
150 ...
Bram Moolenaar9964e462007-05-05 17:54:07 +0000151 default login USERID password "PASSWORD"
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000152<
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200153Windows' ftp doesn't support .netrc; however, one may have in one's .vimrc: >
154
Bram Moolenaare6ae6222013-05-21 21:01:10 +0200155 let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\MyUserName\MACHINE'
Bram Moolenaar97d62492012-11-15 21:28:22 +0100156<
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100157Netrw will substitute the host's machine name for "MACHINE" from the URL it is
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200158attempting to open, and so one may specify >
159 userid
160 password
Bram Moolenaare6ae6222013-05-21 21:01:10 +0200161for each site in a separate file: c:\Users\MyUserName\MachineName.
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200162
Bram Moolenaar446cb832008-06-24 21:56:24 +0000163Now about browsing -- when you just want to look around before editing a
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000164file. For browsing on your current host, just "edit" a directory: >
165
166 vim .
167 vim /home/userid/path
168<
169For browsing on a remote host, "edit" a directory (but make sure that
170the directory name is followed by a "/"): >
171
172 vim scp://hostname/
173 vim ftp://hostname/path/to/dir/
174<
175See |netrw-browse| for more!
176
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100177There are more protocols supported by netrw than just scp and ftp, too: see the
178next section, |netrw-externapp|, on how to use these external applications with
179netrw and vim.
180
Bram Moolenaar13600302014-05-22 18:26:40 +0200181PREVENTING LOADING *netrw-noload*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000182
183If you want to use plugins, but for some reason don't wish to use netrw, then
184you need to avoid loading both the plugin and the autoload portions of netrw.
185You may do so by placing the following two lines in your <.vimrc>: >
186
187 :let g:loaded_netrw = 1
188 :let g:loaded_netrwPlugin = 1
189<
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000190
191==============================================================================
Bram Moolenaar13600302014-05-22 18:26:40 +02001923. Netrw Reference *netrw-ref* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000193
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100194 Netrw supports several protocols in addition to scp and ftp as mentioned
Bram Moolenaar446cb832008-06-24 21:56:24 +0000195 in |netrw-start|. These include dav, fetch, http,... well, just look
196 at the list in |netrw-externapp|. Each protocol is associated with a
197 variable which holds the default command supporting that protocol.
198
199EXTERNAL APPLICATIONS AND PROTOCOLS *netrw-externapp* {{{2
Bram Moolenaar071d4272004-06-13 20:20:40 +0000200
Bram Moolenaar8d043172014-01-23 14:24:41 +0100201 Protocol Variable Default Value
202 -------- ---------------- -------------
203 dav: *g:netrw_dav_cmd* = "cadaver" if cadaver is executable
204 dav: g:netrw_dav_cmd = "curl -o" elseif curl is available
205 fetch: *g:netrw_fetch_cmd* = "fetch -o" if fetch is available
206 ftp: *g:netrw_ftp_cmd* = "ftp"
207 http: *g:netrw_http_cmd* = "elinks" if elinks is available
208 http: g:netrw_http_cmd = "links" elseif links is available
209 http: g:netrw_http_cmd = "curl" elseif curl is available
210 http: g:netrw_http_cmd = "wget" elseif wget is available
Bram Moolenaarb7398fe2023-05-14 18:50:25 +0100211 http: g:netrw_http_cmd = "fetch" elseif fetch is available
Bram Moolenaar8d043172014-01-23 14:24:41 +0100212 http: *g:netrw_http_put_cmd* = "curl -T"
213 rcp: *g:netrw_rcp_cmd* = "rcp"
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100214 rsync: *g:netrw_rsync_cmd* = "rsync" (see |g:netrw_rsync_sep|)
Bram Moolenaar8d043172014-01-23 14:24:41 +0100215 scp: *g:netrw_scp_cmd* = "scp -q"
216 sftp: *g:netrw_sftp_cmd* = "sftp"
Bram Moolenaar8feef4f2015-01-07 16:57:10 +0100217 file: *g:netrw_file_cmd* = "elinks" or "links"
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100218
219 *g:netrw_http_xcmd* : the option string for http://... protocols are
220 specified via this variable and may be independently overridden. By
221 default, the option arguments for the http-handling commands are: >
222
223 elinks : "-source >"
Bram Moolenaar97d62492012-11-15 21:28:22 +0100224 links : "-dump >"
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100225 curl : "-L -o"
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100226 wget : "-q -O"
227 fetch : "-o"
228<
229 For example, if your system has elinks, and you'd rather see the
230 page using an attempt at rendering the text, you may wish to have >
231 let g:netrw_http_xcmd= "-dump >"
232< in your .vimrc.
233
Bram Moolenaar8d043172014-01-23 14:24:41 +0100234 g:netrw_http_put_cmd: this option specifies both the executable and
235 any needed options. This command does a PUT operation to the url.
236
Bram Moolenaar071d4272004-06-13 20:20:40 +0000237
Bram Moolenaar446cb832008-06-24 21:56:24 +0000238READING *netrw-read* *netrw-nread* {{{2
239
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100240 Generally, one may just use the URL notation with a normal editing
Bram Moolenaar446cb832008-06-24 21:56:24 +0000241 command, such as >
242
243 :e ftp://[user@]machine/path
244<
245 Netrw also provides the Nread command:
246
Bram Moolenaar071d4272004-06-13 20:20:40 +0000247 :Nread ? give help
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000248 :Nread "machine:path" uses rcp
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000249 :Nread "machine path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000250 :Nread "machine id password path" uses ftp
251 :Nread "dav://machine[:port]/path" uses cadaver
252 :Nread "fetch://[user@]machine/path" uses fetch
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000253 :Nread "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000254 :Nread "http://[user@]machine/path" uses http uses wget
255 :Nread "rcp://[user@]machine/path" uses rcp
256 :Nread "rsync://[user@]machine[:port]/path" uses rsync
257 :Nread "scp://[user@]machine[[:#]port]/path" uses scp
258 :Nread "sftp://[user@]machine/path" uses sftp
Bram Moolenaar071d4272004-06-13 20:20:40 +0000259
Bram Moolenaar446cb832008-06-24 21:56:24 +0000260WRITING *netrw-write* *netrw-nwrite* {{{2
261
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100262 One may just use the URL notation with a normal file writing
Bram Moolenaar446cb832008-06-24 21:56:24 +0000263 command, such as >
264
265 :w ftp://[user@]machine/path
266<
267 Netrw also provides the Nwrite command:
268
Bram Moolenaar433f7c82006-03-21 21:29:36 +0000269 :Nwrite ? give help
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000270 :Nwrite "machine:path" uses rcp
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000271 :Nwrite "machine path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000272 :Nwrite "machine id password path" uses ftp
273 :Nwrite "dav://machine[:port]/path" uses cadaver
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000274 :Nwrite "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000275 :Nwrite "rcp://[user@]machine/path" uses rcp
276 :Nwrite "rsync://[user@]machine[:port]/path" uses rsync
277 :Nwrite "scp://[user@]machine[[:#]port]/path" uses scp
278 :Nwrite "sftp://[user@]machine/path" uses sftp
Bram Moolenaar071d4272004-06-13 20:20:40 +0000279 http: not supported!
280
Bram Moolenaar446cb832008-06-24 21:56:24 +0000281SOURCING *netrw-source* {{{2
282
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100283 One may just use the URL notation with the normal file sourcing
Bram Moolenaar446cb832008-06-24 21:56:24 +0000284 command, such as >
285
286 :so ftp://[user@]machine/path
287<
288 Netrw also provides the Nsource command:
289
Bram Moolenaar9964e462007-05-05 17:54:07 +0000290 :Nsource ? give help
291 :Nsource "dav://machine[:port]/path" uses cadaver
292 :Nsource "fetch://[user@]machine/path" uses fetch
293 :Nsource "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc>
294 :Nsource "http://[user@]machine/path" uses http uses wget
295 :Nsource "rcp://[user@]machine/path" uses rcp
296 :Nsource "rsync://[user@]machine[:port]/path" uses rsync
297 :Nsource "scp://[user@]machine[[:#]port]/path" uses scp
298 :Nsource "sftp://[user@]machine/path" uses sftp
299
Bram Moolenaar13600302014-05-22 18:26:40 +0200300DIRECTORY LISTING *netrw-trailingslash* *netrw-dirlist* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +0000301
302 One may browse a directory to get a listing by simply attempting to
303 edit the directory: >
304
305 :e scp://[user]@hostname/path/
306 :e ftp://[user]@hostname/path/
307<
Bram Moolenaar251e1912011-06-19 05:09:16 +0200308 For remote directory listings (ie. those using scp or ftp), that
309 trailing "/" is necessary (the slash tells netrw to treat the argument
310 as a directory to browse instead of as a file to download).
Bram Moolenaar446cb832008-06-24 21:56:24 +0000311
Bram Moolenaar251e1912011-06-19 05:09:16 +0200312 The Nread command may also be used to accomplish this (again, that
313 trailing slash is necessary): >
Bram Moolenaar446cb832008-06-24 21:56:24 +0000314
Bram Moolenaar251e1912011-06-19 05:09:16 +0200315 :Nread [protocol]://[user]@hostname/path/
316<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000317 *netrw-login* *netrw-password*
318CHANGING USERID AND PASSWORD *netrw-chgup* *netrw-userpass* {{{2
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000319
Bram Moolenaar071d4272004-06-13 20:20:40 +0000320 Attempts to use ftp will prompt you for a user-id and a password.
Bram Moolenaar15146672011-10-20 22:22:38 +0200321 These will be saved in global variables |g:netrw_uid| and
322 |s:netrw_passwd|; subsequent use of ftp will re-use those two strings,
323 thereby simplifying use of ftp. However, if you need to use a
324 different user id and/or password, you'll want to call |NetUserPass()|
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000325 first. To work around the need to enter passwords, check if your ftp
326 supports a <.netrc> file in your home directory. Also see
327 |netrw-passwd| (and if you're using ssh/scp hoping to figure out how
Bram Moolenaar15146672011-10-20 22:22:38 +0200328 to not need to use passwords for scp, look at |netrw-ssh-hack|).
Bram Moolenaar071d4272004-06-13 20:20:40 +0000329
330 :NetUserPass [uid [password]] -- prompts as needed
331 :call NetUserPass() -- prompts for uid and password
332 :call NetUserPass("uid") -- prompts for password
333 :call NetUserPass("uid","password") -- sets global uid and password
334
Bram Moolenaare6ae6222013-05-21 21:01:10 +0200335(Related topics: |ftp| |netrw-userpass| |netrw-start|)
336
Bram Moolenaar446cb832008-06-24 21:56:24 +0000337NETRW VARIABLES AND SETTINGS *netrw-variables* {{{2
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200338 (Also see:
339 |netrw-browser-var| : netrw browser option variables
340 |netrw-protocol| : file transfer protocol option variables
341 |netrw-settings| : additional file transfer options
342 |netrw-browser-options| : these options affect browsing directories
343 )
Bram Moolenaar9964e462007-05-05 17:54:07 +0000344
Bram Moolenaar446cb832008-06-24 21:56:24 +0000345Netrw provides a lot of variables which allow you to customize netrw to your
346preferences. One way to look at them is via the command :NetrwSettings (see
347|netrw-settings|) which will display your current netrw settings. Most such
348settings are described below, in |netrw-browser-options|, and in
349|netrw-externapp|:
Bram Moolenaar9964e462007-05-05 17:54:07 +0000350
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100351 *b:netrw_lastfile* last file Network-read/written retained on a
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200352 per-buffer basis (supports plain :Nw )
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100353
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200354 *g:netrw_bufsettings* the settings that netrw buffers have
Bram Moolenaar8feef4f2015-01-07 16:57:10 +0100355 (default) noma nomod nonu nowrap ro nobl
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200356
Bram Moolenaar13600302014-05-22 18:26:40 +0200357 *g:netrw_chgwin* specifies a window number where subsequent file edits
358 will take place. (also see |netrw-C|)
359 (default) -1
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100360
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200361 *g:Netrw_funcref* specifies a function (or functions) to be called when
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200362 netrw edits a file. The file is first edited, and
363 then the function reference (|Funcref|) is called.
364 This variable may also hold a |List| of Funcrefs.
365 (default) not defined. (the capital in g:Netrw...
366 is required by its holding a function reference)
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200367>
368 Example: place in .vimrc; affects all file opening
369 fun! MyFuncRef()
370 endfun
371 let g:Netrw_funcref= function("MyFuncRef")
Bram Moolenaara0f849e2015-10-30 14:37:44 +0100372
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200373<
Bram Moolenaara0f849e2015-10-30 14:37:44 +0100374 *g:Netrw_UserMaps* specifies a function or |List| of functions which can
375 be used to set up user-specified maps and functionality.
376 See |netrw-usermaps|
377
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200378 *g:netrw_ftp* if it doesn't exist, use default ftp
379 =0 use default ftp (uid password)
380 =1 use alternate ftp method (user uid password)
381 If you're having trouble with ftp, try changing the
382 value of this variable to see if the alternate ftp
383 method works for your setup.
384
Bram Moolenaar13600302014-05-22 18:26:40 +0200385 *g:netrw_ftp_options* Chosen by default, these options are supposed to
386 turn interactive prompting off and to restrain ftp
387 from attempting auto-login upon initial connection.
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200388 However, it appears that not all ftp implementations
389 support this (ex. ncftp).
390 ="-i -n"
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000391
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100392 *g:netrw_ftpextracmd* default: doesn't exist
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200393 If this variable exists, then any string it contains
394 will be placed into the commands set to your ftp
395 client. As an example:
396 ="passive"
Bram Moolenaar9964e462007-05-05 17:54:07 +0000397
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000398 *g:netrw_ftpmode* ="binary" (default)
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200399 ="ascii"
Bram Moolenaarf6cf9872005-08-08 22:00:59 +0000400
Bram Moolenaar9964e462007-05-05 17:54:07 +0000401 *g:netrw_ignorenetrc* =0 (default for linux, cygwin)
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200402 =1 If you have a <.netrc> file but it doesn't work and
403 you want it ignored, then set this variable as
404 shown. (default for Windows + cmd.exe)
Bram Moolenaar9964e462007-05-05 17:54:07 +0000405
406 *g:netrw_menu* =0 disable netrw's menu
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200407 =1 (default) netrw's menu enabled
Bram Moolenaar9964e462007-05-05 17:54:07 +0000408
409 *g:netrw_nogx* if this variable exists, then the "gx" map will not
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200410 be available (see |netrw-gx|)
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000411
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100412 *g:netrw_uid* (ftp) user-id, retained on a per-vim-session basis
Bram Moolenaar8feef4f2015-01-07 16:57:10 +0100413 *s:netrw_passwd* (ftp) password, retained on a per-vim-session basis
Bram Moolenaar446cb832008-06-24 21:56:24 +0000414
415 *g:netrw_preview* =0 (default) preview window shown in a horizontally
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200416 split window
417 =1 preview window shown in a vertically split window.
Bram Moolenaar13600302014-05-22 18:26:40 +0200418 Also affects the "previous window" (see |netrw-P|)
419 in the same way.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +0100420 The |g:netrw_alto| variable may be used to provide
421 additional splitting control:
422 g:netrw_preview g:netrw_alto result
423 0 0 |:aboveleft|
424 0 1 |:belowright|
425 1 0 |:topleft|
426 1 1 |:botright|
427 To control sizing, see |g:netrw_winsize|
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000428
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200429 *g:netrw_scpport* = "-P" : option to use to set port for scp
430 *g:netrw_sshport* = "-p" : option to use to set port for ssh
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000431
Bram Moolenaar8feef4f2015-01-07 16:57:10 +0100432 *g:netrw_sepchr* =\0xff
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200433 =\0x01 for enc == euc-jp (and perhaps it should be for
434 others, too, please let me know)
435 Separates priority codes from filenames internally.
436 See |netrw-p12|.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100437
Bram Moolenaar446cb832008-06-24 21:56:24 +0000438 *g:netrw_silent* =0 : transfers done normally
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200439 =1 : transfers done silently
Bram Moolenaar446cb832008-06-24 21:56:24 +0000440
Bram Moolenaar1d59aa12020-09-19 18:50:13 +0200441 *g:netrw_use_errorwindow* =2: messages from netrw will use a popup window
442 Move the mouse and pause to remove the popup window.
Bram Moolenaard592deb2022-06-17 15:42:40 +0100443 (default value if popup windows are available)
Bram Moolenaar1d59aa12020-09-19 18:50:13 +0200444 =1 : messages from netrw will use a separate one
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200445 line window. This window provides reliable
Bram Moolenaar1d59aa12020-09-19 18:50:13 +0200446 delivery of messages.
Bram Moolenaard592deb2022-06-17 15:42:40 +0100447 (default value if popup windows are not available)
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200448 =0 : messages from netrw will use echoerr ;
449 messages don't always seem to show up this
450 way, but one doesn't have to quit the window.
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000451
Bram Moolenaar8feef4f2015-01-07 16:57:10 +0100452 *g:netrw_cygwin* =1 assume scp under windows is from cygwin. Also
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200453 permits network browsing to use ls with time and
454 size sorting (default if windows)
455 =0 assume Windows' scp accepts windows-style paths
456 Network browsing uses dir instead of ls
457 This option is ignored if you're using unix
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000458
459 *g:netrw_use_nt_rcp* =0 don't use the rcp of WinNT, Win2000 and WinXP
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200460 =1 use WinNT's rcp in binary mode (default)
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000461
Bram Moolenaar446cb832008-06-24 21:56:24 +0000462PATHS *netrw-path* {{{2
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000463
464Paths to files are generally user-directory relative for most protocols.
465It is possible that some protocol will make paths relative to some
466associated directory, however.
467>
468 example: vim scp://user@host/somefile
469 example: vim scp://user@host/subdir1/subdir2/somefile
470<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000471where "somefile" is in the "user"'s home directory. If you wish to get a
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000472file using root-relative paths, use the full path:
473>
474 example: vim scp://user@host//somefile
475 example: vim scp://user@host//subdir1/subdir2/somefile
476<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000477
478==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00004794. Network-Oriented File Transfer *netrw-xfer* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000480
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100481Network-oriented file transfer under Vim is implemented by a vim script
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000482(<netrw.vim>) using plugin techniques. It currently supports both reading and
483writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch,
Bram Moolenaar071d4272004-06-13 20:20:40 +0000484dav/cadaver, rsync, or sftp.
485
486http is currently supported read-only via use of wget or fetch.
487
488<netrw.vim> is a standard plugin which acts as glue between Vim and the
489various file transfer programs. It uses autocommand events (BufReadCmd,
490FileReadCmd, BufWriteCmd) to intercept reads/writes with url-like filenames. >
491
492 ex. vim ftp://hostname/path/to/file
493<
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000494The characters preceding the colon specify the protocol to use; in the
Bram Moolenaar446cb832008-06-24 21:56:24 +0000495example, it's ftp. The <netrw.vim> script then formulates a command or a
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000496series of commands (typically ftp) which it issues to an external program
497(ftp, scp, etc) which does the actual file transfer/protocol. Files are read
498from/written to a temporary file (under Unix/Linux, /tmp/...) which the
499<netrw.vim> script will clean up.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000500
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100501Now, a word about Jan Minář's "FTP User Name and Password Disclosure"; first,
502ftp is not a secure protocol. User names and passwords are transmitted "in
503the clear" over the internet; any snooper tool can pick these up; this is not
504a netrw thing, this is a ftp thing. If you're concerned about this, please
505try to use scp or sftp instead.
506
507Netrw re-uses the user id and password during the same vim session and so long
508as the remote hostname remains the same.
509
510Jan seems to be a bit confused about how netrw handles ftp; normally multiple
511commands are performed in a "ftp session", and he seems to feel that the
512uid/password should only be retained over one ftp session. However, netrw
513does every ftp operation in a separate "ftp session"; so remembering the
514uid/password for just one "ftp session" would be the same as not remembering
515the uid/password at all. IMHO this would rapidly grow tiresome as one
516browsed remote directories, for example.
517
518On the other hand, thanks go to Jan M. for pointing out the many
519vulnerabilities that netrw (and vim itself) had had in handling "crafted"
520filenames. The |shellescape()| and |fnameescape()| functions were written in
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200521response by Bram Moolenaar to handle these sort of problems, and netrw has
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100522been modified to use them. Still, my advice is, if the "filename" looks like
523a vim command that you aren't comfortable with having executed, don't open it.
524
Bram Moolenaar9964e462007-05-05 17:54:07 +0000525 *netrw-putty* *netrw-pscp* *netrw-psftp*
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000526One may modify any protocol's implementing external application by setting a
527variable (ex. scp uses the variable g:netrw_scp_cmd, which is defaulted to
Bram Moolenaar433f7c82006-03-21 21:29:36 +0000528"scp -q"). As an example, consider using PuTTY: >
Bram Moolenaar9964e462007-05-05 17:54:07 +0000529
530 let g:netrw_scp_cmd = '"c:\Program Files\PuTTY\pscp.exe" -q -batch'
531 let g:netrw_sftp_cmd= '"c:\Program Files\PuTTY\psftp.exe"'
Bram Moolenaar433f7c82006-03-21 21:29:36 +0000532<
Bram Moolenaar15146672011-10-20 22:22:38 +0200533(note: it has been reported that windows 7 with putty v0.6's "-batch" option
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100534 doesn't work, so its best to leave it off for that system)
Bram Moolenaar15146672011-10-20 22:22:38 +0200535
Bram Moolenaar9964e462007-05-05 17:54:07 +0000536See |netrw-p8| for more about putty, pscp, psftp, etc.
537
Bram Moolenaar071d4272004-06-13 20:20:40 +0000538Ftp, an old protocol, seems to be blessed by numerous implementations.
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000539Unfortunately, some implementations are noisy (ie., add junk to the end of the
540file). Thus, concerned users may decide to write a NetReadFixup() function
541that will clean up after reading with their ftp. Some Unix systems (ie.,
542FreeBSD) provide a utility called "fetch" which uses the ftp protocol but is
543not noisy and more convenient, actually, for <netrw.vim> to use.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100544Consequently, if "fetch" is available (ie. executable), it may be preferable
545to use it for ftp://... based transfers.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000546
547For rcp, scp, sftp, and http, one may use network-oriented file transfers
Bram Moolenaar83bab712005-08-01 21:58:57 +0000548transparently; ie.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000549>
550 vim rcp://[user@]machine/path
551 vim scp://[user@]machine/path
552<
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100553If your ftp supports <.netrc>, then it too can be transparently used
Bram Moolenaar071d4272004-06-13 20:20:40 +0000554if the needed triad of machine name, user id, and password are present in
555that file. Your ftp must be able to use the <.netrc> file on its own, however.
556>
557 vim ftp://[user@]machine[[:#]portnumber]/path
558<
Bram Moolenaaradc21822011-04-01 18:03:16 +0200559Windows provides an ftp (typically c:\Windows\System32\ftp.exe) which uses
560an option, -s:filename (filename can and probably should be a full path)
561which contains ftp commands which will be automatically run whenever ftp
562starts. You may use this feature to enter a user and password for one site: >
563 userid
564 password
Bram Moolenaar13600302014-05-22 18:26:40 +0200565< *netrw-windows-netrc* *netrw-windows-s*
566If |g:netrw_ftp_cmd| contains -s:[path/]MACHINE, then (on Windows machines
567only) netrw will substitute the current machine name requested for ftp
568connections for MACHINE. Hence one can have multiple machine.ftp files
569containing login and password for ftp. Example: >
Bram Moolenaaradc21822011-04-01 18:03:16 +0200570
Bram Moolenaarff034192013-04-24 18:51:19 +0200571 let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\Myself\MACHINE'
572 vim ftp://myhost.somewhere.net/
Bram Moolenaar13600302014-05-22 18:26:40 +0200573
Bram Moolenaaradc21822011-04-01 18:03:16 +0200574will use a file >
Bram Moolenaar13600302014-05-22 18:26:40 +0200575
Bram Moolenaaradc21822011-04-01 18:03:16 +0200576 C:\Users\Myself\myhost.ftp
577<
578Often, ftp will need to query the user for the userid and password.
Bram Moolenaar83bab712005-08-01 21:58:57 +0000579The latter will be done "silently"; ie. asterisks will show up instead of
Bram Moolenaar071d4272004-06-13 20:20:40 +0000580the actually-typed-in password. Netrw will retain the userid and password
581for subsequent read/writes from the most recent transfer so subsequent
582transfers (read/write) to or from that machine will take place without
583additional prompting.
584
585 *netrw-urls*
586 +=================================+============================+============+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000587 | Reading | Writing | Uses |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000588 +=================================+============================+============+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000589 | DAV: | | |
590 | dav://host/path | | cadaver |
591 | :Nread dav://host/path | :Nwrite dav://host/path | cadaver |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000592 +---------------------------------+----------------------------+------------+
Bram Moolenaar446cb832008-06-24 21:56:24 +0000593 | DAV + SSL: | | |
594 | davs://host/path | | cadaver |
595 | :Nread davs://host/path | :Nwrite davs://host/path | cadaver |
596 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000597 | FETCH: | | |
598 | fetch://[user@]host/path | | |
599 | fetch://[user@]host:http/path | Not Available | fetch |
600 | :Nread fetch://[user@]host/path| | |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000601 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000602 | FILE: | | |
603 | file:///* | file:///* | |
604 | file://localhost/* | file://localhost/* | |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000605 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000606 | FTP: (*3) | (*3) | |
607 | ftp://[user@]host/path | ftp://[user@]host/path | ftp (*2) |
608 | :Nread ftp://host/path | :Nwrite ftp://host/path | ftp+.netrc |
609 | :Nread host path | :Nwrite host path | ftp+.netrc |
610 | :Nread host uid pass path | :Nwrite host uid pass path | ftp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000611 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000612 | HTTP: wget is executable: (*4) | | |
613 | http://[user@]host/path | Not Available | wget |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000614 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000615 | HTTP: fetch is executable (*4) | | |
616 | http://[user@]host/path | Not Available | fetch |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000617 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000618 | RCP: | | |
619 | rcp://[user@]host/path | rcp://[user@]host/path | rcp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000620 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000621 | RSYNC: | | |
622 | rsync://[user@]host/path | rsync://[user@]host/path | rsync |
623 | :Nread rsync://host/path | :Nwrite rsync://host/path | rsync |
624 | :Nread rcp://host/path | :Nwrite rcp://host/path | rcp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000625 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000626 | SCP: | | |
627 | scp://[user@]host/path | scp://[user@]host/path | scp |
628 | :Nread scp://host/path | :Nwrite scp://host/path | scp (*1) |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000629 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000630 | SFTP: | | |
631 | sftp://[user@]host/path | sftp://[user@]host/path | sftp |
632 | :Nread sftp://host/path | :Nwrite sftp://host/path | sftp (*1) |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000633 +=================================+============================+============+
634
635 (*1) For an absolute path use scp://machine//path.
636
637 (*2) if <.netrc> is present, it is assumed that it will
638 work with your ftp client. Otherwise the script will
Bram Moolenaar9964e462007-05-05 17:54:07 +0000639 prompt for user-id and password.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000640
zeertzjqd086b8f2024-02-25 15:42:52 +0800641 (*3) for ftp, "machine" may be machine#port or machine:port
Bram Moolenaar071d4272004-06-13 20:20:40 +0000642 if a different port is needed than the standard ftp port
643
644 (*4) for http:..., if wget is available it will be used. Otherwise,
645 if fetch is available it will be used.
646
647Both the :Nread and the :Nwrite ex-commands can accept multiple filenames.
648
649
650NETRC *netrw-netrc*
651
Bram Moolenaar446cb832008-06-24 21:56:24 +0000652The <.netrc> file, typically located in your home directory, contains lines
653therein which map a hostname (machine name) to the user id and password you
654prefer to use with it.
655
Bram Moolenaar071d4272004-06-13 20:20:40 +0000656The typical syntax for lines in a <.netrc> file is given as shown below.
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000657Ftp under Unix usually supports <.netrc>; ftp under Windows usually doesn't.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000658>
659 machine {full machine name} login {user-id} password "{password}"
660 default login {user-id} password "{password}"
661
662Your ftp client must handle the use of <.netrc> on its own, but if the
663<.netrc> file exists, an ftp transfer will not ask for the user-id or
664password.
665
666 Note:
667 Since this file contains passwords, make very sure nobody else can
668 read this file! Most programs will refuse to use a .netrc that is
669 readable for others. Don't forget that the system administrator can
Bram Moolenaar446cb832008-06-24 21:56:24 +0000670 still read the file! Ie. for Linux/Unix: chmod 600 .netrc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000671
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200672Even though Windows' ftp clients typically do not support .netrc, netrw has
673a work-around: see |netrw-windows-s|.
674
Bram Moolenaar071d4272004-06-13 20:20:40 +0000675
676PASSWORD *netrw-passwd*
677
678The script attempts to get passwords for ftp invisibly using |inputsecret()|,
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200679a built-in Vim function. See |netrw-userpass| for how to change the password
Bram Moolenaar071d4272004-06-13 20:20:40 +0000680after one has set it.
681
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000682Unfortunately there doesn't appear to be a way for netrw to feed a password to
683scp. Thus every transfer via scp will require re-entry of the password.
Bram Moolenaar446cb832008-06-24 21:56:24 +0000684However, |netrw-ssh-hack| can help with this problem.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000685
686
687==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00006885. Activation *netrw-activate* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000689
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000690Network-oriented file transfers are available by default whenever Vim's
Bram Moolenaar446cb832008-06-24 21:56:24 +0000691|'nocompatible'| mode is enabled. Netrw's script files reside in your
692system's plugin, autoload, and syntax directories; just the
693plugin/netrwPlugin.vim script is sourced automatically whenever you bring up
694vim. The main script in autoload/netrw.vim is only loaded when you actually
695use netrw. I suggest that, at a minimum, you have at least the following in
696your <.vimrc> customization file: >
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000697
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000698 set nocp
699 if version >= 600
700 filetype plugin indent on
701 endif
702<
Bram Moolenaar8feef4f2015-01-07 16:57:10 +0100703By also including the following lines in your .vimrc, one may have netrw
704immediately activate when using [g]vim without any filenames, showing the
705current directory: >
706
707 " Augroup VimStartup:
708 augroup VimStartup
709 au!
710 au VimEnter * if expand("%") == "" | e . | endif
711 augroup END
712<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000713
714==============================================================================
Bram Moolenaar13600302014-05-22 18:26:40 +02007156. Transparent Remote File Editing *netrw-transparent* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000716
717Transparent file transfers occur whenever a regular file read or write
Bram Moolenaar446cb832008-06-24 21:56:24 +0000718(invoked via an |:autocmd| for |BufReadCmd|, |BufWriteCmd|, or |SourceCmd|
719events) is made. Thus one may read, write, or source files across networks
720just as easily as if they were local files! >
Bram Moolenaar071d4272004-06-13 20:20:40 +0000721
722 vim ftp://[user@]machine/path
723 ...
724 :wq
725
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000726See |netrw-activate| for more on how to encourage your vim to use plugins
727such as netrw.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000728
Bram Moolenaar1d59aa12020-09-19 18:50:13 +0200729For password-free use of scp:, see |netrw-ssh-hack|.
730
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000731
Bram Moolenaar071d4272004-06-13 20:20:40 +0000732==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00007337. Ex Commands *netrw-ex* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000734
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000735The usual read/write commands are supported. There are also a few
Bram Moolenaar446cb832008-06-24 21:56:24 +0000736additional commands available. Often you won't need to use Nwrite or
Bram Moolenaar9964e462007-05-05 17:54:07 +0000737Nread as shown in |netrw-transparent| (ie. simply use >
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100738 :e URL
739 :r URL
740 :w URL
Bram Moolenaar9964e462007-05-05 17:54:07 +0000741instead, as appropriate) -- see |netrw-urls|. In the explanations
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100742below, a {netfile} is a URL to a remote file.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000743
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200744 *:Nwrite* *:Nw*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000745:[range]Nw[rite] Write the specified lines to the current
Bram Moolenaar071d4272004-06-13 20:20:40 +0000746 file as specified in b:netrw_lastfile.
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200747 (related: |netrw-nwrite|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000748
Bram Moolenaar446cb832008-06-24 21:56:24 +0000749:[range]Nw[rite] {netfile} [{netfile}]...
Bram Moolenaar071d4272004-06-13 20:20:40 +0000750 Write the specified lines to the {netfile}.
751
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200752 *:Nread* *:Nr*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100753:Nr[ead] Read the lines from the file specified in b:netrw_lastfile
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200754 into the current buffer. (related: |netrw-nread|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000755
Bram Moolenaar446cb832008-06-24 21:56:24 +0000756:Nr[ead] {netfile} {netfile}...
Bram Moolenaar071d4272004-06-13 20:20:40 +0000757 Read the {netfile} after the current line.
758
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200759 *:Nsource* *:Ns*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000760:Ns[ource] {netfile}
Bram Moolenaar9964e462007-05-05 17:54:07 +0000761 Source the {netfile}.
762 To start up vim using a remote .vimrc, one may use
763 the following (all on one line) (tnx to Antoine Mechelynck) >
764 vim -u NORC -N
765 --cmd "runtime plugin/netrwPlugin.vim"
766 --cmd "source scp://HOSTNAME/.vimrc"
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200767< (related: |netrw-source|)
768
769:call NetUserPass() *NetUserPass()*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000770 If g:netrw_uid and s:netrw_passwd don't exist,
771 this function will query the user for them.
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200772 (related: |netrw-userpass|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000773
774:call NetUserPass("userid")
Bram Moolenaar446cb832008-06-24 21:56:24 +0000775 This call will set the g:netrw_uid and, if
Bram Moolenaar071d4272004-06-13 20:20:40 +0000776 the password doesn't exist, will query the user for it.
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200777 (related: |netrw-userpass|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000778
779:call NetUserPass("userid","passwd")
Bram Moolenaar446cb832008-06-24 21:56:24 +0000780 This call will set both the g:netrw_uid and s:netrw_passwd.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000781 The user-id and password are used by ftp transfers. One may
Bram Moolenaar446cb832008-06-24 21:56:24 +0000782 effectively remove the user-id and password by using empty
783 strings (ie. "").
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200784 (related: |netrw-userpass|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000785
Bram Moolenaar9964e462007-05-05 17:54:07 +0000786:NetrwSettings This command is described in |netrw-settings| -- used to
zeertzjqd086b8f2024-02-25 15:42:52 +0800787 display netrw settings and change netrw behavior.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000788
Bram Moolenaar071d4272004-06-13 20:20:40 +0000789
790==============================================================================
Bram Moolenaar13600302014-05-22 18:26:40 +02007918. Variables and Options *netrw-var* *netrw-settings* {{{1
Bram Moolenaar446cb832008-06-24 21:56:24 +0000792
Bram Moolenaar15146672011-10-20 22:22:38 +0200793(also see: |netrw-options| |netrw-variables| |netrw-protocol|
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200794 |netrw-browser-settings| |netrw-browser-options| )
Bram Moolenaar071d4272004-06-13 20:20:40 +0000795
Bram Moolenaar9964e462007-05-05 17:54:07 +0000796The <netrw.vim> script provides several variables which act as options to
Bram Moolenaar446cb832008-06-24 21:56:24 +0000797affect <netrw.vim>'s file transfer behavior. These variables typically may be
798set in the user's <.vimrc> file: (see also |netrw-settings| |netrw-protocol|)
Bram Moolenaar15146672011-10-20 22:22:38 +0200799 *netrw-options*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000800>
Bram Moolenaar9964e462007-05-05 17:54:07 +0000801 -------------
802 Netrw Options
803 -------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000804 Option Meaning
805 -------------- -----------------------------------------------
806<
Bram Moolenaar9964e462007-05-05 17:54:07 +0000807 b:netrw_col Holds current cursor position (during NetWrite)
808 g:netrw_cygwin =1 assume scp under windows is from cygwin
809 (default/windows)
810 =0 assume scp under windows accepts windows
811 style paths (default/else)
812 g:netrw_ftp =0 use default ftp (uid password)
813 g:netrw_ftpmode ="binary" (default)
814 ="ascii" (your choice)
815 g:netrw_ignorenetrc =1 (default)
816 if you have a <.netrc> file but you don't
Bram Moolenaar071d4272004-06-13 20:20:40 +0000817 want it used, then set this variable. Its
818 mere existence is enough to cause <.netrc>
819 to be ignored.
Bram Moolenaar9964e462007-05-05 17:54:07 +0000820 b:netrw_lastfile Holds latest method/machine/path.
821 b:netrw_line Holds current line number (during NetWrite)
Bram Moolenaar9964e462007-05-05 17:54:07 +0000822 g:netrw_silent =0 transfers done normally
823 =1 transfers done silently
824 g:netrw_uid Holds current user-id for ftp.
Bram Moolenaar9964e462007-05-05 17:54:07 +0000825 g:netrw_use_nt_rcp =0 don't use WinNT/2K/XP's rcp (default)
826 =1 use WinNT/2K/XP's rcp, binary mode
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000827 -----------------------------------------------------------------------
828<
Bram Moolenaar13600302014-05-22 18:26:40 +0200829 *netrw-internal-variables*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000830The script will also make use of the following variables internally, albeit
831temporarily.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000832>
833 -------------------
834 Temporary Variables
835 -------------------
836 Variable Meaning
837 -------- ------------------------------------
838<
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100839 b:netrw_method Index indicating rcp/ftp+.netrc/ftp
840 w:netrw_method (same as b:netrw_method)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000841 g:netrw_machine Holds machine name parsed from input
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100842 b:netrw_fname Holds filename being accessed >
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000843 ------------------------------------------------------------
844<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000845 *netrw-protocol*
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000846
847Netrw supports a number of protocols. These protocols are invoked using the
848variables listed below, and may be modified by the user.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000849>
850 ------------------------
Bram Moolenaar9964e462007-05-05 17:54:07 +0000851 Protocol Control Options
Bram Moolenaar071d4272004-06-13 20:20:40 +0000852 ------------------------
Bram Moolenaar9964e462007-05-05 17:54:07 +0000853 Option Type Setting Meaning
854 --------- -------- -------------- ---------------------------
Bram Moolenaar8d043172014-01-23 14:24:41 +0100855< netrw_ftp variable =doesn't exist userid set by "user userid"
Bram Moolenaar9964e462007-05-05 17:54:07 +0000856 =0 userid set by "user userid"
857 =1 userid set by "userid"
858 NetReadFixup function =doesn't exist no change
859 =exists Allows user to have files
860 read via ftp automatically
861 transformed however they wish
862 by NetReadFixup()
Bram Moolenaar8d043172014-01-23 14:24:41 +0100863 g:netrw_dav_cmd var ="cadaver" if cadaver is executable
864 g:netrw_dav_cmd var ="curl -o" elseif curl is executable
865 g:netrw_fetch_cmd var ="fetch -o" if fetch is available
866 g:netrw_ftp_cmd var ="ftp"
867 g:netrw_http_cmd var ="fetch -o" if fetch is available
868 g:netrw_http_cmd var ="wget -O" else if wget is available
869 g:netrw_http_put_cmd var ="curl -T"
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100870 |g:netrw_list_cmd| var ="ssh USEPORT HOSTNAME ls -Fa"
Bram Moolenaar8d043172014-01-23 14:24:41 +0100871 g:netrw_rcp_cmd var ="rcp"
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100872 g:netrw_rsync_cmd var ="rsync"
873 *g:netrw_rsync_sep* var ="/" used to separate the hostname
874 from the file spec
Bram Moolenaar8d043172014-01-23 14:24:41 +0100875 g:netrw_scp_cmd var ="scp -q"
876 g:netrw_sftp_cmd var ="sftp" >
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000877 -------------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000878<
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000879 *netrw-ftp*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000880
Bram Moolenaar9964e462007-05-05 17:54:07 +0000881The g:netrw_..._cmd options (|g:netrw_ftp_cmd| and |g:netrw_sftp_cmd|)
882specify the external program to use handle the ftp protocol. They may
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200883include command line options (such as -p for passive mode). Example: >
Bram Moolenaar071d4272004-06-13 20:20:40 +0000884
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200885 let g:netrw_ftp_cmd= "ftp -p"
886<
Bram Moolenaar9964e462007-05-05 17:54:07 +0000887Browsing is supported by using the |g:netrw_list_cmd|; the substring
888"HOSTNAME" will be changed via substitution with whatever the current request
889is for a hostname.
890
891Two options (|g:netrw_ftp| and |netrw-fixup|) both help with certain ftp's
892that give trouble . In order to best understand how to use these options if
893ftp is giving you troubles, a bit of discussion is provided on how netrw does
894ftp reads.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000895
896For ftp, netrw typically builds up lines of one of the following formats in a
Bram Moolenaar071d4272004-06-13 20:20:40 +0000897temporary file:
898>
899 IF g:netrw_ftp !exists or is not 1 IF g:netrw_ftp exists and is 1
900 ---------------------------------- ------------------------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000901<
Bram Moolenaar9964e462007-05-05 17:54:07 +0000902 open machine [port] open machine [port]
903 user userid password userid password
904 [g:netrw_ftpmode] password
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200905 [g:netrw_ftpextracmd] [g:netrw_ftpmode]
Bram Moolenaar9964e462007-05-05 17:54:07 +0000906 get filename tempfile [g:netrw_extracmd]
907 get filename tempfile >
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000908 ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000909<
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200910The |g:netrw_ftpmode| and |g:netrw_ftpextracmd| are optional.
Bram Moolenaar9964e462007-05-05 17:54:07 +0000911
Bram Moolenaar071d4272004-06-13 20:20:40 +0000912Netrw then executes the lines above by use of a filter:
913>
914 :%! {g:netrw_ftp_cmd} -i [-n]
915<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000916where
917 g:netrw_ftp_cmd is usually "ftp",
918 -i tells ftp not to be interactive
919 -n means don't use netrc and is used for Method #3 (ftp w/o <.netrc>)
920
921If <.netrc> exists it will be used to avoid having to query the user for
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000922userid and password. The transferred file is put into a temporary file.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000923The temporary file is then read into the main editing session window that
924requested it and the temporary file deleted.
925
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000926If your ftp doesn't accept the "user" command and immediately just demands a
927userid, then try putting "let netrw_ftp=1" in your <.vimrc>.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000928
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000929 *netrw-cadaver*
930To handle the SSL certificate dialog for untrusted servers, one may pull
931down the certificate and place it into /usr/ssl/cert.pem. This operation
932renders the server treatment as "trusted".
933
Bram Moolenaar433f7c82006-03-21 21:29:36 +0000934 *netrw-fixup* *netreadfixup*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000935If your ftp for whatever reason generates unwanted lines (such as AUTH
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100936messages) you may write a NetReadFixup() function:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000937>
938 function! NetReadFixup(method,line1,line2)
939 " a:line1: first new line in current file
940 " a:line2: last new line in current file
941 if a:method == 1 "rcp
942 elseif a:method == 2 "ftp + <.netrc>
943 elseif a:method == 3 "ftp + machine,uid,password,filename
944 elseif a:method == 4 "scp
945 elseif a:method == 5 "http/wget
946 elseif a:method == 6 "dav/cadaver
947 elseif a:method == 7 "rsync
948 elseif a:method == 8 "fetch
949 elseif a:method == 9 "sftp
Bram Moolenaar9964e462007-05-05 17:54:07 +0000950 else " complain
Bram Moolenaar071d4272004-06-13 20:20:40 +0000951 endif
952 endfunction
953>
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000954The NetReadFixup() function will be called if it exists and thus allows you to
Nir Lichtman1e34b952024-05-08 19:19:34 +0200955customize your reading process.
956
Bram Moolenaare6ae6222013-05-21 21:01:10 +0200957(Related topics: |ftp| |netrw-userpass| |netrw-start|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000958
959==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00009609. Browsing *netrw-browsing* *netrw-browse* *netrw-help* {{{1
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100961 *netrw-browser* *netrw-dir* *netrw-list*
Bram Moolenaar83bab712005-08-01 21:58:57 +0000962
Bram Moolenaar446cb832008-06-24 21:56:24 +0000963INTRODUCTION TO BROWSING *netrw-intro-browse* {{{2
964 (Quick References: |netrw-quickmaps| |netrw-quickcoms|)
Bram Moolenaar83bab712005-08-01 21:58:57 +0000965
Bram Moolenaar446cb832008-06-24 21:56:24 +0000966Netrw supports the browsing of directories on your local system and on remote
967hosts; browsing includes listing files and directories, entering directories,
968editing files therein, deleting files/directories, making new directories,
969moving (renaming) files and directories, copying files and directories, etc.
970One may mark files and execute any system command on them! The Netrw browser
971generally implements the previous explorer's maps and commands for remote
972directories, although details (such as pertinent global variable names)
973necessarily differ. To browse a directory, simply "edit" it! >
Bram Moolenaar269ec652004-07-29 08:43:53 +0000974
Bram Moolenaar446cb832008-06-24 21:56:24 +0000975 vim /your/directory/
976 vim .
977 vim c:\your\directory\
978<
979(Related topics: |netrw-cr| |netrw-o| |netrw-p| |netrw-P| |netrw-t|
980 |netrw-mf| |netrw-mx| |netrw-D| |netrw-R| |netrw-v| )
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000981
982The Netrw remote file and directory browser handles two protocols: ssh and
Bram Moolenaar446cb832008-06-24 21:56:24 +0000983ftp. The protocol in the url, if it is ftp, will cause netrw also to use ftp
984in its remote browsing. Specifying any other protocol will cause it to be
985used for file transfers; but the ssh protocol will be used to do remote
986browsing.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000987
Bram Moolenaar446cb832008-06-24 21:56:24 +0000988To use Netrw's remote directory browser, simply attempt to read a "file" with
989a trailing slash and it will be interpreted as a request to list a directory:
990>
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000991 vim [protocol]://[user@]hostname/path/
Bram Moolenaar4ea8fe12006-03-09 22:32:39 +0000992<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000993where [protocol] is typically scp or ftp. As an example, try: >
Bram Moolenaar4ea8fe12006-03-09 22:32:39 +0000994
Bram Moolenaar446cb832008-06-24 21:56:24 +0000995 vim ftp://ftp.home.vim.org/pub/vim/
996<
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100997For local directories, the trailing slash is not required. Again, because it's
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100998easy to miss: to browse remote directories, the URL must terminate with a
Bram Moolenaar446cb832008-06-24 21:56:24 +0000999slash!
Bram Moolenaar83bab712005-08-01 21:58:57 +00001000
Bram Moolenaar446cb832008-06-24 21:56:24 +00001001If you'd like to avoid entering the password repeatedly for remote directory
1002listings with ssh or scp, see |netrw-ssh-hack|. To avoid password entry with
1003ftp, see |netrw-netrc| (if your ftp supports it).
Bram Moolenaar83bab712005-08-01 21:58:57 +00001004
Bram Moolenaar446cb832008-06-24 21:56:24 +00001005There are several things you can do to affect the browser's display of files:
Bram Moolenaar83bab712005-08-01 21:58:57 +00001006
Bram Moolenaar446cb832008-06-24 21:56:24 +00001007 * To change the listing style, press the "i" key (|netrw-i|).
1008 Currently there are four styles: thin, long, wide, and tree.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001009 To make that change "permanent", see |g:netrw_liststyle|.
Bram Moolenaar83bab712005-08-01 21:58:57 +00001010
Bram Moolenaar446cb832008-06-24 21:56:24 +00001011 * To hide files (don't want to see those xyz~ files anymore?) see
1012 |netrw-ctrl-h|.
Bram Moolenaar83bab712005-08-01 21:58:57 +00001013
Bram Moolenaar446cb832008-06-24 21:56:24 +00001014 * Press s to sort files by name, time, or size.
1015
1016See |netrw-browse-cmds| for all the things you can do with netrw!
1017
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001018 *netrw-getftype* *netrw-filigree* *netrw-ftype*
1019The |getftype()| function is used to append a bit of filigree to indicate
1020filetype to locally listed files:
1021
1022 directory : /
1023 executable : *
1024 fifo : |
1025 links : @
1026 sockets : =
1027
1028The filigree also affects the |g:netrw_sort_sequence|.
1029
Bram Moolenaar446cb832008-06-24 21:56:24 +00001030
1031QUICK HELP *netrw-quickhelp* {{{2
1032 (Use ctrl-] to select a topic)~
1033 Intro to Browsing...............................|netrw-intro-browse|
1034 Quick Reference: Maps.........................|netrw-quickmap|
1035 Quick Reference: Commands.....................|netrw-browse-cmds|
1036 Hiding
1037 Edit hiding list..............................|netrw-ctrl-h|
1038 Hiding Files or Directories...................|netrw-a|
1039 Hiding/Unhiding by suffix.....................|netrw-mh|
1040 Hiding dot-files.............................|netrw-gh|
1041 Listing Style
1042 Select listing style (thin/long/wide/tree)....|netrw-i|
1043 Associated setting variable...................|g:netrw_liststyle|
1044 Shell command used to perform listing.........|g:netrw_list_cmd|
1045 Quick file info...............................|netrw-qf|
1046 Sorted by
1047 Select sorting style (name/time/size).........|netrw-s|
1048 Editing the sorting sequence..................|netrw-S|
Bram Moolenaarc236c162008-07-13 17:41:49 +00001049 Sorting options...............................|g:netrw_sort_options|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001050 Associated setting variable...................|g:netrw_sort_sequence|
1051 Reverse sorting order.........................|netrw-r|
1052
1053
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02001054 *netrw-quickmap* *netrw-quickmaps*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001055QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00001056>
Bram Moolenaar446cb832008-06-24 21:56:24 +00001057 --- ----------------- ----
1058 Map Quick Explanation Link
1059 --- ----------------- ----
1060< <F1> Causes Netrw to issue help
1061 <cr> Netrw will enter the directory or read the file |netrw-cr|
1062 <del> Netrw will attempt to remove the file/directory |netrw-del|
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001063 <c-h> Edit file hiding list |netrw-ctrl-h|
1064 <c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l|
1065 <c-r> Browse using a gvim server |netrw-ctrl-r|
1066 <c-tab> Shrink/expand a netrw/explore window |netrw-c-tab|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001067 - Makes Netrw go up one directory |netrw--|
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001068 a Cycles between normal display, |netrw-a|
Bram Moolenaar938ae282023-02-20 20:44:55 +00001069 hiding (suppress display of files matching g:netrw_list_hide)
1070 and showing (display only files which match g:netrw_list_hide)
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02001071 cd Make browsing directory the current directory |netrw-cd|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001072 C Setting the editing window |netrw-C|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001073 d Make a directory |netrw-d|
1074 D Attempt to remove the file(s)/directory(ies) |netrw-D|
1075 gb Go to previous bookmarked directory |netrw-gb|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001076 gd Force treatment as directory |netrw-gd|
1077 gf Force treatment as file |netrw-gf|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001078 gh Quick hide/unhide of dot-files |netrw-gh|
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001079 gn Make top of tree the directory below the cursor |netrw-gn|
Bram Moolenaar89a9c152021-08-29 21:55:35 +02001080 gp Change local-only file permissions |netrw-gp|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001081 i Cycle between thin, long, wide, and tree listings |netrw-i|
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001082 I Toggle the displaying of the banner |netrw-I|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001083 mb Bookmark current directory |netrw-mb|
1084 mc Copy marked files to marked-file target directory |netrw-mc|
1085 md Apply diff to marked files (up to 3) |netrw-md|
1086 me Place marked files on arg list and edit them |netrw-me|
1087 mf Mark a file |netrw-mf|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001088 mF Unmark files |netrw-mF|
1089 mg Apply vimgrep to marked files |netrw-mg|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001090 mh Toggle marked file suffices' presence on hiding list |netrw-mh|
1091 mm Move marked files to marked-file target directory |netrw-mm|
1092 mp Print marked files |netrw-mp|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001093 mr Mark files using a shell-style |regexp| |netrw-mr|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001094 mt Current browsing directory becomes markfile target |netrw-mt|
1095 mT Apply ctags to marked files |netrw-mT|
1096 mu Unmark all marked files |netrw-mu|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001097 mv Apply arbitrary vim command to marked files |netrw-mv|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001098 mx Apply arbitrary shell command to marked files |netrw-mx|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001099 mX Apply arbitrary shell command to marked files en bloc|netrw-mX|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001100 mz Compress/decompress marked files |netrw-mz|
1101 o Enter the file/directory under the cursor in a new |netrw-o|
Bram Moolenaar938ae282023-02-20 20:44:55 +00001102 browser window. A horizontal split is used.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001103 O Obtain a file specified by cursor |netrw-O|
1104 p Preview the file |netrw-p|
1105 P Browse in the previously used window |netrw-P|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001106 qb List bookmarked directories and history |netrw-qb|
1107 qf Display information on file |netrw-qf|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001108 qF Mark files using a quickfix list |netrw-qF|
Bram Moolenaare0fa3742016-02-20 15:47:01 +01001109 qL Mark files using a |location-list| |netrw-qL|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001110 r Reverse sorting order |netrw-r|
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001111 R Rename the designated file(s)/directory(ies) |netrw-R|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001112 s Select sorting style: by name, time, or file size |netrw-s|
1113 S Specify suffix priority for name-sorting |netrw-S|
1114 t Enter the file/directory under the cursor in a new tab|netrw-t|
1115 u Change to recently-visited directory |netrw-u|
1116 U Change to subsequently-visited directory |netrw-U|
1117 v Enter the file/directory under the cursor in a new |netrw-v|
Bram Moolenaar938ae282023-02-20 20:44:55 +00001118 browser window. A vertical split is used.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001119 x View file with an associated program |netrw-x|
Bram Moolenaar97d62492012-11-15 21:28:22 +01001120 X Execute filename under cursor via |system()| |netrw-X|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001121
Bram Moolenaarc236c162008-07-13 17:41:49 +00001122 % Open a new file in netrw's current directory |netrw-%|
1123
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001124 *netrw-mouse* *netrw-leftmouse* *netrw-middlemouse* *netrw-rightmouse*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001125 <leftmouse> (gvim only) selects word under mouse as if a <cr>
1126 had been pressed (ie. edit file, change directory)
1127 <middlemouse> (gvim only) same as P selecting word under mouse;
1128 see |netrw-P|
1129 <rightmouse> (gvim only) delete file/directory using word under
1130 mouse
1131 <2-leftmouse> (gvim only) when:
Bram Moolenaar13600302014-05-22 18:26:40 +02001132 * in a netrw-selected file, AND
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001133 * |g:netrw_retmap| == 1 AND
Bram Moolenaar13600302014-05-22 18:26:40 +02001134 * the user doesn't already have a <2-leftmouse>
Bram Moolenaarff034192013-04-24 18:51:19 +02001135 mapping defined before netrw is autoloaded,
Bram Moolenaar446cb832008-06-24 21:56:24 +00001136 then a double clicked leftmouse button will return
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001137 to the netrw browser window. See |g:netrw_retmap|.
Bram Moolenaar8d043172014-01-23 14:24:41 +01001138 <s-leftmouse> (gvim only) like mf, will mark files. Dragging
1139 the shifted leftmouse will mark multiple files.
1140 (see |netrw-mf|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00001141
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001142 (to disable mouse buttons while browsing: |g:netrw_mousemaps|)
1143
Bram Moolenaar446cb832008-06-24 21:56:24 +00001144 *netrw-quickcom* *netrw-quickcoms*
1145QUICK REFERENCE: COMMANDS *netrw-explore-cmds* *netrw-browse-cmds* {{{2
Bram Moolenaar8d043172014-01-23 14:24:41 +01001146 :NetrwClean[!]............................................|netrw-clean|
1147 :NetrwSettings............................................|netrw-settings|
1148 :Ntree....................................................|netrw-ntree|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001149 :Explore[!] [dir] Explore directory of current file......|netrw-explore|
1150 :Hexplore[!] [dir] Horizontal Split & Explore.............|netrw-explore|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001151 :Lexplore[!] [dir] Left Explorer Toggle...................|netrw-explore|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001152 :Nexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
1153 :Pexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
1154 :Rexplore Return to Explorer.....................|netrw-explore|
1155 :Sexplore[!] [dir] Split & Explore directory .............|netrw-explore|
1156 :Texplore[!] [dir] Tab & Explore..........................|netrw-explore|
1157 :Vexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
1158
Bram Moolenaare0fa3742016-02-20 15:47:01 +01001159
1160BANNER DISPLAY *netrw-I*
1161
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001162One may toggle the displaying of the banner by pressing "I".
Bram Moolenaare0fa3742016-02-20 15:47:01 +01001163
1164Also See: |g:netrw_banner|
1165
1166
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001167BOOKMARKING A DIRECTORY *netrw-mb* *netrw-bookmark* *netrw-bookmarks* {{{2
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001168
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001169One may easily "bookmark" the currently browsed directory by using >
Bram Moolenaar446cb832008-06-24 21:56:24 +00001170
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001171 mb
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00001172<
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001173 *.netrwbook*
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001174Bookmarks are retained in between sessions of vim in a file called .netrwbook
1175as a |List|, which is typically stored in the first directory on the user's
Bram Moolenaar8024f932020-01-14 19:29:13 +01001176'runtimepath'; entries are kept in sorted order.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001177
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001178If there are marked files and/or directories, mb will add them to the bookmark
1179list.
1180
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001181 *netrw-:NetrwMB*
Bram Moolenaarb7398fe2023-05-14 18:50:25 +01001182Additionally, one may use :NetrwMB to bookmark files or directories. >
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001183
1184 :NetrwMB[!] [files/directories]
1185
1186< No bang: enters files/directories into Netrw's bookmark system
1187
1188 No argument and in netrw buffer:
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001189 if there are marked files : bookmark marked files
1190 otherwise : bookmark file/directory under cursor
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001191 No argument and not in netrw buffer: bookmarks current open file
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001192 Has arguments : |glob()|s each arg and bookmarks them
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001193
1194 With bang: deletes files/directories from Netrw's bookmark system
1195
1196The :NetrwMB command is available outside of netrw buffers (once netrw has been
1197invoked in the session).
1198
1199The file ".netrwbook" holds bookmarks when netrw (and vim) is not active. By
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001200default, its stored on the first directory on the user's |'runtimepath'|.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001201
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001202Related Topics:
1203 |netrw-gb| how to return (go) to a bookmark
1204 |netrw-mB| how to delete bookmarks
1205 |netrw-qb| how to list bookmarks
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001206 |g:netrw_home| controls where .netrwbook is kept
Bram Moolenaar4a85b412006-04-23 22:40:29 +00001207
1208
Bram Moolenaare0fa3742016-02-20 15:47:01 +01001209BROWSING *netrw-enter* *netrw-cr* {{{2
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001210
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001211Browsing is simple: move the cursor onto a file or directory of interest.
Bram Moolenaar843ee412004-06-30 16:16:41 +00001212Hitting the <cr> (the return key) will select the file or directory.
1213Directories will themselves be listed, and files will be opened using the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001214protocol given in the original read request.
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001215
Bram Moolenaar446cb832008-06-24 21:56:24 +00001216 CAVEAT: There are four forms of listing (see |netrw-i|). Netrw assumes that
1217 two or more spaces delimit filenames and directory names for the long and
1218 wide listing formats. Thus, if your filename or directory name has two or
1219 more sequential spaces embedded in it, or any trailing spaces, then you'll
1220 need to use the "thin" format to select it.
Bram Moolenaar843ee412004-06-30 16:16:41 +00001221
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001222The |g:netrw_browse_split| option, which is zero by default, may be used to
Bram Moolenaar446cb832008-06-24 21:56:24 +00001223cause the opening of files to be done in a new window or tab instead of the
1224default. When the option is one or two, the splitting will be taken
1225horizontally or vertically, respectively. When the option is set to three, a
1226<cr> will cause the file to appear in a new tab.
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001227
Bram Moolenaar83bab712005-08-01 21:58:57 +00001228
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001229When using the gui (gvim), one may select a file by pressing the <leftmouse>
1230button. In addition, if
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001231
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001232 * |g:netrw_retmap| == 1 AND (its default value is 0)
Bram Moolenaar446cb832008-06-24 21:56:24 +00001233 * in a netrw-selected file, AND
1234 * the user doesn't already have a <2-leftmouse> mapping defined before
1235 netrw is loaded
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001236
Bram Moolenaar446cb832008-06-24 21:56:24 +00001237then a doubly-clicked leftmouse button will return to the netrw browser
1238window.
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001239
Bram Moolenaar446cb832008-06-24 21:56:24 +00001240Netrw attempts to speed up browsing, especially for remote browsing where one
1241may have to enter passwords, by keeping and re-using previously obtained
1242directory listing buffers. The |g:netrw_fastbrowse| variable is used to
1243control this behavior; one may have slow browsing (no buffer re-use), medium
1244speed browsing (re-use directory buffer listings only for remote directories),
1245and fast browsing (re-use directory buffer listings as often as possible).
1246The price for such re-use is that when changes are made (such as new files
1247are introduced into a directory), the listing may become out-of-date. One may
1248always refresh directory listing buffers by pressing ctrl-L (see
1249|netrw-ctrl-l|).
Bram Moolenaare0fa3742016-02-20 15:47:01 +01001250
1251 *netrw-s-cr*
1252Squeezing the Current Tree-Listing Directory~
1253
1254When the tree listing style is enabled (see |netrw-i|) and one is using
1255gvim, then the <s-cr> mapping may be used to squeeze (close) the
1256directory currently containing the cursor.
1257
1258Otherwise, one may remap a key combination of one's own choice to get
1259this effect: >
1260
1261 nmap <buffer> <silent> <nowait> YOURKEYCOMBO <Plug>NetrwTreeSqueeze
1262<
1263Put this line in $HOME/ftplugin/netrw/netrw.vim; it needs to be generated
1264for netrw buffers only.
Bram Moolenaara6878372014-03-22 21:02:50 +01001265
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001266Related topics:
1267 |netrw-ctrl-r| |netrw-o| |netrw-p|
1268 |netrw-P| |netrw-t| |netrw-v|
1269Associated setting variables:
1270 |g:netrw_browse_split| |g:netrw_fastbrowse|
1271 |g:netrw_ftp_list_cmd| |g:netrw_ftp_sizelist_cmd|
1272 |g:netrw_ftp_timelist_cmd| |g:netrw_ssh_browse_reject|
1273 |g:netrw_ssh_cmd| |g:netrw_use_noswf|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001274
1275
1276BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o* *netrw-horiz* {{{2
1277
1278Normally one enters a file or directory using the <cr>. However, the "o" map
1279allows one to open a new window to hold the new directory listing or file. A
1280horizontal split is used. (for vertical splitting, see |netrw-v|)
1281
1282Normally, the o key splits the window horizontally with the new window and
Bram Moolenaar15146672011-10-20 22:22:38 +02001283cursor at the top.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001284
1285Associated setting variables: |g:netrw_alto| |g:netrw_winsize|
1286
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001287Related topics:
1288 |netrw-ctrl-r| |netrw-o| |netrw-p|
1289 |netrw-P| |netrw-t| |netrw-v|
Bram Moolenaar15146672011-10-20 22:22:38 +02001290Associated setting variables:
1291 |g:netrw_alto| control above/below splitting
1292 |g:netrw_winsize| control initial sizing
Bram Moolenaar446cb832008-06-24 21:56:24 +00001293
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001294BROWSING WITH A NEW TAB *netrw-t* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00001295
1296Normally one enters a file or directory using the <cr>. The "t" map
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001297allows one to open a new window holding the new directory listing or file in
Bram Moolenaarff034192013-04-24 18:51:19 +02001298a new tab.
1299
1300If you'd like to have the new listing in a background tab, use |gT|.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001301
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001302Related topics:
1303 |netrw-ctrl-r| |netrw-o| |netrw-p|
1304 |netrw-P| |netrw-t| |netrw-v|
Bram Moolenaar15146672011-10-20 22:22:38 +02001305Associated setting variables:
1306 |g:netrw_winsize| control initial sizing
Bram Moolenaar446cb832008-06-24 21:56:24 +00001307
1308BROWSING WITH A VERTICALLY SPLIT WINDOW *netrw-v* {{{2
1309
1310Normally one enters a file or directory using the <cr>. However, the "v" map
1311allows one to open a new window to hold the new directory listing or file. A
1312vertical split is used. (for horizontal splitting, see |netrw-o|)
1313
1314Normally, the v key splits the window vertically with the new window and
Bram Moolenaar15146672011-10-20 22:22:38 +02001315cursor at the left.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001316
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001317There is only one tree listing buffer; using "v" on a displayed subdirectory
Bram Moolenaar446cb832008-06-24 21:56:24 +00001318will split the screen, but the same buffer will be shown twice.
1319
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001320Related topics:
1321 |netrw-ctrl-r| |netrw-o| |netrw-p|
1322 |netrw-P| |netrw-t| |netrw-v|
Bram Moolenaar15146672011-10-20 22:22:38 +02001323Associated setting variables:
1324 |g:netrw_altv| control right/left splitting
1325 |g:netrw_winsize| control initial sizing
1326
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001327
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001328BROWSING USING A GVIM SERVER *netrw-ctrl-r* {{{2
1329
1330One may keep a browsing gvim separate from the gvim being used to edit.
1331Use the <c-r> map on a file (not a directory) in the netrw browser, and it
1332will use a gvim server (see |g:netrw_servername|). Subsequent use of <cr>
1333(see |netrw-cr|) will re-use that server for editing files.
1334
1335Related topics:
1336 |netrw-ctrl-r| |netrw-o| |netrw-p|
1337 |netrw-P| |netrw-t| |netrw-v|
1338Associated setting variables:
1339 |g:netrw_servername| : sets name of server
1340 |g:netrw_browse_split| : controls how <cr> will open files
1341
1342
1343CHANGE LISTING STYLE (THIN LONG WIDE TREE) *netrw-i* {{{2
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001344
Bram Moolenaar9964e462007-05-05 17:54:07 +00001345The "i" map cycles between the thin, long, wide, and tree listing formats.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001346
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001347The thin listing format gives just the files' and directories' names.
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001348
Bram Moolenaar8299df92004-07-10 09:47:34 +00001349The long listing is either based on the "ls" command via ssh for remote
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001350directories or displays the filename, file size (in bytes), and the time and
1351date of last modification for local directories. With the long listing
1352format, netrw is not able to recognize filenames which have trailing spaces.
1353Use the thin listing format for such files.
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001354
Bram Moolenaar9964e462007-05-05 17:54:07 +00001355The wide listing format uses two or more contiguous spaces to delineate
1356filenames; when using that format, netrw won't be able to recognize or use
1357filenames which have two or more contiguous spaces embedded in the name or any
1358trailing spaces. The thin listing format will, however, work with such files.
Bram Moolenaar13600302014-05-22 18:26:40 +02001359The wide listing format is the most compact.
Bram Moolenaar9964e462007-05-05 17:54:07 +00001360
1361The tree listing format has a top directory followed by files and directories
Bram Moolenaar13600302014-05-22 18:26:40 +02001362preceded by one or more "|"s, which indicate the directory depth. One may
1363open and close directories by pressing the <cr> key while atop the directory
1364name.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001365
1366One may make a preferred listing style your default; see |g:netrw_liststyle|.
1367As an example, by putting the following line in your .vimrc, >
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001368 let g:netrw_liststyle= 3
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001369the tree style will become your default listing style.
Bram Moolenaar8299df92004-07-10 09:47:34 +00001370
Bram Moolenaar5b435d62012-04-05 17:33:26 +02001371One typical way to use the netrw tree display is to: >
1372
1373 vim .
1374 (use i until a tree display shows)
1375 navigate to a file
1376 v (edit as desired in vertically split window)
1377 ctrl-w h (to return to the netrw listing)
1378 P (edit newly selected file in the previous window)
1379 ctrl-w h (to return to the netrw listing)
1380 P (edit newly selected file in the previous window)
1381 ...etc...
1382<
Bram Moolenaar446cb832008-06-24 21:56:24 +00001383Associated setting variables: |g:netrw_liststyle| |g:netrw_maxfilenamelen|
1384 |g:netrw_timefmt| |g:netrw_list_cmd|
Bram Moolenaar8299df92004-07-10 09:47:34 +00001385
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001386CHANGE FILE PERMISSION *netrw-gp* {{{2
1387
1388"gp" will ask you for a new permission for the file named under the cursor.
1389Currently, this only works for local files.
1390
1391Associated setting variables: |g:netrw_chgperm|
1392
Bram Moolenaar83bab712005-08-01 21:58:57 +00001393
Bram Moolenaar446cb832008-06-24 21:56:24 +00001394CHANGING TO A BOOKMARKED DIRECTORY *netrw-gb* {{{2
Bram Moolenaar843ee412004-06-30 16:16:41 +00001395
Bram Moolenaar446cb832008-06-24 21:56:24 +00001396To change directory back to a bookmarked directory, use
Bram Moolenaar843ee412004-06-30 16:16:41 +00001397
Bram Moolenaar446cb832008-06-24 21:56:24 +00001398 {cnt}gb
Bram Moolenaar843ee412004-06-30 16:16:41 +00001399
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001400Any count may be used to reference any of the bookmarks.
Bram Moolenaarff034192013-04-24 18:51:19 +02001401Note that |netrw-qb| shows both bookmarks and history; to go
1402to a location stored in the history see |netrw-u| and |netrw-U|.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001403
1404Related Topics:
1405 |netrw-mB| how to delete bookmarks
1406 |netrw-mb| how to make a bookmark
1407 |netrw-qb| how to list bookmarks
Bram Moolenaar843ee412004-06-30 16:16:41 +00001408
Bram Moolenaar843ee412004-06-30 16:16:41 +00001409
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001410CHANGING TO A PREDECESSOR DIRECTORY *netrw-u* *netrw-updir* {{{2
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001411
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001412Every time you change to a new directory (new for the current session), netrw
1413will save the directory in a recently-visited directory history list (unless
1414|g:netrw_dirhistmax| is zero; by default, it holds ten entries). With the "u"
1415map, one can change to an earlier directory (predecessor). To do the
1416opposite, see |netrw-U|.
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001417
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001418The "u" map also accepts counts to go back in the history several slots. For
1419your convenience, qb (see |netrw-qb|) lists the history number which may be
1420used in that count.
Bram Moolenaarff034192013-04-24 18:51:19 +02001421
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001422 *.netrwhist*
Bram Moolenaarff034192013-04-24 18:51:19 +02001423See |g:netrw_dirhistmax| for how to control the quantity of history stack
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001424slots. The file ".netrwhist" holds history when netrw (and vim) is not
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001425active. By default, its stored on the first directory on the user's
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001426|'runtimepath'|.
1427
1428Related Topics:
1429 |netrw-U| changing to a successor directory
1430 |g:netrw_home| controls where .netrwhist is kept
Bram Moolenaarff034192013-04-24 18:51:19 +02001431
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001432
Bram Moolenaar446cb832008-06-24 21:56:24 +00001433CHANGING TO A SUCCESSOR DIRECTORY *netrw-U* *netrw-downdir* {{{2
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001434
1435With the "U" map, one can change to a later directory (successor).
1436This map is the opposite of the "u" map. (see |netrw-u|) Use the
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001437qb map to list both the bookmarks and history. (see |netrw-qb|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00001438
Bram Moolenaarff034192013-04-24 18:51:19 +02001439The "U" map also accepts counts to go forward in the history several slots.
1440
1441See |g:netrw_dirhistmax| for how to control the quantity of history stack
1442slots.
1443
Bram Moolenaar446cb832008-06-24 21:56:24 +00001444
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001445CHANGING TREE TOP *netrw-ntree* *:Ntree* *netrw-gn* {{{2
Bram Moolenaar8d043172014-01-23 14:24:41 +01001446
1447One may specify a new tree top for tree listings using >
1448
1449 :Ntree [dirname]
1450
1451Without a "dirname", the current line is used (and any leading depth
1452information is elided).
1453With a "dirname", the specified directory name is used.
1454
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001455The "gn" map will take the word below the cursor and use that for
1456changing the top of the tree listing.
1457
Bram Moolenaar8d043172014-01-23 14:24:41 +01001458
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001459NETRW CLEAN *netrw-clean* *:NetrwClean* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00001460
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001461With :NetrwClean one may easily remove netrw from one's home directory;
Bram Moolenaar446cb832008-06-24 21:56:24 +00001462more precisely, from the first directory on your |'runtimepath'|.
1463
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001464With :NetrwClean!, netrw will attempt to remove netrw from all directories on
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001465your |'runtimepath'|. Of course, you have to have write/delete permissions
1466correct to do this.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001467
1468With either form of the command, netrw will first ask for confirmation
1469that the removal is in fact what you want to do. If netrw doesn't have
1470permission to remove a file, it will issue an error message.
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001471
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001472CUSTOMIZING BROWSING WITH A SPECIAL HANDLER *netrw-x* *netrw-handler* {{{2
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001473
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001474Certain files, such as html, gif, jpeg, (word/office) doc, etc, files, are
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001475best seen with a special handler (ie. a tool provided with your computer's
Konfekt3d7e5672024-10-27 22:16:49 +01001476operating system). Netrw allows one to invoke such special handlers by:
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001477
Konfekt3d7e5672024-10-27 22:16:49 +01001478 * hitting gx with the cursor atop the file path or alternatively x
1479 in a netrw buffer; the former can be disabled by defining the
1480 |g:netrw_nogx| variable
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001481 * when in command line, typing :Open <path>, see |:Open| below.
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001482
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001483One may also use visual mode (see |visual-start|) to select the text that the
Konfekt3d7e5672024-10-27 22:16:49 +01001484special handler will use. Normally gx checks for a close-by URL or file name
1485to pick up the text under the cursor; one may change what |expand()| uses via the
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001486|g:netrw_gx| variable (options include "<cword>", "<cWORD>"). Note that
1487expand("<cfile>") depends on the |'isfname'| setting. Alternatively, one may
1488select the text to be used by gx by making a visual selection (see
1489|visual-block|) and then pressing gx.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001490
Konfekt3d7e5672024-10-27 22:16:49 +01001491The selection function can be adapted for each filetype by adding a function
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001492`Netrw_get_URL_<filetype>`, where <filetype> is given by the 'filetype'.
Konfekt3d7e5672024-10-27 22:16:49 +01001493The function should return the URL or file name to be used by gx, and will
1494fall back to the default behavior if it returns an empty string.
1495For example, special handlers for links Markdown and HTML are
Konfekt3d7e5672024-10-27 22:16:49 +01001496
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001497" make gx work on concealed links regardless of exact cursor position: >
1498
1499 function Netrw_get_URL_markdown()
1500 " markdown URL such as [link text](http://ya.ru 'yandex search')
1501 try
1502 let save_view = winsaveview()
1503 if searchpair('\[.\{-}\](', '', ')\zs', 'cbW', '', line('.')) > 0
1504 return matchstr(getline('.')[col('.')-1:],
1505 \ '\[.\{-}\](\zs' .. g:netrw_regex_url .. '\ze\(\s\+.\{-}\)\?)')
1506 endif
Christian Brabandt9b053262024-11-13 17:14:39 +01001507 return ''
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001508 finally
1509 call winrestview(save_view)
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001510 endtry
1511 endfunction
1512
1513 function Netrw_get_URL_html()
1514 " HTML URL such as <a href='http://www.python.org'>Python is here</a>
1515 " <a href="http://www.python.org"/>
1516 try
1517 let save_view = winsaveview()
1518 if searchpair('<a\s\+href=', '', '\%(</a>\|/>\)\zs', 'cbW', '', line('.')) > 0
1519 return matchstr(getline('.')[col('.') - 1 : ],
1520 \ 'href=["'.."'"..']\?\zs\S\{-}\ze["'.."'"..']\?/\?>')
1521 endif
Christian Brabandt9b053262024-11-13 17:14:39 +01001522 return ''
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001523 finally
1524 call winrestview(save_view)
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001525 endtry
1526 endfunction
Konfekt3d7e5672024-10-27 22:16:49 +01001527<
Konfekt3d7e5672024-10-27 22:16:49 +01001528Other than a file path, the text under the cursor may be a URL. Netrw uses
1529by default the following regular expression to determine if the text under the
1530cursor is a URL:
1531>
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001532 :let g:netrw_regex_url = '\%(\%(http\|ftp\|irc\)s\?\|file\)://\S\{-}'
Konfekt3d7e5672024-10-27 22:16:49 +01001533<
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001534Associated setting variables:
1535 |g:netrw_gx| control how gx picks up the text under the cursor
1536 |g:netrw_nogx| prevent gx map while editing
1537 |g:netrw_suppress_gx_mesg| controls gx's suppression of browser messages
1538
h-east624bb832024-11-09 18:37:32 +01001539OPENING FILES AND LAUNCHING APPS *netrw-gx* *:Open* *:Launch* {{{2
Konfekt3d7e5672024-10-27 22:16:49 +01001540
1541Netrw determines which special handler by the following method:
1542
1543 * if |g:netrw_browsex_viewer| exists, then it will be used to attempt to
S. B. Tama95d6a32024-11-02 15:48:54 +01001544 view files.
Konfekt3d7e5672024-10-27 22:16:49 +01001545 If the viewer you wish to use does not support handling of a remote URL
1546 directory, set |g:netrw_browsex_support_remote| to 0.
1547 * otherwise:
1548
1549 * for Windows : explorer.exe is used
1550 * for Mac OS X : open is used.
1551 * for Linux : xdg-open is used.
1552
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001553To open a path (or URL) <path> by the appropriate handler, type >
Konfekt3d7e5672024-10-27 22:16:49 +01001554
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001555 :Open <path>
1556<
1557No escaping, neither for the shell nor for Vim's command-line, is needed.
Konfekt3d7e5672024-10-27 22:16:49 +01001558
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001559To launch a specific application <app> <args>, often <args> being <path> >
Konfekt3d7e5672024-10-27 22:16:49 +01001560
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001561 :Launch <app> <args>.
Konfekt3d7e5672024-10-27 22:16:49 +01001562
1563Since <args> can be arbitrarily complex, in particular contain many file
1564paths, the escaping is left to the user.
1565
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001566If you disabled the netrw plugin by setting g:loaded_netrwPlugin (see
1567|netrw-noload|), then you can use >
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001568
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001569 :call netrw#Launch('<app> <args>')
1570 :call netrw#Open('<path>')
1571<
Bram Moolenaar446cb832008-06-24 21:56:24 +00001572 *netrw-curdir*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001573DELETING BOOKMARKS *netrw-mB* {{{2
1574
1575To delete a bookmark, use >
1576
1577 {cnt}mB
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001578
1579If there are marked files, then mB will remove them from the
1580bookmark list.
1581
1582Alternatively, one may use :NetrwMB! (see |netrw-:NetrwMB|). >
1583
1584 :NetrwMB! [files/directories]
1585
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001586Related Topics:
1587 |netrw-gb| how to return (go) to a bookmark
1588 |netrw-mb| how to make a bookmark
1589 |netrw-qb| how to list bookmarks
1590
1591
Bram Moolenaar446cb832008-06-24 21:56:24 +00001592DELETING FILES OR DIRECTORIES *netrw-delete* *netrw-D* *netrw-del* {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001593
Bram Moolenaar446cb832008-06-24 21:56:24 +00001594If files have not been marked with |netrw-mf|: (local marked file list)
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001595
Bram Moolenaar446cb832008-06-24 21:56:24 +00001596 Deleting/removing files and directories involves moving the cursor to the
1597 file/directory to be deleted and pressing "D". Directories must be empty
1598 first before they can be successfully removed. If the directory is a
1599 softlink to a directory, then netrw will make two requests to remove the
1600 directory before succeeding. Netrw will ask for confirmation before doing
1601 the removal(s). You may select a range of lines with the "V" command
1602 (visual selection), and then pressing "D".
Bram Moolenaar9964e462007-05-05 17:54:07 +00001603
Bram Moolenaar446cb832008-06-24 21:56:24 +00001604If files have been marked with |netrw-mf|: (local marked file list)
1605
1606 Marked files (and empty directories) will be deleted; again, you'll be
1607 asked to confirm the deletion before it actually takes place.
1608
Bram Moolenaar13600302014-05-22 18:26:40 +02001609A further approach is to delete files which match a pattern.
1610
1611 * use :MF pattern (see |netrw-:MF|); then press "D".
1612
1613 * use mr (see |netrw-mr|) which will prompt you for pattern.
1614 This will cause the matching files to be marked. Then,
1615 press "D".
1616
K.Takata71d0ba02024-01-10 03:21:05 +09001617Please note that only empty directories may be deleted with the "D" mapping.
1618Regular files are deleted with |delete()|, too.
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001619
Bram Moolenaar446cb832008-06-24 21:56:24 +00001620The |g:netrw_rm_cmd|, |g:netrw_rmf_cmd|, and |g:netrw_rmdir_cmd| variables are
Bram Moolenaar13600302014-05-22 18:26:40 +02001621used to control the attempts to remove remote files and directories. The
Bram Moolenaar446cb832008-06-24 21:56:24 +00001622g:netrw_rm_cmd is used with files, and its default value is:
1623
1624 g:netrw_rm_cmd: ssh HOSTNAME rm
1625
1626The g:netrw_rmdir_cmd variable is used to support the removal of directories.
1627Its default value is:
1628
Bram Moolenaar13600302014-05-22 18:26:40 +02001629 |g:netrw_rmdir_cmd|: ssh HOSTNAME rmdir
Bram Moolenaar446cb832008-06-24 21:56:24 +00001630
1631If removing a directory fails with g:netrw_rmdir_cmd, netrw then will attempt
1632to remove it again using the g:netrw_rmf_cmd variable. Its default value is:
1633
Bram Moolenaar13600302014-05-22 18:26:40 +02001634 |g:netrw_rmf_cmd|: ssh HOSTNAME rm -f
Bram Moolenaar446cb832008-06-24 21:56:24 +00001635
Bram Moolenaar15146672011-10-20 22:22:38 +02001636Related topics: |netrw-d|
K.Takata71d0ba02024-01-10 03:21:05 +09001637Associated setting variable: |g:netrw_rm_cmd| |g:netrw_ssh_cmd|
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001638
1639
Bram Moolenaar446cb832008-06-24 21:56:24 +00001640*netrw-explore* *netrw-hexplore* *netrw-nexplore* *netrw-pexplore*
Bram Moolenaar8d043172014-01-23 14:24:41 +01001641*netrw-rexplore* *netrw-sexplore* *netrw-texplore* *netrw-vexplore* *netrw-lexplore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001642DIRECTORY EXPLORATION COMMANDS {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001643
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001644 :[N]Explore[!] [dir]... Explore directory of current file *:Explore*
1645 :[N]Hexplore[!] [dir]... Horizontal Split & Explore *:Hexplore*
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001646 :[N]Lexplore[!] [dir]... Left Explorer Toggle *:Lexplore*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001647 :[N]Sexplore[!] [dir]... Split&Explore current file's directory *:Sexplore*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001648 :[N]Vexplore[!] [dir]... Vertical Split & Explore *:Vexplore*
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001649 :Texplore [dir]... Tab & Explore *:Texplore*
1650 :Rexplore ... Return to/from Explorer *:Rexplore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001651
1652 Used with :Explore **/pattern : (also see |netrw-starstar|)
1653 :Nexplore............. go to next matching file *:Nexplore*
1654 :Pexplore............. go to previous matching file *:Pexplore*
1655
Bram Moolenaara6878372014-03-22 21:02:50 +01001656 *netrw-:Explore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001657:Explore will open the local-directory browser on the current file's
1658 directory (or on directory [dir] if specified). The window will be
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001659 split only if the file has been modified and |'hidden'| is not set,
1660 otherwise the browsing window will take over that window. Normally
1661 the splitting is taken horizontally.
Bram Moolenaara6878372014-03-22 21:02:50 +01001662 Also see: |netrw-:Rexplore|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001663:Explore! is like :Explore, but will use vertical splitting.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001664
Bram Moolenaara6878372014-03-22 21:02:50 +01001665 *netrw-:Hexplore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001666:Hexplore [dir] does an :Explore with |:belowright| horizontal splitting.
1667:Hexplore! [dir] does an :Explore with |:aboveleft| horizontal splitting.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001668
1669 *netrw-:Lexplore*
1670:[N]Lexplore [dir] toggles a full height Explorer window on the left hand side
1671 of the current tab. It will open a netrw window on the current
1672 directory if [dir] is omitted; a :Lexplore [dir] will show the
1673 specified directory in the left-hand side browser display no matter
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001674 from which window the command is issued.
1675
1676 By default, :Lexplore will change an uninitialized |g:netrw_chgwin|
1677 to 2; edits will thus preferentially be made in window#2.
1678
1679 The [N] specifies a |g:netrw_winsize| just for the new :Lexplore
K.Takata71d0ba02024-01-10 03:21:05 +09001680 window. That means that
1681 if [N] < 0 : use |N| columns for the Lexplore window
1682 if [N] = 0 : a normal split is made
1683 if [N] > 0 : use N% of the current window will be used for the
1684 new window
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001685
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001686 Those who like this method often also like tree style displays;
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001687 see |g:netrw_liststyle|.
1688
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001689:[N]Lexplore! [dir] is similar to :Lexplore, except that the full-height
1690 Explorer window will open on the right hand side and an
1691 uninitialized |g:netrw_chgwin| will be set to 1 (eg. edits will
1692 preferentially occur in the leftmost window).
1693
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001694 Also see: |netrw-C| |g:netrw_browse_split| |g:netrw_wiw|
1695 |netrw-p| |netrw-P| |g:netrw_chgwin|
1696 |netrw-c-tab| |g:netrw_winsize|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001697
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001698 *netrw-:Sexplore*
1699:[N]Sexplore will always split the window before invoking the local-directory
1700 browser. As with Explore, the splitting is normally done
1701 horizontally.
1702:[N]Sexplore! [dir] is like :Sexplore, but the splitting will be done vertically.
1703
Bram Moolenaara6878372014-03-22 21:02:50 +01001704 *netrw-:Texplore*
Bram Moolenaar8d043172014-01-23 14:24:41 +01001705:Texplore [dir] does a |:tabnew| before generating the browser window
Bram Moolenaar446cb832008-06-24 21:56:24 +00001706
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001707 *netrw-:Vexplore*
1708:[N]Vexplore [dir] does an :Explore with |:leftabove| vertical splitting.
1709:[N]Vexplore! [dir] does an :Explore with |:rightbelow| vertical splitting.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001710
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001711The optional parameters are:
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001712
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001713 [N]: This parameter will override |g:netrw_winsize| to specify the quantity of
1714 rows and/or columns the new explorer window should have.
1715 Otherwise, the |g:netrw_winsize| variable, if it has been specified by the
1716 user, is used to control the quantity of rows and/or columns new
1717 explorer windows should have.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001718
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001719 [dir]: By default, these explorer commands use the current file's directory.
1720 However, one may explicitly provide a directory (path) to use instead;
1721 ie. >
1722
1723 :Explore /some/path
1724<
Bram Moolenaara6878372014-03-22 21:02:50 +01001725 *netrw-:Rexplore*
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001726:Rexplore This command is a little different from the other Explore commands
1727 as it doesn't necessarily open an Explorer window.
Bram Moolenaara6878372014-03-22 21:02:50 +01001728
1729 Return to Explorer~
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001730 When one edits a file using netrw which can occur, for example,
1731 when pressing <cr> while the cursor is atop a filename in a netrw
1732 browser window, a :Rexplore issued while editing that file will
1733 return the display to that of the last netrw browser display in
1734 that window.
Bram Moolenaara6878372014-03-22 21:02:50 +01001735
1736 Return from Explorer~
1737 Conversely, when one is editing a directory, issuing a :Rexplore
Bram Moolenaar13600302014-05-22 18:26:40 +02001738 will return to editing the file that was last edited in that
Bram Moolenaara6878372014-03-22 21:02:50 +01001739 window.
1740
1741 The <2-leftmouse> map (which is only available under gvim and
1742 cooperative terms) does the same as :Rexplore.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001743
Bram Moolenaar8d043172014-01-23 14:24:41 +01001744Also see: |g:netrw_alto| |g:netrw_altv| |g:netrw_winsize|
1745
Bram Moolenaar446cb832008-06-24 21:56:24 +00001746
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001747*netrw-star* *netrw-starpat* *netrw-starstar* *netrw-starstarpat* *netrw-grep*
1748EXPLORING WITH STARS AND PATTERNS {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00001749
1750When Explore, Sexplore, Hexplore, or Vexplore are used with one of the
Bram Moolenaare0fa3742016-02-20 15:47:01 +01001751following four patterns Explore generates a list of files which satisfy the
1752request for the local file system. These exploration patterns will not work
1753with remote file browsing.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001754
1755 */filepat files in current directory which satisfy filepat
1756 **/filepat files in current directory or below which satisfy the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001757 file pattern
Bram Moolenaar446cb832008-06-24 21:56:24 +00001758 *//pattern files in the current directory which contain the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001759 pattern (vimgrep is used)
Bram Moolenaar446cb832008-06-24 21:56:24 +00001760 **//pattern files in the current directory or below which contain
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001761 the pattern (vimgrep is used)
Bram Moolenaar572cb562005-08-05 21:35:02 +00001762<
Bram Moolenaar446cb832008-06-24 21:56:24 +00001763The cursor will be placed on the first file in the list. One may then
1764continue to go to subsequent files on that list via |:Nexplore| or to
1765preceding files on that list with |:Pexplore|. Explore will update the
1766directory and place the cursor appropriately.
1767
1768A plain >
1769 :Explore
1770will clear the explore list.
1771
1772If your console or gui produces recognizable shift-up or shift-down sequences,
1773then you'll likely find using shift-downarrow and shift-uparrow convenient.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001774They're mapped by netrw as follows:
Bram Moolenaar446cb832008-06-24 21:56:24 +00001775
1776 <s-down> == Nexplore, and
1777 <s-up> == Pexplore.
1778
1779As an example, consider
1780>
1781 :Explore */*.c
1782 :Nexplore
1783 :Nexplore
1784 :Pexplore
1785<
1786The status line will show, on the right hand side of the status line, a
1787message like "Match 3 of 20".
1788
Bram Moolenaara6878372014-03-22 21:02:50 +01001789Associated setting variables:
1790 |g:netrw_keepdir| |g:netrw_browse_split|
1791 |g:netrw_fastbrowse| |g:netrw_ftp_browse_reject|
1792 |g:netrw_ftp_list_cmd| |g:netrw_ftp_sizelist_cmd|
1793 |g:netrw_ftp_timelist_cmd| |g:netrw_list_cmd|
1794 |g:netrw_liststyle|
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001795
1796
Bram Moolenaar446cb832008-06-24 21:56:24 +00001797DISPLAYING INFORMATION ABOUT FILE *netrw-qf* {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001798
Bram Moolenaar446cb832008-06-24 21:56:24 +00001799With the cursor atop a filename, pressing "qf" will reveal the file's size
1800and last modification timestamp. Currently this capability is only available
1801for local files.
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001802
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001803
Bram Moolenaar446cb832008-06-24 21:56:24 +00001804EDIT FILE OR DIRECTORY HIDING LIST *netrw-ctrl-h* *netrw-edithide* {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001805
Bram Moolenaar446cb832008-06-24 21:56:24 +00001806The "<ctrl-h>" map brings up a requestor allowing the user to change the
1807file/directory hiding list contained in |g:netrw_list_hide|. The hiding list
1808consists of one or more patterns delimited by commas. Files and/or
1809directories satisfying these patterns will either be hidden (ie. not shown) or
1810be the only ones displayed (see |netrw-a|).
1811
1812The "gh" mapping (see |netrw-gh|) quickly alternates between the usual
1813hiding list and the hiding of files or directories that begin with ".".
1814
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001815As an example, >
1816 let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+'
1817Effectively, this makes the effect of a |netrw-gh| command the initial setting.
1818What it means:
1819
1820 \(^\|\s\s\) : if the line begins with the following, -or-
1821 two consecutive spaces are encountered
1822 \zs : start the hiding match now
1823 \. : if it now begins with a dot
1824 \S\+ : and is followed by one or more non-whitespace
1825 characters
1826
Bram Moolenaar446cb832008-06-24 21:56:24 +00001827Associated setting variables: |g:netrw_hide| |g:netrw_list_hide|
1828Associated topics: |netrw-a| |netrw-gh| |netrw-mh|
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001829
Bram Moolenaar15146672011-10-20 22:22:38 +02001830 *netrw-sort-sequence*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001831EDITING THE SORTING SEQUENCE *netrw-S* *netrw-sortsequence* {{{2
1832
1833When "Sorted by" is name, one may specify priority via the sorting sequence
1834(g:netrw_sort_sequence). The sorting sequence typically prioritizes the
1835name-listing by suffix, although any pattern will do. Patterns are delimited
1836by commas. The default sorting sequence is (all one line):
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001837
1838For Unix: >
1839 '[\/]$,\<core\%(\.\d\+\)\=,\.[a-np-z]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,
1840 \.info$,\.swp$,\.bak$,\~$'
1841<
1842Otherwise: >
Bram Moolenaar446cb832008-06-24 21:56:24 +00001843 '[\/]$,\.[a-np-z]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,
1844 \.swp$,\.bak$,\~$'
1845<
1846The lone * is where all filenames not covered by one of the other patterns
1847will end up. One may change the sorting sequence by modifying the
1848g:netrw_sort_sequence variable (either manually or in your <.vimrc>) or by
1849using the "S" map.
1850
Bram Moolenaarc236c162008-07-13 17:41:49 +00001851Related topics: |netrw-s| |netrw-S|
1852Associated setting variables: |g:netrw_sort_sequence| |g:netrw_sort_options|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001853
1854
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001855EXECUTING FILE UNDER CURSOR VIA SYSTEM() *netrw-X* {{{2
Bram Moolenaar97d62492012-11-15 21:28:22 +01001856
1857Pressing X while the cursor is atop an executable file will yield a prompt
1858using the filename asking for any arguments. Upon pressing a [return], netrw
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001859will then call |system()| with that command and arguments. The result will be
1860displayed by |:echomsg|, and so |:messages| will repeat display of the result.
1861Ansi escape sequences will be stripped out.
1862
1863See |cmdline-window| for directions for more on how to edit the arguments.
Bram Moolenaar97d62492012-11-15 21:28:22 +01001864
1865
Bram Moolenaaradc21822011-04-01 18:03:16 +02001866FORCING TREATMENT AS A FILE OR DIRECTORY *netrw-gd* *netrw-gf* {{{2
1867
1868Remote symbolic links (ie. those listed via ssh or ftp) are problematic
1869in that it is difficult to tell whether they link to a file or to a
1870directory.
1871
1872To force treatment as a file: use >
Bram Moolenaar97d62492012-11-15 21:28:22 +01001873 gf
Bram Moolenaaradc21822011-04-01 18:03:16 +02001874<
1875To force treatment as a directory: use >
Bram Moolenaar97d62492012-11-15 21:28:22 +01001876 gd
Bram Moolenaaradc21822011-04-01 18:03:16 +02001877<
1878
Bram Moolenaar446cb832008-06-24 21:56:24 +00001879GOING UP *netrw--* {{{2
1880
1881To go up a directory, press "-" or press the <cr> when atop the ../ directory
1882entry in the listing.
1883
1884Netrw will use the command in |g:netrw_list_cmd| to perform the directory
1885listing operation after changing HOSTNAME to the host specified by the
Bram Moolenaara6878372014-03-22 21:02:50 +01001886user-prpvided url. By default netrw provides the command as: >
Bram Moolenaar446cb832008-06-24 21:56:24 +00001887
1888 ssh HOSTNAME ls -FLa
Bram Moolenaara6878372014-03-22 21:02:50 +01001889<
Bram Moolenaar446cb832008-06-24 21:56:24 +00001890where the HOSTNAME becomes the [user@]hostname as requested by the attempt to
1891read. Naturally, the user may override this command with whatever is
1892preferred. The NetList function which implements remote browsing
1893expects that directories will be flagged by a trailing slash.
1894
1895
1896HIDING FILES OR DIRECTORIES *netrw-a* *netrw-hiding* {{{2
1897
1898Netrw's browsing facility allows one to use the hiding list in one of three
1899ways: ignore it, hide files which match, and show only those files which
1900match.
1901
1902If no files have been marked via |netrw-mf|:
1903
1904The "a" map allows the user to cycle through the three hiding modes.
1905
1906The |g:netrw_list_hide| variable holds a comma delimited list of patterns
1907based on regular expressions (ex. ^.*\.obj$,^\.) which specify the hiding list.
1908(also see |netrw-ctrl-h|) To set the hiding list, use the <c-h> map. As an
1909example, to hide files which begin with a ".", one may use the <c-h> map to
1910set the hiding list to '^\..*' (or one may put let g:netrw_list_hide= '^\..*'
1911in one's <.vimrc>). One may then use the "a" key to show all files, hide
1912matching files, or to show only the matching files.
1913
1914 Example: \.[ch]$
1915 This hiding list command will hide/show all *.c and *.h files.
1916
1917 Example: \.c$,\.h$
1918 This hiding list command will also hide/show all *.c and *.h
1919 files.
1920
1921Don't forget to use the "a" map to select the mode (normal/hiding/show) you
1922want!
1923
1924If files have been marked using |netrw-mf|, then this command will:
1925
1926 if showing all files or non-hidden files:
1927 modify the g:netrw_list_hide list by appending the marked files to it
1928 and showing only non-hidden files.
1929
1930 else if showing hidden files only:
1931 modify the g:netrw_list_hide list by removing the marked files from it
1932 and showing only non-hidden files.
1933 endif
1934
1935 *netrw-gh* *netrw-hide*
1936As a quick shortcut, one may press >
1937 gh
1938to toggle between hiding files which begin with a period (dot) and not hiding
1939them.
1940
Bram Moolenaar8d043172014-01-23 14:24:41 +01001941Associated setting variables: |g:netrw_list_hide| |g:netrw_hide|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001942Associated topics: |netrw-a| |netrw-ctrl-h| |netrw-mh|
1943
Bram Moolenaar8d043172014-01-23 14:24:41 +01001944 *netrw-gitignore*
1945Netrw provides a helper function 'netrw_gitignore#Hide()' that, when used with
1946|g:netrw_list_hide| automatically hides all git-ignored files.
1947
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001948'netrw_gitignore#Hide' searches for patterns in the following files: >
1949
Bram Moolenaar8d043172014-01-23 14:24:41 +01001950 './.gitignore'
1951 './.git/info/exclude'
1952 global gitignore file: `git config --global core.excludesfile`
1953 system gitignore file: `git config --system core.excludesfile`
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001954<
Bram Moolenaar8d043172014-01-23 14:24:41 +01001955Files that do not exist, are ignored.
1956Git-ignore patterns are taken from existing files, and converted to patterns for
1957hiding files. For example, if you had '*.log' in your '.gitignore' file, it
1958would be converted to '.*\.log'.
1959
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001960To use this function, simply assign its output to |g:netrw_list_hide| option. >
Bram Moolenaar8d043172014-01-23 14:24:41 +01001961
1962 Example: let g:netrw_list_hide= netrw_gitignore#Hide()
1963 Git-ignored files are hidden in Netrw.
1964
1965 Example: let g:netrw_list_hide= netrw_gitignore#Hide('my_gitignore_file')
1966 Function can take additional files with git-ignore patterns.
1967
Bram Moolenaarb7398fe2023-05-14 18:50:25 +01001968 Example: let g:netrw_list_hide= netrw_gitignore#Hide() .. '.*\.swp$'
Bram Moolenaar8d043172014-01-23 14:24:41 +01001969 Combining 'netrw_gitignore#Hide' with custom patterns.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001970<
Bram Moolenaar8d043172014-01-23 14:24:41 +01001971
Bram Moolenaar446cb832008-06-24 21:56:24 +00001972IMPROVING BROWSING *netrw-listhack* *netrw-ssh-hack* {{{2
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001973
1974Especially with the remote directory browser, constantly entering the password
1975is tedious.
1976
Bram Moolenaar9964e462007-05-05 17:54:07 +00001977For Linux/Unix systems, the book "Linux Server Hacks - 100 industrial strength
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +00001978tips & tools" by Rob Flickenger (O'Reilly, ISBN 0-596-00461-3) gives a tip
1979for setting up no-password ssh and scp and discusses associated security
Bram Moolenaar9964e462007-05-05 17:54:07 +00001980issues. It used to be available at http://hacks.oreilly.com/pub/h/66 ,
1981but apparently that address is now being redirected to some "hackzine".
Bram Moolenaare37d50a2008-08-06 17:06:04 +00001982I'll attempt a summary based on that article and on a communication from
1983Ben Schmidt:
Bram Moolenaar843ee412004-06-30 16:16:41 +00001984
Bram Moolenaare37d50a2008-08-06 17:06:04 +00001985 1. Generate a public/private key pair on the local machine
1986 (ssh client): >
1987 ssh-keygen -t rsa
1988 (saving the file in ~/.ssh/id_rsa as prompted)
1989<
1990 2. Just hit the <CR> when asked for passphrase (twice) for no
1991 passphrase. If you do use a passphrase, you will also need to use
1992 ssh-agent so you only have to type the passphrase once per session.
1993 If you don't use a passphrase, simply logging onto your local
1994 computer or getting access to the keyfile in any way will suffice
1995 to access any ssh servers which have that key authorized for login.
1996
1997 3. This creates two files: >
1998 ~/.ssh/id_rsa
1999 ~/.ssh/id_rsa.pub
2000<
2001 4. On the target machine (ssh server): >
2002 cd
2003 mkdir -p .ssh
2004 chmod 0700 .ssh
2005<
2006 5. On your local machine (ssh client): (one line) >
2007 ssh {serverhostname}
2008 cat '>>' '~/.ssh/authorized_keys2' < ~/.ssh/id_rsa.pub
2009<
2010 or, for OpenSSH, (one line) >
2011 ssh {serverhostname}
2012 cat '>>' '~/.ssh/authorized_keys' < ~/.ssh/id_rsa.pub
2013<
2014You can test it out with >
2015 ssh {serverhostname}
2016and you should be log onto the server machine without further need to type
2017anything.
2018
2019If you decided to use a passphrase, do: >
2020 ssh-agent $SHELL
2021 ssh-add
2022 ssh {serverhostname}
2023You will be prompted for your key passphrase when you use ssh-add, but not
2024subsequently when you use ssh. For use with vim, you can use >
2025 ssh-agent vim
2026and, when next within vim, use >
2027 :!ssh-add
2028Alternatively, you can apply ssh-agent to the terminal you're planning on
2029running vim in: >
2030 ssh-agent xterm &
2031and do ssh-add whenever you need.
Bram Moolenaar843ee412004-06-30 16:16:41 +00002032
Bram Moolenaar9964e462007-05-05 17:54:07 +00002033For Windows, folks on the vim mailing list have mentioned that Pageant helps
2034with avoiding the constant need to enter the password.
Bram Moolenaar433f7c82006-03-21 21:29:36 +00002035
Bram Moolenaar446cb832008-06-24 21:56:24 +00002036Kingston Fung wrote about another way to avoid constantly needing to enter
2037passwords:
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00002038
Bram Moolenaar446cb832008-06-24 21:56:24 +00002039 In order to avoid the need to type in the password for scp each time, you
2040 provide a hack in the docs to set up a non password ssh account. I found a
2041 better way to do that: I can use a regular ssh account which uses a
2042 password to access the material without the need to key-in the password
2043 each time. It's good for security and convenience. I tried ssh public key
Christian Brabandt1c5728e2024-05-11 11:12:40 +02002044 authorization + ssh-agent, implementing this, and it works!
Bram Moolenaar446cb832008-06-24 21:56:24 +00002045
2046
Bram Moolenaar8d043172014-01-23 14:24:41 +01002047 Ssh hints:
2048
2049 Thomer Gil has provided a hint on how to speed up netrw+ssh:
2050 http://thomer.com/howtos/netrw_ssh.html
2051
2052 Alex Young has several hints on speeding ssh up:
2053 http://usevim.com/2012/03/16/editing-remote-files/
2054
2055
Bram Moolenaar446cb832008-06-24 21:56:24 +00002056LISTING BOOKMARKS AND HISTORY *netrw-qb* *netrw-listbookmark* {{{2
2057
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002058Pressing "qb" (query bookmarks) will list both the bookmarked directories and
2059directory traversal history.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002060
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002061Related Topics:
2062 |netrw-gb| how to return (go) to a bookmark
2063 |netrw-mb| how to make a bookmark
2064 |netrw-mB| how to delete bookmarks
2065 |netrw-u| change to a predecessor directory via the history stack
2066 |netrw-U| change to a successor directory via the history stack
Bram Moolenaar446cb832008-06-24 21:56:24 +00002067
2068MAKING A NEW DIRECTORY *netrw-d* {{{2
2069
2070With the "d" map one may make a new directory either remotely (which depends
2071on the global variable g:netrw_mkdir_cmd) or locally (which depends on the
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002072global variable g:netrw_localmkdir). Netrw will issue a request for the new
Bram Moolenaar446cb832008-06-24 21:56:24 +00002073directory's name. A bare <CR> at that point will abort the making of the
2074directory. Attempts to make a local directory that already exists (as either
2075a file or a directory) will be detected, reported on, and ignored.
2076
Bram Moolenaar15146672011-10-20 22:22:38 +02002077Related topics: |netrw-D|
Bram Moolenaar8d043172014-01-23 14:24:41 +01002078Associated setting variables: |g:netrw_localmkdir| |g:netrw_mkdir_cmd|
2079 |g:netrw_remote_mkdir| |netrw-%|
Bram Moolenaar446cb832008-06-24 21:56:24 +00002080
2081
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002082MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-cd* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002083
2084By default, |g:netrw_keepdir| is 1. This setting means that the current
Bram Moolenaarff034192013-04-24 18:51:19 +02002085directory will not track the browsing directory. (done for backwards
2086compatibility with v6's file explorer).
Bram Moolenaar446cb832008-06-24 21:56:24 +00002087
Bram Moolenaarff034192013-04-24 18:51:19 +02002088Setting g:netrw_keepdir to 0 tells netrw to make vim's current directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002089track netrw's browsing directory.
2090
2091However, given the default setting for g:netrw_keepdir of 1 where netrw
2092maintains its own separate notion of the current directory, in order to make
Bram Moolenaar85850f32019-07-19 22:05:51 +02002093the two directories the same, use the "cd" map (type cd). That map will
Bram Moolenaar446cb832008-06-24 21:56:24 +00002094set Vim's notion of the current directory to netrw's current browsing
2095directory.
2096
Bram Moolenaar89a9c152021-08-29 21:55:35 +02002097|netrw-cd| : This map's name was changed from "c" to cd (see |netrw-cd|).
2098 This change was done to allow for |netrw-cb| and |netrw-cB| maps.
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002099
Bram Moolenaar446cb832008-06-24 21:56:24 +00002100Associated setting variable: |g:netrw_keepdir|
2101
Bram Moolenaara6878372014-03-22 21:02:50 +01002102MARKING FILES *netrw-:MF* *netrw-mf* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002103 (also see |netrw-mr|)
2104
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002105Netrw provides several ways to mark files:
Bram Moolenaara6878372014-03-22 21:02:50 +01002106
2107 * One may mark files with the cursor atop a filename and
Bram Moolenaar13600302014-05-22 18:26:40 +02002108 then pressing "mf".
Bram Moolenaara6878372014-03-22 21:02:50 +01002109
2110 * With gvim, in addition one may mark files with
Bram Moolenaar13600302014-05-22 18:26:40 +02002111 <s-leftmouse>. (see |netrw-mouse|)
Bram Moolenaara6878372014-03-22 21:02:50 +01002112
2113 * One may use the :MF command, which takes a list of
Bram Moolenaar13600302014-05-22 18:26:40 +02002114 files (for local directories, the list may include
2115 wildcards -- see |glob()|) >
Bram Moolenaara6878372014-03-22 21:02:50 +01002116
2117 :MF *.c
2118<
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002119 (Note that :MF uses |<f-args>| to break the line
2120 at spaces)
2121
2122 * Mark files using the |argument-list| (|netrw-mA|)
2123
2124 * Mark files based upon a |location-list| (|netrw-qL|)
Bram Moolenaar13600302014-05-22 18:26:40 +02002125
2126 * Mark files based upon the quickfix list (|netrw-qF|)
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002127 (|quickfix-error-lists|)
Bram Moolenaara6878372014-03-22 21:02:50 +01002128
2129The following netrw maps make use of marked files:
Bram Moolenaar446cb832008-06-24 21:56:24 +00002130
2131 |netrw-a| Hide marked files/directories
2132 |netrw-D| Delete marked files/directories
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002133 |netrw-ma| Move marked files' names to |arglist|
2134 |netrw-mA| Move |arglist| filenames to marked file list
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002135 |netrw-mb| Append marked files to bookmarks
2136 |netrw-mB| Delete marked files from bookmarks
Bram Moolenaar446cb832008-06-24 21:56:24 +00002137 |netrw-mc| Copy marked files to target
2138 |netrw-md| Apply vimdiff to marked files
2139 |netrw-me| Edit marked files
Bram Moolenaarff034192013-04-24 18:51:19 +02002140 |netrw-mF| Unmark marked files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002141 |netrw-mg| Apply vimgrep to marked files
Bram Moolenaara6878372014-03-22 21:02:50 +01002142 |netrw-mm| Move marked files to target
Bram Moolenaar446cb832008-06-24 21:56:24 +00002143 |netrw-mp| Print marked files
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002144 |netrw-ms| Netrw will source marked files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002145 |netrw-mt| Set target for |netrw-mm| and |netrw-mc|
2146 |netrw-mT| Generate tags using marked files
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002147 |netrw-mv| Apply vim command to marked files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002148 |netrw-mx| Apply shell command to marked files
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002149 |netrw-mX| Apply shell command to marked files, en bloc
Bram Moolenaar446cb832008-06-24 21:56:24 +00002150 |netrw-mz| Compress/Decompress marked files
2151 |netrw-O| Obtain marked files
2152 |netrw-R| Rename marked files
2153
2154One may unmark files one at a time the same way one marks them; ie. place
2155the cursor atop a marked file and press "mf". This process also works
2156with <s-leftmouse> using gvim. One may unmark all files by pressing
2157"mu" (see |netrw-mu|).
2158
Bram Moolenaaradc21822011-04-01 18:03:16 +02002159Marked files are highlighted using the "netrwMarkFile" highlighting group,
2160which by default is linked to "Identifier" (see Identifier under
2161|group-name|). You may change the highlighting group by putting something
2162like >
2163
2164 highlight clear netrwMarkFile
2165 hi link netrwMarkFile ..whatever..
2166<
2167into $HOME/.vim/after/syntax/netrw.vim .
2168
Bram Moolenaar8d043172014-01-23 14:24:41 +01002169If the mouse is enabled and works with your vim, you may use <s-leftmouse> to
2170mark one or more files. You may mark multiple files by dragging the shifted
2171leftmouse. (see |netrw-mouse|)
2172
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002173 *markfilelist* *global_markfilelist* *local_markfilelist*
Bram Moolenaar446cb832008-06-24 21:56:24 +00002174All marked files are entered onto the global marked file list; there is only
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002175one such list. In addition, every netrw buffer also has its own buffer-local
2176marked file list; since netrw buffers are associated with specific
2177directories, this means that each directory has its own local marked file
2178list. The various commands which operate on marked files use one or the other
2179of the marked file lists.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002180
Bram Moolenaara6878372014-03-22 21:02:50 +01002181Known Problem: if one is using tree mode (|g:netrw_liststyle|) and several
2182directories have files with the same name, then marking such a file will
2183result in all such files being highlighted as if they were all marked. The
2184|markfilelist|, however, will only have the selected file in it. This problem
2185is unlikely to be fixed.
2186
Bram Moolenaar446cb832008-06-24 21:56:24 +00002187
Bram Moolenaarff034192013-04-24 18:51:19 +02002188UNMARKING FILES *netrw-mF* {{{2
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002189 (also see |netrw-mf|, |netrw-mu|)
Bram Moolenaarff034192013-04-24 18:51:19 +02002190
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002191The "mF" command will unmark all files in the current buffer. One may also use
2192mf (|netrw-mf|) on a specific, already marked, file to unmark just that file.
Bram Moolenaarff034192013-04-24 18:51:19 +02002193
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002194MARKING FILES BY LOCATION LIST *netrw-qL* {{{2
2195 (also see |netrw-mf|)
Bram Moolenaarff034192013-04-24 18:51:19 +02002196
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002197One may convert |location-list|s into a marked file list using "qL".
2198You may then proceed with commands such as me (|netrw-me|) to edit them.
2199
2200
2201MARKING FILES BY QUICKFIX LIST *netrw-qF* {{{2
Bram Moolenaarff034192013-04-24 18:51:19 +02002202 (also see |netrw-mf|)
2203
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002204One may convert |quickfix-error-lists| into a marked file list using "qF".
2205You may then proceed with commands such as me (|netrw-me|) to edit them.
2206Quickfix error lists are generated, for example, by calls to |:vimgrep|.
Bram Moolenaarff034192013-04-24 18:51:19 +02002207
2208
Bram Moolenaar446cb832008-06-24 21:56:24 +00002209MARKING FILES BY REGULAR EXPRESSION *netrw-mr* {{{2
2210 (also see |netrw-mf|)
2211
2212One may also mark files by pressing "mr"; netrw will then issue a prompt,
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002213"Enter regexp: ". You may then enter a shell-style regular expression such
2214as *.c$ (see |glob()|). For remote systems, glob() doesn't work -- so netrw
2215converts "*" into ".*" (see |regexp|) and marks files based on that. In the
2216future I may make it possible to use |regexp|s instead of glob()-style
2217expressions (yet-another-option).
Bram Moolenaar446cb832008-06-24 21:56:24 +00002218
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002219See |cmdline-window| for directions on more on how to edit the regular
2220expression.
2221
Bram Moolenaar446cb832008-06-24 21:56:24 +00002222
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002223MARKED FILES, ARBITRARY VIM COMMAND *netrw-mv* {{{2
2224 (See |netrw-mf| and |netrw-mr| for how to mark files)
2225 (uses the local marked-file list)
2226
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002227The "mv" map causes netrw to execute an arbitrary vim command on each file on
2228the local marked file list, individually:
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002229
2230 * 1split
2231 * sil! keepalt e file
2232 * run vim command
2233 * sil! keepalt wq!
2234
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002235A prompt, "Enter vim command: ", will be issued to elicit the vim command you
2236wish used. See |cmdline-window| for directions for more on how to edit the
2237command.
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002238
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002239
2240MARKED FILES, ARBITRARY SHELL COMMAND *netrw-mx* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002241 (See |netrw-mf| and |netrw-mr| for how to mark files)
2242 (uses the local marked-file list)
2243
2244Upon activation of the "mx" map, netrw will query the user for some (external)
2245command to be applied to all marked files. All "%"s in the command will be
2246substituted with the name of each marked file in turn. If no "%"s are in the
2247command, then the command will be followed by a space and a marked filename.
2248
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002249Example:
2250 (mark files)
2251 mx
2252 Enter command: cat
2253
2254 The result is a series of shell commands:
2255 cat 'file1'
2256 cat 'file2'
2257 ...
2258
2259
Bram Moolenaar938ae282023-02-20 20:44:55 +00002260MARKED FILES, ARBITRARY SHELL COMMAND, EN BLOC *netrw-mX* {{{2
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002261 (See |netrw-mf| and |netrw-mr| for how to mark files)
2262 (uses the global marked-file list)
2263
2264Upon activation of the 'mX' map, netrw will query the user for some (external)
2265command to be applied to all marked files on the global marked file list. The
2266"en bloc" means that one command will be executed on all the files at once: >
2267
2268 command files
2269
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002270This approach is useful, for example, to select files and make a tarball: >
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002271
2272 (mark files)
2273 mX
2274 Enter command: tar cf mynewtarball.tar
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002275<
2276The command that will be run with this example:
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002277
2278 tar cf mynewtarball.tar 'file1' 'file2' ...
2279
Bram Moolenaar446cb832008-06-24 21:56:24 +00002280
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002281MARKED FILES: ARGUMENT LIST *netrw-ma* *netrw-mA*
2282 (See |netrw-mf| and |netrw-mr| for how to mark files)
2283 (uses the global marked-file list)
2284
2285Using ma, one moves filenames from the marked file list to the argument list.
2286Using mA, one moves filenames from the argument list to the marked file list.
2287
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002288See Also: |netrw-cb| |netrw-cB| |netrw-qF| |argument-list| |:args|
2289
2290
2291MARKED FILES: BUFFER LIST *netrw-cb* *netrw-cB*
2292 (See |netrw-mf| and |netrw-mr| for how to mark files)
2293 (uses the global marked-file list)
2294
2295Using cb, one moves filenames from the marked file list to the buffer list.
2296Using cB, one copies filenames from the buffer list to the marked file list.
2297
2298See Also: |netrw-ma| |netrw-mA| |netrw-qF| |buffer-list| |:buffers|
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002299
2300
Bram Moolenaar446cb832008-06-24 21:56:24 +00002301MARKED FILES: COMPRESSION AND DECOMPRESSION *netrw-mz* {{{2
2302 (See |netrw-mf| and |netrw-mr| for how to mark files)
2303 (uses the local marked file list)
2304
2305If any marked files are compressed, then "mz" will decompress them.
2306If any marked files are decompressed, then "mz" will compress them
2307using the command specified by |g:netrw_compress|; by default,
2308that's "gzip".
2309
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002310For decompression, netrw uses a |Dictionary| of suffices and their
Bram Moolenaar446cb832008-06-24 21:56:24 +00002311associated decompressing utilities; see |g:netrw_decompress|.
2312
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002313Remember that one can mark multiple files by regular expression
2314(see |netrw-mr|); this is particularly useful to facilitate compressing and
2315decompressing a large number of files.
2316
Bram Moolenaar446cb832008-06-24 21:56:24 +00002317Associated setting variables: |g:netrw_compress| |g:netrw_decompress|
2318
2319MARKED FILES: COPYING *netrw-mc* {{{2
2320 (See |netrw-mf| and |netrw-mr| for how to mark files)
2321 (Uses the global marked file list)
2322
2323Select a target directory with mt (|netrw-mt|). Then change directory,
Bram Moolenaaradc21822011-04-01 18:03:16 +02002324select file(s) (see |netrw-mf|), and press "mc". The copy is done
2325from the current window (where one does the mf) to the target.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002326
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002327If one does not have a target directory set with |netrw-mt|, then netrw
2328will query you for a directory to copy to.
2329
2330One may also copy directories and their contents (local only) to a target
2331directory.
2332
2333Associated setting variables:
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002334 |g:netrw_localcopycmd| |g:netrw_localcopycmdopt|
2335 |g:netrw_localcopydircmd| |g:netrw_localcopydircmdopt|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002336 |g:netrw_ssh_cmd|
Bram Moolenaar446cb832008-06-24 21:56:24 +00002337
2338MARKED FILES: DIFF *netrw-md* {{{2
2339 (See |netrw-mf| and |netrw-mr| for how to mark files)
2340 (uses the global marked file list)
2341
2342Use |vimdiff| to visualize difference between selected files (two or
2343three may be selected for this). Uses the global marked file list.
2344
2345MARKED FILES: EDITING *netrw-me* {{{2
2346 (See |netrw-mf| and |netrw-mr| for how to mark files)
2347 (uses the global marked file list)
2348
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002349The "me" command will place the marked files on the |arglist| and commence
Bram Moolenaar446cb832008-06-24 21:56:24 +00002350editing them. One may return the to explorer window with |:Rexplore|.
Bram Moolenaarff034192013-04-24 18:51:19 +02002351(use |:n| and |:p| to edit next and previous files in the arglist)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002352
2353MARKED FILES: GREP *netrw-mg* {{{2
2354 (See |netrw-mf| and |netrw-mr| for how to mark files)
2355 (uses the global marked file list)
2356
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002357The "mg" command will apply |:vimgrep| to the marked files.
Bram Moolenaarff034192013-04-24 18:51:19 +02002358The command will ask for the requested pattern; one may then enter: >
2359
Bram Moolenaar446cb832008-06-24 21:56:24 +00002360 /pattern/[g][j]
2361 ! /pattern/[g][j]
2362 pattern
2363<
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002364With /pattern/, editing will start with the first item on the |quickfix| list
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002365that vimgrep sets up (see |:copen|, |:cnext|, |:cprevious|, |:cclose|). The |:vimgrep|
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002366command is in use, so without 'g' each line is added to quickfix list only
2367once; with 'g' every match is included.
2368
2369With /pattern/j, "mg" will winnow the current marked file list to just those
2370marked files also possessing the specified pattern. Thus, one may use >
2371
2372 mr ...file-pattern...
2373 mg /pattern/j
2374<
2375to have a marked file list satisfying the file-pattern but also restricted to
2376files containing some desired pattern.
2377
Bram Moolenaarff034192013-04-24 18:51:19 +02002378
Bram Moolenaar446cb832008-06-24 21:56:24 +00002379MARKED FILES: HIDING AND UNHIDING BY SUFFIX *netrw-mh* {{{2
2380 (See |netrw-mf| and |netrw-mr| for how to mark files)
2381 (uses the local marked file list)
2382
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002383The "mh" command extracts the suffices of the marked files and toggles their
Bram Moolenaar446cb832008-06-24 21:56:24 +00002384presence on the hiding list. Please note that marking the same suffix
2385this way multiple times will result in the suffix's presence being toggled
2386for each file (so an even quantity of marked files having the same suffix
2387is the same as not having bothered to select them at all).
2388
2389Related topics: |netrw-a| |g:netrw_list_hide|
2390
2391MARKED FILES: MOVING *netrw-mm* {{{2
2392 (See |netrw-mf| and |netrw-mr| for how to mark files)
2393 (uses the global marked file list)
2394
Bram Moolenaare37d50a2008-08-06 17:06:04 +00002395 WARNING: moving files is more dangerous than copying them.
2396 A file being moved is first copied and then deleted; if the
2397 copy operation fails and the delete succeeds, you will lose
2398 the file. Either try things out with unimportant files
2399 first or do the copy and then delete yourself using mc and D.
2400 Use at your own risk!
2401
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002402Select a target directory with mt (|netrw-mt|). Then change directory,
Bram Moolenaaradc21822011-04-01 18:03:16 +02002403select file(s) (see |netrw-mf|), and press "mm". The move is done
2404from the current window (where one does the mf) to the target.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002405
2406Associated setting variable: |g:netrw_localmovecmd| |g:netrw_ssh_cmd|
2407
2408MARKED FILES: PRINTING *netrw-mp* {{{2
2409 (See |netrw-mf| and |netrw-mr| for how to mark files)
2410 (uses the local marked file list)
2411
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002412When "mp" is used, netrw will apply the |:hardcopy| command to marked files.
2413What netrw does is open each file in a one-line window, execute hardcopy, then
2414close the one-line window.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002415
2416
2417MARKED FILES: SOURCING *netrw-ms* {{{2
2418 (See |netrw-mf| and |netrw-mr| for how to mark files)
2419 (uses the local marked file list)
2420
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002421With "ms", netrw will source the marked files (using vim's |:source| command)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002422
2423
Bram Moolenaarff034192013-04-24 18:51:19 +02002424MARKED FILES: SETTING THE TARGET DIRECTORY *netrw-mt* {{{2
2425 (See |netrw-mf| and |netrw-mr| for how to mark files)
2426
2427Set the marked file copy/move-to target (see |netrw-mc| and |netrw-mm|):
2428
2429 * If the cursor is atop a file name, then the netrw window's currently
2430 displayed directory is used for the copy/move-to target.
2431
2432 * Also, if the cursor is in the banner, then the netrw window's currently
2433 displayed directory is used for the copy/move-to target.
2434 Unless the target already is the current directory. In which case,
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002435 typing "mf" clears the target.
Bram Moolenaarff034192013-04-24 18:51:19 +02002436
2437 * However, if the cursor is atop a directory name, then that directory is
2438 used for the copy/move-to target
2439
Bram Moolenaara6878372014-03-22 21:02:50 +01002440 * One may use the :MT [directory] command to set the target *netrw-:MT*
2441 This command uses |<q-args>|, so spaces in the directory name are
2442 permitted without escaping.
2443
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002444 * With mouse-enabled vim or with gvim, one may select a target by using
2445 <c-leftmouse>
2446
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002447There is only one copy/move-to target at a time in a vim session; ie. the
2448target is a script variable (see |s:var|) and is shared between all netrw
2449windows (in an instance of vim).
Bram Moolenaarff034192013-04-24 18:51:19 +02002450
2451When using menus and gvim, netrw provides a "Targets" entry which allows one
2452to pick a target from the list of bookmarks and history.
2453
2454Related topics:
2455 Marking Files......................................|netrw-mf|
2456 Marking Files by Regular Expression................|netrw-mr|
2457 Marked Files: Target Directory Using Bookmarks.....|netrw-Tb|
2458 Marked Files: Target Directory Using History.......|netrw-Th|
2459
2460
Bram Moolenaar446cb832008-06-24 21:56:24 +00002461MARKED FILES: TAGGING *netrw-mT* {{{2
2462 (See |netrw-mf| and |netrw-mr| for how to mark files)
2463 (uses the global marked file list)
2464
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002465The "mT" mapping will apply the command in |g:netrw_ctags| (by default, it is
Bram Moolenaar446cb832008-06-24 21:56:24 +00002466"ctags") to marked files. For remote browsing, in order to create a tags file
2467netrw will use ssh (see |g:netrw_ssh_cmd|), and so ssh must be available for
2468this to work on remote systems. For your local system, see |ctags| on how to
2469get a version. I myself use hdrtags, currently available at
Bram Moolenaar97d62492012-11-15 21:28:22 +01002470http://www.drchip.org/astronaut/src/index.html , and have >
Bram Moolenaar446cb832008-06-24 21:56:24 +00002471
2472 let g:netrw_ctags= "hdrtag"
2473<
2474in my <.vimrc>.
2475
2476When a remote set of files are tagged, the resulting tags file is "obtained";
Bram Moolenaara6878372014-03-22 21:02:50 +01002477ie. a copy is transferred to the local system's directory. The now local tags
Bram Moolenaar446cb832008-06-24 21:56:24 +00002478file is then modified so that one may use it through the network. The
Bram Moolenaara6878372014-03-22 21:02:50 +01002479modification made concerns the names of the files in the tags; each filename is
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002480preceded by the netrw-compatible URL used to obtain it. When one subsequently
2481uses one of the go to tag actions (|tags|), the URL will be used by netrw to
Bram Moolenaar446cb832008-06-24 21:56:24 +00002482edit the desired file and go to the tag.
2483
Bram Moolenaarc236c162008-07-13 17:41:49 +00002484Associated setting variables: |g:netrw_ctags| |g:netrw_ssh_cmd|
Bram Moolenaar446cb832008-06-24 21:56:24 +00002485
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002486MARKED FILES: TARGET DIRECTORY USING BOOKMARKS *netrw-Tb* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002487
Bram Moolenaara6878372014-03-22 21:02:50 +01002488Sets the marked file copy/move-to target.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002489
Bram Moolenaarff034192013-04-24 18:51:19 +02002490The |netrw-qb| map will give you a list of bookmarks (and history).
2491One may choose one of the bookmarks to become your marked file
2492target by using [count]Tb (default count: 1).
Bram Moolenaar446cb832008-06-24 21:56:24 +00002493
Bram Moolenaarff034192013-04-24 18:51:19 +02002494Related topics:
Bram Moolenaara6878372014-03-22 21:02:50 +01002495 Copying files to target............................|netrw-mc|
Bram Moolenaarff034192013-04-24 18:51:19 +02002496 Listing Bookmarks and History......................|netrw-qb|
2497 Marked Files: Setting The Target Directory.........|netrw-mt|
2498 Marked Files: Target Directory Using History.......|netrw-Th|
2499 Marking Files......................................|netrw-mf|
2500 Marking Files by Regular Expression................|netrw-mr|
Bram Moolenaara6878372014-03-22 21:02:50 +01002501 Moving files to target.............................|netrw-mm|
Bram Moolenaar446cb832008-06-24 21:56:24 +00002502
Bram Moolenaar446cb832008-06-24 21:56:24 +00002503
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002504MARKED FILES: TARGET DIRECTORY USING HISTORY *netrw-Th* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002505
Bram Moolenaara6878372014-03-22 21:02:50 +01002506Sets the marked file copy/move-to target.
Bram Moolenaarff034192013-04-24 18:51:19 +02002507
2508The |netrw-qb| map will give you a list of history (and bookmarks).
2509One may choose one of the history entries to become your marked file
2510target by using [count]Th (default count: 0; ie. the current directory).
2511
2512Related topics:
Bram Moolenaara6878372014-03-22 21:02:50 +01002513 Copying files to target............................|netrw-mc|
Bram Moolenaarff034192013-04-24 18:51:19 +02002514 Listing Bookmarks and History......................|netrw-qb|
2515 Marked Files: Setting The Target Directory.........|netrw-mt|
2516 Marked Files: Target Directory Using Bookmarks.....|netrw-Tb|
2517 Marking Files......................................|netrw-mf|
2518 Marking Files by Regular Expression................|netrw-mr|
Bram Moolenaara6878372014-03-22 21:02:50 +01002519 Moving files to target.............................|netrw-mm|
Bram Moolenaarff034192013-04-24 18:51:19 +02002520
Bram Moolenaar446cb832008-06-24 21:56:24 +00002521
2522MARKED FILES: UNMARKING *netrw-mu* {{{2
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002523 (See |netrw-mf|, |netrw-mF|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002524
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002525The "mu" mapping will unmark all currently marked files. This command differs
2526from "mF" as the latter only unmarks files in the current directory whereas
2527"mu" will unmark global and all buffer-local marked files.
2528(see |netrw-mF|)
2529
Bram Moolenaar446cb832008-06-24 21:56:24 +00002530
Bram Moolenaar15146672011-10-20 22:22:38 +02002531 *netrw-browser-settings*
Bram Moolenaar446cb832008-06-24 21:56:24 +00002532NETRW BROWSER VARIABLES *netrw-browser-options* *netrw-browser-var* {{{2
2533
Bram Moolenaar15146672011-10-20 22:22:38 +02002534(if you're interested in the netrw file transfer settings, see |netrw-options|
2535 and |netrw-protocol|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002536
2537The <netrw.vim> browser provides settings in the form of variables which
2538you may modify; by placing these settings in your <.vimrc>, you may customize
2539your browsing preferences. (see also: |netrw-settings|)
2540>
2541 --- -----------
2542 Var Explanation
2543 --- -----------
Bram Moolenaar8d043172014-01-23 14:24:41 +01002544< *g:netrw_altfile* some like |CTRL-^| to return to the last
2545 edited file. Choose that by setting this
2546 parameter to 1.
2547 Others like |CTRL-^| to return to the
2548 netrw browsing buffer. Choose that by setting
2549 this parameter to 0.
2550 default: =0
2551
2552 *g:netrw_alto* change from above splitting to below splitting
Bram Moolenaar446cb832008-06-24 21:56:24 +00002553 by setting this variable (see |netrw-o|)
2554 default: =&sb (see |'sb'|)
2555
Bram Moolenaarff034192013-04-24 18:51:19 +02002556 *g:netrw_altv* change from left splitting to right splitting
Bram Moolenaar446cb832008-06-24 21:56:24 +00002557 by setting this variable (see |netrw-v|)
2558 default: =&spr (see |'spr'|)
2559
Bram Moolenaarff034192013-04-24 18:51:19 +02002560 *g:netrw_banner* enable/suppress the banner
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002561 =0: suppress the banner
2562 =1: banner is enabled (default)
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002563
Bram Moolenaare6ae6222013-05-21 21:01:10 +02002564 *g:netrw_bannerbackslash* if this variable exists and is not zero, the
2565 banner will be displayed with backslashes
2566 rather than forward slashes.
2567
Bram Moolenaarff034192013-04-24 18:51:19 +02002568 *g:netrw_browse_split* when browsing, <cr> will open the file by:
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002569 =0: re-using the same window (default)
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002570 =1: horizontally splitting the window first
2571 =2: vertically splitting the window first
Bram Moolenaar446cb832008-06-24 21:56:24 +00002572 =3: open file in new tab
2573 =4: act like "P" (ie. open previous window)
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002574 Note that |g:netrw_preview| may be used
2575 to get vertical splitting instead of
2576 horizontal splitting.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002577 =[servername,tab-number,window-number]
2578 Given a |List| such as this, a remote server
2579 named by the "servername" will be used for
2580 editing. It will also use the specified tab
2581 and window numbers to perform editing
2582 (see |clientserver|, |netrw-ctrl-r|)
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002583 This option does not affect the production of
2584 |:Lexplore| windows.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002585
Bram Moolenaar8d043172014-01-23 14:24:41 +01002586 Related topics:
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002587 |g:netrw_alto| |g:netrw_altv|
2588 |netrw-C| |netrw-cr|
2589 |netrw-ctrl-r|
Bram Moolenaar8d043172014-01-23 14:24:41 +01002590
Bram Moolenaarff034192013-04-24 18:51:19 +02002591 *g:netrw_browsex_viewer* specify user's preference for a viewer: >
Bram Moolenaar446cb832008-06-24 21:56:24 +00002592 "kfmclient exec"
2593 "gnome-open"
Luca Saccarolaa7d45612024-10-21 21:27:03 +02002594<
Bram Moolenaar89a9c152021-08-29 21:55:35 +02002595 *g:netrw_browsex_support_remote*
2596 specify if the specified viewer supports a
2597 remote URL. (see |netrw-handler|).
2598
Bram Moolenaarff034192013-04-24 18:51:19 +02002599 *g:netrw_chgperm* Unix/Linux: "chmod PERM FILENAME"
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002600 Windows: "cacls FILENAME /e /p PERM"
2601 Used to change access permission for a file.
2602
Bram Moolenaar89a9c152021-08-29 21:55:35 +02002603 *g:netrw_clipboard* =1
Bram Moolenaar938ae282023-02-20 20:44:55 +00002604 By default, netrw will attempt to insure that
Bram Moolenaar89a9c152021-08-29 21:55:35 +02002605 the clipboard's values will remain unchanged.
2606 However, some users report that they have
2607 speed problems with this; consequently, this
2608 option, when set to zero, lets such users
2609 prevent netrw from saving and restoring the
2610 clipboard (the latter is done only as needed).
2611 That means that if the clipboard is changed
2612 (inadvertently) by normal netrw operation that
2613 it will not be restored to its prior state.
2614
Bram Moolenaarff034192013-04-24 18:51:19 +02002615 *g:netrw_compress* ="gzip"
Bram Moolenaar89a9c152021-08-29 21:55:35 +02002616 Will compress marked files with this
2617 command
Bram Moolenaar446cb832008-06-24 21:56:24 +00002618
Bram Moolenaarff034192013-04-24 18:51:19 +02002619 *g:Netrw_corehandler* Allows one to specify something additional
Bram Moolenaar15146672011-10-20 22:22:38 +02002620 to do when handling <core> files via netrw's
2621 browser's "x" command (see |netrw-x|). If
2622 present, g:Netrw_corehandler specifies
2623 either one or more function references
2624 (see |Funcref|). (the capital g:Netrw...
2625 is required its holding a function reference)
2626
2627
Bram Moolenaarff034192013-04-24 18:51:19 +02002628 *g:netrw_ctags* ="ctags"
2629 The default external program used to create
2630 tags
Bram Moolenaarc236c162008-07-13 17:41:49 +00002631
Bram Moolenaarff034192013-04-24 18:51:19 +02002632 *g:netrw_cursor* = 2 (default)
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002633 This option controls the use of the
Bram Moolenaaradc21822011-04-01 18:03:16 +02002634 |'cursorline'| (cul) and |'cursorcolumn'|
2635 (cuc) settings by netrw:
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002636
Bram Moolenaaradc21822011-04-01 18:03:16 +02002637 Value Thin-Long-Tree Wide
2638 =0 u-cul u-cuc u-cul u-cuc
2639 =1 u-cul u-cuc cul u-cuc
2640 =2 cul u-cuc cul u-cuc
2641 =3 cul u-cuc cul cuc
2642 =4 cul cuc cul cuc
Bram Moolenaar89a9c152021-08-29 21:55:35 +02002643 =5 U-cul U-cuc U-cul U-cuc
2644 =6 U-cul U-cuc cul U-cuc
2645 =7 cul U-cuc cul U-cuc
2646 =8 cul U-cuc cul cuc
Bram Moolenaaradc21822011-04-01 18:03:16 +02002647
2648 Where
Bram Moolenaar89a9c152021-08-29 21:55:35 +02002649 u-cul : user's |'cursorline'| initial setting used
2650 u-cuc : user's |'cursorcolumn'| initial setting used
2651 U-cul : user's |'cursorline'| current setting used
2652 U-cuc : user's |'cursorcolumn'| current setting used
2653 cul : |'cursorline'| will be locally set
2654 cuc : |'cursorcolumn'| will be locally set
2655
2656 The "initial setting" means the values of
2657 the |'cuc'| and |'cul'| settings in effect when
2658 netrw last saw |g:netrw_cursor| >= 5 or when
2659 netrw was initially run.
Bram Moolenaaradc21822011-04-01 18:03:16 +02002660
Christian Brabandtcacfccf2024-11-23 13:28:01 +01002661 *g:netrw_decompress* = { '.lz4': 'lz4 -d',
2662 '.lzo': 'lzop -d',
2663 '.lz': 'lzip -dk',
2664 '.7z': '7za x',
2665 '.001': '7za x',
2666 '.tar.bz': 'tar -xvjf',
2667 '.tar.bz2': 'tar -xvjf',
2668 '.tbz': 'tar -xvjf',
2669 '.tbz2': 'tar -xvjf',
2670 '.tar.gz': 'tar -xvzf',
2671 '.tgz': 'tar -xvzf',
2672 '.tar.zst': 'tar --use-compress-program=unzstd -xvf',
2673 '.tzst': 'tar --use-compress-program=unzstd -xvf',
2674 '.tar': 'tar -xvf',
2675 '.zip': 'unzip',
2676 '.bz': 'bunzip2 -k',
2677 '.bz2': 'bunzip2 -k',
2678 '.gz': 'gunzip -k',
2679 '.lzma': 'unlzma -T0 -k',
2680 '.xz': 'unxz -T0 -k',
2681 '.zst': 'zstd -T0 -d',
2682 '.Z': 'uncompress -k',
2683 '.rar': 'unrar x -ad',
2684 '.tar.lzma': 'tar --lzma -xvf',
2685 '.tlz': 'tar --lzma -xvf',
2686 '.tar.xz': 'tar -xvJf',
2687 '.txz': 'tar -xvJf'}
2688
Bram Moolenaar446cb832008-06-24 21:56:24 +00002689 A dictionary mapping suffices to
2690 decompression programs.
2691
Bram Moolenaaradc21822011-04-01 18:03:16 +02002692 *g:netrw_dirhistmax* =10: controls maximum quantity of past
Bram Moolenaar89a9c152021-08-29 21:55:35 +02002693 history. May be zero to suppress
Bram Moolenaaradc21822011-04-01 18:03:16 +02002694 history.
2695 (related: |netrw-qb| |netrw-u| |netrw-U|)
2696
Bram Moolenaar97d62492012-11-15 21:28:22 +01002697 *g:netrw_dynamic_maxfilenamelen* =32: enables dynamic determination of
2698 |g:netrw_maxfilenamelen|, which affects
2699 local file long listing.
Bram Moolenaara6878372014-03-22 21:02:50 +01002700
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002701 *g:netrw_errorlvl* =0: error levels greater than or equal to
2702 this are permitted to be displayed
2703 0: notes
2704 1: warnings
2705 2: errors
2706
Bram Moolenaarff034192013-04-24 18:51:19 +02002707 *g:netrw_fastbrowse* =0: slow speed directory browsing;
Bram Moolenaar13600302014-05-22 18:26:40 +02002708 never re-uses directory listings;
Bram Moolenaar446cb832008-06-24 21:56:24 +00002709 always obtains directory listings.
2710 =1: medium speed directory browsing;
2711 re-use directory listings only
2712 when remote directory browsing.
2713 (default value)
2714 =2: fast directory browsing;
2715 only obtains directory listings when the
2716 directory hasn't been seen before
2717 (or |netrw-ctrl-l| is used).
2718
2719 Fast browsing retains old directory listing
2720 buffers so that they don't need to be
2721 re-acquired. This feature is especially
2722 important for remote browsing. However, if
2723 a file is introduced or deleted into or from
2724 such directories, the old directory buffer
2725 becomes out-of-date. One may always refresh
2726 such a directory listing with |netrw-ctrl-l|.
2727 This option gives the user the choice of
2728 trading off accuracy (ie. up-to-date listing)
2729 versus speed.
2730
Bram Moolenaar13600302014-05-22 18:26:40 +02002731 *g:netrw_ffkeep* (default: doesn't exist)
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002732 If this variable exists and is zero, then
Bram Moolenaar13600302014-05-22 18:26:40 +02002733 netrw will not do a save and restore for
2734 |'fileformat'|.
2735
Bram Moolenaarff034192013-04-24 18:51:19 +02002736 *g:netrw_fname_escape* =' ?&;%'
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002737 Used on filenames before remote reading/writing
Bram Moolenaar446cb832008-06-24 21:56:24 +00002738
Bram Moolenaarff034192013-04-24 18:51:19 +02002739 *g:netrw_ftp_browse_reject* ftp can produce a number of errors and warnings
Bram Moolenaar446cb832008-06-24 21:56:24 +00002740 that can show up as "directories" and "files"
2741 in the listing. This pattern is used to
2742 remove such embedded messages. By default its
2743 value is:
2744 '^total\s\+\d\+$\|
2745 ^Trying\s\+\d\+.*$\|
2746 ^KERBEROS_V\d rejected\|
2747 ^Security extensions not\|
2748 No such file\|
2749 : connect to address [0-9a-fA-F:]*
2750 : No route to host$'
2751
Bram Moolenaarff034192013-04-24 18:51:19 +02002752 *g:netrw_ftp_list_cmd* options for passing along to ftp for directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002753 listing. Defaults:
2754 unix or g:netrw_cygwin set: : "ls -lF"
2755 otherwise "dir"
2756
2757
Bram Moolenaarff034192013-04-24 18:51:19 +02002758 *g:netrw_ftp_sizelist_cmd* options for passing along to ftp for directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002759 listing, sorted by size of file.
2760 Defaults:
2761 unix or g:netrw_cygwin set: : "ls -slF"
2762 otherwise "dir"
2763
Bram Moolenaarff034192013-04-24 18:51:19 +02002764 *g:netrw_ftp_timelist_cmd* options for passing along to ftp for directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002765 listing, sorted by time of last modification.
2766 Defaults:
2767 unix or g:netrw_cygwin set: : "ls -tlF"
2768 otherwise "dir"
2769
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002770 *g:netrw_glob_escape* ='[]*?`{~$' (unix)
Bram Moolenaar00a927d2010-05-14 23:24:24 +02002771 ='[]*?`{$' (windows
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002772 These characters in directory names are
Bram Moolenaar446cb832008-06-24 21:56:24 +00002773 escaped before applying glob()
2774
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002775 *g:netrw_gx* ="<cfile>"
Bram Moolenaar938ae282023-02-20 20:44:55 +00002776 This option controls how gx (|netrw-gx|) picks
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002777 up the text under the cursor. See |expand()|
2778 for possibilities.
2779
Bram Moolenaarff034192013-04-24 18:51:19 +02002780 *g:netrw_hide* Controlled by the "a" map (see |netrw-a|)
2781 =0 : show all
2782 =1 : show not-hidden files
2783 =2 : show hidden files only
Bram Moolenaar85850f32019-07-19 22:05:51 +02002784 default: =1
Bram Moolenaar446cb832008-06-24 21:56:24 +00002785
Bram Moolenaarff034192013-04-24 18:51:19 +02002786 *g:netrw_home* The home directory for where bookmarks and
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002787 history are saved (as .netrwbook and
2788 .netrwhist).
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002789 Netrw uses |expand()|on the string.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002790 default: the first directory on the
2791 |'runtimepath'|
2792
Bram Moolenaarff034192013-04-24 18:51:19 +02002793 *g:netrw_keepdir* =1 (default) keep current directory immune from
Bram Moolenaar446cb832008-06-24 21:56:24 +00002794 the browsing directory.
2795 =0 keep the current directory the same as the
2796 browsing directory.
2797 The current browsing directory is contained in
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02002798 b:netrw_curdir (also see |netrw-cd|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002799
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002800 *g:netrw_keepj* ="keepj" (default) netrw attempts to keep the
2801 |:jumps| table unaffected.
2802 ="" netrw will not use |:keepjumps| with
2803 exceptions only for the
2804 saving/restoration of position.
2805
Bram Moolenaarff034192013-04-24 18:51:19 +02002806 *g:netrw_list_cmd* command for listing remote directories
Bram Moolenaar446cb832008-06-24 21:56:24 +00002807 default: (if ssh is executable)
2808 "ssh HOSTNAME ls -FLa"
2809
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002810 *g:netrw_list_cmd_options* If this variable exists, then its contents are
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002811 appended to the g:netrw_list_cmd. For
2812 example, use "2>/dev/null" to get rid of banner
2813 messages on unix systems.
2814
2815
Bram Moolenaarff034192013-04-24 18:51:19 +02002816 *g:netrw_liststyle* Set the default listing style:
Bram Moolenaar446cb832008-06-24 21:56:24 +00002817 = 0: thin listing (one file per line)
2818 = 1: long listing (one file per line with time
2819 stamp information and file size)
2820 = 2: wide listing (multiple files in columns)
2821 = 3: tree style listing
Bram Moolenaar8d043172014-01-23 14:24:41 +01002822
Bram Moolenaarb7398fe2023-05-14 18:50:25 +01002823 *g:netrw_list_hide* comma-separated pattern list for hiding files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002824 Patterns are regular expressions (see |regexp|)
Bram Moolenaar8d043172014-01-23 14:24:41 +01002825 There's some special support for git-ignore
2826 files: you may add the output from the helper
2827 function 'netrw_gitignore#Hide() automatically
2828 hiding all gitignored files.
2829 For more details see |netrw-gitignore|.
2830
2831 Examples:
2832 let g:netrw_list_hide= '.*\.swp$'
Bram Moolenaarb7398fe2023-05-14 18:50:25 +01002833 let g:netrw_list_hide= netrw_gitignore#Hide() .. '.*\.swp$'
Bram Moolenaar8d043172014-01-23 14:24:41 +01002834 default: ""
Bram Moolenaar446cb832008-06-24 21:56:24 +00002835
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002836 *g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin
2837 =expand("$COMSPEC") Windows
Bram Moolenaar446cb832008-06-24 21:56:24 +00002838 Copies marked files (|netrw-mf|) to target
2839 directory (|netrw-mt|, |netrw-mc|)
2840
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002841 *g:netrw_localcopycmdopt* ='' Linux/Unix/MacOS/Cygwin
Bram Moolenaar938ae282023-02-20 20:44:55 +00002842 =' \c copy' Windows
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002843 Options for the |g:netrw_localcopycmd|
2844
2845 *g:netrw_localcopydircmd* ="cp" Linux/Unix/MacOS/Cygwin
Bram Moolenaar938ae282023-02-20 20:44:55 +00002846 =expand("$COMSPEC") Windows
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002847 Copies directories to target directory.
2848 (|netrw-mc|, |netrw-mt|)
2849
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002850 *g:netrw_localcopydircmdopt* =" -R" Linux/Unix/MacOS/Cygwin
2851 =" /c xcopy /e /c /h/ /i /k" Windows
2852 Options for |g:netrw_localcopydircmd|
Bram Moolenaare6ae6222013-05-21 21:01:10 +02002853
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002854 *g:netrw_localmkdir* ="mkdir" Linux/Unix/MacOS/Cygwin
2855 =expand("$COMSPEC") Windows
2856 command for making a local directory
2857
2858 *g:netrw_localmkdiropt* ="" Linux/Unix/MacOS/Cygwin
2859 =" /c mkdir" Windows
2860 Options for |g:netrw_localmkdir|
2861
2862 *g:netrw_localmovecmd* ="mv" Linux/Unix/MacOS/Cygwin
2863 =expand("$COMSPEC") Windows
Bram Moolenaar446cb832008-06-24 21:56:24 +00002864 Moves marked files (|netrw-mf|) to target
2865 directory (|netrw-mt|, |netrw-mm|)
2866
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002867 *g:netrw_localmovecmdopt* ="" Linux/Unix/MacOS/Cygwin
2868 =" /c move" Windows
2869 Options for |g:netrw_localmovecmd|
2870
Bram Moolenaarff034192013-04-24 18:51:19 +02002871 *g:netrw_maxfilenamelen* =32 by default, selected so as to make long
Bram Moolenaar446cb832008-06-24 21:56:24 +00002872 listings fit on 80 column displays.
2873 If your screen is wider, and you have file
2874 or directory names longer than 32 bytes,
2875 you may set this option to keep listings
2876 columnar.
2877
Bram Moolenaarff034192013-04-24 18:51:19 +02002878 *g:netrw_mkdir_cmd* command for making a remote directory
Bram Moolenaar15146672011-10-20 22:22:38 +02002879 via ssh (also see |g:netrw_remote_mkdir|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002880 default: "ssh USEPORT HOSTNAME mkdir"
2881
Bram Moolenaar251e1912011-06-19 05:09:16 +02002882 *g:netrw_mousemaps* =1 (default) enables mouse buttons while
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002883 browsing to:
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002884 leftmouse : open file/directory
2885 shift-leftmouse : mark file
2886 middlemouse : same as P
2887 rightmouse : remove file/directory
2888 =0: disables mouse maps
2889
Bram Moolenaar15146672011-10-20 22:22:38 +02002890 *g:netrw_nobeval* doesn't exist (default)
2891 If this variable exists, then balloon
2892 evaluation will be suppressed
2893 (see |'ballooneval'|)
2894
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002895 *g:netrw_sizestyle* not defined: actual bytes (default)
Bram Moolenaar938ae282023-02-20 20:44:55 +00002896 ="b" : actual bytes (default)
2897 ="h" : human-readable (ex. 5k, 4m, 3g)
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002898 uses 1000 base
Bram Moolenaar938ae282023-02-20 20:44:55 +00002899 ="H" : human-readable (ex. 5K, 4M, 3G)
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002900 uses 1024 base
2901 The long listing (|netrw-i|) and query-file
2902 maps (|netrw-qf|) will display file size
2903 using the specified style.
2904
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002905 *g:netrw_usetab* if this variable exists and is non-zero, then
2906 the <tab> map supporting shrinking/expanding a
2907 Lexplore or netrw window will be enabled.
2908 (see |netrw-c-tab|)
2909
Bram Moolenaara6878372014-03-22 21:02:50 +01002910 *g:netrw_remote_mkdir* command for making a remote directory
Bram Moolenaar15146672011-10-20 22:22:38 +02002911 via ftp (also see |g:netrw_mkdir_cmd|)
2912 default: "mkdir"
2913
Bram Moolenaarff034192013-04-24 18:51:19 +02002914 *g:netrw_retmap* if it exists and is set to one, then:
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002915 * if in a netrw-selected file, AND
2916 * no normal-mode <2-leftmouse> mapping exists,
2917 then the <2-leftmouse> will be mapped for easy
Bram Moolenaar446cb832008-06-24 21:56:24 +00002918 return to the netrw browser window.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002919 example: click once to select and open a file,
2920 double-click to return.
2921
2922 Note that one may instead choose to:
2923 * let g:netrw_retmap= 1, AND
2924 * nmap <silent> YourChoice <Plug>NetrwReturn
2925 and have another mapping instead of
2926 <2-leftmouse> to invoke the return.
2927
2928 You may also use the |:Rexplore| command to do
2929 the same thing.
2930
Bram Moolenaar446cb832008-06-24 21:56:24 +00002931 default: =0
2932
Bram Moolenaar13600302014-05-22 18:26:40 +02002933 *g:netrw_rm_cmd* command for removing remote files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002934 default: "ssh USEPORT HOSTNAME rm"
2935
Bram Moolenaar13600302014-05-22 18:26:40 +02002936 *g:netrw_rmdir_cmd* command for removing remote directories
Bram Moolenaar446cb832008-06-24 21:56:24 +00002937 default: "ssh USEPORT HOSTNAME rmdir"
2938
Bram Moolenaar13600302014-05-22 18:26:40 +02002939 *g:netrw_rmf_cmd* command for removing remote softlinks
Bram Moolenaar446cb832008-06-24 21:56:24 +00002940 default: "ssh USEPORT HOSTNAME rm -f"
2941
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002942 *g:netrw_servername* use this variable to provide a name for
2943 |netrw-ctrl-r| to use for its server.
2944 default: "NETRWSERVER"
2945
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002946 *g:netrw_sort_by* sort by "name", "time", "size", or
Bram Moolenaar938ae282023-02-20 20:44:55 +00002947 "exten".
Bram Moolenaar446cb832008-06-24 21:56:24 +00002948 default: "name"
2949
Bram Moolenaarff034192013-04-24 18:51:19 +02002950 *g:netrw_sort_direction* sorting direction: "normal" or "reverse"
Bram Moolenaar446cb832008-06-24 21:56:24 +00002951 default: "normal"
2952
Bram Moolenaarff034192013-04-24 18:51:19 +02002953 *g:netrw_sort_options* sorting is done using |:sort|; this
Bram Moolenaarc236c162008-07-13 17:41:49 +00002954 variable's value is appended to the
2955 sort command. Thus one may ignore case,
2956 for example, with the following in your
2957 .vimrc: >
2958 let g:netrw_sort_options="i"
2959< default: ""
2960
Bram Moolenaarff034192013-04-24 18:51:19 +02002961 *g:netrw_sort_sequence* when sorting by name, first sort by the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002962 comma-separated pattern sequence. Note that
Bram Moolenaara6878372014-03-22 21:02:50 +01002963 any filigree added to indicate filetypes
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002964 should be accounted for in your pattern.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002965 default: '[\/]$,*,\.bak$,\.o$,\.h$,
2966 \.info$,\.swp$,\.obj$'
2967
Bram Moolenaarff034192013-04-24 18:51:19 +02002968 *g:netrw_special_syntax* If true, then certain files will be shown
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002969 using special syntax in the browser:
Bram Moolenaar446cb832008-06-24 21:56:24 +00002970
2971 netrwBak : *.bak
2972 netrwCompress: *.gz *.bz2 *.Z *.zip
Bram Moolenaar85850f32019-07-19 22:05:51 +02002973 netrwCoreDump: core.\d\+
Bram Moolenaar446cb832008-06-24 21:56:24 +00002974 netrwData : *.dat
Bram Moolenaar85850f32019-07-19 22:05:51 +02002975 netrwDoc : *.doc,*.txt,*.pdf,
2976 *.pdf,*.docx
Bram Moolenaar446cb832008-06-24 21:56:24 +00002977 netrwHdr : *.h
Bram Moolenaar85850f32019-07-19 22:05:51 +02002978 netrwLex : *.l *.lex
Bram Moolenaar446cb832008-06-24 21:56:24 +00002979 netrwLib : *.a *.so *.lib *.dll
2980 netrwMakefile: [mM]akefile *.mak
2981 netrwObj : *.o *.obj
Bram Moolenaar85850f32019-07-19 22:05:51 +02002982 netrwPix : *.bmp,*.fit,*.fits,*.gif,
2983 *.jpg,*.jpeg,*.pcx,*.ppc
2984 *.pgm,*.png,*.psd,*.rgb
2985 *.tif,*.xbm,*.xcf
Bram Moolenaar446cb832008-06-24 21:56:24 +00002986 netrwTags : tags ANmenu ANtags
Bram Moolenaara6878372014-03-22 21:02:50 +01002987 netrwTilde : *
Bram Moolenaar446cb832008-06-24 21:56:24 +00002988 netrwTmp : tmp* *tmp
Bram Moolenaar85850f32019-07-19 22:05:51 +02002989 netrwYacc : *.y
Bram Moolenaar446cb832008-06-24 21:56:24 +00002990
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002991 In addition, those groups mentioned in
2992 |'suffixes'| are also added to the special
2993 file highlighting group.
2994 These syntax highlighting groups are linked
2995 to netrwGray or Folded by default
2996 (see |hl-Folded|), but one may put lines like >
Bram Moolenaar446cb832008-06-24 21:56:24 +00002997 hi link netrwCompress Visual
2998< into one's <.vimrc> to use one's own
Bram Moolenaara6878372014-03-22 21:02:50 +01002999 preferences. Alternatively, one may
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003000 put such specifications into >
3001 .vim/after/syntax/netrw.vim.
3002< The netrwGray highlighting is set up by
3003 netrw when >
Bram Moolenaar938ae282023-02-20 20:44:55 +00003004 * netrwGray has not been previously
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003005 defined
3006 * the gui is running
3007< As an example, I myself use a dark-background
Bram Moolenaara6878372014-03-22 21:02:50 +01003008 colorscheme with the following in
3009 .vim/after/syntax/netrw.vim: >
3010
3011 hi netrwCompress term=NONE cterm=NONE gui=NONE ctermfg=10 guifg=green ctermbg=0 guibg=black
3012 hi netrwData term=NONE cterm=NONE gui=NONE ctermfg=9 guifg=blue ctermbg=0 guibg=black
3013 hi netrwHdr term=NONE cterm=NONE,italic gui=NONE guifg=SeaGreen1
3014 hi netrwLex term=NONE cterm=NONE,italic gui=NONE guifg=SeaGreen1
3015 hi netrwYacc term=NONE cterm=NONE,italic gui=NONE guifg=SeaGreen1
3016 hi netrwLib term=NONE cterm=NONE gui=NONE ctermfg=14 guifg=yellow
3017 hi netrwObj term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
3018 hi netrwTilde term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
3019 hi netrwTmp term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
3020 hi netrwTags term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
3021 hi netrwDoc term=NONE cterm=NONE gui=NONE ctermfg=220 ctermbg=27 guifg=yellow2 guibg=Blue3
3022 hi netrwSymLink term=NONE cterm=NONE gui=NONE ctermfg=220 ctermbg=27 guifg=grey60
3023<
Bram Moolenaarff034192013-04-24 18:51:19 +02003024 *g:netrw_ssh_browse_reject* ssh can sometimes produce unwanted lines,
Bram Moolenaar446cb832008-06-24 21:56:24 +00003025 messages, banners, and whatnot that one doesn't
3026 want masquerading as "directories" and "files".
3027 Use this pattern to remove such embedded
3028 messages. By default its value is:
3029 '^total\s\+\d\+$'
3030
Bram Moolenaare6ae6222013-05-21 21:01:10 +02003031 *g:netrw_ssh_cmd* One may specify an executable command
3032 to use instead of ssh for remote actions
3033 such as listing, file removal, etc.
3034 default: ssh
3035
Bram Moolenaaraa3b15d2016-04-21 08:53:19 +02003036 *g:netrw_suppress_gx_mesg* =1 : browsers sometimes produce messages
3037 which are normally unwanted intermixed
3038 with the page.
3039 However, when using links, for example,
3040 those messages are what the browser produces.
3041 By setting this option to 0, netrw will not
3042 suppress browser messages.
Bram Moolenaar446cb832008-06-24 21:56:24 +00003043
Bram Moolenaarff034192013-04-24 18:51:19 +02003044 *g:netrw_tmpfile_escape* =' &;'
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003045 escape() is applied to all temporary files
Bram Moolenaar446cb832008-06-24 21:56:24 +00003046 to escape these characters.
3047
Bram Moolenaarff034192013-04-24 18:51:19 +02003048 *g:netrw_timefmt* specify format string to vim's strftime().
Bram Moolenaar446cb832008-06-24 21:56:24 +00003049 The default, "%c", is "the preferred date
3050 and time representation for the current
3051 locale" according to my manpage entry for
3052 strftime(); however, not all are satisfied
3053 with it. Some alternatives:
3054 "%a %d %b %Y %T",
3055 " %a %Y-%m-%d %I-%M-%S %p"
3056 default: "%c"
3057
Bram Moolenaarff034192013-04-24 18:51:19 +02003058 *g:netrw_use_noswf* netrw normally avoids writing swapfiles
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003059 for browser buffers. However, under some
Bram Moolenaar446cb832008-06-24 21:56:24 +00003060 systems this apparently is causing nasty
3061 ml_get errors to appear; if you're getting
3062 ml_get errors, try putting
3063 let g:netrw_use_noswf= 0
3064 in your .vimrc.
Bram Moolenaara6878372014-03-22 21:02:50 +01003065 default: 1
Bram Moolenaar446cb832008-06-24 21:56:24 +00003066
Bram Moolenaarff034192013-04-24 18:51:19 +02003067 *g:netrw_winsize* specify initial size of new windows made with
Bram Moolenaar446cb832008-06-24 21:56:24 +00003068 "o" (see |netrw-o|), "v" (see |netrw-v|),
Bram Moolenaar251e1912011-06-19 05:09:16 +02003069 |:Hexplore| or |:Vexplore|. The g:netrw_winsize
3070 is an integer describing the percentage of the
3071 current netrw buffer's window to be used for
3072 the new window.
Bram Moolenaar15146672011-10-20 22:22:38 +02003073 If g:netrw_winsize is less than zero, then
Bram Moolenaar85850f32019-07-19 22:05:51 +02003074 the absolute value of g:netrw_winsize will be
3075 used to specify the quantity of lines or
3076 columns for the new window.
Bram Moolenaar13600302014-05-22 18:26:40 +02003077 If g:netrw_winsize is zero, then a normal
3078 split will be made (ie. |'equalalways'| will
3079 take effect, for example).
Bram Moolenaar251e1912011-06-19 05:09:16 +02003080 default: 50 (for 50%)
Bram Moolenaar446cb832008-06-24 21:56:24 +00003081
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003082 *g:netrw_wiw* =1 specifies the minimum window width to use
3083 when shrinking a netrw/Lexplore window
3084 (see |netrw-c-tab|).
3085
Bram Moolenaarff034192013-04-24 18:51:19 +02003086 *g:netrw_xstrlen* Controls how netrw computes string lengths,
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02003087 including multi-byte characters' string
Bram Moolenaar446cb832008-06-24 21:56:24 +00003088 length. (thanks to N Weibull, T Mechelynck)
3089 =0: uses Vim's built-in strlen()
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003090 =1: number of codepoints (Latin a + combining
Bram Moolenaar446cb832008-06-24 21:56:24 +00003091 circumflex is two codepoints) (DEFAULT)
3092 =2: number of spacing codepoints (Latin a +
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003093 combining circumflex is one spacing
Bram Moolenaar446cb832008-06-24 21:56:24 +00003094 codepoint; a hard tab is one; wide and
3095 narrow CJK are one each; etc.)
3096 =3: virtual length (counting tabs as anything
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003097 between 1 and |'tabstop'|, wide CJK as 2
Bram Moolenaar446cb832008-06-24 21:56:24 +00003098 rather than 1, Arabic alif as zero when
3099 immediately preceded by lam, one
3100 otherwise, etc)
3101
Bram Moolenaarff034192013-04-24 18:51:19 +02003102 *g:NetrwTopLvlMenu* This variable specifies the top level
Bram Moolenaar446cb832008-06-24 21:56:24 +00003103 menu name; by default, it's "Netrw.". If
3104 you wish to change this, do so in your
3105 .vimrc.
3106
3107NETRW BROWSING AND OPTION INCOMPATIBILITIES *netrw-incompatible* {{{2
3108
3109Netrw has been designed to handle user options by saving them, setting the
3110options to something that's compatible with netrw's needs, and then restoring
3111them. However, the autochdir option: >
3112 :set acd
Bram Moolenaara6878372014-03-22 21:02:50 +01003113is problematic. Autochdir sets the current directory to that containing the
Bram Moolenaar446cb832008-06-24 21:56:24 +00003114file you edit; this apparently also applies to directories. In other words,
3115autochdir sets the current directory to that containing the "file" (even if
3116that "file" is itself a directory).
3117
Bram Moolenaar15146672011-10-20 22:22:38 +02003118NETRW SETTINGS WINDOW *netrw-settings-window* {{{2
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00003119
3120With the NetrwSettings.vim plugin, >
3121 :NetrwSettings
3122will bring up a window with the many variables that netrw uses for its
Bram Moolenaar1afcace2005-11-25 19:54:28 +00003123settings. You may change any of their values; when you save the file, the
3124settings therein will be used. One may also press "?" on any of the lines for
3125help on what each of the variables do.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00003126
Bram Moolenaar5b435d62012-04-05 17:33:26 +02003127(also see: |netrw-browser-var| |netrw-protocol| |netrw-variables|)
Bram Moolenaar9964e462007-05-05 17:54:07 +00003128
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00003129
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00003130==============================================================================
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003131OBTAINING A FILE *netrw-obtain* *netrw-O* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00003132
3133If there are no marked files:
3134
3135 When browsing a remote directory, one may obtain a file under the cursor
3136 (ie. get a copy on your local machine, but not edit it) by pressing the O
3137 key.
3138
3139If there are marked files:
3140
3141 The marked files will be obtained (ie. a copy will be transferred to your
3142 local machine, but not set up for editing).
3143
3144Only ftp and scp are supported for this operation (but since these two are
3145available for browsing, that shouldn't be a problem). The status bar will
3146then show, on its right hand side, a message like "Obtaining filename". The
3147statusline will be restored after the transfer is complete.
3148
3149Netrw can also "obtain" a file using the local browser. Netrw's display
3150of a directory is not necessarily the same as Vim's "current directory",
3151unless |g:netrw_keepdir| is set to 0 in the user's <.vimrc>. One may select
3152a file using the local browser (by putting the cursor on it) and pressing
3153"O" will then "obtain" the file; ie. copy it to Vim's current directory.
3154
3155Related topics:
3156 * To see what the current directory is, use |:pwd|
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02003157 * To make the currently browsed directory the current directory, see
3158 |netrw-cd|
Bram Moolenaar446cb832008-06-24 21:56:24 +00003159 * To automatically make the currently browsed directory the current
3160 directory, see |g:netrw_keepdir|.
3161
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003162 *netrw-newfile* *netrw-createfile*
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003163OPEN A NEW FILE IN NETRW'S CURRENT DIRECTORY *netrw-%* {{{2
Bram Moolenaarc236c162008-07-13 17:41:49 +00003164
Bram Moolenaara6878372014-03-22 21:02:50 +01003165To open a new file in netrw's current directory, press "%". This map
3166will query the user for a new filename; an empty file by that name will
3167be placed in the netrw's current directory (ie. b:netrw_curdir).
Bram Moolenaarc236c162008-07-13 17:41:49 +00003168
Bram Moolenaar89a9c152021-08-29 21:55:35 +02003169If Lexplore (|netrw-:Lexplore|) is in use, the new file will be generated
3170in the |g:netrw_chgwin| window.
3171
Bram Moolenaar8d043172014-01-23 14:24:41 +01003172Related topics: |netrw-d|
3173
Bram Moolenaarc236c162008-07-13 17:41:49 +00003174
Bram Moolenaar446cb832008-06-24 21:56:24 +00003175PREVIEW WINDOW *netrw-p* *netrw-preview* {{{2
3176
3177One may use a preview window by using the "p" key when the cursor is atop the
3178desired filename to be previewed. The display will then split to show both
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003179the browser (where the cursor will remain) and the file (see |:pedit|). By
3180default, the split will be taken horizontally; one may use vertical splitting
3181if one has set |g:netrw_preview| first.
Bram Moolenaar446cb832008-06-24 21:56:24 +00003182
Bram Moolenaar00a927d2010-05-14 23:24:24 +02003183An interesting set of netrw settings is: >
3184
3185 let g:netrw_preview = 1
3186 let g:netrw_liststyle = 3
3187 let g:netrw_winsize = 30
3188
3189These will:
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003190
Bram Moolenaar00a927d2010-05-14 23:24:24 +02003191 1. Make vertical splitting the default for previewing files
3192 2. Make the default listing style "tree"
3193 3. When a vertical preview window is opened, the directory listing
Bram Moolenaar5b435d62012-04-05 17:33:26 +02003194 will use only 30% of the columns available; the rest of the window
3195 is used for the preview window.
Bram Moolenaar446cb832008-06-24 21:56:24 +00003196
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003197 Related: if you like this idea, you may also find :Lexplore
3198 (|netrw-:Lexplore|) or |g:netrw_chgwin| of interest
3199
Bram Moolenaare0fa3742016-02-20 15:47:01 +01003200Also see: |g:netrw_chgwin| |netrw-P| |'previewwindow'| |CTRL-W_z| |:pclose|
Bram Moolenaara6878372014-03-22 21:02:50 +01003201
3202
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003203PREVIOUS WINDOW *netrw-P* *netrw-prvwin* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00003204
Bram Moolenaare0fa3742016-02-20 15:47:01 +01003205To edit a file or directory under the cursor in the previously used (last
3206accessed) window (see :he |CTRL-W_p|), press a "P". If there's only one
3207window, then the one window will be horizontally split (by default).
Bram Moolenaar446cb832008-06-24 21:56:24 +00003208
3209If there's more than one window, the previous window will be re-used on
3210the selected file/directory. If the previous window's associated buffer
3211has been modified, and there's only one window with that buffer, then
3212the user will be asked if s/he wishes to save the buffer first (yes,
3213no, or cancel).
3214
Bram Moolenaarff034192013-04-24 18:51:19 +02003215Related Actions |netrw-cr| |netrw-o| |netrw-t| |netrw-v|
Bram Moolenaar15146672011-10-20 22:22:38 +02003216Associated setting variables:
3217 |g:netrw_alto| control above/below splitting
3218 |g:netrw_altv| control right/left splitting
3219 |g:netrw_preview| control horizontal vs vertical splitting
3220 |g:netrw_winsize| control initial sizing
3221
Bram Moolenaara6878372014-03-22 21:02:50 +01003222Also see: |g:netrw_chgwin| |netrw-p|
3223
Bram Moolenaar446cb832008-06-24 21:56:24 +00003224
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003225REFRESHING THE LISTING *netrw-refresh* *netrw-ctrl-l* *netrw-ctrl_l* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00003226
3227To refresh either a local or remote directory listing, press ctrl-l (<c-l>) or
3228hit the <cr> when atop the ./ directory entry in the listing. One may also
3229refresh a local directory by using ":e .".
3230
3231
Bram Moolenaarff034192013-04-24 18:51:19 +02003232REVERSING SORTING ORDER *netrw-r* *netrw-reverse* {{{2
3233
3234One may toggle between normal and reverse sorting order by pressing the
3235"r" key.
3236
3237Related topics: |netrw-s|
3238Associated setting variable: |g:netrw_sort_direction|
3239
3240
Bram Moolenaar446cb832008-06-24 21:56:24 +00003241RENAMING FILES OR DIRECTORIES *netrw-move* *netrw-rename* *netrw-R* {{{2
3242
3243If there are no marked files: (see |netrw-mf|)
3244
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003245 Renaming files and directories involves moving the cursor to the
Bram Moolenaar446cb832008-06-24 21:56:24 +00003246 file/directory to be moved (renamed) and pressing "R". You will then be
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003247 queried for what you want the file/directory to be renamed to. You may
3248 select a range of lines with the "V" command (visual selection), and then
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003249 press "R"; you will be queried for each file as to what you want it
3250 renamed to.
Bram Moolenaar446cb832008-06-24 21:56:24 +00003251
3252If there are marked files: (see |netrw-mf|)
3253
3254 Marked files will be renamed (moved). You will be queried as above in
3255 order to specify where you want the file/directory to be moved.
3256
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003257 If you answer a renaming query with a "s/frompattern/topattern/", then
3258 subsequent files on the marked file list will be renamed by taking each
3259 name, applying that substitute, and renaming each file to the result.
3260 As an example : >
3261
Bram Moolenaar938ae282023-02-20 20:44:55 +00003262 mr [query: reply with *.c]
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003263 R [query: reply with s/^\(.*\)\.c$/\1.cpp/]
3264<
3265 This example will mark all *.c files and then rename them to *.cpp
Bram Moolenaar29634562020-01-09 21:46:04 +01003266 files. Netrw will protect you from overwriting local files without
3267 confirmation, but not remote ones.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003268
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003269 The ctrl-X character has special meaning for renaming files: >
3270
Bram Moolenaar938ae282023-02-20 20:44:55 +00003271 <c-x> : a single ctrl-x tells netrw to ignore the portion of the response
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003272 lying between the last '/' and the ctrl-x.
3273
3274 <c-x><c-x> : a pair of contiguous ctrl-x's tells netrw to ignore any
3275 portion of the string preceding the double ctrl-x's.
3276<
Bram Moolenaar446cb832008-06-24 21:56:24 +00003277 WARNING:~
3278
3279 Note that moving files is a dangerous operation; copies are safer. That's
3280 because a "move" for remote files is actually a copy + delete -- and if
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003281 the copy fails and the delete succeeds you may lose the file.
Bram Moolenaara6878372014-03-22 21:02:50 +01003282 Use at your own risk.
Bram Moolenaar446cb832008-06-24 21:56:24 +00003283
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003284The *g:netrw_rename_cmd* variable is used to implement remote renaming. By
3285default its value is: >
Bram Moolenaar446cb832008-06-24 21:56:24 +00003286
3287 ssh HOSTNAME mv
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003288<
Bram Moolenaar446cb832008-06-24 21:56:24 +00003289One may rename a block of files and directories by selecting them with
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003290V (|linewise-visual|) when using thin style.
3291
3292See |cmdline-editing| for more on how to edit the command line; in particular,
3293you'll find <ctrl-f> (initiates cmdline window editing) and <ctrl-c> (uses the
3294command line under the cursor) useful in conjunction with the R command.
Bram Moolenaar446cb832008-06-24 21:56:24 +00003295
3296
Bram Moolenaar446cb832008-06-24 21:56:24 +00003297SELECTING SORTING STYLE *netrw-s* *netrw-sort* {{{2
3298
3299One may select the sorting style by name, time, or (file) size. The "s" map
3300allows one to circulate amongst the three choices; the directory listing will
3301automatically be refreshed to reflect the selected style.
3302
3303Related topics: |netrw-r| |netrw-S|
3304Associated setting variables: |g:netrw_sort_by| |g:netrw_sort_sequence|
3305
3306
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003307SETTING EDITING WINDOW *netrw-editwindow* *netrw-C* *netrw-:NetrwC* {{{2
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003308
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003309One may select a netrw window for editing with the "C" mapping, using the
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003310:NetrwC [win#] command, or by setting |g:netrw_chgwin| to the selected window
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003311number. Subsequent selection of a file to edit (|netrw-cr|) will use that
3312window.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003313
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003314 * C : by itself, will select the current window holding a netrw buffer
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003315 for subsequent editing via |netrw-cr|. The C mapping is only available
3316 while in netrw buffers.
Bram Moolenaar13600302014-05-22 18:26:40 +02003317
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003318 * [count]C : the count will be used as the window number to be used
3319 for subsequent editing via |netrw-cr|.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003320
3321 * :NetrwC will set |g:netrw_chgwin| to the current window
3322
3323 * :NetrwC win# will set |g:netrw_chgwin| to the specified window
3324 number
3325
Bram Moolenaar13600302014-05-22 18:26:40 +02003326Using >
3327 let g:netrw_chgwin= -1
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003328will restore the default editing behavior
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003329(ie. subsequent editing will use the current window).
Bram Moolenaar13600302014-05-22 18:26:40 +02003330
Bram Moolenaar8d043172014-01-23 14:24:41 +01003331Related topics: |netrw-cr| |g:netrw_browse_split|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003332Associated setting variables: |g:netrw_chgwin|
3333
3334
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003335SHRINKING OR EXPANDING A NETRW OR LEXPLORE WINDOW *netrw-c-tab* {{{2
3336
3337The <c-tab> key will toggle a netrw or |:Lexplore| window's width,
3338but only if |g:netrw_usetab| exists and is non-zero (and, of course,
3339only if your terminal supports differentiating <c-tab> from a plain
3340<tab>).
3341
3342 * If the current window is a netrw window, toggle its width
3343 (between |g:netrw_wiw| and its original width)
3344
3345 * Else if there is a |:Lexplore| window in the current tab, toggle
3346 its width
3347
3348 * Else bring up a |:Lexplore| window
3349
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003350If |g:netrw_usetab| exists and is zero, or if there is a pre-existing mapping
Bram Moolenaare0fa3742016-02-20 15:47:01 +01003351for <c-tab>, then the <c-tab> will not be mapped. One may map something other
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003352than a <c-tab>, too: (but you'll still need to have had |g:netrw_usetab| set). >
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003353
3354 nmap <unique> (whatever) <Plug>NetrwShrink
3355<
3356Related topics: |:Lexplore|
3357Associated setting variable: |g:netrw_usetab|
3358
3359
3360USER SPECIFIED MAPS *netrw-usermaps* {{{1
3361
3362One may make customized user maps. Specify a variable, |g:Netrw_UserMaps|,
3363to hold a |List| of lists of keymap strings and function names: >
3364
3365 [["keymap-sequence","ExampleUserMapFunc"],...]
3366<
3367When netrw is setting up maps for a netrw buffer, if |g:Netrw_UserMaps|
3368exists, then the internal function netrw#UserMaps(islocal) is called.
3369This function goes through all the entries in the |g:Netrw_UserMaps| list:
3370
3371 * sets up maps: >
3372 nno <buffer> <silent> KEYMAP-SEQUENCE
3373 :call s:UserMaps(islocal,"ExampleUserMapFunc")
3374< * refreshes if result from that function call is the string
3375 "refresh"
3376 * if the result string is not "", then that string will be
3377 executed (:exe result)
3378 * if the result is a List, then the above two actions on results
3379 will be taken for every string in the result List
3380
3381The user function is passed one argument; it resembles >
3382
3383 fun! ExampleUserMapFunc(islocal)
3384<
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003385where a:islocal is 1 if its a local-directory system call or 0 when
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003386remote-directory system call.
3387
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003388 *netrw-call* *netrw-expose* *netrw-modify*
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003389Use netrw#Expose("varname") to access netrw-internal (script-local)
3390 variables.
3391Use netrw#Modify("varname",newvalue) to change netrw-internal variables.
3392Use netrw#Call("funcname"[,args]) to call a netrw-internal function with
3393 specified arguments.
3394
3395Example: Get a copy of netrw's marked file list: >
3396
3397 let netrwmarkfilelist= netrw#Expose("netrwmarkfilelist")
3398<
3399Example: Modify the value of netrw's marked file list: >
3400
3401 call netrw#Modify("netrwmarkfilelist",[])
3402<
3403Example: Clear netrw's marked file list via a mapping on gu >
3404 " ExampleUserMap: {{{2
3405 fun! ExampleUserMap(islocal)
3406 call netrw#Modify("netrwmarkfilelist",[])
3407 call netrw#Modify('netrwmarkfilemtch_{bufnr("%")}',"")
3408 let retval= ["refresh"]
3409 return retval
3410 endfun
3411 let g:Netrw_UserMaps= [["gu","ExampleUserMap"]]
3412<
3413
Bram Moolenaar446cb832008-06-24 21:56:24 +0000341410. Problems and Fixes *netrw-problems* {{{1
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003415
3416 (This section is likely to grow as I get feedback)
3417 (also see |netrw-debug|)
Bram Moolenaar488c6512005-08-11 20:09:58 +00003418 *netrw-p1*
Nir Lichtman1e34b952024-05-08 19:19:34 +02003419 P1. I use Windows, and my network browsing with ftp doesn't sort by {{{2
Bram Moolenaar9964e462007-05-05 17:54:07 +00003420 time or size! -or- The remote system is a Windows server; why
3421 don't I get sorts by time or size?
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003422
3423 Windows' ftp has a minimal support for ls (ie. it doesn't
3424 accept sorting options). It doesn't support the -F which
3425 gives an explanatory character (ABC/ for "ABC is a directory").
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003426 Netrw then uses "dir" to get both its thin and long listings.
Bram Moolenaar9964e462007-05-05 17:54:07 +00003427 If you think your ftp does support a full-up ls, put the
3428 following into your <.vimrc>: >
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003429
Bram Moolenaar9964e462007-05-05 17:54:07 +00003430 let g:netrw_ftp_list_cmd = "ls -lF"
3431 let g:netrw_ftp_timelist_cmd= "ls -tlF"
3432 let g:netrw_ftp_sizelist_cmd= "ls -slF"
3433<
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003434 Alternatively, if you have cygwin on your Windows box, put
Bram Moolenaar9964e462007-05-05 17:54:07 +00003435 into your <.vimrc>: >
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003436
3437 let g:netrw_cygwin= 1
Bram Moolenaar9964e462007-05-05 17:54:07 +00003438<
3439 This problem also occurs when the remote system is Windows.
3440 In this situation, the various g:netrw_ftp_[time|size]list_cmds
3441 are as shown above, but the remote system will not correctly
3442 modify its listing behavior.
3443
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003444
Nir Lichtman1e34b952024-05-08 19:19:34 +02003445 *netrw-p2*
3446 P2. I tried rcp://user@host/ (or protocol other than ftp) and netrw {{{2
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003447 used ssh! That wasn't what I asked for...
3448
3449 Netrw has two methods for browsing remote directories: ssh
3450 and ftp. Unless you specify ftp specifically, ssh is used.
3451 When it comes time to do download a file (not just a directory
3452 listing), netrw will use the given protocol to do so.
3453
Nir Lichtman1e34b952024-05-08 19:19:34 +02003454 *netrw-p3*
3455 P3. I would like long listings to be the default. {{{2
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003456
Bram Moolenaar446cb832008-06-24 21:56:24 +00003457 Put the following statement into your |.vimrc|: >
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00003458
Bram Moolenaar446cb832008-06-24 21:56:24 +00003459 let g:netrw_liststyle= 1
3460<
3461 Check out |netrw-browser-var| for more customizations that
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00003462 you can set.
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003463
Nir Lichtman1e34b952024-05-08 19:19:34 +02003464 *netrw-p4*
3465 P4. My times come up oddly in local browsing {{{2
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003466
3467 Does your system's strftime() accept the "%c" to yield dates
Bram Moolenaarff034192013-04-24 18:51:19 +02003468 such as "Sun Apr 27 11:49:23 1997"? If not, do a
3469 "man strftime" and find out what option should be used. Then
3470 put it into your |.vimrc|: >
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003471
Bram Moolenaar446cb832008-06-24 21:56:24 +00003472 let g:netrw_timefmt= "%X" (where X is the option)
3473<
Nir Lichtman1e34b952024-05-08 19:19:34 +02003474 *netrw-p5*
3475 P5. I want my current directory to track my browsing. {{{2
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00003476 How do I do that?
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003477
Bram Moolenaar446cb832008-06-24 21:56:24 +00003478 Put the following line in your |.vimrc|:
3479>
Bram Moolenaar433f7c82006-03-21 21:29:36 +00003480 let g:netrw_keepdir= 0
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003481<
Nir Lichtman1e34b952024-05-08 19:19:34 +02003482 *netrw-p6*
3483 P6. I use Chinese (or other non-ascii) characters in my filenames, {{{2
Bram Moolenaar85850f32019-07-19 22:05:51 +02003484 and netrw (Explore, Sexplore, Hexplore, etc) doesn't display them!
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00003485
Bram Moolenaar9964e462007-05-05 17:54:07 +00003486 (taken from an answer provided by Wu Yongwei on the vim
3487 mailing list)
Bram Moolenaara6878372014-03-22 21:02:50 +01003488 I now see the problem. Your code page is not 936, right? Vim
Bram Moolenaar9964e462007-05-05 17:54:07 +00003489 seems only able to open files with names that are valid in the
3490 current code page, as are many other applications that do not
3491 use the Unicode version of Windows APIs. This is an OS-related
3492 issue. You should not have such problems when the system
3493 locale uses UTF-8, such as modern Linux distros.
3494
3495 (...it is one more reason to recommend that people use utf-8!)
3496
Nir Lichtman1e34b952024-05-08 19:19:34 +02003497 *netrw-p7*
3498 P7. I'm getting "ssh is not executable on your system" -- what do I {{{2
Bram Moolenaar9964e462007-05-05 17:54:07 +00003499 do?
3500
3501 (Dudley Fox) Most people I know use putty for windows ssh. It
3502 is a free ssh/telnet application. You can read more about it
3503 here:
3504
3505 http://www.chiark.greenend.org.uk/~sgtatham/putty/ Also:
3506
3507 (Marlin Unruh) This program also works for me. It's a single
3508 executable, so he/she can copy it into the Windows\System32
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003509 folder and create a shortcut to it.
Bram Moolenaar9964e462007-05-05 17:54:07 +00003510
3511 (Dudley Fox) You might also wish to consider plink, as it
3512 sounds most similar to what you are looking for. plink is an
3513 application in the putty suite.
3514
3515 http://the.earth.li/~sgtatham/putty/0.58/htmldoc/Chapter7.html#plink
3516
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003517 (Vissale Neang) Maybe you can try OpenSSH for windows, which
Bram Moolenaar9964e462007-05-05 17:54:07 +00003518 can be obtained from:
3519
3520 http://sshwindows.sourceforge.net/
3521
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003522 It doesn't need the full Cygwin package.
Bram Moolenaar9964e462007-05-05 17:54:07 +00003523
3524 (Antoine Mechelynck) For individual Unix-like programs needed
3525 for work in a native-Windows environment, I recommend getting
3526 them from the GnuWin32 project on sourceforge if it has them:
3527
3528 http://gnuwin32.sourceforge.net/
3529
3530 Unlike Cygwin, which sets up a Unix-like virtual machine on
3531 top of Windows, GnuWin32 is a rewrite of Unix utilities with
3532 Windows system calls, and its programs works quite well in the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003533 cmd.exe "Dos box".
Bram Moolenaar9964e462007-05-05 17:54:07 +00003534
3535 (dave) Download WinSCP and use that to connect to the server.
3536 In Preferences > Editors, set gvim as your editor:
3537
3538 - Click "Add..."
3539 - Set External Editor (adjust path as needed, include
3540 the quotes and !.! at the end):
Bram Moolenaar8024f932020-01-14 19:29:13 +01003541 "c:\Program Files\Vim\vim82\gvim.exe" !.!
Bram Moolenaar9964e462007-05-05 17:54:07 +00003542 - Check that the filetype in the box below is
3543 {asterisk}.{asterisk} (all files), or whatever types
3544 you want (cec: change {asterisk} to * ; I had to
3545 write it that way because otherwise the helptags
Bram Moolenaar446cb832008-06-24 21:56:24 +00003546 system thinks it's a tag)
3547 - Make sure it's at the top of the listbox (click it,
3548 then click "Up" if it's not)
Bram Moolenaar9964e462007-05-05 17:54:07 +00003549 If using the Norton Commander style, you just have to hit <F4>
3550 to edit a file in a local copy of gvim.
3551
3552 (Vit Gottwald) How to generate public/private key and save
3553 public key it on server: >
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +02003554 http://www.chiark.greenend.org.uk/~sgtatham/putty/0.60/htmldoc/Chapter8.html#pubkey-gettingready
3555 (8.3 Getting ready for public key authentication)
Bram Moolenaar9964e462007-05-05 17:54:07 +00003556<
Bram Moolenaar446cb832008-06-24 21:56:24 +00003557 How to use a private key with 'pscp': >
3558
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +02003559 http://www.chiark.greenend.org.uk/~sgtatham/putty/0.60/htmldoc/Chapter5.html
3560 (5.2.4 Using public key authentication with PSCP)
Bram Moolenaar9964e462007-05-05 17:54:07 +00003561<
Bram Moolenaar446cb832008-06-24 21:56:24 +00003562 (Ben Schmidt) I find the ssh included with cwRsync is
3563 brilliant, and install cwRsync or cwRsyncServer on most
3564 Windows systems I come across these days. I guess COPSSH,
3565 packed by the same person, is probably even better for use as
3566 just ssh on Windows, and probably includes sftp, etc. which I
3567 suspect the cwRsync doesn't, though it might
3568
Bram Moolenaar9964e462007-05-05 17:54:07 +00003569 (cec) To make proper use of these suggestions above, you will
3570 need to modify the following user-settable variables in your
3571 .vimrc:
3572
Bram Moolenaar446cb832008-06-24 21:56:24 +00003573 |g:netrw_ssh_cmd| |g:netrw_list_cmd| |g:netrw_mkdir_cmd|
3574 |g:netrw_rm_cmd| |g:netrw_rmdir_cmd| |g:netrw_rmf_cmd|
Bram Moolenaar9964e462007-05-05 17:54:07 +00003575
3576 The first one (|g:netrw_ssh_cmd|) is the most important; most
3577 of the others will use the string in g:netrw_ssh_cmd by
3578 default.
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003579
Nir Lichtman1e34b952024-05-08 19:19:34 +02003580 *netrw-p8* *netrw-ml_get*
3581 P8. I'm browsing, changing directory, and bang! ml_get errors {{{2
Bram Moolenaar9964e462007-05-05 17:54:07 +00003582 appear and I have to kill vim. Any way around this?
3583
3584 Normally netrw attempts to avoid writing swapfiles for
3585 its temporary directory buffers. However, on some systems
3586 this attempt appears to be causing ml_get errors to
3587 appear. Please try setting |g:netrw_use_noswf| to 0
3588 in your <.vimrc>: >
3589 let g:netrw_use_noswf= 0
3590<
Nir Lichtman1e34b952024-05-08 19:19:34 +02003591 *netrw-p9*
3592 P9. I'm being pestered with "[something] is a directory" and {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00003593 "Press ENTER or type command to continue" prompts...
3594
3595 The "[something] is a directory" prompt is issued by Vim,
3596 not by netrw, and there appears to be no way to work around
3597 it. Coupled with the default cmdheight of 1, this message
3598 causes the "Press ENTER..." prompt. So: read |hit-enter|;
3599 I also suggest that you set your |'cmdheight'| to 2 (or more) in
3600 your <.vimrc> file.
3601
Nir Lichtman1e34b952024-05-08 19:19:34 +02003602 *netrw-p10*
3603 P10. I want to have two windows; a thin one on the left and my {{{2
Bram Moolenaar85850f32019-07-19 22:05:51 +02003604 editing window on the right. How may I accomplish this?
Bram Moolenaar446cb832008-06-24 21:56:24 +00003605
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003606 You probably want netrw running as in a side window. If so, you
3607 will likely find that ":[N]Lexplore" does what you want. The
3608 optional "[N]" allows you to select the quantity of columns you
Bram Moolenaard7464be2015-11-01 16:49:04 +01003609 wish the |:Lexplore|r window to start with (see |g:netrw_winsize|
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003610 for how this parameter works).
3611
3612 Previous solution:
3613
Bram Moolenaar446cb832008-06-24 21:56:24 +00003614 * Put the following line in your <.vimrc>:
3615 let g:netrw_altv = 1
3616 * Edit the current directory: :e .
3617 * Select some file, press v
3618 * Resize the windows as you wish (see |CTRL-W_<| and
3619 |CTRL-W_>|). If you're using gvim, you can drag
3620 the separating bar with your mouse.
3621 * When you want a new file, use ctrl-w h to go back to the
3622 netrw browser, select a file, then press P (see |CTRL-W_h|
3623 and |netrw-P|). If you're using gvim, you can press
3624 <leftmouse> in the browser window and then press the
3625 <middlemouse> to select the file.
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003626
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003627
Nir Lichtman1e34b952024-05-08 19:19:34 +02003628 *netrw-p11*
3629 P11. My directory isn't sorting correctly, or unwanted letters are {{{2
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003630 appearing in the listed filenames, or things aren't lining
3631 up properly in the wide listing, ...
3632
3633 This may be due to an encoding problem. I myself usually use
3634 utf-8, but really only use ascii (ie. bytes from 32-126).
3635 Multibyte encodings use two (or more) bytes per character.
3636 You may need to change |g:netrw_sepchr| and/or |g:netrw_xstrlen|.
3637
Nir Lichtman1e34b952024-05-08 19:19:34 +02003638 *netrw-p12*
3639 P12. I'm a Windows + putty + ssh user, and when I attempt to {{{2
Bram Moolenaar85850f32019-07-19 22:05:51 +02003640 browse, the directories are missing trailing "/"s so netrw treats
3641 them as file transfers instead of as attempts to browse
Bram Moolenaar00a927d2010-05-14 23:24:24 +02003642 subdirectories. How may I fix this?
3643
3644 (mikeyao) If you want to use vim via ssh and putty under Windows,
3645 try combining the use of pscp/psftp with plink. pscp/psftp will
3646 be used to connect and plink will be used to execute commands on
3647 the server, for example: list files and directory using 'ls'.
3648
3649 These are the settings I use to do this:
3650>
3651 " list files, it's the key setting, if you haven't set,
3652 " you will get a blank buffer
3653 let g:netrw_list_cmd = "plink HOSTNAME ls -Fa"
3654 " if you haven't add putty directory in system path, you should
3655 " specify scp/sftp command. For examples:
3656 "let g:netrw_sftp_cmd = "d:\\dev\\putty\\PSFTP.exe"
3657 "let g:netrw_scp_cmd = "d:\\dev\\putty\\PSCP.exe"
3658<
Nir Lichtman1e34b952024-05-08 19:19:34 +02003659 *netrw-p13*
3660 P13. I would like to speed up writes using Nwrite and scp/ssh {{{2
Bram Moolenaar251e1912011-06-19 05:09:16 +02003661 style connections. How? (Thomer M. Gil)
Bram Moolenaar00a927d2010-05-14 23:24:24 +02003662
Bram Moolenaar251e1912011-06-19 05:09:16 +02003663 Try using ssh's ControlMaster and ControlPath (see the ssh_config
3664 man page) to share multiple ssh connections over a single network
3665 connection. That cuts out the cryptographic handshake on each
3666 file write, sometimes speeding it up by an order of magnitude.
3667 (see http://thomer.com/howtos/netrw_ssh.html)
3668 (included by permission)
3669
3670 Add the following to your ~/.ssh/config: >
3671
3672 # you change "*" to the hostname you care about
3673 Host *
3674 ControlMaster auto
3675 ControlPath /tmp/%r@%h:%p
3676
3677< Then create an ssh connection to the host and leave it running: >
3678
3679 ssh -N host.domain.com
3680
3681< Now remotely open a file with Vim's Netrw and enjoy the
3682 zippiness: >
3683
3684 vim scp://host.domain.com//home/user/.bashrc
3685<
Nir Lichtman1e34b952024-05-08 19:19:34 +02003686 *netrw-p14*
3687 P14. How may I use a double-click instead of netrw's usual single {{{2
Bram Moolenaar85850f32019-07-19 22:05:51 +02003688 click to open a file or directory? (Ben Fritz)
Bram Moolenaar251e1912011-06-19 05:09:16 +02003689
3690 First, disable netrw's mapping with >
3691 let g:netrw_mousemaps= 0
3692< and then create a netrw buffer only mapping in
3693 $HOME/.vim/after/ftplugin/netrw.vim: >
3694 nmap <buffer> <2-leftmouse> <CR>
3695< Note that setting g:netrw_mousemaps to zero will turn off
3696 all netrw's mouse mappings, not just the <leftmouse> one.
3697 (see |g:netrw_mousemaps|)
Bram Moolenaar00a927d2010-05-14 23:24:24 +02003698
Nir Lichtman1e34b952024-05-08 19:19:34 +02003699 *netrw-p15*
3700 P15. When editing remote files (ex. :e ftp://hostname/path/file), {{{2
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003701 under Windows I get an |E303| message complaining that its unable
Bram Moolenaar13600302014-05-22 18:26:40 +02003702 to open a swap file.
3703
3704 (romainl) It looks like you are starting Vim from a protected
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003705 directory. Start netrw from your $HOME or other writable
Bram Moolenaar13600302014-05-22 18:26:40 +02003706 directory.
3707
Nir Lichtman1e34b952024-05-08 19:19:34 +02003708 *netrw-p16*
3709 P16. Netrw is closing buffers on its own. {{{2
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003710 What steps will reproduce the problem?
3711 1. :Explore, navigate directories, open a file
3712 2. :Explore, open another file
3713 3. Buffer opened in step 1 will be closed. o
3714 What is the expected output? What do you see instead?
3715 I expect both buffers to exist, but only the last one does.
3716
3717 (Lance) Problem is caused by "set autochdir" in .vimrc.
3718 (drchip) I am able to duplicate this problem with |'acd'| set.
3719 It appears that the buffers are not exactly closed;
3720 a ":ls!" will show them (although ":ls" does not).
3721
Nir Lichtman1e34b952024-05-08 19:19:34 +02003722 *netrw-P17*
3723 P17. How to locally edit a file that's only available via {{{2
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003724 another server accessible via ssh?
3725 See http://stackoverflow.com/questions/12469645/
3726 "Using Vim to Remotely Edit A File on ServerB Only
3727 Accessible From ServerA"
3728
Nir Lichtman1e34b952024-05-08 19:19:34 +02003729 *netrw-P18*
3730 P18. How do I get numbering on in directory listings? {{{2
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003731 With |g:netrw_bufsettings|, you can control netrw's buffer
3732 settings; try putting >
3733 let g:netrw_bufsettings="noma nomod nu nobl nowrap ro nornu"
3734< in your .vimrc. If you'd like to have relative numbering
3735 instead, try >
3736 let g:netrw_bufsettings="noma nomod nonu nobl nowrap ro rnu"
3737<
Nir Lichtman1e34b952024-05-08 19:19:34 +02003738 *netrw-P19*
3739 P19. How may I have gvim start up showing a directory listing? {{{2
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003740 Try putting the following code snippet into your .vimrc: >
3741 augroup VimStartup
3742 au!
3743 au VimEnter * if expand("%") == "" && argc() == 0 &&
3744 \ (v:servername =~ 'GVIM\d*' || v:servername == "")
3745 \ | e . | endif
3746 augroup END
3747< You may use Lexplore instead of "e" if you're so inclined.
3748 This snippet assumes that you have client-server enabled
3749 (ie. a "huge" vim version).
3750
Nir Lichtman1e34b952024-05-08 19:19:34 +02003751 *netrw-P20*
3752 P20. I've made a directory (or file) with an accented character, {{{2
Bram Moolenaar85850f32019-07-19 22:05:51 +02003753 but netrw isn't letting me enter that directory/read that file:
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003754
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003755 Its likely that the shell or o/s is using a different encoding
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003756 than you have vim (netrw) using. A patch to vim supporting
3757 "systemencoding" may address this issue in the future; for
3758 now, just have netrw use the proper encoding. For example: >
3759
3760 au FileType netrw set enc=latin1
3761<
Nir Lichtman1e34b952024-05-08 19:19:34 +02003762 *netrw-P21*
3763 P21. I get an error message when I try to copy or move a file: {{{2
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003764
3765 **error** (netrw) tried using g:netrw_localcopycmd<cp>; it doesn't work!
3766
3767 What's wrong?
3768
3769 Netrw uses several system level commands to do things (see
3770
3771 |g:netrw_localcopycmd|, |g:netrw_localmovecmd|,
K.Takata71d0ba02024-01-10 03:21:05 +09003772 |g:netrw_mkdir_cmd|).
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003773
3774 You may need to adjust the default commands for one or more of
3775 these commands by setting them properly in your .vimrc. Another
3776 source of difficulty is that these commands use vim's local
3777 directory, which may not be the same as the browsing directory
3778 shown by netrw (see |g:netrw_keepdir|).
3779
3780
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003781==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +0000378211. Debugging Netrw Itself *netrw-debug* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +00003783
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003784Step 1: check that the problem you've encountered hasn't already been resolved
3785by obtaining a copy of the latest (often developmental) netrw at:
3786
3787 http://www.drchip.org/astronaut/vim/index.html#NETRW
3788
3789The <netrw.vim> script is typically installed on systems as something like:
Bram Moolenaar488c6512005-08-11 20:09:58 +00003790>
Bram Moolenaar8024f932020-01-14 19:29:13 +01003791 /usr/local/share/vim/vim8x/plugin/netrwPlugin.vim
3792 /usr/local/share/vim/vim8x/autoload/netrw.vim
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003793 (see output of :echo &rtp)
Bram Moolenaar488c6512005-08-11 20:09:58 +00003794<
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003795which is loaded automatically at startup (assuming :set nocp). If you
3796installed a new netrw, then it will be located at >
3797
3798 $HOME/.vim/plugin/netrwPlugin.vim
3799 $HOME/.vim/autoload/netrw.vim
3800<
3801Step 2: assuming that you've installed the latest version of netrw,
3802check that your problem is really due to netrw. Create a file
3803called netrw.vimrc with the following contents: >
3804
3805 set nocp
3806 so $HOME/.vim/plugin/netrwPlugin.vim
3807<
3808Then run netrw as follows: >
3809
Bram Moolenaare0fa3742016-02-20 15:47:01 +01003810 vim -u netrw.vimrc --noplugins -i NONE [some path here]
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003811<
3812Perform whatever netrw commands you need to, and check that the problem is
3813still present. This procedure sidesteps any issues due to personal .vimrc
Bram Moolenaare0fa3742016-02-20 15:47:01 +01003814settings, .viminfo file, and other plugins. If the problem does not appear,
3815then you need to determine which setting in your .vimrc is causing the
3816conflict with netrw or which plugin(s) is/are involved.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003817
3818Step 3: If the problem still is present, then get a debugging trace from
3819netrw:
Bram Moolenaar071d4272004-06-13 20:20:40 +00003820
3821 1. Get the <Decho.vim> script, available as:
3822
Bram Moolenaar97d62492012-11-15 21:28:22 +01003823 http://www.drchip.org/astronaut/vim/index.html#DECHO
Bram Moolenaar071d4272004-06-13 20:20:40 +00003824 or
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00003825 http://vim.sourceforge.net/scripts/script.php?script_id=120
Bram Moolenaar071d4272004-06-13 20:20:40 +00003826
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02003827 Decho.vim is provided as a "vimball"; see |vimball-intro|. You
3828 should edit the Decho.vba.gz file and source it in: >
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00003829
Bram Moolenaar938ae282023-02-20 20:44:55 +00003830 vim Decho.vba.gz
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02003831 :so %
3832 :q
3833<
3834 2. To turn on debug tracing in netrw, then edit the <netrw.vim>
3835 file by typing: >
Bram Moolenaard4755bb2004-09-02 19:12:26 +00003836
3837 vim netrw.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +00003838 :DechoOn
Bram Moolenaard4755bb2004-09-02 19:12:26 +00003839 :wq
Bram Moolenaar446cb832008-06-24 21:56:24 +00003840<
3841 To restore to normal non-debugging behavior, re-edit <netrw.vim>
3842 and type >
Bram Moolenaar071d4272004-06-13 20:20:40 +00003843
Bram Moolenaard4755bb2004-09-02 19:12:26 +00003844 vim netrw.vim
3845 :DechoOff
3846 :wq
Bram Moolenaar446cb832008-06-24 21:56:24 +00003847<
Bram Moolenaard4755bb2004-09-02 19:12:26 +00003848 This command, provided by <Decho.vim>, will comment out all
3849 Decho-debugging statements (Dfunc(), Dret(), Decho(), Dredir()).
3850
Bram Moolenaar446cb832008-06-24 21:56:24 +00003851 3. Then bring up vim and attempt to evoke the problem by doing a
3852 transfer or doing some browsing. A set of messages should appear
3853 concerning the steps that <netrw.vim> took in attempting to
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003854 read/write your file over the network in a separate tab or
3855 server vim window.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003856
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02003857 Change the netrw.vimrc file to include the Decho plugin: >
3858
3859 set nocp
3860 so $HOME/.vim/plugin/Decho.vim
3861 so $HOME/.vim/plugin/netrwPlugin.vim
3862<
3863 You should continue to run vim with >
3864
3865 vim -u netrw.vimrc --noplugins -i NONE [some path here]
3866<
3867 to avoid entanglements with options and other plugins.
3868
3869 To save the file: under linux, the output will be in a separate
3870 remote server window; in it, just save the file with >
3871
Bram Moolenaar938ae282023-02-20 20:44:55 +00003872 :w! DBG
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02003873
3874< Under a vim that doesn't support clientserver, your debugging
3875 output will appear in another tab: >
Bram Moolenaar8d043172014-01-23 14:24:41 +01003876
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003877 :tabnext
Bram Moolenaar9964e462007-05-05 17:54:07 +00003878 :set bt=
3879 :w! DBG
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02003880<
3881 Furthermore, it'd be helpful if you would type >
Bram Moolenaar8d043172014-01-23 14:24:41 +01003882
Bram Moolenaara6878372014-03-22 21:02:50 +01003883 :Dsep <command>
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02003884
Bram Moolenaara6878372014-03-22 21:02:50 +01003885< where <command> is the command you're about to type next,
3886 thereby making it easier to associate which part of the
3887 debugging trace is due to which command.
Bram Moolenaar8d043172014-01-23 14:24:41 +01003888
Christian Brabandtc5e24ee2024-07-13 18:19:03 +02003889 For bug reports, please see |bugs|.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003890==============================================================================
Bram Moolenaar9964e462007-05-05 17:54:07 +0000389112. History *netrw-history* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +00003892
K.Takata71d0ba02024-01-10 03:21:05 +09003893 v172: Sep 02, 2021 * (Bram Moolenaar) Changed "l:go" to "go"
3894 * (Bram Moolenaar) no need for "b" in
3895 netrw-safe guioptions
3896 Nov 15, 2021 * removed netrw_localrm and netrw_localrmdir
3897 references
zeertzjq8feed3a2024-09-29 10:37:47 +02003898 Aug 18, 2022 * (Miguel Barro) improving compatibility with
K.Takata71d0ba02024-01-10 03:21:05 +09003899 powershell
Bram Moolenaar89a9c152021-08-29 21:55:35 +02003900 v171: Oct 09, 2020 * included code in s:NetrwOptionsSafe()
3901 to allow |'bh'| to be set to delete when
3902 rather than hide when g:netrw_fastbrowse
3903 was zero.
3904 * Installed |g:netrw_clipboard| setting
3905 * Installed option bypass for |'guioptions'|
3906 a/A settings
Bram Moolenaarb529cfb2022-07-25 15:42:07 +01003907 * Changed popup_beval() to |popup_atcursor()|
Bram Moolenaar89a9c152021-08-29 21:55:35 +02003908 in netrw#ErrorMsg (lacygoill). Apparently
3909 popup_beval doesn't reliably close the
3910 popup when the mouse is moved.
3911 * VimEnter() now using win_execute to examine
3912 buffers for an attempt to open a directory.
3913 Avoids issues with popups/terminal from
3914 command line. (lacygoill)
3915 Jun 28, 2021 * (zeertzjq) provided a patch for use of
3916 xmap,xno instead of vmap,vno in
3917 netrwPlugin.vim. Avoids entanglement with
3918 select mode.
3919 Jul 14, 2021 * Fixed problem addressed by tst976; opening
3920 a file using tree mode, going up a
3921 directory, and opening a file there was
3922 opening the file in the wrong directory.
3923 Jul 28, 2021 * (Ingo Karkat) provided a patch fixing an
3924 E488 error with netrwPlugin.vim
3925 (occurred for vim versions < 8.02)
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02003926 v170: Mar 11, 2020 * (reported by Reiner Herrmann) netrw+tree
3927 would not hide with the ^\..* pattern
3928 correctly.
3929 * (Marcin Szamotulski) NetrwOptionRestore
3930 did not restore options correctly that
3931 had a single quote in the option string.
3932 Apr 13, 2020 * implemented error handling via popup
3933 windows (see |popup_beval()|)
3934 Apr 30, 2020 * (reported by Manatsu Takahashi) while
3935 using Lexplore, a modified file could
3936 be overwritten. Sol'n: will not overwrite,
3937 but will emit an |E37| (although one cannot
3938 add an ! to override)
3939 Jun 07, 2020 * (reported by Jo Totland) repeatedly invoking
3940 :Lexplore and quitting it left unused
3941 hidden buffers. Netrw will now set netrw
Bram Moolenaar89a9c152021-08-29 21:55:35 +02003942 buffers created by :Lexplore to |'bh'|=wipe.
Bram Moolenaar29634562020-01-09 21:46:04 +01003943 v169: Dec 20, 2019 * (reported by amkarthik) that netrw's x
3944 (|netrw-x|) would throw an error when
3945 attempting to open a local directory.
3946 v168: Dec 12, 2019 * scp timeout error message not reported,
3947 hopefully now fixed (Shane Xb Qian)
Bram Moolenaar91359012019-11-30 17:57:03 +01003948 v167: Nov 29, 2019 * netrw does a save&restore on @* and @+.
3949 That causes problems with the clipboard.
3950 Now restores occurs only if @* or @+ have
3951 been changed.
3952 * netrw will change @* or @+ less often.
3953 Never if I happen to have caught all the
3954 operations that modify the unnamed
3955 register (which also writes @*).
3956 * Modified hiding behavior so that "s"
3957 will not ignore hiding.
Bram Moolenaar5ef1c6a2019-11-10 22:09:11 +01003958 v166: Nov 06, 2019 * Removed a space from a nmap for "-"
3959 * Numerous debugging statement changes
Bram Moolenaar85850f32019-07-19 22:05:51 +02003960 v163: Dec 05, 2017 * (Cristi Balan) reported that a setting ('sel')
3961 was left changed
3962 * (Holger Mitschke) reported a problem with
3963 saving and restoring history. Fixed.
3964 * Hopefully I fixed a nasty bug that caused a
3965 file rename to wipe out a buffer that it
3966 should not have wiped out.
3967 * (Holger Mitschke) amended this help file
3968 with additional |g:netrw_special_syntax|
3969 items
Bram Moolenaar5ef1c6a2019-11-10 22:09:11 +01003970 * Prioritized wget over curl for
3971 g:netrw_http_cmd
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003972 v162: Sep 19, 2016 * (haya14busa) pointed out two syntax errors
3973 with a patch; these are now fixed.
3974 Oct 26, 2016 * I started using mate-terminal and found that
3975 x and gx (|netrw-x| and |netrw-gx|) were no
3976 longer working. Fixed (using atril when
3977 $DESKTOP_SESSION is "mate").
3978 Nov 04, 2016 * (Martin Vuille) pointed out that @+ was
3979 being restored with keepregstar rather than
3980 keepregplus.
3981 Nov 09, 2016 * Broke apart the command from the options,
3982 mostly for Windows. Introduced new netrw
3983 settings: |g:netrw_localcopycmdopt|
Bram Moolenaarb7398fe2023-05-14 18:50:25 +01003984 |g:netrw_localcopydircmdopt|
3985 |g:netrw_localmkdiropt|
3986 |g:netrw_localmovecmdopt|
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003987 Nov 21, 2016 * (mattn) provided a patch for preview; swapped
3988 winwidth() with winheight()
3989 Nov 22, 2016 * (glacambre) reported that files containing
3990 spaces weren't being obtained properly via
3991 scp. Fix: apparently using single quotes
3992 such as with 'file name' wasn't enough; the
3993 spaces inside the quotes also had to be
3994 escaped (ie. 'file\ name').
3995 * Also fixed obtain (|netrw-O|) to be able to
3996 obtain files with spaces in their names
3997 Dec 20, 2016 * (xc1427) Reported that using "I" (|netrw-I|)
3998 when atop "Hiding" in the banner also caused
3999 the active-banner hiding control to occur
4000 Jan 03, 2017 * (Enno Nagel) reported that attempting to
4001 apply netrw to a directory that was without
4002 read permission caused a syntax error.
4003 Jan 13, 2017 * (Ingo Karkat) provided a patch which makes
4004 using netrw#Call() better. Now returns
4005 value of internal routines return, for example.
4006 Jan 13, 2017 * (Ingo Karkat) changed netrw#FileUrlRead to
4007 use |:edit| instead of |:read|. I also
4008 changed the routine name to netrw#FileUrlEdit.
4009 Jan 16, 2017 * (Sayem) reported a problem where :Lexplore
4010 could generate a new listing buffer and
4011 window instead of toggling the netrw display.
4012 Unfortunately, the directions for eliciting
4013 the problem weren't complete, so I may or
4014 may not have fixed that issue.
4015 Feb 06, 2017 * Implemented cb and cB. Changed "c" to "cd".
4016 (see |netrw-cb|, |netrw-cB|, and |netrw-cd|)
4017 Mar 21, 2017 * previously, netrw would specify (safe) settings
4018 even when the setting was already safe for
4019 netrw. Netrw now attempts to leave such
4020 already-netrw-safe settings alone.
4021 (affects s:NetrwOptionRestore() and
4022 s:NetrwSafeOptions(); also introduced
4023 s:NetrwRestoreSetting())
4024 Jun 26, 2017 * (Christian Brabandt) provided a patch to
4025 allow curl to follow redirects (ie. -L
4026 option)
4027 Jun 26, 2017 * (Callum Howard) reported a problem with
4028 :Lexpore not removing the Lexplore window
4029 after a change-directory
4030 Aug 30, 2017 * (Ingo Karkat) one cannot switch to the
4031 previously edited file (e.g. with CTRL-^)
4032 after editing a file:// URL. Patch to
4033 have a "keepalt" included.
4034 Oct 17, 2017 * (Adam Faryna) reported that gn (|netrw-gn|)
4035 did not work on directories in the current
4036 tree
4037 v157: Apr 20, 2016 * (Nicola) had set up a "nmap <expr> ..." with
4038 a function that returned a 0 while silently
4039 invoking a shell command. The shell command
4040 activated a ShellCmdPost event which in turn
4041 called s:LocalBrowseRefresh(). That looks
4042 over all netrw buffers for changes needing
4043 refreshes. However, inside a |:map-<expr>|,
4044 tab and window changes are disallowed. Fixed.
4045 (affects netrw's s:LocalBrowseRefresh())
K.Takata71d0ba02024-01-10 03:21:05 +09004046 * g:netrw_localrmdir not used any more, but
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01004047 the relevant patch that causes |delete()| to
4048 take over was #1107 (not #1109).
4049 * |expand()| is now used on |g:netrw_home|;
4050 consequently, g:netrw_home may now use
4051 environment variables
4052 * s:NetrwLeftmouse and s:NetrwCLeftmouse will
4053 return without doing anything if invoked
4054 when inside a non-netrw window
4055 Jun 15, 2016 * gx now calls netrw#GX() which returns
4056 the word under the cursor. The new
4057 wrinkle: if one is in a netrw buffer,
4058 then netrw's s:NetrwGetWord().
4059 Jun 22, 2016 * Netrw was executing all its associated
4060 Filetype commands silently; I'm going
4061 to try doing that "noisily" and see if
4062 folks have a problem with that.
4063 Aug 12, 2016 * Changed order of tool selection for
4064 handling http://... viewing.
4065 (Nikolay Aleksandrovich Pavlov)
4066 Aug 21, 2016 * Included hiding/showing/all for tree
4067 listings
4068 * Fixed refresh (^L) for tree listings
Bram Moolenaaraa3b15d2016-04-21 08:53:19 +02004069 v156: Feb 18, 2016 * Changed =~ to =~# where appropriate
4070 Feb 23, 2016 * s:ComposePath(base,subdir) now uses
4071 fnameescape() on the base portion
4072 Mar 01, 2016 * (gt_macki) reported where :Explore would
4073 make file unlisted. Fixed (tst943)
4074 Apr 04, 2016 * (reported by John Little) netrw normally
4075 suppresses browser messages, but sometimes
4076 those "messages" are what is wanted.
4077 See |g:netrw_suppress_gx_mesg|
4078 Apr 06, 2016 * (reported by Carlos Pita) deleting a remote
4079 file was giving an error message. Fixed.
4080 Apr 08, 2016 * (Charles Cooper) had a problem with an
4081 undefined b:netrw_curdir. He also provided
4082 a fix.
4083 Apr 20, 2016 * Changed s:NetrwGetBuffer(); now uses
4084 dictionaries. Also fixed the "No Name"
4085 buffer problem.
Bram Moolenaare0fa3742016-02-20 15:47:01 +01004086 v155: Oct 29, 2015 * (Timur Fayzrakhmanov) reported that netrw's
4087 mapping of ctrl-l was not allowing refresh of
4088 other windows when it was done in a netrw
4089 window.
4090 Nov 05, 2015 * Improved s:TreeSqueezeDir() to use search()
4091 instead of a loop
4092 * NetrwBrowse() will return line to
4093 w:netrw_bannercnt if cursor ended up in
4094 banner
4095 Nov 16, 2015 * Added a <Plug>NetrwTreeSqueeze (|netrw-s-cr|)
4096 Nov 17, 2015 * Commented out imaps -- perhaps someone can
4097 tell me how they're useful and should be
4098 retained?
4099 Nov 20, 2015 * Added |netrw-ma| and |netrw-mA| support
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01004100 Nov 20, 2015 * gx (|netrw-gx|) on a URL downloaded the
Bram Moolenaare0fa3742016-02-20 15:47:01 +01004101 file in addition to simply bringing up the
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01004102 URL in a browser. Fixed.
Bram Moolenaare0fa3742016-02-20 15:47:01 +01004103 Nov 23, 2015 * Added |g:netrw_sizestyle| support
4104 Nov 27, 2015 * Inserted a lot of <c-u>s into various netrw
4105 maps.
4106 Jan 05, 2016 * |netrw-qL| implemented to mark files based
4107 upon |location-list|s; similar to |netrw-qF|.
4108 Jan 19, 2016 * using - call delete(directoryname,"d") -
4109 instead of using g:netrw_localrmdir if
4110 v7.4 + patch#1107 is available
4111 Jan 28, 2016 * changed to using |winsaveview()| and
4112 |winrestview()|
4113 Jan 28, 2016 * s:NetrwTreePath() now does a save and
4114 restore of view
4115 Feb 08, 2016 * Fixed a tree-listing problem with remote
4116 directories
Bram Moolenaara0f849e2015-10-30 14:37:44 +01004117 v154: Feb 26, 2015 * (Yuri Kanivetsky) reported a situation where
4118 a file was not treated properly as a file
4119 due to g:netrw_keepdir == 1
4120 Mar 25, 2015 * (requested by Ben Friz) one may now sort by
4121 extension
4122 Mar 28, 2015 * (requested by Matt Brooks) netrw has a lot
4123 of buffer-local mappings; however, some
4124 plugins (such as vim-surround) set up
4125 conflicting mappings that cause vim to wait.
4126 The "<nowait>" modifier has been included
4127 with most of netrw's mappings to avoid that
4128 delay.
zeertzjq8feed3a2024-09-29 10:37:47 +02004129 Jun 26, 2015 * |netrw-gn| mapping implemented
Bram Moolenaara0f849e2015-10-30 14:37:44 +01004130 * :Ntree NotADir resulted in having
4131 the tree listing expand in the error messages
4132 window. Fixed.
4133 Jun 29, 2015 * Attempting to delete a file remotely caused
4134 an error with "keepsol" mentioned; fixed.
4135 Jul 08, 2015 * Several changes to keep the |:jumps| table
4136 correct when working with
4137 |g:netrw_fastbrowse| set to 2
4138 * wide listing with accented characters fixed
4139 (using %-S instead of %-s with a |printf()|
4140 Jul 13, 2015 * (Daniel Hahler) CheckIfKde() could be true
4141 but kfmclient not installed. Changed order
4142 in netrw#BrowseX(): checks if kde and
4143 kfmclient, then will use xdg-open on a unix
4144 system (if xdg-open is executable)
4145 Aug 11, 2015 * (McDonnell) tree listing mode wouldn't
4146 select a file in a open subdirectory.
4147 * (McDonnell) when multiple subdirectories
4148 were concurrently open in tree listing
4149 mode, a ctrl-L wouldn't refresh properly.
4150 * The netrw:target menu showed duplicate
4151 entries
4152 Oct 13, 2015 * (mattn) provided an exception to handle
4153 windows with shellslash set but no shell
4154 Oct 23, 2015 * if g:netrw_usetab and <c-tab> now used
4155 to control whether NetrwShrink is used
4156 (see |netrw-c-tab|)
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01004157 v153: May 13, 2014 * added another |g:netrw_ffkeep| usage {{{2
4158 May 14, 2014 * changed s:PerformListing() so that it
4159 always sets ft=netrw for netrw buffers
4160 (ie. even when syntax highlighting is
4161 off, not available, etc)
4162 May 16, 2014 * introduced the |netrw-ctrl-r| functionality
4163 May 17, 2014 * introduced the |netrw-:NetrwMB| functionality
4164 * mb and mB (|netrw-mb|, |netrw-mB|) will
4165 add/remove marked files from bookmark list
4166 May 20, 2014 * (Enno Nagel) reported that :Lex <dirname>
4167 wasn't working. Fixed.
4168 May 26, 2014 * restored test to prevent leftmouse window
4169 resizing from causing refresh.
4170 (see s:NetrwLeftmouse())
4171 * fixed problem where a refresh caused cursor
4172 to go just under the banner instead of
4173 staying put
4174 May 28, 2014 * (László Bimba) provided a patch for opening
4175 the |:Lexplore| window 100% high, optionally
4176 on the right, and will work with remote
4177 files.
4178 May 29, 2014 * implemented :NetrwC (see |netrw-:NetrwC|)
4179 Jun 01, 2014 * Removed some "silent"s from commands used
4180 to implemented scp://... and pscp://...
4181 directory listing. Permits request for
4182 password to appear.
4183 Jun 05, 2014 * (Enno Nagel) reported that user maps "/"
4184 caused problems with "b" and "w", which
4185 are mapped (for wide listings only) to
4186 skip over files rather than just words.
4187 Jun 10, 2014 * |g:netrw_gx| introduced to allow users to
4188 override default "<cfile>" with the gx
4189 (|netrw-gx|) map
4190 Jun 11, 2014 * gx (|netrw-gx|), with |'autowrite'| set,
4191 will write modified files. s:NetrwBrowseX()
4192 will now save, turn off, and restore the
4193 |'autowrite'| setting.
4194 Jun 13, 2014 * added visual map for gx use
4195 Jun 15, 2014 * (Enno Nagel) reported that with having hls
4196 set and wide listing style in use, that the
4197 b and w maps caused unwanted highlighting.
4198 Jul 05, 2014 * |netrw-mv| and |netrw-mX| commands included
4199 Jul 09, 2014 * |g:netrw_keepj| included, allowing optional
4200 keepj
4201 Jul 09, 2014 * fixing bugs due to previous update
4202 Jul 21, 2014 * (Bruno Sutic) provided an updated
4203 netrw_gitignore.vim
4204 Jul 30, 2014 * (Yavuz Yetim) reported that editing two
4205 remote files of the same name caused the
4206 second instance to have a "temporary"
4207 name. Fixed: now they use the same buffer.
4208 Sep 18, 2014 * (Yasuhiro Matsumoto) provided a patch which
4209 allows scp and windows local paths to work.
4210 Oct 07, 2014 * gx (see |netrw-gx|) when atop a directory,
4211 will now do |gf| instead
4212 Nov 06, 2014 * For cygwin: cygstart will be available for
4213 netrw#BrowseX() to use if its executable.
4214 Nov 07, 2014 * Began support for file://... urls. Will use
4215 |g:netrw_file_cmd| (typically elinks or links)
4216 Dec 02, 2014 * began work on having mc (|netrw-mc|) copy
4217 directories. Works for linux machines,
4218 cygwin+vim, but not for windows+gvim.
4219 Dec 02, 2014 * in tree mode, netrw was not opening
4220 directories via symbolic links.
4221 Dec 02, 2014 * added resolved link information to
4222 thin and tree modes
4223 Dec 30, 2014 * (issue#231) |:ls| was not showing
4224 remote-file buffers reliably. Fixed.
4225 v152: Apr 08, 2014 * uses the |'noswapfile'| option (requires {{{2
Bram Moolenaar13600302014-05-22 18:26:40 +02004226 vim 7.4 with patch 213)
4227 * (Enno Nagel) turn |'rnu'| off in netrw
4228 buffers.
4229 * (Quinn Strahl) suggested that netrw
4230 allow regular window splitting to occur,
4231 thereby allowing |'equalalways'| to take
4232 effect.
4233 * (qingtian zhao) normally, netrw will
4234 save and restore the |'fileformat'|;
4235 however, sometimes that isn't wanted
4236 Apr 14, 2014 * whenever netrw marks a buffer as ro,
4237 it will also mark it as nomod.
4238 Apr 16, 2014 * sftp protocol now supported by
4239 netrw#Obtain(); this means that one
4240 may use "mc" to copy a remote file
4241 to a local file using sftp, and that
4242 the |netrw-O| command can obtain remote
4243 files via sftp.
4244 * added [count]C support (see |netrw-C|)
4245 Apr 18, 2014 * when |g:netrw_chgwin| is one more than
4246 the last window, then vertically split
4247 the last window and use it as the
4248 chgwin window.
4249 May 09, 2014 * SavePosn was "saving filename under cursor"
4250 from a non-netrw window when using :Rex.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01004251 v151: Jan 22, 2014 * extended :Rexplore to return to buffer {{{2
Bram Moolenaara6878372014-03-22 21:02:50 +01004252 prior to Explore or editing a directory
4253 * (Ken Takata) netrw gave error when
4254 clipboard was disabled. Sol'n: Placed
4255 several if has("clipboard") tests in.
4256 * Fixed ftp://X@Y@Z// problem; X@Y now
4257 part of user id, and only Z is part of
4258 hostname.
4259 * (A Loumiotis) reported that completion
4260 using a directory name containing spaces
4261 did not work. Fixed with a retry in
4262 netrw#Explore() which removes the
4263 backslashes vim inserted.
4264 Feb 26, 2014 * :Rexplore now records the current file
4265 using w:netrw_rexfile when returning via
4266 |:Rexplore|
4267 Mar 08, 2014 * (David Kotchan) provided some patches
4268 allowing netrw to work properly with
4269 windows shares.
4270 * Multiple one-liner help messages available
4271 by pressing <cr> while atop the "Quick
4272 Help" line
4273 * worked on ShellCmdPost, FocusGained event
4274 handling.
4275 * |:Lexplore| path: will be used to update
4276 a left-side netrw browsing directory.
Bram Moolenaare0fa3742016-02-20 15:47:01 +01004277 Mar 12, 2014 * |netrw-s-cr|: use <s-cr> to close
Bram Moolenaara6878372014-03-22 21:02:50 +01004278 tree directory implemented
4279 Mar 13, 2014 * (Tony Mechylynck) reported that using
4280 the browser with ftp on a directory,
4281 and selecting a gzipped txt file, that
4282 an E19 occurred (which was issued by
4283 gzip.vim). Fixed.
4284 Mar 14, 2014 * Implemented :MF and :MT (see |netrw-:MF|
4285 and |netrw-:MT|, respectively)
4286 Mar 17, 2014 * |:Ntree| [dir] wasn't working properly; fixed
4287 Mar 18, 2014 * Changed all uses of set to setl
4288 Mar 18, 2014 * Commented the netrw_btkeep line in
4289 s:NetrwOptionSave(); the effect is that
4290 netrw buffers will remain as |'bt'|=nofile.
4291 This should prevent swapfiles being created
4292 for netrw buffers.
4293 Mar 20, 2014 * Changed all uses of lcd to use s:NetrwLcd()
4294 instead. Consistent error handling results
4295 and it also handles Window's shares
4296 * Fixed |netrw-d| command when applied with ftp
4297 * https: support included for netrw#NetRead()
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01004298 v150: Jul 12, 2013 * removed a "keepalt" to allow ":e #" to {{{2
Bram Moolenaar8d043172014-01-23 14:24:41 +01004299 return to the netrw directory listing
4300 Jul 13, 2013 * (Jonas Diemer) suggested changing
4301 a <cWORD> to <cfile>.
4302 Jul 21, 2013 * (Yuri Kanivetsky) reported that netrw's
4303 use of mkdir did not produce directories
Bram Moolenaara6878372014-03-22 21:02:50 +01004304 following the user's umask.
Bram Moolenaar8d043172014-01-23 14:24:41 +01004305 Aug 27, 2013 * introduced |g:netrw_altfile| option
4306 Sep 05, 2013 * s:Strlen() now uses |strdisplaywidth()|
4307 when available, by default
4308 Sep 12, 2013 * (Selyano Baldo) reported that netrw wasn't
4309 opening some directories properly from the
4310 command line.
4311 Nov 09, 2013 * |:Lexplore| introduced
4312 * (Ondrej Platek) reported an issue with
4313 netrw's trees (P15). Fixed.
4314 * (Jorge Solis) reported that "t" in
4315 tree mode caused netrw to forget its
4316 line position.
4317 Dec 05, 2013 * Added <s-leftmouse> file marking
4318 (see |netrw-mf|)
4319 Dec 05, 2013 * (Yasuhiro Matsumoto) Explore should use
4320 strlen() instead s:Strlen() when handling
4321 multibyte chars with strpart()
4322 (ie. strpart() is byte oriented, not
4323 display-width oriented).
4324 Dec 09, 2013 * (Ken Takata) Provided a patch; File sizes
4325 and a portion of timestamps were wrongly
4326 highlighted with the directory color when
4327 setting `:let g:netrw_liststyle=1` on Windows.
4328 * (Paul Domaskis) noted that sometimes
4329 cursorline was activating in non-netrw
4330 windows. All but one setting of cursorline
4331 was done via setl; there was one that was
4332 overlooked. Fixed.
4333 Dec 24, 2013 * (esquifit) asked that netrw allow the
4334 /cygdrive prefix be a user-alterable
4335 parameter.
4336 Jan 02, 2014 * Fixed a problem with netrw-based ballon
4337 evaluation (ie. netrw#NetrwBaloonHelp()
4338 not having been loaded error messages)
4339 Jan 03, 2014 * Fixed a problem with tree listings
4340 * New command installed: |:Ntree|
4341 Jan 06, 2014 * (Ivan Brennan) reported a problem with
4342 |netrw-P|. Fixed.
4343 Jan 06, 2014 * Fixed a problem with |netrw-P| when the
4344 modified file was to be abandoned.
4345 Jan 15, 2014 * (Matteo Cavalleri) reported that when the
4346 banner is suppressed and tree listing is
4347 used, a blank line was left at the top of
4348 the display. Fixed.
4349 Jan 20, 2014 * (Gideon Go) reported that, in tree listing
4350 style, with a previous window open, that
4351 the wrong directory was being used to open
4352 a file. Fixed. (P21)
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01004353 v149: Apr 18, 2013 * in wide listing format, now have maps for {{{2
Bram Moolenaare6ae6222013-05-21 21:01:10 +02004354 w and b to move to next/previous file
4355 Apr 26, 2013 * one may now copy files in the same
4356 directory; netrw will issue requests for
4357 what names the files should be copied under
4358 Apr 29, 2013 * Trying Benzinger's problem again. Seems
4359 that commenting out the BufEnter and
4360 installing VimEnter (only) works. Weird
4361 problem! (tree listing, vim -O Dir1 Dir2)
4362 May 01, 2013 * :Explore ftp://... wasn't working. Fixed.
4363 May 02, 2013 * introduced |g:netrw_bannerbackslash| as
4364 requested by Paul Domaskis.
Bram Moolenaar8d043172014-01-23 14:24:41 +01004365 Jul 03, 2013 * Explore now avoids splitting when a buffer
4366 will be hidden.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01004367 v148: Apr 16, 2013 * changed Netrw's Style menu to allow direct {{{2
Bram Moolenaarff034192013-04-24 18:51:19 +02004368 choice of listing style, hiding style, and
4369 sorting style
Bram Moolenaar071d4272004-06-13 20:20:40 +00004370
4371==============================================================================
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100437213. Todo *netrw-todo* {{{1
4373
437407/29/09 : banner :|g:netrw_banner| can be used to suppress the
4375 suppression banner. This feature is new and experimental,
4376 so its in the process of being debugged.
437709/04/09 : "gp" : See if it can be made to work for remote systems.
4378 : See if it can be made to work with marked files.
4379
4380==============================================================================
438114. Credits *netrw-credits* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +00004382
4383 Vim editor by Bram Moolenaar (Thanks, Bram!)
4384 dav support by C Campbell
4385 fetch support by Bram Moolenaar and C Campbell
Bram Moolenaar29634562020-01-09 21:46:04 +01004386 ftp support by C Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
Bram Moolenaar071d4272004-06-13 20:20:40 +00004387 http support by Bram Moolenaar <bram@moolenaar.net>
4388 rcp
4389 rsync support by C Campbell (suggested by Erik Warendorph)
4390 scp support by raf <raf@comdyn.com.au>
4391 sftp support by C Campbell
4392
4393 inputsecret(), BufReadCmd, BufWriteCmd contributed by C Campbell
4394
4395 Jérôme Augé -- also using new buffer method with ftp+.netrc
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00004396 Bram Moolenaar -- obviously vim itself, :e and v:cmdarg use,
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +00004397 fetch,...
Bram Moolenaar071d4272004-06-13 20:20:40 +00004398 Yasuhiro Matsumoto -- pointing out undo+0r problem and a solution
4399 Erik Warendorph -- for several suggestions (g:netrw_..._cmd
4400 variables, rsync etc)
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00004401 Doug Claar -- modifications to test for success with ftp
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +00004402 operation
Bram Moolenaar071d4272004-06-13 20:20:40 +00004403
4404==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00004405Modelines: {{{1
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02004406vim:tw=78:ts=8:ft=help:noet:norl:fdm=marker