annotate runtime/autoload/zip.vim @ 9529:581d5131629f v7.4.2045

commit https://github.com/vim/vim/commit/5ef2e762844e0eb1f5b213bd58e6bc38bdb69dac Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jul 15 21:29:35 2016 +0200 patch 7.4.2045 Problem: Memory leak when using a function callback. Solution: Don't save the function name when it's in the partial.
author Christian Brabandt <cb@256bit.org>
date Fri, 15 Jul 2016 21:30:07 +0200
parents 71e066e10a47
children b7da8d4c594c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
1 " zip.vim: Handles browsing zipfiles
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
2 " AUTOLOAD PORTION
5130
71e066e10a47 updated for version 7.3.1308
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
3 " Date: Jul 02, 2013
71e066e10a47 updated for version 7.3.1308
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
4 " Version: 27
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
5 " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
6 " License: Vim License (see vim's :help license)
5130
71e066e10a47 updated for version 7.3.1308
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
7 " Copyright: Copyright (C) 2005-2013 Charles E. Campbell {{{1
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
8 " Permission is hereby granted to use and distribute this code,
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
9 " with or without modifications, provided that this copyright
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
10 " notice is copied with it. Like anything else that's free,
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1214
diff changeset
11 " zip.vim and zipPlugin.vim are provided *as is* and comes with
82b5078be2dd updated for version 7.2a
vimboss
parents: 1214
diff changeset
12 " no warranty of any kind, either expressed or implied. By using
82b5078be2dd updated for version 7.2a
vimboss
parents: 1214
diff changeset
13 " this plugin, you agree that in no event will the copyright
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
14 " holder be liable for any damages resulting from the use
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
15 " of this software.
5130
71e066e10a47 updated for version 7.3.1308
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
16 "redraw!|call DechoSep()|call inputsave()|call input("Press <cr> to continue")|call inputrestore()
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
17
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
18 " ---------------------------------------------------------------------
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
19 " Load Once: {{{1
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
20 if &cp || exists("g:loaded_zip")
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
21 finish
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
22 endif
5130
71e066e10a47 updated for version 7.3.1308
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
23 let g:loaded_zip= "v27"
2152
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
24 if v:version < 702
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
25 echohl WarningMsg
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
26 echo "***warning*** this version of zip needs vim 7.2"
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
27 echohl Normal
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
28 finish
b9e314fe473f Updated runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1698
diff changeset
29 endif
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
30 let s:keepcpo= &cpo
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
31 set cpo&vim
5130
71e066e10a47 updated for version 7.3.1308
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
32 "DechoTabOn
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
33
798
95dac6af3b3a updated for version 7.0232
vimboss
parents: 623
diff changeset
34 let s:zipfile_escape = ' ?&;\'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
35 let s:ERROR = 2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
36 let s:WARNING = 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
37 let s:NOTE = 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
38
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
39 " ---------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
40 " Global Values: {{{1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
41 if !exists("g:zip_shq")
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1214
diff changeset
42 if &shq != ""
82b5078be2dd updated for version 7.2a
vimboss
parents: 1214
diff changeset
43 let g:zip_shq= &shq
82b5078be2dd updated for version 7.2a
vimboss
parents: 1214
diff changeset
44 elseif has("unix")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
45 let g:zip_shq= "'"
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
46 else
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
47 let g:zip_shq= '"'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
48 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
49 endif
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
50 if !exists("g:zip_zipcmd")
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
51 let g:zip_zipcmd= "zip"
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
52 endif
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
53 if !exists("g:zip_unzipcmd")
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
54 let g:zip_unzipcmd= "unzip"
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
55 endif
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
56
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
57 " ----------------
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
58 " Functions: {{{1
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
59 " ----------------
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
60
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
61 " ---------------------------------------------------------------------
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
62 " zip#Browse: {{{2
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
63 fun! zip#Browse(zipfile)
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
64 " call Dfunc("zip#Browse(zipfile<".a:zipfile.">)")
5130
71e066e10a47 updated for version 7.3.1308
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
65 " sanity check: insure that the zipfile has "PK" as its first two letters
71e066e10a47 updated for version 7.3.1308
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
66 " (zipped files have a leading PK as a "magic cookie")
71e066e10a47 updated for version 7.3.1308
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
67 if !filereadable(a:zipfile) || readfile(a:zipfile, "", 1)[0] !~ '^PK'
71e066e10a47 updated for version 7.3.1308
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
68 exe "noautocmd e ".fnameescape(a:zipfile)
71e066e10a47 updated for version 7.3.1308
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
69 " call Dret("zip#Browse : not a zipfile<".a:zipfile.">")
71e066e10a47 updated for version 7.3.1308
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
70 return
71e066e10a47 updated for version 7.3.1308
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
71 " else " Decho
71e066e10a47 updated for version 7.3.1308
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
72 " call Decho("zip#Browse: a:zipfile<".a:zipfile."> passed PK test - its a zip file")
71e066e10a47 updated for version 7.3.1308
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
73 endif
71e066e10a47 updated for version 7.3.1308
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
74
568
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
75 let repkeep= &report
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
76 set report=10
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
77
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
78 " sanity checks
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
79 if !exists("*fnameescape")
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
80 if &verbose > 1
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
81 echoerr "the zip plugin is not available (your vim doens't support fnameescape())"
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
82 endif
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
83 return
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
84 endif
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
85 if !executable(g:zip_unzipcmd)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
86 redraw!
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
87 echohl Error | echo "***error*** (zip#Browse) unzip not available on your system"
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
88 " call inputsave()|call input("Press <cr> to continue")|call inputrestore()
568
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
89 let &report= repkeep
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
90 " call Dret("zip#Browse")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
91 return
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
92 endif
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
93 if !filereadable(a:zipfile)
557
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
94 if a:zipfile !~# '^\a\+://'
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
95 " if its an url, don't complain, let url-handlers such as vim do its thing
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
96 redraw!
557
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
97 echohl Error | echo "***error*** (zip#Browse) File not readable<".a:zipfile.">" | echohl None
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
98 " call inputsave()|call input("Press <cr> to continue")|call inputrestore()
557
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
99 endif
568
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
100 let &report= repkeep
557
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
101 " call Dret("zip#Browse : file<".a:zipfile."> not readable")
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
102 return
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
103 endif
798
95dac6af3b3a updated for version 7.0232
vimboss
parents: 623
diff changeset
104 " call Decho("passed sanity checks")
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
105 if &ma != 1
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
106 set ma
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
107 endif
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
108 let b:zipfile= a:zipfile
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
109
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
110 setlocal noswapfile
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
111 setlocal buftype=nofile
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
112 setlocal bufhidden=hide
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
113 setlocal nobuflisted
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
114 setlocal nowrap
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
115 set ft=tar
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
116
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
117 " give header
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
118 call append(0, ['" zip.vim version '.g:loaded_zip,
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
119 \ '" Browsing zipfile '.a:zipfile,
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
120 \ '" Select a file with cursor and press ENTER'])
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
121 keepj $
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
122
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
123 " call Decho("exe silent r! ".g:zip_unzipcmd." -l -- ".s:Escape(a:zipfile,1))
3281
af1e8a1714c2 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2908
diff changeset
124 exe "keepj sil! r! ".g:zip_unzipcmd." -Z -1 -- ".s:Escape(a:zipfile,1)
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
125 if v:shell_error != 0
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
126 redraw!
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
127 echohl WarningMsg | echo "***warning*** (zip#Browse) ".fnameescape(a:zipfile)." is not a zip file" | echohl None
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
128 " call inputsave()|call input("Press <cr> to continue")|call inputrestore()
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
129 keepj sil! %d
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
130 let eikeep= &ei
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
131 set ei=BufReadCmd,FileReadCmd
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
132 exe "keepj r ".fnameescape(a:zipfile)
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
133 let &ei= eikeep
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
134 keepj 1d
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
135 " call Dret("zip#Browse")
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
136 return
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
137 endif
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
138
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
139 setlocal noma nomod ro
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
140 noremap <silent> <buffer> <cr> :call <SID>ZipBrowseSelect()<cr>
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
141
568
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
142 let &report= repkeep
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
143 " call Dret("zip#Browse")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
144 endfun
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
145
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
146 " ---------------------------------------------------------------------
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
147 " ZipBrowseSelect: {{{2
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
148 fun! s:ZipBrowseSelect()
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
149 " call Dfunc("ZipBrowseSelect() zipfile<".b:zipfile."> curfile<".expand("%").">")
568
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
150 let repkeep= &report
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
151 set report=10
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
152 let fname= getline(".")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
153
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
154 " sanity check
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
155 if fname =~ '^"'
568
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
156 let &report= repkeep
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
157 " call Dret("ZipBrowseSelect")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
158 return
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
159 endif
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
160 if fname =~ '/$'
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
161 redraw!
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
162 echohl Error | echo "***error*** (zip#Browse) Please specify a file, not a directory" | echohl None
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
163 " call inputsave()|call input("Press <cr> to continue")|call inputrestore()
568
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
164 let &report= repkeep
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
165 " call Dret("ZipBrowseSelect")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
166 return
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
167 endif
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
168
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
169 " call Decho("fname<".fname.">")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
170
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
171 " get zipfile to the new-window
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
172 let zipfile = b:zipfile
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 804
diff changeset
173 let curfile= expand("%")
798
95dac6af3b3a updated for version 7.0232
vimboss
parents: 623
diff changeset
174 " call Decho("zipfile<".zipfile.">")
95dac6af3b3a updated for version 7.0232
vimboss
parents: 623
diff changeset
175 " call Decho("curfile<".curfile.">")
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
176
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
177 new
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1214
diff changeset
178 if !exists("g:zip_nomax") || g:zip_nomax == 0
82b5078be2dd updated for version 7.2a
vimboss
parents: 1214
diff changeset
179 wincmd _
82b5078be2dd updated for version 7.2a
vimboss
parents: 1214
diff changeset
180 endif
557
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
181 let s:zipfile_{winnr()}= curfile
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
182 " call Decho("exe e ".fnameescape("zipfile:".zipfile.'::'.fname))
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
183 exe "e ".fnameescape("zipfile:".zipfile.'::'.fname)
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
184 filetype detect
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
185
568
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
186 let &report= repkeep
557
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
187 " call Dret("ZipBrowseSelect : s:zipfile_".winnr()."<".s:zipfile_{winnr()}.">")
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
188 endfun
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
189
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
190 " ---------------------------------------------------------------------
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
191 " zip#Read: {{{2
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
192 fun! zip#Read(fname,mode)
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
193 " call Dfunc("zip#Read(fname<".a:fname.">,mode=".a:mode.")")
568
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
194 let repkeep= &report
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
195 set report=10
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
196
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
197 if has("unix")
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
198 let zipfile = substitute(a:fname,'zipfile:\(.\{-}\)::[^\\].*$','\1','')
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
199 let fname = substitute(a:fname,'zipfile:.\{-}::\([^\\].*\)$','\1','')
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
200 else
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
201 let zipfile = substitute(a:fname,'^.\{-}zipfile:\(.\{-}\)::[^\\].*$','\1','')
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
202 let fname = substitute(a:fname,'^.\{-}zipfile:.\{-}::\([^\\].*\)$','\1','')
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
203 let fname = substitute(fname, '[', '[[]', 'g')
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
204 endif
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
205 " call Decho("zipfile<".zipfile.">")
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
206 " call Decho("fname <".fname.">")
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
207
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
208 " the following code does much the same thing as
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
209 " exe "keepj sil! r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
210 " but allows zipfile:... entries in quickfix lists
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
211 let temp = tempname()
5130
71e066e10a47 updated for version 7.3.1308
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
212 " call Decho("using temp file<".temp.">")
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
213 let fn = expand('%:p')
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
214 exe "sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1).' > '.temp
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
215 " call Decho("exe sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1).' > '.temp)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
216 sil exe 'keepalt file '.temp
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
217 sil keepj e!
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
218 sil exe 'keepalt file '.fnameescape(fn)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
219 call delete(temp)
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
220
2908
fd09a9c8468e Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 2152
diff changeset
221 filetype detect
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
222
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
223 " cleanup
5130
71e066e10a47 updated for version 7.3.1308
Bram Moolenaar <bram@vim.org>
parents: 4339
diff changeset
224 " keepj 0d " used to be needed for the ...r! ... method
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
225 set nomod
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
226
568
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
227 let &report= repkeep
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
228 " call Dret("zip#Read")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
229 endfun
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
230
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
231 " ---------------------------------------------------------------------
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
232 " zip#Write: {{{2
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
233 fun! zip#Write(fname)
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 804
diff changeset
234 " call Dfunc("zip#Write(fname<".a:fname.">) zipfile_".winnr()."<".s:zipfile_{winnr()}.">")
568
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
235 let repkeep= &report
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
236 set report=10
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
237
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
238 " sanity checks
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
239 if !executable(g:zip_zipcmd)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
240 redraw!
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
241 echohl Error | echo "***error*** (zip#Write) sorry, your system doesn't appear to have the zip pgm" | echohl None
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
242 " call inputsave()|call input("Press <cr> to continue")|call inputrestore()
568
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
243 let &report= repkeep
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
244 " call Dret("zip#Write")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
245 return
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
246 endif
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
247 if !exists("*mkdir")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
248 redraw!
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
249 echohl Error | echo "***error*** (zip#Write) sorry, mkdir() doesn't work on your system" | echohl None
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
250 " call inputsave()|call input("Press <cr> to continue")|call inputrestore()
568
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
251 let &report= repkeep
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
252 " call Dret("zip#Write")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
253 return
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
254 endif
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
255
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
256 let curdir= getcwd()
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
257 let tmpdir= tempname()
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
258 " call Decho("orig tempname<".tmpdir.">")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
259 if tmpdir =~ '\.'
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
260 let tmpdir= substitute(tmpdir,'\.[^.]*$','','e')
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
261 endif
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
262 " call Decho("tmpdir<".tmpdir.">")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
263 call mkdir(tmpdir,"p")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
264
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
265 " attempt to change to the indicated directory
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
266 if s:ChgDir(tmpdir,s:ERROR,"(zip#Write) cannot cd to temporary directory")
568
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
267 let &report= repkeep
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
268 " call Dret("zip#Write")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
269 return
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
270 endif
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
271 " call Decho("current directory now: ".getcwd())
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
272
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
273 " place temporary files under .../_ZIPVIM_/
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
274 if isdirectory("_ZIPVIM_")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
275 call s:Rmdir("_ZIPVIM_")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
276 endif
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
277 call mkdir("_ZIPVIM_")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
278 cd _ZIPVIM_
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
279 " call Decho("current directory now: ".getcwd())
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
280
857
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
281 if has("unix")
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
282 let zipfile = substitute(a:fname,'zipfile:\(.\{-}\)::[^\\].*$','\1','')
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
283 let fname = substitute(a:fname,'zipfile:.\{-}::\([^\\].*\)$','\1','')
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
284 else
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
285 let zipfile = substitute(a:fname,'^.\{-}zipfile:\(.\{-}\)::[^\\].*$','\1','')
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
286 let fname = substitute(a:fname,'^.\{-}zipfile:.\{-}::\([^\\].*\)$','\1','')
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
287 endif
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
288 " call Decho("zipfile<".zipfile.">")
b933657f7c9d updated for version 7.0g01
vimboss
parents: 826
diff changeset
289 " call Decho("fname <".fname.">")
623
bd2fe62c9d77 updated for version 7.0178
vimboss
parents: 568
diff changeset
290
bd2fe62c9d77 updated for version 7.0178
vimboss
parents: 568
diff changeset
291 if fname =~ '/'
bd2fe62c9d77 updated for version 7.0178
vimboss
parents: 568
diff changeset
292 let dirpath = substitute(fname,'/[^/]\+$','','e')
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
293 if has("win32unix") && executable("cygpath")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
294 let dirpath = substitute(system("cygpath ".s:Escape(dirpath,0)),'\n','','e')
623
bd2fe62c9d77 updated for version 7.0178
vimboss
parents: 568
diff changeset
295 endif
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 804
diff changeset
296 " call Decho("mkdir(dirpath<".dirpath.">,p)")
623
bd2fe62c9d77 updated for version 7.0178
vimboss
parents: 568
diff changeset
297 call mkdir(dirpath,"p")
bd2fe62c9d77 updated for version 7.0178
vimboss
parents: 568
diff changeset
298 endif
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
299 if zipfile !~ '/'
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
300 let zipfile= curdir.'/'.zipfile
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
301 endif
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
302 " call Decho("zipfile<".zipfile."> fname<".fname.">")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
303
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
304 exe "w! ".fnameescape(fname)
4339
22fa3049e934 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3281
diff changeset
305 if has("win32unix") && executable("cygpath")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
306 let zipfile = substitute(system("cygpath ".s:Escape(zipfile,0)),'\n','','e')
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
307 endif
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
308
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
309 if (has("win32") || has("win95") || has("win64") || has("win16")) && &shell !~? 'sh$'
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
310 let fname = substitute(fname, '[', '[[]', 'g')
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
311 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
312
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
313 " call Decho(g:zip_zipcmd." -u ".s:Escape(fnamemodify(zipfile,":p"),0)." ".s:Escape(fname,0))
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
314 call system(g:zip_zipcmd." -u ".s:Escape(fnamemodify(zipfile,":p"),0)." ".s:Escape(fname,0))
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
315 if v:shell_error != 0
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
316 redraw!
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
317 echohl Error | echo "***error*** (zip#Write) sorry, unable to update ".zipfile." with ".fname | echohl None
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
318 " call inputsave()|call input("Press <cr> to continue")|call inputrestore()
557
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
319
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
320 elseif s:zipfile_{winnr()} =~ '^\a\+://'
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
321 " support writing zipfiles across a network
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
322 let netzipfile= s:zipfile_{winnr()}
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
323 " call Decho("handle writing <".zipfile."> across network as <".netzipfile.">")
557
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
324 1split|enew
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
325 let binkeep= &binary
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
326 let eikeep = &ei
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
327 set binary ei=all
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
328 exe "e! ".fnameescape(zipfile)
557
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
329 call netrw#NetWrite(netzipfile)
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
330 let &ei = eikeep
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
331 let &binary = binkeep
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
332 q!
862863033fdd updated for version 7.0158
vimboss
parents: 530
diff changeset
333 unlet s:zipfile_{winnr()}
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
334 endif
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
335
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
336 " cleanup and restore current directory
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
337 cd ..
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
338 call s:Rmdir("_ZIPVIM_")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
339 call s:ChgDir(curdir,s:WARNING,"(zip#Write) unable to return to ".curdir."!")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
340 call s:Rmdir(tmpdir)
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
341 setlocal nomod
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
342
568
db92c5cc4f66 updated for version 7.0161
vimboss
parents: 557
diff changeset
343 let &report= repkeep
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
344 " call Dret("zip#Write")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
345 endfun
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
346
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
347 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
348 " s:Escape: {{{2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
349 fun! s:Escape(fname,isfilt)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
350 " call Dfunc("QuoteFileDir(fname<".a:fname."> isfilt=".a:isfilt.")")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
351 if exists("*shellescape")
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
352 if a:isfilt
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
353 let qnameq= shellescape(a:fname,1)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
354 else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
355 let qnameq= shellescape(a:fname)
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
356 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1214
diff changeset
357 else
82b5078be2dd updated for version 7.2a
vimboss
parents: 1214
diff changeset
358 let qnameq= g:zip_shq.escape(a:fname,g:zip_shq).g:zip_shq
82b5078be2dd updated for version 7.2a
vimboss
parents: 1214
diff changeset
359 endif
82b5078be2dd updated for version 7.2a
vimboss
parents: 1214
diff changeset
360 " call Dret("QuoteFileDir <".qnameq.">")
82b5078be2dd updated for version 7.2a
vimboss
parents: 1214
diff changeset
361 return qnameq
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
362 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
363
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
364 " ---------------------------------------------------------------------
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
365 " ChgDir: {{{2
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
366 fun! s:ChgDir(newdir,errlvl,errmsg)
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
367 " call Dfunc("ChgDir(newdir<".a:newdir."> errlvl=".a:errlvl." errmsg<".a:errmsg.">)")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
368
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
369 try
1698
f4f8014d516e updated for version 7.2c-000
vimboss
parents: 1668
diff changeset
370 exe "cd ".fnameescape(a:newdir)
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
371 catch /^Vim\%((\a\+)\)\=:E344/
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
372 redraw!
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
373 if a:errlvl == s:NOTE
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
374 echo "***note*** ".a:errmsg
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
375 elseif a:errlvl == s:WARNING
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
376 echohl WarningMsg | echo "***warning*** ".a:errmsg | echohl NONE
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
377 elseif a:errlvl == s:ERROR
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
378 echohl Error | echo "***error*** ".a:errmsg | echohl NONE
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
379 endif
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
380 " call inputsave()|call input("Press <cr> to continue")|call inputrestore()
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
381 " call Dret("ChgDir 1")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
382 return 1
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
383 endtry
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
384
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
385 " call Dret("ChgDir 0")
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
386 return 0
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
387 endfun
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
388
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
389 " ---------------------------------------------------------------------
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
390 " s:Rmdir: {{{2
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
391 fun! s:Rmdir(fname)
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
392 " call Dfunc("Rmdir(fname<".a:fname.">)")
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
393 if (has("win32") || has("win95") || has("win64") || has("win16")) && &shell !~? 'sh$'
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
394 call system("rmdir /S/Q ".s:Escape(a:fname,0))
1121
e63691e7c504 updated for version 7.1a
vimboss
parents: 857
diff changeset
395 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
396 call system("/bin/rm -rf ".s:Escape(a:fname,0))
530
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
397 endif
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
398 " call Dret("Rmdir")
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
399 endfun
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
400
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
401 " ------------------------------------------------------------------------
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
402 " Modelines And Restoration: {{{1
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
403 let &cpo= s:keepcpo
339999b511a0 updated for version 7.0148
vimboss
parents:
diff changeset
404 unlet s:keepcpo
1214
a91a2e0c4108 updated for version 7.1b
vimboss
parents: 1121
diff changeset
405 " vim:ts=8 fdm=marker