annotate runtime/autoload/netrw.vim @ 534:c6296b0ad9ea v7.0151

updated for version 7.0151
author vimboss
date Thu, 29 Sep 2005 18:26:07 +0000
parents 7052f11a3dc9
children 917c4fda217f
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
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3 " Date: Sep 29, 2005
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
4 " Version: 72
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,
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
11 " netrw.vim, netrwPlugin.vim, and netrwSettings.vim are provided
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
12 " *as is* and comes with no warranty of any kind, either
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
13 " expressed or implied. By using this plugin, you agree that
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
14 " in no event will the copyright holder be liable for any damages
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
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 " =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
21
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
22 " Exception for &cp: {{{1
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
23 if &cp || exists("g:loaded_netrw")
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
24 finish
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
25 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
26 if v:version < 700
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
27 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
28 finish
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
29 endif
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
30 let g:loaded_netrw = "v72"
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
31 let s:keepcpo = &cpo
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
32 set cpo&vim
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
33 " call Decho("doing autoload/netrw.vim")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
34
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
35 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
36 " Default values for global netrw variables {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
37 if !exists("g:netrw_ftpmode")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
38 let g:netrw_ftpmode= "binary"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
39 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
40 if !exists("g:netrw_win95ftp")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
41 let g:netrw_win95ftp= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
42 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
43 if !exists("g:netrw_cygwin")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
44 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
45 if &shell == "bash"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
46 let g:netrw_cygwin= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
47 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
48 let g:netrw_cygwin= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
49 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
50 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
51 let g:netrw_cygwin= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
52 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
53 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
54 if !exists("g:netrw_list_cmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
55 if executable("ssh")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
56 " provide a default listing command
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
57 let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
58 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
59 " call Decho("ssh is not executable, can't do remote directory exploring with ssh")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
60 let g:netrw_list_cmd= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
61 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
62 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
63 if !exists("g:netrw_ftp_list_cmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
64 if has("unix") || exists("g:netrw_cygwin")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
65 let g:netrw_ftp_list_cmd= "ls -lF"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
66 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
67 let g:netrw_ftp_list_cmd= "dir"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
68 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
69 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
70 if !exists("g:netrw_rm_cmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
71 let g:netrw_rm_cmd = "ssh HOSTNAME rm"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
72 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
73 if !exists("g:netrw_rmf_cmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
74 let g:netrw_rmf_cmd = "ssh HOSTNAME rm -f"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
75 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
76 if !exists("g:netrw_rmdir_cmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
77 let g:netrw_rmdir_cmd = "ssh HOSTNAME rmdir"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
78 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
79 if !exists("g:netrw_rename_cmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
80 let g:netrw_rename_cmd= "ssh HOSTNAME mv"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
81 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
82 if exists("g:netrw_silent") && g:netrw_silent != 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
83 let g:netrw_silentxfer= "silent "
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
84 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
85 let g:netrw_silentxfer= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
86 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
87 if !exists("g:netrw_winsize")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
88 let g:netrw_winsize= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
89 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
90 if !exists("g:netrw_list_hide")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
91 let g:netrw_list_hide= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
92 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
93 if !exists("g:netrw_sort_by")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
94 " alternatives: date size
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
95 let g:netrw_sort_by= "name"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
96 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
97 if !exists("g:netrw_sort_sequence")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
98 let g:netrw_sort_sequence= '[\/]$,*,\.bak$,\.o$,\.h$,\.info$,\.swp$,\.obj$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
99 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
100 if !exists("g:netrw_sort_direction")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
101 " alternative: reverse (z y x ...)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
102 let g:netrw_sort_direction= "normal"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
103 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
104 if !exists("g:netrw_longlist")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
105 let g:netrw_longlist= 0
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
106 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
107 if g:netrw_longlist == 0 || g:netrw_longlist == 2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
108 let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa"
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_longlist= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
111 let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa -l"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
112 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
113 if !exists("g:netrw_list_cmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
114 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
115 if !exists("g:netrw_timefmt")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
116 let g:netrw_timefmt= "%c"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
117 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
118 if !exists("g:netrw_local_rmdir")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
119 let g:netrw_local_rmdir= "rmdir"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
120 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
121 if !exists("g:netrw_local_mkdir")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
122 let g:netrw_local_mkdir= "mkdir"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
123 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
124 if !exists("g:netrw_mkdir_cmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
125 let g:netrw_mkdir_cmd= "ssh HOSTNAME mkdir"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
126 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
127 if !exists("g:netrw_hide")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
128 let g:netrw_hide= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
129 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
130 if !exists("g:netrw_ftp_browse_reject")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
131 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$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
132 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
133 if !exists("g:netrw_ssh_browse_reject")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
134 let g:netrw_ssh_browse_reject='^total\s\+\d\+$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
135 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
136 if !exists("g:netrw_keepdir")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
137 let g:netrw_keepdir= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
138 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
139 if !exists("s:netrw_cd_escape")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
140 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
141 let s:netrw_cd_escape="#% "
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
142 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
143 let s:netrw_cd_escape="[]#*$%'\" ?`!&();<>\\"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
144 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
145 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
146 if !exists("s:netrw_glob_escape")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
147 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
148 let s:netrw_glob_escape= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
149 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
150 let s:netrw_glob_escape= '[]*?`{~$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
151 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
152 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
153 if !exists("g:netrw_alto")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
154 let g:netrw_alto= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
155 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
156 if !exists("g:netrw_altv")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
157 let g:netrw_altv= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
158 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
159 if !exists("g:netrw_maxfilenamelen")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
160 let g:netrw_maxfilenamelen= 32
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
161 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
162 if !exists("g:netrw_dirhistmax")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
163 let g:netrw_dirhistmax= 10
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
164 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
165 if !exists("g:NETRW_DIRHIST_CNT")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
166 let g:NETRW_DIRHIST_CNT= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
167 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
168
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
169 " BufEnter event ignored by decho when following variable is true
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
170 " Has a side effect that doau BufReadPost doesn't work, so
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
171 " files read by network transfer aren't appropriately highlighted.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
172 "let g:decho_bufenter = 1 "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
173
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
174 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
175 " Default values for global protocol variables {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
176 if !exists("g:netrw_rcp_cmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
177 let g:netrw_rcp_cmd = "rcp"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
178 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
179 if !exists("g:netrw_ftp_cmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
180 let g:netrw_ftp_cmd = "ftp"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
181 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
182 if !exists("g:netrw_scp_cmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
183 let g:netrw_scp_cmd = "scp -q"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
184 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
185 if !exists("g:netrw_sftp_cmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
186 let g:netrw_sftp_cmd = "sftp"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
187 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
188 if !exists("g:netrw_http_cmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
189 if executable("wget")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
190 let g:netrw_http_cmd = "wget -q -O"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
191 elseif executable("fetch")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
192 let g:netrw_http_cmd = "fetch -o"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
193 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
194 let g:netrw_http_cmd = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
195 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
196 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
197 if !exists("g:netrw_dav_cmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
198 let g:netrw_dav_cmd = "cadaver"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
199 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
200 if !exists("g:netrw_rsync_cmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
201 let g:netrw_rsync_cmd = "rsync"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
202 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
203 if !exists("g:netrw_fetch_cmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
204 if executable("fetch")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
205 let g:netrw_fetch_cmd = "fetch -o"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
206 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
207 let g:netrw_fetch_cmd = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
208 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
209 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
210
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
211 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
212 \ && exists("g:netrw_use_nt_rcp")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
213 \ && g:netrw_use_nt_rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
214 \ && executable( $SystemRoot .'/system32/rcp.exe')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
215 let s:netrw_has_nt_rcp = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
216 let s:netrw_rcpmode = '-b'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
217 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
218 let s:netrw_has_nt_rcp = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
219 let s:netrw_rcpmode = ''
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
220 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
221
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
222 " ------------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
223 " NetSavePosn: saves position of cursor on screen {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
224 fun! netrw#NetSavePosn()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
225 " call Dfunc("NetSavePosn()")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
226 " Save current line and column
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
227 let w:netrw_winnr= winnr()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
228 let w:netrw_line = line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
229 let w:netrw_col = virtcol(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
230
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
231 " Save top-of-screen line
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
232 norm! H0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
233 let w:netrw_hline= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
234
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
235 call netrw#NetRestorePosn()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
236 " 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
237 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
238
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
239 " ------------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
240 " NetRestorePosn: restores the cursor and file position as saved by NetSavePosn() {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
241 fun! netrw#NetRestorePosn()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
242 " 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
243 let eikeep= &ei
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
244 set ei=all
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
245
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
246 " restore window
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
247 " call Decho("restore window: exe silent! ".w:netrw_winnr."wincmd w")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
248 exe "silent! ".w:netrw_winnr."wincmd w"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
249 " if v:shell_error == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
250 " " as suggested by Bram M: redraw on no error
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
251 " " allows protocol error messages to remain visible
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
252 " redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
253 " endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
254
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
255 " restore top-of-screen line
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
256 " call Decho("restore topofscreen: exe norm! ".w:netrw_hline."G0z")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
257 exe "norm! ".w:netrw_hline."G0z\<CR>"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
258
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
259 " restore position
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
260 " call Decho("restore posn: exe norm! ".w:netrw_line."G0".w:netrw_col."|")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
261 exe "norm! ".w:netrw_line."G0".w:netrw_col."\<bar>"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
262
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
263 let &ei= eikeep
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
264 " call Dret("NetRestorePosn")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
265 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
266
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
267 " ------------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
268 " NetRead: responsible for reading a file over the net {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
269 fun! netrw#NetRead(...)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
270 " call Dfunc("NetRead(a:1<".a:1.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
271
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
272 " save options
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
273 call s:NetOptionSave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
274
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
275 " Special Exception: if a file is named "0r", then
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
276 " "0r" will be used to read the
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
277 " following files instead of "r"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
278 if a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
279 let readcmd= "r"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
280 let ichoice= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
281 elseif a:1 == "0r"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
282 let readcmd = "0r"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
283 let ichoice = 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
284 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
285 let readcmd = "r"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
286 let ichoice = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
287 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
288
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
289 " get name of a temporary file and set up shell-quoting character
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
290 let tmpfile= tempname()
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
291 let tmpfile= substitute(tmpfile,'\','/','ge')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
292 if !isdirectory(substitute(tmpfile,'[^/]\+$','','e'))
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
293 echohl Error | echo "***netrw*** your <".substitute(tmpfile,'[^/]\+$','','e')."> directory is missing!"
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
294 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
295 " call Dret("NetRead")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
296 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
297 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
298
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
299 " call Decho("ichoice=".ichoice." readcmd<".readcmd.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
300 while ichoice <= a:0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
301
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
302 " attempt to repeat with previous host-file-etc
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
303 if exists("b:netrw_lastfile") && a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
304 " call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
305 let choice = b:netrw_lastfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
306 let ichoice= ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
307
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
308 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
309 exe "let choice= a:" . ichoice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
310 " call Decho("no lastfile: choice<" . choice . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
311
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
312 if match(choice,"?") == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
313 " give help
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
314 echomsg 'NetRead Usage:'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
315 echomsg ':Nread machine:path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
316 echomsg ':Nread "machine path" uses ftp with <.netrc>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
317 echomsg ':Nread "machine id password path" uses ftp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
318 echomsg ':Nread dav://machine[:port]/path uses cadaver'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
319 echomsg ':Nread fetch://machine/path uses fetch'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
320 echomsg ':Nread ftp://[user@]machine[:port]/path uses ftp autodetects <.netrc>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
321 echomsg ':Nread http://[user@]machine/path uses http wget'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
322 echomsg ':Nread rcp://[user@]machine/path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
323 echomsg ':Nread rsync://machine[:port]/path uses rsync'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
324 echomsg ':Nread scp://[user@]machine[[:#]port]/path uses scp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
325 echomsg ':Nread sftp://[user@]machine[[:#]port]/path uses sftp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
326 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
327
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
328 elseif match(choice,"^\"") != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
329 " Reconstruct Choice if choice starts with '"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
330 " call Decho("reconstructing choice")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
331 if match(choice,"\"$") != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
332 " case "..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
333 let choice=strpart(choice,1,strlen(choice)-2)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
334 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
335 " case "... ... ..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
336 let choice = strpart(choice,1,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
337 let wholechoice = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
338
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
339 while match(choice,"\"$") == -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
340 let wholechoice = wholechoice . " " . choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
341 let ichoice = ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
342 if ichoice > a:0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
343 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
344 echohl Error | echo "***netrw*** Unbalanced string in filename '". wholechoice ."'" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
345 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
346 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
347 " call Dret("NetRead")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
348 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
349 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
350 let choice= a:{ichoice}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
351 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
352 let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
353 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
354 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
355 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
356
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
357 " call Decho("choice<" . choice . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
358 let ichoice= ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
359
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
360 " fix up windows urls
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
361 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
362 let choice = substitute(choice,'\\','/','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
363 " call Decho("fixing up windows url to <".choice."> tmpfile<".tmpfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
364
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
365 exe 'lcd ' . fnamemodify(tmpfile,':h')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
366 let tmpfile = fnamemodify(tmpfile,':t')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
367 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
368
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
369 " Determine method of read (ftp, rcp, etc)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
370 call s:NetMethod(choice)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
371
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
372 " Check if NetBrowse() should be handling this request
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
373 " call Decho("checking if netlist: choice<".choice."> netrw_list_cmd<".g:netrw_list_cmd.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
374 if choice =~ "^.*[\/]$"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
375 keepjumps call s:NetBrowse(choice)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
376 " call Dret("NetRead")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
377 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
378 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
379
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
380 " ============
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
381 " Perform Read
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
382 " ============
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
383
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
384 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
385 " rcp: NetRead Method #1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
386 if b:netrw_method == 1 " read with rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
387 " call Decho("read via rcp (method #1)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
388 " ER: noting done with g:netrw_uid yet?
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
389 " ER: on Win2K" rcp machine[.user]:file tmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
390 " ER: if machine contains '.' adding .user is required (use $USERNAME)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
391 " ER: the tmpfile is full path: rcp sees C:\... as host C
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
392 if s:netrw_has_nt_rcp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
393 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
394 let uid_machine = g:netrw_machine .'.'. g:netrw_uid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
395 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
396 " Any way needed it machine contains a '.'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
397 let uid_machine = g:netrw_machine .'.'. $USERNAME
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
398 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
399 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
400 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
401 let uid_machine = g:netrw_uid .'@'. g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
402 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
403 let uid_machine = g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
404 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
405 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
406 " call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".uid_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
407 exe g:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".uid_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
408 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
409 let b:netrw_lastfile = choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
410
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
411 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
412 " ftp + <.netrc>: NetRead Method #2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
413 elseif b:netrw_method == 2 " read with ftp + <.netrc>
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
414 " call Decho("read via ftp+.netrc (method #2)")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
415 let netrw_fname= b:netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
416 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
417 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
418 exe "put ='".g:netrw_ftpmode."'"
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
419 " call Decho("filter input: ".getline("."))
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
420 exe "put ='".'get \"'.netrw_fname.'\" '.tmpfile."'"
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
421 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
422 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
423 " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
424 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
425 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
426 " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
427 exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
428 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
429 " 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
430 if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying '
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
431 let debugkeep= &debug
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
432 set debug=msg
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
433 echohl Error | echo "***netrw*** ".getline(1) | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
434 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
435 let &debug= debugkeep
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
436 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
437 bd!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
438 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
439 let b:netrw_lastfile = choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
440
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
441 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
442 " ftp + machine,id,passwd,filename: NetRead Method #3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
443 elseif b:netrw_method == 3 " read with ftp + machine, id, passwd, and fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
444 " Construct execution string (four lines) which will be passed through filter
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
445 " call Decho("read via ftp+mipf (method #3)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
446 let netrw_fname= b:netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
447 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
448 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
449 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
450 put ='open '.g:netrw_machine.' '.g:netrw_port
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
451 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
452 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
453 put ='open '.g:netrw_machine
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
454 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
455 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
456
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
457 if exists("g:netrw_ftp") && g:netrw_ftp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
458 put =g:netrw_uid
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
459 " call Decho("filter input: ".getline("."))
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
460 put ='\"'.g:netrw_passwd.'\"'
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
461 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
462 else
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
463 put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"'
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
464 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
465 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
466
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
467 if exists("g:netrw_ftpmode") && g:netrw_ftpmode != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
468 put =g:netrw_ftpmode
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
469 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
470 endif
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
471 put ='get \"'.netrw_fname.'\" '.tmpfile
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
472 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
473
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
474 " perform ftp:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
475 " -i : turns off interactive prompting from ftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
476 " -n unix : DON'T use <.netrc>, even though it exists
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
477 " -n win32: quit being obnoxious about password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
478 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
479 " call Decho("executing: %!".g:netrw_ftp_cmd." -i -n")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
480 exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
481 " 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
482 if getline(1) !~ "^$"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
483 " call Decho("error<".getline(1).">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
484 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
485 echohl Error | echo "***netrw*** ".getline(1) | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
486 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
487 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
488 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
489 bd!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
490 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
491 let b:netrw_lastfile = choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
492
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
493 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
494 " scp: NetRead Method #4
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
495 elseif b:netrw_method == 4 " read with scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
496 " call Decho("read via scp (method #4)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
497 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
498 let useport= " -P ".g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
499 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
500 let useport= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
501 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
502 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
503 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
504 " call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
505 exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
506 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
507 " call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
508 exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
509 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
510 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
511 let b:netrw_lastfile = choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
512
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
513 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
514 elseif b:netrw_method == 5 " read with http (wget)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
515 " call Decho("read via http (method #5)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
516 if g:netrw_http_cmd == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
517 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
518 echohl Error | echo "***netrw*** neither wget nor fetch command is available" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
519 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
520 endif
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
521 " call Dret("NetRead")
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
522 return
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
523 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
524
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
525 if match(b:netrw_fname,"#") == -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
526 " simple wget
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
527 " call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.escape(b:netrw_fname,' ?&'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
528 exe g:netrw_silentxfer."!".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.escape(b:netrw_fname,' ?&')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
529 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
530
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
531 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
532 " wget plus a jump to an in-page marker (ie. http://abc/def.html#aMarker)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
533 let netrw_html= substitute(b:netrw_fname,"#.*$","","")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
534 let netrw_tag = substitute(b:netrw_fname,"^.*#","","")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
535 " call Decho("netrw_html<".netrw_html.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
536 " call Decho("netrw_tag <".netrw_tag.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
537 " call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_html)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
538 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
539 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
540 " call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
541 exe 'norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\<CR>"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
542 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
543 let b:netrw_lastfile = choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
544
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
545 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
546 " cadaver: NetRead Method #6
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
547 elseif b:netrw_method == 6 " read with cadaver
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
548 " call Decho("read via cadaver (method #6)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
549
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
550 " Construct execution string (four lines) which will be passed through filter
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
551 let netrw_fname= b:netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
552 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
553 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
554 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
555 put ='open '.g:netrw_machine.' '.g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
556 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
557 put ='open '.g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
558 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
559 put ='user '.g:netrw_uid.' '.g:netrw_passwd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
560
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
561 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
562 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
563 put ='get '.netrw_fname.' '.cygtmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
564 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
565 put ='get '.netrw_fname.' '.tmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
566 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
567 put ='quit'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
568
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
569 " perform cadaver operation:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
570 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
571 " call Decho("executing: %!".g:netrw_dav_cmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
572 exe g:netrw_silentxfer."%!".g:netrw_dav_cmd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
573 bd!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
574 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
575 let b:netrw_lastfile = choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
576
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
577 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
578 " rsync: NetRead Method #7
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
579 elseif b:netrw_method == 7 " read with rsync
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
580 " call Decho("read via rsync (method #7)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
581 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
582 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
583 " call Decho("executing: !".g:netrw_rsync_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
584 exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
585 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
586 " call Decho("executing: !".g:netrw_rsync_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
587 exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
588 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
589 let result = s:NetGetFile(readcmd,tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
590 let b:netrw_lastfile = choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
591
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
592 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
593 " fetch: NetRead Method #8
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
594 " fetch://[user@]host[:http]/path
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
595 elseif b:netrw_method == 8 " read with fetch
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
596 if g:netrw_fetch_cmd == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
597 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
598 echohl Error | echo "***netrw*** fetch command not available" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
599 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
600 endif
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
601 " call Dret("NetRead")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
602 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
603 if exists("g:netrw_option") && g:netrw_option == ":http"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
604 let netrw_option= "http"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
605 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
606 let netrw_option= "ftp"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
607 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
608 " call Decho("read via fetch for ".netrw_option)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
609
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
610 if exists("g:netrw_uid") && g:netrw_uid != "" && exists("g:netrw_passwd") && g:netrw_passwd != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
611 " call Decho("executing: !".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_uid.':'.g:netrw_passwd.'@'.g:netrw_machine."/".escape(b:netrw_fname,' ?&'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
612 exe g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_uid.':'.g:netrw_passwd.'@'.g:netrw_machine."/".escape(b:netrw_fname,' ?&')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
613 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
614 " call Decho("executing: !".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_machine."/".escape(b:netrw_fname,' ?&'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
615 exe g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_machine."/".escape(b:netrw_fname,' ?&')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
616 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
617
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
618 let result = s:NetGetFile(readcmd,tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
619 let b:netrw_lastfile = choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
620
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
621 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
622 " sftp: NetRead Method #9
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
623 elseif b:netrw_method == 9 " read with sftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
624 " call Decho("read via sftp (method #4)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
625 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
626 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
627 " call Decho("!".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
628 " call Decho("executing: !".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
629 exe "!".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".cygtmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
630 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
631 " call Decho("executing: !".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
632 exe g:netrw_silentxfer."!".g:netrw_sftp_cmd." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
633 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
634 let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
635 let b:netrw_lastfile = choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
636
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
637 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
638 else " Complain
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
639 echo "***warning*** unable to comply with your request<" . choice . ">"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
640 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
641 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
642
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
643 " cleanup
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
644 " call Decho("cleanup")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
645 if exists("b:netrw_method")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
646 unlet b:netrw_method
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
647 unlet b:netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
648 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
649 call s:NetOptionRestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
650
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
651 " call Dret("NetRead")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
652 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
653
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
654 " ------------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
655 " NetGetFile: Function to read file "fname" with command "readcmd". {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
656 fun! s:NetGetFile(readcmd, fname, method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
657 " call Dfunc("NetGetFile(readcmd<".a:readcmd.">,fname<".a:fname."> method<".a:method.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
658
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
659 if exists("*NetReadFixup")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
660 " for the use of NetReadFixup (not otherwise used internally)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
661 let line2= line("$")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
662 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
663
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
664 " transform paths from / to \ for Windows (except for cygwin)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
665 if &term == "win32"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
666 if g:netrw_cygwin
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
667 let fname= a:fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
668 " call Decho("(win32 && cygwin) fname<".fname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
669 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
670 let fname= substitute(a:fname,'/','\\\\','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
671 " call Decho("(win32 && !cygwin) fname<".fname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
672 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
673 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
674 let fname= a:fname
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
675 " call Decho("fname=a:fname<".fname.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
676 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
677
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
678 if a:readcmd[0] == '0'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
679 " get file into buffer
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
680
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
681 " record remote filename
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
682 let rfile= bufname(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
683 " call Decho("remotefile<".rfile.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
684 " call Dredir("ls!","starting buffer list")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
685
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
686 " rename the current buffer to the temp file (ie. fname)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
687 keepalt exe "file ".fname
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
688 " call Dredir("ls!","after renaming current buffer to <".fname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
689
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
690 " edit temporary file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
691 e
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
692 " call Dredir("ls!","after editing temporary file")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
693
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
694 " rename buffer back to remote filename
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
695 keepalt exe "file ".rfile
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
696 " call Dredir("ls!","renaming buffer back to remote filename<".rfile.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
697 let line1 = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
698 let line2 = line("$")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
699
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
700 elseif filereadable(fname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
701 " read file after current line
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
702 let curline = line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
703 let lastline= line("$")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
704 " call Decho("exe<".a:readcmd." ".v:cmdarg." ".fname."> line#".curline)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
705 exe a:readcmd." ".v:cmdarg." ".fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
706 let line1 = curline + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
707 let line2 = line("$") - lastline + 1
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
708
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
709 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
710 " not readable
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
711 " call Dfunc("NetGetFile(readcmd<".a:readcmd.">,fname<".a:fname."> method<".a:method.">)")
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
712 echohl WarningMsg | echo "***netrw*** file <".fname."> not readable"| echohl None
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
713 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
714 " call Dret("NetGetFile : fname<".fname."> not readable")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
715 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
716 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
717
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
718 " User-provided (ie. optional) fix-it-up command
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
719 if exists("*NetReadFixup")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
720 " call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
721 call NetReadFixup(a:method, line1, line2)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
722 " else " Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
723 " call Decho("NetReadFixup() not called, doesn't exist")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
724 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
725
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
726 " update the Buffers menu
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
727 if has("gui") && has("gui_running")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
728 silent! emenu Buffers.Refresh\ menu
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
729 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
730
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
731 " call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> fname<".a:fname."> readable=".filereadable(a:fname))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
732
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
733 " insure that we have the right filetype and that its being displayed
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
734 filetype detect
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
735 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
736 " call Dret("NetGetFile")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
737 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
738
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
739 " ------------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
740 " NetWrite: responsible for writing a file over the net {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
741 fun! netrw#NetWrite(...) range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
742 " call Dfunc("NetWrite(a:0=".a:0.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
743
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
744 " option handling
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
745 let mod= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
746 call s:NetOptionSave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
747
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
748 " Get Temporary Filename
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
749 let tmpfile= tempname()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
750 if !isdirectory(substitute(tmpfile,'[^/]\+$','','e'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
751 echohl Error | echo "***netrw*** your ".substitute(tmpfile,'[^/]\+$','','e')." directory is missing!"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
752 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
753 " call Dret("NetWrite")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
754 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
755 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
756
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
757 if a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
758 let ichoice = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
759 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
760 let ichoice = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
761 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
762
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
763 " write (selected portion of) file to temporary
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
764 silent exe a:firstline."," . a:lastline . "w! ".v:cmdarg." ".tmpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
765
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
766 while ichoice <= a:0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
767
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
768 " attempt to repeat with previous host-file-etc
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
769 if exists("b:netrw_lastfile") && a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
770 " call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
771 let choice = b:netrw_lastfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
772 let ichoice= ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
773 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
774 exe "let choice= a:" . ichoice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
775
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
776 " Reconstruct Choice if choice starts with '"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
777 if match(choice,"?") == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
778 echomsg 'NetWrite Usage:"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
779 echomsg ':Nwrite machine:path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
780 echomsg ':Nwrite "machine path" uses ftp with <.netrc>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
781 echomsg ':Nwrite "machine id password path" uses ftp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
782 echomsg ':Nwrite dav://[user@]machine/path uses cadaver'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
783 echomsg ':Nwrite fetch://[user@]machine/path uses fetch'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
784 echomsg ':Nwrite ftp://machine[#port]/path uses ftp (autodetects <.netrc>)'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
785 echomsg ':Nwrite rcp://machine/path uses rcp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
786 echomsg ':Nwrite rsync://[user@]machine/path uses rsync'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
787 echomsg ':Nwrite scp://[user@]machine[[:#]port]/path uses scp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
788 echomsg ':Nwrite sftp://[user@]machine/path uses sftp'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
789 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
790
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
791 elseif match(choice,"^\"") != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
792 if match(choice,"\"$") != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
793 " case "..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
794 let choice=strpart(choice,1,strlen(choice)-2)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
795 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
796 " case "... ... ..."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
797 let choice = strpart(choice,1,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
798 let wholechoice = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
799
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
800 while match(choice,"\"$") == -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
801 let wholechoice= wholechoice . " " . choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
802 let ichoice = ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
803 if choice > a:0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
804 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
805 echohl Error | echo "***netrw*** Unbalanced string in filename '". wholechoice ."'" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
806 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
807 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
808 " call Dret("NetWrite")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
809 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
810 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
811 let choice= a:{ichoice}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
812 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
813 let choice= strpart(wholechoice,1,strlen(wholechoice)-1) . " " . strpart(choice,0,strlen(choice)-1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
814 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
815 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
816 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
817 " call Decho("choice<" . choice . ">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
818 let ichoice= ichoice + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
819
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
820 " fix up windows urls
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
821 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
822 let choice= substitute(choice,'\\','/','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
823 "ER: see NetRead()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
824 exe 'lcd ' . fnamemodify(tmpfile,':h')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
825 let tmpfile = fnamemodify(tmpfile,':t')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
826 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
827
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
828 " Determine method of read (ftp, rcp, etc)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
829 call s:NetMethod(choice)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
830
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
831 " =============
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
832 " Perform Write
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
833 " =============
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
834
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
835 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
836 " rcp: NetWrite Method #1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
837 if b:netrw_method == 1 " write with rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
838 " Decho "write via rcp (method #1)"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
839 if s:netrw_has_nt_rcp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
840 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
841 let uid_machine = g:netrw_machine .'.'. g:netrw_uid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
842 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
843 let uid_machine = g:netrw_machine .'.'. $USERNAME
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
844 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
845 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
846 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
847 let uid_machine = g:netrw_uid .'@'. g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
848 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
849 let uid_machine = g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
850 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
851 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
852 " call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".tmpfile." ".uid_machine.":".escape(b:netrw_fname,' ?&'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
853 exe g:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".tmpfile." ".uid_machine.":".escape(b:netrw_fname,' ?&')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
854 let b:netrw_lastfile = choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
855
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
856 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
857 " ftp + <.netrc>: NetWrite Method #2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
858 elseif b:netrw_method == 2 " write with ftp + <.netrc>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
859 let netrw_fname = b:netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
860 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
861 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
862 exe "put ='".g:netrw_ftpmode."'"
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
863 " call Decho(" filter input: ".getline("."))
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
864 exe "put ='"."put ".tmpfile.' \"'.netrw_fname.'\"'."'"
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
865 " call Decho(" filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
866 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
867 " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
868 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
869 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
870 " call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
871 exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
872 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
873 " 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
874 if getline(1) !~ "^$"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
875 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
876 echohl Error | echo "***netrw*** ".getline(1) | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
877 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
878 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
879 let mod=1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
880 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
881 bd!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
882 let b:netrw_lastfile = choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
883
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
884 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
885 " ftp + machine, id, passwd, filename: NetWrite Method #3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
886 elseif b:netrw_method == 3 " write with ftp + machine, id, passwd, and fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
887 let netrw_fname= b:netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
888 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
889 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
890 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
891 put ='open '.g:netrw_machine.' '.g:netrw_port
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
892 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
893 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
894 put ='open '.g:netrw_machine
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
895 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
896 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
897 if exists("g:netrw_ftp") && g:netrw_ftp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
898 put =g:netrw_uid
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
899 " call Decho("filter input: ".getline("."))
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
900 put ='\"'.g:netrw_passwd.'\"'
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
901 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
902 else
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
903 put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"'
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
904 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
905 endif
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
906 put ='put '.tmpfile.' \"'.netrw_fname.'\"'
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
907 " call Decho("filter input: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
908 " save choice/id/password for future use
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
909 let b:netrw_lastfile = choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
910
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
911 " perform ftp:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
912 " -i : turns off interactive prompting from ftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
913 " -n unix : DON'T use <.netrc>, even though it exists
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
914 " -n win32: quit being obnoxious about password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
915 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
916 " call Decho("executing: %!".g:netrw_ftp_cmd." -i -n")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
917 exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
918 " 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
919 if getline(1) !~ "^$"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
920 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
921 echohl Error | echo "***netrw*** ".getline(1) | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
922 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
923 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
924 let mod=1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
925 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
926 bd!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
927
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
928 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
929 " scp: NetWrite Method #4
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
930 elseif b:netrw_method == 4 " write with scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
931 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
932 let useport= " -P ".g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
933 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
934 let useport= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
935 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
936 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
937 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
938 " call Decho("executing: !".g:netrw_scp_cmd.useport." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
939 exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
940 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
941 " call Decho("executing: !".g:netrw_scp_cmd.useport." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
942 exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
943 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
944 let b:netrw_lastfile = choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
945
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
946 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
947 " http: NetWrite Method #5
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
948 elseif b:netrw_method == 5
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
949 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
950 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
951 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
952 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
953
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
954 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
955 " dav: NetWrite Method #6
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
956 elseif b:netrw_method == 6 " write with cadaver
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
957 " call Decho("write via cadaver (method #6)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
958
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
959 " Construct execution string (four lines) which will be passed through filter
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
960 let netrw_fname= b:netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
961 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
962 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
963 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
964 put ='open '.g:netrw_machine.' '.g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
965 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
966 put ='open '.g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
967 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
968 put ='user '.g:netrw_uid.' '.g:netrw_passwd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
969
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
970 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
971 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
972 put ='put '.cygtmpfile.' '.netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
973 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
974 put ='put '.tmpfile.' '.netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
975 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
976
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
977 " perform cadaver operation:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
978 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
979 " call Decho("executing: %!".g:netrw_dav_cmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
980 exe g:netrw_silentxfer."%!".g:netrw_dav_cmd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
981 bd!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
982 let b:netrw_lastfile = choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
983
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
984 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
985 " rsync: NetWrite Method #7
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
986 elseif b:netrw_method == 7 " write with rsync
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
987 if g:netrw_cygwin == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
988 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
989 " call Decho("executing: !".g:netrw_rsync_cmd." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
990 exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".cygtmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
991 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
992 " call Decho("executing: !".g:netrw_rsync_cmd." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
993 exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".tmpfile." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
994 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
995 let b:netrw_lastfile = choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
996
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
997 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
998 " scp: NetWrite Method #9
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
999 elseif b:netrw_method == 9 " write with sftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1000 let netrw_fname= b:netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1001 if exists("g:netrw_uid") && ( g:netrw_uid != "" )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1002 let uid_machine = g:netrw_uid .'@'. g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1003 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1004 let uid_machine = g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1005 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1006 new
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1007 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1008 put ='put '.tmpfile.' '.netrw_fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1009 norm! 1Gdd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1010 " call Decho("executing: %!".g:netrw_sftp_cmd.' '.uid_machine)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1011 exe g:netrw_silentxfer."%!".g:netrw_sftp_cmd.' '.uid_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1012 bd!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1013 let b:netrw_lastfile= choice
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1014
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1015 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1016 else " Complain
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1017 echo "***warning*** unable to comply with your request<" . choice . ">"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1018 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1019 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1020
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1021 " cleanup
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1022 " call Decho("cleanup")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1023 let result=delete(tmpfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1024 call s:NetOptionRestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1025
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1026 if a:firstline == 1 && a:lastline == line("$")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1027 let &mod= mod " usually equivalent to set nomod
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1028 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1029
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1030 " call Dret("NetWrite")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1031 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1032
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1033 " ===========================================
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1034 " Remote Directory Browsing Support: {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1035 " ===========================================
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1036
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1037 " 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
1038 " of the contents of a remote directory. It is assumed that the
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1039 " g:netrw_list_cmd has a string, HOSTNAME, that needs to be substituted
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1040 " with the requested remote hostname first.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1041 fun! s:NetBrowse(dirname)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1042 if !exists("w:netrw_longlist")|let w:netrw_longlist= g:netrw_longlist|endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1043 " call Dfunc("NetBrowse(dirname<".a:dirname.">) longlist=".w:netrw_longlist)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1044
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1045 if exists("s:netrw_skipbrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1046 unlet s:netrw_skipbrowse
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1047 " call Dret("NetBrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1048 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1049 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1050
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1051 call s:NetOptionSave()
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1052
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1053 " sanity check
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1054 if exists("b:netrw_method") && b:netrw_method =~ '[235]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1055 " call Decho("b:netrw_method=".b:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1056 if !executable("ftp")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1057 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1058 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
1059 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1060 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1061 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1062 " call Dret("NetBrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1063 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1064 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1065 elseif !exists("g:netrw_list_cmd") || g:netrw_list_cmd == ''
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1066 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1067 echohl Error | echo "***netrw*** this system doesn't support remote directory listing via ssh" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1068 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1069 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1070
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1071 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1072 " call Dret("NetBrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1073 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1074 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1075
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1076 " use buffer-oriented WinVars if buffer ones exist but window ones don't
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1077 call s:UseBufWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1078
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1079 " make this buffer modifiable
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1080 setlocal ma nonu nowrap
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1081
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1082 " analyze a:dirname and g:netrw_list_cmd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1083 let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1084 let dirname = substitute(a:dirname,'\\','/','ge')
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1085 " call Decho("dirname<".dirname.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1086 if dirname !~ dirpat
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1087 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1088 echohl Error | echo "***netrw*** netrw doesn't understand your dirname<".dirname.">" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1089 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1090 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1091 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1092 " call Dret("NetBrowse : badly formatted dirname<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1093 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1094 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1095
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1096 let method = substitute(dirname,dirpat,'\1','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1097 let user = substitute(dirname,dirpat,'\2','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1098 let machine = substitute(dirname,dirpat,'\3','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1099 let path = substitute(dirname,dirpat,'\4','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1100 let fname = substitute(dirname,'^.*/\ze.','','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1101 " call Decho("set up method <".method .">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1102 " call Decho("set up user <".user .">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1103 " call Decho("set up machine<".machine.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1104 " call Decho("set up path <".path .">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1105 " call Decho("set up fname <".fname .">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1106
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1107 if method == "ftp" || method == "http"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1108 let method = "ftp"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1109 let listcmd = g:netrw_ftp_list_cmd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1110 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1111 let listcmd = substitute(g:netrw_list_cmd,'\<HOSTNAME\>',user.machine,'')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1112 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1113
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1114 if exists("b:netrw_method")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1115 " call Decho("setting w:netrw_method<".b:netrw_method.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1116 let w:netrw_method= b:netrw_method
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1117 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1118
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1119 " optionally sort by time (-t) or by size (-S)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1120 if listcmd == "dir" && g:netrw_sort_by =~ "^[ts]"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1121 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
1122 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1123 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1124 if g:netrw_sort_by =~ "^t"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1125 let listcmd= listcmd."t"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1126 elseif g:netrw_sort_by =~ "^s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1127 let listcmd= listcmd."S"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1128 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1129 " optionally sort in reverse
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1130 if g:netrw_sort_direction =~ "^r" && listcmd == "dir"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1131 let listcmd= listcmd."r"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1132 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1133 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1134
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1135 " call Decho("set up listcmd<".listcmd.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1136 if fname =~ '@$' && fname !~ '^"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1137 " call Decho("attempt transfer of symlink as file")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1138 call s:NetBrowse(substitute(dirname,'@$','','e'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1139 redraw!
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1140 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1141 " call Dret("NetBrowse : symlink")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1142 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1143
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1144 elseif fname !~ '[\/]$' && fname !~ '^"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1145 " looks like a regular file, attempt transfer
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1146 " call Decho("attempt transfer as regular file<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1147
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1148 " remove any filetype indicator from end of dirname, except for the
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1149 " "this is a directory" indicator (/). There shouldn't be one of those,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1150 " anyway.
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1151 let path= substitute(path,'[*=@|]\r\=$','','e')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1152 " call Decho("new path<".path.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1153
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1154 " remote-read the requested file into current buffer
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1155 keepjumps keepalt enew!
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1156 set ma
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1157 " call Decho("exe file ".method."://".user.machine."/".escape(path,s:netrw_cd_escape))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1158 exe "file ".method."://".user.machine."/".escape(path,s:netrw_cd_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1159 exe "silent doau BufReadPre ".fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1160 silent call netrw#NetRead(method."://".user.machine."/".path)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1161 exe "silent doau BufReadPost ".fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1162 keepjumps 1d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1163
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1164 " save certain window-oriented variables into buffer-oriented variables
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1165 call s:SetBufWinVars()
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1166 call s:NetOptionRestore()
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1167 setlocal nomod
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1168
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1169 " call Dret("NetBrowse : file<".fname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1170 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1171 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1172
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1173 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1174 " Perform Directory Listing:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1175 " call Decho("Perform directory listing...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1176 " set up new buffer and map
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1177 let bufname = method.'://'.user.machine.'/'.path
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1178 let bufnamenr = bufnr(bufname.'$')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1179 " call Decho("bufname<".bufname."> bufnamenr=".bufnamenr)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1180 if bufnamenr != -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1181 " buffer already exists, switch to it!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1182 " call Decho("buffer already exists, switching to it")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1183 exe "b ".bufnamenr
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1184 if line("$") >= 5
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1185 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1186 " call Dret("NetBrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1187 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1188 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1189 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1190 " call Decho("generate a new buffer")
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1191 keepjumps keepalt enew!
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1192 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1193
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1194 " rename file to reflect where its from
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1195 setlocal bt=nofile bh=wipe nobl noswf
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1196 exe "setlocal ts=".g:netrw_maxfilenamelen
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1197 " call Decho("exe file ".escape(bufname,s:netrw_cd_escape))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1198 exe 'file '.escape(bufname,s:netrw_cd_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1199 " call Decho("renaming file to bufname<".bufname.">")
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1200 setlocal bh=hide bt=nofile nobl nonu
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1201
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1202 " save current directory on directory history list
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1203 call <SID>NetBookmarkDir(3,expand("%"))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1204
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1205 " set up buffer-local mappings
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1206 " call Decho("set up buffer-local mappings")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1207 nnoremap <buffer> <silent> <cr> :call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),<SID>NetGetWord()))<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1208 nnoremap <buffer> <silent> <c-l> :call <SID>NetRefresh(<SID>NetBrowseChgDir(expand("%"),'./'))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1209 nnoremap <buffer> <silent> - :exe "norm! 0"<bar>call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),'../'))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1210 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
1211 if w:netrw_longlist != 2
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1212 nnoremap <buffer> <silent> b :<c-u>call <SID>NetBookmarkDir(0,expand("%"))<cr>
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1213 nnoremap <buffer> <silent> B :<c-u>call <SID>NetBookmarkDir(1,expand("%"))<cr>
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1214 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1215 nnoremap <buffer> <silent> Nb :<c-u>call <SID>NetBookmarkDir(0,expand("%"))<cr>
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1216 nnoremap <buffer> <silent> NB :<c-u>call <SID>NetBookmarkDir(0,expand("%"))<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1217 nnoremap <buffer> <silent> <c-h> :call <SID>NetHideEdit(0)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1218 nnoremap <buffer> <silent> i :call <SID>NetLongList(0)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1219 nnoremap <buffer> <silent> o :call <SID>NetSplit(0)<cr>
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1220 nnoremap <buffer> <silent> O :call <SID>NetObtain()<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1221 nnoremap <buffer> <silent> q :<c-u>call <SID>NetBookmarkDir(2,expand("%"))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1222 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
1223 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
1224 nnoremap <buffer> <silent> S :call <SID>NetSortSequence(0)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1225 nnoremap <buffer> <silent> u :<c-u>call <SID>NetBookmarkDir(4,expand("%"))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1226 nnoremap <buffer> <silent> U :<c-u>call <SID>NetBookmarkDir(5,expand("%"))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1227 nnoremap <buffer> <silent> v :call <SID>NetSplit(1)<cr>
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1228 nnoremap <buffer> <silent> x :call <SID>NetBrowseX(<SID>NetBrowseChgDir(expand("%"),<SID>NetGetWord()),1)<cr>
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1229 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
1230 exe 'nnoremap <buffer> <silent> <del> :call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1231 exe 'vnoremap <buffer> <silent> <del> :call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1232 exe 'nnoremap <buffer> <silent> d :call <SID>NetMakeDir("'.user.machine.'")<cr>'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1233 exe 'nnoremap <buffer> <silent> D :call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1234 exe 'vnoremap <buffer> <silent> D :call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1235 exe 'nnoremap <buffer> <silent> R :call <SID>NetBrowseRename("'.user.machine.'","'.path.'")<cr>'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1236 exe 'vnoremap <buffer> <silent> R :call <SID>NetBrowseRename("'.user.machine.'","'.path.'")<cr>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1237 nnoremap <buffer> ? :he netrw-browse-cmds<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1238 setlocal ma nonu nowrap
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1239
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1240 " Set up the banner
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1241 " call Decho("set up the banner: sortby<".g:netrw_sort_by."> method<".method.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1242 keepjumps put ='\" ==========================================================================='
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1243 keepjumps put ='\" Netrw Remote Directory Listing (netrw '.g:loaded_netrw.')'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1244 keepjumps put ='\" '.bufname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1245 let w:netrw_bannercnt = 7
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1246 let sortby = g:netrw_sort_by
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1247 if g:netrw_sort_direction =~ "^r"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1248 let sortby = sortby." reversed"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1249 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1250
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1251 if g:netrw_sort_by =~ "^n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1252 " sorted by name
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1253 let w:netrw_bannercnt= w:netrw_bannercnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1254 keepjumps put ='\" Sorted by '.sortby
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1255 keepjumps put ='\" Sort sequence: '.g:netrw_sort_sequence
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1256 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1257 " sorted by size or date
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1258 keepjumps put ='\" Sorted by '.sortby
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1259 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1260 if g:netrw_list_hide != "" && g:netrw_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1261 if g:netrw_hide == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1262 keepjumps put ='\" Hiding: '.g:netrw_list_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1263 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1264 keepjumps put ='\" Showing: '.g:netrw_list_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1265 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1266 let w:netrw_bannercnt= w:netrw_bannercnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1267 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1268 keepjumps put ='\" Quick Help: ?:help -:go up dir D:delete R:rename s:sort-by x:exec'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1269 keepjumps put ='\" ==========================================================================='
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1270
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1271 " remote read the requested directory listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1272 " Use ftp if that was the file-transfer method selected, otherwise use ssh
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1273 " Note that not all ftp servers honor the options for ls
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1274 if method == "ftp"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1275 " use ftp to get remote file listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1276 " call Decho("use ftp to get remote file listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1277 call s:NetBrowseFtpCmd(path,listcmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1278 keepjumps 1d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1279
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1280 if w:netrw_longlist == 0 || w:netrw_longlist == 2
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1281 " shorten the listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1282 " call Decho("generate short listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1283 exe "keepjumps ".w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1284
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1285 " cleanup
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1286 if g:netrw_ftp_browse_reject != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1287 exe "silent! g/".g:netrw_ftp_browse_reject."/keepjumps d"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1288 endif
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1289 silent! keepjumps %s/\r$//e
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1290
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1291 " if there's no ../ listed, then put ./ and ../ in
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1292 let line1= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1293 keepjumps 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1294 silent keepjumps call search('^\.\.\/\%(\s\|$\)','W')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1295 let line2= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1296 if line2 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1297 keepjumps put='../'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1298 keepjumps put='./'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1299 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1300 exe "keepjumps ".line1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1301 keepjumps norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1302
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1303 " more cleanup
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1304 exe 'silent! keepjumps '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e'
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1305 exe "silent! keepjumps ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e'
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1306 exe "silent! keepjumps ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1307 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1308
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1309 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1310 " use ssh to get remote file listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1311 " call Decho("use ssh to get remote file listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1312 let shq= &shq? &shq : ( &sxq? &sxq : "'")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1313 " call Decho("exe silent r! ".listcmd." '".shq.escape(path,s:netrw_cd_escape).shq."'")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1314 exe "silent r! ".listcmd." ".shq.escape(path,s:netrw_cd_escape).shq
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1315 keepjumps 1d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1316 " cleanup
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1317 if g:netrw_ftp_browse_reject != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1318 exe "silent! g/".g:netrw_ssh_browse_reject."/keepjumps d"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1319 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1320 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1321
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1322 " set up syntax highlighting
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1323 if has("syntax")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1324 setlocal ft=netrwlist
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1325 if !exists("g:syntax_on") || !g:syntax_on
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1326 setlocal ft=
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1327 " Ugly workaround -- when syntax highlighting is off and laststatus==2,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1328 " sometimes the laststatus highlight bleeds into the entire display.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1329 " Only seems to happen with remote browsing. Weird.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1330 redraw
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1331 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1332 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1333
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1334 " manipulate the directory listing (hide, sort)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1335 if line("$") >= w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1336 if g:netrw_hide && g:netrw_list_hide != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1337 call s:NetrwListHide()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1338 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1339
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1340 if w:netrw_longlist == 1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1341 " do a long listing; these substitutions need to be done prior to sorting
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1342 " call Decho("manipulate long listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1343
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1344 if method == "ftp"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1345 " cleanup
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1346 exe "keepjumps ".w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1347 while getline(".") =~ g:netrw_ftp_browse_reject
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1348 keepjumps d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1349 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1350 " if there's no ../ listed, then put ./ and ../ in
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1351 let line1= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1352 keepjumps 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1353 silent keepjumps call search('^\.\.\/\%(\s\|$\)','W')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1354 let line2= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1355 if line2 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1356 exe 'keepjumps '.w:netrw_bannercnt."put='./'"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1357 exe 'keepjumps '.w:netrw_bannercnt."put='../'"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1358 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1359 exe "keepjumps ".line1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1360 keepjumps norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1361 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1362
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1363 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/ -> .*$//e'
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1364 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2\t\1/e'
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1365 exe 'silent keepjumps '.w:netrw_bannercnt
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1366 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1367
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1368 if line("$") >= w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1369 if g:netrw_sort_by =~ "^n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1370 call s:SetSort()
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1371 if g:netrw_sort_direction =~ 'n'
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1372 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1373 else
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1374 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1375 endif
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1376 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{3}\///e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1377 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1378 if w:netrw_longlist == 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1379 " shorten the list to keep its width <= winwidth characters
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1380 exe "silent keepjumps ".w:netrw_bannercnt.',$s/\t[-dstrwx]\+/\t/e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1381 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1382 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1383 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1384
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1385 call s:NetrwWideListing()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1386 if line("$") >= w:netrw_bannercnt
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1387 " place cursor on the top-left corner of the file listing
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1388 exe "keepjumps ".w:netrw_bannercnt
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1389 norm! 0
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1390 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1391
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1392 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1393 setlocal nomod noma nonu
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1394
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1395 " call Dret("NetBrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1396 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1397 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1398
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1399 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1400 " NetBrowseChgDir: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1401 fun! s:NetBrowseChgDir(dirname,newdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1402 " call Dfunc("NetBrowseChgDir(dirname<".a:dirname."> newdir<".a:newdir.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1403
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1404 let dirname= a:dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1405 let newdir = a:newdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1406
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1407 if newdir !~ '[\/]$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1408 " handling a file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1409 let dirname= dirname.newdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1410 " call Decho("handling a file: dirname<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1411
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1412 elseif newdir == './'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1413 " refresh the directory list
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1414 " call Decho("refresh directory listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1415 setlocal ma nobl bh=hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1416 %d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1417
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1418 elseif newdir == '../'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1419 " go up one directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1420 let trailer= substitute(a:dirname,'^\(\w\+://\%(\w\+@\)\=\w\+/\)\(.*\)$','\2','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1421
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1422 if trailer =~ '^\%(\.\./\)*$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1423 " tack on a ../"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1424 let dirname= dirname.'../'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1425
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1426 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1427 " strip off a directory name from dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1428 let dirname= substitute(dirname,'^\(.*/\)[^/]\+/','\1','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1429 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1430 " call Decho("go up one dir: dirname<".dirname."> trailer<".trailer.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1431
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1432 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1433 " go down one directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1434 let dirname= dirname.newdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1435 " call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1436 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1437
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1438 " call Dret("NetBrowseChgDir <".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1439 return dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1440 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1441
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1442 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1443 " NetGetWord: it gets the directory named under the cursor
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1444 fun! s:NetGetWord()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1445 " call Dfunc("NetGetWord() line#".line("."))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1446 call s:UseBufWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1447
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1448 " insure that w:netrw_longlist is set up
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1449 if !exists("w:netrw_longlist")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1450 if exists("g:netrw_longlist")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1451 let w:netrw_longlist= g:netrw_longlist
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1452 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1453 let w:netrw_longlist= 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1454 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1455 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1456
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1457 if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1458 " Active Banner support
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1459 " call Decho("active banner handling")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1460 norm! 0
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1461 let dirname= "./"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1462 let curline= getline(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1463 if curline =~ '"\s*Sorted by\s'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1464 norm s
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1465 let s:netrw_skipbrowse= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1466 echo 'Pressing "s" also works'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1467 elseif curline =~ '"\s*Sort sequence:'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1468 let s:netrw_skipbrowse= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1469 echo 'Press "S" to edit sorting sequence'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1470 elseif curline =~ '"\s*Quick Help:'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1471 norm ?
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1472 let s:netrw_skipbrowse= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1473 echo 'Pressing "?" also works'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1474 elseif curline =~ '"\s*\%(Hiding\|Showing\):'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1475 norm a
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1476 let s:netrw_skipbrowse= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1477 echo 'Pressing "a" also works'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1478 elseif line("$") > w:netrw_bannercnt
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1479 exe 'silent keepjumps '.w:netrw_bannercnt
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1480 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1481
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1482 elseif w:netrw_longlist == 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1483 " call Decho("thin column handling")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1484 norm! 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1485 let dirname= getline(".")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1486
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1487 elseif w:netrw_longlist == 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1488 " call Decho("long column handling")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1489 norm! 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1490 let dirname= substitute(getline("."),'^\(\%(\S\+\s\)*\S\+\).\{-}$','\1','e')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1491
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1492 else
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1493 " call Decho("obtain word from wide listing")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1494 let dirname= getline(".")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1495
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1496 if !exists("b:netrw_cpf")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1497 let b:netrw_cpf= 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1498 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
1499 " call Decho("computed cpf")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1500 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1501
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1502 let filestart = (virtcol(".")/b:netrw_cpf)*b:netrw_cpf
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1503 " call Decho("virtcol=".virtcol(".")." cpf=".b:netrw_cpf." bannercnt=".w:netrw_bannercnt." filestart=".filestart)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1504 " call Decho("1: dirname<".dirname.">")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1505 if filestart > 0|let dirname= substitute(dirname,'^.\{'.filestart.'}','','')|endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1506 " call Decho("2: dirname<".dirname.">")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1507 let dirname = substitute(dirname,'^\(.\{'.b:netrw_cpf.'}\).*$','\1','e')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1508 " call Decho("3: dirname<".dirname.">")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1509 let dirname = substitute(dirname,'\s\+$','','e')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1510 " call Decho("4: dirname<".dirname.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1511 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1512
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1513 " call Dret("NetGetWord <".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1514 return dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1515 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1516
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1517 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1518 " NetBrowseRm: remove/delete a remote file or directory {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1519 fun! s:NetBrowseRm(usrhost,path) range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1520 " call Dfunc("NetBrowseRm(usrhost<".a:usrhost."> path<".a:path.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1521 " call Decho("firstline=".a:firstline." lastline=".a:lastline)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1522
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1523 " preparation for removing multiple files/directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1524 let ctr= a:firstline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1525 let all= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1526
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1527 " remove multiple files and directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1528 while ctr <= a:lastline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1529 exe ctr
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1530
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1531 norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1532 let rmfile= s:NetGetWord()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1533 " call Decho("rmfile<".rmfile.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1534
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1535 if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1536 " attempt to remove file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1537 if !all
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1538 echohl Statement
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1539 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1540 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
1541 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1542 echohl NONE
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1543 let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1544 if ok =~ 'a\%[ll]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1545 let all= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1546 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1547 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1548
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1549 if all || ok =~ 'y\%[es]' || ok == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1550 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1551 silent! keepjumps .,$d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1552 call s:NetBrowseFtpCmd(a:path,"delete ".rmfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1553 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1554 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
1555 " call Decho("attempt to remove file: system(".netrw_rm_cmd.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1556 let ret= system(netrw_rm_cmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1557 " call Decho("returned=".ret." errcode=".v:shell_error)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1558 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1559 elseif ok =~ 'q\%[uit]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1560 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1561 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1562
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1563 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1564 " attempt to remove directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1565 if !all
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1566 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1567 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
1568 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1569 let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1570 if ok =~ 'a\%[ll]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1571 let all= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1572 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1573 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1574
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1575 if all || ok =~ 'y\%[es]' || ok == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1576 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1577 call s:NetBrowseFtpCmd(a:path,"rmdir ".rmfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1578 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1579 let rmfile = a:path.rmfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1580 let netrw_rmdir_cmd= substitute(g:netrw_rmdir_cmd,'HOSTNAME',a:usrhost,'').' '."'".'"'.rmfile.'"'."'"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1581 " call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1582 let ret= system(netrw_rmdir_cmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1583 " call Decho("returned=".ret." errcode=".v:shell_error)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1584
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1585 if v:shell_error != 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1586 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
1587 " call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1588 let ret= system(netrw_rmf_cmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1589 " call Decho("returned=".ret." errcode=".v:shell_error)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1590
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1591 if v:shell_error != 0 && !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1592 echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1593 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1594 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1595 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1596 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1597
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1598 elseif ok =~ 'q\%[uit]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1599 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1600 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1601 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1602
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1603 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1604 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1605
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1606 " refresh the directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1607 let curline= line(".")-1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1608 " call Decho("refresh the directory")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1609 call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),'./'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1610 exe curline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1611
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1612 " call Dret("NetBrowseRm")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1613 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1614
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1615 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1616 " NetBrowseRename: rename a remote file or directory {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1617 fun! s:NetBrowseRename(usrhost,path) range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1618 " call Dfunc("NetBrowseRename(usrhost<".a:usrhost."> path<".a:path.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1619
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1620 " preparation for removing multiple files/directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1621 let ctr = a:firstline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1622 let rename_cmd = substitute(g:netrw_rename_cmd,'\<HOSTNAME\>',a:usrhost,'')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1623
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1624 " attempt to rename files/directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1625 while ctr <= a:lastline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1626 exe "keepjumps ".ctr
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1627
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1628 norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1629 let oldname= s:NetGetWord()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1630 " call Decho("oldname<".oldname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1631
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1632 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1633 let newname= input("Moving ".oldname." to : ",oldname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1634 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1635
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1636 if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1637 call s:NetBrowseFtpCmd(a:path,"rename ".oldname." ".newname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1638 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1639 let oldname= a:path.oldname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1640 let newname= a:path.newname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1641 " call Decho("system(rename_cmd".' "'.escape(oldname," ").'" "'.escape(newname,s:netrw_cd_escape).'"')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1642 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
1643 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1644
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1645 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1646 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1647
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1648 " refresh the directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1649 let curline= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1650 call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),'./'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1651 exe "keepjumps ".curline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1652 " call Dret("NetBrowseRename")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1653 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1654
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1655 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1656 " NetRefresh: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1657 fun! s:NetRefresh(dirname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1658 " call Dfunc("NetRefresh(dirname<".a:dirname.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1659 set ma
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1660 %d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1661 call <SID>NetBrowse(dirname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1662 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1663 " call Dret("NetRefresh")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1664 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1665
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1666 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1667 " NetSplit: mode {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1668 " =0 : net and o
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1669 " =1 : net and v
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1670 " =2 : local and o
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1671 " =3 : local and v
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1672 fun! s:NetSplit(mode)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1673 " call Dfunc("NetSplit(mode=".a:mode.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1674
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1675 call s:SaveWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1676 if a:mode == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1677 exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1678 call s:CopyWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1679 exe "norm! 0"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1680 call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),<SID>NetGetWord()))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1681 elseif a:mode ==1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1682 exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1683 call s:CopyWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1684 exe "norm! 0"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1685 call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),<SID>NetGetWord()))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1686 elseif a:mode ==2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1687 exe (g:netrw_alto? "bel " : "abo ").g:netrw_winsize."wincmd s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1688 call s:CopyWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1689 exe "norm! 0"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1690 call s:LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1691 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1692 exe (g:netrw_altv? "rightb " : "lefta ").g:netrw_winsize."wincmd v"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1693 call s:CopyWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1694 exe "norm! 0"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1695 call s:LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1696 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1697
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1698 " call Dret("NetSplit")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1699 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1700
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1701 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1702 " NetBrowseX: allows users to write custom functions to operate on {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1703 " files given their extension. Passes 0=local, 1=remote
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1704 fun! s:NetBrowseX(fname,remote)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1705 " call Dfunc("NetBrowseX(".a:fname." remote=".a:remote.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1706
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1707 " set up the filename
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1708 " (lower case the extension, make a local copy of a remote file)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1709 let exten= substitute(a:fname,'.*\.\(.\{-}\)','\1','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1710 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1711 let exten= substitute(exten,'^.*$','\L&\E','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1712 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1713 let fname= escape(a:fname,"%#")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1714 " call Decho("fname<".fname."> after escape()")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1715
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1716 if a:remote == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1717 " create a local copy
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1718 let fname= tempname().".".exten
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1719 " call Decho("create a local copy of <".a:fname."> as <".fname.">")
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1720 exe "silent keepjumps bot 1new ".a:fname
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1721 set bh=delete
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1722 exe "w! ".fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1723 q
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1724 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1725 " call Decho("exten<".exten."> "."NetrwFileHandler_".exten."():exists=".exists("*NetrwFileHandler_".exten))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1726
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1727 " set up redirection
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1728 if &srr =~ "%s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1729 let redir= substitute(&srr,"%s","/dev/null"."")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1730 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1731 let redir= &srr . "/dev/null"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1732 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1733 " call Decho("redir:".redir.":")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1734
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1735 " execute the file handler
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1736 if has("win32") || has("win64")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1737 " call Decho('exe silent !start rundll32 url.dll,FileProtocolHandler "'.escape(fname, '%#').'"')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1738 exe 'silent !start rundll32 url.dll,FileProtocolHandler "'.escape(fname, '%#').'"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1739 let ret= v:shell_error
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1740
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1741 elseif has("unix") && executable("kfmclient")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1742 " call Decho("exe silent !kfmclient exec '".escape(fname,'%#')."' ".redir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1743 exe "silent !kfmclient exec '".escape(fname,'%#')."' ".redir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1744 let ret= v:shell_error
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1745
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1746 elseif has("unix") && executable("gnome-open")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1747 " call Decho("exe silent !gnome-open '".escape(fname,'%#')."' ".redir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1748 exe "silent !gnome-open '".escape(fname,'%#')."'".redir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1749 let ret= v:shell_error
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1750
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1751 elseif exten != "" && exists("*NetrwFileHandler_".exten)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1752 " call Decho("let ret= NetrwFileHandler_".exten.'("'.fname.'")')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1753 exe "let ret= NetrwFileHandler_".exten.'("'.fname.'")'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1754 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1755 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1756
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1757 " cleanup: remove temporary file,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1758 " delete current buffer if success with handler,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1759 " return to prior buffer (directory listing)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1760 if a:remote == 1 && fname != a:fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1761 " call Decho("deleting temporary file<".fname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1762 call delete(fname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1763 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1764
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1765 if a:remote == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1766 set bh=delete bt=nofile noswf
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1767 exe "norm! \<c-o>"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1768 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1769 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1770
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1771 " call Dret("NetBrowseX")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1772 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1773
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1774 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1775 " NetBrowseFtpCmd: unfortunately, not all ftp servers honor options for ls {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1776 " This function assumes that a long listing will be received. Size, time,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1777 " and reverse sorts will be requested of the server but not otherwise
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1778 " enforced here.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1779 fun! s:NetBrowseFtpCmd(path,cmd)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1780 " call Dfunc("NetBrowseFtpCmd(path<".a:path."> cmd<".a:cmd.">) netrw_method=".w:netrw_method)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1781
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1782 " because WinXX ftp uses unix style input
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1783 " curline is one more than the bannercnt in order to account
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1784 " for the unwanted first blank line (doing a :put to an empty
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1785 " buffer yields a blank first line)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1786 let ffkeep= &ff
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1787 setlocal ma ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1788 let curline= w:netrw_bannercnt+1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1789 exe "silent! keepjumps ".curline.",$d"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1790
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1791 ".........................................
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1792 if w:netrw_method == 2 || w:netrw_method == 5
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1793 " ftp + <.netrc>: Method #2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1794 if a:path != ""
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1795 put ='cd \"'.a:path.'\"'
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1796 " call Decho('ftp: '.getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1797 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1798 exe "put ='".a:cmd."'"
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1799 " call Decho("ftp: ".getline("."))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1800 " redraw!|call inputsave()|call input("Pausing...")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1801 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1802 " 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
1803 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
1804 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1805 " 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
1806 exe g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1807 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1808
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1809 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1810 elseif w:netrw_method == 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1811 " ftp + machine,id,passwd,filename: Method #3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1812 setlocal ff=unix
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1813 if exists("g:netrw_port") && g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1814 put ='open '.g:netrw_machine.' '.g:netrw_port
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1815 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1816 put ='open '.g:netrw_machine
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1817 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1818
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1819 if exists("g:netrw_ftp") && g:netrw_ftp == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1820 put =g:netrw_uid
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1821 put ='\"'.g:netrw_passwd.'\"'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1822 else
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1823 put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1824 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1825
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1826 if a:path != ""
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1827 put ='cd \"'.a:path.'\"'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1828 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1829 exe "put ='".a:cmd."'"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1830
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1831 " perform ftp:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1832 " -i : turns off interactive prompting from ftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1833 " -n unix : DON'T use <.netrc>, even though it exists
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1834 " -n win32: quit being obnoxious about password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1835 " call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i -n")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1836 exe g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i -n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1837
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1838 ".........................................
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1839 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1840 echo "***warning*** unable to comply with your request<" . choice . ">"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1841 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1842
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1843 " cleanup for Windows
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1844 if has("win32") || has("win95") || has("win64") || has("win16")
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1845 silent! keepjumps! %s/\r$//e
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1846 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1847 if a:cmd == "dir"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1848 " infer directory/link based on the file permission string
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1849 silent! keepjumps g/d\%([-r][-w][-x]\)\{3}/s@$@/@
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1850 silent! keepjumps g/l\%([-r][-w][-x]\)\{3}/s/$/@/
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1851 if w:netrw_longlist == 0 || w:netrw_longlist == 2
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1852 exe "silent! keepjumps ".curline.',$s/^\%(\S\+\s\+\)\{8}//e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1853 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1854 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1855
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1856 " ftp's ls doesn't seem to include ./ or ../
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1857 if !search('^\.\/$','wn')
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1858 exe 'keepjumps '.curline
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1859 if a:path !~ '^$'
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1860 put ='../'
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1861 endif
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1862 put ='./'
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1863 exe 'keepjumps '.curline
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1864 endif
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
1865
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1866 " restore settings
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1867 let &ff= ffkeep
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1868 " call Dret("NetBrowseFtpCmd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1869 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1870
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1871 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1872 " NetrwListHide: uses [range]g~...~d to delete files that match comma {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1873 " separated patterns given in g:netrw_list_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1874 fun! s:NetrwListHide()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1875 " call Dfunc("NetrwListHide() listhide<".g:netrw_list_hide.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1876
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1877 let listhide= g:netrw_list_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1878 while listhide != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1879 if listhide =~ ','
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1880 let hide = substitute(listhide,',.*$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1881 let listhide = substitute(listhide,'^.\{-},\(.*\)$','\1','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1882 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1883 let hide = listhide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1884 let listhide= ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1885 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1886
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1887 " Prune the list by hiding any files which match
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1888 " call Decho("pruning <".hide."> listhide<".listhide.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1889 if g:netrw_hide == 1
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1890 exe 'silent keepjumps '.w:netrw_bannercnt.',$g~'.hide.'~d'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1891 elseif g:netrw_hide == 2
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
1892 exe 'silent keepjumps '.w:netrw_bannercnt.',$v~'.hide.'~d'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1893 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1894 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1895
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1896 " call Dret("NetrwListHide")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1897 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1898
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1899 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1900 " NetHideEdit: allows user to edit the file/directory hiding list
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1901 fun! s:NetHideEdit(mode)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1902 " call Dfunc("NetHideEdit(mode=".a:mode.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1903
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1904 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1905 let newhide= input("Edit Hiding List: ",g:netrw_list_hide)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1906 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1907
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1908 " refresh the listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1909 let g:netrw_list_hide= newhide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1910 if a:mode == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1911 silent call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1912 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1913 silent call s:LocalRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,"./"))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1914 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1915
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1916 " call Dret("NetHideEdit")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1917 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1918
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1919 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1920 " NetSortSequence: allows user to edit the sorting sequence
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1921 fun! s:NetSortSequence(mode)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1922 " call Dfunc("NetSortSequence(mode=".a:mode.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1923
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1924 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1925 let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1926 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1927
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1928 " refresh the listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1929 let g:netrw_sort_sequence= newsortseq
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1930 if a:mode == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1931 silent call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1932 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1933 silent call s:LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,"./"))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1934 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1935
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1936 " call Dret("NetSortSequence")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1937 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1938
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1939 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1940 " NetLongList: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1941 fun! s:NetLongList(mode)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1942 " call Dfunc("NetLongList(mode=".a:mode.") netrw_longlist=".w:netrw_longlist)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1943 let fname = s:NetGetWord()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1944 let w:netrw_longlist = (w:netrw_longlist + 1) % 3
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1945 " call Decho("fname<".fname.">")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1946
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1947 if w:netrw_longlist == 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1948 " use one column listing
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1949 " call Decho("use one column list")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1950 let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1951
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1952 elseif w:netrw_longlist == 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1953 " use long list
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1954 " call Decho("use long list")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1955 let g:netrw_list_cmd = g:netrw_list_cmd." -l"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1956
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1957 else
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1958 " give wide list
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1959 " call Decho("use wide list")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1960 let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1961 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1962 setlocal ma
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1963
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1964 " clear buffer - this will cause NetBrowse/LocalBrowse to do a refresh
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1965 %d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1966
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1967 " refresh the listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1968 if a:mode == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1969 silent call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),"./"))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1970 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1971 silent call s:LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,"./"))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1972 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
1973
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1974 " keep cursor on the filename
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1975 silent keepjumps $
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1976 if fname =~ '/$'
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1977 silent call search('\%(^\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bW')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1978 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1979 silent call search('\%(^\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bW')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1980 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1981
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1982 " call Dret("NetLongList : w:netrw_longlist=".w:netrw_longlist)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1983 endfun
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1984
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1985 " ---------------------------------------------------------------------
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1986 " NetrwWideListing: {{{2
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1987 fun! s:NetrwWideListing()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1988 " call Dfunc("NetrwWideListing()")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1989
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1990 if w:netrw_longlist == 2
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1991 " look for longest filename (cpf=characters per filename)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1992 " cpf: characters per file
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1993 " fpl: files per line
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1994 " fpc: files per column
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1995 set ma
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1996 let b:netrw_cpf= 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1997 if line("$") >= w:netrw_bannercnt
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
1998 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
1999 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2000 " call Dret("NetrwWideListing")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2001 return
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2002 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2003 " call Decho("max file strlen+1=".b:netrw_cpf)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2004 let b:netrw_cpf= b:netrw_cpf + 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2005
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2006 " determine qty files per line (fpl)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2007 let w:netrw_fpl= winwidth(0)/b:netrw_cpf
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2008 " 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
2009
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2010 " make wide display
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2011 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^.*$/\=printf("%-'.b:netrw_cpf.'s",submatch(0))/'
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2012 let fpc = (line("$") - w:netrw_bannercnt + w:netrw_fpl)/w:netrw_fpl
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2013 let newcolstart = w:netrw_bannercnt + fpc
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2014 let newcolend = newcolstart + fpc - 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2015 " 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
2016 while line("$") >= newcolstart
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2017 if newcolend > line("$") | let newcolend= line("$") | endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2018 let newcolqty= newcolend - newcolstart
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2019 exe newcolstart
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2020 if newcolqty == 0
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2021 exe "silent keepjumps norm! 0\<c-v>$hx".w:netrw_bannercnt."G$p"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2022 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2023 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
2024 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2025 exe "silent keepjumps ".newcolstart.','.newcolend.'d'
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2026 exe 'silent keepjumps '.w:netrw_bannercnt
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2027 endwhile
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2028 exe "silent keepjumps ".w:netrw_bannercnt.',$s/\s\+$//e'
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2029 setlocal noma nomod
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2030 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2031
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2032 " call Dret("NetrwWideListing")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2033 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2034
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2035 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2036 " NetSaveWordPosn: used by the "s" command in both remote and local {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2037 " browsing. Along with NetRestoreWordPosn(), it keeps the cursor on
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2038 " the same word even though the sorting has changed its order of appearance.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2039 fun! s:NetSaveWordPosn()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2040 " call Dfunc("NetSaveWordPosn()")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2041 let s:netrw_saveword= '^'.escape(getline("."),s:netrw_cd_escape).'$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2042 " call Dret("NetSaveWordPosn : saveword<".s:netrw_saveword.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2043 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2044
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2045 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2046 " NetRestoreWordPosn: used by the "s" command; see NetSaveWordPosn() above {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2047 fun! s:NetRestoreWordPosn()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2048 " call Dfunc("NetRestoreWordPosn()")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2049 silent! call search(s:netrw_saveword,'w')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2050 " call Dret("NetRestoreWordPosn")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2051 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2052
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2053 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2054 " NetMakeDir: this function makes a directory (both local and remote) {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2055 fun! s:NetMakeDir(usrhost)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2056 " call Dfunc("NetMakeDir(usrhost<".a:usrhost.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2057
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2058 " get name of new directory from user. A bare <CR> will skip.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2059 " if its currently a directory, also request will be skipped, but with
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2060 " a message.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2061 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2062 let newdirname= input("Please give directory name: ")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2063 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2064 " call Decho("newdirname<".newdirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2065
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2066 if newdirname == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2067 " call Dret("NetMakeDir : user aborted with bare <cr>")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2068 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2069 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2070
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2071 if a:usrhost == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2072
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2073 " Local mkdir:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2074 " sanity checks
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2075 let fullnewdir= b:netrw_curdir.'/'.newdirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2076 " call Decho("fullnewdir<".fullnewdir.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2077 if isdirectory(fullnewdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2078 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2079 echohl WarningMsg | echo "***netrw*** <".newdirname."> is already a directory!" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2080 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2081 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2082 " call Dret("NetMakeDir : directory<".newdirname."> exists previously")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2083 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2084 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2085 if filereadable(fullnewdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2086 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2087 echohl WarningMsg | echo "***netrw*** <".newdirname."> is already a file!" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2088 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2089 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2090 " call Dret("NetMakeDir : file<".newdirname."> exists previously")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2091 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2092 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2093
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2094 " requested new local directory is neither a pre-existing file or
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2095 " directory, so make it!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2096 if exists("*mkdir")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2097 call mkdir(fullnewdir,"p")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2098 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2099 let netrw_origdir= s:NetGetcwd(1)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2100 exe 'cd '.b:netrw_curdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2101 " call Decho("netrw_origdir<".netrw_origdir."> b:netrw_curdir<".b:netrw_curdir.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2102 " call Decho("exe silent! !".g:netrw_local_mkdir.' "'.newdirname.'"')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2103 exe "silent! !".g:netrw_local_mkdir.' "'.newdirname.'"'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2104 if !g:netrw_keepdir | exe 'keepjumps cd '.netrw_origdir | endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2105 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2106
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2107 if v:shell_error == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2108 " refresh listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2109 " call Decho("refresh listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2110 let linenum= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2111 norm! H0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2112 let hline = line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2113 set ma|norm! 2D
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2114 call s:LocalBrowse(s:LocalBrowseChgDir(b:netrw_curdir,'./'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2115 exe "norm! ".hline."G0z\<CR>"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2116 exe linenum
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2117 elseif !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2118 echohl Error | echo "***netrw*** unable to make directory<".newdirname.">" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2119 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2120 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2121 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2122
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2123 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2124 " Remote mkdir:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2125 let mkdircmd = substitute(g:netrw_mkdir_cmd,'\<HOSTNAME\>',a:usrhost,'')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2126 let newdirname= "'".'"'.substitute(expand("%"),'^\%(.\{-}/\)\{3}\(.*\)$','\1','').newdirname.'"'."'"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2127 " call Decho("exe silent! !".mkdircmd." ".newdirname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2128 exe "silent! !".mkdircmd." ".newdirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2129 if v:shell_error == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2130 " refresh listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2131 let linenum= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2132 norm! H0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2133 let hline = line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2134 call s:NetBrowse(s:NetBrowseChgDir(expand("%"),'./'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2135 exe "norm! ".hline."G0z\<CR>"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2136 exe linenum
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2137 elseif !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2138 echohl Error | echo "***netrw*** unable to make directory<".newdirname.">" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2139 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2140 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2141 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2142 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2143
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2144 " call Dret("NetMakeDir")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2145 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2146
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2147 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2148 " NetBookmarkDir: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2149 " 0: (user: <b>) bookmark current directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2150 " 1: (user: <B>) change to the bookmarked directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2151 " 2: (user: <q>) list bookmarks
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2152 " 3: (LocalBrowse) record current directory history
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2153 " 4: (user: <u>) go up (previous) bookmark
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2154 " 5: (user: <U>) go down (next) bookmark
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2155 fun! s:NetBookmarkDir(chg,curdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2156 " call Dfunc("NetBookmarkDir(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2157 if exists("w:netrw_bannercnt") && line(".") <= w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2158 " looks like a "b" was pressed while in the banner region
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2159 if line("$") > w:netrw_bannercnt
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2160 exe 'silent keepjumps '.w:netrw_bannercnt
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2161 endif
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2162 if &ch > 1
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2163 " "clear" the message
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2164 echo ""
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2165 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2166 " call Dret("NetBookmarkDir - ignoring")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2167 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2168 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2169
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2170 if a:chg == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2171 " bookmark the current directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2172 let g:NETRW_BOOKMARKDIR_{v:count}= a:curdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2173 if !exists("g:NETRW_BOOKMARKMAX")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2174 let g:NETRW_BOOKMARKMAX= v:count
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2175 elseif v:count > g:NETRW_BOOKMARKMAX
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2176 let g:NETRW_BOOKMARKMAX= v:count
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2177 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2178 echo "bookmarked the current directory"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2179
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2180 elseif a:chg == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2181 " change to the bookmarked directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2182 if exists("g:NETRW_BOOKMARKDIR_{v:count}")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2183 exe "e ".g:NETRW_BOOKMARKDIR_{v:count}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2184 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2185 echomsg "Sorry, bookmark#".v:count." doesn't exist!"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2186 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2187
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2188 elseif a:chg == 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2189 " list user's bookmarks
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2190 if exists("g:NETRW_BOOKMARKMAX")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2191 " call Decho("list bookmarks [0,".g:NETRW_BOOKMARKMAX."]")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2192 let cnt= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2193 while cnt <= g:NETRW_BOOKMARKMAX
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2194 if exists("g:NETRW_BOOKMARKDIR_{cnt}")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2195 " call Decho("Netrw Bookmark#".cnt.": ".g:NETRW_BOOKMARKDIR_{cnt})
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2196 echo "Netrw Bookmark#".cnt.": ".g:NETRW_BOOKMARKDIR_{cnt}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2197 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2198 let cnt= cnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2199 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2200 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2201
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2202 " list directory history
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2203 let cnt = g:NETRW_DIRHIST_CNT
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2204 let first = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2205 let histcnt = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2206 while ( first || cnt != g:NETRW_DIRHIST_CNT )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2207 " call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:NETRW_DIRHIST_CNT)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2208 let histcnt= histcnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2209 if exists("g:NETRW_DIRHIST_{cnt}")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2210 " call Decho("Netrw History#".histcnt.": ".g:NETRW_DIRHIST_{cnt})
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2211 echo "Netrw History#".histcnt.": ".g:NETRW_DIRHIST_{cnt}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2212 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2213 let first = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2214 let cnt = ( cnt - 1 ) % g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2215 if cnt < 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2216 let cnt= cnt + g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2217 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2218 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2219
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2220 elseif a:chg == 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2221 " saves most recently visited directories (when they differ)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2222 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
2223 let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2224 let g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}= substitute(a:curdir,'[/\\]$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2225 " 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
2226 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2227
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2228 elseif a:chg == 4
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2229 " u: change to the previous directory stored on the history list
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2230 let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT - 1 ) % g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2231 if g:NETRW_DIRHIST_CNT < 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2232 let g:NETRW_DIRHIST_CNT= g:NETRW_DIRHIST_CNT + g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2233 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2234 if exists("g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2235 " 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
2236 exe "e ".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2237 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2238 let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2239 echo "Sorry, no predecessor directory exists yet"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2240 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2241
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2242 elseif a:chg == 5
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2243 " U: change to the subsequent directory stored on the history list
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2244 let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2245 if exists("g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2246 " 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
2247 exe "e ".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2248 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2249 let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT - 1 ) % g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2250 if g:NETRW_DIRHIST_CNT < 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2251 let g:NETRW_DIRHIST_CNT= g:NETRW_DIRHIST_CNT + g:netrw_dirhistmax
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2252 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2253 echo "Sorry, no successor directory exists yet"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2254 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2255 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2256 " call Dret("NetBookmarkDir")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2257 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2258
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2259 " ---------------------------------------------------------------------
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2260 " NetObtain: obtain file under cursor (for remote browsing support) {{{2
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2261 fun! s:NetObtain()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2262 let fname= expand("<cWORD>")
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2263
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2264 " NetrwStatusLine support - for obtaining support
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2265 call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.fname)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2266
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2267 " call Dfunc("NetObtain() method=".w:netrw_method)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2268 if exists("w:netrw_method") && w:netrw_method =~ '[235]'
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2269 if executable("ftp")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2270 let curdir = expand("%")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2271 let path = substitute(curdir,'ftp://[^/]\+/','','e')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2272 let curline= line(".")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2273 let endline= line("$")+1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2274 set ma
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2275 keepjumps $
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2276
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2277 ".........................................
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2278 if w:netrw_method == 2
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2279 " ftp + <.netrc>: Method #2
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2280 if path != ""
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2281 put ='cd '.path
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2282 " call Decho("ftp: cd ".path)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2283 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2284 put ='get '.fname
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2285 " call Decho("ftp: get ".fname)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2286 if exists("g:netrw_port") && g:netrw_port != ""
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2287 " 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
2288 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
2289 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2290 " 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
2291 exe g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2292 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2293
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2294 ".........................................
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2295 elseif w:netrw_method == 3
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2296 " ftp + machine,id,passwd,filename: Method #3
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2297 setlocal ff=unix
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2298 if exists("g:netrw_port") && g:netrw_port != ""
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2299 put ='open '.g:netrw_machine.' '.g:netrw_port
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2300 " call Decho('ftp: open '.g:netrw_machine.' '.g:netrw_port)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2301 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2302 put ='open '.g:netrw_machine
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2303 " call Decho('ftp: open '.g:netrw_machine
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2304 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2305
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2306 if exists("g:netrw_ftp") && g:netrw_ftp == 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2307 put =g:netrw_uid
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2308 put ='\"'.g:netrw_passwd.'\"'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2309 " call Decho('ftp: g:netrw_uid')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2310 " call Decho('ftp: g:netrw_passwd')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2311 else
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2312 put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2313 " call Decho('user '.g:netrw_uid.' '.g:netrw_passwd)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2314 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2315
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2316 if a:path != ""
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2317 put ='cd '.a:path
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2318 " call Decho('cd '.a:path)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2319 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2320 exe "put ='".a:cmd."'"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2321 " call Decho("ftp: ".a:cmd)
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2322
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2323 " perform ftp:
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2324 " -i : turns off interactive prompting from ftp
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2325 " -n unix : DON'T use <.netrc>, even though it exists
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2326 " -n win32: quit being obnoxious about password
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2327 " call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i -n")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2328 exe g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i -n"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2329
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2330 ".........................................
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2331 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2332 echo "***warning*** unable to comply with your request<" . choice . ">"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2333 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2334 " restore
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2335 exe "silent! ".endline.",$d"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2336 exe "keepjumps ".curline
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2337 setlocal noma nomod
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2338 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2339 if !exists("g:netrw_quiet")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2340 echohl Error | echo "***netrw*** this system doesn't support ftp" | echohl None
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2341 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2342 endif
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2343 let &stl = s:netrw_users_stl
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2344 let &laststatus = s:netrw_users_ls
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2345 " call Dret("NetObtain")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2346 return
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2347 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2348
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2349 ".........................................
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2350 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2351 " scp: Method#4
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2352 if exists("g:netrw_port") && g:netrw_port != ""
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2353 let useport= " -P ".g:netrw_port
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2354 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2355 let useport= ""
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2356 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2357 if g:netrw_cygwin == 1
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2358 let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2359 " call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(fname,' ?&')." .")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2360 exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(fname,' ?&')." ."
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2361 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2362 " call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(fname,' ?&')." .")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2363 exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(fname,' ?&')." ."
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2364 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2365 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2366
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2367 " restore status line
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2368 let &stl = s:netrw_users_stl
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2369 let &laststatus = s:netrw_users_ls
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2370 redraw!
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2371
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2372 " call Dret("NetObtain")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2373 endfun
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2374
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2375 " ==========================================
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2376 " Local Directory Browsing Support: {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2377 " ==========================================
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2378
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2379 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2380 " LocalBrowse: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2381 fun! s:LocalBrowse(dirname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2382 " unfortunate interaction -- debugging calls can't be used here;
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2383 " the BufEnter event causes triggering when attempts to write to
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2384 " the DBG buffer are made.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2385 if isdirectory(a:dirname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2386 call netrw#DirBrowse(a:dirname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2387 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2388 " not a directory, ignore it
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2389 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2390
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2391 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2392 " DirBrowse: supports local file/directory browsing {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2393 fun! netrw#DirBrowse(dirname)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2394 if !exists("w:netrw_longlist")|let w:netrw_longlist= g:netrw_longlist|endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2395 " call Dfunc("DirBrowse(dirname<".a:dirname.">) buf#".bufnr("%")." winnr=".winnr()." sortby=".g:netrw_sort_by)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2396 " call Dredir("ls!")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2397
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2398 if exists("s:netrw_skipbrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2399 unlet s:netrw_skipbrowse
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2400 " call Dret("DirBrowse")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2401 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2402 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2403 call s:NetOptionSave()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2404
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2405 if v:version < 603
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2406 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2407 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
2408 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2409 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2410 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2411 " call Dret("DirBrowse : vim version<".v:version."> too old")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2412 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2413 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2414
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2415 " use buffer-oriented WinVars if buffer ones exist but window ones don't
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2416 call s:UseBufWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2417
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2418 " find buffer number of buffer named precisely the same as a:dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2419 let bufnum= bufnr(escape(a:dirname,'\'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2420 " call Decho("findbuf: bufnum=".bufnum)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2421 if bufnum > 0 && bufname(bufnum) != a:dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2422 let ibuf= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2423 let buflast= bufnr("$")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2424 while bufname(ibuf) !~ '^'.a:dirname.'\=$' && ibuf <= buflast
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2425 " call Decho("findbuf: ibuf=".ibuf. " bufname<".bufname(ibuf)."> dirname<".a:dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2426 let ibuf= ibuf + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2427 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2428 if ibuf > buflast
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2429 let bufnum= -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2430 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2431 let bufnum= ibuf
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2432 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2433 " call Decho("findbuf: bufnum=".bufnum." (final)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2434 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2435
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2436 " get cleared buffer
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2437 if bufnum < 0 || !bufexists(bufnum)
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2438 keepjumps keepalt enew!
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2439 " call Decho("enew buffer")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2440 else
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2441 exe "keepalt b ".bufnum
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2442 if exists("s:last_sort_by") && g:netrw_sort_by == s:last_sort_by
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2443 if getline(2) =~ '^" Directory Listing '
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2444 if !g:netrw_keepdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2445 " call Decho("change directory: cd ".b:netrw_curdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2446 exe 'cd '.escape(b:netrw_curdir,s:netrw_cd_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2447 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2448 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2449 " call Dret("DirBrowse : reusing buffer#".bufnum."<".a:dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2450 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2451 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2452 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2453 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2454 let s:last_sort_by= g:netrw_sort_by
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2455
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2456 " get the new directory name
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2457 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2458 let b:netrw_curdir= substitute(a:dirname,'\\','/','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2459 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2460 let b:netrw_curdir= a:dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2461 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2462 if b:netrw_curdir =~ '[/\\]$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2463 let b:netrw_curdir= substitute(b:netrw_curdir,'[/\\]$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2464 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2465 if b:netrw_curdir == ''
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2466 " under unix, when the root directory is encountered, the result
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2467 " from the preceding substitute is an empty string.
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2468 let b:netrw_curdir= '/'
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2469 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2470 " call Decho("b:netrw_curdir<".b:netrw_curdir.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2471
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2472 " make netrw's idea of the current directory vim's if the user wishes
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2473 if !g:netrw_keepdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2474 " call Decho("change directory: cd ".b:netrw_curdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2475 try
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2476 exe 'cd '.escape(b:netrw_curdir,s:netrw_cd_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2477 catch /^Vim\%((\a\+)\)\=:E472/
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2478 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
2479 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2480 if exists("w:netrw_prvdir")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2481 let b:netrw_curdir= w:netrw_prvdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2482 else
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2483 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2484 " call Dret("DirBrowse : reusing buffer#".bufnum."<".a:dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2485 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2486 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2487 endtry
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2488 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2489
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2490 " change the name of the buffer to reflect the b:netrw_curdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2491 exe 'silent! file '.escape(b:netrw_curdir,s:netrw_cd_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2492
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2493 " make this buffer not-a-file, modifiable, not line-numbered, etc
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2494 setlocal bh=hide bt=nofile nobl ma nonu
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2495 keepalt silent! %d
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2496
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2497 " ---------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2498 " Perform Directory Listing:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2499
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2500 " save current directory on directory history list
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2501 call <SID>NetBookmarkDir(3,b:netrw_curdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2502
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2503 " set up all the maps
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2504 " call Decho("Setting up local browser maps")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2505 nnoremap <buffer> <silent> <cr> :call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2506 nnoremap <buffer> <silent> <c-l> :set ma<bar>%d<bar>call <SID>LocalRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))<bar>redraw!<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2507 nnoremap <buffer> <silent> - :exe "norm! 0"<bar>call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,'../'))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2508 nnoremap <buffer> <silent> a :let g:netrw_hide=(g:netrw_hide+1)%3<bar>exe "norm! 0"<bar>call <SID>LocalRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))<cr>
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2509 if w:netrw_longlist != 2
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2510 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
2511 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
2512 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2513 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
2514 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
2515 nnoremap <buffer> <silent> c :exe "cd ".b:netrw_curdir<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2516 nnoremap <buffer> <silent> d :call <SID>NetMakeDir("")<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2517 nnoremap <buffer> <silent> <c-h> :call <SID>NetHideEdit(1)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2518 nnoremap <buffer> <silent> i :call <SID>NetLongList(1)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2519 nnoremap <buffer> <silent> o :call <SID>NetSplit(2)<cr>
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2520 nnoremap <buffer> <silent> O :call <SID>LocalObtain()<cr>
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2521 nnoremap <buffer> <silent> p :call <SID>LocalPreview(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord(),1))<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2522 nnoremap <buffer> <silent> q :<c-u>call <SID>NetBookmarkDir(2,b:netrw_curdir)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2523 nnoremap <buffer> <silent> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>LocalRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,'./'))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2524 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
2525 nnoremap <buffer> <silent> S :call <SID>NetSortSequence(1)<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2526 nnoremap <buffer> <silent> u :<c-u>call <SID>NetBookmarkDir(4,expand("%"))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2527 nnoremap <buffer> <silent> U :<c-u>call <SID>NetBookmarkDir(5,expand("%"))<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2528 nnoremap <buffer> <silent> v :call <SID>NetSplit(3)<cr>
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2529 nnoremap <buffer> <silent> x :call <SID>NetBrowseX(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord(),0),0)"<cr>
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2530 nnoremap <buffer> <silent> <2-leftmouse> :call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr>
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2531 nnoremap <buffer> <silent> <s-up> :Pexplore<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2532 nnoremap <buffer> <silent> <s-down> :Nexplore<cr>
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2533 exe 'nnoremap <buffer> <silent> <del> :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2534 exe 'vnoremap <buffer> <silent> <del> :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2535 exe 'nnoremap <buffer> <silent> D :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2536 exe 'vnoremap <buffer> <silent> D :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2537 exe 'nnoremap <buffer> <silent> R :call <SID>LocalBrowseRename("'.b:netrw_curdir.'")<cr>'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2538 exe 'vnoremap <buffer> <silent> R :call <SID>LocalBrowseRename("'.b:netrw_curdir.'")<cr>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2539 exe 'nnoremap <buffer> <silent> <Leader>m :call <SID>NetMakeDir("")<cr>'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2540 nnoremap <buffer> ? :he netrw-dir<cr>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2541
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2542 " Set up the banner
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2543 " call Decho("set up banner")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2544 keepjumps put ='\" ============================================================================'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2545 keepjumps 1d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2546 keepjumps put ='\" Directory Listing (netrw '.g:loaded_netrw.')'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2547 keepjumps put ='\" '.b:netrw_curdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2548 let w:netrw_bannercnt= 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2549
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2550 let sortby= g:netrw_sort_by
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2551 if g:netrw_sort_direction =~ "^r"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2552 let sortby= sortby." reversed"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2553 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2554
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2555 " Sorted by...
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2556 if g:netrw_sort_by =~ "^n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2557 " call Decho("directories will be sorted by name")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2558 " sorted by name
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2559 keepjumps put ='\" Sorted by '.sortby
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2560 keepjumps put ='\" Sort sequence: '.g:netrw_sort_sequence
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2561 let w:netrw_bannercnt= w:netrw_bannercnt + 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2562 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2563 " call Decho("directories will be sorted by size or date")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2564 " sorted by size or date
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2565 keepjumps put ='\" Sorted by '.sortby
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2566 let w:netrw_bannercnt= w:netrw_bannercnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2567 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2568
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2569 " Hiding... -or- Showing...
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2570 if g:netrw_list_hide != "" && g:netrw_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2571 if g:netrw_hide == 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2572 keepjumps put ='\" Hiding: '.g:netrw_list_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2573 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2574 keepjumps put ='\" Showing: '.g:netrw_list_hide
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2575 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2576 let w:netrw_bannercnt= w:netrw_bannercnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2577 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2578 keepjumps put ='\" Quick Help: ?:help -:go up dir D:delete R:rename s:sort-by x:exec'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2579 keepjumps put ='\" ============================================================================'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2580 let w:netrw_bannercnt= w:netrw_bannercnt + 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2581
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2582 " bannercnt should index the line just after the banner
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2583 let w:netrw_bannercnt= w:netrw_bannercnt + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2584 " call Decho("bannercnt=".w:netrw_bannercnt)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2585
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2586 " generate the requested directory listing
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2587 call s:LocalBrowseList()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2588
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2589 " set up syntax highlighting
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2590 if has("syntax")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2591 setlocal ft=netrwlist
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2592 if !exists("g:syntax_on") || !g:syntax_on
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2593 setlocal ft=
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2594 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2595 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2596
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2597 " manipulate the directory listing (hide, sort)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2598 if line("$") >= w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2599 if g:netrw_hide && g:netrw_list_hide != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2600 call s:NetrwListHide()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2601 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2602 if line("$") >= w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2603
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2604 if g:netrw_sort_by =~ "^n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2605 call s:SetSort()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2606
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2607 if g:netrw_sort_direction =~ 'n'
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2608 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2609 else
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2610 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2611 endif
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2612 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{3}\///e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2613
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2614 else
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2615 if g:netrw_sort_direction =~ 'n'
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2616 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2617 else
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2618 exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2619 endif
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2620 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{-}\///e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2621 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2622
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2623 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2624 endif
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2625
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2626 call s:NetrwWideListing()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2627 if exists("w:netrw_bannercnt") && line("$") > w:netrw_bannercnt
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2628 " place cursor on the top-left corner of the file listing
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2629 exe 'silent '.w:netrw_bannercnt
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2630 norm! 0
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2631 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2632
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2633 " record previous current directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2634 let w:netrw_prvdir= b:netrw_curdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2635
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2636 " save certain window-oriented variables into buffer-oriented variables
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2637 call s:SetBufWinVars()
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2638 call s:NetOptionRestore()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2639 setlocal noma nomod nonu bh=hide nobl
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2640
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2641 " call Dret("DirBrowse : file<".expand("%:p")."> bufname<".bufname("%").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2642 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2643
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2644 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2645 " LocalBrowseList: does the job of "ls" for local directories {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2646 fun! s:LocalBrowseList()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2647 " call Dfunc("LocalBrowseList() b:netrw_curdir<".b:netrw_curdir.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2648
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2649 " get the list of files contained in the current directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2650 let dirname = escape(b:netrw_curdir,s:netrw_glob_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2651 let dirnamelen = strlen(b:netrw_curdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2652 let filelist = glob(dirname."/*")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2653 " call Decho("glob(dirname<".dirname.">,*)=".filelist)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2654 if filelist != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2655 let filelist= filelist."\n"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2656 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2657 let filelist= filelist.glob(dirname."/.*")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2658 " call Decho("glob(dirname<".dirname.">,.*)=".glob(dirname.".*"))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2659
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2660 " if the directory name includes a "$", and possibly other characters,
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2661 " the glob() doesn't include "." and ".." entries.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2662 if filelist !~ '[\\/]\.[\\/]\=\(\n\|$\)'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2663 " call Decho("forcibly tacking on .")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2664 if filelist == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2665 let filelist= dirname."."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2666 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2667 let filelist= filelist."\n".b:netrw_curdir."."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2668 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2669 " call Decho("filelist<".filelist.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2670 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2671 if filelist !~ '[\\/]\.\.[\\/]\=\(\n\|$\)'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2672 " call Decho("forcibly tacking on ..")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2673 let filelist= filelist."\n".b:netrw_curdir.".."
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2674 " call Decho("filelist<".filelist.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2675 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2676 let filelist= substitute(filelist,'\n\{2,}','\n','ge')
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2677 let filelist= substitute(filelist,'\','/','ge')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2678
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2679 " call Decho("dirname<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2680 " call Decho("dirnamelen<".dirnamelen.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2681 " call Decho("filelist<".filelist.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2682
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2683 while filelist != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2684 if filelist =~ '\n'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2685 let filename = substitute(filelist,'\n.*$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2686 let filelist = substitute(filelist,'^.\{-}\n\(.*\)$','\1','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2687 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2688 let filename = filelist
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2689 let filelist = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2690 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2691 let pfile= filename
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2692 if isdirectory(filename)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2693 let pfile= filename."/"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2694 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2695 if pfile =~ '//$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2696 let pfile= substitute(pfile,'//$','/','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2697 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2698 let pfile= strpart(pfile,dirnamelen)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2699 let pfile= substitute(pfile,'^/','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2700 " call Decho(" ")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2701 " call Decho("filename<".filename.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2702 " call Decho("pfile <".pfile.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2703
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2704 if w:netrw_longlist == 1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2705 let sz = getfsize(filename)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2706 let fsz = strpart(" ",1,15-strlen(sz)).sz
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2707 let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename))
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2708 " call Decho("sz=".sz." fsz=".fsz)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2709 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2710
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2711 if g:netrw_sort_by =~ "^t"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2712 " sort by time (handles time up to 1 quintillion seconds, US)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2713 " call Decho("getftime(".filename.")=".getftime(filename))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2714 let t = getftime(filename)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2715 let ft = strpart("000000000000000000",1,18-strlen(t)).t
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2716 " call Decho("exe keepjumps put ='".ft.'/'.filename."'")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2717 let ftpfile= ft.'/'.pfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2718 keepjumps put=ftpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2719
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2720 elseif g:netrw_sort_by =~ "^s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2721 " sort by size (handles file sizes up to 1 quintillion bytes, US)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2722 " call Decho("getfsize(".filename.")=".getfsize(filename))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2723 let sz = getfsize(filename)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2724 let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2725 " call Decho("exe keepjumps put ='".fsz.'/'.filename."'")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2726 let fszpfile= fsz.'/'.pfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2727 keepjumps put =fszpfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2728
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2729 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2730 " sort by name
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2731 " call Decho("exe keepjumps put ='".pfile."'")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2732 keepjumps put=pfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2733 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2734 endwhile
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2735
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
2736 " cleanup any windows mess at end-of-line
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
2737 silent! keepjumps %s/\r$//e
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2738 setlocal ts=32
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2739
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2740 " call Dret("LocalBrowseList")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2741 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2742
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2743 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2744 " LocalBrowseChgDir: constructs a new directory based on the current {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2745 " directory and a new directory name
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2746 fun! s:LocalBrowseChgDir(dirname,newdir,...)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2747 " call Dfunc("LocalBrowseChgDir(dirname<".a:dirname."> newdir<".a:newdir.">) a:0=".a:0)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2748
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2749 let dirname= substitute(a:dirname,'\\','','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2750 let newdir = a:newdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2751
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2752 if dirname !~ '[\/]$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2753 " apparently vim is "recognizing" that it is in the home directory and
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2754 " is removing the "/". Bad idea, so I have to put it back.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2755 let dirname= dirname.'/'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2756 " call Decho("adjusting dirname<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2757 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2758
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2759 if newdir !~ '[\/]$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2760 " handling a file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2761 let dirname= dirname.newdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2762 " call Decho("handling a file: dirname<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2763 " this lets NetBrowseX avoid the edit
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2764 if a:0 < 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2765 " call Decho("dirname<".dirname."> netrw_cd_escape<".s:netrw_cd_escape.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2766 " call Decho("about to edit<".escape(dirname,s:netrw_cd_escape).">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2767 exe "e! ".escape(dirname,s:netrw_cd_escape)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2768 set ma nomod
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2769 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2770
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2771 elseif newdir == './'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2772 " refresh the directory list
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2773 " call Decho("refresh directory listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2774
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2775 elseif newdir == '../'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2776 " go up one directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2777 let dirname= substitute(dirname,'^\(.*/\)\([^/]\+[\/]$\)','\1','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2778 " call Decho("go up one dir: dirname<".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2779
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2780 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2781 " go down one directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2782 let dirname= dirname.newdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2783 " call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2784 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2785
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2786 " call Dret("LocalBrowseChgDir <".dirname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2787 return dirname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2788 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2789
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2790 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2791 " LocalBrowseRm: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2792 fun! s:LocalBrowseRm(path) range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2793 " call Dfunc("LocalBrowseRm(path<".a:path.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2794 " call Decho("firstline=".a:firstline." lastline=".a:lastline)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2795
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2796 " preparation for removing multiple files/directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2797 let ctr = a:firstline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2798 let ret = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2799 let all= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2800
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2801 " remove multiple files and directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2802 while ctr <= a:lastline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2803 exe "keepjumps ".ctr
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2804
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2805 " sanity checks
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2806 if line(".") < w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2807 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2808 continue
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2809 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2810 let curword= s:NetGetWord()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2811 if curword == "./" || curword == "../"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2812 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2813 continue
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2814 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2815
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2816 norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2817 let rmfile= a:path."/".curword
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2818 " call Decho("rmfile<".rmfile.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2819
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2820 if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2821 " attempt to remove file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2822 if !all
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2823 echohl Statement
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2824 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2825 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
2826 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2827 echohl NONE
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2828 let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2829 if ok =~ 'a\%[ll]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2830 let all= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2831 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2832 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2833
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2834 if all || ok =~ 'y\%[es]' || ok == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2835 let ret= delete(rmfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2836 " call Decho("errcode=".v:shell_error." ret=".ret)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2837 elseif ok =~ 'q\%[uit]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2838 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2839 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2840
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2841 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2842 " attempt to remove directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2843 if !all
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2844 echohl Statement
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2845 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2846 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
2847 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2848 let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2849 if ok =~ 'a\%[ll]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2850 let all= 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2851 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2852 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2853 let rmfile= substitute(rmfile,'[\/]$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2854
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2855 if all || ok =~ 'y\%[es]' || ok == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2856 " call Decho("1st attempt: system(".g:netrw_local_rmdir.' "'.rmfile.'")')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2857 call system(g:netrw_local_rmdir.' "'.rmfile.'"')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2858 " call Decho("v:shell_error=".v:shell_error)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2859
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2860 if v:shell_error != 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2861 " call Decho("2nd attempt to remove directory<".rmfile.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2862 let errcode= delete(rmfile)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2863 " call Decho("errcode=".errcode)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2864
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2865 if errcode != 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2866 if has("unix")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2867 " call Decho("3rd attempt to remove directory<".rmfile.">")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2868 call system("rm ".rmfile)
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2869 if v:shell_error != 0 && !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2870 echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2871 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2872 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2873 elseif !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2874 echohl Error | echo "***netrw*** unable to remove directory<".rmfile."> -- is it empty?" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2875 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2876 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2877 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2878 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2879
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2880 elseif ok =~ 'q\%[uit]'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2881 break
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2882 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2883 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2884
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2885 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2886 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2887
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2888 " refresh the directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2889 let curline= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2890 " call Decho("refresh the directory")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2891 call s:LocalRefresh(s:LocalBrowseChgDir(b:netrw_curdir,'./'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2892 exe curline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2893
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2894 " call Dret("LocalBrowseRm")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2895 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2896
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2897 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2898 " LocalBrowseRename: rename a remote file or directory {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2899 fun! s:LocalBrowseRename(path) range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2900 " call Dfunc("LocalBrowseRename(path<".a:path.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2901
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2902 " preparation for removing multiple files/directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2903 let ctr= a:firstline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2904
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2905 " attempt to rename files/directories
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2906 while ctr <= a:lastline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2907 exe "keepjumps ".ctr
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2908
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2909 " sanity checks
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2910 if line(".") < w:netrw_bannercnt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2911 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2912 continue
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2913 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2914 let curword= s:NetGetWord()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2915 if curword == "./" || curword == "../"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2916 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2917 continue
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2918 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2919
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2920 norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2921 let oldname= a:path."/".curword
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2922 " call Decho("oldname<".oldname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2923
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2924 call inputsave()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2925 let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2926 call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2927
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2928 let ret= rename(oldname,newname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2929 " call Decho("renaming <".oldname."> to <".newname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2930
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2931 let ctr= ctr + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2932 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2933
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2934 " refresh the directory
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2935 let curline= line(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2936 " call Decho("refresh the directory listing")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2937 call s:LocalRefresh(s:LocalBrowseChgDir(b:netrw_curdir,'./'))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2938 exe "keepjumps ".curline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2939 " call Dret("LocalBrowseRename")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2940 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2941
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2942 " ---------------------------------------------------------------------
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2943 " LocalObtain: copy selected file to current working directory {{{2
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2944 fun! s:LocalObtain()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2945 " call Dfunc("LocalObtain()")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2946 if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2947 let fname= expand("<cWORD>")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2948 let fcopy= readfile(b:netrw_curdir."/".fname,"b")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2949 call writefile(fcopy,getcwd()."/".fname,"b")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2950 elseif !exists("b:netrw_curdir")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2951 echohl Error | echo "***netrw*** local browsing directory doesn't exist!"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2952 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2953 else
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2954 echohl Error | echo "***netrw*** local browsing directory and current directory are identical"
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2955 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2956 endif
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2957 " call Dret("LocalObtain")
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2958 endfun
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2959
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
2960 " ---------------------------------------------------------------------
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2961 " LocalPreview: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2962 fun! s:LocalPreview(path) range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2963 " call Dfunc("LocalPreview(path<".a:path.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2964 if has("quickfix")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2965 if !isdirectory(a:path)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2966 exe "pedit ".a:path
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2967 elseif !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2968 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
2969 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2970 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2971 elseif !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2972 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
2973 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2974 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2975 " call Dret("LocalPreview")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2976 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2977
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2978 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2979 " LocalRefresh: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2980 fun! s:LocalRefresh(dirname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2981 " call Dfunc("LocalRefresh(dirname<".a:dirname.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2982 set ma
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2983 %d
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2984 call s:LocalBrowse(a:dirname)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2985 redraw!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2986 " call Dret("LocalRefresh")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2987 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2988
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2989 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2990 " Explore: launch the local browser in the directory of the current file {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2991 " dosplit==0: the window will be split iff the current file has
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2992 " been modified
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2993 " dosplit==1: the window will be split before running the local
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2994 " browser
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2995 fun! netrw#Explore(indx,dosplit,style,...)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2996 " call Dfunc("Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2997
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2998 " if dosplit or file has been modified
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
2999 if a:dosplit || &modified
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3000 call <SID>SaveWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3001
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3002 if a:style == 0 " Explore, Sexplore
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3003 exe g:netrw_winsize."wincmd s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3004 " call Decho("style=0: Explore or Sexplore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3005
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3006 elseif a:style == 1 "Explore!, Sexplore!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3007 exe g:netrw_winsize."wincmd v"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3008 " call Decho("style=1: Explore! or Sexplore!")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3009
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3010 elseif a:style == 2 " Hexplore
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3011 exe "bel ".g:netrw_winsize."wincmd s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3012 " call Decho("style=2: Hexplore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3013
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3014 elseif a:style == 3 " Hexplore!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3015 exe "abo ".g:netrw_winsize."wincmd s"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3016 " call Decho("style=3: Hexplore!")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3017
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3018 elseif a:style == 4 " Vexplore
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3019 exe "lefta ".g:netrw_winsize."wincmd v"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3020 " call Decho("style=4: Vexplore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3021
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3022 elseif a:style == 5 " Vexplore!
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3023 exe "rightb ".g:netrw_winsize."wincmd v"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3024 " call Decho("style=5: Vexplore!")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3025 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3026 call s:CopyWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3027 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3028 norm! 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3029
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3030 if a:1 == "" && a:indx >= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3031 " Explore Hexplore Vexplore Sexplore
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3032 let newdir= substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3033 if newdir =~ '^scp:' || newdir =~ '^ftp:'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3034 " call Decho("calling NetBrowse(newdir<".newdir.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3035 call s:NetBrowse(newdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3036 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3037 " call Decho("calling LocalBrowse(newdir<".newdir.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3038 call s:LocalBrowse(newdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3039 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3040
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3041 elseif a:1 =~ '\*\*/' || a:indx < 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3042 " Nexplore Pexplore -or- Explore **/...
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3043
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3044 if has("path_extra")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3045 if !exists("w:netrw_explore_indx")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3046 let w:netrw_explore_indx= 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3047 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3048 let indx = a:indx
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3049 if indx == -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3050 let indx= w:netrw_explore_indx + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3051 elseif indx == -2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3052 let indx= w:netrw_explore_indx - 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3053 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3054 let w:netrw_explore_indx = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3055 if !exists("b:netrw_curdir")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3056 let b:netrw_curdir= getcwd()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3057 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3058 let w:netrw_explore_list = split(expand(b:netrw_curdir."/".a:1),'\n')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3059 let w:netrw_explore_listlen = len(w:netrw_explore_list)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3060 if w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3061 echohl WarningMsg | echo "***netrw*** no files matched" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3062 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3063 " call Dret("Explore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3064 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3065 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3066 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3067
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3068 " NetrwStatusLine support - for exploring support
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3069 let w:netrw_explore_indx= indx
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3070 " call Decho("explorelist<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3071
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3072 " sanity check
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3073 if indx >= w:netrw_explore_listlen || indx < 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3074 let indx= (indx < 0)? 0 : ( w:netrw_explore_listlen - 1 )
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3075 echohl WarningMsg | echo "***netrw*** no more files match Explore pattern" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3076 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3077 " call Dret("Explore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3078 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3079 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3080
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3081 exe "let dirfile= w:netrw_explore_list[".indx."]"
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3082 " call Decho("dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3083 let newdir= substitute(dirfile,'/[^/]*$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3084 " call Decho("newdir<".newdir.">")
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3085
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3086 " call Decho("calling LocalBrowse(newdir<".newdir.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3087 call s:LocalBrowse(newdir)
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3088 if w:netrw_longlist == 0 || w:netrw_longlist == 1
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3089 call search('^'.substitute(dirfile,"^.*/","","").'\>',"W")
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3090 else
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3091 call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w")
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3092 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3093 let w:netrw_explore_mtchcnt = indx + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3094 let w:netrw_explore_bufnr = bufnr(".")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3095 let w:netrw_explore_line = line(".")
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3096 call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}')
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3097 " 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
3098
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3099 else
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3100 if !exists("g:netrw_quiet")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3101 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
3102 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3103 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3104 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3105
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3106 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3107 let newdir= a:1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3108 " call Decho("calling LocalBrowse(newdir<".newdir.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3109 call s:LocalBrowse(newdir)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3110 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3111
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3112 " call Dret("Explore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3113 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3114
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3115 " ---------------------------------------------------------------------
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3116 " SetupNetrwStatusLine: {{{2
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3117 fun! s:SetupNetrwStatusLine(statline)
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3118 " call Dfunc("SetupNetrwStatusLine(statline<".a:statline.">)")
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3119
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3120 if !exists("s:netrw_setup_statline")
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3121 let s:netrw_setup_statline= 1
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3122 " call Decho("do first-time status line setup")
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3123
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3124 if !exists("s:netrw_users_stl")
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3125 let s:netrw_users_stl= &stl
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3126 endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3127 if !exists("s:netrw_users_ls")
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3128 let s:netrw_users_ls= &laststatus
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3129 endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3130
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3131 " set up User9 highlighting as needed
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3132 let keepa= @a
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3133 redir @a
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3134 try
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3135 hi User9
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3136 catch /^Vim\%((\a\+)\)\=:E411/
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3137 if &bg == "dark"
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3138 hi User9 ctermfg=yellow ctermbg=blue guifg=yellow guibg=blue
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3139 else
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3140 hi User9 ctermbg=yellow ctermfg=blue guibg=yellow guifg=blue
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3141 endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3142 endtry
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3143 redir END
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3144 let @a= keepa
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3145 endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3146
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3147 " set up status line (may use User9 highlighting)
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3148 " insure that windows have a statusline
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3149 " make sure statusline is displayed
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3150 let &stl=a:statline
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3151 set laststatus=2
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3152 " call Decho("stl=".&stl)
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3153 redraw!
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3154
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3155 " call Dret("SetupNetrwStatusLine : stl=".&stl)
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3156 endfun
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3157
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3158 " ---------------------------------------------------------------------
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3159 " NetrwStatusLine: {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3160 fun! NetrwStatusLine()
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3161
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3162 " vvv NetrwStatusLine() debugging vvv
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3163 " let g:stlmsg=""
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3164 " if !exists("w:netrw_explore_bufnr")
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3165 " let g:stlmsg="!X<explore_bufnr>"
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3166 " elseif w:netrw_explore_bufnr != bufnr(".")
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3167 " let g:stlmsg="explore_bufnr!=".bufnr(".")
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3168 " endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3169 " if !exists("w:netrw_explore_line")
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3170 " let g:stlmsg=" !X<explore_line>"
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3171 " elseif w:netrw_explore_line != line(".")
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3172 " let g:stlmsg=" explore_line!={line(.)<".line(".").">"
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3173 " endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3174 " if !exists("w:netrw_explore_list")
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3175 " let g:stlmsg=" !X<explore_list>"
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3176 " endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3177 " ^^^ NetrwStatusLine() debugging ^^^
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3178
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3179 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
3180 " restore user's status line
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3181 let &stl = s:netrw_users_stl
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3182 let &laststatus = s:netrw_users_ls
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3183 if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3184 if exists("w:netrw_explore_line")|unlet w:netrw_explore_line|endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3185 return ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3186 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3187 return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3188 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3189 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3190
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3191 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3192 " NetGetcwd: get the current directory. {{{2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3193 " Change backslashes to forward slashes, if any.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3194 " If doesc is true, escape certain troublesome characters
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3195 fun! s:NetGetcwd(doesc)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3196 " call Dfunc("NetGetcwd(doesc=".a:doesc.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3197 let curdir= substitute(getcwd(),'\\','/','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3198 if curdir !~ '[\/]$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3199 let curdir= curdir.'/'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3200 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3201 if a:doesc
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3202 let curdir= escape(curdir,s:netrw_cd_escape)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3203 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3204 " call Dret("NetGetcwd <".curdir.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3205 return curdir
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3206 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3207
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3208 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3209 " NetMethod: determine method of transfer {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3210 " method == 1: rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3211 " 2: ftp + <.netrc>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3212 " 3: ftp + machine, id, password, and [path]filename
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3213 " 4: scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3214 " 5: http (wget)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3215 " 6: cadaver
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3216 " 7: rsync
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3217 " 8: fetch
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3218 " 9: sftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3219 fun! s:NetMethod(choice) " globals: method machine id passwd fname
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3220 " call Dfunc("NetMethod(a:choice<".a:choice.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3221
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3222 " initialization
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3223 let b:netrw_method = 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3224 let g:netrw_machine = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3225 let b:netrw_fname = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3226 let g:netrw_port = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3227
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3228 " Patterns:
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3229 " mipf : a:machine a:id password filename Use ftp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3230 " mf : a:machine filename Use ftp + <.netrc> or g:netrw_uid g:netrw_passwd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3231 " 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
3232 " rcpurm : rcp://[user@]host/filename Use rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3233 " rcphf : [user@]host:filename Use rcp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3234 " scpurm : scp://[user@]host[[#:]port]/filename Use scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3235 " httpurm : http://[user@]host/filename Use wget
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3236 " davurm : [s]dav://host[:port]/path Use cadaver
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3237 " rsyncurm : rsync://host[:port]/path Use rsync
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3238 " fetchurm : fetch://[user@]host[:http]/filename Use fetch (defaults to ftp, override for http)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3239 " sftpurm : sftp://[user@]host/filename Use scp
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3240 let mipf = '^\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)\s\+\(\S\+\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3241 let mf = '^\(\S\+\)\s\+\(\S\+\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3242 let ftpurm = '^ftp://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3243 let rcpurm = '^rcp://\%(\([^/@]\{-}\)@\)\=\([^/]\{-}\)/\(.*\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3244 let rcphf = '^\(\(\h\w*\)@\)\=\(\h\w*\):\([^@]\+\)$'
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3245 let scpurm = '^scp://\([^/#:]\+\)\%([#:]\(\d\+\)\)\=/\(.*\)$'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3246 let httpurm = '^http://\([^/]\{-}\)\(/.*\)\=$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3247 let davurm = '^s\=dav://\([^/]\+\)/\(.*/\)\([-_.~[:alnum:]]\+\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3248 let rsyncurm = '^rsync://\([^/]\{-}\)/\(.*\)\=$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3249 let fetchurm = '^fetch://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\(:http\)\=/\(.*\)$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3250 let sftpurm = '^sftp://\([^/]\{-}\)/\(.*\)\=$'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3251
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3252 " call Decho("determine method:")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3253 " Determine Method
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3254 " rcp://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3255 if match(a:choice,rcpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3256 " call Decho("rcp://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3257 let b:netrw_method = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3258 let userid = substitute(a:choice,rcpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3259 let g:netrw_machine = substitute(a:choice,rcpurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3260 let b:netrw_fname = substitute(a:choice,rcpurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3261 if userid != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3262 let g:netrw_uid= userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3263 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3264
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3265 " scp://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3266 elseif match(a:choice,scpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3267 " call Decho("scp://...")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3268 let b:netrw_method = 4
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3269 let g:netrw_machine = substitute(a:choice,scpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3270 let g:netrw_port = substitute(a:choice,scpurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3271 let b:netrw_fname = substitute(a:choice,scpurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3272
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3273 " http://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3274 elseif match(a:choice,httpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3275 " call Decho("http://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3276 let b:netrw_method = 5
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3277 let g:netrw_machine= substitute(a:choice,httpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3278 let b:netrw_fname = substitute(a:choice,httpurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3279
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3280 " dav://hostname[:port]/..path-to-file..
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3281 elseif match(a:choice,davurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3282 " call Decho("dav://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3283 let b:netrw_method= 6
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3284 if a:choice =~ '^s'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3285 let g:netrw_machine= 'https://'.substitute(a:choice,davurm,'\1/\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3286 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3287 let g:netrw_machine= 'http://'.substitute(a:choice,davurm,'\1/\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3288 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3289 let b:netrw_fname = substitute(a:choice,davurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3290
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3291 " rsync://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3292 elseif match(a:choice,rsyncurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3293 " call Decho("rsync://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3294 let b:netrw_method = 7
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3295 let g:netrw_machine= substitute(a:choice,rsyncurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3296 let b:netrw_fname = substitute(a:choice,rsyncurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3297
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3298 " ftp://[user@]hostname[[:#]port]/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3299 elseif match(a:choice,ftpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3300 " call Decho("ftp://...")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3301 let userid = substitute(a:choice,ftpurm,'\2',"")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3302 let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3303 let g:netrw_port = substitute(a:choice,ftpurm,'\4',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3304 let b:netrw_fname = substitute(a:choice,ftpurm,'\5',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3305 if userid != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3306 let g:netrw_uid= userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3307 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3308 if exists("g:netrw_uid") && exists("g:netrw_passwd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3309 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3310 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3311 if filereadable(expand("$HOME/.netrc")) && !exists("g:netrw_ignorenetrc")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3312 let b:netrw_method= 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3313 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3314 if !exists("g:netrw_uid") || g:netrw_uid == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3315 call NetUserPass()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3316 elseif !exists("g:netrw_passwd") || g:netrw_passwd == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3317 call NetUserPass(g:netrw_uid)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3318 " else just use current g:netrw_uid and g:netrw_passwd
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3319 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3320 let b:netrw_method= 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3321 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3322 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3323
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3324 elseif match(a:choice,fetchurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3325 " call Decho("fetch://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3326 let b:netrw_method = 8
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3327 let g:netrw_userid = substitute(a:choice,fetchurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3328 let g:netrw_machine= substitute(a:choice,fetchurm,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3329 let b:netrw_option = substitute(a:choice,fetchurm,'\4',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3330 let b:netrw_fname = substitute(a:choice,fetchurm,'\5',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3331
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3332 " Issue an ftp : "machine id password [path/]filename"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3333 elseif match(a:choice,mipf) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3334 " call Decho("(ftp) host id pass file")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3335 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3336 let g:netrw_machine = substitute(a:choice,mipf,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3337 let g:netrw_uid = substitute(a:choice,mipf,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3338 let g:netrw_passwd = substitute(a:choice,mipf,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3339 let b:netrw_fname = substitute(a:choice,mipf,'\4',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3340
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3341 " Issue an ftp: "hostname [path/]filename"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3342 elseif match(a:choice,mf) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3343 " call Decho("(ftp) host file")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3344 if exists("g:netrw_uid") && exists("g:netrw_passwd")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3345 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3346 let g:netrw_machine = substitute(a:choice,mf,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3347 let b:netrw_fname = substitute(a:choice,mf,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3348
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3349 elseif filereadable(expand("$HOME/.netrc"))
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3350 let b:netrw_method = 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3351 let g:netrw_machine = substitute(a:choice,mf,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3352 let b:netrw_fname = substitute(a:choice,mf,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3353 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3354
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3355 " sftp://user@hostname/...path-to-file
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3356 elseif match(a:choice,sftpurm) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3357 " call Decho("sftp://...")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3358 let b:netrw_method = 9
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3359 let g:netrw_machine= substitute(a:choice,sftpurm,'\1',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3360 let b:netrw_fname = substitute(a:choice,sftpurm,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3361
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3362 " Issue an rcp: hostname:filename" (this one should be last)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3363 elseif match(a:choice,rcphf) == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3364 " call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3365 let b:netrw_method = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3366 let userid = substitute(a:choice,rcphf,'\2',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3367 let g:netrw_machine= substitute(a:choice,rcphf,'\3',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3368 let b:netrw_fname = substitute(a:choice,rcphf,'\4',"")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3369 " call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3370 " call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3371 " call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3372 " call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3373 if userid != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3374 let g:netrw_uid= userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3375 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3376 if has("win32") || has("win95") || has("win64") || has("win16")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3377 " don't let PCs try <.netrc>
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3378 let b:netrw_method = 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3379 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3380
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3381 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3382 if !exists("g:netrw_quiet")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3383 echohl Error | echo "***netrw*** cannot determine method" | echohl None
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3384 call inputsave()|call input("Press <cr> to continue")|call inputrestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3385 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3386 let b:netrw_method = -1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3387 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3388
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3389 " remove any leading [:#] from port number
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3390 if g:netrw_port != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3391 let g:netrw_port = substitute(g:netrw_port,'[#:]\+','','')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3392 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3393
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3394 " call Decho("a:choice <".a:choice.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3395 " call Decho("b:netrw_method <".b:netrw_method.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3396 " call Decho("g:netrw_machine<".g:netrw_machine.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3397 " call Decho("g:netrw_port <".g:netrw_port.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3398 " if exists("g:netrw_uid") "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3399 " call Decho("g:netrw_uid <".g:netrw_uid.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3400 " endif "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3401 " if exists("g:netrw_passwd") "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3402 " call Decho("g:netrw_passwd <".g:netrw_passwd.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3403 " endif "Decho
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3404 " call Decho("b:netrw_fname <".b:netrw_fname.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3405 " call Dret("NetMethod")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3406 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3407
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3408 " ------------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3409 " NetUserPass: set username and password for subsequent ftp transfer {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3410 " Usage: :call NetUserPass() -- will prompt for userid and password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3411 " :call NetUserPass("uid") -- will prompt for password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3412 " :call NetUserPass("uid","password") -- sets global userid and password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3413 fun! NetUserPass(...)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3414
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3415 " get/set userid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3416 if a:0 == 0
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3417 " call Dfunc("NetUserPass(a:0<".a:0.">)")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3418 if !exists("g:netrw_uid") || g:netrw_uid == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3419 " via prompt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3420 let g:netrw_uid= input('Enter username: ')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3421 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3422 else " from command line
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3423 " call Dfunc("NetUserPass(a:1<".a:1.">) {")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3424 let g:netrw_uid= a:1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3425 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3426
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3427 " get password
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3428 if a:0 <= 1 " via prompt
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3429 " call Decho("a:0=".a:0." case <=1:")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3430 let g:netrw_passwd= inputsecret("Enter Password: ")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3431 else " from command line
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3432 " call Decho("a:0=".a:0." case >1: a:2<".a:2.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3433 let g:netrw_passwd=a:2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3434 endif
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3435
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3436 " call Dret("NetUserPass")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3437 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3438
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3439 " ------------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3440 " NetOptionSave: save options and set to "standard" form {{{1
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3441 fun! s:NetOptionSave()
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3442 " call Dfunc("NetOptionSave()")
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3443 if !exists("w:netoptionsave")
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3444 let w:netoptionsave= 1
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3445 else
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3446 " call Dret("NetOptionSave : netoptionsave=".w:netoptionsave)
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3447 return
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3448 endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3449
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3450 " Get Temporary Filename
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3451 let w:aikeep = &ai
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3452 " record autochdir setting and then insure its unset (tnx to David Fishburn)
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3453 if has("netbeans_intg") || has("sun_workshop")
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3454 let w:acdkeep = &autochdir
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3455 set noautochdir
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3456 endif
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3457 let w:cinkeep = &cin
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3458 let w:cinokeep = &cino
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3459 let w:comkeep = &com
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3460 let w:cpokeep = &cpo
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3461 if !g:netrw_keepdir
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3462 let w:dirkeep = getcwd()
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3463 endif
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3464 let w:gdkeep = &gd
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3465 let w:repkeep = &report
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3466 let w:spellkeep = &spell
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3467 let w:twkeep = &tw
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3468 setlocal cino =
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3469 setlocal com =
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3470 setlocal cpo -=aA
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3471 setlocal nocin noai nospell
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3472 setlocal tw =0
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3473 setlocal report=10000
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3474 if has("win32") && !has("win95")
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3475 let w:swfkeep= &swf
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3476 setlocal noswf
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3477 " call Decho("setting w:swfkeep to <".&swf.">")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3478 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3479
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3480 " call Dret("NetOptionSave")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3481 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3483 " ------------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3484 " NetOptionRestore: restore options {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3485 fun! s:NetOptionRestore()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3486 " call Dfunc("NetOptionRestore()")
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3487 if !exists("w:netoptionsave")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3488 " call Dret("NetOptionRestore : w:netoptionsave doesn't exist")
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3489 return
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3490 endif
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3491 unlet w:netoptionsave
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3492
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3493 if exists("w:aikeep")| let &ai= w:aikeep|endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3494 if (has("netbeans_intg") || has("sun_workshop")) && exists("w:acdkeep")
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3495 let &acd= w:acdkeep
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3496 unlet w:acdkeep
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3497 endif
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3498 if exists("w:cinkeep") |let &cin = w:cinkeep |unlet w:cinkeep |endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3499 if exists("w:cinokeep") |let &cino = w:cinokeep |unlet w:cinokeep |endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3500 if exists("w:comkeep") |let &com = w:comkeep |unlet w:comkeep |endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3501 if exists("w:cpokeep") |let &cpo = w:cpokeep |unlet w:cpokeep |endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3502 if exists("w:dirkeep") |exe "lcd ".w:dirkeep |unlet w:dirkeep |endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3503 if exists("w:gdkeep") |let &gd = w:gdkeep |unlet w:gdkeep |endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3504 if exists("w:repkeep") |let &report = w:repkeep |unlet w:repkeep |endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3505 if exists("w:spellkeep")|let &spell = w:spellkeep |unlet w:spellkeep|endif
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3506 if exists("w:twkeep") |let &tw = w:twkeep |unlet w:twkeep |endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3507 if exists("w:swfkeep")
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3508 if &directory == "" && exists("w:swfkeep")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3509 " user hasn't specified a swapfile directory;
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3510 " netrw will temporarily make the swapfile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3511 " directory the current local one.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3512 let &directory = getcwd()
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3513 silent! let &swf = w:swfkeep
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3514 set directory=
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3515 else
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3516 let &swf= w:swfkeep
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3517 endif
484
f012c4ed8c38 updated for version 7.0132
vimboss
parents: 482
diff changeset
3518 unlet w:swfkeep
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3519 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3520
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3521 " call Dret("NetOptionRestore")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3522 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3523
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3524 " ------------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3525 " NetReadFixup: this sort of function is typically written by the user {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3526 " to handle extra junk that their system's ftp dumps
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3527 " into the transfer. This function is provided as an
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3528 " example and as a fix for a Windows 95 problem: in my
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3529 " experience, win95's ftp always dumped four blank lines
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3530 " at the end of the transfer.
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3531 if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3532 fun! NetReadFixup(method, line1, line2)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3533 " call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3534 if method == 3 " ftp (no <.netrc>)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3535 let fourblanklines= line2 - 3
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3536 silent fourblanklines.",".line2."g/^\s*/d"
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3537 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3538 " call Dret("NetReadFixup")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3539 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3540 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3541
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3542 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3543 " NetSort: Piet Delport's BISort2() function, modified to take a range {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3544 if v:version < 700
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3545 fun! s:NetSort() range
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3546 " " call Dfunc("NetSort()")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3547
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3548 let i = a:firstline + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3549 while i <= a:lastline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3550 " find insertion point via binary search
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3551 let i_val = getline(i)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3552 let lo = a:firstline
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3553 let hi = i
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3554 while lo < hi
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3555 let mid = (lo + hi) / 2
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3556 let mid_val = getline(mid)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3557 if g:netrw_sort_direction =~ '^n'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3558 " normal sorting order
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3559 if i_val < mid_val
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3560 let hi = mid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3561 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3562 let lo = mid + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3563 if i_val == mid_val | break | endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3564 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3565 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3566 " reverse sorting order
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3567 if i_val > mid_val
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3568 let hi = mid
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3569 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3570 let lo = mid + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3571 if i_val == mid_val | break | endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3572 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3573 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3574 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3575 " do insert
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3576 if lo < i
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3577 exe 'keepjumps '.i.'d_'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3578 keepjumps call append(lo - 1, i_val)
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3579 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3580 let i = i + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3581 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3582
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3583 " " call Dret("NetSort")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3584 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3585 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3586
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3587 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3588 " SetSort: sets up the sort based on the g:netrw_sort_sequence {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3589 " What this function does is to compute a priority for the patterns
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3590 " in the g:netrw_sort_sequence. It applies a substitute to any
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3591 " "files" that satisfy each pattern, putting the priority / in
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3592 " front. An "*" pattern handles the default priority.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3593 fun! s:SetSort()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3594 " call Dfunc("SetSort() bannercnt=".w:netrw_bannercnt)
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3595 if w:netrw_longlist == 1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3596 let seqlist = substitute(g:netrw_sort_sequence,'\$','\\%(\t\\|\$\\)','ge')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3597 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3598 let seqlist = g:netrw_sort_sequence
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3599 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3600 " sanity check -- insure that * appears somewhere
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3601 if seqlist == ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3602 let seqlist= '*'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3603 elseif seqlist !~ '\*'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3604 let seqlist= seqlist.',*'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3605 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3606 let priority = 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3607 while seqlist != ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3608 if seqlist =~ ','
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3609 let seq = substitute(seqlist,',.*$','','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3610 let seqlist = substitute(seqlist,'^.\{-},\(.*\)$','\1','e')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3611 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3612 let seq = seqlist
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3613 let seqlist = ""
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3614 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3615 let eseq= escape(seq,'/')
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3616 if priority < 10
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3617 let spriority= "00".priority.'\/'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3618 elseif priority < 100
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3619 let spriority= "0".priority.'\/'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3620 else
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3621 let spriority= priority.'\/'
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3622 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3623 " call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3624
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3625 " sanity check
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3626 if w:netrw_bannercnt > line("$")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3627 " apparently no files were left after a Hiding pattern was used
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3628 " call Dret("SetSort : no files left after hiding")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3629 return
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3630 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3631 if seq == '*'
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3632 exe 'silent keepjumps '.w:netrw_bannercnt.',$v/^\d\{3}\//s/^/'.spriority.'/'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3633 else
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3634 exe 'silent keepjumps '.w:netrw_bannercnt.',$g/'.eseq.'/s/^/'.spriority.'/'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3635 endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3636 let priority = priority + 1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3637 endwhile
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3638
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3639 exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\(\d\{3}\/\)\%(\d\{3}\/\)\+/\1/e'
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3640
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3641 " call Dret("SetSort")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3642 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3643
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3644 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3645 " SaveWinVars: (used by Explore()) {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3646 fun! s:SaveWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3647 " call Dfunc("SaveWinVars()")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3648 if exists("w:netrw_bannercnt") |let s:bannercnt = w:netrw_bannercnt |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3649 if exists("w:netrw_method") |let s:method = w:netrw_method |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3650 if exists("w:netrw_prvdir") |let s:prvdir = w:netrw_prvdir |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3651 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
3652 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
3653 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
3654 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
3655 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
3656 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
3657 " call Dret("SaveWinVars")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3658 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3659
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3660 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3661 " CopyWinVars: (used by Explore()) {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3662 fun! s:CopyWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3663 " call Dfunc("CopyWinVars()")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3664 if exists("s:bannercnt") |let w:netrw_bannercnt = s:bannercnt |unlet s:bannercnt |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3665 if exists("s:method") |let w:netrw_method = s:method |unlet s:method |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3666 if exists("s:prvdir") |let w:netrw_prvdir = s:prvdir |unlet s:prvdir |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3667 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
3668 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
3669 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
3670 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
3671 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
3672 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
3673 " call Dret("CopyWinVars")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3674 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3675
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3676 " ---------------------------------------------------------------------
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3677 " SetBufWinVars: (used by NetBrowse() and LocalBrowse()) {{{1
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3678 " To allow separate windows to have their own activities, such as
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3679 " Explore **/pattern, several variables have been made window-oriented.
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3680 " However, when the user splits a browser window (ex: ctrl-w s), these
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3681 " variables are not inherited by the new window. SetBufWinVars() and
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3682 " UseBufWinVars() get around that.
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3683 fun! s:SetBufWinVars()
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3684 " call Dfunc("SetBufWinVars()")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3685 if exists("w:netrw_longlist") |let b:netrw_longlist = w:netrw_longlist |endif
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3686 if exists("w:netrw_bannercnt") |let b:netrw_bannercnt = w:netrw_bannercnt |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3687 if exists("w:netrw_method") |let b:netrw_method = w:netrw_method |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3688 if exists("w:netrw_prvdir") |let b:netrw_prvdir = w:netrw_prvdir |endif
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3689 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
3690 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
3691 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
3692 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
3693 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
3694 if exists("w:netrw_explore_list") |let b:netrw_explore_list = w:netrw_explore_list |endif
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 532
diff changeset
3695 " call Dret("SetBufWinVars")
482
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3696 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3697
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3698 " ---------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3699 " UseBufWinVars: (used by NetBrowse() and LocalBrowse() {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3700 " Matching function to BufferWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3701 fun! s:UseBufWinVars()
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3702 " call Dfunc("UseBufWinVars()")
519
d50452846776 updated for version 7.0145
vimboss
parents: 484
diff changeset
3703 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
3704 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
3705 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
3706 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
3707 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
3708 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
3709 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
3710 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
3711 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
3712 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
3713 " call Dret("UseBufWinVars")
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3714 endfun
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3715
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3716 " ------------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3717 " Settings Restoration: {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3718 let &cpo= s:keepcpo
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3719 unlet s:keepcpo
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3720
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3721 " ------------------------------------------------------------------------
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3722 " Modelines: {{{1
6f8b578776ab updated for version 7.0131
vimboss
parents:
diff changeset
3723 " vim:ts=8 fdm=marker