blob: c17ca5f7c368ef122a18ef7806c34941af026c00 [file] [log] [blame]
Bram Moolenaar97d62492012-11-15 21:28:22 +01001*pi_netrw.txt* For Vim version 7.3. Last change: 2012 Oct 25
Bram Moolenaar071d4272004-06-13 20:20:40 +00002
Bram Moolenaar9964e462007-05-05 17:54:07 +00003 -----------------------------------------------------
4 NETRW REFERENCE MANUAL by Charles E. Campbell, Jr.
5 -----------------------------------------------------
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01006Author: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamily.AbizM>
7 (remove NOSPAM from Campbell's email first)
8
Bram Moolenaar5b435d62012-04-05 17:33:26 +02009Copyright: Copyright (C) 1999-2012 Charles E Campbell, Jr *netrw-copyright*
10 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 Moolenaar00a927d2010-05-14 23:24:24 +020021 *dav* *ftp* *netrw-file* *rcp* *scp*
22 *davs* *http* *netrw.vim* *rsync* *sftp*
23 *fetch* *netrw* *network*
Bram Moolenaar071d4272004-06-13 20:20:40 +000024
25==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +0000261. Contents *netrw-contents* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +000027
Bram Moolenaar9964e462007-05-05 17:54:07 +0000281. Contents.............................................|netrw-contents|
292. Starting With Netrw..................................|netrw-start|
303. Netrw Reference......................................|netrw-ref|
Bram Moolenaar446cb832008-06-24 21:56:24 +000031 EXTERNAL APPLICATIONS AND PROTOCOLS................|netrw-externapp|
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +000032 READING............................................|netrw-read|
33 WRITING............................................|netrw-write|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +010034 SOURCING...........................................|netrw-source|
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +000035 DIRECTORY LISTING..................................|netrw-dirlist|
36 CHANGING THE USERID AND PASSWORD...................|netrw-chgup|
Bram Moolenaar446cb832008-06-24 21:56:24 +000037 VARIABLES AND SETTINGS.............................|netrw-variables|
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +000038 PATHS..............................................|netrw-path|
Bram Moolenaar9964e462007-05-05 17:54:07 +0000394. Network-Oriented File Transfer.......................|netrw-xfer|
Bram Moolenaar83bab712005-08-01 21:58:57 +000040 NETRC..............................................|netrw-netrc|
41 PASSWORD...........................................|netrw-passwd|
Bram Moolenaar9964e462007-05-05 17:54:07 +0000425. Activation...........................................|netrw-activate|
Bram Moolenaaradc21822011-04-01 18:03:16 +0200436. Transparent Remote File Editing......................|netrw-transparent|
Bram Moolenaar9964e462007-05-05 17:54:07 +0000447. Ex Commands..........................................|netrw-ex|
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200458. Variables and Options................................|netrw-variables|
Bram Moolenaar446cb832008-06-24 21:56:24 +0000469. Browsing.............................................|netrw-browse|
47 Introduction To Browsing...........................|netrw-intro-browse|
48 Quick Reference: Maps..............................|netrw-browse-maps|
49 Quick Reference: Commands..........................|netrw-browse-cmds|
50 Bookmarking A Directory............................|netrw-mb|
Bram Moolenaar83bab712005-08-01 21:58:57 +000051 Browsing...........................................|netrw-cr|
Bram Moolenaar83bab712005-08-01 21:58:57 +000052 Browsing With A Horizontally Split Window..........|netrw-o|
Bram Moolenaar9964e462007-05-05 17:54:07 +000053 Browsing With A New Tab............................|netrw-t|
Bram Moolenaar446cb832008-06-24 21:56:24 +000054 Browsing With A Vertically Split Window............|netrw-v|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +010055 Change Listing Style.(thin wide long tree).........|netrw-i|
Bram Moolenaar446cb832008-06-24 21:56:24 +000056 Changing To A Bookmarked Directory.................|netrw-gb|
Bram Moolenaar83bab712005-08-01 21:58:57 +000057 Changing To A Predecessor Directory................|netrw-u|
58 Changing To A Successor Directory..................|netrw-U|
Bram Moolenaar83bab712005-08-01 21:58:57 +000059 Customizing Browsing With A User Function..........|netrw-x|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +010060 Deleting Bookmarks.................................|netrw-mB|
Bram Moolenaar446cb832008-06-24 21:56:24 +000061 Deleting Files Or Directories......................|netrw-D|
62 Directory Exploring Commands.......................|netrw-explore|
63 Exploring With Stars and Patterns..................|netrw-star|
64 Displaying Information About File..................|netrw-qf|
65 Edit File Or Directory Hiding List.................|netrw-ctrl-h|
66 Editing The Sorting Sequence.......................|netrw-S|
Bram Moolenaaradc21822011-04-01 18:03:16 +020067 Forcing treatment as a file or directory...........|netrw-gd| |netrw-gf|
Bram Moolenaar446cb832008-06-24 21:56:24 +000068 Going Up...........................................|netrw--|
69 Hiding Files Or Directories........................|netrw-a|
70 Improving Browsing.................................|netrw-ssh-hack|
71 Listing Bookmarks And History......................|netrw-qb|
72 Making A New Directory.............................|netrw-d|
Bram Moolenaar83bab712005-08-01 21:58:57 +000073 Making The Browsing Directory The Current Directory|netrw-c|
Bram Moolenaar446cb832008-06-24 21:56:24 +000074 Marking Files......................................|netrw-mf|
75 Marking Files By Regular Expression................|netrw-mr|
76 Marked Files: Arbitrary Command....................|netrw-mx|
77 Marked Files: Compression And Decompression........|netrw-mz|
78 Marked Files: Copying..............................|netrw-mc|
79 Marked Files: Diff.................................|netrw-md|
80 Marked Files: Editing..............................|netrw-me|
81 Marked Files: Grep.................................|netrw-mg|
82 Marked Files: Hiding and Unhiding by Suffix........|netrw-mh|
83 Marked Files: Moving...............................|netrw-mm|
84 Marked Files: Printing.............................|netrw-mp|
85 Marked Files: Sourcing.............................|netrw-ms|
86 Marked Files: Tagging..............................|netrw-mT|
87 Marked Files: Setting the Target Directory.........|netrw-mt|
88 Marked Files: Unmarking............................|netrw-mu|
89 Netrw Browser Variables............................|netrw-browser-var|
90 Netrw Browsing And Option Incompatibilities........|netrw-incompatible|
Bram Moolenaar15146672011-10-20 22:22:38 +020091 Netrw Settings Window..............................|netrw-settings-window|
Bram Moolenaar446cb832008-06-24 21:56:24 +000092 Obtaining A File...................................|netrw-O|
93 Preview Window.....................................|netrw-p|
94 Previous Window....................................|netrw-P|
95 Refreshing The Listing.............................|netrw-ctrl-l|
96 Renaming Files Or Directories......................|netrw-move|
97 Reversing Sorting Order............................|netrw-r|
98 Selecting Sorting Style............................|netrw-s|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +010099 Setting Editing Window.............................|netrw-C|
Bram Moolenaar9964e462007-05-05 17:54:07 +000010010. Problems and Fixes...................................|netrw-problems|
Bram Moolenaar446cb832008-06-24 21:56:24 +000010111. Debugging Netrw Itself...............................|netrw-debug|
Bram Moolenaar9964e462007-05-05 17:54:07 +000010212. History..............................................|netrw-history|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +010010313. Todo.................................................|netrw-todo|
10414. Credits..............................................|netrw-credits|
Bram Moolenaar071d4272004-06-13 20:20:40 +0000105
Bram Moolenaar071d4272004-06-13 20:20:40 +0000106{Vi does not have any of this}
107
108==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00001092. Starting With Netrw *netrw-start* {{{1
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000110
Bram Moolenaar446cb832008-06-24 21:56:24 +0000111Netrw makes reading files, writing files, browsing over a network, and
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100112local browsing easy! First, make sure that you have plugins enabled, so
Bram Moolenaar446cb832008-06-24 21:56:24 +0000113you'll need to have at least the following in your <.vimrc>:
114(or see |netrw-activate|) >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000115
Bram Moolenaar9964e462007-05-05 17:54:07 +0000116 set nocp " 'compatible' is not set
117 filetype plugin on " plugins are enabled
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000118<
119(see |'cp'| and |:filetype-plugin-on|)
120
121Netrw supports "transparent" editing of files on other machines using urls
122(see |netrw-transparent|). As an example of this, let's assume you have an
Bram Moolenaar446cb832008-06-24 21:56:24 +0000123account on some other machine; if you can use scp, try: >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000124
125 vim scp://hostname/path/to/file
126<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000127Want to make ssh/scp easier to use? Check out |netrw-ssh-hack|!
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000128
Bram Moolenaar446cb832008-06-24 21:56:24 +0000129So, what if you have ftp, not ssh/scp? That's easy, too; try >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000130
131 vim ftp://hostname/path/to/file
132<
133Want to make ftp simpler to use? See if your ftp supports a file called
134<.netrc> -- typically it goes in your home directory, has read/write
135permissions for only the user to read (ie. not group, world, other, etc),
136and has lines resembling >
137
138 machine HOSTNAME login USERID password "PASSWORD"
139 machine HOSTNAME login USERID password "PASSWORD"
140 ...
Bram Moolenaar9964e462007-05-05 17:54:07 +0000141 default login USERID password "PASSWORD"
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000142<
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200143Windows' ftp doesn't support .netrc; however, one may have in one's .vimrc: >
144
145 let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\Myself\MACHINE'
Bram Moolenaar97d62492012-11-15 21:28:22 +0100146<
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200147Netrw will substitute the host's machine name for MACHINE from the url it is
148attempting to open, and so one may specify >
149 userid
150 password
151for each site in a separate file in c:\Users\Myself\.
152
Bram Moolenaar446cb832008-06-24 21:56:24 +0000153Now about browsing -- when you just want to look around before editing a
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000154file. For browsing on your current host, just "edit" a directory: >
155
156 vim .
157 vim /home/userid/path
158<
159For browsing on a remote host, "edit" a directory (but make sure that
160the directory name is followed by a "/"): >
161
162 vim scp://hostname/
163 vim ftp://hostname/path/to/dir/
164<
165See |netrw-browse| for more!
166
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100167There are more protocols supported by netrw than just scp and ftp, too: see the
168next section, |netrw-externapp|, on how to use these external applications with
169netrw and vim.
170
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200171PREVENTING LOADING *netrw-noload*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000172
173If you want to use plugins, but for some reason don't wish to use netrw, then
174you need to avoid loading both the plugin and the autoload portions of netrw.
175You may do so by placing the following two lines in your <.vimrc>: >
176
177 :let g:loaded_netrw = 1
178 :let g:loaded_netrwPlugin = 1
179<
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000180
181==============================================================================
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001823. Netrw Reference *netrw-ref* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000183
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100184 Netrw supports several protocols in addition to scp and ftp as mentioned
Bram Moolenaar446cb832008-06-24 21:56:24 +0000185 in |netrw-start|. These include dav, fetch, http,... well, just look
186 at the list in |netrw-externapp|. Each protocol is associated with a
187 variable which holds the default command supporting that protocol.
188
189EXTERNAL APPLICATIONS AND PROTOCOLS *netrw-externapp* {{{2
Bram Moolenaar071d4272004-06-13 20:20:40 +0000190
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000191 Protocol Variable Default Value
192 -------- ---------------- -------------
Bram Moolenaaradc21822011-04-01 18:03:16 +0200193 dav: *g:netrw_dav_cmd* = "cadaver" if cadaver is executable
194 dav: g:netrw_dav_cmd = "curl -o" elseif curl is available
195 fetch: *g:netrw_fetch_cmd* = "fetch -o" if fetch is available
196 ftp: *g:netrw_ftp_cmd* = "ftp"
197 http: *g:netrw_http_cmd* = "elinks" if elinks is available
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100198 http: g:netrw_http_cmd = "links" elseif links is available
199 http: g:netrw_http_cmd = "curl" elseif curl is available
200 http: g:netrw_http_cmd = "wget" elseif wget is available
201 http: g:netrw_http_cmd = "fetch" elseif fetch is available
Bram Moolenaaradc21822011-04-01 18:03:16 +0200202 rcp: *g:netrw_rcp_cmd* = "rcp"
203 rsync: *g:netrw_rsync_cmd* = "rsync -a"
204 scp: *g:netrw_scp_cmd* = "scp -q"
205 sftp: *g:netrw_sftp_cmd* = "sftp"
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100206
207 *g:netrw_http_xcmd* : the option string for http://... protocols are
208 specified via this variable and may be independently overridden. By
209 default, the option arguments for the http-handling commands are: >
210
211 elinks : "-source >"
Bram Moolenaar97d62492012-11-15 21:28:22 +0100212 links : "-dump >"
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100213 curl : "-o"
214 wget : "-q -O"
215 fetch : "-o"
216<
217 For example, if your system has elinks, and you'd rather see the
218 page using an attempt at rendering the text, you may wish to have >
219 let g:netrw_http_xcmd= "-dump >"
220< in your .vimrc.
221
Bram Moolenaar071d4272004-06-13 20:20:40 +0000222
Bram Moolenaar446cb832008-06-24 21:56:24 +0000223READING *netrw-read* *netrw-nread* {{{2
224
225 Generally, one may just use the url notation with a normal editing
226 command, such as >
227
228 :e ftp://[user@]machine/path
229<
230 Netrw also provides the Nread command:
231
Bram Moolenaar071d4272004-06-13 20:20:40 +0000232 :Nread ? give help
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000233 :Nread "machine:path" uses rcp
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000234 :Nread "machine path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000235 :Nread "machine id password path" uses ftp
236 :Nread "dav://machine[:port]/path" uses cadaver
237 :Nread "fetch://[user@]machine/path" uses fetch
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000238 :Nread "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000239 :Nread "http://[user@]machine/path" uses http uses wget
240 :Nread "rcp://[user@]machine/path" uses rcp
241 :Nread "rsync://[user@]machine[:port]/path" uses rsync
242 :Nread "scp://[user@]machine[[:#]port]/path" uses scp
243 :Nread "sftp://[user@]machine/path" uses sftp
Bram Moolenaar071d4272004-06-13 20:20:40 +0000244
Bram Moolenaar446cb832008-06-24 21:56:24 +0000245WRITING *netrw-write* *netrw-nwrite* {{{2
246
247 One may just use the url notation with a normal file writing
248 command, such as >
249
250 :w ftp://[user@]machine/path
251<
252 Netrw also provides the Nwrite command:
253
Bram Moolenaar433f7c82006-03-21 21:29:36 +0000254 :Nwrite ? give help
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000255 :Nwrite "machine:path" uses rcp
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000256 :Nwrite "machine path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000257 :Nwrite "machine id password path" uses ftp
258 :Nwrite "dav://machine[:port]/path" uses cadaver
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000259 :Nwrite "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000260 :Nwrite "rcp://[user@]machine/path" uses rcp
261 :Nwrite "rsync://[user@]machine[:port]/path" uses rsync
262 :Nwrite "scp://[user@]machine[[:#]port]/path" uses scp
263 :Nwrite "sftp://[user@]machine/path" uses sftp
Bram Moolenaar071d4272004-06-13 20:20:40 +0000264 http: not supported!
265
Bram Moolenaar446cb832008-06-24 21:56:24 +0000266SOURCING *netrw-source* {{{2
267
268 One may just use the url notation with the normal file sourcing
269 command, such as >
270
271 :so ftp://[user@]machine/path
272<
273 Netrw also provides the Nsource command:
274
Bram Moolenaar9964e462007-05-05 17:54:07 +0000275 :Nsource ? give help
276 :Nsource "dav://machine[:port]/path" uses cadaver
277 :Nsource "fetch://[user@]machine/path" uses fetch
278 :Nsource "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc>
279 :Nsource "http://[user@]machine/path" uses http uses wget
280 :Nsource "rcp://[user@]machine/path" uses rcp
281 :Nsource "rsync://[user@]machine[:port]/path" uses rsync
282 :Nsource "scp://[user@]machine[[:#]port]/path" uses scp
283 :Nsource "sftp://[user@]machine/path" uses sftp
284
Bram Moolenaar251e1912011-06-19 05:09:16 +0200285DIRECTORY LISTING *netrw-trailingslash* *netrw-dirlist* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +0000286
287 One may browse a directory to get a listing by simply attempting to
288 edit the directory: >
289
290 :e scp://[user]@hostname/path/
291 :e ftp://[user]@hostname/path/
292<
Bram Moolenaar251e1912011-06-19 05:09:16 +0200293 For remote directory listings (ie. those using scp or ftp), that
294 trailing "/" is necessary (the slash tells netrw to treat the argument
295 as a directory to browse instead of as a file to download).
Bram Moolenaar446cb832008-06-24 21:56:24 +0000296
Bram Moolenaar251e1912011-06-19 05:09:16 +0200297 The Nread command may also be used to accomplish this (again, that
298 trailing slash is necessary): >
Bram Moolenaar446cb832008-06-24 21:56:24 +0000299
Bram Moolenaar251e1912011-06-19 05:09:16 +0200300 :Nread [protocol]://[user]@hostname/path/
301<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000302 *netrw-login* *netrw-password*
303CHANGING USERID AND PASSWORD *netrw-chgup* *netrw-userpass* {{{2
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000304
Bram Moolenaar071d4272004-06-13 20:20:40 +0000305 Attempts to use ftp will prompt you for a user-id and a password.
Bram Moolenaar15146672011-10-20 22:22:38 +0200306 These will be saved in global variables |g:netrw_uid| and
307 |s:netrw_passwd|; subsequent use of ftp will re-use those two strings,
308 thereby simplifying use of ftp. However, if you need to use a
309 different user id and/or password, you'll want to call |NetUserPass()|
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000310 first. To work around the need to enter passwords, check if your ftp
311 supports a <.netrc> file in your home directory. Also see
312 |netrw-passwd| (and if you're using ssh/scp hoping to figure out how
Bram Moolenaar15146672011-10-20 22:22:38 +0200313 to not need to use passwords for scp, look at |netrw-ssh-hack|).
Bram Moolenaar071d4272004-06-13 20:20:40 +0000314
315 :NetUserPass [uid [password]] -- prompts as needed
316 :call NetUserPass() -- prompts for uid and password
317 :call NetUserPass("uid") -- prompts for password
318 :call NetUserPass("uid","password") -- sets global uid and password
319
Bram Moolenaar446cb832008-06-24 21:56:24 +0000320NETRW VARIABLES AND SETTINGS *netrw-variables* {{{2
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200321 (Also see:
322 |netrw-browser-var| : netrw browser option variables
323 |netrw-protocol| : file transfer protocol option variables
324 |netrw-settings| : additional file transfer options
325 |netrw-browser-options| : these options affect browsing directories
326 )
Bram Moolenaar9964e462007-05-05 17:54:07 +0000327
Bram Moolenaar446cb832008-06-24 21:56:24 +0000328Netrw provides a lot of variables which allow you to customize netrw to your
329preferences. One way to look at them is via the command :NetrwSettings (see
330|netrw-settings|) which will display your current netrw settings. Most such
331settings are described below, in |netrw-browser-options|, and in
332|netrw-externapp|:
Bram Moolenaar9964e462007-05-05 17:54:07 +0000333
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100334 *b:netrw_lastfile* last file Network-read/written retained on a
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200335 per-buffer basis (supports plain :Nw )
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100336
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200337 *g:netrw_bufsettings* the settings that netrw buffers have
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200338 (default) noma nomod nonu nowrap ro nobl
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200339
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100340 *g:netrw_chgwin* specifies a window number where file edits will take
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200341 place. (also see |netrw-C|)
342 (default) not defined
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100343
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200344 *g:Netrw_funcref* specifies a function (or functions) to be called when
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200345 netrw edits a file. The file is first edited, and
346 then the function reference (|Funcref|) is called.
347 This variable may also hold a |List| of Funcrefs.
348 (default) not defined. (the capital in g:Netrw...
349 is required by its holding a function reference)
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200350>
351 Example: place in .vimrc; affects all file opening
352 fun! MyFuncRef()
353 endfun
354 let g:Netrw_funcref= function("MyFuncRef")
355<
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200356 *g:netrw_ftp* if it doesn't exist, use default ftp
357 =0 use default ftp (uid password)
358 =1 use alternate ftp method (user uid password)
359 If you're having trouble with ftp, try changing the
360 value of this variable to see if the alternate ftp
361 method works for your setup.
362
363 *g:netrw_ftp_options* Chosen by default, these options are supposed to turn
364 interactive prompting off and to restrain ftp from
365 attempting auto-login upon initial connection.
366 However, it appears that not all ftp implementations
367 support this (ex. ncftp).
368 ="-i -n"
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000369
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100370 *g:netrw_ftpextracmd* default: doesn't exist
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200371 If this variable exists, then any string it contains
372 will be placed into the commands set to your ftp
373 client. As an example:
374 ="passive"
Bram Moolenaar9964e462007-05-05 17:54:07 +0000375
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000376 *g:netrw_ftpmode* ="binary" (default)
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200377 ="ascii"
Bram Moolenaarf6cf9872005-08-08 22:00:59 +0000378
Bram Moolenaar9964e462007-05-05 17:54:07 +0000379 *g:netrw_ignorenetrc* =0 (default for linux, cygwin)
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200380 =1 If you have a <.netrc> file but it doesn't work and
381 you want it ignored, then set this variable as
382 shown. (default for Windows + cmd.exe)
Bram Moolenaar9964e462007-05-05 17:54:07 +0000383
384 *g:netrw_menu* =0 disable netrw's menu
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200385 =1 (default) netrw's menu enabled
Bram Moolenaar9964e462007-05-05 17:54:07 +0000386
387 *g:netrw_nogx* if this variable exists, then the "gx" map will not
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200388 be available (see |netrw-gx|)
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000389
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100390 *g:netrw_uid* (ftp) user-id, retained on a per-vim-session basis
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200391 *s:netrw_passwd* (ftp) password, retained on a per-vim-session basis
Bram Moolenaar446cb832008-06-24 21:56:24 +0000392
393 *g:netrw_preview* =0 (default) preview window shown in a horizontally
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200394 split window
395 =1 preview window shown in a vertically split window.
396 Also affects the "previous window" (see |netrw-P|) in
397 the same way.
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000398
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200399 *g:netrw_scpport* = "-P" : option to use to set port for scp
400 *g:netrw_sshport* = "-p" : option to use to set port for ssh
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000401
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200402 *g:netrw_sepchr* =\0xff
403 =\0x01 for enc == euc-jp (and perhaps it should be for
404 others, too, please let me know)
405 Separates priority codes from filenames internally.
406 See |netrw-p12|.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100407
Bram Moolenaar446cb832008-06-24 21:56:24 +0000408 *g:netrw_silent* =0 : transfers done normally
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200409 =1 : transfers done silently
Bram Moolenaar446cb832008-06-24 21:56:24 +0000410
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000411 *g:netrw_use_errorwindow* =1 : messages from netrw will use a separate one
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200412 line window. This window provides reliable
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200413 delivery of messages. (default)
414 =0 : messages from netrw will use echoerr ;
415 messages don't always seem to show up this
416 way, but one doesn't have to quit the window.
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000417
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000418 *g:netrw_win95ftp* =1 if using Win95, will remove four trailing blank
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200419 lines that o/s's ftp "provides" on transfers
420 =0 force normal ftp behavior (no trailing line removal)
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000421
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200422 *g:netrw_cygwin* =1 assume scp under windows is from cygwin. Also
423 permits network browsing to use ls with time and
424 size sorting (default if windows)
425 =0 assume Windows' scp accepts windows-style paths
426 Network browsing uses dir instead of ls
427 This option is ignored if you're using unix
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000428
429 *g:netrw_use_nt_rcp* =0 don't use the rcp of WinNT, Win2000 and WinXP
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200430 =1 use WinNT's rcp in binary mode (default)
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000431
Bram Moolenaar446cb832008-06-24 21:56:24 +0000432PATHS *netrw-path* {{{2
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000433
434Paths to files are generally user-directory relative for most protocols.
435It is possible that some protocol will make paths relative to some
436associated directory, however.
437>
438 example: vim scp://user@host/somefile
439 example: vim scp://user@host/subdir1/subdir2/somefile
440<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000441where "somefile" is in the "user"'s home directory. If you wish to get a
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000442file using root-relative paths, use the full path:
443>
444 example: vim scp://user@host//somefile
445 example: vim scp://user@host//subdir1/subdir2/somefile
446<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000447
448==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00004494. Network-Oriented File Transfer *netrw-xfer* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000450
451Network-oriented file transfer under Vim is implemented by a VimL-based script
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000452(<netrw.vim>) using plugin techniques. It currently supports both reading and
453writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch,
Bram Moolenaar071d4272004-06-13 20:20:40 +0000454dav/cadaver, rsync, or sftp.
455
456http is currently supported read-only via use of wget or fetch.
457
458<netrw.vim> is a standard plugin which acts as glue between Vim and the
459various file transfer programs. It uses autocommand events (BufReadCmd,
460FileReadCmd, BufWriteCmd) to intercept reads/writes with url-like filenames. >
461
462 ex. vim ftp://hostname/path/to/file
463<
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000464The characters preceding the colon specify the protocol to use; in the
Bram Moolenaar446cb832008-06-24 21:56:24 +0000465example, it's ftp. The <netrw.vim> script then formulates a command or a
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000466series of commands (typically ftp) which it issues to an external program
467(ftp, scp, etc) which does the actual file transfer/protocol. Files are read
468from/written to a temporary file (under Unix/Linux, /tmp/...) which the
469<netrw.vim> script will clean up.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000470
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100471Now, a word about Jan Minář's "FTP User Name and Password Disclosure"; first,
472ftp is not a secure protocol. User names and passwords are transmitted "in
473the clear" over the internet; any snooper tool can pick these up; this is not
474a netrw thing, this is a ftp thing. If you're concerned about this, please
475try to use scp or sftp instead.
476
477Netrw re-uses the user id and password during the same vim session and so long
478as the remote hostname remains the same.
479
480Jan seems to be a bit confused about how netrw handles ftp; normally multiple
481commands are performed in a "ftp session", and he seems to feel that the
482uid/password should only be retained over one ftp session. However, netrw
483does every ftp operation in a separate "ftp session"; so remembering the
484uid/password for just one "ftp session" would be the same as not remembering
485the uid/password at all. IMHO this would rapidly grow tiresome as one
486browsed remote directories, for example.
487
488On the other hand, thanks go to Jan M. for pointing out the many
489vulnerabilities that netrw (and vim itself) had had in handling "crafted"
490filenames. The |shellescape()| and |fnameescape()| functions were written in
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200491response by Bram Moolenaar to handle these sort of problems, and netrw has
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100492been modified to use them. Still, my advice is, if the "filename" looks like
493a vim command that you aren't comfortable with having executed, don't open it.
494
Bram Moolenaar9964e462007-05-05 17:54:07 +0000495 *netrw-putty* *netrw-pscp* *netrw-psftp*
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000496One may modify any protocol's implementing external application by setting a
497variable (ex. scp uses the variable g:netrw_scp_cmd, which is defaulted to
Bram Moolenaar433f7c82006-03-21 21:29:36 +0000498"scp -q"). As an example, consider using PuTTY: >
Bram Moolenaar9964e462007-05-05 17:54:07 +0000499
500 let g:netrw_scp_cmd = '"c:\Program Files\PuTTY\pscp.exe" -q -batch'
501 let g:netrw_sftp_cmd= '"c:\Program Files\PuTTY\psftp.exe"'
Bram Moolenaar433f7c82006-03-21 21:29:36 +0000502<
Bram Moolenaar15146672011-10-20 22:22:38 +0200503(note: it has been reported that windows 7 with putty v0.6's "-batch" option
504 doesn't work, so its best to leave it off for that system)
505
Bram Moolenaar9964e462007-05-05 17:54:07 +0000506See |netrw-p8| for more about putty, pscp, psftp, etc.
507
Bram Moolenaar071d4272004-06-13 20:20:40 +0000508Ftp, an old protocol, seems to be blessed by numerous implementations.
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000509Unfortunately, some implementations are noisy (ie., add junk to the end of the
510file). Thus, concerned users may decide to write a NetReadFixup() function
511that will clean up after reading with their ftp. Some Unix systems (ie.,
512FreeBSD) provide a utility called "fetch" which uses the ftp protocol but is
513not noisy and more convenient, actually, for <netrw.vim> to use.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100514Consequently, if "fetch" is available (ie. executable), it may be preferable
515to use it for ftp://... based transfers.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000516
517For rcp, scp, sftp, and http, one may use network-oriented file transfers
Bram Moolenaar83bab712005-08-01 21:58:57 +0000518transparently; ie.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000519>
520 vim rcp://[user@]machine/path
521 vim scp://[user@]machine/path
522<
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100523If your ftp supports <.netrc>, then it too can be transparently used
Bram Moolenaar071d4272004-06-13 20:20:40 +0000524if the needed triad of machine name, user id, and password are present in
525that file. Your ftp must be able to use the <.netrc> file on its own, however.
526>
527 vim ftp://[user@]machine[[:#]portnumber]/path
528<
Bram Moolenaaradc21822011-04-01 18:03:16 +0200529Windows provides an ftp (typically c:\Windows\System32\ftp.exe) which uses
530an option, -s:filename (filename can and probably should be a full path)
531which contains ftp commands which will be automatically run whenever ftp
532starts. You may use this feature to enter a user and password for one site: >
533 userid
534 password
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200535< *netrw-windows-netrc* *netrw-windows-s*
Bram Moolenaaradc21822011-04-01 18:03:16 +0200536If |g:netrw_ftp_cmd| contains -s:[path/]MACHINE, then (on Windows machines only)
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200537netrw will substitute the current machine name requested for ftp connections
Bram Moolenaaradc21822011-04-01 18:03:16 +0200538for MACHINE. Hence one can have multiple machine.ftp files containing login
539and password for ftp. Example: >
540
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200541 let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\Myself\MACHINE'
Bram Moolenaaradc21822011-04-01 18:03:16 +0200542 vim ftp://myhost.somewhere.net/
543will use a file >
544 C:\Users\Myself\myhost.ftp
545<
546Often, ftp will need to query the user for the userid and password.
Bram Moolenaar83bab712005-08-01 21:58:57 +0000547The latter will be done "silently"; ie. asterisks will show up instead of
Bram Moolenaar071d4272004-06-13 20:20:40 +0000548the actually-typed-in password. Netrw will retain the userid and password
549for subsequent read/writes from the most recent transfer so subsequent
550transfers (read/write) to or from that machine will take place without
551additional prompting.
552
553 *netrw-urls*
554 +=================================+============================+============+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000555 | Reading | Writing | Uses |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000556 +=================================+============================+============+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000557 | DAV: | | |
558 | dav://host/path | | cadaver |
559 | :Nread dav://host/path | :Nwrite dav://host/path | cadaver |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000560 +---------------------------------+----------------------------+------------+
Bram Moolenaar446cb832008-06-24 21:56:24 +0000561 | DAV + SSL: | | |
562 | davs://host/path | | cadaver |
563 | :Nread davs://host/path | :Nwrite davs://host/path | cadaver |
564 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000565 | FETCH: | | |
566 | fetch://[user@]host/path | | |
567 | fetch://[user@]host:http/path | Not Available | fetch |
568 | :Nread fetch://[user@]host/path| | |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000569 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000570 | FILE: | | |
571 | file:///* | file:///* | |
572 | file://localhost/* | file://localhost/* | |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000573 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000574 | FTP: (*3) | (*3) | |
575 | ftp://[user@]host/path | ftp://[user@]host/path | ftp (*2) |
576 | :Nread ftp://host/path | :Nwrite ftp://host/path | ftp+.netrc |
577 | :Nread host path | :Nwrite host path | ftp+.netrc |
578 | :Nread host uid pass path | :Nwrite host uid pass path | ftp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000579 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000580 | HTTP: wget is executable: (*4) | | |
581 | http://[user@]host/path | Not Available | wget |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000582 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000583 | HTTP: fetch is executable (*4) | | |
584 | http://[user@]host/path | Not Available | fetch |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000585 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000586 | RCP: | | |
587 | rcp://[user@]host/path | rcp://[user@]host/path | rcp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000588 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000589 | RSYNC: | | |
590 | rsync://[user@]host/path | rsync://[user@]host/path | rsync |
591 | :Nread rsync://host/path | :Nwrite rsync://host/path | rsync |
592 | :Nread rcp://host/path | :Nwrite rcp://host/path | rcp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000593 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000594 | SCP: | | |
595 | scp://[user@]host/path | scp://[user@]host/path | scp |
596 | :Nread scp://host/path | :Nwrite scp://host/path | scp (*1) |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000597 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000598 | SFTP: | | |
599 | sftp://[user@]host/path | sftp://[user@]host/path | sftp |
600 | :Nread sftp://host/path | :Nwrite sftp://host/path | sftp (*1) |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000601 +=================================+============================+============+
602
603 (*1) For an absolute path use scp://machine//path.
604
605 (*2) if <.netrc> is present, it is assumed that it will
606 work with your ftp client. Otherwise the script will
Bram Moolenaar9964e462007-05-05 17:54:07 +0000607 prompt for user-id and password.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000608
Bram Moolenaar9964e462007-05-05 17:54:07 +0000609 (*3) for ftp, "machine" may be machine#port or machine:port
Bram Moolenaar071d4272004-06-13 20:20:40 +0000610 if a different port is needed than the standard ftp port
611
612 (*4) for http:..., if wget is available it will be used. Otherwise,
613 if fetch is available it will be used.
614
615Both the :Nread and the :Nwrite ex-commands can accept multiple filenames.
616
617
618NETRC *netrw-netrc*
619
Bram Moolenaar446cb832008-06-24 21:56:24 +0000620The <.netrc> file, typically located in your home directory, contains lines
621therein which map a hostname (machine name) to the user id and password you
622prefer to use with it.
623
Bram Moolenaar071d4272004-06-13 20:20:40 +0000624The typical syntax for lines in a <.netrc> file is given as shown below.
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000625Ftp under Unix usually supports <.netrc>; ftp under Windows usually doesn't.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000626>
627 machine {full machine name} login {user-id} password "{password}"
628 default login {user-id} password "{password}"
629
630Your ftp client must handle the use of <.netrc> on its own, but if the
631<.netrc> file exists, an ftp transfer will not ask for the user-id or
632password.
633
634 Note:
635 Since this file contains passwords, make very sure nobody else can
636 read this file! Most programs will refuse to use a .netrc that is
637 readable for others. Don't forget that the system administrator can
Bram Moolenaar446cb832008-06-24 21:56:24 +0000638 still read the file! Ie. for Linux/Unix: chmod 600 .netrc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000639
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200640Even though Windows' ftp clients typically do not support .netrc, netrw has
641a work-around: see |netrw-windows-s|.
642
Bram Moolenaar071d4272004-06-13 20:20:40 +0000643
644PASSWORD *netrw-passwd*
645
646The script attempts to get passwords for ftp invisibly using |inputsecret()|,
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200647a built-in Vim function. See |netrw-userpass| for how to change the password
Bram Moolenaar071d4272004-06-13 20:20:40 +0000648after one has set it.
649
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000650Unfortunately there doesn't appear to be a way for netrw to feed a password to
651scp. Thus every transfer via scp will require re-entry of the password.
Bram Moolenaar446cb832008-06-24 21:56:24 +0000652However, |netrw-ssh-hack| can help with this problem.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000653
654
655==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00006565. Activation *netrw-activate* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000657
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000658Network-oriented file transfers are available by default whenever Vim's
Bram Moolenaar446cb832008-06-24 21:56:24 +0000659|'nocompatible'| mode is enabled. Netrw's script files reside in your
660system's plugin, autoload, and syntax directories; just the
661plugin/netrwPlugin.vim script is sourced automatically whenever you bring up
662vim. The main script in autoload/netrw.vim is only loaded when you actually
663use netrw. I suggest that, at a minimum, you have at least the following in
664your <.vimrc> customization file: >
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000665
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000666 set nocp
667 if version >= 600
668 filetype plugin indent on
669 endif
670<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000671
672==============================================================================
Bram Moolenaaradc21822011-04-01 18:03:16 +02006736. Transparent Remote File Editing *netrw-transparent* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000674
675Transparent file transfers occur whenever a regular file read or write
Bram Moolenaar446cb832008-06-24 21:56:24 +0000676(invoked via an |:autocmd| for |BufReadCmd|, |BufWriteCmd|, or |SourceCmd|
677events) is made. Thus one may read, write, or source files across networks
678just as easily as if they were local files! >
Bram Moolenaar071d4272004-06-13 20:20:40 +0000679
680 vim ftp://[user@]machine/path
681 ...
682 :wq
683
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000684See |netrw-activate| for more on how to encourage your vim to use plugins
685such as netrw.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000686
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000687
Bram Moolenaar071d4272004-06-13 20:20:40 +0000688==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00006897. Ex Commands *netrw-ex* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000690
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000691The usual read/write commands are supported. There are also a few
Bram Moolenaar446cb832008-06-24 21:56:24 +0000692additional commands available. Often you won't need to use Nwrite or
Bram Moolenaar9964e462007-05-05 17:54:07 +0000693Nread as shown in |netrw-transparent| (ie. simply use >
694 :e url
695 :r url
696 :w url
697instead, as appropriate) -- see |netrw-urls|. In the explanations
698below, a {netfile} is an url to a remote file.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000699
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200700 *:Nwrite* *:Nw*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000701:[range]Nw[rite] Write the specified lines to the current
Bram Moolenaar071d4272004-06-13 20:20:40 +0000702 file as specified in b:netrw_lastfile.
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200703 (related: |netrw-nwrite|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000704
Bram Moolenaar446cb832008-06-24 21:56:24 +0000705:[range]Nw[rite] {netfile} [{netfile}]...
Bram Moolenaar071d4272004-06-13 20:20:40 +0000706 Write the specified lines to the {netfile}.
707
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200708 *:Nread* *:Nr*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100709:Nr[ead] Read the lines from the file specified in b:netrw_lastfile
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200710 into the current buffer. (related: |netrw-nread|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000711
Bram Moolenaar446cb832008-06-24 21:56:24 +0000712:Nr[ead] {netfile} {netfile}...
Bram Moolenaar071d4272004-06-13 20:20:40 +0000713 Read the {netfile} after the current line.
714
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200715 *:Nsource* *:Ns*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000716:Ns[ource] {netfile}
Bram Moolenaar9964e462007-05-05 17:54:07 +0000717 Source the {netfile}.
718 To start up vim using a remote .vimrc, one may use
719 the following (all on one line) (tnx to Antoine Mechelynck) >
720 vim -u NORC -N
721 --cmd "runtime plugin/netrwPlugin.vim"
722 --cmd "source scp://HOSTNAME/.vimrc"
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200723< (related: |netrw-source|)
724
725:call NetUserPass() *NetUserPass()*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000726 If g:netrw_uid and s:netrw_passwd don't exist,
727 this function will query the user for them.
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200728 (related: |netrw-userpass|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000729
730:call NetUserPass("userid")
Bram Moolenaar446cb832008-06-24 21:56:24 +0000731 This call will set the g:netrw_uid and, if
Bram Moolenaar071d4272004-06-13 20:20:40 +0000732 the password doesn't exist, will query the user for it.
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200733 (related: |netrw-userpass|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000734
735:call NetUserPass("userid","passwd")
Bram Moolenaar446cb832008-06-24 21:56:24 +0000736 This call will set both the g:netrw_uid and s:netrw_passwd.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000737 The user-id and password are used by ftp transfers. One may
Bram Moolenaar446cb832008-06-24 21:56:24 +0000738 effectively remove the user-id and password by using empty
739 strings (ie. "").
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200740 (related: |netrw-userpass|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000741
Bram Moolenaar9964e462007-05-05 17:54:07 +0000742:NetrwSettings This command is described in |netrw-settings| -- used to
743 display netrw settings and change netrw behavior.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000744
Bram Moolenaar071d4272004-06-13 20:20:40 +0000745
746==============================================================================
Bram Moolenaar5b435d62012-04-05 17:33:26 +02007478. Variables and Options *netrw-var* *netrw-settings* {{{1
Bram Moolenaar446cb832008-06-24 21:56:24 +0000748
Bram Moolenaar15146672011-10-20 22:22:38 +0200749(also see: |netrw-options| |netrw-variables| |netrw-protocol|
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200750 |netrw-browser-settings| |netrw-browser-options| )
Bram Moolenaar071d4272004-06-13 20:20:40 +0000751
Bram Moolenaar9964e462007-05-05 17:54:07 +0000752The <netrw.vim> script provides several variables which act as options to
Bram Moolenaar446cb832008-06-24 21:56:24 +0000753affect <netrw.vim>'s file transfer behavior. These variables typically may be
754set in the user's <.vimrc> file: (see also |netrw-settings| |netrw-protocol|)
Bram Moolenaar15146672011-10-20 22:22:38 +0200755 *netrw-options*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000756>
Bram Moolenaar9964e462007-05-05 17:54:07 +0000757 -------------
758 Netrw Options
759 -------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000760 Option Meaning
761 -------------- -----------------------------------------------
762<
Bram Moolenaar9964e462007-05-05 17:54:07 +0000763 b:netrw_col Holds current cursor position (during NetWrite)
764 g:netrw_cygwin =1 assume scp under windows is from cygwin
765 (default/windows)
766 =0 assume scp under windows accepts windows
767 style paths (default/else)
768 g:netrw_ftp =0 use default ftp (uid password)
769 g:netrw_ftpmode ="binary" (default)
770 ="ascii" (your choice)
771 g:netrw_ignorenetrc =1 (default)
772 if you have a <.netrc> file but you don't
Bram Moolenaar071d4272004-06-13 20:20:40 +0000773 want it used, then set this variable. Its
774 mere existence is enough to cause <.netrc>
775 to be ignored.
Bram Moolenaar9964e462007-05-05 17:54:07 +0000776 b:netrw_lastfile Holds latest method/machine/path.
777 b:netrw_line Holds current line number (during NetWrite)
Bram Moolenaar9964e462007-05-05 17:54:07 +0000778 g:netrw_silent =0 transfers done normally
779 =1 transfers done silently
780 g:netrw_uid Holds current user-id for ftp.
Bram Moolenaar9964e462007-05-05 17:54:07 +0000781 g:netrw_use_nt_rcp =0 don't use WinNT/2K/XP's rcp (default)
782 =1 use WinNT/2K/XP's rcp, binary mode
783 g:netrw_win95ftp =0 use unix-style ftp even if win95/98/ME/etc
784 =1 use default method to do ftp >
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000785 -----------------------------------------------------------------------
786<
Bram Moolenaar15146672011-10-20 22:22:38 +0200787 *netrw-internal-variables*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000788The script will also make use of the following variables internally, albeit
789temporarily.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000790>
791 -------------------
792 Temporary Variables
793 -------------------
794 Variable Meaning
795 -------- ------------------------------------
796<
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100797 b:netrw_method Index indicating rcp/ftp+.netrc/ftp
798 w:netrw_method (same as b:netrw_method)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000799 g:netrw_machine Holds machine name parsed from input
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100800 b:netrw_fname Holds filename being accessed >
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000801 ------------------------------------------------------------
802<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000803 *netrw-protocol*
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000804
805Netrw supports a number of protocols. These protocols are invoked using the
806variables listed below, and may be modified by the user.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000807>
808 ------------------------
Bram Moolenaar9964e462007-05-05 17:54:07 +0000809 Protocol Control Options
Bram Moolenaar071d4272004-06-13 20:20:40 +0000810 ------------------------
Bram Moolenaar9964e462007-05-05 17:54:07 +0000811 Option Type Setting Meaning
812 --------- -------- -------------- ---------------------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000813<
Bram Moolenaar9964e462007-05-05 17:54:07 +0000814 netrw_ftp variable =doesn't exist userid set by "user userid"
815 =0 userid set by "user userid"
816 =1 userid set by "userid"
817 NetReadFixup function =doesn't exist no change
818 =exists Allows user to have files
819 read via ftp automatically
820 transformed however they wish
821 by NetReadFixup()
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100822 g:netrw_dav_cmd variable ="cadaver" if cadaver is executable
823 g:netrw_dav_cmd variable ="curl -o" elseif curl is executable
Bram Moolenaar9964e462007-05-05 17:54:07 +0000824 g:netrw_fetch_cmd variable ="fetch -o" if fetch is available
Bram Moolenaar071d4272004-06-13 20:20:40 +0000825 g:netrw_ftp_cmd variable ="ftp"
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000826 g:netrw_http_cmd variable ="fetch -o" if fetch is available
827 g:netrw_http_cmd variable ="wget -O" else if wget is available
Bram Moolenaar9964e462007-05-05 17:54:07 +0000828 g:netrw_list_cmd variable ="ssh USEPORT HOSTNAME ls -Fa"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000829 g:netrw_rcp_cmd variable ="rcp"
830 g:netrw_rsync_cmd variable ="rsync -a"
831 g:netrw_scp_cmd variable ="scp -q"
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000832 g:netrw_sftp_cmd variable ="sftp" >
833 -------------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000834<
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000835 *netrw-ftp*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000836
Bram Moolenaar9964e462007-05-05 17:54:07 +0000837The g:netrw_..._cmd options (|g:netrw_ftp_cmd| and |g:netrw_sftp_cmd|)
838specify the external program to use handle the ftp protocol. They may
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200839include command line options (such as -p for passive mode). Example: >
Bram Moolenaar071d4272004-06-13 20:20:40 +0000840
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200841 let g:netrw_ftp_cmd= "ftp -p"
842<
Bram Moolenaar9964e462007-05-05 17:54:07 +0000843Browsing is supported by using the |g:netrw_list_cmd|; the substring
844"HOSTNAME" will be changed via substitution with whatever the current request
845is for a hostname.
846
847Two options (|g:netrw_ftp| and |netrw-fixup|) both help with certain ftp's
848that give trouble . In order to best understand how to use these options if
849ftp is giving you troubles, a bit of discussion is provided on how netrw does
850ftp reads.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000851
852For ftp, netrw typically builds up lines of one of the following formats in a
Bram Moolenaar071d4272004-06-13 20:20:40 +0000853temporary file:
854>
855 IF g:netrw_ftp !exists or is not 1 IF g:netrw_ftp exists and is 1
856 ---------------------------------- ------------------------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000857<
Bram Moolenaar9964e462007-05-05 17:54:07 +0000858 open machine [port] open machine [port]
859 user userid password userid password
860 [g:netrw_ftpmode] password
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200861 [g:netrw_ftpextracmd] [g:netrw_ftpmode]
Bram Moolenaar9964e462007-05-05 17:54:07 +0000862 get filename tempfile [g:netrw_extracmd]
863 get filename tempfile >
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000864 ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000865<
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200866The |g:netrw_ftpmode| and |g:netrw_ftpextracmd| are optional.
Bram Moolenaar9964e462007-05-05 17:54:07 +0000867
Bram Moolenaar071d4272004-06-13 20:20:40 +0000868Netrw then executes the lines above by use of a filter:
869>
870 :%! {g:netrw_ftp_cmd} -i [-n]
871<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000872where
873 g:netrw_ftp_cmd is usually "ftp",
874 -i tells ftp not to be interactive
875 -n means don't use netrc and is used for Method #3 (ftp w/o <.netrc>)
876
877If <.netrc> exists it will be used to avoid having to query the user for
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000878userid and password. The transferred file is put into a temporary file.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000879The temporary file is then read into the main editing session window that
880requested it and the temporary file deleted.
881
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000882If your ftp doesn't accept the "user" command and immediately just demands a
883userid, then try putting "let netrw_ftp=1" in your <.vimrc>.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000884
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000885 *netrw-cadaver*
886To handle the SSL certificate dialog for untrusted servers, one may pull
887down the certificate and place it into /usr/ssl/cert.pem. This operation
888renders the server treatment as "trusted".
889
Bram Moolenaar433f7c82006-03-21 21:29:36 +0000890 *netrw-fixup* *netreadfixup*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000891If your ftp for whatever reason generates unwanted lines (such as AUTH
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100892messages) you may write a NetReadFixup() function:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000893>
894 function! NetReadFixup(method,line1,line2)
895 " a:line1: first new line in current file
896 " a:line2: last new line in current file
897 if a:method == 1 "rcp
898 elseif a:method == 2 "ftp + <.netrc>
899 elseif a:method == 3 "ftp + machine,uid,password,filename
900 elseif a:method == 4 "scp
901 elseif a:method == 5 "http/wget
902 elseif a:method == 6 "dav/cadaver
903 elseif a:method == 7 "rsync
904 elseif a:method == 8 "fetch
905 elseif a:method == 9 "sftp
Bram Moolenaar9964e462007-05-05 17:54:07 +0000906 else " complain
Bram Moolenaar071d4272004-06-13 20:20:40 +0000907 endif
908 endfunction
909>
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000910The NetReadFixup() function will be called if it exists and thus allows you to
911customize your reading process. As a further example, <netrw.vim> contains
912just such a function to handle Windows 95 ftp. For whatever reason, Windows
91395's ftp dumps four blank lines at the end of a transfer, and so it is
914desirable to automate their removal. Here's some code taken from <netrw.vim>
915itself:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000916>
917 if has("win95") && g:netrw_win95ftp
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000918 fun! NetReadFixup(method, line1, line2)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000919 if method == 3 " ftp (no <.netrc>)
Bram Moolenaar9964e462007-05-05 17:54:07 +0000920 let fourblanklines= line2 - 3
921 silent fourblanklines.",".line2."g/^\s*/d"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000922 endif
923 endfunction
924 endif
925>
926
927==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00009289. Browsing *netrw-browsing* *netrw-browse* *netrw-help* {{{1
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100929 *netrw-browser* *netrw-dir* *netrw-list*
Bram Moolenaar83bab712005-08-01 21:58:57 +0000930
Bram Moolenaar446cb832008-06-24 21:56:24 +0000931INTRODUCTION TO BROWSING *netrw-intro-browse* {{{2
932 (Quick References: |netrw-quickmaps| |netrw-quickcoms|)
Bram Moolenaar83bab712005-08-01 21:58:57 +0000933
Bram Moolenaar446cb832008-06-24 21:56:24 +0000934Netrw supports the browsing of directories on your local system and on remote
935hosts; browsing includes listing files and directories, entering directories,
936editing files therein, deleting files/directories, making new directories,
937moving (renaming) files and directories, copying files and directories, etc.
938One may mark files and execute any system command on them! The Netrw browser
939generally implements the previous explorer's maps and commands for remote
940directories, although details (such as pertinent global variable names)
941necessarily differ. To browse a directory, simply "edit" it! >
Bram Moolenaar269ec652004-07-29 08:43:53 +0000942
Bram Moolenaar446cb832008-06-24 21:56:24 +0000943 vim /your/directory/
944 vim .
945 vim c:\your\directory\
946<
947(Related topics: |netrw-cr| |netrw-o| |netrw-p| |netrw-P| |netrw-t|
948 |netrw-mf| |netrw-mx| |netrw-D| |netrw-R| |netrw-v| )
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000949
950The Netrw remote file and directory browser handles two protocols: ssh and
Bram Moolenaar446cb832008-06-24 21:56:24 +0000951ftp. The protocol in the url, if it is ftp, will cause netrw also to use ftp
952in its remote browsing. Specifying any other protocol will cause it to be
953used for file transfers; but the ssh protocol will be used to do remote
954browsing.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000955
Bram Moolenaar446cb832008-06-24 21:56:24 +0000956To use Netrw's remote directory browser, simply attempt to read a "file" with
957a trailing slash and it will be interpreted as a request to list a directory:
958>
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000959 vim [protocol]://[user@]hostname/path/
Bram Moolenaar4ea8fe12006-03-09 22:32:39 +0000960<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000961where [protocol] is typically scp or ftp. As an example, try: >
Bram Moolenaar4ea8fe12006-03-09 22:32:39 +0000962
Bram Moolenaar446cb832008-06-24 21:56:24 +0000963 vim ftp://ftp.home.vim.org/pub/vim/
964<
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100965For local directories, the trailing slash is not required. Again, because it's
Bram Moolenaar446cb832008-06-24 21:56:24 +0000966easy to miss: to browse remote directories, the url must terminate with a
967slash!
Bram Moolenaar83bab712005-08-01 21:58:57 +0000968
Bram Moolenaar446cb832008-06-24 21:56:24 +0000969If you'd like to avoid entering the password repeatedly for remote directory
970listings with ssh or scp, see |netrw-ssh-hack|. To avoid password entry with
971ftp, see |netrw-netrc| (if your ftp supports it).
Bram Moolenaar83bab712005-08-01 21:58:57 +0000972
Bram Moolenaar446cb832008-06-24 21:56:24 +0000973There are several things you can do to affect the browser's display of files:
Bram Moolenaar83bab712005-08-01 21:58:57 +0000974
Bram Moolenaar446cb832008-06-24 21:56:24 +0000975 * To change the listing style, press the "i" key (|netrw-i|).
976 Currently there are four styles: thin, long, wide, and tree.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100977 To make that change "permanent", see |g:netrw_liststyle|.
Bram Moolenaar83bab712005-08-01 21:58:57 +0000978
Bram Moolenaar446cb832008-06-24 21:56:24 +0000979 * To hide files (don't want to see those xyz~ files anymore?) see
980 |netrw-ctrl-h|.
Bram Moolenaar83bab712005-08-01 21:58:57 +0000981
Bram Moolenaar446cb832008-06-24 21:56:24 +0000982 * Press s to sort files by name, time, or size.
983
984See |netrw-browse-cmds| for all the things you can do with netrw!
985
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100986 *netrw-getftype* *netrw-filigree* *netrw-ftype*
987The |getftype()| function is used to append a bit of filigree to indicate
988filetype to locally listed files:
989
990 directory : /
991 executable : *
992 fifo : |
993 links : @
994 sockets : =
995
996The filigree also affects the |g:netrw_sort_sequence|.
997
Bram Moolenaar446cb832008-06-24 21:56:24 +0000998
999QUICK HELP *netrw-quickhelp* {{{2
1000 (Use ctrl-] to select a topic)~
1001 Intro to Browsing...............................|netrw-intro-browse|
1002 Quick Reference: Maps.........................|netrw-quickmap|
1003 Quick Reference: Commands.....................|netrw-browse-cmds|
1004 Hiding
1005 Edit hiding list..............................|netrw-ctrl-h|
1006 Hiding Files or Directories...................|netrw-a|
1007 Hiding/Unhiding by suffix.....................|netrw-mh|
1008 Hiding dot-files.............................|netrw-gh|
1009 Listing Style
1010 Select listing style (thin/long/wide/tree)....|netrw-i|
1011 Associated setting variable...................|g:netrw_liststyle|
1012 Shell command used to perform listing.........|g:netrw_list_cmd|
1013 Quick file info...............................|netrw-qf|
1014 Sorted by
1015 Select sorting style (name/time/size).........|netrw-s|
1016 Editing the sorting sequence..................|netrw-S|
Bram Moolenaarc236c162008-07-13 17:41:49 +00001017 Sorting options...............................|g:netrw_sort_options|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001018 Associated setting variable...................|g:netrw_sort_sequence|
1019 Reverse sorting order.........................|netrw-r|
1020
1021
1022 *netrw-quickmap* *netrw-quickmaps*
1023QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00001024>
Bram Moolenaar446cb832008-06-24 21:56:24 +00001025 --- ----------------- ----
1026 Map Quick Explanation Link
1027 --- ----------------- ----
1028< <F1> Causes Netrw to issue help
1029 <cr> Netrw will enter the directory or read the file |netrw-cr|
1030 <del> Netrw will attempt to remove the file/directory |netrw-del|
1031 - Makes Netrw go up one directory |netrw--|
1032 a Toggles between normal display, |netrw-a|
1033 hiding (suppress display of files matching g:netrw_list_hide)
1034 showing (display only files which match g:netrw_list_hide)
1035 c Make browsing directory the current directory |netrw-c|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001036 C Setting the editing window |netrw-C|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001037 d Make a directory |netrw-d|
1038 D Attempt to remove the file(s)/directory(ies) |netrw-D|
1039 gb Go to previous bookmarked directory |netrw-gb|
1040 gh Quick hide/unhide of dot-files |netrw-gh|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001041 <c-h> Edit file hiding list |netrw-ctrl-h|
1042 i Cycle between thin, long, wide, and tree listings |netrw-i|
1043 <c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l|
1044 mb Bookmark current directory |netrw-mb|
1045 mc Copy marked files to marked-file target directory |netrw-mc|
1046 md Apply diff to marked files (up to 3) |netrw-md|
1047 me Place marked files on arg list and edit them |netrw-me|
1048 mf Mark a file |netrw-mf|
1049 mh Toggle marked file suffices' presence on hiding list |netrw-mh|
1050 mm Move marked files to marked-file target directory |netrw-mm|
1051 mp Print marked files |netrw-mp|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001052 mr Mark files satisfying a shell-style |regexp| |netrw-mr|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001053 mt Current browsing directory becomes markfile target |netrw-mt|
1054 mT Apply ctags to marked files |netrw-mT|
1055 mu Unmark all marked files |netrw-mu|
1056 mx Apply arbitrary shell command to marked files |netrw-mx|
1057 mz Compress/decompress marked files |netrw-mz|
1058 o Enter the file/directory under the cursor in a new |netrw-o|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001059 browser window. A horizontal split is used.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001060 O Obtain a file specified by cursor |netrw-O|
1061 p Preview the file |netrw-p|
1062 P Browse in the previously used window |netrw-P|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001063 qb List bookmarked directories and history |netrw-qb|
1064 qf Display information on file |netrw-qf|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001065 r Reverse sorting order |netrw-r|
1066 R Rename the designed file(s)/directory(ies) |netrw-R|
1067 s Select sorting style: by name, time, or file size |netrw-s|
1068 S Specify suffix priority for name-sorting |netrw-S|
1069 t Enter the file/directory under the cursor in a new tab|netrw-t|
1070 u Change to recently-visited directory |netrw-u|
1071 U Change to subsequently-visited directory |netrw-U|
1072 v Enter the file/directory under the cursor in a new |netrw-v|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001073 browser window. A vertical split is used.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001074 x View file with an associated program |netrw-x|
Bram Moolenaar97d62492012-11-15 21:28:22 +01001075 X Execute filename under cursor via |system()| |netrw-X|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001076
Bram Moolenaarc236c162008-07-13 17:41:49 +00001077 % Open a new file in netrw's current directory |netrw-%|
1078
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001079 *netrw-mouse* *netrw-leftmouse* *netrw-middlemouse* *netrw-rightmouse*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001080 <leftmouse> (gvim only) selects word under mouse as if a <cr>
1081 had been pressed (ie. edit file, change directory)
1082 <middlemouse> (gvim only) same as P selecting word under mouse;
1083 see |netrw-P|
1084 <rightmouse> (gvim only) delete file/directory using word under
1085 mouse
1086 <2-leftmouse> (gvim only) when:
1087 * in a netrw-selected file, AND
1088 * |g:netrw_retmap| == 1 AND
1089 * the user doesn't already have a <2-leftmouse> mapping
1090 defined before netrw is autoloaded,
1091 then a double clicked leftmouse button will return
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001092 to the netrw browser window. See |g:netrw_retmap|.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001093 <s-leftmouse> (gvim only) like mf, will mark files
1094
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001095 (to disable mouse buttons while browsing: |g:netrw_mousemaps|)
1096
Bram Moolenaar446cb832008-06-24 21:56:24 +00001097 *netrw-quickcom* *netrw-quickcoms*
1098QUICK REFERENCE: COMMANDS *netrw-explore-cmds* *netrw-browse-cmds* {{{2
1099 :NetrwClean[!] ...........................................|netrw-clean|
1100 :NetrwSettings ...........................................|netrw-settings|
1101 :Explore[!] [dir] Explore directory of current file......|netrw-explore|
1102 :Hexplore[!] [dir] Horizontal Split & Explore.............|netrw-explore|
1103 :Nexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
1104 :Pexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
1105 :Rexplore Return to Explorer.....................|netrw-explore|
1106 :Sexplore[!] [dir] Split & Explore directory .............|netrw-explore|
1107 :Texplore[!] [dir] Tab & Explore..........................|netrw-explore|
1108 :Vexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
1109
1110BOOKMARKING A DIRECTORY *netrw-mb* *netrw-bookmark* *netrw-bookmarks* {{{2
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001111
Bram Moolenaar446cb832008-06-24 21:56:24 +00001112One may easily "bookmark" a directory by using >
1113
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001114 mb
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00001115<
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001116Bookmarks are retained in between sessions in a $HOME/.netrwbook file, and are
1117kept in sorted order.
1118
1119Related Topics:
1120 |netrw-gb| how to return (go) to a bookmark
1121 |netrw-mB| how to delete bookmarks
1122 |netrw-qb| how to list bookmarks
Bram Moolenaar4a85b412006-04-23 22:40:29 +00001123
1124
Bram Moolenaar446cb832008-06-24 21:56:24 +00001125BROWSING *netrw-cr* {{{2
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001126
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001127Browsing is simple: move the cursor onto a file or directory of interest.
Bram Moolenaar843ee412004-06-30 16:16:41 +00001128Hitting the <cr> (the return key) will select the file or directory.
1129Directories will themselves be listed, and files will be opened using the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001130protocol given in the original read request.
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001131
Bram Moolenaar446cb832008-06-24 21:56:24 +00001132 CAVEAT: There are four forms of listing (see |netrw-i|). Netrw assumes that
1133 two or more spaces delimit filenames and directory names for the long and
1134 wide listing formats. Thus, if your filename or directory name has two or
1135 more sequential spaces embedded in it, or any trailing spaces, then you'll
1136 need to use the "thin" format to select it.
Bram Moolenaar843ee412004-06-30 16:16:41 +00001137
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001138The |g:netrw_browse_split| option, which is zero by default, may be used to
Bram Moolenaar446cb832008-06-24 21:56:24 +00001139cause the opening of files to be done in a new window or tab instead of the
1140default. When the option is one or two, the splitting will be taken
1141horizontally or vertically, respectively. When the option is set to three, a
1142<cr> will cause the file to appear in a new tab.
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001143
Bram Moolenaar83bab712005-08-01 21:58:57 +00001144
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001145When using the gui (gvim), one may select a file by pressing the <leftmouse>
1146button. In addition, if
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001147
Bram Moolenaar446cb832008-06-24 21:56:24 +00001148 *|g:netrw_retmap| == 1 AND (its default value is 0)
1149 * in a netrw-selected file, AND
1150 * the user doesn't already have a <2-leftmouse> mapping defined before
1151 netrw is loaded
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001152
Bram Moolenaar446cb832008-06-24 21:56:24 +00001153then a doubly-clicked leftmouse button will return to the netrw browser
1154window.
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001155
Bram Moolenaar446cb832008-06-24 21:56:24 +00001156Netrw attempts to speed up browsing, especially for remote browsing where one
1157may have to enter passwords, by keeping and re-using previously obtained
1158directory listing buffers. The |g:netrw_fastbrowse| variable is used to
1159control this behavior; one may have slow browsing (no buffer re-use), medium
1160speed browsing (re-use directory buffer listings only for remote directories),
1161and fast browsing (re-use directory buffer listings as often as possible).
1162The price for such re-use is that when changes are made (such as new files
1163are introduced into a directory), the listing may become out-of-date. One may
1164always refresh directory listing buffers by pressing ctrl-L (see
1165|netrw-ctrl-l|).
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001166
1167
Bram Moolenaar446cb832008-06-24 21:56:24 +00001168Related topics: |netrw-o| |netrw-p| |netrw-P| |netrw-t| |netrw-v|
1169Associated setting variables: |g:netrw_browse_split| |g:netrw_fastbrowse|
1170 |g:netrw_ftp_list_cmd| |g:netrw_ftp_sizelist_cmd|
1171 |g:netrw_ftp_timelist_cmd| |g:netrw_ssh_cmd|
1172 |g:netrw_ssh_browse_reject| |g:netrw_use_noswf|
1173
1174
1175BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o* *netrw-horiz* {{{2
1176
1177Normally one enters a file or directory using the <cr>. However, the "o" map
1178allows one to open a new window to hold the new directory listing or file. A
1179horizontal split is used. (for vertical splitting, see |netrw-v|)
1180
1181Normally, the o key splits the window horizontally with the new window and
Bram Moolenaar15146672011-10-20 22:22:38 +02001182cursor at the top.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001183
1184Associated setting variables: |g:netrw_alto| |g:netrw_winsize|
1185
Bram Moolenaar15146672011-10-20 22:22:38 +02001186Related Actions |netrw-cr| |netrw-p| |netrw-t| |netrw-T| |netrw-v|
1187Associated setting variables:
1188 |g:netrw_alto| control above/below splitting
1189 |g:netrw_winsize| control initial sizing
Bram Moolenaar446cb832008-06-24 21:56:24 +00001190
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001191BROWSING WITH A NEW TAB *netrw-t* *netrw-T* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00001192
1193Normally one enters a file or directory using the <cr>. The "t" map
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001194allows one to open a new window holding the new directory listing or file in
1195a new tab. The "T" version puts the file or directory into a background tab
1196(see |gT|)
1197
Bram Moolenaar15146672011-10-20 22:22:38 +02001198Related Actions |netrw-cr| |netrw-o| |netrw-p| |netrw-v|
1199Associated setting variables:
1200 |g:netrw_winsize| control initial sizing
Bram Moolenaar446cb832008-06-24 21:56:24 +00001201
1202BROWSING WITH A VERTICALLY SPLIT WINDOW *netrw-v* {{{2
1203
1204Normally one enters a file or directory using the <cr>. However, the "v" map
1205allows one to open a new window to hold the new directory listing or file. A
1206vertical split is used. (for horizontal splitting, see |netrw-o|)
1207
1208Normally, the v key splits the window vertically with the new window and
Bram Moolenaar15146672011-10-20 22:22:38 +02001209cursor at the left.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001210
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001211There is only one tree listing buffer; using "v" on a displayed subdirectory
Bram Moolenaar446cb832008-06-24 21:56:24 +00001212will split the screen, but the same buffer will be shown twice.
1213
1214Associated setting variable: |g:netrw_altv| |g:netrw_winsize|
1215
Bram Moolenaar15146672011-10-20 22:22:38 +02001216Related Actions |netrw-cr| |netrw-o| |netrw-t| |netrw-T| |netrw-v|
1217Associated setting variables:
1218 |g:netrw_altv| control right/left splitting
1219 |g:netrw_winsize| control initial sizing
1220
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001221
1222CHANGE LISTING STYLE (THIN LONG WIDE TREE) *netrw-i* {{{2
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001223
Bram Moolenaar9964e462007-05-05 17:54:07 +00001224The "i" map cycles between the thin, long, wide, and tree listing formats.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001225
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001226The thin listing format gives just the files' and directories' names.
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001227
Bram Moolenaar8299df92004-07-10 09:47:34 +00001228The long listing is either based on the "ls" command via ssh for remote
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001229directories or displays the filename, file size (in bytes), and the time and
1230date of last modification for local directories. With the long listing
1231format, netrw is not able to recognize filenames which have trailing spaces.
1232Use the thin listing format for such files.
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001233
Bram Moolenaar9964e462007-05-05 17:54:07 +00001234The wide listing format uses two or more contiguous spaces to delineate
1235filenames; when using that format, netrw won't be able to recognize or use
1236filenames which have two or more contiguous spaces embedded in the name or any
1237trailing spaces. The thin listing format will, however, work with such files.
1238This listing format is the most compact.
1239
1240The tree listing format has a top directory followed by files and directories
1241preceded by a "|". One may open and close directories by pressing the <cr>
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001242key while atop the directory name.
1243
1244One may make a preferred listing style your default; see |g:netrw_liststyle|.
1245As an example, by putting the following line in your .vimrc, >
1246 let g:netrw_liststyle= 4
1247the tree style will become your default listing style.
Bram Moolenaar8299df92004-07-10 09:47:34 +00001248
Bram Moolenaar5b435d62012-04-05 17:33:26 +02001249One typical way to use the netrw tree display is to: >
1250
1251 vim .
1252 (use i until a tree display shows)
1253 navigate to a file
1254 v (edit as desired in vertically split window)
1255 ctrl-w h (to return to the netrw listing)
1256 P (edit newly selected file in the previous window)
1257 ctrl-w h (to return to the netrw listing)
1258 P (edit newly selected file in the previous window)
1259 ...etc...
1260<
Bram Moolenaar446cb832008-06-24 21:56:24 +00001261Associated setting variables: |g:netrw_liststyle| |g:netrw_maxfilenamelen|
1262 |g:netrw_timefmt| |g:netrw_list_cmd|
Bram Moolenaar8299df92004-07-10 09:47:34 +00001263
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001264CHANGE FILE PERMISSION *netrw-gp* {{{2
1265
1266"gp" will ask you for a new permission for the file named under the cursor.
1267Currently, this only works for local files.
1268
1269Associated setting variables: |g:netrw_chgperm|
1270
Bram Moolenaar83bab712005-08-01 21:58:57 +00001271
Bram Moolenaar446cb832008-06-24 21:56:24 +00001272CHANGING TO A BOOKMARKED DIRECTORY *netrw-gb* {{{2
Bram Moolenaar843ee412004-06-30 16:16:41 +00001273
Bram Moolenaar446cb832008-06-24 21:56:24 +00001274To change directory back to a bookmarked directory, use
Bram Moolenaar843ee412004-06-30 16:16:41 +00001275
Bram Moolenaar446cb832008-06-24 21:56:24 +00001276 {cnt}gb
Bram Moolenaar843ee412004-06-30 16:16:41 +00001277
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001278Any count may be used to reference any of the bookmarks.
1279
1280Related Topics:
1281 |netrw-mB| how to delete bookmarks
1282 |netrw-mb| how to make a bookmark
1283 |netrw-qb| how to list bookmarks
Bram Moolenaar843ee412004-06-30 16:16:41 +00001284
Bram Moolenaar843ee412004-06-30 16:16:41 +00001285
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001286CHANGING TO A PREDECESSOR DIRECTORY *netrw-u* *netrw-updir* {{{2
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001287
1288Every time you change to a new directory (new for the current session),
1289netrw will save the directory in a recently-visited directory history
Bram Moolenaaradc21822011-04-01 18:03:16 +02001290list (unless |g:netrw_dirhistmax| is zero; by default, it's ten). With the
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001291"u" map, one can change to an earlier directory (predecessor). To do
1292the opposite, see |netrw-U|.
1293
1294
Bram Moolenaar446cb832008-06-24 21:56:24 +00001295CHANGING TO A SUCCESSOR DIRECTORY *netrw-U* *netrw-downdir* {{{2
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001296
1297With the "U" map, one can change to a later directory (successor).
1298This map is the opposite of the "u" map. (see |netrw-u|) Use the
Bram Moolenaar446cb832008-06-24 21:56:24 +00001299q map to list both the bookmarks and history. (see |netrw-qb|)
1300
1301
1302NETRW CLEAN *netrw-clean* *:NetrwClean*
1303
1304With :NetrwClean one may easily remove netrw from one's home directory;
1305more precisely, from the first directory on your |'runtimepath'|.
1306
1307With :NetrwClean!, netrw will remove netrw from all directories on your
1308|'runtimepath'|.
1309
1310With either form of the command, netrw will first ask for confirmation
1311that the removal is in fact what you want to do. If netrw doesn't have
1312permission to remove a file, it will issue an error message.
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001313
Bram Moolenaar9964e462007-05-05 17:54:07 +00001314 *netrw-gx*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001315CUSTOMIZING BROWSING WITH A USER FUNCTION *netrw-x* *netrw-handler* {{{2
Bram Moolenaar9964e462007-05-05 17:54:07 +00001316 (also see |netrw_filehandler|)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001317
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001318Certain files, such as html, gif, jpeg, (word/office) doc, etc, files, are
1319best seen with a special handler (ie. a tool provided with your computer).
1320Netrw allows one to invoke such special handlers by: >
1321
1322 * when Exploring, hit the "x" key
1323 * when editing, hit gx with the cursor atop the special filename
Bram Moolenaar9964e462007-05-05 17:54:07 +00001324< (not available if the |g:netrw_nogx| variable exists)
1325
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001326Netrw determines which special handler by the following method:
1327
1328 * if |g:netrw_browsex_viewer| exists, then it will be used to attempt to
1329 view files. Examples of useful settings (place into your <.vimrc>): >
1330
1331 :let g:netrw_browsex_viewer= "kfmclient exec"
1332< or >
1333 :let g:netrw_browsex_viewer= "gnome-open"
1334<
1335 If g:netrw_browsex_viewer == '-', then netrwFileHandler() will be
1336 invoked first (see |netrw_filehandler|).
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001337
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001338 * for Windows 32 or 64, the url and FileProtocolHandler dlls are used.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001339 * for Gnome (with gnome-open): gnome-open is used.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001340 * for KDE (with kfmclient) : kfmclient is used.
1341 * for Mac OS X : open is used.
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001342 * otherwise the netrwFileHandler plugin is used.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001343
1344The file's suffix is used by these various approaches to determine an
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001345appropriate application to use to "handle" these files. Such things as
1346OpenOffice (*.sfx), visualization (*.jpg, *.gif, etc), and PostScript (*.ps,
1347*.eps) can be handled.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001348
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001349 *netrw_filehandler*
Bram Moolenaar9964e462007-05-05 17:54:07 +00001350
1351The "x" map applies a function to a file, based on its extension. Of course,
1352the handler function must exist for it to be called!
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001353>
1354 Ex. mypgm.html x ->
Bram Moolenaar9964e462007-05-05 17:54:07 +00001355 NFH_html("scp://user@host/some/path/mypgm.html")
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001356<
Bram Moolenaar9964e462007-05-05 17:54:07 +00001357Users may write their own netrw File Handler functions to support more
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001358suffixes with special handling. See <autoload/netrwFileHandlers.vim> for
Bram Moolenaar9964e462007-05-05 17:54:07 +00001359examples on how to make file handler functions. As an example: >
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001360
Bram Moolenaar9964e462007-05-05 17:54:07 +00001361 " NFH_suffix(filename)
1362 fun! NFH_suffix(filename)
1363 ..do something special with filename..
1364 endfun
1365<
1366These functions need to be defined in some file in your .vim/plugin
1367(vimfiles\plugin) directory. Vim's function names may not have punctuation
1368characters (except for the underscore) in them. To support suffices that
1369contain such characters, netrw will first convert the suffix using the
1370following table: >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001371
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001372 @ -> AT ! -> EXCLAMATION % -> PERCENT
1373 : -> COLON = -> EQUAL ? -> QUESTION
Bram Moolenaar9964e462007-05-05 17:54:07 +00001374 , -> COMMA - -> MINUS ; -> SEMICOLON
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001375 $ -> DOLLAR + -> PLUS ~ -> TILDE
1376<
Bram Moolenaar9964e462007-05-05 17:54:07 +00001377So, for example: >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001378
Bram Moolenaar9964e462007-05-05 17:54:07 +00001379 file.rcs,v -> NFH_rcsCOMMAv()
1380<
1381If more such translations are necessary, please send me email: >
1382 NdrOchip at ScampbellPfamily.AbizM - NOSPAM
1383with a request.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001384
Bram Moolenaar446cb832008-06-24 21:56:24 +00001385Associated setting variable: |g:netrw_browsex_viewer|
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001386
Bram Moolenaar446cb832008-06-24 21:56:24 +00001387 *netrw-curdir*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001388DELETING BOOKMARKS *netrw-mB* {{{2
1389
1390To delete a bookmark, use >
1391
1392 {cnt}mB
1393<
1394Related Topics:
1395 |netrw-gb| how to return (go) to a bookmark
1396 |netrw-mb| how to make a bookmark
1397 |netrw-qb| how to list bookmarks
1398
1399
Bram Moolenaar446cb832008-06-24 21:56:24 +00001400DELETING FILES OR DIRECTORIES *netrw-delete* *netrw-D* *netrw-del* {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001401
Bram Moolenaar446cb832008-06-24 21:56:24 +00001402If files have not been marked with |netrw-mf|: (local marked file list)
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001403
Bram Moolenaar446cb832008-06-24 21:56:24 +00001404 Deleting/removing files and directories involves moving the cursor to the
1405 file/directory to be deleted and pressing "D". Directories must be empty
1406 first before they can be successfully removed. If the directory is a
1407 softlink to a directory, then netrw will make two requests to remove the
1408 directory before succeeding. Netrw will ask for confirmation before doing
1409 the removal(s). You may select a range of lines with the "V" command
1410 (visual selection), and then pressing "D".
Bram Moolenaar9964e462007-05-05 17:54:07 +00001411
Bram Moolenaar446cb832008-06-24 21:56:24 +00001412If files have been marked with |netrw-mf|: (local marked file list)
1413
1414 Marked files (and empty directories) will be deleted; again, you'll be
1415 asked to confirm the deletion before it actually takes place.
1416
1417The |g:netrw_rm_cmd|, |g:netrw_rmf_cmd|, and |g:netrw_rmdir_cmd| variables are
1418used to control the attempts to remove files and directories. The
1419g:netrw_rm_cmd is used with files, and its default value is:
1420
1421 g:netrw_rm_cmd: ssh HOSTNAME rm
1422
1423The g:netrw_rmdir_cmd variable is used to support the removal of directories.
1424Its default value is:
1425
1426 g:netrw_rmdir_cmd: ssh HOSTNAME rmdir
1427
1428If removing a directory fails with g:netrw_rmdir_cmd, netrw then will attempt
1429to remove it again using the g:netrw_rmf_cmd variable. Its default value is:
1430
1431 g:netrw_rmf_cmd: ssh HOSTNAME rm -f
1432
Bram Moolenaar15146672011-10-20 22:22:38 +02001433Related topics: |netrw-d|
Bram Moolenaar5b435d62012-04-05 17:33:26 +02001434Associated setting variable: |g:netrw_localrmdir| |g:netrw_rm_cmd|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001435 |g:netrw_rmdir_cmd| |g:netrw_ssh_cmd|
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001436
1437
Bram Moolenaar446cb832008-06-24 21:56:24 +00001438*netrw-explore* *netrw-hexplore* *netrw-nexplore* *netrw-pexplore*
1439*netrw-rexplore* *netrw-sexplore* *netrw-texplore* *netrw-vexplore*
1440DIRECTORY EXPLORATION COMMANDS {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001441
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001442 :[N]Explore[!] [dir]... Explore directory of current file *:Explore*
1443 :[N]Hexplore[!] [dir]... Horizontal Split & Explore *:Hexplore*
1444 :Rexplore ... Return to Explorer *:Rexplore*
1445 :[N]Sexplore[!] [dir]... Split&Explore current file's directory *:Sexplore*
1446 :Texplore [dir]... Tab & Explore *:Texplore*
1447 :[N]Vexplore[!] [dir]... Vertical Split & Explore *:Vexplore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001448
1449 Used with :Explore **/pattern : (also see |netrw-starstar|)
1450 :Nexplore............. go to next matching file *:Nexplore*
1451 :Pexplore............. go to previous matching file *:Pexplore*
1452
1453:Explore will open the local-directory browser on the current file's
1454 directory (or on directory [dir] if specified). The window will be
1455 split only if the file has been modified, otherwise the browsing
1456 window will take over that window. Normally the splitting is taken
1457 horizontally.
1458:Explore! is like :Explore, but will use vertical splitting.
1459:Sexplore will always split the window before invoking the local-directory
1460 browser. As with Explore, the splitting is normally done
1461 horizontally.
1462:Sexplore! [dir] is like :Sexplore, but the splitting will be done vertically.
1463:Hexplore [dir] does an :Explore with |:belowright| horizontal splitting.
1464:Hexplore! [dir] does an :Explore with |:aboveleft| horizontal splitting.
1465:Vexplore [dir] does an :Explore with |:leftabove| vertical splitting.
1466:Vexplore! [dir] does an :Explore with |:rightbelow| vertical splitting.
1467:Texplore [dir] does a tabnew before generating the browser window
1468
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001469By default, these commands use the current file's directory. However, one may
1470explicitly provide a directory (path) to use.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001471
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001472The [N] will override |g:netrw_winsize| to specify the quantity of rows and/or
1473columns the new explorer window should have.
1474
1475Otherwise, the |g:netrw_winsize| variable, if it has been specified by the
1476user, is used to control the quantity of rows and/or columns new explorer
1477windows should have.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001478
1479:Rexplore This command is a little different from the others. When one
1480 edits a file, for example by pressing <cr> when atop a file in
1481 a netrw browser window, :Rexplore will return the display to
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001482 that of the last netrw browser window. It is a command version
1483 of the <2-leftmouse> map (which is only available under gvim and
Bram Moolenaar446cb832008-06-24 21:56:24 +00001484 cooperative terms).
1485
1486
1487*netrw-star* *netrw-starpat* *netrw-starstar* *netrw-starstarpat*
1488EXPLORING WITH STARS AND PATTERNS
1489
1490When Explore, Sexplore, Hexplore, or Vexplore are used with one of the
1491following four styles, Explore generates a list of files which satisfy
1492the request. >
1493
1494 */filepat files in current directory which satisfy filepat
1495 **/filepat files in current directory or below which satisfy the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001496 file pattern
Bram Moolenaar446cb832008-06-24 21:56:24 +00001497 *//pattern files in the current directory which contain the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001498 pattern (vimgrep is used)
Bram Moolenaar446cb832008-06-24 21:56:24 +00001499 **//pattern files in the current directory or below which contain
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001500 the pattern (vimgrep is used)
Bram Moolenaar572cb562005-08-05 21:35:02 +00001501<
Bram Moolenaar446cb832008-06-24 21:56:24 +00001502The cursor will be placed on the first file in the list. One may then
1503continue to go to subsequent files on that list via |:Nexplore| or to
1504preceding files on that list with |:Pexplore|. Explore will update the
1505directory and place the cursor appropriately.
1506
1507A plain >
1508 :Explore
1509will clear the explore list.
1510
1511If your console or gui produces recognizable shift-up or shift-down sequences,
1512then you'll likely find using shift-downarrow and shift-uparrow convenient.
1513They're mapped by netrw:
1514
1515 <s-down> == Nexplore, and
1516 <s-up> == Pexplore.
1517
1518As an example, consider
1519>
1520 :Explore */*.c
1521 :Nexplore
1522 :Nexplore
1523 :Pexplore
1524<
1525The status line will show, on the right hand side of the status line, a
1526message like "Match 3 of 20".
1527
1528Associated setting variables: |g:netrw_keepdir| |g:netrw_browse_split|
1529 |g:netrw_fastbrowse| |g:netrw_ftp_browse_reject|
1530 |g:netrw_ftp_list_cmd| |g:netrw_ftp_sizelist_cmd|
1531 |g:netrw_ftp_timelist_cmd| |g:netrw_list_cmd|
1532 |g:netrw_liststyle|
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001533
1534
Bram Moolenaar446cb832008-06-24 21:56:24 +00001535DISPLAYING INFORMATION ABOUT FILE *netrw-qf* {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001536
Bram Moolenaar446cb832008-06-24 21:56:24 +00001537With the cursor atop a filename, pressing "qf" will reveal the file's size
1538and last modification timestamp. Currently this capability is only available
1539for local files.
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001540
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001541
Bram Moolenaar446cb832008-06-24 21:56:24 +00001542EDIT FILE OR DIRECTORY HIDING LIST *netrw-ctrl-h* *netrw-edithide* {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001543
Bram Moolenaar446cb832008-06-24 21:56:24 +00001544The "<ctrl-h>" map brings up a requestor allowing the user to change the
1545file/directory hiding list contained in |g:netrw_list_hide|. The hiding list
1546consists of one or more patterns delimited by commas. Files and/or
1547directories satisfying these patterns will either be hidden (ie. not shown) or
1548be the only ones displayed (see |netrw-a|).
1549
1550The "gh" mapping (see |netrw-gh|) quickly alternates between the usual
1551hiding list and the hiding of files or directories that begin with ".".
1552
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001553As an example, >
1554 let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+'
1555Effectively, this makes the effect of a |netrw-gh| command the initial setting.
1556What it means:
1557
1558 \(^\|\s\s\) : if the line begins with the following, -or-
1559 two consecutive spaces are encountered
1560 \zs : start the hiding match now
1561 \. : if it now begins with a dot
1562 \S\+ : and is followed by one or more non-whitespace
1563 characters
1564
Bram Moolenaar446cb832008-06-24 21:56:24 +00001565Associated setting variables: |g:netrw_hide| |g:netrw_list_hide|
1566Associated topics: |netrw-a| |netrw-gh| |netrw-mh|
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001567
Bram Moolenaar15146672011-10-20 22:22:38 +02001568 *netrw-sort-sequence*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001569EDITING THE SORTING SEQUENCE *netrw-S* *netrw-sortsequence* {{{2
1570
1571When "Sorted by" is name, one may specify priority via the sorting sequence
1572(g:netrw_sort_sequence). The sorting sequence typically prioritizes the
1573name-listing by suffix, although any pattern will do. Patterns are delimited
1574by commas. The default sorting sequence is (all one line):
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001575
1576For Unix: >
1577 '[\/]$,\<core\%(\.\d\+\)\=,\.[a-np-z]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,
1578 \.info$,\.swp$,\.bak$,\~$'
1579<
1580Otherwise: >
Bram Moolenaar446cb832008-06-24 21:56:24 +00001581 '[\/]$,\.[a-np-z]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,
1582 \.swp$,\.bak$,\~$'
1583<
1584The lone * is where all filenames not covered by one of the other patterns
1585will end up. One may change the sorting sequence by modifying the
1586g:netrw_sort_sequence variable (either manually or in your <.vimrc>) or by
1587using the "S" map.
1588
Bram Moolenaarc236c162008-07-13 17:41:49 +00001589Related topics: |netrw-s| |netrw-S|
1590Associated setting variables: |g:netrw_sort_sequence| |g:netrw_sort_options|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001591
1592
Bram Moolenaar97d62492012-11-15 21:28:22 +01001593EXECUTING FILE UNDER CURSOR VIA SYSTEM() *netrw-X*
1594
1595Pressing X while the cursor is atop an executable file will yield a prompt
1596using the filename asking for any arguments. Upon pressing a [return], netrw
1597will then call |system()| with that command and arguments. The result will
1598be displayed by |:echomsg|, and so |:messages| will repeat display of the
1599result. Ansi escape sequences will be stripped out.
1600
1601
Bram Moolenaaradc21822011-04-01 18:03:16 +02001602FORCING TREATMENT AS A FILE OR DIRECTORY *netrw-gd* *netrw-gf* {{{2
1603
1604Remote symbolic links (ie. those listed via ssh or ftp) are problematic
1605in that it is difficult to tell whether they link to a file or to a
1606directory.
1607
1608To force treatment as a file: use >
Bram Moolenaar97d62492012-11-15 21:28:22 +01001609 gf
Bram Moolenaaradc21822011-04-01 18:03:16 +02001610<
1611To force treatment as a directory: use >
Bram Moolenaar97d62492012-11-15 21:28:22 +01001612 gd
Bram Moolenaaradc21822011-04-01 18:03:16 +02001613<
1614
Bram Moolenaar446cb832008-06-24 21:56:24 +00001615GOING UP *netrw--* {{{2
1616
1617To go up a directory, press "-" or press the <cr> when atop the ../ directory
1618entry in the listing.
1619
1620Netrw will use the command in |g:netrw_list_cmd| to perform the directory
1621listing operation after changing HOSTNAME to the host specified by the
1622user-provided url. By default netrw provides the command as:
1623
1624 ssh HOSTNAME ls -FLa
1625
1626where the HOSTNAME becomes the [user@]hostname as requested by the attempt to
1627read. Naturally, the user may override this command with whatever is
1628preferred. The NetList function which implements remote browsing
1629expects that directories will be flagged by a trailing slash.
1630
1631
1632HIDING FILES OR DIRECTORIES *netrw-a* *netrw-hiding* {{{2
1633
1634Netrw's browsing facility allows one to use the hiding list in one of three
1635ways: ignore it, hide files which match, and show only those files which
1636match.
1637
1638If no files have been marked via |netrw-mf|:
1639
1640The "a" map allows the user to cycle through the three hiding modes.
1641
1642The |g:netrw_list_hide| variable holds a comma delimited list of patterns
1643based on regular expressions (ex. ^.*\.obj$,^\.) which specify the hiding list.
1644(also see |netrw-ctrl-h|) To set the hiding list, use the <c-h> map. As an
1645example, to hide files which begin with a ".", one may use the <c-h> map to
1646set the hiding list to '^\..*' (or one may put let g:netrw_list_hide= '^\..*'
1647in one's <.vimrc>). One may then use the "a" key to show all files, hide
1648matching files, or to show only the matching files.
1649
1650 Example: \.[ch]$
1651 This hiding list command will hide/show all *.c and *.h files.
1652
1653 Example: \.c$,\.h$
1654 This hiding list command will also hide/show all *.c and *.h
1655 files.
1656
1657Don't forget to use the "a" map to select the mode (normal/hiding/show) you
1658want!
1659
1660If files have been marked using |netrw-mf|, then this command will:
1661
1662 if showing all files or non-hidden files:
1663 modify the g:netrw_list_hide list by appending the marked files to it
1664 and showing only non-hidden files.
1665
1666 else if showing hidden files only:
1667 modify the g:netrw_list_hide list by removing the marked files from it
1668 and showing only non-hidden files.
1669 endif
1670
1671 *netrw-gh* *netrw-hide*
1672As a quick shortcut, one may press >
1673 gh
1674to toggle between hiding files which begin with a period (dot) and not hiding
1675them.
1676
1677Associated setting variable: |g:netrw_list_hide|
1678Associated topics: |netrw-a| |netrw-ctrl-h| |netrw-mh|
1679
1680IMPROVING BROWSING *netrw-listhack* *netrw-ssh-hack* {{{2
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001681
1682Especially with the remote directory browser, constantly entering the password
1683is tedious.
1684
Bram Moolenaar9964e462007-05-05 17:54:07 +00001685For Linux/Unix systems, the book "Linux Server Hacks - 100 industrial strength
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +00001686tips & tools" by Rob Flickenger (O'Reilly, ISBN 0-596-00461-3) gives a tip
1687for setting up no-password ssh and scp and discusses associated security
Bram Moolenaar9964e462007-05-05 17:54:07 +00001688issues. It used to be available at http://hacks.oreilly.com/pub/h/66 ,
1689but apparently that address is now being redirected to some "hackzine".
Bram Moolenaare37d50a2008-08-06 17:06:04 +00001690I'll attempt a summary based on that article and on a communication from
1691Ben Schmidt:
Bram Moolenaar843ee412004-06-30 16:16:41 +00001692
Bram Moolenaare37d50a2008-08-06 17:06:04 +00001693 1. Generate a public/private key pair on the local machine
1694 (ssh client): >
1695 ssh-keygen -t rsa
1696 (saving the file in ~/.ssh/id_rsa as prompted)
1697<
1698 2. Just hit the <CR> when asked for passphrase (twice) for no
1699 passphrase. If you do use a passphrase, you will also need to use
1700 ssh-agent so you only have to type the passphrase once per session.
1701 If you don't use a passphrase, simply logging onto your local
1702 computer or getting access to the keyfile in any way will suffice
1703 to access any ssh servers which have that key authorized for login.
1704
1705 3. This creates two files: >
1706 ~/.ssh/id_rsa
1707 ~/.ssh/id_rsa.pub
1708<
1709 4. On the target machine (ssh server): >
1710 cd
1711 mkdir -p .ssh
1712 chmod 0700 .ssh
1713<
1714 5. On your local machine (ssh client): (one line) >
1715 ssh {serverhostname}
1716 cat '>>' '~/.ssh/authorized_keys2' < ~/.ssh/id_rsa.pub
1717<
1718 or, for OpenSSH, (one line) >
1719 ssh {serverhostname}
1720 cat '>>' '~/.ssh/authorized_keys' < ~/.ssh/id_rsa.pub
1721<
1722You can test it out with >
1723 ssh {serverhostname}
1724and you should be log onto the server machine without further need to type
1725anything.
1726
1727If you decided to use a passphrase, do: >
1728 ssh-agent $SHELL
1729 ssh-add
1730 ssh {serverhostname}
1731You will be prompted for your key passphrase when you use ssh-add, but not
1732subsequently when you use ssh. For use with vim, you can use >
1733 ssh-agent vim
1734and, when next within vim, use >
1735 :!ssh-add
1736Alternatively, you can apply ssh-agent to the terminal you're planning on
1737running vim in: >
1738 ssh-agent xterm &
1739and do ssh-add whenever you need.
Bram Moolenaar843ee412004-06-30 16:16:41 +00001740
Bram Moolenaar9964e462007-05-05 17:54:07 +00001741For Windows, folks on the vim mailing list have mentioned that Pageant helps
1742with avoiding the constant need to enter the password.
Bram Moolenaar433f7c82006-03-21 21:29:36 +00001743
Bram Moolenaar446cb832008-06-24 21:56:24 +00001744Kingston Fung wrote about another way to avoid constantly needing to enter
1745passwords:
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001746
Bram Moolenaar446cb832008-06-24 21:56:24 +00001747 In order to avoid the need to type in the password for scp each time, you
1748 provide a hack in the docs to set up a non password ssh account. I found a
1749 better way to do that: I can use a regular ssh account which uses a
1750 password to access the material without the need to key-in the password
1751 each time. It's good for security and convenience. I tried ssh public key
1752 authorization + ssh-agent, implementing this, and it works! Here are two
1753 links with instructions:
1754
1755 http://www.ibm.com/developerworks/library/l-keyc2/
1756 http://sial.org/howto/openssh/publickey-auth/
1757
1758
1759LISTING BOOKMARKS AND HISTORY *netrw-qb* *netrw-listbookmark* {{{2
1760
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001761Pressing "qb" (query bookmarks) will list both the bookmarked directories and
1762directory traversal history.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001763
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001764Related Topics:
1765 |netrw-gb| how to return (go) to a bookmark
1766 |netrw-mb| how to make a bookmark
1767 |netrw-mB| how to delete bookmarks
1768 |netrw-u| change to a predecessor directory via the history stack
1769 |netrw-U| change to a successor directory via the history stack
Bram Moolenaar446cb832008-06-24 21:56:24 +00001770
1771MAKING A NEW DIRECTORY *netrw-d* {{{2
1772
1773With the "d" map one may make a new directory either remotely (which depends
1774on the global variable g:netrw_mkdir_cmd) or locally (which depends on the
Bram Moolenaar5b435d62012-04-05 17:33:26 +02001775global variable g:netrw_localmkdir). Netrw will issue a request for the new
Bram Moolenaar446cb832008-06-24 21:56:24 +00001776directory's name. A bare <CR> at that point will abort the making of the
1777directory. Attempts to make a local directory that already exists (as either
1778a file or a directory) will be detected, reported on, and ignored.
1779
Bram Moolenaar15146672011-10-20 22:22:38 +02001780Related topics: |netrw-D|
Bram Moolenaar5b435d62012-04-05 17:33:26 +02001781Associated setting variables: |g:netrw_localmkdir| |g:netrw_mkdir_cmd|
Bram Moolenaar15146672011-10-20 22:22:38 +02001782 |g:netrw_remote_mkdir|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001783
1784
1785MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-c* {{{2
1786
1787By default, |g:netrw_keepdir| is 1. This setting means that the current
1788directory will not track the browsing directory.
1789
1790Setting g:netrw_keepdir to 0 tells netrw to make vim's current directory to
1791track netrw's browsing directory.
1792
1793However, given the default setting for g:netrw_keepdir of 1 where netrw
1794maintains its own separate notion of the current directory, in order to make
1795the two directories the same, use the "c" map (just type c). That map will
1796set Vim's notion of the current directory to netrw's current browsing
1797directory.
1798
1799Associated setting variable: |g:netrw_keepdir|
1800
1801MARKING FILES *netrw-mf* {{{2
1802 (also see |netrw-mr|)
1803
1804One may mark files with the cursor atop a filename and then pressing "mf".
1805With gvim, one may also mark files with <s-leftmouse>. The following netrw
1806maps make use of marked files:
1807
1808 |netrw-a| Hide marked files/directories
1809 |netrw-D| Delete marked files/directories
1810 |netrw-mc| Copy marked files to target
1811 |netrw-md| Apply vimdiff to marked files
1812 |netrw-me| Edit marked files
1813 |netrw-mg| Apply vimgrep to marked files
1814 |netrw-mm| Move marked files
1815 |netrw-mp| Print marked files
1816 |netrw-mt| Set target for |netrw-mm| and |netrw-mc|
1817 |netrw-mT| Generate tags using marked files
1818 |netrw-mx| Apply shell command to marked files
1819 |netrw-mz| Compress/Decompress marked files
1820 |netrw-O| Obtain marked files
1821 |netrw-R| Rename marked files
1822
1823One may unmark files one at a time the same way one marks them; ie. place
1824the cursor atop a marked file and press "mf". This process also works
1825with <s-leftmouse> using gvim. One may unmark all files by pressing
1826"mu" (see |netrw-mu|).
1827
Bram Moolenaaradc21822011-04-01 18:03:16 +02001828Marked files are highlighted using the "netrwMarkFile" highlighting group,
1829which by default is linked to "Identifier" (see Identifier under
1830|group-name|). You may change the highlighting group by putting something
1831like >
1832
1833 highlight clear netrwMarkFile
1834 hi link netrwMarkFile ..whatever..
1835<
1836into $HOME/.vim/after/syntax/netrw.vim .
1837
Bram Moolenaar446cb832008-06-24 21:56:24 +00001838*markfilelist* *global_markfilelist* *local_markfilelist*
1839All marked files are entered onto the global marked file list; there is only
1840one such list. In addition, every netrw buffer also has its own local marked
1841file list; since netrw buffers are associated with specific directories, this
1842means that each directory has its own local marked file list. The various
1843commands which operate on marked files use one or the other of the marked file
1844lists.
1845
1846
1847MARKING FILES BY REGULAR EXPRESSION *netrw-mr* {{{2
1848 (also see |netrw-mf|)
1849
1850One may also mark files by pressing "mr"; netrw will then issue a prompt,
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001851"Enter regexp: ". You may then enter a shell-style regular expression such
1852as *.c$ (see |glob()|). For remote systems, glob() doesn't work -- so netrw
1853converts "*" into ".*" (see |regexp|) and marks files based on that. In the
1854future I may make it possible to use |regexp|s instead of glob()-style
1855expressions (yet-another-option).
Bram Moolenaar446cb832008-06-24 21:56:24 +00001856
1857
1858MARKED FILES: ARBITRARY COMMAND *netrw-mx* {{{2
1859 (See |netrw-mf| and |netrw-mr| for how to mark files)
1860 (uses the local marked-file list)
1861
1862Upon activation of the "mx" map, netrw will query the user for some (external)
1863command to be applied to all marked files. All "%"s in the command will be
1864substituted with the name of each marked file in turn. If no "%"s are in the
1865command, then the command will be followed by a space and a marked filename.
1866
1867
1868MARKED FILES: COMPRESSION AND DECOMPRESSION *netrw-mz* {{{2
1869 (See |netrw-mf| and |netrw-mr| for how to mark files)
1870 (uses the local marked file list)
1871
1872If any marked files are compressed, then "mz" will decompress them.
1873If any marked files are decompressed, then "mz" will compress them
1874using the command specified by |g:netrw_compress|; by default,
1875that's "gzip".
1876
1877For decompression, netrw provides a |Dictionary| of suffices and their
1878associated decompressing utilities; see |g:netrw_decompress|.
1879
1880Associated setting variables: |g:netrw_compress| |g:netrw_decompress|
1881
1882MARKED FILES: COPYING *netrw-mc* {{{2
1883 (See |netrw-mf| and |netrw-mr| for how to mark files)
1884 (Uses the global marked file list)
1885
1886Select a target directory with mt (|netrw-mt|). Then change directory,
Bram Moolenaaradc21822011-04-01 18:03:16 +02001887select file(s) (see |netrw-mf|), and press "mc". The copy is done
1888from the current window (where one does the mf) to the target.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001889
1890Associated setting variable: |g:netrw_localcopycmd| |g:netrw_ssh_cmd|
1891
1892MARKED FILES: DIFF *netrw-md* {{{2
1893 (See |netrw-mf| and |netrw-mr| for how to mark files)
1894 (uses the global marked file list)
1895
1896Use |vimdiff| to visualize difference between selected files (two or
1897three may be selected for this). Uses the global marked file list.
1898
1899MARKED FILES: EDITING *netrw-me* {{{2
1900 (See |netrw-mf| and |netrw-mr| for how to mark files)
1901 (uses the global marked file list)
1902
1903This command will place the marked files on the |arglist| and commence
1904editing them. One may return the to explorer window with |:Rexplore|.
1905
1906MARKED FILES: GREP *netrw-mg* {{{2
1907 (See |netrw-mf| and |netrw-mr| for how to mark files)
1908 (uses the global marked file list)
1909
1910This command will apply |:vimgrep| to the marked files. The command will ask
1911for the requested pattern; one may enter: >
1912 /pattern/[g][j]
1913 ! /pattern/[g][j]
1914 pattern
1915<
1916MARKED FILES: HIDING AND UNHIDING BY SUFFIX *netrw-mh* {{{2
1917 (See |netrw-mf| and |netrw-mr| for how to mark files)
1918 (uses the local marked file list)
1919
1920This command extracts the suffices of the marked files and toggles their
1921presence on the hiding list. Please note that marking the same suffix
1922this way multiple times will result in the suffix's presence being toggled
1923for each file (so an even quantity of marked files having the same suffix
1924is the same as not having bothered to select them at all).
1925
1926Related topics: |netrw-a| |g:netrw_list_hide|
1927
1928MARKED FILES: MOVING *netrw-mm* {{{2
1929 (See |netrw-mf| and |netrw-mr| for how to mark files)
1930 (uses the global marked file list)
1931
Bram Moolenaare37d50a2008-08-06 17:06:04 +00001932 WARNING: moving files is more dangerous than copying them.
1933 A file being moved is first copied and then deleted; if the
1934 copy operation fails and the delete succeeds, you will lose
1935 the file. Either try things out with unimportant files
1936 first or do the copy and then delete yourself using mc and D.
1937 Use at your own risk!
1938
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001939Select a target directory with mt (|netrw-mt|). Then change directory,
Bram Moolenaaradc21822011-04-01 18:03:16 +02001940select file(s) (see |netrw-mf|), and press "mm". The move is done
1941from the current window (where one does the mf) to the target.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001942
1943Associated setting variable: |g:netrw_localmovecmd| |g:netrw_ssh_cmd|
1944
1945MARKED FILES: PRINTING *netrw-mp* {{{2
1946 (See |netrw-mf| and |netrw-mr| for how to mark files)
1947 (uses the local marked file list)
1948
1949Netrw will apply the |:hardcopy| command to marked files. What it does
1950is open each file in a one-line window, execute hardcopy, then close the
1951one-line window.
1952
1953
1954MARKED FILES: SOURCING *netrw-ms* {{{2
1955 (See |netrw-mf| and |netrw-mr| for how to mark files)
1956 (uses the local marked file list)
1957
1958Netrw will source the marked files (using vim's |:source| command)
1959
1960
1961MARKED FILES: TAGGING *netrw-mT* {{{2
1962 (See |netrw-mf| and |netrw-mr| for how to mark files)
1963 (uses the global marked file list)
1964
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001965The "mT" mapping will apply the command in |g:netrw_ctags| (by default, it is
Bram Moolenaar446cb832008-06-24 21:56:24 +00001966"ctags") to marked files. For remote browsing, in order to create a tags file
1967netrw will use ssh (see |g:netrw_ssh_cmd|), and so ssh must be available for
1968this to work on remote systems. For your local system, see |ctags| on how to
1969get a version. I myself use hdrtags, currently available at
Bram Moolenaar97d62492012-11-15 21:28:22 +01001970http://www.drchip.org/astronaut/src/index.html , and have >
Bram Moolenaar446cb832008-06-24 21:56:24 +00001971
1972 let g:netrw_ctags= "hdrtag"
1973<
1974in my <.vimrc>.
1975
1976When a remote set of files are tagged, the resulting tags file is "obtained";
1977ie. a copy is transferred to the local system's directory. The local tags
1978file is then modified so that one may use it through the network. The
1979modification is concerns the names of the files in the tags; each filename is
1980preceded by the netrw-compatible url used to obtain it. When one subsequently
1981uses one of the go to tag actions (|tags|), the url will be used by netrw to
1982edit the desired file and go to the tag.
1983
Bram Moolenaarc236c162008-07-13 17:41:49 +00001984Associated setting variables: |g:netrw_ctags| |g:netrw_ssh_cmd|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001985
1986
1987MARKED FILES: SETTING THE TARGET DIRECTORY *netrw-mt* {{{2
1988 (See |netrw-mf| and |netrw-mr| for how to mark files)
1989
1990Set the marked file copy/move-to target (see |netrw-mc| and |netrw-mm|):
1991
1992 * if the cursor is atop a file name, then the netrw window's currently
1993 displayed directory is used for the copy/move-to target.
1994
1995 * also, if the cursor is in the banner, then the netrw window's currently
1996 displayed directory is used for the copy/move-to target.
1997
1998 * however, if the cursor is atop a directory name, then that directory is
1999 used for the copy/move-to target
2000
2001There is only one copy/move-to target per vim session; ie. the target is a
2002script variable (see |s:var|) and is shared between all netrw windows (in an
2003instance of vim).
2004
2005MARKED FILES: UNMARKING *netrw-mu* {{{2
2006 (See |netrw-mf| and |netrw-mr| for how to mark files)
2007
2008The "mu" mapping will unmark all currently marked files.
2009
Bram Moolenaar15146672011-10-20 22:22:38 +02002010 *netrw-browser-settings*
Bram Moolenaar446cb832008-06-24 21:56:24 +00002011NETRW BROWSER VARIABLES *netrw-browser-options* *netrw-browser-var* {{{2
2012
Bram Moolenaar15146672011-10-20 22:22:38 +02002013(if you're interested in the netrw file transfer settings, see |netrw-options|
2014 and |netrw-protocol|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002015
2016The <netrw.vim> browser provides settings in the form of variables which
2017you may modify; by placing these settings in your <.vimrc>, you may customize
2018your browsing preferences. (see also: |netrw-settings|)
2019>
2020 --- -----------
2021 Var Explanation
2022 --- -----------
Bram Moolenaaradc21822011-04-01 18:03:16 +02002023< *g:netrw_alto* change from above splitting to below splitting
Bram Moolenaar446cb832008-06-24 21:56:24 +00002024 by setting this variable (see |netrw-o|)
2025 default: =&sb (see |'sb'|)
2026
Bram Moolenaaradc21822011-04-01 18:03:16 +02002027 *g:netrw_altv* change from left splitting to right splitting
Bram Moolenaar446cb832008-06-24 21:56:24 +00002028 by setting this variable (see |netrw-v|)
2029 default: =&spr (see |'spr'|)
2030
Bram Moolenaaradc21822011-04-01 18:03:16 +02002031 *g:netrw_banner* enable/suppress the banner
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002032 =0: suppress the banner
2033 =1: banner is enabled (default)
2034 NOTE: suppressing the banner is a new feature
2035 which may cause problems.
2036
Bram Moolenaaradc21822011-04-01 18:03:16 +02002037 *g:netrw_browse_split* when browsing, <cr> will open the file by:
Bram Moolenaar446cb832008-06-24 21:56:24 +00002038 =0: re-using the same window
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002039 =1: horizontally splitting the window first
2040 =2: vertically splitting the window first
Bram Moolenaar446cb832008-06-24 21:56:24 +00002041 =3: open file in new tab
2042 =4: act like "P" (ie. open previous window)
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002043 Note that |g:netrw_preview| may be used
2044 to get vertical splitting instead of
2045 horizontal splitting.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002046
Bram Moolenaaradc21822011-04-01 18:03:16 +02002047 *g:netrw_browsex_viewer* specify user's preference for a viewer: >
Bram Moolenaar446cb832008-06-24 21:56:24 +00002048 "kfmclient exec"
2049 "gnome-open"
2050< If >
2051 "-"
2052< is used, then netrwFileHandler() will look for
2053 a script/function to handle the given
2054 extension. (see |netrw_filehandler|).
2055
Bram Moolenaaradc21822011-04-01 18:03:16 +02002056 *g:netrw_chgperm* Unix/Linux: "chmod PERM FILENAME"
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002057 Windows: "cacls FILENAME /e /p PERM"
2058 Used to change access permission for a file.
2059
Bram Moolenaaradc21822011-04-01 18:03:16 +02002060 *g:netrw_compress* ="gzip"
Bram Moolenaar446cb832008-06-24 21:56:24 +00002061 Will compress marked files with this
2062 command
2063
Bram Moolenaar15146672011-10-20 22:22:38 +02002064 *g:Netrw_corehandler* Allows one to specify something additional
2065 to do when handling <core> files via netrw's
2066 browser's "x" command (see |netrw-x|). If
2067 present, g:Netrw_corehandler specifies
2068 either one or more function references
2069 (see |Funcref|). (the capital g:Netrw...
2070 is required its holding a function reference)
2071
2072
Bram Moolenaaradc21822011-04-01 18:03:16 +02002073 *g:netrw_ctags* ="ctags"
Bram Moolenaarc236c162008-07-13 17:41:49 +00002074 The default external program used to create tags
2075
Bram Moolenaaradc21822011-04-01 18:03:16 +02002076 *g:netrw_cursor* = 2 (default)
2077 This option controls the use of the
2078 |'cursorline'| (cul) and |'cursorcolumn'|
2079 (cuc) settings by netrw:
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002080
Bram Moolenaaradc21822011-04-01 18:03:16 +02002081 Value Thin-Long-Tree Wide
2082 =0 u-cul u-cuc u-cul u-cuc
2083 =1 u-cul u-cuc cul u-cuc
2084 =2 cul u-cuc cul u-cuc
2085 =3 cul u-cuc cul cuc
2086 =4 cul cuc cul cuc
2087
2088 Where
2089 u-cul : user's |'cursorline'| setting used
2090 u-cuc : user's |'cursorcolumn'| setting used
2091 cul : |'cursorline'| locally set
2092 cuc : |'cursorcolumn'| locally set
2093
2094 *g:netrw_decompress* = { ".gz" : "gunzip" ,
Bram Moolenaar446cb832008-06-24 21:56:24 +00002095 ".bz2" : "bunzip2" ,
2096 ".zip" : "unzip" ,
2097 ".tar" : "tar -xf"}
2098 A dictionary mapping suffices to
2099 decompression programs.
2100
Bram Moolenaaradc21822011-04-01 18:03:16 +02002101 *g:netrw_dirhistmax* =10: controls maximum quantity of past
2102 history. May be zero to supppress
2103 history.
2104 (related: |netrw-qb| |netrw-u| |netrw-U|)
2105
Bram Moolenaar97d62492012-11-15 21:28:22 +01002106 *g:netrw_dynamic_maxfilenamelen* =32: enables dynamic determination of
2107 |g:netrw_maxfilenamelen|, which affects
2108 local file long listing.
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002109 *g:netrw_errorlvl* =0: error levels greater than or equal to
2110 this are permitted to be displayed
2111 0: notes
2112 1: warnings
2113 2: errors
2114
Bram Moolenaaradc21822011-04-01 18:03:16 +02002115 *g:netrw_fastbrowse* =0: slow speed directory browsing;
Bram Moolenaar446cb832008-06-24 21:56:24 +00002116 never re-uses directory listings,
2117 always obtains directory listings.
2118 =1: medium speed directory browsing;
2119 re-use directory listings only
2120 when remote directory browsing.
2121 (default value)
2122 =2: fast directory browsing;
2123 only obtains directory listings when the
2124 directory hasn't been seen before
2125 (or |netrw-ctrl-l| is used).
2126
2127 Fast browsing retains old directory listing
2128 buffers so that they don't need to be
2129 re-acquired. This feature is especially
2130 important for remote browsing. However, if
2131 a file is introduced or deleted into or from
2132 such directories, the old directory buffer
2133 becomes out-of-date. One may always refresh
2134 such a directory listing with |netrw-ctrl-l|.
2135 This option gives the user the choice of
2136 trading off accuracy (ie. up-to-date listing)
2137 versus speed.
2138
Bram Moolenaaradc21822011-04-01 18:03:16 +02002139 *g:netrw_fname_escape* =' ?&;%'
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002140 Used on filenames before remote reading/writing
Bram Moolenaar446cb832008-06-24 21:56:24 +00002141
Bram Moolenaaradc21822011-04-01 18:03:16 +02002142 *g:netrw_ftp_browse_reject* ftp can produce a number of errors and warnings
Bram Moolenaar446cb832008-06-24 21:56:24 +00002143 that can show up as "directories" and "files"
2144 in the listing. This pattern is used to
2145 remove such embedded messages. By default its
2146 value is:
2147 '^total\s\+\d\+$\|
2148 ^Trying\s\+\d\+.*$\|
2149 ^KERBEROS_V\d rejected\|
2150 ^Security extensions not\|
2151 No such file\|
2152 : connect to address [0-9a-fA-F:]*
2153 : No route to host$'
2154
Bram Moolenaaradc21822011-04-01 18:03:16 +02002155 *g:netrw_ftp_list_cmd* options for passing along to ftp for directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002156 listing. Defaults:
2157 unix or g:netrw_cygwin set: : "ls -lF"
2158 otherwise "dir"
2159
2160
Bram Moolenaaradc21822011-04-01 18:03:16 +02002161 *g:netrw_ftp_sizelist_cmd* options for passing along to ftp for directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002162 listing, sorted by size of file.
2163 Defaults:
2164 unix or g:netrw_cygwin set: : "ls -slF"
2165 otherwise "dir"
2166
Bram Moolenaaradc21822011-04-01 18:03:16 +02002167 *g:netrw_ftp_timelist_cmd* options for passing along to ftp for directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002168 listing, sorted by time of last modification.
2169 Defaults:
2170 unix or g:netrw_cygwin set: : "ls -tlF"
2171 otherwise "dir"
2172
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002173 *g:netrw_glob_escape* ='[]*?`{~$' (unix)
Bram Moolenaar00a927d2010-05-14 23:24:24 +02002174 ='[]*?`{$' (windows
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002175 These characters in directory names are
Bram Moolenaar446cb832008-06-24 21:56:24 +00002176 escaped before applying glob()
2177
Bram Moolenaaradc21822011-04-01 18:03:16 +02002178 *g:netrw_hide* if true, the hiding list is used
Bram Moolenaar446cb832008-06-24 21:56:24 +00002179 default: =0
2180
Bram Moolenaaradc21822011-04-01 18:03:16 +02002181 *g:netrw_home* The home directory for where bookmarks and
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002182 history are saved (as .netrwbook and
2183 .netrwhist).
2184 default: the first directory on the
2185 |'runtimepath'|
2186
Bram Moolenaaradc21822011-04-01 18:03:16 +02002187 *g:netrw_keepdir* =1 (default) keep current directory immune from
Bram Moolenaar446cb832008-06-24 21:56:24 +00002188 the browsing directory.
2189 =0 keep the current directory the same as the
2190 browsing directory.
2191 The current browsing directory is contained in
2192 b:netrw_curdir (also see |netrw-c|)
2193
Bram Moolenaaradc21822011-04-01 18:03:16 +02002194 *g:netrw_list_cmd* command for listing remote directories
Bram Moolenaar446cb832008-06-24 21:56:24 +00002195 default: (if ssh is executable)
2196 "ssh HOSTNAME ls -FLa"
2197
Bram Moolenaaradc21822011-04-01 18:03:16 +02002198 *g:netrw_liststyle* Set the default listing style:
Bram Moolenaar446cb832008-06-24 21:56:24 +00002199 = 0: thin listing (one file per line)
2200 = 1: long listing (one file per line with time
2201 stamp information and file size)
2202 = 2: wide listing (multiple files in columns)
2203 = 3: tree style listing
Bram Moolenaaradc21822011-04-01 18:03:16 +02002204 *g:netrw_list_hide* comma separated pattern list for hiding files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002205 Patterns are regular expressions (see |regexp|)
2206 Example: let g:netrw_list_hide= '.*\.swp$'
2207 default: ""
2208
Bram Moolenaaradc21822011-04-01 18:03:16 +02002209 *g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002210 ="copy" Windows
Bram Moolenaar446cb832008-06-24 21:56:24 +00002211 Copies marked files (|netrw-mf|) to target
2212 directory (|netrw-mt|, |netrw-mc|)
2213
Bram Moolenaaradc21822011-04-01 18:03:16 +02002214 *g:netrw_localmovecmd* ="mv" Linux/Unix/MacOS/Cygwin
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002215 ="move" Windows
Bram Moolenaar446cb832008-06-24 21:56:24 +00002216 Moves marked files (|netrw-mf|) to target
2217 directory (|netrw-mt|, |netrw-mm|)
2218
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002219 *g:netrw_localmkdir* command for making a local directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002220 default: "mkdir"
2221
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002222 *g:netrw_localrmdir* remove directory command (rmdir)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002223 default: "rmdir"
2224
Bram Moolenaaradc21822011-04-01 18:03:16 +02002225 *g:netrw_maxfilenamelen* =32 by default, selected so as to make long
Bram Moolenaar446cb832008-06-24 21:56:24 +00002226 listings fit on 80 column displays.
2227 If your screen is wider, and you have file
2228 or directory names longer than 32 bytes,
2229 you may set this option to keep listings
2230 columnar.
2231
Bram Moolenaaradc21822011-04-01 18:03:16 +02002232 *g:netrw_mkdir_cmd* command for making a remote directory
Bram Moolenaar15146672011-10-20 22:22:38 +02002233 via ssh (also see |g:netrw_remote_mkdir|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002234 default: "ssh USEPORT HOSTNAME mkdir"
2235
Bram Moolenaar251e1912011-06-19 05:09:16 +02002236 *g:netrw_mousemaps* =1 (default) enables mouse buttons while
2237 browsing to:
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002238 leftmouse : open file/directory
2239 shift-leftmouse : mark file
2240 middlemouse : same as P
2241 rightmouse : remove file/directory
2242 =0: disables mouse maps
2243
Bram Moolenaar15146672011-10-20 22:22:38 +02002244 *g:netrw_nobeval* doesn't exist (default)
2245 If this variable exists, then balloon
2246 evaluation will be suppressed
2247 (see |'ballooneval'|)
2248
2249 *g:netrw_remote_mkdir* command for making a local directory
2250 via ftp (also see |g:netrw_mkdir_cmd|)
2251 default: "mkdir"
2252
Bram Moolenaaradc21822011-04-01 18:03:16 +02002253 *g:netrw_retmap* if it exists and is set to one, then:
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002254 * if in a netrw-selected file, AND
2255 * no normal-mode <2-leftmouse> mapping exists,
2256 then the <2-leftmouse> will be mapped for easy
Bram Moolenaar446cb832008-06-24 21:56:24 +00002257 return to the netrw browser window.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002258 example: click once to select and open a file,
2259 double-click to return.
2260
2261 Note that one may instead choose to:
2262 * let g:netrw_retmap= 1, AND
2263 * nmap <silent> YourChoice <Plug>NetrwReturn
2264 and have another mapping instead of
2265 <2-leftmouse> to invoke the return.
2266
2267 You may also use the |:Rexplore| command to do
2268 the same thing.
2269
Bram Moolenaar446cb832008-06-24 21:56:24 +00002270 default: =0
2271
Bram Moolenaaradc21822011-04-01 18:03:16 +02002272 *g:netrw_rm_cmd* command for removing files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002273 default: "ssh USEPORT HOSTNAME rm"
2274
Bram Moolenaaradc21822011-04-01 18:03:16 +02002275 *g:netrw_rmdir_cmd* command for removing directories
Bram Moolenaar446cb832008-06-24 21:56:24 +00002276 default: "ssh USEPORT HOSTNAME rmdir"
2277
Bram Moolenaaradc21822011-04-01 18:03:16 +02002278 *g:netrw_rmf_cmd* command for removing softlinks
Bram Moolenaar446cb832008-06-24 21:56:24 +00002279 default: "ssh USEPORT HOSTNAME rm -f"
2280
Bram Moolenaaradc21822011-04-01 18:03:16 +02002281 *g:netrw_sort_by* sort by "name", "time", or "size"
Bram Moolenaar446cb832008-06-24 21:56:24 +00002282 default: "name"
2283
Bram Moolenaaradc21822011-04-01 18:03:16 +02002284 *g:netrw_sort_direction* sorting direction: "normal" or "reverse"
Bram Moolenaar446cb832008-06-24 21:56:24 +00002285 default: "normal"
2286
Bram Moolenaaradc21822011-04-01 18:03:16 +02002287 *g:netrw_sort_options* sorting is done using |:sort|; this
Bram Moolenaarc236c162008-07-13 17:41:49 +00002288 variable's value is appended to the
2289 sort command. Thus one may ignore case,
2290 for example, with the following in your
2291 .vimrc: >
2292 let g:netrw_sort_options="i"
2293< default: ""
2294
Bram Moolenaaradc21822011-04-01 18:03:16 +02002295 *g:netrw_sort_sequence* when sorting by name, first sort by the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002296 comma-separated pattern sequence. Note that
2297 the filigree added to indicate filetypes
2298 should be accounted for in your pattern.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002299 default: '[\/]$,*,\.bak$,\.o$,\.h$,
2300 \.info$,\.swp$,\.obj$'
2301
Bram Moolenaaradc21822011-04-01 18:03:16 +02002302 *g:netrw_special_syntax* If true, then certain files will be shown
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002303 using special syntax in the browser:
Bram Moolenaar446cb832008-06-24 21:56:24 +00002304
2305 netrwBak : *.bak
2306 netrwCompress: *.gz *.bz2 *.Z *.zip
2307 netrwData : *.dat
2308 netrwHdr : *.h
2309 netrwLib : *.a *.so *.lib *.dll
2310 netrwMakefile: [mM]akefile *.mak
2311 netrwObj : *.o *.obj
2312 netrwTags : tags ANmenu ANtags
Bram Moolenaaradc21822011-04-01 18:03:16 +02002313 netrwTilde : *~
Bram Moolenaar446cb832008-06-24 21:56:24 +00002314 netrwTmp : tmp* *tmp
2315
2316 These syntax highlighting groups are linked
2317 to Folded or DiffChange by default
2318 (see |hl-Folded| and |hl-DiffChange|), but
2319 one may put lines like >
2320 hi link netrwCompress Visual
2321< into one's <.vimrc> to use one's own
2322 preferences.
2323
Bram Moolenaaradc21822011-04-01 18:03:16 +02002324 *g:netrw_ssh_cmd* One may specify an executable command
Bram Moolenaar446cb832008-06-24 21:56:24 +00002325 to use instead of ssh for remote actions
2326 such as listing, file removal, etc.
2327 default: ssh
2328
Bram Moolenaaradc21822011-04-01 18:03:16 +02002329 *g:netrw_ssh_browse_reject* ssh can sometimes produce unwanted lines,
Bram Moolenaar446cb832008-06-24 21:56:24 +00002330 messages, banners, and whatnot that one doesn't
2331 want masquerading as "directories" and "files".
2332 Use this pattern to remove such embedded
2333 messages. By default its value is:
2334 '^total\s\+\d\+$'
2335
2336
Bram Moolenaaradc21822011-04-01 18:03:16 +02002337 *g:netrw_tmpfile_escape* =' &;'
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002338 escape() is applied to all temporary files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002339 to escape these characters.
2340
Bram Moolenaaradc21822011-04-01 18:03:16 +02002341 *g:netrw_timefmt* specify format string to vim's strftime().
Bram Moolenaar446cb832008-06-24 21:56:24 +00002342 The default, "%c", is "the preferred date
2343 and time representation for the current
2344 locale" according to my manpage entry for
2345 strftime(); however, not all are satisfied
2346 with it. Some alternatives:
2347 "%a %d %b %Y %T",
2348 " %a %Y-%m-%d %I-%M-%S %p"
2349 default: "%c"
2350
Bram Moolenaaradc21822011-04-01 18:03:16 +02002351 *g:netrw_use_noswf* netrw normally avoids writing swapfiles
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002352 for browser buffers. However, under some
Bram Moolenaar446cb832008-06-24 21:56:24 +00002353 systems this apparently is causing nasty
2354 ml_get errors to appear; if you're getting
2355 ml_get errors, try putting
2356 let g:netrw_use_noswf= 0
2357 in your .vimrc.
2358
Bram Moolenaaradc21822011-04-01 18:03:16 +02002359 *g:netrw_winsize* specify initial size of new windows made with
Bram Moolenaar446cb832008-06-24 21:56:24 +00002360 "o" (see |netrw-o|), "v" (see |netrw-v|),
Bram Moolenaar251e1912011-06-19 05:09:16 +02002361 |:Hexplore| or |:Vexplore|. The g:netrw_winsize
2362 is an integer describing the percentage of the
2363 current netrw buffer's window to be used for
2364 the new window.
Bram Moolenaar15146672011-10-20 22:22:38 +02002365 If g:netrw_winsize is less than zero, then
2366 the absolute value of g:netrw_winsize lines
2367 or columns will be used for the new window.
Bram Moolenaar251e1912011-06-19 05:09:16 +02002368 default: 50 (for 50%)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002369
Bram Moolenaaradc21822011-04-01 18:03:16 +02002370 *g:netrw_xstrlen* Controls how netrw computes string lengths,
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002371 including multi-byte characters' string
Bram Moolenaar446cb832008-06-24 21:56:24 +00002372 length. (thanks to N Weibull, T Mechelynck)
2373 =0: uses Vim's built-in strlen()
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002374 =1: number of codepoints (Latin a + combining
Bram Moolenaar446cb832008-06-24 21:56:24 +00002375 circumflex is two codepoints) (DEFAULT)
2376 =2: number of spacing codepoints (Latin a +
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002377 combining circumflex is one spacing
Bram Moolenaar446cb832008-06-24 21:56:24 +00002378 codepoint; a hard tab is one; wide and
2379 narrow CJK are one each; etc.)
2380 =3: virtual length (counting tabs as anything
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002381 between 1 and |'tabstop'|, wide CJK as 2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002382 rather than 1, Arabic alif as zero when
2383 immediately preceded by lam, one
2384 otherwise, etc)
2385
Bram Moolenaaradc21822011-04-01 18:03:16 +02002386 *g:NetrwTopLvlMenu* This variable specifies the top level
Bram Moolenaar446cb832008-06-24 21:56:24 +00002387 menu name; by default, it's "Netrw.". If
2388 you wish to change this, do so in your
2389 .vimrc.
2390
2391NETRW BROWSING AND OPTION INCOMPATIBILITIES *netrw-incompatible* {{{2
2392
2393Netrw has been designed to handle user options by saving them, setting the
2394options to something that's compatible with netrw's needs, and then restoring
2395them. However, the autochdir option: >
2396 :set acd
2397is problematical. Autochdir sets the current directory to that containing the
2398file you edit; this apparently also applies to directories. In other words,
2399autochdir sets the current directory to that containing the "file" (even if
2400that "file" is itself a directory).
2401
Bram Moolenaar15146672011-10-20 22:22:38 +02002402NETRW SETTINGS WINDOW *netrw-settings-window* {{{2
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00002403
2404With the NetrwSettings.vim plugin, >
2405 :NetrwSettings
2406will bring up a window with the many variables that netrw uses for its
Bram Moolenaar1afcace2005-11-25 19:54:28 +00002407settings. You may change any of their values; when you save the file, the
2408settings therein will be used. One may also press "?" on any of the lines for
2409help on what each of the variables do.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00002410
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002411(also see: |netrw-browser-var| |netrw-protocol| |netrw-variables|)
Bram Moolenaar9964e462007-05-05 17:54:07 +00002412
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00002413
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00002414==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00002415OBTAINING A FILE *netrw-O* {{{2
2416
2417If there are no marked files:
2418
2419 When browsing a remote directory, one may obtain a file under the cursor
2420 (ie. get a copy on your local machine, but not edit it) by pressing the O
2421 key.
2422
2423If there are marked files:
2424
2425 The marked files will be obtained (ie. a copy will be transferred to your
2426 local machine, but not set up for editing).
2427
2428Only ftp and scp are supported for this operation (but since these two are
2429available for browsing, that shouldn't be a problem). The status bar will
2430then show, on its right hand side, a message like "Obtaining filename". The
2431statusline will be restored after the transfer is complete.
2432
2433Netrw can also "obtain" a file using the local browser. Netrw's display
2434of a directory is not necessarily the same as Vim's "current directory",
2435unless |g:netrw_keepdir| is set to 0 in the user's <.vimrc>. One may select
2436a file using the local browser (by putting the cursor on it) and pressing
2437"O" will then "obtain" the file; ie. copy it to Vim's current directory.
2438
2439Related topics:
2440 * To see what the current directory is, use |:pwd|
2441 * To make the currently browsed directory the current directory, see |netrw-c|
2442 * To automatically make the currently browsed directory the current
2443 directory, see |g:netrw_keepdir|.
2444
Bram Moolenaaradc21822011-04-01 18:03:16 +02002445 *netrw-createfile*
Bram Moolenaarc236c162008-07-13 17:41:49 +00002446OPEN A NEW FILE IN NETRW'S CURRENT DIRECTORY *netrw-%*
2447
2448To open a file in netrw's current directory, press "%". This map will
2449query the user for a new filename; an empty file by that name will be
2450placed in the netrw's current directory (ie. b:netrw_curdir).
2451
2452
Bram Moolenaar446cb832008-06-24 21:56:24 +00002453PREVIEW WINDOW *netrw-p* *netrw-preview* {{{2
2454
2455One may use a preview window by using the "p" key when the cursor is atop the
2456desired filename to be previewed. The display will then split to show both
2457the browser (where the cursor will remain) and the file (see |:pedit|).
2458By default, the split will be taken horizontally; one may use vertical
2459splitting if one has set |g:netrw_preview| first.
2460
Bram Moolenaar00a927d2010-05-14 23:24:24 +02002461An interesting set of netrw settings is: >
2462
2463 let g:netrw_preview = 1
2464 let g:netrw_liststyle = 3
2465 let g:netrw_winsize = 30
2466
2467These will:
2468 1. Make vertical splitting the default for previewing files
2469 2. Make the default listing style "tree"
2470 3. When a vertical preview window is opened, the directory listing
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002471 will use only 30% of the columns available; the rest of the window
2472 is used for the preview window.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002473
2474PREVIOUS WINDOW *netrw-P* *netrw-prvwin* {{{2
2475
2476To edit a file or directory in the previously used (last accessed) window (see
2477:he |CTRL-W_p|), press a "P". If there's only one window, then the one window
Bram Moolenaar15146672011-10-20 22:22:38 +02002478will be horizontally split (by default).
Bram Moolenaar446cb832008-06-24 21:56:24 +00002479
2480If there's more than one window, the previous window will be re-used on
2481the selected file/directory. If the previous window's associated buffer
2482has been modified, and there's only one window with that buffer, then
2483the user will be asked if s/he wishes to save the buffer first (yes,
2484no, or cancel).
2485
Bram Moolenaar15146672011-10-20 22:22:38 +02002486Related Actions |netrw-cr| |netrw-o| |netrw-t| |netrw-T| |netrw-v|
2487Associated setting variables:
2488 |g:netrw_alto| control above/below splitting
2489 |g:netrw_altv| control right/left splitting
2490 |g:netrw_preview| control horizontal vs vertical splitting
2491 |g:netrw_winsize| control initial sizing
2492
Bram Moolenaar446cb832008-06-24 21:56:24 +00002493
2494REFRESHING THE LISTING *netrw-ctrl-l* *netrw-ctrl_l* {{{2
2495
2496To refresh either a local or remote directory listing, press ctrl-l (<c-l>) or
2497hit the <cr> when atop the ./ directory entry in the listing. One may also
2498refresh a local directory by using ":e .".
2499
2500
2501RENAMING FILES OR DIRECTORIES *netrw-move* *netrw-rename* *netrw-R* {{{2
2502
2503If there are no marked files: (see |netrw-mf|)
2504
2505 Renaming/moving files and directories involves moving the cursor to the
2506 file/directory to be moved (renamed) and pressing "R". You will then be
2507 queried for where you want the file/directory to be moved. You may select
2508 a range of lines with the "V" command (visual selection), and then
2509 pressing "R".
2510
2511If there are marked files: (see |netrw-mf|)
2512
2513 Marked files will be renamed (moved). You will be queried as above in
2514 order to specify where you want the file/directory to be moved.
2515
2516 WARNING:~
2517
2518 Note that moving files is a dangerous operation; copies are safer. That's
2519 because a "move" for remote files is actually a copy + delete -- and if
2520 the copy fails and the delete does not, you may lose the file.
2521
2522The g:netrw_rename_cmd variable is used to implement renaming. By default its
2523value is:
2524
2525 ssh HOSTNAME mv
2526
2527One may rename a block of files and directories by selecting them with
2528the V (|linewise-visual|).
2529
2530
2531REVERSING SORTING ORDER *netrw-r* *netrw-reverse* {{{2
2532
2533One may toggle between normal and reverse sorting order by pressing the
2534"r" key.
2535
2536Related topics: |netrw-s|
2537Associated setting variable: |g:netrw_sort_direction|
2538
2539
2540SELECTING SORTING STYLE *netrw-s* *netrw-sort* {{{2
2541
2542One may select the sorting style by name, time, or (file) size. The "s" map
2543allows one to circulate amongst the three choices; the directory listing will
2544automatically be refreshed to reflect the selected style.
2545
2546Related topics: |netrw-r| |netrw-S|
2547Associated setting variables: |g:netrw_sort_by| |g:netrw_sort_sequence|
2548
2549
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002550SETTING EDITING WINDOW *netrw-C* {{{2
2551
2552One may select a netrw window for editing with the "C" mapping, or by setting
2553g:netrw_chgwin to the selected window number. Subsequent selection of a file
2554to edit (|netrw-cr|) will use that window.
2555
2556Related topics: |netrw-cr|
2557Associated setting variables: |g:netrw_chgwin|
2558
2559
Bram Moolenaar446cb832008-06-24 21:56:24 +0000256010. Problems and Fixes *netrw-problems* {{{1
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002561
2562 (This section is likely to grow as I get feedback)
2563 (also see |netrw-debug|)
Bram Moolenaar488c6512005-08-11 20:09:58 +00002564 *netrw-p1*
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002565 P1. I use windows 95, and my ftp dumps four blank lines at the
2566 end of every read.
2567
2568 See |netrw-fixup|, and put the following into your
2569 <.vimrc> file:
2570
2571 let g:netrw_win95ftp= 1
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00002572
Bram Moolenaar488c6512005-08-11 20:09:58 +00002573 *netrw-p2*
Bram Moolenaar9964e462007-05-05 17:54:07 +00002574 P2. I use Windows, and my network browsing with ftp doesn't sort by
2575 time or size! -or- The remote system is a Windows server; why
2576 don't I get sorts by time or size?
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002577
2578 Windows' ftp has a minimal support for ls (ie. it doesn't
2579 accept sorting options). It doesn't support the -F which
2580 gives an explanatory character (ABC/ for "ABC is a directory").
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002581 Netrw then uses "dir" to get both its thin and long listings.
Bram Moolenaar9964e462007-05-05 17:54:07 +00002582 If you think your ftp does support a full-up ls, put the
2583 following into your <.vimrc>: >
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002584
Bram Moolenaar9964e462007-05-05 17:54:07 +00002585 let g:netrw_ftp_list_cmd = "ls -lF"
2586 let g:netrw_ftp_timelist_cmd= "ls -tlF"
2587 let g:netrw_ftp_sizelist_cmd= "ls -slF"
2588<
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002589 Alternatively, if you have cygwin on your Windows box, put
Bram Moolenaar9964e462007-05-05 17:54:07 +00002590 into your <.vimrc>: >
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002591
2592 let g:netrw_cygwin= 1
Bram Moolenaar9964e462007-05-05 17:54:07 +00002593<
2594 This problem also occurs when the remote system is Windows.
2595 In this situation, the various g:netrw_ftp_[time|size]list_cmds
2596 are as shown above, but the remote system will not correctly
2597 modify its listing behavior.
2598
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002599
Bram Moolenaar488c6512005-08-11 20:09:58 +00002600 *netrw-p3*
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002601 P3. I tried rcp://user@host/ (or protocol other than ftp) and netrw
2602 used ssh! That wasn't what I asked for...
2603
2604 Netrw has two methods for browsing remote directories: ssh
2605 and ftp. Unless you specify ftp specifically, ssh is used.
2606 When it comes time to do download a file (not just a directory
2607 listing), netrw will use the given protocol to do so.
2608
Bram Moolenaar488c6512005-08-11 20:09:58 +00002609 *netrw-p4*
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002610 P4. I would like long listings to be the default.
2611
Bram Moolenaar446cb832008-06-24 21:56:24 +00002612 Put the following statement into your |.vimrc|: >
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00002613
Bram Moolenaar446cb832008-06-24 21:56:24 +00002614 let g:netrw_liststyle= 1
2615<
2616 Check out |netrw-browser-var| for more customizations that
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00002617 you can set.
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002618
Bram Moolenaar488c6512005-08-11 20:09:58 +00002619 *netrw-p5*
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002620 P5. My times come up oddly in local browsing
2621
2622 Does your system's strftime() accept the "%c" to yield dates
2623 such as "Sun Apr 27 11:49:23 1997"? If not, do a "man strftime"
2624 and find out what option should be used. Then put it into
Bram Moolenaar446cb832008-06-24 21:56:24 +00002625 your |.vimrc|: >
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002626
Bram Moolenaar446cb832008-06-24 21:56:24 +00002627 let g:netrw_timefmt= "%X" (where X is the option)
2628<
Bram Moolenaar488c6512005-08-11 20:09:58 +00002629 *netrw-p6*
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00002630 P6. I want my current directory to track my browsing.
2631 How do I do that?
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002632
Bram Moolenaar446cb832008-06-24 21:56:24 +00002633 Put the following line in your |.vimrc|:
2634>
Bram Moolenaar433f7c82006-03-21 21:29:36 +00002635 let g:netrw_keepdir= 0
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002636<
Bram Moolenaar9964e462007-05-05 17:54:07 +00002637 *netrw-p7*
2638 P7. I use Chinese (or other non-ascii) characters in my filenames, and
2639 netrw (Explore, Sexplore, Hexplore, etc) doesn't display them!
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00002640
Bram Moolenaar9964e462007-05-05 17:54:07 +00002641 (taken from an answer provided by Wu Yongwei on the vim
2642 mailing list)
2643 I now see the problem. You code page is not 936, right? Vim
2644 seems only able to open files with names that are valid in the
2645 current code page, as are many other applications that do not
2646 use the Unicode version of Windows APIs. This is an OS-related
2647 issue. You should not have such problems when the system
2648 locale uses UTF-8, such as modern Linux distros.
2649
2650 (...it is one more reason to recommend that people use utf-8!)
2651
2652 *netrw-p8*
2653 P8. I'm getting "ssh is not executable on your system" -- what do I
2654 do?
2655
2656 (Dudley Fox) Most people I know use putty for windows ssh. It
2657 is a free ssh/telnet application. You can read more about it
2658 here:
2659
2660 http://www.chiark.greenend.org.uk/~sgtatham/putty/ Also:
2661
2662 (Marlin Unruh) This program also works for me. It's a single
2663 executable, so he/she can copy it into the Windows\System32
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002664 folder and create a shortcut to it.
Bram Moolenaar9964e462007-05-05 17:54:07 +00002665
2666 (Dudley Fox) You might also wish to consider plink, as it
2667 sounds most similar to what you are looking for. plink is an
2668 application in the putty suite.
2669
2670 http://the.earth.li/~sgtatham/putty/0.58/htmldoc/Chapter7.html#plink
2671
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002672 (Vissale Neang) Maybe you can try OpenSSH for windows, which
Bram Moolenaar9964e462007-05-05 17:54:07 +00002673 can be obtained from:
2674
2675 http://sshwindows.sourceforge.net/
2676
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002677 It doesn't need the full Cygwin package.
Bram Moolenaar9964e462007-05-05 17:54:07 +00002678
2679 (Antoine Mechelynck) For individual Unix-like programs needed
2680 for work in a native-Windows environment, I recommend getting
2681 them from the GnuWin32 project on sourceforge if it has them:
2682
2683 http://gnuwin32.sourceforge.net/
2684
2685 Unlike Cygwin, which sets up a Unix-like virtual machine on
2686 top of Windows, GnuWin32 is a rewrite of Unix utilities with
2687 Windows system calls, and its programs works quite well in the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002688 cmd.exe "Dos box".
Bram Moolenaar9964e462007-05-05 17:54:07 +00002689
2690 (dave) Download WinSCP and use that to connect to the server.
2691 In Preferences > Editors, set gvim as your editor:
2692
2693 - Click "Add..."
2694 - Set External Editor (adjust path as needed, include
2695 the quotes and !.! at the end):
2696 "c:\Program Files\Vim\vim70\gvim.exe" !.!
2697 - Check that the filetype in the box below is
2698 {asterisk}.{asterisk} (all files), or whatever types
2699 you want (cec: change {asterisk} to * ; I had to
2700 write it that way because otherwise the helptags
Bram Moolenaar446cb832008-06-24 21:56:24 +00002701 system thinks it's a tag)
2702 - Make sure it's at the top of the listbox (click it,
2703 then click "Up" if it's not)
Bram Moolenaar9964e462007-05-05 17:54:07 +00002704 If using the Norton Commander style, you just have to hit <F4>
2705 to edit a file in a local copy of gvim.
2706
2707 (Vit Gottwald) How to generate public/private key and save
2708 public key it on server: >
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +02002709 http://www.chiark.greenend.org.uk/~sgtatham/putty/0.60/htmldoc/Chapter8.html#pubkey-gettingready
2710 (8.3 Getting ready for public key authentication)
Bram Moolenaar9964e462007-05-05 17:54:07 +00002711<
Bram Moolenaar446cb832008-06-24 21:56:24 +00002712 How to use a private key with 'pscp': >
2713
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +02002714 http://www.chiark.greenend.org.uk/~sgtatham/putty/0.60/htmldoc/Chapter5.html
2715 (5.2.4 Using public key authentication with PSCP)
Bram Moolenaar9964e462007-05-05 17:54:07 +00002716<
Bram Moolenaar446cb832008-06-24 21:56:24 +00002717 (Ben Schmidt) I find the ssh included with cwRsync is
2718 brilliant, and install cwRsync or cwRsyncServer on most
2719 Windows systems I come across these days. I guess COPSSH,
2720 packed by the same person, is probably even better for use as
2721 just ssh on Windows, and probably includes sftp, etc. which I
2722 suspect the cwRsync doesn't, though it might
2723
Bram Moolenaar9964e462007-05-05 17:54:07 +00002724 (cec) To make proper use of these suggestions above, you will
2725 need to modify the following user-settable variables in your
2726 .vimrc:
2727
Bram Moolenaar446cb832008-06-24 21:56:24 +00002728 |g:netrw_ssh_cmd| |g:netrw_list_cmd| |g:netrw_mkdir_cmd|
2729 |g:netrw_rm_cmd| |g:netrw_rmdir_cmd| |g:netrw_rmf_cmd|
Bram Moolenaar9964e462007-05-05 17:54:07 +00002730
2731 The first one (|g:netrw_ssh_cmd|) is the most important; most
2732 of the others will use the string in g:netrw_ssh_cmd by
2733 default.
2734 *netrw-p9* *netrw-ml_get*
2735 P9. I'm browsing, changing directory, and bang! ml_get errors
2736 appear and I have to kill vim. Any way around this?
2737
2738 Normally netrw attempts to avoid writing swapfiles for
2739 its temporary directory buffers. However, on some systems
2740 this attempt appears to be causing ml_get errors to
2741 appear. Please try setting |g:netrw_use_noswf| to 0
2742 in your <.vimrc>: >
2743 let g:netrw_use_noswf= 0
2744<
Bram Moolenaar446cb832008-06-24 21:56:24 +00002745 *netrw-p10*
2746 P10. I'm being pestered with "[something] is a directory" and
2747 "Press ENTER or type command to continue" prompts...
2748
2749 The "[something] is a directory" prompt is issued by Vim,
2750 not by netrw, and there appears to be no way to work around
2751 it. Coupled with the default cmdheight of 1, this message
2752 causes the "Press ENTER..." prompt. So: read |hit-enter|;
2753 I also suggest that you set your |'cmdheight'| to 2 (or more) in
2754 your <.vimrc> file.
2755
2756 *netrw-p11*
2757 P11. I want to have two windows; a thin one on the left and my editing
Bram Moolenaar251e1912011-06-19 05:09:16 +02002758 window on the right. How may I accomplish this?
Bram Moolenaar446cb832008-06-24 21:56:24 +00002759
2760 * Put the following line in your <.vimrc>:
2761 let g:netrw_altv = 1
2762 * Edit the current directory: :e .
2763 * Select some file, press v
2764 * Resize the windows as you wish (see |CTRL-W_<| and
2765 |CTRL-W_>|). If you're using gvim, you can drag
2766 the separating bar with your mouse.
2767 * When you want a new file, use ctrl-w h to go back to the
2768 netrw browser, select a file, then press P (see |CTRL-W_h|
2769 and |netrw-P|). If you're using gvim, you can press
2770 <leftmouse> in the browser window and then press the
2771 <middlemouse> to select the file.
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002772
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002773 *netrw-p12*
2774 P12. My directory isn't sorting correctly, or unwanted letters are
2775 appearing in the listed filenames, or things aren't lining
2776 up properly in the wide listing, ...
2777
2778 This may be due to an encoding problem. I myself usually use
2779 utf-8, but really only use ascii (ie. bytes from 32-126).
2780 Multibyte encodings use two (or more) bytes per character.
2781 You may need to change |g:netrw_sepchr| and/or |g:netrw_xstrlen|.
2782
Bram Moolenaar00a927d2010-05-14 23:24:24 +02002783 *netrw-p13*
2784 P13. I'm a Windows + putty + ssh user, and when I attempt to browse,
2785 the directories are missing trailing "/"s so netrw treats them
2786 as file transfers instead of as attempts to browse
2787 subdirectories. How may I fix this?
2788
2789 (mikeyao) If you want to use vim via ssh and putty under Windows,
2790 try combining the use of pscp/psftp with plink. pscp/psftp will
2791 be used to connect and plink will be used to execute commands on
2792 the server, for example: list files and directory using 'ls'.
2793
2794 These are the settings I use to do this:
2795>
2796 " list files, it's the key setting, if you haven't set,
2797 " you will get a blank buffer
2798 let g:netrw_list_cmd = "plink HOSTNAME ls -Fa"
2799 " if you haven't add putty directory in system path, you should
2800 " specify scp/sftp command. For examples:
2801 "let g:netrw_sftp_cmd = "d:\\dev\\putty\\PSFTP.exe"
2802 "let g:netrw_scp_cmd = "d:\\dev\\putty\\PSCP.exe"
2803<
Bram Moolenaar251e1912011-06-19 05:09:16 +02002804 *netrw-p14*
2805 P14. I'd would like to speed up writes using Nwrite and scp/ssh
2806 style connections. How? (Thomer M. Gil)
Bram Moolenaar00a927d2010-05-14 23:24:24 +02002807
Bram Moolenaar251e1912011-06-19 05:09:16 +02002808 Try using ssh's ControlMaster and ControlPath (see the ssh_config
2809 man page) to share multiple ssh connections over a single network
2810 connection. That cuts out the cryptographic handshake on each
2811 file write, sometimes speeding it up by an order of magnitude.
2812 (see http://thomer.com/howtos/netrw_ssh.html)
2813 (included by permission)
2814
2815 Add the following to your ~/.ssh/config: >
2816
2817 # you change "*" to the hostname you care about
2818 Host *
2819 ControlMaster auto
2820 ControlPath /tmp/%r@%h:%p
2821
2822< Then create an ssh connection to the host and leave it running: >
2823
2824 ssh -N host.domain.com
2825
2826< Now remotely open a file with Vim's Netrw and enjoy the
2827 zippiness: >
2828
2829 vim scp://host.domain.com//home/user/.bashrc
2830<
2831 *netrw-p15*
2832 P15. How may I use a double-click instead of netrw's usual single click
2833 to open a file or directory? (Ben Fritz)
2834
2835 First, disable netrw's mapping with >
2836 let g:netrw_mousemaps= 0
2837< and then create a netrw buffer only mapping in
2838 $HOME/.vim/after/ftplugin/netrw.vim: >
2839 nmap <buffer> <2-leftmouse> <CR>
2840< Note that setting g:netrw_mousemaps to zero will turn off
2841 all netrw's mouse mappings, not just the <leftmouse> one.
2842 (see |g:netrw_mousemaps|)
Bram Moolenaar00a927d2010-05-14 23:24:24 +02002843
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002844==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +0000284511. Debugging Netrw Itself *netrw-debug* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +00002846
Bram Moolenaaradc21822011-04-01 18:03:16 +02002847The <netrw.vim> script is typically available as something like:
Bram Moolenaar488c6512005-08-11 20:09:58 +00002848>
Bram Moolenaar446cb832008-06-24 21:56:24 +00002849 /usr/local/share/vim/vim7x/plugin/netrwPlugin.vim
2850 /usr/local/share/vim/vim7x/autoload/netrw.vim
Bram Moolenaaradc21822011-04-01 18:03:16 +02002851< -or- >
2852 /usr/local/share/vim/vim6x/plugin/netrwPlugin.vim
2853 /usr/local/share/vim/vim6x/autoload/netrw.vim
Bram Moolenaar488c6512005-08-11 20:09:58 +00002854<
Bram Moolenaar071d4272004-06-13 20:20:40 +00002855which is loaded automatically at startup (assuming :set nocp).
2856
2857 1. Get the <Decho.vim> script, available as:
2858
Bram Moolenaar97d62492012-11-15 21:28:22 +01002859 http://www.drchip.org/astronaut/vim/index.html#DECHO
Bram Moolenaar071d4272004-06-13 20:20:40 +00002860 or
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00002861 http://vim.sourceforge.net/scripts/script.php?script_id=120
Bram Moolenaar071d4272004-06-13 20:20:40 +00002862
Bram Moolenaar446cb832008-06-24 21:56:24 +00002863 It now comes as a "vimball"; if you're using vim 7.0 or earlier,
2864 you'll need to update vimball, too. See
Bram Moolenaar97d62492012-11-15 21:28:22 +01002865 http://www.drchip.org/astronaut/vim/index.html#VIMBALL
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00002866
Bram Moolenaar446cb832008-06-24 21:56:24 +00002867 2. Edit the <netrw.vim> file by typing: >
Bram Moolenaard4755bb2004-09-02 19:12:26 +00002868
2869 vim netrw.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +00002870 :DechoOn
Bram Moolenaard4755bb2004-09-02 19:12:26 +00002871 :wq
Bram Moolenaar446cb832008-06-24 21:56:24 +00002872<
2873 To restore to normal non-debugging behavior, re-edit <netrw.vim>
2874 and type >
Bram Moolenaar071d4272004-06-13 20:20:40 +00002875
Bram Moolenaard4755bb2004-09-02 19:12:26 +00002876 vim netrw.vim
2877 :DechoOff
2878 :wq
Bram Moolenaar446cb832008-06-24 21:56:24 +00002879<
Bram Moolenaard4755bb2004-09-02 19:12:26 +00002880 This command, provided by <Decho.vim>, will comment out all
2881 Decho-debugging statements (Dfunc(), Dret(), Decho(), Dredir()).
2882
Bram Moolenaar446cb832008-06-24 21:56:24 +00002883 3. Then bring up vim and attempt to evoke the problem by doing a
2884 transfer or doing some browsing. A set of messages should appear
2885 concerning the steps that <netrw.vim> took in attempting to
2886 read/write your file over the network in a separate tab.
Bram Moolenaar071d4272004-06-13 20:20:40 +00002887
Bram Moolenaar9964e462007-05-05 17:54:07 +00002888 To save the file, use >
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002889 :tabnext
Bram Moolenaar9964e462007-05-05 17:54:07 +00002890 :set bt=
2891 :w! DBG
2892< Please send that information to <netrw.vim>'s maintainer, >
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00002893 NdrOchip at ScampbellPfamily.AbizM - NOSPAM
Bram Moolenaar9964e462007-05-05 17:54:07 +00002894<
Bram Moolenaar071d4272004-06-13 20:20:40 +00002895==============================================================================
Bram Moolenaar9964e462007-05-05 17:54:07 +0000289612. History *netrw-history* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +00002897
Bram Moolenaar97d62492012-11-15 21:28:22 +01002898 v146: Oct 20, 2012 * (David Kotchan) reported that under Windows,
2899 directories named with unusual characters
2900 such as "#" or "$" were not being listed
2901 properly.
2902 * (Kenny Lee) reported that the buffer list
2903 was being populated by netrw buffers.
2904 Netrw will now |:bwipe| netrw buffers
2905 upon editing a file if g:netrw_fastbrowse
2906 is zero and its not in tree listing style.
2907 v145: Apr 05, 2012 * moved some command from a g:netrw_local_...
2908 format to g:netwr_local... format
2909 * included some NOTE level messages about
2910 commands that aren't executable
2911 * |g:netrw_errorlvl| (default: NOTE=0)
2912 option introduced
2913 May 18, 2012 * (Ilya Dogolazky) a scenario where a
2914 |g:netrw_fastbrowse| of zero did not
2915 have a local directory refreshed fixed.
2916 Jul 10, 2012 * (Donatas) |netrw-gb| wasn't working due
2917 to an incorrectly used variable.
2918 Aug 09, 2012 * (Bart Baker) netrw was doubling
2919 of entries after a split.
2920 * (code by Takahiro Yoshihara) implemented
2921 |g:netrw_dynamic_maxfilenamelen|
2922 Aug 31, 2012 * (Andrew Wong) netrw refresh overwriting
2923 the yank buffer.
2924 v144: Mar 12, 2012 * when |CTRL-W_s| or |CTRL-W_v| are used,
2925 or their wincmd equivalents, on a netrw
2926 buffer, the netrw's w: variables were
2927 not copied over. Fixed.
2928 Mar 13, 2012 * nbcd_curpos_{bufnr('%')} was commented
2929 out, and was mistakenly used during
2930 RestorePosn. Unfortunately, I'm not
2931 sure why it was commented out, so this
2932 "fix" may re-introduce an earlier problem.
2933 Mar 21, 2012 * included s:rexposn internally to make
2934 :Rex return the cursor to the same pos'n
2935 upon restoration of netrw buffer
2936 Mar 27, 2012 * (sjbesse) s:NetrwGetFile() needs to remove
2937 "/" from the netrw buffer's usual |'isk'|
2938 in order to allow "filetype detect" to work
2939 properly for scripts.
2940 v143: Jun 01, 2011 * |g:netrw_winsize| will accept a negative
2941 number; the absolute value of it will then
2942 be used to specify lines/columns instead of
2943 a percentage.
2944 Jul 05, 2011 * the "d" map now supports mkdir via ftp
2945 See |netrw-d| and |g:netrw_remote_mkdir|
2946 Jul 11, 2011 * Changed Explore!, Sexplore!, and Vexplore
2947 to use a percentage of |winwidth()| instead
2948 of a percentage of |winheight()|.
2949 Jul 11, 2011 * included support for https://... I'm just
2950 beginning to test this, however.
2951 Aug 01, 2011 * changed RestoreOptions to also restore
2952 cursor position in netrw buffers.
2953 Aug 12, 2011 * added a note about "%" to the balloon
2954 Aug 30, 2011 * if |g:netrw_nobeval| exists, then balloon
2955 evaluation is suppressed.
2956 Aug 31, 2011 * (Benjamin R Haskell) provided a patch that
2957 implements non-standard port handling for
2958 files opened via the remote browser.
2959 Aug 31, 2011 * Fixed a **//pattern Explorer bug
2960 Sep 15, 2011 * (reported by Francesco Campana) netrw
2961 now permits the "@" to be part of the
2962 user id (if there's an @ that appears
2963 to the right).
2964 Nov 21, 2011 * New option: |g:netrw_ftp_options|
2965 Dec 07, 2011 * (James Sinclair) provided a fix handling
2966 attempts to use a uid and password when
2967 they weren't defined. This affected
2968 NetWrite (NetRead already had that fix).
Bram Moolenaar071d4272004-06-13 20:20:40 +00002969
2970
2971==============================================================================
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100297213. Todo *netrw-todo* {{{1
2973
297407/29/09 : banner :|g:netrw_banner| can be used to suppress the
2975 suppression banner. This feature is new and experimental,
2976 so its in the process of being debugged.
297709/04/09 : "gp" : See if it can be made to work for remote systems.
2978 : See if it can be made to work with marked files.
2979
2980==============================================================================
298114. Credits *netrw-credits* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +00002982
2983 Vim editor by Bram Moolenaar (Thanks, Bram!)
2984 dav support by C Campbell
2985 fetch support by Bram Moolenaar and C Campbell
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00002986 ftp support by C Campbell <NdrOchip@ScampbellPfamily.AbizM>
Bram Moolenaar071d4272004-06-13 20:20:40 +00002987 http support by Bram Moolenaar <bram@moolenaar.net>
2988 rcp
2989 rsync support by C Campbell (suggested by Erik Warendorph)
2990 scp support by raf <raf@comdyn.com.au>
2991 sftp support by C Campbell
2992
2993 inputsecret(), BufReadCmd, BufWriteCmd contributed by C Campbell
2994
2995 Jérôme Augé -- also using new buffer method with ftp+.netrc
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00002996 Bram Moolenaar -- obviously vim itself, :e and v:cmdarg use,
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +00002997 fetch,...
Bram Moolenaar071d4272004-06-13 20:20:40 +00002998 Yasuhiro Matsumoto -- pointing out undo+0r problem and a solution
2999 Erik Warendorph -- for several suggestions (g:netrw_..._cmd
3000 variables, rsync etc)
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00003001 Doug Claar -- modifications to test for success with ftp
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +00003002 operation
Bram Moolenaar071d4272004-06-13 20:20:40 +00003003
3004==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00003005Modelines: {{{1
Bram Moolenaar83bab712005-08-01 21:58:57 +00003006 vim:tw=78:ts=8:ft=help:norl:fdm=marker