Mercurial > vim
changeset 1592:e06e177de52a v7.1.305
updated for version 7.1-305
author | vimboss |
---|---|
date | Thu, 29 May 2008 20:41:57 +0000 |
parents | c19f6b8d0393 |
children | 2430fc9a18d1 |
files | runtime/autoload/gzip.vim src/version.c |
diffstat | 2 files changed, 23 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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