diff --git a/vimfiles.stefan/plugin/changelog.vim b/vimfiles.stefan/plugin/changelog.vim deleted file mode 100644 index c35e9ce..0000000 --- a/vimfiles.stefan/plugin/changelog.vim +++ /dev/null @@ -1,170 +0,0 @@ -" =========================================================================== -" File: changelog.vim -" Author: Stefan Liebl (S.Liebl@gmx.de) -" Description: changelog for vimfiles in subversion -" Revision: $LastChangedRevision$ -" =========================================================================== - -" get Revision from subversion -let g:VimFilesRevision = substitute("$Rev$",'\$Rev:\s*\(\d\+\)\s*\$','\1','g') -let &titlestring = '%t - (%-F) - %=vimfiles Rev: ' . g:VimFilesRevision - -if exists('nochangelog') - finish -endif - -function s:ReportRev(Rev) - if a:Rev >= '148' - echo 'Neu seit Rev: 148' - echo 'BlockDiff: Commands ergänzt' - echo 'Matchit: syntax für a2l' - elseif a:Rev >= '145' - echo 'Neu seit Rev: 145' - echo 'BlockDiff: Markieren -> BlockDiff -> Markieren -> BlockDiff -> neuer Tab' - echo 'Gsub: global substitute' - echo 'gb funktioniert jetzt anders (= bis zum letzten file)' - echo 'syntax Highliting für Lint-Kommentare' - elseif a:Rev >= '139' - echo 'Neu seit Rev: 129' - echo 'Projekt laden über project.vim' - echo 'Einstellungen bleiben gespeichert' - echo 'Session wird im Projekt gespeichert, wenn g:sessionfile von project.vim gesetzt wird' - elseif a:Rev >= '129' - echo 'Neu seit Rev: 129' - echo 'Tags für BMS-X' - echo 'Doxygen Toolkit' - echo 'Update VimScripts' - echo 'das Verzeichnis vimfiles kann ohne Anpassung verwendet werden' - elseif a:Rev >= '128' - echo 'Neu seit Rev: 128' - echo 'Vimsuite für BMS-X verbessert' - elseif a:Rev >= '123' - echo 'Neu seit Rev: 120' - echo 'Task Report' - echo 'damos als eigenes Package' - echo 'a2l indent verbessert' - echo '+scons' - echo '+Merge für Synergy/CM' - elseif a:Rev >= '120' - echo 'Neu seit Rev: 119' - echo 'Verbindung zu Projekt deutlich beschleunigt, da mehrere Variablen auf einmal gelesen werden können' - echo '+ftplugin paf.vim: Anzeiger der aktuellen Adresse in der Statuszeile' - echo 'ccm.vim: Umformatierungen für ChangeSynergy Reports' - echo 'BmskDoku im Menü und interaktiv' - echo 'Cscope Verbindung kann per Menü geschlossen werden' - echo 'Altes make.log kann per Menü geparsed werden' - elseif a:Rev >= '119' - echo 'Neu seit Rev: 118' - echo 'Befehl "Bmsk distclean" im Menü ergänzt' - elseif a:Rev >= '116' - echo 'Neu seit Rev: 116' - echo 'Einstelldialoge und Titelleiste für BMS-K verbessert' - echo 'Menüs für BMS-K verbessert' - elseif a:Rev >= '114' - echo 'Neu seit Rev: 114' - echo 'Continuus Anbindung verbessert' - echo 'Bmsk Argumen EXTRA_C_FLAGS' - elseif a:Rev >= '111' - echo 'Neu seit Rev: 111' - echo 'GetMakeVar verbessert, ccm64, +FindEEEmuFile' - elseif a:Rev >= '111' - echo 'Neu seit Rev: 100' - echo 'Befehl BmskDoku zum besseren parsen von LaTeX Fehlern' - echo 'Grep, GrepBmsk aktiviert' - echo 'CCM kann jetzt auch Subprojekte' - echo 'GetOsp... repariert' - echo 'SVNstudio verbessert' - echo 'SVNdiff auch mit Revision' - echo 'diff für unix verbessert' - echo 'MyTools heissen jetzt VimSuite' - echo 'K46 ergänzt' - echo 'Dokumentation überarbeitet' - elseif a:Rev >= '100' - echo 'Neu seit Rev: 90' - echo 'vimfiles in Unterverzeichnisse' - elseif a:Rev >= '90' - echo 'Neu seit Rev: 89' - echo 'compiler/bmsk.vim: leere Makeoptionen unterstützen, tex mit includieren' - echo 'ftplugin/latex-suite: Update von vim.org' - echo 'plugin/bmsk.vim: Makeoptionen erst leer lassen' - echo 'plugin/basics.vim: PathNormpath verbessert' - echo 'plugin/tools.vim: $VIMRUNTIME -> g:vimfiles' - echo 'plugin/visincr.vim: Update von vim.org' - echo 'after/syntax/python.vim: Update von vim.org' - elseif a:Rev >= '89' - echo 'Neu seit Rev: 79' - echo 'after/syntax/kgs.vim: + test_wert_text' - echo 'compiler/bmsk.vim : Xlint weglassen wenn leer' - echo 'doc/bmsk.txt : kleine Aktualisierungen' - echo 'tools/ctags.exe : Version ohne cygwin' - echo 'plugin/bmsk.vim : header-Verzeichnisse verbessert' - echo ' ' - echo 'checkpath sollte jetzt komplett funktionierien.' - echo 'Siehe :help :checkpath' - elseif a:Rev >= '79' - echo 'Neu seit Rev: 78' - echo 'angepasst auf make-12' - echo 'ftplugins verbessert (setlocal)' - echo 'Formatierung verbessert' - echo 'Angepasst für vim 6.4' - echo 'Python-dlls integriert' - elseif a:Rev >= '78' - echo 'Neu seit Rev: 76' - echo 'Bmsk: UpdateBuffers verbessert' - echo 'cscope: find files including this file geändert' - echo '+ xml.vim' - echo '+ indent/a2l.vim' - echo 'compiler/bmsk.vim: alte Python-Meldung auskommentiert' - echo 'svn.vim: SVNtool verbessert' - elseif a:Rev >= '76' - echo 'Neu seit Rev: 72' - echo 'syntax-File für paf,daf,0pa,0da' - echo 'Diff-Tools im Menü MyTools' - echo 'Subversion-Menü' - echo 'Subversion Command SVN' - echo 'compiler/bmsk.vim unabhängig von Pfaden' - elseif a:Rev >= '72' - echo 'Neu seit Rev: 71' - echo 'cscopeprg wird mit Pfad gesetzt' - echo 'grep.exe V 2.5.1 in funktionierender Version' - echo 'neue Suchpfade für linux' - echo 'FindFile funktioniert wieder' - elseif a:Rev >= '71' - echo 'Neu seit Rev: 71' - echo 'grep.exe V 2.5.1' - echo 'basics.vim: Verbesserungen für GetOspTestValues' - echo 'syntax/c.vim: c.vim aufgenommen (hatte ich bei Rev 67 vergessen)' - elseif a:Rev >= '70' - echo 'Neu seit Rev: 70' - echo 'Make-Targets ergänzt' - echo 'Produkte in Continuus auschecken' - elseif a:Rev >= '66' - echo 'Neu seit Rev: 66' - echo 'ftplugin- und syntax-files nach after/...,' - echo ' damit sie nach den files in vim63 geladen werden' - echo 'syntax/c.vim: Verbessertes Syntax-Highliting' - echo 'colors/Stefan.vim: Neue Syntax-Groups für neues c.vim' - echo '-----------------------------------------------------' - echo 'Ich empfehle die Änderungen aus colors/Stefan.vim' - echo ' in das eigene Colorscheme zu übertragen' - elseif a:Rev == '66' - echo 'Neu in Rev: ' . g:VimFilesRevision - echo 'doc/bmsk.vim: Doku aktualisiert' - echo 'plugin/changelog.vim: neu, gibt die Änderungen beim ersten Start aus' - echo 'plugin/tComment.vim: neu, gute Kommentierfunktion, :help tComment' - echo 'plugin/visincr.vim: neu, inkrementieren von Spalten, :help visincr' - echo 'plugin/matrix.vim: neu, Bildschirmschoner, :Matrix' - echo 'ftplugin/python_fold.vim: neu, Faltungen für Python' - endif -endfunction - -" uncomment next line to get changelog for the last version -execute 'call s:ReportRev(' . g:VimFilesRevision . ')' - -" comment changelog after first usage -silent! new -silent! set modifiable -silent! %substitute/^execute 'call/"execute 'call/ -silent! wq! -bdelete changelog.vim - diff --git a/vimfiles/GetLatest/GetLatestVimScripts.dat b/vimfiles/GetLatest/GetLatestVimScripts.dat index 8e35967..15ff6c8 100644 --- a/vimfiles/GetLatest/GetLatestVimScripts.dat +++ b/vimfiles/GetLatest/GetLatestVimScripts.dat @@ -1,6 +1,6 @@ ScriptID SourceID Filename -------------------------- -1075 8351 netrw.vim +1075 8501 netrw.vim 1502 7078 vimball.vim 1008 3118 srec.vim (ftplugin) 1009 3119 srec.vim (syntax file) @@ -30,3 +30,4 @@ ScriptID SourceID Filename 294 8407 Align.vim 642 8136 getscript.vim 642 8136 :AutoInstall: GetLatestVimScripts.vim +1066 7618 :AutoInstall: cecutil.vim diff --git a/vimfiles/autoload/netrw.vim b/vimfiles/autoload/netrw.vim index 3734b69..f17adf7 100644 --- a/vimfiles/autoload/netrw.vim +++ b/vimfiles/autoload/netrw.vim @@ -1,7 +1,7 @@ " netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION -" Date: Feb 26, 2008 -" Version: 122 +" Date: Mar 28, 2008 +" Version: 123 " Maintainer: Charles E Campbell, Jr " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1 @@ -27,7 +27,7 @@ if !exists("s:NOTE") let s:WARNING = 1 let s:ERROR = 2 endif -let g:loaded_netrw = "v122" +let g:loaded_netrw = "v123" if v:version < 700 call netrw#ErrorMsg(s:WARNING,"you need vim version 7.0 or later for version ".g:loaded_netrw." of netrw",1) finish @@ -360,13 +360,13 @@ if !exists("g:netrw_cd_escape") let g:netrw_cd_escape="[]#*$%'\" ?`!&();<>\\" endif if !exists("g:netrw_fname_escape") - let 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 -if !exists("s:netrw_glob_escape") - let s:netrw_glob_escape= '[]*?`{~$' + let g:netrw_tmpfile_escape= ' &;' endif " BufEnter event ignored by decho when following variable is true @@ -447,8 +447,8 @@ fun! s:NetrwOptionRestore(vt) let &l:acd = {a:vt}netrw_acdkeep unlet {a:vt}netrw_acdkeep if &l:acd -" call Decho("exe cd ".escape(curdir,g:netrw_fname_escape)) - exe "lcd ".escape(curdir,g:netrw_fname_escape) +" call Decho("exe cd ".escape(curdir,g:netrw_cd_escape)) " NOTE: was g:netrw_fname_escape for some reason + exe "lcd ".escape(curdir,g:netrw_cd_escape) endif endif endif @@ -705,8 +705,8 @@ fun! netrw#NetRead(mode,...) let uid_machine = g:netrw_machine endif endif -" call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".uid_machine.":".escape(b:netrw_fname,' ?&;')." ".tmpfile) - exe g:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".uid_machine.":".escape(b:netrw_fname,' ?&;')." ".tmpfile +" call Decho("executing: !".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".g:netrw_shq.uid_machine.":".escape(b:netrw_fname,' ?&;')." ".tmpfile.g:netrw_shq) + exe g:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".g:netrw_shq.uid_machine.":".escape(b:netrw_fname,' ?&;')." ".tmpfile.g:netrw_shq let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -807,7 +807,7 @@ fun! netrw#NetRead(mode,...) else let useport= "" endif -" call Decho("executing: !".g:netrw_scp_cmd.useport." '".g:netrw_machine.":".escape(b:netrw_fname,g:netrw_fname_escape)."' ".tmpfile) +" call Decho("exe g:netrw_silentxfer.!".g:netrw_scp_cmd.useport." ".g:netrw_shq.g:netrw_machine.":".escape(b:netrw_fname,g:netrw_fname_escape).g:netrw_shq." ".tmpfile) exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_shq.g:netrw_machine.":".escape(b:netrw_fname,g:netrw_fname_escape).g:netrw_shq." ".tmpfile let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -824,21 +824,23 @@ fun! netrw#NetRead(mode,...) return endif + let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) if match(b:netrw_fname,"#") == -1 " simple wget - let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) -" call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_fname) - exe g:netrw_silentxfer."!".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_fname +" call Decho('using simple wget (# not in b:netrw_fname<'.b:netrw_fname.">)") +" call Decho("exe ".g:netrw_silentxfer."!".g:netrw_http_cmd." ".g:netrw_shq.tmpfile.g:netrw_shq." ".g:netrw_shq."http://".g:netrw_machine.netrw_fname.g:netrw_shq) + exe g:netrw_silentxfer."!".g:netrw_http_cmd." ".g:netrw_shq.tmpfile.g:netrw_shq." ".g:netrw_shq."http://".g:netrw_machine.netrw_fname.g:netrw_shq let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) else " wget plus a jump to an in-page marker (ie. http://abc/def.html#aMarker) +" call Decho(("wget/curl plus jump (# in b:netrw_fname<".b:netrw_fname.">)") let netrw_html= substitute(netrw_fname,"#.*$","","") let netrw_tag = substitute(netrw_fname,"^.*#","","") " call Decho("netrw_html<".netrw_html.">") " call Decho("netrw_tag <".netrw_tag.">") -" call Decho("executing: !".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_html) - exe g:netrw_silentxfer."!".g:netrw_http_cmd." ".tmpfile." http://".g:netrw_machine.netrw_html +" call Decho("exe ".g:netrw_silentxfer."!".g:netrw_http_cmd." ".g:netrw_shq.tmpfile.g:netrw_shq." ".g:netrw_shq."http://".g:netrw_machine.netrw_html.g:netrw_shq) + exe g:netrw_silentxfer."!".g:netrw_http_cmd." ".g:netrw_shq.tmpfile.g:netrw_shq." ".g:netrw_shq."http://".g:netrw_machine.netrw_html.g:netrw_shq let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) " call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/') exe 'norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\" @@ -877,9 +879,9 @@ fun! netrw#NetRead(mode,...) elseif b:netrw_method == 7 " call Decho("read via rsync (method #7)") let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) -" call Decho("executing: !".g:netrw_rsync_cmd." ".g:netrw_machine.":".netrw_fname." ".tmpfile) - exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".g:netrw_machine.":".netrw_fname." ".tmpfile - let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) +" call Decho("exe ".g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".g:netrw_shq.g:netrw_machine.":".netrw_fname.g:netrw_shq." ".tmpfile) + exe g:netrw_silentxfer."!".g:netrw_rsync_cmd." ".g:netrw_shq.g:netrw_machine.":".netrw_fname.g:netrw_shq." ".tmpfile + let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... @@ -902,11 +904,11 @@ fun! netrw#NetRead(mode,...) " call Decho("read via fetch for ".netrw_option) if exists("g:netrw_uid") && g:netrw_uid != "" && exists("s:netrw_passwd") && s:netrw_passwd != "" -" call Decho("executing: !".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".netrw_fname) - exe g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".netrw_fname +" call Decho("exe ".g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".g:netrw_shq.netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".netrw_fname.g:netrw_shq) + exe g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".g:netrw_shq.netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".netrw_fname.g:netrw_shq else -" call Decho("executing: !".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_machine."/".netrw_fname) - exe g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".netrw_option."://".g:netrw_machine."/".netrw_fname +" call Decho("exe ".g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".g:netrw_shq.netrw_option."://".g:netrw_machine."/".netrw_fname.g:netrw_shq) + exe g:netrw_silentxfer."!".g:netrw_fetch_cmd." ".tmpfile." ".g:netrw_shq.netrw_option."://".g:netrw_machine."/".netrw_fname.g:netrw_shq endif let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) @@ -918,8 +920,8 @@ fun! netrw#NetRead(mode,...) elseif b:netrw_method == 9 " call Decho("read via sftp (method #9)") let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) -" call Decho("executing: !".g:netrw_sftp_cmd." ".g:netrw_machine.":".netrw_fname." ".tmpfile) - exe g:netrw_silentxfer."!".g:netrw_sftp_cmd." ".g:netrw_machine.":".netrw_fname." ".tmpfile +" call Decho("exe ".g:netrw_silentxfer."!".g:netrw_sftp_cmd." ".g:netrw_shq.g:netrw_machine.":".netrw_fname.g:netrw_shq." ".tmpfile) + exe g:netrw_silentxfer."!".g:netrw_sftp_cmd." ".g:netrw_shq.g:netrw_machine.":".netrw_fname.g:netrw_shq." ".tmpfile let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -1354,7 +1356,11 @@ fun! s:NetrwGetFile(readcmd, tfile, method) " rename buffer back to remote filename " call Decho("exe silent! keepalt file ".escape(rfile,' ')) exe "silent! keepalt file ".escape(rfile,' ') - filetype detect + if a:method == 5 + set ft=html + else + filetype detect + endif " call Dredir("renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">","ls!") let line1 = 1 let line2 = line("$") @@ -1386,9 +1392,9 @@ fun! s:NetrwGetFile(readcmd, tfile, method) " call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")") endif - " update the Buffers menu - if has("gui") && has("gui_running") - silent! emenu Buffers.Refresh\ menu + if has("gui") && has("menu") && has("gui_running") && &go =~ 'm' + " update the Buffers menu + call s:UpdateBuffersMenu() endif " call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> tfile<".a:tfile."> readable=".s:FileReadable(a:tfile)) @@ -1949,6 +1955,7 @@ endfun fun! s:NetrwBrowse(islocal,dirname) if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif " 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_skipbrowse") @@ -2218,7 +2225,7 @@ fun! s:NetrwGetBuffer(islocal,dirname) " call Decho(" findbuf1: bufnum=bufnr('".dirname."')=".bufnum." bufname(".bufnum.")<".bufname(bufnum)."> (initial)") " 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 + if bufnum > 0 && bufname(bufnum) != dirname && bufname(bufnum) != '.' " handle approximate matches " call Decho(" handling approx match: bufnum#%d<".bufname(bufnum)."> approx= dirname<".dirname.">") let ibuf = 1 @@ -2267,9 +2274,10 @@ fun! s:NetrwGetBuffer(islocal,dirname) else " let v:errmsg= "" " Decho let escdirname= escape(dirname,g:netrw_cd_escape) -" call Decho("errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">") +" call Decho(" errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">") " call Decho(' exe silent! keepalt file '.escdirname) exe 'silent! keepalt file '.escdirname +" call Decho(" errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">") endif " call Decho(" named enew buffer#".bufnr("%")."<".bufname("%").">") @@ -2284,6 +2292,9 @@ fun! s:NetrwGetBuffer(islocal,dirname) " call Decho(" reusing buffer#".bufnum."<".((bufnum > 0)? bufname(bufnum) : "")."> using: b ".bufnum) exe "b ".bufnum endif + if bufname("%") == '.' + exe "silent! keepalt file ".escape(getcwd(),' ') + endif let &ei= eikeep if line("$") <= 1 call s:NetrwListSettings(a:islocal) @@ -2524,7 +2535,9 @@ fun! s:NetrwBookmarkMenu() return endif " call Dfunc("NetrwBookmarkMenu() bookmarkcnt=".g:NETRW_BOOKMARKMAX." histcnt=".g:NETRW_DIRHIST_CNT." menucnt=".s:netrw_menucnt) - if has("menu") && has("gui_running") && &go =~ 'm' + + " 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") exe 'silent! unmenu '.g:NetrwTopLvlMenu.'Bookmark' endif @@ -3603,24 +3616,28 @@ endfun fun! s:NetrwMarkFile(islocal,fname) " call Dfunc("s:NetrwMarkFile(islocal=".a:islocal." fname<".a:fname.">)") let curbufnr= bufnr("%") + let curdir = b:netrw_curdir if exists("s:netrwmarkfilelist_{curbufnr}") + " markfile list exists " call Decho("starting s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">") " call Decho("starting s:netrwmarkfilemtch_{curbufnr}<".s:netrwmarkfilemtch_{curbufnr}.">") if index(s:netrwmarkfilelist_{curbufnr},a:fname) == -1 - " append filename to list -" call Decho("append filename<".a:fname."> to markfilelist<".string(s:netrwmarkfilelist_{curbufnr}).">") + " append filename to local-directory 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."'").'\>' + else - " remove filename from list -" call Decho("remove filename<".a:fname."> from markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">") + " remove filename from local markfilelist +" call Decho("remove filename<".a:fname."> from local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">") 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) - unlet s:netrwmarkfilelist_{curbufnr} - unlet s:netrwmarkfilemtch_{curbufnr} + call s:NetrwUnmarkList(curbufnr,curdir) else + " rebuild match list to display markings correctly " call Decho("rebuild s:netrwmarkfilemtch_".curbufnr) let s:netrwmarkfilemtch_{curbufnr}= "" let first = 1 @@ -3632,26 +3649,52 @@ fun! s:NetrwMarkFile(islocal,fname) endif let first= 0 endfor -" call Decho("ending s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">") -" call Decho("ending s:netrwmarkfilemtch_{curbufnr}<".s:netrwmarkfilemtch_{curbufnr}.">") +" call Decho("ending s:netrwmarkfilelist_"curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">") +" call Decho("ending s:netrwmarkfilemtch_"curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">") endif endif else + " initialize new markfilelist -" call Decho("add fname<".a:fname."> to new markfilelist") +" call Decho("add fname<".a:fname."> to new markfilelist_".curbufnr) let s:netrwmarkfilelist_{curbufnr}= [] call add(s:netrwmarkfilelist_{curbufnr},a:fname) " call Decho("ending s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">") + " build initial markfile matching pattern if a:fname =~ '/$' let s:netrwmarkfilemtch_{curbufnr}= '\<'.escape(a:fname,g:netrw_markfileesc) else let s:netrwmarkfilemtch_{curbufnr}= '\<'.escape(a:fname,g:netrw_markfileesc).'\>' endif -" call Decho("ending s:netrwmarkfilemtch_{curbufnr}<".s:netrwmarkfilemtch_{curbufnr}.">") +" call Decho("ending s:netrwmarkfilemtch_".curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">") endif + " handle global markfilelist + if exists("s:netrwmarkfilelist") + let dname= s:ComposePath(b:netrw_curdir,a:fname) + if index(s:netrwmarkfilelist,dname) == -1 + " append new filename to global markfilelist + call add(s:netrwmarkfilelist,s:ComposePath(b:netrw_curdir,a:fname)) +" call Decho("append filename<".a:fname."> to global markfilelist<".string(s:netrwmarkfilelist).">") + else + " remove new filename from global markfilelist +" call Decho("filter(".string(s:netrwmarkfilelist).",'v:val != '.".dname.")") + call filter(s:netrwmarkfilelist,'v:val != "'.dname.'"') +" call Decho("ending s:netrwmarkfilelist <".string(s:netrwmarkfilelist).">") + if s:netrwmarkfilelist == [] + unlet s:netrwmarkfilelist + endif + endif + else + " initialize new global-directory markfilelist + let s:netrwmarkfilelist= [] + call add(s:netrwmarkfilelist,s:ComposePath(b:netrw_curdir,a:fname)) +" call Decho("init s:netrwmarkfilelist<".string(s:netrwmarkfilelist).">") + endif + + " 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}."/" @@ -3659,7 +3702,7 @@ fun! s:NetrwMarkFile(islocal,fname) " call Decho("2match none") 2match none endif -" call Dret("s:NetrwMarkFile : netrwmarkfilelist".(exists("s:netrwmarkfilelist_{curbufnr}")? string(s:netrwmarkfilelist_{curbufnr}) : " doesn't exist")) +" call Dret("s:NetrwMarkFile : netrwmarkfilelist_".curbufnr."<".(exists("s:netrwmarkfilelist_{curbufnr}")? string(s:netrwmarkfilelist_{curbufnr}) : " doesn't exist").">") endfun " --------------------------------------------------------------------- @@ -3713,9 +3756,7 @@ fun! s:NetrwMarkFileCompress(islocal) call s:RemoteSystem(g:netrw_compress." ".fname) endif endfor - unlet s:netrwmarkfilelist_{curbufnr} - unlet s:netrwmarkfilemtch_{curbufnr} - 2match none + call s:NetrwUnmarkList(curbufnr,curdir) call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) call netrw#NetrwRestorePosn(svpos) endif @@ -3726,7 +3767,7 @@ endfun " s:NetrwMarkFileCopy: (invoked by mc) copy marked files to target {{{2 " If no marked files, then set up directory as the " target. Currently does not support copying entire -" directories. +" directories. Uses the global marked file list. " Returns 1=success (used by NetrwMarkFileMove()) " 0=failure fun! s:NetrwMarkFileCopy(islocal) @@ -3734,9 +3775,8 @@ fun! s:NetrwMarkFileCopy(islocal) " s:netrwmarkfilelist_{bufnr("%")}: the List of marked files let curbufnr= bufnr("%") - if exists("s:netrwmarkfilelist_{curbufnr}") -" call Decho("s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">") -" call Decho("s:netrwmarkfilemtch_{curbufnr}<".string(s:netrwmarkfilemtch_{curbufnr}).">") + if exists("s:netrwmarkfilelist") +" call Decho("s:netrwmarkfilelist<".string(s:netrwmarkfilelist).">") let svpos = netrw#NetrwSavePosn() let curdir = b:netrw_curdir @@ -3747,7 +3787,7 @@ fun! s:NetrwMarkFileCopy(islocal) " call Decho("s:netrwmftgt<".s:netrwmftgt.">") " call Decho("s:netrwmfloc=".s:netrwmfloc) - for fname in s:netrwmarkfilelist_{curbufnr} + for fname in s:netrwmarkfilelist " call Decho("s:NetrwMarkFileCopy: fname<".fname.">") " sanity check @@ -3759,10 +3799,11 @@ fun! s:NetrwMarkFileCopy(islocal) if a:islocal && s:netrwmfloc " local to local copy -" call Decho("local to local copy: from b:netrw_curdir<".b:netrw_curdir."> fname<".fname."> to s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("local to local copy") +" call Decho("from b:netrw_curdir<".b:netrw_curdir."> fname<".fname."> to s:netrwmftgt<".s:netrwmftgt.">") if executable(g:netrw_localcopycmd) " call Decho("let ret= system(".g:netrw_localcopycmd." ".s:ComposePath(b:netrw_curdir,fname)." ".s:netrwmftgt.")") - let ret= system(g:netrw_localcopycmd." ".s:ComposePath(curdir,fname)." ".s:netrwmftgt) + let ret= system(g:netrw_localcopycmd." "." ".s:netrwmftgt) " global markfilelist verison if v:shell_error < 0 call netrw#ErrorMsg(s:ERROR,"command<".g:netrw_localcopycmd."> failed, aborting",54) break @@ -3774,13 +3815,15 @@ fun! s:NetrwMarkFileCopy(islocal) elseif !a:islocal && s:netrwmfloc " remote to local copy -" call Decho("remote to local copy: getcwd<".getcwd()."> b:netrw_curdir<".b:netrw_curdir.">") +" call Decho("remote to local copy") +" call Decho("getcwd<".getcwd()."> b:netrw_curdir<".b:netrw_curdir.">") call netrw#NetrwObtain(a:islocal,fname,s:netrwmftgt) elseif a:islocal && !s:netrwmfloc " local to remote copy -" call Decho("local to remote copy: getcwd<".getcwd()."> b:netrw_curdir<".b:netrw_curdir.">") - call s:NetrwUpload(s:ComposePath(curdir,fname),s:netrwmftgt) +" call Decho("local to remote copy") +" call Decho("getcwd<".getcwd()."> b:netrw_curdir<".b:netrw_curdir.">") + call s:NetrwUpload(fname,s:netrwmftgt) else " remote to remote copy @@ -3789,13 +3832,8 @@ fun! s:NetrwMarkFileCopy(islocal) endif endfor - " unmark marked file list (although I expect s:NetrwUpload() - " to do it, I'm just making sure) - if exists("s:netrwmarkfilelist_{curbufnr}") - unlet s:netrwmarkfilelist_{curbufnr} - unlet s:netrwmarkfilemtch_{curbufnr} - 2match none - endif + " unmark all marked file lists + call s:NetrwUnmarkAll() else call netrw#ErrorMsg(s:ERROR,"missing a markfile copy target! (see help for netrw-mt)",56) endif @@ -3815,6 +3853,7 @@ endfun " s:NetrwMarkFileDiff: (invoked by md) This function is used to {{{2 " invoke vim's diff mode on the marked files. " Either two or three files can be so handled. +" Uses the global marked file list. fun! s:NetrwMarkFileDiff(islocal) " call Dfunc("s:NetrwMarkFileDiff(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">") let curbufnr= bufnr("%") @@ -3822,13 +3861,9 @@ fun! s:NetrwMarkFileDiff(islocal) let cnt = 0 let curdir = b:netrw_curdir - for fname in s:netrwmarkfilelist_{curbufnr} + for fname in s:netrwmarkfilelist let cnt= cnt + 1 - if a:islocal - if g:netrw_keepdir - let fname= s:ComposePath(curdir,fname) - endif - else + if !a:islocal let fname= curdir.fname endif if cnt == 1 @@ -3845,15 +3880,14 @@ fun! s:NetrwMarkFileDiff(islocal) break endif endfor - unlet s:netrwmarkfilelist_{curbufnr} - unlet s:netrwmarkfilemtch_{curbufnr} - 2match none + call s:NetrwUnmarkList(curbufnr,curdir) endif " call Dret("s:NetrwMarkFileDiff") endfun " --------------------------------------------------------------------- " s:NetrwMarkFileEdit: (invoked by me) put marked files on arg list and start editing them {{{2 +" Uses global markfilelist fun! s:NetrwMarkFileEdit(islocal) " call Dfunc("s:NetrwMarkFileEdit(islocal=".a:islocal.")") @@ -3864,16 +3898,17 @@ fun! s:NetrwMarkFileEdit(islocal) if a:islocal && g:netrw_keepdir " use complete paths if its local and keepdir enabled let flist= "" - for fname in s:netrwmarkfilelist_{curbufnr} - let flist= flist." ".s:ComposePath(curdir,fname) + for fname in s:netrwmarkfilelist +" let flist= flist." ".s:ComposePath(curdir,fname) + let flist= flist." ".fname endfor else - let flist= substitute(escape(join(s:netrwmarkfilelist_{curbufnr},"\t"),' '),"\t",' ','g') +" let flist= substitute(escape(join(s:netrwmarkfilelist_{curbufnr},"\t"),' '),"\t",' ','g') + let flist= substitute(escape(join(s:netrwmarkfilelist,"\t"),' '),"\t",' ','g') endif - " unmark marked file list - unlet s:netrwmarkfilelist_{curbufnr} - unlet s:netrwmarkfilemtch_{curbufnr} - 2match none + " unmark markedfile list +" call s:NetrwUnmarkList(curbufnr,curdir) + call s:NetrwUnmarkAll() " call Decho("exe silent args ".flist) exe "silent args ".flist endif @@ -3883,6 +3918,7 @@ endfun " --------------------------------------------------------------------- " s:NetrwMarkFileExe: (invoked by mx) execute arbitrary command on marked files, one at a time {{{2 +" Uses the local marked-file list. fun! s:NetrwMarkFileExe(islocal) " call Dfunc("s:NetrwMarkFileExe(islocal=".a:islocal.")") let svpos = netrw#NetrwSavePosn() @@ -3927,9 +3963,7 @@ fun! s:NetrwMarkFileExe(islocal) endfor " unmark marked file list - unlet s:netrwmarkfilelist_{curbufnr} - unlet s:netrwmarkfilemtch_{curbufnr} - 2match none + call s:NetrwUnmarkList(curbufnr,curdir) " refresh the listing call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) @@ -3944,6 +3978,7 @@ endfun " --------------------------------------------------------------------- " s:NetrwMarkHideSfx: (invoked by mh) (un)hide files having same suffix " as the marked file(s) (toggles suffix presence) +" Uses the local marked file list. fun! s:NetrwMarkHideSfx(islocal) " call Dfunc("s:NetrwMarkHideSfx(islocal=".a:islocal.")") let svpos = netrw#NetrwSavePosn() @@ -3999,27 +4034,24 @@ endfun " --------------------------------------------------------------------- " s:NetrwMarkFileMove: (invoked by mm) execute arbitrary command on marked files, one at a time {{{2 +" uses the global marked file list fun! s:NetrwMarkFileMove(islocal) " call Dfunc("s:NetrwMarkFileMove(islocal=".a:islocal.")") - let curbufnr= bufnr("%") - if exists("s:netrwmarkfilelist_{curbufnr}") - let svpos = netrw#NetrwSavePosn() - let curdir = b:netrw_curdir + if exists("s:netrwmarkfilelist") + let svpos = netrw#NetrwSavePosn() + let curbufnr = bufnr("%") + let curdir = b:netrw_curdir if exists("s:netrwmftgt") && exists("s:netrwmfloc") - for fname in s:netrwmarkfilelist_{curbufnr} -" call Decho("s:NetrwMarkFileMove: fname<".fname.">") - if a:islocal - if g:netrw_keepdir - let fname= s:ComposePath(curdir,fname) - endif - else - let fname= curdir.fname - endif - - if a:islocal && s:netrwmfloc + for fname in s:netrwmarkfilelist + let islocal= fname !~ '^\a\+://' +" call Decho("s:NetrwMarkFileMove: fname<".fname."> islocal=".islocal) + if islocal && s:netrwmfloc " local to local move + " s:netrwmfloc= 0: target directory is remote + " = 1: target directory is local +" call Decho("local to local move") if executable(g:netrw_localmovecmd) " call Decho("let ret= system(".g:netrw_localmovecmd." ".fname." ".s:netrwmftgt.")") let ret= system(g:netrw_localmovecmd." ".fname." ".s:netrwmftgt) @@ -4031,32 +4063,36 @@ fun! s:NetrwMarkFileMove(islocal) call netrw#ErrorMsg(s:ERROR,"command<".g:netrw_localmovecmd."> is not executable!",57) break endif - else - " copy file, then remove original + elseif !islocal && s:netrwmfloc " remote to local move +" call Decho("remote to local: copy and remove") +" call Decho("islocal =".islocal) +" call Decho("fname <".fname.">") +" call Decho("s:netrwmftgt<".s:netrwmftgt.">") + call netrw#NetrwObtain(islocal,fname,s:netrwmftgt) + let path = substitute(fname,'^\(.*/\)\(.\{-}\)$','\1','') + let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') + let ok= s:NetrwRemoteRmFile(path,barefname,1) + elseif !islocal && s:netrwmfloc " local to remote move +" call Decho("local to remote: copy and remove") + call s:NetrwUpload(fname,s:netrwmftgt) + let path = substitute(fname,'^\(.*/\)\(.\{-}\)$','\1','') + let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') + let ok = s:NetrwLocalRmFile(path,barefname,1) + else " remote to remote move - let netrwmflist = s:netrwmflist - let netrwmfmtch = s:netrwmfmtch - if s:NetrwMarkFileCopy(islocal) - let s:netrwmflist= netrwmflist - let s:netrwmfmtch= netrwmfmtch - if a:islocal - call s:NetrwLocalRm("---") - else - call s:NetrwRemoteRm("---","---") - endif - endif +" call Decho("remote to remote: copy and remove") + call s:NetrwUpload(fname,s:netrwmftgt) + let path = substitute(fname,'^\(.*/\)\(.\{-}\)$','\1','') + let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') + let ok = s:NetrwRemoteRmFile(path,barefname,1) endif endfor endif - " unmark marked file list - if exists("s:netrwmarkfilelist_{curbufnr}") - unlet s:netrwmarkfilelist_{curbufnr} - unlet s:netrwmarkfilemtch_{curbufnr} - 2match none - endif + " unmark marked file lists + call s:NetrwUnmarkAll() " refresh the listing and restore cursor position call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) @@ -4070,15 +4106,14 @@ endfun " --------------------------------------------------------------------- " s:NetrwMarkFilePrint: (invoked by mp) This function prints marked files {{{2 -" using the hardcopy command +" using the hardcopy command. Local marked-file list only. fun! s:NetrwMarkFilePrint(islocal) " call Dfunc("s:NetrwMarkFilePrint(islocal=".a:islocal.")") let curbufnr= bufnr("%") if exists("s:netrwmarkfilelist_{curbufnr}") let netrwmarkfilelist = s:netrwmarkfilelist_{curbufnr} let curdir = b:netrw_curdir - unlet s:netrwmarkfilelist_{curbufnr} - unlet s:netrwmarkfilemtch_{curbufnr} + call s:NetrwUnmarkList(curbufnr,curdir) for fname in netrwmarkfilelist if a:islocal if g:netrw_keepdir @@ -4113,7 +4148,7 @@ fun! s:NetrwMarkFileRegexp(islocal) if a:islocal " get the matching list of files using local glob() - let dirname = escape(b:netrw_curdir,s:netrw_glob_escape) + let dirname = escape(b:netrw_curdir,g:netrw_glob_escape) let filelist = glob(s:ComposePath(dirname,regexp)) if filelist != "" let filelist= filelist."\n" @@ -4172,14 +4207,14 @@ endfun " --------------------------------------------------------------------- " s:NetrwMarkFileSource: (invoked by ms) This function sources marked files {{{2 +" Uses the local marked file list. fun! s:NetrwMarkFileSource(islocal) " call Dfunc("s:NetrwMarkFileSource(islocal=".a:islocal.")") let curbufnr= bufnr("%") if exists("s:netrwmarkfilelist_{curbufnr}") let netrwmarkfilelist = s:netrwmarkfilelist_{bufnr("%")} let curdir = b:netrw_curdir - unlet s:netrwmarkfilelist_{curbufnr} - unlet s:netrwmarkfilemtch_{curbufnr} + call s:NetrwUnmarkList(curbufnr,curdir) for fname in netrwmarkfilelist if a:islocal if g:netrw_keepdir @@ -4197,28 +4232,27 @@ fun! s:NetrwMarkFileSource(islocal) endfun " --------------------------------------------------------------------- -" s:NetrwMarkFileTag: (invoked by mt) This function applies {{{2 -" g:netrw_ctags to marked files +" s:NetrwMarkFileTag: (invoked by mT) This function applies g:netrw_ctags to marked files {{{2 +" Uses the global markfilelist fun! s:NetrwMarkFileTag(islocal) " call Dfunc("s:NetrwMarkFileTag(islocal=".a:islocal.")") let svpos = netrw#NetrwSavePosn() let curdir = b:netrw_curdir let curbufnr = bufnr("%") - if exists("s:netrwmarkfilelist_{curbufnr}") -" call Decho("s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">") + if exists("s:netrwmarkfilelist") +" call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">") if a:islocal && g:netrw_keepdir let netrwmarkfilelist= "" - for fname in s:netrwmarkfilelist_{curbufnr} - let netrwmarkfilelist= netrwmarkfilelist." ".s:ComposePath(curdir,fname) + for fname in s:netrwmarkfilelist +" let netrwmarkfilelist= netrwmarkfilelist." ".s:ComposePath(curdir,fname) + let netrwmarkfilelist= netrwmarkfilelist." ".fname endfor else - let netrwmarkfilelist= string(s:netrwmarkfilelist_{curbufnr}) + let netrwmarkfilelist= string(s:netrwmarkfilelist) let netrwmarkfilelist= substitute(netrwmarkfilelist,'[[\],]','','g') endif - unlet s:netrwmarkfilelist_{curbufnr} - unlet s:netrwmarkfilemtch_{curbufnr} -" call Decho("netrwmarkfilelist<".netrwmarkfilelist.">") + call s:NetrwUnmarkAll() if a:islocal if executable(g:netrw_ctags) @@ -4303,6 +4337,58 @@ fun! s:NetrwMarkFileTgt(islocal) " call Dret("s:NetrwMarkFileTgt") endfun +" --------------------------------------------------------------------- +" s:NetrwUnmarkList: delete local marked file lists and remove their contents from the global marked-file list {{{2 +fun! s:NetrwUnmarkList(curbufnr,curdir) +" call Dfunc("s:NetrwUnmarkList(curbufnr=".a:curbufnr." curdir<".a:curdir.">)") + + " remove all files in local marked-file list from global list + for mfile in s:netrwmarkfilelist_{a:curbufnr} + let dfile = s:ComposePath(a:curdir,mfile) " prepend directory to mfile + let idx = index(s:netrwmarkfilelist,dfile) " get index in list of dfile + call remove(s:netrwmarkfilelist,idx) " remove from global list + endfor + if s:netrwmarkfilelist == [] + unlet s:netrwmarkfilelist + endif + + " getting rid of the local marked-file lists is easy + unlet s:netrwmarkfilelist_{a:curbufnr} + unlet s:netrwmarkfilemtch_{a:curbufnr} + 2match none +" call Dret("s:NetrwUnmarkList") +endfun + +" --------------------------------------------------------------------- +" s:NetrwUnmarkAll: remove the global marked file list and all local ones {{{2 +fun! s:NetrwUnmarkAll() +" call Dfunc("s:NetrwUnmarkAll()") + if exists("s:netrwmarkfilelist") + unlet s:netrwmarkfilelist + endif + silent call s:NetrwUnmarkAll2() + 2match none +" call Dret("s:NetrwUnmarkAll") +endfun + +" --------------------------------------------------------------------- +" s:NetrwUnmarkAll2: {{{2 +fun! s:NetrwUnmarkAll2() +" call Dfunc("s:NetrwUnmarkAll2()") + redir => netrwmarkfilelist_let + let + redir END + let netrwmarkfilelist_list= split(netrwmarkfilelist_let,'\n') " convert let string into a let list + call filter(netrwmarkfilelist_list,"v:val =~ '^s:netrwmarkfilelist_'") " retain only those vars that start as s:netrwmarkfilelist_ + call map(netrwmarkfilelist_list,"substitute(v:val,'\\s.*$','','')") " remove what the entries are equal to + for flist in netrwmarkfilelist_list + let curbufnr= substitute(flist,'s:netrwmarkfilelist_','','') + unlet s:netrwmarkfilelist_{curbufnr} + unlet s:netrwmarkfilemtch_{curbufnr} + endfor +" call Dret("s:NetrwUnmarkAll2") +endfun + " --------------------------------------------------------------------- " s:NetrwUnMarkFile: {{{2 fun! s:NetrwUnMarkFile(islocal) @@ -4314,6 +4400,7 @@ fun! s:NetrwUnMarkFile(islocal) " to do it, I'm just making sure) if exists("s:netrwmarkfilelist_{bufnr('%')}") " call Decho("unlet'ing: s:netrwmarkfile[list|mtch]_".bufnr("%")) + unlet s:netrwmarkfilelist unlet s:netrwmarkfilelist_{curbufnr} unlet s:netrwmarkfilemtch_{curbufnr} 2match none @@ -4415,11 +4502,17 @@ fun! s:NetrwObtain(islocal) if exists("s:netrwmarkfilelist_{bufnr('%')}") for fname in s:netrwmarkfilelist_{bufnr("%")} - call netrw#NetrwObtain(a:islocal,fname) + let islocal= fname !~ '^\a\+://' + call netrw#NetrwObtain(islocal,fname) endfor - unlet s:netrwmarkfilelist_{bufnr("%")} - unlet s:netrwmarkfilemtch_{bufnr("%")} - 2match none + call s:NetrwUnmarkList(bufnr('%'),b:netrw_curdir) + endif + if exists("s:netrwmarkfilelist") + for fname in s:netrwmarkfilelist + let islocal= fname !~ '^\a\+://' + call netrw#NetrwObtain(islocal,fname) + endfor + call s:NetrwUnmarkAll() else call netrw#NetrwObtain(a:islocal,expand("")) endif @@ -4436,6 +4529,7 @@ fun! netrw#NetrwObtain(islocal,fname,...) if a:islocal " obtain local file from getcwd() to b:netrw_curdir +" call Decho("obtain local file from ".getcwd()." to b:netrw_curdir<".b:netrw_curdir.">") if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir let fname= expand("") let fcopy= readfile(b:netrw_curdir."/".fname,"b") @@ -4449,19 +4543,20 @@ fun! netrw#NetrwObtain(islocal,fname,...) else " obtain a remote file to local directory (see tgtdir below) +" call Decho("obtain a remote file to local directory<".getcwd().">") call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.a:fname) " set up target directory (default is vim's idea of the current directory) if a:0 > 0 let tgtdir= a:1 else - let tgtdir= '.' + let tgtdir= getcwd() endif -" call Decho("tgtdir<".tgtdir.">") +" call Decho("obtain a remote file<".a:fname."> to tgtdir<".tgtdir.">") if exists("w:netrw_method") && w:netrw_method =~ '[235]' -" call Decho("method=".w:netrw_method) +" call Decho("method=".w:netrw_method) if executable("ftp") -" call Decho("ftp is executable, method=".w:netrw_method) +" call Decho("using ftp, method=".w:netrw_method) let curdir = b:netrw_curdir let path = substitute(curdir,'ftp://[^/]\+/','','e') let curline= line(".") @@ -4469,32 +4564,32 @@ fun! netrw#NetrwObtain(islocal,fname,...) setlocal ma noro " call Decho("setlocal ma noro") keepjumps $ -" call Decho("getcwd<".getcwd().">") -" call Decho("curdir<".curdir.">") -" call Decho("path<".path.">") -" call Decho("curline=".curline) -" call Decho("endline=".endline) +" call Decho("getcwd<".getcwd().">") +" call Decho("curdir<".curdir.">") +" call Decho("path<".path.">") +" call Decho("curline=".curline) +" call Decho("endline=".endline) "......................................... if w:netrw_method == 2 " ftp + <.netrc>: Method #2 setlocal ff=unix if path != "" - put ='lcd '.path -" call Decho("ftp: cd ".path) + put ='cd '.path +" call Decho("ftp: cd ".path) endif if tgtdir != '.' put ='lcd '.tgtdir endif put ='get '.a:fname -" call Decho("ftp: get ".a:fname) +" call Decho("ftp: get ".a:fname) put ='quit' -" call Decho("ftp: quit") +" call Decho("ftp: quit") if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("exe ".g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port) +" call Decho("exe ".g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port) exe g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine." ".g:netrw_port else -" call Decho("exe ".g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine) +" call Decho("exe ".g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine) exe g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i ".g:netrw_machine endif @@ -4507,78 +4602,91 @@ fun! netrw#NetrwObtain(islocal,fname,...) " call Decho('ftp: open '.g:netrw_machine.' '.g:netrw_port) else put ='open '.g:netrw_machine -" call Decho('ftp: open '.g:netrw_machine) +" call Decho('ftp: open '.g:netrw_machine) endif if exists("g:netrw_ftp") && g:netrw_ftp == 1 put =g:netrw_uid put ='\"'.s:netrw_passwd.'\"' -" call Decho('ftp: g:netrw_uid') -" call Decho('ftp: s:netrw_passwd') +" call Decho('ftp: g:netrw_uid') +" call Decho('ftp: s:netrw_passwd') else put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho('user '.g:netrw_uid.' '.s:netrw_passwd) +" call Decho('user '.g:netrw_uid.' '.s:netrw_passwd) endif if path != "" - put ='lcd '.path -" call Decho('lcd '.a:path) + put ='cd '.path +" call Decho('ftp: cd '.a:path) endif if tgtdir != '.' put ='lcd '.tgtdir +" call Decho('ftp: lcd '.tgtdir) endif put ='get '.a:fname -" call Decho("ftp: get ".a:fname) +" call Decho("ftp: get ".a:fname) put ='quit' -" call Decho("ftp: quit") +" call Decho("ftp: quit") - " perform ftp: - " -i : turns off interactive prompting from ftp - " -n unix : DON'T use <.netrc>, even though it exists - " -n win32: quit being obnoxious about password + " perform ftp: + " -i : turns off interactive prompting from ftp + " -n unix : DON'T use <.netrc>, even though it exists + " -n win32: quit being obnoxious about password " call Decho("exe ".g:netrw_silentxfer.curline.",$!".g:netrw_ftp_cmd." -i -n") - exe g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i -n" + exe g:netrw_silentxfer.endline.",$!".g:netrw_ftp_cmd." -i -n" - "......................................... - else - call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",28) - endif - " restore - exe "silent! ".endline.",$d" - exe "keepjumps ".curline - setlocal noma nomod ro + "......................................... else -" call Decho("ftp not executable") - if !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"this system doesn't support ftp",29) - endif - " restore status line - let &stl = s:netrw_users_stl - let &laststatus = s:netrw_users_ls - " restore NetrwMethod - if exists("keep_netrw_method") - call s:NetrwMethod(keep_netrw_choice) - let w:netrw_method = keep_netrw_wmethod - endif -" call Dret("NetrwObtain") - return + call netrw#ErrorMsg(s:WARNING,"unable to comply with your request<" . choice . ">",28) endif + " restore + exe "silent! ".endline.",$d" + exe "keepjumps ".curline + setlocal noma nomod ro + else +" call Decho("ftp not executable") + if !exists("g:netrw_quiet") + call netrw#ErrorMsg(s:ERROR,"this system doesn't support ftp",29) + endif + " restore status line + let &stl = s:netrw_users_stl + let &laststatus = s:netrw_users_ls + " restore NetrwMethod + if exists("keep_netrw_method") + call s:NetrwMethod(keep_netrw_choice) + let w:netrw_method = keep_netrw_wmethod + endif +" call Dret("NetrwObtain") + return + endif "......................................... else " scp: Method#4 -" call Decho("using scp") let curdir = b:netrw_curdir let path = substitute(curdir,'scp://[^/]\+/','','e') -" call Decho("path<".path.">") if exists("g:netrw_port") && g:netrw_port != "" let useport= " ".g:netrw_scpport." ".g:netrw_port else let useport= "" endif -" call Decho("pwd<".getcwd().">") -" call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".path.escape(a:fname,' ?&')." ".tgtdir) - exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".path.escape(a:fname,' ?&')." ".tgtdir + if a:fname =~ '^\a\+:' + let fname= substitute(a:fname,'^.*/','','') + else + let fname= a:fname + endif + if path !~ '/$' + let path= path.'/' + endif +" call Decho("using scp: curdir <".curdir.">") +" call Decho("using scp: fname <".fname.">") +" call Decho("using scp: machine<".g:netrw_machine.">") +" call Decho("using scp: path <".path.">") +" call Decho("using scp: pwd <".getcwd().">") +" call Decho("using scp: tgtdir <".tgtdir.">") +" call Decho("using scp: useport<".useport.">") +" call Decho("executing: !".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".path.escape(fname,' ?&')." ".tgtdir) + exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".g:netrw_machine.":".path.escape(fname,' ?&')." ".tgtdir endif " restore status line @@ -4704,19 +4812,23 @@ endfun " s:NetrwUpload: load fname to tgt (used by NetrwMarkFileCopy()) {{{2 " fname may itself be a remote or local file " tgt is assumed to be remote, so NetWrite will be used -" (indirectly an autocmd) +" (indirectly via an autocmd) fun! s:NetrwUpload(fname,tgt) " call Dfunc("s:NetrwUpload(fname<".a:fname."> tgt<".a:tgt.">)") 1split -" call Decho("exe e ".a:fname) - exe "e ".escape(a:fname,g:netrw_fname_escape) + let efname= escape(a:fname,g:netrw_fname_escape) +" call Decho("exe e ".efname) + exe "e ".efname if a:tgt =~ '/$' -" call Decho("exe w ".a:tgt.a:fname) - exe "w ".escape(a:tgt.a:fname,g:netrw_fname_escape) + let wfname= substitute(a:fname,'^.*/','','') + let wfname= escape(a:tgt.wfname,g:netrw_fname_escape) +" call Decho("exe w ".wfname) + exe "w ".wfname else -" call Decho("exe w ".a:tgt) - exe "w ".escape(a:tgt,g:netrw_fname_escape) + let wfname= escape(a:tgt,g:netrw_fname_escape) +" call Decho("exe w ".wfname) + exe "w ".wfname endif q! @@ -5409,7 +5521,7 @@ fun! s:SetupNetrwStatusLine(statline) let &stl=a:statline setlocal laststatus=2 " call Decho("stl=".&stl) -" redraw! + redraw " call Dret("SetupNetrwStatusLine : stl=".&stl) endfun @@ -5879,9 +5991,7 @@ fun! s:NetrwRemoteRename(usrhost,path) range endif endfor - 2match none - unlet s:netrwmarkfilelist_{bufnr("%")} - unlet s:netrwmarkfilemtch_{bufnr("%")} + call s:NetrwUnMarkFile(1) else @@ -5957,7 +6067,7 @@ fun! s:LocalListing() " if exists("g:netrw_sort_by")|call Decho('g:netrw_sort_by<'.g:netrw_sort_by.">")|else|call Decho("g:netrw_sort_by doesn't exist")|endif " get the list of files contained in the current directory - let dirname = escape(b:netrw_curdir,s:netrw_glob_escape) + let dirname = escape(b:netrw_curdir,g:netrw_glob_escape) let dirnamelen = s:Strlen(b:netrw_curdir) let filelist = glob(s:ComposePath(dirname,"*")) " call Decho("glob(dirname<".dirname."/*>)=".filelist) @@ -6102,8 +6212,12 @@ endfun " buffers to be refreshed after a user has executed some shell command, " on the chance that s/he removed/created a file/directory with it. fun! s:LocalBrowseShellCmdRefresh() -" call Dfunc("LocalBrowseShellCmdRefresh() browselist=".string(s:netrw_browselist)." ".tabpagenr("$")." tabs") +" call Dfunc("LocalBrowseShellCmdRefresh() browselist=".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "empty")." ".tabpagenr("$")." tabs") " determine which buffers currently reside in a tab + if !exists("s:netrw_browselist") +" call Dret("LocalBrowseShellCmdRefresh : browselist is empty") + return + endif let itab = 1 let buftablist = [] while itab <= tabpagenr("$") @@ -6112,7 +6226,7 @@ fun! s:LocalBrowseShellCmdRefresh() tabn endwhile " call Decho("buftablist".string(buftablist)) -" call Decho("s:netrw_browselist<".string(s:netrw_browselist).">") +" call Decho("s:netrw_browselist<".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "").">") " GO through all buffers on netrw_browselist (ie. just local-netrw buffers): " | refresh any netrw window " | wipe out any non-displaying netrw buffer @@ -6160,9 +6274,7 @@ fun! s:NetrwLocalRm(path) range let all= 1 endif endfor - unlet s:netrwmarkfilelist_{bufnr("%")} - unlet s:netrwmarkfilemtch_{bufnr("%")} - 2match none + call s:NetrwUnMarkFile(1) else " remove (multiple) files and directories @@ -6411,6 +6523,44 @@ endfun " --------------------------------------------------------------------- " Support Functions: {{{1 +" --------------------------------------------------------------------- +" s:UpdateBuffersMenu: does emenu Buffers.Refresh (but due to locale, the menu item may not be called that) {{{2 +" The Buffers.Refresh menu calls s:BMShow(); unfortunately, that means that that function +" can't be called except via emenu. But due to locale, that menu line may not be called +" 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' + try + silent emenu Buffers.Refresh\ menu + catch /^Vim\%((\a\+)\)\=:E/ + let v:errmsg= "" + silent call s:NetrwBMShow() + endtry + endif +" call Dret("s:UpdateBuffersMenu") +endfun + +" --------------------------------------------------------------------- +" s:NetrwBMShow: {{{2 +fun! s:NetrwBMShow() +" call Dfunc("s:NetrwBMShow()") + redir => bmshowraw + menu + redir END + let bmshowlist = split(bmshowraw,'\n') + if bmshowlist != [] + let bmshowfuncs= filter(bmshowlist,'v:val =~ "\\d\\+_BMShow()"') + if bmshowfuncs != [] + let bmshowfunc = substitute(bmshowfuncs[0],'^.*:\(call.*BMShow()\).*$','\1','') + if bmshowfunc =~ '^call.*BMShow()' + exe "silent! ".bmshowfunc + endif + endif + endif +" call Dret("s:NetrwBMShow : bmshowfunc<".bmshowfunc.">") +endfun + " --------------------------------------------------------------------- " s:ComposePath: Appends a new part to a path taking different systems into consideration {{{2 fun! s:ComposePath(base,subdir) diff --git a/vimfiles/autoload/netrwSettings.vim b/vimfiles/autoload/netrwSettings.vim index a2b7c11..40829a1 100644 --- a/vimfiles/autoload/netrwSettings.vim +++ b/vimfiles/autoload/netrwSettings.vim @@ -1,5 +1,5 @@ " netrwSettings.vim: makes netrw settings simpler -" Date: Jun 04, 2007 +" Date: Mar 11, 2008 " Maintainer: Charles E Campbell, Jr " Version: 11 " Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1 @@ -108,10 +108,14 @@ fun! netrwSettings#NetrwSettings() put ='let g:netrw_decompress...' put = 'let g:netrw_dirhistmax = '.g:netrw_dirhistmax put = 'let g:netrw_fastbrowse = '.g:netrw_fastbrowse + let fnameescline= line("$") + put = 'let g:netrw_fname_escape...' put = 'let g:netrw_ftp_browse_reject = '.g:netrw_ftp_browse_reject put = 'let g:netrw_ftp_list_cmd = '.g:netrw_ftp_list_cmd put = 'let g:netrw_ftp_sizelist_cmd = '.g:netrw_ftp_sizelist_cmd put = 'let g:netrw_ftp_timelist_cmd = '.g:netrw_ftp_timelist_cmd + let globescline= line("$") + put ='let g:netrw_glob_escape...' put = 'let g:netrw_hide = '.g:netrw_hide put = 'let g:netrw_keepdir = '.g:netrw_keepdir put = 'let g:netrw_list_cmd = '.g:netrw_list_cmd @@ -139,6 +143,8 @@ fun! netrwSettings#NetrwSettings() put = 'let g:netrw_scpport = '.g:netrw_scpport put = 'let g:netrw_sshport = '.g:netrw_sshport put = 'let g:netrw_timefmt = '.g:netrw_timefmt + let tmpfileescline= line("$") + put ='let g:netrw_tmpfile_escape...' put = 'let g:netrw_use_noswf = '.g:netrw_use_noswf put = 'let g:netrw_winsize = '.g:netrw_winsize @@ -155,12 +161,15 @@ fun! netrwSettings#NetrwSettings() " Put in g:netrw_shq setting and g:netrw_cd_escape " (deferred so as to avoid the quote manipulation just preceding) if g:netrw_shq == "'" - call setline(shqline,'let g:netrw_shq = "'.g:netrw_shq.'"') + call setline(shqline, 'let g:netrw_shq = "'.g:netrw_shq.'"') else - call setline(shqline,"let g:netrw_shq = '".g:netrw_shq."'") + call setline(shqline, "let g:netrw_shq = '".g:netrw_shq."'") endif - call setline(cdescline,"let g:netrw_cd_escape = ".'"'.escape(g:netrw_cd_escape,'\"').'"') + call setline(cdescline, "let g:netrw_cd_escape = ".'"'.escape(g:netrw_cd_escape,'\"').'"') call setline(decompressline,"let g:netrw_decompress = ".substitute(string(g:netrw_decompress),"^'\\(.*\\)'$",'\1','')) + call setline(fnameescline, "let g:netrw_fname_escape = '".escape(g:netrw_fname_escape,"'")."'") + call setline(globescline, "let g:netrw_glob_escape = '".escape(g:netrw_glob_escape,"'")."'") + call setline(tmpfileescline,"let g:netrw_tmpfile_escape = '".escape(g:netrw_tmpfile_escape,"'")."'") set nomod diff --git a/vimfiles/doc/cecutil.txt b/vimfiles/doc/cecutil.txt new file mode 100644 index 0000000..cf16ed1 --- /dev/null +++ b/vimfiles/doc/cecutil.txt @@ -0,0 +1,204 @@ +*cecutil.txt* DrChip's Utilities Sep 04, 2007 + +Author: Charles E. Campbell, Jr. + (remove NOSPAM from Campbell's email first) +Copyright: (c) 2004-2006 by Charles E. Campbell, Jr. *cecutil-copyright* + The VIM LICENSE applies to cecutil.vim and cecutil.txt + (see |copyright|) except use "cecutil" instead of "Vim" + No warranty, express or implied. Use At-Your-Own-Risk. + +============================================================================== +1. Contents *cecutil* *cecutil-contents* + + 1. Contents.................: |cecutil-contents| + 2. Positioning..............: |cecutil-posn| + 3. Marks....................: |cecutil-marks| + 4. Maps.....................: |cecutil-maps| + 5. History..................: |cecutil-history| + +============================================================================== +2. Positioning *cecutil-posn* *cecutil-position* + + let winposn= SaveWinPosn() *cecutil-savewinposn* + + This operation will save window position in winposn variable and + on a (buffer local) b:winposn{} stack. + + call SaveWinPosn() + + This function will save window position in b:winposn{b:iwinposn} + + let winposn= SaveWinPosn(0) + + This operation will _only_ save the window position in winposn variable. + Ie. the window position will not appear on the b:winposn{} stack. You + will then need to use RestoreWinPosn(winposn) to restore to this window + position. + + call RestoreWinPosn() *cecutil-restorewinposn* + + This function call will use the local buffer b:winposn{} stack to + restore the last window position saved therein. It will also + pop the stack. + + call RestoreWinPosn(winposn) + + This function call will use the winposn variable and restore + the window position accordingly. It will also search the + stack and remove any similar entry from the stack. + + *cecutil-map* *cecutil-cmd* *cecutil-swp* *cecutil-rwp* + \swp : save current window position (uses the b:winposn{} stack) + :SWP like \swp, but provided as a command + + \rwp : restore window position (uses the b:winposn{} stack) + :RWP like \rwp, but provided as a command + +============================================================================== +3. Marks *cecutil-marks* + + call SaveMark(markname) *cecutil-savemark* + let savemark= SaveMark(markname) + SM markname > + + ex. call SaveMark("a") + let savemarkb= SaveMark("b") + :SM a +< + This function saves a string in the global variable g:savemark_{markname} + which contains sufficient information to completely restore the position + of a mark. It also returns that string. + + call RestoreMark(markname) *cecutil-restoremark* + call RestoreMark(savemark) + + This function either takes a single-character string (ex. "a") and uses + g:savemark_{markname} to restore the mark position or assumes that + the string passed to it is a SaveMark() string (and uses it to restore + the mark). > + + ex. call RestoreMark("a") + call RestoreMark(savemarkb) + :RM a +< + + call DestroyMark(markname) *cecutil-destroymark* + + The DestroyMark() function completely removes a mark. It does this + by saving the window position, copying line one, putting the + to-be-destroyed mark on that new line, deleting the new line, and + then restoring the window position. The windows' modified status + is preserved. > + + ex. call DestroyMark("a") + :DM a +< + +============================================================================== +4.Maps *cecutil-maps* + *cecutil-saveusermaps* + call SaveUserMaps(mapmode,maplead,mapchx,suffix) + + This function sets up a script-variable (ie. a variable that can + generally be accessed only from within cecutil's own functions; + see |s:|) called s:restoremap. The selected user's maps are appended + to this variable; the RestoreUserMaps() (|cecutil-restoreusermaps|) + function uses the contents of this variable to restore user maps. + + mapmode - see :help maparg for its list (see |maparg()|) > + ex. "n" = Normal +< Will now accept an optional leading "u"; if present, + SaveUserMaps() will save and unmap (otherwise, it + will save only) + mapchx - "" handled as a single map item. > + ex. "" +< - "string" a string of single letters which are actually + multiple two-letter maps + maplead - the maps are assumed to have the form > + maplead . each_character_in_string +< ex. maplead="\" and mapchx="abc" saves mappings for > + \a, \b, and \c +< Of course, if maplead is "", then for mapchx="abc", + mappings for just a, b, and c are saved. + - :something handled as a single map item, w/o the ":" > + ex. mapchx= ":abc" +< will save the user mapping for "abc" + suffix - a string unique to your plugin > + ex. suffix= "DrawIt" +< + Some examples follow: > + + call SaveUserMaps("n","","webWEBjklh$0%;,nN","HiMtchBrkt") +< normal mode maps for w, e, b, W, E, B, j, k, l, etc + (if any) are all saved in the variable + s:restoremaps_HiMtchBrkt > + + call SaveUserMaps("n","","","DrawIt") +< the normal mode map (if any) for the key is saved in + the variable s:restoremaps_DrawIt > + + call SaveUserMaps("n","",":F(","HiMtchBrkt") +< the normal mode map for F( (if any) is saved in the + variable s:restoremaps_HiMtchBrkt + + call RestoreUserMaps(suffix) + + The usermaps saved by SaveUserMaps() with the given suffix will be + restored (ie. s:restoremaps_{suffix}). Example: > + + call RestoreUserMaps("HiMtchBrkt") +< will restore all user maps redefined for the HiMtchBrkt plugin + + +============================================================================== +5. History *cecutil-history* {{{1 + + v17 Sep 04, 2007 : * new function, QArgSplitter(), included + v16 Oct 30, 2006 : * com -> com! so AsNeeded is happier + Feb 12, 2007 * fixed a bug where :somemap (a map of "somemap") + did not use the optional mapleader (so it'd be + a map of "\somemap", if "\" is the mapleader). + (problem pointed out by Michael Zhang) + v15 Jan 25, 2006 : * bypass for report option for DestroyMark() included + * SaveWinPosn() and RestoreWinPosn() now handle an + empty buffer + * b:(varname) now use b:cecutil_(varname) + * map restoration improved + v14 Jan 23, 2006 : * bypasses for si, so, and siso options included + Jan 25, 2006 * SaveUserMaps' mapmode argument, heretofore just + a single letter (see |maparg()|), now accepts a + leading "u". If present, SaveUserMaps() will + do an unmap. + v13 Jan 12, 2006 : * SaveUserMaps() was saving user maps but then also + unmap'ing them. HiMtchBrkt needed to append a + function call to maps, not overwrite them. So + the new SaveUserMaps() just saves user maps, + leaving their definitions in place. + Jan 18, 2006 * keepjumps used to avoid jumplist changes when + using SaveWinPosn() and RestoreWinPosn() + v12 Dec 29, 2005 : * bugfix (affected Mines.vim) + v11 Dec 29, 2005 : * two new functions (SaveUserMaps() and + RestoreUserMaps() ) + v10 Nov 22, 2005 : * SaveWinPosn bugfix + v9 Jun 02, 2005 : * produces a "" argument when there are + no arguments, which caused difficulties. Fixed. + v8 Apr 22, 2005 : * used to handle marknames with commands + Thus, :DM a will delete mark a + v7 Mar 10, 2005 : * removed zO from saved window position; caused + problems with ftplugin/currfunc.vim + * doing a SWP and RWP on an empty buffer produced + "empty buffer" messages; now these are ignored + Apr 13, 2005 * command (SWP RWP MP SP etc) now have -bar so + that the "|" can be used to chain such commands + v6 Feb 17, 2005 : * improved SaveMark() and RestoreMark() + v5 Jan 18, 2005 : * s:loaded_winposn changed to g:loaded_cecutil + v4 Oct 25, 2004 : * changed com! to com so that error messages will + be given when there's a command-name conflict + v3 May 19, 2004 : * bugfix: the sequence \swp\rwp wasn't working right + * bugfix: \swp...\rwp was echoing the current + line when the \rwp should've been silent + * improved Dfunc/Decho/Dret debugging + + +============================================================================== +vim:tw=78:ts=8:ft=help:fdm=marker diff --git a/vimfiles/doc/pi_netrw.txt b/vimfiles/doc/pi_netrw.txt index 0e6ad1f..77a9b43 100644 --- a/vimfiles/doc/pi_netrw.txt +++ b/vimfiles/doc/pi_netrw.txt @@ -1,4 +1,4 @@ -*pi_netrw.txt* For Vim version 7.1. Last change: 2008 Feb 26 +*pi_netrw.txt* For Vim version 7.1. Last change: 2008 Mar 28 ----------------------------------------------------- NETRW REFERENCE MANUAL by Charles E. Campbell, Jr. @@ -141,6 +141,11 @@ You may do so by placing the following two lines in your <.vimrc>: > ============================================================================== 3. Netrw Reference *netrw-ref* {{{1 + Netrw supports several protocols in addition to scp and ftp mentioned + in |netrw-start|. These include dav, fetch, http,... well, just look + at the list in |netrw-externapp|. Each protocol is associated with a + variable which holds the default command supporting that protocol. + EXTERNAL APPLICATIONS AND PROTOCOLS *netrw-externapp* {{{2 Protocol Variable Default Value @@ -180,7 +185,7 @@ READING *netrw-read* *netrw-nread* {{{2 WRITING *netrw-write* *netrw-nwrite* {{{2 - Generally, one may just use the url notation with a normal file writing + One may just use the url notation with a normal file writing command, such as > :w ftp://[user@]machine/path @@ -201,8 +206,8 @@ WRITING *netrw-write* *netrw-nwrite* {{{2 SOURCING *netrw-source* {{{2 - Generally, one may just use the url notation with the normal file - sourcing command, such as > + One may just use the url notation with the normal file sourcing + command, such as > :so ftp://[user@]machine/path < @@ -220,12 +225,16 @@ SOURCING *netrw-source* {{{2 DIRECTORY LISTING *netrw-dirlist* {{{2 - Generally, one may browse a directory to get a listing by simply - attempting to edit the directory: > + One may browse a directory to get a listing by simply attempting to + edit the directory: > :e scp://[user]@hostname/path/ :e ftp://[user]@hostname/path/ < + For remote directories (ie. those using scp or ftp), that trailing + "/" is necessary (it tells netrw that its to treat it as a directory + to browse instead of a file to download). + However, the Nread command can also be used to accomplish this: :Nread [protocol]://[user]@hostname/path/ @@ -249,9 +258,14 @@ CHANGING USERID AND PASSWORD *netrw-chgup* *netrw-userpass* {{{2 :call NetUserPass("uid","password") -- sets global uid and password NETRW VARIABLES AND SETTINGS *netrw-variables* {{{2 - (also see: |netrw-browser-var| |netrw-protocol| |netrw-settings| |netrw-var|) +Netrw provides a lot of variables which allow you to customize netrw to your +preferences. One way to look at them is via the command :NetrwSettings (see +|netrw-settings|) which will display your current netrw settings. Most such +settings are described below, in |netrw-browser-options|, and in +|netrw-externapp|: + *b:netrw_lastfile* last file Network-read/written retained on a per-buffer basis (supports plain :Nw ) @@ -1144,7 +1158,7 @@ Associated setting variable: |g:netrw_browsex_viewer| *netrw-curdir* DELETING FILES OR DIRECTORIES *netrw-delete* *netrw-D* *netrw-del* {{{2 -If files have not been marked with |netrw-mf|: +If files have not been marked with |netrw-mf|: (local marked file list) Deleting/removing files and directories involves moving the cursor to the file/directory to be deleted and pressing "D". Directories must be empty @@ -1154,14 +1168,14 @@ If files have not been marked with |netrw-mf|: the removal(s). You may select a range of lines with the "V" command (visual selection), and then pressing "D". -If files have been marked with |netrw-mf|: +If files have been marked with |netrw-mf|: (local marked file list) Marked files (and empty directories) will be deleted; again, you'll be asked to confirm the deletion before it actually takes place. -The g:netrw_rm_cmd, g:netrw_rmf_cmd, and g:netrw_rmdir_cmd variables are used -to control the attempts to remove files and directories. The g:netrw_rm_cmd -is used with files, and its default value is: +The |g:netrw_rm_cmd|, |g:netrw_rmf_cmd|, and |g:netrw_rmdir_cmd| variables are +used to control the attempts to remove files and directories. The +g:netrw_rm_cmd is used with files, and its default value is: g:netrw_rm_cmd: ssh HOSTNAME rm @@ -1455,7 +1469,8 @@ Associated setting variable: |g:netrw_keepdir| MARKED FILES: ARBITRARY COMMAND *netrw-mx* {{{2 - (See |netrw-mf| and |netrw-mr| for how to mark files) + (See |netrw-mf| and |netrw-mr| for how to mark files) + (uses the local marked-file list) Upon activation of the "mx" map, netrw will query the user for some command to be applied to all marked files. All %s in the command will be substituted @@ -1464,7 +1479,8 @@ will be followed by a space and a marked filename. MARKED FILES: COMPRESSION AND DECOMPRESSION *netrw-mz* {{{2 - (See |netrw-mf| and |netrw-mr| for how to mark files) + (See |netrw-mf| and |netrw-mr| for how to mark files) + (uses the local marked file list) If any marked files are compressed, then "mz" will decompress them. If any marked files are decompressed, then "mz" will compress them @@ -1477,7 +1493,8 @@ associated decompressing utilities; see |g:netrw_decompress|. Associated setting variables: |g:netrw_compress| |g:netrw_decompress| MARKED FILES: COPYING *netrw-mc* {{{2 - (See |netrw-mf| and |netrw-mr| for how to mark files) + (See |netrw-mf| and |netrw-mr| for how to mark files) + (Uses the global marked file list) Select a target directory with mt (|netrw-mt|). Then change directory, select file(s) (see |netrw-mf|), and press "mc". @@ -1485,19 +1502,22 @@ select file(s) (see |netrw-mf|), and press "mc". Associated setting variable: |g:netrw_localcopycmd| |g:netrw_ssh_cmd| MARKED FILES: DIFF *netrw-md* {{{2 - (See |netrw-mf| and |netrw-mr| for how to mark files) + (See |netrw-mf| and |netrw-mr| for how to mark files) + (uses the global marked file list) Use |vimdiff| to visualize difference between selected files (two or -three may be selected for this). +three may be selected for this). Uses the global marked file list. MARKED FILES: EDITING *netrw-me* {{{2 - (See |netrw-mf| and |netrw-mr| for how to mark files) + (See |netrw-mf| and |netrw-mr| for how to mark files) + (uses the global marked file list) This command will place the marked files on the |arglist| and commence editing them. One may return the to explorer window with |:Rexplore|. MARKED FILES: HIDING AND UNHIDING BY SUFFIX *netrw-mh* {{{2 - (See |netrw-mf| and |netrw-mr| for how to mark files) + (See |netrw-mf| and |netrw-mr| for how to mark files) + (uses the local marked file list) This command extracts the suffices of the marked files and toggles their presence on the hiding list. Please note that marking the same suffix @@ -1508,7 +1528,8 @@ is the same as not having bothered to select them at all). Related topics: |netrw-a| |g:netrw_list_hide| MARKED FILES: MOVING *netrw-mm* {{{2 - (See |netrw-mf| and |netrw-mr| for how to mark files) + (See |netrw-mf| and |netrw-mr| for how to mark files) + (uses the global marked file list) Select a target directory with mT (|netrw-mt|). Then change directory, select file(s) (see |netrw-mf|), and press "mm". @@ -1516,7 +1537,8 @@ select file(s) (see |netrw-mf|), and press "mm". Associated setting variable: |g:netrw_localmovecmd| |g:netrw_ssh_cmd| MARKED FILES: PRINTING *netrw-mp* {{{2 - (See |netrw-mf| and |netrw-mr| for how to mark files) + (See |netrw-mf| and |netrw-mr| for how to mark files) + (uses the local marked file list) Netrw will apply the |:hardcopy| command to marked files. What it does is open each file in a one-line window, execute hardcopy, then close the @@ -1524,13 +1546,15 @@ one-line window. MARKED FILES: SOURCING *netrw-ms* {{{2 - (See |netrw-mf| and |netrw-mr| for how to mark files) + (See |netrw-mf| and |netrw-mr| for how to mark files) + (uses the local marked file list) Netrw will source the marked files (using vim's |:source| command) MARKED FILES: TAGGING *netrw-mT* {{{2 - (See |netrw-mf| and |netrw-mr| for how to mark files) + (See |netrw-mf| and |netrw-mr| for how to mark files) + (uses the global marked file list) The "mt" mapping will apply the command in |g:netrw_ctags| (by default, its "ctags") to marked files. For remote browsing, in order to create a tags file @@ -1585,16 +1609,32 @@ One may mark files with the cursor atop a filename and then pressing "mf". With gvim, one may also mark files with . The following netrw maps make use of marked files: - |netrw-a| |netrw-O| |netrw-mc| |netrw-me| |netrw-mp| |netrw-mx| - |netrw-D| |netrw-R| |netrw-md| |netrw-mm| |netrw-mT| |netrw-mz| + |netrw-a| Hide marked files/directories + |netrw-D| Delete marked files/directories + |netrw-mc| Copy marked files to target + |netrw-md| Apply vimdiff to marked files + |netrw-me| Edit marked files + |netrw-mm| Move marked files + |netrw-mp| Print marked files + |netrw-mt| Set target for |netrw-mm| and |netrw-mc| + |netrw-mT| Generate tags using marked files + |netrw-mx| Apply shell command to marked files + |netrw-mz| Compress/Decompress marked files + |netrw-O| Obtain marked files + |netrw-R| Rename marked files One may unmark files one at a time the same way one marks them; ie. place the cursor atop a marked file and press "mf". This process also works with using gvim. One may unmark all files by pressing "mu" (see |netrw-mu|). -Two commands, |netrw-mc| and |netrw-mm|, copy/move marked files to a -target directory (which can be set with |netrw-mt|). +*markfilelist* *global_markfilelist* *local_markfilelist* +All marked files are entered onto the global marked file list; there is only +one such list. In addition, every netrw buffer also has its own local marked +file list; since netrw buffers are associated with specific directories, this +means that each directory has its own local marked file list. The various +commands which operate on marked files use one or the other of the marked file +lists. MARKING FILES BY REGULAR EXPRESSION *netrw-mr* {{{2 @@ -1642,15 +1682,21 @@ your browsing preferences. (see also: |netrw-settings|) a script/function to handle the given extension. (see |netrw_filehandler|). + *g:netrw_cd_escape* ="[]#*$%'\" ?`!&();<>\\" + This option is used to escape directory names + before changing directory to them. + *g:netrw_compress* ="gzip" Will compress marked files with this command + *g:netrw_decompress* = { ".gz" : "gunzip" , ".bz2" : "bunzip2" , ".zip" : "unzip" , ".tar" : "tar -xf"} A dictionary mapping suffices to decompression programs. + *g:netrw_fastbrowse* =0: slow speed browsing, never re-use directory listings; always obtain directory listings. @@ -1671,6 +1717,9 @@ your browsing preferences. (see also: |netrw-settings|) This option gives the choice of the trade-off between accuracy and speed to the user. + *g:netrw_fname_escape* =' ?&;%' + Used on filenames before remote reading/writing + *g:netrw_ftp_browse_reject* ftp can produce a number of errors and warnings that can show up as "directories" and "files" in the listing. This pattern is used to @@ -1702,6 +1751,10 @@ your browsing preferences. (see also: |netrw-settings|) unix or g:netrw_cygwin set: : "ls -tlF" otherwise "dir" + *g:netrw_glob_escape* ='[]*?`{~$' + These characters in directory names are + escaped before applying glob() + *g:netrw_hide* if true, the hiding list is used default: =0 @@ -1814,13 +1867,10 @@ your browsing preferences. (see also: |netrw-settings|) messages. By default its value is: '^total\s\+\d\+$' - *g:netrw_use_noswf* netrw normally avoids writing swapfiles - for browser buffers. However, under some - systems this apparently is causing nasty - ml_get errors to appear; if you're getting - ml_get errors, try putting - let g:netrw_use_noswf= 0 - in your .vimrc. + + *g:netrw_tmpfile_escape* =' &;' + escape() is applied to all temporary files + to escape these characters. *g:netrw_timefmt* specify format string to vim's strftime(). The default, "%c", is "the preferred date @@ -1832,6 +1882,14 @@ your browsing preferences. (see also: |netrw-settings|) " %a %Y-%m-%d %I-%M-%S %p" default: "%c" + *g:netrw_use_noswf* netrw normally avoids writing swapfiles + for browser buffers. However, under some + systems this apparently is causing nasty + ml_get errors to appear; if you're getting + ml_get errors, try putting + let g:netrw_use_noswf= 0 + in your .vimrc. + *g:netrw_winsize* specify initial size of new windows made with "o" (see |netrw-o|), "v" (see |netrw-v|), |:Hexplore| or |:Vexplore|. @@ -2237,6 +2295,23 @@ which is loaded automatically at startup (assuming :set nocp). ============================================================================== 12. History *netrw-history* {{{1 + v123: Feb 27, 2008 * Marked files now keeps a "global" marked file + list. The global marked file list is used to + support tag processing and vimdiff'ing + (|netrw-md| |netrw-mt|) + * Been insuring that mm and mc works with various + combinations of local and remote directories + * (Stefan Bittner) http://.../ should always have + filetype "html" -- fixed. + * (Stefan Bittner) a "?" in a http://.../ request + wasn't being handled correctly. Fixed by + removing ? from default |g:netrw_tmpfile_escape|. + * (Nico Weber) % codes in http://.../ requests + weren't being handled correctly. Fixed by + including % in default |g:netrw_fname_escape|. + * (Stefan Bittner) attempts to update Buffers.Refresh + were failing because locale use changed the menu + names. I implemented a workaround. v122: Feb 12, 2008 * bugfix - first sorting sequence match now has priority Feb 14, 2008 * bugfix - sorting sequence was effectively ignoring diff --git a/vimfiles/doc/tags b/vimfiles/doc/tags index 5e0b1b7..a415bda 100644 --- a/vimfiles/doc/tags +++ b/vimfiles/doc/tags @@ -155,6 +155,25 @@ b:match_wholeBR matchit.txt /*b:match_wholeBR* b:match_word matchit.txt /*b:match_word* b:match_words matchit.txt /*b:match_words* b:netrw_lastfile pi_netrw.txt /*b:netrw_lastfile* +cecutil cecutil.txt /*cecutil* +cecutil-cmd cecutil.txt /*cecutil-cmd* +cecutil-contents cecutil.txt /*cecutil-contents* +cecutil-copyright cecutil.txt /*cecutil-copyright* +cecutil-destroymark cecutil.txt /*cecutil-destroymark* +cecutil-history cecutil.txt /*cecutil-history* +cecutil-map cecutil.txt /*cecutil-map* +cecutil-maps cecutil.txt /*cecutil-maps* +cecutil-marks cecutil.txt /*cecutil-marks* +cecutil-position cecutil.txt /*cecutil-position* +cecutil-posn cecutil.txt /*cecutil-posn* +cecutil-restoremark cecutil.txt /*cecutil-restoremark* +cecutil-restorewinposn cecutil.txt /*cecutil-restorewinposn* +cecutil-rwp cecutil.txt /*cecutil-rwp* +cecutil-savemark cecutil.txt /*cecutil-savemark* +cecutil-saveusermaps cecutil.txt /*cecutil-saveusermaps* +cecutil-savewinposn cecutil.txt /*cecutil-savewinposn* +cecutil-swp cecutil.txt /*cecutil-swp* +cecutil.txt cecutil.txt /*cecutil.txt* crefvim crefvim.txt /*crefvim* crefvim.txt crefvim.txt /*crefvim.txt* crefvimdoc crefvimdoc.txt /*crefvimdoc* @@ -1394,6 +1413,7 @@ g:netrw_alto pi_netrw.txt /*g:netrw_alto* g:netrw_altv pi_netrw.txt /*g:netrw_altv* g:netrw_browse_split pi_netrw.txt /*g:netrw_browse_split* g:netrw_browsex_viewer pi_netrw.txt /*g:netrw_browsex_viewer* +g:netrw_cd_escape pi_netrw.txt /*g:netrw_cd_escape* g:netrw_compress pi_netrw.txt /*g:netrw_compress* g:netrw_cygwin pi_netrw.txt /*g:netrw_cygwin* g:netrw_dav_cmd pi_netrw.txt /*g:netrw_dav_cmd* @@ -1401,6 +1421,7 @@ g:netrw_decompress pi_netrw.txt /*g:netrw_decompress* g:netrw_extracmd pi_netrw.txt /*g:netrw_extracmd* g:netrw_fastbrowse pi_netrw.txt /*g:netrw_fastbrowse* g:netrw_fetch_cmd pi_netrw.txt /*g:netrw_fetch_cmd* +g:netrw_fname_escape pi_netrw.txt /*g:netrw_fname_escape* g:netrw_ftp pi_netrw.txt /*g:netrw_ftp* g:netrw_ftp_browse_reject pi_netrw.txt /*g:netrw_ftp_browse_reject* g:netrw_ftp_cmd pi_netrw.txt /*g:netrw_ftp_cmd* @@ -1408,6 +1429,7 @@ g:netrw_ftp_list_cmd pi_netrw.txt /*g:netrw_ftp_list_cmd* g:netrw_ftp_sizelist_cmd pi_netrw.txt /*g:netrw_ftp_sizelist_cmd* g:netrw_ftp_timelist_cmd pi_netrw.txt /*g:netrw_ftp_timelist_cmd* g:netrw_ftpmode pi_netrw.txt /*g:netrw_ftpmode* +g:netrw_glob_escape pi_netrw.txt /*g:netrw_glob_escape* g:netrw_hide pi_netrw.txt /*g:netrw_hide* g:netrw_http_cmd pi_netrw.txt /*g:netrw_http_cmd* g:netrw_ignorenetrc pi_netrw.txt /*g:netrw_ignorenetrc* @@ -1443,6 +1465,7 @@ g:netrw_ssh_browse_reject pi_netrw.txt /*g:netrw_ssh_browse_reject* g:netrw_ssh_cmd pi_netrw.txt /*g:netrw_ssh_cmd* g:netrw_sshport pi_netrw.txt /*g:netrw_sshport* g:netrw_timefmt pi_netrw.txt /*g:netrw_timefmt* +g:netrw_tmpfile_escape pi_netrw.txt /*g:netrw_tmpfile_escape* g:netrw_uid pi_netrw.txt /*g:netrw_uid* g:netrw_use_errorwindow pi_netrw.txt /*g:netrw_use_errorwindow* g:netrw_use_noswf pi_netrw.txt /*g:netrw_use_noswf* @@ -1463,6 +1486,7 @@ getscript-data pi_getscript.txt /*getscript-data* getscript-history pi_getscript.txt /*getscript-history* getscript-plugins pi_getscript.txt /*getscript-plugins* getscript-start pi_getscript.txt /*getscript-start* +global_markfilelist pi_netrw.txt /*global_markfilelist* glvs pi_getscript.txt /*glvs* glvs-alg pi_getscript.txt /*glvs-alg* glvs-algorithm pi_getscript.txt /*glvs-algorithm* @@ -1477,6 +1501,7 @@ glvs-options pi_getscript.txt /*glvs-options* glvs-plugins pi_getscript.txt /*glvs-plugins* glvs-usage pi_getscript.txt /*glvs-usage* http pi_netrw.txt /*http* +local_markfilelist pi_netrw.txt /*local_markfilelist* logipat LogiPat.txt /*logipat* logipat-arg LogiPat.txt /*logipat-arg* logipat-caveat LogiPat.txt /*logipat-caveat* @@ -1489,6 +1514,7 @@ logipat-manual LogiPat.txt /*logipat-manual* logipat-operators LogiPat.txt /*logipat-operators* logipat-pattern LogiPat.txt /*logipat-pattern* logipat.txt LogiPat.txt /*logipat.txt* +markfilelist pi_netrw.txt /*markfilelist* matchit matchit.txt /*matchit* matchit-% matchit.txt /*matchit-%* matchit-\1 matchit.txt /*matchit-\\1* diff --git a/vimfiles/plugin/netrwPlugin.vim b/vimfiles/plugin/netrwPlugin.vim index 3020279..b221eb5 100644 --- a/vimfiles/plugin/netrwPlugin.vim +++ b/vimfiles/plugin/netrwPlugin.vim @@ -1,180 +1,180 @@ -" netrwPlugin.vim: Handles file transfer and remote directory listing across a network -" PLUGIN SECTION -" Date: Aug 09, 2007 -" Maintainer: Charles E Campbell, Jr -" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim -" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1 -" Permission is hereby granted to use and distribute this code, -" with or without modifications, provided that this copyright -" notice is copied with it. Like anything else that's free, -" netrw.vim, netrwPlugin.vim, and netrwSettings.vim are provided -" *as is* and comes with no warranty of any kind, either -" expressed or implied. By using this plugin, you agree that -" in no event will the copyright holder be liable for any damages -" resulting from the use of this software. -" -" 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 = "v116" -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 - finish -endif -let s:keepcpo= &cpo -set cpo&vim - -" --------------------------------------------------------------------- -" Public Interface: {{{1 - -" Local Browsing: {{{2 -augroup FileExplorer - au! - au BufEnter * silent! call s:LocalBrowse(expand("")) - if has("win32") || has("win95") || has("win64") || has("win16") - au BufEnter .* silent! call s:LocalBrowse(expand("")) - endif -augroup END - -" Network Browsing Reading Writing: {{{2 -augroup Network - au! - if has("win32") || has("win95") || has("win64") || has("win16") - au BufReadCmd file://* exe "silent doau BufReadPre ".netrw#RFC2396(expand(""))|exe 'e '.substitute(netrw#RFC2396(expand("")),'file://\(.*\)','\1',"")|exe "silent doau BufReadPost ".netrw#RFC2396(expand("")) - else - au BufReadCmd file://* exe "silent doau BufReadPre ".netrw#RFC2396(expand(""))|exe 'e '.substitute(netrw#RFC2396(expand("")),'file://\(.*\)','\1',"")|exe "silent doau BufReadPost ".netrw#RFC2396(expand("")) - au BufReadCmd file://localhost/* exe "silent doau BufReadPre ".netrw#RFC2396(expand(""))|exe 'e '.substitute(netrw#RFC2396(expand("")),'file://localhost/\(.*\)','\1',"")|exe "silent doau BufReadPost ".netrw#RFC2396(expand("")) - endif - au BufReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("")|exe '2Nread "'.expand("").'"'|exe "silent doau BufReadPost ".expand("") - au FileReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau FileReadPre ".expand("")|exe 'Nread "' .expand("").'"'|exe "silent doau FileReadPost ".expand("") - au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("")|exe 'Nwrite "' .expand("").'"'|exe "silent doau BufWritePost ".expand("") - au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau FileWritePre ".expand("")|exe "'[,']".'Nwrite "' .expand("").'"'|exe "silent doau FileWritePost ".expand("") - try - au SourceCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe 'Nsource "'.expand("").'"' - catch /^Vim\%((\a\+)\)\=:E216/ - au SourcePre ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe 'Nsource "'.expand("").'"' - endtry -augroup END - -" Commands: :Nread, :Nwrite, :NetUserPass {{{2 -com! -count=1 -nargs=* Nread call netrw#NetrwSavePosn()call netrw#NetRead(,)call netrw#NetrwRestorePosn() -com! -range=% -nargs=* Nwrite call netrw#NetrwSavePosn(),call netrw#NetWrite()call netrw#NetrwRestorePosn() -com! -nargs=* NetUserPass call NetUserPass() -com! -nargs=* Nsource call netrw#NetrwSavePosn()call netrw#NetSource()call netrw#NetrwRestorePosn() - -" Commands: :Explore, :Sexplore, Hexplore, Vexplore {{{2 -com! -nargs=* -bar -bang -count=0 -complete=dir Explore call netrw#Explore(,0,0+0,) -com! -nargs=* -bar -bang -count=0 -complete=dir Sexplore call netrw#Explore(,1,0+0,) -com! -nargs=* -bar -bang -count=0 -complete=dir Hexplore call netrw#Explore(,1,2+0,) -com! -nargs=* -bar -bang -count=0 -complete=dir Vexplore call netrw#Explore(,1,4+0,) -com! -nargs=* -bar -count=0 -complete=dir Texplore call netrw#Explore(,0,6 ,) -com! -nargs=* -bar -bang Nexplore call netrw#Explore(-1,0,0,) -com! -nargs=* -bar -bang Pexplore call netrw#Explore(-2,0,0,) - -" Commands: NetrwSettings {{{2 -com! -nargs=0 NetrwSettings call netrwSettings#NetrwSettings() -com! -bang NetrwClean call netrw#NetrwClean(0) - -" Maps: -if !exists("g:netrw_nogx") && maparg('g','n') == "" - if !hasmapto('NetrwBrowseX') - nmap gx NetrwBrowseX - endif - nno NetrwBrowseX :call netrw#NetBrowseX(expand(""),0) -endif - -" --------------------------------------------------------------------- -" LocalBrowse: {{{2 -fun! s:LocalBrowse(dirname) - " unfortunate interaction -- debugging calls can't be used here; - " the BufEnter event causes triggering when attempts to write to - " the DBG buffer are made. -" echomsg "dirname<".a:dirname.">" - if has("amiga") - " The check against '' is made for the Amiga, where the empty - " string is the current directory and not checking would break - " things such as the help command. - if a:dirname != '' && isdirectory(a:dirname) - silent! call netrw#LocalBrowseCheck(a:dirname) - endif - elseif isdirectory(a:dirname) -" echomsg "dirname<".dirname."> isdir" - silent! call netrw#LocalBrowseCheck(a:dirname) - endif - " not a directory, ignore it -endfun - -" --------------------------------------------------------------------- -" NetrwStatusLine: {{{1 -fun! NetrwStatusLine() -" let g:stlmsg= "Xbufnr=".w:netrw_explore_bufnr." bufnr=".bufnr("%")." Xline#".w:netrw_explore_line." line#".line(".") - if !exists("w:netrw_explore_bufnr") || w:netrw_explore_bufnr != bufnr("%") || !exists("w:netrw_explore_line") || w:netrw_explore_line != line(".") || !exists("w:netrw_explore_list") - let &stl= s:netrw_explore_stl - if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif - if exists("w:netrw_explore_line")|unlet w:netrw_explore_line|endif - return "" - else - return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen - endif -endfun - -" ------------------------------------------------------------------------ -" NetUserPass: set username and password for subsequent ftp transfer {{{1 -" Usage: :call NetUserPass() -- will prompt for userid and password -" :call NetUserPass("uid") -- will prompt for password -" :call NetUserPass("uid","password") -- sets global userid and password -fun! NetUserPass(...) - - " get/set userid - if a:0 == 0 -" call Dfunc("NetUserPass(a:0<".a:0.">)") - if !exists("g:netrw_uid") || g:netrw_uid == "" - " via prompt - let g:netrw_uid= input('Enter username: ') - endif - else " from command line -" call Dfunc("NetUserPass(a:1<".a:1.">) {") - let g:netrw_uid= a:1 - endif - - " get password - if a:0 <= 1 " via prompt -" call Decho("a:0=".a:0." case <=1:") - let g:netrw_passwd= inputsecret("Enter Password: ") - else " from command line -" call Decho("a:0=".a:0." case >1: a:2<".a:2.">") - let g:netrw_passwd=a:2 - endif -" call Dret("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 -" vim:ts=8 fdm=marker +" netrwPlugin.vim: Handles file transfer and remote directory listing across a network +" PLUGIN SECTION +" Date: Aug 09, 2007 +" Maintainer: Charles E Campbell, Jr +" GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim +" Copyright: Copyright (C) 1999-2005 Charles E. Campbell, Jr. {{{1 +" Permission is hereby granted to use and distribute this code, +" with or without modifications, provided that this copyright +" notice is copied with it. Like anything else that's free, +" netrw.vim, netrwPlugin.vim, and netrwSettings.vim are provided +" *as is* and comes with no warranty of any kind, either +" expressed or implied. By using this plugin, you agree that +" in no event will the copyright holder be liable for any damages +" resulting from the use of this software. +" +" 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 = "v123" +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 + finish +endif +let s:keepcpo= &cpo +set cpo&vim + +" --------------------------------------------------------------------- +" Public Interface: {{{1 + +" Local Browsing: {{{2 +augroup FileExplorer + au! + au BufEnter * silent! call s:LocalBrowse(expand("")) + if has("win32") || has("win95") || has("win64") || has("win16") + au BufEnter .* silent! call s:LocalBrowse(expand("")) + endif +augroup END + +" Network Browsing Reading Writing: {{{2 +augroup Network + au! + if has("win32") || has("win95") || has("win64") || has("win16") + au BufReadCmd file://* exe "silent doau BufReadPre ".netrw#RFC2396(expand(""))|exe 'e '.substitute(netrw#RFC2396(expand("")),'file://\(.*\)','\1',"")|exe "bwipe ".expand("")|exe "silent doau BufReadPost ".netrw#RFC2396(expand("")) + else + au BufReadCmd file://* exe "silent doau BufReadPre ".netrw#RFC2396(expand(""))|exe 'e '.substitute(netrw#RFC2396(expand("")),'file://\(.*\)','\1',"")|exe "bwipe ".expand("")|exe "silent doau BufReadPost ".netrw#RFC2396(expand("")) + au BufReadCmd file://localhost/* exe "silent doau BufReadPre ".netrw#RFC2396(expand(""))|exe 'e '.substitute(netrw#RFC2396(expand("")),'file://localhost/\(.*\)','\1',"")|exe "bwipe ".substitute(expand(""),'file://\(\k\+@\)\=','','')|exe "silent doau BufReadPost ".netrw#RFC2396(expand("")) + endif + au BufReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau BufReadPre ".expand("")|exe '2Nread "'.expand("").'"'|exe "silent doau BufReadPost ".expand("") + au FileReadCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe "silent doau FileReadPre ".expand("")|exe 'Nread "' .expand("").'"'|exe "silent doau FileReadPost ".expand("") + au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau BufWritePre ".expand("")|exe 'Nwrite "' .expand("").'"'|exe "silent doau BufWritePost ".expand("") + au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,rsync://*,sftp://* exe "silent doau FileWritePre ".expand("")|exe "'[,']".'Nwrite "' .expand("").'"'|exe "silent doau FileWritePost ".expand("") + try + au SourceCmd ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe 'Nsource "'.expand("").'"' + catch /^Vim\%((\a\+)\)\=:E216/ + au SourcePre ftp://*,rcp://*,scp://*,http://*,dav://*,rsync://*,sftp://* exe 'Nsource "'.expand("").'"' + endtry +augroup END + +" Commands: :Nread, :Nwrite, :NetUserPass {{{2 +com! -count=1 -nargs=* Nread call netrw#NetrwSavePosn()call netrw#NetRead(,)call netrw#NetrwRestorePosn() +com! -range=% -nargs=* Nwrite call netrw#NetrwSavePosn(),call netrw#NetWrite()call netrw#NetrwRestorePosn() +com! -nargs=* NetUserPass call NetUserPass() +com! -nargs=* Nsource call netrw#NetrwSavePosn()call netrw#NetSource()call netrw#NetrwRestorePosn() + +" Commands: :Explore, :Sexplore, Hexplore, Vexplore {{{2 +com! -nargs=* -bar -bang -count=0 -complete=dir Explore call netrw#Explore(,0,0+0,) +com! -nargs=* -bar -bang -count=0 -complete=dir Sexplore call netrw#Explore(,1,0+0,) +com! -nargs=* -bar -bang -count=0 -complete=dir Hexplore call netrw#Explore(,1,2+0,) +com! -nargs=* -bar -bang -count=0 -complete=dir Vexplore call netrw#Explore(,1,4+0,) +com! -nargs=* -bar -count=0 -complete=dir Texplore call netrw#Explore(,0,6 ,) +com! -nargs=* -bar -bang Nexplore call netrw#Explore(-1,0,0,) +com! -nargs=* -bar -bang Pexplore call netrw#Explore(-2,0,0,) + +" Commands: NetrwSettings {{{2 +com! -nargs=0 NetrwSettings call netrwSettings#NetrwSettings() +com! -bang NetrwClean call netrw#NetrwClean(0) + +" Maps: +if !exists("g:netrw_nogx") && maparg('g','n') == "" + if !hasmapto('NetrwBrowseX') + nmap gx NetrwBrowseX + endif + nno NetrwBrowseX :call netrw#NetBrowseX(expand(""),0) +endif + +" --------------------------------------------------------------------- +" LocalBrowse: {{{2 +fun! s:LocalBrowse(dirname) + " unfortunate interaction -- debugging calls can't be used here; + " the BufEnter event causes triggering when attempts to write to + " the DBG buffer are made. +" echomsg "dirname<".a:dirname.">" + if has("amiga") + " The check against '' is made for the Amiga, where the empty + " string is the current directory and not checking would break + " things such as the help command. + if a:dirname != '' && isdirectory(a:dirname) + silent! call netrw#LocalBrowseCheck(a:dirname) + endif + elseif isdirectory(a:dirname) +" echomsg "dirname<".dirname."> isdir" + silent! call netrw#LocalBrowseCheck(a:dirname) + endif + " not a directory, ignore it +endfun + +" --------------------------------------------------------------------- +" NetrwStatusLine: {{{1 +fun! NetrwStatusLine() +" let g:stlmsg= "Xbufnr=".w:netrw_explore_bufnr." bufnr=".bufnr("%")." Xline#".w:netrw_explore_line." line#".line(".") + if !exists("w:netrw_explore_bufnr") || w:netrw_explore_bufnr != bufnr("%") || !exists("w:netrw_explore_line") || w:netrw_explore_line != line(".") || !exists("w:netrw_explore_list") + let &stl= s:netrw_explore_stl + if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif + if exists("w:netrw_explore_line")|unlet w:netrw_explore_line|endif + return "" + else + return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen + endif +endfun + +" ------------------------------------------------------------------------ +" NetUserPass: set username and password for subsequent ftp transfer {{{1 +" Usage: :call NetUserPass() -- will prompt for userid and password +" :call NetUserPass("uid") -- will prompt for password +" :call NetUserPass("uid","password") -- sets global userid and password +fun! NetUserPass(...) + + " get/set userid + if a:0 == 0 +" call Dfunc("NetUserPass(a:0<".a:0.">)") + if !exists("g:netrw_uid") || g:netrw_uid == "" + " via prompt + let g:netrw_uid= input('Enter username: ') + endif + else " from command line +" call Dfunc("NetUserPass(a:1<".a:1.">) {") + let g:netrw_uid= a:1 + endif + + " get password + if a:0 <= 1 " via prompt +" call Decho("a:0=".a:0." case <=1:") + let g:netrw_passwd= inputsecret("Enter Password: ") + else " from command line +" call Decho("a:0=".a:0." case >1: a:2<".a:2.">") + let g:netrw_passwd=a:2 + endif +" call Dret("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 +" vim:ts=8 fdm=marker diff --git a/vimfiles/syntax/netrw.vim b/vimfiles/syntax/netrw.vim index 6947bb8..5e43293 100644 --- a/vimfiles/syntax/netrw.vim +++ b/vimfiles/syntax/netrw.vim @@ -50,17 +50,17 @@ syn match netrwVersion "(netrw.*)" contained " Special filetype highlighting {{{1 " ----------------------------- if exists("g:netrw_special_syntax") && netrw_special_syntax - syn match netrwBak "\(\S\+ \)*\S\+\.bak\>" - syn match netrwCompress "\(\S\+ \)*\S\+\.\%(gz\|bz2\|Z\|zip\)\>" - syn match netrwData "\(\S\+ \)*\S\+\.dat\>" - syn match netrwHdr "\(\S\+ \)*\S\+\.h\>" - syn match netrwLib "\(\S\+ \)*\S*\.\%(a\|so\|lib\|dll\)\>" - syn match netrwMakeFile "\<[mM]akefile\>\|\(\S\+ \)*\S\+\.mak\>" - syn match netrwObj "\(\S\+ \)*\S*\.\%(o\|obj\)\>" - syn match netrwTags "\" - syn match netrwTags "\<\(ANmenu\|ANtags\)\>" - syn match netrwTilde "\(\S\+ \)*\S\+\~\>" - syn match netrwTmp "\\|\(\S\+ \)*\S*tmp\>" + syn match netrwBak "\(\S\+ \)*\S\+\.bak\>" contains=netrwTreeBar + syn match netrwCompress "\(\S\+ \)*\S\+\.\%(gz\|bz2\|Z\|zip\)\>" contains=netrwTreeBar + syn match netrwData "\(\S\+ \)*\S\+\.dat\>" contains=netrwTreeBar + syn match netrwHdr "\(\S\+ \)*\S\+\.h\>" contains=netrwTreeBar + syn match netrwLib "\(\S\+ \)*\S*\.\%(a\|so\|lib\|dll\)\>" contains=netrwTreeBar + syn match netrwMakeFile "\<[mM]akefile\>\|\(\S\+ \)*\S\+\.mak\>" contains=netrwTreeBar + syn match netrwObj "\(\S\+ \)*\S*\.\%(o\|obj\)\>" contains=netrwTreeBar + syn match netrwTags "\" contains=netrwTreeBar + syn match netrwTags "\<\(ANmenu\|ANtags\)\>" contains=netrwTreeBar + syn match netrwTilde "\(\S\+ \)*\S\+\~\>" contains=netrwTreeBar + syn match netrwTmp "\\|\(\S\+ \)*\S*tmp\>" contains=netrwTreeBar endif " ---------------------------------------------------------------------