# HG changeset patch # User Bram Moolenaar # Date 1262807692 -3600 # Node ID 7bc41231fbc77c4c866eb6e170b93d268b47ad0e # Parent de5a43c5eedc537e4dcdcdbddeea496088063683 Update runtime files. diff --git a/runtime/autoload/ada.vim b/runtime/autoload/ada.vim --- a/runtime/autoload/ada.vim +++ b/runtime/autoload/ada.vim @@ -1,15 +1,15 @@ "------------------------------------------------------------------------------ " Description: Perform Ada specific completion & tagging. " Language: Ada (2005) -" $Id$ +" $Id: ada.vim 887 2008-07-08 14:29:01Z krischik $ " Maintainer: Martin Krischik " Taylor Venable " Neil Bird " Ned Okie -" $Author$ -" $Date$ +" $Author: krischik $ +" $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $ " Version: 4.6 -" $Revision$ +" $Revision: 887 $ " $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/autoload/ada.vim $ " History: 24.05.2006 MK Unified Headers " 26.05.2006 MK ' should not be in iskeyword. diff --git a/runtime/autoload/adacomplete.vim b/runtime/autoload/adacomplete.vim --- a/runtime/autoload/adacomplete.vim +++ b/runtime/autoload/adacomplete.vim @@ -1,12 +1,12 @@ "------------------------------------------------------------------------------ " Description: Vim Ada omnicompletion file " Language: Ada (2005) -" $Id$ +" $Id: adacomplete.vim 887 2008-07-08 14:29:01Z krischik $ " Maintainer: Martin Krischik -" $Author$ -" $Date$ +" $Author: krischik $ +" $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $ " Version: 4.6 -" $Revision$ +" $Revision: 887 $ " $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/autoload/adacomplete.vim $ " History: 24.05.2006 MK Unified Headers " 26.05.2006 MK improved search for begin of word. diff --git a/runtime/autoload/decada.vim b/runtime/autoload/decada.vim --- a/runtime/autoload/decada.vim +++ b/runtime/autoload/decada.vim @@ -1,13 +1,13 @@ "------------------------------------------------------------------------------ " Description: Vim Ada/Dec Ada compiler file " Language: Ada (Dec Ada) -" $Id$ +" $Id: decada.vim 887 2008-07-08 14:29:01Z krischik $ " Copyright: Copyright (C) 2006 Martin Krischik " Maintainer: Martin Krischik -" $Author$ -" $Date$ +" $Author: krischik $ +" $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $ " Version: 4.6 -" $Revision$ +" $Revision: 887 $ " $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/autoload/decada.vim $ " History: 21.07.2006 MK New Dec Ada " 15.10.2006 MK Bram's suggestion for runtime integration diff --git a/runtime/autoload/getscript.vim b/runtime/autoload/getscript.vim --- a/runtime/autoload/getscript.vim +++ b/runtime/autoload/getscript.vim @@ -1,8 +1,8 @@ " --------------------------------------------------------------------- " getscript.vim " Author: Charles E. Campbell, Jr. -" Date: Jul 10, 2008 -" Version: 31 +" Date: Dec 28, 2009 +" Version: 32 " Installing: :help glvs-install " Usage: :help glvs " @@ -12,19 +12,24 @@ " Initialization: {{{1 " if you're sourcing this file, surely you can't be " expecting vim to be in its vi-compatible mode! +if exists("g:loaded_getscript") + finish +endif +let g:loaded_getscript= "v32" if &cp echoerr "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)" finish endif +if v:version < 702 + echohl WarningMsg + echo "***warning*** this version of getscript needs vim 7.2" + echohl Normal + finish +endif let s:keepcpo = &cpo set cpo&vim "DechoTabOn -if exists("g:loaded_getscript") - finish -endif -let g:loaded_getscript= "v31" - " --------------------------- " Global Variables: {{{1 " --------------------------- @@ -40,25 +45,6 @@ if !exists("g:getscript_cygwin") 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") @@ -112,7 +98,9 @@ if g:GetLatestVimScripts_allowautoinstal endif endif - if exists('$HOME') && isdirectory(expand("$HOME")."/".s:dotvim) + if exists("g:GetLatestVimScripts_autoinstalldir") && isdirectory(g:GetLatestVimScripts_autoinstalldir) + let s:autoinstall= g:GetLatestVimScripts_autoinstalldir" + elseif exists('$HOME') && isdirectory(expand("$HOME")."/".s:dotvim) let s:autoinstall= $HOME."/".s:dotvim endif " call Decho("s:autoinstall<".s:autoinstall.">") @@ -165,7 +153,6 @@ fun! getscript#GetLatestVimScripts() " 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.">") @@ -182,21 +169,29 @@ fun! getscript#GetLatestVimScripts() " call Dret("GetLatestVimScripts : non-writable datafile<".datafile.">") return endif + " -------------------- + " Passed sanity checks + " -------------------- + " call Decho("datadir <".datadir.">") " call Decho("datafile <".datafile.">") - " don't let any events interfere (like winmanager's, taglist's, etc) - let eikeep= &ei - let hlskeep= &hls - set ei=all hls&vim + " don't let any event handlers interfere (like winmanager's, taglist's, etc) + let eikeep = &ei + let hlskeep = &hls + let acdkeep = &acd + set ei=all hls&vim noacd - " record current directory, change to datadir, open split window with - " datafile + " Edit the datafile (ie. GetLatestVimScripts.dat): + " 1. record current directory (origdir), + " 2. change directory to datadir, + " 3. split window + " 4. edit datafile let origdir= getcwd() " call Decho("exe cd ".fnameescape(substitute(datadir,'\','/','ge'))) exe "cd ".fnameescape(substitute(datadir,'\','/','ge')) split -" call Decho("exe e ".fnameescape(substitute(datafile,'\','/','ge'))) +" call Decho("exe e ".fnameescape(substitute(datafile,'\','/','ge'))) exe "e ".fnameescape(substitute(datafile,'\','/','ge')) res 1000 let s:downloads = 0 @@ -207,69 +202,68 @@ fun! getscript#GetLatestVimScripts() " call Decho("searching plugins for GetLatestVimScripts dependencies") let lastline = line("$") " call Decho("lastline#".lastline) - let plugins = split(globpath(&rtp,"plugin/*.vim"),'\n') + let firstdir = substitute(&rtp,',.*$','','') + let plugins = split(globpath(firstdir,"plugin/*.vim"),'\n') + let plugins = plugins + split(globpath(firstdir,"AsNeeded/*.vim"),'\n') let foundscript = 0 - let firstdir= "" - - for plugin in plugins -" call Decho("plugin<".plugin.">") - " 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 + " this loop updates the GetLatestVimScripts.dat file + " with dependencies explicitly mentioned in the plugins + " via GetLatestVimScripts: ... lines + " It reads the plugin script at the end of the GetLatestVimScripts.dat + " file, examines it, and then removes it. + for plugin in plugins +" call Decho(" ") +" call Decho("plugin<".plugin.">") " read plugin in " evidently a :r creates a new buffer (the "#" buffer) that is subsequently unused -- bwiping it $ -" call Decho(" ") " call Decho(".dependency checking<".plugin."> line$=".line("$")) -" call Decho("exe silent r ".fnameescape(plugin)) +" call Decho("..exe silent r ".fnameescape(plugin)) exe "silent r ".fnameescape(plugin) exe "silent bwipe ".bufnr("#") 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) + let depscript = substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\d\+\s\+\d\+\s\+\(.*\)$','\1','e') + let depscriptid = substitute(getline("."),'^"\s\+GetLatestVimScripts:\s\+\(\d\+\)\s\+.*$','\1','') + let llp1 = lastline+1 +" call Decho("..depscript<".depscript.">") - 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 + " found a "GetLatestVimScripts: # #" line in the script; + " check if its already in the datafile by searching backwards from llp1, + " the (prior to reading in the plugin script) last line plus one of the GetLatestVimScripts.dat file, + " for the script-id with no wrapping allowed. + let curline = line(".") + let noai_script = substitute(depscript,'\s*:AutoInstall:\s*','','e') + exe llp1 + let srchline = search('^\s*'.depscriptid.'\s\+\d\+\s\+.*$','bW') + if srchline == 0 + " this second search is taken when, for example, a 0 0 scriptname is to be skipped over + let srchline= search('\<'.noai_script.'\>','bW') + endif +" call Decho("..noai_script<".noai_script."> depscriptid#".depscriptid." srchline#".srchline." curline#".line(".")." lastline#".lastline) - let curline = curline + 1 - exe curline + 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\+','','') + echomsg "Appending <".@a."> to ".datafile." for ".depscript +" call Decho("..Appending <".@a."> to ".datafile." for ".depscript) + exe lastline."put a" + 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 endwhile + " llp1: last line plus one let llp1= lastline + 1 " call Decho(".deleting lines: ".llp1.",$d") exe "silent! ".llp1.",$d" @@ -282,7 +276,9 @@ fun! getscript#GetLatestVimScripts() 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 @@ -322,8 +318,9 @@ fun! getscript#GetLatestVimScripts() " restore events and current directory exe "cd ".fnameescape(substitute(origdir,'\','/','ge')) - let &ei= eikeep - let &hls= hlskeep + let &ei = eikeep + let &hls = hlskeep + let &acd = acdkeep setlocal nolz " call Dredir("BUFFER TEST (GetLatestVimScripts 2)","ls!") " call Dret("GetLatestVimScripts : did ".s:downloads." downloads") @@ -333,7 +330,7 @@ endfun " 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. +" It downloads any scripts that have newer versions from vim.sourceforge.net. fun! s:GetOneScript(...) " call Dfunc("GetOneScript()") @@ -391,6 +388,7 @@ fun! s:GetOneScript(...) " call Decho("fname <".fname.">") endif + " plugin author protection from downloading his/her own scripts atop their latest work if scriptid == 0 || srcid == 0 " When looking for :AutoInstall: lines, skip scripts that have 0 0 scriptname let @a= rega @@ -416,21 +414,21 @@ fun! s:GetOneScript(...) " call Decho('considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid) echo '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 + " grab a copy of the plugin's vim.sourceforge.net webpage + let scriptaddr = 'http://vim.sourceforge.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) +" 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." ".s:Escape(tmpfile).' '.s:Escape(scriptaddr)."|bw!") - new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".s:Escape(tmpfile).' '.s:Escape(scriptaddr)|bw! +" call Decho(".new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile).' '.shellescape(scriptaddr)."|bw!") + new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile).' '.shellescape(scriptaddr)|bw! else -" call Decho("exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".s:Escape(tmpfile)." ".s:Escape(scriptaddr)) - exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".s:Escape(tmpfile)." ".s:Escape(scriptaddr) +" call Decho(".exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile)." ".shellescape(scriptaddr)) + exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(tmpfile)." ".shellescape(scriptaddr) endif if itry == 1 exe "silent vsplit ".fnameescape(tmpfile) @@ -495,8 +493,7 @@ fun! s:GetOneScript(...) 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 + " 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.">") @@ -506,65 +503,103 @@ fun! s:GetOneScript(...) 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.">" + " ----------------------------------------------------------------------------- +" 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." ".s:Escape(sname)." ".s:Escape('http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid)."|q") - new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".s:Escape(sname)." ".s:Escape('http://vim.sf.net/scripts/download_script.php?src_id='.latestsrcid)|q +" call Decho(".new|exe silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id='.latestsrcid)."|q") + new|exe "silent r!".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id='.latestsrcid)|q else -" call Decho("exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".s:Escape(sname)." ".s:Escape('http://vim.sf.net/scripts/download_script.php?src_id=')) - exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".s:Escape(sname)." ".s:Escape('http://vim.sf.net/scripts/download_script.php?src_id=').latestsrcid +" call Decho(".exe silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id=')) + exe "silent !".g:GetLatestVimScripts_wget." ".g:GetLatestVimScripts_options." ".shellescape(sname)." ".shellescape('http://vim.sourceforge.net/scripts/download_script.php?src_id=').latestsrcid 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)) +" call Decho(" ") +" call Decho("Autoinstall: getcwd<".getcwd()."> filereadable(".sname.")=".filereadable(sname)) if filereadable(sname) -" call Decho("exe silent !".g:GetLatestVimScripts_mv." ".s:Escape(sname)." ".s:Escape(s:autoinstall)) - exe "silent !".g:GetLatestVimScripts_mv." ".s:Escape(sname)." ".s:Escape(s:autoinstall) +" call Decho("<".sname."> is readable") +" call Decho("exe silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".shellescape(s:autoinstall)) + exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".shellescape(s:autoinstall) let curdir = escape(substitute(getcwd(),'\','/','ge'),"|[]*'\" #") let installdir= curdir."/Installed" if !isdirectory(installdir) call mkdir(installdir) endif -" call Decho("exe cd ".fnameescape(s:autoinstall)) +" call Decho("curdir<".curdir."> installdir<".installdir.">") +" call Decho("exe cd ".fnameescape(s:autoinstall)) exe "cd ".fnameescape(s:autoinstall) + + " determine target directory for moves + let firstdir= substitute(&rtp,',.*$','','') + let pname = substitute(sname,'\..*','.vim','') +" call Decho("determine tgtdir: is <".firstdir.'/AsNeeded/'.pname." readable?") + if filereadable(firstdir.'/AsNeeded/'.pname) + let tgtdir= "AsNeeded" + else + let tgtdir= "plugin" + endif +" call Decho("tgtdir<".tgtdir."> pname<".pname.">") " decompress if sname =~ '\.bz2$' " call Decho("decompress: attempt to bunzip2 ".sname) - exe "silent !bunzip2 ".s:Escape(sname) + exe "silent !bunzip2 ".shellescape(sname) 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 ".s:Escape(sname) + exe "silent !gunzip ".shellescape(sname) let sname= substitute(sname,'\.gz$','','') " call Decho("decompress: new sname<".sname."> after gunzip") + else +" call Decho("no decompression needed") endif " distribute archive(.zip, .tar, .vba) contents if sname =~ '\.zip$' " call Decho("dearchive: attempt to unzip ".sname) - exe "silent !unzip -o ".s:Escape(sname) + exe "silent !unzip -o ".shellescape(sname) elseif sname =~ '\.tar$' " call Decho("dearchive: attempt to untar ".sname) - exe "silent !tar -xvf ".s:Escape(sname) + exe "silent !tar -xvf ".shellescape(sname) elseif sname =~ '\.vba$' " call Decho("dearchive: attempt to handle a vimball: ".sname) silent 1split + if exists("g:vimball_home") + let oldvimballhome= g:vimball_home + endif + let g:vimball_home= s:autoinstall exe "silent e ".fnameescape(sname) silent so % silent q + if exists("oldvimballhome") + let g:vimball_home= oldvimballhome + else + unlet g:vimball_home + endif + else +" call Decho("no dearchiving needed") endif + " --------------------------------------------- + " move plugin to plugin/ or AsNeeded/ directory + " --------------------------------------------- if sname =~ '.vim$' -" call Decho("dearchive: attempt to simply move ".sname." to plugin") - exe "silent !".g:GetLatestVimScripts_mv." ".s:Escape(sname)." plugin" +" call Decho("dearchive: attempt to simply move ".sname." to ".tgtdir) + exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".tgtdir else " call Decho("dearchive: move <".sname."> to installdir<".installdir.">") - exe "silent !".g:GetLatestVimScripts_mv." ".s:Escape(sname)." ".installdir + exe "silent !".g:GetLatestVimScripts_mv." ".shellescape(sname)." ".installdir + endif + if tgtdir != "plugin" +" call Decho("exe silent !".g:GetLatestVimScripts_mv." plugin/".shellescape(pname)." ".tgtdir) + exe "silent !".g:GetLatestVimScripts_mv." plugin/".shellescape(pname)." ".tgtdir endif " helptags step @@ -600,20 +635,6 @@ fun! s:GetOneScript(...) endfun " --------------------------------------------------------------------- -" s:Escape: makes a string safe&suitable for the shell {{{2 -fun! s:Escape(name) -" call Dfunc("s:Escape(name<".a:name.">)") - if exists("*shellescape") - " shellescape() was added by patch 7.0.111 - let name= shellescape(a:name) - else - let name= g:getscript_shq . a:name . g:getscript_shq - endif -" call Dret("s:Escape ".name) - return name -endfun - -" --------------------------------------------------------------------- " Restore Options: {{{1 let &cpo= s:keepcpo unlet s:keepcpo diff --git a/runtime/autoload/gnat.vim b/runtime/autoload/gnat.vim --- a/runtime/autoload/gnat.vim +++ b/runtime/autoload/gnat.vim @@ -1,14 +1,14 @@ "------------------------------------------------------------------------------ " Description: Vim Ada/GNAT compiler file " Language: Ada (GNAT) -" $Id$ +" $Id: gnat.vim 887 2008-07-08 14:29:01Z krischik $ " Copyright: Copyright (C) 2006 Martin Krischik " Maintainer: Martin Krischi k " Ned Okie -" $Author$ -" $Date$ +" $Author: krischik $ +" $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $ " Version: 4.6 -" $Revision$ +" $Revision: 887 $ " $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/autoload/gnat.vim $ " History: 24.05.2006 MK Unified Headers " 16.07.2006 MK Ada-Mode as vim-ball diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -1,10 +1,10 @@ " netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION -" Date: Aug 08, 2008 -" Version: 132 +" 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,12 +22,18 @@ if &cp || exists("g:loaded_netrw") finish endif +let g:loaded_netrw = "v136" +if v:version < 702 + echohl WarningMsg + echo "***warning*** this version of netrw needs vim 7.2" + echohl Normal + finish +endif if !exists("s:NOTE") let s:NOTE = 0 let s:WARNING = 1 let s:ERROR = 2 endif -let g:loaded_netrw = "v132" " sanity checks if v:version < 700 @@ -45,25 +51,41 @@ setlocal cpo&vim " ====================== " --------------------------------------------------------------------- +" 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_BOOKMARKMAX") - let g:NETRW_BOOKMARKMAX= 0 -endif -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 " --------------------------------------------------------------------- " Default values for netrw's global protocol variables {{{2 if !exists("g:netrw_dav_cmd") + if executable("cadaver") let g:netrw_dav_cmd = "cadaver" + elseif executable("curl") + let g:netrw_dav_cmd = "curl" + else + let g:netrw_dav_cmd = "" + endif endif if !exists("g:netrw_fetch_cmd") if executable("fetch") @@ -78,35 +100,28 @@ endif if !exists("g:netrw_http_cmd") if executable("elinks") let g:netrw_http_cmd = "elinks" - let g:netrw_http_xcmd= "-dump >" + call s:NetrwInit("g:netrw_http_xcmd","-source >") elseif executable("links") let g:netrw_http_cmd = "links" - let g:netrw_http_xcmd= "-dump >" + call s:NetrwInit("g:netrw_http_xcmd","-source >") elseif executable("curl") - let g:netrw_http_cmd = "curl -o" + let g:netrw_http_cmd = "curl" + call s:NetrwInit("g:netrw_http_xcmd","-o") elseif executable("wget") - let g:netrw_http_cmd = "wget -q -O" + let g:netrw_http_cmd = "wget" + call s:NetrwInit("g:netrw_http_xcmd","-q -O") elseif executable("fetch") - let g:netrw_http_cmd = "fetch -o" + let g:netrw_http_cmd = "fetch" + 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") @@ -134,40 +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" +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" @@ -179,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 @@ -193,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 @@ -211,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") @@ -228,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 @@ -244,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 +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 -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 +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 +" 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") + if has("unix") + let g:netrw_sort_sequence= '[\/]$,\,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$' else - let g:netrw_mousemaps= 0 + let g:netrw_sort_sequence= '[\/]$,\.h$,\.c$,\.cpp$,*,\.o$,\.obj$,\.info$,\.swp$,\.bak$,\~$' 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" -endif -" 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 -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 - 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 @@ -384,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") @@ -430,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") @@ -503,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 @@ -513,9 +440,16 @@ fun! s:NetrwSafeOptions() setlocal fo=nroql2 setlocal tw=0 setlocal report=10000 + setlocal isk+=@ isk+=* isk+=/ 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 @@ -566,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 " =============================== @@ -579,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 @@ -599,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!") @@ -666,8 +610,12 @@ 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") + return + endif let tmpfile= s:GetTempfile(b:netrw_fname) " apply correct suffix " Check if NetrwBrowse() should be handling this request @@ -680,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? @@ -709,12 +657,12 @@ fun! netrw#NetRead(mode,...) endif endif " call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) - exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) + exe s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) 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 @@ -745,7 +693,8 @@ fun! netrw#NetRead(mode,...) endif call s:SaveBufVars() bd! - if bufname("%") == "" && line("$") == 1 && getline("$") == "" + if bufname("%") == "" && getline("$") == "" && line('$') == 1 + " needed when one sources a file in a nolbl setting window via ftp q! endif call s:RestoreBufVars() @@ -753,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)") @@ -809,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 != "" @@ -817,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 == "" @@ -863,33 +812,43 @@ fun! netrw#NetRead(mode,...) setlocal ro "......................................... - " cadaver: NetRead Method #6 {{{3 + " NetRead: (dav) NetRead Method #6 {{{3 elseif b:netrw_method == 6 " call Decho("read 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 - setlocal ff=unix - if exists("g:netrw_port") && g:netrw_port != "" - put ='open '.g:netrw_machine.' '.g:netrw_port + if !executable(g:netrw_dav_cmd) + call netrw#ErrorMsg(s:ERROR,g:netrw_dav_cmd." is not executable",73) +" call Dret("netrw#NetRead : ".g:netrw_dav_cmd." not executable") + return + endif + if g:netrw_dav_cmd =~ "curl" +" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_dav_cmd." ".shellescape("dav://".g:netrw_machine.b:netrw_fname,1)." ".shellescape(tmpfile,1)) + exe s:netrw_silentxfer."!".g:netrw_dav_cmd." ".shellescape("dav://".g:netrw_machine.b:netrw_fname,1)." ".shellescape(tmpfile,1) else - put ='open '.g:netrw_machine - endif - put ='user '.g:netrw_uid.' '.s:netrw_passwd - put ='get '.netrw_fname.' '.tmpfile - put ='quit' - - " perform cadaver operation: - norm! 1Gdd + " Construct execution string (four lines) which will be passed through filter + let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) + new + setlocal ff=unix + if exists("g:netrw_port") && g:netrw_port != "" + put ='open '.g:netrw_machine.' '.g:netrw_port + else + put ='open '.g:netrw_machine + endif + put ='user '.g:netrw_uid.' '.s:netrw_passwd + put ='get '.netrw_fname.' '.tmpfile + put ='quit' + + " perform cadaver operation: + norm! 1Gdd " call Decho("executing: %!".g:netrw_dav_cmd) - exe s:netrw_silentxfer."%!".g:netrw_dav_cmd - bd! + exe s:netrw_silentxfer."%!".g:netrw_dav_cmd + bd! + endif let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) 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)) @@ -898,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)") @@ -928,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) @@ -937,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 @@ -951,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:") @@ -963,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!") @@ -1007,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 @@ -1065,9 +1024,13 @@ fun! netrw#NetWrite(...) range " Determine method of write (ftp, rcp, etc) {{{4 call s:NetrwMethod(choice) + if !exists("b:netrw_method") || b:netrw_method < 0 +" call Dfunc("netrw#NetWrite : unsupported method") + return + 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..." @@ -1075,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 @@ -1096,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 @@ -1126,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('.')) @@ -1153,6 +1134,12 @@ fun! netrw#NetWrite(...) range 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('.')) " save choice/id/password for future use @@ -1172,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 != "" @@ -1188,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") @@ -1196,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 @@ -1218,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)) @@ -1230,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) @@ -1239,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") @@ -1269,6 +1281,7 @@ fun! netrw#NetWrite(...) range let &mod= mod endif + " restore equalalways " call Dret("netrw#NetWrite") endfun @@ -1370,11 +1383,7 @@ fun! s:NetrwGetFile(readcmd, tfile, meth " 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("$") @@ -1406,7 +1415,7 @@ fun! s:NetrwGetFile(readcmd, tfile, meth " 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 @@ -1422,18 +1431,34 @@ endfun " ------------------------------------------------------------------------ " s:NetrwMethod: determine method of transfer {{{2 -" method == 1: rcp -" 2: ftp + <.netrc> -" 3: ftp + machine, id, password, and [path]filename -" 4: scp -" 5: http (wget) -" 6: cadaver -" 7: rsync -" 8: fetch -" 9: sftp -fun! s:NetrwMethod(choice) " globals: method machine id passwd fname +" Input: +" choice = url [protocol:]//[userid@]hostname[:port]/[path-to-file] +" Output: +" b:netrw_method= 1: rcp +" 2: ftp + <.netrc> +" 3: ftp + machine, id, password, and [path]filename +" 4: scp +" 5: http (wget) +" 6: dav +" 7: rsync +" 8: fetch +" 9: sftp +" g:netrw_machine= hostname +" b:netrw_fname = filename +" g:netrw_port = optional port number (for ftp) +" g:netrw_choice = copy of input url (choice) +fun! s:NetrwMethod(choice) " call Dfunc("NetrwMethod(a:choice<".a:choice.">)") + " record current g:netrw_machine, if any + " curmachine used if protocol == ftp and no .netrc + if exists("g:netrw_machine") + let curmachine= g:netrw_machine +" call Decho("curmachine<".curmachine.">") + else + let curmachine= "N O T A HOST" + endif + " initialization let b:netrw_method = 0 let g:netrw_machine = "" @@ -1449,7 +1474,7 @@ fun! s:NetrwMethod(choice) " globals: m " rcphf : [user@]host:filename Use rcp " scpurm : scp://[user@]host[[#:]port]/filename Use scp " httpurm : http://[user@]host/filename Use wget - " davurm : dav[s]://host[:port]/path Use cadaver + " davurm : dav[s]://host[:port]/path Use cadaver/curl " rsyncurm : rsync://host[:port]/path Use rsync " fetchurm : fetch://[user@]host[:http]/filename Use fetch (defaults to ftp, override for http) " sftpurm : sftp://[user@]host/filename Use scp @@ -1518,9 +1543,14 @@ fun! s:NetrwMethod(choice) " globals: m let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"") let g:netrw_port = substitute(a:choice,ftpurm,'\4',"") let b:netrw_fname = substitute(a:choice,ftpurm,'\5',"") +" call Decho("g:netrw_machine<".g:netrw_machine.">") if userid != "" let g:netrw_uid= userid endif + if exists("s:netrw_passwd") && curmachine != g:netrw_machine + " if there's a change in hostname, require password re-entry + unlet s:netrw_passwd + endif if exists("g:netrw_uid") && exists("s:netrw_passwd") let b:netrw_method = 3 else @@ -1592,7 +1622,7 @@ fun! s:NetrwMethod(choice) " globals: m else if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:WARNING,"cannot determine method",45) + call netrw#ErrorMsg(s:WARNING,"cannot determine method (format: protocol://[user@]hostname[:port]/[path])",45) endif let b:netrw_method = -1 endif @@ -1626,10 +1656,24 @@ endfun if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp fun! NetReadFixup(method, line1, line2) " call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")") + + " sanity checks -- attempt to convert inputs to integers + let method = a:method + 0 + let line1 = a:line1 + 0 + let line2 = a:line2 + 0 + if type(method) != 0 || type(line1) != 0 || type(line2) != 0 || method < 0 || line1 <= 0 || line2 <= 0 +" call Dret("NetReadFixup") + return + endif + if method == 3 " ftp (no <.netrc>) let fourblanklines= line2 - 3 - silent fourblanklines.",".line2."g/^\s*/d" - endif + if fourblanklines >= line1 + exe "silent ".fourblanklines.",".line2."g/^\s*$/d" + call histdel("/",-1) + endif + endif + " call Dret("NetReadFixup") endfun endif @@ -1678,7 +1722,7 @@ fun! s:BrowserMaps(islocal) nnoremap :call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,NetrwGetWord())) nnoremap - :exe "norm! 0"call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,'../')) nnoremap a :call NetrwHide(1) - nnoremap mb :call NetrwBookmarkDir(0,b:netrw_curdir) + nnoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) nnoremap mc :call NetrwMarkFileCopy(1) nnoremap md :call NetrwMarkFileDiff(1) nnoremap me :call NetrwMarkFileEdit(1) @@ -1694,25 +1738,28 @@ fun! s:BrowserMaps(islocal) nnoremap mu :call NetrwUnMarkFile(1) nnoremap mx :call NetrwMarkFileExe(1) nnoremap mz :call NetrwMarkFileCompress(1) - nnoremap gb :call NetrwBookmarkDir(1,b:netrw_curdir) + 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)) nnoremap P :call NetrwPrevWinOpen(1) - nnoremap qb :call NetrwBookmarkDir(2,b:netrw_curdir) - nnoremap mB :call NetrwBookmarkDir(6,b:netrw_curdir) + nnoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) + nnoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) nnoremap qf :call NetrwFileInfo(1,NetrwGetWord()) nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) nnoremap s :call NetrwSortStyle(1) nnoremap S :call NetSortSequence(1) nnoremap t :call NetrwSplit(4) - nnoremap u :call NetrwBookmarkDir(4,expand("%")) - nnoremap U :call NetrwBookmarkDir(5,expand("%")) + nnoremap T :call NetrwSplit(4)norm! gT + nnoremap u :call NetrwBookHistHandler(4,expand("%")) + nnoremap U :call NetrwBookHistHandler(5,expand("%")) nnoremap v :call NetrwSplit(5) nnoremap x :call netrw#NetrwBrowseX(NetrwBrowseChgDir(1,NetrwGetWord(),0),0)" nnoremap % :call NetrwOpenFile(1) @@ -1754,7 +1801,7 @@ fun! s:BrowserMaps(islocal) nnoremap :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) nnoremap - :exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'../')) nnoremap a :call NetrwHide(0) - nnoremap mb :call NetrwBookmarkDir(0,b:netrw_curdir) + nnoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) nnoremap mc :call NetrwMarkFileCopy(0) nnoremap md :call NetrwMarkFileDiff(0) nnoremap me :call NetrwMarkFileEdit(0) @@ -1770,23 +1817,26 @@ fun! s:BrowserMaps(islocal) nnoremap mu :call NetrwUnMarkFile(0) nnoremap mx :call NetrwMarkFileExe(0) nnoremap mz :call NetrwMarkFileCompress(0) - nnoremap gb :call NetrwBookmarkDir(1,b:netrw_cur) + 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)) nnoremap P :call NetrwPrevWinOpen(0) - nnoremap qb :call NetrwBookmarkDir(2,b:netrw_curdir) - nnoremap mB :call NetrwBookmarkDir(6,b:netrw_curdir) + nnoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) + nnoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) nnoremap qf :call NetrwFileInfo(0,NetrwGetWord()) nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'./')) nnoremap s :call NetrwSortStyle(0) nnoremap S :call NetSortSequence(0) nnoremap t :call NetrwSplit(1) - nnoremap u :call NetrwBookmarkDir(4,b:netrw_curdir) - nnoremap U :call NetrwBookmarkDir(5,b:netrw_curdir) + 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) nnoremap x :call netrw#NetrwBrowseX(NetrwBrowseChgDir(0,NetrwGetWord()),1) nnoremap % :call NetrwOpenFile(0) @@ -1836,7 +1886,7 @@ fun! s:ExplorePatHls(pattern) endfun " --------------------------------------------------------------------- -" s:NetrwBookmarkDir: {{{2 +" s:NetrwBookHistHandler: {{{2 " 0: (user: ) bookmark current directory " 1: (user: ) change to the bookmarked directory " 2: (user: ) list bookmarks @@ -1844,32 +1894,27 @@ endfun " 4: (user: ) go up (previous) bookmark " 5: (user: ) go down (next) bookmark " 6: (user: ) delete bookmark -fun! s:NetrwBookmarkDir(chg,curdir) -" call Dfunc("NetrwBookmarkDir(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count." bookmarkcnt=".g:NETRW_BOOKMARKMAX." histcnt=".g:NETRW_DIRHIST_CNT." bookmax=".g:NETRW_BOOKMARKMAX." histmax=".g:netrw_dirhistmax) +fun! s:NetrwBookHistHandler(chg,curdir) +" call Dfunc("NetrwBookHistHandler(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count." histcnt=".g:netrw_dirhist_cnt." histmax=".g:netrw_dirhistmax) if a:chg == 0 " bookmark the current directory " call Decho("(user: ) bookmark the current directory") - if v:count > 0 - " handle bookmark# specified via the count - let g:NETRW_BOOKMARKDIR_{v:count}= a:curdir - if !exists("g:NETRW_BOOKMARKMAX") - let g:NETRW_BOOKMARKMAX= v:count - elseif v:count > g:NETRW_BOOKMARKMAX - let g:NETRW_BOOKMARKMAX= v:count - endif - else - " handle no count specified - let g:NETRW_BOOKMARKMAX = g:NETRW_BOOKMARKMAX + 1 - let g:NETRW_BOOKMARKDIR_{g:NETRW_BOOKMARKMAX} = a:curdir + if !exists("g:netrw_bookmarklist") + let g:netrw_bookmarklist= [] + endif + if index(g:netrw_bookmarklist,a:curdir) == -1 + " curdir not currently in g:netrw_bookmarklist, so include it + call add(g:netrw_bookmarklist,a:curdir) + call sort(g:netrw_bookmarklist) endif echo "bookmarked the current directory" elseif a:chg == 1 " change to the bookmarked directory -" call Decho("(user: ) change to the bookmarked directory") - if exists("g:NETRW_BOOKMARKDIR_{v:count}") - exe "e ".fnameescape(g:NETRW_BOOKMARKDIR_{v:count}) +" call Decho("(user: <".v:count."mb>) change to the bookmarked directory") + if exists("g:netrw_bookmarklist[v:count-1]") + exe "e ".fnameescape(g:netrw_bookmarklist[v:count-1]) else echomsg "Sorry, bookmark#".v:count." doesn't exist!" endif @@ -1879,29 +1924,27 @@ fun! s:NetrwBookmarkDir(chg,curdir) let didwork= 0 " list user's bookmarks " call Decho("(user: ) list user's bookmarks") - if exists("g:NETRW_BOOKMARKMAX") -" call Decho("list bookmarks [0,".g:NETRW_BOOKMARKMAX."]") - let cnt= 0 - while cnt <= g:NETRW_BOOKMARKMAX - if exists("g:NETRW_BOOKMARKDIR_{cnt}") -" call Decho("Netrw Bookmark#".cnt.": ".g:NETRW_BOOKMARKDIR_{cnt}) - echo "Netrw Bookmark#".cnt.": ".g:NETRW_BOOKMARKDIR_{cnt} - let didwork= 1 - endif - let cnt= cnt + 1 - endwhile + if exists("g:netrw_bookmarklist") +" call Decho('list '.len(g:netrw_bookmarklist).' bookmarks') + let cnt= 1 + for bmd in g:netrw_bookmarklist +" call Decho("Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1]) + echo "Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1] + let didwork = 1 + let cnt = cnt + 1 + endfor endif " list directory history - let cnt = g:NETRW_DIRHIST_CNT + let cnt = g:netrw_dirhist_cnt let first = 1 let histcnt = 0 - while ( first || cnt != g:NETRW_DIRHIST_CNT ) -" call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:NETRW_DIRHIST_CNT) + while ( first || cnt != g:netrw_dirhist_cnt ) +" call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:netrw_dirhist_cnt) let histcnt= histcnt + 1 - if exists("g:NETRW_DIRHIST_{cnt}") -" call Decho("Netrw History#".histcnt.": ".g:NETRW_DIRHIST_{cnt}) - echo "Netrw History#".histcnt.": ".g:NETRW_DIRHIST_{cnt} + if exists("g:netrw_dirhist_{cnt}") +" call Decho("Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt}) + echo "Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt} let didwork= 1 endif let first = 0 @@ -1917,22 +1960,21 @@ fun! s:NetrwBookmarkDir(chg,curdir) elseif a:chg == 3 " saves most recently visited directories (when they differ) " call Decho("(browsing) record curdir history") - if !exists("g:NETRW_DIRHIST_0") || g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT} != a:curdir - let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax -" let g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}= substitute(a:curdir,'[/\\]$','','e') - let g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}= a:curdir -" call Decho("save dirhist#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">") + if !exists("g:netrw_dirhist_cnt") || !exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") || g:netrw_dirhist_{g:netrw_dirhist_cnt} != a:curdir + let g:netrw_dirhist_cnt = ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax + let g:netrw_dirhist_{g:netrw_dirhist_cnt} = a:curdir +" call Decho("save dirhist#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") endif elseif a:chg == 4 " u: change to the previous directory stored on the history list " call Decho("(user: ) chg to prev dir from history") - let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT - 1 ) % g:netrw_dirhistmax - if g:NETRW_DIRHIST_CNT < 0 - let g:NETRW_DIRHIST_CNT= g:NETRW_DIRHIST_CNT + g:netrw_dirhistmax - endif - if exists("g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}") -" call Decho("changedir u#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">") + let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - 1 ) % g:netrw_dirhistmax + if g:netrw_dirhist_cnt < 0 + let g:netrw_dirhist_cnt= g:netrw_dirhist_cnt + g:netrw_dirhistmax + endif + if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") +" call Decho("changedir u#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") setlocal ma noro " call Decho("setlocal ma noro") @@ -1940,19 +1982,19 @@ fun! s:NetrwBookmarkDir(chg,curdir) setlocal nomod " call Decho("setlocal nomod") endif -" " call Decho("exe e! ".fnameescape(g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT})) - exe "e! ".fnameescape(g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}) +" " call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})) + exe "e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) else - let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax + let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax echo "Sorry, no predecessor directory exists yet" endif elseif a:chg == 5 " U: change to the subsequent directory stored on the history list " call Decho("(user: ) chg to next dir from history") - let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT + 1 ) % g:netrw_dirhistmax - if exists("g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}") -" call Decho("changedir U#".g:NETRW_DIRHIST_CNT."<".g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}.">") + let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax + if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") +" call Decho("changedir U#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") setlocal ma noro " call Decho("setlocal ma noro") @@ -1961,57 +2003,108 @@ fun! s:NetrwBookmarkDir(chg,curdir) setlocal nomod " call Decho("setlocal nomod") endif -" call Decho("exe e! ".fnameescape(g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT})) - exe "e! ".fnameescape(g:NETRW_DIRHIST_{g:NETRW_DIRHIST_CNT}) +" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})) + exe "e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) else - let g:NETRW_DIRHIST_CNT= ( g:NETRW_DIRHIST_CNT - 1 ) % g:netrw_dirhistmax - if g:NETRW_DIRHIST_CNT < 0 - let g:NETRW_DIRHIST_CNT= g:NETRW_DIRHIST_CNT + g:netrw_dirhistmax + let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - 1 ) % g:netrw_dirhistmax + if g:netrw_dirhist_cnt < 0 + let g:netrw_dirhist_cnt= g:netrw_dirhist_cnt + g:netrw_dirhistmax endif echo "Sorry, no successor directory exists yet" endif elseif a:chg == 6 - if v:count > 0 && v:count == g:NETRW_BOOKMARKMAX - " delete the v:count'th bookmark -" call Decho("delete bookmark#".v:count."<".g:NETRW_BOOKMARKDIR_{g:NETRW_BOOKMARKMAX}.">") - unlet g:NETRW_BOOKMARKDIR_{g:NETRW_BOOKMARKMAX} - let g:NETRW_BOOKMARKMAX= g:NETRW_BOOKMARKMAX - 1 - - elseif v:count > 0 -" call Decho("delete by shifting bookmark#".v:count."<".g:NETRW_BOOKMARKDIR_{v:count}.">") - let cnt= v:count - while cnt < g:NETRW_BOOKMARKMAX - let g:NETRW_BOOKMARKDIR_{cnt} = g:NETRW_BOOKMARKDIR_{(cnt+1)} - let cnt = cnt + 1 - endwhile - unlet g:NETRW_BOOKMARKDIR_{g:NETRW_BOOKMARKMAX} - let g:NETRW_BOOKMARKMAX= g:NETRW_BOOKMARKMAX - 1 - - elseif exists("b:netrw_curdir") - " look for current directory amongst the bookmarks and remove that bookmark -" call Decho("search for bookmark<".b:netrw_curdir.">") - let cnt= 1 - while cnt <= g:NETRW_BOOKMARKMAX -" call Decho("checking: g:NETRW_BOOKMARKDIR_".cnt."<".g:NETRW_BOOKMARKDIR_{cnt}.">") - if g:NETRW_BOOKMARKDIR_{cnt} == b:netrw_curdir - if cnt < g:NETRW_BOOKMARKMAX -" call Decho("delete bookmark#".cnt."<".b:netrw_curdir.">") - while cnt < g:NETRW_BOOKMARMAX - let g:NETRW_BOOKMARKDIR_{cnt} = g:NETRW_BOOKMARKDIR_{(cnt+1)} - let cnt = cnt + 1 - endwhile - endif - unlet g:NETRW_BOOKMARKDIR_{g:NETRW_BOOKMARKMAX} - let g:NETRW_BOOKMARKMAX= g:NETRW_BOOKMARKMAX - 1 - endif - let cnt= cnt + 1 - endwhile - endif - + " delete the v:count'th bookmark +" call Decho("delete bookmark#".v:count."<".g:netrw_bookmarklist[v:count-1].">") + let savefile= s:NetrwHome()."/.netrwbook" + if filereadable(savefile) + call s:NetrwBookHistSave() " done here to merge bookmarks first + call delete(savefile) + endif + call remove(g:netrw_bookmarklist,v:count-1) endif call s:NetrwBookmarkMenu() -" call Dret("NetrwBookmarkDir") +" call Dret("NetrwBookHistHandler") +endfun + +" --------------------------------------------------------------------- +" s:NetrwBookHistRead: this function reads bookmarks and history {{{2 +" Sister function: s:NetrwBookHistSave() +fun! s:NetrwBookHistRead() +" call Dfunc("s:NetrwBookHistRead()") + if !exists("s:netrw_initbookhist") + let home = s:NetrwHome() + let savefile= home."/.netrwbook" + if filereadable(savefile) +" call Decho("sourcing .netrwbook") + exe "so ".savefile + endif + let savefile= home."/.netrwhist" + if filereadable(savefile) +" call Decho("sourcing .netrwhist") + exe "so ".savefile + endif + let s:netrw_initbookhist= 1 + au VimLeave * call s:NetrwBookHistSave() + endif +" call Dret("s:NetrwBookHistRead") +endfun + +" --------------------------------------------------------------------- +" s:NetrwBookHistSave: this function saves bookmarks and history {{{2 +" Sister function: s:NetrwBookHistRead() +" I used to do this via viminfo but that appears to +" be unreliable for long-term storage +" COMBAK: does $HOME work under windows??? +fun! s:NetrwBookHistSave() +" call Dfunc("s:NetrwBookHistSave() dirhistmax=".g:netrw_dirhistmax) + let savefile= s:NetrwHome()."/.netrwhist" + 1split + 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 + 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("$") + let cnt = 1 + while cnt <= g:netrw_dirhist_cnt + call setline((cnt+lastline),'let g:netrw_dirhist_'.cnt."='".g:netrw_dirhist_{cnt}."'") + let cnt= cnt + 1 + endwhile + exe "silent! w! ".savefile + + silent %d + if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] + " merge and write .netrwbook + let savefile= s:NetrwHome()."/.netrwbook" + + if filereadable(savefile) + let booklist= deepcopy(g:netrw_bookmarklist) + exe "silent so ".savefile + for bdm in booklist + if index(g:netrw_bookmarklist,bdm) == -1 + call add(g:netrw_bookmarklist,bdm) + endif + endfor + call sort(g:netrw_bookmarklist) + exe "silent! w! ".savefile + endif + + " construct and save .netrwbook + call setline(1,"let g:netrw_bookmarklist= ".string(g:netrw_bookmarklist)) + exe "silent! w! ".savefile + endif + let bgone= bufnr("%") + q! + exe bgone."bwipe!" + +" call Dret("s:NetrwBookHistSave") endfun " --------------------------------------------------------------------- @@ -2024,6 +2117,18 @@ fun! s:NetrwBrowse(islocal,dirname) " call Dfunc("s:NetrwBrowse(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".w:netrw_liststyle." ".g:loaded_netrw." buf#".bufnr("%")."<".bufname("%").">") " call Decho("tab#".tabpagenr()." win#".winnr()) " call Dredir("ls!") + 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 @@ -2043,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) @@ -2092,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) @@ -2122,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:") @@ -2143,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 @@ -2183,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 !~ '/$' @@ -2196,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 @@ -2214,12 +2326,23 @@ 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). + " However, s:NetrwBrowse() causes the ShellCmdPost event itself to fire once; setting + " the variable below avoids that second refresh of the screen. The s:LocalBrowseShellCmdRefresh() + " function gets called due to that autocmd; it notices that the following variable is set + " and skips the refresh and sets s:locbrowseshellcmd to zero. Oct 13, 2008 + let s:locbrowseshellcmd= 1 " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap) " call Dret("s:NetrwBrowse : did PerformListing") @@ -2274,13 +2397,14 @@ 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 set ei=all exe "b ".w:netrw_treebufnr let &ei= eikeep -" call Dret("s:NetrwGetBuffer : bufnum#".bufnum."") +" call Dret("s:NetrwGetBuffer : bufnum#".w:netrw_treebufnr."") return endif let bufnum= -1 @@ -2297,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 @@ -2306,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 @@ -2318,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 @@ -2510,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 @@ -2621,6 +2755,22 @@ fun! s:NetrwListStyle(islocal) let svpos= netrw#NetrwSavePosn() call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) call netrw#NetrwRestorePosn(svpos) + if w:netrw_liststyle != s:WIDELIST + if g:netrw_cursorline == 2 + setlocal cursorline + let &cursorcolumn= s:netrw_usercuc + elseif g:netrw_cursorline + setlocal cursorline +" call Decho("setlocal cursorline") + endif + else + if g:netrw_cursorline == 2 + setlocal cursorline cursorcolumn +" call Decho("setlocal cursorline cursorcolumn") + elseif g:netrw_cursorline + let &cursorline= s:netrw_usercul + endif + endif " keep cursor on the filename silent keepjumps $ @@ -2634,6 +2784,29 @@ fun! s:NetrwListStyle(islocal) 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 " .3.[cnt] for history @@ -2642,37 +2815,47 @@ fun! s:NetrwBookmarkMenu() if !exists("s:netrw_menucnt") return endif -" call Dfunc("NetrwBookmarkMenu() bookmarkcnt=".g:NETRW_BOOKMARKMAX." histcnt=".g:NETRW_DIRHIST_CNT." menucnt=".s:netrw_menucnt) +" call Dfunc("NetrwBookmarkMenu() histcnt=".g:netrw_dirhist_cnt." menucnt=".s:netrw_menucnt) " the following test assures that gvim is running, has menus available, and has menus enabled. if has("gui") && has("menu") && has("gui_running") && &go =~ 'm' && g:netrw_menu if exists("g:NetrwTopLvlMenu") " call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)") exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Bookmarks' + exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete' + endif + if !exists("s:netrw_initbookhist") + call s:NetrwBookHistRead() endif " show bookmarked places - let cnt = 1 - while cnt <= g:NETRW_BOOKMARKMAX - if exists("g:NETRW_BOOKMARKDIR_{cnt}") - let bmdir= escape(g:NETRW_BOOKMARKDIR_{cnt},'. ') -" call Decho('silent! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmark.'.bmdir.' :e '.bmdir) - exe 'silent! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks.'.bmdir.' :e '.bmdir."\" - endif - let cnt= cnt + 1 - endwhile + if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] + let cnt= 1 + for bmd in g:netrw_bookmarklist +" call Decho('silent! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmark.'.bmd.' :e '.bmd) + let bmd= escape(bmd,'. ') + + " show bookmarks for goto menu + exe 'silent! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks.'.bmd.' :e '.bmd."\" + + " show bookmarks for deletion menu + exe 'silent! menu '.g:NetrwMenuPriority.".8.2.".cnt." ".g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete.'.bmd.' '.cnt."mB" + let cnt= cnt + 1 + endfor + + endif " show directory browsing history - let cnt = g:NETRW_DIRHIST_CNT + let cnt = g:netrw_dirhist_cnt let first = 1 let histcnt = 0 - while ( first || cnt != g:NETRW_DIRHIST_CNT ) + while ( first || cnt != g:netrw_dirhist_cnt ) let histcnt = histcnt + 1 - let priority = g:NETRW_DIRHIST_CNT + histcnt - if exists("g:NETRW_DIRHIST_{cnt}") - let bmdir= escape(g:NETRW_DIRHIST_{cnt},'/&? ') -" call Decho('silent! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.bmdir.' :e '.bmdir) - exe 'silent! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.bmdir.' :e '.bmdir."\" + let priority = g:netrw_dirhist_cnt + histcnt + if exists("g:netrw_dirhist_{cnt}") + let histdir= escape(g:netrw_dirhist_{cnt},'./&? ') +" call Decho('silent! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir) + exe 'silent! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir."\" endif let first = 0 let cnt = ( cnt - 1 ) % g:netrw_dirhistmax @@ -2680,6 +2863,7 @@ fun! s:NetrwBookmarkMenu() let cnt= cnt + g:netrw_dirhistmax endif endwhile + endif " call Dret("NetrwBookmarkMenu") endfun @@ -2702,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() @@ -2737,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 @@ -2751,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 @@ -2781,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 =~ '^/' @@ -2887,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 @@ -2916,17 +3135,40 @@ 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') if has("win32") || has("win95") || has("win64") || has("win16") let exten= substitute(exten,'^.*$','\L&\E','') endif +" call Decho("exten<".exten.">") " seems kde systems often have gnome-open due to dependencies, even though " gnome-open's subsidiary display tools are largely absent. Kde systems @@ -2945,16 +3187,25 @@ fun! netrw#NetrwBrowseX(fname,remote) if a:remote == 1 " create a local copy - let fname= fnamemodify(tempname(),":r").".".exten -" call Decho("a:remote=".a:remote.": create a local copy of <".fname."> as <".fname.">") - exe "silent keepjumps bot 1new ".fnameescape(fname) +" call Decho("a:remote=".a:remote.": create a local copy of <".a:fname.">") setlocal bh=delete -" call Decho("read <".fnameescape(fname).">, now writing: exe w! ".fnameescape(fname)) - exe "silent! w! ".fnameescape(fname) - q + call netrw#NetRead(3,a:fname) + " attempt to rename tempfile + let basename= substitute(a:fname,'^\(.*\)/\(.*\)\.\([^.]*\)$','\2','') + let newname= substitute(s:netrw_tmpfile,'^\(.*\)/\(.*\)\.\([^.]*\)$','\1/'.basename.'.\3','') +" call Decho("basename<".basename.">") +" call Decho("newname <".newname.">") + if rename(s:netrw_tmpfile,newname) == 0 + " renaming succeeded + let fname= newname + else + " renaming failed + let fname= s:netrw_tmpfile + endif else let fname= a:fname endif +" call Decho("fname<".fname.">") " call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten)) " set up redirection @@ -2973,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*','','')." " @@ -3004,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 @@ -3060,19 +3319,72 @@ fun! netrw#NetrwBrowseX(fname,remote) 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 -" dosplit==0: the window will be split iff the current file has -" been modified -" dosplit==1: the window will be split before running the local -" browser +" indx: == -1: Nexplore +" == -2: Pexplore +" == +: this is overloaded: +" * If Nexplore/Pexplore is in use, then this refers to the +" indx'th item in the w:netrw_explore_list[] of items which +" matched the */pattern **/pattern *//pattern **//pattern +" * If Hexplore or Vexplore, then this will override +" g:netrw_winsize to specify the qty of rows or columns the +" newly split window should have. +" dosplit==0: the window will be split iff the current file has been modified +" dosplit==1: the window will be split before running the local browser +" style == 0: Explore style == 1: Explore! +" == 2: Hexplore style == 3: Hexplore! +" == 4: Vexplore style == 5: Vexplore! +" == 6: Texplore 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 = @* @@ -3083,30 +3395,34 @@ fun! netrw#Explore(indx,dosplit,style,.. if a:dosplit || &modified || a:style == 6 " call Decho("case: dosplit=".a:dosplit." modified=".&modified." a:style=".a:style) call s:SaveWinVars() + let winsize= g:netrw_winsize + if a:indx > 0 + let winsize= a:indx + endif if a:style == 0 " Explore, Sexplore " call Decho("style=0: Explore or Sexplore") - exe g:netrw_winsize."wincmd s" + exe winsize."wincmd s" elseif a:style == 1 "Explore!, Sexplore! " call Decho("style=1: Explore! or Sexplore!") - exe g:netrw_winsize."wincmd v" + exe winsize."wincmd v" elseif a:style == 2 " Hexplore " call Decho("style=2: Hexplore") - exe "bel ".g:netrw_winsize."wincmd s" + exe "bel ".winsize."wincmd s" elseif a:style == 3 " Hexplore! " call Decho("style=3: Hexplore!") - exe "abo ".g:netrw_winsize."wincmd s" + exe "abo ".winsize."wincmd s" elseif a:style == 4 " Vexplore " call Decho("style=4: Vexplore") - exe "lefta ".g:netrw_winsize."wincmd v" + exe "lefta ".winsize."wincmd v" elseif a:style == 5 " Vexplore! " call Decho("style=5: Vexplore!") - exe "rightb ".g:netrw_winsize."wincmd v" + exe "rightb ".winsize."wincmd v" elseif a:style == 6 " Texplore call s:SaveBufVars() @@ -3117,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.">") @@ -3131,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 @@ -3192,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 - endif +" 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.">)") @@ -3211,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) @@ -3224,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 @@ -3237,9 +3548,10 @@ fun! netrw#Explore(indx,dosplit,style,.. if !exists("w:netrw_explore_indx") let w:netrw_explore_indx= 0 endif + let indx = a:indx " call Decho("starpat=".starpat.": set indx= [a:indx=".indx."]") -" + if indx == -1 " Nexplore " call Decho("case Nexplore with starpat=".starpat.": (indx=".indx.")") @@ -3290,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() @@ -3300,17 +3613,24 @@ fun! netrw#Explore(indx,dosplit,style,.. if starpat == 1 " starpat=1: Explore *//pattern (current directory only search for files containing pattern) " call Decho("starpat=".starpat.": build *//pattern list") - exe "vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*" - let w:netrw_explore_list = map(getqflist(),'bufname(v:val.bufnr)') +" call Decho("pattern<".pattern.">") + 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 @@ -3320,19 +3640,22 @@ 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) " call Decho("starpat=".starpat.": build */filepat list") - let dirname = substitute(dirname,'^\*/','','') - let w:netrw_explore_list= split(expand(b:netrw_curdir."/".dirname),'\n') - if &hls | let keepregslash= s:ExplorePatHls(dirname) | endif + let filepat= substitute(dirname,'^\*/','','') + let filepat= substitute(filepat,'^[%#<]','\\&','') +" call Decho("b:netrw_curdir<".b:netrw_curdir.">") +" call Decho("filepat<".filepat.">") + 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 @@ -3352,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 @@ -3360,7 +3683,6 @@ fun! netrw#Explore(indx,dosplit,style,.. let indx = (indx < 0)? ( w:netrw_explore_listlen - 1 ) : 0 let w:netrw_explore_indx= indx call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43) - sleep 1 endif exe "let dirfile= w:netrw_explore_list[".indx."]" @@ -3397,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 @@ -3409,14 +3731,19 @@ 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 @@ -3425,15 +3752,15 @@ fun! netrw#Explore(indx,dosplit,style,.. " call Decho("fname<".fname.">") if fname =~ '^'.b:netrw_curdir if s:explore_match == "" - let s:explore_match= '\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc."'".g:netrw_markfileesc."'").'\>' + let s:explore_match= '\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>' else - let s:explore_match= s:explore_match.'\|\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc."'".g:netrw_markfileesc."'").'\>' + let s:explore_match= s:explore_match.'\|\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>' endif elseif fname !~ '^/' && fname != prvfname if s:explore_match == "" - let s:explore_match= '\<'.escape(fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").'\>' + let s:explore_match= '\<'.escape(fname,g:netrw_markfileesc).'\>' else - let s:explore_match= s:explore_match.'\|\<'.escape(fname,g:netrw_markfileesc."'".g:netrw_markfileesc."'").'\>' + let s:explore_match= s:explore_match.'\|\<'.escape(fname,g:netrw_markfileesc).'\>' endif endif let prvfname= fname @@ -3449,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 @@ -3457,6 +3785,24 @@ fun! netrw#Explore(indx,dosplit,style,.. 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 " s:NetrwListHide(). @@ -3490,9 +3836,7 @@ fun! s:NetrwHide(islocal) " call Decho("hide: g:netrw_list_hide<".g:netrw_list_hide.">") endif endfor - unlet s:netrwmarkfilelist_{bufnr("%")} - unlet s:netrwmarkfilemtch_{bufnr("%")} - 2match none + call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) let g:netrw_hide= 1 else @@ -3522,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\+' @@ -3535,6 +3879,41 @@ fun! s:NetrwHidden(islocal) endfun " --------------------------------------------------------------------- +" s:NetrwHome: this function determines a "home" for saving bookmarks and history {{{2 +fun! s:NetrwHome() + if exists("g:netrw_home") + let home= g:netrw_home + else + " go to vim plugin home + for home in split(&rtp,',') + [''] + if isdirectory(home) && filewritable(home) | break | endif + let basehome= substitute(home,'[/\\]\.vim$','','') + if isdirectory(basehome) && filewritable(basehome) + let home= basehome."/.vim" + break + endif + endfor + if home == "" + " just pick the first directory + let home= substitute(&rtp,',.*$','','') + endif + if (has("win32") || has("win95") || has("win64") || has("win16")) + let home= substitute(home,'/','\\','g') + endif + endif + " insure that the home directory exists + if !isdirectory(home) + if exists("g:netrw_mkdir") + call system(g:netrw_mkdir." ".shellescape(home)) + else + call mkdir(home) + endif + endif + let g:netrw_home= home + return home +endfun + +" --------------------------------------------------------------------- " s:NetrwLeftmouse: handles the when in a netrw browsing window {{{2 fun! s:NetrwLeftmouse(islocal) " call Dfunc("s:NetrwLeftmouse(islocal=".a:islocal.")") @@ -3749,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}).">") @@ -3759,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 @@ -3767,7 +4147,7 @@ fun! s:NetrwMarkFile(islocal,fname) call filter(s:netrwmarkfilelist_{curbufnr},'v:val != a:fname') if s:netrwmarkfilelist_{curbufnr} == [] " local markfilelist is empty; remove it entirely -" call Decho("markfile list now empty, unlet s:netrwmarkfilelist_".curbufnr." and ...mtch_".curbufnr) +" call Decho("markfile list now empty") call s:NetrwUnmarkList(curbufnr,curdir) else " rebuild match list to display markings correctly @@ -3776,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 @@ -3799,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 @@ -3830,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 @@ -3858,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 @@ -3883,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) @@ -3927,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 @@ -3982,7 +4364,9 @@ fun! s:NetrwMarkFileCopy(islocal) if a:islocal call s:NetrwRefreshDir(a:islocal,b:netrw_curdir) endif - call s:LocalBrowseShellCmdRefresh() + if g:netrw_fastbrowse <= 1 + call s:LocalBrowseShellCmdRefresh() + endif " call Dret("s:NetrwMarkFileCopy 1") return 1 @@ -4064,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') @@ -4185,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) @@ -4290,7 +4680,9 @@ fun! s:NetrwMarkFileMove(islocal) if a:islocal call s:NetrwRefreshDir(a:islocal,b:netrw_curdir) endif - call s:LocalBrowseShellCmdRefresh() + if g:netrw_fastbrowse <= 1 + call s:LocalBrowseShellCmdRefresh() + endif " call Dret("s:NetrwMarkFileMove") endfun @@ -4342,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") @@ -4371,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') @@ -4379,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 @@ -4459,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 @@ -4518,7 +4908,7 @@ fun! s:NetrwMarkFileTgt(islocal) endif let s:netrwmftgt_islocal= a:islocal - if g:netrw_fastbrowse > 0 + if g:netrw_fastbrowse <= 1 call s:LocalBrowseShellCmdRefresh() endif call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) @@ -4653,20 +5043,17 @@ fun! s:NetrwMenu(domenu) " call Decho("initialize menu") let s:netrw_menu_enabled= 1 exe 'silent! menu '.g:NetrwMenuPriority.'.1 '.g:NetrwTopLvlMenu.'Help ' - call s:NetrwBookmarkMenu() " provide some history! uses priorities 2,3, reserves 4 exe 'silent! menu '.g:NetrwMenuPriority.'.5 '.g:NetrwTopLvlMenu.'-Sep1- :' exe 'silent! menu '.g:NetrwMenuPriority.'.6 '.g:NetrwTopLvlMenu.'Go\ Up\ Directory- -' exe 'silent! menu '.g:NetrwMenuPriority.'.7 '.g:NetrwTopLvlMenu.'Apply\ Special\ Viewerx x' exe 'silent! menu '.g:NetrwMenuPriority.'.8.1 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Current\ Directorymb mb' - exe 'silent! menu '.g:NetrwMenuPriority.'.8.2 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ DeletemB mB' - exe 'silent! menu '.g:NetrwMenuPriority.'.8.3 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Bookmarkgb gb' exe 'silent! menu '.g:NetrwMenuPriority.'.8.4 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Prev\ Dir\ (History)u u' exe 'silent! menu '.g:NetrwMenuPriority.'.8.5 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Next\ Dir\ (History)U U' exe 'silent! menu '.g:NetrwMenuPriority.'.8.6 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Listqb qb' - exe 'silent! menu '.g:NetrwMenuPriority.'.9.1 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ File\ Hiding\ List'." \NetrwHideEdit" + exe 'silent! menu '.g:NetrwMenuPriority.'.9.1 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ File\ Hiding\ List'." \'" exe 'silent! menu '.g:NetrwMenuPriority.'.9.2 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ Sorting\ SequenceS S' exe 'silent! menu '.g:NetrwMenuPriority.'.9.3 '.g:NetrwTopLvlMenu.'Browsing\ Control.Quick\ Hide/Unhide\ Dot\ Files'."gh gh" - exe 'silent! menu '.g:NetrwMenuPriority.'.9.4 '.g:NetrwTopLvlMenu.'Browsing\ Control.Refresh\ Listing'." \NetrwRefresh" + exe 'silent! menu '.g:NetrwMenuPriority.'.9.4 '.g:NetrwTopLvlMenu.'Browsing\ Control.Refresh\ Listing'." \" exe 'silent! menu '.g:NetrwMenuPriority.'.9.5 '.g:NetrwTopLvlMenu.'Browsing\ Control.Settings/Options:NetrwSettings '.":NetrwSettings\" exe 'silent! menu '.g:NetrwMenuPriority.'.10 '.g:NetrwTopLvlMenu.'Delete\ File/DirectoryD D' exe 'silent! menu '.g:NetrwMenuPriority.'.11.1 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Current\ Window '."\" @@ -4677,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' @@ -4704,6 +5091,7 @@ fun! s:NetrwMenu(domenu) exe 'silent! menu '.g:NetrwMenuPriority.'.16.4 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method\ (name-time-size)s s' exe 'silent! menu '.g:NetrwMenuPriority.'.17 '.g:NetrwTopLvlMenu.'Rename\ File/DirectoryR R' exe 'silent! menu '.g:NetrwMenuPriority.'.18 '.g:NetrwTopLvlMenu.'Set\ Current\ Directoryc c' + call s:NetrwBookmarkMenu() " provide some history! uses priorities 2,3, reserves 4, 8.2.x let s:netrw_menucnt= 28 elseif !a:domenu @@ -4731,8 +5119,8 @@ fun! s:NetrwObtain(islocal) " call Dfunc("NetrwObtain(islocal=".a:islocal.")") if exists("s:netrwmarkfilelist_{bufnr('%')}") - let islocal= s:netrwmarkfilelist_{bufnr("%")}[1] !~ '^\a\+://' - call netrw#NetrwObtain(islocal,s:netrwmarkfilelist_{bufnr("%")}) + let islocal= s:netrwmarkfilelist_{bufnr('%')}[1] !~ '^\a\+://' + call netrw#NetrwObtain(islocal,s:netrwmarkfilelist_{bufnr('%')}) call s:NetrwUnmarkList(bufnr('%'),b:netrw_curdir) else call netrw#NetrwObtain(a:islocal,expand("")) @@ -4769,7 +5157,7 @@ fun! netrw#NetrwObtain(islocal,fname,... endif " call Decho("tgtdir<".tgtdir.">") - if b:netrw_islocal + if exists("b:netrw_islocal") && b:netrw_islocal " obtain a file from local b:netrw_curdir to (local) tgtdir " call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir) if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir @@ -4921,6 +5309,14 @@ fun! netrw#NetrwObtain(islocal,fname,... call netrw#ErrorMsg(s:ERROR,getline(1),5) endif endif + elseif !exists("b:netrw_method") || b:netrw_method < 0 +" call Dfunc("netrw#NetrwObtain : unsupported method") + return + endif + + " restore status line + if type(a:fname) == 1 && exists("s:netrw_users_stl") + call s:SetupNetrwStatusLine(s:netrw_users_stl) endif endif @@ -4989,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 @@ -5138,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 @@ -5196,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 @@ -5205,6 +5603,9 @@ fun! s:NetrwUpload(fname,tgt,...) else bw!|q endif + elseif !exists("b:netrw_method") || b:netrw_method < 0 +" call Dfunc("netrw#NetrwUpload : unsupported method") + return endif else call netrw#ErrorMsg(s:ERROR,"can't obtain files with protocol from<".a:tgt.">",63) @@ -5325,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.">") @@ -5345,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 @@ -5361,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 @@ -5405,12 +5809,12 @@ fun! s:NetrwSplit(mode) elseif a:mode == 1 " remote and t - let cursorword = s:NetrwGetWord() + let newdir = s:NetrwBrowseChgDir(0,s:NetrwGetWord()) " call Decho("tabnew") tabnew let s:didsplit= 1 call s:RestoreWinVars() - call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,cursorword)) + call s:NetrwBrowse(0,newdir) unlet s:didsplit elseif a:mode == 2 @@ -5433,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 @@ -5505,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 @@ -5525,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.">") @@ -5548,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 @@ -5663,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 @@ -5706,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 @@ -5733,16 +6136,21 @@ fun! s:PerformListing(islocal) endif " save current directory on directory history list - call s:NetrwBookmarkDir(3,b:netrw_curdir) + 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" @@ -5750,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 - endif - exe "keepjumps ".w:netrw_bannercnt + " 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 " 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)') - endif - let w:netrw_bannercnt= w:netrw_bannercnt + 1 - else -" call Decho("s:netrwmftgt does not exist, don't make Copy/Move Tgt") - endif - exe "keepjumps ".w:netrw_bannercnt +" call Decho("s:netrwmftgt does not exist, don't make Copy/Move Tgt") + endif + exe "keepjumps ".w:netrw_bannercnt + endif " 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 - endif - let w:netrw_bannercnt= w:netrw_bannercnt + 1 - 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 + 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 + 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 " 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") @@ -5816,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 @@ -5844,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') @@ -5857,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 + exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{-}\///e' + call histdel("/",-1) endif - exe 'silent keepjumps '.w:netrw_bannercnt.',$s/^\d\{-}\///e' 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 @@ -5872,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 @@ -6006,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(".") @@ -6025,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 @@ -6045,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 == "" @@ -6063,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 @@ -6099,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 @@ -6118,6 +6552,7 @@ fun! s:NetrwRemoteRm(usrhost,path) range let all= 0 if exists("s:netrwmarkfilelist_{bufnr('%')}") " remove all marked files +" call Decho("remove all marked files with bufnr#".bufnr("%")) for fname in s:netrwmarkfilelist_{bufnr("%")} let ok= s:NetrwRemoteRmFile(a:path,fname,all) if ok =~ 'q\%[uit]' @@ -6126,12 +6561,11 @@ fun! s:NetrwRemoteRm(usrhost,path) range let all= 1 endif endfor - unlet s:netrwmarkfilelist_{bufnr("%")} - unlet s:netrwmarkfilemtch_{bufnr("%")} - 2match none + call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) else " remove files specified by range +" call Decho("remove files specified by range") " preparation for removing multiple files/directories let ctr= a:firstline @@ -6245,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) @@ -6353,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 @@ -6412,8 +6850,8 @@ fun! s:NetrwRemoteRename(usrhost,path) r 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 @@ -6437,8 +6875,8 @@ fun! s:NetrwRemoteRename(usrhost,path) r 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 @@ -6466,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 @@ -6492,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 != "" @@ -6608,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 @@ -6617,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 @@ -6626,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 @@ -6639,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) @@ -6659,9 +7102,17 @@ 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") + if s:locbrowseshellcmd + let s:locbrowseshellcmd= 0 +" call Dret("LocalBrowseShellCmdRefresh : NetrwBrowse itself caused the refresh") + return + endif + let s:locbrowseshellcmd= 0 + endif let itab = 1 let buftablist = [] while itab <= tabpagenr("$") @@ -6815,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 @@ -6874,9 +7325,7 @@ fun! s:NetrwLocalRename(path) range endif call rename(oldname,newname) endfor - 2match none - unlet s:netrwmarkfilelist_{bufnr("%")} - unlet s:netrwmarkfilemtch_{bufnr("%")} + call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) else @@ -6955,9 +7404,11 @@ fun! s:LocalFastBrowser() augroup AuNetrwShellCmd au! if (has("win32") || has("win95") || has("win64") || has("win16")) +" call Decho("autocmd: ShellCmdPost * call s:LocalBrowseShellCmdRefresh()") au ShellCmdPost * call s:LocalBrowseShellCmdRefresh() else au ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh() +" call Decho("autocmd: ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh()") endif augroup END endif @@ -6984,7 +7435,7 @@ endfun " 0=note = s:NOTE " 1=warning = s:WARNING " 2=error = s:ERROR -" Jul 08, 2008 : max errnum currently is 71 +" 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) @@ -7017,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") @@ -7101,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 @@ -7130,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 @@ -7141,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','') @@ -7212,7 +7673,7 @@ fun! s:GetTempfile(fname) endif " let netrw#NetSource() know about the tmpfile - let s:netrw_tmpfile= tmpfile " used by netrw#NetSource() + let s:netrw_tmpfile= tmpfile " used by netrw#NetSource() and netrw#NetrwBrowseX() " call Decho("tmpfile<".tmpfile."> s:netrw_tmpfile<".s:netrw_tmpfile.">") " o/s dependencies @@ -7301,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 @@ -7317,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) @@ -7326,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 @@ -7370,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 @@ -7511,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 @@ -7532,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 @@ -7562,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 @@ -7584,8 +8051,7 @@ fun! s:SetRexDir(islocal,dirname) if a:islocal exe 'com! Rexplore call s:NetrwRexplore(1,"'.escape(a:dirname,'"\').'")' if g:netrw_retmap - silent! unmap <2-leftmouse> - if !hasmapto("NetrwReturn") + if !hasmapto("NetrwReturn") && maparg("<2-leftmouse>","n") == "" nmap <2-leftmouse> NetrwReturn endif let dir = escape(a:dirname, s:netrw_map_escape) @@ -7594,8 +8060,7 @@ fun! s:SetRexDir(islocal,dirname) else exe 'com! Rexplore call s:NetrwRexplore(0,"'.escape(a:dirname,'"\').'")' if g:netrw_retmap - silent! unmap <2-leftmouse> - if !hasmapto("NetrwReturn") + if !hasmapto("NetrwReturn") && maparg("<2-leftmouse>","n") == "" nmap <2-leftmouse> NetrwReturn endif let dir = escape(a:dirname, s:netrw_map_escape) @@ -7608,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 @@ -7638,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 @@ -7707,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/ @@ -7737,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 @@ -7750,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/runtime/autoload/netrwFileHandlers.vim b/runtime/autoload/netrwFileHandlers.vim --- a/runtime/autoload/netrwFileHandlers.vim +++ b/runtime/autoload/netrwFileHandlers.vim @@ -1,9 +1,9 @@ " netrwFileHandlers: contains various extension-based file handlers for " netrw's browsers' x command ("eXecute launcher") " Author: Charles E. Campbell, Jr. -" Date: May 30, 2006 -" Version: 9 -" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1 +" Date: Sep 30, 2008 +" Version: 10 +" Copyright: Copyright (C) 1999-2008 Charles E. Campbell, Jr. {{{1 " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright " notice is copied with it. Like anything else that's free, @@ -20,9 +20,15 @@ if exists("g:loaded_netrwFileHandlers") || &cp finish endif +let g:loaded_netrwFileHandlers= "v10" +if v:version < 702 + echohl WarningMsg + echo "***warning*** this version of netrwFileHandlers needs vim 7.2" + echohl Normal + finish +endif let s:keepcpo= &cpo set cpo&vim -let g:loaded_netrwFileHandlers= "v9" " --------------------------------------------------------------------- " netrwFileHandlers#Invoke: {{{1 @@ -73,10 +79,10 @@ fun! s:NFH_html(pagefile) if executable("mozilla") " call Decho("executing !mozilla ".page) - exe "!mozilla ".g:netrw_shq.page.g:netrw_shq + exe "!mozilla ".shellescape(page,1) elseif executable("netscape") " call Decho("executing !netscape ".page) - exe "!netscape ".g:netrw_shq..page.g:netrw_shq + exe "!netscape ".shellescape(page,1) else " call Dret("s:NFH_html 0") return 0 @@ -96,10 +102,10 @@ fun! s:NFH_htm(pagefile) if executable("mozilla") " call Decho("executing !mozilla ".page) - exe "!mozilla ".g:netrw_shq.page.g:netrw_shq + exe "!mozilla ".shellescape(page,1) elseif executable("netscape") " call Decho("executing !netscape ".page) - exe "!netscape ".g:netrw_shq.page.g:netrw_shq + exe "!netscape ".shellescape(page,1) else " call Dret("s:NFH_htm 0") return 0 @@ -115,10 +121,10 @@ fun! s:NFH_jpg(jpgfile) " call Dfunc("s:NFH_jpg(jpgfile<".a:jpgfile.">)") if executable("gimp") - exe "silent! !gimp -s ".g:netrw_shq.a:jpgfile.g:netrw_shq + exe "silent! !gimp -s ".shellescape(a:jpgfile,1) elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") " call Decho("silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".escape(a:jpgfile," []|'")) - exe "!".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".g:netrw_shq.a:jpgfile.g:netrw_shq + exe "!".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".shellescape(a:jpgfile,1) else " call Dret("s:NFH_jpg 0") return 0 @@ -134,9 +140,9 @@ fun! s:NFH_gif(giffile) " call Dfunc("s:NFH_gif(giffile<".a:giffile.">)") if executable("gimp") - exe "silent! !gimp -s ".g:netrw_shq.a:giffile.g:netrw_shq + exe "silent! !gimp -s ".shellescape(a:giffile,1) elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") - exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".g:netrw_shq.a:giffile.g:netrw_shq + exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".shellescape(a:giffile,1) else " call Dret("s:NFH_gif 0") return 0 @@ -152,9 +158,9 @@ fun! s:NFH_png(pngfile) " call Dfunc("s:NFH_png(pngfile<".a:pngfile.">)") if executable("gimp") - exe "silent! !gimp -s ".g:netrw_shq.a:pngfile.g:netrw_shq + exe "silent! !gimp -s ".shellescape(a:pngfile,1) elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") - exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".g:netrw_shq.a:pngfile.g:netrw_shq + exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".shellescape(a:pngfile,1) else " call Dret("s:NFH_png 0") return 0 @@ -170,9 +176,9 @@ fun! s:NFH_pnm(pnmfile) " call Dfunc("s:NFH_pnm(pnmfile<".a:pnmfile.">)") if executable("gimp") - exe "silent! !gimp -s ".g:netrw_shq.a:pnmfile.g:netrw_shq + exe "silent! !gimp -s ".shellescape(a:pnmfile,1) elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") - exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".g:netrw_shq.a:pnmfile.g:netrw_shq + exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".shellescape(a:pnmfile,1) else " call Dret("s:NFH_pnm 0") return 0 @@ -190,7 +196,7 @@ fun! s:NFH_bmp(bmpfile) if executable("gimp") exe "silent! !gimp -s ".a:bmpfile elseif executable(expand("$SystemRoot")."/SYSTEM32/MSPAINT.EXE") - exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".g:netrw_shq.a:bmpfile.g:netrw_shq + exe "silent! !".expand("$SystemRoot")."/SYSTEM32/MSPAINT ".shellescape(a:bmpfile,1) else " call Dret("s:NFH_bmp 0") return 0 @@ -205,9 +211,9 @@ endfun fun! s:NFH_pdf(pdf) " call Dfunc("s:NFH_pdf(pdf<".a:pdf.">)") if executable("gs") - exe 'silent! !gs '.g:netrw_shq.a:pdf.g:netrw_shq + exe 'silent! !gs '.shellescape(a:pdf,1) elseif executable("pdftotext") - exe 'silent! pdftotext -nopgbrk '.g:netrw_shq.a:pdf.g:netrw_shq + exe 'silent! pdftotext -nopgbrk '.shellescape(a:pdf,1) else " call Dret("s:NFH_pdf 0") return 0 @@ -223,7 +229,7 @@ fun! s:NFH_doc(doc) " call Dfunc("s:NFH_doc(doc<".a:doc.">)") if executable("oowriter") - exe 'silent! !oowriter '.g:netrw_shq.a:doc.g:netrw_shq + exe 'silent! !oowriter '.shellescape(a:doc,1) redraw! else " call Dret("s:NFH_doc 0") @@ -240,7 +246,7 @@ fun! s:NFH_sxw(sxw) " call Dfunc("s:NFH_sxw(sxw<".a:sxw.">)") if executable("oowriter") - exe 'silent! !oowriter '.g:netrw_shq.a:sxw.g:netrw_shq + exe 'silent! !oowriter '.shellescape(a:sxw,1) redraw! else " call Dret("s:NFH_sxw 0") @@ -257,7 +263,7 @@ fun! s:NFH_xls(xls) " call Dfunc("s:NFH_xls(xls<".a:xls.">)") if executable("oocalc") - exe 'silent! !oocalc '.g:netrw_shq.a:xls.g:netrw_shq + exe 'silent! !oocalc '.shellescape(a:xls,1) redraw! else " call Dret("s:NFH_xls 0") @@ -274,15 +280,15 @@ fun! s:NFH_ps(ps) " call Dfunc("s:NFH_ps(ps<".a:ps.">)") if executable("gs") " call Decho("exe silent! !gs ".a:ps) - exe "silent! !gs ".g:netrw_shq.a:ps.g:netrw_shq + exe "silent! !gs ".shellescape(a:ps,1) redraw! elseif executable("ghostscript") " call Decho("exe silent! !ghostscript ".a:ps) - exe "silent! !ghostscript ".g:netrw_shq.a:ps.g:netrw_shq + exe "silent! !ghostscript ".shellescape(a:ps,1) redraw! elseif executable("gswin32") -" call Decho("exe silent! !gswin32 ".g:netrw_shq.a:ps.g:netrw_shq) - exe "silent! !gswin32 ".g:netrw_shq.a:ps.g:netrw_shq +" call Decho("exe silent! !gswin32 ".shellescape(a:ps,1)) + exe "silent! !gswin32 ".shellescape(a:ps,1) redraw! else " call Dret("s:NFH_ps 0") @@ -298,16 +304,16 @@ endfun fun! s:NFH_eps(eps) " call Dfunc("s:NFH_eps()") if executable("gs") - exe "silent! !gs ".g:netrw_shq.a:eps.g:netrw_shq + exe "silent! !gs ".shellescape(a:eps,1) redraw! elseif executable("ghostscript") - exe "silent! !ghostscript ".g:netrw_shq.a:eps.g:netrw_shq + exe "silent! !ghostscript ".shellescape(a:eps,1) redraw! elseif executable("ghostscript") - exe "silent! !ghostscript ".g:netrw_shq.a:eps.g:netrw_shq + exe "silent! !ghostscript ".shellescape(a:eps,1) redraw! elseif executable("gswin32") - exe "silent! !gswin32 ".g:netrw_shq.a:eps.g:netrw_shq + exe "silent! !gswin32 ".shellescape(a:eps,1) redraw! else " call Dret("s:NFH_eps 0") diff --git a/runtime/autoload/netrwSettings.vim b/runtime/autoload/netrwSettings.vim --- a/runtime/autoload/netrwSettings.vim +++ b/runtime/autoload/netrwSettings.vim @@ -1,7 +1,7 @@ " netrwSettings.vim: makes netrw settings simpler -" Date: Jul 02, 2008 +" Date: Sep 03, 2008 " Maintainer: Charles E Campbell, Jr -" Version: 12 +" Version: 13 " Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1 " Permission is hereby granted to use and distribute this code, " with or without modifications, provided that this copyright @@ -19,7 +19,13 @@ if exists("g:loaded_netrwSettings") || &cp finish endif -let g:loaded_netrwSettings = "v12" +let g:loaded_netrwSettings = "v13" +if v:version < 700 + echohl WarningMsg + echo "***warning*** this version of netrwSettings needs vim 7.0" + echohl Normal + finish +endif " --------------------------------------------------------------------- " NetrwSettings: {{{1 @@ -100,6 +106,7 @@ fun! netrwSettings#NetrwSettings() put = 'let g:netrw_browsex_viewer = (not defined)' endif put = 'let g:netrw_compress = '.g:netrw_compress + put = 'let g:netrw_cursorline = '.g:netrw_cursorline let decompressline= line("$") put ='let g:netrw_decompress...' put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax @@ -138,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/runtime/autoload/rubycomplete.vim b/runtime/autoload/rubycomplete.vim --- a/runtime/autoload/rubycomplete.vim +++ b/runtime/autoload/rubycomplete.vim @@ -1,7 +1,7 @@ " Vim completion script " Language: Ruby " Maintainer: Mark Guzman -" Info: $Id$ +" Info: $Id: rubycomplete.vim,v 1.41 2008/06/30 06:50:45 segy Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns diff --git a/runtime/autoload/spellfile.vim b/runtime/autoload/spellfile.vim --- a/runtime/autoload/spellfile.vim +++ b/runtime/autoload/spellfile.vim @@ -1,6 +1,6 @@ " Vim script to download a missing spell file " Maintainer: Bram Moolenaar -" Last Change: 2008 Jun 27 +" Last Change: 2008 Nov 29 if !exists('g:spellfile_URL') " Prefer using http:// when netrw should be able to use it, since @@ -39,19 +39,22 @@ function! spellfile#LoadFile(lang) let s:donedict[a:lang . &enc] = 1 " Find spell directories we can write in. - let dirlist = [] - let dirchoices = '&Cancel' - for dir in split(globpath(&rtp, 'spell'), "\n") - if filewritable(dir) == 2 - call add(dirlist, dir) - let dirchoices .= "\n&" . len(dirlist) - endif - endfor + let [dirlist, dirchoices] = spellfile#GetDirChoices() if len(dirlist) == 0 - if &verbose + let dir_to_create = spellfile#WritableSpellDir() + if &verbose || dir_to_create != '' echomsg 'spellfile#LoadFile(): There is no writable spell directory.' endif - return + if dir_to_create != '' + if confirm("Shall I create " . dir_to_create, "&Yes\n&No", 2) == 1 + " After creating the directory it should show up in the list. + call mkdir(dir_to_create, "p") + let [dirlist, dirchoices] = spellfile#GetDirChoices() + endif + endif + if len(dirlist) == 0 + return + endif endif let msg = 'Cannot find spell file for "' . a:lang . '" in ' . &enc @@ -177,3 +180,29 @@ function! spellfile#Nread(fname) unlet g:netrw_use_errorwindow endif endfunc + +" Get a list of writable spell directories and choices for confirm(). +function! spellfile#GetDirChoices() + let dirlist = [] + let dirchoices = '&Cancel' + for dir in split(globpath(&rtp, 'spell'), "\n") + if filewritable(dir) == 2 + call add(dirlist, dir) + let dirchoices .= "\n&" . len(dirlist) + endif + endfor + return [dirlist, dirchoices] +endfunc + +function! spellfile#WritableSpellDir() + if has("unix") + " For Unix always use the $HOME/.vim directory + return $HOME . "/.vim/spell" + endif + for dir in split(&rtp, ',') + if filewritable(dir) == 2 + return dir . "/spell" + endif + endfor + return '' +endfunction diff --git a/runtime/autoload/sqlcomplete.vim b/runtime/autoload/sqlcomplete.vim --- a/runtime/autoload/sqlcomplete.vim +++ b/runtime/autoload/sqlcomplete.vim @@ -1,13 +1,19 @@ " Vim OMNI completion script for SQL " Language: SQL -" Maintainer: David Fishburn -" Version: 6.0 -" Last Change: Thu 03 Apr 2008 10:37:54 PM Eastern Daylight Time +" Maintainer: David Fishburn +" Version: 7.0 +" Last Change: 2009 Jan 04 " Usage: For detailed help " ":help sql.txt" " or ":help ft-sql-omni" " or read $VIMRUNTIME/doc/sql.txt +" History +" Version 7.0 +" Better handling of object names +" Version 6.0 +" Supports object names with spaces "my table name" +" " Set completion with CTRL-X CTRL-O to autoloaded function. " This check is in place in case this script is " sourced directly instead of using the autoload feature. @@ -22,7 +28,7 @@ endif if exists('g:loaded_sql_completion') finish endif -let g:loaded_sql_completion = 50 +let g:loaded_sql_completion = 70 " Maintains filename of dictionary let s:sql_file_table = "" @@ -106,10 +112,23 @@ function! sqlcomplete#Complete(findstart let begindot = 1 endif while start > 0 - if line[start - 1] =~ '\(\w\|\s\+\)' + " Additional code was required to handle objects which + " can contain spaces like "my table name". + if line[start - 1] !~ '\(\w\|\.\)' + " If the previous character is not a period or word character + break + " elseif line[start - 1] =~ '\(\w\|\s\+\)' + " let start -= 1 + elseif line[start - 1] =~ '\w' + " If the previous character is word character continue back let start -= 1 elseif line[start - 1] =~ '\.' && \ compl_type =~ 'column\|table\|view\|procedure' + " If the previous character is a period and we are completing + " an object which can be specified with a period like this: + " table_name.column_name + " owner_name.table_name + " If lastword has already been set for column completion " break from the loop, since we do not also want to pickup " a table name if it was also supplied. @@ -184,9 +203,10 @@ function! sqlcomplete#Complete(findstart endif let compl_type_uc = substitute(compl_type, '\w\+', '\u&', '') - if s:sql_file_{compl_type} == "" - let s:sql_file_{compl_type} = DB_getDictionaryName(compl_type_uc) - endif + " Same call below, no need to do it twice + " if s:sql_file_{compl_type} == "" + " let s:sql_file_{compl_type} = DB_getDictionaryName(compl_type_uc) + " endif let s:sql_file_{compl_type} = DB_getDictionaryName(compl_type_uc) if s:sql_file_{compl_type} != "" if filereadable(s:sql_file_{compl_type}) @@ -312,9 +332,16 @@ function! sqlcomplete#Complete(findstart endif if base != '' - " Filter the list based on the first few characters the user - " entered - let expr = 'v:val '.(g:omni_sql_ignorecase==1?'=~?':'=~#').' "\\(^'.base.'\\|\\([^.]*\\)\\?'.base.'\\)"' + " Filter the list based on the first few characters the user entered. + " Check if the text matches at the beginning + " or + " Match to a owner.table or alias.column type match + " or + " Handle names with spaces "my table name" + let expr = 'v:val '.(g:omni_sql_ignorecase==1?'=~?':'=~#').' "\\(^'.base.'\\|^\\(\\w\\+\\.\\)\\?'.base.'\\)"' + " let expr = 'v:val '.(g:omni_sql_ignorecase==1?'=~?':'=~#').' "\\(^'.base.'\\)"' + " let expr = 'v:val '.(g:omni_sql_ignorecase==1?'=~?':'=~#').' "\\(^'.base.'\\|\\(\\.\\)\\?'.base.'\\)"' + " let expr = 'v:val '.(g:omni_sql_ignorecase==1?'=~?':'=~#').' "\\(^'.base.'\\|\\([^.]*\\)\\?'.base.'\\)"' let compl_list = filter(deepcopy(compl_list), expr) endif diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim --- a/runtime/autoload/tar.vim +++ b/runtime/autoload/tar.vim @@ -1,13 +1,13 @@ " tar.vim: Handles browsing tarfiles " AUTOLOAD PORTION -" Date: Aug 08, 2008 -" Version: 23 + modifications by Bram +" Date: Dec 28, 2009 +" Version: 24 " Maintainer: Charles E Campbell, Jr " License: Vim License (see vim's :help license) " " Contains many ideas from Michael Toren's " -" Copyright: Copyright (C) 2005-2008 Charles E. Campbell, Jr. {{{1 +" Copyright: Copyright (C) 2005-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, @@ -16,19 +16,22 @@ " By using this plugin, you agree that in no event will the " copyright holder be liable for any damages resulting from " the use of this software. - +" call inputsave()|call input("Press to continue")|call inputrestore() " --------------------------------------------------------------------- " Load Once: {{{1 +if &cp || exists("g:loaded_tar") + finish +endif +let g:loaded_tar= "v24" +if v:version < 702 + echohl WarningMsg + echo "***warning*** this version of tar needs vim 7.2" + echohl Normal + finish +endif let s:keepcpo= &cpo set cpo&vim -if &cp || exists("g:loaded_tar") || v:version < 700 - finish -endif -let g:loaded_tar= "v23b" "call Decho("loading autoload/tar.vim") -if v:version < 701 || (v:version == 701 && !has("patch299")) - echoerr "(autoload/tar.vim) need vim v7.1 with patchlevel 299" -endif " --------------------------------------------------------------------- " Default Settings: {{{1 @@ -44,7 +47,22 @@ endif if !exists("g:tar_writeoptions") let g:tar_writeoptions= "uf" endif - +if !exists("g:tar_copycmd") + if !exists("g:netrw_localcopycmd") + if has("win32") || has("win95") || has("win64") || has("win16") + if g:netrw_cygwin + let g:netrw_localcopycmd= "cp" + else + let g:netrw_localcopycmd= "copy" + endif + elseif has("unix") || has("macunix") + let g:netrw_localcopycmd= "cp" + else + let g:netrw_localcopycmd= "" + endif + endif + let g:tar_copycmd= g:netrw_localcopycmd +endif if !exists("g:netrw_cygwin") if has("win32") || has("win95") || has("win64") || has("win16") if &shell =~ '\%(\\|\\)\%(\.exe\)\=$' @@ -56,6 +74,9 @@ if !exists("g:netrw_cygwin") let g:netrw_cygwin= 0 endif endif +if !exists("g:tar_extractcmd") + let g:tar_extractcmd= "tar -xf" +endif " set up shell quoting character if !exists("g:tar_shq") @@ -88,7 +109,6 @@ fun! tar#Browse(tarfile) if !executable(g:tar_cmd) redraw! echohl Error | echo '***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system' -" call inputsave()|call input("Press to continue")|call inputrestore() let &report= repkeep " call Dret("tar#Browse") return @@ -99,7 +119,6 @@ fun! tar#Browse(tarfile) " if its an url, don't complain, let url-handlers such as vim do its thing redraw! echohl Error | echo "***error*** (tar#Browse) File not readable<".a:tarfile.">" | echohl None -" call inputsave()|call input("Press to continue")|call inputrestore() endif let &report= repkeep " call Dret("tar#Browse : file<".a:tarfile."> not readable") @@ -130,37 +149,38 @@ fun! tar#Browse(tarfile) let tarfile= a:tarfile if has("win32") && executable("cygpath") " assuming cygwin - let tarfile=substitute(system("cygpath -u ".s:Escape(tarfile,0)),'\n$','','e') + let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') endif let curlast= line("$") if tarfile =~# '\.\(gz\|tgz\)$' -" call Decho("1: exe silent r! gzip -d -c -- ".s:Escape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") - exe "silent r! gzip -d -c -- ".s:Escape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " +" call Decho("1: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") + exe "silent r! gzip -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " elseif tarfile =~# '\.lrp' -" call Decho("2: exe silent r! cat -- ".s:Escape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - ") - exe "silent r! cat -- ".s:Escape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - " +" call Decho("2: exe silent r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - ") + exe "silent r! cat -- ".shellescape(tarfile,1)."|gzip -d -c -|".g:tar_cmd." -".g:tar_browseoptions." - " elseif tarfile =~# '\.bz2$' -" call Decho("3: exe silent r! bzip2 -d -c -- ".s:Escape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") - exe "silent r! bzip2 -d -c -- ".s:Escape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " +" call Decho("3: exe silent r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") + exe "silent r! bzip2 -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " + elseif tarfile =~# '\.lzma$' +" call Decho("3: exe silent r! lzma -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ") + exe "silent r! lzma -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - " else if tarfile =~ '^\s*-' - " A file name starting with a dash may be taken as an option. Prepend ./ to avoid that. + " A file name starting with a dash is taken as an option. Prepend ./ to avoid that. let tarfile = substitute(tarfile, '-', './-', '') endif -" call Decho("4: exe silent r! ".g:tar_cmd." -".g:tar_browseoptions." ".s:Escape(tarfile,1)) - exe "silent r! ".g:tar_cmd." -".g:tar_browseoptions." ".s:Escape(tarfile,1) +" call Decho("4: exe silent r! ".g:tar_cmd." -".g:tar_browseoptions." ".shellescape(tarfile,0)) + exe "silent r! ".g:tar_cmd." -".g:tar_browseoptions." ".shellescape(tarfile,1) endif if v:shell_error != 0 redraw! echohl WarningMsg | echo "***warning*** (tar#Browse) please check your g:tar_browseoptions<".g:tar_browseoptions.">" -" call inputsave()|call input("Press to continue")|call inputrestore() " call Dret("tar#Browse : a:tarfile<".a:tarfile.">") return endif if line("$") == curlast || ( line("$") == (curlast + 1) && getline("$") =~ '\c\%(warning\|error\|inappropriate\|unrecognized\)') redraw! echohl WarningMsg | echo "***warning*** (tar#Browse) ".a:tarfile." doesn't appear to be a tar file" | echohl None -" call inputsave()|call input("Press to continue")|call inputrestore() silent %d let eikeep= &ei set ei=BufReadCmd,FileReadCmd @@ -189,7 +209,7 @@ fun! s:TarBrowseSelect() if !exists("g:tar_secure") && fname =~ '^\s*-\|\s\+-' redraw! - echohl WarningMsg | echo '***error*** (tar#BrowseSelect) rejecting tarfile member<'.fname.'> because of embedded "-"; See :help tar-options' + echohl WarningMsg | echo '***warning*** (tar#BrowseSelect) rejecting tarfile member<'.fname.'> because of embedded "-"' " call Dret('tar#BrowseSelect : rejecting tarfile member<'.fname.'> because of embedded "-"') return endif @@ -206,7 +226,7 @@ fun! s:TarBrowseSelect() let curfile= expand("%") if has("win32") && executable("cygpath") " assuming cygwin - let tarfile=substitute(system("cygpath -u ".s:Escape(tarfile,0)),'\n$','','e') + let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') endif new @@ -231,21 +251,24 @@ fun! tar#Read(fname,mode) let fname = substitute(a:fname,'tarfile:.\{-}::\(.*\)$','\1','') if has("win32") && executable("cygpath") " assuming cygwin - let tarfile=substitute(system("cygpath -u ".s:Escape(tarfile,0)),'\n$','','e') + let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') endif " call Decho("tarfile<".tarfile.">") " call Decho("fname<".fname.">") - if fname =~ '\.gz$' && executable("zcat") + if fname =~ '\.bz2$' && executable("bzcat") + let decmp= "|bzcat" + let doro = 1 + elseif fname =~ '\.gz$' && executable("zcat") let decmp= "|zcat" let doro = 1 - elseif fname =~ '\.bz2$' && executable("bzcat") - let decmp= "|bzcat" + elseif fname =~ '\.lzma$' && executable("lzcat") + let decmp= "|lzcat" let doro = 1 else let decmp="" let doro = 0 - if fname =~ '\.gz$\|\.bz2$\|\.Z$\|\.zip$' + if fname =~ '\.bz2$\|\.gz$\|\.lzma$\|\.zip$\|\.Z$' setlocal bin endif endif @@ -255,22 +278,25 @@ fun! tar#Read(fname,mode) else let tar_secure= " " endif - if tarfile =~# '\.\(gz\|tgz\)$' -" call Decho("5: exe silent r! gzip -d -c -- ".s:Escape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.tar_secure.s:Escape(fname,1)) - exe "silent r! gzip -d -c -- ".s:Escape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.s:Escape(fname,1).decmp + if tarfile =~# '\.bz2$' +" call Decho("7: exe silent r! bzip2 -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) + exe "silent r! bzip2 -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp + elseif tarfile =~# '\.\(gz\|tgz\)$' +" call Decho("5: exe silent r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd.' -'.g:tar_readoptions.' - '.tar_secure.shellescape(fname,1)) + exe "silent r! gzip -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp elseif tarfile =~# '\.lrp$' -" call Decho("6: exe silent r! cat ".s:Escape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.s:Escape(fname,1).decmp) - exe "silent r! cat -- ".s:Escape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.s:Escape(fname,1).decmp - elseif tarfile =~# '\.bz2$' -" call Decho("7: exe silent r! bzip2 -d -c ".s:Escape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.s:Escape(fname,1).decmp) - exe "silent r! bzip2 -d -c -- ".s:Escape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.s:Escape(fname,1).decmp +" call Decho("6: exe silent r! cat ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) + exe "silent r! cat -- ".shellescape(tarfile,1)." | gzip -d -c - | ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp + elseif tarfile =~# '\.lzma$' +" call Decho("7: exe silent r! lzma -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp) + exe "silent r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp else if tarfile =~ '^\s*-' - " A file name starting with a dash may be taken as an option. Prepend ./ to avoid that. + " A file name starting with a dash is taken as an option. Prepend ./ to avoid that. let tarfile = substitute(tarfile, '-', './-', '') endif -" call Decho("8: exe silent r! ".g:tar_cmd." -".g:tar_readoptions." "s:Escape(tarfile,1).tar_secure..s:Escape(fname,1).decmp) - exe "silent r! ".g:tar_cmd." -".g:tar_readoptions." ".s:Escape(tarfile,1).tar_secure.s:Escape(fname,1).decmp +" call Decho("8: exe silent r! ".g:tar_cmd." -".g:tar_readoptions.tar_secure.shellescape(tarfile,1)." ".shellescape(fname,1).decmp) + exe "silent r! ".g:tar_cmd." -".g:tar_readoptions.shellescape(tarfile,1)." ".tar_secure.shellescape(fname,1).decmp endif if doro @@ -298,7 +324,7 @@ fun! tar#Write(fname) if !exists("g:tar_secure") && a:fname =~ '^\s*-\|\s\+-' redraw! - echohl WarningMsg | echo '***error*** (tar#Write) rejecting tarfile member<'.a:fname.'> because of embedded "-"; See :help tar-options' + echohl WarningMsg | echo '***warning*** (tar#Write) rejecting tarfile member<'.a:fname.'> because of embedded "-"' " call Dret('tar#Write : rejecting tarfile member<'.fname.'> because of embedded "-"') return endif @@ -307,7 +333,6 @@ fun! tar#Write(fname) if !executable(g:tar_cmd) redraw! echohl Error | echo '***error*** (tar#Browse) "'.g:tar_cmd.'" not available on your system' -" call inputsave()|call input("Press to continue")|call inputrestore() let &report= repkeep " call Dret("tar#Write") return @@ -315,7 +340,6 @@ fun! tar#Write(fname) if !exists("*mkdir") redraw! echohl Error | echo "***error*** (tar#Write) sorry, mkdir() doesn't work on your system" | echohl None -" call inputsave()|call input("Press to continue")|call inputrestore() let &report= repkeep " call Dret("tar#Write") return @@ -336,7 +360,6 @@ fun! tar#Write(fname) catch /^Vim\%((\a\+)\)\=:E344/ redraw! echohl Error | echo "***error*** (tar#Write) cannot cd to temporary directory" | Echohl None -" call inputsave()|call input("Press to continue")|call inputrestore() let &report= repkeep " call Dret("tar#Write") return @@ -355,29 +378,33 @@ fun! tar#Write(fname) let fname = substitute(w:tarfile,'tarfile:.\{-}::\(.*\)$','\1','') " handle compressed archives - if tarfile =~# '\.gz' - call system("gzip -d -- ".s:Escape(tarfile,0)) + if tarfile =~# '\.bz2' + call system("bzip2 -d -- ".shellescape(tarfile,0)) + let tarfile = substitute(tarfile,'\.bz2','','e') + let compress= "bzip2 -- ".shellescape(tarfile,0) +" call Decho("compress<".compress.">") + elseif tarfile =~# '\.gz' + call system("gzip -d -- ".shellescape(tarfile,0)) let tarfile = substitute(tarfile,'\.gz','','e') - let compress= "gzip -- ".s:Escape(tarfile,0) + let compress= "gzip -- ".shellescape(tarfile,0) +" call Decho("compress<".compress.">") + elseif tarfile =~# '\.lzma' + call system("lzma -d -- ".shellescape(tarfile,0)) + let tarfile = substitute(tarfile,'\.lzma','','e') + let compress= "lzma -- ".shellescape(tarfile,0) " call Decho("compress<".compress.">") elseif tarfile =~# '\.tgz' - call system("gzip -d -- ".s:Escape(tarfile,0)) + call system("gzip -d -- ".shellescape(tarfile,0)) let tarfile = substitute(tarfile,'\.tgz','.tar','e') - let compress= "gzip -- ".s:Escape(tarfile,0) + let compress= "gzip -- ".shellescape(tarfile,0) let tgz = 1 " call Decho("compress<".compress.">") - elseif tarfile =~# '\.bz2' - call system("bzip2 -d -- ".s:Escape(tarfile,0)) - let tarfile = substitute(tarfile,'\.bz2','','e') - let compress= "bzip2 -- ".s:Escape(tarfile,0) -" call Decho("compress<".compress.">") endif " call Decho("tarfile<".tarfile.">") if v:shell_error != 0 redraw! echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".tarfile." with ".fname | echohl None -" call inputsave()|call input("Press to continue")|call inputrestore() else " call Decho("tarfile<".tarfile."> fname<".fname.">") @@ -385,7 +412,7 @@ fun! tar#Write(fname) if fname =~ '/' let dirpath = substitute(fname,'/[^/]\+$','','e') if executable("cygpath") - let dirpath = substitute(system("cygpath ".s:Escape(dirpath, 0)),'\n','','e') + let dirpath = substitute(system("cygpath ".shellescape(dirpath, 0)),'\n','','e') endif call mkdir(dirpath,"p") endif @@ -405,25 +432,23 @@ fun! tar#Write(fname) endif exe "w! ".fnameescape(fname) if executable("cygpath") - let tarfile = substitute(system("cygpath ".s:Escape(tarfile,0)),'\n','','e') + let tarfile = substitute(system("cygpath ".shellescape(tarfile,0)),'\n','','e') endif " delete old file from tarfile -" call Decho("system(".g:tar_cmd." --delete -f ".s:Escape(tarfile,0)." -- ".s:Escape(fname,0).")") - call system(g:tar_cmd." --delete -f ".s:Escape(tarfile,0).tar_secure.s:Escape(fname,0)) +" call Decho("system(".g:tar_cmd." --delete -f ".shellescape(tarfile,0)." -- ".shellescape(fname,0).")") + call system(g:tar_cmd." --delete -f ".shellescape(tarfile,0).tar_secure.shellescape(fname,0)) if v:shell_error != 0 redraw! echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None -" call inputsave()|call input("Press to continue")|call inputrestore() else " update tarfile with new file -" call Decho(g:tar_cmd." -".g:tar_writeoptions." ".s:Escape(tarfile,0).tar_secure.s:Escape(fname,0)) - call system(g:tar_cmd." -".g:tar_writeoptions." ".s:Escape(tarfile,0).tar_secure.s:Escape(fname,0)) +" call Decho(g:tar_cmd." -".g:tar_writeoptions." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0)) + call system(g:tar_cmd." -".g:tar_writeoptions." ".shellescape(tarfile,0).tar_secure.shellescape(fname,0)) if v:shell_error != 0 redraw! echohl Error | echo "***error*** (tar#Write) sorry, unable to update ".fnameescape(tarfile)." with ".fnameescape(fname) | echohl None -" call inputsave()|call input("Press to continue")|call inputrestore() elseif exists("compress") " call Decho("call system(".compress.")") call system(compress) @@ -439,13 +464,13 @@ fun! tar#Write(fname) " call Decho("handle writing <".tarfile."> across network to <".s:tblfile_{winnr()}.">") let tblfile= s:tblfile_{winnr()} 1split|enew - let binkeep= &binary + let binkeep= &l:binary let eikeep = &ei set binary ei=all exe "e! ".fnameescape(tarfile) call netrw#NetWrite(tblfile) - let &ei = eikeep - let &binary = binkeep + let &ei = eikeep + let &l:binary = binkeep q! unlet s:tblfile_{winnr()} endif @@ -462,38 +487,98 @@ fun! tar#Write(fname) endfun " --------------------------------------------------------------------- -" Rmdir: {{{2 +" s:Rmdir: {{{2 fun! s:Rmdir(fname) " call Dfunc("Rmdir(fname<".a:fname.">)") if has("unix") - call system("/bin/rm -rf -- ".s:Escape(a:fname,0)) + call system("/bin/rm -rf -- ".shellescape(a:fname,0)) elseif has("win32") || has("win95") || has("win64") || has("win16") if &shell =~? "sh$" - call system("/bin/rm -rf -- ".s:Escape(a:fname,0)) + call system("/bin/rm -rf -- ".shellescape(a:fname,0)) else - call system("del /S ".s:Escape(a:fname,0)) + call system("del /S ".shellescape(a:fname,0)) endif endif " call Dret("Rmdir") endfun " --------------------------------------------------------------------- -" s:Escape: {{{2 -fun s:Escape(name,isfilt) - " shellescape() was added by patch 7.0.111 - if exists("*shellescape") - if a:isfilt - let qnameq= shellescape(a:name,1) +" tar#Vimuntar: installs a tarball in the user's .vim / vimfiles directory {{{2 +fun! tar#Vimuntar(...) +" call Dfunc("tar#Vimuntar() a:0=".a:0." a:1<".(exists("a:1")? a:1 : "-n/a-").">") + let tarball = expand("%") +" call Decho("tarball<".tarball.">") + let tarbase = substitute(tarball,'\..*$','','') +" call Decho("tarbase<".tarbase.">") + let tarhome = expand("%:p") + if has("win32") || has("win95") || has("win64") || has("win16") + let tarhome= substitute(tarhome,'\\','/','g') + endif + let tarhome= substitute(tarhome,'/[^/]*$','','') +" call Decho("tarhome<".tarhome.">") + let tartail = expand("%:t") +" call Decho("tartail<".tartail.">") + let curdir = getcwd() +" call Decho("curdir <".curdir.">") + " set up vimhome + if a:0 > 0 && a:1 != "" + let vimhome= a:1 + else + let vimhome= vimball#VimballHome() + endif +" call Decho("vimhome<".vimhome.">") + +" call Decho("curdir<".curdir."> vimhome<".vimhome.">") + if simplify(curdir) != simplify(vimhome) + " copy (possibly compressed) tarball to .vim/vimfiles +" call Decho(netrw#WinPath(g:tar_copycmd)." ".shellescape(tartail)." ".shellescape(vimhome)) + call system(netrw#WinPath(g:tar_copycmd)." ".shellescape(tartail)." ".shellescape(vimhome)) +" call Decho("exe cd ".fnameescape(vimhome)) + exe "cd ".fnameescape(vimhome) + endif +" call Decho("getcwd<".getcwd().">") + + " if necessary, decompress the tarball; then, extract it + if tartail =~ '\.tgz' + if executable("gunzip") + silent exe "!gunzip ".shellescape(tartail) + elseif executable("gzip") + silent exe "!gzip -d ".shellescape(tartail) else - let qnameq= shellescape(a:name) + echoerr "unable to decompress<".tartail."> on this sytem" + if simplify(curdir) != simplify(tarhome) + " remove decompressed tarball, restore directory +" call Decho("delete(".tartail.".tar)") + call delete(tartail.".tar") +" call Decho("exe cd ".fnameescape(curdir)) + exe "cd ".fnameescape(curdir) + endif +" call Dret("tar#Vimuntar") + return endif else - let qnameq= g:tar_shq . a:name . g:tar_shq + call vimball#Decompress(tartail,0) endif - return qnameq + let extractcmd= netrw#WinPath(g:tar_extractcmd) +" call Decho("system(".extractcmd." ".shellescape(tarbase.".tar").")") + call system(extractcmd." ".shellescape(tarbase.".tar")) + + " set up help + if filereadable("doc/".tarbase.".txt") +" call Decho("exe helptags ".getcwd()."/doc") + exe "helptags ".getcwd()."/doc" + endif + + if simplify(tarhome) != simplify(vimhome) + " remove decompressed tarball, restore directory + call delete(vimhome."/".tarbase.".tar") + exe "cd ".fnameescape(curdir) + endif + +" call Dret("tar#Vimuntar") endfun -" --------------------------------------------------------------------- +" ===================================================================== " Modelines And Restoration: {{{1 let &cpo= s:keepcpo unlet s:keepcpo diff --git a/runtime/autoload/vimball.vim b/runtime/autoload/vimball.vim --- a/runtime/autoload/vimball.vim +++ b/runtime/autoload/vimball.vim @@ -1,9 +1,9 @@ " vimball.vim : construct a file containing both paths and files " Author: Charles E. Campbell, Jr. -" Date: Jul 30, 2008 -" Version: 29 +" Date: Dec 28, 2009 +" Version: 30 " GetLatestVimScripts: 1502 1 :AutoInstall: vimball.vim -" Copyright: (c) 2004-2008 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 = "v29" +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,write 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,write let home= expand(a:2) else " use first existing directory from rtp - let home= s:VimballHome() + let home= vimball#VimballHome() endif " save current directory @@ -218,7 +200,7 @@ fun! vimball#Vimball(really,...) return endif - if getline(1) !~ '^" Vimball Archiver by Charles E. Campbell, Jr., Ph.D.$' + if getline(1) !~ '^" Vimball Archiver' echoerr "(Vimball) The current file does not appear to be a Vimball!" " call Dret("vimball#Vimball") return @@ -240,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.">") @@ -272,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) @@ -307,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 @@ -337,9 +321,13 @@ fun! vimball#Vimball(really,...) if a:really 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 @@ -418,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.">") @@ -432,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) @@ -472,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 @@ -536,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 @@ -646,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 @@ -674,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 @@ -743,20 +733,5 @@ fun! vimball#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/runtime/colors/desert.vim b/runtime/colors/desert.vim --- a/runtime/colors/desert.vim +++ b/runtime/colors/desert.vim @@ -1,9 +1,9 @@ " Vim color file " Maintainer: Hans Fugal -" Last Change: $Date$ -" Last Change: $Date$ +" Last Change: $Date: 2004/06/13 19:30:30 $ +" Last Change: $Date: 2004/06/13 19:30:30 $ " URL: http://hans.fugal.net/vim/colors/desert.vim -" Version: $Id$ +" Version: $Id: desert.vim,v 1.1 2004/06/13 19:30:30 vimboss Exp $ " cool help screens " :he group-name diff --git a/runtime/compiler/decada.vim b/runtime/compiler/decada.vim --- a/runtime/compiler/decada.vim +++ b/runtime/compiler/decada.vim @@ -1,13 +1,13 @@ "------------------------------------------------------------------------------ " Description: Vim Ada/Dec Ada compiler file " Language: Ada (Dec Ada) -" $Id$ +" $Id: decada.vim 887 2008-07-08 14:29:01Z krischik $ " Copyright: Copyright (C) 2006 Martin Krischik " Maintainer: Martin Krischik -" $Author$ -" $Date$ +" $Author: krischik $ +" $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $ " Version: 4.6 -" $Revision$ +" $Revision: 887 $ " $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/compiler/decada.vim $ " History: 21.07.2006 MK New Dec Ada " 15.10.2006 MK Bram's suggestion for runtime integration diff --git a/runtime/compiler/eruby.vim b/runtime/compiler/eruby.vim --- a/runtime/compiler/eruby.vim +++ b/runtime/compiler/eruby.vim @@ -1,7 +1,7 @@ " Vim compiler file " Language: eRuby " Maintainer: Doug Kearns -" Info: $Id$ +" Info: $Id: eruby.vim,v 1.7 2008/06/29 04:18:42 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns diff --git a/runtime/compiler/fortran_g77.vim b/runtime/compiler/fortran_g77.vim --- a/runtime/compiler/fortran_g77.vim +++ b/runtime/compiler/fortran_g77.vim @@ -1,8 +1,8 @@ " Vim compiler file " Compiler: g77 (GNU Fortran) " Maintainer: Ralf Wildenhues -" Last Change: $Date$ -" $Revision$ +" Last Change: $Date: 2004/06/13 18:17:36 $ +" $Revision: 1.1 $ if exists("current_compiler") finish diff --git a/runtime/compiler/gcc.vim b/runtime/compiler/gcc.vim --- a/runtime/compiler/gcc.vim +++ b/runtime/compiler/gcc.vim @@ -1,7 +1,7 @@ " Vim compiler file " Compiler: GNU C Compiler " Maintainer: Nikolai Weibull -" Latest Revision: 2006-12-20 +" Latest Revision: 2009-05-01 if exists("current_compiler") finish @@ -12,10 +12,13 @@ let s:cpo_save = &cpo set cpo-=C CompilerSet errorformat= + \%*[^\"]\"%f\"%*\\D%l:%c:\ %m, \%*[^\"]\"%f\"%*\\D%l:\ %m, + \\"%f\"%*\\D%l:%c:\ %m, \\"%f\"%*\\D%l:\ %m, \%-G%f:%l:\ %trror:\ (Each\ undeclared\ identifier\ is\ reported\ only\ once, \%-G%f:%l:\ %trror:\ for\ each\ function\ it\ appears\ in.), + \%f:%l:%c:\ %m, \%f:%l:\ %m, \\"%f\"\\,\ line\ %l%*\\D%c%*[^\ ]\ %m, \%D%*\\a[%*\\d]:\ Entering\ directory\ `%f', diff --git a/runtime/compiler/gnat.vim b/runtime/compiler/gnat.vim --- a/runtime/compiler/gnat.vim +++ b/runtime/compiler/gnat.vim @@ -1,14 +1,14 @@ "------------------------------------------------------------------------------ " Description: Vim Ada/GNAT compiler file " Language: Ada (GNAT) -" $Id$ +" $Id: gnat.vim 887 2008-07-08 14:29:01Z krischik $ " Copyright: Copyright (C) 2006 Martin Krischik " Maintainer: Martin Krischi k " Ned Okie -" $Author$ -" $Date$ +" $Author: krischik $ +" $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $ " Version: 4.6 -" $Revision$ +" $Revision: 887 $ " $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/compiler/gnat.vim $ " History: 24.05.2006 MK Unified Headers " 16.07.2006 MK Ada-Mode as vim-ball diff --git a/runtime/compiler/jikes.vim b/runtime/compiler/jikes.vim --- a/runtime/compiler/jikes.vim +++ b/runtime/compiler/jikes.vim @@ -1,8 +1,8 @@ " Vim Compiler File " Compiler: Jikes " Maintainer: Dan Sharp -" Last Change: 2004 Mar 27 -" URL: http://mywebpage.netscape.com/sharppeople/vim/compiler +" Last Change: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/compiler if exists("current_compiler") finish diff --git a/runtime/compiler/rspec.vim b/runtime/compiler/rspec.vim --- a/runtime/compiler/rspec.vim +++ b/runtime/compiler/rspec.vim @@ -1,7 +1,7 @@ " Vim compiler file " Language: RSpec " Maintainer: Tim Pope -" Info: $Id$ +" Info: $Id: rspec.vim,v 1.2 2008/06/29 04:18:42 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns diff --git a/runtime/compiler/ruby.vim b/runtime/compiler/ruby.vim --- a/runtime/compiler/ruby.vim +++ b/runtime/compiler/ruby.vim @@ -2,7 +2,7 @@ " Language: Ruby " Function: Syntax check and/or error reporting " Maintainer: Tim Hammerquist -" Info: $Id$ +" Info: $Id: ruby.vim,v 1.13 2008/06/29 04:18:43 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns diff --git a/runtime/compiler/rubyunit.vim b/runtime/compiler/rubyunit.vim --- a/runtime/compiler/rubyunit.vim +++ b/runtime/compiler/rubyunit.vim @@ -1,7 +1,7 @@ " Vim compiler file " Language: Test::Unit - Ruby Unit Testing Framework " Maintainer: Doug Kearns -" Info: $Id$ +" Info: $Id: rubyunit.vim,v 1.12 2008/06/29 04:18:43 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns diff --git a/runtime/compiler/splint.vim b/runtime/compiler/splint.vim --- a/runtime/compiler/splint.vim +++ b/runtime/compiler/splint.vim @@ -3,7 +3,7 @@ " Maintainer: Ralf Wildenhues " Splint Home: http://www.splint.org/ " Last Change: 2005 Apr 21 -" $Revision$ +" $Revision: 1.3 $ if exists("current_compiler") finish diff --git a/runtime/filetype.vim b/runtime/filetype.vim --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar -" Last Change: 2008 Aug 03 +" Last Change: 2009 Dec 24 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -110,12 +110,15 @@ au BufNewFile,BufRead build.xml setf a au BufNewFile,BufRead proftpd.conf* call s:StarSetf('apachestyle') " Apache config file -au BufNewFile,BufRead .htaccess setf apache -au BufNewFile,BufRead httpd.conf*,srm.conf*,access.conf*,apache.conf*,apache2.conf*,/etc/apache2/*.conf* call s:StarSetf('apache') +au BufNewFile,BufRead .htaccess,/etc/httpd/*.conf setf apache +au BufNewFile,BufRead httpd.conf*,srm.conf*,access.conf*,apache.conf*,apache2.conf*,/etc/apache2/*.conf*,/etc/httpd/conf.d/*.conf* call s:StarSetf('apache') " XA65 MOS6510 cross assembler au BufNewFile,BufRead *.a65 setf a65 +" Applescript +au BufNewFile,BufRead *.scpt setf applescript + " Applix ELF au BufNewFile,BufRead *.am \ if expand("") !~? 'Makefile.am\>' | setf elf | endif @@ -350,10 +353,9 @@ au BufNewFile,BufRead *.cpp \ if exists("cynlib_syntax_for_cpp")|setf cynlib|else|setf cpp|endif " C++ +au BufNewFile,BufRead *.cxx,*.c++,*.hh,*.hxx,*.hpp,*.ipp,*.moc,*.tcc,*.inl setf cpp if has("fname_case") - au BufNewFile,BufRead *.cxx,*.c++,*.C,*.H,*.hh,*.hxx,*.hpp,*.moc,*.tcc,*.inl setf cpp -else - au BufNewFile,BufRead *.cxx,*.c++,*.hh,*.hxx,*.hpp,*.moc,*.tcc,*.inl setf cpp + au BufNewFile,BufRead *.C,*.H setf cpp endif " .h files can be C, Ch C++, ObjC or ObjC++. @@ -364,9 +366,9 @@ au BufNewFile,BufRead *.h call s:FThea func! s:FTheader() if match(getline(1, min([line("$"), 200])), '^@\(interface\|end\|class\)') > -1 setf objc - elseif exists("c_syntax_for_h") + elseif exists("g:c_syntax_for_h") setf c - elseif exists("ch_syntax_for_h") + elseif exists("g:ch_syntax_for_h") setf ch else setf cpp @@ -669,8 +671,9 @@ au BufNewFile,BufRead *.factor setf fa " Fetchmail RC file au BufNewFile,BufRead .fetchmailrc setf fetchmail -" FlexWiki -au BufNewFile,BufRead *.wiki setf flexwiki +" FlexWiki - disabled, because it has side effects when a .wiki file +" is not actually FlexWiki +"au BufNewFile,BufRead *.wiki setf flexwiki " Focus Executable au BufNewFile,BufRead *.fex,*.focexec setf focexec @@ -704,12 +707,12 @@ au BufNewFile,BufRead .gdbinit setf gd au BufNewFile,BufRead *.mo,*.gdmo setf gdmo " Gedcom -au BufNewFile,BufRead *.ged setf gedcom +au BufNewFile,BufRead *.ged,lltxxxxx.txt setf gedcom " Git -autocmd BufNewFile,BufRead *.git/COMMIT_EDITMSG setf gitcommit -autocmd BufNewFile,BufRead *.git/config,.gitconfig setf gitconfig -autocmd BufNewFile,BufRead git-rebase-todo setf gitrebase +autocmd BufNewFile,BufRead *.git/COMMIT_EDITMSG setf gitcommit +autocmd BufNewFile,BufRead *.git/config,.gitconfig,.gitmodules setf gitconfig +autocmd BufNewFile,BufRead git-rebase-todo setf gitrebase autocmd BufNewFile,BufRead .msg.[0-9]* \ if getline(1) =~ '^From.*# This line is ignored.$' | \ setf gitsendemail | @@ -896,7 +899,7 @@ au BufNewFile,BufRead *.java,*.jav setf au BufNewFile,BufRead *.jj,*.jjt setf javacc " JavaScript, ECMAScript -au BufNewFile,BufRead *.js,*.javascript,*.es setf javascript +au BufNewFile,BufRead *.js,*.javascript,*.es,*.jsx setf javascript " Java Server Pages au BufNewFile,BufRead *.jsp setf jsp @@ -1043,7 +1046,7 @@ func! s:FTm() let n = 1 while n < 10 let line = getline(n) - if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\)' + if line =~ '^\s*\(#\s*\(include\|import\)\>\|/\*\|//\)' setf objc return endif @@ -1070,6 +1073,9 @@ au BufNewFile,BufRead *.nb setf mma " Maya Extension Language au BufNewFile,BufRead *.mel setf mel +" Mercurial config (looks like generic config file) +au BufNewFile,BufRead *.hgrc,*hgrc setf cfg + " Messages au BufNewFile,BufRead /var/log/messages,/var/log/messages.*[0-9] setf messages @@ -1260,7 +1266,7 @@ if has("fname_case") else au BufNewFile,BufRead *.pl call s:FTpl() endif -au BufNewFile,BufRead *.plx setf perl +au BufNewFile,BufRead *.plx,*.al setf perl func! s:FTpl() if exists("g:filetype_pl") @@ -1552,6 +1558,7 @@ endfunc " Remind au BufNewFile,BufRead .reminders* call s:StarSetf('remind') +au BufNewFile,BufRead *.remind,*.rem setf remind " Resolv.conf au BufNewFile,BufRead resolv.conf setf resolv @@ -1586,7 +1593,7 @@ au BufNewFile,BufRead *.builder,*.rxml,* " Rantfile and Rakefile is like Ruby au BufNewFile,BufRead [rR]antfile,*.rant,[rR]akefile,*.rake setf ruby -" S-lang (or shader language!) +" S-lang (or shader language, or SmallLisp) au BufNewFile,BufRead *.sl setf slang " Samba config @@ -1685,7 +1692,15 @@ func! SetFileTypeSH(name) if expand("") =~ g:ft_ignore_pat return endif - if a:name =~ '\' + if a:name =~ '\' + " Some .sh scripts contain #!/bin/csh. + call SetFileTypeShell("csh") + return + elseif a:name =~ '\' + " Some .sh scripts contain #!/bin/tcsh. + call SetFileTypeShell("tcsh") + return + elseif a:name =~ '\' let b:is_kornshell = 1 if exists("b:is_bash") unlet b:is_bash @@ -1823,10 +1838,15 @@ au BufNewFile,BufRead *.rules call s:F let s:ft_rules_udev_rules_pattern = '^\s*\cudev_rules\s*=\s*"\([^"]\{-1,}\)/*".*' func! s:FTRules() - if expand(':p') =~ '^/etc/udev/\%(rules\.d/\)\=.*\.rules$' + let path = expand(':p') + if path =~ '^/etc/udev/\%(rules\.d/\)\=.*\.rules$' setf udevrules return endif + if path =~ '^/etc/ufw/' + setf conf " Better than hog + return + endif try let config_lines = readfile('/etc/udev/udev.conf') catch /^Vim\%((\a\+)\)\=:E484/ @@ -1909,6 +1929,9 @@ au BufNewFile,BufRead *.cm setf voscm " Sysctl au BufNewFile,BufRead /etc/sysctl.conf setf sysctl +" Synopsys Design Constraints +au BufNewFile,BufRead *.sdc setf sdc + " Sudoers au BufNewFile,BufRead /etc/sudoers,sudoers.tmp setf sudoers @@ -1944,6 +1967,10 @@ au BufNewFile,BufRead tags setf tags " TAK au BufNewFile,BufRead *.tak setf tak +" Task +au BufRead,BufNewFile {pending,completed,undo}.data setf taskdata +au BufRead,BufNewFile *.task setf taskedit + " Tcl (JACL too) au BufNewFile,BufRead *.tcl,*.tk,*.itcl,*.itk,*.jacl setf tcl @@ -2079,8 +2106,13 @@ au BufNewFile,BufRead *.vim,*.vba,.exrc, " Viminfo file au BufNewFile,BufRead .viminfo,_viminfo setf viminfo -" Virata Config Script File -au BufRead,BufNewFile *.hw,*.module,*.pkg setf virata +" Virata Config Script File or Drupal module +au BufRead,BufNewFile *.hw,*.module,*.pkg + \ if getline(1) =~ ' -" Last Change: 2004 Jul 06 +" Last Change: 2008 Oct 5 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") | finish | endif @@ -13,13 +13,6 @@ let b:did_ftplugin = 1 let s:cpo_save = &cpoptions set cpoptions&vim -" Folding -if version >= 600 - " Fold all lines that do not begin with * - setlocal foldexpr=getline(v:lnum)[0]!=\"\*\" - setlocal foldmethod=expr -endif - " Set the format of the include file specification for Abaqus " Used in :check gf ^wf [i and other commands setlocal include=\\<\\cINPUT\\s*= @@ -42,29 +35,43 @@ setlocal define=^\\*\\a.*\\c\\(NAME\\\|N " Abaqus keywords and identifiers may include a - character setlocal iskeyword+=- +let b:undo_ftplugin = "setlocal include< includeexpr< isfname<" + \ . " comments< commentstring< define< iskeyword<" + +if has("folding") + " Fold all lines that do not begin with * + setlocal foldexpr=getline(v:lnum)[0]!=\"\*\" + setlocal foldmethod=expr + let b:undo_ftplugin .= " foldexpr< foldmethod<" +endif + " Set the file browse filter (currently only supported under Win32 gui) if has("gui_win32") && !exists("b:browsefilter") let b:browsefilter = "Abaqus Input Files (*.inp *.inc)\t*.inp;*.inc\n" . \ "Abaqus Results (*.dat)\t*.dat\n" . \ "Abaqus Messages (*.pre *.msg *.sta)\t*.pre;*.msg;*.sta\n" . \ "All Files (*.*)\t*.*\n" + let b:undo_ftplugin .= "|unlet b:browsefilter" endif -" Define keys used to move [count] sections backward or forward. -" TODO: Make this do something intelligent in visual mode. -nnoremap [[ :call Abaqus_Jump('?^\*\a?') -nnoremap ]] :call Abaqus_Jump('/^\*\a/') -function! Abaqus_Jump(motion) range - let s:count = v:count1 - mark ' - while s:count > 0 - silent! execute a:motion - let s:count = s:count - 1 - endwhile -endfunction +" Define patterns for the matchit plugin +if exists("loaded_matchit") && !exists("b:match_words") + let b:match_ignorecase = 1 + let b:match_words = + \ '\*part:\*end\s*part,' . + \ '\*assembly:\*end\s*assembly,' . + \ '\*instance:\*end\s*instance,' . + \ '\*step:\*end\s*step' + let b:undo_ftplugin .= "|unlet b:match_ignorecase b:match_words" +endif + +" Define keys used to move [count] keywords backward or forward. +noremap [[ ?^\*\a:nohlsearch +noremap ]] /^\*\a:nohlsearch " Define key to toggle commenting of the current line or range -noremap :call Abaqus_ToggleComment()j +noremap + \ :call Abaqus_ToggleComment()j function! Abaqus_ToggleComment() range if strpart(getline(a:firstline), 0, 2) == "**" " Un-comment all lines in range @@ -75,5 +82,8 @@ function! Abaqus_ToggleComment() ra endif endfunction +let b:undo_ftplugin .= "|unmap [[|unmap ]]" + \ . "|unmap " + " Restore saved compatibility options let &cpoptions = s:cpo_save diff --git a/runtime/ftplugin/ada.vim b/runtime/ftplugin/ada.vim --- a/runtime/ftplugin/ada.vim +++ b/runtime/ftplugin/ada.vim @@ -1,14 +1,14 @@ "------------------------------------------------------------------------------ " Description: Perform Ada specific completion & tagging. " Language: Ada (2005) -" $Id$ +" $Id: ada.vim 887 2008-07-08 14:29:01Z krischik $ " Maintainer: Martin Krischik " Taylor Venable " Neil Bird -" $Author$ -" $Date$ +" $Author: krischik $ +" $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $ " Version: 4.6 -" $Revision$ +" $Revision: 887 $ " $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/ftplugin/ada.vim $ " History: 24.05.2006 MK Unified Headers " 26.05.2006 MK ' should not be in iskeyword. diff --git a/runtime/ftplugin/ant.vim b/runtime/ftplugin/ant.vim --- a/runtime/ftplugin/ant.vim +++ b/runtime/ftplugin/ant.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: ant -" Maintainer: Dan Sharp -" Last Changed: 2003 Sep 29 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Changed: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif diff --git a/runtime/ftplugin/aspvbs.vim b/runtime/ftplugin/aspvbs.vim --- a/runtime/ftplugin/aspvbs.vim +++ b/runtime/ftplugin/aspvbs.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: aspvbs -" Maintainer: Dan Sharp -" Last Changed: 2004 Jun 28 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Changed: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif diff --git a/runtime/ftplugin/bst.vim b/runtime/ftplugin/bst.vim --- a/runtime/ftplugin/bst.vim +++ b/runtime/ftplugin/bst.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: bst " Author: Tim Pope -" $Id$ +" $Id: bst.vim,v 1.1 2007/05/05 17:37:57 vimboss Exp $ if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/changelog.vim b/runtime/ftplugin/changelog.vim --- a/runtime/ftplugin/changelog.vim +++ b/runtime/ftplugin/changelog.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: generic Changelog file " Maintainer: Nikolai Weibull -" Latest Revision: 2007-05-21 +" Latest Revision: 2009-05-25 " Variables: " g:changelog_timeformat (deprecated: use g:changelog_dateformat instead) - " description: the timeformat used in ChangeLog entries. @@ -46,73 +46,78 @@ if &filetype == 'changelog' endif endif - " Try to figure out a reasonable username of the form: - " Full Name . - if !exists('g:changelog_username') - if exists('$EMAIL') && $EMAIL != '' - let g:changelog_username = $EMAIL - elseif exists('$EMAIL_ADDRESS') && $EMAIL_ADDRESS != '' - " This is some Debian junk if I remember correctly. - let g:changelog_username = $EMAIL_ADDRESS - else - " Get the users login name. - let login = system('whoami') - if v:shell_error - let login = 'unknown' - else - let newline = stridx(login, "\n") - if newline != -1 - let login = strpart(login, 0, newline) - endif - endif + function! s:username() + if exists('g:changelog_username') + return g:changelog_username + elseif $EMAIL != "" + return $EMAIL + elseif $EMAIL_ADDRESS != "" + return $EMAIL_ADDRESS + endif + + let login = s:login() + return printf('%s <%s@%s>', s:name(login), login, s:hostname()) + endfunction + + function! s:login() + return s:trimmed_system_with_default('whoami', 'unknown') + endfunction + + function! s:trimmed_system_with_default(command, default) + return s:first_line(s:system_with_default(a:command, a:default)) + endfunction + + function! s:system_with_default(command, default) + let output = system(a:command) + if v:shell_error + return default + endif + return output + endfunction + + function! s:first_line(string) + return substitute(a:string, '\n.*$', "", "") + endfunction - " Try to get the full name from gecos field in /etc/passwd. - if filereadable('/etc/passwd') - for line in readfile('/etc/passwd') - if line =~ '^' . login - let name = substitute(line,'^\%([^:]*:\)\{4}\([^:]*\):.*$','\1','') - " Only keep stuff before the first comma. - let comma = stridx(name, ',') - if comma != -1 - let name = strpart(name, 0, comma) - endif - " And substitute & in the real name with the login of our user. - let amp = stridx(name, '&') - if amp != -1 - let name = strpart(name, 0, amp) . toupper(login[0]) . - \ strpart(login, 1) . strpart(name, amp + 1) - endif - endif - endfor + function! s:name(login) + for name in [s:gecos_name(a:login), $NAME, s:capitalize(a:login)] + if name != "" + return name endif + endfor + endfunction + + function! s:gecos_name(login) + for line in s:try_reading_file('/etc/passwd') + if line =~ '^' . a:login . ':' + return substitute(s:passwd_field(line, 5), '&', s:capitalize(a:login), "") + endif + endfor + return "" + endfunction - " If we haven't found a name, try to gather it from other places. - if !exists('name') - " Maybe the environment has something of interest. - if exists("$NAME") - let name = $NAME - else - " No? well, use the login name and capitalize first - " character. - let name = toupper(login[0]) . strpart(login, 1) - endif - endif + function! s:try_reading_file(path) + try + return readfile(a:path) + endtry + return [] + endfunction - " Get our hostname. - let hostname = system('hostname') - if v:shell_error - let hostname = 'localhost' - else - let newline = stridx(hostname, "\n") - if newline != -1 - let hostname = strpart(hostname, 0, newline) - endif - endif + function! s:passwd_field(line, field) + let fields = split(a:line, ':', 1) + if len(fields) < field + return "" + endif + return fields[field - 1] + endfunction - " And finally set the username. - let g:changelog_username = name . ' <' . login . '@' . hostname . '>' - endif - endif + function! s:capitalize(word) + return toupper(a:word[0]) . strpart(a:word, 1) + endfunction + + function! s:hostname() + return s:trimmed_system_with_default('hostname', 'localhost') + endfunction " Format used for new date entries. if !exists('g:changelog_new_date_format') @@ -178,7 +183,7 @@ if &filetype == 'changelog' " Ok, now we look for the end of the date entry, and add an entry. call cursor(nextnonblank(line('.') + 1), 1) if search(g:changelog_date_end_entry_search, 'W') > 0 - let p = line('.') - 1 + let p = (line('.') == line('$')) ? line('.') : line('.') - 1 else let p = line('.') endif @@ -217,7 +222,7 @@ if &filetype == 'changelog' endfunction if exists(":NewChangelogEntry") != 2 - map o :call new_changelog_entry() + noremap o :call new_changelog_entry() command! -nargs=0 NewChangelogEntry call s:new_changelog_entry() endif @@ -236,14 +241,48 @@ if &filetype == 'changelog' let &cpo = s:cpo_save unlet s:cpo_save else + let s:cpo_save = &cpo + set cpo&vim + " Add the Changelog opening mapping - nmap o :call open_changelog() + nnoremap o :call open_changelog() function! s:open_changelog() - if !filereadable('ChangeLog') + let path = expand('%:p:h') + if exists('b:changelog_path') + let changelog = b:changelog_path + else + if exists('b:changelog_name') + let name = b:changelog_name + else + let name = 'ChangeLog' + endif + while isdirectory(path) + let changelog = path . '/' . name + if filereadable(changelog) + break + endif + let parent = substitute(path, '/\+[^/]*$', "", "") + if path == parent + break + endif + let path = parent + endwhile + endif + if !filereadable(changelog) return endif - let buf = bufnr('ChangeLog') + + if exists('b:changelog_entry_prefix') + let prefix = call(b:changelog_entry_prefix, []) + else + let prefix = substitute(strpart(expand('%:p'), strlen(path)), '^/\+', "", "") . ':' + endif + if !empty(prefix) + let prefix = ' ' . prefix + endif + + let buf = bufnr(changelog) if buf != -1 if bufwinnr(buf) != -1 execute bufwinnr(buf) . 'wincmd w' @@ -251,9 +290,12 @@ else execute 'sbuffer' buf endif else - split ChangeLog + execute 'split' fnameescape(changelog) endif - call s:new_changelog_entry() + call s:new_changelog_entry(prefix) endfunction + + let &cpo = s:cpo_save + unlet s:cpo_save endif diff --git a/runtime/ftplugin/cobol.vim b/runtime/ftplugin/cobol.vim --- a/runtime/ftplugin/cobol.vim +++ b/runtime/ftplugin/cobol.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: cobol " Author: Tim Pope -" $Id$ +" $Id: cobol.vim,v 1.1 2007/05/05 17:24:38 vimboss Exp $ " Insert mode mappings: " Normal mode mappings: < > << >> [[ ]] [] ][ diff --git a/runtime/ftplugin/config.vim b/runtime/ftplugin/config.vim --- a/runtime/ftplugin/config.vim +++ b/runtime/ftplugin/config.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: config -" Maintainer: Dan Sharp -" Last Changed: 2004 Jul 08 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Changed: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif diff --git a/runtime/ftplugin/csc.vim b/runtime/ftplugin/csc.vim --- a/runtime/ftplugin/csc.vim +++ b/runtime/ftplugin/csc.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: csc -" Maintainer: Dan Sharp -" Last Changed: 2003 Sep 29 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Changed: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 diff --git a/runtime/ftplugin/csh.vim b/runtime/ftplugin/csh.vim --- a/runtime/ftplugin/csh.vim +++ b/runtime/ftplugin/csh.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: csh -" Maintainer: Dan Sharp -" Last Changed: 2003 Sep 29 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Changed: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 diff --git a/runtime/ftplugin/dosbatch.vim b/runtime/ftplugin/dosbatch.vim --- a/runtime/ftplugin/dosbatch.vim +++ b/runtime/ftplugin/dosbatch.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: MS-DOS .bat files " Maintainer: Mike Williams -" Last Change: 5th February 2003 +" Last Change: 27th May 2009 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -12,10 +12,10 @@ endif let b:did_ftplugin = 1 " BAT comment formatting -setlocal comments=b:rem,b:@rem,b:REM,b:@REM,b::: +setlocal comments=b:rem,b:@rem,b:REM,b:@REM,::: setlocal formatoptions-=t formatoptions+=rol " Define patterns for the browse file filter if has("gui_win32") && !exists("b:browsefilter") - let b:browsefilter = "DOS Batch Files (*.bat, *.btm, *.cmd)\t*.bat;*.btm;*.cmd\nAll Files (*.*)\t*.*\n" + let b:browsefilter = "DOS Batch Files (*.bat, *.cmd)\t*.bat;*.cmd\nAll Files (*.*)\t*.*\n" endif diff --git a/runtime/ftplugin/dtd.vim b/runtime/ftplugin/dtd.vim --- a/runtime/ftplugin/dtd.vim +++ b/runtime/ftplugin/dtd.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: dtd -" Maintainer: Dan Sharp -" Last Changed: 30 Jun 2008 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Changed: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 diff --git a/runtime/ftplugin/eruby.vim b/runtime/ftplugin/eruby.vim --- a/runtime/ftplugin/eruby.vim +++ b/runtime/ftplugin/eruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: eRuby " Maintainer: Tim Pope -" Info: $Id$ +" Info: $Id: eruby.vim,v 1.12 2008/06/29 04:18:43 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns diff --git a/runtime/ftplugin/git.vim b/runtime/ftplugin/git.vim --- a/runtime/ftplugin/git.vim +++ b/runtime/ftplugin/git.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: generic git output -" Maintainer: Tim Pope -" Last Change: 2008 Jul 30 +" Maintainer: Tim Pope +" Last Change: 2009 Dec 24 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) @@ -29,6 +29,9 @@ if exists('*shellescape') && exists('b:g else setlocal keywordprg=git\ show endif +if has('gui_running') + let &l:keywordprg = substitute(&l:keywordprg,'^git\>','git --no-pager','') +endif setlocal includeexpr=substitute(v:fname,'^[^/]\\+/','','') let b:undo_ftplugin = "setl keywordprg< path< includeexpr<" diff --git a/runtime/ftplugin/gitcommit.vim b/runtime/ftplugin/gitcommit.vim --- a/runtime/ftplugin/gitcommit.vim +++ b/runtime/ftplugin/gitcommit.vim @@ -1,7 +1,7 @@ " Vim filetype plugin -" Language: git config file -" Maintainer: Tim Pope -" Last Change: 2008 Jun 04 +" Language: git commit file +" Maintainer: Tim Pope +" Last Change: 2009 Dec 24 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) diff --git a/runtime/ftplugin/gitconfig.vim b/runtime/ftplugin/gitconfig.vim --- a/runtime/ftplugin/gitconfig.vim +++ b/runtime/ftplugin/gitconfig.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: git config file -" Maintainer: Tim Pope -" Last Change: 2007 Dec 16 +" Maintainer: Tim Pope +" Last Change: 2009 Dec 24 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) diff --git a/runtime/ftplugin/gitrebase.vim b/runtime/ftplugin/gitrebase.vim --- a/runtime/ftplugin/gitrebase.vim +++ b/runtime/ftplugin/gitrebase.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: git rebase --interactive -" Maintainer: Tim Pope -" Last Change: 2008 Apr 16 +" Maintainer: Tim Pope +" Last Change: 2009 Dec 24 " Only do this when not done yet for this buffer if (exists("b:did_ftplugin")) @@ -22,12 +22,13 @@ function! s:choose(word) endfunction function! s:cycle() - call s:choose(get({'s':'edit','p':'squash'},getline('.')[0],'pick')) + call s:choose(get({'s':'edit','p':'squash','e':'reword'},getline('.')[0],'pick')) endfunction command! -buffer -bar Pick :call s:choose('pick') command! -buffer -bar Squash :call s:choose('squash') command! -buffer -bar Edit :call s:choose('edit') +command! -buffer -bar Reword :call s:choose('reword') command! -buffer -bar Cycle :call s:cycle() " The above are more useful when they are mapped; for example: "nnoremap S :Cycle diff --git a/runtime/ftplugin/gitsendemail.vim b/runtime/ftplugin/gitsendemail.vim --- a/runtime/ftplugin/gitsendemail.vim +++ b/runtime/ftplugin/gitsendemail.vim @@ -1,6 +1,6 @@ " Vim filetype plugin " Language: git send-email message -" Maintainer: Tim Pope -" Last Change: 2007 Dec 16 +" Maintainer: Tim Pope +" Last Change: 2009 Dec 24 runtime! ftplugin/mail.vim diff --git a/runtime/ftplugin/html.vim b/runtime/ftplugin/html.vim --- a/runtime/ftplugin/html.vim +++ b/runtime/ftplugin/html.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: html -" Maintainer: Dan Sharp -" Last Changed: 2007 Nov 20 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Changed: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 diff --git a/runtime/ftplugin/java.vim b/runtime/ftplugin/java.vim --- a/runtime/ftplugin/java.vim +++ b/runtime/ftplugin/java.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: Java -" Maintainer: Dan Sharp -" Last Change: 2005 Mar 28 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Change: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 diff --git a/runtime/ftplugin/jsp.vim b/runtime/ftplugin/jsp.vim --- a/runtime/ftplugin/jsp.vim +++ b/runtime/ftplugin/jsp.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: jsp -" Maintainer: Dan Sharp -" Last Changed: 2005 Oct 10 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Changed: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif diff --git a/runtime/ftplugin/mail.vim b/runtime/ftplugin/mail.vim --- a/runtime/ftplugin/mail.vim +++ b/runtime/ftplugin/mail.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: Mail " Maintainer: Bram Moolenaar -" Last Change: 2007 Apr 30 +" Last Change: 2009 Jun 03 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -23,7 +23,7 @@ endif " Set 'formatoptions' to break text lines and keep the comment leader ">". setlocal fo+=tcql -" Add mappings, unless the user didn't want this. +" Add mappings, unless the user doesn't want this. if !exists("no_plugin_maps") && !exists("no_mail_maps") " Quote text by inserting "> " if !hasmapto('MailQuote') diff --git a/runtime/ftplugin/man.vim b/runtime/ftplugin/man.vim --- a/runtime/ftplugin/man.vim +++ b/runtime/ftplugin/man.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: man -" Maintainer: Nam SungHyun -" Last Change: 2007 Nov 30 +" Maintainer: SungHyun Nam +" Last Change: 2008 Sep 17 " To make the ":Man" command available before editing a manual page, source " this script from your startup vimrc file. diff --git a/runtime/ftplugin/pascal.vim b/runtime/ftplugin/pascal.vim --- a/runtime/ftplugin/pascal.vim +++ b/runtime/ftplugin/pascal.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: pascal -" Maintainer: Dan Sharp -" Last Changed: 2005 Sep 05 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Changed: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 diff --git a/runtime/ftplugin/perl.vim b/runtime/ftplugin/perl.vim --- a/runtime/ftplugin/perl.vim +++ b/runtime/ftplugin/perl.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: Perl -" Maintainer: Dan Sharp -" Last Change: 17 Jul 2008 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Change: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 diff --git a/runtime/ftplugin/php.vim b/runtime/ftplugin/php.vim --- a/runtime/ftplugin/php.vim +++ b/runtime/ftplugin/php.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: php -" Maintainer: Dan Sharp -" Last Changed: 2007 Nov 10 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Changed: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif diff --git a/runtime/ftplugin/ruby.vim b/runtime/ftplugin/ruby.vim --- a/runtime/ftplugin/ruby.vim +++ b/runtime/ftplugin/ruby.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Ruby " Maintainer: Gavin Sinclair -" Info: $Id$ +" Info: $Id: ruby.vim,v 1.40 2008/06/29 04:18:43 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns diff --git a/runtime/ftplugin/sgml.vim b/runtime/ftplugin/sgml.vim --- a/runtime/ftplugin/sgml.vim +++ b/runtime/ftplugin/sgml.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: sgml -" Maintainer: Dan Sharp -" Last Changed: 2003 Sep 30 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Changed: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif diff --git a/runtime/ftplugin/sh.vim b/runtime/ftplugin/sh.vim --- a/runtime/ftplugin/sh.vim +++ b/runtime/ftplugin/sh.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: sh -" Maintainer: Dan Sharp -" Last Changed: 2003 Sep 29 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Changed: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 diff --git a/runtime/ftplugin/sql.vim b/runtime/ftplugin/sql.vim --- a/runtime/ftplugin/sql.vim +++ b/runtime/ftplugin/sql.vim @@ -1,8 +1,8 @@ " SQL filetype plugin file " Language: SQL (Common for Oracle, Microsoft SQL Server, Sybase) -" Version: 4.0 +" Version: 6.0 " Maintainer: David Fishburn -" Last Change: Wed 27 Feb 2008 04:35:21 PM Eastern Standard Time +" Last Change: 2009 Aug 04 " Download: http://vim.sourceforge.net/script.php?script_id=454 " For more details please use: @@ -29,6 +29,27 @@ " " To change the default dialect, add the following to your vimrc: " let g:sql_type_default = 'sqlanywhere' +" +" This file also creates a command, SQLGetType, which allows you to +" determine what the current dialect is in use. +" :SQLGetType +" +" History +" +" Version 6.0 +" +" NF: Adds the command SQLGetType +" +" Version 5.0 +" +" NF: Adds the ability to choose the keys to control SQL completion, just add +" the following to your .vimrc: +" let g:ftplugin_sql_omni_key = '' +" let g:ftplugin_sql_omni_key_right = '' +" let g:ftplugin_sql_omni_key_left = '' +" +" BF: format-options - Auto-wrap comments using textwidth was turned off +" by mistake. " Only do this when not done yet for this buffer @@ -44,7 +65,7 @@ set cpo= " c Auto-wrap comments using textwidth, inserting the current comment " leader automatically. setlocal formatoptions-=t -setlocal formatoptions-=c +setlocal formatoptions+=c " Functions/Commands to allow the user to change SQL syntax dialects " through the use of :SQLSetType for completion. @@ -154,6 +175,20 @@ if !exists("*SQL_SetType") endif +" Functions/Commands to allow the user determine current SQL syntax dialect +" This works with both Vim 6 and 7. + +if !exists("*SQL_GetType") + function SQL_GetType() + if exists('b:sql_type_override') + echomsg "Current SQL dialect in use:".b:sql_type_override + else + echomsg "Current SQL dialect in use:".g:sql_type_default + endif + endfunction + command! -nargs=0 SQLGetType :call SQL_GetType() +endif + if exists("b:sql_type_override") " echo 'sourcing buffer ftplugin/'.b:sql_type_override.'.vim' if globpath(&runtimepath, 'ftplugin/'.b:sql_type_override.'.vim') != '' @@ -311,6 +346,19 @@ if !exists('g:ftplugin_sql_objects') \ ',index,subscription,synchronization,view,variable' endif +" Key to trigger SQL completion +if !exists('g:ftplugin_sql_omni_key') + let g:ftplugin_sql_omni_key = '' +endif +" Key to trigger drill into column list +if !exists('g:ftplugin_sql_omni_key_right') + let g:ftplugin_sql_omni_key_right = '' +endif +" Key to trigger drill out of column list +if !exists('g:ftplugin_sql_omni_key_left') + let g:ftplugin_sql_omni_key_left = '' +endif + " Replace all ,'s with bars, except ones with numbers after them. " This will most likely be a \{,1} string. let s:ftplugin_sql_objects = @@ -382,32 +430,32 @@ if exists('&omnifunc') if !exists('g:omni_sql_no_default_maps') " Static maps which use populate the completion list " using Vim's syntax highlighting rules - imap a :call sqlcomplete#Map('syntax') - imap k :call sqlcomplete#Map('sqlKeyword') - imap f :call sqlcomplete#Map('sqlFunction') - imap o :call sqlcomplete#Map('sqlOption') - imap T :call sqlcomplete#Map('sqlType') - imap s :call sqlcomplete#Map('sqlStatement') + exec 'imap '.g:ftplugin_sql_omni_key.'a :call sqlcomplete#Map("syntax")' + exec 'imap '.g:ftplugin_sql_omni_key.'k :call sqlcomplete#Map("sqlKeyword")' + exec 'imap '.g:ftplugin_sql_omni_key.'f :call sqlcomplete#Map("sqlFunction")' + exec 'imap '.g:ftplugin_sql_omni_key.'o :call sqlcomplete#Map("sqlOption")' + exec 'imap '.g:ftplugin_sql_omni_key.'T :call sqlcomplete#Map("sqlType")' + exec 'imap '.g:ftplugin_sql_omni_key.'s :call sqlcomplete#Map("sqlStatement")' " Dynamic maps which use populate the completion list " using the dbext.vim plugin - imap t :call sqlcomplete#Map('table') - imap p :call sqlcomplete#Map('procedure') - imap v :call sqlcomplete#Map('view') - imap c :call sqlcomplete#Map('column') - imap l :call sqlcomplete#Map('column_csv') + exec 'imap '.g:ftplugin_sql_omni_key.'t :call sqlcomplete#Map("table")' + exec 'imap '.g:ftplugin_sql_omni_key.'p :call sqlcomplete#Map("procedure")' + exec 'imap '.g:ftplugin_sql_omni_key.'v :call sqlcomplete#Map("view")' + exec 'imap '.g:ftplugin_sql_omni_key.'c :call sqlcomplete#Map("column")' + exec 'imap '.g:ftplugin_sql_omni_key.'l :call sqlcomplete#Map("column_csv")' " The next 3 maps are only to be used while the completion window is " active due to the at the beginning of the map - imap L :call sqlcomplete#Map('column_csv') + exec 'imap '.g:ftplugin_sql_omni_key.'L :call sqlcomplete#Map("column_csv")' " is not recognized on most Unix systems, so only create " these additional maps on the Windows platform. " If you would like to use these maps, choose a different key and make " the same map in your vimrc. - if has('win32') - imap =sqlcomplete#DrillIntoTable() - imap =sqlcomplete#DrillOutOfColumns() - endif + " if has('win32') + exec 'imap '.g:ftplugin_sql_omni_key_right.' =sqlcomplete#DrillIntoTable()' + exec 'imap '.g:ftplugin_sql_omni_key_left.' =sqlcomplete#DrillOutOfColumns()' + " endif " Remove any cached items useful for schema changes - imap R :call sqlcomplete#Map('resetCache') + exec 'imap '.g:ftplugin_sql_omni_key.'R :call sqlcomplete#Map("resetCache")' endif if b:sql_compl_savefunc != "" diff --git a/runtime/ftplugin/svg.vim b/runtime/ftplugin/svg.vim --- a/runtime/ftplugin/svg.vim +++ b/runtime/ftplugin/svg.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: svg -" Maintainer: Dan Sharp -" Last Changed: 2003 Sep 29 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Changed: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif diff --git a/runtime/ftplugin/tcl.vim b/runtime/ftplugin/tcl.vim new file mode 100644 --- /dev/null +++ b/runtime/ftplugin/tcl.vim @@ -0,0 +1,36 @@ +" Vim filetype plugin file +" Language: Tcl +" Maintainer: Robert L Hicks +" Latest Revision: 2009-05-01 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +" Make sure the continuation lines below do not cause problems in +" compatibility mode. +let s:cpo_save = &cpo +set cpo-=C + +setlocal comments=:# +setlocal commentstring=#%s +setlocal formatoptions+=croql + +" Change the browse dialog on Windows to show mainly Tcl-related files +if has("gui_win32") + let b:browsefilter = "Tcl Source Files (.tcl)\t*.tcl\n" . + \ "Tcl Test Files (.test)\t*.test\n" . + \ "All Files (*.*)\t*.*\n" +endif + +"----------------------------------------------------------------------------- + +" Undo the stuff we changed. +let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf< kp<" . + \ " | unlet! b:browsefilter" + +" Restore the saved compatibility options. +let &cpo = s:cpo_save + +" vim: set et ts=4 sw=4 tw=78: diff --git a/runtime/ftplugin/tcsh.vim b/runtime/ftplugin/tcsh.vim --- a/runtime/ftplugin/tcsh.vim +++ b/runtime/ftplugin/tcsh.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: tcsh -" Maintainer: Dan Sharp -" Last Changed: 2003 Sep 29 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Changed: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif diff --git a/runtime/ftplugin/verilog.vim b/runtime/ftplugin/verilog.vim --- a/runtime/ftplugin/verilog.vim +++ b/runtime/ftplugin/verilog.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: Verilog HDL " Maintainer: Chih-Tsun Huang -" Last Change: Mon Sep 5 11:05:54 CST 2005 and 2006 April 30 +" Last Change: Wed Sep 3 15:24:49 CST 2008 " URL: http://larc.ee.nthu.edu.tw/~cthuang/vim/ftplugin/verilog.vim " Only do this when not done yet for this buffer @@ -12,6 +12,10 @@ endif " Don't load another plugin for this buffer let b:did_ftplugin = 1 +" Set 'cpoptions' to allow line continuations +let s:cpo_save = &cpo +set cpo&vim + " Undo the plugin effect let b:undo_ftplugin = "setlocal fo< com< tw<" \ . "| unlet! b:browsefilter b:match_ignorecase b:match_words" @@ -28,8 +32,6 @@ if &textwidth == 0 setlocal tw=78 endif -set cpo-=C - " Win32 can filter files in the browse dialog if has("gui_win32") && !exists("b:browsefilter") let b:browsefilter = "Verilog Source Files (*.v)\t*.v\n" . @@ -49,3 +51,7 @@ if exists("loaded_matchit") \ '\:\,' . \ '\:\' endif + +" Reset 'cpoptions' back to the user's setting +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/ftplugin/vim.vim b/runtime/ftplugin/vim.vim --- a/runtime/ftplugin/vim.vim +++ b/runtime/ftplugin/vim.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Vim " Maintainer: Bram Moolenaar -" Last Change: 2008 Feb 27 +" Last Change: 2009 Jan 22 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -11,16 +11,20 @@ endif " Don't load another plugin for this buffer let b:did_ftplugin = 1 -let cpo_save = &cpo +let s:cpo_save = &cpo set cpo-=C -let b:undo_ftplugin = "setl fo< com< tw< commentstring<" +let b:undo_ftplugin = "setl fo< isk< com< tw< commentstring<" \ . "| unlet! b:match_ignorecase b:match_words b:match_skip" " Set 'formatoptions' to break comment lines but not other lines, " and insert the comment leader when hitting or using "o". setlocal fo-=t fo+=croql +" To allow tag lookup via CTRL-] for autoload functions, '#' must be a +" keyword character. E.g., for netrw#Nread(). +setlocal isk+=# + " Set 'comments' to format dashed lists in comments setlocal com=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\" @@ -53,8 +57,7 @@ if exists("loaded_matchit") let b:match_ignorecase = 0 let b:match_words = \ '\:\:\,' . - \ '\:\:\:\,' . - \ '\:\:\:\,' . + \ '\<\(wh\%[ile]\|for\)\>:\:\:\,' . \ '\:\:\,' . \ '\:\:\:\,' . \ '\\)\@!\S:\,' . @@ -64,7 +67,8 @@ if exists("loaded_matchit") \ synIDattr(synID(line("."),col("."),1),"name") =~? "comment\\|string"' endif -let &cpo = cpo_save +let &cpo = s:cpo_save +unlet s:cpo_save " removed this, because 'cpoptions' is a global option. " setlocal cpo+=M " makes \%( match \) diff --git a/runtime/ftplugin/xhtml.vim b/runtime/ftplugin/xhtml.vim --- a/runtime/ftplugin/xhtml.vim +++ b/runtime/ftplugin/xhtml.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: xhtml -" Maintainer: Dan Sharp -" Last Changed: 2004 Jul 08 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Changed: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif diff --git a/runtime/ftplugin/xml.vim b/runtime/ftplugin/xml.vim --- a/runtime/ftplugin/xml.vim +++ b/runtime/ftplugin/xml.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: xml -" Maintainer: Dan Sharp -" Last Changed: 30 Jun 2008 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Changed: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif let b:did_ftplugin = 1 diff --git a/runtime/ftplugin/xsd.vim b/runtime/ftplugin/xsd.vim --- a/runtime/ftplugin/xsd.vim +++ b/runtime/ftplugin/xsd.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: xsd -" Maintainer: Dan Sharp -" Last Changed: 2003 Sep 29 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Changed: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif diff --git a/runtime/ftplugin/xslt.vim b/runtime/ftplugin/xslt.vim --- a/runtime/ftplugin/xslt.vim +++ b/runtime/ftplugin/xslt.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file " Language: xslt -" Maintainer: Dan Sharp -" Last Changed: 2004 Jul 08 -" URL: http://mywebpage.netscape.com/sharppeople/vim/ftplugin +" Maintainer: Dan Sharp +" Last Changed: 20 Jan 2009 +" URL: http://dwsharp.users.sourceforge.net/vim/ftplugin if exists("b:did_ftplugin") | finish | endif diff --git a/runtime/indent/ada.vim b/runtime/indent/ada.vim --- a/runtime/indent/ada.vim +++ b/runtime/indent/ada.vim @@ -1,15 +1,15 @@ "------------------------------------------------------------------------------ " Description: Vim Ada indent file " Language: Ada (2005) -" $Id$ +" $Id: ada.vim 887 2008-07-08 14:29:01Z krischik $ " Copyright: Copyright (C) 2006 Martin Krischik " Maintainer: Martin Krischik " Neil Bird " Ned Okie -" $Author$ -" $Date$ +" $Author: krischik $ +" $Date: 2008-07-08 16:29:01 +0200 (Di, 08 Jul 2008) $ " Version: 4.6 -" $Revision$ +" $Revision: 887 $ " $HeadURL: https://gnuada.svn.sourceforge.net/svnroot/gnuada/trunk/tools/vim/indent/ada.vim $ " History: 24.05.2006 MK Unified Headers " 16.07.2006 MK Ada-Mode as vim-ball diff --git a/runtime/indent/bst.vim b/runtime/indent/bst.vim --- a/runtime/indent/bst.vim +++ b/runtime/indent/bst.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: bst " Author: Tim Pope -" $Id$ +" $Id: bst.vim,v 1.1 2007/05/05 18:11:12 vimboss Exp $ if exists("b:did_indent") finish diff --git a/runtime/indent/cmake.vim b/runtime/indent/cmake.vim --- a/runtime/indent/cmake.vim +++ b/runtime/indent/cmake.vim @@ -1,10 +1,10 @@ " ============================================================================= " " Program: CMake - Cross-Platform Makefile Generator -" Module: $RCSfile$ +" Module: $RCSfile: cmake-indent.vim,v $ " Language: VIM -" Date: $Date$ -" Version: $Revision$ +" Date: $Date: 2006/09/23 21:09:08 $ +" Version: $Revision: 1.7 $ " " ============================================================================= @@ -12,8 +12,8 @@ " Language: CMake (ft=cmake) " Author: Andy Cedilnik " Maintainer: Andy Cedilnik -" Last Change: $Date$ -" Version: $Revision$ +" Last Change: $Date: 2006/09/23 21:09:08 $ +" Version: $Revision: 1.7 $ " " Licence: The CMake license applies to this file. See " http://www.cmake.org/HTML/Copyright.html diff --git a/runtime/indent/cobol.vim b/runtime/indent/cobol.vim --- a/runtime/indent/cobol.vim +++ b/runtime/indent/cobol.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: cobol " Author: Tim Pope -" $Id$ +" $Id: cobol.vim,v 1.1 2007/05/05 18:08:19 vimboss Exp $ if exists("b:did_indent") finish diff --git a/runtime/indent/cpp.vim b/runtime/indent/cpp.vim --- a/runtime/indent/cpp.vim +++ b/runtime/indent/cpp.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: C++ " Maintainer: Bram Moolenaar -" Last Change: 2001 Jun 12 +" Last Change: 2008 Nov 29 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -11,3 +11,5 @@ let b:did_indent = 1 " C++ indenting is built-in, thus this is very simple setlocal cindent + +let b:undo_indent = "setl cin<" diff --git a/runtime/indent/cuda.vim b/runtime/indent/cuda.vim new file mode 100644 --- /dev/null +++ b/runtime/indent/cuda.vim @@ -0,0 +1,15 @@ +" Vim indent file +" Language: CUDA +" Maintainer: Bram Moolenaar +" Last Change: 2008 Nov 29 + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +" It's just like C indenting +setlocal cindent + +let b:undo_indent = "setl cin<" diff --git a/runtime/indent/eiffel.vim b/runtime/indent/eiffel.vim --- a/runtime/indent/eiffel.vim +++ b/runtime/indent/eiffel.vim @@ -2,8 +2,8 @@ " Language: Eiffel " Maintainer: Jocelyn Fiat " Previous-Maintainer: David Clarke -" $Date$ -" $Revision$ +" $Date: 2004/12/09 21:33:52 $ +" $Revision: 1.3 $ " URL: http://www.djoce.net/page/vim/ " Last Change: 2004 Sept 14 : removed specific value for tab (sw) diff --git a/runtime/indent/eruby.vim b/runtime/indent/eruby.vim --- a/runtime/indent/eruby.vim +++ b/runtime/indent/eruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: eRuby " Maintainer: Tim Pope -" Info: $Id$ +" Info: $Id: eruby.vim,v 1.16 2008/06/29 04:18:43 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns diff --git a/runtime/indent/gitconfig.vim b/runtime/indent/gitconfig.vim --- a/runtime/indent/gitconfig.vim +++ b/runtime/indent/gitconfig.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: git config file -" Maintainer: Tim Pope -" Last Change: 2008 Jun 04 +" Maintainer: Tim Pope +" Last Change: 2009 Dec 24 if exists("b:did_indent") finish diff --git a/runtime/indent/mail.vim b/runtime/indent/mail.vim new file mode 100644 --- /dev/null +++ b/runtime/indent/mail.vim @@ -0,0 +1,13 @@ +" Vim indent file +" Language: Mail +" Maintainer: Bram Moolenaar +" Last Change: 2009 Jun 03 + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +" What works best is auto-indenting, disable other indenting. +" For formatting see the ftplugin. +setlocal autoindent nosmartindent nocindent indentexpr= diff --git a/runtime/indent/php.vim b/runtime/indent/php.vim --- a/runtime/indent/php.vim +++ b/runtime/indent/php.vim @@ -2,17 +2,10 @@ " Language: PHP " Author: John Wellesz " URL: http://www.2072productions.com/vim/indent/php.vim -" Last Change: 2008 June 7th +" Last Change: 2008 November 22nd " Newsletter: http://www.2072productions.com/?to=php-indent-for-vim-newsletter.php -" Version: 1.28 +" Version: 1.30 " -" If you find a bug, please e-mail me at John.wellesz (AT) teaser (DOT) fr -" with an example of code that breaks the algorithm. -" -" ---> The change log and all the comments have been removed from this file. -" -" For a complete change log and fully commented code, download the script on -" 2072productions.com at the URI provided above. " " If you find a bug, please e-mail me at John.wellesz (AT) teaser (DOT) fr " with an example of code that breaks the algorithm. @@ -24,7 +17,7 @@ " NOTE: This script must be used with PHP syntax ON and with the php syntax " script by Lutz Eymers (http://www.isp.de/data/php.vim ) or with the " script by Peter Hodge (http://www.vim.org/scripts/script.php?script_id=1571 ) -" the later is bunbdled by default with vim 7. +" the later is bunbdled by default with Vim 7. " " " In the case you have syntax errors in your script such as HereDoc end @@ -33,50 +26,19 @@ " they are followed by a ';'). " " -" NOTE: If you are editing file in Unix file format and that (by accident) -" there are '\r' before new lines, this script won't be able to proceed -" correctly and will make many mistakes because it won't be able to match -" '\s*$' correctly. -" So you have to remove those useless characters first with a command like: -" -" :%s /\r$//g -" -" or simply 'let' the option PHP_removeCRwhenUnix to 1 and the script will -" silently remove them when VIM load this script (at each bufread). -" -" -" Options: PHP_autoformatcomment = 0 to not enable autoformating of comment by -" default, if set to 0, this script will let the 'formatoptions' setting intact. -" -" Options: PHP_default_indenting = # of sw (default is 0), # of sw will be -" added to the indent of each line of PHP code. +" NOTE: If you are editing files in Unix file format and that (by accident) +" there are '\r' before new lines, this script won't be able to proceed +" correctly and will make many mistakes because it won't be able to match +" '\s*$' correctly. +" So you have to remove those useless characters first with a command like: " -" Options: PHP_removeCRwhenUnix = 1 to make the script automatically remove CR -" at end of lines (by default this option is unset), NOTE that you -" MUST remove CR when the fileformat is UNIX else the indentation -" won't be correct! +" :%s /\r$//g " -" Options: PHP_BracesAtCodeLevel = 1 to indent the '{' and '}' at the same -" level than the code they contain. -" Exemple: -" Instead of: -" if ($foo) -" { -" foo(); -" } +" or simply 'let' the option PHP_removeCRwhenUnix to 1 and the script will +" silently remove them when VIM load this script (at each bufread). " -" You will write: -" if ($foo) -" { -" foo(); -" } -" -" NOTE: The script will be a bit slower if you use this option because -" some optimizations won't be available. -" -" Options: PHP_vintage_case_default_indent = 1 (defaults to 0) to add a meaningless indent -" befaore 'case:' and 'default":' statement in switch block -" +" Options: See :help php-indent for available options. + if exists("b:did_indent") finish @@ -145,6 +107,7 @@ if &fileformat == "unix" && exists("PHP_ endif if exists("*GetPhpIndent") + call ResetPhpOptions() finish " XXX endif @@ -317,14 +280,13 @@ endfunction " }}} let s:notPhpHereDoc = '\%(break\|return\|continue\|exit\|else\)' let s:blockstart = '\%(\%(\%(}\s*\)\=else\%(\s\+\)\=\)\=if\>\|else\>\|while\>\|switch\>\|for\%(each\)\=\>\|declare\>\|class\>\|interface\>\|abstract\>\|try\>\|catch\>\)' -let s:autorestoptions = 0 -if ! s:autorestoptions - au BufWinEnter,Syntax *.php,*.php3,*.php4,*.php5 call ResetOptions() - let s:autorestoptions = 1 +let s:autoresetoptions = 0 +if ! s:autoresetoptions + let s:autoresetoptions = 1 endif -function! ResetOptions() - if ! b:optionsset +function! ResetPhpOptions() + if ! b:optionsset && &filetype == "php" if b:PHP_autoformatcomment setlocal comments=s1:/*,mb:*,ex:*/,://,:# @@ -341,6 +303,8 @@ function! ResetOptions() endif endfunc +call ResetPhpOptions() + function! GetPhpIndent() let b:GetLastRealCodeLNum_ADD = 0 @@ -360,7 +324,7 @@ function! GetPhpIndent() if !b:PHP_indentinghuge && b:PHP_lastindented > b:PHP_indentbeforelast if b:PHP_indentbeforelast let b:PHP_indentinghuge = 1 - echom 'Large indenting detected, speed optimizations engaged (v1.28)' + echom 'Large indenting detected, speed optimizations engaged (v1.30)' endif let b:PHP_indentbeforelast = b:PHP_lastindented endif @@ -693,6 +657,7 @@ function! GetPhpIndent() if !LastLineClosed + if last_line =~# '[{(]'.endline || last_line =~? '\h\w*\s*(.*,$' && pline !~ '[,(]'.endline if !b:PHP_BracesAtCodeLevel || last_line !~# '^\s*{' @@ -715,11 +680,11 @@ function! GetPhpIndent() elseif last_line =~ '^\s*'.s:blockstart let ind = ind + &sw - elseif last_line =~# defaultORcase + elseif last_line =~# defaultORcase && cline !~# defaultORcase let ind = ind + &sw - elseif pline =~ '\%(;\%(\s*?>\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|{\)'.endline . '\|' . defaultORcase + elseif pline =~ '\%(;\%(\s*?>\)\=\|<<<''\=\a\w*''\=$\|^\s*}\|{\)'.endline . '\|' . defaultORcase && cline !~# defaultORcase let ind = ind + &sw endif diff --git a/runtime/indent/ruby.vim b/runtime/indent/ruby.vim --- a/runtime/indent/ruby.vim +++ b/runtime/indent/ruby.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Ruby " Maintainer: Nikolai Weibull -" Info: $Id$ +" Info: $Id: ruby.vim,v 1.47 2008/06/29 04:18:43 tpope Exp $ " URL: http://vim-ruby.rubyforge.org " Anon CVS: See above site " Release Coordinator: Doug Kearns diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim --- a/runtime/indent/sh.vim +++ b/runtime/indent/sh.vim @@ -1,7 +1,7 @@ " Vim indent file -" Language: Shell Script +" Language: Shell Script " Maintainer: Nikolai Weibull -" Latest Revision: 2006-04-19 +" Latest Revision: 2010-01-06 if exists("b:did_indent") finish @@ -9,8 +9,10 @@ endif let b:did_indent = 1 setlocal indentexpr=GetShIndent() -setlocal indentkeys+==then,=do,=else,=elif,=esac,=fi,=fin,=fil,=done +setlocal indentkeys+=0=then,0=do,0=else,0=elif,0=fi,0=esac,0=done,),0=;;,0=;& +setlocal indentkeys+=0=fin,0=fil,0=fip,0=fir,0=fix setlocal indentkeys-=:,0# +setlocal nosmartindent if exists("*GetShIndent") finish @@ -19,34 +21,138 @@ endif let s:cpo_save = &cpo set cpo&vim -function GetShIndent() +function s:buffer_shiftwidth() + return &shiftwidth +endfunction + +let s:sh_indent_defaults = { + \ 'default': function('s:buffer_shiftwidth'), + \ 'continuation-line': function('s:buffer_shiftwidth'), + \ 'case-labels': function('s:buffer_shiftwidth'), + \ 'case-statements': function('s:buffer_shiftwidth'), + \ 'case-breaks': 0 } + +function! s:indent_value(option) + let Value = exists('b:sh_indent_options') + \ && has_key(b:sh_indent_options, a:option) ? + \ b:sh_indent_options[a:option] : + \ s:sh_indent_defaults[a:option] + if type(Value) == type(function('type')) + return Value() + endif + return Value +endfunction + +function! GetShIndent() let lnum = prevnonblank(v:lnum - 1) if lnum == 0 return 0 endif - " Add a 'shiftwidth' after if, while, else, case, until, for, function() - " Skip if the line also contains the closure for the above + let pnum = prevnonblank(lnum - 1) + let ind = indent(lnum) let line = getline(lnum) - if line =~ '^\s*\(if\|then\|do\|else\|elif\|case\|while\|until\|for\)\>' - \ || line =~ '^\s*\<\k\+\>\s*()\s*{' - \ || line =~ '^\s*{' - if line !~ '\(esac\|fi\|done\)\>\s*$' && line !~ '}\s*$' - let ind = ind + &sw + if line =~ '^\s*\%(if\|then\|do\|else\|elif\|case\|while\|until\|for\|select\)\>' + if line !~ '\<\%(fi\|esac\|done\)\>\s*\%(#.*\)\=$' + let ind += s:indent_value('default') + endif + elseif s:is_case_label(line, pnum) + if !s:is_case_ended(line) + let ind += s:indent_value('case-statements') endif + elseif line =~ '^\s*\<\k\+\>\s*()\s*{' || line =~ '^\s*{' + if line !~ '}\s*\%(#.*\)\=$' + let ind += s:indent_value('default') + endif + elseif s:is_continuation_line(line) + if pnum == 0 || !s:is_continuation_line(getline(pnum)) + let ind += s:indent_value('continuation-line') + endif + elseif pnum != 0 && s:is_continuation_line(getline(pnum)) + let ind = indent(s:find_continued_lnum(pnum)) endif - " Subtract a 'shiftwidth' on a then, do, else, esac, fi, done - " Retain the indentation level if line matches fin (for find) + let pine = line let line = getline(v:lnum) - if (line =~ '^\s*\(then\|do\|else\|elif\|esac\|fi\|done\)\>' || line =~ '^\s*}') - \ && line !~ '^\s*fi[ln]\>' - let ind = ind - &sw + if line =~ '^\s*\%(then\|do\|else\|elif\|fi\|done\)\>' || line =~ '^\s*}' + let ind -= s:indent_value('default') + elseif line =~ '^\s*esac\>' + let ind -= (s:is_case_label(pine, lnum) && s:is_case_ended(pine) ? + \ 0 : s:indent_value('case-statements')) + + \ s:indent_value('case-labels') + if s:is_case_break(pine) + let ind += s:indent_value('case-breaks') + endif + elseif s:is_case_label(line, lnum) + if s:is_case(pine) + let ind = indent(lnum) + s:indent_value('case-labels') + else + let ind -= s:indent_value('case-statements') - s:indent_value('case-breaks') + endif + elseif s:is_case_break(line) + let ind -= s:indent_value('case-breaks') endif return ind endfunction +function! s:is_continuation_line(line) + return a:line =~ '\%(\%(^\|[^\\]\)\\\|&&\|||\)$' +endfunction + +function! s:find_continued_lnum(lnum) + let i = a:lnum + while i > 1 && s:is_continuation_line(getline(i - 1)) + let i -= 1 + endwhile + return i +endfunction + +function! s:is_case_label(line, pnum) + if a:line !~ '^\s*(\=.*)' + return 0 + endif + + if a:pnum > 0 + let pine = getline(a:pnum) + if !(s:is_case(pine) || s:is_case_ended(pine)) + return 0 + endif + endif + + let suffix = substitute(a:line, '^\s*(\=', "", "") + let nesting = 0 + let i = 0 + let n = strlen(suffix) + while i < n + let c = suffix[i] + let i += 1 + if c == '\\' + let i += 1 + elseif c == '(' + let nesting += 1 + elseif c == ')' + if nesting == 0 + return 1 + endif + let nesting -= 1 + endif + endwhile + return 0 +endfunction + +function! s:is_case(line) + return a:line =~ '^\s*case\>' +endfunction + +function! s:is_case_break(line) + return a:line =~ '^\s*;[;&]' +endfunction + +function! s:is_case_ended(line) + return s:is_case_break(a:line) || a:line =~ ';[;&]\s*\%(#.*\)\=$' +endfunction + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/indent/xml.vim b/runtime/indent/xml.vim --- a/runtime/indent/xml.vim +++ b/runtime/indent/xml.vim @@ -1,10 +1,11 @@ " Language: xml " Maintainer: Johannes Zellner -" Last Change: Tue, 27 Apr 2004 14:54:59 CEST +" Last Change: 2009-05-26 00:17:25 " Notes: 1) does not indent pure non-xml code (e.g. embedded scripts) " 2) will be confused by unbalanced tags in comments " or CDATA sections. -" TODO: implement pre-like tags, see xml_indent_open / xml_indent_close +" 2009-05-26 patch by Nikolai Weibull +" TODO: implement pre-like tags, see xml_indent_open / xml_indent_close " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -46,6 +47,9 @@ fun! XmlIndentSynCheck(lnum) if '' != syn1 && syn1 !~ 'xml' && '' != syn2 && syn2 !~ 'xml' " don't indent pure non-xml code return 0 + elseif syn1 =~ '^xmlComment' && syn2 =~ '^xmlComment' + " indent comments specially + return -1 endif endif return 1 @@ -74,8 +78,12 @@ fun! XmlIndentGet(lnum, use_syntax_check endif if a:use_syntax_check - if 0 == XmlIndentSynCheck(lnum) || 0 == XmlIndentSynCheck(a:lnum) + let check_lnum = XmlIndentSynCheck(lnum) + let check_alnum = XmlIndentSynCheck(a:lnum) + if 0 == check_lnum || 0 == check_alnum return indent(a:lnum) + elseif -1 == check_lnum || -1 == check_alnum + return -1 endif endif diff --git a/runtime/keymap/dvorak.vim b/runtime/keymap/dvorak.vim new file mode 100644 --- /dev/null +++ b/runtime/keymap/dvorak.vim @@ -0,0 +1,82 @@ +" Maintainer: Ashish SHUKLA +" Last Changed: 2009 Jul 04 +" +" All characters are ASCII, conversion to another encoding (e.g., UTF-8) +" should work. + +let b:keymap_name = "en-dv" + +loadkeymap +q ' +w , +e . +r p +t y +y f +u g +i c +o r +p l +[ / +] = +\\ \\ +a a +s o +d e +f u +g i +h d +j h +k t +l n +; s +' - +z ; +x q +c j +v k +b x +n b +m m +, w +. v +/ z +Z : +X Q +C J +V K +B X +N B +M M +< W +> V +? Z +A A +S O +D E +F U +G I +H D +J H +K T +L N +: S +\" _ +Q " +W < +E > +R P +T Y +Y F +U G +I C +O R +P L +{ ? +} + +| | +- [ +_ { += ] ++ } + diff --git a/runtime/lang/menu_cs_cz.iso_8859-2.vim b/runtime/lang/menu_cs_cz.iso_8859-2.vim --- a/runtime/lang/menu_cs_cz.iso_8859-2.vim +++ b/runtime/lang/menu_cs_cz.iso_8859-2.vim @@ -1,8 +1,8 @@ " Menu Translations: Czech for ISO-8859-2 " Maintainer: Jiri Brezina " vim:set foldmethod=marker: -" $Revision$ -" $Date$ +" $Revision: 1.3 $ +" $Date: 2005/12/19 22:08:24 $ " Quit when menu translations have already been done. if exists("did_menu_trans") diff --git a/runtime/lang/menu_czech_czech_republic.1250.vim b/runtime/lang/menu_czech_czech_republic.1250.vim --- a/runtime/lang/menu_czech_czech_republic.1250.vim +++ b/runtime/lang/menu_czech_czech_republic.1250.vim @@ -1,8 +1,8 @@ " Menu Translations: Czech for MS-Windows " Maintainer: Jiri Brezina " vim:set foldmethod=marker: -" $Revision$ -" $Date$ +" $Revision: 1.3 $ +" $Date: 2005/12/19 22:13:30 $ " Quit when menu translations have already been done. if exists("did_menu_trans") diff --git a/runtime/lang/menu_czech_czech_republic.ascii.vim b/runtime/lang/menu_czech_czech_republic.ascii.vim --- a/runtime/lang/menu_czech_czech_republic.ascii.vim +++ b/runtime/lang/menu_czech_czech_republic.ascii.vim @@ -1,8 +1,8 @@ " Menu Translations: Czech for systems without localization " Maintainer: Jiri Brezina " vim:set foldmethod=marker: -" $Revision$ -" $Date$ +" $Revision: 1.3 $ +" $Date: 2005/12/19 22:06:56 $ " Quit when menu translations have already been done. if exists("did_menu_trans") diff --git a/runtime/lang/menu_es_es.latin1.vim b/runtime/lang/menu_es_es.latin1.vim --- a/runtime/lang/menu_es_es.latin1.vim +++ b/runtime/lang/menu_es_es.latin1.vim @@ -1,7 +1,8 @@ " Menu Translations: Espaol -" Maintainer: Alejandro Lpez-Valencia -" Version: 6.4.p0-1 -" Last Change: 2005 Dec 01 +" Previous translator: Alejandro Lpez-Valencia +" Last translator: Omar Campagne Polaino +" Version: 7.2.245 +" Last Change: 2009 Sep 03 " " Quit when menu translations have already been done. @@ -28,13 +29,14 @@ menutrans O&rphans Ayude\ a\ los\ nios\ &hurfanos menutrans Co&pying &Trminos\ de\ Licencia menutrans Sponsor/Register Benefactor/Regstrese menutrans &Version &Versin\ e\ \informacin\ de\ configuracin -menutrans &About &Acerca\ de\ Vim. +menutrans &About &Acerca\ de\ Vim " File menu menutrans &File &Archivo menutrans &Open\.\.\.:e &Abrir\.\.\.:e menutrans Sp&lit-Open\.\.\.:sp A&brir\ en\ otra\ ventana\.\.\.:sp menutrans &New:enew &Nuevo:enew +menutrans Open\ Tab\.\.\.:tabnew Abrir\ pes&taa\.\.\.:tabnew menutrans &Close:close &Cerrar:close menutrans &Save:w &Guardar:w menutrans Save\ &As\.\.\.:sav Guardar\ &como\.\.\.:sav @@ -65,11 +67,12 @@ menutrans Find\ and\ Rep&lace:%s Bu menutrans Find\ and\ Rep&lace Buscar\ y\ R&eemplazar menutrans Find\ and\ Rep&lace:s Buscar\ y\ R&eemplazar:s menutrans Settings\ &Window &Ventana\ de\ opciones +menutrans Startup\ &Settings Opciones\ de\ arranque " Edit/Global Settings menutrans &Global\ Settings Opciones\ &globales -menutrans Toggle\ Pattern\ &Highlight:set\ hls! Activar/Desactivar\ &realzado\ de\ sintaxis:set\ hls! +menutrans Toggle\ Pattern\ &Highlight:set\ hls! Activar/Desactivar\ &resaltado\ de\ sintaxis:set\ hls! menutrans Toggle\ &Ignore-case:set\ ic! Activar/Desactivar\ &ignorar\ maysculas\ y\ minsculas:set\ ic! menutrans Toggle\ &Showmatch:set\ sm! Activar/Desactivar\ &mostrar\ coincidencias:set\ sm! @@ -95,11 +98,11 @@ menutrans Toggle\ &Bottom\ Scrollbar Ocu menutrans Toggle\ &Left\ Scrollbar Ocultar/Mostrar\ barra\ de\ desplazamiento\ i&zquierda menutrans Toggle\ &Right\ Scrollbar Ocultar/Mostrar\ barra\ de\ desplazamiento\ &derecha -let g:menutrans_path_dialog = "Introduzca la ruta de bsqueda para los ficheros.\nSepare los nombres de los directorios con una coma." -let g:menutrans_tags_dialog = "Introduzca los nombres de los fichero de tags.\nSepare los nombres con una coma." +let g:menutrans_path_dialog = "Introduzca la ruta de bsqueda para los archivos.\nSepare los nombres de los directorios con una coma." +let g:menutrans_tags_dialog = "Introduzca los nombres de los archivos de tags.\nSepare los nombres con una coma." " Edit/File Settings -menutrans F&ile\ Settings Opciones\ del\ &fichero +menutrans F&ile\ Settings Opciones\ del\ &archivo " Boolean options menutrans Toggle\ Line\ &Numbering:set\ nu! Activar/Desactivar\ &numeracin\ de\ lneas:set\ nu! @@ -118,8 +121,8 @@ menutrans Soft\ &Tabstop &Tabulado\ blando menutrans Te&xt\ Width\.\.\. Anchura\ del\ te&xto\.\.\. let g:menutrans_textwidth_dialog = "Introduzca el nuevo ancho del texto (0 para desactivar el quiebre de lnea): " -menutrans &File\ Format\.\.\. &Formato\ del\ fichero\.\.\. -let g:menutrans_fileformat_dialog = "Seleccione el formato para escribir el fichero" +menutrans &File\ Format\.\.\. &Formato\ del\ archivo\.\.\. +let g:menutrans_fileformat_dialog = "Seleccione el formato para escribir el archivo" menutrans C&olor\ Scheme Esquema\ de\ c&olores menutrans blue azul @@ -154,7 +157,7 @@ menutrans slovak eslovaco menutrans &Tools &Herramientas menutrans &Jump\ to\ this\ tagg^] &Saltar\ a\ este\ etiquetag^] menutrans Jump\ &back^T Saltar\ &atrs^T -menutrans Build\ &Tags\ File Crear\ fichero\ de\ &etiquetas\ +menutrans Build\ &Tags\ File Crear\ archivo\ de\ &etiquetas\ menutrans &Diff Modo\ de\ &diferencias menutrans &Folding &Plegado menutrans &Make:make Ejecutar\ &Make:make @@ -169,6 +172,24 @@ menutrans &Set\ Compiler Esco&ger\ el\ menutrans &Convert\ to\ HEX:%!xxd Convertir\ a\ formato\ &hexadecimal:%!xxd menutrans Conve&rt\ back:%!xxd\ -r &Convertir\ al\ formato\ original:%!xxd\ -r +" Tools.Spelling Menu +menutrans &Spelling Correccin\ ortogrfica +menutrans &Spell\ Check\ On &Activar\ correccin\ ortogrfica +menutrans Spell\ Check\ &Off &Desactivar\ correccin\ ortogrfica +menutrans To\ &Next\ error]s &Siguiente\ error]s +menutrans To\ &Previous\ error[s Error\ &precedente[s +menutrans Suggest\ &Correctionsz= Sugerir\ &correccinz= +menutrans &Repeat\ correction:spellrepall &Repetir\ correccin:spellrepall +an 40.335.205 &Tools.&Spelling.Castellano\ (es) :set spl=es spell +menutrans Set\ language\ to\ "en" Ingls +menutrans Set\ language\ to\ "en_au" Ingls\ (en_au) +menutrans Set\ language\ to\ "en_ca" Ingls\ (en_ca) +menutrans Set\ language\ to\ "en_gb" Ingls\ (en_gb) +menutrans Set\ language\ to\ "en_nz" Ingls\ (en_nz) +menutrans Set\ language\ to\ "en_us" Ingls\ (en_us) + +menutrans &Find\ More\ Languages &Buscar\ otras\ lenguas + " Tools.Fold Menu menutrans &Enable/Disable\ foldszi &Activar/Desactivar\ pliegueszi menutrans &View\ Cursor\ Linezv &Ver\ lnea\ del\ cursorzv @@ -182,7 +203,7 @@ menutrans Fold\ Met&hod &Mtodo\ de\ plegado " create and delete folds menutrans Create\ &Foldzf Crear\ &plieguezf menutrans &Delete\ Foldzd &Suprimir\ plieguezd -menutrans Delete\ &All\ FoldszD Suprimir\ &todos\ los\ pligueszD +menutrans Delete\ &All\ FoldszD Suprimir\ &todos\ los\ pliegueszD " moving around in folds menutrans Fold\ col&umn\ width A&nchura\ de\ columna\ del\ pliegue @@ -203,7 +224,7 @@ menutrans &Delete &Suprimir menutrans &Alternate &Alternar menutrans &Next Si&guiente menutrans &Previous &Previo -let g:menutrans_no_file = "[Sin fichero]" +let g:menutrans_no_file = "[Sin archivo]" " Window menu menutrans &Window &Ventana @@ -211,7 +232,7 @@ menutrans &New^Wn Ventana\ &nueva menutrans S&plit^Ws &Dividir\ la\ ventana^Ws menutrans Sp&lit\ To\ #^W^^ D&ividir\ en\ el\ marcador\ (#)^W^^ menutrans Split\ &Vertically^Wv Dividir\ &verticalmente^Wv -menutrans Split\ File\ E&xplorer &Abrir\ el\ Explorador\ de\ ficheros +menutrans Split\ File\ E&xplorer &Abrir\ el\ Explorador\ de\ archivos menutrans &Close^Wc &Cerrar\ esta\ ventana^Wc menutrans Close\ &Other(s)^Wo Cerrar\ &otra(s)\ ventana(s)^Wo menutrans Move\ &To Mov&er\ a @@ -245,9 +266,9 @@ if has("toolbar") delfun Do_toolbar_tmenu endif fun Do_toolbar_tmenu() - tmenu ToolBar.Open Abrir fichero - tmenu ToolBar.Save Guardar fichero - tmenu ToolBar.SaveAll Guardar todos los ficheros + tmenu ToolBar.Open Abrir archivo + tmenu ToolBar.Save Guardar archivo + tmenu ToolBar.SaveAll Guardar todos los archivos tmenu ToolBar.Print Imprimir tmenu ToolBar.Undo Deshacer tmenu ToolBar.Redo Rehacer @@ -273,7 +294,7 @@ if has("toolbar") tmenu ToolBar.RunScript Ejecutar un archivo de rdenes tmenu ToolBar.Make Ejecutar Make tmenu ToolBar.Shell Abrir un intrprete de comandos - tmenu ToolBar.RunCtags Generar un fichero de etiquetas + tmenu ToolBar.RunCtags Generar un archivo de etiquetas tmenu ToolBar.TagJump Saltar a una etiqueta tmenu ToolBar.Help Ayuda tmenu ToolBar.FindHelp Buscar en la ayuda... @@ -282,15 +303,15 @@ endif " Syntax menu menutrans &Syntax &Sintaxis -menutrans &Show\ filetypes\ in\ menu &Mostrar\ listas\ de\ tipo\ de\ fichero +menutrans &Show\ filetypes\ in\ menu &Mostrar\ listas\ de\ tipo\ de\ archivo menutrans Set\ '&syntax'\ only Activar\ slo\ sintaxis -menutrans Set\ '&filetype'\ too Activar\ tambin\ tipo\ de\ fichero +menutrans Set\ '&filetype'\ too Activar\ tambin\ tipo\ de\ archivo menutrans &Off &Desactivar\ sintaxis -menutrans &Manual sintaxis\ &manual -menutrans A&utomatic sintaxis\ a&utomtica -menutrans on/off\ for\ &This\ file Activar/Desactivar\ en\ es&te\ fichero +menutrans &Manual Sintaxis\ &manual +menutrans A&utomatic Sintaxis\ a&utomtica +menutrans on/off\ for\ &This\ file Activar/Desactivar\ en\ es&te\ archivo menutrans Co&lor\ test &Prueba\ de\ colores -menutrans &Highlight\ test Prueba\ de\ &realzado +menutrans &Highlight\ test Prueba\ de\ &resaltado menutrans &Convert\ to\ HTML &Convertir\ a\ HTML " Find Help dialog text diff --git a/runtime/lang/menu_ko_kr.euckr.vim b/runtime/lang/menu_ko_kr.euckr.vim --- a/runtime/lang/menu_ko_kr.euckr.vim +++ b/runtime/lang/menu_ko_kr.euckr.vim @@ -1,6 +1,6 @@ " Menu Translations: Korean -" Maintainer: Nam SungHyun -" Last Change: 2003 Apr 25 +" Maintainer: SungHyun Nam +" Last Change: 2008 Sep 17 " Quit when menu translations have already been done. if exists("did_menu_trans") diff --git a/runtime/lang/menu_ko_kr.utf-8.vim b/runtime/lang/menu_ko_kr.utf-8.vim --- a/runtime/lang/menu_ko_kr.utf-8.vim +++ b/runtime/lang/menu_ko_kr.utf-8.vim @@ -1,6 +1,6 @@ " Menu Translations: Korean -" Maintainer: Nam SungHyun -" Last Change: 2003 Apr 25 +" Maintainer: SungHyun Nam +" Last Change: 2008 Sep 17 " Quit when menu translations have already been done. if exists("did_menu_trans") diff --git a/runtime/lang/menu_ko_kr.vim b/runtime/lang/menu_ko_kr.vim --- a/runtime/lang/menu_ko_kr.vim +++ b/runtime/lang/menu_ko_kr.vim @@ -1,5 +1,5 @@ " Menu Translations: Korean -" Translated By: Nam SungHyun -" Last Change: 2003 Feb 24 +" Translated By: SungHyun Nam +" Last Change: 2008 Sep 17 source :p:h/menu_ko_kr.euckr.vim diff --git a/runtime/lang/menu_ru_ru.koi8-r.vim b/runtime/lang/menu_ru_ru.koi8-r.vim --- a/runtime/lang/menu_ru_ru.koi8-r.vim +++ b/runtime/lang/menu_ru_ru.koi8-r.vim @@ -3,7 +3,7 @@ " Last Change: 26 Apr 2004 " URL: cvs://cvs.sf.net:/cvsroot/ruvim/extras/menu/menu_ru_ru.vim " -" $Id$ +" $Id: menu_ru_ru.koi8-r.vim,v 1.2 2004/06/16 11:19:21 vimboss Exp $ " " Adopted for RuVim project by Vassily Ragosin. " First translation: Tim Alexeevsky , diff --git a/runtime/lang/menu_ru_ru.vim b/runtime/lang/menu_ru_ru.vim --- a/runtime/lang/menu_ru_ru.vim +++ b/runtime/lang/menu_ru_ru.vim @@ -3,7 +3,7 @@ " Last Change: 26 Apr 2004 " URL: cvs://cvs.sf.net:/cvsroot/ruvim/extras/menu/menu_ru_ru.vim " -" $Id$ +" $Id: menu_ru_ru.vim,v 1.1 2004/06/13 16:09:10 vimboss Exp $ " " Adopted for RuVim project by Vassily Ragosin. " First translation: Tim Alexeevsky , diff --git a/runtime/macros/matchit.vim b/runtime/macros/matchit.vim --- a/runtime/macros/matchit.vim +++ b/runtime/macros/matchit.vim @@ -357,7 +357,7 @@ fun! s:InsertRefs(groupBR, prefix, group execute s:Ref(ini, d, "start", "len") let ini = strpart(ini, 0, start) . backref . strpart(ini, start+len) let tailBR = substitute(tailBR, s:notslash . '\zs\\' . d, - \ escape(backref, '\\'), 'g') + \ escape(backref, '\\&'), 'g') endif let d = d-1 endwhile diff --git a/runtime/menu.vim b/runtime/menu.vim --- a/runtime/menu.vim +++ b/runtime/menu.vim @@ -2,7 +2,7 @@ " You can also use this as a start for your own set of menus. " " Maintainer: Bram Moolenaar -" Last Change: 2008 Jun 30 +" Last Change: 2009 Feb 26 " Note that ":an" (short for ":anoremenu") is often used to make a menu work " in all modes and avoid side effects from mappings defined by the user. @@ -138,6 +138,7 @@ endfunc func! s:FnameEscape(fname) if exists('*fnameescape') return fnameescape(a:fname) + endif return escape(a:fname, " \t\n*?[{`$\\%#'\"|!<") endfunc @@ -1016,10 +1017,9 @@ else tmenu ToolBar.Copy Copy to clipboard tmenu ToolBar.Paste Paste from Clipboard if !has("gui_athena") - tmenu ToolBar.Find Find... + tmenu ToolBar.Replace Find / Replace... tmenu ToolBar.FindNext Find Next tmenu ToolBar.FindPrev Find Previous - tmenu ToolBar.Replace Find / Replace... endif tmenu ToolBar.LoadSesn Choose a session to load tmenu ToolBar.SaveSesn Save current session diff --git a/runtime/plugin/getscriptPlugin.vim b/runtime/plugin/getscriptPlugin.vim --- a/runtime/plugin/getscriptPlugin.vim +++ b/runtime/plugin/getscriptPlugin.vim @@ -19,7 +19,7 @@ if &cp || exists("g:loaded_getscriptPlug endif finish endif -let g:loaded_getscriptPlugin = "v31" +let g:loaded_getscriptPlugin = "v32" let s:keepcpo = &cpo set cpo&vim diff --git a/runtime/plugin/gzip.vim b/runtime/plugin/gzip.vim --- a/runtime/plugin/gzip.vim +++ b/runtime/plugin/gzip.vim @@ -1,6 +1,6 @@ " Vim plugin for editing compressed files. " Maintainer: Bram Moolenaar -" Last Change: 2005 Jul 26 +" Last Change: 2009 Jul 01 " Exit quickly when: " - this plugin was already loaded @@ -20,17 +20,21 @@ augroup gzip " " Set binary mode before reading the file. " Use "gzip -d", gunzip isn't always available. - autocmd BufReadPre,FileReadPre *.gz,*.bz2,*.Z setlocal bin + autocmd BufReadPre,FileReadPre *.gz,*.bz2,*.Z,*.lzma setlocal bin autocmd BufReadPost,FileReadPost *.gz call gzip#read("gzip -dn") autocmd BufReadPost,FileReadPost *.bz2 call gzip#read("bzip2 -d") autocmd BufReadPost,FileReadPost *.Z call gzip#read("uncompress") + autocmd BufReadPost,FileReadPost *.lzma call gzip#read("lzma -d") autocmd BufWritePost,FileWritePost *.gz call gzip#write("gzip") autocmd BufWritePost,FileWritePost *.bz2 call gzip#write("bzip2") autocmd BufWritePost,FileWritePost *.Z call gzip#write("compress -f") + autocmd BufWritePost,FileWritePost *.lzma call gzip#write("lzma -z") autocmd FileAppendPre *.gz call gzip#appre("gzip -dn") autocmd FileAppendPre *.bz2 call gzip#appre("bzip2 -d") autocmd FileAppendPre *.Z call gzip#appre("uncompress") + autocmd FileAppendPre *.lzma call gzip#appre("lzma -d") autocmd FileAppendPost *.gz call gzip#write("gzip") autocmd FileAppendPost *.bz2 call gzip#write("bzip2") autocmd FileAppendPost *.Z call gzip#write("compress -f") + autocmd FileAppendPost *.lzma call gzip#write("lzma -z") augroup END diff --git a/runtime/plugin/matchparen.vim b/runtime/plugin/matchparen.vim --- a/runtime/plugin/matchparen.vim +++ b/runtime/plugin/matchparen.vim @@ -1,6 +1,6 @@ " Vim plugin for showing matching parens " Maintainer: Bram Moolenaar -" Last Change: 2008 Feb 27 +" Last Change: 2008 Sep 03 " Exit quickly when: " - this plugin was already loaded (or disabled) @@ -21,7 +21,7 @@ if exists("*s:Highlight_Matching_Pair") finish endif -let cpo_save = &cpo +let s:cpo_save = &cpo set cpo-=C " The function that is invoked (very often) to define a ":match" highlighting @@ -147,4 +147,5 @@ command! NoMatchParen windo 3match none \ au! matchparen command! DoMatchParen runtime plugin/matchparen.vim | windo doau CursorMoved -let &cpo = cpo_save +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim --- a/runtime/plugin/netrwPlugin.vim +++ b/runtime/plugin/netrwPlugin.vim @@ -1,6 +1,6 @@ " netrwPlugin.vim: Handles file transfer and remote directory listing across a network " PLUGIN SECTION -" Date: Aug 01, 2008 +" Date: Aug 10, 2008 " Maintainer: Charles E Campbell, Jr " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 1999-2008 Charles E. Campbell, Jr. {{{1 @@ -16,19 +16,16 @@ " But be doers of the Word, and not only hearers, deluding your own selves {{{1 " (James 1:22 RSV) " =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - -" --------------------------------------------------------------------- " Load Once: {{{1 if &cp || exists("g:loaded_netrwPlugin") finish endif -let g:loaded_netrwPlugin = "v132" -let s:keepcpo = &cpo -if v:version < 700 - echohl WarningMsg | echo "***netrw*** you need vim version 7.0 for this version of netrw" | echohl None +let g:loaded_netrwPlugin = "v136" +if v:version < 702 + echohl WarningMsg | echo "***netrw*** you need vim version 7.2 for this version of netrw" | echohl None finish endif -let s:keepcpo= &cpo +let s:keepcpo = &cpo set cpo&vim " --------------------------------------------------------------------- @@ -52,8 +49,8 @@ augroup Network au BufReadCmd file://* exe "silent doau BufReadPre ".fnameescape(netrw#RFC2396(expand("")))|exe 'e '.fnameescape(substitute(netrw#RFC2396(expand("")),'file://\(.*\)','\1',""))|exe "bwipe ".fnameescape(expand(""))|exe "silent doau BufReadPost ".fnameescape(netrw#RFC2396(expand(""))) au BufReadCmd file://localhost/* exe "silent doau BufReadPre ".fnameescape(netrw#RFC2396(expand("")))|exe 'e '.fnameescape(substitute(netrw#RFC2396(expand("")),'file://localhost/\(.*\)','\1',""))|exe "bwipe ".fnameescape(substitute(expand(""),'file://\(\k\+@\)\=','',''))|exe "silent doau BufReadPost ".fnameescape(netrw#RFC2396(expand(""))) endif - au BufReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau BufReadPre ".fnameescape(expand(""))|exe '2Nread '.fnameescape(expand(""))|exe "silent doau BufReadPost ".fnameescape(expand("")) - au FileReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau FileReadPre ".fnameescape(expand(""))|exe 'Nread '.fnameescape(expand(""))|exe "silent doau FileReadPost ".fnameescape(expand("")) + au BufReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau BufReadPre ".fnameescape(expand(""))|call netrw#Nread(2,expand(""))|exe "silent doau BufReadPost ".fnameescape(expand("")) + au FileReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau FileReadPre ".fnameescape(expand(""))|call netrw#Nread(1,expand(""))|exe "silent doau FileReadPost ".fnameescape(expand("")) au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau BufWritePre ".fnameescape(expand(""))|exe 'Nwrite '.fnameescape(expand(""))|exe "silent doau BufWritePost ".fnameescape(expand("")) au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau FileWritePre ".fnameescape(expand(""))|exe "'[,']".'Nwrite '.fnameescape(expand(""))|exe "silent doau FileWritePost ".fnameescape(expand("")) try @@ -156,24 +153,6 @@ fun! NetUserPass(...) endfun " ------------------------------------------------------------------------ -" NetReadFixup: this sort of function is typically written by the user {{{1 -" to handle extra junk that their system's ftp dumps -" into the transfer. This function is provided as an -" example and as a fix for a Windows 95 problem: in my -" experience, win95's ftp always dumped four blank lines -" at the end of the transfer. -if has("win95") && exists("g:netrw_win95ftp") && g:netrw_win95ftp - fun! NetReadFixup(method, line1, line2) -" call Dfunc("NetReadFixup(method<".a:method."> line1=".a:line1." line2=".a:line2.")") - if method == 3 " ftp (no <.netrc>) - let fourblanklines= line2 - 3 - silent fourblanklines.",".line2."g/^\s*/d" - endif -" call Dret("NetReadFixup") - endfun -endif - -" ------------------------------------------------------------------------ " Modelines And Restoration: {{{1 let &cpo= s:keepcpo unlet s:keepcpo diff --git a/runtime/plugin/tarPlugin.vim b/runtime/plugin/tarPlugin.vim --- a/runtime/plugin/tarPlugin.vim +++ b/runtime/plugin/tarPlugin.vim @@ -14,7 +14,7 @@ if &cp || exists("g:loaded_tarPlugin") finish endif -let g:loaded_tarPlugin = "v23" +let g:loaded_tarPlugin = "v24" let s:keepcpo = &cpo set cpo&vim @@ -34,13 +34,15 @@ augroup tar au FileWriteCmd tarfile::*/* call tar#Write(expand("")) endif - au BufReadCmd *.tar.gz call tar#Browse(expand("")) - au BufReadCmd *.tar call tar#Browse(expand("")) - au BufReadCmd *.lrp call tar#Browse(expand("")) - au BufReadCmd *.tar.bz2 call tar#Browse(expand("")) - au BufReadCmd *.tar.Z call tar#Browse(expand("")) - au BufReadCmd *.tgz call tar#Browse(expand("")) + au BufReadCmd *.tar.gz call tar#Browse(expand("")) + au BufReadCmd *.tar call tar#Browse(expand("")) + au BufReadCmd *.lrp call tar#Browse(expand("")) + au BufReadCmd *.tar.bz2 call tar#Browse(expand("")) + au BufReadCmd *.tar.Z call tar#Browse(expand("")) + au BufReadCmd *.tgz call tar#Browse(expand("")) + au BufReadCmd *.tar.lzma call tar#Browse(expand("")) augroup END +com! -nargs=? -complete=file Vimuntar call tar#Vimuntar() " --------------------------------------------------------------------- " Restoration And Modelines: {{{1 diff --git a/runtime/plugin/vimballPlugin.vim b/runtime/plugin/vimballPlugin.vim --- a/runtime/plugin/vimballPlugin.vim +++ b/runtime/plugin/vimballPlugin.vim @@ -1,6 +1,6 @@ " vimballPlugin : construct a file containing both paths and files " Author: Charles E. Campbell, Jr. -" 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. @@ -16,18 +16,18 @@ if &cp || exists("g:loaded_vimballPlugin") finish endif -let g:loaded_vimballPlugin = "v29" +let g:loaded_vimballPlugin = "v30" let s:keepcpo = &cpo set cpo&vim " ------------------------------------------------------------------------------ " Public Interface: {{{1 com! -ra -complete=file -na=+ -bang MkVimball call vimball#MkVimball(,,0,) -com! -na=? -complete=dir UseVimball call vimball#Vimball(1,) -com! -na=0 VimballList call vimball#Vimball(0) -com! -na=* -complete=dir RmVimball call vimball#SaveSettings()|call vimball#RmVimball()|call vimball#RestoreSettings() -au BufEnter *.vba.gz,*.vba.bz2,*.vba.zip call vimball#Decompress(expand("")) -au BufEnter *.vba setlocal ff=unix noma bt=nofile fmr=[[[,]]] fdm=marker|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)") +com! -na=? -complete=dir UseVimball call vimball#Vimball(1,) +com! -na=0 VimballList call vimball#Vimball(0) +com! -na=* -complete=dir RmVimball call vimball#SaveSettings()|call vimball#RmVimball()|call vimball#RestoreSettings() +au SourceCmd *.vba.gz,*.vba.bz2,*.vba.zip call vimball#Decompress(expand(""))|call vimball#Vimball(1) +au BufEnter *.vba,*.vba.gz,*.vba.bz2,*.vba.zip setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'| setlocal ff=unix|endif|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)") " ===================================================================== " Restoration And Modelines: {{{1 diff --git a/runtime/scripts.vim b/runtime/scripts.vim --- a/runtime/scripts.vim +++ b/runtime/scripts.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types in scripts " " Maintainer: Bram Moolenaar -" Last change: 2008 Aug 09 +" Last change: 2009 Dec 24 " This file is called by an autocommand for every file that has just been " loaded into a buffer. It checks if the type of file can be recognized by @@ -318,30 +318,31 @@ else set ft=scheme " Git output - elseif s:line1 =~ '^\(commit\|tree\|object\) \x\{40\}$\|^tag \S\+$' + elseif s:line1 =~ '^\(commit\|tree\|object\) \x\{40\}\>\|^tag \S\+$' set ft=git " CVS diff else - let lnum = 1 - while getline(lnum) =~ "^? " && lnum < line("$") - let lnum = lnum + 1 + let s:lnum = 1 + while getline(s:lnum) =~ "^? " && s:lnum < line("$") + let s:lnum += 1 endwhile - if getline(lnum) =~ '^Index:\s\+\f\+$' + if getline(s:lnum) =~ '^Index:\s\+\f\+$' set ft=diff " locale input files: Formal Definitions of Cultural Conventions " filename must be like en_US, fr_FR@euro or en_US.UTF-8 elseif expand("%") =~ '\a\a_\a\a\($\|[.@]\)\|i18n$\|POSIX$\|translit_' - let lnum = 1 - while lnum < 100 && lnum < line("$") - if getline(lnum) =~ '^LC_\(IDENTIFICATION\|CTYPE\|COLLATE\|MONETARY\|NUMERIC\|TIME\|MESSAGES\|PAPER\|TELEPHONE\|MEASUREMENT\|NAME\|ADDRESS\)$' + let s:lnum = 1 + while s:lnum < 100 && s:lnum < line("$") + if getline(s:lnum) =~ '^LC_\(IDENTIFICATION\|CTYPE\|COLLATE\|MONETARY\|NUMERIC\|TIME\|MESSAGES\|PAPER\|TELEPHONE\|MEASUREMENT\|NAME\|ADDRESS\)$' setf fdcc break endif - let lnum = lnum + 1 + let s:lnum += 1 endwhile endif + unlet s:lnum endif diff --git a/runtime/spell/README.txt b/runtime/spell/README.txt --- a/runtime/spell/README.txt +++ b/runtime/spell/README.txt @@ -72,7 +72,7 @@ 2. Tweak the .aff and .dic files to gene change too much, the OpenOffice people are not stupid. However, you may want to remove obvious mistakes. And remove single-letter words that aren't really words, they mess up the suggestions (English has this - problem). You can use the "fixdup" Vim script to find duplicate words. + problem). You can use the "fixdup.vim" Vim script to find duplicate words. 3. Make the diff file. "aap diff" will do this for you. If a diff would be too big you might consider writing a Vim script to do systematic changes. diff --git a/runtime/spell/fixdup.vim b/runtime/spell/fixdup.vim new file mode 100644 --- /dev/null +++ b/runtime/spell/fixdup.vim @@ -0,0 +1,27 @@ +" Vim script to fix duplicate words in a .dic file vim: set ft=vim: +" +" Usage: Edit the .dic file and source this script. + +let deleted = 0 + +" Start below the word count. +let lnum = 2 +while lnum <= line('$') + let word = getline(lnum) + if word !~ '/' + if search('^' . word . '/', 'w') != 0 + let deleted += 1 + exe lnum . "d" + continue " don't increment lnum, it's already at the next word + endif + endif + let lnum += 1 +endwhile + +if deleted == 0 + echomsg "No duplicate words found" +elseif deleted == 1 + echomsg "Deleted 1 duplicate word" +else + echomsg printf("Deleted %d duplicate words", deleted) +endif diff --git a/runtime/syntax/2html.vim b/runtime/syntax/2html.vim --- a/runtime/syntax/2html.vim +++ b/runtime/syntax/2html.vim @@ -1,13 +1,18 @@ " Vim syntax support file " Maintainer: Bram Moolenaar -" Last Change: 2008 Jul 17 +" Last Change: 2009 Jul 14 " (modified by David Ne\v{c}as (Yeti) ) " (XHTML support by Panagiotis Issaris ) " (made w3 compliant by Edd Barrett ) " (added html_font. Edd Barrett ) +" (dynamic folding by Ben Fritz ) " Transform a file into HTML, using the current syntax highlighting. +" this file uses line continuations +let s:cpo_sav = &cpo +set cpo-=C + " Number lines when explicitely requested or when `number' is set if exists("html_number_lines") let s:numblines = html_number_lines @@ -22,6 +27,37 @@ else let s:htmlfont = "monospace" endif +" make copies of the user-defined settings that we may overrule +if exists("html_dynamic_folds") + let s:html_dynamic_folds = 1 +endif +if exists("html_hover_unfold") + let s:html_hover_unfold = 1 +endif +if exists("html_use_css") + let s:html_use_css = 1 +endif + +" hover opening implies dynamic folding +if exists("s:html_hover_unfold") + let s:html_dynamic_folds = 1 +endif + +" dynamic folding with no foldcolumn implies hover opens +if exists("s:html_dynamic_folds") && exists("html_no_foldcolumn") + let s:html_hover_unfold = 1 +endif + +" ignore folding overrides dynamic folding +if exists("html_ignore_folding") && exists("s:html_dynamic_folds") + unlet s:html_dynamic_folds +endif + +" dynamic folding implies css +if exists("s:html_dynamic_folds") + let s:html_use_css = 1 +endif + " When not in gui we can only guess the colors. if has("gui_running") let s:whatterm = "gui" @@ -62,7 +98,7 @@ else endfun endif -if !exists("html_use_css") +if !exists("s:html_use_css") " Return opening HTML tag for given highlight id function! s:HtmlOpening(id) let a = "" @@ -150,6 +186,26 @@ function! s:CSS1(id) return a endfun +if exists("s:html_dynamic_folds") + + " compares two folds as stored in our list of folds + " A fold is "less" than another if it starts at an earlier line number, + " or ends at a later line number, ties broken by fold level + function! s:FoldCompare(f1, f2) + if a:f1.firstline != a:f2.firstline + " put it before if it starts earlier + return a:f1.firstline - a:f2.firstline + elseif a:f1.lastline != a:f2.lastline + " put it before if it ends later + return a:f2.lastline - a:f1.lastline + else + " if folds begin and end on the same lines, put lowest fold level first + return a:f1.level - a:f2.level + endif + endfunction + +endif + " Figure out proper MIME charset from the 'encoding' option. if exists("html_use_encoding") let s:html_encoding = html_use_encoding @@ -223,13 +279,13 @@ else let s:tag_close = '>' endif -" Cache html_no_pre incase we have to turn it on for non-css mode +" Cache html_no_pre in case we have to turn it on for non-css mode if exists("html_no_pre") let s:old_html_no_pre = html_no_pre endif -if !exists("html_use_css") - " Cant put font tags in
+if !exists("s:html_use_css")
+  " Can't put font tags in 
   let html_no_pre=1
 endif
 
@@ -251,9 +307,86 @@ if s:html_encoding != ""
   exe "normal! a\n\n\n\e"
+if exists("s:html_use_css")
+  if exists("s:html_dynamic_folds")
+    if exists("s:html_hover_unfold")
+      " if we are doing hover_unfold, use css 2 with css 1 fallback for IE6
+      exe "normal! a".
+	  \ "\n"
+      exe "normal! a\n"
+    else
+      " if we aren't doing hover_unfold, use CSS 1 only
+      exe "normal! a\n"
+    endif
+  else
+    " if we aren't doing any dynamic folding, no need for any special rules
+    exe "normal! a\n\e"
+  endif
 endif
+
+" insert javascript to toggle folds open and closed
+if exists("s:html_dynamic_folds")
+  exe "normal! a\n".
+	\ "\n\e"
+endif
+
 if exists("html_no_pre")
   exe "normal! a\n\n\e"
 else
@@ -265,7 +398,81 @@ exe s:orgwin . "wincmd w"
 " List of all id's
 let s:idlist = ","
 
-" Loop over all lines in the original text.
+" First do some preprocessing for dynamic folding. Do this for the entire file
+" so we don't accidentally start within a closed fold or something.
+let s:allfolds = []
+
+if exists("s:html_dynamic_folds")
+  let s:lnum = 1
+  let s:end = line('$')
+  " save the fold text and set it to the default so we can find fold levels
+  let s:foldtext_save = &foldtext
+  set foldtext&
+
+  " we will set the foldcolumn in the html to the greater of the maximum fold
+  " level and the current foldcolumn setting
+  let s:foldcolumn = &foldcolumn
+
+  " get all info needed to describe currently closed folds
+  while s:lnum < s:end
+    if foldclosed(s:lnum) == s:lnum
+      " default fold text has '+-' and then a number of dashes equal to fold
+      " level, so subtract 2 from index of first non-dash after the dashes
+      " in order to get the fold level of the current fold
+      let s:level = match(foldtextresult(s:lnum), '+-*\zs[^-]') - 2
+      if s:level+1 > s:foldcolumn
+	let s:foldcolumn = s:level+1
+      endif
+      " store fold info for later use
+      let s:newfold = {'firstline': s:lnum, 'lastline': foldclosedend(s:lnum), 'level': s:level,'type': "closed-fold"}
+      call add(s:allfolds, s:newfold)
+      " open the fold so we can find any contained folds
+      execute s:lnum."foldopen"
+    else
+      let s:lnum = s:lnum + 1
+    endif
+  endwhile
+
+  " close all folds to get info for originally open folds
+  silent! %foldclose!
+  let s:lnum = 1
+
+  " the originally open folds will be all folds we encounter that aren't
+  " already in the list of closed folds
+  while s:lnum < s:end
+    if foldclosed(s:lnum) == s:lnum
+      " default fold text has '+-' and then a number of dashes equal to fold
+      " level, so subtract 2 from index of first non-dash after the dashes
+      " in order to get the fold level of the current fold
+      let s:level = match(foldtextresult(s:lnum), '+-*\zs[^-]') - 2
+      if s:level+1 > s:foldcolumn
+	let s:foldcolumn = s:level+1
+      endif
+      let s:newfold = {'firstline': s:lnum, 'lastline': foldclosedend(s:lnum), 'level': s:level,'type': "closed-fold"}
+      " only add the fold if we don't already have it
+      if empty(s:allfolds) || index(s:allfolds, s:newfold) == -1
+	let s:newfold.type = "open-fold"
+	call add(s:allfolds, s:newfold)
+      endif
+      " open the fold so we can find any contained folds
+      execute s:lnum."foldopen"
+    else
+      let s:lnum = s:lnum + 1
+    endif
+  endwhile
+
+  " sort the folds so that we only ever need to look at the first item in the
+  " list of folds
+  call sort(s:allfolds, "s:FoldCompare")
+
+  let &foldtext = s:foldtext_save
+  unlet s:foldtext_save
+
+  " close all folds again so we can get the fold text as we go
+  silent! %foldclose! 
+endif
+
+" Now loop over all lines in the original text to convert to html.
 " Use html_start_line and html_end_line if they are set.
 if exists("html_start_line")
   let s:lnum = html_start_line
@@ -284,6 +491,15 @@ else
   let s:end = line("$")
 endif
 
+" stack to keep track of all the folds containing the current line
+let s:foldstack = []
+
+if s:numblines
+  let s:margin = strlen(s:end) + 1
+else
+  let s:margin = 0
+endif
+
 if has('folding') && !exists('html_ignore_folding')
   let s:foldfillchar = &fillchars[matchend(&fillchars, 'fold:')]
   if s:foldfillchar == ''
@@ -295,6 +511,7 @@ if s:difffillchar == ''
   let s:difffillchar = '-'
 endif
 
+let s:foldId = 0
 
 while s:lnum <= s:end
 
@@ -303,12 +520,7 @@ while s:lnum <= s:end
   if s:filler > 0
     let s:n = s:filler
     while s:n > 0
-      if s:numblines
-	" Indent if line numbering is on
-	let s:new = repeat(s:LeadingSpace, strlen(s:end) + 1) . repeat(s:difffillchar, 3)
-      else
-	let s:new = repeat(s:difffillchar, 3)
-      endif
+      let s:new = repeat(s:difffillchar, 3)
 
       if s:n > 2 && s:n < s:filler && !exists("html_whole_filler")
 	let s:new = s:new . " " . s:filler . " inserted lines "
@@ -317,10 +529,16 @@ while s:lnum <= s:end
 
       if !exists("html_no_pre")
 	" HTML line wrapping is off--go ahead and fill to the margin
-	let s:new = s:new . repeat(s:difffillchar, &columns - strlen(s:new))
+	let s:new = s:new . repeat(s:difffillchar, &columns - strlen(s:new) - s:margin)
+      else
+	let s:new = s:new . repeat(s:difffillchar, 3)
       endif
 
       let s:new = s:HtmlFormat(s:new, "DiffDelete")
+      if s:numblines
+	" Indent if line numbering is on; must be after escaping.
+	let s:new = repeat(s:LeadingSpace, s:margin) . s:new
+      endif
       exe s:newwin . "wincmd w"
       exe "normal! a" . s:new . s:HtmlEndline . "\n\e"
       exe s:orgwin . "wincmd w"
@@ -333,16 +551,18 @@ while s:lnum <= s:end
 
   " Start the line with the line number.
   if s:numblines
-    let s:new = repeat(' ', strlen(s:end) - strlen(s:lnum)) . s:lnum . ' '
+    let s:numcol = repeat(' ', s:margin - 1 - strlen(s:lnum)) . s:lnum . ' '
   else
-    let s:new = ""
+    let s:numcol = ""
   endif
 
-  if has('folding') && !exists('html_ignore_folding') && foldclosed(s:lnum) > -1
+  let s:new = ""
+
+  if has('folding') && !exists('html_ignore_folding') && foldclosed(s:lnum) > -1 && !exists('s:html_dynamic_folds')
     "
-    " This is the beginning of a folded block
+    " This is the beginning of a folded block (with no dynamic folding)
     "
-    let s:new = s:new . foldtextresult(s:lnum)
+    let s:new = s:numcol . foldtextresult(s:lnum)
     if !exists("html_no_pre")
       " HTML line wrapping is off--go ahead and fill to the margin
       let s:new = s:new . repeat(s:foldfillchar, &columns - strlen(s:new))
@@ -355,14 +575,96 @@ while s:lnum <= s:end
 
   else
     "
-    " A line that is not folded.
+    " A line that is not folded, or doing dynamic folding.
     "
     let s:line = getline(s:lnum)
-
     let s:len = strlen(s:line)
 
+    if exists("s:html_dynamic_folds")
+      " First insert a closing for any open folds that end on this line
+      while !empty(s:foldstack) && get(s:foldstack,0).lastline == s:lnum-1
+	let s:new = s:new.""
+	call remove(s:foldstack, 0)
+      endwhile
+
+      " Now insert an opening any new folds that start on this line
+      let s:firstfold = 1
+      while !empty(s:allfolds) && get(s:allfolds,0).firstline == s:lnum
+	let s:foldId = s:foldId + 1
+	let s:new = s:new . ""
+
+	" Unless disabled, add a fold column for the opening line of a fold.
+	"
+	" Note that dynamic folds require using css so we just use css to take
+	" care of the leading spaces rather than using   in the case of
+	" html_no_pre to make it easier
+	if !exists("html_no_foldcolumn")
+	  " add fold column that can open the new fold
+	  if s:allfolds[0].level > 1 && s:firstfold
+	    let s:new = s:new . ""
+	    let s:new = s:new . repeat('|', s:allfolds[0].level - 1) . ""
+	  endif
+	  let s:new = s:new . "+"
+	  let s:new = s:new . ""
+
+	  " add fold column that can close the new fold
+	  let s:new = s:new . ""
+	  if s:firstfold
+	    let s:new = s:new . repeat('|', s:allfolds[0].level - 1)
+	  endif
+	  let s:new = s:new . "-"
+	  " only add spaces if we aren't opening another fold on the same line
+	  if get(s:allfolds, 1, {'firstline': 0}).firstline != s:lnum
+	    let s:new = s:new . repeat(" ", s:foldcolumn - s:allfolds[0].level)
+	  endif
+	  let s:new = s:new . ""
+	  let s:firstfold = 0
+	endif
+
+	" add fold text, moving the span ending to the next line so collapsing
+	" of folds works correctly
+	let s:new = s:new . substitute(s:HtmlFormat(s:numcol . foldtextresult(s:lnum), "Folded"), '', s:HtmlEndline.'\r\0', '')
+	let s:new = s:new . ""
+
+	" open the fold now that we have the fold text to allow retrieval of
+	" fold text for subsequent folds
+	execute s:lnum."foldopen"
+	call insert(s:foldstack, remove(s:allfolds,0))
+	let s:foldstack[0].id = s:foldId
+      endwhile
+
+      " Unless disabled, add a fold column for other lines.
+      "
+      " Note that dynamic folds require using css so we just use css to take
+      " care of the leading spaces rather than using   in the case of
+      " html_no_pre to make it easier
+      if !exists("html_no_foldcolumn")
+	if empty(s:foldstack)
+	  " add the empty foldcolumn for unfolded lines
+	  let s:new = s:new . s:HtmlFormat(repeat(' ', s:foldcolumn), "FoldColumn")
+	else
+	  " add the fold column for folds not on the opening line
+	  if get(s:foldstack, 0).firstline < s:lnum
+	    let s:new = s:new . ""
+	    let s:new = s:new . repeat('|', s:foldstack[0].level)
+	    let s:new = s:new . repeat(' ', s:foldcolumn - s:foldstack[0].level) . ""
+	  endif
+	endif
+      endif
+    endif
+
+    " Now continue with the unfolded line text
     if s:numblines
-      let s:new = s:HtmlFormat(s:new, "lnr")
+      let s:new = s:new . s:HtmlFormat(s:numcol, "lnr")
     endif
 
     " Get the diff attribute, if any.
@@ -380,7 +682,7 @@ while s:lnum <= s:end
 	while s:col <= s:len && s:id == diff_hlID(s:lnum, s:col) | let s:col = s:col + 1 | endwhile
 	if s:len < &columns && !exists("html_no_pre")
 	  " Add spaces at the end to mark the changed line.
-	  let s:line = s:line . repeat(' ', &columns - s:len)
+	  let s:line = s:line . repeat(' ', &columns - virtcol([s:lnum, s:len]) - s:margin)
 	  let s:len = &columns
 	endif
       else
@@ -393,11 +695,27 @@ while s:lnum <= s:end
 
       " Expand tabs
       let s:expandedtab = strpart(s:line, s:startcol - 1, s:col - s:startcol)
-      let idx = stridx(s:expandedtab, "\t")
-      while idx >= 0
-	let i = &ts - ((idx + s:startcol - 1) % &ts)
-	let s:expandedtab = substitute(s:expandedtab, '\t', repeat(' ', i), '')
-	let idx = stridx(s:expandedtab, "\t")
+      let s:offset = 0
+      let s:idx = stridx(s:expandedtab, "\t")
+      while s:idx >= 0
+	if has("multi_byte_encoding")
+	  if s:startcol + s:idx == 1
+	    let s:i = &ts
+	  else
+	    if s:idx == 0
+	      let s:prevc = matchstr(s:line, '.\%' . (s:startcol + s:idx + s:offset) . 'c')
+	    else
+	      let s:prevc = matchstr(s:expandedtab, '.\%' . (s:idx + 1) . 'c')
+	    endif
+	    let s:vcol = virtcol([s:lnum, s:startcol + s:idx + s:offset - len(s:prevc)])
+	    let s:i = &ts - (s:vcol % &ts)
+	  endif
+	  let s:offset -= s:i - 1
+	else
+	  let s:i = &ts - ((s:idx + s:startcol - 1) % &ts)
+	endif
+	let s:expandedtab = substitute(s:expandedtab, '\t', repeat(' ', s:i), '')
+	let s:idx = stridx(s:expandedtab, "\t")
       endwhile
 
       " Output the text with the same synID, with class set to {s:id_name}
@@ -415,8 +733,22 @@ endwhile
 " Finish with the last line
 exe s:newwin . "wincmd w"
 
+if exists("s:html_dynamic_folds")
+  " finish off any open folds
+  while !empty(s:foldstack)
+    exe "normal! a"
+    call remove(s:foldstack, 0)
+  endwhile
+
+  " add fold column to the style list if not already there
+  let s:id = hlID('FoldColumn')
+  if stridx(s:idlist, "," . s:id . ",") == -1
+    let s:idlist = s:idlist . s:id . ","
+  endif
+endif
+
 " Close off the font tag that encapsulates the whole 
-if !exists("html_use_css")
+if !exists("s:html_use_css")
   exe "normal! a\e"
 endif
 
@@ -428,7 +760,7 @@ endif
 
 
 " Now, when we finally know which, we define the colors and styles
-if exists("html_use_css")
+if exists("s:html_use_css")
   1;/