robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
318d6a7f59
master
1*netrw.txt* Nvim 2 3 ------------------------------------------------ 4 NETRW REFERENCE MANUAL by Charles E. Campbell 5 ------------------------------------------------ 6Original Author: Charles E. Campbell 7Copyright: Copyright (C) 2017 Charles E Campbell *netrw-copyright* 8 The VIM LICENSE applies to the files in this package, including 9 netrw.vim, netrw.txt, and syntax/netrw.vim. 10 Like anything else that's free, netrw.vim and its 11 associated files are provided *as is* and comes with no warranty of 12 any kind, either expressed or implied. No guarantees of 13 merchantability. No guarantees of suitability for any purpose. By 14 using this plugin, you agree that in no event will the copyright 15 holder be liable for any damages resulting from the use of this 16 software. Use at your own risk! 17 18 *netrw* 19 *dav* *ftp* *netrw-file* *rcp* *scp* 20 *davs* *http* *netrw.vim* *rsync* *sftp* 21 *fetch* *network* 22 23============================================================================== 241. Contents *netrw-contents* {{{1 25 261. Contents..............................................|netrw-contents| 272. Starting With Netrw...................................|netrw-start| 283. Netrw Reference.......................................|netrw-ref| 29 EXTERNAL APPLICATIONS AND PROTOCOLS.................|netrw-externapp| 30 READING.............................................|netrw-read| 31 WRITING.............................................|netrw-write| 32 SOURCING............................................|netrw-source| 33 DIRECTORY LISTING...................................|netrw-dirlist| 34 CHANGING THE USERID AND PASSWORD....................|netrw-chgup| 35 VARIABLES AND SETTINGS..............................|netrw-variables| 36 PATHS...............................................|netrw-path| 374. Network-Oriented File Transfer........................|netrw-xfer| 38 NETRC...............................................|netrw-netrc| 39 PASSWORD............................................|netrw-passwd| 405. Activation............................................|netrw-activate| 416. Transparent Remote File Editing.......................|netrw-transparent| 427. Ex Commands...........................................|netrw-ex| 438. Variables and Options.................................|netrw-variables| 449. Browsing..............................................|netrw-browse| 45 Introduction To Browsing............................|netrw-intro-browse| 46 Quick Reference: Maps...............................|netrw-browse-maps| 47 Quick Reference: Commands...........................|netrw-browse-cmds| 48 Banner Display......................................|netrw-I| 49 Bookmarking A Directory.............................|netrw-mb| 50 Browsing............................................|netrw-cr| 51 Squeezing the Current Tree-Listing Directory........|netrw-s-cr| 52 Browsing With A Horizontally Split Window...........|netrw-o| 53 Browsing With A New Tab.............................|netrw-t| 54 Browsing With A Vertically Split Window.............|netrw-v| 55 Change Listing Style (thin wide long tree)..........|netrw-i| 56 Changing To A Bookmarked Directory..................|netrw-gb| 57 Quick hide/unhide of dot-files......................|netrw-gh| 58 Changing local-only File Permission.................|netrw-gp| 59 Changing To A Predecessor Directory.................|netrw-u| 60 Changing To A Successor Directory...................|netrw-U| 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-cd| 75 Marking Files.......................................|netrw-mf| 76 Unmarking Files.....................................|netrw-mF| 77 Marking Files By Location List......................|netrw-qL| 78 Marking Files By QuickFix List......................|netrw-qF| 79 Marking Files By Regular Expression.................|netrw-mr| 80 Marked Files: Arbitrary Shell Command...............|netrw-mx| 81 Marked Files: Arbitrary Shell Command, En Bloc......|netrw-mX| 82 Marked Files: Arbitrary Vim Command.................|netrw-mv| 83 Marked Files: Argument List.........................|netrw-ma| |netrw-mA| 84 Marked Files: Buffer List...........................|netrw-cb| |netrw-cB| 85 Marked Files: Compression And Decompression.........|netrw-mz| 86 Marked Files: Copying...............................|netrw-mc| 87 Marked Files: Diff..................................|netrw-md| 88 Marked Files: Editing...............................|netrw-me| 89 Marked Files: Grep..................................|netrw-mg| 90 Marked Files: Hiding and Unhiding by Suffix.........|netrw-mh| 91 Marked Files: Moving................................|netrw-mm| 92 Marked Files: Sourcing..............................|netrw-ms| 93 Marked Files: Setting the Target Directory..........|netrw-mt| 94 Marked Files: Tagging...............................|netrw-mT| 95 Marked Files: Target Directory Using Bookmarks......|netrw-Tb| 96 Marked Files: Target Directory Using History........|netrw-Th| 97 Marked Files: Unmarking.............................|netrw-mu| 98 Netrw Browser Variables.............................|netrw-browser-var| 99 Netrw Browsing And Option Incompatibilities.........|netrw-incompatible| 100 Obtaining A File....................................|netrw-O| 101 Preview Window......................................|netrw-p| 102 Previous Window.....................................|netrw-P| 103 Refreshing The Listing..............................|netrw-ctrl-l| 104 Reversing Sorting Order.............................|netrw-r| 105 Renaming Files Or Directories.......................|netrw-R| 106 Selecting Sorting Style.............................|netrw-s| 107 Setting Editing Window..............................|netrw-C| 10810. Problems and Fixes....................................|netrw-problems| 10911. Credits...............................................|netrw-credits| 110 111============================================================================== 1122. Starting With Netrw *netrw-start* {{{1 113 114Netrw makes reading files, writing files, browsing over a network, and 115local browsing easy! First, make sure that you have plugins enabled, so 116you'll need to have at least the following in your <.vimrc>: 117(or see |netrw-activate|) > 118 119 set nocp " 'compatible' is not set 120 filetype plugin on " plugins are enabled 121< 122(see 'cp' and |:filetype-plugin-on|) 123 124Netrw supports "transparent" editing of files on other machines using urls 125(see |netrw-transparent|). As an example of this, let's assume you have an 126account on some other machine; if you can use scp, try: > 127 128 vim scp://hostname/path/to/file 129< 130Want to make ssh/scp easier to use? Check out |netrw-ssh-hack|! 131 132So, what if you have ftp, not ssh/scp? That's easy, too; try > 133 134 vim ftp://hostname/path/to/file 135< 136Want to make ftp simpler to use? See if your ftp supports a file called 137<.netrc> -- typically it goes in your home directory, has read/write 138permissions for only the user to read (ie. not group, world, other, etc), 139and has lines resembling > 140 141 machine HOSTNAME login USERID password "PASSWORD" 142 machine HOSTNAME login USERID password "PASSWORD" 143 ... 144 default login USERID password "PASSWORD" 145< 146Windows' ftp doesn't support .netrc; however, one may have in one's .vimrc: > 147 148 let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\MyUserName\MACHINE' 149< 150Netrw will substitute the host's machine name for "MACHINE" from the URL it is 151attempting to open, and so one may specify > 152 userid 153 password 154for each site in a separate file: c:\Users\MyUserName\MachineName. 155 156Now about browsing -- when you just want to look around before editing a 157file. For netrw browsing on your current host, use |:Explore|: > 158 159 :Explore . 160 :Explore /home/userid/path 161< 162For browsing on a remote host, "edit" a directory (but make sure that 163the directory name is followed by a "/"): > 164 165 vim scp://hostname/ 166 vim ftp://hostname/path/to/dir/ 167< 168See |netrw-browse| for more! 169 170There are more protocols supported by netrw than just scp and ftp, too: see the 171next section, |netrw-externapp|, on how to use these external applications with 172netrw and vim. 173 174PREVENTING LOADING *netrw-noload* 175 176If you want to use plugins, but for some reason don't wish to use netrw, then 177you need to avoid loading both the plugin and the autoload portions of netrw. 178You may do so by placing the following two lines in your <.vimrc>: > 179 180 :let g:loaded_netrw = 1 181 :let g:loaded_netrwPlugin = 1 182< 183 184============================================================================== 1853. Netrw Reference *netrw-ref* {{{1 186 187 Netrw supports several protocols in addition to scp and ftp as mentioned 188 in |netrw-start|. These include dav, fetch, http,... well, just look 189 at the list in |netrw-externapp|. Each protocol is associated with a 190 variable which holds the default command supporting that protocol. 191 192EXTERNAL APPLICATIONS AND PROTOCOLS *netrw-externapp* {{{2 193 194 Protocol Variable Default Value 195 -------- ---------------- ------------- 196 dav: *g:netrw_dav_cmd* = "cadaver" if cadaver is executable 197 dav: g:netrw_dav_cmd = "curl -o" elseif curl is available 198 fetch: *g:netrw_fetch_cmd* = "fetch -o" if fetch is available 199 ftp: *g:netrw_ftp_cmd* = "ftp" 200 http: *g:netrw_http_cmd* = "elinks" if elinks is available 201 http: g:netrw_http_cmd = "links" elseif links is available 202 http: g:netrw_http_cmd = "curl" elseif curl is available 203 http: g:netrw_http_cmd = "wget" elseif wget is available 204 http: g:netrw_http_cmd = "fetch" elseif fetch is available 205 http: *g:netrw_http_put_cmd* = "curl -T" 206 rcp: *g:netrw_rcp_cmd* = "rcp" 207 rsync: *g:netrw_rsync_cmd* = "rsync" (see |g:netrw_rsync_sep|) 208 scp: *g:netrw_scp_cmd* = "scp -q" 209 sftp: *g:netrw_sftp_cmd* = "sftp" 210 file: *g:netrw_file_cmd* = "elinks" or "links" 211 212 *g:netrw_http_xcmd* : the option string for http://... protocols are 213 specified via this variable and may be independently overridden. By 214 default, the option arguments for the http-handling commands are: > 215 216 elinks : "-source >" 217 links : "-dump >" 218 curl : "-L -o" 219 wget : "-q -O" 220 fetch : "-o" 221< 222 For example, if your system has elinks, and you'd rather see the 223 page using an attempt at rendering the text, you may wish to have > 224 let g:netrw_http_xcmd= "-dump >" 225< in your .vimrc. 226 227 g:netrw_http_put_cmd: this option specifies both the executable and 228 any needed options. This command does a PUT operation to the url. 229 230 231READING *netrw-read* *netrw-nread* {{{2 232 233 Generally, one may just use the URL notation with a normal editing 234 command, such as > 235 236 :e ftp://[user@]machine/path 237< 238 Netrw also provides the Nread command: 239 240 :Nread ? give help 241 :Nread "machine:path" uses rcp 242 :Nread "machine path" uses ftp w/ <.netrc> 243 :Nread "machine id password path" uses ftp 244 :Nread "dav://machine[:port]/path" uses cadaver 245 :Nread "fetch://[user@]machine/path" uses fetch 246 :Nread "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc> 247 :Nread "http://[user@]machine/path" uses http uses wget 248 :Nread "rcp://[user@]machine/path" uses rcp 249 :Nread "rsync://[user@]machine[:port]/path" uses rsync 250 :Nread "scp://[user@]machine[[:#]port]/path" uses scp 251 :Nread "sftp://[user@]machine/path" uses sftp 252 253WRITING *netrw-write* *netrw-nwrite* {{{2 254 255 One may just use the URL notation with a normal file writing 256 command, such as > 257 258 :w ftp://[user@]machine/path 259< 260 Netrw also provides the Nwrite command: 261 262 :Nwrite ? give help 263 :Nwrite "machine:path" uses rcp 264 :Nwrite "machine path" uses ftp w/ <.netrc> 265 :Nwrite "machine id password path" uses ftp 266 :Nwrite "dav://machine[:port]/path" uses cadaver 267 :Nwrite "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc> 268 :Nwrite "rcp://[user@]machine/path" uses rcp 269 :Nwrite "rsync://[user@]machine[:port]/path" uses rsync 270 :Nwrite "scp://[user@]machine[[:#]port]/path" uses scp 271 :Nwrite "sftp://[user@]machine/path" uses sftp 272 http: not supported! 273 274SOURCING *netrw-source* {{{2 275 276 One may just use the URL notation with the normal file sourcing 277 command, such as > 278 279 :so ftp://[user@]machine/path 280< 281 Netrw also provides the Nsource command: 282 283 :Nsource ? give help 284 :Nsource "dav://machine[:port]/path" uses cadaver 285 :Nsource "fetch://[user@]machine/path" uses fetch 286 :Nsource "ftp://[user@]machine[[:#]port]/path" uses ftp w/ <.netrc> 287 :Nsource "http://[user@]machine/path" uses http uses wget 288 :Nsource "rcp://[user@]machine/path" uses rcp 289 :Nsource "rsync://[user@]machine[:port]/path" uses rsync 290 :Nsource "scp://[user@]machine[[:#]port]/path" uses scp 291 :Nsource "sftp://[user@]machine/path" uses sftp 292 293DIRECTORY LISTING *netrw-trailingslash* *netrw-dirlist* {{{2 294 295 One may browse a directory to get a listing by simply attempting to 296 edit the directory: > 297 298 :e scp://[user]@hostname/path/ 299 :e ftp://[user]@hostname/path/ 300< 301 For remote directory listings (ie. those using scp or ftp), that 302 trailing "/" is necessary (the slash tells netrw to treat the argument 303 as a directory to browse instead of as a file to download). 304 305 The Nread command may also be used to accomplish this (again, that 306 trailing slash is necessary): > 307 308 :Nread [protocol]://[user]@hostname/path/ 309< 310 *netrw-login* *netrw-password* 311CHANGING USERID AND PASSWORD *netrw-chgup* *netrw-userpass* {{{2 312 313 Attempts to use ftp will prompt you for a user-id and a password. 314 These will be saved in global variables |g:netrw_uid| and 315 |s:netrw_passwd|; subsequent use of ftp will re-use those two strings, 316 thereby simplifying use of ftp. However, if you need to use a 317 different user id and/or password, you'll want to call |NetUserPass()| 318 first. To work around the need to enter passwords, check if your ftp 319 supports a <.netrc> file in your home directory. Also see 320 |netrw-passwd| (and if you're using ssh/scp hoping to figure out how 321 to not need to use passwords for scp, look at |netrw-ssh-hack|). 322 323 :NetUserPass [uid [password]] -- prompts as needed 324 :call NetUserPass() -- prompts for uid and password 325 :call NetUserPass("uid") -- prompts for password 326 :call NetUserPass("uid","password") -- sets global uid and password 327 328(Related topics: |ftp| |netrw-userpass| |netrw-start|) 329 330NETRW VARIABLES AND SETTINGS *netrw-variables* {{{2 331 (Also see: 332 |netrw-browser-var| : netrw browser option variables 333 |netrw-protocol| : file transfer protocol option variables 334 |netrw-settings| : additional file transfer options 335 |netrw-browser-options| : these options affect browsing directories 336 ) 337 338Netrw provides a lot of variables which allow you to customize netrw to your 339preferences. Most such settings are described below, in 340|netrw-browser-options|, and in |netrw-externapp|: 341 342 *b:netrw_lastfile* last file Network-read/written retained on a 343 per-buffer basis (supports plain :Nw ) 344 345 *g:netrw_bufsettings* the settings that netrw buffers have 346 (default) noma nomod nonu nowrap ro nobl 347 348 *g:netrw_chgwin* specifies a window number where subsequent file edits 349 will take place. (also see |netrw-C|) 350 (default) -1 351 352 *g:Netrw_funcref* specifies a function (or functions) to be called when 353 netrw edits a file. The file is first edited, and 354 then the function reference (|Funcref|) is called. 355 This variable may also hold a |List| of Funcrefs. 356 (default) not defined. (the capital in g:Netrw... 357 is required by its holding a function reference) 358> 359 Example: place in .vimrc; affects all file opening 360 fun! MyFuncRef() 361 endfun 362 let g:Netrw_funcref= function("MyFuncRef") 363 364< 365 *g:Netrw_UserMaps* specifies a function or |List| of functions which can 366 be used to set up user-specified maps and functionality. 367 See |netrw-usermaps| 368 369 *g:netrw_ftp* if it doesn't exist, use default ftp 370 =0 use default ftp (uid password) 371 =1 use alternate ftp method (user uid password) 372 If you're having trouble with ftp, try changing the 373 value of this variable to see if the alternate ftp 374 method works for your setup. 375 376 *g:netrw_ftp_options* Chosen by default, these options are supposed to 377 turn interactive prompting off and to restrain ftp 378 from attempting auto-login upon initial connection. 379 However, it appears that not all ftp implementations 380 support this (ex. ncftp). 381 ="-i -n" 382 383 *g:netrw_ftpextracmd* default: doesn't exist 384 If this variable exists, then any string it contains 385 will be placed into the commands set to your ftp 386 client. As an example: 387 ="passive" 388 389 *g:netrw_ftpmode* ="binary" (default) 390 ="ascii" 391 392 *g:netrw_ignorenetrc* =0 (default for linux, cygwin) 393 =1 If you have a <.netrc> file but it doesn't work and 394 you want it ignored, then set this variable as 395 shown. (default for Windows + cmd.exe) 396 397 *g:netrw_menu* =0 disable netrw's menu 398 =1 (default) netrw's menu enabled 399 400 *g:netrw_uid* (ftp) user-id, retained on a per-vim-session basis 401 *s:netrw_passwd* (ftp) password, retained on a per-vim-session basis 402 403 *g:netrw_preview* =0 (default) preview window shown in a horizontally 404 split window 405 =1 preview window shown in a vertically split window. 406 Also affects the "previous window" (see |netrw-P|) 407 in the same way. 408 The |g:netrw_alto| variable may be used to provide 409 additional splitting control: 410 g:netrw_preview g:netrw_alto result 411 0 0 |:aboveleft| 412 0 1 |:belowright| 413 1 0 |:topleft| 414 1 1 |:botright| 415 To control sizing, see |g:netrw_winsize| 416 417 *g:netrw_scpport* = "-P" : option to use to set port for scp 418 *g:netrw_sshport* = "-p" : option to use to set port for ssh 419 420 *g:netrw_sepchr* =\0xff 421 =\0x01 for enc == euc-jp (and perhaps it should be for 422 others, too, please let me know) 423 Separates priority codes from filenames internally. 424 See |netrw-p12|. 425 426 *g:netrw_silent* =0 : transfers done normally 427 =1 : transfers done silently 428 429 *g:netrw_cygwin* =1 assume scp under windows is from cygwin. Also 430 permits network browsing to use ls with time and 431 size sorting (default if windows) 432 =0 assume Windows' scp accepts windows-style paths 433 Network browsing uses dir instead of ls 434 This option is ignored if you're using unix 435 436 *g:netrw_use_nt_rcp* =0 don't use the rcp of WinNT, Win2000 and WinXP 437 =1 use WinNT's rcp in binary mode (default) 438 439PATHS *netrw-path* {{{2 440 441Paths to files are generally user-directory relative for most protocols. 442It is possible that some protocol will make paths relative to some 443associated directory, however. 444> 445 example: vim scp://user@host/somefile 446 example: vim scp://user@host/subdir1/subdir2/somefile 447< 448where "somefile" is in the "user"'s home directory. If you wish to get a 449file using root-relative paths, use the full path: 450> 451 example: vim scp://user@host//somefile 452 example: vim scp://user@host//subdir1/subdir2/somefile 453< 454 455============================================================================== 4564. Network-Oriented File Transfer *netrw-xfer* {{{1 457 458Network-oriented file transfer under Vim is implemented by a Vim script 459(<netrw.vim>) using plugin techniques. It currently supports both reading and 460writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch, 461dav/cadaver, rsync, or sftp. 462 463http is currently supported read-only via use of wget or fetch. 464 465<netrw.vim> is a standard plugin which acts as glue between Vim and the 466various file transfer programs. It uses autocommand events (BufReadCmd, 467FileReadCmd, BufWriteCmd) to intercept reads/writes with url-like filenames. > 468 469 ex. vim ftp://hostname/path/to/file 470< 471The characters preceding the colon specify the protocol to use; in the 472example, it's ftp. The <netrw.vim> script then formulates a command or a 473series of commands (typically ftp) which it issues to an external program 474(ftp, scp, etc) which does the actual file transfer/protocol. Files are read 475from/written to a temporary file (under Unix/Linux, /tmp/...) which the 476<netrw.vim> script will clean up. 477 478Now, a word about Jan Minář's "FTP User Name and Password Disclosure"; first, 479ftp is not a secure protocol. User names and passwords are transmitted "in 480the clear" over the internet; any snooper tool can pick these up; this is not 481a netrw thing, this is a ftp thing. If you're concerned about this, please 482try to use scp or sftp instead. 483 484Netrw re-uses the user id and password during the same vim session and so long 485as the remote hostname remains the same. 486 487Jan seems to be a bit confused about how netrw handles ftp; normally multiple 488commands are performed in a "ftp session", and he seems to feel that the 489uid/password should only be retained over one ftp session. However, netrw 490does every ftp operation in a separate "ftp session"; so remembering the 491uid/password for just one "ftp session" would be the same as not remembering 492the uid/password at all. IMHO this would rapidly grow tiresome as one 493browsed remote directories, for example. 494 495On the other hand, thanks go to Jan M. for pointing out the many 496vulnerabilities that netrw (and vim itself) had had in handling "crafted" 497filenames. The |shellescape()| and |fnameescape()| functions were written in 498response by Bram Moolenaar to handle these sort of problems, and netrw has 499been modified to use them. Still, my advice is, if the "filename" looks like 500a vim command that you aren't comfortable with having executed, don't open it. 501 502 *netrw-putty* *netrw-pscp* *netrw-psftp* 503One may modify any protocol's implementing external application by setting a 504variable (ex. scp uses the variable g:netrw_scp_cmd, which is defaulted to 505"scp -q"). As an example, consider using PuTTY: > 506 507 let g:netrw_scp_cmd = '"c:\Program Files\PuTTY\pscp.exe" -q -batch' 508 let g:netrw_sftp_cmd= '"c:\Program Files\PuTTY\psftp.exe"' 509< 510(note: it has been reported that windows 7 with putty v0.6's "-batch" option 511 doesn't work, so its best to leave it off for that system) 512 513See |netrw-p8| for more about putty, pscp, psftp, etc. 514 515Ftp, an old protocol, seems to be blessed by numerous implementations. 516Unfortunately, some implementations are noisy (ie., add junk to the end of the 517file). Thus, concerned users may decide to write a NetReadFixup() function 518that will clean up after reading with their ftp. Some Unix systems (ie., 519FreeBSD) provide a utility called "fetch" which uses the ftp protocol but is 520not noisy and more convenient, actually, for <netrw.vim> to use. 521Consequently, if "fetch" is available (ie. executable), it may be preferable 522to use it for ftp://... based transfers. 523 524For rcp, scp, sftp, and http, one may use network-oriented file transfers 525transparently; ie. 526> 527 vim rcp://[user@]machine/path 528 vim scp://[user@]machine/path 529< 530If your ftp supports <.netrc>, then it too can be transparently used 531if the needed triad of machine name, user id, and password are present in 532that file. Your ftp must be able to use the <.netrc> file on its own, however. 533> 534 vim ftp://[user@]machine[[:#]portnumber]/path 535< 536Windows provides an ftp (typically c:\Windows\System32\ftp.exe) which uses 537an option, -s:filename (filename can and probably should be a full path) 538which contains ftp commands which will be automatically run whenever ftp 539starts. You may use this feature to enter a user and password for one site: > 540 userid 541 password 542< *netrw-windows-netrc* *netrw-windows-s* 543If |g:netrw_ftp_cmd| contains -s:[path/]MACHINE, then (on Windows machines 544only) netrw will substitute the current machine name requested for ftp 545connections for MACHINE. Hence one can have multiple machine.ftp files 546containing login and password for ftp. Example: > 547 548 let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\Myself\MACHINE' 549 vim ftp://myhost.somewhere.net/ 550 551will use a file > 552 553 C:\Users\Myself\myhost.ftp 554< 555Often, ftp will need to query the user for the userid and password. 556The latter will be done "silently"; ie. asterisks will show up instead of 557the actually-typed-in password. Netrw will retain the userid and password 558for subsequent read/writes from the most recent transfer so subsequent 559transfers (read/write) to or from that machine will take place without 560additional prompting. 561 562 *netrw-urls* 563 +=================================+============================+============+ 564 | Reading | Writing | Uses | 565 +=================================+============================+============+ 566 | DAV: | | | 567 | dav://host/path | | cadaver | 568 | :Nread dav://host/path | :Nwrite dav://host/path | cadaver | 569 +---------------------------------+----------------------------+------------+ 570 | DAV + SSL: | | | 571 | davs://host/path | | cadaver | 572 | :Nread davs://host/path | :Nwrite davs://host/path | cadaver | 573 +---------------------------------+----------------------------+------------+ 574 | FETCH: | | | 575 | fetch://[user@]host/path | | | 576 | fetch://[user@]host:http/path | Not Available | fetch | 577 | :Nread fetch://[user@]host/path| | | 578 +---------------------------------+----------------------------+------------+ 579 | FILE: | | | 580 | file:///* | file:///* | | 581 | file://localhost/* | file://localhost/* | | 582 +---------------------------------+----------------------------+------------+ 583 | FTP: (*3) | (*3) | | 584 | ftp://[user@]host/path | ftp://[user@]host/path | ftp (*2) | 585 | :Nread ftp://host/path | :Nwrite ftp://host/path | ftp+.netrc | 586 | :Nread host path | :Nwrite host path | ftp+.netrc | 587 | :Nread host uid pass path | :Nwrite host uid pass path | ftp | 588 +---------------------------------+----------------------------+------------+ 589 | HTTP: wget is executable: (*4) | | | 590 | http://[user@]host/path | Not Available | wget | 591 +---------------------------------+----------------------------+------------+ 592 | HTTP: fetch is executable (*4) | | | 593 | http://[user@]host/path | Not Available | fetch | 594 +---------------------------------+----------------------------+------------+ 595 | RCP: | | | 596 | rcp://[user@]host/path | rcp://[user@]host/path | rcp | 597 +---------------------------------+----------------------------+------------+ 598 | RSYNC: | | | 599 | rsync://[user@]host/path | rsync://[user@]host/path | rsync | 600 | :Nread rsync://host/path | :Nwrite rsync://host/path | rsync | 601 | :Nread rcp://host/path | :Nwrite rcp://host/path | rcp | 602 +---------------------------------+----------------------------+------------+ 603 | SCP: | | | 604 | scp://[user@]host/path | scp://[user@]host/path | scp | 605 | :Nread scp://host/path | :Nwrite scp://host/path | scp (*1) | 606 +---------------------------------+----------------------------+------------+ 607 | SFTP: | | | 608 | sftp://[user@]host/path | sftp://[user@]host/path | sftp | 609 | :Nread sftp://host/path | :Nwrite sftp://host/path | sftp (*1) | 610 +=================================+============================+============+ 611 612 (*1) For an absolute path use scp://machine//path. 613 614 (*2) if <.netrc> is present, it is assumed that it will 615 work with your ftp client. Otherwise the script will 616 prompt for user-id and password. 617 618 (*3) for ftp, "machine" may be machine#port or machine:port 619 if a different port is needed than the standard ftp port 620 621 (*4) for http:..., if wget is available it will be used. Otherwise, 622 if fetch is available it will be used. 623 624Both the :Nread and the :Nwrite ex-commands can accept multiple filenames. 625 626 627NETRC *netrw-netrc* 628 629The <.netrc> file, typically located in your home directory, contains lines 630therein which map a hostname (machine name) to the user id and password you 631prefer to use with it. 632 633The typical syntax for lines in a <.netrc> file is given as shown below. 634Ftp under Unix usually supports <.netrc>; ftp under Windows usually doesn't. 635> 636 machine {full machine name} login {user-id} password "{password}" 637 default login {user-id} password "{password}" 638 639Your ftp client must handle the use of <.netrc> on its own, but if the 640<.netrc> file exists, an ftp transfer will not ask for the user-id or 641password. 642 643 Note: 644 Since this file contains passwords, make very sure nobody else can 645 read this file! Most programs will refuse to use a .netrc that is 646 readable for others. Don't forget that the system administrator can 647 still read the file! Ie. for Linux/Unix: chmod 600 .netrc 648 649Even though Windows' ftp clients typically do not support .netrc, netrw has 650a work-around: see |netrw-windows-s|. 651 652 653PASSWORD *netrw-passwd* 654 655The script attempts to get passwords for ftp invisibly using |inputsecret()|, 656a built-in Vim function. See |netrw-userpass| for how to change the password 657after one has set it. 658 659Unfortunately there doesn't appear to be a way for netrw to feed a password to 660scp. Thus every transfer via scp will require re-entry of the password. 661However, |netrw-ssh-hack| can help with this problem. 662 663 664============================================================================== 6655. Activation *netrw-activate* {{{1 666 667Network-oriented file transfers are available by default whenever Vim's 668'nocompatible' mode is enabled. Netrw's script files reside in your 669system's plugin, autoload, and syntax directories; just the 670plugin/netrwPlugin.vim script is sourced automatically whenever you bring up 671vim. The main script in autoload/netrw.vim is only loaded when you actually 672use netrw. I suggest that, at a minimum, you have at least the following in 673your <.vimrc> customization file: > 674 675 set nocp 676 if version >= 600 677 filetype plugin indent on 678 endif 679< 680By also including the following lines in your .vimrc, one may have netrw 681immediately activate when using [g]vim without any filenames, showing the 682current directory: > 683 684 " Augroup VimStartup: 685 augroup VimStartup 686 au! 687 au VimEnter * if expand("%") == "" | e . | endif 688 augroup END 689< 690 691============================================================================== 6926. Transparent Remote File Editing *netrw-transparent* {{{1 693 694Transparent file transfers occur whenever a regular file read or write 695(invoked via an |:autocmd| for |BufReadCmd|, |BufWriteCmd|, or |SourceCmd| 696events) is made. Thus one may read, write, or source files across networks 697just as easily as if they were local files! > 698 699 vim ftp://[user@]machine/path 700 ... 701 :wq 702 703See |netrw-activate| for more on how to encourage your vim to use plugins 704such as netrw. 705 706For password-free use of scp:, see |netrw-ssh-hack|. 707 708 709============================================================================== 7107. Ex Commands *netrw-ex* {{{1 711 712The usual read/write commands are supported. There are also a few 713additional commands available. Often you won't need to use Nwrite or 714Nread as shown in |netrw-transparent| (ie. simply use > 715 :e URL 716 :r URL 717 :w URL 718instead, as appropriate) -- see |netrw-urls|. In the explanations 719below, a {netfile} is a URL to a remote file. 720 721 *:Nwrite* *:Nw* 722:[range]Nw[rite] Write the specified lines to the current 723 file as specified in b:netrw_lastfile. 724 (related: |netrw-nwrite|) 725 726:[range]Nw[rite] {netfile} [{netfile}]... 727 Write the specified lines to the {netfile}. 728 729 *:Nread* *:Nr* 730:Nr[ead] Read the lines from the file specified in b:netrw_lastfile 731 into the current buffer. (related: |netrw-nread|) 732 733:Nr[ead] {netfile} {netfile}... 734 Read the {netfile} after the current line. 735 736 *:Nsource* *:Ns* 737:Ns[ource] {netfile} 738 Source the {netfile}. 739 To start up vim using a remote .vimrc, one may use 740 the following (all on one line) (tnx to Antoine Mechelynck) > 741 vim -u NORC -N 742 --cmd "runtime plugin/netrwPlugin.vim" 743 --cmd "source scp://HOSTNAME/.vimrc" 744< (related: |netrw-source|) 745 746:call NetUserPass() *NetUserPass()* 747 If g:netrw_uid and s:netrw_passwd don't exist, 748 this function will query the user for them. 749 (related: |netrw-userpass|) 750 751:call NetUserPass("userid") 752 This call will set the g:netrw_uid and, if 753 the password doesn't exist, will query the user for it. 754 (related: |netrw-userpass|) 755 756:call NetUserPass("userid","passwd") 757 This call will set both the g:netrw_uid and s:netrw_passwd. 758 The user-id and password are used by ftp transfers. One may 759 effectively remove the user-id and password by using empty 760 strings (ie. ""). 761 (related: |netrw-userpass|) 762 763 764============================================================================== 7658. Variables and Options *netrw-var* *netrw-settings* {{{1 766 767(also see: |netrw-options| |netrw-variables| |netrw-protocol| 768 |netrw-browser-settings| |netrw-browser-options| ) 769 770The <netrw.vim> script provides several variables which act as options to 771affect <netrw.vim>'s file transfer behavior. These variables typically may be 772set in the user's <.vimrc> file: (see also |netrw-settings| |netrw-protocol|) 773 *netrw-options* 774> 775 ------------- 776 Netrw Options 777 ------------- 778 Option Meaning 779 -------------- ----------------------------------------------- 780< 781 b:netrw_col Holds current cursor position (during NetWrite) 782 g:netrw_cygwin =1 assume scp under windows is from cygwin 783 (default/windows) 784 =0 assume scp under windows accepts windows 785 style paths (default/else) 786 g:netrw_ftp =0 use default ftp (uid password) 787 g:netrw_ftpmode ="binary" (default) 788 ="ascii" (your choice) 789 g:netrw_ignorenetrc =1 (default) 790 if you have a <.netrc> file but you don't 791 want it used, then set this variable. Its 792 mere existence is enough to cause <.netrc> 793 to be ignored. 794 b:netrw_lastfile Holds latest method/machine/path. 795 b:netrw_line Holds current line number (during NetWrite) 796 g:netrw_silent =0 transfers done normally 797 =1 transfers done silently 798 g:netrw_uid Holds current user-id for ftp. 799 g:netrw_use_nt_rcp =0 don't use WinNT/2K/XP's rcp (default) 800 =1 use WinNT/2K/XP's rcp, binary mode 801 ----------------------------------------------------------------------- 802< 803 *netrw-internal-variables* 804The script will also make use of the following variables internally, albeit 805temporarily. 806> 807 ------------------- 808 Temporary Variables 809 ------------------- 810 Variable Meaning 811 -------- ------------------------------------ 812< 813 b:netrw_method Index indicating rcp/ftp+.netrc/ftp 814 w:netrw_method (same as b:netrw_method) 815 g:netrw_machine Holds machine name parsed from input 816 b:netrw_fname Holds filename being accessed > 817 ------------------------------------------------------------ 818< 819 *netrw-protocol* 820 821Netrw supports a number of protocols. These protocols are invoked using the 822variables listed below, and may be modified by the user. 823> 824 ------------------------ 825 Protocol Control Options 826 ------------------------ 827 Option Type Setting Meaning 828 --------- -------- -------------- --------------------------- 829< netrw_ftp variable =doesn't exist userid set by "user userid" 830 =0 userid set by "user userid" 831 =1 userid set by "userid" 832 NetReadFixup function =doesn't exist no change 833 =exists Allows user to have files 834 read via ftp automatically 835 transformed however they wish 836 by NetReadFixup() 837 g:netrw_dav_cmd var ="cadaver" if cadaver is executable 838 g:netrw_dav_cmd var ="curl -o" elseif curl is executable 839 g:netrw_fetch_cmd var ="fetch -o" if fetch is available 840 g:netrw_ftp_cmd var ="ftp" 841 g:netrw_http_cmd var ="fetch -o" if fetch is available 842 g:netrw_http_cmd var ="wget -O" else if wget is available 843 g:netrw_http_put_cmd var ="curl -T" 844 |g:netrw_list_cmd| var ="ssh USEPORT HOSTNAME ls -Fa" 845 g:netrw_rcp_cmd var ="rcp" 846 g:netrw_rsync_cmd var ="rsync" 847 *g:netrw_rsync_sep* var ="/" used to separate the hostname 848 from the file spec 849 g:netrw_scp_cmd var ="scp -q" 850 g:netrw_sftp_cmd var ="sftp" > 851 ------------------------------------------------------------------------- 852< 853 *netrw-ftp* 854 855The g:netrw_..._cmd options (|g:netrw_ftp_cmd| and |g:netrw_sftp_cmd|) 856specify the external program to use handle the ftp protocol. They may 857include command line options (such as -p for passive mode). Example: > 858 859 let g:netrw_ftp_cmd= "ftp -p" 860< 861Browsing is supported by using the |g:netrw_list_cmd|; the substring 862"HOSTNAME" will be changed via substitution with whatever the current request 863is for a hostname. 864 865Two options (|g:netrw_ftp| and |netrw-fixup|) both help with certain ftp's 866that give trouble . In order to best understand how to use these options if 867ftp is giving you troubles, a bit of discussion is provided on how netrw does 868ftp reads. 869 870For ftp, netrw typically builds up lines of one of the following formats in a 871temporary file: 872> 873 IF g:netrw_ftp !exists or is not 1 IF g:netrw_ftp exists and is 1 874 ---------------------------------- ------------------------------ 875< 876 open machine [port] open machine [port] 877 user userid password userid password 878 [g:netrw_ftpmode] password 879 [g:netrw_ftpextracmd] [g:netrw_ftpmode] 880 get filename tempfile [g:netrw_extracmd] 881 get filename tempfile > 882 --------------------------------------------------------------------- 883< 884The |g:netrw_ftpmode| and |g:netrw_ftpextracmd| are optional. 885 886Netrw then executes the lines above by use of a filter: 887> 888 :%! {g:netrw_ftp_cmd} -i [-n] 889< 890where 891 g:netrw_ftp_cmd is usually "ftp", 892 -i tells ftp not to be interactive 893 -n means don't use netrc and is used for Method #3 (ftp w/o <.netrc>) 894 895If <.netrc> exists it will be used to avoid having to query the user for 896userid and password. The transferred file is put into a temporary file. 897The temporary file is then read into the main editing session window that 898requested it and the temporary file deleted. 899 900If your ftp doesn't accept the "user" command and immediately just demands a 901userid, then try putting "let netrw_ftp=1" in your <.vimrc>. 902 903 *netrw-cadaver* 904To handle the SSL certificate dialog for untrusted servers, one may pull 905down the certificate and place it into /usr/ssl/cert.pem. This operation 906renders the server treatment as "trusted". 907 908 *netrw-fixup* *netreadfixup* 909If your ftp for whatever reason generates unwanted lines (such as AUTH 910messages) you may write a NetReadFixup() function: 911> 912 function! NetReadFixup(method,line1,line2) 913 " a:line1: first new line in current file 914 " a:line2: last new line in current file 915 if a:method == 1 "rcp 916 elseif a:method == 2 "ftp + <.netrc> 917 elseif a:method == 3 "ftp + machine,uid,password,filename 918 elseif a:method == 4 "scp 919 elseif a:method == 5 "http/wget 920 elseif a:method == 6 "dav/cadaver 921 elseif a:method == 7 "rsync 922 elseif a:method == 8 "fetch 923 elseif a:method == 9 "sftp 924 else " complain 925 endif 926 endfunction 927> 928The NetReadFixup() function will be called if it exists and thus allows you to 929customize your reading process. 930 931(Related topics: |ftp| |netrw-userpass| |netrw-start|) 932 933============================================================================== 9349. Browsing *netrw-browsing* *netrw-browse* *netrw-help* {{{1 935 *netrw-browser* *netrw-dir* *netrw-list* 936 937INTRODUCTION TO BROWSING *netrw-intro-browse* {{{2 938 (Quick References: |netrw-quickmaps| |netrw-quickcoms|) 939 940Netrw supports the browsing of directories on your local system and on remote 941hosts; browsing includes listing files and directories, entering directories, 942editing files therein, deleting files/directories, making new directories, 943moving (renaming) files and directories, copying files and directories, etc. 944One may mark files and execute any system command on them! The Netrw browser 945generally implements the previous explorer's maps and commands for remote 946directories, although details (such as pertinent global variable names) 947necessarily differ. To browse a local directory with netrw, use |:Explore|: > 948 949 :Explore /your/directory/ 950 :Explore . 951 :Explore c:\your\directory\ 952< 953(Related topics: |netrw-cr| |netrw-o| |netrw-p| |netrw-P| |netrw-t| 954 |netrw-mf| |netrw-mx| |netrw-D| |netrw-R| |netrw-v| ) 955 956The Netrw remote file and directory browser handles two protocols: ssh and 957ftp. The protocol in the url, if it is ftp, will cause netrw also to use ftp 958in its remote browsing. Specifying any other protocol will cause it to be 959used for file transfers; but the ssh protocol will be used to do remote 960browsing. 961 962To use Netrw's remote directory browser, simply attempt to read a "file" with 963a trailing slash and it will be interpreted as a request to list a directory: 964> 965 vim [protocol]://[user@]hostname/path/ 966< 967where [protocol] is typically scp or ftp. As an example, try: > 968 969 vim ftp://ftp.home.vim.org/pub/vim/ 970< 971For local directories, the trailing slash is not required. Again, because it's 972easy to miss: to browse remote directories, the URL must terminate with a 973slash! 974 975If you'd like to avoid entering the password repeatedly for remote directory 976listings with ssh or scp, see |netrw-ssh-hack|. To avoid password entry with 977ftp, see |netrw-netrc| (if your ftp supports it). 978 979There are several things you can do to affect the browser's display of files: 980 981 * To change the listing style, press the "i" key (|netrw-i|). 982 Currently there are four styles: thin, long, wide, and tree. 983 To make that change "permanent", see |g:netrw_liststyle|. 984 985 * To hide files (don't want to see those xyz~ files anymore?) see 986 |netrw-ctrl-h|. 987 988 * Press s to sort files by name, time, or size. 989 990See |netrw-browse-cmds| for all the things you can do with netrw! 991 992 *netrw-getftype* *netrw-filigree* *netrw-ftype* 993The |getftype()| function is used to append a bit of filigree to indicate 994filetype to locally listed files: 995 996 directory : / 997 executable : * 998 fifo : | 999 links : @ 1000 sockets : = 1001 1002The filigree also affects the |g:netrw_sort_sequence|. 1003 1004 1005QUICK HELP *netrw-quickhelp* {{{2 1006 (Use ctrl-] to select a topic)~ 1007 Intro to Browsing...............................|netrw-intro-browse| 1008 Quick Reference: Maps.........................|netrw-quickmap| 1009 Quick Reference: Commands.....................|netrw-browse-cmds| 1010 Hiding 1011 Edit hiding list..............................|netrw-ctrl-h| 1012 Hiding Files or Directories...................|netrw-a| 1013 Hiding/Unhiding by suffix.....................|netrw-mh| 1014 Hiding dot-files.............................|netrw-gh| 1015 Listing Style 1016 Select listing style (thin/long/wide/tree)....|netrw-i| 1017 Associated setting variable...................|g:netrw_liststyle| 1018 Shell command used to perform listing.........|g:netrw_list_cmd| 1019 Quick file info...............................|netrw-qf| 1020 Sorted by 1021 Select sorting style (name/time/size).........|netrw-s| 1022 Editing the sorting sequence..................|netrw-S| 1023 Sorting options...............................|g:netrw_sort_options| 1024 Associated setting variable...................|g:netrw_sort_sequence| 1025 Reverse sorting order.........................|netrw-r| 1026 1027 1028 *netrw-quickmap* *netrw-quickmaps* 1029QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 1030> 1031 --- ----------------- ---- 1032 Map Quick Explanation Link 1033 --- ----------------- ---- 1034< <F1> Causes Netrw to issue help 1035 <cr> Netrw will enter the directory or read the file |netrw-cr| 1036 <del> Netrw will attempt to remove the file/directory |netrw-del| 1037 <c-h> Edit file hiding list |netrw-ctrl-h| 1038 <c-l> Causes Netrw to refresh the directory listing |netrw-ctrl-l| 1039 <c-r> Browse using a gvim server |netrw-ctrl-r| 1040 <c-tab> Shrink/expand a netrw/explore window |netrw-c-tab| 1041 - Makes Netrw go up one directory |netrw--| 1042 a Cycles between normal display, |netrw-a| 1043 hiding (suppress display of files matching g:netrw_list_hide) 1044 and showing (display only files which match g:netrw_list_hide) 1045 cd Make browsing directory the current directory |netrw-cd| 1046 C Setting the editing window |netrw-C| 1047 d Make a directory |netrw-d| 1048 D Attempt to remove the file(s)/directory(ies) |netrw-D| 1049 gb Go to bookmark |netrw-gb| 1050 gd Force treatment as directory |netrw-gd| 1051 gf Force treatment as file |netrw-gf| 1052 gh Quick hide/unhide of dot-files |netrw-gh| 1053 gn Make top of tree the directory below the cursor |netrw-gn| 1054 gp Change local-only file permissions |netrw-gp| 1055 i Cycle between thin, long, wide, and tree listings |netrw-i| 1056 I Toggle the displaying of the banner |netrw-I| 1057 mb Bookmark current directory |netrw-mb| 1058 mB Delete bookmark |netrw-mB| 1059 mc Copy marked files to marked-file target directory |netrw-mc| 1060 md Apply diff to marked files (up to 3) |netrw-md| 1061 me Place marked files on arg list and edit them |netrw-me| 1062 mf Mark a file |netrw-mf| 1063 mF Unmark buffer-local files |netrw-mF| 1064 mg Apply vimgrep to marked files |netrw-mg| 1065 mh Toggle marked file suffices' presence on hiding list |netrw-mh| 1066 mm Move marked files to marked-file target directory |netrw-mm| 1067 mr Mark files using a shell-style |regexp| |netrw-mr| 1068 mt Current browsing directory becomes markfile target |netrw-mt| 1069 mT Apply ctags to marked files |netrw-mT| 1070 mu Unmark all marked files |netrw-mu| 1071 mv Apply arbitrary vim command to marked files |netrw-mv| 1072 mx Apply arbitrary shell command to marked files |netrw-mx| 1073 mX Apply arbitrary shell command to marked files en bloc|netrw-mX| 1074 mz Compress/decompress marked files |netrw-mz| 1075 o Enter the file/directory under the cursor in a new |netrw-o| 1076 browser window. A horizontal split is used. 1077 O Obtain a file specified by cursor |netrw-O| 1078 p Preview the file |netrw-p| 1079 P Browse in the previously used window |netrw-P| 1080 qb List bookmarked directories and history |netrw-qb| 1081 qf Display information on file |netrw-qf| 1082 qF Mark files using a quickfix list |netrw-qF| 1083 qL Mark files using a |location-list| |netrw-qL| 1084 r Reverse sorting order |netrw-r| 1085 R Rename the designated file(s)/directory(ies) |netrw-R| 1086 s Select sorting style: by name, time, or file size |netrw-s| 1087 S Specify suffix priority for name-sorting |netrw-S| 1088 t Enter the file/directory under the cursor in a new tab|netrw-t| 1089 u Change to recently-visited directory |netrw-u| 1090 U Change to subsequently-visited directory |netrw-U| 1091 v Enter the file/directory under the cursor in a new |netrw-v| 1092 browser window. A vertical split is used. 1093 x View file with an associated program 1094 X Execute filename under cursor via |system()| |netrw-X| 1095 1096 % Open a new file in netrw's current directory |netrw-%| 1097 1098 *netrw-mouse* *netrw-leftmouse* *netrw-middlemouse* *netrw-rightmouse* 1099 <leftmouse> (gvim only) selects word under mouse as if a <cr> 1100 had been pressed (ie. edit file, change directory) 1101 <middlemouse> (gvim only) same as P selecting word under mouse; 1102 see |netrw-P| 1103 <rightmouse> (gvim only) delete file/directory using word under 1104 mouse 1105 <2-leftmouse> (gvim only) when: 1106 * in a netrw-selected file, AND 1107 * |g:netrw_retmap| == 1 AND 1108 * the user doesn't already have a <2-leftmouse> 1109 mapping defined before netrw is autoloaded, 1110 then a double clicked leftmouse button will return 1111 to the netrw browser window. See |g:netrw_retmap|. 1112 <s-leftmouse> (gvim only) like mf, will mark files. Dragging 1113 the shifted leftmouse will mark multiple files. 1114 (see |netrw-mf|) 1115 1116 (to disable mouse buttons while browsing: |g:netrw_mousemaps|) 1117 1118 *netrw-quickcom* *netrw-quickcoms* 1119QUICK REFERENCE: COMMANDS *netrw-explore-cmds* *netrw-browse-cmds* {{{2 1120 :Ntree....................................................|netrw-ntree| 1121 :Explore[!] [dir] Explore directory of current file......|netrw-explore| 1122 :Hexplore[!] [dir] Horizontal Split & Explore.............|netrw-explore| 1123 :Lexplore[!] [dir] Left Explorer Toggle...................|netrw-explore| 1124 :Nexplore[!] [dir] Vertical Split & Explore...............|netrw-explore| 1125 :Pexplore[!] [dir] Vertical Split & Explore...............|netrw-explore| 1126 :Rexplore Return to Explorer.....................|netrw-explore| 1127 :Sexplore[!] [dir] Split & Explore directory .............|netrw-explore| 1128 :Texplore[!] [dir] Tab & Explore..........................|netrw-explore| 1129 :Vexplore[!] [dir] Vertical Split & Explore...............|netrw-explore| 1130 1131 1132BANNER DISPLAY *netrw-I* 1133 1134One may toggle the displaying of the banner by pressing "I". 1135 1136Also See: |g:netrw_banner| 1137 1138 1139BOOKMARKING A DIRECTORY *netrw-mb* *netrw-bookmark* *netrw-bookmarks* {{{2 1140 1141One may easily "bookmark" the currently browsed directory by using > 1142 1143 mb 1144< 1145Note: Bookmarked paths are normalized and stored as absolute paths. 1146 1147 *.netrwbook* 1148Bookmarks are retained in between sessions of vim in a file called .netrwbook 1149as a |List|, which is typically stored in the first directory on the user's 1150'runtimepath'; entries are kept in sorted order. 1151 1152If there are marked files and/or directories, mb will add them to the bookmark 1153list. 1154 1155 *netrw-:NetrwMB* 1156Additionally, one may use :NetrwMB to bookmark files or directories. > 1157 1158 :NetrwMB[!] [files/directories] 1159 1160< No bang: enters files/directories into Netrw's bookmark system 1161 1162 No argument and in netrw buffer: 1163 if there are marked files : bookmark marked files 1164 otherwise : bookmark file/directory under cursor 1165 No argument and not in netrw buffer: bookmarks current open file 1166 Has arguments : |glob()|s each arg and bookmarks them 1167 1168 With bang: deletes files/directories from Netrw's bookmark system 1169 1170The :NetrwMB command is available outside of netrw buffers (once netrw has been 1171invoked in the session). 1172 1173The file ".netrwbook" holds bookmarks when netrw (and vim) is not active. By 1174default, its stored on the first directory on the user's 'runtimepath'. 1175 1176Related Topics: 1177 |netrw-gb| how to return (go) to a bookmark 1178 |netrw-mB| how to delete bookmarks 1179 |netrw-qb| how to list bookmarks 1180 |g:netrw_home| controls where .netrwbook is kept 1181 1182 1183BROWSING *netrw-enter* *netrw-cr* {{{2 1184 1185Browsing is simple: move the cursor onto a file or directory of interest. 1186Hitting the <cr> (the return key) will select the file or directory. 1187Directories will themselves be listed, and files will be opened using the 1188protocol given in the original read request. 1189 1190 CAVEAT: There are four forms of listing (see |netrw-i|). Netrw assumes that 1191 two or more spaces delimit filenames and directory names for the long and 1192 wide listing formats. Thus, if your filename or directory name has two or 1193 more sequential spaces embedded in it, or any trailing spaces, then you'll 1194 need to use the "thin" format to select it. 1195 1196The |g:netrw_browse_split| option, which is zero by default, may be used to 1197cause the opening of files to be done in a new window or tab instead of the 1198default. When the option is one or two, the splitting will be taken 1199horizontally or vertically, respectively. When the option is set to three, a 1200<cr> will cause the file to appear in a new tab. 1201 1202 1203When using the gui (gvim), one may select a file by pressing the <leftmouse> 1204button. In addition, if 1205 1206 * |g:netrw_retmap| == 1 AND (its default value is 0) 1207 * in a netrw-selected file, AND 1208 * the user doesn't already have a <2-leftmouse> mapping defined before 1209 netrw is loaded 1210 1211then a doubly-clicked leftmouse button will return to the netrw browser 1212window. 1213 1214Netrw attempts to speed up browsing, especially for remote browsing where one 1215may have to enter passwords, by keeping and re-using previously obtained 1216directory listing buffers. The |g:netrw_fastbrowse| variable is used to 1217control this behavior; one may have slow browsing (no buffer re-use), medium 1218speed browsing (re-use directory buffer listings only for remote directories), 1219and fast browsing (re-use directory buffer listings as often as possible). 1220The price for such re-use is that when changes are made (such as new files 1221are introduced into a directory), the listing may become out-of-date. One may 1222always refresh directory listing buffers by pressing ctrl-L (see 1223|netrw-ctrl-l|). 1224 1225 *netrw-s-cr* 1226Squeezing the Current Tree-Listing Directory~ 1227 1228When the tree listing style is enabled (see |netrw-i|) and one is using 1229gvim, then the <s-cr> mapping may be used to squeeze (close) the 1230directory currently containing the cursor. 1231 1232Otherwise, one may remap a key combination of one's own choice to get 1233this effect: > 1234 1235 nmap <buffer> <silent> <nowait> YOURKEYCOMBO <Plug>NetrwTreeSqueeze 1236< 1237Put this line in $HOME/ftplugin/netrw/netrw.vim; it needs to be generated 1238for netrw buffers only. 1239 1240Related topics: 1241 |netrw-ctrl-r| |netrw-o| |netrw-p| 1242 |netrw-P| |netrw-t| |netrw-v| 1243Associated setting variables: 1244 |g:netrw_browse_split| |g:netrw_fastbrowse| 1245 |g:netrw_ftp_list_cmd| |g:netrw_ftp_sizelist_cmd| 1246 |g:netrw_ftp_timelist_cmd| |g:netrw_ssh_browse_reject| 1247 |g:netrw_ssh_cmd| |g:netrw_use_noswf| 1248 1249 1250BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o* *netrw-horiz* {{{2 1251 1252Normally one enters a file or directory using the <cr>. However, the "o" map 1253allows one to open a new window to hold the new directory listing or file. A 1254horizontal split is used. (for vertical splitting, see |netrw-v|) 1255 1256Normally, the o key splits the window horizontally with the new window and 1257cursor at the top. 1258 1259Associated setting variables: |g:netrw_alto| |g:netrw_winsize| 1260 1261Related topics: 1262 |netrw-ctrl-r| |netrw-o| |netrw-p| 1263 |netrw-P| |netrw-t| |netrw-v| 1264Associated setting variables: 1265 |g:netrw_alto| control above/below splitting 1266 |g:netrw_winsize| control initial sizing 1267 1268BROWSING WITH A NEW TAB *netrw-t* {{{2 1269 1270Normally one enters a file or directory using the <cr>. The "t" map 1271allows one to open a new window holding the new directory listing or file in 1272a new tab. 1273 1274If you'd like to have the new listing in a background tab, use |gT|. 1275 1276Related topics: 1277 |netrw-ctrl-r| |netrw-o| |netrw-p| 1278 |netrw-P| |netrw-t| |netrw-v| 1279Associated setting variables: 1280 |g:netrw_winsize| control initial sizing 1281 1282BROWSING WITH A VERTICALLY SPLIT WINDOW *netrw-v* {{{2 1283 1284Normally one enters a file or directory using the <cr>. However, the "v" map 1285allows one to open a new window to hold the new directory listing or file. A 1286vertical split is used. (for horizontal splitting, see |netrw-o|) 1287 1288Normally, the v key splits the window vertically with the new window and 1289cursor at the left. 1290 1291There is only one tree listing buffer; using "v" on a displayed subdirectory 1292will split the screen, but the same buffer will be shown twice. 1293 1294Related topics: 1295 |netrw-ctrl-r| |netrw-o| |netrw-p| 1296 |netrw-P| |netrw-t| |netrw-v| 1297Associated setting variables: 1298 |g:netrw_altv| control right/left splitting 1299 |g:netrw_winsize| control initial sizing 1300 1301 1302BROWSING USING A GVIM SERVER *netrw-ctrl-r* {{{2 1303 1304One may keep a browsing gvim separate from the gvim being used to edit. 1305Use the <c-r> map on a file (not a directory) in the netrw browser, and it 1306will use a gvim server (see |g:netrw_servername|). Subsequent use of <cr> 1307(see |netrw-cr|) will re-use that server for editing files. 1308 1309Related topics: 1310 |netrw-ctrl-r| |netrw-o| |netrw-p| 1311 |netrw-P| |netrw-t| |netrw-v| 1312Associated setting variables: 1313 |g:netrw_servername| : sets name of server 1314 |g:netrw_browse_split| : controls how <cr> will open files 1315 1316 1317CHANGE LISTING STYLE (THIN LONG WIDE TREE) *netrw-i* {{{2 1318 1319The "i" map cycles between the thin, long, wide, and tree listing formats. 1320 1321The thin listing format gives just the files' and directories' names. 1322 1323The long listing is either based on the "ls" command via ssh for remote 1324directories or displays the filename, file size (in bytes), and the time and 1325date of last modification for local directories. With the long listing 1326format, netrw is not able to recognize filenames which have trailing spaces. 1327Use the thin listing format for such files. 1328 1329The wide listing format uses two or more contiguous spaces to delineate 1330filenames; when using that format, netrw won't be able to recognize or use 1331filenames which have two or more contiguous spaces embedded in the name or any 1332trailing spaces. The thin listing format will, however, work with such files. 1333The wide listing format is the most compact. 1334 1335The tree listing format has a top directory followed by files and directories 1336preceded by one or more "|"s, which indicate the directory depth. One may 1337open and close directories by pressing the <cr> key while atop the directory 1338name. 1339 1340One may make a preferred listing style your default; see |g:netrw_liststyle|. 1341As an example, by putting the following line in your .vimrc, > 1342 let g:netrw_liststyle= 3 1343the tree style will become your default listing style. 1344 1345One typical way to use the netrw tree display is to: > 1346 1347 :Explore . 1348 (use i until a tree display shows) 1349 navigate to a file 1350 v (edit as desired in vertically split window) 1351 ctrl-w h (to return to the netrw listing) 1352 P (edit newly selected file in the previous window) 1353 ctrl-w h (to return to the netrw listing) 1354 P (edit newly selected file in the previous window) 1355 ...etc... 1356< 1357Associated setting variables: |g:netrw_liststyle| |g:netrw_maxfilenamelen| 1358 |g:netrw_timefmt| |g:netrw_list_cmd| 1359 1360CHANGE FILE PERMISSION *netrw-gp* {{{2 1361 1362"gp" will ask you for a new permission for the file named under the cursor. 1363Currently, this only works for local files. 1364 1365Associated setting variables: |g:netrw_chgperm| 1366 1367 1368CHANGING TO A BOOKMARKED PATH *netrw-gb* {{{2 1369 1370To change to a bookmarked path, use > 1371 1372 [{cnt}]gb 1373 1374Any count may be used to reference any of the bookmarks. 1375If {cnt} is omitted, it shows a list of the current bookmarks 1376and prompts for a bookmark number to go to. 1377 1378Note that |netrw-qb| shows both bookmarks and history; to go 1379to a location stored in the history see |netrw-u| and |netrw-U|. 1380 1381Related Topics: 1382 |netrw-mB| how to delete bookmarks 1383 |netrw-mb| how to make a bookmark 1384 |netrw-qb| how to list bookmarks 1385 1386 1387CHANGING TO A PREDECESSOR DIRECTORY *netrw-u* *netrw-updir* {{{2 1388 1389Every time you change to a new directory (new for the current session), netrw 1390will save the directory in a recently-visited directory history list (unless 1391|g:netrw_dirhistmax| is zero; by default, it holds ten entries). With the "u" 1392map, one can change to an earlier directory (predecessor). To do the 1393opposite, see |netrw-U|. 1394 1395The "u" map also accepts counts to go back in the history several slots. For 1396your convenience, qb (see |netrw-qb|) lists the history number which may be 1397used in that count. 1398 1399 *.netrwhist* 1400See |g:netrw_dirhistmax| for how to control the quantity of history stack 1401slots. The file ".netrwhist" holds history when netrw (and vim) is not 1402active. By default, its stored on the first directory on the user's 1403'runtimepath'. 1404 1405Related Topics: 1406 |netrw-U| changing to a successor directory 1407 |g:netrw_home| controls where .netrwhist is kept 1408 1409 1410CHANGING TO A SUCCESSOR DIRECTORY *netrw-U* *netrw-downdir* {{{2 1411 1412With the "U" map, one can change to a later directory (successor). 1413This map is the opposite of the "u" map. (see |netrw-u|) Use the 1414qb map to list both the bookmarks and history. (see |netrw-qb|) 1415 1416The "U" map also accepts counts to go forward in the history several slots. 1417 1418See |g:netrw_dirhistmax| for how to control the quantity of history stack 1419slots. 1420 1421 1422CHANGING TREE TOP *netrw-ntree* *:Ntree* *netrw-gn* {{{2 1423 1424One may specify a new tree top for tree listings using > 1425 1426 :Ntree [dirname] 1427 1428Without a "dirname", the current line is used (and any leading depth 1429information is elided). 1430With a "dirname", the specified directory name is used. 1431 1432The "gn" map will take the word below the cursor and use that for 1433changing the top of the tree listing. 1434 1435 *netrw-curdir* 1436DELETING BOOKMARKS *netrw-mB* {{{2 1437 1438To delete a bookmark, use > 1439 1440 [{cnt}]mB 1441 1442If there are marked files, then mB will remove them from the 1443bookmark list. 1444If no files are marked and {cnt} is omitted, it shows a list 1445of the current bookmarks and prompts for a bookmark number 1446to delete. 1447 1448Alternatively, one may use :NetrwMB! (see |netrw-:NetrwMB|). > 1449 1450 :NetrwMB! [files/directories] 1451 1452Related Topics: 1453 |netrw-gb| how to return (go) to a bookmark 1454 |netrw-mb| how to make a bookmark 1455 |netrw-qb| how to list bookmarks 1456 1457 1458DELETING FILES OR DIRECTORIES *netrw-delete* *netrw-D* *netrw-del* {{{2 1459 1460If files have not been marked with |netrw-mf|: (local marked file list) 1461 1462 Deleting/removing files and directories involves moving the cursor to the 1463 file/directory to be deleted and pressing "D". Directories must be empty 1464 first before they can be successfully removed. If the directory is a 1465 softlink to a directory, then netrw will make two requests to remove the 1466 directory before succeeding. Netrw will ask for confirmation before doing 1467 the removal(s). You may select a range of lines with the "V" command 1468 (visual selection), and then pressing "D". 1469 1470If files have been marked with |netrw-mf|: (local marked file list) 1471 1472 Marked files (and empty directories) will be deleted; again, you'll be 1473 asked to confirm the deletion before it actually takes place. 1474 1475A further approach is to delete files which match a pattern. 1476 1477 * use :MF pattern (see |netrw-:MF|); then press "D". 1478 1479 * use mr (see |netrw-mr|) which will prompt you for pattern. 1480 This will cause the matching files to be marked. Then, 1481 press "D". 1482 1483Please note that only empty directories may be deleted with the "D" mapping. 1484Regular files are deleted with |delete()|, too. 1485 1486The |g:netrw_rm_cmd|, |g:netrw_rmf_cmd|, and |g:netrw_rmdir_cmd| variables are 1487used to control the attempts to remove remote files and directories. The 1488g:netrw_rm_cmd is used with files, and its default value is: 1489 1490 g:netrw_rm_cmd: ssh HOSTNAME rm 1491 1492The g:netrw_rmdir_cmd variable is used to support the removal of directories. 1493Its default value is: 1494 1495 |g:netrw_rmdir_cmd|: ssh HOSTNAME rmdir 1496 1497If removing a directory fails with g:netrw_rmdir_cmd, netrw then will attempt 1498to remove it again using the g:netrw_rmf_cmd variable. Its default value is: 1499 1500 |g:netrw_rmf_cmd|: ssh HOSTNAME rm -f 1501 1502Related topics: |netrw-d| 1503Associated setting variable: |g:netrw_rm_cmd| |g:netrw_ssh_cmd| 1504 1505 1506*netrw-explore* *netrw-hexplore* *netrw-nexplore* *netrw-pexplore* 1507*netrw-rexplore* *netrw-sexplore* *netrw-texplore* *netrw-vexplore* *netrw-lexplore* 1508DIRECTORY EXPLORATION COMMANDS {{{2 1509 1510 :[N]Explore[!] [dir]... Explore directory of current file *:Explore* 1511 :[N]Hexplore[!] [dir]... Horizontal Split & Explore *:Hexplore* 1512 :[N]Lexplore[!] [dir]... Left Explorer Toggle *:Lexplore* 1513 :[N]Sexplore[!] [dir]... Split&Explore current file's directory *:Sexplore* 1514 :[N]Vexplore[!] [dir]... Vertical Split & Explore *:Vexplore* 1515 :Texplore [dir]... Tab & Explore *:Texplore* 1516 :Rexplore ... Return to/from Explorer *:Rexplore* 1517 1518 Used with :Explore **/pattern : (also see |netrw-starstar|) 1519 :Nexplore............. go to next matching file *:Nexplore* 1520 :Pexplore............. go to previous matching file *:Pexplore* 1521 1522 *netrw-:Explore* 1523:Explore will open the local-directory browser on the current file's 1524 directory (or on directory [dir] if specified). The window will be 1525 split only if the file has been modified and 'hidden' is not set, 1526 otherwise the browsing window will take over that window. Normally 1527 the splitting is taken horizontally. 1528 Also see: |netrw-:Rexplore| 1529:Explore! is like :Explore, but will use vertical splitting. 1530 1531 *netrw-:Hexplore* 1532:Hexplore [dir] does an :Explore with |:belowright| horizontal splitting. 1533:Hexplore! [dir] does an :Explore with |:aboveleft| horizontal splitting. 1534 1535 *netrw-:Lexplore* 1536:[N]Lexplore [dir] toggles a full height Explorer window on the left hand side 1537 of the current tab. It will open a netrw window on the current 1538 directory if [dir] is omitted; a :Lexplore [dir] will show the 1539 specified directory in the left-hand side browser display no matter 1540 from which window the command is issued. 1541 1542 By default, :Lexplore will change an uninitialized |g:netrw_chgwin| 1543 to 2; edits will thus preferentially be made in window#2. 1544 1545 The [N] specifies a |g:netrw_winsize| just for the new :Lexplore 1546 window. That means that 1547 if [N] < 0 : use |N| columns for the Lexplore window 1548 if [N] = 0 : a normal split is made 1549 if [N] > 0 : use N% of the current window will be used for the 1550 new window 1551 1552 Those who like this method often also like tree style displays; 1553 see |g:netrw_liststyle|. 1554 1555:[N]Lexplore! [dir] is similar to :Lexplore, except that the full-height 1556 Explorer window will open on the right hand side and an 1557 uninitialized |g:netrw_chgwin| will be set to 1 (eg. edits will 1558 preferentially occur in the leftmost window). 1559 1560 Also see: |netrw-C| |g:netrw_browse_split| |g:netrw_wiw| 1561 |netrw-p| |netrw-P| |g:netrw_chgwin| 1562 |netrw-c-tab| |g:netrw_winsize| 1563 1564 *netrw-:Sexplore* 1565:[N]Sexplore will always split the window before invoking the local-directory 1566 browser. As with Explore, the splitting is normally done 1567 horizontally. 1568:[N]Sexplore! [dir] is like :Sexplore, but the splitting will be done vertically. 1569 1570 *netrw-:Texplore* 1571:Texplore [dir] does a |:tabnew| before generating the browser window 1572 1573 *netrw-:Vexplore* 1574:[N]Vexplore [dir] does an :Explore with |:leftabove| vertical splitting. 1575:[N]Vexplore! [dir] does an :Explore with |:rightbelow| vertical splitting. 1576 1577The optional parameters are: 1578 1579 [N]: This parameter will override |g:netrw_winsize| to specify the quantity of 1580 rows and/or columns the new explorer window should have. 1581 Otherwise, the |g:netrw_winsize| variable, if it has been specified by the 1582 user, is used to control the quantity of rows and/or columns new 1583 explorer windows should have. 1584 1585 [dir]: By default, these explorer commands use the current file's directory. 1586 However, one may explicitly provide a directory (path) to use instead; 1587 ie. > 1588 1589 :Explore /some/path 1590< 1591 *netrw-:Rexplore* 1592:Rexplore This command is a little different from the other Explore commands 1593 as it doesn't necessarily open an Explorer window. 1594 1595 Return to Explorer~ 1596 When one edits a file using netrw which can occur, for example, 1597 when pressing <cr> while the cursor is atop a filename in a netrw 1598 browser window, a :Rexplore issued while editing that file will 1599 return the display to that of the last netrw browser display in 1600 that window. 1601 1602 Return from Explorer~ 1603 Conversely, when one is using a netrw directory browser, issuing a 1604 :Rexplore will return to editing the file that was last edited in 1605 that window. 1606 1607 The <2-leftmouse> map (which is only available under gvim and 1608 cooperative terms) does the same as :Rexplore. 1609 1610Also see: |g:netrw_alto| |g:netrw_altv| |g:netrw_winsize| 1611 1612 1613*netrw-star* *netrw-starpat* *netrw-starstar* *netrw-starstarpat* *netrw-grep* 1614EXPLORING WITH STARS AND PATTERNS {{{2 1615 1616When Explore, Sexplore, Hexplore, or Vexplore are used with one of the 1617following four patterns Explore generates a list of files which satisfy the 1618request for the local file system. These exploration patterns will not work 1619with remote file browsing. 1620 1621 */filepat files in current directory which satisfy filepat 1622 **/filepat files in current directory or below which satisfy the 1623 file pattern 1624 *//pattern files in the current directory which contain the 1625 pattern (vimgrep is used) 1626 **//pattern files in the current directory or below which contain 1627 the pattern (vimgrep is used) 1628< 1629The cursor will be placed on the first file in the list. One may then 1630continue to go to subsequent files on that list via |:Nexplore| or to 1631preceding files on that list with |:Pexplore|. Explore will update the 1632directory and place the cursor appropriately. 1633 1634A plain > 1635 :Explore 1636will clear the explore list. 1637 1638If your console or gui produces recognizable shift-up or shift-down sequences, 1639then you'll likely find using shift-downarrow and shift-uparrow convenient. 1640They're mapped by netrw as follows: 1641 1642 <s-down> == Nexplore, and 1643 <s-up> == Pexplore. 1644 1645As an example, consider 1646> 1647 :Explore */*.c 1648 :Nexplore 1649 :Nexplore 1650 :Pexplore 1651< 1652The status line will show, on the right hand side of the status line, a 1653message like "Match 3 of 20". 1654 1655Associated setting variables: 1656 |g:netrw_keepdir| |g:netrw_browse_split| 1657 |g:netrw_fastbrowse| |g:netrw_ftp_browse_reject| 1658 |g:netrw_ftp_list_cmd| |g:netrw_ftp_sizelist_cmd| 1659 |g:netrw_ftp_timelist_cmd| |g:netrw_list_cmd| 1660 |g:netrw_liststyle| 1661 1662 1663DISPLAYING INFORMATION ABOUT FILE *netrw-qf* {{{2 1664 1665With the cursor atop a filename, pressing "qf" will reveal the file's size 1666and last modification timestamp. Currently this capability is only available 1667for local files. 1668 1669 1670EDIT FILE OR DIRECTORY HIDING LIST *netrw-ctrl-h* *netrw-edithide* {{{2 1671 1672The "<ctrl-h>" map brings up a requestor allowing the user to change the 1673file/directory hiding list contained in |g:netrw_list_hide|. The hiding list 1674consists of one or more patterns delimited by commas. Files and/or 1675directories satisfying these patterns will either be hidden (ie. not shown) or 1676be the only ones displayed (see |netrw-a|). 1677 1678The "gh" mapping (see |netrw-gh|) quickly alternates between the usual 1679hiding list and the hiding of files or directories that begin with ".". 1680 1681As an example, > 1682 let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+' 1683Effectively, this makes the effect of a |netrw-gh| command the initial setting. 1684What it means: 1685 1686 \(^\|\s\s\) : if the line begins with the following, -or- 1687 two consecutive spaces are encountered 1688 \zs : start the hiding match now 1689 \. : if it now begins with a dot 1690 \S\+ : and is followed by one or more non-whitespace 1691 characters 1692 1693Associated setting variables: |g:netrw_hide| |g:netrw_list_hide| 1694Associated topics: |netrw-a| |netrw-gh| |netrw-mh| 1695 1696 *netrw-sort-sequence* 1697EDITING THE SORTING SEQUENCE *netrw-S* *netrw-sortsequence* {{{2 1698 1699When "Sorted by" is name, one may specify priority via the sorting sequence 1700(g:netrw_sort_sequence). The sorting sequence typically prioritizes the 1701name-listing by suffix, although any pattern will do. Patterns are delimited 1702by commas. The default sorting sequence is (all one line): 1703 1704For Unix: > 1705 '[\/]$,\<core\%(\.\d\+\)\=,\.[a-np-z]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$, 1706 \.info$,\.swp$,\.bak$,\~$' 1707< 1708Otherwise: > 1709 '[\/]$,\.[a-np-z]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$, 1710 \.swp$,\.bak$,\~$' 1711< 1712The lone * is where all filenames not covered by one of the other patterns 1713will end up. One may change the sorting sequence by modifying the 1714g:netrw_sort_sequence variable (either manually or in your <.vimrc>) or by 1715using the "S" map. 1716 1717Related topics: |netrw-s| |netrw-S| 1718Associated setting variables: |g:netrw_sort_sequence| |g:netrw_sort_options| 1719 1720 1721EXECUTING FILE UNDER CURSOR VIA SYSTEM() *netrw-X* {{{2 1722 1723Pressing X while the cursor is atop an executable file will yield a prompt 1724using the filename asking for any arguments. Upon pressing a [return], netrw 1725will then call |system()| with that command and arguments. The result will be 1726displayed by |:echomsg|, and so |:messages| will repeat display of the result. 1727Ansi escape sequences will be stripped out. 1728 1729See |cmdline-window| for directions for more on how to edit the arguments. 1730 1731 1732FORCING TREATMENT AS A FILE OR DIRECTORY *netrw-gd* *netrw-gf* {{{2 1733 1734Remote symbolic links (ie. those listed via ssh or ftp) are problematic 1735in that it is difficult to tell whether they link to a file or to a 1736directory. 1737 1738To force treatment as a file: use > 1739 gf 1740< 1741To force treatment as a directory: use > 1742 gd 1743< 1744 1745GOING UP *netrw--* {{{2 1746 1747To go up a directory, press "-" or press the <cr> when atop the ../ directory 1748entry in the listing. 1749 1750Netrw will use the command in |g:netrw_list_cmd| to perform the directory 1751listing operation after changing HOSTNAME to the host specified by the 1752user-prpvided url. By default netrw provides the command as: > 1753 1754 ssh HOSTNAME ls -FLa 1755< 1756where the HOSTNAME becomes the [user@]hostname as requested by the attempt to 1757read. Naturally, the user may override this command with whatever is 1758preferred. The NetList function which implements remote browsing 1759expects that directories will be flagged by a trailing slash. 1760 1761 1762HIDING FILES OR DIRECTORIES *netrw-a* *netrw-hiding* {{{2 1763 1764Netrw's browsing facility allows one to use the hiding list in one of three 1765ways: ignore it, hide files which match, and show only those files which 1766match. 1767 1768If no files have been marked via |netrw-mf|: 1769 1770The "a" map allows the user to cycle through the three hiding modes. 1771 1772The |g:netrw_list_hide| variable holds a comma delimited list of patterns 1773based on regular expressions (ex. ^.*\.obj$,^\.) which specify the hiding list. 1774(also see |netrw-ctrl-h|) To set the hiding list, use the <c-h> map. As an 1775example, to hide files which begin with a ".", one may use the <c-h> map to 1776set the hiding list to '^\..*' (or one may put let g:netrw_list_hide= '^\..*' 1777in one's <.vimrc>). One may then use the "a" key to show all files, hide 1778matching files, or to show only the matching files. 1779 1780 Example: \.[ch]$ 1781 This hiding list command will hide/show all *.c and *.h files. 1782 1783 Example: \.c$,\.h$ 1784 This hiding list command will also hide/show all *.c and *.h 1785 files. 1786 1787Don't forget to use the "a" map to select the mode (normal/hiding/show) you 1788want! 1789 1790If files have been marked using |netrw-mf|, then this command will: 1791 1792 if showing all files or non-hidden files: 1793 modify the g:netrw_list_hide list by appending the marked files to it 1794 and showing only non-hidden files. 1795 1796 else if showing hidden files only: 1797 modify the g:netrw_list_hide list by removing the marked files from it 1798 and showing only non-hidden files. 1799 endif 1800 1801 *netrw-gh* *netrw-hide* 1802As a quick shortcut, one may press > 1803 gh 1804to toggle between hiding files which begin with a period (dot) and not hiding 1805them. 1806 1807Associated setting variables: |g:netrw_list_hide| |g:netrw_hide| 1808Associated topics: |netrw-a| |netrw-ctrl-h| |netrw-mh| 1809 1810 *netrw-gitignore* 1811Netrw provides a helper function 'netrw_gitignore#Hide()' that, when used with 1812|g:netrw_list_hide| automatically hides all git-ignored files. 1813 1814'netrw_gitignore#Hide' searches for patterns in the following files: > 1815 1816 './.gitignore' 1817 './.git/info/exclude' 1818 global gitignore file: `git config --global core.excludesfile` 1819 system gitignore file: `git config --system core.excludesfile` 1820< 1821Files that do not exist, are ignored. 1822Git-ignore patterns are taken from existing files, and converted to patterns for 1823hiding files. For example, if you had '*.log' in your '.gitignore' file, it 1824would be converted to '.*\.log'. 1825 1826To use this function, simply assign its output to |g:netrw_list_hide| option. > 1827 1828 Example: let g:netrw_list_hide= netrw_gitignore#Hide() 1829 Git-ignored files are hidden in Netrw. 1830 1831 Example: let g:netrw_list_hide= netrw_gitignore#Hide('my_gitignore_file') 1832 Function can take additional files with git-ignore patterns. 1833 1834 Example: let g:netrw_list_hide= netrw_gitignore#Hide() .. '.*\.swp$' 1835 Combining 'netrw_gitignore#Hide' with custom patterns. 1836< 1837 1838IMPROVING BROWSING *netrw-listhack* *netrw-ssh-hack* {{{2 1839 1840Especially with the remote directory browser, constantly entering the password 1841is tedious. 1842 1843For Linux/Unix systems, the book "Linux Server Hacks - 100 industrial strength 1844tips & tools" by Rob Flickenger (O'Reilly, ISBN 0-596-00461-3) gives a tip 1845for setting up no-password ssh and scp and discusses associated security 1846issues. It used to be available at http://hacks.oreilly.com/pub/h/66 , 1847but apparently that address is now being redirected to some "hackzine". 1848I'll attempt a summary based on that article and on a communication from 1849Ben Schmidt: 1850 1851 1. Generate a public/private key pair on the local machine 1852 (ssh client): > 1853 ssh-keygen -t rsa 1854 (saving the file in ~/.ssh/id_rsa as prompted) 1855< 1856 2. Just hit the <CR> when asked for passphrase (twice) for no 1857 passphrase. If you do use a passphrase, you will also need to use 1858 ssh-agent so you only have to type the passphrase once per session. 1859 If you don't use a passphrase, simply logging onto your local 1860 computer or getting access to the keyfile in any way will suffice 1861 to access any ssh servers which have that key authorized for login. 1862 1863 3. This creates two files: > 1864 ~/.ssh/id_rsa 1865 ~/.ssh/id_rsa.pub 1866< 1867 4. On the target machine (ssh server): > 1868 cd 1869 mkdir -p .ssh 1870 chmod 0700 .ssh 1871< 1872 5. On your local machine (ssh client): (one line) > 1873 ssh {serverhostname} 1874 cat '>>' '~/.ssh/authorized_keys2' < ~/.ssh/id_rsa.pub 1875< 1876 or, for OpenSSH, (one line) > 1877 ssh {serverhostname} 1878 cat '>>' '~/.ssh/authorized_keys' < ~/.ssh/id_rsa.pub 1879< 1880You can test it out with > 1881 ssh {serverhostname} 1882and you should be log onto the server machine without further need to type 1883anything. 1884 1885If you decided to use a passphrase, do: > 1886 ssh-agent $SHELL 1887 ssh-add 1888 ssh {serverhostname} 1889You will be prompted for your key passphrase when you use ssh-add, but not 1890subsequently when you use ssh. For use with vim, you can use > 1891 ssh-agent vim 1892and, when next within vim, use > 1893 :!ssh-add 1894Alternatively, you can apply ssh-agent to the terminal you're planning on 1895running vim in: > 1896 ssh-agent xterm & 1897and do ssh-add whenever you need. 1898 1899For Windows, folks on the vim mailing list have mentioned that Pageant helps 1900with avoiding the constant need to enter the password. 1901 1902Kingston Fung wrote about another way to avoid constantly needing to enter 1903passwords: 1904 1905 In order to avoid the need to type in the password for scp each time, you 1906 provide a hack in the docs to set up a non password ssh account. I found a 1907 better way to do that: I can use a regular ssh account which uses a 1908 password to access the material without the need to key-in the password 1909 each time. It's good for security and convenience. I tried ssh public key 1910 authorization + ssh-agent, implementing this, and it works! 1911 1912 1913 Ssh hints: 1914 1915 Thomer Gil has provided a hint on how to speed up netrw+ssh: 1916 http://thomer.com/howtos/netrw_ssh.html 1917 1918 1919LISTING BOOKMARKS AND HISTORY *netrw-qb* *netrw-listbookmark* {{{2 1920 1921Pressing "qb" (query bookmarks) will list both the bookmarked directories and 1922directory traversal history. 1923 1924Related Topics: 1925 |netrw-gb| how to return (go) to a bookmark 1926 |netrw-mb| how to make a bookmark 1927 |netrw-mB| how to delete bookmarks 1928 |netrw-u| change to a predecessor directory via the history stack 1929 |netrw-U| change to a successor directory via the history stack 1930 1931MAKING A NEW DIRECTORY *netrw-d* {{{2 1932 1933With the "d" map one may make a new directory either remotely (which depends 1934on the global variable g:netrw_mkdir_cmd) or locally (which depends on the 1935global variable g:netrw_localmkdir). Netrw will issue a request for the new 1936directory's name. A bare <CR> at that point will abort the making of the 1937directory. Attempts to make a local directory that already exists (as either 1938a file or a directory) will be detected, reported on, and ignored. 1939 1940Related topics: |netrw-D| 1941Associated setting variables: |g:netrw_localmkdir| |g:netrw_mkdir_cmd| 1942 |g:netrw_remote_mkdir| |netrw-%| 1943 1944 1945MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-cd* {{{2 1946 1947By default, |g:netrw_keepdir| is 1. This setting means that the current 1948directory will not track the browsing directory. (done for backwards 1949compatibility with v6's file explorer). 1950 1951Setting g:netrw_keepdir to 0 tells netrw to make vim's current directory 1952track netrw's browsing directory. 1953 1954However, given the default setting for g:netrw_keepdir of 1 where netrw 1955maintains its own separate notion of the current directory, in order to make 1956the two directories the same, use the "cd" map (type cd). That map will 1957set Vim's notion of the current directory to netrw's current browsing 1958directory. 1959 1960|netrw-cd| : This map's name was changed from "c" to cd (see |netrw-cd|). 1961 This change was done to allow for |netrw-cb| and |netrw-cB| maps. 1962 1963Associated setting variable: |g:netrw_keepdir| 1964 1965MARKING FILES *netrw-:MF* *netrw-mf* {{{2 1966 (also see |netrw-mr|) 1967 1968Netrw provides several ways to mark files: 1969 1970 * One may mark files with the cursor atop a filename and 1971 then pressing "mf". 1972 1973 * With gvim, in addition one may mark files with 1974 <s-leftmouse>. (see |netrw-mouse|) 1975 1976 * One may use the :MF command, which takes a list of 1977 files (for local directories, the list may include 1978 wildcards -- see |glob()|) > 1979 1980 :MF *.c 1981< 1982 (Note that :MF uses |<f-args>| to break the line 1983 at spaces) 1984 1985 * Mark files using the |argument-list| (|netrw-mA|) 1986 1987 * Mark files based upon a |location-list| (|netrw-qL|) 1988 1989 * Mark files based upon the quickfix list (|netrw-qF|) 1990 (|quickfix-error-lists|) 1991 1992The following netrw maps make use of marked files: 1993 1994 |netrw-a| Hide marked files/directories 1995 |netrw-D| Delete marked files/directories 1996 |netrw-ma| Move marked files' names to |arglist| 1997 |netrw-mA| Move |arglist| filenames to marked file list 1998 |netrw-mb| Append marked files to bookmarks 1999 |netrw-mB| Delete marked files from bookmarks 2000 |netrw-mc| Copy marked files to target 2001 |netrw-md| Apply vimdiff to marked files 2002 |netrw-me| Edit marked files 2003 |netrw-mF| Unmark marked files 2004 |netrw-mg| Apply vimgrep to marked files 2005 |netrw-mm| Move marked files to target 2006 |netrw-ms| Netrw will source marked files 2007 |netrw-mt| Set target for |netrw-mm| and |netrw-mc| 2008 |netrw-mT| Generate tags using marked files 2009 |netrw-mv| Apply vim command to marked files 2010 |netrw-mx| Apply shell command to marked files 2011 |netrw-mX| Apply shell command to marked files, en bloc 2012 |netrw-mz| Compress/Decompress marked files 2013 |netrw-O| Obtain marked files 2014 |netrw-R| Rename marked files 2015 2016One may unmark files one at a time the same way one marks them; ie. place 2017the cursor atop a marked file and press "mf". This process also works 2018with <s-leftmouse> using gvim. One may unmark all files by pressing 2019"mu" (see |netrw-mu|). 2020 2021Marked files are highlighted using the "netrwMarkFile" highlighting group, 2022which by default is linked to "Identifier" (see Identifier under 2023|group-name|). You may change the highlighting group by putting something 2024like > 2025 2026 highlight clear netrwMarkFile 2027 hi link netrwMarkFile ..whatever.. 2028< 2029into $HOME/.vim/after/syntax/netrw.vim . 2030 2031If the mouse is enabled and works with your vim, you may use <s-leftmouse> to 2032mark one or more files. You may mark multiple files by dragging the shifted 2033leftmouse. (see |netrw-mouse|) 2034 2035 *markfilelist* *global_markfilelist* *local_markfilelist* 2036All marked files are entered onto the global marked file list; there is only 2037one such list. In addition, every netrw buffer also has its own buffer-local 2038marked file list; since netrw buffers are associated with specific 2039directories, this means that each directory has its own local marked file 2040list. The various commands which operate on marked files use one or the other 2041of the marked file lists. 2042 2043Known Problem: if one is using tree mode (|g:netrw_liststyle|) and several 2044directories have files with the same name, then marking such a file will 2045result in all such files being highlighted as if they were all marked. The 2046|markfilelist|, however, will only have the selected file in it. This problem 2047is unlikely to be fixed. 2048 2049 2050UNMARKING FILES *netrw-mF* {{{2 2051 (also see |netrw-mf|, |netrw-mu|) 2052 2053The "mF" command will unmark all files in the current buffer. One may also use 2054mf (|netrw-mf|) on a specific, already marked, file to unmark just that file. 2055 2056MARKING FILES BY LOCATION LIST *netrw-qL* {{{2 2057 (also see |netrw-mf|) 2058 2059One may convert |location-list|s into a marked file list using "qL". 2060You may then proceed with commands such as me (|netrw-me|) to edit them. 2061 2062 2063MARKING FILES BY QUICKFIX LIST *netrw-qF* {{{2 2064 (also see |netrw-mf|) 2065 2066One may convert |quickfix-error-lists| into a marked file list using "qF". 2067You may then proceed with commands such as me (|netrw-me|) to edit them. 2068Quickfix error lists are generated, for example, by calls to |:vimgrep|. 2069 2070 2071MARKING FILES BY REGULAR EXPRESSION *netrw-mr* {{{2 2072 (also see |netrw-mf|) 2073 2074One may also mark files by pressing "mr"; netrw will then issue a prompt, 2075"Enter regexp: ". You may then enter a shell-style regular expression such 2076as *.c$ (see |glob()|). For remote systems, glob() doesn't work -- so netrw 2077converts "*" into ".*" (see |regexp|) and marks files based on that. In the 2078future I may make it possible to use |regexp|s instead of glob()-style 2079expressions (yet-another-option). 2080 2081See |cmdline-window| for directions on more on how to edit the regular 2082expression. 2083 2084 2085MARKED FILES, ARBITRARY VIM COMMAND *netrw-mv* {{{2 2086 (See |netrw-mf| and |netrw-mr| for how to mark files) 2087 (uses the local marked-file list) 2088 2089The "mv" map causes netrw to execute an arbitrary vim command on each file on 2090the local marked file list, individually: 2091 2092 * 1split 2093 * sil! keepalt e file 2094 * run vim command 2095 * sil! keepalt wq! 2096 2097A prompt, "Enter vim command: ", will be issued to elicit the vim command you 2098wish used. See |cmdline-window| for directions for more on how to edit the 2099command. 2100 2101 2102MARKED FILES, ARBITRARY SHELL COMMAND *netrw-mx* {{{2 2103 (See |netrw-mf| and |netrw-mr| for how to mark files) 2104 (uses the local marked-file list) 2105 2106Upon activation of the "mx" map, netrw will query the user for some (external) 2107command to be applied to all marked files. All "%"s in the command will be 2108substituted with the name of each marked file in turn. If no "%"s are in the 2109command, then the command will be followed by a space and a marked filename. 2110 2111Example: 2112 (mark files) 2113 mx 2114 Enter command: cat 2115 2116 The result is a series of shell commands: 2117 cat 'file1' 2118 cat 'file2' 2119 ... 2120 2121 2122MARKED FILES, ARBITRARY SHELL COMMAND, EN BLOC *netrw-mX* {{{2 2123 (See |netrw-mf| and |netrw-mr| for how to mark files) 2124 (uses the global marked-file list) 2125 2126Upon activation of the 'mX' map, netrw will query the user for some (external) 2127command to be applied to all marked files on the global marked file list. The 2128"en bloc" means that one command will be executed on all the files at once: > 2129 2130 command files 2131 2132This approach is useful, for example, to select files and make a tarball: > 2133 2134 (mark files) 2135 mX 2136 Enter command: tar cf mynewtarball.tar 2137< 2138The command that will be run with this example: 2139 2140 tar cf mynewtarball.tar 'file1' 'file2' ... 2141 2142 2143MARKED FILES: ARGUMENT LIST *netrw-ma* *netrw-mA* 2144 (See |netrw-mf| and |netrw-mr| for how to mark files) 2145 (uses the global marked-file list) 2146 2147Using ma, one moves filenames from the marked file list to the argument list. 2148Using mA, one moves filenames from the argument list to the marked file list. 2149 2150See Also: |netrw-cb| |netrw-cB| |netrw-qF| |argument-list| |:args| 2151 2152 2153MARKED FILES: BUFFER LIST *netrw-cb* *netrw-cB* 2154 (See |netrw-mf| and |netrw-mr| for how to mark files) 2155 (uses the global marked-file list) 2156 2157Using cb, one moves filenames from the marked file list to the buffer list. 2158Using cB, one copies filenames from the buffer list to the marked file list. 2159 2160See Also: |netrw-ma| |netrw-mA| |netrw-qF| |buffer-list| |:buffers| 2161 2162 2163MARKED FILES: COMPRESSION AND DECOMPRESSION *netrw-mz* {{{2 2164 (See |netrw-mf| and |netrw-mr| for how to mark files) 2165 (uses the local marked file list) 2166 2167If any marked files are compressed, then "mz" will decompress them. 2168If any marked files are decompressed, then "mz" will compress them 2169using the command specified by |g:netrw_compress|; by default, 2170that's "gzip". 2171 2172For decompression, netrw uses a |Dictionary| of suffices and their 2173associated decompressing utilities; see |g:netrw_decompress|. 2174 2175Remember that one can mark multiple files by regular expression 2176(see |netrw-mr|); this is particularly useful to facilitate compressing and 2177decompressing a large number of files. 2178 2179Associated setting variables: |g:netrw_compress| |g:netrw_decompress| 2180 2181MARKED FILES: COPYING *netrw-mc* {{{2 2182 (See |netrw-mf| and |netrw-mr| for how to mark files) 2183 (Uses the global marked file list) 2184 2185Select a target directory with mt (|netrw-mt|). Then change directory, 2186select file(s) (see |netrw-mf|), and press "mc". The copy is done 2187from the current window (where one does the mf) to the target. 2188 2189If one does not have a target directory set with |netrw-mt|, then netrw 2190will query you for a directory to copy to. 2191 2192One may also copy directories and their contents (local only) to a target 2193directory. 2194 2195Associated setting variables: 2196 |g:netrw_localcopycmd| |g:netrw_localcopycmdopt| 2197 |g:netrw_localcopydircmd| |g:netrw_localcopydircmdopt| 2198 |g:netrw_ssh_cmd| 2199 2200MARKED FILES: DIFF *netrw-md* {{{2 2201 (See |netrw-mf| and |netrw-mr| for how to mark files) 2202 (uses the global marked file list) 2203 2204Use vimdiff to visualize difference between selected files (two or 2205three may be selected for this). Uses the global marked file list. 2206 2207MARKED FILES: EDITING *netrw-me* {{{2 2208 (See |netrw-mf| and |netrw-mr| for how to mark files) 2209 (uses the global marked file list) 2210 2211The "me" command will place the marked files on the |arglist| and commence 2212editing them. One may return the to explorer window with |:Rexplore|. 2213(use |:n| and |:p| to edit next and previous files in the arglist) 2214 2215MARKED FILES: GREP *netrw-mg* {{{2 2216 (See |netrw-mf| and |netrw-mr| for how to mark files) 2217 (uses the global marked file list) 2218 2219The "mg" command will apply |:vimgrep| to the marked files. 2220The command will ask for the requested pattern; one may then enter: > 2221 2222 /pattern/[g][j] 2223 ! /pattern/[g][j] 2224 pattern 2225< 2226With /pattern/, editing will start with the first item on the |quickfix| list 2227that vimgrep sets up (see |:copen|, |:cnext|, |:cprevious|, |:cclose|). The |:vimgrep| 2228command is in use, so without 'g' each line is added to quickfix list only 2229once; with 'g' every match is included. 2230 2231With /pattern/j, "mg" will winnow the current marked file list to just those 2232marked files also possessing the specified pattern. Thus, one may use > 2233 2234 mr ...file-pattern... 2235 mg /pattern/j 2236< 2237to have a marked file list satisfying the file-pattern but also restricted to 2238files containing some desired pattern. 2239 2240 2241MARKED FILES: HIDING AND UNHIDING BY SUFFIX *netrw-mh* {{{2 2242 (See |netrw-mf| and |netrw-mr| for how to mark files) 2243 (uses the local marked file list) 2244 2245The "mh" command extracts the suffices of the marked files and toggles their 2246presence on the hiding list. Please note that marking the same suffix 2247this way multiple times will result in the suffix's presence being toggled 2248for each file (so an even quantity of marked files having the same suffix 2249is the same as not having bothered to select them at all). 2250 2251Related topics: |netrw-a| |g:netrw_list_hide| 2252 2253MARKED FILES: MOVING *netrw-mm* {{{2 2254 (See |netrw-mf| and |netrw-mr| for how to mark files) 2255 (uses the global marked file list) 2256 2257 WARNING: moving files is more dangerous than copying them. 2258 A file being moved is first copied and then deleted; if the 2259 copy operation fails and the delete succeeds, you will lose 2260 the file. Either try things out with unimportant files 2261 first or do the copy and then delete yourself using mc and D. 2262 Use at your own risk! 2263 2264Select a target directory with mt (|netrw-mt|). Then change directory, 2265select file(s) (see |netrw-mf|), and press "mm". The move is done 2266from the current window (where one does the mf) to the target. 2267 2268Associated setting variable: |g:netrw_localmovecmd| |g:netrw_ssh_cmd| 2269 2270MARKED FILES: SOURCING *netrw-ms* {{{2 2271 (See |netrw-mf| and |netrw-mr| for how to mark files) 2272 (uses the local marked file list) 2273 2274With "ms", netrw will source the marked files (using vim's |:source| command) 2275 2276 2277MARKED FILES: SETTING THE TARGET DIRECTORY *netrw-mt* {{{2 2278 (See |netrw-mf| and |netrw-mr| for how to mark files) 2279 2280Set the marked file copy/move-to target (see |netrw-mc| and |netrw-mm|): 2281 2282 * If the cursor is atop a file name, then the netrw window's currently 2283 displayed directory is used for the copy/move-to target. 2284 2285 * Also, if the cursor is in the banner, then the netrw window's currently 2286 displayed directory is used for the copy/move-to target - unless that 2287 directory is already the target, in which case typing "mt" again clears 2288 it. Repeating "mt" in the banner thus toggles the current directory as 2289 the target. 2290 2291 * However, if the cursor is atop a directory name, then that directory is 2292 used for the copy/move-to target 2293 2294 * One may use the :MT [directory] command to set the target *netrw-:MT* 2295 This command uses |<q-args>|, so spaces in the directory name are 2296 permitted without escaping. 2297 2298 * With mouse-enabled vim or with gvim, one may select a target by using 2299 <c-leftmouse> 2300 2301There is only one copy/move-to target at a time in a vim session; ie. the 2302target is a script variable (see |s:var|) and is shared between all netrw 2303windows (in an instance of vim). 2304 2305When using menus and gvim, netrw provides a "Targets" entry which allows one 2306to pick a target from the list of bookmarks and history. 2307 2308Related topics: 2309 Marking Files......................................|netrw-mf| 2310 Marking Files by Regular Expression................|netrw-mr| 2311 Marked Files: Target Directory Using Bookmarks.....|netrw-Tb| 2312 Marked Files: Target Directory Using History.......|netrw-Th| 2313 2314 2315MARKED FILES: TAGGING *netrw-mT* {{{2 2316 (See |netrw-mf| and |netrw-mr| for how to mark files) 2317 (uses the global marked file list) 2318 2319The "mT" mapping will apply the command in |g:netrw_ctags| (by default, it is 2320"ctags") to marked files. For remote browsing, in order to create a tags file 2321netrw will use ssh (see |g:netrw_ssh_cmd|), and so ssh must be available for 2322this to work on remote systems. For your local system, see |ctags| on how to 2323get a version. I myself use hdrtags, currently available at 2324http://www.drchip.org/astronaut/src/index.html , and have > 2325 2326 let g:netrw_ctags= "hdrtag" 2327< 2328in my <.vimrc>. 2329 2330When a remote set of files are tagged, the resulting tags file is "obtained"; 2331ie. a copy is transferred to the local system's directory. The now local tags 2332file is then modified so that one may use it through the network. The 2333modification made concerns the names of the files in the tags; each filename is 2334preceded by the netrw-compatible URL used to obtain it. When one subsequently 2335uses one of the go to tag actions (|tags|), the URL will be used by netrw to 2336edit the desired file and go to the tag. 2337 2338Associated setting variables: |g:netrw_ctags| |g:netrw_ssh_cmd| 2339 2340MARKED FILES: TARGET DIRECTORY USING BOOKMARKS *netrw-Tb* {{{2 2341 2342Sets the marked file copy/move-to target. 2343 2344The |netrw-qb| map will give you a list of bookmarks (and history). 2345One may choose one of the bookmarks to become your marked file 2346target by using [count]Tb (default count: 1). 2347 2348Related topics: 2349 Copying files to target............................|netrw-mc| 2350 Listing Bookmarks and History......................|netrw-qb| 2351 Marked Files: Setting The Target Directory.........|netrw-mt| 2352 Marked Files: Target Directory Using History.......|netrw-Th| 2353 Marking Files......................................|netrw-mf| 2354 Marking Files by Regular Expression................|netrw-mr| 2355 Moving files to target.............................|netrw-mm| 2356 2357 2358MARKED FILES: TARGET DIRECTORY USING HISTORY *netrw-Th* {{{2 2359 2360Sets the marked file copy/move-to target. 2361 2362The |netrw-qb| map will give you a list of history (and bookmarks). 2363One may choose one of the history entries to become your marked file 2364target by using [count]Th (default count: 0; ie. the current directory). 2365 2366Related topics: 2367 Copying files to target............................|netrw-mc| 2368 Listing Bookmarks and History......................|netrw-qb| 2369 Marked Files: Setting The Target Directory.........|netrw-mt| 2370 Marked Files: Target Directory Using Bookmarks.....|netrw-Tb| 2371 Marking Files......................................|netrw-mf| 2372 Marking Files by Regular Expression................|netrw-mr| 2373 Moving files to target.............................|netrw-mm| 2374 2375 2376MARKED FILES: UNMARKING *netrw-mu* {{{2 2377 (See |netrw-mf|, |netrw-mF|) 2378 2379The "mu" mapping will unmark all currently marked files. This command differs 2380from "mF" as the latter only unmarks files in the current directory whereas 2381"mu" will unmark global and all buffer-local marked files. 2382(see |netrw-mF|) 2383 2384 2385 *netrw-browser-settings* 2386NETRW BROWSER VARIABLES *netrw-browser-options* *netrw-browser-var* {{{2 2387 2388(if you're interested in the netrw file transfer settings, see |netrw-options| 2389 and |netrw-protocol|) 2390 2391The <netrw.vim> browser provides settings in the form of variables which 2392you may modify; by placing these settings in your <.vimrc>, you may customize 2393your browsing preferences. (see also: |netrw-settings|) 2394> 2395 --- ----------- 2396 Var Explanation 2397 --- ----------- 2398< *g:netrw_altfile* some like |CTRL-^| to return to the last 2399 edited file. Choose that by setting this 2400 parameter to 1. 2401 Others like |CTRL-^| to return to the 2402 netrw browsing buffer. Choose that by setting 2403 this parameter to 0. 2404 default: =0 2405 2406 *g:netrw_alto* change from above splitting to below splitting 2407 by setting this variable (see |netrw-o|) 2408 default: =&sb (see 'sb') 2409 2410 *g:netrw_altv* change from left splitting to right splitting 2411 by setting this variable (see |netrw-v|) 2412 default: =&spr (see 'spr') 2413 2414 *g:netrw_banner* enable/suppress the banner 2415 =0: suppress the banner 2416 =1: banner is enabled (default) 2417 2418 *g:netrw_bannerbackslash* if this variable exists and is not zero, the 2419 banner will be displayed with backslashes 2420 rather than forward slashes. 2421 2422 *g:netrw_browse_split* when browsing, <cr> will open the file by: 2423 =0: re-using the same window (default) 2424 =1: horizontally splitting the window first 2425 =2: vertically splitting the window first 2426 =3: open file in new tab 2427 =4: act like "P" (ie. open previous window) 2428 Note that |g:netrw_preview| may be used 2429 to get vertical splitting instead of 2430 horizontal splitting. 2431 =[servername,tab-number,window-number] 2432 Given a |List| such as this, a remote server 2433 named by the "servername" will be used for 2434 editing. It will also use the specified tab 2435 and window numbers to perform editing 2436 (see |clientserver|, |netrw-ctrl-r|) 2437 This option does not affect the production of 2438 |:Lexplore| windows. 2439 2440 Related topics: 2441 |g:netrw_alto| |g:netrw_altv| 2442 |netrw-C| |netrw-cr| 2443 |netrw-ctrl-r| 2444 2445 *g:netrw_chgperm* Unix/Linux: "chmod PERM FILENAME" 2446 Windows: "cacls FILENAME /e /p PERM" 2447 Used to change access permission for a file. 2448 2449 *g:netrw_clipboard* =1 2450 By default, netrw will attempt to insure that 2451 the clipboard's values will remain unchanged. 2452 However, some users report that they have 2453 speed problems with this; consequently, this 2454 option, when set to zero, lets such users 2455 prevent netrw from saving and restoring the 2456 clipboard (the latter is done only as needed). 2457 That means that if the clipboard is changed 2458 (inadvertently) by normal netrw operation that 2459 it will not be restored to its prior state. 2460 2461 *g:netrw_compress* ="gzip" 2462 Will compress marked files with this 2463 command 2464 2465 *g:Netrw_corehandler* Allows one to specify something additional 2466 to do when handling <core> files via netrw's 2467 browser's "x" command. If present, 2468 g:Netrw_corehandler specifies either one or 2469 more function references (see |Funcref|). 2470 (the capital g:Netrw... is required its 2471 holding a function reference) 2472 2473 *g:netrw_ctags* ="ctags" 2474 The default external program used to create 2475 tags 2476 2477 *g:netrw_cursor* = 2 (default) 2478 This option controls the use of the 2479 'cursorline' (cul) and 'cursorcolumn' 2480 (cuc) settings by netrw: 2481 2482 Value Thin-Long-Tree Wide 2483 =0 u-cul u-cuc u-cul u-cuc 2484 =1 u-cul u-cuc cul u-cuc 2485 =2 cul u-cuc cul u-cuc 2486 =3 cul u-cuc cul cuc 2487 =4 cul cuc cul cuc 2488 =5 U-cul U-cuc U-cul U-cuc 2489 =6 U-cul U-cuc cul U-cuc 2490 =7 cul U-cuc cul U-cuc 2491 =8 cul U-cuc cul cuc 2492 2493 Where 2494 u-cul : user's 'cursorline' initial setting used 2495 u-cuc : user's 'cursorcolumn' initial setting used 2496 U-cul : user's 'cursorline' current setting used 2497 U-cuc : user's 'cursorcolumn' current setting used 2498 cul : 'cursorline' will be locally set 2499 cuc : 'cursorcolumn' will be locally set 2500 2501 The "initial setting" means the values of 2502 the 'cuc' and 'cul' settings in effect when 2503 netrw last saw |g:netrw_cursor| >= 5 or when 2504 netrw was initially run. 2505 2506 *g:netrw_decompress* = { ".lz4": "lz4 -d", 2507 ".lzo": "lzop -d", 2508 ".lz": "lzip -dk", 2509 ".7z": "7za x", 2510 ".001": "7za x", 2511 ".tar.bz": "tar -xvjf", 2512 ".tar.bz2": "tar -xvjf", 2513 ".tbz": "tar -xvjf", 2514 ".tbz2": "tar -xvjf", 2515 ".tar.gz": "tar -xvzf", 2516 ".tgz": "tar -xvzf", 2517 ".tar.zst": "tar --use-compress-program=unzstd -xvf", 2518 ".tzst": "tar --use-compress-program=unzstd -xvf", 2519 ".tar": "tar -xvf", 2520 ".zip": "unzip", 2521 ".bz": "bunzip2 -k", 2522 ".bz2": "bunzip2 -k", 2523 ".gz": "gunzip -k", 2524 ".lzma": "unlzma -T0 -k", 2525 ".xz": "unxz -T0 -k", 2526 ".zst": "zstd -T0 -d", 2527 ".Z": "uncompress -k", 2528 ".rar": "unrar x -ad", 2529 ".tar.lzma": "tar --lzma -xvf", 2530 ".tlz": "tar --lzma -xvf", 2531 ".tar.xz": "tar -xvJf", 2532 ".txz": "tar -xvJf"} 2533 2534 A dictionary mapping suffices to 2535 decompression programs. 2536 2537 *g:netrw_dirhistmax* =10: controls maximum quantity of past 2538 history. May be zero to suppress 2539 history. 2540 (related: |netrw-qb| |netrw-u| |netrw-U|) 2541 2542 *g:netrw_dynamic_maxfilenamelen* =32: enables dynamic determination of 2543 |g:netrw_maxfilenamelen|, which affects 2544 local file long listing. 2545 2546 *g:netrw_fastbrowse* =0: slow speed directory browsing; 2547 never re-uses directory listings; 2548 always obtains directory listings. 2549 =1: medium speed directory browsing; 2550 re-use directory listings only 2551 when remote directory browsing. 2552 (default value) 2553 =2: fast directory browsing; 2554 only obtains directory listings when the 2555 directory hasn't been seen before 2556 (or |netrw-ctrl-l| is used). 2557 2558 Fast browsing retains old directory listing 2559 buffers so that they don't need to be 2560 re-acquired. This feature is especially 2561 important for remote browsing. However, if 2562 a file is introduced or deleted into or from 2563 such directories, the old directory buffer 2564 becomes out-of-date. One may always refresh 2565 such a directory listing with |netrw-ctrl-l|. 2566 This option gives the user the choice of 2567 trading off accuracy (ie. up-to-date listing) 2568 versus speed. 2569 2570 *g:netrw_ffkeep* (default: doesn't exist) 2571 If this variable exists and is zero, then 2572 netrw will not do a save and restore for 2573 'fileformat'. 2574 2575 *g:netrw_fname_escape* =' ?&;%' 2576 Used on filenames before remote reading/writing 2577 2578 *g:netrw_ftp_browse_reject* ftp can produce a number of errors and warnings 2579 that can show up as "directories" and "files" 2580 in the listing. This pattern is used to 2581 remove such embedded messages. By default its 2582 value is: 2583 '^total\s\+\d\+$\| 2584 ^Trying\s\+\d\+.*$\| 2585 ^KERBEROS_V\d rejected\| 2586 ^Security extensions not\| 2587 No such file\| 2588 : connect to address [0-9a-fA-F:]* 2589 : No route to host$' 2590 2591 *g:netrw_ftp_list_cmd* options for passing along to ftp for directory 2592 listing. Defaults: 2593 unix or g:netrw_cygwin set: : "ls -lF" 2594 otherwise "dir" 2595 2596 2597 *g:netrw_ftp_sizelist_cmd* options for passing along to ftp for directory 2598 listing, sorted by size of file. 2599 Defaults: 2600 unix or g:netrw_cygwin set: : "ls -slF" 2601 otherwise "dir" 2602 2603 *g:netrw_ftp_timelist_cmd* options for passing along to ftp for directory 2604 listing, sorted by time of last modification. 2605 Defaults: 2606 unix or g:netrw_cygwin set: : "ls -tlF" 2607 otherwise "dir" 2608 2609 *g:netrw_glob_escape* ='[]*?`{~$' (unix) 2610 ='[]*?`{$' (windows) 2611 These characters in directory names are 2612 escaped before applying glob() 2613 2614 *g:netrw_hide* Controlled by the "a" map (see |netrw-a|) 2615 =0 : show all 2616 =1 : show not-hidden files 2617 =2 : show hidden files only 2618 default: =1 2619 2620 *g:netrw_home* The home directory for where bookmarks and 2621 history are saved (as .netrwbook and 2622 .netrwhist). 2623 Netrw uses |expand()| on the string. 2624 default: stdpath("data") (see |stdpath()|) 2625 2626 *g:netrw_keepdir* =1 (default) keep current directory immune from 2627 the browsing directory. 2628 =0 keep the current directory the same as the 2629 browsing directory. 2630 The current browsing directory is contained in 2631 b:netrw_curdir (also see |netrw-cd|) 2632 2633 *g:netrw_keepj* ="keepj" (default) netrw attempts to keep the 2634 |:jumps| table unaffected. 2635 ="" netrw will not use |:keepjumps| with 2636 exceptions only for the 2637 saving/restoration of position. 2638 2639 *g:netrw_list_cmd* command for listing remote directories 2640 default: (if ssh is executable) 2641 "ssh HOSTNAME ls -FLa" 2642 2643 *g:netrw_list_cmd_options* If this variable exists, then its contents are 2644 appended to the g:netrw_list_cmd. For 2645 example, use "2>/dev/null" to get rid of banner 2646 messages on unix systems. 2647 2648 2649 *g:netrw_liststyle* Set the default listing style: 2650 = 0: thin listing (one file per line) 2651 = 1: long listing (one file per line with time 2652 stamp information and file size) 2653 = 2: wide listing (multiple files in columns) 2654 = 3: tree style listing 2655 2656 *g:netrw_list_hide* comma-separated pattern list for hiding files 2657 Patterns are regular expressions (see |regexp|) 2658 There's some special support for git-ignore 2659 files: you may add the output from the helper 2660 function 'netrw_gitignore#Hide() automatically 2661 hiding all gitignored files. 2662 For more details see |netrw-gitignore|. 2663 default: "" 2664 2665 Examples: > 2666 let g:netrw_list_hide= '.*\.swp$' 2667 let g:netrw_list_hide= netrw_gitignore#Hide() .. '.*\.swp$' 2668< 2669 *g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin 2670 =expand("$COMSPEC") Windows 2671 Copies marked files (|netrw-mf|) to target 2672 directory (|netrw-mt|, |netrw-mc|) 2673 2674 *g:netrw_localcopycmdopt* ='' Linux/Unix/MacOS/Cygwin 2675 =' \c copy' Windows 2676 Options for the |g:netrw_localcopycmd| 2677 2678 *g:netrw_localcopydircmd* ="cp" Linux/Unix/MacOS/Cygwin 2679 =expand("$COMSPEC") Windows 2680 Copies directories to target directory. 2681 (|netrw-mc|, |netrw-mt|) 2682 2683 *g:netrw_localcopydircmdopt* =" -R" Linux/Unix/MacOS/Cygwin 2684 =" /c xcopy /e /c /h/ /i /k" Windows 2685 Options for |g:netrw_localcopydircmd| 2686 2687 *g:netrw_localmkdir* ="mkdir" Linux/Unix/MacOS/Cygwin 2688 =expand("$COMSPEC") Windows 2689 command for making a local directory 2690 2691 *g:netrw_localmkdiropt* ="" Linux/Unix/MacOS/Cygwin 2692 =" /c mkdir" Windows 2693 Options for |g:netrw_localmkdir| 2694 2695 *g:netrw_localmovecmd* ="mv" Linux/Unix/MacOS/Cygwin 2696 =expand("$COMSPEC") Windows 2697 Moves marked files (|netrw-mf|) to target 2698 directory (|netrw-mt|, |netrw-mm|) 2699 2700 *g:netrw_localmovecmdopt* ="" Linux/Unix/MacOS/Cygwin 2701 =" /c move" Windows 2702 Options for |g:netrw_localmovecmd| 2703 2704 *g:netrw_maxfilenamelen* =32 by default, selected so as to make long 2705 listings fit on 80 column displays. 2706 If your screen is wider, and you have file 2707 or directory names longer than 32 bytes, 2708 you may set this option to keep listings 2709 columnar. 2710 2711 *g:netrw_mkdir_cmd* command for making a remote directory 2712 via ssh (also see |g:netrw_remote_mkdir|) 2713 default: "ssh USEPORT HOSTNAME mkdir" 2714 2715 *g:netrw_mousemaps* =1 (default) enables mouse buttons while 2716 browsing to: 2717 leftmouse : open file/directory 2718 shift-leftmouse : mark file 2719 middlemouse : same as P 2720 rightmouse : remove file/directory 2721 =0: disables mouse maps 2722 2723 *g:netrw_sizestyle* not defined: actual bytes (default) 2724 ="b" : actual bytes (default) 2725 ="h" : human-readable (ex. 5k, 4m, 3g) 2726 uses 1000 base 2727 ="H" : human-readable (ex. 5K, 4M, 3G) 2728 uses 1024 base 2729 The long listing (|netrw-i|) and query-file 2730 maps (|netrw-qf|) will display file size 2731 using the specified style. 2732 2733 *g:netrw_usetab* if this variable exists and is non-zero, then 2734 the <tab> map supporting shrinking/expanding a 2735 Lexplore or netrw window will be enabled. 2736 (see |netrw-c-tab|) 2737 2738 *g:netrw_remote_mkdir* command for making a remote directory 2739 via ftp (also see |g:netrw_mkdir_cmd|) 2740 default: "mkdir" 2741 2742 *g:netrw_retmap* if it exists and is set to one, then: 2743 * if in a netrw-selected file, AND 2744 * no normal-mode <2-leftmouse> mapping exists, 2745 then the <2-leftmouse> will be mapped for easy 2746 return to the netrw browser window. 2747 example: click once to select and open a file, 2748 double-click to return. 2749 2750 Note that one may instead choose to: 2751 * let g:netrw_retmap= 1, AND 2752 * nmap <silent> YourChoice <Plug>NetrwReturn 2753 and have another mapping instead of 2754 <2-leftmouse> to invoke the return. 2755 2756 You may also use the |:Rexplore| command to do 2757 the same thing. 2758 2759 default: =0 2760 2761 *g:netrw_rm_cmd* command for removing remote files 2762 default: "ssh USEPORT HOSTNAME rm" 2763 2764 *g:netrw_rmdir_cmd* command for removing remote directories 2765 default: "ssh USEPORT HOSTNAME rmdir" 2766 2767 *g:netrw_rmf_cmd* command for removing remote softlinks 2768 default: "ssh USEPORT HOSTNAME rm -f" 2769 2770 *g:netrw_servername* use this variable to provide a name for 2771 |netrw-ctrl-r| to use for its server. 2772 default: "NETRWSERVER" 2773 2774 *g:netrw_sort_by* sort by "name", "time", "size", or 2775 "exten". 2776 default: "name" 2777 2778 *g:netrw_sort_direction* sorting direction: "normal" or "reverse" 2779 default: "normal" 2780 2781 *g:netrw_sort_options* sorting is done using |:sort|; this 2782 variable's value is appended to the 2783 sort command. Thus one may ignore case, 2784 for example, with the following in your 2785 .vimrc: > 2786 let g:netrw_sort_options="i" 2787< default: "" 2788 2789 *g:netrw_sort_sequence* when sorting by name, first sort by the 2790 comma-separated pattern sequence. Note that 2791 any filigree added to indicate filetypes 2792 should be accounted for in your pattern. 2793 default: '[\/]$,*,\.bak$,\.o$,\.h$, 2794 \.info$,\.swp$,\.obj$' 2795 2796 *g:netrw_special_syntax* If true, then certain files will be shown 2797 using special syntax in the browser: 2798 2799 netrwBak : *.bak 2800 netrwCompress: *.gz *.bz2 *.Z *.zip 2801 netrwCoreDump: core.\d\+ 2802 netrwData : *.dat 2803 netrwDoc : *.doc,*.txt,*.pdf, 2804 *.pdf,*.docx 2805 netrwHdr : *.h 2806 netrwLex : *.l *.lex 2807 netrwLib : *.a *.so *.lib *.dll 2808 netrwMakefile: [mM]akefile *.mak 2809 netrwObj : *.o *.obj 2810 netrwPix : *.bmp,*.fit,*.fits,*.gif, 2811 *.jpg,*.jpeg,*.pcx,*.ppc 2812 *.pgm,*.png,*.psd,*.rgb 2813 *.tif,*.xbm,*.xcf 2814 netrwTags : tags ANmenu ANtags 2815 netrwTilde : * 2816 netrwTmp : tmp* *tmp 2817 netrwYacc : *.y 2818 2819 In addition, those groups mentioned in 2820 'suffixes' are also added to the special 2821 file highlighting group. 2822 These syntax highlighting groups are linked 2823 to netrwGray or Folded by default 2824 (see |hl-Folded|), but one may put lines like > 2825 hi link netrwCompress Visual 2826< into one's <.vimrc> to use one's own 2827 preferences. Alternatively, one may 2828 put such specifications into > 2829 .vim/after/syntax/netrw.vim. 2830< The netrwGray highlighting is set up by 2831 netrw when > 2832 * netrwGray has not been previously 2833 defined 2834 * the gui is running 2835< As an example, I myself use a dark-background 2836 colorscheme with the following in 2837 .vim/after/syntax/netrw.vim: > 2838 2839 hi netrwCompress term=NONE cterm=NONE gui=NONE ctermfg=10 guifg=green ctermbg=0 guibg=black 2840 hi netrwData term=NONE cterm=NONE gui=NONE ctermfg=9 guifg=blue ctermbg=0 guibg=black 2841 hi netrwHdr term=NONE cterm=NONE,italic gui=NONE guifg=SeaGreen1 2842 hi netrwLex term=NONE cterm=NONE,italic gui=NONE guifg=SeaGreen1 2843 hi netrwYacc term=NONE cterm=NONE,italic gui=NONE guifg=SeaGreen1 2844 hi netrwLib term=NONE cterm=NONE gui=NONE ctermfg=14 guifg=yellow 2845 hi netrwObj term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red 2846 hi netrwTilde term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red 2847 hi netrwTmp term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red 2848 hi netrwTags term=NONE cterm=NONE gui=NONE ctermfg=12 guifg=red 2849 hi netrwDoc term=NONE cterm=NONE gui=NONE ctermfg=220 ctermbg=27 guifg=yellow2 guibg=Blue3 2850 hi netrwSymLink term=NONE cterm=NONE gui=NONE ctermfg=220 ctermbg=27 guifg=grey60 2851< 2852 *g:netrw_ssh_browse_reject* ssh can sometimes produce unwanted lines, 2853 messages, banners, and whatnot that one doesn't 2854 want masquerading as "directories" and "files". 2855 Use this pattern to remove such embedded 2856 messages. By default its value is: 2857 '^total\s\+\d\+$' 2858 2859 *g:netrw_ssh_cmd* One may specify an executable command 2860 to use instead of ssh for remote actions 2861 such as listing, file removal, etc. 2862 default: ssh 2863 2864 *g:netrw_timefmt* specify format string to vim's strftime(). 2865 The default, "%c", is "the preferred date 2866 and time representation for the current 2867 locale" according to my manpage entry for 2868 strftime(); however, not all are satisfied 2869 with it. Some alternatives: 2870 "%a %d %b %Y %T", 2871 " %a %Y-%m-%d %I-%M-%S %p" 2872 default: "%c" 2873 2874 *g:netrw_use_noswf* netrw normally avoids writing swapfiles 2875 for browser buffers. However, under some 2876 systems this apparently is causing nasty 2877 ml_get errors to appear; if you're getting 2878 ml_get errors, try putting 2879 let g:netrw_use_noswf= 0 2880 in your .vimrc. 2881 default: 1 2882 2883 *g:netrw_winsize* specify initial size of new windows made with 2884 "o" (see |netrw-o|), "v" (see |netrw-v|), 2885 |:Hexplore| or |:Vexplore|. The g:netrw_winsize 2886 is an integer describing the percentage of the 2887 current netrw buffer's window to be used for 2888 the new window. 2889 If g:netrw_winsize is less than zero, then 2890 the absolute value of g:netrw_winsize will be 2891 used to specify the quantity of lines or 2892 columns for the new window. 2893 If g:netrw_winsize is zero, then a normal 2894 split will be made (ie. 'equalalways' will 2895 take effect, for example). 2896 default: 50 (for 50%) 2897 2898 *g:netrw_wiw* =1 specifies the minimum window width to use 2899 when shrinking a netrw/Lexplore window 2900 (see |netrw-c-tab|). 2901 2902 *g:netrw_xstrlen* Controls how netrw computes string lengths, 2903 including multi-byte characters' string 2904 length. (thanks to N Weibull, T Mechelynck) 2905 =0: uses Vim's built-in strlen() 2906 =1: number of codepoints (Latin a + combining 2907 circumflex is two codepoints) (DEFAULT) 2908 =2: number of spacing codepoints (Latin a + 2909 combining circumflex is one spacing 2910 codepoint; a hard tab is one; wide and 2911 narrow CJK are one each; etc.) 2912 =3: virtual length (counting tabs as anything 2913 between 1 and 'tabstop', wide CJK as 2 2914 rather than 1, Arabic alif as zero when 2915 immediately preceded by lam, one 2916 otherwise, etc) 2917 2918 *g:NetrwTopLvlMenu* This variable specifies the top level 2919 menu name; by default, it's "Netrw.". If 2920 you wish to change this, do so in your 2921 .vimrc. 2922 2923NETRW BROWSING AND OPTION INCOMPATIBILITIES *netrw-incompatible* {{{2 2924 2925Netrw has been designed to handle user options by saving them, setting the 2926options to something that's compatible with netrw's needs, and then restoring 2927them. However, the autochdir option: > 2928 :set acd 2929is problematic. Autochdir sets the current directory to that containing the 2930file you edit; this apparently also applies to directories. In other words, 2931autochdir sets the current directory to that containing the "file" (even if 2932that "file" is itself a directory). 2933 2934 2935============================================================================== 2936OBTAINING A FILE *netrw-obtain* *netrw-O* {{{2 2937 2938If there are no marked files: 2939 2940 When browsing a remote directory, one may obtain a file under the cursor 2941 (ie. get a copy on your local machine, but not edit it) by pressing the O 2942 key. 2943 2944If there are marked files: 2945 2946 The marked files will be obtained (ie. a copy will be transferred to your 2947 local machine, but not set up for editing). 2948 2949Only ftp and scp are supported for this operation (but since these two are 2950available for browsing, that shouldn't be a problem). The status bar will 2951then show, on its right hand side, a message like "Obtaining filename". The 2952statusline will be restored after the transfer is complete. 2953 2954Netrw can also "obtain" a file using the local browser. Netrw's display 2955of a directory is not necessarily the same as Vim's "current directory", 2956unless |g:netrw_keepdir| is set to 0 in the user's <.vimrc>. One may select 2957a file using the local browser (by putting the cursor on it) and pressing 2958"O" will then "obtain" the file; ie. copy it to Vim's current directory. 2959 2960Related topics: 2961 * To see what the current directory is, use |:pwd| 2962 * To make the currently browsed directory the current directory, see 2963 |netrw-cd| 2964 * To automatically make the currently browsed directory the current 2965 directory, see |g:netrw_keepdir|. 2966 2967 *netrw-newfile* *netrw-createfile* 2968OPEN A NEW FILE IN NETRW'S CURRENT DIRECTORY *netrw-%* {{{2 2969 2970To open a new file in netrw's current directory, press "%". This map 2971will query the user for a new filename; an empty file by that name will 2972be placed in the netrw's current directory (ie. b:netrw_curdir). 2973 2974If Lexplore (|netrw-:Lexplore|) is in use, the new file will be generated 2975in the |g:netrw_chgwin| window. 2976 2977Related topics: |netrw-d| 2978 2979 2980PREVIEW WINDOW *netrw-p* *netrw-preview* {{{2 2981 2982One may use a preview window by using the "p" key when the cursor is atop the 2983desired filename to be previewed. The display will then split to show both 2984the browser (where the cursor will remain) and the file (see |:pedit|). By 2985default, the split will be taken horizontally; one may use vertical splitting 2986if one has set |g:netrw_preview| first. 2987 2988An interesting set of netrw settings is: > 2989 2990 let g:netrw_preview = 1 2991 let g:netrw_liststyle = 3 2992 let g:netrw_winsize = 30 2993 2994These will: 2995 2996 1. Make vertical splitting the default for previewing files 2997 2. Make the default listing style "tree" 2998 3. When a vertical preview window is opened, the directory listing 2999 will use only 30% of the columns available; the rest of the window 3000 is used for the preview window. 3001 3002 Related: if you like this idea, you may also find :Lexplore 3003 (|netrw-:Lexplore|) or |g:netrw_chgwin| of interest 3004 3005Also see: |g:netrw_chgwin| |netrw-P| 'previewwindow' |CTRL-W_z| |:pclose| 3006 3007 3008PREVIOUS WINDOW *netrw-P* *netrw-prvwin* {{{2 3009 3010To edit a file or directory under the cursor in the previously used (last 3011accessed) window (see :he |CTRL-W_p|), press a "P". If there's only one 3012window, then the one window will be horizontally split (by default). 3013 3014If there's more than one window, the previous window will be re-used on 3015the selected file/directory. If the previous window's associated buffer 3016has been modified, and there's only one window with that buffer, then 3017the user will be asked if they wish to save the buffer first (yes, no, or 3018cancel). 3019 3020Related Actions |netrw-cr| |netrw-o| |netrw-t| |netrw-v| 3021Associated setting variables: 3022 |g:netrw_alto| control above/below splitting 3023 |g:netrw_altv| control right/left splitting 3024 |g:netrw_preview| control horizontal vs vertical splitting 3025 |g:netrw_winsize| control initial sizing 3026 3027Also see: |g:netrw_chgwin| |netrw-p| 3028 3029 3030REFRESHING THE LISTING *netrw-refresh* *netrw-ctrl-l* *netrw-ctrl_l* {{{2 3031 3032To refresh either a local or remote netrw directory listing, press ctrl-l 3033(<c-l>) or hit the <cr> when atop the ./ directory entry in the listing. 3034 3035 3036REVERSING SORTING ORDER *netrw-r* *netrw-reverse* {{{2 3037 3038One may toggle between normal and reverse sorting order by pressing the 3039"r" key. 3040 3041Related topics: |netrw-s| 3042Associated setting variable: |g:netrw_sort_direction| 3043 3044 3045RENAMING FILES OR DIRECTORIES *netrw-move* *netrw-rename* *netrw-R* {{{2 3046 3047If there are no marked files: (see |netrw-mf|) 3048 3049 Renaming files and directories involves moving the cursor to the 3050 file/directory to be moved (renamed) and pressing "R". You will then be 3051 queried for what you want the file/directory to be renamed to. You may 3052 select a range of lines with the "V" command (visual selection), and then 3053 press "R"; you will be queried for each file as to what you want it 3054 renamed to. 3055 3056If there are marked files: (see |netrw-mf|) 3057 3058 Marked files will be renamed (moved). You will be queried as above in 3059 order to specify where you want the file/directory to be moved. 3060 3061 If you answer a renaming query with a "s/frompattern/topattern/", then 3062 subsequent files on the marked file list will be renamed by taking each 3063 name, applying that substitute, and renaming each file to the result. 3064 As an example : > 3065 3066 mr [query: reply with *.c] 3067 R [query: reply with s/^\(.*\)\.c$/\1.cpp/] 3068< 3069 This example will mark all "*.c" files and then rename them to "*.cpp" 3070 files. Netrw will protect you from overwriting local files without 3071 confirmation, but not remote ones. 3072 3073 The ctrl-X character has special meaning for renaming files: > 3074 3075 <c-x> : a single ctrl-x tells netrw to ignore the portion of the response 3076 lying between the last '/' and the ctrl-x. 3077 3078 <c-x><c-x> : a pair of contiguous ctrl-x's tells netrw to ignore any 3079 portion of the string preceding the double ctrl-x's. 3080< 3081 WARNING: ~ 3082 3083 Note that moving files is a dangerous operation; copies are safer. That's 3084 because a "move" for remote files is actually a copy + delete -- and if 3085 the copy fails and the delete succeeds you may lose the file. 3086 Use at your own risk. 3087 3088The *g:netrw_rename_cmd* variable is used to implement remote renaming. By 3089default its value is: > 3090 3091 ssh HOSTNAME mv 3092< 3093One may rename a block of files and directories by selecting them with 3094V (|linewise-visual|) when using thin style. 3095 3096See |cmdline-editing| for more on how to edit the command line; in particular, 3097you'll find <ctrl-f> (initiates cmdline window editing) and <ctrl-c> (uses the 3098command line under the cursor) useful in conjunction with the R command. 3099 3100 3101SELECTING SORTING STYLE *netrw-s* *netrw-sort* {{{2 3102 3103One may select the sorting style by name, time, or (file) size. The "s" map 3104allows one to circulate amongst the three choices; the directory listing will 3105automatically be refreshed to reflect the selected style. 3106 3107Related topics: |netrw-r| |netrw-S| 3108Associated setting variables: |g:netrw_sort_by| |g:netrw_sort_sequence| 3109 3110 3111SETTING EDITING WINDOW *netrw-editwindow* *netrw-C* *netrw-:NetrwC* {{{2 3112 3113One may select a netrw window for editing with the "C" mapping, using the 3114:NetrwC [win#] command, or by setting |g:netrw_chgwin| to the selected window 3115number. Subsequent selection of a file to edit (|netrw-cr|) will use that 3116window. 3117 3118 * C : by itself, will select the current window holding a netrw buffer 3119 for subsequent editing via |netrw-cr|. The C mapping is only available 3120 while in netrw buffers. 3121 3122 * [count]C : the count will be used as the window number to be used 3123 for subsequent editing via |netrw-cr|. 3124 3125 * :NetrwC will set |g:netrw_chgwin| to the current window 3126 3127 * :NetrwC win# will set |g:netrw_chgwin| to the specified window 3128 number 3129 3130Using > 3131 let g:netrw_chgwin= -1 3132will restore the default editing behavior 3133(ie. subsequent editing will use the current window). 3134 3135Related topics: |netrw-cr| |g:netrw_browse_split| 3136Associated setting variables: |g:netrw_chgwin| 3137 3138 3139SHRINKING OR EXPANDING A NETRW OR LEXPLORE WINDOW *netrw-c-tab* {{{2 3140 3141The <c-tab> key will toggle a netrw or |:Lexplore| window's width, 3142but only if |g:netrw_usetab| exists and is non-zero (and, of course, 3143only if your terminal supports differentiating <c-tab> from a plain 3144<tab>). 3145 3146 * If the current window is a netrw window, toggle its width 3147 (between |g:netrw_wiw| and its original width) 3148 3149 * Else if there is a |:Lexplore| window in the current tab, toggle 3150 its width 3151 3152 * Else bring up a |:Lexplore| window 3153 3154If |g:netrw_usetab| exists and is zero, or if there is a pre-existing mapping 3155for <c-tab>, then the <c-tab> will not be mapped. One may map something other 3156than a <c-tab>, too: (but you'll still need to have had |g:netrw_usetab| set). > 3157 3158 nmap <unique> (whatever) <Plug>NetrwShrink 3159< 3160Related topics: |:Lexplore| 3161Associated setting variable: |g:netrw_usetab| 3162 3163 3164USER SPECIFIED MAPS *netrw-usermaps* {{{1 3165 3166One may make customized user maps. Specify a variable, |g:Netrw_UserMaps|, 3167to hold a |List| of lists of keymap strings and function names: > 3168 3169 [["keymap-sequence","ExampleUserMapFunc"],...] 3170< 3171When netrw is setting up maps for a netrw buffer, if |g:Netrw_UserMaps| 3172exists, then the internal function netrw#UserMaps(islocal) is called. 3173This function goes through all the entries in the |g:Netrw_UserMaps| list: 3174 3175 * sets up maps: > 3176 nno <buffer> <silent> KEYMAP-SEQUENCE 3177 :call s:UserMaps(islocal,"ExampleUserMapFunc") 3178< * refreshes if result from that function call is the string 3179 "refresh" 3180 * if the result string is not "", then that string will be 3181 executed (:exe result) 3182 * if the result is a List, then the above two actions on results 3183 will be taken for every string in the result List 3184 3185The user function is passed one argument; it resembles > 3186 3187 fun! ExampleUserMapFunc(islocal) 3188< 3189where a:islocal is 1 if its a local-directory system call or 0 when 3190remote-directory system call. 3191 3192 *netrw-call* *netrw-expose* *netrw-modify* 3193Use netrw#Expose("varname") to access netrw-internal (script-local) 3194 variables. 3195Use netrw#Modify("varname",newvalue) to change netrw-internal variables. 3196Use netrw#Call("funcname"[,args]) to call a netrw-internal function with 3197 specified arguments. 3198 3199Example: Get a copy of netrw's marked file list: > 3200 3201 let netrwmarkfilelist= netrw#Expose("netrwmarkfilelist") 3202< 3203Example: Modify the value of netrw's marked file list: > 3204 3205 call netrw#Modify("netrwmarkfilelist",[]) 3206< 3207Example: Clear netrw's marked file list via a mapping on gu > 3208 " ExampleUserMap: {{{2 3209 fun! ExampleUserMap(islocal) 3210 call netrw#Modify("netrwmarkfilelist",[]) 3211 call netrw#Modify('netrwmarkfilemtch_{bufnr("%")}',"") 3212 let retval= ["refresh"] 3213 return retval 3214 endfun 3215 let g:Netrw_UserMaps= [["gu","ExampleUserMap"]] 3216< 3217 321810. Problems and Fixes *netrw-problems* {{{1 3219 3220 (This section is likely to grow as I get feedback) 3221 *netrw-p1* 3222 P1. I use Windows, and my network browsing with ftp doesn't sort by {{{2 3223 time or size! -or- The remote system is a Windows server; why 3224 don't I get sorts by time or size? 3225 3226 Windows' ftp has a minimal support for ls (ie. it doesn't 3227 accept sorting options). It doesn't support the -F which 3228 gives an explanatory character (ABC/ for "ABC is a directory"). 3229 Netrw then uses "dir" to get both its thin and long listings. 3230 If you think your ftp does support a full-up ls, put the 3231 following into your <.vimrc>: > 3232 3233 let g:netrw_ftp_list_cmd = "ls -lF" 3234 let g:netrw_ftp_timelist_cmd= "ls -tlF" 3235 let g:netrw_ftp_sizelist_cmd= "ls -slF" 3236< 3237 Alternatively, if you have cygwin on your Windows box, put 3238 into your <.vimrc>: > 3239 3240 let g:netrw_cygwin= 1 3241< 3242 This problem also occurs when the remote system is Windows. 3243 In this situation, the various g:netrw_ftp_[time|size]list_cmds 3244 are as shown above, but the remote system will not correctly 3245 modify its listing behavior. 3246 3247 3248 *netrw-p2* 3249 P2. I tried rcp://user@host/ (or protocol other than ftp) and netrw {{{2 3250 used ssh! That wasn't what I asked for... 3251 3252 Netrw has two methods for browsing remote directories: ssh 3253 and ftp. Unless you specify ftp specifically, ssh is used. 3254 When it comes time to do download a file (not just a directory 3255 listing), netrw will use the given protocol to do so. 3256 3257 *netrw-p3* 3258 P3. I would like long listings to be the default. {{{2 3259 3260 Put the following statement into your |vimrc|: > 3261 3262 let g:netrw_liststyle= 1 3263< 3264 Check out |netrw-browser-var| for more customizations that 3265 you can set. 3266 3267 *netrw-p4* 3268 P4. My times come up oddly in local browsing {{{2 3269 3270 Does your system's strftime() accept the "%c" to yield dates 3271 such as "Sun Apr 27 11:49:23 1997"? If not, do a 3272 "man strftime" and find out what option should be used. Then 3273 put it into your |vimrc|: > 3274 3275 let g:netrw_timefmt= "%X" (where X is the option) 3276< 3277 *netrw-p5* 3278 P5. I want my current directory to track my browsing. {{{2 3279 How do I do that? 3280 3281 Put the following line in your |vimrc|: 3282> 3283 let g:netrw_keepdir= 0 3284< 3285 *netrw-p6* 3286 P6. I use Chinese (or other non-ascii) characters in my filenames, {{{2 3287 and netrw (Explore, Sexplore, Hexplore, etc) doesn't display them! 3288 3289 (taken from an answer provided by Wu Yongwei on the vim 3290 mailing list) 3291 I now see the problem. Your code page is not 936, right? Vim 3292 seems only able to open files with names that are valid in the 3293 current code page, as are many other applications that do not 3294 use the Unicode version of Windows APIs. This is an OS-related 3295 issue. You should not have such problems when the system 3296 locale uses UTF-8, such as modern Linux distros. 3297 3298 (...it is one more reason to recommend that people use utf-8!) 3299 3300 *netrw-p7* 3301 P7. I'm getting "ssh is not executable on your system" -- what do I {{{2 3302 do? 3303 3304 (Dudley Fox) Most people I know use putty for windows ssh. It 3305 is a free ssh/telnet application. You can read more about it 3306 here: 3307 3308 http://www.chiark.greenend.org.uk/~sgtatham/putty/ Also: 3309 3310 (Marlin Unruh) This program also works for me. It's a single 3311 executable, so he/she can copy it into the Windows\System32 3312 folder and create a shortcut to it. 3313 3314 (Dudley Fox) You might also wish to consider plink, as it 3315 sounds most similar to what you are looking for. plink is an 3316 application in the putty suite. 3317 3318 http://the.earth.li/~sgtatham/putty/0.58/htmldoc/Chapter7.html#plink 3319 3320 (Vissale Neang) Maybe you can try OpenSSH for windows, which 3321 can be obtained from: 3322 3323 http://sshwindows.sourceforge.net/ 3324 3325 It doesn't need the full Cygwin package. 3326 3327 (Antoine Mechelynck) For individual Unix-like programs needed 3328 for work in a native-Windows environment, I recommend getting 3329 them from the GnuWin32 project on sourceforge if it has them: 3330 3331 http://gnuwin32.sourceforge.net/ 3332 3333 Unlike Cygwin, which sets up a Unix-like virtual machine on 3334 top of Windows, GnuWin32 is a rewrite of Unix utilities with 3335 Windows system calls, and its programs works quite well in the 3336 cmd.exe "Dos box". 3337 3338 (dave) Download WinSCP and use that to connect to the server. 3339 In Preferences > Editors, set gvim as your editor: 3340 3341 - Click "Add..." 3342 - Set External Editor (adjust path as needed, include 3343 the quotes and !.! at the end): 3344 "c:\Program Files\Vim\vim82\gvim.exe" !.! 3345 - Check that the filetype in the box below is 3346 {asterisk}.{asterisk} (all files), or whatever types 3347 you want (cec: change {asterisk} to * ; I had to 3348 write it that way because otherwise the helptags 3349 system thinks it's a tag) 3350 - Make sure it's at the top of the listbox (click it, 3351 then click "Up" if it's not) 3352 If using the Norton Commander style, you just have to hit <F4> 3353 to edit a file in a local copy of gvim. 3354 3355 (Vit Gottwald) How to generate public/private key and save 3356 public key it on server: > 3357 http://www.chiark.greenend.org.uk/~sgtatham/putty/0.60/htmldoc/Chapter8.html#pubkey-gettingready 3358 (8.3 Getting ready for public key authentication) 3359< 3360 How to use a private key with "pscp": > 3361 3362 http://www.chiark.greenend.org.uk/~sgtatham/putty/0.60/htmldoc/Chapter5.html 3363 (5.2.4 Using public key authentication with PSCP) 3364< 3365 (Ben Schmidt) I find the ssh included with cwRsync is 3366 brilliant, and install cwRsync or cwRsyncServer on most 3367 Windows systems I come across these days. I guess COPSSH, 3368 packed by the same person, is probably even better for use as 3369 just ssh on Windows, and probably includes sftp, etc. which I 3370 suspect the cwRsync doesn't, though it might 3371 3372 (cec) To make proper use of these suggestions above, you will 3373 need to modify the following user-settable variables in your 3374 .vimrc: 3375 3376 |g:netrw_ssh_cmd| |g:netrw_list_cmd| |g:netrw_mkdir_cmd| 3377 |g:netrw_rm_cmd| |g:netrw_rmdir_cmd| |g:netrw_rmf_cmd| 3378 3379 The first one (|g:netrw_ssh_cmd|) is the most important; most 3380 of the others will use the string in g:netrw_ssh_cmd by 3381 default. 3382 3383 *netrw-p8* *netrw-ml_get* 3384 P8. I'm browsing, changing directory, and bang! ml_get errors {{{2 3385 appear and I have to kill vim. Any way around this? 3386 3387 Normally netrw attempts to avoid writing swapfiles for 3388 its temporary directory buffers. However, on some systems 3389 this attempt appears to be causing ml_get errors to 3390 appear. Please try setting |g:netrw_use_noswf| to 0 3391 in your <.vimrc>: > 3392 let g:netrw_use_noswf= 0 3393< 3394 *netrw-p9* 3395 P9. I'm being pestered with "[something] is a directory" and {{{2 3396 "Press ENTER or type command to continue" prompts... 3397 3398 The "[something] is a directory" prompt is issued by Vim, 3399 not by netrw, and there appears to be no way to work around 3400 it. Coupled with the default cmdheight of 1, this message 3401 causes the "Press ENTER..." prompt. So: read |hit-enter|; 3402 I also suggest that you set your 'cmdheight' to 2 (or more) in 3403 your <.vimrc> file. 3404 3405 *netrw-p10* 3406 P10. I want to have two windows; a thin one on the left and my {{{2 3407 editing window on the right. How may I accomplish this? 3408 3409 You probably want netrw running as in a side window. If so, you 3410 will likely find that ":[N]Lexplore" does what you want. The 3411 optional "[N]" allows you to select the quantity of columns you 3412 wish the |:Lexplore|r window to start with (see |g:netrw_winsize| 3413 for how this parameter works). 3414 3415 Previous solution: 3416 3417 * Put the following line in your <.vimrc>: 3418 let g:netrw_altv = 1 3419 * Explore the current directory: :Explore . 3420 * Select some file, press v 3421 * Resize the windows as you wish (see |CTRL-W_<| and 3422 |CTRL-W_>|). If you're using gvim, you can drag 3423 the separating bar with your mouse. 3424 * When you want a new file, use ctrl-w h to go back to the 3425 netrw browser, select a file, then press P (see |CTRL-W_h| 3426 and |netrw-P|). If you're using gvim, you can press 3427 <leftmouse> in the browser window and then press the 3428 <middlemouse> to select the file. 3429 3430 3431 *netrw-p11* 3432 P11. My directory isn't sorting correctly, or unwanted letters are {{{2 3433 appearing in the listed filenames, or things aren't lining 3434 up properly in the wide listing, ... 3435 3436 This may be due to an encoding problem. I myself usually use 3437 utf-8, but really only use ascii (ie. bytes from 32-126). 3438 Multibyte encodings use two (or more) bytes per character. 3439 You may need to change |g:netrw_sepchr| and/or |g:netrw_xstrlen|. 3440 3441 *netrw-p12* 3442 P12. I'm a Windows + putty + ssh user, and when I attempt to {{{2 3443 browse, the directories are missing trailing "/"s so netrw treats 3444 them as file transfers instead of as attempts to browse 3445 subdirectories. How may I fix this? 3446 3447 (mikeyao) If you want to use vim via ssh and putty under Windows, 3448 try combining the use of pscp/psftp with plink. pscp/psftp will 3449 be used to connect and plink will be used to execute commands on 3450 the server, for example: list files and directory using 'ls'. 3451 3452 These are the settings I use to do this: 3453> 3454 " list files, it's the key setting, if you haven't set, 3455 " you will get a blank buffer 3456 let g:netrw_list_cmd = "plink HOSTNAME ls -Fa" 3457 " if you haven't add putty directory in system path, you should 3458 " specify scp/sftp command. For examples: 3459 "let g:netrw_sftp_cmd = "d:\\dev\\putty\\PSFTP.exe" 3460 "let g:netrw_scp_cmd = "d:\\dev\\putty\\PSCP.exe" 3461< 3462 *netrw-p13* 3463 P13. I would like to speed up writes using Nwrite and scp/ssh {{{2 3464 style connections. How? (Thomer M. Gil) 3465 3466 Try using ssh's ControlMaster and ControlPath (see the ssh_config 3467 man page) to share multiple ssh connections over a single network 3468 connection. That cuts out the cryptographic handshake on each 3469 file write, sometimes speeding it up by an order of magnitude. 3470 (see http://thomer.com/howtos/netrw_ssh.html) 3471 (included by permission) 3472 3473 Add the following to your ~/.ssh/config: > 3474 3475 # you change "*" to the hostname you care about 3476 Host * 3477 ControlMaster auto 3478 ControlPath /tmp/%r@%h:%p 3479 3480< Then create an ssh connection to the host and leave it running: > 3481 3482 ssh -N host.domain.com 3483 3484< Now remotely open a file with Vim's Netrw and enjoy the 3485 zippiness: > 3486 3487 vim scp://host.domain.com//home/user/.bashrc 3488< 3489 *netrw-p14* 3490 P14. How may I use a double-click instead of netrw's usual single {{{2 3491 click to open a file or directory? (Ben Fritz) 3492 3493 First, disable netrw's mapping with > 3494 let g:netrw_mousemaps= 0 3495< and then create a netrw buffer only mapping in 3496 $HOME/.vim/after/ftplugin/netrw.vim: > 3497 nmap <buffer> <2-leftmouse> <CR> 3498< Note that setting g:netrw_mousemaps to zero will turn off 3499 all netrw's mouse mappings, not just the <leftmouse> one. 3500 (see |g:netrw_mousemaps|) 3501 3502 *netrw-p15* 3503 P15. When editing remote files (ex. :e ftp://hostname/path/file), {{{2 3504 under Windows I get an |E303| message complaining that its unable 3505 to open a swap file. 3506 3507 (romainl) It looks like you are starting Vim from a protected 3508 directory. Start netrw from your $HOME or other writable 3509 directory. 3510 3511 *netrw-p16* 3512 P16. Netrw is closing buffers on its own. {{{2 3513 What steps will reproduce the problem? 3514 1. :Explore, navigate directories, open a file 3515 2. :Explore, open another file 3516 3. Buffer opened in step 1 will be closed. o 3517 What is the expected output? What do you see instead? 3518 I expect both buffers to exist, but only the last one does. 3519 3520 (Lance) Problem is caused by "set autochdir" in .vimrc. 3521 (drchip) I am able to duplicate this problem with 'acd' set. 3522 It appears that the buffers are not exactly closed; 3523 a ":ls!" will show them (although ":ls" does not). 3524 3525 *netrw-P17* 3526 P17. How to locally edit a file that's only available via {{{2 3527 another server accessible via ssh? 3528 See http://stackoverflow.com/questions/12469645/ 3529 "Using Vim to Remotely Edit A File on ServerB Only 3530 Accessible From ServerA" 3531 3532 *netrw-P18* 3533 P18. How do I get numbering on in directory listings? {{{2 3534 With |g:netrw_bufsettings|, you can control netrw's buffer 3535 settings; try putting > 3536 let g:netrw_bufsettings="noma nomod nu nobl nowrap ro nornu" 3537< in your .vimrc. If you'd like to have relative numbering 3538 instead, try > 3539 let g:netrw_bufsettings="noma nomod nonu nobl nowrap ro rnu" 3540< 3541 *netrw-P19* 3542 P19. How may I have gvim start up showing a directory listing? {{{2 3543 Try putting the following code snippet into your .vimrc: > 3544 augroup VimStartup 3545 au! 3546 au VimEnter * if expand("%") == "" && argc() == 0 && 3547 \ (v:servername =~ 'GVIM\d*' || v:servername == "") 3548 \ | e . | endif 3549 augroup END 3550< You may use Lexplore instead of "e" if you're so inclined. 3551 This snippet assumes that you have client-server enabled 3552 (ie. a "huge" vim version). 3553 3554 *netrw-P20* 3555 P20. I've made a directory (or file) with an accented character, {{{2 3556 but netrw isn't letting me enter that directory/read that file: 3557 3558 Its likely that the shell or o/s is using a different encoding 3559 than you have vim (netrw) using. A patch to vim supporting 3560 "systemencoding" may address this issue in the future; for 3561 now, just have netrw use the proper encoding. For example: > 3562 3563 au FileType netrw set enc=latin1 3564< 3565 *netrw-P21* 3566 P21. I get an error message when I try to copy or move a file: {{{2 3567> 3568 **error** (netrw) tried using g:netrw_localcopycmd<cp>; it doesn't work! 3569< 3570 What's wrong? 3571 3572 Netrw uses several system level commands to do things (see 3573 3574 |g:netrw_localcopycmd|, |g:netrw_localmovecmd|, 3575 |g:netrw_mkdir_cmd|). 3576 3577 You may need to adjust the default commands for one or more of 3578 these commands by setting them properly in your .vimrc. Another 3579 source of difficulty is that these commands use vim's local 3580 directory, which may not be the same as the browsing directory 3581 shown by netrw (see |g:netrw_keepdir|). 3582 3583============================================================================== 358411. Credits *netrw-credits* {{{1 3585 3586 Vim editor by Bram Moolenaar (Thanks, Bram!) 3587 dav support by C Campbell 3588 fetch support by Bram Moolenaar and C Campbell 3589 ftp support by C Campbell <NcampObell@SdrPchip.AorgM-NOSPAM> 3590 http support by Bram Moolenaar <bram@moolenaar.net> 3591 rcp 3592 rsync support by C Campbell (suggested by Erik Warendorph) 3593 scp support by raf <raf@comdyn.com.au> 3594 sftp support by C Campbell 3595 3596 inputsecret(), BufReadCmd, BufWriteCmd contributed by C Campbell 3597 3598 Jérôme Augé -- also using new buffer method with ftp+.netrc 3599 Bram Moolenaar -- obviously vim itself, :e and v:cmdarg use, 3600 fetch,... 3601 Yasuhiro Matsumoto -- pointing out undo+0r problem and a solution 3602 Erik Warendorph -- for several suggestions (g:netrw_..._cmd 3603 variables, rsync etc) 3604 Doug Claar -- modifications to test for success with ftp 3605 operation 3606 3607============================================================================== 3608Modelines: {{{1 3609vim:tw=78:ts=8:ft=help:noet:norl:fdm=marker