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