# HG changeset patch # User Christian Brabandt # Date 1446212704 -3600 # Node ID ffad29dc7eee9a2aeb7299b4e9d72fc36f9a4023 # Parent c6a1a1ea7c19ff6db7e94cfb21889dd38262b509 commit https://github.com/vim/vim/commit/a0f849ee40cbea3c889345256786b640b0becca2 Author: Bram Moolenaar Date: Fri Oct 30 14:37:44 2015 +0100 Update runtime files. diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -1,10 +1,10 @@ " netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION -" Date: Jan 05, 2015 -" Version: 153 +" Date: Oct 23, 2015 +" Version: 154 " Maintainer: Charles E Campbell " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim -" Copyright: Copyright (C) 1999-2013 Charles E. Campbell {{{1 +" Copyright: Copyright (C) 1999-2015 Charles E. Campbell {{{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, @@ -13,7 +13,7 @@ " 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. -"redraw!|call DechoSep()|call inputsave()|call input("Press to continue")|call inputrestore() +"redraw!|call DechoSep()|call inputsave()|call input("Press to continue")|call inputrestore(,'~'.expand("")) " " But be doers of the Word, and not only hearers, deluding your own selves {{{1 " (James 1:22 RSV) @@ -22,14 +22,15 @@ if &cp || exists("g:loaded_netrw") finish endif +" netrw requires vim having patch 213; netrw will benefit from vim's having patch#656, too if v:version < 704 || !has("patch213") if !exists("s:needpatch213") - echo "***sorry*** this version of netrw requires vim v7.4 with patch 213" + unsilent echomsg "***sorry*** this version of netrw requires vim v7.4 with patch 213" endif let s:needpatch213= 1 finish endif -let g:loaded_netrw = "v153" +let g:loaded_netrw = "v154" if !exists("s:NOTE") let s:NOTE = 0 let s:WARNING = 1 @@ -38,9 +39,9 @@ endif let s:keepcpo= &cpo setl cpo&vim -"let g:dechofuncname=1 +"let g:dechofuncname= 1 "DechoRemOn -"call Decho("doing autoload/netrw.vim version ".g:loaded_netrw) +"call Decho("doing autoload/netrw.vim version ".g:loaded_netrw,'~'.expand("")) " ====================== " Netrw Variables: {{{1 @@ -54,7 +55,7 @@ setl cpo&vim " Usage: netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,"some message",error-number) " netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,["message1","message2",...],error-number) " (this function can optionally take a list of messages) -" May 15, 2014 : max errnum currently is 98 +" Oct 09, 2015 : max errnum currently is 102 fun! netrw#ErrorMsg(level,msg,errnum) " call Dfunc("netrw#ErrorMsg(level=".a:level." msg<".a:msg."> errnum=".a:errnum.") g:netrw_use_errorwindow=".g:netrw_use_errorwindow) @@ -70,7 +71,7 @@ fun! netrw#ErrorMsg(level,msg,errnum) else let level= "**note** (netrw) " endif -" call Decho("level=".level) +" call Decho("level=".level,'~'.expand("")) if g:netrw_use_errorwindow " (default) netrw creates a one-line window to show error/warning @@ -78,14 +79,14 @@ fun! netrw#ErrorMsg(level,msg,errnum) " record current window number for NetrwRestorePosn()'s benefit let s:winBeforeErr= winnr() -" call Decho("s:winBeforeErr=".s:winBeforeErr) +" call Decho("s:winBeforeErr=".s:winBeforeErr,'~'.expand("")) " getting messages out reliably is just plain difficult! " This attempt splits the current window, creating a one line window. if bufexists("NetrwMessage") && bufwinnr("NetrwMessage") > 0 -" call Decho("write to NetrwMessage buffer") +" call Decho("write to NetrwMessage buffer",'~'.expand("")) exe bufwinnr("NetrwMessage")."wincmd w" -" call Decho("setl ma noro") +" call Decho("setl ma noro",'~'.expand("")) setl ma noro if type(a:msg) == 3 for msg in a:msg @@ -96,13 +97,13 @@ fun! netrw#ErrorMsg(level,msg,errnum) endif NetrwKeepj $ else -" call Decho("create a NetrwMessage buffer window") +" call Decho("create a NetrwMessage buffer window",'~'.expand("")) bo 1split sil! call s:NetrwEnew() sil! NetrwKeepj call s:NetrwSafeOptions() setl bt=nofile NetrwKeepj file NetrwMessage -" call Decho("setl ma noro") +" call Decho("setl ma noro",'~'.expand("")) setl ma noro if type(a:msg) == 3 for msg in a:msg @@ -113,7 +114,7 @@ fun! netrw#ErrorMsg(level,msg,errnum) endif NetrwKeepj $ endif -" call Decho("wrote msg<".level.a:msg."> to NetrwMessage win#".winnr()) +" call Decho("wrote msg<".level.a:msg."> to NetrwMessage win#".winnr(),'~'.expand("")) if &fo !~ '[ta]' syn clear syn match netrwMesgNote "^\*\*note\*\*" @@ -122,7 +123,7 @@ fun! netrw#ErrorMsg(level,msg,errnum) hi link netrwMesgWarning WarningMsg hi link netrwMesgError Error endif -" call Decho("setl noma ro bh=wipe") +" call Decho("setl noma ro bh=wipe",'~'.expand("")) setl ro nomod noma bh=wipe else @@ -137,13 +138,13 @@ fun! netrw#ErrorMsg(level,msg,errnum) if type(a:msg) == 3 for msg in a:msg - echomsg level.msg + unsilent echomsg level.msg endfor else - echomsg level.a:msg - endif - -" call Decho("echomsg ***netrw*** ".a:msg) + unsilent echomsg level.a:msg + endif + +" call Decho("echomsg ***netrw*** ".a:msg,'~'.expand("")) echohl None endif @@ -154,7 +155,7 @@ endfun " s:NetrwInit: initializes variables if they haven't been defined {{{2 " Loosely, varname = value. fun s:NetrwInit(varname,value) -" call Decho("varname<".a:varname."> value=".a:value) +" call Decho("varname<".a:varname."> value=".a:value,'~'.expand("")) if !exists(a:varname) if type(a:value) == 0 exe "let ".a:varname."=".a:value @@ -345,7 +346,7 @@ if !exists("g:netrw_list_cmd") let g:netrw_list_cmd= g:netrw_ssh_cmd." USEPORT HOSTNAME ls -FLa" endif else -" call Decho(g:netrw_ssh_cmd." is not executable") +" call Decho(g:netrw_ssh_cmd." is not executable",'~'.expand("")) let g:netrw_list_cmd= "" endif endif @@ -504,6 +505,7 @@ endif call s:NetrwInit("g:NetrwTopLvlMenu","Netrw.") call s:NetrwInit("g:netrw_win95ftp",1) call s:NetrwInit("g:netrw_winsize",50) +call s:NetrwInit("g:netrw_wiw",1) if g:netrw_winsize > 100|let g:netrw_winsize= 100|endif " --------------------------------------------------------------------- " Default values for netrw's script variables: {{{2 @@ -531,18 +533,18 @@ endif " Netrw Initialization: {{{1 " ====================== if v:version >= 700 && has("balloon_eval") && !exists("s:initbeval") && !exists("g:netrw_nobeval") && has("syntax") && exists("g:syntax_on") -" call Decho("installed beval events") +" call Decho("installed beval events",'~'.expand("")) let &l:bexpr = "netrw#BalloonHelp()" au FileType netrw setl beval au WinLeave * if &ft == "netrw" && exists("s:initbeval")|let &beval= s:initbeval|endif au VimEnter * let s:initbeval= &beval "else " Decho -" if v:version < 700 | call Decho("did not install beval events: v:version=".v:version." < 700") | endif -" if !has("balloon_eval") | call Decho("did not install beval events: does not have balloon_eval") | endif -" if exists("s:initbeval") | call Decho("did not install beval events: s:initbeval exists") | endif -" if exists("g:netrw_nobeval") | call Decho("did not install beval events: g:netrw_nobeval exists") | endif -" if !has("syntax") | call Decho("did not install beval events: does not have syntax highlighting") | endif -" if exists("g:syntax_on") | call Decho("did not install beval events: g:syntax_on exists") | endif +" if v:version < 700 | call Decho("did not install beval events: v:version=".v:version." < 700","~".expand("")) | endif +" if !has("balloon_eval") | call Decho("did not install beval events: does not have balloon_eval","~".expand("")) | endif +" if exists("s:initbeval") | call Decho("did not install beval events: s:initbeval exists","~".expand("")) | endif +" if exists("g:netrw_nobeval") | call Decho("did not install beval events: g:netrw_nobeval exists","~".expand("")) | endif +" if !has("syntax") | call Decho("did not install beval events: does not have syntax highlighting","~".expand("")) | endif +" if exists("g:syntax_on") | call Decho("did not install beval events: g:syntax_on exists","~".expand("")) | endif endif au WinEnter * if &ft == "netrw"|call s:NetrwInsureWinVars()|endif @@ -560,7 +562,7 @@ endif " --------------------------------------------------------------------- " netrw#BalloonHelp: {{{2 if v:version >= 700 && has("balloon_eval") && has("syntax") && exists("g:syntax_on") && !exists("g:netrw_nobeval") -" call Decho("loading netrw#BalloonHelp()") +" call Decho("loading netrw#BalloonHelp()",'~'.expand("")) fun! netrw#BalloonHelp() if &ft != "netrw" return "" @@ -572,7 +574,7 @@ if v:version >= 700 && has("balloon_eval elseif getline(v:beval_lnum) =~ '^"\s*/' let mesg = ": edit/enter o: edit/enter in horiz window t: edit/enter in new tab v:edit/enter in vert window" elseif v:beval_text == "Sorted" || v:beval_text == "by" - let mesg = 's: sort by name, time, or file size r: reverse sorting order mt: mark target' + let mesg = 's: sort by name, time, file size, extension r: reverse sorting order mt: mark target' elseif v:beval_text == "Sort" || v:beval_text == "sequence" let mesg = "S: edit sorting sequence" elseif v:beval_text == "Hiding" || v:beval_text == "Showing" @@ -587,11 +589,11 @@ if v:version >= 700 && has("balloon_eval return mesg endfun "else " Decho -" if v:version < 700 |call Decho("did not load netrw#BalloonHelp(): vim version ".v:version." < 700 -")|endif -" if !has("balloon_eval") |call Decho("did not load netrw#BalloonHelp(): does not have balloon eval") |endif -" if !has("syntax") |call Decho("did not load netrw#BalloonHelp(): syntax disabled") |endif -" if !exists("g:syntax_on") |call Decho("did not load netrw#BalloonHelp(): g:syntax_on n/a") |endif -" if exists("g:netrw_nobeval") |call Decho("did not load netrw#BalloonHelp(): g:netrw_nobeval exists") |endif +" if v:version < 700 |call Decho("did not load netrw#BalloonHelp(): vim version ".v:version." < 700 -","~".expand(""))|endif +" if !has("balloon_eval") |call Decho("did not load netrw#BalloonHelp(): does not have balloon eval","~".expand("")) |endif +" if !has("syntax") |call Decho("did not load netrw#BalloonHelp(): syntax disabled","~".expand("")) |endif +" if !exists("g:syntax_on") |call Decho("did not load netrw#BalloonHelp(): g:syntax_on n/a","~".expand("")) |endif +" if exists("g:netrw_nobeval") |call Decho("did not load netrw#BalloonHelp(): g:netrw_nobeval exists","~".expand("")) |endif endif " ------------------------------------------------------------------------ @@ -613,9 +615,10 @@ endif " == 6: Texplore fun! netrw#Explore(indx,dosplit,style,...) " call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." modifiable=".&modifiable." a:0=".a:0." win#".winnr()." buf#".bufnr("%")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) if !exists("b:netrw_curdir") let b:netrw_curdir= getcwd() -" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)") +" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)",'~'.expand("")) endif " record current file for Rexplore's benefit @@ -629,23 +632,24 @@ fun! netrw#Explore(indx,dosplit,style,.. if !exists("g:netrw_cygwin") && (has("win32") || has("win95") || has("win64") || has("win16")) let curdir= substitute(curdir,'\','/','g') endif -" call Decho("curdir<".curdir."> curfiledir<".curfiledir.">") +" call Decho("curdir<".curdir."> curfiledir<".curfiledir.">",'~'.expand("")) " using completion, directories with spaces in their names (thanks, Bill Gates, for a truly dumb idea) " will end up with backslashes here. Solution: strip off backslashes that precede white space and " try Explore again. if a:0 > 0 " call Decho('considering retry: a:1<'.a:1.'>: '. - \ ((a:1 =~ "\\\s")? 'has backslash whitespace' : 'does not have backslash whitespace').', '. - \ ((filereadable(a:1))? 'is readable' : 'is not readable').', '. - \ ((isdirectory(a:1))? 'is a directory' : 'is not a directory')) - if a:1 =~ "\\\s" && !filereadable(a:1) && !isdirectory(a:1) -" call Decho("re-trying Explore with <".substitute(a:1,'\\\(\s\)','\1','g').">") + \ ((a:1 =~ "\\\s")? 'has backslash whitespace' : 'does not have backslash whitespace').', '. + \ ((filereadable(s:NetrwFile(a:1)))? 'is readable' : 'is not readable').', '. + \ ((isdirectory(s:NetrwFile(a:1))))? 'is a directory' : 'is not a directory', + \ '~'.expand("")) + if a:1 =~ "\\\s" && !filereadable(s:NetrwFile(a:1)) && !isdirectory(s:NetrwFile(a:1)) +" call Decho("re-trying Explore with <".substitute(a:1,'\\\(\s\)','\1','g').">",'~'.expand("")) call netrw#Explore(a:indx,a:dosplit,a:style,substitute(a:1,'\\\(\s\)','\1','g')) " call Dret("netrw#Explore : returning from retry") return " else " Decho -" call Decho("retry not needed") +" call Decho("retry not needed",'~'.expand("")) endif endif @@ -660,7 +664,7 @@ fun! netrw#Explore(indx,dosplit,style,.. " -or- file has been modified AND file not hidden when abandoned " -or- Texplore used if a:dosplit || (&modified && &hidden == 0 && &bufhidden != "hide") || a:style == 6 -" call Decho("case dosplit=".a:dosplit." modified=".&modified." a:style=".a:style.": dosplit or file has been modified") +" call Decho("case dosplit=".a:dosplit." modified=".&modified." a:style=".a:style.": dosplit or file has been modified",'~'.expand("")) call s:SaveWinVars() let winsz= g:netrw_winsize if a:indx > 0 @@ -668,119 +672,119 @@ fun! netrw#Explore(indx,dosplit,style,.. endif if a:style == 0 " Explore, Sexplore -" call Decho("style=0: Explore or Sexplore") +" call Decho("style=0: Explore or Sexplore",'~'.expand("")) let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "noswapfile ".winsz."wincmd s" -" call Decho("exe noswapfile ".winsz."wincmd s") +" call Decho("exe noswapfile ".winsz."wincmd s",'~'.expand("")) elseif a:style == 1 "Explore!, Sexplore! -" call Decho("style=1: Explore! or Sexplore!") +" call Decho("style=1: Explore! or Sexplore!",'~'.expand("")) let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile ".winsz."wincmd v" -" call Decho("exe keepalt noswapfile ".winsz."wincmd v") +" call Decho("exe keepalt noswapfile ".winsz."wincmd v",'~'.expand("")) elseif a:style == 2 " Hexplore -" call Decho("style=2: Hexplore") +" call Decho("style=2: Hexplore",'~'.expand("")) let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile bel ".winsz."wincmd s" -" call Decho("exe keepalt noswapfile bel ".winsz."wincmd s") +" call Decho("exe keepalt noswapfile bel ".winsz."wincmd s",'~'.expand("")) elseif a:style == 3 " Hexplore! -" call Decho("style=3: Hexplore!") +" call Decho("style=3: Hexplore!",'~'.expand("")) let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile abo ".winsz."wincmd s" -" call Decho("exe keepalt noswapfile abo ".winsz."wincmd s") +" call Decho("exe keepalt noswapfile abo ".winsz."wincmd s",'~'.expand("")) elseif a:style == 4 " Vexplore -" call Decho("style=4: Vexplore") +" call Decho("style=4: Vexplore",'~'.expand("")) let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile lefta ".winsz."wincmd v" -" call Decho("exe keepalt noswapfile lefta ".winsz."wincmd v") +" call Decho("exe keepalt noswapfile lefta ".winsz."wincmd v",'~'.expand("")) elseif a:style == 5 " Vexplore! -" call Decho("style=5: Vexplore!") +" call Decho("style=5: Vexplore!",'~'.expand("")) let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz if winsz == 0|let winsz= ""|endif exe "keepalt noswapfile rightb ".winsz."wincmd v" -" call Decho("exe keepalt noswapfile rightb ".winsz."wincmd v") +" call Decho("exe keepalt noswapfile rightb ".winsz."wincmd v",'~'.expand("")) elseif a:style == 6 " Texplore call s:SaveBufVars() -" call Decho("style = 6: Texplore") +" call Decho("style = 6: Texplore",'~'.expand("")) exe "keepalt tabnew ".fnameescape(curdir) -" call Decho("exe keepalt tabnew ".fnameescape(curdir)) +" call Decho("exe keepalt tabnew ".fnameescape(curdir),'~'.expand("")) call s:RestoreBufVars() endif call s:RestoreWinVars() " else " Decho -" call Decho("case a:dosplit=".a:dosplit." AND modified=".&modified." AND a:style=".a:style." is not 6") +" call Decho("case a:dosplit=".a:dosplit." AND modified=".&modified." AND a:style=".a:style." is not 6",'~'.expand("")) endif NetrwKeepj norm! 0 if a:0 > 0 -" call Decho("case [a:0=".a:0."] > 0: a:1<".a:1.">") +" call Decho("case [a:0=".a:0."] > 0: a:1<".a:1.">",'~'.expand("")) if a:1 =~ '^\~' && (has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin)) -" call Decho("..case a:1<".a:1.">: starts with ~ and unix or cygwin") +" call Decho("..case a:1<".a:1.">: starts with ~ and unix or cygwin",'~'.expand("")) let dirname= simplify(substitute(a:1,'\~',expand("$HOME"),'')) -" call Decho("..using dirname<".dirname."> (case: ~ && unix||cygwin)") +" call Decho("..using dirname<".dirname."> (case: ~ && unix||cygwin)",'~'.expand("")) elseif a:1 == '.' -" call Decho("..case a:1<".a:1.">: matches .") +" call Decho("..case a:1<".a:1.">: matches .",'~'.expand("")) let dirname= simplify(exists("b:netrw_curdir")? b:netrw_curdir : getcwd()) if dirname !~ '/$' let dirname= dirname."/" endif -" call Decho("..using dirname<".dirname."> (case: ".(exists("b:netrw_curdir")? "b:netrw_curdir" : "getcwd()").")") +" call Decho("..using dirname<".dirname."> (case: ".(exists("b:netrw_curdir")? "b:netrw_curdir" : "getcwd()").")",'~'.expand("")) elseif a:1 =~ '\$' -" call Decho("..case a:1<".a:1.">: matches ending $") +" call Decho("..case a:1<".a:1.">: matches ending $",'~'.expand("")) let dirname= simplify(expand(a:1)) -" call Decho("..using user-specified dirname<".dirname."> with $env-var") +" call Decho("..using user-specified dirname<".dirname."> with $env-var",'~'.expand("")) elseif a:1 !~ '^\*\{1,2}/' && a:1 !~ '^\a\{3,}://' -" call Decho("..case a:1<".a:1.">: other, not pattern or filepattern") +" call Decho("..case a:1<".a:1.">: other, not pattern or filepattern",'~'.expand("")) let dirname= simplify(a:1) -" call Decho("..using user-specified dirname<".dirname.">") - else -" call Decho("..case a:1: pattern or filepattern") +" call Decho("..using user-specified dirname<".dirname.">",'~'.expand("")) + else +" call Decho("..case a:1: pattern or filepattern",'~'.expand("")) let dirname= a:1 endif else " clear explore -" call Decho("case a:0=".a:0.": clearing Explore list") +" call Decho("case a:0=".a:0.": clearing Explore list",'~'.expand("")) call s:NetrwClearExplore() " call Dret("netrw#Explore : cleared list") return endif -" call Decho("dirname<".dirname.">") +" call Decho("dirname<".dirname.">",'~'.expand("")) if dirname =~ '\.\./\=$' let dirname= simplify(fnamemodify(dirname,':p:h')) elseif dirname =~ '\.\.' || dirname == '.' let dirname= simplify(fnamemodify(dirname,':p')) endif -" call Decho("dirname<".dirname."> (after simplify)") +" call Decho("dirname<".dirname."> (after simplify)",'~'.expand("")) if dirname =~ '^\*//' " starpat=1: Explore *//pattern (current directory only search for files containing pattern) -" call Decho("case starpat=1: Explore *//pattern") +" call Decho("case starpat=1: Explore *//pattern",'~'.expand("")) let pattern= substitute(dirname,'^\*//\(.*\)$','\1','') let starpat= 1 -" call Decho("..Explore *//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">") +" call Decho("..Explore *//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">",'~'.expand("")) if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif elseif dirname =~ '^\*\*//' " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) -" call Decho("case starpat=2: Explore **//pattern") +" call Decho("case starpat=2: Explore **//pattern",'~'.expand("")) let pattern= substitute(dirname,'^\*\*//','','') let starpat= 2 -" call Decho("..Explore **//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">") +" call Decho("..Explore **//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">",'~'.expand("")) elseif dirname =~ '/\*\*/' " handle .../**/.../filepat -" call Decho("case starpat=4: Explore .../**/.../filepat") +" call Decho("case starpat=4: Explore .../**/.../filepat",'~'.expand("")) let prefixdir= substitute(dirname,'^\(.\{-}\)\*\*.*$','\1','') if prefixdir =~ '^/' || (prefixdir =~ '^\a:/' && (has("win32") || has("win95") || has("win64") || has("win16"))) let b:netrw_curdir = prefixdir @@ -789,30 +793,30 @@ fun! netrw#Explore(indx,dosplit,style,.. endif let dirname= substitute(dirname,'^.\{-}\(\*\*/.*\)$','\1','') let starpat= 4 -" call Decho("..pwd<".getcwd()."> dirname<".dirname.">") -" call Decho("..case Explore ../**/../filepat (starpat=".starpat.")") +" call Decho("..pwd<".getcwd()."> dirname<".dirname.">",'~'.expand("")) +" call Decho("..case Explore ../**/../filepat (starpat=".starpat.")",'~'.expand("")) elseif dirname =~ '^\*/' " case starpat=3: Explore */filepat (search in current directory for filenames matching filepat) let starpat= 3 -" call Decho("case starpat=3: Explore */filepat (starpat=".starpat.")") +" call Decho("case starpat=3: Explore */filepat (starpat=".starpat.")",'~'.expand("")) elseif dirname=~ '^\*\*/' " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) let starpat= 4 -" call Decho("case starpat=4: Explore **/filepat (starpat=".starpat.")") +" call Decho("case starpat=4: Explore **/filepat (starpat=".starpat.")",'~'.expand("")) else let starpat= 0 -" call Decho("case starpat=0: default") +" call Decho("case starpat=0: default",'~'.expand("")) endif if starpat == 0 && a:indx >= 0 " [Explore Hexplore Vexplore Sexplore] [dirname] -" call Decho("case starpat==0 && a:indx=".a:indx.": dirname<".dirname.">, handles Explore Hexplore Vexplore Sexplore") +" call Decho("case starpat==0 && a:indx=".a:indx.": dirname<".dirname.">, handles Explore Hexplore Vexplore Sexplore",'~'.expand("")) if dirname == "" let dirname= curfiledir -" call Decho("..empty dirname, using current file's directory<".dirname.">") +" call Decho("..empty dirname, using current file's directory<".dirname.">",'~'.expand("")) endif if dirname =~ '^scp://' || dirname =~ '^ftp://' call netrw#Nread(2,dirname) @@ -820,7 +824,7 @@ fun! netrw#Explore(indx,dosplit,style,.. if dirname == "" let dirname= getcwd() elseif (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin - " Windows : check for a drive specifier, or else for a remote share name ('\\Foo' or '//Foo', + " Windows : check for a drive specifier, or else for a remote share name ('\\Foo' or '//Foo', " depending on whether backslashes have been converted to forward slashes by earlier code). if dirname !~ '^[a-zA-Z]:' && dirname !~ '^\\\\\w\+' && dirname !~ '^//\w\+' let dirname= b:netrw_curdir."/".dirname @@ -828,9 +832,10 @@ fun! netrw#Explore(indx,dosplit,style,.. elseif dirname !~ '^/' let dirname= b:netrw_curdir."/".dirname endif -" call Decho("..calling LocalBrowseCheck(dirname<".dirname.">)") +" call Decho("..calling LocalBrowseCheck(dirname<".dirname.">)",'~'.expand("")) call netrw#LocalBrowseCheck(dirname) -" call Decho("win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) +" call Decho(" modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) endif if exists("w:netrw_bannercnt") " done to handle P08-Ingelrest. :Explore will _Always_ go to the line just after the banner. @@ -838,7 +843,7 @@ fun! netrw#Explore(indx,dosplit,style,.. exe w:netrw_bannercnt endif -" call Decho("curdir<".curdir.">") +" call Decho("curdir<".curdir.">",'~'.expand("")) " --------------------------------------------------------------------- " Jan 24, 2013: not sure why the following was present. See P08-Ingelrest " if has("win32") || has("win95") || has("win64") || has("win16") @@ -854,26 +859,26 @@ fun! netrw#Explore(indx,dosplit,style,.. " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) elseif a:indx <= 0 " Nexplore, Pexplore, Explore: handle starpat -" call Decho("case a:indx<=0: Nexplore, Pexplore, , starpat=".starpat." a:indx=".a:indx) +" call Decho("case a:indx<=0: Nexplore, Pexplore, , starpat=".starpat." a:indx=".a:indx,'~'.expand("")) if !mapcheck("","n") && !mapcheck("","n") && exists("b:netrw_curdir") -" call Decho("..set up and maps") +" call Decho("..set up and maps",'~'.expand("")) let s:didstarstar= 1 nnoremap :Pexplore nnoremap :Nexplore endif if has("path_extra") -" call Decho("..starpat=".starpat.": has +path_extra") +" call Decho("..starpat=".starpat.": has +path_extra",'~'.expand("")) if !exists("w:netrw_explore_indx") let w:netrw_explore_indx= 0 endif let indx = a:indx -" call Decho("..starpat=".starpat.": set indx= [a:indx=".indx."]") +" call Decho("..starpat=".starpat.": set indx= [a:indx=".indx."]",'~'.expand("")) if indx == -1 " Nexplore -" call Decho("..case Nexplore with starpat=".starpat.": (indx=".indx.")") +" call Decho("..case Nexplore with starpat=".starpat.": (indx=".indx.")",'~'.expand("")) if !exists("w:netrw_explore_list") " sanity check NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or improperly; see help for netrw-starstar",40) if has("clipboard") @@ -888,17 +893,17 @@ fun! netrw#Explore(indx,dosplit,style,.. if indx < 0 | let indx= 0 | endif if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif let curfile= w:netrw_explore_list[indx] -" call Decho("....indx=".indx." curfile<".curfile.">") +" call Decho("....indx=".indx." curfile<".curfile.">",'~'.expand("")) while indx < w:netrw_explore_listlen && curfile == w:netrw_explore_list[indx] let indx= indx + 1 -" call Decho("....indx=".indx." (Nexplore while loop)") +" call Decho("....indx=".indx." (Nexplore while loop)",'~'.expand("")) endwhile if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif -" call Decho("....Nexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx) +" call Decho("....Nexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx,'~'.expand("")) elseif indx == -2 " Pexplore -" call Decho("case Pexplore with starpat=".starpat.": (indx=".indx.")") +" call Decho("case Pexplore with starpat=".starpat.": (indx=".indx.")",'~'.expand("")) if !exists("w:netrw_explore_list") " sanity check NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or improperly; see help for netrw-starstar",41) if has("clipboard") @@ -913,30 +918,30 @@ fun! netrw#Explore(indx,dosplit,style,.. if indx < 0 | let indx= 0 | endif if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif let curfile= w:netrw_explore_list[indx] -" call Decho("....indx=".indx." curfile<".curfile.">") +" call Decho("....indx=".indx." curfile<".curfile.">",'~'.expand("")) while indx >= 0 && curfile == w:netrw_explore_list[indx] let indx= indx - 1 -" call Decho("....indx=".indx." (Pexplore while loop)") +" call Decho("....indx=".indx." (Pexplore while loop)",'~'.expand("")) endwhile if indx < 0 | let indx= 0 | endif -" call Decho("....Pexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx) +" call Decho("....Pexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx,'~'.expand("")) else " Explore -- initialize " build list of files to Explore with Nexplore/Pexplore -" call Decho("..starpat=".starpat.": case Explore: initialize (indx=".indx.")") +" call Decho("..starpat=".starpat.": case Explore: initialize (indx=".indx.")",'~'.expand("")) NetrwKeepj keepalt call s:NetrwClearExplore() let w:netrw_explore_indx= 0 if !exists("b:netrw_curdir") let b:netrw_curdir= getcwd() endif -" call Decho("....starpat=".starpat.": b:netrw_curdir<".b:netrw_curdir.">") +" call Decho("....starpat=".starpat.": b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("")) " switch on starpat to build the w:netrw_explore_list of files if starpat == 1 " starpat=1: Explore *//pattern (current directory only search for files containing pattern) -" call Decho("..case starpat=".starpat.": build *//pattern list (curdir-only srch for files containing pattern) &hls=".&hls) -" call Decho("....pattern<".pattern.">") +" call Decho("..case starpat=".starpat.": build *//pattern list (curdir-only srch for files containing pattern) &hls=".&hls,'~'.expand("")) +" call Decho("....pattern<".pattern.">",'~'.expand("")) try exe "NetrwKeepj noautocmd vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*" catch /^Vim\%((\a\+)\)\=:E480/ @@ -949,8 +954,8 @@ fun! netrw#Explore(indx,dosplit,style,.. elseif starpat == 2 " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) -" call Decho("..case starpat=".starpat.": build **//pattern list (recursive descent files containing pattern)") -" call Decho("....pattern<".pattern.">") +" call Decho("..case starpat=".starpat.": build **//pattern list (recursive descent files containing pattern)",'~'.expand("")) +" call Decho("....pattern<".pattern.">",'~'.expand("")) try exe "sil NetrwKeepj noautocmd keepalt vimgrep /".pattern."/gj "."**/*" catch /^Vim\%((\a\+)\)\=:E480/ @@ -971,24 +976,24 @@ fun! netrw#Explore(indx,dosplit,style,.. elseif starpat == 3 " starpat=3: Explore */filepat (search in current directory for filenames matching filepat) -" call Decho("..case starpat=".starpat.": build */filepat list (curdir-only srch filenames matching filepat) &hls=".&hls) +" call Decho("..case starpat=".starpat.": build */filepat list (curdir-only srch filenames matching filepat) &hls=".&hls,'~'.expand("")) let filepat= substitute(dirname,'^\*/','','') let filepat= substitute(filepat,'^[%#<]','\\&','') -" call Decho("....b:netrw_curdir<".b:netrw_curdir.">") -" call Decho("....filepat<".filepat.">") +" call Decho("....b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("")) +" call Decho("....filepat<".filepat.">",'~'.expand("")) let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".filepat),'\n')) if &hls | let keepregslash= s:ExplorePatHls(filepat) | endif elseif starpat == 4 " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) -" call Decho("..case starpat=".starpat.": build **/filepat list (recursive descent srch filenames matching filepat) &hls=".&hls) +" call Decho("..case starpat=".starpat.": build **/filepat list (recursive descent srch filenames matching filepat) &hls=".&hls,'~'.expand("")) let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".dirname),'\n')) if &hls | let keepregslash= s:ExplorePatHls(dirname) | endif endif " switch on starpat to build w:netrw_explore_list let w:netrw_explore_listlen = len(w:netrw_explore_list) -" call Decho("....w:netrw_explore_list<".string(w:netrw_explore_list).">") -" call Decho("....w:netrw_explore_listlen=".w:netrw_explore_listlen) +" call Decho("....w:netrw_explore_list<".string(w:netrw_explore_list).">",'~'.expand("")) +" call Decho("....w:netrw_explore_listlen=".w:netrw_explore_listlen,'~'.expand("")) if w:netrw_explore_listlen == 0 || (w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/') keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"no files matched",42) @@ -1004,22 +1009,22 @@ fun! netrw#Explore(indx,dosplit,style,.. " NetrwStatusLine support - for exploring support let w:netrw_explore_indx= indx -" call Decho("....w:netrw_explore_list<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen) +" call Decho("....w:netrw_explore_list<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen,'~'.expand("")) " wrap the indx around, but issue a note if indx >= w:netrw_explore_listlen || indx < 0 -" call Decho("....wrap indx (indx=".indx." listlen=".w:netrw_explore_listlen.")") +" call Decho("....wrap indx (indx=".indx." listlen=".w:netrw_explore_listlen.")",'~'.expand("")) let indx = (indx < 0)? ( w:netrw_explore_listlen - 1 ) : 0 let w:netrw_explore_indx= indx keepalt NetrwKeepj call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43) endif exe "let dirfile= w:netrw_explore_list[".indx."]" -" call Decho("....dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">") +" call Decho("....dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">",'~'.expand("")) let newdir= substitute(dirfile,'/[^/]*$','','e') -" call Decho("....newdir<".newdir.">") - -" call Decho("....calling LocalBrowseCheck(newdir<".newdir.">)") +" call Decho("....newdir<".newdir.">",'~'.expand("")) + +" call Decho("....calling LocalBrowseCheck(newdir<".newdir.">)",'~'.expand("")) call netrw#LocalBrowseCheck(newdir) if !exists("w:netrw_liststyle") let w:netrw_liststyle= g:netrw_liststyle @@ -1033,10 +1038,10 @@ fun! netrw#Explore(indx,dosplit,style,.. let w:netrw_explore_bufnr = bufnr("%") let w:netrw_explore_line = line(".") keepalt NetrwKeepj call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}') -" call Decho("....explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line) - - else -" call Decho("..your vim does not have +path_extra") +" call Decho("....explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line,'~'.expand("")) + + else +" call Decho("..your vim does not have +path_extra",'~'.expand("")) if !exists("g:netrw_quiet") keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44) endif @@ -1050,7 +1055,7 @@ fun! netrw#Explore(indx,dosplit,style,.. endif else -" call Decho("..default case: Explore newdir<".dirname.">") +" call Decho("..default case: Explore newdir<".dirname.">",'~'.expand("")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && dirname =~ '/' sil! unlet w:netrw_treedict sil! unlet w:netrw_treetop @@ -1064,13 +1069,13 @@ fun! netrw#Explore(indx,dosplit,style,.. endif " visual display of **/ **// */ Exploration files -" call Decho("w:netrw_explore_indx=".(exists("w:netrw_explore_indx")? w:netrw_explore_indx : "doesn't exist")) -" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "n/a").">") +" call Decho("w:netrw_explore_indx=".(exists("w:netrw_explore_indx")? w:netrw_explore_indx : "doesn't exist"),'~'.expand("")) +" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "n/a").">",'~'.expand("")) if exists("w:netrw_explore_indx") && exists("b:netrw_curdir") -" call Decho("s:explore_prvdir<".(exists("s:explore_prvdir")? s:explore_prvdir : "-doesn't exist-")) +" call Decho("s:explore_prvdir<".(exists("s:explore_prvdir")? s:explore_prvdir : "-doesn't exist-"),'~'.expand("")) if !exists("s:explore_prvdir") || s:explore_prvdir != b:netrw_curdir " only update match list when current directory isn't the same as before -" call Decho("only update match list when current directory not the same as before") +" call Decho("only update match list when current directory not the same as before",'~'.expand("")) let s:explore_prvdir = b:netrw_curdir let s:explore_match = "" let dirlen = strlen(b:netrw_curdir) @@ -1079,7 +1084,7 @@ fun! netrw#Explore(indx,dosplit,style,.. endif let prvfname= "" for fname in w:netrw_explore_list -" call Decho("fname<".fname.">") +" call Decho("fname<".fname.">",'~'.expand("")) if fname =~ '^'.b:netrw_curdir if s:explore_match == "" let s:explore_match= '\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>' @@ -1095,7 +1100,7 @@ fun! netrw#Explore(indx,dosplit,style,.. endif let prvfname= fname endfor -" call Decho("explore_match<".s:explore_match.">") +" call Decho("explore_match<".s:explore_match.">",'~'.expand("")) exe "2match netrwMarkFile /".s:explore_match."/" endif echo "==Pexplore ==Nexplore" @@ -1104,7 +1109,7 @@ fun! netrw#Explore(indx,dosplit,style,.. if exists("s:explore_match") | unlet s:explore_match | endif if exists("s:explore_prvdir") | unlet s:explore_prvdir | endif echo " " -" call Decho("cleared explore match list") +" call Decho("cleared explore match list",'~'.expand("")) endif " since Explore may be used to initialize netrw's browser, @@ -1130,14 +1135,14 @@ fun! netrw#Lexplore(count,rightside,...) " and a directory has been specified, explore with that " directory. let a1 = expand(a:1) -" call Decho("a:1<".a:1."> curwin#".curwin) +" call Decho("a:1<".a:1."> curwin#".curwin,'~'.expand("")) exe "1wincmd w" if &ft == "netrw" -" call Decho("exe Explore ".fnameescape(a:1)) +" call Decho("exe Explore ".fnameescape(a:1),'~'.expand("")) exe "Explore ".fnameescape(a1) exe curwin."wincmd w" if exists("t:netrw_lexposn") -" call Decho("forgetting t:netrw_lexposn") +" call Decho("forgetting t:netrw_lexposn",'~'.expand("")) unlet t:netrw_lexposn endif " call Dret("netrw#Lexplore") @@ -1157,11 +1162,11 @@ fun! netrw#Lexplore(count,rightside,...) if lexwinnr > 0 " close down netrw explorer window -" call Decho("t:netrw_lexbufnr#".t:netrw_lexbufnr.": close down netrw window") +" call Decho("t:netrw_lexbufnr#".t:netrw_lexbufnr.": close down netrw window",'~'.expand("")) exe lexwinnr."wincmd w" let g:netrw_winsize = -winwidth(0) let t:netrw_lexposn = netrw#SavePosn() -" call Decho("saving t:netrw_lexposn") +" call Decho("saving t:netrw_lexposn",'~'.expand("")) close if lexwinnr < curwin let curwin= curwin - 1 @@ -1171,7 +1176,7 @@ fun! netrw#Lexplore(count,rightside,...) else " open netrw explorer window -" call Decho("t:netrw_lexbufnr: open netrw explorer window") +" call Decho("t:netrw_lexbufnr: open netrw explorer window",'~'.expand("")) exe "1wincmd w" let keep_altv = g:netrw_altv let g:netrw_altv = 0 @@ -1180,16 +1185,16 @@ fun! netrw#Lexplore(count,rightside,...) let g:netrw_winsize = a:count endif let curfile= expand("%") -" call Decho("curfile<".curfile.">") +" call Decho("curfile<".curfile.">",'~'.expand("")) exe (a:rightside? "botright" : "topleft")." vertical ".((g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize) . " new" if a:0 > 0 && a1 != "" -" call Decho("case 1: Explore ".a1) +" call Decho("case 1: Explore ".a1,'~'.expand("")) exe "Explore ".fnameescape(a1) - elseif curfile =~ '^\a\+://' -" call Decho("case 2: Explore ".substitute(curfile,'[^/\\]*$','','')) + elseif curfile =~ '^\a\{3,}://' +" call Decho("case 2: Explore ".substitute(curfile,'[^/\\]*$','',''),'~'.expand("")) exe "Explore ".substitute(curfile,'[^/\\]*$','','') else -" call Decho("case 3: Explore .") +" call Decho("case 3: Explore .",'~'.expand("")) Explore . endif if a:count != 0 @@ -1199,7 +1204,7 @@ fun! netrw#Lexplore(count,rightside,...) let g:netrw_altv = keep_altv let t:netrw_lexbufnr = bufnr("%") if exists("t:netrw_lexposn") -" call Decho("restoring to t:netrw_lexposn") +" call Decho("restoring to t:netrw_lexposn",'~'.expand("")) call netrw#RestorePosn(t:netrw_lexposn) unlet t:netrw_lexposn endif @@ -1229,14 +1234,14 @@ fun! netrw#Clean(sys) else let choice= confirm("Remove personal copy of netrw?","&Yes\n&No") endif -" call Decho("choice=".choice) +" call Decho("choice=".choice,'~'.expand("")) let diddel= 0 let diddir= "" if choice == 1 for dir in split(&rtp,',') if filereadable(dir."/plugin/netrwPlugin.vim") -" call Decho("removing netrw-related files from ".dir) +" call Decho("removing netrw-related files from ".dir,'~'.expand("")) if s:NetrwDelete(dir."/plugin/netrwPlugin.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/plugin/netrwPlugin.vim",55) |endif if s:NetrwDelete(dir."/autoload/netrwFileHandlers.vim")|call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrwFileHandlers.vim",55)|endif if s:NetrwDelete(dir."/autoload/netrwSettings.vim") |call netrw#ErrorMsg(1,"unable to remove ".dir."/autoload/netrwSettings.vim",55) |endif @@ -1269,8 +1274,8 @@ fun! netrw#MakeTgt(dname) " call Dfunc("netrw#MakeTgt(dname<".a:dname.">)") " simplify the target (eg. /abc/def/../ghi -> /abc/ghi) let svpos = netrw#SavePosn() - let s:netrwmftgt_islocal= (a:dname !~ '^\a\+://') -" call Decho("s:netrwmftgt_islocal=".s:netrwmftgt_islocal) + let s:netrwmftgt_islocal= (a:dname !~ '^\a\{3,}://') +" call Decho("s:netrwmftgt_islocal=".s:netrwmftgt_islocal,'~'.expand("")) if s:netrwmftgt_islocal let netrwmftgt= simplify(a:dname) else @@ -1283,7 +1288,7 @@ fun! netrw#MakeTgt(dname) let s:netrwmftgt= netrwmftgt endif if g:netrw_fastbrowse <= 1 - call s:NetrwRefresh((b:netrw_curdir !~ '\a\+://'),b:netrw_curdir) + call s:NetrwRefresh((b:netrw_curdir !~ '\a\{3,}://'),b:netrw_curdir) endif call netrw#RestorePosn(svpos) " call Dret("netrw#MakeTgt") @@ -1309,40 +1314,40 @@ fun! netrw#Obtain(islocal,fname,...) " call Dret("netrw#Obtain") return endif -" call Decho("fnamelist<".string(fnamelist).">") +" call Decho("fnamelist<".string(fnamelist).">",'~'.expand("")) if a:0 > 0 let tgtdir= a:1 else let tgtdir= getcwd() endif -" call Decho("tgtdir<".tgtdir.">") +" call Decho("tgtdir<".tgtdir.">",'~'.expand("")) if exists("b:netrw_islocal") && b:netrw_islocal " obtain a file from local b:netrw_curdir to (local) tgtdir -" call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir) +" call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir,'~'.expand("")) if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir let topath= s:ComposePath(tgtdir,"") if (has("win32") || has("win95") || has("win64") || has("win16")) " transfer files one at time -" call Decho("transfer files one at a time") +" call Decho("transfer files one at a time",'~'.expand("")) for fname in fnamelist -" call Decho("system(".g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath).")") - call system(g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath)) +" call Decho("system(".g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath).")",'~'.expand("")) + call system(g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath)) if v:shell_error != 0 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) -" call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath)) +" call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath)) return endif endfor else " transfer files with one command -" call Decho("transfer files with one command") - let filelist= join(map(deepcopy(fnamelist),"shellescape(v:val)")) -" call Decho("system(".g:netrw_localcopycmd." ".filelist." ".shellescape(topath).")") - call system(g:netrw_localcopycmd." ".filelist." ".shellescape(topath)) +" call Decho("transfer files with one command",'~'.expand("")) + let filelist= join(map(deepcopy(fnamelist),"s:ShellEscape(v:val)")) +" call Decho("system(".g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath).")",'~'.expand("")) + call system(g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath)) if v:shell_error != 0 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) -" call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".filelist." ".shellescape(topath)) +" call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath)) return endif endif @@ -1354,7 +1359,7 @@ fun! netrw#Obtain(islocal,fname,...) else " obtain files from remote b:netrw_curdir to local tgtdir -" call Decho("obtain a file from remote ".b:netrw_curdir." to ".tgtdir) +" call Decho("obtain a file from remote ".b:netrw_curdir." to ".tgtdir,'~'.expand("")) if type(a:fname) == 1 call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.a:fname) endif @@ -1362,7 +1367,7 @@ fun! netrw#Obtain(islocal,fname,...) if b:netrw_method == 4 " obtain file using scp -" call Decho("obtain via scp (method#4)") +" call Decho("obtain via scp (method#4)",'~'.expand("")) if exists("g:netrw_port") && g:netrw_port != "" let useport= " ".g:netrw_scpport." ".g:netrw_port else @@ -1373,37 +1378,37 @@ fun! netrw#Obtain(islocal,fname,...) else let path= "" endif - let filelist= join(map(deepcopy(fnamelist),'shellescape(g:netrw_machine.":".path.v:val,1)')) - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1)) + let filelist= join(map(deepcopy(fnamelist),'s:ShellEscape(g:netrw_machine.":".path.v:val,1)')) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.s:ShellEscape(useport,1)." ".filelist." ".s:ShellEscape(tgtdir,1)) elseif b:netrw_method == 2 " obtain file using ftp + .netrc -" call Decho("obtain via ftp+.netrc (method #2)") +" call Decho("obtain via ftp+.netrc (method #2)",'~'.expand("")) call s:SaveBufVars()|sil NetrwKeepj new|call s:RestoreBufVars() let tmpbufnr= bufnr("%") setl ff=unix if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) endif if exists("b:netrw_fname") && b:netrw_fname != "" call setline(line("$")+1,'cd "'.b:netrw_fname.'"') -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) endif if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) endif for fname in fnamelist call setline(line("$")+1,'get "'.fname.'"') -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) endfor if exists("g:netrw_port") && g:netrw_port != "" - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)) else - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)) endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' @@ -1415,56 +1420,56 @@ fun! netrw#Obtain(islocal,fname,...) elseif b:netrw_method == 3 " obtain with ftp + machine, id, passwd, and fname (ie. no .netrc) -" call Decho("obtain via ftp+mipf (method #3)") +" call Decho("obtain via ftp+mipf (method #3)",'~'.expand("")) call s:SaveBufVars()|sil NetrwKeepj new|call s:RestoreBufVars() let tmpbufnr= bufnr("%") setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) else NetrwKeepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 NetrwKeepj put =g:netrw_uid -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) if exists("s:netrw_passwd") && s:netrw_passwd != "" NetrwKeepj put ='\"'.s:netrw_passwd.'\"' endif -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) elseif exists("s:netrw_passwd") NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) endif endif if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) endif if exists("b:netrw_fname") && b:netrw_fname != "" NetrwKeepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) endif if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) endif if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) endif for fname in fnamelist NetrwKeepj call setline(line("$")+1,'get "'.fname.'"') endfor -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) " perform ftp: " -i : turns off interactive prompting from ftp @@ -1474,7 +1479,7 @@ fun! netrw#Obtain(islocal,fname,...) call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" -" call Decho("error<".getline(1).">") +" call Decho("error<".getline(1).">",'~'.expand("")) if !exists("g:netrw_quiet") NetrwKeepj call netrw#ErrorMsg(s:ERROR,getline(1),5) endif @@ -1482,13 +1487,13 @@ fun! netrw#Obtain(islocal,fname,...) elseif b:netrw_method == 9 " obtain file using sftp -" call Decho("obtain via sftp (method #9)") +" call Decho("obtain via sftp (method #9)",'~'.expand("")) if a:fname =~ '/' let localfile= substitute(a:fname,'^.*/','','') else let localfile= a:fname endif - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1).shellescape(localfile)." ".shellescape(tgtdir)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1).s:ShellEscape(localfile)." ".s:ShellEscape(tgtdir)) elseif !exists("b:netrw_method") || b:netrw_method < 0 " probably a badly formed url; protocol not recognized @@ -1544,19 +1549,19 @@ endfun " s:NetrwOptionRestore: restore options (based on prior s:NetrwOptionSave) {{{2 fun! s:NetrwOptionRestore(vt) " call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("")) if !exists("{a:vt}netrw_optionsave") if exists("s:nbcd_curpos_{bufnr('%')}") -" call Decho("restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)") +" call Decho("restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)",'~'.expand("")) NetrwKeepj call netrw#RestorePosn(s:nbcd_curpos_{bufnr('%')}) -" call Decho("win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) -" call Decho("unlet s:nbcd_curpos_".bufnr('%')) +" call Decho("win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$"),'~'.expand("")) +" call Decho("unlet s:nbcd_curpos_".bufnr('%'),'~'.expand("")) unlet s:nbcd_curpos_{bufnr('%')} else -" call Decho("no previous position") - endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt) -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("no previous position",'~'.expand("")) + endif +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("")) +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) " call Dret("s:NetrwOptionRestore : ".a:vt."netrw_optionsave doesn't exist") return endif @@ -1564,7 +1569,7 @@ fun! s:NetrwOptionRestore(vt) if exists("+acd") if exists("{a:vt}netrw_acdkeep") -" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) +" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("")) let curdir = getcwd() let &l:acd = {a:vt}netrw_acdkeep unlet {a:vt}netrw_acdkeep @@ -1575,9 +1580,6 @@ fun! s:NetrwOptionRestore(vt) endif if exists("{a:vt}netrw_aikeep") |let &l:ai = {a:vt}netrw_aikeep |unlet {a:vt}netrw_aikeep |endif if exists("{a:vt}netrw_awkeep") |let &l:aw = {a:vt}netrw_awkeep |unlet {a:vt}netrw_awkeep |endif - if g:netrw_liststyle != s:TREELIST - if exists("{a:vt}netrw_bhkeep") |let &l:bh = {a:vt}netrw_bhkeep |unlet {a:vt}netrw_bhkeep |endif - endif if exists("{a:vt}netrw_blkeep") |let &l:bl = {a:vt}netrw_blkeep |unlet {a:vt}netrw_blkeep |endif if exists("{a:vt}netrw_btkeep") |let &l:bt = {a:vt}netrw_btkeep |unlet {a:vt}netrw_btkeep |endif if exists("{a:vt}netrw_bombkeep") |let &l:bomb = {a:vt}netrw_bombkeep |unlet {a:vt}netrw_bombkeep |endif @@ -1632,7 +1634,7 @@ fun! s:NetrwOptionRestore(vt) unlet {a:vt}netrw_swfkeep endif endif - if exists("{a:vt}netrw_dirkeep") && isdirectory({a:vt}netrw_dirkeep) && g:netrw_keepdir + if exists("{a:vt}netrw_dirkeep") && isdirectory(s:NetrwFile({a:vt}netrw_dirkeep)) && g:netrw_keepdir let dirkeep = substitute({a:vt}netrw_dirkeep,'\\','/','g') if exists("{a:vt}netrw_dirkeep") call s:NetrwLcd(dirkeep) @@ -1644,29 +1646,29 @@ fun! s:NetrwOptionRestore(vt) endif if exists("{a:vt}netrw_regslash")|sil! let @/= {a:vt}netrw_regslash|unlet {a:vt}netrw_regslash|endif if exists("s:nbcd_curpos_{bufnr('%')}") -" call Decho("restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)") +" call Decho("restoring previous position (s:nbcd_curpos_".bufnr('%')." exists)",'~'.expand("")) NetrwKeepj call netrw#RestorePosn(s:nbcd_curpos_{bufnr('%')}) -" call Decho("unlet s:nbcd_curpos_".bufnr('%')) +" call Decho("unlet s:nbcd_curpos_".bufnr('%'),'~'.expand("")) if exists("s:nbcd_curpos_".bufnr('%')) unlet s:nbcd_curpos_{bufnr('%')} endif else -" call Decho("no previous position") - endif - -" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) -" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")) -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") -" call Decho("diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist")) -" call Decho("ts=".&l:ts) +" call Decho("no previous position",'~'.expand("")) + endif + +" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("")) +" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist"),'~'.expand("")) +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) +" call Decho("diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist"),'~'.expand("")) +" call Decho("ts=".&l:ts,'~'.expand("")) " Moved the filetype detect here from NetrwGetFile() because remote files " were having their filetype detect-generated settings overwritten by " NetrwOptionRestore. if &ft != "netrw" -" call Decho("filetype detect (ft=".&ft.")") +" call Decho("filetype detect (ft=".&ft.")",'~'.expand("")) filetype detect endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("")) " call Dret("s:NetrwOptionRestore : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) endfun @@ -1680,8 +1682,8 @@ endfun " vt: normally its "w:" or "s:" (a variable type) fun! s:NetrwOptionSave(vt) " call Dfunc("s:NetrwOptionSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">"." winnr($)=".winnr("$")." mod=".&mod." ma=".&ma) -" call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist")) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt) +" call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist"),'~'.expand("")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("")) if !exists("{a:vt}netrw_optionsave") let {a:vt}netrw_optionsave= 1 @@ -1689,10 +1691,10 @@ fun! s:NetrwOptionSave(vt) " call Dret("s:NetrwOptionSave : options already saved") return endif -" call Decho("prior to save: fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff) +" call Decho("prior to save: fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff,'~'.expand("")) " Save current settings and current directory -" call Decho("saving current settings and current directory") +" call Decho("saving current settings and current directory",'~'.expand("")) let s:yykeep = @@ if exists("&l:acd")|let {a:vt}netrw_acdkeep = &l:acd|endif let {a:vt}netrw_aikeep = &l:ai @@ -1740,7 +1742,7 @@ fun! s:NetrwOptionSave(vt) let {a:vt}netrw_writekeep = &l:write " save a few selected netrw-related variables -" call Decho("saving a few selected netrw-related variables") +" call Decho("saving a few selected netrw-related variables",'~'.expand("")) if g:netrw_keepdir let {a:vt}netrw_dirkeep = getcwd() endif @@ -1749,7 +1751,7 @@ fun! s:NetrwOptionSave(vt) endif sil! let {a:vt}netrw_regslash= @/ -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("")) " call Dret("s:NetrwOptionSave : tab#".tabpagenr()." win#".winnr()) endfun @@ -1759,8 +1761,8 @@ endfun " Use s:NetrwOptionRestore() to restore user settings fun! s:NetrwSafeOptions() " call Dfunc("s:NetrwSafeOptions() win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%"))."> winnr($)=".winnr("$")) -" call Decho("win#".winnr()."'s ft=".&ft) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("win#".winnr()."'s ft=".&ft,'~'.expand("")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) if exists("+acd") | setl noacd | endif setl noai setl noaw @@ -1769,9 +1771,7 @@ fun! s:NetrwSafeOptions() setl bt=nofile setl noci setl nocin - if g:netrw_liststyle == s:TREELIST - setl bh=hide - endif + setl bh=hide setl cino= setl com= setl cpo-=a @@ -1793,14 +1793,14 @@ fun! s:NetrwSafeOptions() call s:NetrwCursor() " allow the user to override safe options -" call Decho("ft<".&ft."> ei=".&ei) +" call Decho("ft<".&ft."> ei=".&ei,'~'.expand("")) if &ft == "netrw" -" call Decho("do any netrw FileType autocmds (doau FileType netrw)") +" call Decho("do any netrw FileType autocmds (doau FileType netrw)",'~'.expand("")) sil! keepalt NetrwKeepj doau FileType netrw endif -" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh." bt<".&bt.">") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh." bt<".&bt.">",'~'.expand("")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) " call Dret("s:NetrwSafeOptions") endfun @@ -1857,7 +1857,7 @@ fun! netrw#NetRead(mode,...) " NetrwSafeOptions sets a buffer up for a netrw listing, which includes buflisting off. " However, this setting is not wanted for a remote editing session. The buffer should be "nofile", still. setl bl -" call Decho("(netrw#NetRead) buf#".bufnr("%")."<".bufname("%")."> bl=".&bl." bt=".&bt." bh=".&bh) +" call Decho("(netrw#NetRead) buf#".bufnr("%")."<".bufname("%")."> bl=".&bl." bt=".&bt." bh=".&bh,'~'.expand("")) " NetRead: interpret mode into a readcmd {{{3 if a:mode == 0 " read remote file before current line @@ -1873,7 +1873,7 @@ fun! netrw#NetRead(mode,...) let readcmd = "r" endif let ichoice = (a:0 == 0)? 0 : 1 -" call Decho("readcmd<".readcmd."> ichoice=".ichoice) +" call Decho("readcmd<".readcmd."> ichoice=".ichoice,'~'.expand("")) " NetRead: get temporary filename {{{3 let tmpfile= s:GetTempfile("") @@ -1886,13 +1886,13 @@ fun! netrw#NetRead(mode,...) " attempt to repeat with previous host-file-etc if exists("b:netrw_lastfile") && a:0 == 0 -" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">") +" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">",'~'.expand("")) let choice = b:netrw_lastfile let ichoice= ichoice + 1 else exe "let choice= a:" . ichoice -" call Decho("no lastfile: choice<" . choice . ">") +" call Decho("no lastfile: choice<" . choice . ">",'~'.expand("")) if match(choice,"?") == 0 " give help @@ -1915,7 +1915,7 @@ fun! netrw#NetRead(mode,...) elseif match(choice,'^"') != -1 " Reconstruct Choice if choice starts with '"' -" call Decho("reconstructing choice") +" call Decho("reconstructing choice",'~'.expand("")) if match(choice,'"$') != -1 " case "..." let choice= strpart(choice,1,strlen(choice)-2) @@ -1941,7 +1941,7 @@ fun! netrw#NetRead(mode,...) endif endif -" call Decho("choice<" . choice . ">") +" call Decho("choice<" . choice . ">",'~'.expand("")) let ichoice= ichoice + 1 " NetRead: Determine method of read (ftp, rcp, etc) {{{3 @@ -1953,9 +1953,9 @@ fun! netrw#NetRead(mode,...) let tmpfile= s:GetTempfile(b:netrw_fname) " apply correct suffix " Check whether or not NetrwBrowse() should be handling this request -" call Decho("checking if NetrwBrowse() should handle choice<".choice."> with netrw_list_cmd<".g:netrw_list_cmd.">") +" call Decho("checking if NetrwBrowse() should handle choice<".choice."> with netrw_list_cmd<".g:netrw_list_cmd.">",'~'.expand("")) if choice =~ "^.*[\/]$" && b:netrw_method != 5 && choice !~ '^https\=://' -" call Decho("yes, choice matches '^.*[\/]$'") +" call Decho("yes, choice matches '^.*[\/]$'",'~'.expand("")) NetrwKeepj call s:NetrwBrowse(0,choice) " call Dret("netrw#NetRead :3 getcwd<".getcwd().">") return @@ -1971,7 +1971,7 @@ fun! netrw#NetRead(mode,...) "......................................... " NetRead: (rcp) NetRead Method #1 {{{3 if b:netrw_method == 1 " read with rcp -" call Decho("read via rcp (method #1)") +" call Decho("read via rcp (method #1)",'~'.expand("")) " ER: nothing done with g:netrw_uid yet? " ER: on Win2K" rcp machine[.user]:file tmpfile " ER: when machine contains '.' adding .user is required (use $USERNAME) @@ -1990,30 +1990,30 @@ fun! netrw#NetRead(mode,...) let uid_machine = g:netrw_machine endif endif - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(uid_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".s:ShellEscape(uid_machine.":".b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1)) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... " NetRead: (ftp + <.netrc>) NetRead Method #2 {{{3 elseif b:netrw_method == 2 " read with ftp + <.netrc> -" call Decho("read via ftp+.netrc (method #2)") +" call Decho("read via ftp+.netrc (method #2)",'~'.expand("")) let netrw_fname= b:netrw_fname NetrwKeepj call s:SaveBufVars()|new|NetrwKeepj call s:RestoreBufVars() let filtbuf= bufnr("%") setl ff=unix NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline(line("$"))) +" call Decho("filter input: ".getline(line("$")),'~'.expand("")) if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline(line("$"))) +" call Decho("filter input: ".getline(line("$")),'~'.expand("")) endif call setline(line("$")+1,'get "'.netrw_fname.'" '.tmpfile) -" call Decho("filter input: ".getline(line("$"))) +" call Decho("filter input: ".getline(line("$")),'~'.expand("")) if exists("g:netrw_port") && g:netrw_port != "" - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)) else - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)) endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' @@ -2023,7 +2023,7 @@ fun! netrw#NetRead(mode,...) let &debug = debugkeep endif call s:SaveBufVars() - bd! + keepj bd! if bufname("%") == "" && getline("$") == "" && line('$') == 1 " needed when one sources a file in a nolbl setting window via ftp q! @@ -2036,43 +2036,43 @@ fun! netrw#NetRead(mode,...) " NetRead: (ftp + machine,id,passwd,filename) NetRead Method #3 {{{3 elseif b:netrw_method == 3 " read with ftp + machine, id, passwd, and fname " Construct execution string (four lines) which will be passed through filter -" call Decho("read via ftp+mipf (method #3)") +" call Decho("read via ftp+mipf (method #3)",'~'.expand("")) let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) NetrwKeepj call s:SaveBufVars()|new|NetrwKeepj call s:RestoreBufVars() let filtbuf= bufnr("%") setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("")) else NetrwKeepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("")) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 NetrwKeepj put =g:netrw_uid -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("")) if exists("s:netrw_passwd") NetrwKeepj put ='\"'.s:netrw_passwd.'\"' endif -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("")) elseif exists("s:netrw_passwd") NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("")) endif endif if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("")) endif if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("")) endif NetrwKeepj put ='get \"'.netrw_fname.'\" '.tmpfile -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("")) " perform ftp: " -i : turns off interactive prompting from ftp @@ -2082,19 +2082,19 @@ fun! netrw#NetRead(mode,...) call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" -" call Decho("error<".getline(1).">") +" call Decho("error<".getline(1).">",'~'.expand("")) if !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,getline(1),5) endif endif - call s:SaveBufVars()|bd!|call s:RestoreBufVars() + call s:SaveBufVars()|keepj bd!|call s:RestoreBufVars() let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... " NetRead: (scp) NetRead Method #4 {{{3 elseif b:netrw_method == 4 " read with scp -" call Decho("read via scp (method #4)") +" call Decho("read via scp (method #4)",'~'.expand("")) if exists("g:netrw_port") && g:netrw_port != "" let useport= " ".g:netrw_scpport." ".g:netrw_port else @@ -2107,14 +2107,14 @@ fun! netrw#NetRead(mode,...) else let tmpfile_get = tmpfile endif - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile_get,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)." ".s:ShellEscape(tmpfile_get,1)) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... " NetRead: (http) NetRead Method #5 (wget) {{{3 elseif b:netrw_method == 5 -" call Decho("read via http (method #5)") +" call Decho("read via http (method #5)",'~'.expand("")) if g:netrw_http_cmd == "" if !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,"neither the wget nor the fetch command is available",6) @@ -2125,34 +2125,34 @@ fun! netrw#NetRead(mode,...) if match(b:netrw_fname,"#") == -1 || exists("g:netrw_http_xcmd") " using g:netrw_http_cmd (usually elinks, links, curl, wget, or fetch) -" call Decho('using '.g:netrw_http_cmd.' (# not in b:netrw_fname<'.b:netrw_fname.">)") +" call Decho('using '.g:netrw_http_cmd.' (# not in b:netrw_fname<'.b:netrw_fname.">)",'~'.expand("")) if exists("g:netrw_http_xcmd") - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".shellescape(tmpfile,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".s:ShellEscape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)." ".g:netrw_http_xcmd." ".s:ShellEscape(tmpfile,1)) else - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(b:netrw_http."://".g:netrw_machine.b:netrw_fname,1)) endif let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) else " wget/curl/fetch 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.">)") +" call Decho("wget/curl plus jump (# in b:netrw_fname<".b:netrw_fname.">)",'~'.expand("")) let netrw_html= substitute(b:netrw_fname,"#.*$","","") let netrw_tag = substitute(b:netrw_fname,"^.*#","","") -" call Decho("netrw_html<".netrw_html.">") -" call Decho("netrw_tag <".netrw_tag.">") - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".shellescape(tmpfile,1)." ".shellescape(b:netrw_http."://".g:netrw_machine.netrw_html,1)) +" call Decho("netrw_html<".netrw_html.">",'~'.expand("")) +" call Decho("netrw_tag <".netrw_tag.">",'~'.expand("")) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(b:netrw_http."://".g:netrw_machine.netrw_html,1)) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) -" call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/') +" call Decho('<\s*a\s*name=\s*"'.netrw_tag.'"/','~'.expand("")) exe 'NetrwKeepj norm! 1G/<\s*a\s*name=\s*"'.netrw_tag.'"/'."\" endif let b:netrw_lastfile = choice -" call Decho("setl ro") +" call Decho("setl ro",'~'.expand("")) setl ro nomod "......................................... " NetRead: (dav) NetRead Method #6 {{{3 elseif b:netrw_method == 6 -" call Decho("read via cadaver (method #6)") +" call Decho("read via cadaver (method #6)",'~'.expand("")) if !executable(g:netrw_dav_cmd) call netrw#ErrorMsg(s:ERROR,g:netrw_dav_cmd." is not executable",73) @@ -2160,7 +2160,7 @@ fun! netrw#NetRead(mode,...) return endif if g:netrw_dav_cmd =~ "curl" - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_dav_cmd." ".shellescape("dav://".g:netrw_machine.b:netrw_fname,1)." ".shellescape(tmpfile,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_dav_cmd." ".s:ShellEscape("dav://".g:netrw_machine.b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1)) else " Construct execution string (four lines) which will be passed through filter let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) @@ -2180,7 +2180,7 @@ fun! netrw#NetRead(mode,...) " perform cadaver operation: NetrwKeepj norm! 1Gdd call s:NetrwExe(s:netrw_silentxfer."%!".g:netrw_dav_cmd) - bd! + keepj bd! endif let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -2188,8 +2188,8 @@ fun! netrw#NetRead(mode,...) "......................................... " NetRead: (rsync) NetRead Method #7 {{{3 elseif b:netrw_method == 7 -" call Decho("read via rsync (method #7)") - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".shellescape(tmpfile,1)) +" call Decho("read via rsync (method #7)",'~'.expand("")) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1)) let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -2197,7 +2197,7 @@ fun! netrw#NetRead(mode,...) " NetRead: (fetch) NetRead Method #8 {{{3 " fetch://[user@]host[:http]/path elseif b:netrw_method == 8 -" call Decho("read via fetch (method #8)") +" call Decho("read via fetch (method #8)",'~'.expand("")) if g:netrw_fetch_cmd == "" if !exists("g:netrw_quiet") NetrwKeepj call netrw#ErrorMsg(s:ERROR,"fetch command not available",7) @@ -2210,32 +2210,32 @@ fun! netrw#NetRead(mode,...) else let netrw_option= "ftp" endif -" call Decho("read via fetch for ".netrw_option) +" call Decho("read via fetch for ".netrw_option,'~'.expand("")) if exists("g:netrw_uid") && g:netrw_uid != "" && exists("s:netrw_passwd") && s:netrw_passwd != "" - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".b:netrw_fname,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(netrw_option."://".g:netrw_uid.':'.s:netrw_passwd.'@'.g:netrw_machine."/".b:netrw_fname,1)) else - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".shellescape(tmpfile,1)." ".shellescape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_fetch_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(netrw_option."://".g:netrw_machine."/".b:netrw_fname,1)) endif let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) let b:netrw_lastfile = choice -" call Decho("setl ro") +" call Decho("setl ro",'~'.expand("")) setl ro nomod "......................................... " NetRead: (sftp) NetRead Method #9 {{{3 elseif b:netrw_method == 9 -" call Decho("read via sftp (method #9)") - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile) +" call Decho("read via sftp (method #9)",'~'.expand("")) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_sftp_cmd." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)." ".tmpfile) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice "......................................... " NetRead: (file) NetRead Method #10 {{{3 elseif b:netrw_method == 10 && exists("g:netrw_file_cmd") -" " call Decho("read via ".b:netrw_file_cmd." (method #10)") - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_file_cmd." ".shellescape(b:netrw_fname,1)." ".tmpfile) +" " call Decho("read via ".b:netrw_file_cmd." (method #10)",'~'.expand("")) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_file_cmd." ".s:ShellEscape(b:netrw_fname,1)." ".tmpfile) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -2248,12 +2248,12 @@ fun! netrw#NetRead(mode,...) " NetRead: cleanup {{{3 if exists("b:netrw_method") -" call Decho("cleanup b:netrw_method and b:netrw_fname") +" call Decho("cleanup b:netrw_method and b:netrw_fname",'~'.expand("")) unlet b:netrw_method unlet b:netrw_fname endif if s:FileReadable(tmpfile) && tmpfile !~ '.tar.bz2$' && tmpfile !~ '.tar.gz$' && tmpfile !~ '.zip' && tmpfile !~ '.tar' && readcmd != 't' && tmpfile !~ '.tar.xz$' && tmpfile !~ '.txz' -" call Decho("cleanup by deleting tmpfile<".tmpfile.">") +" call Decho("cleanup by deleting tmpfile<".tmpfile.">",'~'.expand("")) NetrwKeepj call s:NetrwDelete(tmpfile) endif NetrwKeepj call s:NetrwOptionRestore("w:") @@ -2285,21 +2285,21 @@ fun! netrw#NetWrite(...) range endif let curbufname= expand("%") -" call Decho("curbufname<".curbufname.">") +" call Decho("curbufname<".curbufname.">",'~'.expand("")) if &binary " For binary writes, always write entire file. " (line numbers don't really make sense for that). " Also supports the writing of tar and zip files. -" call Decho("(write entire file) sil exe w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)) +" call Decho("(write entire file) sil exe w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile),'~'.expand("")) exe "sil NetrwKeepj w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) elseif g:netrw_cygwin " write (selected portion of) file to temporary let cygtmpfile= substitute(tmpfile,g:netrw_cygdrive.'/\(.\)','\1:','') -" call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile)) +" call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile),'~'.expand("")) exe "sil NetrwKeepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(cygtmpfile) else " write (selected portion of) file to temporary -" call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile)) +" call Decho("(write selected portion) sil exe ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile),'~'.expand("")) exe "sil NetrwKeepj ".a:firstline."," . a:lastline . "w! ".fnameescape(v:cmdarg)." ".fnameescape(tmpfile) endif @@ -2316,7 +2316,7 @@ fun! netrw#NetWrite(...) range " Process arguments: {{{4 " attempt to repeat with previous host-file-etc if exists("b:netrw_lastfile") && a:0 == 0 -" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">") +" call Decho("using b:netrw_lastfile<" . b:netrw_lastfile . ">",'~'.expand("")) let choice = b:netrw_lastfile let ichoice= ichoice + 1 else @@ -2364,7 +2364,7 @@ fun! netrw#NetWrite(...) range endif endif let ichoice= ichoice + 1 -" call Decho("choice<" . choice . "> ichoice=".ichoice) +" call Decho("choice<" . choice . "> ichoice=".ichoice,'~'.expand("")) " Determine method of write (ftp, rcp, etc) {{{4 NetrwKeepj call s:NetrwMethod(choice) @@ -2378,13 +2378,13 @@ fun! netrw#NetWrite(...) range " ============================ if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 echo "(netrw) Processing your write request..." -" call Decho("(netrw) Processing your write request...") +" call Decho("(netrw) Processing your write request...",'~'.expand("")) endif "......................................... " NetWrite: (rcp) NetWrite Method #1 {{{3 if b:netrw_method == 1 -" call Decho("write via rcp (method #1)") +" call Decho("write via rcp (method #1)",'~'.expand("")) if s:netrw_has_nt_rcp == 1 if exists("g:netrw_uid") && ( g:netrw_uid != "" ) let uid_machine = g:netrw_machine .'.'. g:netrw_uid @@ -2398,36 +2398,36 @@ fun! netrw#NetWrite(...) range let uid_machine = g:netrw_machine endif endif - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".shellescape(tmpfile,1)." ".shellescape(uid_machine.":".b:netrw_fname,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rcp_cmd." ".s:netrw_rcpmode." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(uid_machine.":".b:netrw_fname,1)) let b:netrw_lastfile = choice "......................................... " NetWrite: (ftp + <.netrc>) NetWrite Method #2 {{{3 elseif b:netrw_method == 2 -" call Decho("write via ftp+.netrc (method #2)") +" call Decho("write via ftp+.netrc (method #2)",'~'.expand("")) let netrw_fname = b:netrw_fname " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead let bhkeep = &l:bh let curbuf = bufnr("%") setl bh=hide - keepalt enew - -" call Decho("filter input window#".winnr()) + keepj keepalt enew + +" call Decho("filter input window#".winnr(),'~'.expand("")) setl ff=unix NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline("$")) +" call Decho("filter input: ".getline("$"),'~'.expand("")) endif NetrwKeepj call setline(line("$")+1,'put "'.tmpfile.'" "'.netrw_fname.'"') -" call Decho("filter input: ".getline("$")) +" call Decho("filter input: ".getline("$"),'~'.expand("")) if exists("g:netrw_port") && g:netrw_port != "" - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)) else -" call Decho("filter input window#".winnr()) - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) +" call Decho("filter input window#".winnr(),'~'.expand("")) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)) endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) if getline(1) !~ "^$" @@ -2449,44 +2449,44 @@ fun! netrw#NetWrite(...) range " NetWrite: (ftp + machine, id, passwd, filename) NetWrite Method #3 {{{3 elseif b:netrw_method == 3 " Construct execution string (three or more lines) which will be passed through filter -" call Decho("read via ftp+mipf (method #3)") +" call Decho("read via ftp+mipf (method #3)",'~'.expand("")) let netrw_fname = b:netrw_fname let bhkeep = &l:bh " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead let curbuf = bufnr("%") setl bh=hide - keepalt enew + keepj keepalt enew setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("")) else NetrwKeepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("")) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 NetrwKeepj put =g:netrw_uid -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("")) if exists("s:netrw_passwd") && s:netrw_passwd != "" NetrwKeepj put ='\"'.s:netrw_passwd.'\"' endif -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("")) elseif exists("s:netrw_passwd") && s:netrw_passwd != "" NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("")) endif endif NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline("$")) +" call Decho("filter input: ".getline("$"),'~'.expand("")) endif NetrwKeepj put ='put \"'.tmpfile.'\" \"'.netrw_fname.'\"' -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("")) " save choice/id/password for future use let b:netrw_lastfile = choice @@ -2513,23 +2513,23 @@ fun! netrw#NetWrite(...) range "......................................... " NetWrite: (scp) NetWrite Method #4 {{{3 elseif b:netrw_method == 4 -" call Decho("write via scp (method #4)") +" call Decho("write via scp (method #4)",'~'.expand("")) if exists("g:netrw_port") && g:netrw_port != "" let useport= " ".g:netrw_scpport." ".fnameescape(g:netrw_port) else let useport= "" endif - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)) let b:netrw_lastfile = choice "......................................... " NetWrite: (http) NetWrite Method #5 {{{3 elseif b:netrw_method == 5 -" call Decho("write via http (method #5)") +" call Decho("write via http (method #5)",'~'.expand("")) let curl= substitute(g:netrw_http_put_cmd,'\s\+.*$',"","") if executable(curl) let url= g:netrw_choice - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_put_cmd." ".shellescape(tmpfile,1)." ".shellescape(url,1) ) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_put_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(url,1) ) elseif !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,"can't write to http using <".g:netrw_http_put_cmd".">".",16) endif @@ -2537,7 +2537,7 @@ fun! netrw#NetWrite(...) range "......................................... " NetWrite: (dav) NetWrite Method #6 (cadaver) {{{3 elseif b:netrw_method == 6 -" call Decho("write via cadaver (method #6)") +" call Decho("write via cadaver (method #6)",'~'.expand("")) " Construct execution string (four lines) which will be passed through filter let netrw_fname = escape(b:netrw_fname,g:netrw_fname_escape) @@ -2546,7 +2546,7 @@ fun! netrw#NetWrite(...) range " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead let curbuf = bufnr("%") setl bh=hide - keepalt enew + keepj keepalt enew setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" @@ -2574,14 +2574,14 @@ fun! netrw#NetWrite(...) range "......................................... " NetWrite: (rsync) NetWrite Method #7 {{{3 elseif b:netrw_method == 7 -" call Decho("write via rsync (method #7)") - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".shellescape(tmpfile,1)." ".shellescape(g:netrw_machine.":".b:netrw_fname,1)) +" call Decho("write via rsync (method #7)",'~'.expand("")) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)) let b:netrw_lastfile = choice "......................................... " NetWrite: (sftp) NetWrite Method #9 {{{3 elseif b:netrw_method == 9 -" call Decho("write via sftp (method #9)") +" call Decho("write via sftp (method #9)",'~'.expand("")) let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) if exists("g:netrw_uid") && ( g:netrw_uid != "" ) let uid_machine = g:netrw_uid .'@'. g:netrw_machine @@ -2593,13 +2593,13 @@ fun! netrw#NetWrite(...) range let bhkeep = &l:bh let curbuf = bufnr("%") setl bh=hide - keepalt enew + keepj keepalt enew setl ff=unix call setline(1,'put "'.escape(tmpfile,'\').'" '.netrw_fname) -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("")) let sftpcmd= substitute(g:netrw_sftp_cmd,"%TEMPFILE%",escape(tmpfile,'\'),"g") - call s:NetrwExe(s:netrw_silentxfer."%!".sftpcmd.' '.shellescape(uid_machine,1)) + call s:NetrwExe(s:netrw_silentxfer."%!".sftpcmd.' '.s:ShellEscape(uid_machine,1)) let filtbuf= bufnr("%") exe curbuf."b!" let &l:bh = bhkeep @@ -2615,9 +2615,9 @@ fun! netrw#NetWrite(...) range endwhile " NetWrite: Cleanup: {{{3 -" call Decho("cleanup") +" call Decho("cleanup",'~'.expand("")) if s:FileReadable(tmpfile) -" call Decho("tmpfile<".tmpfile."> readable, will now delete it") +" call Decho("tmpfile<".tmpfile."> readable, will now delete it",'~'.expand("")) call s:NetrwDelete(tmpfile) endif call s:NetrwOptionRestore("w:") @@ -2625,12 +2625,12 @@ fun! netrw#NetWrite(...) range if a:firstline == 1 && a:lastline == line("$") " restore modifiability; usually equivalent to set nomod let &mod= mod -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) elseif !exists("leavemod") " indicate that the buffer has not been modified since last written -" call Decho("set nomod") +" call Decho("set nomod",'~'.expand("")) setl nomod -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) endif " call Dret("netrw#NetWrite") @@ -2659,11 +2659,11 @@ fun! netrw#NetSource(...) let i= 1 while i <= a:0 call netrw#NetRead(3,a:{i}) -" call Decho("s:netread_tmpfile<".s:netrw_tmpfile.">") +" call Decho("s:netread_tmpfile<".s:netrw_tmpfile.">",'~'.expand("")) if s:FileReadable(s:netrw_tmpfile) -" call Decho("exe so ".fnameescape(s:netrw_tmpfile)) +" call Decho("exe so ".fnameescape(s:netrw_tmpfile),'~'.expand("")) exe "so ".fnameescape(s:netrw_tmpfile) -" call Decho("delete(".s:netrw_tmpfile.")") +" call Decho("delete(".s:netrw_tmpfile.")",'~'.expand("")) call delete(s:netrw_tmpfile) unlet s:netrw_tmpfile else @@ -2683,33 +2683,37 @@ fun! netrw#SetTreetop(...) " clear out the current tree if exists("w:netrw_treetop") -" call Decho("clearing out current tree") +" call Decho("clearing out current tree",'~'.expand("")) let inittreetop= w:netrw_treetop unlet w:netrw_treetop endif if exists("w:netrw_treedict") -" call Decho("freeing w:netrw_treedict") +" call Decho("freeing w:netrw_treedict",'~'.expand("")) unlet w:netrw_treedict endif if a:1 == "" && exists("inittreetop") let treedir= s:NetrwTreePath(inittreetop) -" call Decho("treedir<".treedir.">") - else - if isdirectory(a:1) -" call Decho("a:1<".a:1."> is a directory") +" call Decho("treedir<".treedir.">",'~'.expand("")) + else + if isdirectory(s:NetrwFile(a:1)) +" call Decho("a:1<".a:1."> is a directory",'~'.expand("")) let treedir= a:1 - elseif exists("b:netrw_curdir") && isdirectory(b:netrw_curdir."/".a:1) + elseif exists("b:netrw_curdir") && (isdirectory(s:NetrwFile(b:netrw_curdir."/".a:1)) || a:1 =~ '^\a\{3,}://') let treedir= b:netrw_curdir."/".a:1 -" call Decho("a:1<".a:1."> is NOT a directory, trying treedir<".treedir.">") - else +" call Decho("a:1<".a:1."> is NOT a directory, trying treedir<".treedir.">",'~'.expand("")) + else + " normally the cursor is left in the message window. + " However, here this results in the directory being listed in the message window, which is not wanted. + let netrwbuf= bufnr("%") call netrw#ErrorMsg(s:ERROR,"sorry, ".a:1." doesn't seem to be a directory!",95) + exe bufwinnr(netrwbuf)."wincmd w" let treedir= "." endif endif -" call Decho("treedir<".treedir.">") - let islocal= expand("%") !~ '^\a\+://' -" call Decho("islocal=".islocal) +" call Decho("treedir<".treedir.">",'~'.expand("")) + let islocal= expand("%") !~ '^\a\{3,}://' +" call Decho("islocal=".islocal,'~'.expand("")) if islocal call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(islocal,treedir)) else @@ -2729,14 +2733,14 @@ fun! s:NetrwGetFile(readcmd, tfile, meth " readcmd=='t': simply do nothing if a:readcmd == 't' -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) " call Dret("NetrwGetFile : skip read of <".a:tfile.">") return endif " get name of remote filename (ie. url and all) let rfile= bufname("%") -" call Decho("rfile<".rfile.">") +" call Decho("rfile<".rfile.">",'~'.expand("")) if exists("*NetReadFixup") " for the use of NetReadFixup (not otherwise used internally) @@ -2745,7 +2749,7 @@ fun! s:NetrwGetFile(readcmd, tfile, meth if a:readcmd[0] == '%' " get file into buffer -" call Decho("get file into buffer") +" call Decho("get file into buffer",'~'.expand("")) " rename the current buffer to the temp file (ie. tfile) if g:netrw_cygwin @@ -2753,41 +2757,41 @@ fun! s:NetrwGetFile(readcmd, tfile, meth else let tfile= a:tfile endif -" call Decho("exe sil! keepalt file ".fnameescape(tfile)) +" call Decho("exe sil! keepalt file ".fnameescape(tfile),'~'.expand("")) exe "sil! keepalt file ".fnameescape(tfile) " edit temporary file (ie. read the temporary file in) if rfile =~ '\.zip$' -" call Decho("handling remote zip file with zip#Browse(tfile<".tfile.">)") +" call Decho("handling remote zip file with zip#Browse(tfile<".tfile.">)",'~'.expand("")) call zip#Browse(tfile) elseif rfile =~ '\.tar$' -" call Decho("handling remote tar file with tar#Browse(tfile<".tfile.">)") +" call Decho("handling remote tar file with tar#Browse(tfile<".tfile.">)",'~'.expand("")) call tar#Browse(tfile) elseif rfile =~ '\.tar\.gz$' -" call Decho("handling remote gzip-compressed tar file") +" call Decho("handling remote gzip-compressed tar file",'~'.expand("")) call tar#Browse(tfile) elseif rfile =~ '\.tar\.bz2$' -" call Decho("handling remote bz2-compressed tar file") +" call Decho("handling remote bz2-compressed tar file",'~'.expand("")) call tar#Browse(tfile) elseif rfile =~ '\.tar\.xz$' -" call Decho("handling remote xz-compressed tar file") +" call Decho("handling remote xz-compressed tar file",'~'.expand("")) call tar#Browse(tfile) elseif rfile =~ '\.txz$' -" call Decho("handling remote xz-compressed tar file (.txz)") +" call Decho("handling remote xz-compressed tar file (.txz)",'~'.expand("")) call tar#Browse(tfile) else -" call Decho("edit temporary file") +" call Decho("edit temporary file",'~'.expand("")) NetrwKeepj e! endif " rename buffer back to remote filename -" call Decho("exe sil! keepalt file ".fnameescape(rfile)) +" call Decho("exe sil! keepalt file ".fnameescape(rfile),'~'.expand("")) exe "sil! NetrwKeepj keepalt file ".fnameescape(rfile) " Detect filetype of local version of remote file. " Note that isk must not include a "/" for scripts.vim " to process this detection correctly. -" call Decho("detect filetype of local version of remote file") +" call Decho("detect filetype of local version of remote file",'~'.expand("")) let iskkeep= &l:isk setl isk-=/ let &l:isk= iskkeep @@ -2798,23 +2802,23 @@ fun! s:NetrwGetFile(readcmd, tfile, meth elseif !&ma " attempting to read a file after the current line in the file, but the buffer is not modifiable NetrwKeepj call netrw#ErrorMsg(s:WARNING,"attempt to read<".a:tfile."> into a non-modifiable buffer!",94) -" call Dret("NetrwGetFile : attempt to read<".a:tfile."> into a non-modifiable buffer!") +" call Dret("NetrwGetFile : attempt to read<".a:tfile."> into a non-modifiable buffer!") return elseif s:FileReadable(a:tfile) " read file after current line -" call Decho("read file<".a:tfile."> after current line") +" call Decho("read file<".a:tfile."> after current line",'~'.expand("")) let curline = line(".") let lastline= line("$") -" call Decho("exe<".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile)."> line#".curline) +" call Decho("exe<".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile)."> line#".curline,'~'.expand("")) exe "NetrwKeepj ".a:readcmd." ".fnameescape(v:cmdarg)." ".fnameescape(a:tfile) let line1= curline + 1 let line2= line("$") - lastline + 1 else " not readable -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") -" call Decho("tfile<".a:tfile."> not readable") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) +" call Decho("tfile<".a:tfile."> not readable",'~'.expand("")) NetrwKeepj call netrw#ErrorMsg(s:WARNING,"file <".a:tfile."> not readable",9) " call Dret("NetrwGetFile : tfile<".a:tfile."> not readable") return @@ -2822,10 +2826,10 @@ fun! s:NetrwGetFile(readcmd, tfile, meth " User-provided (ie. optional) fix-it-up command if exists("*NetReadFixup") -" call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")") +" call Decho("calling NetReadFixup(method<".a:method."> line1=".line1." line2=".line2.")",'~'.expand("")) NetrwKeepj call NetReadFixup(a:method, line1, line2) " else " Decho -" call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")") +" call Decho("NetReadFixup() not called, doesn't exist (line1=".line1." line2=".line2.")",'~'.expand("")) endif if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu @@ -2833,12 +2837,12 @@ fun! s:NetrwGetFile(readcmd, tfile, meth NetrwKeepj call s:UpdateBuffersMenu() endif -" call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> tfile<".a:tfile."> readable=".s:FileReadable(a:tfile)) +" call Decho("readcmd<".a:readcmd."> cmdarg<".v:cmdarg."> tfile<".a:tfile."> readable=".s:FileReadable(a:tfile),'~'.expand("")) " make sure file is being displayed " redraw! -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) " call Dret("NetrwGetFile") endfun @@ -2847,15 +2851,15 @@ endfun " Input: " choice = url [protocol:]//[userid@]hostname[:port]/[path-to-file] " Output: -" b:netrw_method= 1: rcp -" 2: ftp + <.netrc> -" 3: ftp + machine, id, password, and [path]filename -" 4: scp -" 5: http[s] (wget) +" b:netrw_method= 1: rcp +" 2: ftp + <.netrc> +" 3: ftp + machine, id, password, and [path]filename +" 4: scp +" 5: http[s] (wget) " 6: dav -" 7: rsync -" 8: fetch -" 9: sftp +" 7: rsync +" 8: fetch +" 9: sftp " 10: file " g:netrw_machine= hostname " b:netrw_fname = filename @@ -2876,7 +2880,7 @@ fun! s:NetrwMethod(choice) " curmachine used if protocol == ftp and no .netrc if exists("g:netrw_machine") let curmachine= g:netrw_machine -" call Decho("curmachine<".curmachine.">") +" call Decho("curmachine<".curmachine.">",'~'.expand("")) else let curmachine= "N O T A HOST" endif @@ -2921,11 +2925,11 @@ fun! s:NetrwMethod(choice) let sftpurm = '^sftp://\([^/]\{-}\)/\(.*\)\=$' let fileurm = '^file\=://\(.*\)$' -" call Decho("determine method:") +" call Decho("determine method:",'~'.expand("")) " Determine Method " Method#1: rcp://user@hostname/...path-to-file {{{3 if match(a:choice,rcpurm) == 0 -" call Decho("rcp://...") +" call Decho("rcp://...",'~'.expand("")) let b:netrw_method = 1 let userid = substitute(a:choice,rcpurm,'\1',"") let g:netrw_machine = substitute(a:choice,rcpurm,'\2',"") @@ -2936,7 +2940,7 @@ fun! s:NetrwMethod(choice) " Method#4: scp://user@hostname/...path-to-file {{{3 elseif match(a:choice,scpurm) == 0 -" call Decho("scp://...") +" call Decho("scp://...",'~'.expand("")) let b:netrw_method = 4 let g:netrw_machine = substitute(a:choice,scpurm,'\1',"") let g:netrw_port = substitute(a:choice,scpurm,'\2',"") @@ -2944,7 +2948,7 @@ fun! s:NetrwMethod(choice) " Method#5: http[s]://user@hostname/...path-to-file {{{3 elseif match(a:choice,httpurm) == 0 -" call Decho("http[s]://...") +" call Decho("http[s]://...",'~'.expand("")) let b:netrw_method = 5 let g:netrw_machine= substitute(a:choice,httpurm,'\1',"") let b:netrw_fname = substitute(a:choice,httpurm,'\2',"") @@ -2952,7 +2956,7 @@ fun! s:NetrwMethod(choice) " Method#6: dav://hostname[:port]/..path-to-file.. {{{3 elseif match(a:choice,davurm) == 0 -" call Decho("dav://...") +" call Decho("dav://...",'~'.expand("")) let b:netrw_method= 6 if a:choice =~ 'davs:' let g:netrw_machine= 'https://'.substitute(a:choice,davurm,'\1/\2',"") @@ -2963,19 +2967,19 @@ fun! s:NetrwMethod(choice) " Method#7: rsync://user@hostname/...path-to-file {{{3 elseif match(a:choice,rsyncurm) == 0 -" call Decho("rsync://...") +" call Decho("rsync://...",'~'.expand("")) let b:netrw_method = 7 let g:netrw_machine= substitute(a:choice,rsyncurm,'\1',"") let b:netrw_fname = substitute(a:choice,rsyncurm,'\2',"") " Methods 2,3: ftp://[user@]hostname[[:#]port]/...path-to-file {{{3 elseif match(a:choice,ftpurm) == 0 -" call Decho("ftp://...") +" call Decho("ftp://...",'~'.expand("")) let userid = substitute(a:choice,ftpurm,'\2',"") let g:netrw_machine= substitute(a:choice,ftpurm,'\3',"") let g:netrw_port = substitute(a:choice,ftpurm,'\4',"") let b:netrw_fname = substitute(a:choice,ftpurm,'\5',"") -" call Decho("g:netrw_machine<".g:netrw_machine.">") +" call Decho("g:netrw_machine<".g:netrw_machine.">",'~'.expand("")) if userid != "" let g:netrw_uid= userid endif @@ -3000,15 +3004,15 @@ fun! s:NetrwMethod(choice) call NetUserPass("ftp:".host) elseif (has("win32") || has("win95") || has("win64") || has("win16")) && s:netrw_ftp_cmd =~ '-[sS]:' -" call Decho("has -s: : s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">") -" call Decho(" g:netrw_ftp_cmd<".g:netrw_ftp_cmd.">") +" call Decho("has -s: : s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">",'~'.expand("")) +" call Decho(" g:netrw_ftp_cmd<".g:netrw_ftp_cmd.">",'~'.expand("")) if g:netrw_ftp_cmd =~ '-[sS]:\S*MACHINE\>' let s:netrw_ftp_cmd= substitute(g:netrw_ftp_cmd,'\',g:netrw_machine,'') -" call Decho("s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">") +" call Decho("s:netrw_ftp_cmd<".s:netrw_ftp_cmd.">",'~'.expand("")) endif let b:netrw_method= 2 elseif s:FileReadable(expand("$HOME/.netrc")) && !g:netrw_ignorenetrc -" call Decho("using <".expand("$HOME/.netrc")."> (readable)") +" call Decho("using <".expand("$HOME/.netrc")."> (readable)",'~'.expand("")) let b:netrw_method= 2 else if !exists("g:netrw_uid") || g:netrw_uid == "" @@ -3023,7 +3027,7 @@ fun! s:NetrwMethod(choice) " Method#8: fetch {{{3 elseif match(a:choice,fetchurm) == 0 -" call Decho("fetch://...") +" call Decho("fetch://...",'~'.expand("")) let b:netrw_method = 8 let g:netrw_userid = substitute(a:choice,fetchurm,'\2',"") let g:netrw_machine= substitute(a:choice,fetchurm,'\3',"") @@ -3032,7 +3036,7 @@ fun! s:NetrwMethod(choice) " Method#3: Issue an ftp : "machine id password [path/]filename" {{{3 elseif match(a:choice,mipf) == 0 -" call Decho("(ftp) host id pass file") +" call Decho("(ftp) host id pass file",'~'.expand("")) let b:netrw_method = 3 let g:netrw_machine = substitute(a:choice,mipf,'\1',"") let g:netrw_uid = substitute(a:choice,mipf,'\2',"") @@ -3042,7 +3046,7 @@ fun! s:NetrwMethod(choice) " Method#3: Issue an ftp: "hostname [path/]filename" {{{3 elseif match(a:choice,mf) == 0 -" call Decho("(ftp) host file") +" call Decho("(ftp) host file",'~'.expand("")) if exists("g:netrw_uid") && exists("s:netrw_passwd") let b:netrw_method = 3 let g:netrw_machine = substitute(a:choice,mf,'\1',"") @@ -3056,32 +3060,32 @@ fun! s:NetrwMethod(choice) " Method#9: sftp://user@hostname/...path-to-file {{{3 elseif match(a:choice,sftpurm) == 0 -" call Decho("sftp://...") +" call Decho("sftp://...",'~'.expand("")) let b:netrw_method = 9 let g:netrw_machine= substitute(a:choice,sftpurm,'\1',"") let b:netrw_fname = substitute(a:choice,sftpurm,'\2',"") " Method#1: Issue an rcp: hostname:filename" (this one should be last) {{{3 elseif match(a:choice,rcphf) == 0 -" call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">") +" call Decho("(rcp) [user@]host:file) rcphf<".rcphf.">",'~'.expand("")) let b:netrw_method = 1 let userid = substitute(a:choice,rcphf,'\2',"") let g:netrw_machine = substitute(a:choice,rcphf,'\3',"") let b:netrw_fname = substitute(a:choice,rcphf,'\4',"") -" call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">") -" call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">") -" call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">") -" call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">") +" call Decho('\1<'.substitute(a:choice,rcphf,'\1',"").">",'~'.expand("")) +" call Decho('\2<'.substitute(a:choice,rcphf,'\2',"").">",'~'.expand("")) +" call Decho('\3<'.substitute(a:choice,rcphf,'\3',"").">",'~'.expand("")) +" call Decho('\4<'.substitute(a:choice,rcphf,'\4',"").">",'~'.expand("")) if userid != "" let g:netrw_uid= userid endif " Method#10: file://user@hostname/...path-to-file {{{3 elseif match(a:choice,fileurm) == 0 && exists("g:netrw_file_cmd") -" call Decho("http[s]://...") +" call Decho("http[s]://...",'~'.expand("")) let b:netrw_method = 10 let b:netrw_fname = substitute(a:choice,fileurm,'\1',"") -" call Decho('\1<'.substitute(a:choice,fileurm,'\1',"").">") +" call Decho('\1<'.substitute(a:choice,fileurm,'\1',"").">",'~'.expand("")) " Cannot Determine Method {{{3 else @@ -3100,17 +3104,17 @@ fun! s:NetrwMethod(choice) let g:netrw_port= netrw_port endif -" call Decho("a:choice <".a:choice.">") -" call Decho("b:netrw_method <".b:netrw_method.">") -" call Decho("g:netrw_machine<".g:netrw_machine.">") -" call Decho("g:netrw_port <".g:netrw_port.">") +" call Decho("a:choice <".a:choice.">",'~'.expand("")) +" call Decho("b:netrw_method <".b:netrw_method.">",'~'.expand("")) +" call Decho("g:netrw_machine<".g:netrw_machine.">",'~'.expand("")) +" call Decho("g:netrw_port <".g:netrw_port.">",'~'.expand("")) " if exists("g:netrw_uid") "Decho -" call Decho("g:netrw_uid <".g:netrw_uid.">") +" call Decho("g:netrw_uid <".g:netrw_uid.">",'~'.expand("")) " endif "Decho " if exists("s:netrw_passwd") "Decho -" call Decho("s:netrw_passwd <".s:netrw_passwd.">") +" call Decho("s:netrw_passwd <".s:netrw_passwd.">",'~'.expand("")) " endif "Decho -" call Decho("b:netrw_fname <".b:netrw_fname.">") +" call Decho("b:netrw_fname <".b:netrw_fname.">",'~'.expand("")) " call Dret("NetrwMethod : b:netrw_method=".b:netrw_method." g:netrw_port=".g:netrw_port) endfun @@ -3189,14 +3193,14 @@ fun! NetUserPass(...) if a:1 =~ '^ftp:' " get host from ftp:... url " access userid and password from hup (host-user-passwd) dictionary -" call Decho("case a:0=1: a:1<".a:1."> (get host from ftp:... url)") +" call Decho("case a:0=1: a:1<".a:1."> (get host from ftp:... url)",'~'.expand("")) let host = substitute(a:1,'^ftp:','','') let host = substitute(host,'\..*','','') if exists("s:netrw_hup[host]") let g:netrw_uid = s:netrw_hup[host].uid let s:netrw_passwd = s:netrw_hup[host].passwd -" call Decho("get s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">") -" call Decho("get s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">") +" call Decho("get s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">",'~'.expand("")) +" call Decho("get s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">",'~'.expand("")) else let g:netrw_uid = input("Enter UserId: ") let s:netrw_passwd = inputsecret("Enter Password: ") @@ -3204,7 +3208,7 @@ fun! NetUserPass(...) else " case: one input argument, not an url. Using it as a new user-id. -" call Decho("case a:0=1: a:1<".a:1."> (get host from input argument, not an url)") +" call Decho("case a:0=1: a:1<".a:1."> (get host from input argument, not an url)",'~'.expand("")) if exists("g:netrw_machine") if g:netrw_machine =~ '[0-9.]\+' let host= g:netrw_machine @@ -3215,7 +3219,7 @@ fun! NetUserPass(...) let g:netrw_machine= input('Enter hostname: ') endif let g:netrw_uid = a:1 -" call Decho("set g:netrw_uid= <".g:netrw_uid.">") +" call Decho("set g:netrw_uid= <".g:netrw_uid.">",'~'.expand("")) if exists("g:netrw_passwd") " ask for password if one not previously entered let s:netrw_passwd= g:netrw_passwd @@ -3224,7 +3228,7 @@ fun! NetUserPass(...) endif endif -" call Decho("host<".host.">") +" call Decho("host<".host.">",'~'.expand("")) if exists("host") if !exists('s:netrw_hup[host]') let s:netrw_hup[host]= {} @@ -3248,8 +3252,8 @@ fun! NetUserPass(...) let s:netrw_hup[host].passwd = a:3 let g:netrw_uid = s:netrw_hup[host].uid let s:netrw_passwd = s:netrw_hup[host].passwd -" call Decho("set s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">") -" call Decho("set s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">") +" call Decho("set s:netrw_hup[".host."].uid <".s:netrw_hup[host].uid.">",'~'.expand("")) +" call Decho("set s:netrw_hup[".host."].passwd<".s:netrw_hup[host].passwd.">",'~'.expand("")) endif " call Dret("NetUserPass : uid<".g:netrw_uid."> passwd<".s:netrw_passwd.">") @@ -3264,9 +3268,9 @@ endfun fun! s:ExplorePatHls(pattern) " call Dfunc("s:ExplorePatHls(pattern<".a:pattern.">)") let repat= substitute(a:pattern,'^**/\{1,2}','','') -" call Decho("repat<".repat.">") +" call Decho("repat<".repat.">",'~'.expand("")) let repat= escape(repat,'][.\') -" call Decho("repat<".repat.">") +" call Decho("repat<".repat.">",'~'.expand("")) let repat= '\<'.substitute(repat,'\*','\\(\\S\\+ \\)*\\S\\+','g').'\>' " call Dret("s:ExplorePatHls repat<".repat.">") return repat @@ -3293,7 +3297,7 @@ fun! s:NetrwBookHistHandler(chg,curdir) if a:chg == 0 " bookmark the current directory -" call Decho("(user: ) bookmark the current directory") +" call Decho("(user: ) bookmark the current directory",'~'.expand("")) if exists("s:netrwmarkfilelist_{curbufnr}") call s:NetrwBookmark(0) echo "bookmarked marked files" @@ -3304,9 +3308,9 @@ fun! s:NetrwBookHistHandler(chg,curdir) elseif a:chg == 1 " change to the bookmarked directory -" call Decho("(user: <".v:count."gb>) change to the bookmarked directory") +" call Decho("(user: <".v:count."gb>) change to the bookmarked directory",'~'.expand("")) if exists("g:netrw_bookmarklist[v:count-1]") -" call Decho("(user: <".v:count."gb>) bookmarklist=".string(g:netrw_bookmarklist)) +" call Decho("(user: <".v:count."gb>) bookmarklist=".string(g:netrw_bookmarklist),'~'.expand("")) exe "NetrwKeepj e ".fnameescape(g:netrw_bookmarklist[v:count-1]) else echomsg "Sorry, bookmark#".v:count." doesn't exist!" @@ -3316,12 +3320,12 @@ fun! s:NetrwBookHistHandler(chg,curdir) " redraw! let didwork= 0 " list user's bookmarks -" call Decho("(user: ) list user's bookmarks") +" call Decho("(user: ) list user's bookmarks",'~'.expand("")) if exists("g:netrw_bookmarklist") -" call Decho('list '.len(g:netrw_bookmarklist).' bookmarks') +" call Decho('list '.len(g:netrw_bookmarklist).' bookmarks','~'.expand("")) let cnt= 1 for bmd in g:netrw_bookmarklist -" call Decho("Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1]) +" call Decho("Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1],'~'.expand("")) echo printf("Netrw Bookmark#%-2d: %s",cnt,g:netrw_bookmarklist[cnt-1]) let didwork = 1 let cnt = cnt + 1 @@ -3334,9 +3338,9 @@ fun! s:NetrwBookHistHandler(chg,curdir) let histcnt = 0 if g:netrw_dirhistmax > 0 while ( first || cnt != g:netrw_dirhist_cnt ) -" call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:netrw_dirhist_cnt) +" call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:netrw_dirhist_cnt,'~'.expand("")) if exists("g:netrw_dirhist_{cnt}") -" call Decho("Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt}) +" call Decho("Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt},'~'.expand("")) echo printf("Netrw History#%-2d: %s",histcnt,g:netrw_dirhist_{cnt}) let didwork= 1 endif @@ -3356,18 +3360,18 @@ fun! s:NetrwBookHistHandler(chg,curdir) elseif a:chg == 3 " saves most recently visited directories (when they differ) -" call Decho("(browsing) record curdir history") +" call Decho("(browsing) record curdir history",'~'.expand("")) if !exists("g:netrw_dirhist_cnt") || !exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") || g:netrw_dirhist_{g:netrw_dirhist_cnt} != a:curdir if g:netrw_dirhistmax > 0 let g:netrw_dirhist_cnt = ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax let g:netrw_dirhist_{g:netrw_dirhist_cnt} = a:curdir endif -" call Decho("save dirhist#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") +" call Decho("save dirhist#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">",'~'.expand("")) endif elseif a:chg == 4 " u: change to the previous directory stored on the history list -" call Decho("(user: ) chg to prev dir from history") +" call Decho("(user: ) chg to prev dir from history",'~'.expand("")) if g:netrw_dirhistmax > 0 let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - v:count1 ) % g:netrw_dirhistmax if g:netrw_dirhist_cnt < 0 @@ -3377,16 +3381,16 @@ fun! s:NetrwBookHistHandler(chg,curdir) let g:netrw_dirhist_cnt= 0 endif if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") -" call Decho("changedir u#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") +" call Decho("changedir u#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">",'~'.expand("")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") setl ma noro -" call Decho("setl ma noro") - sil! NetrwKeepj %d +" call Decho("setl ma noro",'~'.expand("")) + sil! NetrwKeepj %d _ setl nomod -" call Decho("setl nomod") -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") - endif -" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})) +" call Decho("setl nomod",'~'.expand("")) +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) + endif +" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}),'~'.expand("")) exe "NetrwKeepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) else if g:netrw_dirhistmax > 0 @@ -3399,21 +3403,21 @@ fun! s:NetrwBookHistHandler(chg,curdir) elseif a:chg == 5 " U: change to the subsequent directory stored on the history list -" call Decho("(user: ) chg to next dir from history") +" call Decho("(user: ) chg to next dir from history",'~'.expand("")) if g:netrw_dirhistmax > 0 let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") -" call Decho("changedir U#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">") +" call Decho("changedir U#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">",'~'.expand("")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") -" call Decho("setl ma noro") +" call Decho("setl ma noro",'~'.expand("")) setl ma noro - sil! NetrwKeepj %d -" call Decho("removed all lines from buffer (%d)") -" call Decho("setl nomod") + sil! NetrwKeepj %d _ +" call Decho("removed all lines from buffer (%d)",'~'.expand("")) +" call Decho("setl nomod",'~'.expand("")) setl nomod -" call Decho("(set nomod) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") - endif -" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt})) +" call Decho("(set nomod) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) + endif +" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}),'~'.expand("")) exe "NetrwKeepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) else let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - 1 ) % g:netrw_dirhistmax @@ -3428,18 +3432,22 @@ fun! s:NetrwBookHistHandler(chg,curdir) endif elseif a:chg == 6 +" call Decho("(user: ) delete bookmark'd directory",'~'.expand("")) if exists("s:netrwmarkfilelist_{curbufnr}") call s:NetrwBookmark(1) echo "removed marked files from bookmarks" else " delete the v:count'th bookmark -" call Decho("delete bookmark#".v:count."<".g:netrw_bookmarklist[v:count-1].">") + let iremove = v:count + let dremove = g:netrw_bookmarklist[iremove - 1] +" call Decho("delete bookmark#".iremove."<".g:netrw_bookmarklist[iremove - 1].">",'~'.expand("")) call s:MergeBookmarks() -" call Decho("remove g:netrw_bookmarklist[".(v:count-1)."]") - NetrwKeepj call remove(g:netrw_bookmarklist,v:count-1) - echo "removed current directory from bookmarks" - endif -" call Decho("resulting g:netrw_bookmarklist=".string(g:netrw_bookmarklist)) +" call Decho("remove g:netrw_bookmarklist[".(iremove-1)."]<".g:netrw_bookmarklist[(iremove-1)].">",'~'.expand("")) + NetrwKeepj call remove(g:netrw_bookmarklist,iremove-1) + echo "removed ".dremove." from g:netrw_bookmarklist" +" call Decho("g:netrw_bookmarklist=".string(g:netrw_bookmarklist),'~'.expand("")) + endif +" call Decho("resulting g:netrw_bookmarklist=".string(g:netrw_bookmarklist),'~'.expand("")) endif call s:NetrwBookmarkMenu() call s:NetrwTgtMenu() @@ -3461,14 +3469,14 @@ fun! s:NetrwBookHistRead() if !exists("s:netrw_initbookhist") let home = s:NetrwHome() let savefile= home."/.netrwbook" - if filereadable(savefile) -" call Decho("sourcing .netrwbook") + if filereadable(s:NetrwFile(savefile)) +" call Decho("sourcing .netrwbook",'~'.expand("")) exe "keepalt NetrwKeepj so ".savefile endif if g:netrw_dirhistmax > 0 let savefile= home."/.netrwhist" - if filereadable(savefile) -" call Decho("sourcing .netrwhist") + if filereadable(s:NetrwFile(savefile)) +" call Decho("sourcing .netrwhist",'~'.expand("")) exe "keepalt NetrwKeepj so ".savefile endif let s:netrw_initbookhist= 1 @@ -3500,7 +3508,7 @@ fun! s:NetrwBookHistSave() setl nocin noai noci magic nospell nohid wig= noaw setl ma noro write if exists("+acd") | setl noacd | endif - sil! NetrwKeepj keepalt %d + sil! NetrwKeepj keepalt %d _ " save .netrwhist -- no attempt to merge sil! keepalt file .netrwhist @@ -3514,12 +3522,12 @@ fun! s:NetrwBookHistSave() endwhile exe "sil! w! ".savefile - sil NetrwKeepj %d + sil NetrwKeepj %d _ if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] " merge and write .netrwbook let savefile= s:NetrwHome()."/.netrwbook" - if filereadable(savefile) + if filereadable(s:NetrwFile(savefile)) let booklist= deepcopy(g:netrw_bookmarklist) exe "sil NetrwKeepj keepalt so ".savefile for bdm in booklist @@ -3546,10 +3554,12 @@ endfun " list of the contents of a local or remote directory. It is assumed that the " g:netrw_list_cmd has a string, USEPORT HOSTNAME, that needs to be substituted " with the requested remote hostname first. +" Often called via: Explore/e dirname/etc -> netrw#LocalBrowseCheck() -> s:NetrwBrowse() 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("%")."> win#".winnr()) -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) +" call Decho("modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) " call Dredir("ls!") " save alternate-file's filename if w:netrw_rexlocal doesn't exist @@ -3564,7 +3574,7 @@ fun! s:NetrwBrowse(islocal,dirname) endif " s:NetrwBrowse : simplify the dirname (especially for ".."s in dirnames) {{{3 - if a:dirname !~ '^\a\+://' + if a:dirname !~ '^\a\{3,}://' let dirname= simplify(a:dirname) else let dirname= a:dirname @@ -3572,7 +3582,7 @@ fun! s:NetrwBrowse(islocal,dirname) if exists("s:netrw_skipbrowse") unlet s:netrw_skipbrowse -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." filename<".expand("%")."> win#".winnr()." ft<".&ft.">") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." filename<".expand("%")."> win#".winnr()." ft<".&ft.">",'~'.expand("")) " call Dret("s:NetrwBrowse : s:netrw_skipbrowse existed") return endif @@ -3590,54 +3600,54 @@ fun! s:NetrwBrowse(islocal,dirname) endif " s:NetrwBrowse : save options: {{{3 - call s:NetrwOptionSave("w:") + call s:NetrwOptionSave("w:") " s:NetrwBrowse : re-instate any marked files {{{3 if exists("s:netrwmarkfilelist_{bufnr('%')}") -" call Decho("clearing marked files") +" call Decho("clearing marked files",'~'.expand("")) exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" endif if a:islocal && exists("w:netrw_acdkeep") && w:netrw_acdkeep " s:NetrwBrowse : set up "safe" options for local directory/file {{{3 -" call Decho("handle w:netrw_acdkeep:") -" call Decho("NetrwKeepj lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")") +" call Decho("handle w:netrw_acdkeep:",'~'.expand("")) +" call Decho("NetrwKeepj lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")",'~'.expand("")) call s:NetrwLcd(dirname) call s:NetrwSafeOptions() -" call Decho("getcwd<".getcwd().">") +" call Decho("getcwd<".getcwd().">",'~'.expand("")) elseif !a:islocal && dirname !~ '[\/]$' && dirname !~ '^"' " s:NetrwBrowse : remote regular file handler {{{3 -" call Decho("handle remote regular file: dirname<".dirname.">") +" call Decho("handle remote regular file: dirname<".dirname.">",'~'.expand("")) if bufname(dirname) != "" -" call Decho("edit buf#".bufname(dirname)." in win#".winnr()) +" call Decho("edit buf#".bufname(dirname)." in win#".winnr(),'~'.expand("")) exe "NetrwKeepj b ".bufname(dirname) else " attempt transfer of remote regular file -" call Decho("attempt transfer as regular file<".dirname.">") +" call Decho("attempt transfer as regular file<".dirname.">",'~'.expand("")) " remove any filetype indicator from end of dirname, except for the " "this is a directory" indicator (/). " There shouldn't be one of those here, anyway. let path= substitute(dirname,'[*=@|]\r\=$','','e') -" call Decho("new path<".path.">") +" call Decho("new path<".path.">",'~'.expand("")) call s:RemotePathAnalysis(dirname) " s:NetrwBrowse : remote-read the requested file into current buffer {{{3 call s:NetrwEnew(dirname) call s:NetrwSafeOptions() setl ma noro -" call Decho("setl ma noro") +" call Decho("setl ma noro",'~'.expand("")) let b:netrw_curdir = dirname let url = s:method."://".((s:user == "")? "" : s:user."@").s:machine.(s:port ? ":".s:port : "")."/".s:path -" call Decho("exe sil! keepalt file ".fnameescape(url)." (bt=".&bt.")") +" call Decho("exe sil! keepalt file ".fnameescape(url)." (bt=".&bt.")",'~'.expand("")) exe "sil! NetrwKeepj keepalt file ".fnameescape(url) exe "sil! NetrwKeepj keepalt doau BufReadPre ".fnameescape(s:fname) sil call netrw#NetRead(2,url) " netrw.vim and tar.vim have already handled decompression of the tarball; avoiding gzip.vim error -" call Decho("url<".url.">") -" call Decho("s:path<".s:path.">") -" call Decho("s:fname<".s:fname.">") +" call Decho("url<".url.">",'~'.expand("")) +" call Decho("s:path<".s:path.">",'~'.expand("")) +" call Decho("s:fname<".s:fname.">",'~'.expand("")) if s:path =~ '.bz2' exe "sil NetrwKeepj keepalt doau BufReadPost ".fnameescape(substitute(s:fname,'\.bz2$','','')) elseif s:path =~ '.gz' @@ -3652,9 +3662,9 @@ fun! s:NetrwBrowse(islocal,dirname) " s:NetrwBrowse : save certain window-oriented variables into buffer-oriented variables {{{3 call s:SetBufWinVars() call s:NetrwOptionRestore("w:") -" call Decho("setl ma nomod") +" call Decho("setl ma nomod",'~'.expand("")) setl ma nomod noro -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) " call Dret("s:NetrwBrowse : file<".s:fname.">") return @@ -3672,29 +3682,30 @@ fun! s:NetrwBrowse(islocal,dirname) NetrwKeepj call s:NetrwMenu(1) " get/set-up buffer {{{3 -" call Decho("saving position across a buffer refresh") +" call Decho("saving position across a buffer refresh",'~'.expand("")) let svpos = netrw#SavePosn() let reusing= s:NetrwGetBuffer(a:islocal,dirname) + " maintain markfile highlighting if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" -" call Decho("bufnr(%)=".bufnr('%')) -" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/") +" call Decho("bufnr(%)=".bufnr('%'),'~'.expand("")) +" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/",'~'.expand("")) exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" else -" call Decho("2match none") +" call Decho("2match none",'~'.expand("")) 2match none endif if reusing && line("$") > 1 call s:NetrwOptionRestore("w:") -" call Decho("setl noma nomod nowrap") +" call Decho("setl noma nomod nowrap",'~'.expand("")) setl noma nomod nowrap -" call Decho("(set noma nomod nowrap) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("(set noma nomod nowrap) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) " call Dret("s:NetrwBrowse : re-using not-cleared buffer") return endif " set b:netrw_curdir to the new directory name {{{3 -" call Decho("set b:netrw_curdir to the new directory name<".dirname."> (buf#".bufnr("%").")") +" call Decho("set b:netrw_curdir to the new directory name<".dirname."> (buf#".bufnr("%").")",'~'.expand("")) let b:netrw_curdir= dirname if b:netrw_curdir =~ '[/\\]$' let b:netrw_curdir= substitute(b:netrw_curdir,'[/\\]$','','e') @@ -3715,21 +3726,21 @@ fun! s:NetrwBrowse(islocal,dirname) if !a:islocal && b:netrw_curdir !~ '/$' let b:netrw_curdir= b:netrw_curdir.'/' endif -" call Decho("b:netrw_curdir<".b:netrw_curdir.">") +" call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("")) " ------------ " (local only) {{{3 " ------------ if a:islocal -" call Decho("local only:") +" call Decho("local only:",'~'.expand("")) " Set up ShellCmdPost handling. Append current buffer to browselist call s:LocalFastBrowser() " handle g:netrw_keepdir: set vim's current directory to netrw's notion of the current directory {{{3 if !g:netrw_keepdir -" call Decho("handle g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) -" call Decho("l:acd".(exists("&l:acd")? "=".&l:acd : " doesn't exist")) +" call Decho("handle g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("")) +" call Decho("l:acd".(exists("&l:acd")? "=".&l:acd : " doesn't exist"),'~'.expand("")) if !exists("&l:acd") || !&l:acd call s:NetrwLcd(b:netrw_curdir) endif @@ -3739,23 +3750,23 @@ fun! s:NetrwBrowse(islocal,dirname) " remote handling: {{{3 " -------------------------------- else -" call Decho("remote only:") +" call Decho("remote only:",'~'.expand("")) " analyze dirname and g:netrw_list_cmd {{{3 -" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> dirname<".dirname.">") +" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> dirname<".dirname.">",'~'.expand("")) if dirname =~ "^NetrwTreeListing\>" let dirname= b:netrw_curdir -" call Decho("(dirname was ) dirname<".dirname.">") +" call Decho("(dirname was ) dirname<".dirname.">",'~'.expand("")) elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") let dirname= substitute(b:netrw_curdir,'\\','/','g') if dirname !~ '/$' let dirname= dirname.'/' endif let b:netrw_curdir = dirname -" call Decho("(liststyle is TREELIST) dirname<".dirname.">") +" call Decho("(liststyle is TREELIST) dirname<".dirname.">",'~'.expand("")) else let dirname = substitute(dirname,'\\','/','g') -" call Decho("(normal) dirname<".dirname.">") +" call Decho("(normal) dirname<".dirname.">",'~'.expand("")) endif let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$' @@ -3764,14 +3775,14 @@ fun! s:NetrwBrowse(islocal,dirname) NetrwKeepj call netrw#ErrorMsg(s:ERROR,"netrw doesn't understand your dirname<".dirname.">",20) endif NetrwKeepj call s:NetrwOptionRestore("w:") -" call Decho("setl noma nomod nowrap") +" call Decho("setl noma nomod nowrap",'~'.expand("")) setl noma nomod nowrap -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) " call Dret("s:NetrwBrowse : badly formatted dirname<".dirname.">") return endif let b:netrw_curdir= dirname -" call Decho("b:netrw_curdir<".b:netrw_curdir."> (remote)") +" call Decho("b:netrw_curdir<".b:netrw_curdir."> (remote)",'~'.expand("")) endif " (additional remote handling) " ----------------------- @@ -3780,29 +3791,82 @@ fun! s:NetrwBrowse(islocal,dirname) NetrwKeepj call s:NetrwMaps(a:islocal) NetrwKeepj call s:NetrwCommands(a:islocal) NetrwKeepj call s:PerformListing(a:islocal) + + " If there is a rexposn: restore position with rexposn + " Otherwise : set rexposn + if exists("s:rexposn_".bufnr("%")) + NetrwKeepj call netrw#RestorePosn(s:rexposn_{bufnr('%')}) + else + NetrwKeepj call s:SetRexDir(a:islocal,b:netrw_curdir) + endif if v:version >= 700 && has("balloon_eval") && &beval == 0 && &l:bexpr == "" && !exists("g:netrw_nobeval") let &l:bexpr= "netrw#BalloonHelp()" -" call Decho("set up balloon help: l:bexpr=".&l:bexpr) +" call Decho("set up balloon help: l:bexpr=".&l:bexpr,'~'.expand("")) setl beval endif call s:NetrwOptionRestore("w:") - - " restore position and jumplist entry - if !reusing -" call Decho("restoring position across buffer refresh") +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) + + " restore position + if reusing +" call Decho("reusing=".reusing.": restoring position across buffer refresh",'~'.expand("")) call netrw#RestorePosn(svpos) endif " The s:LocalBrowseRefresh() function is called by an autocmd " installed by s:LocalFastBrowser() when g:netrw_fastbrowse <= 1 (ie. slow, medium speed). " However, s:NetrwBrowse() causes the FocusGained event to fire the firstt time. - -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) " call Dret("s:NetrwBrowse : did PerformListing ft<".&ft.">") return endfun " --------------------------------------------------------------------- +" s:NetrwFile: because of g:netrw_keepdir, isdirectory(), type(), etc may or {{{2 +" may not apply correctly; ie. netrw's idea of the current directory may +" differ from vim's. This function insures that netrw's idea of the current +" directory is used. +fun! s:NetrwFile(fname) +" call Dfunc("s:NetrwFile(fname<".a:fname.">)") + + if g:netrw_keepdir + " vim's idea of the current directory possibly may differ from netrw's + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() + endif + + if !exists("g:netrw_cygwin") && (has("win32") || has("win95") || has("win64") || has("win16")) + if a:fname =~ '^\' || a:fname =~ '^\a:\' + " windows, but full path given + let ret= a:fname +" call Decho("windows+full path: isdirectory(".a:fname.")",'~'.expand("")) + else + " windows, relative path given + let ret= s:ComposePath(b:netrw_curdir,a:fname) +" call Decho("windows+rltv path: isdirectory(".a:fname.")",'~'.expand("")) + endif + + elseif a:fname =~ '^/' + " not windows, full path given + let ret= a:fname +" call Decho("unix+full path: isdirectory(".a:fname.")",'~'.expand("")) + else + " not windows, relative path given + let ret= s:ComposePath(b:netrw_curdir,a:fname) +" call Decho("unix+rltv path: isdirectory(".a:fname.")",'~'.expand("")) + endif + else + " vim and netrw agree on the current directory + let ret= a:fname +" call Decho("vim and netrw agree on current directory (g:netrw_keepdir=".g:netrw_keepdir.")",'~'.expand("")) + endif + +" call Dret("s:NetrwFile ".ret) + return ret +endfun + +" --------------------------------------------------------------------- " s:NetrwFileInfo: supports qf (query for file information) {{{2 fun! s:NetrwFileInfo(islocal,fname) " call Dfunc("s:NetrwFileInfo(islocal=".a:islocal." fname<".a:fname.">) b:netrw_curdir<".b:netrw_curdir.">") @@ -3811,40 +3875,34 @@ fun! s:NetrwFileInfo(islocal,fname) if (has("unix") || has("macunix")) && executable("/bin/ls") if getline(".") == "../" - echo system("/bin/ls -lsad ".shellescape("..")) -" call Decho("#1: echo system(/bin/ls -lsad ".shellescape(..).")") + echo system("/bin/ls -lsad ".s:ShellEscape("..")) +" call Decho("#1: echo system(/bin/ls -lsad ".s:ShellEscape(..).")",'~'.expand("")) elseif w:netrw_liststyle == s:TREELIST && getline(".") !~ '^'.s:treedepthstring - echo system("/bin/ls -lsad ".shellescape(b:netrw_curdir)) -" call Decho("#2: echo system(/bin/ls -lsad ".shellescape(b:netrw_curdir).")") + echo system("/bin/ls -lsad ".s:ShellEscape(b:netrw_curdir)) +" call Decho("#2: echo system(/bin/ls -lsad ".s:ShellEscape(b:netrw_curdir).")",'~'.expand("")) elseif exists("b:netrw_curdir") - if b:netrw_curdir =~ '/$' - echo system("/bin/ls -lsad ".shellescape(b:netrw_curdir.a:fname)) -" call Decho("#3: echo system(/bin/ls -lsad ".shellescape(b:netrw_curdir.a:fname).")") - - else - echo system("/bin/ls -lsad ".shellescape(b:netrw_curdir."/".a:fname)) -" call Decho("#4: echo system(/bin/ls -lsad ".shellescape(b:netrw_curdir."/".a:fname).")") - endif + echo system("/bin/ls -lsad ".s:ShellEscape(s:ComposePath(b:netrw_curdir,a:fname))) +" call Decho("#3: echo system(/bin/ls -lsad ".s:ShellEscape(b:netrw_curdir.a:fname).")",'~'.expand("")) else -" call Decho('using ls '.a:fname." using cwd<".getcwd().">") - echo system("/bin/ls -lsad ".shellescape(a:fname)) -" call Decho("#5: echo system(/bin/ls -lsad ".shellescape(a:fname).")") +" call Decho('using ls '.a:fname." using cwd<".getcwd().">",'~'.expand("")) + echo system("/bin/ls -lsad ".s:ShellEscape(s:NetrwFile(a:fname))) +" call Decho("#5: echo system(/bin/ls -lsad ".s:ShellEscape(a:fname).")",'~'.expand("")) endif else " use vim functions to return information about file below cursor -" call Decho("using vim functions to query for file info") - if !isdirectory(a:fname) && !filereadable(a:fname) && a:fname =~ '[*@/]' +" call Decho("using vim functions to query for file info",'~'.expand("")) + if !isdirectory(s:NetrwFile(a:fname)) && !filereadable(s:NetrwFile(a:fname)) && a:fname =~ '[*@/]' let fname= substitute(a:fname,".$","","") else let fname= a:fname endif - let t = getftime(fname) - let sz = getfsize(fname) - echo a:fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname)) -" call Decho("fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname))) + let t = getftime(s:NetrwFile(fname)) + let sz = getfsize(s:NetrwFile(fname)) + echo a:fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(s:NetrwFile(fname))) +" call Decho("fname.": ".sz." ".strftime(g:netrw_timefmt,getftime(fname)),'~'.expand("")) endif else echo "sorry, \"qf\" not supported yet for remote files" @@ -3856,45 +3914,46 @@ endfun " --------------------------------------------------------------------- " s:NetrwGetBuffer: {{{2 " returns 0=cleared buffer -" 1=re-used buffer +" 1=re-used buffer (buffer not cleared) fun! s:NetrwGetBuffer(islocal,dirname) " call Dfunc("s:NetrwGetBuffer(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".g:netrw_liststyle) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) let dirname= a:dirname " re-use buffer if possible {{{3 -" call Decho("--re-use a buffer if possible--") +" call Decho("--re-use a buffer if possible--",'~'.expand("")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST " find NetrwTreeList buffer if there is one -" call Decho("case liststyle=treelist: find NetrwTreeList buffer if there is one") +" call Decho("case liststyle=treelist: find NetrwTreeList buffer if there is one",'~'.expand("")) if exists("w:netrw_treebufnr") && w:netrw_treebufnr > 0 -" call Decho(" re-using w:netrw_treebufnr=".w:netrw_treebufnr) +" call Decho(" re-using w:netrw_treebufnr=".w:netrw_treebufnr,'~'.expand("")) let eikeep= &ei setl ei=all - exe "sil! noswapfile keepalt b ".w:netrw_treebufnr + exe "sil! keepj noswapfile keepalt b ".w:netrw_treebufnr let &ei= eikeep setl ma - sil! NetrwKeepj %d -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) + sil! NetrwKeepj %d _ +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) " call Dret("s:NetrwGetBuffer 0 : bufnum#".w:netrw_treebufnr."") return 0 endif let bufnum= -1 -" call Decho(" liststyle=TREE but w:netrw_treebufnr doesn't exist") +" call Decho(" liststyle=TREE but w:netrw_treebufnr doesn't exist",'~'.expand("")) else " find buffer number of buffer named precisely the same as dirname {{{3 -" call Decho("case listtyle not treelist: find buffer numnber of buffer named precisely the same as dirname--") +" call Decho("case listtyle not treelist: find buffer numnber of buffer named precisely the same as dirname--",'~'.expand("")) " call Dredir("(NetrwGetBuffer) ls!","ls!") " get dirname and associated buffer number let bufnum = bufnr(escape(dirname,'\')) -" call Decho(" find buffer<".dirname.">'s number ") -" call Decho(" bufnr(dirname<".escape(dirname,'\').">)=".bufnum) +" call Decho(" find buffer<".dirname.">'s number ",'~'.expand("")) +" call Decho(" bufnr(dirname<".escape(dirname,'\').">)=".bufnum,'~'.expand("")) if bufnum < 0 && dirname !~ '/$' " try appending a trailing / -" call Decho(" try appending a trailing / to dirname<".dirname.">") +" call Decho(" try appending a trailing / to dirname<".dirname.">",'~'.expand("")) let bufnum= bufnr(escape(dirname.'/','\')) if bufnum > 0 let dirname= dirname.'/' @@ -3903,43 +3962,43 @@ fun! s:NetrwGetBuffer(islocal,dirname) if bufnum < 0 && dirname =~ '/$' " try removing a trailing / -" call Decho(" try removing a trailing / from dirname<".dirname.">") +" call Decho(" try removing a trailing / from dirname<".dirname.">",'~'.expand("")) let bufnum= bufnr(escape(substitute(dirname,'/$','',''),'\')) if bufnum > 0 let dirname= substitute(dirname,'/$','','') endif endif -" call Decho(" findbuf1: bufnum=bufnr('".dirname."')=".bufnum." bufname(".bufnum.")<".bufname(bufnum)."> (initial)") +" call Decho(" findbuf1: bufnum=bufnr('".dirname."')=".bufnum." bufname(".bufnum.")<".bufname(bufnum)."> (initial)",'~'.expand("")) " note: !~ was used just below, but that means using ../ to go back would match (ie. abc/def/ and abc/ matches) if bufnum > 0 && bufname(bufnum) != dirname && bufname(bufnum) != '.' " handle approximate matches -" call Decho(" handling approx match: bufnum#".bufnum.">0 AND bufname<".bufname(bufnum).">!=dirname<".dirname."> AND bufname(".bufnum.")!='.'") +" call Decho(" handling approx match: bufnum#".bufnum.">0 AND bufname<".bufname(bufnum).">!=dirname<".dirname."> AND bufname(".bufnum.")!='.'",'~'.expand("")) let ibuf = 1 let buflast = bufnr("$") -" call Decho(" findbuf2: buflast=bufnr($)=".buflast) +" call Decho(" findbuf2: buflast=bufnr($)=".buflast,'~'.expand("")) while ibuf <= buflast let bname= substitute(bufname(ibuf),'\\','/','g') let bname= substitute(bname,'.\zs/$','','') -" call Decho(" findbuf3: while [ibuf=",ibuf."]<=[buflast=".buflast."]: dirname<".dirname."> bname=bufname(".ibuf.")<".bname.">") +" call Decho(" findbuf3: while [ibuf=",ibuf."]<=[buflast=".buflast."]: dirname<".dirname."> bname=bufname(".ibuf.")<".bname.">",'~'.expand("")) if bname != '' && dirname =~ '/'.bname.'/\=$' && dirname !~ '^/' " bname is not empty " dirname ends with bname, " dirname doesn't start with /, so its not a absolute path -" call Decho(" findbuf3a: passes test 1 : dirname<".dirname.'> =~ /'.bname.'/\=$ && dirname !~ ^/') +" call Decho(" findbuf3a: passes test 1 : dirname<".dirname.'> =~ /'.bname.'/\=$ && dirname !~ ^/','~'.expand("")) break endif if bname =~ '^'.dirname.'/\=$' " bname begins with dirname -" call Decho(' findbuf3b: passes test 2 : bname<'.bname.'>=~^'.dirname.'/\=$') +" call Decho(' findbuf3b: passes test 2 : bname<'.bname.'>=~^'.dirname.'/\=$','~'.expand("")) break endif if dirname =~ '^'.bname.'/$' -" call Decho(' findbuf3c: passes test 3 : dirname<'.dirname.'>=~^'.bname.'/$') +" call Decho(' findbuf3c: passes test 3 : dirname<'.dirname.'>=~^'.bname.'/$','~'.expand("")) break endif if bname != '' && dirname =~ '/'.bname.'$' && bname == bufname("%") && line("$") == 1 -" call Decho(' findbuf3d: passes test 4 : dirname<'.dirname.'>=~ /'.bname.'$') +" call Decho(' findbuf3d: passes test 4 : dirname<'.dirname.'>=~ /'.bname.'$','~'.expand("")) break endif let ibuf= ibuf + 1 @@ -3949,89 +4008,93 @@ fun! s:NetrwGetBuffer(islocal,dirname) else let bufnum= ibuf endif -" call Decho(" findbuf4: bufnum=".bufnum." (ibuf=".ibuf." buflast=".buflast.")") +" call Decho(" findbuf4: bufnum=".bufnum." (ibuf=".ibuf." buflast=".buflast.")",'~'.expand("")) endif endif " get enew buffer and name it -or- re-use buffer {{{3 -" call Decho(" get enew buffer and name it OR re-use buffer") - sil! NetrwKeepj keepalt mark ' - if bufnum < 0 || !bufexists(bufnum) -" call Decho("--get enew buffer and name it (bufnum#".bufnum."<0 OR bufexists(".bufnum.")=".bufexists(bufnum)."==0)") + if bufnum < 0 || !bufexists(bufnum) " get enew buffer and name it +" call Decho("--get enew buffer and name it (bufnum#".bufnum."<0 OR bufexists(".bufnum.")=".bufexists(bufnum)."==0)",'~'.expand("")) call s:NetrwEnew(dirname) -" call Decho(" got enew buffer#".bufnr("%")." (altbuf<".expand("#").">)") +" call Decho(" got enew buffer#".bufnr("%")." (altbuf<".expand("#").">)",'~'.expand("")) " name the buffer if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST " Got enew buffer; transform into a NetrwTreeListing -" call Decho("--transform enew buffer#".bufnr("%")." into a NetrwTreeListing --") +" call Decho("--transform enew buffer#".bufnr("%")." into a NetrwTreeListing --",'~'.expand("")) if !exists("s:netrw_treelistnum") let s:netrw_treelistnum= 1 else let s:netrw_treelistnum= s:netrw_treelistnum + 1 endif let w:netrw_treebufnr= bufnr("%") -" call Decho(" exe sil! keepalt file NetrwTreeListing ".fnameescape(s:netrw_treelistnum)) +" call Decho(" exe sil! keepalt file NetrwTreeListing ".fnameescape(s:netrw_treelistnum),'~'.expand("")) exe 'sil! keepalt file NetrwTreeListing\ '.fnameescape(s:netrw_treelistnum) setl bt=nofile noswf nnoremap [ :sil call TreeListMove('[') nnoremap ] :sil call TreeListMove(']') nnoremap [[ :sil call TreeListMove('[') nnoremap ]] :sil call TreeListMove(']') -" call Decho(" tree listing#".s:netrw_treelistnum." bufnr=".w:netrw_treebufnr) +" call Decho(" tree listing#".s:netrw_treelistnum." bufnr=".w:netrw_treebufnr,'~'.expand("")) else " let v:errmsg = "" " Decho let escdirname = fnameescape(dirname) -" call Decho(" errmsg<".v:errmsg."> bufnr(escdirname<".escdirname.">)=".bufnr(escdirname)." bufname()<".bufname(bufnr(escdirname)).">") -" call Decho(' exe sil! keepalt file '.escdirname) +" call Decho(" errmsg<".v:errmsg."> bufnr(escdirname<".escdirname.">)=".bufnr(escdirname)." bufname()<".bufname(bufnr(escdirname)).">",'~'.expand("")) +" call Decho(' exe sil! keepalt file '.escdirname,'~'.expand("")) " let v:errmsg= "" " Decho - exe 'sil! keepalt file '.escdirname -" call Decho(" errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">") - endif -" call Decho(" named enew buffer#".bufnr("%")."<".bufname("%").">") + exe 'sil! keepj keepalt file '.escdirname +" call Decho(" errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">",'~'.expand("")) + endif +" call Decho(" named enew buffer#".bufnr("%")."<".bufname("%").">",'~'.expand("")) else " Re-use the buffer -" call Decho("--re-use buffer#".bufnum." (bufnum#".bufnum.">=0 AND bufexists(".bufnum.")=".bufexists(bufnum)."!=0)") +" call Decho("--re-use buffer#".bufnum." (bufnum#".bufnum.">=0 AND bufexists(".bufnum.")=".bufexists(bufnum)."!=0)",'~'.expand("")) let eikeep= &ei setl ei=all if getline(2) =~ '^" Netrw Directory Listing' -" call Decho(" getline(2)<".getline(2).'> matches "Netrw Directory Listing" : using keepalt b '.bufnum) - exe "sil! noswapfile keepalt b ".bufnum - else -" call Decho(" getline(2)<".getline(2).'> does not match "Netrw Directory Listing" : using b '.bufnum) - exe "sil! noswapfile keepalt b ".bufnum - endif +" call Decho(" getline(2)<".getline(2).'> matches "Netrw Directory Listing" : using keepalt b '.bufnum,'~'.expand("")) + exe "sil! NetrwKeepj noswapfile keepalt b ".bufnum + else +" call Decho(" getline(2)<".getline(2).'> does not match "Netrw Directory Listing" : using b '.bufnum,'~'.expand("")) + exe "sil! NetrwKeepj noswapfile keepalt b ".bufnum + endif +" call Decho(" line($)=".line("$"),'~'.expand("")) if bufname("%") == '.' -" call Decho("exe sil! keepalt file ".fnameescape(getcwd())) - exe "sil! keepalt file ".fnameescape(getcwd()) +" call Decho("exe sil! keepalt file ".fnameescape(getcwd()),'~'.expand("")) + exe "sil! NetrwKeepj keepalt file ".fnameescape(getcwd()) endif let &ei= eikeep - if line("$") <= 1 + if line("$") <= 1 && getline(1) == "" + " empty buffer NetrwKeepj call s:NetrwListSettings(a:islocal) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) " call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but its empty, so refresh it") return 0 elseif g:netrw_fastbrowse == 0 || (a:islocal && g:netrw_fastbrowse == 1) -" call Decho("g:netrw_fastbrowse=".g:netrw_fastbrowse." a:islocal=".a:islocal.": clear buffer") +" call Decho("g:netrw_fastbrowse=".g:netrw_fastbrowse." a:islocal=".a:islocal.": clear buffer",'~'.expand("")) NetrwKeepj call s:NetrwListSettings(a:islocal) - sil NetrwKeepj %d -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) + sil NetrwKeepj %d _ +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) " call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but refreshing due to g:netrw_fastbrowse=".g:netrw_fastbrowse) return 0 elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST -" call Decho("--re-use tree listing--") -" call Decho(" clear buffer<".expand("%")."> with :%d") - sil NetrwKeepj %d +" call Decho("--re-use tree listing--",'~'.expand("")) +" call Decho(" clear buffer<".expand("%")."> with :%d",'~'.expand("")) + sil NetrwKeepj %d _ NetrwKeepj call s:NetrwListSettings(a:islocal) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) " call Dret("s:NetrwGetBuffer 0 : re-using buffer#".bufnr("%").", but treelist mode always needs a refresh") return 0 else -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) -" call Dret("s:NetrwGetBuffer 1 : buf#".bufnr("%")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) +" call Dret("s:NetrwGetBuffer 1") return 1 endif endif @@ -4041,19 +4104,20 @@ fun! s:NetrwGetBuffer(islocal,dirname) " slow 0 D D Deleting a buffer implies it will not be re-used (slow) " med 1 D H " fast 2 H H -" call Decho("--do netrw settings: make this buffer#".bufnr("%")." not-a-file, modifiable, not line-numbered, etc--") +" call Decho("--do netrw settings: make this buffer#".bufnr("%")." not-a-file, modifiable, not line-numbered, etc--",'~'.expand("")) let fname= expand("%") NetrwKeepj call s:NetrwListSettings(a:islocal) -" call Decho("exe sil! keepalt file ".fnameescape(fname)) +" call Decho("exe sil! keepalt file ".fnameescape(fname),'~'.expand("")) exe "sil! NetrwKeepj keepalt file ".fnameescape(fname) " delete all lines from buffer {{{3 -" call Decho("--delete all lines from buffer--") -" call Decho(" clear buffer<".expand("%")."> with :%d") - sil! keepalt NetrwKeepj %d - -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) -" call Dret("s:NetrwGetBuffer 0 : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")) +" call Decho("--delete all lines from buffer--",'~'.expand("")) +" call Decho(" clear buffer<".expand("%")."> with :%d",'~'.expand("")) + sil! keepalt NetrwKeepj %d _ + +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) +" call Dret("s:NetrwGetBuffer 0") return 0 endfun @@ -4077,7 +4141,11 @@ endfun " --------------------------------------------------------------------- " s:NetrwGetWord: it gets the directory/file named under the cursor {{{2 fun! s:NetrwGetWord() -" call Dfunc("s:NetrwGetWord() line#".line(".")." liststyle=".s:ShowStyle()." virtcol=".virtcol(".")) +" call Dfunc("s:NetrwGetWord() liststyle=".s:ShowStyle()." virtcol=".virtcol(".")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) + let keepsol= &l:sol + setl nosol + call s:UseBufWinVars() " insure that w:netrw_liststyle is set up @@ -4087,12 +4155,12 @@ fun! s:NetrwGetWord() else let w:netrw_liststyle= s:THINLIST endif -" "call Decho("w:netrw_liststyle=".w:netrw_liststyle) +" call Decho("w:netrw_liststyle=".w:netrw_liststyle,'~'.expand("")) endif if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt " Active Banner support -" "call Decho("active banner handling") +" call Decho("active banner handling",'~'.expand("")) NetrwKeepj norm! 0 let dirname= "./" let curline= getline('.') @@ -4120,35 +4188,35 @@ fun! s:NetrwGetWord() endif elseif w:netrw_liststyle == s:THINLIST -" "call Decho("thin column handling") +" call Decho("thin column handling",'~'.expand("")) NetrwKeepj norm! 0 let dirname= substitute(getline('.'),'\t -->.*$','','') elseif w:netrw_liststyle == s:LONGLIST -" "call Decho("long column handling") +" call Decho("long column handling",'~'.expand("")) NetrwKeepj norm! 0 let dirname= substitute(getline('.'),'^\(\%(\S\+ \)*\S\+\).\{-}$','\1','e') elseif w:netrw_liststyle == s:TREELIST -" "call Decho("treelist handling") +" call Decho("treelist handling",'~'.expand("")) let dirname= substitute(getline('.'),'^\('.s:treedepthstring.'\)*','','e') let dirname= substitute(dirname,'\t -->.*$','','') else -" "call Decho("obtain word from wide listing") +" call Decho("obtain word from wide listing",'~'.expand("")) let dirname= getline('.') if !exists("b:netrw_cpf") let b:netrw_cpf= 0 exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' call histdel("/",-1) -" "call Decho("computed cpf=".b:netrw_cpf) - endif - -" "call Decho("buf#".bufnr("%")."<".bufname("%").">") +" "call Decho("computed cpf=".b:netrw_cpf,'~'.expand("")) + endif + +" call Decho("buf#".bufnr("%")."<".bufname("%").">",'~'.expand("")) let filestart = (virtcol(".")/b:netrw_cpf)*b:netrw_cpf -" "call Decho("filestart= ([virtcol=".virtcol(".")."]/[b:netrw_cpf=".b:netrw_cpf."])*b:netrw_cpf=".filestart." bannercnt=".w:netrw_bannercnt) -" "call Decho("1: dirname<".dirname.">") +" call Decho("filestart= ([virtcol=".virtcol(".")."]/[b:netrw_cpf=".b:netrw_cpf."])*b:netrw_cpf=".filestart." bannercnt=".w:netrw_bannercnt,'~'.expand("")) +" call Decho("1: dirname<".dirname.">",'~'.expand("")) if filestart == 0 NetrwKeepj norm! 0ma else @@ -4165,9 +4233,9 @@ fun! s:NetrwGetWord() endif let dirname = @a let @a = rega -" "call Decho("2: dirname<".dirname.">") +" call Decho("2: dirname<".dirname.">",'~'.expand("")) let dirname= substitute(dirname,'\s\+$','','e') -" "call Decho("3: dirname<".dirname.">") +" call Decho("3: dirname<".dirname.">",'~'.expand("")) endif " symlinks are indicated by a trailing "@". Remove it before further processing. @@ -4176,6 +4244,8 @@ fun! s:NetrwGetWord() " executables are indicated by a trailing "*". Remove it before further processing. let dirname= substitute(dirname,"\*$","","") + let &l:sol= keepsol + " call Dret("s:NetrwGetWord <".dirname.">") return dirname endfun @@ -4184,17 +4254,17 @@ endfun " s:NetrwListSettings: make standard settings for a netrw listing {{{2 fun! s:NetrwListSettings(islocal) " call Dfunc("s:NetrwListSettings(islocal=".a:islocal.")") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) let fname= bufname("%") -" " call Decho("(NetrwListSettings) setl bt=nofile nobl ma nonu nowrap noro nornu") +" " call Decho("(NetrwListSettings) setl bt=nofile nobl ma nonu nowrap noro nornu",'~'.expand("")) setl bt=nofile nobl ma nonu nowrap noro nornu -" call Decho("(NetrwListSettings) exe sil! keepalt file ".fnameescape(fname)) +" call Decho("(NetrwListSettings) exe sil! keepalt file ".fnameescape(fname),'~'.expand("")) exe "sil! keepalt file ".fnameescape(fname) if g:netrw_use_noswf setl noswf endif " call Dredir("ls!") -" call Decho("(NetrwListSettings) exe setl ts=".(g:netrw_maxfilenamelen+1)) +" call Decho("(NetrwListSettings) exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("")) exe "setl ts=".(g:netrw_maxfilenamelen+1) setl isk+=.,~,- if g:netrw_fastbrowse > a:islocal @@ -4202,7 +4272,7 @@ fun! s:NetrwListSettings(islocal) else setl bh=delete endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) " call Dret("s:NetrwListSettings") endfun @@ -4218,27 +4288,27 @@ fun! s:NetrwListStyle(islocal) if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif let svpos = netrw#SavePosn() let w:netrw_liststyle = (w:netrw_liststyle + 1) % s:MAXLIST -" call Decho("fname<".fname.">") -" call Decho("chgd w:netrw_liststyle to ".w:netrw_liststyle) -" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">") +" call Decho("fname<".fname.">",'~'.expand("")) +" call Decho("chgd w:netrw_liststyle to ".w:netrw_liststyle,'~'.expand("")) +" call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">",'~'.expand("")) if w:netrw_liststyle == s:THINLIST " use one column listing -" call Decho("use one column list") +" call Decho("use one column list",'~'.expand("")) let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') elseif w:netrw_liststyle == s:LONGLIST " use long list -" call Decho("use long list") +" call Decho("use long list",'~'.expand("")) let g:netrw_list_cmd = g:netrw_list_cmd." -l" elseif w:netrw_liststyle == s:WIDELIST " give wide list -" call Decho("use wide list") +" call Decho("use wide list",'~'.expand("")) let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') elseif w:netrw_liststyle == s:TREELIST -" call Decho("use tree list") +" call Decho("use tree list",'~'.expand("")) let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') else @@ -4248,18 +4318,18 @@ fun! s:NetrwListStyle(islocal) let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') endif setl ma noro -" call Decho("setl ma noro") +" call Decho("setl ma noro",'~'.expand("")) " clear buffer - this will cause NetrwBrowse/LocalBrowseCheck to do a refresh -" call Decho("clear buffer<".expand("%")."> with :%d") - sil! NetrwKeepj %d +" call Decho("clear buffer<".expand("%")."> with :%d",'~'.expand("")) + sil! NetrwKeepj %d _ " following prevents tree listing buffer from being marked "modified" -" call Decho("setl nomod") +" call Decho("setl nomod",'~'.expand("")) setl nomod -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) " refresh the listing -" call Decho("refresh the listing") +" call Decho("refresh the listing",'~'.expand("")) NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) NetrwKeepj call s:NetrwCursor() @@ -4287,7 +4357,7 @@ fun! s:NetrwBannerCtrl(islocal) let fname= s:NetrwGetWord() sil NetrwKeepj $ let result= search('\%(^\%(|\+\s\)\=\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bc') -" call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A')) +" call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A'),'~'.expand("")) if result <= 0 && exists("w:netrw_bannercnt") exe "NetrwKeepj ".w:netrw_bannercnt endif @@ -4314,9 +4384,9 @@ fun! s:NetrwBookmark(del,...) if exists("s:netrwmarkfilelist_{curbufnr}") " for every filename in the marked list -" call Decho("bookmark every filename in marked list") +" call Decho("bookmark every filename in marked list",'~'.expand("")) let svpos = netrw#SavePosn() - let islocal= expand("%") !~ '^\a\+://' + let islocal= expand("%") !~ '^\a\{3,}://' for fname in s:netrwmarkfilelist_{curbufnr} if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif endfor @@ -4331,7 +4401,7 @@ fun! s:NetrwBookmark(del,...) else " bookmark currently open file -" call Decho("bookmark currently open file") +" call Decho("bookmark currently open file",'~'.expand("")) let fname= expand("%") if a:del|call s:DeleteBookmark(fname)|else|call s:MakeBookmark(fname)|endif endif @@ -4341,18 +4411,22 @@ fun! s:NetrwBookmark(del,...) " attempts to infer if working remote or local " by deciding if the current file begins with an url " Globbing cannot be done remotely. - let islocal= expand("%") !~ '^\a\+://' -" call Decho("bookmark specified file".((a:0>1)? "s" : "")) + let islocal= expand("%") !~ '^\a\{3,}://' +" call Decho("bookmark specified file".((a:0>1)? "s" : ""),'~'.expand("")) let i = 1 while i <= a:0 if islocal - let mbfiles= glob(a:{i},0,1) + if v:version == 704 && has("patch656") + let mbfiles= glob(a:{i},0,1,1) + else + let mbfiles= glob(a:{i},0,1) + endif else let mbfiles= [a:{i}] endif -" call Decho("mbfiles".string(mbfiles)) +" call Decho("mbfiles".string(mbfiles),'~'.expand("")) for mbfile in mbfiles -" call Decho("mbfile<".mbfile.">") +" call Decho("mbfile<".mbfile.">",'~'.expand("")) if a:del|call s:DeleteBookmark(mbfile)|else|call s:MakeBookmark(mbfile)|endif endfor let i= i + 1 @@ -4379,7 +4453,7 @@ fun! s:NetrwBookmarkMenu() " the following test assures that gvim is running, has menus available, and has menus enabled. if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu if exists("g:NetrwTopLvlMenu") -" call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)") +" call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)",'~'.expand("")) exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Bookmarks' exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Delete' endif @@ -4391,7 +4465,7 @@ fun! s:NetrwBookmarkMenu() if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] && g:netrw_dirhistmax > 0 let cnt= 1 for bmd in g:netrw_bookmarklist -" call Decho('sil! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmark.'.bmd.' :e '.bmd) +" call Decho('sil! menu '.g:NetrwMenuPriority.".2.".cnt." ".g:NetrwTopLvlMenu.'Bookmark.'.bmd.' :e '.bmd,'~'.expand("")) let bmd= escape(bmd,g:netrw_menu_escape) " show bookmarks for goto menu @@ -4414,7 +4488,7 @@ fun! s:NetrwBookmarkMenu() let priority = g:netrw_dirhist_cnt + histcnt if exists("g:netrw_dirhist_{cnt}") let histdir= escape(g:netrw_dirhist_{cnt},g:netrw_menu_escape) -" call Decho('sil! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir) +" call Decho('sil! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir,'~'.expand("")) exe 'sil! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir."\" endif let first = 0 @@ -4436,27 +4510,27 @@ endfun " NetrwBrowseChgDir() edits the file. fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Dfunc("s:NetrwBrowseChgDir(islocal=".a:islocal."> newdir<".a:newdir.">) a:0=".a:0." curpos<".string(getpos("."))."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "").">") -" call Decho("win#".winnr()) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) let ykeep= @@ if !exists("b:netrw_curdir") " Don't try to change-directory: this can happen, for example, when netrw#ErrorMsg has been called " and the current window is the NetrwMessage window. let @@= ykeep -" call Decho("b:netrw_curdir doesn't exist!") -" call Decho("getcwd<".getcwd().">") +" call Decho("b:netrw_curdir doesn't exist!",'~'.expand("")) +" call Decho("getcwd<".getcwd().">",'~'.expand("")) " call Dredir("ls!") " call Dret("s:NetrwBrowseChgDir") return endif " NetrwBrowseChgDir: save options and initialize {{{3 -" call Decho("saving options") +" call Decho("saving options",'~'.expand("")) NetrwKeepj call s:NetrwOptionSave("s:") NetrwKeepj call s:NetrwSafeOptions() let nbcd_curpos = netrw#SavePosn() let s:nbcd_curpos_{bufnr('%')} = nbcd_curpos -" call Decho("setting s:nbcd_curpos_".bufnr('%')." to SavePosn") +" call Decho("setting s:nbcd_curpos_".bufnr('%')." to SavePosn",'~'.expand("")) if (has("win32") || has("win95") || has("win64") || has("win16")) let dirname = substitute(b:netrw_curdir,'\\','/','ge') else @@ -4465,110 +4539,108 @@ fun! s:NetrwBrowseChgDir(islocal,newdir, let newdir = a:newdir let dolockout = 0 let dorestore = 1 -" call Decho("dirname<".dirname.">") +" call Decho("dirname<".dirname.">",'~'.expand("")) " ignore s when done in the banner -" call Decho('ignore s when done in banner (g:netrw_banner='.g:netrw_banner.")") +" call Decho('ignore [return]s when done in banner (g:netrw_banner='.g:netrw_banner.")",'~'.expand("")) if g:netrw_banner -" call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." line(.)#".line('.')." line($)#".line("#")) +" call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." line(.)#".line('.')." line($)#".line("#"),'~'.expand("")) if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt && line("$") >= w:netrw_bannercnt if getline(".") =~ 'Quick Help' -" call Decho("#1: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("#1: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) let g:netrw_quickhelp= (g:netrw_quickhelp + 1)%len(s:QuickHelp) -" call Decho("#2: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("#2: quickhelp=".g:netrw_quickhelp." ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) setl ma noro nowrap NetrwKeepj call setline(line('.'),'" Quick Help: :help '.s:QuickHelp[g:netrw_quickhelp]) setl noma nomod nowrap NetrwKeepj call netrw#RestorePosn(nbcd_curpos) NetrwKeepj call s:NetrwOptionRestore("s:") -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) endif endif " else " Decho -" call Decho("(s:NetrwBrowseChgdir) g:netrw_banner=".g:netrw_banner." (no banner)") +" call Decho("(s:NetrwBrowseChgdir) g:netrw_banner=".g:netrw_banner." (no banner)",'~'.expand("")) endif " set up o/s-dependent directory recognition pattern -" call Decho("set up o/s-dependent directory recognition pattern") if has("amiga") let dirpat= '[\/:]$' else let dirpat= '[\/]$' endif -" call Decho("dirname<".dirname."> dirpat<".dirpat.">") +" call Decho("set up o/s-dependent directory recognition pattern: dirname<".dirname."> dirpat<".dirpat.">",'~'.expand("")) if dirname !~ dirpat " apparently vim is "recognizing" that it is in a directory and " is removing the trailing "/". Bad idea, so let's put it back. let dirname= dirname.'/' -" call Decho("adjusting dirname<".dirname.">") - endif -" call Decho("newdir<".newdir."> !~ dirpat<".dirpat.">? ".((newdir !~ dirpat)? "yes" : "no")) - - if newdir !~ dirpat && !(a:islocal && isdirectory(newdir)) +" call Decho("adjusting dirname<".dirname.'> (put trailing "/" back)','~'.expand("")) + endif + +" " call Decho("[newdir<".newdir."> ".((newdir =~ dirpat)? "=~" : "!~")." dirpat<".dirpat.">] && [islocal=".a:islocal."] && [newdir is ".(isdirectory(s:NetrwFile(newdir))? "" : "not ")."a directory]",'~'.expand("")) + if newdir !~ dirpat && !(a:islocal && isdirectory(s:NetrwFile(s:ComposePath(dirname,newdir)))) " ------------------------------ " NetrwBrowseChgDir: edit a file {{{3 " ------------------------------ -" call Decho('edit-a-file: case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">") +" call Decho('edit-a-file: case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">",'~'.expand("")) " save position for benefit of Rexplore let s:rexposn_{bufnr("%")}= netrw#SavePosn() - -" call Decho("edit-a-file: setting s:rexposn_".bufnr("%")." to SavePosn") -" call Decho("edit-a-file: win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft) -" call Decho("edit-a-file: w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')." w:netrw_treedict:".(exists("w:netrw_treedict")? "exists" : 'n/a')." newdir<".newdir.">") +" call Decho("edit-a-file: setting s:rexposn_".bufnr("%")."<".bufname("%")."> to SavePosn",'~'.expand("")) +" call Decho("edit-a-file: win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> ft=".&ft,'~'.expand("")) +" call Decho("edit-a-file: w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')." w:netrw_treedict:".(exists("w:netrw_treedict")? "exists" : 'n/a')." newdir<".newdir.">",'~'.expand("")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") && newdir !~ '^\(/\|\a:\)' -" call Decho("edit-a-file: handle tree listing: w:netrw_treedict<".(exists("w:netrw_treedict")? string(w:netrw_treedict) : 'n/a').">") -" call Decho("edit-a-file: newdir<".newdir.">") +" call Decho("edit-a-file: handle tree listing: w:netrw_treedict<".(exists("w:netrw_treedict")? string(w:netrw_treedict) : 'n/a').">",'~'.expand("")) +" call Decho("edit-a-file: newdir<".newdir.">",'~'.expand("")) let dirname= s:NetrwTreeDir(a:islocal) if dirname =~ '/$' let dirname= dirname.newdir else let dirname= dirname."/".newdir endif -" call Decho("edit-a-file: dirname<".dirname.">") -" call Decho("edit-a-file: tree listing") +" call Decho("edit-a-file: dirname<".dirname.">",'~'.expand("")) +" call Decho("edit-a-file: tree listing",'~'.expand("")) elseif newdir =~ '^\(/\|\a:\)' let dirname= newdir else let dirname= s:ComposePath(dirname,newdir) endif -" call Decho("edit-a-file: handling a file: dirname<".dirname."> (a:0=".a:0.")") +" call Decho("edit-a-file: handling a file: dirname<".dirname."> (a:0=".a:0.")",'~'.expand("")) " this lets netrw#BrowseX avoid the edit if a:0 < 1 -" call Decho("edit-a-file: set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist")) +" call Decho("edit-a-file: set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist"),'~'.expand("")) NetrwKeepj call s:NetrwOptionRestore("s:") if !exists("s:didsplit") -" call Decho("edit-a-file: s:didsplit does not exist; g:netrw_browse_split=".string(g:netrw_browse_split)." win#".winnr()) +" call Decho("edit-a-file: s:didsplit does not exist; g:netrw_browse_split=".string(g:netrw_browse_split)." win#".winnr(),'~'.expand("")) if type(g:netrw_browse_split) == 3 " open file in server " Note that g:netrw_browse_split is a List: [servername,tabnr,winnr] -" call Decho("edit-a-file: open file in server") +" call Decho("edit-a-file: open file in server",'~'.expand("")) call s:NetrwServerEdit(a:islocal,dirname) " call Dret("s:NetrwBrowseChgDir") return elseif g:netrw_browse_split == 1 " horizontally splitting the window first -" call Decho("edit-a-file: horizontally splitting window prior to edit") +" call Decho("edit-a-file: horizontally splitting window prior to edit",'~'.expand("")) keepalt new if !&ea keepalt wincmd _ endif elseif g:netrw_browse_split == 2 " vertically splitting the window first -" call Decho("edit-a-file: vertically splitting window prior to edit") +" call Decho("edit-a-file: vertically splitting window prior to edit",'~'.expand("")) keepalt rightb vert new if !&ea keepalt wincmd | endif elseif g:netrw_browse_split == 3 " open file in new tab -" call Decho("edit-a-file: opening new tab prior to edit") +" call Decho("edit-a-file: opening new tab prior to edit",'~'.expand("")) keepalt tabnew elseif g:netrw_browse_split == 4 " act like "P" (ie. open previous window) -" call Decho("edit-a-file: use previous window for edit") +" call Decho("edit-a-file: use previous window for edit",'~'.expand("")) if s:NetrwPrevWinOpen(2) == 3 let @@= ykeep " call Dret("s:NetrwBrowseChgDir") @@ -4576,16 +4648,16 @@ fun! s:NetrwBrowseChgDir(islocal,newdir, endif else " handling a file, didn't split, so remove menu -" call Decho("edit-a-file: handling a file+didn't split, so remove menu") +" call Decho("edit-a-file: handling a file+didn't split, so remove menu",'~'.expand("")) call s:NetrwMenu(0) " optional change to window if g:netrw_chgwin >= 1 -" call Decho("edit-a-file: changing window to #".g:netrw_chgwin) +" call Decho("edit-a-file: changing window to #".g:netrw_chgwin,'~'.expand("")) if winnr("$")+1 == g:netrw_chgwin " if g:netrw_chgwin is set to one more than the last window, then " vertically split the last window to make that window available. let curwin= winnr() - exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd ".winnr("$") + exe "NetrwKeepj keepalt ".winnr("$")."wincmd w" vs exe "NetrwKeepj keepalt ".g:netrw_chgwin."wincmd ".curwin endif @@ -4598,7 +4670,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir, " if its local only: LocalBrowseCheck() doesn't edit a file, but NetrwBrowse() will " no keepalt to support :e # to return to a directory listing if a:islocal -" call Decho("edit-a-file: edit local file: exe e! ".fnameescape(dirname)) +" call Decho("edit-a-file: edit local file: exe e! ".fnameescape(dirname),'~'.expand("")) " some like c-^ to return to the last edited file " others like c-^ to return to the netrw buffer if exists("g:netrw_altfile") && g:netrw_altfile @@ -4606,14 +4678,14 @@ fun! s:NetrwBrowseChgDir(islocal,newdir, else exe "NetrwKeepj e! ".fnameescape(dirname) endif -" call Decho("edit-a-file: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod) +" call Decho("edit-a-file: after e! ".dirname.": hidden=".&hidden." bufhidden<".&bufhidden."> mod=".&mod,'~'.expand("")) call s:NetrwCursor() if &hidden || &bufhidden == "hide" " file came from vim's hidden storage. Don't "restore" options with it. let dorestore= 0 endif else -" call Decho("edit-a-file: remote file: NetrwBrowse will edit it") +" call Decho("edit-a-file: remote file: NetrwBrowse will edit it",'~'.expand("")) endif let dolockout= 1 @@ -4622,12 +4694,12 @@ fun! s:NetrwBrowseChgDir(islocal,newdir, " or as a list of function references. It will ignore anything that's not " a function reference. See :help Funcref for information about function references. if exists("g:Netrw_funcref") -" call Decho("edit-a-file: handle optional Funcrefs") +" call Decho("edit-a-file: handle optional Funcrefs",'~'.expand("")) if type(g:Netrw_funcref) == 2 -" call Decho("edit-a-file: handling a g:Netrw_funcref") +" call Decho("edit-a-file: handling a g:Netrw_funcref",'~'.expand("")) NetrwKeepj call g:Netrw_funcref() elseif type(g:Netrw_funcref) == 3 -" call Decho("edit-a-file: handling a list of g:Netrw_funcrefs") +" call Decho("edit-a-file: handling a list of g:Netrw_funcrefs",'~'.expand("")) for Fncref in g:Netrw_funcref if type(FncRef) == 2 NetrwKeepj call FncRef() @@ -4641,42 +4713,44 @@ fun! s:NetrwBrowseChgDir(islocal,newdir, " ---------------------------------------------------- " NetrwBrowseChgDir: just go to the new directory spec {{{3 " ---------------------------------------------------- -" call Decho('goto-newdir: case "just go to new directory spec": newdir<'.newdir.'>') +" call Decho('goto-newdir: case "just go to new directory spec": newdir<'.newdir.'>','~'.expand("")) let dirname = newdir NetrwKeepj call s:SetRexDir(a:islocal,dirname) NetrwKeepj call s:NetrwOptionRestore("s:") + norm! m` elseif newdir == './' " --------------------------------------------- " NetrwBrowseChgDir: refresh the directory list {{{3 " --------------------------------------------- -" call Decho('refresh-dirlist: case "refresh directory listing": newdir == "./"') +" call Decho('refresh-dirlist: case "refresh directory listing": newdir == "./"','~'.expand("")) NetrwKeepj call s:SetRexDir(a:islocal,dirname) + norm! m` elseif newdir == '../' " -------------------------------------- " NetrwBrowseChgDir: go up one directory {{{3 " -------------------------------------- -" call Decho('go-up: case "go up one directory": newdir == "../"') +" call Decho('go-up: case "go up one directory": newdir == "../"','~'.expand("")) if w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " force a refresh -" call Decho("go-up: clear buffer<".expand("%")."> with :%d") -" call Decho("go-up: setl noro ma") +" call Decho("go-up: clear buffer<".expand("%")."> with :%d",'~'.expand("")) +" call Decho("go-up: setl noro ma",'~'.expand("")) setl noro ma - NetrwKeepj %d + NetrwKeepj %d _ endif if has("amiga") " amiga -" call Decho('go-up: case "go up one directory": newdir == "../" and amiga') +" call Decho('go-up: case "go up one directory": newdir == "../" and amiga','~'.expand("")) if a:islocal let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+$\)','\1','') let dirname= substitute(dirname,'/$','','') else let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+/$\)','\1','') endif -" call Decho("go-up: amiga: dirname<".dirname."> (go up one dir)") +" call Decho("go-up: amiga: dirname<".dirname."> (go up one dir)",'~'.expand("")) elseif !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) " windows @@ -4686,94 +4760,96 @@ fun! s:NetrwBrowseChgDir(islocal,newdir, let dirname= '/' endif else - let dirname= substitute(dirname,'^\(\a\+://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') + let dirname= substitute(dirname,'^\(\a\{3,}://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') endif if dirname =~ '^\a:$' let dirname= dirname.'/' endif -" call Decho("go-up: windows: dirname<".dirname."> (go up one dir)") +" call Decho("go-up: windows: dirname<".dirname."> (go up one dir)",'~'.expand("")) else " unix or cygwin -" call Decho('go-up: case "go up one directory": newdir == "../" and unix or cygwin') +" call Decho('go-up: case "go up one directory": newdir == "../" and unix or cygwin','~'.expand("")) if a:islocal let dirname= substitute(dirname,'^\(.*\)/\([^/]\+\)/$','\1','') if dirname == "" let dirname= '/' endif else - let dirname= substitute(dirname,'^\(\a\+://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') - endif -" call Decho("go-up: unix: dirname<".dirname."> (go up one dir)") + let dirname= substitute(dirname,'^\(\a\{3,}://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') + endif +" call Decho("go-up: unix: dirname<".dirname."> (go up one dir)",'~'.expand("")) endif NetrwKeepj call s:SetRexDir(a:islocal,dirname) + norm m` elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " -------------------------------------- " NetrwBrowseChgDir: Handle Tree Listing {{{3 " -------------------------------------- -" call Decho('tree-list: case liststyle is TREELIST and w:netrw_treedict exists') - " force a refresh (for TREELIST, wait for NetrwTreeDir() to force the refresh) -" call Decho("tree-list: setl noro ma") +" call Decho('tree-list: case liststyle is TREELIST and w:netrw_treedict exists','~'.expand("")) + " force a refresh (for TREELIST, NetrwTreeDir() will force the refresh) +" call Decho("tree-list: setl noro ma",'~'.expand("")) setl noro ma if !(exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir")) -" call Decho("tree-list: clear buffer<".expand("%")."> with :%d") - NetrwKeepj %d +" call Decho("tree-list: clear buffer<".expand("%")."> with :%d (force refresh)",'~'.expand("")) + NetrwKeepj %d _ endif let treedir = s:NetrwTreeDir(a:islocal) +" call Decho("tree-list: treedir<".treedir.">",'~'.expand("")) let s:treecurpos = nbcd_curpos let haskey = 0 -" call Decho("tree-list: w:netrw_treedict<".string(w:netrw_treedict).">") +" call Decho("tree-list: w:netrw_treedict<".string(w:netrw_treedict).">",'~'.expand("")) " search treedict for tree dir as-is -" call Decho("search treedict for tree dir as-is") +" call Decho("search treedict for tree dir as-is",'~'.expand("")) if has_key(w:netrw_treedict,treedir) -" call Decho('tree-list: ....searched for treedir<'.treedir.'> : found it!') +" call Decho('tree-list: ....searched for treedir<'.treedir.'> : found it!','~'.expand("")) let haskey= 1 else -" call Decho('tree-list: ....searched for treedir<'.treedir.'> : not found') - endif - - " search treedict for treedir with a / appended -" call Decho("search treedict for treedir with a / appended") - if !haskey && treedir !~ '/$' +" call Decho('tree-list: ....searched for treedir<'.treedir.'> : not found','~'.expand("")) + endif + + " search treedict for treedir with a [/@] appended +" call Decho("search treedict for treedir with a [/@] appended",'~'.expand("")) + if !haskey && treedir !~ '[/@]$' if has_key(w:netrw_treedict,treedir."/") let treedir= treedir."/" -" call Decho('tree-list: ....searched.for treedir<'.treedir.'> found it!') +" call Decho('tree-list: ....searched.for treedir<'.treedir.'> found it!','~'.expand("")) let haskey = 1 else -" call Decho('tree-list: ....searched for treedir<'.treedir.'/> : not found') +" call Decho('tree-list: ....searched for treedir<'.treedir.'/> : not found','~'.expand("")) endif endif " search treedict for treedir with any trailing / elided -" call Decho("search treedict for treedir with any trailing / elided") +" call Decho("search treedict for treedir with any trailing / elided",'~'.expand("")) if !haskey && treedir =~ '/$' let treedir= substitute(treedir,'/$','','') if has_key(w:netrw_treedict,treedir) -" call Decho('tree-list: ....searched.for treedir<'.treedir.'> found it!') +" call Decho('tree-list: ....searched.for treedir<'.treedir.'> found it!','~'.expand("")) let haskey = 1 else -" call Decho('tree-list: ....searched for treedir<'.treedir.'> : not found') - endif - endif - -" call Decho("haskey=".haskey) +" call Decho('tree-list: ....searched for treedir<'.treedir.'> : not found','~'.expand("")) + endif + endif + +" call Decho("haskey=".haskey,'~'.expand("")) if haskey " close tree listing for selected subdirectory -" call Decho("tree-list: closing selected subdirectory<".dirname.">") +" call Decho("tree-list: closing selected subdirectory<".dirname.">",'~'.expand("")) call remove(w:netrw_treedict,treedir) -" call Decho("tree-list: removed entry<".treedir."> from treedict") -" call Decho("tree-list: yielding treedict<".string(w:netrw_treedict).">") +" call Decho("tree-list: removed entry<".treedir."> from treedict",'~'.expand("")) +" call Decho("tree-list: yielding treedict<".string(w:netrw_treedict).">",'~'.expand("")) let dirname= w:netrw_treetop else " go down one directory let dirname= substitute(treedir,'/*$','/','') -" call Decho("tree-list: go down one dir: treedir<".treedir.">") -" call Decho("tree-list: ... : dirname<".dirname.">") +" call Decho("tree-list: go down one dir: treedir<".treedir.">",'~'.expand("")) +" call Decho("tree-list: ... : dirname<".dirname.">",'~'.expand("")) endif NetrwKeepj call s:SetRexDir(a:islocal,dirname) -" call Decho("setting s:treeforceredraw to true") +" call Decho("setting s:treeforceredraw to true",'~'.expand("")) let s:treeforceredraw = 1 else @@ -4781,8 +4857,9 @@ fun! s:NetrwBrowseChgDir(islocal,newdir, " NetrwBrowseChgDir: Go down one directory {{{3 " ---------------------------------------- let dirname = s:ComposePath(dirname,newdir) -" call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">") +" call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">",'~'.expand("")) NetrwKeepj call s:SetRexDir(a:islocal,dirname) + norm m` endif " -------------------------------------- @@ -4791,23 +4868,23 @@ fun! s:NetrwBrowseChgDir(islocal,newdir, if dorestore " dorestore is zero'd when a local file was hidden or bufhidden; " in such a case, we want to keep whatever settings it may have. -" call Decho("doing option restore (dorestore=".dorestore.")") +" call Decho("doing option restore (dorestore=".dorestore.")",'~'.expand("")) NetrwKeepj call s:NetrwOptionRestore("s:") " else " Decho -" call Decho("skipping option restore (dorestore==0): hidden=".&hidden." bufhidden=".&bufhidden." mod=".&mod) +" call Decho("skipping option restore (dorestore==0): hidden=".&hidden." bufhidden=".&bufhidden." mod=".&mod,'~'.expand("")) endif if dolockout && dorestore -" call Decho("restore: filewritable(dirname<".dirname.">)=".filewritable(dirname)) +" call Decho("restore: filewritable(dirname<".dirname.">)=".filewritable(dirname),'~'.expand("")) if filewritable(dirname) -" call Decho("restore: doing modification lockout settings: ma nomod noro") -" call Decho("restore: setl ma nomod noro") +" call Decho("restore: doing modification lockout settings: ma nomod noro",'~'.expand("")) +" call Decho("restore: setl ma nomod noro",'~'.expand("")) setl ma noro nomod -" call Decho("restore: ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") - else -" call Decho("restore: doing modification lockout settings: ma nomod ro") -" call Decho("restore: setl ma nomod noro") +" call Decho("restore: ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) + else +" call Decho("restore: doing modification lockout settings: ma nomod ro",'~'.expand("")) +" call Decho("restore: setl ma nomod noro",'~'.expand("")) setl ma ro nomod -" call Decho("restore: ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("restore: ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) endif endif let @@= ykeep @@ -4825,7 +4902,7 @@ fun! s:NetrwBrowseUpDir(islocal) if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt-1 " this test needed because occasionally this function seems to be incorrectly called " when multiple leftmouse clicks are taken when atop the one line help in the banner. - " I'm allowing the very bottom line to permit a "-" exit so that one may escape empty + " I'm allowing the very bottom line to permit a "-" exit so that one may escape empty " directories. " call Dret("s:NetrwBrowseUpDir : cursor not in file area") return @@ -4833,12 +4910,13 @@ fun! s:NetrwBrowseUpDir(islocal) norm! 0 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") -" call Decho("case: treestyle") +" call Decho("case: treestyle",'~'.expand("")) let curline= getline(".") let swwline= winline() - 1 if exists("w:netrw_treetop") let b:netrw_curdir= w:netrw_treetop endif + let curdir= b:netrw_curdir if a:islocal call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,'../')) else @@ -4858,19 +4936,26 @@ fun! s:NetrwBrowseUpDir(islocal) endif endwhile else -" call Decho("case: not treestyle") +" call Decho("case: not treestyle",'~'.expand("")) + if exists("b:netrw_curdir") + let curdir= b:netrw_curdir + else + let curdir= expand(getcwd()) + endif if a:islocal call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,'../')) else call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,'../')) endif if exists("w:netrw_bannercnt") -" call Decho("moving to line#".w:netrw_bannercnt) +" call Decho("moving to line#".w:netrw_bannercnt,'~'.expand("")) exe w:netrw_bannercnt else 1 endif endif + let curdir= substitute(curdir,'^.*[\/]','','') + call search('\<'.curdir.'\>','wc') " call Dret("s:NetrwBrowseUpDir") endfun @@ -4900,11 +4985,11 @@ fun! netrw#BrowseX(fname,remote) if exists("g:Netrw_corehandler") if type(g:Netrw_corehandler) == 2 " g:Netrw_corehandler is a function reference (see :help Funcref) -" call Decho("g:Netrw_corehandler is a funcref") - call g:Netrw_corehandler(a:fname) +" call Decho("g:Netrw_corehandler is a funcref",'~'.expand("")) + call g:Netrw_corehandler(s:NetrwFile(a:fname)) elseif type(g:Netrw_corehandler) == 3 " g:Netrw_corehandler is a List of function references (see :help Funcref) -" call Decho("g:Netrw_corehandler is a List") +" call Decho("g:Netrw_corehandler is a List",'~'.expand("")) for Fncref in g:Netrw_corehandler if type(FncRef) == 2 call FncRef(a:fname) @@ -4925,18 +5010,18 @@ fun! netrw#BrowseX(fname,remote) if has("win32") || has("win95") || has("win64") || has("win16") let exten= substitute(exten,'^.*$','\L&\E','') endif -" call Decho("exten<".exten.">") +" call Decho("exten<".exten.">",'~'.expand("")) if a:remote == 1 " create a local copy -" call Decho("remote: a:remote=".a:remote.": create a local copy of <".a:fname.">") +" call Decho("remote: a:remote=".a:remote.": create a local copy of <".a:fname.">",'~'.expand("")) setl bh=delete call netrw#NetRead(3,a:fname) " attempt to rename tempfile let basename= substitute(a:fname,'^\(.*\)/\(.*\)\.\([^.]*\)$','\2','') let newname = substitute(s:netrw_tmpfile,'^\(.*\)/\(.*\)\.\([^.]*\)$','\1/'.basename.'.\3','') -" call Decho("basename<".basename.">") -" call Decho("newname <".newname.">") +" call Decho("basename<".basename.">",'~'.expand("")) +" call Decho("newname <".newname.">",'~'.expand("")) if rename(s:netrw_tmpfile,newname) == 0 " renaming succeeded let fname= newname @@ -4945,16 +5030,16 @@ fun! netrw#BrowseX(fname,remote) let fname= s:netrw_tmpfile endif else -" call Decho("local: a:remote=".a:remote.": handling local copy of <".a:fname.">") +" call Decho("local: a:remote=".a:remote.": handling local copy of <".a:fname.">",'~'.expand("")) let fname= a:fname " special ~ handler for local if fname =~ '^\~' && expand("$HOME") != "" -" call Decho('invoking special ~ handler') - let fname= substitute(fname,'^\~',expand("$HOME"),'') - endif - endif -" call Decho("fname<".fname.">") -" call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten)) +" call Decho('invoking special ~ handler','~'.expand("")) + let fname= s:NetrwFile(substitute(fname,'^\~',expand("$HOME"),'')) + endif + endif +" call Decho("fname<".fname.">",'~'.expand("")) +" call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten),'~'.expand("")) " set up redirection if &srr =~ "%s" @@ -4968,12 +5053,12 @@ fun! netrw#BrowseX(fname,remote) else let redir= &srr . "/dev/null" endif -" call Decho("set up redirection: redir{".redir."} srr{".&srr."}") +" call Decho("set up redirection: redir{".redir."} srr{".&srr."}",'~'.expand("")) " extract any viewing options. Assumes that they're set apart by quotes. -" call Decho("extract any viewing options") +" call Decho("extract any viewing options",'~'.expand("")) if exists("g:netrw_browsex_viewer") -" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") +" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("")) if g:netrw_browsex_viewer =~ '\s' let viewer = substitute(g:netrw_browsex_viewer,'\s.*$','','') let viewopt = substitute(g:netrw_browsex_viewer,'^\S\+\s*','','')." " @@ -4984,32 +5069,32 @@ fun! netrw#BrowseX(fname,remote) let viewopt = substitute(g:netrw_browsex_viewer,'^\(\(^\S\+\s\+\)\{'.cnt.'}\S\+\)\(.*\)$','\3','')." " let cnt = cnt + 1 let oviewer = viewer -" call Decho("!exe: viewer<".viewer."> viewopt<".viewopt.">") +" call Decho("!exe: viewer<".viewer."> viewopt<".viewopt.">",'~'.expand("")) endwhile else let viewer = g:netrw_browsex_viewer let viewopt = "" endif -" call Decho("viewer<".viewer."> viewopt<".viewopt.">") +" call Decho("viewer<".viewer."> viewopt<".viewopt.">",'~'.expand("")) endif " execute the file handler -" call Decho("execute the file handler (if any)") +" call Decho("execute the file handler (if any)",'~'.expand("")) if exists("g:netrw_browsex_viewer") && g:netrw_browsex_viewer == '-' -" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") +" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("")) let ret= netrwFileHandlers#Invoke(exten,fname) elseif exists("g:netrw_browsex_viewer") && executable(viewer) -" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">") - call s:NetrwExe("sil !".viewer." ".viewopt.shellescape(fname,1).redir) +" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("")) + call s:NetrwExe("sil !".viewer." ".viewopt.s:ShellEscape(fname,1).redir) let ret= v:shell_error elseif has("win32") || has("win64") -" call Decho("windows") +" call Decho("windows",'~'.expand("")) if executable("start") - call s:NetrwExe('sil! !start rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)) + call s:NetrwExe('sil! !start rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(fname,1)) elseif executable("rundll32") - call s:NetrwExe('sil! !rundll32 url.dll,FileProtocolHandler '.shellescape(fname,1)) + call s:NetrwExe('sil! !rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(fname,1)) else call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) endif @@ -5018,32 +5103,37 @@ fun! netrw#BrowseX(fname,remote) elseif has("win32unix") let winfname= 'c:\cygwin'.substitute(fname,'/','\\','g') -" call Decho("cygwin: winfname<".shellescape(winfname,1).">") +" call Decho("cygwin: winfname<".s:ShellEscape(winfname,1).">",'~'.expand("")) if executable("start") - call s:NetrwExe('sil !start rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1)) + call s:NetrwExe('sil !start rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(winfname,1)) elseif executable("rundll32") - call s:NetrwExe('sil !rundll32 url.dll,FileProtocolHandler '.shellescape(winfname,1)) + call s:NetrwExe('sil !rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(winfname,1)) elseif executable("cygstart") - call s:NetrwExe('sil !cygstart '.shellescape(fname,1)) + call s:NetrwExe('sil !cygstart '.s:ShellEscape(fname,1)) else call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) endif call inputsave()|call input("Press to continue")|call inputrestore() let ret= v:shell_error - elseif has("unix") && executable("xdg-open") && !s:CheckIfKde() -" call Decho("unix and xdg-open") - call s:NetrwExe("sil !xdg-open ".shellescape(fname,1).redir) + elseif has("unix") && executable("kfmclient") && s:CheckIfKde() +" call Decho("unix and kfmclient",'~'.expand("")) + call s:NetrwExe("sil !kfmclient exec ".s:ShellEscape(fname,1)." ".redir) let ret= v:shell_error - elseif has("unix") && executable("kfmclient") && s:CheckIfKde() -" call Decho("unix and kfmclient") - call s:NetrwExe("sil !kfmclient exec ".shellescape(fname,1)." ".redir) + elseif has("unix") && executable("exo-open") && executable("xdg-open") && executable("setsid") +" call Decho("unix, exo-open, xdg-open",'~'.expand("")) + call s:NetrwExe("sil !setsid xdg-open ".s:ShellEscape(fname,1).redir) + let ret= v:shell_error + + elseif has("unix") && executable("xdg-open") +" call Decho("unix and xdg-open",'~'.expand("")) + call s:NetrwExe("sil !xdg-open ".s:ShellEscape(fname,1).redir) let ret= v:shell_error elseif has("macunix") && executable("open") -" call Decho("macunix and open") - call s:NetrwExe("sil !open ".shellescape(fname,1)." ".redir) +" call Decho("macunix and open",'~'.expand("")) + call s:NetrwExe("sil !open ".s:ShellEscape(fname,1)." ".redir) let ret= v:shell_error else @@ -5065,7 +5155,7 @@ fun! netrw#BrowseX(fname,remote) " Feb 12, 2008: had to de-activiate removal of " temporary file because it wasn't getting seen. " if a:remote == 1 && fname != a:fname -"" call Decho("deleting temporary file<".fname.">") +"" call Decho("deleting temporary file<".fname.">",'~'.expand("")) " call s:NetrwDelete(fname) " endif @@ -5090,7 +5180,7 @@ fun! netrw#BrowseXVis() " call Dfunc("netrw#BrowseXVis()") let atkeep = @@ norm! gvy -" call Decho("@@<".@@.">") +" call Decho("@@<".@@.">",'~'.expand("")) call netrw#BrowseX(@@,netrw#CheckIfRemote()) let @@ = atkeep " call Dret("netrw#BrowseXVis") @@ -5100,7 +5190,7 @@ endfun " netrw#CheckIfRemote: returns 1 if current file looks like an url, 0 else {{{2 fun! netrw#CheckIfRemote() " call Dfunc("netrw#CheckIfRemote()") - if expand("%") =~ '^\a\+://' + if expand("%") =~ '^\a\{3,}://' " call Dret("netrw#CheckIfRemote 1") return 1 else @@ -5117,9 +5207,9 @@ fun! s:NetrwChgPerm(islocal,curdir) call inputsave() let newperm= input("Enter new permission: ") call inputrestore() - let chgperm= substitute(g:netrw_chgperm,'\',shellescape(expand("")),'') - let chgperm= substitute(chgperm,'\',shellescape(newperm),'') -" call Decho("chgperm<".chgperm.">") + let chgperm= substitute(g:netrw_chgperm,'\',s:ShellEscape(expand("")),'') + let chgperm= substitute(chgperm,'\',s:ShellEscape(newperm),'') +" call Decho("chgperm<".chgperm.">",'~'.expand("")) call system(chgperm) if v:shell_error != 0 NetrwKeepj call netrw#ErrorMsg(1,"changing permission on file<".expand("")."> seems to have failed",75) @@ -5142,14 +5232,14 @@ fun! s:CheckIfKde() " usually have "kdeinit" running, though... (tnx Mikolaj Machowski) if !exists("s:haskdeinit") if has("unix") && executable("ps") && !has("win32unix") - let s:haskdeinit= system("ps -e") =~ '\")) endif " call Dret("s:CheckIfKde ".s:haskdeinit) @@ -5208,7 +5298,7 @@ fun! s:NetrwForceChgDir(islocal,newdir) else let newdir= a:newdir.'/' endif -" call Decho("adjusting newdir<".newdir."> due to gd") +" call Decho("adjusting newdir<".newdir."> due to gd",'~'.expand("")) else " should already be getting treatment as a directory let newdir= a:newdir @@ -5249,18 +5339,18 @@ fun! s:NetrwHide(islocal) let svpos= netrw#SavePosn() if exists("s:netrwmarkfilelist_{bufnr('%')}") -" call Decho("((g:netrw_hide == 1)? "unhide" : "hide")." files in markfilelist<".string(s:netrwmarkfilelist_{bufnr("%")}).">") -" call Decho("g:netrw_list_hide<".g:netrw_list_hide.">") +" call Decho("((g:netrw_hide == 1)? "unhide" : "hide")." files in markfilelist<".string(s:netrwmarkfilelist_{bufnr("%")}).">",'~'.expand("")) +" call Decho("g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("")) " hide the files in the markfile list for fname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("match(g:netrw_list_hide<".g:netrw_list_hide.'> fname<\<'.fname.'\>>)='.match(g:netrw_list_hide,'\<'.fname.'\>')." l:isk=".&l:isk) +" call Decho("match(g:netrw_list_hide<".g:netrw_list_hide.'> fname<\<'.fname.'\>>)='.match(g:netrw_list_hide,'\<'.fname.'\>')." l:isk=".&l:isk,'~'.expand("")) if match(g:netrw_list_hide,'\<'.fname.'\>') != -1 " remove fname from hiding list let g:netrw_list_hide= substitute(g:netrw_list_hide,'..\<'.escape(fname,g:netrw_fname_escape).'\>..','','') let g:netrw_list_hide= substitute(g:netrw_list_hide,',,',',','g') let g:netrw_list_hide= substitute(g:netrw_list_hide,'^,\|,$','','') -" call Decho("unhide: g:netrw_list_hide<".g:netrw_list_hide.">") +" call Decho("unhide: g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("")) else " append fname to hiding list if exists("g:netrw_list_hide") && g:netrw_list_hide != "" @@ -5268,7 +5358,7 @@ fun! s:NetrwHide(islocal) else let g:netrw_list_hide= '\<'.escape(fname,g:netrw_fname_escape).'\>' endif -" call Decho("hide: g:netrw_list_hide<".g:netrw_list_hide.">") +" call Decho("hide: g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("")) endif endfor NetrwKeepj call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) @@ -5294,6 +5384,32 @@ fun! s:NetrwHide(islocal) endfun " --------------------------------------------------------------------- +" s:NetrwHideEdit: allows user to edit the file/directory hiding list {{{2 +fun! s:NetrwHideEdit(islocal) +" call Dfunc("NetrwHideEdit(islocal=".a:islocal.")") + + let ykeep= @@ + " save current cursor position + let svpos= netrw#SavePosn() + + " get new hiding list from user + call inputsave() + let newhide= input("Edit Hiding List: ",g:netrw_list_hide) + call inputrestore() + let g:netrw_list_hide= newhide +" call Decho("new g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("")) + + " refresh the listing + sil NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,"./")) + + " restore cursor position + call netrw#RestorePosn(svpos) + let @@= ykeep + +" call Dret("NetrwHideEdit") +endfun + +" --------------------------------------------------------------------- " s:NetrwHidden: invoked by "gh" {{{2 fun! s:NetrwHidden(islocal) " call Dfunc("s:NetrwHidden()") @@ -5325,9 +5441,9 @@ fun! s:NetrwHome() else " go to vim plugin home for home in split(&rtp,',') + [''] - if isdirectory(home) && filewritable(home) | break | endif + if isdirectory(s:NetrwFile(home)) && filewritable(s:NetrwFile(home)) | break | endif let basehome= substitute(home,'[/\\]\.vim$','','') - if isdirectory(basehome) && filewritable(basehome) + if isdirectory(s:NetrwFile(basehome)) && filewritable(s:NetrwFile(basehome)) let home= basehome."/.vim" break endif @@ -5341,9 +5457,9 @@ fun! s:NetrwHome() endif endif " insure that the home directory exists - if g:netrw_dirhistmax > 0 && !isdirectory(home) + if g:netrw_dirhistmax > 0 && !isdirectory(s:NetrwFile(home)) if exists("g:netrw_mkdir") - call system(g:netrw_mkdir." ".shellescape(home)) + call system(g:netrw_mkdir." ".s:ShellEscape(s:NetrwFile(home))) else call mkdir(home) endif @@ -5370,8 +5486,8 @@ fun! s:NetrwLeftmouse(islocal) let mouse_lnum = v:mouse_lnum let wlastline = line('w$') let lastline = line('$') -" call Decho("v:mouse_lnum=".mouse_lnum." line(w$)=".wlastline." line($)=".lastline." v:mouse_win=".v:mouse_win." winnr#".winnr()) -" call Decho("v:mouse_col =".v:mouse_col." col=".col(".")." wincol =".wincol()." winwidth =".winwidth(0)) +" call Decho("v:mouse_lnum=".mouse_lnum." line(w$)=".wlastline." line($)=".lastline." v:mouse_win=".v:mouse_win." winnr#".winnr(),'~'.expand("")) +" call Decho("v:mouse_col =".v:mouse_col." col=".col(".")." wincol =".wincol()." winwidth =".winwidth(0),'~'.expand("")) if mouse_lnum >= wlastline + 1 || v:mouse_win != winnr() " appears to be a status bar leftmouse click let @@= ykeep @@ -5382,7 +5498,7 @@ fun! s:NetrwLeftmouse(islocal) " Windows are separated by vertical separator bars - but the mouse seems to be doing what it should when dragging that bar " without this test when its disabled. " May 26, 2014: edit file, :Lex, resize window -- causes refresh. Reinstated a modified test. See if problems develop. -" call Decho("v:mouse_col=".v:mouse_col." col#".col('.')." virtcol#".virtcol('.')." col($)#".col("$")." virtcol($)#".virtcol("$")) +" call Decho("v:mouse_col=".v:mouse_col." col#".col('.')." virtcol#".virtcol('.')." col($)#".col("$")." virtcol($)#".virtcol("$"),'~'.expand("")) if v:mouse_col > virtcol('.') let @@= ykeep " call Dret("s:NetrwLeftmouse : detected a vertical separator bar leftmouse click") @@ -5403,6 +5519,14 @@ fun! s:NetrwLeftmouse(islocal) endfun " --------------------------------------------------------------------- +" s:NetrwCLeftmouse: used to select a file/directory for a target {{{2 +fun! s:NetrwCLeftmouse(islocal) +" call Dfunc("s:NetrwCLeftmouse(islocal=".a:islocal.")") + call s:NetrwMarkFileTgt(a:islocal) +" call Dret("s:NetrwCLeftmouse") +endfun + +" --------------------------------------------------------------------- " s:NetrwServerEdit: edit file in a server gvim, usually NETRWSERVER (implements ){{{2 " a:islocal=0 : not used, remote " a:islocal=1 : no used, local @@ -5412,10 +5536,12 @@ fun! s:NetrwServerEdit(islocal,fname) " call Dfunc("s:NetrwServerEdit(islocal=".a:islocal.",fname<".a:fname.">)") let islocal = a:islocal%2 " =0: remote =1: local let ctrlr = a:islocal >= 2 " =0: not used =1: used - - if (islocal && isdirectory(a:fname)) || (!islocal && a:fname =~ '/$') +" call Decho("islocal=".islocal." ctrlr=".ctrlr,'~'.expand("")) + + if (islocal && isdirectory(s:NetrwFile(a:fname))) || (!islocal && a:fname =~ '/$') " handle directories in the local window -- not in the remote vim server " user must have closed the NETRWSERVER window. Treat as a normal editing from netrw. +" call Decho("handling directory in client window",'~'.expand("")) let g:netrw_browse_split= 0 if exists("s:netrw_browse_split_".winnr()) let g:netrw_browse_split= s:netrw_browse_split_{winnr()} @@ -5426,22 +5552,23 @@ fun! s:NetrwServerEdit(islocal,fname) return endif +" call Decho("handling file in server window",'~'.expand("")) if has("clientserver") && executable("gvim") -" call Decho("has clientserver and gvim") +" call Decho("has clientserver and gvim",'~'.expand("")) if exists("g:netrw_browse_split") && type(g:netrw_browse_split) == 3 -" call Decho("g:netrw_browse_split=".string(g:netrw_browse_split)) +" call Decho("g:netrw_browse_split=".string(g:netrw_browse_split),'~'.expand("")) let srvrname = g:netrw_browse_split[0] let tabnum = g:netrw_browse_split[1] let winnum = g:netrw_browse_split[2] if serverlist() !~ '\<'.srvrname.'\>' -" call Decho("server not available; ctrlr=".ctrlr) +" call Decho("server not available; ctrlr=".ctrlr,'~'.expand("")) if !ctrlr " user must have closed the server window and the user did not use , but " used something like . -" call Decho("user must have closed server AND did not use ctrl-r") +" call Decho("user must have closed server AND did not use ctrl-r",'~'.expand("")) if exists("g:netrw_browse_split") unlet g:netrw_browse_split endif @@ -5455,27 +5582,27 @@ fun! s:NetrwServerEdit(islocal,fname) elseif has("win32") && executable("start") " start up remote netrw server under windows -" call Decho("starting up gvim server<".srvrname."> for windows") +" call Decho("starting up gvim server<".srvrname."> for windows",'~'.expand("")) call system("start gvim --servername ".srvrname) else " start up remote netrw server under linux -" call Decho("starting up gvim server<".srvrname.">") +" call Decho("starting up gvim server<".srvrname.">",'~'.expand("")) call system("gvim --servername ".srvrname) endif endif -" call Decho("srvrname<".srvrname."> tabnum=".tabnum." winnum=".winnum." server-editing<".a:fname.">") +" call Decho("srvrname<".srvrname."> tabnum=".tabnum." winnum=".winnum." server-editing<".a:fname.">",'~'.expand("")) call remote_send(srvrname,":tabn ".tabnum."\") call remote_send(srvrname,":".winnum."wincmd w\") - call remote_send(srvrname,":e ".fnameescape(a:fname)."\") + call remote_send(srvrname,":e ".fnameescape(s:NetrwFile(a:fname))."\") else if serverlist() !~ '\<'.g:netrw_servername.'\>' if !ctrlr -" call Decho("server<".g:netrw_servername."> not available and ctrl-r not used") +" call Decho("server<".g:netrw_servername."> not available and ctrl-r not used",'~'.expand("")) if exists("g:netrw_browse_split") unlet g:netrw_browse_split endif @@ -5485,14 +5612,14 @@ fun! s:NetrwServerEdit(islocal,fname) return else -" call Decho("server<".g:netrw_servername."> not available but ctrl-r used") +" call Decho("server<".g:netrw_servername."> not available but ctrl-r used",'~'.expand("")) if has("win32") && executable("start") " start up remote netrw server under windows -" call Decho("starting up gvim server<".g:netrw_servername."> for windows") +" call Decho("starting up gvim server<".g:netrw_servername."> for windows",'~'.expand("")) call system("start gvim --servername ".g:netrw_servername) else " start up remote netrw server under linux -" call Decho("starting up gvim server<".g:netrw_servername.">") +" call Decho("starting up gvim server<".g:netrw_servername.">",'~'.expand("")) call system("gvim --servername ".g:netrw_servername) endif endif @@ -5500,8 +5627,8 @@ fun! s:NetrwServerEdit(islocal,fname) while 1 try -" call Decho("remote-send: e ".a:fname) - call remote_send(g:netrw_servername,":e ".fnameescape(a:fname)."\") +" call Decho("remote-send: e ".a:fname,'~'.expand("")) + call remote_send(g:netrw_servername,":e ".fnameescape(s:NetrwFile(a:fname))."\") break catch /^Vim\%((\a\+)\)\=:E241/ sleep 200m @@ -5528,7 +5655,7 @@ endfun " s:NetrwSLeftmouse: marks the file under the cursor. May be dragged to select additional files {{{2 fun! s:NetrwSLeftmouse(islocal) " call Dfunc("s:NetrwSLeftmouse(islocal=".a:islocal.")") - + let s:ngw= s:NetrwGetWord() call s:NetrwMarkFile(a:islocal,s:ngw) @@ -5587,7 +5714,7 @@ fun! s:NetrwListHide() " string. Use the first character left as a separator character. let listhide= g:netrw_list_hide let sep = strpart(substitute('/~@#$%^&*{};:,<.>?|1234567890','['.escape(listhide,'-]^\').']','','ge'),1,1) -" call Decho("sep=".sep) +" call Decho("sep=".sep,'~'.expand("")) while listhide != "" if listhide =~ ',' @@ -5600,10 +5727,10 @@ fun! s:NetrwListHide() " Prune the list by hiding any files which match if g:netrw_hide == 1 -" call Decho("hiding<".hide."> listhide<".listhide.">") +" call Decho("hiding<".hide."> listhide<".listhide.">",'~'.expand("")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d' elseif g:netrw_hide == 2 -" call Decho("showing<".hide."> listhide<".listhide.">") +" call Decho("showing<".hide."> listhide<".listhide.">",'~'.expand("")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'s@^@ /-KEEP-/ @' endif endwhile @@ -5621,52 +5748,6 @@ fun! s:NetrwListHide() endfun " --------------------------------------------------------------------- -" NetrwHideEdit: allows user to edit the file/directory hiding list -fun! s:NetrwHideEdit(islocal) -" call Dfunc("NetrwHideEdit(islocal=".a:islocal.")") - - let ykeep= @@ - " save current cursor position - let svpos= netrw#SavePosn() - - " get new hiding list from user - call inputsave() - let newhide= input("Edit Hiding List: ",g:netrw_list_hide) - call inputrestore() - let g:netrw_list_hide= newhide -" call Decho("new g:netrw_list_hide<".g:netrw_list_hide.">") - - " refresh the listing - sil NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,"./")) - - " restore cursor position - call netrw#RestorePosn(svpos) - let @@= ykeep - -" call Dret("NetrwHideEdit") -endfun - -" --------------------------------------------------------------------- -" NetSortSequence: allows user to edit the sorting sequence -fun! s:NetSortSequence(islocal) -" call Dfunc("NetSortSequence(islocal=".a:islocal.")") - - let ykeep= @@ - let svpos= netrw#SavePosn() - call inputsave() - let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence) - call inputrestore() - - " refresh the listing - let g:netrw_sort_sequence= newsortseq - NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) - NetrwKeepj call netrw#RestorePosn(svpos) - let @@= ykeep - -" call Dret("NetSortSequence") -endfun - -" --------------------------------------------------------------------- " s:NetrwMakeDir: this function makes a directory (both local and remote) {{{2 " implements the "d" mapping. fun! s:NetrwMakeDir(usrhost) @@ -5679,7 +5760,7 @@ fun! s:NetrwMakeDir(usrhost) call inputsave() let newdirname= input("Please give directory name: ") call inputrestore() -" call Decho("newdirname<".newdirname.">") +" call Decho("newdirname<".newdirname.">",'~'.expand("")) if newdirname == "" let @@= ykeep @@ -5688,13 +5769,13 @@ fun! s:NetrwMakeDir(usrhost) endif if a:usrhost == "" -" call Decho("local mkdir") +" call Decho("local mkdir",'~'.expand("")) " Local mkdir: " sanity checks let fullnewdir= b:netrw_curdir.'/'.newdirname -" call Decho("fullnewdir<".fullnewdir.">") - if isdirectory(fullnewdir) +" call Decho("fullnewdir<".fullnewdir.">",'~'.expand("")) + if isdirectory(s:NetrwFile(fullnewdir)) if !exists("g:netrw_quiet") NetrwKeepj call netrw#ErrorMsg(s:WARNING,"<".newdirname."> is already a directory!",24) endif @@ -5722,23 +5803,23 @@ fun! s:NetrwMakeDir(usrhost) else let netrw_origdir= s:NetrwGetcwd(1) call s:NetrwLcd(b:netrw_curdir) -" call Decho("netrw_origdir<".netrw_origdir.">: lcd b:netrw_curdir<".fnameescape(b:netrw_curdir).">") - call s:NetrwExe("sil! !".g:netrw_localmkdir.' '.shellescape(newdirname,1)) +" call Decho("netrw_origdir<".netrw_origdir.">: lcd b:netrw_curdir<".fnameescape(b:netrw_curdir).">",'~'.expand("")) + call s:NetrwExe("sil! !".g:netrw_localmkdir.' '.s:ShellEscape(newdirname,1)) if v:shell_error != 0 let @@= ykeep call netrw#ErrorMsg(s:ERROR,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80) -" call Dret("s:NetrwMakeDir : failed: sil! !".g:netrw_localmkdir.' '.shellescape(newdirname,1)) +" call Dret("s:NetrwMakeDir : failed: sil! !".g:netrw_localmkdir.' '.s:ShellEscape(newdirname,1)) return endif if !g:netrw_keepdir -" call Decho("restoring netrw_origdir since g:netrw_keepdir=".g:netrw_keepdir) +" call Decho("restoring netrw_origdir since g:netrw_keepdir=".g:netrw_keepdir,'~'.expand("")) call s:NetrwLcd(netrw_origdir) endif endif if v:shell_error == 0 " refresh listing -" call Decho("refresh listing") +" call Decho("refresh listing",'~'.expand("")) let svpos= netrw#SavePosn() call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) call netrw#RestorePosn(svpos) @@ -5749,10 +5830,10 @@ fun! s:NetrwMakeDir(usrhost) elseif !exists("b:netrw_method") || b:netrw_method == 4 " Remote mkdir: using ssh -" call Decho("remote mkdir") +" call Decho("remote mkdir",'~'.expand("")) let mkdircmd = s:MakeSshCmd(g:netrw_mkdir_cmd) let newdirname= substitute(b:netrw_curdir,'^\%(.\{-}/\)\{3}\(.*\)$','\1','').newdirname - call s:NetrwExe("sil! !".mkdircmd." ".shellescape(newdirname,1)) + call s:NetrwExe("sil! !".mkdircmd." ".s:ShellEscape(newdirname,1)) if v:shell_error == 0 " refresh listing let svpos= netrw#SavePosn() @@ -5766,9 +5847,9 @@ fun! s:NetrwMakeDir(usrhost) elseif b:netrw_method == 2 " Remote mkdir: using ftp+.netrc let svpos= netrw#SavePosn() -" call Decho("b:netrw_curdir<".b:netrw_curdir.">") +" call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("")) if exists("b:netrw_fname") -" call Decho("b:netrw_fname<".b:netrw_fname.">") +" call Decho("b:netrw_fname<".b:netrw_fname.">",'~'.expand("")) let remotepath= b:netrw_fname else let remotepath= "" @@ -5780,9 +5861,9 @@ fun! s:NetrwMakeDir(usrhost) elseif b:netrw_method == 3 " Remote mkdir: using ftp + machine, id, passwd, and fname (ie. no .netrc) let svpos= netrw#SavePosn() -" call Decho("b:netrw_curdir<".b:netrw_curdir.">") +" call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("")) if exists("b:netrw_fname") -" call Decho("b:netrw_fname<".b:netrw_fname.">") +" call Decho("b:netrw_fname<".b:netrw_fname.">",'~'.expand("")) let remotepath= b:netrw_fname else let remotepath= "" @@ -5805,19 +5886,19 @@ fun! s:TreeSqueezeDir(islocal) let curdepth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') let iline = line(".") - 1 let stopline = (exists("w:netrw_bannercnt")? (w:netrw_bannercnt + 1) : 1) -" call Decho("curdepth=".curdepth) -" call Decho("stopline#".stopline) -" call Decho("starting with line#".line(".").": ".getline('.')) +" call Decho("curdepth=".curdepth,'~'.expand("")) +" call Decho("stopline#".stopline,'~'.expand("")) +" call Decho("starting with line#".line(".").": ".getline('.'),'~'.expand("")) while iline > stopline " find a line that has less depth let depth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') -" call Decho("considering line#".line(".").": ".getline('.')) +" call Decho("considering line#".line(".").": ".getline('.'),'~'.expand("")) if depth < curdepth break endif norm! k endwhile -" call Decho("squeezing at line#".line(".").": ".getline('.')) +" call Decho("squeezing at line#".line(".").": ".getline('.'),'~'.expand("")) call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,s:NetrwGetWord())) endif " call Dret("s:TreeSqueezeDir") @@ -5829,128 +5910,130 @@ fun! s:NetrwMaps(islocal) " call Dfunc("s:NetrwMaps(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">") if g:netrw_mousemaps && g:netrw_retmap -" call Decho("set up Rexplore 2-leftmouse") +" call Decho("set up Rexplore 2-leftmouse",'~'.expand("")) if !hasmapto("NetrwReturn") if maparg("<2-leftmouse>","n") == "" || maparg("<2-leftmouse>","n") =~ '^-$' -" call Decho("making map for 2-leftmouse") +" call Decho("making map for 2-leftmouse",'~'.expand("")) nmap <2-leftmouse> NetrwReturn elseif maparg("","n") == "" -" call Decho("making map for c-leftmouse") +" call Decho("making map for c-leftmouse",'~'.expand("")) nmap NetrwReturn endif endif nno NetrwReturn :Rexplore -" call Decho("made NetrwReturn map") +" call Decho("made NetrwReturn map",'~'.expand("")) endif if a:islocal -" call Decho("make local maps") +" call Decho("make local maps",'~'.expand("")) " local normal-mode maps - nnoremap a :call NetrwHide(1) - nnoremap % :call NetrwOpenFile(1) - nnoremap c :call NetrwLcd(b:netrw_curdir) - nnoremap C :call NetrwSetChgwin() - nnoremap :call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,NetrwGetWord())) - nnoremap :call TreeSqueezeDir(1) - nnoremap :call NetrwServerEdit(3,NetrwGetWord()) - nnoremap d :call NetrwMakeDir("") - nnoremap - :call NetrwBrowseUpDir(1) - nnoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) - nnoremap gd :call NetrwForceChgDir(1,NetrwGetWord()) - nnoremap gf :call NetrwForceFile(1,NetrwGetWord()) - nnoremap gh :call NetrwHidden(1) - nnoremap gp :call NetrwChgPerm(1,b:netrw_curdir) - nnoremap I :call NetrwBannerCtrl(1) - nnoremap i :call NetrwListStyle(1) - nnoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) - nnoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) - nnoremap mc :call NetrwMarkFileCopy(1) - nnoremap md :call NetrwMarkFileDiff(1) - nnoremap me :call NetrwMarkFileEdit(1) - nnoremap mf :call NetrwMarkFile(1,NetrwGetWord()) - nnoremap mF :call NetrwUnmarkList(bufnr("%"),b:netrw_curdir) - nnoremap mg :call NetrwMarkFileGrep(1) - nnoremap mh :call NetrwMarkHideSfx(1) - nnoremap mm :call NetrwMarkFileMove(1) - nnoremap mp :call NetrwMarkFilePrint(1) - nnoremap mr :call NetrwMarkFileRegexp(1) - nnoremap ms :call NetrwMarkFileSource(1) - nnoremap mt :call NetrwMarkFileTgt(1) - nnoremap mT :call NetrwMarkFileTag(1) - nnoremap mu :call NetrwUnMarkFile(1) - nnoremap mv :call NetrwMarkFileVimCmd(1) - nnoremap mx :call NetrwMarkFileExe(1,0) - nnoremap mX :call NetrwMarkFileExe(1,1) - nnoremap mz :call NetrwMarkFileCompress(1) - nnoremap O :call NetrwObtain(1) - nnoremap o :call NetrwSplit(3) - nnoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) - nnoremap P :call NetrwPrevWinOpen(1) - nnoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) - nnoremap qf :call NetrwFileInfo(1,NetrwGetWord()) - nnoremap qF :call NetrwMarkFileQFEL(1,getqflist()) - nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) - nnoremap s :call NetrwSortStyle(1) - nnoremap S :call NetSortSequence(1) - nnoremap t :call NetrwSplit(4) - nnoremap Tb :call NetrwSetTgt('b',v:count1) - nnoremap Th :call NetrwSetTgt('h',v:count) - nnoremap u :call NetrwBookHistHandler(4,expand("%")) - nnoremap U :call NetrwBookHistHandler(5,expand("%")) - nnoremap v :call NetrwSplit(5) - nnoremap x :call netrw#BrowseX(NetrwBrowseChgDir(1,NetrwGetWord(),0),0)" - nnoremap X :call NetrwLocalExecute(expand(""))" + nnoremap a :call NetrwHide(1) + nnoremap % :call NetrwOpenFile(1) + nnoremap c :call NetrwLcd(b:netrw_curdir) + nnoremap C :call NetrwSetChgwin() + nnoremap :call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,NetrwGetWord())) + nnoremap :call TreeSqueezeDir(1) + nnoremap :call NetrwServerEdit(3,NetrwGetWord()) + nnoremap d :call NetrwMakeDir("") + nnoremap - :call NetrwBrowseUpDir(1) + nnoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) + nnoremap gd :call NetrwForceChgDir(1,NetrwGetWord()) + nnoremap gf :call NetrwForceFile(1,NetrwGetWord()) + nnoremap gh :call NetrwHidden(1) + nnoremap gn :call netrw#SetTreetop(NetrwGetWord()) + nnoremap gp :call NetrwChgPerm(1,b:netrw_curdir) + nnoremap I :call NetrwBannerCtrl(1) + nnoremap i :call NetrwListStyle(1) + nnoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) + nnoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) + nnoremap mc :call NetrwMarkFileCopy(1) + nnoremap md :call NetrwMarkFileDiff(1) + nnoremap me :call NetrwMarkFileEdit(1) + nnoremap mf :call NetrwMarkFile(1,NetrwGetWord()) + nnoremap mF :call NetrwUnmarkList(bufnr("%"),b:netrw_curdir) + nnoremap mg :call NetrwMarkFileGrep(1) + nnoremap mh :call NetrwMarkHideSfx(1) + nnoremap mm :call NetrwMarkFileMove(1) + nnoremap mp :call NetrwMarkFilePrint(1) + nnoremap mr :call NetrwMarkFileRegexp(1) + nnoremap ms :call NetrwMarkFileSource(1) + nnoremap mt :call NetrwMarkFileTgt(1) + nnoremap mT :call NetrwMarkFileTag(1) + nnoremap mu :call NetrwUnMarkFile(1) + nnoremap mv :call NetrwMarkFileVimCmd(1) + nnoremap mx :call NetrwMarkFileExe(1,0) + nnoremap mX :call NetrwMarkFileExe(1,1) + nnoremap mz :call NetrwMarkFileCompress(1) + nnoremap O :call NetrwObtain(1) + nnoremap o :call NetrwSplit(3) + nnoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) + nnoremap P :call NetrwPrevWinOpen(1) + nnoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) + nnoremap qf :call NetrwFileInfo(1,NetrwGetWord()) + nnoremap qF :call NetrwMarkFileQFEL(1,getqflist()) + nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) + nnoremap s :call NetrwSortStyle(1) + nnoremap S :call NetSortSequence(1) + nnoremap t :call NetrwSplit(4) + nnoremap Tb :call NetrwSetTgt('b',v:count1) + nnoremap Th :call NetrwSetTgt('h',v:count) + nnoremap u :call NetrwBookHistHandler(4,expand("%")) + nnoremap U :call NetrwBookHistHandler(5,expand("%")) + nnoremap v :call NetrwSplit(5) + nnoremap x :call netrw#BrowseX(NetrwBrowseChgDir(1,NetrwGetWord(),0),0)" + nnoremap X :call NetrwLocalExecute(expand(""))" " local insert-mode maps - inoremap a :call NetrwHide(1) - inoremap c :exe "NetrwKeepj lcd ".fnameescape(b:netrw_curdir) - inoremap c :call NetrwLcd(b:netrw_curdir) - inoremap C :call NetrwSetChgwin() - inoremap % :call NetrwOpenFile(1) - inoremap - :call NetrwBrowseUpDir(1) - inoremap :call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,NetrwGetWord())) - inoremap :call TreeSqueezeDir(1) - inoremap d :call NetrwMakeDir("") - inoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) - inoremap gh :call NetrwHidden(1) - inoremap gp :call NetrwChgPerm(1,b:netrw_curdir) - inoremap I :call NetrwBannerCtrl(1) - inoremap i :call NetrwListStyle(1) - inoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) - inoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) - inoremap mc :call NetrwMarkFileCopy(1) - inoremap md :call NetrwMarkFileDiff(1) - inoremap me :call NetrwMarkFileEdit(1) - inoremap mf :call NetrwMarkFile(1,NetrwGetWord()) - inoremap mg :call NetrwMarkFileGrep(1) - inoremap mh :call NetrwMarkHideSfx(1) - inoremap mm :call NetrwMarkFileMove(1) - inoremap mp :call NetrwMarkFilePrint(1) - inoremap mr :call NetrwMarkFileRegexp(1) - inoremap ms :call NetrwMarkFileSource(1) - inoremap mT :call NetrwMarkFileTag(1) - inoremap mt :call NetrwMarkFileTgt(1) - inoremap mu :call NetrwUnMarkFile(1) - inoremap mv :call NetrwMarkFileVimCmd(1) - inoremap mx :call NetrwMarkFileExe(1,0) - inoremap mX :call NetrwMarkFileExe(1,1) - inoremap mz :call NetrwMarkFileCompress(1) - inoremap O :call NetrwObtain(1) - inoremap o :call NetrwSplit(3) - inoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) - inoremap P :call NetrwPrevWinOpen(1) - inoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) - inoremap qf :call NetrwFileInfo(1,NetrwGetWord()) - inoremap qF :call NetrwMarkFileQFEL(1,getqflist()) - inoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) - inoremap s :call NetrwSortStyle(1) - inoremap S :call NetSortSequence(1) - inoremap t :call NetrwSplit(4) - inoremap Tb :call NetrwSetTgt('b',v:count1) - inoremap Th :call NetrwSetTgt('h',v:count) - inoremap u :call NetrwBookHistHandler(4,expand("%")) - inoremap U :call NetrwBookHistHandler(5,expand("%")) - inoremap v :call NetrwSplit(5) - inoremap x :call netrw#BrowseX(NetrwBrowseChgDir(1,NetrwGetWord(),0),0)" + inoremap a :call NetrwHide(1) + inoremap c :exe "NetrwKeepj lcd ".fnameescape(b:netrw_curdir) + inoremap c :call NetrwLcd(b:netrw_curdir) + inoremap C :call NetrwSetChgwin() + inoremap % :call NetrwOpenFile(1) + inoremap - :call NetrwBrowseUpDir(1) + inoremap :call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,NetrwGetWord())) + inoremap :call TreeSqueezeDir(1) + inoremap d :call NetrwMakeDir("") + inoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) + inoremap gh :call NetrwHidden(1) + nnoremap gn :call netrw#SetTreetop(NetrwGetWord()) + inoremap gp :call NetrwChgPerm(1,b:netrw_curdir) + inoremap I :call NetrwBannerCtrl(1) + inoremap i :call NetrwListStyle(1) + inoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) + inoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) + inoremap mc :call NetrwMarkFileCopy(1) + inoremap md :call NetrwMarkFileDiff(1) + inoremap me :call NetrwMarkFileEdit(1) + inoremap mf :call NetrwMarkFile(1,NetrwGetWord()) + inoremap mg :call NetrwMarkFileGrep(1) + inoremap mh :call NetrwMarkHideSfx(1) + inoremap mm :call NetrwMarkFileMove(1) + inoremap mp :call NetrwMarkFilePrint(1) + inoremap mr :call NetrwMarkFileRegexp(1) + inoremap ms :call NetrwMarkFileSource(1) + inoremap mT :call NetrwMarkFileTag(1) + inoremap mt :call NetrwMarkFileTgt(1) + inoremap mu :call NetrwUnMarkFile(1) + inoremap mv :call NetrwMarkFileVimCmd(1) + inoremap mx :call NetrwMarkFileExe(1,0) + inoremap mX :call NetrwMarkFileExe(1,1) + inoremap mz :call NetrwMarkFileCompress(1) + inoremap O :call NetrwObtain(1) + inoremap o :call NetrwSplit(3) + inoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) + inoremap P :call NetrwPrevWinOpen(1) + inoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) + inoremap qf :call NetrwFileInfo(1,NetrwGetWord()) + inoremap qF :call NetrwMarkFileQFEL(1,getqflist()) + inoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) + inoremap s :call NetrwSortStyle(1) + inoremap S :call NetSortSequence(1) + inoremap t :call NetrwSplit(4) + inoremap Tb :call NetrwSetTgt('b',v:count1) + inoremap Th :call NetrwSetTgt('h',v:count) + inoremap u :call NetrwBookHistHandler(4,expand("%")) + inoremap U :call NetrwBookHistHandler(5,expand("%")) + inoremap v :call NetrwSplit(5) + inoremap x :call netrw#BrowseX(NetrwBrowseChgDir(1,NetrwGetWord(),0),0)" if !hasmapto('NetrwHideEdit') nmap NetrwHideEdit imap NetrwHideEdit @@ -5960,7 +6043,7 @@ fun! s:NetrwMaps(islocal) nmap NetrwRefresh imap NetrwRefresh endif - nnoremap NetrwRefresh :call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) + nnoremap NetrwRefresh :call NetrwRefresh(1,NetrwBrowseChgDir(1,(w:netrw_liststyle == 3)? w:netrw_treetop : './')) if s:didstarstar || !mapcheck("","n") nnoremap :Nexplore inoremap :Nexplore @@ -5972,144 +6055,149 @@ fun! s:NetrwMaps(islocal) let mapsafecurdir = escape(b:netrw_curdir, s:netrw_map_escape) if g:netrw_mousemaps == 1 nmap NetrwLeftmouse - nno NetrwLeftmouse :call NetrwLeftmouse(1) + nno NetrwLeftmouse :call NetrwLeftmouse(1) + nmap NetrwCLeftmouse + nno NetrwCLeftmouse :call NetrwCLeftmouse(1) nmap NetrwMiddlemouse - nno NetrwMiddlemouse :call NetrwPrevWinOpen(1) + nno NetrwMiddlemouse :call NetrwPrevWinOpen(1) nmap NetrwSLeftmouse - nno NetrwSLeftmouse :call NetrwSLeftmouse(1) + nno NetrwSLeftmouse :call NetrwSLeftmouse(1) nmap NetrwSLeftdrag - nno NetrwSLeftdrag :call NetrwSLeftdrag(1) + nno NetrwSLeftdrag :call NetrwSLeftdrag(1) nmap <2-leftmouse> Netrw2Leftmouse - nmap Netrw2Leftmouse - + nmap Netrw2Leftmouse - imap ILeftmouse - ino ILeftmouse :call NetrwLeftmouse(1) + ino ILeftmouse :call NetrwLeftmouse(1) imap IMiddlemouse - ino IMiddlemouse :call NetrwPrevWinOpen(1) + ino IMiddlemouse :call NetrwPrevWinOpen(1) imap ISLeftmouse - ino ISLeftmouse :call NetrwMarkFile(1,NetrwGetWord()) + ino ISLeftmouse :call NetrwMarkFile(1,NetrwGetWord()) exe 'nnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' exe 'vnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' exe 'inoremap :call NetrwLocalRm("'.mapsafecurdir.'")' endif - exe 'nnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' - exe 'nnoremap D :call NetrwLocalRm("'.mapsafecurdir.'")' - exe 'nnoremap R :call NetrwLocalRename("'.mapsafecurdir.'")' - exe 'nnoremap d :call NetrwMakeDir("")' - exe 'vnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' - exe 'vnoremap D :call NetrwLocalRm("'.mapsafecurdir.'")' - exe 'vnoremap R :call NetrwLocalRename("'.mapsafecurdir.'")' - exe 'inoremap :call NetrwLocalRm("'.mapsafecurdir.'")' - exe 'inoremap D :call NetrwLocalRm("'.mapsafecurdir.'")' - exe 'inoremap R :call NetrwLocalRename("'.mapsafecurdir.'")' - exe 'inoremap d :call NetrwMakeDir("")' + exe 'nnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' + exe 'nnoremap D :call NetrwLocalRm("'.mapsafecurdir.'")' + exe 'nnoremap R :call NetrwLocalRename("'.mapsafecurdir.'")' + exe 'nnoremap d :call NetrwMakeDir("")' + exe 'vnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' + exe 'vnoremap D :call NetrwLocalRm("'.mapsafecurdir.'")' + exe 'vnoremap R :call NetrwLocalRename("'.mapsafecurdir.'")' + exe 'inoremap :call NetrwLocalRm("'.mapsafecurdir.'")' + exe 'inoremap D :call NetrwLocalRm("'.mapsafecurdir.'")' + exe 'inoremap R :call NetrwLocalRename("'.mapsafecurdir.'")' + exe 'inoremap d :call NetrwMakeDir("")' nnoremap :he netrw-quickhelp + " support user-specified maps + call netrw#UserMaps(1) + else " remote -" call Decho("make remote maps") +" call Decho("make remote maps",'~'.expand("")) call s:RemotePathAnalysis(b:netrw_curdir) " remote normal-mode maps - nnoremap :call NetrwBrowse(0,NetrwBrowseChgDir(0,NetrwGetWord())) - nnoremap :call TreeSqueezeDir(0) - nnoremap :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) - nnoremap :call NetrwServerEdit(2,NetrwGetWord()) - nnoremap - :call NetrwBrowseUpDir(0) - nnoremap a :call NetrwHide(0) - nnoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) - nnoremap mc :call NetrwMarkFileCopy(0) - nnoremap md :call NetrwMarkFileDiff(0) - nnoremap me :call NetrwMarkFileEdit(0) - nnoremap mf :call NetrwMarkFile(0,NetrwGetWord()) - nnoremap mF :call NetrwUnmarkList(bufnr("%"),b:netrw_curdir) - nnoremap mg :call NetrwMarkFileGrep(0) - nnoremap mh :call NetrwMarkHideSfx(0) - nnoremap mm :call NetrwMarkFileMove(0) - nnoremap mp :call NetrwMarkFilePrint(0) - nnoremap mr :call NetrwMarkFileRegexp(0) - nnoremap ms :call NetrwMarkFileSource(0) - nnoremap mt :call NetrwMarkFileTgt(0) - nnoremap mT :call NetrwMarkFileTag(0) - nnoremap mu :call NetrwUnMarkFile(0) - nnoremap mv :call NetrwMarkFileVimCmd(0) - nnoremap mx :call NetrwMarkFileExe(0,0) - nnoremap mX :call NetrwMarkFileExe(0,1) - nnoremap mz :call NetrwMarkFileCompress(0) - nnoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) - nnoremap gd :call NetrwForceChgDir(0,NetrwGetWord()) - nnoremap gf :call NetrwForceFile(0,NetrwGetWord()) - nnoremap gh :call NetrwHidden(0) - nnoremap gp :call NetrwChgPerm(0,b:netrw_curdir) - nnoremap C :call NetrwSetChgwin() - nnoremap i :call NetrwListStyle(0) - nnoremap I :call NetrwBannerCtrl(1) - nnoremap o :call NetrwSplit(0) - nnoremap O :call NetrwObtain(0) - nnoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) - nnoremap P :call NetrwPrevWinOpen(0) - nnoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) - nnoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) - nnoremap qf :call NetrwFileInfo(0,NetrwGetWord()) - nnoremap qF :call NetrwMarkFileQFEL(0,getqflist()) - nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'./')) - nnoremap s :call NetrwSortStyle(0) - nnoremap S :call NetSortSequence(0) - nnoremap t :call NetrwSplit(1) - nnoremap Tb :call NetrwSetTgt('b',v:count1) - nnoremap Th :call NetrwSetTgt('h',v:count) - nnoremap u :call NetrwBookHistHandler(4,b:netrw_curdir) - nnoremap U :call NetrwBookHistHandler(5,b:netrw_curdir) - nnoremap v :call NetrwSplit(2) - nnoremap x :call netrw#BrowseX(NetrwBrowseChgDir(0,NetrwGetWord()),1) - nnoremap % :call NetrwOpenFile(0) + nnoremap :call NetrwBrowse(0,NetrwBrowseChgDir(0,NetrwGetWord())) + nnoremap :call TreeSqueezeDir(0) + nnoremap :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) + nnoremap :call NetrwServerEdit(2,NetrwGetWord()) + nnoremap - :call NetrwBrowseUpDir(0) + nnoremap a :call NetrwHide(0) + nnoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) + nnoremap mc :call NetrwMarkFileCopy(0) + nnoremap md :call NetrwMarkFileDiff(0) + nnoremap me :call NetrwMarkFileEdit(0) + nnoremap mf :call NetrwMarkFile(0,NetrwGetWord()) + nnoremap mF :call NetrwUnmarkList(bufnr("%"),b:netrw_curdir) + nnoremap mg :call NetrwMarkFileGrep(0) + nnoremap mh :call NetrwMarkHideSfx(0) + nnoremap mm :call NetrwMarkFileMove(0) + nnoremap mp :call NetrwMarkFilePrint(0) + nnoremap mr :call NetrwMarkFileRegexp(0) + nnoremap ms :call NetrwMarkFileSource(0) + nnoremap mt :call NetrwMarkFileTgt(0) + nnoremap mT :call NetrwMarkFileTag(0) + nnoremap mu :call NetrwUnMarkFile(0) + nnoremap mv :call NetrwMarkFileVimCmd(0) + nnoremap mx :call NetrwMarkFileExe(0,0) + nnoremap mX :call NetrwMarkFileExe(0,1) + nnoremap mz :call NetrwMarkFileCompress(0) + nnoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) + nnoremap gd :call NetrwForceChgDir(0,NetrwGetWord()) + nnoremap gf :call NetrwForceFile(0,NetrwGetWord()) + nnoremap gh :call NetrwHidden(0) + nnoremap gp :call NetrwChgPerm(0,b:netrw_curdir) + nnoremap C :call NetrwSetChgwin() + nnoremap i :call NetrwListStyle(0) + nnoremap I :call NetrwBannerCtrl(1) + nnoremap o :call NetrwSplit(0) + nnoremap O :call NetrwObtain(0) + nnoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) + nnoremap P :call NetrwPrevWinOpen(0) + nnoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) + nnoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) + nnoremap qf :call NetrwFileInfo(0,NetrwGetWord()) + nnoremap qF :call NetrwMarkFileQFEL(0,getqflist()) + nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'./')) + nnoremap s :call NetrwSortStyle(0) + nnoremap S :call NetSortSequence(0) + nnoremap t :call NetrwSplit(1) + nnoremap Tb :call NetrwSetTgt('b',v:count1) + nnoremap Th :call NetrwSetTgt('h',v:count) + nnoremap u :call NetrwBookHistHandler(4,b:netrw_curdir) + nnoremap U :call NetrwBookHistHandler(5,b:netrw_curdir) + nnoremap v :call NetrwSplit(2) + nnoremap x :call netrw#BrowseX(NetrwBrowseChgDir(0,NetrwGetWord()),1) + nnoremap % :call NetrwOpenFile(0) " remote insert-mode maps - inoremap :call NetrwBrowse(0,NetrwBrowseChgDir(0,NetrwGetWord())) - inoremap :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) - inoremap :call TreeSqueezeDir(0) - inoremap - :call NetrwBrowseUpDir(0) - inoremap a :call NetrwHide(0) - inoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) - inoremap mc :call NetrwMarkFileCopy(0) - inoremap md :call NetrwMarkFileDiff(0) - inoremap me :call NetrwMarkFileEdit(0) - inoremap mf :call NetrwMarkFile(0,NetrwGetWord()) - inoremap mg :call NetrwMarkFileGrep(0) - inoremap mh :call NetrwMarkHideSfx(0) - inoremap mm :call NetrwMarkFileMove(0) - inoremap mp :call NetrwMarkFilePrint(0) - inoremap mr :call NetrwMarkFileRegexp(0) - inoremap ms :call NetrwMarkFileSource(0) - inoremap mt :call NetrwMarkFileTgt(0) - inoremap mT :call NetrwMarkFileTag(0) - inoremap mu :call NetrwUnMarkFile(0) - nnoremap mv :call NetrwMarkFileVimCmd(1) - inoremap mx :call NetrwMarkFileExe(0,0) - inoremap mX :call NetrwMarkFileExe(0,1) - inoremap mv :call NetrwMarkFileVimCmd(0) - inoremap mz :call NetrwMarkFileCompress(0) - inoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) - inoremap gh :call NetrwHidden(0) - inoremap gp :call NetrwChgPerm(0,b:netrw_curdir) - inoremap C :call NetrwSetChgwin() - inoremap i :call NetrwListStyle(0) - inoremap I :call NetrwBannerCtrl(1) - inoremap o :call NetrwSplit(0) - inoremap O :call NetrwObtain(0) - inoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) - inoremap P :call NetrwPrevWinOpen(0) - inoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) - inoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) - inoremap qf :call NetrwFileInfo(0,NetrwGetWord()) - inoremap qF :call NetrwMarkFileQFEL(0,getqflist()) - inoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'./')) - inoremap s :call NetrwSortStyle(0) - inoremap S :call NetSortSequence(0) - inoremap t :call NetrwSplit(1) - inoremap Tb :call NetrwSetTgt('b',v:count1) - inoremap Th :call NetrwSetTgt('h',v:count) - inoremap u :call NetrwBookHistHandler(4,b:netrw_curdir) - inoremap U :call NetrwBookHistHandler(5,b:netrw_curdir) - inoremap v :call NetrwSplit(2) - inoremap x :call netrw#BrowseX(NetrwBrowseChgDir(0,NetrwGetWord()),1) - inoremap % :call NetrwOpenFile(0) + inoremap :call NetrwBrowse(0,NetrwBrowseChgDir(0,NetrwGetWord())) + inoremap :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) + inoremap :call TreeSqueezeDir(0) + inoremap - :call NetrwBrowseUpDir(0) + inoremap a :call NetrwHide(0) + inoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) + inoremap mc :call NetrwMarkFileCopy(0) + inoremap md :call NetrwMarkFileDiff(0) + inoremap me :call NetrwMarkFileEdit(0) + inoremap mf :call NetrwMarkFile(0,NetrwGetWord()) + inoremap mg :call NetrwMarkFileGrep(0) + inoremap mh :call NetrwMarkHideSfx(0) + inoremap mm :call NetrwMarkFileMove(0) + inoremap mp :call NetrwMarkFilePrint(0) + inoremap mr :call NetrwMarkFileRegexp(0) + inoremap ms :call NetrwMarkFileSource(0) + inoremap mt :call NetrwMarkFileTgt(0) + inoremap mT :call NetrwMarkFileTag(0) + inoremap mu :call NetrwUnMarkFile(0) + nnoremap mv :call NetrwMarkFileVimCmd(1) + inoremap mx :call NetrwMarkFileExe(0,0) + inoremap mX :call NetrwMarkFileExe(0,1) + inoremap mv :call NetrwMarkFileVimCmd(0) + inoremap mz :call NetrwMarkFileCompress(0) + inoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) + inoremap gh :call NetrwHidden(0) + inoremap gp :call NetrwChgPerm(0,b:netrw_curdir) + inoremap C :call NetrwSetChgwin() + inoremap i :call NetrwListStyle(0) + inoremap I :call NetrwBannerCtrl(1) + inoremap o :call NetrwSplit(0) + inoremap O :call NetrwObtain(0) + inoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) + inoremap P :call NetrwPrevWinOpen(0) + inoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) + inoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) + inoremap qf :call NetrwFileInfo(0,NetrwGetWord()) + inoremap qF :call NetrwMarkFileQFEL(0,getqflist()) + inoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'./')) + inoremap s :call NetrwSortStyle(0) + inoremap S :call NetSortSequence(0) + inoremap t :call NetrwSplit(1) + inoremap Tb :call NetrwSetTgt('b',v:count1) + inoremap Th :call NetrwSetTgt('h',v:count) + inoremap u :call NetrwBookHistHandler(4,b:netrw_curdir) + inoremap U :call NetrwBookHistHandler(5,b:netrw_curdir) + inoremap v :call NetrwSplit(2) + inoremap x :call netrw#BrowseX(NetrwBrowseChgDir(0,NetrwGetWord()),1) + inoremap % :call NetrwOpenFile(0) if !hasmapto('NetrwHideEdit') nmap NetrwHideEdit imap NetrwHideEdit @@ -6125,44 +6213,45 @@ fun! s:NetrwMaps(islocal) nnoremap NetrwRefresh :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) if g:netrw_mousemaps == 1 - nmap NetrwLeftmouse - nno NetrwLeftmouse :call NetrwLeftmouse(0) - nmap NetrwLeftdrag - nno NetrwLeftdrag :call NetrwLeftdrag(0) - nmap NetrwSLeftmouse - nno NetrwSLeftmouse :call NetrwSLeftmouse(0) - nmap NetrwSLeftdrag - nno NetrwSLeftdrag :call NetrwSLeftdrag(0) - nmap NetrwMiddlemouse - nno NetrwMiddlemouse :call NetrwPrevWinOpen(0) - nmap <2-leftmouse> Netrw2Leftmouse - nmap Netrw2Leftmouse - - imap ILeftmouse - ino ILeftmouse :call NetrwLeftmouse(0) - imap IMiddlemouse - ino IMiddlemouse :call NetrwPrevWinOpen(0) - imap ISLeftmouse - ino ISLeftmouse :call NetrwMarkFile(0,NetrwGetWord()) + nmap NetrwLeftmouse + nno NetrwLeftmouse :call NetrwLeftmouse(0) + nmap NetrwCLeftmouse + nno NetrwCLeftmouse :call NetrwCLeftmouse(0) + nmap NetrwSLeftmouse + nno NetrwSLeftmouse :call NetrwSLeftmouse(0) + nmap NetrwSLeftdrag + nno NetrwSLeftdrag :call NetrwSLeftdrag(0) + nmap NetrwMiddlemouse + nno NetrwMiddlemouse :call NetrwPrevWinOpen(0) + nmap <2-leftmouse> Netrw2Leftmouse + nmap Netrw2Leftmouse - + imap ILeftmouse + ino ILeftmouse :call NetrwLeftmouse(0) + imap IMiddlemouse + ino IMiddlemouse :call NetrwPrevWinOpen(0) + imap ISLeftmouse + ino ISLeftmouse :call NetrwMarkFile(0,NetrwGetWord()) exe 'nnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' exe 'vnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' exe 'inoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' endif - exe 'nnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'nnoremap d :call NetrwMakeDir("'.mapsafeusermach.'")' - exe 'nnoremap D :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'nnoremap R :call NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'vnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'vnoremap D :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'vnoremap R :call NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'inoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'inoremap d :call NetrwMakeDir("'.mapsafeusermach.'")' - exe 'inoremap D :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' - exe 'inoremap R :call NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'nnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'nnoremap d :call NetrwMakeDir("'.mapsafeusermach.'")' + exe 'nnoremap D :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'nnoremap R :call NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'vnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'vnoremap D :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'vnoremap R :call NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'inoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'inoremap d :call NetrwMakeDir("'.mapsafeusermach.'")' + exe 'inoremap D :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' + exe 'inoremap R :call NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")' nnoremap :he netrw-quickhelp inoremap :he netrw-quickhelp - endif - - NetrwKeepj call s:SetRexDir(a:islocal,b:netrw_curdir) + + " support user-specified maps + call netrw#UserMaps(0) + endif " call Dret("s:NetrwMaps") endfun @@ -6184,9 +6273,6 @@ fun! s:NetrwCommands(islocal) com! -buffer -nargs=+ -complete=file MF call s:NetrwMarkFiles(0,) endif com! -buffer -nargs=? -complete=file MT call s:NetrwMarkTarget() - " the following two commands are intended to be used for testing only, so I'm not advertising them in the manual - com! -buffer -nargs=0 CRL call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,s:NetrwGetWord())) - com! -buffer -nargs=0 CRR call NetrwBrowse(0,NetrwBrowseChgDir(0,NetrwGetWord())) " call Dret("s:NetrwCommands") endfun @@ -6196,16 +6282,21 @@ endfun " glob()ing only works with local files fun! s:NetrwMarkFiles(islocal,...) " call Dfunc("s:NetrwMarkFiles(islocal=".a:islocal."...) a:0=".a:0) - let i = 1 + let curdir = s:NetrwGetCurdir(a:islocal) + let i = 1 while i <= a:0 if a:islocal - let mffiles= glob(a:{i},0,1) + if v:version == 704 && has("patch656") + let mffiles= glob(a:{i},0,1,1) + else + let mffiles= glob(a:{i},0,1) + endif else let mffiles= [a:{i}] endif -" call Decho("mffiles".string(mffiles)) +" call Decho("mffiles".string(mffiles),'~'.expand("")) for mffile in mffiles -" call Decho("mffile<".mffile.">") +" call Decho("mffile<".mffile.">",'~'.expand("")) call s:NetrwMarkFile(a:islocal,mffile) endfor let i= i + 1 @@ -6214,18 +6305,20 @@ fun! s:NetrwMarkFiles(islocal,...) endfun " --------------------------------------------------------------------- -" s:NetrwMarkTarget: {{{2 +" s:NetrwMarkTarget: implements :MT (mark target) {{{2 fun! s:NetrwMarkTarget(...) " call Dfunc("s:NetrwMarkTarget() a:0=".a:0) if a:0 == 0 || (a:0 == 1 && a:1 == "") - let tgt= b:netrw_curdir - else - let tgt= a:1 - endif -" call Decho("tgt<".tgt.">") + let curdir = s:NetrwGetCurdir(1) + let tgt = b:netrw_curdir + else + let curdir = s:NetrwGetCurdir((a:1 =~ '^\a\{3,}://')? 0 : 1) + let tgt = a:1 + endif +" call Decho("tgt<".tgt.">",'~'.expand("")) let s:netrwmftgt = tgt - let s:netrwmftgt_islocal = tgt !~ '^\a\+://' - let curislocal = b:netrw_curdir !~ '^\a\+://' + let s:netrwmftgt_islocal = tgt !~ '^\a\{3,}://' + let curislocal = b:netrw_curdir !~ '^\a\{3,}://' let svpos = netrw#SavePosn() call s:NetrwRefresh(curislocal,s:NetrwBrowseChgDir(curislocal,'./')) call netrw#RestorePosn(svpos) @@ -6251,16 +6344,17 @@ endfun " b:netrw_islocal fun! s:NetrwMarkFile(islocal,fname) " call Dfunc("s:NetrwMarkFile(islocal=".a:islocal." fname<".a:fname.">)") +" call Decho("bufnr(%)=".bufnr("%").": ".bufname("%"),'~'.expand("")) " sanity check if empty(a:fname) " call Dret("s:NetrwMarkFile : emtpy fname") return endif + let curdir = s:NetrwGetCurdir(a:islocal) let ykeep = @@ let curbufnr= bufnr("%") - let curdir = b:netrw_curdir if a:fname =~ '^\a' let leader= '\<' else @@ -6272,29 +6366,30 @@ fun! s:NetrwMarkFile(islocal,fname) let trailer = '[@=|\/\*]\=\ze\%( \|\t\|$\)' endif - if exists("s:netrwmarkfilelist_{curbufnr}") + if exists("s:netrwmarkfilelist_".curbufnr) " markfile list pre-exists -" call Decho("starting s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">") -" call Decho("starting s:netrwmarkfilemtch_{curbufnr}<".s:netrwmarkfilemtch_{curbufnr}.">") +" call Decho("case s:netrwmarkfilelist_".curbufnr." already exists",'~'.expand("")) +" call Decho("starting s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("")) +" call Decho("starting s:netrwmarkfilemtch_".curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">",'~'.expand("")) let b:netrw_islocal= a:islocal if index(s:netrwmarkfilelist_{curbufnr},a:fname) == -1 " append filename to buffer's markfilelist -" call Decho("append filename<".a:fname."> to local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">") +" call Decho("append filename<".a:fname."> to local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("")) call add(s:netrwmarkfilelist_{curbufnr},a:fname) let s:netrwmarkfilemtch_{curbufnr}= s:netrwmarkfilemtch_{curbufnr}.'\|'.leader.escape(a:fname,g:netrw_markfileesc).trailer else " remove filename from buffer's markfilelist -" call Decho("remove filename<".a:fname."> from local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">") +" call Decho("remove filename<".a:fname."> from local markfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("")) 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") +" call Decho("markfile list now empty",'~'.expand("")) call s:NetrwUnmarkList(curbufnr,curdir) else " rebuild match list to display markings correctly -" call Decho("rebuild s:netrwmarkfilemtch_".curbufnr) +" call Decho("rebuild s:netrwmarkfilemtch_".curbufnr,'~'.expand("")) let s:netrwmarkfilemtch_{curbufnr}= "" let first = 1 for fname in s:netrwmarkfilelist_{curbufnr} @@ -6305,17 +6400,18 @@ fun! s:NetrwMarkFile(islocal,fname) endif let first= 0 endfor -" call Decho("ending s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">") +" call Decho("ending s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("")) endif endif else " initialize new markfilelist - -" call Decho("add fname<".a:fname."> to new markfilelist_".curbufnr) +" call Decho("case: initialize new markfilelist",'~'.expand("")) + +" call Decho("add fname<".a:fname."> to new markfilelist_".curbufnr,'~'.expand("")) let s:netrwmarkfilelist_{curbufnr}= [] - call add(s:netrwmarkfilelist_{curbufnr},a:fname) -" call Decho("ending s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">") + call add(s:netrwmarkfilelist_{curbufnr},substitute(a:fname,'[|@]$','','')) +" call Decho("ending s:netrwmarkfilelist_{curbufnr}<".string(s:netrwmarkfilelist_{curbufnr}).">",'~'.expand("")) " build initial markfile matching pattern if a:fname =~ '/$' @@ -6323,7 +6419,7 @@ fun! s:NetrwMarkFile(islocal,fname) else let s:netrwmarkfilemtch_{curbufnr}= leader.escape(a:fname,g:netrw_markfileesc).trailer endif -" call Decho("ending s:netrwmarkfilemtch_".curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">") +" call Decho("ending s:netrwmarkfilemtch_".curbufnr."<".s:netrwmarkfilemtch_{curbufnr}.">",'~'.expand("")) endif " handle global markfilelist @@ -6332,12 +6428,12 @@ fun! s:NetrwMarkFile(islocal,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).">") +" call Decho("append filename<".a:fname."> to global markfilelist<".string(s:netrwmarkfilelist).">",'~'.expand("")) else " remove new filename from global markfilelist -" call Decho("filter(".string(s:netrwmarkfilelist).",'v:val != '.".dname.")") +" call Decho("filter(".string(s:netrwmarkfilelist).",'v:val != '.".dname.")",'~'.expand("")) call filter(s:netrwmarkfilelist,'v:val != "'.dname.'"') -" call Decho("ending s:netrwmarkfilelist <".string(s:netrwmarkfilelist).">") +" call Decho("ending s:netrwmarkfilelist <".string(s:netrwmarkfilelist).">",'~'.expand("")) if s:netrwmarkfilelist == [] unlet s:netrwmarkfilelist endif @@ -6346,17 +6442,17 @@ fun! s:NetrwMarkFile(islocal,fname) " 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 +" call Decho("init s:netrwmarkfilelist<".string(s:netrwmarkfilelist).">",'~'.expand("")) + endif + + " set up 2match'ing to netrwmarkfilemtch_# list if exists("s:netrwmarkfilemtch_{curbufnr}") && s:netrwmarkfilemtch_{curbufnr} != "" -" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/") +" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/",'~'.expand("")) if exists("g:did_drchip_netrwlist_syntax") exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/" endif else -" call Decho("2match none") +" call Decho("2match none",'~'.expand("")) 2match none endif let @@= ykeep @@ -6374,7 +6470,7 @@ endfun fun! s:NetrwMarkFileCompress(islocal) " call Dfunc("s:NetrwMarkFileCompress(islocal=".a:islocal.")") let svpos = netrw#SavePosn() - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") " sanity check @@ -6383,25 +6479,25 @@ fun! s:NetrwMarkFileCompress(islocal) " call Dret("s:NetrwMarkFileCompress") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) if exists("s:netrwmarkfilelist_{curbufnr}") && exists("g:netrw_compress") && exists("g:netrw_decompress") " for every filename in the marked list for fname in s:netrwmarkfilelist_{curbufnr} let sfx= substitute(fname,'^.\{-}\(\.\a\+\)$','\1','') -" call Decho("extracted sfx<".sfx.">") +" call Decho("extracted sfx<".sfx.">",'~'.expand("")) if exists("g:netrw_decompress['".sfx."']") " fname has a suffix indicating that its compressed; apply associated decompression routine let exe= g:netrw_decompress[sfx] -" call Decho("fname<".fname."> is compressed so decompress with <".exe.">") +" call Decho("fname<".fname."> is compressed so decompress with <".exe.">",'~'.expand("")) let exe= netrw#WinPath(exe) if a:islocal if g:netrw_keepdir - let fname= shellescape(s:ComposePath(curdir,fname)) + let fname= s:ShellEscape(s:ComposePath(curdir,fname)) endif else - let fname= shellescape(b:netrw_curdir.fname,1) + let fname= s:ShellEscape(b:netrw_curdir.fname,1) endif if executable(exe) if a:islocal @@ -6419,10 +6515,10 @@ fun! s:NetrwMarkFileCompress(islocal) unlet exe elseif a:islocal " fname not a compressed file, so compress it - call system(netrw#WinPath(g:netrw_compress)." ".shellescape(s:ComposePath(b:netrw_curdir,fname))) + call system(netrw#WinPath(g:netrw_compress)." ".s:ShellEscape(s:ComposePath(b:netrw_curdir,fname))) else " fname not a compressed file, so compress it - NetrwKeepj call s:RemoteSystem(netrw#WinPath(g:netrw_compress)." ".shellescape(fname)) + NetrwKeepj call s:RemoteSystem(netrw#WinPath(g:netrw_compress)." ".s:ShellEscape(fname)) endif endfor " for every file in the marked list @@ -6443,11 +6539,7 @@ endfun fun! s:NetrwMarkFileCopy(islocal,...) " call Dfunc("s:NetrwMarkFileCopy(islocal=".a:islocal.") target<".(exists("s:netrwmftgt")? s:netrwmftgt : '---')."> a:0=".a:0) - if !exists("b:netrw_curdir") - let b:netrw_curdir= getcwd() -" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)") - endif - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") " sanity check @@ -6456,18 +6548,18 @@ fun! s:NetrwMarkFileCopy(islocal,...) " call Dret("s:NetrwMarkFileCopy") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) if !exists("s:netrwmftgt") NetrwKeepj call netrw#ErrorMsg(s:ERROR,"your marked file target is empty! (:help netrw-mt)",67) " call Dret("s:NetrwMarkFileCopy 0") return 0 endif -" call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("")) if a:islocal && s:netrwmftgt_islocal " Copy marked files, local directory to local directory -" call Decho("copy from local to local") +" call Decho("copy from local to local",'~'.expand("")) if !executable(g:netrw_localcopycmd) && g:netrw_localcopycmd !~ '^'.expand("$COMSPEC").'\s' call netrw#ErrorMsg(s:ERROR,"g:netrw_localcopycmd<".g:netrw_localcopycmd."> not executable on your system, aborting",91) " call Dfunc("s:NetrwMarkFileMove : g:netrw_localcopycmd<".g:netrw_localcopycmd."> n/a!") @@ -6478,17 +6570,17 @@ fun! s:NetrwMarkFileCopy(islocal,...) if simplify(s:netrwmftgt) == simplify(b:netrw_curdir) if len(s:netrwmarkfilelist_{bufnr('%')}) == 1 " only one marked file -" call Decho("case: only one marked file") - let args = shellescape(b:netrw_curdir."/".s:netrwmarkfilelist_{bufnr('%')}[0]) +" call Decho("case: only one marked file",'~'.expand("")) + let args = s:ShellEscape(b:netrw_curdir."/".s:netrwmarkfilelist_{bufnr('%')}[0]) let oldname = s:netrwmarkfilelist_{bufnr('%')}[0] elseif a:0 == 1 -" call Decho("case: handling one input argument") +" call Decho("case: handling one input argument",'~'.expand("")) " this happens when the next case was used to recursively call s:NetrwMarkFileCopy() - let args = shellescape(b:netrw_curdir."/".a:1) + let args = s:ShellEscape(b:netrw_curdir."/".a:1) let oldname = a:1 else " copy multiple marked files inside the same directory -" call Decho("case: handling a multiple marked files") +" call Decho("case: handling a multiple marked files",'~'.expand("")) let s:recursive= 1 for oldname in s:netrwmarkfilelist_{bufnr("%")} let ret= s:NetrwMarkFileCopy(a:islocal,oldname) @@ -6509,11 +6601,11 @@ fun! s:NetrwMarkFileCopy(islocal,...) " call Dret("s:NetrwMarkFileCopy 0") return 0 endif - let args= shellescape(oldname) - let tgt = shellescape(s:netrwmftgt.'/'.newname) - else - let args= join(map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),"shellescape(b:netrw_curdir.\"/\".v:val)")) - let tgt = shellescape(s:netrwmftgt) + let args= s:ShellEscape(oldname) + let tgt = s:ShellEscape(s:netrwmftgt.'/'.newname) + else + let args= join(map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),"s:ShellEscape(b:netrw_curdir.\"/\".v:val)")) + let tgt = s:ShellEscape(s:netrwmftgt) endif if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) let args= substitute(args,'/','\\','g') @@ -6521,16 +6613,17 @@ fun! s:NetrwMarkFileCopy(islocal,...) endif if args =~ "'"|let args= substitute(args,"'\\(.*\\)'",'\1','')|endif if tgt =~ "'"|let tgt = substitute(tgt,"'\\(.*\\)'",'\1','') |endif - if isdirectory(args) -" call Decho("args<".args."> is a directory") + if args =~ '//$'|let args= substitute(args,'//$','/','')|endif + if isdirectory(s:NetrwFile(args)) +" call Decho("args<".args."> is a directory",'~'.expand("")) let copycmd= g:netrw_localcopydircmd -" call Decho("using copydircmd<".copycmd.">") +" call Decho("using copydircmd<".copycmd.">",'~'.expand("")) if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) " window's xcopy doesn't copy a directory to a target properly. Instead, it copies a directory's " contents to a target. One must append the source directory name to the target to get xcopy to " do the right thing. let tgt= tgt.'\'.substitute(a:1,'^.*[\\/]','','') -" call Decho("modified tgt for xcopy") +" call Decho("modified tgt for xcopy",'~'.expand("")) endif else let copycmd= g:netrw_localcopycmd @@ -6542,30 +6635,34 @@ fun! s:NetrwMarkFileCopy(islocal,...) else let copycmd = netrw#WinPath(copycmd) endif -" call Decho("args <".args.">") -" call Decho("tgt <".tgt.">") -" call Decho("copycmd<".copycmd.">") -" call Decho("system(".copycmd." '".args."' '".tgt."')") +" call Decho("args <".args.">",'~'.expand("")) +" call Decho("tgt <".tgt.">",'~'.expand("")) +" call Decho("copycmd<".copycmd.">",'~'.expand("")) +" call Decho("system(".copycmd." '".args."' '".tgt."')",'~'.expand("")) call system(copycmd." '".args."' '".tgt."'") if v:shell_error != 0 - call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localcopycmd<".g:netrw_localcopycmd.">; it doesn't work!",80) -" call Dret("s:NetrwMarkFileCopy 0 : failed: system(".g:netrw_localcopycmd." ".args." ".shellescape(s:netrwmftgt)) + if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir + call netrw#ErrorMsg(s:ERROR,"copy failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-c)",101) + else + call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localcopycmd<".g:netrw_localcopycmd.">; it doesn't work!",80) + endif +" call Dret("s:NetrwMarkFileCopy 0 : failed: system(".g:netrw_localcopycmd." ".args." ".s:ShellEscape(s:netrwmftgt)) return 0 endif elseif a:islocal && !s:netrwmftgt_islocal " Copy marked files, local directory to remote directory -" call Decho("copy from local to remote") +" call Decho("copy from local to remote",'~'.expand("")) NetrwKeepj call s:NetrwUpload(s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt) elseif !a:islocal && s:netrwmftgt_islocal " Copy marked files, remote directory to local directory -" call Decho("copy from remote to local") +" call Decho("copy from remote to local",'~'.expand("")) NetrwKeepj call netrw#Obtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},s:netrwmftgt) elseif !a:islocal && !s:netrwmftgt_islocal " Copy marked files, remote directory to remote directory -" call Decho("copy from remote to remote") +" call Decho("copy from remote to remote",'~'.expand("")) let curdir = getcwd() let tmpdir = s:GetTempfile("") if tmpdir !~ '/' @@ -6574,14 +6671,14 @@ fun! s:NetrwMarkFileCopy(islocal,...) if exists("*mkdir") call mkdir(tmpdir) else - call s:NetrwExe("sil! !".g:netrw_localmkdir.' '.shellescape(tmpdir,1)) + call s:NetrwExe("sil! !".g:netrw_localmkdir.' '.s:ShellEscape(tmpdir,1)) if v:shell_error != 0 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80) -" call Dret("s:NetrwMarkFileCopy : failed: sil! !".g:netrw_localmkdir.' '.shellescape(tmpdir,1) ) +" call Dret("s:NetrwMarkFileCopy : failed: sil! !".g:netrw_localmkdir.' '.s:ShellEscape(tmpdir,1) ) return endif endif - if isdirectory(tmpdir) + if isdirectory(s:NetrwFile(tmpdir)) call s:NetrwLcd(tmpdir) NetrwKeepj call netrw#Obtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},tmpdir) let localfiles= map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),'substitute(v:val,"^.*/","","")') @@ -6591,10 +6688,10 @@ fun! s:NetrwMarkFileCopy(islocal,...) NetrwKeepj call s:NetrwDelete(fname) endfor call s:NetrwLcd(curdir) - call s:NetrwExe("sil !".g:netrw_localrmdir." ".shellescape(tmpdir,1)) + call s:NetrwExe("sil !".g:netrw_localrmdir." ".s:ShellEscape(tmpdir,1)) if v:shell_error != 0 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localrmdir<".g:netrw_localrmdir."> to something that works",80) -" call Dret("s:NetrwMarkFileCopy : failed: sil !".g:netrw_localrmdir." ".shellescape(tmpdir,1) ) +" call Dret("s:NetrwMarkFileCopy : failed: sil !".g:netrw_localrmdir." ".s:ShellEscape(tmpdir,1) ) return endif else @@ -6606,7 +6703,7 @@ fun! s:NetrwMarkFileCopy(islocal,...) " ------- " cleanup " ------- -" call Decho("cleanup") +" call Decho("cleanup",'~'.expand("")) if !exists("s:recursive") " remove markings from local buffer call s:NetrwUnmarkList(curbufnr,curdir) @@ -6622,7 +6719,7 @@ fun! s:NetrwMarkFileCopy(islocal,...) if g:netrw_fastbrowse <= 1 NetrwKeepj call s:LocalBrowseRefresh() endif - + " call Dret("s:NetrwMarkFileCopy 1") return 1 endfun @@ -6642,21 +6739,21 @@ fun! s:NetrwMarkFileDiff(islocal) " call Dret("s:NetrwMarkFileDiff") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + let curdir= s:NetrwGetCurdir(a:islocal) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) if exists("s:netrwmarkfilelist_{".curbufnr."}") let cnt = 0 - let curdir = b:netrw_curdir for fname in s:netrwmarkfilelist let cnt= cnt + 1 if cnt == 1 -" call Decho("diffthis: fname<".fname.">") +" call Decho("diffthis: fname<".fname.">",'~'.expand("")) exe "NetrwKeepj e ".fnameescape(fname) diffthis elseif cnt == 2 || cnt == 3 vsplit wincmd l -" call Decho("diffthis: ".fname) +" call Decho("diffthis: ".fname,'~'.expand("")) exe "NetrwKeepj e ".fnameescape(fname) diffthis else @@ -6675,7 +6772,7 @@ endfun fun! s:NetrwMarkFileEdit(islocal) " call Dfunc("s:NetrwMarkFileEdit(islocal=".a:islocal.")") - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") " sanity check @@ -6684,7 +6781,7 @@ fun! s:NetrwMarkFileEdit(islocal) " call Dret("s:NetrwMarkFileEdit") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) if exists("s:netrwmarkfilelist_{curbufnr}") call s:SetRexDir(a:islocal,curdir) @@ -6692,11 +6789,11 @@ fun! s:NetrwMarkFileEdit(islocal) " unmark markedfile list " call s:NetrwUnmarkList(curbufnr,curdir) call s:NetrwUnmarkAll() -" call Decho("exe sil args ".flist) +" call Decho("exe sil args ".flist,'~'.expand("")) exe "sil args ".flist endif echo "(use :bn, :bp to navigate files; :Rex to return)" - + " call Dret("s:NetrwMarkFileEdit") endfun @@ -6710,17 +6807,17 @@ fun! s:NetrwMarkFileQFEL(islocal,qfel) if !empty(a:qfel) for entry in a:qfel let bufnmbr= entry["bufnr"] -" call Decho("bufname(".bufnmbr.")<".bufname(bufnmbr)."> line#".entry["lnum"]." text=".entry["text"]) +" call Decho("bufname(".bufnmbr.")<".bufname(bufnmbr)."> line#".entry["lnum"]." text=".entry["text"],'~'.expand("")) if !exists("s:netrwmarkfilelist_{curbufnr}") -" call Decho("case: no marked file list") +" call Decho("case: no marked file list",'~'.expand("")) call s:NetrwMarkFile(a:islocal,bufname(bufnmbr)) elseif index(s:netrwmarkfilelist_{curbufnr},bufname(bufnmbr)) == -1 " s:NetrwMarkFile will remove duplicate entries from the marked file list. " So, this test lets two or more hits on the same pattern to be ignored. -" call Decho("case: ".bufname(bufnmbr)." not currently in marked file list") +" call Decho("case: ".bufname(bufnmbr)." not currently in marked file list",'~'.expand("")) call s:NetrwMarkFile(a:islocal,bufname(bufnmbr)) else -" call Decho("case: ".bufname(bufnmbr)." already in marked file list") +" call Decho("case: ".bufname(bufnmbr)." already in marked file list",'~'.expand("")) endif endfor echo "(use me to edit marked files)" @@ -6738,7 +6835,7 @@ endfun fun! s:NetrwMarkFileExe(islocal,enbloc) " call Dfunc("s:NetrwMarkFileExe(islocal=".a:islocal.",enbloc=".a:enbloc.")") let svpos = netrw#SavePosn() - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") if a:enbloc == 0 @@ -6749,14 +6846,14 @@ fun! s:NetrwMarkFileExe(islocal,enbloc) " call Dret("s:NetrwMarkFileExe") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) if exists("s:netrwmarkfilelist_{curbufnr}") " get the command call inputsave() let cmd= input("Enter command: ","","file") call inputrestore() -" call Decho("cmd<".cmd.">") +" call Decho("cmd<".cmd.">",'~'.expand("")) if cmd == "" " call Dret("s:NetrwMarkFileExe : early exit, empty command") return @@ -6767,10 +6864,10 @@ fun! s:NetrwMarkFileExe(islocal,enbloc) for fname in s:netrwmarkfilelist_{curbufnr} if a:islocal if g:netrw_keepdir - let fname= shellescape(netrw#WinPath(s:ComposePath(curdir,fname))) + let fname= s:ShellEscape(netrw#WinPath(s:ComposePath(curdir,fname))) endif else - let fname= shellescape(netrw#WinPath(b:netrw_curdir.fname)) + let fname= s:ShellEscape(netrw#WinPath(b:netrw_curdir.fname)) endif if cmd =~ '%' let xcmd= substitute(cmd,'%',fname,'g') @@ -6778,10 +6875,10 @@ fun! s:NetrwMarkFileExe(islocal,enbloc) let xcmd= cmd.' '.fname endif if a:islocal -" call Decho("local: xcmd<".xcmd.">") +" call Decho("local: xcmd<".xcmd.">",'~'.expand("")) let ret= system(xcmd) else -" call Decho("remote: xcmd<".xcmd.">") +" call Decho("remote: xcmd<".xcmd.">",'~'.expand("")) let ret= s:RemoteSystem(xcmd) endif if v:shell_error < 0 @@ -6807,15 +6904,15 @@ fun! s:NetrwMarkFileExe(islocal,enbloc) call inputsave() let cmd= input("Enter command: ","","file") call inputrestore() -" call Decho("cmd<".cmd.">") +" call Decho("cmd<".cmd.">",'~'.expand("")) if cmd == "" " call Dret("s:NetrwMarkFileExe : early exit, empty command") return endif if cmd =~ '%' - let cmd= substitute(cmd,'%',join(map(s:netrwmarkfilelist,'shellescape(v:val)'),' '),'g') - else - let cmd= cmd.' '.join(map(s:netrwmarkfilelist,'shellescape(v:val)'),' ') + let cmd= substitute(cmd,'%',join(map(s:netrwmarkfilelist,'s:ShellEscape(v:val)'),' '),'g') + else + let cmd= cmd.' '.join(map(s:netrwmarkfilelist,'s:ShellEscape(v:val)'),' ') endif if a:islocal call system(cmd) @@ -6832,7 +6929,7 @@ fun! s:NetrwMarkFileExe(islocal,enbloc) NetrwKeepj call netrw#RestorePosn(svpos) endif - + " call Dret("s:NetrwMarkFileExe") endfun @@ -6849,7 +6946,7 @@ fun! s:NetrwMarkHideSfx(islocal) if exists("s:netrwmarkfilelist_{curbufnr}") for fname in s:netrwmarkfilelist_{curbufnr} -" call Decho("s:NetrwMarkFileCopy: fname<".fname.">") +" call Decho("s:NetrwMarkFileCopy: fname<".fname.">",'~'.expand("")) " construct suffix pattern if fname =~ '\.' let sfxpat= "^.*".substitute(fname,'^.*\(\.[^. ]\+\)$','\1','') @@ -6869,7 +6966,7 @@ fun! s:NetrwMarkHideSfx(islocal) let itemnum= itemnum + 1 endfor endif -" call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">") +" call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">",'~'.expand("")) if inhidelist " remove sfxpat from list call remove(hidelist,itemnum) @@ -6899,7 +6996,7 @@ endfun fun! s:NetrwMarkFileVimCmd(islocal) " call Dfunc("s:NetrwMarkFileVimCmd(islocal=".a:islocal.")") let svpos = netrw#SavePosn() - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") " sanity check @@ -6908,14 +7005,14 @@ fun! s:NetrwMarkFileVimCmd(islocal) " call Dret("s:NetrwMarkFileVimCmd") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) if exists("s:netrwmarkfilelist_{curbufnr}") " get the command call inputsave() let cmd= input("Enter vim command: ","","file") call inputrestore() -" call Decho("cmd<".cmd.">") +" call Decho("cmd<".cmd.">",'~'.expand("")) if cmd == "" " " call Dret("s:NetrwMarkFileVimCmd : early exit, empty command") return @@ -6924,15 +7021,15 @@ fun! s:NetrwMarkFileVimCmd(islocal) " apply command to marked files. Substitute: filename -> % " If no %, then append a space and the filename to the command for fname in s:netrwmarkfilelist_{curbufnr} -" call Decho("fname<".fname.">") +" call Decho("fname<".fname.">",'~'.expand("")) if a:islocal 1split exe "sil! NetrwKeepj keepalt e ".fnameescape(fname) -" call Decho("local<".fname.">: exe ".cmd) +" call Decho("local<".fname.">: exe ".cmd,'~'.expand("")) exe cmd exe "sil! keepalt wq!" else -" call Decho("remote<".fname.">: exe ".cmd." : NOT SUPPORTED YET") +" call Decho("remote<".fname.">: exe ".cmd." : NOT SUPPORTED YET",'~'.expand("")) echo "sorry, \"mv\" not supported yet for remote files" endif endfor @@ -6946,7 +7043,7 @@ fun! s:NetrwMarkFileVimCmd(islocal) else NetrwKeepj call netrw#ErrorMsg(s:ERROR,"no files marked!",59) endif - + " call Dret("s:NetrwMarkFileVimCmd") endfun @@ -6963,7 +7060,7 @@ fun! s:NetrwMarkHideSfx(islocal) if exists("s:netrwmarkfilelist_{curbufnr}") for fname in s:netrwmarkfilelist_{curbufnr} -" call Decho("s:NetrwMarkFileCopy: fname<".fname.">") +" call Decho("s:NetrwMarkFileCopy: fname<".fname.">",'~'.expand("")) " construct suffix pattern if fname =~ '\.' let sfxpat= "^.*".substitute(fname,'^.*\(\.[^. ]\+\)$','\1','') @@ -6983,7 +7080,7 @@ fun! s:NetrwMarkHideSfx(islocal) let itemnum= itemnum + 1 endfor endif -" call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">") +" call Decho("fname<".fname."> inhidelist=".inhidelist." sfxpat<".sfxpat.">",'~'.expand("")) if inhidelist " remove sfxpat from list call remove(hidelist,itemnum) @@ -7014,13 +7111,14 @@ fun! s:NetrwMarkFileGrep(islocal) " call Dfunc("s:NetrwMarkFileGrep(islocal=".a:islocal.")") let svpos = netrw#SavePosn() let curbufnr = bufnr("%") + let curdir = s:NetrwGetCurdir(a:islocal) if exists("s:netrwmarkfilelist") -" call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">") +" call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">",'~'.expand("")) let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)")) call s:NetrwUnmarkAll() else -" call Decho('no marked files, using "*"') +" call Decho('no marked files, using "*"','~'.expand("")) let netrwmarkfilelist= "*" endif @@ -7031,7 +7129,7 @@ fun! s:NetrwMarkFileGrep(islocal) let patbang = "" if pat =~ '^!' let patbang = "!" - let pat= strpart(pat,2) + let pat = strpart(pat,2) endif if pat =~ '^\i' let pat = escape(pat,'/') @@ -7041,7 +7139,7 @@ fun! s:NetrwMarkFileGrep(islocal) endif " use vimgrep for both local and remote -" call Decho("exe vimgrep".patbang." ".pat." ".netrwmarkfilelist) +" call Decho("exe vimgrep".patbang." ".pat." ".netrwmarkfilelist,'~'.expand("")) try exe "NetrwKeepj noautocmd vimgrep".patbang." ".pat." ".netrwmarkfilelist catch /^Vim\%((\a\+)\)\=:E480/ @@ -7056,7 +7154,7 @@ fun! s:NetrwMarkFileGrep(islocal) if exists("nonisi") " original, user-supplied pattern did not begin with a character from isident -" call Decho("looking for trailing nonisi<".nonisi."> followed by a j, gj, or jg") +" call Decho("looking for trailing nonisi<".nonisi."> followed by a j, gj, or jg",'~'.expand("")) if pat =~ nonisi.'j$\|'.nonisi.'gj$\|'.nonisi.'jg$' call s:NetrwMarkFileQFEL(a:islocal,getqflist()) endif @@ -7072,7 +7170,7 @@ endfun " = 1: target directory is local fun! s:NetrwMarkFileMove(islocal) " call Dfunc("s:NetrwMarkFileMove(islocal=".a:islocal.")") - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") " sanity check @@ -7081,61 +7179,65 @@ fun! s:NetrwMarkFileMove(islocal) " call Dret("s:NetrwMarkFileMove") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) if !exists("s:netrwmftgt") NetrwKeepj call netrw#ErrorMsg(2,"your marked file target is empty! (:help netrw-mt)",67) " call Dret("s:NetrwMarkFileCopy 0") return 0 endif -" call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("sanity chk passed: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("")) if a:islocal && s:netrwmftgt_islocal " move: local -> local -" call Decho("move from local to local") -" call Decho("local to local move") +" call Decho("move from local to local",'~'.expand("")) +" call Decho("local to local move",'~'.expand("")) if !executable(g:netrw_localmovecmd) && g:netrw_localmovecmd !~ '^'.expand("$COMSPEC").'\s' call netrw#ErrorMsg(s:ERROR,"g:netrw_localmovecmd<".g:netrw_localmovecmd."> not executable on your system, aborting",90) " call Dfunc("s:NetrwMarkFileMove : g:netrw_localmovecmd<".g:netrw_localmovecmd."> n/a!") return endif - let tgt = shellescape(s:netrwmftgt) -" call Decho("tgt<".tgt.">") + let tgt = s:ShellEscape(s:netrwmftgt) +" call Decho("tgt<".tgt.">",'~'.expand("")) if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) let tgt = substitute(tgt, '/','\\','g') -" call Decho("windows exception: tgt<".tgt.">") +" call Decho("windows exception: tgt<".tgt.">",'~'.expand("")) if g:netrw_localmovecmd =~ '\s' let movecmd = substitute(g:netrw_localmovecmd,'\s.*$','','') let movecmdargs = substitute(g:netrw_localmovecmd,'^.\{-}\(\s.*\)$','\1','') let movecmd = netrw#WinPath(movecmd).movecmdargs -" call Decho("windows exception: movecmd<".movecmd."> (#1: had a space)") +" call Decho("windows exception: movecmd<".movecmd."> (#1: had a space)",'~'.expand("")) else let movecmd = netrw#WinPath(movecmd) -" call Decho("windows exception: movecmd<".movecmd."> (#2: no space)") +" call Decho("windows exception: movecmd<".movecmd."> (#2: no space)",'~'.expand("")) endif else let movecmd = netrw#WinPath(g:netrw_localmovecmd) -" call Decho("movecmd<".movecmd."> (#3 linux or cygwin)") +" call Decho("movecmd<".movecmd."> (#3 linux or cygwin)",'~'.expand("")) endif for fname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("system(".movecmd." ".shellescape(fname)." ".tgt.")") if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) let fname= substitute(fname,'/','\\','g') endif - let ret= system(g:netrw_localmovecmd." ".shellescape(fname)." ".tgt) +" call Decho("system(".movecmd." ".s:ShellEscape(fname)." ".tgt.")",'~'.expand("")) + let ret= system(movecmd." ".s:ShellEscape(fname)." ".tgt) if v:shell_error != 0 - call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localmovecmd<".g:netrw_localmovecmd.">; it doesn't work!",54) + if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir + call netrw#ErrorMsg(s:ERROR,"move failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-c)",100) + else + call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localmovecmd<".g:netrw_localmovecmd.">; it doesn't work!",54) + endif break endif endfor elseif a:islocal && !s:netrwmftgt_islocal " move: local -> remote -" call Decho("move from local to remote") -" call Decho("copy") +" call Decho("move from local to remote",'~'.expand("")) +" call Decho("copy",'~'.expand("")) let mflist= s:netrwmarkfilelist_{bufnr("%")} NetrwKeepj call s:NetrwMarkFileCopy(a:islocal) -" call Decho("remove") +" call Decho("remove",'~'.expand("")) for fname in mflist let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') let ok = s:NetrwLocalRmFile(b:netrw_curdir,barefname,1) @@ -7144,11 +7246,11 @@ fun! s:NetrwMarkFileMove(islocal) elseif !a:islocal && s:netrwmftgt_islocal " move: remote -> local -" call Decho("move from remote to local") -" call Decho("copy") +" call Decho("move from remote to local",'~'.expand("")) +" call Decho("copy",'~'.expand("")) let mflist= s:netrwmarkfilelist_{bufnr("%")} NetrwKeepj call s:NetrwMarkFileCopy(a:islocal) -" call Decho("remove") +" call Decho("remove",'~'.expand("")) for fname in mflist let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') let ok = s:NetrwRemoteRmFile(b:netrw_curdir,barefname,1) @@ -7157,11 +7259,11 @@ fun! s:NetrwMarkFileMove(islocal) elseif !a:islocal && !s:netrwmftgt_islocal " move: remote -> remote -" call Decho("move from remote to remote") -" call Decho("copy") +" call Decho("move from remote to remote",'~'.expand("")) +" call Decho("copy",'~'.expand("")) let mflist= s:netrwmarkfilelist_{bufnr("%")} NetrwKeepj call s:NetrwMarkFileCopy(a:islocal) -" call Decho("remove") +" call Decho("remove",'~'.expand("")) for fname in mflist let barefname = substitute(fname,'^\(.*/\)\(.\{-}\)$','\2','') let ok = s:NetrwRemoteRmFile(b:netrw_curdir,barefname,1) @@ -7172,25 +7274,25 @@ fun! s:NetrwMarkFileMove(islocal) " ------- " cleanup " ------- -" call Decho("cleanup") +" call Decho("cleanup",'~'.expand("")) " remove markings from local buffer call s:NetrwUnmarkList(curbufnr,curdir) " remove markings from local buffer " refresh buffers if !s:netrwmftgt_islocal -" call Decho("refresh netrwmftgt<".s:netrwmftgt.">") +" call Decho("refresh netrwmftgt<".s:netrwmftgt.">",'~'.expand("")) NetrwKeepj call s:NetrwRefreshDir(s:netrwmftgt_islocal,s:netrwmftgt) endif if a:islocal -" call Decho("refresh b:netrw_curdir<".b:netrw_curdir.">") +" call Decho("refresh b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("")) NetrwKeepj call s:NetrwRefreshDir(a:islocal,b:netrw_curdir) endif if g:netrw_fastbrowse <= 1 -" call Decho("since g:netrw_fastbrowse=".g:netrw_fastbrowse.", perform shell cmd refresh") +" call Decho("since g:netrw_fastbrowse=".g:netrw_fastbrowse.", perform shell cmd refresh",'~'.expand("")) NetrwKeepj call s:LocalBrowseRefresh() endif - + " call Dret("s:NetrwMarkFileMove") endfun @@ -7207,10 +7309,11 @@ fun! s:NetrwMarkFilePrint(islocal) " call Dret("s:NetrwMarkFilePrint") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) + let curdir= s:NetrwGetCurdir(a:islocal) + if exists("s:netrwmarkfilelist_{curbufnr}") let netrwmarkfilelist = s:netrwmarkfilelist_{curbufnr} - let curdir = b:netrw_curdir call s:NetrwUnmarkList(curbufnr,curdir) for fname in netrwmarkfilelist if a:islocal @@ -7222,9 +7325,9 @@ fun! s:NetrwMarkFilePrint(islocal) endif 1split " the autocmds will handle both local and remote files -" call Decho("exe sil e ".escape(fname,' ')) +" call Decho("exe sil e ".escape(fname,' '),'~'.expand("")) exe "sil NetrwKeepj e ".fnameescape(fname) -" call Decho("hardcopy") +" call Decho("hardcopy",'~'.expand("")) hardcopy q endfor @@ -7246,28 +7349,33 @@ fun! s:NetrwMarkFileRegexp(islocal) call inputrestore() if a:islocal + let curdir= s:NetrwGetCurdir(a:islocal) " get the matching list of files using local glob() -" call Decho("handle local regexp") +" call Decho("handle local regexp",'~'.expand("")) let dirname = escape(b:netrw_curdir,g:netrw_glob_escape) - let files = glob(s:ComposePath(dirname,regexp)) -" call Decho("files<".files.">") + if v:version == 704 && has("patch656") + let files = glob(s:ComposePath(dirname,regexp),0,0,1) + else + let files = glob(s:ComposePath(dirname,regexp),0,0) + endif +" call Decho("files<".files.">",'~'.expand("")) let filelist= split(files,"\n") " mark the list of files for fname in filelist -" call Decho("fname<".fname.">") +" call Decho("fname<".fname.">",'~'.expand("")) NetrwKeepj call s:NetrwMarkFile(a:islocal,substitute(fname,'^.*/','','')) endfor else -" call Decho("handle remote regexp") +" call Decho("handle remote regexp",'~'.expand("")) " convert displayed listing into a filelist let eikeep = &ei let areg = @a sil NetrwKeepj %y a setl ei=all ma -" call Decho("setl ei=all ma") +" call Decho("setl ei=all ma",'~'.expand("")) 1split NetrwKeepj call s:NetrwEnew() NetrwKeepj call s:NetrwSafeOptions() @@ -7290,7 +7398,7 @@ fun! s:NetrwMarkFileRegexp(islocal) endif " convert regexp into the more usual glob-style format let regexp= substitute(regexp,'\*','.*','g') -" call Decho("regexp<".regexp.">") +" call Decho("regexp<".regexp.">",'~'.expand("")) exe "sil! NetrwKeepj v/".escape(regexp,'/')."/d" call histdel("/",-1) let filelist= getline(1,line("$")) @@ -7320,10 +7428,11 @@ fun! s:NetrwMarkFileSource(islocal) " call Dret("s:NetrwMarkFileSource") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) + let curdir= s:NetrwGetCurdir(a:islocal) + if exists("s:netrwmarkfilelist_{curbufnr}") let netrwmarkfilelist = s:netrwmarkfilelist_{bufnr("%")} - let curdir = b:netrw_curdir call s:NetrwUnmarkList(curbufnr,curdir) for fname in netrwmarkfilelist if a:islocal @@ -7334,7 +7443,7 @@ fun! s:NetrwMarkFileSource(islocal) let fname= curdir.fname endif " the autocmds will handle sourcing both local and remote files -" call Decho("exe so ".fnameescape(fname)) +" call Decho("exe so ".fnameescape(fname),'~'.expand("")) exe "so ".fnameescape(fname) endfor 2match none @@ -7348,7 +7457,7 @@ endfun fun! s:NetrwMarkFileTag(islocal) " call Dfunc("s:NetrwMarkFileTag(islocal=".a:islocal.")") let svpos = netrw#SavePosn() - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let curbufnr = bufnr("%") " sanity check @@ -7357,16 +7466,16 @@ fun! s:NetrwMarkFileTag(islocal) " call Dret("s:NetrwMarkFileTag") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr}),'~'.expand("")) if exists("s:netrwmarkfilelist") -" call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">") - let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "shellescape(v:val,".!a:islocal.")")) +" call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">",'~'.expand("")) + let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "s:ShellEscape(v:val,".!a:islocal.")")) call s:NetrwUnmarkAll() if a:islocal if executable(g:netrw_ctags) -" call Decho("call system(".g:netrw_ctags." ".netrwmarkfilelist.")") +" call Decho("call system(".g:netrw_ctags." ".netrwmarkfilelist.")",'~'.expand("")) call system(g:netrw_ctags." ".netrwmarkfilelist) else call netrw#ErrorMsg(s:ERROR,"g:netrw_ctags<".g:netrw_ctags."> is not executable!",51) @@ -7378,7 +7487,7 @@ fun! s:NetrwMarkFileTag(islocal) 1split NetrwKeepj e tags let path= substitute(curdir,'^\(.*\)/[^/]*$','\1/','') -" call Decho("curdir<".curdir."> path<".path.">") +" call Decho("curdir<".curdir."> path<".path.">",'~'.expand("")) exe 'NetrwKeepj %s/\t\(\S\+\)\t/\t'.escape(path,"/\n\r\\").'\1\t/e' call histdel("/",-1) wq! @@ -7393,14 +7502,14 @@ endfun " --------------------------------------------------------------------- " s:NetrwMarkFileTgt: (invoked by mt) This function sets up a marked file target {{{2 -" Sets up two variables, +" Sets up two variables, " s:netrwmftgt : holds the target directory " s:netrwmftgt_islocal : 0=target directory is remote " 1=target directory is local fun! s:NetrwMarkFileTgt(islocal) " call Dfunc("s:NetrwMarkFileTgt(islocal=".a:islocal.")") let svpos = netrw#SavePosn() - let curdir = b:netrw_curdir + let curdir = s:NetrwGetCurdir(a:islocal) let hadtgt = exists("s:netrwmftgt") if !exists("w:netrw_bannercnt") let w:netrw_bannercnt= b:netrw_bannercnt @@ -7408,9 +7517,10 @@ fun! s:NetrwMarkFileTgt(islocal) " set up target if line(".") < w:netrw_bannercnt +" call Decho("set up target: line(.) < w:netrw_bannercnt=".w:netrw_bannercnt,'~'.expand("")) " if cursor in banner region, use b:netrw_curdir for the target unless its already the target if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal") && s:netrwmftgt == b:netrw_curdir -" call Decho("cursor in banner region, and target already is <".b:netrw_curdir.">: removing target") +" call Decho("cursor in banner region, and target already is <".b:netrw_curdir.">: removing target",'~'.expand("")) unlet s:netrwmftgt s:netrwmftgt_islocal if g:netrw_fastbrowse <= 1 call s:LocalBrowseRefresh() @@ -7421,50 +7531,87 @@ fun! s:NetrwMarkFileTgt(islocal) return else let s:netrwmftgt= b:netrw_curdir -" call Decho("inbanner: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("inbanner: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("")) endif else " get word under cursor. " * If directory, use it for the target. " * If file, use b:netrw_curdir for the target +" call Decho("get word under cursor",'~'.expand("")) let curword= s:NetrwGetWord() let tgtdir = s:ComposePath(curdir,curword) - if a:islocal && isdirectory(tgtdir) + if a:islocal && isdirectory(s:NetrwFile(tgtdir)) let s:netrwmftgt = tgtdir -" call Decho("local isdir: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("local isdir: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("")) elseif !a:islocal && tgtdir =~ '/$' let s:netrwmftgt = tgtdir -" call Decho("remote isdir: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("remote isdir: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("")) else let s:netrwmftgt = curdir -" call Decho("isfile: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("isfile: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("")) endif endif if a:islocal " simplify the target (eg. /abc/def/../ghi -> /abc/ghi) let s:netrwmftgt= simplify(s:netrwmftgt) -" call Decho("simplify: s:netrwmftgt<".s:netrwmftgt.">") +" call Decho("simplify: s:netrwmftgt<".s:netrwmftgt.">",'~'.expand("")) endif if g:netrw_cygwin - let s:netrwmftgt= substitute(system("cygpath ".shellescape(s:netrwmftgt)),'\n$','','') + let s:netrwmftgt= substitute(system("cygpath ".s:ShellEscape(s:netrwmftgt)),'\n$','','') let s:netrwmftgt= substitute(s:netrwmftgt,'\n$','','') endif let s:netrwmftgt_islocal= a:islocal + " need to do refresh so that the banner will be updated + " s:LocalBrowseRefresh handles all local-browsing buffers when not fast browsing if g:netrw_fastbrowse <= 1 +" call Decho("g:netrw_fastbrowse=".g:netrw_fastbrowse.", so refreshing all local netrw buffers") call s:LocalBrowseRefresh() endif - call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) +" call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + if w:netrw_liststyle == s:TREELIST + call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,w:netrw_treetop)) + else + call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + endif call netrw#RestorePosn(svpos) if !hadtgt sil! NetrwKeepj norm! j endif +" call Decho("getmatches=".string(getmatches()),'~'.expand("")) +" call Decho("s:netrwmarkfilelist=".(exists("s:netrwmarkfilelist")? string(s:netrwmarkfilelist) : 'n/a'),'~'.expand("")) " call Dret("s:NetrwMarkFileTgt : netrwmftgt<".(exists("s:netrwmftgt")? s:netrwmftgt : "").">") endfun " --------------------------------------------------------------------- +" s:NetrwGetCurdir: gets current directory and sets up b:netrw_curdir if necessary {{{2 +fun! s:NetrwGetCurdir(islocal) +" call Dfunc("s:NetrwGetCurdir(islocal=".a:islocal.")") + + if w:netrw_liststyle == s:TREELIST + let b:netrw_curdir = s:NetrwTreePath(w:netrw_treetop) +" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used s:NetrwTreeDir)",'~'.expand("")) + elseif !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() +" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)",'~'.expand("")) + endif + +" call Decho("b:netrw_curdir<".b:netrw_curdir."> ".((b:netrw_curdir !~ '\<\a\{3,}://')? "does not match" : "matches")." url pattern") + if b:netrw_curdir !~ '\<\a\{3,}://' + let curdir= b:netrw_curdir +" call Decho("g:netrw_keepdir=".g:netrw_keepdir) + if g:netrw_keepdir == 0 + call s:NetrwLcd(curdir) + endif + endif + +" call Dret("s:NetrwGetCurdir <".curdir.">") + return b:netrw_curdir +endfun + +" --------------------------------------------------------------------- " s:NetrwOpenFile: query user for a filename and open it {{{2 fun! s:NetrwOpenFile(islocal) " call Dfunc("s:NetrwOpenFile(islocal=".a:islocal.")") @@ -7477,7 +7624,10 @@ fun! s:NetrwOpenFile(islocal) if exists("g:netrw_quiet") let netrw_quiet_keep = g:netrw_quiet endif - let g:netrw_quiet = 1 + let g:netrw_quiet = 1 + " save position for benefit of Rexplore + let s:rexposn_{bufnr("%")}= netrw#SavePosn() +" call Decho("setting s:rexposn_".bufnr("%")."<".bufname("%")."> to SavePosn",'~'.expand("")) if b:netrw_curdir =~ '/$' exe "NetrwKeepj e ".fnameescape(b:netrw_curdir.fname) else @@ -7497,14 +7647,84 @@ fun! s:NetrwOpenFile(islocal) endfun " --------------------------------------------------------------------- -" s:NetrwUnmarkList: delete local marked file lists and remove their contents from the global marked-file list {{{2 -" User access provided by the mapping. (see :help netrw-mu) +" netrw#Shrink: shrinks/expands a netrw or Lexplorer window {{{2 +" For the mapping to this function be made via +" netrwPlugin, you'll need to have had +" g:netrw_usetab set to non-zero. +fun! netrw#Shrink() +" call Dfunc("netrw#Shrink() ft<".&ft."> winwidth=".winwidth(0)." lexbuf#".((exists("t:netrw_lexbufnr"))? t:netrw_lexbufnr : 'n/a')) + let curwin = winnr() + let wiwkeep = &wiw + set wiw=1 + + if &ft == "netrw" + if winwidth(0) > g:netrw_wiw + let t:netrw_winwidth= winwidth(0) + exe "vert resize ".g:netrw_wiw + wincmd l + if winnr() == curwin + wincmd h + endif +" call Decho("vert resize 0",'~'.expand("")) + else + exe "vert resize ".t:netrw_winwidth +" call Decho("vert resize ".t:netrw_winwidth,'~'.expand("")) + endif + + elseif exists("t:netrw_lexbufnr") + exe bufwinnr(t:netrw_lexbufnr)."wincmd w" + if winwidth(bufwinnr(t:netrw_lexbufnr)) > g:netrw_wiw + let t:netrw_winwidth= winwidth(0) + exe "vert resize ".g:netrw_wiw + wincmd l + if winnr() == curwin + wincmd h + endif +" call Decho("vert resize 0",'~'.expand("")) + elseif winwidth(bufwinnr(t:netrw_lexbufnr)) >= 0 + exe "vert resize ".t:netrw_winwidth +" call Decho("vert resize ".t:netrw_winwidth,'~'.expand("")) + else + call netrw#Lexplore(0,0) + endif + + else + call netrw#Lexplore(0,0) + endif + let wiw= wiwkeep + +" call Dret("netrw#Shrink") +endfun + +" --------------------------------------------------------------------- +" s:NetSortSequence: allows user to edit the sorting sequence {{{2 +fun! s:NetSortSequence(islocal) +" call Dfunc("NetSortSequence(islocal=".a:islocal.")") + + let ykeep= @@ + let svpos= netrw#SavePosn() + call inputsave() + let newsortseq= input("Edit Sorting Sequence: ",g:netrw_sort_sequence) + call inputrestore() + + " refresh the listing + let g:netrw_sort_sequence= newsortseq + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call netrw#RestorePosn(svpos) + let @@= ykeep + +" call Dret("NetSortSequence") +endfun + +" --------------------------------------------------------------------- +" s:NetrwUnmarkList: delete local marked file list and remove their contents from the global marked-file list {{{2 +" User access provided by the mapping. (see :help netrw-mF) " Used by many MarkFile functions. 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 - if exists("s:netrwmarkfilelist_{a:curbufnr}") + if exists("s:netrwmarkfilelist") 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 @@ -7513,7 +7733,7 @@ fun! s:NetrwUnmarkList(curbufnr,curdir) if s:netrwmarkfilelist == [] unlet s:netrwmarkfilelist endif - + " getting rid of the local marked-file lists is easy unlet s:netrwmarkfilelist_{a:curbufnr} endif @@ -7544,7 +7764,7 @@ fun! s:NetrwUnmarkAll2() 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 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_','','') @@ -7555,21 +7775,35 @@ fun! s:NetrwUnmarkAll2() endfun " --------------------------------------------------------------------- -" s:NetrwUnMarkFile: {{{2 +" s:NetrwUnMarkFile: called via mu map; unmarks *all* marked files, both global and buffer-local {{{2 +" +" Marked files are in two types of lists: +" s:netrwmarkfilelist -- holds complete paths to all marked files +" s:netrwmarkfilelist_# -- holds list of marked files in current-buffer's directory (#==bufnr()) +" +" Marked files suitable for use with 2match are in: +" s:netrwmarkfilemtch_# -- used with 2match to display marked files fun! s:NetrwUnMarkFile(islocal) " call Dfunc("s:NetrwUnMarkFile(islocal=".a:islocal.")") let svpos = netrw#SavePosn() let curbufnr = bufnr("%") - " unmark marked file list (although I expect s:NetrwUpload() - " to do it, I'm just making sure) - if exists("s:netrwmarkfilelist_{bufnr('%')}") -" call Decho("unlet'ing: s:netrwmarkfile[list|mtch]_".bufnr("%")) + " unmark marked file list + " (although I expect s:NetrwUpload() to do it, I'm just making sure) + if exists("s:netrwmarkfilelist") +" " call Decho("unlet'ing: s:netrwmarkfilelist",'~'.expand("")) unlet s:netrwmarkfilelist - unlet s:netrwmarkfilelist_{curbufnr} - unlet s:netrwmarkfilemtch_{curbufnr} - 2match none - endif + endif + + let ibuf= 1 + while ibuf < bufnr("$") + if exists("s:netrwmarkfilelist_".ibuf) + unlet s:netrwmarkfilelist_{ibuf} + unlet s:netrwmarkfilemtch_{ibuf} + endif + let ibuf = ibuf + 1 + endwhile + 2match none " call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) call netrw#RestorePosn(svpos) @@ -7588,7 +7822,7 @@ fun! s:NetrwMenu(domenu) " call Dfunc("NetrwMenu(domenu=".a:domenu.")") if !exists("s:netrw_menu_enabled") && a:domenu -" call Decho("initialize menu") +" call Decho("initialize menu",'~'.expand("")) let s:netrw_menu_enabled= 1 exe 'sil! menu '.g:NetrwMenuPriority.'.1 '.g:NetrwTopLvlMenu.'Help ' exe 'sil! menu '.g:NetrwMenuPriority.'.5 '.g:NetrwTopLvlMenu.'-Sep1- :' @@ -7654,6 +7888,7 @@ fun! s:NetrwMenu(domenu) exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.1 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Names :let g:netrw_sort_by="name"' exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.2 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Times :let g:netrw_sort_by="time"' exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.3 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Sizes :let g:netrw_sort_by="size"' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.3 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Extens :let g:netrw_sort_by="exten"' exe 'sil! menu '.g:NetrwMenuPriority.'.17 '.g:NetrwTopLvlMenu.'Rename\ File/DirectoryR R' exe 'sil! menu '.g:NetrwMenuPriority.'.18 '.g:NetrwTopLvlMenu.'Set\ Current\ Directoryc c' let s:netrw_menucnt= 28 @@ -7667,9 +7902,9 @@ fun! s:NetrwMenu(domenu) exe curwin."wincmd w" if s:netrwcnt <= 1 -" call Decho("clear menus") +" call Decho("clear menus",'~'.expand("")) exe 'sil! unmenu '.g:NetrwTopLvlMenu -" call Decho('exe sil! unmenu '.g:NetrwTopLvlMenu.'*') +" call Decho('exe sil! unmenu '.g:NetrwTopLvlMenu.'*','~'.expand("")) sil! unlet s:netrw_menu_enabled endif endif @@ -7687,7 +7922,7 @@ fun! s:NetrwObtain(islocal) let ykeep= @@ if exists("s:netrwmarkfilelist_{bufnr('%')}") - let islocal= s:netrwmarkfilelist_{bufnr('%')}[1] !~ '^\a\+://' + let islocal= s:netrwmarkfilelist_{bufnr('%')}[1] !~ '^\a\{3,}://' call netrw#Obtain(islocal,s:netrwmarkfilelist_{bufnr('%')}) call s:NetrwUnmarkList(bufnr('%'),b:netrw_curdir) else @@ -7720,32 +7955,32 @@ fun! s:NetrwPrevWinOpen(islocal) let choice = 0 let s:treedir = s:NetrwTreeDir(a:islocal) let curdir = s:treedir -" call Decho("winnr($)#".lastwinnr." curword<".curword.">") +" call Decho("winnr($)#".lastwinnr." curword<".curword.">",'~'.expand("")) let didsplit = 0 if lastwinnr == 1 " if only one window, open a new one first -" call Decho("only one window, so open a new one (g:netrw_alto=".g:netrw_alto.")") +" call Decho("only one window, so open a new one (g:netrw_alto=".g:netrw_alto.")",'~'.expand("")) if g:netrw_preview " vertically split preview window let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize -" call Decho("exe ".(g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s") +" call Decho("exe ".(g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s",'~'.expand("")) exe (g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s" else " horizontally split preview window let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize -" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s") +" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s",'~'.expand("")) exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" endif let didsplit = 1 -" call Decho("did split") +" call Decho("did split",'~'.expand("")) else NetrwKeepj call s:SaveBufVars() let eikeep= &ei setl ei=all wincmd p -" call Decho("wincmd p (now in win#".winnr().") curdir<".curdir.">") +" call Decho("wincmd p (now in win#".winnr().") curdir<".curdir.">",'~'.expand("")) " prevwinnr: the window number of the "prev" window " prevbufnr: the buffer number of the buffer in the "prev" window @@ -7756,22 +7991,22 @@ fun! s:NetrwPrevWinOpen(islocal) let prevmod = &mod let bnrcnt = 0 NetrwKeepj call s:RestoreBufVars() -" call Decho("after wincmd p: win#".winnr()." win($)#".winnr("$")." origwin#".origwin." &mod=".&mod." bufname(%)<".bufname("%")."> prevbufnr=".prevbufnr) +" call Decho("after wincmd p: win#".winnr()." win($)#".winnr("$")." origwin#".origwin." &mod=".&mod." bufname(%)<".bufname("%")."> prevbufnr=".prevbufnr,'~'.expand("")) " if the previous window's buffer has been changed (ie. its modified flag is set), " and it doesn't appear in any other extant window, then ask the " user if s/he wants to abandon modifications therein. if prevmod -" call Decho("detected that prev window's buffer has been modified: prevbufnr=".prevbufnr." winnr()#".winnr()) +" call Decho("detected that prev window's buffer has been modified: prevbufnr=".prevbufnr." winnr()#".winnr(),'~'.expand("")) windo if winbufnr(0) == prevbufnr | let bnrcnt=bnrcnt+1 | endif -" call Decho("prevbufnr=".prevbufnr." bnrcnt=".bnrcnt." buftype=".&bt." winnr()=".winnr()." prevwinnr#".prevwinnr) +" call Decho("prevbufnr=".prevbufnr." bnrcnt=".bnrcnt." buftype=".&bt." winnr()=".winnr()." prevwinnr#".prevwinnr,'~'.expand("")) exe prevwinnr."wincmd w" if bnrcnt == 1 && &hidden == 0 " only one copy of the modified buffer in a window, and " hidden not set, so overwriting will lose the modified file. Ask first... let choice = confirm("Save modified buffer<".prevbufname."> first?","&Yes\n&No\n&Cancel") -" call Decho("(NetrwPrevWinOpen) prevbufname<".prevbufname."> choice=".choice." current-winnr#".winnr()) +" call Decho("(NetrwPrevWinOpen) prevbufname<".prevbufname."> choice=".choice." current-winnr#".winnr(),'~'.expand("")) let &ei= eikeep if choice == 1 @@ -7779,7 +8014,7 @@ fun! s:NetrwPrevWinOpen(islocal) let v:errmsg= "" sil w if v:errmsg != "" - call netrw#ErrorMsg(s:ERROR,"unable to write <".prevbufname.">!",30) + call netrw#ErrorMsg(s:ERROR,"unable to write <".(exists("prevbufname")? prevbufname : 'n/a').">!",30) exe origwin."wincmd w" let &ei = eikeep let @@ = ykeep @@ -7789,12 +8024,12 @@ fun! s:NetrwPrevWinOpen(islocal) elseif choice == 2 " No -- don't worry about changed file, just browse anyway -" call Decho("don't worry about chgd file, just browse anyway (winnr($)#".winnr("$").")") +" call Decho("don't worry about chgd file, just browse anyway (winnr($)#".winnr("$").")",'~'.expand("")) echomsg "**note** changes to ".prevbufname." abandoned" else " Cancel -- don't do this -" call Decho("cancel, don't browse, switch to win#".origwin) +" call Decho("cancel, don't browse, switch to win#".origwin,'~'.expand("")) exe origwin."wincmd w" let &ei= eikeep let @@ = ykeep @@ -7828,46 +8063,46 @@ endfun fun! s:NetrwUpload(fname,tgt,...) " call Dfunc("s:NetrwUpload(fname<".((type(a:fname) == 1)? a:fname : string(a:fname))."> tgt<".a:tgt.">) a:0=".a:0) - if a:tgt =~ '^\a\+://' - let tgtdir= substitute(a:tgt,'^\a\+://[^/]\+/\(.\{-}\)$','\1','') + if a:tgt =~ '^\a\{3,}://' + let tgtdir= substitute(a:tgt,'^\a\{3,}://[^/]\+/\(.\{-}\)$','\1','') else let tgtdir= substitute(a:tgt,'^\(.*\)/[^/]*$','\1','') endif -" call Decho("tgtdir<".tgtdir.">") +" call Decho("tgtdir<".tgtdir.">",'~'.expand("")) if a:0 > 0 let fromdir= a:1 else let fromdir= getcwd() endif -" call Decho("fromdir<".fromdir.">") +" call Decho("fromdir<".fromdir.">",'~'.expand("")) if type(a:fname) == 1 " handle uploading a single file using NetWrite -" call Decho("handle uploading a single file via NetWrite") +" call Decho("handle uploading a single file via NetWrite",'~'.expand("")) 1split -" call Decho("exe e ".fnameescape(a:fname)) - exe "NetrwKeepj e ".fnameescape(a:fname) -" call Decho("now locally editing<".expand("%").">, has ".line("$")." lines") +" call Decho("exe e ".fnameescape(s:NetrwFile(a:fname)),'~'.expand("")) + exe "NetrwKeepj e ".fnameescape(s:NetrwFile(a:fname)) +" call Decho("now locally editing<".expand("%").">, has ".line("$")." lines",'~'.expand("")) if a:tgt =~ '/$' let wfname= substitute(a:fname,'^.*/','','') -" call Decho("exe w! ".fnameescape(wfname)) +" call Decho("exe w! ".fnameescape(wfname),'~'.expand("")) exe "w! ".fnameescape(a:tgt.wfname) else -" call Decho("writing local->remote: exe w ".fnameescape(a:tgt)) +" call Decho("writing local->remote: exe w ".fnameescape(a:tgt),'~'.expand("")) exe "w ".fnameescape(a:tgt) -" call Decho("done writing local->remote") +" call Decho("done writing local->remote",'~'.expand("")) endif q! elseif type(a:fname) == 3 " handle uploading a list of files via scp -" call Decho("handle uploading a list of files via scp") +" call Decho("handle uploading a list of files via scp",'~'.expand("")) let curdir= getcwd() if a:tgt =~ '^scp:' call s:NetrwLcd(fromdir) let filelist= deepcopy(s:netrwmarkfilelist_{bufnr('%')}) - let args = join(map(filelist,"shellescape(v:val, 1)")) + let args = join(map(filelist,"s:ShellEscape(v:val, 1)")) if exists("g:netrw_port") && g:netrw_port != "" let useport= " ".g:netrw_scpport." ".g:netrw_port else @@ -7875,7 +8110,7 @@ fun! s:NetrwUpload(fname,tgt,...) endif let machine = substitute(a:tgt,'^scp://\([^/:]\+\).*$','\1','') let tgt = substitute(a:tgt,'^scp://[^/]\+/\(.*\)$','\1','') - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".args." ".shellescape(machine.":".tgt,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.s:ShellEscape(useport,1)." ".args." ".s:ShellEscape(machine.":".tgt,1)) call s:NetrwLcd(curdir) elseif a:tgt =~ '^ftp:' @@ -7885,35 +8120,35 @@ fun! s:NetrwUpload(fname,tgt,...) " handle uploading a list of files via ftp+.netrc let netrw_fname = b:netrw_fname sil NetrwKeepj new -" call Decho("filter input window#".winnr()) +" call Decho("filter input window#".winnr(),'~'.expand("")) NetrwKeepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) endif NetrwKeepj call setline(line("$")+1,'lcd "'.fromdir.'"') -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) if tgtdir == "" let tgtdir= '/' endif NetrwKeepj call setline(line("$")+1,'cd "'.tgtdir.'"') -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) for fname in a:fname - NetrwKeepj call setline(line("$")+1,'put "'.fname.'"') -" call Decho("filter input: ".getline('$')) + NetrwKeepj call setline(line("$")+1,'put "'.s:NetrwFile(fname).'"') +" call Decho("filter input: ".getline('$'),'~'.expand("")) endfor if exists("g:netrw_port") && g:netrw_port != "" - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1)) else -" call Decho("filter input window#".winnr()) - call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) +" call Decho("filter input window#".winnr(),'~'.expand("")) + call s:NetrwExe(s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)) endif " If the result of the ftp operation isn't blank, show an error message (tnx to Doug Claar) sil NetrwKeepj g/Local directory now/d @@ -7933,42 +8168,42 @@ fun! s:NetrwUpload(fname,tgt,...) if exists("g:netrw_port") && g:netrw_port != "" NetrwKeepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) else NetrwKeepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) endif if exists("g:netrw_uid") && g:netrw_uid != "" if exists("g:netrw_ftp") && g:netrw_ftp == 1 NetrwKeepj put =g:netrw_uid -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) if exists("s:netrw_passwd") NetrwKeepj call setline(line("$")+1,'"'.s:netrw_passwd.'"') endif -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) elseif exists("s:netrw_passwd") NetrwKeepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) endif endif NetrwKeepj call setline(line("$")+1,'lcd "'.fromdir.'"') -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) if exists("b:netrw_fname") && b:netrw_fname != "" NetrwKeepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) endif if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) endif for fname in a:fname NetrwKeepj call setline(line("$")+1,'put "'.fname.'"') -" call Decho("filter input: ".getline('$')) +" call Decho("filter input: ".getline('$'),'~'.expand("")) endfor " perform ftp: @@ -8009,7 +8244,7 @@ fun! s:NetrwPreview(path) range NetrwKeepj call s:NetrwOptionSave("s:") NetrwKeepj call s:NetrwSafeOptions() if has("quickfix") - if !isdirectory(a:path) + if !isdirectory(s:NetrwFile(a:path)) if g:netrw_preview && !g:netrw_alto let pvhkeep = &pvh let winsz = (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize @@ -8036,15 +8271,16 @@ fun! s:NetrwRefresh(islocal,dirname) " call Dfunc("s:NetrwRefresh(islocal<".a:islocal.">,dirname=".a:dirname.") hide=".g:netrw_hide." sortdir=".g:netrw_sort_direction) " at the current time (Mar 19, 2007) all calls to NetrwRefresh() call NetrwBrowseChgDir() first. setl ma noro -" call Decho("setl ma noro") -" call Decho("clear buffer<".expand("%")."> with :%d") +" call Decho("setl ma noro",'~'.expand("")) +" call Decho("clear buffer<".expand("%")."> with :%d",'~'.expand("")) let ykeep = @@ " save the cursor position before refresh. let screenposn = netrw#SavePosn() -" call Decho("win#".winnr().": ".winheight(0)."x".winwidth(0)." curfile<".expand("%").">") -" call Decho("clearing buffer prior to refresh") - sil! NetrwKeepj %d + +" call Decho("win#".winnr().": ".winheight(0)."x".winwidth(0)." curfile<".expand("%").">",'~'.expand("")) +" call Decho("clearing buffer prior to refresh",'~'.expand("")) + sil! NetrwKeepj %d _ if a:islocal NetrwKeepj call netrw#LocalBrowseCheck(a:dirname) else @@ -8056,10 +8292,10 @@ fun! s:NetrwRefresh(islocal,dirname) " restore file marks if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" -" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/") +" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/",'~'.expand("")) exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" else -" call Decho("2match none") +" call Decho("2match none (bufnr(%)=".bufnr("%")."<".bufname("%").">)",'~'.expand("")) 2match none endif @@ -8076,26 +8312,26 @@ fun! s:NetrwRefreshDir(islocal,dirname) " call Dfunc("s:NetrwRefreshDir(islocal=".a:islocal." dirname<".a:dirname.">) g:netrw_fastbrowse=".g:netrw_fastbrowse) if g:netrw_fastbrowse == 0 " slowest mode (keep buffers refreshed, local or remote) -" call Decho("slowest mode: keep buffers refreshed, local or remote") +" call Decho("slowest mode: keep buffers refreshed, local or remote",'~'.expand("")) let tgtwin= bufwinnr(a:dirname) -" call Decho("tgtwin= bufwinnr(".a:dirname.")=".tgtwin) +" call Decho("tgtwin= bufwinnr(".a:dirname.")=".tgtwin,'~'.expand("")) if tgtwin > 0 " tgtwin is being displayed, so refresh it let curwin= winnr() -" call Decho("refresh tgtwin#".tgtwin." (curwin#".curwin.")") +" call Decho("refresh tgtwin#".tgtwin." (curwin#".curwin.")",'~'.expand("")) exe tgtwin."wincmd w" - NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) exe curwin."wincmd w" elseif bufnr(a:dirname) > 0 let bn= bufnr(a:dirname) -" call Decho("bd bufnr(".a:dirname.")=".bn) - exe "sil bd ".bn +" call Decho("bd bufnr(".a:dirname.")=".bn,'~'.expand("")) + exe "sil keepj bd ".bn endif elseif g:netrw_fastbrowse <= 1 -" call Decho("medium-speed mode: refresh local buffers only") +" call Decho("medium-speed mode: refresh local buffers only",'~'.expand("")) NetrwKeepj call s:LocalBrowseRefresh() endif " call Dret("s:NetrwRefreshDir") @@ -8109,7 +8345,7 @@ endfun fun! s:NetrwSetChgwin(...) " call Dfunc("s:NetrwSetChgwin() v:count=".v:count) if a:0 > 0 -" call Decho("a:1<".a:1.">") +" call Decho("a:1<".a:1.">",'~'.expand("")) if a:1 == "" " :NetrwC win# let g:netrw_chgwin= winnr() else " :NetrwC @@ -8120,6 +8356,7 @@ fun! s:NetrwSetChgwin(...) else " C let g:netrw_chgwin= winnr() endif + echo "editing window now set to window#".g:netrw_chgwin " call Dret("s:NetrwSetChgwin : g:netrw_chgwin=".g:netrw_chgwin) endfun @@ -8159,7 +8396,7 @@ fun! s:NetrwSetSort() else let spriority= priority.g:netrw_sepchr endif -" call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">") +" call Decho("priority=".priority." spriority<".spriority."> seq<".seq."> seqlist<".seqlist.">",'~'.expand("")) " sanity check if w:netrw_bannercnt > line("$") @@ -8235,7 +8472,7 @@ fun! s:NetrwSortStyle(islocal) NetrwKeepj call s:NetrwSaveWordPosn() let svpos= netrw#SavePosn() - let g:netrw_sort_by= (g:netrw_sort_by =~ 'n')? 'time' : (g:netrw_sort_by =~ 't')? 'size' : 'name' + let g:netrw_sort_by= (g:netrw_sort_by =~ '^n')? 'time' : (g:netrw_sort_by =~ '^t')? 'size' : (g:netrw_sort_by =~ '^siz')? 'exten' : 'name' NetrwKeepj norm! 0 NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) NetrwKeepj call netrw#RestorePosn(svpos) @@ -8261,7 +8498,7 @@ fun! s:NetrwSplit(mode) " remote and o let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize if winsz == 0|let winsz= ""|endif -" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s") +" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s",'~'.expand("")) exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" let s:didsplit= 1 NetrwKeepj call s:RestoreWinVars() @@ -8271,7 +8508,7 @@ fun! s:NetrwSplit(mode) elseif a:mode == 1 " remote and t let newdir = s:NetrwBrowseChgDir(0,s:NetrwGetWord()) -" call Decho("tabnew") +" call Decho("tabnew",'~'.expand("")) tabnew let s:didsplit= 1 NetrwKeepj call s:RestoreWinVars() @@ -8282,7 +8519,7 @@ fun! s:NetrwSplit(mode) " remote and v let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize if winsz == 0|let winsz= ""|endif -" call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v") +" call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v",'~'.expand("")) exe (g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v" let s:didsplit= 1 NetrwKeepj call s:RestoreWinVars() @@ -8293,7 +8530,7 @@ fun! s:NetrwSplit(mode) " local and o let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize if winsz == 0|let winsz= ""|endif -" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s") +" call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s",'~'.expand("")) exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" let s:didsplit= 1 NetrwKeepj call s:RestoreWinVars() @@ -8312,9 +8549,9 @@ fun! s:NetrwSplit(mode) setl ei=all exe "NetrwKeepj norm! ".netrw_hline."G0z\" exe "NetrwKeepj norm! ".netrw_line."G0".netrw_col."\" - let &ei= eikeep - let netrw_curdir= s:NetrwTreeDir(0) -" call Decho("tabnew") + let &ei = eikeep + let netrw_curdir = s:NetrwTreeDir(0) +" call Decho("tabnew",'~'.expand("")) tabnew let b:netrw_curdir = netrw_curdir let s:didsplit = 1 @@ -8332,7 +8569,7 @@ fun! s:NetrwSplit(mode) " local and v let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize if winsz == 0|let winsz= ""|endif -" call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v") +" call Decho("exe ".(g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v",'~'.expand("")) exe (g:netrw_altv? "rightb " : "lefta ").winsz."wincmd v" let s:didsplit= 1 NetrwKeepj call s:RestoreWinVars() @@ -8359,21 +8596,29 @@ fun! s:NetrwTgtMenu() " the following test assures that gvim is running, has menus available, and has menus enabled. if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu if exists("g:NetrwTopLvlMenu") -" call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)") +" call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)",'~'.expand("")) exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Targets' endif if !exists("s:netrw_initbookhist") call s:NetrwBookHistRead() endif + " try to cull duplicate entries + let tgtdict={} + " target bookmarked places if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] && g:netrw_dirhistmax > 0 -" call Decho("installing bookmarks as easy targets") +" call Decho("installing bookmarks as easy targets",'~'.expand("")) let cnt= 1 for bmd in g:netrw_bookmarklist + if has_key(tgtdict,bmd) + let cnt= cnt + 1 + continue + endif + let tgtdict[bmd]= cnt let ebmd= escape(bmd,g:netrw_menu_escape) " show bookmarks for goto menu -" call Decho("menu: Targets: ".bmd) +" call Decho("menu: Targets: ".bmd,'~'.expand("")) exe 'sil! menu '.g:NetrwMenuPriority.".19.1.".cnt." ".g:NetrwTopLvlMenu.'Targets.'.ebmd." :call netrw#MakeTgt('".bmd."')\" let cnt= cnt + 1 endfor @@ -8381,14 +8626,19 @@ fun! s:NetrwTgtMenu() " target directory browsing history if exists("g:netrw_dirhistmax") && g:netrw_dirhistmax > 0 -" call Decho("installing history as easy targets (histmax=".g:netrw_dirhistmax.")") +" call Decho("installing history as easy targets (histmax=".g:netrw_dirhistmax.")",'~'.expand("")) let histcnt = 1 while histcnt <= g:netrw_dirhistmax let priority = g:netrw_dirhist_cnt + histcnt if exists("g:netrw_dirhist_{histcnt}") let histentry = g:netrw_dirhist_{histcnt} - let ehistentry = escape(histentry,g:netrw_menu_escape) -" call Decho("menu: Targets: ".histentry) + if has_key(tgtdict,histentry) + let histcnt = histcnt + 1 + continue + endif + let tgtdict[histentry] = histcnt + let ehistentry = escape(histentry,g:netrw_menu_escape) +" call Decho("menu: Targets: ".histentry,'~'.expand("")) exe 'sil! menu '.g:NetrwMenuPriority.".19.2.".priority." ".g:NetrwTopLvlMenu.'Targets.'.ehistentry." :call netrw#MakeTgt('".histentry."')\" endif let histcnt = histcnt + 1 @@ -8411,63 +8661,72 @@ fun! s:NetrwTreeDir(islocal) " call Dret("s:NetrwTreeDir ".treedir) return treedir endif + if !exists("b:netrw_curdir") || b:netrw_curdir == "" let b:netrw_curdir= getcwd() endif + let treedir = b:netrw_curdir -" call Decho("set initial treedir<".treedir.">") +" call Decho("set initial treedir<".treedir.">",'~'.expand("")) let s:treecurpos= netrw#SavePosn() if w:netrw_liststyle == s:TREELIST -" call Decho("w:netrw_liststyle is TREELIST:") -" call Decho("line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">") +" call Decho("w:netrw_liststyle is TREELIST:",'~'.expand("")) +" call Decho("line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">",'~'.expand("")) " extract tree directory if on a line specifying a subdirectory (ie. ends with "/") let curline= substitute(getline('.'),"\t -->.*$",'','') if curline =~ '/$' -" call Decho("extract tree subdirectory from current line") +" call Decho("extract tree subdirectory from current line",'~'.expand("")) let treedir= substitute(getline('.'),'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e') -" call Decho("treedir<".treedir.">") - else -" call Decho("do not extract tree subdirectory from current line and set treedir to empty") +" call Decho("treedir<".treedir.">",'~'.expand("")) + elseif curline =~ '@$' +" call Decho("handle symbolic link from current line",'~'.expand("")) + let treedir= resolve(substitute(substitute(getline('.'),'@.*$','','e'),'^|*\s*','','e')) +" call Decho("treedir<".treedir.">",'~'.expand("")) + else +" call Decho("do not extract tree subdirectory from current line and set treedir to empty",'~'.expand("")) let treedir= "" endif " detect user attempting to close treeroot -" call Decho("check if user is attempting to close treeroot") -" call Decho(".win#".winnr()." buf#".bufnr("%")."<".bufname("%").">") -" call Decho(".getline(".line(".").")<".getline('.').'> '.((getline('.') =~ '^'.s:treedepthstring)? '=~' : '!~').' ^'.s:treedepthstring) +" call Decho("check if user is attempting to close treeroot",'~'.expand("")) +" call Decho(".win#".winnr()." buf#".bufnr("%")."<".bufname("%").">",'~'.expand("")) +" call Decho(".getline(".line(".").")<".getline('.').'> '.((getline('.') =~ '^'.s:treedepthstring)? '=~' : '!~').' ^'.s:treedepthstring,'~'.expand("")) if curline !~ '^'.s:treedepthstring && getline('.') != '..' -" call Decho(".user may have attempted to close treeroot") +" call Decho(".user may have attempted to close treeroot",'~'.expand("")) " now force a refresh -" call Decho(".force refresh: clear buffer<".expand("%")."> with :%d") - sil! NetrwKeepj %d -" call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".string(s:treecurpos).">") +" call Decho(".force refresh: clear buffer<".expand("%")."> with :%d",'~'.expand("")) + sil! NetrwKeepj %d _ +" call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".(exists("s:treecurpos")? string(s:treecurpos) : 'n/a').">") return b:netrw_curdir " else " Decho -" call Decho(".user did not attempt to close treeroot") - endif - -" call Decho("islocal=".a:islocal." curline<".curline.">") -" call Decho("after subst<".substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)$','\1','').">") +" call Decho(".user did not attempt to close treeroot",'~'.expand("")) + endif + +" call Decho("islocal=".a:islocal." curline<".curline.">",'~'.expand("")) +" call Decho("after subst<".substitute(curline,'^'.s:treedepthstring.'\+ \(.*\)$','\1','').">",'~'.expand("")) let potentialdir= substitute(curline,'^'.s:treedepthstring.'* \(.*\)@$','\1','') -" call Decho("potentialdir<".potentialdir."> isdir=".isdirectory(potentialdir)) - - if a:islocal && curline =~ '@$' && isdirectory(potentialdir) - let newdir = w:netrw_treetop.'/'.potentialdir - let treedir = s:NetrwTreePath(newdir) - let w:netrw_treetop = newdir -" call Decho("newdir <".newdir.">") - else +" call Decho("potentialdir<".potentialdir."> isdir=".isdirectory(s:NetrwFile(potentialdir)),'~'.expand("")) + + " COMBAK: a symbolic link may point anywhere -- so it will be used to start a new treetop +" if a:islocal && curline =~ '@$' && isdirectory(s:NetrwFile(potentialdir)) +" let newdir = w:netrw_treetop.'/'.potentialdir +" " call Decho("apply NetrwTreePath to newdir<".newdir.">",'~'.expand("")) +" let treedir = s:NetrwTreePath(newdir) +" let w:netrw_treetop = newdir +" " call Decho("newdir <".newdir.">",'~'.expand("")) +" else +" call Decho("apply NetrwTreePath to treetop<".w:netrw_treetop.">",'~'.expand("")) let treedir = s:NetrwTreePath(w:netrw_treetop) - endif +" endif endif " sanity maintenance: keep those //s away... let treedir= substitute(treedir,'//$','/','') -" call Decho("treedir<".treedir.">") - -" call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".string(s:treecurpos).">") +" call Decho("treedir<".treedir.">",'~'.expand("")) + +" call Dret("s:NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".(exists("s:treecurpos")? string(s:treecurpos) : 'n/a').">") return treedir endfun @@ -8482,9 +8741,9 @@ fun! s:NetrwTreeDisplay(dir,depth) " install ../ and shortdir if a:depth == "" call setline(line("$")+1,'../') -" call Decho("setline#".line("$")." ../ (depth is zero)") - endif - if a:dir =~ '^\a\+://' +" call Decho("setline#".line("$")." ../ (depth is zero)",'~'.expand("")) + endif + if a:dir =~ '^\a\{3,}://' if a:dir == w:netrw_treetop let shortdir= a:dir else @@ -8495,29 +8754,30 @@ fun! s:NetrwTreeDisplay(dir,depth) let shortdir= substitute(a:dir,'^.*/','','e') call setline(line("$")+1,a:depth.shortdir.'/') endif -" call Decho("setline#".line("$")." shortdir<".a:depth.shortdir.">") +" call Decho("setline#".line("$")." shortdir<".a:depth.shortdir.">",'~'.expand("")) " append a / to dir if its missing one let dir= a:dir - if dir !~ '/$' - let dir= dir.'/' - endif " display subtrees (if any) let depth= s:treedepthstring.a:depth - -" call Decho("display subtrees with depth<".depth."> and current leaves") - for entry in w:netrw_treedict[a:dir] - let direntry= substitute(dir.entry,'/$','','e') -" call Decho("dir<".dir."> entry<".entry."> direntry<".direntry.">") +" call Decho("display subtrees with depth<".depth."> and current leaves",'~'.expand("")) + +" call Decho("w:netrw_treedict[".dir."]=".string(w:netrw_treedict[dir]),'~'.expand("")) + for entry in w:netrw_treedict[dir] + let direntry= substitute(dir.'/'.entry,'[@/]$','','e') +" call Decho("dir<".dir."> entry<".entry."> direntry<".direntry.">",'~'.expand("")) if entry =~ '/$' && has_key(w:netrw_treedict,direntry) -" call Decho("<".direntry."> is a key in treedict - display subtree for it") +" call Decho("<".direntry."> is a key in treedict - display subtree for it",'~'.expand("")) NetrwKeepj call s:NetrwTreeDisplay(direntry,depth) elseif entry =~ '/$' && has_key(w:netrw_treedict,direntry.'/') -" call Decho("<".direntry."/> is a key in treedict - display subtree for it") +" call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("")) NetrwKeepj call s:NetrwTreeDisplay(direntry.'/',depth) - else -" call Decho("<".entry."> is not a key in treedict (no subtree)") + elseif entry =~ '@$' && has_key(w:netrw_treedict,direntry.'@') +" call Decho("<".direntry."/> is a key in treedict - display subtree for it",'~'.expand("")) + NetrwKeepj call s:NetrwTreeDisplay(direntry.'/',depth) + else +" call Decho("<".entry."> is not a key in treedict (no subtree)",'~'.expand("")) sil! NetrwKeepj call setline(line("$")+1,depth.entry) endif endfor @@ -8527,34 +8787,36 @@ endfun " --------------------------------------------------------------------- " s:NetrwTreeListing: displays tree listing from treetop on down, using NetrwTreeDisplay() {{{2 +" Called by s:PerformListing() fun! s:NetrwTreeListing(dirname) if w:netrw_liststyle == s:TREELIST " call Dfunc("NetrwTreeListing() bufname<".expand("%").">") -" call Decho("curdir<".a:dirname.">") -" call Decho("win#".winnr().": w:netrw_treetop ".(exists("w:netrw_treetop")? "exists" : "doesn't exist")." w:netrw_treedict ".(exists("w:netrw_treedict")? "exists" : "doesn't exit")) -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("curdir<".a:dirname.">",'~'.expand("")) +" call Decho("win#".winnr().": w:netrw_treetop ".(exists("w:netrw_treetop")? "exists" : "doesn't exist")." w:netrw_treedict ".(exists("w:netrw_treedict")? "exists" : "doesn't exit"),'~'.expand("")) +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) " update the treetop -" call Decho("update the treetop") +" call Decho("update the treetop",'~'.expand("")) if !exists("w:netrw_treetop") let w:netrw_treetop= a:dirname -" call Decho("w:netrw_treetop<".w:netrw_treetop."> (reusing)") +" call Decho("w:netrw_treetop<".w:netrw_treetop."> (reusing)",'~'.expand("")) elseif (w:netrw_treetop =~ ('^'.a:dirname) && s:Strlen(a:dirname) < s:Strlen(w:netrw_treetop)) || a:dirname !~ ('^'.w:netrw_treetop) let w:netrw_treetop= a:dirname -" call Decho("w:netrw_treetop<".w:netrw_treetop."> (went up)") - endif - - " insure that we have at least an empty treedict +" call Decho("w:netrw_treetop<".w:netrw_treetop."> (went up)",'~'.expand("")) + endif + if !exists("w:netrw_treedict") + " insure that we have a treedict, albeit empty +" call Decho("initializing w:netrw_treedict to empty",'~'.expand("")) let w:netrw_treedict= {} endif " update the directory listing for the current directory -" call Decho("updating dictionary with ".a:dirname.":[..directory listing..]") -" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." line($)=".line("$")) +" call Decho("updating dictionary with ".a:dirname.":[..directory listing..]",'~'.expand("")) +" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." line($)=".line("$"),'~'.expand("")) exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g@^\.\.\=/$@d' let w:netrw_treedict[a:dirname]= getline(w:netrw_bannercnt,line("$")) -" call Decho("w:treedict[".a:dirname."]= ".string(w:netrw_treedict[a:dirname])) +" call Decho("w:treedict[".a:dirname."]= ".string(w:netrw_treedict[a:dirname]),'~'.expand("")) exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d" " if past banner, record word @@ -8563,16 +8825,16 @@ fun! s:NetrwTreeListing(dirname) else let fname= "" endif -" call Decho("fname<".fname.">") -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("fname<".fname.">",'~'.expand("")) +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) " display from treetop on down NetrwKeepj call s:NetrwTreeDisplay(w:netrw_treetop,"") -" call Decho("s:NetrwTreeDisplay) setl noma nomod ro") +" call Decho("s:NetrwTreeDisplay) setl noma nomod ro",'~'.expand("")) " remove any blank line remaining as line#1 (happens in treelisting mode with banner suppressed) while getline(1) =~ '^\s*$' && byte2line(1) > 0 -" call Decho("deleting blank line") +" call Decho("deleting blank line",'~'.expand("")) 1d endwhile @@ -8591,25 +8853,32 @@ endfun fun! s:NetrwTreePath(treetop) " call Dfunc("s:NetrwTreePath() line#".line(".")."<".getline(".").">") let depth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') -" call Decho("(s:NetrwTreePath) depth<".depth."> 1st subst") +" call Decho("depth<".depth."> 1st subst",'~'.expand("")) let depth = substitute(depth,'^'.s:treedepthstring,'','') -" call Decho("(s:NetrwTreePath) depth<".depth."> 2nd subst (first depth removed)") - if getline('.') =~ '/$' -" call Decho("extract tree directory from current line") - let treedir= substitute(getline('.'),'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e') -" call Decho("(s:NetrwTreePath) treedir<".treedir.">") - else -" call Decho("(s:NetrwTreePath) do not extract tree directory from current line and set treedir to empty") +" call Decho("depth<".depth."> 2nd subst (first depth removed)",'~'.expand("")) + let curline= getline('.') +" call Decho("curline<".curline.'>','~'.expand("")) + if curline =~ '/$' +" call Decho("extract tree directory from current line",'~'.expand("")) + let treedir= substitute(curline,'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e') +" call Decho("treedir<".treedir.">",'~'.expand("")) + elseif curline =~ '@\s\+-->' +" call Decho("extract tree directory using symbolic link",'~'.expand("")) + let treedir= substitute(curline,'^\%('.s:treedepthstring.'\)*\([^'.s:treedepthstring.'].\{-}\)$','\1','e') + let treedir= substitute(treedir,'@\s\+-->.*$','','e') +" call Decho("treedir<".treedir.">",'~'.expand("")) + else +" call Decho("do not extract tree directory from current line and set treedir to empty",'~'.expand("")) let treedir= "" endif " construct treedir by searching backwards at correct depth -" call Decho("(s:NetrwTreePath) construct treedir by searching backwards for correct depth") -" call Decho("(s:NetrwTreePath) initial treedir<".treedir."> depth<".depth.">") +" call Decho("construct treedir by searching backwards for correct depth",'~'.expand("")) +" call Decho("initial treedir<".treedir."> depth<".depth.">",'~'.expand("")) while depth != "" && search('^'.depth.'[^'.s:treedepthstring.'].\{-}/$','bW') let dirname= substitute(getline('.'),'^\('.s:treedepthstring.'\)*','','e') let treedir= dirname.treedir let depth = substitute(depth,'^'.s:treedepthstring,'','') -" call Decho("(s:NetrwTreePath) constructing treedir<".treedir.">: dirname<".dirname."> while depth<".depth.">") +" call Decho("constructing treedir<".treedir.">: dirname<".dirname."> while depth<".depth.">",'~'.expand("")) endwhile if a:treetop =~ '/$' let treedir= a:treetop.treedir @@ -8632,7 +8901,7 @@ fun! s:NetrwWideListing() " fpl: filenames per line " fpc: filenames per column setl ma noro -" call Decho("setl ma noro") +" call Decho("setl ma noro",'~'.expand("")) let b:netrw_cpf= 0 if line("$") >= w:netrw_bannercnt exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' @@ -8642,22 +8911,23 @@ fun! s:NetrwWideListing() return endif let b:netrw_cpf= b:netrw_cpf + 2 -" call Decho("b:netrw_cpf=max_filename_length+2=".b:netrw_cpf) +" call Decho("b:netrw_cpf=max_filename_length+2=".b:netrw_cpf,'~'.expand("")) " determine qty files per line (fpl) let w:netrw_fpl= winwidth(0)/b:netrw_cpf if w:netrw_fpl <= 0 let w:netrw_fpl= 1 endif -" call Decho("fpl= [winwidth=".winwidth(0)."]/[b:netrw_cpf=".b:netrw_cpf.']='.w:netrw_fpl) +" call Decho("fpl= [winwidth=".winwidth(0)."]/[b:netrw_cpf=".b:netrw_cpf.']='.w:netrw_fpl,'~'.expand("")) " make wide display - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^.*$/\=escape(printf("%-'.b:netrw_cpf.'s",submatch(0)),"\\")/' + " fpc: files per column of wide listing + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^.*$/\=escape(printf("%-'.b:netrw_cpf.'S",submatch(0)),"\\")/' NetrwKeepj call histdel("/",-1) let fpc = (line("$") - w:netrw_bannercnt + w:netrw_fpl)/w:netrw_fpl let newcolstart = w:netrw_bannercnt + fpc let newcolend = newcolstart + fpc - 1 -" call Decho("bannercnt=".w:netrw_bannercnt." fpl=".w:netrw_fpl." fpc=".fpc." newcol[".newcolstart.",".newcolend."]") +" call Decho("bannercnt=".w:netrw_bannercnt." fpl=".w:netrw_fpl." fpc=".fpc." newcol[".newcolstart.",".newcolend."]",'~'.expand("")) if has("clipboard") sil! let keepregstar = @* endif @@ -8680,9 +8950,9 @@ fun! s:NetrwWideListing() NetrwKeepj call histdel("/",-1) exe 'nno w :call search(''^.\\|\s\s\zs\S'',''W'')'."\" exe 'nno b :call search(''^.\\|\s\s\zs\S'',''bW'')'."\" -" call Decho("NetrwWideListing) setl noma nomod ro") +" call Decho("NetrwWideListing) setl noma nomod ro",'~'.expand("")) exe "setl ".g:netrw_bufsettings -" call Decho("(NetrwWideListing) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("(NetrwWideListing) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) " call Dret("NetrwWideListing") return else @@ -8699,26 +8969,27 @@ endfun " --------------------------------------------------------------------- " s:PerformListing: {{{2 fun! s:PerformListing(islocal) -" call Dfunc("s:PerformListing(islocal=".a:islocal.") bufnr(%)=".bufnr("%")."<".bufname("%").">") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (enter)") +" call Dfunc("s:PerformListing(islocal=".a:islocal.")") +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("")) +" call Decho("settings: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (enter)",'~'.expand("")) " set up syntax highlighting {{{3 -" call Decho("set up syntax highlighting (ie. setl ft=netrw)") +" call Decho("--set up syntax highlighting (ie. setl ft=netrw)",'~'.expand("")) sil! setl ft=netrw NetrwKeepj call s:NetrwSafeOptions() setl noro ma -" call Decho("setl noro ma bh=".&bh) +" call Decho("setl noro ma bh=".&bh,'~'.expand("")) " if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 " Decho -" call Decho("(netrw) Processing your browsing request...") +" call Decho("(netrw) Processing your browsing request...",'~'.expand("")) " endif " Decho -" call Decho('w:netrw_liststyle='.(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')) +" call Decho('w:netrw_liststyle='.(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " force a refresh for tree listings -" call Decho("force refresh for treelisting: clear buffer<".expand("%")."> with :%d") - sil! NetrwKeepj %d +" call Decho("force refresh for treelisting: clear buffer<".expand("%")."> with :%d",'~'.expand("")) + sil! NetrwKeepj %d _ endif " save current directory on directory history list @@ -8726,21 +8997,34 @@ fun! s:PerformListing(islocal) " Set up the banner {{{3 if g:netrw_banner -" call Decho("set up banner") +" call Decho("--set up banner",'~'.expand("")) NetrwKeepj call setline(1,'" ============================================================================') - NetrwKeepj call setline(2,'" Netrw Directory Listing (netrw '.g:loaded_netrw.')') + if exists("g:netrw_pchk") + " this undocumented option allows pchk to run with different versions of netrw without causing spurious + " failure detections. + NetrwKeepj call setline(2,'" Netrw Directory Listing') + else + NetrwKeepj call setline(2,'" Netrw Directory Listing (netrw '.g:loaded_netrw.')') + endif + if exists("g:netrw_pchk") + let curdir= substitute(b:netrw_curdir,expand("$HOME"),'~','') + else + let curdir= b:netrw_curdir + endif if exists("g:netrw_bannerbackslash") && g:netrw_bannerbackslash - NetrwKeepj call setline(3,'" '.substitute(b:netrw_curdir,'/','\\','g')) - else - NetrwKeepj call setline(3,'" '.b:netrw_curdir) + NetrwKeepj call setline(3,'" '.substitute(curdir,'/','\\','g')) + else + NetrwKeepj call setline(3,'" '.curdir) endif let w:netrw_bannercnt= 3 NetrwKeepj exe "sil! NetrwKeepj ".w:netrw_bannercnt else +" call Decho("--no banner",'~'.expand("")) NetrwKeepj 1 let w:netrw_bannercnt= 1 endif -" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." win#".winnr()) +" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." win#".winnr(),'~'.expand("")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("")) let sortby= g:netrw_sort_by if g:netrw_sort_direction =~ "^r" @@ -8749,28 +9033,28 @@ fun! s:PerformListing(islocal) " Sorted by... {{{3 if g:netrw_banner -" call Decho("handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">") +" call Decho("--handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">",'~'.expand("")) if g:netrw_sort_by =~ "^n" -" call Decho("directories will be sorted by name") +" call Decho("directories will be sorted by name",'~'.expand("")) " sorted by name NetrwKeepj put ='\" Sorted by '.sortby NetrwKeepj put ='\" Sort sequence: '.g:netrw_sort_sequence let w:netrw_bannercnt= w:netrw_bannercnt + 2 else -" call Decho("directories will be sorted by size or time") +" call Decho("directories will be sorted by size or time",'~'.expand("")) " sorted by size or date NetrwKeepj put ='\" Sorted by '.sortby let w:netrw_bannercnt= w:netrw_bannercnt + 1 endif exe "sil! NetrwKeepj ".w:netrw_bannercnt " else " Decho -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) endif " show copy/move target, if any if g:netrw_banner if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal") -" call Decho("show copy/move target<".s:netrwmftgt.">") +" call Decho("--show copy/move target<".s:netrwmftgt.">",'~'.expand("")) NetrwKeepj put ='' if s:netrwmftgt_islocal sil! NetrwKeepj call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (local)') @@ -8779,14 +9063,14 @@ fun! s:PerformListing(islocal) endif let w:netrw_bannercnt= w:netrw_bannercnt + 1 else -" call Decho("s:netrwmftgt does not exist, don't make Copy/Move Tgt") +" call Decho("s:netrwmftgt does not exist, don't make Copy/Move Tgt",'~'.expand("")) endif exe "sil! NetrwKeepj ".w:netrw_bannercnt endif " Hiding... -or- Showing... {{{3 if g:netrw_banner -" call Decho("handle hiding/showing (g:netrw_hide=".g:netrw_list_hide." g:netrw_list_hide<".g:netrw_list_hide.">)") +" call Decho("--handle hiding/showing (g:netrw_hide=".g:netrw_list_hide." g:netrw_list_hide<".g:netrw_list_hide.">)",'~'.expand("")) if g:netrw_list_hide != "" && g:netrw_hide if g:netrw_hide == 1 NetrwKeepj put ='\" Hiding: '.g:netrw_list_hide @@ -8797,34 +9081,34 @@ fun! s:PerformListing(islocal) endif exe "NetrwKeepj ".w:netrw_bannercnt -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) let quickhelp = g:netrw_quickhelp%len(s:QuickHelp) -" call Decho("quickhelp =".quickhelp) +" call Decho("quickhelp =".quickhelp,'~'.expand("")) NetrwKeepj put ='\" Quick Help: :help '.s:QuickHelp[quickhelp] -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) NetrwKeepj put ='\" ==============================================================================' let w:netrw_bannercnt= w:netrw_bannercnt + 2 " else " Decho -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) endif " bannercnt should index the line just after the banner if g:netrw_banner let w:netrw_bannercnt= w:netrw_bannercnt + 1 exe "sil! NetrwKeepj ".w:netrw_bannercnt -" call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$")) +" call Decho("--w:netrw_bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$"),'~'.expand("")) " else " Decho -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) endif " get list of files -" call Decho("Get list of files - islocal=".a:islocal) +" call Decho("--Get list of files - islocal=".a:islocal,'~'.expand("")) if a:islocal NetrwKeepj call s:LocalListing() else " remote NetrwKeepj let badresult= s:NetrwRemoteListing() if badresult -" call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." win#".winnr()." buf#".bufnr("%")."<".bufname("%").">") +" call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." win#".winnr()." buf#".bufnr("%")."<".bufname("%").">",'~'.expand("")) " call Dret("s:PerformListing : error detected by NetrwRemoteListing") return endif @@ -8834,24 +9118,25 @@ fun! s:PerformListing(islocal) if !exists("w:netrw_bannercnt") let w:netrw_bannercnt= 0 endif -" call Decho("g:netrw_banner=".g:netrw_banner." w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)") -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("--manipulate directory listing (hide, sort)",'~'.expand("")) +" call Decho("g:netrw_banner=".g:netrw_banner." w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)",'~'.expand("")) +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) if !g:netrw_banner || line("$") >= w:netrw_bannercnt -" call Decho("manipulate directory listing (hide)") -" call Decho("g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">") +" call Decho("manipulate directory listing (hide)",'~'.expand("")) +" call Decho("g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">",'~'.expand("")) if g:netrw_hide && g:netrw_list_hide != "" NetrwKeepj call s:NetrwListHide() endif if !g:netrw_banner || line("$") >= w:netrw_bannercnt -" call Decho("manipulate directory listing (sort) : g:netrw_sort_by<".g:netrw_sort_by.">") +" call Decho("manipulate directory listing (sort) : g:netrw_sort_by<".g:netrw_sort_by.">",'~'.expand("")) if g:netrw_sort_by =~ "^n" " sort by name NetrwKeepj call s:NetrwSetSort() if !g:netrw_banner || w:netrw_bannercnt < line("$") -" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")") +" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) if g:netrw_sort_direction =~ 'n' " normal direction sorting exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options @@ -8861,18 +9146,39 @@ fun! s:PerformListing(islocal) endif endif " remove priority pattern prefix -" call Decho("remove priority pattern prefix") +" call Decho("remove priority pattern prefix",'~'.expand("")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{3}'.g:netrw_sepchr.'//e' NetrwKeepj call histdel("/",-1) + elseif g:netrw_sort_by =~ "^ext" + " sort by extension + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g+/+s/^/001'.g:netrw_sepchr.'/' + NetrwKeepj call histdel("/",-1) + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$v+[./]+s/^/002'.g:netrw_sepchr.'/' + NetrwKeepj call histdel("/",-1) + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$v+['.g:netrw_sepchr.'/]+s/^\(.*\.\)\(.\{-\}\)$/\2'.g:netrw_sepchr.'&/e' + NetrwKeepj call histdel("/",-1) + if !g:netrw_banner || w:netrw_bannercnt < line("$") +" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) + if g:netrw_sort_direction =~ 'n' + " normal direction sorting + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options + else + " reverse direction sorting + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options + endif + endif + exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^.\{-}'.g:netrw_sepchr.'//e' + NetrwKeepj call histdel("/",-1) + elseif a:islocal if !g:netrw_banner || w:netrw_bannercnt < line("$") -" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction) +" call Decho("g:netrw_sort_direction=".g:netrw_sort_direction,'~'.expand("")) if g:netrw_sort_direction =~ 'n' -" call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort') +" call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort','~'.expand("")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options else -" call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort!') +" call Decho('exe sil NetrwKeepj '.w:netrw_bannercnt.',$sort!','~'.expand("")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$sort!'.' '.g:netrw_sort_options endif exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{-}\///e' @@ -8881,62 +9187,72 @@ fun! s:PerformListing(islocal) endif elseif g:netrw_sort_direction =~ 'r' -" call Decho('(s:PerformListing) reverse the sorted listing') +" call Decho('(s:PerformListing) reverse the sorted listing','~'.expand("")) if !g:netrw_banner || w:netrw_bannercnt < line('$') exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g/^/m '.w:netrw_bannercnt call histdel("/",-1) endif endif endif -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) " convert to wide/tree listing {{{3 -" call Decho("modify display if wide/tree listing style") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#1)") +" call Decho("--modify display if wide/tree listing style",'~'.expand("")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#1)",'~'.expand("")) NetrwKeepj call s:NetrwWideListing() -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#2)") +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#2)",'~'.expand("")) NetrwKeepj call s:NetrwTreeListing(b:netrw_curdir) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#3)") +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#3)",'~'.expand("")) " resolve symbolic links if local and (thin or tree) if a:islocal && (w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:TREELIST) - g/@$/call s:ShowLink() - endif - - if exists("w:netrw_bannercnt") && (line("$") > w:netrw_bannercnt || !g:netrw_banner) +" call Decho("--resolve symbolic links if local and thin|tree",'~'.expand("")) + g/@$/call s:ShowLink() + endif + + if exists("w:netrw_bannercnt") && (line("$") >= w:netrw_bannercnt || !g:netrw_banner) " place cursor on the top-left corner of the file listing -" call Decho("place cursor on top-left corner of file listing") - exe 'sil! NetrwKeepj '.w:netrw_bannercnt +" call Decho("--place cursor on top-left corner of file listing",'~'.expand("")) + exe 'sil! '.w:netrw_bannercnt sil! NetrwKeepj norm! 0 +" call Decho(" tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("")) + else +" call Decho("--did NOT place cursor on top-left corner",'~'.expand("")) +" call Decho(" w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a'),'~'.expand("")) +" call Decho(" line($)=".line("$"),'~'.expand("")) +" call Decho(" g:netrw_banner=".(exists("g:netrw_banner")? g:netrw_banner : 'n/a'),'~'.expand("")) endif " record previous current directory let w:netrw_prvdir= b:netrw_curdir -" call Decho("record netrw_prvdir<".w:netrw_prvdir.">") +" call Decho("--record netrw_prvdir<".w:netrw_prvdir.">",'~'.expand("")) " save certain window-oriented variables into buffer-oriented variables {{{3 -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#4)") +" call Decho("--save some window-oriented variables into buffer oriented variables",'~'.expand("")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#4)",'~'.expand("")) NetrwKeepj call s:SetBufWinVars() -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#5)") +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#5)",'~'.expand("")) NetrwKeepj call s:NetrwOptionRestore("w:") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#6)") +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#6)",'~'.expand("")) " set display to netrw display settings -" call Decho("set display to netrw display settings (".g:netrw_bufsettings.")") +" call Decho("--set display to netrw display settings (".g:netrw_bufsettings.")",'~'.expand("")) exe "setl ".g:netrw_bufsettings -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#7)") +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#7)",'~'.expand("")) if g:netrw_liststyle == s:LONGLIST -" call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1)) +" call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("")) exe "setl ts=".(g:netrw_maxfilenamelen+1) endif if exists("s:treecurpos") -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#8)") +" call Decho("s:treecurpos exists; restore posn",'~'.expand("")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#8)",'~'.expand("")) NetrwKeepj call netrw#RestorePosn(s:treecurpos) unlet s:treecurpos endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (return)") +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (return)",'~'.expand("")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("")) " call Dret("s:PerformListing : curpos<".string(getpos(".")).">") endfun @@ -8947,7 +9263,7 @@ fun! s:SetupNetrwStatusLine(statline) if !exists("s:netrw_setup_statline") let s:netrw_setup_statline= 1 -" call Decho("do first-time status line setup") +" call Decho("do first-time status line setup",'~'.expand("")) if !exists("s:netrw_users_stl") let s:netrw_users_stl= &stl @@ -8961,7 +9277,7 @@ fun! s:SetupNetrwStatusLine(statline) redir @a try hi User9 - catch /^Vim\%((\a\+)\)\=:E411/ + catch /^Vim\%((\a\{3,})\)\=:E411/ if &bg == "dark" hi User9 ctermfg=yellow ctermbg=blue guifg=yellow guibg=blue else @@ -8977,7 +9293,7 @@ fun! s:SetupNetrwStatusLine(statline) " make sure statusline is displayed let &stl=a:statline setl laststatus=2 -" call Decho("stl=".&stl) +" call Decho("stl=".&stl,'~'.expand("")) redraw " call Dret("SetupNetrwStatusLine : stl=".&stl) @@ -8994,7 +9310,7 @@ endfun " enforced here. fun! s:NetrwRemoteFtpCmd(path,listcmd) " call Dfunc("NetrwRemoteFtpCmd(path<".a:path."> listcmd<".a:listcmd.">) w:netrw_method=".(exists("w:netrw_method")? w:netrw_method : (exists("b:netrw_method")? b:netrw_method : "???"))) -" call Decho("line($)=".line("$")." w:netrw_bannercnt=".w:netrw_bannercnt) +" call Decho("line($)=".line("$")." w:netrw_bannercnt=".w:netrw_bannercnt,'~'.expand("")) " sanity check: {{{3 if !exists("w:netrw_method") if exists("b:netrw_method") @@ -9009,11 +9325,11 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) " WinXX ftp uses unix style input, so set ff to unix " {{{3 let ffkeep= &ff setl ma ff=unix noro -" call Decho("setl ma ff=unix noro") +" call Decho("setl ma ff=unix noro",'~'.expand("")) " clear off any older non-banner lines " {{{3 " note that w:netrw_bannercnt indexes the line after the banner -" call Decho('exe sil! NetrwKeepj '.w:netrw_bannercnt.",$d (clear off old non-banner lines)") +" call Decho('exe sil! NetrwKeepj '.w:netrw_bannercnt.",$d (clear off old non-banner lines)",'~'.expand("")) exe "sil! NetrwKeepj ".w:netrw_bannercnt.",$d" "......................................... @@ -9024,16 +9340,16 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) endif if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("")) endif NetrwKeepj call setline(line("$")+1,a:listcmd) -" exe "NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))' +" exe "NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."),''~''.expand(""))' if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) - exe s:netrw_silentxfer." NetrwKeepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) - else -" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer." NetrwKeepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1) +" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1),'~'.expand("")) + exe s:netrw_silentxfer." NetrwKeepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1)." ".s:ShellEscape(g:netrw_port,1) + else +" call Decho("exe ".s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1),'~'.expand("")) + exe s:netrw_silentxfer." NetrwKeepj ".w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." -i ".s:ShellEscape(g:netrw_machine,1) endif "......................................... @@ -9048,7 +9364,7 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) " handle userid and password let host= substitute(g:netrw_machine,'\..*$','','') -" call Decho("host<".host.">") +" call Decho("host<".host.">",'~'.expand("")) if exists("s:netrw_hup") && exists("s:netrw_hup[host]") call NetUserPass("ftp:".host) endif @@ -9068,7 +9384,7 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) endif if exists("g:netrw_ftpextracmd") NetrwKeepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('.')) +" call Decho("filter input: ".getline('.'),'~'.expand("")) endif NetrwKeepj call setline(line("$")+1,a:listcmd) @@ -9077,11 +9393,11 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) " -n unix : DON'T use <.netrc>, even though it exists " -n win32: quit being obnoxious about password if exists("w:netrw_bannercnt") -" exe w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."))' +" exe w:netrw_bannercnt.',$g/^./call Decho("ftp#".line(".").": ".getline("."),''~''.expand(""))' call s:NetrwExe(s:netrw_silentxfer.w:netrw_bannercnt.",$!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) " else " Decho -" call Decho("WARNING: w:netrw_bannercnt doesn't exist!") -" g/^./call Decho("SKIPPING ftp#".line(".").": ".getline(".")) +" call Decho("WARNING: w:netrw_bannercnt doesn't exist!",'~'.expand("")) +" g/^./call Decho("SKIPPING ftp#".line(".").": ".getline("."),'~'.expand("")) endif "......................................... @@ -9148,9 +9464,9 @@ fun! s:NetrwRemoteListing() " sanity check: if exists("b:netrw_method") && b:netrw_method =~ '[235]' -" call Decho("b:netrw_method=".b:netrw_method) +" call Decho("b:netrw_method=".b:netrw_method,'~'.expand("")) if !executable("ftp") -" call Decho("ftp is not executable") +" call Decho("ftp is not executable",'~'.expand("")) if !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ftp",18) endif @@ -9160,7 +9476,7 @@ fun! s:NetrwRemoteListing() endif elseif !exists("g:netrw_list_cmd") || g:netrw_list_cmd == '' -" call Decho("g:netrw_list_cmd<",(exists("g:netrw_list_cmd")? 'n/a' : "-empty-").">") +" call Decho("g:netrw_list_cmd<",(exists("g:netrw_list_cmd")? 'n/a' : "-empty-").">",'~'.expand("")) if !exists("g:netrw_quiet") if g:netrw_list_cmd == "" NetrwKeepj call netrw#ErrorMsg(s:ERROR,"your g:netrw_list_cmd is empty; perhaps ".g:netrw_ssh_cmd." is not executable on your system",47) @@ -9173,16 +9489,16 @@ fun! s:NetrwRemoteListing() " call Dret("s:NetrwRemoteListing -1") return -1 endif " (remote handling sanity check) -" call Decho("passed remote listing sanity checks") +" call Decho("passed remote listing sanity checks",'~'.expand("")) if exists("b:netrw_method") -" call Decho("setting w:netrw_method to b:netrw_method<".b:netrw_method.">") +" call Decho("setting w:netrw_method to b:netrw_method<".b:netrw_method.">",'~'.expand("")) let w:netrw_method= b:netrw_method endif if s:method == "ftp" " use ftp to get remote file listing {{{3 -" call Decho("use ftp to get remote file listing") +" call Decho("use ftp to get remote file listing",'~'.expand("")) let s:method = "ftp" let listcmd = g:netrw_ftp_list_cmd if g:netrw_sort_by =~ '^t' @@ -9190,9 +9506,9 @@ fun! s:NetrwRemoteListing() elseif g:netrw_sort_by =~ '^s' let listcmd= g:netrw_ftp_sizelist_cmd endif -" call Decho("listcmd<".listcmd."> (using g:netrw_ftp_list_cmd)") +" call Decho("listcmd<".listcmd."> (using g:netrw_ftp_list_cmd)",'~'.expand("")) call s:NetrwRemoteFtpCmd(s:path,listcmd) -" exe "sil! keepalt NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("raw listing: ".getline("."))' +" exe "sil! keepalt NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("raw listing: ".getline("."),''~''.expand(""))' " report on missing file or directory messages if search('[Nn]o such file or directory\|Failed to change directory') @@ -9210,7 +9526,7 @@ fun! s:NetrwRemoteListing() if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:WIDELIST || w:netrw_liststyle == s:TREELIST " shorten the listing -" call Decho("generate short listing") +" call Decho("generate short listing",'~'.expand("")) exe "sil! keepalt NetrwKeepj ".w:netrw_bannercnt " cleanup @@ -9225,21 +9541,21 @@ fun! s:NetrwRemoteListing() let line1= line(".") exe "sil! NetrwKeepj ".w:netrw_bannercnt let line2= search('\.\.\/\%(\s\|$\)','cnW') -" call Decho("search(".'\.\.\/\%(\s\|$\)'."','cnW')=".line2." w:netrw_bannercnt=".w:netrw_bannercnt) +" call Decho("search(".'\.\.\/\%(\s\|$\)'."','cnW')=".line2." w:netrw_bannercnt=".w:netrw_bannercnt,'~'.expand("")) if line2 == 0 -" call Decho("netrw is putting ../ into listing") +" call Decho("netrw is putting ../ into listing",'~'.expand("")) sil! NetrwKeepj put='../' endif exe "sil! NetrwKeepj ".line1 sil! NetrwKeepj norm! 0 -" call Decho("line1=".line1." line2=".line2." line(.)=".line(".")) +" call Decho("line1=".line1." line2=".line2." line(.)=".line("."),'~'.expand("")) if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup -" call Decho("M$ ftp cleanup") +" call Decho("M$ ftp cleanup",'~'.expand("")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(\|\d\+\)\s\+//' NetrwKeepj call histdel("/",-1) else " normal ftp cleanup -" call Decho("normal ftp cleanup") +" call Decho("normal ftp cleanup",'~'.expand("")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2/e' exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*/$#/#e' exe "sil! NetrwKeepj ".w:netrw_bannercnt.',$g/ -> /s# -> .*$#/#e' @@ -9251,12 +9567,12 @@ fun! s:NetrwRemoteListing() else " use ssh to get remote file listing {{{3 -" call Decho("use ssh to get remote file listing: s:path<".s:path.">") +" call Decho("use ssh to get remote file listing: s:path<".s:path.">",'~'.expand("")) let listcmd= s:MakeSshCmd(g:netrw_list_cmd) -" call Decho("listcmd<".listcmd."> (using g:netrw_list_cmd)") +" call Decho("listcmd<".listcmd."> (using g:netrw_list_cmd)",'~'.expand("")) if g:netrw_scp_cmd =~ '^pscp' -" call Decho("1: exe r! ".shellescape(listcmd.s:path, 1)) - exe "NetrwKeepj r! ".listcmd.shellescape(s:path, 1) +" call Decho("1: exe r! ".s:ShellEscape(listcmd.s:path, 1),'~'.expand("")) + exe "NetrwKeepj r! ".listcmd.s:ShellEscape(s:path, 1) " remove rubbish and adjust listing format of 'pscp' to 'ssh ls -FLa' like sil! NetrwKeepj g/^Listing directory/NetrwKeepj d sil! NetrwKeepj g/^d[-rwx][-rwx][-rwx]/NetrwKeepj s+$+/+e @@ -9270,18 +9586,18 @@ fun! s:NetrwRemoteListing() endif else if s:path == "" -" call Decho("2: exe r! ".listcmd) +" call Decho("2: exe r! ".listcmd,'~'.expand("")) exe "NetrwKeepj keepalt r! ".listcmd else -" call Decho("3: exe r! ".listcmd.' '.shellescape(fnameescape(s:path),1)) - exe "NetrwKeepj keepalt r! ".listcmd.' '.shellescape(fnameescape(s:path),1) -" call Decho("listcmd<".listcmd."> path<".s:path.">") +" call Decho("3: exe r! ".listcmd.' '.s:ShellEscape(fnameescape(s:path),1),'~'.expand("")) + exe "NetrwKeepj keepalt r! ".listcmd.' '.s:ShellEscape(fnameescape(s:path),1) +" call Decho("listcmd<".listcmd."> path<".s:path.">",'~'.expand("")) endif endif " cleanup if g:netrw_ssh_browse_reject != "" -" call Decho("cleanup: exe sil! g/".g:netrw_ssh_browse_reject."/NetrwKeepj d") +" call Decho("cleanup: exe sil! g/".g:netrw_ssh_browse_reject."/NetrwKeepj d",'~'.expand("")) exe "sil! g/".g:netrw_ssh_browse_reject."/NetrwKeepj d" NetrwKeepj call histdel("/",-1) endif @@ -9289,7 +9605,7 @@ fun! s:NetrwRemoteListing() if w:netrw_liststyle == s:LONGLIST " do a long listing; these substitutions need to be done prior to sorting {{{3 -" call Decho("fix long listing:") +" call Decho("fix long listing:",'~'.expand("")) if s:method == "ftp" " cleanup @@ -9312,12 +9628,12 @@ fun! s:NetrwRemoteListing() endif if search('^\d\{2}-\d\{2}-\d\{2}\s','n') " M$ ftp site cleanup -" call Decho("M$ ftp site listing cleanup") +" call Decho("M$ ftp site listing cleanup",'~'.expand("")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\d\{2}-\d\{2}-\d\{2}\s\+\d\+:\d\+[AaPp][Mm]\s\+\%(\|\d\+\)\s\+\)\(\w.*\)$/\2\t\1/' elseif exists("w:netrw_bannercnt") && w:netrw_bannercnt <= line("$") -" call Decho("normal ftp site listing cleanup: bannercnt=".w:netrw_bannercnt." line($)=".line("$")) +" call Decho("normal ftp site listing cleanup: bannercnt=".w:netrw_bannercnt." line($)=".line("$"),'~'.expand("")) exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/ -> .*$//e' - exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2\t\1/e' + exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$s/^\(\%(\S\+\s\+\)\{7}\S\+\)\s\+\(\S.*\)$/\2 \t\1/e' exe 'sil NetrwKeepj '.w:netrw_bannercnt NetrwKeepj call histdel("/",-1) NetrwKeepj call histdel("/",-1) @@ -9326,7 +9642,7 @@ fun! s:NetrwRemoteListing() endif " if exists("w:netrw_bannercnt") && w:netrw_bannercnt <= line("$") " Decho -" exe "NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("listing: ".getline("."))' +" exe "NetrwKeepj ".w:netrw_bannercnt.',$g/^./call Decho("listing: ".getline("."),''~''.expand(""))' " endif " Decho " call Dret("s:NetrwRemoteListing 0") @@ -9337,13 +9653,13 @@ endfun " s:NetrwRemoteRm: remove/delete a remote file or directory {{{2 fun! s:NetrwRemoteRm(usrhost,path) range " call Dfunc("s:NetrwRemoteRm(usrhost<".a:usrhost."> path<".a:path.">) virtcol=".virtcol(".")) -" call Decho("firstline=".a:firstline." lastline=".a:lastline) +" call Decho("firstline=".a:firstline." lastline=".a:lastline,'~'.expand("")) let svpos= netrw#SavePosn() let all= 0 if exists("s:netrwmarkfilelist_{bufnr('%')}") " remove all marked files -" call Decho("remove all marked files with bufnr#".bufnr("%")) +" call Decho("remove all marked files with bufnr#".bufnr("%"),'~'.expand("")) for fname in s:netrwmarkfilelist_{bufnr("%")} let ok= s:NetrwRemoteRmFile(a:path,fname,all) if ok =~ 'q\%[uit]' @@ -9356,10 +9672,12 @@ fun! s:NetrwRemoteRm(usrhost,path) range else " remove files specified by range -" call Decho("remove files specified by range") +" call Decho("remove files specified by range",'~'.expand("")) " preparation for removing multiple files/directories - let ctr= a:firstline + let keepsol = &l:sol + setl nosol + let ctr = a:firstline " remove multiple files and directories while ctr <= a:lastline @@ -9372,10 +9690,11 @@ fun! s:NetrwRemoteRm(usrhost,path) range endif let ctr= ctr + 1 endwhile + let &l:sol = keepsol endif " refresh the (remote) directory listing -" call Decho("refresh remote directory listing") +" call Decho("refresh remote directory listing",'~'.expand("")) NetrwKeepj call s:NetrwRefresh(0,s:NetrwBrowseChgDir(0,'./')) NetrwKeepj call netrw#RestorePosn(svpos) @@ -9392,10 +9711,10 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all if a:rmfile !~ '^"' && (a:rmfile =~ '@$' || a:rmfile !~ '[\/]$') " attempt to remove file -" call Decho("attempt to remove file (all=".all.")") +" call Decho("attempt to remove file (all=".all.")",'~'.expand("")) if !all echohl Statement -" call Decho("case all=0:") +" call Decho("case all=0:",'~'.expand("")) call inputsave() let ok= input("Confirm deletion of file<".a:rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") call inputrestore() @@ -9410,47 +9729,53 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all endif if all || ok =~ 'y\%[es]' || ok == "" -" call Decho("case all=".all." or ok<".ok.">".(exists("w:netrw_method")? ': netrw_method='.w:netrw_method : "")) +" call Decho("case all=".all." or ok<".ok.">".(exists("w:netrw_method")? ': netrw_method='.w:netrw_method : ""),'~'.expand("")) if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) -" call Decho("case ftp:") +" call Decho("case ftp:",'~'.expand("")) let path= a:path - if path =~ '^\a\+://' - let path= substitute(path,'^\a\+://[^/]\+/','','') + if path =~ '^\a\{3,}://' + let path= substitute(path,'^\a\{3,}://[^/]\+/','','') endif sil! NetrwKeepj .,$d call s:NetrwRemoteFtpCmd(path,"delete ".'"'.a:rmfile.'"') else -" call Decho("case ssh: g:netrw_rm_cmd<".g:netrw_rm_cmd.">") +" call Decho("case ssh: g:netrw_rm_cmd<".g:netrw_rm_cmd.">",'~'.expand("")) let netrw_rm_cmd= s:MakeSshCmd(g:netrw_rm_cmd) -" call Decho("netrw_rm_cmd<".netrw_rm_cmd.">") +" call Decho("netrw_rm_cmd<".netrw_rm_cmd.">",'~'.expand("")) if !exists("b:netrw_curdir") NetrwKeepj call netrw#ErrorMsg(s:ERROR,"for some reason b:netrw_curdir doesn't exist!",53) let ok="q" else let remotedir= substitute(b:netrw_curdir,'^.*//[^/]\+/\(.*\)$','\1','') -" call Decho("netrw_rm_cmd<".netrw_rm_cmd.">") -" call Decho("remotedir<".remotedir.">") -" call Decho("rmfile<".a:rmfile.">") +" call Decho("netrw_rm_cmd<".netrw_rm_cmd.">",'~'.expand("")) +" call Decho("remotedir<".remotedir.">",'~'.expand("")) +" call Decho("rmfile<".a:rmfile.">",'~'.expand("")) if remotedir != "" - let netrw_rm_cmd= netrw_rm_cmd." ".shellescape(fnameescape(remotedir.a:rmfile)) + let netrw_rm_cmd= netrw_rm_cmd." ".s:ShellEscape(fnameescape(remotedir.a:rmfile)) else - let netrw_rm_cmd= netrw_rm_cmd." ".shellescape(fnameescape(a:rmfile)) + let netrw_rm_cmd= netrw_rm_cmd." ".s:ShellEscape(fnameescape(a:rmfile)) endif -" call Decho("call system(".netrw_rm_cmd.")") +" call Decho("call system(".netrw_rm_cmd.")",'~'.expand("")) let ret= system(netrw_rm_cmd) - if ret != 0 - NetrwKeepj call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) + if v:shell_error != 0 + if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir + call netrw#ErrorMsg(s:ERROR,"remove failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-c)",102) + else + call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) + endif + else if ret != 0 + call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) endif -" call Decho("returned=".ret." errcode=".v:shell_error) +" call Decho("returned=".ret." errcode=".v:shell_error,'~'.expand("")) endif endif elseif ok =~ 'q\%[uit]' -" call Decho("ok==".ok) +" call Decho("ok==".ok,'~'.expand("")) endif else " attempt to remove directory -" call Decho("attempt to remove directory") +" call Decho("attempt to remove directory",'~'.expand("")) if !all call inputsave() let ok= input("Confirm deletion of directory<".a:rmfile."> ","[{y(es)},n(o),a(ll),q(uit)] ") @@ -9469,17 +9794,17 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all NetrwKeepj call s:NetrwRemoteFtpCmd(a:path,"rmdir ".a:rmfile) else let rmfile = substitute(a:path.a:rmfile,'/$','','') - let netrw_rmdir_cmd = s:MakeSshCmd(netrw#WinPath(g:netrw_rmdir_cmd)).' '.shellescape(netrw#WinPath(rmfile)) -" call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")") + let netrw_rmdir_cmd = s:MakeSshCmd(netrw#WinPath(g:netrw_rmdir_cmd)).' '.s:ShellEscape(netrw#WinPath(rmfile)) +" call Decho("attempt to remove dir: system(".netrw_rmdir_cmd.")",'~'.expand("")) let ret= system(netrw_rmdir_cmd) -" call Decho("returned=".ret." errcode=".v:shell_error) +" call Decho("returned=".ret." errcode=".v:shell_error,'~'.expand("")) if v:shell_error != 0 -" call Decho("v:shell_error not 0") - let netrw_rmf_cmd= s:MakeSshCmd(netrw#WinPath(g:netrw_rmf_cmd)).' '.shellescape(netrw#WinPath(substitute(rmfile,'[\/]$','','e'))) -" call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")") +" call Decho("v:shell_error not 0",'~'.expand("")) + let netrw_rmf_cmd= s:MakeSshCmd(netrw#WinPath(g:netrw_rmf_cmd)).' '.s:ShellEscape(netrw#WinPath(substitute(rmfile,'[\/]$','','e'))) +" call Decho("2nd attempt to remove dir: system(".netrw_rmf_cmd.")",'~'.expand("")) let ret= system(netrw_rmf_cmd) -" call Decho("returned=".ret." errcode=".v:shell_error) +" call Decho("returned=".ret." errcode=".v:shell_error,'~'.expand("")) if v:shell_error != 0 && !exists("g:netrw_quiet") NetrwKeepj call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",22) @@ -9488,7 +9813,7 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all endif elseif ok =~ 'q\%[uit]' -" call Decho("ok==".ok) +" call Decho("ok==".ok,'~'.expand("")) endif endif @@ -9509,10 +9834,10 @@ fun! s:NetrwRemoteRename(usrhost,path) r " rename files given by the markfilelist if exists("s:netrwmarkfilelist_{bufnr('%')}") for oldname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("oldname<".oldname.">") +" call Decho("oldname<".oldname.">",'~'.expand("")) if exists("subfrom") let newname= substitute(oldname,subfrom,subto,'') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") +" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("")) else call inputsave() let newname= input("Moving ".oldname." to : ",oldname) @@ -9521,16 +9846,16 @@ fun! s:NetrwRemoteRename(usrhost,path) r let subfrom = substitute(newname,'^s/\([^/]*\)/.*/$','\1','') let subto = substitute(newname,'^s/[^/]*/\(.*\)/$','\1','') let newname = substitute(oldname,subfrom,subto,'') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") - endif - endif - +" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("")) + endif + endif + if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) NetrwKeepj call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname) else - let oldname= shellescape(a:path.oldname) - let newname= shellescape(a:path.newname) -" call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")") + let oldname= s:ShellEscape(a:path.oldname) + let newname= s:ShellEscape(a:path.newname) +" call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")",'~'.expand("")) let ret = system(netrw#WinPath(rename_cmd).' '.oldname.' '.newname) endif @@ -9540,11 +9865,13 @@ fun! s:NetrwRemoteRename(usrhost,path) r else " attempt to rename files/directories + let keepsol= &l:sol + setl nosol while ctr <= a:lastline exe "NetrwKeepj ".ctr let oldname= s:NetrwGetWord() -" call Decho("oldname<".oldname.">") +" call Decho("oldname<".oldname.">",'~'.expand("")) call inputsave() let newname= input("Moving ".oldname." to : ",oldname) @@ -9553,14 +9880,15 @@ fun! s:NetrwRemoteRename(usrhost,path) r if exists("w:netrw_method") && (w:netrw_method == 2 || w:netrw_method == 3) call s:NetrwRemoteFtpCmd(a:path,"rename ".oldname." ".newname) else - let oldname= shellescape(a:path.oldname) - let newname= shellescape(a:path.newname) -" call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")") + let oldname= s:ShellEscape(a:path.oldname) + let newname= s:ShellEscape(a:path.newname) +" call Decho("system(netrw#WinPath(".rename_cmd.") ".oldname.' '.newname.")",'~'.expand("")) let ret = system(netrw#WinPath(rename_cmd).' '.oldname.' '.newname) endif let ctr= ctr + 1 endwhile + let &l:sol= keepsol endif " refresh the directory @@ -9589,37 +9917,37 @@ fun! netrw#FileUrlRead(fname) " call Dfunc("netrw#FileUrlRead(fname<".a:fname.">)") let fname = a:fname if fname =~ '^file://localhost/' -" call Decho('converting file://localhost/ -to- file:///') +" call Decho('converting file://localhost/ -to- file:///','~'.expand("")) let fname= substitute(fname,'^file://localhost/','file:///','') -" call Decho("fname<".fname.">") +" call Decho("fname<".fname.">",'~'.expand("")) endif if (has("win32") || has("win95") || has("win64") || has("win16")) if fname =~ '^file:///\=\a[|:]/' -" call Decho('converting file:///\a|/ -to- file://\a:/') +" call Decho('converting file:///\a|/ -to- file://\a:/','~'.expand("")) let fname = substitute(fname,'^file:///\=\(\a\)[|:]/','file://\1:/','') -" call Decho("fname<".fname.">") +" call Decho("fname<".fname.">",'~'.expand("")) endif endif let fname2396 = netrw#RFC2396(fname) let fname2396e= fnameescape(fname2396) let plainfname= substitute(fname2396,'file://\(.*\)','\1',"") if (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("windows exception for plainfname") +" call Decho("windows exception for plainfname",'~'.expand("")) if plainfname =~ '^/\+\a:' -" call Decho('removing leading "/"s') +" call Decho('removing leading "/"s','~'.expand("")) let plainfname= substitute(plainfname,'^/\+\(\a:\)','\1','') endif endif -" call Decho("fname2396<".fname2396.">") -" call Decho("plainfname<".plainfname.">") +" call Decho("fname2396<".fname2396.">",'~'.expand("")) +" call Decho("plainfname<".plainfname.">",'~'.expand("")) exe "sil doau BufReadPre ".fname2396e exe 'NetrwKeepj r '.plainfname exe 'sil! bdelete '.plainfname exe 'keepalt file! '.plainfname NetrwKeepj 1d -" call Decho("setl nomod") +" call Decho("setl nomod",'~'.expand("")) setl nomod -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) " call Dret("netrw#FileUrlRead") exe "sil doau BufReadPost ".fname2396e endfun @@ -9627,6 +9955,7 @@ endfun " --------------------------------------------------------------------- " netrw#LocalBrowseCheck: {{{2 fun! netrw#LocalBrowseCheck(dirname) + " This function is called by netrwPlugin.vim's s:LocalBrowse() and by s:NetrwRexplore() " unfortunate interaction -- split window debugging can't be " used here, must use D-echoRemOn or D-echoTabOn -- the BufEnter " event triggers another call to LocalBrowseCheck() when attempts @@ -9635,33 +9964,32 @@ fun! netrw#LocalBrowseCheck(dirname) " would hit when re-entering netrw windows, creating unexpected " refreshes (and would do so in the middle of NetrwSaveOptions(), too) " call Dfunc("netrw#LocalBrowseCheck(dirname<".a:dirname.">") -" call Decho("isdir<".a:dirname.">=".isdirectory(a:dirname).((exists("s:treeforceredraw")? " treeforceredraw" : ""))) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("isdir<".a:dirname.">=".isdirectory(s:NetrwFile(a:dirname)).((exists("s:treeforceredraw")? " treeforceredraw" : "")).expand("")) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) " call Dredir("ls!","ls!") - norm! m` +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) +" call Decho("current buffer#".bufnr("%")."<".bufname("%")."> ft=".&ft,'~'.expand("")) let ykeep= @@ - if isdirectory(a:dirname) -" call Decho("is-directory ft<".&ft."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : " doesn't exist")."> dirname<".a:dirname.">"." line($)=".line("$")." ft<".&ft."> g:netrw_fastbrowse=".g:netrw_fastbrowse) - let svposn= netrw#SavePosn() + if isdirectory(s:NetrwFile(a:dirname)) +" call Decho("is-directory ft<".&ft."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : " doesn't exist")."> dirname<".a:dirname.">"." line($)=".line("$")." ft<".&ft."> g:netrw_fastbrowse=".g:netrw_fastbrowse,'~'.expand("")) if &ft != "netrw" || (exists("b:netrw_curdir") && b:netrw_curdir != a:dirname) || g:netrw_fastbrowse <= 1 -" call Decho("case 1 : ft=".&ft) +" call Decho("case 1 : ft=".&ft,'~'.expand("")) +" call Decho("s:rexposn_".bufnr("%")."<".bufname("%")."> ".(exists("s:rexposn_".bufnr("%"))? "exists" : "does not exist"),'~'.expand("")) sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname) - NetrwKeepj keepalt call netrw#RestorePosn(svposn) elseif &ft == "netrw" && line("$") == 1 -" call Decho("case 2 (ft≡netrw && line($)≡1)") +" call Decho("case 2 (ft≡netrw && line($)≡1)",'~'.expand("")) sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname) - NetrwKeepj keepalt call netrw#RestorePosn(svposn) elseif exists("s:treeforceredraw") -" call Decho("case 3 (treeforceredraw)") +" call Decho("case 3 (treeforceredraw)",'~'.expand("")) unlet s:treeforceredraw sil! NetrwKeepj keepalt call s:NetrwBrowse(1,a:dirname) - NetrwKeepj keepalt call netrw#RestorePosn(svposn) - endif - + endif + +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) " call Dret("netrw#LocalBrowseCheck") return endif @@ -9670,18 +9998,19 @@ fun! netrw#LocalBrowseCheck(dirname) " IF g:netrw_fastbrowse is zero (ie. slow browsing selected) " AND IF the listing style is not a tree listing if exists("g:netrw_fastbrowse") && g:netrw_fastbrowse == 0 && g:netrw_liststyle != s:TREELIST -" call Decho("wiping out currently unused netrw buffers") +" call Decho("wiping out currently unused netrw buffers",'~'.expand("")) let ibuf = 1 let buflast = bufnr("$") while ibuf <= buflast - if bufwinnr(ibuf) == -1 && isdirectory(bufname(ibuf)) - exe "sil! keepalt ".ibuf."bw!" + if bufwinnr(ibuf) == -1 && isdirectory(s:NetrwFile(bufname(ibuf))) + exe "sil! keepj keepalt ".ibuf."bw!" endif let ibuf= ibuf + 1 endwhile endif let @@= ykeep -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) " not a directory, ignore it " call Dret("netrw#LocalBrowseCheck : not a directory, ignoring it; dirname<".a:dirname.">") endfun @@ -9693,8 +10022,8 @@ endfun " on the chance that s/he removed/created a file/directory with it. fun! s:LocalBrowseRefresh() " call Dfunc("s:LocalBrowseRefresh() tabpagenr($)=".tabpagenr("$")) -" call Decho("s:netrw_browselist =".(exists("s:netrw_browselist")? string(s:netrw_browselist) : '')) -" call Decho("w:netrw_bannercnt =".(exists("w:netrw_bannercnt")? string(w:netrw_bannercnt) : '')) +" call Decho("s:netrw_browselist =".(exists("s:netrw_browselist")? string(s:netrw_browselist) : ''),'~'.expand("")) +" call Decho("w:netrw_bannercnt =".(exists("w:netrw_bannercnt")? string(w:netrw_bannercnt) : ''),'~'.expand("")) " determine which buffers currently reside in a tab if !exists("s:netrw_browselist") @@ -9719,36 +10048,38 @@ fun! s:LocalBrowseRefresh() let itab = itab + 1 tabn endwhile -" call Decho("buftablist".string(buftablist)) -" call Decho("s:netrw_browselist<".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "").">") +" call Decho("buftablist".string(buftablist),'~'.expand("")) +" call Decho("s:netrw_browselist<".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "").">",'~'.expand("")) " GO through all buffers on netrw_browselist (ie. just local-netrw buffers): " | refresh any netrw window " | wipe out any non-displaying netrw buffer let curwin = winnr() let ibl = 0 for ibuf in s:netrw_browselist -" call Decho("bufwinnr(".ibuf.") index(buftablist,".ibuf.")=".index(buftablist,ibuf)) +" call Decho("bufwinnr(".ibuf.") index(buftablist,".ibuf.")=".index(buftablist,ibuf),'~'.expand("")) if bufwinnr(ibuf) == -1 && index(buftablist,ibuf) == -1 " wipe out any non-displaying netrw buffer -" call Decho("wiping buf#".ibuf,"<".bufname(ibuf).">") - exe "sil! bd ".fnameescape(ibuf) +" call Decho("wiping buf#".ibuf,"<".bufname(ibuf).">",'~'.expand("")) + exe "sil! keepj bd ".fnameescape(ibuf) call remove(s:netrw_browselist,ibl) -" call Decho("browselist=".string(s:netrw_browselist)) +" call Decho("browselist=".string(s:netrw_browselist),'~'.expand("")) continue elseif index(tabpagebuflist(),ibuf) != -1 " refresh any netrw buffer -" call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf)) +" call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf),'~'.expand("")) exe bufwinnr(ibuf)."wincmd w" if getline(".") =~ 'Quick Help' " decrement g:netrw_quickhelp to prevent refresh from changing g:netrw_quickhelp " (counteracts s:NetrwBrowseChgDir()'s incrementing) let g:netrw_quickhelp= g:netrw_quickhelp - 1 endif -" call Decho("#3: quickhelp=".g:netrw_quickhelp) +" call Decho("#3: quickhelp=".g:netrw_quickhelp,'~'.expand("")) NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) endif let ibl= ibl + 1 +" call Decho("bottom of s:netrw_browselist for loop: ibl=".ibl,'~'.expand("")) endfor +" call Decho("restore window: exe ".curwin."wincmd w",'~'.expand("")) exe curwin."wincmd w" let @@= ykeep @@ -9759,10 +10090,10 @@ endfun " s:LocalFastBrowser: handles setting up/taking down fast browsing for the local browser {{{2 " " g:netrw_ Directory Is -" fastbrowse Local Remote +" fastbrowse Local Remote " slow 0 D D D=Deleting a buffer implies it will not be re-used (slow) " med 1 D H H=Hiding a buffer implies it may be re-used (fast) -" fast 2 H H +" fast 2 H H " " Deleting a buffer means that it will be re-loaded when examined, hence "slow". " Hiding a buffer means that it will be re-used when examined, hence "fast". @@ -9775,21 +10106,21 @@ endfun " =2: autocmds installed (doesn't ignore any FocusGained events) fun! s:LocalFastBrowser() " call Dfunc("LocalFastBrowser() g:netrw_fastbrowse=".g:netrw_fastbrowse) -" call Decho("s:netrw_events ".(exists("s:netrw_events")? "exists" : 'n/a')) -" call Decho("autocmd: ShellCmdPost ".(exists("#ShellCmdPost")? "installed" : "not installed")) -" call Decho("autocmd: FocusGained ".(exists("#FocusGained")? "installed" : "not installed")) +" call Decho("s:netrw_events ".(exists("s:netrw_events")? "exists" : 'n/a'),'~'.expand("")) +" call Decho("autocmd: ShellCmdPost ".(exists("#ShellCmdPost")? "installed" : "not installed"),'~'.expand("")) +" call Decho("autocmd: FocusGained ".(exists("#FocusGained")? "installed" : "not installed"),'~'.expand("")) " initialize browselist, a list of buffer numbers that the local browser has used if !exists("s:netrw_browselist") -" call Decho("initialize s:netrw_browselist") +" call Decho("initialize s:netrw_browselist",'~'.expand("")) let s:netrw_browselist= [] endif " append current buffer to fastbrowse list if empty(s:netrw_browselist) || bufnr("%") > s:netrw_browselist[-1] -" call Decho("appendng current buffer to browselist") +" call Decho("appendng current buffer to browselist",'~'.expand("")) call add(s:netrw_browselist,bufnr("%")) -" call Decho("browselist=".string(s:netrw_browselist)) +" call Decho("browselist=".string(s:netrw_browselist),'~'.expand("")) endif " enable autocmd events to handle refreshing/removing local browser buffers @@ -9803,10 +10134,10 @@ fun! s:LocalFastBrowser() augroup AuNetrwEvent au! if (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("installing autocmd: ShellCmdPost") +" call Decho("installing autocmd: ShellCmdPost",'~'.expand("")) au ShellCmdPost * call s:LocalBrowseRefresh() else -" call Decho("installing autocmds: ShellCmdPost FocusGained") +" call Decho("installing autocmds: ShellCmdPost FocusGained",'~'.expand("")) au ShellCmdPost,FocusGained * call s:LocalBrowseRefresh() endif augroup END @@ -9814,7 +10145,7 @@ fun! s:LocalFastBrowser() " user must have changed fastbrowse to its fast setting, so remove " the associated autocmd events elseif g:netrw_fastbrowse > 1 && exists("#ShellCmdPost") && exists("s:netrw_events") -" call Decho("remove AuNetrwEvent autcmd group") +" call Decho("remove AuNetrwEvent autcmd group",'~'.expand("")) unlet s:netrw_events augroup AuNetrwEvent au! @@ -9829,70 +10160,78 @@ endfun " s:LocalListing: does the job of "ls" for local directories {{{2 fun! s:LocalListing() " call Dfunc("s:LocalListing()") -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) - -" if exists("b:netrw_curdir") |call Decho('b:netrw_curdir<'.b:netrw_curdir.">") |else|call Decho("b:netrw_curdir doesn't exist") |endif -" 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 -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) +" call Decho("modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("")) +" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) + +" if exists("b:netrw_curdir") |call Decho('b:netrw_curdir<'.b:netrw_curdir.">") |else|call Decho("b:netrw_curdir doesn't exist",'~'.expand("")) |endif +" 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",'~'.expand(""))|endif +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) " get the list of files contained in the current directory let dirname = b:netrw_curdir let dirnamelen = strlen(b:netrw_curdir) - let filelist = glob(s:ComposePath(dirname,"*"),0,1) - let filelist = filelist + glob(s:ComposePath(dirname,".*"),0,1) -" call Decho("filelist=".string(filelist)) + if v:version == 704 && has("patch656") +" call Decho("using glob with patch656",'~'.expand("")) + let filelist = glob(s:ComposePath(dirname,"*"),0,1,1) + let filelist = filelist + glob(s:ComposePath(dirname,".*"),0,1,1) + else +" call Decho("using glob without patch656",'~'.expand("")) + let filelist = glob(s:ComposePath(dirname,"*"),0,1) + let filelist = filelist + glob(s:ComposePath(dirname,".*"),0,1) + endif +" call Decho("filelist=".string(filelist),'~'.expand("")) if g:netrw_cygwin == 0 && (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("filelist=".string(filelist)) +" call Decho("filelist=".string(filelist),'~'.expand("")) elseif index(filelist,'..') == -1 && b:netrw_curdir !~ '/' " include ../ in the glob() entry if its missing -" call Decho("forcibly including on \"..\"") +" call Decho("forcibly including on \"..\"",'~'.expand("")) let filelist= filelist+[s:ComposePath(b:netrw_curdir,"../")] -" call Decho("filelist=".string(filelist)) - endif - -" call Decho("before while: dirname<".dirname.">") -" call Decho("before while: dirnamelen<".dirnamelen.">") -" call Decho("before while: filelist=".string(filelist)) +" call Decho("filelist=".string(filelist),'~'.expand("")) + endif + +" call Decho("before while: dirname<".dirname.">",'~'.expand("")) +" call Decho("before while: dirnamelen<".dirnamelen.">",'~'.expand("")) +" call Decho("before while: filelist=".string(filelist),'~'.expand("")) if get(g:, 'netrw_dynamic_maxfilenamelen', 0) let filelistcopy = map(deepcopy(filelist),'fnamemodify(v:val, ":t")') let g:netrw_maxfilenamelen = max(map(filelistcopy,'len(v:val)')) + 1 -" call Decho("dynamic_maxfilenamelen: filenames =".string(filelistcopy)) -" call Decho("dynamic_maxfilenamelen: g:netrw_maxfilenamelen=".g:netrw_maxfilenamelen) - endif -" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")") +" call Decho("dynamic_maxfilenamelen: filenames =".string(filelistcopy),'~'.expand("")) +" call Decho("dynamic_maxfilenamelen: g:netrw_maxfilenamelen=".g:netrw_maxfilenamelen,'~'.expand("")) + endif +" call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) for filename in filelist -" call Decho(" ") -" call Decho("for filename in filelist: filename<".filename.">") +" call Decho(" ",'~'.expand("")) +" call Decho("for filename in filelist: filename<".filename.">",'~'.expand("")) if getftype(filename) == "link" " indicate a symbolic link -" call Decho("indicate <".filename."> is a symbolic link with trailing @") +" call Decho("indicate <".filename."> is a symbolic link with trailing @",'~'.expand("")) let pfile= filename."@" elseif getftype(filename) == "socket" " indicate a socket -" call Decho("indicate <".filename."> is a socket with trailing =") +" call Decho("indicate <".filename."> is a socket with trailing =",'~'.expand("")) let pfile= filename."=" elseif getftype(filename) == "fifo" " indicate a fifo -" call Decho("indicate <".filename."> is a fifo with trailing |") +" call Decho("indicate <".filename."> is a fifo with trailing |",'~'.expand("")) let pfile= filename."|" - elseif isdirectory(filename) + elseif isdirectory(s:NetrwFile(filename)) " indicate a directory -" call Decho("indicate <".filename."> is a directory with trailing /") +" call Decho("indicate <".filename."> is a directory with trailing /",'~'.expand("")) let pfile= filename."/" - elseif exists("b:netrw_curdir") && b:netrw_curdir !~ '^.*://' && !isdirectory(filename) + elseif exists("b:netrw_curdir") && b:netrw_curdir !~ '^.*://' && !isdirectory(s:NetrwFile(filename)) if (has("win32") || has("win95") || has("win64") || has("win16")) if filename =~ '\.[eE][xX][eE]$' || filename =~ '\.[cC][oO][mM]$' || filename =~ '\.[bB][aA][tT]$' " indicate an executable -" call Decho("indicate <".filename."> is executable with trailing *") +" call Decho("indicate <".filename."> is executable with trailing *",'~'.expand("")) let pfile= filename."*" else " normal file @@ -9900,7 +10239,7 @@ fun! s:LocalListing() endif elseif executable(filename) " indicate an executable -" call Decho("indicate <".filename."> is executable with trailing *") +" call Decho("indicate <".filename."> is executable with trailing *",'~'.expand("")) let pfile= filename."*" else " normal file @@ -9911,45 +10250,45 @@ fun! s:LocalListing() " normal file let pfile= filename endif -" call Decho("pfile<".pfile."> (after *@/ appending)") +" call Decho("pfile<".pfile."> (after *@/ appending)",'~'.expand("")) if pfile =~ '//$' let pfile= substitute(pfile,'//$','/','e') -" call Decho("change // to /: pfile<".pfile.">") +" call Decho("change // to /: pfile<".pfile.">",'~'.expand("")) endif let pfile= strpart(pfile,dirnamelen) let pfile= substitute(pfile,'^[/\\]','','e') -" call Decho("filename<".filename.">") -" call Decho("pfile <".pfile.">") +" call Decho("filename<".filename.">",'~'.expand("")) +" call Decho("pfile <".pfile.">",'~'.expand("")) if w:netrw_liststyle == s:LONGLIST let sz = getfsize(filename) let fsz = strpart(" ",1,15-strlen(sz)).sz let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename)) -" call Decho("sz=".sz." fsz=".fsz) +" call Decho("sz=".sz." fsz=".fsz,'~'.expand("")) endif if g:netrw_sort_by =~ "^t" " sort by time (handles time up to 1 quintillion seconds, US) -" call Decho("getftime(".filename.")=".getftime(filename)) +" call Decho("getftime(".filename.")=".getftime(filename),'~'.expand("")) let t = getftime(filename) let ft = strpart("000000000000000000",1,18-strlen(t)).t -" call Decho("exe NetrwKeepj put ='".ft.'/'.filename."'") +" call Decho("exe NetrwKeepj put ='".ft.'/'.filename."'",'~'.expand("")) let ftpfile= ft.'/'.pfile sil! NetrwKeepj put=ftpfile elseif g:netrw_sort_by =~ "^s" " sort by size (handles file sizes up to 1 quintillion bytes, US) -" call Decho("getfsize(".filename.")=".getfsize(filename)) +" call Decho("getfsize(".filename.")=".getfsize(filename),'~'.expand("")) let sz = getfsize(filename) let fsz = strpart("000000000000000000",1,18-strlen(sz)).sz -" call Decho("exe NetrwKeepj put ='".fsz.'/'.filename."'") +" call Decho("exe NetrwKeepj put ='".fsz.'/'.filename."'",'~'.expand("")) let fszpfile= fsz.'/'.pfile sil! NetrwKeepj put =fszpfile else " sort by name -" call Decho("exe NetrwKeepj put ='".pfile."'") +" call Decho("exe NetrwKeepj put ='".pfile."'",'~'.expand("")) sil! NetrwKeepj put=pfile endif endfor @@ -9958,7 +10297,7 @@ fun! s:LocalListing() sil! NetrwKeepj g/^$/d sil! NetrwKeepj %s/\r$//e call histdel("/",-1) -" call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1)) +" call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("")) exe "setl ts=".(g:netrw_maxfilenamelen+1) " call Dret("s:LocalListing") @@ -9978,9 +10317,9 @@ fun! s:NetrwLocalExecute(cmd) endif let optargs= input(":!".a:cmd,"","file") -" call Decho("optargs<".optargs.">") +" call Decho("optargs<".optargs.">",'~'.expand("")) let result= system(a:cmd.optargs) -" call Decho("result) +" call Decho("result,'~'.expand("")) " strip any ansi escape sequences off let result = substitute(result,"\e\\[[0-9;]*m","","g") @@ -9998,32 +10337,39 @@ fun! s:NetrwLocalRename(path) range " call Dfunc("NetrwLocalRename(path<".a:path.">)") " preparation for removing multiple files/directories - let ykeep = @@ - let ctr = a:firstline - let svpos = netrw#SavePosn() + let ykeep = @@ + let ctr = a:firstline + let svpos = netrw#SavePosn() " rename files given by the markfilelist if exists("s:netrwmarkfilelist_{bufnr('%')}") for oldname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("oldname<".oldname.">") +" call Decho("oldname<".oldname.">",'~'.expand("")) if exists("subfrom") let newname= substitute(oldname,subfrom,subto,'') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") +" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("")) else call inputsave() - let newname= input("Moving ".oldname." to : ",oldname) + let newname= input("Moving ".oldname." to : ",oldname,"file") call inputrestore() + if newname =~ '' + " two ctrl-x's : ignore all of string preceding the ctrl-x's + let newname = substitute(newname,'^.*','','') + elseif newname =~ '' + " one ctrl-x : ignore portion of string preceding ctrl-x but after last / + let newname = substitute(newname,'[^/]*','','') + endif if newname =~ '^s/' let subfrom = substitute(newname,'^s/\([^/]*\)/.*/$','\1','') let subto = substitute(newname,'^s/[^/]*/\(.*\)/$','\1','') -" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">") +" call Decho("subfrom<".subfrom."> subto<".subto."> newname<".newname.">",'~'.expand("")) let newname = substitute(oldname,subfrom,subto,'') endif endif call rename(oldname,newname) endfor call s:NetrwUnmarkList(bufnr("%"),b:netrw_curdir) - + else " attempt to rename files/directories @@ -10043,21 +10389,21 @@ fun! s:NetrwLocalRename(path) range NetrwKeepj norm! 0 let oldname= s:ComposePath(a:path,curword) -" call Decho("oldname<".oldname.">") +" call Decho("oldname<".oldname.">",'~'.expand("")) call inputsave() let newname= input("Moving ".oldname." to : ",substitute(oldname,'/*$','','e')) call inputrestore() call rename(oldname,newname) -" call Decho("renaming <".oldname."> to <".newname.">") +" call Decho("renaming <".oldname."> to <".newname.">",'~'.expand("")) let ctr= ctr + 1 endwhile endif " refresh the directory -" call Decho("refresh the directory listing") +" call Decho("refresh the directory listing",'~'.expand("")) NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) NetrwKeepj call netrw#RestorePosn(svpos) let @@= ykeep @@ -10069,7 +10415,7 @@ endfun " s:NetrwLocalRm: {{{2 fun! s:NetrwLocalRm(path) range " call Dfunc("s:NetrwLocalRm(path<".a:path.">)") -" call Decho("firstline=".a:firstline." lastline=".a:lastline) +" call Decho("firstline=".a:firstline." lastline=".a:lastline,'~'.expand("")) " preparation for removing multiple files/directories let ykeep = @@ @@ -10079,7 +10425,7 @@ fun! s:NetrwLocalRm(path) range if exists("s:netrwmarkfilelist_{bufnr('%')}") " remove all marked files -" call Decho("remove all marked files") +" call Decho("remove all marked files",'~'.expand("")) for fname in s:netrwmarkfilelist_{bufnr("%")} let ok= s:NetrwLocalRmFile(a:path,fname,all) if ok =~ 'q\%[uit]' || ok == "no" @@ -10092,8 +10438,10 @@ fun! s:NetrwLocalRm(path) range else " remove (multiple) files and directories -" call Decho("remove files in range [".a:firstline.",".a:lastline."]") - +" call Decho("remove files in range [".a:firstline.",".a:lastline."]",'~'.expand("")) + + let keepsol= &l:sol + setl nosol let ctr = a:firstline while ctr <= a:lastline exe "NetrwKeepj ".ctr @@ -10116,10 +10464,11 @@ fun! s:NetrwLocalRm(path) range endif let ctr= ctr + 1 endwhile + let &l:sol= keepsol endif " refresh the directory -" call Decho("bufname<".bufname("%").">") +" call Decho("bufname<".bufname("%").">",'~'.expand("")) if bufname("%") != "NetrwMessage" NetrwKeepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) NetrwKeepj call netrw#RestorePosn(svpos) @@ -10134,16 +10483,16 @@ endfun " Give confirmation prompt unless all==1 fun! s:NetrwLocalRmFile(path,fname,all) " call Dfunc("s:NetrwLocalRmFile(path<".a:path."> fname<".a:fname."> all=".a:all) - + let all= a:all let ok = "" NetrwKeepj norm! 0 - let rmfile= s:ComposePath(a:path,a:fname) -" call Decho("rmfile<".rmfile.">") + let rmfile= s:NetrwFile(s:ComposePath(a:path,a:fname)) +" call Decho("rmfile<".rmfile.">",'~'.expand("")) if rmfile !~ '^"' && (rmfile =~ '@$' || rmfile !~ '[\/]$') " attempt to remove file -" call Decho("attempt to remove file<".rmfile.">") +" call Decho("attempt to remove file<".rmfile.">",'~'.expand("")) if !all echohl Statement call inputsave() @@ -10153,9 +10502,9 @@ fun! s:NetrwLocalRmFile(path,fname,all) if ok == "" let ok="no" endif -" call Decho("response: ok<".ok.">") +" call Decho("response: ok<".ok.">",'~'.expand("")) let ok= substitute(ok,'\[{y(es)},n(o),a(ll),q(uit)]\s*','','e') -" call Decho("response: ok<".ok."> (after sub)") +" call Decho("response: ok<".ok."> (after sub)",'~'.expand("")) if ok =~ 'a\%[ll]' let all= 1 endif @@ -10163,7 +10512,7 @@ fun! s:NetrwLocalRmFile(path,fname,all) if all || ok =~ 'y\%[es]' || ok == "" let ret= s:NetrwDelete(rmfile) -" call Decho("errcode=".v:shell_error." ret=".ret) +" call Decho("errcode=".v:shell_error." ret=".ret,'~'.expand("")) endif else @@ -10184,19 +10533,19 @@ fun! s:NetrwLocalRmFile(path,fname,all) let rmfile= substitute(rmfile,'[\/]$','','e') if all || ok =~ 'y\%[es]' || ok == "" -" call Decho("1st attempt: system(netrw#WinPath(".g:netrw_localrmdir.') '.shellescape(rmfile).')') - call system(netrw#WinPath(g:netrw_localrmdir).' '.shellescape(rmfile)) -" call Decho("v:shell_error=".v:shell_error) +" call Decho("1st attempt: system(netrw#WinPath(".g:netrw_localrmdir.') '.s:ShellEscape(rmfile).')','~'.expand("")) + call system(netrw#WinPath(g:netrw_localrmdir).' '.s:ShellEscape(rmfile)) +" call Decho("v:shell_error=".v:shell_error,'~'.expand("")) if v:shell_error != 0 -" call Decho("2nd attempt to remove directory<".rmfile.">") +" call Decho("2nd attempt to remove directory<".rmfile.">",'~'.expand("")) let errcode= s:NetrwDelete(rmfile) -" call Decho("errcode=".errcode) +" call Decho("errcode=".errcode,'~'.expand("")) if errcode != 0 if has("unix") -" call Decho("3rd attempt to remove directory<".rmfile.">") - call system("rm ".shellescape(rmfile)) +" call Decho("3rd attempt to remove directory<".rmfile.">",'~'.expand("")) + call system("rm ".s:ShellEscape(rmfile)) if v:shell_error != 0 && !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,"unable to remove directory<".rmfile."> -- is it empty?",34) let ok="no" @@ -10232,6 +10581,18 @@ fun! netrw#Access(ilist) return s:netrwmftgt endfun +" --------------------------------------------------------------------- +" netrw#Call: allows user-specified mappings to call internal netrw functions {{{2 +fun! netrw#Call(funcname,...) +" call Dfunc("netrw#Call(funcname<".a:funcname.">,".string(a:000).")") + if a:0 > 0 + exe "call s:".a:funcname."(".string(a:000).")" + else + exe "call s:".a:funcname."()" + endif +" call Dret("netrw#Call") +endfun + " ------------------------------------------------------------------------ " netrw#RestorePosn: restores the cursor and file position as saved by netrw#SavePosn() {{{2 fun! netrw#RestorePosn(...) @@ -10247,22 +10608,22 @@ fun! netrw#RestorePosn(...) if a:0 > 0 exe "keepj ".a:1 endif -" "call Decho("a:1 = ".((a:0 > 0)? a:1 : 'n/a')) -" "call Decho("liststyle = ".(exists("liststyle")? liststyle : 'n/a'). " w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')) +" "call Decho("a:1 = ".((a:0 > 0)? a:1 : 'n/a'),'~'.expand("")) +" "call Decho("liststyle = ".(exists("liststyle")? liststyle : 'n/a'). " w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("")) if exists("liststyle") && exists("w:netrw_liststyle") && liststyle != w:netrw_liststyle let usesrch= 1 else let usesrch= 0 endif -" "call Decho("winh = ".(exists("w:netrw_winh")? w:netrw_winh : -1)) -" "call Decho("winw = ".(exists("w:netrw_winw")? w:netrw_winw : -1)) -" "call Decho("cur winheight=".winheight(0)." winwidth=".winwidth(0)) -" "call Decho("w:netrw_winfile = ".(exists("w:netrw_winfile")? w:netrw_winfile : 'n/a')) +" "call Decho("winh = ".(exists("w:netrw_winh")? w:netrw_winh : -1),'~'.expand("")) +" "call Decho("winw = ".(exists("w:netrw_winw")? w:netrw_winw : -1),'~'.expand("")) +" "call Decho("cur winheight=".winheight(0)." winwidth=".winwidth(0),'~'.expand("")) +" "call Decho("w:netrw_winfile = ".(exists("w:netrw_winfile")? w:netrw_winfile : 'n/a'),'~'.expand("")) " restore window if exists("w:netrw_winnr") -" "call Decho("restore window: exe sil! ".w:netrw_winnr."wincmd w") +" "call Decho("restore window: exe sil! ".w:netrw_winnr."wincmd w",'~'.expand("")) exe "sil! ".w:netrw_winnr."wincmd w" endif " if v:shell_error == 0 @@ -10273,34 +10634,34 @@ fun! netrw#RestorePosn(...) " restore top-of-screen line if exists("w:netrw_hline") -" "call Decho("restore topofscreen: exe keepj norm! ".w:netrw_hline."G0z") +" "call Decho("restore topofscreen: exe keepj norm! ".w:netrw_hline."G0z",'~'.expand("")) exe "keepj norm! ".w:netrw_hline."G0z\" endif " restore position " when the window's height x width has changed, the line,col is no longer useful if w:netrw_winh == winheight(0) && w:netrw_winw == winwidth(0) && exists("w:netrw_line") && exists("w:netrw_col") && !usesrch -" "call Decho("using posn: exe keepj norm! ".w:netrw_line."G0".w:netrw_col."|") +" "call Decho("using posn: exe keepj norm! ".w:netrw_line."G0".w:netrw_col."|",'~'.expand("")) exe "keepj norm! ".w:netrw_line."G0".w:netrw_col."\" elseif exists("w:netrw_winfile") if !search('\<'.escape(w:netrw_winfile,g:netrw_fname_escape),'cw') if exists("w:netrw_bannercnt") -" "call Decho("using bannercnt: win#".winnr()." ".winheight(0)."x".winwidth(0)." w:netrw_winfile<".w:netrw_winfile.">") +" "call Decho("using bannercnt: win#".winnr()." ".winheight(0)."x".winwidth(0)." w:netrw_winfile<".w:netrw_winfile.">",'~'.expand("")) exe "keepj ".w:netrw_bannercnt norm! 0 else " go to upper left corner -" "call Decho("goto ulc: win#".winnr()." ".winheight(0)."x".winwidth(0)." w:netrw_winfile<".w:netrw_winfile.">") +" "call Decho("goto ulc: win#".winnr()." ".winheight(0)."x".winwidth(0)." w:netrw_winfile<".w:netrw_winfile.">",'~'.expand("")) keepj 1 norm! 0 endif else -" "call Decho("used search: w:netrw_winfile<".w:netrw_winfile.">") - endif - - else -" "call Decho("goto ulc: win#".winnr()." ".winheight(0)."x".winwidth(0)) +" "call Decho("used search: w:netrw_winfile<".w:netrw_winfile.">",'~'.expand("")) + endif + + else +" "call Decho("goto ulc: win#".winnr()." ".winheight(0)."x".winwidth(0),'~'.expand("")) keepj 1 norm! 0 endif @@ -10310,6 +10671,39 @@ fun! netrw#RestorePosn(...) endfun " --------------------------------------------------------------------- +" netrw#Expose: allows UserMaps and pchk to look at otherwise script-local variables {{{2 +" I expect this function to be used in +" :PChkAssert netrw#Expose("netrwmarkfilelist") +" for example. +fun! netrw#Expose(varname) +" call Dfunc("netrw#Expose(varname<".a:varname.">)") + exe "let retval= s:".a:varname + if exists("g:netrw_pchk") + if type(retval) == 3 + let retval = copy(retval) + let i = 0 + while i < len(retval) + let retval[i]= substitute(retval[i],expand("$HOME"),'~','') + let i = i + 1 + endwhile + endif +" call Dret("netrw#Expose ".string(retval)) + return string(retval) + endif + +" call Dret("netrw#Expose ".string(retval)) + return retval +endfun + +" --------------------------------------------------------------------- +" netrw#Modify: allows UserMaps to set (modify) script-local variables {{{2 +fun! netrw#Modify(varname,newvalue) +" call Dfunc("netrw#Modify(varname<".a:varname.">,newvalue<".string(a:newvalue).">)") + exe "let s:".a:varname."= ".string(a:newvalue) +" call Dret("netrw#Modify") +endfun + +" --------------------------------------------------------------------- " netrw#RFC2396: converts %xx into characters {{{2 fun! netrw#RFC2396(fname) " call Dfunc("netrw#RFC2396(fname<".a:fname.">)") @@ -10321,27 +10715,27 @@ endfun " --------------------------------------------------------------------- " netrw#SavePosn: saves position of cursor on screen {{{2 fun! netrw#SavePosn() -" call Dfunc("netrw#SavePosn() line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()) +" call Dfunc("netrw#SavePosn() win#".winnr()." line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()) " Save current line and column let w:netrw_winnr= winnr() let w:netrw_line = line(".") let w:netrw_col = virtcol(".") -" "call Decho("currently, win#".w:netrw_winnr." line#".w:netrw_line." col#".w:netrw_col) +" "call Decho("currently, win#".w:netrw_winnr." line#".w:netrw_line." col#".w:netrw_col,'~'.expand("")) " save filename under cursor -" "call Decho("line#".line(".")." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')) +" "call Decho("line#".line(".")." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a'),'~'.expand("")) if exists("w:netrw_bannercnt") && line(".") >= w:netrw_bannercnt && &ft == "netrw" let winfile = "|let w:netrw_winfile=\"".fnameescape(s:NetrwGetWord())."\"" else let winfile= "" endif -" "call Decho("winfile<".winfile.">") +" "call Decho("winfile<".winfile.">",'~'.expand("")) if exists("w:netrw_liststyle") let liststyle = "|let liststyle=".w:netrw_liststyle else let liststyle= "" endif -" "call Decho("liststyle=".liststyle) +" "call Decho("liststyle=".liststyle,'~'.expand("")) " Save top-of-screen line keepj norm! H0 @@ -10356,11 +10750,51 @@ fun! netrw#SavePosn() let ret = "let w:netrw_winnr=".w:netrw_winnr."|let w:netrw_line=".w:netrw_line."|let w:netrw_col=".w:netrw_col."|let w:netrw_hline=".w:netrw_hline."|let w:netrw_winh=".w:netrw_winh."|let w:netrw_winw=".w:netrw_winw.liststyle.winfile keepj call netrw#RestorePosn() -" call Dret("netrw#SavePosn : winnr=".(exists("w:netrw_winnr")? w:netrw_winnr : "n/a")." line=".(exists("w:netrw_line")? w:netrw_line : "n/a")." col=".(exists("w:netrw_col")? w:netrw_col : "n/a")." hline=".(exists("w:netrw_hline")? w:netrw_hline : "n/a")) +" call Dret("netrw#SavePosn : win#=".(exists("w:netrw_winnr")? w:netrw_winnr : "n/a")." line=".(exists("w:netrw_line")? w:netrw_line : "n/a")." col=".(exists("w:netrw_col")? w:netrw_col : "n/a")." hline=".(exists("w:netrw_hline")? w:netrw_hline : "n/a")) return ret endfun " --------------------------------------------------------------------- +" netrw#UserMaps: supports user-specified maps {{{2 +" see :help function() +" +" g:Netrw_UserMaps is a List with members such as: +" [[keymap sequence, function reference],...] +" +" The referenced function may return a string, +" refresh : refresh the display +" -other- : this string will be executed +" or it may return a List of strings. +" +" Each keymap-sequence will be set up with a nnoremap +" to invoke netrw#UserMaps(islocal). +" Related functions: +" netrw#Expose(varname) -- see s:varname variables +" netrw#Modify(varname,newvalue) -- modify value of s:varname variable +" netrw#Call(funcname,...) -- call internal netrw function with optional arguments +fun! netrw#UserMaps(islocal) +" call Dfunc("netrw#UserMaps(islocal=".a:islocal.")") +" call Decho("g:Netrw_UserMaps ".(exists("g:Netrw_UserMaps")? "exists" : "does NOT exist"),'~'.expand("")) + + " set up usermaplist + if exists("g:Netrw_UserMaps") && type(g:Netrw_UserMaps) == 3 +" call Decho("g:Netrw_UserMaps has type 3",'~'.expand("")) + for umap in g:Netrw_UserMaps +" call Decho("type(umap[0]<".string(umap[0]).">)=".type(umap[0])." (should be 1=string)",'~'.expand("")) +" call Decho("type(umap[1])=".type(umap[1])." (should be 1=string)",'~'.expand("")) + " if umap[0] is a string and umap[1] is a string holding a function name + if type(umap[0]) == 1 && type(umap[1]) == 1 +" call Decho("nno ".umap[0]." :call s:UserMaps(".a:islocal.",".string(umap[1]).")",'~'.expand("")) + exe "nno ".umap[0]." :call UserMaps(".a:islocal.",'".umap[1]."')" + else + call netrw#ErrorMsg(s:WARNING,"ignoring usermap <".string(umap[0])."> -- not a [string,funcref] entry",99) + endif + endfor + endif +" call Dret("netrw#UserMaps") +endfun + +" --------------------------------------------------------------------- " netrw#WinPath: tries to insure that the path is windows-acceptable, whether cygwin is used or not {{{2 fun! netrw#WinPath(path) " call Dfunc("netrw#WinPath(path<".a:path.">)") @@ -10386,7 +10820,7 @@ fun! s:ComposePath(base,subdir) " call Dfunc("s:ComposePath(base<".a:base."> subdir<".a:subdir.">)") if has("amiga") -" call Decho("amiga") +" call Decho("amiga",'~'.expand("")) let ec = a:base[s:Strlen(a:base)-1] if ec != '/' && ec != ':' let ret = a:base . "/" . a:subdir @@ -10395,19 +10829,19 @@ fun! s:ComposePath(base,subdir) endif elseif a:subdir =~ '^\a:[/\\][^/\\]' && (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("windows") +" call Decho("windows",'~'.expand("")) let ret= a:subdir elseif a:base =~ '^\a:[/\\][^/\\]' && (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("windows") +" call Decho("windows",'~'.expand("")) if a:base =~ '[/\\]$' let ret= a:base.a:subdir else - let ret= a:base."/".a:subdir - endif - - elseif a:base =~ '^\a\+://' -" call Decho("remote linux/macos") + let ret= a:base.'/'.a:subdir + endif + + elseif a:base =~ '^\a\{3,}://' +" call Decho("remote linux/macos",'~'.expand("")) let urlbase = substitute(a:base,'^\(\a\+://.\{-}/\)\(.*\)$','\1','') let curpath = substitute(a:base,'^\(\a\+://.\{-}/\)\(.*\)$','\2','') if a:subdir == '../' @@ -10420,12 +10854,12 @@ fun! s:ComposePath(base,subdir) else let ret= urlbase.curpath.a:subdir endif -" call Decho("urlbase<".urlbase.">") -" call Decho("curpath<".curpath.">") -" call Decho("ret<".ret.">") - - else -" call Decho("local linux/macos") +" call Decho("urlbase<".urlbase.">",'~'.expand("")) +" call Decho("curpath<".curpath.">",'~'.expand("")) +" call Decho("ret<".ret.">",'~'.expand("")) + + else +" call Decho("local linux/macos",'~'.expand("")) let ret = substitute(a:base."/".a:subdir,"//","/","g") if a:base =~ '^//' " keeping initial '//' for the benefit of network share listing support @@ -10471,9 +10905,9 @@ fun! s:FileReadable(fname) " call Dfunc("s:FileReadable(fname<".a:fname.">)") if g:netrw_cygwin - let ret= filereadable(substitute(a:fname,g:netrw_cygdrive.'/\(.\)','\1:/','')) - else - let ret= filereadable(a:fname) + let ret= filereadable(s:NetrwFile(substitute(a:fname,g:netrw_cygdrive.'/\(.\)','\1:/',''))) + else + let ret= filereadable(s:NetrwFile(a:fname)) endif " call Dret("s:FileReadable ".ret) @@ -10490,14 +10924,14 @@ fun! s:GetTempfile(fname) if !exists("b:netrw_tmpfile") " get a brand new temporary filename let tmpfile= tempname() -" call Decho("tmpfile<".tmpfile."> : from tempname()") +" call Decho("tmpfile<".tmpfile."> : from tempname()",'~'.expand("")) let tmpfile= substitute(tmpfile,'\','/','ge') -" call Decho("tmpfile<".tmpfile."> : chgd any \\ -> /") +" call Decho("tmpfile<".tmpfile."> : chgd any \\ -> /",'~'.expand("")) " sanity check -- does the temporary file's directory exist? - if !isdirectory(substitute(tmpfile,'[^/]\+$','','e')) -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") + if !isdirectory(s:NetrwFile(substitute(tmpfile,'[^/]\+$','','e'))) +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) NetrwKeepj call netrw#ErrorMsg(s:ERROR,"your <".substitute(tmpfile,'[^/]\+$','','e')."> directory is missing!",2) " call Dret("s:GetTempfile getcwd<".getcwd().">") return "" @@ -10505,7 +10939,7 @@ fun! s:GetTempfile(fname) " let netrw#NetSource() know about the tmpfile let s:netrw_tmpfile= tmpfile " used by netrw#NetSource() and netrw#BrowseX() -" call Decho("tmpfile<".tmpfile."> s:netrw_tmpfile<".s:netrw_tmpfile.">") +" call Decho("tmpfile<".tmpfile."> s:netrw_tmpfile<".s:netrw_tmpfile.">",'~'.expand("")) " o/s dependencies if g:netrw_cygwin != 0 @@ -10518,17 +10952,17 @@ fun! s:GetTempfile(fname) let tmpfile = tmpfile endif let b:netrw_tmpfile= tmpfile -" call Decho("o/s dependent fixed tempname<".tmpfile.">") +" call Decho("o/s dependent fixed tempname<".tmpfile.">",'~'.expand("")) else " re-use temporary filename let tmpfile= b:netrw_tmpfile -" call Decho("tmpfile<".tmpfile."> re-using") +" call Decho("tmpfile<".tmpfile."> re-using",'~'.expand("")) endif " use fname's suffix for the temporary file if a:fname != "" if a:fname =~ '\.[^./]\+$' -" call Decho("using fname<".a:fname.">'s suffix") +" call Decho("using fname<".a:fname.">'s suffix",'~'.expand("")) if a:fname =~ '\.tar\.gz$' || a:fname =~ '\.tar\.bz2$' || a:fname =~ '\.tar\.xz$' let suffix = ".tar".substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e') elseif a:fname =~ '.txz$' @@ -10536,16 +10970,16 @@ fun! s:GetTempfile(fname) else let suffix = substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e') endif -" call Decho("suffix<".suffix.">") +" call Decho("suffix<".suffix.">",'~'.expand("")) let tmpfile= substitute(tmpfile,'\.tmp$','','e') -" call Decho("chgd tmpfile<".tmpfile."> (removed any .tmp suffix)") +" call Decho("chgd tmpfile<".tmpfile."> (removed any .tmp suffix)",'~'.expand("")) let tmpfile .= suffix -" call Decho("chgd tmpfile<".tmpfile."> (added ".suffix." suffix) netrw_fname<".b:netrw_fname.">") +" call Decho("chgd tmpfile<".tmpfile."> (added ".suffix." suffix) netrw_fname<".b:netrw_fname.">",'~'.expand("")) let s:netrw_tmpfile= tmpfile " supports netrw#NetSource() endif endif -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) " call Dret("s:GetTempfile <".tmpfile.">") return tmpfile endfun @@ -10582,7 +11016,7 @@ fun! s:MakeBookmark(fname) if index(g:netrw_bookmarklist,a:fname) == -1 " curdir not currently in g:netrw_bookmarklist, so include it - if isdirectory(a:fname) && a:fname !~ '/$' + if isdirectory(s:NetrwFile(a:fname)) && a:fname !~ '/$' call add(g:netrw_bookmarklist,a:fname.'/') elseif a:fname !~ '/' call add(g:netrw_bookmarklist,getcwd()."/".a:fname) @@ -10598,13 +11032,13 @@ endfun " --------------------------------------------------------------------- " s:MergeBookmarks: merge current bookmarks with saved bookmarks {{{2 fun! s:MergeBookmarks() -" call Dfunc("s:MergeBookmarks()") +" call Dfunc("s:MergeBookmarks() : merge current bookmarks into .netrwbook") " get bookmarks from .netrwbook file let savefile= s:NetrwHome()."/.netrwbook" - if filereadable(savefile) -" call Decho("merge bookmarks (active and file)") + if filereadable(s:NetrwFile(savefile)) +" call Decho("merge bookmarks (active and file)",'~'.expand("")) NetrwKeepj call s:NetrwBookHistSave() -" call Decho("bookmark delete savefile<".savefile.">") +" call Decho("bookmark delete savefile<".savefile.">",'~'.expand("")) NetrwKeepj call delete(savefile) endif " call Dret("s:MergeBookmarks") @@ -10641,13 +11075,13 @@ fun! s:NetrwCursor() if &ft != "netrw" " if the current window isn't a netrw directory listing window, then use user cursorline/column " settings. Affects when netrw is used to read/write a file using scp/ftp/etc. -" call Decho("case ft!=netrw: use user cul,cuc") +" call Decho("case ft!=netrw: use user cul,cuc",'~'.expand("")) let &l:cursorline = s:netrw_usercul let &l:cursorcolumn = s:netrw_usercuc elseif g:netrw_cursor == 4 " all styles: cursorline, cursorcolumn -" call Decho("case g:netrw_cursor==4: setl cul cuc") +" call Decho("case g:netrw_cursor==4: setl cul cuc",'~'.expand("")) setl cursorline setl cursorcolumn @@ -10655,11 +11089,11 @@ fun! s:NetrwCursor() " thin-long-tree: cursorline, user's cursorcolumn " wide : cursorline, cursorcolumn if w:netrw_liststyle == s:WIDELIST -" call Decho("case g:netrw_cursor==3 and wide: setl cul cuc") +" call Decho("case g:netrw_cursor==3 and wide: setl cul cuc",'~'.expand("")) setl cursorline setl cursorcolumn else -" call Decho("case g:netrw_cursor==3 and not wide: setl cul (use user's cuc)") +" call Decho("case g:netrw_cursor==3 and not wide: setl cul (use user's cuc)",'~'.expand("")) setl cursorline let &l:cursorcolumn = s:netrw_usercuc endif @@ -10667,7 +11101,7 @@ fun! s:NetrwCursor() elseif g:netrw_cursor == 2 " thin-long-tree: cursorline, user's cursorcolumn " wide : cursorline, user's cursorcolumn -" call Decho("case g:netrw_cursor==2: setl cuc (use user's cul)") +" call Decho("case g:netrw_cursor==2: setl cuc (use user's cul)",'~'.expand("")) let &l:cursorcolumn = s:netrw_usercuc setl cursorline @@ -10676,16 +11110,16 @@ fun! s:NetrwCursor() " wide : cursorline, user's cursorcolumn let &l:cursorcolumn = s:netrw_usercuc if w:netrw_liststyle == s:WIDELIST -" call Decho("case g:netrw_cursor==2 and wide: setl cul (use user's cuc)") +" call Decho("case g:netrw_cursor==2 and wide: setl cul (use user's cuc)",'~'.expand("")) setl cursorline else -" call Decho("case g:netrw_cursor==2 and not wide: (use user's cul,cuc)") +" call Decho("case g:netrw_cursor==2 and not wide: (use user's cul,cuc)",'~'.expand("")) let &l:cursorline = s:netrw_usercul endif else " all styles: user's cursorline, user's cursorcolumn -" call Decho("default: (use user's cul,cuc)") +" call Decho("default: (use user's cul,cuc)",'~'.expand("")) let &l:cursorline = s:netrw_usercul let &l:cursorcolumn = s:netrw_usercuc endif @@ -10722,11 +11156,11 @@ fun! s:NetrwDelete(path) let result = delete(path) let &shellslash = sskeep else -" call Decho("exe let result= ".a:cmd."('".path."')") +" call Decho("exe let result= ".a:cmd."('".path."')",'~'.expand("")) let result= delete(path) endif else -" call Decho("let result= delete(".path.")") +" call Decho("let result= delete(".path.")",'~'.expand("")) let result= delete(path) endif if result < 0 @@ -10741,10 +11175,10 @@ endfun " s:NetrwEnew: opens a new buffer, passes netrw buffer variables through {{{2 fun! s:NetrwEnew(...) " call Dfunc("s:NetrwEnew() a:0=".a:0." bufnr($)=".bufnr("$")) -" call Decho("curdir<".((a:0>0)? a:1 : "")."> buf#".bufnr("%")."<".bufname("%").">") +" call Decho("curdir<".((a:0>0)? a:1 : "")."> buf#".bufnr("%")."<".bufname("%").">",'~'.expand("")) " grab a function-local-variable copy of buffer variables -" call Decho("make function-local copy of netrw variables") +" call Decho("make function-local copy of netrw variables",'~'.expand("")) if exists("b:netrw_bannercnt") |let netrw_bannercnt = b:netrw_bannercnt |endif if exists("b:netrw_browser_active") |let netrw_browser_active = b:netrw_browser_active |endif if exists("b:netrw_cpf") |let netrw_cpf = b:netrw_cpf |endif @@ -10763,15 +11197,15 @@ fun! s:NetrwEnew(...) if exists("b:netrw_prvdir") |let netrw_prvdir = b:netrw_prvdir |endif NetrwKeepj call s:NetrwOptionRestore("w:") -" call Decho("generate a buffer with NetrwKeepj keepalt enew!") +" call Decho("generate a buffer with NetrwKeepj keepalt enew!",'~'.expand("")) let netrw_keepdiff= &l:diff noswapfile NetrwKeepj keepalt enew! let &l:diff= netrw_keepdiff -" call Decho("bufnr($)=".bufnr("$")." winnr($)=".winnr("$")) +" call Decho("bufnr($)=".bufnr("$")." winnr($)=".winnr("$"),'~'.expand("")) NetrwKeepj call s:NetrwOptionSave("w:") " copy function-local-variables to buffer variable equivalents -" call Decho("copy function-local variables back to buffer netrw variables") +" call Decho("copy function-local variables back to buffer netrw variables",'~'.expand("")) if exists("netrw_bannercnt") |let b:netrw_bannercnt = netrw_bannercnt |endif if exists("netrw_browser_active") |let b:netrw_browser_active = netrw_browser_active |endif if exists("netrw_cpf") |let b:netrw_cpf = netrw_cpf |endif @@ -10841,7 +11275,7 @@ fun! s:NetrwInsureWinVars() endwhile exe "keepalt ".curwin."wincmd w" if exists("winvars") -" call Decho("copying w#".iwin." window variables to w#".curwin) +" call Decho("copying w#".iwin." window variables to w#".curwin,'~'.expand("")) for k in keys(winvars) let w:{k}= winvars[k] endfor @@ -10860,7 +11294,7 @@ fun! s:NetrwLcd(newdir) catch /^Vim\%((\a\+)\)\=:E344/ " Vim's lcd fails with E344 when attempting to go above the 'root' of a Windows share. " Therefore, detect if a Windows share is present, and if E344 occurs, just settle at - " 'root' (ie. '\'). The share name may start with either backslashes ('\\Foo') or + " 'root' (ie. '\'). The share name may start with either backslashes ('\\Foo') or " forward slashes ('//Foo'), depending on whether backslashes have been converted to " forward slashes by earlier code; so check for both. if (has("win32") || has("win95") || has("win64") || has("win16")) && !g:netrw_cygwin @@ -10875,9 +11309,9 @@ fun! s:NetrwLcd(newdir) let a:newdir= w:netrw_prvdir else call s:NetrwOptionRestore("w:") -" call Decho("setl noma nomod nowrap") +" call Decho("setl noma nomod nowrap",'~'.expand("")) exe "setl ".g:netrw_bufsettings -" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) let a:newdir= dirname " call Dret("s:NetrwBrowse : reusing buffer#".(exists("bufnum")? bufnum : 'N/A')."<".dirname."> getcwd<".getcwd().">") return @@ -10939,12 +11373,12 @@ fun! s:RemotePathAnalysis(dirname) let s:machine = substitute(s:machine,dirpat,'\2','') endif -" call Decho("set up s:method <".s:method .">") -" call Decho("set up s:user <".s:user .">") -" call Decho("set up s:machine<".s:machine.">") -" call Decho("set up s:port <".s:port.">") -" call Decho("set up s:path <".s:path .">") -" call Decho("set up s:fname <".s:fname .">") +" call Decho("set up s:method <".s:method .">",'~'.expand("")) +" call Decho("set up s:user <".s:user .">",'~'.expand("")) +" call Decho("set up s:machine<".s:machine.">",'~'.expand("")) +" call Decho("set up s:port <".s:port.">",'~'.expand("")) +" call Decho("set up s:path <".s:path .">",'~'.expand("")) +" call Decho("set up s:fname <".s:fname .">",'~'.expand("")) " call Dret("s:RemotePathAnalysis") endfun @@ -10954,7 +11388,7 @@ endfun " Returns status " Runs system() on " [cd REMOTEDIRPATH;] a:cmd -" Note that it doesn't do shellescape(a:cmd)! +" Note that it doesn't do s:ShellEscape(a:cmd)! fun! s:RemoteSystem(cmd) " call Dfunc("s:RemoteSystem(cmd<".a:cmd.">)") if !executable(g:netrw_ssh_cmd) @@ -10965,12 +11399,12 @@ fun! s:RemoteSystem(cmd) let cmd = s:MakeSshCmd(g:netrw_ssh_cmd." USEPORT HOSTNAME") let remotedir= substitute(b:netrw_curdir,'^.*//[^/]\+/\(.*\)$','\1','') if remotedir != "" - let cmd= cmd.' cd '.shellescape(remotedir).";" + let cmd= cmd.' cd '.s:ShellEscape(remotedir).";" else let cmd= cmd.' ' endif let cmd= cmd.a:cmd -" call Decho("call system(".cmd.")") +" call Decho("call system(".cmd.")",'~'.expand("")) let ret= system(cmd) endif " call Dret("s:RemoteSystem ".ret) @@ -11009,23 +11443,26 @@ endfun " is true) and a command, :Rexplore, which call this function. " " s:nbcd_curpos_{bufnr('%')} is set up by s:NetrwBrowseChgDir() +" +" s:rexposn_BUFNR used to save/restore cursor position fun! s:NetrwRexplore(islocal,dirname) if exists("s:netrwdrag") return endif " call Dfunc("s:NetrwRexplore() w:netrw_rexlocal=".w:netrw_rexlocal." w:netrw_rexdir<".w:netrw_rexdir.">") -" call Decho("ft=".&ft." win#".winnr()." w:netrw_rexfile<".(exists("w:netrw_rexfile")? w:netrw_rexfile : 'n/a').">") +" call Decho("currently in bufname<".bufname("%").">",'~'.expand("")) +" call Decho("ft=".&ft." win#".winnr()." w:netrw_rexfile<".(exists("w:netrw_rexfile")? w:netrw_rexfile : 'n/a').">",'~'.expand("")) if &ft == "netrw" && exists("w:netrw_rexfile") && w:netrw_rexfile != "" " a :Rex while in a netrw buffer means: edit the file in w:netrw_rexfile -" call Decho("in netrw buffer, will edit file<".w:netrw_rexfile.">") +" call Decho("in netrw buffer, will edit file<".w:netrw_rexfile.">",'~'.expand("")) exe "NetrwKeepj e ".w:netrw_rexfile unlet w:netrw_rexfile " call Dret("s:NetrwRexplore returning from netrw to buf#".bufnr("%")."<".bufname("%")."> (ft=".&ft.")") return " else " Decho -" call Decho("treating as not-netrw-buffer: ft=".&ft.((&ft == "netrw")? " == netrw" : "!= netrw")) -" call Decho("treating as not-netrw-buffer: w:netrw_rexfile<".((exists("w:netrw_rexfile"))? w:netrw_rexfile : 'n/a').">") +" call Decho("treating as not-netrw-buffer: ft=".&ft.((&ft == "netrw")? " == netrw" : "!= netrw"),'~'.expand("")) +" call Decho("treating as not-netrw-buffer: w:netrw_rexfile<".((exists("w:netrw_rexfile"))? w:netrw_rexfile : 'n/a').">",'~'.expand("")) endif " --------------------------- @@ -11034,43 +11471,37 @@ fun! s:NetrwRexplore(islocal,dirname) " record current file so :Rex can return to it from netrw let w:netrw_rexfile= expand("%") +" call Decho("set w:netrw_rexfile<".w:netrw_rexfile."> (win#".winnr().")",'~'.expand("")) if !exists("w:netrw_rexlocal") " call Dret("s:NetrwRexplore w:netrw_rexlocal doesn't exist (".&ft.")") return endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) if w:netrw_rexlocal - if g:netrw_keepj =~ "keepj" - keepj call netrw#LocalBrowseCheck(w:netrw_rexdir) - else - call netrw#LocalBrowseCheck(w:netrw_rexdir) - endif - elseif g:netrw_keepj =~ "keepj" - keepj call s:NetrwBrowse(0,w:netrw_rexdir) - else - call s:NetrwBrowse(0,w:netrw_rexdir) + NetrwKeepj call netrw#LocalBrowseCheck(w:netrw_rexdir) + else + NetrwKeepj call s:NetrwBrowse(0,w:netrw_rexdir) endif if exists("s:initbeval") setl beval endif if exists("s:rexposn_".bufnr("%")) -" call Decho("restore posn, then unlet s:rexposn_".bufnr('%')) - if g:netrw_keepj =~ "keepj" - keepj call netrw#RestorePosn(s:rexposn_{bufnr('%')}) - else - call netrw#RestorePosn(s:rexposn_{bufnr('%')}) - endif - unlet s:rexposn_{bufnr('%')} - else -" call Decho("s:rexposn_".bufnr('%')." doesn't exist") +" call Decho("restore posn, then unlet s:rexposn_".bufnr('%')."<".bufname("%").">",'~'.expand("")) + " restore position in directory listing + NetrwKeepj call netrw#RestorePosn(s:rexposn_{bufnr('%')}) + if exists("s:rexposn_".bufnr('%')) + unlet s:rexposn_{bufnr('%')} + endif + else +" call Decho("s:rexposn_".bufnr('%')."<".bufname("%")."> doesn't exist",'~'.expand("")) endif if exists("s:explore_match") exe "2match netrwMarkFile /".s:explore_match."/" endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo) +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) " call Dret("s:NetrwRexplore : ft=".&ft) endfun @@ -11141,8 +11572,10 @@ endfun " s:SetRexDir: set directory for :Rexplore {{{2 fun! s:SetRexDir(islocal,dirname) " call Dfunc("s:SetRexDir(islocal=".a:islocal." dirname<".a:dirname.">)") - let w:netrw_rexdir = a:dirname - let w:netrw_rexlocal = a:islocal + let w:netrw_rexdir = a:dirname + let w:netrw_rexlocal = a:islocal + let s:rexposn_{bufnr("%")} = netrw#SavePosn() +" call Decho("setting s:rexposn_".bufnr("%")."<".bufname("%")."> to SavePosn",'~'.expand("")) " call Dret("s:SetRexDir : win#".winnr()." ".(a:islocal? "local" : "remote")." dir: ".a:dirname) endfun @@ -11150,22 +11583,23 @@ endfun " s:ShowLink: used to modify thin and tree listings to show links {{{2 fun! s:ShowLink() " " call Dfunc("s:ShowLink()") -" " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">") -" " call Decho(printf("line#%4d: %s",line("."),getline("."))) +" " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">",'~'.expand("")) +" " call Decho(printf("line#%4d: %s",line("."),getline(".")),'~'.expand("")) if exists("b:netrw_curdir") norm! $?\a let fname = b:netrw_curdir.'/'.s:NetrwGetWord() let resname = resolve(fname) - if resname =~ '^\M'.b:netrw_curdir +" " call Decho("fname <".fname.">",'~'.expand("")) +" " call Decho("resname <".resname.">",'~'.expand("")) +" " call Decho("b:netrw_curdir<".b:netrw_curdir.">",'~'.expand("")) + if resname =~ '^\M'.b:netrw_curdir.'/' let dirlen = strlen(b:netrw_curdir) let resname = strpart(resname,dirlen+1) -" " call Decho("resname<".resname."> (b:netrw_curdir elided)") -" " else " Decho -" " call Decho("resname<".fname.">") +" " call Decho("resname<".resname."> (b:netrw_curdir elided)",'~'.expand("")) endif let modline = getline(".")."\t --> ".resname -" " call Decho("fname <".fname.">") -" " call Decho("modline<".modline.">") +" " call Decho("fname <".fname.">",'~'.expand("")) +" " call Decho("modline<".modline.">",'~'.expand("")) setl noro ma call setline(".",modline) setl ro noma nomod @@ -11203,22 +11637,22 @@ fun! s:Strlen(x) if v:version >= 703 && exists("*strdisplaywidth") let ret= strdisplaywidth(a:x) - + elseif type(g:Align_xstrlen) == 1 " allow user to specify a function to compute the string length (ie. let g:Align_xstrlen="mystrlenfunc") exe "let ret= ".g:Align_xstrlen."('".substitute(a:x,"'","''","g")."')" - + elseif g:Align_xstrlen == 1 " number of codepoints (Latin a + combining circumflex is two codepoints) " (comment from TM, solution from NW) let ret= strlen(substitute(a:x,'.','c','g')) - + elseif g:Align_xstrlen == 2 " number of spacing codepoints (Latin a + combining circumflex is one spacing " codepoint; a hard tab is one; wide and narrow CJK are one each; etc.) " (comment from TM, solution from TM) let ret=strlen(substitute(a:x, '.\Z', 'x', 'g')) - + elseif g:Align_xstrlen == 3 " virtual length (counting, for instance, tabs as anything between 1 and " 'tabstop', wide CJK as 2 rather than 1, Arabic alif as zero when immediately @@ -11231,7 +11665,7 @@ fun! s:Strlen(x) d NetrwKeepj norm! k let &l:mod= modkeep - + else " at least give a decent default let ret= strlen(a:x) @@ -11241,6 +11675,16 @@ fun! s:Strlen(x) endfun " --------------------------------------------------------------------- +" s:ShellEscape: shellescape(), or special windows handling {{{2 +fun! s:ShellEscape(s, ...) + if (has('win32') || has('win64')) && $SHELL == '' && &shellslash + return printf('"%s"', substitute(a:s, '"', '""', 'g')) + endif + let f = a:0 > 0 ? a:1 : 0 + return shellescape(a:s, f) +endfun + +" --------------------------------------------------------------------- " s:TreeListMove: {{{2 fun! s:TreeListMove(dir) " call Dfunc("s:TreeListMove(dir<".a:dir.">)") @@ -11249,33 +11693,33 @@ fun! s:TreeListMove(dir) let nxtline = (line(".") < line("$"))? getline(line(".")+1) : '' let curindent= substitute(curline,'^\([| ]*\).\{-}$','\1','') let indentm1 = substitute(curindent,'^'.s:treedepthstring.' ','','') -" call Decho("prvline <".prvline."> #".line(".")-1) -" call Decho("curline <".curline."> #".line(".")) -" call Decho("nxtline <".nxtline."> #".line(".")+1) -" call Decho("curindent<".curindent.">") -" call Decho("indentm1 <".indentm1.">") +" call Decho("prvline <".prvline."> #".line(".")-1,'~'.expand("")) +" call Decho("curline <".curline."> #".line("."),'~'.expand("")) +" call Decho("nxtline <".nxtline."> #".line(".")+1,'~'.expand("")) +" call Decho("curindent<".curindent.">",'~'.expand("")) +" call Decho("indentm1 <".indentm1.">",'~'.expand("")) if curline !~ '/$' -" call Decho('regfile') +" call Decho('regfile','~'.expand("")) if a:dir == '[' && prvline != '' NetrwKeepj norm! 0 let nl = search('^'.indentm1.'[^'.s:treedepthstring.']','bWe') " search backwards from regular file -" call Decho("regfile srch back: ".nl) +" call Decho("regfile srch back: ".nl,'~'.expand("")) elseif a:dir == ']' && nxtline != '' NetrwKeepj norm! $ let nl = search('^'.indentm1.'[^'.s:treedepthstring.']','We') " search forwards from regular file -" call Decho("regfile srch fwd: ".nl) +" call Decho("regfile srch fwd: ".nl,'~'.expand("")) endif elseif a:dir == '[' && prvline != '' NetrwKeepj norm! 0 let curline= line(".") let nl = search('^'.curindent.'[^'.s:treedepthstring.']','bWe') " search backwards From directory, same indentation -" call Decho("dir srch back ind: ".nl) +" call Decho("dir srch back ind: ".nl,'~'.expand("")) if nl != 0 if line(".") == curline-1 let nl= search('^'.indentm1.'[^'.s:treedepthstring.']','bWe') " search backwards from directory, indentation - 1 -" call Decho("dir srch back ind-1: ".nl) +" call Decho("dir srch back ind-1: ".nl,'~'.expand("")) endif endif @@ -11283,11 +11727,11 @@ fun! s:TreeListMove(dir) NetrwKeepj norm! $ let curline = line(".") let nl = search('^'.curindent.'[^'.s:treedepthstring.']','We') " search forwards from directory, same indentation -" call Decho("dir srch fwd ind: ".nl) +" call Decho("dir srch fwd ind: ".nl,'~'.expand("")) if nl != 0 if line(".") == curline+1 let nl= search('^'.indentm1.'[^'.s:treedepthstring.']','We') " search forwards from directory, indentation - 1 -" call Decho("dir srch fwd ind-1: ".nl) +" call Decho("dir srch fwd ind-1: ".nl,'~'.expand("")) endif endif @@ -11333,6 +11777,48 @@ fun! s:UseBufWinVars() endfun " --------------------------------------------------------------------- +" s:UserMaps: supports user-defined UserMaps {{{2 +" * calls a user-supplied funcref(islocal,curdir) +" * interprets result +" See netrw#UserMaps() +fun! s:UserMaps(islocal,funcname) +" call Dfunc("s:UserMaps(islocal=".a:islocal.",funcname<".a:funcname.">)") + + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() + endif + let Funcref = function(a:funcname) + let result = Funcref(a:islocal) + + if type(result) == 1 + " if result from user's funcref is a string... +" call Decho("result string from user funcref<".result.">",'~'.expand("")) + if result == "refresh" +" call Decho("refreshing display",'~'.expand("")) + call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + elseif result != "" +" call Decho("executing result<".result.">",'~'.expand("")) + exe result + endif + + elseif type(result) == 3 + " if result from user's funcref is a List... +" call Decho("result List from user funcref<".string(result).">",'~'.expand("")) + for action in result + if action == "refresh" +" call Decho("refreshing display",'~'.expand("")) + call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + elseif action != "" +" call Decho("executing action<".action.">",'~'.expand("")) + exe action + endif + endfor + endif + +" call Dret("s:UserMaps") +endfun + +" --------------------------------------------------------------------- " Settings Restoration: {{{1 let &cpo= s:keepcpo unlet s:keepcpo diff --git a/runtime/autoload/pythoncomplete.vim b/runtime/autoload/pythoncomplete.vim --- a/runtime/autoload/pythoncomplete.vim +++ b/runtime/autoload/pythoncomplete.vim @@ -377,6 +377,7 @@ class PyParser: def __init__(self): self.top = Scope('global',0) self.scope = self.top + self.parserline = 0 def _parsedotname(self,pre=None): #returns (dottedname, nexttoken) diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -1,4 +1,4 @@ -*change.txt* For Vim version 7.4. Last change: 2015 Sep 06 +*change.txt* For Vim version 7.4. Last change: 2015 Oct 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -863,6 +863,36 @@ either the first or second pattern in pa :s/\([ab]\)\|\([cd]\)/\1x/g modifies "a b c d" to "ax bx x x" < + *:sc* *:sce* *:scg* *:sci* *:scI* *:scl* *:scp* *:sg* *:sgc* + *:sge* *:sgi* *:sgI* *:sgl* *:sgn* *:sgp* *:sgr* *:sI* *:si* + *:sic* *:sIc* *:sie* *:sIe* *:sIg* *:sIl* *:sin* *:sIn* *:sIp* + *:sip* *:sIr* *:sir* *:sr* *:src* *:srg* *:sri* *:srI* *:srl* + *:srn* *:srp* +2-letter and 3-letter :substitute commands ~ + + List of :substitute commands + | c e g i I n p l r + | c :sc :sce :scg :sci :scI :scn :scp :scl --- + | e + | g :sgc :sge :sg :sgi :sgI :sgn :sgp :sgl :sgr + | i :sic :sie --- :si :siI :sin :sip --- :sir + | I :sIc :sIe :sIg :sIi :sI :sIn :sIp :sIl :sIr + | n + | p + | l + | r :src --- :srg :sri :srI :srn :srp :srl :sr + +Exceptions: + :scr is `:scriptnames` + :se is `:set` + :sig is `:sign` + :sil is `:silent` + :sn is `:snext` + :sp is `:split` + :sl is `:sleep` + :sre is `:srewind` + + Substitute with an expression *sub-replace-expression* *sub-replace-\=* *s/\=* When the substitute string starts with "\=" the remainder is interpreted as an diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -1,4 +1,4 @@ -*pi_netrw.txt* For Vim version 7.4. Last change: 2015 Jan 05 +*pi_netrw.txt* For Vim version 7.4. Last change: 2015 Oct 30 ------------------------------------------------ NETRW REFERENCE MANUAL by Charles E. Campbell @@ -367,7 +367,12 @@ settings are described below, in |netrw- fun! MyFuncRef() endfun let g:Netrw_funcref= function("MyFuncRef") + < + *g:Netrw_UserMaps* specifies a function or |List| of functions which can + be used to set up user-specified maps and functionality. + See |netrw-usermaps| + *g:netrw_ftp* if it doesn't exist, use default ftp =0 use default ftp (uid password) =1 use alternate ftp method (user uid password) @@ -1064,9 +1069,10 @@ QUICK REFERENCE: MAPS *netrw-browse-m < Causes Netrw to issue help Netrw will enter the directory or read the file |netrw-cr| Netrw will attempt to remove the file/directory |netrw-del| - Edit file hiding list |netrw-ctrl-h| - Causes Netrw to refresh the directory listing |netrw-ctrl-l| - Browse using a gvim server |netrw-ctrl-r| + Edit file hiding list |netrw-ctrl-h| + Causes Netrw to refresh the directory listing |netrw-ctrl-l| + Browse using a gvim server |netrw-ctrl-r| + Shrink/expand a netrw/explore window |netrw-c-tab| - Makes Netrw go up one directory |netrw--| a Toggles between normal display, |netrw-a| hiding (suppress display of files matching g:netrw_list_hide) @@ -1079,6 +1085,7 @@ QUICK REFERENCE: MAPS *netrw-browse-m gd Force treatment as directory |netrw-gd| gf Force treatment as file |netrw-gf| gh Quick hide/unhide of dot-files |netrw-gh| + gn Make top of tree the directory below the cursor |netrw-gn| i Cycle between thin, long, wide, and tree listings |netrw-i| mb Bookmark current directory |netrw-mb| mc Copy marked files to marked-file target directory |netrw-mc| @@ -1107,7 +1114,7 @@ QUICK REFERENCE: MAPS *netrw-browse-m qf Display information on file |netrw-qf| qF Mark files using a quickfix list |netrw-qF| r Reverse sorting order |netrw-r| - R Rename the designed file(s)/directory(ies) |netrw-R| + R Rename the designated file(s)/directory(ies) |netrw-R| s Select sorting style: by name, time, or file size |netrw-s| S Specify suffix priority for name-sorting |netrw-S| t Enter the file/directory under the cursor in a new tab|netrw-t| @@ -1176,10 +1183,10 @@ Addtionally, one may use :NetrwMB to boo < No bang: enters files/directories into Netrw's bookmark system No argument and in netrw buffer: - if there are marked files: bookmark marked files - otherwise : bookmark file/directory under cursor + if there are marked files : bookmark marked files + otherwise : bookmark file/directory under cursor No argument and not in netrw buffer: bookmarks current open file - Has arguments: globs them individually and bookmarks them + Has arguments : |glob()|s each arg and bookmarks them With bang: deletes files/directories from Netrw's bookmark system @@ -1396,8 +1403,8 @@ list (unless |g:netrw_dirhistmax| is zer the opposite, see |netrw-U|. The "u" map also accepts counts to go back in the history several slots. -For your convenience, |netrw-qb| lists the history number which can be -re-used in that count. +For your convenience, qb (see |netrw-qb|) lists the history number which may +be used in that count. *.netrwhist* See |g:netrw_dirhistmax| for how to control the quantity of history stack @@ -1414,7 +1421,7 @@ CHANGING TO A SUCCESSOR DIRECTORY *netr With the "U" map, one can change to a later directory (successor). This map is the opposite of the "u" map. (see |netrw-u|) Use the -q map to list both the bookmarks and history. (see |netrw-qb|) +qb map to list both the bookmarks and history. (see |netrw-qb|) The "U" map also accepts counts to go forward in the history several slots. @@ -1422,7 +1429,7 @@ See |g:netrw_dirhistmax| for how to cont slots. -CHANGING TREE TOP *netrw-ntree* *:Ntree* {{{2 +CHANGING TREE TOP *netrw-ntree* *:Ntree* *netrw-gn* {{{2 One may specify a new tree top for tree listings using > @@ -1432,14 +1439,18 @@ Without a "dirname", the current line is information is elided). With a "dirname", the specified directory name is used. +The "gn" map will take the word below the cursor and use that for +changing the top of the tree listing. + NETRW CLEAN *netrw-clean* *:NetrwClean* {{{2 -With :NetrwClean one may easily remove netrw from one's home directory; +With NetrwClean one may easily remove netrw from one's home directory; more precisely, from the first directory on your |'runtimepath'|. -With :NetrwClean!, netrw will remove netrw from all directories on your -|'runtimepath'|. +With NetrwClean!, netrw will attempt to remove netrw from all directories on +your |'runtimepath'|. Of course, you have to have write/delete permissions +correct to do this. With either form of the command, netrw will first ask for confirmation that the removal is in fact what you want to do. If netrw doesn't have @@ -1456,6 +1467,7 @@ operating system). Netrw allows one to * when Exploring, hit the "x" key * when editing, hit gx with the cursor atop the special filename < (latter not available if the |g:netrw_nogx| variable exists) + Netrw determines which special handler by the following method: * if |g:netrw_browsex_viewer| exists, then it will be used to attempt to @@ -1631,19 +1643,23 @@ DIRECTORY EXPLORATION COMMANDS {{{2 of the current tab. It will open a netrw window on the current directory if [dir] is omitted; a :Lexplore [dir] will show the specified directory in the left-hand side browser display no matter - from which window the command is issued. By default, :Lexplore will - change an uninitialized |g:netrw_chgwin| to 2; edits will thus - preferentially be made in window#2. - The [N] specifies a |g:netrw_winsize| just for the new :Lexplore + from which window the command is issued. + + By default, :Lexplore will change an uninitialized |g:netrw_chgwin| + to 2; edits will thus preferentially be made in window#2. + + The [N] specifies a |g:netrw_winsize| just for the new :Lexplore window. - Those who like this method often also like tree style displays; + + Those who like this method often also often like tree style displays; see |g:netrw_liststyle|. - Also see: |netrw-C| |g:netrw_chgwin| |g:netrw_winsize| - |netrw-p| |netrw-P| |g:netrw_browse_split| + Also see: |netrw-C| |g:netrw_browse_split| |g:netrw_wiw| + |netrw-p| |netrw-P| |g:netrw_chgwin| + |netrw-c-tab| |g:netrw_winsize| :[N]Lexplore! is like :Lexplore, except that the full-height Explorer window - will open on the right hand side, and an uninitialized |g:netrw_chgwin| + will open on the right hand side and an uninitialized |g:netrw_chgwin| will be set to 1. *netrw-:Sexplore* @@ -2127,19 +2143,18 @@ is unlikely to be fixed. UNMARKING FILES *netrw-mF* {{{2 - (also see |netrw-mf|) - -This command will unmark all files in the current buffer. One may also use -mf (|netrw-mf|) on a specific file to unmark just that file. + (also see |netrw-mf|, |netrw-mu|) + +The "mF" command will unmark all files in the current buffer. One may also use +mf (|netrw-mf|) on a specific, already marked, file to unmark just that file. MARKING FILES BY QUICKFIX LIST *netrw-qF* {{{2 (also see |netrw-mf|) -One may convert the |quickfix-error-lists| into a marked file list using -"qF". You may then proceed with commands such as me (|netrw-me|) to -edit them. Quickfix error lists are generated, for example, by calls -to |:vimgrep|. +One may convert |quickfix-error-lists| into a marked file list using "qF". +You may then proceed with commands such as me (|netrw-me|) to edit them. +Quickfix error lists are generated, for example, by calls to |:vimgrep|. MARKING FILES BY REGULAR EXPRESSION *netrw-mr* {{{2 @@ -2157,14 +2172,17 @@ MARKED FILES, ARBITRARY VIM COMMAND * (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the local marked-file list) -The "mv" map causes netrw execute an arbitrary vim command on each file -on the local marked file list, individually: +The "mv" map causes netrw to execute an arbitrary vim command on each file on +the local marked file list, individually: * 1split * sil! keepalt e file * run vim command * sil! keepalt wq! +A prompt, "Enter vim command: ", will be issued to elicit the vim command +you wish used. + MARKED FILES, ARBITRARY SHELL COMMAND *netrw-mx* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) @@ -2196,13 +2214,13 @@ command to be applied to all marked file command files -It is useful, for example, to select files and make a tarball: +This approach is useful, for example, to select files and make a tarball: > (mark files) mX Enter command: tar cf mynewtarball.tar - -The command that will be run in this example: +< +The command that will be run with this example: tar cf mynewtarball.tar 'file1' 'file2' ... @@ -2255,7 +2273,7 @@ MARKED FILES: EDITING *netrw-me* {{ (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 +The "me" command will place the marked files on the |arglist| and commence editing them. One may return the to explorer window with |:Rexplore|. (use |:n| and |:p| to edit next and previous files in the arglist) @@ -2263,26 +2281,33 @@ MARKED FILES: GREP *netrw-mg* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the global marked file list) -This command will apply |:vimgrep| to the marked files. +The "mg" command will apply |:vimgrep| to the marked files. The command will ask for the requested pattern; one may then enter: > /pattern/[g][j] ! /pattern/[g][j] pattern < -In the cases of "j" option usage as shown above, "mg" will winnow the current -marked file list to just those possessing the specified pattern. -Thus, one may use > - mr ...file-pattern - mg ..contents-pattern -to have a marked file list satisfying the file-pattern but containing the -desired contents-pattern. +With /pattern/, editing will start with the first item on the |quickfix| list +that vimgrep sets up (see |:copen|, |:cnext|, |:cprevious|). The |:vimgrep| +command is in use, so without 'g' each line is added to quickfix list only +once; with 'g' every match is included. + +With /pattern/j, "mg" will winnow the current marked file list to just those +marked files also possessing the specified pattern. Thus, one may use > + + mr ...file-pattern... + mg /pattern/j +< +to have a marked file list satisfying the file-pattern but also restricted to +files containing some desired pattern. + MARKED FILES: HIDING AND UNHIDING BY SUFFIX *netrw-mh* {{{2 (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 +The "mh" command extracts the suffices of the marked files and toggles their presence on the hiding list. Please note that marking the same suffix this way multiple times will result in the suffix's presence being toggled for each file (so an even quantity of marked files having the same suffix @@ -2311,16 +2336,16 @@ MARKED FILES: PRINTING *netrw-mp* { (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 -one-line window. +When "mp" is used, netrw will apply the |:hardcopy| command to marked files. +What netrw does is open each file in a one-line window, execute hardcopy, then +close the one-line window. MARKED FILES: SOURCING *netrw-ms* {{{2 (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) +With "ms", netrw will source the marked files (using vim's |:source| command) MARKED FILES: SETTING THE TARGET DIRECTORY *netrw-mt* {{{2 @@ -2343,6 +2368,9 @@ Set the marked file copy/move-to target This command uses ||, so spaces in the directory name are permitted without escaping. + * With mouse-enabled vim or with gvim, one may select a target by using + + There is only one copy/move-to target at a time in a vim session; ie. the target is a script variable (see |s:var|) and is shared between all netrw windows (in an instance of vim). @@ -2419,9 +2447,13 @@ Related topics: MARKED FILES: UNMARKING *netrw-mu* {{{2 - (See |netrw-mf| and |netrw-mr| for how to mark files) - -The "mu" mapping will unmark all currently marked files. + (See |netrw-mf|, |netrw-mF|) + +The "mu" mapping will unmark all currently marked files. This command differs +from "mF" as the latter only unmarks files in the current directory whereas +"mu" will unmark global and all buffer-local marked files. +(see |netrw-mF|) + *netrw-browser-settings* NETRW BROWSER VARIABLES *netrw-browser-options* *netrw-browser-var* {{{2 @@ -2726,6 +2758,11 @@ your browsing preferences. (see also: | evaluation will be suppressed (see |'ballooneval'|) + *g:netrw_usetab* if this variable exists and is non-zero, then + the map supporting shrinking/expanding a + Lexplore or netrw window will be enabled. + (see |netrw-c-tab|) + *g:netrw_remote_mkdir* command for making a remote directory via ftp (also see |g:netrw_mkdir_cmd|) default: "mkdir" @@ -2762,7 +2799,8 @@ your browsing preferences. (see also: | |netrw-ctrl-r| to use for its server. default: "NETRWSERVER" - *g:netrw_sort_by* sort by "name", "time", or "size" + *g:netrw_sort_by* sort by "name", "time", "size", or + "exten". default: "name" *g:netrw_sort_direction* sorting direction: "normal" or "reverse" @@ -2874,6 +2912,10 @@ your browsing preferences. (see also: | take effect, for example). default: 50 (for 50%) + *g:netrw_wiw* =1 specifies the minimum window width to use + when shrinking a netrw/Lexplore window + (see |netrw-c-tab|). + *g:netrw_xstrlen* Controls how netrw computes string lengths, including multi-byte characters' string length. (thanks to N Weibull, T Mechelynck) @@ -2919,7 +2961,7 @@ help on what each of the variables do. ============================================================================== -OBTAINING A FILE *netrw-O* {{{2 +OBTAINING A FILE *netrw-obtain* *netrw-O* {{{2 If there are no marked files: @@ -2949,7 +2991,7 @@ Related topics: * To automatically make the currently browsed directory the current directory, see |g:netrw_keepdir|. - *netrw-createfile* + *netrw-newfile* *netrw-createfile* OPEN A NEW FILE IN NETRW'S CURRENT DIRECTORY *netrw-%* {{{2 To open a new file in netrw's current directory, press "%". This map @@ -2981,10 +3023,13 @@ These will: will use only 30% of the columns available; the rest of the window is used for the preview window. -Also see: |g:netrw_chgwin| |netrw-P| - - -PREVIOUS WINDOW *netrw-P* *netrw-prvwin* {{{2 + Related: if you like this idea, you may also find :Lexplore + (|netrw-:Lexplore|) or |g:netrw_chgwin| of interest + +Also see: |g:netrw_chgwin| |netrw-P| |'previewwindow'| + + +PREVIOUS WINDOW *netrw-P* *netrw-prvwin* {{{2 To edit a file or directory in the previously used (last accessed) window (see :he |CTRL-W_p|), press a "P". If there's only one window, then the one window @@ -3006,7 +3051,7 @@ Associated setting variables: Also see: |g:netrw_chgwin| |netrw-p| -REFRESHING THE LISTING *netrw-ctrl-l* *netrw-ctrl_l* {{{2 +REFRESHING THE LISTING *netrw-refresh* *netrw-ctrl-l* *netrw-ctrl_l* {{{2 To refresh either a local or remote directory listing, press ctrl-l () or hit the when atop the ./ directory entry in the listing. One may also @@ -3026,11 +3071,12 @@ RENAMING FILES OR DIRECTORIES *netrw-mov If there are no marked files: (see |netrw-mf|) - Renaming/moving files and directories involves moving the cursor to the + Renaming files and directories involves moving the cursor to the file/directory to be moved (renamed) and pressing "R". You will then be - queried for where you want the file/directory to be moved. You may select + queried for what you want the file/directory to be renamed to You may select a range of lines with the "V" command (visual selection), and then - pressing "R". + press "R"; you will be queried for each file as to what you want it + renamed to. If there are marked files: (see |netrw-mf|) @@ -3048,6 +3094,14 @@ If there are marked files: (see |netrw- This example will mark all *.c files and then rename them to *.cpp files. + The ctrl-X character has special meaning for renaming files: > + + : a single ctrl-x tells netrw to ignore the portion of the response + lying between the last '/' and the ctrl-x. + + : a pair of contiguous ctrl-x's tells netrw to ignore any + portion of the string preceding the double ctrl-x's. +< WARNING:~ Note that moving files is a dangerous operation; copies are safer. That's @@ -3055,13 +3109,13 @@ If there are marked files: (see |netrw- the copy fails and the delete does not, you may lose the file. Use at your own risk. -The g:netrw_rename_cmd variable is used to implement renaming. By default its -value is: +The g:netrw_rename_cmd variable is used to implement remote renaming. By +default its value is: ssh HOSTNAME mv One may rename a block of files and directories by selecting them with -the V (|linewise-visual|). +V (|linewise-visual|) when using thin style SELECTING SORTING STYLE *netrw-s* *netrw-sort* {{{2 @@ -3074,18 +3128,19 @@ Related topics: |netrw-r| Associated setting variables: |g:netrw_sort_by| |g:netrw_sort_sequence| -SETTING EDITING WINDOW *netrw-C* *netrw-:NetrwC* {{{2 +SETTING EDITING WINDOW *netrw-editwindow* *netrw-C* *netrw-:NetrwC* {{{2 One may select a netrw window for editing with the "C" mapping, using the -:NetrwC [win#] command, or by setting g:netrw_chgwin to the selected window +:NetrwC [win#] command, or by setting |g:netrw_chgwin| to the selected window number. Subsequent selection of a file to edit (|netrw-cr|) will use that window. - * C by itself, will select the current window for editing via - |netrw-cr| - - * [count]C the count will be used as the window number to be used - for editing via |netrw-cr|. + * C : by itself, will select the current window holding a netrw buffer + for editing via |netrw-cr|. The C mapping is only available while in + netrw buffers. + + * [count]C : the count will be used as the window number to be used + for subsequent editing via |netrw-cr|. * :NetrwC will set |g:netrw_chgwin| to the current window @@ -3094,12 +3149,91 @@ window. Using > let g:netrw_chgwin= -1 -will restore the default editing behavior (ie. use the current window). +will restore the default editing behavior +(ie. editing will use the current window). Related topics: |netrw-cr| |g:netrw_browse_split| Associated setting variables: |g:netrw_chgwin| +SHRINKING OR EXPANDING A NETRW OR LEXPLORE WINDOW *netrw-c-tab* {{{2 + +The key will toggle a netrw or |:Lexplore| window's width, +but only if |g:netrw_usetab| exists and is non-zero (and, of course, +only if your terminal supports differentiating from a plain +). + + * If the current window is a netrw window, toggle its width + (between |g:netrw_wiw| and its original width) + + * Else if there is a |:Lexplore| window in the current tab, toggle + its width + + * Else bring up a |:Lexplore| window + +If |g:netrw_usetab| exists or is zero, or if there is a pre-existing mapping +for , then the will not be mapped. One may map something other +than a , too: (but you'll still need to have had g:netrw_usetab set) > + + nmap (whatever) NetrwShrink +< +Related topics: |:Lexplore| +Associated setting variable: |g:netrw_usetab| + + +USER SPECIFIED MAPS *netrw-usermaps* {{{1 + +One may make customized user maps. Specify a variable, |g:Netrw_UserMaps|, +to hold a |List| of lists of keymap strings and function names: > + + [["keymap-sequence","ExampleUserMapFunc"],...] +< +When netrw is setting up maps for a netrw buffer, if |g:Netrw_UserMaps| +exists, then the internal function netrw#UserMaps(islocal) is called. +This function goes through all the entries in the |g:Netrw_UserMaps| list: + + * sets up maps: > + nno KEYMAP-SEQUENCE + :call s:UserMaps(islocal,"ExampleUserMapFunc") +< * refreshes if result from that function call is the string + "refresh" + * if the result string is not "", then that string will be + executed (:exe result) + * if the result is a List, then the above two actions on results + will be taken for every string in the result List + +The user function is passed one argument; it resembles > + + fun! ExampleUserMapFunc(islocal) +< +where a:islocal is 1 if its a local-directory system call or 0 when +remote-directory system call. + +Use netrw#Expose("varname") to access netrw-internal (script-local) + variables. +Use netrw#Modify("varname",newvalue) to change netrw-internal variables. +Use netrw#Call("funcname"[,args]) to call a netrw-internal function with + specified arguments. + +Example: Get a copy of netrw's marked file list: > + + let netrwmarkfilelist= netrw#Expose("netrwmarkfilelist") +< +Example: Modify the value of netrw's marked file list: > + + call netrw#Modify("netrwmarkfilelist",[]) +< +Example: Clear netrw's marked file list via a mapping on gu > + " ExampleUserMap: {{{2 + fun! ExampleUserMap(islocal) + call netrw#Modify("netrwmarkfilelist",[]) + call netrw#Modify('netrwmarkfilemtch_{bufnr("%")}',"") + let retval= ["refresh"] + return retval + endfun + let g:Netrw_UserMaps= [["gu","ExampleUserMap"]] +< + 10. Problems and Fixes *netrw-problems* {{{1 (This section is likely to grow as I get feedback) @@ -3274,6 +3408,7 @@ 10. Problems and Fixes *netrw-proble The first one (|g:netrw_ssh_cmd|) is the most important; most of the others will use the string in g:netrw_ssh_cmd by default. + *netrw-p9* *netrw-ml_get* P9. I'm browsing, changing directory, and bang! ml_get errors appear and I have to kill vim. Any way around this? @@ -3300,6 +3435,14 @@ 10. Problems and Fixes *netrw-proble P11. I want to have two windows; a thin one on the left and my editing window on the right. How may I accomplish this? + You probably want netrw running as in a side window. If so, you + will likely find that ":[N]Lexplore" does what you want. The + optional "[N]" allows you to select the quantity of columns you + wish the Lexplorer window to start with (see |g:netrw_winsize| + for how this parameter works). + + Previous solution: + * Put the following line in your <.vimrc>: let g:netrw_altv = 1 * Edit the current directory: :e . @@ -3313,6 +3456,7 @@ 10. Problems and Fixes *netrw-proble in the browser window and then press the to select the file. + *netrw-p12* P12. My directory isn't sorting correctly, or unwanted letters are appearing in the listed filenames, or things aren't lining @@ -3390,7 +3534,7 @@ 10. Problems and Fixes *netrw-proble to open a swap file. (romainl) It looks like you are starting Vim from a protected - directory. Start if from your $HOME or another writable + directory. Start netrw from your $HOME or other writable directory. *netrw-p17* @@ -3414,6 +3558,58 @@ 10. Problems and Fixes *netrw-proble "Using Vim to Remotely Edit A File on ServerB Only Accessible From ServerA" + *netrw-P19* + P19. How do I get numbering on in directory listings? + With |g:netrw_bufsettings|, you can control netrw's buffer + settings; try putting > + let g:netrw_bufsettings="noma nomod nu nobl nowrap ro nornu" +< in your .vimrc. If you'd like to have relative numbering + instead, try > + let g:netrw_bufsettings="noma nomod nonu nobl nowrap ro rnu" +< + *netrw-P20* + P20. How may I have gvim start up showing a directory listing? + Try putting the following code snippet into your .vimrc: > + augroup VimStartup + au! + au VimEnter * if expand("%") == "" && argc() == 0 && + \ (v:servername =~ 'GVIM\d*' || v:servername == "") + \ | e . | endif + augroup END +< You may use Lexplore instead of "e" if you're so inclined. + This snippet assumes that you have client-server enabled + (ie. a "huge" vim version). + + *netrw-P21* + P21. I've made a directory (or file) with an accented character, but + netrw isn't letting me enter that directory/read that file: + + Its likely that the shell or o/s is using a different encoding + than you have vim (netrw) using. A patch to vim supporting + "systemencoding" may address this issue in the future; for + now, just have netrw use the proper encoding. For example: > + + au FileType netrw set enc=latin1 +< + *netrw-P22* + P22. I get an error message when I try to copy or move a file: + + **error** (netrw) tried using g:netrw_localcopycmd; it doesn't work! + + What's wrong? + + Netrw uses several system level commands to do things (see + + |g:netrw_localcopycmd|, |g:netrw_localmovecmd|, + |g:netrw_localrmdir|, |g:netrw_mkdir_cmd|). + + You may need to adjust the default commands for one or more of + these commands by setting them properly in your .vimrc. Another + source of difficulty is that these commands use vim's local + directory, which may not be the same as the browsing directory + shown by netrw (see |g:netrw_keepdir|). + + ============================================================================== 11. Debugging Netrw Itself *netrw-debug* {{{1 @@ -3504,6 +3700,46 @@ netrw: ============================================================================== 12. History *netrw-history* {{{1 + v154: Feb 26, 2015 * (Yuri Kanivetsky) reported a situation where + a file was not treated properly as a file + due to g:netrw_keepdir == 1 + Mar 25, 2015 * (requested by Ben Friz) one may now sort by + extension + Mar 28, 2015 * (requested by Matt Brooks) netrw has a lot + of buffer-local mappings; however, some + plugins (such as vim-surround) set up + conflicting mappings that cause vim to wait. + The "" modifier has been included + with most of netrw's mappings to avoid that + delay. + Jun 26, 2015 * |netrw-gn| mapping implemted + * :Ntree NotADir resulted in having + the tree listing expand in the error messages + window. Fixed. + Jun 29, 2015 * Attempting to delete a file remotely caused + an error with "keepsol" mentioned; fixed. + Jul 08, 2015 * Several changes to keep the |:jumps| table + correct when working with + |g:netrw_fastbrowse| set to 2 + * wide listing with accented characters fixed + (using %-S instead of %-s with a |printf()| + Jul 13, 2015 * (Daniel Hahler) CheckIfKde() could be true + but kfmclient not installed. Changed order + in netrw#BrowseX(): checks if kde and + kfmclient, then will use xdg-open on a unix + system (if xdg-open is executable) + Aug 11, 2015 * (McDonnell) tree listing mode wouldn't + select a file in a open subdirectory. + * (McDonnell) when multiple subdirectories + were concurrently open in tree listing + mode, a ctrl-L wouldn't refresh properly. + * The netrw:target menu showed duplicate + entries + Oct 13, 2015 * (mattn) provided an exception to handle + windows with shellslash set but no shell + Oct 23, 2015 * if g:netrw_usetab and now used + to control whether NetrwShrink is used + (see |netrw-c-tab|) v153: May 13, 2014 * added another |g:netrw_ffkeep| usage {{{2 May 14, 2014 * changed s:PerformListing() so that it always sets ft=netrw for netrw buffers diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1,4 +1,4 @@ -*syntax.txt* For Vim version 7.4. Last change: 2015 Sep 29 +*syntax.txt* For Vim version 7.4. Last change: 2015 Oct 17 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1081,7 +1081,7 @@ CPP *cpp.vim* *ft-cpp-syntax* Most of things are same as |ft-c-syntax|. Variable Highlight ~ -cpp_no_c11 don't highlight C++11 standard items +cpp_no_cpp11 don't highlight C++11 standard items CSH *csh.vim* *ft-csh-syntax* @@ -3248,7 +3248,8 @@ improve screen updating rates (see |:syn The g:vimsyn_embed option allows users to select what, if any, types of embedded script highlighting they wish to have. > - g:vimsyn_embed == 0 : don't embed any scripts + g:vimsyn_embed == 0 : don't support any embedded scripts + g:vimsyn_embed =~ 'l' : support embedded lua g:vimsyn_embed =~ 'm' : support embedded mzscheme g:vimsyn_embed =~ 'p' : support embedded perl g:vimsyn_embed =~ 'P' : support embedded python @@ -3266,6 +3267,7 @@ Some folding is now supported with synta g:vimsyn_folding == 0 or doesn't exist: no syntax-based folding g:vimsyn_folding =~ 'a' : augroups g:vimsyn_folding =~ 'f' : fold functions + g:vimsyn_folding =~ 'l' : fold lua script g:vimsyn_folding =~ 'm' : fold mzscheme script g:vimsyn_folding =~ 'p' : fold perl script g:vimsyn_folding =~ 'P' : fold python script diff --git a/runtime/doc/tags b/runtime/doc/tags --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -2714,6 +2714,14 @@ 90.5 usr_90.txt /*90.5* :rviminfo starting.txt /*:rviminfo* :s change.txt /*:s* :s% change.txt /*:s%* +:sI change.txt /*:sI* +:sIc change.txt /*:sIc* +:sIe change.txt /*:sIe* +:sIg change.txt /*:sIg* +:sIl change.txt /*:sIl* +:sIn change.txt /*:sIn* +:sIp change.txt /*:sIp* +:sIr change.txt /*:sIr* :sN windows.txt /*:sN* :sNext windows.txt /*:sNext* :s\= change.txt /*:s\\=* @@ -2745,6 +2753,13 @@ 90.5 usr_90.txt /*90.5* :sbr windows.txt /*:sbr* :sbrewind windows.txt /*:sbrewind* :sbuffer windows.txt /*:sbuffer* +:sc change.txt /*:sc* +:scI change.txt /*:scI* +:sce change.txt /*:sce* +:scg change.txt /*:scg* +:sci change.txt /*:sci* +:scl change.txt /*:scl* +:scp change.txt /*:scp* :scr repeat.txt /*:scr* :scripte repeat.txt /*:scripte* :scriptencoding repeat.txt /*:scriptencoding* @@ -2778,8 +2793,20 @@ 90.5 usr_90.txt /*90.5* :sfind windows.txt /*:sfind* :sfir windows.txt /*:sfir* :sfirst windows.txt /*:sfirst* +:sg change.txt /*:sg* +:sgI change.txt /*:sgI* +:sgc change.txt /*:sgc* +:sge change.txt /*:sge* +:sgi change.txt /*:sgi* +:sgl change.txt /*:sgl* +:sgn change.txt /*:sgn* +:sgp change.txt /*:sgp* +:sgr change.txt /*:sgr* :sh various.txt /*:sh* :shell various.txt /*:shell* +:si change.txt /*:si* +:sic change.txt /*:sic* +:sie change.txt /*:sie* :sig sign.txt /*:sig* :sign sign.txt /*:sign* :sign-define sign.txt /*:sign-define* @@ -2794,6 +2821,9 @@ 90.5 usr_90.txt /*90.5* :silent various.txt /*:silent* :sim gui_w32.txt /*:sim* :simalt gui_w32.txt /*:simalt* +:sin change.txt /*:sin* +:sip change.txt /*:sip* +:sir change.txt /*:sir* :sl various.txt /*:sl* :sla windows.txt /*:sla* :slast windows.txt /*:slast* @@ -2838,8 +2868,16 @@ 90.5 usr_90.txt /*90.5* :split_f windows.txt /*:split_f* :spr windows.txt /*:spr* :sprevious windows.txt /*:sprevious* +:sr change.txt /*:sr* +:srI change.txt /*:srI* +:src change.txt /*:src* :sre windows.txt /*:sre* :srewind windows.txt /*:srewind* +:srg change.txt /*:srg* +:sri change.txt /*:sri* +:srl change.txt /*:srl* +:srn change.txt /*:srn* +:srp change.txt /*:srp* :st starting.txt /*:st* :sta windows.txt /*:sta* :stag windows.txt /*:stag* @@ -5942,6 +5980,7 @@ g0 motion.txt /*g0* g8 various.txt /*g8* g: eval.txt /*g:* g:NetrwTopLvlMenu pi_netrw.txt /*g:NetrwTopLvlMenu* +g:Netrw_UserMaps pi_netrw.txt /*g:Netrw_UserMaps* g:Netrw_corehandler pi_netrw.txt /*g:Netrw_corehandler* g:Netrw_funcref pi_netrw.txt /*g:Netrw_funcref* g:ada#Comment ft_ada.txt /*g:ada#Comment* @@ -6104,8 +6143,10 @@ 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* g:netrw_use_nt_rcp pi_netrw.txt /*g:netrw_use_nt_rcp* +g:netrw_usetab pi_netrw.txt /*g:netrw_usetab* g:netrw_win95ftp pi_netrw.txt /*g:netrw_win95ftp* g:netrw_winsize pi_netrw.txt /*g:netrw_winsize* +g:netrw_wiw pi_netrw.txt /*g:netrw_wiw* g:netrw_xstrlen pi_netrw.txt /*g:netrw_xstrlen* g:sh_isk syntax.txt /*g:sh_isk* g:sh_noisk syntax.txt /*g:sh_noisk* @@ -7064,6 +7105,10 @@ netrw-D pi_netrw.txt /*netrw-D* netrw-O pi_netrw.txt /*netrw-O* netrw-P pi_netrw.txt /*netrw-P* netrw-P18 pi_netrw.txt /*netrw-P18* +netrw-P19 pi_netrw.txt /*netrw-P19* +netrw-P20 pi_netrw.txt /*netrw-P20* +netrw-P21 pi_netrw.txt /*netrw-P21* +netrw-P22 pi_netrw.txt /*netrw-P22* netrw-R pi_netrw.txt /*netrw-R* netrw-S pi_netrw.txt /*netrw-S* netrw-Tb pi_netrw.txt /*netrw-Tb* @@ -7083,6 +7128,7 @@ netrw-browser-settings pi_netrw.txt /*ne netrw-browser-var pi_netrw.txt /*netrw-browser-var* netrw-browsing pi_netrw.txt /*netrw-browsing* netrw-c pi_netrw.txt /*netrw-c* +netrw-c-tab pi_netrw.txt /*netrw-c-tab* netrw-cadaver pi_netrw.txt /*netrw-cadaver* netrw-chgup pi_netrw.txt /*netrw-chgup* netrw-clean pi_netrw.txt /*netrw-clean* @@ -7104,6 +7150,7 @@ netrw-dir pi_netrw.txt /*netrw-dir* netrw-dirlist pi_netrw.txt /*netrw-dirlist* netrw-downdir pi_netrw.txt /*netrw-downdir* netrw-edithide pi_netrw.txt /*netrw-edithide* +netrw-editwindow pi_netrw.txt /*netrw-editwindow* netrw-ex pi_netrw.txt /*netrw-ex* netrw-explore pi_netrw.txt /*netrw-explore* netrw-explore-cmds pi_netrw.txt /*netrw-explore-cmds* @@ -7119,6 +7166,7 @@ netrw-getftype pi_netrw.txt /*netrw-getf netrw-gf pi_netrw.txt /*netrw-gf* netrw-gh pi_netrw.txt /*netrw-gh* netrw-gitignore pi_netrw.txt /*netrw-gitignore* +netrw-gn pi_netrw.txt /*netrw-gn* netrw-gp pi_netrw.txt /*netrw-gp* netrw-grep pi_netrw.txt /*netrw-grep* netrw-gx pi_netrw.txt /*netrw-gx* @@ -7164,12 +7212,14 @@ netrw-mv pi_netrw.txt /*netrw-mv* netrw-mx pi_netrw.txt /*netrw-mx* netrw-mz pi_netrw.txt /*netrw-mz* netrw-netrc pi_netrw.txt /*netrw-netrc* +netrw-newfile pi_netrw.txt /*netrw-newfile* netrw-nexplore pi_netrw.txt /*netrw-nexplore* netrw-noload pi_netrw.txt /*netrw-noload* netrw-nread pi_netrw.txt /*netrw-nread* netrw-ntree pi_netrw.txt /*netrw-ntree* netrw-nwrite pi_netrw.txt /*netrw-nwrite* netrw-o pi_netrw.txt /*netrw-o* +netrw-obtain pi_netrw.txt /*netrw-obtain* netrw-options pi_netrw.txt /*netrw-options* netrw-p pi_netrw.txt /*netrw-p* netrw-p1 pi_netrw.txt /*netrw-p1* @@ -7211,6 +7261,7 @@ netrw-quickmaps pi_netrw.txt /*netrw-qui netrw-r pi_netrw.txt /*netrw-r* netrw-read pi_netrw.txt /*netrw-read* netrw-ref pi_netrw.txt /*netrw-ref* +netrw-refresh pi_netrw.txt /*netrw-refresh* netrw-rename pi_netrw.txt /*netrw-rename* netrw-reverse pi_netrw.txt /*netrw-reverse* netrw-rexplore pi_netrw.txt /*netrw-rexplore* @@ -7237,6 +7288,7 @@ netrw-transparent pi_netrw.txt /*netrw-t netrw-u pi_netrw.txt /*netrw-u* netrw-updir pi_netrw.txt /*netrw-updir* netrw-urls pi_netrw.txt /*netrw-urls* +netrw-usermaps pi_netrw.txt /*netrw-usermaps* netrw-userpass pi_netrw.txt /*netrw-userpass* netrw-v pi_netrw.txt /*netrw-v* netrw-var pi_netrw.txt /*netrw-var* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.4. Last change: 2015 Oct 13 +*todo.txt* For Vim version 7.4. Last change: 2015 Oct 30 VIM REFERENCE MANUAL by Bram Moolenaar @@ -83,18 +83,48 @@ work. (ZyX, 2013 Sep 28) Problem using ":try" inside ":execute". (ZyX, 2013 Sep 15) +Netrw update. (Charles 2015 Oct 23) + +Patch to use local value of 'errorformat' in :cexpr. (Christian Brabandt, +2015 Oct 16) Only do this for :lexpr ? + +Update Oracle syntax file from: +https://github.com/chrisbra/vim-sqloracle-syntax/blob/master/syntax/sqloracle.vim + ":cd C:\Windows\System32\drivers\etc*" does not work, even though the directory exists. (Sergio Gallelli, 2013 Dec 29) +Updated syntax files. (Charles Campbell, 2015 Oct 19) + +Patch to include .desktop files in the distribution. PR #455. + +Better changelog syntax file. (Martin Florian, 2015 Oct 25) + +Better readline syntax file. (Raphael Bazaud, 2015 Oct 25) + +English spell checking has an error. Updating doesn't work. +(Dominique Pelle, 2015 Oct 15) +Hint for new URL: Christian Brabandt, 2015 Oct 15. +But that file looks old. + Using ":windo" to set options in all windows has the side effect that it changes the window layout and the current window. Make a variant that saves and restores. Use in the matchparen plugin. Perhaps we can use ":silent window"? +Patch for documentation mistakes. (Hirohito Higashi, 2015 Oct 22) + Illegal memory access, requires ASAN to see. (Dominique Pelle, 2015 Jul 28) Gvim: when both Tab and CTRL-I are mapped, use CTRL-I not for Tab. +Patch for yaml indent, #458. + +Patch for Python to add isatty, readable, etc. (PR #464) + +Patch to add options for specifying dll names. (Kazuki Sakamoto, 2015 Oct 16) +PR #452 Check if it's secure (can't set from modeline). + Unexpected delay when using CTRL-O u. It's not timeoutlen. (Gary Johnson, 2015 Aug 28) @@ -112,6 +142,12 @@ wrong name. (Aram, 2014 Nov 7) Vim 7.4. Can't recognize the $ProgramFiles(x86) environment variable. Recognize it specifically? First try with the parens, then without. +Patch to add 'tagcase' option, whether to ignore case for tags. +(Gary Johnson, 2015 Oct 17) + +Patch to fix "." after CTRL-A in Visual block mode. (Ozaki Kiichi, 2015 Oct +24) + Value returned by virtcol() changes depending on how lines wrap. This is inconsistent with the documentation. @@ -145,6 +181,8 @@ wildcards. Add a ":nowild" command modi Proposal to make options.txt easier to read. (Arnaud Decara, 2015 Aug 5) Update Aug 14. +Crash in :cnext on MS-Windows. (Ben Fritz, 2015 Oct 27) + Patch for problem with restoring screen on Windows. (Nobuhiro Takasaki, 2015 Sep 10) @@ -199,6 +237,9 @@ Doesn't work completely (Dominique Orban Patch to add a "literal" argument to bufnr(). (Olaf Dabrunz, 2015 Aug 4) +Cannot execute the shell when it's in a directory with a space. +Issue #459. + When a session file is created and there are "nofile" buffers, these are not filled. Need to trigger BufReadCmd autocommands. Also handle deleting the initial empty buffer better. (ZyX, 2015 March 8) @@ -300,6 +341,10 @@ them: ":repeats". Patch for glob(), adding slash to normal files. (Ingo Karkat, 2014 Dec 22) +When entering and leaving the preview window autocommands are triggered, but +these may not work well. Perhaps set a flag to indicate that the preview +window is involved? (John Otter, 2015 Oct 27) + Using "." to repeat an Ex command puts that command in history. Probably should not happen. If the command is the result of a mapping it's not put in history either. (Jacob Niehus, 2014 Nov 2) diff --git a/runtime/doc/usr_43.txt b/runtime/doc/usr_43.txt --- a/runtime/doc/usr_43.txt +++ b/runtime/doc/usr_43.txt @@ -1,4 +1,4 @@ -*usr_43.txt* For Vim version 7.4. Last change: 2008 Dec 28 +*usr_43.txt* For Vim version 7.4. Last change: 2015 Oct 23 VIM USER MANUAL - by Bram Moolenaar @@ -46,6 +46,7 @@ 2. Create the file "~/.vim/ftplugin/c.vi setlocal softtabstop=4 noremap c o/**************/ + let b:undo_ftplugin = "setl softtabstop< | unmap c" Try editing a C file. You should notice that the 'softtabstop' option is set to 4. But when you edit another file it's reset to the default zero. That is @@ -60,6 +61,11 @@ buffer. This works with any mapping com || in the mapping is replaced with the value of the "maplocalleader" variable. +The line to set b:undo_ftplugin is for when the filetype is set to another +value. In that case you will want to undo your preferences. The +b:undo_ftplugin variable is executed as a command. Watch out for characters +with a special meaning inside a string, such as a backslash. + You can find examples for filetype plugins in this directory: > $VIMRUNTIME/ftplugin/ diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim --- a/runtime/plugin/netrwPlugin.vim +++ b/runtime/plugin/netrwPlugin.vim @@ -20,19 +20,7 @@ if &cp || exists("g:loaded_netrwPlugin") finish endif -let g:loaded_netrwPlugin = "v153" -if v:version < 702 - echohl WarningMsg - echo "***warning*** you need vim version 7.2 for this version of netrw" - echohl None - finish -endif -if v:version < 703 || (v:version == 703 && !has("patch465")) - echohl WarningMsg - echo "***warning*** this version of netrw needs vim 7.3.465 or later" - echohl Normal - finish -endif +let g:loaded_netrwPlugin = "v154" let s:keepcpo = &cpo set cpo&vim "DechoRemOn @@ -102,6 +90,12 @@ if !exists("g:netrw_nogx") vno NetrwBrowseXVis :call netrw#BrowseXVis() endif endif +if exists("g:netrw_usetab") && g:netrw_usetab + if maparg('','n') == "" + nmap NetrwShrink + endif + nno NetrwShrink :call netrw#Shrink() +endif " --------------------------------------------------------------------- " LocalBrowse: invokes netrw#LocalBrowseCheck() on directory buffers {{{2 @@ -135,15 +129,19 @@ fun! s:LocalBrowse(dirname) elseif isdirectory(a:dirname) " call Decho("(LocalBrowse) dirname<".a:dirname."> ft=".&ft." (isdirectory, not amiga)") " call Dredir("LocalBrowse ft last set: ","verbose set ft") +" call Decho("(s:LocalBrowse) COMBAK#23: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col(".")) sil! call netrw#LocalBrowseCheck(a:dirname) +" call Decho("(s:LocalBrowse) COMBAK#24: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col(".")) if exists("w:netrw_bannercnt") && line('.') < w:netrw_bannercnt exe w:netrw_bannercnt +" call Decho("(s:LocalBrowse) COMBAK#25: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col(".")) endif else " not a directory, ignore it " call Decho("(LocalBrowse) dirname<".a:dirname."> not a directory, ignoring...") endif +" call Decho("(s:LocalBrowse) COMBAK#26: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col(".")) " call Dret("s:LocalBrowse") endfun diff --git a/runtime/syntax/autohotkey.vim b/runtime/syntax/autohotkey.vim --- a/runtime/syntax/autohotkey.vim +++ b/runtime/syntax/autohotkey.vim @@ -1,7 +1,8 @@ " Vim syntax file " Language: AutoHotkey script file -" Maintainer: Nikolai Weibull -" Latest Revision: 2008-06-22 +" Maintainer: SungHyun Nam +" Previous Maintainer: Nikolai Weibull +" Latest Revision: 2015-10-29 if exists("b:current_syntax") finish @@ -179,6 +180,7 @@ syn keyword autohotkeyRepeat syn keyword autohotkeyConditional \ IfExist IfNotExist If IfEqual IfLess IfGreater Else + \ IfWinExist IfWinNotExist syn match autohotkeyPreProcStart \ nextgroup= diff --git a/runtime/syntax/netrw.vim b/runtime/syntax/netrw.vim --- a/runtime/syntax/netrw.vim +++ b/runtime/syntax/netrw.vim @@ -19,7 +19,6 @@ syn cluster NetrwTreeGroup contains=netr syn match netrwPlain "\(\S\+ \)*\S\+" contains=netrwLink,@NoSpell syn match netrwSpecial "\%(\S\+ \)*\S\+[*|=]\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell syn match netrwDir "\.\{1,2}/" contains=netrwClassify,@NoSpell -"syn match netrwDir "\%(\S\+ \)*\S\+/" contains=netrwClassify,@NoSpell syn match netrwDir "\%(\S\+ \)*\S\+/\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell syn match netrwSizeDate "\<\d\+\s\d\{1,2}/\d\{1,2}/\d\{4}\s" skipwhite contains=netrwDateSep,@NoSpell nextgroup=netrwTime syn match netrwSymLink "\%(\S\+ \)*\S\+@\ze\%(\s\{2,}\|$\)" contains=netrwClassify,@NoSpell diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim --- a/runtime/syntax/tex.vim +++ b/runtime/syntax/tex.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: TeX " Maintainer: Charles E. Campbell -" Last Change: Jun 11, 2015 -" Version: 87 +" Last Change: Oct 19, 2015 +" Version: 89 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX " " Notes: {{{1 @@ -122,6 +122,11 @@ endif if g:tex_fold_enabled && &fdm == "manual" setl fdm=syntax endif +if g:tex_fold_enabled && has("folding") + com! -nargs=* TexFold fold +else + com! -nargs=* TexFold +endif " (La)TeX keywords: uses the characters 0-9,a-z,A-Z,192-255 only... {{{1 " but _ is the only one that causes problems. @@ -142,7 +147,7 @@ endif " Clusters: {{{1 " -------- syn cluster texCmdGroup contains=texCmdBody,texComment,texDefParm,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texBeginEnd,texBeginEndName,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle -if !exists("s:tex_no_error") || !s:tex_no_error +if !s:tex_no_error syn cluster texCmdGroup add=texMathError endif syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement @@ -156,15 +161,16 @@ else syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,texStyleMatcher endif -syn cluster texPreambleMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texMathZoneZ +syn cluster texPreambleMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTitle,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texMathZoneZ syn cluster texRefGroup contains=texMatcher,texComment,texDelimiter if !exists("g:tex_no_math") +syn cluster texPreambleMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTitle,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texMathZoneZ syn cluster texMathZones contains=texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ syn cluster texMatchGroup add=@texMathZones syn cluster texMathDelimGroup contains=texMathDelimBad,texMathDelimKey,texMathDelimSet1,texMathDelimSet2 syn cluster texMathMatchGroup contains=@texMathZones,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMathDelim,texMathMatcher,texMathOper,texNewCmd,texNewEnv,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone syn cluster texMathZoneGroup contains=texComment,texDelimiter,texLength,texMathDelim,texMathMatcher,texMathOper,texMathSymbol,texMathText,texRefZone,texSpecialChar,texStatement,texTypeSize,texTypeStyle - if !exists("s:tex_no_error") || !s:tex_no_error + if !s:tex_no_error syn cluster texMathMatchGroup add=texMathError syn cluster texMathZoneGroup add=texMathError endif @@ -186,7 +192,7 @@ endif " Try to flag {} and () mismatches: {{{1 if s:tex_fast =~ 'm' - if !exists("s:tex_no_error") || !s:tex_no_error + if !s:tex_no_error syn region texMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\[{}]" end="}" contains=@texMatchGroup,texError syn region texMatcher matchgroup=Delimiter start="\[" end="]" contains=@texMatchGroup,texError,@NoSpell else @@ -199,15 +205,15 @@ if s:tex_fast =~ 'm' syn region texParen start="(" end=")" contains=@texMatchGroup endif endif -if !exists("s:tex_no_error") || !s:tex_no_error +if !s:tex_no_error syn match texError "[}\])]" endif if s:tex_fast =~ 'M' if !exists("g:tex_no_math") - if !exists("s:tex_no_error") || !s:tex_no_error + if !s:tex_no_error syn match texMathError "}" contained endif - syn region texMathMatcher matchgroup=Delimiter start="{" skip="\(\\\\\)*\\}" end="}" end="%stopzone\>" contained contains=@texMathMatchGroup + syn region texMathMatcher matchgroup=Delimiter start="{" skip="\\\\\|\\}" end="}" end="%stopzone\>" contained contains=@texMathMatchGroup endif endif @@ -218,7 +224,7 @@ if exists("g:tex_tex") || b:tex_stylish syn match texStatement "\\[a-zA-Z@]\+" else syn match texStatement "\\\a\+" - if !exists("s:tex_no_error") || !s:tex_no_error + if !s:tex_no_error syn match texError "\\\a*@[a-zA-Z@]*" endif endif @@ -226,7 +232,7 @@ endif " TeX/LaTeX delimiters: {{{1 syn match texDelimiter "&" syn match texDelimiter "\\\\" -"%syn match texDelimiter "[{}]" +" syn match texDelimiter "[{}]" " Tex/Latex Options: {{{1 syn match texOption "[^\\]\zs#\d\+\|^#\d\+" @@ -247,7 +253,7 @@ syn match texLigature "\\\([ijolL]\|ae\ " \begin{}/\end{} section markers: {{{1 syn match texBeginEnd "\\begin\>\|\\end\>" nextgroup=texBeginEndName if s:tex_fast =~ 'm' - syn region texBeginEndName matchgroup=Delimiter start="{" end="}" contained nextgroup=texBeginEndModifier contains=texComment + syn region texBeginEndName matchgroup=Delimiter start="{" end="}" contained nextgroup=texBeginEndModifier contains=texComment syn region texBeginEndModifier matchgroup=Delimiter start="\[" end="]" contained contains=texComment,@NoSpell endif @@ -337,54 +343,27 @@ syn match texSpaceCodeChar "`\\\=.\(\ " Sections, subsections, etc: {{{1 if s:tex_fast =~ 'p' if !exists("g:tex_nospell") || !g:tex_nospell - if g:tex_fold_enabled && has("folding") - syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup,@Spell - syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texPartGroup,@Spell - syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texChapterGroup,@Spell - syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSectionGroup,@Spell - syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup,@Spell - syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSubSectionGroup,@Spell - syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texParaGroup,@Spell - syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@Spell - syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup,@Spell - syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup,@Spell - else - syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell - syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup,@Spell - syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup,@Spell - syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup,@Spell - syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup,@Spell - syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup,@Spell - syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup,@Spell - syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@Spell - syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup,@Spell - syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup,@Spell - syn region texSpellZone matchgroup=texSpellZone start="%spellzone_start" end="%spellzone_end" contains=@Spell - endif + TexFold syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup,@Spell + TexFold syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup,@Spell + TexFold syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup,@Spell + TexFold syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup,@Spell + TexFold syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup,@Spell + TexFold syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup,@Spell + TexFold syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup,@Spell + TexFold syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@Spell + TexFold syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup,@Spell + TexFold syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup,@Spell else - if g:tex_fold_enabled && has("folding") - syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' fold contains=@texFoldGroup,@texDocGroup - syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texPartGroup - syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texChapterGroup - syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSectionGroup - syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSectionGroup - syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texSubSubSectionGroup - syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup,@texParaGroup - syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' fold contains=@texFoldGroup - syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' fold contains=@texFoldGroup - syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' fold contains=@texFoldGroup - else - syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup - syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup - syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup - syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup - syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup - syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup - syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup - syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup - syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup - syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup - endif + TexFold syn region texDocZone matchgroup=texSection start='\\begin\s*{\s*document\s*}' end='\\end\s*{\s*document\s*}' contains=@texFoldGroup,@texDocGroup + TexFold syn region texPartZone matchgroup=texSection start='\\part\>' end='\ze\s*\\\%(part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texPartGroup + TexFold syn region texChapterZone matchgroup=texSection start='\\chapter\>' end='\ze\s*\\\%(chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texChapterGroup + TexFold syn region texSectionZone matchgroup=texSection start='\\section\>' end='\ze\s*\\\%(section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSectionGroup + TexFold syn region texSubSectionZone matchgroup=texSection start='\\subsection\>' end='\ze\s*\\\%(\%(sub\)\=section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSectionGroup + TexFold syn region texSubSubSectionZone matchgroup=texSection start='\\subsubsection\>' end='\ze\s*\\\%(\%(sub\)\{,2}section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texSubSubSectionGroup + TexFold syn region texParaZone matchgroup=texSection start='\\paragraph\>' end='\ze\s*\\\%(paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup,@texParaGroup + TexFold syn region texSubParaZone matchgroup=texSection start='\\subparagraph\>' end='\ze\s*\\\%(\%(sub\)\=paragraph\>\|\%(sub\)*section\>\|chapter\>\|part\>\|end\s*{\s*document\s*}\)' contains=@texFoldGroup + TexFold syn region texTitle matchgroup=texSection start='\\\%(author\|title\)\>\s*{' end='}' contains=@texFoldGroup + TexFold syn region texAbstract matchgroup=texSection start='\\begin\s*{\s*abstract\s*}' end='\\end\s*{\s*abstract\s*}' contains=@texFoldGroup endif endif @@ -406,8 +385,8 @@ if s:tex_fast =~ 'b' endif " Bad Math (mismatched): {{{1 -if !exists("g:tex_no_math") && (!exists("s:tex_no_error") || !s:tex_no_error) - syn match texBadMath "\\end\s*{\s*\(array\|gathered\|bBpvV]matrix\|split\|smallmatrix\|xxalignat\)\s*}" +if !exists("g:tex_no_math") && !s:tex_no_error + syn match texBadMath "\\end\s*{\s*\(array\|gathered\|bBpvV]matrix\|split\|subequations\|smallmatrix\|xxalignat\)\s*}" syn match texBadMath "\\end\s*{\s*\(align\|alignat\|displaymath\|displaymath\|eqnarray\|equation\|flalign\|gather\|math\|multline\|xalignat\)\*\=\s*}" syn match texBadMath "\\[\])]" endif @@ -456,8 +435,9 @@ if !exists("g:tex_no_math") call TexNewMathZone("G","gather",1) call TexNewMathZone("H","math",1) call TexNewMathZone("I","multline",1) - call TexNewMathZone("J","xalignat",1) - call TexNewMathZone("K","xxalignat",0) + call TexNewMathZone("J","subequations",0) + call TexNewMathZone("K","xalignat",1) + call TexNewMathZone("L","xxalignat",0) " Inline Math Zones: {{{2 if s:tex_fast =~ 'M' @@ -573,25 +553,23 @@ syn case ignore syn keyword texTodo contained combak fixme todo xxx syn case match if s:extfname == "dtx" - syn match texComment "\^\^A.*$" contains=@texCommentGroup - syn match texComment "^%\+" contains=@texCommentGroup + syn match texComment "\^\^A.*$" contains=@texCommentGroup + syn match texComment "^%\+" contains=@texCommentGroup else - if g:tex_fold_enabled - " allows syntax-folding of 2 or more contiguous comment lines - " single-line comments are not folded - syn match texComment "%.*$" contains=@texCommentGroup - if s:tex_fast =~ 'c' - syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' fold - syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" fold contains=@texFoldGroup,@NoSpell - syn region texSpellZone matchgroup=texComment start="%\s*spellzone_start" end="%\s*spellzone_end" fold contains=@Spell,@texFoldGroup - endif - else - syn match texComment "%.*$" contains=@texCommentGroup - if s:tex_fast =~ 'c' - syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell - syn region texSpellZone matchgroup=texComment start="%\s*spellzone_start" end="%\s*spellzone_end" contains=@Spell,@texFoldGroup - endif + if g:tex_fold_enabled + " allows syntax-folding of 2 or more contiguous comment lines + " single-line comments are not folded + syn match texComment "%.*$" contains=@texCommentGroup + if s:tex_fast =~ 'c' + TexFold syn region texComment start="^\zs\s*%.*\_s*%" skip="^\s*%" end='^\ze\s*[^%]' + TexFold syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell endif + else + syn match texComment "%.*$" contains=@texCommentGroup + if s:tex_fast =~ 'c' + syn region texNoSpell contained matchgroup=texComment start="%\s*nospell\s*{" end="%\s*nospell\s*}" contains=@texFoldGroup,@NoSpell + endif + endif endif " Separate lines used for verb` and verb# so that the end conditions {{{1 @@ -673,7 +651,7 @@ syn match texLength "\<\d\+\([.,]\d\+\ syn match texString "\(``\|''\|,,\)" " makeatletter -- makeatother sections -if !exists("s:tex_no_error") || !s:tex_no_error +if !s:tex_no_error if s:tex_fast =~ 'S' syn region texStyle matchgroup=texStatement start='\\makeatletter' end='\\makeatother' contains=@texStyleGroup contained endif @@ -1353,6 +1331,7 @@ if did_tex_syntax_inits == 1 endif " Cleanup: {{{1 +delc TexFold unlet s:extfname let b:current_syntax = "tex" let &cpo = s:keepcpo diff --git a/runtime/syntax/vhdl.vim b/runtime/syntax/vhdl.vim --- a/runtime/syntax/vhdl.vim +++ b/runtime/syntax/vhdl.vim @@ -4,7 +4,6 @@ " Previous Maintainer: Czo " Credits: Stephan Hegel " Last Changed: 2015 Oct 13 by Daniel Kho -" $Id: vhdl.vim,v 1.1 2004/06/13 15:34:56 vimboss Exp $ " VHSIC (Very High Speed Integrated Circuit) Hardware Description Language diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: Vim 7.4 script " Maintainer: Charles E. Campbell -" Last Change: Apr 02, 2015 -" Version: 7.4-33 +" Last Change: October 19, 2015 +" Version: 7.4-35 " Automatically generated keyword lists: {{{1 " Quit when a syntax file was already loaded {{{2 @@ -28,28 +28,28 @@ syn match vimCommand contained "\