blob: 3f705d4ba147b9c1921535e41f8748cd3e1377f0 [file] [log] [blame]
Bram Moolenaaraa3b15d2016-04-21 08:53:19 +02001*pi_netrw.txt* For Vim version 7.4. Last change: 2016 Apr 20
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 ------------------------------------------------
6Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM>
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01007 (remove NOSPAM from Campbell's email first)
8
Bram Moolenaare0fa3742016-02-20 15:47:01 +01009Copyright: Copyright (C) 2016 Charles E Campbell *netrw-copyright*
Bram Moolenaar5b435d62012-04-05 17:33:26 +020010 The VIM LICENSE applies to the files in this package, including
11 netrw.vim, pi_netrw.txt, netrwFileHandlers.vim, netrwSettings.vim, and
12 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
18 software. Use at your own risk!
Bram Moolenaar071d4272004-06-13 20:20:40 +000019
Bram Moolenaar1afcace2005-11-25 19:54:28 +000020
Bram Moolenaar8feef4f2015-01-07 16:57:10 +010021 *netrw*
Bram Moolenaar00a927d2010-05-14 23:24:24 +020022 *dav* *ftp* *netrw-file* *rcp* *scp*
23 *davs* *http* *netrw.vim* *rsync* *sftp*
Bram Moolenaar8feef4f2015-01-07 16:57:10 +010024 *fetch* *network*
Bram Moolenaar071d4272004-06-13 20:20:40 +000025
26==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +0000271. Contents *netrw-contents* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000028
Bram Moolenaarff034192013-04-24 18:51:19 +0200291. Contents..............................................|netrw-contents|
302. Starting With Netrw...................................|netrw-start|
313. Netrw Reference.......................................|netrw-ref|
32 EXTERNAL APPLICATIONS AND PROTOCOLS.................|netrw-externapp|
33 READING.............................................|netrw-read|
34 WRITING.............................................|netrw-write|
35 SOURCING............................................|netrw-source|
36 DIRECTORY LISTING...................................|netrw-dirlist|
37 CHANGING THE USERID AND PASSWORD....................|netrw-chgup|
38 VARIABLES AND SETTINGS..............................|netrw-variables|
39 PATHS...............................................|netrw-path|
404. Network-Oriented File Transfer........................|netrw-xfer|
41 NETRC...............................................|netrw-netrc|
42 PASSWORD............................................|netrw-passwd|
435. Activation............................................|netrw-activate|
446. Transparent Remote File Editing.......................|netrw-transparent|
457. Ex Commands...........................................|netrw-ex|
468. Variables and Options.................................|netrw-variables|
479. Browsing..............................................|netrw-browse|
48 Introduction To Browsing............................|netrw-intro-browse|
49 Quick Reference: Maps...............................|netrw-browse-maps|
50 Quick Reference: Commands...........................|netrw-browse-cmds|
Bram Moolenaare0fa3742016-02-20 15:47:01 +010051 Banner Display......................................|netrw-I|
Bram Moolenaarff034192013-04-24 18:51:19 +020052 Bookmarking A Directory.............................|netrw-mb|
53 Browsing............................................|netrw-cr|
Bram Moolenaare0fa3742016-02-20 15:47:01 +010054 Squeezing the Current Tree-Listing Directory........|netrw-s-cr|
Bram Moolenaarff034192013-04-24 18:51:19 +020055 Browsing With A Horizontally Split Window...........|netrw-o|
56 Browsing With A New Tab.............................|netrw-t|
57 Browsing With A Vertically Split Window.............|netrw-v|
58 Change Listing Style.(thin wide long tree)..........|netrw-i|
59 Changing To A Bookmarked Directory..................|netrw-gb|
60 Changing To A Predecessor Directory.................|netrw-u|
61 Changing To A Successor Directory...................|netrw-U|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +010062 Customizing Browsing With A Special Handler.........|netrw-x|
Bram Moolenaarff034192013-04-24 18:51:19 +020063 Deleting Bookmarks..................................|netrw-mB|
64 Deleting Files Or Directories.......................|netrw-D|
65 Directory Exploring Commands........................|netrw-explore|
66 Exploring With Stars and Patterns...................|netrw-star|
67 Displaying Information About File...................|netrw-qf|
68 Edit File Or Directory Hiding List..................|netrw-ctrl-h|
69 Editing The Sorting Sequence........................|netrw-S|
70 Forcing treatment as a file or directory............|netrw-gd| |netrw-gf|
71 Going Up............................................|netrw--|
72 Hiding Files Or Directories.........................|netrw-a|
73 Improving Browsing..................................|netrw-ssh-hack|
74 Listing Bookmarks And History.......................|netrw-qb|
75 Making A New Directory..............................|netrw-d|
76 Making The Browsing Directory The Current Directory.|netrw-c|
77 Marking Files.......................................|netrw-mf|
78 Unmarking Files.....................................|netrw-mF|
Bram Moolenaare0fa3742016-02-20 15:47:01 +010079 Marking Files By Location List......................|netrw-qL|
Bram Moolenaarff034192013-04-24 18:51:19 +020080 Marking Files By QuickFix List......................|netrw-qF|
81 Marking Files By Regular Expression.................|netrw-mr|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +010082 Marked Files: Arbitrary Shell Command...............|netrw-mx|
83 Marked Files: Arbitrary Shell Command, En Bloc......|netrw-mX|
84 Marked Files: Arbitrary Vim Command.................|netrw-mv|
Bram Moolenaare0fa3742016-02-20 15:47:01 +010085 Marked Files: Argument List.........................|netrw-ma| |netrw-mA|
Bram Moolenaarff034192013-04-24 18:51:19 +020086 Marked Files: Compression And Decompression.........|netrw-mz|
87 Marked Files: Copying...............................|netrw-mc|
88 Marked Files: Diff..................................|netrw-md|
89 Marked Files: Editing...............................|netrw-me|
90 Marked Files: Grep..................................|netrw-mg|
91 Marked Files: Hiding and Unhiding by Suffix.........|netrw-mh|
92 Marked Files: Moving................................|netrw-mm|
93 Marked Files: Printing..............................|netrw-mp|
94 Marked Files: Sourcing..............................|netrw-ms|
95 Marked Files: Setting the Target Directory..........|netrw-mt|
96 Marked Files: Tagging...............................|netrw-mT|
97 Marked Files: Target Directory Using Bookmarks......|netrw-Tb|
98 Marked Files: Target Directory Using History........|netrw-Th|
99 Marked Files: Unmarking.............................|netrw-mu|
100 Netrw Browser Variables.............................|netrw-browser-var|
101 Netrw Browsing And Option Incompatibilities.........|netrw-incompatible|
102 Netrw Settings Window...............................|netrw-settings-window|
103 Obtaining A File....................................|netrw-O|
104 Preview Window......................................|netrw-p|
105 Previous Window.....................................|netrw-P|
106 Refreshing The Listing..............................|netrw-ctrl-l|
107 Reversing Sorting Order.............................|netrw-r|
108 Renaming Files Or Directories.......................|netrw-R|
109 Selecting Sorting Style.............................|netrw-s|
110 Setting Editing Window..............................|netrw-C|
11110. Problems and Fixes....................................|netrw-problems|
11211. Debugging Netrw Itself................................|netrw-debug|
11312. History...............................................|netrw-history|
11413. Todo..................................................|netrw-todo|
11514. Credits...............................................|netrw-credits|
Bram Moolenaar071d4272004-06-13 20:20:40 +0000116
Bram Moolenaar071d4272004-06-13 20:20:40 +0000117{Vi does not have any of this}
118
119==============================================================================
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 Moolenaare6ae6222013-05-21 21:01:10 +0200158Netrw 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
212 http: g:netrw_http_cmd = "fetch" elseif fetch is available
213 http: *g:netrw_http_put_cmd* = "curl -T"
214 rcp: *g:netrw_rcp_cmd* = "rcp"
215 rsync: *g:netrw_rsync_cmd* = "rsync -a"
216 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 Moolenaar8f3f58f2010-01-06 20:52:26 +0100226 curl : "-o"
227 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
241 Generally, one may just use the url notation with a normal editing
242 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
263 One may just use the url notation with a normal file writing
264 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
284 One may just use the url notation with the normal file sourcing
285 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 Moolenaar7aa9f6a2007-05-10 18:00:30 +0000442 *g:netrw_use_errorwindow* =1 : messages from netrw will use a separate one
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200443 line window. This window provides reliable
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200444 delivery of messages. (default)
445 =0 : messages from netrw will use echoerr ;
446 messages don't always seem to show up this
447 way, but one doesn't have to quit the window.
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000448
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000449 *g:netrw_win95ftp* =1 if using Win95, will remove four trailing blank
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200450 lines that o/s's ftp "provides" on transfers
451 =0 force normal ftp behavior (no trailing line removal)
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +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
482Network-oriented file transfer under Vim is implemented by a VimL-based 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
535 doesn't work, so its best to leave it off for that system)
536
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
Bram Moolenaar9964e462007-05-05 17:54:07 +0000642 (*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 Moolenaarc01140a2006-03-24 22:21:52 +0000730
Bram Moolenaar071d4272004-06-13 20:20:40 +0000731==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00007327. Ex Commands *netrw-ex* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000733
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000734The usual read/write commands are supported. There are also a few
Bram Moolenaar446cb832008-06-24 21:56:24 +0000735additional commands available. Often you won't need to use Nwrite or
Bram Moolenaar9964e462007-05-05 17:54:07 +0000736Nread as shown in |netrw-transparent| (ie. simply use >
737 :e url
738 :r url
739 :w url
740instead, as appropriate) -- see |netrw-urls|. In the explanations
741below, a {netfile} is an url to a remote file.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000742
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200743 *:Nwrite* *:Nw*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000744:[range]Nw[rite] Write the specified lines to the current
Bram Moolenaar071d4272004-06-13 20:20:40 +0000745 file as specified in b:netrw_lastfile.
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200746 (related: |netrw-nwrite|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000747
Bram Moolenaar446cb832008-06-24 21:56:24 +0000748:[range]Nw[rite] {netfile} [{netfile}]...
Bram Moolenaar071d4272004-06-13 20:20:40 +0000749 Write the specified lines to the {netfile}.
750
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200751 *:Nread* *:Nr*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100752:Nr[ead] Read the lines from the file specified in b:netrw_lastfile
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200753 into the current buffer. (related: |netrw-nread|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000754
Bram Moolenaar446cb832008-06-24 21:56:24 +0000755:Nr[ead] {netfile} {netfile}...
Bram Moolenaar071d4272004-06-13 20:20:40 +0000756 Read the {netfile} after the current line.
757
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200758 *:Nsource* *:Ns*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000759:Ns[ource] {netfile}
Bram Moolenaar9964e462007-05-05 17:54:07 +0000760 Source the {netfile}.
761 To start up vim using a remote .vimrc, one may use
762 the following (all on one line) (tnx to Antoine Mechelynck) >
763 vim -u NORC -N
764 --cmd "runtime plugin/netrwPlugin.vim"
765 --cmd "source scp://HOSTNAME/.vimrc"
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200766< (related: |netrw-source|)
767
768:call NetUserPass() *NetUserPass()*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000769 If g:netrw_uid and s:netrw_passwd don't exist,
770 this function will query the user for them.
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200771 (related: |netrw-userpass|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000772
773:call NetUserPass("userid")
Bram Moolenaar446cb832008-06-24 21:56:24 +0000774 This call will set the g:netrw_uid and, if
Bram Moolenaar071d4272004-06-13 20:20:40 +0000775 the password doesn't exist, will query the user for it.
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200776 (related: |netrw-userpass|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000777
778:call NetUserPass("userid","passwd")
Bram Moolenaar446cb832008-06-24 21:56:24 +0000779 This call will set both the g:netrw_uid and s:netrw_passwd.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000780 The user-id and password are used by ftp transfers. One may
Bram Moolenaar446cb832008-06-24 21:56:24 +0000781 effectively remove the user-id and password by using empty
782 strings (ie. "").
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200783 (related: |netrw-userpass|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000784
Bram Moolenaar9964e462007-05-05 17:54:07 +0000785:NetrwSettings This command is described in |netrw-settings| -- used to
786 display netrw settings and change netrw behavior.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000787
Bram Moolenaar071d4272004-06-13 20:20:40 +0000788
789==============================================================================
Bram Moolenaar13600302014-05-22 18:26:40 +02007908. Variables and Options *netrw-var* *netrw-settings* {{{1
Bram Moolenaar446cb832008-06-24 21:56:24 +0000791
Bram Moolenaar15146672011-10-20 22:22:38 +0200792(also see: |netrw-options| |netrw-variables| |netrw-protocol|
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200793 |netrw-browser-settings| |netrw-browser-options| )
Bram Moolenaar071d4272004-06-13 20:20:40 +0000794
Bram Moolenaar9964e462007-05-05 17:54:07 +0000795The <netrw.vim> script provides several variables which act as options to
Bram Moolenaar446cb832008-06-24 21:56:24 +0000796affect <netrw.vim>'s file transfer behavior. These variables typically may be
797set in the user's <.vimrc> file: (see also |netrw-settings| |netrw-protocol|)
Bram Moolenaar15146672011-10-20 22:22:38 +0200798 *netrw-options*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000799>
Bram Moolenaar9964e462007-05-05 17:54:07 +0000800 -------------
801 Netrw Options
802 -------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000803 Option Meaning
804 -------------- -----------------------------------------------
805<
Bram Moolenaar9964e462007-05-05 17:54:07 +0000806 b:netrw_col Holds current cursor position (during NetWrite)
807 g:netrw_cygwin =1 assume scp under windows is from cygwin
808 (default/windows)
809 =0 assume scp under windows accepts windows
810 style paths (default/else)
811 g:netrw_ftp =0 use default ftp (uid password)
812 g:netrw_ftpmode ="binary" (default)
813 ="ascii" (your choice)
814 g:netrw_ignorenetrc =1 (default)
815 if you have a <.netrc> file but you don't
Bram Moolenaar071d4272004-06-13 20:20:40 +0000816 want it used, then set this variable. Its
817 mere existence is enough to cause <.netrc>
818 to be ignored.
Bram Moolenaar9964e462007-05-05 17:54:07 +0000819 b:netrw_lastfile Holds latest method/machine/path.
820 b:netrw_line Holds current line number (during NetWrite)
Bram Moolenaar9964e462007-05-05 17:54:07 +0000821 g:netrw_silent =0 transfers done normally
822 =1 transfers done silently
823 g:netrw_uid Holds current user-id for ftp.
Bram Moolenaar9964e462007-05-05 17:54:07 +0000824 g:netrw_use_nt_rcp =0 don't use WinNT/2K/XP's rcp (default)
825 =1 use WinNT/2K/XP's rcp, binary mode
826 g:netrw_win95ftp =0 use unix-style ftp even if win95/98/ME/etc
827 =1 use default method to do ftp >
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 Moolenaar8feef4f2015-01-07 16:57:10 +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"
873 g:netrw_rsync_cmd var ="rsync -a"
874 g:netrw_scp_cmd var ="scp -q"
875 g:netrw_sftp_cmd var ="sftp" >
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000876 -------------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000877<
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000878 *netrw-ftp*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000879
Bram Moolenaar9964e462007-05-05 17:54:07 +0000880The g:netrw_..._cmd options (|g:netrw_ftp_cmd| and |g:netrw_sftp_cmd|)
881specify the external program to use handle the ftp protocol. They may
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200882include command line options (such as -p for passive mode). Example: >
Bram Moolenaar071d4272004-06-13 20:20:40 +0000883
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200884 let g:netrw_ftp_cmd= "ftp -p"
885<
Bram Moolenaar9964e462007-05-05 17:54:07 +0000886Browsing is supported by using the |g:netrw_list_cmd|; the substring
887"HOSTNAME" will be changed via substitution with whatever the current request
888is for a hostname.
889
890Two options (|g:netrw_ftp| and |netrw-fixup|) both help with certain ftp's
891that give trouble . In order to best understand how to use these options if
892ftp is giving you troubles, a bit of discussion is provided on how netrw does
893ftp reads.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000894
895For ftp, netrw typically builds up lines of one of the following formats in a
Bram Moolenaar071d4272004-06-13 20:20:40 +0000896temporary file:
897>
898 IF g:netrw_ftp !exists or is not 1 IF g:netrw_ftp exists and is 1
899 ---------------------------------- ------------------------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000900<
Bram Moolenaar9964e462007-05-05 17:54:07 +0000901 open machine [port] open machine [port]
902 user userid password userid password
903 [g:netrw_ftpmode] password
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200904 [g:netrw_ftpextracmd] [g:netrw_ftpmode]
Bram Moolenaar9964e462007-05-05 17:54:07 +0000905 get filename tempfile [g:netrw_extracmd]
906 get filename tempfile >
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000907 ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000908<
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200909The |g:netrw_ftpmode| and |g:netrw_ftpextracmd| are optional.
Bram Moolenaar9964e462007-05-05 17:54:07 +0000910
Bram Moolenaar071d4272004-06-13 20:20:40 +0000911Netrw then executes the lines above by use of a filter:
912>
913 :%! {g:netrw_ftp_cmd} -i [-n]
914<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000915where
916 g:netrw_ftp_cmd is usually "ftp",
917 -i tells ftp not to be interactive
918 -n means don't use netrc and is used for Method #3 (ftp w/o <.netrc>)
919
920If <.netrc> exists it will be used to avoid having to query the user for
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000921userid and password. The transferred file is put into a temporary file.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000922The temporary file is then read into the main editing session window that
923requested it and the temporary file deleted.
924
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000925If your ftp doesn't accept the "user" command and immediately just demands a
926userid, then try putting "let netrw_ftp=1" in your <.vimrc>.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000927
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000928 *netrw-cadaver*
929To handle the SSL certificate dialog for untrusted servers, one may pull
930down the certificate and place it into /usr/ssl/cert.pem. This operation
931renders the server treatment as "trusted".
932
Bram Moolenaar433f7c82006-03-21 21:29:36 +0000933 *netrw-fixup* *netreadfixup*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000934If your ftp for whatever reason generates unwanted lines (such as AUTH
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100935messages) you may write a NetReadFixup() function:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000936>
937 function! NetReadFixup(method,line1,line2)
938 " a:line1: first new line in current file
939 " a:line2: last new line in current file
940 if a:method == 1 "rcp
941 elseif a:method == 2 "ftp + <.netrc>
942 elseif a:method == 3 "ftp + machine,uid,password,filename
943 elseif a:method == 4 "scp
944 elseif a:method == 5 "http/wget
945 elseif a:method == 6 "dav/cadaver
946 elseif a:method == 7 "rsync
947 elseif a:method == 8 "fetch
948 elseif a:method == 9 "sftp
Bram Moolenaar9964e462007-05-05 17:54:07 +0000949 else " complain
Bram Moolenaar071d4272004-06-13 20:20:40 +0000950 endif
951 endfunction
952>
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000953The NetReadFixup() function will be called if it exists and thus allows you to
954customize your reading process. As a further example, <netrw.vim> contains
955just such a function to handle Windows 95 ftp. For whatever reason, Windows
95695's ftp dumps four blank lines at the end of a transfer, and so it is
957desirable to automate their removal. Here's some code taken from <netrw.vim>
958itself:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000959>
960 if has("win95") && g:netrw_win95ftp
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000961 fun! NetReadFixup(method, line1, line2)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000962 if method == 3 " ftp (no <.netrc>)
Bram Moolenaar9964e462007-05-05 17:54:07 +0000963 let fourblanklines= line2 - 3
964 silent fourblanklines.",".line2."g/^\s*/d"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000965 endif
966 endfunction
967 endif
968>
Bram Moolenaare6ae6222013-05-21 21:01:10 +0200969(Related topics: |ftp| |netrw-userpass| |netrw-start|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000970
971==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00009729. Browsing *netrw-browsing* *netrw-browse* *netrw-help* {{{1
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100973 *netrw-browser* *netrw-dir* *netrw-list*
Bram Moolenaar83bab712005-08-01 21:58:57 +0000974
Bram Moolenaar446cb832008-06-24 21:56:24 +0000975INTRODUCTION TO BROWSING *netrw-intro-browse* {{{2
976 (Quick References: |netrw-quickmaps| |netrw-quickcoms|)
Bram Moolenaar83bab712005-08-01 21:58:57 +0000977
Bram Moolenaar446cb832008-06-24 21:56:24 +0000978Netrw supports the browsing of directories on your local system and on remote
979hosts; browsing includes listing files and directories, entering directories,
980editing files therein, deleting files/directories, making new directories,
981moving (renaming) files and directories, copying files and directories, etc.
982One may mark files and execute any system command on them! The Netrw browser
983generally implements the previous explorer's maps and commands for remote
984directories, although details (such as pertinent global variable names)
985necessarily differ. To browse a directory, simply "edit" it! >
Bram Moolenaar269ec652004-07-29 08:43:53 +0000986
Bram Moolenaar446cb832008-06-24 21:56:24 +0000987 vim /your/directory/
988 vim .
989 vim c:\your\directory\
990<
991(Related topics: |netrw-cr| |netrw-o| |netrw-p| |netrw-P| |netrw-t|
992 |netrw-mf| |netrw-mx| |netrw-D| |netrw-R| |netrw-v| )
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000993
994The Netrw remote file and directory browser handles two protocols: ssh and
Bram Moolenaar446cb832008-06-24 21:56:24 +0000995ftp. The protocol in the url, if it is ftp, will cause netrw also to use ftp
996in its remote browsing. Specifying any other protocol will cause it to be
997used for file transfers; but the ssh protocol will be used to do remote
998browsing.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000999
Bram Moolenaar446cb832008-06-24 21:56:24 +00001000To use Netrw's remote directory browser, simply attempt to read a "file" with
1001a trailing slash and it will be interpreted as a request to list a directory:
1002>
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001003 vim [protocol]://[user@]hostname/path/
Bram Moolenaar4ea8fe12006-03-09 22:32:39 +00001004<
Bram Moolenaar446cb832008-06-24 21:56:24 +00001005where [protocol] is typically scp or ftp. As an example, try: >
Bram Moolenaar4ea8fe12006-03-09 22:32:39 +00001006
Bram Moolenaar446cb832008-06-24 21:56:24 +00001007 vim ftp://ftp.home.vim.org/pub/vim/
1008<
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001009For local directories, the trailing slash is not required. Again, because it's
Bram Moolenaar446cb832008-06-24 21:56:24 +00001010easy to miss: to browse remote directories, the url must terminate with a
1011slash!
Bram Moolenaar83bab712005-08-01 21:58:57 +00001012
Bram Moolenaar446cb832008-06-24 21:56:24 +00001013If you'd like to avoid entering the password repeatedly for remote directory
1014listings with ssh or scp, see |netrw-ssh-hack|. To avoid password entry with
1015ftp, see |netrw-netrc| (if your ftp supports it).
Bram Moolenaar83bab712005-08-01 21:58:57 +00001016
Bram Moolenaar446cb832008-06-24 21:56:24 +00001017There are several things you can do to affect the browser's display of files:
Bram Moolenaar83bab712005-08-01 21:58:57 +00001018
Bram Moolenaar446cb832008-06-24 21:56:24 +00001019 * To change the listing style, press the "i" key (|netrw-i|).
1020 Currently there are four styles: thin, long, wide, and tree.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001021 To make that change "permanent", see |g:netrw_liststyle|.
Bram Moolenaar83bab712005-08-01 21:58:57 +00001022
Bram Moolenaar446cb832008-06-24 21:56:24 +00001023 * To hide files (don't want to see those xyz~ files anymore?) see
1024 |netrw-ctrl-h|.
Bram Moolenaar83bab712005-08-01 21:58:57 +00001025
Bram Moolenaar446cb832008-06-24 21:56:24 +00001026 * Press s to sort files by name, time, or size.
1027
1028See |netrw-browse-cmds| for all the things you can do with netrw!
1029
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001030 *netrw-getftype* *netrw-filigree* *netrw-ftype*
1031The |getftype()| function is used to append a bit of filigree to indicate
1032filetype to locally listed files:
1033
1034 directory : /
1035 executable : *
1036 fifo : |
1037 links : @
1038 sockets : =
1039
1040The filigree also affects the |g:netrw_sort_sequence|.
1041
Bram Moolenaar446cb832008-06-24 21:56:24 +00001042
1043QUICK HELP *netrw-quickhelp* {{{2
1044 (Use ctrl-] to select a topic)~
1045 Intro to Browsing...............................|netrw-intro-browse|
1046 Quick Reference: Maps.........................|netrw-quickmap|
1047 Quick Reference: Commands.....................|netrw-browse-cmds|
1048 Hiding
1049 Edit hiding list..............................|netrw-ctrl-h|
1050 Hiding Files or Directories...................|netrw-a|
1051 Hiding/Unhiding by suffix.....................|netrw-mh|
1052 Hiding dot-files.............................|netrw-gh|
1053 Listing Style
1054 Select listing style (thin/long/wide/tree)....|netrw-i|
1055 Associated setting variable...................|g:netrw_liststyle|
1056 Shell command used to perform listing.........|g:netrw_list_cmd|
1057 Quick file info...............................|netrw-qf|
1058 Sorted by
1059 Select sorting style (name/time/size).........|netrw-s|
1060 Editing the sorting sequence..................|netrw-S|
Bram Moolenaarc236c162008-07-13 17:41:49 +00001061 Sorting options...............................|g:netrw_sort_options|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001062 Associated setting variable...................|g:netrw_sort_sequence|
1063 Reverse sorting order.........................|netrw-r|
1064
1065
1066 *netrw-quickmap* *netrw-quickmaps*
1067QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00001068>
Bram Moolenaar446cb832008-06-24 21:56:24 +00001069 --- ----------------- ----
1070 Map Quick Explanation Link
1071 --- ----------------- ----
1072< <F1> Causes Netrw to issue help
1073 <cr> Netrw will enter the directory or read the file |netrw-cr|
1074 <del> Netrw will attempt to remove the file/directory |netrw-del|
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001075 <c-h> Edit file hiding list |netrw-ctrl-h|
1076 <c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l|
1077 <c-r> Browse using a gvim server |netrw-ctrl-r|
1078 <c-tab> Shrink/expand a netrw/explore window |netrw-c-tab|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001079 - Makes Netrw go up one directory |netrw--|
1080 a Toggles between normal display, |netrw-a|
Bram Moolenaar13600302014-05-22 18:26:40 +02001081 hiding (suppress display of files matching g:netrw_list_hide)
1082 showing (display only files which match g:netrw_list_hide)
Bram Moolenaar446cb832008-06-24 21:56:24 +00001083 c Make browsing directory the current directory |netrw-c|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001084 C Setting the editing window |netrw-C|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001085 d Make a directory |netrw-d|
1086 D Attempt to remove the file(s)/directory(ies) |netrw-D|
1087 gb Go to previous bookmarked directory |netrw-gb|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001088 gd Force treatment as directory |netrw-gd|
1089 gf Force treatment as file |netrw-gf|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001090 gh Quick hide/unhide of dot-files |netrw-gh|
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001091 gn Make top of tree the directory below the cursor |netrw-gn|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001092 i Cycle between thin, long, wide, and tree listings |netrw-i|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001093 mb Bookmark current directory |netrw-mb|
1094 mc Copy marked files to marked-file target directory |netrw-mc|
1095 md Apply diff to marked files (up to 3) |netrw-md|
1096 me Place marked files on arg list and edit them |netrw-me|
1097 mf Mark a file |netrw-mf|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001098 mF Unmark files |netrw-mF|
1099 mg Apply vimgrep to marked files |netrw-mg|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001100 mh Toggle marked file suffices' presence on hiding list |netrw-mh|
1101 mm Move marked files to marked-file target directory |netrw-mm|
1102 mp Print marked files |netrw-mp|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001103 mr Mark files using a shell-style |regexp| |netrw-mr|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001104 mt Current browsing directory becomes markfile target |netrw-mt|
1105 mT Apply ctags to marked files |netrw-mT|
1106 mu Unmark all marked files |netrw-mu|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001107 mv Apply arbitrary vim command to marked files |netrw-mv|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001108 mx Apply arbitrary shell command to marked files |netrw-mx|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001109 mX Apply arbitrary shell command to marked files en bloc|netrw-mX|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001110 mz Compress/decompress marked files |netrw-mz|
1111 o Enter the file/directory under the cursor in a new |netrw-o|
Bram Moolenaar13600302014-05-22 18:26:40 +02001112 browser window. A horizontal split is used.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001113 O Obtain a file specified by cursor |netrw-O|
1114 p Preview the file |netrw-p|
1115 P Browse in the previously used window |netrw-P|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001116 qb List bookmarked directories and history |netrw-qb|
1117 qf Display information on file |netrw-qf|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001118 qF Mark files using a quickfix list |netrw-qF|
Bram Moolenaare0fa3742016-02-20 15:47:01 +01001119 qL Mark files using a |location-list| |netrw-qL|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001120 r Reverse sorting order |netrw-r|
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001121 R Rename the designated file(s)/directory(ies) |netrw-R|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001122 s Select sorting style: by name, time, or file size |netrw-s|
1123 S Specify suffix priority for name-sorting |netrw-S|
1124 t Enter the file/directory under the cursor in a new tab|netrw-t|
1125 u Change to recently-visited directory |netrw-u|
1126 U Change to subsequently-visited directory |netrw-U|
1127 v Enter the file/directory under the cursor in a new |netrw-v|
Bram Moolenaar13600302014-05-22 18:26:40 +02001128 browser window. A vertical split is used.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001129 x View file with an associated program |netrw-x|
Bram Moolenaar97d62492012-11-15 21:28:22 +01001130 X Execute filename under cursor via |system()| |netrw-X|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001131
Bram Moolenaarc236c162008-07-13 17:41:49 +00001132 % Open a new file in netrw's current directory |netrw-%|
1133
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001134 *netrw-mouse* *netrw-leftmouse* *netrw-middlemouse* *netrw-rightmouse*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001135 <leftmouse> (gvim only) selects word under mouse as if a <cr>
1136 had been pressed (ie. edit file, change directory)
1137 <middlemouse> (gvim only) same as P selecting word under mouse;
1138 see |netrw-P|
1139 <rightmouse> (gvim only) delete file/directory using word under
1140 mouse
1141 <2-leftmouse> (gvim only) when:
Bram Moolenaar13600302014-05-22 18:26:40 +02001142 * in a netrw-selected file, AND
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001143 * |g:netrw_retmap| == 1 AND
Bram Moolenaar13600302014-05-22 18:26:40 +02001144 * the user doesn't already have a <2-leftmouse>
Bram Moolenaarff034192013-04-24 18:51:19 +02001145 mapping defined before netrw is autoloaded,
Bram Moolenaar446cb832008-06-24 21:56:24 +00001146 then a double clicked leftmouse button will return
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001147 to the netrw browser window. See |g:netrw_retmap|.
Bram Moolenaar8d043172014-01-23 14:24:41 +01001148 <s-leftmouse> (gvim only) like mf, will mark files. Dragging
1149 the shifted leftmouse will mark multiple files.
1150 (see |netrw-mf|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00001151
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001152 (to disable mouse buttons while browsing: |g:netrw_mousemaps|)
1153
Bram Moolenaar446cb832008-06-24 21:56:24 +00001154 *netrw-quickcom* *netrw-quickcoms*
1155QUICK REFERENCE: COMMANDS *netrw-explore-cmds* *netrw-browse-cmds* {{{2
Bram Moolenaar8d043172014-01-23 14:24:41 +01001156 :NetrwClean[!]............................................|netrw-clean|
1157 :NetrwSettings............................................|netrw-settings|
1158 :Ntree....................................................|netrw-ntree|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001159 :Explore[!] [dir] Explore directory of current file......|netrw-explore|
1160 :Hexplore[!] [dir] Horizontal Split & Explore.............|netrw-explore|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001161 :Lexplore[!] [dir] Left Explorer Toggle...................|netrw-explore|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001162 :Nexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
1163 :Pexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
1164 :Rexplore Return to Explorer.....................|netrw-explore|
1165 :Sexplore[!] [dir] Split & Explore directory .............|netrw-explore|
1166 :Texplore[!] [dir] Tab & Explore..........................|netrw-explore|
1167 :Vexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
1168
Bram Moolenaare0fa3742016-02-20 15:47:01 +01001169
1170BANNER DISPLAY *netrw-I*
1171
1172One may toggle the banner display on and off by pressing "I".
1173
1174Also See: |g:netrw_banner|
1175
1176
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001177BOOKMARKING A DIRECTORY *netrw-mb* *netrw-bookmark* *netrw-bookmarks* {{{2
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001178
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001179One may easily "bookmark" the currently browsed directory by using >
Bram Moolenaar446cb832008-06-24 21:56:24 +00001180
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001181 mb
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00001182<
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001183 *.netrwbook*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001184Bookmarks are retained in between sessions in a $HOME/.netrwbook file, and are
1185kept in sorted order.
1186
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001187If there are marked files and/or directories, mb will add them to the bookmark
1188list.
1189
1190*netrw-:NetrwMB*
1191Addtionally, one may use :NetrwMB to bookmark files or directories. >
1192
1193 :NetrwMB[!] [files/directories]
1194
1195< No bang: enters files/directories into Netrw's bookmark system
1196
1197 No argument and in netrw buffer:
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001198 if there are marked files : bookmark marked files
1199 otherwise : bookmark file/directory under cursor
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001200 No argument and not in netrw buffer: bookmarks current open file
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001201 Has arguments : |glob()|s each arg and bookmarks them
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001202
1203 With bang: deletes files/directories from Netrw's bookmark system
1204
1205The :NetrwMB command is available outside of netrw buffers (once netrw has been
1206invoked in the session).
1207
1208The file ".netrwbook" holds bookmarks when netrw (and vim) is not active. By
1209default, its stored on the first directory on the user's |'runtimepath'|.
1210
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001211Related Topics:
1212 |netrw-gb| how to return (go) to a bookmark
1213 |netrw-mB| how to delete bookmarks
1214 |netrw-qb| how to list bookmarks
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001215 |g:netrw_home| controls where .netrwbook is kept
Bram Moolenaar4a85b412006-04-23 22:40:29 +00001216
1217
Bram Moolenaare0fa3742016-02-20 15:47:01 +01001218BROWSING *netrw-enter* *netrw-cr* {{{2
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001219
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001220Browsing is simple: move the cursor onto a file or directory of interest.
Bram Moolenaar843ee412004-06-30 16:16:41 +00001221Hitting the <cr> (the return key) will select the file or directory.
1222Directories will themselves be listed, and files will be opened using the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001223protocol given in the original read request.
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001224
Bram Moolenaar446cb832008-06-24 21:56:24 +00001225 CAVEAT: There are four forms of listing (see |netrw-i|). Netrw assumes that
1226 two or more spaces delimit filenames and directory names for the long and
1227 wide listing formats. Thus, if your filename or directory name has two or
1228 more sequential spaces embedded in it, or any trailing spaces, then you'll
1229 need to use the "thin" format to select it.
Bram Moolenaar843ee412004-06-30 16:16:41 +00001230
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001231The |g:netrw_browse_split| option, which is zero by default, may be used to
Bram Moolenaar446cb832008-06-24 21:56:24 +00001232cause the opening of files to be done in a new window or tab instead of the
1233default. When the option is one or two, the splitting will be taken
1234horizontally or vertically, respectively. When the option is set to three, a
1235<cr> will cause the file to appear in a new tab.
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001236
Bram Moolenaar83bab712005-08-01 21:58:57 +00001237
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001238When using the gui (gvim), one may select a file by pressing the <leftmouse>
1239button. In addition, if
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001240
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001241 * |g:netrw_retmap| == 1 AND (its default value is 0)
Bram Moolenaar446cb832008-06-24 21:56:24 +00001242 * in a netrw-selected file, AND
1243 * the user doesn't already have a <2-leftmouse> mapping defined before
1244 netrw is loaded
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001245
Bram Moolenaar446cb832008-06-24 21:56:24 +00001246then a doubly-clicked leftmouse button will return to the netrw browser
1247window.
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001248
Bram Moolenaar446cb832008-06-24 21:56:24 +00001249Netrw attempts to speed up browsing, especially for remote browsing where one
1250may have to enter passwords, by keeping and re-using previously obtained
1251directory listing buffers. The |g:netrw_fastbrowse| variable is used to
1252control this behavior; one may have slow browsing (no buffer re-use), medium
1253speed browsing (re-use directory buffer listings only for remote directories),
1254and fast browsing (re-use directory buffer listings as often as possible).
1255The price for such re-use is that when changes are made (such as new files
1256are introduced into a directory), the listing may become out-of-date. One may
1257always refresh directory listing buffers by pressing ctrl-L (see
1258|netrw-ctrl-l|).
Bram Moolenaare0fa3742016-02-20 15:47:01 +01001259
1260 *netrw-s-cr*
1261Squeezing the Current Tree-Listing Directory~
1262
1263When the tree listing style is enabled (see |netrw-i|) and one is using
1264gvim, then the <s-cr> mapping may be used to squeeze (close) the
1265directory currently containing the cursor.
1266
1267Otherwise, one may remap a key combination of one's own choice to get
1268this effect: >
1269
1270 nmap <buffer> <silent> <nowait> YOURKEYCOMBO <Plug>NetrwTreeSqueeze
1271<
1272Put this line in $HOME/ftplugin/netrw/netrw.vim; it needs to be generated
1273for netrw buffers only.
Bram Moolenaara6878372014-03-22 21:02:50 +01001274
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001275Related topics:
1276 |netrw-ctrl-r| |netrw-o| |netrw-p|
1277 |netrw-P| |netrw-t| |netrw-v|
1278Associated setting variables:
1279 |g:netrw_browse_split| |g:netrw_fastbrowse|
1280 |g:netrw_ftp_list_cmd| |g:netrw_ftp_sizelist_cmd|
1281 |g:netrw_ftp_timelist_cmd| |g:netrw_ssh_browse_reject|
1282 |g:netrw_ssh_cmd| |g:netrw_use_noswf|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001283
1284
1285BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o* *netrw-horiz* {{{2
1286
1287Normally one enters a file or directory using the <cr>. However, the "o" map
1288allows one to open a new window to hold the new directory listing or file. A
1289horizontal split is used. (for vertical splitting, see |netrw-v|)
1290
1291Normally, the o key splits the window horizontally with the new window and
Bram Moolenaar15146672011-10-20 22:22:38 +02001292cursor at the top.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001293
1294Associated setting variables: |g:netrw_alto| |g:netrw_winsize|
1295
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001296Related topics:
1297 |netrw-ctrl-r| |netrw-o| |netrw-p|
1298 |netrw-P| |netrw-t| |netrw-v|
Bram Moolenaar15146672011-10-20 22:22:38 +02001299Associated setting variables:
1300 |g:netrw_alto| control above/below splitting
1301 |g:netrw_winsize| control initial sizing
Bram Moolenaar446cb832008-06-24 21:56:24 +00001302
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001303BROWSING WITH A NEW TAB *netrw-t* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00001304
1305Normally one enters a file or directory using the <cr>. The "t" map
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001306allows one to open a new window holding the new directory listing or file in
Bram Moolenaarff034192013-04-24 18:51:19 +02001307a new tab.
1308
1309If you'd like to have the new listing in a background tab, use |gT|.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001310
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001311Related topics:
1312 |netrw-ctrl-r| |netrw-o| |netrw-p|
1313 |netrw-P| |netrw-t| |netrw-v|
Bram Moolenaar15146672011-10-20 22:22:38 +02001314Associated setting variables:
1315 |g:netrw_winsize| control initial sizing
Bram Moolenaar446cb832008-06-24 21:56:24 +00001316
1317BROWSING WITH A VERTICALLY SPLIT WINDOW *netrw-v* {{{2
1318
1319Normally one enters a file or directory using the <cr>. However, the "v" map
1320allows one to open a new window to hold the new directory listing or file. A
1321vertical split is used. (for horizontal splitting, see |netrw-o|)
1322
1323Normally, the v key splits the window vertically with the new window and
Bram Moolenaar15146672011-10-20 22:22:38 +02001324cursor at the left.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001325
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001326There is only one tree listing buffer; using "v" on a displayed subdirectory
Bram Moolenaar446cb832008-06-24 21:56:24 +00001327will split the screen, but the same buffer will be shown twice.
1328
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001329Related topics:
1330 |netrw-ctrl-r| |netrw-o| |netrw-p|
1331 |netrw-P| |netrw-t| |netrw-v|
Bram Moolenaar15146672011-10-20 22:22:38 +02001332Associated setting variables:
1333 |g:netrw_altv| control right/left splitting
1334 |g:netrw_winsize| control initial sizing
1335
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001336
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001337BROWSING USING A GVIM SERVER *netrw-ctrl-r* {{{2
1338
1339One may keep a browsing gvim separate from the gvim being used to edit.
1340Use the <c-r> map on a file (not a directory) in the netrw browser, and it
1341will use a gvim server (see |g:netrw_servername|). Subsequent use of <cr>
1342(see |netrw-cr|) will re-use that server for editing files.
1343
1344Related topics:
1345 |netrw-ctrl-r| |netrw-o| |netrw-p|
1346 |netrw-P| |netrw-t| |netrw-v|
1347Associated setting variables:
1348 |g:netrw_servername| : sets name of server
1349 |g:netrw_browse_split| : controls how <cr> will open files
1350
1351
1352CHANGE LISTING STYLE (THIN LONG WIDE TREE) *netrw-i* {{{2
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001353
Bram Moolenaar9964e462007-05-05 17:54:07 +00001354The "i" map cycles between the thin, long, wide, and tree listing formats.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001355
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001356The thin listing format gives just the files' and directories' names.
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001357
Bram Moolenaar8299df92004-07-10 09:47:34 +00001358The long listing is either based on the "ls" command via ssh for remote
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001359directories or displays the filename, file size (in bytes), and the time and
1360date of last modification for local directories. With the long listing
1361format, netrw is not able to recognize filenames which have trailing spaces.
1362Use the thin listing format for such files.
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001363
Bram Moolenaar9964e462007-05-05 17:54:07 +00001364The wide listing format uses two or more contiguous spaces to delineate
1365filenames; when using that format, netrw won't be able to recognize or use
1366filenames which have two or more contiguous spaces embedded in the name or any
1367trailing spaces. The thin listing format will, however, work with such files.
Bram Moolenaar13600302014-05-22 18:26:40 +02001368The wide listing format is the most compact.
Bram Moolenaar9964e462007-05-05 17:54:07 +00001369
1370The tree listing format has a top directory followed by files and directories
Bram Moolenaar13600302014-05-22 18:26:40 +02001371preceded by one or more "|"s, which indicate the directory depth. One may
1372open and close directories by pressing the <cr> key while atop the directory
1373name.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001374
1375One may make a preferred listing style your default; see |g:netrw_liststyle|.
1376As an example, by putting the following line in your .vimrc, >
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001377 let g:netrw_liststyle= 3
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001378the tree style will become your default listing style.
Bram Moolenaar8299df92004-07-10 09:47:34 +00001379
Bram Moolenaar5b435d62012-04-05 17:33:26 +02001380One typical way to use the netrw tree display is to: >
1381
1382 vim .
1383 (use i until a tree display shows)
1384 navigate to a file
1385 v (edit as desired in vertically split window)
1386 ctrl-w h (to return to the netrw listing)
1387 P (edit newly selected file in the previous window)
1388 ctrl-w h (to return to the netrw listing)
1389 P (edit newly selected file in the previous window)
1390 ...etc...
1391<
Bram Moolenaar446cb832008-06-24 21:56:24 +00001392Associated setting variables: |g:netrw_liststyle| |g:netrw_maxfilenamelen|
1393 |g:netrw_timefmt| |g:netrw_list_cmd|
Bram Moolenaar8299df92004-07-10 09:47:34 +00001394
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001395CHANGE FILE PERMISSION *netrw-gp* {{{2
1396
1397"gp" will ask you for a new permission for the file named under the cursor.
1398Currently, this only works for local files.
1399
1400Associated setting variables: |g:netrw_chgperm|
1401
Bram Moolenaar83bab712005-08-01 21:58:57 +00001402
Bram Moolenaar446cb832008-06-24 21:56:24 +00001403CHANGING TO A BOOKMARKED DIRECTORY *netrw-gb* {{{2
Bram Moolenaar843ee412004-06-30 16:16:41 +00001404
Bram Moolenaar446cb832008-06-24 21:56:24 +00001405To change directory back to a bookmarked directory, use
Bram Moolenaar843ee412004-06-30 16:16:41 +00001406
Bram Moolenaar446cb832008-06-24 21:56:24 +00001407 {cnt}gb
Bram Moolenaar843ee412004-06-30 16:16:41 +00001408
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001409Any count may be used to reference any of the bookmarks.
Bram Moolenaarff034192013-04-24 18:51:19 +02001410Note that |netrw-qb| shows both bookmarks and history; to go
1411to a location stored in the history see |netrw-u| and |netrw-U|.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001412
1413Related Topics:
1414 |netrw-mB| how to delete bookmarks
1415 |netrw-mb| how to make a bookmark
1416 |netrw-qb| how to list bookmarks
Bram Moolenaar843ee412004-06-30 16:16:41 +00001417
Bram Moolenaar843ee412004-06-30 16:16:41 +00001418
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001419CHANGING TO A PREDECESSOR DIRECTORY *netrw-u* *netrw-updir* {{{2
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001420
1421Every time you change to a new directory (new for the current session),
1422netrw will save the directory in a recently-visited directory history
Bram Moolenaaradc21822011-04-01 18:03:16 +02001423list (unless |g:netrw_dirhistmax| is zero; by default, it's ten). With the
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001424"u" map, one can change to an earlier directory (predecessor). To do
1425the opposite, see |netrw-U|.
1426
Bram Moolenaarff034192013-04-24 18:51:19 +02001427The "u" map also accepts counts to go back in the history several slots.
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001428For your convenience, qb (see |netrw-qb|) lists the history number which may
1429be used in that count.
Bram Moolenaarff034192013-04-24 18:51:19 +02001430
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001431 *.netrwhist*
Bram Moolenaarff034192013-04-24 18:51:19 +02001432See |g:netrw_dirhistmax| for how to control the quantity of history stack
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001433slots. The file ".netrwhist" holds history when netrw (and vim) is not
1434active. By default, its stored on the first directory on the user's
1435|'runtimepath'|.
1436
1437Related Topics:
1438 |netrw-U| changing to a successor directory
1439 |g:netrw_home| controls where .netrwhist is kept
Bram Moolenaarff034192013-04-24 18:51:19 +02001440
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001441
Bram Moolenaar446cb832008-06-24 21:56:24 +00001442CHANGING TO A SUCCESSOR DIRECTORY *netrw-U* *netrw-downdir* {{{2
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001443
1444With the "U" map, one can change to a later directory (successor).
1445This map is the opposite of the "u" map. (see |netrw-u|) Use the
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001446qb map to list both the bookmarks and history. (see |netrw-qb|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00001447
Bram Moolenaarff034192013-04-24 18:51:19 +02001448The "U" map also accepts counts to go forward in the history several slots.
1449
1450See |g:netrw_dirhistmax| for how to control the quantity of history stack
1451slots.
1452
Bram Moolenaar446cb832008-06-24 21:56:24 +00001453
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001454CHANGING TREE TOP *netrw-ntree* *:Ntree* *netrw-gn* {{{2
Bram Moolenaar8d043172014-01-23 14:24:41 +01001455
1456One may specify a new tree top for tree listings using >
1457
1458 :Ntree [dirname]
1459
1460Without a "dirname", the current line is used (and any leading depth
1461information is elided).
1462With a "dirname", the specified directory name is used.
1463
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001464The "gn" map will take the word below the cursor and use that for
1465changing the top of the tree listing.
1466
Bram Moolenaar8d043172014-01-23 14:24:41 +01001467
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001468NETRW CLEAN *netrw-clean* *:NetrwClean* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00001469
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001470With NetrwClean one may easily remove netrw from one's home directory;
Bram Moolenaar446cb832008-06-24 21:56:24 +00001471more precisely, from the first directory on your |'runtimepath'|.
1472
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001473With NetrwClean!, netrw will attempt to remove netrw from all directories on
1474your |'runtimepath'|. Of course, you have to have write/delete permissions
1475correct to do this.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001476
1477With either form of the command, netrw will first ask for confirmation
1478that the removal is in fact what you want to do. If netrw doesn't have
1479permission to remove a file, it will issue an error message.
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001480
Bram Moolenaar9964e462007-05-05 17:54:07 +00001481 *netrw-gx*
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001482CUSTOMIZING BROWSING WITH A SPECIAL HANDLER *netrw-x* *netrw-handler* {{{2
Bram Moolenaar9964e462007-05-05 17:54:07 +00001483 (also see |netrw_filehandler|)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001484
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001485Certain files, such as html, gif, jpeg, (word/office) doc, etc, files, are
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001486best seen with a special handler (ie. a tool provided with your computer's
1487operating system). Netrw allows one to invoke such special handlers by: >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001488
1489 * when Exploring, hit the "x" key
1490 * when editing, hit gx with the cursor atop the special filename
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001491< (latter not available if the |g:netrw_nogx| variable exists)
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001492
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001493Netrw determines which special handler by the following method:
1494
1495 * if |g:netrw_browsex_viewer| exists, then it will be used to attempt to
1496 view files. Examples of useful settings (place into your <.vimrc>): >
1497
1498 :let g:netrw_browsex_viewer= "kfmclient exec"
1499< or >
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001500 :let g:netrw_browsex_viewer= "xdg-open"
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001501<
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001502 If g:netrw_browsex_viewer == '-', then netrwFileHandlers#Invoke() will be
1503 used instead (see |netrw_filehandler|).
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001504
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001505 * for Windows 32 or 64, the url and FileProtocolHandler dlls are used.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001506 * for Gnome (with gnome-open): gnome-open is used.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001507 * for KDE (with kfmclient) : kfmclient is used
Bram Moolenaar446cb832008-06-24 21:56:24 +00001508 * for Mac OS X : open is used.
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001509 * otherwise the netrwFileHandler plugin is used.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001510
1511The file's suffix is used by these various approaches to determine an
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001512appropriate application to use to "handle" these files. Such things as
1513OpenOffice (*.sfx), visualization (*.jpg, *.gif, etc), and PostScript (*.ps,
1514*.eps) can be handled.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001515
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001516The gx mapping extends to all buffers; apply "gx" while atop a word and netrw
1517will apply a special handler to it (like "x" works when in a netrw buffer).
1518One may also use visual mode (see |visual-start|) to select the text that the
1519special handler will use. Normally gx uses expand("<cfile>") to pick up the
1520text under the cursor; one may change what |expand()| uses via the
1521|g:netrw_gx| variable. Alternatively, one may select the text to be used by
Bram Moolenaare0fa3742016-02-20 15:47:01 +01001522gx via first making a visual selection (see |visual-block|) or by changing
1523the |'isfname'| option (which is global, so netrw doesn't modify it).
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001524
1525Associated setting variables:
1526 |g:netrw_gx| control how gx picks up the text under the cursor
1527 |g:netrw_nogx| prevent gx map while editing
Bram Moolenaaraa3b15d2016-04-21 08:53:19 +02001528 |g:netrw_suppress_gx_mesg| controls gx's suppression of browser messages
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001529
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001530 *netrw_filehandler*
Bram Moolenaar9964e462007-05-05 17:54:07 +00001531
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001532When |g:netrw_browsex_viewer| exists and is "-", then netrw will attempt to
1533handle the special file with a vim function. The "x" map applies a function
1534to a file, based on its extension. Of course, the handler function must exist
1535for it to be called!
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001536>
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001537 Ex. mypgm.html x -> NFH_html("scp://user@host/some/path/mypgm.html")
1538
1539< Users may write their own netrw File Handler functions to
1540 support more suffixes with special handling. See
1541 <autoload/netrwFileHandlers.vim> for examples on how to make
1542 file handler functions. As an example: >
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001543
Bram Moolenaar9964e462007-05-05 17:54:07 +00001544 " NFH_suffix(filename)
1545 fun! NFH_suffix(filename)
1546 ..do something special with filename..
1547 endfun
1548<
1549These functions need to be defined in some file in your .vim/plugin
1550(vimfiles\plugin) directory. Vim's function names may not have punctuation
1551characters (except for the underscore) in them. To support suffices that
1552contain such characters, netrw will first convert the suffix using the
1553following table: >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001554
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001555 @ -> AT ! -> EXCLAMATION % -> PERCENT
1556 : -> COLON = -> EQUAL ? -> QUESTION
Bram Moolenaar9964e462007-05-05 17:54:07 +00001557 , -> COMMA - -> MINUS ; -> SEMICOLON
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001558 $ -> DOLLAR + -> PLUS ~ -> TILDE
1559<
Bram Moolenaar9964e462007-05-05 17:54:07 +00001560So, for example: >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001561
Bram Moolenaar9964e462007-05-05 17:54:07 +00001562 file.rcs,v -> NFH_rcsCOMMAv()
1563<
1564If more such translations are necessary, please send me email: >
1565 NdrOchip at ScampbellPfamily.AbizM - NOSPAM
1566with a request.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001567
Bram Moolenaar446cb832008-06-24 21:56:24 +00001568Associated setting variable: |g:netrw_browsex_viewer|
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001569
Bram Moolenaar446cb832008-06-24 21:56:24 +00001570 *netrw-curdir*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001571DELETING BOOKMARKS *netrw-mB* {{{2
1572
1573To delete a bookmark, use >
1574
1575 {cnt}mB
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001576
1577If there are marked files, then mB will remove them from the
1578bookmark list.
1579
1580Alternatively, one may use :NetrwMB! (see |netrw-:NetrwMB|). >
1581
1582 :NetrwMB! [files/directories]
1583
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001584Related Topics:
1585 |netrw-gb| how to return (go) to a bookmark
1586 |netrw-mb| how to make a bookmark
1587 |netrw-qb| how to list bookmarks
1588
1589
Bram Moolenaar446cb832008-06-24 21:56:24 +00001590DELETING FILES OR DIRECTORIES *netrw-delete* *netrw-D* *netrw-del* {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001591
Bram Moolenaar446cb832008-06-24 21:56:24 +00001592If files have not been marked with |netrw-mf|: (local marked file list)
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001593
Bram Moolenaar446cb832008-06-24 21:56:24 +00001594 Deleting/removing files and directories involves moving the cursor to the
1595 file/directory to be deleted and pressing "D". Directories must be empty
1596 first before they can be successfully removed. If the directory is a
1597 softlink to a directory, then netrw will make two requests to remove the
1598 directory before succeeding. Netrw will ask for confirmation before doing
1599 the removal(s). You may select a range of lines with the "V" command
1600 (visual selection), and then pressing "D".
Bram Moolenaar9964e462007-05-05 17:54:07 +00001601
Bram Moolenaar446cb832008-06-24 21:56:24 +00001602If files have been marked with |netrw-mf|: (local marked file list)
1603
1604 Marked files (and empty directories) will be deleted; again, you'll be
1605 asked to confirm the deletion before it actually takes place.
1606
Bram Moolenaar13600302014-05-22 18:26:40 +02001607A further approach is to delete files which match a pattern.
1608
1609 * use :MF pattern (see |netrw-:MF|); then press "D".
1610
1611 * use mr (see |netrw-mr|) which will prompt you for pattern.
1612 This will cause the matching files to be marked. Then,
1613 press "D".
1614
Bram Moolenaar446cb832008-06-24 21:56:24 +00001615The |g:netrw_rm_cmd|, |g:netrw_rmf_cmd|, and |g:netrw_rmdir_cmd| variables are
Bram Moolenaar13600302014-05-22 18:26:40 +02001616used to control the attempts to remove remote files and directories. The
Bram Moolenaar446cb832008-06-24 21:56:24 +00001617g:netrw_rm_cmd is used with files, and its default value is:
1618
1619 g:netrw_rm_cmd: ssh HOSTNAME rm
1620
1621The g:netrw_rmdir_cmd variable is used to support the removal of directories.
1622Its default value is:
1623
Bram Moolenaar13600302014-05-22 18:26:40 +02001624 |g:netrw_rmdir_cmd|: ssh HOSTNAME rmdir
Bram Moolenaar446cb832008-06-24 21:56:24 +00001625
1626If removing a directory fails with g:netrw_rmdir_cmd, netrw then will attempt
1627to remove it again using the g:netrw_rmf_cmd variable. Its default value is:
1628
Bram Moolenaar13600302014-05-22 18:26:40 +02001629 |g:netrw_rmf_cmd|: ssh HOSTNAME rm -f
Bram Moolenaar446cb832008-06-24 21:56:24 +00001630
Bram Moolenaar15146672011-10-20 22:22:38 +02001631Related topics: |netrw-d|
Bram Moolenaar5b435d62012-04-05 17:33:26 +02001632Associated setting variable: |g:netrw_localrmdir| |g:netrw_rm_cmd|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001633 |g:netrw_rmdir_cmd| |g:netrw_ssh_cmd|
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001634
1635
Bram Moolenaar446cb832008-06-24 21:56:24 +00001636*netrw-explore* *netrw-hexplore* *netrw-nexplore* *netrw-pexplore*
Bram Moolenaar8d043172014-01-23 14:24:41 +01001637*netrw-rexplore* *netrw-sexplore* *netrw-texplore* *netrw-vexplore* *netrw-lexplore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001638DIRECTORY EXPLORATION COMMANDS {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001639
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001640 :[N]Explore[!] [dir]... Explore directory of current file *:Explore*
1641 :[N]Hexplore[!] [dir]... Horizontal Split & Explore *:Hexplore*
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001642 :[N]Lexplore[!] [dir]... Left Explorer Toggle *:Lexplore*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001643 :[N]Sexplore[!] [dir]... Split&Explore current file's directory *:Sexplore*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001644 :[N]Vexplore[!] [dir]... Vertical Split & Explore *:Vexplore*
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001645 :Texplore [dir]... Tab & Explore *:Texplore*
1646 :Rexplore ... Return to/from Explorer *:Rexplore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001647
1648 Used with :Explore **/pattern : (also see |netrw-starstar|)
1649 :Nexplore............. go to next matching file *:Nexplore*
1650 :Pexplore............. go to previous matching file *:Pexplore*
1651
Bram Moolenaara6878372014-03-22 21:02:50 +01001652 *netrw-:Explore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001653:Explore will open the local-directory browser on the current file's
1654 directory (or on directory [dir] if specified). The window will be
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001655 split only if the file has been modified and |'hidden'| is not set,
1656 otherwise the browsing window will take over that window. Normally
1657 the splitting is taken horizontally.
Bram Moolenaara6878372014-03-22 21:02:50 +01001658 Also see: |netrw-:Rexplore|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001659:Explore! is like :Explore, but will use vertical splitting.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001660
Bram Moolenaara6878372014-03-22 21:02:50 +01001661 *netrw-:Hexplore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001662:Hexplore [dir] does an :Explore with |:belowright| horizontal splitting.
1663:Hexplore! [dir] does an :Explore with |:aboveleft| horizontal splitting.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001664
1665 *netrw-:Lexplore*
1666:[N]Lexplore [dir] toggles a full height Explorer window on the left hand side
1667 of the current tab. It will open a netrw window on the current
1668 directory if [dir] is omitted; a :Lexplore [dir] will show the
1669 specified directory in the left-hand side browser display no matter
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001670 from which window the command is issued.
1671
1672 By default, :Lexplore will change an uninitialized |g:netrw_chgwin|
1673 to 2; edits will thus preferentially be made in window#2.
1674
1675 The [N] specifies a |g:netrw_winsize| just for the new :Lexplore
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001676 window.
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001677
1678 Those who like this method often also often like tree style displays;
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001679 see |g:netrw_liststyle|.
1680
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001681 Also see: |netrw-C| |g:netrw_browse_split| |g:netrw_wiw|
1682 |netrw-p| |netrw-P| |g:netrw_chgwin|
1683 |netrw-c-tab| |g:netrw_winsize|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001684
1685:[N]Lexplore! is like :Lexplore, except that the full-height Explorer window
Bram Moolenaara0f849e2015-10-30 14:37:44 +01001686 will open on the right hand side and an uninitialized |g:netrw_chgwin|
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001687 will be set to 1.
1688
1689 *netrw-:Sexplore*
1690:[N]Sexplore will always split the window before invoking the local-directory
1691 browser. As with Explore, the splitting is normally done
1692 horizontally.
1693:[N]Sexplore! [dir] is like :Sexplore, but the splitting will be done vertically.
1694
Bram Moolenaara6878372014-03-22 21:02:50 +01001695 *netrw-:Texplore*
Bram Moolenaar8d043172014-01-23 14:24:41 +01001696:Texplore [dir] does a |:tabnew| before generating the browser window
Bram Moolenaar446cb832008-06-24 21:56:24 +00001697
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001698 *netrw-:Vexplore*
1699:[N]Vexplore [dir] does an :Explore with |:leftabove| vertical splitting.
1700:[N]Vexplore! [dir] does an :Explore with |:rightbelow| vertical splitting.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001701
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001702The optional parameters are:
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001703
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001704 [N]: This parameter will override |g:netrw_winsize| to specify the quantity of
1705 rows and/or columns the new explorer window should have.
1706 Otherwise, the |g:netrw_winsize| variable, if it has been specified by the
1707 user, is used to control the quantity of rows and/or columns new
1708 explorer windows should have.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001709
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001710 [dir]: By default, these explorer commands use the current file's directory.
1711 However, one may explicitly provide a directory (path) to use instead;
1712 ie. >
1713
1714 :Explore /some/path
1715<
Bram Moolenaara6878372014-03-22 21:02:50 +01001716 *netrw-:Rexplore*
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001717:Rexplore This command is a little different from the other Explore commands
1718 as it doesn't necessarily open an Explorer window.
Bram Moolenaara6878372014-03-22 21:02:50 +01001719
1720 Return to Explorer~
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001721 When one edits a file using netrw which can occur, for example,
1722 when pressing <cr> while the cursor is atop a filename in a netrw
1723 browser window, a :Rexplore issued while editing that file will
1724 return the display to that of the last netrw browser display in
1725 that window.
Bram Moolenaara6878372014-03-22 21:02:50 +01001726
1727 Return from Explorer~
1728 Conversely, when one is editing a directory, issuing a :Rexplore
Bram Moolenaar13600302014-05-22 18:26:40 +02001729 will return to editing the file that was last edited in that
Bram Moolenaara6878372014-03-22 21:02:50 +01001730 window.
1731
1732 The <2-leftmouse> map (which is only available under gvim and
1733 cooperative terms) does the same as :Rexplore.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001734
Bram Moolenaar8d043172014-01-23 14:24:41 +01001735Also see: |g:netrw_alto| |g:netrw_altv| |g:netrw_winsize|
1736
Bram Moolenaar446cb832008-06-24 21:56:24 +00001737
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001738*netrw-star* *netrw-starpat* *netrw-starstar* *netrw-starstarpat* *netrw-grep*
1739EXPLORING WITH STARS AND PATTERNS {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00001740
1741When Explore, Sexplore, Hexplore, or Vexplore are used with one of the
Bram Moolenaare0fa3742016-02-20 15:47:01 +01001742following four patterns Explore generates a list of files which satisfy the
1743request for the local file system. These exploration patterns will not work
1744with remote file browsing.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001745
1746 */filepat files in current directory which satisfy filepat
1747 **/filepat files in current directory or below which satisfy the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001748 file pattern
Bram Moolenaar446cb832008-06-24 21:56:24 +00001749 *//pattern files in the current directory which contain the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001750 pattern (vimgrep is used)
Bram Moolenaar446cb832008-06-24 21:56:24 +00001751 **//pattern files in the current directory or below which contain
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001752 the pattern (vimgrep is used)
Bram Moolenaar572cb562005-08-05 21:35:02 +00001753<
Bram Moolenaar446cb832008-06-24 21:56:24 +00001754The cursor will be placed on the first file in the list. One may then
1755continue to go to subsequent files on that list via |:Nexplore| or to
1756preceding files on that list with |:Pexplore|. Explore will update the
1757directory and place the cursor appropriately.
1758
1759A plain >
1760 :Explore
1761will clear the explore list.
1762
1763If your console or gui produces recognizable shift-up or shift-down sequences,
1764then you'll likely find using shift-downarrow and shift-uparrow convenient.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001765They're mapped by netrw as follows:
Bram Moolenaar446cb832008-06-24 21:56:24 +00001766
1767 <s-down> == Nexplore, and
1768 <s-up> == Pexplore.
1769
1770As an example, consider
1771>
1772 :Explore */*.c
1773 :Nexplore
1774 :Nexplore
1775 :Pexplore
1776<
1777The status line will show, on the right hand side of the status line, a
1778message like "Match 3 of 20".
1779
Bram Moolenaara6878372014-03-22 21:02:50 +01001780Associated setting variables:
1781 |g:netrw_keepdir| |g:netrw_browse_split|
1782 |g:netrw_fastbrowse| |g:netrw_ftp_browse_reject|
1783 |g:netrw_ftp_list_cmd| |g:netrw_ftp_sizelist_cmd|
1784 |g:netrw_ftp_timelist_cmd| |g:netrw_list_cmd|
1785 |g:netrw_liststyle|
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001786
1787
Bram Moolenaar446cb832008-06-24 21:56:24 +00001788DISPLAYING INFORMATION ABOUT FILE *netrw-qf* {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001789
Bram Moolenaar446cb832008-06-24 21:56:24 +00001790With the cursor atop a filename, pressing "qf" will reveal the file's size
1791and last modification timestamp. Currently this capability is only available
1792for local files.
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001793
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001794
Bram Moolenaar446cb832008-06-24 21:56:24 +00001795EDIT FILE OR DIRECTORY HIDING LIST *netrw-ctrl-h* *netrw-edithide* {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001796
Bram Moolenaar446cb832008-06-24 21:56:24 +00001797The "<ctrl-h>" map brings up a requestor allowing the user to change the
1798file/directory hiding list contained in |g:netrw_list_hide|. The hiding list
1799consists of one or more patterns delimited by commas. Files and/or
1800directories satisfying these patterns will either be hidden (ie. not shown) or
1801be the only ones displayed (see |netrw-a|).
1802
1803The "gh" mapping (see |netrw-gh|) quickly alternates between the usual
1804hiding list and the hiding of files or directories that begin with ".".
1805
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001806As an example, >
1807 let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+'
1808Effectively, this makes the effect of a |netrw-gh| command the initial setting.
1809What it means:
1810
1811 \(^\|\s\s\) : if the line begins with the following, -or-
1812 two consecutive spaces are encountered
1813 \zs : start the hiding match now
1814 \. : if it now begins with a dot
1815 \S\+ : and is followed by one or more non-whitespace
1816 characters
1817
Bram Moolenaar446cb832008-06-24 21:56:24 +00001818Associated setting variables: |g:netrw_hide| |g:netrw_list_hide|
1819Associated topics: |netrw-a| |netrw-gh| |netrw-mh|
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001820
Bram Moolenaar15146672011-10-20 22:22:38 +02001821 *netrw-sort-sequence*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001822EDITING THE SORTING SEQUENCE *netrw-S* *netrw-sortsequence* {{{2
1823
1824When "Sorted by" is name, one may specify priority via the sorting sequence
1825(g:netrw_sort_sequence). The sorting sequence typically prioritizes the
1826name-listing by suffix, although any pattern will do. Patterns are delimited
1827by commas. The default sorting sequence is (all one line):
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001828
1829For Unix: >
1830 '[\/]$,\<core\%(\.\d\+\)\=,\.[a-np-z]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,
1831 \.info$,\.swp$,\.bak$,\~$'
1832<
1833Otherwise: >
Bram Moolenaar446cb832008-06-24 21:56:24 +00001834 '[\/]$,\.[a-np-z]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,
1835 \.swp$,\.bak$,\~$'
1836<
1837The lone * is where all filenames not covered by one of the other patterns
1838will end up. One may change the sorting sequence by modifying the
1839g:netrw_sort_sequence variable (either manually or in your <.vimrc>) or by
1840using the "S" map.
1841
Bram Moolenaarc236c162008-07-13 17:41:49 +00001842Related topics: |netrw-s| |netrw-S|
1843Associated setting variables: |g:netrw_sort_sequence| |g:netrw_sort_options|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001844
1845
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001846EXECUTING FILE UNDER CURSOR VIA SYSTEM() *netrw-X* {{{2
Bram Moolenaar97d62492012-11-15 21:28:22 +01001847
1848Pressing X while the cursor is atop an executable file will yield a prompt
1849using the filename asking for any arguments. Upon pressing a [return], netrw
1850will then call |system()| with that command and arguments. The result will
1851be displayed by |:echomsg|, and so |:messages| will repeat display of the
1852result. Ansi escape sequences will be stripped out.
1853
1854
Bram Moolenaaradc21822011-04-01 18:03:16 +02001855FORCING TREATMENT AS A FILE OR DIRECTORY *netrw-gd* *netrw-gf* {{{2
1856
1857Remote symbolic links (ie. those listed via ssh or ftp) are problematic
1858in that it is difficult to tell whether they link to a file or to a
1859directory.
1860
1861To force treatment as a file: use >
Bram Moolenaar97d62492012-11-15 21:28:22 +01001862 gf
Bram Moolenaaradc21822011-04-01 18:03:16 +02001863<
1864To force treatment as a directory: use >
Bram Moolenaar97d62492012-11-15 21:28:22 +01001865 gd
Bram Moolenaaradc21822011-04-01 18:03:16 +02001866<
1867
Bram Moolenaar446cb832008-06-24 21:56:24 +00001868GOING UP *netrw--* {{{2
1869
1870To go up a directory, press "-" or press the <cr> when atop the ../ directory
1871entry in the listing.
1872
1873Netrw will use the command in |g:netrw_list_cmd| to perform the directory
1874listing operation after changing HOSTNAME to the host specified by the
Bram Moolenaara6878372014-03-22 21:02:50 +01001875user-prpvided url. By default netrw provides the command as: >
Bram Moolenaar446cb832008-06-24 21:56:24 +00001876
1877 ssh HOSTNAME ls -FLa
Bram Moolenaara6878372014-03-22 21:02:50 +01001878<
Bram Moolenaar446cb832008-06-24 21:56:24 +00001879where the HOSTNAME becomes the [user@]hostname as requested by the attempt to
1880read. Naturally, the user may override this command with whatever is
1881preferred. The NetList function which implements remote browsing
1882expects that directories will be flagged by a trailing slash.
1883
1884
1885HIDING FILES OR DIRECTORIES *netrw-a* *netrw-hiding* {{{2
1886
1887Netrw's browsing facility allows one to use the hiding list in one of three
1888ways: ignore it, hide files which match, and show only those files which
1889match.
1890
1891If no files have been marked via |netrw-mf|:
1892
1893The "a" map allows the user to cycle through the three hiding modes.
1894
1895The |g:netrw_list_hide| variable holds a comma delimited list of patterns
1896based on regular expressions (ex. ^.*\.obj$,^\.) which specify the hiding list.
1897(also see |netrw-ctrl-h|) To set the hiding list, use the <c-h> map. As an
1898example, to hide files which begin with a ".", one may use the <c-h> map to
1899set the hiding list to '^\..*' (or one may put let g:netrw_list_hide= '^\..*'
1900in one's <.vimrc>). One may then use the "a" key to show all files, hide
1901matching files, or to show only the matching files.
1902
1903 Example: \.[ch]$
1904 This hiding list command will hide/show all *.c and *.h files.
1905
1906 Example: \.c$,\.h$
1907 This hiding list command will also hide/show all *.c and *.h
1908 files.
1909
1910Don't forget to use the "a" map to select the mode (normal/hiding/show) you
1911want!
1912
1913If files have been marked using |netrw-mf|, then this command will:
1914
1915 if showing all files or non-hidden files:
1916 modify the g:netrw_list_hide list by appending the marked files to it
1917 and showing only non-hidden files.
1918
1919 else if showing hidden files only:
1920 modify the g:netrw_list_hide list by removing the marked files from it
1921 and showing only non-hidden files.
1922 endif
1923
1924 *netrw-gh* *netrw-hide*
1925As a quick shortcut, one may press >
1926 gh
1927to toggle between hiding files which begin with a period (dot) and not hiding
1928them.
1929
Bram Moolenaar8d043172014-01-23 14:24:41 +01001930Associated setting variables: |g:netrw_list_hide| |g:netrw_hide|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001931Associated topics: |netrw-a| |netrw-ctrl-h| |netrw-mh|
1932
Bram Moolenaar8d043172014-01-23 14:24:41 +01001933 *netrw-gitignore*
1934Netrw provides a helper function 'netrw_gitignore#Hide()' that, when used with
1935|g:netrw_list_hide| automatically hides all git-ignored files.
1936
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001937'netrw_gitignore#Hide' searches for patterns in the following files: >
1938
Bram Moolenaar8d043172014-01-23 14:24:41 +01001939 './.gitignore'
1940 './.git/info/exclude'
1941 global gitignore file: `git config --global core.excludesfile`
1942 system gitignore file: `git config --system core.excludesfile`
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001943<
Bram Moolenaar8d043172014-01-23 14:24:41 +01001944Files that do not exist, are ignored.
1945Git-ignore patterns are taken from existing files, and converted to patterns for
1946hiding files. For example, if you had '*.log' in your '.gitignore' file, it
1947would be converted to '.*\.log'.
1948
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001949To use this function, simply assign its output to |g:netrw_list_hide| option. >
Bram Moolenaar8d043172014-01-23 14:24:41 +01001950
1951 Example: let g:netrw_list_hide= netrw_gitignore#Hide()
1952 Git-ignored files are hidden in Netrw.
1953
1954 Example: let g:netrw_list_hide= netrw_gitignore#Hide('my_gitignore_file')
1955 Function can take additional files with git-ignore patterns.
1956
1957 Example: g:netrw_list_hide= netrw_gitignore#Hide() . '.*\.swp$'
1958 Combining 'netrw_gitignore#Hide' with custom patterns.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01001959<
Bram Moolenaar8d043172014-01-23 14:24:41 +01001960
Bram Moolenaar446cb832008-06-24 21:56:24 +00001961IMPROVING BROWSING *netrw-listhack* *netrw-ssh-hack* {{{2
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001962
1963Especially with the remote directory browser, constantly entering the password
1964is tedious.
1965
Bram Moolenaar9964e462007-05-05 17:54:07 +00001966For Linux/Unix systems, the book "Linux Server Hacks - 100 industrial strength
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +00001967tips & tools" by Rob Flickenger (O'Reilly, ISBN 0-596-00461-3) gives a tip
1968for setting up no-password ssh and scp and discusses associated security
Bram Moolenaar9964e462007-05-05 17:54:07 +00001969issues. It used to be available at http://hacks.oreilly.com/pub/h/66 ,
1970but apparently that address is now being redirected to some "hackzine".
Bram Moolenaare37d50a2008-08-06 17:06:04 +00001971I'll attempt a summary based on that article and on a communication from
1972Ben Schmidt:
Bram Moolenaar843ee412004-06-30 16:16:41 +00001973
Bram Moolenaare37d50a2008-08-06 17:06:04 +00001974 1. Generate a public/private key pair on the local machine
1975 (ssh client): >
1976 ssh-keygen -t rsa
1977 (saving the file in ~/.ssh/id_rsa as prompted)
1978<
1979 2. Just hit the <CR> when asked for passphrase (twice) for no
1980 passphrase. If you do use a passphrase, you will also need to use
1981 ssh-agent so you only have to type the passphrase once per session.
1982 If you don't use a passphrase, simply logging onto your local
1983 computer or getting access to the keyfile in any way will suffice
1984 to access any ssh servers which have that key authorized for login.
1985
1986 3. This creates two files: >
1987 ~/.ssh/id_rsa
1988 ~/.ssh/id_rsa.pub
1989<
1990 4. On the target machine (ssh server): >
1991 cd
1992 mkdir -p .ssh
1993 chmod 0700 .ssh
1994<
1995 5. On your local machine (ssh client): (one line) >
1996 ssh {serverhostname}
1997 cat '>>' '~/.ssh/authorized_keys2' < ~/.ssh/id_rsa.pub
1998<
1999 or, for OpenSSH, (one line) >
2000 ssh {serverhostname}
2001 cat '>>' '~/.ssh/authorized_keys' < ~/.ssh/id_rsa.pub
2002<
2003You can test it out with >
2004 ssh {serverhostname}
2005and you should be log onto the server machine without further need to type
2006anything.
2007
2008If you decided to use a passphrase, do: >
2009 ssh-agent $SHELL
2010 ssh-add
2011 ssh {serverhostname}
2012You will be prompted for your key passphrase when you use ssh-add, but not
2013subsequently when you use ssh. For use with vim, you can use >
2014 ssh-agent vim
2015and, when next within vim, use >
2016 :!ssh-add
2017Alternatively, you can apply ssh-agent to the terminal you're planning on
2018running vim in: >
2019 ssh-agent xterm &
2020and do ssh-add whenever you need.
Bram Moolenaar843ee412004-06-30 16:16:41 +00002021
Bram Moolenaar9964e462007-05-05 17:54:07 +00002022For Windows, folks on the vim mailing list have mentioned that Pageant helps
2023with avoiding the constant need to enter the password.
Bram Moolenaar433f7c82006-03-21 21:29:36 +00002024
Bram Moolenaar446cb832008-06-24 21:56:24 +00002025Kingston Fung wrote about another way to avoid constantly needing to enter
2026passwords:
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00002027
Bram Moolenaar446cb832008-06-24 21:56:24 +00002028 In order to avoid the need to type in the password for scp each time, you
2029 provide a hack in the docs to set up a non password ssh account. I found a
2030 better way to do that: I can use a regular ssh account which uses a
2031 password to access the material without the need to key-in the password
2032 each time. It's good for security and convenience. I tried ssh public key
2033 authorization + ssh-agent, implementing this, and it works! Here are two
2034 links with instructions:
2035
2036 http://www.ibm.com/developerworks/library/l-keyc2/
2037 http://sial.org/howto/openssh/publickey-auth/
2038
2039
Bram Moolenaar8d043172014-01-23 14:24:41 +01002040 Ssh hints:
2041
2042 Thomer Gil has provided a hint on how to speed up netrw+ssh:
2043 http://thomer.com/howtos/netrw_ssh.html
2044
2045 Alex Young has several hints on speeding ssh up:
2046 http://usevim.com/2012/03/16/editing-remote-files/
2047
2048
Bram Moolenaar446cb832008-06-24 21:56:24 +00002049LISTING BOOKMARKS AND HISTORY *netrw-qb* *netrw-listbookmark* {{{2
2050
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002051Pressing "qb" (query bookmarks) will list both the bookmarked directories and
2052directory traversal history.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002053
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002054Related Topics:
2055 |netrw-gb| how to return (go) to a bookmark
2056 |netrw-mb| how to make a bookmark
2057 |netrw-mB| how to delete bookmarks
2058 |netrw-u| change to a predecessor directory via the history stack
2059 |netrw-U| change to a successor directory via the history stack
Bram Moolenaar446cb832008-06-24 21:56:24 +00002060
2061MAKING A NEW DIRECTORY *netrw-d* {{{2
2062
2063With the "d" map one may make a new directory either remotely (which depends
2064on the global variable g:netrw_mkdir_cmd) or locally (which depends on the
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002065global variable g:netrw_localmkdir). Netrw will issue a request for the new
Bram Moolenaar446cb832008-06-24 21:56:24 +00002066directory's name. A bare <CR> at that point will abort the making of the
2067directory. Attempts to make a local directory that already exists (as either
2068a file or a directory) will be detected, reported on, and ignored.
2069
Bram Moolenaar15146672011-10-20 22:22:38 +02002070Related topics: |netrw-D|
Bram Moolenaar8d043172014-01-23 14:24:41 +01002071Associated setting variables: |g:netrw_localmkdir| |g:netrw_mkdir_cmd|
2072 |g:netrw_remote_mkdir| |netrw-%|
Bram Moolenaar446cb832008-06-24 21:56:24 +00002073
2074
2075MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-c* {{{2
2076
2077By default, |g:netrw_keepdir| is 1. This setting means that the current
Bram Moolenaarff034192013-04-24 18:51:19 +02002078directory will not track the browsing directory. (done for backwards
2079compatibility with v6's file explorer).
Bram Moolenaar446cb832008-06-24 21:56:24 +00002080
Bram Moolenaarff034192013-04-24 18:51:19 +02002081Setting g:netrw_keepdir to 0 tells netrw to make vim's current directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002082track netrw's browsing directory.
2083
2084However, given the default setting for g:netrw_keepdir of 1 where netrw
2085maintains its own separate notion of the current directory, in order to make
2086the two directories the same, use the "c" map (just type c). That map will
2087set Vim's notion of the current directory to netrw's current browsing
2088directory.
2089
2090Associated setting variable: |g:netrw_keepdir|
2091
Bram Moolenaara6878372014-03-22 21:02:50 +01002092MARKING FILES *netrw-:MF* *netrw-mf* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002093 (also see |netrw-mr|)
2094
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002095Netrw provides several ways to mark files:
Bram Moolenaara6878372014-03-22 21:02:50 +01002096
2097 * One may mark files with the cursor atop a filename and
Bram Moolenaar13600302014-05-22 18:26:40 +02002098 then pressing "mf".
Bram Moolenaara6878372014-03-22 21:02:50 +01002099
2100 * With gvim, in addition one may mark files with
Bram Moolenaar13600302014-05-22 18:26:40 +02002101 <s-leftmouse>. (see |netrw-mouse|)
Bram Moolenaara6878372014-03-22 21:02:50 +01002102
2103 * One may use the :MF command, which takes a list of
Bram Moolenaar13600302014-05-22 18:26:40 +02002104 files (for local directories, the list may include
2105 wildcards -- see |glob()|) >
Bram Moolenaara6878372014-03-22 21:02:50 +01002106
2107 :MF *.c
2108<
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002109 (Note that :MF uses |<f-args>| to break the line
2110 at spaces)
2111
2112 * Mark files using the |argument-list| (|netrw-mA|)
2113
2114 * Mark files based upon a |location-list| (|netrw-qL|)
Bram Moolenaar13600302014-05-22 18:26:40 +02002115
2116 * Mark files based upon the quickfix list (|netrw-qF|)
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002117 (|quickfix-error-lists|)
Bram Moolenaara6878372014-03-22 21:02:50 +01002118
2119The following netrw maps make use of marked files:
Bram Moolenaar446cb832008-06-24 21:56:24 +00002120
2121 |netrw-a| Hide marked files/directories
2122 |netrw-D| Delete marked files/directories
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002123 |netrw-ma| Move marked files' names to |arglist|
2124 |netrw-mA| Move |arglist| filenames to marked file list
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002125 |netrw-mb| Append marked files to bookmarks
2126 |netrw-mB| Delete marked files from bookmarks
Bram Moolenaar446cb832008-06-24 21:56:24 +00002127 |netrw-mc| Copy marked files to target
2128 |netrw-md| Apply vimdiff to marked files
2129 |netrw-me| Edit marked files
Bram Moolenaarff034192013-04-24 18:51:19 +02002130 |netrw-mF| Unmark marked files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002131 |netrw-mg| Apply vimgrep to marked files
Bram Moolenaara6878372014-03-22 21:02:50 +01002132 |netrw-mm| Move marked files to target
Bram Moolenaar446cb832008-06-24 21:56:24 +00002133 |netrw-mp| Print marked files
2134 |netrw-mt| Set target for |netrw-mm| and |netrw-mc|
2135 |netrw-mT| Generate tags using marked files
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002136 |netrw-mv| Apply vim command to marked files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002137 |netrw-mx| Apply shell command to marked files
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002138 |netrw-mX| Apply shell command to marked files, en bloc
Bram Moolenaar446cb832008-06-24 21:56:24 +00002139 |netrw-mz| Compress/Decompress marked files
2140 |netrw-O| Obtain marked files
2141 |netrw-R| Rename marked files
2142
2143One may unmark files one at a time the same way one marks them; ie. place
2144the cursor atop a marked file and press "mf". This process also works
2145with <s-leftmouse> using gvim. One may unmark all files by pressing
2146"mu" (see |netrw-mu|).
2147
Bram Moolenaaradc21822011-04-01 18:03:16 +02002148Marked files are highlighted using the "netrwMarkFile" highlighting group,
2149which by default is linked to "Identifier" (see Identifier under
2150|group-name|). You may change the highlighting group by putting something
2151like >
2152
2153 highlight clear netrwMarkFile
2154 hi link netrwMarkFile ..whatever..
2155<
2156into $HOME/.vim/after/syntax/netrw.vim .
2157
Bram Moolenaar8d043172014-01-23 14:24:41 +01002158If the mouse is enabled and works with your vim, you may use <s-leftmouse> to
2159mark one or more files. You may mark multiple files by dragging the shifted
2160leftmouse. (see |netrw-mouse|)
2161
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002162 *markfilelist* *global_markfilelist* *local_markfilelist*
Bram Moolenaar446cb832008-06-24 21:56:24 +00002163All marked files are entered onto the global marked file list; there is only
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002164one such list. In addition, every netrw buffer also has its own buffer-local
2165marked file list; since netrw buffers are associated with specific
2166directories, this means that each directory has its own local marked file
2167list. The various commands which operate on marked files use one or the other
2168of the marked file lists.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002169
Bram Moolenaara6878372014-03-22 21:02:50 +01002170Known Problem: if one is using tree mode (|g:netrw_liststyle|) and several
2171directories have files with the same name, then marking such a file will
2172result in all such files being highlighted as if they were all marked. The
2173|markfilelist|, however, will only have the selected file in it. This problem
2174is unlikely to be fixed.
2175
Bram Moolenaar446cb832008-06-24 21:56:24 +00002176
Bram Moolenaarff034192013-04-24 18:51:19 +02002177UNMARKING FILES *netrw-mF* {{{2
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002178 (also see |netrw-mf|, |netrw-mu|)
Bram Moolenaarff034192013-04-24 18:51:19 +02002179
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002180The "mF" command will unmark all files in the current buffer. One may also use
2181mf (|netrw-mf|) on a specific, already marked, file to unmark just that file.
Bram Moolenaarff034192013-04-24 18:51:19 +02002182
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002183MARKING FILES BY LOCATION LIST *netrw-qL* {{{2
2184 (also see |netrw-mf|)
Bram Moolenaarff034192013-04-24 18:51:19 +02002185
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002186One may convert |location-list|s into a marked file list using "qL".
2187You may then proceed with commands such as me (|netrw-me|) to edit them.
2188
2189
2190MARKING FILES BY QUICKFIX LIST *netrw-qF* {{{2
Bram Moolenaarff034192013-04-24 18:51:19 +02002191 (also see |netrw-mf|)
2192
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002193One may convert |quickfix-error-lists| into a marked file list using "qF".
2194You may then proceed with commands such as me (|netrw-me|) to edit them.
2195Quickfix error lists are generated, for example, by calls to |:vimgrep|.
Bram Moolenaarff034192013-04-24 18:51:19 +02002196
2197
Bram Moolenaar446cb832008-06-24 21:56:24 +00002198MARKING FILES BY REGULAR EXPRESSION *netrw-mr* {{{2
2199 (also see |netrw-mf|)
2200
2201One may also mark files by pressing "mr"; netrw will then issue a prompt,
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002202"Enter regexp: ". You may then enter a shell-style regular expression such
2203as *.c$ (see |glob()|). For remote systems, glob() doesn't work -- so netrw
2204converts "*" into ".*" (see |regexp|) and marks files based on that. In the
2205future I may make it possible to use |regexp|s instead of glob()-style
2206expressions (yet-another-option).
Bram Moolenaar446cb832008-06-24 21:56:24 +00002207
2208
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002209MARKED FILES, ARBITRARY VIM COMMAND *netrw-mv* {{{2
2210 (See |netrw-mf| and |netrw-mr| for how to mark files)
2211 (uses the local marked-file list)
2212
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002213The "mv" map causes netrw to execute an arbitrary vim command on each file on
2214the local marked file list, individually:
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002215
2216 * 1split
2217 * sil! keepalt e file
2218 * run vim command
2219 * sil! keepalt wq!
2220
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002221A prompt, "Enter vim command: ", will be issued to elicit the vim command
2222you wish used.
2223
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002224
2225MARKED FILES, ARBITRARY SHELL COMMAND *netrw-mx* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002226 (See |netrw-mf| and |netrw-mr| for how to mark files)
2227 (uses the local marked-file list)
2228
2229Upon activation of the "mx" map, netrw will query the user for some (external)
2230command to be applied to all marked files. All "%"s in the command will be
2231substituted with the name of each marked file in turn. If no "%"s are in the
2232command, then the command will be followed by a space and a marked filename.
2233
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002234Example:
2235 (mark files)
2236 mx
2237 Enter command: cat
2238
2239 The result is a series of shell commands:
2240 cat 'file1'
2241 cat 'file2'
2242 ...
2243
2244
2245MARKED FILES, ARBITRARY SHELL COMMAND, EN BLOC *netrw-mX* {{{2
2246 (See |netrw-mf| and |netrw-mr| for how to mark files)
2247 (uses the global marked-file list)
2248
2249Upon activation of the 'mX' map, netrw will query the user for some (external)
2250command to be applied to all marked files on the global marked file list. The
2251"en bloc" means that one command will be executed on all the files at once: >
2252
2253 command files
2254
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002255This approach is useful, for example, to select files and make a tarball: >
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002256
2257 (mark files)
2258 mX
2259 Enter command: tar cf mynewtarball.tar
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002260<
2261The command that will be run with this example:
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002262
2263 tar cf mynewtarball.tar 'file1' 'file2' ...
2264
Bram Moolenaar446cb832008-06-24 21:56:24 +00002265
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002266MARKED FILES: ARGUMENT LIST *netrw-ma* *netrw-mA*
2267 (See |netrw-mf| and |netrw-mr| for how to mark files)
2268 (uses the global marked-file list)
2269
2270Using ma, one moves filenames from the marked file list to the argument list.
2271Using mA, one moves filenames from the argument list to the marked file list.
2272
2273See Also: |netrw-qF| |argument-list| |:args|
2274
2275
Bram Moolenaar446cb832008-06-24 21:56:24 +00002276MARKED FILES: COMPRESSION AND DECOMPRESSION *netrw-mz* {{{2
2277 (See |netrw-mf| and |netrw-mr| for how to mark files)
2278 (uses the local marked file list)
2279
2280If any marked files are compressed, then "mz" will decompress them.
2281If any marked files are decompressed, then "mz" will compress them
2282using the command specified by |g:netrw_compress|; by default,
2283that's "gzip".
2284
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002285For decompression, netrw uses a |Dictionary| of suffices and their
Bram Moolenaar446cb832008-06-24 21:56:24 +00002286associated decompressing utilities; see |g:netrw_decompress|.
2287
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002288Remember that one can mark multiple files by regular expression
2289(see |netrw-mr|); this is particularly useful to facilitate compressing and
2290decompressing a large number of files.
2291
Bram Moolenaar446cb832008-06-24 21:56:24 +00002292Associated setting variables: |g:netrw_compress| |g:netrw_decompress|
2293
2294MARKED FILES: COPYING *netrw-mc* {{{2
2295 (See |netrw-mf| and |netrw-mr| for how to mark files)
2296 (Uses the global marked file list)
2297
2298Select a target directory with mt (|netrw-mt|). Then change directory,
Bram Moolenaaradc21822011-04-01 18:03:16 +02002299select file(s) (see |netrw-mf|), and press "mc". The copy is done
2300from the current window (where one does the mf) to the target.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002301
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002302If one does not have a target directory set with |netrw-mt|, then netrw
2303will query you for a directory to copy to.
2304
2305One may also copy directories and their contents (local only) to a target
2306directory.
2307
2308Associated setting variables:
2309 |g:netrw_localcopycmd|
2310 |g:netrw_localcopydircmd|
2311 |g:netrw_ssh_cmd|
Bram Moolenaar446cb832008-06-24 21:56:24 +00002312
2313MARKED FILES: DIFF *netrw-md* {{{2
2314 (See |netrw-mf| and |netrw-mr| for how to mark files)
2315 (uses the global marked file list)
2316
2317Use |vimdiff| to visualize difference between selected files (two or
2318three may be selected for this). Uses the global marked file list.
2319
2320MARKED FILES: EDITING *netrw-me* {{{2
2321 (See |netrw-mf| and |netrw-mr| for how to mark files)
2322 (uses the global marked file list)
2323
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002324The "me" command will place the marked files on the |arglist| and commence
Bram Moolenaar446cb832008-06-24 21:56:24 +00002325editing them. One may return the to explorer window with |:Rexplore|.
Bram Moolenaarff034192013-04-24 18:51:19 +02002326(use |:n| and |:p| to edit next and previous files in the arglist)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002327
2328MARKED FILES: GREP *netrw-mg* {{{2
2329 (See |netrw-mf| and |netrw-mr| for how to mark files)
2330 (uses the global marked file list)
2331
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002332The "mg" command will apply |:vimgrep| to the marked files.
Bram Moolenaarff034192013-04-24 18:51:19 +02002333The command will ask for the requested pattern; one may then enter: >
2334
Bram Moolenaar446cb832008-06-24 21:56:24 +00002335 /pattern/[g][j]
2336 ! /pattern/[g][j]
2337 pattern
2338<
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002339With /pattern/, editing will start with the first item on the |quickfix| list
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002340that vimgrep sets up (see |:copen|, |:cnext|, |:cprevious|, |:cclose|). The |:vimgrep|
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002341command is in use, so without 'g' each line is added to quickfix list only
2342once; with 'g' every match is included.
2343
2344With /pattern/j, "mg" will winnow the current marked file list to just those
2345marked files also possessing the specified pattern. Thus, one may use >
2346
2347 mr ...file-pattern...
2348 mg /pattern/j
2349<
2350to have a marked file list satisfying the file-pattern but also restricted to
2351files containing some desired pattern.
2352
Bram Moolenaarff034192013-04-24 18:51:19 +02002353
Bram Moolenaar446cb832008-06-24 21:56:24 +00002354MARKED FILES: HIDING AND UNHIDING BY SUFFIX *netrw-mh* {{{2
2355 (See |netrw-mf| and |netrw-mr| for how to mark files)
2356 (uses the local marked file list)
2357
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002358The "mh" command extracts the suffices of the marked files and toggles their
Bram Moolenaar446cb832008-06-24 21:56:24 +00002359presence on the hiding list. Please note that marking the same suffix
2360this way multiple times will result in the suffix's presence being toggled
2361for each file (so an even quantity of marked files having the same suffix
2362is the same as not having bothered to select them at all).
2363
2364Related topics: |netrw-a| |g:netrw_list_hide|
2365
2366MARKED FILES: MOVING *netrw-mm* {{{2
2367 (See |netrw-mf| and |netrw-mr| for how to mark files)
2368 (uses the global marked file list)
2369
Bram Moolenaare37d50a2008-08-06 17:06:04 +00002370 WARNING: moving files is more dangerous than copying them.
2371 A file being moved is first copied and then deleted; if the
2372 copy operation fails and the delete succeeds, you will lose
2373 the file. Either try things out with unimportant files
2374 first or do the copy and then delete yourself using mc and D.
2375 Use at your own risk!
2376
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002377Select a target directory with mt (|netrw-mt|). Then change directory,
Bram Moolenaaradc21822011-04-01 18:03:16 +02002378select file(s) (see |netrw-mf|), and press "mm". The move is done
2379from the current window (where one does the mf) to the target.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002380
2381Associated setting variable: |g:netrw_localmovecmd| |g:netrw_ssh_cmd|
2382
2383MARKED FILES: PRINTING *netrw-mp* {{{2
2384 (See |netrw-mf| and |netrw-mr| for how to mark files)
2385 (uses the local marked file list)
2386
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002387When "mp" is used, netrw will apply the |:hardcopy| command to marked files.
2388What netrw does is open each file in a one-line window, execute hardcopy, then
2389close the one-line window.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002390
2391
2392MARKED FILES: SOURCING *netrw-ms* {{{2
2393 (See |netrw-mf| and |netrw-mr| for how to mark files)
2394 (uses the local marked file list)
2395
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002396With "ms", netrw will source the marked files (using vim's |:source| command)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002397
2398
Bram Moolenaarff034192013-04-24 18:51:19 +02002399MARKED FILES: SETTING THE TARGET DIRECTORY *netrw-mt* {{{2
2400 (See |netrw-mf| and |netrw-mr| for how to mark files)
2401
2402Set the marked file copy/move-to target (see |netrw-mc| and |netrw-mm|):
2403
2404 * If the cursor is atop a file name, then the netrw window's currently
2405 displayed directory is used for the copy/move-to target.
2406
2407 * Also, if the cursor is in the banner, then the netrw window's currently
2408 displayed directory is used for the copy/move-to target.
2409 Unless the target already is the current directory. In which case,
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002410 typing "mf" clears the target.
Bram Moolenaarff034192013-04-24 18:51:19 +02002411
2412 * However, if the cursor is atop a directory name, then that directory is
2413 used for the copy/move-to target
2414
Bram Moolenaara6878372014-03-22 21:02:50 +01002415 * One may use the :MT [directory] command to set the target *netrw-:MT*
2416 This command uses |<q-args>|, so spaces in the directory name are
2417 permitted without escaping.
2418
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002419 * With mouse-enabled vim or with gvim, one may select a target by using
2420 <c-leftmouse>
2421
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002422There is only one copy/move-to target at a time in a vim session; ie. the
2423target is a script variable (see |s:var|) and is shared between all netrw
2424windows (in an instance of vim).
Bram Moolenaarff034192013-04-24 18:51:19 +02002425
2426When using menus and gvim, netrw provides a "Targets" entry which allows one
2427to pick a target from the list of bookmarks and history.
2428
2429Related topics:
2430 Marking Files......................................|netrw-mf|
2431 Marking Files by Regular Expression................|netrw-mr|
2432 Marked Files: Target Directory Using Bookmarks.....|netrw-Tb|
2433 Marked Files: Target Directory Using History.......|netrw-Th|
2434
2435
Bram Moolenaar446cb832008-06-24 21:56:24 +00002436MARKED FILES: TAGGING *netrw-mT* {{{2
2437 (See |netrw-mf| and |netrw-mr| for how to mark files)
2438 (uses the global marked file list)
2439
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002440The "mT" mapping will apply the command in |g:netrw_ctags| (by default, it is
Bram Moolenaar446cb832008-06-24 21:56:24 +00002441"ctags") to marked files. For remote browsing, in order to create a tags file
2442netrw will use ssh (see |g:netrw_ssh_cmd|), and so ssh must be available for
2443this to work on remote systems. For your local system, see |ctags| on how to
2444get a version. I myself use hdrtags, currently available at
Bram Moolenaar97d62492012-11-15 21:28:22 +01002445http://www.drchip.org/astronaut/src/index.html , and have >
Bram Moolenaar446cb832008-06-24 21:56:24 +00002446
2447 let g:netrw_ctags= "hdrtag"
2448<
2449in my <.vimrc>.
2450
2451When a remote set of files are tagged, the resulting tags file is "obtained";
Bram Moolenaara6878372014-03-22 21:02:50 +01002452ie. a copy is transferred to the local system's directory. The now local tags
Bram Moolenaar446cb832008-06-24 21:56:24 +00002453file is then modified so that one may use it through the network. The
Bram Moolenaara6878372014-03-22 21:02:50 +01002454modification made concerns the names of the files in the tags; each filename is
Bram Moolenaar446cb832008-06-24 21:56:24 +00002455preceded by the netrw-compatible url used to obtain it. When one subsequently
2456uses one of the go to tag actions (|tags|), the url will be used by netrw to
2457edit the desired file and go to the tag.
2458
Bram Moolenaarc236c162008-07-13 17:41:49 +00002459Associated setting variables: |g:netrw_ctags| |g:netrw_ssh_cmd|
Bram Moolenaar446cb832008-06-24 21:56:24 +00002460
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002461MARKED FILES: TARGET DIRECTORY USING BOOKMARKS *netrw-Tb* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002462
Bram Moolenaara6878372014-03-22 21:02:50 +01002463Sets the marked file copy/move-to target.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002464
Bram Moolenaarff034192013-04-24 18:51:19 +02002465The |netrw-qb| map will give you a list of bookmarks (and history).
2466One may choose one of the bookmarks to become your marked file
2467target by using [count]Tb (default count: 1).
Bram Moolenaar446cb832008-06-24 21:56:24 +00002468
Bram Moolenaarff034192013-04-24 18:51:19 +02002469Related topics:
Bram Moolenaara6878372014-03-22 21:02:50 +01002470 Copying files to target............................|netrw-mc|
Bram Moolenaarff034192013-04-24 18:51:19 +02002471 Listing Bookmarks and History......................|netrw-qb|
2472 Marked Files: Setting The Target Directory.........|netrw-mt|
2473 Marked Files: Target Directory Using History.......|netrw-Th|
2474 Marking Files......................................|netrw-mf|
2475 Marking Files by Regular Expression................|netrw-mr|
Bram Moolenaara6878372014-03-22 21:02:50 +01002476 Moving files to target.............................|netrw-mm|
Bram Moolenaar446cb832008-06-24 21:56:24 +00002477
Bram Moolenaar446cb832008-06-24 21:56:24 +00002478
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002479MARKED FILES: TARGET DIRECTORY USING HISTORY *netrw-Th* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002480
Bram Moolenaara6878372014-03-22 21:02:50 +01002481Sets the marked file copy/move-to target.
Bram Moolenaarff034192013-04-24 18:51:19 +02002482
2483The |netrw-qb| map will give you a list of history (and bookmarks).
2484One may choose one of the history entries to become your marked file
2485target by using [count]Th (default count: 0; ie. the current directory).
2486
2487Related topics:
Bram Moolenaara6878372014-03-22 21:02:50 +01002488 Copying files to target............................|netrw-mc|
Bram Moolenaarff034192013-04-24 18:51:19 +02002489 Listing Bookmarks and History......................|netrw-qb|
2490 Marked Files: Setting The Target Directory.........|netrw-mt|
2491 Marked Files: Target Directory Using Bookmarks.....|netrw-Tb|
2492 Marking Files......................................|netrw-mf|
2493 Marking Files by Regular Expression................|netrw-mr|
Bram Moolenaara6878372014-03-22 21:02:50 +01002494 Moving files to target.............................|netrw-mm|
Bram Moolenaarff034192013-04-24 18:51:19 +02002495
Bram Moolenaar446cb832008-06-24 21:56:24 +00002496
2497MARKED FILES: UNMARKING *netrw-mu* {{{2
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002498 (See |netrw-mf|, |netrw-mF|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002499
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002500The "mu" mapping will unmark all currently marked files. This command differs
2501from "mF" as the latter only unmarks files in the current directory whereas
2502"mu" will unmark global and all buffer-local marked files.
2503(see |netrw-mF|)
2504
Bram Moolenaar446cb832008-06-24 21:56:24 +00002505
Bram Moolenaar15146672011-10-20 22:22:38 +02002506 *netrw-browser-settings*
Bram Moolenaar446cb832008-06-24 21:56:24 +00002507NETRW BROWSER VARIABLES *netrw-browser-options* *netrw-browser-var* {{{2
2508
Bram Moolenaar15146672011-10-20 22:22:38 +02002509(if you're interested in the netrw file transfer settings, see |netrw-options|
2510 and |netrw-protocol|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002511
2512The <netrw.vim> browser provides settings in the form of variables which
2513you may modify; by placing these settings in your <.vimrc>, you may customize
2514your browsing preferences. (see also: |netrw-settings|)
2515>
2516 --- -----------
2517 Var Explanation
2518 --- -----------
Bram Moolenaar8d043172014-01-23 14:24:41 +01002519< *g:netrw_altfile* some like |CTRL-^| to return to the last
2520 edited file. Choose that by setting this
2521 parameter to 1.
2522 Others like |CTRL-^| to return to the
2523 netrw browsing buffer. Choose that by setting
2524 this parameter to 0.
2525 default: =0
2526
2527 *g:netrw_alto* change from above splitting to below splitting
Bram Moolenaar446cb832008-06-24 21:56:24 +00002528 by setting this variable (see |netrw-o|)
2529 default: =&sb (see |'sb'|)
2530
Bram Moolenaarff034192013-04-24 18:51:19 +02002531 *g:netrw_altv* change from left splitting to right splitting
Bram Moolenaar446cb832008-06-24 21:56:24 +00002532 by setting this variable (see |netrw-v|)
2533 default: =&spr (see |'spr'|)
2534
Bram Moolenaarff034192013-04-24 18:51:19 +02002535 *g:netrw_banner* enable/suppress the banner
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002536 =0: suppress the banner
2537 =1: banner is enabled (default)
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002538
Bram Moolenaare6ae6222013-05-21 21:01:10 +02002539 *g:netrw_bannerbackslash* if this variable exists and is not zero, the
2540 banner will be displayed with backslashes
2541 rather than forward slashes.
2542
Bram Moolenaarff034192013-04-24 18:51:19 +02002543 *g:netrw_browse_split* when browsing, <cr> will open the file by:
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002544 =0: re-using the same window (default)
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002545 =1: horizontally splitting the window first
2546 =2: vertically splitting the window first
Bram Moolenaar446cb832008-06-24 21:56:24 +00002547 =3: open file in new tab
2548 =4: act like "P" (ie. open previous window)
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002549 Note that |g:netrw_preview| may be used
2550 to get vertical splitting instead of
2551 horizontal splitting.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002552 =[servername,tab-number,window-number]
2553 Given a |List| such as this, a remote server
2554 named by the "servername" will be used for
2555 editing. It will also use the specified tab
2556 and window numbers to perform editing
2557 (see |clientserver|, |netrw-ctrl-r|)
2558 This option does not affect |:Lexplore|
2559 windows.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002560
Bram Moolenaar8d043172014-01-23 14:24:41 +01002561 Related topics:
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002562 |g:netrw_alto| |g:netrw_altv|
2563 |netrw-C| |netrw-cr|
2564 |netrw-ctrl-r|
Bram Moolenaar8d043172014-01-23 14:24:41 +01002565
Bram Moolenaarff034192013-04-24 18:51:19 +02002566 *g:netrw_browsex_viewer* specify user's preference for a viewer: >
Bram Moolenaar446cb832008-06-24 21:56:24 +00002567 "kfmclient exec"
2568 "gnome-open"
2569< If >
2570 "-"
2571< is used, then netrwFileHandler() will look for
2572 a script/function to handle the given
2573 extension. (see |netrw_filehandler|).
2574
Bram Moolenaarff034192013-04-24 18:51:19 +02002575 *g:netrw_chgperm* Unix/Linux: "chmod PERM FILENAME"
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002576 Windows: "cacls FILENAME /e /p PERM"
2577 Used to change access permission for a file.
2578
Bram Moolenaarff034192013-04-24 18:51:19 +02002579 *g:netrw_compress* ="gzip"
Bram Moolenaar446cb832008-06-24 21:56:24 +00002580 Will compress marked files with this
2581 command
2582
Bram Moolenaarff034192013-04-24 18:51:19 +02002583 *g:Netrw_corehandler* Allows one to specify something additional
Bram Moolenaar15146672011-10-20 22:22:38 +02002584 to do when handling <core> files via netrw's
2585 browser's "x" command (see |netrw-x|). If
2586 present, g:Netrw_corehandler specifies
2587 either one or more function references
2588 (see |Funcref|). (the capital g:Netrw...
2589 is required its holding a function reference)
2590
2591
Bram Moolenaarff034192013-04-24 18:51:19 +02002592 *g:netrw_ctags* ="ctags"
2593 The default external program used to create
2594 tags
Bram Moolenaarc236c162008-07-13 17:41:49 +00002595
Bram Moolenaarff034192013-04-24 18:51:19 +02002596 *g:netrw_cursor* = 2 (default)
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002597 This option controls the use of the
Bram Moolenaaradc21822011-04-01 18:03:16 +02002598 |'cursorline'| (cul) and |'cursorcolumn'|
2599 (cuc) settings by netrw:
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002600
Bram Moolenaaradc21822011-04-01 18:03:16 +02002601 Value Thin-Long-Tree Wide
2602 =0 u-cul u-cuc u-cul u-cuc
2603 =1 u-cul u-cuc cul u-cuc
2604 =2 cul u-cuc cul u-cuc
2605 =3 cul u-cuc cul cuc
2606 =4 cul cuc cul cuc
2607
2608 Where
2609 u-cul : user's |'cursorline'| setting used
2610 u-cuc : user's |'cursorcolumn'| setting used
2611 cul : |'cursorline'| locally set
2612 cuc : |'cursorcolumn'| locally set
2613
Bram Moolenaarff034192013-04-24 18:51:19 +02002614 *g:netrw_decompress* = { ".gz" : "gunzip" ,
Bram Moolenaar446cb832008-06-24 21:56:24 +00002615 ".bz2" : "bunzip2" ,
2616 ".zip" : "unzip" ,
2617 ".tar" : "tar -xf"}
2618 A dictionary mapping suffices to
2619 decompression programs.
2620
Bram Moolenaaradc21822011-04-01 18:03:16 +02002621 *g:netrw_dirhistmax* =10: controls maximum quantity of past
2622 history. May be zero to supppress
2623 history.
2624 (related: |netrw-qb| |netrw-u| |netrw-U|)
2625
Bram Moolenaar97d62492012-11-15 21:28:22 +01002626 *g:netrw_dynamic_maxfilenamelen* =32: enables dynamic determination of
2627 |g:netrw_maxfilenamelen|, which affects
2628 local file long listing.
Bram Moolenaara6878372014-03-22 21:02:50 +01002629
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002630 *g:netrw_errorlvl* =0: error levels greater than or equal to
2631 this are permitted to be displayed
2632 0: notes
2633 1: warnings
2634 2: errors
2635
Bram Moolenaarff034192013-04-24 18:51:19 +02002636 *g:netrw_fastbrowse* =0: slow speed directory browsing;
Bram Moolenaar13600302014-05-22 18:26:40 +02002637 never re-uses directory listings;
Bram Moolenaar446cb832008-06-24 21:56:24 +00002638 always obtains directory listings.
2639 =1: medium speed directory browsing;
2640 re-use directory listings only
2641 when remote directory browsing.
2642 (default value)
2643 =2: fast directory browsing;
2644 only obtains directory listings when the
2645 directory hasn't been seen before
2646 (or |netrw-ctrl-l| is used).
2647
2648 Fast browsing retains old directory listing
2649 buffers so that they don't need to be
2650 re-acquired. This feature is especially
2651 important for remote browsing. However, if
2652 a file is introduced or deleted into or from
2653 such directories, the old directory buffer
2654 becomes out-of-date. One may always refresh
2655 such a directory listing with |netrw-ctrl-l|.
2656 This option gives the user the choice of
2657 trading off accuracy (ie. up-to-date listing)
2658 versus speed.
2659
Bram Moolenaar13600302014-05-22 18:26:40 +02002660 *g:netrw_ffkeep* (default: doesn't exist)
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002661 If this variable exists and is zero, then
Bram Moolenaar13600302014-05-22 18:26:40 +02002662 netrw will not do a save and restore for
2663 |'fileformat'|.
2664
Bram Moolenaarff034192013-04-24 18:51:19 +02002665 *g:netrw_fname_escape* =' ?&;%'
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002666 Used on filenames before remote reading/writing
Bram Moolenaar446cb832008-06-24 21:56:24 +00002667
Bram Moolenaarff034192013-04-24 18:51:19 +02002668 *g:netrw_ftp_browse_reject* ftp can produce a number of errors and warnings
Bram Moolenaar446cb832008-06-24 21:56:24 +00002669 that can show up as "directories" and "files"
2670 in the listing. This pattern is used to
2671 remove such embedded messages. By default its
2672 value is:
2673 '^total\s\+\d\+$\|
2674 ^Trying\s\+\d\+.*$\|
2675 ^KERBEROS_V\d rejected\|
2676 ^Security extensions not\|
2677 No such file\|
2678 : connect to address [0-9a-fA-F:]*
2679 : No route to host$'
2680
Bram Moolenaarff034192013-04-24 18:51:19 +02002681 *g:netrw_ftp_list_cmd* options for passing along to ftp for directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002682 listing. Defaults:
2683 unix or g:netrw_cygwin set: : "ls -lF"
2684 otherwise "dir"
2685
2686
Bram Moolenaarff034192013-04-24 18:51:19 +02002687 *g:netrw_ftp_sizelist_cmd* options for passing along to ftp for directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002688 listing, sorted by size of file.
2689 Defaults:
2690 unix or g:netrw_cygwin set: : "ls -slF"
2691 otherwise "dir"
2692
Bram Moolenaarff034192013-04-24 18:51:19 +02002693 *g:netrw_ftp_timelist_cmd* options for passing along to ftp for directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002694 listing, sorted by time of last modification.
2695 Defaults:
2696 unix or g:netrw_cygwin set: : "ls -tlF"
2697 otherwise "dir"
2698
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002699 *g:netrw_glob_escape* ='[]*?`{~$' (unix)
Bram Moolenaar00a927d2010-05-14 23:24:24 +02002700 ='[]*?`{$' (windows
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002701 These characters in directory names are
Bram Moolenaar446cb832008-06-24 21:56:24 +00002702 escaped before applying glob()
2703
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002704 *g:netrw_gx* ="<cfile>"
2705 This option controls how gx (|netrw-gx|) picks
2706 up the text under the cursor. See |expand()|
2707 for possibilities.
2708
Bram Moolenaarff034192013-04-24 18:51:19 +02002709 *g:netrw_hide* Controlled by the "a" map (see |netrw-a|)
2710 =0 : show all
2711 =1 : show not-hidden files
2712 =2 : show hidden files only
Bram Moolenaar446cb832008-06-24 21:56:24 +00002713 default: =0
2714
Bram Moolenaarff034192013-04-24 18:51:19 +02002715 *g:netrw_home* The home directory for where bookmarks and
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002716 history are saved (as .netrwbook and
2717 .netrwhist).
2718 default: the first directory on the
2719 |'runtimepath'|
2720
Bram Moolenaarff034192013-04-24 18:51:19 +02002721 *g:netrw_keepdir* =1 (default) keep current directory immune from
Bram Moolenaar446cb832008-06-24 21:56:24 +00002722 the browsing directory.
2723 =0 keep the current directory the same as the
2724 browsing directory.
2725 The current browsing directory is contained in
2726 b:netrw_curdir (also see |netrw-c|)
2727
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002728 *g:netrw_keepj* ="keepj" (default) netrw attempts to keep the
2729 |:jumps| table unaffected.
2730 ="" netrw will not use |:keepjumps| with
2731 exceptions only for the
2732 saving/restoration of position.
2733
Bram Moolenaarff034192013-04-24 18:51:19 +02002734 *g:netrw_list_cmd* command for listing remote directories
Bram Moolenaar446cb832008-06-24 21:56:24 +00002735 default: (if ssh is executable)
2736 "ssh HOSTNAME ls -FLa"
2737
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002738 *g:netrw_list_cmd_options* If this variable exists, then its contents are
2739 appended to the g:netrw_list_cmd. For
2740 example, use "2>/dev/null" to get rid of banner
2741 messages on unix systems.
2742
2743
Bram Moolenaarff034192013-04-24 18:51:19 +02002744 *g:netrw_liststyle* Set the default listing style:
Bram Moolenaar446cb832008-06-24 21:56:24 +00002745 = 0: thin listing (one file per line)
2746 = 1: long listing (one file per line with time
2747 stamp information and file size)
2748 = 2: wide listing (multiple files in columns)
2749 = 3: tree style listing
Bram Moolenaar8d043172014-01-23 14:24:41 +01002750
Bram Moolenaarff034192013-04-24 18:51:19 +02002751 *g:netrw_list_hide* comma separated pattern list for hiding files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002752 Patterns are regular expressions (see |regexp|)
Bram Moolenaar8d043172014-01-23 14:24:41 +01002753 There's some special support for git-ignore
2754 files: you may add the output from the helper
2755 function 'netrw_gitignore#Hide() automatically
2756 hiding all gitignored files.
2757 For more details see |netrw-gitignore|.
2758
2759 Examples:
2760 let g:netrw_list_hide= '.*\.swp$'
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002761 let g:netrw_list_hide= netrw_gitignore#Hide().'.*\.swp$'
Bram Moolenaar8d043172014-01-23 14:24:41 +01002762 default: ""
Bram Moolenaar446cb832008-06-24 21:56:24 +00002763
Bram Moolenaarff034192013-04-24 18:51:19 +02002764 *g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002765 ="copy" Windows
Bram Moolenaar446cb832008-06-24 21:56:24 +00002766 Copies marked files (|netrw-mf|) to target
2767 directory (|netrw-mt|, |netrw-mc|)
2768
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002769 *g:netrw_localcopydircmd* ="cp -R" Linux/Unix/MacOS/Cygwin
2770 ="xcopy /e /c /h/ /i /k" Windows
2771 Copies directories to target directory.
2772 (|netrw-mc|, |netrw-mt|)
2773
Bram Moolenaare6ae6222013-05-21 21:01:10 +02002774 *g:netrw_localmkdir* command for making a local directory
2775 default: "mkdir"
2776
Bram Moolenaarff034192013-04-24 18:51:19 +02002777 *g:netrw_localmovecmd* ="mv" Linux/Unix/MacOS/Cygwin
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002778 ="move" Windows
Bram Moolenaar446cb832008-06-24 21:56:24 +00002779 Moves marked files (|netrw-mf|) to target
2780 directory (|netrw-mt|, |netrw-mm|)
2781
Bram Moolenaarff034192013-04-24 18:51:19 +02002782 *g:netrw_localrmdir* remove directory command (rmdir)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002783 default: "rmdir"
2784
Bram Moolenaarff034192013-04-24 18:51:19 +02002785 *g:netrw_maxfilenamelen* =32 by default, selected so as to make long
Bram Moolenaar446cb832008-06-24 21:56:24 +00002786 listings fit on 80 column displays.
2787 If your screen is wider, and you have file
2788 or directory names longer than 32 bytes,
2789 you may set this option to keep listings
2790 columnar.
2791
Bram Moolenaarff034192013-04-24 18:51:19 +02002792 *g:netrw_mkdir_cmd* command for making a remote directory
Bram Moolenaar15146672011-10-20 22:22:38 +02002793 via ssh (also see |g:netrw_remote_mkdir|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002794 default: "ssh USEPORT HOSTNAME mkdir"
2795
Bram Moolenaar251e1912011-06-19 05:09:16 +02002796 *g:netrw_mousemaps* =1 (default) enables mouse buttons while
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002797 browsing to:
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002798 leftmouse : open file/directory
2799 shift-leftmouse : mark file
2800 middlemouse : same as P
2801 rightmouse : remove file/directory
2802 =0: disables mouse maps
2803
Bram Moolenaar15146672011-10-20 22:22:38 +02002804 *g:netrw_nobeval* doesn't exist (default)
2805 If this variable exists, then balloon
2806 evaluation will be suppressed
2807 (see |'ballooneval'|)
2808
Bram Moolenaare0fa3742016-02-20 15:47:01 +01002809 *g:netrw_sizestyle* not defined: actual bytes (default)
2810 ="b" : actual bytes (default)
2811 ="h" : human-readable (ex. 5k, 4m, 3g)
2812 uses 1000 base
2813 ="H" : human-readable (ex. 5K, 4M, 3G)
2814 uses 1024 base
2815 The long listing (|netrw-i|) and query-file
2816 maps (|netrw-qf|) will display file size
2817 using the specified style.
2818
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002819 *g:netrw_usetab* if this variable exists and is non-zero, then
2820 the <tab> map supporting shrinking/expanding a
2821 Lexplore or netrw window will be enabled.
2822 (see |netrw-c-tab|)
2823
Bram Moolenaara6878372014-03-22 21:02:50 +01002824 *g:netrw_remote_mkdir* command for making a remote directory
Bram Moolenaar15146672011-10-20 22:22:38 +02002825 via ftp (also see |g:netrw_mkdir_cmd|)
2826 default: "mkdir"
2827
Bram Moolenaarff034192013-04-24 18:51:19 +02002828 *g:netrw_retmap* if it exists and is set to one, then:
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002829 * if in a netrw-selected file, AND
2830 * no normal-mode <2-leftmouse> mapping exists,
2831 then the <2-leftmouse> will be mapped for easy
Bram Moolenaar446cb832008-06-24 21:56:24 +00002832 return to the netrw browser window.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002833 example: click once to select and open a file,
2834 double-click to return.
2835
2836 Note that one may instead choose to:
2837 * let g:netrw_retmap= 1, AND
2838 * nmap <silent> YourChoice <Plug>NetrwReturn
2839 and have another mapping instead of
2840 <2-leftmouse> to invoke the return.
2841
2842 You may also use the |:Rexplore| command to do
2843 the same thing.
2844
Bram Moolenaar446cb832008-06-24 21:56:24 +00002845 default: =0
2846
Bram Moolenaar13600302014-05-22 18:26:40 +02002847 *g:netrw_rm_cmd* command for removing remote files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002848 default: "ssh USEPORT HOSTNAME rm"
2849
Bram Moolenaar13600302014-05-22 18:26:40 +02002850 *g:netrw_rmdir_cmd* command for removing remote directories
Bram Moolenaar446cb832008-06-24 21:56:24 +00002851 default: "ssh USEPORT HOSTNAME rmdir"
2852
Bram Moolenaar13600302014-05-22 18:26:40 +02002853 *g:netrw_rmf_cmd* command for removing remote softlinks
Bram Moolenaar446cb832008-06-24 21:56:24 +00002854 default: "ssh USEPORT HOSTNAME rm -f"
2855
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01002856 *g:netrw_servername* use this variable to provide a name for
2857 |netrw-ctrl-r| to use for its server.
2858 default: "NETRWSERVER"
2859
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002860 *g:netrw_sort_by* sort by "name", "time", "size", or
2861 "exten".
Bram Moolenaar446cb832008-06-24 21:56:24 +00002862 default: "name"
2863
Bram Moolenaarff034192013-04-24 18:51:19 +02002864 *g:netrw_sort_direction* sorting direction: "normal" or "reverse"
Bram Moolenaar446cb832008-06-24 21:56:24 +00002865 default: "normal"
2866
Bram Moolenaarff034192013-04-24 18:51:19 +02002867 *g:netrw_sort_options* sorting is done using |:sort|; this
Bram Moolenaarc236c162008-07-13 17:41:49 +00002868 variable's value is appended to the
2869 sort command. Thus one may ignore case,
2870 for example, with the following in your
2871 .vimrc: >
2872 let g:netrw_sort_options="i"
2873< default: ""
2874
Bram Moolenaarff034192013-04-24 18:51:19 +02002875 *g:netrw_sort_sequence* when sorting by name, first sort by the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002876 comma-separated pattern sequence. Note that
Bram Moolenaara6878372014-03-22 21:02:50 +01002877 any filigree added to indicate filetypes
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002878 should be accounted for in your pattern.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002879 default: '[\/]$,*,\.bak$,\.o$,\.h$,
2880 \.info$,\.swp$,\.obj$'
2881
Bram Moolenaarff034192013-04-24 18:51:19 +02002882 *g:netrw_special_syntax* If true, then certain files will be shown
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002883 using special syntax in the browser:
Bram Moolenaar446cb832008-06-24 21:56:24 +00002884
2885 netrwBak : *.bak
2886 netrwCompress: *.gz *.bz2 *.Z *.zip
2887 netrwData : *.dat
2888 netrwHdr : *.h
2889 netrwLib : *.a *.so *.lib *.dll
2890 netrwMakefile: [mM]akefile *.mak
2891 netrwObj : *.o *.obj
2892 netrwTags : tags ANmenu ANtags
Bram Moolenaara6878372014-03-22 21:02:50 +01002893 netrwTilde : *
Bram Moolenaar446cb832008-06-24 21:56:24 +00002894 netrwTmp : tmp* *tmp
2895
2896 These syntax highlighting groups are linked
2897 to Folded or DiffChange by default
2898 (see |hl-Folded| and |hl-DiffChange|), but
2899 one may put lines like >
2900 hi link netrwCompress Visual
2901< into one's <.vimrc> to use one's own
Bram Moolenaara6878372014-03-22 21:02:50 +01002902 preferences. Alternatively, one may
2903 put such specifications into
2904 .vim/after/syntax/netrw.vim.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002905
Bram Moolenaara6878372014-03-22 21:02:50 +01002906 As an example, I myself use a dark-background
2907 colorscheme with the following in
2908 .vim/after/syntax/netrw.vim: >
2909
2910 hi netrwCompress term=NONE cterm=NONE gui=NONE ctermfg=10 guifg=green ctermbg=0 guibg=black
2911 hi netrwData term=NONE cterm=NONE gui=NONE ctermfg=9 guifg=blue ctermbg=0 guibg=black
2912 hi netrwHdr term=NONE cterm=NONE,italic gui=NONE guifg=SeaGreen1
2913 hi netrwLex term=NONE cterm=NONE,italic gui=NONE guifg=SeaGreen1
2914 hi netrwYacc term=NONE cterm=NONE,italic gui=NONE guifg=SeaGreen1
2915 hi netrwLib term=NONE cterm=NONE gui=NONE ctermfg=14 guifg=yellow
2916 hi netrwObj term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
2917 hi netrwTilde term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
2918 hi netrwTmp term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
2919 hi netrwTags term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
2920 hi netrwDoc term=NONE cterm=NONE gui=NONE ctermfg=220 ctermbg=27 guifg=yellow2 guibg=Blue3
2921 hi netrwSymLink term=NONE cterm=NONE gui=NONE ctermfg=220 ctermbg=27 guifg=grey60
2922<
Bram Moolenaarff034192013-04-24 18:51:19 +02002923 *g:netrw_ssh_browse_reject* ssh can sometimes produce unwanted lines,
Bram Moolenaar446cb832008-06-24 21:56:24 +00002924 messages, banners, and whatnot that one doesn't
2925 want masquerading as "directories" and "files".
2926 Use this pattern to remove such embedded
2927 messages. By default its value is:
2928 '^total\s\+\d\+$'
2929
Bram Moolenaare6ae6222013-05-21 21:01:10 +02002930 *g:netrw_ssh_cmd* One may specify an executable command
2931 to use instead of ssh for remote actions
2932 such as listing, file removal, etc.
2933 default: ssh
2934
Bram Moolenaaraa3b15d2016-04-21 08:53:19 +02002935 *g:netrw_suppress_gx_mesg* =1 : browsers sometimes produce messages
2936 which are normally unwanted intermixed
2937 with the page.
2938 However, when using links, for example,
2939 those messages are what the browser produces.
2940 By setting this option to 0, netrw will not
2941 suppress browser messages.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002942
Bram Moolenaarff034192013-04-24 18:51:19 +02002943 *g:netrw_tmpfile_escape* =' &;'
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002944 escape() is applied to all temporary files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002945 to escape these characters.
2946
Bram Moolenaarff034192013-04-24 18:51:19 +02002947 *g:netrw_timefmt* specify format string to vim's strftime().
Bram Moolenaar446cb832008-06-24 21:56:24 +00002948 The default, "%c", is "the preferred date
2949 and time representation for the current
2950 locale" according to my manpage entry for
2951 strftime(); however, not all are satisfied
2952 with it. Some alternatives:
2953 "%a %d %b %Y %T",
2954 " %a %Y-%m-%d %I-%M-%S %p"
2955 default: "%c"
2956
Bram Moolenaarff034192013-04-24 18:51:19 +02002957 *g:netrw_use_noswf* netrw normally avoids writing swapfiles
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002958 for browser buffers. However, under some
Bram Moolenaar446cb832008-06-24 21:56:24 +00002959 systems this apparently is causing nasty
2960 ml_get errors to appear; if you're getting
2961 ml_get errors, try putting
2962 let g:netrw_use_noswf= 0
2963 in your .vimrc.
Bram Moolenaara6878372014-03-22 21:02:50 +01002964 default: 1
Bram Moolenaar446cb832008-06-24 21:56:24 +00002965
Bram Moolenaarff034192013-04-24 18:51:19 +02002966 *g:netrw_winsize* specify initial size of new windows made with
Bram Moolenaar446cb832008-06-24 21:56:24 +00002967 "o" (see |netrw-o|), "v" (see |netrw-v|),
Bram Moolenaar251e1912011-06-19 05:09:16 +02002968 |:Hexplore| or |:Vexplore|. The g:netrw_winsize
2969 is an integer describing the percentage of the
2970 current netrw buffer's window to be used for
2971 the new window.
Bram Moolenaar15146672011-10-20 22:22:38 +02002972 If g:netrw_winsize is less than zero, then
2973 the absolute value of g:netrw_winsize lines
2974 or columns will be used for the new window.
Bram Moolenaar13600302014-05-22 18:26:40 +02002975 If g:netrw_winsize is zero, then a normal
2976 split will be made (ie. |'equalalways'| will
2977 take effect, for example).
Bram Moolenaar251e1912011-06-19 05:09:16 +02002978 default: 50 (for 50%)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002979
Bram Moolenaara0f849e2015-10-30 14:37:44 +01002980 *g:netrw_wiw* =1 specifies the minimum window width to use
2981 when shrinking a netrw/Lexplore window
2982 (see |netrw-c-tab|).
2983
Bram Moolenaarff034192013-04-24 18:51:19 +02002984 *g:netrw_xstrlen* Controls how netrw computes string lengths,
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002985 including multi-byte characters' string
Bram Moolenaar446cb832008-06-24 21:56:24 +00002986 length. (thanks to N Weibull, T Mechelynck)
2987 =0: uses Vim's built-in strlen()
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002988 =1: number of codepoints (Latin a + combining
Bram Moolenaar446cb832008-06-24 21:56:24 +00002989 circumflex is two codepoints) (DEFAULT)
2990 =2: number of spacing codepoints (Latin a +
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002991 combining circumflex is one spacing
Bram Moolenaar446cb832008-06-24 21:56:24 +00002992 codepoint; a hard tab is one; wide and
2993 narrow CJK are one each; etc.)
2994 =3: virtual length (counting tabs as anything
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002995 between 1 and |'tabstop'|, wide CJK as 2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002996 rather than 1, Arabic alif as zero when
2997 immediately preceded by lam, one
2998 otherwise, etc)
2999
Bram Moolenaarff034192013-04-24 18:51:19 +02003000 *g:NetrwTopLvlMenu* This variable specifies the top level
Bram Moolenaar446cb832008-06-24 21:56:24 +00003001 menu name; by default, it's "Netrw.". If
3002 you wish to change this, do so in your
3003 .vimrc.
3004
3005NETRW BROWSING AND OPTION INCOMPATIBILITIES *netrw-incompatible* {{{2
3006
3007Netrw has been designed to handle user options by saving them, setting the
3008options to something that's compatible with netrw's needs, and then restoring
3009them. However, the autochdir option: >
3010 :set acd
Bram Moolenaara6878372014-03-22 21:02:50 +01003011is problematic. Autochdir sets the current directory to that containing the
Bram Moolenaar446cb832008-06-24 21:56:24 +00003012file you edit; this apparently also applies to directories. In other words,
3013autochdir sets the current directory to that containing the "file" (even if
3014that "file" is itself a directory).
3015
Bram Moolenaar15146672011-10-20 22:22:38 +02003016NETRW SETTINGS WINDOW *netrw-settings-window* {{{2
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00003017
3018With the NetrwSettings.vim plugin, >
3019 :NetrwSettings
3020will bring up a window with the many variables that netrw uses for its
Bram Moolenaar1afcace2005-11-25 19:54:28 +00003021settings. You may change any of their values; when you save the file, the
3022settings therein will be used. One may also press "?" on any of the lines for
3023help on what each of the variables do.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00003024
Bram Moolenaar5b435d62012-04-05 17:33:26 +02003025(also see: |netrw-browser-var| |netrw-protocol| |netrw-variables|)
Bram Moolenaar9964e462007-05-05 17:54:07 +00003026
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00003027
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00003028==============================================================================
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003029OBTAINING A FILE *netrw-obtain* *netrw-O* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00003030
3031If there are no marked files:
3032
3033 When browsing a remote directory, one may obtain a file under the cursor
3034 (ie. get a copy on your local machine, but not edit it) by pressing the O
3035 key.
3036
3037If there are marked files:
3038
3039 The marked files will be obtained (ie. a copy will be transferred to your
3040 local machine, but not set up for editing).
3041
3042Only ftp and scp are supported for this operation (but since these two are
3043available for browsing, that shouldn't be a problem). The status bar will
3044then show, on its right hand side, a message like "Obtaining filename". The
3045statusline will be restored after the transfer is complete.
3046
3047Netrw can also "obtain" a file using the local browser. Netrw's display
3048of a directory is not necessarily the same as Vim's "current directory",
3049unless |g:netrw_keepdir| is set to 0 in the user's <.vimrc>. One may select
3050a file using the local browser (by putting the cursor on it) and pressing
3051"O" will then "obtain" the file; ie. copy it to Vim's current directory.
3052
3053Related topics:
3054 * To see what the current directory is, use |:pwd|
3055 * To make the currently browsed directory the current directory, see |netrw-c|
3056 * To automatically make the currently browsed directory the current
3057 directory, see |g:netrw_keepdir|.
3058
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003059 *netrw-newfile* *netrw-createfile*
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003060OPEN A NEW FILE IN NETRW'S CURRENT DIRECTORY *netrw-%* {{{2
Bram Moolenaarc236c162008-07-13 17:41:49 +00003061
Bram Moolenaara6878372014-03-22 21:02:50 +01003062To open a new file in netrw's current directory, press "%". This map
3063will query the user for a new filename; an empty file by that name will
3064be placed in the netrw's current directory (ie. b:netrw_curdir).
Bram Moolenaarc236c162008-07-13 17:41:49 +00003065
Bram Moolenaar8d043172014-01-23 14:24:41 +01003066Related topics: |netrw-d|
3067
Bram Moolenaarc236c162008-07-13 17:41:49 +00003068
Bram Moolenaar446cb832008-06-24 21:56:24 +00003069PREVIEW WINDOW *netrw-p* *netrw-preview* {{{2
3070
3071One may use a preview window by using the "p" key when the cursor is atop the
3072desired filename to be previewed. The display will then split to show both
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003073the browser (where the cursor will remain) and the file (see |:pedit|). By
3074default, the split will be taken horizontally; one may use vertical splitting
3075if one has set |g:netrw_preview| first.
Bram Moolenaar446cb832008-06-24 21:56:24 +00003076
Bram Moolenaar00a927d2010-05-14 23:24:24 +02003077An interesting set of netrw settings is: >
3078
3079 let g:netrw_preview = 1
3080 let g:netrw_liststyle = 3
3081 let g:netrw_winsize = 30
3082
3083These will:
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003084
Bram Moolenaar00a927d2010-05-14 23:24:24 +02003085 1. Make vertical splitting the default for previewing files
3086 2. Make the default listing style "tree"
3087 3. When a vertical preview window is opened, the directory listing
Bram Moolenaar5b435d62012-04-05 17:33:26 +02003088 will use only 30% of the columns available; the rest of the window
3089 is used for the preview window.
Bram Moolenaar446cb832008-06-24 21:56:24 +00003090
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003091 Related: if you like this idea, you may also find :Lexplore
3092 (|netrw-:Lexplore|) or |g:netrw_chgwin| of interest
3093
Bram Moolenaare0fa3742016-02-20 15:47:01 +01003094Also see: |g:netrw_chgwin| |netrw-P| |'previewwindow'| |CTRL-W_z| |:pclose|
Bram Moolenaara6878372014-03-22 21:02:50 +01003095
3096
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003097PREVIOUS WINDOW *netrw-P* *netrw-prvwin* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00003098
Bram Moolenaare0fa3742016-02-20 15:47:01 +01003099To edit a file or directory under the cursor in the previously used (last
3100accessed) window (see :he |CTRL-W_p|), press a "P". If there's only one
3101window, then the one window will be horizontally split (by default).
Bram Moolenaar446cb832008-06-24 21:56:24 +00003102
3103If there's more than one window, the previous window will be re-used on
3104the selected file/directory. If the previous window's associated buffer
3105has been modified, and there's only one window with that buffer, then
3106the user will be asked if s/he wishes to save the buffer first (yes,
3107no, or cancel).
3108
Bram Moolenaarff034192013-04-24 18:51:19 +02003109Related Actions |netrw-cr| |netrw-o| |netrw-t| |netrw-v|
Bram Moolenaar15146672011-10-20 22:22:38 +02003110Associated setting variables:
3111 |g:netrw_alto| control above/below splitting
3112 |g:netrw_altv| control right/left splitting
3113 |g:netrw_preview| control horizontal vs vertical splitting
3114 |g:netrw_winsize| control initial sizing
3115
Bram Moolenaara6878372014-03-22 21:02:50 +01003116Also see: |g:netrw_chgwin| |netrw-p|
3117
Bram Moolenaar446cb832008-06-24 21:56:24 +00003118
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003119REFRESHING THE LISTING *netrw-refresh* *netrw-ctrl-l* *netrw-ctrl_l* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00003120
3121To refresh either a local or remote directory listing, press ctrl-l (<c-l>) or
3122hit the <cr> when atop the ./ directory entry in the listing. One may also
3123refresh a local directory by using ":e .".
3124
3125
Bram Moolenaarff034192013-04-24 18:51:19 +02003126REVERSING SORTING ORDER *netrw-r* *netrw-reverse* {{{2
3127
3128One may toggle between normal and reverse sorting order by pressing the
3129"r" key.
3130
3131Related topics: |netrw-s|
3132Associated setting variable: |g:netrw_sort_direction|
3133
3134
Bram Moolenaar446cb832008-06-24 21:56:24 +00003135RENAMING FILES OR DIRECTORIES *netrw-move* *netrw-rename* *netrw-R* {{{2
3136
3137If there are no marked files: (see |netrw-mf|)
3138
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003139 Renaming files and directories involves moving the cursor to the
Bram Moolenaar446cb832008-06-24 21:56:24 +00003140 file/directory to be moved (renamed) and pressing "R". You will then be
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003141 queried for what you want the file/directory to be renamed to You may select
Bram Moolenaar446cb832008-06-24 21:56:24 +00003142 a range of lines with the "V" command (visual selection), and then
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003143 press "R"; you will be queried for each file as to what you want it
3144 renamed to.
Bram Moolenaar446cb832008-06-24 21:56:24 +00003145
3146If there are marked files: (see |netrw-mf|)
3147
3148 Marked files will be renamed (moved). You will be queried as above in
3149 order to specify where you want the file/directory to be moved.
3150
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003151 If you answer a renaming query with a "s/frompattern/topattern/", then
3152 subsequent files on the marked file list will be renamed by taking each
3153 name, applying that substitute, and renaming each file to the result.
3154 As an example : >
3155
3156 mr [query: reply with *.c]
3157 R [query: reply with s/^\(.*\)\.c$/\1.cpp/]
3158<
3159 This example will mark all *.c files and then rename them to *.cpp
3160 files.
3161
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003162 The ctrl-X character has special meaning for renaming files: >
3163
3164 <c-x> : a single ctrl-x tells netrw to ignore the portion of the response
3165 lying between the last '/' and the ctrl-x.
3166
3167 <c-x><c-x> : a pair of contiguous ctrl-x's tells netrw to ignore any
3168 portion of the string preceding the double ctrl-x's.
3169<
Bram Moolenaar446cb832008-06-24 21:56:24 +00003170 WARNING:~
3171
3172 Note that moving files is a dangerous operation; copies are safer. That's
3173 because a "move" for remote files is actually a copy + delete -- and if
3174 the copy fails and the delete does not, you may lose the file.
Bram Moolenaara6878372014-03-22 21:02:50 +01003175 Use at your own risk.
Bram Moolenaar446cb832008-06-24 21:56:24 +00003176
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003177The g:netrw_rename_cmd variable is used to implement remote renaming. By
3178default its value is:
Bram Moolenaar446cb832008-06-24 21:56:24 +00003179
3180 ssh HOSTNAME mv
3181
3182One may rename a block of files and directories by selecting them with
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003183V (|linewise-visual|) when using thin style
Bram Moolenaar446cb832008-06-24 21:56:24 +00003184
3185
Bram Moolenaar446cb832008-06-24 21:56:24 +00003186SELECTING SORTING STYLE *netrw-s* *netrw-sort* {{{2
3187
3188One may select the sorting style by name, time, or (file) size. The "s" map
3189allows one to circulate amongst the three choices; the directory listing will
3190automatically be refreshed to reflect the selected style.
3191
3192Related topics: |netrw-r| |netrw-S|
3193Associated setting variables: |g:netrw_sort_by| |g:netrw_sort_sequence|
3194
3195
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003196SETTING EDITING WINDOW *netrw-editwindow* *netrw-C* *netrw-:NetrwC* {{{2
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003197
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003198One may select a netrw window for editing with the "C" mapping, using the
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003199:NetrwC [win#] command, or by setting |g:netrw_chgwin| to the selected window
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003200number. Subsequent selection of a file to edit (|netrw-cr|) will use that
3201window.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003202
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003203 * C : by itself, will select the current window holding a netrw buffer
3204 for editing via |netrw-cr|. The C mapping is only available while in
3205 netrw buffers.
Bram Moolenaar13600302014-05-22 18:26:40 +02003206
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003207 * [count]C : the count will be used as the window number to be used
3208 for subsequent editing via |netrw-cr|.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003209
3210 * :NetrwC will set |g:netrw_chgwin| to the current window
3211
3212 * :NetrwC win# will set |g:netrw_chgwin| to the specified window
3213 number
3214
Bram Moolenaar13600302014-05-22 18:26:40 +02003215Using >
3216 let g:netrw_chgwin= -1
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003217will restore the default editing behavior
3218(ie. editing will use the current window).
Bram Moolenaar13600302014-05-22 18:26:40 +02003219
Bram Moolenaar8d043172014-01-23 14:24:41 +01003220Related topics: |netrw-cr| |g:netrw_browse_split|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003221Associated setting variables: |g:netrw_chgwin|
3222
3223
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003224SHRINKING OR EXPANDING A NETRW OR LEXPLORE WINDOW *netrw-c-tab* {{{2
3225
3226The <c-tab> key will toggle a netrw or |:Lexplore| window's width,
3227but only if |g:netrw_usetab| exists and is non-zero (and, of course,
3228only if your terminal supports differentiating <c-tab> from a plain
3229<tab>).
3230
3231 * If the current window is a netrw window, toggle its width
3232 (between |g:netrw_wiw| and its original width)
3233
3234 * Else if there is a |:Lexplore| window in the current tab, toggle
3235 its width
3236
3237 * Else bring up a |:Lexplore| window
3238
3239If |g:netrw_usetab| exists or is zero, or if there is a pre-existing mapping
Bram Moolenaare0fa3742016-02-20 15:47:01 +01003240for <c-tab>, then the <c-tab> will not be mapped. One may map something other
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003241than a <c-tab>, too: (but you'll still need to have had g:netrw_usetab set) >
3242
3243 nmap <unique> (whatever) <Plug>NetrwShrink
3244<
3245Related topics: |:Lexplore|
3246Associated setting variable: |g:netrw_usetab|
3247
3248
3249USER SPECIFIED MAPS *netrw-usermaps* {{{1
3250
3251One may make customized user maps. Specify a variable, |g:Netrw_UserMaps|,
3252to hold a |List| of lists of keymap strings and function names: >
3253
3254 [["keymap-sequence","ExampleUserMapFunc"],...]
3255<
3256When netrw is setting up maps for a netrw buffer, if |g:Netrw_UserMaps|
3257exists, then the internal function netrw#UserMaps(islocal) is called.
3258This function goes through all the entries in the |g:Netrw_UserMaps| list:
3259
3260 * sets up maps: >
3261 nno <buffer> <silent> KEYMAP-SEQUENCE
3262 :call s:UserMaps(islocal,"ExampleUserMapFunc")
3263< * refreshes if result from that function call is the string
3264 "refresh"
3265 * if the result string is not "", then that string will be
3266 executed (:exe result)
3267 * if the result is a List, then the above two actions on results
3268 will be taken for every string in the result List
3269
3270The user function is passed one argument; it resembles >
3271
3272 fun! ExampleUserMapFunc(islocal)
3273<
3274where a:islocal is 1 if its a local-directory system call or 0 when
3275remote-directory system call.
3276
3277Use netrw#Expose("varname") to access netrw-internal (script-local)
3278 variables.
3279Use netrw#Modify("varname",newvalue) to change netrw-internal variables.
3280Use netrw#Call("funcname"[,args]) to call a netrw-internal function with
3281 specified arguments.
3282
3283Example: Get a copy of netrw's marked file list: >
3284
3285 let netrwmarkfilelist= netrw#Expose("netrwmarkfilelist")
3286<
3287Example: Modify the value of netrw's marked file list: >
3288
3289 call netrw#Modify("netrwmarkfilelist",[])
3290<
3291Example: Clear netrw's marked file list via a mapping on gu >
3292 " ExampleUserMap: {{{2
3293 fun! ExampleUserMap(islocal)
3294 call netrw#Modify("netrwmarkfilelist",[])
3295 call netrw#Modify('netrwmarkfilemtch_{bufnr("%")}',"")
3296 let retval= ["refresh"]
3297 return retval
3298 endfun
3299 let g:Netrw_UserMaps= [["gu","ExampleUserMap"]]
3300<
3301
Bram Moolenaar446cb832008-06-24 21:56:24 +0000330210. Problems and Fixes *netrw-problems* {{{1
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003303
3304 (This section is likely to grow as I get feedback)
3305 (also see |netrw-debug|)
Bram Moolenaar488c6512005-08-11 20:09:58 +00003306 *netrw-p1*
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003307 P1. I use windows 95, and my ftp dumps four blank lines at the
3308 end of every read.
3309
3310 See |netrw-fixup|, and put the following into your
3311 <.vimrc> file:
3312
3313 let g:netrw_win95ftp= 1
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00003314
Bram Moolenaar488c6512005-08-11 20:09:58 +00003315 *netrw-p2*
Bram Moolenaar9964e462007-05-05 17:54:07 +00003316 P2. I use Windows, and my network browsing with ftp doesn't sort by
3317 time or size! -or- The remote system is a Windows server; why
3318 don't I get sorts by time or size?
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003319
3320 Windows' ftp has a minimal support for ls (ie. it doesn't
3321 accept sorting options). It doesn't support the -F which
3322 gives an explanatory character (ABC/ for "ABC is a directory").
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003323 Netrw then uses "dir" to get both its thin and long listings.
Bram Moolenaar9964e462007-05-05 17:54:07 +00003324 If you think your ftp does support a full-up ls, put the
3325 following into your <.vimrc>: >
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003326
Bram Moolenaar9964e462007-05-05 17:54:07 +00003327 let g:netrw_ftp_list_cmd = "ls -lF"
3328 let g:netrw_ftp_timelist_cmd= "ls -tlF"
3329 let g:netrw_ftp_sizelist_cmd= "ls -slF"
3330<
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003331 Alternatively, if you have cygwin on your Windows box, put
Bram Moolenaar9964e462007-05-05 17:54:07 +00003332 into your <.vimrc>: >
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003333
3334 let g:netrw_cygwin= 1
Bram Moolenaar9964e462007-05-05 17:54:07 +00003335<
3336 This problem also occurs when the remote system is Windows.
3337 In this situation, the various g:netrw_ftp_[time|size]list_cmds
3338 are as shown above, but the remote system will not correctly
3339 modify its listing behavior.
3340
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003341
Bram Moolenaar488c6512005-08-11 20:09:58 +00003342 *netrw-p3*
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003343 P3. I tried rcp://user@host/ (or protocol other than ftp) and netrw
3344 used ssh! That wasn't what I asked for...
3345
3346 Netrw has two methods for browsing remote directories: ssh
3347 and ftp. Unless you specify ftp specifically, ssh is used.
3348 When it comes time to do download a file (not just a directory
3349 listing), netrw will use the given protocol to do so.
3350
Bram Moolenaar488c6512005-08-11 20:09:58 +00003351 *netrw-p4*
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003352 P4. I would like long listings to be the default.
3353
Bram Moolenaar446cb832008-06-24 21:56:24 +00003354 Put the following statement into your |.vimrc|: >
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00003355
Bram Moolenaar446cb832008-06-24 21:56:24 +00003356 let g:netrw_liststyle= 1
3357<
3358 Check out |netrw-browser-var| for more customizations that
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00003359 you can set.
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003360
Bram Moolenaar488c6512005-08-11 20:09:58 +00003361 *netrw-p5*
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003362 P5. My times come up oddly in local browsing
3363
3364 Does your system's strftime() accept the "%c" to yield dates
Bram Moolenaarff034192013-04-24 18:51:19 +02003365 such as "Sun Apr 27 11:49:23 1997"? If not, do a
3366 "man strftime" and find out what option should be used. Then
3367 put it into your |.vimrc|: >
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003368
Bram Moolenaar446cb832008-06-24 21:56:24 +00003369 let g:netrw_timefmt= "%X" (where X is the option)
3370<
Bram Moolenaar488c6512005-08-11 20:09:58 +00003371 *netrw-p6*
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00003372 P6. I want my current directory to track my browsing.
3373 How do I do that?
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003374
Bram Moolenaar446cb832008-06-24 21:56:24 +00003375 Put the following line in your |.vimrc|:
3376>
Bram Moolenaar433f7c82006-03-21 21:29:36 +00003377 let g:netrw_keepdir= 0
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003378<
Bram Moolenaar9964e462007-05-05 17:54:07 +00003379 *netrw-p7*
3380 P7. I use Chinese (or other non-ascii) characters in my filenames, and
3381 netrw (Explore, Sexplore, Hexplore, etc) doesn't display them!
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00003382
Bram Moolenaar9964e462007-05-05 17:54:07 +00003383 (taken from an answer provided by Wu Yongwei on the vim
3384 mailing list)
Bram Moolenaara6878372014-03-22 21:02:50 +01003385 I now see the problem. Your code page is not 936, right? Vim
Bram Moolenaar9964e462007-05-05 17:54:07 +00003386 seems only able to open files with names that are valid in the
3387 current code page, as are many other applications that do not
3388 use the Unicode version of Windows APIs. This is an OS-related
3389 issue. You should not have such problems when the system
3390 locale uses UTF-8, such as modern Linux distros.
3391
3392 (...it is one more reason to recommend that people use utf-8!)
3393
3394 *netrw-p8*
3395 P8. I'm getting "ssh is not executable on your system" -- what do I
3396 do?
3397
3398 (Dudley Fox) Most people I know use putty for windows ssh. It
3399 is a free ssh/telnet application. You can read more about it
3400 here:
3401
3402 http://www.chiark.greenend.org.uk/~sgtatham/putty/ Also:
3403
3404 (Marlin Unruh) This program also works for me. It's a single
3405 executable, so he/she can copy it into the Windows\System32
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003406 folder and create a shortcut to it.
Bram Moolenaar9964e462007-05-05 17:54:07 +00003407
3408 (Dudley Fox) You might also wish to consider plink, as it
3409 sounds most similar to what you are looking for. plink is an
3410 application in the putty suite.
3411
3412 http://the.earth.li/~sgtatham/putty/0.58/htmldoc/Chapter7.html#plink
3413
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003414 (Vissale Neang) Maybe you can try OpenSSH for windows, which
Bram Moolenaar9964e462007-05-05 17:54:07 +00003415 can be obtained from:
3416
3417 http://sshwindows.sourceforge.net/
3418
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003419 It doesn't need the full Cygwin package.
Bram Moolenaar9964e462007-05-05 17:54:07 +00003420
3421 (Antoine Mechelynck) For individual Unix-like programs needed
3422 for work in a native-Windows environment, I recommend getting
3423 them from the GnuWin32 project on sourceforge if it has them:
3424
3425 http://gnuwin32.sourceforge.net/
3426
3427 Unlike Cygwin, which sets up a Unix-like virtual machine on
3428 top of Windows, GnuWin32 is a rewrite of Unix utilities with
3429 Windows system calls, and its programs works quite well in the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003430 cmd.exe "Dos box".
Bram Moolenaar9964e462007-05-05 17:54:07 +00003431
3432 (dave) Download WinSCP and use that to connect to the server.
3433 In Preferences > Editors, set gvim as your editor:
3434
3435 - Click "Add..."
3436 - Set External Editor (adjust path as needed, include
3437 the quotes and !.! at the end):
3438 "c:\Program Files\Vim\vim70\gvim.exe" !.!
3439 - Check that the filetype in the box below is
3440 {asterisk}.{asterisk} (all files), or whatever types
3441 you want (cec: change {asterisk} to * ; I had to
3442 write it that way because otherwise the helptags
Bram Moolenaar446cb832008-06-24 21:56:24 +00003443 system thinks it's a tag)
3444 - Make sure it's at the top of the listbox (click it,
3445 then click "Up" if it's not)
Bram Moolenaar9964e462007-05-05 17:54:07 +00003446 If using the Norton Commander style, you just have to hit <F4>
3447 to edit a file in a local copy of gvim.
3448
3449 (Vit Gottwald) How to generate public/private key and save
3450 public key it on server: >
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +02003451 http://www.chiark.greenend.org.uk/~sgtatham/putty/0.60/htmldoc/Chapter8.html#pubkey-gettingready
3452 (8.3 Getting ready for public key authentication)
Bram Moolenaar9964e462007-05-05 17:54:07 +00003453<
Bram Moolenaar446cb832008-06-24 21:56:24 +00003454 How to use a private key with 'pscp': >
3455
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +02003456 http://www.chiark.greenend.org.uk/~sgtatham/putty/0.60/htmldoc/Chapter5.html
3457 (5.2.4 Using public key authentication with PSCP)
Bram Moolenaar9964e462007-05-05 17:54:07 +00003458<
Bram Moolenaar446cb832008-06-24 21:56:24 +00003459 (Ben Schmidt) I find the ssh included with cwRsync is
3460 brilliant, and install cwRsync or cwRsyncServer on most
3461 Windows systems I come across these days. I guess COPSSH,
3462 packed by the same person, is probably even better for use as
3463 just ssh on Windows, and probably includes sftp, etc. which I
3464 suspect the cwRsync doesn't, though it might
3465
Bram Moolenaar9964e462007-05-05 17:54:07 +00003466 (cec) To make proper use of these suggestions above, you will
3467 need to modify the following user-settable variables in your
3468 .vimrc:
3469
Bram Moolenaar446cb832008-06-24 21:56:24 +00003470 |g:netrw_ssh_cmd| |g:netrw_list_cmd| |g:netrw_mkdir_cmd|
3471 |g:netrw_rm_cmd| |g:netrw_rmdir_cmd| |g:netrw_rmf_cmd|
Bram Moolenaar9964e462007-05-05 17:54:07 +00003472
3473 The first one (|g:netrw_ssh_cmd|) is the most important; most
3474 of the others will use the string in g:netrw_ssh_cmd by
3475 default.
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003476
Bram Moolenaar9964e462007-05-05 17:54:07 +00003477 *netrw-p9* *netrw-ml_get*
3478 P9. I'm browsing, changing directory, and bang! ml_get errors
3479 appear and I have to kill vim. Any way around this?
3480
3481 Normally netrw attempts to avoid writing swapfiles for
3482 its temporary directory buffers. However, on some systems
3483 this attempt appears to be causing ml_get errors to
3484 appear. Please try setting |g:netrw_use_noswf| to 0
3485 in your <.vimrc>: >
3486 let g:netrw_use_noswf= 0
3487<
Bram Moolenaar446cb832008-06-24 21:56:24 +00003488 *netrw-p10*
3489 P10. I'm being pestered with "[something] is a directory" and
3490 "Press ENTER or type command to continue" prompts...
3491
3492 The "[something] is a directory" prompt is issued by Vim,
3493 not by netrw, and there appears to be no way to work around
3494 it. Coupled with the default cmdheight of 1, this message
3495 causes the "Press ENTER..." prompt. So: read |hit-enter|;
3496 I also suggest that you set your |'cmdheight'| to 2 (or more) in
3497 your <.vimrc> file.
3498
3499 *netrw-p11*
3500 P11. I want to have two windows; a thin one on the left and my editing
Bram Moolenaar251e1912011-06-19 05:09:16 +02003501 window on the right. How may I accomplish this?
Bram Moolenaar446cb832008-06-24 21:56:24 +00003502
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003503 You probably want netrw running as in a side window. If so, you
3504 will likely find that ":[N]Lexplore" does what you want. The
3505 optional "[N]" allows you to select the quantity of columns you
Bram Moolenaard7464be2015-11-01 16:49:04 +01003506 wish the |:Lexplore|r window to start with (see |g:netrw_winsize|
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003507 for how this parameter works).
3508
3509 Previous solution:
3510
Bram Moolenaar446cb832008-06-24 21:56:24 +00003511 * Put the following line in your <.vimrc>:
3512 let g:netrw_altv = 1
3513 * Edit the current directory: :e .
3514 * Select some file, press v
3515 * Resize the windows as you wish (see |CTRL-W_<| and
3516 |CTRL-W_>|). If you're using gvim, you can drag
3517 the separating bar with your mouse.
3518 * When you want a new file, use ctrl-w h to go back to the
3519 netrw browser, select a file, then press P (see |CTRL-W_h|
3520 and |netrw-P|). If you're using gvim, you can press
3521 <leftmouse> in the browser window and then press the
3522 <middlemouse> to select the file.
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003523
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003524
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003525 *netrw-p12*
3526 P12. My directory isn't sorting correctly, or unwanted letters are
3527 appearing in the listed filenames, or things aren't lining
3528 up properly in the wide listing, ...
3529
3530 This may be due to an encoding problem. I myself usually use
3531 utf-8, but really only use ascii (ie. bytes from 32-126).
3532 Multibyte encodings use two (or more) bytes per character.
3533 You may need to change |g:netrw_sepchr| and/or |g:netrw_xstrlen|.
3534
Bram Moolenaar00a927d2010-05-14 23:24:24 +02003535 *netrw-p13*
3536 P13. I'm a Windows + putty + ssh user, and when I attempt to browse,
3537 the directories are missing trailing "/"s so netrw treats them
3538 as file transfers instead of as attempts to browse
3539 subdirectories. How may I fix this?
3540
3541 (mikeyao) If you want to use vim via ssh and putty under Windows,
3542 try combining the use of pscp/psftp with plink. pscp/psftp will
3543 be used to connect and plink will be used to execute commands on
3544 the server, for example: list files and directory using 'ls'.
3545
3546 These are the settings I use to do this:
3547>
3548 " list files, it's the key setting, if you haven't set,
3549 " you will get a blank buffer
3550 let g:netrw_list_cmd = "plink HOSTNAME ls -Fa"
3551 " if you haven't add putty directory in system path, you should
3552 " specify scp/sftp command. For examples:
3553 "let g:netrw_sftp_cmd = "d:\\dev\\putty\\PSFTP.exe"
3554 "let g:netrw_scp_cmd = "d:\\dev\\putty\\PSCP.exe"
3555<
Bram Moolenaar251e1912011-06-19 05:09:16 +02003556 *netrw-p14*
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003557 P14. I would like to speed up writes using Nwrite and scp/ssh
Bram Moolenaar251e1912011-06-19 05:09:16 +02003558 style connections. How? (Thomer M. Gil)
Bram Moolenaar00a927d2010-05-14 23:24:24 +02003559
Bram Moolenaar251e1912011-06-19 05:09:16 +02003560 Try using ssh's ControlMaster and ControlPath (see the ssh_config
3561 man page) to share multiple ssh connections over a single network
3562 connection. That cuts out the cryptographic handshake on each
3563 file write, sometimes speeding it up by an order of magnitude.
3564 (see http://thomer.com/howtos/netrw_ssh.html)
3565 (included by permission)
3566
3567 Add the following to your ~/.ssh/config: >
3568
3569 # you change "*" to the hostname you care about
3570 Host *
3571 ControlMaster auto
3572 ControlPath /tmp/%r@%h:%p
3573
3574< Then create an ssh connection to the host and leave it running: >
3575
3576 ssh -N host.domain.com
3577
3578< Now remotely open a file with Vim's Netrw and enjoy the
3579 zippiness: >
3580
3581 vim scp://host.domain.com//home/user/.bashrc
3582<
3583 *netrw-p15*
3584 P15. How may I use a double-click instead of netrw's usual single click
3585 to open a file or directory? (Ben Fritz)
3586
3587 First, disable netrw's mapping with >
3588 let g:netrw_mousemaps= 0
3589< and then create a netrw buffer only mapping in
3590 $HOME/.vim/after/ftplugin/netrw.vim: >
3591 nmap <buffer> <2-leftmouse> <CR>
3592< Note that setting g:netrw_mousemaps to zero will turn off
3593 all netrw's mouse mappings, not just the <leftmouse> one.
3594 (see |g:netrw_mousemaps|)
Bram Moolenaar00a927d2010-05-14 23:24:24 +02003595
Bram Moolenaar13600302014-05-22 18:26:40 +02003596 *netrw-p16*
3597 P16. When editing remote files (ex. :e ftp://hostname/path/file),
3598 under Windows I get an |E303| message complaining that its unable
3599 to open a swap file.
3600
3601 (romainl) It looks like you are starting Vim from a protected
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003602 directory. Start netrw from your $HOME or other writable
Bram Moolenaar13600302014-05-22 18:26:40 +02003603 directory.
3604
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003605 *netrw-p17*
3606 P17. Netrw is closing buffers on its own.
3607 What steps will reproduce the problem?
3608 1. :Explore, navigate directories, open a file
3609 2. :Explore, open another file
3610 3. Buffer opened in step 1 will be closed. o
3611 What is the expected output? What do you see instead?
3612 I expect both buffers to exist, but only the last one does.
3613
3614 (Lance) Problem is caused by "set autochdir" in .vimrc.
3615 (drchip) I am able to duplicate this problem with |'acd'| set.
3616 It appears that the buffers are not exactly closed;
3617 a ":ls!" will show them (although ":ls" does not).
3618
3619 *netrw-P18*
3620 P18. How to locally edit a file that's only available via
3621 another server accessible via ssh?
3622 See http://stackoverflow.com/questions/12469645/
3623 "Using Vim to Remotely Edit A File on ServerB Only
3624 Accessible From ServerA"
3625
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003626 *netrw-P19*
3627 P19. How do I get numbering on in directory listings?
3628 With |g:netrw_bufsettings|, you can control netrw's buffer
3629 settings; try putting >
3630 let g:netrw_bufsettings="noma nomod nu nobl nowrap ro nornu"
3631< in your .vimrc. If you'd like to have relative numbering
3632 instead, try >
3633 let g:netrw_bufsettings="noma nomod nonu nobl nowrap ro rnu"
3634<
3635 *netrw-P20*
3636 P20. How may I have gvim start up showing a directory listing?
3637 Try putting the following code snippet into your .vimrc: >
3638 augroup VimStartup
3639 au!
3640 au VimEnter * if expand("%") == "" && argc() == 0 &&
3641 \ (v:servername =~ 'GVIM\d*' || v:servername == "")
3642 \ | e . | endif
3643 augroup END
3644< You may use Lexplore instead of "e" if you're so inclined.
3645 This snippet assumes that you have client-server enabled
3646 (ie. a "huge" vim version).
3647
3648 *netrw-P21*
3649 P21. I've made a directory (or file) with an accented character, but
3650 netrw isn't letting me enter that directory/read that file:
3651
3652 Its likely that the shell or o/s is using a different encoding
3653 than you have vim (netrw) using. A patch to vim supporting
3654 "systemencoding" may address this issue in the future; for
3655 now, just have netrw use the proper encoding. For example: >
3656
3657 au FileType netrw set enc=latin1
3658<
3659 *netrw-P22*
3660 P22. I get an error message when I try to copy or move a file:
3661
3662 **error** (netrw) tried using g:netrw_localcopycmd<cp>; it doesn't work!
3663
3664 What's wrong?
3665
3666 Netrw uses several system level commands to do things (see
3667
3668 |g:netrw_localcopycmd|, |g:netrw_localmovecmd|,
3669 |g:netrw_localrmdir|, |g:netrw_mkdir_cmd|).
3670
3671 You may need to adjust the default commands for one or more of
3672 these commands by setting them properly in your .vimrc. Another
3673 source of difficulty is that these commands use vim's local
3674 directory, which may not be the same as the browsing directory
3675 shown by netrw (see |g:netrw_keepdir|).
3676
3677
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003678==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +0000367911. Debugging Netrw Itself *netrw-debug* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +00003680
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003681Step 1: check that the problem you've encountered hasn't already been resolved
3682by obtaining a copy of the latest (often developmental) netrw at:
3683
3684 http://www.drchip.org/astronaut/vim/index.html#NETRW
3685
3686The <netrw.vim> script is typically installed on systems as something like:
Bram Moolenaar488c6512005-08-11 20:09:58 +00003687>
Bram Moolenaar446cb832008-06-24 21:56:24 +00003688 /usr/local/share/vim/vim7x/plugin/netrwPlugin.vim
3689 /usr/local/share/vim/vim7x/autoload/netrw.vim
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003690 (see output of :echo &rtp)
Bram Moolenaar488c6512005-08-11 20:09:58 +00003691<
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003692which is loaded automatically at startup (assuming :set nocp). If you
3693installed a new netrw, then it will be located at >
3694
3695 $HOME/.vim/plugin/netrwPlugin.vim
3696 $HOME/.vim/autoload/netrw.vim
3697<
3698Step 2: assuming that you've installed the latest version of netrw,
3699check that your problem is really due to netrw. Create a file
3700called netrw.vimrc with the following contents: >
3701
3702 set nocp
3703 so $HOME/.vim/plugin/netrwPlugin.vim
3704<
3705Then run netrw as follows: >
3706
Bram Moolenaare0fa3742016-02-20 15:47:01 +01003707 vim -u netrw.vimrc --noplugins -i NONE [some path here]
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003708<
3709Perform whatever netrw commands you need to, and check that the problem is
3710still present. This procedure sidesteps any issues due to personal .vimrc
Bram Moolenaare0fa3742016-02-20 15:47:01 +01003711settings, .viminfo file, and other plugins. If the problem does not appear,
3712then you need to determine which setting in your .vimrc is causing the
3713conflict with netrw or which plugin(s) is/are involved.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003714
3715Step 3: If the problem still is present, then get a debugging trace from
3716netrw:
Bram Moolenaar071d4272004-06-13 20:20:40 +00003717
3718 1. Get the <Decho.vim> script, available as:
3719
Bram Moolenaar97d62492012-11-15 21:28:22 +01003720 http://www.drchip.org/astronaut/vim/index.html#DECHO
Bram Moolenaar071d4272004-06-13 20:20:40 +00003721 or
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00003722 http://vim.sourceforge.net/scripts/script.php?script_id=120
Bram Moolenaar071d4272004-06-13 20:20:40 +00003723
Bram Moolenaara6878372014-03-22 21:02:50 +01003724 Decho.vim is provided as a "vimball"; see |vimball-intro|.
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00003725
Bram Moolenaar446cb832008-06-24 21:56:24 +00003726 2. Edit the <netrw.vim> file by typing: >
Bram Moolenaard4755bb2004-09-02 19:12:26 +00003727
3728 vim netrw.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +00003729 :DechoOn
Bram Moolenaard4755bb2004-09-02 19:12:26 +00003730 :wq
Bram Moolenaar446cb832008-06-24 21:56:24 +00003731<
3732 To restore to normal non-debugging behavior, re-edit <netrw.vim>
3733 and type >
Bram Moolenaar071d4272004-06-13 20:20:40 +00003734
Bram Moolenaard4755bb2004-09-02 19:12:26 +00003735 vim netrw.vim
3736 :DechoOff
3737 :wq
Bram Moolenaar446cb832008-06-24 21:56:24 +00003738<
Bram Moolenaard4755bb2004-09-02 19:12:26 +00003739 This command, provided by <Decho.vim>, will comment out all
3740 Decho-debugging statements (Dfunc(), Dret(), Decho(), Dredir()).
3741
Bram Moolenaar446cb832008-06-24 21:56:24 +00003742 3. Then bring up vim and attempt to evoke the problem by doing a
3743 transfer or doing some browsing. A set of messages should appear
3744 concerning the steps that <netrw.vim> took in attempting to
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003745 read/write your file over the network in a separate tab or
3746 server vim window.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003747
Bram Moolenaar9964e462007-05-05 17:54:07 +00003748 To save the file, use >
Bram Moolenaar8d043172014-01-23 14:24:41 +01003749
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003750 :tabnext
Bram Moolenaar9964e462007-05-05 17:54:07 +00003751 :set bt=
3752 :w! DBG
Bram Moolenaar8d043172014-01-23 14:24:41 +01003753
3754< Furthermore, it'd be helpful if you would type >
Bram Moolenaara6878372014-03-22 21:02:50 +01003755 :Dsep <command>
3756< where <command> is the command you're about to type next,
3757 thereby making it easier to associate which part of the
3758 debugging trace is due to which command.
Bram Moolenaar8d043172014-01-23 14:24:41 +01003759
Bram Moolenaara6878372014-03-22 21:02:50 +01003760 Please send that information to <netrw.vim>'s maintainer along
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003761 with the o/s you're using and the vim version that you're using
Bram Moolenaara6878372014-03-22 21:02:50 +01003762 (see |:version|) >
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00003763 NdrOchip at ScampbellPfamily.AbizM - NOSPAM
Bram Moolenaar9964e462007-05-05 17:54:07 +00003764<
Bram Moolenaar071d4272004-06-13 20:20:40 +00003765==============================================================================
Bram Moolenaar9964e462007-05-05 17:54:07 +0000376612. History *netrw-history* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +00003767
Bram Moolenaaraa3b15d2016-04-21 08:53:19 +02003768 v156: Feb 18, 2016 * Changed =~ to =~# where appropriate
3769 Feb 23, 2016 * s:ComposePath(base,subdir) now uses
3770 fnameescape() on the base portion
3771 Mar 01, 2016 * (gt_macki) reported where :Explore would
3772 make file unlisted. Fixed (tst943)
3773 Apr 04, 2016 * (reported by John Little) netrw normally
3774 suppresses browser messages, but sometimes
3775 those "messages" are what is wanted.
3776 See |g:netrw_suppress_gx_mesg|
3777 Apr 06, 2016 * (reported by Carlos Pita) deleting a remote
3778 file was giving an error message. Fixed.
3779 Apr 08, 2016 * (Charles Cooper) had a problem with an
3780 undefined b:netrw_curdir. He also provided
3781 a fix.
3782 Apr 20, 2016 * Changed s:NetrwGetBuffer(); now uses
3783 dictionaries. Also fixed the "No Name"
3784 buffer problem.
Bram Moolenaare0fa3742016-02-20 15:47:01 +01003785 v155: Oct 29, 2015 * (Timur Fayzrakhmanov) reported that netrw's
3786 mapping of ctrl-l was not allowing refresh of
3787 other windows when it was done in a netrw
3788 window.
3789 Nov 05, 2015 * Improved s:TreeSqueezeDir() to use search()
3790 instead of a loop
3791 * NetrwBrowse() will return line to
3792 w:netrw_bannercnt if cursor ended up in
3793 banner
3794 Nov 16, 2015 * Added a <Plug>NetrwTreeSqueeze (|netrw-s-cr|)
3795 Nov 17, 2015 * Commented out imaps -- perhaps someone can
3796 tell me how they're useful and should be
3797 retained?
3798 Nov 20, 2015 * Added |netrw-ma| and |netrw-mA| support
3799 Nov 20, 2015 * gx (|netrw-gx|) on an url downloaded the
3800 file in addition to simply bringing up the
3801 url in a browser. Fixed.
3802 Nov 23, 2015 * Added |g:netrw_sizestyle| support
3803 Nov 27, 2015 * Inserted a lot of <c-u>s into various netrw
3804 maps.
3805 Jan 05, 2016 * |netrw-qL| implemented to mark files based
3806 upon |location-list|s; similar to |netrw-qF|.
3807 Jan 19, 2016 * using - call delete(directoryname,"d") -
3808 instead of using g:netrw_localrmdir if
3809 v7.4 + patch#1107 is available
3810 Jan 28, 2016 * changed to using |winsaveview()| and
3811 |winrestview()|
3812 Jan 28, 2016 * s:NetrwTreePath() now does a save and
3813 restore of view
3814 Feb 08, 2016 * Fixed a tree-listing problem with remote
3815 directories
Bram Moolenaara0f849e2015-10-30 14:37:44 +01003816 v154: Feb 26, 2015 * (Yuri Kanivetsky) reported a situation where
3817 a file was not treated properly as a file
3818 due to g:netrw_keepdir == 1
3819 Mar 25, 2015 * (requested by Ben Friz) one may now sort by
3820 extension
3821 Mar 28, 2015 * (requested by Matt Brooks) netrw has a lot
3822 of buffer-local mappings; however, some
3823 plugins (such as vim-surround) set up
3824 conflicting mappings that cause vim to wait.
3825 The "<nowait>" modifier has been included
3826 with most of netrw's mappings to avoid that
3827 delay.
3828 Jun 26, 2015 * |netrw-gn| mapping implemted
3829 * :Ntree NotADir resulted in having
3830 the tree listing expand in the error messages
3831 window. Fixed.
3832 Jun 29, 2015 * Attempting to delete a file remotely caused
3833 an error with "keepsol" mentioned; fixed.
3834 Jul 08, 2015 * Several changes to keep the |:jumps| table
3835 correct when working with
3836 |g:netrw_fastbrowse| set to 2
3837 * wide listing with accented characters fixed
3838 (using %-S instead of %-s with a |printf()|
3839 Jul 13, 2015 * (Daniel Hahler) CheckIfKde() could be true
3840 but kfmclient not installed. Changed order
3841 in netrw#BrowseX(): checks if kde and
3842 kfmclient, then will use xdg-open on a unix
3843 system (if xdg-open is executable)
3844 Aug 11, 2015 * (McDonnell) tree listing mode wouldn't
3845 select a file in a open subdirectory.
3846 * (McDonnell) when multiple subdirectories
3847 were concurrently open in tree listing
3848 mode, a ctrl-L wouldn't refresh properly.
3849 * The netrw:target menu showed duplicate
3850 entries
3851 Oct 13, 2015 * (mattn) provided an exception to handle
3852 windows with shellslash set but no shell
3853 Oct 23, 2015 * if g:netrw_usetab and <c-tab> now used
3854 to control whether NetrwShrink is used
3855 (see |netrw-c-tab|)
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003856 v153: May 13, 2014 * added another |g:netrw_ffkeep| usage {{{2
3857 May 14, 2014 * changed s:PerformListing() so that it
3858 always sets ft=netrw for netrw buffers
3859 (ie. even when syntax highlighting is
3860 off, not available, etc)
3861 May 16, 2014 * introduced the |netrw-ctrl-r| functionality
3862 May 17, 2014 * introduced the |netrw-:NetrwMB| functionality
3863 * mb and mB (|netrw-mb|, |netrw-mB|) will
3864 add/remove marked files from bookmark list
3865 May 20, 2014 * (Enno Nagel) reported that :Lex <dirname>
3866 wasn't working. Fixed.
3867 May 26, 2014 * restored test to prevent leftmouse window
3868 resizing from causing refresh.
3869 (see s:NetrwLeftmouse())
3870 * fixed problem where a refresh caused cursor
3871 to go just under the banner instead of
3872 staying put
3873 May 28, 2014 * (László Bimba) provided a patch for opening
3874 the |:Lexplore| window 100% high, optionally
3875 on the right, and will work with remote
3876 files.
3877 May 29, 2014 * implemented :NetrwC (see |netrw-:NetrwC|)
3878 Jun 01, 2014 * Removed some "silent"s from commands used
3879 to implemented scp://... and pscp://...
3880 directory listing. Permits request for
3881 password to appear.
3882 Jun 05, 2014 * (Enno Nagel) reported that user maps "/"
3883 caused problems with "b" and "w", which
3884 are mapped (for wide listings only) to
3885 skip over files rather than just words.
3886 Jun 10, 2014 * |g:netrw_gx| introduced to allow users to
3887 override default "<cfile>" with the gx
3888 (|netrw-gx|) map
3889 Jun 11, 2014 * gx (|netrw-gx|), with |'autowrite'| set,
3890 will write modified files. s:NetrwBrowseX()
3891 will now save, turn off, and restore the
3892 |'autowrite'| setting.
3893 Jun 13, 2014 * added visual map for gx use
3894 Jun 15, 2014 * (Enno Nagel) reported that with having hls
3895 set and wide listing style in use, that the
3896 b and w maps caused unwanted highlighting.
3897 Jul 05, 2014 * |netrw-mv| and |netrw-mX| commands included
3898 Jul 09, 2014 * |g:netrw_keepj| included, allowing optional
3899 keepj
3900 Jul 09, 2014 * fixing bugs due to previous update
3901 Jul 21, 2014 * (Bruno Sutic) provided an updated
3902 netrw_gitignore.vim
3903 Jul 30, 2014 * (Yavuz Yetim) reported that editing two
3904 remote files of the same name caused the
3905 second instance to have a "temporary"
3906 name. Fixed: now they use the same buffer.
3907 Sep 18, 2014 * (Yasuhiro Matsumoto) provided a patch which
3908 allows scp and windows local paths to work.
3909 Oct 07, 2014 * gx (see |netrw-gx|) when atop a directory,
3910 will now do |gf| instead
3911 Nov 06, 2014 * For cygwin: cygstart will be available for
3912 netrw#BrowseX() to use if its executable.
3913 Nov 07, 2014 * Began support for file://... urls. Will use
3914 |g:netrw_file_cmd| (typically elinks or links)
3915 Dec 02, 2014 * began work on having mc (|netrw-mc|) copy
3916 directories. Works for linux machines,
3917 cygwin+vim, but not for windows+gvim.
3918 Dec 02, 2014 * in tree mode, netrw was not opening
3919 directories via symbolic links.
3920 Dec 02, 2014 * added resolved link information to
3921 thin and tree modes
3922 Dec 30, 2014 * (issue#231) |:ls| was not showing
3923 remote-file buffers reliably. Fixed.
3924 v152: Apr 08, 2014 * uses the |'noswapfile'| option (requires {{{2
Bram Moolenaar13600302014-05-22 18:26:40 +02003925 vim 7.4 with patch 213)
3926 * (Enno Nagel) turn |'rnu'| off in netrw
3927 buffers.
3928 * (Quinn Strahl) suggested that netrw
3929 allow regular window splitting to occur,
3930 thereby allowing |'equalalways'| to take
3931 effect.
3932 * (qingtian zhao) normally, netrw will
3933 save and restore the |'fileformat'|;
3934 however, sometimes that isn't wanted
3935 Apr 14, 2014 * whenever netrw marks a buffer as ro,
3936 it will also mark it as nomod.
3937 Apr 16, 2014 * sftp protocol now supported by
3938 netrw#Obtain(); this means that one
3939 may use "mc" to copy a remote file
3940 to a local file using sftp, and that
3941 the |netrw-O| command can obtain remote
3942 files via sftp.
3943 * added [count]C support (see |netrw-C|)
3944 Apr 18, 2014 * when |g:netrw_chgwin| is one more than
3945 the last window, then vertically split
3946 the last window and use it as the
3947 chgwin window.
3948 May 09, 2014 * SavePosn was "saving filename under cursor"
3949 from a non-netrw window when using :Rex.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003950 v151: Jan 22, 2014 * extended :Rexplore to return to buffer {{{2
Bram Moolenaara6878372014-03-22 21:02:50 +01003951 prior to Explore or editing a directory
3952 * (Ken Takata) netrw gave error when
3953 clipboard was disabled. Sol'n: Placed
3954 several if has("clipboard") tests in.
3955 * Fixed ftp://X@Y@Z// problem; X@Y now
3956 part of user id, and only Z is part of
3957 hostname.
3958 * (A Loumiotis) reported that completion
3959 using a directory name containing spaces
3960 did not work. Fixed with a retry in
3961 netrw#Explore() which removes the
3962 backslashes vim inserted.
3963 Feb 26, 2014 * :Rexplore now records the current file
3964 using w:netrw_rexfile when returning via
3965 |:Rexplore|
3966 Mar 08, 2014 * (David Kotchan) provided some patches
3967 allowing netrw to work properly with
3968 windows shares.
3969 * Multiple one-liner help messages available
3970 by pressing <cr> while atop the "Quick
3971 Help" line
3972 * worked on ShellCmdPost, FocusGained event
3973 handling.
3974 * |:Lexplore| path: will be used to update
3975 a left-side netrw browsing directory.
Bram Moolenaare0fa3742016-02-20 15:47:01 +01003976 Mar 12, 2014 * |netrw-s-cr|: use <s-cr> to close
Bram Moolenaara6878372014-03-22 21:02:50 +01003977 tree directory implemented
3978 Mar 13, 2014 * (Tony Mechylynck) reported that using
3979 the browser with ftp on a directory,
3980 and selecting a gzipped txt file, that
3981 an E19 occurred (which was issued by
3982 gzip.vim). Fixed.
3983 Mar 14, 2014 * Implemented :MF and :MT (see |netrw-:MF|
3984 and |netrw-:MT|, respectively)
3985 Mar 17, 2014 * |:Ntree| [dir] wasn't working properly; fixed
3986 Mar 18, 2014 * Changed all uses of set to setl
3987 Mar 18, 2014 * Commented the netrw_btkeep line in
3988 s:NetrwOptionSave(); the effect is that
3989 netrw buffers will remain as |'bt'|=nofile.
3990 This should prevent swapfiles being created
3991 for netrw buffers.
3992 Mar 20, 2014 * Changed all uses of lcd to use s:NetrwLcd()
3993 instead. Consistent error handling results
3994 and it also handles Window's shares
3995 * Fixed |netrw-d| command when applied with ftp
3996 * https: support included for netrw#NetRead()
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01003997 v150: Jul 12, 2013 * removed a "keepalt" to allow ":e #" to {{{2
Bram Moolenaar8d043172014-01-23 14:24:41 +01003998 return to the netrw directory listing
3999 Jul 13, 2013 * (Jonas Diemer) suggested changing
4000 a <cWORD> to <cfile>.
4001 Jul 21, 2013 * (Yuri Kanivetsky) reported that netrw's
4002 use of mkdir did not produce directories
Bram Moolenaara6878372014-03-22 21:02:50 +01004003 following the user's umask.
Bram Moolenaar8d043172014-01-23 14:24:41 +01004004 Aug 27, 2013 * introduced |g:netrw_altfile| option
4005 Sep 05, 2013 * s:Strlen() now uses |strdisplaywidth()|
4006 when available, by default
4007 Sep 12, 2013 * (Selyano Baldo) reported that netrw wasn't
4008 opening some directories properly from the
4009 command line.
4010 Nov 09, 2013 * |:Lexplore| introduced
4011 * (Ondrej Platek) reported an issue with
4012 netrw's trees (P15). Fixed.
4013 * (Jorge Solis) reported that "t" in
4014 tree mode caused netrw to forget its
4015 line position.
4016 Dec 05, 2013 * Added <s-leftmouse> file marking
4017 (see |netrw-mf|)
4018 Dec 05, 2013 * (Yasuhiro Matsumoto) Explore should use
4019 strlen() instead s:Strlen() when handling
4020 multibyte chars with strpart()
4021 (ie. strpart() is byte oriented, not
4022 display-width oriented).
4023 Dec 09, 2013 * (Ken Takata) Provided a patch; File sizes
4024 and a portion of timestamps were wrongly
4025 highlighted with the directory color when
4026 setting `:let g:netrw_liststyle=1` on Windows.
4027 * (Paul Domaskis) noted that sometimes
4028 cursorline was activating in non-netrw
4029 windows. All but one setting of cursorline
4030 was done via setl; there was one that was
4031 overlooked. Fixed.
4032 Dec 24, 2013 * (esquifit) asked that netrw allow the
4033 /cygdrive prefix be a user-alterable
4034 parameter.
4035 Jan 02, 2014 * Fixed a problem with netrw-based ballon
4036 evaluation (ie. netrw#NetrwBaloonHelp()
4037 not having been loaded error messages)
4038 Jan 03, 2014 * Fixed a problem with tree listings
4039 * New command installed: |:Ntree|
4040 Jan 06, 2014 * (Ivan Brennan) reported a problem with
4041 |netrw-P|. Fixed.
4042 Jan 06, 2014 * Fixed a problem with |netrw-P| when the
4043 modified file was to be abandoned.
4044 Jan 15, 2014 * (Matteo Cavalleri) reported that when the
4045 banner is suppressed and tree listing is
4046 used, a blank line was left at the top of
4047 the display. Fixed.
4048 Jan 20, 2014 * (Gideon Go) reported that, in tree listing
4049 style, with a previous window open, that
4050 the wrong directory was being used to open
4051 a file. Fixed. (P21)
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01004052 v149: Apr 18, 2013 * in wide listing format, now have maps for {{{2
Bram Moolenaare6ae6222013-05-21 21:01:10 +02004053 w and b to move to next/previous file
4054 Apr 26, 2013 * one may now copy files in the same
4055 directory; netrw will issue requests for
4056 what names the files should be copied under
4057 Apr 29, 2013 * Trying Benzinger's problem again. Seems
4058 that commenting out the BufEnter and
4059 installing VimEnter (only) works. Weird
4060 problem! (tree listing, vim -O Dir1 Dir2)
4061 May 01, 2013 * :Explore ftp://... wasn't working. Fixed.
4062 May 02, 2013 * introduced |g:netrw_bannerbackslash| as
4063 requested by Paul Domaskis.
Bram Moolenaar8d043172014-01-23 14:24:41 +01004064 Jul 03, 2013 * Explore now avoids splitting when a buffer
4065 will be hidden.
Bram Moolenaar8feef4f2015-01-07 16:57:10 +01004066 v148: Apr 16, 2013 * changed Netrw's Style menu to allow direct {{{2
Bram Moolenaarff034192013-04-24 18:51:19 +02004067 choice of listing style, hiding style, and
4068 sorting style
Bram Moolenaar071d4272004-06-13 20:20:40 +00004069
4070==============================================================================
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100407113. Todo *netrw-todo* {{{1
4072
407307/29/09 : banner :|g:netrw_banner| can be used to suppress the
4074 suppression banner. This feature is new and experimental,
4075 so its in the process of being debugged.
407609/04/09 : "gp" : See if it can be made to work for remote systems.
4077 : See if it can be made to work with marked files.
4078
4079==============================================================================
408014. Credits *netrw-credits* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +00004081
4082 Vim editor by Bram Moolenaar (Thanks, Bram!)
4083 dav support by C Campbell
4084 fetch support by Bram Moolenaar and C Campbell
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00004085 ftp support by C Campbell <NdrOchip@ScampbellPfamily.AbizM>
Bram Moolenaar071d4272004-06-13 20:20:40 +00004086 http support by Bram Moolenaar <bram@moolenaar.net>
4087 rcp
4088 rsync support by C Campbell (suggested by Erik Warendorph)
4089 scp support by raf <raf@comdyn.com.au>
4090 sftp support by C Campbell
4091
4092 inputsecret(), BufReadCmd, BufWriteCmd contributed by C Campbell
4093
4094 Jérôme Augé -- also using new buffer method with ftp+.netrc
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00004095 Bram Moolenaar -- obviously vim itself, :e and v:cmdarg use,
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +00004096 fetch,...
Bram Moolenaar071d4272004-06-13 20:20:40 +00004097 Yasuhiro Matsumoto -- pointing out undo+0r problem and a solution
4098 Erik Warendorph -- for several suggestions (g:netrw_..._cmd
4099 variables, rsync etc)
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00004100 Doug Claar -- modifications to test for success with ftp
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +00004101 operation
Bram Moolenaar071d4272004-06-13 20:20:40 +00004102
4103==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00004104Modelines: {{{1
Bram Moolenaar83bab712005-08-01 21:58:57 +00004105 vim:tw=78:ts=8:ft=help:norl:fdm=marker