blob: 32ed1bf28e35358968d0a3047a7eeedbf827dae7 [file] [log] [blame]
Bram Moolenaara6878372014-03-22 21:02:50 +01001*pi_netrw.txt* For Vim version 7.4. Last change: 2014 Mar 20
Bram Moolenaar071d4272004-06-13 20:20:40 +00002
Bram Moolenaarff034192013-04-24 18:51:19 +02003 ------------------------------------------------
4 NETRW REFERENCE MANUAL by Charles E. Campbell
5 ------------------------------------------------
6Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM>
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01007 (remove NOSPAM from Campbell's email first)
8
Bram Moolenaar8d043172014-01-23 14:24:41 +01009Copyright: Copyright (C) 1999-2014 Charles E Campbell *netrw-copyright*
Bram Moolenaar5b435d62012-04-05 17:33:26 +020010 The VIM LICENSE applies to the files in this package, including
11 netrw.vim, pi_netrw.txt, netrwFileHandlers.vim, netrwSettings.vim, and
12 syntax/netrw.vim. Like anything else that's free, netrw.vim and its
13 associated files are provided *as is* and comes with no warranty of
14 any kind, either expressed or implied. No guarantees of
15 merchantability. No guarantees of suitability for any purpose. By
16 using this plugin, you agree that in no event will the copyright
17 holder be liable for any damages resulting from the use of this
18 software. Use at your own risk!
Bram Moolenaar071d4272004-06-13 20:20:40 +000019
Bram Moolenaar1afcace2005-11-25 19:54:28 +000020
Bram 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 Moolenaarff034192013-04-24 18:51:19 +0200281. Contents..............................................|netrw-contents|
292. Starting With Netrw...................................|netrw-start|
303. Netrw Reference.......................................|netrw-ref|
31 EXTERNAL APPLICATIONS AND PROTOCOLS.................|netrw-externapp|
32 READING.............................................|netrw-read|
33 WRITING.............................................|netrw-write|
34 SOURCING............................................|netrw-source|
35 DIRECTORY LISTING...................................|netrw-dirlist|
36 CHANGING THE USERID AND PASSWORD....................|netrw-chgup|
37 VARIABLES AND SETTINGS..............................|netrw-variables|
38 PATHS...............................................|netrw-path|
394. Network-Oriented File Transfer........................|netrw-xfer|
40 NETRC...............................................|netrw-netrc|
41 PASSWORD............................................|netrw-passwd|
425. Activation............................................|netrw-activate|
436. Transparent Remote File Editing.......................|netrw-transparent|
447. Ex Commands...........................................|netrw-ex|
458. Variables and Options.................................|netrw-variables|
469. Browsing..............................................|netrw-browse|
47 Introduction To Browsing............................|netrw-intro-browse|
48 Quick Reference: Maps...............................|netrw-browse-maps|
49 Quick Reference: Commands...........................|netrw-browse-cmds|
50 Bookmarking A Directory.............................|netrw-mb|
51 Browsing............................................|netrw-cr|
Bram Moolenaara6878372014-03-22 21:02:50 +010052 Squeezing the Current Tree-Listing Directory......|:netrw-s-cr|
Bram Moolenaarff034192013-04-24 18:51:19 +020053 Browsing With A Horizontally Split Window...........|netrw-o|
54 Browsing With A New Tab.............................|netrw-t|
55 Browsing With A Vertically Split Window.............|netrw-v|
56 Change Listing Style.(thin wide long tree)..........|netrw-i|
57 Changing To A Bookmarked Directory..................|netrw-gb|
58 Changing To A Predecessor Directory.................|netrw-u|
59 Changing To A Successor Directory...................|netrw-U|
60 Customizing Browsing With A User Function...........|netrw-x|
61 Deleting Bookmarks..................................|netrw-mB|
62 Deleting Files Or Directories.......................|netrw-D|
63 Directory Exploring Commands........................|netrw-explore|
64 Exploring With Stars and Patterns...................|netrw-star|
65 Displaying Information About File...................|netrw-qf|
66 Edit File Or Directory Hiding List..................|netrw-ctrl-h|
67 Editing The Sorting Sequence........................|netrw-S|
68 Forcing treatment as a file or directory............|netrw-gd| |netrw-gf|
69 Going Up............................................|netrw--|
70 Hiding Files Or Directories.........................|netrw-a|
71 Improving Browsing..................................|netrw-ssh-hack|
72 Listing Bookmarks And History.......................|netrw-qb|
73 Making A New Directory..............................|netrw-d|
74 Making The Browsing Directory The Current Directory.|netrw-c|
75 Marking Files.......................................|netrw-mf|
76 Unmarking Files.....................................|netrw-mF|
77 Marking Files By QuickFix List......................|netrw-qF|
78 Marking Files By Regular Expression.................|netrw-mr|
79 Marked Files: Arbitrary Command.....................|netrw-mx|
80 Marked Files: Compression And Decompression.........|netrw-mz|
81 Marked Files: Copying...............................|netrw-mc|
82 Marked Files: Diff..................................|netrw-md|
83 Marked Files: Editing...............................|netrw-me|
84 Marked Files: Grep..................................|netrw-mg|
85 Marked Files: Hiding and Unhiding by Suffix.........|netrw-mh|
86 Marked Files: Moving................................|netrw-mm|
87 Marked Files: Printing..............................|netrw-mp|
88 Marked Files: Sourcing..............................|netrw-ms|
89 Marked Files: Setting the Target Directory..........|netrw-mt|
90 Marked Files: Tagging...............................|netrw-mT|
91 Marked Files: Target Directory Using Bookmarks......|netrw-Tb|
92 Marked Files: Target Directory Using History........|netrw-Th|
93 Marked Files: Unmarking.............................|netrw-mu|
94 Netrw Browser Variables.............................|netrw-browser-var|
95 Netrw Browsing And Option Incompatibilities.........|netrw-incompatible|
96 Netrw Settings Window...............................|netrw-settings-window|
97 Obtaining A File....................................|netrw-O|
98 Preview Window......................................|netrw-p|
99 Previous Window.....................................|netrw-P|
100 Refreshing The Listing..............................|netrw-ctrl-l|
101 Reversing Sorting Order.............................|netrw-r|
102 Renaming Files Or Directories.......................|netrw-R|
103 Selecting Sorting Style.............................|netrw-s|
104 Setting Editing Window..............................|netrw-C|
10510. Problems and Fixes....................................|netrw-problems|
10611. Debugging Netrw Itself................................|netrw-debug|
10712. History...............................................|netrw-history|
10813. Todo..................................................|netrw-todo|
10914. Credits...............................................|netrw-credits|
Bram Moolenaar071d4272004-06-13 20:20:40 +0000110
Bram Moolenaar071d4272004-06-13 20:20:40 +0000111{Vi does not have any of this}
112
113==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00001142. Starting With Netrw *netrw-start* {{{1
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000115
Bram Moolenaar446cb832008-06-24 21:56:24 +0000116Netrw makes reading files, writing files, browsing over a network, and
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100117local browsing easy! First, make sure that you have plugins enabled, so
Bram Moolenaar446cb832008-06-24 21:56:24 +0000118you'll need to have at least the following in your <.vimrc>:
119(or see |netrw-activate|) >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000120
Bram Moolenaar9964e462007-05-05 17:54:07 +0000121 set nocp " 'compatible' is not set
122 filetype plugin on " plugins are enabled
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000123<
124(see |'cp'| and |:filetype-plugin-on|)
125
126Netrw supports "transparent" editing of files on other machines using urls
127(see |netrw-transparent|). As an example of this, let's assume you have an
Bram Moolenaar446cb832008-06-24 21:56:24 +0000128account on some other machine; if you can use scp, try: >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000129
130 vim scp://hostname/path/to/file
131<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000132Want to make ssh/scp easier to use? Check out |netrw-ssh-hack|!
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000133
Bram Moolenaar446cb832008-06-24 21:56:24 +0000134So, what if you have ftp, not ssh/scp? That's easy, too; try >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000135
136 vim ftp://hostname/path/to/file
137<
138Want to make ftp simpler to use? See if your ftp supports a file called
139<.netrc> -- typically it goes in your home directory, has read/write
140permissions for only the user to read (ie. not group, world, other, etc),
141and has lines resembling >
142
143 machine HOSTNAME login USERID password "PASSWORD"
144 machine HOSTNAME login USERID password "PASSWORD"
145 ...
Bram Moolenaar9964e462007-05-05 17:54:07 +0000146 default login USERID password "PASSWORD"
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000147<
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200148Windows' ftp doesn't support .netrc; however, one may have in one's .vimrc: >
149
Bram Moolenaare6ae6222013-05-21 21:01:10 +0200150 let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\MyUserName\MACHINE'
Bram Moolenaar97d62492012-11-15 21:28:22 +0100151<
Bram Moolenaare6ae6222013-05-21 21:01:10 +0200152Netrw will substitute the host's machine name for "MACHINE" from the url it is
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200153attempting to open, and so one may specify >
154 userid
155 password
Bram Moolenaare6ae6222013-05-21 21:01:10 +0200156for each site in a separate file: c:\Users\MyUserName\MachineName.
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200157
Bram Moolenaar446cb832008-06-24 21:56:24 +0000158Now about browsing -- when you just want to look around before editing a
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000159file. For browsing on your current host, just "edit" a directory: >
160
161 vim .
162 vim /home/userid/path
163<
164For browsing on a remote host, "edit" a directory (but make sure that
165the directory name is followed by a "/"): >
166
167 vim scp://hostname/
168 vim ftp://hostname/path/to/dir/
169<
170See |netrw-browse| for more!
171
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100172There are more protocols supported by netrw than just scp and ftp, too: see the
173next section, |netrw-externapp|, on how to use these external applications with
174netrw and vim.
175
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200176PREVENTING LOADING *netrw-noload*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000177
178If you want to use plugins, but for some reason don't wish to use netrw, then
179you need to avoid loading both the plugin and the autoload portions of netrw.
180You may do so by placing the following two lines in your <.vimrc>: >
181
182 :let g:loaded_netrw = 1
183 :let g:loaded_netrwPlugin = 1
184<
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +0000185
186==============================================================================
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001873. Netrw Reference *netrw-ref* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000188
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100189 Netrw supports several protocols in addition to scp and ftp as mentioned
Bram Moolenaar446cb832008-06-24 21:56:24 +0000190 in |netrw-start|. These include dav, fetch, http,... well, just look
191 at the list in |netrw-externapp|. Each protocol is associated with a
192 variable which holds the default command supporting that protocol.
193
194EXTERNAL APPLICATIONS AND PROTOCOLS *netrw-externapp* {{{2
Bram Moolenaar071d4272004-06-13 20:20:40 +0000195
Bram Moolenaar8d043172014-01-23 14:24:41 +0100196 Protocol Variable Default Value
197 -------- ---------------- -------------
198 dav: *g:netrw_dav_cmd* = "cadaver" if cadaver is executable
199 dav: g:netrw_dav_cmd = "curl -o" elseif curl is available
200 fetch: *g:netrw_fetch_cmd* = "fetch -o" if fetch is available
201 ftp: *g:netrw_ftp_cmd* = "ftp"
202 http: *g:netrw_http_cmd* = "elinks" if elinks is available
203 http: g:netrw_http_cmd = "links" elseif links is available
204 http: g:netrw_http_cmd = "curl" elseif curl is available
205 http: g:netrw_http_cmd = "wget" elseif wget is available
206 http: g:netrw_http_cmd = "fetch" elseif fetch is available
207 http: *g:netrw_http_put_cmd* = "curl -T"
208 rcp: *g:netrw_rcp_cmd* = "rcp"
209 rsync: *g:netrw_rsync_cmd* = "rsync -a"
210 scp: *g:netrw_scp_cmd* = "scp -q"
211 sftp: *g:netrw_sftp_cmd* = "sftp"
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100212
213 *g:netrw_http_xcmd* : the option string for http://... protocols are
214 specified via this variable and may be independently overridden. By
215 default, the option arguments for the http-handling commands are: >
216
217 elinks : "-source >"
Bram Moolenaar97d62492012-11-15 21:28:22 +0100218 links : "-dump >"
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100219 curl : "-o"
220 wget : "-q -O"
221 fetch : "-o"
222<
223 For example, if your system has elinks, and you'd rather see the
224 page using an attempt at rendering the text, you may wish to have >
225 let g:netrw_http_xcmd= "-dump >"
226< in your .vimrc.
227
Bram Moolenaar8d043172014-01-23 14:24:41 +0100228 g:netrw_http_put_cmd: this option specifies both the executable and
229 any needed options. This command does a PUT operation to the url.
230
Bram Moolenaar071d4272004-06-13 20:20:40 +0000231
Bram Moolenaar446cb832008-06-24 21:56:24 +0000232READING *netrw-read* *netrw-nread* {{{2
233
234 Generally, one may just use the url notation with a normal editing
235 command, such as >
236
237 :e ftp://[user@]machine/path
238<
239 Netrw also provides the Nread command:
240
Bram Moolenaar071d4272004-06-13 20:20:40 +0000241 :Nread ? give help
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000242 :Nread "machine:path" uses rcp
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000243 :Nread "machine path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000244 :Nread "machine id password path" uses ftp
245 :Nread "dav://machine[:port]/path" uses cadaver
246 :Nread "fetch://[user@]machine/path" uses fetch
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000247 :Nread "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000248 :Nread "http://[user@]machine/path" uses http uses wget
249 :Nread "rcp://[user@]machine/path" uses rcp
250 :Nread "rsync://[user@]machine[:port]/path" uses rsync
251 :Nread "scp://[user@]machine[[:#]port]/path" uses scp
252 :Nread "sftp://[user@]machine/path" uses sftp
Bram Moolenaar071d4272004-06-13 20:20:40 +0000253
Bram Moolenaar446cb832008-06-24 21:56:24 +0000254WRITING *netrw-write* *netrw-nwrite* {{{2
255
256 One may just use the url notation with a normal file writing
257 command, such as >
258
259 :w ftp://[user@]machine/path
260<
261 Netrw also provides the Nwrite command:
262
Bram Moolenaar433f7c82006-03-21 21:29:36 +0000263 :Nwrite ? give help
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000264 :Nwrite "machine:path" uses rcp
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000265 :Nwrite "machine path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000266 :Nwrite "machine id password path" uses ftp
267 :Nwrite "dav://machine[:port]/path" uses cadaver
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000268 :Nwrite "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc>
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000269 :Nwrite "rcp://[user@]machine/path" uses rcp
270 :Nwrite "rsync://[user@]machine[:port]/path" uses rsync
271 :Nwrite "scp://[user@]machine[[:#]port]/path" uses scp
272 :Nwrite "sftp://[user@]machine/path" uses sftp
Bram Moolenaar071d4272004-06-13 20:20:40 +0000273 http: not supported!
274
Bram Moolenaar446cb832008-06-24 21:56:24 +0000275SOURCING *netrw-source* {{{2
276
277 One may just use the url notation with the normal file sourcing
278 command, such as >
279
280 :so ftp://[user@]machine/path
281<
282 Netrw also provides the Nsource command:
283
Bram Moolenaar9964e462007-05-05 17:54:07 +0000284 :Nsource ? give help
285 :Nsource "dav://machine[:port]/path" uses cadaver
286 :Nsource "fetch://[user@]machine/path" uses fetch
287 :Nsource "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc>
288 :Nsource "http://[user@]machine/path" uses http uses wget
289 :Nsource "rcp://[user@]machine/path" uses rcp
290 :Nsource "rsync://[user@]machine[:port]/path" uses rsync
291 :Nsource "scp://[user@]machine[[:#]port]/path" uses scp
292 :Nsource "sftp://[user@]machine/path" uses sftp
293
Bram Moolenaarff034192013-04-24 18:51:19 +0200294DIRECTORY LISTING *netrw-trailingslash* *netrw-dirlist* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +0000295
296 One may browse a directory to get a listing by simply attempting to
297 edit the directory: >
298
299 :e scp://[user]@hostname/path/
300 :e ftp://[user]@hostname/path/
301<
Bram Moolenaar251e1912011-06-19 05:09:16 +0200302 For remote directory listings (ie. those using scp or ftp), that
303 trailing "/" is necessary (the slash tells netrw to treat the argument
304 as a directory to browse instead of as a file to download).
Bram Moolenaar446cb832008-06-24 21:56:24 +0000305
Bram Moolenaar251e1912011-06-19 05:09:16 +0200306 The Nread command may also be used to accomplish this (again, that
307 trailing slash is necessary): >
Bram Moolenaar446cb832008-06-24 21:56:24 +0000308
Bram Moolenaar251e1912011-06-19 05:09:16 +0200309 :Nread [protocol]://[user]@hostname/path/
310<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000311 *netrw-login* *netrw-password*
312CHANGING USERID AND PASSWORD *netrw-chgup* *netrw-userpass* {{{2
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000313
Bram Moolenaar071d4272004-06-13 20:20:40 +0000314 Attempts to use ftp will prompt you for a user-id and a password.
Bram Moolenaar15146672011-10-20 22:22:38 +0200315 These will be saved in global variables |g:netrw_uid| and
316 |s:netrw_passwd|; subsequent use of ftp will re-use those two strings,
317 thereby simplifying use of ftp. However, if you need to use a
318 different user id and/or password, you'll want to call |NetUserPass()|
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000319 first. To work around the need to enter passwords, check if your ftp
320 supports a <.netrc> file in your home directory. Also see
321 |netrw-passwd| (and if you're using ssh/scp hoping to figure out how
Bram Moolenaar15146672011-10-20 22:22:38 +0200322 to not need to use passwords for scp, look at |netrw-ssh-hack|).
Bram Moolenaar071d4272004-06-13 20:20:40 +0000323
324 :NetUserPass [uid [password]] -- prompts as needed
325 :call NetUserPass() -- prompts for uid and password
326 :call NetUserPass("uid") -- prompts for password
327 :call NetUserPass("uid","password") -- sets global uid and password
328
Bram Moolenaare6ae6222013-05-21 21:01:10 +0200329(Related topics: |ftp| |netrw-userpass| |netrw-start|)
330
Bram Moolenaar446cb832008-06-24 21:56:24 +0000331NETRW VARIABLES AND SETTINGS *netrw-variables* {{{2
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200332 (Also see:
333 |netrw-browser-var| : netrw browser option variables
334 |netrw-protocol| : file transfer protocol option variables
335 |netrw-settings| : additional file transfer options
336 |netrw-browser-options| : these options affect browsing directories
337 )
Bram Moolenaar9964e462007-05-05 17:54:07 +0000338
Bram Moolenaar446cb832008-06-24 21:56:24 +0000339Netrw provides a lot of variables which allow you to customize netrw to your
340preferences. One way to look at them is via the command :NetrwSettings (see
341|netrw-settings|) which will display your current netrw settings. Most such
342settings are described below, in |netrw-browser-options|, and in
343|netrw-externapp|:
Bram Moolenaar9964e462007-05-05 17:54:07 +0000344
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100345 *b:netrw_lastfile* last file Network-read/written retained on a
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200346 per-buffer basis (supports plain :Nw )
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100347
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200348 *g:netrw_bufsettings* the settings that netrw buffers have
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200349 (default) noma nomod nonu nowrap ro nobl
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200350
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100351 *g:netrw_chgwin* specifies a window number where file edits will take
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200352 place. (also see |netrw-C|)
353 (default) not defined
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100354
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200355 *g:Netrw_funcref* specifies a function (or functions) to be called when
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200356 netrw edits a file. The file is first edited, and
357 then the function reference (|Funcref|) is called.
358 This variable may also hold a |List| of Funcrefs.
359 (default) not defined. (the capital in g:Netrw...
360 is required by its holding a function reference)
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200361>
362 Example: place in .vimrc; affects all file opening
363 fun! MyFuncRef()
364 endfun
365 let g:Netrw_funcref= function("MyFuncRef")
366<
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200367 *g:netrw_ftp* if it doesn't exist, use default ftp
368 =0 use default ftp (uid password)
369 =1 use alternate ftp method (user uid password)
370 If you're having trouble with ftp, try changing the
371 value of this variable to see if the alternate ftp
372 method works for your setup.
373
374 *g:netrw_ftp_options* Chosen by default, these options are supposed to turn
375 interactive prompting off and to restrain ftp from
376 attempting auto-login upon initial connection.
377 However, it appears that not all ftp implementations
378 support this (ex. ncftp).
379 ="-i -n"
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000380
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100381 *g:netrw_ftpextracmd* default: doesn't exist
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200382 If this variable exists, then any string it contains
383 will be placed into the commands set to your ftp
384 client. As an example:
385 ="passive"
Bram Moolenaar9964e462007-05-05 17:54:07 +0000386
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000387 *g:netrw_ftpmode* ="binary" (default)
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200388 ="ascii"
Bram Moolenaarf6cf9872005-08-08 22:00:59 +0000389
Bram Moolenaar9964e462007-05-05 17:54:07 +0000390 *g:netrw_ignorenetrc* =0 (default for linux, cygwin)
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200391 =1 If you have a <.netrc> file but it doesn't work and
392 you want it ignored, then set this variable as
393 shown. (default for Windows + cmd.exe)
Bram Moolenaar9964e462007-05-05 17:54:07 +0000394
395 *g:netrw_menu* =0 disable netrw's menu
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200396 =1 (default) netrw's menu enabled
Bram Moolenaar9964e462007-05-05 17:54:07 +0000397
398 *g:netrw_nogx* if this variable exists, then the "gx" map will not
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200399 be available (see |netrw-gx|)
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000400
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100401 *g:netrw_uid* (ftp) user-id, retained on a per-vim-session basis
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200402 *s:netrw_passwd* (ftp) password, retained on a per-vim-session basis
Bram Moolenaar446cb832008-06-24 21:56:24 +0000403
404 *g:netrw_preview* =0 (default) preview window shown in a horizontally
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200405 split window
406 =1 preview window shown in a vertically split window.
407 Also affects the "previous window" (see |netrw-P|) in
408 the same way.
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000409
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200410 *g:netrw_scpport* = "-P" : option to use to set port for scp
411 *g:netrw_sshport* = "-p" : option to use to set port for ssh
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000412
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200413 *g:netrw_sepchr* =\0xff
414 =\0x01 for enc == euc-jp (and perhaps it should be for
415 others, too, please let me know)
416 Separates priority codes from filenames internally.
417 See |netrw-p12|.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100418
Bram Moolenaar446cb832008-06-24 21:56:24 +0000419 *g:netrw_silent* =0 : transfers done normally
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200420 =1 : transfers done silently
Bram Moolenaar446cb832008-06-24 21:56:24 +0000421
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000422 *g:netrw_use_errorwindow* =1 : messages from netrw will use a separate one
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200423 line window. This window provides reliable
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200424 delivery of messages. (default)
425 =0 : messages from netrw will use echoerr ;
426 messages don't always seem to show up this
427 way, but one doesn't have to quit the window.
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +0000428
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000429 *g:netrw_win95ftp* =1 if using Win95, will remove four trailing blank
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200430 lines that o/s's ftp "provides" on transfers
431 =0 force normal ftp behavior (no trailing line removal)
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000432
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200433 *g:netrw_cygwin* =1 assume scp under windows is from cygwin. Also
434 permits network browsing to use ls with time and
435 size sorting (default if windows)
436 =0 assume Windows' scp accepts windows-style paths
437 Network browsing uses dir instead of ls
438 This option is ignored if you're using unix
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000439
440 *g:netrw_use_nt_rcp* =0 don't use the rcp of WinNT, Win2000 and WinXP
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200441 =1 use WinNT's rcp in binary mode (default)
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000442
Bram Moolenaar446cb832008-06-24 21:56:24 +0000443PATHS *netrw-path* {{{2
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000444
445Paths to files are generally user-directory relative for most protocols.
446It is possible that some protocol will make paths relative to some
447associated directory, however.
448>
449 example: vim scp://user@host/somefile
450 example: vim scp://user@host/subdir1/subdir2/somefile
451<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000452where "somefile" is in the "user"'s home directory. If you wish to get a
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000453file using root-relative paths, use the full path:
454>
455 example: vim scp://user@host//somefile
456 example: vim scp://user@host//subdir1/subdir2/somefile
457<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000458
459==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00004604. Network-Oriented File Transfer *netrw-xfer* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000461
462Network-oriented file transfer under Vim is implemented by a VimL-based script
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000463(<netrw.vim>) using plugin techniques. It currently supports both reading and
464writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch,
Bram Moolenaar071d4272004-06-13 20:20:40 +0000465dav/cadaver, rsync, or sftp.
466
467http is currently supported read-only via use of wget or fetch.
468
469<netrw.vim> is a standard plugin which acts as glue between Vim and the
470various file transfer programs. It uses autocommand events (BufReadCmd,
471FileReadCmd, BufWriteCmd) to intercept reads/writes with url-like filenames. >
472
473 ex. vim ftp://hostname/path/to/file
474<
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000475The characters preceding the colon specify the protocol to use; in the
Bram Moolenaar446cb832008-06-24 21:56:24 +0000476example, it's ftp. The <netrw.vim> script then formulates a command or a
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000477series of commands (typically ftp) which it issues to an external program
478(ftp, scp, etc) which does the actual file transfer/protocol. Files are read
479from/written to a temporary file (under Unix/Linux, /tmp/...) which the
480<netrw.vim> script will clean up.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000481
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100482Now, a word about Jan Minář's "FTP User Name and Password Disclosure"; first,
483ftp is not a secure protocol. User names and passwords are transmitted "in
484the clear" over the internet; any snooper tool can pick these up; this is not
485a netrw thing, this is a ftp thing. If you're concerned about this, please
486try to use scp or sftp instead.
487
488Netrw re-uses the user id and password during the same vim session and so long
489as the remote hostname remains the same.
490
491Jan seems to be a bit confused about how netrw handles ftp; normally multiple
492commands are performed in a "ftp session", and he seems to feel that the
493uid/password should only be retained over one ftp session. However, netrw
494does every ftp operation in a separate "ftp session"; so remembering the
495uid/password for just one "ftp session" would be the same as not remembering
496the uid/password at all. IMHO this would rapidly grow tiresome as one
497browsed remote directories, for example.
498
499On the other hand, thanks go to Jan M. for pointing out the many
500vulnerabilities that netrw (and vim itself) had had in handling "crafted"
501filenames. The |shellescape()| and |fnameescape()| functions were written in
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200502response by Bram Moolenaar to handle these sort of problems, and netrw has
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100503been modified to use them. Still, my advice is, if the "filename" looks like
504a vim command that you aren't comfortable with having executed, don't open it.
505
Bram Moolenaar9964e462007-05-05 17:54:07 +0000506 *netrw-putty* *netrw-pscp* *netrw-psftp*
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000507One may modify any protocol's implementing external application by setting a
508variable (ex. scp uses the variable g:netrw_scp_cmd, which is defaulted to
Bram Moolenaar433f7c82006-03-21 21:29:36 +0000509"scp -q"). As an example, consider using PuTTY: >
Bram Moolenaar9964e462007-05-05 17:54:07 +0000510
511 let g:netrw_scp_cmd = '"c:\Program Files\PuTTY\pscp.exe" -q -batch'
512 let g:netrw_sftp_cmd= '"c:\Program Files\PuTTY\psftp.exe"'
Bram Moolenaar433f7c82006-03-21 21:29:36 +0000513<
Bram Moolenaar15146672011-10-20 22:22:38 +0200514(note: it has been reported that windows 7 with putty v0.6's "-batch" option
515 doesn't work, so its best to leave it off for that system)
516
Bram Moolenaar9964e462007-05-05 17:54:07 +0000517See |netrw-p8| for more about putty, pscp, psftp, etc.
518
Bram Moolenaar071d4272004-06-13 20:20:40 +0000519Ftp, an old protocol, seems to be blessed by numerous implementations.
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000520Unfortunately, some implementations are noisy (ie., add junk to the end of the
521file). Thus, concerned users may decide to write a NetReadFixup() function
522that will clean up after reading with their ftp. Some Unix systems (ie.,
523FreeBSD) provide a utility called "fetch" which uses the ftp protocol but is
524not noisy and more convenient, actually, for <netrw.vim> to use.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100525Consequently, if "fetch" is available (ie. executable), it may be preferable
526to use it for ftp://... based transfers.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000527
528For rcp, scp, sftp, and http, one may use network-oriented file transfers
Bram Moolenaar83bab712005-08-01 21:58:57 +0000529transparently; ie.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000530>
531 vim rcp://[user@]machine/path
532 vim scp://[user@]machine/path
533<
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100534If your ftp supports <.netrc>, then it too can be transparently used
Bram Moolenaar071d4272004-06-13 20:20:40 +0000535if the needed triad of machine name, user id, and password are present in
536that file. Your ftp must be able to use the <.netrc> file on its own, however.
537>
538 vim ftp://[user@]machine[[:#]portnumber]/path
539<
Bram Moolenaaradc21822011-04-01 18:03:16 +0200540Windows provides an ftp (typically c:\Windows\System32\ftp.exe) which uses
541an option, -s:filename (filename can and probably should be a full path)
542which contains ftp commands which will be automatically run whenever ftp
543starts. You may use this feature to enter a user and password for one site: >
544 userid
545 password
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200546< *netrw-windows-netrc* *netrw-windows-s*
Bram Moolenaaradc21822011-04-01 18:03:16 +0200547If |g:netrw_ftp_cmd| contains -s:[path/]MACHINE, then (on Windows machines only)
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200548netrw will substitute the current machine name requested for ftp connections
Bram Moolenaaradc21822011-04-01 18:03:16 +0200549for MACHINE. Hence one can have multiple machine.ftp files containing login
550and password for ftp. Example: >
551
Bram Moolenaarff034192013-04-24 18:51:19 +0200552 let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\Myself\MACHINE'
553 vim ftp://myhost.somewhere.net/
Bram Moolenaaradc21822011-04-01 18:03:16 +0200554will use a file >
555 C:\Users\Myself\myhost.ftp
556<
557Often, ftp will need to query the user for the userid and password.
Bram Moolenaar83bab712005-08-01 21:58:57 +0000558The latter will be done "silently"; ie. asterisks will show up instead of
Bram Moolenaar071d4272004-06-13 20:20:40 +0000559the actually-typed-in password. Netrw will retain the userid and password
560for subsequent read/writes from the most recent transfer so subsequent
561transfers (read/write) to or from that machine will take place without
562additional prompting.
563
564 *netrw-urls*
565 +=================================+============================+============+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000566 | Reading | Writing | Uses |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000567 +=================================+============================+============+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000568 | DAV: | | |
569 | dav://host/path | | cadaver |
570 | :Nread dav://host/path | :Nwrite dav://host/path | cadaver |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000571 +---------------------------------+----------------------------+------------+
Bram Moolenaar446cb832008-06-24 21:56:24 +0000572 | DAV + SSL: | | |
573 | davs://host/path | | cadaver |
574 | :Nread davs://host/path | :Nwrite davs://host/path | cadaver |
575 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000576 | FETCH: | | |
577 | fetch://[user@]host/path | | |
578 | fetch://[user@]host:http/path | Not Available | fetch |
579 | :Nread fetch://[user@]host/path| | |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000580 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000581 | FILE: | | |
582 | file:///* | file:///* | |
583 | file://localhost/* | file://localhost/* | |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000584 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000585 | FTP: (*3) | (*3) | |
586 | ftp://[user@]host/path | ftp://[user@]host/path | ftp (*2) |
587 | :Nread ftp://host/path | :Nwrite ftp://host/path | ftp+.netrc |
588 | :Nread host path | :Nwrite host path | ftp+.netrc |
589 | :Nread host uid pass path | :Nwrite host uid pass path | ftp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000590 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000591 | HTTP: wget is executable: (*4) | | |
592 | http://[user@]host/path | Not Available | wget |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000593 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000594 | HTTP: fetch is executable (*4) | | |
595 | http://[user@]host/path | Not Available | fetch |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000596 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000597 | RCP: | | |
598 | rcp://[user@]host/path | rcp://[user@]host/path | rcp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000599 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000600 | RSYNC: | | |
601 | rsync://[user@]host/path | rsync://[user@]host/path | rsync |
602 | :Nread rsync://host/path | :Nwrite rsync://host/path | rsync |
603 | :Nread rcp://host/path | :Nwrite rcp://host/path | rcp |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000604 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000605 | SCP: | | |
606 | scp://[user@]host/path | scp://[user@]host/path | scp |
607 | :Nread scp://host/path | :Nwrite scp://host/path | scp (*1) |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000608 +---------------------------------+----------------------------+------------+
Bram Moolenaar9964e462007-05-05 17:54:07 +0000609 | SFTP: | | |
610 | sftp://[user@]host/path | sftp://[user@]host/path | sftp |
611 | :Nread sftp://host/path | :Nwrite sftp://host/path | sftp (*1) |
Bram Moolenaar071d4272004-06-13 20:20:40 +0000612 +=================================+============================+============+
613
614 (*1) For an absolute path use scp://machine//path.
615
616 (*2) if <.netrc> is present, it is assumed that it will
617 work with your ftp client. Otherwise the script will
Bram Moolenaar9964e462007-05-05 17:54:07 +0000618 prompt for user-id and password.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000619
Bram Moolenaar9964e462007-05-05 17:54:07 +0000620 (*3) for ftp, "machine" may be machine#port or machine:port
Bram Moolenaar071d4272004-06-13 20:20:40 +0000621 if a different port is needed than the standard ftp port
622
623 (*4) for http:..., if wget is available it will be used. Otherwise,
624 if fetch is available it will be used.
625
626Both the :Nread and the :Nwrite ex-commands can accept multiple filenames.
627
628
629NETRC *netrw-netrc*
630
Bram Moolenaar446cb832008-06-24 21:56:24 +0000631The <.netrc> file, typically located in your home directory, contains lines
632therein which map a hostname (machine name) to the user id and password you
633prefer to use with it.
634
Bram Moolenaar071d4272004-06-13 20:20:40 +0000635The typical syntax for lines in a <.netrc> file is given as shown below.
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000636Ftp under Unix usually supports <.netrc>; ftp under Windows usually doesn't.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000637>
638 machine {full machine name} login {user-id} password "{password}"
639 default login {user-id} password "{password}"
640
641Your ftp client must handle the use of <.netrc> on its own, but if the
642<.netrc> file exists, an ftp transfer will not ask for the user-id or
643password.
644
645 Note:
646 Since this file contains passwords, make very sure nobody else can
647 read this file! Most programs will refuse to use a .netrc that is
648 readable for others. Don't forget that the system administrator can
Bram Moolenaar446cb832008-06-24 21:56:24 +0000649 still read the file! Ie. for Linux/Unix: chmod 600 .netrc
Bram Moolenaar071d4272004-06-13 20:20:40 +0000650
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200651Even though Windows' ftp clients typically do not support .netrc, netrw has
652a work-around: see |netrw-windows-s|.
653
Bram Moolenaar071d4272004-06-13 20:20:40 +0000654
655PASSWORD *netrw-passwd*
656
657The script attempts to get passwords for ftp invisibly using |inputsecret()|,
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200658a built-in Vim function. See |netrw-userpass| for how to change the password
Bram Moolenaar071d4272004-06-13 20:20:40 +0000659after one has set it.
660
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000661Unfortunately there doesn't appear to be a way for netrw to feed a password to
662scp. Thus every transfer via scp will require re-entry of the password.
Bram Moolenaar446cb832008-06-24 21:56:24 +0000663However, |netrw-ssh-hack| can help with this problem.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000664
665
666==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00006675. Activation *netrw-activate* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000668
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000669Network-oriented file transfers are available by default whenever Vim's
Bram Moolenaar446cb832008-06-24 21:56:24 +0000670|'nocompatible'| mode is enabled. Netrw's script files reside in your
671system's plugin, autoload, and syntax directories; just the
672plugin/netrwPlugin.vim script is sourced automatically whenever you bring up
673vim. The main script in autoload/netrw.vim is only loaded when you actually
674use netrw. I suggest that, at a minimum, you have at least the following in
675your <.vimrc> customization file: >
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000676
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000677 set nocp
678 if version >= 600
679 filetype plugin indent on
680 endif
681<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000682
683==============================================================================
Bram Moolenaaradc21822011-04-01 18:03:16 +02006846. Transparent Remote File Editing *netrw-transparent* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000685
686Transparent file transfers occur whenever a regular file read or write
Bram Moolenaar446cb832008-06-24 21:56:24 +0000687(invoked via an |:autocmd| for |BufReadCmd|, |BufWriteCmd|, or |SourceCmd|
688events) is made. Thus one may read, write, or source files across networks
689just as easily as if they were local files! >
Bram Moolenaar071d4272004-06-13 20:20:40 +0000690
691 vim ftp://[user@]machine/path
692 ...
693 :wq
694
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000695See |netrw-activate| for more on how to encourage your vim to use plugins
696such as netrw.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000697
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000698
Bram Moolenaar071d4272004-06-13 20:20:40 +0000699==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00007007. Ex Commands *netrw-ex* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +0000701
Bram Moolenaarc01140a2006-03-24 22:21:52 +0000702The usual read/write commands are supported. There are also a few
Bram Moolenaar446cb832008-06-24 21:56:24 +0000703additional commands available. Often you won't need to use Nwrite or
Bram Moolenaar9964e462007-05-05 17:54:07 +0000704Nread as shown in |netrw-transparent| (ie. simply use >
705 :e url
706 :r url
707 :w url
708instead, as appropriate) -- see |netrw-urls|. In the explanations
709below, a {netfile} is an url to a remote file.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000710
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200711 *:Nwrite* *:Nw*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000712:[range]Nw[rite] Write the specified lines to the current
Bram Moolenaar071d4272004-06-13 20:20:40 +0000713 file as specified in b:netrw_lastfile.
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200714 (related: |netrw-nwrite|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000715
Bram Moolenaar446cb832008-06-24 21:56:24 +0000716:[range]Nw[rite] {netfile} [{netfile}]...
Bram Moolenaar071d4272004-06-13 20:20:40 +0000717 Write the specified lines to the {netfile}.
718
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200719 *:Nread* *:Nr*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100720:Nr[ead] Read the lines from the file specified in b:netrw_lastfile
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200721 into the current buffer. (related: |netrw-nread|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000722
Bram Moolenaar446cb832008-06-24 21:56:24 +0000723:Nr[ead] {netfile} {netfile}...
Bram Moolenaar071d4272004-06-13 20:20:40 +0000724 Read the {netfile} after the current line.
725
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200726 *:Nsource* *:Ns*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000727:Ns[ource] {netfile}
Bram Moolenaar9964e462007-05-05 17:54:07 +0000728 Source the {netfile}.
729 To start up vim using a remote .vimrc, one may use
730 the following (all on one line) (tnx to Antoine Mechelynck) >
731 vim -u NORC -N
732 --cmd "runtime plugin/netrwPlugin.vim"
733 --cmd "source scp://HOSTNAME/.vimrc"
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200734< (related: |netrw-source|)
735
736:call NetUserPass() *NetUserPass()*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000737 If g:netrw_uid and s:netrw_passwd don't exist,
738 this function will query the user for them.
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200739 (related: |netrw-userpass|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000740
741:call NetUserPass("userid")
Bram Moolenaar446cb832008-06-24 21:56:24 +0000742 This call will set the g:netrw_uid and, if
Bram Moolenaar071d4272004-06-13 20:20:40 +0000743 the password doesn't exist, will query the user for it.
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200744 (related: |netrw-userpass|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000745
746:call NetUserPass("userid","passwd")
Bram Moolenaar446cb832008-06-24 21:56:24 +0000747 This call will set both the g:netrw_uid and s:netrw_passwd.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000748 The user-id and password are used by ftp transfers. One may
Bram Moolenaar446cb832008-06-24 21:56:24 +0000749 effectively remove the user-id and password by using empty
750 strings (ie. "").
Bram Moolenaar00a927d2010-05-14 23:24:24 +0200751 (related: |netrw-userpass|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000752
Bram Moolenaar9964e462007-05-05 17:54:07 +0000753:NetrwSettings This command is described in |netrw-settings| -- used to
754 display netrw settings and change netrw behavior.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +0000755
Bram Moolenaar071d4272004-06-13 20:20:40 +0000756
757==============================================================================
Bram Moolenaar5b435d62012-04-05 17:33:26 +02007588. Variables and Options *netrw-var* *netrw-settings* {{{1
Bram Moolenaar446cb832008-06-24 21:56:24 +0000759
Bram Moolenaar15146672011-10-20 22:22:38 +0200760(also see: |netrw-options| |netrw-variables| |netrw-protocol|
Bram Moolenaar5b435d62012-04-05 17:33:26 +0200761 |netrw-browser-settings| |netrw-browser-options| )
Bram Moolenaar071d4272004-06-13 20:20:40 +0000762
Bram Moolenaar9964e462007-05-05 17:54:07 +0000763The <netrw.vim> script provides several variables which act as options to
Bram Moolenaar446cb832008-06-24 21:56:24 +0000764affect <netrw.vim>'s file transfer behavior. These variables typically may be
765set in the user's <.vimrc> file: (see also |netrw-settings| |netrw-protocol|)
Bram Moolenaar15146672011-10-20 22:22:38 +0200766 *netrw-options*
Bram Moolenaar446cb832008-06-24 21:56:24 +0000767>
Bram Moolenaar9964e462007-05-05 17:54:07 +0000768 -------------
769 Netrw Options
770 -------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000771 Option Meaning
772 -------------- -----------------------------------------------
773<
Bram Moolenaar9964e462007-05-05 17:54:07 +0000774 b:netrw_col Holds current cursor position (during NetWrite)
775 g:netrw_cygwin =1 assume scp under windows is from cygwin
776 (default/windows)
777 =0 assume scp under windows accepts windows
778 style paths (default/else)
779 g:netrw_ftp =0 use default ftp (uid password)
780 g:netrw_ftpmode ="binary" (default)
781 ="ascii" (your choice)
782 g:netrw_ignorenetrc =1 (default)
783 if you have a <.netrc> file but you don't
Bram Moolenaar071d4272004-06-13 20:20:40 +0000784 want it used, then set this variable. Its
785 mere existence is enough to cause <.netrc>
786 to be ignored.
Bram Moolenaar9964e462007-05-05 17:54:07 +0000787 b:netrw_lastfile Holds latest method/machine/path.
788 b:netrw_line Holds current line number (during NetWrite)
Bram Moolenaar9964e462007-05-05 17:54:07 +0000789 g:netrw_silent =0 transfers done normally
790 =1 transfers done silently
791 g:netrw_uid Holds current user-id for ftp.
Bram Moolenaar9964e462007-05-05 17:54:07 +0000792 g:netrw_use_nt_rcp =0 don't use WinNT/2K/XP's rcp (default)
793 =1 use WinNT/2K/XP's rcp, binary mode
794 g:netrw_win95ftp =0 use unix-style ftp even if win95/98/ME/etc
795 =1 use default method to do ftp >
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000796 -----------------------------------------------------------------------
797<
Bram Moolenaar15146672011-10-20 22:22:38 +0200798 *netrw-internal-variables*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000799The script will also make use of the following variables internally, albeit
800temporarily.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000801>
802 -------------------
803 Temporary Variables
804 -------------------
805 Variable Meaning
806 -------- ------------------------------------
807<
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100808 b:netrw_method Index indicating rcp/ftp+.netrc/ftp
809 w:netrw_method (same as b:netrw_method)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000810 g:netrw_machine Holds machine name parsed from input
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100811 b:netrw_fname Holds filename being accessed >
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000812 ------------------------------------------------------------
813<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000814 *netrw-protocol*
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000815
816Netrw supports a number of protocols. These protocols are invoked using the
817variables listed below, and may be modified by the user.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000818>
819 ------------------------
Bram Moolenaar9964e462007-05-05 17:54:07 +0000820 Protocol Control Options
Bram Moolenaar071d4272004-06-13 20:20:40 +0000821 ------------------------
Bram Moolenaar9964e462007-05-05 17:54:07 +0000822 Option Type Setting Meaning
823 --------- -------- -------------- ---------------------------
Bram Moolenaar8d043172014-01-23 14:24:41 +0100824< netrw_ftp variable =doesn't exist userid set by "user userid"
Bram Moolenaar9964e462007-05-05 17:54:07 +0000825 =0 userid set by "user userid"
826 =1 userid set by "userid"
827 NetReadFixup function =doesn't exist no change
828 =exists Allows user to have files
829 read via ftp automatically
830 transformed however they wish
831 by NetReadFixup()
Bram Moolenaar8d043172014-01-23 14:24:41 +0100832 g:netrw_dav_cmd var ="cadaver" if cadaver is executable
833 g:netrw_dav_cmd var ="curl -o" elseif curl is executable
834 g:netrw_fetch_cmd var ="fetch -o" if fetch is available
835 g:netrw_ftp_cmd var ="ftp"
836 g:netrw_http_cmd var ="fetch -o" if fetch is available
837 g:netrw_http_cmd var ="wget -O" else if wget is available
838 g:netrw_http_put_cmd var ="curl -T"
839 g:netrw_list_cmd var ="ssh USEPORT HOSTNAME ls -Fa"
840 g:netrw_rcp_cmd var ="rcp"
841 g:netrw_rsync_cmd var ="rsync -a"
842 g:netrw_scp_cmd var ="scp -q"
843 g:netrw_sftp_cmd var ="sftp" >
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000844 -------------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000845<
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000846 *netrw-ftp*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000847
Bram Moolenaar9964e462007-05-05 17:54:07 +0000848The g:netrw_..._cmd options (|g:netrw_ftp_cmd| and |g:netrw_sftp_cmd|)
849specify the external program to use handle the ftp protocol. They may
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200850include command line options (such as -p for passive mode). Example: >
Bram Moolenaar071d4272004-06-13 20:20:40 +0000851
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +0200852 let g:netrw_ftp_cmd= "ftp -p"
853<
Bram Moolenaar9964e462007-05-05 17:54:07 +0000854Browsing is supported by using the |g:netrw_list_cmd|; the substring
855"HOSTNAME" will be changed via substitution with whatever the current request
856is for a hostname.
857
858Two options (|g:netrw_ftp| and |netrw-fixup|) both help with certain ftp's
859that give trouble . In order to best understand how to use these options if
860ftp is giving you troubles, a bit of discussion is provided on how netrw does
861ftp reads.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000862
863For ftp, netrw typically builds up lines of one of the following formats in a
Bram Moolenaar071d4272004-06-13 20:20:40 +0000864temporary file:
865>
866 IF g:netrw_ftp !exists or is not 1 IF g:netrw_ftp exists and is 1
867 ---------------------------------- ------------------------------
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000868<
Bram Moolenaar9964e462007-05-05 17:54:07 +0000869 open machine [port] open machine [port]
870 user userid password userid password
871 [g:netrw_ftpmode] password
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200872 [g:netrw_ftpextracmd] [g:netrw_ftpmode]
Bram Moolenaar9964e462007-05-05 17:54:07 +0000873 get filename tempfile [g:netrw_extracmd]
874 get filename tempfile >
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000875 ---------------------------------------------------------------------
Bram Moolenaar071d4272004-06-13 20:20:40 +0000876<
Bram Moolenaar8ada2cc2010-07-29 20:43:36 +0200877The |g:netrw_ftpmode| and |g:netrw_ftpextracmd| are optional.
Bram Moolenaar9964e462007-05-05 17:54:07 +0000878
Bram Moolenaar071d4272004-06-13 20:20:40 +0000879Netrw then executes the lines above by use of a filter:
880>
881 :%! {g:netrw_ftp_cmd} -i [-n]
882<
Bram Moolenaar071d4272004-06-13 20:20:40 +0000883where
884 g:netrw_ftp_cmd is usually "ftp",
885 -i tells ftp not to be interactive
886 -n means don't use netrc and is used for Method #3 (ftp w/o <.netrc>)
887
888If <.netrc> exists it will be used to avoid having to query the user for
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000889userid and password. The transferred file is put into a temporary file.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000890The temporary file is then read into the main editing session window that
891requested it and the temporary file deleted.
892
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000893If your ftp doesn't accept the "user" command and immediately just demands a
894userid, then try putting "let netrw_ftp=1" in your <.vimrc>.
Bram Moolenaar071d4272004-06-13 20:20:40 +0000895
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +0000896 *netrw-cadaver*
897To handle the SSL certificate dialog for untrusted servers, one may pull
898down the certificate and place it into /usr/ssl/cert.pem. This operation
899renders the server treatment as "trusted".
900
Bram Moolenaar433f7c82006-03-21 21:29:36 +0000901 *netrw-fixup* *netreadfixup*
Bram Moolenaar071d4272004-06-13 20:20:40 +0000902If your ftp for whatever reason generates unwanted lines (such as AUTH
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100903messages) you may write a NetReadFixup() function:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000904>
905 function! NetReadFixup(method,line1,line2)
906 " a:line1: first new line in current file
907 " a:line2: last new line in current file
908 if a:method == 1 "rcp
909 elseif a:method == 2 "ftp + <.netrc>
910 elseif a:method == 3 "ftp + machine,uid,password,filename
911 elseif a:method == 4 "scp
912 elseif a:method == 5 "http/wget
913 elseif a:method == 6 "dav/cadaver
914 elseif a:method == 7 "rsync
915 elseif a:method == 8 "fetch
916 elseif a:method == 9 "sftp
Bram Moolenaar9964e462007-05-05 17:54:07 +0000917 else " complain
Bram Moolenaar071d4272004-06-13 20:20:40 +0000918 endif
919 endfunction
920>
Bram Moolenaar1afcace2005-11-25 19:54:28 +0000921The NetReadFixup() function will be called if it exists and thus allows you to
922customize your reading process. As a further example, <netrw.vim> contains
923just such a function to handle Windows 95 ftp. For whatever reason, Windows
92495's ftp dumps four blank lines at the end of a transfer, and so it is
925desirable to automate their removal. Here's some code taken from <netrw.vim>
926itself:
Bram Moolenaar071d4272004-06-13 20:20:40 +0000927>
928 if has("win95") && g:netrw_win95ftp
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000929 fun! NetReadFixup(method, line1, line2)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000930 if method == 3 " ftp (no <.netrc>)
Bram Moolenaar9964e462007-05-05 17:54:07 +0000931 let fourblanklines= line2 - 3
932 silent fourblanklines.",".line2."g/^\s*/d"
Bram Moolenaar071d4272004-06-13 20:20:40 +0000933 endif
934 endfunction
935 endif
936>
Bram Moolenaare6ae6222013-05-21 21:01:10 +0200937(Related topics: |ftp| |netrw-userpass| |netrw-start|)
Bram Moolenaar071d4272004-06-13 20:20:40 +0000938
939==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00009409. Browsing *netrw-browsing* *netrw-browse* *netrw-help* {{{1
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100941 *netrw-browser* *netrw-dir* *netrw-list*
Bram Moolenaar83bab712005-08-01 21:58:57 +0000942
Bram Moolenaar446cb832008-06-24 21:56:24 +0000943INTRODUCTION TO BROWSING *netrw-intro-browse* {{{2
944 (Quick References: |netrw-quickmaps| |netrw-quickcoms|)
Bram Moolenaar83bab712005-08-01 21:58:57 +0000945
Bram Moolenaar446cb832008-06-24 21:56:24 +0000946Netrw supports the browsing of directories on your local system and on remote
947hosts; browsing includes listing files and directories, entering directories,
948editing files therein, deleting files/directories, making new directories,
949moving (renaming) files and directories, copying files and directories, etc.
950One may mark files and execute any system command on them! The Netrw browser
951generally implements the previous explorer's maps and commands for remote
952directories, although details (such as pertinent global variable names)
953necessarily differ. To browse a directory, simply "edit" it! >
Bram Moolenaar269ec652004-07-29 08:43:53 +0000954
Bram Moolenaar446cb832008-06-24 21:56:24 +0000955 vim /your/directory/
956 vim .
957 vim c:\your\directory\
958<
959(Related topics: |netrw-cr| |netrw-o| |netrw-p| |netrw-P| |netrw-t|
960 |netrw-mf| |netrw-mx| |netrw-D| |netrw-R| |netrw-v| )
Bram Moolenaard4755bb2004-09-02 19:12:26 +0000961
962The Netrw remote file and directory browser handles two protocols: ssh and
Bram Moolenaar446cb832008-06-24 21:56:24 +0000963ftp. The protocol in the url, if it is ftp, will cause netrw also to use ftp
964in its remote browsing. Specifying any other protocol will cause it to be
965used for file transfers; but the ssh protocol will be used to do remote
966browsing.
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000967
Bram Moolenaar446cb832008-06-24 21:56:24 +0000968To use Netrw's remote directory browser, simply attempt to read a "file" with
969a trailing slash and it will be interpreted as a request to list a directory:
970>
Bram Moolenaar69a7cb42004-06-20 12:51:53 +0000971 vim [protocol]://[user@]hostname/path/
Bram Moolenaar4ea8fe12006-03-09 22:32:39 +0000972<
Bram Moolenaar446cb832008-06-24 21:56:24 +0000973where [protocol] is typically scp or ftp. As an example, try: >
Bram Moolenaar4ea8fe12006-03-09 22:32:39 +0000974
Bram Moolenaar446cb832008-06-24 21:56:24 +0000975 vim ftp://ftp.home.vim.org/pub/vim/
976<
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100977For local directories, the trailing slash is not required. Again, because it's
Bram Moolenaar446cb832008-06-24 21:56:24 +0000978easy to miss: to browse remote directories, the url must terminate with a
979slash!
Bram Moolenaar83bab712005-08-01 21:58:57 +0000980
Bram Moolenaar446cb832008-06-24 21:56:24 +0000981If you'd like to avoid entering the password repeatedly for remote directory
982listings with ssh or scp, see |netrw-ssh-hack|. To avoid password entry with
983ftp, see |netrw-netrc| (if your ftp supports it).
Bram Moolenaar83bab712005-08-01 21:58:57 +0000984
Bram Moolenaar446cb832008-06-24 21:56:24 +0000985There are several things you can do to affect the browser's display of files:
Bram Moolenaar83bab712005-08-01 21:58:57 +0000986
Bram Moolenaar446cb832008-06-24 21:56:24 +0000987 * To change the listing style, press the "i" key (|netrw-i|).
988 Currently there are four styles: thin, long, wide, and tree.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100989 To make that change "permanent", see |g:netrw_liststyle|.
Bram Moolenaar83bab712005-08-01 21:58:57 +0000990
Bram Moolenaar446cb832008-06-24 21:56:24 +0000991 * To hide files (don't want to see those xyz~ files anymore?) see
992 |netrw-ctrl-h|.
Bram Moolenaar83bab712005-08-01 21:58:57 +0000993
Bram Moolenaar446cb832008-06-24 21:56:24 +0000994 * Press s to sort files by name, time, or size.
995
996See |netrw-browse-cmds| for all the things you can do with netrw!
997
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100998 *netrw-getftype* *netrw-filigree* *netrw-ftype*
999The |getftype()| function is used to append a bit of filigree to indicate
1000filetype to locally listed files:
1001
1002 directory : /
1003 executable : *
1004 fifo : |
1005 links : @
1006 sockets : =
1007
1008The filigree also affects the |g:netrw_sort_sequence|.
1009
Bram Moolenaar446cb832008-06-24 21:56:24 +00001010
1011QUICK HELP *netrw-quickhelp* {{{2
1012 (Use ctrl-] to select a topic)~
1013 Intro to Browsing...............................|netrw-intro-browse|
1014 Quick Reference: Maps.........................|netrw-quickmap|
1015 Quick Reference: Commands.....................|netrw-browse-cmds|
1016 Hiding
1017 Edit hiding list..............................|netrw-ctrl-h|
1018 Hiding Files or Directories...................|netrw-a|
1019 Hiding/Unhiding by suffix.....................|netrw-mh|
1020 Hiding dot-files.............................|netrw-gh|
1021 Listing Style
1022 Select listing style (thin/long/wide/tree)....|netrw-i|
1023 Associated setting variable...................|g:netrw_liststyle|
1024 Shell command used to perform listing.........|g:netrw_list_cmd|
1025 Quick file info...............................|netrw-qf|
1026 Sorted by
1027 Select sorting style (name/time/size).........|netrw-s|
1028 Editing the sorting sequence..................|netrw-S|
Bram Moolenaarc236c162008-07-13 17:41:49 +00001029 Sorting options...............................|g:netrw_sort_options|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001030 Associated setting variable...................|g:netrw_sort_sequence|
1031 Reverse sorting order.........................|netrw-r|
1032
1033
1034 *netrw-quickmap* *netrw-quickmaps*
1035QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00001036>
Bram Moolenaar446cb832008-06-24 21:56:24 +00001037 --- ----------------- ----
1038 Map Quick Explanation Link
1039 --- ----------------- ----
1040< <F1> Causes Netrw to issue help
1041 <cr> Netrw will enter the directory or read the file |netrw-cr|
1042 <del> Netrw will attempt to remove the file/directory |netrw-del|
1043 - Makes Netrw go up one directory |netrw--|
1044 a Toggles between normal display, |netrw-a|
1045 hiding (suppress display of files matching g:netrw_list_hide)
1046 showing (display only files which match g:netrw_list_hide)
1047 c Make browsing directory the current directory |netrw-c|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001048 C Setting the editing window |netrw-C|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001049 d Make a directory |netrw-d|
1050 D Attempt to remove the file(s)/directory(ies) |netrw-D|
1051 gb Go to previous bookmarked directory |netrw-gb|
1052 gh Quick hide/unhide of dot-files |netrw-gh|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001053 <c-h> Edit file hiding list |netrw-ctrl-h|
1054 i Cycle between thin, long, wide, and tree listings |netrw-i|
1055 <c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l|
1056 mb Bookmark current directory |netrw-mb|
1057 mc Copy marked files to marked-file target directory |netrw-mc|
1058 md Apply diff to marked files (up to 3) |netrw-md|
1059 me Place marked files on arg list and edit them |netrw-me|
1060 mf Mark a file |netrw-mf|
1061 mh Toggle marked file suffices' presence on hiding list |netrw-mh|
1062 mm Move marked files to marked-file target directory |netrw-mm|
1063 mp Print marked files |netrw-mp|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001064 mr Mark files satisfying a shell-style |regexp| |netrw-mr|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001065 mt Current browsing directory becomes markfile target |netrw-mt|
1066 mT Apply ctags to marked files |netrw-mT|
1067 mu Unmark all marked files |netrw-mu|
1068 mx Apply arbitrary shell command to marked files |netrw-mx|
1069 mz Compress/decompress marked files |netrw-mz|
1070 o Enter the file/directory under the cursor in a new |netrw-o|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001071 browser window. A horizontal split is used.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001072 O Obtain a file specified by cursor |netrw-O|
1073 p Preview the file |netrw-p|
1074 P Browse in the previously used window |netrw-P|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001075 qb List bookmarked directories and history |netrw-qb|
1076 qf Display information on file |netrw-qf|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001077 r Reverse sorting order |netrw-r|
1078 R Rename the designed file(s)/directory(ies) |netrw-R|
1079 s Select sorting style: by name, time, or file size |netrw-s|
1080 S Specify suffix priority for name-sorting |netrw-S|
1081 t Enter the file/directory under the cursor in a new tab|netrw-t|
1082 u Change to recently-visited directory |netrw-u|
1083 U Change to subsequently-visited directory |netrw-U|
1084 v Enter the file/directory under the cursor in a new |netrw-v|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001085 browser window. A vertical split is used.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001086 x View file with an associated program |netrw-x|
Bram Moolenaar97d62492012-11-15 21:28:22 +01001087 X Execute filename under cursor via |system()| |netrw-X|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001088
Bram Moolenaarc236c162008-07-13 17:41:49 +00001089 % Open a new file in netrw's current directory |netrw-%|
1090
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001091 *netrw-mouse* *netrw-leftmouse* *netrw-middlemouse* *netrw-rightmouse*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001092 <leftmouse> (gvim only) selects word under mouse as if a <cr>
1093 had been pressed (ie. edit file, change directory)
1094 <middlemouse> (gvim only) same as P selecting word under mouse;
1095 see |netrw-P|
1096 <rightmouse> (gvim only) delete file/directory using word under
1097 mouse
1098 <2-leftmouse> (gvim only) when:
1099 * in a netrw-selected file, AND
1100 * |g:netrw_retmap| == 1 AND
Bram Moolenaarff034192013-04-24 18:51:19 +02001101 * the user doesn't already have a <2-leftmouse>
1102 mapping defined before netrw is autoloaded,
Bram Moolenaar446cb832008-06-24 21:56:24 +00001103 then a double clicked leftmouse button will return
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001104 to the netrw browser window. See |g:netrw_retmap|.
Bram Moolenaar8d043172014-01-23 14:24:41 +01001105 <s-leftmouse> (gvim only) like mf, will mark files. Dragging
1106 the shifted leftmouse will mark multiple files.
1107 (see |netrw-mf|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00001108
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001109 (to disable mouse buttons while browsing: |g:netrw_mousemaps|)
1110
Bram Moolenaar446cb832008-06-24 21:56:24 +00001111 *netrw-quickcom* *netrw-quickcoms*
1112QUICK REFERENCE: COMMANDS *netrw-explore-cmds* *netrw-browse-cmds* {{{2
Bram Moolenaar8d043172014-01-23 14:24:41 +01001113 :NetrwClean[!]............................................|netrw-clean|
1114 :NetrwSettings............................................|netrw-settings|
1115 :Ntree....................................................|netrw-ntree|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001116 :Explore[!] [dir] Explore directory of current file......|netrw-explore|
1117 :Hexplore[!] [dir] Horizontal Split & Explore.............|netrw-explore|
Bram Moolenaar8d043172014-01-23 14:24:41 +01001118 :Lexplore [dir] Left Explorer Toggle...................|netrw-explore|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001119 :Nexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
1120 :Pexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
1121 :Rexplore Return to Explorer.....................|netrw-explore|
1122 :Sexplore[!] [dir] Split & Explore directory .............|netrw-explore|
1123 :Texplore[!] [dir] Tab & Explore..........................|netrw-explore|
1124 :Vexplore[!] [dir] Vertical Split & Explore...............|netrw-explore|
1125
1126BOOKMARKING A DIRECTORY *netrw-mb* *netrw-bookmark* *netrw-bookmarks* {{{2
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001127
Bram Moolenaar446cb832008-06-24 21:56:24 +00001128One may easily "bookmark" a directory by using >
1129
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001130 mb
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00001131<
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001132Bookmarks are retained in between sessions in a $HOME/.netrwbook file, and are
1133kept in sorted order.
1134
1135Related Topics:
1136 |netrw-gb| how to return (go) to a bookmark
1137 |netrw-mB| how to delete bookmarks
1138 |netrw-qb| how to list bookmarks
Bram Moolenaar4a85b412006-04-23 22:40:29 +00001139
1140
Bram Moolenaar446cb832008-06-24 21:56:24 +00001141BROWSING *netrw-cr* {{{2
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001142
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001143Browsing is simple: move the cursor onto a file or directory of interest.
Bram Moolenaar843ee412004-06-30 16:16:41 +00001144Hitting the <cr> (the return key) will select the file or directory.
1145Directories will themselves be listed, and files will be opened using the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001146protocol given in the original read request.
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001147
Bram Moolenaar446cb832008-06-24 21:56:24 +00001148 CAVEAT: There are four forms of listing (see |netrw-i|). Netrw assumes that
1149 two or more spaces delimit filenames and directory names for the long and
1150 wide listing formats. Thus, if your filename or directory name has two or
1151 more sequential spaces embedded in it, or any trailing spaces, then you'll
1152 need to use the "thin" format to select it.
Bram Moolenaar843ee412004-06-30 16:16:41 +00001153
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001154The |g:netrw_browse_split| option, which is zero by default, may be used to
Bram Moolenaar446cb832008-06-24 21:56:24 +00001155cause the opening of files to be done in a new window or tab instead of the
1156default. When the option is one or two, the splitting will be taken
1157horizontally or vertically, respectively. When the option is set to three, a
1158<cr> will cause the file to appear in a new tab.
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001159
Bram Moolenaar83bab712005-08-01 21:58:57 +00001160
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001161When using the gui (gvim), one may select a file by pressing the <leftmouse>
1162button. In addition, if
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001163
Bram Moolenaar446cb832008-06-24 21:56:24 +00001164 *|g:netrw_retmap| == 1 AND (its default value is 0)
1165 * in a netrw-selected file, AND
1166 * the user doesn't already have a <2-leftmouse> mapping defined before
1167 netrw is loaded
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001168
Bram Moolenaar446cb832008-06-24 21:56:24 +00001169then a doubly-clicked leftmouse button will return to the netrw browser
1170window.
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001171
Bram Moolenaar446cb832008-06-24 21:56:24 +00001172Netrw attempts to speed up browsing, especially for remote browsing where one
1173may have to enter passwords, by keeping and re-using previously obtained
1174directory listing buffers. The |g:netrw_fastbrowse| variable is used to
1175control this behavior; one may have slow browsing (no buffer re-use), medium
1176speed browsing (re-use directory buffer listings only for remote directories),
1177and fast browsing (re-use directory buffer listings as often as possible).
1178The price for such re-use is that when changes are made (such as new files
1179are introduced into a directory), the listing may become out-of-date. One may
1180always refresh directory listing buffers by pressing ctrl-L (see
1181|netrw-ctrl-l|).
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001182
Bram Moolenaara6878372014-03-22 21:02:50 +01001183 *:netrw-s-cr*
1184 Squeezing the Current Tree-Listing Directory~
1185 When the tree listing style is enabled (see |netrw-i|) and one is using
1186 gvim, then the <s-cr> mapping may be used to squeeze (close) the
1187 directory currently containing the cursor.
1188
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001189
Bram Moolenaar446cb832008-06-24 21:56:24 +00001190Related topics: |netrw-o| |netrw-p| |netrw-P| |netrw-t| |netrw-v|
1191Associated setting variables: |g:netrw_browse_split| |g:netrw_fastbrowse|
1192 |g:netrw_ftp_list_cmd| |g:netrw_ftp_sizelist_cmd|
1193 |g:netrw_ftp_timelist_cmd| |g:netrw_ssh_cmd|
1194 |g:netrw_ssh_browse_reject| |g:netrw_use_noswf|
1195
1196
1197BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o* *netrw-horiz* {{{2
1198
1199Normally one enters a file or directory using the <cr>. However, the "o" map
1200allows one to open a new window to hold the new directory listing or file. A
1201horizontal split is used. (for vertical splitting, see |netrw-v|)
1202
1203Normally, the o key splits the window horizontally with the new window and
Bram Moolenaar15146672011-10-20 22:22:38 +02001204cursor at the top.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001205
1206Associated setting variables: |g:netrw_alto| |g:netrw_winsize|
1207
Bram Moolenaarff034192013-04-24 18:51:19 +02001208Related Actions |netrw-cr| |netrw-p| |netrw-t| |netrw-v|
Bram Moolenaar15146672011-10-20 22:22:38 +02001209Associated setting variables:
1210 |g:netrw_alto| control above/below splitting
1211 |g:netrw_winsize| control initial sizing
Bram Moolenaar446cb832008-06-24 21:56:24 +00001212
Bram Moolenaarff034192013-04-24 18:51:19 +02001213BROWSING WITH A NEW TAB *netrw-t*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001214
1215Normally one enters a file or directory using the <cr>. The "t" map
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001216allows one to open a new window holding the new directory listing or file in
Bram Moolenaarff034192013-04-24 18:51:19 +02001217a new tab.
1218
1219If you'd like to have the new listing in a background tab, use |gT|.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001220
Bram Moolenaar15146672011-10-20 22:22:38 +02001221Related Actions |netrw-cr| |netrw-o| |netrw-p| |netrw-v|
1222Associated setting variables:
1223 |g:netrw_winsize| control initial sizing
Bram Moolenaar446cb832008-06-24 21:56:24 +00001224
1225BROWSING WITH A VERTICALLY SPLIT WINDOW *netrw-v* {{{2
1226
1227Normally one enters a file or directory using the <cr>. However, the "v" map
1228allows one to open a new window to hold the new directory listing or file. A
1229vertical split is used. (for horizontal splitting, see |netrw-o|)
1230
1231Normally, the v key splits the window vertically with the new window and
Bram Moolenaar15146672011-10-20 22:22:38 +02001232cursor at the left.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001233
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001234There is only one tree listing buffer; using "v" on a displayed subdirectory
Bram Moolenaar446cb832008-06-24 21:56:24 +00001235will split the screen, but the same buffer will be shown twice.
1236
1237Associated setting variable: |g:netrw_altv| |g:netrw_winsize|
1238
Bram Moolenaarff034192013-04-24 18:51:19 +02001239Related Actions |netrw-cr| |netrw-o| |netrw-t| |netrw-v|
Bram Moolenaar15146672011-10-20 22:22:38 +02001240Associated setting variables:
1241 |g:netrw_altv| control right/left splitting
1242 |g:netrw_winsize| control initial sizing
1243
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001244
1245CHANGE LISTING STYLE (THIN LONG WIDE TREE) *netrw-i* {{{2
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001246
Bram Moolenaar9964e462007-05-05 17:54:07 +00001247The "i" map cycles between the thin, long, wide, and tree listing formats.
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001248
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001249The thin listing format gives just the files' and directories' names.
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001250
Bram Moolenaar8299df92004-07-10 09:47:34 +00001251The long listing is either based on the "ls" command via ssh for remote
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001252directories or displays the filename, file size (in bytes), and the time and
1253date of last modification for local directories. With the long listing
1254format, netrw is not able to recognize filenames which have trailing spaces.
1255Use the thin listing format for such files.
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001256
Bram Moolenaar9964e462007-05-05 17:54:07 +00001257The wide listing format uses two or more contiguous spaces to delineate
1258filenames; when using that format, netrw won't be able to recognize or use
1259filenames which have two or more contiguous spaces embedded in the name or any
1260trailing spaces. The thin listing format will, however, work with such files.
1261This listing format is the most compact.
1262
1263The tree listing format has a top directory followed by files and directories
1264preceded by a "|". One may open and close directories by pressing the <cr>
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001265key while atop the directory name.
1266
1267One may make a preferred listing style your default; see |g:netrw_liststyle|.
1268As an example, by putting the following line in your .vimrc, >
1269 let g:netrw_liststyle= 4
1270the tree style will become your default listing style.
Bram Moolenaar8299df92004-07-10 09:47:34 +00001271
Bram Moolenaar5b435d62012-04-05 17:33:26 +02001272One typical way to use the netrw tree display is to: >
1273
1274 vim .
1275 (use i until a tree display shows)
1276 navigate to a file
1277 v (edit as desired in vertically split window)
1278 ctrl-w h (to return to the netrw listing)
1279 P (edit newly selected file in the previous window)
1280 ctrl-w h (to return to the netrw listing)
1281 P (edit newly selected file in the previous window)
1282 ...etc...
1283<
Bram Moolenaar446cb832008-06-24 21:56:24 +00001284Associated setting variables: |g:netrw_liststyle| |g:netrw_maxfilenamelen|
1285 |g:netrw_timefmt| |g:netrw_list_cmd|
Bram Moolenaar8299df92004-07-10 09:47:34 +00001286
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001287CHANGE FILE PERMISSION *netrw-gp* {{{2
1288
1289"gp" will ask you for a new permission for the file named under the cursor.
1290Currently, this only works for local files.
1291
1292Associated setting variables: |g:netrw_chgperm|
1293
Bram Moolenaar83bab712005-08-01 21:58:57 +00001294
Bram Moolenaar446cb832008-06-24 21:56:24 +00001295CHANGING TO A BOOKMARKED DIRECTORY *netrw-gb* {{{2
Bram Moolenaar843ee412004-06-30 16:16:41 +00001296
Bram Moolenaar446cb832008-06-24 21:56:24 +00001297To change directory back to a bookmarked directory, use
Bram Moolenaar843ee412004-06-30 16:16:41 +00001298
Bram Moolenaar446cb832008-06-24 21:56:24 +00001299 {cnt}gb
Bram Moolenaar843ee412004-06-30 16:16:41 +00001300
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001301Any count may be used to reference any of the bookmarks.
Bram Moolenaarff034192013-04-24 18:51:19 +02001302Note that |netrw-qb| shows both bookmarks and history; to go
1303to a location stored in the history see |netrw-u| and |netrw-U|.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001304
1305Related Topics:
1306 |netrw-mB| how to delete bookmarks
1307 |netrw-mb| how to make a bookmark
1308 |netrw-qb| how to list bookmarks
Bram Moolenaar843ee412004-06-30 16:16:41 +00001309
Bram Moolenaar843ee412004-06-30 16:16:41 +00001310
Bram Moolenaar00a927d2010-05-14 23:24:24 +02001311CHANGING TO A PREDECESSOR DIRECTORY *netrw-u* *netrw-updir* {{{2
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001312
1313Every time you change to a new directory (new for the current session),
1314netrw will save the directory in a recently-visited directory history
Bram Moolenaaradc21822011-04-01 18:03:16 +02001315list (unless |g:netrw_dirhistmax| is zero; by default, it's ten). With the
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001316"u" map, one can change to an earlier directory (predecessor). To do
1317the opposite, see |netrw-U|.
1318
Bram Moolenaarff034192013-04-24 18:51:19 +02001319The "u" map also accepts counts to go back in the history several slots.
1320For your convenience, |netrw-qb| lists the history number which can be
1321re-used in that count.
1322
1323See |g:netrw_dirhistmax| for how to control the quantity of history stack
1324slots.
1325
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001326
Bram Moolenaar446cb832008-06-24 21:56:24 +00001327CHANGING TO A SUCCESSOR DIRECTORY *netrw-U* *netrw-downdir* {{{2
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001328
1329With the "U" map, one can change to a later directory (successor).
1330This map is the opposite of the "u" map. (see |netrw-u|) Use the
Bram Moolenaar446cb832008-06-24 21:56:24 +00001331q map to list both the bookmarks and history. (see |netrw-qb|)
1332
Bram Moolenaarff034192013-04-24 18:51:19 +02001333The "U" map also accepts counts to go forward in the history several slots.
1334
1335See |g:netrw_dirhistmax| for how to control the quantity of history stack
1336slots.
1337
Bram Moolenaar446cb832008-06-24 21:56:24 +00001338
Bram Moolenaar8d043172014-01-23 14:24:41 +01001339CHANGING TREE TOP *netrw-ntree* *:Ntree*
1340
1341One may specify a new tree top for tree listings using >
1342
1343 :Ntree [dirname]
1344
1345Without a "dirname", the current line is used (and any leading depth
1346information is elided).
1347With a "dirname", the specified directory name is used.
1348
1349
Bram Moolenaar446cb832008-06-24 21:56:24 +00001350NETRW CLEAN *netrw-clean* *:NetrwClean*
1351
1352With :NetrwClean one may easily remove netrw from one's home directory;
1353more precisely, from the first directory on your |'runtimepath'|.
1354
1355With :NetrwClean!, netrw will remove netrw from all directories on your
1356|'runtimepath'|.
1357
1358With either form of the command, netrw will first ask for confirmation
1359that the removal is in fact what you want to do. If netrw doesn't have
1360permission to remove a file, it will issue an error message.
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00001361
Bram Moolenaar9964e462007-05-05 17:54:07 +00001362 *netrw-gx*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001363CUSTOMIZING BROWSING WITH A USER FUNCTION *netrw-x* *netrw-handler* {{{2
Bram Moolenaar9964e462007-05-05 17:54:07 +00001364 (also see |netrw_filehandler|)
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001365
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001366Certain files, such as html, gif, jpeg, (word/office) doc, etc, files, are
1367best seen with a special handler (ie. a tool provided with your computer).
1368Netrw allows one to invoke such special handlers by: >
1369
1370 * when Exploring, hit the "x" key
1371 * when editing, hit gx with the cursor atop the special filename
Bram Moolenaar9964e462007-05-05 17:54:07 +00001372< (not available if the |g:netrw_nogx| variable exists)
1373
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001374Netrw determines which special handler by the following method:
1375
1376 * if |g:netrw_browsex_viewer| exists, then it will be used to attempt to
1377 view files. Examples of useful settings (place into your <.vimrc>): >
1378
1379 :let g:netrw_browsex_viewer= "kfmclient exec"
1380< or >
1381 :let g:netrw_browsex_viewer= "gnome-open"
1382<
1383 If g:netrw_browsex_viewer == '-', then netrwFileHandler() will be
1384 invoked first (see |netrw_filehandler|).
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001385
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001386 * for Windows 32 or 64, the url and FileProtocolHandler dlls are used.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001387 * for Gnome (with gnome-open): gnome-open is used.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001388 * for KDE (with kfmclient) : kfmclient is used.
1389 * for Mac OS X : open is used.
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001390 * otherwise the netrwFileHandler plugin is used.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001391
1392The file's suffix is used by these various approaches to determine an
Bram Moolenaar1afcace2005-11-25 19:54:28 +00001393appropriate application to use to "handle" these files. Such things as
1394OpenOffice (*.sfx), visualization (*.jpg, *.gif, etc), and PostScript (*.ps,
1395*.eps) can be handled.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001396
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001397 *netrw_filehandler*
Bram Moolenaar9964e462007-05-05 17:54:07 +00001398
1399The "x" map applies a function to a file, based on its extension. Of course,
1400the handler function must exist for it to be called!
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001401>
1402 Ex. mypgm.html x ->
Bram Moolenaar9964e462007-05-05 17:54:07 +00001403 NFH_html("scp://user@host/some/path/mypgm.html")
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001404<
Bram Moolenaar9964e462007-05-05 17:54:07 +00001405Users may write their own netrw File Handler functions to support more
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001406suffixes with special handling. See <autoload/netrwFileHandlers.vim> for
Bram Moolenaar9964e462007-05-05 17:54:07 +00001407examples on how to make file handler functions. As an example: >
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001408
Bram Moolenaar9964e462007-05-05 17:54:07 +00001409 " NFH_suffix(filename)
1410 fun! NFH_suffix(filename)
1411 ..do something special with filename..
1412 endfun
1413<
1414These functions need to be defined in some file in your .vim/plugin
1415(vimfiles\plugin) directory. Vim's function names may not have punctuation
1416characters (except for the underscore) in them. To support suffices that
1417contain such characters, netrw will first convert the suffix using the
1418following table: >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001419
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001420 @ -> AT ! -> EXCLAMATION % -> PERCENT
1421 : -> COLON = -> EQUAL ? -> QUESTION
Bram Moolenaar9964e462007-05-05 17:54:07 +00001422 , -> COMMA - -> MINUS ; -> SEMICOLON
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001423 $ -> DOLLAR + -> PLUS ~ -> TILDE
1424<
Bram Moolenaar9964e462007-05-05 17:54:07 +00001425So, for example: >
Bram Moolenaarafeb4fa2006-02-01 21:51:12 +00001426
Bram Moolenaar9964e462007-05-05 17:54:07 +00001427 file.rcs,v -> NFH_rcsCOMMAv()
1428<
1429If more such translations are necessary, please send me email: >
1430 NdrOchip at ScampbellPfamily.AbizM - NOSPAM
1431with a request.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00001432
Bram Moolenaar446cb832008-06-24 21:56:24 +00001433Associated setting variable: |g:netrw_browsex_viewer|
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001434
Bram Moolenaar446cb832008-06-24 21:56:24 +00001435 *netrw-curdir*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001436DELETING BOOKMARKS *netrw-mB* {{{2
1437
1438To delete a bookmark, use >
1439
1440 {cnt}mB
1441<
1442Related Topics:
1443 |netrw-gb| how to return (go) to a bookmark
1444 |netrw-mb| how to make a bookmark
1445 |netrw-qb| how to list bookmarks
1446
1447
Bram Moolenaar446cb832008-06-24 21:56:24 +00001448DELETING FILES OR DIRECTORIES *netrw-delete* *netrw-D* *netrw-del* {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001449
Bram Moolenaar446cb832008-06-24 21:56:24 +00001450If files have not been marked with |netrw-mf|: (local marked file list)
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00001451
Bram Moolenaar446cb832008-06-24 21:56:24 +00001452 Deleting/removing files and directories involves moving the cursor to the
1453 file/directory to be deleted and pressing "D". Directories must be empty
1454 first before they can be successfully removed. If the directory is a
1455 softlink to a directory, then netrw will make two requests to remove the
1456 directory before succeeding. Netrw will ask for confirmation before doing
1457 the removal(s). You may select a range of lines with the "V" command
1458 (visual selection), and then pressing "D".
Bram Moolenaar9964e462007-05-05 17:54:07 +00001459
Bram Moolenaar446cb832008-06-24 21:56:24 +00001460If files have been marked with |netrw-mf|: (local marked file list)
1461
1462 Marked files (and empty directories) will be deleted; again, you'll be
1463 asked to confirm the deletion before it actually takes place.
1464
1465The |g:netrw_rm_cmd|, |g:netrw_rmf_cmd|, and |g:netrw_rmdir_cmd| variables are
1466used to control the attempts to remove files and directories. The
1467g:netrw_rm_cmd is used with files, and its default value is:
1468
1469 g:netrw_rm_cmd: ssh HOSTNAME rm
1470
1471The g:netrw_rmdir_cmd variable is used to support the removal of directories.
1472Its default value is:
1473
1474 g:netrw_rmdir_cmd: ssh HOSTNAME rmdir
1475
1476If removing a directory fails with g:netrw_rmdir_cmd, netrw then will attempt
1477to remove it again using the g:netrw_rmf_cmd variable. Its default value is:
1478
1479 g:netrw_rmf_cmd: ssh HOSTNAME rm -f
1480
Bram Moolenaar15146672011-10-20 22:22:38 +02001481Related topics: |netrw-d|
Bram Moolenaar5b435d62012-04-05 17:33:26 +02001482Associated setting variable: |g:netrw_localrmdir| |g:netrw_rm_cmd|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001483 |g:netrw_rmdir_cmd| |g:netrw_ssh_cmd|
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001484
1485
Bram Moolenaar446cb832008-06-24 21:56:24 +00001486*netrw-explore* *netrw-hexplore* *netrw-nexplore* *netrw-pexplore*
Bram Moolenaar8d043172014-01-23 14:24:41 +01001487*netrw-rexplore* *netrw-sexplore* *netrw-texplore* *netrw-vexplore* *netrw-lexplore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001488DIRECTORY EXPLORATION COMMANDS {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001489
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001490 :[N]Explore[!] [dir]... Explore directory of current file *:Explore*
1491 :[N]Hexplore[!] [dir]... Horizontal Split & Explore *:Hexplore*
Bram Moolenaara6878372014-03-22 21:02:50 +01001492 :Rexplore ... Return to/from Explorer *:Rexplore*
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001493 :[N]Sexplore[!] [dir]... Split&Explore current file's directory *:Sexplore*
1494 :Texplore [dir]... Tab & Explore *:Texplore*
1495 :[N]Vexplore[!] [dir]... Vertical Split & Explore *:Vexplore*
Bram Moolenaar8d043172014-01-23 14:24:41 +01001496 :Lexplore [dir]... Left Explorer Toggle *:Lexplore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001497
1498 Used with :Explore **/pattern : (also see |netrw-starstar|)
1499 :Nexplore............. go to next matching file *:Nexplore*
1500 :Pexplore............. go to previous matching file *:Pexplore*
1501
Bram Moolenaara6878372014-03-22 21:02:50 +01001502 *netrw-:Explore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001503:Explore will open the local-directory browser on the current file's
1504 directory (or on directory [dir] if specified). The window will be
1505 split only if the file has been modified, otherwise the browsing
1506 window will take over that window. Normally the splitting is taken
1507 horizontally.
Bram Moolenaara6878372014-03-22 21:02:50 +01001508 Also see: |netrw-:Rexplore|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001509:Explore! is like :Explore, but will use vertical splitting.
Bram Moolenaara6878372014-03-22 21:02:50 +01001510 *netrw-:Lexplore*
Bram Moolenaar8d043172014-01-23 14:24:41 +01001511:Lexplore [dir] toggles an Explorer window on the left hand side
1512 of the current tab It will open a netrw window on the current
Bram Moolenaara6878372014-03-22 21:02:50 +01001513 directory if [dir] is omitted; a :Lexplore [dir] will show
1514 the specified directory in the left-hand side browser display
1515 no matter from which window the command is issued. By default,
1516 :Lexplore will change an uninitialized |g:netrw_chgwin| to 2;
1517 edits will thus be preferentially made in window#2.
1518 Also see: |netrw-C|| |g:netrw_chgwin| |g:netrw_winsize|
1519 |netrw-p| |netrw-P|| |g:netrw_browse_split|
1520 *netrw-:Sexplore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001521:Sexplore will always split the window before invoking the local-directory
1522 browser. As with Explore, the splitting is normally done
1523 horizontally.
1524:Sexplore! [dir] is like :Sexplore, but the splitting will be done vertically.
Bram Moolenaara6878372014-03-22 21:02:50 +01001525 *netrw-:Hexplore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001526:Hexplore [dir] does an :Explore with |:belowright| horizontal splitting.
1527:Hexplore! [dir] does an :Explore with |:aboveleft| horizontal splitting.
Bram Moolenaara6878372014-03-22 21:02:50 +01001528 *netrw-:Vexplore*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001529:Vexplore [dir] does an :Explore with |:leftabove| vertical splitting.
1530:Vexplore! [dir] does an :Explore with |:rightbelow| vertical splitting.
Bram Moolenaara6878372014-03-22 21:02:50 +01001531 *netrw-:Texplore*
Bram Moolenaar8d043172014-01-23 14:24:41 +01001532:Texplore [dir] does a |:tabnew| before generating the browser window
Bram Moolenaar446cb832008-06-24 21:56:24 +00001533
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001534By default, these commands use the current file's directory. However, one may
1535explicitly provide a directory (path) to use.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001536
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001537The [N] will override |g:netrw_winsize| to specify the quantity of rows and/or
1538columns the new explorer window should have.
1539
1540Otherwise, the |g:netrw_winsize| variable, if it has been specified by the
1541user, is used to control the quantity of rows and/or columns new explorer
1542windows should have.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001543
Bram Moolenaara6878372014-03-22 21:02:50 +01001544 *netrw-:Rexplore*
1545:Rexplore This command is a little different from the others as it doesn't
1546 necessarily open an Explorer window.
1547
1548 Return to Explorer~
1549 When one edits a file, for example by pressing <cr> when the
1550 cursor is atop a file in a netrw browser window, :Rexplore will
1551 return the display to that of the last netrw browser window.
1552
1553 Return from Explorer~
1554 Conversely, when one is editing a directory, issuing a :Rexplore
1555 will return to editing the last file being edited in that
1556 window.
1557
1558 The <2-leftmouse> map (which is only available under gvim and
1559 cooperative terms) does the same as :Rexplore.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001560
Bram Moolenaar8d043172014-01-23 14:24:41 +01001561Also see: |g:netrw_alto| |g:netrw_altv| |g:netrw_winsize|
1562
Bram Moolenaar446cb832008-06-24 21:56:24 +00001563
1564*netrw-star* *netrw-starpat* *netrw-starstar* *netrw-starstarpat*
1565EXPLORING WITH STARS AND PATTERNS
1566
1567When Explore, Sexplore, Hexplore, or Vexplore are used with one of the
1568following four styles, Explore generates a list of files which satisfy
1569the request. >
1570
1571 */filepat files in current directory which satisfy filepat
1572 **/filepat files in current directory or below which satisfy the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001573 file pattern
Bram Moolenaar446cb832008-06-24 21:56:24 +00001574 *//pattern files in the current directory which contain the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001575 pattern (vimgrep is used)
Bram Moolenaar446cb832008-06-24 21:56:24 +00001576 **//pattern files in the current directory or below which contain
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001577 the pattern (vimgrep is used)
Bram Moolenaar572cb562005-08-05 21:35:02 +00001578<
Bram Moolenaar446cb832008-06-24 21:56:24 +00001579The cursor will be placed on the first file in the list. One may then
1580continue to go to subsequent files on that list via |:Nexplore| or to
1581preceding files on that list with |:Pexplore|. Explore will update the
1582directory and place the cursor appropriately.
1583
1584A plain >
1585 :Explore
1586will clear the explore list.
1587
1588If your console or gui produces recognizable shift-up or shift-down sequences,
1589then you'll likely find using shift-downarrow and shift-uparrow convenient.
1590They're mapped by netrw:
1591
1592 <s-down> == Nexplore, and
1593 <s-up> == Pexplore.
1594
1595As an example, consider
1596>
1597 :Explore */*.c
1598 :Nexplore
1599 :Nexplore
1600 :Pexplore
1601<
1602The status line will show, on the right hand side of the status line, a
1603message like "Match 3 of 20".
1604
Bram Moolenaara6878372014-03-22 21:02:50 +01001605Associated setting variables:
1606 |g:netrw_keepdir| |g:netrw_browse_split|
1607 |g:netrw_fastbrowse| |g:netrw_ftp_browse_reject|
1608 |g:netrw_ftp_list_cmd| |g:netrw_ftp_sizelist_cmd|
1609 |g:netrw_ftp_timelist_cmd| |g:netrw_list_cmd|
1610 |g:netrw_liststyle|
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001611
1612
Bram Moolenaar446cb832008-06-24 21:56:24 +00001613DISPLAYING INFORMATION ABOUT FILE *netrw-qf* {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001614
Bram Moolenaar446cb832008-06-24 21:56:24 +00001615With the cursor atop a filename, pressing "qf" will reveal the file's size
1616and last modification timestamp. Currently this capability is only available
1617for local files.
Bram Moolenaar578b49e2005-09-10 19:22:57 +00001618
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001619
Bram Moolenaar446cb832008-06-24 21:56:24 +00001620EDIT FILE OR DIRECTORY HIDING LIST *netrw-ctrl-h* *netrw-edithide* {{{2
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001621
Bram Moolenaar446cb832008-06-24 21:56:24 +00001622The "<ctrl-h>" map brings up a requestor allowing the user to change the
1623file/directory hiding list contained in |g:netrw_list_hide|. The hiding list
1624consists of one or more patterns delimited by commas. Files and/or
1625directories satisfying these patterns will either be hidden (ie. not shown) or
1626be the only ones displayed (see |netrw-a|).
1627
1628The "gh" mapping (see |netrw-gh|) quickly alternates between the usual
1629hiding list and the hiding of files or directories that begin with ".".
1630
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001631As an example, >
1632 let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+'
1633Effectively, this makes the effect of a |netrw-gh| command the initial setting.
1634What it means:
1635
1636 \(^\|\s\s\) : if the line begins with the following, -or-
1637 two consecutive spaces are encountered
1638 \zs : start the hiding match now
1639 \. : if it now begins with a dot
1640 \S\+ : and is followed by one or more non-whitespace
1641 characters
1642
Bram Moolenaar446cb832008-06-24 21:56:24 +00001643Associated setting variables: |g:netrw_hide| |g:netrw_list_hide|
1644Associated topics: |netrw-a| |netrw-gh| |netrw-mh|
Bram Moolenaard4755bb2004-09-02 19:12:26 +00001645
Bram Moolenaar15146672011-10-20 22:22:38 +02001646 *netrw-sort-sequence*
Bram Moolenaar446cb832008-06-24 21:56:24 +00001647EDITING THE SORTING SEQUENCE *netrw-S* *netrw-sortsequence* {{{2
1648
1649When "Sorted by" is name, one may specify priority via the sorting sequence
1650(g:netrw_sort_sequence). The sorting sequence typically prioritizes the
1651name-listing by suffix, although any pattern will do. Patterns are delimited
1652by commas. The default sorting sequence is (all one line):
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001653
1654For Unix: >
1655 '[\/]$,\<core\%(\.\d\+\)\=,\.[a-np-z]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,
1656 \.info$,\.swp$,\.bak$,\~$'
1657<
1658Otherwise: >
Bram Moolenaar446cb832008-06-24 21:56:24 +00001659 '[\/]$,\.[a-np-z]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,
1660 \.swp$,\.bak$,\~$'
1661<
1662The lone * is where all filenames not covered by one of the other patterns
1663will end up. One may change the sorting sequence by modifying the
1664g:netrw_sort_sequence variable (either manually or in your <.vimrc>) or by
1665using the "S" map.
1666
Bram Moolenaarc236c162008-07-13 17:41:49 +00001667Related topics: |netrw-s| |netrw-S|
1668Associated setting variables: |g:netrw_sort_sequence| |g:netrw_sort_options|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001669
1670
Bram Moolenaar97d62492012-11-15 21:28:22 +01001671EXECUTING FILE UNDER CURSOR VIA SYSTEM() *netrw-X*
1672
1673Pressing X while the cursor is atop an executable file will yield a prompt
1674using the filename asking for any arguments. Upon pressing a [return], netrw
1675will then call |system()| with that command and arguments. The result will
1676be displayed by |:echomsg|, and so |:messages| will repeat display of the
1677result. Ansi escape sequences will be stripped out.
1678
1679
Bram Moolenaaradc21822011-04-01 18:03:16 +02001680FORCING TREATMENT AS A FILE OR DIRECTORY *netrw-gd* *netrw-gf* {{{2
1681
1682Remote symbolic links (ie. those listed via ssh or ftp) are problematic
1683in that it is difficult to tell whether they link to a file or to a
1684directory.
1685
1686To force treatment as a file: use >
Bram Moolenaar97d62492012-11-15 21:28:22 +01001687 gf
Bram Moolenaaradc21822011-04-01 18:03:16 +02001688<
1689To force treatment as a directory: use >
Bram Moolenaar97d62492012-11-15 21:28:22 +01001690 gd
Bram Moolenaaradc21822011-04-01 18:03:16 +02001691<
1692
Bram Moolenaar446cb832008-06-24 21:56:24 +00001693GOING UP *netrw--* {{{2
1694
1695To go up a directory, press "-" or press the <cr> when atop the ../ directory
1696entry in the listing.
1697
1698Netrw will use the command in |g:netrw_list_cmd| to perform the directory
1699listing operation after changing HOSTNAME to the host specified by the
Bram Moolenaara6878372014-03-22 21:02:50 +01001700user-prpvided url. By default netrw provides the command as: >
Bram Moolenaar446cb832008-06-24 21:56:24 +00001701
1702 ssh HOSTNAME ls -FLa
Bram Moolenaara6878372014-03-22 21:02:50 +01001703<
Bram Moolenaar446cb832008-06-24 21:56:24 +00001704where the HOSTNAME becomes the [user@]hostname as requested by the attempt to
1705read. Naturally, the user may override this command with whatever is
1706preferred. The NetList function which implements remote browsing
1707expects that directories will be flagged by a trailing slash.
1708
1709
1710HIDING FILES OR DIRECTORIES *netrw-a* *netrw-hiding* {{{2
1711
1712Netrw's browsing facility allows one to use the hiding list in one of three
1713ways: ignore it, hide files which match, and show only those files which
1714match.
1715
1716If no files have been marked via |netrw-mf|:
1717
1718The "a" map allows the user to cycle through the three hiding modes.
1719
1720The |g:netrw_list_hide| variable holds a comma delimited list of patterns
1721based on regular expressions (ex. ^.*\.obj$,^\.) which specify the hiding list.
1722(also see |netrw-ctrl-h|) To set the hiding list, use the <c-h> map. As an
1723example, to hide files which begin with a ".", one may use the <c-h> map to
1724set the hiding list to '^\..*' (or one may put let g:netrw_list_hide= '^\..*'
1725in one's <.vimrc>). One may then use the "a" key to show all files, hide
1726matching files, or to show only the matching files.
1727
1728 Example: \.[ch]$
1729 This hiding list command will hide/show all *.c and *.h files.
1730
1731 Example: \.c$,\.h$
1732 This hiding list command will also hide/show all *.c and *.h
1733 files.
1734
1735Don't forget to use the "a" map to select the mode (normal/hiding/show) you
1736want!
1737
1738If files have been marked using |netrw-mf|, then this command will:
1739
1740 if showing all files or non-hidden files:
1741 modify the g:netrw_list_hide list by appending the marked files to it
1742 and showing only non-hidden files.
1743
1744 else if showing hidden files only:
1745 modify the g:netrw_list_hide list by removing the marked files from it
1746 and showing only non-hidden files.
1747 endif
1748
1749 *netrw-gh* *netrw-hide*
1750As a quick shortcut, one may press >
1751 gh
1752to toggle between hiding files which begin with a period (dot) and not hiding
1753them.
1754
Bram Moolenaar8d043172014-01-23 14:24:41 +01001755Associated setting variables: |g:netrw_list_hide| |g:netrw_hide|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001756Associated topics: |netrw-a| |netrw-ctrl-h| |netrw-mh|
1757
Bram Moolenaar8d043172014-01-23 14:24:41 +01001758 *netrw-gitignore*
1759Netrw provides a helper function 'netrw_gitignore#Hide()' that, when used with
1760|g:netrw_list_hide| automatically hides all git-ignored files.
1761
1762'netrw_gitignore#Hide' searches for patterns in the following files:
1763 './.gitignore'
1764 './.git/info/exclude'
1765 global gitignore file: `git config --global core.excludesfile`
1766 system gitignore file: `git config --system core.excludesfile`
1767
1768Files that do not exist, are ignored.
1769Git-ignore patterns are taken from existing files, and converted to patterns for
1770hiding files. For example, if you had '*.log' in your '.gitignore' file, it
1771would be converted to '.*\.log'.
1772
1773To use this function, simply assign it's output to |g:netrw_list_hide| option.
1774
1775 Example: let g:netrw_list_hide= netrw_gitignore#Hide()
1776 Git-ignored files are hidden in Netrw.
1777
1778 Example: let g:netrw_list_hide= netrw_gitignore#Hide('my_gitignore_file')
1779 Function can take additional files with git-ignore patterns.
1780
1781 Example: g:netrw_list_hide= netrw_gitignore#Hide() . '.*\.swp$'
1782 Combining 'netrw_gitignore#Hide' with custom patterns.
1783
1784
Bram Moolenaar446cb832008-06-24 21:56:24 +00001785IMPROVING BROWSING *netrw-listhack* *netrw-ssh-hack* {{{2
Bram Moolenaarcfbc5ee2004-07-02 15:38:35 +00001786
1787Especially with the remote directory browser, constantly entering the password
1788is tedious.
1789
Bram Moolenaar9964e462007-05-05 17:54:07 +00001790For Linux/Unix systems, the book "Linux Server Hacks - 100 industrial strength
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +00001791tips & tools" by Rob Flickenger (O'Reilly, ISBN 0-596-00461-3) gives a tip
1792for setting up no-password ssh and scp and discusses associated security
Bram Moolenaar9964e462007-05-05 17:54:07 +00001793issues. It used to be available at http://hacks.oreilly.com/pub/h/66 ,
1794but apparently that address is now being redirected to some "hackzine".
Bram Moolenaare37d50a2008-08-06 17:06:04 +00001795I'll attempt a summary based on that article and on a communication from
1796Ben Schmidt:
Bram Moolenaar843ee412004-06-30 16:16:41 +00001797
Bram Moolenaare37d50a2008-08-06 17:06:04 +00001798 1. Generate a public/private key pair on the local machine
1799 (ssh client): >
1800 ssh-keygen -t rsa
1801 (saving the file in ~/.ssh/id_rsa as prompted)
1802<
1803 2. Just hit the <CR> when asked for passphrase (twice) for no
1804 passphrase. If you do use a passphrase, you will also need to use
1805 ssh-agent so you only have to type the passphrase once per session.
1806 If you don't use a passphrase, simply logging onto your local
1807 computer or getting access to the keyfile in any way will suffice
1808 to access any ssh servers which have that key authorized for login.
1809
1810 3. This creates two files: >
1811 ~/.ssh/id_rsa
1812 ~/.ssh/id_rsa.pub
1813<
1814 4. On the target machine (ssh server): >
1815 cd
1816 mkdir -p .ssh
1817 chmod 0700 .ssh
1818<
1819 5. On your local machine (ssh client): (one line) >
1820 ssh {serverhostname}
1821 cat '>>' '~/.ssh/authorized_keys2' < ~/.ssh/id_rsa.pub
1822<
1823 or, for OpenSSH, (one line) >
1824 ssh {serverhostname}
1825 cat '>>' '~/.ssh/authorized_keys' < ~/.ssh/id_rsa.pub
1826<
1827You can test it out with >
1828 ssh {serverhostname}
1829and you should be log onto the server machine without further need to type
1830anything.
1831
1832If you decided to use a passphrase, do: >
1833 ssh-agent $SHELL
1834 ssh-add
1835 ssh {serverhostname}
1836You will be prompted for your key passphrase when you use ssh-add, but not
1837subsequently when you use ssh. For use with vim, you can use >
1838 ssh-agent vim
1839and, when next within vim, use >
1840 :!ssh-add
1841Alternatively, you can apply ssh-agent to the terminal you're planning on
1842running vim in: >
1843 ssh-agent xterm &
1844and do ssh-add whenever you need.
Bram Moolenaar843ee412004-06-30 16:16:41 +00001845
Bram Moolenaar9964e462007-05-05 17:54:07 +00001846For Windows, folks on the vim mailing list have mentioned that Pageant helps
1847with avoiding the constant need to enter the password.
Bram Moolenaar433f7c82006-03-21 21:29:36 +00001848
Bram Moolenaar446cb832008-06-24 21:56:24 +00001849Kingston Fung wrote about another way to avoid constantly needing to enter
1850passwords:
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00001851
Bram Moolenaar446cb832008-06-24 21:56:24 +00001852 In order to avoid the need to type in the password for scp each time, you
1853 provide a hack in the docs to set up a non password ssh account. I found a
1854 better way to do that: I can use a regular ssh account which uses a
1855 password to access the material without the need to key-in the password
1856 each time. It's good for security and convenience. I tried ssh public key
1857 authorization + ssh-agent, implementing this, and it works! Here are two
1858 links with instructions:
1859
1860 http://www.ibm.com/developerworks/library/l-keyc2/
1861 http://sial.org/howto/openssh/publickey-auth/
1862
1863
Bram Moolenaar8d043172014-01-23 14:24:41 +01001864 Ssh hints:
1865
1866 Thomer Gil has provided a hint on how to speed up netrw+ssh:
1867 http://thomer.com/howtos/netrw_ssh.html
1868
1869 Alex Young has several hints on speeding ssh up:
1870 http://usevim.com/2012/03/16/editing-remote-files/
1871
1872
Bram Moolenaar446cb832008-06-24 21:56:24 +00001873LISTING BOOKMARKS AND HISTORY *netrw-qb* *netrw-listbookmark* {{{2
1874
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001875Pressing "qb" (query bookmarks) will list both the bookmarked directories and
1876directory traversal history.
Bram Moolenaar446cb832008-06-24 21:56:24 +00001877
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01001878Related Topics:
1879 |netrw-gb| how to return (go) to a bookmark
1880 |netrw-mb| how to make a bookmark
1881 |netrw-mB| how to delete bookmarks
1882 |netrw-u| change to a predecessor directory via the history stack
1883 |netrw-U| change to a successor directory via the history stack
Bram Moolenaar446cb832008-06-24 21:56:24 +00001884
1885MAKING A NEW DIRECTORY *netrw-d* {{{2
1886
1887With the "d" map one may make a new directory either remotely (which depends
1888on the global variable g:netrw_mkdir_cmd) or locally (which depends on the
Bram Moolenaar5b435d62012-04-05 17:33:26 +02001889global variable g:netrw_localmkdir). Netrw will issue a request for the new
Bram Moolenaar446cb832008-06-24 21:56:24 +00001890directory's name. A bare <CR> at that point will abort the making of the
1891directory. Attempts to make a local directory that already exists (as either
1892a file or a directory) will be detected, reported on, and ignored.
1893
Bram Moolenaar15146672011-10-20 22:22:38 +02001894Related topics: |netrw-D|
Bram Moolenaar8d043172014-01-23 14:24:41 +01001895Associated setting variables: |g:netrw_localmkdir| |g:netrw_mkdir_cmd|
1896 |g:netrw_remote_mkdir| |netrw-%|
Bram Moolenaar446cb832008-06-24 21:56:24 +00001897
1898
1899MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-c* {{{2
1900
1901By default, |g:netrw_keepdir| is 1. This setting means that the current
Bram Moolenaarff034192013-04-24 18:51:19 +02001902directory will not track the browsing directory. (done for backwards
1903compatibility with v6's file explorer).
Bram Moolenaar446cb832008-06-24 21:56:24 +00001904
Bram Moolenaarff034192013-04-24 18:51:19 +02001905Setting g:netrw_keepdir to 0 tells netrw to make vim's current directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00001906track netrw's browsing directory.
1907
1908However, given the default setting for g:netrw_keepdir of 1 where netrw
1909maintains its own separate notion of the current directory, in order to make
1910the two directories the same, use the "c" map (just type c). That map will
1911set Vim's notion of the current directory to netrw's current browsing
1912directory.
1913
1914Associated setting variable: |g:netrw_keepdir|
1915
Bram Moolenaara6878372014-03-22 21:02:50 +01001916MARKING FILES *netrw-:MF* *netrw-mf* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00001917 (also see |netrw-mr|)
1918
Bram Moolenaara6878372014-03-22 21:02:50 +01001919Netrw has several ways of marking files:
1920
1921 * One may mark files with the cursor atop a filename and
1922 then pressing "mf".
1923
1924 * With gvim, in addition one may mark files with
1925 <s-leftmouse>.
1926
1927 * One may use the :MF command, which takes a list of
1928 files (for local directories, the list may include
1929 wildcards -- see |glob()|) >
1930
1931 :MF *.c
1932<
1933 * Note that :MF uses |<f-args>| to break the line
1934 at spaces.
1935
1936The following netrw maps make use of marked files:
Bram Moolenaar446cb832008-06-24 21:56:24 +00001937
1938 |netrw-a| Hide marked files/directories
1939 |netrw-D| Delete marked files/directories
1940 |netrw-mc| Copy marked files to target
1941 |netrw-md| Apply vimdiff to marked files
1942 |netrw-me| Edit marked files
Bram Moolenaarff034192013-04-24 18:51:19 +02001943 |netrw-mF| Unmark marked files
Bram Moolenaar446cb832008-06-24 21:56:24 +00001944 |netrw-mg| Apply vimgrep to marked files
Bram Moolenaara6878372014-03-22 21:02:50 +01001945 |netrw-mm| Move marked files to target
Bram Moolenaar446cb832008-06-24 21:56:24 +00001946 |netrw-mp| Print marked files
1947 |netrw-mt| Set target for |netrw-mm| and |netrw-mc|
1948 |netrw-mT| Generate tags using marked files
1949 |netrw-mx| Apply shell command to marked files
1950 |netrw-mz| Compress/Decompress marked files
Bram Moolenaarff034192013-04-24 18:51:19 +02001951 |netrw-qF| Mark files using quickfix list
Bram Moolenaar446cb832008-06-24 21:56:24 +00001952 |netrw-O| Obtain marked files
1953 |netrw-R| Rename marked files
1954
1955One may unmark files one at a time the same way one marks them; ie. place
1956the cursor atop a marked file and press "mf". This process also works
1957with <s-leftmouse> using gvim. One may unmark all files by pressing
1958"mu" (see |netrw-mu|).
1959
Bram Moolenaaradc21822011-04-01 18:03:16 +02001960Marked files are highlighted using the "netrwMarkFile" highlighting group,
1961which by default is linked to "Identifier" (see Identifier under
1962|group-name|). You may change the highlighting group by putting something
1963like >
1964
1965 highlight clear netrwMarkFile
1966 hi link netrwMarkFile ..whatever..
1967<
1968into $HOME/.vim/after/syntax/netrw.vim .
1969
Bram Moolenaar8d043172014-01-23 14:24:41 +01001970If the mouse is enabled and works with your vim, you may use <s-leftmouse> to
1971mark one or more files. You may mark multiple files by dragging the shifted
1972leftmouse. (see |netrw-mouse|)
1973
Bram Moolenaar446cb832008-06-24 21:56:24 +00001974*markfilelist* *global_markfilelist* *local_markfilelist*
1975All marked files are entered onto the global marked file list; there is only
1976one such list. In addition, every netrw buffer also has its own local marked
1977file list; since netrw buffers are associated with specific directories, this
1978means that each directory has its own local marked file list. The various
1979commands which operate on marked files use one or the other of the marked file
1980lists.
1981
Bram Moolenaara6878372014-03-22 21:02:50 +01001982Known Problem: if one is using tree mode (|g:netrw_liststyle|) and several
1983directories have files with the same name, then marking such a file will
1984result in all such files being highlighted as if they were all marked. The
1985|markfilelist|, however, will only have the selected file in it. This problem
1986is unlikely to be fixed.
1987
Bram Moolenaar446cb832008-06-24 21:56:24 +00001988
Bram Moolenaarff034192013-04-24 18:51:19 +02001989UNMARKING FILES *netrw-mF* {{{2
1990 (also see |netrw-mf|)
1991
1992This command will unmark all files in the current buffer. One may also use
1993mf (|netrw-mf|) on a specific file to unmark just that file.
1994
1995
1996MARKING FILES BY QUICKFIX LIST *netrw-qF*
1997 (also see |netrw-mf|)
1998
1999One may convert the |quickfix-error-lists| into a marked file list using
2000"qF". You may then proceed with commands such as me (|netrw-me|) to
2001edit them. Quickfix error lists are generated, for example, by calls
2002to |:vimgrep|.
2003
2004
Bram Moolenaar446cb832008-06-24 21:56:24 +00002005MARKING FILES BY REGULAR EXPRESSION *netrw-mr* {{{2
2006 (also see |netrw-mf|)
2007
2008One may also mark files by pressing "mr"; netrw will then issue a prompt,
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002009"Enter regexp: ". You may then enter a shell-style regular expression such
2010as *.c$ (see |glob()|). For remote systems, glob() doesn't work -- so netrw
2011converts "*" into ".*" (see |regexp|) and marks files based on that. In the
2012future I may make it possible to use |regexp|s instead of glob()-style
2013expressions (yet-another-option).
Bram Moolenaar446cb832008-06-24 21:56:24 +00002014
2015
2016MARKED FILES: ARBITRARY COMMAND *netrw-mx* {{{2
2017 (See |netrw-mf| and |netrw-mr| for how to mark files)
2018 (uses the local marked-file list)
2019
2020Upon activation of the "mx" map, netrw will query the user for some (external)
2021command to be applied to all marked files. All "%"s in the command will be
2022substituted with the name of each marked file in turn. If no "%"s are in the
2023command, then the command will be followed by a space and a marked filename.
2024
2025
2026MARKED FILES: COMPRESSION AND DECOMPRESSION *netrw-mz* {{{2
2027 (See |netrw-mf| and |netrw-mr| for how to mark files)
2028 (uses the local marked file list)
2029
2030If any marked files are compressed, then "mz" will decompress them.
2031If any marked files are decompressed, then "mz" will compress them
2032using the command specified by |g:netrw_compress|; by default,
2033that's "gzip".
2034
2035For decompression, netrw provides a |Dictionary| of suffices and their
2036associated decompressing utilities; see |g:netrw_decompress|.
2037
2038Associated setting variables: |g:netrw_compress| |g:netrw_decompress|
2039
2040MARKED FILES: COPYING *netrw-mc* {{{2
2041 (See |netrw-mf| and |netrw-mr| for how to mark files)
2042 (Uses the global marked file list)
2043
2044Select a target directory with mt (|netrw-mt|). Then change directory,
Bram Moolenaaradc21822011-04-01 18:03:16 +02002045select file(s) (see |netrw-mf|), and press "mc". The copy is done
2046from the current window (where one does the mf) to the target.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002047
2048Associated setting variable: |g:netrw_localcopycmd| |g:netrw_ssh_cmd|
2049
2050MARKED FILES: DIFF *netrw-md* {{{2
2051 (See |netrw-mf| and |netrw-mr| for how to mark files)
2052 (uses the global marked file list)
2053
2054Use |vimdiff| to visualize difference between selected files (two or
2055three may be selected for this). Uses the global marked file list.
2056
2057MARKED FILES: EDITING *netrw-me* {{{2
2058 (See |netrw-mf| and |netrw-mr| for how to mark files)
2059 (uses the global marked file list)
2060
2061This command will place the marked files on the |arglist| and commence
2062editing them. One may return the to explorer window with |:Rexplore|.
Bram Moolenaarff034192013-04-24 18:51:19 +02002063(use |:n| and |:p| to edit next and previous files in the arglist)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002064
2065MARKED FILES: GREP *netrw-mg* {{{2
2066 (See |netrw-mf| and |netrw-mr| for how to mark files)
2067 (uses the global marked file list)
2068
Bram Moolenaarff034192013-04-24 18:51:19 +02002069This command will apply |:vimgrep| to the marked files.
2070The command will ask for the requested pattern; one may then enter: >
2071
Bram Moolenaar446cb832008-06-24 21:56:24 +00002072 /pattern/[g][j]
2073 ! /pattern/[g][j]
2074 pattern
2075<
Bram Moolenaarff034192013-04-24 18:51:19 +02002076In the cases of "j" option usage as shown above, "mg" will winnow the current
2077marked file list to just those possessing the specified pattern.
2078Thus, one may use >
2079 mr ...file-pattern
2080 mg ..contents-pattern
2081to have a marked file list satisfying the file-pattern but containing the
2082desried contents-pattern.
2083
Bram Moolenaar446cb832008-06-24 21:56:24 +00002084MARKED FILES: HIDING AND UNHIDING BY SUFFIX *netrw-mh* {{{2
2085 (See |netrw-mf| and |netrw-mr| for how to mark files)
2086 (uses the local marked file list)
2087
2088This command extracts the suffices of the marked files and toggles their
2089presence on the hiding list. Please note that marking the same suffix
2090this way multiple times will result in the suffix's presence being toggled
2091for each file (so an even quantity of marked files having the same suffix
2092is the same as not having bothered to select them at all).
2093
2094Related topics: |netrw-a| |g:netrw_list_hide|
2095
2096MARKED FILES: MOVING *netrw-mm* {{{2
2097 (See |netrw-mf| and |netrw-mr| for how to mark files)
2098 (uses the global marked file list)
2099
Bram Moolenaare37d50a2008-08-06 17:06:04 +00002100 WARNING: moving files is more dangerous than copying them.
2101 A file being moved is first copied and then deleted; if the
2102 copy operation fails and the delete succeeds, you will lose
2103 the file. Either try things out with unimportant files
2104 first or do the copy and then delete yourself using mc and D.
2105 Use at your own risk!
2106
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002107Select a target directory with mt (|netrw-mt|). Then change directory,
Bram Moolenaaradc21822011-04-01 18:03:16 +02002108select file(s) (see |netrw-mf|), and press "mm". The move is done
2109from the current window (where one does the mf) to the target.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002110
2111Associated setting variable: |g:netrw_localmovecmd| |g:netrw_ssh_cmd|
2112
2113MARKED FILES: PRINTING *netrw-mp* {{{2
2114 (See |netrw-mf| and |netrw-mr| for how to mark files)
2115 (uses the local marked file list)
2116
2117Netrw will apply the |:hardcopy| command to marked files. What it does
2118is open each file in a one-line window, execute hardcopy, then close the
2119one-line window.
2120
2121
2122MARKED FILES: SOURCING *netrw-ms* {{{2
2123 (See |netrw-mf| and |netrw-mr| for how to mark files)
2124 (uses the local marked file list)
2125
2126Netrw will source the marked files (using vim's |:source| command)
2127
2128
Bram Moolenaarff034192013-04-24 18:51:19 +02002129MARKED FILES: SETTING THE TARGET DIRECTORY *netrw-mt* {{{2
2130 (See |netrw-mf| and |netrw-mr| for how to mark files)
2131
2132Set the marked file copy/move-to target (see |netrw-mc| and |netrw-mm|):
2133
2134 * If the cursor is atop a file name, then the netrw window's currently
2135 displayed directory is used for the copy/move-to target.
2136
2137 * Also, if the cursor is in the banner, then the netrw window's currently
2138 displayed directory is used for the copy/move-to target.
2139 Unless the target already is the current directory. In which case,
2140 remove the target.
2141
2142 * However, if the cursor is atop a directory name, then that directory is
2143 used for the copy/move-to target
2144
Bram Moolenaara6878372014-03-22 21:02:50 +01002145 * One may use the :MT [directory] command to set the target *netrw-:MT*
2146 This command uses |<q-args>|, so spaces in the directory name are
2147 permitted without escaping.
2148
Bram Moolenaarff034192013-04-24 18:51:19 +02002149There is only one copy/move-to target per vim session; ie. the target is a
2150script variable (see |s:var|) and is shared between all netrw windows (in an
2151instance of vim).
2152
2153When using menus and gvim, netrw provides a "Targets" entry which allows one
2154to pick a target from the list of bookmarks and history.
2155
2156Related topics:
2157 Marking Files......................................|netrw-mf|
2158 Marking Files by Regular Expression................|netrw-mr|
2159 Marked Files: Target Directory Using Bookmarks.....|netrw-Tb|
2160 Marked Files: Target Directory Using History.......|netrw-Th|
2161
2162
Bram Moolenaar446cb832008-06-24 21:56:24 +00002163MARKED FILES: TAGGING *netrw-mT* {{{2
2164 (See |netrw-mf| and |netrw-mr| for how to mark files)
2165 (uses the global marked file list)
2166
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002167The "mT" mapping will apply the command in |g:netrw_ctags| (by default, it is
Bram Moolenaar446cb832008-06-24 21:56:24 +00002168"ctags") to marked files. For remote browsing, in order to create a tags file
2169netrw will use ssh (see |g:netrw_ssh_cmd|), and so ssh must be available for
2170this to work on remote systems. For your local system, see |ctags| on how to
2171get a version. I myself use hdrtags, currently available at
Bram Moolenaar97d62492012-11-15 21:28:22 +01002172http://www.drchip.org/astronaut/src/index.html , and have >
Bram Moolenaar446cb832008-06-24 21:56:24 +00002173
2174 let g:netrw_ctags= "hdrtag"
2175<
2176in my <.vimrc>.
2177
2178When a remote set of files are tagged, the resulting tags file is "obtained";
Bram Moolenaara6878372014-03-22 21:02:50 +01002179ie. a copy is transferred to the local system's directory. The now local tags
Bram Moolenaar446cb832008-06-24 21:56:24 +00002180file is then modified so that one may use it through the network. The
Bram Moolenaara6878372014-03-22 21:02:50 +01002181modification made concerns the names of the files in the tags; each filename is
Bram Moolenaar446cb832008-06-24 21:56:24 +00002182preceded by the netrw-compatible url used to obtain it. When one subsequently
2183uses one of the go to tag actions (|tags|), the url will be used by netrw to
2184edit the desired file and go to the tag.
2185
Bram Moolenaarc236c162008-07-13 17:41:49 +00002186Associated setting variables: |g:netrw_ctags| |g:netrw_ssh_cmd|
Bram Moolenaar446cb832008-06-24 21:56:24 +00002187
Bram Moolenaarff034192013-04-24 18:51:19 +02002188MARKED FILES: TARGET DIRECTORY USING BOOKMARKS *netrw-Tb* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002189
Bram Moolenaara6878372014-03-22 21:02:50 +01002190Sets the marked file copy/move-to target.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002191
Bram Moolenaarff034192013-04-24 18:51:19 +02002192The |netrw-qb| map will give you a list of bookmarks (and history).
2193One may choose one of the bookmarks to become your marked file
2194target by using [count]Tb (default count: 1).
Bram Moolenaar446cb832008-06-24 21:56:24 +00002195
Bram Moolenaarff034192013-04-24 18:51:19 +02002196Related topics:
Bram Moolenaara6878372014-03-22 21:02:50 +01002197 Copying files to target............................|netrw-mc|
Bram Moolenaarff034192013-04-24 18:51:19 +02002198 Listing Bookmarks and History......................|netrw-qb|
2199 Marked Files: Setting The Target Directory.........|netrw-mt|
2200 Marked Files: Target Directory Using History.......|netrw-Th|
2201 Marking Files......................................|netrw-mf|
2202 Marking Files by Regular Expression................|netrw-mr|
Bram Moolenaara6878372014-03-22 21:02:50 +01002203 Moving files to target.............................|netrw-mm|
Bram Moolenaar446cb832008-06-24 21:56:24 +00002204
Bram Moolenaar446cb832008-06-24 21:56:24 +00002205
Bram Moolenaarff034192013-04-24 18:51:19 +02002206MARKED FILES: TARGET DIRECTORY USING HISTORY *netrw-Th* {{{2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002207
Bram Moolenaara6878372014-03-22 21:02:50 +01002208Sets the marked file copy/move-to target.
Bram Moolenaarff034192013-04-24 18:51:19 +02002209
2210The |netrw-qb| map will give you a list of history (and bookmarks).
2211One may choose one of the history entries to become your marked file
2212target by using [count]Th (default count: 0; ie. the current directory).
2213
2214Related topics:
Bram Moolenaara6878372014-03-22 21:02:50 +01002215 Copying files to target............................|netrw-mc|
Bram Moolenaarff034192013-04-24 18:51:19 +02002216 Listing Bookmarks and History......................|netrw-qb|
2217 Marked Files: Setting The Target Directory.........|netrw-mt|
2218 Marked Files: Target Directory Using Bookmarks.....|netrw-Tb|
2219 Marking Files......................................|netrw-mf|
2220 Marking Files by Regular Expression................|netrw-mr|
Bram Moolenaara6878372014-03-22 21:02:50 +01002221 Moving files to target.............................|netrw-mm|
Bram Moolenaarff034192013-04-24 18:51:19 +02002222
Bram Moolenaar446cb832008-06-24 21:56:24 +00002223
2224MARKED FILES: UNMARKING *netrw-mu* {{{2
2225 (See |netrw-mf| and |netrw-mr| for how to mark files)
2226
2227The "mu" mapping will unmark all currently marked files.
2228
Bram Moolenaar15146672011-10-20 22:22:38 +02002229 *netrw-browser-settings*
Bram Moolenaar446cb832008-06-24 21:56:24 +00002230NETRW BROWSER VARIABLES *netrw-browser-options* *netrw-browser-var* {{{2
2231
Bram Moolenaar15146672011-10-20 22:22:38 +02002232(if you're interested in the netrw file transfer settings, see |netrw-options|
2233 and |netrw-protocol|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002234
2235The <netrw.vim> browser provides settings in the form of variables which
2236you may modify; by placing these settings in your <.vimrc>, you may customize
2237your browsing preferences. (see also: |netrw-settings|)
2238>
2239 --- -----------
2240 Var Explanation
2241 --- -----------
Bram Moolenaar8d043172014-01-23 14:24:41 +01002242< *g:netrw_altfile* some like |CTRL-^| to return to the last
2243 edited file. Choose that by setting this
2244 parameter to 1.
2245 Others like |CTRL-^| to return to the
2246 netrw browsing buffer. Choose that by setting
2247 this parameter to 0.
2248 default: =0
2249
2250 *g:netrw_alto* change from above splitting to below splitting
Bram Moolenaar446cb832008-06-24 21:56:24 +00002251 by setting this variable (see |netrw-o|)
2252 default: =&sb (see |'sb'|)
2253
Bram Moolenaarff034192013-04-24 18:51:19 +02002254 *g:netrw_altv* change from left splitting to right splitting
Bram Moolenaar446cb832008-06-24 21:56:24 +00002255 by setting this variable (see |netrw-v|)
2256 default: =&spr (see |'spr'|)
2257
Bram Moolenaarff034192013-04-24 18:51:19 +02002258 *g:netrw_banner* enable/suppress the banner
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002259 =0: suppress the banner
2260 =1: banner is enabled (default)
2261 NOTE: suppressing the banner is a new feature
2262 which may cause problems.
2263
Bram Moolenaare6ae6222013-05-21 21:01:10 +02002264 *g:netrw_bannerbackslash* if this variable exists and is not zero, the
2265 banner will be displayed with backslashes
2266 rather than forward slashes.
2267
Bram Moolenaarff034192013-04-24 18:51:19 +02002268 *g:netrw_browse_split* when browsing, <cr> will open the file by:
Bram Moolenaar446cb832008-06-24 21:56:24 +00002269 =0: re-using the same window
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002270 =1: horizontally splitting the window first
2271 =2: vertically splitting the window first
Bram Moolenaar446cb832008-06-24 21:56:24 +00002272 =3: open file in new tab
2273 =4: act like "P" (ie. open previous window)
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002274 Note that |g:netrw_preview| may be used
2275 to get vertical splitting instead of
2276 horizontal splitting.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002277
Bram Moolenaar8d043172014-01-23 14:24:41 +01002278 Related topics:
2279 |netrw-cr| |netrw-C|
2280 |g:netrw_alto| |g:netrw_altv|
2281
Bram Moolenaarff034192013-04-24 18:51:19 +02002282 *g:netrw_browsex_viewer* specify user's preference for a viewer: >
Bram Moolenaar446cb832008-06-24 21:56:24 +00002283 "kfmclient exec"
2284 "gnome-open"
2285< If >
2286 "-"
2287< is used, then netrwFileHandler() will look for
2288 a script/function to handle the given
2289 extension. (see |netrw_filehandler|).
2290
Bram Moolenaarff034192013-04-24 18:51:19 +02002291 *g:netrw_chgperm* Unix/Linux: "chmod PERM FILENAME"
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002292 Windows: "cacls FILENAME /e /p PERM"
2293 Used to change access permission for a file.
2294
Bram Moolenaarff034192013-04-24 18:51:19 +02002295 *g:netrw_compress* ="gzip"
Bram Moolenaar446cb832008-06-24 21:56:24 +00002296 Will compress marked files with this
2297 command
2298
Bram Moolenaarff034192013-04-24 18:51:19 +02002299 *g:Netrw_corehandler* Allows one to specify something additional
Bram Moolenaar15146672011-10-20 22:22:38 +02002300 to do when handling <core> files via netrw's
2301 browser's "x" command (see |netrw-x|). If
2302 present, g:Netrw_corehandler specifies
2303 either one or more function references
2304 (see |Funcref|). (the capital g:Netrw...
2305 is required its holding a function reference)
2306
2307
Bram Moolenaarff034192013-04-24 18:51:19 +02002308 *g:netrw_ctags* ="ctags"
2309 The default external program used to create
2310 tags
Bram Moolenaarc236c162008-07-13 17:41:49 +00002311
Bram Moolenaarff034192013-04-24 18:51:19 +02002312 *g:netrw_cursor* = 2 (default)
Bram Moolenaaradc21822011-04-01 18:03:16 +02002313 This option controls the use of the
2314 |'cursorline'| (cul) and |'cursorcolumn'|
2315 (cuc) settings by netrw:
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002316
Bram Moolenaaradc21822011-04-01 18:03:16 +02002317 Value Thin-Long-Tree Wide
2318 =0 u-cul u-cuc u-cul u-cuc
2319 =1 u-cul u-cuc cul u-cuc
2320 =2 cul u-cuc cul u-cuc
2321 =3 cul u-cuc cul cuc
2322 =4 cul cuc cul cuc
2323
2324 Where
2325 u-cul : user's |'cursorline'| setting used
2326 u-cuc : user's |'cursorcolumn'| setting used
2327 cul : |'cursorline'| locally set
2328 cuc : |'cursorcolumn'| locally set
2329
Bram Moolenaarff034192013-04-24 18:51:19 +02002330 *g:netrw_decompress* = { ".gz" : "gunzip" ,
Bram Moolenaar446cb832008-06-24 21:56:24 +00002331 ".bz2" : "bunzip2" ,
2332 ".zip" : "unzip" ,
2333 ".tar" : "tar -xf"}
2334 A dictionary mapping suffices to
2335 decompression programs.
2336
Bram Moolenaaradc21822011-04-01 18:03:16 +02002337 *g:netrw_dirhistmax* =10: controls maximum quantity of past
2338 history. May be zero to supppress
2339 history.
2340 (related: |netrw-qb| |netrw-u| |netrw-U|)
2341
Bram Moolenaar97d62492012-11-15 21:28:22 +01002342 *g:netrw_dynamic_maxfilenamelen* =32: enables dynamic determination of
2343 |g:netrw_maxfilenamelen|, which affects
2344 local file long listing.
Bram Moolenaara6878372014-03-22 21:02:50 +01002345
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002346 *g:netrw_errorlvl* =0: error levels greater than or equal to
2347 this are permitted to be displayed
2348 0: notes
2349 1: warnings
2350 2: errors
2351
Bram Moolenaarff034192013-04-24 18:51:19 +02002352 *g:netrw_fastbrowse* =0: slow speed directory browsing;
Bram Moolenaar446cb832008-06-24 21:56:24 +00002353 never re-uses directory listings,
2354 always obtains directory listings.
2355 =1: medium speed directory browsing;
2356 re-use directory listings only
2357 when remote directory browsing.
2358 (default value)
2359 =2: fast directory browsing;
2360 only obtains directory listings when the
2361 directory hasn't been seen before
2362 (or |netrw-ctrl-l| is used).
2363
2364 Fast browsing retains old directory listing
2365 buffers so that they don't need to be
2366 re-acquired. This feature is especially
2367 important for remote browsing. However, if
2368 a file is introduced or deleted into or from
2369 such directories, the old directory buffer
2370 becomes out-of-date. One may always refresh
2371 such a directory listing with |netrw-ctrl-l|.
2372 This option gives the user the choice of
2373 trading off accuracy (ie. up-to-date listing)
2374 versus speed.
2375
Bram Moolenaarff034192013-04-24 18:51:19 +02002376 *g:netrw_fname_escape* =' ?&;%'
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002377 Used on filenames before remote reading/writing
Bram Moolenaar446cb832008-06-24 21:56:24 +00002378
Bram Moolenaarff034192013-04-24 18:51:19 +02002379 *g:netrw_ftp_browse_reject* ftp can produce a number of errors and warnings
Bram Moolenaar446cb832008-06-24 21:56:24 +00002380 that can show up as "directories" and "files"
2381 in the listing. This pattern is used to
2382 remove such embedded messages. By default its
2383 value is:
2384 '^total\s\+\d\+$\|
2385 ^Trying\s\+\d\+.*$\|
2386 ^KERBEROS_V\d rejected\|
2387 ^Security extensions not\|
2388 No such file\|
2389 : connect to address [0-9a-fA-F:]*
2390 : No route to host$'
2391
Bram Moolenaarff034192013-04-24 18:51:19 +02002392 *g:netrw_ftp_list_cmd* options for passing along to ftp for directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002393 listing. Defaults:
2394 unix or g:netrw_cygwin set: : "ls -lF"
2395 otherwise "dir"
2396
2397
Bram Moolenaarff034192013-04-24 18:51:19 +02002398 *g:netrw_ftp_sizelist_cmd* options for passing along to ftp for directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002399 listing, sorted by size of file.
2400 Defaults:
2401 unix or g:netrw_cygwin set: : "ls -slF"
2402 otherwise "dir"
2403
Bram Moolenaarff034192013-04-24 18:51:19 +02002404 *g:netrw_ftp_timelist_cmd* options for passing along to ftp for directory
Bram Moolenaar446cb832008-06-24 21:56:24 +00002405 listing, sorted by time of last modification.
2406 Defaults:
2407 unix or g:netrw_cygwin set: : "ls -tlF"
2408 otherwise "dir"
2409
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002410 *g:netrw_glob_escape* ='[]*?`{~$' (unix)
Bram Moolenaar00a927d2010-05-14 23:24:24 +02002411 ='[]*?`{$' (windows
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002412 These characters in directory names are
Bram Moolenaar446cb832008-06-24 21:56:24 +00002413 escaped before applying glob()
2414
Bram Moolenaarff034192013-04-24 18:51:19 +02002415 *g:netrw_hide* Controlled by the "a" map (see |netrw-a|)
2416 =0 : show all
2417 =1 : show not-hidden files
2418 =2 : show hidden files only
Bram Moolenaar446cb832008-06-24 21:56:24 +00002419 default: =0
2420
Bram Moolenaarff034192013-04-24 18:51:19 +02002421 *g:netrw_home* The home directory for where bookmarks and
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002422 history are saved (as .netrwbook and
2423 .netrwhist).
2424 default: the first directory on the
2425 |'runtimepath'|
2426
Bram Moolenaarff034192013-04-24 18:51:19 +02002427 *g:netrw_keepdir* =1 (default) keep current directory immune from
Bram Moolenaar446cb832008-06-24 21:56:24 +00002428 the browsing directory.
2429 =0 keep the current directory the same as the
2430 browsing directory.
2431 The current browsing directory is contained in
2432 b:netrw_curdir (also see |netrw-c|)
2433
Bram Moolenaarff034192013-04-24 18:51:19 +02002434 *g:netrw_list_cmd* command for listing remote directories
Bram Moolenaar446cb832008-06-24 21:56:24 +00002435 default: (if ssh is executable)
2436 "ssh HOSTNAME ls -FLa"
2437
Bram Moolenaarff034192013-04-24 18:51:19 +02002438 *g:netrw_liststyle* Set the default listing style:
Bram Moolenaar446cb832008-06-24 21:56:24 +00002439 = 0: thin listing (one file per line)
2440 = 1: long listing (one file per line with time
2441 stamp information and file size)
2442 = 2: wide listing (multiple files in columns)
2443 = 3: tree style listing
Bram Moolenaar8d043172014-01-23 14:24:41 +01002444
Bram Moolenaarff034192013-04-24 18:51:19 +02002445 *g:netrw_list_hide* comma separated pattern list for hiding files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002446 Patterns are regular expressions (see |regexp|)
Bram Moolenaar8d043172014-01-23 14:24:41 +01002447 There's some special support for git-ignore
2448 files: you may add the output from the helper
2449 function 'netrw_gitignore#Hide() automatically
2450 hiding all gitignored files.
2451 For more details see |netrw-gitignore|.
2452
2453 Examples:
2454 let g:netrw_list_hide= '.*\.swp$'
2455 let g:netrw_list_hide= netrw_gitignore#Hide().'.*\.swp$'
2456 default: ""
Bram Moolenaar446cb832008-06-24 21:56:24 +00002457
Bram Moolenaarff034192013-04-24 18:51:19 +02002458 *g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002459 ="copy" Windows
Bram Moolenaar446cb832008-06-24 21:56:24 +00002460 Copies marked files (|netrw-mf|) to target
2461 directory (|netrw-mt|, |netrw-mc|)
2462
Bram Moolenaare6ae6222013-05-21 21:01:10 +02002463 *g:netrw_localmkdir* command for making a local directory
2464 default: "mkdir"
2465
Bram Moolenaarff034192013-04-24 18:51:19 +02002466 *g:netrw_localmovecmd* ="mv" Linux/Unix/MacOS/Cygwin
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002467 ="move" Windows
Bram Moolenaar446cb832008-06-24 21:56:24 +00002468 Moves marked files (|netrw-mf|) to target
2469 directory (|netrw-mt|, |netrw-mm|)
2470
Bram Moolenaarff034192013-04-24 18:51:19 +02002471 *g:netrw_localrmdir* remove directory command (rmdir)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002472 default: "rmdir"
2473
Bram Moolenaarff034192013-04-24 18:51:19 +02002474 *g:netrw_maxfilenamelen* =32 by default, selected so as to make long
Bram Moolenaar446cb832008-06-24 21:56:24 +00002475 listings fit on 80 column displays.
2476 If your screen is wider, and you have file
2477 or directory names longer than 32 bytes,
2478 you may set this option to keep listings
2479 columnar.
2480
Bram Moolenaarff034192013-04-24 18:51:19 +02002481 *g:netrw_mkdir_cmd* command for making a remote directory
Bram Moolenaar15146672011-10-20 22:22:38 +02002482 via ssh (also see |g:netrw_remote_mkdir|)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002483 default: "ssh USEPORT HOSTNAME mkdir"
2484
Bram Moolenaar251e1912011-06-19 05:09:16 +02002485 *g:netrw_mousemaps* =1 (default) enables mouse buttons while
2486 browsing to:
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002487 leftmouse : open file/directory
2488 shift-leftmouse : mark file
2489 middlemouse : same as P
2490 rightmouse : remove file/directory
2491 =0: disables mouse maps
2492
Bram Moolenaar15146672011-10-20 22:22:38 +02002493 *g:netrw_nobeval* doesn't exist (default)
2494 If this variable exists, then balloon
2495 evaluation will be suppressed
2496 (see |'ballooneval'|)
2497
Bram Moolenaara6878372014-03-22 21:02:50 +01002498 *g:netrw_remote_mkdir* command for making a remote directory
Bram Moolenaar15146672011-10-20 22:22:38 +02002499 via ftp (also see |g:netrw_mkdir_cmd|)
2500 default: "mkdir"
2501
Bram Moolenaarff034192013-04-24 18:51:19 +02002502 *g:netrw_retmap* if it exists and is set to one, then:
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002503 * if in a netrw-selected file, AND
2504 * no normal-mode <2-leftmouse> mapping exists,
2505 then the <2-leftmouse> will be mapped for easy
Bram Moolenaar446cb832008-06-24 21:56:24 +00002506 return to the netrw browser window.
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002507 example: click once to select and open a file,
2508 double-click to return.
2509
2510 Note that one may instead choose to:
2511 * let g:netrw_retmap= 1, AND
2512 * nmap <silent> YourChoice <Plug>NetrwReturn
2513 and have another mapping instead of
2514 <2-leftmouse> to invoke the return.
2515
2516 You may also use the |:Rexplore| command to do
2517 the same thing.
2518
Bram Moolenaar446cb832008-06-24 21:56:24 +00002519 default: =0
2520
Bram Moolenaarff034192013-04-24 18:51:19 +02002521 *g:netrw_rm_cmd* command for removing files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002522 default: "ssh USEPORT HOSTNAME rm"
2523
Bram Moolenaarff034192013-04-24 18:51:19 +02002524 *g:netrw_rmdir_cmd* command for removing directories
Bram Moolenaar446cb832008-06-24 21:56:24 +00002525 default: "ssh USEPORT HOSTNAME rmdir"
2526
Bram Moolenaarff034192013-04-24 18:51:19 +02002527 *g:netrw_rmf_cmd* command for removing softlinks
Bram Moolenaar446cb832008-06-24 21:56:24 +00002528 default: "ssh USEPORT HOSTNAME rm -f"
2529
Bram Moolenaarff034192013-04-24 18:51:19 +02002530 *g:netrw_sort_by* sort by "name", "time", or "size"
Bram Moolenaar446cb832008-06-24 21:56:24 +00002531 default: "name"
2532
Bram Moolenaarff034192013-04-24 18:51:19 +02002533 *g:netrw_sort_direction* sorting direction: "normal" or "reverse"
Bram Moolenaar446cb832008-06-24 21:56:24 +00002534 default: "normal"
2535
Bram Moolenaarff034192013-04-24 18:51:19 +02002536 *g:netrw_sort_options* sorting is done using |:sort|; this
Bram Moolenaarc236c162008-07-13 17:41:49 +00002537 variable's value is appended to the
2538 sort command. Thus one may ignore case,
2539 for example, with the following in your
2540 .vimrc: >
2541 let g:netrw_sort_options="i"
2542< default: ""
2543
Bram Moolenaarff034192013-04-24 18:51:19 +02002544 *g:netrw_sort_sequence* when sorting by name, first sort by the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002545 comma-separated pattern sequence. Note that
Bram Moolenaara6878372014-03-22 21:02:50 +01002546 any filigree added to indicate filetypes
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002547 should be accounted for in your pattern.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002548 default: '[\/]$,*,\.bak$,\.o$,\.h$,
2549 \.info$,\.swp$,\.obj$'
2550
Bram Moolenaarff034192013-04-24 18:51:19 +02002551 *g:netrw_special_syntax* If true, then certain files will be shown
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002552 using special syntax in the browser:
Bram Moolenaar446cb832008-06-24 21:56:24 +00002553
2554 netrwBak : *.bak
2555 netrwCompress: *.gz *.bz2 *.Z *.zip
2556 netrwData : *.dat
2557 netrwHdr : *.h
2558 netrwLib : *.a *.so *.lib *.dll
2559 netrwMakefile: [mM]akefile *.mak
2560 netrwObj : *.o *.obj
2561 netrwTags : tags ANmenu ANtags
Bram Moolenaara6878372014-03-22 21:02:50 +01002562 netrwTilde : *
Bram Moolenaar446cb832008-06-24 21:56:24 +00002563 netrwTmp : tmp* *tmp
2564
2565 These syntax highlighting groups are linked
2566 to Folded or DiffChange by default
2567 (see |hl-Folded| and |hl-DiffChange|), but
2568 one may put lines like >
2569 hi link netrwCompress Visual
2570< into one's <.vimrc> to use one's own
Bram Moolenaara6878372014-03-22 21:02:50 +01002571 preferences. Alternatively, one may
2572 put such specifications into
2573 .vim/after/syntax/netrw.vim.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002574
Bram Moolenaara6878372014-03-22 21:02:50 +01002575 As an example, I myself use a dark-background
2576 colorscheme with the following in
2577 .vim/after/syntax/netrw.vim: >
2578
2579 hi netrwCompress term=NONE cterm=NONE gui=NONE ctermfg=10 guifg=green ctermbg=0 guibg=black
2580 hi netrwData term=NONE cterm=NONE gui=NONE ctermfg=9 guifg=blue ctermbg=0 guibg=black
2581 hi netrwHdr term=NONE cterm=NONE,italic gui=NONE guifg=SeaGreen1
2582 hi netrwLex term=NONE cterm=NONE,italic gui=NONE guifg=SeaGreen1
2583 hi netrwYacc term=NONE cterm=NONE,italic gui=NONE guifg=SeaGreen1
2584 hi netrwLib term=NONE cterm=NONE gui=NONE ctermfg=14 guifg=yellow
2585 hi netrwObj term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
2586 hi netrwTilde term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
2587 hi netrwTmp term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
2588 hi netrwTags term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red
2589 hi netrwDoc term=NONE cterm=NONE gui=NONE ctermfg=220 ctermbg=27 guifg=yellow2 guibg=Blue3
2590 hi netrwSymLink term=NONE cterm=NONE gui=NONE ctermfg=220 ctermbg=27 guifg=grey60
2591<
Bram Moolenaarff034192013-04-24 18:51:19 +02002592 *g:netrw_ssh_browse_reject* ssh can sometimes produce unwanted lines,
Bram Moolenaar446cb832008-06-24 21:56:24 +00002593 messages, banners, and whatnot that one doesn't
2594 want masquerading as "directories" and "files".
2595 Use this pattern to remove such embedded
2596 messages. By default its value is:
2597 '^total\s\+\d\+$'
2598
Bram Moolenaare6ae6222013-05-21 21:01:10 +02002599 *g:netrw_ssh_cmd* One may specify an executable command
2600 to use instead of ssh for remote actions
2601 such as listing, file removal, etc.
2602 default: ssh
2603
Bram Moolenaar446cb832008-06-24 21:56:24 +00002604
Bram Moolenaarff034192013-04-24 18:51:19 +02002605 *g:netrw_tmpfile_escape* =' &;'
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002606 escape() is applied to all temporary files
Bram Moolenaar446cb832008-06-24 21:56:24 +00002607 to escape these characters.
2608
Bram Moolenaarff034192013-04-24 18:51:19 +02002609 *g:netrw_timefmt* specify format string to vim's strftime().
Bram Moolenaar446cb832008-06-24 21:56:24 +00002610 The default, "%c", is "the preferred date
2611 and time representation for the current
2612 locale" according to my manpage entry for
2613 strftime(); however, not all are satisfied
2614 with it. Some alternatives:
2615 "%a %d %b %Y %T",
2616 " %a %Y-%m-%d %I-%M-%S %p"
2617 default: "%c"
2618
Bram Moolenaarff034192013-04-24 18:51:19 +02002619 *g:netrw_use_noswf* netrw normally avoids writing swapfiles
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002620 for browser buffers. However, under some
Bram Moolenaar446cb832008-06-24 21:56:24 +00002621 systems this apparently is causing nasty
2622 ml_get errors to appear; if you're getting
2623 ml_get errors, try putting
2624 let g:netrw_use_noswf= 0
2625 in your .vimrc.
Bram Moolenaara6878372014-03-22 21:02:50 +01002626 default: 1
Bram Moolenaar446cb832008-06-24 21:56:24 +00002627
Bram Moolenaarff034192013-04-24 18:51:19 +02002628 *g:netrw_winsize* specify initial size of new windows made with
Bram Moolenaar446cb832008-06-24 21:56:24 +00002629 "o" (see |netrw-o|), "v" (see |netrw-v|),
Bram Moolenaar251e1912011-06-19 05:09:16 +02002630 |:Hexplore| or |:Vexplore|. The g:netrw_winsize
2631 is an integer describing the percentage of the
2632 current netrw buffer's window to be used for
2633 the new window.
Bram Moolenaar15146672011-10-20 22:22:38 +02002634 If g:netrw_winsize is less than zero, then
2635 the absolute value of g:netrw_winsize lines
2636 or columns will be used for the new window.
Bram Moolenaar251e1912011-06-19 05:09:16 +02002637 default: 50 (for 50%)
Bram Moolenaar446cb832008-06-24 21:56:24 +00002638
Bram Moolenaarff034192013-04-24 18:51:19 +02002639 *g:netrw_xstrlen* Controls how netrw computes string lengths,
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002640 including multi-byte characters' string
Bram Moolenaar446cb832008-06-24 21:56:24 +00002641 length. (thanks to N Weibull, T Mechelynck)
2642 =0: uses Vim's built-in strlen()
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002643 =1: number of codepoints (Latin a + combining
Bram Moolenaar446cb832008-06-24 21:56:24 +00002644 circumflex is two codepoints) (DEFAULT)
2645 =2: number of spacing codepoints (Latin a +
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002646 combining circumflex is one spacing
Bram Moolenaar446cb832008-06-24 21:56:24 +00002647 codepoint; a hard tab is one; wide and
2648 narrow CJK are one each; etc.)
2649 =3: virtual length (counting tabs as anything
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002650 between 1 and |'tabstop'|, wide CJK as 2
Bram Moolenaar446cb832008-06-24 21:56:24 +00002651 rather than 1, Arabic alif as zero when
2652 immediately preceded by lam, one
2653 otherwise, etc)
2654
Bram Moolenaarff034192013-04-24 18:51:19 +02002655 *g:NetrwTopLvlMenu* This variable specifies the top level
Bram Moolenaar446cb832008-06-24 21:56:24 +00002656 menu name; by default, it's "Netrw.". If
2657 you wish to change this, do so in your
2658 .vimrc.
2659
2660NETRW BROWSING AND OPTION INCOMPATIBILITIES *netrw-incompatible* {{{2
2661
2662Netrw has been designed to handle user options by saving them, setting the
2663options to something that's compatible with netrw's needs, and then restoring
2664them. However, the autochdir option: >
2665 :set acd
Bram Moolenaara6878372014-03-22 21:02:50 +01002666is problematic. Autochdir sets the current directory to that containing the
Bram Moolenaar446cb832008-06-24 21:56:24 +00002667file you edit; this apparently also applies to directories. In other words,
2668autochdir sets the current directory to that containing the "file" (even if
2669that "file" is itself a directory).
2670
Bram Moolenaar15146672011-10-20 22:22:38 +02002671NETRW SETTINGS WINDOW *netrw-settings-window* {{{2
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00002672
2673With the NetrwSettings.vim plugin, >
2674 :NetrwSettings
2675will bring up a window with the many variables that netrw uses for its
Bram Moolenaar1afcace2005-11-25 19:54:28 +00002676settings. You may change any of their values; when you save the file, the
2677settings therein will be used. One may also press "?" on any of the lines for
2678help on what each of the variables do.
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00002679
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002680(also see: |netrw-browser-var| |netrw-protocol| |netrw-variables|)
Bram Moolenaar9964e462007-05-05 17:54:07 +00002681
Bram Moolenaar5b8d8fd2005-08-16 23:01:50 +00002682
Bram Moolenaar69a7cb42004-06-20 12:51:53 +00002683==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00002684OBTAINING A FILE *netrw-O* {{{2
2685
2686If there are no marked files:
2687
2688 When browsing a remote directory, one may obtain a file under the cursor
2689 (ie. get a copy on your local machine, but not edit it) by pressing the O
2690 key.
2691
2692If there are marked files:
2693
2694 The marked files will be obtained (ie. a copy will be transferred to your
2695 local machine, but not set up for editing).
2696
2697Only ftp and scp are supported for this operation (but since these two are
2698available for browsing, that shouldn't be a problem). The status bar will
2699then show, on its right hand side, a message like "Obtaining filename". The
2700statusline will be restored after the transfer is complete.
2701
2702Netrw can also "obtain" a file using the local browser. Netrw's display
2703of a directory is not necessarily the same as Vim's "current directory",
2704unless |g:netrw_keepdir| is set to 0 in the user's <.vimrc>. One may select
2705a file using the local browser (by putting the cursor on it) and pressing
2706"O" will then "obtain" the file; ie. copy it to Vim's current directory.
2707
2708Related topics:
2709 * To see what the current directory is, use |:pwd|
2710 * To make the currently browsed directory the current directory, see |netrw-c|
2711 * To automatically make the currently browsed directory the current
2712 directory, see |g:netrw_keepdir|.
2713
Bram Moolenaaradc21822011-04-01 18:03:16 +02002714 *netrw-createfile*
Bram Moolenaarc236c162008-07-13 17:41:49 +00002715OPEN A NEW FILE IN NETRW'S CURRENT DIRECTORY *netrw-%*
2716
Bram Moolenaara6878372014-03-22 21:02:50 +01002717To open a new file in netrw's current directory, press "%". This map
2718will query the user for a new filename; an empty file by that name will
2719be placed in the netrw's current directory (ie. b:netrw_curdir).
Bram Moolenaarc236c162008-07-13 17:41:49 +00002720
Bram Moolenaar8d043172014-01-23 14:24:41 +01002721Related topics: |netrw-d|
2722
Bram Moolenaarc236c162008-07-13 17:41:49 +00002723
Bram Moolenaar446cb832008-06-24 21:56:24 +00002724PREVIEW WINDOW *netrw-p* *netrw-preview* {{{2
2725
2726One may use a preview window by using the "p" key when the cursor is atop the
2727desired filename to be previewed. The display will then split to show both
2728the browser (where the cursor will remain) and the file (see |:pedit|).
2729By default, the split will be taken horizontally; one may use vertical
2730splitting if one has set |g:netrw_preview| first.
2731
Bram Moolenaar00a927d2010-05-14 23:24:24 +02002732An interesting set of netrw settings is: >
2733
2734 let g:netrw_preview = 1
2735 let g:netrw_liststyle = 3
2736 let g:netrw_winsize = 30
2737
2738These will:
2739 1. Make vertical splitting the default for previewing files
2740 2. Make the default listing style "tree"
2741 3. When a vertical preview window is opened, the directory listing
Bram Moolenaar5b435d62012-04-05 17:33:26 +02002742 will use only 30% of the columns available; the rest of the window
2743 is used for the preview window.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002744
Bram Moolenaara6878372014-03-22 21:02:50 +01002745Also see: |g:netrw_chgwin| |netrw-P|
2746
2747
Bram Moolenaar446cb832008-06-24 21:56:24 +00002748PREVIOUS WINDOW *netrw-P* *netrw-prvwin* {{{2
2749
2750To edit a file or directory in the previously used (last accessed) window (see
2751:he |CTRL-W_p|), press a "P". If there's only one window, then the one window
Bram Moolenaar15146672011-10-20 22:22:38 +02002752will be horizontally split (by default).
Bram Moolenaar446cb832008-06-24 21:56:24 +00002753
2754If there's more than one window, the previous window will be re-used on
2755the selected file/directory. If the previous window's associated buffer
2756has been modified, and there's only one window with that buffer, then
2757the user will be asked if s/he wishes to save the buffer first (yes,
2758no, or cancel).
2759
Bram Moolenaarff034192013-04-24 18:51:19 +02002760Related Actions |netrw-cr| |netrw-o| |netrw-t| |netrw-v|
Bram Moolenaar15146672011-10-20 22:22:38 +02002761Associated setting variables:
2762 |g:netrw_alto| control above/below splitting
2763 |g:netrw_altv| control right/left splitting
2764 |g:netrw_preview| control horizontal vs vertical splitting
2765 |g:netrw_winsize| control initial sizing
2766
Bram Moolenaara6878372014-03-22 21:02:50 +01002767Also see: |g:netrw_chgwin| |netrw-p|
2768
Bram Moolenaar446cb832008-06-24 21:56:24 +00002769
2770REFRESHING THE LISTING *netrw-ctrl-l* *netrw-ctrl_l* {{{2
2771
2772To refresh either a local or remote directory listing, press ctrl-l (<c-l>) or
2773hit the <cr> when atop the ./ directory entry in the listing. One may also
2774refresh a local directory by using ":e .".
2775
2776
Bram Moolenaarff034192013-04-24 18:51:19 +02002777REVERSING SORTING ORDER *netrw-r* *netrw-reverse* {{{2
2778
2779One may toggle between normal and reverse sorting order by pressing the
2780"r" key.
2781
2782Related topics: |netrw-s|
2783Associated setting variable: |g:netrw_sort_direction|
2784
2785
Bram Moolenaar446cb832008-06-24 21:56:24 +00002786RENAMING FILES OR DIRECTORIES *netrw-move* *netrw-rename* *netrw-R* {{{2
2787
2788If there are no marked files: (see |netrw-mf|)
2789
2790 Renaming/moving files and directories involves moving the cursor to the
2791 file/directory to be moved (renamed) and pressing "R". You will then be
2792 queried for where you want the file/directory to be moved. You may select
2793 a range of lines with the "V" command (visual selection), and then
2794 pressing "R".
2795
2796If there are marked files: (see |netrw-mf|)
2797
2798 Marked files will be renamed (moved). You will be queried as above in
2799 order to specify where you want the file/directory to be moved.
2800
2801 WARNING:~
2802
2803 Note that moving files is a dangerous operation; copies are safer. That's
2804 because a "move" for remote files is actually a copy + delete -- and if
2805 the copy fails and the delete does not, you may lose the file.
Bram Moolenaara6878372014-03-22 21:02:50 +01002806 Use at your own risk.
Bram Moolenaar446cb832008-06-24 21:56:24 +00002807
2808The g:netrw_rename_cmd variable is used to implement renaming. By default its
2809value is:
2810
2811 ssh HOSTNAME mv
2812
2813One may rename a block of files and directories by selecting them with
2814the V (|linewise-visual|).
2815
2816
Bram Moolenaar446cb832008-06-24 21:56:24 +00002817SELECTING SORTING STYLE *netrw-s* *netrw-sort* {{{2
2818
2819One may select the sorting style by name, time, or (file) size. The "s" map
2820allows one to circulate amongst the three choices; the directory listing will
2821automatically be refreshed to reflect the selected style.
2822
2823Related topics: |netrw-r| |netrw-S|
2824Associated setting variables: |g:netrw_sort_by| |g:netrw_sort_sequence|
2825
2826
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002827SETTING EDITING WINDOW *netrw-C* {{{2
2828
2829One may select a netrw window for editing with the "C" mapping, or by setting
2830g:netrw_chgwin to the selected window number. Subsequent selection of a file
2831to edit (|netrw-cr|) will use that window.
2832
Bram Moolenaar8d043172014-01-23 14:24:41 +01002833Related topics: |netrw-cr| |g:netrw_browse_split|
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002834Associated setting variables: |g:netrw_chgwin|
2835
2836
Bram Moolenaar446cb832008-06-24 21:56:24 +0000283710. Problems and Fixes *netrw-problems* {{{1
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002838
2839 (This section is likely to grow as I get feedback)
2840 (also see |netrw-debug|)
Bram Moolenaar488c6512005-08-11 20:09:58 +00002841 *netrw-p1*
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002842 P1. I use windows 95, and my ftp dumps four blank lines at the
2843 end of every read.
2844
2845 See |netrw-fixup|, and put the following into your
2846 <.vimrc> file:
2847
2848 let g:netrw_win95ftp= 1
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00002849
Bram Moolenaar488c6512005-08-11 20:09:58 +00002850 *netrw-p2*
Bram Moolenaar9964e462007-05-05 17:54:07 +00002851 P2. I use Windows, and my network browsing with ftp doesn't sort by
2852 time or size! -or- The remote system is a Windows server; why
2853 don't I get sorts by time or size?
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002854
2855 Windows' ftp has a minimal support for ls (ie. it doesn't
2856 accept sorting options). It doesn't support the -F which
2857 gives an explanatory character (ABC/ for "ABC is a directory").
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002858 Netrw then uses "dir" to get both its thin and long listings.
Bram Moolenaar9964e462007-05-05 17:54:07 +00002859 If you think your ftp does support a full-up ls, put the
2860 following into your <.vimrc>: >
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002861
Bram Moolenaar9964e462007-05-05 17:54:07 +00002862 let g:netrw_ftp_list_cmd = "ls -lF"
2863 let g:netrw_ftp_timelist_cmd= "ls -tlF"
2864 let g:netrw_ftp_sizelist_cmd= "ls -slF"
2865<
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002866 Alternatively, if you have cygwin on your Windows box, put
Bram Moolenaar9964e462007-05-05 17:54:07 +00002867 into your <.vimrc>: >
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002868
2869 let g:netrw_cygwin= 1
Bram Moolenaar9964e462007-05-05 17:54:07 +00002870<
2871 This problem also occurs when the remote system is Windows.
2872 In this situation, the various g:netrw_ftp_[time|size]list_cmds
2873 are as shown above, but the remote system will not correctly
2874 modify its listing behavior.
2875
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002876
Bram Moolenaar488c6512005-08-11 20:09:58 +00002877 *netrw-p3*
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002878 P3. I tried rcp://user@host/ (or protocol other than ftp) and netrw
2879 used ssh! That wasn't what I asked for...
2880
2881 Netrw has two methods for browsing remote directories: ssh
2882 and ftp. Unless you specify ftp specifically, ssh is used.
2883 When it comes time to do download a file (not just a directory
2884 listing), netrw will use the given protocol to do so.
2885
Bram Moolenaar488c6512005-08-11 20:09:58 +00002886 *netrw-p4*
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002887 P4. I would like long listings to be the default.
2888
Bram Moolenaar446cb832008-06-24 21:56:24 +00002889 Put the following statement into your |.vimrc|: >
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00002890
Bram Moolenaar446cb832008-06-24 21:56:24 +00002891 let g:netrw_liststyle= 1
2892<
2893 Check out |netrw-browser-var| for more customizations that
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00002894 you can set.
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002895
Bram Moolenaar488c6512005-08-11 20:09:58 +00002896 *netrw-p5*
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002897 P5. My times come up oddly in local browsing
2898
2899 Does your system's strftime() accept the "%c" to yield dates
Bram Moolenaarff034192013-04-24 18:51:19 +02002900 such as "Sun Apr 27 11:49:23 1997"? If not, do a
2901 "man strftime" and find out what option should be used. Then
2902 put it into your |.vimrc|: >
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002903
Bram Moolenaar446cb832008-06-24 21:56:24 +00002904 let g:netrw_timefmt= "%X" (where X is the option)
2905<
Bram Moolenaar488c6512005-08-11 20:09:58 +00002906 *netrw-p6*
Bram Moolenaar3fdfa4a2004-10-07 21:02:47 +00002907 P6. I want my current directory to track my browsing.
2908 How do I do that?
Bram Moolenaarc0197e22004-09-13 20:26:32 +00002909
Bram Moolenaar446cb832008-06-24 21:56:24 +00002910 Put the following line in your |.vimrc|:
2911>
Bram Moolenaar433f7c82006-03-21 21:29:36 +00002912 let g:netrw_keepdir= 0
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002913<
Bram Moolenaar9964e462007-05-05 17:54:07 +00002914 *netrw-p7*
2915 P7. I use Chinese (or other non-ascii) characters in my filenames, and
2916 netrw (Explore, Sexplore, Hexplore, etc) doesn't display them!
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00002917
Bram Moolenaar9964e462007-05-05 17:54:07 +00002918 (taken from an answer provided by Wu Yongwei on the vim
2919 mailing list)
Bram Moolenaara6878372014-03-22 21:02:50 +01002920 I now see the problem. Your code page is not 936, right? Vim
Bram Moolenaar9964e462007-05-05 17:54:07 +00002921 seems only able to open files with names that are valid in the
2922 current code page, as are many other applications that do not
2923 use the Unicode version of Windows APIs. This is an OS-related
2924 issue. You should not have such problems when the system
2925 locale uses UTF-8, such as modern Linux distros.
2926
2927 (...it is one more reason to recommend that people use utf-8!)
2928
2929 *netrw-p8*
2930 P8. I'm getting "ssh is not executable on your system" -- what do I
2931 do?
2932
2933 (Dudley Fox) Most people I know use putty for windows ssh. It
2934 is a free ssh/telnet application. You can read more about it
2935 here:
2936
2937 http://www.chiark.greenend.org.uk/~sgtatham/putty/ Also:
2938
2939 (Marlin Unruh) This program also works for me. It's a single
2940 executable, so he/she can copy it into the Windows\System32
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002941 folder and create a shortcut to it.
Bram Moolenaar9964e462007-05-05 17:54:07 +00002942
2943 (Dudley Fox) You might also wish to consider plink, as it
2944 sounds most similar to what you are looking for. plink is an
2945 application in the putty suite.
2946
2947 http://the.earth.li/~sgtatham/putty/0.58/htmldoc/Chapter7.html#plink
2948
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002949 (Vissale Neang) Maybe you can try OpenSSH for windows, which
Bram Moolenaar9964e462007-05-05 17:54:07 +00002950 can be obtained from:
2951
2952 http://sshwindows.sourceforge.net/
2953
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002954 It doesn't need the full Cygwin package.
Bram Moolenaar9964e462007-05-05 17:54:07 +00002955
2956 (Antoine Mechelynck) For individual Unix-like programs needed
2957 for work in a native-Windows environment, I recommend getting
2958 them from the GnuWin32 project on sourceforge if it has them:
2959
2960 http://gnuwin32.sourceforge.net/
2961
2962 Unlike Cygwin, which sets up a Unix-like virtual machine on
2963 top of Windows, GnuWin32 is a rewrite of Unix utilities with
2964 Windows system calls, and its programs works quite well in the
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01002965 cmd.exe "Dos box".
Bram Moolenaar9964e462007-05-05 17:54:07 +00002966
2967 (dave) Download WinSCP and use that to connect to the server.
2968 In Preferences > Editors, set gvim as your editor:
2969
2970 - Click "Add..."
2971 - Set External Editor (adjust path as needed, include
2972 the quotes and !.! at the end):
2973 "c:\Program Files\Vim\vim70\gvim.exe" !.!
2974 - Check that the filetype in the box below is
2975 {asterisk}.{asterisk} (all files), or whatever types
2976 you want (cec: change {asterisk} to * ; I had to
2977 write it that way because otherwise the helptags
Bram Moolenaar446cb832008-06-24 21:56:24 +00002978 system thinks it's a tag)
2979 - Make sure it's at the top of the listbox (click it,
2980 then click "Up" if it's not)
Bram Moolenaar9964e462007-05-05 17:54:07 +00002981 If using the Norton Commander style, you just have to hit <F4>
2982 to edit a file in a local copy of gvim.
2983
2984 (Vit Gottwald) How to generate public/private key and save
2985 public key it on server: >
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +02002986 http://www.chiark.greenend.org.uk/~sgtatham/putty/0.60/htmldoc/Chapter8.html#pubkey-gettingready
2987 (8.3 Getting ready for public key authentication)
Bram Moolenaar9964e462007-05-05 17:54:07 +00002988<
Bram Moolenaar446cb832008-06-24 21:56:24 +00002989 How to use a private key with 'pscp': >
2990
Bram Moolenaar5ac3b1a2010-07-27 22:50:36 +02002991 http://www.chiark.greenend.org.uk/~sgtatham/putty/0.60/htmldoc/Chapter5.html
2992 (5.2.4 Using public key authentication with PSCP)
Bram Moolenaar9964e462007-05-05 17:54:07 +00002993<
Bram Moolenaar446cb832008-06-24 21:56:24 +00002994 (Ben Schmidt) I find the ssh included with cwRsync is
2995 brilliant, and install cwRsync or cwRsyncServer on most
2996 Windows systems I come across these days. I guess COPSSH,
2997 packed by the same person, is probably even better for use as
2998 just ssh on Windows, and probably includes sftp, etc. which I
2999 suspect the cwRsync doesn't, though it might
3000
Bram Moolenaar9964e462007-05-05 17:54:07 +00003001 (cec) To make proper use of these suggestions above, you will
3002 need to modify the following user-settable variables in your
3003 .vimrc:
3004
Bram Moolenaar446cb832008-06-24 21:56:24 +00003005 |g:netrw_ssh_cmd| |g:netrw_list_cmd| |g:netrw_mkdir_cmd|
3006 |g:netrw_rm_cmd| |g:netrw_rmdir_cmd| |g:netrw_rmf_cmd|
Bram Moolenaar9964e462007-05-05 17:54:07 +00003007
3008 The first one (|g:netrw_ssh_cmd|) is the most important; most
3009 of the others will use the string in g:netrw_ssh_cmd by
3010 default.
3011 *netrw-p9* *netrw-ml_get*
3012 P9. I'm browsing, changing directory, and bang! ml_get errors
3013 appear and I have to kill vim. Any way around this?
3014
3015 Normally netrw attempts to avoid writing swapfiles for
3016 its temporary directory buffers. However, on some systems
3017 this attempt appears to be causing ml_get errors to
3018 appear. Please try setting |g:netrw_use_noswf| to 0
3019 in your <.vimrc>: >
3020 let g:netrw_use_noswf= 0
3021<
Bram Moolenaar446cb832008-06-24 21:56:24 +00003022 *netrw-p10*
3023 P10. I'm being pestered with "[something] is a directory" and
3024 "Press ENTER or type command to continue" prompts...
3025
3026 The "[something] is a directory" prompt is issued by Vim,
3027 not by netrw, and there appears to be no way to work around
3028 it. Coupled with the default cmdheight of 1, this message
3029 causes the "Press ENTER..." prompt. So: read |hit-enter|;
3030 I also suggest that you set your |'cmdheight'| to 2 (or more) in
3031 your <.vimrc> file.
3032
3033 *netrw-p11*
3034 P11. I want to have two windows; a thin one on the left and my editing
Bram Moolenaar251e1912011-06-19 05:09:16 +02003035 window on the right. How may I accomplish this?
Bram Moolenaar446cb832008-06-24 21:56:24 +00003036
3037 * Put the following line in your <.vimrc>:
3038 let g:netrw_altv = 1
3039 * Edit the current directory: :e .
3040 * Select some file, press v
3041 * Resize the windows as you wish (see |CTRL-W_<| and
3042 |CTRL-W_>|). If you're using gvim, you can drag
3043 the separating bar with your mouse.
3044 * When you want a new file, use ctrl-w h to go back to the
3045 netrw browser, select a file, then press P (see |CTRL-W_h|
3046 and |netrw-P|). If you're using gvim, you can press
3047 <leftmouse> in the browser window and then press the
3048 <middlemouse> to select the file.
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003049
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003050 *netrw-p12*
3051 P12. My directory isn't sorting correctly, or unwanted letters are
3052 appearing in the listed filenames, or things aren't lining
3053 up properly in the wide listing, ...
3054
3055 This may be due to an encoding problem. I myself usually use
3056 utf-8, but really only use ascii (ie. bytes from 32-126).
3057 Multibyte encodings use two (or more) bytes per character.
3058 You may need to change |g:netrw_sepchr| and/or |g:netrw_xstrlen|.
3059
Bram Moolenaar00a927d2010-05-14 23:24:24 +02003060 *netrw-p13*
3061 P13. I'm a Windows + putty + ssh user, and when I attempt to browse,
3062 the directories are missing trailing "/"s so netrw treats them
3063 as file transfers instead of as attempts to browse
3064 subdirectories. How may I fix this?
3065
3066 (mikeyao) If you want to use vim via ssh and putty under Windows,
3067 try combining the use of pscp/psftp with plink. pscp/psftp will
3068 be used to connect and plink will be used to execute commands on
3069 the server, for example: list files and directory using 'ls'.
3070
3071 These are the settings I use to do this:
3072>
3073 " list files, it's the key setting, if you haven't set,
3074 " you will get a blank buffer
3075 let g:netrw_list_cmd = "plink HOSTNAME ls -Fa"
3076 " if you haven't add putty directory in system path, you should
3077 " specify scp/sftp command. For examples:
3078 "let g:netrw_sftp_cmd = "d:\\dev\\putty\\PSFTP.exe"
3079 "let g:netrw_scp_cmd = "d:\\dev\\putty\\PSCP.exe"
3080<
Bram Moolenaar251e1912011-06-19 05:09:16 +02003081 *netrw-p14*
3082 P14. I'd would like to speed up writes using Nwrite and scp/ssh
3083 style connections. How? (Thomer M. Gil)
Bram Moolenaar00a927d2010-05-14 23:24:24 +02003084
Bram Moolenaar251e1912011-06-19 05:09:16 +02003085 Try using ssh's ControlMaster and ControlPath (see the ssh_config
3086 man page) to share multiple ssh connections over a single network
3087 connection. That cuts out the cryptographic handshake on each
3088 file write, sometimes speeding it up by an order of magnitude.
3089 (see http://thomer.com/howtos/netrw_ssh.html)
3090 (included by permission)
3091
3092 Add the following to your ~/.ssh/config: >
3093
3094 # you change "*" to the hostname you care about
3095 Host *
3096 ControlMaster auto
3097 ControlPath /tmp/%r@%h:%p
3098
3099< Then create an ssh connection to the host and leave it running: >
3100
3101 ssh -N host.domain.com
3102
3103< Now remotely open a file with Vim's Netrw and enjoy the
3104 zippiness: >
3105
3106 vim scp://host.domain.com//home/user/.bashrc
3107<
3108 *netrw-p15*
3109 P15. How may I use a double-click instead of netrw's usual single click
3110 to open a file or directory? (Ben Fritz)
3111
3112 First, disable netrw's mapping with >
3113 let g:netrw_mousemaps= 0
3114< and then create a netrw buffer only mapping in
3115 $HOME/.vim/after/ftplugin/netrw.vim: >
3116 nmap <buffer> <2-leftmouse> <CR>
3117< Note that setting g:netrw_mousemaps to zero will turn off
3118 all netrw's mouse mappings, not just the <leftmouse> one.
3119 (see |g:netrw_mousemaps|)
Bram Moolenaar00a927d2010-05-14 23:24:24 +02003120
Bram Moolenaarc0197e22004-09-13 20:26:32 +00003121==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +0000312211. Debugging Netrw Itself *netrw-debug* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +00003123
Bram Moolenaaradc21822011-04-01 18:03:16 +02003124The <netrw.vim> script is typically available as something like:
Bram Moolenaar488c6512005-08-11 20:09:58 +00003125>
Bram Moolenaar446cb832008-06-24 21:56:24 +00003126 /usr/local/share/vim/vim7x/plugin/netrwPlugin.vim
3127 /usr/local/share/vim/vim7x/autoload/netrw.vim
Bram Moolenaar488c6512005-08-11 20:09:58 +00003128<
Bram Moolenaar071d4272004-06-13 20:20:40 +00003129which is loaded automatically at startup (assuming :set nocp).
3130
3131 1. Get the <Decho.vim> script, available as:
3132
Bram Moolenaar97d62492012-11-15 21:28:22 +01003133 http://www.drchip.org/astronaut/vim/index.html#DECHO
Bram Moolenaar071d4272004-06-13 20:20:40 +00003134 or
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00003135 http://vim.sourceforge.net/scripts/script.php?script_id=120
Bram Moolenaar071d4272004-06-13 20:20:40 +00003136
Bram Moolenaara6878372014-03-22 21:02:50 +01003137 Decho.vim is provided as a "vimball"; see |vimball-intro|.
Bram Moolenaarf6cf9872005-08-08 22:00:59 +00003138
Bram Moolenaar446cb832008-06-24 21:56:24 +00003139 2. Edit the <netrw.vim> file by typing: >
Bram Moolenaard4755bb2004-09-02 19:12:26 +00003140
3141 vim netrw.vim
Bram Moolenaar071d4272004-06-13 20:20:40 +00003142 :DechoOn
Bram Moolenaard4755bb2004-09-02 19:12:26 +00003143 :wq
Bram Moolenaar446cb832008-06-24 21:56:24 +00003144<
3145 To restore to normal non-debugging behavior, re-edit <netrw.vim>
3146 and type >
Bram Moolenaar071d4272004-06-13 20:20:40 +00003147
Bram Moolenaard4755bb2004-09-02 19:12:26 +00003148 vim netrw.vim
3149 :DechoOff
3150 :wq
Bram Moolenaar446cb832008-06-24 21:56:24 +00003151<
Bram Moolenaard4755bb2004-09-02 19:12:26 +00003152 This command, provided by <Decho.vim>, will comment out all
3153 Decho-debugging statements (Dfunc(), Dret(), Decho(), Dredir()).
3154
Bram Moolenaar446cb832008-06-24 21:56:24 +00003155 3. Then bring up vim and attempt to evoke the problem by doing a
3156 transfer or doing some browsing. A set of messages should appear
3157 concerning the steps that <netrw.vim> took in attempting to
3158 read/write your file over the network in a separate tab.
Bram Moolenaar071d4272004-06-13 20:20:40 +00003159
Bram Moolenaar9964e462007-05-05 17:54:07 +00003160 To save the file, use >
Bram Moolenaar8d043172014-01-23 14:24:41 +01003161
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +01003162 :tabnext
Bram Moolenaar9964e462007-05-05 17:54:07 +00003163 :set bt=
3164 :w! DBG
Bram Moolenaar8d043172014-01-23 14:24:41 +01003165
3166< Furthermore, it'd be helpful if you would type >
Bram Moolenaara6878372014-03-22 21:02:50 +01003167 :Dsep <command>
3168< where <command> is the command you're about to type next,
3169 thereby making it easier to associate which part of the
3170 debugging trace is due to which command.
Bram Moolenaar8d043172014-01-23 14:24:41 +01003171
Bram Moolenaara6878372014-03-22 21:02:50 +01003172 Please send that information to <netrw.vim>'s maintainer along
3173 with the o/s you're using and vim version you're using
3174 (see |:version|) >
Bram Moolenaar293ee4d2004-12-09 21:34:53 +00003175 NdrOchip at ScampbellPfamily.AbizM - NOSPAM
Bram Moolenaar9964e462007-05-05 17:54:07 +00003176<
Bram Moolenaar071d4272004-06-13 20:20:40 +00003177==============================================================================
Bram Moolenaar9964e462007-05-05 17:54:07 +0000317812. History *netrw-history* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +00003179
Bram Moolenaara6878372014-03-22 21:02:50 +01003180 v151: Jan 22, 2014 * extended :Rexplore to return to buffer
3181 prior to Explore or editing a directory
3182 * (Ken Takata) netrw gave error when
3183 clipboard was disabled. Sol'n: Placed
3184 several if has("clipboard") tests in.
3185 * Fixed ftp://X@Y@Z// problem; X@Y now
3186 part of user id, and only Z is part of
3187 hostname.
3188 * (A Loumiotis) reported that completion
3189 using a directory name containing spaces
3190 did not work. Fixed with a retry in
3191 netrw#Explore() which removes the
3192 backslashes vim inserted.
3193 Feb 26, 2014 * :Rexplore now records the current file
3194 using w:netrw_rexfile when returning via
3195 |:Rexplore|
3196 Mar 08, 2014 * (David Kotchan) provided some patches
3197 allowing netrw to work properly with
3198 windows shares.
3199 * Multiple one-liner help messages available
3200 by pressing <cr> while atop the "Quick
3201 Help" line
3202 * worked on ShellCmdPost, FocusGained event
3203 handling.
3204 * |:Lexplore| path: will be used to update
3205 a left-side netrw browsing directory.
3206 Mar 12, 2014 * |:netrw-s-cr|: use <s-cr> to close
3207 tree directory implemented
3208 Mar 13, 2014 * (Tony Mechylynck) reported that using
3209 the browser with ftp on a directory,
3210 and selecting a gzipped txt file, that
3211 an E19 occurred (which was issued by
3212 gzip.vim). Fixed.
3213 Mar 14, 2014 * Implemented :MF and :MT (see |netrw-:MF|
3214 and |netrw-:MT|, respectively)
3215 Mar 17, 2014 * |:Ntree| [dir] wasn't working properly; fixed
3216 Mar 18, 2014 * Changed all uses of set to setl
3217 Mar 18, 2014 * Commented the netrw_btkeep line in
3218 s:NetrwOptionSave(); the effect is that
3219 netrw buffers will remain as |'bt'|=nofile.
3220 This should prevent swapfiles being created
3221 for netrw buffers.
3222 Mar 20, 2014 * Changed all uses of lcd to use s:NetrwLcd()
3223 instead. Consistent error handling results
3224 and it also handles Window's shares
3225 * Fixed |netrw-d| command when applied with ftp
3226 * https: support included for netrw#NetRead()
Bram Moolenaar8d043172014-01-23 14:24:41 +01003227 v150: Jul 12, 2013 * removed a "keepalt" to allow ":e #" to
3228 return to the netrw directory listing
3229 Jul 13, 2013 * (Jonas Diemer) suggested changing
3230 a <cWORD> to <cfile>.
3231 Jul 21, 2013 * (Yuri Kanivetsky) reported that netrw's
3232 use of mkdir did not produce directories
Bram Moolenaara6878372014-03-22 21:02:50 +01003233 following the user's umask.
Bram Moolenaar8d043172014-01-23 14:24:41 +01003234 Aug 27, 2013 * introduced |g:netrw_altfile| option
3235 Sep 05, 2013 * s:Strlen() now uses |strdisplaywidth()|
3236 when available, by default
3237 Sep 12, 2013 * (Selyano Baldo) reported that netrw wasn't
3238 opening some directories properly from the
3239 command line.
3240 Nov 09, 2013 * |:Lexplore| introduced
3241 * (Ondrej Platek) reported an issue with
3242 netrw's trees (P15). Fixed.
3243 * (Jorge Solis) reported that "t" in
3244 tree mode caused netrw to forget its
3245 line position.
3246 Dec 05, 2013 * Added <s-leftmouse> file marking
3247 (see |netrw-mf|)
3248 Dec 05, 2013 * (Yasuhiro Matsumoto) Explore should use
3249 strlen() instead s:Strlen() when handling
3250 multibyte chars with strpart()
3251 (ie. strpart() is byte oriented, not
3252 display-width oriented).
3253 Dec 09, 2013 * (Ken Takata) Provided a patch; File sizes
3254 and a portion of timestamps were wrongly
3255 highlighted with the directory color when
3256 setting `:let g:netrw_liststyle=1` on Windows.
3257 * (Paul Domaskis) noted that sometimes
3258 cursorline was activating in non-netrw
3259 windows. All but one setting of cursorline
3260 was done via setl; there was one that was
3261 overlooked. Fixed.
3262 Dec 24, 2013 * (esquifit) asked that netrw allow the
3263 /cygdrive prefix be a user-alterable
3264 parameter.
3265 Jan 02, 2014 * Fixed a problem with netrw-based ballon
3266 evaluation (ie. netrw#NetrwBaloonHelp()
3267 not having been loaded error messages)
3268 Jan 03, 2014 * Fixed a problem with tree listings
3269 * New command installed: |:Ntree|
3270 Jan 06, 2014 * (Ivan Brennan) reported a problem with
3271 |netrw-P|. Fixed.
3272 Jan 06, 2014 * Fixed a problem with |netrw-P| when the
3273 modified file was to be abandoned.
3274 Jan 15, 2014 * (Matteo Cavalleri) reported that when the
3275 banner is suppressed and tree listing is
3276 used, a blank line was left at the top of
3277 the display. Fixed.
3278 Jan 20, 2014 * (Gideon Go) reported that, in tree listing
3279 style, with a previous window open, that
3280 the wrong directory was being used to open
3281 a file. Fixed. (P21)
Bram Moolenaare6ae6222013-05-21 21:01:10 +02003282 v149: Apr 18, 2013 * in wide listing format, now have maps for
3283 w and b to move to next/previous file
3284 Apr 26, 2013 * one may now copy files in the same
3285 directory; netrw will issue requests for
3286 what names the files should be copied under
3287 Apr 29, 2013 * Trying Benzinger's problem again. Seems
3288 that commenting out the BufEnter and
3289 installing VimEnter (only) works. Weird
3290 problem! (tree listing, vim -O Dir1 Dir2)
3291 May 01, 2013 * :Explore ftp://... wasn't working. Fixed.
3292 May 02, 2013 * introduced |g:netrw_bannerbackslash| as
3293 requested by Paul Domaskis.
Bram Moolenaar8d043172014-01-23 14:24:41 +01003294 Jul 03, 2013 * Explore now avoids splitting when a buffer
3295 will be hidden.
Bram Moolenaarff034192013-04-24 18:51:19 +02003296 v148: Apr 16, 2013 * changed Netrw's Style menu to allow direct
3297 choice of listing style, hiding style, and
3298 sorting style
3299 v147: Nov 24, 2012 * (James McCoy) Even with g:netrw_dirhistmax
3300 at zero, the .vim/ directory would be
3301 created to support history/bookmarks. I've
3302 gone over netrw to suppress history and
3303 bookmarking when g:netrw_dirhistmax is zero.
3304 For instance, the menus will display
3305 (disabled) when attempts to use
3306 bookmarks/history are made.
3307 Nov 29, 2012 * (Kim Jang-hwan) reported that with
3308 g:Align_xstrlen set to 3 that the cursor was
3309 moved (linewise) after invocation. This
3310 problem also afflicted netrw.
3311 (see |g:netrw_xstrlen|) Fixed.
3312 Jan 21, 2013 * (mattn) provided a patch to insert some
3313 endifs needed with the code implementing
3314 |netrw-O|.
3315 Jan 24, 2013 * (John Szakmeister) found that remote file
3316 editing resulted in filetype options being
3317 overwritten by NetrwOptionRestore(). I
3318 moved filetype detect from NetrwGetFile()
3319 to NetrwOptionRestore.
3320 Feb 17, 2013 * (Yukhiro Nakadaira) provided a patch
3321 correcting some syntax errors.
3322 Feb 28, 2013 * (Ingo Karkat) provided a patch preventing
3323 receipt of an |E95| when revisiting a
3324 file://... style url.
3325 Mar 18, 2013 * (Gary Johnson) pointed out that changing
3326 cedit to <Esc> caused problems with visincr;
3327 the cedit setting is now bypassed in netrw too.
3328 Apr 02, 2013 * (Paul Domaskis) reported an undefined
3329 variable error (s:didstarstar) was
3330 occurring. It is now defined at
3331 initialization.
3332 * included additional sanity checking for the
3333 marked file functions.
3334 * included |netrw-qF| and special "j" option
3335 handling for |netrw-mg|
3336 Apr 12, 2013 * |netrw-u| and |netrw-U| now handle counts
3337 * the former mapping for "T" has been removed;
3338 in its place are new maps, |netrw-Tb| and |netrw-Th|.
3339 * the menu now supports a "Targets" entry for
3340 easier target selection. (see |netrw-mt|)
3341 * (Paul Domaskis) reported some problems with
3342 moving/copying files under Windows' gvim
3343 (ie. not cygwin). Fixed.
3344 * (Paul Mueller) provided a patch to get
3345 start and rundll working via |netrw-gx|
3346 by bypassing the user's |'shellslash'| option.
Bram Moolenaar97d62492012-11-15 21:28:22 +01003347 v146: Oct 20, 2012 * (David Kotchan) reported that under Windows,
3348 directories named with unusual characters
3349 such as "#" or "$" were not being listed
3350 properly.
3351 * (Kenny Lee) reported that the buffer list
3352 was being populated by netrw buffers.
3353 Netrw will now |:bwipe| netrw buffers
3354 upon editing a file if g:netrw_fastbrowse
3355 is zero and its not in tree listing style.
Bram Moolenaarff034192013-04-24 18:51:19 +02003356 * fixed a bug with s:NetrwInit() that
3357 prevented initialization with |Lists| and
3358 |Dictionaries|.
3359 * |netrw-mu| now unmarks marked-file lists
Bram Moolenaar97d62492012-11-15 21:28:22 +01003360 v145: Apr 05, 2012 * moved some command from a g:netrw_local_...
3361 format to g:netwr_local... format
3362 * included some NOTE level messages about
3363 commands that aren't executable
3364 * |g:netrw_errorlvl| (default: NOTE=0)
3365 option introduced
3366 May 18, 2012 * (Ilya Dogolazky) a scenario where a
3367 |g:netrw_fastbrowse| of zero did not
3368 have a local directory refreshed fixed.
3369 Jul 10, 2012 * (Donatas) |netrw-gb| wasn't working due
3370 to an incorrectly used variable.
3371 Aug 09, 2012 * (Bart Baker) netrw was doubling
3372 of entries after a split.
3373 * (code by Takahiro Yoshihara) implemented
3374 |g:netrw_dynamic_maxfilenamelen|
3375 Aug 31, 2012 * (Andrew Wong) netrw refresh overwriting
3376 the yank buffer.
3377 v144: Mar 12, 2012 * when |CTRL-W_s| or |CTRL-W_v| are used,
3378 or their wincmd equivalents, on a netrw
3379 buffer, the netrw's w: variables were
3380 not copied over. Fixed.
3381 Mar 13, 2012 * nbcd_curpos_{bufnr('%')} was commented
3382 out, and was mistakenly used during
3383 RestorePosn. Unfortunately, I'm not
3384 sure why it was commented out, so this
3385 "fix" may re-introduce an earlier problem.
3386 Mar 21, 2012 * included s:rexposn internally to make
3387 :Rex return the cursor to the same pos'n
3388 upon restoration of netrw buffer
3389 Mar 27, 2012 * (sjbesse) s:NetrwGetFile() needs to remove
3390 "/" from the netrw buffer's usual |'isk'|
3391 in order to allow "filetype detect" to work
3392 properly for scripts.
3393 v143: Jun 01, 2011 * |g:netrw_winsize| will accept a negative
3394 number; the absolute value of it will then
3395 be used to specify lines/columns instead of
3396 a percentage.
3397 Jul 05, 2011 * the "d" map now supports mkdir via ftp
3398 See |netrw-d| and |g:netrw_remote_mkdir|
3399 Jul 11, 2011 * Changed Explore!, Sexplore!, and Vexplore
3400 to use a percentage of |winwidth()| instead
3401 of a percentage of |winheight()|.
3402 Jul 11, 2011 * included support for https://... I'm just
3403 beginning to test this, however.
3404 Aug 01, 2011 * changed RestoreOptions to also restore
3405 cursor position in netrw buffers.
3406 Aug 12, 2011 * added a note about "%" to the balloon
3407 Aug 30, 2011 * if |g:netrw_nobeval| exists, then balloon
3408 evaluation is suppressed.
3409 Aug 31, 2011 * (Benjamin R Haskell) provided a patch that
3410 implements non-standard port handling for
3411 files opened via the remote browser.
3412 Aug 31, 2011 * Fixed a **//pattern Explorer bug
3413 Sep 15, 2011 * (reported by Francesco Campana) netrw
3414 now permits the "@" to be part of the
3415 user id (if there's an @ that appears
3416 to the right).
3417 Nov 21, 2011 * New option: |g:netrw_ftp_options|
3418 Dec 07, 2011 * (James Sinclair) provided a fix handling
3419 attempts to use a uid and password when
3420 they weren't defined. This affected
3421 NetWrite (NetRead already had that fix).
Bram Moolenaar071d4272004-06-13 20:20:40 +00003422
3423
3424==============================================================================
Bram Moolenaar8f3f58f2010-01-06 20:52:26 +0100342513. Todo *netrw-todo* {{{1
3426
342707/29/09 : banner :|g:netrw_banner| can be used to suppress the
3428 suppression banner. This feature is new and experimental,
3429 so its in the process of being debugged.
343009/04/09 : "gp" : See if it can be made to work for remote systems.
3431 : See if it can be made to work with marked files.
3432
3433==============================================================================
343414. Credits *netrw-credits* {{{1
Bram Moolenaar071d4272004-06-13 20:20:40 +00003435
3436 Vim editor by Bram Moolenaar (Thanks, Bram!)
3437 dav support by C Campbell
3438 fetch support by Bram Moolenaar and C Campbell
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00003439 ftp support by C Campbell <NdrOchip@ScampbellPfamily.AbizM>
Bram Moolenaar071d4272004-06-13 20:20:40 +00003440 http support by Bram Moolenaar <bram@moolenaar.net>
3441 rcp
3442 rsync support by C Campbell (suggested by Erik Warendorph)
3443 scp support by raf <raf@comdyn.com.au>
3444 sftp support by C Campbell
3445
3446 inputsecret(), BufReadCmd, BufWriteCmd contributed by C Campbell
3447
3448 Jérôme Augé -- also using new buffer method with ftp+.netrc
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00003449 Bram Moolenaar -- obviously vim itself, :e and v:cmdarg use,
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +00003450 fetch,...
Bram Moolenaar071d4272004-06-13 20:20:40 +00003451 Yasuhiro Matsumoto -- pointing out undo+0r problem and a solution
3452 Erik Warendorph -- for several suggestions (g:netrw_..._cmd
3453 variables, rsync etc)
Bram Moolenaar482aaeb2005-09-29 18:26:07 +00003454 Doug Claar -- modifications to test for success with ftp
Bram Moolenaar7aa9f6a2007-05-10 18:00:30 +00003455 operation
Bram Moolenaar071d4272004-06-13 20:20:40 +00003456
3457==============================================================================
Bram Moolenaar446cb832008-06-24 21:56:24 +00003458Modelines: {{{1
Bram Moolenaar83bab712005-08-01 21:58:57 +00003459 vim:tw=78:ts=8:ft=help:norl:fdm=marker