summaryrefslogtreecommitdiffstats
path: root/runtime/autoload
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2008-06-24 22:58:06 +0000
committerBram Moolenaar <Bram@vim.org>2008-06-24 22:58:06 +0000
commit8c8de839325eda0bed68917d18179d2003b344d1 (patch)
treec65b80f0a627f2e77385a07a62ee4206465cbc22 /runtime/autoload
parent864207de089119377a1e1e5d411307d8eb57399e (diff)
updated for version 7.2av7.2a
Diffstat (limited to 'runtime/autoload')
-rw-r--r--runtime/autoload/ccomplete.vim25
-rw-r--r--runtime/autoload/spellfile.vim11
-rw-r--r--runtime/autoload/sqlcomplete.vim72
-rw-r--r--runtime/autoload/tar.vim182
-rw-r--r--runtime/autoload/xml/html32.vim1
-rw-r--r--runtime/autoload/xml/html401s.vim1
-rw-r--r--runtime/autoload/xml/xhtml10s.vim1
-rw-r--r--runtime/autoload/xml/xhtml10t.vim1
8 files changed, 193 insertions, 101 deletions
diff --git a/runtime/autoload/ccomplete.vim b/runtime/autoload/ccomplete.vim
index 0f013d79b7..6850e19a0b 100644
--- a/runtime/autoload/ccomplete.vim
+++ b/runtime/autoload/ccomplete.vim
@@ -1,7 +1,7 @@
" Vim completion script
" Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2006 May 08
+" Last Change: 2007 Aug 30
" This function is used for the 'omnifunc' option.
@@ -119,6 +119,27 @@ function! ccomplete#Complete(findstart, base)
" TODO: join previous line if it makes sense
let line = getline('.')
let col = col('.')
+ if stridx(strpart(line, 0, col), ';') != -1
+ " Handle multiple declarations on the same line.
+ let col2 = col - 1
+ while line[col2] != ';'
+ let col2 -= 1
+ endwhile
+ let line = strpart(line, col2 + 1)
+ let col -= col2
+ endif
+ if stridx(strpart(line, 0, col), ',') != -1
+ " Handle multiple declarations on the same line in a function
+ " declaration.
+ let col2 = col - 1
+ while line[col2] != ','
+ let col2 -= 1
+ endwhile
+ if strpart(line, col2 + 1, col - col2 - 1) =~ ' *[^ ][^ ]* *[^ ]'
+ let line = strpart(line, col2 + 1)
+ let col -= col2
+ endif
+ endif
if len(items) == 1
" Completing one word and it's a local variable: May add '[', '.' or
" '->'.
@@ -140,7 +161,7 @@ function! ccomplete#Complete(findstart, base)
let res = [{'match': match, 'tagline' : '', 'kind' : kind, 'info' : line}]
else
" Completing "var.", "var.something", etc.
- let res = s:Nextitem(strpart(line, 0, col), items[1:], 0, 1)
+ let res = s:Nextitem(strpart(line, 0, col), items[-1], 0, 1)
endif
endif
diff --git a/runtime/autoload/spellfile.vim b/runtime/autoload/spellfile.vim
index b9e17f1f14..1ca76a4aeb 100644
--- a/runtime/autoload/spellfile.vim
+++ b/runtime/autoload/spellfile.vim
@@ -1,6 +1,6 @@
" Vim script to download a missing spell file
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2007 May 08
+" Last Change: 2008 May 29
if !exists('g:spellfile_URL')
let g:spellfile_URL = 'ftp://ftp.vim.org/pub/vim/runtime/spell'
@@ -106,7 +106,12 @@ function! spellfile#LoadFile(lang)
endfor
let dirchoice = confirm(msg, dirchoices) - 2
if dirchoice >= 0
- exe "write " . escape(dirlist[dirchoice], ' ') . '/' . fname
+ if exists('*fnameescape')
+ let dirname = fnameescape(dirlist[dirchoice])
+ else
+ let dirname = escape(dirlist[dirchoice], ' ')
+ endif
+ exe "write " . dirname . '/' . fname
" Also download the .sug file, if the user wants to.
let msg = "Do you want me to try getting the .sug file?\n"
@@ -119,7 +124,7 @@ function! spellfile#LoadFile(lang)
call spellfile#Nread(fname)
if getline(2) =~ 'VIMsug'
1d
- exe "write " . escape(dirlist[dirchoice], ' ') . '/' . fname
+ exe "write " . dirname . '/' . fname
set nomod
else
echo 'Sorry, downloading failed'
diff --git a/runtime/autoload/sqlcomplete.vim b/runtime/autoload/sqlcomplete.vim
index c803932c25..eecb3260fe 100644
--- a/runtime/autoload/sqlcomplete.vim
+++ b/runtime/autoload/sqlcomplete.vim
@@ -1,8 +1,8 @@
" Vim OMNI completion script for SQL
" Language: SQL
" Maintainer: David Fishburn <fishburn@ianywhere.com>
-" Version: 5.0
-" Last Change: Mon Jun 05 2006 3:30:04 PM
+" Version: 6.0
+" Last Change: Thu 03 Apr 2008 10:37:54 PM Eastern Daylight Time
" Usage: For detailed help
" ":help sql.txt"
" or ":help ft-sql-omni"
@@ -106,7 +106,7 @@ function! sqlcomplete#Complete(findstart, base)
let begindot = 1
endif
while start > 0
- if line[start - 1] =~ '\w'
+ if line[start - 1] =~ '\(\w\|\s\+\)'
let start -= 1
elseif line[start - 1] =~ '\.' &&
\ compl_type =~ 'column\|table\|view\|procedure'
@@ -178,11 +178,10 @@ function! sqlcomplete#Complete(findstart, base)
" Allow the user to override the dbext plugin to specify whether
" the owner/creator should be included in the list
- let saved_dbext_show_owner = 1
- if exists('g:dbext_default_dict_show_owner')
- let saved_dbext_show_owner = g:dbext_default_dict_show_owner
+ if g:loaded_dbext >= 300
+ let saveSetting = DB_listOption('dict_show_owner')
+ exec 'DBSetOption dict_show_owner='.(g:omni_sql_include_owner==1?'1':'0')
endif
- let g:dbext_default_dict_show_owner = g:omni_sql_include_owner
let compl_type_uc = substitute(compl_type, '\w\+', '\u&', '')
if s:sql_file_{compl_type} == ""
@@ -192,18 +191,12 @@ function! sqlcomplete#Complete(findstart, base)
if s:sql_file_{compl_type} != ""
if filereadable(s:sql_file_{compl_type})
let compl_list = readfile(s:sql_file_{compl_type})
- " let dic_list = readfile(s:sql_file_{compl_type})
- " if !empty(dic_list)
- " for elem in dic_list
- " let kind = (compl_type=='table'?'m':(compl_type=='procedure'?'f':'v'))
- " let item = {'word':elem, 'menu':elem, 'kind':kind, 'info':compl_type}
- " let compl_list += [item]
- " endfor
- " endif
endif
endif
- let g:dbext_default_dict_show_owner = saved_dbext_show_owner
+ if g:loaded_dbext > 300
+ exec 'DBSetOption dict_show_owner='.saveSetting
+ endif
elseif compl_type =~? 'column'
" This type of completion relies upon the dbext.vim plugin
@@ -450,8 +443,8 @@ function! s:SQLCCheck4dbext()
" Leave time for the user to read the error message
:sleep 2
return -1
- elseif g:loaded_dbext < 300
- let msg = "The dbext plugin must be at least version 3.00 " .
+ elseif g:loaded_dbext < 600
+ let msg = "The dbext plugin must be at least version 5.30 " .
\ " for dynamic SQL completion"
call s:SQLCErrorMsg(msg)
" Leave time for the user to read the error message
@@ -514,34 +507,42 @@ endfunction
function! s:SQLCGetObjectOwner(object)
" The owner regex matches a word at the start of the string which is
" followed by a dot, but doesn't include the dot in the result.
- " ^ - from beginning of line
- " "\? - ignore any quotes
- " \zs - start the match now
- " \w\+ - get owner name
- " \ze - end the match
- " "\? - ignore any quotes
- " \. - must by followed by a .
- let owner = matchstr( a:object, '^"\?\zs\w\+\ze"\?\.' )
+ " ^ - from beginning of line
+ " \("\|\[\)\? - ignore any quotes
+ " \zs - start the match now
+ " .\{-} - get owner name
+ " \ze - end the match
+ " \("\|\[\)\? - ignore any quotes
+ " \. - must by followed by a .
+ " let owner = matchstr( a:object, '^\s*\zs.*\ze\.' )
+ let owner = matchstr( a:object, '^\("\|\[\)\?\zs\.\{-}\ze\("\|\]\)\?\.' )
return owner
endfunction
function! s:SQLCGetColumns(table_name, list_type)
" Check if the table name was provided as part of the column name
- let table_name = matchstr(a:table_name, '^[a-zA-Z0-9_]\+\ze\.\?')
+ let table_name = matchstr(a:table_name, '^["\[\]a-zA-Z0-9_ ]\+\ze\.\?')
let table_cols = []
let table_alias = ''
let move_to_top = 1
+ let table_name = substitute(table_name, '\s*\(.\{-}\)\s*$', '\1', 'g')
+
+ " If the table name was given as:
+ " where c.
+ let table_name = substitute(table_name, '^\c\(WHERE\|AND\|OR\)\s\+', '', '')
if g:loaded_dbext >= 300
let saveSettingAlias = DB_listOption('use_tbl_alias')
exec 'DBSetOption use_tbl_alias=n'
endif
+ let table_name_stripped = substitute(table_name, '["\[\]]*', '', 'g')
+
" Check if we have already cached the column list for this table
" by its name
- let list_idx = index(s:tbl_name, table_name, 0, &ignorecase)
+ let list_idx = index(s:tbl_name, table_name_stripped, 0, &ignorecase)
if list_idx > -1
- let table_cols = split(s:tbl_cols[list_idx])
+ let table_cols = split(s:tbl_cols[list_idx], '\n')
else
" Check if we have already cached the column list for this table
" by its alias, assuming the table_name provided was actually
@@ -549,11 +550,11 @@ function! s:SQLCGetColumns(table_name, list_type)
" select *
" from area a
" where a.
- let list_idx = index(s:tbl_alias, table_name, 0, &ignorecase)
+ let list_idx = index(s:tbl_alias, table_name_stripped, 0, &ignorecase)
if list_idx > -1
- let table_alias = table_name
+ let table_alias = table_name_stripped
let table_name = s:tbl_name[list_idx]
- let table_cols = split(s:tbl_cols[list_idx])
+ let table_cols = split(s:tbl_cols[list_idx], '\n')
endif
endif
@@ -609,8 +610,8 @@ function! s:SQLCGetColumns(table_name, list_type)
" '.*' - Exclude the rest of the line in the match
let table_name_new = matchstr(@y,
\ 'from.\{-}'.
- \ '\zs\(\(\<\w\+\>\)\.\)\?'.
- \ '\<\w\+\>\ze'.
+ \ '\zs\(\("\|\[\)\?.\{-}\("\|\]\)\.\)\?'.
+ \ '\("\|\[\)\?.\{-}\("\|\]\)\ze'.
\ '\s\+\%(as\s\+\)\?\<'.
\ matchstr(table_name, '.\{-}\ze\.\?$').
\ '\>'.
@@ -618,6 +619,7 @@ function! s:SQLCGetColumns(table_name, list_type)
\ '\(\<where\>\|$\)'.
\ '.*'
\ )
+
if table_name_new != ''
let table_alias = table_name
let table_name = table_name_new
@@ -668,7 +670,7 @@ function! s:SQLCGetColumns(table_name, list_type)
let s:tbl_name = add( s:tbl_name, table_name )
let s:tbl_alias = add( s:tbl_alias, table_alias )
let s:tbl_cols = add( s:tbl_cols, table_cols_str )
- let table_cols = split(table_cols_str)
+ let table_cols = split(table_cols_str, '\n')
endif
endif
diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim
index 6c172386c0..35ef7fd253 100644
--- a/runtime/autoload/tar.vim
+++ b/runtime/autoload/tar.vim
@@ -1,21 +1,21 @@
" tar.vim: Handles browsing tarfiles
" AUTOLOAD PORTION
-" Date: Sep 29, 2006
-" Version: 11
+" Date: Jun 12, 2008
+" Version: 16
" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM>
" License: Vim License (see vim's :help license)
"
" Contains many ideas from Michael Toren's <tar.vim>
"
-" Copyright: Copyright (C) 2005 Charles E. Campbell, Jr. {{{1
+" Copyright: Copyright (C) 2005-2008 Charles E. Campbell, Jr. {{{1
" Permission is hereby granted to use and distribute this code,
" with or without modifications, provided that this copyright
" notice is copied with it. Like anything else that's free,
-" tarPlugin.vim is provided *as is* and comes with no warranty
-" of any kind, either expressed or implied. By using this
-" plugin, you agree that in no event will the copyright
-" holder be liable for any damages resulting from the use
-" of this software.
+" tar.vim and tarPlugin.vim are provided *as is* and comes
+" with no warranty of any kind, either expressed or implied.
+" By using this plugin, you agree that in no event will the
+" copyright holder be liable for any damages resulting from
+" the use of this software.
" ---------------------------------------------------------------------
" Load Once: {{{1
@@ -24,8 +24,11 @@ set cpo&vim
if &cp || exists("g:loaded_tar") || v:version < 700
finish
endif
-let g:loaded_tar= "v11"
+let g:loaded_tar= "v16"
"call Decho("loading autoload/tar.vim")
+if v:version < 701 || (v:version == 701 && !has("patch299"))
+ echoerr "(autoload/tar.vim) need vim v7.1 with patchlevel 299"
+endif
" ---------------------------------------------------------------------
" Default Settings: {{{1
@@ -41,12 +44,33 @@ endif
if !exists("g:tar_writeoptions")
let g:tar_writeoptions= "uf"
endif
+
+if !exists("g:netrw_cygwin")
+ if has("win32") || has("win95") || has("win64") || has("win16")
+ if &shell =~ '\%(\<bash\>\|\<zsh\>\)\%(\.exe\)\=$'
+ let g:netrw_cygwin= 1
+ else
+ let g:netrw_cygwin= 0
+ endif
+ else
+ let g:netrw_cygwin= 0
+ endif
+endif
+
+" set up shell quoting character
if !exists("g:tar_shq")
- if has("unix")
- let g:tar_shq= "'"
+ if exists("&shq") && &shq != ""
+ let g:tar_shq= &shq
+ elseif has("win32") || has("win95") || has("win64") || has("win16")
+ if exists("g:netrw_cygwin") && g:netrw_cygwin
+ let g:tar_shq= "'"
+ else
+ let g:tar_shq= '"'
+ endif
else
- let g:tar_shq= '"'
+ let g:tar_shq= "'"
endif
+" call Decho("g:tar_shq<".g:tar_shq.">")
endif
" ----------------
@@ -95,27 +119,32 @@ fun! tar#Browse(tarfile)
" give header
" call Decho("printing header")
- exe "$put ='".'\"'." tar.vim version ".g:loaded_tar."'"
- exe "$put ='".'\"'." Browsing tarfile ".a:tarfile."'"
- exe "$put ='".'\"'." Select a file with cursor and press ENTER"."'"
+ let lastline= line("$")
+ call setline(lastline+1,'" tar.vim version '.g:loaded_tar)
+ call setline(lastline+2,'" Browsing tarfile '.a:tarfile)
+ call setline(lastline+3,'" Select a file with cursor and press ENTER')
+ $put =''
0d
$
let tarfile= a:tarfile
if has("win32") && executable("cygpath")
" assuming cygwin
- let tarfile=substitute(system("cygpath -u ".tarfile),'\n$','','e')
+ let tarfile=substitute(system("cygpath -u ".s:Escape(tarfile)),'\n$','','e')
endif
let curlast= line("$")
if tarfile =~# '\.\(gz\|tgz\)$'
-" call Decho("exe silent r! gzip -d -c ".g:tar_shq.tarfile.g:tar_shq."| ".g:tar_cmd." -".g:tar_browseoptions." - ")
- exe "silent r! gzip -d -c ".g:tar_shq.tarfile.g:tar_shq."| ".g:tar_cmd." -".g:tar_browseoptions." - "
+" call Decho("1: exe silent r! gzip -d -c ".s:Escape(tarfile)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
+ exe "silent r! gzip -d -c -- ".s:Escape(tarfile)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
+ elseif tarfile =~# '\.lrp'
+" call Decho("2: exe silent r! cat -- ".s:Escape(tarfile)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - ")
+ exe "silent r! cat -- ".s:Escape(tarfile)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - "
elseif tarfile =~# '\.bz2$'
-" call Decho("exe silent r! bzip2 -d -c ".g:tar_shq.tarfile.g:tar_shq."| ".g:tar_cmd." -".g:tar_browseoptions." - ")
- exe "silent r! bzip2 -d -c ".g:tar_shq.tarfile.g:tar_shq."| ".g:tar_cmd." -".g:tar_browseoptions." - "
+" call Decho("3: exe silent r! bzip2 -d -c ".s:Escape(tarfile)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
+ exe "silent r! bzip2 -d -c -- ".s:Escape(tarfile)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
else
-" call Decho("exe silent r! ".g:tar_cmd." -".g:tar_browseoptions." ".g:tar_shq.tarfile.g:tar_shq)
- exe "silent r! ".g:tar_cmd." -".g:tar_browseoptions." ".g:tar_shq.tarfile.g:tar_shq
+" call Decho("4: exe silent r! ".g:tar_cmd." -".g:tar_browseoptions." ".s:Escape(tarfile))
+ exe "silent r! ".g:tar_cmd." -".g:tar_browseoptions." ".s:Escape(tarfile)
endif
if v:shell_error != 0
redraw!
@@ -166,13 +195,15 @@ fun! s:TarBrowseSelect()
let curfile= expand("%")
if has("win32") && executable("cygpath")
" assuming cygwin
- let tarfile=substitute(system("cygpath -u ".tarfile),'\n$','','e')
+ let tarfile=substitute(system("cygpath -u ".s:Escape(tarfile)),'\n$','','e')
endif
new
- wincmd _
+ if !exists("g:tar_nomax") || g:tar_nomax == 0
+ wincmd _
+ endif
let s:tblfile_{winnr()}= curfile
- call tar#Read("tarfile:".tarfile.':'.fname,1)
+ call tar#Read("tarfile:".tarfile.'::'.fname,1)
filetype detect
let &report= repkeep
@@ -185,27 +216,50 @@ fun! tar#Read(fname,mode)
" call Dfunc("tar#Read(fname<".a:fname.">,mode=".a:mode.")")
let repkeep= &report
set report=10
- let tarfile = substitute(a:fname,'tarfile:\(.\{-}\):.*$','\1','')
- let fname = substitute(a:fname,'tarfile:.\{-}:\(.*\)$','\1','')
+ let tarfile = substitute(a:fname,'tarfile:\(.\{-}\)::.*$','\1','')
+ let fname = substitute(a:fname,'tarfile:.\{-}::\(.*\)$','\1','')
if has("win32") && executable("cygpath")
" assuming cygwin
- let tarfile=substitute(system("cygpath -u ".tarfile),'\n$','','e')
+ let tarfile=substitute(system("cygpath -u ".s:Escape(tarfile)),'\n$','','e')
endif
" call Decho("tarfile<".tarfile.">")
" call Decho("fname<".fname.">")
+ if fname =~ '\.gz$' && executable("zcat")
+ let decmp= "|zcat"
+ let doro = 1
+ elseif fname =~ '\.bz2$' && executable("bzcat")
+ let decmp= "|bzcat"
+ let doro = 1
+ else
+ let decmp=""
+ let doro = 0
+ if fname =~ '\.gz$\|\.bz2$\|\.Z$\|\.zip$'
+ setlocal bin
+ endif
+ endif
+
if tarfile =~# '\.\(gz\|tgz\)$'
-" call Decho("exe silent r! gzip -d -c ".g:tar_shq.tarfile.g:tar_shq."| ".g:tar_cmd." -OPxf - '".fname."'")
- exe "silent r! gzip -d -c ".g:tar_shq.tarfile.g:tar_shq."| ".g:tar_cmd." -".g:tar_readoptions." - '".fname."'"
+" call Decho("5: exe silent r! gzip -d -c -- ".s:Escape(tarfile)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.s:Escape(fname))
+ exe "silent r! gzip -d -c -- ".s:Escape(tarfile)."| ".g:tar_cmd." -".g:tar_readoptions." - ".s:Escape(fname).decmp
+ elseif tarfile =~# '\.lrp$'
+" call Decho("6: exe silent r! cat ".s:Escape(tarfile)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".s:Escape(fname).decmp)
+ exe "silent r! cat -- ".s:Escape(tarfile)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".s:Escape(fname).decmp
elseif tarfile =~# '\.bz2$'
-" call Decho("exe silent r! bzip2 -d -c ".g:tar_shq.tarfile.g:tar_shq."| ".g:tar_cmd." -".g:tar_readoptions." - '".fname."'")
- exe "silent r! bzip2 -d -c ".g:tar_shq.tarfile.g:tar_shq."| ".g:tar_cmd." -".g:tar_readoptions." - '".fname."'"
+" call Decho("7: exe silent r! bzip2 -d -c ".s:Escape(tarfile)."| ".g:tar_cmd." -".g:tar_readoptions." - ".s:Escape(fname).decmp)
+ exe "silent r! bzip2 -d -c -- ".s:Escape(tarfile)."| ".g:tar_cmd." -".g:tar_readoptions." - ".s:Escape(fname).decmp
else
-" call Decho("exe silent r! ".g:tar_cmd." -".g:tar_readoptions." ".g:tar_shq.tarfile.g:tar_shq." ".g:tar_shq.fname.g:tar_shq)
- exe "silent r! ".g:tar_cmd." -".g:tar_readoptions." ".g:tar_shq.tarfile.g:tar_shq." ".g:tar_shq.fname.g:tar_shq
+" call Decho("8: exe silent r! ".g:tar_cmd." -".g:tar_readoptions." -- ".s:Escape(tarfile)." ".s:Escape(fname))
+ exe "silent r! ".g:tar_cmd." -".g:tar_readoptions." ".s:Escape(tarfile)." -- ".s:Escape(fname).decmp
endif
+
+ if doro
+ " because the reverse process of compressing changed files back into the tarball is not currently supported
+ setlocal ro
+ endif
+
let w:tarfile= a:fname
- exe "file tarfile:".fname
+ exe "file tarfile::".fname
" cleanup
0d
@@ -251,7 +305,7 @@ fun! tar#Write(fname)
" attempt to change to the indicated directory
try
- exe "cd ".escape(tmpdir,' \')
+ exe "cd ".fnameescape(tmpdir)
catch /^Vim\%((\a\+)\)\=:E344/
redraw!
echohl Error | echo "***error*** (tar#Write) cannot cd to temporary directory" | Echohl None
@@ -270,24 +324,26 @@ fun! tar#Write(fname)
cd _ZIPVIM_
" call Decho("current directory now: ".getcwd())
- let tarfile = substitute(w:tarfile,'tarfile:\(.\{-}\):.*$','\1','')
- let fname = substitute(w:tarfile,'tarfile:.\{-}:\(.*\)$','\1','')
+ let tarfile = substitute(w:tarfile,'tarfile:\(.\{-}\)::.*$','\1','')
+ let fname = substitute(w:tarfile,'tarfile:.\{-}::\(.*\)$','\1','')
" handle compressed archives
if tarfile =~# '\.gz'
- call system("gzip -d ".tarfile)
+ call system("gzip -d -- ".tarfile)
let tarfile = substitute(tarfile,'\.gz','','e')
- let compress= "gzip '".tarfile."'"
+ let compress= "gzip ".s:Escape(tarfile)
elseif tarfile =~# '\.tgz'
- call system("gzip -d ".tarfile)
+ call system("gzip -d -- ".s:Escape(tarfile))
let tarfile = substitute(tarfile,'\.tgz','.tar','e')
- let compress= "gzip '".tarfile."'"
+ let compress= "gzip -- ".s:Escape(tarfile)
let tgz = 1
elseif tarfile =~# '\.bz2'
- call system("bzip2 -d ".tarfile)
+ call system("bzip2 -d -- ".s:Escape(tarfile))
let tarfile = substitute(tarfile,'\.bz2','','e')
- let compress= "bzip2 '".tarfile."'"
+ let compress= "bzip2 -- ".s:Escape(tarfile)
endif
+" call Decho("tarfile<".tarfile.">")
+" call Decho("compress<".compress.">")
if v:shell_error != 0
redraw!
@@ -309,26 +365,26 @@ fun! tar#Write(fname)
endif
" call Decho("tarfile<".tarfile."> fname<".fname.">")
- exe "w! ".fname
+ exe "w! ".fnameescape(fname)
if executable("cygpath")
- let tarfile = substitute(system("cygpath ".tarfile),'\n','','e')
+ let tarfile = substitute(system("cygpath ".s:Escape(tarfile)),'\n','','e')
endif
" delete old file from tarfile
-" call Decho("tar --delete -f '".tarfile."' '".fname."'")
- call system("tar --delete -f '".tarfile."' '".fname."'")
+" call Decho("system(tar --delete -f ".s:Escape(tarfile)." -- ".s:Escape(fname).")")
+ call system("tar --delete -f ".s:Escape(tarfile)." -- ".s:Escape(fname))
if v:shell_error != 0
redraw!
- echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".tarfile." with ".fname | echohl None
+ echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None
" call inputsave()|call input("Press <cr> to continue")|call inputrestore()
else
" update tarfile with new file
-" call Decho("tar -".g:tar_writeoptions." '".tarfile."' '".fname."'")
- call system("tar -".g:tar_writeoptions." '".tarfile."' '".fname."'")
+" call Decho("tar -".g:tar_writeoptions." ".s:Escape(tarfile)." -- ".s:Escape(fname))
+ call system("tar -".g:tar_writeoptions." ".s:Escape(tarfile)." -- ".s:Escape(fname))
if v:shell_error != 0
redraw!
- echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".tarfile." with ".fname | echohl None
+ echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None
" call inputsave()|call input("Press <cr> to continue")|call inputrestore()
elseif exists("compress")
" call Decho("call system(".compress.")")
@@ -372,19 +428,31 @@ endfun
fun! s:Rmdir(fname)
" call Dfunc("Rmdir(fname<".a:fname.">)")
if has("unix")
- call system("/bin/rm -rf ".a:fname)
+ call system("/bin/rm -rf -- ".s:Escape(a:fname))
elseif has("win32") || has("win95") || has("win64") || has("win16")
if &shell =~? "sh$"
- call system("/bin/rm -rf ".a:fname)
+ call system("/bin/rm -rf -- ".s:Escape(a:fname))
else
- call system("del /S ".a:fname)
+ call system("del /S ".s:Escape(a:fname))
endif
endif
" call Dret("Rmdir")
endfun
-" ------------------------------------------------------------------------
+" ---------------------------------------------------------------------
+" s:Escape: {{{2
+fun s:Escape(name)
+ " shellescape() was added by patch 7.0.111
+ if exists("*shellescape")
+ let qnameq= shellescape(a:name)
+ else
+ let qnameq= g:tar_shq . a:name . g:tar_shq
+ endif
+ return qnameq
+endfun
+
+" ---------------------------------------------------------------------
" Modelines And Restoration: {{{1
let &cpo= s:keepcpo
unlet s:keepcpo
-" vim:ts=8 fdm=marker
+" vim:ts=8 fdm=marker
diff --git a/runtime/autoload/xml/html32.vim b/runtime/autoload/xml/html32.vim
index 9b971d6faa..242f52b1ab 100644
--- a/runtime/autoload/xml/html32.vim
+++ b/runtime/autoload/xml/html32.vim
@@ -381,4 +381,3 @@ let g:xmldata_html32 = {
\ 'param': ['/>', ''],
\ }
\ }
-" vim:ft=vim:ff=unix
diff --git a/runtime/autoload/xml/html401s.vim b/runtime/autoload/xml/html401s.vim
index 8f7264864e..37f581ba2b 100644
--- a/runtime/autoload/xml/html401s.vim
+++ b/runtime/autoload/xml/html401s.vim
@@ -408,4 +408,3 @@ let g:xmldata_html401s = {
\ 'param': ['/>', ''],
\ }
\ }
-" vim:ft=vim:ff=unix
diff --git a/runtime/autoload/xml/xhtml10s.vim b/runtime/autoload/xml/xhtml10s.vim
index ec8300ed3b..3fb7cf8c44 100644
--- a/runtime/autoload/xml/xhtml10s.vim
+++ b/runtime/autoload/xml/xhtml10s.vim
@@ -408,4 +408,3 @@ let g:xmldata_xhtml10s = {
\ 'param': ['/>', ''],
\ }
\ }
-" vim:ft=vim:ff=unix
diff --git a/runtime/autoload/xml/xhtml10t.vim b/runtime/autoload/xml/xhtml10t.vim
index 9a9041897f..0e857ac9b2 100644
--- a/runtime/autoload/xml/xhtml10t.vim
+++ b/runtime/autoload/xml/xhtml10t.vim
@@ -458,4 +458,3 @@ let g:xmldata_xhtml10t = {
\ 'param': ['/>', ''],
\ }
\ }
-" vim:ft=vim:ff=unix