0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

updated for version 7.0122

This commit is contained in:
Bram Moolenaar 2005-08-01 21:58:57 +00:00
parent d314b2519b
commit 83bab71b3c
8 changed files with 484 additions and 312 deletions

View File

@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.0aa. Last change: 2005 Jul 30 *eval.txt* For Vim version 7.0aa. Last change: 2005 Aug 01
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -3460,7 +3460,7 @@ printf({fmt}, {expr1} ...) *printf()*
automatically to fit the conversion specifier. Any other automatically to fit the conversion specifier. Any other
argument type results in an error message. argument type results in an error message.
*E766* *767* *E766* *E767*
The number of {exprN} arguments must exactly match the number The number of {exprN} arguments must exactly match the number
of "%" items. If there are not sufficient or too many of "%" items. If there are not sufficient or too many
arguments an error is given. Up to 18 arguments can be used. arguments an error is given. Up to 18 arguments can be used.

View File

@ -1,4 +1,4 @@
*insert.txt* For Vim version 7.0aa. Last change: 2005 Jul 29 *insert.txt* For Vim version 7.0aa. Last change: 2005 Aug 01
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -614,12 +614,12 @@ Completing whole lines *compl-whole-line*
*i_CTRL-X_CTRL-L* *i_CTRL-X_CTRL-L*
CTRL-X CTRL-L Search backwards for a line that starts with the CTRL-X CTRL-L Search backwards for a line that starts with the
same characters as in the current line before the same characters as those in the current line before
cursor. Indent is ignored. The found line is the cursor. Indent is ignored. The matching line is
inserted in front of the cursor. inserted in front of the cursor.
The 'complete' option is used to decide in which The 'complete' option is used to decide which buffers
buffers a match is searched for. But only loaded are searched for a match. Only loaded buffers are
buffers are used. used.
CTRL-L or CTRL-L or
CTRL-P Search backwards for next matching line. This line CTRL-P Search backwards for next matching line. This line
replaces the previous matching line. replaces the previous matching line.

View File

@ -1,4 +1,4 @@
*options.txt* For Vim version 7.0aa. Last change: 2005 Jul 30 *options.txt* For Vim version 7.0aa. Last change: 2005 Aug 01
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@ -2176,10 +2176,10 @@ A jump table for the options with a short description can be found at |Q_op|.
- A directory starting with "./" (or ".\" for MS-DOS et al.) means to - A directory starting with "./" (or ".\" for MS-DOS et al.) means to
put the swap file relative to where the edited file is. The leading put the swap file relative to where the edited file is. The leading
"." is replaced with the path name of the edited file. "." is replaced with the path name of the edited file.
- For Unix and Win32, if a directory ends in two path separators, the - For Unix and Win32, if a directory ends in two path separators "//"
swap file name will be built from the complete path to the file or "\\", the swap file name will be built from the complete path to
with all path separators substituted to percent '%' signs. This will the file with all path separators substituted to percent '%' signs.
ensure file name uniqueness in the preserve directory. This will ensure file name uniqueness in the preserve directory.
- Spaces after the comma are ignored, other spaces are considered part - Spaces after the comma are ignored, other spaces are considered part
of the directory name. To have a space at the start of a directory of the directory name. To have a space at the start of a directory
name, precede it with a backslash. name, precede it with a backslash.

View File

@ -1,4 +1,4 @@
*pi_netrw.txt* For Vim version 6.3. Last change: Oct 08, 2004 *pi_netrw.txt* For Vim version 6.3. Last change: Jul 09, 2005
VIM REFERENCE MANUAL by Charles E. Campbell, Jr. VIM REFERENCE MANUAL by Charles E. Campbell, Jr.
@ -10,17 +10,48 @@
============================================================================== ==============================================================================
0. Contents *netrw-contents* 0. Contents *netrw-contents*
1. Netrw Reference.....................................|netrw-ref| 1. Netrw Reference......................................|netrw-ref|
2. Network-Oriented File Transfer......................|netrw-xfer| 2. Network-Oriented File Transfer.......................|netrw-xfer|
3. Activation..........................................|netrw-activate| NETRC..............................................|netrw-netrc|
4. Transparent File Transfer...........................|netrw-transparent| PASSWORD...........................................|netrw-passwd|
5. Ex Commands.........................................|netrw-ex| 3. Activation...........................................|netrw-activate|
6. Variables and Options...............................|netrw-var| 4. Transparent File Transfer............................|netrw-transparent|
7. Directory Browser...................................|netrw-browse| 5. Ex Commands..........................................|netrw-ex|
8. Problems and Fixes..................................|netrw-problems| 6. Variables and Options................................|netrw-var|
9. Debugging...........................................|netrw-debug| 7. Directory Browser....................................|netrw-browse| {{{1
10. History.............................................|netrw-history| Maps...............................................|netrw-maps|
11. Credits.............................................|netrw-credits| Exploring..........................................|netrw-explore-cmds|
Quick Reference Commands Table.....................|netrw-browse-cmds|
Netrw Browser Variables............................|netrw-browse-var|
Introduction To Directory Browsing.................|netrw-browse-intro|
Directory Exploring Commands.......................|netrw-explore|
Refreshing The Listing.............................|netrw-ctrl-l|
Going Up...........................................|netrw--|
Browsing...........................................|netrw-cr|
Long Vs Short Listing..............................|netrw-i|
Making A New Directory.............................|netrw-d|
Deleting Files Or Directories......................|netrw-delete|
Renaming Files Or Directories......................|netrw-move|
Hiding Files Or Directories........................|g:netrw-a|
Edit File Or Directory Hiding List.................|netrw-h|
Browsing With A Horizontally Split Window..........|netrw-o|
Preview Window.....................................|netrw-p|
Selecting Sorting Style............................|netrw-s|
Editing The Sorting Sequence.......................|netrw-S|
Reversing Sorting Order............................|netrw-r|
Changing To A Predecessor Directory................|netrw-u|
Changing To A Successor Directory..................|netrw-U|
Browsing With A Vertically Split Window............|netrw-v|
Customizing Browsing With A User Function..........|netrw-x|
Making The Browsing Directory The Current Directory|netrw-c|
Bookmarking A Directory............................|netrw-b|
Changing To A Bookmarked Directory.................|netrw-B|
Listing Bookmarks And History......................|netrw-q|
Improving Directory Browsing.......................|netrw-list-hack| }}}1
8. Problems and Fixes...................................|netrw-problems|
9. Debugging............................................|netrw-debug|
10. History..............................................|netrw-history|
11. Credits..............................................|netrw-credits|
The functionality mentioned here is done via using |standard-plugin| The functionality mentioned here is done via using |standard-plugin|
techniques. This plugin is only available if techniques. This plugin is only available if
@ -177,16 +208,16 @@ by setting a variable (ex. scp uses the variable g:netrw_scp_cmd,
which is defaulted to "scp -q"). which is defaulted to "scp -q").
Ftp, an old protocol, seems to be blessed by numerous implementations. Ftp, an old protocol, seems to be blessed by numerous implementations.
Unfortunately, some implementations are noisy (i.e., add junk to the end Unfortunately, some implementations are noisy (ie., add junk to the end
of the file). Thus, concerned users may decide to write a NetReadFixup() of the file). Thus, concerned users may decide to write a NetReadFixup()
function that will clean up after reading with their ftp. Some Unix systems function that will clean up after reading with their ftp. Some Unix systems
(i.e., FreeBSD) provide a utility called "fetch" which uses the ftp protocol (ie., FreeBSD) provide a utility called "fetch" which uses the ftp protocol
but is not noisy and more convenient, actually, for <netrw.vim> to use. but is not noisy and more convenient, actually, for <netrw.vim> to use.
Consequently, if "fetch" is executable, it will be used to do reads for Consequently, if "fetch" is executable, it will be used to do reads for
ftp://... (and http://...) . See |netrw-var| for more about this. ftp://... (and http://...) . See |netrw-var| for more about this.
For rcp, scp, sftp, and http, one may use network-oriented file transfers For rcp, scp, sftp, and http, one may use network-oriented file transfers
transparently; i.e. transparently; ie.
> >
vim rcp://[user@]machine/path vim rcp://[user@]machine/path
vim scp://[user@]machine/path vim scp://[user@]machine/path
@ -198,7 +229,7 @@ that file. Your ftp must be able to use the <.netrc> file on its own, however.
vim ftp://[user@]machine[[:#]portnumber]/path vim ftp://[user@]machine[[:#]portnumber]/path
< <
However, ftp will often need to query the user for the userid and password. However, ftp will often need to query the user for the userid and password.
The latter will be done "silently"; i.e. asterisks will show up instead of The latter will be done "silently"; ie. asterisks will show up instead of
the actually-typed-in password. Netrw will retain the userid and password the actually-typed-in password. Netrw will retain the userid and password
for subsequent read/writes from the most recent transfer so subsequent for subsequent read/writes from the most recent transfer so subsequent
transfers (read/write) to or from that machine will take place without transfers (read/write) to or from that machine will take place without
@ -482,7 +513,7 @@ To handle the SSL certificate dialog for untrusted servers, one may pull
down the certificate and place it into /usr/ssl/cert.pem. This operation down the certificate and place it into /usr/ssl/cert.pem. This operation
renders the server treatment as "trusted". renders the server treatment as "trusted".
*netrw-fixup* *netrw-fixup* *netreadfixup*
If your ftp for whatever reason generates unwanted lines (such as AUTH If your ftp for whatever reason generates unwanted lines (such as AUTH
messages) you may write a NetReadFixup(tmpfile) function: messages) you may write a NetReadFixup(tmpfile) function:
> >
@ -521,30 +552,38 @@ from <netrw.vim> itself:
============================================================================== ==============================================================================
7. Directory Browser *netrw-browse* *netrw-dir* *netrw-list* *netrw-help* 7. Directory Browser *netrw-browse* *netrw-dir* *netrw-list* *netrw-help*
?..........Help....................................|netrw-help|
<cr>.......Browsing................................|netrw-cr| MAPS *netrw-maps*
<del>......Deleting Files or Directories...........|netrw-delete| ?................Help.......................................|netrw-help|
-..........Going Up................................|netrw--| <cr>.............Browsing...................................|netrw-cr|
a..........Hiding Files or Directories.............|netrw-a| <del>............Deleting Files or Directories..............|netrw-delete|
b..........Bookmarking a Directory.................|netrw-b| -................Going Up...................................|netrw--|
B..........Changing to a Bookmarked Directory......|netrw-B| a................Hiding Files or Directories................|netrw-a|
c..........Make Browsing Directory The Current Dir.|netrw-c| b................Bookmarking a Directory....................|netrw-b|
d..........Make A New Directory....................|netrw-d| B................Changing to a Bookmarked Directory.........|netrw-B|
D..........Deleting Files or Directories...........|netrw-D| c................Make Browsing Directory The Current Dir....|netrw-c|
<c-h>......Edit File/Directory Hiding List.........|netrw-h| d................Make A New Directory.......................|netrw-d|
i..........Long Listing............................|netrw-i| D................Deleting Files or Directories..............|netrw-D|
<c-l>......Refreshing the Listing..................|netrw-ctrl-l| <c-h>............Edit File/Directory Hiding List............|netrw-h|
o..........Browsing with a Horizontal Split........|netrw-o| i................Long Listing...............................|netrw-i|
p..........Preview Window..........................|netrw-p| <c-l>............Refreshing the Listing.....................|netrw-ctrl-l|
q..........Listing Bookmarks and History...........|netrw-q| o................Browsing with a Horizontal Split...........|netrw-o|
r..........Reversing Sorting Order.................|netrw-r| p................Preview Window.............................|netrw-p|
R..........Renaming Files or Directories...........|netrw-R| q................Listing Bookmarks and History..............|netrw-q|
s..........Selecting Sorting Style.................|netrw-s| r................Reversing Sorting Order....................|netrw-r|
S..........Editing the Sorting Sequence............|netrw-S| R................Renaming Files or Directories..............|netrw-R|
u..........Changing to a Predecessor Directory.....|netrw-u| s................Selecting Sorting Style....................|netrw-s|
U..........Changing to a Successor Directory.......|netrw-U| S................Editing the Sorting Sequence...............|netrw-S|
v..........Browsing with a Vertical Split..........|netrw-v| u................Changing to a Predecessor Directory........|netrw-u|
x..........Customizing Browsing....................|netrw-x| U................Changing to a Successor Directory..........|netrw-U|
v................Browsing with a Vertical Split.............|netrw-v|
x................Customizing Browsing.......................|netrw-x|
COMMANDS *netrw-explore-cmds*
:Explore[!] [dir].Explore directory of current file........|netrw-explore|
:Sexplore[!] [dir].Split & Explore directory of current file|netrw-explore|
:Hexplore[!] [dir].Horizontal Split & Explore...............|netrw-explore|
:Vexplore[!] [dir].Vertical Split & Explore.................|netrw-explore|
QUICK REFERENCE COMMANDS TABLE *netrw-browse-cmds* QUICK REFERENCE COMMANDS TABLE *netrw-browse-cmds*
> >
@ -581,51 +620,103 @@ NETRW BROWSER VARIABLES *netrw-browse-var*
< g:netrw_alto change from above splitting to < g:netrw_alto change from above splitting to
below splitting by setting this below splitting by setting this
variable (see |netrw-o|) variable (see |netrw-o|)
default: =0
g:netrw_altv change from left splitting to g:netrw_altv change from left splitting to
right splitting by setting this right splitting by setting this
variable (see |netrw-v|) variable (see |netrw-v|)
default: =0
g:netrw_ftp_browse_reject ftp can produce a number of errors g:netrw_ftp_browse_reject ftp can produce a number of errors
and warnings that can show up as and warnings that can show up as
"directories" and "files" in the "directories" and "files" in the
listing. This pattern is used to listing. This pattern is used to
remove such embedded messages. remove such embedded messages. By
default its value is:
'^total\s\+\d\+$\|
^Trying\s\+\d\+.*$\|
^KERBEROS_V\d rejected\|
^Security extensions not\|
No such file\|
: connect to address [0-9a-fA-F:]*
: No route to host$'
g:netrw_ssh_browse_reject ssh can sometimes produce unwanted
lines/messages/banners/and whatnot
that one doesn't want masquerading
as "directories" and "files". Use
this pattern to remove such embedded
messages. By default its value is:
'^total\s\+\d\+$'
g:netrw_keepdir =1 (default) keep current directory g:netrw_keepdir =1 (default) keep current directory
immune from the browsing directory. immune from the browsing directory.
=0 keep the current directory the =0 keep the current directory the
same as the browsing directory. same as the browsing directory.
The browsing directory is contained in The browsing directory is contained in
b:netrw_curdir b:netrw_curdir
g:netrw_list_cmd command for listing remote directories g:netrw_list_cmd command for listing remote directories
default: (if ssh is executable)
"ssh HOSTNAME ls -FLa"
g:netrw_longlist if =1, then long listing will be default g:netrw_longlist if =1, then long listing will be default
g:netrw_ftp_list_cmd options for passing along to ftp for g:netrw_ftp_list_cmd options for passing along to ftp for
directory listing. Defaults: directory listing. Defaults:
unix or g:netrw_cygwin set: : "ls -lF" unix or g:netrw_cygwin set: : "ls -lF"
otherwise "dir" otherwise "dir"
g:netrw_list_hide comma separated list of patterns for g:netrw_list_hide comma separated list of patterns for
hiding files hiding files
default: ""
g:netrw_local_mkdir command for making a local directory g:netrw_local_mkdir command for making a local directory
default: "ssh HOSTNAME mkdir"
g:netrw_local_rmdir remove directory command (rmdir) g:netrw_local_rmdir remove directory command (rmdir)
g:netrw_local_rename rename file/directory command default: "rmdir"
unix-default: rm win32-default: ren
g:netrw_maxfilenamelen =32 by default, selected so as to make g:netrw_maxfilenamelen =32 by default, selected so as to make
long listings fit on 80 column displays. long listings fit on 80 column displays.
If your screen is wider, and you have If your screen is wider, and you have
file/directory names longer than 32 bytes, file/directory names longer than 32 bytes,
you may set this option to keep listings you may set this option to keep listings
columnar. columnar.
g:netrw_mkdir_cmd command for making a remote directory g:netrw_mkdir_cmd command for making a remote directory
default: "ssh HOSTNAME mkdir"
g:netrw_rm_cmd command for removing files g:netrw_rm_cmd command for removing files
default: "ssh HOSTNAME rm"
g:netrw_rmdir_cmd command for removing directories g:netrw_rmdir_cmd command for removing directories
default: "ssh HOSTNAME rmdir"
g:netrw_rmf_cmd command for removing softlinks g:netrw_rmf_cmd command for removing softlinks
default: "ssh HOSTNAME rm -f"
g:netrw_hide if true, the hiding list is used g:netrw_hide if true, the hiding list is used
default: =0
g:netrw_sort_by sort by "name", "time", or "size" g:netrw_sort_by sort by "name", "time", or "size"
default: "name"
g:netrw_sort_direction sorting direction: "normal" or "reverse" g:netrw_sort_direction sorting direction: "normal" or "reverse"
default: "normal"
g:netrw_sort_sequence when sorting by name, first sort by the g:netrw_sort_sequence when sorting by name, first sort by the
comma-separated pattern sequence comma-separated pattern sequence
g:netrw_timefmt specify format string to strftime() (%c) default: '[\/]$,*,\.bak$,\.o$,\.h$,
g:netrw_winsize specify initial size of new o/v windows \.info$,\.swp$,\.obj$'
INTRODUCTION TO DIRECTORY BROWSING *file-explorer* g:netrw_timefmt specify format string to strftime() (%c)
default: "%c"
g:netrw_winsize specify initial size of new o/v windows
default: ""
INTRODUCTION TO DIRECTORY BROWSING *netrw-browse-intro*
Netrw supports the browsing of directories on the local system and on remote Netrw supports the browsing of directories on the local system and on remote
hosts, including generating listing directories, entering directories, editing hosts, including generating listing directories, entering directories, editing
@ -647,6 +738,31 @@ trailing slash and it will be interpreted as a request to list a directory:
If you'd like to avoid entering the password in for directory listings, scp, If you'd like to avoid entering the password in for directory listings, scp,
ssh interaction, etc, see |netrw-list-hack|. ssh interaction, etc, see |netrw-list-hack|.
DIRECTORY EXPLORING COMMANDS *netrw-explore*
:Explore[!] [dir].Explore directory of current file
:Sexplore[!] [dir].Split & Explore directory of current file
:Hexplore[!] [dir].Horizontal Split & Explore
:Vexplore[!] [dir].Vertical Split & Explore
The Explore command will open the local-directory browser on the current
file's directory (or on directory [dir] if specified). The window
will be split only if the file has been modified, otherwise the
browsing window will take over that window. Normally the splitting is
taken horizontally; the optional ! will use vertical splitting.
Sexplore will always split the window before invoking the local-directory
browser. As with Explore, the splitting is normally done horizontally,
but with the optional ! the splitting will be done vertically.
Hexplore does an Explore with |belowright| horizontal splitting; the
optional ! does the Explore with |aboveleft| horizontal splitting.
Vexplore does an Explore with |leftabove| vertical splitting; the optiona
! does an Explore with |topleft| vertical splitting.
REFRESHING THE LISTING *netrw-ctrl-l* REFRESHING THE LISTING *netrw-ctrl-l*
To refresh either a local or remote directory listing, press ctrl-l (<c-l>) or To refresh either a local or remote directory listing, press ctrl-l (<c-l>) or
@ -677,6 +793,7 @@ Hitting the <cr> (the return key) will select the file or directory.
Directories will themselves be listed, and files will be opened using the Directories will themselves be listed, and files will be opened using the
protocol given in the original read request. protocol given in the original read request.
LONG VS SHORT LISTING *netrw-i* LONG VS SHORT LISTING *netrw-i*
The short listing format gives just the files' and directories' names. The short listing format gives just the files' and directories' names.
@ -694,6 +811,7 @@ new directory's name. A bare <CR> at that point will abort the making of the
directory. Attempts to make a local directory that already exists (as either directory. Attempts to make a local directory that already exists (as either
a file or a directory) will be detected, reported on, and ignored. a file or a directory) will be detected, reported on, and ignored.
DELETING FILES OR DIRECTORIES *netrw-delete* *netrw-D* DELETING FILES OR DIRECTORIES *netrw-delete* *netrw-D*
Deleting/removing files and directories involves moving the cursor to the Deleting/removing files and directories involves moving the cursor to the
@ -740,15 +858,22 @@ One may rename a block of files and directories by selecting them with
the V (|linewise-visual|). the V (|linewise-visual|).
HIDING FILES OR DIRECTORIES *netrw-a* *g:netrw_list_hide* HIDING FILES OR DIRECTORIES *g:netrw-a* *g:netrw_list_hide*
Netrw's browsing facility allows one to use the hiding list in one of Netrw's browsing facility allows one to use the hiding list in one of
three ways: ignore it, hide files which match, and show only those files three ways: ignore it, hide files which match, and show only those files
which match. The g:netrw_list_hide variable holds a comma delimited list which match. The "a" map allows the user to cycle about these three ways.
of patterns (ex. \.obj) which specify the hiding list. (also see |netrw-h|)
The g:netrw_list_hide variable holds a comma delimited list of patterns
(ex. \.obj) which specify the hiding list. (also see |netrw-h|) To
set the hiding list, use the <c-h> map. As an example, to hide files
which begin with a ".", one may use the <c-h> map to set the hiding
list to '^\..*' (or one may put let g:netrw_list_hide= '^\..*' in
one's <.vimrc>). One may then use the "a" key to show all files,
hide matching files, or to show only the matching files.
EDIT FILE OR DIRECTORY HIDING LIST *netrw-h* EDIT FILE OR DIRECTORY HIDING LIST *netrw-h* *netrw-edithide*
The "<ctrl-h>" map brings up a requestor allowing the user to change the The "<ctrl-h>" map brings up a requestor allowing the user to change the
file/directory hiding list. The hiding list consists of one or more patterns file/directory hiding list. The hiding list consists of one or more patterns
@ -756,7 +881,7 @@ delimited by commas. Files and/or directories satisfying these patterns will
either be hidden (ie. not shown) or be the only ones displayed (see |netrw-a|). either be hidden (ie. not shown) or be the only ones displayed (see |netrw-a|).
BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o* BROWSING WITH A HORIZONTALLY SPLIT WINDOW *netrw-o* *netrw-horiz*
Normally one enters a file or directory using the <cr>. However, the "o" map Normally one enters a file or directory using the <cr>. However, the "o" map
allows one to open a new window to hold the new directory listing or file. A allows one to open a new window to hold the new directory listing or file. A
@ -770,20 +895,21 @@ with the new window and cursor at the bottom, have
in your <.vimrc>. in your <.vimrc>.
PREVIEW WINDOW
PREVIEW WINDOW *netrw-p* *netrw-preview*
One may use a preview window (currently only for local browsing) by using One may use a preview window (currently only for local browsing) by using
the "p" key when the cursor is atop the desired filename to be previewed. the "p" key when the cursor is atop the desired filename to be previewed.
SELECTING SORTING STYLE *netrw-s* SELECTING SORTING STYLE *netrw-s* *netrw-sort*
One may select the sorting style by name, time, or (file) size. The One may select the sorting style by name, time, or (file) size. The
"s" map allows one to circulate among the three choices; the directory "s" map allows one to circulate among the three choices; the directory
listing will automatically be refreshed to reflect the selected style. listing will automatically be refreshed to reflect the selected style.
EDITING THE SORTING SEQUENCE *netrw-S* EDITING THE SORTING SEQUENCE *netrw-S* *netrw-sortsequence*
When "Sorted by" is name, one may specify priority via the sorting When "Sorted by" is name, one may specify priority via the sorting
sequence (g:netrw_sort_sequence). The sorting sequence typically sequence (g:netrw_sort_sequence). The sorting sequence typically
@ -798,13 +924,13 @@ the g:netrw_sort_sequence variable (either manually or in your <.vimrc>)
or by using the "S" map. or by using the "S" map.
REVERSING SORTING ORDER *netrw-r* REVERSING SORTING ORDER *netrw-r* *netrw-reverse*
One may toggle between normal and reverse sorting order by pressing the One may toggle between normal and reverse sorting order by pressing the
"r" key. "r" key.
CHANGING TO A PREDECESSOR DIRECTORY *netrw-u* CHANGING TO A PREDECESSOR DIRECTORY *netrw-u* *netrw-updir*
Every time you change to a new directory (new for the current session), Every time you change to a new directory (new for the current session),
netrw will save the directory in a recently-visited directory history netrw will save the directory in a recently-visited directory history
@ -813,7 +939,7 @@ list (unless g:netrw_dirhistmax is zero; by default, its ten). With the
the opposite, see |netrw-U|. the opposite, see |netrw-U|.
CHANGING TO A SUCCESSOR DIRECTORY *netrw-U* CHANGING TO A SUCCESSOR DIRECTORY *netrw-U* *netrw-downdir*
With the "U" map, one can change to a later directory (successor). With the "U" map, one can change to a later directory (successor).
This map is the opposite of the "u" map. (see |netrw-u|) Use the This map is the opposite of the "u" map. (see |netrw-u|) Use the
@ -835,7 +961,7 @@ with the new window and cursor at the right, have
in your <.vimrc>. in your <.vimrc>.
CUSTOMIZING BROWSING WITH A USER FUNCTION *netrw-x* CUSTOMIZING BROWSING WITH A USER FUNCTION *netrw-x* *netrw-handler*
One may "enter" a file with a special handler, thereby firing up a browser or One may "enter" a file with a special handler, thereby firing up a browser or
other application, for example, on a file by hitting the "x" key. Presumably other application, for example, on a file by hitting the "x" key. Presumably
@ -886,13 +1012,13 @@ Any count may be used to reference any of the bookmarks. See |netrw-b|
for how to bookmark a directory and |netrw-q| for how to list them. for how to bookmark a directory and |netrw-q| for how to list them.
LISTING BOOKMARKS AND HISTORY *netrw-q* LISTING BOOKMARKS AND HISTORY *netrw-q* *netrw-listbookmark*
Pressing "q" will list the bookmarked directories and directory traversal Pressing "q" will list the bookmarked directories and directory traversal
history (query). (see |netrw-b|, |netrw-B|, |netrw-u|, and |netrw-U|) history (query). (see |netrw-b|, |netrw-B|, |netrw-u|, and |netrw-U|)
IMPROVING DIRECTORY BROWSING *netrw-list-hack* IMPROVING DIRECTORY BROWSING *netrw-listhack*
Especially with the remote directory browser, constantly entering the password Especially with the remote directory browser, constantly entering the password
is tedious. is tedious.
@ -1017,6 +1143,23 @@ which is loaded automatically at startup (assuming :set nocp).
============================================================================== ==============================================================================
10. History *netrw-history* 10. History *netrw-history*
v56: * LocalBrowse now saves autochdir setting, unsets it, and
restores it before returning.
* using vim's rename() instead of system + local_rename variable
v55: * -bar used with :Explore :Sexplore etc to allow multiple
commands to be separated by |s
* browser listings now use the "nowrap" option
* browser: some unuseful error messages now suppressed
v54: * For backwards compatibility, Explore and Sexplore have been
implemented. In addition, Hexplore and Vexplore commands
are available, too.
* <amatch> used instead of <afile> in the transparency
support (BufReadCmd, FileReadCmd, FileWriteCmd)
* ***netrw*** prepended to various error messages netrw may emit
* g:netrw_port used instead of b:netrw_port for scp
* any leading [:#] is removed from port numbers
v53: * backslashes as well as slashes placed in various patterns
(ex. g:netrw_sort_sequence) to better support Windows
v52: * nonumber'ing now set for browsing buffers v52: * nonumber'ing now set for browsing buffers
* when the hiding list hid all files, error messages ensued. Fixed * when the hiding list hid all files, error messages ensued. Fixed
* when browsing, swf is set, but directory is not set, when netrw * when browsing, swf is set, but directory is not set, when netrw
@ -1120,4 +1263,4 @@ which is loaded automatically at startup (assuming :set nocp).
Doug Claar -- modifications to test for success with ftp operation Doug Claar -- modifications to test for success with ftp operation
============================================================================== ==============================================================================
vim:tw=78:ts=8:ft=help:norl: vim:tw=78:ts=8:ft=help:norl:fdm=marker

View File

@ -4864,7 +4864,6 @@ fcs_reason-variable eval.txt /*fcs_reason-variable*
feature-list eval.txt /*feature-list* feature-list eval.txt /*feature-list*
fetch pi_netrw.txt /*fetch* fetch pi_netrw.txt /*fetch*
file-browser-5.2 version5.txt /*file-browser-5.2* file-browser-5.2 version5.txt /*file-browser-5.2*
file-explorer pi_netrw.txt /*file-explorer*
file-formats editing.txt /*file-formats* file-formats editing.txt /*file-formats*
file-pattern autocmd.txt /*file-pattern* file-pattern autocmd.txt /*file-pattern*
file-read insert.txt /*file-read* file-read insert.txt /*file-read*
@ -4980,6 +4979,7 @@ g'a motion.txt /*g'a*
g, motion.txt /*g,* g, motion.txt /*g,*
g0 motion.txt /*g0* g0 motion.txt /*g0*
g8 various.txt /*g8* g8 various.txt /*g8*
g:netrw-a pi_netrw.txt /*g:netrw-a*
g:netrw_list_cmd pi_netrw.txt /*g:netrw_list_cmd* g:netrw_list_cmd pi_netrw.txt /*g:netrw_list_cmd*
g:netrw_list_hide pi_netrw.txt /*g:netrw_list_hide* g:netrw_list_hide pi_netrw.txt /*g:netrw_list_hide*
g:netrw_rm_cmd pi_netrw.txt /*g:netrw_rm_cmd* g:netrw_rm_cmd pi_netrw.txt /*g:netrw_rm_cmd*
@ -5162,7 +5162,6 @@ hebrew hebrew.txt /*hebrew*
hebrew.txt hebrew.txt /*hebrew.txt* hebrew.txt hebrew.txt /*hebrew.txt*
help various.txt /*help* help various.txt /*help*
help-context help.txt /*help-context* help-context help.txt /*help-context*
help-tags tags 1
help-translated various.txt /*help-translated* help-translated various.txt /*help-translated*
help-xterm-window various.txt /*help-xterm-window* help-xterm-window various.txt /*help-xterm-window*
help.txt help.txt /*help.txt* help.txt help.txt /*help.txt*
@ -5723,6 +5722,7 @@ netbeans-run netbeans.txt /*netbeans-run*
netbeans-setup netbeans.txt /*netbeans-setup* netbeans-setup netbeans.txt /*netbeans-setup*
netbeans-support netbeans.txt /*netbeans-support* netbeans-support netbeans.txt /*netbeans-support*
netbeans.txt netbeans.txt /*netbeans.txt* netbeans.txt netbeans.txt /*netbeans.txt*
netreadfixup pi_netrw.txt /*netreadfixup*
netrw pi_netrw.txt /*netrw* netrw pi_netrw.txt /*netrw*
netrw-- pi_netrw.txt /*netrw--* netrw-- pi_netrw.txt /*netrw--*
netrw-B pi_netrw.txt /*netrw-B* netrw-B pi_netrw.txt /*netrw-B*
@ -5730,13 +5730,13 @@ netrw-D pi_netrw.txt /*netrw-D*
netrw-R pi_netrw.txt /*netrw-R* netrw-R pi_netrw.txt /*netrw-R*
netrw-S pi_netrw.txt /*netrw-S* netrw-S pi_netrw.txt /*netrw-S*
netrw-U pi_netrw.txt /*netrw-U* netrw-U pi_netrw.txt /*netrw-U*
netrw-a pi_netrw.txt /*netrw-a*
netrw-activate pi_netrw.txt /*netrw-activate* netrw-activate pi_netrw.txt /*netrw-activate*
netrw-b pi_netrw.txt /*netrw-b* netrw-b pi_netrw.txt /*netrw-b*
netrw-bookmark pi_netrw.txt /*netrw-bookmark* netrw-bookmark pi_netrw.txt /*netrw-bookmark*
netrw-bookmarks pi_netrw.txt /*netrw-bookmarks* netrw-bookmarks pi_netrw.txt /*netrw-bookmarks*
netrw-browse pi_netrw.txt /*netrw-browse* netrw-browse pi_netrw.txt /*netrw-browse*
netrw-browse-cmds pi_netrw.txt /*netrw-browse-cmds* netrw-browse-cmds pi_netrw.txt /*netrw-browse-cmds*
netrw-browse-intro pi_netrw.txt /*netrw-browse-intro*
netrw-browse-var pi_netrw.txt /*netrw-browse-var* netrw-browse-var pi_netrw.txt /*netrw-browse-var*
netrw-c pi_netrw.txt /*netrw-c* netrw-c pi_netrw.txt /*netrw-c*
netrw-cadaver pi_netrw.txt /*netrw-cadaver* netrw-cadaver pi_netrw.txt /*netrw-cadaver*
@ -5749,24 +5749,34 @@ netrw-d pi_netrw.txt /*netrw-d*
netrw-debug pi_netrw.txt /*netrw-debug* netrw-debug pi_netrw.txt /*netrw-debug*
netrw-delete pi_netrw.txt /*netrw-delete* netrw-delete pi_netrw.txt /*netrw-delete*
netrw-dir pi_netrw.txt /*netrw-dir* netrw-dir pi_netrw.txt /*netrw-dir*
netrw-downdir pi_netrw.txt /*netrw-downdir*
netrw-edithide pi_netrw.txt /*netrw-edithide*
netrw-ex pi_netrw.txt /*netrw-ex* netrw-ex pi_netrw.txt /*netrw-ex*
netrw-explore pi_netrw.txt /*netrw-explore*
netrw-explore-cmds pi_netrw.txt /*netrw-explore-cmds*
netrw-file pi_netrw.txt /*netrw-file* netrw-file pi_netrw.txt /*netrw-file*
netrw-fixup pi_netrw.txt /*netrw-fixup* netrw-fixup pi_netrw.txt /*netrw-fixup*
netrw-ftp pi_netrw.txt /*netrw-ftp* netrw-ftp pi_netrw.txt /*netrw-ftp*
netrw-h pi_netrw.txt /*netrw-h* netrw-h pi_netrw.txt /*netrw-h*
netrw-handler pi_netrw.txt /*netrw-handler*
netrw-help pi_netrw.txt /*netrw-help* netrw-help pi_netrw.txt /*netrw-help*
netrw-history pi_netrw.txt /*netrw-history* netrw-history pi_netrw.txt /*netrw-history*
netrw-horiz pi_netrw.txt /*netrw-horiz*
netrw-i pi_netrw.txt /*netrw-i* netrw-i pi_netrw.txt /*netrw-i*
netrw-list pi_netrw.txt /*netrw-list* netrw-list pi_netrw.txt /*netrw-list*
netrw-list-hack pi_netrw.txt /*netrw-list-hack* netrw-listbookmark pi_netrw.txt /*netrw-listbookmark*
netrw-listhack pi_netrw.txt /*netrw-listhack*
netrw-maps pi_netrw.txt /*netrw-maps*
netrw-move pi_netrw.txt /*netrw-move* netrw-move pi_netrw.txt /*netrw-move*
netrw-netrc pi_netrw.txt /*netrw-netrc* netrw-netrc pi_netrw.txt /*netrw-netrc*
netrw-nread pi_netrw.txt /*netrw-nread* netrw-nread pi_netrw.txt /*netrw-nread*
netrw-nwrite pi_netrw.txt /*netrw-nwrite* netrw-nwrite pi_netrw.txt /*netrw-nwrite*
netrw-o pi_netrw.txt /*netrw-o* netrw-o pi_netrw.txt /*netrw-o*
netrw-options pi_netrw.txt /*netrw-options* netrw-options pi_netrw.txt /*netrw-options*
netrw-p pi_netrw.txt /*netrw-p*
netrw-passwd pi_netrw.txt /*netrw-passwd* netrw-passwd pi_netrw.txt /*netrw-passwd*
netrw-path pi_netrw.txt /*netrw-path* netrw-path pi_netrw.txt /*netrw-path*
netrw-preview pi_netrw.txt /*netrw-preview*
netrw-problems pi_netrw.txt /*netrw-problems* netrw-problems pi_netrw.txt /*netrw-problems*
netrw-protocol pi_netrw.txt /*netrw-protocol* netrw-protocol pi_netrw.txt /*netrw-protocol*
netrw-q pi_netrw.txt /*netrw-q* netrw-q pi_netrw.txt /*netrw-q*
@ -5774,10 +5784,14 @@ netrw-r pi_netrw.txt /*netrw-r*
netrw-read pi_netrw.txt /*netrw-read* netrw-read pi_netrw.txt /*netrw-read*
netrw-ref pi_netrw.txt /*netrw-ref* netrw-ref pi_netrw.txt /*netrw-ref*
netrw-rename pi_netrw.txt /*netrw-rename* netrw-rename pi_netrw.txt /*netrw-rename*
netrw-reverse pi_netrw.txt /*netrw-reverse*
netrw-s pi_netrw.txt /*netrw-s* netrw-s pi_netrw.txt /*netrw-s*
netrw-sort pi_netrw.txt /*netrw-sort*
netrw-sortsequence pi_netrw.txt /*netrw-sortsequence*
netrw-transparent pi_netrw.txt /*netrw-transparent* netrw-transparent pi_netrw.txt /*netrw-transparent*
netrw-u pi_netrw.txt /*netrw-u* netrw-u pi_netrw.txt /*netrw-u*
netrw-uidpass pi_netrw.txt /*netrw-uidpass* netrw-uidpass pi_netrw.txt /*netrw-uidpass*
netrw-updir pi_netrw.txt /*netrw-updir*
netrw-urls pi_netrw.txt /*netrw-urls* netrw-urls pi_netrw.txt /*netrw-urls*
netrw-v pi_netrw.txt /*netrw-v* netrw-v pi_netrw.txt /*netrw-v*
netrw-var pi_netrw.txt /*netrw-var* netrw-var pi_netrw.txt /*netrw-var*

View File

@ -1,7 +1,7 @@
" netrw.vim: Handles file transfer and remote directory listing across a network " netrw.vim: Handles file transfer and remote directory listing across a network
" last change: Dec 29, 2004 " Last Change: Aug 01, 2005
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz> " Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
" Version: 54 " Version: 56
" License: Vim License (see vim's :help license) " License: Vim License (see vim's :help license)
" "
" But be doers of the Word, and not only hearers, deluding your own selves " But be doers of the Word, and not only hearers, deluding your own selves
@ -10,13 +10,13 @@
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" Prevent Reloading: {{{1 " Load Once: {{{1
if exists("g:loaded_netrw") || &cp if exists("g:loaded_netrw") || &cp
finish finish
endif endif
let g:loaded_netrw = "v54" let g:loaded_netrw = "v56"
let s:save_cpo = &cpo
let loaded_explorer = 1 let loaded_explorer = 1
let s:keepcpo = &cpo
set cpo&vim set cpo&vim
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
@ -43,7 +43,7 @@ if !exists("g:netrw_list_cmd")
" provide a default listing command " provide a default listing command
let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa" let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa"
else else
" call Decho("ssh is not executable, can't do remote directory exploring") " call Decho("ssh is not executable, can't do remote directory exploring with ssh")
let g:netrw_list_cmd= "" let g:netrw_list_cmd= ""
endif endif
endif endif
@ -100,15 +100,6 @@ endif
if !exists("g:netrw_local_rmdir") if !exists("g:netrw_local_rmdir")
let g:netrw_local_rmdir= "rmdir" let g:netrw_local_rmdir= "rmdir"
endif endif
if !exists("g:netrw_local_rename")
if g:netrw_cygwin
let g:netrw_local_rename= "mv"
elseif has("win32") || has("win95") || has("win64") || has("win16")
let g:netrw_local_rename= "rename"
elseif has("unix")
let g:netrw_local_rename= "mv"
endif
endif
if !exists("g:netrw_local_mkdir") if !exists("g:netrw_local_mkdir")
let g:netrw_local_mkdir= "mkdir" let g:netrw_local_mkdir= "mkdir"
endif endif
@ -216,30 +207,36 @@ endif
if version >= 600 if version >= 600
augroup FileExplorer augroup FileExplorer
au! au!
au BufEnter * call <SID>LocalBrowse(expand("<afile>")) au BufEnter * call <SID>LocalBrowse(expand("<amatch>"))
augroup END augroup END
" Network Handler: {{{2 " Network Handler: {{{2
augroup Network augroup Network
au! au!
if has("win32") || has("win95") || has("win64") || has("win16") if has("win32") || has("win95") || has("win64") || has("win16")
au BufReadCmd file://* exe "silent doau BufReadPre ".expand("<afile>")|exe 'e '.substitute(expand("<afile>"),"file:/*","","")|exe "silent doau BufReadPost ".expand("<afile>") au BufReadCmd file://* exe "silent doau BufReadPre ".expand("<amatch>")|exe 'e '.substitute(expand("<amatch>"),"file:/*","","")|exe "silent doau BufReadPost ".expand("<amatch>")
else else
au BufReadCmd file:///* exe "silent doau BufReadPre ".expand("<afile>")|exe 'e /'.substitute(expand("<afile>"),"file:/*","","")|exe "silent doau BufReadPost ".expand("<afile>") au BufReadCmd file:///* exe "silent doau BufReadPre ".expand("<amatch>")|exe 'e /'.substitute(expand("<amatch>"),"file:/*","","")|exe "silent doau BufReadPost ".expand("<amatch>")
au BufReadCmd file://localhost/* exe "silent doau BufReadPre ".expand("<afile>")|exe 'e /'.substitute(expand("<afile>"),"file:/*","","")|exe "silent doau BufReadPost ".expand("<afile>") au BufReadCmd file://localhost/* exe "silent doau BufReadPre ".expand("<amatch>")|exe 'e /'.substitute(expand("<amatch>"),"file:/*","","")|exe "silent doau BufReadPost ".expand("<amatch>")
endif endif
au BufReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("<afile>")|exe "Nread 0r ".expand("<afile>")|exe "silent doau BufReadPost ".expand("<afile>") au BufReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("<amatch>")|exe "Nread 0r ".expand("<amatch>")|exe "silent doau BufReadPost ".expand("<amatch>")
au FileReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("<afile>")|exe "Nread " .expand("<afile>")|exe "silent doau FileReadPost ".expand("<afile>") au FileReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("<amatch>")|exe "Nread " .expand("<amatch>")|exe "silent doau FileReadPost ".expand("<amatch>")
au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("<afile>")|exe "Nwrite " .expand("<afile>")|exe "silent doau BufWritePost ".expand("<afile>") au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("<amatch>")|exe "Nwrite " .expand("<amatch>")|exe "silent doau BufWritePost ".expand("<amatch>")
au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("<afile>")|exe "'[,']Nwrite " .expand("<afile>")|exe "silent doau FileWritePost ".expand("<afile>") au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("<amatch>")|exe "'[,']Nwrite " .expand("<amatch>")|exe "silent doau FileWritePost ".expand("<amatch>")
augroup END augroup END
endif endif
" ------------------------------------------------------------------------ " ------------------------------------------------------------------------
" Commands: :Nread, :Nwrite, and :NetUserPass {{{1 " Commands: :Nread, :Nwrite, :NetUserPass {{{1
com! -nargs=* Nread call <SID>NetSavePosn()<bar>call <SID>NetRead(<f-args>)<bar>call <SID>NetRestorePosn() com! -nargs=* Nread call s:NetSavePosn()<bar>call s:NetRead(<f-args>)<bar>call s:NetRestorePosn()
com! -range=% -nargs=* Nwrite call <SID>NetSavePosn()<bar><line1>,<line2>call <SID>NetWrite(<f-args>)<bar>call <SID>NetRestorePosn() com! -range=% -nargs=* Nwrite call s:NetSavePosn()<bar><line1>,<line2>call s:NetWrite(<f-args>)<bar>call s:NetRestorePosn()
com! -nargs=* NetUserPass call NetUserPass(<f-args>) com! -nargs=* NetUserPass call NetUserPass(<f-args>)
" Commands: :Explore, :Sexplore, Hexplore, Vexplore {{{1
com! -nargs=? -bar -bang Explore call s:Explore(0,0+<bang>0,<q-args>)
com! -nargs=? -bar -bang Sexplore call s:Explore(1,0+<bang>0,<q-args>)
com! -nargs=? -bar -bang Hexplore call s:Explore(1,2+<bang>0,<q-args>)
com! -nargs=? -bar -bang Vexplore call s:Explore(1,4+<bang>0,<q-args>)
" ------------------------------------------------------------------------ " ------------------------------------------------------------------------
" NetSavePosn: saves position of cursor on screen {{{1 " NetSavePosn: saves position of cursor on screen {{{1
fun! s:NetSavePosn() fun! s:NetSavePosn()
@ -352,7 +349,7 @@ fun! s:NetRead(...)
let ichoice = ichoice + 1 let ichoice = ichoice + 1
if ichoice > a:0 if ichoice > a:0
if !exists("g:netrw_quiet") if !exists("g:netrw_quiet")
echoerr "Unbalanced string in filename '". wholechoice ."'" echoerr "***netrw*** Unbalanced string in filename '". wholechoice ."'"
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
" call Dret("NetRead") " call Dret("NetRead")
@ -436,10 +433,10 @@ fun! s:NetRead(...)
exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine
endif endif
" If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
if getline(1) !~ "^$" && !exists("g:netrw_quiet") if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
let debugkeep= &debug let debugkeep= &debug
set debug=msg set debug=msg
echoerr getline(1) echoerr "***netrw*** ".getline(1)
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
let &debug= debugkeep let &debug= debugkeep
endif endif
@ -485,7 +482,7 @@ fun! s:NetRead(...)
if getline(1) !~ "^$" if getline(1) !~ "^$"
" call Decho("error<".getline(1).">") " call Decho("error<".getline(1).">")
if !exists("g:netrw_quiet") if !exists("g:netrw_quiet")
echoerr getline(1) echoerr "***netrw*** ".getline(1)
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
endif endif
@ -518,7 +515,7 @@ fun! s:NetRead(...)
" call Decho("read via http (method #5)") " call Decho("read via http (method #5)")
if g:netrw_http_cmd == "" if g:netrw_http_cmd == ""
if !exists("g:netrw_quiet") if !exists("g:netrw_quiet")
echoerr "neither wget nor fetch command is available" echoerr "***netrw*** neither wget nor fetch command is available"
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
exit exit
@ -596,7 +593,7 @@ fun! s:NetRead(...)
elseif b:netrw_method == 8 " read with fetch elseif b:netrw_method == 8 " read with fetch
if g:netrw_fetch_cmd == "" if g:netrw_fetch_cmd == ""
if !exists("g:netrw_quiet") if !exists("g:netrw_quiet")
echoerr "fetch command not available" echoerr "***netrw*** fetch command not available"
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
exit exit
@ -678,17 +675,23 @@ fun! s:NetGetFile(readcmd, fname, method)
if a:readcmd[0] == '0' if a:readcmd[0] == '0'
" get file into buffer " get file into buffer
" record remote filename " record remote filename
let rfile= bufname("%") let rfile= bufname(".")
" call Decho("edit remotefile<".rfile.">") " call Decho("remotefile<".rfile.">")
" call Dredir("ls!","starting buffer list")
" rename the current buffer to the temp file (ie. fname) " rename the current buffer to the temp file (ie. fname)
exe "keepalt file ".fname keepalt exe "file ".fname
" call Dredir("ls!","after renaming current buffer to <".fname.">")
" edit temporary file " edit temporary file
e e
" call Dredir("ls!","after editing temporary file")
" rename buffer back to remote filename " rename buffer back to remote filename
exe "keepalt file ".rfile keepalt exe "file ".rfile
" wipe out the buffer with the temp file name " call Dredir("ls!","renaming buffer back to remote filename<".rfile.">")
exe "bwipe ".fname
let line1 = 1 let line1 = 1
let line2 = line("$") let line2 = line("$")
@ -712,6 +715,8 @@ fun! s:NetGetFile(readcmd, fname, method)
if exists("*NetReadFixup") if exists("*NetReadFixup")
" call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")") " call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")")
call NetReadFixup(a:method, line1, line2) call NetReadFixup(a:method, line1, line2)
" else " Decho
" call Decho("NetReadFixup() not called, doesn't exist")
endif endif
" update the Buffers menu " update the Buffers menu
@ -787,7 +792,7 @@ fun! s:NetWrite(...) range
let ichoice = ichoice + 1 let ichoice = ichoice + 1
if choice > a:0 if choice > a:0
if !exists("g:netrw_quiet") if !exists("g:netrw_quiet")
echoerr "Unbalanced string in filename '". wholechoice ."'" echoerr "***netrw*** Unbalanced string in filename '". wholechoice ."'"
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
" call Dret("NetWrite") " call Dret("NetWrite")
@ -858,7 +863,7 @@ fun! s:NetWrite(...) range
" If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
if getline(1) !~ "^$" if getline(1) !~ "^$"
if !exists("g:netrw_quiet") if !exists("g:netrw_quiet")
echoerr getline(1) echoerr "***netrw*** ".getline(1)
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
let mod=1 let mod=1
@ -898,7 +903,7 @@ fun! s:NetWrite(...) range
" If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
if getline(1) !~ "^$" if getline(1) !~ "^$"
if !exists("g:netrw_quiet") if !exists("g:netrw_quiet")
echoerr getline(1) echoerr "***netrw*** ".getline(1)
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
let mod=1 let mod=1
@ -927,7 +932,7 @@ fun! s:NetWrite(...) range
" http: NetWrite Method #5 " http: NetWrite Method #5
elseif b:netrw_method == 5 elseif b:netrw_method == 5
if !exists("g:netrw_quiet") if !exists("g:netrw_quiet")
echoerr "***warning*** currently <netrw.vim> does not support writing using http:" echoerr "***netrw*** currently <netrw.vim> does not support writing using http:"
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
@ -1010,8 +1015,10 @@ fun! s:NetWrite(...) range
" call Dret("NetWrite") " call Dret("NetWrite")
endfun endfun
" ------------------------------------------------------------------------ " ===========================================
" Browsing Support For Remote Directories And Files: {{{1 " Remote Directory Browsing Support: {{{1
" ===========================================
" NetBrowse: This function uses the command in g:netrw_list_cmd to get a list {{{2 " NetBrowse: This function uses the command in g:netrw_list_cmd to get a list {{{2
" of the contents of a remote directory. It is assumed that the " of the contents of a remote directory. It is assumed that the
" g:netrw_list_cmd has a string, HOSTNAME, that needs to be substituted " g:netrw_list_cmd has a string, HOSTNAME, that needs to be substituted
@ -1040,7 +1047,7 @@ fun! <SID>NetBrowse(dirname)
endif endif
" make this buffer modifiable " make this buffer modifiable
setlocal ma setlocal ma nonu nowrap
" analyze a:dirname and g:netrw_list_cmd " analyze a:dirname and g:netrw_list_cmd
let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$' let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$'
@ -1048,7 +1055,7 @@ fun! <SID>NetBrowse(dirname)
" call Decho("dirpat<".dirpat.">") " call Decho("dirpat<".dirpat.">")
if dirname !~ dirpat if dirname !~ dirpat
if !exists("g:netrw_quiet") if !exists("g:netrw_quiet")
echoerr "NetBrowse: I don't understand your dirname<".dirname.">" echoerr "***netrw*** netrw doesn't understand your dirname<".dirname.">"
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
" call Dret("NetBrowse : badly formatted dirname<".dirname.">") " call Dret("NetBrowse : badly formatted dirname<".dirname.">")
@ -1080,7 +1087,7 @@ fun! <SID>NetBrowse(dirname)
" optionally sort by time (-t) or by size (-S) " optionally sort by time (-t) or by size (-S)
if listcmd == "dir" && g:netrw_sort_by =~ "^[ts]" if listcmd == "dir" && g:netrw_sort_by =~ "^[ts]"
echoerr "***warning*** windows' ftp doesn't support time/size sorts (get cygwin, set g:netrw_cygwin)" echoerr "***netrw*** windows' ftp doesn't support time/size sorts (get cygwin, set g:netrw_cygwin)"
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
else else
if g:netrw_sort_by =~ "^t" if g:netrw_sort_by =~ "^t"
@ -1185,7 +1192,7 @@ fun! <SID>NetBrowse(dirname)
exe 'nnoremap <buffer> <silent> R :exe "norm! 0"<bar>call <SID>NetBrowseRename("'.user.machine.'","'.path.'")<cr>' exe 'nnoremap <buffer> <silent> R :exe "norm! 0"<bar>call <SID>NetBrowseRename("'.user.machine.'","'.path.'")<cr>'
exe 'vnoremap <buffer> <silent> R :call <SID>NetBrowseRename("'.user.machine.'","'.path.'")<cr>' exe 'vnoremap <buffer> <silent> R :call <SID>NetBrowseRename("'.user.machine.'","'.path.'")<cr>'
nnoremap <buffer> ? :he netrw-browse-cmds<cr> nnoremap <buffer> ? :he netrw-browse-cmds<cr>
setlocal ma nonu setlocal ma nonu nowrap
" Set up the banner " Set up the banner
" call Decho("set up the banner: sortby<".g:netrw_sort_by."> method<".method.">") " call Decho("set up the banner: sortby<".g:netrw_sort_by."> method<".method.">")
@ -1251,9 +1258,9 @@ fun! <SID>NetBrowse(dirname)
keepjumps norm! 0 keepjumps norm! 0
" more cleanup " more cleanup
exe 'keepjumps silent '.s:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e' exe 'keepjumps silent! '.s:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e'
exe "keepjumps silent ".s:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#' exe "keepjumps silent! ".s:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e'
exe "keepjumps silent ".s:netrw_bannercnt.',$g/ -> /s# -> .*$#/#' exe "keepjumps silent! ".s:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e'
endif endif
else else
@ -1307,7 +1314,11 @@ fun! <SID>NetBrowse(dirname)
if line("$") >= s:netrw_bannercnt if line("$") >= s:netrw_bannercnt
if g:netrw_sort_by =~ "^n" if g:netrw_sort_by =~ "^n"
call s:SetSort() call s:SetSort()
if v:version < 700
exe 'keepjumps silent '.s:netrw_bannercnt.',$call s:NetSort()' exe 'keepjumps silent '.s:netrw_bannercnt.',$call s:NetSort()'
else
exe 'keepjumps silent '.s:netrw_bannercnt.',$sort'
endif
exe 'keepjumps silent '.s:netrw_bannercnt.',$s/^\d\{3}\///e' exe 'keepjumps silent '.s:netrw_bannercnt.',$s/^\d\{3}\///e'
endif endif
if g:netrw_longlist if g:netrw_longlist
@ -1459,7 +1470,7 @@ fun! <SID>NetBrowseRm(usrhost,path) range
" call Decho("returned=".ret." errcode=".v:shell_error) " call Decho("returned=".ret." errcode=".v:shell_error)
if v:shell_error != 0 && !exists("g:netrw_quiet") if v:shell_error != 0 && !exists("g:netrw_quiet")
echoerr "unable to remove directory<".rmfile."> -- is it empty?" echoerr "***netrw*** unable to remove directory<".rmfile."> -- is it empty?"
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
endif endif
@ -1669,14 +1680,14 @@ fun! NetBrowseFtpCmd(path,cmd)
" cleanup for Windows " cleanup for Windows
if has("win32") || has("win95") || has("win64") || has("win16") if has("win32") || has("win95") || has("win64") || has("win16")
keepjumps silent! %s/\r$// keepjumps silent!! %s/\r$//e
endif endif
if a:cmd == "dir" if a:cmd == "dir"
" infer directory/link based on the file permission string " infer directory/link based on the file permission string
keepjumps silent g/d\%([-r][-w][-x]\)\{3}/s@$@/@ keepjumps silent! g/d\%([-r][-w][-x]\)\{3}/s@$@/@
keepjumps silent g/l\%([-r][-w][-x]\)\{3}/s/$/@/ keepjumps silent! g/l\%([-r][-w][-x]\)\{3}/s/$/@/
if !g:netrw_longlist if !g:netrw_longlist
exe "keepjumps silent ".curline.',$s/^\%(\S\+\s\+\)\{8}//' exe "keepjumps silent! ".curline.',$s/^\%(\S\+\s\+\)\{8}//e'
endif endif
endif endif
@ -1782,7 +1793,7 @@ fun! <SID>NetLongList(mode)
endfun endfun
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" NetSaveWordPosn: used by the "s" command in both remote and local " NetSaveWordPosn: used by the "s" command in both remote and local {{{2
" browsing. Along with NetRestoreWordPosn(), it keeps the cursor on " browsing. Along with NetRestoreWordPosn(), it keeps the cursor on
" the same word even though the sorting has changed its order of appearance. " the same word even though the sorting has changed its order of appearance.
fun! s:NetSaveWordPosn() fun! s:NetSaveWordPosn()
@ -1792,7 +1803,7 @@ fun! s:NetSaveWordPosn()
endfun endfun
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" NetRestoreWordPosn: used by the "s" command; see NetSaveWordPosn() above " NetRestoreWordPosn: used by the "s" command; see NetSaveWordPosn() above {{{2
fun! s:NetRestoreWordPosn() fun! s:NetRestoreWordPosn()
" call Dfunc("NetRestoreWordPosn()") " call Dfunc("NetRestoreWordPosn()")
silent! call search(s:netrw_saveword,'w') silent! call search(s:netrw_saveword,'w')
@ -1800,7 +1811,7 @@ fun! s:NetRestoreWordPosn()
endfun endfun
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" NetMakeDir: this function makes a directory (both local and remote) " NetMakeDir: this function makes a directory (both local and remote) {{{2
fun! <SID>NetMakeDir(usrhost) fun! <SID>NetMakeDir(usrhost)
" call Dfunc("NetMakeDir(usrhost<".a:usrhost.">)") " call Dfunc("NetMakeDir(usrhost<".a:usrhost.">)")
@ -1825,7 +1836,7 @@ fun! <SID>NetMakeDir(usrhost)
" call Decho("fullnewdir<".fullnewdir.">") " call Decho("fullnewdir<".fullnewdir.">")
if isdirectory(fullnewdir) if isdirectory(fullnewdir)
if !exists("g:netrw_quiet") if !exists("g:netrw_quiet")
echoerr "***warning*** <".newdirname."> is already a directory!" echoerr "***netrw*** <".newdirname."> is already a directory!"
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
" call Dret("NetMakeDir : directory<".newdirname."> exists previously") " call Dret("NetMakeDir : directory<".newdirname."> exists previously")
@ -1833,14 +1844,25 @@ fun! <SID>NetMakeDir(usrhost)
endif endif
if filereadable(fullnewdir) if filereadable(fullnewdir)
if !exists("g:netrw_quiet") if !exists("g:netrw_quiet")
echoerr "***warning*** <".newdirname."> is already a file!" echoerr "***netrw*** <".newdirname."> is already a file!"
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
" call Dret("NetMakeDir : file<".newdirname."> exists previously") " call Dret("NetMakeDir : file<".newdirname."> exists previously")
return return
endif endif
" call Decho("exe silent! !".g:netrw_local_mkdir.' "'.fullnewdir.'"')
exe "silent! !".g:netrw_local_mkdir.' "'.fullnewdir.'"' " requested new local directory is neither a pre-existing file or
" directory, so make it!
if exists("*mkdir")
call mkdir(fullnewdir,"p")
else
let netrw_origdir= s:NetGetcwd(1)
exe 'cd '.b:netrw_curdir
" call Decho("netrw_origdir<".netrw_origdir."> b:netrw_curdir<".b:netrw_curdir.">")
" call Decho("exe silent! !".g:netrw_local_mkdir.' "'.newdirname.'"')
exe "silent! !".g:netrw_local_mkdir.' "'.newdirname.'"'
if g:netrw_keepdir | exe 'keepjumps cd '.netrw_origdir | endif
endif
if v:shell_error == 0 if v:shell_error == 0
" refresh listing " refresh listing
@ -1852,7 +1874,7 @@ fun! <SID>NetMakeDir(usrhost)
exe "norm! ".hline."G0z\<CR>" exe "norm! ".hline."G0z\<CR>"
exe linenum exe linenum
elseif !exists("g:netrw_quiet") elseif !exists("g:netrw_quiet")
echoerr "***warning*** unable to make directory<".newdirname.">" echoerr "***netrw*** unable to make directory<".newdirname.">"
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
redraw! redraw!
@ -1872,7 +1894,7 @@ fun! <SID>NetMakeDir(usrhost)
exe "norm! ".hline."G0z\<CR>" exe "norm! ".hline."G0z\<CR>"
exe linenum exe linenum
elseif !exists("g:netrw_quiet") elseif !exists("g:netrw_quiet")
echoerr "***warning*** unable to make directory<".newdirname.">" echoerr "***netrw*** unable to make directory<".newdirname.">"
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
redraw! redraw!
@ -1882,7 +1904,7 @@ fun! <SID>NetMakeDir(usrhost)
endfun endfun
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" NetBookmarkDir: " NetBookmarkDir: {{{2
" 0: bookmark the current directory " 0: bookmark the current directory
" 1: change to the bookmarked directory " 1: change to the bookmarked directory
fun! <SID>NetBookmarkDir(chg,curdir) fun! <SID>NetBookmarkDir(chg,curdir)
@ -1974,8 +1996,9 @@ fun! <SID>NetBookmarkDir(chg,curdir)
" call Dret("NetBookmarkDir") " call Dret("NetBookmarkDir")
endfun endfun
" --------------------------------------------------------------------- " ==========================================
" Browsing Support For Local Directories And Files: {{{1 " Local Directory Browsing Support: {{{1
" ==========================================
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" LocalBrowse: supports local file/directory browsing {{{2 " LocalBrowse: supports local file/directory browsing {{{2
@ -1995,107 +2018,43 @@ fun! <SID>LocalBrowse(dirname)
if v:version < 603 if v:version < 603
if !exists("g:netrw_quiet") if !exists("g:netrw_quiet")
echoerr "vim version<".v:version."> too old for browsing with netrw" echoerr "***netrw*** vim version<".v:version."> too old for browsing with netrw"
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
" call Dret("LocalBrowse : vim version<".v:version."> too old") " call Dret("LocalBrowse : vim version<".v:version."> too old")
return return
endif endif
" record autochdir setting and then insure its unset (tnx to David Fishburn)
let keep_autochdir= &autochdir
set noautochdir
" record and change current directory " record and change current directory
let netrw_origdir= s:NetGetcwd(1) let b:netrw_curdir= substitute(a:dirname,'\\','/','ge')
try if b:netrw_curdir =~ '[/\\]$'
cd - let b:netrw_curdir= substitute(b:netrw_curdir,'[/\\]$','','e')
let netrw_altdir= s:NetGetcwd(1) endif
cd - " call Decho("b:netrw_curdir<".b:netrw_curdir.">")
catch " make netrw's idea of the current directory vim's if the user wishes
let netrw_altdir= '' if g:netrw_keepdir
endtry " call Decho("change directory: cd ".b:netrw_curdir)
exe 'cd '.escape(substitute(a:dirname,'\\','/','ge'),s:netrw_cd_escape) exe 'cd '.b:netrw_curdir
" call Decho("dirname<".a:dirname."> buf#".bufnr("%")." winnr=".winnr()) endif
" change the name of the buffer to reflect the b:netrw_curdir
exe 'silent file '.escape(b:netrw_curdir,s:netrw_cd_escape)
" make this buffer modifiable " make this buffer modifiable
setlocal ma setlocal ma
" disable 'autochdir', it breaks things
set noautochdir
" --------------------------- " ---------------------------
" Perform Directory Listing: " Perform Directory Listing:
" call Decho("Perform directory listing...")
" set up new buffer and map
" dirname : current working directory, no escapes, has trailing /
" dirnamens : dirname, but with no trailing slash
" dirnamenr : buffer number containing dirnamens
" dirnamebuf: buffer's idea of dirname, with all \ -> /
let dirname = s:NetGetcwd(0)
let dirnamens = substitute(dirname,'[\/]$','','e')
let dirnamenr = bufnr(dirnamens.'$')
let dirnamebuf = substitute(bufname(dirnamenr),'\\','/','ge')
" call Decho("dirnamenr= bufnr(".dirnamens.")=".dirnamenr." bufname(".dirnamenr.")=".bufname(dirnamenr))
if dirnamenr != 0 && dirnamebuf != dirnamens
" try keeping the trailing slash
let dirnamenr = bufnr(dirname.'$')
" call Decho("dirnamenr= bufnr(".dirname.")=".dirnamenr." bufname(".dirnamenr.")=".bufname(dirnamenr)." (retry with /)")
endif
if dirnamenr != -1
" buffer already exists (hidden), so switch to it!
" call Decho("buffer already exists: dirnamenr=".dirnamenr." dirname<".dirname."> pre-exists")
" call Dredir("ls!")
exe "b ".dirnamenr
exe 'silent! cd '.escape(dirname,s:netrw_cd_escape)
" call Decho("changed directory to<".dirname.">")
if a:dirname != "." && line("$") >= 5 && exists("b:netrw_curdir")
if b:netrw_curdir == dirname
" call Dret("LocalBrowse : buffer already exists with info, #".dirnamenr)
if g:netrw_keepdir
if netrw_altdir != ''
exe 'keepjumps cd '.netrw_altdir
endif
exe 'keepjumps cd '.netrw_origdir
endif
return
endif
endif
" call Decho("buffer already exists, but needs re-listing (buf#".dirnamenr.")")
" call Decho("buffer name<".bufname("%")."> dirname<".dirname.">")
setlocal ma
keepjumps %d
let curdir= substitute(substitute(expand("%"),'\\','/','ge'),'[^/]$','&/','e')
if curdir != dirname
" set standard browser options on buffer
setlocal bt=nofile bh=hide nobl noswf
exe 'silent file '.escape(dirname,s:netrw_cd_escape)
" call Decho("errmsg1<".v:errmsg.">")
" call Decho("renamed buffer to<".escape(dirname,s:netrw_cd_escape).">")
" call Decho("yielding actual bufname<".bufname("%").">")
endif
else
" call Decho("generate new buffer named<".escape(dirname,' #').">")
silent! enew!
" set standard browser options on buffer
setlocal bt=nofile bh=hide nobl noswf nonu
exe 'silent file '.substitute(escape(dirname,s:netrw_cd_escape),'[\/]$','','e')
" call Decho("errmsg2<".v:errmsg.">")
" call Decho("renamed buffer to<".substitute(escape(dirname,s:netrw_cd_escape),'[\/]$','','e').">")
" call Decho("yielding actual bufname<".bufname("%").">")
endif
exe "setlocal ts=".g:netrw_maxfilenamelen
if bufname("#") == "" && bufnr("#") != -1
" the file command produces a lot of [No File] buffers
" call Decho("wiping out nofile buffer#".bufnr("#"))
exe bufnr("#")."bwipe"
endif
" save current directory on directory history list " save current directory on directory history list
call <SID>NetBookmarkDir(3,s:NetGetcwd(0)) call <SID>NetBookmarkDir(3,b:netrw_curdir)
" set up all the maps " set up all the maps
" call Decho("Setting up local browser maps") " call Decho("Setting up local browser maps")
let b:netrw_curdir= s:NetGetcwd(1)
nnoremap <buffer> <silent> <cr> :exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr> nnoremap <buffer> <silent> <cr> :exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr>
nnoremap <buffer> <silent> <c-l> :exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))<cr> nnoremap <buffer> <silent> <c-l> :exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))<cr>
nnoremap <buffer> <silent> - :exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,'../'))<cr> nnoremap <buffer> <silent> - :exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,'../'))<cr>
@ -2131,7 +2090,7 @@ fun! <SID>LocalBrowse(dirname)
keepjumps put ='\" ============================================================================' keepjumps put ='\" ============================================================================'
keepjumps 1d keepjumps 1d
keepjumps put ='\" Directory Listing (netrw '.g:loaded_netrw.')' keepjumps put ='\" Directory Listing (netrw '.g:loaded_netrw.')'
keepjumps put ='\" '.dirname keepjumps put ='\" '.b:netrw_curdir
let s:netrw_bannercnt= 3 let s:netrw_bannercnt= 3
let sortby= g:netrw_sort_by let sortby= g:netrw_sort_by
@ -2171,7 +2130,7 @@ fun! <SID>LocalBrowse(dirname)
" call Decho("bannercnt=".s:netrw_bannercnt) " call Decho("bannercnt=".s:netrw_bannercnt)
" generate the requested directory listing " generate the requested directory listing
call LocalBrowseList(dirname) call LocalBrowseList()
" manipulate the directory listing (hide, sort) " manipulate the directory listing (hide, sort)
setlocal ft=netrwlist setlocal ft=netrwlist
@ -2182,10 +2141,18 @@ fun! <SID>LocalBrowse(dirname)
if line("$") >= s:netrw_bannercnt if line("$") >= s:netrw_bannercnt
if g:netrw_sort_by =~ "^n" if g:netrw_sort_by =~ "^n"
call s:SetSort() call s:SetSort()
if v:version < 700
exe 'keepjumps silent '.s:netrw_bannercnt.',$call s:NetSort()' exe 'keepjumps silent '.s:netrw_bannercnt.',$call s:NetSort()'
else
exe 'keepjumps silent '.s:netrw_bannercnt.',$sort'
endif
exe 'keepjumps silent '.s:netrw_bannercnt.',$s/^\d\{3}\///e' exe 'keepjumps silent '.s:netrw_bannercnt.',$s/^\d\{3}\///e'
else else
if v:version < 700
exe 'keepjumps silent '.s:netrw_bannercnt.',$call s:NetSort()' exe 'keepjumps silent '.s:netrw_bannercnt.',$call s:NetSort()'
else
exe 'keepjumps silent '.s:netrw_bannercnt.',$sort'
endif
exe 'keepjumps silent '.s:netrw_bannercnt.',$s/^\d\{-}\///e' exe 'keepjumps silent '.s:netrw_bannercnt.',$s/^\d\{-}\///e'
endif endif
endif endif
@ -2193,30 +2160,25 @@ fun! <SID>LocalBrowse(dirname)
exe s:netrw_bannercnt exe s:netrw_bannercnt
setlocal noma nomod nonu setlocal noma nomod nonu
if g:netrw_keepdir let &autochdir= keep_autochdir
if netrw_altdir != ''
exe 'keepjumps cd '.netrw_altdir
endif
exe 'keepjumps cd '.netrw_origdir
endif
" call Dret("LocalBrowse : file<".expand("%:p")."> bufname<".bufname("%").">") " call Dret("LocalBrowse : file<".expand("%:p")."> bufname<".bufname("%").">")
endfun endfun
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" LocalBrowseList: does the job of "ls" for local directories {{{2 " LocalBrowseList: does the job of "ls" for local directories {{{2
fun! LocalBrowseList(dirname) fun! LocalBrowseList()
" call Dfunc("LocalBrowseList(dirname<".a:dirname.">)") " call Dfunc("LocalBrowseList() b:netrw_curdir<".b:netrw_curdir.">")
" get the list of files contained in the current directory " get the list of files contained in the current directory
let dirname = escape(a:dirname,s:netrw_glob_escape) let dirname = escape(b:netrw_curdir,s:netrw_glob_escape)
let dirnamelen = strlen(a:dirname) let dirnamelen = strlen(b:netrw_curdir)
let filelist = glob(dirname."*") let filelist = glob(dirname."/*")
" call Decho("glob(dirname<".dirname.">,*)=".filelist) " call Decho("glob(dirname<".dirname.">,*)=".filelist)
if filelist != "" if filelist != ""
let filelist= filelist."\n" let filelist= filelist."\n"
endif endif
let filelist= filelist.glob(dirname.".*") let filelist= filelist.glob(dirname."/.*")
" call Decho("glob(dirname<".dirname.">,.*)=".glob(dirname.".*")) " call Decho("glob(dirname<".dirname.">,.*)=".glob(dirname.".*"))
" if the directory name includes a "$", and possibly other characters, " if the directory name includes a "$", and possibly other characters,
@ -2226,13 +2188,13 @@ fun! LocalBrowseList(dirname)
if filelist == "" if filelist == ""
let filelist= dirname."." let filelist= dirname."."
else else
let filelist= filelist."\n".a:dirname."." let filelist= filelist."\n".b:netrw_curdir."."
endif endif
" call Decho("filelist<".filelist.">") " call Decho("filelist<".filelist.">")
endif endif
if filelist !~ '[\\/]\.\.[\\/]\=\(\n\|$\)' if filelist !~ '[\\/]\.\.[\\/]\=\(\n\|$\)'
" call Decho("forcibly tacking on ..") " call Decho("forcibly tacking on ..")
let filelist= filelist."\n".a:dirname.".." let filelist= filelist."\n".b:netrw_curdir.".."
" call Decho("filelist<".filelist.">") " call Decho("filelist<".filelist.">")
endif endif
let filelist= substitute(filelist,'\n\{2,}','\n','ge') let filelist= substitute(filelist,'\n\{2,}','\n','ge')
@ -2243,41 +2205,47 @@ fun! LocalBrowseList(dirname)
while filelist != "" while filelist != ""
if filelist =~ '\n' if filelist =~ '\n'
let file = substitute(filelist,'\n.*$','','e') let filename = substitute(filelist,'\n.*$','','e')
let filelist = substitute(filelist,'^.\{-}\n\(.*\)$','\1','e') let filelist = substitute(filelist,'^.\{-}\n\(.*\)$','\1','e')
else else
let file = filelist let filename = filelist
let filelist = "" let filelist = ""
endif endif
let pfile= file let pfile= filename
if isdirectory(file) if isdirectory(filename)
let pfile= file."/" let pfile= filename."/"
endif endif
let pfile= substitute(pfile,'^/','','e')
if pfile =~ '//$' if pfile =~ '//$'
let pfile= substitute(pfile,'//$','/','e') let pfile= substitute(pfile,'//$','/','e')
endif endif
let pfile= strpart(pfile,dirnamelen) let pfile= strpart(pfile,dirnamelen)
" call Decho(" ")
" call Decho("filename<".filename.">")
" call Decho("pfile <".pfile.">")
if g:netrw_longlist if g:netrw_longlist
let sz = getfsize(file) let sz = getfsize(filename)
let fsz = strpart(" ",1,15-strlen(sz)).sz let fsz = strpart(" ",1,15-strlen(sz)).sz
let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(file)) let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename))
" call Decho("sz=".sz." fsz=".fsz)
endif endif
if g:netrw_sort_by =~ "^t" if g:netrw_sort_by =~ "^t"
" sort by time (handles time up to 1 quintillion seconds, US) " sort by time (handles time up to 1 quintillion seconds, US)
" call Decho("getftime(".file.")=".getftime(file)) " call Decho("getftime(".filename.")=".getftime(filename))
let t = getftime(file) let t = getftime(filename)
let ft = strpart("000000000000000000",1,18-strlen(t)).t let ft = strpart("000000000000000000",1,18-strlen(t)).t
" call Decho("exe keepjumps put ='".ft.'/'.file."'") " call Decho("exe keepjumps put ='".ft.'/'.filename."'")
let ftpfile= ft.'/'.pfile let ftpfile= ft.'/'.pfile
keepjumps put=ftpfile keepjumps put=ftpfile
elseif g:netrw_sort_by =~ "^s" elseif g:netrw_sort_by =~ "^s"
" sort by size (handles file sizes up to 1 quintillion bytes, US) " sort by size (handles file sizes up to 1 quintillion bytes, US)
" call Decho("getfsize(".file.")=".getfsize(file)) " call Decho("getfsize(".filename.")=".getfsize(filename))
let sz = getfsize(file) let sz = getfsize(filename)
let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz
" call Decho("exe keepjumps put ='".fsz.'/'.file."'") " call Decho("exe keepjumps put ='".fsz.'/'.filename."'")
let fszpfile= fsz.'/'.pfile let fszpfile= fsz.'/'.pfile
keepjumps put =fszpfile keepjumps put =fszpfile
@ -2287,6 +2255,7 @@ fun! LocalBrowseList(dirname)
keepjumps put=pfile keepjumps put=pfile
endif endif
endwhile endwhile
setlocal ts=32
" call Dret("LocalBrowseList") " call Dret("LocalBrowseList")
endfun endfun
@ -2305,6 +2274,8 @@ fun! <SID>LocalBrowseChgDir(dirname,newdir,...)
" is removing the "/". Bad idea, so I have to put it back. " is removing the "/". Bad idea, so I have to put it back.
let dirname= dirname.'/' let dirname= dirname.'/'
" call Decho("adjusting dirname<".dirname.">") " call Decho("adjusting dirname<".dirname.">")
setlocal ma
%d
endif endif
if newdir !~ '[\/]$' if newdir !~ '[\/]$'
@ -2313,24 +2284,28 @@ fun! <SID>LocalBrowseChgDir(dirname,newdir,...)
" call Decho("handling a file: dirname<".dirname.">") " call Decho("handling a file: dirname<".dirname.">")
" this lets NetBrowseX avoid the edit " this lets NetBrowseX avoid the edit
if a:0 < 1 if a:0 < 1
exe "e ".escape(dirname,s:netrw_cd_escape) " call Decho("dirname<".dirname."> netrw_cd_escape<".s:netrw_cd_escape.">")
" call Decho("about to edit<".escape(dirname,s:netrw_cd_escape).">")
exe "e! ".escape(dirname,s:netrw_cd_escape)
endif endif
elseif newdir == './' elseif newdir == './'
" refresh the directory list " refresh the directory list
" call Decho("refresh directory listing") " call Decho("refresh directory listing")
setlocal ma
%d
elseif newdir == '../' elseif newdir == '../'
" go up one directory " go up one directory
let dirname= substitute(dirname,'^\(.*/\)\([^/]\+[\/]$\)','\1','e') let dirname= substitute(dirname,'^\(.*/\)\([^/]\+[\/]$\)','\1','e')
" call Decho("go up one dir: dirname<".dirname.">") " call Decho("go up one dir: dirname<".dirname.">")
setlocal ma
%d
else else
" go down one directory " go down one directory
let dirname= dirname.newdir let dirname= dirname.newdir
" call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">") " call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">")
setlocal ma
%d
endif endif
" call Dret("LocalBrowseChgDir <".dirname.">") " call Dret("LocalBrowseChgDir <".dirname.">")
@ -2364,7 +2339,7 @@ fun! <SID>LocalBrowseRm(path) range
endif endif
norm! 0 norm! 0
let rmfile= a:path.curword let rmfile= a:path."/".curword
" call Decho("rmfile<".rmfile.">") " call Decho("rmfile<".rmfile.">")
if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$') if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$')
@ -2417,11 +2392,11 @@ fun! <SID>LocalBrowseRm(path) range
" call Decho("3rd attempt to remove directory<".rmfile.">") " call Decho("3rd attempt to remove directory<".rmfile.">")
call system("rm ".rmfile) call system("rm ".rmfile)
if v:shell_error != 0 && !exists("g:netrw_quiet") if v:shell_error != 0 && !exists("g:netrw_quiet")
echoerr "unable to remove directory<".rmfile."> -- is it empty?" echoerr "***netrw*** unable to remove directory<".rmfile."> -- is it empty?"
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
elseif !exists("g:netrw_quiet") elseif !exists("g:netrw_quiet")
echoerr "unable to remove directory<".rmfile."> -- is it empty?" echoerr "***netrw*** unable to remove directory<".rmfile."> -- is it empty?"
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
endif endif
@ -2475,8 +2450,8 @@ fun! <SID>LocalBrowseRename(path) range
let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e')) let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e'))
call inputrestore() call inputrestore()
let ret= system(g:netrw_local_rename.' "'.oldname.'" "'.newname.'"') let ret= rename(oldname,newname)
" call Decho("executing system(".g:netrw_local_rename." ".oldname." ".newname) " call Decho("renaming <".oldname."> to <".newname.">")
let ctr= ctr + 1 let ctr= ctr + 1
endwhile endwhile
@ -2497,16 +2472,54 @@ fun! <SID>LocalPreview(path) range
if !isdirectory(a:path) if !isdirectory(a:path)
exe "pedit ".a:path exe "pedit ".a:path
elseif !exists("g:netrw_quiet") elseif !exists("g:netrw_quiet")
echoerr "sorry, cannot preview a directory such as <".a:path.">" echoerr "***netrw*** sorry, cannot preview a directory such as <".a:path.">"
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
elseif !exists("g:netrw_quiet") elseif !exists("g:netrw_quiet")
echoerr "sorry, to preview your vim needs the quickfix feature compiled in" echoerr "***netrw*** sorry, to preview your vim needs the quickfix feature compiled in"
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
" call Dret("LocalPreview") " call Dret("LocalPreview")
endfun endfun
" ---------------------------------------------------------------------
" Explore: launch the local browser in the directory of the current file {{{2
" dosplit==0: the window will be split iff the current file has
" been modified
" dosplit==1: the window will be split before running the local
" browser
fun! s:Explore(dosplit,style,...)
" call Dfunc("Explore(dosplit=".a:dosplit." style=".a:style.")")
" if dosplit or file has been modified
if a:dosplit || &modified
if a:style == 0 " Explore, Sexplore
exe g:netrw_winsize."wincmd s"
elseif a:style == 1 "Explore!, Sexplore!
exe g:netrw_winsize."wincmd v"
elseif a:style == 2 " Hexplore
exe "bel ".g:netrw_winsize."wincmd s"
elseif a:style == 3 " Hexplore!
exe "abo ".g:netrw_winsize."wincmd s"
elseif a:style == 4 " Vexplore
exe "lefta ".g:netrw_winsize."wincmd v"
elseif a:style == 5 " Vexplore!
exe "rightb ".g:netrw_winsize."wincmd v"
endif
endif
norm! 0
if a:1 == ""
let newdir= substitute(expand("%:p"),'^\(.*\)[/\\][^/\\]*$','\1','e')
else
let newdir= a:1
endif
" call Decho("newdir<".newdir.">")
call s:LocalBrowse(newdir)
" call Dret("Explore")
endfun
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" NetGetcwd: get the current directory. {{{2 " NetGetcwd: get the current directory. {{{2
" Change backslashes to forward slashes, if any. " Change backslashes to forward slashes, if any.
@ -2559,7 +2572,7 @@ fun! s:NetMethod(choice) " globals: method machine id passwd fname
let mipf = '^\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)$' let mipf = '^\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)$'
let mf = '^\(\S\+\)\s\+\(\S\+\)$' let mf = '^\(\S\+\)\s\+\(\S\+\)$'
let ftpurm = '^ftp://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$' let ftpurm = '^ftp://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$'
let rcpurm = '^rcp://\(\([^/@]\{-}\)@\)\=\([^/]\{-}\)/\(.*\)$' let rcpurm = '^rcp://\%(\([^/@]\{-}\)@\)\=\([^/]\{-}\)/\(.*\)$'
let rcphf = '^\(\(\h\w*\)@\)\=\(\h\w*\):\([^@]\+\)$' let rcphf = '^\(\(\h\w*\)@\)\=\(\h\w*\):\([^@]\+\)$'
let scpurm = '^scp://\([^/]\{-}\)\([#:]\d\+\)\=/\(.*\)$' let scpurm = '^scp://\([^/]\{-}\)\([#:]\d\+\)\=/\(.*\)$'
let httpurm = '^http://\([^/]\{-}\)\(/.*\)\=$' let httpurm = '^http://\([^/]\{-}\)\(/.*\)\=$'
@ -2574,9 +2587,9 @@ fun! s:NetMethod(choice) " globals: method machine id passwd fname
if match(a:choice,rcpurm) == 0 if match(a:choice,rcpurm) == 0
" call Decho("rcp://...") " call Decho("rcp://...")
let b:netrw_method = 1 let b:netrw_method = 1
let userid = substitute(a:choice,rcpurm,'\2',"") let userid = substitute(a:choice,rcpurm,'\1',"")
let g:netrw_machine= substitute(a:choice,rcpurm,'\3',"") let g:netrw_machine = substitute(a:choice,rcpurm,'\2',"")
let b:netrw_fname = substitute(a:choice,rcpurm,'\4',"") let b:netrw_fname = substitute(a:choice,rcpurm,'\3',"")
if userid != "" if userid != ""
let g:netrw_uid= userid let g:netrw_uid= userid
endif endif
@ -2585,7 +2598,7 @@ fun! s:NetMethod(choice) " globals: method machine id passwd fname
elseif match(a:choice,scpurm) == 0 elseif match(a:choice,scpurm) == 0
" call Decho("scp://...") " call Decho("scp://...")
let b:netrw_method = 4 let b:netrw_method = 4
let g:netrw_machine= substitute(a:choice,scpurm,'\1',"") let g:netrw_machine = substitute(a:choice,scpurm,'\1',"")
let g:netrw_port = substitute(a:choice,scpurm,'\2',"") let g:netrw_port = substitute(a:choice,scpurm,'\2',"")
let b:netrw_fname = substitute(a:choice,scpurm,'\3',"") let b:netrw_fname = substitute(a:choice,scpurm,'\3',"")
@ -2699,7 +2712,7 @@ fun! s:NetMethod(choice) " globals: method machine id passwd fname
else else
if !exists("g:netrw_quiet") if !exists("g:netrw_quiet")
echoerr "***error*** cannot determine method" echoerr "***netrw*** cannot determine method"
call inputsave()|call input("Press <cr> to continue")|call inputrestore() call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif endif
let b:netrw_method = -1 let b:netrw_method = -1
@ -2840,8 +2853,9 @@ endif
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" NetSort: Piet Delport's BISort2() function, modified to take a range {{{1 " NetSort: Piet Delport's BISort2() function, modified to take a range {{{1
fun! <SID>NetSort() range if v:version < 700
" call Dfunc("NetSort()") fun! <SID>NetSort() range
" " call Dfunc("NetSort()")
let i = a:firstline + 1 let i = a:firstline + 1
while i <= a:lastline while i <= a:lastline
@ -2878,8 +2892,9 @@ fun! <SID>NetSort() range
let i = i + 1 let i = i + 1
endwhile endwhile
" call Dret("NetSort") " " call Dret("NetSort")
endfun endfun
endif
" --------------------------------------------------------------------- " ---------------------------------------------------------------------
" SetSort: sets up the sort based on the g:netrw_sort_sequence {{{1 " SetSort: sets up the sort based on the g:netrw_sort_sequence {{{1
@ -2938,8 +2953,8 @@ fun! <SID>SetSort()
" call Dret("SetSort") " call Dret("SetSort")
endfun endfun
let &cpo= s:keepcpo
unlet s:keepcpo
" ------------------------------------------------------------------------ " ------------------------------------------------------------------------
" Restore {{{1 " Modelines: {{{1
let &cpo= s:save_cpo
unlet s:save_cpo
" vim:ts=8 fdm=marker " vim:ts=8 fdm=marker

View File

@ -1384,7 +1384,7 @@ vim_strncpy(to, from, len)
/* /*
* Isolate one part of a string option where parts are separated with * Isolate one part of a string option where parts are separated with
* "sep_chars". * "sep_chars".
* The part is copied into buf[maxlen]. * The part is copied into "buf[maxlen]".
* "*option" is advanced to the next part. * "*option" is advanced to the next part.
* The length is returned. * The length is returned.
*/ */

View File

@ -36,5 +36,5 @@
#define VIM_VERSION_NODOT "vim70aa" #define VIM_VERSION_NODOT "vim70aa"
#define VIM_VERSION_SHORT "7.0aa" #define VIM_VERSION_SHORT "7.0aa"
#define VIM_VERSION_MEDIUM "7.0aa ALPHA" #define VIM_VERSION_MEDIUM "7.0aa ALPHA"
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Jul 31)" #define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 1)"
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Jul 31, compiled " #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Aug 1, compiled "