From 587fd7e78a8da22175553d5fda3738cbbb1f4367 Mon Sep 17 00:00:00 2001 From: "Stefan.Liebl" Date: Tue, 12 Jan 2010 16:18:53 +0000 Subject: [PATCH] GetLatestVimScripts git-svn-id: https://vimsuite.svn.sourceforge.net/svnroot/vimsuite/trunk@180 eb2d0018-73a3-4aeb-bfe9-1def61c9ec69 --- vimfiles/GetLatest/GetLatestVimScripts.dat | 68 +- vimfiles/autoload/Align.vim | 31 +- vimfiles/autoload/AlignMaps.vim | 28 +- vimfiles/autoload/getscript.vim | 1182 +++++++++---------- vimfiles/autoload/libsrec.vim | 152 +++ vimfiles/autoload/netrw.vim | 1186 +++++++++++-------- vimfiles/autoload/netrwSettings.vim | 1 + vimfiles/autoload/tcomment.vim | 35 +- vimfiles/autoload/vimball.vim | 197 ++-- vimfiles/doc/Align.txt | 145 ++- vimfiles/doc/editsrec.txt | 21 + vimfiles/doc/pi_getscript.txt | 828 ++++++------- vimfiles/doc/pi_netrw.txt | 436 +++++-- vimfiles/doc/pi_vimball.txt | 72 +- vimfiles/doc/tags | 103 +- vimfiles/ftplugin/xml.vim | 170 ++- vimfiles/plugin/AlignMapsPlugin.vim | 38 +- vimfiles/plugin/AlignPlugin.vim | 6 +- vimfiles/plugin/DoxygenToolkit.vim | 1235 ++++++++++++-------- vimfiles/plugin/GetLatestVimScripts.vim | 468 -------- vimfiles/plugin/cecutil.vim | 10 +- vimfiles/plugin/editsrec.vim | 169 +++ vimfiles/plugin/editsrec_test.txt | 337 ++++++ vimfiles/plugin/netrwPlugin.vim | 6 +- vimfiles/plugin/svndiff.vim | 374 ------ vimfiles/plugin/tComment.vim | 13 +- vimfiles/plugin/vimballPlugin.vim | 14 +- vimfiles/syntax/netrw.vim | 77 +- 28 files changed, 3971 insertions(+), 3431 deletions(-) create mode 100644 vimfiles/autoload/libsrec.vim create mode 100644 vimfiles/doc/editsrec.txt delete mode 100644 vimfiles/plugin/GetLatestVimScripts.vim create mode 100644 vimfiles/plugin/editsrec.vim create mode 100644 vimfiles/plugin/editsrec_test.txt delete mode 100644 vimfiles/plugin/svndiff.vim diff --git a/vimfiles/GetLatest/GetLatestVimScripts.dat b/vimfiles/GetLatest/GetLatestVimScripts.dat index 298fa93..83fd14a 100644 --- a/vimfiles/GetLatest/GetLatestVimScripts.dat +++ b/vimfiles/GetLatest/GetLatestVimScripts.dat @@ -1,38 +1,34 @@ ScriptID SourceID Filename -------------------------- -1075 9389 netrw.vim -1502 8743 vimball.vim -1008 3118 srec.vim (ftplugin) -1009 3119 srec.vim (syntax file) -475 2535 latex-suite (install in vimfiles.latex) -614 3666 C-Referenz -670 8073 visincr.vim (Visual Increment) -862 2635 cscope_quickfix.vim -51 171 cscope_macros.vim -102 9375 DirDiff.vim -1189 8687 matrix.vim -1173 8689 tcomment -948 2878 Scons Compiler plugin -1709 6421 Scons Syntax file -1772 7248 DAMOS.zip DAMOS tools (von Stefan) -987 6978 DoxygenToolkit.vim -1397 6887 xml.vim -1290 5190 LogiPat.vim -1881 9564 svndiff -1462 5612 dtd2xml -1046 4249 Lusty Explorer -2043 7805 VimPdb (debugging python) -1776 7902 Vimgrep Replace -2048 7817 BlockDiff -39 8196 matchit.vim -2092 8095 reloaded.vim (matrix colorscheme) -848 8203 SrchRplcHiGrp.vim (Search/Replace on Syntax Group) -294 9414 Align.vim -479 9276 MultipleSearch -1066 7618 cecutil.vim -642 8136 getscript.vim -90 9279 vcscommand -642 8136 :AutoInstall: GetLatestVimScripts.vim -479 9276 :AutoInstall: MultipleSearch.vba -1173 8689 tComment.vim -2701 1 editsrec +1008 3118 srec.vim (ftplugin) +1009 3119 srec.vim (syntax file) +475 2535 latex-suite (install in vimfiles.latex) +614 3666 C-Referenz +670 8073 visincr.vim (Visual Increment) +862 2635 cscope_quickfix.vim +51 171 cscope_macros.vim +102 9375 DirDiff.vim +1189 8687 matrix.vim +1173 11513 tcomment +948 2878 Scons Compiler plugin +1709 6421 Scons Syntax file +1772 7248 DAMOS.zip DAMOS tools (von Stefan) +987 11878 DoxygenToolkit.vim +1397 11713 xml.vim +1290 5190 LogiPat.vim +1462 5612 dtd2xml +1046 4249 Lusty Explorer +2043 7805 VimPdb (debugging python) +1776 7902 Vimgrep Replace +2048 7817 BlockDiff +39 8196 matchit.vim +2092 8095 reloaded.vim (matrix colorscheme) +848 8203 SrchRplcHiGrp.vim (Search/Replace on Syntax Group) +294 10110 Align.vim +479 9276 MultipleSearch.vba +1066 7618 cecutil.vim +1173 11513 tComment.vim +2701 10950 editsrec +642 8136 :AutoInstall: getscript.vim +1075 11979 :AutoInstall: netrw.vim +1502 11981 :AutoInstall: vimball.vim diff --git a/vimfiles/autoload/Align.vim b/vimfiles/autoload/Align.vim index 9c61728..bce3542 100644 --- a/vimfiles/autoload/Align.vim +++ b/vimfiles/autoload/Align.vim @@ -1,7 +1,7 @@ " Align: tool to align multiple fields based on one or more separators " Author: Charles E. Campbell, Jr. -" Date: Oct 08, 2008 -" Version: 34 +" Date: Mar 03, 2009 +" Version: 35 " GetLatestVimScripts: 294 1 :AutoInstall: Align.vim " GetLatestVimScripts: 1066 1 :AutoInstall: cecutil.vim " Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1 @@ -21,10 +21,10 @@ " --------------------------------------------------------------------- " Load Once: {{{1 -if exists("g:loaded_align") || &cp +if exists("g:loaded_Align") || &cp finish endif -let g:loaded_align = "v34" +let g:loaded_Align = "v35" if v:version < 700 echohl WarningMsg echo "***warning*** this version of Align needs vim 7.0" @@ -36,9 +36,19 @@ set cpo&vim "DechoTabOn " --------------------------------------------------------------------- -" Debugging Support: +" Debugging Support: {{{1 "if !exists("g:loaded_Decho") | runtime plugin/Decho.vim | endif +" --------------------------------------------------------------------- +" Options: {{{1 +if !exists("g:Align_xstrlen") + if &enc == "latin1" || $LANG == "en_US.UTF-8" || !has("multi_byte") + let g:Align_xstrlen= 0 + else + let g:Align_xstrlen= 1 + endif +endif + " --------------------------------------------------------------------- " Align#AlignCtrl: enter alignment patterns here {{{1 " @@ -333,12 +343,17 @@ endfun fun! Align#Align(hasctrl,...) range " call Dfunc("Align#Align(hasctrl=".a:hasctrl.",...) a:0=".a:0) - " sanity check + " sanity checks if string(a:hasctrl) != "0" && string(a:hasctrl) != "1" echohl Error|echo 'usage: Align#Align(hasctrl<'.a:hasctrl.'> (should be 0 or 1),"separator(s)" (you have '.a:0.') )'|echohl None " call Dret("Align#Align") return endif + if exists("s:AlignStyle") && s:AlignStyle == ":" + echohl Error |echo '(Align#Align) your AlignStyle is ":", which implies "do-no-alignment"!'|echohl None +" call Dret("Align#Align") + return + endif " set up a list akin to an argument list if a:0 > 0 @@ -986,12 +1001,12 @@ fun! s:Strlen(x) " 'tabstop', wide CJK as 2 rather than 1, Arabic alif as zero when immediately " preceded by lam, one otherwise, etc.) " (comment from TM, solution from me) - let modkeep= &mod + let modkeep= &l:mod exe "norm! o\" call setline(line("."),a:x) let ret= virtcol("$") - 1 d - let &mod= modkeep + let &l:mod= modkeep else " at least give a decent default diff --git a/vimfiles/autoload/AlignMaps.vim b/vimfiles/autoload/AlignMaps.vim index 3246afb..ace2de8 100644 --- a/vimfiles/autoload/AlignMaps.vim +++ b/vimfiles/autoload/AlignMaps.vim @@ -1,13 +1,13 @@ " AlignMaps.vim : support functions for AlignMaps " Author: Charles E. Campbell, Jr. -" Date: Oct 24, 2008 -" Version: 40 +" Date: Mar 03, 2009 +" Version: 41 " --------------------------------------------------------------------- " Load Once: {{{1 if &cp || exists("g:loaded_AlignMaps") finish endif -let g:loaded_AlignMaps= "v40" +let g:loaded_AlignMaps= "v41" let s:keepcpo = &cpo set cpo&vim @@ -16,7 +16,7 @@ set cpo&vim " --------------------------------------------------------------------- " AlignMaps#WrapperStart: {{{2 -fun! AlignMaps#WrapperStart(vis) +fun! AlignMaps#WrapperStart(vis) range " call Dfunc("AlignMaps#WrapperStart(vis=".a:vis.")") if a:vis @@ -55,7 +55,7 @@ endfun " --------------------------------------------------------------------- " AlignMaps#WrapperEnd: {{{2 -fun! AlignMaps#WrapperEnd() +fun! AlignMaps#WrapperEnd() range " call Dfunc("AlignMaps#WrapperEnd() alignmaps_wrapcnt=".s:alignmaps_wrapcnt." my=".line("'y")." mz=".line("'z")) " remove trailing white space introduced by whatever in the modification zone @@ -103,7 +103,7 @@ endfun " --------------------------------------------------------------------- " AlignMaps#StdAlign: some semi-standard align calls {{{2 -fun! AlignMaps#StdAlign(mode) +fun! AlignMaps#StdAlign(mode) range " call Dfunc("AlignMaps#StdAlign(mode=".a:mode.")") if a:mode == 1 " align on @ @@ -157,12 +157,12 @@ endfun " --------------------------------------------------------------------- " AlignMaps#Equals: supports \t= and \T= {{{2 -fun! AlignMaps#Equals() +fun! AlignMaps#Equals() range " call Dfunc("AlignMaps#Equals()") 'a,'zs/\s\+\([*/+\-%|&\~^]\==\)/ \1/e 'a,'zs@ \+\([*/+\-%|&\~^]\)=@\1=@ge - 'a,'zs/==/\="\\"/ge - 'a,'zs/!=/\="!\"/ge + 'a,'zs/==/\="\\"/ge + 'a,'zs/\([!<>:]\)=/\=submatch(1)."\"/ge norm g'zk AlignCtrl mIp1P1=l = AlignCtrl g = @@ -174,15 +174,15 @@ fun! AlignMaps#Equals() 'a,'z-1v/^\s*\/[*/]/s/\/[*/]/@&@/e 'a,'z-1v/^\s*\/[*/]/s/\*\//@&/e if exists("g:mapleader") - exe "norm 'zk" - call AlignMaps#StdAlign(1) + exe "norm 'zk" + call AlignMaps#StdAlign(1) else - exe "norm 'zk" - call AlignMaps#StdAlign(1) + exe "norm 'zk" + call AlignMaps#StdAlign(1) endif 'y,'zs/^\(\s*\) @/\1/e endif - 'a,'z-1s/\%xff/=/ge + 'a,'z-1s/\%x0f/=/ge 'y,'zs/ @//eg " call Dret("AlignMaps#Equals") endfun diff --git a/vimfiles/autoload/getscript.vim b/vimfiles/autoload/getscript.vim index b22ff8a..44d5668 100644 --- a/vimfiles/autoload/getscript.vim +++ b/vimfiles/autoload/getscript.vim @@ -1,591 +1,591 @@ -" --------------------------------------------------------------------- -" getscript.vim -" Author: Charles E. Campbell, Jr. -" Date: Jan 08, 2008 -" Version: 29 -" Installing: :help glvs-install -" Usage: :help glvs -" -" GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim -"redraw!|call inputsave()|call input("Press to continue")|call inputrestore() -" --------------------------------------------------------------------- -" Initialization: {{{1 -" if you're sourcing this file, surely you can't be -" expecting vim to be in its vi-compatible mode! -if &cp - echoerr "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)" - finish -endif -let s:keepcpo = &cpo -set cpo&vim -"DechoTabOn - -if exists("g:loaded_getscript") - finish -endif -let g:loaded_getscript= "v29" - -" --------------------------- -" Global Variables: {{{1 -" --------------------------- -" Cygwin Detection ------- {{{2 -if !exists("g:getscript_cygwin") - if has("win32") || has("win95") || has("win64") || has("win16") - if &shell =~ '\%(\\|\\)\%(\.exe\)\=$' - let g:getscript_cygwin= 1 - else - let g:getscript_cygwin= 0 - endif - else - let g:getscript_cygwin= 0 - endif -endif -" shell quoting character {{{2 -if exists("g:netrw_shq") && !exists("g:getscript_shq") - let g:getscript_shq= g:netrw_shq -elseif !exists("g:getscript_shq") - if exists("&shq") && &shq != "" - let g:getscript_shq= &shq - elseif exists("&sxq") && &sxq != "" - let g:getscript_shq= &sxq - elseif has("win32") || has("win95") || has("win64") || has("win16") - if g:getscript_cygwin - let g:getscript_shq= "'" - else - let g:getscript_shq= '"' - endif - else - let g:getscript_shq= "'" - endif -" call Decho("g:getscript_shq<".g:getscript_shq.">") -endif - -" wget vs curl {{{2 -if !exists("g:GetLatestVimScripts_wget") - if executable("wget") - let g:GetLatestVimScripts_wget= "wget" - elseif executable("curl") - let g:GetLatestVimScripts_wget= "curl" - else - let g:GetLatestVimScripts_wget = 'echo "GetLatestVimScripts needs wget or curl"' - let g:GetLatestVimScripts_options = "" - endif -endif - -" options that wget and curl require: -if !exists("g:GetLatestVimScripts_options") - if g:GetLatestVimScripts_wget == "wget" - let g:GetLatestVimScripts_options= "-q -O" - elseif g:GetLatestVimScripts_wget == "curl" - let g:GetLatestVimScripts_options= "-s -O" - else - let g:GetLatestVimScripts_options= "" - endif -endif - -" by default, allow autoinstall lines to work -if !exists("g:GetLatestVimScripts_allowautoinstall") - let g:GetLatestVimScripts_allowautoinstall= 1 -endif - -"" For debugging: -"let g:GetLatestVimScripts_wget = "echo" -"let g:GetLatestVimScripts_options = "options" - -" --------------------------------------------------------------------- -" Check If AutoInstall Capable: {{{1 -let s:autoinstall= "" -if g:GetLatestVimScripts_allowautoinstall - - if (has("win32") || has("gui_win32") || has("gui_win32s") || has("win16") || has("win64") || has("win32unix") || has("win95")) && &shell != "bash" - " windows (but not cygwin/bash) - let s:dotvim= "vimfiles" - if !exists("g:GetLatestVimScripts_mv") - let g:GetLatestVimScripts_mv= "ren" - endif - - else - " unix - let s:dotvim= ".vim" - if !exists("g:GetLatestVimScripts_mv") - let g:GetLatestVimScripts_mv= "mv" - endif - endif - - if exists('$HOME') && isdirectory(expand("$HOME")."/".s:dotvim) - let s:autoinstall= $HOME."/".s:dotvim - endif -" call Decho("s:autoinstall<".s:autoinstall.">") -"else "Decho -" call Decho("g:GetLatestVimScripts_allowautoinstall=".g:GetLatestVimScripts_allowautoinstall.": :AutoInstall: disabled") -endif - -" --------------------------------------------------------------------- -" Public Interface: {{{1 -com! -nargs=0 GetLatestVimScripts call getscript#GetLatestVimScripts() -com! -nargs=0 GetScript call getscript#GetLatestVimScripts() -silent! com -nargs=0 GLVS call getscript#GetLatestVimScripts() - -" --------------------------------------------------------------------- -" GetOneScript: (Get Latest Vim Script) this function operates {{{1 -" on the current line, interpreting two numbers and text as -" ScriptID, SourceID, and Filename. -" It downloads any scripts that have newer versions from vim.sf.net. -fun! s:GetOneScript(...) -" call Dfunc("GetOneScript()") - - " set options to allow progress to be shown on screen - let rega= @a - let t_ti= &t_ti - let t_te= &t_te - let rs = &rs - set t_ti= t_te= nors - - " put current line on top-of-screen and interpret it into - " a script identifer : used to obtain webpage - " source identifier : used to identify current version - " and an associated comment: used to report on what's being considered - if a:0 >= 3 - let scriptid = a:1 - let srcid = a:2 - let fname = a:3 - let cmmnt = "" -" call Decho("scriptid<".scriptid.">") -" call Decho("srcid <".srcid.">") -" call Decho("fname <".fname.">") - else - let curline = getline(".") - if curline =~ '^\s*#' - let @a= rega -" call Dret("GetOneScript : skipping a pure comment line") - return - endif - let parsepat = '^\s*\(\d\+\)\s\+\(\d\+\)\s\+\(.\{-}\)\(\s*#.*\)\=$' - try - let scriptid = substitute(curline,parsepat,'\1','e') - catch /^Vim\%((\a\+)\)\=:E486/ - let scriptid= 0 - endtry - try - let srcid = substitute(curline,parsepat,'\2','e') - catch /^Vim\%((\a\+)\)\=:E486/ - let srcid= 0 - endtry - try - let fname= substitute(curline,parsepat,'\3','e') - catch /^Vim\%((\a\+)\)\=:E486/ - let fname= "" - endtry - try - let cmmnt= substitute(curline,parsepat,'\4','e') - catch /^Vim\%((\a\+)\)\=:E486/ - let cmmnt= "" - endtry -" call Decho("curline <".curline.">") -" call Decho("parsepat<".parsepat.">") -" call Decho("scriptid<".scriptid.">") -" call Decho("srcid <".srcid.">") -" call Decho("fname <".fname.">") - endif - - if scriptid == 0 || srcid == 0 - " When looking for :AutoInstall: lines, skip scripts that have 0 0 scriptname - let @a= rega -" call Dret("GetOneScript : skipping a scriptid==srcid==0 line") - return - endif - - let doautoinstall= 0 - if fname =~ ":AutoInstall:" -" call Decho("case AutoInstall: fname<".fname.">") - let aicmmnt= substitute(fname,'\s\+:AutoInstall:\s\+',' ','') -" call Decho("aicmmnt<".aicmmnt."> s:autoinstall=".s:autoinstall) - if s:autoinstall != "" - let doautoinstall = g:GetLatestVimScripts_allowautoinstall - endif - else - let aicmmnt= fname - endif -" call Decho("aicmmnt<".aicmmnt.">: doautoinstall=".doautoinstall) - - exe "norm z\" - redraw! -" call Decho('considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid) - echomsg 'considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid - - " grab a copy of the plugin's vim.sf.net webpage - let scriptaddr = 'http://vim.sf.net/script.php?script_id='.scriptid - let tmpfile = tempname() - let v:errmsg = "" - - " make up to three tries at downloading the description - let itry= 1 - while itry <= 3 -" call Decho("try#".itry." to download description of <".aicmmnt."> with addr=".scriptaddr) - if has("win32") || has("win16") || has("win95") -" call Decho("new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.tmpfile.g:getscript_shq.' '.g:getscript_shq.scriptaddr.g:getscript_shq."|q!") - new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.tmpfile.g:getscript_shq.' '.g:getscript_shq.scriptaddr.g:getscript_shq|q! - else -" call Decho("exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.tmpfile.g:getscript_shq." ".g:getscript_shq.scriptaddr.g:getscript_shq) - exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.tmpfile.g:getscript_shq." ".g:getscript_shq.scriptaddr.g:getscript_shq - endif - if itry == 1 - exe "silent vsplit ".tmpfile - else - silent! e % - endif - - " find the latest source-id in the plugin's webpage - silent! 1 - let findpkg= search('Click on the package to download','W') - if findpkg > 0 - break - endif - let itry= itry + 1 - endwhile -" call Decho(" --- end downloading tries while loop --- itry=".itry) - - " testing: did finding "Click on the package..." fail? - if findpkg == 0 || itry >= 4 - silent q! - call delete(tmpfile) - " restore options - let &t_ti = t_ti - let &t_te = t_te - let &rs = rs - let s:downerrors = s:downerrors + 1 -" call Decho("***warning*** couldn'".'t find "Click on the package..." in description page for <'.aicmmnt.">") - echomsg "***warning*** couldn'".'t find "Click on the package..." in description page for <'.aicmmnt.">" -" call Dret("GetOneScript : srch for /Click on the package/ failed") - let @a= rega - return - endif -" call Decho('found "Click on the package to download"') - - let findsrcid= search('src_id=','W') - if findsrcid == 0 - silent q! - call delete(tmpfile) - " restore options - let &t_ti = t_ti - let &t_te = t_te - let &rs = rs - let s:downerrors = s:downerrors + 1 -" call Decho("***warning*** couldn'".'t find "src_id=" in description page for <'.aicmmnt.">") - echomsg "***warning*** couldn'".'t find "src_id=" in description page for <'.aicmmnt.">" - let @a= rega -" call Dret("GetOneScript : srch for /src_id/ failed") - return - endif -" call Decho('found "src_id=" in description page') - - let srcidpat = '^\s*\([^<]\+\)<.*$' - let latestsrcid= substitute(getline("."),srcidpat,'\1','') - let sname = substitute(getline("."),srcidpat,'\2','') " script name actually downloaded -" call Decho("srcidpat<".srcidpat."> latestsrcid<".latestsrcid."> sname<".sname.">") - silent q! - call delete(tmpfile) - - " convert the strings-of-numbers into numbers - let srcid = srcid + 0 - let latestsrcid = latestsrcid + 0 -" call Decho("srcid=".srcid." latestsrcid=".latestsrcid." sname<".sname.">") - - " has the plugin's most-recent srcid increased, which indicates - " that it has been updated - if latestsrcid > srcid -" call Decho("[latestsrcid=".latestsrcid."] <= [srcid=".srcid."]: need to update <".sname.">") - - let s:downloads= s:downloads + 1 - if sname == bufname("%") - " GetLatestVimScript has to be careful about downloading itself - let sname= "NEW_".sname - endif - - " the plugin has been updated since we last obtained it, so download a new copy -" call Decho("...downloading new <".sname.">") - echomsg "...downloading new <".sname.">" - if has("win32") || has("win16") || has("win95") -" call Decho("new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.sname.g:getscript_shq." ".g:getscript_shq.'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid.g:getscript_shq."|q") - new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.sname.g:getscript_shq." ".g:getscript_shq.'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid.g:getscript_shq|q - else -" call Decho("silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.sname.g:getscript_shq." ".g:getscript_shq.'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid.g:getscript_shq) - exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.sname.g:getscript_shq." ".g:getscript_shq.'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid.g:getscript_shq - endif - - " AutoInstall: only if doautoinstall has been requested by the plugin itself - if doautoinstall -" call Decho("attempting to do autoinstall: getcwd<".getcwd()."> filereadable(".sname.")=".filereadable(sname)) - if filereadable(sname) -" call Decho("silent !".g:GetLatestVimScripts_mv." ".g:getscript_shq.sname.g:getscript_shq." ".g:getscript_shq.s:autoinstall.g:getscript_shq) - exe "silent !".g:GetLatestVimScripts_mv." ".g:getscript_shq.sname.g:getscript_shq." ".g:getscript_shq.s:autoinstall.g:getscript_shq - let curdir = escape(substitute(getcwd(),'\','/','ge'),"|[]*'\" #") - let installdir= curdir."/Installed" - if !isdirectory(installdir) - call mkdir(installdir) - endif -" call Decho("exe cd ".s:autoinstall) - exe "cd ".escape(s:autoinstall,' ') - - " decompress - if sname =~ '\.bz2$' -" call Decho("decompress: attempt to bunzip2 ".sname) - exe "silent !bunzip2 ".g:getscript_shq.sname.g:getscript_shq - let sname= substitute(sname,'\.bz2$','','') -" call Decho("decompress: new sname<".sname."> after bunzip2") - elseif sname =~ '\.gz$' -" call Decho("decompress: attempt to gunzip ".sname) - exe "silent !gunzip ".g:getscript_shq.sname.g:getscript_shq - let sname= substitute(sname,'\.gz$','','') -" call Decho("decompress: new sname<".sname."> after gunzip") - endif - - " distribute archive(.zip, .tar, .vba) contents - if sname =~ '\.zip$' -" call Decho("dearchive: attempt to unzip ".sname) - exe "silent !unzip -o ".g:getscript_shq.sname.g:getscript_shq - elseif sname =~ '\.tar$' -" call Decho("dearchive: attempt to untar ".sname) - exe "silent !tar -xvf ".g:getscript_shq.sname.g:getscript_shq - elseif sname =~ '\.vba$' -" call Decho("dearchive: attempt to handle a vimball: ".sname) - silent 1split - exe "silent e ".escape(sname,' ') - silent so % - silent q - endif - - if sname =~ '.vim$' -" call Decho("dearchive: attempt to simply move ".sname." to plugin") - exe "silent !".g:GetLatestVimScripts_mv." ".g:getscript_shq.sname.g:getscript_shq." plugin" - else -" call Decho("dearchive: move <".sname."> to installdir<".installdir.">") - exe "silent !".g:GetLatestVimScripts_mv." ".g:getscript_shq.sname.g:getscript_shq." ".installdir - endif - - " helptags step - let docdir= substitute(&rtp,',.*','','e')."/doc" -" call Decho("helptags: docdir<".docdir.">") - exe "helptags ".docdir - exe "cd ".curdir - endif - if fname !~ ':AutoInstall:' - let modline=scriptid." ".latestsrcid." :AutoInstall: ".fname.cmmnt - else - let modline=scriptid." ".latestsrcid." ".fname.cmmnt - endif - else - let modline=scriptid." ".latestsrcid." ".fname.cmmnt - endif - - " update the data in the file - call setline(line("."),modline) -" call Decho("update data in ".expand("%")."#".line(".").": modline<".modline.">") -" else " Decho -" call Decho("[latestsrcid=".latestsrcid."] <= [srcid=".srcid."], no need to update") - endif - - " restore options - let &t_ti = t_ti - let &t_te = t_te - let &rs = rs - let @a = rega - -" call Dret("GetOneScript") -endfun - -" --------------------------------------------------------------------- -" GetLatestVimScripts: this function gets the latest versions of {{{1 -" scripts based on the list in -" (first dir in runtimepath)/GetLatest/GetLatestVimScripts.dat -fun! getscript#GetLatestVimScripts() -" call Dfunc("GetLatestVimScripts() autoinstall<".s:autoinstall.">") - -" insure that wget is executable - if executable(g:GetLatestVimScripts_wget) != 1 - echoerr "GetLatestVimScripts needs ".g:GetLatestVimScripts_wget." which apparently is not available on your system" -" call Dret("GetLatestVimScripts : wget not executable/availble") - return - endif - - " Find the .../GetLatest subdirectory under the runtimepath - for datadir in split(&rtp,',') + [''] - if isdirectory(datadir."/GetLatest") -" call Decho("found directory<".datadir.">") - let datadir= datadir . "/GetLatest" - break - endif - if filereadable(datadir."GetLatestVimScripts.dat") -" call Decho("found ".datadir."/GetLatestVimScripts.dat") - break - endif - endfor - - " Sanity checks: readability and writability - if datadir == "" - echoerr 'Missing "GetLatest/" on your runtimepath - see :help glvs-dist-install' -" call Dret("GetLatestVimScripts : unable to find a GetLatest subdirectory") - return - endif - - if filewritable(datadir) != 2 - echoerr "(getLatestVimScripts) Your ".datadir." isn't writable" -" call Dret("GetLatestVimScripts : non-writable directory<".datadir.">") - return - endif - let datafile= datadir."/GetLatestVimScripts.dat" - if !filereadable(datafile) - echoerr "Your data file<".datafile."> isn't readable" -" call Dret("GetLatestVimScripts : non-readable datafile<".datafile.">") - return - endif - if !filewritable(datafile) - echoerr "Your data file<".datafile."> isn't writable" -" call Dret("GetLatestVimScripts : non-writable datafile<".datafile.">") - return - endif -" call Decho("datadir <".datadir.">") -" call Decho("datafile <".datafile.">") - - " don't let any events interfere (like winmanager's, taglist's, etc) - let eikeep= &ei - set ei=all - - " record current directory, change to datadir, open split window with - " datafile - let origdir= getcwd() - exe "cd ".escape(substitute(datadir,'\','/','ge'),"|[]*'\" #") - split - exe "e ".escape(substitute(datafile,'\','/','ge'),"|[]*'\" #") - res 1000 - let s:downloads = 0 - let s:downerrors= 0 - - " Check on dependencies mentioned in plugins -" call Decho(" ") -" call Decho("searching plugins for GetLatestVimScripts dependencies") - let lastline = line("$") -" call Decho("lastline#".lastline) - let plugins = split(globpath(&rtp,"plugin/*.vim"),'\n') - let foundscript = 0 - let firstdir= "" - - for plugin in plugins - - " don't process plugins in system directories - if firstdir == "" - let firstdir= substitute(plugin,'[/\\][^/\\]\+$','','') -" call Decho("setting firstdir<".firstdir.">") - else - let curdir= substitute(plugin,'[/\\][^/\\]\+$','','') -" call Decho("curdir<".curdir.">") - if curdir != firstdir -" call Decho("skipping subsequent plugins: curdir<".curdir."> != firstdir<".firstdir.">") - break - endif - endif - - " read plugin in - $ -" call Decho(" ") -" call Decho(".dependency checking<".plugin."> line$=".line("$")) - exe "silent r ".escape(plugin,"[]#*$%'\" ?`!&();<>\\") - - while search('^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+','W') != 0 - let newscript= substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+\s\+\(.*\)$','\1','e') - let llp1 = lastline+1 -" call Decho("..newscript<".newscript.">") - - " don't process ""GetLatestVimScripts lines -- those that have been doubly-commented out - if newscript !~ '^"' - " found a "GetLatestVimScripts: # #" line in the script; check if its already in the datafile - let curline = line(".") - let noai_script = substitute(newscript,'\s*:AutoInstall:\s*','','e') - exe llp1 - let srchline = search('\<'.noai_script.'\>','bW') -" call Decho("..noai_script<".noai_script."> srch=".srchline."curline#".line(".")." lastline#".lastline) - - if srchline == 0 - " found a new script to permanently include in the datafile - let keep_rega = @a - let @a = substitute(getline(curline),'^"\s\+GetLatestVimScripts:\s\+','','') - exe lastline."put a" - echomsg "Appending <".@a."> to ".datafile." for ".newscript -" call Decho("..APPEND (".noai_script.")<".@a."> to GetLatestVimScripts.dat") - let @a = keep_rega - let lastline = llp1 - let curline = curline + 1 - let foundscript = foundscript + 1 -" else " Decho -" call Decho("..found <".noai_script."> (already in datafile at line#".srchline.")") - endif - - let curline = curline + 1 - exe curline - endif - endwhile - - let llp1= lastline + 1 -" call Decho(".deleting lines: ".llp1.",$d") - exe "silent! ".llp1.",$d" - endfor -" call Decho("--- end dependency checking loop --- foundscript=".foundscript) -" call Decho(" ") - - if foundscript == 0 - setlocal nomod - endif - - " Check on out-of-date scripts using GetLatest/GetLatestVimScripts.dat -" call Decho("begin: checking out-of-date scripts using datafile<".datafile.">") - setlocal lz - 1 -" /^-----/,$g/^\s*\d/call Decho(getline(".")) - 1 - /^-----/,$g/^\s*\d/call s:GetOneScript() -" call Decho("--- end out-of-date checking --- ") - - " Final report (an echomsg) - try - silent! ?^-------? - catch /^Vim\%((\a\+)\)\=:E114/ -" call Dret("GetLatestVimScripts : nothing done!") - return - endtry - exe "norm! kz\" - redraw! - let s:msg = "" - if s:downloads == 1 - let s:msg = "Downloaded one updated script to <".datadir.">" - elseif s:downloads == 2 - let s:msg= "Downloaded two updated scripts to <".datadir.">" - elseif s:downloads > 1 - let s:msg= "Downloaded ".s:downloads." updated scripts to <".datadir.">" - else - let s:msg= "Everything was already current" - endif - if s:downerrors > 0 - let s:msg= s:msg." (".s:downerrors." downloading errors)" - endif - echomsg s:msg - " save the file - if &mod - silent! w! - endif - q - - " restore events and current directory - exe "cd ".escape(substitute(origdir,'\','/','ge'),"|[]*'\" #") - let &ei= eikeep - setlocal nolz -" call Dret("GetLatestVimScripts : did ".s:downloads." downloads") -endfun - -" --------------------------------------------------------------------- -" Restore Options: {{{1 -let &cpo= s:keepcpo -unlet s:keepcpo - -" --------------------------------------------------------------------- -" Modelines: {{{1 -" vim: ts=8 sts=2 fdm=marker nowrap +" --------------------------------------------------------------------- +" getscript.vim +" Author: Charles E. Campbell, Jr. +" Date: Jan 08, 2008 +" Version: 29 +" Installing: :help glvs-install +" Usage: :help glvs +" +" GetLatestVimScripts: 642 1 :AutoInstall: getscript.vim +"redraw!|call inputsave()|call input("Press to continue")|call inputrestore() +" --------------------------------------------------------------------- +" Initialization: {{{1 +" if you're sourcing this file, surely you can't be +" expecting vim to be in its vi-compatible mode! +if &cp + echoerr "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)" + finish +endif +let s:keepcpo = &cpo +set cpo&vim +"DechoTabOn + +if exists("g:loaded_getscript") + finish +endif +let g:loaded_getscript= "v29" + +" --------------------------- +" Global Variables: {{{1 +" --------------------------- +" Cygwin Detection ------- {{{2 +if !exists("g:getscript_cygwin") + if has("win32") || has("win95") || has("win64") || has("win16") + if &shell =~ '\%(\\|\\)\%(\.exe\)\=$' + let g:getscript_cygwin= 1 + else + let g:getscript_cygwin= 0 + endif + else + let g:getscript_cygwin= 0 + endif +endif +" shell quoting character {{{2 +if exists("g:netrw_shq") && !exists("g:getscript_shq") + let g:getscript_shq= g:netrw_shq +elseif !exists("g:getscript_shq") + if exists("&shq") && &shq != "" + let g:getscript_shq= &shq + elseif exists("&sxq") && &sxq != "" + let g:getscript_shq= &sxq + elseif has("win32") || has("win95") || has("win64") || has("win16") + if g:getscript_cygwin + let g:getscript_shq= "'" + else + let g:getscript_shq= '"' + endif + else + let g:getscript_shq= "'" + endif +" call Decho("g:getscript_shq<".g:getscript_shq.">") +endif + +" wget vs curl {{{2 +if !exists("g:GetLatestVimScripts_wget") + if executable("wget") + let g:GetLatestVimScripts_wget= "wget" + elseif executable("curl") + let g:GetLatestVimScripts_wget= "curl" + else + let g:GetLatestVimScripts_wget = 'echo "GetLatestVimScripts needs wget or curl"' + let g:GetLatestVimScripts_options = "" + endif +endif + +" options that wget and curl require: +if !exists("g:GetLatestVimScripts_options") + if g:GetLatestVimScripts_wget == "wget" + let g:GetLatestVimScripts_options= "-q -O" + elseif g:GetLatestVimScripts_wget == "curl" + let g:GetLatestVimScripts_options= "-s -O" + else + let g:GetLatestVimScripts_options= "" + endif +endif + +" by default, allow autoinstall lines to work +if !exists("g:GetLatestVimScripts_allowautoinstall") + let g:GetLatestVimScripts_allowautoinstall= 1 +endif + +"" For debugging: +"let g:GetLatestVimScripts_wget = "echo" +"let g:GetLatestVimScripts_options = "options" + +" --------------------------------------------------------------------- +" Check If AutoInstall Capable: {{{1 +let s:autoinstall= "" +if g:GetLatestVimScripts_allowautoinstall + + if (has("win32") || has("gui_win32") || has("gui_win32s") || has("win16") || has("win64") || has("win32unix") || has("win95")) && &shell != "bash" + " windows (but not cygwin/bash) + let s:dotvim= "vimfiles" + if !exists("g:GetLatestVimScripts_mv") + let g:GetLatestVimScripts_mv= "ren" + endif + + else + " unix + let s:dotvim= ".vim" + if !exists("g:GetLatestVimScripts_mv") + let g:GetLatestVimScripts_mv= "mv" + endif + endif + + if exists('$HOME') && isdirectory(expand("$HOME")."/".s:dotvim) + let s:autoinstall= $HOME."/".s:dotvim + endif +" call Decho("s:autoinstall<".s:autoinstall.">") +"else "Decho +" call Decho("g:GetLatestVimScripts_allowautoinstall=".g:GetLatestVimScripts_allowautoinstall.": :AutoInstall: disabled") +endif + +" --------------------------------------------------------------------- +" Public Interface: {{{1 +com! -nargs=0 GetLatestVimScripts call getscript#GetLatestVimScripts() +com! -nargs=0 GetScript call getscript#GetLatestVimScripts() +silent! com -nargs=0 GLVS call getscript#GetLatestVimScripts() + +" --------------------------------------------------------------------- +" GetOneScript: (Get Latest Vim Script) this function operates {{{1 +" on the current line, interpreting two numbers and text as +" ScriptID, SourceID, and Filename. +" It downloads any scripts that have newer versions from vim.sf.net. +fun! s:GetOneScript(...) +" call Dfunc("GetOneScript()") + + " set options to allow progress to be shown on screen + let rega= @a + let t_ti= &t_ti + let t_te= &t_te + let rs = &rs + set t_ti= t_te= nors + + " put current line on top-of-screen and interpret it into + " a script identifer : used to obtain webpage + " source identifier : used to identify current version + " and an associated comment: used to report on what's being considered + if a:0 >= 3 + let scriptid = a:1 + let srcid = a:2 + let fname = a:3 + let cmmnt = "" +" call Decho("scriptid<".scriptid.">") +" call Decho("srcid <".srcid.">") +" call Decho("fname <".fname.">") + else + let curline = getline(".") + if curline =~ '^\s*#' + let @a= rega +" call Dret("GetOneScript : skipping a pure comment line") + return + endif + let parsepat = '^\s*\(\d\+\)\s\+\(\d\+\)\s\+\(.\{-}\)\(\s*#.*\)\=$' + try + let scriptid = substitute(curline,parsepat,'\1','e') + catch /^Vim\%((\a\+)\)\=:E486/ + let scriptid= 0 + endtry + try + let srcid = substitute(curline,parsepat,'\2','e') + catch /^Vim\%((\a\+)\)\=:E486/ + let srcid= 0 + endtry + try + let fname= substitute(curline,parsepat,'\3','e') + catch /^Vim\%((\a\+)\)\=:E486/ + let fname= "" + endtry + try + let cmmnt= substitute(curline,parsepat,'\4','e') + catch /^Vim\%((\a\+)\)\=:E486/ + let cmmnt= "" + endtry +" call Decho("curline <".curline.">") +" call Decho("parsepat<".parsepat.">") +" call Decho("scriptid<".scriptid.">") +" call Decho("srcid <".srcid.">") +" call Decho("fname <".fname.">") + endif + + if scriptid == 0 || srcid == 0 + " When looking for :AutoInstall: lines, skip scripts that have 0 0 scriptname + let @a= rega +" call Dret("GetOneScript : skipping a scriptid==srcid==0 line") + return + endif + + let doautoinstall= 0 + if fname =~ ":AutoInstall:" +" call Decho("case AutoInstall: fname<".fname.">") + let aicmmnt= substitute(fname,'\s\+:AutoInstall:\s\+',' ','') +" call Decho("aicmmnt<".aicmmnt."> s:autoinstall=".s:autoinstall) + if s:autoinstall != "" + let doautoinstall = g:GetLatestVimScripts_allowautoinstall + endif + else + let aicmmnt= fname + endif +" call Decho("aicmmnt<".aicmmnt.">: doautoinstall=".doautoinstall) + + exe "norm z\" + redraw! +" call Decho('considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid) + echomsg 'considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid + + " grab a copy of the plugin's vim.sf.net webpage + let scriptaddr = 'http://vim.sf.net/script.php?script_id='.scriptid + let tmpfile = tempname() + let v:errmsg = "" + + " make up to three tries at downloading the description + let itry= 1 + while itry <= 3 +" call Decho("try#".itry." to download description of <".aicmmnt."> with addr=".scriptaddr) + if has("win32") || has("win16") || has("win95") +" call Decho("new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.tmpfile.g:getscript_shq.' '.g:getscript_shq.scriptaddr.g:getscript_shq."|q!") + new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.tmpfile.g:getscript_shq.' '.g:getscript_shq.scriptaddr.g:getscript_shq|q! + else +" call Decho("exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.tmpfile.g:getscript_shq." ".g:getscript_shq.scriptaddr.g:getscript_shq) + exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.tmpfile.g:getscript_shq." ".g:getscript_shq.scriptaddr.g:getscript_shq + endif + if itry == 1 + exe "silent vsplit ".tmpfile + else + silent! e % + endif + + " find the latest source-id in the plugin's webpage + silent! 1 + let findpkg= search('Click on the package to download','W') + if findpkg > 0 + break + endif + let itry= itry + 1 + endwhile +" call Decho(" --- end downloading tries while loop --- itry=".itry) + + " testing: did finding "Click on the package..." fail? + if findpkg == 0 || itry >= 4 + silent q! + call delete(tmpfile) + " restore options + let &t_ti = t_ti + let &t_te = t_te + let &rs = rs + let s:downerrors = s:downerrors + 1 +" call Decho("***warning*** couldn'".'t find "Click on the package..." in description page for <'.aicmmnt.">") + echomsg "***warning*** couldn'".'t find "Click on the package..." in description page for <'.aicmmnt.">" +" call Dret("GetOneScript : srch for /Click on the package/ failed") + let @a= rega + return + endif +" call Decho('found "Click on the package to download"') + + let findsrcid= search('src_id=','W') + if findsrcid == 0 + silent q! + call delete(tmpfile) + " restore options + let &t_ti = t_ti + let &t_te = t_te + let &rs = rs + let s:downerrors = s:downerrors + 1 +" call Decho("***warning*** couldn'".'t find "src_id=" in description page for <'.aicmmnt.">") + echomsg "***warning*** couldn'".'t find "src_id=" in description page for <'.aicmmnt.">" + let @a= rega +" call Dret("GetOneScript : srch for /src_id/ failed") + return + endif +" call Decho('found "src_id=" in description page') + + let srcidpat = '^\s*\([^<]\+\)<.*$' + let latestsrcid= substitute(getline("."),srcidpat,'\1','') + let sname = substitute(getline("."),srcidpat,'\2','') " script name actually downloaded +" call Decho("srcidpat<".srcidpat."> latestsrcid<".latestsrcid."> sname<".sname.">") + silent q! + call delete(tmpfile) + + " convert the strings-of-numbers into numbers + let srcid = srcid + 0 + let latestsrcid = latestsrcid + 0 +" call Decho("srcid=".srcid." latestsrcid=".latestsrcid." sname<".sname.">") + + " has the plugin's most-recent srcid increased, which indicates + " that it has been updated + if latestsrcid > srcid +" call Decho("[latestsrcid=".latestsrcid."] <= [srcid=".srcid."]: need to update <".sname.">") + + let s:downloads= s:downloads + 1 + if sname == bufname("%") + " GetLatestVimScript has to be careful about downloading itself + let sname= "NEW_".sname + endif + + " the plugin has been updated since we last obtained it, so download a new copy +" call Decho("...downloading new <".sname.">") + echomsg "...downloading new <".sname.">" + if has("win32") || has("win16") || has("win95") +" call Decho("new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.sname.g:getscript_shq." ".g:getscript_shq.'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid.g:getscript_shq."|q") + new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.sname.g:getscript_shq." ".g:getscript_shq.'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid.g:getscript_shq|q + else +" call Decho("silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.sname.g:getscript_shq." ".g:getscript_shq.'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid.g:getscript_shq) + exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".g:getscript_shq.sname.g:getscript_shq." ".g:getscript_shq.'http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid.g:getscript_shq + endif + + " AutoInstall: only if doautoinstall has been requested by the plugin itself + if doautoinstall +" call Decho("attempting to do autoinstall: getcwd<".getcwd()."> filereadable(".sname.")=".filereadable(sname)) + if filereadable(sname) +" call Decho("silent !".g:GetLatestVimScripts_mv." ".g:getscript_shq.sname.g:getscript_shq." ".g:getscript_shq.s:autoinstall.g:getscript_shq) + exe "silent !".g:GetLatestVimScripts_mv." ".g:getscript_shq.sname.g:getscript_shq." ".g:getscript_shq.s:autoinstall.g:getscript_shq + let curdir = escape(substitute(getcwd(),'\','/','ge'),"|[]*'\" #") + let installdir= curdir."/Installed" + if !isdirectory(installdir) + call mkdir(installdir) + endif +" call Decho("exe cd ".s:autoinstall) + exe "cd ".escape(s:autoinstall,' ') + + " decompress + if sname =~ '\.bz2$' +" call Decho("decompress: attempt to bunzip2 ".sname) + exe "silent !bunzip2 ".g:getscript_shq.sname.g:getscript_shq + let sname= substitute(sname,'\.bz2$','','') +" call Decho("decompress: new sname<".sname."> after bunzip2") + elseif sname =~ '\.gz$' +" call Decho("decompress: attempt to gunzip ".sname) + exe "silent !gunzip ".g:getscript_shq.sname.g:getscript_shq + let sname= substitute(sname,'\.gz$','','') +" call Decho("decompress: new sname<".sname."> after gunzip") + endif + + " distribute archive(.zip, .tar, .vba) contents + if sname =~ '\.zip$' +" call Decho("dearchive: attempt to unzip ".sname) + exe "silent !unzip -o ".g:getscript_shq.sname.g:getscript_shq + elseif sname =~ '\.tar$' +" call Decho("dearchive: attempt to untar ".sname) + exe "silent !tar -xvf ".g:getscript_shq.sname.g:getscript_shq + elseif sname =~ '\.vba$' +" call Decho("dearchive: attempt to handle a vimball: ".sname) + silent 1split + exe "silent e ".escape(sname,' ') + silent so % + silent q + endif + + if sname =~ '.vim$' +" call Decho("dearchive: attempt to simply move ".sname." to plugin") + exe "silent !".g:GetLatestVimScripts_mv." ".g:getscript_shq.sname.g:getscript_shq." plugin" + else +" call Decho("dearchive: move <".sname."> to installdir<".installdir.">") + exe "silent !".g:GetLatestVimScripts_mv." ".g:getscript_shq.sname.g:getscript_shq." ".installdir + endif + + " helptags step + let docdir= substitute(&rtp,',.*','','e')."/doc" +" call Decho("helptags: docdir<".docdir.">") + exe "helptags ".docdir + exe "cd ".curdir + endif + if fname !~ ':AutoInstall:' + let modline=scriptid." ".latestsrcid." :AutoInstall: ".fname.cmmnt + else + let modline=scriptid." ".latestsrcid." ".fname.cmmnt + endif + else + let modline=scriptid." ".latestsrcid." ".fname.cmmnt + endif + + " update the data in the file + call setline(line("."),modline) +" call Decho("update data in ".expand("%")."#".line(".").": modline<".modline.">") +" else " Decho +" call Decho("[latestsrcid=".latestsrcid."] <= [srcid=".srcid."], no need to update") + endif + + " restore options + let &t_ti = t_ti + let &t_te = t_te + let &rs = rs + let @a = rega + +" call Dret("GetOneScript") +endfun + +" --------------------------------------------------------------------- +" GetLatestVimScripts: this function gets the latest versions of {{{1 +" scripts based on the list in +" (first dir in runtimepath)/GetLatest/GetLatestVimScripts.dat +fun! getscript#GetLatestVimScripts() +" call Dfunc("GetLatestVimScripts() autoinstall<".s:autoinstall.">") + +" insure that wget is executable + if executable(g:GetLatestVimScripts_wget) != 1 + echoerr "GetLatestVimScripts needs ".g:GetLatestVimScripts_wget." which apparently is not available on your system" +" call Dret("GetLatestVimScripts : wget not executable/availble") + return + endif + + " Find the .../GetLatest subdirectory under the runtimepath + for datadir in split(&rtp,',') + [''] + if isdirectory(datadir."/GetLatest") +" call Decho("found directory<".datadir.">") + let datadir= datadir . "/GetLatest" + break + endif + if filereadable(datadir."GetLatestVimScripts.dat") +" call Decho("found ".datadir."/GetLatestVimScripts.dat") + break + endif + endfor + + " Sanity checks: readability and writability + if datadir == "" + echoerr 'Missing "GetLatest/" on your runtimepath - see :help glvs-dist-install' +" call Dret("GetLatestVimScripts : unable to find a GetLatest subdirectory") + return + endif + + if filewritable(datadir) != 2 + echoerr "(getLatestVimScripts) Your ".datadir." isn't writable" +" call Dret("GetLatestVimScripts : non-writable directory<".datadir.">") + return + endif + let datafile= datadir."/GetLatestVimScripts.dat" + if !filereadable(datafile) + echoerr "Your data file<".datafile."> isn't readable" +" call Dret("GetLatestVimScripts : non-readable datafile<".datafile.">") + return + endif + if !filewritable(datafile) + echoerr "Your data file<".datafile."> isn't writable" +" call Dret("GetLatestVimScripts : non-writable datafile<".datafile.">") + return + endif +" call Decho("datadir <".datadir.">") +" call Decho("datafile <".datafile.">") + + " don't let any events interfere (like winmanager's, taglist's, etc) + let eikeep= &ei + set ei=all + + " record current directory, change to datadir, open split window with + " datafile + let origdir= getcwd() + exe "cd ".escape(substitute(datadir,'\','/','ge'),"|[]*'\" #") + split + exe "e ".escape(substitute(datafile,'\','/','ge'),"|[]*'\" #") + res 1000 + let s:downloads = 0 + let s:downerrors= 0 + + " Check on dependencies mentioned in plugins +" call Decho(" ") +" call Decho("searching plugins for GetLatestVimScripts dependencies") + let lastline = line("$") +" call Decho("lastline#".lastline) + let plugins = split(globpath(&rtp,"plugin/*.vim"),'\n') + let foundscript = 0 + let firstdir= "" + + for plugin in plugins + + " don't process plugins in system directories + if firstdir == "" + let firstdir= substitute(plugin,'[/\\][^/\\]\+$','','') +" call Decho("setting firstdir<".firstdir.">") + else + let curdir= substitute(plugin,'[/\\][^/\\]\+$','','') +" call Decho("curdir<".curdir.">") + if curdir != firstdir +" call Decho("skipping subsequent plugins: curdir<".curdir."> != firstdir<".firstdir.">") + break + endif + endif + + " read plugin in + $ +" call Decho(" ") +" call Decho(".dependency checking<".plugin."> line$=".line("$")) + exe "silent r ".escape(plugin,"[]#*$%'\" ?`!&();<>\\") + + while search('^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+','W') != 0 + let newscript= substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+\s\+\(.*\)$','\1','e') + let llp1 = lastline+1 +" call Decho("..newscript<".newscript.">") + + " don't process ""GetLatestVimScripts lines -- those that have been doubly-commented out + if newscript !~ '^"' + " found a "GetLatestVimScripts: # #" line in the script; check if its already in the datafile + let curline = line(".") + let noai_script = substitute(newscript,'\s*:AutoInstall:\s*','','e') + exe llp1 + let srchline = search('\<'.noai_script.'\>','bW') +" call Decho("..noai_script<".noai_script."> srch=".srchline."curline#".line(".")." lastline#".lastline) + + if srchline == 0 + " found a new script to permanently include in the datafile + let keep_rega = @a + let @a = substitute(getline(curline),'^"\s\+GetLatestVimScripts:\s\+','','') + exe lastline."put a" + echomsg "Appending <".@a."> to ".datafile." for ".newscript +" call Decho("..APPEND (".noai_script.")<".@a."> to GetLatestVimScripts.dat") + let @a = keep_rega + let lastline = llp1 + let curline = curline + 1 + let foundscript = foundscript + 1 +" else " Decho +" call Decho("..found <".noai_script."> (already in datafile at line#".srchline.")") + endif + + let curline = curline + 1 + exe curline + endif + endwhile + + let llp1= lastline + 1 +" call Decho(".deleting lines: ".llp1.",$d") + exe "silent! ".llp1.",$d" + endfor +" call Decho("--- end dependency checking loop --- foundscript=".foundscript) +" call Decho(" ") + + if foundscript == 0 + setlocal nomod + endif + + " Check on out-of-date scripts using GetLatest/GetLatestVimScripts.dat +" call Decho("begin: checking out-of-date scripts using datafile<".datafile.">") + setlocal lz + 1 +" /^-----/,$g/^\s*\d/call Decho(getline(".")) + 1 + /^-----/,$g/^\s*\d/call s:GetOneScript() +" call Decho("--- end out-of-date checking --- ") + + " Final report (an echomsg) + try + silent! ?^-------? + catch /^Vim\%((\a\+)\)\=:E114/ +" call Dret("GetLatestVimScripts : nothing done!") + return + endtry + exe "norm! kz\" + redraw! + let s:msg = "" + if s:downloads == 1 + let s:msg = "Downloaded one updated script to <".datadir.">" + elseif s:downloads == 2 + let s:msg= "Downloaded two updated scripts to <".datadir.">" + elseif s:downloads > 1 + let s:msg= "Downloaded ".s:downloads." updated scripts to <".datadir.">" + else + let s:msg= "Everything was already current" + endif + if s:downerrors > 0 + let s:msg= s:msg." (".s:downerrors." downloading errors)" + endif + echomsg s:msg + " save the file + if &mod + silent! w! + endif + q + + " restore events and current directory + exe "cd ".escape(substitute(origdir,'\','/','ge'),"|[]*'\" #") + let &ei= eikeep + setlocal nolz +" call Dret("GetLatestVimScripts : did ".s:downloads." downloads") +endfun + +" --------------------------------------------------------------------- +" Restore Options: {{{1 +let &cpo= s:keepcpo +unlet s:keepcpo + +" --------------------------------------------------------------------- +" Modelines: {{{1 +" vim: ts=8 sts=2 fdm=marker nowrap diff --git a/vimfiles/autoload/libsrec.vim b/vimfiles/autoload/libsrec.vim new file mode 100644 index 0000000..088d3a9 --- /dev/null +++ b/vimfiles/autoload/libsrec.vim @@ -0,0 +1,152 @@ +" Vim Library for Editing .srec Files +" Maintainer: Alexander Fleck +" +" License: This File is placed in the Public Domain. +" Revision | Date [DD.MM.YY] | Changes +" 00.01.00 | 05.07.09 | 01. Revision + +" create ByteCount +fun libsrec#CrBC(line) + let s:byco = "" + + " Dictionary with Assumptions + let s:dict = { 0: '0F', + \ 1: '0F', + \ 2: '0F', + \ 3: '0F', + \ 4: '' , + \ 5: '03', + \ 6: '' , + \ 7: '05', + \ 8: '04', + \ 9: '03' } + + let s:byco = s:dict[a:line[1]] + + unlet s:dict + "unlet s:byco + return s:byco +endfun + +" create ADdress +fun libsrec#CrAD(line) + let s:adrs = "" + " Number of Bytes for Address + let s:adby = "" + " Dictionary + let s:dict = { 0: 2, + \ 1: 2, + \ 2: 3, + \ 3: 4, + \ 4: 0, + \ 5: 2, + \ 6: 0, + \ 7: 4, + \ 8: 3, + \ 9: 2 } + + let s:adby = s:dict[a:line[1]] + + let s:n = 0 + while 1 + let s:n = s:n + 1 + if s:n > s:adby + break + endif + let s:adrs = s:adrs . "00" + continue + endwhile + unlet s:n + + unlet s:dict + unlet s:adby + "unlet s:adrs + return s:adrs +endfun + +" create DAta +fun libsrec#CrDA(line) + let s:data = "" + " Number of Bytes for Data + let s:daby = "" + + " get ByteCount from Line + let s:bchx = "0x" . a:line[2] . a:line[3] + " Dictionary + let s:dict = { 0: s:bchx - 3, + \ 1: s:bchx - 3, + \ 2: s:bchx - 4, + \ 3: s:bchx - 5, + \ 4: 0 , + \ 5: 0 , + \ 6: 0 , + \ 7: 0 , + \ 8: 0 , + \ 9: 0 } + + let s:daby = s:dict[a:line[1]] + + let s:n = 0 + while 1 + let s:n = s:n + 1 + if s:n > s:daby + break + endif + let s:data = s:data . "FF" + continue + endwhile + unlet s:n + + unlet s:dict + unlet s:bchx + unlet s:daby + "unlet s:data + return s:data +endfun + +" create CheckSum +fun libsrec#CrCS(line) + " CheckSum as a String + let s:chsu = "" + + " get ByteCount from Line + let s:bchx = "0x" . a:line[2] . a:line[3] + + if ((a:line[1] == "4") || (a:line[1] == "6")) + " there' s no S4 or S6 + else + " CheckSum as a Value + let s:csby = 0 + + " add the Byte Values + let s:n = 0 + while 1 + let s:n = s:n + 1 + if s:n > s:bchx + break + endif + let s:csby = s:csby + ("0x" . a:line[2*s:n] . a:line[2*s:n+1]) + continue + endwhile + unlet s:n + + " CheckSum is: + let s:csby = 255 - (s:csby % 256) + + " convert to Hex Value, + " Hex String without "0x" + let s:hxva = "0123456789ABCDEF" + while s:csby + let s:chsu = s:hxva[s:csby % 16] . s:chsu + let s:csby = s:csby / 16 + endwhile + + unlet s:hxva + unlet s:csby + endif + + unlet s:bchx + "unlet s:chsu + return s:chsu +endfun + diff --git a/vimfiles/autoload/netrw.vim b/vimfiles/autoload/netrw.vim index 0bd0283..dff8afd 100644 --- a/vimfiles/autoload/netrw.vim +++ b/vimfiles/autoload/netrw.vim @@ -1,10 +1,10 @@ " netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION -" Date: Oct 23, 2008 -" Version: 134 +" Date: Dec 28, 2009 +" Version: 136 " Maintainer: Charles E Campbell, Jr " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim -" Copyright: Copyright (C) 1999-2008 Charles E. Campbell, Jr. {{{1 +" Copyright: Copyright (C) 1999-2009 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, @@ -22,7 +22,7 @@ if &cp || exists("g:loaded_netrw") finish endif -let g:loaded_netrw = "v134" +let g:loaded_netrw = "v136" if v:version < 702 echohl WarningMsg echo "***warning*** this version of netrw needs vim 7.2" @@ -50,17 +50,30 @@ setlocal cpo&vim " Netrw Variables: {{{1 " ====================== +" --------------------------------------------------------------------- +" NetrwInit: initializes variables if they haven't been defined {{{2 +" Loosely, varname = value. +fun s:NetrwInit(varname,value) + if !exists(a:varname) + if type(a:value) == 0 + exe "let ".a:varname."=".a:value + elseif type(a:value) == 1 + exe "let ".a:varname."="."'".a:value."'" + else + exe "let ".a:varname."=".a:value + endif + endif +endfun + " --------------------------------------------------------------------- " Netrw Constants: {{{2 -if !exists("g:netrw_dirhist_cnt") - let g:netrw_dirhist_cnt= 0 -endif +call s:NetrwInit("g:netrw_dirhist_cnt",0) if !exists("s:LONGLIST") - let s:THINLIST = 0 - let s:LONGLIST = 1 - let s:WIDELIST = 2 - let s:TREELIST = 3 - let s:MAXLIST = 4 + call s:NetrwInit("s:THINLIST",0) + call s:NetrwInit("s:LONGLIST",1) + call s:NetrwInit("s:WIDELIST",2) + call s:NetrwInit("s:TREELIST",3) + call s:NetrwInit("s:MAXLIST" ,4) endif " --------------------------------------------------------------------- @@ -87,48 +100,28 @@ endif if !exists("g:netrw_http_cmd") if executable("elinks") let g:netrw_http_cmd = "elinks" - if !exists("g:netrw_http_xcmd") - let g:netrw_http_xcmd= "-dump >" - endif + call s:NetrwInit("g:netrw_http_xcmd","-source >") elseif executable("links") let g:netrw_http_cmd = "links" - if !exists("g:netrw_http_xcmd") - let g:netrw_http_xcmd= "-dump >" - endif + call s:NetrwInit("g:netrw_http_xcmd","-source >") elseif executable("curl") let g:netrw_http_cmd = "curl" - if !exists("g:netrw_http_xcmd") - let g:netrw_http_xcmd= "-o" - endif + call s:NetrwInit("g:netrw_http_xcmd","-o") elseif executable("wget") let g:netrw_http_cmd = "wget" - if !exists("g:netrw_http_xcmd") - let g:netrw_http_xcmd= "-q -O" - endif + call s:NetrwInit("g:netrw_http_xcmd","-q -O") elseif executable("fetch") let g:netrw_http_cmd = "fetch" - if !exists("g:netrw_http_xcmd") - let g:netrw_http_xcmd= "-o" - endif + call s:NetrwInit("g:netrw_http_xcmd","-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 +call s:NetrwInit("g:netrw_rcp_cmd" , "rcp") +call s:NetrwInit("g:netrw_rsync_cmd", "rsync") +call s:NetrwInit("g:netrw_scp_cmd" , "scp -q") +call s:NetrwInit("g:netrw_sftp_cmd" , "sftp") +call s:NetrwInit("g:netrw_ssh_cmd" , "ssh") if (has("win32") || has("win95") || has("win64") || has("win16")) \ && exists("g:netrw_use_nt_rcp") @@ -156,45 +149,24 @@ if !exists("g:netrw_cygwin") endif endif " Default values - a-c ---------- {{{3 -if !exists("g:netrw_alto") - let g:netrw_alto= &sb -endif -if !exists("g:netrw_altv") - let g:netrw_altv= &spr -endif -if !exists("g:netrw_browse_split") - let g:netrw_browse_split= 0 -endif -if !exists("g:netrw_chgwin") - let g:netrw_chgwin = -1 -endif -if !exists("g:netrw_compress") - let g:netrw_compress= "gzip" -endif -if !exists("g:netrw_ctags") - let g:netrw_ctags= "ctags" -endif +call s:NetrwInit("g:netrw_alto" , &sb) +call s:NetrwInit("g:netrw_altv" , &spr) +call s:NetrwInit("g:netrw_banner" , 1) +call s:NetrwInit("g:netrw_browse_split", 0) +call s:NetrwInit("g:netrw_chgwin" , -1) +call s:NetrwInit("g:netrw_compress" , "gzip") +call s:NetrwInit("g:netrw_ctags" , "ctags") if !exists("g:netrw_cursorline") let g:netrw_cursorline= 1 let s:netrw_usercul = &cursorline let s:netrw_usercuc = &cursorcolumn endif " Default values - d-g ---------- {{{3 -if !exists("g:netrw_dirhist_cnt") - let g:netrw_dirhist_cnt= 0 -endif -if !exists("g:netrw_decompress") - let g:netrw_decompress= { ".gz" : "gunzip" , ".bz2" : "bunzip2" , ".zip" : "unzip" , ".tar" : "tar -xf"} -endif -if !exists("g:netrw_dirhistmax") - let g:netrw_dirhistmax= 10 -endif -if !exists("g:netrw_fastbrowse") - let g:netrw_fastbrowse= 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 +call s:NetrwInit("g:netrw_dirhist_cnt" , 0) +call s:NetrwInit("g:netrw_decompress" , '{ ".gz" : "gunzip", ".bz2" : "bunzip2", ".zip" : "unzip", ".tar" : "tar -xf"}') +call s:NetrwInit("g:netrw_dirhistmax" , 10) +call s:NetrwInit("g:netrw_fastbrowse" , 1) +call s:NetrwInit("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_ftp_list_cmd") if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin) let g:netrw_ftp_list_cmd = "ls -lF" @@ -206,13 +178,9 @@ if !exists("g:netrw_ftp_list_cmd") let g:netrw_ftp_sizelist_cmd = "dir" endif endif -if !exists("g:netrw_ftpmode") - let g:netrw_ftpmode= "binary" -endif +call s:NetrwInit("g:netrw_ftpmode",'binary') " Default values - h-lh ---------- {{{3 -if !exists("g:netrw_hide") - let g:netrw_hide= 1 -endif +call s:NetrwInit("g:netrw_hide",1) if !exists("g:netrw_ignorenetrc") if &shell =~ '\c\<\%(cmd\|4nt\)\.exe$' let g:netrw_ignorenetrc= 1 @@ -220,9 +188,7 @@ if !exists("g:netrw_ignorenetrc") let g:netrw_ignorenetrc= 0 endif endif -if !exists("g:netrw_keepdir") - let g:netrw_keepdir= 1 -endif +call s:NetrwInit("g:netrw_keepdir",1) if !exists("g:netrw_list_cmd") if g:netrw_scp_cmd =~ '^pscp' && executable("pscp") " provide a 'pscp' listing command @@ -238,9 +204,7 @@ if !exists("g:netrw_list_cmd") let g:netrw_list_cmd= "" endif endif -if !exists("g:netrw_list_hide") - let g:netrw_list_hide= "" -endif +call s:NetrwInit("g:netrw_list_hide","") " Default values - lh-lz ---------- {{{3 if !exists("g:netrw_localcopycmd") if has("win32") || has("win95") || has("win64") || has("win16") @@ -255,9 +219,7 @@ if !exists("g:netrw_localcopycmd") let g:netrw_localcopycmd= "" endif endif -if !exists("g:netrw_local_mkdir") - let g:netrw_local_mkdir= "mkdir" -endif +call s:NetrwInit("g:netrw_local_mkdir","mkdir") if !exists("g:netrw_localmovecmd") if has("win32") || has("win95") || has("win64") || has("win16") if g:netrw_cygwin @@ -271,128 +233,66 @@ if !exists("g:netrw_localmovecmd") let g:netrw_localmovecmd= "" endif endif -if !exists("g:netrw_local_rmdir") - let g:netrw_local_rmdir= "rmdir" -endif -if !exists("g:netrw_liststyle") - let g:netrw_liststyle= s:THINLIST -endif +call s:NetrwInit("g:netrw_local_rmdir", "rmdir") +call s:NetrwInit("g:netrw_liststyle" , s:THINLIST) +" sanity checks if g:netrw_liststyle < 0 || g:netrw_liststyle >= s:MAXLIST - " sanity check let g:netrw_liststyle= s:THINLIST endif if g:netrw_liststyle == s:LONGLIST && g:netrw_scp_cmd !~ '^pscp' let g:netrw_list_cmd= g:netrw_list_cmd." -l" endif " Default values - m-r ---------- {{{3 -if !exists("g:netrw_markfileesc") - let g:netrw_markfileesc= '*./[\~' -endif -if !exists("g:netrw_maxfilenamelen") - let g:netrw_maxfilenamelen= 32 -endif -if !exists("g:netrw_menu") - let g:netrw_menu= 1 -endif -if !exists("g:netrw_mkdir_cmd") - let g:netrw_mkdir_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME mkdir" -endif -if !exists("g:netrw_mousemaps") - if exists("&mouse") && &mouse =~ '[anh]' - let g:netrw_mousemaps= 1 - else - let g:netrw_mousemaps= 0 - endif -endif -if !exists("g:netrw_retmap") - let g:netrw_retmap= 0 -endif -if !exists("g:netrw_preview") - let g:netrw_preview= 0 -endif -if !exists("g:netrw_scpport") - let g:netrw_scpport= "-P" -endif -if !exists("g:netrw_sshport") - let g:netrw_sshport= "-p" -endif -if !exists("g:netrw_rename_cmd") - let g:netrw_rename_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME mv" -endif -if !exists("g:netrw_rm_cmd") - let g:netrw_rm_cmd = g:netrw_ssh_cmd." USEPORT HOSTNAME rm" -endif -if !exists("g:netrw_rmdir_cmd") - let g:netrw_rmdir_cmd = g:netrw_ssh_cmd." USEPORT HOSTNAME rmdir" -endif -if !exists("g:netrw_rmf_cmd") - let g:netrw_rmf_cmd = g:netrw_ssh_cmd." USEPORT HOSTNAME rm -f" +call s:NetrwInit("g:netrw_markfileesc" , '*./[\~') +call s:NetrwInit("g:netrw_maxfilenamelen", 32) +call s:NetrwInit("g:netrw_menu" , 1) +call s:NetrwInit("g:netrw_mkdir_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME mkdir") +call s:NetrwInit("g:netrw_mousemaps" , (exists("&mouse") && &mouse =~ '[anh]')) +call s:NetrwInit("g:netrw_retmap" , 0) +if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin) + call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME") +elseif has("win32") || has("win95") || has("win64") || has("win16") + call s:NetrwInit("g:netrw_chgperm" , "cacls FILENAME /e /p PERM") +else + call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME") endif +call s:NetrwInit("g:netrw_preview" , 0) +call s:NetrwInit("g:netrw_scpport" , "-P") +call s:NetrwInit("g:netrw_sshport" , "-p") +call s:NetrwInit("g:netrw_rename_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME mv") +call s:NetrwInit("g:netrw_rm_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rm") +call s:NetrwInit("g:netrw_rmdir_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rmdir") +call s:NetrwInit("g:netrw_rmf_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME rm -f") " Default values - s ---------- {{{3 - " set up shell quoting character -if exists("g:netrw_silent") && g:netrw_silent != 0 - let s:netrw_silentxfer= "silent " -else - let s:netrw_silentxfer= "" -endif -if !exists("g:netrw_sort_by") - " alternatives: date size - let g:netrw_sort_by= "name" -endif -if !exists("g:netrw_sort_options") - let g:netrw_sort_options= "" -endif -if !exists("g:netrw_sort_direction") - " alternative: reverse (z y x ...) - let g:netrw_sort_direction= "normal" -endif +" g:netrw_sepchr: picking a character that doesn't appear in filenames that can be used to separate priority from filename +call s:NetrwInit("g:netrw_sepchr" , (&enc == "euc-jp")? "\" : "\") +call s:NetrwInit("s:netrw_silentxfer" , (exists("g:netrw_silent") && g:netrw_silent != 0)? "silent " : "") +call s:NetrwInit("g:netrw_sort_by" , "name") " alternatives: date , size +call s:NetrwInit("g:netrw_sort_options" , "") +call s:NetrwInit("g:netrw_sort_direction", "normal") " alternative: reverse (z y x ...) if !exists("g:netrw_sort_sequence") - let g:netrw_sort_sequence= '[\/]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$' -endif -if !exists("g:netrw_special_syntax") - let g:netrw_special_syntax= 0 -endif -if !exists("g:netrw_ssh_browse_reject") - let g:netrw_ssh_browse_reject='^total\s\+\d\+$' -endif -if !has("patch192") - if !exists("g:netrw_use_noswf") - let g:netrw_use_noswf= 1 + if has("unix") + let g:netrw_sort_sequence= '[\/]$,\,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$' + else + let g:netrw_sort_sequence= '[\/]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$' endif -else - let g:netrw_use_noswf= 0 endif +call s:NetrwInit("g:netrw_special_syntax" , 0) +call s:NetrwInit("g:netrw_ssh_browse_reject", '^total\s\+\d\+$') +call s:NetrwInit("g:netrw_use_noswf" , 0) " Default values - t-w ---------- {{{3 -if !exists("g:netrw_timefmt") - let g:netrw_timefmt= "%c" -endif -if !exists("g:netrw_xstrlen") - let g:netrw_xstrlen= 1 -endif -if !exists("g:NetrwTopLvlMenu") - let g:NetrwTopLvlMenu= "Netrw." -endif -if !exists("g:netrw_use_errorwindow") - let g:netrw_use_errorwindow= 1 -endif -if !exists("g:netrw_win95ftp") - let g:netrw_win95ftp= 1 -endif -if !exists("g:netrw_winsize") - let g:netrw_winsize= "" -endif +call s:NetrwInit("g:netrw_timefmt","%c") +call s:NetrwInit("g:netrw_xstrlen",0) +call s:NetrwInit("g:NetrwTopLvlMenu","Netrw.") +call s:NetrwInit("g:netrw_use_errorwindow",1) +call s:NetrwInit("g:netrw_win95ftp",1) +call s:NetrwInit("g:netrw_winsize","") " --------------------------------------------------------------------- " Default values for netrw's script variables: {{{2 -if !exists("g:netrw_fname_escape") - let g:netrw_fname_escape= ' ?&;%' -endif -if !exists("g:netrw_glob_escape") - let g:netrw_glob_escape= '[]*?`{~$' -endif -if !exists("g:netrw_tmpfile_escape") - let g:netrw_tmpfile_escape= ' &;' -endif -let s:netrw_map_escape = "<|\n\r\\\\"" +call s:NetrwInit("g:netrw_fname_escape",' ?&;%') +call s:NetrwInit("g:netrw_glob_escape",'[]*?`{~$') +call s:NetrwInit("g:netrw_tmpfile_escape",' &;') +call s:NetrwInit("s:netrw_map_escape","<|\n\r\\\\"") " BufEnter event ignored by decho when following variable is true " Has a side effect that doau BufReadPost doesn't work, so @@ -411,7 +311,7 @@ let s:netrw_map_escape = "<|\n\r\\\\"" " NetrwBrowse. " vt: normally its "w:" or "s:" (a variable type) fun! s:NetrwOptionSave(vt) -" call Dfunc("s:NetrwOptionSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">") +" call Dfunc("s:NetrwOptionSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">"." winnr($)=".winnr("$")) " call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist")) if !exists("{a:vt}netrw_optionsave") @@ -457,7 +357,7 @@ endfun " ------------------------------------------------------------------------ " s:NetrwOptionRestore: restore options {{{2 fun! s:NetrwOptionRestore(vt) -" call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")) +" call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")." winnr($)=".winnr("$")) if !exists("{a:vt}netrw_optionsave") " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) " call Dret("s:NetrwOptionRestore : ".a:vt."netrw_optionsave doesn't exist") @@ -530,8 +430,8 @@ endfun " --------------------------------------------------------------------- " s:NetrwSafeOptions: sets options to help netrw do its job {{{2 fun! s:NetrwSafeOptions() -" call Dfunc("s:NetrwSafeOptions() win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">") -" call Decho("window's ft=".&ft) +" call Dfunc("s:NetrwSafeOptions() win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%"))."> winnr($)=".winnr("$")) +" call Decho("win#".winnr()."'s ft=".&ft) setlocal cino= setlocal com= setlocal cpo-=aA @@ -544,6 +444,12 @@ fun! s:NetrwSafeOptions() if g:netrw_use_noswf && has("win32") && !has("win95") setlocal noswf endif + + " allow the user to override safe options + if &ft == "netrw" + silent keepalt keepjumps doau FileType netrw + endif + " call Decho("fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist")) " call Dret("s:NetrwSafeOptions") endfun @@ -594,6 +500,16 @@ fun! netrw#NetrwClean(sys) " call Dret("netrw#NetrwClean") endfun +" --------------------------------------------------------------------- +" netrw#Nread: {{{2 +fun! netrw#Nread(mode,fname) +" call Dfunc("netrw#Nread(mode=".a:mode." fname<".a:fname.">)") + call netrw#NetrwSavePosn() + call netrw#NetRead(a:mode,a:fname) + call netrw#NetrwRestorePosn() +" call Dret("netrw#Nread") +endfun + " ------------------------------------------------------------------------ " Netrw Transfer Functions: {{{1 " =============================== @@ -607,11 +523,11 @@ endfun fun! netrw#NetRead(mode,...) " call Dfunc("netrw#NetRead(mode=".a:mode.",...) a:0=".a:0." ".g:loaded_netrw) - " save options {{{3 + " NetRead: save options {{{3 call s:NetrwOptionSave("w:") call s:NetrwSafeOptions() - " interpret mode into a readcmd {{{3 + " NetRead: interpret mode into a readcmd {{{3 if a:mode == 0 " read remote file before current line let readcmd = "0r" elseif a:mode == 1 " read file after current line @@ -627,7 +543,7 @@ fun! netrw#NetRead(mode,...) let ichoice = (a:0 == 0)? 0 : 1 " call Decho("readcmd<".readcmd."> ichoice=".ichoice) - " Get Temporary Filename {{{3 + " NetRead: get temporary filename {{{3 let tmpfile= s:GetTempfile("") if tmpfile == "" " call Dret("netrw#NetRead : unable to get a tempfile!") @@ -694,7 +610,7 @@ fun! netrw#NetRead(mode,...) " call Decho("choice<" . choice . ">") let ichoice= ichoice + 1 - " Determine method of read (ftp, rcp, etc) {{{3 + " NetRead: Determine method of read (ftp, rcp, etc) {{{3 call s:NetrwMethod(choice) if !exists("b:netrw_method") || b:netrw_method < 0 " call Dfunc("netrw#NetRead : unsupported method") @@ -712,14 +628,14 @@ fun! netrw#NetRead(mode,...) endif " ============ - " Perform Protocol-Based Read {{{3 + " NetRead: Perform Protocol-Based Read {{{3 " =========================== if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 echo "(netrw) Processing your read request..." endif "......................................... - " rcp: NetRead Method #1 {{{3 + " NetRead: (rcp) NetRead Method #1 {{{3 if b:netrw_method == 1 " read with rcp " call Decho("read via rcp (method #1)") " ER: nothing done with g:netrw_uid yet? @@ -746,7 +662,7 @@ fun! netrw#NetRead(mode,...) let b:netrw_lastfile = choice "......................................... - " ftp + <.netrc>: NetRead Method #2 {{{3 + " NetRead: (ftp + <.netrc>) NetRead Method #2 {{{3 elseif b:netrw_method == 2 " read with ftp + <.netrc> " call Decho("read via ftp+.netrc (method #2)") let netrw_fname= b:netrw_fname @@ -786,7 +702,7 @@ fun! netrw#NetRead(mode,...) let b:netrw_lastfile = choice "......................................... - " ftp + machine,id,passwd,filename: NetRead Method #3 {{{3 + " NetRead: (ftp + machine,id,passwd,filename) NetRead Method #3 {{{3 elseif b:netrw_method == 3 " read with ftp + machine, id, passwd, and fname " Construct execution string (four lines) which will be passed through filter " call Decho("read via ftp+mipf (method #3)") @@ -842,7 +758,7 @@ fun! netrw#NetRead(mode,...) let b:netrw_lastfile = choice "......................................... - " scp: NetRead Method #4 {{{3 + " NetRead: (scp) NetRead Method #4 {{{3 elseif b:netrw_method == 4 " read with scp " call Decho("read via scp (method #4)") if exists("g:netrw_port") && g:netrw_port != "" @@ -850,13 +766,13 @@ fun! netrw#NetRead(mode,...) else let useport= "" endif -" call Decho("exe s:netrw_silentxfer.!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) +" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) exe s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... - " http: NetRead Method #5 (wget) {{{3 + " NetRead: (http) NetRead Method #5 (wget) {{{3 elseif b:netrw_method == 5 " call Decho("read via http (method #5)") if g:netrw_http_cmd == "" @@ -896,7 +812,7 @@ fun! netrw#NetRead(mode,...) setlocal ro "......................................... - " dav: NetRead Method #6 {{{3 + " NetRead: (dav) NetRead Method #6 {{{3 elseif b:netrw_method == 6 " call Decho("read via cadaver (method #6)") @@ -932,7 +848,7 @@ fun! netrw#NetRead(mode,...) let b:netrw_lastfile = choice "......................................... - " rsync: NetRead Method #7 {{{3 + " NetRead: (rsync) NetRead Method #7 {{{3 elseif b:netrw_method == 7 " call Decho("read via rsync (method #7)") " call Decho("exe ".s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) @@ -941,7 +857,7 @@ fun! netrw#NetRead(mode,...) let b:netrw_lastfile = choice "......................................... - " fetch: NetRead Method #8 {{{3 + " NetRead: (fetch) NetRead Method #8 {{{3 " fetch://[user@]host[:http]/path elseif b:netrw_method == 8 " call Decho("read via fetch (method #8)") @@ -971,7 +887,7 @@ fun! netrw#NetRead(mode,...) setlocal ro "......................................... - " sftp: NetRead Method #9 {{{3 + " NetRead: (sftp) NetRead Method #9 {{{3 elseif b:netrw_method == 9 " call Decho("read via sftp (method #9)") " call Decho("exe ".s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile) @@ -980,13 +896,13 @@ fun! netrw#NetRead(mode,...) let b:netrw_lastfile = choice "......................................... - " Complain {{{3 + " NetRead: Complain {{{3 else call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",8) endif endwhile - " cleanup {{{3 + " NetRead: cleanup {{{3 if exists("b:netrw_method") " call Decho("cleanup b:netrw_method and b:netrw_fname") unlet b:netrw_method @@ -994,7 +910,7 @@ fun! netrw#NetRead(mode,...) endif if s:FileReadable(tmpfile) && tmpfile !~ '.tar.bz2$' && tmpfile !~ '.tar.gz$' && tmpfile !~ '.zip' && tmpfile !~ '.tar' && readcmd != 't' " call Decho("cleanup by deleting tmpfile<".tmpfile.">") - call s:NetrwDelete(fnameescape(tmpfile)) + call s:NetrwDelete(tmpfile) endif call s:NetrwOptionRestore("w:") @@ -1006,12 +922,12 @@ endfun fun! netrw#NetWrite(...) range " call Dfunc("netrw#NetWrite(a:0=".a:0.") ".g:loaded_netrw) - " option handling + " NetWrite: option handling {{{3 let mod= 0 call s:NetrwOptionSave("w:") call s:NetrwSafeOptions() - " Get Temporary Filename {{{3 + " NetWrite: Get Temporary Filename {{{3 let tmpfile= s:GetTempfile("") if tmpfile == "" " call Dret("netrw#NetWrite : unable to get a tempfile!") @@ -1050,7 +966,7 @@ fun! netrw#NetWrite(...) range 0file! endif - " While choice loop: {{{3 + " NetWrite: while choice loop: {{{3 while ichoice <= a:0 " Process arguments: {{{4 @@ -1114,7 +1030,7 @@ fun! netrw#NetWrite(...) range endif " ============= - " Perform Protocol-Based Write {{{4 + " NetWrite: Perform Protocol-Based Write {{{3 " ============================ if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 echo "(netrw) Processing your write request..." @@ -1122,7 +1038,7 @@ fun! netrw#NetWrite(...) range endif "......................................... - " rcp: NetWrite Method #1 {{{4 + " NetWrite: (rcp) NetWrite Method #1 {{{3 if b:netrw_method == 1 " call Decho("write via rcp (method #1)") if s:netrw_has_nt_rcp == 1 @@ -1143,11 +1059,17 @@ fun! netrw#NetWrite(...) range let b:netrw_lastfile = choice "......................................... - " ftp + <.netrc>: NetWrite Method #2 {{{4 + " NetWrite: (ftp + <.netrc>) NetWrite Method #2 {{{3 elseif b:netrw_method == 2 " call Decho("write via ftp+.netrc (method #2)") - let netrw_fname= b:netrw_fname - new + let netrw_fname = b:netrw_fname + + " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead + let bhkeep = &l:bh + let curbuf = bufnr("%") + setlocal bh=hide + enew + " call Decho("filter input window#".winnr()) setlocal ff=unix put =g:netrw_ftpmode @@ -1173,17 +1095,29 @@ fun! netrw#NetWrite(...) range endif let mod=1 endif - bd! + + " remove enew buffer (quietly) + let filtbuf= bufnr("%") + exe curbuf."b!" + let &l:bh = bhkeep + exe filtbuf."bw!" + let b:netrw_lastfile = choice "......................................... - " ftp + machine, id, passwd, filename: NetWrite Method #3 {{{4 + " NetWrite: (ftp + machine, id, passwd, filename) NetWrite Method #3 {{{3 elseif b:netrw_method == 3 - " Construct execution string (four lines) which will be passed through filter + " Construct execution string (three or more lines) which will be passed through filter " call Decho("read via ftp+mipf (method #3)") - let netrw_fname= b:netrw_fname - new + let netrw_fname = b:netrw_fname + let bhkeep = &l:bh + + " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead + let curbuf = bufnr("%") + setlocal bh=hide + enew setlocal ff=unix + if exists("g:netrw_port") && g:netrw_port != "" put ='open '.g:netrw_machine.' '.g:netrw_port " call Decho("filter input: ".getline('.')) @@ -1199,6 +1133,12 @@ fun! netrw#NetWrite(...) range else put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' " call Decho("filter input: ".getline('.')) + endif + put =g:netrw_ftpmode +" call Decho("filter input: ".getline('$')) + if exists("g:netrw_ftpextracmd") + put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline("$")) endif put ='put \"'.tmpfile.'\" \"'.netrw_fname.'\"' " call Decho("filter input: ".getline('.')) @@ -1219,10 +1159,15 @@ fun! netrw#NetWrite(...) range endif let mod=1 endif - bd! + + " remove enew buffer (quietly) + let filtbuf= bufnr("%") + exe curbuf."b!" + let &l:bh= bhkeep + exe filtbuf."bw!" "......................................... - " scp: NetWrite Method #4 {{{4 + " NetWrite: (scp) NetWrite Method #4 {{{3 elseif b:netrw_method == 4 " call Decho("write via scp (method #4)") if exists("g:netrw_port") && g:netrw_port != "" @@ -1235,7 +1180,7 @@ fun! netrw#NetWrite(...) range let b:netrw_lastfile = choice "......................................... - " http: NetWrite Method #5 {{{4 + " NetWrite: (http) NetWrite Method #5 {{{3 elseif b:netrw_method == 5 " call Decho("write via http (method #5)") if !exists("g:netrw_quiet") @@ -1243,13 +1188,19 @@ fun! netrw#NetWrite(...) range endif "......................................... - " dav: NetWrite Method #6 (cadaver) {{{4 + " NetWrite: (dav) NetWrite Method #6 (cadaver) {{{3 elseif b:netrw_method == 6 " call Decho("write via cadaver (method #6)") " Construct execution string (four lines) which will be passed through filter - let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) - new + let netrw_fname = escape(b:netrw_fname,g:netrw_fname_escape) + let bhkeep = &l:bh + + " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead + let curbuf = bufnr("%") + setlocal bh=hide + enew + setlocal ff=unix if exists("g:netrw_port") && g:netrw_port != "" put ='open '.g:netrw_machine.' '.g:netrw_port @@ -1265,11 +1216,17 @@ fun! netrw#NetWrite(...) range norm! 1Gdd " call Decho("executing: %!".g:netrw_dav_cmd) exe s:netrw_silentxfer."%!".g:netrw_dav_cmd - bd! + + " remove enew buffer (quietly) + let filtbuf= bufnr("%") + exe curbuf."b!" + let &l:bh = bhkeep + exe filtbuf."bw!" + let b:netrw_lastfile = choice "......................................... - " rsync: NetWrite Method #7 {{{4 + " NetWrite: (rsync) NetWrite Method #7 {{{3 elseif b:netrw_method == 7 " call Decho("write via rsync (method #7)") " call Decho("executing: !".g:netrw_rsync_cmd." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)) @@ -1277,7 +1234,7 @@ fun! netrw#NetWrite(...) range let b:netrw_lastfile = choice "......................................... - " sftp: NetWrite Method #9 {{{4 + " NetWrite: (sftp) NetWrite Method #9 {{{3 elseif b:netrw_method == 9 " call Decho("read via sftp (method #9)") let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) @@ -1286,24 +1243,32 @@ fun! netrw#NetWrite(...) range else let uid_machine = g:netrw_machine endif - new + + " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead + let bhkeep = &l:bh + let curbuf = bufnr("%") + setlocal bh=hide + enew + setlocal ff=unix - put ='put \"'.escape(tmpfile,'\').'\" '.netrw_fname + call setline(1,'put "'.escape(tmpfile,'\').'" '.netrw_fname) " call Decho("filter input: ".getline('.')) - norm! 1Gdd " call Decho("executing: %!".g:netrw_sftp_cmd.' '.shellescape(uid_machine,1)) exe s:netrw_silentxfer."%!".g:netrw_sftp_cmd.' '.shellescape(uid_machine,1) - bd! - let b:netrw_lastfile= choice + let filtbuf= bufnr("%") + exe curbuf."b!" + let &l:bh = bhkeep + exe filtbuf."bw!" + let b:netrw_lastfile = choice "......................................... - " Complain {{{4 + " NetWrite: Complain {{{3 else call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",17) endif endwhile - " Cleanup: {{{3 + " NetWrite: Cleanup: {{{3 " call Decho("cleanup") if s:FileReadable(tmpfile) " call Decho("tmpfile<".tmpfile."> readable, will now delete it") @@ -1316,6 +1281,7 @@ fun! netrw#NetWrite(...) range let &mod= mod endif + " restore equalalways " call Dret("netrw#NetWrite") endfun @@ -1417,11 +1383,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method) " rename buffer back to remote filename " call Decho("exe silent! keepalt file ".fnameescape(rfile)) exe "silent! keepalt file ".fnameescape(rfile) - if a:method == 5 - set ft=html - else - filetype detect - endif + filetype detect " call Dredir("renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">","ls!") let line1 = 1 let line2 = line("$") @@ -1453,7 +1415,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method) " call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")") endif - if has("gui") && has("menu") && has("gui_running") && &go =~ 'm' + if has("gui") && has("menu") && has("gui_running") && &go =~ 'm' && g:netrw_menu " update the Buffers menu call s:UpdateBuffersMenu() endif @@ -1708,6 +1670,7 @@ if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp let fourblanklines= line2 - 3 if fourblanklines >= line1 exe "silent ".fourblanklines.",".line2."g/^\s*$/d" + call histdel("/",-1) endif endif @@ -1777,10 +1740,12 @@ fun! s:BrowserMaps(islocal) nnoremap mz :call NetrwMarkFileCompress(1) nnoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) nnoremap gh :call NetrwHidden(1) + nnoremap gp :call NetrwChgPerm(1,b:netrw_curdir) nnoremap c :exe "keepjumps lcd ".fnameescape(b:netrw_curdir) nnoremap C :let g:netrw_chgwin= winnr() nnoremap d :call NetrwMakeDir("") nnoremap i :call NetrwListStyle(1) + nnoremap I :call NetrwBannerCtrl(1) nnoremap o :call NetrwSplit(3) nnoremap O :call NetrwObtain(1) nnoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) @@ -1792,6 +1757,7 @@ fun! s:BrowserMaps(islocal) nnoremap s :call NetrwSortStyle(1) nnoremap S :call NetSortSequence(1) nnoremap t :call NetrwSplit(4) + nnoremap T :call NetrwSplit(4)norm! gT nnoremap u :call NetrwBookHistHandler(4,expand("%")) nnoremap U :call NetrwBookHistHandler(5,expand("%")) nnoremap v :call NetrwSplit(5) @@ -1853,8 +1819,10 @@ fun! s:BrowserMaps(islocal) nnoremap mz :call NetrwMarkFileCompress(0) nnoremap gb :call NetrwBookHistHandler(1,b:netrw_cur) nnoremap gh :call NetrwHidden(0) + nnoremap gp :call NetrwChgPerm(0,b:netrw_curdir) nnoremap C :let g:netrw_chgwin= winnr() nnoremap i :call NetrwListStyle(0) + nnoremap I :call NetrwBannerCtrl(1) nnoremap o :call NetrwSplit(0) nnoremap O :call NetrwObtain(0) nnoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) @@ -1866,6 +1834,7 @@ fun! s:BrowserMaps(islocal) nnoremap s :call NetrwSortStyle(0) nnoremap S :call NetSortSequence(0) nnoremap t :call NetrwSplit(1) + nnoremap T :call NetrwSplit(1)norm! gT nnoremap u :call NetrwBookHistHandler(4,b:netrw_curdir) nnoremap U :call NetrwBookHistHandler(5,b:netrw_curdir) nnoremap v :call NetrwSplit(2) @@ -2064,12 +2033,13 @@ endfun fun! s:NetrwBookHistRead() " call Dfunc("s:NetrwBookHistRead()") if !exists("s:netrw_initbookhist") - let savefile= s:NetrwHome()."/.netrwbook" + let home = s:NetrwHome() + let savefile= home."/.netrwbook" if filereadable(savefile) " call Decho("sourcing .netrwbook") exe "so ".savefile endif - let savefile= s:NetrwHome()."/.netrwhist" + let savefile= home."/.netrwhist" if filereadable(savefile) " call Decho("sourcing .netrwhist") exe "so ".savefile @@ -2090,11 +2060,15 @@ fun! s:NetrwBookHistSave() " call Dfunc("s:NetrwBookHistSave() dirhistmax=".g:netrw_dirhistmax) let savefile= s:NetrwHome()."/.netrwhist" 1split - enew - setlocal noswf + call s:NetrwEnew() + setlocal cino= com= cpo-=aA fo=nroql2 tw=0 report=10000 noswf + setlocal nocin noai noci magic nospell nohid wig= noaw + setlocal ma noro write + if exists("&acd") | setlocal noacd | endif + silent %d " save .netrwhist -- no attempt to merge - file .netrwhist + silent! file .netrwhist call setline(1,"let g:netrw_dirhistmax =".g:netrw_dirhistmax) call setline(2,"let g:netrw_dirhist_cnt =".g:netrw_dirhist_cnt) let lastline = line("$") @@ -2104,8 +2078,8 @@ fun! s:NetrwBookHistSave() let cnt= cnt + 1 endwhile exe "silent! w! ".savefile - %d + silent %d if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] " merge and write .netrwbook let savefile= s:NetrwHome()."/.netrwbook" @@ -2146,6 +2120,15 @@ fun! s:NetrwBrowse(islocal,dirname) if !exists("s:netrw_initbookhist") call s:NetrwBookHistRead() endif +" call FOTEST(7) + + " simplify the dirname (especially for ".."s in dirnames) + if a:dirname !~ '^\a\+://' + let dirname= simplify(a:dirname) + else + let dirname= a:dirname + endif +" call FOTEST(8) if exists("s:netrw_skipbrowse") unlet s:netrw_skipbrowse @@ -2165,37 +2148,40 @@ fun! s:NetrwBrowse(islocal,dirname) endif call s:NetrwOptionSave("w:") - call s:NetrwSafeOptions() +" call FOTEST(9) " re-instate any marked files if exists("s:netrwmarkfilelist_{bufnr('%')}") " call Decho("clearing marked files") exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" endif +" call FOTEST(10) if a:islocal && exists("w:netrw_acdkeep") && w:netrw_acdkeep " call Decho("handle w:netrw_acdkeep:") -" call Decho("keepjumps lcd ".fnameescape(a:dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")") - exe 'keepjumps lcd '.fnameescape(a:dirname) +" call Decho("keepjumps lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")") + exe 'keepjumps lcd '.fnameescape(dirname) + call s:NetrwSafeOptions() " call Decho("getcwd<".getcwd().">") - elseif !a:islocal && a:dirname !~ '[\/]$' && a:dirname !~ '^"' + elseif !a:islocal && dirname !~ '[\/]$' && dirname !~ '^"' " looks like a regular file, attempt transfer -" call Decho("attempt transfer as regular file<".a:dirname.">") +" call Decho("attempt transfer as regular file<".dirname.">") " remove any filetype indicator from end of dirname, except for the {{{3 " "this is a directory" indicator (/). " There shouldn't be one of those here, anyway. - let path= substitute(a:dirname,'[*=@|]\r\=$','','e') + let path= substitute(dirname,'[*=@|]\r\=$','','e') " call Decho("new path<".path.">") - call s:RemotePathAnalysis(a:dirname) + call s:RemotePathAnalysis(dirname) " remote-read the requested file into current buffer {{{3 mark ' - call s:NetrwEnew(a:dirname) + call s:NetrwEnew(dirname) + call s:NetrwSafeOptions() setlocal ma noro " call Decho("setlocal ma noro") - let b:netrw_curdir= a:dirname + let b:netrw_curdir= dirname " call Decho("exe silent! keepalt file ".fnameescape(s:method."://".s:user.s:machine."/".s:path)." (bt=".&bt.")") exe "silent! keepalt file ".fnameescape(s:method."://".s:user.s:machine."/".s:path) exe "silent keepalt doau BufReadPre ".fnameescape(s:fname) @@ -2214,17 +2200,19 @@ fun! s:NetrwBrowse(islocal,dirname) " call Dret("s:NetrwBrowse : file<".s:fname.">") return endif +" call FOTEST(11) " use buffer-oriented WinVars if buffer ones exist but window ones don't {{{3 call s:UseBufWinVars() " set up some variables {{{3 let b:netrw_browser_active = 1 - let dirname = a:dirname + let dirname = dirname let s:last_sort_by = g:netrw_sort_by " set up menu {{{3 call s:NetrwMenu(1) +" call FOTEST(12) " set up buffer {{{3 let reusing= s:NetrwGetBuffer(a:islocal,dirname) @@ -2244,6 +2232,7 @@ fun! s:NetrwBrowse(islocal,dirname) " call Dret("s:NetrwBrowse : re-using buffer") return endif +"" call FOTEST(13) " PROBLEM WITH LISTING " set b:netrw_curdir to the new directory name {{{3 " call Decho("set b:netrw_curdir to the new directory name:") @@ -2265,6 +2254,7 @@ fun! s:NetrwBrowse(islocal,dirname) let b:netrw_curdir= b:netrw_curdir.'/' endif " call Decho("b:netrw_curdir<".b:netrw_curdir.">") +"" call FOTEST(14) " PROBLEM WITH LISTING " ------------ " (local only) {{{3 @@ -2305,11 +2295,11 @@ fun! s:NetrwBrowse(islocal,dirname) else " call Decho("remote only:") - " analyze a:dirname and g:netrw_list_cmd {{{4 -" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> a:dirname<".a:dirname.">") - if a:dirname =~ "^NetrwTreeListing\>" + " analyze dirname and g:netrw_list_cmd {{{4 +" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> dirname<".dirname.">") + if dirname =~ "^NetrwTreeListing\>" let dirname= b:netrw_curdir -" call Decho("(dirname was ".a:dirname.") dirname<".dirname.">") +" call Decho("(dirname was ".dirname.") dirname<".dirname.">") elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") let dirname= substitute(b:netrw_curdir,'\\','/','g') if dirname !~ '/$' @@ -2318,7 +2308,7 @@ fun! s:NetrwBrowse(islocal,dirname) let b:netrw_curdir = dirname " call Decho("(liststyle is TREELIST) dirname<".dirname.">") else - let dirname = substitute(a:dirname,'\\','/','g') + let dirname = substitute(dirname,'\\','/','g') " call Decho("(normal) dirname<".dirname.">") endif @@ -2336,12 +2326,15 @@ fun! s:NetrwBrowse(islocal,dirname) let b:netrw_curdir= dirname " call Decho("b:netrw_curdir<".b:netrw_curdir."> (remote)") endif " (additional remote handling) +"" call FOTEST(15) " PROBLEM WITH LISTING " ----------------------- " Directory Listing: {{{3 " ----------------------- call s:BrowserMaps(a:islocal) +"" call FOTEST(16) " PROBLEM WITH LISTING call s:PerformListing(a:islocal) +" call FOTEST(17) " The s:LocalBrowseShellCmdRefresh() function is called by an autocmd " installed by s:LocalFastBrowser() when g:netrw_fastbrowse <= 1 (ie. slow, medium speed). @@ -2404,6 +2397,7 @@ fun! s:NetrwGetBuffer(islocal,dirname) " call Decho("--re-use a buffer if possible--") if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST " find NetrwTreeList buffer if there is one +" call Decho("find NetrwTreeList buffer if there is one") if exists("w:netrw_treebufnr") && w:netrw_treebufnr > 0 " call Decho(" re-use w:netrw_treebufnr=".w:netrw_treebufnr) let eikeep= &ei @@ -2427,7 +2421,7 @@ fun! s:NetrwGetBuffer(islocal,dirname) " call Decho(" bufnr(dirname<".escape(dirname,'\').">)=".bufnum) if bufnum < 0 && dirname !~ '/$' - " trying appending a trailing / + " try appending a trailing / " call Decho(" try appending a trailing / to dirname<".dirname.">") let bufnum= bufnr(escape(dirname.'/','\')) if bufnum > 0 @@ -2436,7 +2430,7 @@ fun! s:NetrwGetBuffer(islocal,dirname) endif if bufnum < 0 && dirname =~ '/$' - " trying removing a trailing / + " try removing a trailing / " call Decho(" try removing a trailing / from dirname<".dirname.">") let bufnum= bufnr(escape(substitute(dirname,'/$','',''),'\')) if bufnum > 0 @@ -2448,17 +2442,26 @@ fun! s:NetrwGetBuffer(islocal,dirname) " note: !~ was used just below, but that means using ../ to go back would match (ie. abc/def/ and abc/ matches) if bufnum > 0 && bufname(bufnum) != dirname && bufname(bufnum) != '.' " handle approximate matches -" call Decho(" handling approx match: bufnum#%d<".bufname(bufnum)."> approx=dirname<".dirname.">") +" call Decho(" handling approx match: bufnum#".bufnum."<".bufname(bufnum)."> approx-dirname<".dirname.">") let ibuf = 1 let buflast = bufnr("$") " call Decho(" findbuf2: buflast=".buflast) while ibuf <= buflast let bname= substitute(bufname(ibuf),'\\','/','g') let bname= substitute(bname,'.\zs/$','','') -" call Decho(" findbuf3: dirname<".dirname."> bufname(".ibuf.")<".bname.">") - if bname != '' && dirname =~ '/'.bname.'/\=$' | break | endif - if bname =~ '^'.dirname.'/\=$' | break | endif - if dirname =~ '^'.bname.'/$' | break | endif +" call Decho(" findbuf3: while [ibuf=",ibuf."]<=[buflast=".buflast."]: dirname<".dirname."> bufname(".ibuf.")<".bname.">") + if bname != '' && dirname =~ '/'.bname.'/\=$' && dirname !~ '^/' +" call Decho(" findbuf3: passes test 1 : dirname<".dirname.'> =~ /'.bname.'/\=$ && dirname !~ ^/') + break + endif + if bname =~ '^'.dirname.'/\=$' +" call Decho(' findbuf3: passes test 2 : bname<'.bname.'>=~^'.dirname.'/\=$') + break + endif + if dirname =~ '^'.bname.'/$' +" call Decho(' findbuf3: passes test 3 : dirname<'.dirname.'>=~^'.bname.'/$') + break + endif let ibuf= ibuf + 1 endwhile if ibuf > buflast @@ -2640,6 +2643,7 @@ fun! s:NetrwGetWord() if !exists("b:netrw_cpf") let b:netrw_cpf= 0 exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' + call histdel("/",-1) " call Decho("computed cpf=".b:netrw_cpf) endif @@ -2779,6 +2783,29 @@ fun! s:NetrwListStyle(islocal) " call Dret("NetrwListStyle".(exists("w:netrw_liststyle")? ' : w:netrw_liststyle='.w:netrw_liststyle : "")) endfun +" --------------------------------------------------------------------- +" s:NetrwBannerCtrl: toggles the display of the banner {{{2 +fun! s:NetrwBannerCtrl(islocal) +" call Dfunc("s:NetrwBannerCtrl(islocal=".a:islocal.") g:netrw_banner=".g:netrw_banner) + + " toggle the banner (enable/suppress) + let g:netrw_banner= !g:netrw_banner + + " refresh the listing + let svpos= netrw#NetrwSavePosn() + call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + + " keep cursor on the filename + let fname= s:NetrwGetWord() + silent keepjumps $ + let result= search('\%(^\%(|\+\s\)\=\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bc') +" call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A')) + if result <= 0 && exists("w:netrw_bannercnt") + exe "keepjumps ".w:netrw_bannercnt + endif +" call Dret("s:NetrwBannerCtrl : g:netrw_banner=".g:netrw_banner) +endfun + " --------------------------------------------------------------------- " s:NetrwBookmarkMenu: Uses menu priorities {{{2 " .2.[cnt] for bookmarks, and @@ -2859,6 +2886,19 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) return endif + " check if the status bar was clicked on instead of a file/directory name + call feedkeys("\") + let c= getchar() + let mouse_lnum = v:mouse_lnum + let wlastline = line('w$') + let lastline = line('$') +" call Decho("v:mouse_lnum=".mouse_lnum." line(w$)=".wlastline." line($)=".lastline) + if mouse_lnum == wlastline + 1 +" call Decho("appears to be a status bar leftmouse click") + " appears to be a status bar leftmouse click + return + endif + call s:NetrwOptionSave("s:") call s:NetrwSafeOptions() let nbcd_curpos = netrw#NetrwSavePosn() @@ -2894,6 +2934,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) else let dirname= s:NetrwTreeDir()."/".newdir endif +" call Decho("dirname<".dirname.">") " call Decho("tree listing") elseif newdir =~ '^\(/\|\a:\)' let dirname= newdir @@ -2908,10 +2949,14 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) if !exists("s:didsplit") if g:netrw_browse_split == 1 new - wincmd _ + if !&ea + wincmd _ + endif elseif g:netrw_browse_split == 2 rightb vert new - wincmd | + if !&ea + wincmd | + endif elseif g:netrw_browse_split == 3 tabnew elseif g:netrw_browse_split == 4 @@ -2938,6 +2983,22 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Decho("remote file: NetrwBrowse will edit it") endif let dolockout= 1 + + " handle g:Netrw_funcref -- call external-to-netrw functions + " This code will handle g:Netrw_funcref as an individual function reference + " or as a list of function references. It will ignore anything that's not + " a function reference. See :help Funcref for information about function references. + if exists("g:Netrw_funcref") + if type(g:Netrw_funcref) == 2 + call g:Netrw_funcref() + elseif type(g:Netrw_funcref) == 3 + for Fncref in g:Netrw_funcref + if type(FncRef) == 2 + call FncRef() + endif + endfor + endif + endif endif elseif newdir =~ '^/' @@ -3044,15 +3105,16 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " close tree listing for selected subdirectory " call Decho("closing selected subdirectory<".dirname.">") call remove(w:netrw_treedict,treedir) -" call Decho("removed entry<".dirname."> from treedict") +" call Decho("removed entry<".treedir."> from treedict") " call Decho("yielding treedict<".string(w:netrw_treedict).">") - let dirname= w:netrw_treetop + let dirname = w:netrw_treetop else " go down one directory let dirname= substitute(treedir,'/*$','/','') " call Decho("go down one dir: treedir<".treedir.">") endif call s:SetRexDir(a:islocal,dirname) + let s:treeforceredraw = 1 else " go down one directory @@ -3073,11 +3135,33 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) endfun " --------------------------------------------------------------------- -" s:NetrwBrowseX: allows users to write custom functions to operate on {{{2 -" files given their extension. Passes 0=local, 1=remote +" s:NetrwBrowseX: (implements "x") executes a special "viewer" script or program for the {{{2 +" given filename; typically this means given their extension. +" 0=local, 1=remote fun! netrw#NetrwBrowseX(fname,remote) " call Dfunc("NetrwBrowseX(fname<".a:fname."> remote=".a:remote.")") + " special core dump handler + if a:fname =~ '/core\(\.\d\+\)\=$' + if exists("g:Netrw_corehandler") + if type(g:Netrw_corehandler) == 2 + " g:Netrw_corehandler is a function reference (see :help Funcref) +" call Decho("g:Netrw_corehandler is a funcref") + call g:Netrw_corehandler(a:fname) + elseif type(g:netrw_corehandler) == 3) + " g:Netrw_corehandler is a List of function references (see :help Funcref) +" call Decho("g:Netrw_corehandler is a List") + for Fncref in g:Netrw_corehandler + if type(FncRef) == 2 + call FncRef(a:fname) + endif + endfor + endif +" call Dret("NetrwBrowseX : coredump handler invoked") + return + endif + endif + " set up the filename " (lower case the extension, make a local copy of a remote file) let exten= substitute(a:fname,'.*\.\(.\{-}\)','\1','e') @@ -3140,6 +3224,7 @@ fun! netrw#NetrwBrowseX(fname,remote) " extract any viewing options. Assumes that they're set apart by quotes. if exists("g:netrw_browsex_viewer") +" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") if g:netrw_browsex_viewer =~ '\s' let viewer = substitute(g:netrw_browsex_viewer,'\s.*$','','') let viewopt = substitute(g:netrw_browsex_viewer,'^\S\+\s*','','')." " @@ -3171,8 +3256,15 @@ fun! netrw#NetrwBrowseX(fname,remote) let ret= v:shell_error elseif has("win32") || has("win64") -" call Decho('exe silent !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)) - exe 'silent !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1) + if executable("start") +" call Decho('exe silent !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)) + exe 'silent !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1) + elseif executable("rundll32") +" call Decho('exe silent !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)) + exe 'silent !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1) + else + call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) + endif call inputsave()|call input("Press to continue")|call inputrestore() let ret= v:shell_error @@ -3226,6 +3318,46 @@ fun! netrw#NetrwBrowseX(fname,remote) " call Dret("NetrwBrowseX") endfun +" --------------------------------------------------------------------- +" s:NetrwChgPerm: (implements "gp") change file permission {{{2 +fun! s:NetrwChgPerm(islocal,curdir) +" call Dfunc("s:NetrwChgPerm(islocal=".a:islocal." curdir<".a:curdir.">)") + call inputsave() + let newperm= input("Enter new permission: ") + call inputrestore() + let chgperm= substitute(g:netrw_chgperm,'\',shellescape(expand("")),'') + let chgperm= substitute(chgperm,'\',shellescape(newperm),'') +" call Decho("chgperm<".chgperm.">") + call system(chgperm) + if v:shell_error != 0 + call netrw#ErrorMsg(1,"changing permission on file<".expand("")."> seems to have failed",75) + endif + if a:islocal + call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + endif +" call Dret("s:NetrwChgPerm") +endfun + +" --------------------------------------------------------------------- +" s:NetrwClearExplore: clear explore variables (if any) {{{2 +fun! s:NetrwClearExplore() +" call Dfunc("s:NetrwClearExplore()") + 2match none + if exists("s:explore_match") |unlet s:explore_match |endif + if exists("s:explore_indx") |unlet s:explore_indx |endif + if exists("s:netrw_explore_prvdir") |unlet s:netrw_explore_prvdir |endif + if exists("s:dirstarstar") |unlet s:dirstarstar |endif + if exists("s:explore_prvdir") |unlet s:explore_prvdir |endif + if exists("w:netrw_explore_indx") |unlet w:netrw_explore_indx |endif + if exists("w:netrw_explore_listlen")|unlet w:netrw_explore_listlen|endif + if exists("w:netrw_explore_list") |unlet w:netrw_explore_list |endif + if exists("w:netrw_explore_bufnr") |unlet w:netrw_explore_bufnr |endif +" redraw! + echo " " + echo " " +" call Dret("s:NetrwClearExplore") +endfun + " --------------------------------------------------------------------- " netrw#Explore: launch the local browser in the directory of the current file {{{2 " indx: == -1: Nexplore @@ -3243,15 +3375,16 @@ endfun " == 2: Hexplore style == 3: Hexplore! " == 4: Vexplore style == 5: Vexplore! " == 6: Texplore -"DechoTabOn fun! netrw#Explore(indx,dosplit,style,...) " call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." a:0=".a:0) if !exists("b:netrw_curdir") let b:netrw_curdir= getcwd() " call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)") endif - let curfile= b:netrw_curdir -" call Decho("curfile<".curfile.">") + let curdir = b:netrw_curdir + let curfiledir = substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e') +" call Decho("curdir<".curdir."> curfiledir<".curfiledir.">") +" call FOTEST(1) " save registers silent! let keepregstar = @* @@ -3300,6 +3433,7 @@ fun! netrw#Explore(indx,dosplit,style,...) call s:RestoreWinVars() endif norm! 0 +" call FOTEST(2) if a:0 > 0 " call Decho("case [a:0=".a:0."]>0: a:1<".a:1.">") @@ -3314,28 +3448,18 @@ fun! netrw#Explore(indx,dosplit,style,...) " call Decho("using dirname<".dirname."> (case: ".(exists("b:netrw_curdir")? "b:netrw_curdir" : "getcwd()").")") elseif a:1 =~ '\$' let dirname= expand(a:1) +" call Decho("using user-specified dirname<".dirname."> with $env-var") else let dirname= a:1 -" call Decho("using dirname<".dirname.">") +" call Decho("using user-specified dirname<".dirname.">") endif else " clear explore -" call Decho("clearing explore variables") - 2match none - if exists("s:explore_match") |unlet s:explore_match |endif - if exists("s:explore_indx") |unlet s:explore_indx |endif - if exists("s:dirstarstar") |unlet s:dirstarstar |endif - if exists("s:dirstarstar") |unlet s:dirstarstar |endif - if exists("w:netrw_explore_indx") |unlet w:netrw_explore_indx |endif - if exists("w:netrw_explore_listlen")|unlet w:netrw_explore_listlen|endif - if exists("w:netrw_explore_list") |unlet w:netrw_explore_list |endif - if exists("w:netrw_explore_bufnr") |unlet w:netrw_explore_bufnr |endif -" redraw! - echo " " - echo " " + call s:NetrwClearExplore() " call Dret("netrw#Explore : cleared list") return endif +" call FOTEST(3) if dirname =~ '/\*\*/' " handle .../**/.../filepat @@ -3375,15 +3499,19 @@ fun! netrw#Explore(indx,dosplit,style,...) " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) let starpat= 4 " call Decho("case Explore **/filepat (starpat=".starpat.")") + else let starpat= 0 +" call Decho("default case: starpat=".starpat) endif +" call FOTEST(4) if starpat == 0 && a:indx >= 0 " [Explore Hexplore Vexplore Sexplore] [dirname] -" call Decho("case dirname<".dirname."> a:indx=".a:indx.": Explore Hexplore Vexplore Sexplore") +" call Decho("case starpat==0 && a:indx=".a:indx.": dirname<".dirname."> Explore Hexplore Vexplore Sexplore") if dirname == "" - let dirname= substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e') + let dirname= curfiledir +" call Decho("empty dirname, using current file's directory<".dirname.">") endif if dirname =~ '^scp:' || dirname =~ '^ftp:' " call Decho("calling NetrwBrowse(0,dirname<".dirname.">)") @@ -3394,11 +3522,11 @@ fun! netrw#Explore(indx,dosplit,style,...) call netrw#LocalBrowseCheck(dirname) endif -" call Decho("curfile<".curfile.">") +" call Decho("curdir<".curdir.">") if has("win32") || has("win95") || has("win64") || has("win16") - call search('\<'.substitute(curfile,'^.*[/\\]','','e').'\>','cW') + call search('\<'.substitute(curdir,'^.*[/\\]','','e').'\>','cW') else - call search('\<'.substitute(curfile,'^.*/','','e').'\>','cW') + call search('\<'.substitute(curdir,'^.*/','','e').'\>','cW') endif " starpat=1: Explore *//pattern (current directory only search for files containing pattern) @@ -3407,7 +3535,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) elseif a:indx <= 0 " Nexplore, Pexplore, Explore: handle starpat -" call Decho("case Nexplore, Pexplore, , : starpat=".starpat." a:indx=".a:indx) +" call Decho("case a:indx<=0: Nexplore, Pexplore, , starpat=".starpat." a:indx=".a:indx) if !mapcheck("","n") && !mapcheck("","n") && exists("b:netrw_curdir") " call Decho("set up and maps") let s:didstarstar= 1 @@ -3474,6 +3602,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " Explore -- initialize " build list of files to Explore with Nexplore/Pexplore " call Decho("starpat=".starpat.": case Explore: initialize (indx=".indx.")") + call s:NetrwClearExplore() let w:netrw_explore_indx= 0 if !exists("b:netrw_curdir") let b:netrw_curdir= getcwd() @@ -3485,17 +3614,23 @@ fun! netrw#Explore(indx,dosplit,style,...) " starpat=1: Explore *//pattern (current directory only search for files containing pattern) " call Decho("starpat=".starpat.": build *//pattern list") " call Decho("pattern<".pattern.">") - exe "vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*" - let w:netrw_explore_list = map(getqflist(),'bufname(v:val.bufnr)') + try + exe "noautocmd vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*" + catch /^Vim\%((\a\+)\)\=:E480/ + call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76) +" call Dret("netrw#Explore : unable to find pattern<".pattern.">") + return + endtry + let w:netrw_explore_list = s:NetrwExploreListUniq(map(getqflist(),'bufname(v:val.bufnr)')) if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif elseif starpat == 2 " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) " call Decho("starpat=".starpat.": build **//pattern list") try - exe "silent vimgrep /".pattern."/gj "."**/*" + exe "silent noautocmd vimgrep /".pattern."/gj "."**/*" catch /^Vim\%((\a\+)\)\=:E480/ - call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45) + call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45) if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif silent! let @* = keepregstar silent! let @+ = keepregstar @@ -3505,7 +3640,7 @@ fun! netrw#Explore(indx,dosplit,style,...) endtry let s:netrw_curdir = b:netrw_curdir let w:netrw_explore_list = getqflist() - let w:netrw_explore_list = map(w:netrw_explore_list,'s:netrw_curdir."/".bufname(v:val.bufnr)') + let w:netrw_explore_list = s:NetrwExploreListUniq(map(w:netrw_explore_list,'s:netrw_curdir."/".bufname(v:val.bufnr)')) elseif starpat == 3 " starpat=3: Explore */filepat (search in current directory for filenames matching filepat) @@ -3514,13 +3649,13 @@ fun! netrw#Explore(indx,dosplit,style,...) let filepat= substitute(filepat,'^[%#<]','\\&','') " call Decho("b:netrw_curdir<".b:netrw_curdir.">") " call Decho("filepat<".filepat.">") - let w:netrw_explore_list= split(expand(b:netrw_curdir."/".filepat),'\n') + let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".filepat),'\n')) if &hls | let keepregslash= s:ExplorePatHls(filepat) | endif elseif starpat == 4 " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) " call Decho("starpat=".starpat.": build **/filepat list") - let w:netrw_explore_list= split(expand(b:netrw_curdir."/".dirname),'\n') + let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".dirname),'\n')) if &hls | let keepregslash= s:ExplorePatHls(dirname) | endif endif " switch on starpat to build w:netrw_explore_list @@ -3540,7 +3675,7 @@ fun! netrw#Explore(indx,dosplit,style,...) " NetrwStatusLine support - for exploring support let w:netrw_explore_indx= indx -" call Decho("explorelist<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen) +" call Decho("w:netrw_explore_list<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen) " wrap the indx around, but issue a note if indx >= w:netrw_explore_listlen || indx < 0 @@ -3584,7 +3719,7 @@ fun! netrw#Explore(indx,dosplit,style,...) endif else -" call Decho("case Explore newdir<".dirname.">") +" call Decho("default case: Explore newdir<".dirname.">") if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && dirname =~ '/' silent! unlet w:netrw_treedict silent! unlet w:netrw_treetop @@ -3596,21 +3731,25 @@ fun! netrw#Explore(indx,dosplit,style,...) call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,newdir)) endif endif +" call FOTEST(5) " visual display of **/ **// */ Exploration files +" call Decho("w:netrw_explore_indx=".(exists("w:netrw_explore_indx")? w:netrw_explore_indx : "doesn't exist")) +" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "n/a").">") if exists("w:netrw_explore_indx") && exists("b:netrw_curdir") +" call Decho("s:explore_prvdir<".(exists("s:explore_prvdir")? s:explore_prvdir : "-doesn't exist-")) if !exists("s:explore_prvdir") || s:explore_prvdir != b:netrw_curdir " only update match list if current directory isn't the same as before +" call Decho("only update match list if current directory not the same as before") let s:explore_prvdir = b:netrw_curdir let s:explore_match = "" - let dirlen = strlen(b:netrw_curdir) + let dirlen = s:Strlen(b:netrw_curdir) if b:netrw_curdir !~ '/$' let dirlen= dirlen + 1 endif let prvfname= "" for fname in w:netrw_explore_list " call Decho("fname<".fname.">") -"COMBAK -- g:netrw_markfileesc."'".g:netrw_markfileesc."'" ??? if fname =~ '^'.b:netrw_curdir if s:explore_match == "" let s:explore_match= '\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>' @@ -3637,6 +3776,7 @@ fun! netrw#Explore(indx,dosplit,style,...) echo " " " call Decho("cleared explore match list") endif +" call FOTEST(6) silent! let @* = keepregstar silent! let @+ = keepregstar @@ -3644,6 +3784,24 @@ fun! netrw#Explore(indx,dosplit,style,...) " call Dret("netrw#Explore : @/<".@/.">") endfun +" --------------------------------------------------------------------- +" s:NetrwExploreListUniq: {{{2 +fun! s:NetrwExploreListUniq(explist) +" call Dfunc("s:NetrwExploreListUniq(explist)") + + " this assumes that the list is already sorted + let newexplist= [] + for member in a:explist + if !exists("uniqmember") || member != uniqmember + let uniqmember = member + let newexplist = newexplist + [ member ] + endif + endfor + +" call Dret("s:NetrwExploreListUniq") + return newexplist +endfun + " --------------------------------------------------------------------- " s:NetrwHide: this function is invoked by the "a" map for browsing {{{2 " and switches the hiding mode. The actual hiding is done by @@ -3708,7 +3866,7 @@ fun! s:NetrwHidden(islocal) if g:netrw_list_hide =~ '\(^\|,\)\\(^\\|\\s\\s\\)\\zs\\.\\S\\+' " remove pattern from hiding list let g:netrw_list_hide= substitute(g:netrw_list_hide,'\(^\|,\)\\(^\\|\\s\\s\\)\\zs\\.\\S\\+','','') - elseif strlen(g:netrw_list_hide) >= 1 + elseif s:Strlen(g:netrw_list_hide) >= 1 let g:netrw_list_hide= g:netrw_list_hide . ',\(^\|\s\s\)\zs\.\S\+' else let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+' @@ -3723,7 +3881,6 @@ endfun " --------------------------------------------------------------------- " s:NetrwHome: this function determines a "home" for saving bookmarks and history {{{2 fun! s:NetrwHome() -" call Dfunc("s:NetrwHome()") if exists("g:netrw_home") let home= g:netrw_home else @@ -3738,7 +3895,6 @@ fun! s:NetrwHome() endfor if home == "" " just pick the first directory -" call Decho("just pick first directory in &rtp") let home= substitute(&rtp,',.*$','','') endif if (has("win32") || has("win95") || has("win64") || has("win16")) @@ -3746,19 +3902,14 @@ fun! s:NetrwHome() endif endif " insure that the home directory exists -" call Decho("picked home<".home.">") if !isdirectory(home) if exists("g:netrw_mkdir") -" call Decho("home<".home."> isn't a directory -- making it now with g:netrw_mkdir<".g:netrw_mkdir.">") -" call Decho("system(".g:netrw_mkdir." ".s:Escape(home).")") - call system(g:netrw_mkdir." ".s:Escape(home)) + call system(g:netrw_mkdir." ".shellescape(home)) else -" call Decho("home<".home."> isn't a directory -- making it now with mkdir()") call mkdir(home) endif endif let g:netrw_home= home -" call Dret("s:NetrwHome <".home.">") return home endfun @@ -3977,6 +4128,7 @@ fun! s:NetrwMarkFile(islocal,fname) " call Dfunc("s:NetrwMarkFile(islocal=".a:islocal." fname<".a:fname.">)") let curbufnr= bufnr("%") let curdir = b:netrw_curdir + let trailer = '[@=|\/\*]\=\>' if exists("s:netrwmarkfilelist_{curbufnr}") " markfile list exists " call Decho("starting s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">") @@ -3987,7 +4139,7 @@ fun! s:NetrwMarkFile(islocal,fname) " append filename to buffer's markfilelist " call Decho("append filename<".a:fname."> to local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">") call add(s:netrwmarkfilelist_{curbufnr},a:fname) - let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\|\<'.escape(a:fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").'\>' + let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\|\<'.escape(a:fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").trailer else " remove filename from buffer's markfilelist @@ -4004,9 +4156,9 @@ fun! s:NetrwMarkFile(islocal,fname) let first = 1 for fname in s:netrwmarkfilelist_{curbufnr} if first - let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\<'.escape(fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").'\>' + let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\<'.escape(fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").trailer else - let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\|\<'.escape(fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").'\>' + let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\|\<'.escape(fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").trailer endif let first= 0 endfor @@ -4027,7 +4179,7 @@ fun! s:NetrwMarkFile(islocal,fname) if a:fname =~ '/$' let s:netrwmarkfilemtch_{curbufnr}= '\<'.escape(a:fname,g:netrw_markfileesc) else - let s:netrwmarkfilemtch_{curbufnr}= '\<'.escape(a:fname,g:netrw_markfileesc).'\>' + let s:netrwmarkfilemtch_{curbufnr}= '\<'.escape(a:fname,g:netrw_markfileesc).trailer endif " call Decho("ending s:netrwmarkfilemtch_".curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">") endif @@ -4058,7 +4210,9 @@ fun! s:NetrwMarkFile(islocal,fname) " set up 2match'ing to netrwmarkfilemtch list if exists("s:netrwmarkfilemtch_{curbufnr}") && s:netrwmarkfilemtch_{curbufnr} != "" " call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/") - exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/" + if exists("g:did_drchip_netrwlist_syntax") + exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/" + endif else " call Decho("2match none") 2match none @@ -4086,7 +4240,7 @@ fun! s:NetrwMarkFileCompress(islocal) for sfx in sort(keys(g:netrw_decompress)) if fname =~ '\'.sfx.'$' " fname has a suffix indicating that its compressed; apply associated decompression routine - let exe= s:WinPath(g:netrw_decompress[sfx]) + let exe= netrw#WinPath(g:netrw_decompress[sfx]) " call Decho("fname<".fname."> is compressed so decompress with <".exe.">") if a:islocal if g:netrw_keepdir @@ -4111,10 +4265,10 @@ fun! s:NetrwMarkFileCompress(islocal) unlet exe elseif a:islocal " fname not a compressed file, so compress it - call system(s:WinPath(g:netrw_compress)." ".shellescape(s:ComposePath(b:netrw_curdir,fname))) + call system(netrw#WinPath(g:netrw_compress)." ".shellescape(s:ComposePath(b:netrw_curdir,fname))) else " fname not a compressed file, so compress it - call s:RemoteSystem(s:WinPath(g:netrw_compress)." ".shellescape(fname)) + call s:RemoteSystem(netrw#WinPath(g:netrw_compress)." ".shellescape(fname)) endif endfor call s:NetrwUnmarkList(curbufnr,curdir) @@ -4155,7 +4309,7 @@ fun! s:NetrwMarkFileCopy(islocal) " call Decho("copy from local to local") let args= join(map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),"shellescape(b:netrw_curdir.\"/\".v:val)")) " call Decho("system(".g:netrw_localcopycmd." ".args." ".shellescape(s:netrwmftgt).")") - call system(s:WinPath(g:netrw_localcopycmd)." ".args." ".shellescape(s:netrwmftgt)) + call system(netrw#WinPath(g:netrw_localcopycmd)." ".args." ".shellescape(s:netrwmftgt)) elseif a:islocal && !s:netrwmftgt_islocal " Copy marked files, local directory to remote directory @@ -4294,10 +4448,10 @@ fun! s:NetrwMarkFileExe(islocal) for fname in s:netrwmarkfilelist_{curbufnr} if a:islocal if g:netrw_keepdir - let fname= shellescape(s:WinPath(s:ComposePath(curdir,fname))) + let fname= shellescape(netrw#WinPath(s:ComposePath(curdir,fname))) endif else - let fname= shellescape(s:WinPath(b:netrw_curdir.fname)) + let fname= shellescape(netrw#WinPath(b:netrw_curdir.fname)) endif if cmd =~ '%' let xcmd= substitute(cmd,'%',fname,'g') @@ -4415,7 +4569,13 @@ fun! s:NetrwMarkFileGrep(islocal) " use vimgrep for both local and remote " call Decho("exe vimgrep".pat." ".netrwmarkfilelist) - exe "vimgrep".pat." ".netrwmarkfilelist + try + exe "noautocmd vimgrep".pat." ".netrwmarkfilelist + catch /^Vim\%((\a\+)\)\=:E480/ + call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76) +" call Dret("s:NetrwMarkFileGrep : unable to find pattern<".pattern.">") + return + endtry 2match none call netrw#NetrwRestorePosn(svpos) @@ -4574,24 +4734,15 @@ fun! s:NetrwMarkFileRegexp(islocal) " get the matching list of files using local glob() " call Decho("handle local regexp") let dirname = escape(b:netrw_curdir,g:netrw_glob_escape) - let filelist = glob(s:ComposePath(dirname,regexp)) - if filelist != "" - let filelist= filelist."\n" - endif + let files = glob(s:ComposePath(dirname,regexp)) +" call Decho("files<".files.">") + let filelist= split(files,"\n") " mark the list of files - while filelist != "" - if filelist =~ '\n' - let filename = substitute(filelist,'\n.*$','','e') - let filelist = substitute(filelist,'^.\{-}\n\(.*\)$','\1','e') - else - let filename = filelist - let filelist = "" - endif -" call Decho("filelist<".filelist.">") -" call Decho("filename<".filename.">") - call s:NetrwMarkFile(a:islocal,substitute(filename,'^.*/','','')) - endwhile + for fname in filelist +" call Decho("fname<".fname.">") + call s:NetrwMarkFile(a:islocal,substitute(fname,'^.*/','','')) + endfor else " call Decho("handle remote regexp") @@ -4603,7 +4754,8 @@ fun! s:NetrwMarkFileRegexp(islocal) set ei=all ma " call Decho("set ei=all ma") 1split - enew + call s:NetrwEnew() + call s:NetrwSafeOptions() silent norm! "ap 2 let bannercnt= search('^" =====','W') @@ -4611,16 +4763,21 @@ fun! s:NetrwMarkFileRegexp(islocal) set bt=nofile if g:netrw_liststyle == s:LONGLIST silent %s/\s\{2,}\S.*$//e + call histdel("/",-1) elseif g:netrw_liststyle == s:WIDELIST silent %s/\s\{2,}/\r/ge + call histdel("/",-1) elseif g:netrw_liststyle == s:TREELIST silent %s/^| //e silent! g/^ .*$/d + call histdel("/",-1) + call histdel("/",-1) endif " convert regexp into the more usual glob-style format let regexp= substitute(regexp,'\*','.*','g') " call Decho("regexp<".regexp.">") exe "silent! v/".escape(regexp,'/')."/d" + call histdel("/",-1) let filelist= getline(1,line("$")) q! for filename in filelist @@ -4691,6 +4848,7 @@ fun! s:NetrwMarkFileTag(islocal) let path= substitute(curdir,'^\(.*\)/[^/]*$','\1/','') " call Decho("curdir<".curdir."> path<".path.">") exe '%s/\t\(\S\+\)\t/\t'.escape(path,"/\n\r\\").'\1\t/e' + call histdel("/",-1) wq! endif 2match none @@ -4906,8 +5064,8 @@ fun! s:NetrwMenu(domenu) exe 'silent! menu '.g:NetrwMenuPriority.'.12.1 '.g:NetrwTopLvlMenu.'Explore.Directory\ Name :Explore ' exe 'silent! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (curdir\ only):Explore\ */ :Explore */' exe 'silent! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (+subdirs):Explore\ **/ :Explore **/' - exe 'silent! menu '.g:NetrwMenuPriority.'.12.3 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ Pattern\ (curdir\ only):Explore\ *// :Explore *//' - exe 'silent! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ Pattern\ (+subdirs):Explore\ **// :Explore **//' + exe 'silent! menu '.g:NetrwMenuPriority.'.12.3 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (curdir\ only):Explore\ *// :Explore *//' + exe 'silent! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (+subdirs):Explore\ **// :Explore **//' exe 'silent! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Next\ Match:Nexplore :Nexplore' exe 'silent! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Prev\ Match:Pexplore :Pexplore' exe 'silent! menu '.g:NetrwMenuPriority.'.13 '.g:NetrwTopLvlMenu.'Make\ Subdirectoryd d' @@ -5227,8 +5385,8 @@ fun! s:NetrwPrevWinOpen(islocal) let &ei= eikeep " call Decho("bnr=".bnr." bnrcnt=".bnrcnt." buftype=".&bt." winnr#".winnr()) if bnrcnt == 1 - let bufname= bufname(winbufnr(winnr())) - let choice= confirm("Save modified file<".bufname.">?","&Yes\n&No\n&Cancel") + let bufname = bufname(winbufnr(winnr())) + let choice = confirm("Save modified file<".bufname.">?","&Yes\n&No\n&Cancel") " call Decho("bufname<".bufname."> choice=".choice." winnr#".winnr()) if choice == 1 @@ -5376,6 +5534,7 @@ fun! s:NetrwUpload(fname,tgt,...) endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) silent g/Local directory now/d + call histdel("/",-1) if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' call netrw#ErrorMsg(s:ERROR,getline(1),14) else @@ -5434,6 +5593,7 @@ fun! s:NetrwUpload(fname,tgt,...) exe s:netrw_silentxfer."%!".g:netrw_ftp_cmd." -i -n" " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) silent g/Local directory now/d + call histdel("/",-1) if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' let debugkeep= &debug setlocal debug=msg @@ -5566,13 +5726,12 @@ fun! s:NetrwSetSort() let seq = seqlist let seqlist = "" endif - let sepchr= "\" if priority < 10 - let spriority= "00".priority.sepchr + let spriority= "00".priority.g:netrw_sepchr elseif priority < 100 - let spriority= "0".priority.sepchr + let spriority= "0".priority.g:netrw_sepchr else - let spriority= priority.sepchr + let spriority= priority.g:netrw_sepchr endif " call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">") @@ -5586,14 +5745,17 @@ fun! s:NetrwSetSort() let starpriority= spriority else exe 'silent keepjumps '.w:netrw_bannercnt.',$g/'.seq.'/s/^/'.spriority.'/' + call histdel("/",-1) " sometimes multiple sorting patterns will match the same file or directory. " The following substitute is intended to remove the excess matches. - exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^\d\{3}'.sepchr.'\d\{3}\//s/^\d\{3}'.sepchr.'\(\d\{3}\/\).\@=/\1/e' + exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^\d\{3}'.g:netrw_sepchr.'\d\{3}\//s/^\d\{3}'.g:netrw_sepchr.'\(\d\{3}\/\).\@=/\1/e' + call histdel("/",-1) endif let priority = priority + 1 endwhile if exists("starpriority") - exe 'silent keepjumps '.w:netrw_bannercnt.',$v/^\d\{3}'.sepchr.'/s/^/'.starpriority.'/' + exe 'silent keepjumps '.w:netrw_bannercnt.',$v/^\d\{3}'.g:netrw_sepchr.'/s/^/'.starpriority.'/' + call histdel("/",-1) endif " Following line associated with priority -- items that satisfy a priority @@ -5602,7 +5764,8 @@ fun! s:NetrwSetSort() " priority pattern needs to be retained. So, at this point, these excess " priority prefixes need to be removed, but not directories that happen to " be just digits themselves. - exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\(\d\{3}'.sepchr.'\)\%(\d\{3}'.sepchr.'\)\+\ze./\1/e' + exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\(\d\{3}'.g:netrw_sepchr.'\)\%(\d\{3}'.g:netrw_sepchr.'\)\+\ze./\1/e' + call histdel("/",-1) " call Dret("SetSort") endfun @@ -5674,8 +5837,8 @@ fun! s:NetrwSplit(mode) elseif a:mode == 4 " local and t - let netrw_curdir= b:netrw_curdir let cursorword = s:NetrwGetWord() + let netrw_curdir= s:NetrwTreeDir() " call Decho("tabnew") tabnew let b:netrw_curdir= netrw_curdir @@ -5746,12 +5909,13 @@ fun! s:NetrwTreeDir() if w:netrw_liststyle == s:TREELIST " call Decho("w:netrrw_liststyle is TREELIST:") " call Decho("line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">") + + " extract tree directory if on a line specifying a subdirectory (ie. ends with "/") if getline('.') =~ '/$' let treedir= substitute(getline('.'),'^\%(| \)*\([^|].\{-}\)$','\1','e') else let treedir= "" endif - " call Decho("treedir<".treedir.">") " detect user attempting to close treeroot @@ -5766,11 +5930,11 @@ fun! s:NetrwTreeDir() " elide all non-depth information let depth = substitute(getline('.'),'^\(\%(| \)*\)[^|].\{-}$','\1','e') -" call Decho("depth<".depth."> 1st subst") +" call Decho("depth<".depth."> 1st subst (non-depth info removed)") " elide first depth let depth = substitute(depth,'^| ','','') -" call Decho("depth<".depth."> 2nd subst") +" call Decho("depth<".depth."> 2nd subst (first depth removed)") " construct treedir by searching backwards at correct depth " call Decho("constructing treedir<".treedir."> depth<".depth.">") @@ -5789,11 +5953,6 @@ fun! s:NetrwTreeDir() endif let treedir= substitute(treedir,'//$','/','') -" " now force a refresh -"" call DECHO("clear buffer<".expand("%")."> with :%d") -" setlocal ma noro -" keepjumps %d - " call Dret("NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".string(s:treecurpos).">") return treedir endfun @@ -5904,30 +6063,32 @@ fun! s:NetrwWideListing() if w:netrw_liststyle == s:WIDELIST " call Dfunc("NetrwWideListing() w:netrw_liststyle=".w:netrw_liststyle.' fo='.&fo.' l:fo='.&l:fo) " look for longest filename (cpf=characters per filename) - " cpf: characters per file - " fpl: files per line - " fpc: files per column + " cpf: characters per filename + " fpl: filenames per line + " fpc: filenames per column setlocal ma noro " call Decho("setlocal ma noro") let b:netrw_cpf= 0 if line("$") >= w:netrw_bannercnt exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' + call histdel("/",-1) else " call Dret("NetrwWideListing") return endif -" call Decho("max file strlen+1=".b:netrw_cpf) - let b:netrw_cpf= b:netrw_cpf + 1 + let b:netrw_cpf= b:netrw_cpf + 2 +" call Decho("b:netrw_cpf=max_filename_length+2=".b:netrw_cpf) " determine qty files per line (fpl) let w:netrw_fpl= winwidth(0)/b:netrw_cpf if w:netrw_fpl <= 0 let w:netrw_fpl= 1 endif -" call Decho("fpl= ".winwidth(0)."/[b:netrw_cpf=".b:netrw_cpf.']='.w:netrw_fpl) +" call Decho("fpl= [winwidth=".winwidth(0)."]/[b:netrw_cpf=".b:netrw_cpf.']='.w:netrw_fpl) " make wide display exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^.*$/\=escape(printf("%-'.b:netrw_cpf.'s",submatch(0)),"\\")/' + call histdel("/",-1) let fpc = (line("$") - w:netrw_bannercnt + w:netrw_fpl)/w:netrw_fpl let newcolstart = w:netrw_bannercnt + fpc let newcolend = newcolstart + fpc - 1 @@ -5947,6 +6108,7 @@ fun! s:NetrwWideListing() endwhile silent! let @*= keepregstar exe "silent keepjumps ".w:netrw_bannercnt.',$s/\s\+$//e' + call histdel("/",-1) setlocal noma nomod ro " call Dret("NetrwWideListing") endif @@ -5977,13 +6139,18 @@ fun! s:PerformListing(islocal) call s:NetrwBookHistHandler(3,b:netrw_curdir) " Set up the banner {{{3 -" call Decho("set up banner") - keepjumps put ='\" ============================================================================' - keepjumps put ='\" Netrw Directory Listing (netrw '.g:loaded_netrw.')' - keepjumps put ='\" '.b:netrw_curdir - keepjumps 1d - let w:netrw_bannercnt= 3 - exe "keepjumps ".w:netrw_bannercnt + if g:netrw_banner +" call Decho("set up banner") + keepjumps put ='\" ============================================================================' + keepjumps put ='\" Netrw Directory Listing (netrw '.g:loaded_netrw.')' + keepjumps put ='\" '.b:netrw_curdir + keepjumps 1d + let w:netrw_bannercnt= 3 + exe "keepjumps ".w:netrw_bannercnt + else + keepjumps 1 + let w:netrw_bannercnt= 1 + endif let sortby= g:netrw_sort_by if g:netrw_sort_direction =~ "^r" @@ -5991,55 +6158,63 @@ fun! s:PerformListing(islocal) endif " Sorted by... {{{3 -" call Decho("handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">") - if g:netrw_sort_by =~ "^n" + if g:netrw_banner +" call Decho("handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">") + if g:netrw_sort_by =~ "^n" " call Decho("directories will be sorted by name") - " sorted by name - keepjumps put ='\" Sorted by '.sortby - keepjumps put ='\" Sort sequence: '.g:netrw_sort_sequence - let w:netrw_bannercnt= w:netrw_bannercnt + 2 - else + " sorted by name + keepjumps put ='\" Sorted by '.sortby + keepjumps put ='\" Sort sequence: '.g:netrw_sort_sequence + let w:netrw_bannercnt= w:netrw_bannercnt + 2 + else " call Decho("directories will be sorted by size or time") - " sorted by size or date - keepjumps put ='\" Sorted by '.sortby - let w:netrw_bannercnt= w:netrw_bannercnt + 1 + " sorted by size or date + keepjumps put ='\" Sorted by '.sortby + let w:netrw_bannercnt= w:netrw_bannercnt + 1 + endif + exe "keepjumps ".w:netrw_bannercnt endif - exe "keepjumps ".w:netrw_bannercnt " show copy/move target, if any - if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal") -" call Decho("show copy/move target<".s:netrwmftgt.">") - keepjumps put ='' - if s:netrwmftgt_islocal - call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (local)') + if g:netrw_banner + if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal") +" call Decho("show copy/move target<".s:netrwmftgt.">") + keepjumps put ='' + if s:netrwmftgt_islocal + call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (local)') + else + call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (remote)') + endif + let w:netrw_bannercnt= w:netrw_bannercnt + 1 else - call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (remote)') +" call Decho("s:netrwmftgt does not exist, don't make Copy/Move Tgt") endif - let w:netrw_bannercnt= w:netrw_bannercnt + 1 - else -" call Decho("s:netrwmftgt does not exist, don't make Copy/Move Tgt") + exe "keepjumps ".w:netrw_bannercnt endif - exe "keepjumps ".w:netrw_bannercnt " Hiding... -or- Showing... {{{3 -" call Decho("handle hiding/showing (g:netrw_hide=".g:netrw_list_hide." g:netrw_list_hide<".g:netrw_list_hide.">)") - if g:netrw_list_hide != "" && g:netrw_hide - if g:netrw_hide == 1 - keepjumps put ='\" Hiding: '.g:netrw_list_hide - else - keepjumps put ='\" Showing: '.g:netrw_list_hide + if g:netrw_banner +" call Decho("handle hiding/showing (g:netrw_hide=".g:netrw_list_hide." g:netrw_list_hide<".g:netrw_list_hide.">)") + if g:netrw_list_hide != "" && g:netrw_hide + if g:netrw_hide == 1 + keepjumps put ='\" Hiding: '.g:netrw_list_hide + else + keepjumps put ='\" Showing: '.g:netrw_list_hide + endif + let w:netrw_bannercnt= w:netrw_bannercnt + 1 endif - let w:netrw_bannercnt= w:netrw_bannercnt + 1 + exe "keepjumps ".w:netrw_bannercnt + keepjumps put ='\" Quick Help: :help -:go up dir D:delete R:rename s:sort-by x:exec' + keepjumps put ='\" ============================================================================' + let w:netrw_bannercnt= w:netrw_bannercnt + 2 endif - exe "keepjumps ".w:netrw_bannercnt - keepjumps put ='\" Quick Help: :help -:go up dir D:delete R:rename s:sort-by x:exec' - keepjumps put ='\" ============================================================================' - let w:netrw_bannercnt= w:netrw_bannercnt + 2 " bannercnt should index the line just after the banner - let w:netrw_bannercnt= w:netrw_bannercnt + 1 - exe "keepjumps ".w:netrw_bannercnt -" call Decho("bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$")) + if g:netrw_banner + let w:netrw_bannercnt= w:netrw_bannercnt + 1 + exe "keepjumps ".w:netrw_bannercnt +" call Decho("bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$")) + endif " set up syntax highlighting {{{3 " call Decho("set up syntax highlighting") @@ -6057,23 +6232,23 @@ fun! s:PerformListing(islocal) else " remote call s:NetrwRemoteListing() endif -" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)") +" call Decho("g:netrw_banner=".g:netrw_banner." w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)") " manipulate the directory listing (hide, sort) {{{3 - if line("$") >= w:netrw_bannercnt + if !g:netrw_banner || line("$") >= w:netrw_bannercnt " call Decho("manipulate directory listing (hide)") " call Decho("g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">") if g:netrw_hide && g:netrw_list_hide != "" call s:NetrwListHide() endif - if line("$") >= w:netrw_bannercnt + if !g:netrw_banner || line("$") >= w:netrw_bannercnt " call Decho("manipulate directory listing (sort) : g:netrw_sort_by<".g:netrw_sort_by.">") if g:netrw_sort_by =~ "^n" " sort by name call s:NetrwSetSort() - if w:netrw_bannercnt < line("$") + if !g:netrw_banner || w:netrw_bannercnt < line("$") " call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")") if g:netrw_sort_direction =~ 'n' " normal direction sorting @@ -6085,11 +6260,11 @@ fun! s:PerformListing(islocal) endif " remove priority pattern prefix " call Decho("remove priority pattern prefix") - let sepchr= "\" - exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{3}'.sepchr.'//e' + exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{3}'.g:netrw_sepchr.'//e' + call histdel("/",-1) elseif a:islocal - if w:netrw_bannercnt < line("$") + if !g:netrw_banner || w:netrw_bannercnt < line("$") " call Decho("g:netrw_sort_direction=".g:netrw_sort_direction) if g:netrw_sort_direction =~ 'n' " call Decho('exe silent keepjumps '.w:netrw_bannercnt.',$sort') @@ -6098,13 +6273,17 @@ fun! s:PerformListing(islocal) " call Decho('exe silent keepjumps '.w:netrw_bannercnt.',$sort!') exe 'silent keepjumps '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options endif - endif exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{-}\///e' + call histdel("/",-1) + endif endif elseif g:netrw_sort_direction =~ 'r' " call Decho('reverse the sorted listing') - exe 'silent keepjumps '.w:netrw_bannercnt.'g/^/m '.w:netrw_bannercnt + if !g:netrw_banner || w:netrw_bannercnt < line('$') + exe 'silent keepjumps '.w:netrw_bannercnt.',$g/^/m '.w:netrw_bannercnt + call histdel("/",-1) + endif endif endif @@ -6113,7 +6292,7 @@ fun! s:PerformListing(islocal) call s:NetrwWideListing() call s:NetrwTreeListing(b:netrw_curdir) - if exists("w:netrw_bannercnt") && line("$") > w:netrw_bannercnt + if exists("w:netrw_bannercnt") && (line("$") > w:netrw_bannercnt || !g:netrw_banner) " place cursor on the top-left corner of the file listing " call Decho("place cursor on top-left corner of file listing") exe 'silent keepjumps '.w:netrw_bannercnt @@ -6247,8 +6426,10 @@ fun! s:NetrwRemoteListing() " cleanup if g:netrw_ftp_browse_reject != "" exe "silent! g/".g:netrw_ftp_browse_reject."/keepjumps d" + call histdel("/",-1) endif silent! keepjumps %s/\r$//e + call histdel("/",-1) " if there's no ../ listed, then put ./ and ../ in let line1= line(".") @@ -6266,11 +6447,15 @@ fun! s:NetrwRemoteListing() if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup " call Decho("M$ ftp cleanup") exe 'silent! keepjumps '.w:netrw_bannercnt.',$s/^\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(\|\d\+\)\s\+//' + call histdel("/",-1) else " normal ftp cleanup " call Decho("normal ftp 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' + call histdel("/",-1) + call histdel("/",-1) + call histdel("/",-1) endif endif @@ -6286,8 +6471,12 @@ fun! s:NetrwRemoteListing() g/^Listing directory/d g/^d[-rwx][-rwx][-rwx]/s+$+/+e silent g/^l[-rwx][-rwx][-rwx]/s+$+@+e + call histdel("/",-1) + call histdel("/",-1) + call histdel("/",-1) if g:netrw_liststyle != s:LONGLIST g/^[dlsp-][-rwx][-rwx][-rwx]/s/^.*\s\(\S\+\)$/\1/e + call histdel("/",-1) endif else if s:path == "" @@ -6304,6 +6493,7 @@ fun! s:NetrwRemoteListing() if g:netrw_ftp_browse_reject != "" " call Decho("(cleanup) exe silent! g/".g:netrw_ssh_browse_reject."/keepjumps d") exe "silent! g/".g:netrw_ssh_browse_reject."/keepjumps d" + call histdel("/",-1) endif endif @@ -6340,6 +6530,9 @@ fun! s:NetrwRemoteListing() 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 + call histdel("/",-1) + call histdel("/",-1) + call histdel("/",-1) endif endif @@ -6486,14 +6679,14 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) call s:NetrwRemoteFtpCmd(a:path,"rmdir ".a:rmfile) else let rmfile = substitute(a:path.a:rmfile,'/$','','') - let netrw_rmdir_cmd = s:MakeSshCmd(s:WinPath(g:netrw_rmdir_cmd)).' '.shellescape(s:WinPath(rmfile)) + let netrw_rmdir_cmd = s:MakeSshCmd(netrw#WinPath(g:netrw_rmdir_cmd)).' '.shellescape(netrw#WinPath(rmfile)) " call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")") let ret= system(netrw_rmdir_cmd) " call Decho("returned=".ret." errcode=".v:shell_error) if v:shell_error != 0 " call Decho("v:shell_error not 0") - let netrw_rmf_cmd= s:MakeSshCmd(s:WinPath(g:netrw_rmf_cmd)).' '.shellescape(s:WinPath(substitute(rmfile,'[\/]$','','e'))) + let netrw_rmf_cmd= s:MakeSshCmd(netrw#WinPath(g:netrw_rmf_cmd)).' '.shellescape(netrw#WinPath(substitute(rmfile,'[\/]$','','e'))) " call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")") let ret= system(netrw_rmf_cmd) " call Decho("returned=".ret." errcode=".v:shell_error) @@ -6594,13 +6787,17 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) " cleanup for Windows if has("win32") || has("win95") || has("win64") || has("win16") silent! keepjumps %s/\r$//e + call histdel("/",-1) endif if a:listcmd == "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/$/@/ + call histdel("/",-1) + call histdel("/",-1) if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || w:netrw_liststyle == s:TREELIST exe "silent! keepjumps ".w:netrw_bannercnt.',$s/^\%(\S\+\s\+\)\{8}//e' + call histdel("/",-1) endif endif @@ -6653,8 +6850,8 @@ fun! s:NetrwRemoteRename(usrhost,path) range else let oldname= shellescape(a:path.oldname) let newname= shellescape(a:path.newname) -" call Decho("system(s:WinPath(".rename_cmd.") ".oldname.' '.newname.")") - let ret = system(s:WinPath(rename_cmd).' '.oldname.' '.newname) +" call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")") + let ret = system(netrw#WinPath(rename_cmd).' '.oldname.' '.newname) endif endfor @@ -6678,8 +6875,8 @@ fun! s:NetrwRemoteRename(usrhost,path) range else let oldname= shellescape(a:path.oldname) let newname= shellescape(a:path.newname) -" call Decho("system(s:WinPath(".rename_cmd.") ".oldname.' '.newname.")") - let ret = system(s:WinPath(rename_cmd).' '.oldname.' '.newname) +" call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")") + let ret = system(netrw#WinPath(rename_cmd).' '.oldname.' '.newname) endif let ctr= ctr + 1 @@ -6707,13 +6904,16 @@ fun! netrw#LocalBrowseCheck(dirname) " The &ft == "netrw" test was installed because the BufEnter event " would hit when re-entering netrw windows, creating unexpected " refreshes (and would do so in the middle of NetrwSaveOptions(), too) -" call Decho("netrw#LocalBrowseCheck: isdir<".a:dirname.">=".isdirectory(a:dirname)) +" call Decho("netrw#LocalBrowseCheck: isdir<".a:dirname.">=".isdirectory(a:dirname).((exists("s:treeforceredraw")? " treeforceredraw" : ""))) if isdirectory(a:dirname) " call Decho(" ft<".&ft."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : " doesn't exist")."> dirname<".a:dirname.">"." line($)=".line("$")) if &ft != "netrw" || (exists("b:netrw_curdir") && b:netrw_curdir != a:dirname) silent! call s:NetrwBrowse(1,a:dirname) elseif &ft == "netrw" && line("$") == 1 silent! call s:NetrwBrowse(1,a:dirname) + elseif exists("s:treeforceredraw") + unlet s:treeforceredraw + silent! call s:NetrwBrowse(1,a:dirname) endif endif " not a directory, ignore it @@ -6733,7 +6933,7 @@ fun! s:LocalListing() " get the list of files contained in the current directory let dirname = escape(b:netrw_curdir,g:netrw_glob_escape) - let dirnamelen = strlen(b:netrw_curdir) + let dirnamelen = s:Strlen(b:netrw_curdir) let filelist = glob(s:ComposePath(dirname,"*")) " call Decho("glob(dirname<".dirname."/*>)=".filelist) if filelist != "" @@ -6849,7 +7049,7 @@ fun! s:LocalListing() if w:netrw_liststyle == s:LONGLIST let sz = getfsize(filename) - let fsz = strpart(" ",1,15-s:Strlen(sz)).sz + let fsz = strpart(" ",1,15-strlen(sz)).sz let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename)) " call Decho("sz=".sz." fsz=".fsz) endif @@ -6858,7 +7058,7 @@ fun! s:LocalListing() " sort by time (handles time up to 1 quintillion seconds, US) " call Decho("getftime(".filename.")=".getftime(filename)) let t = getftime(filename) - let ft = strpart("000000000000000000",1,18-s:Strlen(t)).t + let ft = strpart("000000000000000000",1,18-strlen(t)).t " call Decho("exe keepjumps put ='".ft.'/'.filename."'") let ftpfile= ft.'/'.pfile keepjumps silent! put=ftpfile @@ -6867,7 +7067,7 @@ fun! s:LocalListing() " sort by size (handles file sizes up to 1 quintillion bytes, US) " call Decho("getfsize(".filename.")=".getfsize(filename)) let sz = getfsize(filename) - let fsz = strpart("000000000000000000",1,18-s:Strlen(sz)).sz + let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz " call Decho("exe keepjumps put ='".fsz.'/'.filename."'") let fszpfile= fsz.'/'.pfile keepjumps silent! put =fszpfile @@ -6880,7 +7080,9 @@ fun! s:LocalListing() endwhile " cleanup any windows mess at end-of-line + silent! keepjumps g/^$/d silent! keepjumps %s/\r$//e + call histdel("/",-1) exe "setlocal ts=".g:netrw_maxfilenamelen " call Decho("setlocal ts=".g:netrw_maxfilenamelen) @@ -6900,7 +7102,7 @@ fun! s:LocalBrowseShellCmdRefresh() return endif if !exists("w:netrw_bannercnt") -" call Dret("LocalBrowseShellCmdRefresh : don't refresh when focus not on netrw windwo") +" call Dret("LocalBrowseShellCmdRefresh : don't refresh when focus not on netrw window") return endif if exists("s:locbrowseshellcmd") @@ -7064,8 +7266,8 @@ fun! s:NetrwLocalRmFile(path,fname,all) let rmfile= substitute(rmfile,'[\/]$','','e') if all || ok =~ 'y\%[es]' || ok == "" -" call Decho("1st attempt: system(s:WinPath(".g:netrw_local_rmdir.') '.shellescape(rmfile).')') - call system(s:WinPath(g:netrw_local_rmdir).' '.shellescape(rmfile)) +" call Decho("1st attempt: system(netrw#WinPath(".g:netrw_local_rmdir.') '.shellescape(rmfile).')') + call system(netrw#WinPath(g:netrw_local_rmdir).' '.shellescape(rmfile)) " call Decho("v:shell_error=".v:shell_error) if v:shell_error != 0 @@ -7233,7 +7435,7 @@ endfun " 0=note = s:NOTE " 1=warning = s:WARNING " 2=error = s:ERROR -" Oct 12, 2008 : max errnum currently is 73 +" Dec 03, 2009 : max errnum currently is 76 fun! netrw#ErrorMsg(level,msg,errnum) " call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a:errnum.") g:netrw_use_errorwindow=".g:netrw_use_errorwindow) @@ -7266,7 +7468,8 @@ fun! netrw#ErrorMsg(level,msg,errnum) else " call Decho("create a NetrwMessage buffer window") bo 1split - enew + call s:NetrwEnew() + call s:NetrwSafeOptions() setlocal bt=nofile file NetrwMessage " call Decho("setlocal ma noro") @@ -7350,6 +7553,7 @@ fun! netrw#NetrwSavePosn() let w:netrw_winnr= winnr() let w:netrw_line = line(".") let w:netrw_col = virtcol(".") +" call Decho("currently, win#".w:netrw_winnr." line#".w:netrw_line." col#".w:netrw_col) " Save top-of-screen line norm! H0 @@ -7379,7 +7583,7 @@ fun! s:ComposePath(base,subdir) if(has("amiga")) " call Decho("amiga") - let ec = a:base[strlen(a:base)-1] + let ec = a:base[s:Strlen(a:base)-1] if ec != '/' && ec != ':' let ret = a:base . "/" . a:subdir else @@ -7390,6 +7594,14 @@ fun! s:ComposePath(base,subdir) " call Decho("windows") let ret= a:subdir + elseif a:base =~ '^\a:[/\\][^/\\]' && (has("win32") || has("win95") || has("win64") || has("win16")) +" call Decho("windows") + if a:base =~ '[/\\]$' + let ret= a:base.a:subdir + else + let ret= a:base."/".a:subdir + endif + elseif a:base =~ '^\a\+://' " call Decho("remote linux/macos") let urlbase = substitute(a:base,'^\(\a\+://.\{-}/\)\(.*\)$','\1','') @@ -7550,7 +7762,7 @@ endfun fun! s:NetrwDelete(path) " call Dfunc("s:NetrwDelete(path<".a:path.">)") - let path = s:WinPath(a:path) + let path = netrw#WinPath(a:path) if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) if exists("+shellslash") let sskeep= &shellslash @@ -7566,7 +7778,7 @@ fun! s:NetrwDelete(path) let result= delete(path) endif if result < 0 - call Netrw#ErrorMsg(s:WARNING,"delete(".path.") failed!",71) + call netrw#ErrorMsg(s:WARNING,"delete(".path.") failed!",71) endif " call Dret("s:NetrwDelete ".result) @@ -7575,8 +7787,9 @@ endfun " --------------------------------------------------------------------- " s:NetrwEnew: opens a new buffer, passes netrw buffer variables through {{{2 -fun! s:NetrwEnew(curdir) -" call Dfunc("s:NetrwEnew(curdir<".a:curdir.">) buf#".bufnr("%")."<".bufname("%").">") +fun! s:NetrwEnew(...) +" call Dfunc("s:NetrwEnew() a:0=".a:0) +" call Decho("curdir<".((a:0>0)? a:1 : "")."> buf#".bufnr("%")."<".bufname("%").">") " grab a function-local-variable copy of buffer variables if exists("b:netrw_bannercnt") |let netrw_bannercnt = b:netrw_bannercnt |endif @@ -7619,14 +7832,16 @@ fun! s:NetrwEnew(curdir) if exists("netrw_option") |let b:netrw_option = netrw_option |endif if exists("netrw_prvdir") |let b:netrw_prvdir = netrw_prvdir |endif - let b:netrw_curdir= a:curdir - if b:netrw_curdir =~ '/$' - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST - file NetrwTreeListing - nno [ :silent call TreeListMove('[') - nno ] :silent call TreeListMove(']') - else - exe "silent! keepalt file ".fnameescape(b:netrw_curdir) + if a:0 > 0 + let b:netrw_curdir= a:1 + if b:netrw_curdir =~ '/$' + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST + file NetrwTreeListing + nno [ :silent call TreeListMove('[') + nno ] :silent call TreeListMove(']') + else + exe "silent! keepalt file ".fnameescape(b:netrw_curdir) + endif endif endif @@ -7760,13 +7975,16 @@ fun! s:NetrwRexplore(islocal,dirname) call netrw#NetrwRestorePosn(s:nbcd_curpos_{bufnr('%')}) unlet s:nbcd_curpos_{bufnr('%')} endif + if exists("s:explore_match") + exe "2match netrwMarkFile /".s:explore_match."/" + endif " call Dret("s:NetrwRexplore") endfun " --------------------------------------------------------------------- " s:SaveBufVars: {{{2 fun! s:SaveBufVars() -" call Dfunc("s:SaveBufVars()") +" call Dfunc("s:SaveBufVars() buf#".bufnr("%")) if exists("b:netrw_curdir") |let s:netrw_curdir = b:netrw_curdir |endif if exists("b:netrw_lastfile") |let s:netrw_lastfile = b:netrw_lastfile |endif @@ -7781,7 +7999,7 @@ endfun " --------------------------------------------------------------------- " s:SaveWinVars: (used by Explore() and NetrwSplit()) {{{2 fun! s:SaveWinVars() -" call Dfunc("s:SaveWinVars()") +" call Dfunc("s:SaveWinVars() win#".winnr()) if exists("w:netrw_bannercnt") |let s:bannercnt = w:netrw_bannercnt |endif if exists("w:netrw_col") |let s:col = w:netrw_col |endif if exists("w:netrw_curdir") |let s:curdir = w:netrw_curdir |endif @@ -7811,7 +8029,7 @@ endfun " variables are not inherited by the new window. SetBufWinVars() and " UseBufWinVars() get around that. fun! s:SetBufWinVars() -" call Dfunc("s:SetBufWinVars()") +" call Dfunc("s:SetBufWinVars() win#".winnr()) if exists("w:netrw_liststyle") |let b:netrw_liststyle = w:netrw_liststyle |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 @@ -7855,9 +8073,9 @@ endfun " --------------------------------------------------------------------- " s:Strlen: this function returns the length of a string, even if its {{{2 " using two-byte etc characters. -" Currently, its only used if g:Align_xstrlen is set to a -" nonzero value. Solution from Nicolai Weibull, vim docs -" (:help strlen()), Tony Mechelynck, and my own invention. +" Solution from Nicolai Weibull, vim docs (:help strlen()), Tony Mechelynck, +" and a bit from me. +" if g:netrw_xstrlen is zero (default), then the builtin strlen() function is used. fun! s:Strlen(x) " call Dfunc("s:Strlen(x<".a:x.">") if g:netrw_xstrlen == 1 @@ -7885,7 +8103,7 @@ fun! s:Strlen(x) else " at least give a decent default - ret= strlen(a:x) + let ret= strlen(a:x) endif " call Dret("s:Strlen ".ret) return ret @@ -7954,7 +8172,7 @@ endfun " Buffers.Refresh; hence, s:NetrwBMShow() utilizes a "cheat" to call that function anyway. fun! s:UpdateBuffersMenu() " call Dfunc("s:UpdateBuffersMenu()") - if has("gui") && has("menu") && has("gui_running") && &go =~ 'm' + if has("gui") && has("menu") && has("gui_running") && &go =~ 'm' && g:netrw_menu try silent emenu Buffers.Refresh\ menu catch /^Vim\%((\a\+)\)\=:E/ @@ -7984,12 +8202,14 @@ fun! s:UseBufWinVars() endfun " --------------------------------------------------------------------- -" s:WinPath: {{{2 -fun! s:WinPath(path) -" call Dfunc("s:WinPath(path<".a:path.">)") - if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) +" netrw#WinPath: tries to insure that the path is windows-acceptable, whether cygwin is used or not {{{2 +fun! netrw#WinPath(path) +" call Dfunc("netrw#WinPath(path<".a:path.">)") + if (!g:netrw_cygwin || &shell !~ '\%(\\|\\)\%(\.exe\)\=$') && (has("win32") || has("win95") || has("win64") || has("win16")) + " remove cygdrive prefix, if present + let path = substitute(a:path,'/cygdrive/\(.\)','\1:','') " remove trailing slash (Win95) - let path = substitute(a:path, '\(\\\|/\)$', '', 'g') + let path = substitute(path, '\(\\\|/\)$', '', 'g') " remove escaped spaces let path = substitute(path, '\ ', ' ', 'g') " convert slashes to backslashes @@ -7997,7 +8217,7 @@ fun! s:WinPath(path) else let path= a:path endif -" call Dret("s:WinPath <".path.">") +" call Dret("netrw#WinPath <".path.">") return path endfun diff --git a/vimfiles/autoload/netrwSettings.vim b/vimfiles/autoload/netrwSettings.vim index daf9e21..38f7299 100644 --- a/vimfiles/autoload/netrwSettings.vim +++ b/vimfiles/autoload/netrwSettings.vim @@ -145,6 +145,7 @@ fun! netrwSettings#NetrwSettings() put = 'let g:netrw_special_syntax = '.g:netrw_special_syntax put = 'let g:netrw_ssh_browse_reject = '.g:netrw_ssh_browse_reject put = 'let g:netrw_scpport = '.g:netrw_scpport + put = 'let g:netrw_sepchr = '.g:netrw_sepchr put = 'let g:netrw_sshport = '.g:netrw_sshport put = 'let g:netrw_timefmt = '.g:netrw_timefmt let tmpfileescline= line("$") diff --git a/vimfiles/autoload/tcomment.vim b/vimfiles/autoload/tcomment.vim index 3fbe817..75ac268 100644 --- a/vimfiles/autoload/tcomment.vim +++ b/vimfiles/autoload/tcomment.vim @@ -1,10 +1,10 @@ " tcomment.vim -" @Author: Thomas Link (mailto:micathom AT gmail com?subject=[vim]) +" @Author: Tom Link (mailto:micathom AT gmail com?subject=[vim]) " @Website: http://www.vim.org/account/profile.php?user_id=4037 " @License: GPL (see http://www.gnu.org/licenses/gpl.txt) " @Created: 2007-09-17. -" @Last Change: 2008-05-07. -" @Revision: 0.0.46 +" @Last Change: 2009-02-15. +" @Revision: 0.0.66 if &cp || exists("loaded_tcomment_autoload") finish @@ -90,6 +90,7 @@ function! tcomment#Comment(beg, end, ...) " We want a comment block call s:CommentBlock(a:beg, a:end, uncomment, cmtCheck, cms, indentStr) else + " call s:CommentLines(a:beg, a:end, cstart, cend, uncomment, cmtCheck, cms0, indentStr) " We want commented lines " final search pattern for uncommenting let cmtCheck = escape('\V\^\(\s\{-}\)'. cmtCheck .'\$', '"/\') @@ -109,10 +110,12 @@ function! tcomment#Comment(beg, end, ...) endif endf - function! tcomment#Operator(type, ...) "{{{3 let commentMode = a:0 >= 1 ? a:1 : '' let bang = a:0 >= 2 ? a:2 : '' + if !exists('w:tcommentPos') + let w:tcommentPos = getpos(".") + endif let sel_save = &selection let &selection = "inclusive" let reg_save = @@ @@ -384,6 +387,17 @@ function! s:ProcessedLine(uncomment, match, checkRx, replace) return rv endf +function! s:CommentLines(beg, end, cstart, cend, uncomment, cmtCheck, cms0, indentStr) "{{{3 + " We want commented lines + " final search pattern for uncommenting + let cmtCheck = escape('\V\^\(\s\{-}\)'. a:cmtCheck .'\$', '"/\') + " final pattern for commenting + let cmtReplace = escape(a:cms0, '"/') + silent exec a:beg .','. a:end .'s/\V'. + \ s:StartRx(a:cstart) . a:indentStr .'\zs\(\.\{-}\)'. s:EndRx(a:cend) .'/'. + \ '\=s:ProcessedLine('. a:uncomment .', submatch(0), "'. a:cmtCheck .'", "'. cmtReplace .'")/ge' +endf + function! s:CommentBlock(beg, end, uncomment, checkRx, replace, indentStr) let t = @t try @@ -428,28 +442,33 @@ function! s:GuessFileType(beg, end, commentMode, filetype, ...) let cms = s:GuessCurrentCommentString(0) endif let n = a:beg + " TLogVAR n, a:beg, a:end while n <= a:end let m = indent(n) + 1 - let le = col('$') + let le = len(getline(n)) + " TLogVAR m, le while m < le let syntaxName = synIDattr(synID(n, m, 1), 'name') + " TLogVAR syntaxName, n, m let ftypeMap = get(g:tcommentSyntaxMap, syntaxName) if !empty(ftypeMap) + " TLogVAR ftypeMap return s:GetCustomCommentString(ftypeMap, a:commentMode, cms) elseif syntaxName =~ g:tcommentFileTypesRx let ft = substitute(syntaxName, g:tcommentFileTypesRx, '\1', '') + " TLogVAR ft if exists('g:tcommentIgnoreTypes_'. a:filetype) && g:tcommentIgnoreTypes_{a:filetype} =~ '\<'.ft.'\>' - let m = m + 1 + let m += 1 else return s:GetCustomCommentString(ft, a:commentMode, cms) endif elseif syntaxName == '' || syntaxName == 'None' || syntaxName =~ '^\u\+$' || syntaxName =~ '^\u\U*$' - let m = m + 1 + let m += 1 else break endif endwh - let n = n + 1 + let n += 1 endwh return [cms, commentMode] endf diff --git a/vimfiles/autoload/vimball.vim b/vimfiles/autoload/vimball.vim index df932db..b97c3a5 100644 --- a/vimfiles/autoload/vimball.vim +++ b/vimfiles/autoload/vimball.vim @@ -1,9 +1,9 @@ " vimball.vim : construct a file containing both paths and files " Author: Charles E. Campbell, Jr. -" Date: May 30, 2008 -" Version: 26 +" Date: Dec 28, 2009 +" Version: 30 " GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim -" Copyright: (c) 2004-2007 by Charles E. Campbell, Jr. +" Copyright: (c) 2004-2009 by Charles E. Campbell, Jr. " The VIM LICENSE applies to Vimball.vim, and Vimball.txt " (see |copyright|) except use "Vimball" instead of "Vim". " No warranty, express or implied. @@ -11,11 +11,17 @@ " --------------------------------------------------------------------- " Load Once: {{{1 -if &cp || exists("g:loaded_vimball") || v:version < 700 +if &cp || exists("g:loaded_vimball") finish endif -let s:keepcpo = &cpo -let g:loaded_vimball = "v26" +let g:loaded_vimball = "v30" +if v:version < 702 + echohl WarningMsg + echo "***warning*** this version of vimball needs vim 7.2" + echohl Normal + finish +endif +let s:keepcpo= &cpo set cpo&vim "DechoTabOn @@ -52,30 +58,6 @@ if !exists("s:USAGE") call vimball#ShowMesg(s:WARNING,"(vimball) g:vimball_mkdir undefined") endif endif - - " set up shell quoting character - if exists("g:vimball_shq") && !exists("g:netrw_shq") - let g:netrw_shq= g:vimball_shq - endif - if !exists("g:netrw_shq") - if exists("&shq") && &shq != "" - let g:netrw_shq= &shq - elseif has("win32") || has("win95") || has("win64") || has("win16") - if g:netrw_cygwin - let g:netrw_shq= "'" - else - let g:netrw_shq= '"' - endif - else - let g:netrw_shq= "'" - endif -" call Decho("g:netrw_shq<".g:netrw_shq.">") - endif - - " set up escape string (used to protect paths) - if !exists("g:vimball_path_escape") - let g:vimball_path_escape= ' ;#%' - endif endif " ===================================================================== @@ -106,8 +88,8 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range let vbname= vbname.'.vba' endif " call Decho("vbname<".vbname.">") - if a:1 =~ '[\/]' - call vimball#ShowMesg(s:ERROR,"(MkVimball) vimball name<".a:1."> should not include slashes") + if !a:writelevel && a:1 =~ '[\/]' + call vimball#ShowMesg(s:ERROR,"(MkVimball) vimball name<".a:1."> should not include slashes; use ! to insist") " call Dret("MkVimball : vimball name<".a:1."> should not include slashes") return endif @@ -125,7 +107,7 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range let home= expand(a:2) else " use first existing directory from rtp - let home= s:VimballHome() + let home= vimball#VimballHome() endif " save current directory @@ -169,9 +151,8 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range call setline(lastline+1,0) " write the file from the tab - let svfilepath= s:Path(svfile,'') -" call Decho("exe $r ".fnameescape(svfilepath)) - exe "$r ".fnameescape(svfilepath) +" call Decho("exe $r ".fnameescape(svfile)) + exe "$r ".fnameescape(svfile) call setline(lastline+1,line("$") - lastline - 1) " call Decho("lastline=".lastline." line$=".line("$")) @@ -186,13 +167,11 @@ fun! vimball#MkVimball(line1,line2,writelevel,...) range call s:ChgDir(curdir) setlocal ff=unix if a:writelevel - let vbnamepath= s:Path(vbname,'') -" call Decho("exe w! ".fnameescape(vbnamepath)) - exe "w! ".fnameescape(vbnamepath) +" call Decho("exe w! ".fnameescape(vbname)) + exe "w! ".fnameescape(vbname) else - let vbnamepath= s:Path(vbname,'') -" call Decho("exe w ".fnameescape(vbnamepath)) - exe "w ".fnameescape(vbnamepath) +" call Decho("exe w ".fnameescape(vbname)) + exe "w ".fnameescape(vbname) endif " call Decho("Vimball<".vbname."> created") echo "Vimball<".vbname."> created" @@ -215,7 +194,13 @@ endfun fun! vimball#Vimball(really,...) " call Dfunc("vimball#Vimball(really=".a:really.") a:0=".a:0) - if getline(1) !~ '^" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.$' + if v:version < 701 || (v:version == 701 && !exists('*fnameescape')) + echoerr "your vim is missing the fnameescape() function" +" call Dret("vimball#Vimball : needs 7.1 with patch 299") + return + endif + + if getline(1) !~ '^" Vimball Archiver' echoerr "(Vimball) The current file does not appear to be a Vimball!" " call Dret("vimball#Vimball") return @@ -237,7 +222,7 @@ fun! vimball#Vimball(really,...) if a:0 > 0 let home= expand(a:1) else - let home= s:VimballHome() + let home= vimball#VimballHome() endif " call Decho("home<".home.">") @@ -269,7 +254,9 @@ fun! vimball#Vimball(really,...) while 1 < linenr && linenr < line("$") let fname = substitute(getline(linenr),'\t\[\[\[1$','','') let fname = substitute(fname,'\\','/','g') - let fsize = getline(linenr+1)+0 +" let fsize = getline(linenr+1)+0 + let fsize = substitute(getline(linenr+1),'^\(\d\+\).\{-}$','\1','')+0 + let fenc = substitute(getline(linenr+1),'^\d\+\s*\(\S\+\)$','\1','') let filecnt = filecnt + 1 " call Decho("fname<".fname."> fsize=".fsize." filecnt=".filecnt) @@ -304,7 +291,7 @@ fun! vimball#Vimball(really,...) if !isdirectory(dirname) " call Decho("making <".dirname.">") if exists("g:vimball_mkdir") - call system(g:vimball_mkdir." ".s:Escape(dirname)) + call system(g:vimball_mkdir." ".shellescape(dirname)) else call mkdir(dirname) endif @@ -332,11 +319,15 @@ fun! vimball#Vimball(really,...) " write tab to file if a:really - let fnamepath= s:Path(home."/".fname,'') + let fnamepath= home."/".fname " call Decho("exe w! ".fnameescape(fnamepath)) - exe "silent w! ".fnameescape(fnamepath) - echo "wrote ".fnamepath - call s:RecordInVar(home,"call delete('".fnameescape(fnamepath)."')") + if fenc != "" + exe "silent w! ++enc=".fnameescape(fenc)." ".fnameescape(fnamepath) + else + exe "silent w! ".fnameescape(fnamepath) + endif + echo "wrote ".fnameescape(fnamepath) + call s:RecordInVar(home,"call delete('".fnamepath."')") endif " return to tab with vimball @@ -358,9 +349,9 @@ fun! vimball#Vimball(really,...) " set up help " call Decho("about to set up help: didhelp<".didhelp.">") if didhelp != "" - let htpath= s:Path(home."/".didhelp,"") + let htpath= home."/".didhelp " call Decho("exe helptags ".htpath) - exe "helptags ".htpath + exe "helptags ".fnameescape(htpath) echo "did helptags" endif @@ -415,7 +406,7 @@ fun! vimball#RmVimball(...) if a:0 >= 2 let home= expand(a:2) else - let home= s:VimballHome() + let home= vimball#VimballHome() endif let curdir = getcwd() " call Decho("home <".home.">") @@ -429,19 +420,20 @@ fun! vimball#RmVimball(...) keepalt keepjumps 1split silent! keepalt keepjumps e .VimballRecord let keepsrch= @/ -" call Decho("search for ^".curfile.".vba:") -" call Decho("search for ^".curfile."[-0-9.]*.vba:") - if search('^'.curfile.": ".'cw') +" call Decho('search for ^\M'.curfile.'.\m: ') +" call Decho('search for ^\M'.curfile.'.\mvba: ') +" call Decho('search for ^\M'.curfile.'\m[-0-9.]*\.vba: ') + if search('^\M'.curfile."\m: ".'cw') let foundit= 1 - elseif search('^'.curfile.".vba: ",'cw') + elseif search('^\M'.curfile.".\mvba: ",'cw') let foundit= 1 - elseif search('^'.curfile.'[-0-9.]*.vba: ','cw') + elseif search('^\M'.curfile.'\m[-0-9.]*\.vba: ','cw') let foundit= 1 else let foundit = 0 endif if foundit - let exestring = substitute(getline("."),'^'.curfile.'\S\{-}\.vba: ','','') + let exestring = substitute(getline("."),'^\M'.curfile.'\m\S\{-}\.vba: ','','') let s:VBRstring= substitute(exestring,'call delete(','','g') let s:VBRstring= substitute(s:VBRstring,"[')]",'','g') " call Decho("exe ".exestring) @@ -469,62 +461,62 @@ endfun " --------------------------------------------------------------------- " vimball#Decompress: attempts to automatically decompress vimballs {{{2 -fun! vimball#Decompress(fname) -" call Dfunc("Decompress(fname<".a:fname.">)") +fun! vimball#Decompress(fname,...) +" call Dfunc("Decompress(fname<".a:fname.">) a:0=".a:0) " decompression: if expand("%") =~ '.*\.gz' && executable("gunzip") " handle *.gz with gunzip - silent exe "!gunzip ".s:Escape(a:fname) + silent exe "!gunzip ".shellescape(a:fname) if v:shell_error != 0 call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) gunzip may have failed with <".a:fname.">") endif let fname= substitute(a:fname,'\.gz$','','') exe "e ".escape(fname,' \') - call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") + if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif elseif expand("%") =~ '.*\.gz' && executable("gzip") " handle *.gz with gzip -d - silent exe "!gzip -d ".s:Escape(a:fname) + silent exe "!gzip -d ".shellescape(a:fname) if v:shell_error != 0 call vimball#ShowMesg(s:WARNING,'(vimball#Decompress) "gzip -d" may have failed with <'.a:fname.">") endif let fname= substitute(a:fname,'\.gz$','','') exe "e ".escape(fname,' \') - call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") + if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif elseif expand("%") =~ '.*\.bz2' && executable("bunzip2") " handle *.bz2 with bunzip2 - silent exe "!bunzip2 ".s:Escape(a:fname) + silent exe "!bunzip2 ".shellescape(a:fname) if v:shell_error != 0 call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) bunzip2 may have failed with <".a:fname.">") endif let fname= substitute(a:fname,'\.bz2$','','') exe "e ".escape(fname,' \') - call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") + if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif elseif expand("%") =~ '.*\.bz2' && executable("bzip2") " handle *.bz2 with bzip2 -d - silent exe "!bzip2 -d ".s:Escape(a:fname) + silent exe "!bzip2 -d ".shellescape(a:fname) if v:shell_error != 0 call vimball#ShowMesg(s:WARNING,'(vimball#Decompress) "bzip2 -d" may have failed with <'.a:fname.">") endif let fname= substitute(a:fname,'\.bz2$','','') exe "e ".escape(fname,' \') - call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") + if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif elseif expand("%") =~ '.*\.zip' && executable("unzip") " handle *.zip with unzip - silent exe "!unzip ".s:Escape(a:fname) + silent exe "!unzip ".shellescape(a:fname) if v:shell_error != 0 call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) unzip may have failed with <".a:fname.">") endif let fname= substitute(a:fname,'\.zip$','','') exe "e ".escape(fname,' \') - call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") + if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif endif - set noma bt=nofile fmr=[[[,]]] fdm=marker + if a:0 == 0| setlocal noma bt=nofile fmr=[[[,]]] fdm=marker | endif " call Dret("Decompress") endfun @@ -533,20 +525,21 @@ endfun " vimball#ShowMesg: {{{2 fun! vimball#ShowMesg(level,msg) " call Dfunc("vimball#ShowMesg(level=".a:level." msg<".a:msg.">)") + let rulerkeep = &ruler let showcmdkeep = &showcmd set noruler noshowcmd redraw! if &fo =~ '[ta]' - echomsg "***vimball*** " a:msg + echomsg "***vimball*** ".a:msg else if a:level == s:WARNING || a:level == s:USAGE echohl WarningMsg elseif a:level == s:ERROR echohl Error endif - echomsg "***vimball*** " a:msg + echomsg "***vimball*** ".a:msg echohl None endif @@ -571,27 +564,6 @@ fun! s:ChgDir(newdir) " call Dret("ChgDir : curdir<".getcwd().">") endfun -" --------------------------------------------------------------------- -" s:Path: prepend and append quotes and do escaping {{{2 -fun! s:Path(cmd,quote) -" call Dfunc("Path(cmd<".a:cmd."> quote<".a:quote.">) vimball_path_escape<".g:vimball_path_escape.">") - if (has("win32") || has("win95") || has("win64") || has("win16")) -" let cmdpath= a:quote.substitute(a:cmd,'/','\\','g').a:quote - let cmdpath= a:quote.substitute(a:cmd,'\\','/','g').a:quote -" call Decho("cmdpath<".cmdpath."> (win32 mod)") - else - let cmdpath= a:quote.a:cmd.a:quote -" call Decho("cmdpath<".cmdpath."> (not-win32 mod)") - endif - if a:quote == "" && g:vimball_path_escape !~ ' ' - let cmdpath= escape(cmdpath,' ') -" call Decho("cmdpath<".cmdpath."> (empty quote case)") - endif - let cmdpath= escape(cmdpath,g:vimball_path_escape) -" call Dret("Path <".cmdpath.">") - return cmdpath -endfun - " --------------------------------------------------------------------- " s:RecordInVar: record a un-vimball command in the .VimballRecord file {{{2 fun! s:RecordInVar(home,cmd) @@ -664,9 +636,9 @@ fun! s:RecordInFile(home) endfun " --------------------------------------------------------------------- -" s:VimballHome: determine/get home directory path (usually from rtp) {{{2 -fun! s:VimballHome() -" call Dfunc("VimballHome()") +" vimball#VimballHome: determine/get home directory path (usually from rtp) {{{2 +fun! vimball#VimballHome() +" call Dfunc("vimball#VimballHome()") if exists("g:vimball_home") let home= g:vimball_home else @@ -692,14 +664,14 @@ fun! s:VimballHome() if !isdirectory(home) if exists("g:vimball_mkdir") " call Decho("home<".home."> isn't a directory -- making it now with g:vimball_mkdir<".g:vimball_mkdir.">") -" call Decho("system(".g:vimball_mkdir." ".s:Escape(home).")") - call system(g:vimball_mkdir." ".s:Escape(home)) +" call Decho("system(".g:vimball_mkdir." ".shellescape(home).")") + call system(g:vimball_mkdir." ".shellescape(home)) else " call Decho("home<".home."> isn't a directory -- making it now with mkdir()") call mkdir(home) endif endif -" call Dret("VimballHome <".home.">") +" call Dret("vimball#VimballHome <".home.">") return home endfun @@ -713,14 +685,14 @@ fun! vimball#SaveSettings() let s:acdkeep = &acd endif let s:eikeep = &ei - let s:fenkeep = &fen + let s:fenkeep = &l:fen let s:hidkeep = &hidden let s:ickeep = &ic let s:lzkeep = &lz let s:pmkeep = &pm let s:repkeep = &report let s:vekeep = &ve - let s:ffkeep = &ff + let s:ffkeep = &l:ff if exists("&acd") setlocal ei=all ve=all noacd nofen noic report=999 nohid bt= ma lz pm= ff=unix else @@ -739,7 +711,7 @@ fun! vimball#RestoreSettings() if exists("&acd") let &acd = s:acdkeep endif - let &fen = s:fenkeep + let &l:fen = s:fenkeep let &hidden = s:hidkeep let &ic = s:ickeep let &lz = s:lzkeep @@ -747,7 +719,7 @@ fun! vimball#RestoreSettings() let &report = s:repkeep let &ve = s:vekeep let &ei = s:eikeep - let &ff = s:ffkeep + let &l:ff = s:ffkeep if s:makeep[0] != 0 " restore mark a " call Decho("restore mark-a: makeep=".string(makeep)) @@ -760,21 +732,6 @@ fun! vimball#RestoreSettings() " call Dret("RestoreSettings") endfun -" --------------------------------------------------------------------- -" s:Escape: {{{2 -fun s:Escape(name) - " shellescape() was added by patch 7.0.111 - if exists("*shellescape") - return shellescape(a:name) - endif - return g:netrw_shq . a:name . g:netrw_shq -endfun - -" --------------------------------------------------------------------- -" Restore: -let &cpo= s:keepcpo -unlet s:keepcpo - " --------------------------------------------------------------------- " Modelines: {{{1 " vim: fdm=marker diff --git a/vimfiles/doc/Align.txt b/vimfiles/doc/Align.txt index ce80238..c447372 100644 --- a/vimfiles/doc/Align.txt +++ b/vimfiles/doc/Align.txt @@ -1,4 +1,4 @@ -*align.txt* The Alignment Tool Oct 29, 2008 +*align.txt* The Alignment Tool Mar 04, 2009 Author: Charles E. Campbell, Jr. (remove NOSPAM from Campbell's email first) @@ -51,8 +51,17 @@ Copyright: (c) 2004-2008 by Charles E. Campbell, Jr. *Align-copyright* ============================================================================== 2. Align Manual *alignman* *alignmanual* *align-manual* {{{1 - To Enable: put and into your .vim/plugin - To see a user's guide, see |align-usage| + Align comes as a vimball; simply typing > + vim Align.vba.gz + :so % +< should put its components where they belong. The components are: > + .vim/plugin/AlignPlugin.vim + .vim/plugin/AlignMapsPlugin.vim + .vim/plugin/cecutil.vim + .vim/autoload/Align.vim + .vim/autoload/AlignMaps.vim + .vim/doc/Align.txt +< To see a user's guide, see |align-userguide| To see examples, see |alignctrl| and |alignmaps| > /=============+=========+=====================================================\ @@ -130,7 +139,7 @@ Copyright: (c) 2004-2008 by Charles E. Campbell, Jr. *Align-copyright* \=============================================================================/ ============================================================================== -3. Alignment Usage *alignusage* *align-usage* {{{1 +3. Alignment Usage *alignusage* *align-usage* *align-userguide* {{{1 ALIGNMENT CONCEPTS *align-concept* *align-concepts* {{{2 @@ -179,8 +188,8 @@ ALIGNMENT CONCEPTS *align-concept* *align-concepts* {{{2 xx = yy = zz = 4; zzz = yyy = zzz = 5; a = b = c = 3; -< There are more options available for field justification: see - |alignctrl-c|. +< There are many more options available for field justification: see + |alignctrl-c| and |alignctrl--|. Separators, although commonly only one character long, are actually specified by regular expressions (see |regexp|), and one may left @@ -221,7 +230,7 @@ ALIGNMENT COMMANDS *align-command* *align-commands* {{{2 ex. :%Align , Interpretation: align all commas over the entire file. -< The :Align! format permits alignment control commands +< The :Align! format permits alignment control commands to precede the alignment patterns. > ex. :%Align! p2P2 = < This will align all "=" in the file with two padding @@ -229,7 +238,7 @@ ALIGNMENT COMMANDS *align-command* *align-commands* {{{2 NOTE ON USING PATTERNS WITH ALIGN:~ Align and AlignCtrl use || to obtain their - input patterns and they use an internal function to + input patterns and they use an internal function to split arguments at whitespace unless inside "..."s. One may escape characters inside a double-quote string by preceding such characters with a backslash. @@ -249,7 +258,8 @@ ALIGNMENT COMMANDS *align-command* *align-commands* {{{2 used (at least once) previously; this command restores the AlignCtrl settings when AlignPush was last used. -< +< Also see |alignctrl-m| for a way to automatically do + an AlignPop after an Align (primarily this is for maps). ALIGNMENT OPTIONS *align-option* *align-options* {{{2 *align-utf8* *align-utf* *align-codepoint* *align-strlen* *align-multibyte* @@ -258,9 +268,20 @@ ALIGNMENT OPTIONS *align-option* *align-options* {{{2 available with utf-8, Align now provides a special option which you may choose based upon your needs: + Use Built-in strlen() ~ +> + let g:Align_xstrlen= 0 + +< This is the fastest method, but it doesn't handle multibyte characters + well. It is the default for: + + enc=latin1 + vim compiled without multi-byte support + $LANG is en_US.UTF-8 (assuming USA english) + Number of codepoints (Latin a + combining circumflex is two codepoints)~ > - let g:Align_xstrlen= 1: + let g:Align_xstrlen= 1 (default) < Number of spacing codepoints (Latin a + combining circumflex is one~ spacing codepoint; a hard tab is one; wide and narrow CJK are one~ @@ -276,7 +297,7 @@ ALIGNMENT OPTIONS *align-option* *align-options* {{{2 < By putting one of these settings into your <.vimrc>, Align will use an internal (interpreted) function to determine a string's length instead - of the Vim's built-in |strlen()| function. As the function is + of the Vim's built-in |strlen()| function. Since the function is interpreted, Align will run a bit slower but will handle such strings correctly. The last setting (g:Align_xstrlen= 3) probably will run the slowest but be the most accurate. (thanks to Tony Mechelynck for @@ -286,17 +307,17 @@ ALIGNMENT OPTIONS *align-option* *align-options* {{{2 ALIGNMENT CONTROL *alignctrl* *align-control* {{{2 This command doesn't do the alignment operation itself; instead, it - controls the subsequent alignment operation(s). + controls subsequent alignment operation(s). The first argument to AlignCtrl is a string which may contain one or - more alignment control commands. Most of the commands are single - letter commands; the exceptions are the p# and P# commands which - interpret digits following the p or P as specifying padding about the + more alignment control settings. Most of the settings are specified + by single letters; the exceptions are the p# and P# commands which + interpret a digit following the p or P as specifying padding about the separator. The typical text line is considered to be composed of two or more - fields separated by one or more separator pattern(s): -> + fields separated by one or more separator pattern(s): > + ws field ws separator ws field ws separator ... < where "ws" stands for "white space" such as blanks and/or tabs. @@ -306,9 +327,11 @@ ALIGNMENT CONTROL *alignctrl* *align-control* {{{2 As a result, separators may not have white space (tabs or blanks) on their outsides (ie. ": :" is fine as a separator, but " :: " is - not). Usually such separators are not needed. + not). Usually such separators are not needed, although a map has been + provided which works around this limitation and aligns on whitespace + (see |alignmap-tsp|). - However, if you really need to have such separators with leading or + However, if you really need to have separators with leading or trailing whitespace, consider handling them by performing a substitute first (ie. s/ :: /@/g), do the alignment on the temporary pattern (ie. @), and then perform a substitute to revert the separators back @@ -401,11 +424,11 @@ ALIGNMENT CONTROL *alignctrl* *align-control* {{{2 The first "=" separator is skipped by the "-" specification, and so "a=bb", "ccc=a", and "dd=eee" are considered as single fields. - + The next "=" separator has its (left side) field left-justified. Due to the cyclic nature of separator patterns, the "-l" specification is equivalent to "-l-l-l ...". - + Hence the next specification is a "skip", so "ccc=1", etc are fields. In the second example in "More justification options": @@ -533,7 +556,7 @@ ALIGNMENT CONTROL *alignctrl* *align-control* {{{2 Separators may be of differing lengths as shown in the example below. Hence they too may be justified left, right, or centered. - Furthermore, separator justification specification is cyclic: + Furthermore, separator justification specifications are cyclic: < means <<<<<... justify separator(s) to the left > means >>>>>... justify separator(s) to the right @@ -595,7 +618,7 @@ ALIGNMENT CONTROL *alignctrl* *align-control* {{{2 AlignCtrl v < To see what g/v patterns are currently active, just use the reporting - capability of a plain AlignCtrl call: > + capability of an unadorned call to AlignCtrl: > AlignCtrl < @@ -656,6 +679,13 @@ ALIGNMENT CONTROL *alignctrl* *align-control* {{{2 padded on the right with spaces (left justification), and separators will be padded on each side with a single space. + To change one of these items, see: + + AlignCtrl......|alignctrl| + qty............|align-concept| + AlignStyle.....|alignctrl--| |alignctrl-+| |alignctrl-:||alignctrl-c| + Padding........|alignctrl-p| |alignctrl-P| + One may get a string which can be fed back into AlignCtrl: > :let alignctrl= Align#AlignCtrl() @@ -680,7 +710,7 @@ ALIGNMENT *align-align* {{{2 :[range]Align [list-of-separators] < - where the |range| is the usual Vim-powered set of possibilities; the + where the |:range| is the usual Vim-powered set of possibilities; the list of separators is the same as the AlignCtrl capability. There is only one list of separators, but either AlignCtrl or Align can be used to specify that list. @@ -728,19 +758,19 @@ ALIGNMENT *align-align* {{{2 ============================================================================== 4. Alignment Maps *alignmaps* *align-maps* {{{1 - There are a number of maps using Align#AlignCtrl() and Align#Align() in the - file. This file may also be put into the plugins - subdirectory. Since AlignCtrl and Align supercede textab and its - file, the maps either have a leading "t" (for "textab") - or the more complicated ones an "a" (for "alignment") for backwards - compatibility. + There are a number of maps using Align#AlignCtrl() and Align#Align() + in the file. This file may also be put into the + plugins subdirectory. Since AlignCtrl and Align supercede textab and + its file, the maps either have a leading "t" (for + "textab") or the more complicated ones an "a" (for "alignment") for + backwards compatibility. - Thee maps are shown below with a leading backslash (\). Actually, - the construct is used (see :help mapleader), so the leading - map kick-off character is easily customized. + The maps are shown below with a leading backslash (\). Actually, the + construct is used (see |mapleader|), so the maps' leading + kick-off character is easily customized. - Furthermore, all AlignMaps.vim maps use the construct (see - ||and | construct (see + ||and |usr_41.txt|). Hence, if one wishes to override the mapping entirely, one may do that, too. As an example: > map ACOM AM_acom < would have \ACOM do what \acom previously did (assuming that the @@ -748,6 +778,7 @@ ALIGNMENT *align-align* {{{2 \a, : useful for breaking up comma-separated declarations prior to \adec |alignmap-a,| + \a( : aligns ( and , (useful for prototypes) *alignmap-a(* \a? : aligns (...)? ...:... expressions on ? and : |alignmap-a?| \a< : aligns << and >> for c++ |alignmap-a<| \a= : aligns := assignments |alignmap-a=| @@ -777,6 +808,12 @@ ALIGNMENT *align-align* {{{2 (left justified) \ts, : like \t, but swaps whitespace on the right of *alignmap-ts,* the commas to their left + \ts: : like \t: but swaps whitespace on the right of *alignmap-ts:* + the colons to their left + \ts< : like \t< but swaps whitespace on the right of *alignmap-ts<* + the less-than signs to their left + \ts= : like \t= but swaps whitespace on the right of *alignmap-ts=* + the equals signs to their left \Tsp : use Align to make a table separated by blanks |alignmap-Tsp| (right justified) \tsq : use Align to make a table separated by blanks |alignmap-tsq| @@ -808,7 +845,7 @@ ALIGNMENT *align-align* {{{2 ALIGNMENT MAP USE WITH VISUAL MODE~ Alternatively, one may select the text with the "V" visual mode - selector. + command. ALIGNMENT MAP USE WITH MENUS~ One may use the mark-and-move style (ma, move, use the menu) or @@ -816,7 +853,7 @@ ALIGNMENT *align-align* {{{2 the alignment map with menu selection). The alignment map menu items are under DrChip.AlignMaps . - One may change the top level menu name to whatever is wished; by + One may even change the top level menu name to whatever is wished; by default, its > let g:DrChipTopLvlMenu= "DrChip." < If you set the variable to the empty string (""), then no menu items @@ -825,14 +862,19 @@ ALIGNMENT *align-align* {{{2 must be included). COMPLEX ALIGNMENT MAP METHOD~ + For those complex alignment maps which do alignment on constructs (e.g. \acom, \adec, etc), a series of substitutes is used to insert - "@" symbols in appropriate locations. Align#Align() is then used to do - alignment directly on "@"s; then it is followed by further substitutes - to do clean-up. However, the maps \WS and \WE protect any original - embedded "@" symbols by first converting them to characters, - doing the requested job, and then converting them back. + "@" symbols in appropriate locations. Align#Align() is then used to + do alignment directly on "@"s; then it is followed by further + substitutes to do clean-up. However, the maps \WS and \WE, used by + every map supported by AlignMaps, protect any original embedded "@" + symbols by first converting them to characters, doing the + requested job, and then converting them back. > + \WS calls AlignMaps#WrapperStart() + \WE calls AlignMaps#WrapperEnd() +< --------------------------- Alignment Map Examples: \a, *alignmap-a,* {{{3 @@ -1136,7 +1178,7 @@ ALIGNMENT *align-align* {{{2 Also see |alignmap-acom| - --------------------------- + --------------------------- *alignmap-Tsp* Alignment Map Examples: \tsp *alignmap-tsp* {{{3 --------------------------- @@ -1266,9 +1308,14 @@ ALIGNMENT *align-align* {{{2 ...field three... ...field four... < ============================================================================== -4. Alignment Tool History *align-history* {{{1 +4. Alignment Tools' History *align-history* {{{1 ALIGN HISTORY {{{2 + 35 : Nov 02, 2008 * g:loaded_AlignPlugin testing to prevent re-loading + installed + Nov 19, 2008 * new sanity check for an AlignStyle of just ":" + Jan 08, 2009 * save&restore of |'mod'| now done with local + variant 34 : Jul 08, 2008 * using :AlignCtrl before entering any alignment control commands was causing an error. 33 : Sep 20, 2007 * s:Strlen() introduced to support various ways @@ -1330,11 +1377,19 @@ ALIGN HISTORY {{{2 11 : Jul 08, 2002 : prevent separator patterns which match zero length -+: included as additional alignment/justification styles - 10 : Jun 26, 2002 : =~# used instead of =~ (for matching case) + 10 : Jun 26, 2002 : =~# used instead of =~ (for matching case) ignorecase option handled 9 : Jun 25, 2002 : implemented cyclic padding ALIGNMENT MAP HISTORY *alignmap-history* {{{2 + v41 Nov 02, 2008 * g:loaded_AlignMapsPlugin testing to prevent + re-loading installed + * AlignMaps now use 0x0f (ctrl-p) for special + character substitutions (instead of 0xff). + Seems to avoid some problems with having to + use Strlen(). + * bug fixed with \ts, + * new maps: \ts; \ts, \ts: \ts< \ts= \a( v40 Oct 21, 2008 * Modified AlignMaps so that its maps use s and