annotate runtime/autoload/netrw.vim @ 842:a209672376fd v7.0f

updated for version 7.0f
author vimboss
date Mon, 24 Apr 2006 19:47:27 +0000
parents c2cae213194d
children d3bbb5dd3913
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1 " netrw.vim: Handles file transfer and remote directory listing across a network
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2 " AUTOLOAD PORTION
842
a209672376fd updated for version 7.0f
vimboss
parents: 841
diff changeset
3 " Date: Apr 24, 2006
a209672376fd updated for version 7.0f
vimboss
parents: 841
diff changeset
4 " Version: 93
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
5 " Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
6 " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
7 " Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
8 " Permission is hereby granted to use and distribute this code,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
9 " with or without modifications, provided that this copyright
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
10 " notice is copied with it. Like anything else that's free,
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
11 " netrw.vim, netrwPlugin.vim, and netrwSettings.vim are provided
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
12 " *as is* and comes with no warranty of any kind, either
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
13 " expressed or implied. By using this plugin, you agree that
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
14 " in no event will the copyright holder be liable for any damages
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
15 " resulting from the use of this software.
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
16 " of this software.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
17 "
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
18 " But be doers of the Word, and not only hearers, deluding your own selves {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
19 " (James 1:22 RSV)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
20 " =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
21
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
22 " Exception for &cp: {{{1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
23 if &cp || exists("g:loaded_netrw")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
24 finish
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
25 endif
842
a209672376fd updated for version 7.0f
vimboss
parents: 841
diff changeset
26 let g:loaded_netrw = "v93"
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
27 if v:version < 700
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
28 echohl WarningMsg | echo "***netrw*** you need vim version 7.0 or later for version ".g:loaded_netrw." of netrw" | echohl None
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
29 finish
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
30 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
31 let s:keepcpo= &cpo
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
32 set cpo&vim
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
33 " call Decho("doing autoload/netrw.vim")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
34
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
35 " ======================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
36 " Netrw Variables: {{{1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
37 " ======================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
38
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
39 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
40 " Default values for netrw's global protocol variables {{{2
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
41 if !exists("g:netrw_dav_cmd")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
42 let g:netrw_dav_cmd = "cadaver"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
43 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
44 if !exists("g:netrw_fetch_cmd")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
45 if executable("fetch")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
46 let g:netrw_fetch_cmd = "fetch -o"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
47 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
48 let g:netrw_fetch_cmd = ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
49 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
50 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
51 if !exists("g:netrw_ftp_cmd")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
52 let g:netrw_ftp_cmd = "ftp"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
53 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
54 if !exists("g:netrw_http_cmd")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
55 if executable("wget")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
56 let g:netrw_http_cmd = "wget -q -O"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
57 elseif executable("fetch")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
58 let g:netrw_http_cmd = "fetch -o"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
59 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
60 let g:netrw_http_cmd = ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
61 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
62 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
63 if !exists("g:netrw_rcp_cmd")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
64 let g:netrw_rcp_cmd = "rcp"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
65 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
66 if !exists("g:netrw_rsync_cmd")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
67 let g:netrw_rsync_cmd = "rsync"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
68 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
69 if !exists("g:netrw_scp_cmd")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
70 let g:netrw_scp_cmd = "scp -q"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
71 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
72 if !exists("g:netrw_sftp_cmd")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
73 let g:netrw_sftp_cmd = "sftp"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
74 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
75 if !exists("g:netrw_ssh_cmd")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
76 let g:netrw_ssh_cmd= "ssh"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
77 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
78
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
79 if (has("win32") || has("win95") || has("win64") || has("win16"))
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
80 \ && exists("g:netrw_use_nt_rcp")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
81 \ && g:netrw_use_nt_rcp
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
82 \ && executable( $SystemRoot .'/system32/rcp.exe')
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
83 let s:netrw_has_nt_rcp = 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
84 let s:netrw_rcpmode = '-b'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
85 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
86 let s:netrw_has_nt_rcp = 0
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
87 let s:netrw_rcpmode = ''
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
88 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
89
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
90 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
91 " Default values for netrw's global variables {{{2
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
92 " Default values - a-c ---------- {{{3
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
93 if !exists("g:netrw_alto")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
94 let g:netrw_alto= 0
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
95 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
96 if !exists("g:netrw_altv")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
97 let g:netrw_altv= 0
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
98 endif
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
99 if !exists("g:netrw_browse_split")
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
100 let g:netrw_browse_split= 0
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
101 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
102 if !exists("g:netrw_cygwin")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
103 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
104 if &shell == "bash"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
105 let g:netrw_cygwin= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
106 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
107 let g:netrw_cygwin= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
108 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
109 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
110 let g:netrw_cygwin= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
111 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
112 endif
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
113 " Default values - d-f ---------- {{{3
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
114 if !exists("g:NETRW_DIRHIST_CNT")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
115 let g:NETRW_DIRHIST_CNT= 0
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
116 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
117 if !exists("g:netrw_dirhistmax")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
118 let g:netrw_dirhistmax= 10
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
119 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
120 if !exists("g:netrw_ftp_browse_reject")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
121 let g:netrw_ftp_browse_reject='^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$'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
122 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
123 if !exists("g:netrw_ftp_list_cmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
124 if has("unix") || exists("g:netrw_cygwin")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
125 let g:netrw_ftp_list_cmd= "ls -lF"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
126 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
127 let g:netrw_ftp_list_cmd= "dir"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
128 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
129 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
130 if !exists("g:netrw_ftpmode")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
131 let g:netrw_ftpmode= "binary"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
132 endif
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
133 " Default values - h-lh ---------- {{{3
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
134 if !exists("g:netrw_hide")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
135 let g:netrw_hide= 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
136 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
137 if !exists("g:netrw_keepdir")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
138 let g:netrw_keepdir= 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
139 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
140 if !exists("g:netrw_list_cmd")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
141 if executable(g:netrw_ssh_cmd)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
142 " provide a default listing command
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
143 let g:netrw_list_cmd= g:netrw_ssh_cmd." HOSTNAME ls -FLa"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
144 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
145 " call Decho(g:netrw_ssh_cmd." is not executable, can't do remote directory exploring)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
146 let g:netrw_list_cmd= ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
147 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
148 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
149 if !exists("g:netrw_list_hide")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
150 let g:netrw_list_hide= ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
151 endif
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
152 " Default values - lh-lz ---------- {{{3
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
153 if !exists("g:netrw_local_mkdir")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
154 let g:netrw_local_mkdir= "mkdir"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
155 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
156 if !exists("g:netrw_local_rmdir")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
157 let g:netrw_local_rmdir= "rmdir"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
158 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
159 if !exists("g:netrw_longlist")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
160 let g:netrw_longlist= 0
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
161 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
162 if g:netrw_longlist < 0 || g:netrw_longlist > 2
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
163 " sanity check
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
164 let g:netrw_longlist= 0
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
165 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
166 if g:netrw_longlist == 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
167 let g:netrw_list_cmd= g:netrw_list_cmd." -l"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
168 endif
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
169 " Default values - m-r ---------- {{{3
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
170 if !exists("g:netrw_maxfilenamelen")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
171 let g:netrw_maxfilenamelen= 32
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
172 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
173 if !exists("g:netrw_mkdir_cmd")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
174 let g:netrw_mkdir_cmd= g:netrw_ssh_cmd." HOSTNAME mkdir"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
175 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
176 if !exists("g:netrw_rename_cmd")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
177 let g:netrw_rename_cmd= g:netrw_ssh_cmd." HOSTNAME mv"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
178 endif
557
862863033fdd updated for version 7.0158
vimboss
parents: 554
diff changeset
179 if !exists("g:netrw_rm_cmd")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
180 let g:netrw_rm_cmd = g:netrw_ssh_cmd." HOSTNAME rm"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
181 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
182 if !exists("g:netrw_rmdir_cmd")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
183 let g:netrw_rmdir_cmd = g:netrw_ssh_cmd." HOSTNAME rmdir"
554
917c4fda217f updated for version 7.0157
vimboss
parents: 534
diff changeset
184 endif
557
862863033fdd updated for version 7.0158
vimboss
parents: 554
diff changeset
185 if !exists("g:netrw_rmf_cmd")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
186 let g:netrw_rmf_cmd = g:netrw_ssh_cmd." HOSTNAME rm -f"
554
917c4fda217f updated for version 7.0157
vimboss
parents: 534
diff changeset
187 endif
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
188 " Default values - s ---------- {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
189 if exists("g:netrw_silent") && g:netrw_silent != 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
190 let g:netrw_silentxfer= "silent "
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
191 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
192 let g:netrw_silentxfer= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
193 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
194 if !exists("g:netrw_fastbrowse")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
195 let g:netrw_fastbrowse= 1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
196 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
197 if !exists("g:netrw_sort_by")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
198 " alternatives: date size
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
199 let g:netrw_sort_by= "name"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
200 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
201 if !exists("g:netrw_sort_direction")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
202 " alternative: reverse (z y x ...)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
203 let g:netrw_sort_direction= "normal"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
204 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
205 if !exists("g:netrw_sort_sequence")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
206 let g:netrw_sort_sequence= '[\/]$,*,\.bak$,\.o$,\.h$,\.info$,\.swp$,\.obj$'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
207 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
208 if !exists("g:netrw_ssh_browse_reject")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
209 let g:netrw_ssh_browse_reject='^total\s\+\d\+$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
210 endif
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
211 " Default values - t-w ---------- {{{3
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
212 if !exists("g:netrw_timefmt")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
213 let g:netrw_timefmt= "%c"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
214 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
215 if !exists("g:netrw_win95ftp")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
216 let g:netrw_win95ftp= 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
217 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
218 if !exists("g:netrw_winsize")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
219 let g:netrw_winsize= ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
220 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
221 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
222 " Default values for netrw's script variables: {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
223 if !exists("s:netrw_cd_escape")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
224 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
225 let s:netrw_cd_escape="#% "
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
226 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
227 let s:netrw_cd_escape="[]#*$%'\" ?`!&();<>\\"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
228 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
229 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
230 if !exists("g:netrw_fname_escape")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
231 let g:netrw_fname_escape= ' ?&;'
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
232 endif
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
233 if !exists("g:netrw_tmpfile_escape")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
234 let g:netrw_tmpfile_escape= ' ?&;'
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
235 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
236 if !exists("s:netrw_glob_escape")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
237 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
238 let s:netrw_glob_escape= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
239 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
240 let s:netrw_glob_escape= '[]*?`{~$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
241 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
242 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
243
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
244 " BufEnter event ignored by decho when following variable is true
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
245 " Has a side effect that doau BufReadPost doesn't work, so
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
246 " files read by network transfer aren't appropriately highlighted.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
247 "let g:decho_bufenter = 1 "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
248
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
249 " ==============================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
250 " Netrw Utility Functions: {{{1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
251 " ==============================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
252
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
253 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
254 " NetSavePosn: saves position of cursor on screen {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
255 fun! netrw#NetSavePosn()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
256 " call Dfunc("NetSavePosn()")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
257 " Save current line and column
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
258 let w:netrw_winnr= winnr()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
259 let w:netrw_line = line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
260 let w:netrw_col = virtcol(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
261
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
262 " Save top-of-screen line
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
263 norm! H0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
264 let w:netrw_hline= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
265
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
266 call netrw#NetRestorePosn()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
267 " call Dret("NetSavePosn : winnr=".w:netrw_winnr." line=".w:netrw_line." col=".w:netrw_col." hline=".w:netrw_hline)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
268 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
269
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
270 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
271 " NetRestorePosn: restores the cursor and file position as saved by NetSavePosn() {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
272 fun! netrw#NetRestorePosn()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
273 " call Dfunc("NetRestorePosn() winnr=".w:netrw_winnr." line=".w:netrw_line." col=".w:netrw_col." hline=".w:netrw_hline)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
274 let eikeep= &ei
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
275 set ei=all
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
276
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
277 " restore window
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
278 " call Decho("restore window: exe silent! ".w:netrw_winnr."wincmd w")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
279 exe "silent! ".w:netrw_winnr."wincmd w"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
280 " if v:shell_error == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
281 " " as suggested by Bram M: redraw on no error
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
282 " " allows protocol error messages to remain visible
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
283 " redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
284 " endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
285
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
286 " restore top-of-screen line
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
287 " call Decho("restore topofscreen: exe norm! ".w:netrw_hline."G0z")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
288 exe "norm! ".w:netrw_hline."G0z\<CR>"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
289
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
290 " restore position
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
291 " call Decho("restore posn: exe norm! ".w:netrw_line."G0".w:netrw_col."|")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
292 exe "norm! ".w:netrw_line."G0".w:netrw_col."\<bar>"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
293
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
294 let &ei= eikeep
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
295 " call Dret("NetRestorePosn")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
296 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
297
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
298 " ===============================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
299 " Netrw Transfer Functions: {{{1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
300 " ===============================
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
301
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
302 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
303 " NetRead: responsible for reading a file over the net {{{2
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
304 fun! netrw#NetRead(mode,...)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
305 " call Dfunc("NetRead(mode=".a:mode.",...) a:0=".a:0)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
306
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
307 " save options
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
308 call s:NetOptionSave()
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
309
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
310 if a:mode == 0 " read remote file before current line
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
311 let readcmd = "0r"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
312 elseif a:mode == 1 " read file after current line
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
313 let readcmd = "r"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
314 elseif a:mode == 2 " replace with remote file
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
315 let readcmd = "%r"
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
316 else
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
317 exe a:mode
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
318 let readcmd = "r"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
319 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
320 let ichoice = (a:0 == 0)? 0 : 1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
321 " call Decho("readcmd<".readcmd."> ichoice=".ichoice)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
322
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
323 " get name of a temporary file and set up shell-quoting character {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
324 let tmpfile= tempname()
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
325 let tmpfile= escape(substitute(tmpfile,'\','/','ge'),g:netrw_tmpfile_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
326 if !isdirectory(substitute(tmpfile,'[^/]\+$','','e'))
568
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 559
diff changeset
327 echohl Error | echo "***netrw*** your <".substitute(tmpfile,'[^/]\+$','','e')."> directory is missing!" | echohl None
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
328 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
329 " call Dret("NetRead")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
330 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
331 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
332 " call Decho("tmpfile<".tmpfile.">")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
333
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
334 while ichoice <= a:0
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
335
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
336 " attempt to repeat with previous host-file-etc
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
337 if exists("b:netrw_lastfile") && a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
338 " call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
339 let choice = b:netrw_lastfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
340 let ichoice= ichoice + 1
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
341
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
342 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
343 exe "let choice= a:" . ichoice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
344 " call Decho("no lastfile: choice<" . choice . ">")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
345
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
346 if match(choice,"?") == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
347 " give help
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
348 echomsg 'NetRead Usage:'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
349 echomsg ':Nread machine:path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
350 echomsg ':Nread "machine path" uses ftp with <.netrc>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
351 echomsg ':Nread "machine id password path" uses ftp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
352 echomsg ':Nread dav://machine[:port]/path uses cadaver'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
353 echomsg ':Nread fetch://machine/path uses fetch'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
354 echomsg ':Nread ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
355 echomsg ':Nread http://[user@]machine/path uses http wget'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
356 echomsg ':Nread rcp://[user@]machine/path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
357 echomsg ':Nread rsync://machine[:port]/path uses rsync'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
358 echomsg ':Nread scp://[user@]machine[[:#]port]/path uses scp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
359 echomsg ':Nread sftp://[user@]machine[[:#]port]/path uses sftp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
360 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
361
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
362 elseif match(choice,"^\"") != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
363 " Reconstruct Choice if choice starts with '"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
364 " call Decho("reconstructing choice")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
365 if match(choice,"\"$") != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
366 " case "..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
367 let choice=strpart(choice,1,strlen(choice)-2)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
368 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
369 " case "... ... ..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
370 let choice = strpart(choice,1,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
371 let wholechoice = ""
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
372
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
373 while match(choice,"\"$") == -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
374 let wholechoice = wholechoice . " " . choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
375 let ichoice = ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
376 if ichoice > a:0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
377 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
378 echohl Error | echo "***netrw*** Unbalanced string in filename '". wholechoice ."'" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
379 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
380 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
381 " call Dret("NetRead")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
382 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
383 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
384 let choice= a:{ichoice}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
385 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
386 let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
387 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
388 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
389 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
390
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
391 " call Decho("choice<" . choice . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
392 let ichoice= ichoice + 1
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
393
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
394 " fix up windows urls
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
395 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
396 let choice = substitute(choice,'\\','/','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
397 " call Decho("fixing up windows url to <".choice."> tmpfile<".tmpfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
398
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
399 exe 'cd ' . fnamemodify(tmpfile,':h')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
400 let tmpfile = fnamemodify(tmpfile,':t')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
401 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
402
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
403 " Determine method of read (ftp, rcp, etc) {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
404 call s:NetMethod(choice)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
405
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
406 " Check if NetBrowse() should be handling this request
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 799
diff changeset
407 " call Decho("checking if NetBrowse() should handle choice<".choice."> with netrw_list_cmd<".g:netrw_list_cmd.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
408 if choice =~ "^.*[\/]$"
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 799
diff changeset
409 " call Decho("yes, choice matches '^.*[\/]$'")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
410 keepjumps call s:NetBrowse(choice)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
411 " call Dret("NetRead")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
412 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
413 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
414
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
415 " use filename's suffix for the temporary file
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
416 if b:netrw_fname =~ '\.[^./]\+$'
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
417 let suffix = substitute(b:netrw_fname,'^.*\(\.[^./]\+\)$','\1','e')
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
418 let tmpfile= substitute(tmpfile,"$",suffix,'e')
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
419 " call Decho("chgd tmpfile<".tmpfile."> (added ".suffix." suffix) netrw_fname<".b:netrw_fname.">")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
420 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
421
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
422 " ============
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
423 " Perform Protocol-Based Read {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
424 " ===========================
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
425 if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
426 echo "(netrw) Processing your read request..."
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
427 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
428
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
429 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
430 " rcp: NetRead Method #1 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
431 if b:netrw_method == 1 " read with rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
432 " call Decho("read via rcp (method #1)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
433 " ER: noting done with g:netrw_uid yet?
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
434 " ER: on Win2K" rcp machine[.user]:file tmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
435 " ER: if machine contains '.' adding .user is required (use $USERNAME)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
436 " ER: the tmpfile is full path: rcp sees C:\... as host C
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
437 if s:netrw_has_nt_rcp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
438 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
439 let uid_machine = g:netrw_machine .'.'. g:netrw_uid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
440 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
441 " Any way needed it machine contains a '.'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
442 let uid_machine = g:netrw_machine .'.'. $USERNAME
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
443 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
444 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
445 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
446 let uid_machine = g:netrw_uid .'@'. g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
447 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
448 let uid_machine = g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
449 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
450 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
451 " call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".uid_machine.":".escape(b:netrw_fname,' ?&;')." ".tmpfile)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
452 exe g:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".uid_machine.":".escape(b:netrw_fname,' ?&;')." ".tmpfile
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
453 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
454 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
455
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
456 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
457 " ftp + <.netrc>: NetRead Method #2 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
458 elseif b:netrw_method == 2 " read with ftp + <.netrc>
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
459 " call Decho("read via ftp+.netrc (method #2)")
820
57c7403f6599 updated for version 7.0c11
vimboss
parents: 819
diff changeset
460 let netrw_fname= b:netrw_fname
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
461 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
462 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
463 exe "put ='".g:netrw_ftpmode."'"
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
464 " call Decho("filter input: ".getline("."))
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
465 exe "put ='".'get \"'.netrw_fname.'\" '.tmpfile."'"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
466 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
467 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
468 " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
469 exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
470 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
471 " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
472 exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
473 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
474 " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
475 if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
476 let debugkeep= &debug
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
477 set debug=msg
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
478 echohl Error | echo "***netrw*** ".getline(1) | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
479 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
480 let &debug= debugkeep
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
481 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
482 bd!
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
483 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
484 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
485
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
486 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
487 " ftp + machine,id,passwd,filename: NetRead Method #3 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
488 elseif b:netrw_method == 3 " read with ftp + machine, id, passwd, and fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
489 " Construct execution string (four lines) which will be passed through filter
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
490 " call Decho("read via ftp+mipf (method #3)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
491 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
492 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
493 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
494 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
495 put ='open '.g:netrw_machine.' '.g:netrw_port
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
496 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
497 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
498 put ='open '.g:netrw_machine
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
499 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
500 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
501
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
502 if exists("g:netrw_ftp") && g:netrw_ftp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
503 put =g:netrw_uid
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
504 " call Decho("filter input: ".getline("."))
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
505 put ='\"'.g:netrw_passwd.'\"'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
506 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
507 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
508 put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
509 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
510 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
511
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
512 if exists("g:netrw_ftpmode") && g:netrw_ftpmode != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
513 put =g:netrw_ftpmode
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
514 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
515 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
516 put ='get \"'.netrw_fname.'\" '.tmpfile
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
517 " call Decho("filter input: ".getline("."))
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
518
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
519 " perform ftp:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
520 " -i : turns off interactive prompting from ftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
521 " -n unix : DON'T use <.netrc>, even though it exists
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
522 " -n win32: quit being obnoxious about password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
523 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
524 " call Decho("executing: %!".g:netrw_ftp_cmd." -i -n")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
525 exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
526 " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
527 if getline(1) !~ "^$"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
528 " call Decho("error<".getline(1).">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
529 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
530 echohl Error | echo "***netrw*** ".getline(1) | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
531 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
532 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
533 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
534 bd!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
535 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
536 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
537
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
538 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
539 " scp: NetRead Method #4 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
540 elseif b:netrw_method == 4 " read with scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
541 " call Decho("read via scp (method #4)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
542 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
543 let useport= " -P ".g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
544 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
545 let useport= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
546 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
547 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
548 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
549 " call Decho("executing: !".g:netrw_scp_cmd.useport." '".g:netrw_machine.":".escape(b:netrw_fname,g:netrw_fname_escape)."' ".cygtmpfile)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
550 exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." '".g:netrw_machine.":".escape(b:netrw_fname,g:netrw_fname_escape)."' ".cygtmpfile
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
551 else
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
552 " call Decho("executing: !".g:netrw_scp_cmd.useport." '".g:netrw_machine.":".escape(b:netrw_fname,g:netrw_fname_escape)."' ".tmpfile)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
553 exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." '".g:netrw_machine.":".escape(b:netrw_fname,g:netrw_fname_escape)."' ".tmpfile
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
554 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
555 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
556 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
557
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
558 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
559 " http: NetRead Method #5 (wget) {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
560 elseif b:netrw_method == 5
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
561 " call Decho("read via http (method #5)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
562 if g:netrw_http_cmd == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
563 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
564 echohl Error | echo "***netrw*** neither wget nor fetch command is available" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
565 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
566 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
567 " call Dret("NetRead")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
568 return
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
569 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
570
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
571 if match(b:netrw_fname,"#") == -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
572 " simple wget
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
573 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
574 " call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_fname)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
575 exe g:netrw_silentxfer."!".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_fname
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
576 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
577
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
578 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
579 " wget plus a jump to an in-page marker (ie. http://abc/def.html#aMarker)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
580 let netrw_html= substitute(netrw_fname,"#.*$","","")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
581 let netrw_tag = substitute(netrw_fname,"^.*#","","")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
582 " call Decho("netrw_html<".netrw_html.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
583 " call Decho("netrw_tag <".netrw_tag.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
584 " call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_html)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
585 exe g:netrw_silentxfer."!".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_html
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
586 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
587 " call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
588 exe 'norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\<CR>"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
589 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
590 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
591
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
592 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
593 " cadaver: NetRead Method #6 {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
594 elseif b:netrw_method == 6
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
595 " call Decho("read via cadaver (method #6)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
596
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
597 " Construct execution string (four lines) which will be passed through filter
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
598 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
599 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
600 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
601 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
602 put ='open '.g:netrw_machine.' '.g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
603 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
604 put ='open '.g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
605 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
606 put ='user '.g:netrw_uid.' '.g:netrw_passwd
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
607
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
608 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
609 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
610 put ='get '.netrw_fname.' '.cygtmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
611 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
612 put ='get '.netrw_fname.' '.tmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
613 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
614 put ='quit'
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
615
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
616 " perform cadaver operation:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
617 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
618 " call Decho("executing: %!".g:netrw_dav_cmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
619 exe g:netrw_silentxfer."%!".g:netrw_dav_cmd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
620 bd!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
621 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
622 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
623
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
624 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
625 " rsync: NetRead Method #7 {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
626 elseif b:netrw_method == 7
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
627 " call Decho("read via rsync (method #7)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
628 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
629 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
630 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
631 " call Decho("executing: !".g:netrw_rsync_cmd." ".g:netrw_machine.":".netrw_fname." ".cygtmpfile)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
632 exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".g:netrw_machine.":".netrw_fname." ".cygtmpfile
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
633 else
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
634 " call Decho("executing: !".g:netrw_rsync_cmd." ".g:netrw_machine.":".netrw_fname." ".tmpfile)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
635 exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".g:netrw_machine.":".netrw_fname." ".tmpfile
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
636 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
637 let result = s:NetGetFile(readcmd,tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
638 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
639
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
640 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
641 " fetch: NetRead Method #8 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
642 " fetch://[user@]host[:http]/path
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
643 elseif b:netrw_method == 8
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
644 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
645 if g:netrw_fetch_cmd == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
646 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
647 echohl Error | echo "***netrw*** fetch command not available" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
648 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
649 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
650 " call Dret("NetRead")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
651 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
652 if exists("g:netrw_option") && g:netrw_option == ":http"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
653 let netrw_option= "http"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
654 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
655 let netrw_option= "ftp"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
656 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
657 " call Decho("read via fetch for ".netrw_option)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
658
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
659 if exists("g:netrw_uid") && g:netrw_uid != "" && exists("g:netrw_passwd") && g:netrw_passwd != ""
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
660 " call Decho("executing: !".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_uid.':'.g:netrw_passwd.'@'.g:netrw_machine."/".netrw_fname)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
661 exe g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_uid.':'.g:netrw_passwd.'@'.g:netrw_machine."/".netrw_fname
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
662 else
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
663 " call Decho("executing: !".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_machine."/".netrw_fname)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
664 exe g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_machine."/".netrw_fname
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
665 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
666
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
667 let result = s:NetGetFile(readcmd,tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
668 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
669
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
670 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
671 " sftp: NetRead Method #9 {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
672 elseif b:netrw_method == 9
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
673 " call Decho("read via sftp (method #4)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
674 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
675 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
676 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
677 " call Decho("!".g:netrw_sftp_cmd." ".g:netrw_machine.":".netrw_fname." ".cygtmpfile)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
678 " call Decho("executing: !".g:netrw_sftp_cmd." ".g:netrw_machine.":".netrw_fname." ".cygtmpfile)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
679 exe "!".g:netrw_sftp_cmd." ".g:netrw_machine.":".netrw_fname." ".cygtmpfile
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
680 else
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
681 " call Decho("executing: !".g:netrw_sftp_cmd." ".g:netrw_machine.":".netrw_fname." ".tmpfile)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
682 exe g:netrw_silentxfer."!".g:netrw_sftp_cmd." ".g:netrw_machine.":".netrw_fname." ".tmpfile
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
683 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
684 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
685 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
686
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
687 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
688 " Complain {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
689 else
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
690 echo "***warning*** unable to comply with your request<" . choice . ">"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
691 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
692 endwhile
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
693
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
694 " cleanup {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
695 " call Decho("cleanup")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
696 if exists("b:netrw_method")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
697 unlet b:netrw_method
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
698 unlet b:netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
699 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
700 call s:NetOptionRestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
701
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
702 " call Dret("NetRead")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
703 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
704
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
705 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
706 " NetGetFile: Function to read temporary file "tfile" with command "readcmd". {{{2
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
707 " readcmd == %r : replace buffer with newly read file
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
708 " == 0r : read file at top of buffer
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
709 " == r : read file after current line
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
710 fun! s:NetGetFile(readcmd, tfile, method)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
711 " call Dfunc("NetGetFile(readcmd<".a:readcmd.">,tfile<".a:tfile."> method<".a:method.">)")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
712
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
713 " get name of remote filename (ie. url and all)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
714 let rfile= bufname("%")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
715 " call Decho("rfile<".rfile.">")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
716
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
717 if exists("*NetReadFixup")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
718 " for the use of NetReadFixup (not otherwise used internally)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
719 let line2= line("$")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
720 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
721
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
722 " transform paths from / to \ for Windows (except for cygwin)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
723 if &term == "win32"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
724 if g:netrw_cygwin
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
725 let tfile= a:tfile
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
726 " call Decho("(win32 && cygwin) tfile<".tfile.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
727 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
728 let tfile= substitute(a:tfile,'/','\\\\','ge')
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
729 " call Decho("(win32 && !cygwin) tfile<".tfile.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
730 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
731 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
732 let tfile= a:tfile
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
733 " call Decho("tfile=a:tfile<".tfile.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
734 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
735
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
736 if a:readcmd[0] == '%'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
737 " get file into buffer
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
738
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
739 " call Dredir("ls!","starting buffer list")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
740
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
741 " rename the current buffer to the temp file (ie. tfile)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
742 keepalt exe "file ".tfile
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
743 " call Dredir("ls!","after renaming current buffer to <".tfile.">")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
744
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
745 " edit temporary file (ie. read the temporary file in)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
746 if rfile =~ '\.zip$'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
747 call zip#Browse(tfile)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
748 elseif rfile =~ '\.tar$'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
749 call tar#Browse(tfile)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
750 else
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
751 " call Decho("edit temporary file")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
752 e
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
753 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
754
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
755 " rename buffer back to remote filename
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
756 keepalt exe "file ".escape(rfile,' ')
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
757 filetype detect
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
758 " call Dredir("ls!","renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
759 let line1 = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
760 let line2 = line("$")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
761
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
762 elseif filereadable(tfile)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
763 " read file after current line
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
764 let curline = line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
765 let lastline= line("$")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
766 " call Decho("exe<".a:readcmd." ".v:cmdarg." ".tfile."> line#".curline)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
767 exe a:readcmd." ".v:cmdarg." ".tfile
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
768 let line1= curline + 1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
769 let line2= line("$") - lastline + 1
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
770
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
771 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
772 " not readable
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
773 echohl WarningMsg | echo "***netrw*** file <".tfile."> not readable"| echohl None
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
774 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
775 " call Dret("NetGetFile : tfile<".tfile."> not readable")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
776 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
777 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
778
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
779 " User-provided (ie. optional) fix-it-up command
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
780 if exists("*NetReadFixup")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
781 " call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
782 call NetReadFixup(a:method, line1, line2)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
783 " else " Decho
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 799
diff changeset
784 " call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
785 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
786
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
787 " update the Buffers menu
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
788 if has("gui") && has("gui_running")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
789 silent! emenu Buffers.Refresh\ menu
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
790 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
791
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
792 " call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> tfile<".a:tfile."> readable=".filereadable(a:tfile))
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
793
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
794 " make sure file is being displayed
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
795 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
796 " call Dret("NetGetFile")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
797 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
798
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
799 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
800 " NetWrite: responsible for writing a file over the net {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
801 fun! netrw#NetWrite(...) range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
802 " call Dfunc("NetWrite(a:0=".a:0.")")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
803
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
804 " option handling
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
805 let mod= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
806 call s:NetOptionSave()
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
807
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
808 " Get Temporary Filename {{{3
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
809 let tmpfile= escape(tempname(),g:netrw_tmpfile_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
810 if !isdirectory(substitute(tmpfile,'[^/]\+$','','e'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
811 echohl Error | echo "***netrw*** your ".substitute(tmpfile,'[^/]\+$','','e')." directory is missing!"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
812 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
813 " call Dret("NetWrite")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
814 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
815 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
816
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
817 if a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
818 let ichoice = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
819 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
820 let ichoice = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
821 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
822
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
823 if &binary
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
824 " for binary writes, write entire file. Line numbers don't really make sense.
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
825 " Supports the writing of tar and zip files.
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
826 " call Decho("silent exe w! ".v:cmdarg." ".tmpfile)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
827 silent exe "w! ".v:cmdarg." ".tmpfile
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
828 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
829 " write (selected portion of) file to temporary
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
830 " call Decho("silent exe ".a:firstline."," . a:lastline . "w! ".v:cmdarg." ".tmpfile)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
831 silent exe a:firstline."," . a:lastline . "w! ".v:cmdarg." ".tmpfile
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
832 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
833
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
834 while ichoice <= a:0
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
835
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
836 " Process arguments: {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
837 " attempt to repeat with previous host-file-etc
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
838 if exists("b:netrw_lastfile") && a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
839 " call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
840 let choice = b:netrw_lastfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
841 let ichoice= ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
842 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
843 exe "let choice= a:" . ichoice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
844
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
845 " Reconstruct Choice if choice starts with '"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
846 if match(choice,"?") == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
847 echomsg 'NetWrite Usage:"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
848 echomsg ':Nwrite machine:path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
849 echomsg ':Nwrite "machine path" uses ftp with <.netrc>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
850 echomsg ':Nwrite "machine id password path" uses ftp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
851 echomsg ':Nwrite dav://[user@]machine/path uses cadaver'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
852 echomsg ':Nwrite fetch://[user@]machine/path uses fetch'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
853 echomsg ':Nwrite ftp://machine[#port]/path uses ftp (autodetects <.netrc>)'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
854 echomsg ':Nwrite rcp://machine/path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
855 echomsg ':Nwrite rsync://[user@]machine/path uses rsync'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
856 echomsg ':Nwrite scp://[user@]machine[[:#]port]/path uses scp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
857 echomsg ':Nwrite sftp://[user@]machine/path uses sftp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
858 break
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
859
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
860 elseif match(choice,"^\"") != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
861 if match(choice,"\"$") != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
862 " case "..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
863 let choice=strpart(choice,1,strlen(choice)-2)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
864 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
865 " case "... ... ..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
866 let choice = strpart(choice,1,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
867 let wholechoice = ""
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
868
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
869 while match(choice,"\"$") == -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
870 let wholechoice= wholechoice . " " . choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
871 let ichoice = ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
872 if choice > a:0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
873 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
874 echohl Error | echo "***netrw*** Unbalanced string in filename '". wholechoice ."'" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
875 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
876 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
877 " call Dret("NetWrite")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
878 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
879 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
880 let choice= a:{ichoice}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
881 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
882 let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
883 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
884 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
885 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
886 " call Decho("choice<" . choice . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
887 let ichoice= ichoice + 1
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
888
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
889 " fix up windows urls
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
890 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
891 let choice= substitute(choice,'\\','/','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
892 "ER: see NetRead()
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
893 exe 'cd ' . fnamemodify(tmpfile,':h')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
894 let tmpfile = fnamemodify(tmpfile,':t')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
895 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
896
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
897 " Determine method of read (ftp, rcp, etc) {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
898 call s:NetMethod(choice)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
899
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
900 " =============
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
901 " Perform Protocol-Based Write {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
902 " ============================
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
903 if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
904 echo "(netrw) Processing your write request..."
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
905 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
906
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
907 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
908 " rcp: NetWrite Method #1 {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
909 if b:netrw_method == 1
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
910 " call Decho("write via rcp (method #1)")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
911 if s:netrw_has_nt_rcp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
912 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
913 let uid_machine = g:netrw_machine .'.'. g:netrw_uid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
914 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
915 let uid_machine = g:netrw_machine .'.'. $USERNAME
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
916 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
917 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
918 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
919 let uid_machine = g:netrw_uid .'@'. g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
920 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
921 let uid_machine = g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
922 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
923 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
924 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
925 " call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".tmpfile." ".uid_machine.":".netrw_fname)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
926 exe g:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".tmpfile." ".uid_machine.":".netrw_fname
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
927 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
928
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
929 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
930 " ftp + <.netrc>: NetWrite Method #2 {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
931 elseif b:netrw_method == 2
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
932 let netrw_fname= b:netrw_fname
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
933 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
934 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
935 exe "put ='".g:netrw_ftpmode."'"
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
936 " call Decho(" filter input: ".getline("."))
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
937 exe "put ='"."put ".tmpfile.' \"'.netrw_fname.'\"'."'"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
938 " call Decho(" filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
939 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
940 " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
941 exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
942 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
943 " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
944 exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
945 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
946 " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
947 if getline(1) !~ "^$"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
948 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
949 echohl Error | echo "***netrw*** ".getline(1) | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
950 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
951 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
952 let mod=1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
953 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
954 bd!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
955 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
956
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
957 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
958 " ftp + machine, id, passwd, filename: NetWrite Method #3 {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
959 elseif b:netrw_method == 3
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
960 let netrw_fname= b:netrw_fname
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
961 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
962 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
963 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
964 put ='open '.g:netrw_machine.' '.g:netrw_port
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
965 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
966 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
967 put ='open '.g:netrw_machine
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
968 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
969 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
970 if exists("g:netrw_ftp") && g:netrw_ftp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
971 put =g:netrw_uid
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
972 " call Decho("filter input: ".getline("."))
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
973 put ='\"'.g:netrw_passwd.'\"'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
974 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
975 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
976 put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
977 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
978 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
979 put ='put '.tmpfile.' \"'.netrw_fname.'\"'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
980 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
981 " save choice/id/password for future use
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
982 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
983
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
984 " perform ftp:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
985 " -i : turns off interactive prompting from ftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
986 " -n unix : DON'T use <.netrc>, even though it exists
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
987 " -n win32: quit being obnoxious about password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
988 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
989 " call Decho("executing: %!".g:netrw_ftp_cmd." -i -n")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
990 exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
991 " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
992 if getline(1) !~ "^$"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
993 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
994 echohl Error | echo "***netrw*** ".getline(1) | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
995 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
996 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
997 let mod=1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
998 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
999 bd!
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1000
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1001 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1002 " scp: NetWrite Method #4 {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1003 elseif b:netrw_method == 4
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1004 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1005 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1006 let useport= " -P ".g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1007 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1008 let useport= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1009 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1010 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1011 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1012 " call Decho("executing: !".g:netrw_scp_cmd.useport." ".cygtmpfile." '".g:netrw_machine.":".netrw_fname."'")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1013 exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".cygtmpfile." '".g:netrw_machine.":".netrw_fname."'"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1014 else
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1015 " call Decho("executing: !".g:netrw_scp_cmd.useport." ".tmpfile." '".g:netrw_machine.":".netrw_fname."'")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1016 exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".tmpfile." '".g:netrw_machine.":".netrw_fname."'"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1017 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1018 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1019
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1020 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1021 " http: NetWrite Method #5 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1022 elseif b:netrw_method == 5
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1023 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1024 echohl Error | echo "***netrw*** currently <netrw.vim> does not support writing using http:" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1025 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1026 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1027
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1028 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1029 " dav: NetWrite Method #6 (cadaver) {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1030 elseif b:netrw_method == 6
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1031 " call Decho("write via cadaver (method #6)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1032
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1033 " Construct execution string (four lines) which will be passed through filter
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1034 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1035 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1036 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1037 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1038 put ='open '.g:netrw_machine.' '.g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1039 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1040 put ='open '.g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1041 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1042 put ='user '.g:netrw_uid.' '.g:netrw_passwd
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1043
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1044 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1045 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1046 put ='put '.cygtmpfile.' '.netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1047 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1048 put ='put '.tmpfile.' '.netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1049 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1050
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1051 " perform cadaver operation:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1052 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1053 " call Decho("executing: %!".g:netrw_dav_cmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1054 exe g:netrw_silentxfer."%!".g:netrw_dav_cmd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1055 bd!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1056 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1057
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1058 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1059 " rsync: NetWrite Method #7 {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1060 elseif b:netrw_method == 7
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1061 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1062 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1063 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1064 " call Decho("executing: !".g:netrw_rsync_cmd." ".cygtmpfile." ".g:netrw_machine.":".netrw_fname)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1065 exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".cygtmpfile." ".g:netrw_machine.":".netrw_fname
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1066 else
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1067 " call Decho("executing: !".g:netrw_rsync_cmd." ".tmpfile." ".g:netrw_machine.":".netrw_fname)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1068 exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".tmpfile." ".g:netrw_machine.":".netrw_fname
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1069 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1070 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1071
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1072 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1073 " sftp: NetWrite Method #9 {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1074 elseif b:netrw_method == 9
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1075 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1076 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1077 let uid_machine = g:netrw_uid .'@'. g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1078 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1079 let uid_machine = g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1080 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1081 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1082 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1083 put ='put '.tmpfile.' '.netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1084 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1085 " call Decho("executing: %!".g:netrw_sftp_cmd.' '.uid_machine)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1086 exe g:netrw_silentxfer."%!".g:netrw_sftp_cmd.' '.uid_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1087 bd!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1088 let b:netrw_lastfile= choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1089
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1090 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1091 " Complain {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1092 else
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1093 echo "***warning*** unable to comply with your request<" . choice . ">"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1094 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1095 endwhile
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1096
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1097 " cleanup {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1098 " call Decho("cleanup")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1099 let result=delete(tmpfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1100 call s:NetOptionRestore()
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1101
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1102 if a:firstline == 1 && a:lastline == line("$")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1103 let &mod= mod " usually equivalent to set nomod
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1104 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1105
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1106 " call Dret("NetWrite")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1107 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1108
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1109 " ===========================================
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1110 " Remote Directory Browsing Support: {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1111 " ===========================================
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1112
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1113 " ---------------------------------------------------------------------
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1114 " NetBrowse: This function uses the command in g:netrw_list_cmd to get a list {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1115 " of the contents of a remote directory. It is assumed that the
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1116 " g:netrw_list_cmd has a string, HOSTNAME, that needs to be substituted
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1117 " with the requested remote hostname first.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1118 fun! s:NetBrowse(dirname)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1119 if !exists("w:netrw_longlist")|let w:netrw_longlist= g:netrw_longlist|endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1120 " call Dfunc("NetBrowse(dirname<".a:dirname.">) longlist=".w:netrw_longlist)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1121
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1122 if exists("s:netrw_skipbrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1123 unlet s:netrw_skipbrowse
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1124 " call Dret("NetBrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1125 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1126 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1127
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1128 call s:NetOptionSave()
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1129
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1130 " sanity check
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1131 if exists("b:netrw_method") && b:netrw_method =~ '[235]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1132 " call Decho("b:netrw_method=".b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1133 if !executable("ftp")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1134 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1135 echohl Error | echo "***netrw*** this system doesn't support remote directory listing via ftp" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1136 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1137 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1138 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1139 " call Dret("NetBrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1140 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1141 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1142 elseif !exists("g:netrw_list_cmd") || g:netrw_list_cmd == ''
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1143 if !exists("g:netrw_quiet")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1144 echohl Error | echo "***netrw*** this system doesn't support remote directory listing via ".g:netrw_list_cmd | echohl None
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1145 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1146 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1147
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1148 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1149 " call Dret("NetBrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1150 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1151 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1152
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1153 " use buffer-oriented WinVars if buffer ones exist but window ones don't
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1154 call s:UseBufWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1155
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1156 " set up menus
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1157 let b:netrw_browser_active= 1
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
1158 call s:NetMenu(1)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1159
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1160 " make this buffer modifiable
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1161 setlocal ma nonu nowrap
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1162
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1163 " analyze a:dirname and g:netrw_list_cmd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1164 let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1165 let dirname = substitute(a:dirname,'\\','/','ge')
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1166 " call Decho("dirname<".dirname.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1167 if dirname !~ dirpat
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1168 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1169 echohl Error | echo "***netrw*** netrw doesn't understand your dirname<".dirname.">" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1170 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1171 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1172 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1173 " call Dret("NetBrowse : badly formatted dirname<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1174 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1175 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1176
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1177 let method = substitute(dirname,dirpat,'\1','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1178 let user = substitute(dirname,dirpat,'\2','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1179 let machine = substitute(dirname,dirpat,'\3','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1180 let path = substitute(dirname,dirpat,'\4','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1181 let fname = substitute(dirname,'^.*/\ze.','','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1182 " call Decho("set up method <".method .">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1183 " call Decho("set up user <".user .">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1184 " call Decho("set up machine<".machine.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1185 " call Decho("set up path <".path .">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1186 " call Decho("set up fname <".fname .">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1187
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1188 if method == "ftp" || method == "http"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1189 let method = "ftp"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1190 let listcmd = g:netrw_ftp_list_cmd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1191 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1192 let listcmd = substitute(g:netrw_list_cmd,'\<HOSTNAME\>',user.machine,'')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1193 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1194
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1195 if exists("b:netrw_method")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1196 " call Decho("setting w:netrw_method<".b:netrw_method.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1197 let w:netrw_method= b:netrw_method
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1198 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1199
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1200 " optionally sort by time (-t) or by size (-S)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1201 if listcmd == "dir" && g:netrw_sort_by =~ "^[ts]"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1202 echohl WarningMsg | echo "***netrw*** windows' ftp doesn't support time/size sorts (get cygwin, set g:netrw_cygwin)" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1203 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1204 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1205 if g:netrw_sort_by =~ "^t"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1206 let listcmd= listcmd."t"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1207 elseif g:netrw_sort_by =~ "^s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1208 let listcmd= listcmd."S"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1209 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1210 " optionally sort in reverse
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1211 if g:netrw_sort_direction =~ "^r" && listcmd == "dir"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1212 let listcmd= listcmd."r"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1213 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1214 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1215
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1216 " call Decho("set up listcmd<".listcmd.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1217 if fname =~ '@$' && fname !~ '^"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1218 " call Decho("attempt transfer of symlink as file")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1219 call s:NetBrowse(substitute(dirname,'@$','','e'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1220 redraw!
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1221 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1222 " call Dret("NetBrowse : symlink")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1223 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1224
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1225 elseif fname !~ '[\/]$' && fname !~ '^"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1226 " looks like a regular file, attempt transfer
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1227 " call Decho("attempt transfer as regular file<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1228
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1229 " remove any filetype indicator from end of dirname, except for the
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1230 " "this is a directory" indicator (/). There shouldn't be one of those,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1231 " anyway.
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1232 let path= substitute(path,'[*=@|]\r\=$','','e')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1233 " call Decho("new path<".path.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1234
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1235 " remote-read the requested file into current buffer
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
1236 mark '
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1237 keepjumps keepalt enew!
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1238 set ma
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1239 " call Decho("exe file ".method."://".user.machine."/".escape(path,s:netrw_cd_escape))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1240 exe "file ".method."://".user.machine."/".escape(path,s:netrw_cd_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1241 exe "silent doau BufReadPre ".fname
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1242 silent call netrw#NetRead(2,method."://".user.machine."/".path)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1243 exe "silent doau BufReadPost ".fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1244
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1245 " save certain window-oriented variables into buffer-oriented variables
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1246 call s:SetBufWinVars()
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1247 call s:NetOptionRestore()
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1248 setlocal nomod nowrap
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1249
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1250 " call Dret("NetBrowse : file<".fname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1251 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1252 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1253
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1254 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1255 " Perform Directory Listing:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1256 " call Decho("Perform directory listing...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1257 " set up new buffer and map
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1258 let bufname = method.'://'.user.machine.'/'.path
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1259 let bufnamenr = bufnr(bufname.'$')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1260 " call Decho("bufname<".bufname."> bufnamenr=".bufnamenr)
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
1261 mark '
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1262 if bufnamenr != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1263 " buffer already exists, switch to it!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1264 " call Decho("buffer already exists, switching to it")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1265 exe "b ".bufnamenr
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1266 if line("$") >= 5
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1267 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1268 " call Dret("NetBrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1269 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1270 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1271 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1272 " call Decho("generate a new buffer")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1273 keepjumps keepalt enew!
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1274 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1275
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1276 " rename file to reflect where its from
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1277 setlocal bt=nofile bh=wipe nobl noswf
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1278 exe "setlocal ts=".g:netrw_maxfilenamelen
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1279 " call Decho("exe file ".escape(bufname,s:netrw_cd_escape))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1280 exe 'file '.escape(bufname,s:netrw_cd_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1281 " call Decho("renaming file to bufname<".bufname.">")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1282 setlocal bt=nofile nobl nonu noswf
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1283 if g:netrw_fastbrowse >= 1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1284 setlocal bh=hide
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
1285 else
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
1286 setlocal bh=delete
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1287 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1288
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1289 " save current directory on directory history list
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1290 call s:NetBookmarkDir(3,expand("%"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1291
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1292 " set up buffer-local mappings
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1293 " call Decho("set up buffer-local mappings")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1294 nnoremap <buffer> <silent> <cr> :call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),<SID>NetGetWord()))<cr>
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1295 nnoremap <buffer> <silent> <c-l> :call <SID>NetRefresh(<SID>NetBrowseChgDir(expand("%"),'./'),0)<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1296 nnoremap <buffer> <silent> - :exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),'../'))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1297 nnoremap <buffer> <silent> a :let g:netrw_hide=(g:netrw_hide+1)%3<bar>exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),'./'))<cr>
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1298 if w:netrw_longlist != 2
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1299 nnoremap <buffer> <silent> b :<c-u>call <SID>NetBookmarkDir(0,expand("%"))<cr>
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1300 nnoremap <buffer> <silent> B :<c-u>call <SID>NetBookmarkDir(1,expand("%"))<cr>
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1301 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1302 nnoremap <buffer> <silent> Nb :<c-u>call <SID>NetBookmarkDir(0,expand("%"))<cr>
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1303 nnoremap <buffer> <silent> NB :<c-u>call <SID>NetBookmarkDir(0,expand("%"))<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1304 nnoremap <buffer> <silent> <c-h> :call <SID>NetHideEdit(0)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1305 nnoremap <buffer> <silent> i :call <SID>NetLongList(0)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1306 nnoremap <buffer> <silent> o :call <SID>NetSplit(0)<cr>
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1307 nnoremap <buffer> <silent> O :call netrw#NetObtain()<cr>
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1308 nnoremap <buffer> <silent> P :call <SID>NetPrevWinOpen(0)<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1309 nnoremap <buffer> <silent> q :<c-u>call <SID>NetBookmarkDir(2,expand("%"))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1310 nnoremap <buffer> <silent> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),'./'))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1311 nnoremap <buffer> <silent> s :call <SID>NetSaveWordPosn()<bar>let g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by =~ 't')? 'size' : 'name'<bar>exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),'./'))<bar>call <SID>NetRestoreWordPosn()<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1312 nnoremap <buffer> <silent> S :call <SID>NetSortSequence(0)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1313 nnoremap <buffer> <silent> u :<c-u>call <SID>NetBookmarkDir(4,expand("%"))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1314 nnoremap <buffer> <silent> U :<c-u>call <SID>NetBookmarkDir(5,expand("%"))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1315 nnoremap <buffer> <silent> v :call <SID>NetSplit(1)<cr>
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1316 nnoremap <buffer> <silent> x :call netrw#NetBrowseX(<SID>NetBrowseChgDir(expand("%"),<SID>NetGetWord()),1)<cr>
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1317 nnoremap <buffer> <silent> <2-leftmouse> :call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),<SID>NetGetWord()))<cr>
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1318 exe 'nnoremap <buffer> <silent> <del> :call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1319 exe 'vnoremap <buffer> <silent> <del> :call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1320 exe 'nnoremap <buffer> <silent> d :call <SID>NetMakeDir("'.user.machine.'")<cr>'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1321 exe 'nnoremap <buffer> <silent> D :call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1322 exe 'vnoremap <buffer> <silent> D :call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1323 exe 'nnoremap <buffer> <silent> R :call <SID>NetBrowseRename("'.user.machine.'","'.path.'")<cr>'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1324 exe 'vnoremap <buffer> <silent> R :call <SID>NetBrowseRename("'.user.machine.'","'.path.'")<cr>'
794
f19994020dad updated for version 7.0231
vimboss
parents: 766
diff changeset
1325 nnoremap <buffer> <F1> :he netrw-browse-cmds<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1326 setlocal ma nonu nowrap
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1327
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1328 " Set up the banner
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
1329 " call Decho("set up the banner: sortby<".g:netrw_sort_by."> method<".method."> direction<".g:netrw_sort_direction.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1330 keepjumps put ='\" ==========================================================================='
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1331 keepjumps put ='\" Netrw Remote Directory Listing (netrw '.g:loaded_netrw.')'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1332 keepjumps put ='\" '.bufname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1333 let w:netrw_bannercnt = 7
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1334 let sortby = g:netrw_sort_by
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1335 if g:netrw_sort_direction =~ "^r"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1336 let sortby = sortby." reversed"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1337 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1338
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1339 if g:netrw_sort_by =~ "^n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1340 " sorted by name
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1341 let w:netrw_bannercnt= w:netrw_bannercnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1342 keepjumps put ='\" Sorted by '.sortby
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1343 keepjumps put ='\" Sort sequence: '.g:netrw_sort_sequence
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1344 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1345 " sorted by size or date
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1346 keepjumps put ='\" Sorted by '.sortby
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1347 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1348 if g:netrw_list_hide != "" && g:netrw_hide
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1349 " call Decho("g:netrw_hide=".g:netrw_hide)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1350 if g:netrw_hide == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1351 keepjumps put ='\" Hiding: '.g:netrw_list_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1352 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1353 keepjumps put ='\" Showing: '.g:netrw_list_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1354 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1355 let w:netrw_bannercnt= w:netrw_bannercnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1356 endif
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 799
diff changeset
1357 keepjumps put ='\" Quick Help: <F1>:help -:go up dir D:delete R:rename s:sort-by x:exec'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1358 keepjumps put ='\" ==========================================================================='
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1359
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1360 " remote read the requested directory listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1361 " Use ftp if that was the file-transfer method selected, otherwise use ssh
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1362 " Note that not all ftp servers honor the options for ls
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1363 if method == "ftp"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1364 " use ftp to get remote file listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1365 " call Decho("use ftp to get remote file listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1366 call s:NetBrowseFtpCmd(path,listcmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1367 keepjumps 1d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1368
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1369 if w:netrw_longlist == 0 || w:netrw_longlist == 2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1370 " shorten the listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1371 " call Decho("generate short listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1372 exe "keepjumps ".w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1373
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1374 " cleanup
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1375 if g:netrw_ftp_browse_reject != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1376 exe "silent! g/".g:netrw_ftp_browse_reject."/keepjumps d"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1377 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1378 silent! keepjumps %s/\r$//e
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1379
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1380 " if there's no ../ listed, then put ./ and ../ in
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1381 let line1= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1382 keepjumps 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1383 silent keepjumps call search('^\.\.\/\%(\s\|$\)','W')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1384 let line2= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1385 if line2 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1386 keepjumps put='../'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1387 keepjumps put='./'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1388 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1389 exe "keepjumps ".line1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1390 keepjumps norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1391
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1392 " more cleanup
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1393 exe 'silent! keepjumps '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1394 exe "silent! keepjumps ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1395 exe "silent! keepjumps ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1396 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1397
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1398 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1399 " use ssh to get remote file listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1400 " call Decho("use ssh to get remote file listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1401 let shq= &shq? &shq : ( &sxq? &sxq : "'")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1402 " call Decho("exe silent r! ".listcmd." '".shq.escape(path,s:netrw_cd_escape).shq."'")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1403 exe "silent r! ".listcmd." ".shq.escape(path,s:netrw_cd_escape).shq
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1404 keepjumps 1d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1405 " cleanup
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1406 if g:netrw_ftp_browse_reject != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1407 exe "silent! g/".g:netrw_ssh_browse_reject."/keepjumps d"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1408 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1409 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1410
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1411 " set up syntax highlighting
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1412 if has("syntax")
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
1413 setlocal ft=netrw
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1414 if !exists("g:syntax_on") || !g:syntax_on
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1415 setlocal ft=
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1416 " Ugly workaround -- when syntax highlighting is off and laststatus==2,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1417 " sometimes the laststatus highlight bleeds into the entire display.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1418 " Only seems to happen with remote browsing. Weird.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1419 redraw
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1420 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1421 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1422
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1423 " manipulate the directory listing (hide, sort)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1424 if line("$") >= w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1425 if g:netrw_hide && g:netrw_list_hide != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1426 call s:NetrwListHide()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1427 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1428
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1429 if w:netrw_longlist == 1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1430 " do a long listing; these substitutions need to be done prior to sorting
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1431 " call Decho("manipulate long listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1432
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1433 if method == "ftp"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1434 " cleanup
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1435 exe "keepjumps ".w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1436 while getline(".") =~ g:netrw_ftp_browse_reject
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1437 keepjumps d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1438 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1439 " if there's no ../ listed, then put ./ and ../ in
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1440 let line1= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1441 keepjumps 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1442 silent keepjumps call search('^\.\.\/\%(\s\|$\)','W')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1443 let line2= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1444 if line2 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1445 exe 'keepjumps '.w:netrw_bannercnt."put='./'"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1446 exe 'keepjumps '.w:netrw_bannercnt."put='../'"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1447 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1448 exe "keepjumps ".line1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1449 keepjumps norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1450 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1451
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1452 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/ -> .*$//e'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1453 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2\t\1/e'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1454 exe 'silent keepjumps '.w:netrw_bannercnt
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1455 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1456
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1457 if line("$") >= w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1458 if g:netrw_sort_by =~ "^n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1459 call s:SetSort()
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1460 if g:netrw_sort_direction =~ 'n'
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1461 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1462 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1463 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1464 endif
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
1465 " remove priority pattern prefix
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1466 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{3}\///e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1467 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1468 if w:netrw_longlist == 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1469 " shorten the list to keep its width <= winwidth characters
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1470 exe "silent keepjumps ".w:netrw_bannercnt.',$s/\t[-dstrwx]\+/\t/e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1471 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1472 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1473 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1474
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1475 call s:NetrwWideListing()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1476 if line("$") >= w:netrw_bannercnt
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1477 " place cursor on the top-left corner of the file listing
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1478 exe "keepjumps ".w:netrw_bannercnt
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1479 norm! 0
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1480 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1481
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1482 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1483 setlocal nomod noma nonu
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1484
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1485 " call Dret("NetBrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1486 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1487 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1488
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1489 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1490 " NetBrowseChgDir: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1491 fun! s:NetBrowseChgDir(dirname,newdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1492 " call Dfunc("NetBrowseChgDir(dirname<".a:dirname."> newdir<".a:newdir.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1493
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1494 let dirname= a:dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1495 let newdir = a:newdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1496
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1497 if newdir !~ '[\/]$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1498 " handling a file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1499 let dirname= dirname.newdir
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
1500 let didfile= 0
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1501 if g:netrw_browse_split == 1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1502 new
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1503 wincmd _
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1504 elseif g:netrw_browse_split == 2
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1505 rightb vert new
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1506 wincmd |
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
1507 else
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
1508 " handling a file, didn't split, so possibly remove menu
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
1509 call s:NetMenu(0)
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1510 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1511 " call Decho("handling a file: dirname<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1512
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1513 elseif newdir == './'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1514 " refresh the directory list
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1515 " call Decho("refresh directory listing")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1516 setlocal ma nobl
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1517 if g:netrw_fastbrowse >= 1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1518 setlocal bh=hide
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
1519 else
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
1520 setlocal bh=delete
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1521 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1522 %d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1523
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1524 elseif newdir == '../'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1525 " go up one directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1526 let trailer= substitute(a:dirname,'^\(\w\+://\%(\w\+@\)\=\w\+/\)\(.*\)$','\2','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1527
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1528 if trailer =~ '^\%(\.\./\)*$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1529 " tack on a ../"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1530 let dirname= dirname.'../'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1531
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1532 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1533 " strip off a directory name from dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1534 let dirname= substitute(dirname,'^\(.*/\)[^/]\+/','\1','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1535 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1536 " call Decho("go up one dir: dirname<".dirname."> trailer<".trailer.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1537
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1538 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1539 " go down one directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1540 let dirname= dirname.newdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1541 " call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1542 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1543
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1544 " call Dret("NetBrowseChgDir <".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1545 return dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1546 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1547
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1548 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1549 " NetGetWord: it gets the directory named under the cursor {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1550 fun! s:NetGetWord()
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
1551 " call Dfunc("NetGetWord() line#".line(".")." longlist=".g:netrw_longlist." virtcol=".virtcol("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1552 call s:UseBufWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1553
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1554 " insure that w:netrw_longlist is set up
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1555 if !exists("w:netrw_longlist")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1556 if exists("g:netrw_longlist")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1557 let w:netrw_longlist= g:netrw_longlist
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1558 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1559 let w:netrw_longlist= 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1560 endif
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
1561 " call Decho("w:netrw_longlist=".w:netrw_longlist)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1562 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1563
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1564 if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1565 " Active Banner support
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1566 " call Decho("active banner handling")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1567 norm! 0
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1568 let dirname= "./"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1569 let curline= getline(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1570 if curline =~ '"\s*Sorted by\s'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1571 norm s
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1572 let s:netrw_skipbrowse= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1573 echo 'Pressing "s" also works'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1574 elseif curline =~ '"\s*Sort sequence:'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1575 let s:netrw_skipbrowse= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1576 echo 'Press "S" to edit sorting sequence'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1577 elseif curline =~ '"\s*Quick Help:'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1578 norm ?
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1579 let s:netrw_skipbrowse= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1580 echo 'Pressing "?" also works'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1581 elseif curline =~ '"\s*\%(Hiding\|Showing\):'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1582 norm a
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1583 let s:netrw_skipbrowse= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1584 echo 'Pressing "a" also works'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1585 elseif line("$") > w:netrw_bannercnt
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1586 exe 'silent keepjumps '.w:netrw_bannercnt
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1587 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1588
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1589 elseif w:netrw_longlist == 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1590 " call Decho("thin column handling")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1591 norm! 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1592 let dirname= getline(".")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1593
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1594 elseif w:netrw_longlist == 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1595 " call Decho("long column handling")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1596 norm! 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1597 let dirname= substitute(getline("."),'^\(\%(\S\+\s\)*\S\+\).\{-}$','\1','e')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1598
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1599 else
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1600 " call Decho("obtain word from wide listing")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1601 let dirname= getline(".")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1602
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1603 if !exists("b:netrw_cpf")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1604 let b:netrw_cpf= 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1605 exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif'
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1606 " call Decho("computed cpf")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1607 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1608
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1609 let filestart = (virtcol(".")/b:netrw_cpf)*b:netrw_cpf
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
1610 " call Decho("filestart= ([virtcol=".virtcol(".")."]/[b:netrw_cpf=".b:netrw_cpf."])*b:netrw_cpf=".filestart." bannercnt=".w:netrw_bannercnt)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1611 " call Decho("1: dirname<".dirname.">")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1612 if filestart > 0|let dirname= substitute(dirname,'^.\{'.filestart.'}','','')|endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1613 " call Decho("2: dirname<".dirname.">")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1614 let dirname = substitute(dirname,'^\(.\{'.b:netrw_cpf.'}\).*$','\1','e')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1615 " call Decho("3: dirname<".dirname.">")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1616 let dirname = substitute(dirname,'\s\+$','','e')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1617 " call Decho("4: dirname<".dirname.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1618 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1619
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1620 " call Dret("NetGetWord <".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1621 return dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1622 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1623
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1624 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1625 " NetBrowseRm: remove/delete a remote file or directory {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1626 fun! s:NetBrowseRm(usrhost,path) range
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
1627 " call Dfunc("NetBrowseRm(usrhost<".a:usrhost."> path<".a:path.">) virtcol=".virtcol("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1628 " call Decho("firstline=".a:firstline." lastline=".a:lastline)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1629
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1630 " preparation for removing multiple files/directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1631 let ctr= a:firstline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1632 let all= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1633
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1634 " remove multiple files and directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1635 while ctr <= a:lastline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1636 exe ctr
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1637
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1638 let rmfile= s:NetGetWord()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1639 " call Decho("rmfile<".rmfile.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1640
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1641 if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1642 " attempt to remove file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1643 if !all
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1644 echohl Statement
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1645 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1646 let ok= input("Confirm deletion of file<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1647 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1648 echohl NONE
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1649 if ok == ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1650 let ok="no"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1651 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1652 let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1653 if ok =~ 'a\%[ll]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1654 let all= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1655 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1656 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1657
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1658 if all || ok =~ 'y\%[es]' || ok == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1659 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1660 silent! keepjumps .,$d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1661 call s:NetBrowseFtpCmd(a:path,"delete ".rmfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1662 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1663 let netrw_rm_cmd= substitute(g:netrw_rm_cmd,'HOSTNAME',a:usrhost,'').' "'.escape(a:path.rmfile,s:netrw_cd_escape).'"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1664 " call Decho("attempt to remove file: system(".netrw_rm_cmd.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1665 let ret= system(netrw_rm_cmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1666 " call Decho("returned=".ret." errcode=".v:shell_error)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1667 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1668 elseif ok =~ 'q\%[uit]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1669 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1670 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1671
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1672 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1673 " attempt to remove directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1674 if !all
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1675 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1676 let ok= input("Confirm deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1677 call inputrestore()
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1678 if ok == ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1679 let ok="no"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1680 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1681 let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1682 if ok =~ 'a\%[ll]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1683 let all= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1684 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1685 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1686
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1687 if all || ok =~ 'y\%[es]' || ok == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1688 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1689 call s:NetBrowseFtpCmd(a:path,"rmdir ".rmfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1690 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1691 let rmfile = a:path.rmfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1692 let netrw_rmdir_cmd= substitute(g:netrw_rmdir_cmd,'HOSTNAME',a:usrhost,'').' '."'".'"'.rmfile.'"'."'"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1693 " call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1694 let ret= system(netrw_rmdir_cmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1695 " call Decho("returned=".ret." errcode=".v:shell_error)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1696
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1697 if v:shell_error != 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1698 let netrw_rmf_cmd= substitute(g:netrw_rmf_cmd,'HOSTNAME',a:usrhost,'').' '.substitute(rmfile,'[\/]$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1699 " call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1700 let ret= system(netrw_rmf_cmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1701 " call Decho("returned=".ret." errcode=".v:shell_error)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1702
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1703 if v:shell_error != 0 && !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1704 echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1705 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1706 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1707 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1708 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1709
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1710 elseif ok =~ 'q\%[uit]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1711 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1712 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1713 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1714
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1715 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1716 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1717
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1718 " refresh the directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1719 let curline= line(".")-1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1720 " call Decho("refresh the directory")
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1721 call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1722 exe curline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1723
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1724 " call Dret("NetBrowseRm")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1725 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1726
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1727 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1728 " NetBrowseRename: rename a remote file or directory {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1729 fun! s:NetBrowseRename(usrhost,path) range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1730 " call Dfunc("NetBrowseRename(usrhost<".a:usrhost."> path<".a:path.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1731
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1732 " preparation for removing multiple files/directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1733 let ctr = a:firstline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1734 let rename_cmd = substitute(g:netrw_rename_cmd,'\<HOSTNAME\>',a:usrhost,'')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1735
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1736 " attempt to rename files/directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1737 while ctr <= a:lastline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1738 exe "keepjumps ".ctr
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1739
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1740 norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1741 let oldname= s:NetGetWord()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1742 " call Decho("oldname<".oldname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1743
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1744 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1745 let newname= input("Moving ".oldname." to : ",oldname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1746 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1747
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1748 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1749 call s:NetBrowseFtpCmd(a:path,"rename ".oldname." ".newname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1750 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1751 let oldname= a:path.oldname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1752 let newname= a:path.newname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1753 " call Decho("system(rename_cmd".' "'.escape(oldname," ").'" "'.escape(newname,s:netrw_cd_escape).'"')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1754 let ret= system(rename_cmd.' "'.escape(oldname,s:netrw_cd_escape).'" "'.escape(newname,s:netrw_cd_escape).'"')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1755 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1756
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1757 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1758 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1759
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1760 " refresh the directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1761 let curline= line(".")
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1762 call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1763 exe "keepjumps ".curline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1764 " call Dret("NetBrowseRename")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1765 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1766
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1767 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1768 " NetRefresh: {{{2
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1769 fun! s:NetRefresh(dirname,islocal)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1770 " call Dfunc("NetRefresh(dirname<".a:dirname.">,islocal=".a:islocal.")")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1771 call netrw#NetSavePosn()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1772 set ma
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1773 %d
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1774 if a:islocal
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1775 call s:LocalBrowse(a:dirname)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1776 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1777 call s:NetBrowse(a:dirname)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1778 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1779 call netrw#NetRestorePosn()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1780 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1781 " call Dret("NetRefresh")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1782 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1783
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1784 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1785 " NetSplit: mode {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1786 " =0 : net and o
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1787 " =1 : net and v
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1788 " =2 : local and o
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1789 " =3 : local and v
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1790 fun! s:NetSplit(mode)
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1791 " call Dfunc("NetSplit(mode=".a:mode.") alto=".g:netrw_alto." altv=".g:netrw_altv)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1792
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1793 call s:SaveWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1794 if a:mode == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1795 exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1796 call s:CopyWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1797 exe "norm! 0"
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1798 call s:NetBrowse(s:NetBrowseChgDir(expand("%"),s:NetGetWord()))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1799 elseif a:mode ==1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1800 exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1801 call s:CopyWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1802 exe "norm! 0"
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1803 call s:NetBrowse(s:NetBrowseChgDir(expand("%"),s:NetGetWord()))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1804 elseif a:mode ==2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1805 exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1806 call s:CopyWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1807 exe "norm! 0"
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1808 call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,s:NetGetWord()))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1809 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1810 exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1811 call s:CopyWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1812 exe "norm! 0"
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1813 call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,s:NetGetWord()))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1814 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1815
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1816 " call Dret("NetSplit")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1817 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1818
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1819 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1820 " NetBrowseX: allows users to write custom functions to operate on {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1821 " files given their extension. Passes 0=local, 1=remote
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1822 fun! netrw#NetBrowseX(fname,remote)
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1823 " call Dfunc("NetBrowseX(fname<".a:fname."> remote=".a:remote.")")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1824
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1825 " set up the filename
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1826 " (lower case the extension, make a local copy of a remote file)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1827 let exten= substitute(a:fname,'.*\.\(.\{-}\)','\1','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1828 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1829 let exten= substitute(exten,'^.*$','\L&\E','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1830 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1831 let fname= escape(a:fname,"%#")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1832 " call Decho("fname<".fname."> after escape()")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1833
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1834 " seems kde systems often have gnome-open due to dependencies, even though
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1835 " gnome-open's subsidiary display tools are largely absent. Kde systems
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1836 " usually have "kdeinit" running, though... (tnx Mikolaj Machowski)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1837 if !exists("s:haskdeinit")
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1838 if has("unix")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1839 silent! let s:haskdeinit= system('ps -e') =~ 'kdeinit'
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1840 if v:shell_error
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1841 let s:haskdeinit = 0
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1842 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1843 else
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1844 let s:haskdeinit= 0
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1845 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1846 " call Decho("setting s:haskdeinit=".s:haskdeinit)
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1847 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1848
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1849 if a:remote == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1850 " create a local copy
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1851 let fname= tempname().".".exten
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1852 " call Decho("a:remote==1: create a local copy of <".a:fname."> as <".fname.">")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1853 exe "silent keepjumps bot 1new ".a:fname
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1854 set bh=delete
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1855 exe "w! ".fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1856 q
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1857 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1858 " call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1859
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1860 " set up redirection
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1861 if &srr =~ "%s"
615
7fe13e0f5dce updated for version 7.0175
vimboss
parents: 568
diff changeset
1862 let redir= substitute(&srr,"%s","/dev/null","")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1863 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1864 let redir= &srr . "/dev/null"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1865 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1866 " call Decho("redir{".redir."} srr{".&srr."}")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1867
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1868 if exists("g:netrw_browsex_viewer") && executable(g:netrw_browsex_viewer)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1869 " call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">")
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1870 if g:netrw_browsex_viewer == '-'
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1871 let ret= netrwFileHandlers#Invoke(exten,fname)
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1872 else
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1873 " call Decho("exe silent !".g:netrw_browsex_viewer." '".escape(fname,'%#')."' ".redir)
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1874 exe "silent !".g:netrw_browsex_viewer." '".escape(fname,'%#')."'".redir
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1875 let ret= v:shell_error
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1876 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1877
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1878 " execute the file handler
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1879 elseif has("win32") || has("win64")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1880 " call Decho('exe silent !start rundll32 url.dll,FileProtocolHandler "'.escape(fname, '%#').'"')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1881 exe 'silent !start rundll32 url.dll,FileProtocolHandler "'.escape(fname, '%#').'"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1882 let ret= v:shell_error
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1883
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1884 elseif has("unix") && executable("gnome-open") && !s:haskdeinit
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1885 " call Decho("exe silent !gnome-open '".escape(fname,'%#')."' ".redir)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1886 exe "silent !gnome-open '".escape(fname,'%#')."'".redir
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1887 let ret= v:shell_error
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1888
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1889 elseif has("unix") && executable("kfmclient") && s:haskdeinit
557
862863033fdd updated for version 7.0158
vimboss
parents: 554
diff changeset
1890 " call Decho("exe silent !kfmclient exec '".escape(fname,'%#')."' ".redir)
862863033fdd updated for version 7.0158
vimboss
parents: 554
diff changeset
1891 exe "silent !kfmclient exec '".escape(fname,'%#')."' ".redir
862863033fdd updated for version 7.0158
vimboss
parents: 554
diff changeset
1892 let ret= v:shell_error
862863033fdd updated for version 7.0158
vimboss
parents: 554
diff changeset
1893
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1894 else
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1895 " netrwFileHandlers#Invoke() always returns 0
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1896 let ret= netrwFileHandlers#Invoke(exten,fname)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1897 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1898
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1899 " if unsuccessful, attempt netrwFileHandlers#Invoke()
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1900 if ret
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1901 let ret= netrwFileHandlers#Invoke(exten,fname)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1902 endif
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1903
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1904 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1905
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1906 " cleanup: remove temporary file,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1907 " delete current buffer if success with handler,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1908 " return to prior buffer (directory listing)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1909 if a:remote == 1 && fname != a:fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1910 " call Decho("deleting temporary file<".fname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1911 call delete(fname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1912 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1913
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1914 if a:remote == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1915 set bh=delete bt=nofile noswf
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1916 exe "norm! \<c-o>"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1917 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1918 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1919
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1920 " call Dret("NetBrowseX")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1921 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1922
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1923 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1924 " NetBrowseFtpCmd: unfortunately, not all ftp servers honor options for ls {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1925 " This function assumes that a long listing will be received. Size, time,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1926 " and reverse sorts will be requested of the server but not otherwise
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1927 " enforced here.
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
1928 fun! s:NetBrowseFtpCmd(path,listcmd)
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
1929 " call Dfunc("NetBrowseFtpCmd(path<".a:path."> listcmd<".a:listcmd.">) netrw_method=".w:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1930
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1931 " because WinXX ftp uses unix style input
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1932 " curline is one more than the bannercnt in order to account
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1933 " for the unwanted first blank line (doing a :put to an empty
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1934 " buffer yields a blank first line)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1935 let ffkeep= &ff
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1936 setlocal ma ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1937 let curline= w:netrw_bannercnt+1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1938 exe "silent! keepjumps ".curline.",$d"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1939
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1940 ".........................................
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1941 if w:netrw_method == 2 || w:netrw_method == 5
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1942 " ftp + <.netrc>: Method #2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1943 if a:path != ""
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1944 put ='cd \"'.a:path.'\"'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1945 " call Decho('ftp: '.getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1946 endif
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
1947 exe "put ='".a:listcmd."'"
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1948 " call Decho("ftp: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1949 " redraw!|call inputsave()|call input("Pausing...")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1950 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1951 " call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1952 exe g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1953 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1954 " call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1955 exe g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1956 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1957
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1958 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1959 elseif w:netrw_method == 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1960 " ftp + machine,id,passwd,filename: Method #3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1961 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1962 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1963 put ='open '.g:netrw_machine.' '.g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1964 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1965 put ='open '.g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1966 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1967
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1968 if exists("g:netrw_ftp") && g:netrw_ftp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1969 put =g:netrw_uid
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1970 put ='\"'.g:netrw_passwd.'\"'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1971 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1972 put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1973 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1974
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1975 if a:path != ""
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1976 put ='cd \"'.a:path.'\"'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1977 endif
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
1978 exe "put ='".a:listcmd."'"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1979
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1980 " perform ftp:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1981 " -i : turns off interactive prompting from ftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1982 " -n unix : DON'T use <.netrc>, even though it exists
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1983 " -n win32: quit being obnoxious about password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1984 " call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i -n")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1985 exe g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i -n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1986
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1987 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1988 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1989 echo "***warning*** unable to comply with your request<" . choice . ">"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1990 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1991
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1992 " cleanup for Windows
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1993 if has("win32") || has("win95") || has("win64") || has("win16")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1994 silent! keepjumps! %s/\r$//e
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1995 endif
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
1996 if a:listcmd == "dir"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1997 " infer directory/link based on the file permission string
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1998 silent! keepjumps g/d\%([-r][-w][-x]\)\{3}/s@$@/@
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1999 silent! keepjumps g/l\%([-r][-w][-x]\)\{3}/s/$/@/
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2000 if w:netrw_longlist == 0 || w:netrw_longlist == 2
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2001 exe "silent! keepjumps ".curline.',$s/^\%(\S\+\s\+\)\{8}//e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2002 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2003 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2004
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2005 " ftp's ls doesn't seem to include ./ or ../
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2006 if !search('^\.\/$','wn')
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2007 exe 'keepjumps '.curline
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2008 if a:path !~ '^$'
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2009 put ='../'
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2010 endif
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2011 put ='./'
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2012 exe 'keepjumps '.curline
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2013 endif
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2014
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2015 " restore settings
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2016 let &ff= ffkeep
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2017 " call Dret("NetBrowseFtpCmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2018 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2019
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2020 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2021 " NetrwListHide: uses [range]g~...~d to delete files that match comma {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2022 " separated patterns given in g:netrw_list_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2023 fun! s:NetrwListHide()
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2024 " call Dfunc("NetrwListHide() hide=".g:netrw_hide." listhide<".g:netrw_list_hide.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2025
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2026 let listhide= g:netrw_list_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2027 while listhide != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2028 if listhide =~ ','
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2029 let hide = substitute(listhide,',.*$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2030 let listhide = substitute(listhide,'^.\{-},\(.*\)$','\1','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2031 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2032 let hide = listhide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2033 let listhide= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2034 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2035
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2036 " Prune the list by hiding any files which match
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2037 if g:netrw_hide == 1
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2038 " call Decho("hiding<".hide."> listhide<".listhide.">")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2039 " call Decho('exe silent keepjumps '.w:netrw_bannercnt.',$g~'.hide.'~d')
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2040 exe 'silent keepjumps '.w:netrw_bannercnt.',$g~'.hide.'~d'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2041 elseif g:netrw_hide == 2
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2042 " call Decho("showing<".hide."> listhide<".listhide.">")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2043 " call Decho('exe silent keepjumps '.w:netrw_bannercnt.',$v~'.hide.'~d')
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2044 exe 'silent keepjumps '.w:netrw_bannercnt.',$v~'.hide.'~d'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2045 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2046 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2047
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2048 " call Dret("NetrwListHide")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2049 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2050
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2051 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2052 " NetHideEdit: allows user to edit the file/directory hiding list
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2053 fun! s:NetHideEdit(islocal)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2054 " call Dfunc("NetHideEdit(islocal=".a:islocal.")")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2055
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2056 " get new hiding list from user
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2057 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2058 let newhide= input("Edit Hiding List: ",g:netrw_list_hide)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2059 call inputrestore()
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2060 let g:netrw_list_hide= newhide
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2061 " call Decho("new g:netrw_list_hide<".g:netrw_list_hide.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2062
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2063 " refresh the listing
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2064 if a:islocal == 0
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2065 silent call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2066 else
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2067 silent call s:NetRefresh(s:LocalBrowseChgDir(b:netrw_curdir,"./"),a:islocal)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2068 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2069
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2070 " call Dret("NetHideEdit")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2071 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2072
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2073 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2074 " NetSortSequence: allows user to edit the sorting sequence
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2075 fun! s:NetSortSequence(mode)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2076 " call Dfunc("NetSortSequence(mode=".a:mode.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2077
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2078 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2079 let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2080 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2081
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2082 " refresh the listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2083 let g:netrw_sort_sequence= newsortseq
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2084 if a:mode == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2085 silent call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2086 else
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2087 silent call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,"./"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2088 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2089
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2090 " call Dret("NetSortSequence")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2091 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2092
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2093 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2094 " NetLongList: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2095 fun! s:NetLongList(mode)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2096 " call Dfunc("NetLongList(mode=".a:mode.") netrw_longlist=".w:netrw_longlist)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2097 let fname = s:NetGetWord()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2098 let w:netrw_longlist = (w:netrw_longlist + 1) % 3
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2099 " call Decho("fname<".fname.">")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2100
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2101 if w:netrw_longlist == 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2102 " use one column listing
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2103 " call Decho("use one column list")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2104 let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2105
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2106 elseif w:netrw_longlist == 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2107 " use long list
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2108 " call Decho("use long list")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2109 let g:netrw_list_cmd = g:netrw_list_cmd." -l"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2110
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2111 else
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2112 " give wide list
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2113 " call Decho("use wide list")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2114 let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2115 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2116 setlocal ma
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2117
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2118 " clear buffer - this will cause NetBrowse/LocalBrowse to do a refresh
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2119 %d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2120
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2121 " refresh the listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2122 if a:mode == 0
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2123 silent call s:NetBrowse(s:NetBrowseChgDir(expand("%"),"./"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2124 else
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2125 silent call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,"./"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2126 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2127
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2128 " keep cursor on the filename
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2129 silent keepjumps $
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2130 if fname =~ '/$'
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2131 silent call search('\%(^\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bW')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2132 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2133 silent call search('\%(^\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bW')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2134 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2135
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2136 " call Dret("NetLongList : w:netrw_longlist=".w:netrw_longlist)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2137 endfun
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2138
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2139 " ---------------------------------------------------------------------
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2140 " NetrwWideListing: {{{2
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2141 fun! s:NetrwWideListing()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2142
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2143 if w:netrw_longlist == 2
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2144 " call Dfunc("NetrwWideListing() w:netrw_longlist=".w:netrw_longlist)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2145 " look for longest filename (cpf=characters per filename)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2146 " cpf: characters per file
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2147 " fpl: files per line
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2148 " fpc: files per column
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2149 set ma
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2150 let b:netrw_cpf= 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2151 if line("$") >= w:netrw_bannercnt
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2152 exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif'
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2153 else
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2154 " call Dret("NetrwWideListing")
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2155 return
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2156 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2157 " call Decho("max file strlen+1=".b:netrw_cpf)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2158 let b:netrw_cpf= b:netrw_cpf + 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2159
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2160 " determine qty files per line (fpl)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2161 let w:netrw_fpl= winwidth(0)/b:netrw_cpf
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2162 if w:netrw_fpl <= 0
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2163 let w:netrw_fpl= 1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2164 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2165 " call Decho("fpl= ".winwidth(0)."/[b:netrw_cpf=".b:netrw_cpf.']='.w:netrw_fpl)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2166
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2167 " make wide display
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2168 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^.*$/\=printf("%-'.b:netrw_cpf.'s",escape(submatch(0),"\\"))/'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2169 let fpc = (line("$") - w:netrw_bannercnt + w:netrw_fpl)/w:netrw_fpl
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2170 let newcolstart = w:netrw_bannercnt + fpc
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2171 let newcolend = newcolstart + fpc - 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2172 " call Decho("bannercnt=".w:netrw_bannercnt." fpl=".w:netrw_fpl." fpc=".fpc." newcol[".newcolstart.",".newcolend."]")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2173 while line("$") >= newcolstart
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2174 if newcolend > line("$") | let newcolend= line("$") | endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2175 let newcolqty= newcolend - newcolstart
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2176 exe newcolstart
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2177 if newcolqty == 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2178 exe "silent keepjumps norm! 0\<c-v>$hx".w:netrw_bannercnt."G$p"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2179 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2180 exe "silent keepjumps norm! 0\<c-v>".newcolqty.'j$hx'.w:netrw_bannercnt.'G$p'
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2181 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2182 exe "silent keepjumps ".newcolstart.','.newcolend.'d'
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2183 exe 'silent keepjumps '.w:netrw_bannercnt
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2184 endwhile
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2185 exe "silent keepjumps ".w:netrw_bannercnt.',$s/\s\+$//e'
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2186 setlocal noma nomod
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2187 " call Dret("NetrwWideListing")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2188 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2189
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2190 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2191
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2192 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2193 " NetSaveWordPosn: used by the "s" command in both remote and local {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2194 " browsing. Along with NetRestoreWordPosn(), it keeps the cursor on
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2195 " the same word even though the sorting has changed its order of appearance.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2196 fun! s:NetSaveWordPosn()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2197 " call Dfunc("NetSaveWordPosn()")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2198 let s:netrw_saveword= '^'.escape(getline("."),s:netrw_cd_escape).'$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2199 " call Dret("NetSaveWordPosn : saveword<".s:netrw_saveword.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2200 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2201
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2202 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2203 " NetRestoreWordPosn: used by the "s" command; see NetSaveWordPosn() above {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2204 fun! s:NetRestoreWordPosn()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2205 " call Dfunc("NetRestoreWordPosn()")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2206 silent! call search(s:netrw_saveword,'w')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2207 " call Dret("NetRestoreWordPosn")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2208 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2209
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2210 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2211 " NetMakeDir: this function makes a directory (both local and remote) {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2212 fun! s:NetMakeDir(usrhost)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2213 " call Dfunc("NetMakeDir(usrhost<".a:usrhost.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2214
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2215 " get name of new directory from user. A bare <CR> will skip.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2216 " if its currently a directory, also request will be skipped, but with
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2217 " a message.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2218 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2219 let newdirname= input("Please give directory name: ")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2220 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2221 " call Decho("newdirname<".newdirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2222
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2223 if newdirname == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2224 " call Dret("NetMakeDir : user aborted with bare <cr>")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2225 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2226 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2227
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2228 if a:usrhost == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2229
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2230 " Local mkdir:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2231 " sanity checks
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2232 let fullnewdir= b:netrw_curdir.'/'.newdirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2233 " call Decho("fullnewdir<".fullnewdir.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2234 if isdirectory(fullnewdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2235 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2236 echohl WarningMsg | echo "***netrw*** <".newdirname."> is already a directory!" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2237 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2238 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2239 " call Dret("NetMakeDir : directory<".newdirname."> exists previously")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2240 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2241 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2242 if filereadable(fullnewdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2243 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2244 echohl WarningMsg | echo "***netrw*** <".newdirname."> is already a file!" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2245 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2246 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2247 " call Dret("NetMakeDir : file<".newdirname."> exists previously")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2248 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2249 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2250
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2251 " requested new local directory is neither a pre-existing file or
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2252 " directory, so make it!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2253 if exists("*mkdir")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2254 call mkdir(fullnewdir,"p")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2255 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2256 let netrw_origdir= s:NetGetcwd(1)
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2257 exe 'keepjumps cd '.b:netrw_curdir
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2258 " call Decho("netrw_origdir<".netrw_origdir.">: cd b:netrw_curdir<".b:netrw_curdir.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2259 " call Decho("exe silent! !".g:netrw_local_mkdir.' "'.newdirname.'"')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2260 exe "silent! !".g:netrw_local_mkdir.' "'.newdirname.'"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2261 if !g:netrw_keepdir | exe 'keepjumps cd '.netrw_origdir | endif
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2262 if !g:netrw_keepdir
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2263 exe 'keepjumps cd '.netrw_origdir
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2264 " call Decho("netrw_keepdir=".g:netrw_keepdir.": cd ".netrw_origdir)
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2265 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2266 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2267
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2268 if v:shell_error == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2269 " refresh listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2270 " call Decho("refresh listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2271 let linenum= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2272 norm! H0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2273 let hline = line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2274 set ma|norm! 2D
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2275 call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,'./'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2276 exe "norm! ".hline."G0z\<CR>"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2277 exe linenum
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2278 elseif !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2279 echohl Error | echo "***netrw*** unable to make directory<".newdirname.">" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2280 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2281 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2282 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2283
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2284 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2285 " Remote mkdir:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2286 let mkdircmd = substitute(g:netrw_mkdir_cmd,'\<HOSTNAME\>',a:usrhost,'')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2287 let newdirname= "'".'"'.substitute(expand("%"),'^\%(.\{-}/\)\{3}\(.*\)$','\1','').newdirname.'"'."'"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2288 " call Decho("exe silent! !".mkdircmd." ".newdirname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2289 exe "silent! !".mkdircmd." ".newdirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2290 if v:shell_error == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2291 " refresh listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2292 let linenum= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2293 norm! H0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2294 let hline = line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2295 call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2296 exe "norm! ".hline."G0z\<CR>"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2297 exe linenum
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2298 elseif !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2299 echohl Error | echo "***netrw*** unable to make directory<".newdirname.">" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2300 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2301 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2302 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2303 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2304
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2305 " call Dret("NetMakeDir")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2306 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2307
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2308 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2309 " NetBookmarkDir: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2310 " 0: (user: <b>) bookmark current directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2311 " 1: (user: <B>) change to the bookmarked directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2312 " 2: (user: <q>) list bookmarks
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2313 " 3: (LocalBrowse) record current directory history
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2314 " 4: (user: <u>) go up (previous) bookmark
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2315 " 5: (user: <U>) go down (next) bookmark
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2316 fun! s:NetBookmarkDir(chg,curdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2317 " call Dfunc("NetBookmarkDir(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2318 if exists("w:netrw_bannercnt") && line(".") <= w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2319 " looks like a "b" was pressed while in the banner region
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2320 if line("$") > w:netrw_bannercnt
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2321 exe 'silent keepjumps '.w:netrw_bannercnt
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2322 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2323 if &ch > 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2324 " "clear" the message
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2325 echo ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2326 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2327 " call Dret("NetBookmarkDir - ignoring")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2328 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2329 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2330
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2331 if a:chg == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2332 " bookmark the current directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2333 let g:NETRW_BOOKMARKDIR_{v:count}= a:curdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2334 if !exists("g:NETRW_BOOKMARKMAX")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2335 let g:NETRW_BOOKMARKMAX= v:count
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2336 elseif v:count > g:NETRW_BOOKMARKMAX
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2337 let g:NETRW_BOOKMARKMAX= v:count
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2338 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2339 echo "bookmarked the current directory"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2340
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2341 elseif a:chg == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2342 " change to the bookmarked directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2343 if exists("g:NETRW_BOOKMARKDIR_{v:count}")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2344 exe "e ".g:NETRW_BOOKMARKDIR_{v:count}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2345 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2346 echomsg "Sorry, bookmark#".v:count." doesn't exist!"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2347 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2348
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2349 elseif a:chg == 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2350 " list user's bookmarks
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2351 if exists("g:NETRW_BOOKMARKMAX")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2352 " call Decho("list bookmarks [0,".g:NETRW_BOOKMARKMAX."]")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2353 let cnt= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2354 while cnt <= g:NETRW_BOOKMARKMAX
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2355 if exists("g:NETRW_BOOKMARKDIR_{cnt}")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2356 " call Decho("Netrw Bookmark#".cnt.": ".g:NETRW_BOOKMARKDIR_{cnt})
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2357 echo "Netrw Bookmark#".cnt.": ".g:NETRW_BOOKMARKDIR_{cnt}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2358 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2359 let cnt= cnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2360 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2361 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2362
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2363 " list directory history
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2364 let cnt = g:NETRW_DIRHIST_CNT
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2365 let first = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2366 let histcnt = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2367 while ( first || cnt != g:NETRW_DIRHIST_CNT )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2368 " call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:NETRW_DIRHIST_CNT)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2369 let histcnt= histcnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2370 if exists("g:NETRW_DIRHIST_{cnt}")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2371 " call Decho("Netrw History#".histcnt.": ".g:NETRW_DIRHIST_{cnt})
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2372 echo "Netrw History#".histcnt.": ".g:NETRW_DIRHIST_{cnt}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2373 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2374 let first = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2375 let cnt = ( cnt - 1 ) % g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2376 if cnt < 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2377 let cnt= cnt + g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2378 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2379 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2380
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2381 elseif a:chg == 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2382 " saves most recently visited directories (when they differ)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2383 if !exists("g:NETRW_DIRHIST_0") || g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT} != a:curdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2384 let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2385 let g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}= substitute(a:curdir,'[/\\]$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2386 " call Decho("save dirhist#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2387 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2388
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2389 elseif a:chg == 4
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2390 " u: change to the previous directory stored on the history list
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2391 let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT - 1 ) % g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2392 if g:NETRW_DIRHIST_CNT < 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2393 let g:NETRW_DIRHIST_CNT= g:NETRW_DIRHIST_CNT + g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2394 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2395 if exists("g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2396 " call Decho("changedir u#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2397 exe "e ".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2398 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2399 let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2400 echo "Sorry, no predecessor directory exists yet"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2401 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2402
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2403 elseif a:chg == 5
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2404 " U: change to the subsequent directory stored on the history list
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2405 let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2406 if exists("g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2407 " call Decho("changedir U#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2408 exe "e ".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2409 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2410 let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT - 1 ) % g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2411 if g:NETRW_DIRHIST_CNT < 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2412 let g:NETRW_DIRHIST_CNT= g:NETRW_DIRHIST_CNT + g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2413 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2414 echo "Sorry, no successor directory exists yet"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2415 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2416 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2417 " call Dret("NetBookmarkDir")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2418 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2419
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2420 " ---------------------------------------------------------------------
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2421 " NetObtain: obtain file under cursor (for remote browsing support) {{{2
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2422 fun! netrw#NetObtain(...)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2423 " call Dfunc("NetObtain() a:0=".a:0)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2424
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2425 if a:0==0
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2426 " no arguments -- use word under cursor
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2427 let fname= expand("<cWORD>")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2428 " call Decho("no arguments, use <".fname.">")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2429 elseif a:0 > 1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2430 " more than one argument, recurse with each argument separately
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2431 " call Decho("more than 1 argument, use recursion")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2432 let i=1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2433 while i <= a:0
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2434 call netrw#NetObtain(a:{i})
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2435 let i=i+1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2436 endwhile
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2437 return
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2438 else
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2439 " one argument provided
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2440 let fname = a:1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2441 let keep_netrw_choice = exists("b:netrw_choice")? b:netrw_choice : ""
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2442 let keep_netrw_fname = exists("b:netrw_fname")? b:netrw_fname : ""
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2443 let keep_netrw_wmethod = exists("w:netrw_method")? w:netrw_method : ""
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2444 call s:NetMethod(fname)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2445 let w:netrw_method= b:netrw_method
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2446 let fname = b:netrw_fname
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2447 " call Decho("g:netrw_scp_cmd<".g:netrw_scp_cmd.">")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2448 " call Decho("g:netrw_machine<".g:netrw_machine.">")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2449 " call Decho("fname<".fname.">")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2450 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2451
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2452 " NetrwStatusLine support - for obtaining support
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2453 call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.fname)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2454
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2455 " call Decho("method=".w:netrw_method)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2456 if exists("w:netrw_method") && w:netrw_method =~ '[235]'
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2457 if executable("ftp")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2458 let curdir = expand("%")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2459 let path = substitute(curdir,'ftp://[^/]\+/','','e')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2460 let curline= line(".")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2461 let endline= line("$")+1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2462 set ma
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2463 keepjumps $
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2464
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2465 ".........................................
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2466 if w:netrw_method == 2
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2467 " ftp + <.netrc>: Method #2
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2468 setlocal ff=unix
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2469 if path != ""
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2470 put ='cd '.path
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2471 " call Decho("ftp: cd ".path)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2472 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2473 put ='get '.fname
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2474 " call Decho("ftp: get ".fname)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2475 if exists("g:netrw_port") && g:netrw_port != ""
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2476 " call Decho("exe ".g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2477 exe g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2478 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2479 " call Decho("exe ".g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2480 exe g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2481 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2482
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2483 ".........................................
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2484 elseif w:netrw_method == 3
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2485 " ftp + machine,id,passwd,filename: Method #3
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2486 setlocal ff=unix
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2487 if exists("g:netrw_port") && g:netrw_port != ""
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2488 put ='open '.g:netrw_machine.' '.g:netrw_port
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2489 " call Decho('ftp: open '.g:netrw_machine.' '.g:netrw_port)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2490 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2491 put ='open '.g:netrw_machine
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2492 " call Decho('ftp: open '.g:netrw_machine)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2493 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2494
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2495 if exists("g:netrw_ftp") && g:netrw_ftp == 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2496 put =g:netrw_uid
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2497 put ='\"'.g:netrw_passwd.'\"'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2498 " call Decho('ftp: g:netrw_uid')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2499 " call Decho('ftp: g:netrw_passwd')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2500 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2501 put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2502 " call Decho('user '.g:netrw_uid.' '.g:netrw_passwd)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2503 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2504
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2505 if a:path != ""
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2506 put ='cd '.a:path
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2507 " call Decho('cd '.a:path)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2508 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2509 exe "put ='".a:cmd."'"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2510 " call Decho("ftp: ".a:cmd)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2511
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2512 " perform ftp:
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2513 " -i : turns off interactive prompting from ftp
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2514 " -n unix : DON'T use <.netrc>, even though it exists
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2515 " -n win32: quit being obnoxious about password
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2516 " call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i -n")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2517 exe g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i -n"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2518
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2519 ".........................................
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2520 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2521 echo "***warning*** unable to comply with your request<" . choice . ">"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2522 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2523 " restore
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2524 exe "silent! ".endline.",$d"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2525 exe "keepjumps ".curline
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2526 setlocal noma nomod
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2527 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2528 if !exists("g:netrw_quiet")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2529 echohl Error | echo "***netrw*** this system doesn't support ftp" | echohl None
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2530 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2531 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2532 " restore status line
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2533 let &stl = s:netrw_users_stl
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2534 let &laststatus = s:netrw_users_ls
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2535 " restore NetMethod
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2536 if exists("keep_netrw_method")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2537 call s:NetMethod(keep_netrw_choice)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2538 let w:netrw_method = keep_netrw_wmethod
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2539 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2540 " call Dret("NetObtain")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2541 return
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2542 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2543
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2544 ".........................................
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2545 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2546 " scp: Method#4
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2547 let curdir = expand("%")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2548 let path = substitute(curdir,'scp://[^/]\+/','','e')
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2549 " call Decho("path<".path.">")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2550 if exists("g:netrw_port") && g:netrw_port != ""
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2551 let useport= " -P ".g:netrw_port
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2552 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2553 let useport= ""
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2554 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2555 if g:netrw_cygwin == 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2556 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2557 " call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".path.escape(fname,' ?&')." .")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2558 exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".path.escape(fname,' ?&')." ."
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2559 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2560 " call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".path.escape(fname,' ?&')." .")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2561 exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".path.escape(fname,' ?&')." ."
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2562 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2563 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2564
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2565 " restore status line
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2566 let &stl = s:netrw_users_stl
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2567 let &laststatus = s:netrw_users_ls
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2568 redraw!
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2569
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2570 " restore NetMethod
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2571 if exists("keep_netrw_method")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2572 call s:NetMethod(keep_netrw_choice)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2573 let w:netrw_method = keep_netrw_wmethod
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2574 endif
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2575
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2576 " call Dret("NetObtain")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2577 endfun
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2578
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2579 " ---------------------------------------------------------------------
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2580 " NetPrevWinOpen: open file/directory in previous window. {{{2
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2581 " If there's only one window, then the window will first be split.
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2582 fun! s:NetPrevWinOpen(islocal)
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2583 " call Dfunc("NetPrevWinOpen(islocal=".a:islocal.")")
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2584
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2585 " get last window number and the word currently under the cursor
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2586 let lastwinnr = winnr("$")
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2587 let curword = s:NetGetWord()
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2588 let curdir = b:netrw_curdir
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2589 " call Decho("lastwinnr=".lastwinnr." curword<".curword.">")
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2590
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2591 let didsplit = 0
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2592 if lastwinnr == 1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2593 " if only one window, open a new one first
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2594 " call Decho("only one window, so open a new one (g:netrw_alto=".g:netrw_alto.")")
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2595 exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s"
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2596 let didsplit = 1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2597
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2598 else
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2599 wincmd p
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2600 " if the previous window's buffer has been changed (is modified),
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2601 " and it doesn't appear in any other extant window, then ask the
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2602 " user if s/he wants to abandon modifications therein.
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2603 let bnr = winbufnr(0)
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2604 let bnrcnt = 0
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2605 if &mod
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2606 windo if winbufnr(0) == bnr | let bnrcnt=bnrcnt+1 | endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2607 " call Decho("bnr=".bnr." bnrcnt=".bnrcnt)
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2608 if bnrcnt == 1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2609 let bufname= bufname(winbufnr(winnr()))
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2610 let choice= confirm("Save modified file<".bufname.">?","&Yes\n&No\n&Cancel")
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2611
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2612 if choice == 1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2613 " Yes -- write file & then browse
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2614 let v:errmsg= ""
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2615 silent w
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2616 if v:errmsg != ""
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2617 echohl Error | echo "***netrw*** "unable to write <".bufname.">!" | echohl None
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2618 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2619 if didsplit
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2620 q
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2621 else
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2622 wincmd p
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2623 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2624 " call Dret("NetPrevWinOpen : unable to write <".bufname.">")
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2625 return
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2626 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2627
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2628 elseif choice == 2
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2629 " No -- don't worry about changed file, just browse anyway
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2630 set nomod
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2631 echohl WarningMsg | echo "***netrw*** ".bufname." changes abandoned" | echohl None
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2632
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2633 else
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2634 " Cancel -- don't do this
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2635 if didsplit
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2636 q
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2637 else
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2638 wincmd p
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2639 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2640 " call Dret("NetPrevWinOpen : cancelled")
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2641 return
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2642 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2643 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2644 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2645 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2646
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2647 if a:islocal
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2648 call s:LocalBrowse(s:LocalBrowseChgDir(curdir,curword))
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2649 else
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2650 call s:NetBrowse(s:NetBrowseChgDir(expand("%"),curword))
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2651 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2652 " call Dret("NetPrevWinOpen")
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2653 endfun
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2654
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2655 " ---------------------------------------------------------------------
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2656 " NetMenu: generates the menu for gvim and netrw {{{2
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2657 fun! s:NetMenu(domenu)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2658
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2659 if !exists("g:NetrwMenuPriority")
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2660 let g:NetrwMenuPriority= 80
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2661 endif
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2662
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2663 if has("menu") && has("gui_running") && &go =~ 'm'
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2664 " call Dfunc("NetMenu(domenu=".a:domenu.")")
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2665 if !exists("s:netrw_menu_enabled") && a:domenu
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2666 " call Decho("initialize menu")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2667 let s:netrw_menu_enabled= 1
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2668 if !exists("g:NetrwTopLvlMenu")
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2669 let g:NetrwTopLvlMenu= "Netrw."
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2670 endif
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2671 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Help<tab><F1> <F1>'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2672 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Apply\ Special\ Viewer<tab>x x'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2673 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Bookmark\ Current\ Directory<tab>b Nb'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2674 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Go\ Up\ Directory<tab>- -'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2675 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Goto\ Bookmarked\ Directory<tab>B NB'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2676 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Change\ To\ Recently\ Used\ Directory<tab>u u'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2677 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Change\ To\ Subsequently\ Used\ Directory<tab>U U'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2678 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Delete\ File/Directory<tab>D D'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2679 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Edit\ File\ Hiding\ List<tab>'."<ctrl-h> \<c-h>"
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2680 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Edit\ File/Directory<tab><cr> '."\<cr>"
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2681 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Edit\ File/Directory,\ New\ Window<tab>o o'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2682 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Edit\ File/Directory,\ New\ Vertical\ Window<tab>v v'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2683 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'List\ Bookmarks\ and\ History<tab>q q'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2684 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Listing\ Style\ (thin-long-wide)<tab>i i'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2685 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Make\ Subdirectory<tab>d d'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2686 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Normal-Hide-Show<tab>a a'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2687 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Obtain\ File<tab>O O'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2688 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Preview\ File/Directory<tab>p p'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2689 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Previous\ Window\ Browser<tab>P P'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2690 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Refresh\ Listing<tab>'."<ctrl-l> \<c-l>"
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2691 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Rename\ File/Directory<tab>R R'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2692 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Reverse\ Sorting\ Order<tab>'."r r"
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2693 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Select\ Sorting\ Style<tab>s s'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2694 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Sorting\ Sequence\ Edit<tab>S S'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2695 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Set\ Current\ Directory<tab>c c'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2696 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Settings/Options<tab>:NetrwSettings '.":NetrwSettings\<cr>"
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2697 elseif !a:domenu
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2698 let s:netrwcnt = 0
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2699 let curwin = winnr()
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2700 windo if getline(2) =~ "Netrw" | let s:netrwcnt= s:netrwcnt + 1 | endif
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2701 exe curwin."wincmd w"
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2702
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2703 if s:netrwcnt <= 1
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2704 " call Decho("clear menus")
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2705 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Help'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2706 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Apply\ Special\ Viewer'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2707 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Bookmark\ Current\ Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2708 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Go\ Up\ Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2709 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Goto\ Bookmarked\ Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2710 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Change\ To\ Recently\ Used\ Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2711 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Change\ To\ Subsequently\ Used\ Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2712 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Delete\ File/Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2713 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Edit\ File/Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2714 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Edit\ File/Directory,\ New\ Window'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2715 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Edit\ File/Directory,\ New\ Vertical\ Window'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2716 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Edit\ File\ Hiding\ List'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2717 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Edit\ File'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2718 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Enter\ File/Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2719 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Enter\ File/Directory\ (vertical\ split)'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2720 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'List\ Bookmarks\ and\ History'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2721 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Listing\ Style\ (thin-long-wide)'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2722 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Make\ Subdirectory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2723 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Normal-Hide-Show'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2724 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Obtain\ File'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2725 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Preview\ File/Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2726 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Previous\ Window\ Browser'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2727 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Refresh\ Listing'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2728 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Rename\ File/Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2729 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Reverse\ Sorting\ Order'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2730 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Select\ Sorting\ Style'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2731 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Sorting\ Sequence\ Edit'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2732 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Set\ Current\ Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2733 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Settings/Options'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2734 unlet s:netrw_menu_enabled
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2735 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2736 endif
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2737 " call Dret("NetMenu")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2738 endif
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2739
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2740 endfun
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2741
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2742 " ==========================================
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2743 " Local Directory Browsing Support: {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2744 " ==========================================
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2745
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2746 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2747 " LocalBrowse: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2748 fun! s:LocalBrowse(dirname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2749 " unfortunate interaction -- debugging calls can't be used here;
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2750 " the BufEnter event causes triggering when attempts to write to
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2751 " the DBG buffer are made.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2752 if isdirectory(a:dirname)
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2753 silent! call netrw#DirBrowse(a:dirname)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2754 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2755 " not a directory, ignore it
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2756 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2757
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2758 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2759 " DirBrowse: supports local file/directory browsing {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2760 fun! netrw#DirBrowse(dirname)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2761 if !exists("w:netrw_longlist")|let w:netrw_longlist= g:netrw_longlist|endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2762 " call Dfunc("DirBrowse(dirname<".a:dirname.">) buf#".bufnr("%")." winnr=".winnr()." sortby=".g:netrw_sort_by)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2763 " call Dredir("ls!")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2764
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2765 if exists("s:netrw_skipbrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2766 unlet s:netrw_skipbrowse
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2767 " call Dret("DirBrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2768 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2769 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2770 if &fo =~ '[ta]'
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2771 set fo-=t
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2772 set fo-=a
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2773 echohl Warning
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2774 echo '***warning*** directory browsing and formatoptions "ta" are incompatible'
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2775 echohl None
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2776 endif
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2777
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2778 call s:NetOptionSave()
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2779 if w:acdkeep
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2780 exe 'cd '.escape(a:dirname,s:netrw_cd_escape)
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2781 " call Decho("cd ".escape(a:dirname,s:netrw_cd_escape))
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2782 " call Decho("getcwd<".getcwd().">")
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2783 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2784
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2785 if v:version < 603
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2786 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2787 echohl Error | echo "***netrw*** vim version<".v:version."> too old for browsing with netrw" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2788 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2789 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2790 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2791 " call Dret("DirBrowse : vim version<".v:version."> too old")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2792 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2793 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2794
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2795 " use buffer-oriented WinVars if buffer ones exist but window ones don't
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2796 call s:UseBufWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2797
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2798 " set up menus
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2799 let b:netrw_browser_active= 1
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2800 call s:NetMenu(1)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2801
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2802 " find buffer number of buffer named precisely the same as a:dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2803 let bufnum= bufnr(escape(a:dirname,'\'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2804 " call Decho("findbuf: bufnum=".bufnum)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2805 if bufnum > 0 && bufname(bufnum) != a:dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2806 let ibuf= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2807 let buflast= bufnr("$")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2808 while bufname(ibuf) !~ '^'.a:dirname.'\=$' && ibuf <= buflast
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2809 " call Decho("findbuf: ibuf=".ibuf. " bufname<".bufname(ibuf)."> dirname<".a:dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2810 let ibuf= ibuf + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2811 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2812 if ibuf > buflast
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2813 let bufnum= -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2814 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2815 let bufnum= ibuf
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2816 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2817 " call Decho("findbuf: bufnum=".bufnum." (final)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2818 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2819
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2820 " get cleared buffer
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2821 mark '
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2822 if bufnum < 0 || !bufexists(bufnum)
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2823 keepjumps keepalt enew!
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2824 " call Decho("enew buffer")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2825 else
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2826 exe "keepalt b ".bufnum
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2827 if exists("s:last_sort_by") && g:netrw_sort_by == s:last_sort_by
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2828 if getline(2) =~ '^" Netrw Directory Listing '
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2829 if !g:netrw_keepdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2830 exe 'cd '.escape(b:netrw_curdir,s:netrw_cd_escape)
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2831 " call Decho("netrw_keepdir=".g:netrw_keepdir.": cd ".escape(b:netrw_curdir,s:netrw_cd_escape))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2832 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2833 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2834 " call Dret("DirBrowse : reusing buffer#".bufnum."<".a:dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2835 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2836 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2837 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2838 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2839 let s:last_sort_by= g:netrw_sort_by
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2840
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
2841 " set up ShellCmdPost handling. Append current buffer to browselist
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
2842 call s:LocalFastBrowser()
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
2843
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2844 " get the new directory name
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2845 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2846 let b:netrw_curdir= substitute(a:dirname,'\\','/','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2847 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2848 let b:netrw_curdir= a:dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2849 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2850 if b:netrw_curdir =~ '[/\\]$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2851 let b:netrw_curdir= substitute(b:netrw_curdir,'[/\\]$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2852 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2853 if b:netrw_curdir == ''
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2854 " under unix, when the root directory is encountered, the result
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2855 " from the preceding substitute is an empty string.
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2856 let b:netrw_curdir= '/'
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2857 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2858 " call Decho("b:netrw_curdir<".b:netrw_curdir.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2859
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2860 " make netrw's idea of the current directory vim's if the user wishes
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2861 if !g:netrw_keepdir
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2862 " call Decho("netrw_keepdir=".g:netrw_keepdir.": cd ".escape(b:netrw_curdir,s:netrw_cd_escape))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2863 try
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2864 exe 'cd '.escape(b:netrw_curdir,s:netrw_cd_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2865 catch /^Vim\%((\a\+)\)\=:E472/
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2866 echohl Error | echo "***netrw*** unable to change directory to <".b:netrw_curdir."> (permissions?)" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2867 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2868 if exists("w:netrw_prvdir")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2869 let b:netrw_curdir= w:netrw_prvdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2870 else
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2871 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2872 " call Dret("DirBrowse : reusing buffer#".bufnum."<".a:dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2873 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2874 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2875 endtry
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2876 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2877
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2878 " change the name of the buffer to reflect the b:netrw_curdir
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2879 " Hmm. When another vim is open to the same directory, I get
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2880 " a "Press ENTER" ... ok, setting "noswf" avoids it.
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2881 " call Decho('exe silent! file '.escape(b:netrw_curdir,s:netrw_cd_escape))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2882 exe 'silent! file '.escape(b:netrw_curdir,s:netrw_cd_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2883
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2884 " make this buffer not-a-file, modifiable, not line-numbered, etc
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2885 setlocal bt=nofile nobl ma nonu noswf nowrap
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2886 if g:netrw_fastbrowse >= 2
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2887 setlocal bh=hide
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
2888 else
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
2889 setlocal bh=delete
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2890 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2891 keepalt silent! %d
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2892
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2893 " ---------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2894 " Perform Directory Listing:
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2895 if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2896 echo "(netrw) Processing your browsing request..."
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2897 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2898
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2899 " save current directory on directory history list
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2900 call s:NetBookmarkDir(3,b:netrw_curdir)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2901
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2902 " set up all the maps
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2903 " call Decho("Setting up local browser maps")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2904 nnoremap <buffer> <silent> <cr> :call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr>
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2905 nnoremap <buffer> <silent> <c-l> :call <SID>NetRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'),1)<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2906 nnoremap <buffer> <silent> - :exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,'../'))<cr>
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2907 nnoremap <buffer> <silent> a :let g:netrw_hide=(g:netrw_hide+1)%3<bar>exe "norm! 0"<bar>call <SID>NetRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'),1)<cr>
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2908 if w:netrw_longlist != 2
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2909 nnoremap <buffer> <silent> b :<c-u>call <SID>NetBookmarkDir(0,b:netrw_curdir)<cr>
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2910 nnoremap <buffer> <silent> B :<c-u>call <SID>NetBookmarkDir(1,b:netrw_curdir)<cr>
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2911 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2912 nnoremap <buffer> <silent> Nb :<c-u>call <SID>NetBookmarkDir(0,b:netrw_curdir)<cr>
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2913 nnoremap <buffer> <silent> NB :<c-u>call <SID>NetBookmarkDir(1,b:netrw_curdir)<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2914 nnoremap <buffer> <silent> c :exe "cd ".b:netrw_curdir<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2915 nnoremap <buffer> <silent> d :call <SID>NetMakeDir("")<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2916 nnoremap <buffer> <silent> <c-h> :call <SID>NetHideEdit(1)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2917 nnoremap <buffer> <silent> i :call <SID>NetLongList(1)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2918 nnoremap <buffer> <silent> o :call <SID>NetSplit(2)<cr>
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2919 nnoremap <buffer> <silent> O :call <SID>LocalObtain()<cr>
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2920 nnoremap <buffer> <silent> p :call <SID>LocalPreview(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord(),1))<cr>
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2921 nnoremap <buffer> <silent> P :call <SID>NetPrevWinOpen(1)<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2922 nnoremap <buffer> <silent> q :<c-u>call <SID>NetBookmarkDir(2,b:netrw_curdir)<cr>
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2923 nnoremap <buffer> <silent> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'),1)<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2924 nnoremap <buffer> <silent> s :call <SID>NetSaveWordPosn()<bar>let g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by =~ 't')? 'size' : 'name'<bar>exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))<bar>call <SID>NetRestoreWordPosn()<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2925 nnoremap <buffer> <silent> S :call <SID>NetSortSequence(1)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2926 nnoremap <buffer> <silent> u :<c-u>call <SID>NetBookmarkDir(4,expand("%"))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2927 nnoremap <buffer> <silent> U :<c-u>call <SID>NetBookmarkDir(5,expand("%"))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2928 nnoremap <buffer> <silent> v :call <SID>NetSplit(3)<cr>
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2929 nnoremap <buffer> <silent> x :call netrw#NetBrowseX(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord(),0),0)"<cr>
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2930 nnoremap <buffer> <silent> <2-leftmouse> :call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr>
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2931 if s:didstarstar || !mapcheck("<s-down>","n")
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2932 nnoremap <buffer> <silent> <s-down> :Nexplore<cr>
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2933 endif
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2934 if s:didstarstar || !mapcheck("<s-up>","n")
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2935 nnoremap <buffer> <silent> <s-up> :Pexplore<cr>
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2936 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2937 exe 'nnoremap <buffer> <silent> <del> :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2938 exe 'vnoremap <buffer> <silent> <del> :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2939 exe 'nnoremap <buffer> <silent> D :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2940 exe 'vnoremap <buffer> <silent> D :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2941 exe 'nnoremap <buffer> <silent> R :call <SID>LocalBrowseRename("'.b:netrw_curdir.'")<cr>'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2942 exe 'vnoremap <buffer> <silent> R :call <SID>LocalBrowseRename("'.b:netrw_curdir.'")<cr>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2943 exe 'nnoremap <buffer> <silent> <Leader>m :call <SID>NetMakeDir("")<cr>'
794
f19994020dad updated for version 7.0231
vimboss
parents: 766
diff changeset
2944 nnoremap <buffer> <F1> :he netrw-dir<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2945
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2946 " Set up the banner
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2947 " call Decho("set up banner")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2948 keepjumps put ='\" ============================================================================'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2949 keepjumps 1d
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2950 keepjumps put ='\" Netrw Directory Listing (netrw '.g:loaded_netrw.')'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2951 keepjumps put ='\" '.b:netrw_curdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2952 let w:netrw_bannercnt= 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2953
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2954 let sortby= g:netrw_sort_by
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2955 if g:netrw_sort_direction =~ "^r"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2956 let sortby= sortby." reversed"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2957 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2958
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2959 " Sorted by...
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2960 if g:netrw_sort_by =~ "^n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2961 " call Decho("directories will be sorted by name")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2962 " sorted by name
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2963 keepjumps put ='\" Sorted by '.sortby
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2964 keepjumps put ='\" Sort sequence: '.g:netrw_sort_sequence
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2965 let w:netrw_bannercnt= w:netrw_bannercnt + 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2966 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2967 " call Decho("directories will be sorted by size or date")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2968 " sorted by size or date
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2969 keepjumps put ='\" Sorted by '.sortby
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2970 let w:netrw_bannercnt= w:netrw_bannercnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2971 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2972
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2973 " Hiding... -or- Showing...
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2974 if g:netrw_list_hide != "" && g:netrw_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2975 if g:netrw_hide == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2976 keepjumps put ='\" Hiding: '.g:netrw_list_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2977 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2978 keepjumps put ='\" Showing: '.g:netrw_list_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2979 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2980 let w:netrw_bannercnt= w:netrw_bannercnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2981 endif
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 799
diff changeset
2982 keepjumps put ='\" Quick Help: <F1>:help -:go up dir D:delete R:rename s:sort-by x:exec'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2983 keepjumps put ='\" ============================================================================'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2984 let w:netrw_bannercnt= w:netrw_bannercnt + 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2985
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2986 " bannercnt should index the line just after the banner
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2987 let w:netrw_bannercnt= w:netrw_bannercnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2988 " call Decho("bannercnt=".w:netrw_bannercnt)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2989
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2990 " generate the requested directory listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2991 call s:LocalBrowseList()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2992
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2993 " set up syntax highlighting
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2994 if has("syntax")
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2995 setlocal ft=netrw
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2996 if !exists("g:syntax_on") || !g:syntax_on
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2997 setlocal ft=
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2998 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2999 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3000
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3001 " manipulate the directory listing (hide, sort)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3002 if line("$") >= w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3003 if g:netrw_hide && g:netrw_list_hide != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3004 call s:NetrwListHide()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3005 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3006 if line("$") >= w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3007
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3008 if g:netrw_sort_by =~ "^n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3009 call s:SetSort()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3010
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3011 if w:netrw_bannercnt < line("$")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3012 if g:netrw_sort_direction =~ 'n'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3013 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3014 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3015 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3016 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3017 endif
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
3018 " remove priority pattern prefix
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3019 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{3}\///e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3020
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3021 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3022 if w:netrw_bannercnt < line("$")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3023 if g:netrw_sort_direction =~ 'n'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3024 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3025 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3026 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3027 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3028 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3029 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{-}\///e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3030 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3031
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3032 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3033 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3034
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3035 call s:NetrwWideListing()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3036 if exists("w:netrw_bannercnt") && line("$") > w:netrw_bannercnt
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3037 " place cursor on the top-left corner of the file listing
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3038 exe 'silent '.w:netrw_bannercnt
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3039 norm! 0
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3040 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3041
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3042 " record previous current directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3043 let w:netrw_prvdir= b:netrw_curdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3044
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3045 " save certain window-oriented variables into buffer-oriented variables
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3046 call s:SetBufWinVars()
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3047 call s:NetOptionRestore()
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3048 setlocal noma nomod nonu nobl nowrap
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3049 if g:netrw_fastbrowse >= 2
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3050 setlocal bh=hide
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3051 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3052
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3053 " call Dret("DirBrowse : file<".expand("%:p")."> bufname<".bufname("%").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3054 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3055
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3056 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3057 " LocalBrowseList: does the job of "ls" for local directories {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3058 fun! s:LocalBrowseList()
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3059 " call Dfunc("LocalBrowseList() b:netrw_curdir<".b:netrw_curdir."> sortby<".g:netrw_sort_by.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3060
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3061 " get the list of files contained in the current directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3062 let dirname = escape(b:netrw_curdir,s:netrw_glob_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3063 let dirnamelen = strlen(b:netrw_curdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3064 let filelist = glob(dirname."/*")
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
3065 " call Decho("glob(dirname<".dirname."/.*>)=".filelist)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3066 if filelist != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3067 let filelist= filelist."\n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3068 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3069 let filelist= filelist.glob(dirname."/.*")
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
3070 " call Decho("glob(dirname<".dirname."/.*>)=".glob(dirname.".*"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3071
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3072 " if the directory name includes a "$", and possibly other characters,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3073 " the glob() doesn't include "." and ".." entries.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3074 if filelist !~ '[\\/]\.[\\/]\=\(\n\|$\)'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3075 " call Decho("forcibly tacking on .")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3076 if filelist == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3077 let filelist= dirname."."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3078 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3079 let filelist= filelist."\n".b:netrw_curdir."."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3080 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3081 " call Decho("filelist<".filelist.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3082 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3083 if filelist !~ '[\\/]\.\.[\\/]\=\(\n\|$\)'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3084 " call Decho("forcibly tacking on ..")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3085 let filelist= filelist."\n".b:netrw_curdir.".."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3086 " call Decho("filelist<".filelist.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3087 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3088 let filelist= substitute(filelist,'\n\{2,}','\n','ge')
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3089 if (has("win32") || has("win95") || has("win64") || has("win16"))
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3090 let filelist= substitute(filelist,'\','/','ge')
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3091 else
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3092 let filelist= substitute(filelist,'\','\\','ge')
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3093 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3094
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3095 " call Decho("dirname<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3096 " call Decho("dirnamelen<".dirnamelen.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3097 " call Decho("filelist<".filelist.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3098
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3099 while filelist != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3100 if filelist =~ '\n'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3101 let filename = substitute(filelist,'\n.*$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3102 let filelist = substitute(filelist,'^.\{-}\n\(.*\)$','\1','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3103 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3104 let filename = filelist
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3105 let filelist = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3106 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3107 let pfile= filename
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3108 if isdirectory(filename)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3109 let pfile= filename."/"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3110 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3111 if pfile =~ '//$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3112 let pfile= substitute(pfile,'//$','/','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3113 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3114 let pfile= strpart(pfile,dirnamelen)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3115 let pfile= substitute(pfile,'^/','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3116 " call Decho(" ")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3117 " call Decho("filename<".filename.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3118 " call Decho("pfile <".pfile.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3119
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3120 if w:netrw_longlist == 1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3121 let sz = getfsize(filename)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3122 let fsz = strpart(" ",1,15-strlen(sz)).sz
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3123 let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3124 " call Decho("sz=".sz." fsz=".fsz)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3125 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3126
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3127 if g:netrw_sort_by =~ "^t"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3128 " sort by time (handles time up to 1 quintillion seconds, US)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3129 " call Decho("getftime(".filename.")=".getftime(filename))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3130 let t = getftime(filename)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3131 let ft = strpart("000000000000000000",1,18-strlen(t)).t
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3132 " call Decho("exe keepjumps put ='".ft.'/'.filename."'")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3133 let ftpfile= ft.'/'.pfile
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3134 keepjumps silent! put=ftpfile
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3135
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3136 elseif g:netrw_sort_by =~ "^s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3137 " sort by size (handles file sizes up to 1 quintillion bytes, US)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3138 " call Decho("getfsize(".filename.")=".getfsize(filename))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3139 let sz = getfsize(filename)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3140 let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3141 " call Decho("exe keepjumps put ='".fsz.'/'.filename."'")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3142 let fszpfile= fsz.'/'.pfile
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3143 keepjumps silent! put =fszpfile
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3144
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3145 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3146 " sort by name
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3147 " call Decho("exe keepjumps put ='".pfile."'")
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3148 keepjumps silent! put=pfile
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3149 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3150 endwhile
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3151
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3152 " cleanup any windows mess at end-of-line
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3153 silent! keepjumps %s/\r$//e
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3154 setlocal ts=32
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3155
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3156 " call Dret("LocalBrowseList")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3157 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3158
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3159 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3160 " LocalBrowseChgDir: constructs a new directory based on the current {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3161 " directory and a new directory name
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3162 fun! s:LocalBrowseChgDir(dirname,newdir,...)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3163 " call Dfunc("LocalBrowseChgDir(dirname<".a:dirname."> newdir<".a:newdir.">) a:0=".a:0)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3164
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3165 let dirname= substitute(a:dirname,'\\','','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3166 let newdir = a:newdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3167
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3168 if dirname !~ '[\/]$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3169 " apparently vim is "recognizing" that it is in the home directory and
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3170 " is removing the "/". Bad idea, so I have to put it back.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3171 let dirname= dirname.'/'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3172 " call Decho("adjusting dirname<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3173 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3174
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3175 if newdir !~ '[\/]$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3176 " handling a file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3177 let dirname= dirname.newdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3178 " call Decho("handling a file: dirname<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3179 " this lets NetBrowseX avoid the edit
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3180 if a:0 < 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3181 " call Decho("dirname<".dirname."> netrw_cd_escape<".s:netrw_cd_escape.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3182 " call Decho("about to edit<".escape(dirname,s:netrw_cd_escape).">")
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3183 if g:netrw_browse_split == 1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3184 new
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3185 wincmd _
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3186 elseif g:netrw_browse_split == 2
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3187 rightb vert new
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3188 wincmd |
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
3189 else
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
3190 " handling a file, didn't split, so possibly remove menu
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
3191 call s:NetMenu(0)
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3192 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3193 exe "e! ".escape(dirname,s:netrw_cd_escape)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3194 set ma nomod
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3195 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3196
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3197 elseif newdir == './'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3198 " refresh the directory list
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3199 " call Decho("refresh directory listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3200
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3201 elseif newdir == '../'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3202 " go up one directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3203 let dirname= substitute(dirname,'^\(.*/\)\([^/]\+[\/]$\)','\1','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3204 " call Decho("go up one dir: dirname<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3205
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3206 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3207 " go down one directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3208 let dirname= dirname.newdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3209 " call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3210 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3211
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3212 " call Dret("LocalBrowseChgDir <".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3213 return dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3214 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3215
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3216 " ---------------------------------------------------------------------
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3217 " LocalBrowseShellCmdRefresh: this function is called after a user has {{{2
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3218 " performed any shell command. The idea is to cause all local-browsing
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3219 " buffers to be refreshed after a user has executed some shell command,
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3220 " on the chance that s/he removed/created a file/directory with it.
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3221 fun! s:LocalBrowseShellCmdRefresh()
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3222 " call Dfunc("LocalBrowseShellCmdRefresh() browselist=".string(s:netrw_browselist))
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
3223 " GO through all buffers on netrw_browselist (ie. just local-netrw buffers):
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
3224 " | refresh any netrw window
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
3225 " | wipe out any non-displaying netrw buffer
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3226 let curwin = winnr()
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3227 let ibl = 0
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3228 for ibuf in s:netrw_browselist
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3229 if bufwinnr(ibuf) == -1
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3230 " call Decho("wiping buf#".ibuf)
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
3231 exe "silent! bw ".ibuf
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3232 call remove(s:netrw_browselist,ibl)
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3233 " call Decho("browselist=".string(s:netrw_browselist))
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3234 continue
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3235 else
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3236 " call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf))
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3237 exe bufwinnr(ibuf)."wincmd w"
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3238 call s:NetRefresh(s:LocalBrowseChgDir(b:netrw_curdir,'./'),1)
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3239 endif
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3240 let ibl= ibl + 1
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3241 endfor
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3242 exe curwin."wincmd w"
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3243
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3244 " call Dret("LocalBrowseShellCmdRefresh")
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3245 endfun
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3246
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3247 " ---------------------------------------------------------------------
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3248 " LocalBrowseRm: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3249 fun! s:LocalBrowseRm(path) range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3250 " call Dfunc("LocalBrowseRm(path<".a:path.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3251 " call Decho("firstline=".a:firstline." lastline=".a:lastline)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3252
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3253 " preparation for removing multiple files/directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3254 let ctr = a:firstline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3255 let ret = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3256 let all= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3257
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3258 " remove multiple files and directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3259 while ctr <= a:lastline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3260 exe "keepjumps ".ctr
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3261
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3262 " sanity checks
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3263 if line(".") < w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3264 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3265 continue
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3266 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3267 let curword= s:NetGetWord()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3268 if curword == "./" || curword == "../"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3269 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3270 continue
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3271 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3272
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3273 norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3274 let rmfile= a:path."/".curword
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3275 " call Decho("rmfile<".rmfile.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3276
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3277 if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3278 " attempt to remove file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3279 if !all
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3280 echohl Statement
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3281 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3282 let ok= input("Confirm deletion of file<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3283 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3284 echohl NONE
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3285 if ok == ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3286 let ok="no"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3287 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3288 " call Decho("response: ok<".ok.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3289 let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3290 " call Decho("response: ok<".ok."> (after sub)")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3291 if ok =~ 'a\%[ll]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3292 let all= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3293 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3294 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3295
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3296 if all || ok =~ 'y\%[es]' || ok == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3297 let ret= delete(rmfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3298 " call Decho("errcode=".v:shell_error." ret=".ret)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3299 elseif ok =~ 'q\%[uit]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3300 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3301 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3302
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3303 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3304 " attempt to remove directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3305 if !all
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3306 echohl Statement
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3307 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3308 let ok= input("Confirm deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3309 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3310 let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3311 if ok == ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3312 let ok="no"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3313 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3314 if ok =~ 'a\%[ll]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3315 let all= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3316 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3317 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3318 let rmfile= substitute(rmfile,'[\/]$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3319
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3320 if all || ok =~ 'y\%[es]' || ok == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3321 " call Decho("1st attempt: system(".g:netrw_local_rmdir.' "'.rmfile.'")')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3322 call system(g:netrw_local_rmdir.' "'.rmfile.'"')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3323 " call Decho("v:shell_error=".v:shell_error)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3324
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3325 if v:shell_error != 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3326 " call Decho("2nd attempt to remove directory<".rmfile.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3327 let errcode= delete(rmfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3328 " call Decho("errcode=".errcode)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3329
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3330 if errcode != 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3331 if has("unix")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3332 " call Decho("3rd attempt to remove directory<".rmfile.">")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3333 call system("rm ".rmfile)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3334 if v:shell_error != 0 && !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3335 echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3336 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3337 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3338 elseif !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3339 echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3340 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3341 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3342 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3343 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3344
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3345 elseif ok =~ 'q\%[uit]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3346 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3347 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3348 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3349
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3350 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3351 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3352
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3353 " refresh the directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3354 let curline= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3355 " call Decho("refresh the directory")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3356 call s:NetRefresh(s:LocalBrowseChgDir(b:netrw_curdir,'./'),1)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3357 exe curline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3358
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3359 " call Dret("LocalBrowseRm")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3360 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3361
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3362 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3363 " LocalBrowseRename: rename a remote file or directory {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3364 fun! s:LocalBrowseRename(path) range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3365 " call Dfunc("LocalBrowseRename(path<".a:path.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3366
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3367 " preparation for removing multiple files/directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3368 let ctr= a:firstline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3369
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3370 " attempt to rename files/directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3371 while ctr <= a:lastline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3372 exe "keepjumps ".ctr
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3373
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3374 " sanity checks
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3375 if line(".") < w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3376 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3377 continue
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3378 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3379 let curword= s:NetGetWord()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3380 if curword == "./" || curword == "../"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3381 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3382 continue
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3383 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3384
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3385 norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3386 let oldname= a:path."/".curword
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3387 " call Decho("oldname<".oldname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3388
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3389 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3390 let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3391 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3392
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3393 let ret= rename(oldname,newname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3394 " call Decho("renaming <".oldname."> to <".newname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3395
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3396 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3397 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3398
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3399 " refresh the directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3400 let curline= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3401 " call Decho("refresh the directory listing")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3402 call s:NetRefresh(s:LocalBrowseChgDir(b:netrw_curdir,'./'),1)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3403 exe "keepjumps ".curline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3404 " call Dret("LocalBrowseRename")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3405 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3406
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3407 " ---------------------------------------------------------------------
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3408 " LocalFastBrowser: handles setting up/taking down fast browsing for the {{{2
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3409 " local browser
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3410 fun! s:LocalFastBrowser()
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3411 " call Dfunc("LocalFastBrowser()")
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3412
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3413 " initialize browselist, a list of buffer numbers that the local browser has used
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3414 if !exists("s:netrw_browselist")
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3415 let s:netrw_browselist= []
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3416 endif
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3417
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3418 " append current buffer to fastbrowse list
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3419 if g:netrw_fastbrowse <= 1 && (empty(s:netrw_browselist) || bufnr("%") > s:netrw_browselist[-1])
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3420 call add(s:netrw_browselist,bufnr("%"))
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3421 " call Decho("browselist=".string(s:netrw_browselist))
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3422 endif
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3423
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3424 " enable autocmd events to handle refreshing/removing local browser buffers
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3425 " If local browse buffer is currently showing: refresh it
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3426 " If local browse buffer is currently hidden : wipe it
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3427 if !exists("s:netrw_browser_shellcmd") && g:netrw_fastbrowse <= 1
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3428 " call Decho("setting up local-browser shell command refresh")
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3429 let s:netrw_browser_shellcmd= 1
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3430 augroup AuNetrwShellCmd
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3431 au!
842
a209672376fd updated for version 7.0f
vimboss
parents: 841
diff changeset
3432 if (has("win32") || has("win95") || has("win64") || has("win16"))
a209672376fd updated for version 7.0f
vimboss
parents: 841
diff changeset
3433 au ShellCmdPost * call s:LocalBrowseShellCmdRefresh()
a209672376fd updated for version 7.0f
vimboss
parents: 841
diff changeset
3434 else
a209672376fd updated for version 7.0f
vimboss
parents: 841
diff changeset
3435 au ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh()
a209672376fd updated for version 7.0f
vimboss
parents: 841
diff changeset
3436 endif
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3437 augroup END
820
57c7403f6599 updated for version 7.0c11
vimboss
parents: 819
diff changeset
3438 endif
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3439
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3440 " user must have changed fastbrowse to its fast setting, so remove
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3441 " the associated autocmd events
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3442 if g:netrw_fastbrowse > 1 && exists("s:netrw_browser_shellcmd")
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3443 unlet s:netrw_browser_shellcmd
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3444 augroup AuNetrwShellCmd
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3445 au!
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3446 augroup END
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3447 augroup! AuNetrwShellCmd
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3448 endif
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3449
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3450 " call Dret("LocalFastBrowser")
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3451 endfun
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3452
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3453 " ---------------------------------------------------------------------
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3454 " LocalObtain: copy selected file to current working directory {{{2
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3455 fun! s:LocalObtain()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3456 " call Dfunc("LocalObtain()")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3457 if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3458 let fname= expand("<cWORD>")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3459 let fcopy= readfile(b:netrw_curdir."/".fname,"b")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3460 call writefile(fcopy,getcwd()."/".fname,"b")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3461 elseif !exists("b:netrw_curdir")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3462 echohl Error | echo "***netrw*** local browsing directory doesn't exist!"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3463 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3464 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3465 echohl Error | echo "***netrw*** local browsing directory and current directory are identical"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3466 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3467 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3468 " call Dret("LocalObtain")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3469 endfun
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3470
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3471 " ---------------------------------------------------------------------
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3472 " LocalPreview: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3473 fun! s:LocalPreview(path) range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3474 " call Dfunc("LocalPreview(path<".a:path.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3475 if has("quickfix")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3476 if !isdirectory(a:path)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3477 exe "pedit ".a:path
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3478 elseif !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3479 echohl WarningMsg | echo "***netrw*** sorry, cannot preview a directory such as <".a:path.">" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3480 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3481 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3482 elseif !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3483 echohl WarningMsg | echo "***netrw*** sorry, to preview your vim needs the quickfix feature compiled in" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3484 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3485 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3486 " call Dret("LocalPreview")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3487 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3488
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3489 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3490 " Explore: launch the local browser in the directory of the current file {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3491 " dosplit==0: the window will be split iff the current file has
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3492 " been modified
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3493 " dosplit==1: the window will be split before running the local
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3494 " browser
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3495 fun! netrw#Explore(indx,dosplit,style,...)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3496 " call Dfunc("Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3497
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3498 " if dosplit or file has been modified
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3499 if a:dosplit || &modified
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3500 call s:SaveWinVars()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3501
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3502 if a:style == 0 " Explore, Sexplore
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3503 exe g:netrw_winsize."wincmd s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3504 " call Decho("style=0: Explore or Sexplore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3505
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3506 elseif a:style == 1 "Explore!, Sexplore!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3507 exe g:netrw_winsize."wincmd v"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3508 " call Decho("style=1: Explore! or Sexplore!")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3509
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3510 elseif a:style == 2 " Hexplore
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3511 exe "bel ".g:netrw_winsize."wincmd s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3512 " call Decho("style=2: Hexplore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3513
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3514 elseif a:style == 3 " Hexplore!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3515 exe "abo ".g:netrw_winsize."wincmd s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3516 " call Decho("style=3: Hexplore!")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3517
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3518 elseif a:style == 4 " Vexplore
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3519 exe "lefta ".g:netrw_winsize."wincmd v"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3520 " call Decho("style=4: Vexplore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3521
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3522 elseif a:style == 5 " Vexplore!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3523 exe "rightb ".g:netrw_winsize."wincmd v"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3524 " call Decho("style=5: Vexplore!")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3525 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3526 call s:CopyWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3527 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3528 norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3529
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3530 if a:1 =~ '^\*/'
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3531 " Explore */pattern
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3532 let pattern= substitute(a:1,'^\*/\(.*\)$','\1','')
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3533 " call Decho("Explore */pat: a:1<".a:1."> -> pattern<".pattern.">")
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3534 elseif a:1 =~ '^\*\*//'
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3535 " Explore **//pattern
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3536 let pattern = substitute(a:1,'^\*\*//','','')
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3537 let starstarpat = 1
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3538 " call Decho("Explore **//pat: a:1<".a:1."> -> pattern<".pattern.">")
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3539 endif
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3540
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3541 if a:1 == "" && a:indx >= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3542 " Explore Hexplore Vexplore Sexplore
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3543 " call Decho("Explore Hexplore Vexplore Sexplore")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3544 let newdir= substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3545 if newdir =~ '^scp:' || newdir =~ '^ftp:'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3546 " call Decho("calling NetBrowse(newdir<".newdir.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3547 call s:NetBrowse(newdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3548 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3549 if newdir == ""|let newdir= getcwd()|endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3550 " call Decho("calling LocalBrowse(newdir<".newdir.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3551 call s:LocalBrowse(newdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3552 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3553
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3554 elseif a:1 =~ '^\*\*/' || a:indx < 0 || a:1 =~ '^\*/'
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3555 " Nexplore, Pexplore, Explore **/... , or Explore */pattern
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3556 " call Decho("Nexplore, Pexplore, <s-down>, <s-up>, Explore ".a:1)
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3557 let s:didstarstar= 1
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3558 if exists("b:netrw_curdir")
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3559 nnoremap <buffer> <silent> <s-up> :Pexplore<cr>
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3560 nnoremap <buffer> <silent> <s-down> :Nexplore<cr>
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3561 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3562
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3563 if has("path_extra")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3564 if !exists("w:netrw_explore_indx")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3565 let w:netrw_explore_indx= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3566 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3567 let indx = a:indx
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3568 " call Decho("set indx=".indx)
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3569 "
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3570 if indx == -1
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3571 "Nexplore
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3572 if !exists("w:netrw_explore_list") " sanity check
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3573 echohl WarningMsg | echo "***netrw*** using Nexplore or <s-down> improperly; see help for netrw-starstar" | echohl None
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3574 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3575 " call Dret("Explore")
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3576 return
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3577 endif
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3578 let indx = w:netrw_explore_indx
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3579 let curfile= w:netrw_explore_list[indx]
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3580 while indx < w:netrw_explore_listlen && curfile == w:netrw_explore_list[indx]
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3581 let indx= indx + 1
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3582 " call Decho("indx=".indx)
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3583 endwhile
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3584 " call Decho("Nexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx)
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3585
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3586 elseif indx == -2
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3587 "Pexplore
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3588 if !exists("w:netrw_explore_list") " sanity check
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3589 echohl WarningMsg | echo "***netrw*** using Pexplore or <s-up> improperly; see help for netrw-starstar" | echohl None
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3590 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3591 " call Dret("Explore")
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3592 return
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3593 endif
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3594 let indx = w:netrw_explore_indx
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3595 let curfile= w:netrw_explore_list[indx]
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3596 while indx > 0 && curfile == w:netrw_explore_list[indx]
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3597 let indx= indx - 1
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3598 endwhile
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3599 " call Decho("Pexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx)
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3600
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3601 else
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3602 " Explore -- initialize
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3603 " build list of files to Explore with Nexplore/Pexplore
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3604 " call Decho("Explore -- initialize")
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3605 let w:netrw_explore_indx= 0
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3606 if !exists("b:netrw_curdir")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3607 let b:netrw_curdir= getcwd()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3608 endif
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3609 " call Decho("b:netrw_curdir<".b:netrw_curdir.">")
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3610 if exists("pattern")
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3611 " call Decho("building list based on pattern<".pattern."> cwd<".getcwd().">")
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3612 if exists("starstarpat")
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3613 exe "vimgrep /".pattern."/gj "."**/*"
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3614 let s:netrw_curdir= b:netrw_curdir
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3615 let w:netrw_explore_list = map(getqflist(),'s:netrw_curdir."/".bufname(v:val.bufnr)')
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3616 else
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3617 exe "vimgrep /".pattern."/gj ".b:netrw_curdir."/*"
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3618 if (has("win32") || has("win95") || has("win64") || has("win16"))
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3619 let w:netrw_explore_list = map(getqflist(),'bufname(v:val.bufnr)')
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3620 else
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3621 let w:netrw_explore_list = map(getqflist(),'b:netrw_curdir.bufname(v:val.bufnr)')
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3622 endif
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3623 endif
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3624 else
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3625 " call Decho("building list based on ".b:netrw_curdir."/".a:1)
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3626 let w:netrw_explore_list= split(expand(b:netrw_curdir."/".a:1),'\n')
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3627 endif
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3628
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3629 let w:netrw_explore_listlen = len(w:netrw_explore_list)
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3630 " call Decho("w:netrw_explore_list<".string(w:netrw_explore_list)."> listlen=".w:netrw_explore_listlen)
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3631
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3632 if w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3633 echohl WarningMsg | echo "***netrw*** no files matched" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3634 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3635 " call Dret("Explore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3636 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3637 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3638 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3639
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3640 " NetrwStatusLine support - for exploring support
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3641 let w:netrw_explore_indx= indx
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3642 " call Decho("explorelist<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3643
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3644 " sanity check
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3645 if indx >= w:netrw_explore_listlen || indx < 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3646 let indx= (indx < 0)? 0 : ( w:netrw_explore_listlen - 1 )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3647 echohl WarningMsg | echo "***netrw*** no more files match Explore pattern" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3648 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3649 " call Dret("Explore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3650 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3651 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3652
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3653 exe "let dirfile= w:netrw_explore_list[".indx."]"
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3654 " call Decho("dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3655 let newdir= substitute(dirfile,'/[^/]*$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3656 " call Decho("newdir<".newdir.">")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3657
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3658 " call Decho("calling LocalBrowse(newdir<".newdir.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3659 call s:LocalBrowse(newdir)
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3660 if w:netrw_longlist == 0 || w:netrw_longlist == 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3661 call search('^'.substitute(dirfile,"^.*/","","").'\>',"W")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3662 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3663 call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3664 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3665 let w:netrw_explore_mtchcnt = indx + 1
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3666 let w:netrw_explore_bufnr = bufnr("%")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3667 let w:netrw_explore_line = line(".")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3668 call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3669 " call Decho("explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3670
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3671 else
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3672 if !exists("g:netrw_quiet")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3673 echohl WarningMsg | echo "***netrw*** your vim needs the +path_extra feature for Exploring with **!" | echohl None | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3674 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3675 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3676 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3677
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3678 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3679 " call Decho("Explore newdir<".a:1.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3680 let newdir= a:1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3681 call s:LocalBrowse(newdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3682 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3683
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3684 " call Dret("Explore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3685 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3686
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3687 " ---------------------------------------------------------------------
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3688 " SetupNetrwStatusLine: {{{2
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3689 fun! s:SetupNetrwStatusLine(statline)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3690 " call Dfunc("SetupNetrwStatusLine(statline<".a:statline.">)")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3691
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3692 if !exists("s:netrw_setup_statline")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3693 let s:netrw_setup_statline= 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3694 " call Decho("do first-time status line setup")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3695
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3696 if !exists("s:netrw_users_stl")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3697 let s:netrw_users_stl= &stl
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3698 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3699 if !exists("s:netrw_users_ls")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3700 let s:netrw_users_ls= &laststatus
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3701 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3702
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3703 " set up User9 highlighting as needed
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3704 let keepa= @a
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3705 redir @a
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3706 try
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3707 hi User9
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3708 catch /^Vim\%((\a\+)\)\=:E411/
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3709 if &bg == "dark"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3710 hi User9 ctermfg=yellow ctermbg=blue guifg=yellow guibg=blue
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3711 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3712 hi User9 ctermbg=yellow ctermfg=blue guibg=yellow guifg=blue
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3713 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3714 endtry
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3715 redir END
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3716 let @a= keepa
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3717 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3718
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3719 " set up status line (may use User9 highlighting)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3720 " insure that windows have a statusline
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3721 " make sure statusline is displayed
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3722 let &stl=a:statline
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3723 set laststatus=2
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3724 " call Decho("stl=".&stl)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3725 redraw!
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3726
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3727 " call Dret("SetupNetrwStatusLine : stl=".&stl)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3728 endfun
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3729
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3730 " ---------------------------------------------------------------------
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3731 " NetrwStatusLine: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3732 fun! NetrwStatusLine()
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3733
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3734 " vvv NetrwStatusLine() debugging vvv
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3735 " let g:stlmsg=""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3736 " if !exists("w:netrw_explore_bufnr")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3737 " let g:stlmsg="!X<explore_bufnr>"
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3738 " elseif w:netrw_explore_bufnr != bufnr("%")
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3739 " let g:stlmsg="explore_bufnr!=".bufnr("%")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3740 " endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3741 " if !exists("w:netrw_explore_line")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3742 " let g:stlmsg=" !X<explore_line>"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3743 " elseif w:netrw_explore_line != line(".")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3744 " let g:stlmsg=" explore_line!={line(.)<".line(".").">"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3745 " endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3746 " if !exists("w:netrw_explore_list")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3747 " let g:stlmsg=" !X<explore_list>"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3748 " endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3749 " ^^^ NetrwStatusLine() debugging ^^^
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3750
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3751 if !exists("w:netrw_explore_bufnr") || w:netrw_explore_bufnr != bufnr("%") || !exists("w:netrw_explore_line") || w:netrw_explore_line != line(".") || !exists("w:netrw_explore_list")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3752 " restore user's status line
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3753 let &stl = s:netrw_users_stl
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3754 let &laststatus = s:netrw_users_ls
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3755 if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3756 if exists("w:netrw_explore_line")|unlet w:netrw_explore_line|endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3757 return ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3758 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3759 return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3760 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3761 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3762
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3763 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3764 " NetGetcwd: get the current directory. {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3765 " Change backslashes to forward slashes, if any.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3766 " If doesc is true, escape certain troublesome characters
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3767 fun! s:NetGetcwd(doesc)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3768 " call Dfunc("NetGetcwd(doesc=".a:doesc.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3769 let curdir= substitute(getcwd(),'\\','/','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3770 if curdir !~ '[\/]$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3771 let curdir= curdir.'/'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3772 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3773 if a:doesc
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3774 let curdir= escape(curdir,s:netrw_cd_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3775 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3776 " call Dret("NetGetcwd <".curdir.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3777 return curdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3778 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3779
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3780 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3781 " NetMethod: determine method of transfer {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3782 " method == 1: rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3783 " 2: ftp + <.netrc>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3784 " 3: ftp + machine, id, password, and [path]filename
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3785 " 4: scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3786 " 5: http (wget)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3787 " 6: cadaver
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3788 " 7: rsync
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3789 " 8: fetch
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3790 " 9: sftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3791 fun! s:NetMethod(choice) " globals: method machine id passwd fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3792 " call Dfunc("NetMethod(a:choice<".a:choice.">)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3793
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3794 " initialization
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3795 let b:netrw_method = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3796 let g:netrw_machine = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3797 let b:netrw_fname = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3798 let g:netrw_port = ""
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3799 let g:netrw_choice = a:choice
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3800
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3801 " Patterns:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3802 " mipf : a:machine a:id password filename Use ftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3803 " mf : a:machine filename Use ftp + <.netrc> or g:netrw_uid g:netrw_passwd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3804 " ftpurm : ftp://[user@]host[[#:]port]/filename Use ftp + <.netrc> or g:netrw_uid g:netrw_passwd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3805 " rcpurm : rcp://[user@]host/filename Use rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3806 " rcphf : [user@]host:filename Use rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3807 " scpurm : scp://[user@]host[[#:]port]/filename Use scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3808 " httpurm : http://[user@]host/filename Use wget
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3809 " davurm : [s]dav://host[:port]/path Use cadaver
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3810 " rsyncurm : rsync://host[:port]/path Use rsync
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3811 " fetchurm : fetch://[user@]host[:http]/filename Use fetch (defaults to ftp, override for http)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3812 " sftpurm : sftp://[user@]host/filename Use scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3813 let mipf = '^\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3814 let mf = '^\(\S\+\)\s\+\(\S\+\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3815 let ftpurm = '^ftp://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3816 let rcpurm = '^rcp://\%(\([^/@]\{-}\)@\)\=\([^/]\{-}\)/\(.*\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3817 let rcphf = '^\(\(\h\w*\)@\)\=\(\h\w*\):\([^@]\+\)$'
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3818 let scpurm = '^scp://\([^/#:]\+\)\%([#:]\(\d\+\)\)\=/\(.*\)$'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3819 let httpurm = '^http://\([^/]\{-}\)\(/.*\)\=$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3820 let davurm = '^s\=dav://\([^/]\+\)/\(.*/\)\([-_.~[:alnum:]]\+\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3821 let rsyncurm = '^rsync://\([^/]\{-}\)/\(.*\)\=$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3822 let fetchurm = '^fetch://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3823 let sftpurm = '^sftp://\([^/]\{-}\)/\(.*\)\=$'
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3824
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3825 " call Decho("determine method:")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3826 " Determine Method
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3827 " rcp://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3828 if match(a:choice,rcpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3829 " call Decho("rcp://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3830 let b:netrw_method = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3831 let userid = substitute(a:choice,rcpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3832 let g:netrw_machine = substitute(a:choice,rcpurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3833 let b:netrw_fname = substitute(a:choice,rcpurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3834 if userid != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3835 let g:netrw_uid= userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3836 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3837
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3838 " scp://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3839 elseif match(a:choice,scpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3840 " call Decho("scp://...")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3841 let b:netrw_method = 4
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3842 let g:netrw_machine = substitute(a:choice,scpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3843 let g:netrw_port = substitute(a:choice,scpurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3844 let b:netrw_fname = substitute(a:choice,scpurm,'\3',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3845
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3846 " http://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3847 elseif match(a:choice,httpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3848 " call Decho("http://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3849 let b:netrw_method = 5
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3850 let g:netrw_machine= substitute(a:choice,httpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3851 let b:netrw_fname = substitute(a:choice,httpurm,'\2',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3852
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3853 " dav://hostname[:port]/..path-to-file..
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3854 elseif match(a:choice,davurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3855 " call Decho("dav://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3856 let b:netrw_method= 6
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3857 if a:choice =~ '^s'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3858 let g:netrw_machine= 'https://'.substitute(a:choice,davurm,'\1/\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3859 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3860 let g:netrw_machine= 'http://'.substitute(a:choice,davurm,'\1/\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3861 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3862 let b:netrw_fname = substitute(a:choice,davurm,'\3',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3863
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3864 " rsync://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3865 elseif match(a:choice,rsyncurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3866 " call Decho("rsync://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3867 let b:netrw_method = 7
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3868 let g:netrw_machine= substitute(a:choice,rsyncurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3869 let b:netrw_fname = substitute(a:choice,rsyncurm,'\2',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3870
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3871 " ftp://[user@]hostname[[:#]port]/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3872 elseif match(a:choice,ftpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3873 " call Decho("ftp://...")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3874 let userid = substitute(a:choice,ftpurm,'\2',"")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3875 let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3876 let g:netrw_port = substitute(a:choice,ftpurm,'\4',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3877 let b:netrw_fname = substitute(a:choice,ftpurm,'\5',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3878 if userid != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3879 let g:netrw_uid= userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3880 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3881 if exists("g:netrw_uid") && exists("g:netrw_passwd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3882 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3883 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3884 if filereadable(expand("$HOME/.netrc")) && !exists("g:netrw_ignorenetrc")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3885 let b:netrw_method= 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3886 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3887 if !exists("g:netrw_uid") || g:netrw_uid == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3888 call NetUserPass()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3889 elseif !exists("g:netrw_passwd") || g:netrw_passwd == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3890 call NetUserPass(g:netrw_uid)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3891 " else just use current g:netrw_uid and g:netrw_passwd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3892 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3893 let b:netrw_method= 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3894 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3895 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3896
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3897 elseif match(a:choice,fetchurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3898 " call Decho("fetch://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3899 let b:netrw_method = 8
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3900 let g:netrw_userid = substitute(a:choice,fetchurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3901 let g:netrw_machine= substitute(a:choice,fetchurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3902 let b:netrw_option = substitute(a:choice,fetchurm,'\4',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3903 let b:netrw_fname = substitute(a:choice,fetchurm,'\5',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3904
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3905 " Issue an ftp : "machine id password [path/]filename"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3906 elseif match(a:choice,mipf) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3907 " call Decho("(ftp) host id pass file")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3908 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3909 let g:netrw_machine = substitute(a:choice,mipf,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3910 let g:netrw_uid = substitute(a:choice,mipf,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3911 let g:netrw_passwd = substitute(a:choice,mipf,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3912 let b:netrw_fname = substitute(a:choice,mipf,'\4',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3913
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3914 " Issue an ftp: "hostname [path/]filename"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3915 elseif match(a:choice,mf) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3916 " call Decho("(ftp) host file")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3917 if exists("g:netrw_uid") && exists("g:netrw_passwd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3918 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3919 let g:netrw_machine = substitute(a:choice,mf,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3920 let b:netrw_fname = substitute(a:choice,mf,'\2',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3921
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3922 elseif filereadable(expand("$HOME/.netrc"))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3923 let b:netrw_method = 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3924 let g:netrw_machine = substitute(a:choice,mf,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3925 let b:netrw_fname = substitute(a:choice,mf,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3926 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3927
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3928 " sftp://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3929 elseif match(a:choice,sftpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3930 " call Decho("sftp://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3931 let b:netrw_method = 9
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3932 let g:netrw_machine= substitute(a:choice,sftpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3933 let b:netrw_fname = substitute(a:choice,sftpurm,'\2',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3934
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3935 " Issue an rcp: hostname:filename" (this one should be last)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3936 elseif match(a:choice,rcphf) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3937 " call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3938 let b:netrw_method = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3939 let userid = substitute(a:choice,rcphf,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3940 let g:netrw_machine= substitute(a:choice,rcphf,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3941 let b:netrw_fname = substitute(a:choice,rcphf,'\4',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3942 " call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3943 " call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3944 " call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3945 " call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3946 if userid != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3947 let g:netrw_uid= userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3948 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3949 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3950 " don't let PCs try <.netrc>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3951 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3952 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3953
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3954 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3955 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3956 echohl Error | echo "***netrw*** cannot determine method" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3957 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3958 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3959 let b:netrw_method = -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3960 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3961
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3962 " remove any leading [:#] from port number
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3963 if g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3964 let g:netrw_port = substitute(g:netrw_port,'[#:]\+','','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3965 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3966
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3967 " call Decho("a:choice <".a:choice.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3968 " call Decho("b:netrw_method <".b:netrw_method.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3969 " call Decho("g:netrw_machine<".g:netrw_machine.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3970 " call Decho("g:netrw_port <".g:netrw_port.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3971 " if exists("g:netrw_uid") "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3972 " call Decho("g:netrw_uid <".g:netrw_uid.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3973 " endif "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3974 " if exists("g:netrw_passwd") "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3975 " call Decho("g:netrw_passwd <".g:netrw_passwd.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3976 " endif "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3977 " call Decho("b:netrw_fname <".b:netrw_fname.">")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3978 " call Dret("NetMethod : b:netrw_method=".b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3979 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3980
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3981 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3982 " NetUserPass: set username and password for subsequent ftp transfer {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3983 " Usage: :call NetUserPass() -- will prompt for userid and password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3984 " :call NetUserPass("uid") -- will prompt for password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3985 " :call NetUserPass("uid","password") -- sets global userid and password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3986 fun! NetUserPass(...)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3987
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3988 " get/set userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3989 if a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3990 " call Dfunc("NetUserPass(a:0<".a:0.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3991 if !exists("g:netrw_uid") || g:netrw_uid == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3992 " via prompt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3993 let g:netrw_uid= input('Enter username: ')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3994 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3995 else " from command line
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3996 " call Dfunc("NetUserPass(a:1<".a:1.">) {")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3997 let g:netrw_uid= a:1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3998 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3999
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4000 " get password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4001 if a:0 <= 1 " via prompt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4002 " call Decho("a:0=".a:0." case <=1:")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4003 let g:netrw_passwd= inputsecret("Enter Password: ")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4004 else " from command line
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4005 " call Decho("a:0=".a:0." case >1: a:2<".a:2.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4006 let g:netrw_passwd=a:2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4007 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4008
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4009 " call Dret("NetUserPass")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4010 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4011
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4012 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4013 " NetOptionSave: save options and set to "standard" form {{{2
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4014 fun! s:NetOptionSave()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4015 " call Dfunc("NetOptionSave()")
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4016 if !exists("w:netoptionsave")
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4017 let w:netoptionsave= 1
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4018 else
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4019 " call Dret("NetOptionSave : netoptionsave=".w:netoptionsave)
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4020 return
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4021 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4022
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4023 " Get Temporary Filename
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
4024 let w:acdkeep = &acd
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
4025 let w:aikeep = &ai
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4026 let w:fokeep = &fo
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4027 let w:cikeep = &ci
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4028 let w:cinkeep = &cin
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4029 let w:cinokeep = &cino
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4030 let w:comkeep = &com
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4031 let w:cpokeep = &cpo
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
4032 let w:hidkeep = &hidden
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4033 let w:magickeep = &magic
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4034 let w:gdkeep = &gd
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4035 let w:repkeep = &report
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4036 let w:spellkeep = &spell
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4037 let w:twkeep = &tw
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4038 setlocal cino =
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4039 setlocal com =
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4040 setlocal cpo -=aA
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
4041 setlocal noacd nocin noai noci magic nospell fo=nroql2 nohid
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4042 setlocal tw =0
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4043 setlocal report=10000
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4044 if has("win32") && !has("win95")
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4045 let w:swfkeep= &swf
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4046 setlocal noswf
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4047 " call Decho("setting w:swfkeep to <".&swf.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4048 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4049
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4050 " call Dret("NetOptionSave")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4051 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4052
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4053 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4054 " NetOptionRestore: restore options {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4055 fun! s:NetOptionRestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4056 " call Dfunc("NetOptionRestore()")
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4057 if !exists("w:netoptionsave")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
4058 " call Dret("NetOptionRestore : w:netoptionsave doesn't exist")
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4059 return
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4060 endif
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4061 unlet w:netoptionsave
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4062
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
4063 if exists("w:acdkeep") |let &acd = w:acdkeep |unlet w:acdkeep |endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4064 if exists("w:aikeep") |let &ai = w:aikeep |unlet w:aikeep |endif
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4065 if exists("w:cikeep") |let &ci = w:cikeep |unlet w:cikeep |endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4066 if exists("w:cinkeep") |let &cin = w:cinkeep |unlet w:cinkeep |endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4067 if exists("w:cinokeep") |let &cino = w:cinokeep |unlet w:cinokeep |endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4068 if exists("w:comkeep") |let &com = w:comkeep |unlet w:comkeep |endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4069 if exists("w:cpokeep") |let &cpo = w:cpokeep |unlet w:cpokeep |endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4070 if exists("w:fokeep") |let &fo = w:fokeep |unlet w:fokeep |endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4071 if exists("w:gdkeep") |let &gd = w:gdkeep |unlet w:gdkeep |endif
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
4072 if exists("w:hidkeep") |let &hidden = w:hidkeep |unlet w:hidkeep |endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4073 if exists("w:magic") |let &magic = w:magic |unlet w:magic |endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4074 if exists("w:repkeep") |let &report = w:repkeep |unlet w:repkeep |endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4075 if exists("w:spellkeep")|let &spell = w:spellkeep |unlet w:spellkeep|endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4076 if exists("w:twkeep") |let &tw = w:twkeep |unlet w:twkeep |endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4077 if exists("w:swfkeep")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4078 if &directory == "" && exists("w:swfkeep")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4079 " user hasn't specified a swapfile directory;
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4080 " netrw will temporarily make the swapfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4081 " directory the current local one.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4082 let &directory = getcwd()
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4083 silent! let &swf = w:swfkeep
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4084 set directory=
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4085 else
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4086 let &swf= w:swfkeep
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4087 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4088 unlet w:swfkeep
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4089 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4090
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4091 " call Dret("NetOptionRestore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4092 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4093
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4094 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4095 " NetReadFixup: this sort of function is typically written by the user {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4096 " to handle extra junk that their system's ftp dumps
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4097 " into the transfer. This function is provided as an
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4098 " example and as a fix for a Windows 95 problem: in my
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4099 " experience, win95's ftp always dumped four blank lines
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4100 " at the end of the transfer.
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4101 if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4102 fun! NetReadFixup(method, line1, line2)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4103 " call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4104 if method == 3 " ftp (no <.netrc>)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4105 let fourblanklines= line2 - 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4106 silent fourblanklines.",".line2."g/^\s*/d"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4107 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4108 " call Dret("NetReadFixup")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4109 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4110 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4111
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4112 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4113 " NetSort: Piet Delport's BISort2() function, modified to take a range {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4114 if v:version < 700
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4115 fun! s:NetSort() range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4116 " " call Dfunc("NetSort()")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4117
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4118 let i = a:firstline + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4119 while i <= a:lastline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4120 " find insertion point via binary search
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4121 let i_val = getline(i)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4122 let lo = a:firstline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4123 let hi = i
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4124 while lo < hi
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4125 let mid = (lo + hi) / 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4126 let mid_val = getline(mid)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4127 if g:netrw_sort_direction =~ '^n'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4128 " normal sorting order
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4129 if i_val < mid_val
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4130 let hi = mid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4131 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4132 let lo = mid + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4133 if i_val == mid_val | break | endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4134 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4135 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4136 " reverse sorting order
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4137 if i_val > mid_val
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4138 let hi = mid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4139 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4140 let lo = mid + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4141 if i_val == mid_val | break | endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4142 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4143 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4144 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4145 " do insert
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4146 if lo < i
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4147 exe 'keepjumps '.i.'d_'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4148 keepjumps call append(lo - 1, i_val)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4149 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4150 let i = i + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4151 endwhile
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4152
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4153 " " call Dret("NetSort")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4154 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4155 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4156
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4157 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4158 " SetSort: sets up the sort based on the g:netrw_sort_sequence {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4159 " What this function does is to compute a priority for the patterns
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4160 " in the g:netrw_sort_sequence. It applies a substitute to any
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4161 " "files" that satisfy each pattern, putting the priority / in
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4162 " front. An "*" pattern handles the default priority.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4163 fun! s:SetSort()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4164 " call Dfunc("SetSort() bannercnt=".w:netrw_bannercnt)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
4165 if w:netrw_longlist == 1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4166 let seqlist = substitute(g:netrw_sort_sequence,'\$','\\%(\t\\|\$\\)','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4167 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4168 let seqlist = g:netrw_sort_sequence
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4169 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4170 " sanity check -- insure that * appears somewhere
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4171 if seqlist == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4172 let seqlist= '*'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4173 elseif seqlist !~ '\*'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4174 let seqlist= seqlist.',*'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4175 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4176 let priority = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4177 while seqlist != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4178 if seqlist =~ ','
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4179 let seq = substitute(seqlist,',.*$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4180 let seqlist = substitute(seqlist,'^.\{-},\(.*\)$','\1','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4181 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4182 let seq = seqlist
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4183 let seqlist = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4184 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4185 let eseq= escape(seq,'/')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4186 if priority < 10
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4187 let spriority= "00".priority.'\/'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4188 elseif priority < 100
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4189 let spriority= "0".priority.'\/'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4190 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4191 let spriority= priority.'\/'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4192 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4193 " call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4194
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4195 " sanity check
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4196 if w:netrw_bannercnt > line("$")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4197 " apparently no files were left after a Hiding pattern was used
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4198 " call Dret("SetSort : no files left after hiding")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4199 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4200 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4201 if seq == '*'
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4202 exe 'silent keepjumps '.w:netrw_bannercnt.',$v/^\d\{3}\//s/^/'.spriority.'/'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4203 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4204 exe 'silent keepjumps '.w:netrw_bannercnt.',$g/'.eseq.'/s/^/'.spriority.'/'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4205 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4206 let priority = priority + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4207 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4208
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
4209 " Following line associated with priority -- items that satisfy a priority
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
4210 " pattern get prefixed by ###/ which permits easy sorting by priority.
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
4211 " Sometimes files can satisfy multiple priority patterns -- only the latest
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
4212 " priority pattern needs to be retained. So, at this point, these excess
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
4213 " priority prefixes need to be removed, but not directories that happen to
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
4214 " be just digits themselves.
820
57c7403f6599 updated for version 7.0c11
vimboss
parents: 819
diff changeset
4215 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\(\d\{3}\/\)\%(\d\{3}\/\)\+\ze./\1/e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4216
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4217 " call Dret("SetSort")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4218 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4219
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4220 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4221 " SaveWinVars: (used by Explore()) {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4222 fun! s:SaveWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4223 " call Dfunc("SaveWinVars()")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4224 if exists("w:netrw_bannercnt") |let s:bannercnt = w:netrw_bannercnt |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4225 if exists("w:netrw_method") |let s:method = w:netrw_method |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4226 if exists("w:netrw_prvdir") |let s:prvdir = w:netrw_prvdir |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4227 if exists("w:netrw_explore_indx") |let s:explore_indx = w:netrw_explore_indx |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4228 if exists("w:netrw_explore_listlen")|let s:explore_listlen = w:netrw_explore_listlen|endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4229 if exists("w:netrw_explore_mtchcnt")|let s:explore_mtchcnt = w:netrw_explore_mtchcnt|endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4230 if exists("w:netrw_explore_bufnr") |let s:explore_bufnr = w:netrw_explore_bufnr |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4231 if exists("w:netrw_explore_line") |let s:explore_line = w:netrw_explore_line |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4232 if exists("w:netrw_explore_list") |let s:explore_list = w:netrw_explore_list |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4233 " call Dret("SaveWinVars")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4234 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4235
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4236 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4237 " CopyWinVars: (used by Explore()) {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4238 fun! s:CopyWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4239 " call Dfunc("CopyWinVars()")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4240 if exists("s:bannercnt") |let w:netrw_bannercnt = s:bannercnt |unlet s:bannercnt |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4241 if exists("s:method") |let w:netrw_method = s:method |unlet s:method |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4242 if exists("s:prvdir") |let w:netrw_prvdir = s:prvdir |unlet s:prvdir |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4243 if exists("s:explore_indx") |let w:netrw_explore_indx = s:explore_indx |unlet s:explore_indx |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4244 if exists("s:explore_listlen")|let w:netrw_explore_listlen = s:explore_listlen|unlet s:explore_listlen|endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4245 if exists("s:explore_mtchcnt")|let w:netrw_explore_mtchcnt = s:explore_mtchcnt|unlet s:explore_mtchcnt|endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4246 if exists("s:explore_bufnr") |let w:netrw_explore_bufnr = s:explore_bufnr |unlet s:explore_bufnr |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4247 if exists("s:explore_line") |let w:netrw_explore_line = s:explore_line |unlet s:explore_line |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4248 if exists("s:explore_list") |let w:netrw_explore_list = s:explore_list |unlet s:explore_list |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4249 " call Dret("CopyWinVars")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4250 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4251
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4252 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4253 " SetBufWinVars: (used by NetBrowse() and LocalBrowse()) {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4254 " To allow separate windows to have their own activities, such as
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4255 " Explore **/pattern, several variables have been made window-oriented.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4256 " However, when the user splits a browser window (ex: ctrl-w s), these
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4257 " variables are not inherited by the new window. SetBufWinVars() and
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4258 " UseBufWinVars() get around that.
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4259 fun! s:SetBufWinVars()
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4260 " call Dfunc("SetBufWinVars()")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
4261 if exists("w:netrw_longlist") |let b:netrw_longlist = w:netrw_longlist |endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4262 if exists("w:netrw_bannercnt") |let b:netrw_bannercnt = w:netrw_bannercnt |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4263 if exists("w:netrw_method") |let b:netrw_method = w:netrw_method |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4264 if exists("w:netrw_prvdir") |let b:netrw_prvdir = w:netrw_prvdir |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4265 if exists("w:netrw_explore_indx") |let b:netrw_explore_indx = w:netrw_explore_indx |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4266 if exists("w:netrw_explore_listlen")|let b:netrw_explore_listlen = w:netrw_explore_listlen|endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4267 if exists("w:netrw_explore_mtchcnt")|let b:netrw_explore_mtchcnt = w:netrw_explore_mtchcnt|endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4268 if exists("w:netrw_explore_bufnr") |let b:netrw_explore_bufnr = w:netrw_explore_bufnr |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4269 if exists("w:netrw_explore_line") |let b:netrw_explore_line = w:netrw_explore_line |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4270 if exists("w:netrw_explore_list") |let b:netrw_explore_list = w:netrw_explore_list |endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4271 " call Dret("SetBufWinVars")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4272 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4273
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4274 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4275 " UseBufWinVars: (used by NetBrowse() and LocalBrowse() {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4276 " Matching function to BufferWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4277 fun! s:UseBufWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4278 " call Dfunc("UseBufWinVars()")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
4279 if exists("b:netrw_longlist") && !exists("w:netrw_longlist") |let w:netrw_longlist = b:netrw_longlist |endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4280 if exists("b:netrw_bannercnt") && !exists("w:netrw_bannercnt") |let w:netrw_bannercnt = b:netrw_bannercnt |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4281 if exists("b:netrw_method") && !exists("w:netrw_method") |let w:netrw_method = b:netrw_method |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4282 if exists("b:netrw_prvdir") && !exists("w:netrw_prvdir") |let w:netrw_prvdir = b:netrw_prvdir |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4283 if exists("b:netrw_explore_indx") && !exists("w:netrw_explore_indx") |let w:netrw_explore_indx = b:netrw_explore_indx |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4284 if exists("b:netrw_explore_listlen") && !exists("w:netrw_explore_listlen")|let w:netrw_explore_listlen = b:netrw_explore_listlen|endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4285 if exists("b:netrw_explore_mtchcnt") && !exists("w:netrw_explore_mtchcnt")|let w:netrw_explore_mtchcnt = b:netrw_explore_mtchcnt|endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4286 if exists("b:netrw_explore_bufnr") && !exists("w:netrw_explore_bufnr") |let w:netrw_explore_bufnr = b:netrw_explore_bufnr |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4287 if exists("b:netrw_explore_line") && !exists("w:netrw_explore_line") |let w:netrw_explore_line = b:netrw_explore_line |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4288 if exists("b:netrw_explore_list") && !exists("w:netrw_explore_list") |let w:netrw_explore_list = b:netrw_explore_list |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4289 " call Dret("UseBufWinVars")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4290 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4291
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4292 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4293 " RFC2396: converts %xx into characters {{{2
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4294 fun! netrw#RFC2396(fname)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4295 " call Dfunc("RFC2396(fname<".a:fname.">)")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4296 let fname = escape(substitute(a:fname,'%\(\x\x\)','\=nr2char("0x".submatch(1))','ge')," \t")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4297 " call Dret("RFC2396 ".fname)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4298 return fname
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4299 endfun
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4300
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4301 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4302 " Settings Restoration: {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4303 let &cpo= s:keepcpo
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4304 unlet s:keepcpo
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4305
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4306 " ------------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4307 " Modelines: {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4308 " vim:ts=8 fdm=marker