comparison runtime/doc/pi_netrw.txt @ 559:8ec588470508

updated for version 7.0159
author vimboss
date Fri, 25 Nov 2005 19:54:28 +0000
parents 862863033fdd
children db92c5cc4f66
comparison
equal deleted inserted replaced
558:7ccb59c211b7 559:8ec588470508
1 *pi_netrw.txt* For Vim version 7.0. Last change: Aug 31, 2005 1 *pi_netrw.txt* For Vim version 7.0. Last change: Oct 19, 2005
2
3 2
4 VIM REFERENCE MANUAL by Charles E. Campbell, Jr. 3 VIM REFERENCE MANUAL by Charles E. Campbell, Jr.
4
5 5
6 *dav* *http* *network* *rcp* *scp* 6 *dav* *http* *network* *rcp* *scp*
7 *fetch* *netrw* *Nread* *rsync* *sftp* 7 *fetch* *netrw* *Nread* *rsync* *sftp*
8 *ftp* *netrw.vim* *Nwrite* *netrw-file* 8 *ftp* *netrw.vim* *Nwrite* *netrw-file*
9 9
23 PASSWORD...........................................|netrw-passwd| 23 PASSWORD...........................................|netrw-passwd|
24 3. Activation...........................................|netrw-activate| 24 3. Activation...........................................|netrw-activate|
25 4. Transparent File Transfer............................|netrw-transparent| 25 4. Transparent File Transfer............................|netrw-transparent|
26 5. Ex Commands..........................................|netrw-ex| 26 5. Ex Commands..........................................|netrw-ex|
27 6. Variables and Options................................|netrw-var| 27 6. Variables and Options................................|netrw-var|
28 7. Directory Browser....................................|netrw-browse| {{{1 28 7. Directory Browsing...................................|netrw-browse| {{{1
29 Maps...............................................|netrw-maps| 29 Maps...............................................|netrw-maps|
30 Exploring..........................................|netrw-explore-cmds| 30 Exploring..........................................|netrw-explore-cmds|
31 Quick Reference Commands Table.....................|netrw-browse-cmds| 31 Quick Reference Commands Table.....................|netrw-browse-cmds|
32 Netrw Browser Variables............................|netrw-browse-var| 32 Netrw Browser Variables............................|netrw-browse-var|
33 Introduction To Directory Browsing.................|netrw-browse-intro| 33 Introduction To Directory Browsing.................|netrw-browse-intro|
192 192
193 ============================================================================== 193 ==============================================================================
194 2. Network-Oriented File Transfer *netrw-xfer* 194 2. Network-Oriented File Transfer *netrw-xfer*
195 195
196 Network-oriented file transfer under Vim is implemented by a VimL-based script 196 Network-oriented file transfer under Vim is implemented by a VimL-based script
197 (<netrw.vim>) using plugin techniques. It currently supports both reading 197 (<netrw.vim>) using plugin techniques. It currently supports both reading and
198 and writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch, 198 writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch,
199 dav/cadaver, rsync, or sftp. 199 dav/cadaver, rsync, or sftp.
200 200
201 http is currently supported read-only via use of wget or fetch. 201 http is currently supported read-only via use of wget or fetch.
202 202
203 <netrw.vim> is a standard plugin which acts as glue between Vim and the 203 <netrw.vim> is a standard plugin which acts as glue between Vim and the
204 various file transfer programs. It uses autocommand events (BufReadCmd, 204 various file transfer programs. It uses autocommand events (BufReadCmd,
205 FileReadCmd, BufWriteCmd) to intercept reads/writes with url-like filenames. > 205 FileReadCmd, BufWriteCmd) to intercept reads/writes with url-like filenames. >
206 206
207 ex. vim ftp://hostname/path/to/file 207 ex. vim ftp://hostname/path/to/file
208 < 208 <
209 The characters preceding the colon specify the protocol to use; 209 The characters preceding the colon specify the protocol to use; in the
210 in the example, its ftp. The <netrw.vim> script then formulates 210 example, its ftp. The <netrw.vim> script then formulates a command or a
211 a command or a series of commands (typically ftp) which it issues 211 series of commands (typically ftp) which it issues to an external program
212 to an external program (ftp, scp, etc) which does the actual file 212 (ftp, scp, etc) which does the actual file transfer/protocol. Files are read
213 transfer/protocol. Files are read from/written to a temporary file 213 from/written to a temporary file (under Unix/Linux, /tmp/...) which the
214 (under Unix/Linux, /tmp/...) which the <netrw.vim> script will 214 <netrw.vim> script will clean up.
215 clean up. 215
216 216 One may modify any protocol's implementing external application by setting a
217 One may modify any protocol's implementing external application 217 variable (ex. scp uses the variable g:netrw_scp_cmd, which is defaulted to
218 by setting a variable (ex. scp uses the variable g:netrw_scp_cmd, 218 "scp -q").
219 which is defaulted to "scp -q").
220 219
221 Ftp, an old protocol, seems to be blessed by numerous implementations. 220 Ftp, an old protocol, seems to be blessed by numerous implementations.
222 Unfortunately, some implementations are noisy (ie., add junk to the end 221 Unfortunately, some implementations are noisy (ie., add junk to the end of the
223 of the file). Thus, concerned users may decide to write a NetReadFixup() 222 file). Thus, concerned users may decide to write a NetReadFixup() function
224 function that will clean up after reading with their ftp. Some Unix systems 223 that will clean up after reading with their ftp. Some Unix systems (ie.,
225 (ie., FreeBSD) provide a utility called "fetch" which uses the ftp protocol 224 FreeBSD) provide a utility called "fetch" which uses the ftp protocol but is
226 but is not noisy and more convenient, actually, for <netrw.vim> to use. 225 not noisy and more convenient, actually, for <netrw.vim> to use.
227 Consequently, if "fetch" is executable, it will be used to do reads for 226 Consequently, if "fetch" is executable, it will be used to do reads for
228 ftp://... (and http://...) . See |netrw-var| for more about this. 227 ftp://... (and http://...) . See |netrw-var| for more about this.
229 228
230 For rcp, scp, sftp, and http, one may use network-oriented file transfers 229 For rcp, scp, sftp, and http, one may use network-oriented file transfers
231 transparently; ie. 230 transparently; ie.
330 329
331 The script attempts to get passwords for ftp invisibly using |inputsecret()|, 330 The script attempts to get passwords for ftp invisibly using |inputsecret()|,
332 a built-in Vim function. See |netrw-uidpass| for how to change the password 331 a built-in Vim function. See |netrw-uidpass| for how to change the password
333 after one has set it. 332 after one has set it.
334 333
335 Unfortunately there doesn't appear to be a way for netrw to feed a password 334 Unfortunately there doesn't appear to be a way for netrw to feed a password to
336 to scp. Thus every transfer via scp will require re-entry of the password. 335 scp. Thus every transfer via scp will require re-entry of the password.
336 However, |netrw-listhack| can help with this problem.
337 337
338 338
339 ============================================================================== 339 ==============================================================================
340 3. Activation *netrw-activate* 340 3. Activation *netrw-activate*
341 341
342 Network-oriented file transfers are available by default whenever 342 Network-oriented file transfers are available by default whenever
343 |'nocompatible'| mode is enabled. The <netrw.vim> file resides in your 343 |'nocompatible'| mode is enabled. The <netrw.vim> file resides in your
344 system's vim-plugin directory and is sourced automatically whenever you 344 system's vim-plugin directory and is sourced automatically whenever you bring
345 bring up vim. 345 up vim. I suggest that, at a minimum, you have at least the following in your
346 346 <.vimrc> customization file: >
347 set nocp
348 if version >= 600
349 filetype plugin indent on
350 endif
351 <
347 352
348 ============================================================================== 353 ==============================================================================
349 4. Transparent File Transfer *netrw-transparent* 354 4. Transparent File Transfer *netrw-transparent*
350 355
351 Transparent file transfers occur whenever a regular file read or write 356 Transparent file transfers occur whenever a regular file read or write
352 (invoked via an |:autocmd| for |BufReadCmd| or |BufWriteCmd| events) is made. 357 (invoked via an |:autocmd| for |BufReadCmd| or |BufWriteCmd| events) is made.
353 Thus one may use files across networks as if they were local. > 358 Thus one may use files across networks just as simply as if they were local. >
354 359
355 vim ftp://[user@]machine/path 360 vim ftp://[user@]machine/path
356 ... 361 ...
357 :wq 362 :wq
358 363
364 See |netrw-activate| for more on how to encourage your vim to use plugins
365 such as netrw.
359 366
360 ============================================================================== 367 ==============================================================================
361 5. Ex Commands *netrw-ex* 368 5. Ex Commands *netrw-ex*
362 369
363 The usual read/write commands are supported. There are also a couple of 370 The usual read/write commands are supported. There are also a couple of
367 file as specified in b:netrw_lastfile. 374 file as specified in b:netrw_lastfile.
368 375
369 :[range]Nw {netfile} [{netfile}]... 376 :[range]Nw {netfile} [{netfile}]...
370 Write the specified lines to the {netfile}. 377 Write the specified lines to the {netfile}.
371 378
372 :Nread 379 :Nread Read the specified lines into the current
373 Read the specified lines into the current
374 buffer from the file specified in 380 buffer from the file specified in
375 b:netrw_lastfile. 381 b:netrw_lastfile.
376 382
377 :Nread {netfile} {netfile}... 383 :Nread {netfile} {netfile}...
378 Read the {netfile} after the current line. 384 Read the {netfile} after the current line.
399 ============================================================================== 405 ==============================================================================
400 6. Variables and Options *netrw-options* *netrw-var* 406 6. Variables and Options *netrw-options* *netrw-var*
401 407
402 The script <netrw.vim> uses several variables which can affect <netrw.vim>'s 408 The script <netrw.vim> uses several variables which can affect <netrw.vim>'s
403 behavior. These variables typically may be set in the user's <.vimrc> file: 409 behavior. These variables typically may be set in the user's <.vimrc> file:
404 > 410 (also see |netrw-settings|) >
405 ------------- 411
406 Netrw Options 412 -------------
407 ------------- 413 Netrw Options
414 -------------
408 Option Meaning 415 Option Meaning
409 -------------- ----------------------------------------------- 416 -------------- -----------------------------------------------
410 < 417 <
411 b:netrw_col Holds current cursor position (during NetWrite) 418 b:netrw_col Holds current cursor position (during NetWrite)
412 g:netrw_cygwin =1 assume scp under windows is from cygwin 419 g:netrw_cygwin =1 assume scp under windows is from cygwin
479 g:netrw_scp_cmd variable ="scp -q" 486 g:netrw_scp_cmd variable ="scp -q"
480 g:netrw_sftp_cmd variable ="sftp" > 487 g:netrw_sftp_cmd variable ="sftp" >
481 ------------------------------------------------------------------------- 488 -------------------------------------------------------------------------
482 < 489 <
483 *netrw-ftp* 490 *netrw-ftp*
484 The first two options both help with certain ftp's that give trouble otherwise. 491 The first two options both help with certain ftp's that give trouble
485 In order to best understand how to use these options if ftp is giving you 492 otherwise. In order to best understand how to use these options if ftp is
486 troubles, a bit of discussion follows on how netrw does ftp reads. 493 giving you troubles, a bit of discussion follows on how netrw does ftp reads.
487 494
488 The g:netrw_..._cmd variables specify the external program to use handle 495 The g:netrw_..._cmd variables specify the external program to use handle the
489 the associated protocol (rcp, ftp, etc), plus any options. 496 associated protocol (rcp, ftp, etc), plus any options.
490 497
491 The g:netrw_list_cmd's HOSTNAME entry will be changed via substitution with 498 The g:netrw_list_cmd's HOSTNAME entry will be changed via substitution with
492 whatever the current request is for a hostname. 499 whatever the current request is for a hostname.
493 500
494 For ftp, netrw typically builds up lines of one of the following formats in a 501 For ftp, netrw typically builds up lines of one of the following formats in a
517 If <.netrc> exists it will be used to avoid having to query the user for 524 If <.netrc> exists it will be used to avoid having to query the user for
518 userid and password. The transferred file is put into a temporary file. 525 userid and password. The transferred file is put into a temporary file.
519 The temporary file is then read into the main editing session window that 526 The temporary file is then read into the main editing session window that
520 requested it and the temporary file deleted. 527 requested it and the temporary file deleted.
521 528
522 If your ftp doesn't accept the "user" command and immediately just demands 529 If your ftp doesn't accept the "user" command and immediately just demands a
523 a userid, then try putting "let netrw_ftp=1" in your <.vimrc>. 530 userid, then try putting "let netrw_ftp=1" in your <.vimrc>.
524 531
525 *netrw-cadaver* 532 *netrw-cadaver*
526 To handle the SSL certificate dialog for untrusted servers, one may pull 533 To handle the SSL certificate dialog for untrusted servers, one may pull
527 down the certificate and place it into /usr/ssl/cert.pem. This operation 534 down the certificate and place it into /usr/ssl/cert.pem. This operation
528 renders the server treatment as "trusted". 535 renders the server treatment as "trusted".
545 elseif a:method == 9 "sftp 552 elseif a:method == 9 "sftp
546 else " complain 553 else " complain
547 endif 554 endif
548 endfunction 555 endfunction
549 > 556 >
550 The NetReadFixup() function will be called if it exists and thus allows 557 The NetReadFixup() function will be called if it exists and thus allows you to
551 you to customize your reading process. As a further example, <netrw.vim> 558 customize your reading process. As a further example, <netrw.vim> contains
552 contains just such a function to handle Windows 95 ftp. For whatever 559 just such a function to handle Windows 95 ftp. For whatever reason, Windows
553 reason, Windows 95's ftp dumps four blank lines at the end of a transfer, 560 95's ftp dumps four blank lines at the end of a transfer, and so it is
554 and so it is desirable to automate their removal. Here's some code taken 561 desirable to automate their removal. Here's some code taken from <netrw.vim>
555 from <netrw.vim> itself: 562 itself:
556 > 563 >
557 if has("win95") && g:netrw_win95ftp 564 if has("win95") && g:netrw_win95ftp
558 fun! NetReadFixup(method, line1, line2) 565 fun! NetReadFixup(method, line1, line2)
559 if method == 3 " ftp (no <.netrc>) 566 if method == 3 " ftp (no <.netrc>)
560 let fourblanklines= line2 - 3 567 let fourblanklines= line2 - 3
563 endfunction 570 endfunction
564 endif 571 endif
565 > 572 >
566 573
567 ============================================================================== 574 ==============================================================================
568 7. Directory Browser *netrw-browse* *netrw-dir* *netrw-list* *netrw-help* 575 7. Directory Browsing *netrw-browse* *netrw-dir* *netrw-list* *netrw-help*
569 576
570 MAPS *netrw-maps* 577 MAPS *netrw-maps*
571 ?................Help.......................................|netrw-help| 578 ?................Help.......................................|netrw-help|
572 <cr>.............Browsing...................................|netrw-cr| 579 <cr>.............Browsing...................................|netrw-cr|
573 <del>............Deleting Files or Directories..............|netrw-delete| 580 <del>............Deleting Files or Directories..............|netrw-delete|
654 ^Security extensions not\| 661 ^Security extensions not\|
655 No such file\| 662 No such file\|
656 : connect to address [0-9a-fA-F:]* 663 : connect to address [0-9a-fA-F:]*
657 : No route to host$' 664 : No route to host$'
658 665
666 *g:netrw_ftp_list_cmd* options for passing along to ftp for directory
667 listing. Defaults:
668 unix or g:netrw_cygwin set: : "ls -lF"
669 otherwise "dir"
670
671 *g:netrw_hide* if true, the hiding list is used
672 default: =0
673
674 *g:netrw_keepdir* =1 (default) keep current directory immune from
675 the browsing directory.
676 =0 keep the current directory the same as the
677 browsing directory.
678 The current browsing directory is contained in
679 b:netrw_curdir
680
681 *g:netrw_list_cmd* command for listing remote directories
682 default: (if ssh is executable)
683 "ssh HOSTNAME ls -FLa"
684
685 *g:netrw_longlist* if =1, then long listing will be default
686
687 *g:netrw_list_hide* comma separated pattern list for hiding files
688 default: ""
689
690 *g:netrw_local_mkdir* command for making a local directory
691 default: "mkdir"
692
693 *g:netrw_local_rmdir* remove directory command (rmdir)
694 default: "rmdir"
695
696 *g:netrw_maxfilenamelen* =32 by default, selected so as to make long
697 listings fit on 80 column displays.
698 If your screen is wider, and you have file
699 or directory names longer than 32 bytes,
700 you may set this option to keep listings
701 columnar.
702
703 *g:netrw_mkdir_cmd* command for making a remote directory
704 default: "ssh HOSTNAME mkdir"
705
706 *g:netrw_rm_cmd* command for removing files
707 default: "ssh HOSTNAME rm"
708
709 *g:netrw_rmdir_cmd* command for removing directories
710 default: "ssh HOSTNAME rmdir"
711
712 *g:netrw_rmf_cmd* command for removing softlinks
713 default: "ssh HOSTNAME rm -f"
714
715 *g:netrw_sort_by* sort by "name", "time", or "size"
716 default: "name"
717
718 *g:netrw_sort_direction* sorting direction: "normal" or "reverse"
719 default: "normal"
720
721 *g:netrw_sort_sequence* when sorting by name, first sort by the
722 comma-separated pattern sequence
723 default: '[\/]$,*,\.bak$,\.o$,\.h$,
724 \.info$,\.swp$,\.obj$'
725
726 *g:netrw_ssh_cmd* One may specify an executable command
727 to use instead of ssh for remote actions
728 such as listing, file removal, etc.
729 default: ssh
730
659 *g:netrw_ssh_browse_reject* ssh can sometimes produce unwanted lines, 731 *g:netrw_ssh_browse_reject* ssh can sometimes produce unwanted lines,
660 messages, banners, and whatnot that one doesn't 732 messages, banners, and whatnot that one doesn't
661 want masquerading as "directories" and "files". 733 want masquerading as "directories" and "files".
662 Use this pattern to remove such embedded 734 Use this pattern to remove such embedded
663 messages. By default its value is: 735 messages. By default its value is:
664 '^total\s\+\d\+$' 736 '^total\s\+\d\+$'
665 737
666 *g:netrw_keepdir* =1 (default) keep current directory immune from
667 the browsing directory.
668 =0 keep the current directory the same as the
669 browsing directory.
670 The current browsing directory is contained in
671 b:netrw_curdir
672
673 *g:netrw_list_cmd* command for listing remote directories
674 default: (if ssh is executable)
675 "ssh HOSTNAME ls -FLa"
676
677 *g:netrw_longlist* if =1, then long listing will be default
678
679 *g:netrw_ftp_list_cmd* options for passing along to ftp for directory
680 listing. Defaults:
681 unix or g:netrw_cygwin set: : "ls -lF"
682 otherwise "dir"
683
684 *g:netrw_list_hide* comma separated pattern list for hiding files
685 default: ""
686
687 *g:netrw_local_mkdir* command for making a local directory
688 default: "ssh HOSTNAME mkdir"
689
690 *g:netrw_local_rmdir* remove directory command (rmdir)
691 default: "rmdir"
692
693 *g:netrw_maxfilenamelen* =32 by default, selected so as to make long
694 listings fit on 80 column displays.
695 If your screen is wider, and you have file
696 or directory names longer than 32 bytes,
697 you may set this option to keep listings
698 columnar.
699
700 *g:netrw_mkdir_cmd* command for making a remote directory
701 default: "ssh HOSTNAME mkdir"
702
703 *g:netrw_rm_cmd* command for removing files
704 default: "ssh HOSTNAME rm"
705
706 *g:netrw_rmdir_cmd* command for removing directories
707 default: "ssh HOSTNAME rmdir"
708
709 *g:netrw_rmf_cmd* command for removing softlinks
710 default: "ssh HOSTNAME rm -f"
711
712 *g:netrw_hide* if true, the hiding list is used
713 default: =0
714
715 *g:netrw_sort_by* sort by "name", "time", or "size"
716 default: "name"
717
718 *g:netrw_sort_direction* sorting direction: "normal" or "reverse"
719 default: "normal"
720
721 *g:netrw_sort_sequence* when sorting by name, first sort by the
722 comma-separated pattern sequence
723 default: '[\/]$,*,\.bak$,\.o$,\.h$,
724 \.info$,\.swp$,\.obj$'
725
726 *g:netrw_timefmt* specify format string to strftime() (%c) 738 *g:netrw_timefmt* specify format string to strftime() (%c)
727 default: "%c" 739 default: "%c"
728 740
729 *g:netrw_winsize* specify initial size of new o/v windows 741 *g:netrw_winsize* specify initial size of new o/v windows
730 default: "" 742 default: ""
731 743
732 INTRODUCTION TO DIRECTORY BROWSING *netrw-browse-intro* 744 INTRODUCTION TO DIRECTORY BROWSING *netrw-browse-intro*
733 745
734 Netrw supports the browsing of directories on the local system and on remote 746 Netrw supports the browsing of directories on the local system and on remote
735 hosts, including generating listing directories, entering directories, editing 747 hosts, including listing files and directories, entering directories, editing
736 files therein, deleting files/directories, making new directories, and moving 748 files therein, deleting files/directories, making new directories, and moving
737 (renaming) files and directories. The Netrw browser generally implements the 749 (renaming) files and directories. The Netrw browser generally implements the
738 previous explorer maps and commands for remote directories, although details 750 previous explorer maps and commands for remote directories, although details
739 (such as pertinent global variable names) necessarily differ. 751 (such as pertinent global variable names) necessarily differ.
740 752
741 The Netrw remote file and directory browser handles two protocols: ssh and 753 The Netrw remote file and directory browser handles two protocols: ssh and
742 ftp. The protocol in the url, if it is ftp, will cause netrw to use ftp 754 ftp. The protocol in the url, if it is ftp, will cause netrw to use ftp
743 in its remote browsing. Any other protocol will be used for file transfers, 755 in its remote browsing. Any other protocol will be used for file transfers,
744 but otherwise the ssh protocol will be used to do remote directory browsing. 756 but otherwise the ssh protocol will be used to do remote directory browsing.
745 757
746 To enter the netrw directory browser, simply attempt to read a "file" with a 758 To use Netrw's remote directory browser, simply attempt to read a "file" with a
747 trailing slash and it will be interpreted as a request to list a directory: 759 trailing slash and it will be interpreted as a request to list a directory:
748 760
749 vim [protocol]://[user@]hostname/path/ 761 vim [protocol]://[user@]hostname/path/
750 762
751 If you'd like to avoid entering the password in for directory listings, scp, 763 For local directories, the trailing slash is not required.
752 ssh interaction, etc, see |netrw-listhack|. 764
765 If you'd like to avoid entering the password in for remote directory listings
766 with ssh or scp, see |netrw-listhack|.
753 767
754 *netrw-explore* *netrw-pexplore* 768 *netrw-explore* *netrw-pexplore*
755 *netrw-hexplore* *netrw-sexplore* 769 *netrw-hexplore* *netrw-sexplore*
756 DIRECTORY EXPLORING COMMANDS *netrw-nexplore* *netrw-vexplore* 770 DIRECTORY EXPLORING COMMANDS *netrw-nexplore* *netrw-vexplore*
757 771
781 795
782 By default, these commands use the current file's directory. However, one 796 By default, these commands use the current file's directory. However, one
783 may explicitly provide a directory (path) to use. 797 may explicitly provide a directory (path) to use.
784 798
785 (Following needs v7.0 or later) *netrw-starstar* 799 (Following needs v7.0 or later) *netrw-starstar*
786 When Explore, Sexplore, Hexplore, or Vexplore are used like 800 When Explore, Sexplore, Hexplore, or Vexplore are used with a **,
801 such as:
787 > 802 >
788 :Explore **/filename_pattern 803 :Explore **/filename_pattern
789 < 804 <
790 netrw will attempt to find a (sub)directory which matches the filename 805 netrw will attempt to find a (sub)directory which matches the filename
791 pattern. Internally, it produces a list of files which match the pattern 806 pattern. Internally, it produces a list of files which match the pattern
795 < 810 <
796 The directory display is updated to show the subdirectory containing a 811 The directory display is updated to show the subdirectory containing a
797 matching file. One may then proceed to the next (or previous) matching files' 812 matching file. One may then proceed to the next (or previous) matching files'
798 directories by using Nexplore or Pexplore, respectively. If your console or 813 directories by using Nexplore or Pexplore, respectively. If your console or
799 gui produces recognizable shift-up or shift-down sequences, then you'll likely 814 gui produces recognizable shift-up or shift-down sequences, then you'll likely
800 find the following mappings convenient: 815 find using shift-downarrow and shift-uparrow convenient. They're mapped by
816 netrw:
801 817
802 <s-down> == Nexplore, and 818 <s-down> == Nexplore, and
803 <s-up> == Pexplore. 819 <s-up> == Pexplore.
804 820
805 As an example, consider 821 As an example, consider
820 refresh a local directory by using ":e .". 836 refresh a local directory by using ":e .".
821 837
822 838
823 GOING UP *netrw--* 839 GOING UP *netrw--*
824 840
825 To go up a directory, press - or his the <cr> when atop the ../ directory 841 To go up a directory, press "-" or press the <cr> when atop the ../ directory
826 entry in the listing. 842 entry in the listing.
827 843
828 Netrw will modify the command in |g:netrw_list_cmd| to perform the directory 844 Netrw will use the command in |g:netrw_list_cmd| to perform the directory
829 listing operation. By default the command is: 845 listing operation after changing HOSTNAME to the host specified by the
846 user-provided url. By default netrw provides the command as:
830 847
831 ssh HOSTNAME ls -FLa 848 ssh HOSTNAME ls -FLa
832 849
833 where the HOSTNAME becomes the [user@]hostname as requested by the attempt to 850 where the HOSTNAME becomes the [user@]hostname as requested by the attempt to
834 read. Naturally, the user may override this command with whatever is 851 read. Naturally, the user may override this command with whatever is
839 BROWSING *netrw-cr* 856 BROWSING *netrw-cr*
840 857
841 Browsing is simple: move the cursor onto a file or directory of interest. 858 Browsing is simple: move the cursor onto a file or directory of interest.
842 Hitting the <cr> (the return key) will select the file or directory. 859 Hitting the <cr> (the return key) will select the file or directory.
843 Directories will themselves be listed, and files will be opened using the 860 Directories will themselves be listed, and files will be opened using the
844 protocol given in the original read request. 861 protocol given in the original read request.
862
863 CAVEAT: There are three forms of listing (see |netrw-i|). Netrw assumes
864 that two or more spaces delimit filenames and directory names for the long
865 and wide listing formats. Thus, if your filename or directory name has two
866 or more spaces embedded in it, or any trailing spaces, then you'll need to
867 use the "thin" format to select it.
845 868
846 869
847 OBTAINING A FILE *netrw-O* 870 OBTAINING A FILE *netrw-O*
848 871
849 When browsing a remote directory, one may obtain a file under the cursor (ie. 872 When browsing a remote directory, one may obtain a file under the cursor (ie.
850 get a copy on your local machine, but not edit it) by pressing the O key. 873 get a copy on your local machine, but not edit it) by pressing the O key.
851 Only ftp and scp are supported for this operation (but since these two are 874 Only ftp and scp are supported for this operation (but since these two are
852 available for browsing, that shouldn't be a problem). 875 available for browsing, that shouldn't be a problem). The status bar
876 will then show, on its right hand side, a message like "Obtaining filename".
877 The statusline will be restored after the transfer is complete.
878
879 Netrw can also "obtain" a file using the local browser. Netrw's display
880 of a directory is not necessarily the same as Vim's "current directory",
881 unless |g:netrw_keepdir| is set to 0 in the user's <.vimrc>. One may select
882 a file using the local browser (by putting the cursor on it) and pressing
883 "O" will then "obtain" the file; ie. copy it to Vim's current directory.
884
885 Related topics:
886 * To see what the current directory is, use |:pwd|
887 * To make the currently browsed directory the current directory, see |netrw-c|
888 * To automatically make the currently browsed directory the current
889 directory, see |g:netrw_keepdir|.
853 890
854 891
855 THIN, LONG, AND WIDE LISTINGS *netrw-i* 892 THIN, LONG, AND WIDE LISTINGS *netrw-i*
856 893
857 The "i" map cycles between the thin, long, and wide listing formats. 894 The "i" map cycles between the thin, long, and wide listing formats.
858 895
859 The short listing format gives just the files' and directories' names. 896 The short listing format gives just the files' and directories' names.
860 897
861 The long listing is either based on the "ls" command via ssh for remote 898 The long listing is either based on the "ls" command via ssh for remote
862 directories or displays the filename, file size (in bytes), and the 899 directories or displays the filename, file size (in bytes), and the time and
863 time and date of last modification for local directories. 900 date of last modification for local directories. With the long listing
864 901 format, netrw is not able to recognize filenames which have trailing spaces.
865 The wide listing format has a multi-column display of the various 902 Use the thin listing format for such files.
866 files in the netrw current directory, rather like the Unix "ls" presents. 903
867 In this mode the "b" and "B" maps are not available; instead, use 904 The wide listing format has a multi-column display of the various files in the
868 Nb (|netrw-Nb|) and NB (|netrw-NB|). 905 netrw current directory, rather like the Unix "ls" presents. In this mode the
906 "b" and "B" maps are not available; instead, use Nb (|netrw-Nb|) and NB
907 (|netrw-NB|). The wide listing format uses two or more contiguous spaces to
908 delineate filenames; when using that format, netrw won't be able to recognize
909 or use filenames which have two or more contiguous spaces embedded in the name
910 or any trailing spaces. The thin listing format will, however, work with such
911 files.
869 912
870 913
871 MAKING A NEW DIRECTORY *netrw-d* 914 MAKING A NEW DIRECTORY *netrw-d*
872 915
873 With the "d" map one may make a new directory either remotely (which 916 With the "d" map one may make a new directory either remotely (which depends
874 depends on the global variable g:netrw_mkdir_cmd) or locally (which depends on 917 on the global variable g:netrw_mkdir_cmd) or locally (which depends on the
875 the global variable g:netrw_local_mkdir). Netrw will issue a request for the 918 global variable g:netrw_local_mkdir). Netrw will issue a request for the new
876 new directory's name. A bare <CR> at that point will abort the making of the 919 directory's name. A bare <CR> at that point will abort the making of the
877 directory. Attempts to make a local directory that already exists (as either 920 directory. Attempts to make a local directory that already exists (as either
878 a file or a directory) will be detected, reported on, and ignored. 921 a file or a directory) will be detected, reported on, and ignored.
879 922
880 923
881 DELETING FILES OR DIRECTORIES *netrw-delete* *netrw-D* 924 DELETING FILES OR DIRECTORIES *netrw-delete* *netrw-D*
882 925
883 Deleting/removing files and directories involves moving the cursor to the 926 Deleting/removing files and directories involves moving the cursor to the
884 file/directory to be deleted and pressing "D". Directories must be empty first 927 file/directory to be deleted and pressing "D". Directories must be empty
885 before they can be successfully removed. If the directory is a softlink to a 928 first before they can be successfully removed. If the directory is a softlink
886 directory, then netrw will make two requests to remove the directory before 929 to a directory, then netrw will make two requests to remove the directory
887 succeeding. Netrw will ask for confirmation before doing the removal(s). 930 before succeeding. Netrw will ask for confirmation before doing the
888 You may select a range of lines with the "V" command (visual selection), 931 removal(s). You may select a range of lines with the "V" command (visual
889 and then pressing "D". 932 selection), and then pressing "D".
890 933
891 The g:netrw_rm_cmd, g:netrw_rmf_cmd, and g:netrw_rmdir_cmd variables are used 934 The g:netrw_rm_cmd, g:netrw_rmf_cmd, and g:netrw_rmdir_cmd variables are used
892 to control the attempts to remove files and directories. The g:netrw_rm_cmd 935 to control the attempts to remove files and directories. The g:netrw_rm_cmd
893 is used with files, and its default value is: 936 is used with files, and its default value is:
894 937
921 the V (|linewise-visual|). 964 the V (|linewise-visual|).
922 965
923 966
924 HIDING FILES OR DIRECTORIES *netrw-a* 967 HIDING FILES OR DIRECTORIES *netrw-a*
925 968
926 Netrw's browsing facility allows one to use the hiding list in one of 969 Netrw's browsing facility allows one to use the hiding list in one of three
927 three ways: ignore it, hide files which match, and show only those files 970 ways: ignore it, hide files which match, and show only those files which
928 which match. The "a" map allows the user to cycle about these three ways. 971 match. The "a" map allows the user to cycle about these three ways.
929 972
930 The g:netrw_list_hide variable holds a comma delimited list of patterns 973 The g:netrw_list_hide variable holds a comma delimited list of patterns (ex.
931 (ex. \.obj) which specify the hiding list. (also see |netrw-h|) To 974 \.obj) which specify the hiding list. (also see |netrw-h|) To set the hiding
932 set the hiding list, use the <c-h> map. As an example, to hide files 975 list, use the <c-h> map. As an example, to hide files which begin with a ".",
933 which begin with a ".", one may use the <c-h> map to set the hiding 976 one may use the <c-h> map to set the hiding list to '^\..*' (or one may put
934 list to '^\..*' (or one may put let g:netrw_list_hide= '^\..*' in 977 let g:netrw_list_hide= '^\..*' in one's <.vimrc>). One may then use the "a"
935 one's <.vimrc>). One may then use the "a" key to show all files, 978 key to show all files, hide matching files, or to show only the matching
936 hide matching files, or to show only the matching files. 979 files.
937 980
938 981
939 EDIT FILE OR DIRECTORY HIDING LIST *netrw-h* *netrw-edithide* 982 EDIT FILE OR DIRECTORY HIDING LIST *netrw-h* *netrw-edithide*
940 983
941 The "<ctrl-h>" map brings up a requestor allowing the user to change the 984 The "<ctrl-h>" map brings up a requestor allowing the user to change the
942 file/directory hiding list. The hiding list consists of one or more patterns 985 file/directory hiding list. The hiding list consists of one or more patterns
943 delimited by commas. Files and/or directories satisfying these patterns will 986 delimited by commas. Files and/or directories satisfying these patterns will
944 either be hidden (ie. not shown) or be the only ones displayed (see |netrw-a|). 987 either be hidden (ie. not shown) or be the only ones displayed (see
988 |netrw-a|).
945 989
946 990
947 BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o* *netrw-horiz* 991 BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o* *netrw-horiz*
948 992
949 Normally one enters a file or directory using the <cr>. However, the "o" map 993 Normally one enters a file or directory using the <cr>. However, the "o" map
950 allows one to open a new window to hold the new directory listing or file. A 994 allows one to open a new window to hold the new directory listing or file. A
951 horizontal split is used. (for vertical splitting, see |netrw-v|) 995 horizontal split is used. (for vertical splitting, see |netrw-v|)
952 996
953 Normally, the o key splits the window horizontally with the new window 997 Normally, the o key splits the window horizontally with the new window and
954 and cursor at the top. To change to splitting the window horizontally 998 cursor at the top. To change to splitting the window horizontally with the
955 with the new window and cursor at the bottom, have 999 new window and cursor at the bottom, have
956 1000
957 let g:netrw_alto = 1 1001 let g:netrw_alto = 1
958 1002
959 in your <.vimrc>. 1003 in your <.vimrc>.
960 1004
961 1005
962 PREVIEW WINDOW *netrw-p* *netrw-preview* 1006 PREVIEW WINDOW *netrw-p* *netrw-preview*
963 1007
964 One may use a preview window (currently only for local browsing) by using 1008 One may use a preview window (currently only for local browsing) by using the
965 the "p" key when the cursor is atop the desired filename to be previewed. 1009 "p" key when the cursor is atop the desired filename to be previewed.
966 1010
967 1011
968 SELECTING SORTING STYLE *netrw-s* *netrw-sort* 1012 SELECTING SORTING STYLE *netrw-s* *netrw-sort*
969 1013
970 One may select the sorting style by name, time, or (file) size. The 1014 One may select the sorting style by name, time, or (file) size. The "s" map
971 "s" map allows one to circulate amongst the three choices; the directory 1015 allows one to circulate amongst the three choices; the directory listing will
972 listing will automatically be refreshed to reflect the selected style. 1016 automatically be refreshed to reflect the selected style.
973 1017
974 1018
975 EDITING THE SORTING SEQUENCE *netrw-S* *netrw-sortsequence* 1019 EDITING THE SORTING SEQUENCE *netrw-S* *netrw-sortsequence*
976 1020
977 When "Sorted by" is name, one may specify priority via the sorting 1021 When "Sorted by" is name, one may specify priority via the sorting sequence
978 sequence (g:netrw_sort_sequence). The sorting sequence typically 1022 (g:netrw_sort_sequence). The sorting sequence typically prioritizes the
979 prioritizes the name-listing by suffix, although any pattern will do. 1023 name-listing by suffix, although any pattern will do. Patterns are delimited
980 Patterns are delimited by commas. The default sorting sequence is: 1024 by commas. The default sorting sequence is:
981 > 1025 >
982 [\/]$,*,\.bak$,\.o$,\.h$,\.info$,\.swp$,\.obj$ 1026 [\/]$,*,\.bak$,\.o$,\.h$,\.info$,\.swp$,\.obj$
983 < 1027 <
984 The lone * is where all filenames not covered by one of the other 1028 The lone * is where all filenames not covered by one of the other patterns
985 patterns will end up. One may change the sorting sequence by modifying 1029 will end up. One may change the sorting sequence by modifying the
986 the g:netrw_sort_sequence variable (either manually or in your <.vimrc>) 1030 g:netrw_sort_sequence variable (either manually or in your <.vimrc>) or by
987 or by using the "S" map. 1031 using the "S" map.
988 1032
989 1033
990 REVERSING SORTING ORDER *netrw-r* *netrw-reverse* 1034 REVERSING SORTING ORDER *netrw-r* *netrw-reverse*
991 1035
992 One may toggle between normal and reverse sorting order by pressing the 1036 One may toggle between normal and reverse sorting order by pressing the
1009 q map to list both the bookmarks and history. (see |netrw-q|) 1053 q map to list both the bookmarks and history. (see |netrw-q|)
1010 1054
1011 1055
1012 BROWSING WITH A VERTICALLY SPLIT WINDOW *netrw-v* 1056 BROWSING WITH A VERTICALLY SPLIT WINDOW *netrw-v*
1013 1057
1014 Normally one enters a file or directory using the <cr>. However, the "v" 1058 Normally one enters a file or directory using the <cr>. However, the "v" map
1015 map allows one to open a new window to hold the new directory listing or 1059 allows one to open a new window to hold the new directory listing or file. A
1016 file. A vertical split is used. (for horizontal splitting, see |netrw-o|) 1060 vertical split is used. (for horizontal splitting, see |netrw-o|)
1017 1061
1018 Normally, the v key splits the window vertically with the new window 1062 Normally, the v key splits the window vertically with the new window and
1019 and cursor at the left. To change to splitting the window vertically 1063 cursor at the left. To change to splitting the window vertically with the new
1020 with the new window and cursor at the right, have 1064 window and cursor at the right, have
1021 1065
1022 let g:netrw_altv = 1 1066 let g:netrw_altv = 1
1023 1067
1024 in your <.vimrc>. 1068 in your <.vimrc>.
1025 1069
1031 handler varies: 1075 handler varies:
1032 1076
1033 * for Windows 32 or 64, the url and FileProtocolHandler dlls are used. 1077 * for Windows 32 or 64, the url and FileProtocolHandler dlls are used.
1034 * for KDE (with kfmclient): kfmclient is used. 1078 * for KDE (with kfmclient): kfmclient is used.
1035 * for Gnome (with gnome-open): gnome-open is used. 1079 * for Gnome (with gnome-open): gnome-open is used.
1036 * otherwise the NetrwFileHandler plugin is used. 1080 * otherwise the netrwFileHandler plugin is used.
1037 1081
1038 The file's suffix is used by these various approaches to determine an 1082 The file's suffix is used by these various approaches to determine an
1039 appropriate application to use to "handle" these files. Such things 1083 appropriate application to use to "handle" these files. Such things as
1040 as OpenOffice (*.sfx), visualization (*.jpg, *.gif, etc), and PostScript 1084 OpenOffice (*.sfx), visualization (*.jpg, *.gif, etc), and PostScript (*.ps,
1041 (*.ps, *.eps) can be handled. 1085 *.eps) can be handled.
1042 1086
1043 The NetrwFileHandler applies a user-defined function to a file, based on its 1087 The netrwFileHandler applies a user-defined function to a file, based on its
1044 extension. Of course, the handler function must exist for it to be called! 1088 extension. Of course, the handler function must exist for it to be called!
1045 > 1089 >
1046 Ex. mypgm.html x -> 1090 Ex. mypgm.html x ->
1047 NetrwFileHandler_html("scp://user@host/some/path/mypgm.html") 1091 netrwFileHandler_html("scp://user@host/some/path/mypgm.html")
1048 < 1092 <
1049 See the <plugin/NetrwFileHandlers.vim> for an example of how to handle an html 1093 See the <plugin/netrwFileHandlers.vim> for an example of how to handle an html
1050 file with mozilla. 1094 file with mozilla.
1051 1095
1052 One may write custom NetrwFileHandlers; please look at the 1096 One may write custom netrwFileHandlers; please look at the
1053 plugin/NetrwFileHandlers.vim script for examples. If its likely to be 1097 plugin/netrwFileHandlers.vim script for examples. If its likely to be
1054 generally useful, please feel free to forward a copy to me for future 1098 generally useful, please feel free to forward a copy to me for future
1055 inclusion in the distribution. 1099 inclusion in the distribution.
1056 1100
1057 1101
1058 MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-c* *netrw-curdir* 1102 MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-c* *netrw-curdir*
1061 directory will not track the browsing directory. However, setting 1105 directory will not track the browsing directory. However, setting
1062 g:netrw_keepdir to 0 (say, in your <.vimrc>) will tell netrw to have the 1106 g:netrw_keepdir to 0 (say, in your <.vimrc>) will tell netrw to have the
1063 currently browsed directory be the current directory. 1107 currently browsed directory be the current directory.
1064 1108
1065 With the default setting for g:netrw_keepdir, in order to make the two 1109 With the default setting for g:netrw_keepdir, in order to make the two
1066 directories the same, use the "c" map (just type c). That map will set 1110 directories the same, use the "c" map (just type c). That map will set the
1067 the current directory to the current browsing directory. 1111 current directory to the current browsing directory.
1068 1112
1069 1113
1070 BOOKMARKING A DIRECTORY *netrw-b* *netrw-bookmark* *netrw-bookmarks* 1114 BOOKMARKING A DIRECTORY *netrw-b* *netrw-bookmark* *netrw-bookmarks*
1071 *netrw-Nb* 1115 *netrw-Nb*
1072 One may easily "bookmark" a directory by using > 1116 One may easily "bookmark" a directory by using >
1085 1129
1086 To change directory back to a bookmarked directory, use 1130 To change directory back to a bookmarked directory, use
1087 1131
1088 {cnt}B 1132 {cnt}B
1089 1133
1090 Any count may be used to reference any of the bookmarks. See |netrw-b| 1134 Any count may be used to reference any of the bookmarks. See |netrw-b| on
1091 for how to bookmark a directory and |netrw-q| for how to list them. 1135 how to bookmark a directory and |netrw-q| on how to list bookmarks.
1092 1136
1093 When wide listing is in use (see |netrw-i|), then the B map is not available; 1137 When wide listing is in use (see |netrw-i|), then the B map is not available;
1094 instead, use {cnt}NB. 1138 instead, use {cnt}NB.
1095 1139
1096 1140
1116 NETRW SETTINGS *netrw-settings* 1160 NETRW SETTINGS *netrw-settings*
1117 1161
1118 With the NetrwSettings.vim plugin, > 1162 With the NetrwSettings.vim plugin, >
1119 :NetrwSettings 1163 :NetrwSettings
1120 will bring up a window with the many variables that netrw uses for its 1164 will bring up a window with the many variables that netrw uses for its
1121 settings. You may change any of their values; when you save the file, 1165 settings. You may change any of their values; when you save the file, the
1122 the settings therein will be used. One may also press "?" on any of 1166 settings therein will be used. One may also press "?" on any of the lines for
1123 the lines for help on what each of the variables do. 1167 help on what each of the variables do.
1124 1168
1125 1169
1126 ============================================================================== 1170 ==============================================================================
1127 8. Problems and Fixes *netrw-problems* 1171 8. Problems and Fixes *netrw-problems*
1128 1172
1238 NdrOchip at ScampbellPfamily.AbizM - NOSPAM 1282 NdrOchip at ScampbellPfamily.AbizM - NOSPAM
1239 1283
1240 ============================================================================== 1284 ==============================================================================
1241 10. History *netrw-history* 1285 10. History *netrw-history*
1242 1286
1287 v75: * file://... now conforms to RFC2396 (thanks to S. Zacchiroli)
1288 * if the binary option is set, then NetWrite() will only write
1289 the whole file (line numbers don't make sense with this).
1290 Supports writing of tar and zip files.
1291 v74: * bugfix (vim, then :Explore) now works
1292 * ctrl-L keeps cursor at same screen location (both local and
1293 remote browsing)
1294 * netrw now can read remote zip and tar files
1295 * Obtain now uses WinXP ftp+.netrc successfully
1296 v73: * bugfix -- scp://host/path/file was getting named incorrectly
1297 * netrw detects use of earlier-than-7.0 version of vim and issues
1298 a pertinent error message.
1299 * netrwSettings.vim is now uses autoloading. Only
1300 <netrwPlugin.vim> is needed as a pure plugin
1301 (ie. always loaded).
1302 v72: * bugfix -- formerly, one could prevent the loading of netrw
1303 by "let g:loaded_netrw=1"; when autoloading became supported,
1304 this feature was lost. It is now restored.
1305 v71: * bugfix -- made some "set nomodifiable"s into setlocal variants
1306 (allows :e somenewfile to be modifiable as usual)
1307 * NetrwSettings calls a netrw function, thereby assuring that
1308 netrw has loaded. However, if netrw does not load for whatever
1309 reason, then NetrwSettings will now issue a warning message.
1310 * For what reason I don't recall, when wget and fetch are both
1311 not present, and an attempt to read a http://... url is made,
1312 netrw exited. It now only returns.
1313 * When ch=1, on the second and subsequent uses of browsing Netrw
1314 would issue a blank line to clear the echo'd messages. This
1315 caused an annoying "Hit-Enter" prompt; now a blank line message
1316 is echo'd only if &ch>1.
1317 v70: * when using |netrw-O|, the "Obtaining filename" message is now
1318 shown using |hl-User9|. If User9 has not been defined, netrw
1319 will define it.
1320 v69: * Bugfix: win95/98 machines were experiencing a
1321 "E121: Undefined variable: g:netrw_win95ftp" message
1322 v68: * double-click-leftmouse selects word under mouse
1243 v67: * Passwords which contain blanks will now be surrounded by 1323 v67: * Passwords which contain blanks will now be surrounded by
1244 double-quotes automatically (Yongwei) 1324 double-quotes automatically (Yongwei)
1245 v66: * Netrw now seems to work with a few more Windows situations 1325 v66: * Netrw now seems to work with a few more Windows situations
1246 * O now obtains a file: remote browsing file -> local copy, 1326 * O now obtains a file: remote browsing file -> local copy,
1247 locally browsing file -> current directory (see :pwd) 1327 locally browsing file -> current directory (see :pwd)
1353 * sorting sequence with the S map now allows confirmation of 1433 * sorting sequence with the S map now allows confirmation of
1354 * deletion with [y(es) n(o) a(ll) q(uit)] the "x" map now handles 1434 * deletion with [y(es) n(o) a(ll) q(uit)] the "x" map now handles
1355 * special file viewing with: 1435 * special file viewing with:
1356 (windows) rundll32 url.dll (gnome) gnome-open (kde) 1436 (windows) rundll32 url.dll (gnome) gnome-open (kde)
1357 kfmclient If none of these are on the executable path, then 1437 kfmclient If none of these are on the executable path, then
1358 NetrwFileHandlers.vim is used. 1438 netrwFileHandlers.vim is used.
1359 * directory bookmarking during both local and remote browsing 1439 * directory bookmarking during both local and remote browsing
1360 implemented 1440 implemented
1361 * one may view all, use the hiding list to suppress, or use the 1441 * one may view all, use the hiding list to suppress, or use the
1362 hiding list to show-only remote and local file/directory 1442 hiding list to show-only remote and local file/directory
1363 listings 1443 listings