diff options
author | Bram Moolenaar <Bram@vim.org> | 2008-05-29 20:41:57 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2008-05-29 20:41:57 +0000 |
commit | c24dca26ac4d1681e5010ed55e4a20337a74bb63 (patch) | |
tree | 8dba2260f734ad529c7fb9aad45b6b1d7cd10885 /runtime/autoload | |
parent | bcebfb6925372a6d67b8a04e92a19aca8ac03016 (diff) |
updated for version 7.1-305v7.1.305
Diffstat (limited to 'runtime/autoload')
-rw-r--r-- | runtime/autoload/gzip.vim | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/runtime/autoload/gzip.vim b/runtime/autoload/gzip.vim index f7c97a6d43..1ad29eaaa3 100644 --- a/runtime/autoload/gzip.vim +++ b/runtime/autoload/gzip.vim @@ -1,6 +1,6 @@ " Vim autoload file for editing compressed files. " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2007 May 10 +" Last Change: 2008 May 29 " These functions are used by the gzip plugin. @@ -73,8 +73,15 @@ fun gzip#read(cmd) let empty = line("'[") == 1 && line("']") == line("$") let tmp = tempname() let tmpe = tmp . "." . expand("<afile>:e") + if exists('*fnameescape') + let tmp_esc = fnameescape(tmp) + let tmpe_esc = fnameescape(tmpe) + else + let tmp_esc = escape(tmp, ' ') + let tmpe_esc = escape(tmpe, ' ') + endif " write the just read lines to a temp file "'[,']w tmp.gz" - execute "silent '[,']w " . escape(tmpe, ' ') + execute "silent '[,']w " . tmpe_esc " uncompress the temp file: call system("gzip -dn tmp.gz") call system(a:cmd . " " . s:escape(tmpe)) if !filereadable(tmp) @@ -95,12 +102,12 @@ fun gzip#read(cmd) setlocal nobin if exists(":lockmarks") if empty - execute "silent lockmarks " . l . "r ++edit " . tmp + execute "silent lockmarks " . l . "r ++edit " . tmp_esc else - execute "silent lockmarks " . l . "r " . tmp + execute "silent lockmarks " . l . "r " . tmp_esc endif else - execute "silent " . l . "r " . tmp + execute "silent " . l . "r " . tmp_esc endif " if buffer became empty, delete trailing blank line @@ -110,8 +117,8 @@ fun gzip#read(cmd) endif " delete the temp file and the used buffers call delete(tmp) - silent! exe "bwipe " . tmp - silent! exe "bwipe " . tmpe + silent! exe "bwipe " . tmp_esc + silent! exe "bwipe " . tmpe_esc endif " Restore saved option values. @@ -124,10 +131,15 @@ fun gzip#read(cmd) " When uncompressed the whole buffer, do autocommands if ok && empty + if exists('*fnameescape') + let fname = fnameescape(expand("%:r")) + else + let fname = escape(expand("%:r"), " \t\n*?[{`$\\%#'\"|!<") + endif if &verbose >= 8 - execute "doau BufReadPost " . expand("%:r") + execute "doau BufReadPost " . fname else - execute "silent! doau BufReadPost " . expand("%:r") + execute "silent! doau BufReadPost " . fname endif endif endfun |