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