annotate runtime/autoload/gzip.vim @ 8798:176647a751d7 v7.4.1687

commit https://github.com/vim/vim/commit/bdf0bda968a53a55149a4c83a10a60c28e431305 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Mar 30 21:06:57 2016 +0200 patch 7.4.1687 Problem: The channel close_cb option does not work. Solution: Use jo_close_partial instead of jo_err_partial. (Damien)
author Christian Brabandt <cb@256bit.org>
date Wed, 30 Mar 2016 22:15:10 +0200
parents 4abac79c0b7a
children 876fbdd84e52
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
1 " Vim autoload file for editing compressed files.
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
2 " Maintainer: Bram Moolenaar <Bram@vim.org>
6336
4abac79c0b7a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1668
diff changeset
3 " Last Change: 2014 Nov 05
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
4
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
5 " These functions are used by the gzip plugin.
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
6
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
7 " Function to check that executing "cmd [-f]" works.
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
8 " The result is cached in s:have_"cmd" for speed.
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
9 fun s:check(cmd)
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
10 let name = substitute(a:cmd, '\(\S*\).*', '\1', '')
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
11 if !exists("s:have_" . name)
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
12 let e = executable(name)
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
13 if e < 0
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
14 let r = system(name . " --version")
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
15 let e = (r !~ "not found" && r != "")
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
16 endif
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
17 exe "let s:have_" . name . "=" . e
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
18 endif
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
19 exe "return s:have_" . name
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
20 endfun
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
21
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
22 " Set b:gzip_comp_arg to the gzip argument to be used for compression, based on
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
23 " the flags in the compressed file.
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
24 " The only compression methods that can be detected are max speed (-1) and max
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
25 " compression (-9).
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
26 fun s:set_compression(line)
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
27 " get the Compression Method
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
28 let l:cm = char2nr(a:line[2])
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
29 " if it's 8 (DEFLATE), we can check for the compression level
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
30 if l:cm == 8
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
31 " get the eXtra FLags
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
32 let l:xfl = char2nr(a:line[8])
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
33 " max compression
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
34 if l:xfl == 2
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
35 let b:gzip_comp_arg = "-9"
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
36 " min compression
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
37 elseif l:xfl == 4
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
38 let b:gzip_comp_arg = "-1"
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
39 endif
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
40 endif
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
41 endfun
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
42
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
43
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
44 " After reading compressed file: Uncompress text in buffer with "cmd"
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
45 fun gzip#read(cmd)
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
46 " don't do anything if the cmd is not supported
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
47 if !s:check(a:cmd)
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
48 return
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
49 endif
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
50
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
51 " for gzip check current compression level and set b:gzip_comp_arg.
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
52 silent! unlet b:gzip_comp_arg
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
53 if a:cmd[0] == 'g'
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
54 call s:set_compression(getline(1))
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
55 endif
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
56
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
57 " make 'patchmode' empty, we don't want a copy of the written file
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
58 let pm_save = &pm
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
59 set pm=
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
60 " remove 'a' and 'A' from 'cpo' to avoid the alternate file changes
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
61 let cpo_save = &cpo
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
62 set cpo-=a cpo-=A
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
63 " set 'modifiable'
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
64 let ma_save = &ma
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
65 setlocal ma
1190
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
66 " Reset 'foldenable', otherwise line numbers get adjusted.
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
67 if has("folding")
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
68 let fen_save = &fen
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
69 setlocal nofen
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
70 endif
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
71
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
72 " when filtering the whole buffer, it will become empty
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
73 let empty = line("'[") == 1 && line("']") == line("$")
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
74 let tmp = tempname()
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
75 let tmpe = tmp . "." . expand("<afile>:e")
1592
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
76 if exists('*fnameescape')
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
77 let tmp_esc = fnameescape(tmp)
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
78 let tmpe_esc = fnameescape(tmpe)
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
79 else
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
80 let tmp_esc = escape(tmp, ' ')
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
81 let tmpe_esc = escape(tmpe, ' ')
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
82 endif
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
83 " write the just read lines to a temp file "'[,']w tmp.gz"
1592
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
84 execute "silent '[,']w " . tmpe_esc
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
85 " uncompress the temp file: call system("gzip -dn tmp.gz")
985
656853d9c014 updated for version 7.0-111
vimboss
parents: 922
diff changeset
86 call system(a:cmd . " " . s:escape(tmpe))
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
87 if !filereadable(tmp)
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
88 " uncompress didn't work! Keep the compressed file then.
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
89 echoerr "Error: Could not read uncompressed file"
1190
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
90 let ok = 0
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
91 else
1190
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
92 let ok = 1
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
93 " delete the compressed lines; remember the line number
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
94 let l = line("'[") - 1
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
95 if exists(":lockmarks")
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
96 lockmarks '[,']d _
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
97 else
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
98 '[,']d _
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
99 endif
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
100 " read in the uncompressed lines "'[-1r tmp"
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
101 " Use ++edit if the buffer was empty, keep the 'ff' and 'fenc' options.
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
102 setlocal nobin
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
103 if exists(":lockmarks")
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
104 if empty
1592
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
105 execute "silent lockmarks " . l . "r ++edit " . tmp_esc
1190
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
106 else
1592
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
107 execute "silent lockmarks " . l . "r " . tmp_esc
1190
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
108 endif
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
109 else
1592
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
110 execute "silent " . l . "r " . tmp_esc
1190
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
111 endif
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
112
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
113 " if buffer became empty, delete trailing blank line
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 446
diff changeset
114 if empty
1190
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
115 silent $delete _
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
116 1
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 446
diff changeset
117 endif
1190
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
118 " delete the temp file and the used buffers
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
119 call delete(tmp)
1592
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
120 silent! exe "bwipe " . tmp_esc
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
121 silent! exe "bwipe " . tmpe_esc
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
122 endif
6336
4abac79c0b7a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1668
diff changeset
123 " Store the OK flag, so that we can use it when writing.
4abac79c0b7a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1668
diff changeset
124 let b:uncompressOk = ok
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
125
1190
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
126 " Restore saved option values.
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
127 let &pm = pm_save
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
128 let &cpo = cpo_save
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
129 let &l:ma = ma_save
1190
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
130 if has("folding")
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
131 let &l:fen = fen_save
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
132 endif
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
133
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
134 " When uncompressed the whole buffer, do autocommands
1190
4e90dc161511 updated for version 7.1b
vimboss
parents: 1132
diff changeset
135 if ok && empty
1592
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
136 if exists('*fnameescape')
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
137 let fname = fnameescape(expand("%:r"))
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
138 else
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
139 let fname = escape(expand("%:r"), " \t\n*?[{`$\\%#'\"|!<")
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
140 endif
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
141 if &verbose >= 8
1592
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
142 execute "doau BufReadPost " . fname
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
143 else
1592
e06e177de52a updated for version 7.1-305
vimboss
parents: 1190
diff changeset
144 execute "silent! doau BufReadPost " . fname
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
145 endif
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
146 endif
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
147 endfun
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
148
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
149 " After writing compressed file: Compress written file with "cmd"
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
150 fun gzip#write(cmd)
6336
4abac79c0b7a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1668
diff changeset
151 if exists('b:uncompressOk') && !b:uncompressOk
4abac79c0b7a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1668
diff changeset
152 echomsg "Not compressing file because uncompress failed; reset b:uncompressOk to compress anyway"
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
153 " don't do anything if the cmd is not supported
6336
4abac79c0b7a Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 1668
diff changeset
154 elseif s:check(a:cmd)
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
155 " Rename the file before compressing it.
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
156 let nm = resolve(expand("<afile>"))
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
157 let nmt = s:tempname(nm)
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
158 if rename(nm, nmt) == 0
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
159 if exists("b:gzip_comp_arg")
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1592
diff changeset
160 call system(a:cmd . " " . b:gzip_comp_arg . " -- " . s:escape(nmt))
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
161 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1592
diff changeset
162 call system(a:cmd . " -- " . s:escape(nmt))
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
163 endif
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
164 call rename(nmt . "." . expand("<afile>:e"), nm)
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
165 endif
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
166 endif
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
167 endfun
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
168
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
169 " Before appending to compressed file: Uncompress file with "cmd"
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
170 fun gzip#appre(cmd)
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
171 " don't do anything if the cmd is not supported
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
172 if s:check(a:cmd)
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
173 let nm = expand("<afile>")
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
174
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
175 " for gzip check current compression level and set b:gzip_comp_arg.
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
176 silent! unlet b:gzip_comp_arg
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
177 if a:cmd[0] == 'g'
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
178 call s:set_compression(readfile(nm, "b", 1)[0])
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
179 endif
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
180
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
181 " Rename to a weird name to avoid the risk of overwriting another file
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
182 let nmt = expand("<afile>:p:h") . "/X~=@l9q5"
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
183 let nmte = nmt . "." . expand("<afile>:e")
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
184 if rename(nm, nmte) == 0
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
185 if &patchmode != "" && getfsize(nm . &patchmode) == -1
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
186 " Create patchmode file by creating the decompressed file new
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1592
diff changeset
187 call system(a:cmd . " -c -- " . s:escape(nmte) . " > " . s:escape(nmt))
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
188 call rename(nmte, nm . &patchmode)
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
189 else
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1592
diff changeset
190 call system(a:cmd . " -- " . s:escape(nmte))
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
191 endif
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
192 call rename(nmt, nm)
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
193 endif
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
194 endif
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
195 endfun
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
196
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
197 " find a file name for the file to be compressed. Use "name" without an
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
198 " extension if possible. Otherwise use a weird name to avoid overwriting an
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
199 " existing file.
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
200 fun s:tempname(name)
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
201 let fn = fnamemodify(a:name, ":r")
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
202 if !filereadable(fn) && !isdirectory(fn)
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
203 return fn
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
204 endif
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
205 return fnamemodify(a:name, ":p:h") . "/X~=@l9q5"
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
206 endfun
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
207
985
656853d9c014 updated for version 7.0-111
vimboss
parents: 922
diff changeset
208 fun s:escape(name)
656853d9c014 updated for version 7.0-111
vimboss
parents: 922
diff changeset
209 " shellescape() was added by patch 7.0.111
1132
857a5e3e1d34 updated for version 7.1a
vimboss
parents: 985
diff changeset
210 if exists("*shellescape")
985
656853d9c014 updated for version 7.0-111
vimboss
parents: 922
diff changeset
211 return shellescape(a:name)
656853d9c014 updated for version 7.0-111
vimboss
parents: 922
diff changeset
212 endif
656853d9c014 updated for version 7.0-111
vimboss
parents: 922
diff changeset
213 return "'" . a:name . "'"
656853d9c014 updated for version 7.0-111
vimboss
parents: 922
diff changeset
214 endfun
656853d9c014 updated for version 7.0-111
vimboss
parents: 922
diff changeset
215
446
7472c565592a updated for version 7.0117
vimboss
parents:
diff changeset
216 " vim: set sw=2 :