annotate runtime/autoload/netrw.vim @ 925:3d842a9e2bae v7.0.051

updated for version 7.0-051
author vimboss
date Fri, 11 Aug 2006 20:55:20 +0000
parents b933657f7c9d
children e63691e7c504
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
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
3 " Date: May 02, 2006
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
4 " Version: 98
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
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
26 let g:loaded_netrw = "v98"
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
844
d3bbb5dd3913 updated for version 7.0f02
vimboss
parents: 842
diff changeset
145 " call Decho(g:netrw_ssh_cmd." is not executable, can't do remote directory exploring")
559
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()
849
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
325 " call Decho("tmpfile<".tmpfile.">")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
326 let tmpfile= escape(substitute(tmpfile,'\','/','ge'),g:netrw_tmpfile_escape)
849
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
327 " call Decho("tmpfile<".tmpfile.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
328 if !isdirectory(substitute(tmpfile,'[^/]\+$','','e'))
568
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 559
diff changeset
329 echohl Error | echo "***netrw*** your <".substitute(tmpfile,'[^/]\+$','','e')."> directory is missing!" | echohl None
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
330 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
331 " call Dret("NetRead :1 getcwd<".getcwd().">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
332 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
333 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
334 " call Decho("tmpfile<".tmpfile.">")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
335
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
336 while ichoice <= a:0
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
337
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
338 " attempt to repeat with previous host-file-etc
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
339 if exists("b:netrw_lastfile") && a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
340 " call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
341 let choice = b:netrw_lastfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
342 let ichoice= ichoice + 1
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
343
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
344 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
345 exe "let choice= a:" . ichoice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
346 " call Decho("no lastfile: choice<" . choice . ">")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
347
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
348 if match(choice,"?") == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
349 " give help
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
350 echomsg 'NetRead Usage:'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
351 echomsg ':Nread machine:path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
352 echomsg ':Nread "machine path" uses ftp with <.netrc>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
353 echomsg ':Nread "machine id password path" uses ftp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
354 echomsg ':Nread dav://machine[:port]/path uses cadaver'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
355 echomsg ':Nread fetch://machine/path uses fetch'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
356 echomsg ':Nread ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
357 echomsg ':Nread http://[user@]machine/path uses http wget'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
358 echomsg ':Nread rcp://[user@]machine/path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
359 echomsg ':Nread rsync://machine[:port]/path uses rsync'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
360 echomsg ':Nread scp://[user@]machine[[:#]port]/path uses scp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
361 echomsg ':Nread sftp://[user@]machine[[:#]port]/path uses sftp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
362 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
363
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
364 elseif match(choice,"^\"") != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
365 " Reconstruct Choice if choice starts with '"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
366 " call Decho("reconstructing choice")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
367 if match(choice,"\"$") != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
368 " case "..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
369 let choice=strpart(choice,1,strlen(choice)-2)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
370 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
371 " case "... ... ..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
372 let choice = strpart(choice,1,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
373 let wholechoice = ""
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
374
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
375 while match(choice,"\"$") == -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
376 let wholechoice = wholechoice . " " . choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
377 let ichoice = ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
378 if ichoice > a:0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
379 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
380 echohl Error | echo "***netrw*** Unbalanced string in filename '". wholechoice ."'" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
381 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
382 endif
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
383 " call Dret("NetRead :2 getcwd<".getcwd().">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
384 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
385 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
386 let choice= a:{ichoice}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
387 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
388 let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
389 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
390 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
391 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
392
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
393 " call Decho("choice<" . choice . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
394 let ichoice= ichoice + 1
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
395
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
396 " fix up windows urls
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
397 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
398 let choice = substitute(choice,'\\','/','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
399 " call Decho("fixing up windows url to <".choice."> tmpfile<".tmpfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
400
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
401 if !g:netrw_keepdir
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
402 exe 'lcd ' . fnamemodify(tmpfile,':h')
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
403 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
404 let tmpfile = fnamemodify(tmpfile,':t')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
405 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
406
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
407 " Determine method of read (ftp, rcp, etc) {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
408 call s:NetMethod(choice)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
409
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
410 " Check if NetBrowse() should be handling this request
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 799
diff changeset
411 " 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
412 if choice =~ "^.*[\/]$"
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 799
diff changeset
413 " call Decho("yes, choice matches '^.*[\/]$'")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
414 keepjumps call s:NetBrowse(choice)
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
415 " call Dret("NetRead :3 getcwd<".getcwd().">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
416 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
417 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
418
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
419 " use filename's suffix for the temporary file
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
420 if b:netrw_fname =~ '\.[^./]\+$'
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
421 let suffix = substitute(b:netrw_fname,'^.*\(\.[^./]\+\)$','\1','e')
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
422 let tmpfile= substitute(tmpfile,"$",suffix,'e')
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
423 " 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
424 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
425
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
426 " ============
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
427 " Perform Protocol-Based Read {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
428 " ===========================
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
429 if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
430 echo "(netrw) Processing your read request..."
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
431 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
432
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
433 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
434 " rcp: NetRead Method #1 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
435 if b:netrw_method == 1 " read with rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
436 " call Decho("read via rcp (method #1)")
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
437 " ER: nothing done with g:netrw_uid yet?
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
438 " ER: on Win2K" rcp machine[.user]:file tmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
439 " ER: if machine contains '.' adding .user is required (use $USERNAME)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
440 " ER: the tmpfile is full path: rcp sees C:\... as host C
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
441 if s:netrw_has_nt_rcp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
442 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
443 let uid_machine = g:netrw_machine .'.'. g:netrw_uid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
444 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
445 " Any way needed it machine contains a '.'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
446 let uid_machine = g:netrw_machine .'.'. $USERNAME
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
447 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
448 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
449 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
450 let uid_machine = g:netrw_uid .'@'. g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
451 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
452 let uid_machine = g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
453 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
454 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
455 " 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
456 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
457 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
458 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
459
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
460 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
461 " ftp + <.netrc>: NetRead Method #2 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
462 elseif b:netrw_method == 2 " read with ftp + <.netrc>
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
463 " call Decho("read via ftp+.netrc (method #2)")
820
57c7403f6599 updated for version 7.0c11
vimboss
parents: 819
diff changeset
464 let netrw_fname= b:netrw_fname
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
465 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
466 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
467 exe "put ='".g:netrw_ftpmode."'"
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
468 " call Decho("filter input: ".getline("."))
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
469 exe "put ='".'get \"'.netrw_fname.'\" '.tmpfile."'"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
470 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
471 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
472 " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
473 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
474 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
475 " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
476 exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
477 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
478 " 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
479 if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
480 let debugkeep= &debug
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
481 set debug=msg
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
482 echohl Error | echo "***netrw*** ".getline(1) | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
483 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
484 let &debug= debugkeep
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
485 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
486 bd!
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
487 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
488 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
489
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
490 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
491 " ftp + machine,id,passwd,filename: NetRead Method #3 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
492 elseif b:netrw_method == 3 " read with ftp + machine, id, passwd, and fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
493 " Construct execution string (four lines) which will be passed through filter
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
494 " call Decho("read via ftp+mipf (method #3)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
495 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
496 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
497 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
498 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
499 put ='open '.g:netrw_machine.' '.g:netrw_port
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
500 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
501 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
502 put ='open '.g:netrw_machine
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
503 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
504 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
505
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
506 if exists("g:netrw_ftp") && g:netrw_ftp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
507 put =g:netrw_uid
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
508 " call Decho("filter input: ".getline("."))
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
509 put ='\"'.g:netrw_passwd.'\"'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
510 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
511 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
512 put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
513 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
514 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
515
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
516 if exists("g:netrw_ftpmode") && g:netrw_ftpmode != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
517 put =g:netrw_ftpmode
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
518 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
519 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
520 put ='get \"'.netrw_fname.'\" '.tmpfile
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
521 " call Decho("filter input: ".getline("."))
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
522
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
523 " perform ftp:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
524 " -i : turns off interactive prompting from ftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
525 " -n unix : DON'T use <.netrc>, even though it exists
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
526 " -n win32: quit being obnoxious about password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
527 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
528 " call Decho("executing: %!".g:netrw_ftp_cmd." -i -n")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
529 exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
530 " 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
531 if getline(1) !~ "^$"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
532 " call Decho("error<".getline(1).">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
533 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
534 echohl Error | echo "***netrw*** ".getline(1) | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
535 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
536 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
537 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
538 bd!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
539 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
540 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
541
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
542 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
543 " scp: NetRead Method #4 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
544 elseif b:netrw_method == 4 " read with scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
545 " call Decho("read via scp (method #4)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
546 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
547 let useport= " -P ".g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
548 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
549 let useport= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
550 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
551 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
552 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
553 " 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
554 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
555 else
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
556 " 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
557 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
558 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
559 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
560 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
561
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
562 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
563 " http: NetRead Method #5 (wget) {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
564 elseif b:netrw_method == 5
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
565 " call Decho("read via http (method #5)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
566 if g:netrw_http_cmd == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
567 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
568 echohl Error | echo "***netrw*** neither wget nor fetch command is available" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
569 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
570 endif
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
571 " call Dret("NetRead :4 getcwd<".getcwd().">")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
572 return
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
573 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
574
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
575 if match(b:netrw_fname,"#") == -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
576 " simple wget
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
577 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
578 " 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
579 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
580 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
581
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
582 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
583 " 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
584 let netrw_html= substitute(netrw_fname,"#.*$","","")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
585 let netrw_tag = substitute(netrw_fname,"^.*#","","")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
586 " call Decho("netrw_html<".netrw_html.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
587 " call Decho("netrw_tag <".netrw_tag.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
588 " call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_html)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
589 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
590 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
591 " call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
592 exe 'norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\<CR>"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
593 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
594 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
595
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
596 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
597 " cadaver: NetRead Method #6 {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
598 elseif b:netrw_method == 6
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
599 " call Decho("read via cadaver (method #6)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
600
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
601 " Construct execution string (four lines) which will be passed through filter
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
602 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
603 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
604 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
605 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
606 put ='open '.g:netrw_machine.' '.g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
607 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
608 put ='open '.g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
609 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
610 put ='user '.g:netrw_uid.' '.g:netrw_passwd
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
611
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
612 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
613 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
614 put ='get '.netrw_fname.' '.cygtmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
615 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
616 put ='get '.netrw_fname.' '.tmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
617 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
618 put ='quit'
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
619
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
620 " perform cadaver operation:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
621 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
622 " call Decho("executing: %!".g:netrw_dav_cmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
623 exe g:netrw_silentxfer."%!".g:netrw_dav_cmd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
624 bd!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
625 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
626 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
627
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
628 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
629 " rsync: NetRead Method #7 {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
630 elseif b:netrw_method == 7
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
631 " call Decho("read via rsync (method #7)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
632 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
633 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
634 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
635 " call Decho("executing: !".g:netrw_rsync_cmd." ".g:netrw_machine.":".netrw_fname." ".cygtmpfile)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
636 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
637 else
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
638 " call Decho("executing: !".g:netrw_rsync_cmd." ".g:netrw_machine.":".netrw_fname." ".tmpfile)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
639 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
640 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
641 let result = s:NetGetFile(readcmd,tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
642 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
643
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
644 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
645 " fetch: NetRead Method #8 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
646 " fetch://[user@]host[:http]/path
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
647 elseif b:netrw_method == 8
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
648 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
649 if g:netrw_fetch_cmd == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
650 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
651 echohl Error | echo "***netrw*** fetch command not available" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
652 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
653 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
654 " call Dret("NetRead")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
655 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
656 if exists("g:netrw_option") && g:netrw_option == ":http"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
657 let netrw_option= "http"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
658 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
659 let netrw_option= "ftp"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
660 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
661 " call Decho("read via fetch for ".netrw_option)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
662
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
663 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
664 " 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
665 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
666 else
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
667 " 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
668 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
669 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
670
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
671 let result = s:NetGetFile(readcmd,tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
672 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
673
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
674 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
675 " sftp: NetRead Method #9 {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
676 elseif b:netrw_method == 9
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
677 " call Decho("read via sftp (method #4)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
678 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
679 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
680 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
681 " call Decho("!".g:netrw_sftp_cmd." ".g:netrw_machine.":".netrw_fname." ".cygtmpfile)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
682 " call Decho("executing: !".g:netrw_sftp_cmd." ".g:netrw_machine.":".netrw_fname." ".cygtmpfile)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
683 exe "!".g:netrw_sftp_cmd." ".g:netrw_machine.":".netrw_fname." ".cygtmpfile
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
684 else
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
685 " call Decho("executing: !".g:netrw_sftp_cmd." ".g:netrw_machine.":".netrw_fname." ".tmpfile)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
686 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
687 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
688 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
689 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
690
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
691 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
692 " Complain {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
693 else
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
694 echo "***warning*** unable to comply with your request<" . choice . ">"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
695 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
696 endwhile
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
697
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
698 " cleanup {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
699 " call Decho("cleanup")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
700 if exists("b:netrw_method")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
701 unlet b:netrw_method
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
702 unlet b:netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
703 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
704 call s:NetOptionRestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
705
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
706 " call Dret("NetRead :5 getcwd<".getcwd().">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
707 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
708
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
709 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
710 " NetGetFile: Function to read temporary file "tfile" with command "readcmd". {{{2
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
711 " readcmd == %r : replace buffer with newly read file
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
712 " == 0r : read file at top of buffer
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
713 " == r : read file after current line
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
714 fun! s:NetGetFile(readcmd, tfile, method)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
715 " call Dfunc("NetGetFile(readcmd<".a:readcmd.">,tfile<".a:tfile."> method<".a:method.">)")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
716
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
717 " get name of remote filename (ie. url and all)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
718 let rfile= bufname("%")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
719 " call Decho("rfile<".rfile.">")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
720
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
721 if exists("*NetReadFixup")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
722 " for the use of NetReadFixup (not otherwise used internally)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
723 let line2= line("$")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
724 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
725
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
726 " transform paths from / to \ for Windows (except for cygwin)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
727 if &term == "win32"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
728 if g:netrw_cygwin
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
729 let tfile= a:tfile
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
730 " call Decho("(win32 && cygwin) tfile<".tfile.">")
482
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= substitute(a:tfile,'/','\\\\','ge')
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
733 " call Decho("(win32 && !cygwin) tfile<".tfile.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
734 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
735 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
736 let tfile= a:tfile
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
737 " call Decho("tfile=a:tfile<".tfile.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
738 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
739
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
740 if a:readcmd[0] == '%'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
741 " get file into buffer
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
742
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
743 " call Dredir("ls!","starting buffer list")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
744
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
745 " rename the current buffer to the temp file (ie. tfile)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
746 keepalt exe "file ".tfile
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
747 " call Dredir("ls!","after renaming current buffer to <".tfile.">")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
748
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
749 " edit temporary file (ie. read the temporary file in)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
750 if rfile =~ '\.zip$'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
751 call zip#Browse(tfile)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
752 elseif rfile =~ '\.tar$'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
753 call tar#Browse(tfile)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
754 else
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
755 " call Decho("edit temporary file")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
756 e
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
757 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
758
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
759 " rename buffer back to remote filename
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
760 keepalt exe "file ".escape(rfile,' ')
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
761 filetype detect
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
762 " call Dredir("ls!","renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
763 let line1 = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
764 let line2 = line("$")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
765
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
766 elseif filereadable(tfile)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
767 " read file after current line
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
768 let curline = line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
769 let lastline= line("$")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
770 " call Decho("exe<".a:readcmd." ".v:cmdarg." ".tfile."> line#".curline)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
771 exe a:readcmd." ".v:cmdarg." ".tfile
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
772 let line1= curline + 1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
773 let line2= line("$") - lastline + 1
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
774
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
775 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
776 " not readable
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
777 echohl WarningMsg | echo "***netrw*** file <".tfile."> not readable"| echohl None
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
778 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
779 " call Dret("NetGetFile : tfile<".tfile."> not readable")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
780 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
781 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
782
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
783 " User-provided (ie. optional) fix-it-up command
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
784 if exists("*NetReadFixup")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
785 " call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
786 call NetReadFixup(a:method, line1, line2)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
787 " else " Decho
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 799
diff changeset
788 " call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
789 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
790
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
791 " update the Buffers menu
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
792 if has("gui") && has("gui_running")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
793 silent! emenu Buffers.Refresh\ menu
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
794 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
795
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
796 " 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
797
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
798 " make sure file is being displayed
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
799 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
800 " call Dret("NetGetFile")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
801 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
802
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
803 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
804 " NetWrite: responsible for writing a file over the net {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
805 fun! netrw#NetWrite(...) range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
806 " call Dfunc("NetWrite(a:0=".a:0.")")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
807
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
808 " option handling
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
809 let mod= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
810 call s:NetOptionSave()
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
811
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
812 " Get Temporary Filename {{{3
849
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
813 let tmpfile= tempname()
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
814 " call Decho("tmpfile<".tmpfile."> (raw)")
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
815 let tmpfile= escape(substitute(tmpfile,'\','/','ge'),g:netrw_tmpfile_escape)
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
816 " call Decho("tmpfile<".tmpfile."> (escaped)")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
817 if !isdirectory(substitute(tmpfile,'[^/]\+$','','e'))
849
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
818 echohl Error | echo "***netrw*** your <".substitute(tmpfile,'[^/]\+$','','e')."> directory is missing!"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
819 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
820 " call Dret("NetWrite")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
821 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
822 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
823
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
824 if a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
825 let ichoice = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
826 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
827 let ichoice = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
828 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
829
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
830 if &binary
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
831 " for binary writes, write entire file. Line numbers don't really make sense.
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
832 " Supports the writing of tar and zip files.
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
833 " call Decho("silent exe w! ".v:cmdarg." ".tmpfile)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
834 silent exe "w! ".v:cmdarg." ".tmpfile
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
835 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
836 " write (selected portion of) file to temporary
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
837 " call Decho("silent exe ".a:firstline."," . a:lastline . "w! ".v:cmdarg." ".tmpfile)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
838 silent exe a:firstline."," . a:lastline . "w! ".v:cmdarg." ".tmpfile
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
839 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
840
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
841 while ichoice <= a:0
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
842
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
843 " Process arguments: {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
844 " attempt to repeat with previous host-file-etc
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
845 if exists("b:netrw_lastfile") && a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
846 " call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
847 let choice = b:netrw_lastfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
848 let ichoice= ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
849 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
850 exe "let choice= a:" . ichoice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
851
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
852 " Reconstruct Choice if choice starts with '"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
853 if match(choice,"?") == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
854 echomsg 'NetWrite Usage:"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
855 echomsg ':Nwrite machine:path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
856 echomsg ':Nwrite "machine path" uses ftp with <.netrc>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
857 echomsg ':Nwrite "machine id password path" uses ftp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
858 echomsg ':Nwrite dav://[user@]machine/path uses cadaver'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
859 echomsg ':Nwrite fetch://[user@]machine/path uses fetch'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
860 echomsg ':Nwrite ftp://machine[#port]/path uses ftp (autodetects <.netrc>)'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
861 echomsg ':Nwrite rcp://machine/path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
862 echomsg ':Nwrite rsync://[user@]machine/path uses rsync'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
863 echomsg ':Nwrite scp://[user@]machine[[:#]port]/path uses scp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
864 echomsg ':Nwrite sftp://[user@]machine/path uses sftp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
865 break
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
866
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
867 elseif match(choice,"^\"") != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
868 if match(choice,"\"$") != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
869 " case "..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
870 let choice=strpart(choice,1,strlen(choice)-2)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
871 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
872 " case "... ... ..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
873 let choice = strpart(choice,1,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
874 let wholechoice = ""
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
875
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
876 while match(choice,"\"$") == -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
877 let wholechoice= wholechoice . " " . choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
878 let ichoice = ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
879 if choice > a:0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
880 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
881 echohl Error | echo "***netrw*** Unbalanced string in filename '". wholechoice ."'" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
882 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
883 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
884 " call Dret("NetWrite")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
885 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
886 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
887 let choice= a:{ichoice}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
888 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
889 let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
890 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
891 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
892 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
893 " call Decho("choice<" . choice . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
894 let ichoice= ichoice + 1
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
895
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
896 " fix up windows urls
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
897 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
898 let choice= substitute(choice,'\\','/','ge')
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
899 if !g:netrw_keepdir
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
900 exe 'lcd ' . fnamemodify(tmpfile,':h')
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
901 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
902 let tmpfile = fnamemodify(tmpfile,':t')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
903 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
904
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
905 " Determine method of read (ftp, rcp, etc) {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
906 call s:NetMethod(choice)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
907
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
908 " =============
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
909 " Perform Protocol-Based Write {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
910 " ============================
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
911 if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
912 echo "(netrw) Processing your write request..."
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
913 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
914
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
915 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
916 " rcp: NetWrite Method #1 {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
917 if b:netrw_method == 1
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
918 " call Decho("write via rcp (method #1)")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
919 if s:netrw_has_nt_rcp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
920 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
921 let uid_machine = g:netrw_machine .'.'. g:netrw_uid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
922 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
923 let uid_machine = g:netrw_machine .'.'. $USERNAME
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
924 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
925 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
926 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
927 let uid_machine = g:netrw_uid .'@'. g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
928 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
929 let uid_machine = g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
930 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
931 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
932 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
933 " 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
934 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
935 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
936
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
937 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
938 " ftp + <.netrc>: NetWrite Method #2 {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
939 elseif b:netrw_method == 2
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
940 let netrw_fname= b:netrw_fname
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
941 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
942 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
943 exe "put ='".g:netrw_ftpmode."'"
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
944 " call Decho(" filter input: ".getline("."))
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
945 exe "put ='"."put ".tmpfile.' \"'.netrw_fname.'\"'."'"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
946 " call Decho(" filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
947 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
948 " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
949 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
950 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
951 " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
952 exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
953 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
954 " 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
955 if getline(1) !~ "^$"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
956 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
957 echohl Error | echo "***netrw*** ".getline(1) | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
958 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
959 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
960 let mod=1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
961 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
962 bd!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
963 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
964
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
965 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
966 " ftp + machine, id, passwd, filename: NetWrite Method #3 {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
967 elseif b:netrw_method == 3
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
968 let netrw_fname= b:netrw_fname
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
969 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
970 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
971 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
972 put ='open '.g:netrw_machine.' '.g:netrw_port
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
973 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
974 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
975 put ='open '.g:netrw_machine
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
976 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
977 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
978 if exists("g:netrw_ftp") && g:netrw_ftp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
979 put =g:netrw_uid
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
980 " call Decho("filter input: ".getline("."))
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
981 put ='\"'.g:netrw_passwd.'\"'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
982 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
983 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
984 put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
985 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
986 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
987 put ='put '.tmpfile.' \"'.netrw_fname.'\"'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
988 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
989 " save choice/id/password for future use
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
990 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
991
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
992 " perform ftp:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
993 " -i : turns off interactive prompting from ftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
994 " -n unix : DON'T use <.netrc>, even though it exists
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
995 " -n win32: quit being obnoxious about password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
996 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
997 " call Decho("executing: %!".g:netrw_ftp_cmd." -i -n")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
998 exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
999 " 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
1000 if getline(1) !~ "^$"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1001 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1002 echohl Error | echo "***netrw*** ".getline(1) | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1003 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1004 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1005 let mod=1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1006 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1007 bd!
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1008
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1009 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1010 " scp: NetWrite Method #4 {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1011 elseif b:netrw_method == 4
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1012 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1013 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1014 let useport= " -P ".g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1015 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1016 let useport= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1017 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1018 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1019 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1020 " 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
1021 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
1022 else
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1023 " 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
1024 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
1025 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1026 let b:netrw_lastfile = choice
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 " http: NetWrite Method #5 {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1030 elseif b:netrw_method == 5
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1031 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1032 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
1033 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1034 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1035
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1036 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1037 " dav: NetWrite Method #6 (cadaver) {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1038 elseif b:netrw_method == 6
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1039 " call Decho("write via cadaver (method #6)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1040
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1041 " Construct execution string (four lines) which will be passed through filter
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1042 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1043 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1044 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1045 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1046 put ='open '.g:netrw_machine.' '.g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1047 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1048 put ='open '.g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1049 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1050 put ='user '.g:netrw_uid.' '.g:netrw_passwd
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1051
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1052 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1053 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1054 put ='put '.cygtmpfile.' '.netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1055 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1056 put ='put '.tmpfile.' '.netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1057 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1058
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1059 " perform cadaver operation:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1060 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1061 " call Decho("executing: %!".g:netrw_dav_cmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1062 exe g:netrw_silentxfer."%!".g:netrw_dav_cmd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1063 bd!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1064 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1065
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1066 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1067 " rsync: NetWrite Method #7 {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1068 elseif b:netrw_method == 7
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1069 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1070 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1071 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1072 " call Decho("executing: !".g:netrw_rsync_cmd." ".cygtmpfile." ".g:netrw_machine.":".netrw_fname)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1073 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
1074 else
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1075 " call Decho("executing: !".g:netrw_rsync_cmd." ".tmpfile." ".g:netrw_machine.":".netrw_fname)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1076 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
1077 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1078 let b:netrw_lastfile = choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1079
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1080 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1081 " sftp: NetWrite Method #9 {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1082 elseif b:netrw_method == 9
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1083 let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1084 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1085 let uid_machine = g:netrw_uid .'@'. g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1086 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1087 let uid_machine = g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1088 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1089 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1090 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1091 put ='put '.tmpfile.' '.netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1092 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1093 " call Decho("executing: %!".g:netrw_sftp_cmd.' '.uid_machine)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1094 exe g:netrw_silentxfer."%!".g:netrw_sftp_cmd.' '.uid_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1095 bd!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1096 let b:netrw_lastfile= choice
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1097
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1098 ".........................................
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1099 " Complain {{{3
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1100 else
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1101 echo "***warning*** unable to comply with your request<" . choice . ">"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1102 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1103 endwhile
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1104
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1105 " cleanup {{{3
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1106 " call Decho("cleanup")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1107 let result=delete(tmpfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1108 call s:NetOptionRestore()
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1109
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1110 if a:firstline == 1 && a:lastline == line("$")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1111 let &mod= mod " usually equivalent to set nomod
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1112 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1113
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1114 " call Dret("NetWrite")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1115 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1116
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1117 " ===========================================
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1118 " Remote Directory Browsing Support: {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1119 " ===========================================
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1120
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1121 " ---------------------------------------------------------------------
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1122 " 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
1123 " of the contents of a remote directory. It is assumed that the
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1124 " g:netrw_list_cmd has a string, HOSTNAME, that needs to be substituted
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1125 " with the requested remote hostname first.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1126 fun! s:NetBrowse(dirname)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1127 if !exists("w:netrw_longlist")|let w:netrw_longlist= g:netrw_longlist|endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1128 " call Dfunc("NetBrowse(dirname<".a:dirname.">) longlist=".w:netrw_longlist)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1129
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1130 if exists("s:netrw_skipbrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1131 unlet s:netrw_skipbrowse
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1132 " call Dret("NetBrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1133 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1134 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1135
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1136 call s:NetOptionSave()
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1137
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1138 " sanity check
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1139 if exists("b:netrw_method") && b:netrw_method =~ '[235]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1140 " call Decho("b:netrw_method=".b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1141 if !executable("ftp")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1142 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1143 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
1144 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1145 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1146 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1147 " call Dret("NetBrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1148 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1149 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1150 elseif !exists("g:netrw_list_cmd") || g:netrw_list_cmd == ''
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1151 if !exists("g:netrw_quiet")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1152 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
1153 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1154 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1155
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1156 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1157 " call Dret("NetBrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1158 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1159 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1160
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1161 " use buffer-oriented WinVars if buffer ones exist but window ones don't
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1162 call s:UseBufWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1163
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1164 " set up menus
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1165 let b:netrw_browser_active= 1
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
1166 call s:NetMenu(1)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1167
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1168 " make this buffer modifiable
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1169 setlocal ma nonu nowrap
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1170
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1171 " analyze a:dirname and g:netrw_list_cmd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1172 let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1173 let dirname = substitute(a:dirname,'\\','/','ge')
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1174 " call Decho("dirname<".dirname.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1175 if dirname !~ dirpat
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1176 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1177 echohl Error | echo "***netrw*** netrw doesn't understand your dirname<".dirname.">" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1178 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1179 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1180 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1181 " call Dret("NetBrowse : badly formatted dirname<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1182 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1183 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1184
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1185 let method = substitute(dirname,dirpat,'\1','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1186 let user = substitute(dirname,dirpat,'\2','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1187 let machine = substitute(dirname,dirpat,'\3','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1188 let path = substitute(dirname,dirpat,'\4','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1189 let fname = substitute(dirname,'^.*/\ze.','','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1190 " call Decho("set up method <".method .">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1191 " call Decho("set up user <".user .">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1192 " call Decho("set up machine<".machine.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1193 " call Decho("set up path <".path .">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1194 " call Decho("set up fname <".fname .">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1195
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1196 if method == "ftp" || method == "http"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1197 let method = "ftp"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1198 let listcmd = g:netrw_ftp_list_cmd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1199 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1200 let listcmd = substitute(g:netrw_list_cmd,'\<HOSTNAME\>',user.machine,'')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1201 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1202
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1203 if exists("b:netrw_method")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1204 " call Decho("setting w:netrw_method<".b:netrw_method.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1205 let w:netrw_method= b:netrw_method
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1206 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1207
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1208 " optionally sort by time (-t) or by size (-S)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1209 if listcmd == "dir" && g:netrw_sort_by =~ "^[ts]"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1210 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
1211 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1212 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1213 if g:netrw_sort_by =~ "^t"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1214 let listcmd= listcmd."t"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1215 elseif g:netrw_sort_by =~ "^s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1216 let listcmd= listcmd."S"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1217 endif
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
1218
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1219 " optionally sort in reverse
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1220 if g:netrw_sort_direction =~ "^r" && listcmd == "dir"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1221 let listcmd= listcmd."r"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1222 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1223 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1224
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1225 " call Decho("set up listcmd<".listcmd.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1226 if fname =~ '@$' && fname !~ '^"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1227 " call Decho("attempt transfer of symlink as file")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1228 call s:NetBrowse(substitute(dirname,'@$','','e'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1229 redraw!
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1230 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1231 " call Dret("NetBrowse : symlink")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1232 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1233
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1234 elseif fname !~ '[\/]$' && fname !~ '^"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1235 " looks like a regular file, attempt transfer
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1236 " call Decho("attempt transfer as regular file<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1237
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1238 " remove any filetype indicator from end of dirname, except for the
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1239 " "this is a directory" indicator (/). There shouldn't be one of those,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1240 " anyway.
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1241 let path= substitute(path,'[*=@|]\r\=$','','e')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1242 " call Decho("new path<".path.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1243
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1244 " remote-read the requested file into current buffer
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
1245 mark '
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1246 keepjumps keepalt enew!
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1247 set ma
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1248 " call Decho("exe file ".method."://".user.machine."/".escape(path,s:netrw_cd_escape))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1249 exe "file ".method."://".user.machine."/".escape(path,s:netrw_cd_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1250 exe "silent doau BufReadPre ".fname
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1251 silent call netrw#NetRead(2,method."://".user.machine."/".path)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1252 exe "silent doau BufReadPost ".fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1253
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1254 " save certain window-oriented variables into buffer-oriented variables
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1255 call s:SetBufWinVars()
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1256 call s:NetOptionRestore()
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1257 setlocal nomod nowrap
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1258
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1259 " call Dret("NetBrowse : file<".fname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1260 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1261 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1262
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1263 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1264 " Perform Directory Listing:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1265 " call Decho("Perform directory listing...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1266 " set up new buffer and map
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1267 let bufname = method.'://'.user.machine.'/'.path
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1268 let bufnamenr = bufnr(bufname.'$')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1269 " call Decho("bufname<".bufname."> bufnamenr=".bufnamenr)
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
1270 mark '
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1271 if bufnamenr != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1272 " buffer already exists, switch to it!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1273 " call Decho("buffer already exists, switching to it")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1274 exe "b ".bufnamenr
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1275 if line("$") >= 5
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1276 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1277 " call Dret("NetBrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1278 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1279 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1280 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1281 " call Decho("generate a new buffer")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1282 keepjumps keepalt enew!
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1283 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1284
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1285 " rename file to reflect where its from
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1286 setlocal bt=nofile bh=wipe nobl noswf
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1287 exe "setlocal ts=".g:netrw_maxfilenamelen
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1288 " call Decho("exe file ".escape(bufname,s:netrw_cd_escape))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1289 exe 'file '.escape(bufname,s:netrw_cd_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1290 " call Decho("renaming file to bufname<".bufname.">")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1291 setlocal bt=nofile nobl nonu noswf
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1292 if g:netrw_fastbrowse >= 1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1293 setlocal bh=hide
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
1294 else
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
1295 setlocal bh=delete
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1296 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1297
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1298 " save current directory on directory history list
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1299 call s:NetBookmarkDir(3,expand("%"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1300
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1301 " set up buffer-local mappings
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1302 " call Decho("set up buffer-local mappings")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1303 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
1304 nnoremap <buffer> <silent> <c-l> :call <SID>NetRefresh(<SID>NetBrowseChgDir(expand("%"),'./'),0)<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1305 nnoremap <buffer> <silent> - :exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),'../'))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1306 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
1307 if w:netrw_longlist != 2
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1308 nnoremap <buffer> <silent> b :<c-u>call <SID>NetBookmarkDir(0,expand("%"))<cr>
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1309 nnoremap <buffer> <silent> B :<c-u>call <SID>NetBookmarkDir(1,expand("%"))<cr>
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1310 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1311 nnoremap <buffer> <silent> Nb :<c-u>call <SID>NetBookmarkDir(0,expand("%"))<cr>
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1312 nnoremap <buffer> <silent> NB :<c-u>call <SID>NetBookmarkDir(0,expand("%"))<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1313 nnoremap <buffer> <silent> <c-h> :call <SID>NetHideEdit(0)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1314 nnoremap <buffer> <silent> i :call <SID>NetLongList(0)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1315 nnoremap <buffer> <silent> o :call <SID>NetSplit(0)<cr>
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1316 nnoremap <buffer> <silent> O :call netrw#NetObtain()<cr>
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1317 nnoremap <buffer> <silent> P :call <SID>NetPrevWinOpen(0)<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1318 nnoremap <buffer> <silent> q :<c-u>call <SID>NetBookmarkDir(2,expand("%"))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1319 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
1320 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
1321 nnoremap <buffer> <silent> S :call <SID>NetSortSequence(0)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1322 nnoremap <buffer> <silent> u :<c-u>call <SID>NetBookmarkDir(4,expand("%"))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1323 nnoremap <buffer> <silent> U :<c-u>call <SID>NetBookmarkDir(5,expand("%"))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1324 nnoremap <buffer> <silent> v :call <SID>NetSplit(1)<cr>
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1325 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
1326 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
1327 exe 'nnoremap <buffer> <silent> <del> :call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1328 exe 'vnoremap <buffer> <silent> <del> :call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1329 exe 'nnoremap <buffer> <silent> d :call <SID>NetMakeDir("'.user.machine.'")<cr>'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1330 exe 'nnoremap <buffer> <silent> D :call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1331 exe 'vnoremap <buffer> <silent> D :call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1332 exe 'nnoremap <buffer> <silent> R :call <SID>NetBrowseRename("'.user.machine.'","'.path.'")<cr>'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1333 exe 'vnoremap <buffer> <silent> R :call <SID>NetBrowseRename("'.user.machine.'","'.path.'")<cr>'
794
f19994020dad updated for version 7.0231
vimboss
parents: 766
diff changeset
1334 nnoremap <buffer> <F1> :he netrw-browse-cmds<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1335 setlocal ma nonu nowrap
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1336
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1337 " Set up the banner
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
1338 " 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
1339 keepjumps put ='\" ==========================================================================='
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1340 keepjumps put ='\" Netrw Remote Directory Listing (netrw '.g:loaded_netrw.')'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1341 keepjumps put ='\" '.bufname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1342 let w:netrw_bannercnt = 7
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1343 let sortby = g:netrw_sort_by
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1344 if g:netrw_sort_direction =~ "^r"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1345 let sortby = sortby." reversed"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1346 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1347
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1348 if g:netrw_sort_by =~ "^n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1349 " sorted by name
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1350 let w:netrw_bannercnt= w:netrw_bannercnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1351 keepjumps put ='\" Sorted by '.sortby
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1352 keepjumps put ='\" Sort sequence: '.g:netrw_sort_sequence
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1353 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1354 " sorted by size or date
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1355 keepjumps put ='\" Sorted by '.sortby
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1356 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1357 if g:netrw_list_hide != "" && g:netrw_hide
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1358 " call Decho("g:netrw_hide=".g:netrw_hide)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1359 if g:netrw_hide == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1360 keepjumps put ='\" Hiding: '.g:netrw_list_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1361 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1362 keepjumps put ='\" Showing: '.g:netrw_list_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1363 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1364 let w:netrw_bannercnt= w:netrw_bannercnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1365 endif
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 799
diff changeset
1366 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
1367 keepjumps put ='\" ==========================================================================='
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1368
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1369 " remote read the requested directory listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1370 " Use ftp if that was the file-transfer method selected, otherwise use ssh
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1371 " Note that not all ftp servers honor the options for ls
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1372 if method == "ftp"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1373 " use ftp to get remote file listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1374 " call Decho("use ftp to get remote file listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1375 call s:NetBrowseFtpCmd(path,listcmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1376 keepjumps 1d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1377
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1378 if w:netrw_longlist == 0 || w:netrw_longlist == 2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1379 " shorten the listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1380 " call Decho("generate short listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1381 exe "keepjumps ".w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1382
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1383 " cleanup
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1384 if g:netrw_ftp_browse_reject != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1385 exe "silent! g/".g:netrw_ftp_browse_reject."/keepjumps d"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1386 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1387 silent! keepjumps %s/\r$//e
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1388
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1389 " if there's no ../ listed, then put ./ and ../ in
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1390 let line1= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1391 keepjumps 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1392 silent keepjumps call search('^\.\.\/\%(\s\|$\)','W')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1393 let line2= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1394 if line2 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1395 keepjumps put='../'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1396 keepjumps put='./'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1397 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1398 exe "keepjumps ".line1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1399 keepjumps norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1400
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1401 " more cleanup
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1402 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
1403 exe "silent! keepjumps ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1404 exe "silent! keepjumps ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1405 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1406
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1407 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1408 " use ssh to get remote file listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1409 " call Decho("use ssh to get remote file listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1410 let shq= &shq? &shq : ( &sxq? &sxq : "'")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1411 " call Decho("exe silent r! ".listcmd." '".shq.escape(path,s:netrw_cd_escape).shq."'")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1412 exe "silent r! ".listcmd." ".shq.escape(path,s:netrw_cd_escape).shq
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1413 keepjumps 1d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1414 " cleanup
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1415 if g:netrw_ftp_browse_reject != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1416 exe "silent! g/".g:netrw_ssh_browse_reject."/keepjumps d"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1417 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1418 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1419
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1420 " set up syntax highlighting
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1421 if has("syntax")
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
1422 setlocal ft=netrw
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1423 if !exists("g:syntax_on") || !g:syntax_on
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1424 setlocal ft=
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1425 " Ugly workaround -- when syntax highlighting is off and laststatus==2,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1426 " sometimes the laststatus highlight bleeds into the entire display.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1427 " Only seems to happen with remote browsing. Weird.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1428 redraw
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1429 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1430 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1431
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1432 " manipulate the directory listing (hide, sort)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1433 if line("$") >= w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1434 if g:netrw_hide && g:netrw_list_hide != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1435 call s:NetrwListHide()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1436 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1437
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1438 if w:netrw_longlist == 1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1439 " do a long listing; these substitutions need to be done prior to sorting
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1440 " call Decho("manipulate long listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1441
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1442 if method == "ftp"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1443 " cleanup
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1444 exe "keepjumps ".w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1445 while getline(".") =~ g:netrw_ftp_browse_reject
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1446 keepjumps d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1447 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1448 " if there's no ../ listed, then put ./ and ../ in
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1449 let line1= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1450 keepjumps 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1451 silent keepjumps call search('^\.\.\/\%(\s\|$\)','W')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1452 let line2= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1453 if line2 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1454 exe 'keepjumps '.w:netrw_bannercnt."put='./'"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1455 exe 'keepjumps '.w:netrw_bannercnt."put='../'"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1456 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1457 exe "keepjumps ".line1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1458 keepjumps norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1459 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1460
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1461 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/ -> .*$//e'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1462 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
1463 exe 'silent keepjumps '.w:netrw_bannercnt
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1464 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1465
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1466 if line("$") >= w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1467 if g:netrw_sort_by =~ "^n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1468 call s:SetSort()
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1469 if g:netrw_sort_direction =~ 'n'
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1470 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1471 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1472 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1473 endif
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
1474 " remove priority pattern prefix
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1475 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{3}\///e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1476 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1477 if w:netrw_longlist == 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1478 " shorten the list to keep its width <= winwidth characters
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1479 exe "silent keepjumps ".w:netrw_bannercnt.',$s/\t[-dstrwx]\+/\t/e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1480 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1481 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1482 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1483
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1484 call s:NetrwWideListing()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1485 if line("$") >= w:netrw_bannercnt
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1486 " place cursor on the top-left corner of the file listing
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1487 exe "keepjumps ".w:netrw_bannercnt
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1488 norm! 0
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1489 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1490
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1491 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1492 setlocal nomod noma nonu
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1493
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1494 " call Dret("NetBrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1495 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1496 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1497
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1498 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1499 " NetBrowseChgDir: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1500 fun! s:NetBrowseChgDir(dirname,newdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1501 " call Dfunc("NetBrowseChgDir(dirname<".a:dirname."> newdir<".a:newdir.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1502
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1503 let dirname= a:dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1504 let newdir = a:newdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1505
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1506 if newdir !~ '[\/]$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1507 " handling a file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1508 let dirname= dirname.newdir
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
1509 let didfile= 0
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1510 if g:netrw_browse_split == 1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1511 new
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1512 wincmd _
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1513 elseif g:netrw_browse_split == 2
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1514 rightb vert new
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1515 wincmd |
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
1516 else
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
1517 " handling a file, didn't split, so possibly remove menu
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
1518 call s:NetMenu(0)
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1519 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1520 " call Decho("handling a file: dirname<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1521
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1522 elseif newdir == './'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1523 " refresh the directory list
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1524 " call Decho("refresh directory listing")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1525 setlocal ma nobl
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1526 if g:netrw_fastbrowse >= 1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1527 setlocal bh=hide
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
1528 else
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
1529 setlocal bh=delete
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1530 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1531 %d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1532
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1533 elseif newdir == '../'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1534 " go up one directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1535 let trailer= substitute(a:dirname,'^\(\w\+://\%(\w\+@\)\=\w\+/\)\(.*\)$','\2','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1536
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1537 if trailer =~ '^\%(\.\./\)*$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1538 " tack on a ../"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1539 let dirname= dirname.'../'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1540
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1541 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1542 " strip off a directory name from dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1543 let dirname= substitute(dirname,'^\(.*/\)[^/]\+/','\1','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1544 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1545 " call Decho("go up one dir: dirname<".dirname."> trailer<".trailer.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1546
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1547 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1548 " go down one directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1549 let dirname= dirname.newdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1550 " call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1551 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1552
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1553 " call Dret("NetBrowseChgDir <".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1554 return dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1555 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1556
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1557 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1558 " NetGetWord: it gets the directory named under the cursor {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1559 fun! s:NetGetWord()
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
1560 " call Dfunc("NetGetWord() line#".line(".")." longlist=".g:netrw_longlist." virtcol=".virtcol("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1561 call s:UseBufWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1562
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1563 " insure that w:netrw_longlist is set up
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1564 if !exists("w:netrw_longlist")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1565 if exists("g:netrw_longlist")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1566 let w:netrw_longlist= g:netrw_longlist
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1567 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1568 let w:netrw_longlist= 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1569 endif
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
1570 " call Decho("w:netrw_longlist=".w:netrw_longlist)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1571 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1572
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1573 if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1574 " Active Banner support
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1575 " call Decho("active banner handling")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1576 norm! 0
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1577 let dirname= "./"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1578 let curline= getline(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1579 if curline =~ '"\s*Sorted by\s'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1580 norm s
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1581 let s:netrw_skipbrowse= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1582 echo 'Pressing "s" also works'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1583 elseif curline =~ '"\s*Sort sequence:'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1584 let s:netrw_skipbrowse= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1585 echo 'Press "S" to edit sorting sequence'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1586 elseif curline =~ '"\s*Quick Help:'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1587 norm ?
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1588 let s:netrw_skipbrowse= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1589 echo 'Pressing "?" also works'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1590 elseif curline =~ '"\s*\%(Hiding\|Showing\):'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1591 norm a
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1592 let s:netrw_skipbrowse= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1593 echo 'Pressing "a" also works'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1594 elseif line("$") > w:netrw_bannercnt
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1595 exe 'silent keepjumps '.w:netrw_bannercnt
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1596 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1597
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1598 elseif w:netrw_longlist == 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1599 " call Decho("thin column handling")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1600 norm! 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1601 let dirname= getline(".")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1602
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1603 elseif w:netrw_longlist == 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1604 " call Decho("long column handling")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1605 norm! 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1606 let dirname= substitute(getline("."),'^\(\%(\S\+\s\)*\S\+\).\{-}$','\1','e')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1607
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1608 else
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1609 " call Decho("obtain word from wide listing")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1610 let dirname= getline(".")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1611
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1612 if !exists("b:netrw_cpf")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1613 let b:netrw_cpf= 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1614 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
1615 " call Decho("computed cpf")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1616 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1617
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1618 let filestart = (virtcol(".")/b:netrw_cpf)*b:netrw_cpf
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
1619 " 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
1620 " call Decho("1: dirname<".dirname.">")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1621 if filestart > 0|let dirname= substitute(dirname,'^.\{'.filestart.'}','','')|endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1622 " call Decho("2: dirname<".dirname.">")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1623 let dirname = substitute(dirname,'^\(.\{'.b:netrw_cpf.'}\).*$','\1','e')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1624 " call Decho("3: dirname<".dirname.">")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1625 let dirname = substitute(dirname,'\s\+$','','e')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1626 " call Decho("4: dirname<".dirname.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1627 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1628
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1629 " call Dret("NetGetWord <".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1630 return dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1631 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1632
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1633 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1634 " NetBrowseRm: remove/delete a remote file or directory {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1635 fun! s:NetBrowseRm(usrhost,path) range
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
1636 " call Dfunc("NetBrowseRm(usrhost<".a:usrhost."> path<".a:path.">) virtcol=".virtcol("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1637 " call Decho("firstline=".a:firstline." lastline=".a:lastline)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1638
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1639 " preparation for removing multiple files/directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1640 let ctr= a:firstline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1641 let all= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1642
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1643 " remove multiple files and directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1644 while ctr <= a:lastline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1645 exe ctr
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1646
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1647 let rmfile= s:NetGetWord()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1648 " call Decho("rmfile<".rmfile.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1649
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1650 if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1651 " attempt to remove file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1652 if !all
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1653 echohl Statement
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1654 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1655 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
1656 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1657 echohl NONE
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1658 if ok == ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1659 let ok="no"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1660 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1661 let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1662 if ok =~ 'a\%[ll]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1663 let all= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1664 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1665 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1666
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1667 if all || ok =~ 'y\%[es]' || ok == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1668 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1669 silent! keepjumps .,$d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1670 call s:NetBrowseFtpCmd(a:path,"delete ".rmfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1671 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1672 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
1673 " call Decho("attempt to remove file: system(".netrw_rm_cmd.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1674 let ret= system(netrw_rm_cmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1675 " call Decho("returned=".ret." errcode=".v:shell_error)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1676 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1677 elseif ok =~ 'q\%[uit]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1678 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1679 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1680
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1681 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1682 " attempt to remove directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1683 if !all
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1684 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1685 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
1686 call inputrestore()
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1687 if ok == ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1688 let ok="no"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1689 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1690 let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1691 if ok =~ 'a\%[ll]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1692 let all= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1693 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1694 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1695
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1696 if all || ok =~ 'y\%[es]' || ok == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1697 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1698 call s:NetBrowseFtpCmd(a:path,"rmdir ".rmfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1699 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1700 let rmfile = a:path.rmfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1701 let netrw_rmdir_cmd= substitute(g:netrw_rmdir_cmd,'HOSTNAME',a:usrhost,'').' '."'".'"'.rmfile.'"'."'"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1702 " call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1703 let ret= system(netrw_rmdir_cmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1704 " call Decho("returned=".ret." errcode=".v:shell_error)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1705
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1706 if v:shell_error != 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1707 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
1708 " call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1709 let ret= system(netrw_rmf_cmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1710 " call Decho("returned=".ret." errcode=".v:shell_error)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1711
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1712 if v:shell_error != 0 && !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1713 echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1714 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1715 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1716 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1717 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1718
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1719 elseif ok =~ 'q\%[uit]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1720 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1721 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1722 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1723
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1724 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1725 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1726
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1727 " refresh the directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1728 let curline= line(".")-1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1729 " call Decho("refresh the directory")
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1730 call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1731 exe curline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1732
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1733 " call Dret("NetBrowseRm")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1734 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1735
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1736 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1737 " NetBrowseRename: rename a remote file or directory {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1738 fun! s:NetBrowseRename(usrhost,path) range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1739 " call Dfunc("NetBrowseRename(usrhost<".a:usrhost."> path<".a:path.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1740
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1741 " preparation for removing multiple files/directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1742 let ctr = a:firstline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1743 let rename_cmd = substitute(g:netrw_rename_cmd,'\<HOSTNAME\>',a:usrhost,'')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1744
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1745 " attempt to rename files/directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1746 while ctr <= a:lastline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1747 exe "keepjumps ".ctr
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1748
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1749 norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1750 let oldname= s:NetGetWord()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1751 " call Decho("oldname<".oldname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1752
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1753 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1754 let newname= input("Moving ".oldname." to : ",oldname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1755 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1756
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1757 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1758 call s:NetBrowseFtpCmd(a:path,"rename ".oldname." ".newname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1759 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1760 let oldname= a:path.oldname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1761 let newname= a:path.newname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1762 " call Decho("system(rename_cmd".' "'.escape(oldname," ").'" "'.escape(newname,s:netrw_cd_escape).'"')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1763 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
1764 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1765
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1766 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1767 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1768
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1769 " refresh the directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1770 let curline= line(".")
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1771 call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./'))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1772 exe "keepjumps ".curline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1773 " call Dret("NetBrowseRename")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1774 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1775
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1776 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1777 " NetRefresh: {{{2
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1778 fun! s:NetRefresh(dirname,islocal)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1779 " call Dfunc("NetRefresh(dirname<".a:dirname.">,islocal=".a:islocal.")")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1780 call netrw#NetSavePosn()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1781 set ma
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1782 %d
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1783 if a:islocal
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1784 call s:LocalBrowse(a:dirname)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1785 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1786 call s:NetBrowse(a:dirname)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1787 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1788 call netrw#NetRestorePosn()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1789 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1790 " call Dret("NetRefresh")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1791 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1792
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1793 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1794 " NetSplit: mode {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1795 " =0 : net and o
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1796 " =1 : net and v
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1797 " =2 : local and o
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1798 " =3 : local and v
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1799 fun! s:NetSplit(mode)
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1800 " 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
1801
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1802 call s:SaveWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1803 if a:mode == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1804 exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1805 call s:CopyWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1806 exe "norm! 0"
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1807 call s:NetBrowse(s:NetBrowseChgDir(expand("%"),s:NetGetWord()))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1808 elseif a:mode ==1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1809 exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1810 call s:CopyWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1811 exe "norm! 0"
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1812 call s:NetBrowse(s:NetBrowseChgDir(expand("%"),s:NetGetWord()))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1813 elseif a:mode ==2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1814 exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1815 call s:CopyWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1816 exe "norm! 0"
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1817 call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,s:NetGetWord()))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1818 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1819 exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1820 call s:CopyWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1821 exe "norm! 0"
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1822 call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,s:NetGetWord()))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1823 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1824
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1825 " call Dret("NetSplit")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1826 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1827
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1828 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1829 " NetBrowseX: allows users to write custom functions to operate on {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1830 " files given their extension. Passes 0=local, 1=remote
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1831 fun! netrw#NetBrowseX(fname,remote)
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1832 " call Dfunc("NetBrowseX(fname<".a:fname."> remote=".a:remote.")")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1833
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1834 " set up the filename
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1835 " (lower case the extension, make a local copy of a remote file)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1836 let exten= substitute(a:fname,'.*\.\(.\{-}\)','\1','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1837 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1838 let exten= substitute(exten,'^.*$','\L&\E','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1839 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1840 let fname= escape(a:fname,"%#")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1841 " call Decho("fname<".fname."> after escape()")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1842
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1843 " seems kde systems often have gnome-open due to dependencies, even though
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1844 " gnome-open's subsidiary display tools are largely absent. Kde systems
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1845 " usually have "kdeinit" running, though... (tnx Mikolaj Machowski)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1846 if !exists("s:haskdeinit")
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1847 if has("unix")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1848 silent! let s:haskdeinit= system('ps -e') =~ 'kdeinit'
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1849 if v:shell_error
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1850 let s:haskdeinit = 0
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1851 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1852 else
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1853 let s:haskdeinit= 0
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1854 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1855 " call Decho("setting s:haskdeinit=".s:haskdeinit)
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1856 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1857
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1858 if a:remote == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1859 " create a local copy
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1860 let fname= tempname().".".exten
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1861 " 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
1862 exe "silent keepjumps bot 1new ".a:fname
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1863 set bh=delete
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1864 exe "w! ".fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1865 q
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1866 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1867 " call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1868
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1869 " set up redirection
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1870 if &srr =~ "%s"
615
7fe13e0f5dce updated for version 7.0175
vimboss
parents: 568
diff changeset
1871 let redir= substitute(&srr,"%s","/dev/null","")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1872 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1873 let redir= &srr . "/dev/null"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1874 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1875 " call Decho("redir{".redir."} srr{".&srr."}")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1876
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1877 if exists("g:netrw_browsex_viewer") && executable(g:netrw_browsex_viewer)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1878 " call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">")
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1879 if g:netrw_browsex_viewer == '-'
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1880 let ret= netrwFileHandlers#Invoke(exten,fname)
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1881 else
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1882 " call Decho("exe silent !".g:netrw_browsex_viewer." '".escape(fname,'%#')."' ".redir)
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1883 exe "silent !".g:netrw_browsex_viewer." '".escape(fname,'%#')."'".redir
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1884 let ret= v:shell_error
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1885 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1886
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1887 " execute the file handler
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
1888 elseif has("win32") || has("win64")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1889 " call Decho('exe silent !start rundll32 url.dll,FileProtocolHandler "'.escape(fname, '%#').'"')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1890 exe 'silent !start rundll32 url.dll,FileProtocolHandler "'.escape(fname, '%#').'"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1891 let ret= v:shell_error
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1892
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1893 elseif has("unix") && executable("gnome-open") && !s:haskdeinit
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1894 " call Decho("exe silent !gnome-open '".escape(fname,'%#')."' ".redir)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1895 exe "silent !gnome-open '".escape(fname,'%#')."'".redir
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1896 let ret= v:shell_error
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1897
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1898 elseif has("unix") && executable("kfmclient") && s:haskdeinit
557
862863033fdd updated for version 7.0158
vimboss
parents: 554
diff changeset
1899 " call Decho("exe silent !kfmclient exec '".escape(fname,'%#')."' ".redir)
862863033fdd updated for version 7.0158
vimboss
parents: 554
diff changeset
1900 exe "silent !kfmclient exec '".escape(fname,'%#')."' ".redir
862863033fdd updated for version 7.0158
vimboss
parents: 554
diff changeset
1901 let ret= v:shell_error
862863033fdd updated for version 7.0158
vimboss
parents: 554
diff changeset
1902
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1903 else
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1904 " netrwFileHandlers#Invoke() always returns 0
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1905 let ret= netrwFileHandlers#Invoke(exten,fname)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1906 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1907
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1908 " if unsuccessful, attempt netrwFileHandlers#Invoke()
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1909 if ret
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1910 let ret= netrwFileHandlers#Invoke(exten,fname)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1911 endif
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1912
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1913 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1914
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1915 " cleanup: remove temporary file,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1916 " delete current buffer if success with handler,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1917 " return to prior buffer (directory listing)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1918 if a:remote == 1 && fname != a:fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1919 " call Decho("deleting temporary file<".fname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1920 call delete(fname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1921 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1922
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1923 if a:remote == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1924 set bh=delete bt=nofile noswf
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1925 exe "norm! \<c-o>"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1926 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1927 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1928
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1929 " call Dret("NetBrowseX")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1930 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1931
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1932 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1933 " NetBrowseFtpCmd: unfortunately, not all ftp servers honor options for ls {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1934 " This function assumes that a long listing will be received. Size, time,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1935 " and reverse sorts will be requested of the server but not otherwise
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1936 " enforced here.
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
1937 fun! s:NetBrowseFtpCmd(path,listcmd)
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
1938 " 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
1939
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1940 " because WinXX ftp uses unix style input
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1941 " curline is one more than the bannercnt in order to account
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1942 " for the unwanted first blank line (doing a :put to an empty
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1943 " buffer yields a blank first line)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1944 let ffkeep= &ff
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1945 setlocal ma ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1946 let curline= w:netrw_bannercnt+1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1947 exe "silent! keepjumps ".curline.",$d"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1948
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1949 ".........................................
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1950 if w:netrw_method == 2 || w:netrw_method == 5
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1951 " ftp + <.netrc>: Method #2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1952 if a:path != ""
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1953 put ='cd \"'.a:path.'\"'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1954 " call Decho('ftp: '.getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1955 endif
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
1956 exe "put ='".a:listcmd."'"
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1957 " call Decho("ftp: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1958 " redraw!|call inputsave()|call input("Pausing...")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1959 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1960 " 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
1961 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
1962 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1963 " 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
1964 exe g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1965 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1966
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1967 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1968 elseif w:netrw_method == 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1969 " ftp + machine,id,passwd,filename: Method #3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1970 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1971 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1972 put ='open '.g:netrw_machine.' '.g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1973 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1974 put ='open '.g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1975 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1976
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1977 if exists("g:netrw_ftp") && g:netrw_ftp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1978 put =g:netrw_uid
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1979 put ='\"'.g:netrw_passwd.'\"'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1980 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1981 put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1982 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1983
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1984 if a:path != ""
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
1985 put ='cd \"'.a:path.'\"'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1986 endif
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
1987 exe "put ='".a:listcmd."'"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
1988
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1989 " perform ftp:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1990 " -i : turns off interactive prompting from ftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1991 " -n unix : DON'T use <.netrc>, even though it exists
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1992 " -n win32: quit being obnoxious about password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1993 " call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i -n")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1994 exe g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i -n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1995
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1996 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1997 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1998 echo "***warning*** unable to comply with your request<" . choice . ">"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1999 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2000
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2001 " cleanup for Windows
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2002 if has("win32") || has("win95") || has("win64") || has("win16")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2003 silent! keepjumps! %s/\r$//e
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2004 endif
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2005 if a:listcmd == "dir"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2006 " infer directory/link based on the file permission string
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2007 silent! keepjumps g/d\%([-r][-w][-x]\)\{3}/s@$@/@
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2008 silent! keepjumps g/l\%([-r][-w][-x]\)\{3}/s/$/@/
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2009 if w:netrw_longlist == 0 || w:netrw_longlist == 2
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2010 exe "silent! keepjumps ".curline.',$s/^\%(\S\+\s\+\)\{8}//e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2011 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2012 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2013
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2014 " ftp's ls doesn't seem to include ./ or ../
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2015 if !search('^\.\/$','wn')
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2016 exe 'keepjumps '.curline
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2017 if a:path !~ '^$'
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2018 put ='../'
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2019 endif
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2020 put ='./'
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2021 exe 'keepjumps '.curline
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2022 endif
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2023
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2024 " restore settings
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2025 let &ff= ffkeep
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2026 " call Dret("NetBrowseFtpCmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2027 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2028
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2029 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2030 " NetrwListHide: uses [range]g~...~d to delete files that match comma {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2031 " separated patterns given in g:netrw_list_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2032 fun! s:NetrwListHide()
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2033 " call Dfunc("NetrwListHide() hide=".g:netrw_hide." listhide<".g:netrw_list_hide.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2034
849
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
2035 " find a character not in the "hide" string to used as a separator
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
2036 " for :g and :v commands
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2037 let listhide= g:netrw_list_hide
849
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
2038 let sep = strpart(substitute('~!@#$%^&*{};:,<.>/?|abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890','['.escape(listhide,'-]^\').']','','ge'),1,1)
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
2039 " call Decho("sep=".sep)
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
2040
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2041 while listhide != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2042 if listhide =~ ','
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2043 let hide = substitute(listhide,',.*$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2044 let listhide = substitute(listhide,'^.\{-},\(.*\)$','\1','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2045 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2046 let hide = listhide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2047 let listhide= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2048 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2049
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2050 " Prune the list by hiding any files which match
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2051 if g:netrw_hide == 1
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2052 " call Decho("hiding<".hide."> listhide<".listhide.">")
849
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
2053 exe 'silent keepjumps '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2054 elseif g:netrw_hide == 2
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2055 " call Decho("showing<".hide."> listhide<".listhide.">")
849
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
2056 exe 'silent keepjumps '.w:netrw_bannercnt.',$g'.sep.hide.sep.'s@^@ /-KEEP-/ @'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2057 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2058 endwhile
849
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
2059 if g:netrw_hide == 2
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
2060 exe 'silent keepjumps '.w:netrw_bannercnt.',$v@^ /-KEEP-/ @d'
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
2061 exe 'silent keepjumps '.w:netrw_bannercnt.',$s@^\%( /-KEEP-/ \)\+@@e'
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
2062 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2063
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2064 " call Dret("NetrwListHide")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2065 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2066
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2067 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2068 " NetHideEdit: allows user to edit the file/directory hiding list
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2069 fun! s:NetHideEdit(islocal)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2070 " call Dfunc("NetHideEdit(islocal=".a:islocal.")")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2071
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2072 " get new hiding list from user
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2073 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2074 let newhide= input("Edit Hiding List: ",g:netrw_list_hide)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2075 call inputrestore()
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2076 let g:netrw_list_hide= newhide
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2077 " call Decho("new g:netrw_list_hide<".g:netrw_list_hide.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2078
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2079 " refresh the listing
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2080 if a:islocal == 0
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2081 silent call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2082 else
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2083 silent call s:NetRefresh(s:LocalBrowseChgDir(b:netrw_curdir,"./"),a:islocal)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2084 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2085
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2086 " call Dret("NetHideEdit")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2087 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2088
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2089 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2090 " NetSortSequence: allows user to edit the sorting sequence
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2091 fun! s:NetSortSequence(mode)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2092 " call Dfunc("NetSortSequence(mode=".a:mode.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2093
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2094 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2095 let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2096 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2097
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2098 " refresh the listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2099 let g:netrw_sort_sequence= newsortseq
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2100 if a:mode == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2101 silent call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2102 else
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2103 silent call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,"./"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2104 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2105
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2106 " call Dret("NetSortSequence")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2107 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2108
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2109 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2110 " NetLongList: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2111 fun! s:NetLongList(mode)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2112 " call Dfunc("NetLongList(mode=".a:mode.") netrw_longlist=".w:netrw_longlist)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2113 let fname = s:NetGetWord()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2114 let w:netrw_longlist = (w:netrw_longlist + 1) % 3
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2115 " call Decho("fname<".fname.">")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2116
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2117 if w:netrw_longlist == 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2118 " use one column listing
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2119 " call Decho("use one column list")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2120 let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2121
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2122 elseif w:netrw_longlist == 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2123 " use long list
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2124 " call Decho("use long list")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2125 let g:netrw_list_cmd = g:netrw_list_cmd." -l"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2126
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2127 else
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2128 " give wide list
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2129 " call Decho("use wide list")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2130 let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2131 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2132 setlocal ma
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2133
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2134 " clear buffer - this will cause NetBrowse/LocalBrowse to do a refresh
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2135 %d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2136
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2137 " refresh the listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2138 if a:mode == 0
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2139 silent call s:NetBrowse(s:NetBrowseChgDir(expand("%"),"./"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2140 else
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2141 silent call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,"./"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2142 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2143
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2144 " keep cursor on the filename
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2145 silent keepjumps $
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2146 if fname =~ '/$'
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2147 silent call search('\%(^\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bW')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2148 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2149 silent call search('\%(^\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bW')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2150 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2151
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2152 " call Dret("NetLongList : w:netrw_longlist=".w:netrw_longlist)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2153 endfun
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2154
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2155 " ---------------------------------------------------------------------
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2156 " NetrwWideListing: {{{2
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2157 fun! s:NetrwWideListing()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2158
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2159 if w:netrw_longlist == 2
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2160 " call Dfunc("NetrwWideListing() w:netrw_longlist=".w:netrw_longlist)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2161 " look for longest filename (cpf=characters per filename)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2162 " cpf: characters per file
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2163 " fpl: files per line
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2164 " fpc: files per column
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2165 set ma
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2166 let b:netrw_cpf= 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2167 if line("$") >= w:netrw_bannercnt
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2168 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
2169 else
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2170 " call Dret("NetrwWideListing")
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2171 return
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2172 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2173 " call Decho("max file strlen+1=".b:netrw_cpf)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2174 let b:netrw_cpf= b:netrw_cpf + 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2175
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2176 " determine qty files per line (fpl)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2177 let w:netrw_fpl= winwidth(0)/b:netrw_cpf
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2178 if w:netrw_fpl <= 0
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2179 let w:netrw_fpl= 1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2180 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2181 " 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
2182
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2183 " make wide display
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2184 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
2185 let fpc = (line("$") - w:netrw_bannercnt + w:netrw_fpl)/w:netrw_fpl
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2186 let newcolstart = w:netrw_bannercnt + fpc
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2187 let newcolend = newcolstart + fpc - 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2188 " 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
2189 while line("$") >= newcolstart
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2190 if newcolend > line("$") | let newcolend= line("$") | endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2191 let newcolqty= newcolend - newcolstart
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2192 exe newcolstart
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2193 if newcolqty == 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2194 exe "silent keepjumps norm! 0\<c-v>$hx".w:netrw_bannercnt."G$p"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2195 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2196 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
2197 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2198 exe "silent keepjumps ".newcolstart.','.newcolend.'d'
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2199 exe 'silent keepjumps '.w:netrw_bannercnt
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2200 endwhile
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2201 exe "silent keepjumps ".w:netrw_bannercnt.',$s/\s\+$//e'
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2202 setlocal noma nomod
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2203 " call Dret("NetrwWideListing")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2204 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2205
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2206 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2207
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2208 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2209 " NetSaveWordPosn: used by the "s" command in both remote and local {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2210 " browsing. Along with NetRestoreWordPosn(), it keeps the cursor on
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2211 " the same word even though the sorting has changed its order of appearance.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2212 fun! s:NetSaveWordPosn()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2213 " call Dfunc("NetSaveWordPosn()")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2214 let s:netrw_saveword= '^'.escape(getline("."),s:netrw_cd_escape).'$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2215 " call Dret("NetSaveWordPosn : saveword<".s:netrw_saveword.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2216 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2217
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2218 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2219 " NetRestoreWordPosn: used by the "s" command; see NetSaveWordPosn() above {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2220 fun! s:NetRestoreWordPosn()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2221 " call Dfunc("NetRestoreWordPosn()")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2222 silent! call search(s:netrw_saveword,'w')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2223 " call Dret("NetRestoreWordPosn")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2224 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2225
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2226 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2227 " NetMakeDir: this function makes a directory (both local and remote) {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2228 fun! s:NetMakeDir(usrhost)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2229 " call Dfunc("NetMakeDir(usrhost<".a:usrhost.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2230
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2231 " get name of new directory from user. A bare <CR> will skip.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2232 " if its currently a directory, also request will be skipped, but with
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2233 " a message.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2234 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2235 let newdirname= input("Please give directory name: ")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2236 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2237 " call Decho("newdirname<".newdirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2238
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2239 if newdirname == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2240 " call Dret("NetMakeDir : user aborted with bare <cr>")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2241 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2242 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2243
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2244 if a:usrhost == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2245
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2246 " Local mkdir:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2247 " sanity checks
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2248 let fullnewdir= b:netrw_curdir.'/'.newdirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2249 " call Decho("fullnewdir<".fullnewdir.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2250 if isdirectory(fullnewdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2251 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2252 echohl WarningMsg | echo "***netrw*** <".newdirname."> is already a directory!" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2253 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2254 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2255 " call Dret("NetMakeDir : directory<".newdirname."> exists previously")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2256 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2257 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2258 if filereadable(fullnewdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2259 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2260 echohl WarningMsg | echo "***netrw*** <".newdirname."> is already a file!" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2261 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2262 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2263 " call Dret("NetMakeDir : file<".newdirname."> exists previously")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2264 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2265 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2266
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2267 " requested new local directory is neither a pre-existing file or
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2268 " directory, so make it!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2269 if exists("*mkdir")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2270 call mkdir(fullnewdir,"p")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2271 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2272 let netrw_origdir= s:NetGetcwd(1)
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2273 exe 'keepjumps cd '.b:netrw_curdir
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2274 " call Decho("netrw_origdir<".netrw_origdir.">: cd b:netrw_curdir<".b:netrw_curdir.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2275 " call Decho("exe silent! !".g:netrw_local_mkdir.' "'.newdirname.'"')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2276 exe "silent! !".g:netrw_local_mkdir.' "'.newdirname.'"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2277 if !g:netrw_keepdir | exe 'keepjumps cd '.netrw_origdir | endif
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2278 if !g:netrw_keepdir
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2279 exe 'keepjumps cd '.netrw_origdir
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2280 " call Decho("netrw_keepdir=".g:netrw_keepdir.": cd ".netrw_origdir)
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2281 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2282 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2283
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2284 if v:shell_error == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2285 " refresh listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2286 " call Decho("refresh listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2287 let linenum= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2288 norm! H0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2289 let hline = line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2290 set ma|norm! 2D
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2291 call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,'./'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2292 exe "norm! ".hline."G0z\<CR>"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2293 exe linenum
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2294 elseif !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2295 echohl Error | echo "***netrw*** unable to make directory<".newdirname.">" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2296 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2297 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2298 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2299
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2300 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2301 " Remote mkdir:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2302 let mkdircmd = substitute(g:netrw_mkdir_cmd,'\<HOSTNAME\>',a:usrhost,'')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2303 let newdirname= "'".'"'.substitute(expand("%"),'^\%(.\{-}/\)\{3}\(.*\)$','\1','').newdirname.'"'."'"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2304 " call Decho("exe silent! !".mkdircmd." ".newdirname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2305 exe "silent! !".mkdircmd." ".newdirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2306 if v:shell_error == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2307 " refresh listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2308 let linenum= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2309 norm! H0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2310 let hline = line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2311 call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2312 exe "norm! ".hline."G0z\<CR>"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2313 exe linenum
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2314 elseif !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2315 echohl Error | echo "***netrw*** unable to make directory<".newdirname.">" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2316 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2317 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2318 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2319 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2320
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2321 " call Dret("NetMakeDir")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2322 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2323
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2324 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2325 " NetBookmarkDir: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2326 " 0: (user: <b>) bookmark current directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2327 " 1: (user: <B>) change to the bookmarked directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2328 " 2: (user: <q>) list bookmarks
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2329 " 3: (LocalBrowse) record current directory history
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2330 " 4: (user: <u>) go up (previous) bookmark
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2331 " 5: (user: <U>) go down (next) bookmark
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2332 fun! s:NetBookmarkDir(chg,curdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2333 " call Dfunc("NetBookmarkDir(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2334 if exists("w:netrw_bannercnt") && line(".") <= w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2335 " looks like a "b" was pressed while in the banner region
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2336 if line("$") > w:netrw_bannercnt
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2337 exe 'silent keepjumps '.w:netrw_bannercnt
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2338 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2339 if &ch > 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2340 " "clear" the message
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2341 echo ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2342 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2343 " call Dret("NetBookmarkDir - ignoring")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2344 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2345 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2346
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2347 if a:chg == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2348 " bookmark the current directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2349 let g:NETRW_BOOKMARKDIR_{v:count}= a:curdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2350 if !exists("g:NETRW_BOOKMARKMAX")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2351 let g:NETRW_BOOKMARKMAX= v:count
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2352 elseif v:count > g:NETRW_BOOKMARKMAX
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2353 let g:NETRW_BOOKMARKMAX= v:count
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2354 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2355 echo "bookmarked the current directory"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2356
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2357 elseif a:chg == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2358 " change to the bookmarked directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2359 if exists("g:NETRW_BOOKMARKDIR_{v:count}")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2360 exe "e ".g:NETRW_BOOKMARKDIR_{v:count}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2361 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2362 echomsg "Sorry, bookmark#".v:count." doesn't exist!"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2363 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2364
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2365 elseif a:chg == 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2366 " list user's bookmarks
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2367 if exists("g:NETRW_BOOKMARKMAX")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2368 " call Decho("list bookmarks [0,".g:NETRW_BOOKMARKMAX."]")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2369 let cnt= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2370 while cnt <= g:NETRW_BOOKMARKMAX
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2371 if exists("g:NETRW_BOOKMARKDIR_{cnt}")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2372 " call Decho("Netrw Bookmark#".cnt.": ".g:NETRW_BOOKMARKDIR_{cnt})
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2373 echo "Netrw Bookmark#".cnt.": ".g:NETRW_BOOKMARKDIR_{cnt}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2374 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2375 let cnt= cnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2376 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2377 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2378
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2379 " list directory history
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2380 let cnt = g:NETRW_DIRHIST_CNT
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2381 let first = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2382 let histcnt = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2383 while ( first || cnt != g:NETRW_DIRHIST_CNT )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2384 " call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:NETRW_DIRHIST_CNT)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2385 let histcnt= histcnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2386 if exists("g:NETRW_DIRHIST_{cnt}")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2387 " call Decho("Netrw History#".histcnt.": ".g:NETRW_DIRHIST_{cnt})
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2388 echo "Netrw History#".histcnt.": ".g:NETRW_DIRHIST_{cnt}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2389 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2390 let first = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2391 let cnt = ( cnt - 1 ) % g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2392 if cnt < 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2393 let cnt= 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 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2396
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2397 elseif a:chg == 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2398 " saves most recently visited directories (when they differ)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2399 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
2400 let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2401 let g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}= substitute(a:curdir,'[/\\]$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2402 " 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
2403 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2404
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2405 elseif a:chg == 4
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2406 " u: change to the previous directory stored on the history list
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2407 let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT - 1 ) % g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2408 if g:NETRW_DIRHIST_CNT < 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2409 let g:NETRW_DIRHIST_CNT= g:NETRW_DIRHIST_CNT + g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2410 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2411 if exists("g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2412 " 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
2413 exe "e ".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2414 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2415 let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2416 echo "Sorry, no predecessor directory exists yet"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2417 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2418
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2419 elseif a:chg == 5
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2420 " U: change to the subsequent directory stored on the history list
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2421 let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2422 if exists("g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2423 " 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
2424 exe "e ".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2425 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2426 let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT - 1 ) % g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2427 if g:NETRW_DIRHIST_CNT < 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2428 let g:NETRW_DIRHIST_CNT= g:NETRW_DIRHIST_CNT + g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2429 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2430 echo "Sorry, no successor directory exists yet"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2431 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2432 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2433 " call Dret("NetBookmarkDir")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2434 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2435
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2436 " ---------------------------------------------------------------------
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2437 " NetObtain: obtain file under cursor (for remote browsing support) {{{2
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2438 fun! netrw#NetObtain(...)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2439 " call Dfunc("NetObtain() a:0=".a:0)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2440
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2441 if a:0==0
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2442 " no arguments -- use word under cursor
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2443 let fname= expand("<cWORD>")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2444 " call Decho("no arguments, use <".fname.">")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2445 elseif a:0 > 1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2446 " more than one argument, recurse with each argument separately
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2447 " call Decho("more than 1 argument, use recursion")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2448 let i=1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2449 while i <= a:0
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2450 call netrw#NetObtain(a:{i})
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2451 let i=i+1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2452 endwhile
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2453 return
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2454 else
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2455 " one argument provided
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2456 let fname = a:1
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2457 let keep_netrw_choice = exists("b:netrw_choice")? b:netrw_choice : ""
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2458 let keep_netrw_fname = exists("b:netrw_fname")? b:netrw_fname : ""
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2459 let keep_netrw_wmethod = exists("w:netrw_method")? w:netrw_method : ""
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2460 call s:NetMethod(fname)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2461 let w:netrw_method= b:netrw_method
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2462 let fname = b:netrw_fname
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2463 " call Decho("g:netrw_scp_cmd<".g:netrw_scp_cmd.">")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2464 " call Decho("g:netrw_machine<".g:netrw_machine.">")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2465 " call Decho("fname<".fname.">")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2466 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2467
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2468 " NetrwStatusLine support - for obtaining support
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2469 call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.fname)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2470
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2471 if exists("w:netrw_method") && w:netrw_method =~ '[235]'
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
2472 " call Decho("method=".w:netrw_method)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2473 if executable("ftp")
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
2474 " call Decho("ftp is executable, method=".w:netrw_method)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2475 let curdir = expand("%")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2476 let path = substitute(curdir,'ftp://[^/]\+/','','e')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2477 let curline= line(".")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2478 let endline= line("$")+1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2479 set ma
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2480 keepjumps $
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
2481 " call Decho("getcwd<".getcwd().">")
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
2482 " call Decho("curdir<".curdir.">")
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
2483 " call Decho("path<".path.">")
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
2484 " call Decho("curline=".curline)
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
2485 " call Decho("endline=".endline)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2486
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2487 ".........................................
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2488 if w:netrw_method == 2
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2489 " ftp + <.netrc>: Method #2
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2490 setlocal ff=unix
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2491 if path != ""
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2492 put ='cd '.path
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2493 " call Decho("ftp: cd ".path)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2494 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2495 put ='get '.fname
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2496 " call Decho("ftp: get ".fname)
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
2497 put ='quit'
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
2498 " call Decho("ftp: quit")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2499 if exists("g:netrw_port") && g:netrw_port != ""
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2500 " 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
2501 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
2502 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2503 " 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
2504 exe g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2505 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2506
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2507 ".........................................
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2508 elseif w:netrw_method == 3
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2509 " ftp + machine,id,passwd,filename: Method #3
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2510 setlocal ff=unix
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2511 if exists("g:netrw_port") && g:netrw_port != ""
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2512 put ='open '.g:netrw_machine.' '.g:netrw_port
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2513 " call Decho('ftp: open '.g:netrw_machine.' '.g:netrw_port)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2514 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2515 put ='open '.g:netrw_machine
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2516 " call Decho('ftp: open '.g:netrw_machine)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2517 endif
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 if exists("g:netrw_ftp") && g:netrw_ftp == 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2520 put =g:netrw_uid
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2521 put ='\"'.g:netrw_passwd.'\"'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2522 " call Decho('ftp: g:netrw_uid')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2523 " call Decho('ftp: g:netrw_passwd')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2524 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2525 put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2526 " call Decho('user '.g:netrw_uid.' '.g:netrw_passwd)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2527 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2528
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2529 if a:path != ""
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2530 put ='cd '.a:path
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2531 " call Decho('cd '.a:path)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2532 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2533 exe "put ='".a:cmd."'"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2534 " call Decho("ftp: ".a:cmd)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2535
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2536 " perform ftp:
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2537 " -i : turns off interactive prompting from ftp
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2538 " -n unix : DON'T use <.netrc>, even though it exists
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2539 " -n win32: quit being obnoxious about password
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2540 " call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i -n")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2541 exe g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i -n"
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2542
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2543 ".........................................
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2544 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2545 echo "***warning*** unable to comply with your request<" . choice . ">"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2546 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2547 " restore
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2548 exe "silent! ".endline.",$d"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2549 exe "keepjumps ".curline
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2550 setlocal noma nomod
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2551 else
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
2552 " call Decho("ftp not executable")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2553 if !exists("g:netrw_quiet")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2554 echohl Error | echo "***netrw*** this system doesn't support ftp" | echohl None
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2555 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2556 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2557 " restore status line
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2558 let &stl = s:netrw_users_stl
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2559 let &laststatus = s:netrw_users_ls
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2560 " restore NetMethod
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2561 if exists("keep_netrw_method")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2562 call s:NetMethod(keep_netrw_choice)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2563 let w:netrw_method = keep_netrw_wmethod
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2564 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2565 " call Dret("NetObtain")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2566 return
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2567 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2568
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2569 ".........................................
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2570 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2571 " scp: Method#4
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
2572 " call Decho("using scp")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2573 let curdir = expand("%")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2574 let path = substitute(curdir,'scp://[^/]\+/','','e')
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2575 " call Decho("path<".path.">")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2576 if exists("g:netrw_port") && g:netrw_port != ""
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2577 let useport= " -P ".g:netrw_port
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2578 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2579 let useport= ""
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2580 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2581 if g:netrw_cygwin == 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2582 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2583 " 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
2584 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
2585 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2586 " 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
2587 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
2588 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2589 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2590
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2591 " restore status line
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2592 let &stl = s:netrw_users_stl
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2593 let &laststatus = s:netrw_users_ls
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2594 redraw!
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2595
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2596 " restore NetMethod
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2597 if exists("keep_netrw_method")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2598 call s:NetMethod(keep_netrw_choice)
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2599 let w:netrw_method = keep_netrw_wmethod
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2600 endif
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2601
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2602 " call Dret("NetObtain")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2603 endfun
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2604
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2605 " ---------------------------------------------------------------------
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2606 " NetPrevWinOpen: open file/directory in previous window. {{{2
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2607 " If there's only one window, then the window will first be split.
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2608 fun! s:NetPrevWinOpen(islocal)
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2609 " call Dfunc("NetPrevWinOpen(islocal=".a:islocal.")")
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2610
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2611 " get last window number and the word currently under the cursor
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2612 let lastwinnr = winnr("$")
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2613 let curword = s:NetGetWord()
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2614 let curdir = b:netrw_curdir
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2615 " call Decho("lastwinnr=".lastwinnr." curword<".curword.">")
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2616
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2617 let didsplit = 0
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2618 if lastwinnr == 1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2619 " if only one window, open a new one first
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2620 " 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
2621 exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s"
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2622 let didsplit = 1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2623
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2624 else
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2625 wincmd p
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2626 " if the previous window's buffer has been changed (is modified),
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2627 " and it doesn't appear in any other extant window, then ask the
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2628 " user if s/he wants to abandon modifications therein.
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2629 let bnr = winbufnr(0)
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2630 let bnrcnt = 0
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2631 if &mod
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2632 windo if winbufnr(0) == bnr | let bnrcnt=bnrcnt+1 | endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2633 " call Decho("bnr=".bnr." bnrcnt=".bnrcnt)
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2634 if bnrcnt == 1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2635 let bufname= bufname(winbufnr(winnr()))
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2636 let choice= confirm("Save modified file<".bufname.">?","&Yes\n&No\n&Cancel")
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2637
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2638 if choice == 1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2639 " Yes -- write file & then browse
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2640 let v:errmsg= ""
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2641 silent w
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2642 if v:errmsg != ""
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2643 echohl Error | echo "***netrw*** "unable to write <".bufname.">!" | echohl None
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2644 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2645 if didsplit
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2646 q
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2647 else
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2648 wincmd p
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2649 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2650 " call Dret("NetPrevWinOpen : unable to write <".bufname.">")
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2651 return
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2652 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2653
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2654 elseif choice == 2
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2655 " No -- don't worry about changed file, just browse anyway
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2656 set nomod
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2657 echohl WarningMsg | echo "***netrw*** ".bufname." changes abandoned" | echohl None
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2658
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2659 else
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2660 " Cancel -- don't do this
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2661 if didsplit
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2662 q
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2663 else
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2664 wincmd p
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2665 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2666 " call Dret("NetPrevWinOpen : cancelled")
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2667 return
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2668 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2669 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2670 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2671 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2672
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2673 if a:islocal
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2674 call s:LocalBrowse(s:LocalBrowseChgDir(curdir,curword))
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2675 else
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2676 call s:NetBrowse(s:NetBrowseChgDir(expand("%"),curword))
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2677 endif
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2678 " call Dret("NetPrevWinOpen")
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2679 endfun
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2680
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2681 " ---------------------------------------------------------------------
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2682 " NetMenu: generates the menu for gvim and netrw {{{2
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2683 fun! s:NetMenu(domenu)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2684
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2685 if !exists("g:NetrwMenuPriority")
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2686 let g:NetrwMenuPriority= 80
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2687 endif
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2688
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2689 if has("menu") && has("gui_running") && &go =~ 'm'
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2690 " call Dfunc("NetMenu(domenu=".a:domenu.")")
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2691 if !exists("s:netrw_menu_enabled") && a:domenu
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2692 " call Decho("initialize menu")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2693 let s:netrw_menu_enabled= 1
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2694 if !exists("g:NetrwTopLvlMenu")
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2695 let g:NetrwTopLvlMenu= "Netrw."
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2696 endif
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2697 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Help<tab><F1> <F1>'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2698 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Apply\ Special\ Viewer<tab>x x'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2699 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Bookmark\ Current\ Directory<tab>b Nb'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2700 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Go\ Up\ Directory<tab>- -'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2701 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Goto\ Bookmarked\ Directory<tab>B NB'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2702 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
2703 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
2704 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Delete\ File/Directory<tab>D D'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2705 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
2706 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Edit\ File/Directory<tab><cr> '."\<cr>"
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2707 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
2708 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
2709 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
2710 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
2711 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Make\ Subdirectory<tab>d d'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2712 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Normal-Hide-Show<tab>a a'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2713 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Obtain\ File<tab>O O'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2714 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Preview\ File/Directory<tab>p p'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2715 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Previous\ Window\ Browser<tab>P P'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2716 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
2717 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Rename\ File/Directory<tab>R R'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2718 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Reverse\ Sorting\ Order<tab>'."r r"
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2719 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Select\ Sorting\ Style<tab>s s'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2720 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Sorting\ Sequence\ Edit<tab>S S'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2721 exe 'silent! '.g:NetrwMenuPriority.'menu '.g:NetrwTopLvlMenu.'Set\ Current\ Directory<tab>c c'
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
2722 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
2723 elseif !a:domenu
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2724 let s:netrwcnt = 0
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2725 let curwin = winnr()
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2726 windo if getline(2) =~ "Netrw" | let s:netrwcnt= s:netrwcnt + 1 | endif
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2727 exe curwin."wincmd w"
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2728
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2729 if s:netrwcnt <= 1
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2730 " call Decho("clear menus")
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2731 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Help'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2732 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Apply\ Special\ Viewer'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2733 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Bookmark\ Current\ Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2734 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Go\ Up\ Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2735 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Goto\ Bookmarked\ Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2736 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Change\ To\ Recently\ Used\ Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2737 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Change\ To\ Subsequently\ Used\ Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2738 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Delete\ File/Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2739 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Edit\ File/Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2740 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Edit\ File/Directory,\ New\ Window'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2741 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Edit\ File/Directory,\ New\ Vertical\ Window'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2742 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Edit\ File\ Hiding\ List'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2743 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Edit\ File'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2744 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Enter\ File/Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2745 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Enter\ File/Directory\ (vertical\ split)'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2746 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'List\ Bookmarks\ and\ History'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2747 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Listing\ Style\ (thin-long-wide)'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2748 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Make\ Subdirectory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2749 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Normal-Hide-Show'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2750 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Obtain\ File'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2751 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Preview\ File/Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2752 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Previous\ Window\ Browser'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2753 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Refresh\ Listing'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2754 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Rename\ File/Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2755 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Reverse\ Sorting\ Order'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2756 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Select\ Sorting\ Style'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2757 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Sorting\ Sequence\ Edit'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2758 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Set\ Current\ Directory'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2759 exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Settings/Options'
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2760 unlet s:netrw_menu_enabled
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2761 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2762 endif
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2763 " call Dret("NetMenu")
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2764 endif
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2765
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2766 endfun
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2767
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2768 " ==========================================
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2769 " Local Directory Browsing Support: {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2770 " ==========================================
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2771
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2772 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2773 " LocalBrowse: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2774 fun! s:LocalBrowse(dirname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2775 " unfortunate interaction -- debugging calls can't be used here;
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2776 " the BufEnter event causes triggering when attempts to write to
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2777 " the DBG buffer are made.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2778 if isdirectory(a:dirname)
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2779 silent! call netrw#DirBrowse(a:dirname)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2780 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2781 " not a directory, ignore it
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2782 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2783
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2784 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2785 " DirBrowse: supports local file/directory browsing {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2786 fun! netrw#DirBrowse(dirname)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2787 if !exists("w:netrw_longlist")|let w:netrw_longlist= g:netrw_longlist|endif
849
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 844
diff changeset
2788 " call Dfunc("DirBrowse(dirname<".a:dirname.">) buf#".bufnr("%")." winnr=".winnr()." sortby=".g:netrw_sort_by." hide=".g:netrw_hide)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2789 " call Dredir("ls!")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2790
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2791 if exists("s:netrw_skipbrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2792 unlet s:netrw_skipbrowse
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2793 " call Dret("DirBrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2794 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2795 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2796 if &fo =~ '[ta]'
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2797 set fo-=t
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2798 set fo-=a
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2799 echohl Warning
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2800 echo '***warning*** directory browsing and formatoptions "ta" are incompatible'
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2801 echohl None
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2802 endif
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2803
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2804 call s:NetOptionSave()
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
2805 if exists("w:acdkeep") && w:acdkeep
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2806 exe 'cd '.escape(a:dirname,s:netrw_cd_escape)
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2807 " call Decho("cd ".escape(a:dirname,s:netrw_cd_escape))
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2808 " call Decho("getcwd<".getcwd().">")
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2809 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2810
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2811 if v:version < 603
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2812 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2813 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
2814 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2815 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2816 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2817 " call Dret("DirBrowse : vim version<".v:version."> too old")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2818 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2819 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2820
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2821 " use buffer-oriented WinVars if buffer ones exist but window ones don't
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2822 call s:UseBufWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2823
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2824 " set up menus
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2825 let b:netrw_browser_active= 1
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2826 call s:NetMenu(1)
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2827
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2828 " find buffer number of buffer named precisely the same as a:dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2829 let bufnum= bufnr(escape(a:dirname,'\'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2830 " call Decho("findbuf: bufnum=".bufnum)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2831 if bufnum > 0 && bufname(bufnum) != a:dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2832 let ibuf= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2833 let buflast= bufnr("$")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2834 while bufname(ibuf) !~ '^'.a:dirname.'\=$' && ibuf <= buflast
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2835 " call Decho("findbuf: ibuf=".ibuf. " bufname<".bufname(ibuf)."> dirname<".a:dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2836 let ibuf= ibuf + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2837 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2838 if ibuf > buflast
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2839 let bufnum= -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2840 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2841 let bufnum= ibuf
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2842 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2843 " call Decho("findbuf: bufnum=".bufnum." (final)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2844 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2845
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2846 " get cleared buffer
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2847 mark '
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2848 if bufnum < 0 || !bufexists(bufnum)
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2849 keepjumps keepalt enew!
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2850 " call Decho("enew buffer")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2851 else
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2852 exe "keepalt b ".bufnum
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2853 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
2854 if getline(2) =~ '^" Netrw Directory Listing '
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2855 if !g:netrw_keepdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2856 exe 'cd '.escape(b:netrw_curdir,s:netrw_cd_escape)
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2857 " 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
2858 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2859 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2860 " call Dret("DirBrowse : reusing buffer#".bufnum."<".a:dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2861 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2862 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2863 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2864 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2865 let s:last_sort_by= g:netrw_sort_by
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2866
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
2867 " set up ShellCmdPost handling. Append current buffer to browselist
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
2868 call s:LocalFastBrowser()
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
2869
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2870 " get the new directory name
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2871 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2872 let b:netrw_curdir= substitute(a:dirname,'\\','/','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2873 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2874 let b:netrw_curdir= a:dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2875 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2876 if b:netrw_curdir =~ '[/\\]$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2877 let b:netrw_curdir= substitute(b:netrw_curdir,'[/\\]$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2878 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2879 if b:netrw_curdir == ''
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2880 " under unix, when the root directory is encountered, the result
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2881 " from the preceding substitute is an empty string.
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2882 let b:netrw_curdir= '/'
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2883 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2884 " call Decho("b:netrw_curdir<".b:netrw_curdir.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2885
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2886 " make netrw's idea of the current directory vim's if the user wishes
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2887 if !g:netrw_keepdir
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2888 " 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
2889 try
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2890 exe 'cd '.escape(b:netrw_curdir,s:netrw_cd_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2891 catch /^Vim\%((\a\+)\)\=:E472/
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2892 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
2893 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2894 if exists("w:netrw_prvdir")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2895 let b:netrw_curdir= w:netrw_prvdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2896 else
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2897 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2898 " call Dret("DirBrowse : reusing buffer#".bufnum."<".a:dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2899 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2900 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2901 endtry
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2902 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2903
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2904 " change the name of the buffer to reflect the b:netrw_curdir
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2905 " Hmm. When another vim is open to the same directory, I get
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2906 " a "Press ENTER" ... ok, setting "noswf" avoids it.
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2907 " call Decho('exe silent! file '.escape(b:netrw_curdir,s:netrw_cd_escape))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2908 exe 'silent! file '.escape(b:netrw_curdir,s:netrw_cd_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2909
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2910 " make this buffer not-a-file, modifiable, not line-numbered, etc
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2911 setlocal bt=nofile nobl ma nonu noswf nowrap
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2912 if g:netrw_fastbrowse >= 2
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2913 setlocal bh=hide
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
2914 else
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
2915 setlocal bh=delete
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
2916 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2917 keepalt silent! %d
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2918
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2919 " ---------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2920 " Perform Directory Listing:
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2921 if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2922 echo "(netrw) Processing your browsing request..."
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
2923 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2924
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2925 " save current directory on directory history list
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2926 call s:NetBookmarkDir(3,b:netrw_curdir)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2927
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2928 " set up all the maps
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2929 " call Decho("Setting up local browser maps")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2930 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
2931 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
2932 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
2933 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
2934 if w:netrw_longlist != 2
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2935 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
2936 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
2937 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2938 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
2939 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
2940 nnoremap <buffer> <silent> c :exe "cd ".b:netrw_curdir<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2941 nnoremap <buffer> <silent> d :call <SID>NetMakeDir("")<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2942 nnoremap <buffer> <silent> <c-h> :call <SID>NetHideEdit(1)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2943 nnoremap <buffer> <silent> i :call <SID>NetLongList(1)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2944 nnoremap <buffer> <silent> o :call <SID>NetSplit(2)<cr>
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2945 nnoremap <buffer> <silent> O :call <SID>LocalObtain()<cr>
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2946 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
2947 nnoremap <buffer> <silent> P :call <SID>NetPrevWinOpen(1)<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2948 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
2949 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
2950 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
2951 nnoremap <buffer> <silent> S :call <SID>NetSortSequence(1)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2952 nnoremap <buffer> <silent> u :<c-u>call <SID>NetBookmarkDir(4,expand("%"))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2953 nnoremap <buffer> <silent> U :<c-u>call <SID>NetBookmarkDir(5,expand("%"))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2954 nnoremap <buffer> <silent> v :call <SID>NetSplit(3)<cr>
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
2955 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
2956 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
2957 if s:didstarstar || !mapcheck("<s-down>","n")
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2958 nnoremap <buffer> <silent> <s-down> :Nexplore<cr>
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2959 endif
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2960 if s:didstarstar || !mapcheck("<s-up>","n")
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2961 nnoremap <buffer> <silent> <s-up> :Pexplore<cr>
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
2962 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2963 exe 'nnoremap <buffer> <silent> <del> :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2964 exe 'vnoremap <buffer> <silent> <del> :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2965 exe 'nnoremap <buffer> <silent> D :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2966 exe 'vnoremap <buffer> <silent> D :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2967 exe 'nnoremap <buffer> <silent> R :call <SID>LocalBrowseRename("'.b:netrw_curdir.'")<cr>'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2968 exe 'vnoremap <buffer> <silent> R :call <SID>LocalBrowseRename("'.b:netrw_curdir.'")<cr>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2969 exe 'nnoremap <buffer> <silent> <Leader>m :call <SID>NetMakeDir("")<cr>'
794
f19994020dad updated for version 7.0231
vimboss
parents: 766
diff changeset
2970 nnoremap <buffer> <F1> :he netrw-dir<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2971
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2972 " Set up the banner
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2973 " call Decho("set up banner")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2974 keepjumps put ='\" ============================================================================'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2975 keepjumps 1d
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
2976 keepjumps put ='\" Netrw Directory Listing (netrw '.g:loaded_netrw.')'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2977 keepjumps put ='\" '.b:netrw_curdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2978 let w:netrw_bannercnt= 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2979
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2980 let sortby= g:netrw_sort_by
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2981 if g:netrw_sort_direction =~ "^r"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2982 let sortby= sortby." reversed"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2983 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2984
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2985 " Sorted by...
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2986 if g:netrw_sort_by =~ "^n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2987 " call Decho("directories will be sorted by name")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2988 " sorted by name
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2989 keepjumps put ='\" Sorted by '.sortby
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2990 keepjumps put ='\" Sort sequence: '.g:netrw_sort_sequence
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2991 let w:netrw_bannercnt= w:netrw_bannercnt + 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2992 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2993 " call Decho("directories will be sorted by size or date")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2994 " sorted by size or date
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2995 keepjumps put ='\" Sorted by '.sortby
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2996 let w:netrw_bannercnt= w:netrw_bannercnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2997 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2998
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2999 " Hiding... -or- Showing...
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3000 if g:netrw_list_hide != "" && g:netrw_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3001 if g:netrw_hide == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3002 keepjumps put ='\" Hiding: '.g:netrw_list_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3003 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3004 keepjumps put ='\" Showing: '.g:netrw_list_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3005 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3006 let w:netrw_bannercnt= w:netrw_bannercnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3007 endif
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 799
diff changeset
3008 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
3009 keepjumps put ='\" ============================================================================'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3010 let w:netrw_bannercnt= w:netrw_bannercnt + 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3011
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3012 " bannercnt should index the line just after the banner
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3013 let w:netrw_bannercnt= w:netrw_bannercnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3014 " call Decho("bannercnt=".w:netrw_bannercnt)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3015
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3016 " generate the requested directory listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3017 call s:LocalBrowseList()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3018
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3019 " set up syntax highlighting
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3020 if has("syntax")
829
dc8197342755 updated for version 7.0d04
vimboss
parents: 828
diff changeset
3021 setlocal ft=netrw
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3022 if !exists("g:syntax_on") || !g:syntax_on
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3023 setlocal ft=
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3024 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3025 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3026
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3027 " manipulate the directory listing (hide, sort)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3028 if line("$") >= w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3029 if g:netrw_hide && g:netrw_list_hide != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3030 call s:NetrwListHide()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3031 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3032 if line("$") >= w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3033
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3034 if g:netrw_sort_by =~ "^n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3035 call s:SetSort()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3036
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3037 if w:netrw_bannercnt < line("$")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3038 if g:netrw_sort_direction =~ 'n'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3039 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3040 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3041 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3042 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3043 endif
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
3044 " remove priority pattern prefix
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3045 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{3}\///e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3046
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3047 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3048 if w:netrw_bannercnt < line("$")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3049 if g:netrw_sort_direction =~ 'n'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3050 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3051 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3052 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3053 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3054 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3055 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{-}\///e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3056 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3057
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3058 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3059 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3060
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3061 call s:NetrwWideListing()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3062 if exists("w:netrw_bannercnt") && line("$") > w:netrw_bannercnt
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3063 " place cursor on the top-left corner of the file listing
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3064 exe 'silent '.w:netrw_bannercnt
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3065 norm! 0
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3066 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3067
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3068 " record previous current directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3069 let w:netrw_prvdir= b:netrw_curdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3070
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3071 " save certain window-oriented variables into buffer-oriented variables
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3072 call s:SetBufWinVars()
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3073 call s:NetOptionRestore()
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3074 setlocal noma nomod nonu nobl nowrap
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3075 if g:netrw_fastbrowse >= 2
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3076 setlocal bh=hide
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3077 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3078
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3079 " call Dret("DirBrowse : file<".expand("%:p")."> bufname<".bufname("%").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3080 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3081
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3082 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3083 " LocalBrowseList: does the job of "ls" for local directories {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3084 fun! s:LocalBrowseList()
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3085 " 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
3086
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3087 " get the list of files contained in the current directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3088 let dirname = escape(b:netrw_curdir,s:netrw_glob_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3089 let dirnamelen = strlen(b:netrw_curdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3090 let filelist = glob(dirname."/*")
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
3091 " call Decho("glob(dirname<".dirname."/.*>)=".filelist)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3092 if filelist != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3093 let filelist= filelist."\n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3094 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3095 let filelist= filelist.glob(dirname."/.*")
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
3096 " call Decho("glob(dirname<".dirname."/.*>)=".glob(dirname.".*"))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3097
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3098 " if the directory name includes a "$", and possibly other characters,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3099 " the glob() doesn't include "." and ".." entries.
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 " call Decho("forcibly tacking on .")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3102 if filelist == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3103 let filelist= dirname."."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3104 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3105 let filelist= filelist."\n".b:netrw_curdir."."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3106 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3107 " call Decho("filelist<".filelist.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3108 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3109 if filelist !~ '[\\/]\.\.[\\/]\=\(\n\|$\)'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3110 " call Decho("forcibly tacking on ..")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3111 let filelist= filelist."\n".b:netrw_curdir.".."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3112 " call Decho("filelist<".filelist.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3113 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3114 let filelist= substitute(filelist,'\n\{2,}','\n','ge')
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3115 if (has("win32") || has("win95") || has("win64") || has("win16"))
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3116 let filelist= substitute(filelist,'\','/','ge')
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3117 else
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3118 let filelist= substitute(filelist,'\','\\','ge')
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3119 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3120
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3121 " call Decho("dirname<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3122 " call Decho("dirnamelen<".dirnamelen.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3123 " call Decho("filelist<".filelist.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3124
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3125 while filelist != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3126 if filelist =~ '\n'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3127 let filename = substitute(filelist,'\n.*$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3128 let filelist = substitute(filelist,'^.\{-}\n\(.*\)$','\1','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3129 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3130 let filename = filelist
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3131 let filelist = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3132 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3133 let pfile= filename
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3134 if isdirectory(filename)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3135 let pfile= filename."/"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3136 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3137 if pfile =~ '//$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3138 let pfile= substitute(pfile,'//$','/','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3139 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3140 let pfile= strpart(pfile,dirnamelen)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3141 let pfile= substitute(pfile,'^/','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3142 " call Decho(" ")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3143 " call Decho("filename<".filename.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3144 " call Decho("pfile <".pfile.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3145
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3146 if w:netrw_longlist == 1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3147 let sz = getfsize(filename)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3148 let fsz = strpart(" ",1,15-strlen(sz)).sz
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3149 let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3150 " call Decho("sz=".sz." fsz=".fsz)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3151 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3152
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3153 if g:netrw_sort_by =~ "^t"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3154 " sort by time (handles time up to 1 quintillion seconds, US)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3155 " call Decho("getftime(".filename.")=".getftime(filename))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3156 let t = getftime(filename)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3157 let ft = strpart("000000000000000000",1,18-strlen(t)).t
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3158 " call Decho("exe keepjumps put ='".ft.'/'.filename."'")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3159 let ftpfile= ft.'/'.pfile
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3160 keepjumps silent! put=ftpfile
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3161
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3162 elseif g:netrw_sort_by =~ "^s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3163 " sort by size (handles file sizes up to 1 quintillion bytes, US)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3164 " call Decho("getfsize(".filename.")=".getfsize(filename))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3165 let sz = getfsize(filename)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3166 let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3167 " call Decho("exe keepjumps put ='".fsz.'/'.filename."'")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3168 let fszpfile= fsz.'/'.pfile
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3169 keepjumps silent! put =fszpfile
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3170
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3171 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3172 " sort by name
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3173 " call Decho("exe keepjumps put ='".pfile."'")
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3174 keepjumps silent! put=pfile
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3175 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3176 endwhile
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3177
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3178 " cleanup any windows mess at end-of-line
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3179 silent! keepjumps %s/\r$//e
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3180 setlocal ts=32
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3181
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3182 " call Dret("LocalBrowseList")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3183 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3184
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3185 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3186 " LocalBrowseChgDir: constructs a new directory based on the current {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3187 " directory and a new directory name
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3188 fun! s:LocalBrowseChgDir(dirname,newdir,...)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3189 " call Dfunc("LocalBrowseChgDir(dirname<".a:dirname."> newdir<".a:newdir.">) a:0=".a:0)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3190
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3191 let dirname= substitute(a:dirname,'\\','','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3192 let newdir = a:newdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3193
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3194 if dirname !~ '[\/]$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3195 " apparently vim is "recognizing" that it is in the home directory and
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3196 " is removing the "/". Bad idea, so I have to put it back.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3197 let dirname= dirname.'/'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3198 " call Decho("adjusting dirname<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3199 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3200
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3201 if newdir !~ '[\/]$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3202 " handling a file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3203 let dirname= dirname.newdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3204 " call Decho("handling a file: dirname<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3205 " this lets NetBrowseX avoid the edit
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3206 if a:0 < 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3207 " call Decho("dirname<".dirname."> netrw_cd_escape<".s:netrw_cd_escape.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3208 " call Decho("about to edit<".escape(dirname,s:netrw_cd_escape).">")
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3209 if g:netrw_browse_split == 1
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3210 new
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3211 wincmd _
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3212 elseif g:netrw_browse_split == 2
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3213 rightb vert new
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3214 wincmd |
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
3215 else
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
3216 " handling a file, didn't split, so possibly remove menu
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
3217 call s:NetMenu(0)
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3218 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3219 exe "e! ".escape(dirname,s:netrw_cd_escape)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3220 set ma nomod
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3221 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3222
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3223 elseif newdir == './'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3224 " refresh the directory list
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3225 " call Decho("refresh directory listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3226
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3227 elseif newdir == '../'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3228 " go up one directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3229 let dirname= substitute(dirname,'^\(.*/\)\([^/]\+[\/]$\)','\1','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3230 " call Decho("go up one dir: dirname<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3231
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3232 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3233 " go down one directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3234 let dirname= dirname.newdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3235 " call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3236 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3237
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3238 " call Dret("LocalBrowseChgDir <".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3239 return dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3240 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3241
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3242 " ---------------------------------------------------------------------
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3243 " LocalBrowseShellCmdRefresh: this function is called after a user has {{{2
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3244 " performed any shell command. The idea is to cause all local-browsing
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3245 " buffers to be refreshed after a user has executed some shell command,
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3246 " on the chance that s/he removed/created a file/directory with it.
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3247 fun! s:LocalBrowseShellCmdRefresh()
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3248 " call Dfunc("LocalBrowseShellCmdRefresh() browselist=".string(s:netrw_browselist))
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
3249 " GO through all buffers on netrw_browselist (ie. just local-netrw buffers):
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
3250 " | refresh any netrw window
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
3251 " | wipe out any non-displaying netrw buffer
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3252 let curwin = winnr()
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3253 let ibl = 0
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3254 for ibuf in s:netrw_browselist
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3255 if bufwinnr(ibuf) == -1
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3256 " call Decho("wiping buf#".ibuf)
799
6beb2c667935 updated for version 7.0b
vimboss
parents: 794
diff changeset
3257 exe "silent! bw ".ibuf
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3258 call remove(s:netrw_browselist,ibl)
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3259 " call Decho("browselist=".string(s:netrw_browselist))
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3260 continue
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3261 else
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3262 " call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf))
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3263 exe bufwinnr(ibuf)."wincmd w"
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3264 call s:NetRefresh(s:LocalBrowseChgDir(b:netrw_curdir,'./'),1)
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3265 endif
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3266 let ibl= ibl + 1
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3267 endfor
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3268 exe curwin."wincmd w"
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3269
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3270 " call Dret("LocalBrowseShellCmdRefresh")
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3271 endfun
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3272
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3273 " ---------------------------------------------------------------------
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3274 " LocalBrowseRm: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3275 fun! s:LocalBrowseRm(path) range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3276 " call Dfunc("LocalBrowseRm(path<".a:path.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3277 " call Decho("firstline=".a:firstline." lastline=".a:lastline)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3278
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3279 " preparation for removing multiple files/directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3280 let ctr = a:firstline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3281 let ret = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3282 let all= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3283
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3284 " remove multiple files and directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3285 while ctr <= a:lastline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3286 exe "keepjumps ".ctr
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3287
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3288 " sanity checks
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3289 if line(".") < w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3290 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3291 continue
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3292 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3293 let curword= s:NetGetWord()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3294 if curword == "./" || curword == "../"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3295 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3296 continue
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3297 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3298
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3299 norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3300 let rmfile= a:path."/".curword
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3301 " call Decho("rmfile<".rmfile.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3302
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3303 if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3304 " attempt to remove file
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 file<".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 echohl NONE
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
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3314 " call Decho("response: ok<".ok.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3315 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
3316 " call Decho("response: ok<".ok."> (after sub)")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3317 if ok =~ 'a\%[ll]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3318 let all= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3319 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3320 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3321
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3322 if all || ok =~ 'y\%[es]' || ok == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3323 let ret= delete(rmfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3324 " call Decho("errcode=".v:shell_error." ret=".ret)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3325 elseif ok =~ 'q\%[uit]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3326 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3327 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3328
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3329 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3330 " attempt to remove directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3331 if !all
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3332 echohl Statement
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3333 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3334 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
3335 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3336 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
3337 if ok == ""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3338 let ok="no"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3339 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3340 if ok =~ 'a\%[ll]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3341 let all= 1
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 let rmfile= substitute(rmfile,'[\/]$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3345
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3346 if all || ok =~ 'y\%[es]' || ok == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3347 " call Decho("1st attempt: system(".g:netrw_local_rmdir.' "'.rmfile.'")')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3348 call system(g:netrw_local_rmdir.' "'.rmfile.'"')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3349 " call Decho("v:shell_error=".v:shell_error)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3350
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3351 if v:shell_error != 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3352 " call Decho("2nd attempt to remove directory<".rmfile.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3353 let errcode= delete(rmfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3354 " call Decho("errcode=".errcode)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3355
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3356 if errcode != 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3357 if has("unix")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3358 " call Decho("3rd attempt to remove directory<".rmfile.">")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3359 call system("rm ".rmfile)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3360 if v:shell_error != 0 && !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3361 echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3362 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3363 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3364 elseif !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3365 echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3366 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3367 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3368 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3369 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3370
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3371 elseif ok =~ 'q\%[uit]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3372 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3373 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3374 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3375
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 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3378
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3379 " refresh the directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3380 let curline= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3381 " call Decho("refresh the directory")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3382 call s:NetRefresh(s:LocalBrowseChgDir(b:netrw_curdir,'./'),1)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3383 exe curline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3384
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3385 " call Dret("LocalBrowseRm")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3386 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3387
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3388 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3389 " LocalBrowseRename: rename a remote file or directory {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3390 fun! s:LocalBrowseRename(path) range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3391 " call Dfunc("LocalBrowseRename(path<".a:path.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3392
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3393 " preparation for removing multiple files/directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3394 let ctr= a:firstline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3395
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3396 " attempt to rename files/directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3397 while ctr <= a:lastline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3398 exe "keepjumps ".ctr
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3399
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3400 " sanity checks
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3401 if line(".") < w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3402 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3403 continue
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3404 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3405 let curword= s:NetGetWord()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3406 if curword == "./" || curword == "../"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3407 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3408 continue
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3409 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3410
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3411 norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3412 let oldname= a:path."/".curword
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3413 " call Decho("oldname<".oldname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3414
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3415 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3416 let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3417 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3418
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3419 let ret= rename(oldname,newname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3420 " call Decho("renaming <".oldname."> to <".newname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3421
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3422 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3423 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3424
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3425 " refresh the directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3426 let curline= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3427 " call Decho("refresh the directory listing")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3428 call s:NetRefresh(s:LocalBrowseChgDir(b:netrw_curdir,'./'),1)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3429 exe "keepjumps ".curline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3430 " call Dret("LocalBrowseRename")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3431 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3432
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3433 " ---------------------------------------------------------------------
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3434 " LocalFastBrowser: handles setting up/taking down fast browsing for the {{{2
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3435 " local browser
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3436 fun! s:LocalFastBrowser()
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3437 " call Dfunc("LocalFastBrowser()")
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3438
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3439 " initialize browselist, a list of buffer numbers that the local browser has used
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3440 if !exists("s:netrw_browselist")
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3441 let s:netrw_browselist= []
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3442 endif
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3443
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3444 " append current buffer to fastbrowse list
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3445 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
3446 call add(s:netrw_browselist,bufnr("%"))
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3447 " call Decho("browselist=".string(s:netrw_browselist))
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 " enable autocmd events to handle refreshing/removing local browser buffers
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3451 " If local browse buffer is currently showing: refresh it
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3452 " If local browse buffer is currently hidden : wipe it
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3453 if !exists("s:netrw_browser_shellcmd") && g:netrw_fastbrowse <= 1
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3454 " call Decho("setting up local-browser shell command refresh")
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3455 let s:netrw_browser_shellcmd= 1
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3456 augroup AuNetrwShellCmd
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3457 au!
842
a209672376fd updated for version 7.0f
vimboss
parents: 841
diff changeset
3458 if (has("win32") || has("win95") || has("win64") || has("win16"))
a209672376fd updated for version 7.0f
vimboss
parents: 841
diff changeset
3459 au ShellCmdPost * call s:LocalBrowseShellCmdRefresh()
a209672376fd updated for version 7.0f
vimboss
parents: 841
diff changeset
3460 else
a209672376fd updated for version 7.0f
vimboss
parents: 841
diff changeset
3461 au ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh()
a209672376fd updated for version 7.0f
vimboss
parents: 841
diff changeset
3462 endif
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3463 augroup END
820
57c7403f6599 updated for version 7.0c11
vimboss
parents: 819
diff changeset
3464 endif
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3465
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3466 " user must have changed fastbrowse to its fast setting, so remove
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3467 " the associated autocmd events
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3468 if g:netrw_fastbrowse > 1 && exists("s:netrw_browser_shellcmd")
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3469 unlet s:netrw_browser_shellcmd
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3470 augroup AuNetrwShellCmd
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3471 au!
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3472 augroup END
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3473 augroup! AuNetrwShellCmd
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3474 endif
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3475
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3476 " call Dret("LocalFastBrowser")
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3477 endfun
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3478
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
3479 " ---------------------------------------------------------------------
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3480 " LocalObtain: copy selected file to current working directory {{{2
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3481 fun! s:LocalObtain()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3482 " call Dfunc("LocalObtain()")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3483 if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3484 let fname= expand("<cWORD>")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3485 let fcopy= readfile(b:netrw_curdir."/".fname,"b")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3486 call writefile(fcopy,getcwd()."/".fname,"b")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3487 elseif !exists("b:netrw_curdir")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3488 echohl Error | echo "***netrw*** local browsing directory doesn't exist!"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3489 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3490 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3491 echohl Error | echo "***netrw*** local browsing directory and current directory are identical"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3492 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3493 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3494 " call Dret("LocalObtain")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3495 endfun
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3496
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3497 " ---------------------------------------------------------------------
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3498 " LocalPreview: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3499 fun! s:LocalPreview(path) range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3500 " call Dfunc("LocalPreview(path<".a:path.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3501 if has("quickfix")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3502 if !isdirectory(a:path)
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
3503 exe "pedit ".escape(a:path,g:netrw_fname_escape)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3504 elseif !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3505 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
3506 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3507 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3508 elseif !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3509 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
3510 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3511 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3512 " call Dret("LocalPreview")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3513 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3514
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3515 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3516 " Explore: launch the local browser in the directory of the current file {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3517 " dosplit==0: the window will be split iff the current file has
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3518 " been modified
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3519 " dosplit==1: the window will be split before running the local
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3520 " browser
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3521 fun! netrw#Explore(indx,dosplit,style,...)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3522 " call Dfunc("Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3523
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3524 " if dosplit or file has been modified
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3525 if a:dosplit || &modified
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3526 call s:SaveWinVars()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3527
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3528 if a:style == 0 " Explore, Sexplore
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3529 exe g:netrw_winsize."wincmd s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3530 " call Decho("style=0: Explore or Sexplore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3531
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3532 elseif a:style == 1 "Explore!, Sexplore!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3533 exe g:netrw_winsize."wincmd v"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3534 " call Decho("style=1: Explore! or Sexplore!")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3535
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3536 elseif a:style == 2 " Hexplore
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3537 exe "bel ".g:netrw_winsize."wincmd s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3538 " call Decho("style=2: Hexplore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3539
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3540 elseif a:style == 3 " Hexplore!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3541 exe "abo ".g:netrw_winsize."wincmd s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3542 " call Decho("style=3: Hexplore!")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3543
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3544 elseif a:style == 4 " Vexplore
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3545 exe "lefta ".g:netrw_winsize."wincmd v"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3546 " call Decho("style=4: Vexplore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3547
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3548 elseif a:style == 5 " Vexplore!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3549 exe "rightb ".g:netrw_winsize."wincmd v"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3550 " call Decho("style=5: Vexplore!")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3551 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3552 call s:CopyWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3553 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3554 norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3555
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3556 if a:1 =~ '^\*/'
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3557 " Explore */pattern
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3558 let pattern= substitute(a:1,'^\*/\(.*\)$','\1','')
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3559 " call Decho("Explore */pat: a:1<".a:1."> -> pattern<".pattern.">")
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3560 elseif a:1 =~ '^\*\*//'
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3561 " Explore **//pattern
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3562 let pattern = substitute(a:1,'^\*\*//','','')
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3563 let starstarpat = 1
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3564 " call Decho("Explore **//pat: a:1<".a:1."> -> pattern<".pattern.">")
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3565 endif
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3566
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3567 if a:1 == "" && a:indx >= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3568 " Explore Hexplore Vexplore Sexplore
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3569 " call Decho("Explore Hexplore Vexplore Sexplore")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3570 let newdir= substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3571 if newdir =~ '^scp:' || newdir =~ '^ftp:'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3572 " call Decho("calling NetBrowse(newdir<".newdir.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3573 call s:NetBrowse(newdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3574 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3575 if newdir == ""|let newdir= getcwd()|endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3576 " call Decho("calling LocalBrowse(newdir<".newdir.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3577 call s:LocalBrowse(newdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3578 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3579
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3580 elseif a:1 =~ '^\*\*/' || a:indx < 0 || a:1 =~ '^\*/'
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3581 " Nexplore, Pexplore, Explore **/... , or Explore */pattern
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3582 " call Decho("Nexplore, Pexplore, <s-down>, <s-up>, Explore ".a:1)
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3583 let s:didstarstar= 1
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3584 if exists("b:netrw_curdir")
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3585 nnoremap <buffer> <silent> <s-up> :Pexplore<cr>
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3586 nnoremap <buffer> <silent> <s-down> :Nexplore<cr>
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3587 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3588
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3589 if has("path_extra")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3590 if !exists("w:netrw_explore_indx")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3591 let w:netrw_explore_indx= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3592 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3593 let indx = a:indx
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3594 " call Decho("set indx=".indx)
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3595 "
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3596 if indx == -1
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3597 "Nexplore
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3598 if !exists("w:netrw_explore_list") " sanity check
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3599 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
3600 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3601 " call Dret("Explore")
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3602 return
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3603 endif
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3604 let indx = w:netrw_explore_indx
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3605 let curfile= w:netrw_explore_list[indx]
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3606 while indx < w:netrw_explore_listlen && curfile == w:netrw_explore_list[indx]
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3607 let indx= indx + 1
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3608 " call Decho("indx=".indx)
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3609 endwhile
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3610 " 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
3611
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3612 elseif indx == -2
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3613 "Pexplore
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3614 if !exists("w:netrw_explore_list") " sanity check
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3615 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
3616 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3617 " call Dret("Explore")
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3618 return
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3619 endif
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3620 let indx = w:netrw_explore_indx
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3621 let curfile= w:netrw_explore_list[indx]
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3622 while indx > 0 && curfile == w:netrw_explore_list[indx]
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3623 let indx= indx - 1
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3624 endwhile
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3625 " 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
3626
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3627 else
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3628 " Explore -- initialize
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3629 " build list of files to Explore with Nexplore/Pexplore
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3630 " call Decho("Explore -- initialize")
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3631 let w:netrw_explore_indx= 0
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3632 if !exists("b:netrw_curdir")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3633 let b:netrw_curdir= getcwd()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3634 endif
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3635 " call Decho("b:netrw_curdir<".b:netrw_curdir.">")
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3636 if exists("pattern")
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3637 " call Decho("building list based on pattern<".pattern."> cwd<".getcwd().">")
841
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3638 if exists("starstarpat")
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3639 exe "vimgrep /".pattern."/gj "."**/*"
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3640 let s:netrw_curdir= b:netrw_curdir
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3641 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
3642 else
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3643 exe "vimgrep /".pattern."/gj ".b:netrw_curdir."/*"
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3644 if (has("win32") || has("win95") || has("win64") || has("win16"))
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3645 let w:netrw_explore_list = map(getqflist(),'bufname(v:val.bufnr)')
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3646 else
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3647 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
3648 endif
c2cae213194d updated for version 7.0e07
vimboss
parents: 839
diff changeset
3649 endif
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3650 else
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3651 " call Decho("building list based on ".b:netrw_curdir."/".a:1)
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3652 let w:netrw_explore_list= split(expand(b:netrw_curdir."/".a:1),'\n')
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3653 endif
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3654
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3655 let w:netrw_explore_listlen = len(w:netrw_explore_list)
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
3656 " 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
3657
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3658 if w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3659 echohl WarningMsg | echo "***netrw*** no files matched" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3660 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3661 " call Dret("Explore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3662 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3663 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3664 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3665
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3666 " NetrwStatusLine support - for exploring support
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3667 let w:netrw_explore_indx= indx
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3668 " call Decho("explorelist<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3669
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3670 " sanity check
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3671 if indx >= w:netrw_explore_listlen || indx < 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3672 let indx= (indx < 0)? 0 : ( w:netrw_explore_listlen - 1 )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3673 echohl WarningMsg | echo "***netrw*** no more files match Explore pattern" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3674 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3675 " call Dret("Explore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3676 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3677 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3678
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3679 exe "let dirfile= w:netrw_explore_list[".indx."]"
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3680 " call Decho("dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3681 let newdir= substitute(dirfile,'/[^/]*$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3682 " call Decho("newdir<".newdir.">")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3683
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3684 " call Decho("calling LocalBrowse(newdir<".newdir.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3685 call s:LocalBrowse(newdir)
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3686 if w:netrw_longlist == 0 || w:netrw_longlist == 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3687 call search('^'.substitute(dirfile,"^.*/","","").'\>',"W")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3688 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3689 call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3690 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3691 let w:netrw_explore_mtchcnt = indx + 1
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3692 let w:netrw_explore_bufnr = bufnr("%")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3693 let w:netrw_explore_line = line(".")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3694 call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3695 " 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
3696
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3697 else
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3698 if !exists("g:netrw_quiet")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3699 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
3700 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3701 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3702 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3703
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3704 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3705 " call Decho("Explore newdir<".a:1.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3706 let newdir= a:1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3707 call s:LocalBrowse(newdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3708 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3709
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3710 " call Dret("Explore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3711 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3712
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3713 " ---------------------------------------------------------------------
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3714 " SetupNetrwStatusLine: {{{2
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3715 fun! s:SetupNetrwStatusLine(statline)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3716 " call Dfunc("SetupNetrwStatusLine(statline<".a:statline.">)")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3717
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3718 if !exists("s:netrw_setup_statline")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3719 let s:netrw_setup_statline= 1
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3720 " call Decho("do first-time status line setup")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3721
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3722 if !exists("s:netrw_users_stl")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3723 let s:netrw_users_stl= &stl
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3724 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3725 if !exists("s:netrw_users_ls")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3726 let s:netrw_users_ls= &laststatus
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3727 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3728
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3729 " set up User9 highlighting as needed
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3730 let keepa= @a
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3731 redir @a
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3732 try
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3733 hi User9
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3734 catch /^Vim\%((\a\+)\)\=:E411/
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3735 if &bg == "dark"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3736 hi User9 ctermfg=yellow ctermbg=blue guifg=yellow guibg=blue
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3737 else
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3738 hi User9 ctermbg=yellow ctermfg=blue guibg=yellow guifg=blue
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3739 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3740 endtry
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3741 redir END
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3742 let @a= keepa
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3743 endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3744
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3745 " set up status line (may use User9 highlighting)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3746 " insure that windows have a statusline
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3747 " make sure statusline is displayed
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3748 let &stl=a:statline
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3749 set laststatus=2
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3750 " call Decho("stl=".&stl)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3751 redraw!
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3752
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3753 " call Dret("SetupNetrwStatusLine : stl=".&stl)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3754 endfun
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3755
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3756 " ---------------------------------------------------------------------
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3757 " NetrwStatusLine: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3758 fun! NetrwStatusLine()
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3759
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3760 " vvv NetrwStatusLine() debugging vvv
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3761 " let g:stlmsg=""
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3762 " if !exists("w:netrw_explore_bufnr")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3763 " let g:stlmsg="!X<explore_bufnr>"
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3764 " elseif w:netrw_explore_bufnr != bufnr("%")
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3765 " let g:stlmsg="explore_bufnr!=".bufnr("%")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3766 " endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3767 " if !exists("w:netrw_explore_line")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3768 " let g:stlmsg=" !X<explore_line>"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3769 " elseif w:netrw_explore_line != line(".")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3770 " let g:stlmsg=" explore_line!={line(.)<".line(".").">"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3771 " endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3772 " if !exists("w:netrw_explore_list")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3773 " let g:stlmsg=" !X<explore_list>"
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3774 " endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3775 " ^^^ NetrwStatusLine() debugging ^^^
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3776
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 719
diff changeset
3777 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
3778 " restore user's status line
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3779 let &stl = s:netrw_users_stl
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3780 let &laststatus = s:netrw_users_ls
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3781 if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3782 if exists("w:netrw_explore_line")|unlet w:netrw_explore_line|endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3783 return ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3784 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3785 return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3786 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3787 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3788
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3789 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3790 " NetGetcwd: get the current directory. {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3791 " Change backslashes to forward slashes, if any.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3792 " If doesc is true, escape certain troublesome characters
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3793 fun! s:NetGetcwd(doesc)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3794 " call Dfunc("NetGetcwd(doesc=".a:doesc.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3795 let curdir= substitute(getcwd(),'\\','/','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3796 if curdir !~ '[\/]$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3797 let curdir= curdir.'/'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3798 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3799 if a:doesc
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3800 let curdir= escape(curdir,s:netrw_cd_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3801 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3802 " call Dret("NetGetcwd <".curdir.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3803 return curdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3804 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3805
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3806 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
3807 " NetMethod: determine method of transfer {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3808 " method == 1: rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3809 " 2: ftp + <.netrc>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3810 " 3: ftp + machine, id, password, and [path]filename
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3811 " 4: scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3812 " 5: http (wget)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3813 " 6: cadaver
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3814 " 7: rsync
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3815 " 8: fetch
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3816 " 9: sftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3817 fun! s:NetMethod(choice) " globals: method machine id passwd fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3818 " call Dfunc("NetMethod(a:choice<".a:choice.">)")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3819
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3820 " initialization
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3821 let b:netrw_method = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3822 let g:netrw_machine = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3823 let b:netrw_fname = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3824 let g:netrw_port = ""
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3825 let g:netrw_choice = a:choice
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3826
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3827 " Patterns:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3828 " mipf : a:machine a:id password filename Use ftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3829 " mf : a:machine filename Use ftp + <.netrc> or g:netrw_uid g:netrw_passwd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3830 " 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
3831 " rcpurm : rcp://[user@]host/filename Use rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3832 " rcphf : [user@]host:filename Use rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3833 " scpurm : scp://[user@]host[[#:]port]/filename Use scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3834 " httpurm : http://[user@]host/filename Use wget
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3835 " davurm : [s]dav://host[:port]/path Use cadaver
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3836 " rsyncurm : rsync://host[:port]/path Use rsync
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3837 " fetchurm : fetch://[user@]host[:http]/filename Use fetch (defaults to ftp, override for http)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3838 " sftpurm : sftp://[user@]host/filename Use scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3839 let mipf = '^\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3840 let mf = '^\(\S\+\)\s\+\(\S\+\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3841 let ftpurm = '^ftp://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3842 let rcpurm = '^rcp://\%(\([^/@]\{-}\)@\)\=\([^/]\{-}\)/\(.*\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3843 let rcphf = '^\(\(\h\w*\)@\)\=\(\h\w*\):\([^@]\+\)$'
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
3844 let scpurm = '^scp://\([^/#:]\+\)\%([#:]\(\d\+\)\)\=/\(.*\)$'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3845 let httpurm = '^http://\([^/]\{-}\)\(/.*\)\=$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3846 let davurm = '^s\=dav://\([^/]\+\)/\(.*/\)\([-_.~[:alnum:]]\+\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3847 let rsyncurm = '^rsync://\([^/]\{-}\)/\(.*\)\=$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3848 let fetchurm = '^fetch://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3849 let sftpurm = '^sftp://\([^/]\{-}\)/\(.*\)\=$'
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3850
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3851 " call Decho("determine method:")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3852 " Determine Method
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3853 " rcp://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3854 if match(a:choice,rcpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3855 " call Decho("rcp://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3856 let b:netrw_method = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3857 let userid = substitute(a:choice,rcpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3858 let g:netrw_machine = substitute(a:choice,rcpurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3859 let b:netrw_fname = substitute(a:choice,rcpurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3860 if userid != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3861 let g:netrw_uid= userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3862 endif
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 " scp://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3865 elseif match(a:choice,scpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3866 " call Decho("scp://...")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3867 let b:netrw_method = 4
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3868 let g:netrw_machine = substitute(a:choice,scpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3869 let g:netrw_port = substitute(a:choice,scpurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3870 let b:netrw_fname = substitute(a:choice,scpurm,'\3',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3871
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3872 " http://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3873 elseif match(a:choice,httpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3874 " call Decho("http://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3875 let b:netrw_method = 5
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3876 let g:netrw_machine= substitute(a:choice,httpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3877 let b:netrw_fname = substitute(a:choice,httpurm,'\2',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3878
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3879 " dav://hostname[:port]/..path-to-file..
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3880 elseif match(a:choice,davurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3881 " call Decho("dav://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3882 let b:netrw_method= 6
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3883 if a:choice =~ '^s'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3884 let g:netrw_machine= 'https://'.substitute(a:choice,davurm,'\1/\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3885 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3886 let g:netrw_machine= 'http://'.substitute(a:choice,davurm,'\1/\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3887 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3888 let b:netrw_fname = substitute(a:choice,davurm,'\3',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3889
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3890 " rsync://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3891 elseif match(a:choice,rsyncurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3892 " call Decho("rsync://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3893 let b:netrw_method = 7
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3894 let g:netrw_machine= substitute(a:choice,rsyncurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3895 let b:netrw_fname = substitute(a:choice,rsyncurm,'\2',"")
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 " ftp://[user@]hostname[[:#]port]/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3898 elseif match(a:choice,ftpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3899 " call Decho("ftp://...")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3900 let userid = substitute(a:choice,ftpurm,'\2',"")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3901 let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3902 let g:netrw_port = substitute(a:choice,ftpurm,'\4',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3903 let b:netrw_fname = substitute(a:choice,ftpurm,'\5',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3904 if userid != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3905 let g:netrw_uid= userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3906 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3907 if exists("g:netrw_uid") && exists("g:netrw_passwd")
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 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3910 if filereadable(expand("$HOME/.netrc")) && !exists("g:netrw_ignorenetrc")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3911 let b:netrw_method= 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3912 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3913 if !exists("g:netrw_uid") || g:netrw_uid == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3914 call NetUserPass()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3915 elseif !exists("g:netrw_passwd") || g:netrw_passwd == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3916 call NetUserPass(g:netrw_uid)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3917 " else just use current g:netrw_uid and g:netrw_passwd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3918 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3919 let b:netrw_method= 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3920 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3921 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3922
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3923 elseif match(a:choice,fetchurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3924 " call Decho("fetch://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3925 let b:netrw_method = 8
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3926 let g:netrw_userid = substitute(a:choice,fetchurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3927 let g:netrw_machine= substitute(a:choice,fetchurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3928 let b:netrw_option = substitute(a:choice,fetchurm,'\4',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3929 let b:netrw_fname = substitute(a:choice,fetchurm,'\5',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3930
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3931 " Issue an ftp : "machine id password [path/]filename"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3932 elseif match(a:choice,mipf) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3933 " call Decho("(ftp) host id pass file")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3934 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3935 let g:netrw_machine = substitute(a:choice,mipf,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3936 let g:netrw_uid = substitute(a:choice,mipf,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3937 let g:netrw_passwd = substitute(a:choice,mipf,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3938 let b:netrw_fname = substitute(a:choice,mipf,'\4',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3939
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3940 " Issue an ftp: "hostname [path/]filename"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3941 elseif match(a:choice,mf) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3942 " call Decho("(ftp) host file")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3943 if exists("g:netrw_uid") && exists("g:netrw_passwd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3944 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3945 let g:netrw_machine = substitute(a:choice,mf,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3946 let b:netrw_fname = substitute(a:choice,mf,'\2',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3947
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3948 elseif filereadable(expand("$HOME/.netrc"))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3949 let b:netrw_method = 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3950 let g:netrw_machine = substitute(a:choice,mf,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3951 let b:netrw_fname = substitute(a:choice,mf,'\2',"")
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 " sftp://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3955 elseif match(a:choice,sftpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3956 " call Decho("sftp://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3957 let b:netrw_method = 9
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3958 let g:netrw_machine= substitute(a:choice,sftpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3959 let b:netrw_fname = substitute(a:choice,sftpurm,'\2',"")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3960
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3961 " Issue an rcp: hostname:filename" (this one should be last)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3962 elseif match(a:choice,rcphf) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3963 " call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3964 let b:netrw_method = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3965 let userid = substitute(a:choice,rcphf,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3966 let g:netrw_machine= substitute(a:choice,rcphf,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3967 let b:netrw_fname = substitute(a:choice,rcphf,'\4',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3968 " call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3969 " call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3970 " call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3971 " call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3972 if userid != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3973 let g:netrw_uid= userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3974 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3975 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3976 " don't let PCs try <.netrc>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3977 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3978 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3979
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3980 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3981 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3982 echohl Error | echo "***netrw*** cannot determine method" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3983 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3984 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3985 let b:netrw_method = -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3986 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3987
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3988 " remove any leading [:#] from port number
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3989 if g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3990 let g:netrw_port = substitute(g:netrw_port,'[#:]\+','','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3991 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
3992
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3993 " call Decho("a:choice <".a:choice.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3994 " call Decho("b:netrw_method <".b:netrw_method.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3995 " call Decho("g:netrw_machine<".g:netrw_machine.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3996 " call Decho("g:netrw_port <".g:netrw_port.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3997 " if exists("g:netrw_uid") "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3998 " call Decho("g:netrw_uid <".g:netrw_uid.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3999 " endif "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4000 " if exists("g:netrw_passwd") "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4001 " call Decho("g:netrw_passwd <".g:netrw_passwd.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4002 " endif "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4003 " call Decho("b:netrw_fname <".b:netrw_fname.">")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4004 " call Dret("NetMethod : b:netrw_method=".b:netrw_method)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4005 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4006
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4007 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4008 " NetUserPass: set username and password for subsequent ftp transfer {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4009 " Usage: :call NetUserPass() -- will prompt for userid and password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4010 " :call NetUserPass("uid") -- will prompt for password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4011 " :call NetUserPass("uid","password") -- sets global userid and password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4012 fun! NetUserPass(...)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4013
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4014 " get/set userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4015 if a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4016 " call Dfunc("NetUserPass(a:0<".a:0.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4017 if !exists("g:netrw_uid") || g:netrw_uid == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4018 " via prompt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4019 let g:netrw_uid= input('Enter username: ')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4020 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4021 else " from command line
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4022 " call Dfunc("NetUserPass(a:1<".a:1.">) {")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4023 let g:netrw_uid= a:1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4024 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4025
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4026 " get password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4027 if a:0 <= 1 " via prompt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4028 " call Decho("a:0=".a:0." case <=1:")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4029 let g:netrw_passwd= inputsecret("Enter Password: ")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4030 else " from command line
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4031 " call Decho("a:0=".a:0." case >1: a:2<".a:2.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4032 let g:netrw_passwd=a:2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4033 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4034
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4035 " call Dret("NetUserPass")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4036 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4037
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4038 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4039 " NetOptionSave: save options and set to "standard" form {{{2
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4040 fun! s:NetOptionSave()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4041 " call Dfunc("NetOptionSave()")
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4042 if !exists("w:netoptionsave")
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4043 let w:netoptionsave= 1
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4044 else
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4045 " call Dret("NetOptionSave : netoptionsave=".w:netoptionsave)
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4046 return
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4047 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4048
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4049 " Get Temporary Filename
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
4050 if exists("&acd")
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
4051 let w:acdkeep = &acd
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
4052 endif
839
1f3b1021f002 updated for version 7.0e05
vimboss
parents: 829
diff changeset
4053 let w:aikeep = &ai
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4054 let w:fokeep = &fo
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4055 let w:cikeep = &ci
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4056 let w:cinkeep = &cin
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4057 let w:cinokeep = &cino
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4058 let w:comkeep = &com
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4059 let w:cpokeep = &cpo
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
4060 let w:hidkeep = &hidden
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4061 let w:magickeep = &magic
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
4062 if !g:netrw_keepdir
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
4063 let w:dirkeep = getcwd()
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
4064 endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4065 let w:gdkeep = &gd
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4066 let w:repkeep = &report
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4067 let w:spellkeep = &spell
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4068 let w:twkeep = &tw
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4069 setlocal cino =
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4070 setlocal com =
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4071 setlocal cpo -=aA
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
4072 if exists("&acd")
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
4073 setlocal noacd nocin noai noci magic nospell fo=nroql2 nohid
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
4074 else
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
4075 setlocal nocin noai noci magic nospell fo=nroql2 nohid
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
4076 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4077 setlocal tw =0
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4078 setlocal report=10000
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4079 if has("win32") && !has("win95")
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4080 let w:swfkeep= &swf
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4081 setlocal noswf
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4082 " call Decho("setting w:swfkeep to <".&swf.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4083 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4084
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4085 " call Dret("NetOptionSave")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4086 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4087
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4088 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4089 " NetOptionRestore: restore options {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4090 fun! s:NetOptionRestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4091 " call Dfunc("NetOptionRestore()")
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4092 if !exists("w:netoptionsave")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
4093 " call Dret("NetOptionRestore : w:netoptionsave doesn't exist")
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4094 return
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4095 endif
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4096 unlet w:netoptionsave
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4097
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
4098 if exists("&acd")
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
4099 if exists("w:acdkeep") |let &acd = w:acdkeep |unlet w:acdkeep |endif
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
4100 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4101 if exists("w:aikeep") |let &ai = w:aikeep |unlet w:aikeep |endif
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4102 if exists("w:cikeep") |let &ci = w:cikeep |unlet w:cikeep |endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4103 if exists("w:cinkeep") |let &cin = w:cinkeep |unlet w:cinkeep |endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4104 if exists("w:cinokeep") |let &cino = w:cinokeep |unlet w:cinokeep |endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4105 if exists("w:comkeep") |let &com = w:comkeep |unlet w:comkeep |endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4106 if exists("w:cpokeep") |let &cpo = w:cpokeep |unlet w:cpokeep |endif
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 849
diff changeset
4107 if exists("w:dirkeep") |exe "lcd ".w:dirkeep |unlet w:dirkeep |endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4108 if exists("w:fokeep") |let &fo = w:fokeep |unlet w:fokeep |endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4109 if exists("w:gdkeep") |let &gd = w:gdkeep |unlet w:gdkeep |endif
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
4110 if exists("w:hidkeep") |let &hidden = w:hidkeep |unlet w:hidkeep |endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4111 if exists("w:magic") |let &magic = w:magic |unlet w:magic |endif
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4112 if exists("w:repkeep") |let &report = w:repkeep |unlet w:repkeep |endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4113 if exists("w:spellkeep")|let &spell = w:spellkeep |unlet w:spellkeep|endif
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4114 if exists("w:twkeep") |let &tw = w:twkeep |unlet w:twkeep |endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4115 if exists("w:swfkeep")
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4116 if &directory == "" && exists("w:swfkeep")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4117 " user hasn't specified a swapfile directory;
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4118 " netrw will temporarily make the swapfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4119 " directory the current local one.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4120 let &directory = getcwd()
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4121 silent! let &swf = w:swfkeep
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4122 set directory=
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4123 else
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4124 let &swf= w:swfkeep
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4125 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
4126 unlet w:swfkeep
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4127 endif
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4128
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4129 " call Dret("NetOptionRestore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4130 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4131
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4132 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4133 " NetReadFixup: this sort of function is typically written by the user {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4134 " to handle extra junk that their system's ftp dumps
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4135 " into the transfer. This function is provided as an
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4136 " example and as a fix for a Windows 95 problem: in my
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4137 " experience, win95's ftp always dumped four blank lines
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4138 " at the end of the transfer.
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4139 if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4140 fun! NetReadFixup(method, line1, line2)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4141 " call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4142 if method == 3 " ftp (no <.netrc>)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4143 let fourblanklines= line2 - 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4144 silent fourblanklines.",".line2."g/^\s*/d"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4145 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4146 " call Dret("NetReadFixup")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4147 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4148 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4149
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4150 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4151 " NetSort: Piet Delport's BISort2() function, modified to take a range {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4152 if v:version < 700
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4153 fun! s:NetSort() range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4154 " " call Dfunc("NetSort()")
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4155
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4156 let i = a:firstline + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4157 while i <= a:lastline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4158 " find insertion point via binary search
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4159 let i_val = getline(i)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4160 let lo = a:firstline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4161 let hi = i
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4162 while lo < hi
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4163 let mid = (lo + hi) / 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4164 let mid_val = getline(mid)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4165 if g:netrw_sort_direction =~ '^n'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4166 " normal sorting order
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4167 if i_val < mid_val
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4168 let hi = mid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4169 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4170 let lo = mid + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4171 if i_val == mid_val | break | endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4172 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4173 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4174 " reverse sorting order
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4175 if i_val > mid_val
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4176 let hi = mid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4177 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4178 let lo = mid + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4179 if i_val == mid_val | break | endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4180 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4181 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4182 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4183 " do insert
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4184 if lo < i
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4185 exe 'keepjumps '.i.'d_'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4186 keepjumps call append(lo - 1, i_val)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4187 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4188 let i = i + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4189 endwhile
719
82ef0c58b012 updated for version 7.0219
vimboss
parents: 650
diff changeset
4190
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4191 " " call Dret("NetSort")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4192 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4193 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4194
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4195 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4196 " SetSort: sets up the sort based on the g:netrw_sort_sequence {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4197 " What this function does is to compute a priority for the patterns
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4198 " in the g:netrw_sort_sequence. It applies a substitute to any
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4199 " "files" that satisfy each pattern, putting the priority / in
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4200 " front. An "*" pattern handles the default priority.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4201 fun! s:SetSort()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4202 " call Dfunc("SetSort() bannercnt=".w:netrw_bannercnt)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
4203 if w:netrw_longlist == 1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4204 let seqlist = substitute(g:netrw_sort_sequence,'\$','\\%(\t\\|\$\\)','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4205 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4206 let seqlist = g:netrw_sort_sequence
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4207 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4208 " sanity check -- insure that * appears somewhere
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4209 if seqlist == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4210 let seqlist= '*'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4211 elseif seqlist !~ '\*'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4212 let seqlist= seqlist.',*'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4213 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4214 let priority = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4215 while seqlist != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4216 if seqlist =~ ','
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4217 let seq = substitute(seqlist,',.*$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4218 let seqlist = substitute(seqlist,'^.\{-},\(.*\)$','\1','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4219 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4220 let seq = seqlist
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4221 let seqlist = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4222 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4223 let eseq= escape(seq,'/')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4224 if priority < 10
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4225 let spriority= "00".priority.'\/'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4226 elseif priority < 100
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4227 let spriority= "0".priority.'\/'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4228 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4229 let spriority= priority.'\/'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4230 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4231 " call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4232
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4233 " sanity check
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4234 if w:netrw_bannercnt > line("$")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4235 " apparently no files were left after a Hiding pattern was used
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4236 " call Dret("SetSort : no files left after hiding")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4237 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4238 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4239 if seq == '*'
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4240 exe 'silent keepjumps '.w:netrw_bannercnt.',$v/^\d\{3}\//s/^/'.spriority.'/'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4241 else
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4242 exe 'silent keepjumps '.w:netrw_bannercnt.',$g/'.eseq.'/s/^/'.spriority.'/'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4243 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4244 let priority = priority + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4245 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4246
828
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
4247 " Following line associated with priority -- items that satisfy a priority
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
4248 " pattern get prefixed by ###/ which permits easy sorting by priority.
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
4249 " Sometimes files can satisfy multiple priority patterns -- only the latest
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
4250 " priority pattern needs to be retained. So, at this point, these excess
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
4251 " priority prefixes need to be removed, but not directories that happen to
01583c79d5f4 updated for version 7.0d03
vimboss
parents: 820
diff changeset
4252 " be just digits themselves.
820
57c7403f6599 updated for version 7.0c11
vimboss
parents: 819
diff changeset
4253 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
4254
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4255 " call Dret("SetSort")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4256 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4257
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4258 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4259 " SaveWinVars: (used by Explore()) {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4260 fun! s:SaveWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4261 " call Dfunc("SaveWinVars()")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4262 if exists("w:netrw_bannercnt") |let s:bannercnt = w:netrw_bannercnt |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4263 if exists("w:netrw_method") |let s:method = w:netrw_method |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4264 if exists("w:netrw_prvdir") |let s:prvdir = w:netrw_prvdir |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4265 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
4266 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
4267 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
4268 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
4269 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
4270 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
4271 " call Dret("SaveWinVars")
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 " CopyWinVars: (used by Explore()) {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4276 fun! s:CopyWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4277 " call Dfunc("CopyWinVars()")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4278 if exists("s:bannercnt") |let w:netrw_bannercnt = s:bannercnt |unlet s:bannercnt |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4279 if exists("s:method") |let w:netrw_method = s:method |unlet s:method |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4280 if exists("s:prvdir") |let w:netrw_prvdir = s:prvdir |unlet s:prvdir |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4281 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
4282 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
4283 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
4284 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
4285 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
4286 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
4287 " call Dret("CopyWinVars")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4288 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4289
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4290 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4291 " SetBufWinVars: (used by NetBrowse() and LocalBrowse()) {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4292 " To allow separate windows to have their own activities, such as
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4293 " Explore **/pattern, several variables have been made window-oriented.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4294 " 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
4295 " variables are not inherited by the new window. SetBufWinVars() and
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4296 " UseBufWinVars() get around that.
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4297 fun! s:SetBufWinVars()
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4298 " call Dfunc("SetBufWinVars()")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
4299 if exists("w:netrw_longlist") |let b:netrw_longlist = w:netrw_longlist |endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4300 if exists("w:netrw_bannercnt") |let b:netrw_bannercnt = w:netrw_bannercnt |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4301 if exists("w:netrw_method") |let b:netrw_method = w:netrw_method |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4302 if exists("w:netrw_prvdir") |let b:netrw_prvdir = w:netrw_prvdir |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4303 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
4304 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
4305 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
4306 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
4307 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
4308 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
4309 " call Dret("SetBufWinVars")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4310 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4311
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4312 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4313 " UseBufWinVars: (used by NetBrowse() and LocalBrowse() {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4314 " Matching function to BufferWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4315 fun! s:UseBufWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4316 " call Dfunc("UseBufWinVars()")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
4317 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
4318 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
4319 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
4320 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
4321 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
4322 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
4323 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
4324 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
4325 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
4326 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
4327 " call Dret("UseBufWinVars")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4328 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4329
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4330 " ---------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4331 " RFC2396: converts %xx into characters {{{2
559
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4332 fun! netrw#RFC2396(fname)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4333 " call Dfunc("RFC2396(fname<".a:fname.">)")
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4334 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
4335 " call Dret("RFC2396 ".fname)
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4336 return fname
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4337 endfun
8ec588470508 updated for version 7.0159
vimboss
parents: 557
diff changeset
4338
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4339 " ------------------------------------------------------------------------
650
662e40bd2be1 updated for version 7.0191
vimboss
parents: 615
diff changeset
4340 " Settings Restoration: {{{2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4341 let &cpo= s:keepcpo
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4342 unlet s:keepcpo
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4343
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4344 " ------------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4345 " Modelines: {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
4346 " vim:ts=8 fdm=marker