blob: 6b4c5e06d4a64151c43f338ad4295d7821148d55 [file] [log] [blame]
S. B. Tama95d6a32024-11-02 15:48:54 +01001*pi_netrw.txt* For Vim version 9.1. Last change: 2024 Nov 02
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 ------------------------------------------------
Bram Moolenaar29634562020-01-09 21:46:04 +01006Author: Charles E. Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01007 (remove NOSPAM from Campbell's email first)
8
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01009Copyright: Copyright (C) 2017 Charles E Campbell *netrw-copyright*
Bram Moolenaar5b435d62012-04-05 17:33:26 +020010 The VIM LICENSE applies to the files in this package, including
Konfekt3d7e5672024-10-27 22:16:49 +010011 netrw.vim, pi_netrw.txt, netrwSettings.vim, and
Bram Moolenaar5b435d62012-04-05 17:33:26 +020012 syntax/netrw.vim. Like anything else that's free, netrw.vim and its
13 associated files are provided *as is* and comes with no warranty of
14 any kind, either expressed or implied. No guarantees of
15 merchantability. No guarantees of suitability for any purpose. By
16 using this plugin, you agree that in no event will the copyright
17 holder be liable for any damages resulting from the use of this
Christian Brabandtc5e24ee2024-07-13 18:19:03 +020018 software. Use at your own risk! For bug reports, see |bugs|.
Bram Moolenaar071d4272004-06-13 20:20:40 +000019
Bram Moolenaar8feef4f2015-01-07 16:57:10 +010020 *netrw*
Bram Moolenaar00a927d2010-05-14 23:24:24 +020021 *dav* *ftp* *netrw-file* *rcp* *scp*
22 *davs* *http* *netrw.vim* *rsync* *sftp*
Bram Moolenaar8feef4f2015-01-07 16:57:10 +010023 *fetch* *network*
Bram Moolenaar071d4272004-06-13 20:20:40 +000024
25==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +0000261. Contents *netrw-contents* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000027
Bram Moolenaarff034192013-04-24 18:51:19 +0200281. Contents..............................................|netrw-contents|
292. Starting With Netrw...................................|netrw-start|
303. Netrw Reference.......................................|netrw-ref|
31 EXTERNAL APPLICATIONS AND PROTOCOLS.................|netrw-externapp|
32 READING.............................................|netrw-read|
33 WRITING.............................................|netrw-write|
34 SOURCING............................................|netrw-source|
35 DIRECTORY LISTING...................................|netrw-dirlist|
36 CHANGING THE USERID AND PASSWORD....................|netrw-chgup|
37 VARIABLES AND SETTINGS..............................|netrw-variables|
38 PATHS...............................................|netrw-path|
394. Network-Oriented File Transfer........................|netrw-xfer|
40 NETRC...............................................|netrw-netrc|
41 PASSWORD............................................|netrw-passwd|
425. Activation............................................|netrw-activate|
436. Transparent Remote File Editing.......................|netrw-transparent|
447. Ex Commands...........................................|netrw-ex|
458. Variables and Options.................................|netrw-variables|
469. Browsing..............................................|netrw-browse|
47 Introduction To Browsing............................|netrw-intro-browse|
48 Quick Reference: Maps...............................|netrw-browse-maps|
49 Quick Reference: Commands...........................|netrw-browse-cmds|
Bram Moolenaare0fa3742016-02-20 15:47:01 +010050 Banner Display......................................|netrw-I|
Bram Moolenaarff034192013-04-24 18:51:19 +020051 Bookmarking A Directory.............................|netrw-mb|
52 Browsing............................................|netrw-cr|
Bram Moolenaare0fa3742016-02-20 15:47:01 +010053 Squeezing the Current Tree-Listing Directory........|netrw-s-cr|
Bram Moolenaarff034192013-04-24 18:51:19 +020054 Browsing With A Horizontally Split Window...........|netrw-o|
55 Browsing With A New Tab.............................|netrw-t|
56 Browsing With A Vertically Split Window.............|netrw-v|
Ernesto Elsäßer26113e52024-11-01 23:17:03 +010057 Change Listing Style (thin wide long tree)..........|netrw-i|
Bram Moolenaarff034192013-04-24 18:51:19 +020058 Changing To A Bookmarked Directory..................|netrw-gb|
Ernesto Elsäßer26113e52024-11-01 23:17:03 +010059 Quick hide/unhide of dot-files......................|netrw-gh|
60 Changing local-only File Permission.................|netrw-gp|
Bram Moolenaarff034192013-04-24 18:51:19 +020061 Changing To A Predecessor Directory.................|netrw-u|
62 Changing To A Successor Directory...................|netrw-U|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +010063 Customizing Browsing With A Special Handler.........|netrw-x|
Bram Moolenaarff034192013-04-24 18:51:19 +020064 Deleting Bookmarks..................................|netrw-mB|
65 Deleting Files Or Directories.......................|netrw-D|
66 Directory Exploring Commands........................|netrw-explore|
67 Exploring With Stars and Patterns...................|netrw-star|
68 Displaying Information About File...................|netrw-qf|
69 Edit File Or Directory Hiding List..................|netrw-ctrl-h|
70 Editing The Sorting Sequence........................|netrw-S|
71 Forcing treatment as a file or directory............|netrw-gd| |netrw-gf|
72 Going Up............................................|netrw--|
73 Hiding Files Or Directories.........................|netrw-a|
74 Improving Browsing..................................|netrw-ssh-hack|
75 Listing Bookmarks And History.......................|netrw-qb|
76 Making A New Directory..............................|netrw-d|
Bram Moolenaarb0d45e72017-11-05 18:19:24 +010077 Making The Browsing Directory The Current Directory.|netrw-cd|
Bram Moolenaarff034192013-04-24 18:51:19 +020078 Marking Files.......................................|netrw-mf|
79 Unmarking Files.....................................|netrw-mF|
Bram Moolenaare0fa3742016-02-20 15:47:01 +010080 Marking Files By Location List......................|netrw-qL|
Bram Moolenaarff034192013-04-24 18:51:19 +020081 Marking Files By QuickFix List......................|netrw-qF|
82 Marking Files By Regular Expression.................|netrw-mr|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +010083 Marked Files: Arbitrary Shell Command...............|netrw-mx|
84 Marked Files: Arbitrary Shell Command, En Bloc......|netrw-mX|
85 Marked Files: Arbitrary Vim Command.................|netrw-mv|
Bram Moolenaare0fa3742016-02-20 15:47:01 +010086 Marked Files: Argument List.........................|netrw-ma| |netrw-mA|
Bram Moolenaarb0d45e72017-11-05 18:19:24 +010087 Marked Files: Buffer List...........................|netrw-cb| |netrw-cB|
Bram Moolenaarff034192013-04-24 18:51:19 +020088 Marked Files: Compression And Decompression.........|netrw-mz|
89 Marked Files: Copying...............................|netrw-mc|
90 Marked Files: Diff..................................|netrw-md|
91 Marked Files: Editing...............................|netrw-me|
92 Marked Files: Grep..................................|netrw-mg|
93 Marked Files: Hiding and Unhiding by Suffix.........|netrw-mh|
94 Marked Files: Moving................................|netrw-mm|
95 Marked Files: Printing..............................|netrw-mp|
96 Marked Files: Sourcing..............................|netrw-ms|
97 Marked Files: Setting the Target Directory..........|netrw-mt|
98 Marked Files: Tagging...............................|netrw-mT|
99 Marked Files: Target Directory Using Bookmarks......|netrw-Tb|
100 Marked Files: Target Directory Using History........|netrw-Th|
101 Marked Files: Unmarking.............................|netrw-mu|
102 Netrw Browser Variables.............................|netrw-browser-var|
103 Netrw Browsing And Option Incompatibilities.........|netrw-incompatible|
104 Netrw Settings Window...............................|netrw-settings-window|
105 Obtaining A File....................................|netrw-O|
106 Preview Window......................................|netrw-p|
107 Previous Window.....................................|netrw-P|
108 Refreshing The Listing..............................|netrw-ctrl-l|
109 Reversing Sorting Order.............................|netrw-r|
110 Renaming Files Or Directories.......................|netrw-R|
111 Selecting Sorting Style.............................|netrw-s|
112 Setting Editing Window..............................|netrw-C|
11310. Problems and Fixes....................................|netrw-problems|
11411. Debugging Netrw Itself................................|netrw-debug|
11512. History...............................................|netrw-history|
11613. Todo..................................................|netrw-todo|
11714. Credits...............................................|netrw-credits|
Bram Moolenaar071d4272004-06-13 20:20:40 +0000118
Bram Moolenaar071d4272004-06-13 20:20:40 +0000119==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00001202. Starting With Netrw *netrw-start* {{{1
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000121
Bram Moolenaar446cb832008-06-24 21:56:24 +0000122Netrw makes reading files, writing files, browsing over a network, and
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100123local browsing easy! First, make sure that you have plugins enabled, so
Bram Moolenaar446cb832008-06-24 21:56:24 +0000124you'll need to have at least the following in your <.vimrc>:
125(or see |netrw-activate|) >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000126
Bram Moolenaar9964e462007-05-05 17:54:07 +0000127 set nocp " 'compatible' is not set
128 filetype plugin on " plugins are enabled
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000129<
130(see |'cp'| and |:filetype-plugin-on|)
131
132Netrw supports "transparent" editing of files on other machines using urls
133(see |netrw-transparent|). As an example of this, let's assume you have an
Bram Moolenaar446cb832008-06-24 21:56:24 +0000134account on some other machine; if you can use scp, try: >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000135
136 vim scp://hostname/path/to/file
137<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000138Want to make ssh/scp easier to use? Check out |netrw-ssh-hack|!
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000139
Bram Moolenaar446cb832008-06-24 21:56:24 +0000140So, what if you have ftp, not ssh/scp? That's easy, too; try >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000141
142 vim ftp://hostname/path/to/file
143<
144Want to make ftp simpler to use? See if your ftp supports a file called
145<.netrc> -- typically it goes in your home directory, has read/write
146permissions for only the user to read (ie. not group, world, other, etc),
147and has lines resembling >
148
149 machine HOSTNAME login USERID password "PASSWORD"
150 machine HOSTNAME login USERID password "PASSWORD"
151 ...
Bram Moolenaar9964e462007-05-05 17:54:07 +0000152 default login USERID password "PASSWORD"
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000153<
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200154Windows' ftp doesn't support .netrc; however, one may have in one's .vimrc: >
155
Bram Moolenaare6ae6222013-05-21 21:01:10 +0200156 let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\MyUserName\MACHINE'
Bram Moolenaar97d62492012-11-15 21:28:22 +0100157<
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100158Netrw will substitute the host's machine name for "MACHINE" from the URL it is
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200159attempting to open, and so one may specify >
160 userid
161 password
Bram Moolenaare6ae6222013-05-21 21:01:10 +0200162for each site in a separate file: c:\Users\MyUserName\MachineName.
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200163
Bram Moolenaar446cb832008-06-24 21:56:24 +0000164Now about browsing -- when you just want to look around before editing a
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000165file. For browsing on your current host, just "edit" a directory: >
166
167 vim .
168 vim /home/userid/path
169<
170For browsing on a remote host, "edit" a directory (but make sure that
171the directory name is followed by a "/"): >
172
173 vim scp://hostname/
174 vim ftp://hostname/path/to/dir/
175<
176See |netrw-browse| for more!
177
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100178There are more protocols supported by netrw than just scp and ftp, too: see the
179next section, |netrw-externapp|, on how to use these external applications with
180netrw and vim.
181
Bram Moolenaar13600302014-05-22 18:26:40 +0200182PREVENTING LOADING *netrw-noload*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000183
184If you want to use plugins, but for some reason don't wish to use netrw, then
185you need to avoid loading both the plugin and the autoload portions of netrw.
186You may do so by placing the following two lines in your <.vimrc>: >
187
188 :let g:loaded_netrw = 1
189 :let g:loaded_netrwPlugin = 1
190<
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000191
192==============================================================================
Bram Moolenaar13600302014-05-22 18:26:40 +02001933. Netrw Reference *netrw-ref* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000194
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100195 Netrw supports several protocols in addition to scp and ftp as mentioned
Bram Moolenaar446cb832008-06-24 21:56:24 +0000196 in |netrw-start|. These include dav, fetch, http,... well, just look
197 at the list in |netrw-externapp|. Each protocol is associated with a
198 variable which holds the default command supporting that protocol.
199
200EXTERNAL APPLICATIONS AND PROTOCOLS *netrw-externapp* {{{2
Bram Moolenaar071d4272004-06-13 20:20:40 +0000201
Bram Moolenaar8d043172014-01-23 14:24:41 +0100202 Protocol Variable Default Value
203 -------- ---------------- -------------
204 dav: *g:netrw_dav_cmd* = "cadaver" if cadaver is executable
205 dav: g:netrw_dav_cmd = "curl -o" elseif curl is available
206 fetch: *g:netrw_fetch_cmd* = "fetch -o" if fetch is available
207 ftp: *g:netrw_ftp_cmd* = "ftp"
208 http: *g:netrw_http_cmd* = "elinks" if elinks is available
209 http: g:netrw_http_cmd = "links" elseif links is available
210 http: g:netrw_http_cmd = "curl" elseif curl is available
211 http: g:netrw_http_cmd = "wget" elseif wget is available
Bram Moolenaarb7398fe2023-05-14 18:50:25 +0100212 http: g:netrw_http_cmd = "fetch" elseif fetch is available
Bram Moolenaar8d043172014-01-23 14:24:41 +0100213 http: *g:netrw_http_put_cmd* = "curl -T"
214 rcp: *g:netrw_rcp_cmd* = "rcp"
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100215 rsync: *g:netrw_rsync_cmd* = "rsync" (see |g:netrw_rsync_sep|)
Bram Moolenaar8d043172014-01-23 14:24:41 +0100216 scp: *g:netrw_scp_cmd* = "scp -q"
217 sftp: *g:netrw_sftp_cmd* = "sftp"
Bram Moolenaar8feef4f2015-01-07 16:57:10 +0100218 file: *g:netrw_file_cmd* = "elinks" or "links"
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100219
220 *g:netrw_http_xcmd* : the option string for http://... protocols are
221 specified via this variable and may be independently overridden. By
222 default, the option arguments for the http-handling commands are: >
223
224 elinks : "-source >"
Bram Moolenaar97d62492012-11-15 21:28:22 +0100225 links : "-dump >"
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100226 curl : "-L -o"
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100227 wget : "-q -O"
228 fetch : "-o"
229<
230 For example, if your system has elinks, and you'd rather see the
231 page using an attempt at rendering the text, you may wish to have >
232 let g:netrw_http_xcmd= "-dump >"
233< in your .vimrc.
234
Bram Moolenaar8d043172014-01-23 14:24:41 +0100235 g:netrw_http_put_cmd: this option specifies both the executable and
236 any needed options. This command does a PUT operation to the url.
237
Bram Moolenaar071d4272004-06-13 20:20:40 +0000238
Bram Moolenaar446cb832008-06-24 21:56:24 +0000239READING *netrw-read* *netrw-nread* {{{2
240
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100241 Generally, one may just use the URL notation with a normal editing
Bram Moolenaar446cb832008-06-24 21:56:24 +0000242 command, such as >
243
244 :e ftp://[user@]machine/path
245<
246 Netrw also provides the Nread command:
247
Bram Moolenaar071d4272004-06-13 20:20:40 +0000248 :Nread ? give help
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000249 :Nread "machine:path" uses rcp
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000250 :Nread "machine path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000251 :Nread "machine id password path" uses ftp
252 :Nread "dav://machine[:port]/path" uses cadaver
253 :Nread "fetch://[user@]machine/path" uses fetch
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000254 :Nread "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000255 :Nread "http://[user@]machine/path" uses http uses wget
256 :Nread "rcp://[user@]machine/path" uses rcp
257 :Nread "rsync://[user@]machine[:port]/path" uses rsync
258 :Nread "scp://[user@]machine[[:#]port]/path" uses scp
259 :Nread "sftp://[user@]machine/path" uses sftp
Bram Moolenaar071d4272004-06-13 20:20:40 +0000260
Bram Moolenaar446cb832008-06-24 21:56:24 +0000261WRITING *netrw-write* *netrw-nwrite* {{{2
262
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100263 One may just use the URL notation with a normal file writing
Bram Moolenaar446cb832008-06-24 21:56:24 +0000264 command, such as >
265
266 :w ftp://[user@]machine/path
267<
268 Netrw also provides the Nwrite command:
269
Bram Moolenaar433f7c82006-03-21 21:29:36 +0000270 :Nwrite ? give help
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000271 :Nwrite "machine:path" uses rcp
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000272 :Nwrite "machine path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000273 :Nwrite "machine id password path" uses ftp
274 :Nwrite "dav://machine[:port]/path" uses cadaver
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000275 :Nwrite "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000276 :Nwrite "rcp://[user@]machine/path" uses rcp
277 :Nwrite "rsync://[user@]machine[:port]/path" uses rsync
278 :Nwrite "scp://[user@]machine[[:#]port]/path" uses scp
279 :Nwrite "sftp://[user@]machine/path" uses sftp
Bram Moolenaar071d4272004-06-13 20:20:40 +0000280 http: not supported!
281
Bram Moolenaar446cb832008-06-24 21:56:24 +0000282SOURCING *netrw-source* {{{2
283
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100284 One may just use the URL notation with the normal file sourcing
Bram Moolenaar446cb832008-06-24 21:56:24 +0000285 command, such as >
286
287 :so ftp://[user@]machine/path
288<
289 Netrw also provides the Nsource command:
290
Bram Moolenaar9964e462007-05-05 17:54:07 +0000291 :Nsource ? give help
292 :Nsource "dav://machine[:port]/path" uses cadaver
293 :Nsource "fetch://[user@]machine/path" uses fetch
294 :Nsource "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc>
295 :Nsource "http://[user@]machine/path" uses http uses wget
296 :Nsource "rcp://[user@]machine/path" uses rcp
297 :Nsource "rsync://[user@]machine[:port]/path" uses rsync
298 :Nsource "scp://[user@]machine[[:#]port]/path" uses scp
299 :Nsource "sftp://[user@]machine/path" uses sftp
300
Bram Moolenaar13600302014-05-22 18:26:40 +0200301DIRECTORY LISTING *netrw-trailingslash* *netrw-dirlist* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +0000302
303 One may browse a directory to get a listing by simply attempting to
304 edit the directory: >
305
306 :e scp://[user]@hostname/path/
307 :e ftp://[user]@hostname/path/
308<
Bram Moolenaar251e1912011-06-19 05:09:16 +0200309 For remote directory listings (ie. those using scp or ftp), that
310 trailing "/" is necessary (the slash tells netrw to treat the argument
311 as a directory to browse instead of as a file to download).
Bram Moolenaar446cb832008-06-24 21:56:24 +0000312
Bram Moolenaar251e1912011-06-19 05:09:16 +0200313 The Nread command may also be used to accomplish this (again, that
314 trailing slash is necessary): >
Bram Moolenaar446cb832008-06-24 21:56:24 +0000315
Bram Moolenaar251e1912011-06-19 05:09:16 +0200316 :Nread [protocol]://[user]@hostname/path/
317<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000318 *netrw-login* *netrw-password*
319CHANGING USERID AND PASSWORD *netrw-chgup* *netrw-userpass* {{{2
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000320
Bram Moolenaar071d4272004-06-13 20:20:40 +0000321 Attempts to use ftp will prompt you for a user-id and a password.
Bram Moolenaar15146672011-10-20 22:22:38 +0200322 These will be saved in global variables |g:netrw_uid| and
323 |s:netrw_passwd|; subsequent use of ftp will re-use those two strings,
324 thereby simplifying use of ftp. However, if you need to use a
325 different user id and/or password, you'll want to call |NetUserPass()|
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000326 first. To work around the need to enter passwords, check if your ftp
327 supports a <.netrc> file in your home directory. Also see
328 |netrw-passwd| (and if you're using ssh/scp hoping to figure out how
Bram Moolenaar15146672011-10-20 22:22:38 +0200329 to not need to use passwords for scp, look at |netrw-ssh-hack|).
Bram Moolenaar071d4272004-06-13 20:20:40 +0000330
331 :NetUserPass [uid [password]] -- prompts as needed
332 :call NetUserPass() -- prompts for uid and password
333 :call NetUserPass("uid") -- prompts for password
334 :call NetUserPass("uid","password") -- sets global uid and password
335
Bram Moolenaare6ae6222013-05-21 21:01:10 +0200336(Related topics: |ftp| |netrw-userpass| |netrw-start|)
337
Bram Moolenaar446cb832008-06-24 21:56:24 +0000338NETRW VARIABLES AND SETTINGS *netrw-variables* {{{2
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200339 (Also see:
340 |netrw-browser-var| : netrw browser option variables
341 |netrw-protocol| : file transfer protocol option variables
342 |netrw-settings| : additional file transfer options
343 |netrw-browser-options| : these options affect browsing directories
344 )
Bram Moolenaar9964e462007-05-05 17:54:07 +0000345
Bram Moolenaar446cb832008-06-24 21:56:24 +0000346Netrw provides a lot of variables which allow you to customize netrw to your
347preferences. One way to look at them is via the command :NetrwSettings (see
348|netrw-settings|) which will display your current netrw settings. Most such
349settings are described below, in |netrw-browser-options|, and in
350|netrw-externapp|:
Bram Moolenaar9964e462007-05-05 17:54:07 +0000351
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100352 *b:netrw_lastfile* last file Network-read/written retained on a
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200353 per-buffer basis (supports plain :Nw )
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100354
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200355 *g:netrw_bufsettings* the settings that netrw buffers have
Bram Moolenaar8feef4f2015-01-07 16:57:10 +0100356 (default) noma nomod nonu nowrap ro nobl
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200357
Bram Moolenaar13600302014-05-22 18:26:40 +0200358 *g:netrw_chgwin* specifies a window number where subsequent file edits
359 will take place. (also see |netrw-C|)
360 (default) -1
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100361
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200362 *g:Netrw_funcref* specifies a function (or functions) to be called when
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200363 netrw edits a file. The file is first edited, and
364 then the function reference (|Funcref|) is called.
365 This variable may also hold a |List| of Funcrefs.
366 (default) not defined. (the capital in g:Netrw...
367 is required by its holding a function reference)
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200368>
369 Example: place in .vimrc; affects all file opening
370 fun! MyFuncRef()
371 endfun
372 let g:Netrw_funcref= function("MyFuncRef")
Bram Moolenaara0f849e2015-10-30 14:37:44 +0100373
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200374<
Bram Moolenaara0f849e2015-10-30 14:37:44 +0100375 *g:Netrw_UserMaps* specifies a function or |List| of functions which can
376 be used to set up user-specified maps and functionality.
377 See |netrw-usermaps|
378
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200379 *g:netrw_ftp* if it doesn't exist, use default ftp
380 =0 use default ftp (uid password)
381 =1 use alternate ftp method (user uid password)
382 If you're having trouble with ftp, try changing the
383 value of this variable to see if the alternate ftp
384 method works for your setup.
385
Bram Moolenaar13600302014-05-22 18:26:40 +0200386 *g:netrw_ftp_options* Chosen by default, these options are supposed to
387 turn interactive prompting off and to restrain ftp
388 from attempting auto-login upon initial connection.
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200389 However, it appears that not all ftp implementations
390 support this (ex. ncftp).
391 ="-i -n"
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000392
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100393 *g:netrw_ftpextracmd* default: doesn't exist
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200394 If this variable exists, then any string it contains
395 will be placed into the commands set to your ftp
396 client. As an example:
397 ="passive"
Bram Moolenaar9964e462007-05-05 17:54:07 +0000398
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000399 *g:netrw_ftpmode* ="binary" (default)
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200400 ="ascii"
Bram Moolenaarf6cf9872005-08-08 22:00:59 +0000401
Bram Moolenaar9964e462007-05-05 17:54:07 +0000402 *g:netrw_ignorenetrc* =0 (default for linux, cygwin)
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200403 =1 If you have a <.netrc> file but it doesn't work and
404 you want it ignored, then set this variable as
405 shown. (default for Windows + cmd.exe)
Bram Moolenaar9964e462007-05-05 17:54:07 +0000406
407 *g:netrw_menu* =0 disable netrw's menu
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200408 =1 (default) netrw's menu enabled
Bram Moolenaar9964e462007-05-05 17:54:07 +0000409
410 *g:netrw_nogx* if this variable exists, then the "gx" map will not
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200411 be available (see |netrw-gx|)
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000412
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100413 *g:netrw_uid* (ftp) user-id, retained on a per-vim-session basis
Bram Moolenaar8feef4f2015-01-07 16:57:10 +0100414 *s:netrw_passwd* (ftp) password, retained on a per-vim-session basis
Bram Moolenaar446cb832008-06-24 21:56:24 +0000415
416 *g:netrw_preview* =0 (default) preview window shown in a horizontally
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200417 split window
418 =1 preview window shown in a vertically split window.
Bram Moolenaar13600302014-05-22 18:26:40 +0200419 Also affects the "previous window" (see |netrw-P|)
420 in the same way.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +0100421 The |g:netrw_alto| variable may be used to provide
422 additional splitting control:
423 g:netrw_preview g:netrw_alto result
424 0 0 |:aboveleft|
425 0 1 |:belowright|
426 1 0 |:topleft|
427 1 1 |:botright|
428 To control sizing, see |g:netrw_winsize|
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000429
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200430 *g:netrw_scpport* = "-P" : option to use to set port for scp
431 *g:netrw_sshport* = "-p" : option to use to set port for ssh
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000432
Bram Moolenaar8feef4f2015-01-07 16:57:10 +0100433 *g:netrw_sepchr* =\0xff
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200434 =\0x01 for enc == euc-jp (and perhaps it should be for
435 others, too, please let me know)
436 Separates priority codes from filenames internally.
437 See |netrw-p12|.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100438
Bram Moolenaar446cb832008-06-24 21:56:24 +0000439 *g:netrw_silent* =0 : transfers done normally
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200440 =1 : transfers done silently
Bram Moolenaar446cb832008-06-24 21:56:24 +0000441
Bram Moolenaar1d59aa12020-09-19 18:50:13 +0200442 *g:netrw_use_errorwindow* =2: messages from netrw will use a popup window
443 Move the mouse and pause to remove the popup window.
Bram Moolenaard592deb2022-06-17 15:42:40 +0100444 (default value if popup windows are available)
Bram Moolenaar1d59aa12020-09-19 18:50:13 +0200445 =1 : messages from netrw will use a separate one
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200446 line window. This window provides reliable
Bram Moolenaar1d59aa12020-09-19 18:50:13 +0200447 delivery of messages.
Bram Moolenaard592deb2022-06-17 15:42:40 +0100448 (default value if popup windows are not available)
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200449 =0 : messages from netrw will use echoerr ;
450 messages don't always seem to show up this
451 way, but one doesn't have to quit the window.
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000452
Bram Moolenaar8feef4f2015-01-07 16:57:10 +0100453 *g:netrw_cygwin* =1 assume scp under windows is from cygwin. Also
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200454 permits network browsing to use ls with time and
455 size sorting (default if windows)
456 =0 assume Windows' scp accepts windows-style paths
457 Network browsing uses dir instead of ls
458 This option is ignored if you're using unix
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000459
460 *g:netrw_use_nt_rcp* =0 don't use the rcp of WinNT, Win2000 and WinXP
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200461 =1 use WinNT's rcp in binary mode (default)
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000462
Bram Moolenaar446cb832008-06-24 21:56:24 +0000463PATHS *netrw-path* {{{2
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000464
465Paths to files are generally user-directory relative for most protocols.
466It is possible that some protocol will make paths relative to some
467associated directory, however.
468>
469 example: vim scp://user@host/somefile
470 example: vim scp://user@host/subdir1/subdir2/somefile
471<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000472where "somefile" is in the "user"'s home directory. If you wish to get a
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000473file using root-relative paths, use the full path:
474>
475 example: vim scp://user@host//somefile
476 example: vim scp://user@host//subdir1/subdir2/somefile
477<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000478
479==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00004804. Network-Oriented File Transfer *netrw-xfer* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000481
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100482Network-oriented file transfer under Vim is implemented by a vim script
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000483(<netrw.vim>) using plugin techniques. It currently supports both reading and
484writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch,
Bram Moolenaar071d4272004-06-13 20:20:40 +0000485dav/cadaver, rsync, or sftp.
486
487http is currently supported read-only via use of wget or fetch.
488
489<netrw.vim> is a standard plugin which acts as glue between Vim and the
490various file transfer programs. It uses autocommand events (BufReadCmd,
491FileReadCmd, BufWriteCmd) to intercept reads/writes with url-like filenames. >
492
493 ex. vim ftp://hostname/path/to/file
494<
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000495The characters preceding the colon specify the protocol to use; in the
Bram Moolenaar446cb832008-06-24 21:56:24 +0000496example, it's ftp. The <netrw.vim> script then formulates a command or a
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000497series of commands (typically ftp) which it issues to an external program
498(ftp, scp, etc) which does the actual file transfer/protocol. Files are read
499from/written to a temporary file (under Unix/Linux, /tmp/...) which the
500<netrw.vim> script will clean up.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000501
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100502Now, a word about Jan Minář's "FTP User Name and Password Disclosure"; first,
503ftp is not a secure protocol. User names and passwords are transmitted "in
504the clear" over the internet; any snooper tool can pick these up; this is not
505a netrw thing, this is a ftp thing. If you're concerned about this, please
506try to use scp or sftp instead.
507
508Netrw re-uses the user id and password during the same vim session and so long
509as the remote hostname remains the same.
510
511Jan seems to be a bit confused about how netrw handles ftp; normally multiple
512commands are performed in a "ftp session", and he seems to feel that the
513uid/password should only be retained over one ftp session. However, netrw
514does every ftp operation in a separate "ftp session"; so remembering the
515uid/password for just one "ftp session" would be the same as not remembering
516the uid/password at all. IMHO this would rapidly grow tiresome as one
517browsed remote directories, for example.
518
519On the other hand, thanks go to Jan M. for pointing out the many
520vulnerabilities that netrw (and vim itself) had had in handling "crafted"
521filenames. The |shellescape()| and |fnameescape()| functions were written in
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200522response by Bram Moolenaar to handle these sort of problems, and netrw has
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100523been modified to use them. Still, my advice is, if the "filename" looks like
524a vim command that you aren't comfortable with having executed, don't open it.
525
Bram Moolenaar9964e462007-05-05 17:54:07 +0000526 *netrw-putty* *netrw-pscp* *netrw-psftp*
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000527One may modify any protocol's implementing external application by setting a
528variable (ex. scp uses the variable g:netrw_scp_cmd, which is defaulted to
Bram Moolenaar433f7c82006-03-21 21:29:36 +0000529"scp -q"). As an example, consider using PuTTY: >
Bram Moolenaar9964e462007-05-05 17:54:07 +0000530
531 let g:netrw_scp_cmd = '"c:\Program Files\PuTTY\pscp.exe" -q -batch'
532 let g:netrw_sftp_cmd= '"c:\Program Files\PuTTY\psftp.exe"'
Bram Moolenaar433f7c82006-03-21 21:29:36 +0000533<
Bram Moolenaar15146672011-10-20 22:22:38 +0200534(note: it has been reported that windows 7 with putty v0.6's "-batch" option
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100535 doesn't work, so its best to leave it off for that system)
Bram Moolenaar15146672011-10-20 22:22:38 +0200536
Bram Moolenaar9964e462007-05-05 17:54:07 +0000537See |netrw-p8| for more about putty, pscp, psftp, etc.
538
Bram Moolenaar071d4272004-06-13 20:20:40 +0000539Ftp, an old protocol, seems to be blessed by numerous implementations.
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000540Unfortunately, some implementations are noisy (ie., add junk to the end of the
541file). Thus, concerned users may decide to write a NetReadFixup() function
542that will clean up after reading with their ftp. Some Unix systems (ie.,
543FreeBSD) provide a utility called "fetch" which uses the ftp protocol but is
544not noisy and more convenient, actually, for <netrw.vim> to use.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100545Consequently, if "fetch" is available (ie. executable), it may be preferable
546to use it for ftp://... based transfers.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000547
548For rcp, scp, sftp, and http, one may use network-oriented file transfers
Bram Moolenaar83bab712005-08-01 21:58:57 +0000549transparently; ie.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000550>
551 vim rcp://[user@]machine/path
552 vim scp://[user@]machine/path
553<
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100554If your ftp supports <.netrc>, then it too can be transparently used
Bram Moolenaar071d4272004-06-13 20:20:40 +0000555if the needed triad of machine name, user id, and password are present in
556that file. Your ftp must be able to use the <.netrc> file on its own, however.
557>
558 vim ftp://[user@]machine[[:#]portnumber]/path
559<
Bram Moolenaaradc21822011-04-01 18:03:16 +0200560Windows provides an ftp (typically c:\Windows\System32\ftp.exe) which uses
561an option, -s:filename (filename can and probably should be a full path)
562which contains ftp commands which will be automatically run whenever ftp
563starts. You may use this feature to enter a user and password for one site: >
564 userid
565 password
Bram Moolenaar13600302014-05-22 18:26:40 +0200566< *netrw-windows-netrc* *netrw-windows-s*
567If |g:netrw_ftp_cmd| contains -s:[path/]MACHINE, then (on Windows machines
568only) netrw will substitute the current machine name requested for ftp
569connections for MACHINE. Hence one can have multiple machine.ftp files
570containing login and password for ftp. Example: >
Bram Moolenaaradc21822011-04-01 18:03:16 +0200571
Bram Moolenaarff034192013-04-24 18:51:19 +0200572 let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\Myself\MACHINE'
573 vim ftp://myhost.somewhere.net/
Bram Moolenaar13600302014-05-22 18:26:40 +0200574
Bram Moolenaaradc21822011-04-01 18:03:16 +0200575will use a file >
Bram Moolenaar13600302014-05-22 18:26:40 +0200576
Bram Moolenaaradc21822011-04-01 18:03:16 +0200577 C:\Users\Myself\myhost.ftp
578<
579Often, ftp will need to query the user for the userid and password.
Bram Moolenaar83bab712005-08-01 21:58:57 +0000580The latter will be done "silently"; ie. asterisks will show up instead of
Bram Moolenaar071d4272004-06-13 20:20:40 +0000581the actually-typed-in password. Netrw will retain the userid and password
582for subsequent read/writes from the most recent transfer so subsequent
583transfers (read/write) to or from that machine will take place without
584additional prompting.
585
586 *netrw-urls*
587 +=================================+============================+============+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000588 | Reading | Writing | Uses |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000589 +=================================+============================+============+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000590 | DAV: | | |
591 | dav://host/path | | cadaver |
592 | :Nread dav://host/path | :Nwrite dav://host/path | cadaver |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000593 +---------------------------------+----------------------------+------------+
Bram Moolenaar446cb832008-06-24 21:56:24 +0000594 | DAV + SSL: | | |
595 | davs://host/path | | cadaver |
596 | :Nread davs://host/path | :Nwrite davs://host/path | cadaver |
597 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000598 | FETCH: | | |
599 | fetch://[user@]host/path | | |
600 | fetch://[user@]host:http/path | Not Available | fetch |
601 | :Nread fetch://[user@]host/path| | |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000602 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000603 | FILE: | | |
604 | file:///* | file:///* | |
605 | file://localhost/* | file://localhost/* | |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000606 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000607 | FTP: (*3) | (*3) | |
608 | ftp://[user@]host/path | ftp://[user@]host/path | ftp (*2) |
609 | :Nread ftp://host/path | :Nwrite ftp://host/path | ftp+.netrc |
610 | :Nread host path | :Nwrite host path | ftp+.netrc |
611 | :Nread host uid pass path | :Nwrite host uid pass path | ftp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000612 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000613 | HTTP: wget is executable: (*4) | | |
614 | http://[user@]host/path | Not Available | wget |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000615 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000616 | HTTP: fetch is executable (*4) | | |
617 | http://[user@]host/path | Not Available | fetch |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000618 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000619 | RCP: | | |
620 | rcp://[user@]host/path | rcp://[user@]host/path | rcp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000621 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000622 | RSYNC: | | |
623 | rsync://[user@]host/path | rsync://[user@]host/path | rsync |
624 | :Nread rsync://host/path | :Nwrite rsync://host/path | rsync |
625 | :Nread rcp://host/path | :Nwrite rcp://host/path | rcp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000626 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000627 | SCP: | | |
628 | scp://[user@]host/path | scp://[user@]host/path | scp |
629 | :Nread scp://host/path | :Nwrite scp://host/path | scp (*1) |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000630 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000631 | SFTP: | | |
632 | sftp://[user@]host/path | sftp://[user@]host/path | sftp |
633 | :Nread sftp://host/path | :Nwrite sftp://host/path | sftp (*1) |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000634 +=================================+============================+============+
635
636 (*1) For an absolute path use scp://machine//path.
637
638 (*2) if <.netrc> is present, it is assumed that it will
639 work with your ftp client. Otherwise the script will
Bram Moolenaar9964e462007-05-05 17:54:07 +0000640 prompt for user-id and password.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000641
zeertzjqd086b8f2024-02-25 15:42:52 +0800642 (*3) for ftp, "machine" may be machine#port or machine:port
Bram Moolenaar071d4272004-06-13 20:20:40 +0000643 if a different port is needed than the standard ftp port
644
645 (*4) for http:..., if wget is available it will be used. Otherwise,
646 if fetch is available it will be used.
647
648Both the :Nread and the :Nwrite ex-commands can accept multiple filenames.
649
650
651NETRC *netrw-netrc*
652
Bram Moolenaar446cb832008-06-24 21:56:24 +0000653The <.netrc> file, typically located in your home directory, contains lines
654therein which map a hostname (machine name) to the user id and password you
655prefer to use with it.
656
Bram Moolenaar071d4272004-06-13 20:20:40 +0000657The typical syntax for lines in a <.netrc> file is given as shown below.
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000658Ftp under Unix usually supports <.netrc>; ftp under Windows usually doesn't.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000659>
660 machine {full machine name} login {user-id} password "{password}"
661 default login {user-id} password "{password}"
662
663Your ftp client must handle the use of <.netrc> on its own, but if the
664<.netrc> file exists, an ftp transfer will not ask for the user-id or
665password.
666
667 Note:
668 Since this file contains passwords, make very sure nobody else can
669 read this file! Most programs will refuse to use a .netrc that is
670 readable for others. Don't forget that the system administrator can
Bram Moolenaar446cb832008-06-24 21:56:24 +0000671 still read the file! Ie. for Linux/Unix: chmod 600 .netrc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000672
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200673Even though Windows' ftp clients typically do not support .netrc, netrw has
674a work-around: see |netrw-windows-s|.
675
Bram Moolenaar071d4272004-06-13 20:20:40 +0000676
677PASSWORD *netrw-passwd*
678
679The script attempts to get passwords for ftp invisibly using |inputsecret()|,
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200680a built-in Vim function. See |netrw-userpass| for how to change the password
Bram Moolenaar071d4272004-06-13 20:20:40 +0000681after one has set it.
682
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000683Unfortunately there doesn't appear to be a way for netrw to feed a password to
684scp. Thus every transfer via scp will require re-entry of the password.
Bram Moolenaar446cb832008-06-24 21:56:24 +0000685However, |netrw-ssh-hack| can help with this problem.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000686
687
688==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00006895. Activation *netrw-activate* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000690
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000691Network-oriented file transfers are available by default whenever Vim's
Bram Moolenaar446cb832008-06-24 21:56:24 +0000692|'nocompatible'| mode is enabled. Netrw's script files reside in your
693system's plugin, autoload, and syntax directories; just the
694plugin/netrwPlugin.vim script is sourced automatically whenever you bring up
695vim. The main script in autoload/netrw.vim is only loaded when you actually
696use netrw. I suggest that, at a minimum, you have at least the following in
697your <.vimrc> customization file: >
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000698
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000699 set nocp
700 if version >= 600
701 filetype plugin indent on
702 endif
703<
Bram Moolenaar8feef4f2015-01-07 16:57:10 +0100704By also including the following lines in your .vimrc, one may have netrw
705immediately activate when using [g]vim without any filenames, showing the
706current directory: >
707
708 " Augroup VimStartup:
709 augroup VimStartup
710 au!
711 au VimEnter * if expand("%") == "" | e . | endif
712 augroup END
713<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000714
715==============================================================================
Bram Moolenaar13600302014-05-22 18:26:40 +02007166. Transparent Remote File Editing *netrw-transparent* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000717
718Transparent file transfers occur whenever a regular file read or write
Bram Moolenaar446cb832008-06-24 21:56:24 +0000719(invoked via an |:autocmd| for |BufReadCmd|, |BufWriteCmd|, or |SourceCmd|
720events) is made. Thus one may read, write, or source files across networks
721just as easily as if they were local files! >
Bram Moolenaar071d4272004-06-13 20:20:40 +0000722
723 vim ftp://[user@]machine/path
724 ...
725 :wq
726
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000727See |netrw-activate| for more on how to encourage your vim to use plugins
728such as netrw.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000729
Bram Moolenaar1d59aa12020-09-19 18:50:13 +0200730For password-free use of scp:, see |netrw-ssh-hack|.
731
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000732
Bram Moolenaar071d4272004-06-13 20:20:40 +0000733==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00007347. Ex Commands *netrw-ex* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000735
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000736The usual read/write commands are supported. There are also a few
Bram Moolenaar446cb832008-06-24 21:56:24 +0000737additional commands available. Often you won't need to use Nwrite or
Bram Moolenaar9964e462007-05-05 17:54:07 +0000738Nread as shown in |netrw-transparent| (ie. simply use >
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100739 :e URL
740 :r URL
741 :w URL
Bram Moolenaar9964e462007-05-05 17:54:07 +0000742instead, as appropriate) -- see |netrw-urls|. In the explanations
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100743below, a {netfile} is a URL to a remote file.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000744
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200745 *:Nwrite* *:Nw*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000746:[range]Nw[rite] Write the specified lines to the current
Bram Moolenaar071d4272004-06-13 20:20:40 +0000747 file as specified in b:netrw_lastfile.
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200748 (related: |netrw-nwrite|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000749
Bram Moolenaar446cb832008-06-24 21:56:24 +0000750:[range]Nw[rite] {netfile} [{netfile}]...
Bram Moolenaar071d4272004-06-13 20:20:40 +0000751 Write the specified lines to the {netfile}.
752
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200753 *:Nread* *:Nr*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100754:Nr[ead] Read the lines from the file specified in b:netrw_lastfile
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200755 into the current buffer. (related: |netrw-nread|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000756
Bram Moolenaar446cb832008-06-24 21:56:24 +0000757:Nr[ead] {netfile} {netfile}...
Bram Moolenaar071d4272004-06-13 20:20:40 +0000758 Read the {netfile} after the current line.
759
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200760 *:Nsource* *:Ns*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000761:Ns[ource] {netfile}
Bram Moolenaar9964e462007-05-05 17:54:07 +0000762 Source the {netfile}.
763 To start up vim using a remote .vimrc, one may use
764 the following (all on one line) (tnx to Antoine Mechelynck) >
765 vim -u NORC -N
766 --cmd "runtime plugin/netrwPlugin.vim"
767 --cmd "source scp://HOSTNAME/.vimrc"
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200768< (related: |netrw-source|)
769
770:call NetUserPass() *NetUserPass()*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000771 If g:netrw_uid and s:netrw_passwd don't exist,
772 this function will query the user for them.
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200773 (related: |netrw-userpass|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000774
775:call NetUserPass("userid")
Bram Moolenaar446cb832008-06-24 21:56:24 +0000776 This call will set the g:netrw_uid and, if
Bram Moolenaar071d4272004-06-13 20:20:40 +0000777 the password doesn't exist, will query the user for it.
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200778 (related: |netrw-userpass|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000779
780:call NetUserPass("userid","passwd")
Bram Moolenaar446cb832008-06-24 21:56:24 +0000781 This call will set both the g:netrw_uid and s:netrw_passwd.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000782 The user-id and password are used by ftp transfers. One may
Bram Moolenaar446cb832008-06-24 21:56:24 +0000783 effectively remove the user-id and password by using empty
784 strings (ie. "").
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200785 (related: |netrw-userpass|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000786
Bram Moolenaar9964e462007-05-05 17:54:07 +0000787:NetrwSettings This command is described in |netrw-settings| -- used to
zeertzjqd086b8f2024-02-25 15:42:52 +0800788 display netrw settings and change netrw behavior.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000789
Bram Moolenaar071d4272004-06-13 20:20:40 +0000790
791==============================================================================
Bram Moolenaar13600302014-05-22 18:26:40 +02007928. Variables and Options *netrw-var* *netrw-settings* {{{1
Bram Moolenaar446cb832008-06-24 21:56:24 +0000793
Bram Moolenaar15146672011-10-20 22:22:38 +0200794(also see: |netrw-options| |netrw-variables| |netrw-protocol|
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200795 |netrw-browser-settings| |netrw-browser-options| )
Bram Moolenaar071d4272004-06-13 20:20:40 +0000796
Bram Moolenaar9964e462007-05-05 17:54:07 +0000797The <netrw.vim> script provides several variables which act as options to
Bram Moolenaar446cb832008-06-24 21:56:24 +0000798affect <netrw.vim>'s file transfer behavior. These variables typically may be
799set in the user's <.vimrc> file: (see also |netrw-settings| |netrw-protocol|)
Bram Moolenaar15146672011-10-20 22:22:38 +0200800 *netrw-options*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000801>
Bram Moolenaar9964e462007-05-05 17:54:07 +0000802 -------------
803 Netrw Options
804 -------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000805 Option Meaning
806 -------------- -----------------------------------------------
807<
Bram Moolenaar9964e462007-05-05 17:54:07 +0000808 b:netrw_col Holds current cursor position (during NetWrite)
809 g:netrw_cygwin =1 assume scp under windows is from cygwin
810 (default/windows)
811 =0 assume scp under windows accepts windows
812 style paths (default/else)
813 g:netrw_ftp =0 use default ftp (uid password)
814 g:netrw_ftpmode ="binary" (default)
815 ="ascii" (your choice)
816 g:netrw_ignorenetrc =1 (default)
817 if you have a <.netrc> file but you don't
Bram Moolenaar071d4272004-06-13 20:20:40 +0000818 want it used, then set this variable. Its
819 mere existence is enough to cause <.netrc>
820 to be ignored.
Bram Moolenaar9964e462007-05-05 17:54:07 +0000821 b:netrw_lastfile Holds latest method/machine/path.
822 b:netrw_line Holds current line number (during NetWrite)
Bram Moolenaar9964e462007-05-05 17:54:07 +0000823 g:netrw_silent =0 transfers done normally
824 =1 transfers done silently
825 g:netrw_uid Holds current user-id for ftp.
Bram Moolenaar9964e462007-05-05 17:54:07 +0000826 g:netrw_use_nt_rcp =0 don't use WinNT/2K/XP's rcp (default)
827 =1 use WinNT/2K/XP's rcp, binary mode
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000828 -----------------------------------------------------------------------
829<
Bram Moolenaar13600302014-05-22 18:26:40 +0200830 *netrw-internal-variables*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000831The script will also make use of the following variables internally, albeit
832temporarily.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000833>
834 -------------------
835 Temporary Variables
836 -------------------
837 Variable Meaning
838 -------- ------------------------------------
839<
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100840 b:netrw_method Index indicating rcp/ftp+.netrc/ftp
841 w:netrw_method (same as b:netrw_method)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000842 g:netrw_machine Holds machine name parsed from input
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100843 b:netrw_fname Holds filename being accessed >
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000844 ------------------------------------------------------------
845<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000846 *netrw-protocol*
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000847
848Netrw supports a number of protocols. These protocols are invoked using the
849variables listed below, and may be modified by the user.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000850>
851 ------------------------
Bram Moolenaar9964e462007-05-05 17:54:07 +0000852 Protocol Control Options
Bram Moolenaar071d4272004-06-13 20:20:40 +0000853 ------------------------
Bram Moolenaar9964e462007-05-05 17:54:07 +0000854 Option Type Setting Meaning
855 --------- -------- -------------- ---------------------------
Bram Moolenaar8d043172014-01-23 14:24:41 +0100856< netrw_ftp variable =doesn't exist userid set by "user userid"
Bram Moolenaar9964e462007-05-05 17:54:07 +0000857 =0 userid set by "user userid"
858 =1 userid set by "userid"
859 NetReadFixup function =doesn't exist no change
860 =exists Allows user to have files
861 read via ftp automatically
862 transformed however they wish
863 by NetReadFixup()
Bram Moolenaar8d043172014-01-23 14:24:41 +0100864 g:netrw_dav_cmd var ="cadaver" if cadaver is executable
865 g:netrw_dav_cmd var ="curl -o" elseif curl is executable
866 g:netrw_fetch_cmd var ="fetch -o" if fetch is available
867 g:netrw_ftp_cmd var ="ftp"
868 g:netrw_http_cmd var ="fetch -o" if fetch is available
869 g:netrw_http_cmd var ="wget -O" else if wget is available
870 g:netrw_http_put_cmd var ="curl -T"
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100871 |g:netrw_list_cmd| var ="ssh USEPORT HOSTNAME ls -Fa"
Bram Moolenaar8d043172014-01-23 14:24:41 +0100872 g:netrw_rcp_cmd var ="rcp"
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100873 g:netrw_rsync_cmd var ="rsync"
874 *g:netrw_rsync_sep* var ="/" used to separate the hostname
875 from the file spec
Bram Moolenaar8d043172014-01-23 14:24:41 +0100876 g:netrw_scp_cmd var ="scp -q"
877 g:netrw_sftp_cmd var ="sftp" >
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000878 -------------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000879<
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000880 *netrw-ftp*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000881
Bram Moolenaar9964e462007-05-05 17:54:07 +0000882The g:netrw_..._cmd options (|g:netrw_ftp_cmd| and |g:netrw_sftp_cmd|)
883specify the external program to use handle the ftp protocol. They may
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200884include command line options (such as -p for passive mode). Example: >
Bram Moolenaar071d4272004-06-13 20:20:40 +0000885
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200886 let g:netrw_ftp_cmd= "ftp -p"
887<
Bram Moolenaar9964e462007-05-05 17:54:07 +0000888Browsing is supported by using the |g:netrw_list_cmd|; the substring
889"HOSTNAME" will be changed via substitution with whatever the current request
890is for a hostname.
891
892Two options (|g:netrw_ftp| and |netrw-fixup|) both help with certain ftp's
893that give trouble . In order to best understand how to use these options if
894ftp is giving you troubles, a bit of discussion is provided on how netrw does
895ftp reads.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000896
897For ftp, netrw typically builds up lines of one of the following formats in a
Bram Moolenaar071d4272004-06-13 20:20:40 +0000898temporary file:
899>
900 IF g:netrw_ftp !exists or is not 1 IF g:netrw_ftp exists and is 1
901 ---------------------------------- ------------------------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000902<
Bram Moolenaar9964e462007-05-05 17:54:07 +0000903 open machine [port] open machine [port]
904 user userid password userid password
905 [g:netrw_ftpmode] password
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200906 [g:netrw_ftpextracmd] [g:netrw_ftpmode]
Bram Moolenaar9964e462007-05-05 17:54:07 +0000907 get filename tempfile [g:netrw_extracmd]
908 get filename tempfile >
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000909 ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000910<
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200911The |g:netrw_ftpmode| and |g:netrw_ftpextracmd| are optional.
Bram Moolenaar9964e462007-05-05 17:54:07 +0000912
Bram Moolenaar071d4272004-06-13 20:20:40 +0000913Netrw then executes the lines above by use of a filter:
914>
915 :%! {g:netrw_ftp_cmd} -i [-n]
916<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000917where
918 g:netrw_ftp_cmd is usually "ftp",
919 -i tells ftp not to be interactive
920 -n means don't use netrc and is used for Method #3 (ftp w/o <.netrc>)
921
922If <.netrc> exists it will be used to avoid having to query the user for
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000923userid and password. The transferred file is put into a temporary file.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000924The temporary file is then read into the main editing session window that
925requested it and the temporary file deleted.
926
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000927If your ftp doesn't accept the "user" command and immediately just demands a
928userid, then try putting "let netrw_ftp=1" in your <.vimrc>.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000929
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000930 *netrw-cadaver*
931To handle the SSL certificate dialog for untrusted servers, one may pull
932down the certificate and place it into /usr/ssl/cert.pem. This operation
933renders the server treatment as "trusted".
934
Bram Moolenaar433f7c82006-03-21 21:29:36 +0000935 *netrw-fixup* *netreadfixup*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000936If your ftp for whatever reason generates unwanted lines (such as AUTH
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100937messages) you may write a NetReadFixup() function:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000938>
939 function! NetReadFixup(method,line1,line2)
940 " a:line1: first new line in current file
941 " a:line2: last new line in current file
942 if a:method == 1 "rcp
943 elseif a:method == 2 "ftp + <.netrc>
944 elseif a:method == 3 "ftp + machine,uid,password,filename
945 elseif a:method == 4 "scp
946 elseif a:method == 5 "http/wget
947 elseif a:method == 6 "dav/cadaver
948 elseif a:method == 7 "rsync
949 elseif a:method == 8 "fetch
950 elseif a:method == 9 "sftp
Bram Moolenaar9964e462007-05-05 17:54:07 +0000951 else " complain
Bram Moolenaar071d4272004-06-13 20:20:40 +0000952 endif
953 endfunction
954>
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000955The NetReadFixup() function will be called if it exists and thus allows you to
Nir Lichtman1e34b952024-05-08 19:19:34 +0200956customize your reading process.
957
Bram Moolenaare6ae6222013-05-21 21:01:10 +0200958(Related topics: |ftp| |netrw-userpass| |netrw-start|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000959
960==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00009619. Browsing *netrw-browsing* *netrw-browse* *netrw-help* {{{1
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100962 *netrw-browser* *netrw-dir* *netrw-list*
Bram Moolenaar83bab712005-08-01 21:58:57 +0000963
Bram Moolenaar446cb832008-06-24 21:56:24 +0000964INTRODUCTION TO BROWSING *netrw-intro-browse* {{{2
965 (Quick References: |netrw-quickmaps| |netrw-quickcoms|)
Bram Moolenaar83bab712005-08-01 21:58:57 +0000966
Bram Moolenaar446cb832008-06-24 21:56:24 +0000967Netrw supports the browsing of directories on your local system and on remote
968hosts; browsing includes listing files and directories, entering directories,
969editing files therein, deleting files/directories, making new directories,
970moving (renaming) files and directories, copying files and directories, etc.
971One may mark files and execute any system command on them! The Netrw browser
972generally implements the previous explorer's maps and commands for remote
973directories, although details (such as pertinent global variable names)
974necessarily differ. To browse a directory, simply "edit" it! >
Bram Moolenaar269ec652004-07-29 08:43:53 +0000975
Bram Moolenaar446cb832008-06-24 21:56:24 +0000976 vim /your/directory/
977 vim .
978 vim c:\your\directory\
979<
980(Related topics: |netrw-cr| |netrw-o| |netrw-p| |netrw-P| |netrw-t|
981 |netrw-mf| |netrw-mx| |netrw-D| |netrw-R| |netrw-v| )
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000982
983The Netrw remote file and directory browser handles two protocols: ssh and
Bram Moolenaar446cb832008-06-24 21:56:24 +0000984ftp. The protocol in the url, if it is ftp, will cause netrw also to use ftp
985in its remote browsing. Specifying any other protocol will cause it to be
986used for file transfers; but the ssh protocol will be used to do remote
987browsing.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000988
Bram Moolenaar446cb832008-06-24 21:56:24 +0000989To use Netrw's remote directory browser, simply attempt to read a "file" with
990a trailing slash and it will be interpreted as a request to list a directory:
991>
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000992 vim [protocol]://[user@]hostname/path/
Bram Moolenaar4ea8fe12006-03-09 22:32:39 +0000993<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000994where [protocol] is typically scp or ftp. As an example, try: >
Bram Moolenaar4ea8fe12006-03-09 22:32:39 +0000995
Bram Moolenaar446cb832008-06-24 21:56:24 +0000996 vim ftp://ftp.home.vim.org/pub/vim/
997<
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100998For local directories, the trailing slash is not required. Again, because it's
Bram Moolenaarb0d45e72017-11-05 18:19:24 +0100999easy to miss: to browse remote directories, the URL must terminate with a
Bram Moolenaar446cb832008-06-24 21:56:24 +00001000slash!
Bram Moolenaar83bab712005-08-01 21:58:57 +00001001
Bram Moolenaar446cb832008-06-24 21:56:24 +00001002If you'd like to avoid entering the password repeatedly for remote directory
1003listings with ssh or scp, see |netrw-ssh-hack|. To avoid password entry with
1004ftp, see |netrw-netrc| (if your ftp supports it).
Bram Moolenaar83bab712005-08-01 21:58:57 +00001005
Bram Moolenaar446cb832008-06-24 21:56:24 +00001006There are several things you can do to affect the browser's display of files:
Bram Moolenaar83bab712005-08-01 21:58:57 +00001007
Bram Moolenaar446cb832008-06-24 21:56:24 +00001008 * To change the listing style, press the "i" key (|netrw-i|).
1009 Currently there are four styles: thin, long, wide, and tree.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001010 To make that change "permanent", see |g:netrw_liststyle|.
Bram Moolenaar83bab712005-08-01 21:58:57 +00001011
Bram Moolenaar446cb832008-06-24 21:56:24 +00001012 * To hide files (don't want to see those xyz~ files anymore?) see
1013 |netrw-ctrl-h|.
Bram Moolenaar83bab712005-08-01 21:58:57 +00001014
Bram Moolenaar446cb832008-06-24 21:56:24 +00001015 * Press s to sort files by name, time, or size.
1016
1017See |netrw-browse-cmds| for all the things you can do with netrw!
1018
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001019 *netrw-getftype* *netrw-filigree* *netrw-ftype*
1020The |getftype()| function is used to append a bit of filigree to indicate
1021filetype to locally listed files:
1022
1023 directory : /
1024 executable : *
1025 fifo : |
1026 links : @
1027 sockets : =
1028
1029The filigree also affects the |g:netrw_sort_sequence|.
1030
Bram Moolenaar446cb832008-06-24 21:56:24 +00001031
1032QUICK HELP *netrw-quickhelp* {{{2
1033 (Use ctrl-] to select a topic)~
1034 Intro to Browsing...............................|netrw-intro-browse|
1035 Quick Reference: Maps.........................|netrw-quickmap|
1036 Quick Reference: Commands.....................|netrw-browse-cmds|
1037 Hiding
1038 Edit hiding list..............................|netrw-ctrl-h|
1039 Hiding Files or Directories...................|netrw-a|
1040 Hiding/Unhiding by suffix.....................|netrw-mh|
1041 Hiding dot-files.............................|netrw-gh|
1042 Listing Style
1043 Select listing style (thin/long/wide/tree)....|netrw-i|
1044 Associated setting variable...................|g:netrw_liststyle|
1045 Shell command used to perform listing.........|g:netrw_list_cmd|
1046 Quick file info...............................|netrw-qf|
1047 Sorted by
1048 Select sorting style (name/time/size).........|netrw-s|
1049 Editing the sorting sequence..................|netrw-S|
Bram Moolenaarc236c162008-07-13 17:41:49 +00001050 Sorting options...............................|g:netrw_sort_options|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001051 Associated setting variable...................|g:netrw_sort_sequence|
1052 Reverse sorting order.........................|netrw-r|
1053
1054
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02001055 *netrw-quickmap* *netrw-quickmaps*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001056QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00001057>
Bram Moolenaar446cb832008-06-24 21:56:24 +00001058 --- ----------------- ----
1059 Map Quick Explanation Link
1060 --- ----------------- ----
1061< <F1> Causes Netrw to issue help
1062 <cr> Netrw will enter the directory or read the file |netrw-cr|
1063 <del> Netrw will attempt to remove the file/directory |netrw-del|
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001064 <c-h> Edit file hiding list |netrw-ctrl-h|
1065 <c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l|
1066 <c-r> Browse using a gvim server |netrw-ctrl-r|
1067 <c-tab> Shrink/expand a netrw/explore window |netrw-c-tab|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001068 - Makes Netrw go up one directory |netrw--|
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001069 a Cycles between normal display, |netrw-a|
Bram Moolenaar938ae282023-02-20 20:44:55 +00001070 hiding (suppress display of files matching g:netrw_list_hide)
1071 and showing (display only files which match g:netrw_list_hide)
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02001072 cd Make browsing directory the current directory |netrw-cd|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001073 C Setting the editing window |netrw-C|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001074 d Make a directory |netrw-d|
1075 D Attempt to remove the file(s)/directory(ies) |netrw-D|
1076 gb Go to previous bookmarked directory |netrw-gb|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001077 gd Force treatment as directory |netrw-gd|
1078 gf Force treatment as file |netrw-gf|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001079 gh Quick hide/unhide of dot-files |netrw-gh|
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001080 gn Make top of tree the directory below the cursor |netrw-gn|
Bram Moolenaar89a9c152021-08-29 21:55:35 +02001081 gp Change local-only file permissions |netrw-gp|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001082 i Cycle between thin, long, wide, and tree listings |netrw-i|
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001083 I Toggle the displaying of the banner |netrw-I|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001084 mb Bookmark current directory |netrw-mb|
1085 mc Copy marked files to marked-file target directory |netrw-mc|
1086 md Apply diff to marked files (up to 3) |netrw-md|
1087 me Place marked files on arg list and edit them |netrw-me|
1088 mf Mark a file |netrw-mf|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001089 mF Unmark files |netrw-mF|
1090 mg Apply vimgrep to marked files |netrw-mg|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001091 mh Toggle marked file suffices' presence on hiding list |netrw-mh|
1092 mm Move marked files to marked-file target directory |netrw-mm|
1093 mp Print marked files |netrw-mp|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001094 mr Mark files using a shell-style |regexp| |netrw-mr|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001095 mt Current browsing directory becomes markfile target |netrw-mt|
1096 mT Apply ctags to marked files |netrw-mT|
1097 mu Unmark all marked files |netrw-mu|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001098 mv Apply arbitrary vim command to marked files |netrw-mv|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001099 mx Apply arbitrary shell command to marked files |netrw-mx|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001100 mX Apply arbitrary shell command to marked files en bloc|netrw-mX|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001101 mz Compress/decompress marked files |netrw-mz|
1102 o Enter the file/directory under the cursor in a new |netrw-o|
Bram Moolenaar938ae282023-02-20 20:44:55 +00001103 browser window. A horizontal split is used.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001104 O Obtain a file specified by cursor |netrw-O|
1105 p Preview the file |netrw-p|
1106 P Browse in the previously used window |netrw-P|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001107 qb List bookmarked directories and history |netrw-qb|
1108 qf Display information on file |netrw-qf|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001109 qF Mark files using a quickfix list |netrw-qF|
Bram Moolenaare0fa3742016-02-20 15:47:01 +01001110 qL Mark files using a |location-list| |netrw-qL|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001111 r Reverse sorting order |netrw-r|
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001112 R Rename the designated file(s)/directory(ies) |netrw-R|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001113 s Select sorting style: by name, time, or file size |netrw-s|
1114 S Specify suffix priority for name-sorting |netrw-S|
1115 t Enter the file/directory under the cursor in a new tab|netrw-t|
1116 u Change to recently-visited directory |netrw-u|
1117 U Change to subsequently-visited directory |netrw-U|
1118 v Enter the file/directory under the cursor in a new |netrw-v|
Bram Moolenaar938ae282023-02-20 20:44:55 +00001119 browser window. A vertical split is used.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001120 x View file with an associated program |netrw-x|
Bram Moolenaar97d62492012-11-15 21:28:22 +01001121 X Execute filename under cursor via |system()| |netrw-X|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001122
Bram Moolenaarc236c162008-07-13 17:41:49 +00001123 % Open a new file in netrw's current directory |netrw-%|
1124
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001125 *netrw-mouse* *netrw-leftmouse* *netrw-middlemouse* *netrw-rightmouse*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001126 <leftmouse> (gvim only) selects word under mouse as if a <cr>
1127 had been pressed (ie. edit file, change directory)
1128 <middlemouse> (gvim only) same as P selecting word under mouse;
1129 see |netrw-P|
1130 <rightmouse> (gvim only) delete file/directory using word under
1131 mouse
1132 <2-leftmouse> (gvim only) when:
Bram Moolenaar13600302014-05-22 18:26:40 +02001133 * in a netrw-selected file, AND
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001134 * |g:netrw_retmap| == 1 AND
Bram Moolenaar13600302014-05-22 18:26:40 +02001135 * the user doesn't already have a <2-leftmouse>
Bram Moolenaarff034192013-04-24 18:51:19 +02001136 mapping defined before netrw is autoloaded,
Bram Moolenaar446cb832008-06-24 21:56:24 +00001137 then a double clicked leftmouse button will return
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001138 to the netrw browser window. See |g:netrw_retmap|.
Bram Moolenaar8d043172014-01-23 14:24:41 +01001139 <s-leftmouse> (gvim only) like mf, will mark files. Dragging
1140 the shifted leftmouse will mark multiple files.
1141 (see |netrw-mf|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00001142
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001143 (to disable mouse buttons while browsing: |g:netrw_mousemaps|)
1144
Bram Moolenaar446cb832008-06-24 21:56:24 +00001145 *netrw-quickcom* *netrw-quickcoms*
1146QUICK REFERENCE: COMMANDS *netrw-explore-cmds* *netrw-browse-cmds* {{{2
Bram Moolenaar8d043172014-01-23 14:24:41 +01001147 :NetrwClean[!]............................................|netrw-clean|
1148 :NetrwSettings............................................|netrw-settings|
1149 :Ntree....................................................|netrw-ntree|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001150 :Explore[!] [dir] Explore directory of current file......|netrw-explore|
1151 :Hexplore[!] [dir] Horizontal Split & Explore.............|netrw-explore|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001152 :Lexplore[!] [dir] Left Explorer Toggle...................|netrw-explore|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001153 :Nexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
1154 :Pexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
1155 :Rexplore Return to Explorer.....................|netrw-explore|
1156 :Sexplore[!] [dir] Split & Explore directory .............|netrw-explore|
1157 :Texplore[!] [dir] Tab & Explore..........................|netrw-explore|
1158 :Vexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
1159
Bram Moolenaare0fa3742016-02-20 15:47:01 +01001160
1161BANNER DISPLAY *netrw-I*
1162
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001163One may toggle the displaying of the banner by pressing "I".
Bram Moolenaare0fa3742016-02-20 15:47:01 +01001164
1165Also See: |g:netrw_banner|
1166
1167
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001168BOOKMARKING A DIRECTORY *netrw-mb* *netrw-bookmark* *netrw-bookmarks* {{{2
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001169
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001170One may easily "bookmark" the currently browsed directory by using >
Bram Moolenaar446cb832008-06-24 21:56:24 +00001171
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001172 mb
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00001173<
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001174 *.netrwbook*
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001175Bookmarks are retained in between sessions of vim in a file called .netrwbook
1176as a |List|, which is typically stored in the first directory on the user's
Bram Moolenaar8024f932020-01-14 19:29:13 +01001177'runtimepath'; entries are kept in sorted order.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001178
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001179If there are marked files and/or directories, mb will add them to the bookmark
1180list.
1181
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001182 *netrw-:NetrwMB*
Bram Moolenaarb7398fe2023-05-14 18:50:25 +01001183Additionally, one may use :NetrwMB to bookmark files or directories. >
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001184
1185 :NetrwMB[!] [files/directories]
1186
1187< No bang: enters files/directories into Netrw's bookmark system
1188
1189 No argument and in netrw buffer:
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001190 if there are marked files : bookmark marked files
1191 otherwise : bookmark file/directory under cursor
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001192 No argument and not in netrw buffer: bookmarks current open file
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001193 Has arguments : |glob()|s each arg and bookmarks them
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001194
1195 With bang: deletes files/directories from Netrw's bookmark system
1196
1197The :NetrwMB command is available outside of netrw buffers (once netrw has been
1198invoked in the session).
1199
1200The file ".netrwbook" holds bookmarks when netrw (and vim) is not active. By
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001201default, its stored on the first directory on the user's |'runtimepath'|.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001202
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001203Related Topics:
1204 |netrw-gb| how to return (go) to a bookmark
1205 |netrw-mB| how to delete bookmarks
1206 |netrw-qb| how to list bookmarks
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001207 |g:netrw_home| controls where .netrwbook is kept
Bram Moolenaar4a85b412006-04-23 22:40:29 +00001208
1209
Bram Moolenaare0fa3742016-02-20 15:47:01 +01001210BROWSING *netrw-enter* *netrw-cr* {{{2
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001211
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001212Browsing is simple: move the cursor onto a file or directory of interest.
Bram Moolenaar843ee412004-06-30 16:16:41 +00001213Hitting the <cr> (the return key) will select the file or directory.
1214Directories will themselves be listed, and files will be opened using the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001215protocol given in the original read request.
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001216
Bram Moolenaar446cb832008-06-24 21:56:24 +00001217 CAVEAT: There are four forms of listing (see |netrw-i|). Netrw assumes that
1218 two or more spaces delimit filenames and directory names for the long and
1219 wide listing formats. Thus, if your filename or directory name has two or
1220 more sequential spaces embedded in it, or any trailing spaces, then you'll
1221 need to use the "thin" format to select it.
Bram Moolenaar843ee412004-06-30 16:16:41 +00001222
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001223The |g:netrw_browse_split| option, which is zero by default, may be used to
Bram Moolenaar446cb832008-06-24 21:56:24 +00001224cause the opening of files to be done in a new window or tab instead of the
1225default. When the option is one or two, the splitting will be taken
1226horizontally or vertically, respectively. When the option is set to three, a
1227<cr> will cause the file to appear in a new tab.
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001228
Bram Moolenaar83bab712005-08-01 21:58:57 +00001229
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001230When using the gui (gvim), one may select a file by pressing the <leftmouse>
1231button. In addition, if
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001232
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001233 * |g:netrw_retmap| == 1 AND (its default value is 0)
Bram Moolenaar446cb832008-06-24 21:56:24 +00001234 * in a netrw-selected file, AND
1235 * the user doesn't already have a <2-leftmouse> mapping defined before
1236 netrw is loaded
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001237
Bram Moolenaar446cb832008-06-24 21:56:24 +00001238then a doubly-clicked leftmouse button will return to the netrw browser
1239window.
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001240
Bram Moolenaar446cb832008-06-24 21:56:24 +00001241Netrw attempts to speed up browsing, especially for remote browsing where one
1242may have to enter passwords, by keeping and re-using previously obtained
1243directory listing buffers. The |g:netrw_fastbrowse| variable is used to
1244control this behavior; one may have slow browsing (no buffer re-use), medium
1245speed browsing (re-use directory buffer listings only for remote directories),
1246and fast browsing (re-use directory buffer listings as often as possible).
1247The price for such re-use is that when changes are made (such as new files
1248are introduced into a directory), the listing may become out-of-date. One may
1249always refresh directory listing buffers by pressing ctrl-L (see
1250|netrw-ctrl-l|).
Bram Moolenaare0fa3742016-02-20 15:47:01 +01001251
1252 *netrw-s-cr*
1253Squeezing the Current Tree-Listing Directory~
1254
1255When the tree listing style is enabled (see |netrw-i|) and one is using
1256gvim, then the <s-cr> mapping may be used to squeeze (close) the
1257directory currently containing the cursor.
1258
1259Otherwise, one may remap a key combination of one's own choice to get
1260this effect: >
1261
1262 nmap <buffer> <silent> <nowait> YOURKEYCOMBO <Plug>NetrwTreeSqueeze
1263<
1264Put this line in $HOME/ftplugin/netrw/netrw.vim; it needs to be generated
1265for netrw buffers only.
Bram Moolenaara6878372014-03-22 21:02:50 +01001266
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001267Related topics:
1268 |netrw-ctrl-r| |netrw-o| |netrw-p|
1269 |netrw-P| |netrw-t| |netrw-v|
1270Associated setting variables:
1271 |g:netrw_browse_split| |g:netrw_fastbrowse|
1272 |g:netrw_ftp_list_cmd| |g:netrw_ftp_sizelist_cmd|
1273 |g:netrw_ftp_timelist_cmd| |g:netrw_ssh_browse_reject|
1274 |g:netrw_ssh_cmd| |g:netrw_use_noswf|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001275
1276
1277BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o* *netrw-horiz* {{{2
1278
1279Normally one enters a file or directory using the <cr>. However, the "o" map
1280allows one to open a new window to hold the new directory listing or file. A
1281horizontal split is used. (for vertical splitting, see |netrw-v|)
1282
1283Normally, the o key splits the window horizontally with the new window and
Bram Moolenaar15146672011-10-20 22:22:38 +02001284cursor at the top.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001285
1286Associated setting variables: |g:netrw_alto| |g:netrw_winsize|
1287
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001288Related topics:
1289 |netrw-ctrl-r| |netrw-o| |netrw-p|
1290 |netrw-P| |netrw-t| |netrw-v|
Bram Moolenaar15146672011-10-20 22:22:38 +02001291Associated setting variables:
1292 |g:netrw_alto| control above/below splitting
1293 |g:netrw_winsize| control initial sizing
Bram Moolenaar446cb832008-06-24 21:56:24 +00001294
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001295BROWSING WITH A NEW TAB *netrw-t* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00001296
1297Normally one enters a file or directory using the <cr>. The "t" map
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001298allows one to open a new window holding the new directory listing or file in
Bram Moolenaarff034192013-04-24 18:51:19 +02001299a new tab.
1300
1301If you'd like to have the new listing in a background tab, use |gT|.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001302
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001303Related topics:
1304 |netrw-ctrl-r| |netrw-o| |netrw-p|
1305 |netrw-P| |netrw-t| |netrw-v|
Bram Moolenaar15146672011-10-20 22:22:38 +02001306Associated setting variables:
1307 |g:netrw_winsize| control initial sizing
Bram Moolenaar446cb832008-06-24 21:56:24 +00001308
1309BROWSING WITH A VERTICALLY SPLIT WINDOW *netrw-v* {{{2
1310
1311Normally one enters a file or directory using the <cr>. However, the "v" map
1312allows one to open a new window to hold the new directory listing or file. A
1313vertical split is used. (for horizontal splitting, see |netrw-o|)
1314
1315Normally, the v key splits the window vertically with the new window and
Bram Moolenaar15146672011-10-20 22:22:38 +02001316cursor at the left.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001317
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001318There is only one tree listing buffer; using "v" on a displayed subdirectory
Bram Moolenaar446cb832008-06-24 21:56:24 +00001319will split the screen, but the same buffer will be shown twice.
1320
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001321Related topics:
1322 |netrw-ctrl-r| |netrw-o| |netrw-p|
1323 |netrw-P| |netrw-t| |netrw-v|
Bram Moolenaar15146672011-10-20 22:22:38 +02001324Associated setting variables:
1325 |g:netrw_altv| control right/left splitting
1326 |g:netrw_winsize| control initial sizing
1327
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001328
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001329BROWSING USING A GVIM SERVER *netrw-ctrl-r* {{{2
1330
1331One may keep a browsing gvim separate from the gvim being used to edit.
1332Use the <c-r> map on a file (not a directory) in the netrw browser, and it
1333will use a gvim server (see |g:netrw_servername|). Subsequent use of <cr>
1334(see |netrw-cr|) will re-use that server for editing files.
1335
1336Related topics:
1337 |netrw-ctrl-r| |netrw-o| |netrw-p|
1338 |netrw-P| |netrw-t| |netrw-v|
1339Associated setting variables:
1340 |g:netrw_servername| : sets name of server
1341 |g:netrw_browse_split| : controls how <cr> will open files
1342
1343
1344CHANGE LISTING STYLE (THIN LONG WIDE TREE) *netrw-i* {{{2
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001345
Bram Moolenaar9964e462007-05-05 17:54:07 +00001346The "i" map cycles between the thin, long, wide, and tree listing formats.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001347
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001348The thin listing format gives just the files' and directories' names.
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001349
Bram Moolenaar8299df92004-07-10 09:47:34 +00001350The long listing is either based on the "ls" command via ssh for remote
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001351directories or displays the filename, file size (in bytes), and the time and
1352date of last modification for local directories. With the long listing
1353format, netrw is not able to recognize filenames which have trailing spaces.
1354Use the thin listing format for such files.
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001355
Bram Moolenaar9964e462007-05-05 17:54:07 +00001356The wide listing format uses two or more contiguous spaces to delineate
1357filenames; when using that format, netrw won't be able to recognize or use
1358filenames which have two or more contiguous spaces embedded in the name or any
1359trailing spaces. The thin listing format will, however, work with such files.
Bram Moolenaar13600302014-05-22 18:26:40 +02001360The wide listing format is the most compact.
Bram Moolenaar9964e462007-05-05 17:54:07 +00001361
1362The tree listing format has a top directory followed by files and directories
Bram Moolenaar13600302014-05-22 18:26:40 +02001363preceded by one or more "|"s, which indicate the directory depth. One may
1364open and close directories by pressing the <cr> key while atop the directory
1365name.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001366
1367One may make a preferred listing style your default; see |g:netrw_liststyle|.
1368As an example, by putting the following line in your .vimrc, >
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001369 let g:netrw_liststyle= 3
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001370the tree style will become your default listing style.
Bram Moolenaar8299df92004-07-10 09:47:34 +00001371
Bram Moolenaar5b435d62012-04-05 17:33:26 +02001372One typical way to use the netrw tree display is to: >
1373
1374 vim .
1375 (use i until a tree display shows)
1376 navigate to a file
1377 v (edit as desired in vertically split window)
1378 ctrl-w h (to return to the netrw listing)
1379 P (edit newly selected file in the previous window)
1380 ctrl-w h (to return to the netrw listing)
1381 P (edit newly selected file in the previous window)
1382 ...etc...
1383<
Bram Moolenaar446cb832008-06-24 21:56:24 +00001384Associated setting variables: |g:netrw_liststyle| |g:netrw_maxfilenamelen|
1385 |g:netrw_timefmt| |g:netrw_list_cmd|
Bram Moolenaar8299df92004-07-10 09:47:34 +00001386
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001387CHANGE FILE PERMISSION *netrw-gp* {{{2
1388
1389"gp" will ask you for a new permission for the file named under the cursor.
1390Currently, this only works for local files.
1391
1392Associated setting variables: |g:netrw_chgperm|
1393
Bram Moolenaar83bab712005-08-01 21:58:57 +00001394
Bram Moolenaar446cb832008-06-24 21:56:24 +00001395CHANGING TO A BOOKMARKED DIRECTORY *netrw-gb* {{{2
Bram Moolenaar843ee412004-06-30 16:16:41 +00001396
Bram Moolenaar446cb832008-06-24 21:56:24 +00001397To change directory back to a bookmarked directory, use
Bram Moolenaar843ee412004-06-30 16:16:41 +00001398
Bram Moolenaar446cb832008-06-24 21:56:24 +00001399 {cnt}gb
Bram Moolenaar843ee412004-06-30 16:16:41 +00001400
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001401Any count may be used to reference any of the bookmarks.
Bram Moolenaarff034192013-04-24 18:51:19 +02001402Note that |netrw-qb| shows both bookmarks and history; to go
1403to a location stored in the history see |netrw-u| and |netrw-U|.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001404
1405Related Topics:
1406 |netrw-mB| how to delete bookmarks
1407 |netrw-mb| how to make a bookmark
1408 |netrw-qb| how to list bookmarks
Bram Moolenaar843ee412004-06-30 16:16:41 +00001409
Bram Moolenaar843ee412004-06-30 16:16:41 +00001410
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001411CHANGING TO A PREDECESSOR DIRECTORY *netrw-u* *netrw-updir* {{{2
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001412
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001413Every time you change to a new directory (new for the current session), netrw
1414will save the directory in a recently-visited directory history list (unless
1415|g:netrw_dirhistmax| is zero; by default, it holds ten entries). With the "u"
1416map, one can change to an earlier directory (predecessor). To do the
1417opposite, see |netrw-U|.
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001418
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001419The "u" map also accepts counts to go back in the history several slots. For
1420your convenience, qb (see |netrw-qb|) lists the history number which may be
1421used in that count.
Bram Moolenaarff034192013-04-24 18:51:19 +02001422
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001423 *.netrwhist*
Bram Moolenaarff034192013-04-24 18:51:19 +02001424See |g:netrw_dirhistmax| for how to control the quantity of history stack
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001425slots. The file ".netrwhist" holds history when netrw (and vim) is not
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001426active. By default, its stored on the first directory on the user's
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001427|'runtimepath'|.
1428
1429Related Topics:
1430 |netrw-U| changing to a successor directory
1431 |g:netrw_home| controls where .netrwhist is kept
Bram Moolenaarff034192013-04-24 18:51:19 +02001432
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001433
Bram Moolenaar446cb832008-06-24 21:56:24 +00001434CHANGING TO A SUCCESSOR DIRECTORY *netrw-U* *netrw-downdir* {{{2
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001435
1436With the "U" map, one can change to a later directory (successor).
1437This map is the opposite of the "u" map. (see |netrw-u|) Use the
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001438qb map to list both the bookmarks and history. (see |netrw-qb|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00001439
Bram Moolenaarff034192013-04-24 18:51:19 +02001440The "U" map also accepts counts to go forward in the history several slots.
1441
1442See |g:netrw_dirhistmax| for how to control the quantity of history stack
1443slots.
1444
Bram Moolenaar446cb832008-06-24 21:56:24 +00001445
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001446CHANGING TREE TOP *netrw-ntree* *:Ntree* *netrw-gn* {{{2
Bram Moolenaar8d043172014-01-23 14:24:41 +01001447
1448One may specify a new tree top for tree listings using >
1449
1450 :Ntree [dirname]
1451
1452Without a "dirname", the current line is used (and any leading depth
1453information is elided).
1454With a "dirname", the specified directory name is used.
1455
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001456The "gn" map will take the word below the cursor and use that for
1457changing the top of the tree listing.
1458
Bram Moolenaar8d043172014-01-23 14:24:41 +01001459
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001460NETRW CLEAN *netrw-clean* *:NetrwClean* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00001461
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001462With :NetrwClean one may easily remove netrw from one's home directory;
Bram Moolenaar446cb832008-06-24 21:56:24 +00001463more precisely, from the first directory on your |'runtimepath'|.
1464
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001465With :NetrwClean!, netrw will attempt to remove netrw from all directories on
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001466your |'runtimepath'|. Of course, you have to have write/delete permissions
1467correct to do this.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001468
1469With either form of the command, netrw will first ask for confirmation
1470that the removal is in fact what you want to do. If netrw doesn't have
1471permission to remove a file, it will issue an error message.
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001472
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001473CUSTOMIZING BROWSING WITH A SPECIAL HANDLER *netrw-x* *netrw-handler* {{{2
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001474
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001475Certain files, such as html, gif, jpeg, (word/office) doc, etc, files, are
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001476best seen with a special handler (ie. a tool provided with your computer's
Konfekt3d7e5672024-10-27 22:16:49 +01001477operating system). Netrw allows one to invoke such special handlers by:
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001478
Konfekt3d7e5672024-10-27 22:16:49 +01001479 * hitting gx with the cursor atop the file path or alternatively x
1480 in a netrw buffer; the former can be disabled by defining the
1481 |g:netrw_nogx| variable
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001482 * when in command line, typing :Open <path>, see |:Open| below.
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001483
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001484One may also use visual mode (see |visual-start|) to select the text that the
Konfekt3d7e5672024-10-27 22:16:49 +01001485special handler will use. Normally gx checks for a close-by URL or file name
1486to pick up the text under the cursor; one may change what |expand()| uses via the
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001487|g:netrw_gx| variable (options include "<cword>", "<cWORD>"). Note that
1488expand("<cfile>") depends on the |'isfname'| setting. Alternatively, one may
1489select the text to be used by gx by making a visual selection (see
1490|visual-block|) and then pressing gx.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001491
Konfekt3d7e5672024-10-27 22:16:49 +01001492The selection function can be adapted for each filetype by adding a function
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001493`Netrw_get_URL_<filetype>`, where <filetype> is given by the 'filetype'.
Konfekt3d7e5672024-10-27 22:16:49 +01001494The function should return the URL or file name to be used by gx, and will
1495fall back to the default behavior if it returns an empty string.
1496For example, special handlers for links Markdown and HTML are
Konfekt3d7e5672024-10-27 22:16:49 +01001497
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001498" make gx work on concealed links regardless of exact cursor position: >
1499
1500 function Netrw_get_URL_markdown()
1501 " markdown URL such as [link text](http://ya.ru 'yandex search')
1502 try
1503 let save_view = winsaveview()
1504 if searchpair('\[.\{-}\](', '', ')\zs', 'cbW', '', line('.')) > 0
1505 return matchstr(getline('.')[col('.')-1:],
1506 \ '\[.\{-}\](\zs' .. g:netrw_regex_url .. '\ze\(\s\+.\{-}\)\?)')
1507 endif
1508 finally
1509 call winrestview(save_view)
1510 return ''
1511 endtry
1512 endfunction
1513
1514 function Netrw_get_URL_html()
1515 " HTML URL such as <a href='http://www.python.org'>Python is here</a>
1516 " <a href="http://www.python.org"/>
1517 try
1518 let save_view = winsaveview()
1519 if searchpair('<a\s\+href=', '', '\%(</a>\|/>\)\zs', 'cbW', '', line('.')) > 0
1520 return matchstr(getline('.')[col('.') - 1 : ],
1521 \ 'href=["'.."'"..']\?\zs\S\{-}\ze["'.."'"..']\?/\?>')
1522 endif
1523 finally
1524 call winrestview(save_view)
1525 return ''
1526 endtry
1527 endfunction
Konfekt3d7e5672024-10-27 22:16:49 +01001528<
Konfekt3d7e5672024-10-27 22:16:49 +01001529Other than a file path, the text under the cursor may be a URL. Netrw uses
1530by default the following regular expression to determine if the text under the
1531cursor is a URL:
1532>
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001533 :let g:netrw_regex_url = '\%(\%(http\|ftp\|irc\)s\?\|file\)://\S\{-}'
Konfekt3d7e5672024-10-27 22:16:49 +01001534<
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001535Associated setting variables:
1536 |g:netrw_gx| control how gx picks up the text under the cursor
1537 |g:netrw_nogx| prevent gx map while editing
1538 |g:netrw_suppress_gx_mesg| controls gx's suppression of browser messages
1539
1540OPENING FILES AND LAUNCHING APPS *netrw-gx* *:Open* *:Launch* {{{2
Konfekt3d7e5672024-10-27 22:16:49 +01001541
1542Netrw determines which special handler by the following method:
1543
1544 * if |g:netrw_browsex_viewer| exists, then it will be used to attempt to
S. B. Tama95d6a32024-11-02 15:48:54 +01001545 view files.
Konfekt3d7e5672024-10-27 22:16:49 +01001546 If the viewer you wish to use does not support handling of a remote URL
1547 directory, set |g:netrw_browsex_support_remote| to 0.
1548 * otherwise:
1549
1550 * for Windows : explorer.exe is used
1551 * for Mac OS X : open is used.
1552 * for Linux : xdg-open is used.
1553
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001554To open a path (or URL) <path> by the appropriate handler, type >
Konfekt3d7e5672024-10-27 22:16:49 +01001555
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001556 :Open <path>
1557<
1558No escaping, neither for the shell nor for Vim's command-line, is needed.
Konfekt3d7e5672024-10-27 22:16:49 +01001559
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001560To launch a specific application <app> <args>, often <args> being <path> >
Konfekt3d7e5672024-10-27 22:16:49 +01001561
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001562 :Launch <app> <args>.
Konfekt3d7e5672024-10-27 22:16:49 +01001563
1564Since <args> can be arbitrarily complex, in particular contain many file
1565paths, the escaping is left to the user.
1566
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001567If you disabled the netrw plugin by setting g:loaded_netrwPlugin (see
1568|netrw-noload|), then you can use >
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001569
Christian Brabandt8b0fa7a2024-10-31 09:21:23 +01001570 :call netrw#Launch('<app> <args>')
1571 :call netrw#Open('<path>')
1572<
Bram Moolenaar446cb832008-06-24 21:56:24 +00001573 *netrw-curdir*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001574DELETING BOOKMARKS *netrw-mB* {{{2
1575
1576To delete a bookmark, use >
1577
1578 {cnt}mB
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001579
1580If there are marked files, then mB will remove them from the
1581bookmark list.
1582
1583Alternatively, one may use :NetrwMB! (see |netrw-:NetrwMB|). >
1584
1585 :NetrwMB! [files/directories]
1586
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001587Related Topics:
1588 |netrw-gb| how to return (go) to a bookmark
1589 |netrw-mb| how to make a bookmark
1590 |netrw-qb| how to list bookmarks
1591
1592
Bram Moolenaar446cb832008-06-24 21:56:24 +00001593DELETING FILES OR DIRECTORIES *netrw-delete* *netrw-D* *netrw-del* {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001594
Bram Moolenaar446cb832008-06-24 21:56:24 +00001595If files have not been marked with |netrw-mf|: (local marked file list)
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001596
Bram Moolenaar446cb832008-06-24 21:56:24 +00001597 Deleting/removing files and directories involves moving the cursor to the
1598 file/directory to be deleted and pressing "D". Directories must be empty
1599 first before they can be successfully removed. If the directory is a
1600 softlink to a directory, then netrw will make two requests to remove the
1601 directory before succeeding. Netrw will ask for confirmation before doing
1602 the removal(s). You may select a range of lines with the "V" command
1603 (visual selection), and then pressing "D".
Bram Moolenaar9964e462007-05-05 17:54:07 +00001604
Bram Moolenaar446cb832008-06-24 21:56:24 +00001605If files have been marked with |netrw-mf|: (local marked file list)
1606
1607 Marked files (and empty directories) will be deleted; again, you'll be
1608 asked to confirm the deletion before it actually takes place.
1609
Bram Moolenaar13600302014-05-22 18:26:40 +02001610A further approach is to delete files which match a pattern.
1611
1612 * use :MF pattern (see |netrw-:MF|); then press "D".
1613
1614 * use mr (see |netrw-mr|) which will prompt you for pattern.
1615 This will cause the matching files to be marked. Then,
1616 press "D".
1617
K.Takata71d0ba02024-01-10 03:21:05 +09001618Please note that only empty directories may be deleted with the "D" mapping.
1619Regular files are deleted with |delete()|, too.
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001620
Bram Moolenaar446cb832008-06-24 21:56:24 +00001621The |g:netrw_rm_cmd|, |g:netrw_rmf_cmd|, and |g:netrw_rmdir_cmd| variables are
Bram Moolenaar13600302014-05-22 18:26:40 +02001622used to control the attempts to remove remote files and directories. The
Bram Moolenaar446cb832008-06-24 21:56:24 +00001623g:netrw_rm_cmd is used with files, and its default value is:
1624
1625 g:netrw_rm_cmd: ssh HOSTNAME rm
1626
1627The g:netrw_rmdir_cmd variable is used to support the removal of directories.
1628Its default value is:
1629
Bram Moolenaar13600302014-05-22 18:26:40 +02001630 |g:netrw_rmdir_cmd|: ssh HOSTNAME rmdir
Bram Moolenaar446cb832008-06-24 21:56:24 +00001631
1632If removing a directory fails with g:netrw_rmdir_cmd, netrw then will attempt
1633to remove it again using the g:netrw_rmf_cmd variable. Its default value is:
1634
Bram Moolenaar13600302014-05-22 18:26:40 +02001635 |g:netrw_rmf_cmd|: ssh HOSTNAME rm -f
Bram Moolenaar446cb832008-06-24 21:56:24 +00001636
Bram Moolenaar15146672011-10-20 22:22:38 +02001637Related topics: |netrw-d|
K.Takata71d0ba02024-01-10 03:21:05 +09001638Associated setting variable: |g:netrw_rm_cmd| |g:netrw_ssh_cmd|
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001639
1640
Bram Moolenaar446cb832008-06-24 21:56:24 +00001641*netrw-explore* *netrw-hexplore* *netrw-nexplore* *netrw-pexplore*
Bram Moolenaar8d043172014-01-23 14:24:41 +01001642*netrw-rexplore* *netrw-sexplore* *netrw-texplore* *netrw-vexplore* *netrw-lexplore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001643DIRECTORY EXPLORATION COMMANDS {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001644
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001645 :[N]Explore[!] [dir]... Explore directory of current file *:Explore*
1646 :[N]Hexplore[!] [dir]... Horizontal Split & Explore *:Hexplore*
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001647 :[N]Lexplore[!] [dir]... Left Explorer Toggle *:Lexplore*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001648 :[N]Sexplore[!] [dir]... Split&Explore current file's directory *:Sexplore*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001649 :[N]Vexplore[!] [dir]... Vertical Split & Explore *:Vexplore*
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001650 :Texplore [dir]... Tab & Explore *:Texplore*
1651 :Rexplore ... Return to/from Explorer *:Rexplore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001652
1653 Used with :Explore **/pattern : (also see |netrw-starstar|)
1654 :Nexplore............. go to next matching file *:Nexplore*
1655 :Pexplore............. go to previous matching file *:Pexplore*
1656
Bram Moolenaara6878372014-03-22 21:02:50 +01001657 *netrw-:Explore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001658:Explore will open the local-directory browser on the current file's
1659 directory (or on directory [dir] if specified). The window will be
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001660 split only if the file has been modified and |'hidden'| is not set,
1661 otherwise the browsing window will take over that window. Normally
1662 the splitting is taken horizontally.
Bram Moolenaara6878372014-03-22 21:02:50 +01001663 Also see: |netrw-:Rexplore|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001664:Explore! is like :Explore, but will use vertical splitting.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001665
Bram Moolenaara6878372014-03-22 21:02:50 +01001666 *netrw-:Hexplore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001667:Hexplore [dir] does an :Explore with |:belowright| horizontal splitting.
1668:Hexplore! [dir] does an :Explore with |:aboveleft| horizontal splitting.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001669
1670 *netrw-:Lexplore*
1671:[N]Lexplore [dir] toggles a full height Explorer window on the left hand side
1672 of the current tab. It will open a netrw window on the current
1673 directory if [dir] is omitted; a :Lexplore [dir] will show the
1674 specified directory in the left-hand side browser display no matter
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001675 from which window the command is issued.
1676
1677 By default, :Lexplore will change an uninitialized |g:netrw_chgwin|
1678 to 2; edits will thus preferentially be made in window#2.
1679
1680 The [N] specifies a |g:netrw_winsize| just for the new :Lexplore
K.Takata71d0ba02024-01-10 03:21:05 +09001681 window. That means that
1682 if [N] < 0 : use |N| columns for the Lexplore window
1683 if [N] = 0 : a normal split is made
1684 if [N] > 0 : use N% of the current window will be used for the
1685 new window
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001686
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001687 Those who like this method often also like tree style displays;
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001688 see |g:netrw_liststyle|.
1689
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001690:[N]Lexplore! [dir] is similar to :Lexplore, except that the full-height
1691 Explorer window will open on the right hand side and an
1692 uninitialized |g:netrw_chgwin| will be set to 1 (eg. edits will
1693 preferentially occur in the leftmost window).
1694
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001695 Also see: |netrw-C| |g:netrw_browse_split| |g:netrw_wiw|
1696 |netrw-p| |netrw-P| |g:netrw_chgwin|
1697 |netrw-c-tab| |g:netrw_winsize|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001698
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001699 *netrw-:Sexplore*
1700:[N]Sexplore will always split the window before invoking the local-directory
1701 browser. As with Explore, the splitting is normally done
1702 horizontally.
1703:[N]Sexplore! [dir] is like :Sexplore, but the splitting will be done vertically.
1704
Bram Moolenaara6878372014-03-22 21:02:50 +01001705 *netrw-:Texplore*
Bram Moolenaar8d043172014-01-23 14:24:41 +01001706:Texplore [dir] does a |:tabnew| before generating the browser window
Bram Moolenaar446cb832008-06-24 21:56:24 +00001707
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001708 *netrw-:Vexplore*
1709:[N]Vexplore [dir] does an :Explore with |:leftabove| vertical splitting.
1710:[N]Vexplore! [dir] does an :Explore with |:rightbelow| vertical splitting.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001711
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001712The optional parameters are:
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001713
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001714 [N]: This parameter will override |g:netrw_winsize| to specify the quantity of
1715 rows and/or columns the new explorer window should have.
1716 Otherwise, the |g:netrw_winsize| variable, if it has been specified by the
1717 user, is used to control the quantity of rows and/or columns new
1718 explorer windows should have.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001719
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001720 [dir]: By default, these explorer commands use the current file's directory.
1721 However, one may explicitly provide a directory (path) to use instead;
1722 ie. >
1723
1724 :Explore /some/path
1725<
Bram Moolenaara6878372014-03-22 21:02:50 +01001726 *netrw-:Rexplore*
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001727:Rexplore This command is a little different from the other Explore commands
1728 as it doesn't necessarily open an Explorer window.
Bram Moolenaara6878372014-03-22 21:02:50 +01001729
1730 Return to Explorer~
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001731 When one edits a file using netrw which can occur, for example,
1732 when pressing <cr> while the cursor is atop a filename in a netrw
1733 browser window, a :Rexplore issued while editing that file will
1734 return the display to that of the last netrw browser display in
1735 that window.
Bram Moolenaara6878372014-03-22 21:02:50 +01001736
1737 Return from Explorer~
1738 Conversely, when one is editing a directory, issuing a :Rexplore
Bram Moolenaar13600302014-05-22 18:26:40 +02001739 will return to editing the file that was last edited in that
Bram Moolenaara6878372014-03-22 21:02:50 +01001740 window.
1741
1742 The <2-leftmouse> map (which is only available under gvim and
1743 cooperative terms) does the same as :Rexplore.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001744
Bram Moolenaar8d043172014-01-23 14:24:41 +01001745Also see: |g:netrw_alto| |g:netrw_altv| |g:netrw_winsize|
1746
Bram Moolenaar446cb832008-06-24 21:56:24 +00001747
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001748*netrw-star* *netrw-starpat* *netrw-starstar* *netrw-starstarpat* *netrw-grep*
1749EXPLORING WITH STARS AND PATTERNS {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00001750
1751When Explore, Sexplore, Hexplore, or Vexplore are used with one of the
Bram Moolenaare0fa3742016-02-20 15:47:01 +01001752following four patterns Explore generates a list of files which satisfy the
1753request for the local file system. These exploration patterns will not work
1754with remote file browsing.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001755
1756 */filepat files in current directory which satisfy filepat
1757 **/filepat files in current directory or below which satisfy the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001758 file pattern
Bram Moolenaar446cb832008-06-24 21:56:24 +00001759 *//pattern files in the current directory which contain the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001760 pattern (vimgrep is used)
Bram Moolenaar446cb832008-06-24 21:56:24 +00001761 **//pattern files in the current directory or below which contain
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001762 the pattern (vimgrep is used)
Bram Moolenaar572cb562005-08-05 21:35:02 +00001763<
Bram Moolenaar446cb832008-06-24 21:56:24 +00001764The cursor will be placed on the first file in the list. One may then
1765continue to go to subsequent files on that list via |:Nexplore| or to
1766preceding files on that list with |:Pexplore|. Explore will update the
1767directory and place the cursor appropriately.
1768
1769A plain >
1770 :Explore
1771will clear the explore list.
1772
1773If your console or gui produces recognizable shift-up or shift-down sequences,
1774then you'll likely find using shift-downarrow and shift-uparrow convenient.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001775They're mapped by netrw as follows:
Bram Moolenaar446cb832008-06-24 21:56:24 +00001776
1777 <s-down> == Nexplore, and
1778 <s-up> == Pexplore.
1779
1780As an example, consider
1781>
1782 :Explore */*.c
1783 :Nexplore
1784 :Nexplore
1785 :Pexplore
1786<
1787The status line will show, on the right hand side of the status line, a
1788message like "Match 3 of 20".
1789
Bram Moolenaara6878372014-03-22 21:02:50 +01001790Associated setting variables:
1791 |g:netrw_keepdir| |g:netrw_browse_split|
1792 |g:netrw_fastbrowse| |g:netrw_ftp_browse_reject|
1793 |g:netrw_ftp_list_cmd| |g:netrw_ftp_sizelist_cmd|
1794 |g:netrw_ftp_timelist_cmd| |g:netrw_list_cmd|
1795 |g:netrw_liststyle|
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001796
1797
Bram Moolenaar446cb832008-06-24 21:56:24 +00001798DISPLAYING INFORMATION ABOUT FILE *netrw-qf* {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001799
Bram Moolenaar446cb832008-06-24 21:56:24 +00001800With the cursor atop a filename, pressing "qf" will reveal the file's size
1801and last modification timestamp. Currently this capability is only available
1802for local files.
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001803
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001804
Bram Moolenaar446cb832008-06-24 21:56:24 +00001805EDIT FILE OR DIRECTORY HIDING LIST *netrw-ctrl-h* *netrw-edithide* {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001806
Bram Moolenaar446cb832008-06-24 21:56:24 +00001807The "<ctrl-h>" map brings up a requestor allowing the user to change the
1808file/directory hiding list contained in |g:netrw_list_hide|. The hiding list
1809consists of one or more patterns delimited by commas. Files and/or
1810directories satisfying these patterns will either be hidden (ie. not shown) or
1811be the only ones displayed (see |netrw-a|).
1812
1813The "gh" mapping (see |netrw-gh|) quickly alternates between the usual
1814hiding list and the hiding of files or directories that begin with ".".
1815
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001816As an example, >
1817 let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+'
1818Effectively, this makes the effect of a |netrw-gh| command the initial setting.
1819What it means:
1820
1821 \(^\|\s\s\) : if the line begins with the following, -or-
1822 two consecutive spaces are encountered
1823 \zs : start the hiding match now
1824 \. : if it now begins with a dot
1825 \S\+ : and is followed by one or more non-whitespace
1826 characters
1827
Bram Moolenaar446cb832008-06-24 21:56:24 +00001828Associated setting variables: |g:netrw_hide| |g:netrw_list_hide|
1829Associated topics: |netrw-a| |netrw-gh| |netrw-mh|
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001830
Bram Moolenaar15146672011-10-20 22:22:38 +02001831 *netrw-sort-sequence*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001832EDITING THE SORTING SEQUENCE *netrw-S* *netrw-sortsequence* {{{2
1833
1834When "Sorted by" is name, one may specify priority via the sorting sequence
1835(g:netrw_sort_sequence). The sorting sequence typically prioritizes the
1836name-listing by suffix, although any pattern will do. Patterns are delimited
1837by commas. The default sorting sequence is (all one line):
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001838
1839For Unix: >
1840 '[\/]$,\<core\%(\.\d\+\)\=,\.[a-np-z]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,
1841 \.info$,\.swp$,\.bak$,\~$'
1842<
1843Otherwise: >
Bram Moolenaar446cb832008-06-24 21:56:24 +00001844 '[\/]$,\.[a-np-z]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,
1845 \.swp$,\.bak$,\~$'
1846<
1847The lone * is where all filenames not covered by one of the other patterns
1848will end up. One may change the sorting sequence by modifying the
1849g:netrw_sort_sequence variable (either manually or in your <.vimrc>) or by
1850using the "S" map.
1851
Bram Moolenaarc236c162008-07-13 17:41:49 +00001852Related topics: |netrw-s| |netrw-S|
1853Associated setting variables: |g:netrw_sort_sequence| |g:netrw_sort_options|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001854
1855
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001856EXECUTING FILE UNDER CURSOR VIA SYSTEM() *netrw-X* {{{2
Bram Moolenaar97d62492012-11-15 21:28:22 +01001857
1858Pressing X while the cursor is atop an executable file will yield a prompt
1859using the filename asking for any arguments. Upon pressing a [return], netrw
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01001860will then call |system()| with that command and arguments. The result will be
1861displayed by |:echomsg|, and so |:messages| will repeat display of the result.
1862Ansi escape sequences will be stripped out.
1863
1864See |cmdline-window| for directions for more on how to edit the arguments.
Bram Moolenaar97d62492012-11-15 21:28:22 +01001865
1866
Bram Moolenaaradc21822011-04-01 18:03:16 +02001867FORCING TREATMENT AS A FILE OR DIRECTORY *netrw-gd* *netrw-gf* {{{2
1868
1869Remote symbolic links (ie. those listed via ssh or ftp) are problematic
1870in that it is difficult to tell whether they link to a file or to a
1871directory.
1872
1873To force treatment as a file: use >
Bram Moolenaar97d62492012-11-15 21:28:22 +01001874 gf
Bram Moolenaaradc21822011-04-01 18:03:16 +02001875<
1876To force treatment as a directory: use >
Bram Moolenaar97d62492012-11-15 21:28:22 +01001877 gd
Bram Moolenaaradc21822011-04-01 18:03:16 +02001878<
1879
Bram Moolenaar446cb832008-06-24 21:56:24 +00001880GOING UP *netrw--* {{{2
1881
1882To go up a directory, press "-" or press the <cr> when atop the ../ directory
1883entry in the listing.
1884
1885Netrw will use the command in |g:netrw_list_cmd| to perform the directory
1886listing operation after changing HOSTNAME to the host specified by the
Bram Moolenaara6878372014-03-22 21:02:50 +01001887user-prpvided url. By default netrw provides the command as: >
Bram Moolenaar446cb832008-06-24 21:56:24 +00001888
1889 ssh HOSTNAME ls -FLa
Bram Moolenaara6878372014-03-22 21:02:50 +01001890<
Bram Moolenaar446cb832008-06-24 21:56:24 +00001891where the HOSTNAME becomes the [user@]hostname as requested by the attempt to
1892read. Naturally, the user may override this command with whatever is
1893preferred. The NetList function which implements remote browsing
1894expects that directories will be flagged by a trailing slash.
1895
1896
1897HIDING FILES OR DIRECTORIES *netrw-a* *netrw-hiding* {{{2
1898
1899Netrw's browsing facility allows one to use the hiding list in one of three
1900ways: ignore it, hide files which match, and show only those files which
1901match.
1902
1903If no files have been marked via |netrw-mf|:
1904
1905The "a" map allows the user to cycle through the three hiding modes.
1906
1907The |g:netrw_list_hide| variable holds a comma delimited list of patterns
1908based on regular expressions (ex. ^.*\.obj$,^\.) which specify the hiding list.
1909(also see |netrw-ctrl-h|) To set the hiding list, use the <c-h> map. As an
1910example, to hide files which begin with a ".", one may use the <c-h> map to
1911set the hiding list to '^\..*' (or one may put let g:netrw_list_hide= '^\..*'
1912in one's <.vimrc>). One may then use the "a" key to show all files, hide
1913matching files, or to show only the matching files.
1914
1915 Example: \.[ch]$
1916 This hiding list command will hide/show all *.c and *.h files.
1917
1918 Example: \.c$,\.h$
1919 This hiding list command will also hide/show all *.c and *.h
1920 files.
1921
1922Don't forget to use the "a" map to select the mode (normal/hiding/show) you
1923want!
1924
1925If files have been marked using |netrw-mf|, then this command will:
1926
1927 if showing all files or non-hidden files:
1928 modify the g:netrw_list_hide list by appending the marked files to it
1929 and showing only non-hidden files.
1930
1931 else if showing hidden files only:
1932 modify the g:netrw_list_hide list by removing the marked files from it
1933 and showing only non-hidden files.
1934 endif
1935
1936 *netrw-gh* *netrw-hide*
1937As a quick shortcut, one may press >
1938 gh
1939to toggle between hiding files which begin with a period (dot) and not hiding
1940them.
1941
Bram Moolenaar8d043172014-01-23 14:24:41 +01001942Associated setting variables: |g:netrw_list_hide| |g:netrw_hide|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001943Associated topics: |netrw-a| |netrw-ctrl-h| |netrw-mh|
1944
Bram Moolenaar8d043172014-01-23 14:24:41 +01001945 *netrw-gitignore*
1946Netrw provides a helper function 'netrw_gitignore#Hide()' that, when used with
1947|g:netrw_list_hide| automatically hides all git-ignored files.
1948
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001949'netrw_gitignore#Hide' searches for patterns in the following files: >
1950
Bram Moolenaar8d043172014-01-23 14:24:41 +01001951 './.gitignore'
1952 './.git/info/exclude'
1953 global gitignore file: `git config --global core.excludesfile`
1954 system gitignore file: `git config --system core.excludesfile`
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001955<
Bram Moolenaar8d043172014-01-23 14:24:41 +01001956Files that do not exist, are ignored.
1957Git-ignore patterns are taken from existing files, and converted to patterns for
1958hiding files. For example, if you had '*.log' in your '.gitignore' file, it
1959would be converted to '.*\.log'.
1960
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001961To use this function, simply assign its output to |g:netrw_list_hide| option. >
Bram Moolenaar8d043172014-01-23 14:24:41 +01001962
1963 Example: let g:netrw_list_hide= netrw_gitignore#Hide()
1964 Git-ignored files are hidden in Netrw.
1965
1966 Example: let g:netrw_list_hide= netrw_gitignore#Hide('my_gitignore_file')
1967 Function can take additional files with git-ignore patterns.
1968
Bram Moolenaarb7398fe2023-05-14 18:50:25 +01001969 Example: let g:netrw_list_hide= netrw_gitignore#Hide() .. '.*\.swp$'
Bram Moolenaar8d043172014-01-23 14:24:41 +01001970 Combining 'netrw_gitignore#Hide' with custom patterns.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001971<
Bram Moolenaar8d043172014-01-23 14:24:41 +01001972
Bram Moolenaar446cb832008-06-24 21:56:24 +00001973IMPROVING BROWSING *netrw-listhack* *netrw-ssh-hack* {{{2
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001974
1975Especially with the remote directory browser, constantly entering the password
1976is tedious.
1977
Bram Moolenaar9964e462007-05-05 17:54:07 +00001978For Linux/Unix systems, the book "Linux Server Hacks - 100 industrial strength
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +00001979tips & tools" by Rob Flickenger (O'Reilly, ISBN 0-596-00461-3) gives a tip
1980for setting up no-password ssh and scp and discusses associated security
Bram Moolenaar9964e462007-05-05 17:54:07 +00001981issues. It used to be available at http://hacks.oreilly.com/pub/h/66 ,
1982but apparently that address is now being redirected to some "hackzine".
Bram Moolenaare37d50a2008-08-06 17:06:04 +00001983I'll attempt a summary based on that article and on a communication from
1984Ben Schmidt:
Bram Moolenaar843ee412004-06-30 16:16:41 +00001985
Bram Moolenaare37d50a2008-08-06 17:06:04 +00001986 1. Generate a public/private key pair on the local machine
1987 (ssh client): >
1988 ssh-keygen -t rsa
1989 (saving the file in ~/.ssh/id_rsa as prompted)
1990<
1991 2. Just hit the <CR> when asked for passphrase (twice) for no
1992 passphrase. If you do use a passphrase, you will also need to use
1993 ssh-agent so you only have to type the passphrase once per session.
1994 If you don't use a passphrase, simply logging onto your local
1995 computer or getting access to the keyfile in any way will suffice
1996 to access any ssh servers which have that key authorized for login.
1997
1998 3. This creates two files: >
1999 ~/.ssh/id_rsa
2000 ~/.ssh/id_rsa.pub
2001<
2002 4. On the target machine (ssh server): >
2003 cd
2004 mkdir -p .ssh
2005 chmod 0700 .ssh
2006<
2007 5. On your local machine (ssh client): (one line) >
2008 ssh {serverhostname}
2009 cat '>>' '~/.ssh/authorized_keys2' < ~/.ssh/id_rsa.pub
2010<
2011 or, for OpenSSH, (one line) >
2012 ssh {serverhostname}
2013 cat '>>' '~/.ssh/authorized_keys' < ~/.ssh/id_rsa.pub
2014<
2015You can test it out with >
2016 ssh {serverhostname}
2017and you should be log onto the server machine without further need to type
2018anything.
2019
2020If you decided to use a passphrase, do: >
2021 ssh-agent $SHELL
2022 ssh-add
2023 ssh {serverhostname}
2024You will be prompted for your key passphrase when you use ssh-add, but not
2025subsequently when you use ssh. For use with vim, you can use >
2026 ssh-agent vim
2027and, when next within vim, use >
2028 :!ssh-add
2029Alternatively, you can apply ssh-agent to the terminal you're planning on
2030running vim in: >
2031 ssh-agent xterm &
2032and do ssh-add whenever you need.
Bram Moolenaar843ee412004-06-30 16:16:41 +00002033
Bram Moolenaar9964e462007-05-05 17:54:07 +00002034For Windows, folks on the vim mailing list have mentioned that Pageant helps
2035with avoiding the constant need to enter the password.
Bram Moolenaar433f7c82006-03-21 21:29:36 +00002036
Bram Moolenaar446cb832008-06-24 21:56:24 +00002037Kingston Fung wrote about another way to avoid constantly needing to enter
2038passwords:
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00002039
Bram Moolenaar446cb832008-06-24 21:56:24 +00002040 In order to avoid the need to type in the password for scp each time, you
2041 provide a hack in the docs to set up a non password ssh account. I found a
2042 better way to do that: I can use a regular ssh account which uses a
2043 password to access the material without the need to key-in the password
2044 each time. It's good for security and convenience. I tried ssh public key
Christian Brabandt1c5728e2024-05-11 11:12:40 +02002045 authorization + ssh-agent, implementing this, and it works!
Bram Moolenaar446cb832008-06-24 21:56:24 +00002046
2047
Bram Moolenaar8d043172014-01-23 14:24:41 +01002048 Ssh hints:
2049
2050 Thomer Gil has provided a hint on how to speed up netrw+ssh:
2051 http://thomer.com/howtos/netrw_ssh.html
2052
2053 Alex Young has several hints on speeding ssh up:
2054 http://usevim.com/2012/03/16/editing-remote-files/
2055
2056
Bram Moolenaar446cb832008-06-24 21:56:24 +00002057LISTING BOOKMARKS AND HISTORY *netrw-qb* *netrw-listbookmark* {{{2
2058
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002059Pressing "qb" (query bookmarks) will list both the bookmarked directories and
2060directory traversal history.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002061
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002062Related Topics:
2063 |netrw-gb| how to return (go) to a bookmark
2064 |netrw-mb| how to make a bookmark
2065 |netrw-mB| how to delete bookmarks
2066 |netrw-u| change to a predecessor directory via the history stack
2067 |netrw-U| change to a successor directory via the history stack
Bram Moolenaar446cb832008-06-24 21:56:24 +00002068
2069MAKING A NEW DIRECTORY *netrw-d* {{{2
2070
2071With the "d" map one may make a new directory either remotely (which depends
2072on the global variable g:netrw_mkdir_cmd) or locally (which depends on the
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002073global variable g:netrw_localmkdir). Netrw will issue a request for the new
Bram Moolenaar446cb832008-06-24 21:56:24 +00002074directory's name. A bare <CR> at that point will abort the making of the
2075directory. Attempts to make a local directory that already exists (as either
2076a file or a directory) will be detected, reported on, and ignored.
2077
Bram Moolenaar15146672011-10-20 22:22:38 +02002078Related topics: |netrw-D|
Bram Moolenaar8d043172014-01-23 14:24:41 +01002079Associated setting variables: |g:netrw_localmkdir| |g:netrw_mkdir_cmd|
2080 |g:netrw_remote_mkdir| |netrw-%|
Bram Moolenaar446cb832008-06-24 21:56:24 +00002081
2082
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002083MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-cd* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002084
2085By default, |g:netrw_keepdir| is 1. This setting means that the current
Bram Moolenaarff034192013-04-24 18:51:19 +02002086directory will not track the browsing directory. (done for backwards
2087compatibility with v6's file explorer).
Bram Moolenaar446cb832008-06-24 21:56:24 +00002088
Bram Moolenaarff034192013-04-24 18:51:19 +02002089Setting g:netrw_keepdir to 0 tells netrw to make vim's current directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002090track netrw's browsing directory.
2091
2092However, given the default setting for g:netrw_keepdir of 1 where netrw
2093maintains its own separate notion of the current directory, in order to make
Bram Moolenaar85850f32019-07-19 22:05:51 +02002094the two directories the same, use the "cd" map (type cd). That map will
Bram Moolenaar446cb832008-06-24 21:56:24 +00002095set Vim's notion of the current directory to netrw's current browsing
2096directory.
2097
Bram Moolenaar89a9c152021-08-29 21:55:35 +02002098|netrw-cd| : This map's name was changed from "c" to cd (see |netrw-cd|).
2099 This change was done to allow for |netrw-cb| and |netrw-cB| maps.
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002100
Bram Moolenaar446cb832008-06-24 21:56:24 +00002101Associated setting variable: |g:netrw_keepdir|
2102
Bram Moolenaara6878372014-03-22 21:02:50 +01002103MARKING FILES *netrw-:MF* *netrw-mf* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002104 (also see |netrw-mr|)
2105
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002106Netrw provides several ways to mark files:
Bram Moolenaara6878372014-03-22 21:02:50 +01002107
2108 * One may mark files with the cursor atop a filename and
Bram Moolenaar13600302014-05-22 18:26:40 +02002109 then pressing "mf".
Bram Moolenaara6878372014-03-22 21:02:50 +01002110
2111 * With gvim, in addition one may mark files with
Bram Moolenaar13600302014-05-22 18:26:40 +02002112 <s-leftmouse>. (see |netrw-mouse|)
Bram Moolenaara6878372014-03-22 21:02:50 +01002113
2114 * One may use the :MF command, which takes a list of
Bram Moolenaar13600302014-05-22 18:26:40 +02002115 files (for local directories, the list may include
2116 wildcards -- see |glob()|) >
Bram Moolenaara6878372014-03-22 21:02:50 +01002117
2118 :MF *.c
2119<
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002120 (Note that :MF uses |<f-args>| to break the line
2121 at spaces)
2122
2123 * Mark files using the |argument-list| (|netrw-mA|)
2124
2125 * Mark files based upon a |location-list| (|netrw-qL|)
Bram Moolenaar13600302014-05-22 18:26:40 +02002126
2127 * Mark files based upon the quickfix list (|netrw-qF|)
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002128 (|quickfix-error-lists|)
Bram Moolenaara6878372014-03-22 21:02:50 +01002129
2130The following netrw maps make use of marked files:
Bram Moolenaar446cb832008-06-24 21:56:24 +00002131
2132 |netrw-a| Hide marked files/directories
2133 |netrw-D| Delete marked files/directories
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002134 |netrw-ma| Move marked files' names to |arglist|
2135 |netrw-mA| Move |arglist| filenames to marked file list
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002136 |netrw-mb| Append marked files to bookmarks
2137 |netrw-mB| Delete marked files from bookmarks
Bram Moolenaar446cb832008-06-24 21:56:24 +00002138 |netrw-mc| Copy marked files to target
2139 |netrw-md| Apply vimdiff to marked files
2140 |netrw-me| Edit marked files
Bram Moolenaarff034192013-04-24 18:51:19 +02002141 |netrw-mF| Unmark marked files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002142 |netrw-mg| Apply vimgrep to marked files
Bram Moolenaara6878372014-03-22 21:02:50 +01002143 |netrw-mm| Move marked files to target
Bram Moolenaar446cb832008-06-24 21:56:24 +00002144 |netrw-mp| Print marked files
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002145 |netrw-ms| Netrw will source marked files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002146 |netrw-mt| Set target for |netrw-mm| and |netrw-mc|
2147 |netrw-mT| Generate tags using marked files
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002148 |netrw-mv| Apply vim command to marked files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002149 |netrw-mx| Apply shell command to marked files
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002150 |netrw-mX| Apply shell command to marked files, en bloc
Bram Moolenaar446cb832008-06-24 21:56:24 +00002151 |netrw-mz| Compress/Decompress marked files
2152 |netrw-O| Obtain marked files
2153 |netrw-R| Rename marked files
2154
2155One may unmark files one at a time the same way one marks them; ie. place
2156the cursor atop a marked file and press "mf". This process also works
2157with <s-leftmouse> using gvim. One may unmark all files by pressing
2158"mu" (see |netrw-mu|).
2159
Bram Moolenaaradc21822011-04-01 18:03:16 +02002160Marked files are highlighted using the "netrwMarkFile" highlighting group,
2161which by default is linked to "Identifier" (see Identifier under
2162|group-name|). You may change the highlighting group by putting something
2163like >
2164
2165 highlight clear netrwMarkFile
2166 hi link netrwMarkFile ..whatever..
2167<
2168into $HOME/.vim/after/syntax/netrw.vim .
2169
Bram Moolenaar8d043172014-01-23 14:24:41 +01002170If the mouse is enabled and works with your vim, you may use <s-leftmouse> to
2171mark one or more files. You may mark multiple files by dragging the shifted
2172leftmouse. (see |netrw-mouse|)
2173
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002174 *markfilelist* *global_markfilelist* *local_markfilelist*
Bram Moolenaar446cb832008-06-24 21:56:24 +00002175All marked files are entered onto the global marked file list; there is only
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002176one such list. In addition, every netrw buffer also has its own buffer-local
2177marked file list; since netrw buffers are associated with specific
2178directories, this means that each directory has its own local marked file
2179list. The various commands which operate on marked files use one or the other
2180of the marked file lists.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002181
Bram Moolenaara6878372014-03-22 21:02:50 +01002182Known Problem: if one is using tree mode (|g:netrw_liststyle|) and several
2183directories have files with the same name, then marking such a file will
2184result in all such files being highlighted as if they were all marked. The
2185|markfilelist|, however, will only have the selected file in it. This problem
2186is unlikely to be fixed.
2187
Bram Moolenaar446cb832008-06-24 21:56:24 +00002188
Bram Moolenaarff034192013-04-24 18:51:19 +02002189UNMARKING FILES *netrw-mF* {{{2
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002190 (also see |netrw-mf|, |netrw-mu|)
Bram Moolenaarff034192013-04-24 18:51:19 +02002191
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002192The "mF" command will unmark all files in the current buffer. One may also use
2193mf (|netrw-mf|) on a specific, already marked, file to unmark just that file.
Bram Moolenaarff034192013-04-24 18:51:19 +02002194
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002195MARKING FILES BY LOCATION LIST *netrw-qL* {{{2
2196 (also see |netrw-mf|)
Bram Moolenaarff034192013-04-24 18:51:19 +02002197
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002198One may convert |location-list|s into a marked file list using "qL".
2199You may then proceed with commands such as me (|netrw-me|) to edit them.
2200
2201
2202MARKING FILES BY QUICKFIX LIST *netrw-qF* {{{2
Bram Moolenaarff034192013-04-24 18:51:19 +02002203 (also see |netrw-mf|)
2204
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002205One may convert |quickfix-error-lists| into a marked file list using "qF".
2206You may then proceed with commands such as me (|netrw-me|) to edit them.
2207Quickfix error lists are generated, for example, by calls to |:vimgrep|.
Bram Moolenaarff034192013-04-24 18:51:19 +02002208
2209
Bram Moolenaar446cb832008-06-24 21:56:24 +00002210MARKING FILES BY REGULAR EXPRESSION *netrw-mr* {{{2
2211 (also see |netrw-mf|)
2212
2213One may also mark files by pressing "mr"; netrw will then issue a prompt,
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002214"Enter regexp: ". You may then enter a shell-style regular expression such
2215as *.c$ (see |glob()|). For remote systems, glob() doesn't work -- so netrw
2216converts "*" into ".*" (see |regexp|) and marks files based on that. In the
2217future I may make it possible to use |regexp|s instead of glob()-style
2218expressions (yet-another-option).
Bram Moolenaar446cb832008-06-24 21:56:24 +00002219
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002220See |cmdline-window| for directions on more on how to edit the regular
2221expression.
2222
Bram Moolenaar446cb832008-06-24 21:56:24 +00002223
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002224MARKED FILES, ARBITRARY VIM COMMAND *netrw-mv* {{{2
2225 (See |netrw-mf| and |netrw-mr| for how to mark files)
2226 (uses the local marked-file list)
2227
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002228The "mv" map causes netrw to execute an arbitrary vim command on each file on
2229the local marked file list, individually:
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002230
2231 * 1split
2232 * sil! keepalt e file
2233 * run vim command
2234 * sil! keepalt wq!
2235
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002236A prompt, "Enter vim command: ", will be issued to elicit the vim command you
2237wish used. See |cmdline-window| for directions for more on how to edit the
2238command.
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002239
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002240
2241MARKED FILES, ARBITRARY SHELL COMMAND *netrw-mx* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002242 (See |netrw-mf| and |netrw-mr| for how to mark files)
2243 (uses the local marked-file list)
2244
2245Upon activation of the "mx" map, netrw will query the user for some (external)
2246command to be applied to all marked files. All "%"s in the command will be
2247substituted with the name of each marked file in turn. If no "%"s are in the
2248command, then the command will be followed by a space and a marked filename.
2249
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002250Example:
2251 (mark files)
2252 mx
2253 Enter command: cat
2254
2255 The result is a series of shell commands:
2256 cat 'file1'
2257 cat 'file2'
2258 ...
2259
2260
Bram Moolenaar938ae282023-02-20 20:44:55 +00002261MARKED FILES, ARBITRARY SHELL COMMAND, EN BLOC *netrw-mX* {{{2
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002262 (See |netrw-mf| and |netrw-mr| for how to mark files)
2263 (uses the global marked-file list)
2264
2265Upon activation of the 'mX' map, netrw will query the user for some (external)
2266command to be applied to all marked files on the global marked file list. The
2267"en bloc" means that one command will be executed on all the files at once: >
2268
2269 command files
2270
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002271This approach is useful, for example, to select files and make a tarball: >
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002272
2273 (mark files)
2274 mX
2275 Enter command: tar cf mynewtarball.tar
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002276<
2277The command that will be run with this example:
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002278
2279 tar cf mynewtarball.tar 'file1' 'file2' ...
2280
Bram Moolenaar446cb832008-06-24 21:56:24 +00002281
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002282MARKED FILES: ARGUMENT LIST *netrw-ma* *netrw-mA*
2283 (See |netrw-mf| and |netrw-mr| for how to mark files)
2284 (uses the global marked-file list)
2285
2286Using ma, one moves filenames from the marked file list to the argument list.
2287Using mA, one moves filenames from the argument list to the marked file list.
2288
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002289See Also: |netrw-cb| |netrw-cB| |netrw-qF| |argument-list| |:args|
2290
2291
2292MARKED FILES: BUFFER LIST *netrw-cb* *netrw-cB*
2293 (See |netrw-mf| and |netrw-mr| for how to mark files)
2294 (uses the global marked-file list)
2295
2296Using cb, one moves filenames from the marked file list to the buffer list.
2297Using cB, one copies filenames from the buffer list to the marked file list.
2298
2299See Also: |netrw-ma| |netrw-mA| |netrw-qF| |buffer-list| |:buffers|
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002300
2301
Bram Moolenaar446cb832008-06-24 21:56:24 +00002302MARKED FILES: COMPRESSION AND DECOMPRESSION *netrw-mz* {{{2
2303 (See |netrw-mf| and |netrw-mr| for how to mark files)
2304 (uses the local marked file list)
2305
2306If any marked files are compressed, then "mz" will decompress them.
2307If any marked files are decompressed, then "mz" will compress them
2308using the command specified by |g:netrw_compress|; by default,
2309that's "gzip".
2310
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002311For decompression, netrw uses a |Dictionary| of suffices and their
Bram Moolenaar446cb832008-06-24 21:56:24 +00002312associated decompressing utilities; see |g:netrw_decompress|.
2313
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002314Remember that one can mark multiple files by regular expression
2315(see |netrw-mr|); this is particularly useful to facilitate compressing and
2316decompressing a large number of files.
2317
Bram Moolenaar446cb832008-06-24 21:56:24 +00002318Associated setting variables: |g:netrw_compress| |g:netrw_decompress|
2319
2320MARKED FILES: COPYING *netrw-mc* {{{2
2321 (See |netrw-mf| and |netrw-mr| for how to mark files)
2322 (Uses the global marked file list)
2323
2324Select a target directory with mt (|netrw-mt|). Then change directory,
Bram Moolenaaradc21822011-04-01 18:03:16 +02002325select file(s) (see |netrw-mf|), and press "mc". The copy is done
2326from the current window (where one does the mf) to the target.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002327
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002328If one does not have a target directory set with |netrw-mt|, then netrw
2329will query you for a directory to copy to.
2330
2331One may also copy directories and their contents (local only) to a target
2332directory.
2333
2334Associated setting variables:
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002335 |g:netrw_localcopycmd| |g:netrw_localcopycmdopt|
2336 |g:netrw_localcopydircmd| |g:netrw_localcopydircmdopt|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002337 |g:netrw_ssh_cmd|
Bram Moolenaar446cb832008-06-24 21:56:24 +00002338
2339MARKED FILES: DIFF *netrw-md* {{{2
2340 (See |netrw-mf| and |netrw-mr| for how to mark files)
2341 (uses the global marked file list)
2342
2343Use |vimdiff| to visualize difference between selected files (two or
2344three may be selected for this). Uses the global marked file list.
2345
2346MARKED FILES: EDITING *netrw-me* {{{2
2347 (See |netrw-mf| and |netrw-mr| for how to mark files)
2348 (uses the global marked file list)
2349
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002350The "me" command will place the marked files on the |arglist| and commence
Bram Moolenaar446cb832008-06-24 21:56:24 +00002351editing them. One may return the to explorer window with |:Rexplore|.
Bram Moolenaarff034192013-04-24 18:51:19 +02002352(use |:n| and |:p| to edit next and previous files in the arglist)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002353
2354MARKED FILES: GREP *netrw-mg* {{{2
2355 (See |netrw-mf| and |netrw-mr| for how to mark files)
2356 (uses the global marked file list)
2357
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002358The "mg" command will apply |:vimgrep| to the marked files.
Bram Moolenaarff034192013-04-24 18:51:19 +02002359The command will ask for the requested pattern; one may then enter: >
2360
Bram Moolenaar446cb832008-06-24 21:56:24 +00002361 /pattern/[g][j]
2362 ! /pattern/[g][j]
2363 pattern
2364<
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002365With /pattern/, editing will start with the first item on the |quickfix| list
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002366that vimgrep sets up (see |:copen|, |:cnext|, |:cprevious|, |:cclose|). The |:vimgrep|
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002367command is in use, so without 'g' each line is added to quickfix list only
2368once; with 'g' every match is included.
2369
2370With /pattern/j, "mg" will winnow the current marked file list to just those
2371marked files also possessing the specified pattern. Thus, one may use >
2372
2373 mr ...file-pattern...
2374 mg /pattern/j
2375<
2376to have a marked file list satisfying the file-pattern but also restricted to
2377files containing some desired pattern.
2378
Bram Moolenaarff034192013-04-24 18:51:19 +02002379
Bram Moolenaar446cb832008-06-24 21:56:24 +00002380MARKED FILES: HIDING AND UNHIDING BY SUFFIX *netrw-mh* {{{2
2381 (See |netrw-mf| and |netrw-mr| for how to mark files)
2382 (uses the local marked file list)
2383
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002384The "mh" command extracts the suffices of the marked files and toggles their
Bram Moolenaar446cb832008-06-24 21:56:24 +00002385presence on the hiding list. Please note that marking the same suffix
2386this way multiple times will result in the suffix's presence being toggled
2387for each file (so an even quantity of marked files having the same suffix
2388is the same as not having bothered to select them at all).
2389
2390Related topics: |netrw-a| |g:netrw_list_hide|
2391
2392MARKED FILES: MOVING *netrw-mm* {{{2
2393 (See |netrw-mf| and |netrw-mr| for how to mark files)
2394 (uses the global marked file list)
2395
Bram Moolenaare37d50a2008-08-06 17:06:04 +00002396 WARNING: moving files is more dangerous than copying them.
2397 A file being moved is first copied and then deleted; if the
2398 copy operation fails and the delete succeeds, you will lose
2399 the file. Either try things out with unimportant files
2400 first or do the copy and then delete yourself using mc and D.
2401 Use at your own risk!
2402
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002403Select a target directory with mt (|netrw-mt|). Then change directory,
Bram Moolenaaradc21822011-04-01 18:03:16 +02002404select file(s) (see |netrw-mf|), and press "mm". The move is done
2405from the current window (where one does the mf) to the target.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002406
2407Associated setting variable: |g:netrw_localmovecmd| |g:netrw_ssh_cmd|
2408
2409MARKED FILES: PRINTING *netrw-mp* {{{2
2410 (See |netrw-mf| and |netrw-mr| for how to mark files)
2411 (uses the local marked file list)
2412
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002413When "mp" is used, netrw will apply the |:hardcopy| command to marked files.
2414What netrw does is open each file in a one-line window, execute hardcopy, then
2415close the one-line window.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002416
2417
2418MARKED FILES: SOURCING *netrw-ms* {{{2
2419 (See |netrw-mf| and |netrw-mr| for how to mark files)
2420 (uses the local marked file list)
2421
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002422With "ms", netrw will source the marked files (using vim's |:source| command)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002423
2424
Bram Moolenaarff034192013-04-24 18:51:19 +02002425MARKED FILES: SETTING THE TARGET DIRECTORY *netrw-mt* {{{2
2426 (See |netrw-mf| and |netrw-mr| for how to mark files)
2427
2428Set the marked file copy/move-to target (see |netrw-mc| and |netrw-mm|):
2429
2430 * If the cursor is atop a file name, then the netrw window's currently
2431 displayed directory is used for the copy/move-to target.
2432
2433 * Also, if the cursor is in the banner, then the netrw window's currently
2434 displayed directory is used for the copy/move-to target.
2435 Unless the target already is the current directory. In which case,
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002436 typing "mf" clears the target.
Bram Moolenaarff034192013-04-24 18:51:19 +02002437
2438 * However, if the cursor is atop a directory name, then that directory is
2439 used for the copy/move-to target
2440
Bram Moolenaara6878372014-03-22 21:02:50 +01002441 * One may use the :MT [directory] command to set the target *netrw-:MT*
2442 This command uses |<q-args>|, so spaces in the directory name are
2443 permitted without escaping.
2444
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002445 * With mouse-enabled vim or with gvim, one may select a target by using
2446 <c-leftmouse>
2447
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002448There is only one copy/move-to target at a time in a vim session; ie. the
2449target is a script variable (see |s:var|) and is shared between all netrw
2450windows (in an instance of vim).
Bram Moolenaarff034192013-04-24 18:51:19 +02002451
2452When using menus and gvim, netrw provides a "Targets" entry which allows one
2453to pick a target from the list of bookmarks and history.
2454
2455Related topics:
2456 Marking Files......................................|netrw-mf|
2457 Marking Files by Regular Expression................|netrw-mr|
2458 Marked Files: Target Directory Using Bookmarks.....|netrw-Tb|
2459 Marked Files: Target Directory Using History.......|netrw-Th|
2460
2461
Bram Moolenaar446cb832008-06-24 21:56:24 +00002462MARKED FILES: TAGGING *netrw-mT* {{{2
2463 (See |netrw-mf| and |netrw-mr| for how to mark files)
2464 (uses the global marked file list)
2465
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002466The "mT" mapping will apply the command in |g:netrw_ctags| (by default, it is
Bram Moolenaar446cb832008-06-24 21:56:24 +00002467"ctags") to marked files. For remote browsing, in order to create a tags file
2468netrw will use ssh (see |g:netrw_ssh_cmd|), and so ssh must be available for
2469this to work on remote systems. For your local system, see |ctags| on how to
2470get a version. I myself use hdrtags, currently available at
Bram Moolenaar97d62492012-11-15 21:28:22 +01002471http://www.drchip.org/astronaut/src/index.html , and have >
Bram Moolenaar446cb832008-06-24 21:56:24 +00002472
2473 let g:netrw_ctags= "hdrtag"
2474<
2475in my <.vimrc>.
2476
2477When a remote set of files are tagged, the resulting tags file is "obtained";
Bram Moolenaara6878372014-03-22 21:02:50 +01002478ie. a copy is transferred to the local system's directory. The now local tags
Bram Moolenaar446cb832008-06-24 21:56:24 +00002479file is then modified so that one may use it through the network. The
Bram Moolenaara6878372014-03-22 21:02:50 +01002480modification made concerns the names of the files in the tags; each filename is
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002481preceded by the netrw-compatible URL used to obtain it. When one subsequently
2482uses one of the go to tag actions (|tags|), the URL will be used by netrw to
Bram Moolenaar446cb832008-06-24 21:56:24 +00002483edit the desired file and go to the tag.
2484
Bram Moolenaarc236c162008-07-13 17:41:49 +00002485Associated setting variables: |g:netrw_ctags| |g:netrw_ssh_cmd|
Bram Moolenaar446cb832008-06-24 21:56:24 +00002486
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002487MARKED FILES: TARGET DIRECTORY USING BOOKMARKS *netrw-Tb* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002488
Bram Moolenaara6878372014-03-22 21:02:50 +01002489Sets the marked file copy/move-to target.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002490
Bram Moolenaarff034192013-04-24 18:51:19 +02002491The |netrw-qb| map will give you a list of bookmarks (and history).
2492One may choose one of the bookmarks to become your marked file
2493target by using [count]Tb (default count: 1).
Bram Moolenaar446cb832008-06-24 21:56:24 +00002494
Bram Moolenaarff034192013-04-24 18:51:19 +02002495Related topics:
Bram Moolenaara6878372014-03-22 21:02:50 +01002496 Copying files to target............................|netrw-mc|
Bram Moolenaarff034192013-04-24 18:51:19 +02002497 Listing Bookmarks and History......................|netrw-qb|
2498 Marked Files: Setting The Target Directory.........|netrw-mt|
2499 Marked Files: Target Directory Using History.......|netrw-Th|
2500 Marking Files......................................|netrw-mf|
2501 Marking Files by Regular Expression................|netrw-mr|
Bram Moolenaara6878372014-03-22 21:02:50 +01002502 Moving files to target.............................|netrw-mm|
Bram Moolenaar446cb832008-06-24 21:56:24 +00002503
Bram Moolenaar446cb832008-06-24 21:56:24 +00002504
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002505MARKED FILES: TARGET DIRECTORY USING HISTORY *netrw-Th* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002506
Bram Moolenaara6878372014-03-22 21:02:50 +01002507Sets the marked file copy/move-to target.
Bram Moolenaarff034192013-04-24 18:51:19 +02002508
2509The |netrw-qb| map will give you a list of history (and bookmarks).
2510One may choose one of the history entries to become your marked file
2511target by using [count]Th (default count: 0; ie. the current directory).
2512
2513Related topics:
Bram Moolenaara6878372014-03-22 21:02:50 +01002514 Copying files to target............................|netrw-mc|
Bram Moolenaarff034192013-04-24 18:51:19 +02002515 Listing Bookmarks and History......................|netrw-qb|
2516 Marked Files: Setting The Target Directory.........|netrw-mt|
2517 Marked Files: Target Directory Using Bookmarks.....|netrw-Tb|
2518 Marking Files......................................|netrw-mf|
2519 Marking Files by Regular Expression................|netrw-mr|
Bram Moolenaara6878372014-03-22 21:02:50 +01002520 Moving files to target.............................|netrw-mm|
Bram Moolenaarff034192013-04-24 18:51:19 +02002521
Bram Moolenaar446cb832008-06-24 21:56:24 +00002522
2523MARKED FILES: UNMARKING *netrw-mu* {{{2
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002524 (See |netrw-mf|, |netrw-mF|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002525
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002526The "mu" mapping will unmark all currently marked files. This command differs
2527from "mF" as the latter only unmarks files in the current directory whereas
2528"mu" will unmark global and all buffer-local marked files.
2529(see |netrw-mF|)
2530
Bram Moolenaar446cb832008-06-24 21:56:24 +00002531
Bram Moolenaar15146672011-10-20 22:22:38 +02002532 *netrw-browser-settings*
Bram Moolenaar446cb832008-06-24 21:56:24 +00002533NETRW BROWSER VARIABLES *netrw-browser-options* *netrw-browser-var* {{{2
2534
Bram Moolenaar15146672011-10-20 22:22:38 +02002535(if you're interested in the netrw file transfer settings, see |netrw-options|
2536 and |netrw-protocol|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002537
2538The <netrw.vim> browser provides settings in the form of variables which
2539you may modify; by placing these settings in your <.vimrc>, you may customize
2540your browsing preferences. (see also: |netrw-settings|)
2541>
2542 --- -----------
2543 Var Explanation
2544 --- -----------
Bram Moolenaar8d043172014-01-23 14:24:41 +01002545< *g:netrw_altfile* some like |CTRL-^| to return to the last
2546 edited file. Choose that by setting this
2547 parameter to 1.
2548 Others like |CTRL-^| to return to the
2549 netrw browsing buffer. Choose that by setting
2550 this parameter to 0.
2551 default: =0
2552
2553 *g:netrw_alto* change from above splitting to below splitting
Bram Moolenaar446cb832008-06-24 21:56:24 +00002554 by setting this variable (see |netrw-o|)
2555 default: =&sb (see |'sb'|)
2556
Bram Moolenaarff034192013-04-24 18:51:19 +02002557 *g:netrw_altv* change from left splitting to right splitting
Bram Moolenaar446cb832008-06-24 21:56:24 +00002558 by setting this variable (see |netrw-v|)
2559 default: =&spr (see |'spr'|)
2560
Bram Moolenaarff034192013-04-24 18:51:19 +02002561 *g:netrw_banner* enable/suppress the banner
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002562 =0: suppress the banner
2563 =1: banner is enabled (default)
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002564
Bram Moolenaare6ae6222013-05-21 21:01:10 +02002565 *g:netrw_bannerbackslash* if this variable exists and is not zero, the
2566 banner will be displayed with backslashes
2567 rather than forward slashes.
2568
Bram Moolenaarff034192013-04-24 18:51:19 +02002569 *g:netrw_browse_split* when browsing, <cr> will open the file by:
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002570 =0: re-using the same window (default)
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002571 =1: horizontally splitting the window first
2572 =2: vertically splitting the window first
Bram Moolenaar446cb832008-06-24 21:56:24 +00002573 =3: open file in new tab
2574 =4: act like "P" (ie. open previous window)
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002575 Note that |g:netrw_preview| may be used
2576 to get vertical splitting instead of
2577 horizontal splitting.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002578 =[servername,tab-number,window-number]
2579 Given a |List| such as this, a remote server
2580 named by the "servername" will be used for
2581 editing. It will also use the specified tab
2582 and window numbers to perform editing
2583 (see |clientserver|, |netrw-ctrl-r|)
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002584 This option does not affect the production of
2585 |:Lexplore| windows.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002586
Bram Moolenaar8d043172014-01-23 14:24:41 +01002587 Related topics:
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002588 |g:netrw_alto| |g:netrw_altv|
2589 |netrw-C| |netrw-cr|
2590 |netrw-ctrl-r|
Bram Moolenaar8d043172014-01-23 14:24:41 +01002591
Bram Moolenaarff034192013-04-24 18:51:19 +02002592 *g:netrw_browsex_viewer* specify user's preference for a viewer: >
Bram Moolenaar446cb832008-06-24 21:56:24 +00002593 "kfmclient exec"
2594 "gnome-open"
Luca Saccarolaa7d45612024-10-21 21:27:03 +02002595<
Bram Moolenaar89a9c152021-08-29 21:55:35 +02002596 *g:netrw_browsex_support_remote*
2597 specify if the specified viewer supports a
2598 remote URL. (see |netrw-handler|).
2599
Bram Moolenaarff034192013-04-24 18:51:19 +02002600 *g:netrw_chgperm* Unix/Linux: "chmod PERM FILENAME"
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002601 Windows: "cacls FILENAME /e /p PERM"
2602 Used to change access permission for a file.
2603
Bram Moolenaar89a9c152021-08-29 21:55:35 +02002604 *g:netrw_clipboard* =1
Bram Moolenaar938ae282023-02-20 20:44:55 +00002605 By default, netrw will attempt to insure that
Bram Moolenaar89a9c152021-08-29 21:55:35 +02002606 the clipboard's values will remain unchanged.
2607 However, some users report that they have
2608 speed problems with this; consequently, this
2609 option, when set to zero, lets such users
2610 prevent netrw from saving and restoring the
2611 clipboard (the latter is done only as needed).
2612 That means that if the clipboard is changed
2613 (inadvertently) by normal netrw operation that
2614 it will not be restored to its prior state.
2615
Bram Moolenaarff034192013-04-24 18:51:19 +02002616 *g:netrw_compress* ="gzip"
Bram Moolenaar89a9c152021-08-29 21:55:35 +02002617 Will compress marked files with this
2618 command
Bram Moolenaar446cb832008-06-24 21:56:24 +00002619
Bram Moolenaarff034192013-04-24 18:51:19 +02002620 *g:Netrw_corehandler* Allows one to specify something additional
Bram Moolenaar15146672011-10-20 22:22:38 +02002621 to do when handling <core> files via netrw's
2622 browser's "x" command (see |netrw-x|). If
2623 present, g:Netrw_corehandler specifies
2624 either one or more function references
2625 (see |Funcref|). (the capital g:Netrw...
2626 is required its holding a function reference)
2627
2628
Bram Moolenaarff034192013-04-24 18:51:19 +02002629 *g:netrw_ctags* ="ctags"
2630 The default external program used to create
2631 tags
Bram Moolenaarc236c162008-07-13 17:41:49 +00002632
Bram Moolenaarff034192013-04-24 18:51:19 +02002633 *g:netrw_cursor* = 2 (default)
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002634 This option controls the use of the
Bram Moolenaaradc21822011-04-01 18:03:16 +02002635 |'cursorline'| (cul) and |'cursorcolumn'|
2636 (cuc) settings by netrw:
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002637
Bram Moolenaaradc21822011-04-01 18:03:16 +02002638 Value Thin-Long-Tree Wide
2639 =0 u-cul u-cuc u-cul u-cuc
2640 =1 u-cul u-cuc cul u-cuc
2641 =2 cul u-cuc cul u-cuc
2642 =3 cul u-cuc cul cuc
2643 =4 cul cuc cul cuc
Bram Moolenaar89a9c152021-08-29 21:55:35 +02002644 =5 U-cul U-cuc U-cul U-cuc
2645 =6 U-cul U-cuc cul U-cuc
2646 =7 cul U-cuc cul U-cuc
2647 =8 cul U-cuc cul cuc
Bram Moolenaaradc21822011-04-01 18:03:16 +02002648
2649 Where
Bram Moolenaar89a9c152021-08-29 21:55:35 +02002650 u-cul : user's |'cursorline'| initial setting used
2651 u-cuc : user's |'cursorcolumn'| initial setting used
2652 U-cul : user's |'cursorline'| current setting used
2653 U-cuc : user's |'cursorcolumn'| current setting used
2654 cul : |'cursorline'| will be locally set
2655 cuc : |'cursorcolumn'| will be locally set
2656
2657 The "initial setting" means the values of
2658 the |'cuc'| and |'cul'| settings in effect when
2659 netrw last saw |g:netrw_cursor| >= 5 or when
2660 netrw was initially run.
Bram Moolenaaradc21822011-04-01 18:03:16 +02002661
Bram Moolenaarff034192013-04-24 18:51:19 +02002662 *g:netrw_decompress* = { ".gz" : "gunzip" ,
Bram Moolenaar446cb832008-06-24 21:56:24 +00002663 ".bz2" : "bunzip2" ,
2664 ".zip" : "unzip" ,
2665 ".tar" : "tar -xf"}
2666 A dictionary mapping suffices to
2667 decompression programs.
2668
Bram Moolenaaradc21822011-04-01 18:03:16 +02002669 *g:netrw_dirhistmax* =10: controls maximum quantity of past
Bram Moolenaar89a9c152021-08-29 21:55:35 +02002670 history. May be zero to suppress
Bram Moolenaaradc21822011-04-01 18:03:16 +02002671 history.
2672 (related: |netrw-qb| |netrw-u| |netrw-U|)
2673
Bram Moolenaar97d62492012-11-15 21:28:22 +01002674 *g:netrw_dynamic_maxfilenamelen* =32: enables dynamic determination of
2675 |g:netrw_maxfilenamelen|, which affects
2676 local file long listing.
Bram Moolenaara6878372014-03-22 21:02:50 +01002677
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002678 *g:netrw_errorlvl* =0: error levels greater than or equal to
2679 this are permitted to be displayed
2680 0: notes
2681 1: warnings
2682 2: errors
2683
Bram Moolenaarff034192013-04-24 18:51:19 +02002684 *g:netrw_fastbrowse* =0: slow speed directory browsing;
Bram Moolenaar13600302014-05-22 18:26:40 +02002685 never re-uses directory listings;
Bram Moolenaar446cb832008-06-24 21:56:24 +00002686 always obtains directory listings.
2687 =1: medium speed directory browsing;
2688 re-use directory listings only
2689 when remote directory browsing.
2690 (default value)
2691 =2: fast directory browsing;
2692 only obtains directory listings when the
2693 directory hasn't been seen before
2694 (or |netrw-ctrl-l| is used).
2695
2696 Fast browsing retains old directory listing
2697 buffers so that they don't need to be
2698 re-acquired. This feature is especially
2699 important for remote browsing. However, if
2700 a file is introduced or deleted into or from
2701 such directories, the old directory buffer
2702 becomes out-of-date. One may always refresh
2703 such a directory listing with |netrw-ctrl-l|.
2704 This option gives the user the choice of
2705 trading off accuracy (ie. up-to-date listing)
2706 versus speed.
2707
Bram Moolenaar13600302014-05-22 18:26:40 +02002708 *g:netrw_ffkeep* (default: doesn't exist)
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002709 If this variable exists and is zero, then
Bram Moolenaar13600302014-05-22 18:26:40 +02002710 netrw will not do a save and restore for
2711 |'fileformat'|.
2712
Bram Moolenaarff034192013-04-24 18:51:19 +02002713 *g:netrw_fname_escape* =' ?&;%'
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002714 Used on filenames before remote reading/writing
Bram Moolenaar446cb832008-06-24 21:56:24 +00002715
Bram Moolenaarff034192013-04-24 18:51:19 +02002716 *g:netrw_ftp_browse_reject* ftp can produce a number of errors and warnings
Bram Moolenaar446cb832008-06-24 21:56:24 +00002717 that can show up as "directories" and "files"
2718 in the listing. This pattern is used to
2719 remove such embedded messages. By default its
2720 value is:
2721 '^total\s\+\d\+$\|
2722 ^Trying\s\+\d\+.*$\|
2723 ^KERBEROS_V\d rejected\|
2724 ^Security extensions not\|
2725 No such file\|
2726 : connect to address [0-9a-fA-F:]*
2727 : No route to host$'
2728
Bram Moolenaarff034192013-04-24 18:51:19 +02002729 *g:netrw_ftp_list_cmd* options for passing along to ftp for directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002730 listing. Defaults:
2731 unix or g:netrw_cygwin set: : "ls -lF"
2732 otherwise "dir"
2733
2734
Bram Moolenaarff034192013-04-24 18:51:19 +02002735 *g:netrw_ftp_sizelist_cmd* options for passing along to ftp for directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002736 listing, sorted by size of file.
2737 Defaults:
2738 unix or g:netrw_cygwin set: : "ls -slF"
2739 otherwise "dir"
2740
Bram Moolenaarff034192013-04-24 18:51:19 +02002741 *g:netrw_ftp_timelist_cmd* options for passing along to ftp for directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002742 listing, sorted by time of last modification.
2743 Defaults:
2744 unix or g:netrw_cygwin set: : "ls -tlF"
2745 otherwise "dir"
2746
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002747 *g:netrw_glob_escape* ='[]*?`{~$' (unix)
Bram Moolenaar00a927d2010-05-14 23:24:24 +02002748 ='[]*?`{$' (windows
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002749 These characters in directory names are
Bram Moolenaar446cb832008-06-24 21:56:24 +00002750 escaped before applying glob()
2751
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002752 *g:netrw_gx* ="<cfile>"
Bram Moolenaar938ae282023-02-20 20:44:55 +00002753 This option controls how gx (|netrw-gx|) picks
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002754 up the text under the cursor. See |expand()|
2755 for possibilities.
2756
Bram Moolenaarff034192013-04-24 18:51:19 +02002757 *g:netrw_hide* Controlled by the "a" map (see |netrw-a|)
2758 =0 : show all
2759 =1 : show not-hidden files
2760 =2 : show hidden files only
Bram Moolenaar85850f32019-07-19 22:05:51 +02002761 default: =1
Bram Moolenaar446cb832008-06-24 21:56:24 +00002762
Bram Moolenaarff034192013-04-24 18:51:19 +02002763 *g:netrw_home* The home directory for where bookmarks and
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002764 history are saved (as .netrwbook and
2765 .netrwhist).
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002766 Netrw uses |expand()|on the string.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002767 default: the first directory on the
2768 |'runtimepath'|
2769
Bram Moolenaarff034192013-04-24 18:51:19 +02002770 *g:netrw_keepdir* =1 (default) keep current directory immune from
Bram Moolenaar446cb832008-06-24 21:56:24 +00002771 the browsing directory.
2772 =0 keep the current directory the same as the
2773 browsing directory.
2774 The current browsing directory is contained in
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02002775 b:netrw_curdir (also see |netrw-cd|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002776
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002777 *g:netrw_keepj* ="keepj" (default) netrw attempts to keep the
2778 |:jumps| table unaffected.
2779 ="" netrw will not use |:keepjumps| with
2780 exceptions only for the
2781 saving/restoration of position.
2782
Bram Moolenaarff034192013-04-24 18:51:19 +02002783 *g:netrw_list_cmd* command for listing remote directories
Bram Moolenaar446cb832008-06-24 21:56:24 +00002784 default: (if ssh is executable)
2785 "ssh HOSTNAME ls -FLa"
2786
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002787 *g:netrw_list_cmd_options* If this variable exists, then its contents are
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002788 appended to the g:netrw_list_cmd. For
2789 example, use "2>/dev/null" to get rid of banner
2790 messages on unix systems.
2791
2792
Bram Moolenaarff034192013-04-24 18:51:19 +02002793 *g:netrw_liststyle* Set the default listing style:
Bram Moolenaar446cb832008-06-24 21:56:24 +00002794 = 0: thin listing (one file per line)
2795 = 1: long listing (one file per line with time
2796 stamp information and file size)
2797 = 2: wide listing (multiple files in columns)
2798 = 3: tree style listing
Bram Moolenaar8d043172014-01-23 14:24:41 +01002799
Bram Moolenaarb7398fe2023-05-14 18:50:25 +01002800 *g:netrw_list_hide* comma-separated pattern list for hiding files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002801 Patterns are regular expressions (see |regexp|)
Bram Moolenaar8d043172014-01-23 14:24:41 +01002802 There's some special support for git-ignore
2803 files: you may add the output from the helper
2804 function 'netrw_gitignore#Hide() automatically
2805 hiding all gitignored files.
2806 For more details see |netrw-gitignore|.
2807
2808 Examples:
2809 let g:netrw_list_hide= '.*\.swp$'
Bram Moolenaarb7398fe2023-05-14 18:50:25 +01002810 let g:netrw_list_hide= netrw_gitignore#Hide() .. '.*\.swp$'
Bram Moolenaar8d043172014-01-23 14:24:41 +01002811 default: ""
Bram Moolenaar446cb832008-06-24 21:56:24 +00002812
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002813 *g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin
2814 =expand("$COMSPEC") Windows
Bram Moolenaar446cb832008-06-24 21:56:24 +00002815 Copies marked files (|netrw-mf|) to target
2816 directory (|netrw-mt|, |netrw-mc|)
2817
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002818 *g:netrw_localcopycmdopt* ='' Linux/Unix/MacOS/Cygwin
Bram Moolenaar938ae282023-02-20 20:44:55 +00002819 =' \c copy' Windows
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002820 Options for the |g:netrw_localcopycmd|
2821
2822 *g:netrw_localcopydircmd* ="cp" Linux/Unix/MacOS/Cygwin
Bram Moolenaar938ae282023-02-20 20:44:55 +00002823 =expand("$COMSPEC") Windows
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002824 Copies directories to target directory.
2825 (|netrw-mc|, |netrw-mt|)
2826
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002827 *g:netrw_localcopydircmdopt* =" -R" Linux/Unix/MacOS/Cygwin
2828 =" /c xcopy /e /c /h/ /i /k" Windows
2829 Options for |g:netrw_localcopydircmd|
Bram Moolenaare6ae6222013-05-21 21:01:10 +02002830
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002831 *g:netrw_localmkdir* ="mkdir" Linux/Unix/MacOS/Cygwin
2832 =expand("$COMSPEC") Windows
2833 command for making a local directory
2834
2835 *g:netrw_localmkdiropt* ="" Linux/Unix/MacOS/Cygwin
2836 =" /c mkdir" Windows
2837 Options for |g:netrw_localmkdir|
2838
2839 *g:netrw_localmovecmd* ="mv" Linux/Unix/MacOS/Cygwin
2840 =expand("$COMSPEC") Windows
Bram Moolenaar446cb832008-06-24 21:56:24 +00002841 Moves marked files (|netrw-mf|) to target
2842 directory (|netrw-mt|, |netrw-mm|)
2843
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002844 *g:netrw_localmovecmdopt* ="" Linux/Unix/MacOS/Cygwin
2845 =" /c move" Windows
2846 Options for |g:netrw_localmovecmd|
2847
Bram Moolenaarff034192013-04-24 18:51:19 +02002848 *g:netrw_maxfilenamelen* =32 by default, selected so as to make long
Bram Moolenaar446cb832008-06-24 21:56:24 +00002849 listings fit on 80 column displays.
2850 If your screen is wider, and you have file
2851 or directory names longer than 32 bytes,
2852 you may set this option to keep listings
2853 columnar.
2854
Bram Moolenaarff034192013-04-24 18:51:19 +02002855 *g:netrw_mkdir_cmd* command for making a remote directory
Bram Moolenaar15146672011-10-20 22:22:38 +02002856 via ssh (also see |g:netrw_remote_mkdir|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002857 default: "ssh USEPORT HOSTNAME mkdir"
2858
Bram Moolenaar251e1912011-06-19 05:09:16 +02002859 *g:netrw_mousemaps* =1 (default) enables mouse buttons while
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002860 browsing to:
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002861 leftmouse : open file/directory
2862 shift-leftmouse : mark file
2863 middlemouse : same as P
2864 rightmouse : remove file/directory
2865 =0: disables mouse maps
2866
Bram Moolenaar15146672011-10-20 22:22:38 +02002867 *g:netrw_nobeval* doesn't exist (default)
2868 If this variable exists, then balloon
2869 evaluation will be suppressed
2870 (see |'ballooneval'|)
2871
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002872 *g:netrw_sizestyle* not defined: actual bytes (default)
Bram Moolenaar938ae282023-02-20 20:44:55 +00002873 ="b" : actual bytes (default)
2874 ="h" : human-readable (ex. 5k, 4m, 3g)
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002875 uses 1000 base
Bram Moolenaar938ae282023-02-20 20:44:55 +00002876 ="H" : human-readable (ex. 5K, 4M, 3G)
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002877 uses 1024 base
2878 The long listing (|netrw-i|) and query-file
2879 maps (|netrw-qf|) will display file size
2880 using the specified style.
2881
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002882 *g:netrw_usetab* if this variable exists and is non-zero, then
2883 the <tab> map supporting shrinking/expanding a
2884 Lexplore or netrw window will be enabled.
2885 (see |netrw-c-tab|)
2886
Bram Moolenaara6878372014-03-22 21:02:50 +01002887 *g:netrw_remote_mkdir* command for making a remote directory
Bram Moolenaar15146672011-10-20 22:22:38 +02002888 via ftp (also see |g:netrw_mkdir_cmd|)
2889 default: "mkdir"
2890
Bram Moolenaarff034192013-04-24 18:51:19 +02002891 *g:netrw_retmap* if it exists and is set to one, then:
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002892 * if in a netrw-selected file, AND
2893 * no normal-mode <2-leftmouse> mapping exists,
2894 then the <2-leftmouse> will be mapped for easy
Bram Moolenaar446cb832008-06-24 21:56:24 +00002895 return to the netrw browser window.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002896 example: click once to select and open a file,
2897 double-click to return.
2898
2899 Note that one may instead choose to:
2900 * let g:netrw_retmap= 1, AND
2901 * nmap <silent> YourChoice <Plug>NetrwReturn
2902 and have another mapping instead of
2903 <2-leftmouse> to invoke the return.
2904
2905 You may also use the |:Rexplore| command to do
2906 the same thing.
2907
Bram Moolenaar446cb832008-06-24 21:56:24 +00002908 default: =0
2909
Bram Moolenaar13600302014-05-22 18:26:40 +02002910 *g:netrw_rm_cmd* command for removing remote files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002911 default: "ssh USEPORT HOSTNAME rm"
2912
Bram Moolenaar13600302014-05-22 18:26:40 +02002913 *g:netrw_rmdir_cmd* command for removing remote directories
Bram Moolenaar446cb832008-06-24 21:56:24 +00002914 default: "ssh USEPORT HOSTNAME rmdir"
2915
Bram Moolenaar13600302014-05-22 18:26:40 +02002916 *g:netrw_rmf_cmd* command for removing remote softlinks
Bram Moolenaar446cb832008-06-24 21:56:24 +00002917 default: "ssh USEPORT HOSTNAME rm -f"
2918
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002919 *g:netrw_servername* use this variable to provide a name for
2920 |netrw-ctrl-r| to use for its server.
2921 default: "NETRWSERVER"
2922
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002923 *g:netrw_sort_by* sort by "name", "time", "size", or
Bram Moolenaar938ae282023-02-20 20:44:55 +00002924 "exten".
Bram Moolenaar446cb832008-06-24 21:56:24 +00002925 default: "name"
2926
Bram Moolenaarff034192013-04-24 18:51:19 +02002927 *g:netrw_sort_direction* sorting direction: "normal" or "reverse"
Bram Moolenaar446cb832008-06-24 21:56:24 +00002928 default: "normal"
2929
Bram Moolenaarff034192013-04-24 18:51:19 +02002930 *g:netrw_sort_options* sorting is done using |:sort|; this
Bram Moolenaarc236c162008-07-13 17:41:49 +00002931 variable's value is appended to the
2932 sort command. Thus one may ignore case,
2933 for example, with the following in your
2934 .vimrc: >
2935 let g:netrw_sort_options="i"
2936< default: ""
2937
Bram Moolenaarff034192013-04-24 18:51:19 +02002938 *g:netrw_sort_sequence* when sorting by name, first sort by the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002939 comma-separated pattern sequence. Note that
Bram Moolenaara6878372014-03-22 21:02:50 +01002940 any filigree added to indicate filetypes
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002941 should be accounted for in your pattern.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002942 default: '[\/]$,*,\.bak$,\.o$,\.h$,
2943 \.info$,\.swp$,\.obj$'
2944
Bram Moolenaarff034192013-04-24 18:51:19 +02002945 *g:netrw_special_syntax* If true, then certain files will be shown
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002946 using special syntax in the browser:
Bram Moolenaar446cb832008-06-24 21:56:24 +00002947
2948 netrwBak : *.bak
2949 netrwCompress: *.gz *.bz2 *.Z *.zip
Bram Moolenaar85850f32019-07-19 22:05:51 +02002950 netrwCoreDump: core.\d\+
Bram Moolenaar446cb832008-06-24 21:56:24 +00002951 netrwData : *.dat
Bram Moolenaar85850f32019-07-19 22:05:51 +02002952 netrwDoc : *.doc,*.txt,*.pdf,
2953 *.pdf,*.docx
Bram Moolenaar446cb832008-06-24 21:56:24 +00002954 netrwHdr : *.h
Bram Moolenaar85850f32019-07-19 22:05:51 +02002955 netrwLex : *.l *.lex
Bram Moolenaar446cb832008-06-24 21:56:24 +00002956 netrwLib : *.a *.so *.lib *.dll
2957 netrwMakefile: [mM]akefile *.mak
2958 netrwObj : *.o *.obj
Bram Moolenaar85850f32019-07-19 22:05:51 +02002959 netrwPix : *.bmp,*.fit,*.fits,*.gif,
2960 *.jpg,*.jpeg,*.pcx,*.ppc
2961 *.pgm,*.png,*.psd,*.rgb
2962 *.tif,*.xbm,*.xcf
Bram Moolenaar446cb832008-06-24 21:56:24 +00002963 netrwTags : tags ANmenu ANtags
Bram Moolenaara6878372014-03-22 21:02:50 +01002964 netrwTilde : *
Bram Moolenaar446cb832008-06-24 21:56:24 +00002965 netrwTmp : tmp* *tmp
Bram Moolenaar85850f32019-07-19 22:05:51 +02002966 netrwYacc : *.y
Bram Moolenaar446cb832008-06-24 21:56:24 +00002967
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002968 In addition, those groups mentioned in
2969 |'suffixes'| are also added to the special
2970 file highlighting group.
2971 These syntax highlighting groups are linked
2972 to netrwGray or Folded by default
2973 (see |hl-Folded|), but one may put lines like >
Bram Moolenaar446cb832008-06-24 21:56:24 +00002974 hi link netrwCompress Visual
2975< into one's <.vimrc> to use one's own
Bram Moolenaara6878372014-03-22 21:02:50 +01002976 preferences. Alternatively, one may
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002977 put such specifications into >
2978 .vim/after/syntax/netrw.vim.
2979< The netrwGray highlighting is set up by
2980 netrw when >
Bram Moolenaar938ae282023-02-20 20:44:55 +00002981 * netrwGray has not been previously
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01002982 defined
2983 * the gui is running
2984< As an example, I myself use a dark-background
Bram Moolenaara6878372014-03-22 21:02:50 +01002985 colorscheme with the following in
2986 .vim/after/syntax/netrw.vim: >
2987
2988 hi netrwCompress term=NONE cterm=NONE gui=NONE ctermfg=10 guifg=green ctermbg=0 guibg=black
2989 hi netrwData term=NONE cterm=NONE gui=NONE ctermfg=9 guifg=blue ctermbg=0 guibg=black
2990 hi netrwHdr term=NONE cterm=NONE,italic gui=NONE guifg=SeaGreen1
2991 hi netrwLex term=NONE cterm=NONE,italic gui=NONE guifg=SeaGreen1
2992 hi netrwYacc term=NONE cterm=NONE,italic gui=NONE guifg=SeaGreen1
2993 hi netrwLib term=NONE cterm=NONE gui=NONE ctermfg=14 guifg=yellow
2994 hi netrwObj term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
2995 hi netrwTilde term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
2996 hi netrwTmp term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
2997 hi netrwTags term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
2998 hi netrwDoc term=NONE cterm=NONE gui=NONE ctermfg=220 ctermbg=27 guifg=yellow2 guibg=Blue3
2999 hi netrwSymLink term=NONE cterm=NONE gui=NONE ctermfg=220 ctermbg=27 guifg=grey60
3000<
Bram Moolenaarff034192013-04-24 18:51:19 +02003001 *g:netrw_ssh_browse_reject* ssh can sometimes produce unwanted lines,
Bram Moolenaar446cb832008-06-24 21:56:24 +00003002 messages, banners, and whatnot that one doesn't
3003 want masquerading as "directories" and "files".
3004 Use this pattern to remove such embedded
3005 messages. By default its value is:
3006 '^total\s\+\d\+$'
3007
Bram Moolenaare6ae6222013-05-21 21:01:10 +02003008 *g:netrw_ssh_cmd* One may specify an executable command
3009 to use instead of ssh for remote actions
3010 such as listing, file removal, etc.
3011 default: ssh
3012
Bram Moolenaaraa3b15d2016-04-21 08:53:19 +02003013 *g:netrw_suppress_gx_mesg* =1 : browsers sometimes produce messages
3014 which are normally unwanted intermixed
3015 with the page.
3016 However, when using links, for example,
3017 those messages are what the browser produces.
3018 By setting this option to 0, netrw will not
3019 suppress browser messages.
Bram Moolenaar446cb832008-06-24 21:56:24 +00003020
Bram Moolenaarff034192013-04-24 18:51:19 +02003021 *g:netrw_tmpfile_escape* =' &;'
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003022 escape() is applied to all temporary files
Bram Moolenaar446cb832008-06-24 21:56:24 +00003023 to escape these characters.
3024
Bram Moolenaarff034192013-04-24 18:51:19 +02003025 *g:netrw_timefmt* specify format string to vim's strftime().
Bram Moolenaar446cb832008-06-24 21:56:24 +00003026 The default, "%c", is "the preferred date
3027 and time representation for the current
3028 locale" according to my manpage entry for
3029 strftime(); however, not all are satisfied
3030 with it. Some alternatives:
3031 "%a %d %b %Y %T",
3032 " %a %Y-%m-%d %I-%M-%S %p"
3033 default: "%c"
3034
Bram Moolenaarff034192013-04-24 18:51:19 +02003035 *g:netrw_use_noswf* netrw normally avoids writing swapfiles
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003036 for browser buffers. However, under some
Bram Moolenaar446cb832008-06-24 21:56:24 +00003037 systems this apparently is causing nasty
3038 ml_get errors to appear; if you're getting
3039 ml_get errors, try putting
3040 let g:netrw_use_noswf= 0
3041 in your .vimrc.
Bram Moolenaara6878372014-03-22 21:02:50 +01003042 default: 1
Bram Moolenaar446cb832008-06-24 21:56:24 +00003043
Bram Moolenaarff034192013-04-24 18:51:19 +02003044 *g:netrw_winsize* specify initial size of new windows made with
Bram Moolenaar446cb832008-06-24 21:56:24 +00003045 "o" (see |netrw-o|), "v" (see |netrw-v|),
Bram Moolenaar251e1912011-06-19 05:09:16 +02003046 |:Hexplore| or |:Vexplore|. The g:netrw_winsize
3047 is an integer describing the percentage of the
3048 current netrw buffer's window to be used for
3049 the new window.
Bram Moolenaar15146672011-10-20 22:22:38 +02003050 If g:netrw_winsize is less than zero, then
Bram Moolenaar85850f32019-07-19 22:05:51 +02003051 the absolute value of g:netrw_winsize will be
3052 used to specify the quantity of lines or
3053 columns for the new window.
Bram Moolenaar13600302014-05-22 18:26:40 +02003054 If g:netrw_winsize is zero, then a normal
3055 split will be made (ie. |'equalalways'| will
3056 take effect, for example).
Bram Moolenaar251e1912011-06-19 05:09:16 +02003057 default: 50 (for 50%)
Bram Moolenaar446cb832008-06-24 21:56:24 +00003058
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003059 *g:netrw_wiw* =1 specifies the minimum window width to use
3060 when shrinking a netrw/Lexplore window
3061 (see |netrw-c-tab|).
3062
Bram Moolenaarff034192013-04-24 18:51:19 +02003063 *g:netrw_xstrlen* Controls how netrw computes string lengths,
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02003064 including multi-byte characters' string
Bram Moolenaar446cb832008-06-24 21:56:24 +00003065 length. (thanks to N Weibull, T Mechelynck)
3066 =0: uses Vim's built-in strlen()
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003067 =1: number of codepoints (Latin a + combining
Bram Moolenaar446cb832008-06-24 21:56:24 +00003068 circumflex is two codepoints) (DEFAULT)
3069 =2: number of spacing codepoints (Latin a +
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003070 combining circumflex is one spacing
Bram Moolenaar446cb832008-06-24 21:56:24 +00003071 codepoint; a hard tab is one; wide and
3072 narrow CJK are one each; etc.)
3073 =3: virtual length (counting tabs as anything
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003074 between 1 and |'tabstop'|, wide CJK as 2
Bram Moolenaar446cb832008-06-24 21:56:24 +00003075 rather than 1, Arabic alif as zero when
3076 immediately preceded by lam, one
3077 otherwise, etc)
3078
Bram Moolenaarff034192013-04-24 18:51:19 +02003079 *g:NetrwTopLvlMenu* This variable specifies the top level
Bram Moolenaar446cb832008-06-24 21:56:24 +00003080 menu name; by default, it's "Netrw.". If
3081 you wish to change this, do so in your
3082 .vimrc.
3083
3084NETRW BROWSING AND OPTION INCOMPATIBILITIES *netrw-incompatible* {{{2
3085
3086Netrw has been designed to handle user options by saving them, setting the
3087options to something that's compatible with netrw's needs, and then restoring
3088them. However, the autochdir option: >
3089 :set acd
Bram Moolenaara6878372014-03-22 21:02:50 +01003090is problematic. Autochdir sets the current directory to that containing the
Bram Moolenaar446cb832008-06-24 21:56:24 +00003091file you edit; this apparently also applies to directories. In other words,
3092autochdir sets the current directory to that containing the "file" (even if
3093that "file" is itself a directory).
3094
Bram Moolenaar15146672011-10-20 22:22:38 +02003095NETRW SETTINGS WINDOW *netrw-settings-window* {{{2
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00003096
3097With the NetrwSettings.vim plugin, >
3098 :NetrwSettings
3099will bring up a window with the many variables that netrw uses for its
Bram Moolenaar1afcace2005-11-25 19:54:28 +00003100settings. You may change any of their values; when you save the file, the
3101settings therein will be used. One may also press "?" on any of the lines for
3102help on what each of the variables do.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00003103
Bram Moolenaar5b435d62012-04-05 17:33:26 +02003104(also see: |netrw-browser-var| |netrw-protocol| |netrw-variables|)
Bram Moolenaar9964e462007-05-05 17:54:07 +00003105
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00003106
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00003107==============================================================================
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003108OBTAINING A FILE *netrw-obtain* *netrw-O* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00003109
3110If there are no marked files:
3111
3112 When browsing a remote directory, one may obtain a file under the cursor
3113 (ie. get a copy on your local machine, but not edit it) by pressing the O
3114 key.
3115
3116If there are marked files:
3117
3118 The marked files will be obtained (ie. a copy will be transferred to your
3119 local machine, but not set up for editing).
3120
3121Only ftp and scp are supported for this operation (but since these two are
3122available for browsing, that shouldn't be a problem). The status bar will
3123then show, on its right hand side, a message like "Obtaining filename". The
3124statusline will be restored after the transfer is complete.
3125
3126Netrw can also "obtain" a file using the local browser. Netrw's display
3127of a directory is not necessarily the same as Vim's "current directory",
3128unless |g:netrw_keepdir| is set to 0 in the user's <.vimrc>. One may select
3129a file using the local browser (by putting the cursor on it) and pressing
3130"O" will then "obtain" the file; ie. copy it to Vim's current directory.
3131
3132Related topics:
3133 * To see what the current directory is, use |:pwd|
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02003134 * To make the currently browsed directory the current directory, see
3135 |netrw-cd|
Bram Moolenaar446cb832008-06-24 21:56:24 +00003136 * To automatically make the currently browsed directory the current
3137 directory, see |g:netrw_keepdir|.
3138
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003139 *netrw-newfile* *netrw-createfile*
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003140OPEN A NEW FILE IN NETRW'S CURRENT DIRECTORY *netrw-%* {{{2
Bram Moolenaarc236c162008-07-13 17:41:49 +00003141
Bram Moolenaara6878372014-03-22 21:02:50 +01003142To open a new file in netrw's current directory, press "%". This map
3143will query the user for a new filename; an empty file by that name will
3144be placed in the netrw's current directory (ie. b:netrw_curdir).
Bram Moolenaarc236c162008-07-13 17:41:49 +00003145
Bram Moolenaar89a9c152021-08-29 21:55:35 +02003146If Lexplore (|netrw-:Lexplore|) is in use, the new file will be generated
3147in the |g:netrw_chgwin| window.
3148
Bram Moolenaar8d043172014-01-23 14:24:41 +01003149Related topics: |netrw-d|
3150
Bram Moolenaarc236c162008-07-13 17:41:49 +00003151
Bram Moolenaar446cb832008-06-24 21:56:24 +00003152PREVIEW WINDOW *netrw-p* *netrw-preview* {{{2
3153
3154One may use a preview window by using the "p" key when the cursor is atop the
3155desired filename to be previewed. The display will then split to show both
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003156the browser (where the cursor will remain) and the file (see |:pedit|). By
3157default, the split will be taken horizontally; one may use vertical splitting
3158if one has set |g:netrw_preview| first.
Bram Moolenaar446cb832008-06-24 21:56:24 +00003159
Bram Moolenaar00a927d2010-05-14 23:24:24 +02003160An interesting set of netrw settings is: >
3161
3162 let g:netrw_preview = 1
3163 let g:netrw_liststyle = 3
3164 let g:netrw_winsize = 30
3165
3166These will:
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003167
Bram Moolenaar00a927d2010-05-14 23:24:24 +02003168 1. Make vertical splitting the default for previewing files
3169 2. Make the default listing style "tree"
3170 3. When a vertical preview window is opened, the directory listing
Bram Moolenaar5b435d62012-04-05 17:33:26 +02003171 will use only 30% of the columns available; the rest of the window
3172 is used for the preview window.
Bram Moolenaar446cb832008-06-24 21:56:24 +00003173
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003174 Related: if you like this idea, you may also find :Lexplore
3175 (|netrw-:Lexplore|) or |g:netrw_chgwin| of interest
3176
Bram Moolenaare0fa3742016-02-20 15:47:01 +01003177Also see: |g:netrw_chgwin| |netrw-P| |'previewwindow'| |CTRL-W_z| |:pclose|
Bram Moolenaara6878372014-03-22 21:02:50 +01003178
3179
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003180PREVIOUS WINDOW *netrw-P* *netrw-prvwin* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00003181
Bram Moolenaare0fa3742016-02-20 15:47:01 +01003182To edit a file or directory under the cursor in the previously used (last
3183accessed) window (see :he |CTRL-W_p|), press a "P". If there's only one
3184window, then the one window will be horizontally split (by default).
Bram Moolenaar446cb832008-06-24 21:56:24 +00003185
3186If there's more than one window, the previous window will be re-used on
3187the selected file/directory. If the previous window's associated buffer
3188has been modified, and there's only one window with that buffer, then
3189the user will be asked if s/he wishes to save the buffer first (yes,
3190no, or cancel).
3191
Bram Moolenaarff034192013-04-24 18:51:19 +02003192Related Actions |netrw-cr| |netrw-o| |netrw-t| |netrw-v|
Bram Moolenaar15146672011-10-20 22:22:38 +02003193Associated setting variables:
3194 |g:netrw_alto| control above/below splitting
3195 |g:netrw_altv| control right/left splitting
3196 |g:netrw_preview| control horizontal vs vertical splitting
3197 |g:netrw_winsize| control initial sizing
3198
Bram Moolenaara6878372014-03-22 21:02:50 +01003199Also see: |g:netrw_chgwin| |netrw-p|
3200
Bram Moolenaar446cb832008-06-24 21:56:24 +00003201
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003202REFRESHING THE LISTING *netrw-refresh* *netrw-ctrl-l* *netrw-ctrl_l* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00003203
3204To refresh either a local or remote directory listing, press ctrl-l (<c-l>) or
3205hit the <cr> when atop the ./ directory entry in the listing. One may also
3206refresh a local directory by using ":e .".
3207
3208
Bram Moolenaarff034192013-04-24 18:51:19 +02003209REVERSING SORTING ORDER *netrw-r* *netrw-reverse* {{{2
3210
3211One may toggle between normal and reverse sorting order by pressing the
3212"r" key.
3213
3214Related topics: |netrw-s|
3215Associated setting variable: |g:netrw_sort_direction|
3216
3217
Bram Moolenaar446cb832008-06-24 21:56:24 +00003218RENAMING FILES OR DIRECTORIES *netrw-move* *netrw-rename* *netrw-R* {{{2
3219
3220If there are no marked files: (see |netrw-mf|)
3221
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003222 Renaming files and directories involves moving the cursor to the
Bram Moolenaar446cb832008-06-24 21:56:24 +00003223 file/directory to be moved (renamed) and pressing "R". You will then be
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003224 queried for what you want the file/directory to be renamed to. You may
3225 select a range of lines with the "V" command (visual selection), and then
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003226 press "R"; you will be queried for each file as to what you want it
3227 renamed to.
Bram Moolenaar446cb832008-06-24 21:56:24 +00003228
3229If there are marked files: (see |netrw-mf|)
3230
3231 Marked files will be renamed (moved). You will be queried as above in
3232 order to specify where you want the file/directory to be moved.
3233
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003234 If you answer a renaming query with a "s/frompattern/topattern/", then
3235 subsequent files on the marked file list will be renamed by taking each
3236 name, applying that substitute, and renaming each file to the result.
3237 As an example : >
3238
Bram Moolenaar938ae282023-02-20 20:44:55 +00003239 mr [query: reply with *.c]
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003240 R [query: reply with s/^\(.*\)\.c$/\1.cpp/]
3241<
3242 This example will mark all *.c files and then rename them to *.cpp
Bram Moolenaar29634562020-01-09 21:46:04 +01003243 files. Netrw will protect you from overwriting local files without
3244 confirmation, but not remote ones.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003245
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003246 The ctrl-X character has special meaning for renaming files: >
3247
Bram Moolenaar938ae282023-02-20 20:44:55 +00003248 <c-x> : a single ctrl-x tells netrw to ignore the portion of the response
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003249 lying between the last '/' and the ctrl-x.
3250
3251 <c-x><c-x> : a pair of contiguous ctrl-x's tells netrw to ignore any
3252 portion of the string preceding the double ctrl-x's.
3253<
Bram Moolenaar446cb832008-06-24 21:56:24 +00003254 WARNING:~
3255
3256 Note that moving files is a dangerous operation; copies are safer. That's
3257 because a "move" for remote files is actually a copy + delete -- and if
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003258 the copy fails and the delete succeeds you may lose the file.
Bram Moolenaara6878372014-03-22 21:02:50 +01003259 Use at your own risk.
Bram Moolenaar446cb832008-06-24 21:56:24 +00003260
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003261The *g:netrw_rename_cmd* variable is used to implement remote renaming. By
3262default its value is: >
Bram Moolenaar446cb832008-06-24 21:56:24 +00003263
3264 ssh HOSTNAME mv
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003265<
Bram Moolenaar446cb832008-06-24 21:56:24 +00003266One may rename a block of files and directories by selecting them with
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003267V (|linewise-visual|) when using thin style.
3268
3269See |cmdline-editing| for more on how to edit the command line; in particular,
3270you'll find <ctrl-f> (initiates cmdline window editing) and <ctrl-c> (uses the
3271command line under the cursor) useful in conjunction with the R command.
Bram Moolenaar446cb832008-06-24 21:56:24 +00003272
3273
Bram Moolenaar446cb832008-06-24 21:56:24 +00003274SELECTING SORTING STYLE *netrw-s* *netrw-sort* {{{2
3275
3276One may select the sorting style by name, time, or (file) size. The "s" map
3277allows one to circulate amongst the three choices; the directory listing will
3278automatically be refreshed to reflect the selected style.
3279
3280Related topics: |netrw-r| |netrw-S|
3281Associated setting variables: |g:netrw_sort_by| |g:netrw_sort_sequence|
3282
3283
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003284SETTING EDITING WINDOW *netrw-editwindow* *netrw-C* *netrw-:NetrwC* {{{2
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003285
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003286One may select a netrw window for editing with the "C" mapping, using the
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003287:NetrwC [win#] command, or by setting |g:netrw_chgwin| to the selected window
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003288number. Subsequent selection of a file to edit (|netrw-cr|) will use that
3289window.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003290
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003291 * C : by itself, will select the current window holding a netrw buffer
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003292 for subsequent editing via |netrw-cr|. The C mapping is only available
3293 while in netrw buffers.
Bram Moolenaar13600302014-05-22 18:26:40 +02003294
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003295 * [count]C : the count will be used as the window number to be used
3296 for subsequent editing via |netrw-cr|.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003297
3298 * :NetrwC will set |g:netrw_chgwin| to the current window
3299
3300 * :NetrwC win# will set |g:netrw_chgwin| to the specified window
3301 number
3302
Bram Moolenaar13600302014-05-22 18:26:40 +02003303Using >
3304 let g:netrw_chgwin= -1
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003305will restore the default editing behavior
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003306(ie. subsequent editing will use the current window).
Bram Moolenaar13600302014-05-22 18:26:40 +02003307
Bram Moolenaar8d043172014-01-23 14:24:41 +01003308Related topics: |netrw-cr| |g:netrw_browse_split|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003309Associated setting variables: |g:netrw_chgwin|
3310
3311
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003312SHRINKING OR EXPANDING A NETRW OR LEXPLORE WINDOW *netrw-c-tab* {{{2
3313
3314The <c-tab> key will toggle a netrw or |:Lexplore| window's width,
3315but only if |g:netrw_usetab| exists and is non-zero (and, of course,
3316only if your terminal supports differentiating <c-tab> from a plain
3317<tab>).
3318
3319 * If the current window is a netrw window, toggle its width
3320 (between |g:netrw_wiw| and its original width)
3321
3322 * Else if there is a |:Lexplore| window in the current tab, toggle
3323 its width
3324
3325 * Else bring up a |:Lexplore| window
3326
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003327If |g:netrw_usetab| exists and is zero, or if there is a pre-existing mapping
Bram Moolenaare0fa3742016-02-20 15:47:01 +01003328for <c-tab>, then the <c-tab> will not be mapped. One may map something other
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003329than a <c-tab>, too: (but you'll still need to have had |g:netrw_usetab| set). >
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003330
3331 nmap <unique> (whatever) <Plug>NetrwShrink
3332<
3333Related topics: |:Lexplore|
3334Associated setting variable: |g:netrw_usetab|
3335
3336
3337USER SPECIFIED MAPS *netrw-usermaps* {{{1
3338
3339One may make customized user maps. Specify a variable, |g:Netrw_UserMaps|,
3340to hold a |List| of lists of keymap strings and function names: >
3341
3342 [["keymap-sequence","ExampleUserMapFunc"],...]
3343<
3344When netrw is setting up maps for a netrw buffer, if |g:Netrw_UserMaps|
3345exists, then the internal function netrw#UserMaps(islocal) is called.
3346This function goes through all the entries in the |g:Netrw_UserMaps| list:
3347
3348 * sets up maps: >
3349 nno <buffer> <silent> KEYMAP-SEQUENCE
3350 :call s:UserMaps(islocal,"ExampleUserMapFunc")
3351< * refreshes if result from that function call is the string
3352 "refresh"
3353 * if the result string is not "", then that string will be
3354 executed (:exe result)
3355 * if the result is a List, then the above two actions on results
3356 will be taken for every string in the result List
3357
3358The user function is passed one argument; it resembles >
3359
3360 fun! ExampleUserMapFunc(islocal)
3361<
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003362where a:islocal is 1 if its a local-directory system call or 0 when
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003363remote-directory system call.
3364
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003365 *netrw-call* *netrw-expose* *netrw-modify*
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003366Use netrw#Expose("varname") to access netrw-internal (script-local)
3367 variables.
3368Use netrw#Modify("varname",newvalue) to change netrw-internal variables.
3369Use netrw#Call("funcname"[,args]) to call a netrw-internal function with
3370 specified arguments.
3371
3372Example: Get a copy of netrw's marked file list: >
3373
3374 let netrwmarkfilelist= netrw#Expose("netrwmarkfilelist")
3375<
3376Example: Modify the value of netrw's marked file list: >
3377
3378 call netrw#Modify("netrwmarkfilelist",[])
3379<
3380Example: Clear netrw's marked file list via a mapping on gu >
3381 " ExampleUserMap: {{{2
3382 fun! ExampleUserMap(islocal)
3383 call netrw#Modify("netrwmarkfilelist",[])
3384 call netrw#Modify('netrwmarkfilemtch_{bufnr("%")}',"")
3385 let retval= ["refresh"]
3386 return retval
3387 endfun
3388 let g:Netrw_UserMaps= [["gu","ExampleUserMap"]]
3389<
3390
Bram Moolenaar446cb832008-06-24 21:56:24 +0000339110. Problems and Fixes *netrw-problems* {{{1
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003392
3393 (This section is likely to grow as I get feedback)
3394 (also see |netrw-debug|)
Bram Moolenaar488c6512005-08-11 20:09:58 +00003395 *netrw-p1*
Nir Lichtman1e34b952024-05-08 19:19:34 +02003396 P1. I use Windows, and my network browsing with ftp doesn't sort by {{{2
Bram Moolenaar9964e462007-05-05 17:54:07 +00003397 time or size! -or- The remote system is a Windows server; why
3398 don't I get sorts by time or size?
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003399
3400 Windows' ftp has a minimal support for ls (ie. it doesn't
3401 accept sorting options). It doesn't support the -F which
3402 gives an explanatory character (ABC/ for "ABC is a directory").
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003403 Netrw then uses "dir" to get both its thin and long listings.
Bram Moolenaar9964e462007-05-05 17:54:07 +00003404 If you think your ftp does support a full-up ls, put the
3405 following into your <.vimrc>: >
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003406
Bram Moolenaar9964e462007-05-05 17:54:07 +00003407 let g:netrw_ftp_list_cmd = "ls -lF"
3408 let g:netrw_ftp_timelist_cmd= "ls -tlF"
3409 let g:netrw_ftp_sizelist_cmd= "ls -slF"
3410<
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003411 Alternatively, if you have cygwin on your Windows box, put
Bram Moolenaar9964e462007-05-05 17:54:07 +00003412 into your <.vimrc>: >
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003413
3414 let g:netrw_cygwin= 1
Bram Moolenaar9964e462007-05-05 17:54:07 +00003415<
3416 This problem also occurs when the remote system is Windows.
3417 In this situation, the various g:netrw_ftp_[time|size]list_cmds
3418 are as shown above, but the remote system will not correctly
3419 modify its listing behavior.
3420
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003421
Nir Lichtman1e34b952024-05-08 19:19:34 +02003422 *netrw-p2*
3423 P2. I tried rcp://user@host/ (or protocol other than ftp) and netrw {{{2
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003424 used ssh! That wasn't what I asked for...
3425
3426 Netrw has two methods for browsing remote directories: ssh
3427 and ftp. Unless you specify ftp specifically, ssh is used.
3428 When it comes time to do download a file (not just a directory
3429 listing), netrw will use the given protocol to do so.
3430
Nir Lichtman1e34b952024-05-08 19:19:34 +02003431 *netrw-p3*
3432 P3. I would like long listings to be the default. {{{2
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003433
Bram Moolenaar446cb832008-06-24 21:56:24 +00003434 Put the following statement into your |.vimrc|: >
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00003435
Bram Moolenaar446cb832008-06-24 21:56:24 +00003436 let g:netrw_liststyle= 1
3437<
3438 Check out |netrw-browser-var| for more customizations that
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00003439 you can set.
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003440
Nir Lichtman1e34b952024-05-08 19:19:34 +02003441 *netrw-p4*
3442 P4. My times come up oddly in local browsing {{{2
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003443
3444 Does your system's strftime() accept the "%c" to yield dates
Bram Moolenaarff034192013-04-24 18:51:19 +02003445 such as "Sun Apr 27 11:49:23 1997"? If not, do a
3446 "man strftime" and find out what option should be used. Then
3447 put it into your |.vimrc|: >
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003448
Bram Moolenaar446cb832008-06-24 21:56:24 +00003449 let g:netrw_timefmt= "%X" (where X is the option)
3450<
Nir Lichtman1e34b952024-05-08 19:19:34 +02003451 *netrw-p5*
3452 P5. I want my current directory to track my browsing. {{{2
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00003453 How do I do that?
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003454
Bram Moolenaar446cb832008-06-24 21:56:24 +00003455 Put the following line in your |.vimrc|:
3456>
Bram Moolenaar433f7c82006-03-21 21:29:36 +00003457 let g:netrw_keepdir= 0
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003458<
Nir Lichtman1e34b952024-05-08 19:19:34 +02003459 *netrw-p6*
3460 P6. I use Chinese (or other non-ascii) characters in my filenames, {{{2
Bram Moolenaar85850f32019-07-19 22:05:51 +02003461 and netrw (Explore, Sexplore, Hexplore, etc) doesn't display them!
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00003462
Bram Moolenaar9964e462007-05-05 17:54:07 +00003463 (taken from an answer provided by Wu Yongwei on the vim
3464 mailing list)
Bram Moolenaara6878372014-03-22 21:02:50 +01003465 I now see the problem. Your code page is not 936, right? Vim
Bram Moolenaar9964e462007-05-05 17:54:07 +00003466 seems only able to open files with names that are valid in the
3467 current code page, as are many other applications that do not
3468 use the Unicode version of Windows APIs. This is an OS-related
3469 issue. You should not have such problems when the system
3470 locale uses UTF-8, such as modern Linux distros.
3471
3472 (...it is one more reason to recommend that people use utf-8!)
3473
Nir Lichtman1e34b952024-05-08 19:19:34 +02003474 *netrw-p7*
3475 P7. I'm getting "ssh is not executable on your system" -- what do I {{{2
Bram Moolenaar9964e462007-05-05 17:54:07 +00003476 do?
3477
3478 (Dudley Fox) Most people I know use putty for windows ssh. It
3479 is a free ssh/telnet application. You can read more about it
3480 here:
3481
3482 http://www.chiark.greenend.org.uk/~sgtatham/putty/ Also:
3483
3484 (Marlin Unruh) This program also works for me. It's a single
3485 executable, so he/she can copy it into the Windows\System32
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003486 folder and create a shortcut to it.
Bram Moolenaar9964e462007-05-05 17:54:07 +00003487
3488 (Dudley Fox) You might also wish to consider plink, as it
3489 sounds most similar to what you are looking for. plink is an
3490 application in the putty suite.
3491
3492 http://the.earth.li/~sgtatham/putty/0.58/htmldoc/Chapter7.html#plink
3493
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003494 (Vissale Neang) Maybe you can try OpenSSH for windows, which
Bram Moolenaar9964e462007-05-05 17:54:07 +00003495 can be obtained from:
3496
3497 http://sshwindows.sourceforge.net/
3498
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003499 It doesn't need the full Cygwin package.
Bram Moolenaar9964e462007-05-05 17:54:07 +00003500
3501 (Antoine Mechelynck) For individual Unix-like programs needed
3502 for work in a native-Windows environment, I recommend getting
3503 them from the GnuWin32 project on sourceforge if it has them:
3504
3505 http://gnuwin32.sourceforge.net/
3506
3507 Unlike Cygwin, which sets up a Unix-like virtual machine on
3508 top of Windows, GnuWin32 is a rewrite of Unix utilities with
3509 Windows system calls, and its programs works quite well in the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003510 cmd.exe "Dos box".
Bram Moolenaar9964e462007-05-05 17:54:07 +00003511
3512 (dave) Download WinSCP and use that to connect to the server.
3513 In Preferences > Editors, set gvim as your editor:
3514
3515 - Click "Add..."
3516 - Set External Editor (adjust path as needed, include
3517 the quotes and !.! at the end):
Bram Moolenaar8024f932020-01-14 19:29:13 +01003518 "c:\Program Files\Vim\vim82\gvim.exe" !.!
Bram Moolenaar9964e462007-05-05 17:54:07 +00003519 - Check that the filetype in the box below is
3520 {asterisk}.{asterisk} (all files), or whatever types
3521 you want (cec: change {asterisk} to * ; I had to
3522 write it that way because otherwise the helptags
Bram Moolenaar446cb832008-06-24 21:56:24 +00003523 system thinks it's a tag)
3524 - Make sure it's at the top of the listbox (click it,
3525 then click "Up" if it's not)
Bram Moolenaar9964e462007-05-05 17:54:07 +00003526 If using the Norton Commander style, you just have to hit <F4>
3527 to edit a file in a local copy of gvim.
3528
3529 (Vit Gottwald) How to generate public/private key and save
3530 public key it on server: >
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +02003531 http://www.chiark.greenend.org.uk/~sgtatham/putty/0.60/htmldoc/Chapter8.html#pubkey-gettingready
3532 (8.3 Getting ready for public key authentication)
Bram Moolenaar9964e462007-05-05 17:54:07 +00003533<
Bram Moolenaar446cb832008-06-24 21:56:24 +00003534 How to use a private key with 'pscp': >
3535
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +02003536 http://www.chiark.greenend.org.uk/~sgtatham/putty/0.60/htmldoc/Chapter5.html
3537 (5.2.4 Using public key authentication with PSCP)
Bram Moolenaar9964e462007-05-05 17:54:07 +00003538<
Bram Moolenaar446cb832008-06-24 21:56:24 +00003539 (Ben Schmidt) I find the ssh included with cwRsync is
3540 brilliant, and install cwRsync or cwRsyncServer on most
3541 Windows systems I come across these days. I guess COPSSH,
3542 packed by the same person, is probably even better for use as
3543 just ssh on Windows, and probably includes sftp, etc. which I
3544 suspect the cwRsync doesn't, though it might
3545
Bram Moolenaar9964e462007-05-05 17:54:07 +00003546 (cec) To make proper use of these suggestions above, you will
3547 need to modify the following user-settable variables in your
3548 .vimrc:
3549
Bram Moolenaar446cb832008-06-24 21:56:24 +00003550 |g:netrw_ssh_cmd| |g:netrw_list_cmd| |g:netrw_mkdir_cmd|
3551 |g:netrw_rm_cmd| |g:netrw_rmdir_cmd| |g:netrw_rmf_cmd|
Bram Moolenaar9964e462007-05-05 17:54:07 +00003552
3553 The first one (|g:netrw_ssh_cmd|) is the most important; most
3554 of the others will use the string in g:netrw_ssh_cmd by
3555 default.
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003556
Nir Lichtman1e34b952024-05-08 19:19:34 +02003557 *netrw-p8* *netrw-ml_get*
3558 P8. I'm browsing, changing directory, and bang! ml_get errors {{{2
Bram Moolenaar9964e462007-05-05 17:54:07 +00003559 appear and I have to kill vim. Any way around this?
3560
3561 Normally netrw attempts to avoid writing swapfiles for
3562 its temporary directory buffers. However, on some systems
3563 this attempt appears to be causing ml_get errors to
3564 appear. Please try setting |g:netrw_use_noswf| to 0
3565 in your <.vimrc>: >
3566 let g:netrw_use_noswf= 0
3567<
Nir Lichtman1e34b952024-05-08 19:19:34 +02003568 *netrw-p9*
3569 P9. I'm being pestered with "[something] is a directory" and {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00003570 "Press ENTER or type command to continue" prompts...
3571
3572 The "[something] is a directory" prompt is issued by Vim,
3573 not by netrw, and there appears to be no way to work around
3574 it. Coupled with the default cmdheight of 1, this message
3575 causes the "Press ENTER..." prompt. So: read |hit-enter|;
3576 I also suggest that you set your |'cmdheight'| to 2 (or more) in
3577 your <.vimrc> file.
3578
Nir Lichtman1e34b952024-05-08 19:19:34 +02003579 *netrw-p10*
3580 P10. I want to have two windows; a thin one on the left and my {{{2
Bram Moolenaar85850f32019-07-19 22:05:51 +02003581 editing window on the right. How may I accomplish this?
Bram Moolenaar446cb832008-06-24 21:56:24 +00003582
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003583 You probably want netrw running as in a side window. If so, you
3584 will likely find that ":[N]Lexplore" does what you want. The
3585 optional "[N]" allows you to select the quantity of columns you
Bram Moolenaard7464be2015-11-01 16:49:04 +01003586 wish the |:Lexplore|r window to start with (see |g:netrw_winsize|
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003587 for how this parameter works).
3588
3589 Previous solution:
3590
Bram Moolenaar446cb832008-06-24 21:56:24 +00003591 * Put the following line in your <.vimrc>:
3592 let g:netrw_altv = 1
3593 * Edit the current directory: :e .
3594 * Select some file, press v
3595 * Resize the windows as you wish (see |CTRL-W_<| and
3596 |CTRL-W_>|). If you're using gvim, you can drag
3597 the separating bar with your mouse.
3598 * When you want a new file, use ctrl-w h to go back to the
3599 netrw browser, select a file, then press P (see |CTRL-W_h|
3600 and |netrw-P|). If you're using gvim, you can press
3601 <leftmouse> in the browser window and then press the
3602 <middlemouse> to select the file.
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003603
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003604
Nir Lichtman1e34b952024-05-08 19:19:34 +02003605 *netrw-p11*
3606 P11. My directory isn't sorting correctly, or unwanted letters are {{{2
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003607 appearing in the listed filenames, or things aren't lining
3608 up properly in the wide listing, ...
3609
3610 This may be due to an encoding problem. I myself usually use
3611 utf-8, but really only use ascii (ie. bytes from 32-126).
3612 Multibyte encodings use two (or more) bytes per character.
3613 You may need to change |g:netrw_sepchr| and/or |g:netrw_xstrlen|.
3614
Nir Lichtman1e34b952024-05-08 19:19:34 +02003615 *netrw-p12*
3616 P12. I'm a Windows + putty + ssh user, and when I attempt to {{{2
Bram Moolenaar85850f32019-07-19 22:05:51 +02003617 browse, the directories are missing trailing "/"s so netrw treats
3618 them as file transfers instead of as attempts to browse
Bram Moolenaar00a927d2010-05-14 23:24:24 +02003619 subdirectories. How may I fix this?
3620
3621 (mikeyao) If you want to use vim via ssh and putty under Windows,
3622 try combining the use of pscp/psftp with plink. pscp/psftp will
3623 be used to connect and plink will be used to execute commands on
3624 the server, for example: list files and directory using 'ls'.
3625
3626 These are the settings I use to do this:
3627>
3628 " list files, it's the key setting, if you haven't set,
3629 " you will get a blank buffer
3630 let g:netrw_list_cmd = "plink HOSTNAME ls -Fa"
3631 " if you haven't add putty directory in system path, you should
3632 " specify scp/sftp command. For examples:
3633 "let g:netrw_sftp_cmd = "d:\\dev\\putty\\PSFTP.exe"
3634 "let g:netrw_scp_cmd = "d:\\dev\\putty\\PSCP.exe"
3635<
Nir Lichtman1e34b952024-05-08 19:19:34 +02003636 *netrw-p13*
3637 P13. I would like to speed up writes using Nwrite and scp/ssh {{{2
Bram Moolenaar251e1912011-06-19 05:09:16 +02003638 style connections. How? (Thomer M. Gil)
Bram Moolenaar00a927d2010-05-14 23:24:24 +02003639
Bram Moolenaar251e1912011-06-19 05:09:16 +02003640 Try using ssh's ControlMaster and ControlPath (see the ssh_config
3641 man page) to share multiple ssh connections over a single network
3642 connection. That cuts out the cryptographic handshake on each
3643 file write, sometimes speeding it up by an order of magnitude.
3644 (see http://thomer.com/howtos/netrw_ssh.html)
3645 (included by permission)
3646
3647 Add the following to your ~/.ssh/config: >
3648
3649 # you change "*" to the hostname you care about
3650 Host *
3651 ControlMaster auto
3652 ControlPath /tmp/%r@%h:%p
3653
3654< Then create an ssh connection to the host and leave it running: >
3655
3656 ssh -N host.domain.com
3657
3658< Now remotely open a file with Vim's Netrw and enjoy the
3659 zippiness: >
3660
3661 vim scp://host.domain.com//home/user/.bashrc
3662<
Nir Lichtman1e34b952024-05-08 19:19:34 +02003663 *netrw-p14*
3664 P14. How may I use a double-click instead of netrw's usual single {{{2
Bram Moolenaar85850f32019-07-19 22:05:51 +02003665 click to open a file or directory? (Ben Fritz)
Bram Moolenaar251e1912011-06-19 05:09:16 +02003666
3667 First, disable netrw's mapping with >
3668 let g:netrw_mousemaps= 0
3669< and then create a netrw buffer only mapping in
3670 $HOME/.vim/after/ftplugin/netrw.vim: >
3671 nmap <buffer> <2-leftmouse> <CR>
3672< Note that setting g:netrw_mousemaps to zero will turn off
3673 all netrw's mouse mappings, not just the <leftmouse> one.
3674 (see |g:netrw_mousemaps|)
Bram Moolenaar00a927d2010-05-14 23:24:24 +02003675
Nir Lichtman1e34b952024-05-08 19:19:34 +02003676 *netrw-p15*
3677 P15. When editing remote files (ex. :e ftp://hostname/path/file), {{{2
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003678 under Windows I get an |E303| message complaining that its unable
Bram Moolenaar13600302014-05-22 18:26:40 +02003679 to open a swap file.
3680
3681 (romainl) It looks like you are starting Vim from a protected
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003682 directory. Start netrw from your $HOME or other writable
Bram Moolenaar13600302014-05-22 18:26:40 +02003683 directory.
3684
Nir Lichtman1e34b952024-05-08 19:19:34 +02003685 *netrw-p16*
3686 P16. Netrw is closing buffers on its own. {{{2
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003687 What steps will reproduce the problem?
3688 1. :Explore, navigate directories, open a file
3689 2. :Explore, open another file
3690 3. Buffer opened in step 1 will be closed. o
3691 What is the expected output? What do you see instead?
3692 I expect both buffers to exist, but only the last one does.
3693
3694 (Lance) Problem is caused by "set autochdir" in .vimrc.
3695 (drchip) I am able to duplicate this problem with |'acd'| set.
3696 It appears that the buffers are not exactly closed;
3697 a ":ls!" will show them (although ":ls" does not).
3698
Nir Lichtman1e34b952024-05-08 19:19:34 +02003699 *netrw-P17*
3700 P17. How to locally edit a file that's only available via {{{2
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003701 another server accessible via ssh?
3702 See http://stackoverflow.com/questions/12469645/
3703 "Using Vim to Remotely Edit A File on ServerB Only
3704 Accessible From ServerA"
3705
Nir Lichtman1e34b952024-05-08 19:19:34 +02003706 *netrw-P18*
3707 P18. How do I get numbering on in directory listings? {{{2
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003708 With |g:netrw_bufsettings|, you can control netrw's buffer
3709 settings; try putting >
3710 let g:netrw_bufsettings="noma nomod nu nobl nowrap ro nornu"
3711< in your .vimrc. If you'd like to have relative numbering
3712 instead, try >
3713 let g:netrw_bufsettings="noma nomod nonu nobl nowrap ro rnu"
3714<
Nir Lichtman1e34b952024-05-08 19:19:34 +02003715 *netrw-P19*
3716 P19. How may I have gvim start up showing a directory listing? {{{2
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003717 Try putting the following code snippet into your .vimrc: >
3718 augroup VimStartup
3719 au!
3720 au VimEnter * if expand("%") == "" && argc() == 0 &&
3721 \ (v:servername =~ 'GVIM\d*' || v:servername == "")
3722 \ | e . | endif
3723 augroup END
3724< You may use Lexplore instead of "e" if you're so inclined.
3725 This snippet assumes that you have client-server enabled
3726 (ie. a "huge" vim version).
3727
Nir Lichtman1e34b952024-05-08 19:19:34 +02003728 *netrw-P20*
3729 P20. I've made a directory (or file) with an accented character, {{{2
Bram Moolenaar85850f32019-07-19 22:05:51 +02003730 but netrw isn't letting me enter that directory/read that file:
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003731
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003732 Its likely that the shell or o/s is using a different encoding
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003733 than you have vim (netrw) using. A patch to vim supporting
3734 "systemencoding" may address this issue in the future; for
3735 now, just have netrw use the proper encoding. For example: >
3736
3737 au FileType netrw set enc=latin1
3738<
Nir Lichtman1e34b952024-05-08 19:19:34 +02003739 *netrw-P21*
3740 P21. I get an error message when I try to copy or move a file: {{{2
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003741
3742 **error** (netrw) tried using g:netrw_localcopycmd<cp>; it doesn't work!
3743
3744 What's wrong?
3745
3746 Netrw uses several system level commands to do things (see
3747
3748 |g:netrw_localcopycmd|, |g:netrw_localmovecmd|,
K.Takata71d0ba02024-01-10 03:21:05 +09003749 |g:netrw_mkdir_cmd|).
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003750
3751 You may need to adjust the default commands for one or more of
3752 these commands by setting them properly in your .vimrc. Another
3753 source of difficulty is that these commands use vim's local
3754 directory, which may not be the same as the browsing directory
3755 shown by netrw (see |g:netrw_keepdir|).
3756
3757
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003758==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +0000375911. Debugging Netrw Itself *netrw-debug* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +00003760
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003761Step 1: check that the problem you've encountered hasn't already been resolved
3762by obtaining a copy of the latest (often developmental) netrw at:
3763
3764 http://www.drchip.org/astronaut/vim/index.html#NETRW
3765
3766The <netrw.vim> script is typically installed on systems as something like:
Bram Moolenaar488c6512005-08-11 20:09:58 +00003767>
Bram Moolenaar8024f932020-01-14 19:29:13 +01003768 /usr/local/share/vim/vim8x/plugin/netrwPlugin.vim
3769 /usr/local/share/vim/vim8x/autoload/netrw.vim
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003770 (see output of :echo &rtp)
Bram Moolenaar488c6512005-08-11 20:09:58 +00003771<
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003772which is loaded automatically at startup (assuming :set nocp). If you
3773installed a new netrw, then it will be located at >
3774
3775 $HOME/.vim/plugin/netrwPlugin.vim
3776 $HOME/.vim/autoload/netrw.vim
3777<
3778Step 2: assuming that you've installed the latest version of netrw,
3779check that your problem is really due to netrw. Create a file
3780called netrw.vimrc with the following contents: >
3781
3782 set nocp
3783 so $HOME/.vim/plugin/netrwPlugin.vim
3784<
3785Then run netrw as follows: >
3786
Bram Moolenaare0fa3742016-02-20 15:47:01 +01003787 vim -u netrw.vimrc --noplugins -i NONE [some path here]
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003788<
3789Perform whatever netrw commands you need to, and check that the problem is
3790still present. This procedure sidesteps any issues due to personal .vimrc
Bram Moolenaare0fa3742016-02-20 15:47:01 +01003791settings, .viminfo file, and other plugins. If the problem does not appear,
3792then you need to determine which setting in your .vimrc is causing the
3793conflict with netrw or which plugin(s) is/are involved.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003794
3795Step 3: If the problem still is present, then get a debugging trace from
3796netrw:
Bram Moolenaar071d4272004-06-13 20:20:40 +00003797
3798 1. Get the <Decho.vim> script, available as:
3799
Bram Moolenaar97d62492012-11-15 21:28:22 +01003800 http://www.drchip.org/astronaut/vim/index.html#DECHO
Bram Moolenaar071d4272004-06-13 20:20:40 +00003801 or
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00003802 http://vim.sourceforge.net/scripts/script.php?script_id=120
Bram Moolenaar071d4272004-06-13 20:20:40 +00003803
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02003804 Decho.vim is provided as a "vimball"; see |vimball-intro|. You
3805 should edit the Decho.vba.gz file and source it in: >
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00003806
Bram Moolenaar938ae282023-02-20 20:44:55 +00003807 vim Decho.vba.gz
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02003808 :so %
3809 :q
3810<
3811 2. To turn on debug tracing in netrw, then edit the <netrw.vim>
3812 file by typing: >
Bram Moolenaard4755bb2004-09-02 19:12:26 +00003813
3814 vim netrw.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +00003815 :DechoOn
Bram Moolenaard4755bb2004-09-02 19:12:26 +00003816 :wq
Bram Moolenaar446cb832008-06-24 21:56:24 +00003817<
3818 To restore to normal non-debugging behavior, re-edit <netrw.vim>
3819 and type >
Bram Moolenaar071d4272004-06-13 20:20:40 +00003820
Bram Moolenaard4755bb2004-09-02 19:12:26 +00003821 vim netrw.vim
3822 :DechoOff
3823 :wq
Bram Moolenaar446cb832008-06-24 21:56:24 +00003824<
Bram Moolenaard4755bb2004-09-02 19:12:26 +00003825 This command, provided by <Decho.vim>, will comment out all
3826 Decho-debugging statements (Dfunc(), Dret(), Decho(), Dredir()).
3827
Bram Moolenaar446cb832008-06-24 21:56:24 +00003828 3. Then bring up vim and attempt to evoke the problem by doing a
3829 transfer or doing some browsing. A set of messages should appear
3830 concerning the steps that <netrw.vim> took in attempting to
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003831 read/write your file over the network in a separate tab or
3832 server vim window.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003833
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02003834 Change the netrw.vimrc file to include the Decho plugin: >
3835
3836 set nocp
3837 so $HOME/.vim/plugin/Decho.vim
3838 so $HOME/.vim/plugin/netrwPlugin.vim
3839<
3840 You should continue to run vim with >
3841
3842 vim -u netrw.vimrc --noplugins -i NONE [some path here]
3843<
3844 to avoid entanglements with options and other plugins.
3845
3846 To save the file: under linux, the output will be in a separate
3847 remote server window; in it, just save the file with >
3848
Bram Moolenaar938ae282023-02-20 20:44:55 +00003849 :w! DBG
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02003850
3851< Under a vim that doesn't support clientserver, your debugging
3852 output will appear in another tab: >
Bram Moolenaar8d043172014-01-23 14:24:41 +01003853
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003854 :tabnext
Bram Moolenaar9964e462007-05-05 17:54:07 +00003855 :set bt=
3856 :w! DBG
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02003857<
3858 Furthermore, it'd be helpful if you would type >
Bram Moolenaar8d043172014-01-23 14:24:41 +01003859
Bram Moolenaara6878372014-03-22 21:02:50 +01003860 :Dsep <command>
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02003861
Bram Moolenaara6878372014-03-22 21:02:50 +01003862< where <command> is the command you're about to type next,
3863 thereby making it easier to associate which part of the
3864 debugging trace is due to which command.
Bram Moolenaar8d043172014-01-23 14:24:41 +01003865
Christian Brabandtc5e24ee2024-07-13 18:19:03 +02003866 For bug reports, please see |bugs|.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003867==============================================================================
Bram Moolenaar9964e462007-05-05 17:54:07 +0000386812. History *netrw-history* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +00003869
K.Takata71d0ba02024-01-10 03:21:05 +09003870 v172: Sep 02, 2021 * (Bram Moolenaar) Changed "l:go" to "go"
3871 * (Bram Moolenaar) no need for "b" in
3872 netrw-safe guioptions
3873 Nov 15, 2021 * removed netrw_localrm and netrw_localrmdir
3874 references
zeertzjq8feed3a2024-09-29 10:37:47 +02003875 Aug 18, 2022 * (Miguel Barro) improving compatibility with
K.Takata71d0ba02024-01-10 03:21:05 +09003876 powershell
Bram Moolenaar89a9c152021-08-29 21:55:35 +02003877 v171: Oct 09, 2020 * included code in s:NetrwOptionsSafe()
3878 to allow |'bh'| to be set to delete when
3879 rather than hide when g:netrw_fastbrowse
3880 was zero.
3881 * Installed |g:netrw_clipboard| setting
3882 * Installed option bypass for |'guioptions'|
3883 a/A settings
Bram Moolenaarb529cfb2022-07-25 15:42:07 +01003884 * Changed popup_beval() to |popup_atcursor()|
Bram Moolenaar89a9c152021-08-29 21:55:35 +02003885 in netrw#ErrorMsg (lacygoill). Apparently
3886 popup_beval doesn't reliably close the
3887 popup when the mouse is moved.
3888 * VimEnter() now using win_execute to examine
3889 buffers for an attempt to open a directory.
3890 Avoids issues with popups/terminal from
3891 command line. (lacygoill)
3892 Jun 28, 2021 * (zeertzjq) provided a patch for use of
3893 xmap,xno instead of vmap,vno in
3894 netrwPlugin.vim. Avoids entanglement with
3895 select mode.
3896 Jul 14, 2021 * Fixed problem addressed by tst976; opening
3897 a file using tree mode, going up a
3898 directory, and opening a file there was
3899 opening the file in the wrong directory.
3900 Jul 28, 2021 * (Ingo Karkat) provided a patch fixing an
3901 E488 error with netrwPlugin.vim
3902 (occurred for vim versions < 8.02)
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02003903 v170: Mar 11, 2020 * (reported by Reiner Herrmann) netrw+tree
3904 would not hide with the ^\..* pattern
3905 correctly.
3906 * (Marcin Szamotulski) NetrwOptionRestore
3907 did not restore options correctly that
3908 had a single quote in the option string.
3909 Apr 13, 2020 * implemented error handling via popup
3910 windows (see |popup_beval()|)
3911 Apr 30, 2020 * (reported by Manatsu Takahashi) while
3912 using Lexplore, a modified file could
3913 be overwritten. Sol'n: will not overwrite,
3914 but will emit an |E37| (although one cannot
3915 add an ! to override)
3916 Jun 07, 2020 * (reported by Jo Totland) repeatedly invoking
3917 :Lexplore and quitting it left unused
3918 hidden buffers. Netrw will now set netrw
Bram Moolenaar89a9c152021-08-29 21:55:35 +02003919 buffers created by :Lexplore to |'bh'|=wipe.
Bram Moolenaar29634562020-01-09 21:46:04 +01003920 v169: Dec 20, 2019 * (reported by amkarthik) that netrw's x
3921 (|netrw-x|) would throw an error when
3922 attempting to open a local directory.
3923 v168: Dec 12, 2019 * scp timeout error message not reported,
3924 hopefully now fixed (Shane Xb Qian)
Bram Moolenaar91359012019-11-30 17:57:03 +01003925 v167: Nov 29, 2019 * netrw does a save&restore on @* and @+.
3926 That causes problems with the clipboard.
3927 Now restores occurs only if @* or @+ have
3928 been changed.
3929 * netrw will change @* or @+ less often.
3930 Never if I happen to have caught all the
3931 operations that modify the unnamed
3932 register (which also writes @*).
3933 * Modified hiding behavior so that "s"
3934 will not ignore hiding.
Bram Moolenaar5ef1c6a2019-11-10 22:09:11 +01003935 v166: Nov 06, 2019 * Removed a space from a nmap for "-"
3936 * Numerous debugging statement changes
Bram Moolenaar85850f32019-07-19 22:05:51 +02003937 v163: Dec 05, 2017 * (Cristi Balan) reported that a setting ('sel')
3938 was left changed
3939 * (Holger Mitschke) reported a problem with
3940 saving and restoring history. Fixed.
3941 * Hopefully I fixed a nasty bug that caused a
3942 file rename to wipe out a buffer that it
3943 should not have wiped out.
3944 * (Holger Mitschke) amended this help file
3945 with additional |g:netrw_special_syntax|
3946 items
Bram Moolenaar5ef1c6a2019-11-10 22:09:11 +01003947 * Prioritized wget over curl for
3948 g:netrw_http_cmd
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003949 v162: Sep 19, 2016 * (haya14busa) pointed out two syntax errors
3950 with a patch; these are now fixed.
3951 Oct 26, 2016 * I started using mate-terminal and found that
3952 x and gx (|netrw-x| and |netrw-gx|) were no
3953 longer working. Fixed (using atril when
3954 $DESKTOP_SESSION is "mate").
3955 Nov 04, 2016 * (Martin Vuille) pointed out that @+ was
3956 being restored with keepregstar rather than
3957 keepregplus.
3958 Nov 09, 2016 * Broke apart the command from the options,
3959 mostly for Windows. Introduced new netrw
3960 settings: |g:netrw_localcopycmdopt|
Bram Moolenaarb7398fe2023-05-14 18:50:25 +01003961 |g:netrw_localcopydircmdopt|
3962 |g:netrw_localmkdiropt|
3963 |g:netrw_localmovecmdopt|
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01003964 Nov 21, 2016 * (mattn) provided a patch for preview; swapped
3965 winwidth() with winheight()
3966 Nov 22, 2016 * (glacambre) reported that files containing
3967 spaces weren't being obtained properly via
3968 scp. Fix: apparently using single quotes
3969 such as with 'file name' wasn't enough; the
3970 spaces inside the quotes also had to be
3971 escaped (ie. 'file\ name').
3972 * Also fixed obtain (|netrw-O|) to be able to
3973 obtain files with spaces in their names
3974 Dec 20, 2016 * (xc1427) Reported that using "I" (|netrw-I|)
3975 when atop "Hiding" in the banner also caused
3976 the active-banner hiding control to occur
3977 Jan 03, 2017 * (Enno Nagel) reported that attempting to
3978 apply netrw to a directory that was without
3979 read permission caused a syntax error.
3980 Jan 13, 2017 * (Ingo Karkat) provided a patch which makes
3981 using netrw#Call() better. Now returns
3982 value of internal routines return, for example.
3983 Jan 13, 2017 * (Ingo Karkat) changed netrw#FileUrlRead to
3984 use |:edit| instead of |:read|. I also
3985 changed the routine name to netrw#FileUrlEdit.
3986 Jan 16, 2017 * (Sayem) reported a problem where :Lexplore
3987 could generate a new listing buffer and
3988 window instead of toggling the netrw display.
3989 Unfortunately, the directions for eliciting
3990 the problem weren't complete, so I may or
3991 may not have fixed that issue.
3992 Feb 06, 2017 * Implemented cb and cB. Changed "c" to "cd".
3993 (see |netrw-cb|, |netrw-cB|, and |netrw-cd|)
3994 Mar 21, 2017 * previously, netrw would specify (safe) settings
3995 even when the setting was already safe for
3996 netrw. Netrw now attempts to leave such
3997 already-netrw-safe settings alone.
3998 (affects s:NetrwOptionRestore() and
3999 s:NetrwSafeOptions(); also introduced
4000 s:NetrwRestoreSetting())
4001 Jun 26, 2017 * (Christian Brabandt) provided a patch to
4002 allow curl to follow redirects (ie. -L
4003 option)
4004 Jun 26, 2017 * (Callum Howard) reported a problem with
4005 :Lexpore not removing the Lexplore window
4006 after a change-directory
4007 Aug 30, 2017 * (Ingo Karkat) one cannot switch to the
4008 previously edited file (e.g. with CTRL-^)
4009 after editing a file:// URL. Patch to
4010 have a "keepalt" included.
4011 Oct 17, 2017 * (Adam Faryna) reported that gn (|netrw-gn|)
4012 did not work on directories in the current
4013 tree
4014 v157: Apr 20, 2016 * (Nicola) had set up a "nmap <expr> ..." with
4015 a function that returned a 0 while silently
4016 invoking a shell command. The shell command
4017 activated a ShellCmdPost event which in turn
4018 called s:LocalBrowseRefresh(). That looks
4019 over all netrw buffers for changes needing
4020 refreshes. However, inside a |:map-<expr>|,
4021 tab and window changes are disallowed. Fixed.
4022 (affects netrw's s:LocalBrowseRefresh())
K.Takata71d0ba02024-01-10 03:21:05 +09004023 * g:netrw_localrmdir not used any more, but
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01004024 the relevant patch that causes |delete()| to
4025 take over was #1107 (not #1109).
4026 * |expand()| is now used on |g:netrw_home|;
4027 consequently, g:netrw_home may now use
4028 environment variables
4029 * s:NetrwLeftmouse and s:NetrwCLeftmouse will
4030 return without doing anything if invoked
4031 when inside a non-netrw window
4032 Jun 15, 2016 * gx now calls netrw#GX() which returns
4033 the word under the cursor. The new
4034 wrinkle: if one is in a netrw buffer,
4035 then netrw's s:NetrwGetWord().
4036 Jun 22, 2016 * Netrw was executing all its associated
4037 Filetype commands silently; I'm going
4038 to try doing that "noisily" and see if
4039 folks have a problem with that.
4040 Aug 12, 2016 * Changed order of tool selection for
4041 handling http://... viewing.
4042 (Nikolay Aleksandrovich Pavlov)
4043 Aug 21, 2016 * Included hiding/showing/all for tree
4044 listings
4045 * Fixed refresh (^L) for tree listings
Bram Moolenaaraa3b15d2016-04-21 08:53:19 +02004046 v156: Feb 18, 2016 * Changed =~ to =~# where appropriate
4047 Feb 23, 2016 * s:ComposePath(base,subdir) now uses
4048 fnameescape() on the base portion
4049 Mar 01, 2016 * (gt_macki) reported where :Explore would
4050 make file unlisted. Fixed (tst943)
4051 Apr 04, 2016 * (reported by John Little) netrw normally
4052 suppresses browser messages, but sometimes
4053 those "messages" are what is wanted.
4054 See |g:netrw_suppress_gx_mesg|
4055 Apr 06, 2016 * (reported by Carlos Pita) deleting a remote
4056 file was giving an error message. Fixed.
4057 Apr 08, 2016 * (Charles Cooper) had a problem with an
4058 undefined b:netrw_curdir. He also provided
4059 a fix.
4060 Apr 20, 2016 * Changed s:NetrwGetBuffer(); now uses
4061 dictionaries. Also fixed the "No Name"
4062 buffer problem.
Bram Moolenaare0fa3742016-02-20 15:47:01 +01004063 v155: Oct 29, 2015 * (Timur Fayzrakhmanov) reported that netrw's
4064 mapping of ctrl-l was not allowing refresh of
4065 other windows when it was done in a netrw
4066 window.
4067 Nov 05, 2015 * Improved s:TreeSqueezeDir() to use search()
4068 instead of a loop
4069 * NetrwBrowse() will return line to
4070 w:netrw_bannercnt if cursor ended up in
4071 banner
4072 Nov 16, 2015 * Added a <Plug>NetrwTreeSqueeze (|netrw-s-cr|)
4073 Nov 17, 2015 * Commented out imaps -- perhaps someone can
4074 tell me how they're useful and should be
4075 retained?
4076 Nov 20, 2015 * Added |netrw-ma| and |netrw-mA| support
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01004077 Nov 20, 2015 * gx (|netrw-gx|) on a URL downloaded the
Bram Moolenaare0fa3742016-02-20 15:47:01 +01004078 file in addition to simply bringing up the
Bram Moolenaarb0d45e72017-11-05 18:19:24 +01004079 URL in a browser. Fixed.
Bram Moolenaare0fa3742016-02-20 15:47:01 +01004080 Nov 23, 2015 * Added |g:netrw_sizestyle| support
4081 Nov 27, 2015 * Inserted a lot of <c-u>s into various netrw
4082 maps.
4083 Jan 05, 2016 * |netrw-qL| implemented to mark files based
4084 upon |location-list|s; similar to |netrw-qF|.
4085 Jan 19, 2016 * using - call delete(directoryname,"d") -
4086 instead of using g:netrw_localrmdir if
4087 v7.4 + patch#1107 is available
4088 Jan 28, 2016 * changed to using |winsaveview()| and
4089 |winrestview()|
4090 Jan 28, 2016 * s:NetrwTreePath() now does a save and
4091 restore of view
4092 Feb 08, 2016 * Fixed a tree-listing problem with remote
4093 directories
Bram Moolenaara0f849e2015-10-30 14:37:44 +01004094 v154: Feb 26, 2015 * (Yuri Kanivetsky) reported a situation where
4095 a file was not treated properly as a file
4096 due to g:netrw_keepdir == 1
4097 Mar 25, 2015 * (requested by Ben Friz) one may now sort by
4098 extension
4099 Mar 28, 2015 * (requested by Matt Brooks) netrw has a lot
4100 of buffer-local mappings; however, some
4101 plugins (such as vim-surround) set up
4102 conflicting mappings that cause vim to wait.
4103 The "<nowait>" modifier has been included
4104 with most of netrw's mappings to avoid that
4105 delay.
zeertzjq8feed3a2024-09-29 10:37:47 +02004106 Jun 26, 2015 * |netrw-gn| mapping implemented
Bram Moolenaara0f849e2015-10-30 14:37:44 +01004107 * :Ntree NotADir resulted in having
4108 the tree listing expand in the error messages
4109 window. Fixed.
4110 Jun 29, 2015 * Attempting to delete a file remotely caused
4111 an error with "keepsol" mentioned; fixed.
4112 Jul 08, 2015 * Several changes to keep the |:jumps| table
4113 correct when working with
4114 |g:netrw_fastbrowse| set to 2
4115 * wide listing with accented characters fixed
4116 (using %-S instead of %-s with a |printf()|
4117 Jul 13, 2015 * (Daniel Hahler) CheckIfKde() could be true
4118 but kfmclient not installed. Changed order
4119 in netrw#BrowseX(): checks if kde and
4120 kfmclient, then will use xdg-open on a unix
4121 system (if xdg-open is executable)
4122 Aug 11, 2015 * (McDonnell) tree listing mode wouldn't
4123 select a file in a open subdirectory.
4124 * (McDonnell) when multiple subdirectories
4125 were concurrently open in tree listing
4126 mode, a ctrl-L wouldn't refresh properly.
4127 * The netrw:target menu showed duplicate
4128 entries
4129 Oct 13, 2015 * (mattn) provided an exception to handle
4130 windows with shellslash set but no shell
4131 Oct 23, 2015 * if g:netrw_usetab and <c-tab> now used
4132 to control whether NetrwShrink is used
4133 (see |netrw-c-tab|)
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01004134 v153: May 13, 2014 * added another |g:netrw_ffkeep| usage {{{2
4135 May 14, 2014 * changed s:PerformListing() so that it
4136 always sets ft=netrw for netrw buffers
4137 (ie. even when syntax highlighting is
4138 off, not available, etc)
4139 May 16, 2014 * introduced the |netrw-ctrl-r| functionality
4140 May 17, 2014 * introduced the |netrw-:NetrwMB| functionality
4141 * mb and mB (|netrw-mb|, |netrw-mB|) will
4142 add/remove marked files from bookmark list
4143 May 20, 2014 * (Enno Nagel) reported that :Lex <dirname>
4144 wasn't working. Fixed.
4145 May 26, 2014 * restored test to prevent leftmouse window
4146 resizing from causing refresh.
4147 (see s:NetrwLeftmouse())
4148 * fixed problem where a refresh caused cursor
4149 to go just under the banner instead of
4150 staying put
4151 May 28, 2014 * (László Bimba) provided a patch for opening
4152 the |:Lexplore| window 100% high, optionally
4153 on the right, and will work with remote
4154 files.
4155 May 29, 2014 * implemented :NetrwC (see |netrw-:NetrwC|)
4156 Jun 01, 2014 * Removed some "silent"s from commands used
4157 to implemented scp://... and pscp://...
4158 directory listing. Permits request for
4159 password to appear.
4160 Jun 05, 2014 * (Enno Nagel) reported that user maps "/"
4161 caused problems with "b" and "w", which
4162 are mapped (for wide listings only) to
4163 skip over files rather than just words.
4164 Jun 10, 2014 * |g:netrw_gx| introduced to allow users to
4165 override default "<cfile>" with the gx
4166 (|netrw-gx|) map
4167 Jun 11, 2014 * gx (|netrw-gx|), with |'autowrite'| set,
4168 will write modified files. s:NetrwBrowseX()
4169 will now save, turn off, and restore the
4170 |'autowrite'| setting.
4171 Jun 13, 2014 * added visual map for gx use
4172 Jun 15, 2014 * (Enno Nagel) reported that with having hls
4173 set and wide listing style in use, that the
4174 b and w maps caused unwanted highlighting.
4175 Jul 05, 2014 * |netrw-mv| and |netrw-mX| commands included
4176 Jul 09, 2014 * |g:netrw_keepj| included, allowing optional
4177 keepj
4178 Jul 09, 2014 * fixing bugs due to previous update
4179 Jul 21, 2014 * (Bruno Sutic) provided an updated
4180 netrw_gitignore.vim
4181 Jul 30, 2014 * (Yavuz Yetim) reported that editing two
4182 remote files of the same name caused the
4183 second instance to have a "temporary"
4184 name. Fixed: now they use the same buffer.
4185 Sep 18, 2014 * (Yasuhiro Matsumoto) provided a patch which
4186 allows scp and windows local paths to work.
4187 Oct 07, 2014 * gx (see |netrw-gx|) when atop a directory,
4188 will now do |gf| instead
4189 Nov 06, 2014 * For cygwin: cygstart will be available for
4190 netrw#BrowseX() to use if its executable.
4191 Nov 07, 2014 * Began support for file://... urls. Will use
4192 |g:netrw_file_cmd| (typically elinks or links)
4193 Dec 02, 2014 * began work on having mc (|netrw-mc|) copy
4194 directories. Works for linux machines,
4195 cygwin+vim, but not for windows+gvim.
4196 Dec 02, 2014 * in tree mode, netrw was not opening
4197 directories via symbolic links.
4198 Dec 02, 2014 * added resolved link information to
4199 thin and tree modes
4200 Dec 30, 2014 * (issue#231) |:ls| was not showing
4201 remote-file buffers reliably. Fixed.
4202 v152: Apr 08, 2014 * uses the |'noswapfile'| option (requires {{{2
Bram Moolenaar13600302014-05-22 18:26:40 +02004203 vim 7.4 with patch 213)
4204 * (Enno Nagel) turn |'rnu'| off in netrw
4205 buffers.
4206 * (Quinn Strahl) suggested that netrw
4207 allow regular window splitting to occur,
4208 thereby allowing |'equalalways'| to take
4209 effect.
4210 * (qingtian zhao) normally, netrw will
4211 save and restore the |'fileformat'|;
4212 however, sometimes that isn't wanted
4213 Apr 14, 2014 * whenever netrw marks a buffer as ro,
4214 it will also mark it as nomod.
4215 Apr 16, 2014 * sftp protocol now supported by
4216 netrw#Obtain(); this means that one
4217 may use "mc" to copy a remote file
4218 to a local file using sftp, and that
4219 the |netrw-O| command can obtain remote
4220 files via sftp.
4221 * added [count]C support (see |netrw-C|)
4222 Apr 18, 2014 * when |g:netrw_chgwin| is one more than
4223 the last window, then vertically split
4224 the last window and use it as the
4225 chgwin window.
4226 May 09, 2014 * SavePosn was "saving filename under cursor"
4227 from a non-netrw window when using :Rex.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01004228 v151: Jan 22, 2014 * extended :Rexplore to return to buffer {{{2
Bram Moolenaara6878372014-03-22 21:02:50 +01004229 prior to Explore or editing a directory
4230 * (Ken Takata) netrw gave error when
4231 clipboard was disabled. Sol'n: Placed
4232 several if has("clipboard") tests in.
4233 * Fixed ftp://X@Y@Z// problem; X@Y now
4234 part of user id, and only Z is part of
4235 hostname.
4236 * (A Loumiotis) reported that completion
4237 using a directory name containing spaces
4238 did not work. Fixed with a retry in
4239 netrw#Explore() which removes the
4240 backslashes vim inserted.
4241 Feb 26, 2014 * :Rexplore now records the current file
4242 using w:netrw_rexfile when returning via
4243 |:Rexplore|
4244 Mar 08, 2014 * (David Kotchan) provided some patches
4245 allowing netrw to work properly with
4246 windows shares.
4247 * Multiple one-liner help messages available
4248 by pressing <cr> while atop the "Quick
4249 Help" line
4250 * worked on ShellCmdPost, FocusGained event
4251 handling.
4252 * |:Lexplore| path: will be used to update
4253 a left-side netrw browsing directory.
Bram Moolenaare0fa3742016-02-20 15:47:01 +01004254 Mar 12, 2014 * |netrw-s-cr|: use <s-cr> to close
Bram Moolenaara6878372014-03-22 21:02:50 +01004255 tree directory implemented
4256 Mar 13, 2014 * (Tony Mechylynck) reported that using
4257 the browser with ftp on a directory,
4258 and selecting a gzipped txt file, that
4259 an E19 occurred (which was issued by
4260 gzip.vim). Fixed.
4261 Mar 14, 2014 * Implemented :MF and :MT (see |netrw-:MF|
4262 and |netrw-:MT|, respectively)
4263 Mar 17, 2014 * |:Ntree| [dir] wasn't working properly; fixed
4264 Mar 18, 2014 * Changed all uses of set to setl
4265 Mar 18, 2014 * Commented the netrw_btkeep line in
4266 s:NetrwOptionSave(); the effect is that
4267 netrw buffers will remain as |'bt'|=nofile.
4268 This should prevent swapfiles being created
4269 for netrw buffers.
4270 Mar 20, 2014 * Changed all uses of lcd to use s:NetrwLcd()
4271 instead. Consistent error handling results
4272 and it also handles Window's shares
4273 * Fixed |netrw-d| command when applied with ftp
4274 * https: support included for netrw#NetRead()
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01004275 v150: Jul 12, 2013 * removed a "keepalt" to allow ":e #" to {{{2
Bram Moolenaar8d043172014-01-23 14:24:41 +01004276 return to the netrw directory listing
4277 Jul 13, 2013 * (Jonas Diemer) suggested changing
4278 a <cWORD> to <cfile>.
4279 Jul 21, 2013 * (Yuri Kanivetsky) reported that netrw's
4280 use of mkdir did not produce directories
Bram Moolenaara6878372014-03-22 21:02:50 +01004281 following the user's umask.
Bram Moolenaar8d043172014-01-23 14:24:41 +01004282 Aug 27, 2013 * introduced |g:netrw_altfile| option
4283 Sep 05, 2013 * s:Strlen() now uses |strdisplaywidth()|
4284 when available, by default
4285 Sep 12, 2013 * (Selyano Baldo) reported that netrw wasn't
4286 opening some directories properly from the
4287 command line.
4288 Nov 09, 2013 * |:Lexplore| introduced
4289 * (Ondrej Platek) reported an issue with
4290 netrw's trees (P15). Fixed.
4291 * (Jorge Solis) reported that "t" in
4292 tree mode caused netrw to forget its
4293 line position.
4294 Dec 05, 2013 * Added <s-leftmouse> file marking
4295 (see |netrw-mf|)
4296 Dec 05, 2013 * (Yasuhiro Matsumoto) Explore should use
4297 strlen() instead s:Strlen() when handling
4298 multibyte chars with strpart()
4299 (ie. strpart() is byte oriented, not
4300 display-width oriented).
4301 Dec 09, 2013 * (Ken Takata) Provided a patch; File sizes
4302 and a portion of timestamps were wrongly
4303 highlighted with the directory color when
4304 setting `:let g:netrw_liststyle=1` on Windows.
4305 * (Paul Domaskis) noted that sometimes
4306 cursorline was activating in non-netrw
4307 windows. All but one setting of cursorline
4308 was done via setl; there was one that was
4309 overlooked. Fixed.
4310 Dec 24, 2013 * (esquifit) asked that netrw allow the
4311 /cygdrive prefix be a user-alterable
4312 parameter.
4313 Jan 02, 2014 * Fixed a problem with netrw-based ballon
4314 evaluation (ie. netrw#NetrwBaloonHelp()
4315 not having been loaded error messages)
4316 Jan 03, 2014 * Fixed a problem with tree listings
4317 * New command installed: |:Ntree|
4318 Jan 06, 2014 * (Ivan Brennan) reported a problem with
4319 |netrw-P|. Fixed.
4320 Jan 06, 2014 * Fixed a problem with |netrw-P| when the
4321 modified file was to be abandoned.
4322 Jan 15, 2014 * (Matteo Cavalleri) reported that when the
4323 banner is suppressed and tree listing is
4324 used, a blank line was left at the top of
4325 the display. Fixed.
4326 Jan 20, 2014 * (Gideon Go) reported that, in tree listing
4327 style, with a previous window open, that
4328 the wrong directory was being used to open
4329 a file. Fixed. (P21)
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01004330 v149: Apr 18, 2013 * in wide listing format, now have maps for {{{2
Bram Moolenaare6ae6222013-05-21 21:01:10 +02004331 w and b to move to next/previous file
4332 Apr 26, 2013 * one may now copy files in the same
4333 directory; netrw will issue requests for
4334 what names the files should be copied under
4335 Apr 29, 2013 * Trying Benzinger's problem again. Seems
4336 that commenting out the BufEnter and
4337 installing VimEnter (only) works. Weird
4338 problem! (tree listing, vim -O Dir1 Dir2)
4339 May 01, 2013 * :Explore ftp://... wasn't working. Fixed.
4340 May 02, 2013 * introduced |g:netrw_bannerbackslash| as
4341 requested by Paul Domaskis.
Bram Moolenaar8d043172014-01-23 14:24:41 +01004342 Jul 03, 2013 * Explore now avoids splitting when a buffer
4343 will be hidden.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01004344 v148: Apr 16, 2013 * changed Netrw's Style menu to allow direct {{{2
Bram Moolenaarff034192013-04-24 18:51:19 +02004345 choice of listing style, hiding style, and
4346 sorting style
Bram Moolenaar071d4272004-06-13 20:20:40 +00004347
4348==============================================================================
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100434913. Todo *netrw-todo* {{{1
4350
435107/29/09 : banner :|g:netrw_banner| can be used to suppress the
4352 suppression banner. This feature is new and experimental,
4353 so its in the process of being debugged.
435409/04/09 : "gp" : See if it can be made to work for remote systems.
4355 : See if it can be made to work with marked files.
4356
4357==============================================================================
435814. Credits *netrw-credits* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +00004359
4360 Vim editor by Bram Moolenaar (Thanks, Bram!)
4361 dav support by C Campbell
4362 fetch support by Bram Moolenaar and C Campbell
Bram Moolenaar29634562020-01-09 21:46:04 +01004363 ftp support by C Campbell <NcampObell@SdrPchip.AorgM-NOSPAM>
Bram Moolenaar071d4272004-06-13 20:20:40 +00004364 http support by Bram Moolenaar <bram@moolenaar.net>
4365 rcp
4366 rsync support by C Campbell (suggested by Erik Warendorph)
4367 scp support by raf <raf@comdyn.com.au>
4368 sftp support by C Campbell
4369
4370 inputsecret(), BufReadCmd, BufWriteCmd contributed by C Campbell
4371
4372 Jérôme Augé -- also using new buffer method with ftp+.netrc
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00004373 Bram Moolenaar -- obviously vim itself, :e and v:cmdarg use,
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +00004374 fetch,...
Bram Moolenaar071d4272004-06-13 20:20:40 +00004375 Yasuhiro Matsumoto -- pointing out undo+0r problem and a solution
4376 Erik Warendorph -- for several suggestions (g:netrw_..._cmd
4377 variables, rsync etc)
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00004378 Doug Claar -- modifications to test for success with ftp
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +00004379 operation
Bram Moolenaar071d4272004-06-13 20:20:40 +00004380
4381==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00004382Modelines: {{{1
Bram Moolenaar1d59aa12020-09-19 18:50:13 +02004383vim:tw=78:ts=8:ft=help:noet:norl:fdm=marker