summaryrefslogtreecommitdiff
path: root/runtime/autoload
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-11-23 21:25:05 +0000
committerBram Moolenaar <Bram@vim.org>2005-11-23 21:25:05 +0000
commita5792f58905da28f0ab37e1c4c3cfd8171b2e602 (patch)
tree258ddcfde89bbf98b90d42dd6c297e1b22a20d09 /runtime/autoload
parentaf289d333a2985051948a53d510fa345df1ddeb3 (diff)
downloadvim-a5792f58905da28f0ab37e1c4c3cfd8171b2e602.zip
updated for version 7.0158
Diffstat (limited to 'runtime/autoload')
-rw-r--r--runtime/autoload/htmlcomplete.vim206
-rw-r--r--runtime/autoload/netrw.vim672
-rw-r--r--runtime/autoload/netrwSettings.vim161
-rw-r--r--runtime/autoload/tar.vim409
-rw-r--r--runtime/autoload/xmlcomplete.vim428
-rw-r--r--runtime/autoload/zip.vim38
6 files changed, 1152 insertions, 762 deletions
diff --git a/runtime/autoload/htmlcomplete.vim b/runtime/autoload/htmlcomplete.vim
index a773ff204..bd138e6bb 100644
--- a/runtime/autoload/htmlcomplete.vim
+++ b/runtime/autoload/htmlcomplete.vim
@@ -1,7 +1,7 @@
" Vim completion script
" Language: XHTML 1.0 Strict
" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
-" Last Change: 2005 Oct 12
+" Last Change: 2005 Now 20
function! htmlcomplete#CompleteTags(findstart, base)
if a:findstart
@@ -52,10 +52,13 @@ function! htmlcomplete#CompleteTags(findstart, base)
if exists("b:entitiescompl")
unlet! b:entitiescompl
- " Very, very long line
- let values = ["AElig", "Aacute", "Acirc", "Agrave", "Alpha", "Aring", "Atilde", "Auml", "Beta", "Ccedil", "Chi", "Dagger", "Delta", "ETH", "Eacute", "Ecirc", "Egrave", "Epsilon", "Eta", "Euml", "Gamma", "Iacute", "Icirc", "Igrave", "Iota", "Iuml", "Kappa", "Lambda", "Mu", "Ntilde", "Nu", "OElig", "Oacute", "Ocirc", "Ograve", "Omega", "Omicron", "Oslash", "Otilde", "Ouml", "Phi", "Pi", "Prime", "Psi", "Rho", "Scaron", "Sigma", "THORN", "TITY", "Tau", "Theta", "Uacute", "Ucirc", "Ugrave", "Upsilon", "Uuml", "Xi", "Yacute", "Yuml", "Zeta", "amp", "aacute", "acirc", "acute", "aelig", "agrave", "alefsym", "alpha", "and", "ang", "apos", "aring", "asymp", "atilde", "auml", "bdquo", "beta", "brvbar", "bull", "cap", "ccedil", "cedil", "cent", "chi", "circ", "clubs", "copy", "cong", "crarr", "cup", "curren", "dArr", "dagger", "darr", "deg", "delta", "diams", "divide", "eacute", "ecirc", "egrave", "empty", "ensp", "emsp", "epsilon", "equiv", "eta", "eth", "euro", "euml", "exist", "fnof", "forall", "frac12", "frac14", "frac34", "frasl", "gt", "gamma", "ge", "hArr", "harr", "hearts", "hellip", "iacute", "icirc", "iexcl", "igrave", "image", "infin", "int", "iota", "iquest", "isin", "iuml", "kappa", "lt", "laquo", "lArr", "lambda", "lang", "larr", "lceil", "ldquo", "le", "lfloor", "lowast", "loz", "lrm", "lsaquo", "lsquo", "macr", "mdash", "micro", "middot", "minus", "mu", "nbsp", "nabla", "ndash", "ne", "ni", "not", "notin", "nsub", "ntilde", "nu", "oacute", "ocirc", "oelig", "ograve", "oline", "omega", "omicron", "oplus", "or", "ordf", "ordm", "oslash", "otilde", "otimes", "ouml", "para", "part", "permil", "perp", "phi", "pi", "piv", "plusmn", "pound", "prime", "prod", "prop", "psi", "quot", "rArr", "raquo", "radic", "rang", "rarr", "rceil", "rdquo", "real", "reg", "rfloor", "rho", "rlm", "rsaquo", "rsquo", "sbquo", "scaron", "sdot", "sect", "shy", "sigma", "sigmaf", "sim", "spades", "sub", "sube", "sum", "sup", "sup1", "sup2", "sup3", "supe", "szlig", "tau", "there4", "theta", "thetasym", "thinsp", "thorn", "tilde", "times", "trade", "uArr", "uacute", "uarr", "ucirc", "ugrave", "uml", "upsih", "upsilon", "uuml", "weierp", "xi", "yacute", "yen", "yuml", "zeta", "zwj", "zwnj"]
+ if !exists("g:xmldata_xhtml10s")
+ runtime! autoload/xml/xhtml10s.vim
+ endif
+
+ let entities = g:xmldata_xhtml10s['vimxmlentities']
- for m in values
+ for m in entities
if m =~ '^'.a:base
call add(res, m.';')
endif
@@ -114,6 +117,7 @@ function! htmlcomplete#CompleteTags(findstart, base)
let head = getline(search('<head\>'), search('<\/head>'))
let headjoined = join(copy(head), ' ')
if headjoined =~ '<style'
+ " Remove possibly confusing CSS operators
let stylehead = substitute(headjoined, '+>\*[,', ' ', 'g')
if search_for == 'class'
let styleheadlines = split(stylehead)
@@ -447,68 +451,18 @@ function! htmlcomplete#CompleteTags(findstart, base)
" Close tag
let b:unaryTagsStack = "base meta link hr br param img area input col"
if context =~ '^\/'
- let opentag = htmlcomplete#GetLastOpenTag("b:unaryTagsStack")
+ let opentag = xmlcomplete#GetLastOpenTag("b:unaryTagsStack")
return [opentag.">"]
endif
" Deal with tag completion.
- let opentag = htmlcomplete#GetLastOpenTag("b:unaryTagsStack")
- " Clusters
- let special = "br span bdo map object img"
- let phrase = "em strong dfn code q samp kbd var cite abbr acronym sub sup"
- let inlineforms = "input select textarea label button"
- let miscinline = "ins del script"
- let inline = "a ".special." ".phrase." ".inlineforms." tt i b big small"
- let misc = "noscript ".miscinline
- let block = "p h1 h2 h3 h4 h5 h6 div ul ol dl pre hr blockquote address fieldset table"
-
- if opentag == 'a'
- let tags = split("tt i b big small ".special." ".phrase." ".inlineforms." ".miscinline)
- elseif opentag =~ '^\(abbr\|acronym\|address\|b\|p\|h\d\|dt\|span\|bdo\|em\|strong\|dfn\|code\|samp\|kbd\|var\|cite\|q\|sub\|sup\|tt\|i\|big\|small\|label\|caption\)$'
- let tags = split(inline." ".miscinline)
- elseif opentag == 'pre'
- let tags = split("a tt i b big small br span bdo map ".phrase." ".miscinline." ".inlineforms)
- elseif opentag == 'html'
- let tags = ["head", "body"]
- elseif opentag == 'legend'
- let tags = split(inline." ".miscinline)
- elseif opentag == 'head'
- let tags = ["title", "base", "scipt", "style", "meta", "link", "object"]
- elseif opentag =~ '^\(noscript\|body\|blockquote\)$'
- let tags = split("form ".block." ".misc)
- elseif opentag =~ '^\(ul\|ol\)$'
- let tags = ["li"]
- elseif opentag == 'dl'
- let tags = ["dt", "dd"]
- elseif opentag =~ '^\(ins\|del\|th\|td\|dd\|div\|li\)$'
- let tags = split("form ".block." ".inline." ".misc)
- elseif opentag == 'object'
- let tags = split("param form ".block." ".inline." ".misc)
- elseif opentag == 'fieldset'
- let tags = split("legend form ".block." ".inline." ".misc)
- elseif opentag == 'map'
- let tags = split("area form ".block." ".misc)
- elseif opentag == 'form'
- let tags = split(block." ".misc)
- elseif opentag == 'select'
- let tags = ["optgroup", "option"]
- elseif opentag == 'optgroup'
- let tags = ["option"]
- elseif opentag == 'colgroup'
- let tags = ["col"]
- elseif opentag == '^\(textarea\|option\|script\|style\|title\)$'
- let tags = ['empty']
- elseif opentag == 'button'
- let tags = ["p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "ul", "ol", "dl", "table"]
- elseif opentag =~ '^\(thead\|tfoot\|tbody\)$'
- let tags = ["tr"]
- elseif opentag == 'tr'
- let tags = ["th", "td"]
- elseif opentag == 'table'
- let tags = ["caption", "col", "colgroup", "thead", "tfoot", "tbody", "tr"]
- else
- return []
+ let opentag = xmlcomplete#GetLastOpenTag("b:unaryTagsStack")
+
+ if !exists("g:xmldata_xhtml10s")
+ runtime! autoload/xml/xhtml10s.vim
endif
+ let tags = g:xmldata_xhtml10s[opentag][0]
+
for m in tags
if m =~ '^'.context
call add(res, m)
@@ -521,133 +475,3 @@ function! htmlcomplete#CompleteTags(findstart, base)
endif
endfunction
-
-" MM: This is greatly reduced closetag.vim used with kind permission of Steven
-" Mueller
-" Changes: strip all comments; delete error messages
-" Author: Steven Mueller <diffusor@ugcs.caltech.edu>
-" Last Modified: Tue May 24 13:29:48 PDT 2005
-" Version: 0.9.1
-
-function! htmlcomplete#GetLastOpenTag(unaryTagsStack)
- let linenum=line('.')
- let lineend=col('.') - 1 " start: cursor position
- let first=1 " flag for first line searched
- let b:TagStack='' " main stack of tags
- let startInComment=s:InComment()
-
- let tagpat='</\=\(\k\|[-:]\)\+\|/>'
- while (linenum>0)
- let line=getline(linenum)
- if first
- let line=strpart(line,0,lineend)
- else
- let lineend=strlen(line)
- endif
- let b:lineTagStack=''
- let mpos=0
- let b:TagCol=0
- while (mpos > -1)
- let mpos=matchend(line,tagpat)
- if mpos > -1
- let b:TagCol=b:TagCol+mpos
- let tag=matchstr(line,tagpat)
-
- if exists('b:closetag_disable_synID') || startInComment==s:InCommentAt(linenum, b:TagCol)
- let b:TagLine=linenum
- call s:Push(matchstr(tag,'[^<>]\+'),'b:lineTagStack')
- endif
- let lineend=lineend-mpos
- let line=strpart(line,mpos,lineend)
- endif
- endwhile
- while (!s:EmptystackP('b:lineTagStack'))
- let tag=s:Pop('b:lineTagStack')
- if match(tag, '^/') == 0 "found end tag
- call s:Push(tag,'b:TagStack')
- elseif s:EmptystackP('b:TagStack') && !s:Instack(tag, a:unaryTagsStack) "found unclosed tag
- return tag
- else
- let endtag=s:Peekstack('b:TagStack')
- if endtag == '/'.tag || endtag == '/'
- call s:Pop('b:TagStack') "found a open/close tag pair
- elseif !s:Instack(tag, a:unaryTagsStack) "we have a mismatch error
- return ''
- endif
- endif
- endwhile
- let linenum=linenum-1 | let first=0
- endwhile
-return ''
-endfunction
-
-function! s:InComment()
- return synIDattr(synID(line('.'), col('.'), 0), 'name') =~ 'Comment'
-endfunction
-
-function! s:InCommentAt(line, col)
- return synIDattr(synID(a:line, a:col, 0), 'name') =~ 'Comment'
-endfunction
-
-function! s:SetKeywords()
- let g:IsKeywordBak=&iskeyword
- let &iskeyword='33-255'
-endfunction
-
-function! s:RestoreKeywords()
- let &iskeyword=g:IsKeywordBak
-endfunction
-
-function! s:Push(el, sname)
- if !s:EmptystackP(a:sname)
- exe 'let '.a:sname."=a:el.' '.".a:sname
- else
- exe 'let '.a:sname.'=a:el'
- endif
-endfunction
-
-function! s:EmptystackP(sname)
- exe 'let stack='.a:sname
- if match(stack,'^ *$') == 0
- return 1
- else
- return 0
- endif
-endfunction
-
-function! s:Instack(el, sname)
- exe 'let stack='.a:sname
- call s:SetKeywords()
- let m=match(stack, '\<'.a:el.'\>')
- call s:RestoreKeywords()
- if m < 0
- return 0
- else
- return 1
- endif
-endfunction
-
-function! s:Peekstack(sname)
- call s:SetKeywords()
- exe 'let stack='.a:sname
- let top=matchstr(stack, '\<.\{-1,}\>')
- call s:RestoreKeywords()
- return top
-endfunction
-
-function! s:Pop(sname)
- if s:EmptystackP(a:sname)
- return ''
- endif
- exe 'let stack='.a:sname
- call s:SetKeywords()
- let loc=matchend(stack,'\<.\{-1,}\>')
- exe 'let '.a:sname.'=strpart(stack, loc+1, strlen(stack))'
- let top=strpart(stack, match(stack, '\<'), loc)
- call s:RestoreKeywords()
- return top
-endfunction
-
-function! s:Clearstack(sname)
- exe 'let '.a:sname."=''"
-endfunction
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim
index d989dc00f..5a06bb0a2 100644
--- a/runtime/autoload/netrw.vim
+++ b/runtime/autoload/netrw.vim
@@ -1,96 +1,36 @@
" netrw.vim: Handles file transfer and remote directory listing across a network
" AUTOLOAD PORTION
-" Date: Oct 12, 2005
-" Version: 73
+" Last Change: Aug 31, 2005
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim
" Copyright: Copyright (C) 1999-2005 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,
-" netrw.vim, netrwPlugin.vim, and netrwSettings.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.
+" netrw.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.
"
" But be doers of the Word, and not only hearers, deluding your own selves {{{1
" (James 1:22 RSV)
" =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
-" Exception for &cp: {{{1
-if &cp || exists("g:loaded_netrw")
- finish
-endif
-let g:loaded_netrw = "v73"
+let s:keepcpo= &cpo
+set cpo&vim
+" call Decho("doing autoload/netrw.vim")
if v:version < 700
echohl WarningMsg | echo "***netrw*** you need vim version 7.0 or later for version ".g:loaded_netrw." of netrw" | echohl None
finish
endif
-let s:keepcpo = &cpo
-set cpo&vim
-" call Decho("doing autoload/netrw.vim")
-
-" ---------------------------------------------------------------------
-" Default values for netrw's global protocol variables {{{1
-if !exists("g:netrw_dav_cmd")
- let g:netrw_dav_cmd = "cadaver"
-endif
-if !exists("g:netrw_fetch_cmd")
- if executable("fetch")
- let g:netrw_fetch_cmd = "fetch -o"
- else
- let g:netrw_fetch_cmd = ""
- endif
-endif
-if !exists("g:netrw_ftp_cmd")
- let g:netrw_ftp_cmd = "ftp"
-endif
-if !exists("g:netrw_http_cmd")
- if executable("wget")
- let g:netrw_http_cmd = "wget -q -O"
- elseif executable("fetch")
- let g:netrw_http_cmd = "fetch -o"
- else
- let g:netrw_http_cmd = ""
- endif
-endif
-if !exists("g:netrw_rcp_cmd")
- let g:netrw_rcp_cmd = "rcp"
-endif
-if !exists("g:netrw_rsync_cmd")
- let g:netrw_rsync_cmd = "rsync"
-endif
-if !exists("g:netrw_scp_cmd")
- let g:netrw_scp_cmd = "scp -q"
-endif
-if !exists("g:netrw_sftp_cmd")
- let g:netrw_sftp_cmd = "sftp"
-endif
-if !exists("g:netrw_ssh_cmd")
- let g:netrw_ssh_cmd= "ssh"
-endif
-
-if has("win32") || has("win95") || has("win64") || has("win16")
- \ && exists("g:netrw_use_nt_rcp")
- \ && g:netrw_use_nt_rcp
- \ && executable( $SystemRoot .'/system32/rcp.exe')
- let s:netrw_has_nt_rcp = 1
- let s:netrw_rcpmode = '-b'
- else
- let s:netrw_has_nt_rcp = 0
- let s:netrw_rcpmode = ''
-endif
" ---------------------------------------------------------------------
-" Default values for netrw's global variables {{{1
-" Default values - a-c ---------- {{{2
-if !exists("g:netrw_alto")
- let g:netrw_alto= 0
+" Default values for global netrw variables {{{1
+if !exists("g:netrw_ftpmode")
+ let g:netrw_ftpmode= "binary"
endif
-if !exists("g:netrw_altv")
- let g:netrw_altv= 0
+if !exists("g:netrw_win95ftp")
+ let g:netrw_win95ftp= 1
endif
if !exists("g:netrw_cygwin")
if has("win32") || has("win95") || has("win64") || has("win16")
@@ -103,15 +43,14 @@ if !exists("g:netrw_cygwin")
let g:netrw_cygwin= 0
endif
endif
-" Default values - d-f ---------- {{{2
-if !exists("g:NETRW_DIRHIST_CNT")
- let g:NETRW_DIRHIST_CNT= 0
-endif
-if !exists("g:netrw_dirhistmax")
- let g:netrw_dirhistmax= 10
-endif
-if !exists("g:netrw_ftp_browse_reject")
- let g:netrw_ftp_browse_reject='^total\s\+\d\+$\|^Trying\s\+\d\+.*$\|^KERBEROS_V\d rejected\|^Security extensions not\|No such file\|: connect to address [0-9a-fA-F:]*: No route to host$'
+if !exists("g:netrw_list_cmd")
+ if executable("ssh")
+ " provide a default listing command
+ let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa"
+ else
+" call Decho("ssh is not executable, can't do remote directory exploring with ssh")
+ let g:netrw_list_cmd= ""
+ endif
endif
if !exists("g:netrw_ftp_list_cmd")
if has("unix") || exists("g:netrw_cygwin")
@@ -120,96 +59,75 @@ if !exists("g:netrw_ftp_list_cmd")
let g:netrw_ftp_list_cmd= "dir"
endif
endif
-if !exists("g:netrw_ftpmode")
- let g:netrw_ftpmode= "binary"
-endif
-" Default values - h-lh ---------- {{{2
-if !exists("g:netrw_hide")
- let g:netrw_hide= 1
-endif
-if !exists("g:netrw_keepdir")
- let g:netrw_keepdir= 1
-endif
-if !exists("g:netrw_list_cmd")
- if executable(g:netrw_ssh_cmd)
- " provide a default listing command
- let g:netrw_list_cmd= g:netrw_ssh_cmd." HOSTNAME ls -FLa"
- else
-" call Decho(g:netrw_ssh_cmd." is not executable, can't do remote directory exploring)
- let g:netrw_list_cmd= ""
- endif
-endif
-if !exists("g:netrw_list_hide")
- let g:netrw_list_hide= ""
-endif
-" Default values - lh-lz ---------- {{{2
-if !exists("g:netrw_local_mkdir")
- let g:netrw_local_mkdir= "mkdir"
-endif
-if !exists("g:netrw_local_rmdir")
- let g:netrw_local_rmdir= "rmdir"
-endif
-if !exists("g:netrw_longlist")
- let g:netrw_longlist= 0
-endif
-if g:netrw_longlist < 0 || g:netrw_longlist > 2
- " sanity check
- let g:netrw_longlist= 0
-endif
-if g:netrw_longlist == 1
- let g:netrw_list_cmd= g:netrw_list_cmd." -l"
-endif
-" Default values - m-r ---------- {{{2
-if !exists("g:netrw_maxfilenamelen")
- let g:netrw_maxfilenamelen= 32
-endif
-if !exists("g:netrw_mkdir_cmd")
- let g:netrw_mkdir_cmd= g:netrw_ssh_cmd." HOSTNAME mkdir"
-endif
-if !exists("g:netrw_rename_cmd")
- let g:netrw_rename_cmd= g:netrw_ssh_cmd." HOSTNAME mv"
-endif
if !exists("g:netrw_rm_cmd")
- let g:netrw_rm_cmd = g:netrw_ssh_cmd." HOSTNAME rm"
+ let g:netrw_rm_cmd = "ssh HOSTNAME rm"
+endif
+if !exists("g:netrw_rmf_cmd")
+ let g:netrw_rmf_cmd = "ssh HOSTNAME rm -f"
endif
if !exists("g:netrw_rmdir_cmd")
- let g:netrw_rmdir_cmd = g:netrw_ssh_cmd." HOSTNAME rmdir"
+ let g:netrw_rmdir_cmd = "ssh HOSTNAME rmdir"
endif
-if !exists("g:netrw_rmf_cmd")
- let g:netrw_rmf_cmd = g:netrw_ssh_cmd." HOSTNAME rm -f"
+if !exists("g:netrw_rename_cmd")
+ let g:netrw_rename_cmd= "ssh HOSTNAME mv"
endif
-" Default values - s ---------- {{{2
if exists("g:netrw_silent") && g:netrw_silent != 0
let g:netrw_silentxfer= "silent "
else
let g:netrw_silentxfer= ""
endif
+if !exists("g:netrw_winsize")
+ let g:netrw_winsize= ""
+endif
+if !exists("g:netrw_list_hide")
+ let g:netrw_list_hide= ""
+endif
if !exists("g:netrw_sort_by")
" alternatives: date size
let g:netrw_sort_by= "name"
endif
+if !exists("g:netrw_sort_sequence")
+ let g:netrw_sort_sequence= '[\/]$,*,\.bak$,\.o$,\.h$,\.info$,\.swp$,\.obj$'
+endif
if !exists("g:netrw_sort_direction")
" alternative: reverse (z y x ...)
let g:netrw_sort_direction= "normal"
endif
-if !exists("g:netrw_sort_sequence")
- let g:netrw_sort_sequence= '[\/]$,*,\.bak$,\.o$,\.h$,\.info$,\.swp$,\.obj$'
+if !exists("g:netrw_longlist")
+ let g:netrw_longlist= 0
endif
-if !exists("g:netrw_ssh_browse_reject")
- let g:netrw_ssh_browse_reject='^total\s\+\d\+$'
+if g:netrw_longlist == 0 || g:netrw_longlist == 2
+ let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa"
+else
+ let g:netrw_longlist= 1
+ let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa -l"
+endif
+if !exists("g:netrw_list_cmd")
endif
-" Default values - t-w ---------- {{{2
if !exists("g:netrw_timefmt")
let g:netrw_timefmt= "%c"
endif
-if !exists("g:netrw_win95ftp")
- let g:netrw_win95ftp= 1
+if !exists("g:netrw_local_rmdir")
+ let g:netrw_local_rmdir= "rmdir"
endif
-if !exists("g:netrw_winsize")
- let g:netrw_winsize= ""
+if !exists("g:netrw_local_mkdir")
+ let g:netrw_local_mkdir= "mkdir"
+endif
+if !exists("g:netrw_mkdir_cmd")
+ let g:netrw_mkdir_cmd= "ssh HOSTNAME mkdir"
+endif
+if !exists("g:netrw_hide")
+ let g:netrw_hide= 1
+endif
+if !exists("g:netrw_ftp_browse_reject")
+ let g:netrw_ftp_browse_reject='^total\s\+\d\+$\|^Trying\s\+\d\+.*$\|^KERBEROS_V\d rejected\|^Security extensions not\|No such file\|: connect to address [0-9a-fA-F:]*: No route to host$'
+endif
+if !exists("g:netrw_ssh_browse_reject")
+ let g:netrw_ssh_browse_reject='^total\s\+\d\+$'
+endif
+if !exists("g:netrw_keepdir")
+ let g:netrw_keepdir= 1
endif
-" ---------------------------------------------------------------------
-" Default values for netrw's script variables: {{{1
if !exists("s:netrw_cd_escape")
if has("win32") || has("win95") || has("win64") || has("win16")
let s:netrw_cd_escape="#% "
@@ -224,12 +142,75 @@ if !exists("s:netrw_glob_escape")
let s:netrw_glob_escape= '[]*?`{~$'
endif
endif
+if !exists("g:netrw_alto")
+ let g:netrw_alto= 0
+endif
+if !exists("g:netrw_altv")
+ let g:netrw_altv= 0
+endif
+if !exists("g:netrw_maxfilenamelen")
+ let g:netrw_maxfilenamelen= 32
+endif
+if !exists("g:netrw_dirhistmax")
+ let g:netrw_dirhistmax= 10
+endif
+if !exists("g:NETRW_DIRHIST_CNT")
+ let g:NETRW_DIRHIST_CNT= 0
+endif
" BufEnter event ignored by decho when following variable is true
" Has a side effect that doau BufReadPost doesn't work, so
" files read by network transfer aren't appropriately highlighted.
"let g:decho_bufenter = 1 "Decho
+" ---------------------------------------------------------------------
+" Default values for global protocol variables {{{1
+if !exists("g:netrw_rcp_cmd")
+ let g:netrw_rcp_cmd = "rcp"
+endif
+if !exists("g:netrw_ftp_cmd")
+ let g:netrw_ftp_cmd = "ftp"
+endif
+if !exists("g:netrw_scp_cmd")
+ let g:netrw_scp_cmd = "scp -q"
+endif
+if !exists("g:netrw_sftp_cmd")
+ let g:netrw_sftp_cmd = "sftp"
+endif
+if !exists("g:netrw_http_cmd")
+ if executable("wget")
+ let g:netrw_http_cmd = "wget -q -O"
+ elseif executable("fetch")
+ let g:netrw_http_cmd = "fetch -o"
+ else
+ let g:netrw_http_cmd = ""
+ endif
+endif
+if !exists("g:netrw_dav_cmd")
+ let g:netrw_dav_cmd = "cadaver"
+endif
+if !exists("g:netrw_rsync_cmd")
+ let g:netrw_rsync_cmd = "rsync"
+endif
+if !exists("g:netrw_fetch_cmd")
+ if executable("fetch")
+ let g:netrw_fetch_cmd = "fetch -o"
+ else
+ let g:netrw_fetch_cmd = ""
+ endif
+endif
+
+if has("win32") || has("win95") || has("win64") || has("win16")
+ \ && exists("g:netrw_use_nt_rcp")
+ \ && g:netrw_use_nt_rcp
+ \ && executable( $SystemRoot .'/system32/rcp.exe')
+ let s:netrw_has_nt_rcp = 1
+ let s:netrw_rcpmode = '-b'
+ else
+ let s:netrw_has_nt_rcp = 0
+ let s:netrw_rcpmode = ''
+endif
+
" ------------------------------------------------------------------------
" NetSavePosn: saves position of cursor on screen {{{1
fun! netrw#NetSavePosn()
@@ -422,14 +403,12 @@ fun! netrw#NetRead(...)
".........................................
" ftp + <.netrc>: NetRead Method #2
elseif b:netrw_method == 2 " read with ftp + <.netrc>
-" call Decho("read via ftp+.netrc (method #2)")
+" call Decho("read via ftp+.netrc (method #2)")
let netrw_fname= b:netrw_fname
new
setlocal ff=unix
exe "put ='".g:netrw_ftpmode."'"
-" call Decho("filter input: ".getline("."))
- exe "put ='".'get \"'.netrw_fname.'\" '.tmpfile."'"
-" call Decho("filter input: ".getline("."))
+ exe "put ='"."get ".netrw_fname." ".tmpfile."'"
if exists("g:netrw_port") && g:netrw_port != ""
" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port)
exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port
@@ -446,7 +425,7 @@ fun! netrw#NetRead(...)
let &debug= debugkeep
endif
bd!
- let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
+ let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
let b:netrw_lastfile = choice
".........................................
@@ -459,33 +438,27 @@ fun! netrw#NetRead(...)
setlocal ff=unix
if exists("g:netrw_port") && g:netrw_port != ""
put ='open '.g:netrw_machine.' '.g:netrw_port
-" call Decho("filter input: ".getline("."))
else
put ='open '.g:netrw_machine
-" call Decho("filter input: ".getline("."))
endif
if exists("g:netrw_ftp") && g:netrw_ftp == 1
put =g:netrw_uid
-" call Decho("filter input: ".getline("."))
- put ='\"'.g:netrw_passwd.'\"'
-" call Decho("filter input: ".getline("."))
+ put =g:netrw_passwd
else
- put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"'
-" call Decho("filter input: ".getline("."))
+ put ='user '.g:netrw_uid.' '.g:netrw_passwd
endif
if exists("g:netrw_ftpmode") && g:netrw_ftpmode != ""
put =g:netrw_ftpmode
-" call Decho("filter input: ".getline("."))
endif
- put ='get \"'.netrw_fname.'\" '.tmpfile
-" call Decho("filter input: ".getline("."))
+ put ='get '.netrw_fname.' '.tmpfile
" perform ftp:
" -i : turns off interactive prompting from ftp
" -n unix : DON'T use <.netrc>, even though it exists
" -n win32: quit being obnoxious about password
+" call Decho('performing ftp -i -n')
norm! 1Gdd
" call Decho("executing: %!".g:netrw_ftp_cmd." -i -n")
exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n"
@@ -518,7 +491,7 @@ fun! netrw#NetRead(...)
" call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile)
exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(b:netrw_fname,' ?&')." ".tmpfile
endif
- let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
+ let result = s:NetGetFile(readcmd, tmpfile, b:netrw_method)
let b:netrw_lastfile = choice
".........................................
@@ -529,8 +502,7 @@ fun! netrw#NetRead(...)
echohl Error | echo "***netrw*** neither wget nor fetch command is available" | echohl None
call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif
-" call Dret("NetRead")
- return
+ exit
endif
if match(b:netrw_fname,"#") == -1
@@ -609,7 +581,7 @@ fun! netrw#NetRead(...)
echohl Error | echo "***netrw*** fetch command not available" | echohl None
call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif
-" call Dret("NetRead")
+ exit
endif
if exists("g:netrw_option") && g:netrw_option == ":http"
let netrw_option= "http"
@@ -666,10 +638,6 @@ endfun
" NetGetFile: Function to read file "fname" with command "readcmd". {{{1
fun! s:NetGetFile(readcmd, fname, method)
" call Dfunc("NetGetFile(readcmd<".a:readcmd.">,fname<".a:fname."> method<".a:method.">)")
-
- " record remote filename
- let rfile= bufname("%")
-" call Decho("rfile<".rfile.">")
if exists("*NetReadFixup")
" for the use of NetReadFixup (not otherwise used internally)
@@ -687,12 +655,15 @@ fun! s:NetGetFile(readcmd, fname, method)
endif
else
let fname= a:fname
-" call Decho("fname=a:fname<".fname.">")
+" call Decho("(copied) fname<".fname.">")
endif
if a:readcmd[0] == '0'
" get file into buffer
+ " record remote filename
+ let rfile= bufname(".")
+" call Decho("remotefile<".rfile.">")
" call Dredir("ls!","starting buffer list")
" rename the current buffer to the temp file (ie. fname)
@@ -717,12 +688,8 @@ fun! s:NetGetFile(readcmd, fname, method)
exe a:readcmd." ".v:cmdarg." ".fname
let line1 = curline + 1
let line2 = line("$") - lastline + 1
-
else
" not readable
-" call Dfunc("NetGetFile(readcmd<".a:readcmd.">,fname<".a:fname."> method<".a:method.">)")
- echohl WarningMsg | echo "***netrw*** file <".fname."> not readable"| echohl None
- call inputsave()|call input("Press <cr> to continue")|call inputrestore()
" call Dret("NetGetFile : fname<".fname."> not readable")
return
endif
@@ -762,7 +729,7 @@ fun! netrw#NetWrite(...) range
if !isdirectory(substitute(tmpfile,'[^/]\+$','','e'))
echohl Error | echo "***netrw*** your ".substitute(tmpfile,'[^/]\+$','','e')." directory is missing!"
call inputsave()|call input("Press <cr> to continue")|call inputrestore()
-" call Dret("NetWrite")
+" call Dret("NetRead")
return
endif
@@ -872,9 +839,9 @@ fun! netrw#NetWrite(...) range
new
setlocal ff=unix
exe "put ='".g:netrw_ftpmode."'"
-" call Decho(" filter input: ".getline("."))
- exe "put ='"."put ".tmpfile.' \"'.netrw_fname.'\"'."'"
-" call Decho(" filter input: ".getline("."))
+" call Decho(" NetWrite: put ='".g:netrw_ftpmode."'")
+ exe "put ='"."put ".tmpfile." ".netrw_fname."'"
+" call Decho("put ='"."put ".tmpfile." ".netrw_fname."'")
if exists("g:netrw_port") && g:netrw_port != ""
" call Decho("executing: %!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port)
exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port
@@ -901,22 +868,16 @@ fun! netrw#NetWrite(...) range
setlocal ff=unix
if exists("g:netrw_port") && g:netrw_port != ""
put ='open '.g:netrw_machine.' '.g:netrw_port
-" call Decho("filter input: ".getline("."))
else
put ='open '.g:netrw_machine
-" call Decho("filter input: ".getline("."))
endif
if exists("g:netrw_ftp") && g:netrw_ftp == 1
put =g:netrw_uid
-" call Decho("filter input: ".getline("."))
- put ='\"'.g:netrw_passwd.'\"'
-" call Decho("filter input: ".getline("."))
+ put =g:netrw_passwd
else
- put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"'
-" call Decho("filter input: ".getline("."))
+ put ='user '.g:netrw_uid.' '.g:netrw_passwd
endif
- put ='put '.tmpfile.' \"'.netrw_fname.'\"'
-" call Decho("filter input: ".getline("."))
+ put ='put '.tmpfile.' '.netrw_fname
" save choice/id/password for future use
let b:netrw_lastfile = choice
@@ -924,6 +885,7 @@ fun! netrw#NetWrite(...) range
" -i : turns off interactive prompting from ftp
" -n unix : DON'T use <.netrc>, even though it exists
" -n win32: quit being obnoxious about password
+" call Decho('performing ftp -i -n')
norm! 1Gdd
" call Decho("executing: %!".g:netrw_ftp_cmd." -i -n")
exe g:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n"
@@ -1076,7 +1038,7 @@ fun! s:NetBrowse(dirname)
endif
elseif !exists("g:netrw_list_cmd") || g:netrw_list_cmd == ''
if !exists("g:netrw_quiet")
- echohl Error | echo "***netrw*** this system doesn't support remote directory listing via ".g:netrw_list_cmd | echohl None
+ echohl Error | echo "***netrw*** this system doesn't support remote directory listing via ssh" | echohl None
call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif
@@ -1094,7 +1056,7 @@ fun! s:NetBrowse(dirname)
" analyze a:dirname and g:netrw_list_cmd
let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$'
let dirname = substitute(a:dirname,'\\','/','ge')
-" call Decho("dirname<".dirname.">")
+" call Decho("dirpat<".dirpat.">")
if dirname !~ dirpat
if !exists("g:netrw_quiet")
echohl Error | echo "***netrw*** netrw doesn't understand your dirname<".dirname.">" | echohl None
@@ -1164,9 +1126,9 @@ fun! s:NetBrowse(dirname)
" call Decho("new path<".path.">")
" remote-read the requested file into current buffer
- keepjumps keepalt enew!
+ enew!
set ma
-" call Decho("exe file ".method."://".user.machine."/".escape(path,s:netrw_cd_escape))
+" call Decho("exe file .method."://".user.machine."/".escape(path,s:netrw_cd_escape))
exe "file ".method."://".user.machine."/".escape(path,s:netrw_cd_escape)
exe "silent doau BufReadPre ".fname
silent call netrw#NetRead(method."://".user.machine."/".path)
@@ -1174,7 +1136,7 @@ fun! s:NetBrowse(dirname)
keepjumps 1d
" save certain window-oriented variables into buffer-oriented variables
- call s:SetBufWinVars()
+ call s:BufWinVars()
call s:NetOptionRestore()
setlocal nomod
@@ -1200,7 +1162,7 @@ fun! s:NetBrowse(dirname)
endif
else
" call Decho("generate a new buffer")
- keepjumps keepalt enew!
+ enew!
endif
" rename file to reflect where its from
@@ -1238,7 +1200,7 @@ fun! s:NetBrowse(dirname)
nnoremap <buffer> <silent> U :<c-u>call <SID>NetBookmarkDir(5,expand("%"))<cr>
nnoremap <buffer> <silent> v :call <SID>NetSplit(1)<cr>
nnoremap <buffer> <silent> x :call <SID>NetBrowseX(<SID>NetBrowseChgDir(expand("%"),<SID>NetGetWord()),1)<cr>
- nnoremap <buffer> <silent> <2-leftmouse> :call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),<SID>NetGetWord()))<cr>
+ nnoremap <buffer> <silent> <2-leftmouse> :call <SID>NetBrowse(<SID>NetBrowseChgDir(expand("%"),<SID>NetGetWord()))<cr>
exe 'nnoremap <buffer> <silent> <del> :call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
exe 'vnoremap <buffer> <silent> <del> :call <SID>NetBrowseRm("'.user.machine.'","'.path.'")<cr>'
exe 'nnoremap <buffer> <silent> d :call <SID>NetMakeDir("'.user.machine.'")<cr>'
@@ -1298,7 +1260,6 @@ fun! s:NetBrowse(dirname)
if g:netrw_ftp_browse_reject != ""
exe "silent! g/".g:netrw_ftp_browse_reject."/keepjumps d"
endif
- silent! keepjumps %s/\r$//e
" if there's no ../ listed, then put ./ and ../ in
let line1= line(".")
@@ -1313,9 +1274,9 @@ fun! s:NetBrowse(dirname)
keepjumps norm! 0
" more cleanup
- exe 'silent! keepjumps '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e'
- exe "silent! keepjumps ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e'
- exe "silent! keepjumps ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e'
+ exe 'keepjumps silent! '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e'
+ exe "keepjumps silent! ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e'
+ exe "keepjumps silent! ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e'
endif
else
@@ -1372,33 +1333,33 @@ fun! s:NetBrowse(dirname)
keepjumps norm! 0
endif
- exe 'silent keepjumps '.w:netrw_bannercnt.',$s/ -> .*$//e'
- exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2\t\1/e'
- exe 'silent keepjumps '.w:netrw_bannercnt
+ exe 'keepjumps silent '.w:netrw_bannercnt.',$s/ -> .*$//e'
+ exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2\t\1/e'
+ exe w:netrw_bannercnt
endif
if line("$") >= w:netrw_bannercnt
if g:netrw_sort_by =~ "^n"
call s:SetSort()
if g:netrw_sort_direction =~ 'n'
- exe 'silent keepjumps '.w:netrw_bannercnt.',$sort'
+ exe 'keepjumps silent '.w:netrw_bannercnt.',$sort'
else
- exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'
+ exe 'keepjumps silent '.w:netrw_bannercnt.',$sort!'
endif
- exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{3}\///e'
+ exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\d\{3}\///e'
endif
if w:netrw_longlist == 1
" shorten the list to keep its width <= winwidth characters
- exe "silent keepjumps ".w:netrw_bannercnt.',$s/\t[-dstrwx]\+/\t/e'
+ exe "keepjumps silent ".w:netrw_bannercnt.',$s/\t[-dstrwx]\+/\t/e'
endif
endif
endif
+ " cleanup any windows mess at end-of-line
+ keepjumps silent! %s/\r$//e
call s:NetrwWideListing()
if line("$") >= w:netrw_bannercnt
- " place cursor on the top-left corner of the file listing
exe "keepjumps ".w:netrw_bannercnt
- norm! 0
endif
call s:NetOptionRestore()
@@ -1488,7 +1449,7 @@ fun! s:NetGetWord()
let s:netrw_skipbrowse= 1
echo 'Pressing "a" also works'
elseif line("$") > w:netrw_bannercnt
- exe 'silent keepjumps '.w:netrw_bannercnt
+ exe w:netrw_bannercnt
endif
elseif w:netrw_longlist == 0
@@ -1552,9 +1513,6 @@ fun! s:NetBrowseRm(usrhost,path) range
let ok= input("Confirm deletion of file<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
call inputrestore()
echohl NONE
- if ok == ""
- let ok="no"
- endif
let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
if ok =~ 'a\%[ll]'
let all= 1
@@ -1581,9 +1539,6 @@ fun! s:NetBrowseRm(usrhost,path) range
call inputsave()
let ok= input("Confirm deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
call inputrestore()
- if ok == ""
- let ok="no"
- endif
let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
if ok =~ 'a\%[ll]'
let all= 1
@@ -1735,12 +1690,12 @@ fun! s:NetBrowseX(fname,remote)
" create a local copy
let fname= tempname().".".exten
" call Decho("create a local copy of <".a:fname."> as <".fname.">")
- exe "silent keepjumps bot 1new ".a:fname
+ exe "keepjumps silent bot 1new ".a:fname
set bh=delete
exe "w! ".fname
q
endif
-" call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten))
+" call Decho("exten<".exten."> "."NetrwFileHandler_".exten."():exists=".exists("*NetrwFileHandler_".exten))
" set up redirection
if &srr =~ "%s"
@@ -1756,22 +1711,19 @@ fun! s:NetBrowseX(fname,remote)
exe 'silent !start rundll32 url.dll,FileProtocolHandler "'.escape(fname, '%#').'"'
let ret= v:shell_error
- elseif has("unix") && executable("gnome-open")
-" call Decho("exe silent !gnome-open '".escape(fname,'%#')."' ".redir)
- exe "silent !gnome-open '".escape(fname,'%#')."'".redir
- let ret= v:shell_error
-
elseif has("unix") && executable("kfmclient")
" call Decho("exe silent !kfmclient exec '".escape(fname,'%#')."' ".redir)
exe "silent !kfmclient exec '".escape(fname,'%#')."' ".redir
let ret= v:shell_error
- else
- call netrwFileHandlers#Init()
- if exten != "" && exists("*netrwFileHandlers#NFH_".exten)
-" call Decho("let ret= netrwFileHandlers#NFH_".exten.'("'.fname.'")')
- exe "let ret= netrwFileHandlers#NFH_".exten.'("'.fname.'")'
- endif
+ elseif has("unix") && executable("gnome-open")
+" call Decho("exe silent !gnome-open '".escape(fname,'%#')."' ".redir)
+ exe "silent !gnome-open '".escape(fname,'%#')."'".redir
+ let ret= v:shell_error
+
+ elseif exten != "" && exists("*NetrwFileHandler_".exten)
+" call Decho("let ret= NetrwFileHandler_".exten.'("'.fname.'")')
+ exe "let ret= NetrwFileHandler_".exten.'("'.fname.'")'
endif
redraw!
@@ -1813,11 +1765,11 @@ fun! s:NetBrowseFtpCmd(path,cmd)
if w:netrw_method == 2 || w:netrw_method == 5
" ftp + <.netrc>: Method #2
if a:path != ""
- put ='cd \"'.a:path.'\"'
-" call Decho('ftp: '.getline("."))
+ put ='cd '.a:path
+" call Decho("ftp: cd ".a:path)
endif
exe "put ='".a:cmd."'"
-" call Decho("ftp: ".getline("."))
+" call Decho("ftp: ".a:cmd)
" redraw!|call inputsave()|call input("Pausing...")|call inputrestore()
if exists("g:netrw_port") && g:netrw_port != ""
" call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port)
@@ -1839,13 +1791,13 @@ fun! s:NetBrowseFtpCmd(path,cmd)
if exists("g:netrw_ftp") && g:netrw_ftp == 1
put =g:netrw_uid
- put ='\"'.g:netrw_passwd.'\"'
+ put =g:netrw_passwd
else
- put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"'
+ put ='user '.g:netrw_uid.' '.g:netrw_passwd
endif
if a:path != ""
- put ='cd \"'.a:path.'\"'
+ put ='cd '.a:path
endif
exe "put ='".a:cmd."'"
@@ -1863,14 +1815,14 @@ fun! s:NetBrowseFtpCmd(path,cmd)
" cleanup for Windows
if has("win32") || has("win95") || has("win64") || has("win16")
- silent! keepjumps! %s/\r$//e
+ keepjumps silent!! %s/\r$//e
endif
if a:cmd == "dir"
" infer directory/link based on the file permission string
- silent! keepjumps g/d\%([-r][-w][-x]\)\{3}/s@$@/@
- silent! keepjumps g/l\%([-r][-w][-x]\)\{3}/s/$/@/
+ keepjumps silent! g/d\%([-r][-w][-x]\)\{3}/s@$@/@
+ keepjumps silent! g/l\%([-r][-w][-x]\)\{3}/s/$/@/
if w:netrw_longlist == 0 || w:netrw_longlist == 2
- exe "silent! keepjumps ".curline.',$s/^\%(\S\+\s\+\)\{8}//e'
+ exe "keepjumps silent! ".curline.',$s/^\%(\S\+\s\+\)\{8}//e'
endif
endif
@@ -1908,9 +1860,9 @@ fun! s:NetrwListHide()
" Prune the list by hiding any files which match
" call Decho("pruning <".hide."> listhide<".listhide.">")
if g:netrw_hide == 1
- exe 'silent keepjumps '.w:netrw_bannercnt.',$g~'.hide.'~d'
+ exe 'keepjumps silent '.w:netrw_bannercnt.',$g~'.hide.'~d'
elseif g:netrw_hide == 2
- exe 'silent keepjumps '.w:netrw_bannercnt.',$v~'.hide.'~d'
+ exe 'keepjumps silent '.w:netrw_bannercnt.',$v~'.hide.'~d'
endif
endwhile
@@ -2044,10 +1996,10 @@ fun! s:NetrwWideListing()
exe "silent keepjumps norm! 0\<c-v>".newcolqty.'j$hx'.w:netrw_bannercnt.'G$p'
endif
exe "silent keepjumps ".newcolstart.','.newcolend.'d'
- exe 'silent keepjumps '.w:netrw_bannercnt
+ exe w:netrw_bannercnt
endwhile
exe "silent keepjumps ".w:netrw_bannercnt.',$s/\s\+$//e'
- setlocal noma nomod
+ set noma nomod
endif
" call Dret("NetrwWideListing")
@@ -2178,12 +2130,9 @@ fun! s:NetBookmarkDir(chg,curdir)
if exists("w:netrw_bannercnt") && line(".") <= w:netrw_bannercnt
" looks like a "b" was pressed while in the banner region
if line("$") > w:netrw_bannercnt
- exe 'silent keepjumps '.w:netrw_bannercnt
- endif
- if &ch > 1
- " "clear" the message
- echo ""
+ exe w:netrw_bannercnt
endif
+ echo ""
" call Dret("NetBookmarkDir - ignoring")
return
endif
@@ -2280,10 +2229,12 @@ endfun
" ---------------------------------------------------------------------
" NetObtain: obtain file under cursor (for remote browsing support) {{{2
fun! s:NetObtain()
+ if !exists("s:netrw_users_stl")
+ let s:netrw_users_stl= &stl
+ endif
let fname= expand("<cWORD>")
-
- " NetrwStatusLine support - for obtaining support
- call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.fname)
+ exe 'set stl=%f\ %h%m%r%=Obtaining\ '.escape(fname,' ')
+ redraw!
" call Dfunc("NetObtain() method=".w:netrw_method)
if exists("w:netrw_method") && w:netrw_method =~ '[235]'
@@ -2326,11 +2277,11 @@ fun! s:NetObtain()
if exists("g:netrw_ftp") && g:netrw_ftp == 1
put =g:netrw_uid
- put ='\"'.g:netrw_passwd.'\"'
+ put =g:netrw_passwd
" call Decho('ftp: g:netrw_uid')
" call Decho('ftp: g:netrw_passwd')
else
- put ='user \"'.g:netrw_uid.'\" \"'.g:netrw_passwd.'\"'
+ put ='user '.g:netrw_uid.' '.g:netrw_passwd
" call Decho('user '.g:netrw_uid.' '.g:netrw_passwd)
endif
@@ -2355,14 +2306,12 @@ fun! s:NetObtain()
" restore
exe "silent! ".endline.",$d"
exe "keepjumps ".curline
- setlocal noma nomod
+ set noma nomod
else
if !exists("g:netrw_quiet")
echohl Error | echo "***netrw*** this system doesn't support ftp" | echohl None
call inputsave()|call input("Press <cr> to continue")|call inputrestore()
endif
- let &stl = s:netrw_users_stl
- let &laststatus = s:netrw_users_ls
" call Dret("NetObtain")
return
endif
@@ -2370,8 +2319,6 @@ fun! s:NetObtain()
".........................................
else
" scp: Method#4
- let curdir = expand("%")
- let path = substitute(curdir,'scp://[^/]\+/','','e')
if exists("g:netrw_port") && g:netrw_port != ""
let useport= " -P ".g:netrw_port
else
@@ -2379,17 +2326,16 @@ fun! s:NetObtain()
endif
if g:netrw_cygwin == 1
let cygtmpfile=substitute(tmpfile,'^\(\a\):','/cygdrive/\1/','e')
-" call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".path.escape(fname,' ?&')." .")
- exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".path.escape(fname,' ?&')." ."
+" call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(fname,' ?&')." .")
+ exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(fname,' ?&')." ."
else
-" call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".path.escape(fname,' ?&')." .")
- exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".path.escape(fname,' ?&')." ."
+" call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(fname,' ?&')." .")
+ exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".escape(fname,' ?&')." ."
endif
endif
" restore status line
- let &stl = s:netrw_users_stl
- let &laststatus = s:netrw_users_ls
+ let &stl= s:netrw_users_stl
redraw!
" call Dret("NetObtain")
@@ -2458,7 +2404,7 @@ fun! netrw#DirBrowse(dirname)
" get cleared buffer
if bufnum < 0 || !bufexists(bufnum)
- keepjumps keepalt enew!
+ keepalt enew!
" call Decho("enew buffer")
else
exe "keepalt b ".bufnum
@@ -2550,7 +2496,7 @@ fun! netrw#DirBrowse(dirname)
nnoremap <buffer> <silent> U :<c-u>call <SID>NetBookmarkDir(5,expand("%"))<cr>
nnoremap <buffer> <silent> v :call <SID>NetSplit(3)<cr>
nnoremap <buffer> <silent> x :call <SID>NetBrowseX(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord(),0),0)"<cr>
- nnoremap <buffer> <silent> <2-leftmouse> :call <SID>LocalBrowse(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))<cr>
+ nnoremap <buffer> <silent> <2-leftmouse> :exe "call <SID>LocalRefresh(<SID>LocalBrowseChgDir(b:netrw_curdir,<SID>NetGetWord()))"<cr>
nnoremap <buffer> <silent> <s-up> :Pexplore<cr>
nnoremap <buffer> <silent> <s-down> :Nexplore<cr>
exe 'nnoremap <buffer> <silent> <del> :call <SID>LocalBrowseRm("'.b:netrw_curdir.'")<cr>'
@@ -2628,19 +2574,19 @@ fun! netrw#DirBrowse(dirname)
call s:SetSort()
if g:netrw_sort_direction =~ 'n'
- exe 'silent keepjumps '.w:netrw_bannercnt.',$sort'
+ exe 'keepjumps silent '.w:netrw_bannercnt.',$sort'
else
- exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'
+ exe 'keepjumps silent '.w:netrw_bannercnt.',$sort!'
endif
- exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{3}\///e'
+ exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\d\{3}\///e'
else
if g:netrw_sort_direction =~ 'n'
- exe 'silent keepjumps '.w:netrw_bannercnt.',$sort'
+ exe 'keepjumps silent '.w:netrw_bannercnt.',$sort'
else
- exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'
+ exe 'keepjumps silent '.w:netrw_bannercnt.',$sort!'
endif
- exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{-}\///e'
+ exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\d\{-}\///e'
endif
endif
@@ -2648,16 +2594,14 @@ fun! netrw#DirBrowse(dirname)
call s:NetrwWideListing()
if exists("w:netrw_bannercnt") && line("$") > w:netrw_bannercnt
- " place cursor on the top-left corner of the file listing
- exe 'silent '.w:netrw_bannercnt
- norm! 0
+ exe w:netrw_bannercnt
endif
" record previous current directory
let w:netrw_prvdir= b:netrw_curdir
" save certain window-oriented variables into buffer-oriented variables
- call s:SetBufWinVars()
+ call s:BufWinVars()
call s:NetOptionRestore()
setlocal noma nomod nonu bh=hide nobl
@@ -2757,7 +2701,7 @@ fun! s:LocalBrowseList()
endwhile
" cleanup any windows mess at end-of-line
- silent! keepjumps %s/\r$//e
+ keepjumps silent! %s/\r$//e
setlocal ts=32
" call Dret("LocalBrowseList")
@@ -2848,12 +2792,7 @@ fun! s:LocalBrowseRm(path) range
let ok= input("Confirm deletion of file<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
call inputrestore()
echohl NONE
- if ok == ""
- let ok="no"
- endif
-" call Decho("response: ok<".ok.">")
let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
-" call Decho("response: ok<".ok."> (after sub)")
if ok =~ 'a\%[ll]'
let all= 1
endif
@@ -2874,9 +2813,6 @@ fun! s:LocalBrowseRm(path) range
let ok= input("Confirm deletion of directory<".rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ")
call inputrestore()
let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e')
- if ok == ""
- let ok="no"
- endif
if ok =~ 'a\%[ll]'
let all= 1
endif
@@ -3065,7 +3001,6 @@ fun! netrw#Explore(indx,dosplit,style,...)
" call Decho("calling NetBrowse(newdir<".newdir.">)")
call s:NetBrowse(newdir)
else
- if newdir == ""|let newdir= "."|endif
" call Decho("calling LocalBrowse(newdir<".newdir.">)")
call s:LocalBrowse(newdir)
endif
@@ -3097,8 +3032,12 @@ fun! netrw#Explore(indx,dosplit,style,...)
endif
endif
- " NetrwStatusLine support - for exploring support
+ " NetrwStatusLine support
let w:netrw_explore_indx= indx
+ if !exists("s:netrw_users_stl")
+ let s:netrw_users_stl= &stl
+ endif
+ set stl=%f\ %h%m%r%=%{NetrwStatusLine()}
" call Decho("explorelist<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen)
" sanity check
@@ -3111,21 +3050,15 @@ fun! netrw#Explore(indx,dosplit,style,...)
endif
exe "let dirfile= w:netrw_explore_list[".indx."]"
-" call Decho("dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">")
+" call Decho("dirfile<".dirfile."> indx=".indx)
let newdir= substitute(dirfile,'/[^/]*$','','e')
" call Decho("newdir<".newdir.">")
-
" call Decho("calling LocalBrowse(newdir<".newdir.">)")
call s:LocalBrowse(newdir)
- if w:netrw_longlist == 0 || w:netrw_longlist == 1
- call search('^'.substitute(dirfile,"^.*/","","").'\>',"W")
- else
- call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w")
- endif
+ call search(substitute(dirfile,"^.*/","",""),"W")
let w:netrw_explore_mtchcnt = indx + 1
let w:netrw_explore_bufnr = bufnr(".")
let w:netrw_explore_line = line(".")
- call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}')
" call Decho("explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line)
else
@@ -3145,73 +3078,12 @@ fun! netrw#Explore(indx,dosplit,style,...)
endfun
" ---------------------------------------------------------------------
-" SetupNetrwStatusLine: {{{2
-fun! s:SetupNetrwStatusLine(statline)
-" call Dfunc("SetupNetrwStatusLine(statline<".a:statline.">)")
-
- if !exists("s:netrw_setup_statline")
- let s:netrw_setup_statline= 1
-" call Decho("do first-time status line setup")
-
- if !exists("s:netrw_users_stl")
- let s:netrw_users_stl= &stl
- endif
- if !exists("s:netrw_users_ls")
- let s:netrw_users_ls= &laststatus
- endif
-
- " set up User9 highlighting as needed
- let keepa= @a
- redir @a
- try
- hi User9
- catch /^Vim\%((\a\+)\)\=:E411/
- if &bg == "dark"
- hi User9 ctermfg=yellow ctermbg=blue guifg=yellow guibg=blue
- else
- hi User9 ctermbg=yellow ctermfg=blue guibg=yellow guifg=blue
- endif
- endtry
- redir END
- let @a= keepa
- endif
-
- " set up status line (may use User9 highlighting)
- " insure that windows have a statusline
- " make sure statusline is displayed
- let &stl=a:statline
- set laststatus=2
-" call Decho("stl=".&stl)
- redraw!
-
-" call Dret("SetupNetrwStatusLine : stl=".&stl)
-endfun
-
-" ---------------------------------------------------------------------
" NetrwStatusLine: {{{2
fun! NetrwStatusLine()
-
- " vvv NetrwStatusLine() debugging vvv
-" let g:stlmsg=""
-" if !exists("w:netrw_explore_bufnr")
-" let g:stlmsg="!X<explore_bufnr>"
-" elseif w:netrw_explore_bufnr != bufnr(".")
-" let g:stlmsg="explore_bufnr!=".bufnr(".")
-" endif
-" if !exists("w:netrw_explore_line")
-" let g:stlmsg=" !X<explore_line>"
-" elseif w:netrw_explore_line != line(".")
-" let g:stlmsg=" explore_line!={line(.)<".line(".").">"
-" endif
-" if !exists("w:netrw_explore_list")
-" let g:stlmsg=" !X<explore_list>"
-" endif
- " ^^^ NetrwStatusLine() debugging ^^^
-
+" let g:stlmsg= "Xbufnr=".w:netrw_explore_bufnr." bufnr=".bufnr(".")." Xline#".w:netrw_explore_line." line#".line(".")
if !exists("w:netrw_explore_bufnr") || w:netrw_explore_bufnr != bufnr(".") || !exists("w:netrw_explore_line") || w:netrw_explore_line != line(".") || !exists("w:netrw_explore_list")
" restore user's status line
- let &stl = s:netrw_users_stl
- let &laststatus = s:netrw_users_ls
+ let &stl= s:netrw_users_stl
if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif
if exists("w:netrw_explore_line")|unlet w:netrw_explore_line|endif
return ""
@@ -3274,7 +3146,7 @@ fun! s:NetMethod(choice) " globals: method machine id passwd fname
let ftpurm = '^ftp://\(\([^/@]\{-}\)@\)\=\([^/#:]\{-}\)\([#:]\d\+\)\=/\(.*\)$'
let rcpurm = '^rcp://\%(\([^/@]\{-}\)@\)\=\([^/]\{-}\)/\(.*\)$'
let rcphf = '^\(\(\h\w*\)@\)\=\(\h\w*\):\([^@]\+\)$'
- let scpurm = '^scp://\([^/#:]\+\)\%([#:]\(\d\+\)\)\=/\(.*\)$'
+ let scpurm = '^scp://\([^/]\{-}\)\([#:]\d\+\)\=/\(.*\)$'
let httpurm = '^http://\([^/]\{-}\)\(/.*\)\=$'
let davurm = '^s\=dav://\([^/]\+\)/\(.*/\)\([-_.~[:alnum:]]\+\)$'
let rsyncurm = '^rsync://\([^/]\{-}\)/\(.*\)\=$'
@@ -3418,6 +3290,11 @@ fun! s:NetMethod(choice) " globals: method machine id passwd fname
let b:netrw_method = -1
endif
+ " surround password with double-quotes if it contains embedded blanks
+ if g:netrw_passwd !~ '^"' && g:netrw_passwd =~ ' '
+ let g:netrw_passwd= '"'.g:netrw_passwd.'"'
+ endif
+
" remove any leading [:#] from port number
if g:netrw_port != ""
let g:netrw_port = substitute(g:netrw_port,'[#:]\+','','')
@@ -3464,7 +3341,6 @@ fun! NetUserPass(...)
" call Decho("a:0=".a:0." case >1: a:2<".a:2.">")
let g:netrw_passwd=a:2
endif
-
" call Dret("NetUserPass")
endfun
@@ -3486,21 +3362,20 @@ fun! s:NetOptionSave()
let w:acdkeep = &autochdir
set noautochdir
endif
- let w:cinkeep = &cin
- let w:cinokeep = &cino
- let w:comkeep = &com
- let w:cpokeep = &cpo
+ let w:cinkeep = &cin
+ let w:cinokeep = &cino
+ let w:comkeep = &com
+ let w:cpokeep = &cpo
if !g:netrw_keepdir
- let w:dirkeep = getcwd()
+ let w:dirkeep = getcwd()
endif
- let w:gdkeep = &gd
- let w:repkeep = &report
- let w:spellkeep = &spell
- let w:twkeep = &tw
+ let w:gdkeep = &gd
+ let w:repkeep = &report
+ let w:twkeep = &tw
setlocal cino =
setlocal com =
setlocal cpo -=aA
- setlocal nocin noai nospell
+ setlocal nocin noai
setlocal tw =0
setlocal report=10000
if has("win32") && !has("win95")
@@ -3522,22 +3397,22 @@ fun! s:NetOptionRestore()
endif
unlet w:netoptionsave
- if exists("w:aikeep")| let &ai= w:aikeep|endif
- if (has("netbeans_intg") || has("sun_workshop")) && exists("w:acdkeep")
- let &acd= w:acdkeep
- unlet w:acdkeep
- endif
- if exists("w:cinkeep") |let &cin = w:cinkeep |unlet w:cinkeep |endif
- if exists("w:cinokeep") |let &cino = w:cinokeep |unlet w:cinokeep |endif
- if exists("w:comkeep") |let &com = w:comkeep |unlet w:comkeep |endif
- if exists("w:cpokeep") |let &cpo = w:cpokeep |unlet w:cpokeep |endif
- if exists("w:dirkeep") |exe "lcd ".w:dirkeep |unlet w:dirkeep |endif
- if exists("w:gdkeep") |let &gd = w:gdkeep |unlet w:gdkeep |endif
- if exists("w:repkeep") |let &report = w:repkeep |unlet w:repkeep |endif
- if exists("w:spellkeep")|let &spell = w:spellkeep |unlet w:spellkeep|endif
- if exists("w:twkeep") |let &tw = w:twkeep |unlet w:twkeep |endif
+ let &ai = w:aikeep
+ if has("netbeans_intg") || has("sun_workshop")
+ let &acd = w:acdkeep
+ endif
+ let &cin = w:cinkeep
+ let &cino = w:cinokeep
+ let &com = w:comkeep
+ let &cpo = w:cpokeep
+ if exists("w:dirkeep")
+ exe "lcd ".w:dirkeep
+ endif
+ let &gd = w:gdkeep
+ let &report = w:repkeep
+ let &tw = w:twkeep
if exists("w:swfkeep")
- if &directory == "" && exists("w:swfkeep")
+ if &directory == ""
" user hasn't specified a swapfile directory;
" netrw will temporarily make the swapfile
" directory the current local one.
@@ -3549,6 +3424,17 @@ fun! s:NetOptionRestore()
endif
unlet w:swfkeep
endif
+ unlet w:aikeep
+ unlet w:cinkeep
+ unlet w:cinokeep
+ unlet w:comkeep
+ unlet w:cpokeep
+ unlet w:gdkeep
+ unlet w:repkeep
+ unlet w:twkeep
+ if exists("w:dirkeep")
+ unlet w:dirkeep
+ endif
" call Dret("NetOptionRestore")
endfun
@@ -3560,7 +3446,7 @@ endfun
" example and as a fix for a Windows 95 problem: in my
" experience, win95's ftp always dumped four blank lines
" at the end of the transfer.
-if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp
+if has("win95") && g:netrw_win95ftp
fun! NetReadFixup(method, line1, line2)
" call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")")
if method == 3 " ftp (no <.netrc>)
@@ -3661,14 +3547,14 @@ fun! s:SetSort()
return
endif
if seq == '*'
- exe 'silent keepjumps '.w:netrw_bannercnt.',$v/^\d\{3}\//s/^/'.spriority.'/'
+ exe 'keepjumps silent '.w:netrw_bannercnt.',$v/^\d\{3}\//s/^/'.spriority.'/'
else
- exe 'silent keepjumps '.w:netrw_bannercnt.',$g/'.eseq.'/s/^/'.spriority.'/'
+ exe 'keepjumps silent '.w:netrw_bannercnt.',$g/'.eseq.'/s/^/'.spriority.'/'
endif
let priority = priority + 1
endwhile
- exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\(\d\{3}\/\)\%(\d\{3}\/\)\+/\1/e'
+ exe 'keepjumps silent '.w:netrw_bannercnt.',$s/^\(\d\{3}\/\)\%(\d\{3}\/\)\+/\1/e'
" call Dret("SetSort")
endfun
@@ -3706,14 +3592,14 @@ fun! s:CopyWinVars()
endfun
" ---------------------------------------------------------------------
-" SetBufWinVars: (used by NetBrowse() and LocalBrowse()) {{{1
+" BufWinVars: (used by NetBrowse() and LocalBrowse()) {{{1
" To allow separate windows to have their own activities, such as
" Explore **/pattern, several variables have been made window-oriented.
" However, when the user splits a browser window (ex: ctrl-w s), these
-" variables are not inherited by the new window. SetBufWinVars() and
+" variables are not inherited by the new window. BufWinVars() and
" UseBufWinVars() get around that.
-fun! s:SetBufWinVars()
-" call Dfunc("SetBufWinVars()")
+fun! s:BufWinVars()
+" call Dfunc("BufWinVars()")
if exists("w:netrw_longlist") |let b:netrw_longlist = w:netrw_longlist |endif
if exists("w:netrw_bannercnt") |let b:netrw_bannercnt = w:netrw_bannercnt |endif
if exists("w:netrw_method") |let b:netrw_method = w:netrw_method |endif
@@ -3724,7 +3610,7 @@ fun! s:SetBufWinVars()
if exists("w:netrw_explore_bufnr") |let b:netrw_explore_bufnr = w:netrw_explore_bufnr |endif
if exists("w:netrw_explore_line") |let b:netrw_explore_line = w:netrw_explore_line |endif
if exists("w:netrw_explore_list") |let b:netrw_explore_list = w:netrw_explore_list |endif
-" call Dret("SetBufWinVars")
+" call Dret("BufWinVars")
endfun
" ---------------------------------------------------------------------
diff --git a/runtime/autoload/netrwSettings.vim b/runtime/autoload/netrwSettings.vim
new file mode 100644
index 000000000..368af5532
--- /dev/null
+++ b/runtime/autoload/netrwSettings.vim
@@ -0,0 +1,161 @@
+" netrwSettings.vim: makes netrw settings simpler
+" Date: Oct 12, 2005
+" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
+" Version: 4
+" Copyright: Copyright (C) 1999-2005 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,
+" netrwSettings.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.
+"
+" Mat 4:23 (WEB) Jesus went about in all Galilee, teaching in their {{{1
+" synagogues, preaching the gospel of the kingdom, and healing
+" every disease and every sickness among the people.
+" Load Once: {{{1
+if exists("g:loaded_netrwSettings") || &cp
+ finish
+endif
+let g:loaded_netrwSettings = "v4"
+
+" ---------------------------------------------------------------------
+" NetrwSettings: {{{1
+fun! netrwSettings#NetrwSettings()
+ " this call is here largely just to insure that netrw has been loaded
+ call netrw#NetSavePosn()
+ if !exists("g:loaded_netrw")
+ echohl WarningMsg | echomsg "***sorry*** netrw needs to be loaded prior to using NetrwSettings" | echohl None
+ return
+ endif
+
+ above wincmd s
+ enew
+ setlocal noswapfile bh=wipe
+ set ft=vim
+ file Netrw\ Settings
+
+ " these variables have the following default effects when they don't
+ " exist (ie. have not been set by the user in his/her .vimrc)
+ if !exists("g:netrw_longlist")
+ let g:netrw_longlist= 0
+ let g:netrw_list_cmd= "ssh HOSTNAME ls -FLa"
+ endif
+ if !exists("g:netrw_silent")
+ let g:netrw_silent= 0
+ endif
+ if !exists("g:netrw_use_nt_rcp")
+ let g:netrw_use_nt_rcp= 0
+ endif
+ if !exists("g:netrw_ftp")
+ let g:netrw_ftp= 0
+ endif
+ if !exists("g:netrw_ignorenetrc")
+ let g:netrw_ignorenetrc= 0
+ endif
+
+ put ='+ ---------------------------------------------'
+ put ='+ NetrwSettings: (by Charles E. Campbell, Jr.)'
+ put ='+ Press ? with cursor atop any line for help '
+ put ='+ ---------------------------------------------'
+ let s:netrw_settings_stop= line(".")
+
+ put =''
+ put ='+ Netrw Protocol Commands'
+ put = 'let g:netrw_dav_cmd = '.g:netrw_dav_cmd
+ put = 'let g:netrw_fetch_cmd = '.g:netrw_fetch_cmd
+ put = 'let g:netrw_ftp_cmd = '.g:netrw_ftp_cmd
+ put = 'let g:netrw_http_cmd = '.g:netrw_http_cmd
+ put = 'let g:netrw_rcp_cmd = '.g:netrw_rcp_cmd
+ put = 'let g:netrw_rsync_cmd = '.g:netrw_rsync_cmd
+ put = 'let g:netrw_scp_cmd = '.g:netrw_scp_cmd
+ put = 'let g:netrw_sftp_cmd = '.g:netrw_sftp_cmd
+ put = 'let g:netrw_ssh_cmd = '.g:netrw_ssh_cmd
+ let s:netrw_protocol_stop= line(".")
+ put = ''
+
+ put ='+Netrw Transfer Control'
+ put = 'let g:netrw_cygwin = '.g:netrw_cygwin
+ put = 'let g:netrw_ftp = '.g:netrw_ftp
+ put = 'let g:netrw_ftpmode = '.g:netrw_ftpmode
+ put = 'let g:netrw_ignorenetrc = '.g:netrw_ignorenetrc
+ put = 'let g:netrw_use_nt_rcp = '.g:netrw_use_nt_rcp
+ put = 'let g:netrw_win95ftp = '.g:netrw_win95ftp
+ let s:netrw_xfer_stop= line(".")
+
+ put = ''
+ put ='+ Netrw Browser Control'
+ put = 'let g:netrw_alto = '.g:netrw_alto
+ put = 'let g:netrw_altv = '.g:netrw_altv
+ put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax
+ put = 'let g:netrw_ftp_browse_reject = '.g:netrw_ftp_browse_reject
+ put = 'let g:netrw_ftp_list_cmd = '.g:netrw_ftp_list_cmd
+ put = 'let g:netrw_hide = '.g:netrw_hide
+ put = 'let g:netrw_keepdir = '.g:netrw_keepdir
+ put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd
+ put = 'let g:netrw_list_hide = '.g:netrw_list_hide
+ put = 'let g:netrw_local_mkdir = '.g:netrw_local_mkdir
+ put = 'let g:netrw_local_rmdir = '.g:netrw_local_rmdir
+ put = 'let g:netrw_longlist = '.g:netrw_longlist
+ put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen
+ put = 'let g:netrw_mkdir_cmd = '.g:netrw_mkdir_cmd
+ put = 'let g:netrw_rename_cmd = '.g:netrw_rename_cmd
+ put = 'let g:netrw_rm_cmd = '.g:netrw_rm_cmd
+ put = 'let g:netrw_rmdir_cmd = '.g:netrw_rmdir_cmd
+ put = 'let g:netrw_rmf_cmd = '.g:netrw_rmf_cmd
+ put = 'let g:netrw_silent = '.g:netrw_silent
+ put = 'let g:netrw_sort_by = '.g:netrw_sort_by
+ put = 'let g:netrw_sort_direction = '.g:netrw_sort_direction
+ put = 'let g:netrw_sort_sequence = '.g:netrw_sort_sequence
+ put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject
+ put = 'let g:netrw_timefmt = '.g:netrw_timefmt
+ put = 'let g:netrw_winsize = '.g:netrw_winsize
+
+ put =''
+ put ='+ For help, place cursor on line and press ?'
+
+ 1d
+ silent %s/^+/"/e
+ res 99
+ silent %s/= \([^0-9].*\)$/= '\1'/e
+ silent %s/= $/= ''/e
+ 1
+
+ set nomod
+
+ map <buffer> <silent> ? :call NetrwSettingHelp()<cr>
+ let tmpfile= tempname()
+ exe 'au BufWriteCmd Netrw\ Settings silent w! '.tmpfile.'|so '.tmpfile.'|call delete("'.tmpfile.'")|set nomod'
+endfun
+
+" ---------------------------------------------------------------------
+" NetrwSettingHelp: {{{2
+fun! NetrwSettingHelp()
+" call Dfunc("NetrwSettingHelp()")
+ let curline = getline(".")
+ if curline =~ '='
+ let varhelp = substitute(curline,'^\s*let ','','e')
+ let varhelp = substitute(varhelp,'\s*=.*$','','e')
+" call Decho("trying help ".varhelp)
+ try
+ exe "he ".varhelp
+ catch /^Vim\%((\a\+)\)\=:E149/
+ echo "***sorry*** no help available for <".varhelp.">"
+ endtry
+ elseif line(".") < s:netrw_settings_stop
+ he netrw-settings
+ elseif line(".") < s:netrw_protocol_stop
+ he netrw-externapp
+ elseif line(".") < s:netrw_xfer_stop
+ he netrw-variables
+ else
+ he netrw-browse-var
+ endif
+" call Dret("NetrwSettingHelp")
+endfun
+
+" ---------------------------------------------------------------------
+" Modelines: {{{1
+" vim:ts=8 fdm=marker
diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim
index 0234059b0..66d2eb5ce 100644
--- a/runtime/autoload/tar.vim
+++ b/runtime/autoload/tar.vim
@@ -1,79 +1,172 @@
+" tar.vim: Handles browsing tarfiles
+" AUTOLOAD PORTION
+" Date: Nov 18, 2005
+" Version: 4
+" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
+" License: Vim License (see vim's :help license)
"
-" tar.vim -- a Vim plugin for browsing tarfiles
-" Copyright (c) 2002, Michael C. Toren <mct@toren.net>
-" Distributed under the GNU General Public License.
+" Contains many ideas from Michael Toren's <tar.vim>
"
-" Version: 2
-" Date: Sep 14, 2005
-" Modified By: Charles E. Campbell, Jr.
-"
-" Updates are available from <http://michael.toren.net/code/>. If you
-" find this script useful, or have suggestions for improvements, please
-" let me know.
-" Also look there for further comments and documentation.
-"
-" This part defines the functions. The autocommands are in plugin/tar.vim.
-if exists("g:loaded_tar") || &cp
+" Copyright: Copyright (C) 2005 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.
+
+" ---------------------------------------------------------------------
+" Initialization: {{{1
+let s:keepcpo= &cpo
+set cpo&vim
+if exists("g:loaded_tar")
finish
endif
-let g:loaded_tar= "v2"
+let g:loaded_tar= "v4"
" ---------------------------------------------------------------------
-" tar#Read: {{{1
-fun! tar#Read(argument, cleanup)
-" call Dfunc("tar#Read(argument<".a:argument."> cleanup=".a:cleanup.")")
- let l:argument = a:argument
- let l:argument = substitute(l:argument, '^tarfile:', '', '')
- let l:argument = substitute(l:argument, '^\~', $HOME, '')
-
- let l:tarfile = l:argument
- while 1
- if (l:tarfile == "" || l:tarfile == "/")
- echo "***error*** (tar#Read) Could not find a readable tarfile in path:" l:argument
-" call Dret("tar#Read")
- return
- endif
-
- if filereadable(l:tarfile) " found it!
- break
- endif
-
- let l:tarfile = fnamemodify(l:tarfile, ":h")
- endwhile
-
- let l:toextract = strpart(l:argument, strlen(l:tarfile) + 1)
-
- if (l:toextract == "")
-" call Dret("tar#Read")
- return
- endif
+" Default Settings: {{{1
+if !exists("g:tar_browseoptions")
+ let g:tar_browseoptions= "Ptf"
+endif
+if !exists("g:tar_readoptions")
+ let g:tar_readoptions= "OPxf"
+endif
+if !exists("g:tar_writeoptions")
+ let g:tar_writeoptions= "uf"
+endif
- let l:cat = s:TarCatCommand(l:tarfile)
- execute "r !" . l:cat . " < '" . l:tarfile . "'"
- \ " | tar OPxf - '" . l:toextract . "'"
+" ----------------
+" Functions: {{{1
+" ----------------
- if (a:cleanup)
- 0d "blank line
- execute "doautocmd BufReadPost " . expand("%")
- setlocal nomod
- silent preserve
- endif
-" call Dret("tar#Read")
+" ---------------------------------------------------------------------
+" tar#Browse: {{{2
+fun! tar#Browse(tarfile)
+" call Dfunc("tar#Browse(tarfile<".a:tarfile.">)")
+
+ " sanity checks
+ if !executable("tar")
+ echohl Error | echo '***error*** (tar#Browse) "tar" not available on your system'
+ call inputsave()|call input("Press <cr> to continue")|call inputrestore()
+" call Dret("tar#Browse")
+ return
+ endif
+ if !filereadable(a:tarfile)
+ if a:tarfile !~# '^\a\+://'
+ " if its an url, don't complain, let url-handlers such as vim do its thing
+ echohl Error | echo "***error*** (tar#Browse) File not readable<".a:tarfile.">" | echohl None
+ call inputsave()|call input("Press <cr> to continue")|call inputrestore()
+ endif
+" call Dret("tar#Browse : file<".a:tarfile."> not readable")
+ return
+ endif
+ if &ma != 1
+ set ma
+ endif
+ let w:tarfile= a:tarfile
+
+ setlocal noswapfile
+ setlocal buftype=nofile
+ setlocal bufhidden=hide
+ setlocal nobuflisted
+ setlocal nowrap
+ set ft=tar
+
+ " give 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"."'"
+ 0d
+ $
+
+ if a:tarfile =~# '\.\(gz\|tgz\)$'
+ exe "silent r! gzip -d -c '".a:tarfile."'| tar -".g:tar_browseoptions." - "
+ elseif a:tarfile =~# '\.bz2$'
+ exe "silent r! bzip2 -d -c '".a:tarfile."'| tar -".g:tar_browseoptions." - "
+ else
+ exe "silent r! tar -".g:tar_browseoptions." '".a:tarfile."'"
+ endif
+ %g@/$@d
+
+ setlocal noma nomod ro
+ noremap <silent> <buffer> <cr> :call <SID>TarBrowseSelect()<cr>
+
+" call Dret("tar#Browse : w:tarfile<".w:tarfile.">")
endfun
" ---------------------------------------------------------------------
-" tar#Write: {{{1
-fun! tar#Write(argument)
-" call Dfunc("tar#Write(argument<".a:argument.">)")
-"
+" TarBrowseSelect: {{{2
+fun! s:TarBrowseSelect()
+" call Dfunc("TarBrowseSelect() w:tarfile<".w:tarfile."> curfile<".expand("%").">")
+ let fname= getline(".")
+" call Decho("fname<".fname.">")
+
+ " sanity check
+ if fname =~ '^"'
+" call Dret("TarBrowseSelect")
+ return
+ endif
+
+ " about to make a new window, need to use w:tarfile
+ let tarfile= w:tarfile
+ let curfile= expand("%")
+
+ new
+ wincmd _
+ let s:tblfile_{winnr()}= curfile
+" call Decho("exe e tarfile:".tarfile.':'.fname)
+ exe "e tarfile:".tarfile.':'.fname
+ filetype detect
+
+" call Dret("TarBrowseSelect : s:tblfile_".winnr()."<".s:tblfile_{winnr()}.">")
+endfun
+
+" ---------------------------------------------------------------------
+" tar#Read: {{{2
+fun! tar#Read(fname,mode)
+" call Dfunc("tar#Read(fname<".a:fname.">,mode=".a:mode.")")
+ let tarfile = substitute(a:fname,'tarfile:\(.\{-}\):.*$','\1','')
+ let fname = substitute(a:fname,'tarfile:.\{-}:\(.*\)$','\1','')
+" call Decho("tarfile<".tarfile."> fname<".fname.">")
+
+ if tarfile =~# '\.\(gz\|tgz\)$'
+" call Decho("exe silent r! gzip -d -c '".tarfile."'| tar -OPxf - '".fname."'")
+ exe "silent r! gzip -d -c '".tarfile."'| tar -".g:tar_readoptions." - '".fname."'"
+ elseif a:fname =~# '\.bz2$'
+" call Decho("exe silent r! bzip2 -d -c '".tarfile."'| tar -".g:tar_readoptions." - '".fname."'")
+ exe "silent r! bzip2 -d -c '".tarfile."'| tar -".g:tar_readoptions." - '".fname."'"
+ else
+" call Decho("exe silent r! tar -".g:tar_readoptions." '".tarfile."' '".fname."'")
+ exe "silent r! tar -".g:tar_readoptions." '".tarfile."' '".fname."'"
+ endif
+ let w:tarfile= a:fname
+ exe "file tarfile:".fname
+
+ " cleanup
+ 0d
+ set nomod
+
+" call Dret("tar#Read : w:tarfile<".w:tarfile.">")
+endfun
+
+" ---------------------------------------------------------------------
+" tar#Write: {{{2
+fun! tar#Write(fname)
+" call Dfunc("tar#Write(fname<".a:fname.">) w:tarfile<".w:tarfile."> tblfile_".winnr()."<".s:tblfile_{winnr()}.">")
+
" sanity checks
if !executable("tar")
- echo "***error*** (TarWrite) sorry, your system doesn't appear to have the tar pgm"
+ echohl Error | echo '***error*** (tar#Browse) "tar" not available on your system'
+ call inputsave()|call input("Press <cr> to continue")|call inputrestore()
" call Dret("tar#Write")
return
endif
if !exists("*mkdir")
- echo "***error*** (TarWrite) sorry, mkdir() doesn't work on your system"
+ echohl Error | echo "***error*** (tar#Write) sorry, mkdir() doesn't work on your system" | echohl None
+ call inputsave()|call input("Press <cr> to continue")|call inputrestore()
" call Dret("tar#Write")
return
endif
@@ -91,44 +184,104 @@ fun! tar#Write(argument)
try
exe "cd ".escape(tmpdir,' \')
catch /^Vim\%((\a\+)\)\=:E344/
- echo "***error*** (TarWrite) cannot cd to temporary directory"
+ echohl Error | echo "***error*** (tar#Write) cannot cd to temporary directory" | Echohl None
+ call inputsave()|call input("Press <cr> to continue")|call inputrestore()
" call Dret("tar#Write")
return
endtry
" call Decho("current directory now: ".getcwd())
- " place temporary files under .../_TARVIM_/
- if isdirectory("_TARVIM_")
- call s:Rmdir("_TARVIM_")
+ " place temporary files under .../_ZIPVIM_/
+ if isdirectory("_ZIPVIM_")
+ call s:Rmdir("_ZIPVIM_")
endif
- call mkdir("_TARVIM_")
- cd _TARVIM_
+ call mkdir("_ZIPVIM_")
+ cd _ZIPVIM_
" call Decho("current directory now: ".getcwd())
- let tarfile = curdir."/".substitute(a:argument,'tarfile:\([^/]\{-}\)/.*$','\1','')
- let path = substitute(a:argument,'^.\{-}/','','')
- let dirpath = substitute(path,'/\=[^/]\+$','','')
-" call Decho("path <".path.">")
-" call Decho("dirpath<".dirpath.">")
- call mkdir(dirpath,"p")
- exe "w! ".path
- if executable("cygpath")
- let path = substitute(system("cygpath ".path),'\n','','e')
- let tarfile = substitute(system("cygpath ".tarfile),'\n','','e')
+ 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)
+ let tarfile = substitute(tarfile,'\.gz','','e')
+ let compress= "gzip '".tarfile."'"
+ elseif tarfile =~# '\.tgz'
+ call system("gzip -d ".tarfile)
+ let tarfile = substitute(tarfile,'\.tgz','.tar','e')
+ let compress= "gzip '".tarfile."'"
+ let tgz = 1
+ elseif tarfile =~# '\.bz2'
+ call system("bzip2 -d ".tarfile)
+ let tarfile = substitute(tarfile,'\.bz2','','e')
+ let compress= "bzip2 '".tarfile."'"
endif
-" call Decho("tar --delete -f ".tarfile." ".path)
- call system("tar --delete -f ".tarfile." ".path)
if v:shell_error != 0
- echo "***error*** (TarWrite) sorry, your tar pgm doesn't support deletion of ".path
+ echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".tarfile." with ".fname | echohl None
+ call inputsave()|call input("Press <cr> to continue")|call inputrestore()
else
-" call Decho("tar -rf ".tarfile." ".path)
- call system("tar -rf ".tarfile." ".path)
+
+" call Decho("tarfile<".tarfile."> fname<".fname.">")
+
+ let dirpath = substitute(fname,'/[^/]\+$','','e')
+ if tarfile !~ '/'
+ let tarfile= curdir.'/'.tarfile
+ endif
+" call Decho("tarfile<".tarfile."> fname<".fname.">")
+
+ call mkdir(dirpath,"p")
+ exe "w! ".fname
+ if executable("cygpath")
+ let dirpath = substitute(system("cygpath ".dirpath),'\n','','e')
+ let tarfile = substitute(system("cygpath ".tarfile),'\n','','e')
+ endif
+
+ " delete old file from tarfile
+" call Decho("tar --delete -f '".tarfile."' '".fname."'")
+ call system("tar --delete -f '".tarfile."' '".fname."'")
+ if v:shell_error != 0
+ echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".tarfile." with ".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."'")
+ if v:shell_error != 0
+ echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".tarfile." with ".fname | echohl None
+ call inputsave()|call input("Press <cr> to continue")|call inputrestore()
+ elseif exists("compress")
+" call Decho("call system(".compress.")")
+ call system(compress)
+ if exists("tgz")
+" call Decho("rename(".tarfile.".gz,".substitute(tarfile,'\.tar$','.tgz','e').")")
+ call rename(tarfile.".gz",substitute(tarfile,'\.tar$','.tgz','e'))
+ endif
+ endif
+ endif
+
+ " support writing tarfiles across a network
+ if s:tblfile_{winnr()} =~ '^\a\+://'
+" call Decho("handle writing <".tarfile."> across network to <".s:tblfile_{winnr()}.">")
+ let tblfile= s:tblfile_{winnr()}
+ 1split|enew
+ let binkeep= &binary
+ let eikeep = &ei
+ set binary ei=all
+ exe "e! ".tarfile
+ call netrw#NetWrite(tblfile)
+ let &ei = eikeep
+ let &binary = binkeep
+ q!
+ unlet s:tblfile_{winnr()}
+ endif
endif
" cleanup and restore current directory
cd ..
- call s:Rmdir("_TARVIM_")
+ call s:Rmdir("_ZIPVIM_")
exe "cd ".escape(curdir,' \')
setlocal nomod
@@ -136,91 +289,7 @@ fun! tar#Write(argument)
endfun
" ---------------------------------------------------------------------
-" tar#Browse: {{{1
-fun! tar#Browse(tarfile)
-" call Dfunc("tar#Browse(tarfile<".a:tarfile.">)")
- setlocal noswapfile
- setlocal buftype=nofile
- setlocal bufhidden=hide
- setlocal filetype=
- setlocal nobuflisted
- setlocal buftype=nofile
- setlocal wrap
- setlocal syntax=tar
-
- let l:tarfile = a:tarfile
- let b:tarfile = l:tarfile
- let l:cat = s:TarCatCommand(l:tarfile)
-
- if ! filereadable(l:tarfile)
- let l:tarfile = substitute(l:tarfile, '^tarfile:', '', '')
- endif
-
- if ! filereadable(l:tarfile)
- echo "***error*** (tar#Browse) File not readable:" l:tarfile
-" call Dret("tar#Browse")
- return
- endif
-
- call s:Say("\" tar.vim version " . g:loaded_tar)
- call s:Say("\" Browsing tarfile " . l:tarfile)
- call s:Say("\" Hit ENTER to view a file in a new window")
- call s:Say("")
-
- silent execute "r!" . l:cat . "<'" . l:tarfile . "'| tar Ptf - "
- 0d "blank line
- /^$/1
-
- setlocal noma nomod ro
-
- noremap <silent> <buffer> <cr> :call <SID>TarBrowseSelect()<cr>
-" call Dret("tar#Browse")
-endfun
-
-" ---------------------------------------------------------------------
-" TarBrowseSelect: {{{1
-fun! s:TarBrowseSelect()
- let l:line = getline(".")
-
- if (l:line =~ '^" ')
- return
- endif
-
- if (l:line =~ '/$')
- echo "Please specify a file, not a directory"
- return
- endif
-
- let l:selection = "tarfile:" . b:tarfile . "/" . l:line
- new
- wincmd _
- execute "e " . l:selection
-endfun
-
-" ---------------------------------------------------------------------
-" TarCatCommand: kludge to deal with compressed archives {{{1
-fun! s:TarCatCommand(tarfile)
-" call Dfunc("s:TarCatCommand(tarfile<".a:tarfile.">)")
- if a:tarfile =~# '\.\(gz\|tgz\|Z\)$'
- let l:cat = "gzip -d -c"
- elseif a:tarfile =~# '\.bz2$'
- let l:cat = "bzip2 -d -c"
- else
- let l:cat = "cat"
- endif
-" call Dret("s:TarCatCommand ".l:cat)
- return l:cat
-endfun
-
-" ---------------------------------------------------------------------
-" Say: {{{1
-fun! s:Say(string)
- let @" = a:string
- $ put
-endfun
-
-" ---------------------------------------------------------------------
-" Rmdir: {{{1
+" Rmdir: {{{2
fun! s:Rmdir(fname)
" call Dfunc("Rmdir(fname<".a:fname.">)")
if has("unix")
@@ -235,6 +304,8 @@ fun! s:Rmdir(fname)
" call Dret("Rmdir")
endfun
-" ---------------------------------------------------------------------
-" Modelines: {{{1
-" vim:set ts=8 sts=4 sw=4 fdm=marker:
+" ------------------------------------------------------------------------
+" Modelines And Restoration: {{{1
+let &cpo= s:keepcpo
+unlet s:keepcpo
+" vim:ts=8 fdm=marker
diff --git a/runtime/autoload/xmlcomplete.vim b/runtime/autoload/xmlcomplete.vim
new file mode 100644
index 000000000..3cd4c7164
--- /dev/null
+++ b/runtime/autoload/xmlcomplete.vim
@@ -0,0 +1,428 @@
+" Vim completion script
+" Language: XHTML 1.0 Strict
+" Maintainer: Mikolaj Machowski ( mikmach AT wp DOT pl )
+" Last Change: 2005 Nov 22
+
+" This function will create Dictionary with users namespace strings and values
+" canonical (system) names of data files. Names should be lowercase,
+" descriptive to avoid any future conflicts. For example 'xhtml10s' should be
+" name for data of XHTML 1.0 Strict and 'xhtml10t' for XHTML 1.0 Transitional
+" User interface will be provided by XMLns command defined ...
+" Currently supported canonicals are:
+" xhtml10s - XHTML 1.0 Strict
+" xsl - XSL
+function! xmlcomplete#CreateConnection(canonical, ...)
+
+ " When only one argument provided treat name as default namespace (without
+ " 'prefix:').
+ if exists("a:1")
+ let users = a:1
+ else
+ let users = 'DEFAULT'
+ endif
+
+ " Source data file. Due to suspected errors in autoload do it with
+ " :runtime.
+ " TODO: make it properly (using autoload, that is) later
+ exe "runtime autoload/xml/".a:canonical.".vim"
+
+ " Remove all traces of unexisting files to return [] when trying
+ " omnicomplete something
+ " TODO: give warning about non-existing canonicals - should it be?
+ if !exists("g:xmldata_".a:canonical)
+ unlet! g:xmldata_connection
+ return 0
+ endif
+
+ " We need to initialize Dictionary to add key-value pair
+ if !exists("g:xmldata_connection")
+ let g:xmldata_connection = {}
+ endif
+
+ let g:xmldata_connection[users] = a:canonical
+
+endfunction
+
+function! xmlcomplete#CreateEntConnection(...)
+ if a:0 > 0
+ let g:xmldata_entconnect = a:1
+ else
+ let g:xmldata_entconnect = 'DEFAULT'
+ endif
+endfunction
+
+function! xmlcomplete#CompleteTags(findstart, base)
+ if a:findstart
+ " locate the start of the word
+ let line = getline('.')
+ let start = col('.') - 1
+ let compl_begin = col('.') - 2
+
+ while start >= 0 && line[start - 1] =~ '\(\k\|[:.-]\)'
+ let start -= 1
+ endwhile
+
+ if start >= 0 && line[start - 1] =~ '&'
+ let b:entitiescompl = 1
+ let b:compl_context = ''
+ return start
+ endif
+
+ let b:compl_context = getline('.')[0:(compl_begin)]
+ let b:compl_context = matchstr(b:compl_context, '.*<\zs.*')
+
+ " Make sure we will have only current namespace
+ unlet! b:xml_namespace
+ let b:xml_namespace = matchstr(b:compl_context, '^\k*\ze:')
+ if b:xml_namespace == ''
+ let b:xml_namespace = 'DEFAULT'
+ endif
+
+ return start
+
+ else
+ " There is no connction of namespace and data file. Abandon action
+ if !exists("g:xmldata_connection") || g:xmldata_connection == {}
+ return []
+ endif
+ " Initialize base return lists
+ let res = []
+ let res2 = []
+ " a:base is very short - we need context
+ let context = b:compl_context
+ unlet! b:compl_context
+
+ " Make entities completion
+ if exists("b:entitiescompl")
+ unlet! b:entitiescompl
+
+ if !exists("g:xmldata_entconnect") || g:xmldata_entconnect == 'DEFAULT'
+ let values = g:xmldata{'_'.g:xmldata_connection['DEFAULT']}['vimxmlentities']
+ else
+ let values = g:xmldata{'_'.g:xmldata_entconnect}['vimxmlentities']
+ endif
+
+ " Get only lines with entity declarations but throw out
+ " parameter-entities - they may be completed in future
+ let entdecl = filter(getline(1, "$"), 'v:val =~ "<!ENTITY\\s\\+[^%]"')
+
+ if len(entdecl) > 0
+ let intent = map(copy(entdecl), 'matchstr(v:val, "<!ENTITY\\s\\+\\zs\\(\\k\\|[.-:]\\)\\+\\ze")')
+ let values = intent + values
+ endif
+
+ for m in values
+ if m =~ '^'.a:base
+ call add(res, m.';')
+ endif
+ endfor
+
+ return res
+
+ endif
+ if context =~ '>'
+ " Generally if context contains > it means we are outside of tag and
+ " should abandon action
+ return []
+ endif
+
+ " find tags matching with "a:base"
+ " If a:base contains white space it is attribute.
+ " It could be also value of attribute...
+ " We have to get first word to offer
+ " proper completions
+ if context == ''
+ let tag = ''
+ else
+ let tag = split(context)[0]
+ endif
+ " Get rid of namespace
+ let tag = substitute(tag, '^'.b:xml_namespace.':', '', '')
+
+
+ " Get last word, it should be attr name
+ let attr = matchstr(context, '.*\s\zs.*')
+ " Possible situations where any prediction would be difficult:
+ " 1. Events attributes
+ if context =~ '\s'
+
+ " If attr contains =\s*[\"'] we catched value of attribute
+ if attr =~ "=\s*[\"']"
+ " Let do attribute specific completion
+ let attrname = matchstr(attr, '.*\ze\s*=')
+ let entered_value = matchstr(attr, ".*=\\s*[\"']\\zs.*")
+
+ if tag =~ '^[?!]'
+ " Return nothing if we are inside of ! or ? tag
+ return []
+ else
+ let values = g:xmldata{'_'.g:xmldata_connection[b:xml_namespace]}[tag][1][attrname]
+ endif
+
+ if len(values) == 0
+ return []
+ endif
+
+ " We need special version of sbase
+ let attrbase = matchstr(context, ".*[\"']")
+ let attrquote = matchstr(attrbase, '.$')
+
+ for m in values
+ " This if is needed to not offer all completions as-is
+ " alphabetically but sort them. Those beginning with entered
+ " part will be as first choices
+ if m =~ '^'.entered_value
+ call add(res, m . attrquote.' ')
+ elseif m =~ entered_value
+ call add(res2, m . attrquote.' ')
+ endif
+ endfor
+
+ return res + res2
+
+ endif
+
+ if tag =~ '?xml'
+ " Two possible arguments for <?xml> plus variation
+ let attrs = ['encoding', 'version="1.0"', 'version']
+ elseif tag =~ '^!'
+ " Don't make completion at all
+ return []
+ else
+ let attrs = keys(g:xmldata{'_'.g:xmldata_connection[b:xml_namespace]}[tag][1])
+ endif
+
+ for m in sort(attrs)
+ if m =~ '^'.attr
+ if tag !~ '^[?!]' && len(g:xmldata{'_'.g:xmldata_connection[b:xml_namespace]}[tag][1][m]) > 0 && g:xmldata{'_'.g:xmldata_connection[b:xml_namespace]}[tag][1][m][0] =~ '^BOOL$'
+ call add(res, m)
+ elseif m =~ '='
+ call add(res, m)
+ else
+ call add(res, m.'="')
+ endif
+ elseif m =~ attr
+ if tag !~ '^[?!]' && len(g:xmldata{'_'.g:xmldata_connection[b:xml_namespace]}[tag][1][m]) > 0 && g:xmldata{'_'.g:xmldata_connection[b:xml_namespace]}[tag][1][m][0] =~ '^BOOL$'
+ call add(res, m)
+ elseif m =~ '='
+ call add(res, m)
+ else
+ call add(res2, m.'="')
+ endif
+ endif
+ endfor
+
+ return res + res2
+
+ endif
+ " Close tag
+ let b:unaryTagsStack = "base meta link hr br param img area input col"
+ if context =~ '^\/'
+ let opentag = xmlcomplete#GetLastOpenTag("b:unaryTagsStack")
+ return [opentag.">"]
+ endif
+
+ " Complete elements of XML structure
+ " TODO: #REQUIRED, #IMPLIED, #FIXED, #PCDATA - but these should be detected like
+ " entities - in first run
+ " keywords: CDATA, ID, IDREF, IDREFS, ENTITY, ENTITIES, NMTOKEN, NMTOKENS
+ " are hardly recognizable but keep it in reserve
+ " also: EMPTY ANY SYSTEM PUBLIC DATA
+ if context =~ '^!'
+ let tags = ['!ELEMENT', '!DOCTYPE', '!ATTLIST', '!ENTITY', '!NOTATION', '![CDATA[', '![INCLUDE[', '![IGNORE[']
+
+ for m in tags
+ if m =~ '^'.context
+ let m = substitute(m, '^!\[\?', '', '')
+ call add(res, m)
+ elseif m =~ context
+ let m = substitute(m, '^!\[\?', '', '')
+ call add(res2, m)
+ endif
+ endfor
+
+ return res + res2
+
+ endif
+
+ " Complete text declaration
+ let g:co = context
+ if context =~ '^?'
+ let tags = ['?xml']
+
+ for m in tags
+ if m =~ '^'.context
+ call add(res, substitute(m, '^?', '', ''))
+ elseif m =~ context
+ call add(res, substitute(m, '^?', '', ''))
+ endif
+ endfor
+
+ return res + res2
+
+ endif
+
+ " Deal with tag completion.
+ let opentag = xmlcomplete#GetLastOpenTag("b:unaryTagsStack")
+ let opentag = substitute(opentag, '^\k*:', '', '')
+
+ let tags = g:xmldata{'_'.g:xmldata_connection[b:xml_namespace]}[opentag][0]
+ let context = substitute(context, '^\k*:', '', '')
+
+ if b:xml_namespace == 'DEFAULT'
+ let b:xml_namespace = ''
+ else
+ let b:xml_namespace .= ':'
+ endif
+
+ for m in tags
+ if m =~ '^'.context
+ call add(res, b:xml_namespace.m)
+ elseif m =~ context
+ call add(res2, b:xml_namespace.m)
+ endif
+ endfor
+
+ return res + res2
+
+ endif
+endfunction
+
+" MM: This is greatly reduced closetag.vim used with kind permission of Steven
+" Mueller
+" Changes: strip all comments; delete error messages; add checking for
+" namespace
+" Author: Steven Mueller <diffusor@ugcs.caltech.edu>
+" Last Modified: Tue May 24 13:29:48 PDT 2005
+" Version: 0.9.1
+
+function! xmlcomplete#GetLastOpenTag(unaryTagsStack)
+ let linenum=line('.')
+ let lineend=col('.') - 1 " start: cursor position
+ let first=1 " flag for first line searched
+ let b:TagStack='' " main stack of tags
+ let startInComment=s:InComment()
+
+ if exists("b:xml_namespace")
+ if b:xml_namespace == 'DEFAULT'
+ let tagpat='</\=\(\k\|[.-]\)\+\|/>'
+ else
+ let tagpat='</\='.b:xml_namespace.':\(\k\|[.-]\)\+\|/>'
+ endif
+ else
+ let tagpat='</\=\(\k\|[.-:]\)\+\|/>'
+ endif
+ while (linenum>0)
+ let line=getline(linenum)
+ if first
+ let line=strpart(line,0,lineend)
+ else
+ let lineend=strlen(line)
+ endif
+ let b:lineTagStack=''
+ let mpos=0
+ let b:TagCol=0
+ while (mpos > -1)
+ let mpos=matchend(line,tagpat)
+ if mpos > -1
+ let b:TagCol=b:TagCol+mpos
+ let tag=matchstr(line,tagpat)
+
+ if exists('b:closetag_disable_synID') || startInComment==s:InCommentAt(linenum, b:TagCol)
+ let b:TagLine=linenum
+ call s:Push(matchstr(tag,'[^<>]\+'),'b:lineTagStack')
+ endif
+ let lineend=lineend-mpos
+ let line=strpart(line,mpos,lineend)
+ endif
+ endwhile
+ while (!s:EmptystackP('b:lineTagStack'))
+ let tag=s:Pop('b:lineTagStack')
+ if match(tag, '^/') == 0 "found end tag
+ call s:Push(tag,'b:TagStack')
+ elseif s:EmptystackP('b:TagStack') && !s:Instack(tag, a:unaryTagsStack) "found unclosed tag
+ return tag
+ else
+ let endtag=s:Peekstack('b:TagStack')
+ if endtag == '/'.tag || endtag == '/'
+ call s:Pop('b:TagStack') "found a open/close tag pair
+ elseif !s:Instack(tag, a:unaryTagsStack) "we have a mismatch error
+ return ''
+ endif
+ endif
+ endwhile
+ let linenum=linenum-1 | let first=0
+ endwhile
+return ''
+endfunction
+
+function! s:InComment()
+ return synIDattr(synID(line('.'), col('.'), 0), 'name') =~ 'Comment'
+endfunction
+
+function! s:InCommentAt(line, col)
+ return synIDattr(synID(a:line, a:col, 0), 'name') =~ 'Comment'
+endfunction
+
+function! s:SetKeywords()
+ let g:IsKeywordBak=&iskeyword
+ let &iskeyword='33-255'
+endfunction
+
+function! s:RestoreKeywords()
+ let &iskeyword=g:IsKeywordBak
+endfunction
+
+function! s:Push(el, sname)
+ if !s:EmptystackP(a:sname)
+ exe 'let '.a:sname."=a:el.' '.".a:sname
+ else
+ exe 'let '.a:sname.'=a:el'
+ endif
+endfunction
+
+function! s:EmptystackP(sname)
+ exe 'let stack='.a:sname
+ if match(stack,'^ *$') == 0
+ return 1
+ else
+ return 0
+ endif
+endfunction
+
+function! s:Instack(el, sname)
+ exe 'let stack='.a:sname
+ call s:SetKeywords()
+ let m=match(stack, '\<'.a:el.'\>')
+ call s:RestoreKeywords()
+ if m < 0
+ return 0
+ else
+ return 1
+ endif
+endfunction
+
+function! s:Peekstack(sname)
+ call s:SetKeywords()
+ exe 'let stack='.a:sname
+ let top=matchstr(stack, '\<.\{-1,}\>')
+ call s:RestoreKeywords()
+ return top
+endfunction
+
+function! s:Pop(sname)
+ if s:EmptystackP(a:sname)
+ return ''
+ endif
+ exe 'let stack='.a:sname
+ call s:SetKeywords()
+ let loc=matchend(stack,'\<.\{-1,}\>')
+ exe 'let '.a:sname.'=strpart(stack, loc+1, strlen(stack))'
+ let top=strpart(stack, match(stack, '\<'), loc)
+ call s:RestoreKeywords()
+ return top
+endfunction
+
+function! s:Clearstack(sname)
+ exe 'let '.a:sname."=''"
+endfunction
diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim
index 751b1a1dc..50a6002a9 100644
--- a/runtime/autoload/zip.vim
+++ b/runtime/autoload/zip.vim
@@ -1,7 +1,7 @@
" zip.vim: Handles browsing zipfiles
" AUTOLOAD PORTION
-" Date: Sep 16, 2005
-" Version: 2
+" Date: Nov 14, 2005
+" Version: 4
" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz>
" License: Vim License (see vim's :help license)
" Copyright: Copyright (C) 2005 Charles E. Campbell, Jr. {{{1
@@ -22,7 +22,7 @@ if exists("g:loaded_zip")
finish
endif
-let g:loaded_zip= "v2"
+let g:loaded_zip= "v4"
" ----------------
" Functions: {{{1
@@ -41,9 +41,12 @@ fun! zip#Browse(zipfile)
return
endif
if !filereadable(a:zipfile)
- echohl Error | echo "***error*** (zip#Browse) File not readable<".a:zipfile.">" | echohl None
- call inputsave()|call input("Press <cr> to continue")|call inputrestore()
-" call Dret("zip#Browse")
+ if a:zipfile !~# '^\a\+://'
+ " if its an url, don't complain, let url-handlers such as vim do its thing
+ echohl Error | echo "***error*** (zip#Browse) File not readable<".a:zipfile.">" | echohl None
+ call inputsave()|call input("Press <cr> to continue")|call inputrestore()
+ endif
+" call Dret("zip#Browse : file<".a:zipfile."> not readable")
return
endif
if &ma != 1
@@ -80,7 +83,7 @@ endfun
" ---------------------------------------------------------------------
" ZipBrowseSelect: {{{2
fun! s:ZipBrowseSelect()
-" call Dfunc("ZipBrowseSelect() zipfile<".w:zipfile.">")
+" call Dfunc("ZipBrowseSelect() zipfile<".w:zipfile."> curfile<".expand("%").">")
let fname= getline(".")
" sanity check
@@ -99,13 +102,15 @@ fun! s:ZipBrowseSelect()
" get zipfile to the new-window
let zipfile= substitute(w:zipfile,'.zip$','','e')
+ let curfile= expand("%")
new
wincmd _
+ let s:zipfile_{winnr()}= curfile
exe "e zipfile:".zipfile.':'.fname
filetype detect
-" call Dret("ZipBrowseSelect")
+" call Dret("ZipBrowseSelect : s:zipfile_".winnr()."<".s:zipfile_{winnr()}.">")
endfun
" ---------------------------------------------------------------------
@@ -128,7 +133,7 @@ endfun
" ---------------------------------------------------------------------
" zip#Write: {{{2
fun! zip#Write(fname)
-" call Dfunc("zip#Write(fname<".a:fname.")")
+" call Dfunc("zip#Write(fname<".a:fname.") zipfile_".winnr()."<".s:zipfile_{winnr()}.">")
" sanity checks
if !executable("zip")
@@ -192,6 +197,21 @@ fun! zip#Write(fname)
if v:shell_error != 0
echohl Error | echo "***error*** (zip#Write) sorry, unable to update ".zipfile." with ".fname | echohl None
call inputsave()|call input("Press <cr> to continue")|call inputrestore()
+
+ elseif s:zipfile_{winnr()} =~ '^\a\+://'
+ " support writing zipfiles across a network
+ let netzipfile= s:zipfile_{winnr()}
+" call Decho("handle writing <".zipfile.".zip> across network as <".netzipfile.">")
+ 1split|enew
+ let binkeep= &binary
+ let eikeep = &ei
+ set binary ei=all
+ exe "e! ".zipfile.".zip"
+ call netrw#NetWrite(netzipfile)
+ let &ei = eikeep
+ let &binary = binkeep
+ q!
+ unlet s:zipfile_{winnr()}
endif
" cleanup and restore current directory