diff options
author | Bram Moolenaar <Bram@vim.org> | 2013-04-24 18:51:19 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2013-04-24 18:51:19 +0200 |
commit | ff0341946eabf4dcb616a2bbe7a2e9d69ae46e57 (patch) | |
tree | 0444bd0917a2d95ee299383bce98e78caa19380b | |
parent | 7afea82f507c0614a22b27d592adf65f5656c2df (diff) | |
download | vim-git-ff0341946eabf4dcb616a2bbe7a2e9d69ae46e57.tar.gz |
Updated runtime files.
27 files changed, 2149 insertions, 1488 deletions
diff --git a/runtime/autoload/getscript.vim b/runtime/autoload/getscript.vim index 34f5970c3..6b74d37da 100644 --- a/runtime/autoload/getscript.vim +++ b/runtime/autoload/getscript.vim @@ -1,8 +1,8 @@ " --------------------------------------------------------------------- " getscript.vim -" Author: Charles E. Campbell, Jr. -" Date: Jan 17, 2012 -" Version: 34 +" Author: Charles E. Campbell +" Date: Apr 17, 2013 +" Version: 35 " Installing: :help glvs-install " Usage: :help glvs " @@ -15,7 +15,7 @@ if exists("g:loaded_getscript") finish endif -let g:loaded_getscript= "v34" +let g:loaded_getscript= "v35" if &cp echoerr "GetLatestVimScripts is not vi-compatible; not loaded (you need to set nocp)" finish @@ -74,6 +74,11 @@ if !exists("g:GetLatestVimScripts_allowautoinstall") let g:GetLatestVimScripts_allowautoinstall= 1 endif +" set up default scriptaddr address +if !exists("g:GetLatestVimScripts_scriptaddr") + let g:GetLatestVimScripts_scriptaddr = 'http://vim.sourceforge.net/script.php?script_id=' +endif + "" For debugging: "let g:GetLatestVimScripts_wget = "echo" "let g:GetLatestVimScripts_options = "options" @@ -314,7 +319,7 @@ fun! getscript#GetLatestVimScripts() if &mod silent! w! endif - q + q! " restore events and current directory exe "cd ".fnameescape(substitute(origdir,'\','/','ge')) @@ -415,7 +420,7 @@ fun! s:GetOneScript(...) echo 'considering <'.aicmmnt.'> scriptid='.scriptid.' srcid='.srcid " grab a copy of the plugin's vim.sourceforge.net webpage - let scriptaddr = 'http://vim.sourceforge.net/script.php?script_id='.scriptid + let scriptaddr = g:GetLatestVimScripts_scriptaddr.scriptid let tmpfile = tempname() let v:errmsg = "" diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 3e9bd34b1..8422d9dea 100644 --- 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: Oct 25, 2012 -" Version: 146 -" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> +" Date: Apr 16, 2013 +" Version: 148 +" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim -" Copyright: Copyright (C) 1999-2012 Charles E. Campbell, Jr. {{{1 +" Copyright: Copyright (C) 1999-2012 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, @@ -22,10 +22,10 @@ if &cp || exists("g:loaded_netrw") finish endif -let g:loaded_netrw = "v146" -if v:version < 702 +let g:loaded_netrw = "v148" +if v:version < 703 || (v:version == 703 && !has("patch465")) echohl WarningMsg - echo "***warning*** this version of netrw needs vim 7.2" + echo "***warning*** this version of netrw needs vim 7.3.465 or later" echohl Normal finish endif @@ -35,12 +35,6 @@ if !exists("s:NOTE") let s:ERROR = 2 endif -" sanity checks -if v:version < 700 - call netrw#ErrorMsg(s:WARNING,"you need vim version 7.0 or later for version ".g:loaded_netrw." of netrw",1) - finish -endif - let s:keepcpo= &cpo set cpo&vim "DechoTabOn @@ -55,7 +49,7 @@ set cpo&vim " 0=note = s:NOTE " 1=warning = s:WARNING " 2=error = s:ERROR -" Oct 24, 2012 : max errnum currently is 91 +" Apr 02, 2013 : max errnum currently is 92 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) @@ -97,7 +91,7 @@ fun! netrw#ErrorMsg(level,msg,errnum) sil! keepj call s:NetrwSafeOptions() setl bt=nofile keepj file NetrwMessage -" call Decho("setlocal ma noro") +" call Decho("setl ma noro") setl ma noro call setline(line("$"),level.a:msg) endif @@ -134,9 +128,12 @@ endfun " 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) if !exists(a:varname) if type(a:value) == 0 exe "let ".a:varname."=".a:value + elseif type(a:value) == 1 && a:value =~ '^[{[]' + exe "let ".a:varname."=".a:value elseif type(a:value) == 1 exe "let ".a:varname."="."'".a:value."'" else @@ -251,6 +248,7 @@ call s:NetrwInit("g:netrw_cursor" , 2) let s:netrw_usercul = &cursorline let s:netrw_usercuc = &cursorcolumn " Default values - d-g ---------- {{{3 +call s:NetrwInit("s:didstarstar",0) call s:NetrwInit("g:netrw_dirhist_cnt" , 0) call s:NetrwInit("g:netrw_decompress" , '{ ".gz" : "gunzip", ".bz2" : "bunzip2", ".zip" : "unzip", ".tar" : "tar -xf", ".xz" : "unxz" }') call s:NetrwInit("g:netrw_dirhistmax" , 10) @@ -297,7 +295,7 @@ endif call s:NetrwInit("g:netrw_list_hide","") " Default values - lh-lz ---------- {{{3 if exists("g:netrw_local_copycmd") - let g:netrw_localcopycmd= g:netrw_local_copycmd" + let g:netrw_localcopycmd= g:netrw_local_copycmd call netrw#ErrorMsg(s:NOTE,"g:netrw_local_copycmd is deprecated in favor of g:netrw_localcopycmd",84) endif if !exists("g:netrw_localcmdshell") @@ -323,7 +321,7 @@ endif call s:NetrwInit("g:netrw_localmkdir","mkdir") call s:NetrwInit("g:netrw_remote_mkdir","mkdir") if exists("g:netrw_local_movecmd") - let g:netrw_localmovecmd= g:netrw_local_movecmd" + let g:netrw_localmovecmd= g:netrw_local_movecmd call netrw#ErrorMsg(s:NOTE,"g:netrw_local_movecmd is deprecated in favor of g:netrw_localmovecmd",88) endif if !exists("g:netrw_localmovecmd") @@ -341,7 +339,7 @@ if !exists("g:netrw_localmovecmd") endif call s:NetrwInit("g:netrw_localrmdir", "rmdir") if exists("g:netrw_local_rmdir") - let g:netrw_localrmdir= g:netrw_local_rmdir" + let g:netrw_localrmdir= g:netrw_local_rmdir call netrw#ErrorMsg(s:NOTE,"g:netrw_local_rmdir is deprecated in favor of g:netrw_localrmdir",86) endif call s:NetrwInit("g:netrw_liststyle" , s:THINLIST) @@ -357,7 +355,7 @@ call s:NetrwInit("g:netrw_markfileesc" , '*./[\~') call s:NetrwInit("g:netrw_maxfilenamelen", 32) call s:NetrwInit("g:netrw_menu" , 1) call s:NetrwInit("g:netrw_mkdir_cmd" , g:netrw_ssh_cmd." USEPORT HOSTNAME mkdir") -call s:NetrwInit("g:netrw_mousemaps" , (exists("&mouse") && &mouse =~ '[anh]')) +call s:NetrwInit("g:netrw_mousemaps" , (exists("+mouse") && &mouse =~ '[anh]')) call s:NetrwInit("g:netrw_retmap" , 0) if has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin) call s:NetrwInit("g:netrw_chgperm" , "chmod PERM FILENAME") @@ -392,7 +390,17 @@ call s:NetrwInit("g:netrw_ssh_browse_reject", '^total\s\+\d\+$') call s:NetrwInit("g:netrw_use_noswf" , 0) " Default values - t-w ---------- {{{3 call s:NetrwInit("g:netrw_timefmt","%c") -call s:NetrwInit("g:netrw_xstrlen",0) +if !exists("g:netrw_xstrlen") + if exists("g:Align_xstrlen") + let g:netrw_xstrlen= g:Align_xstrlen + elseif exists("g:drawit_xstrlen") + let g:netrw_xstrlen= g:drawit_xstrlen + elseif &enc == "latin1" || !has("multi_byte") + let g:netrw_xstrlen= 0 + else + let g:netrw_xstrlen= 1 + endif +endif call s:NetrwInit("g:NetrwTopLvlMenu","Netrw.") call s:NetrwInit("g:netrw_win95ftp",1) call s:NetrwInit("g:netrw_winsize",50) @@ -402,11 +410,11 @@ if g:netrw_winsize > 100|let g:netrw_winsize= 100|endif " Default values for netrw's script variables: {{{2 call s:NetrwInit("g:netrw_fname_escape",' ?&;%') if has("win32") || has("win95") || has("win64") || has("win16") - call s:NetrwInit("g:netrw_glob_escape",'[]*?`{$') + call s:NetrwInit("g:netrw_glob_escape",'*?`{[]$') else - call s:NetrwInit("g:netrw_glob_escape",'[]*?`{~$\') + call s:NetrwInit("g:netrw_glob_escape",'*[]?`{~$\') endif -call s:NetrwInit("g:netrw_menu_escape",'./&? \') +call s:NetrwInit("g:netrw_menu_escape",'.&? \') call s:NetrwInit("g:netrw_tmpfile_escape",' &;') call s:NetrwInit("s:netrw_map_escape","<|\n\r\\\<C-V>\"") @@ -459,7 +467,7 @@ if v:version >= 700 && has("balloon_eval") && &beval == 1 && has("syntax") && ex endif " ------------------------------------------------------------------------ -" s:NetrwOptionSave: save options and set to "standard" form {{{2 +" s:NetrwOptionSave: save options prior to setting to "netrw-buffer-standard" form {{{2 " 06/08/07 : removed call to NetrwSafeOptions(), either placed " immediately after NetrwOptionSave() calls in NetRead " and NetWrite, or after the s:NetrwEnew() call in @@ -475,7 +483,7 @@ fun! s:NetrwOptionSave(vt) " call Dret("s:NetrwOptionSave : options already saved") return endif -" call Decho("fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff) +" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff) " Save current settings and current directory " call Decho("saving current settings and current directory") @@ -487,6 +495,7 @@ fun! s:NetrwOptionSave(vt) let {a:vt}netrw_blkeep = &l:bl let {a:vt}netrw_btkeep = &l:bt let {a:vt}netrw_bombkeep = &l:bomb + let {a:vt}netrw_cedit = &cedit let {a:vt}netrw_cikeep = &l:ci let {a:vt}netrw_cinkeep = &l:cin let {a:vt}netrw_cinokeep = &l:cino @@ -552,7 +561,7 @@ fun! s:NetrwOptionRestore(vt) endif unlet {a:vt}netrw_optionsave - if exists("&acd") + if exists("+acd") if exists("{a:vt}netrw_acdkeep") " call Decho("(NetrwOptionRestore) g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) let curdir = getcwd() @@ -572,10 +581,13 @@ 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 exists("{a:vt}netrw_bhkeep") |let &l:bh = {a:vt}netrw_bhkeep |unlet {a:vt}netrw_bhkeep |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 + if exists("{a:vt}netrw_cedit") |let &cedit = {a:vt}netrw_cedit |unlet {a:vt}netrw_cedit |endif if exists("{a:vt}netrw_cikeep") |let &l:ci = {a:vt}netrw_cikeep |unlet {a:vt}netrw_cikeep |endif if exists("{a:vt}netrw_cinkeep") |let &l:cin = {a:vt}netrw_cinkeep |unlet {a:vt}netrw_cinkeep |endif if exists("{a:vt}netrw_cinokeep") |let &l:cino = {a:vt}netrw_cinokeep |unlet {a:vt}netrw_cinokeep |endif @@ -612,7 +624,7 @@ fun! s:NetrwOptionRestore(vt) " to the current directory as returned by getcwd(). let &l:directory = getcwd() sil! let &l:swf = {a:vt}netrw_swfkeep - setlocal directory= + setl directory= unlet {a:vt}netrw_swfkeep elseif &l:swf != {a:vt}netrw_swfkeep " following line causes a Press ENTER in windows -- can't seem to work around it!!! @@ -636,55 +648,549 @@ fun! s:NetrwOptionRestore(vt) endif " call Decho("(NetrwOptionRestore) g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) -" call Decho("(NetrwOptionRestore) fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist")) +" call Decho("(NetrwOptionRestore) fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")) " call Decho("(NetrwOptionRestore) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Decho("(NetrwOptionRestore) diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist")) " call Decho("(NetrwOptionRestore) ts=".&l:ts) + " 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("(NetrwOptionRestore) filetype detect (ft=".&ft.")") + filetype detect + endif " call Dret("s:NetrwOptionRestore : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) endfun " --------------------------------------------------------------------- " s:NetrwSafeOptions: sets options to help netrw do its job {{{2 +" Use s:NetrwSaveOptions() to save user settings +" 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) - if exists("&acd") | setlocal noacd | endif - setlocal noai - setlocal noaw - setlocal nobomb - setlocal noci - setlocal nocin - setlocal cino= - setlocal com= - setlocal cpo-=a - setlocal cpo-=A - setlocal fo=nroql2 - setlocal nohid - setlocal noim - setlocal isk+=@ isk+=* isk+=/ - setlocal magic - setlocal report=10000 - setlocal sel=inclusive - setlocal nospell - setlocal tw=0 - setlocal wig= + if exists("+acd") | setl noacd | endif + setl noai + setl noaw + setl nobomb + setl noci + setl nocin + if g:netrw_liststyle == s:TREELIST + setl bh=hide + endif + setl cino= + setl com= + setl cpo-=a + setl cpo-=A + setl fo=nroql2 + setl nohid + setl noim + setl isk+=@ isk+=* isk+=/ + setl magic + setl report=10000 + setl sel=inclusive + setl nospell + setl tw=0 + setl wig= + set cedit& if g:netrw_use_noswf && has("win32") && !has("win95") - setlocal noswf + setl noswf endif call s:NetrwCursor() " allow the user to override safe options " call Decho("ft<".&ft."> ei=".&ei) if &ft == "netrw" -" call Decho("do any netrw FileType autocmds") +" call Decho("do any netrw FileType autocmds (doau FileType netrw)") sil! keepalt keepj doau FileType netrw endif -" call Decho("fo=".&fo.(exists("&acd")? " acd=".&acd : " acd doesn't exist")) +" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh) " call Dret("s:NetrwSafeOptions") endfun " --------------------------------------------------------------------- +" netrw#Explore: launch the local browser in the directory of the current file {{{2 +" indx: == -1: Nexplore +" == -2: Pexplore +" == +: this is overloaded: +" * If Nexplore/Pexplore is in use, then this refers to the +" indx'th item in the w:netrw_explore_list[] of items which +" matched the */pattern **/pattern *//pattern **//pattern +" * If Hexplore or Vexplore, then this will override +" g:netrw_winsize to specify the qty of rows or columns the +" newly split window should have. +" dosplit==0: the window will be split iff the current file has been modified +" dosplit==1: the window will be split before running the local browser +" style == 0: Explore style == 1: Explore! +" == 2: Hexplore style == 3: Hexplore! +" == 4: Vexplore style == 5: Vexplore! +" == 6: Texplore +fun! netrw#Explore(indx,dosplit,style,...) +" call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." modifiable=".&modifiable." a:0=".a:0." win#".winnr()." buf#".bufnr("%")) + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() +" call Decho("(Explore) set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)") + endif + let curdir = simplify(b:netrw_curdir) + let curfiledir = substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e') +" call Decho("(Explore) curdir<".curdir."> curfiledir<".curfiledir.">") + + " save registers + sil! let keepregstar = @* + sil! let keepregplus = @+ + sil! let keepregslash= @/ + + " if dosplit or file has been modified + if a:dosplit || &modified || a:style == 6 +" call Decho("(Explore) case dosplit=".a:dosplit." modified=".&modified." a:style=".a:style.": dosplit or file has been modified") + call s:SaveWinVars() + let winsz= g:netrw_winsize + if a:indx > 0 + let winsz= a:indx + endif + + if a:style == 0 " Explore, Sexplore +" call Decho("(Explore) style=0: Explore or Sexplore") + let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz + exe winsz."wincmd s" + + elseif a:style == 1 "Explore!, Sexplore! +" call Decho("(Explore) style=1: Explore! or Sexplore!") + let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz + exe "keepalt ".winsz."wincmd v" + + elseif a:style == 2 " Hexplore +" call Decho("(Explore) style=2: Hexplore") + let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz + exe "keepalt bel ".winsz."wincmd s" + + elseif a:style == 3 " Hexplore! +" call Decho("(Explore) style=3: Hexplore!") + let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz + exe "keepalt abo ".winsz."wincmd s" + + elseif a:style == 4 " Vexplore +" call Decho("(Explore) style=4: Vexplore") + let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz + exe "keepalt lefta ".winsz."wincmd v" + + elseif a:style == 5 " Vexplore! +" call Decho("(Explore) style=5: Vexplore!") + let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz + exe "keepalt rightb ".winsz."wincmd v" + + elseif a:style == 6 " Texplore + call s:SaveBufVars() +" call Decho("(Explore) style = 6: Texplore") + exe "keepalt tabnew ".fnameescape(curdir) + call s:RestoreBufVars() + endif + call s:RestoreWinVars() +" else " Decho +" call Decho("(Explore) case a:dosplit=".a:dosplit." AND modified=".&modified." AND a:style=".a:style." is not 6") + endif + keepj norm! 0 + + if a:0 > 0 +" call Decho("(Explore) case [a:0=".a:0."] > 0") + if a:1 =~ '^\~' && (has("unix") || (exists("g:netrw_cygwin") && g:netrw_cygwin)) +" call Decho("(Explore) ..case a:1<".a:1.">: starts with ~ and unix or cygwin") + let dirname= simplify(substitute(a:1,'\~',expand("$HOME"),'')) +" call Decho("(Explore) ..using dirname<".dirname."> (case: ~ && unix||cygwin)") + elseif a:1 == '.' +" call Decho("(Explore) ..case a:1<".a:1.">: matches .") + let dirname= simplify(exists("b:netrw_curdir")? b:netrw_curdir : getcwd()) + if dirname !~ '/$' + let dirname= dirname."/" + endif +" call Decho("(Explore) ..using dirname<".dirname."> (case: ".(exists("b:netrw_curdir")? "b:netrw_curdir" : "getcwd()").")") + elseif a:1 =~ '\$' +" call Decho("(Explore) ..case a:1<".a:1.">: matches ending $") + let dirname= simplify(expand(a:1)) +" call Decho("(Explore) ..using user-specified dirname<".dirname."> with $env-var") + elseif a:1 !~ '^\*\{1,2}/' +" call Decho("(Explore) ..case a:1<".a:1.">: other, not pattern or filepattern") + let dirname= simplify(a:1) +" call Decho("(Explore) ..using user-specified dirname<".dirname.">") + else +" call Decho("(Explore) ..case a:1: pattern or filepattern") + let dirname= a:1 + endif + else + " clear explore +" call Decho("(Explore) case a:0=".a:0.": clearing Explore list") + call s:NetrwClearExplore() +" call Dret("netrw#Explore : cleared list") + return + endif + +" call Decho("(Explore) dirname<".dirname.">") + if dirname =~ '\.\./\=$' + let dirname= simplify(fnamemodify(dirname,':p:h')) + elseif dirname =~ '\.\.' || dirname == '.' + let dirname= simplify(fnamemodify(dirname,':p')) + endif +" call Decho("(Explore) dirname<".dirname."> (after simplify)") + + if dirname =~ '^\*//' + " starpat=1: Explore *//pattern (current directory only search for files containing pattern) +" call Decho("(Explore) case Explore *//pattern") + let pattern= substitute(dirname,'^\*//\(.*\)$','\1','') + let starpat= 1 +" call Decho("(Explore) ..Explore *//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">") + if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif + + elseif dirname =~ '^\*\*//' + " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) +" call Decho("(Explore) case Explore **//pattern") + let pattern= substitute(dirname,'^\*\*//','','') + let starpat= 2 +" call Decho("(Explore) ..Explore **//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">") + + elseif dirname =~ '/\*\*/' + " handle .../**/.../filepat +" call Decho("(Explore) case Explore .../**/.../filepat") + let prefixdir= substitute(dirname,'^\(.\{-}\)\*\*.*$','\1','') + if prefixdir =~ '^/' || (prefixdir =~ '^\a:/' && (has("win32") || has("win95") || has("win64") || has("win16"))) + let b:netrw_curdir = prefixdir + else + let b:netrw_curdir= getcwd().'/'.prefixdir + endif + let dirname= substitute(dirname,'^.\{-}\(\*\*/.*\)$','\1','') + let starpat= 4 +" call Decho("(Explore) ..pwd<".getcwd()."> dirname<".dirname.">") +" call Decho("(Explore) ..case Explore ../**/../filepat (starpat=".starpat.")") + + elseif dirname =~ '^\*/' + " starpat=3: Explore */filepat (search in current directory for filenames matching filepat) + let starpat= 3 +" call Decho("(Explore) case Explore */filepat (starpat=".starpat.")") + + elseif dirname=~ '^\*\*/' + " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) + let starpat= 4 +" call Decho("(Explore) case Explore **/filepat (starpat=".starpat.")") + + else + let starpat= 0 +" call Decho("(Explore) default case: starpat=".starpat) + endif + + if starpat == 0 && a:indx >= 0 + " [Explore Hexplore Vexplore Sexplore] [dirname] +" call Decho("(Explore) case starpat==0 && a:indx=".a:indx.": dirname<".dirname."> Explore Hexplore Vexplore Sexplore") + if dirname == "" + let dirname= curfiledir +" call Decho("(Explore) ..empty dirname, using current file's directory<".dirname.">") + endif + if dirname =~ '^scp:' || dirname =~ '^ftp:' +" call Decho("(Explore) ..calling NetrwBrowse(0,dirname<".dirname.">)") + call s:NetrwBrowse(0,dirname) + else + if dirname == ""|let dirname= getcwd()|endif +" call Decho("(Explore) ..calling LocalBrowseCheck(dirname<".dirname.">)") + call netrw#LocalBrowseCheck(dirname) +" call Decho("(Explore) win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) + endif + if exists("w:netrw_bannercnt") + " done to handle P08-Ingelrest. :Explore will _Always_ go to the line just after the banner. + " If one wants to return the same place in the netrw window, use :Rex instead. + exe w:netrw_bannercnt + endif + +" call Decho("(Explore) curdir<".curdir.">") + " --------------------------------------------------------------------- + " Jan 24, 2013: not sure why the following was present. See P08-Ingelrest +" if has("win32") || has("win95") || has("win64") || has("win16") +" keepj call search('\<'.substitute(curdir,'^.*[/\\]','','e').'\>','cW') +" else +" keepj call search('\<'.substitute(curdir,'^.*/','','e').'\>','cW') +" endif + " --------------------------------------------------------------------- + + " starpat=1: Explore *//pattern (current directory only search for files containing pattern) + " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) + " starpat=3: Explore */filepat (search in current directory for filenames matching filepat) + " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) + elseif a:indx <= 0 + " Nexplore, Pexplore, Explore: handle starpat +" call Decho("(Explore) case a:indx<=0: Nexplore, Pexplore, <s-down>, <s-up> starpat=".starpat." a:indx=".a:indx) + if !mapcheck("<s-up>","n") && !mapcheck("<s-down>","n") && exists("b:netrw_curdir") +" call Decho("(Explore) ..set up <s-up> and <s-down> maps") + let s:didstarstar= 1 + nnoremap <buffer> <silent> <s-up> :Pexplore<cr> + nnoremap <buffer> <silent> <s-down> :Nexplore<cr> + endif + + if has("path_extra") +" call Decho("(Explore) ..starpat=".starpat.": has +path_extra") + if !exists("w:netrw_explore_indx") + let w:netrw_explore_indx= 0 + endif + + let indx = a:indx +" call Decho("(Explore) ..starpat=".starpat.": set indx= [a:indx=".indx."]") + + if indx == -1 + " Nexplore +" call Decho("(Explore) ..case Nexplore with starpat=".starpat.": (indx=".indx.")") + if !exists("w:netrw_explore_list") " sanity check + keepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or <s-down> improperly; see help for netrw-starstar",40) + sil! let @* = keepregstar + sil! let @+ = keepregstar + sil! let @/ = keepregslash +" call Dret("netrw#Explore") + return + endif + let indx= w:netrw_explore_indx + 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("(Explore) ....indx=".indx." curfile<".curfile.">") + while indx < w:netrw_explore_listlen && curfile == w:netrw_explore_list[indx] + let indx= indx + 1 +" call Decho("(Explore) ....indx=".indx." (Nexplore while loop)") + endwhile + if indx >= w:netrw_explore_listlen | let indx= w:netrw_explore_listlen - 1 | endif +" call Decho("(Explore) ....Nexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx) + + elseif indx == -2 + " Pexplore +" call Decho("(Explore) case Pexplore with starpat=".starpat.": (indx=".indx.")") + if !exists("w:netrw_explore_list") " sanity check + keepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or <s-up> improperly; see help for netrw-starstar",41) + sil! let @* = keepregstar + sil! let @+ = keepregstar + sil! let @/ = keepregslash +" call Dret("netrw#Explore") + return + endif + let indx= w:netrw_explore_indx + 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("(Explore) ....indx=".indx." curfile<".curfile.">") + while indx >= 0 && curfile == w:netrw_explore_list[indx] + let indx= indx - 1 +" call Decho("(Explore) ....indx=".indx." (Pexplore while loop)") + endwhile + if indx < 0 | let indx= 0 | endif +" call Decho("(Explore) ....Pexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx) + + else + " Explore -- initialize + " build list of files to Explore with Nexplore/Pexplore +" call Decho("(Explore) ..starpat=".starpat.": case Explore: initialize (indx=".indx.")") + keepj keepalt call s:NetrwClearExplore() + let w:netrw_explore_indx= 0 + if !exists("b:netrw_curdir") + let b:netrw_curdir= getcwd() + endif +" call Decho("(Explore) ....starpat=".starpat.": b:netrw_curdir<".b:netrw_curdir.">") + + " 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("(Explore) ..case starpat=".starpat.": build *//pattern list (curdir-only srch for files containing pattern) &hls=".&hls) +" call Decho("(Explore) ....pattern<".pattern.">") + try + exe "keepj noautocmd vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*" + catch /^Vim\%((\a\+)\)\=:E480/ + keepalt call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76) +" call Dret("netrw#Explore : unable to find pattern<".pattern.">") + return + endtry + let w:netrw_explore_list = s:NetrwExploreListUniq(map(getqflist(),'bufname(v:val.bufnr)')) + if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif + + elseif starpat == 2 + " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) +" call Decho("(Explore) ..case starpat=".starpat.": build **//pattern list (recursive descent files containing pattern)") +" call Decho("(Explore) ....pattern<".pattern.">") + try + exe "sil keepj noautocmd keepalt vimgrep /".pattern."/gj "."**/*" + catch /^Vim\%((\a\+)\)\=:E480/ + keepalt call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45) + if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif + sil! let @* = keepregstar + sil! let @+ = keepregstar + sil! let @/ = keepregslash +" call Dret("netrw#Explore : no files matched pattern") + return + endtry + let s:netrw_curdir = b:netrw_curdir + let w:netrw_explore_list = getqflist() + let w:netrw_explore_list = s:NetrwExploreListUniq(map(w:netrw_explore_list,'s:netrw_curdir."/".bufname(v:val.bufnr)')) + if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif + + elseif starpat == 3 + " starpat=3: Explore */filepat (search in current directory for filenames matching filepat) +" call Decho("(Explore) ..case starpat=".starpat.": build */filepat list (curdir-only srch filenames matching filepat) &hls=".&hls) + let filepat= substitute(dirname,'^\*/','','') + let filepat= substitute(filepat,'^[%#<]','\\&','') +" call Decho("(Explore) ....b:netrw_curdir<".b:netrw_curdir.">") +" call Decho("(Explore) ....filepat<".filepat.">") + let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".filepat),'\n')) + if &hls | let keepregslash= s:ExplorePatHls(filepat) | endif + + elseif starpat == 4 + " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) +" call Decho("(Explore) ..case starpat=".starpat.": build **/filepat list (recursive descent srch filenames matching filepat) &hls=".&hls) + 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("(Explore) ....w:netrw_explore_list<".string(w:netrw_explore_list).">") +" call Decho("(Explore) ....w:netrw_explore_listlen=".w:netrw_explore_listlen) + + if w:netrw_explore_listlen == 0 || (w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/') + keepalt keepj call netrw#ErrorMsg(s:WARNING,"no files matched",42) + sil! let @* = keepregstar + sil! let @+ = keepregstar + sil! let @/ = keepregslash +" call Dret("netrw#Explore : no files matched") + return + endif + endif " if indx ... endif + + " NetrwStatusLine support - for exploring support + let w:netrw_explore_indx= indx +" call Decho("(Explore) ....w:netrw_explore_list<".join(w:netrw_explore_list,',')."> len=".w:netrw_explore_listlen) + + " wrap the indx around, but issue a note + if indx >= w:netrw_explore_listlen || indx < 0 +" call Decho("(Explore) ....wrap indx (indx=".indx." listlen=".w:netrw_explore_listlen.")") + let indx = (indx < 0)? ( w:netrw_explore_listlen - 1 ) : 0 + let w:netrw_explore_indx= indx + keepalt keepj call netrw#ErrorMsg(s:NOTE,"no more files match Explore pattern",43) + endif + + exe "let dirfile= w:netrw_explore_list[".indx."]" +" call Decho("(Explore) ....dirfile=w:netrw_explore_list[indx=".indx."]= <".dirfile.">") + let newdir= substitute(dirfile,'/[^/]*$','','e') +" call Decho("(Explore) ....newdir<".newdir.">") + +" call Decho("(Explore) ....calling LocalBrowseCheck(newdir<".newdir.">)") + call netrw#LocalBrowseCheck(newdir) + if !exists("w:netrw_liststyle") + let w:netrw_liststyle= g:netrw_liststyle + endif + if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:LONGLIST + keepalt keepj call search('^'.substitute(dirfile,"^.*/","","").'\>',"W") + else + keepalt keepj call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w") + endif + let w:netrw_explore_mtchcnt = indx + 1 + let w:netrw_explore_bufnr = bufnr("%") + let w:netrw_explore_line = line(".") + keepalt keepj call s:SetupNetrwStatusLine('%f %h%m%r%=%9*%{NetrwStatusLine()}') +" call Decho("(Explore) ....explore: mtchcnt=".w:netrw_explore_mtchcnt." bufnr=".w:netrw_explore_bufnr." line#".w:netrw_explore_line) + + else +" call Decho("(Explore) ..your vim does not have +path_extra") + if !exists("g:netrw_quiet") + keepalt keepj call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44) + endif + sil! let @* = keepregstar + sil! let @+ = keepregstar + sil! let @/ = keepregslash +" call Dret("netrw#Explore : missing +path_extra") + return + endif + + else +" call Decho("(Explore) ..default case: Explore newdir<".dirname.">") + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && dirname =~ '/' + sil! unlet w:netrw_treedict + sil! unlet w:netrw_treetop + endif + let newdir= dirname + if !exists("b:netrw_curdir") + keepj call netrw#LocalBrowseCheck(getcwd()) + else + keepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,newdir)) + endif + endif + + " visual display of **/ **// */ Exploration files +" call Decho("(Explore) w:netrw_explore_indx=".(exists("w:netrw_explore_indx")? w:netrw_explore_indx : "doesn't exist")) +" call Decho("(Explore) b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "n/a").">") + if exists("w:netrw_explore_indx") && exists("b:netrw_curdir") +" call Decho("(Explore) s:explore_prvdir<".(exists("s:explore_prvdir")? s:explore_prvdir : "-doesn't exist-")) + if !exists("s:explore_prvdir") || s:explore_prvdir != b:netrw_curdir + " only update match list if current directory isn't the same as before +" call Decho("(Explore) only update match list if current directory not the same as before") + let s:explore_prvdir = b:netrw_curdir + let s:explore_match = "" + let dirlen = s:Strlen(b:netrw_curdir) + if b:netrw_curdir !~ '/$' + let dirlen= dirlen + 1 + endif + let prvfname= "" + for fname in w:netrw_explore_list +" call Decho("(Explore) fname<".fname.">") + if fname =~ '^'.b:netrw_curdir + if s:explore_match == "" + let s:explore_match= '\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>' + else + let s:explore_match= s:explore_match.'\|\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>' + endif + elseif fname !~ '^/' && fname != prvfname + if s:explore_match == "" + let s:explore_match= '\<'.escape(fname,g:netrw_markfileesc).'\>' + else + let s:explore_match= s:explore_match.'\|\<'.escape(fname,g:netrw_markfileesc).'\>' + endif + endif + let prvfname= fname + endfor +" call Decho("(Explore) explore_match<".s:explore_match.">") + exe "2match netrwMarkFile /".s:explore_match."/" + endif + echo "<s-up>==Pexplore <s-down>==Nexplore" + else + 2match none + if exists("s:explore_match") | unlet s:explore_match | endif + if exists("s:explore_prvdir") | unlet s:explore_prvdir | endif + echo " " +" call Decho("(Explore) cleared explore match list") + endif + + sil! let @* = keepregstar + sil! let @+ = keepregstar + sil! let @/ = keepregslash +" call Dret("netrw#Explore : @/<".@/.">") +endfun + +" --------------------------------------------------------------------- +" netrw#NetrwMakeTgt: make a target out of the directory name provided {{{2 +fun! netrw#NetrwMakeTgt(dname) +" call Dfunc("netrw#NetrwMakeTgt(dname<".a:dname.">)") + " simplify the target (eg. /abc/def/../ghi -> /abc/ghi) + let svpos = netrw#NetrwSavePosn() + let s:netrwmftgt_islocal= (a:dname !~ '^\a\+://') +" call Decho("s:netrwmftgt_islocal=".s:netrwmftgt_islocal) + if s:netrwmftgt_islocal + let netrwmftgt= simplify(a:dname) + else + let netrwmftgt= a:dname + endif + if exists("s:netrwmftgt") && netrwmftgt == s:netrwmftgt + " re-selected target, so just clear it + unlet s:netrwmftgt s:netrwmftgt_islocal + else + let s:netrwmftgt= netrwmftgt + endif + if g:netrw_fastbrowse <= 1 + call s:NetrwRefresh((b:netrw_curdir !~ '\a\+://'),b:netrw_curdir) + endif + call netrw#NetrwRestorePosn(svpos) +" call Dret("netrw#NetrwMakeTgt") +endfun + +" --------------------------------------------------------------------- " netrw#NetrwClean: remove netrw {{{2 " supports :NetrwClean -- remove netrw from first directory on runtimepath " :NetrwClean! -- remove netrw from all directories on runtimepath @@ -741,6 +1247,257 @@ fun! netrw#Nread(mode,fname) endfun " ------------------------------------------------------------------------ +" netrw#NetrwObtain: {{{2 +" netrw#NetrwObtain(islocal,fname[,tgtdirectory]) +" islocal=0 obtain from remote source +" =1 obtain from local source +" fname : a filename or a list of filenames +" tgtdir : optional place where files are to go (not present, uses getcwd()) +fun! netrw#NetrwObtain(islocal,fname,...) +" call Dfunc("netrw#NetrwObtain(islocal=".a:islocal." fname<".((type(a:fname) == 1)? a:fname : string(a:fname)).">) a:0=".a:0) + " NetrwStatusLine support - for obtaining support + + if type(a:fname) == 1 + let fnamelist= [ a:fname ] + elseif type(a:fname) == 3 + let fnamelist= a:fname + else + call netrw#ErrorMsg(s:ERROR,"attempting to use NetrwObtain on something not a filename or a list",62) +" call Dret("netrw#NetrwObtain") + return + endif +" call Decho("fnamelist<".string(fnamelist).">") + if a:0 > 0 + let tgtdir= a:1 + else + let tgtdir= getcwd() + endif +" call Decho("tgtdir<".tgtdir.">") + + if exists("b:netrw_islocal") && b:netrw_islocal + " obtain a file from local b:netrw_curdir to (local) tgtdir +" call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir) + if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir + 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") + for fname in fnamelist +" call Decho("system(".g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath).")") + call system(g:netrw_localcopycmd." ".shellescape(fname)." ".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)) + 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)) + 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)) + return + endif + endif + elseif !exists("b:netrw_curdir") + call netrw#ErrorMsg(s:ERROR,"local browsing directory doesn't exist!",36) + else + call netrw#ErrorMsg(s:WARNING,"local browsing directory and current directory are identical",37) + endif + + else + " obtain files from remote b:netrw_curdir to local tgtdir +" call Decho("obtain a file from remote ".b:netrw_curdir." to ".tgtdir) + if type(a:fname) == 1 + call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.a:fname) + endif + call s:NetrwMethod(b:netrw_curdir) + + if b:netrw_method == 4 + " obtain file using scp +" call Decho("obtain via scp (method#4)") + if exists("g:netrw_port") && g:netrw_port != "" + let useport= " ".g:netrw_scpport." ".g:netrw_port + else + let useport= "" + endif + if b:netrw_fname =~ '/' + let path= substitute(b:netrw_fname,'^\(.*/\).\{-}$','\1','') + else + let path= "" + endif + let filelist= join(map(deepcopy(fnamelist),'shellescape(g:netrw_machine.":".path.v:val,1)')) +" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1)) + exe s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1) + + elseif b:netrw_method == 2 + " obtain file using ftp + .netrc +" call Decho("obtain via ftp+.netrc (method #2)") + call s:SaveBufVars()|sil keepjumps new|call s:RestoreBufVars() + let tmpbufnr= bufnr("%") + setl ff=unix + if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" + keepj put =g:netrw_ftpmode +" call Decho("filter input: ".getline('$')) + endif + + if exists("b:netrw_fname") && b:netrw_fname != "" + call setline(line("$")+1,'cd "'.b:netrw_fname.'"') +" call Decho("filter input: ".getline('$')) + endif + + if exists("g:netrw_ftpextracmd") + keepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline('$')) + endif + for fname in fnamelist + call setline(line("$")+1,'get "'.fname.'"') +" call Decho("filter input: ".getline('$')) + endfor + if exists("g:netrw_port") && g:netrw_port != "" +" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) + exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) + else +" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) + exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".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 ' + let debugkeep= &debug + setl debug=msg + call netrw#ErrorMsg(s:ERROR,getline(1),4) + let &debug= debugkeep + endif + + 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 s:SaveBufVars()|sil keepjumps new|call s:RestoreBufVars() + let tmpbufnr= bufnr("%") + setl ff=unix + + if exists("g:netrw_port") && g:netrw_port != "" + keepj put ='open '.g:netrw_machine.' '.g:netrw_port +" call Decho("filter input: ".getline('$')) + else + keepj put ='open '.g:netrw_machine +" call Decho("filter input: ".getline('$')) + endif + + if exists("g:netrw_uid") && g:netrw_uid != "" + if exists("g:netrw_ftp") && g:netrw_ftp == 1 + keepj put =g:netrw_uid +" call Decho("filter input: ".getline('$')) + if exists("s:netrw_passwd") && s:netrw_passwd != "" + keepj put ='\"'.s:netrw_passwd.'\"' + endif +" call Decho("filter input: ".getline('$')) + elseif exists("s:netrw_passwd") + keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' +" call Decho("filter input: ".getline('$')) + endif + endif + + if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" + keepj put =g:netrw_ftpmode +" call Decho("filter input: ".getline('$')) + endif + + if exists("b:netrw_fname") && b:netrw_fname != "" + keepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') +" call Decho("filter input: ".getline('$')) + endif + + if exists("g:netrw_ftpextracmd") + keepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline('$')) + endif + + if exists("g:netrw_ftpextracmd") + keepj put =g:netrw_ftpextracmd +" call Decho("filter input: ".getline('$')) + endif + for fname in fnamelist + keepj call setline(line("$")+1,'get "'.fname.'"') + endfor +" call Decho("filter input: ".getline('$')) + + " perform ftp: + " -i : turns off interactive prompting from ftp + " -n unix : DON'T use <.netrc>, even though it exists + " -n win32: quit being obnoxious about password + keepj norm! 1Gdd +" call Decho("executing: %!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) + exe 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).">") + if !exists("g:netrw_quiet") + keepj call netrw#ErrorMsg(s:ERROR,getline(1),5) + endif + endif + elseif !exists("b:netrw_method") || b:netrw_method < 0 +" call Dfunc("netrw#NetrwObtain : unsupported method") + return + endif + + " restore status line + if type(a:fname) == 1 && exists("s:netrw_users_stl") + keepj call s:SetupNetrwStatusLine(s:netrw_users_stl) + endif + + endif + + " cleanup + if exists("tmpbufnr") + if bufnr("%") != tmpbufnr + exe tmpbufnr."bw!" + else + q! + endif + endif + +" call Dret("netrw#NetrwObtain") +endfun + +" --------------------------------------------------------------------- +" NetrwStatusLine: {{{2 +fun! NetrwStatusLine() + +" vvv NetrwStatusLine() debugging vvv +" let g:stlmsg="" +" if !exists("w:netrw_explore_bufnr") +" let g:stlmsg="!X<explore_bufnr>" +" elseif w:netrw_explore_bufnr != bufnr("%") +" let g:stlmsg="explore_bufnr!=".bufnr("%") +" endif +" if !exists("w:netrw_explore_line") +" let g:stlmsg=" !X<explore_line>" +" elseif w:netrw_explore_line != line(".") +" let g:stlmsg=" explore_line!={line(.)<".line(".").">" +" endif +" if !exists("w:netrw_explore_list") +" let g:stlmsg=" !X<explore_list>" +" endif +" ^^^ NetrwStatusLine() debugging ^^^ + + if !exists("w:netrw_explore_bufnr") || w:netrw_explore_bufnr != bufnr("%") || !exists("w:netrw_explore_line") || w:netrw_explore_line != line(".") || !exists("w:netrw_explore_list") + " restore user's status line + let &stl = s:netrw_users_stl + let &laststatus = s:netrw_users_ls + if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif + if exists("w:netrw_explore_line") |unlet w:netrw_explore_line |endif + return "" + else + return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen + endif +endfun + +" --------------------------------------------------------------------- " Netrw Transfer Functions: {{{1 " =============================== @@ -899,7 +1656,7 @@ fun! netrw#NetRead(mode,...) let netrw_fname= b:netrw_fname keepj call s:SaveBufVars()|new|keepj call s:RestoreBufVars() let filtbuf= bufnr("%") - setlocal ff=unix + setl ff=unix keepj put =g:netrw_ftpmode " call Decho("filter input: ".getline(line("$"))) if exists("g:netrw_ftpextracmd") @@ -918,7 +1675,7 @@ fun! netrw#NetRead(mode,...) " 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 ' let debugkeep = &debug - setlocal debug=msg + setl debug=msg keepj call netrw#ErrorMsg(s:ERROR,getline(1),4) let &debug = debugkeep endif @@ -940,7 +1697,7 @@ fun! netrw#NetRead(mode,...) let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) keepj call s:SaveBufVars()|new|keepj call s:RestoreBufVars() let filtbuf= bufnr("%") - setlocal ff=unix + setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" keepj put ='open '.g:netrw_machine.' '.g:netrw_port " call Decho("filter input: ".getline('.')) @@ -1064,7 +1821,7 @@ fun! netrw#NetRead(mode,...) " Construct execution string (four lines) which will be passed through filter let netrw_fname= escape(b:netrw_fname,g:netrw_fname_escape) new - setlocal ff=unix + setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" keepj put ='open '.g:netrw_machine.' '.g:netrw_port else @@ -1307,11 +2064,11 @@ fun! netrw#NetWrite(...) range " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead let bhkeep = &l:bh let curbuf = bufnr("%") - setlocal bh=hide - enew + setl bh=hide + keepalt enew " call Decho("filter input window#".winnr()) - setlocal ff=unix + setl ff=unix keepj put =g:netrw_ftpmode " call Decho("filter input: ".getline('$')) if exists("g:netrw_ftpextracmd") @@ -1354,9 +2111,9 @@ fun! netrw#NetWrite(...) range " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead let curbuf = bufnr("%") - setlocal bh=hide - enew - setlocal ff=unix + setl bh=hide + keepalt enew + setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" keepj put ='open '.g:netrw_machine.' '.g:netrw_port @@ -1442,10 +2199,10 @@ fun! netrw#NetWrite(...) range " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead let curbuf = bufnr("%") - setlocal bh=hide - enew + setl bh=hide + keepalt enew - setlocal ff=unix + setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" keepj put ='open '.g:netrw_machine.' '.g:netrw_port else @@ -1491,10 +2248,10 @@ fun! netrw#NetWrite(...) range " formerly just a "new...bd!", that changed the window sizes when equalalways. Using enew workaround instead let bhkeep = &l:bh let curbuf = bufnr("%") - setlocal bh=hide - enew + setl bh=hide + keepalt enew - setlocal ff=unix + setl ff=unix call setline(1,'put "'.escape(tmpfile,'\').'" '.netrw_fname) " call Decho("filter input: ".getline('.')) " call Decho("executing: %!".g:netrw_sftp_cmd.' '.shellescape(uid_machine,1)) @@ -1647,7 +2404,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method) " call Decho("detect filetype of local version of remote file") let iskkeep= &l:isk setl isk-=/ - filetype detect + " filetype detect " COMBAK - trying filetype detect in NetrwOptionRestore Jan 24, 2013 let &l:isk= iskkeep " call Dredir("renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">","ls!") let line1 = 1 @@ -2104,25 +2861,25 @@ fun! s:NetrwMaps(islocal) " call Dfunc("s:NetrwMaps(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">") " set up Rexplore and [ 2-leftmouse-click -or- c-leftmouse ] -" call Decho("set up Rexplore command") +" call Decho("(NetrwMaps) set up Rexplore command") com! Rexplore if exists("w:netrw_rexlocal")|call s:NetrwRexplore(w:netrw_rexlocal,exists("w:netrw_rexdir")? w:netrw_rexdir : ".")|else|call netrw#ErrorMsg(s:WARNING,"not a former netrw window",79)|endif if g:netrw_mousemaps && g:netrw_retmap -" call Decho("set up Rexplore 2-leftmouse") +" call Decho("(NetrwMaps) set up Rexplore 2-leftmouse") if !hasmapto("<Plug>NetrwReturn") if maparg("<2-leftmouse>","n") == "" || maparg("<2-leftmouse>","n") =~ '^-$' -" call Decho("making map for 2-leftmouse") +" call Decho("(NetrwMaps) making map for 2-leftmouse") nmap <unique> <silent> <2-leftmouse> <Plug>NetrwReturn elseif maparg("<c-leftmouse>","n") == "" -" call Decho("making map for c-leftmouse") +" call Decho("(NetrwMaps) making map for c-leftmouse") nmap <unique> <silent> <c-leftmouse> <Plug>NetrwReturn endif endif nno <silent> <Plug>NetrwReturn :Rexplore<cr> -" call Decho("made <Plug>NetrwReturn map") +" call Decho("(NetrwMaps) made <Plug>NetrwReturn map") endif if a:islocal -" call Decho("make local maps") +" call Decho("(NetrwMaps) make local maps") " local normal-mode maps nnoremap <buffer> <silent> a :call <SID>NetrwHide(1)<cr> nnoremap <buffer> <silent> % :call <SID>NetrwOpenFile(1)<cr> @@ -2144,6 +2901,7 @@ fun! s:NetrwMaps(islocal) nnoremap <buffer> <silent> md :<c-u>call <SID>NetrwMarkFileDiff(1)<cr> nnoremap <buffer> <silent> me :<c-u>call <SID>NetrwMarkFileEdit(1)<cr> nnoremap <buffer> <silent> mf :<c-u>call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> mF :<c-u>call <SID>NetrwUnmarkList(bufnr("%"),b:netrw_curdir)<cr> nnoremap <buffer> <silent> mg :<c-u>call <SID>NetrwMarkFileGrep(1)<cr> nnoremap <buffer> <silent> mh :<c-u>call <SID>NetrwMarkHideSfx(1)<cr> nnoremap <buffer> <silent> mm :<c-u>call <SID>NetrwMarkFileMove(1)<cr> @@ -2162,11 +2920,13 @@ fun! s:NetrwMaps(islocal) nnoremap <buffer> <silent> P :call <SID>NetrwPrevWinOpen(1)<cr> nnoremap <buffer> <silent> qb :<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> nnoremap <buffer> <silent> qf :<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> qF :<c-u>call <SID>NetrwMarkFileQFEL(1,getqflist())<cr> nnoremap <buffer> <silent> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> nnoremap <buffer> <silent> s :call <SID>NetrwSortStyle(1)<cr> nnoremap <buffer> <silent> S :call <SID>NetSortSequence(1)<cr> - nnoremap <buffer> <silent> T :call <SID>NetrwSplit(4)<bar>norm! gT<cr> nnoremap <buffer> <silent> t :call <SID>NetrwSplit(4)<cr> + nnoremap <buffer> <silent> Tb :<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> + nnoremap <buffer> <silent> Th :<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> nnoremap <buffer> <silent> u :<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr> nnoremap <buffer> <silent> U :<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr> nnoremap <buffer> <silent> v :call <SID>NetrwSplit(5)<cr> @@ -2209,11 +2969,13 @@ fun! s:NetrwMaps(islocal) inoremap <buffer> <silent> P <c-o>:call <SID>NetrwPrevWinOpen(1)<cr> inoremap <buffer> <silent> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> inoremap <buffer> <silent> qf <c-o>:<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr> + inoremap <buffer> <silent> qF :<c-u>call <SID>NetrwMarkFileQFEL(1,getqflist())<cr> inoremap <buffer> <silent> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> inoremap <buffer> <silent> s <c-o>:call <SID>NetrwSortStyle(1)<cr> inoremap <buffer> <silent> S <c-o>:call <SID>NetSortSequence(1)<cr> - inoremap <buffer> <silent> T <c-o>:call <SID>NetrwSplit(4)<bar>norm! gT<cr> inoremap <buffer> <silent> t <c-o>:call <SID>NetrwSplit(4)<cr> + inoremap <buffer> <silent> Tb <c-o>:<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> + inoremap <buffer> <silent> Th <c-o>:<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> inoremap <buffer> <silent> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr> inoremap <buffer> <silent> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr> inoremap <buffer> <silent> v <c-o>:call <SID>NetrwSplit(5)<cr> @@ -2240,6 +3002,8 @@ fun! s:NetrwMaps(islocal) if g:netrw_mousemaps == 1 nmap <buffer> <leftmouse> <Plug>NetrwLeftmouse nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(1)<cr> + nmap <buffer> <s-rightdrag> <Plug>NetrwRightdrag + nno <buffer> <silent> <Plug>NetrwRightdrag <leftmouse>:call <SID>NetrwRightdrag(1)<cr> nmap <buffer> <middlemouse> <Plug>NetrwMiddlemouse nno <buffer> <silent> <Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(1)<cr> nmap <buffer> <s-leftmouse> <Plug>NetrwSLeftmouse @@ -2270,7 +3034,7 @@ fun! s:NetrwMaps(islocal) nnoremap <buffer> <F1> :he netrw-quickhelp<cr> else " remote -" call Decho("make remote maps") +" call Decho("(NetrwMaps) make remote maps") call s:RemotePathAnalysis(b:netrw_curdir) " remote normal-mode maps nnoremap <buffer> <silent> <cr> :call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr> @@ -2282,6 +3046,7 @@ fun! s:NetrwMaps(islocal) nnoremap <buffer> <silent> md :<c-u>call <SID>NetrwMarkFileDiff(0)<cr> nnoremap <buffer> <silent> me :<c-u>call <SID>NetrwMarkFileEdit(0)<cr> nnoremap <buffer> <silent> mf :<c-u>call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> mF :<c-u>call <SID>NetrwUnmarkList(bufnr("%"),b:netrw_curdir)<cr> nnoremap <buffer> <silent> mg :<c-u>call <SID>NetrwMarkFileGrep(0)<cr> nnoremap <buffer> <silent> mh :<c-u>call <SID>NetrwMarkHideSfx(0)<cr> nnoremap <buffer> <silent> mm :<c-u>call <SID>NetrwMarkFileMove(0)<cr> @@ -2309,11 +3074,13 @@ fun! s:NetrwMaps(islocal) nnoremap <buffer> <silent> qb :<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> nnoremap <buffer> <silent> mB :<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> nnoremap <buffer> <silent> qf :<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> qF :<c-u>call <SID>NetrwMarkFileQFEL(0,getqflist())<cr> nnoremap <buffer> <silent> r :let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> nnoremap <buffer> <silent> s :call <SID>NetrwSortStyle(0)<cr> nnoremap <buffer> <silent> S :call <SID>NetSortSequence(0)<cr> nnoremap <buffer> <silent> t :call <SID>NetrwSplit(1)<cr> - nnoremap <buffer> <silent> T :call <SID>NetrwSplit(1)<bar>norm! gT<cr> + nnoremap <buffer> <silent> Tb :<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> + nnoremap <buffer> <silent> Th :<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> nnoremap <buffer> <silent> u :<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr> nnoremap <buffer> <silent> U :<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr> nnoremap <buffer> <silent> v :call <SID>NetrwSplit(2)<cr> @@ -2354,11 +3121,13 @@ fun! s:NetrwMaps(islocal) inoremap <buffer> <silent> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> inoremap <buffer> <silent> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> inoremap <buffer> <silent> qf <c-o>:<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr> + inoremap <buffer> <silent> qF :<c-u>call <SID>NetrwMarkFileQFEL(0,getqflist())<cr> inoremap <buffer> <silent> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~ 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> inoremap <buffer> <silent> s <c-o>:call <SID>NetrwSortStyle(0)<cr> inoremap <buffer> <silent> S <c-o>:call <SID>NetSortSequence(0)<cr> inoremap <buffer> <silent> t <c-o>:call <SID>NetrwSplit(1)<cr> - inoremap <buffer> <silent> T <c-o>:call <SID>NetrwSplit(1)<bar>norm! gT<cr> + inoremap <buffer> <silent> Tb <c-o>:<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> + inoremap <buffer> <silent> Th <c-o>:<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> inoremap <buffer> <silent> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr> inoremap <buffer> <silent> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr> inoremap <buffer> <silent> v <c-o>:call <SID>NetrwSplit(2)<cr> @@ -2381,6 +3150,8 @@ fun! s:NetrwMaps(islocal) if g:netrw_mousemaps == 1 nmap <leftmouse> <Plug>NetrwLeftmouse nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(0)<cr> + nmap <buffer> <leftdrag> <Plug>NetrwLeftdrag + nno <buffer> <silent> <Plug>NetrwLeftdrag :call <SID>NetrwLeftdrag(0)<cr> nmap <middlemouse> <Plug>NetrwMiddlemouse nno <buffer> <silent> <middlemouse> <Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(0)<cr> nmap <buffer> <s-leftmouse> <Plug>NetrwSLeftmouse @@ -2441,6 +3212,10 @@ endfun " 6: (user: <mB>) delete bookmark fun! s:NetrwBookHistHandler(chg,curdir) " call Dfunc("s:NetrwBookHistHandler(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count." histcnt=".g:netrw_dirhist_cnt." histmax=".g:netrw_dirhistmax) + if !exists("g:netrw_dirhistmax") || g:netrw_dirhistmax <= 0 +" " call Dret("s:NetrwBookHistHandler - suppressed due to g:netrw_dirhistmax") + return + endif let ykeep= @@ if a:chg == 0 @@ -2458,8 +3233,9 @@ fun! s:NetrwBookHistHandler(chg,curdir) elseif a:chg == 1 " change to the bookmarked directory -" call Decho("(user: <".v:count."mb>) change to the bookmarked directory") +" call Decho("(user: <".v:count."gb>) change to the bookmarked directory") if exists("g:netrw_bookmarklist[v:count-1]") +" call Decho("(user: <".v:count."gb>) bookmarklist=".string(g:netrw_bookmarklist)) exe "keepj e ".fnameescape(g:netrw_bookmarklist[v:count-1]) else echomsg "Sorry, bookmark#".v:count." doesn't exist!" @@ -2475,7 +3251,7 @@ fun! s:NetrwBookHistHandler(chg,curdir) let cnt= 1 for bmd in g:netrw_bookmarklist " call Decho("Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1]) - echo "Netrw Bookmark#".cnt.": ".g:netrw_bookmarklist[cnt-1] + echo printf("Netrw Bookmark#%-2d: %s",cnt,g:netrw_bookmarklist[cnt-1]) let didwork = 1 let cnt = cnt + 1 endfor @@ -2488,14 +3264,14 @@ fun! s:NetrwBookHistHandler(chg,curdir) if g:netrw_dirhistmax > 0 while ( first || cnt != g:netrw_dirhist_cnt ) " call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:netrw_dirhist_cnt) - let histcnt= histcnt + 1 if exists("g:netrw_dirhist_{cnt}") " call Decho("Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt}) - echo "Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt} + echo printf("Netrw History#%-2d: %s",histcnt,g:netrw_dirhist_{cnt}) let didwork= 1 endif - let first = 0 - let cnt = ( cnt - 1 ) % g:netrw_dirhistmax + let histcnt = histcnt + 1 + let first = 0 + let cnt = ( cnt - 1 ) % g:netrw_dirhistmax if cnt < 0 let cnt= cnt + g:netrw_dirhistmax endif @@ -2522,7 +3298,7 @@ fun! s:NetrwBookHistHandler(chg,curdir) " u: change to the previous directory stored on the history list " call Decho("(user: <u>) chg to prev dir from history") if g:netrw_dirhistmax > 0 - let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - 1 ) % g:netrw_dirhistmax + let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - v:count1 ) % g:netrw_dirhistmax if g:netrw_dirhist_cnt < 0 let g:netrw_dirhist_cnt= g:netrw_dirhist_cnt + g:netrw_dirhistmax endif @@ -2543,7 +3319,7 @@ fun! s:NetrwBookHistHandler(chg,curdir) exe "keepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) else if g:netrw_dirhistmax > 0 - let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax + let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + v:count1 ) % g:netrw_dirhistmax else let g:netrw_dirhist_cnt= 0 endif @@ -2585,12 +3361,17 @@ fun! s:NetrwBookHistHandler(chg,curdir) " call Decho("delete bookmark#".v:count."<".g:netrw_bookmarklist[v:count-1].">") let savefile= s:NetrwHome()."/.netrwbook" if filereadable(savefile) +" call Decho("merge bookmarks (active and file)") keepj call s:NetrwBookHistSave() " done here to merge bookmarks first +" call Decho("bookmark delete savefile<".savefile.">") keepj call delete(savefile) endif +" call Decho("remove g:netrw_bookmarklist[".(v:count-1)."]") keepj call remove(g:netrw_bookmarklist,v:count-1) +" call Decho("resulting g:netrw_bookmarklist=".string(g:netrw_bookmarklist)) endif call s:NetrwBookmarkMenu() + call s:NetrwTgtMenu() let @@= ykeep " call Dret("s:NetrwBookHistHandler") endfun @@ -2600,19 +3381,23 @@ endfun " Sister function: s:NetrwBookHistSave() fun! s:NetrwBookHistRead() " call Dfunc("s:NetrwBookHistRead()") + if !exists("g:netrw_dirhistmax") || g:netrw_dirhistmax <= 0 +" " call Dret("s:NetrwBookHistRead - suppressed due to g:netrw_dirhistmax") + return + endif let ykeep= @@ if !exists("s:netrw_initbookhist") let home = s:NetrwHome() let savefile= home."/.netrwbook" if filereadable(savefile) " call Decho("sourcing .netrwbook") - exe "keepj so ".savefile + exe "keepalt keepj so ".savefile endif if g:netrw_dirhistmax > 0 let savefile= home."/.netrwhist" if filereadable(savefile) " call Decho("sourcing .netrwhist") - exe "keepj so ".savefile + exe "keepalt keepj so ".savefile endif let s:netrw_initbookhist= 1 au VimLeave * call s:NetrwBookHistSave() @@ -2629,7 +3414,7 @@ endfun " be unreliable for long-term storage fun! s:NetrwBookHistSave() " call Dfunc("s:NetrwBookHistSave() dirhistmax=".g:netrw_dirhistmax) - if g:netrw_dirhistmax <= 0 + if !exists("g:netrw_dirhistmax") || g:netrw_dirhistmax <= 0 " call Dret("s:NetrwBookHistSave : dirhistmax=".g:netrw_dirhistmax) return endif @@ -2637,14 +3422,14 @@ fun! s:NetrwBookHistSave() let savefile= s:NetrwHome()."/.netrwhist" 1split call s:NetrwEnew() - setlocal cino= com= cpo-=a cpo-=A fo=nroql2 tw=0 report=10000 noswf - setlocal nocin noai noci magic nospell nohid wig= noaw - setlocal ma noro write - if exists("&acd") | setlocal noacd | endif + setl cino= com= cpo-=a cpo-=A fo=nroql2 tw=0 report=10000 noswf + setl nocin noai noci magic nospell nohid wig= noaw + setl ma noro write + if exists("+acd") | setl noacd | endif sil! keepj keepalt %d " save .netrwhist -- no attempt to merge - sil! file .netrwhist + sil! keepalt file .netrwhist call setline(1,"let g:netrw_dirhistmax =".g:netrw_dirhistmax) call setline(2,"let g:netrw_dirhist_cnt =".g:netrw_dirhist_cnt) let lastline = line("$") @@ -2662,7 +3447,7 @@ fun! s:NetrwBookHistSave() if filereadable(savefile) let booklist= deepcopy(g:netrw_bookmarklist) - exe "sil keepj so ".savefile + exe "sil keepj keepalt so ".savefile for bdm in booklist if index(g:netrw_bookmarklist,bdm) == -1 call add(g:netrw_bookmarklist,bdm) @@ -2678,7 +3463,7 @@ fun! s:NetrwBookHistSave() endif let bgone= bufnr("%") q! - exe bgone."bwipe!" + exe "keepalt ".bgone."bwipe!" " call Dret("s:NetrwBookHistSave") endfun @@ -2691,7 +3476,7 @@ endfun fun! s:NetrwBrowse(islocal,dirname) if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif " call Dfunc("s:NetrwBrowse(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".w:netrw_liststyle." ".g:loaded_netrw." buf#".bufnr("%")."<".bufname("%")."> win#".winnr()) -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) +" call Decho("(NetrwBrowse) tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) " call Dredir("ls!") " s:NetrwBrowse: initialize history {{{3 if !exists("s:netrw_initbookhist") @@ -2729,38 +3514,38 @@ fun! s:NetrwBrowse(islocal,dirname) " s:NetrwBrowse: re-instate any marked files {{{3 if exists("s:netrwmarkfilelist_{bufnr('%')}") -" call Decho("clearing marked files") +" call Decho("(NetrwBrowse) clearing marked files") 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("keepjumps lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")") +" call Decho("(NetrwBrowse) handle w:netrw_acdkeep:") +" call Decho("(NetrwBrowse) keepjumps lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")") exe 'keepj lcd '.fnameescape(dirname) call s:NetrwSafeOptions() -" call Decho("getcwd<".getcwd().">") +" call Decho("(NetrwBrowse) getcwd<".getcwd().">") elseif !a:islocal && dirname !~ '[\/]$' && dirname !~ '^"' " s:NetrwBrowse: looks like a remote regular file, attempt transfer {{{3 -" call Decho("attempt transfer as regular file<".dirname.">") +" call Decho("(NetrwBrowse) attempt transfer as regular file<".dirname.">") " 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("(NetrwBrowse) new path<".path.">") call s:RemotePathAnalysis(dirname) " s:NetrwBrowse: remote-read the requested file into current buffer {{{3 keepj mark ' call s:NetrwEnew(dirname) call s:NetrwSafeOptions() - setlocal ma noro -" call Decho("setlocal ma noro") + setl ma noro +" call Decho("(NetrwBrowse) setl ma noro") let b:netrw_curdir = dirname let url = s:method."://".s:user.s:machine.(s:port ? ":".s:port : "")."/".s:path -" call Decho("exe sil! keepalt file ".fnameescape(url)." (bt=".&bt.")") +" call Decho("(NetrwBrowse) exe sil! keepalt file ".fnameescape(url)." (bt=".&bt.")") exe "sil! keepj keepalt file ".fnameescape(url) exe "sil! keepj keepalt doau BufReadPre ".fnameescape(s:fname) sil call netrw#NetRead(2,url) @@ -2772,7 +3557,7 @@ 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("(NetrwBrowse) setl ma nomod") setl ma nomod " call Decho("(NetrwBrowse) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") @@ -2795,24 +3580,24 @@ fun! s:NetrwBrowse(islocal,dirname) 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("(NetrwBrowse) bufnr(%)=".bufnr('%')) +" call Decho("(NetrwBrowse) exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/") exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" else -" call Decho("2match none") +" call Decho("(NetrwBrowse) 2match none") 2match none endif - if reusing + if reusing && line("$") > 1 call s:NetrwOptionRestore("w:") " call Decho("(NetrwBrowse) setl noma nomod nowrap") 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("(NetrwBrowse) (set noma nomod nowrap) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Dret("s:NetrwBrowse : re-using buffer") return endif " set b:netrw_curdir to the new directory name {{{3 -" call Decho("set b:netrw_curdir to the new directory name: (buf#".bufnr("%").")") +" call Decho("(NetrwBrowse) set b:netrw_curdir to the new directory name: (buf#".bufnr("%").")") let b:netrw_curdir= dirname if b:netrw_curdir =~ '[/\\]$' let b:netrw_curdir= substitute(b:netrw_curdir,'[/\\]$','','e') @@ -2830,21 +3615,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("(NetrwBrowse) b:netrw_curdir<".b:netrw_curdir.">") " ------------ " (local only) {{{3 " ------------ if a:islocal -" call Decho("local only:") +" call Decho("(NetrwBrowse) local only:") " 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("(NetrwBrowse) handle g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd) +" call Decho("(NetrwBrowse) l:acd".(exists("&l:acd")? "=".&l:acd : " doesn't exist")) if !exists("&l:acd") || !&l:acd " call Decho('exe keepjumps lcd '.fnameescape(b:netrw_curdir)) try @@ -2870,23 +3655,23 @@ fun! s:NetrwBrowse(islocal,dirname) " remote handling: {{{3 " -------------------------------- else -" call Decho("remote only:") +" call Decho("(NetrwBrowse) remote only:") " 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("(NetrwBrowse) b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist")."> dirname<".dirname.">") if dirname =~ "^NetrwTreeListing\>" let dirname= b:netrw_curdir -" call Decho("(dirname was <NetrwTreeListing>) dirname<".dirname.">") +" call Decho("(NetrwBrowse) (dirname was <NetrwTreeListing>) dirname<".dirname.">") elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") let dirname= substitute(b:netrw_curdir,'\\','/','g') if dirname !~ '/$' let dirname= dirname.'/' endif let b:netrw_curdir = dirname -" call Decho("(liststyle is TREELIST) dirname<".dirname.">") +" call Decho("(NetrwBrowse) (liststyle is TREELIST) dirname<".dirname.">") else let dirname = substitute(dirname,'\\','/','g') -" call Decho("(normal) dirname<".dirname.">") +" call Decho("(NetrwBrowse) (normal) dirname<".dirname.">") endif let dirpat = '^\(\w\{-}\)://\(\w\+@\)\=\([^/]\+\)/\(.*\)$' @@ -2902,7 +3687,7 @@ fun! s:NetrwBrowse(islocal,dirname) return endif let b:netrw_curdir= dirname -" call Decho("b:netrw_curdir<".b:netrw_curdir."> (remote)") +" call Decho("(NetrwBrowse) b:netrw_curdir<".b:netrw_curdir."> (remote)") endif " (additional remote handling) " ----------------------- @@ -2912,7 +3697,7 @@ fun! s:NetrwBrowse(islocal,dirname) keepj call s:PerformListing(a:islocal) if v:version >= 700 && has("balloon_eval") && &beval == 0 && &l:bexpr == "" && !exists("g:netrw_nobeval") let &l:bexpr= "netrw#NetrwBalloonHelp()" -" call Decho("set up balloon help: l:bexpr=".&l:bexpr) +" call Decho("(NetrwBrowse) set up balloon help: l:bexpr=".&l:bexpr) set beval endif call s:NetrwOptionRestore("w:") @@ -2977,35 +3762,36 @@ fun! s:NetrwGetBuffer(islocal,dirname) let dirname= a:dirname " re-use buffer if possible {{{3 -" call Decho("--re-use a buffer if possible--") +" call Decho("(NetrwGetBuffer) --re-use a buffer if possible--") if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST " find NetrwTreeList buffer if there is one -" call Decho("case liststyle=treelist: find NetrwTreeList buffer if there is one") +" call Decho("(NetrwGetBuffer) case liststyle=treelist: find NetrwTreeList buffer if there is one") if exists("w:netrw_treebufnr") && w:netrw_treebufnr > 0 -" call Decho(" re-use w:netrw_treebufnr=".w:netrw_treebufnr) +" call Decho("(NetrwGetBuffer) re-use w:netrw_treebufnr=".w:netrw_treebufnr) + sil keepj %d let eikeep= &ei set ei=all - exe "sil! b ".w:netrw_treebufnr + exe "sil! keepalt b ".w:netrw_treebufnr let &ei= eikeep -" call Dret("s:NetrwGetBuffer 1<buffer not cleared> : bufnum#".w:netrw_treebufnr."<NetrwTreeListing>") - return 1 +" call Dret("s:NetrwGetBuffer 0<buffer cleared> : bufnum#".w:netrw_treebufnr."<NetrwTreeListing>") + return 0 endif let bufnum= -1 -" call Decho(" liststyle=TREE but w:netrw_treebufnr doesn't exist") +" call Decho("(NetrwGetBuffer) liststyle=TREE but w:netrw_treebufnr doesn't exist") 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("(NetrwGetBuffer) case listtyle not treelist: find buffer numnber of buffer named precisely the same as dirname--") " call Dredir("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("(NetrwGetBuffer) find buffer<".dirname.">'s number ") +" call Decho("(NetrwGetBuffer) bufnr(dirname<".escape(dirname,'\').">)=".bufnum) if bufnum < 0 && dirname !~ '/$' " try appending a trailing / -" call Decho(" try appending a trailing / to dirname<".dirname.">") +" call Decho("(NetrwGetBuffer) try appending a trailing / to dirname<".dirname.">") let bufnum= bufnr(escape(dirname.'/','\')) if bufnum > 0 let dirname= dirname.'/' @@ -3014,30 +3800,30 @@ fun! s:NetrwGetBuffer(islocal,dirname) if bufnum < 0 && dirname =~ '/$' " try removing a trailing / -" call Decho(" try removing a trailing / from dirname<".dirname.">") +" call Decho("(NetrwGetBuffer) try removing a trailing / from dirname<".dirname.">") 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("(NetrwGetBuffer) findbuf1: bufnum=bufnr('".dirname."')=".bufnum." bufname(".bufnum.")<".bufname(bufnum)."> (initial)") " note: !~ was used just below, but that means using ../ to go back would match (ie. abc/def/ and abc/ matches) if bufnum > 0 && bufname(bufnum) != dirname && bufname(bufnum) != '.' " handle approximate matches -" call Decho(" handling approx match: bufnum#".bufnum.">0 AND bufname<".bufname(bufnum).">!=dirname<".dirname."> AND bufname(".bufnum.")!='.'") +" call Decho("(NetrwGetBuffer) handling approx match: bufnum#".bufnum.">0 AND bufname<".bufname(bufnum).">!=dirname<".dirname."> AND bufname(".bufnum.")!='.'") let ibuf = 1 let buflast = bufnr("$") -" call Decho(" findbuf2: buflast=bufnr($)=".buflast) +" call Decho("(NetrwGetBuffer) findbuf2: buflast=bufnr($)=".buflast) 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("(NetrwGetBuffer) findbuf3: while [ibuf=",ibuf."]<=[buflast=".buflast."]: dirname<".dirname."> bname=bufname(".ibuf.")<".bname.">") 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("(NetrwGetBuffer) findbuf3a: passes test 1 : dirname<".dirname.'> =~ /'.bname.'/\=$ && dirname !~ ^/') break endif if bname =~ '^'.dirname.'/\=$' @@ -3060,59 +3846,59 @@ fun! s:NetrwGetBuffer(islocal,dirname) else let bufnum= ibuf endif -" call Decho(" findbuf4: bufnum=".bufnum." (ibuf=".ibuf." buflast=".buflast.")") +" call Decho("(NetrwGetBuffer) findbuf4: bufnum=".bufnum." (ibuf=".ibuf." buflast=".buflast.")") 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! keepj mark ' +" call Decho("(NetrwGetBuffer) get enew buffer and name it OR re-use buffer") + sil! keepj keepalt mark ' if bufnum < 0 || !bufexists(bufnum) -" call Decho("--get enew buffer and name it (bufnum#".bufnum."<0 OR bufexists(".bufnum.")=".bufexists(bufnum)."==0)") +" call Decho("(NetrwGetBuffer) --get enew buffer and name it (bufnum#".bufnum."<0 OR bufexists(".bufnum.")=".bufexists(bufnum)."==0)") call s:NetrwEnew(dirname) -" call Decho(" got enew buffer#".bufnr("%")." (altbuf<".expand("#").">)") +" call Decho("(NetrwGetBuffer) got enew buffer#".bufnr("%")." (altbuf<".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("(NetrwGetBuffer) --transform enew buffer#".bufnr("%")." into a NetrwTreeListing --") 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("(NetrwGetBuffer) exe sil! keepalt file NetrwTreeListing ".fnameescape(s:netrw_treelistnum)) exe 'sil! keepalt file NetrwTreeListing\ '.fnameescape(s:netrw_treelistnum) set bt=nofile noswf nnoremap <silent> <buffer> [ :sil call <SID>TreeListMove('[')<cr> nnoremap <silent> <buffer> ] :sil call <SID>TreeListMove(']')<cr> nnoremap <silent> <buffer> [[ :sil call <SID>TreeListMove('[')<cr> nnoremap <silent> <buffer> ]] :sil call <SID>TreeListMove(']')<cr> -" call Decho(" tree listing#".s:netrw_treelistnum." bufnr=".w:netrw_treebufnr) +" call Decho("(NetrwGetBuffer) tree listing#".s:netrw_treelistnum." bufnr=".w:netrw_treebufnr) 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("(NetrwGetBuffer) errmsg<".v:errmsg."> bufnr(escdirname<".escdirname.">)=".bufnr(escdirname)." bufname()<".bufname(bufnr(escdirname)).">") " call Decho(' exe sil! keepalt file '.escdirname) " let v:errmsg= "" " Decho exe 'sil! keepalt file '.escdirname -" call Decho(" errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">") +" call Decho("(NetrwGetBuffer) errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">") endif -" call Decho(" named enew buffer#".bufnr("%")."<".bufname("%").">") +" call Decho("(NetrwGetBuffer) named enew buffer#".bufnr("%")."<".bufname("%").">") else " Re-use the buffer -" call Decho("--re-use buffer#".bufnum." (bufnum#".bufnum.">=0 AND bufexists(".bufnum.")=".bufexists(bufnum)."!=0)") +" call Decho("(NetrwGetBuffer) --re-use buffer#".bufnum." (bufnum#".bufnum.">=0 AND bufexists(".bufnum.")=".bufexists(bufnum)."!=0)") let eikeep= &ei set ei=all if getline(2) =~ '^" Netrw Directory Listing' -" call Decho(" getline(2)<".getline(2).'> matches "Netrw Directory Listing" : using keepalt b '.bufnum) +" call Decho("(NetrwGetBuffer) getline(2)<".getline(2).'> matches "Netrw Directory Listing" : using keepalt b '.bufnum) exe "sil! keepalt b ".bufnum else -" call Decho(" getline(2)<".getline(2).'> does not match "Netrw Directory Listing" : using b '.bufnum) - exe "sil! b ".bufnum +" call Decho("(NetrwGetBuffer) getline(2)<".getline(2).'> does not match "Netrw Directory Listing" : using b '.bufnum) + exe "sil! keepalt b ".bufnum endif if bufname("%") == '.' -" call Decho("exe sil! keepalt file ".fnameescape(getcwd())) +" call Decho("(NetrwGetBuffer) exe sil! keepalt file ".fnameescape(getcwd())) exe "sil! keepalt file ".fnameescape(getcwd()) endif let &ei= eikeep @@ -3126,8 +3912,8 @@ fun! s:NetrwGetBuffer(islocal,dirname) " call Dret("s:NetrwGetBuffer 0<cleared buffer> : 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") +" call Decho("(NetrwGetBuffer) --re-use tree listing--") +" call Decho("(NetrwGetBuffer) clear buffer<".expand("%")."> with :%d") sil keepj %d keepj call s:NetrwListSettings(a:islocal) " call Dret("s:NetrwGetBuffer 0<cleared buffer> : re-using buffer#".bufnr("%").", but treelist mode always needs a refresh") @@ -3143,15 +3929,15 @@ 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("(NetrwGetBuffer) --do netrw settings: make this buffer#".bufnr("%")." not-a-file, modifiable, not line-numbered, etc--") let fname= expand("%") keepj call s:NetrwListSettings(a:islocal) -" call Decho("exe sil! keepalt file ".fnameescape(fname)) +" call Decho("(NetrwGetBuffer) exe sil! keepalt file ".fnameescape(fname)) exe "sil! keepj keepalt file ".fnameescape(fname) " delete all lines from buffer {{{3 -" call Decho("--delete all lines from buffer--") -" call Decho(" clear buffer<".expand("%")."> with :%d") +" call Decho("(NetrwGetBuffer) --delete all lines from buffer--") +" call Decho("(NetrwGetBuffer) clear buffer<".expand("%")."> with :%d") sil! keepalt keepj %d " call Dret("s:NetrwGetBuffer 0<cleared buffer> : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) @@ -3286,21 +4072,21 @@ endfun fun! s:NetrwListSettings(islocal) " call Dfunc("s:NetrwListSettings(islocal=".a:islocal.")") let fname= bufname("%") -" call Decho("setlocal bt=nofile nobl ma nonu nowrap noro") - setlocal bt=nofile nobl ma nonu nowrap noro -" call Decho("exe sil! keepalt file ".fnameescape(fname)) +" call Decho("(NetrwListSettings) setl bt=nofile nobl ma nonu nowrap noro") + setl bt=nofile nobl ma nonu nowrap noro +" call Decho("(NetrwListSettings) exe sil! keepalt file ".fnameescape(fname)) exe "sil! keepalt file ".fnameescape(fname) if g:netrw_use_noswf - setlocal noswf + setl noswf endif " call Dredir("ls!") -" call Decho("(LocalListing) exe setl ts=".(g:netrw_maxfilenamelen+1)) +" call Decho("(NetrwListSettings) exe setl ts=".(g:netrw_maxfilenamelen+1)) exe "setl ts=".(g:netrw_maxfilenamelen+1) - setlocal isk+=.,~,- + setl isk+=.,~,- if g:netrw_fastbrowse > a:islocal - setlocal bh=hide + setl bh=hide else - setlocal bh=delete + setl bh=delete endif " call Dret("s:NetrwListSettings") endfun @@ -3344,8 +4130,8 @@ fun! s:NetrwListStyle(islocal) let w:netrw_liststyle = g:netrw_liststyle let g:netrw_list_cmd = substitute(g:netrw_list_cmd,' -l','','ge') endif - setlocal ma noro -" call Decho("setlocal ma noro") + setl ma noro +" call Decho("setl ma noro") " clear buffer - this will cause NetrwBrowse/LocalBrowseCheck to do a refresh " call Decho("clear buffer<".expand("%")."> with :%d") @@ -3422,7 +4208,7 @@ fun! s:NetrwBookmarkMenu() endif " show bookmarked places - if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] + 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) @@ -3509,19 +4295,19 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " 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.">") +" call Decho("(NetrwBrowseChgDir) adjusting dirname<".dirname.">") endif if newdir !~ dirpat " ------------------------------ " NetrwBrowseChgDir: edit a file {{{3 " ------------------------------ -" call Decho('(NetrwBrowseChgDir) case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">") +" call Decho('(NetrwBrowseChgDir:edit-a-file) case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">") " save position for benefit of Rexplore let s:rexposn_{bufnr("%")}= netrw#NetrwSavePosn() -" call Decho("(NetrwBrowseChgDir) setting s:rexposn_".bufnr("%")." to SavePosn") +" call Decho("(NetrwBrowseChgDir:edit-a-file) setting s:rexposn_".bufnr("%")." to SavePosn") if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") && newdir !~ '^\(/\|\a:\)' let dirname= s:NetrwTreeDir() if dirname =~ '/$' @@ -3529,35 +4315,35 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) else let dirname= s:NetrwTreeDir()."/".newdir endif -" call Decho("(NetrwBrowseChgDir) dirname<".dirname.">") -" call Decho("(NetrwBrowseChgDir) tree listing") +" call Decho("(NetrwBrowseChgDir:edit-a-file) dirname<".dirname.">") +" call Decho("(NetrwBrowseChgDir:edit-a-file) tree listing") elseif newdir =~ '^\(/\|\a:\)' let dirname= newdir else let dirname= s:ComposePath(dirname,newdir) endif -" call Decho("(NetrwBrowseChgDir) handling a file: dirname<".dirname."> (a:0=".a:0.")") +" call Decho("(NetrwBrowseChgDir:edit-a-file) handling a file: dirname<".dirname."> (a:0=".a:0.")") " this lets NetrwBrowseX avoid the edit if a:0 < 1 -" call Decho("(NetrwBrowseChgDir) set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist")) +" call Decho("(NetrwBrowseChgDir:edit-a-file) set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist")) keepj call s:NetrwOptionRestore("s:") if !exists("s:didsplit") -" call Decho("s:didsplit does not exist; g:netrw_browse_split=".g:netrw_browse_split." win#".winnr()) +" call Decho("(NetrwBrowseChgDir:edit-a-file) s:didsplit does not exist; g:netrw_browse_split=".g:netrw_browse_split." win#".winnr()) if g:netrw_browse_split == 1 " horizontally splitting the window first - new + keepalt new if !&ea - wincmd _ + keepalt wincmd _ endif elseif g:netrw_browse_split == 2 " vertically splitting the window first - rightb vert new + keepalt rightb vert new if !&ea - wincmd | + keepalt wincmd | endif elseif g:netrw_browse_split == 3 " open file in new tab - tabnew + keepalt tabnew elseif g:netrw_browse_split == 4 " act like "P" (ie. open previous window) if s:NetrwPrevWinOpen(2) == 3 @@ -3567,11 +4353,11 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) endif else " handling a file, didn't split, so remove menu -" call Decho("(NetrwBrowseChgDir) handling a file+didn't split, so remove menu") +" call Decho("(NetrwBrowseChgDir:edit-a-file) handling a file+didn't split, so remove menu") call s:NetrwMenu(0) " optional change to window if g:netrw_chgwin >= 1 - exe "keepjumps ".g:netrw_chgwin."wincmd w" + exe "keepj keepalt ".g:netrw_chgwin."wincmd w" endif endif endif @@ -3579,11 +4365,11 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " the point where netrw actually edits the (local) file " if its local only: LocalBrowseCheck() doesn't edit a file, but NetrwBrowse() will if a:islocal -" call Decho("(NetrwBrowseChgDir) edit local file: exe e! ".fnameescape(dirname)) - exe "e! ".fnameescape(dirname) +" call Decho("(NetrwBrowseChgDir:edit-a-file) edit local file: exe e! ".fnameescape(dirname)) + exe "keepj keepalt e! ".fnameescape(dirname) call s:NetrwCursor() else -" call Decho("(NetrwBrowseChgDir) remote file: NetrwBrowse will edit it") +" call Decho("(NetrwBrowseChgDir:edit-a-file) remote file: NetrwBrowse will edit it") endif let dolockout= 1 @@ -3592,12 +4378,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("(NetrwBrowseChgDir) handle optional Funcrefs") +" call Decho("(NetrwBrowseChgDir:edit-a-file) handle optional Funcrefs") if type(g:Netrw_funcref) == 2 -" call Decho("(NetrwBrowseChgDir) handling a g:Netrw_funcref") +" call Decho("(NetrwBrowseChgDir:edit-a-file) handling a g:Netrw_funcref") keepj call g:Netrw_funcref() elseif type(g:Netrw_funcref) == 3 -" call Decho("(NetrwBrowseChgDir) handling a list of g:Netrw_funcrefs") +" call Decho("(NetrwBrowseChgDir:edit-a-file) handling a list of g:Netrw_funcrefs") for Fncref in g:Netrw_funcref if type(FncRef) == 2 keepj call FncRef() @@ -3611,7 +4397,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " ---------------------------------------------------- " NetrwBrowseChgDir: just go to the new directory spec {{{3 " ---------------------------------------------------- -" call Decho('(NetrwBrowseChgDir) case "just go to new directory spec": newdir<'.newdir.'>') +" call Decho('(NetrwBrowseChgDir:goto-newdir) case "just go to new directory spec": newdir<'.newdir.'>') let dirname = newdir keepj call s:SetRexDir(a:islocal,dirname) keepj call s:NetrwOptionRestore("s:") @@ -3620,37 +4406,37 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " --------------------------------------------- " NetrwBrowseChgDir: refresh the directory list {{{3 " --------------------------------------------- -" call Decho('(NetrwBrowseChgDir) case "refresh directory listing": newdir == "./"') +" call Decho('(NetrwBrowseChgDir:refresh-dirlist) case "refresh directory listing": newdir == "./"') keepj call s:SetRexDir(a:islocal,dirname) elseif newdir == '../' " -------------------------------------- " NetrwBrowseChgDir: go up one directory {{{3 " -------------------------------------- -" call Decho('(NetrwBrowseChgDir) case "go up one directory": newdir == "../"') +" call Decho('(NetrwBrowseChgDir:go-up) case "go up one directory": newdir == "../"') if w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " force a refresh -" call Decho("(NetrwBrowseChgDir) clear buffer<".expand("%")."> with :%d") -" call Decho("(NetrwBrowseChgDir) setl noro ma") +" call Decho("(NetrwBrowseChgDir:go-up) clear buffer<".expand("%")."> with :%d") +" call Decho("(NetrwBrowseChgDir:go-up) setl noro ma") setl noro ma keepj %d endif if has("amiga") " amiga -" call Decho('(NetrwBrowseChgDir) case "go up one directory": newdir == "../" and amiga') +" call Decho('(NetrwBrowseChgDir:go-up) case "go up one directory": newdir == "../" and amiga') if a:islocal let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+$\)','\1','') let dirname= substitute(dirname,'/$','','') else let dirname= substitute(dirname,'^\(.*[/:]\)\([^/]\+/$\)','\1','') endif -" call Decho("(NetrwBrowseChgDir) amiga: dirname<".dirname."> (go up one dir)") +" call Decho("(NetrwBrowseChgDir:go-up) amiga: dirname<".dirname."> (go up one dir)") else " unix or cygwin -" call Decho('(NetrwBrowseChgDir) case "go up one directory": newdir == "../" and unix or cygwin') +" call Decho('(NetrwBrowseChgDir:go-up) case "go up one directory": newdir == "../" and unix or cygwin') if a:islocal let dirname= substitute(dirname,'^\(.*\)/\([^/]\+\)/$','\1','') if dirname == "" @@ -3659,7 +4445,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) else let dirname= substitute(dirname,'^\(\a\+://.\{-}/\{1,2}\)\(.\{-}\)\([^/]\+\)/$','\1\2','') endif -" call Decho("(NetrwBrowseChgDir) unix: dirname<".dirname."> (go up one dir)") +" call Decho("(NetrwBrowseChgDir:go-up) unix: dirname<".dirname."> (go up one dir)") endif keepj call s:SetRexDir(a:islocal,dirname) @@ -3667,9 +4453,9 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " -------------------------------------- " NetrwBrowseChgDir: Handle Tree Listing {{{3 " -------------------------------------- -" call Decho('(NetrwBrowseChgDir) case liststyle is TREELIST and w:netrw_treedict exists') +" call Decho('(NetrwBrowseChgDir: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("(NetrwBrowseChgDir) setl noro ma") +" call Decho("(NetrwBrowseChgDir) (treelist) setl noro ma") setl noro ma if !(exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir")) " call Decho("(NetrwBrowseChgDir) clear buffer<".expand("%")."> with :%d") @@ -3678,24 +4464,24 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) let treedir = s:NetrwTreeDir() let s:treecurpos = nbcd_curpos let haskey= 0 -" call Decho("(NetrwBrowseChgDir) w:netrw_treedict<".string(w:netrw_treedict).">") +" call Decho("(NetrwBrowseChgDir:tree-list) w:netrw_treedict<".string(w:netrw_treedict).">") " search treedict for tree dir as-is if has_key(w:netrw_treedict,treedir) -" call Decho('(NetrwBrowseChgDir) ....searched for treedir<'.treedir.'> : found it!') +" call Decho('(NetrwBrowseChgDir:tree-list) ....searched for treedir<'.treedir.'> : found it!') let haskey= 1 else -" call Decho('(NetrwBrowseChgDir) ....searched for treedir<'.treedir.'> : not found') +" call Decho('(NetrwBrowseChgDir:tree-list) ....searched for treedir<'.treedir.'> : not found') endif " search treedict for treedir with a / appended if !haskey && treedir !~ '/$' if has_key(w:netrw_treedict,treedir."/") let treedir= treedir."/" -" call Decho('(NetrwBrowseChgDir) ....searched.for treedir<'.treedir.'> found it!') +" call Decho('(NetrwBrowseChgDir:tree-list) ....searched.for treedir<'.treedir.'> found it!') let haskey = 1 else -" call Decho('(NetrwBrowseChgDir) ....searched for treedir<'.treedir.'/> : not found') +" call Decho('(NetrwBrowseChgDir:tree-list) ....searched for treedir<'.treedir.'/> : not found') endif endif @@ -3703,16 +4489,16 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) if !haskey && treedir =~ '/$' let treedir= substitute(treedir,'/$','','') if has_key(w:netrw_treedict,treedir) -" call Decho('(NetrwBrowseChgDir) ....searched.for treedir<'.treedir.'> found it!') +" call Decho('(NetrwBrowseChgDir:tree-list) ....searched.for treedir<'.treedir.'> found it!') let haskey = 1 else -" call Decho('(NetrwBrowseChgDir) ....searched for treedir<'.treedir.'> : not found') +" call Decho('(NetrwBrowseChgDir:tree-list) ....searched for treedir<'.treedir.'> : not found') endif endif if haskey " close tree listing for selected subdirectory -" call Decho("(NetrwBrowseChgDir) closing selected subdirectory<".dirname.">") +" call Decho("(NetrwBrowseChgDir:tree-list) closing selected subdirectory<".dirname.">") call remove(w:netrw_treedict,treedir) " call Decho("(NetrwBrowseChgDir) removed entry<".treedir."> from treedict") " call Decho("(NetrwBrowseChgDir) yielding treedict<".string(w:netrw_treedict).">") @@ -3720,7 +4506,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) else " go down one directory let dirname= substitute(treedir,'/*$','/','') -" call Decho("(NetrwBrowseChgDir) go down one dir: treedir<".treedir.">") +" call Decho("(NetrwBrowseChgDir:tree-list) go down one dir: treedir<".treedir.">") endif keepj call s:SetRexDir(a:islocal,dirname) let s:treeforceredraw = 1 @@ -3730,7 +4516,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " NetrwBrowseChgDir: Go down one directory {{{3 " ---------------------------------------- let dirname = s:ComposePath(dirname,newdir) -" call Decho("(NetrwBrowseChgDir) go down one dir: dirname<".dirname."> newdir<".newdir.">") +" call Decho("(NetrwBrowseChgDir:go-down) go down one dir: dirname<".dirname."> newdir<".newdir.">") keepj call s:SetRexDir(a:islocal,dirname) endif @@ -3739,17 +4525,17 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " -------------------------------------- keepj call s:NetrwOptionRestore("s:") if dolockout -" call Decho("(NetrwBrowseChgDir) filewritable(dirname<".dirname.">)=".filewritable(dirname)) +" call Decho("(NetrwBrowseChgDir:restore) filewritable(dirname<".dirname.">)=".filewritable(dirname)) if filewritable(dirname) -" call Decho("(NetrwBrowseChgDir) doing modification lockout settings: ma nomod noro") -" call Decho("(NetrwBrowseChgDir) setl ma nomod noro") +" call Decho("(NetrwBrowseChgDir:restore) doing modification lockout settings: ma nomod noro") +" call Decho("(NetrwBrowseChgDir:restore) setl ma nomod noro") setl ma nomod noro -" call Decho("(NetrwBrowseChgDir) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("(NetrwBrowseChgDir:restore) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") else -" call Decho("(NetrwBrowseChgDir) doing modification lockout settings: ma nomod ro") -" call Decho("(NetrwBrowseChgDir) setl ma nomod noro") +" call Decho("(NetrwBrowseChgDir:restore) doing modification lockout settings: ma nomod ro") +" call Decho("(NetrwBrowseChgDir:restore) setl ma nomod noro") setl ma nomod ro -" call Decho("(NetrwBrowseChgDir) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") +" call Decho("(NetrwBrowseChgDir:restore) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") endif endif let @@= ykeep @@ -3775,7 +4561,7 @@ fun! netrw#NetrwBrowseX(fname,remote) " g:Netrw_corehandler is a function reference (see :help Funcref) " call Decho("g:Netrw_corehandler is a funcref") call g:Netrw_corehandler(a:fname) - elseif type(g:Netrw_corehandler) == 3) + elseif type(g:Netrw_corehandler) == 3 " g:Netrw_corehandler is a List of function references (see :help Funcref) " call Decho("g:Netrw_corehandler is a List") for Fncref in g:Netrw_corehandler @@ -3817,7 +4603,7 @@ fun! netrw#NetrwBrowseX(fname,remote) if a:remote == 1 " create a local copy " call Decho("(remote) a:remote=".a:remote.": create a local copy of <".a:fname.">") - setlocal bh=delete + setl bh=delete call netrw#NetRead(3,a:fname) " attempt to rename tempfile let basename= substitute(a:fname,'^\(.*\)/\(.*\)\.\([^.]*\)$','\2','') @@ -3963,9 +4749,9 @@ fun! netrw#NetrwBrowseX(fname,remote) " endif if a:remote == 1 - setlocal bh=delete bt=nofile + setl bh=delete bt=nofile if g:netrw_use_noswf - setlocal noswf + setl noswf endif exe "sil! keepj norm! \<c-o>" " redraw! @@ -4019,453 +4805,6 @@ fun! s:NetrwClearExplore() endfun " --------------------------------------------------------------------- -" netrw#Explore: launch the local browser in the directory of the current file {{{2 -" indx: == -1: Nexplore -" == -2: Pexplore -" == +: this is overloaded: -" * If Nexplore/Pexplore is in use, then this refers to the -" indx'th item in the w:netrw_explore_list[] of items which -" matched the */pattern **/pattern *//pattern **//pattern -" * If Hexplore or Vexplore, then this will override -" g:netrw_winsize to specify the qty of rows or columns the -" newly split window should have. -" dosplit==0: the window will be split iff the current file has been modified -" dosplit==1: the window will be split before running the local browser -" style == 0: Explore style == 1: Explore! -" == 2: Hexplore style == 3: Hexplore! -" == 4: Vexplore style == 5: Vexplore! -" == 6: Texplore -fun! netrw#Explore(indx,dosplit,style,...) -" call Dfunc("netrw#Explore(indx=".a:indx." dosplit=".a:dosplit." style=".a:style.",a:1<".a:1.">) &modified=".&modified." modifiable=".&modifiable." a:0=".a:0." win#".winnr()." buf#".bufnr("%")) - if !exists("b:netrw_curdir") - let b:netrw_curdir= getcwd() -" call Decho("set b:netrw_curdir<".b:netrw_curdir."> (used getcwd)") - endif - let curdir = simplify(b:netrw_curdir) - let curfiledir = substitute(expand("%:p"),'^\(.*[/\\]\)[^/\\]*$','\1','e') -" call Decho("curdir<".curdir."> curfiledir<".curfiledir.">") - - " save registers - sil! let keepregstar = @* - sil! let keepregplus = @+ - sil! let keepregslash= @/ - - " if dosplit or file has been modified - if a:dosplit || &modified || a:style == 6 -" call Decho("case dosplit=".a:dosplit." modified=".&modified." a:style=".a:style.": dosplit or file has been modified") - call s:SaveWinVars() - let winsz= g:netrw_winsize - if a:indx > 0 - let winsz= a:indx - endif - - if a:style == 0 " Explore, Sexplore -" call Decho("style=0: Explore or Sexplore") - let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz - exe winsz."wincmd s" - - elseif a:style == 1 "Explore!, Sexplore! -" call Decho("style=1: Explore! or Sexplore!") - let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz - exe winsz."wincmd v" - - elseif a:style == 2 " Hexplore -" call Decho("style=2: Hexplore") - let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz - exe "bel ".winsz."wincmd s" - - elseif a:style == 3 " Hexplore! -" call Decho("style=3: Hexplore!") - let winsz= (winsz > 0)? (winsz*winheight(0))/100 : -winsz - exe "abo ".winsz."wincmd s" - - elseif a:style == 4 " Vexplore -" call Decho("style=4: Vexplore") - let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz - exe "lefta ".winsz."wincmd v" - - elseif a:style == 5 " Vexplore! -" call Decho("style=5: Vexplore!") - let winsz= (winsz > 0)? (winsz*winwidth(0))/100 : -winsz - exe "rightb ".winsz."wincmd v" - - elseif a:style == 6 " Texplore - call s:SaveBufVars() -" call Decho("style = 6: Texplore") - exe "tabnew ".fnameescape(curdir) - 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") - endif - keepj norm! 0 - - if a:0 > 0 -" call Decho("case [a:0=".a:0."] > 0") - 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") - let dirname= simplify(substitute(a:1,'\~',expand("$HOME"),'')) -" call Decho("..using dirname<".dirname."> (case: ~ && unix||cygwin)") - elseif a:1 == '.' -" call Decho("..case a:1<".a:1.">: matches .") - 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()").")") - elseif a:1 =~ '\$' -" call Decho("..case a:1<".a:1.">: matches ending $") - let dirname= simplify(expand(a:1)) -" call Decho("..using user-specified dirname<".dirname."> with $env-var") - elseif a:1 !~ '^\*\{1,2}/' -" call Decho("..case a:1<".a:1.">: other, not pattern or filepattern") - let dirname= simplify(a:1) -" call Decho("..using user-specified dirname<".dirname.">") - else -" call Decho("..case a:1: pattern or filepattern") - let dirname= a:1 - endif - else - " clear explore -" call Decho("case a:0=".a:0.": clearing Explore list") - call s:NetrwClearExplore() -" call Dret("netrw#Explore : cleared list") - return - endif - -" call Decho("dirname<".dirname.">") - 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)") - - if dirname =~ '^\*//' - " starpat=1: Explore *//pattern (current directory only search for files containing pattern) -" call Decho("case Explore *//pattern") - let pattern= substitute(dirname,'^\*//\(.*\)$','\1','') - let starpat= 1 -" call Decho("..Explore *//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">") - if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif - - elseif dirname =~ '^\*\*//' - " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) -" call Decho("case Explore **//pattern") - let pattern= substitute(dirname,'^\*\*//','','') - let starpat= 2 -" call Decho("..Explore **//pat: (starpat=".starpat.") dirname<".dirname."> -> pattern<".pattern.">") - - elseif dirname =~ '/\*\*/' - " handle .../**/.../filepat -" call Decho("case Explore .../**/.../filepat") - let prefixdir= substitute(dirname,'^\(.\{-}\)\*\*.*$','\1','') - if prefixdir =~ '^/' || (prefixdir =~ '^\a:/' && (has("win32") || has("win95") || has("win64") || has("win16"))) - let b:netrw_curdir = prefixdir - else - let b:netrw_curdir= getcwd().'/'.prefixdir - endif - let dirname= substitute(dirname,'^.\{-}\(\*\*/.*\)$','\1','') - let starpat= 4; -" call Decho("..pwd<".getcwd()."> dirname<".dirname.">") -" call Decho("..case Explore ../**/../filepat (starpat=".starpat.")") - - elseif dirname =~ '^\*/' - " starpat=3: Explore */filepat (search in current directory for filenames matching filepat) - let starpat= 3 -" call Decho("case Explore */filepat (starpat=".starpat.")") - - elseif dirname=~ '^\*\*/' - " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) - let starpat= 4 -" call Decho("case Explore **/filepat (starpat=".starpat.")") - - else - let starpat= 0 -" call Decho("default case: starpat=".starpat) - endif - - if starpat == 0 && a:indx >= 0 - " [Explore Hexplore Vexplore Sexplore] [dirname] -" call Decho("case starpat==0 && a:indx=".a:indx.": dirname<".dirname."> Explore Hexplore Vexplore Sexplore") - if dirname == "" - let dirname= curfiledir -" call Decho("..empty dirname, using current file's directory<".dirname.">") - endif - if dirname =~ '^scp:' || dirname =~ '^ftp:' -" call Decho("..calling NetrwBrowse(0,dirname<".dirname.">)") - call s:NetrwBrowse(0,dirname) - else - if dirname == ""|let dirname= getcwd()|endif -" call Decho("..calling LocalBrowseCheck(dirname<".dirname.">)") - call netrw#LocalBrowseCheck(dirname) -" call Decho("win#".winnr()." buf#".bufnr("%")." modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) - endif - -" call Decho("curdir<".curdir.">") - if has("win32") || has("win95") || has("win64") || has("win16") - keepj call search('\<'.substitute(curdir,'^.*[/\\]','','e').'\>','cW') - else - keepj call search('\<'.substitute(curdir,'^.*/','','e').'\>','cW') - endif - - " starpat=1: Explore *//pattern (current directory only search for files containing pattern) - " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) - " starpat=3: Explore */filepat (search in current directory for filenames matching filepat) - " 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, <s-down>, <s-up> starpat=".starpat." a:indx=".a:indx) - if !mapcheck("<s-up>","n") && !mapcheck("<s-down>","n") && exists("b:netrw_curdir") -" call Decho("..set up <s-up> and <s-down> maps") - let s:didstarstar= 1 - nnoremap <buffer> <silent> <s-up> :Pexplore<cr> - nnoremap <buffer> <silent> <s-down> :Nexplore<cr> - endif - - if has("path_extra") -" call Decho("..starpat=".starpat.": has +path_extra") - if !exists("w:netrw_explore_indx") - let w:netrw_explore_indx= 0 - endif - - let indx = a:indx -" call Decho("..starpat=".starpat.": set indx= [a:indx=".indx."]") - - if indx == -1 - " Nexplore -" call Decho("..case Nexplore with starpat=".starpat.": (indx=".indx.")") - if !exists("w:netrw_explore_list") " sanity check - keepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or <s-down> improperly; see help for netrw-starstar",40) - sil! let @* = keepregstar - sil! let @+ = keepregstar - sil! let @/ = keepregslash -" call Dret("netrw#Explore") - return - endif - let indx= w:netrw_explore_indx - 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.">") - while indx < w:netrw_explore_listlen && curfile == w:netrw_explore_list[indx] - let indx= indx + 1 -" call Decho("....indx=".indx." (Nexplore while loop)") - 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) - - elseif indx == -2 - " Pexplore -" call Decho("case Pexplore with starpat=".starpat.": (indx=".indx.")") - if !exists("w:netrw_explore_list") " sanity check - keepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or <s-up> improperly; see help for netrw-starstar",41) - sil! let @* = keepregstar - sil! let @+ = keepregstar - sil! let @/ = keepregslash -" call Dret("netrw#Explore") - return - endif - let indx= w:netrw_explore_indx - 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.">") - while indx >= 0 && curfile == w:netrw_explore_list[indx] - let indx= indx - 1 -" call Decho("....indx=".indx." (Pexplore while loop)") - endwhile - if indx < 0 | let indx= 0 | endif -" call Decho("....Pexplore: indx= [w:netrw_explore_indx=".w:netrw_explore_indx."]=".indx) - - else - " Explore -- initialize - " build list of files to Explore with Nexplore/Pexplore -" call Decho("..starpat=".starpat.": case Explore: initialize (indx=".indx.")") - keepj 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.">") - - " 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.">") - try - exe "keepj noautocmd vimgrep /".pattern."/gj ".fnameescape(b:netrw_curdir)."/*" - catch /^Vim\%((\a\+)\)\=:E480/ - call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76) -" call Dret("netrw#Explore : unable to find pattern<".pattern.">") - return - endtry - let w:netrw_explore_list = s:NetrwExploreListUniq(map(getqflist(),'bufname(v:val.bufnr)')) - if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif - - elseif starpat == 2 - " starpat=2: Explore **//pattern (recursive descent search for files containing pattern) -" call Decho("..case starpat=".starpat.": build **//pattern list (recursive descent files containing pattern)") -" call Decho("....pattern<".pattern.">") - try - exe "sil keepj noautocmd vimgrep /".pattern."/gj "."**/*" - catch /^Vim\%((\a\+)\)\=:E480/ - call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45) - if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif - sil! let @* = keepregstar - sil! let @+ = keepregstar - sil! let @/ = keepregslash -" call Dret("netrw#Explore : no files matched pattern") - return - endtry - let s:netrw_curdir = b:netrw_curdir - let w:netrw_explore_list = getqflist() - let w:netrw_explore_list = s:NetrwExploreListUniq(map(w:netrw_explore_list,'s:netrw_curdir."/".bufname(v:val.bufnr)')) - if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif - - 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) - let filepat= substitute(dirname,'^\*/','','') - let filepat= substitute(filepat,'^[%#<]','\\&','') -" call Decho("....b:netrw_curdir<".b:netrw_curdir.">") -" call Decho("....filepat<".filepat.">") - let w:netrw_explore_list= s:NetrwExploreListUniq(split(expand(b:netrw_curdir."/".filepat),'\n')) - if &hls | let keepregslash= s:ExplorePatHls(filepat) | endif - - elseif starpat == 4 - " starpat=4: Explore **/filepat (recursive descent search for filenames matching filepat) -" call Decho("..case starpat=".starpat.": build **/filepat list (recursive descent srch filenames matching filepat) &hls=".&hls) - 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) - - if w:netrw_explore_listlen == 0 || (w:netrw_explore_listlen == 1 && w:netrw_explore_list[0] =~ '\*\*\/') - keepj call netrw#ErrorMsg(s:WARNING,"no files matched",42) - sil! let @* = keepregstar - sil! let @+ = keepregstar - sil! let @/ = keepregslash -" call Dret("netrw#Explore : no files matched") - return - endif - endif " if indx ... endif - - " 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) - - " 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.")") - let indx = (indx < 0)? ( w:netrw_explore_listlen - 1 ) : 0 - let w:netrw_explore_indx= indx - keepj 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.">") - let newdir= substitute(dirfile,'/[^/]*$','','e') -" call Decho("....newdir<".newdir.">") - -" call Decho("....calling LocalBrowseCheck(newdir<".newdir.">)") - call netrw#LocalBrowseCheck(newdir) - if !exists("w:netrw_liststyle") - let w:netrw_liststyle= g:netrw_liststyle - endif - if w:netrw_liststyle == s:THINLIST || w:netrw_liststyle == s:LONGLIST - keepj call search('^'.substitute(dirfile,"^.*/","","").'\>',"W") - else - keepj call search('\<'.substitute(dirfile,"^.*/","","").'\>',"w") - endif - let w:netrw_explore_mtchcnt = indx + 1 - let w:netrw_explore_bufnr = bufnr("%") - let w:netrw_explore_line = line(".") - keepj 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") - if !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:WARNING,"your vim needs the +path_extra feature for Exploring with **!",44) - endif - sil! let @* = keepregstar - sil! let @+ = keepregstar - sil! let @/ = keepregslash -" call Dret("netrw#Explore : missing +path_extra") - return - endif - - else -" call Decho("..default case: Explore newdir<".dirname.">") - if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && dirname =~ '/' - sil! unlet w:netrw_treedict - sil! unlet w:netrw_treetop - endif - let newdir= dirname - if !exists("b:netrw_curdir") - keepj call netrw#LocalBrowseCheck(getcwd()) - else - keepj call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,newdir)) - endif - 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").">") - if exists("w:netrw_explore_indx") && exists("b:netrw_curdir") -" call Decho("s:explore_prvdir<".(exists("s:explore_prvdir")? s:explore_prvdir : "-doesn't exist-")) - if !exists("s:explore_prvdir") || s:explore_prvdir != b:netrw_curdir - " only update match list if current directory isn't the same as before -" call Decho("only update match list if current directory not the same as before") - let s:explore_prvdir = b:netrw_curdir - let s:explore_match = "" - let dirlen = s:Strlen(b:netrw_curdir) - if b:netrw_curdir !~ '/$' - let dirlen= dirlen + 1 - endif - let prvfname= "" - for fname in w:netrw_explore_list -" call Decho("fname<".fname.">") - if fname =~ '^'.b:netrw_curdir - if s:explore_match == "" - let s:explore_match= '\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>' - else - let s:explore_match= s:explore_match.'\|\<'.escape(strpart(fname,dirlen),g:netrw_markfileesc).'\>' - endif - elseif fname !~ '^/' && fname != prvfname - if s:explore_match == "" - let s:explore_match= '\<'.escape(fname,g:netrw_markfileesc).'\>' - else - let s:explore_match= s:explore_match.'\|\<'.escape(fname,g:netrw_markfileesc).'\>' - endif - endif - let prvfname= fname - endfor -" call Decho("explore_match<".s:explore_match.">") - exe "2match netrwMarkFile /".s:explore_match."/" - endif - echo "<s-up>==Pexplore <s-down>==Nexplore" - else - 2match none - 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") - endif - - sil! let @* = keepregstar - sil! let @+ = keepregstar - sil! let @/ = keepregslash -" call Dret("netrw#Explore : @/<".@/.">") -endfun - -" --------------------------------------------------------------------- " s:NetrwExploreListUniq: {{{2 fun! s:NetrwExploreListUniq(explist) " call Dfunc("s:NetrwExploreListUniq(explist<".string(a:explist).">)") @@ -4511,13 +4850,17 @@ endfun " --------------------------------------------------------------------- " s:NetrwForceFile: (gf support) Force treatment as a file {{{2 fun! s:NetrwForceFile(islocal,newfile) -" " call Dfunc("s:NetrwForceFile(islocal=".a:islocal." newdir<".a:newdir.">)") +" call Dfunc("s:NetrwForceFile(islocal=".a:islocal." newdir<".a:newfile.">)") if a:newfile =~ '[/@*=|\\]$' let newfile= substitute(a:newfile,'.$','','') else let newfile= a:newfile endif - call s:NetrwBrowseChgDir(a:islocal,newfile) + if a:islocal + call s:NetrwBrowseChgDir(a:islocal,newfile) + else + call s:NetrwBrowse(a:islocal,s:NetrwBrowseChgDir(a:islocal,newfile)) + endif " call Dret("s:NetrwForceFile") endfun @@ -4539,7 +4882,7 @@ fun! s:NetrwHide(islocal) " 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.'\>')." isk=".&isk) +" call Decho("match(g:netrw_list_hide<".g:netrw_list_hide.'> fname<\<'.fname.'\>>)='.match(g:netrw_list_hide,'\<'.fname.'\>')." l:isk=".&l:isk) 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).'\>..','','') @@ -4626,7 +4969,7 @@ fun! s:NetrwHome() endif endif " insure that the home directory exists - if !isdirectory(home) + if g:netrw_dirhistmax > 0 && !isdirectory(home) if exists("g:netrw_mkdir") call system(g:netrw_mkdir." ".shellescape(home)) else @@ -4640,6 +4983,9 @@ endfun " --------------------------------------------------------------------- " s:NetrwLeftmouse: handles the <leftmouse> when in a netrw browsing window {{{2 fun! s:NetrwLeftmouse(islocal) + if exists("s:netrwdrag") + return + endif " call Dfunc("s:NetrwLeftmouse(islocal=".a:islocal.")") let ykeep= @@ @@ -4680,6 +5026,47 @@ fun! s:NetrwLeftmouse(islocal) endfun " --------------------------------------------------------------------- +" s:NetrwRightdrag: {{{2 +"DechoTabOn +fun! s:NetrwRightdrag(islocal) +" call Dfunc("s:NetrwRightdrag(islocal=".a:islocal.")") + if !exists("s:netrwdrag") + let s:netrwdrag = winnr() + call s:NetrwMarkFile(a:islocal,s:NetrwGetWord()) + if a:islocal + nno <silent> <s-rightrelease> <leftmouse>:<c-u>call <SID>NetrwRightrelease(1)<cr> + else + nno <silent> <s-rightrelease> <leftmouse>:<c-u>call <SID>NetrwRightrelease(0)<cr> + endif + endif +" call Dret("s:NetrwRightdrag : s:netrwdrag=".s:netrwdrag." buf#".bufnr("%")) +endfun + +" --------------------------------------------------------------------- +" s:NetrwRightrelease: {{{2 +fun! s:NetrwRightrelease(islocal) +" call Dfunc("s:NetrwRightrelease(islocal=".a:islocal.") s:netrwdrag=".s:netrwdrag." buf#".bufnr("%")) + if exists("s:netrwdrag") + nunmap <s-rightrelease> + let tgt = s:NetrwGetWord() +" call Decho("target#1: ".tgt) + if tgt =~ '/$' && tgt !~ '^\./$' + let tgt = b:netrw_curdir."/".tgt + else + let tgt= b:netrw_curdir + endif +" call Decho("target#2: ".tgt) + call netrw#NetrwMakeTgt(tgt) + let curwin= winnr() + exe s:netrwdrag."wincmd w" + call s:NetrwMarkFileMove(a:islocal) + exe curwin."wincmd w" + unlet s:netrwdrag + endif +" call Dret("s:NetrwRightrelease") +endfun + +" --------------------------------------------------------------------- " s:NetrwListHide: uses [range]g~...~d to delete files that match comma {{{2 " separated patterns given in g:netrw_list_hide fun! s:NetrwListHide() @@ -4900,6 +5287,13 @@ endfun " b:netrw_islocal fun! s:NetrwMarkFile(islocal,fname) " call Dfunc("s:NetrwMarkFile(islocal=".a:islocal." fname<".a:fname.">)") + + " sanity check + if empty(a:fname) +" call Dret("s:NetrwMarkFile : emtpy fname") + return + endif + let ykeep = @@ let curbufnr= bufnr("%") let curdir = b:netrw_curdir @@ -5010,34 +5404,44 @@ fun! s:NetrwMarkFileCompress(islocal) let curdir = b:netrw_curdir let curbufnr = bufnr("%") + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFileCompress") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + 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} - " for every filename in the marked list - for sfx in sort(keys(g:netrw_decompress)) - if fname =~ '\'.sfx.'$' - " fname has a suffix indicating that its compressed; apply associated decompression routine - let exe= netrw#WinPath(g:netrw_decompress[sfx]) -" call Decho("fname<".fname."> is compressed so decompress with <".exe.">") - if a:islocal - if g:netrw_keepdir - let fname= shellescape(s:ComposePath(curdir,fname)) - endif - else - let fname= shellescape(b:netrw_curdir.fname,1) + let sfx= substitute(fname,'^.\{-}\(\.\a\+\)$','\1','') +" call Decho("extracted sfx<".sfx.">") + 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.">") + let exe= netrw#WinPath(exe) + if a:islocal + if g:netrw_keepdir + let fname= shellescape(s:ComposePath(curdir,fname)) endif - if executable(exe) - if a:islocal - call system(exe." ".fname) - else - keepj call s:RemoteSystem(exe." ".fname) - endif + else + let fname= shellescape(b:netrw_curdir.fname,1) + endif + if executable(exe) + if a:islocal + call system(exe." ".fname) else - keepj call netrw#ErrorMsg(s:WARNING,"unable to apply<".exe."> to file<".fname.">",50) + keepj call s:RemoteSystem(exe." ".fname) endif - break + else + keepj call netrw#ErrorMsg(s:WARNING,"unable to apply<".exe."> to file<".fname.">",50) endif - unlet sfx - endfor + endif + unlet sfx + if exists("exe") unlet exe elseif a:islocal @@ -5047,7 +5451,8 @@ fun! s:NetrwMarkFileCompress(islocal) " fname not a compressed file, so compress it keepj call s:RemoteSystem(netrw#WinPath(g:netrw_compress)." ".shellescape(fname)) endif - endfor + endfor " for every file in the marked list + call s:NetrwUnmarkList(curbufnr,curdir) keepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) keepj call netrw#NetrwRestorePosn(svpos) @@ -5064,36 +5469,52 @@ endfun " 0=failure fun! s:NetrwMarkFileCopy(islocal) " call Dfunc("s:NetrwMarkFileCopy(islocal=".a:islocal.") target<".(exists("s:netrwmftgt")? s:netrwmftgt : '---').">") + let curdir = b:netrw_curdir + let curbufnr = bufnr("%") - " sanity checks - if !exists("s:netrwmarkfilelist_{bufnr('%')}") || empty(s:netrwmarkfilelist_{bufnr('%')}) - keepj call netrw#ErrorMsg(s:ERROR,"there are no marked files in this window (:help netrw-mf)",66) -" call Dret("s:NetrwMarkFileCopy 0") - return 0 + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFileCopy") + return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".bufnr('%')."<".string(s:netrwmarkfilelist_{bufnr('%')})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + if !exists("s:netrwmftgt") keepj 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.">") - let curdir = b:netrw_curdir - let curbufnr = bufnr("%") if a:islocal && s:netrwmftgt_islocal " Copy marked files, local directory to local directory " call Decho("copy from local to local") - if !executable(g:netrw_localcopycmd) && g:netrw_localcopycmd !~ '^cmd ' + if !executable(g:netrw_localcopycmd) && g:netrw_localcopycmd !~ '\<cmd\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!") return endif let args= join(map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),"shellescape(b:netrw_curdir.\"/\".v:val)")) -" call Decho("system(".g:netrw_localcopycmd." ".args." ".shellescape(s:netrwmftgt).")") - call system(netrw#WinPath(g:netrw_localcopycmd)." ".args." ".shellescape(s:netrwmftgt)) + let tgt = shellescape(s:netrwmftgt) + if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) + let args= substitute(args,'/','\\','g') + let tgt = substitute(tgt, '/','\\','g') + endif + if g:netrw_localcopycmd =~ '\s' + let copycmd = substitute(g:netrw_localcopycmd,'\s.*$','','') + let copycmdargs = substitute(g:netrw_localcopycmd,'^.\{-}\(\s.*\)$','\1','') + let copycmd = netrw#WinPath(copycmd).copycmdargs + else + let copycmd = netrw#WinPath(g:netrw_localcopycmd) + endif +" call Decho("args <".args.">") +" call Decho("tgt <".tgt.">") +" call Decho("copycmd<".copycmd.">") +" call Decho("system(".copycmd." ".args." ".tgt.")") + call system(copycmd." ".args." ".tgt) if v:shell_error != 0 - call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) + 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)) return 0 endif @@ -5178,7 +5599,15 @@ fun! s:NetrwMarkFileDiff(islocal) " call Dfunc("s:NetrwMarkFileDiff(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">") let curbufnr= bufnr("%") - if exists("s:netrwmarkfilelist_{curbufnr}") + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFileDiff") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + + if exists("s:netrwmarkfilelist_{."curbufnr}") let cnt = 0 let curdir = b:netrw_curdir for fname in s:netrwmarkfilelist @@ -5211,6 +5640,15 @@ fun! s:NetrwMarkFileEdit(islocal) let curdir = b:netrw_curdir let curbufnr = bufnr("%") + + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFileEdit") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + if exists("s:netrwmarkfilelist_{curbufnr}") call s:SetRexDir(a:islocal,curdir) let flist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)")) @@ -5220,11 +5658,43 @@ fun! s:NetrwMarkFileEdit(islocal) " call Decho("exe sil args ".flist) exe "sil args ".flist endif + echo "(use :bn, :bp to navigate files; :Rex to return)" " call Dret("s:NetrwMarkFileEdit") endfun " --------------------------------------------------------------------- +" s:NetrwMarkFileQFEL: convert a quickfix-error list into a marked file list {{{2 +fun! s:NetrwMarkFileQFEL(islocal,qfel) +" call Dfunc("s:NetrwMarkFileQFEL(islocal=".a:islocal.",qfel)") + call s:NetrwUnmarkAll() + let curbufnr= bufnr("%") + + 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"]) + if !exists("s:netrwmarkfilelist_{curbufnr}") +" call Decho("case: no marked file list") + 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 s:NetrwMarkFile(a:islocal,bufname(bufnmbr)) + else +" call Decho("case: ".bufname(bufnmbr)." already in marked file list") + endif + endfor + echo "(use me to edit marked files)" + else + call netrw#ErrorMsg(s:WARNING,"can't convert quickfix error list; its empty!",92) + endif + +" call Dret("s:NetrwMarkFileQFEL") +endfun + +" --------------------------------------------------------------------- " s:NetrwMarkFileExe: (invoked by mx) execute arbitrary system command on marked files, one at a time {{{2 " Uses the local marked-file list. fun! s:NetrwMarkFileExe(islocal) @@ -5233,6 +5703,14 @@ fun! s:NetrwMarkFileExe(islocal) let curdir = b:netrw_curdir let curbufnr = bufnr("%") + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFileExe") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + if exists("s:netrwmarkfilelist_{curbufnr}") " get the command call inputsave() @@ -5353,6 +5831,14 @@ fun! s:NetrwMarkFileVimCmd(islocal) let curdir = b:netrw_curdir let curbufnr = bufnr("%") + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFileVimCmd") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + if exists("s:netrwmarkfilelist_{curbufnr}") " get the command call inputsave() @@ -5463,30 +5949,47 @@ fun! s:NetrwMarkFileGrep(islocal) " call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">") let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "fnameescape(v:val)")) call s:NetrwUnmarkAll() + else +" call Decho('no marked files, using "*"') + let netrwmarkfilelist= "*" + endif - " ask user for pattern - call inputsave() - let pat= input("Enter pattern: ","") - call inputrestore() - if pat !~ '^\s' - if pat !~ '^/' - let pat= '/'.pat.'/' - endif - let pat= " ".pat - endif + " ask user for pattern + call inputsave() + let pat= input("Enter pattern: ","") + call inputrestore() + let patbang = "" + if pat =~ '^!' + let patbang = "!" + let pat= strpart(pat,2) + endif + if pat =~ '^\i' + let pat = escape(pat,'/') + let pat = '/'.pat.'/' + else + let nonisi = pat[0] + endif - " use vimgrep for both local and remote -" call Decho("exe vimgrep".pat." ".netrwmarkfilelist) - try - exe "keepj noautocmd vimgrep".pat." ".netrwmarkfilelist - catch /^Vim\%((\a\+)\)\=:E480/ - keepj call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pattern.">",76) -" call Dret("s:NetrwMarkFileGrep : unable to find pattern<".pattern.">") - return - endtry + " use vimgrep for both local and remote +" call Decho("exe vimgrep".patbang." ".pat." ".netrwmarkfilelist) + try + exe "keepj noautocmd vimgrep".patbang." ".pat." ".netrwmarkfilelist + catch /^Vim\%((\a\+)\)\=:E480/ + keepj call netrw#ErrorMsg(s:WARNING,"no match with pattern<".pat.">",76) +" call Dret("s:NetrwMarkFileGrep : unable to find pattern<".pat.">") + return + endtry + echo "(use :cn, :cp to navigate, :Rex to return)" - 2match none - keepj call netrw#NetrwRestorePosn(svpos) + 2match none + keepj call netrw#NetrwRestorePosn(svpos) + + 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") + if pat =~ nonisi.'j$\|'.nonisi.'gj$\|'.nonisi.'jg$' + call s:NetrwMarkFileQFEL(a:islocal,getqflist()) + endif endif " call Dret("s:NetrwMarkFileGrep") @@ -5503,12 +6006,13 @@ fun! s:NetrwMarkFileMove(islocal) let curbufnr = bufnr("%") " sanity check - if !exists("s:netrwmarkfilelist_{bufnr('%')}") || empty(s:netrwmarkfilelist_{bufnr('%')}) + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) " call Dret("s:NetrwMarkFileMove") return endif -" call Decho("sanity chk passed: s:netrwmarkfilelist_".bufnr('%')."<".string(s:netrwmarkfilelist_{bufnr('%')})) +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + if !exists("s:netrwmftgt") keepj call netrw#ErrorMsg(2,"your marked file target is empty! (:help netrw-mt)",67) " call Dret("s:NetrwMarkFileCopy 0") @@ -5520,16 +6024,37 @@ fun! s:NetrwMarkFileMove(islocal) " move: local -> local " call Decho("move from local to local") " call Decho("(s:NetrwMarkFileMove) local to local move") - if !executable(g:netrw_localmovecmd) && g:netrw_localmovecmd !~ '^cmd ' + if !executable(g:netrw_localmovecmd) && g:netrw_localmovecmd !~ '\<cmd\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.">") + if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) + let tgt = substitute(tgt, '/','\\','g') +" call Decho("windows exception: tgt<".tgt.">") + 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)") + else + let movecmd = netrw#WinPath(movecmd) +" call Decho("windows exception: movecmd<".movecmd."> (#2: no space)") + endif + else + let movecmd = netrw#WinPath(g:netrw_localmovecmd) +" call Decho("movecmd<".movecmd."> (#3 linux or cygwin)") + endif for fname in s:netrwmarkfilelist_{bufnr("%")} -" call Decho("system(".g:netrw_localmovecmd." ".shellescape(fname)." ".shellescape(s:netrwmftgt).")") - let ret= system(g:netrw_localmovecmd." ".shellescape(fname)." ".shellescape(s:netrwmftgt)) - if v:shell_error < 0 - call netrw#ErrorMsg(s:ERROR,"command<".g:netrw_localmovecmd."> failed, aborting",54) +" 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) + if v:shell_error != 0 + call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localmovecmd<".g:netrw_localmovecmd.">; it doesn't work!",54) break endif endfor @@ -5605,6 +6130,14 @@ endfun fun! s:NetrwMarkFilePrint(islocal) " call Dfunc("s:NetrwMarkFilePrint(islocal=".a:islocal.")") let curbufnr= bufnr("%") + + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFilePrint") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) if exists("s:netrwmarkfilelist_{curbufnr}") let netrwmarkfilelist = s:netrwmarkfilelist_{curbufnr} let curdir = b:netrw_curdir @@ -5633,7 +6166,7 @@ endfun " --------------------------------------------------------------------- " s:NetrwMarkFileRegexp: (invoked by mr) This function is used to mark {{{2 " files when given a regexp (for which a prompt is -" issued). +" issued) (matches to name of files). fun! s:NetrwMarkFileRegexp(islocal) " call Dfunc("s:NetrwMarkFileRegexp(islocal=".a:islocal.")") @@ -5645,8 +6178,8 @@ fun! s:NetrwMarkFileRegexp(islocal) if a:islocal " get the matching list of files using local glob() " call Decho("handle local regexp") - let dirname = escape(b:netrw_curdir,g:netrw_glob_escape) - let files = glob(s:ComposePath(dirname,regexp)) + let dirname = escape(b:netrw_curdir,g:netrw_glob_escape) + let files = glob(s:ComposePath(dirname,regexp)) " call Decho("files<".files.">") let filelist= split(files,"\n") @@ -5699,6 +6232,7 @@ fun! s:NetrwMarkFileRegexp(islocal) let @a = areg let &ei = eikeep endif + echo " (use me to edit marked files)" " call Dret("s:NetrwMarkFileRegexp") endfun @@ -5709,6 +6243,14 @@ endfun fun! s:NetrwMarkFileSource(islocal) " call Dfunc("s:NetrwMarkFileSource(islocal=".a:islocal.")") let curbufnr= bufnr("%") + + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFileSource") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) if exists("s:netrwmarkfilelist_{curbufnr}") let netrwmarkfilelist = s:netrwmarkfilelist_{bufnr("%")} let curdir = b:netrw_curdir @@ -5739,6 +6281,14 @@ fun! s:NetrwMarkFileTag(islocal) let curdir = b:netrw_curdir let curbufnr = bufnr("%") + " sanity check + if !exists("s:netrwmarkfilelist_{curbufnr}") || empty(s:netrwmarkfilelist_{curbufnr}) + keepj call netrw#ErrorMsg(2,"there are no marked files in this window (:help netrw-mf)",66) +" call Dret("s:NetrwMarkFileTag") + return + endif +" call Decho("sanity chk passed: s:netrwmarkfilelist_".curbufnr."<".string(s:netrwmarkfilelist_{curbufnr})) + if exists("s:netrwmarkfilelist") " call Decho("s:netrwmarkfilelist".string(s:netrwmarkfilelist).">") let netrwmarkfilelist= join(map(deepcopy(s:netrwmarkfilelist), "shellescape(v:val,".!a:islocal.")")) @@ -5774,9 +6324,9 @@ endfun " --------------------------------------------------------------------- " s:NetrwMarkFileTgt: (invoked by mt) This function sets up a marked file target {{{2 " Sets up two variables, -" s:netrwmftgt : holds the target directory +" s:netrwmftgt : holds the target directory " s:netrwmftgt_islocal : 0=target directory is remote -" 1=target directory is local +" 1=target directory is local fun! s:NetrwMarkFileTgt(islocal) " call Dfunc("s:NetrwMarkFileTgt(islocal=".a:islocal.")") let svpos = netrw#NetrwSavePosn() @@ -5788,9 +6338,21 @@ fun! s:NetrwMarkFileTgt(islocal) " set up target if line(".") < w:netrw_bannercnt - " if cursor in banner region, use b:netrw_curdir for the target - let s:netrwmftgt= b:netrw_curdir -" call Decho("inbanner: s:netrwmftgt<".s:netrwmftgt.">") + " 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") + unlet s:netrwmftgt s:netrwmftgt_islocal + if g:netrw_fastbrowse <= 1 + call s:LocalBrowseShellCmdRefresh() + endif + call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) + call netrw#NetrwRestorePosn(svpos) +" call Dret("s:NetrwMarkFileTgt : removed target") + return + else + let s:netrwmftgt= b:netrw_curdir +" call Decho("inbanner: s:netrwmftgt<".s:netrwmftgt.">") + endif else " get word under cursor. @@ -5866,6 +6428,8 @@ endfun " --------------------------------------------------------------------- " s:NetrwUnmarkList: delete local marked file lists and remove their contents from the global marked-file list {{{2 +" User access provided by the <mu> mapping. (see :help netrw-mu) +" Used by many MarkFile functions. fun! s:NetrwUnmarkList(curbufnr,curdir) " call Dfunc("s:NetrwUnmarkList(curbufnr=".a:curbufnr." curdir<".a:curdir.">)") @@ -5903,7 +6467,7 @@ fun! s:NetrwUnmarkAll() endfun " --------------------------------------------------------------------- -" s:NetrwUnmarkAll2: {{{2 +" s:NetrwUnmarkAll2: unmark all files from all buffers {{{2 fun! s:NetrwUnmarkAll2() " call Dfunc("s:NetrwUnmarkAll2()") redir => netrwmarkfilelist_let @@ -5956,58 +6520,74 @@ fun! s:NetrwMenu(domenu) if !exists("s:netrw_menu_enabled") && a:domenu " call Decho("initialize menu") let s:netrw_menu_enabled= 1 - exe 'sil! menu '.g:NetrwMenuPriority.'.1 '.g:NetrwTopLvlMenu.'Help<tab><F1> <F1>' - exe 'sil! menu '.g:NetrwMenuPriority.'.5 '.g:NetrwTopLvlMenu.'-Sep1- :' - exe 'sil! menu '.g:NetrwMenuPriority.'.6 '.g:NetrwTopLvlMenu.'Go\ Up\ Directory<tab>- -' - exe 'sil! menu '.g:NetrwMenuPriority.'.7 '.g:NetrwTopLvlMenu.'Apply\ Special\ Viewer<tab>x x' - exe 'sil! menu '.g:NetrwMenuPriority.'.8.1 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Current\ Directory<tab>mb mb' - exe 'sil! menu '.g:NetrwMenuPriority.'.8.4 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Prev\ Dir\ (History)<tab>u u' - exe 'sil! menu '.g:NetrwMenuPriority.'.8.5 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Next\ Dir\ (History)<tab>U U' - exe 'sil! menu '.g:NetrwMenuPriority.'.8.6 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.List<tab>qb qb' - exe 'sil! menu '.g:NetrwMenuPriority.'.9.1 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ File\ Hiding\ List<tab><ctrl-h>'." \<c-h>'" - exe 'sil! menu '.g:NetrwMenuPriority.'.9.2 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ Sorting\ Sequence<tab>S S' - exe 'sil! menu '.g:NetrwMenuPriority.'.9.3 '.g:NetrwTopLvlMenu.'Browsing\ Control.Quick\ Hide/Unhide\ Dot\ Files<tab>'."gh gh" - exe 'sil! menu '.g:NetrwMenuPriority.'.9.4 '.g:NetrwTopLvlMenu.'Browsing\ Control.Refresh\ Listing<tab>'."<ctrl-l> \<c-l>" - exe 'sil! menu '.g:NetrwMenuPriority.'.9.5 '.g:NetrwTopLvlMenu.'Browsing\ Control.Settings/Options<tab>:NetrwSettings '.":NetrwSettings\<cr>" - exe 'sil! menu '.g:NetrwMenuPriority.'.10 '.g:NetrwTopLvlMenu.'Delete\ File/Directory<tab>D D' - exe 'sil! menu '.g:NetrwMenuPriority.'.11.1 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.Create\ New\ File<tab>% %' - exe 'sil! menu '.g:NetrwMenuPriority.'.11.1 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Current\ Window<tab><cr> '."\<cr>" - exe 'sil! menu '.g:NetrwMenuPriority.'.11.2 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.Preview\ File/Directory<tab>p p' - exe 'sil! menu '.g:NetrwMenuPriority.'.11.3 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Previous\ Window<tab>P P' - exe 'sil! menu '.g:NetrwMenuPriority.'.11.4 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Window<tab>o o' - exe 'sil! menu '.g:NetrwMenuPriority.'.11.5 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Vertical\ Window<tab>v v' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.1 '.g:NetrwTopLvlMenu.'Explore.Directory\ Name :Explore ' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (curdir\ only)<tab>:Explore\ */ :Explore */' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (+subdirs)<tab>:Explore\ **/ :Explore **/' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.3 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (curdir\ only)<tab>:Explore\ *// :Explore *//' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (+subdirs)<tab>:Explore\ **// :Explore **//' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Next\ Match<tab>:Nexplore :Nexplore<cr>' - exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Prev\ Match<tab>:Pexplore :Pexplore<cr>' - exe 'sil! menu '.g:NetrwMenuPriority.'.13 '.g:NetrwTopLvlMenu.'Make\ Subdirectory<tab>d d' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.1 '.g:NetrwTopLvlMenu.'Marked\ Files.Mark\ File<tab>mf mf' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.2 '.g:NetrwTopLvlMenu.'Marked\ Files.Mark\ Files\ by\ Regexp<tab>mr mr' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.3 '.g:NetrwTopLvlMenu.'Marked\ Files.Hide-Show-List\ Control<tab>a a' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.4 '.g:NetrwTopLvlMenu.'Marked\ Files.Copy\ To\ Target<tab>mc mc' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.5 '.g:NetrwTopLvlMenu.'Marked\ Files.Delete<tab>D D' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.6 '.g:NetrwTopLvlMenu.'Marked\ Files.Diff<tab>md md' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.7 '.g:NetrwTopLvlMenu.'Marked\ Files.Edit<tab>me me' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.8 '.g:NetrwTopLvlMenu.'Marked\ Files.Exe\ Cmd<tab>mx mx' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.9 '.g:NetrwTopLvlMenu.'Marked\ Files.Move\ To\ Target<tab>mm mm' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.10 '.g:NetrwTopLvlMenu.'Marked\ Files.Obtain<tab>O O' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.11 '.g:NetrwTopLvlMenu.'Marked\ Files.Print<tab>mp mp' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.12 '.g:NetrwTopLvlMenu.'Marked\ Files.Replace<tab>R R' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.13 '.g:NetrwTopLvlMenu.'Marked\ Files.Set\ Target<tab>mt mt' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.14 '.g:NetrwTopLvlMenu.'Marked\ Files.Tag<tab>mT mT' - exe 'sil! menu '.g:NetrwMenuPriority.'.14.15 '.g:NetrwTopLvlMenu.'Marked\ Files.Zip/Unzip/Compress/Uncompress<tab>mz mz' - exe 'sil! menu '.g:NetrwMenuPriority.'.15 '.g:NetrwTopLvlMenu.'Obtain\ File<tab>O O' - exe 'sil! menu '.g:NetrwMenuPriority.'.16.1 '.g:NetrwTopLvlMenu.'Style.Listing\ Style\ (thin-long-wide-tree)<tab>i i' - exe 'sil! menu '.g:NetrwMenuPriority.'.16.2 '.g:NetrwTopLvlMenu.'Style.Normal-Hide-Show<tab>a a' - exe 'sil! menu '.g:NetrwMenuPriority.'.16.3 '.g:NetrwTopLvlMenu.'Style.Reverse\ Sorting\ Order<tab>'."r r" - exe 'sil! menu '.g:NetrwMenuPriority.'.16.4 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method\ (name-time-size)<tab>s s' - exe 'sil! menu '.g:NetrwMenuPriority.'.17 '.g:NetrwTopLvlMenu.'Rename\ File/Directory<tab>R R' - exe 'sil! menu '.g:NetrwMenuPriority.'.18 '.g:NetrwTopLvlMenu.'Set\ Current\ Directory<tab>c c' - call s:NetrwBookmarkMenu() " provide some history! uses priorities 2,3, reserves 4, 8.2.x + exe 'sil! menu '.g:NetrwMenuPriority.'.1 '.g:NetrwTopLvlMenu.'Help<tab><F1> <F1>' + exe 'sil! menu '.g:NetrwMenuPriority.'.5 '.g:NetrwTopLvlMenu.'-Sep1- :' + exe 'sil! menu '.g:NetrwMenuPriority.'.6 '.g:NetrwTopLvlMenu.'Go\ Up\ Directory<tab>- -' + exe 'sil! menu '.g:NetrwMenuPriority.'.7 '.g:NetrwTopLvlMenu.'Apply\ Special\ Viewer<tab>x x' + if g:netrw_dirhistmax > 0 + exe 'sil! menu '.g:NetrwMenuPriority.'.8.1 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Bookmark\ Current\ Directory<tab>mb mb' + exe 'sil! menu '.g:NetrwMenuPriority.'.8.4 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Prev\ Dir\ (History)<tab>u u' + exe 'sil! menu '.g:NetrwMenuPriority.'.8.5 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.Goto\ Next\ Dir\ (History)<tab>U U' + exe 'sil! menu '.g:NetrwMenuPriority.'.8.6 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History.List<tab>qb qb' + else + exe 'sil! menu '.g:NetrwMenuPriority.'.8 '.g:NetrwTopLvlMenu.'Bookmarks\ and\ History :echo "(disabled)"'."\<cr>" + endif + exe 'sil! menu '.g:NetrwMenuPriority.'.9.1 '.g:NetrwTopLvlMenu.'Browsing\ Control.Horizontal\ Split<tab>o o' + exe 'sil! menu '.g:NetrwMenuPriority.'.9.2 '.g:NetrwTopLvlMenu.'Browsing\ Control.Vertical\ Split<tab>v v' + exe 'sil! menu '.g:NetrwMenuPriority.'.9.3 '.g:NetrwTopLvlMenu.'Browsing\ Control.New\ Tab<tab>t t' + exe 'sil! menu '.g:NetrwMenuPriority.'.9.4 '.g:NetrwTopLvlMenu.'Browsing\ Control.Preview<tab>p p' + exe 'sil! menu '.g:NetrwMenuPriority.'.9.5 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ File\ Hiding\ List<tab><ctrl-h>'." \<c-h>'" + exe 'sil! menu '.g:NetrwMenuPriority.'.9.6 '.g:NetrwTopLvlMenu.'Browsing\ Control.Edit\ Sorting\ Sequence<tab>S S' + exe 'sil! menu '.g:NetrwMenuPriority.'.9.7 '.g:NetrwTopLvlMenu.'Browsing\ Control.Quick\ Hide/Unhide\ Dot\ Files<tab>'."gh gh" + exe 'sil! menu '.g:NetrwMenuPriority.'.9.8 '.g:NetrwTopLvlMenu.'Browsing\ Control.Refresh\ Listing<tab>'."<ctrl-l> \<c-l>" + exe 'sil! menu '.g:NetrwMenuPriority.'.9.9 '.g:NetrwTopLvlMenu.'Browsing\ Control.Settings/Options<tab>:NetrwSettings '.":NetrwSettings\<cr>" + exe 'sil! menu '.g:NetrwMenuPriority.'.10 '.g:NetrwTopLvlMenu.'Delete\ File/Directory<tab>D D' + exe 'sil! menu '.g:NetrwMenuPriority.'.11.1 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.Create\ New\ File<tab>% %' + exe 'sil! menu '.g:NetrwMenuPriority.'.11.1 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Current\ Window<tab><cr> '."\<cr>" + exe 'sil! menu '.g:NetrwMenuPriority.'.11.2 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.Preview\ File/Directory<tab>p p' + exe 'sil! menu '.g:NetrwMenuPriority.'.11.3 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ Previous\ Window<tab>P P' + exe 'sil! menu '.g:NetrwMenuPriority.'.11.4 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Window<tab>o o' + exe 'sil! menu '.g:NetrwMenuPriority.'.11.5 '.g:NetrwTopLvlMenu.'Edit\ File/Dir.In\ New\ Vertical\ Window<tab>v v' + exe 'sil! menu '.g:NetrwMenuPriority.'.12.1 '.g:NetrwTopLvlMenu.'Explore.Directory\ Name :Explore ' + exe 'sil! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (curdir\ only)<tab>:Explore\ */ :Explore */' + exe 'sil! menu '.g:NetrwMenuPriority.'.12.2 '.g:NetrwTopLvlMenu.'Explore.Filenames\ Matching\ Pattern\ (+subdirs)<tab>:Explore\ **/ :Explore **/' + exe 'sil! menu '.g:NetrwMenuPriority.'.12.3 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (curdir\ only)<tab>:Explore\ *// :Explore *//' + exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Files\ Containing\ String\ Pattern\ (+subdirs)<tab>:Explore\ **// :Explore **//' + exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Next\ Match<tab>:Nexplore :Nexplore<cr>' + exe 'sil! menu '.g:NetrwMenuPriority.'.12.4 '.g:NetrwTopLvlMenu.'Explore.Prev\ Match<tab>:Pexplore :Pexplore<cr>' + exe 'sil! menu '.g:NetrwMenuPriority.'.13 '.g:NetrwTopLvlMenu.'Make\ Subdirectory<tab>d d' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.1 '.g:NetrwTopLvlMenu.'Marked\ Files.Mark\ File<tab>mf mf' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.2 '.g:NetrwTopLvlMenu.'Marked\ Files.Mark\ Files\ by\ Regexp<tab>mr mr' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.3 '.g:NetrwTopLvlMenu.'Marked\ Files.Hide-Show-List\ Control<tab>a a' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.4 '.g:NetrwTopLvlMenu.'Marked\ Files.Copy\ To\ Target<tab>mc mc' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.5 '.g:NetrwTopLvlMenu.'Marked\ Files.Delete<tab>D D' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.6 '.g:NetrwTopLvlMenu.'Marked\ Files.Diff<tab>md md' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.7 '.g:NetrwTopLvlMenu.'Marked\ Files.Edit<tab>me me' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.8 '.g:NetrwTopLvlMenu.'Marked\ Files.Exe\ Cmd<tab>mx mx' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.9 '.g:NetrwTopLvlMenu.'Marked\ Files.Move\ To\ Target<tab>mm mm' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.10 '.g:NetrwTopLvlMenu.'Marked\ Files.Obtain<tab>O O' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.11 '.g:NetrwTopLvlMenu.'Marked\ Files.Print<tab>mp mp' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.12 '.g:NetrwTopLvlMenu.'Marked\ Files.Replace<tab>R R' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.13 '.g:NetrwTopLvlMenu.'Marked\ Files.Set\ Target<tab>mt mt' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.14 '.g:NetrwTopLvlMenu.'Marked\ Files.Tag<tab>mT mT' + exe 'sil! menu '.g:NetrwMenuPriority.'.14.15 '.g:NetrwTopLvlMenu.'Marked\ Files.Zip/Unzip/Compress/Uncompress<tab>mz mz' + exe 'sil! menu '.g:NetrwMenuPriority.'.15 '.g:NetrwTopLvlMenu.'Obtain\ File<tab>O O' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.1.1 '.g:NetrwTopLvlMenu.'Style.Listing.thin<tab>i :let w:netrw_liststyle=0<cr><c-L>' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.1.1 '.g:NetrwTopLvlMenu.'Style.Listing.long<tab>i :let w:netrw_liststyle=1<cr><c-L>' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.1.1 '.g:NetrwTopLvlMenu.'Style.Listing.wide<tab>i :let w:netrw_liststyle=2<cr><c-L>' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.1.1 '.g:NetrwTopLvlMenu.'Style.Listing.tree<tab>i :let w:netrw_liststyle=3<cr><c-L>' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.2.1 '.g:NetrwTopLvlMenu.'Style.Normal-Hide-Show.Show\ All<tab>a :let g:netrw_hide=0<cr><c-L>' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.2.3 '.g:NetrwTopLvlMenu.'Style.Normal-Hide-Show.Normal<tab>a :let g:netrw_hide=1<cr><c-L>' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.2.2 '.g:NetrwTopLvlMenu.'Style.Normal-Hide-Show.Hidden\ Only<tab>a :let g:netrw_hide=2<cr><c-L>' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.3 '.g:NetrwTopLvlMenu.'Style.Reverse\ Sorting\ Order<tab>'."r r" + exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.1 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Name<tab>s :let g:netrw_sort_by="name"<cr><c-L>' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.2 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Time<tab>s :let g:netrw_sort_by="time"<cr><c-L>' + exe 'sil! menu '.g:NetrwMenuPriority.'.16.4.3 '.g:NetrwTopLvlMenu.'Style.Sorting\ Method.Size<tab>s :let g:netrw_sort_by="size"<cr><c-L>' + exe 'sil! menu '.g:NetrwMenuPriority.'.17 '.g:NetrwTopLvlMenu.'Rename\ File/Directory<tab>R R' + exe 'sil! menu '.g:NetrwMenuPriority.'.18 '.g:NetrwTopLvlMenu.'Set\ Current\ Directory<tab>c c' let s:netrw_menucnt= 28 + call s:NetrwBookmarkMenu() " provide some history! uses priorities 2,3, reserves 4, 8.2.x + call s:NetrwTgtMenu() " let bookmarks and history be easy targets elseif !a:domenu let s:netrwcnt = 0 @@ -6048,222 +6628,6 @@ fun! s:NetrwObtain(islocal) endfun " --------------------------------------------------------------------- -" netrw#NetrwObtain: {{{2 -" netrw#NetrwObtain(islocal,fname[,tgtdirectory]) -" islocal=0 obtain from remote source -" =1 obtain from local source -" fname : a filename or a list of filenames -" tgtdir : optional place where files are to go (not present, uses getcwd()) -fun! netrw#NetrwObtain(islocal,fname,...) -" call Dfunc("netrw#NetrwObtain(islocal=".a:islocal." fname<".((type(a:fname) == 1)? a:fname : string(a:fname)).">) a:0=".a:0) - " NetrwStatusLine support - for obtaining support - - if type(a:fname) == 1 - let fnamelist= [ a:fname ] - elseif type(a:fname) == 3 - let fnamelist= a:fname - else - call netrw#ErrorMsg(s:ERROR,"attempting to use NetrwObtain on something not a filename or a list",62) -" call Dret("netrw#NetrwObtain") - return - endif -" call Decho("fnamelist<".string(fnamelist).">") - if a:0 > 0 - let tgtdir= a:1 - else - let tgtdir= getcwd() - endif -" call Decho("tgtdir<".tgtdir.">") - - if exists("b:netrw_islocal") && b:netrw_islocal - " obtain a file from local b:netrw_curdir to (local) tgtdir -" call Decho("obtain a file from local ".b:netrw_curdir." to ".tgtdir) - if exists("b:netrw_curdir") && getcwd() != b:netrw_curdir - 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") - for fname in fnamelist -" call Decho("system(".g:netrw_localcopycmd." ".shellescape(fname)." ".shellescape(topath).")") - call system(g:netrw_localcopycmd." ".shellescape(fname)." ".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)) - return - 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)) - 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)) - return - endif - elseif !exists("b:netrw_curdir") - call netrw#ErrorMsg(s:ERROR,"local browsing directory doesn't exist!",36) - else - call netrw#ErrorMsg(s:WARNING,"local browsing directory and current directory are identical",37) - endif - - else - " obtain files from remote b:netrw_curdir to local tgtdir -" call Decho("obtain a file from remote ".b:netrw_curdir." to ".tgtdir) - if type(a:fname) == 1 - call s:SetupNetrwStatusLine('%f %h%m%r%=%9*Obtaining '.a:fname) - endif - call s:NetrwMethod(b:netrw_curdir) - - if b:netrw_method == 4 - " obtain file using scp -" call Decho("obtain via scp (method#4)") - if exists("g:netrw_port") && g:netrw_port != "" - let useport= " ".g:netrw_scpport." ".g:netrw_port - else - let useport= "" - endif - if b:netrw_fname =~ '/' - let path= substitute(b:netrw_fname,'^\(.*/\).\{-}$','\1','') - else - let path= "" - endif - let filelist= join(map(deepcopy(fnamelist),'shellescape(g:netrw_machine.":".path.v:val,1)')) -" call Decho("exe ".s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1)) - exe s:netrw_silentxfer."!".g:netrw_scp_cmd.shellescape(useport,1)." ".filelist." ".shellescape(tgtdir,1) - - elseif b:netrw_method == 2 - " obtain file using ftp + .netrc -" call Decho("obtain via ftp+.netrc (method #2)") - call s:SaveBufVars()|sil keepjumps new|call s:RestoreBufVars() - let tmpbufnr= bufnr("%") - setlocal ff=unix - if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" - keepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) - endif - - if exists("b:netrw_fname") && b:netrw_fname != "" - call setline(line("$")+1,'cd "'.b:netrw_fname.'"') -" call Decho("filter input: ".getline('$')) - endif - - if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) - endif - for fname in fnamelist - call setline(line("$")+1,'get "'.fname.'"') -" call Decho("filter input: ".getline('$')) - endfor - if exists("g:netrw_port") && g:netrw_port != "" -" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)." ".shellescape(g:netrw_port,1) - else -" call Decho("executing: %!".s:netrw_ftp_cmd." -i ".shellescape(g:netrw_machine,1)) - exe s:netrw_silentxfer."%!".s:netrw_ftp_cmd." -i ".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 ' - let debugkeep= &debug - setlocal debug=msg - call netrw#ErrorMsg(s:ERROR,getline(1),4) - let &debug= debugkeep - endif - - 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 s:SaveBufVars()|sil keepjumps new|call s:RestoreBufVars() - let tmpbufnr= bufnr("%") - setlocal ff=unix - - if exists("g:netrw_port") && g:netrw_port != "" - keepj put ='open '.g:netrw_machine.' '.g:netrw_port -" call Decho("filter input: ".getline('$')) - else - keepj put ='open '.g:netrw_machine -" call Decho("filter input: ".getline('$')) - endif - - if exists("g:netrw_uid") && g:netrw_uid != "" - if exists("g:netrw_ftp") && g:netrw_ftp == 1 - keepj put =g:netrw_uid -" call Decho("filter input: ".getline('$')) - if exists("s:netrw_passwd") && s:netrw_passwd != "" - keepj put ='\"'.s:netrw_passwd.'\"' - endif -" call Decho("filter input: ".getline('$')) - elseif exists("s:netrw_passwd") - keepj put ='user \"'.g:netrw_uid.'\" \"'.s:netrw_passwd.'\"' -" call Decho("filter input: ".getline('$')) - endif - endif - - if exists("g:netrw_ftpmode") && g:netrw_ftpmode != "" - keepj put =g:netrw_ftpmode -" call Decho("filter input: ".getline('$')) - endif - - if exists("b:netrw_fname") && b:netrw_fname != "" - keepj call setline(line("$")+1,'cd "'.b:netrw_fname.'"') -" call Decho("filter input: ".getline('$')) - endif - - if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) - endif - - if exists("g:netrw_ftpextracmd") - keepj put =g:netrw_ftpextracmd -" call Decho("filter input: ".getline('$')) - endif - for fname in fnamelist - keepj call setline(line("$")+1,'get "'.fname.'"') - endfor -" call Decho("filter input: ".getline('$')) - - " perform ftp: - " -i : turns off interactive prompting from ftp - " -n unix : DON'T use <.netrc>, even though it exists - " -n win32: quit being obnoxious about password - keepj norm! 1Gdd -" call Decho("executing: %!".s:netrw_ftp_cmd." ".g:netrw_ftp_options) - exe 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).">") - if !exists("g:netrw_quiet") - keepj call netrw#ErrorMsg(s:ERROR,getline(1),5) - endif - endif - elseif !exists("b:netrw_method") || b:netrw_method < 0 -" call Dfunc("netrw#NetrwObtain : unsupported method") - return - endif - - " restore status line - if type(a:fname) == 1 && exists("s:netrw_users_stl") - keepj call s:SetupNetrwStatusLine(s:netrw_users_stl) - endif - - endif - - " cleanup - if exists("tmpbufnr") - if bufnr("%") != tmpbufnr - exe tmpbufnr."bw!" - else - q! - endif - endif - -" call Dret("netrw#NetrwObtain") -endfun - -" --------------------------------------------------------------------- " s:NetrwPrevWinOpen: open file/directory in previous window. {{{2 " If there's only one window, then the window will first be split. " Returns: @@ -6487,7 +6851,7 @@ fun! s:NetrwUpload(fname,tgt,...) let netrw_fname= b:netrw_fname keepj call s:SaveBufVars()|sil keepj new|keepj call s:RestoreBufVars() let tmpbufnr= bufnr("%") - setlocal ff=unix + setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" keepj put ='open '.g:netrw_machine.' '.g:netrw_port @@ -6541,7 +6905,7 @@ fun! s:NetrwUpload(fname,tgt,...) call histdel("/",-1) if getline(1) !~ "^$" && !exists("g:netrw_quiet") && getline(1) !~ '^Trying ' let debugkeep= &debug - setlocal debug=msg + setl debug=msg call netrw#ErrorMsg(s:ERROR,getline(1),15) let &debug = debugkeep let mod = 1 @@ -6596,11 +6960,12 @@ fun! s:NetrwRefresh(islocal,dirname) " at the current time (Mar 19, 2007) all calls to NetrwRefresh() call NetrwBrowseChgDir() first. " (defunct) NetrwBrowseChgDir() may clear the display; hence a NetrwSavePosn() may not work if its placed here. " (defunct) Also, NetrwBrowseChgDir() now does a NetrwSavePosn() itself. - setlocal ma noro -" call Decho("setlocal ma noro") + setl ma noro +" call Decho("setl ma noro") " call Decho("clear buffer<".expand("%")."> with :%d") let ykeep = @@ let screenposn = netrw#NetrwSavePosn() +" call Decho("clearing buffer prior to refresh") sil! keepj %d if a:islocal keepj call netrw#LocalBrowseCheck(a:dirname) @@ -6730,6 +7095,37 @@ fun! s:NetrwSetSort() " call Dret("SetSort") endfun +" --------------------------------------------------------------------- +" s:NetrwSetTgt: sets the target to the specified choice index {{{2 +" Implements [count]Tb (bookhist<b>) +" [count]Th (bookhist<h>) +" See :help netrw-qb for how to make the choice. +fun! s:NetrwSetTgt(bookhist,choice) +" call Dfunc("s:NetrwSetTgt(bookhist<".a:bookhist."> choice#".a:choice.")") + + if a:bookhist == 'b' + " supports choosing a bookmark as a target using a qb-generated list + let choice= a:choice - 1 + if exists("g:netrw_bookmarklist[".choice."]") + call netrw#NetrwMakeTgt(g:netrw_bookmarklist[choice]) + else + echomsg "Sorry, bookmark#".a:choice." doesn't exist!" + endif + + elseif a:bookhist == 'h' + " supports choosing a history stack entry as a target using a qb-generated list + let choice= (a:choice % g:netrw_dirhistmax) + 1 + if exists("g:netrw_dirhist_".choice) + let histentry = g:netrw_dirhist_{choice} + call netrw#NetrwMakeTgt(histentry) + else + echomsg "Sorry, history#".a:choice." not available!" + endif + endif + +" call Dret("s:NetrwSetTgt") +endfun + " ===================================================================== " s:NetrwSortStyle: change sorting style (name - time - size) and refresh display {{{2 fun! s:NetrwSortStyle(islocal) @@ -6830,36 +7226,53 @@ fun! s:NetrwSplit(mode) endfun " --------------------------------------------------------------------- -" NetrwStatusLine: {{{2 -fun! NetrwStatusLine() +" s:NetrwTgtMenu: {{{2 +fun! s:NetrwTgtMenu() + if !exists("s:netrw_menucnt") + return + endif +" call Dfunc("s:NetrwTgtMenu()") -" vvv NetrwStatusLine() debugging vvv -" let g:stlmsg="" -" if !exists("w:netrw_explore_bufnr") -" let g:stlmsg="!X<explore_bufnr>" -" elseif w:netrw_explore_bufnr != bufnr("%") -" let g:stlmsg="explore_bufnr!=".bufnr("%") -" endif -" if !exists("w:netrw_explore_line") -" let g:stlmsg=" !X<explore_line>" -" elseif w:netrw_explore_line != line(".") -" let g:stlmsg=" explore_line!={line(.)<".line(".").">" -" endif -" if !exists("w:netrw_explore_list") -" let g:stlmsg=" !X<explore_list>" -" endif -" ^^^ NetrwStatusLine() debugging ^^^ + " the following test assures that gvim is running, has menus available, and has menus enabled. + if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu + if exists("g:NetrwTopLvlMenu") +" call Decho("removing ".g:NetrwTopLvlMenu."Bookmarks menu item(s)") + exe 'sil! unmenu '.g:NetrwTopLvlMenu.'Targets' + endif + if !exists("s:netrw_initbookhist") + call s:NetrwBookHistRead() + endif - if !exists("w:netrw_explore_bufnr") || w:netrw_explore_bufnr != bufnr("%") || !exists("w:netrw_explore_line") || w:netrw_explore_line != line(".") || !exists("w:netrw_explore_list") - " restore user's status line - let &stl = s:netrw_users_stl - let &laststatus = s:netrw_users_ls - if exists("w:netrw_explore_bufnr")|unlet w:netrw_explore_bufnr|endif - if exists("w:netrw_explore_line") |unlet w:netrw_explore_line |endif - return "" - else - return "Match ".w:netrw_explore_mtchcnt." of ".w:netrw_explore_listlen + " target bookmarked places + if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] && g:netrw_dirhistmax > 0 +" call Decho("installing bookmarks as easy targets") + let cnt= 1 + for bmd in g:netrw_bookmarklist + let ebmd= escape(bmd,g:netrw_menu_escape) + " show bookmarks for goto menu +" call Decho("menu: Targets: ".bmd) + exe 'sil! menu <silent> '.g:NetrwMenuPriority.".19.1.".cnt." ".g:NetrwTopLvlMenu.'Targets.'.ebmd." :call netrw#NetrwMakeTgt('".bmd."')\<cr>" + let cnt= cnt + 1 + endfor + endif + + " target directory browsing history + if exists("g:netrw_dirhistmax") && g:netrw_dirhistmax > 0 +" call Decho("installing history as easy targets (histmax=".g:netrw_dirhistmax.")") + 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) + exe 'sil! menu <silent> '.g:NetrwMenuPriority.".19.2.".priority." ".g:NetrwTopLvlMenu.'Targets.'.ehistentry." :call netrw#NetrwMakeTgt('".histentry."')\<cr>" + endif + let histcnt = histcnt + 1 + endwhile + endif endif +" call Dret("s:NetrwTgtMenu") endfun " --------------------------------------------------------------------- @@ -6869,12 +7282,12 @@ fun! s:NetrwTreeDir() " call Dfunc("NetrwTreeDir() curline#".line(".")."<".getline('.')."> b:netrw_curdir<".b:netrw_curdir."> tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%").">") let treedir= b:netrw_curdir -" call Decho("set initial treedir<".treedir.">") +" call Decho("(NetrwTreeDir) set initial treedir<".treedir.">") let s:treecurpos= netrw#NetrwSavePosn() if w:netrw_liststyle == s:TREELIST -" call Decho("w:netrrw_liststyle is TREELIST:") -" call Decho("line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">") +" call Decho("(NetrwTreeDir) w:netrw_liststyle is TREELIST:") +" call Decho("(NetrwTreeDir) line#".line(".")." getline(.)<".getline('.')."> treecurpos<".string(s:treecurpos).">") " extract tree directory if on a line specifying a subdirectory (ie. ends with "/") if getline('.') =~ '/$' @@ -6882,13 +7295,13 @@ fun! s:NetrwTreeDir() else let treedir= "" endif -" call Decho("treedir<".treedir.">") +" call Decho("(NetrwTreeDir) treedir<".treedir.">") " detect user attempting to close treeroot if getline('.') !~ '|' && getline('.') != '..' " call Decho("user attempted to close treeroot") " now force a refresh -" call Decho("clear buffer<".expand("%")."> with :%d") +" call Decho("(NetrwTreeDir) clear buffer<".expand("%")."> with :%d") sil! keepj %d " call Dret("NetrwTreeDir <".treedir."> : (side effect) s:treecurpos<".string(s:treecurpos).">") return b:netrw_curdir @@ -6896,26 +7309,26 @@ fun! s:NetrwTreeDir() " elide all non-depth information let depth = substitute(getline('.'),'^\(\%(| \)*\)[^|].\{-}$','\1','e') -" call Decho("depth<".depth."> 1st subst (non-depth info removed)") +" call Decho("(NetrwTreeDir) depth<".depth."> 1st subst (non-depth info removed)") " elide first depth let depth = substitute(depth,'^| ','','') -" call Decho("depth<".depth."> 2nd subst (first depth removed)") +" call Decho("(NetrwTreeDir) depth<".depth."> 2nd subst (first depth removed)") " construct treedir by searching backwards at correct depth -" call Decho("constructing treedir<".treedir."> depth<".depth.">") +" call Decho("(NetrwTreeDir) constructing treedir<".treedir."> depth<".depth.">") while depth != "" && search('^'.depth.'[^|].\{-}/$','bW') let dirname= substitute(getline('.'),'^\(| \)*','','e') let treedir= dirname.treedir let depth = substitute(depth,'^| ','','') -" call Decho("constructing treedir<".treedir.">: dirname<".dirname."> while depth<".depth.">") +" call Decho("(NetrwTreeDir) constructing treedir<".treedir.">: dirname<".dirname."> while depth<".depth.">") endwhile if w:netrw_treetop =~ '/$' let treedir= w:netrw_treetop.treedir else let treedir= w:netrw_treetop.'/'.treedir endif -" call Decho("bufnr(.)=".bufnr("%")." line($)=".line("$")." line(.)=".line(".")) +" call Decho("(NetrwTreeDir) bufnr(.)=".bufnr("%")." line($)=".line("$")." line(.)=".line(".")) endif let treedir= substitute(treedir,'//$','/','') @@ -6929,7 +7342,7 @@ fun! s:NetrwTreeDisplay(dir,depth) " call Dfunc("NetrwTreeDisplay(dir<".a:dir."> depth<".a:depth.">)") " insure that there are no folds - setlocal nofen + setl nofen " install ../ and shortdir if a:depth == "" @@ -7033,8 +7446,8 @@ fun! s:NetrwWideListing() " cpf: characters per filename " fpl: filenames per line " fpc: filenames per column - setlocal ma noro -" call Decho("setlocal ma noro") + setl ma noro +" call Decho("setl ma noro") let b:netrw_cpf= 0 if line("$") >= w:netrw_bannercnt exe 'sil keepj '.w:netrw_bannercnt.',$g/^./if virtcol("$") > b:netrw_cpf|let b:netrw_cpf= virtcol("$")|endif' @@ -7091,28 +7504,28 @@ fun! s:PerformListing(islocal) " call Dfunc("s:PerformListing(islocal=".a:islocal.") bufnr(%)=".bufnr("%")."<".bufname("%").">") " set up syntax highlighting {{{3 -" call Decho("set up syntax highlighting") +" call Decho("(PerformListing) set up syntax highlighting") if has("syntax") if !exists("g:syntax_on") || !g:syntax_on -" call Decho("but g:syntax_on".(exists("g:syntax_on")? "=".g:syntax_on : "<doesn't exist>")) - setlocal ft= +" call Decho("(PerformListing) but g:syntax_on".(exists("g:syntax_on")? "=".g:syntax_on : "<doesn't exist>")) + setl ft= elseif &ft != "netrw" - setlocal ft=netrw + setl ft=netrw endif endif keepj call s:NetrwSafeOptions() - setlocal noro ma -" call Decho("setlocal noro ma") + set noro ma +" call Decho("(PerformListing) setl noro ma bh=".&bh) " if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 " Decho -" call Decho("(netrw) Processing your browsing request...") +" call Decho("(PerformListing) (netrw) Processing your browsing request...") " endif " Decho " call Decho('w:netrw_liststyle='.(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a')) 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") +" call Decho("(PerformListing) force refresh for treelisting: clear buffer<".expand("%")."> with :%d") sil! keepj %d endif @@ -7121,7 +7534,7 @@ fun! s:PerformListing(islocal) " Set up the banner {{{3 if g:netrw_banner -" call Decho("set up banner") +" call Decho("(PerformListing) set up banner") keepj call setline(1,'" ============================================================================') keepj call setline(2,'" Netrw Directory Listing (netrw '.g:loaded_netrw.')') keepj call setline(3,'" '.b:netrw_curdir) @@ -7139,15 +7552,15 @@ 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("(PerformListing) handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">") if g:netrw_sort_by =~ "^n" -" call Decho("directories will be sorted by name") +" call Decho("(PerformListing) directories will be sorted by name") " sorted by name keepj put ='\" Sorted by '.sortby keepj 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("(PerformListing) directories will be sorted by size or time") " sorted by size or date keepj put ='\" Sorted by '.sortby let w:netrw_bannercnt= w:netrw_bannercnt + 1 @@ -7158,7 +7571,7 @@ fun! s:PerformListing(islocal) " 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("(PerformListing) show copy/move target<".s:netrwmftgt.">") keepj put ='' if s:netrwmftgt_islocal sil! keepj call setline(line("."),'" Copy/Move Tgt: '.s:netrwmftgt.' (local)') @@ -7167,14 +7580,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("(PerformListing) s:netrwmftgt does not exist, don't make Copy/Move Tgt") endif exe "sil! keepj ".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("(PerformListing) handle hiding/showing (g:netrw_hide=".g:netrw_list_hide." g:netrw_list_hide<".g:netrw_list_hide.">)") if g:netrw_list_hide != "" && g:netrw_hide if g:netrw_hide == 1 keepj put ='\" Hiding: '.g:netrw_list_hide @@ -7193,37 +7606,37 @@ fun! s:PerformListing(islocal) if g:netrw_banner let w:netrw_bannercnt= w:netrw_bannercnt + 1 exe "sil! keepj ".w:netrw_bannercnt -" call Decho("bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$")) +" call Decho("(PerformListing) bannercnt=".w:netrw_bannercnt." (should index line just after banner) line($)=".line("$")) endif " get list of files -" call Decho("Get list of files - islocal=".a:islocal) +" call Decho("(PerformListing) Get list of files - islocal=".a:islocal) if a:islocal keepj call s:LocalListing() else " remote keepj call s:NetrwRemoteListing() endif -" call Decho("g:netrw_banner=".g:netrw_banner." w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)") +" call Decho("(PerformListing) g:netrw_banner=".g:netrw_banner." w:netrw_bannercnt=".w:netrw_bannercnt." (banner complete)") " manipulate the directory listing (hide, sort) {{{3 if !exists("w:netrw_bannercnt") let w:netrw_bannercnt= 0 endif 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("(PerformListing) manipulate directory listing (hide)") +" call Decho("(PerformListing) g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">") if g:netrw_hide && g:netrw_list_hide != "" keepj 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("(PerformListing) manipulate directory listing (sort) : g:netrw_sort_by<".g:netrw_sort_by.">") if g:netrw_sort_by =~ "^n" " sort by name keepj 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("(PerformListing) g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")") if g:netrw_sort_direction =~ 'n' " normal direction sorting exe 'sil keepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options @@ -7233,13 +7646,13 @@ fun! s:PerformListing(islocal) endif endif " remove priority pattern prefix -" call Decho("remove priority pattern prefix") +" call Decho("(PerformListing) remove priority pattern prefix") exe 'sil! keepj '.w:netrw_bannercnt.',$s/^\d\{3}'.g:netrw_sepchr.'//e' keepj 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("(PerformListing) g:netrw_sort_direction=".g:netrw_sort_direction) if g:netrw_sort_direction =~ 'n' " call Decho('exe sil keepjumps '.w:netrw_bannercnt.',$sort') exe 'sil! keepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options @@ -7262,30 +7675,30 @@ fun! s:PerformListing(islocal) endif " convert to wide/tree listing {{{3 -" call Decho("modify display if wide/tree listing style") +" call Decho("(PerformListing) modify display if wide/tree listing style") keepj call s:NetrwWideListing() keepj call s:NetrwTreeListing(b:netrw_curdir) 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") +" call Decho("(PerformListing) place cursor on top-left corner of file listing") exe 'sil! keepj '.w:netrw_bannercnt sil! keepj norm! 0 endif " record previous current directory let w:netrw_prvdir= b:netrw_curdir -" call Decho("record netrw_prvdir<".w:netrw_prvdir.">") +" call Decho("(PerformListing) record netrw_prvdir<".w:netrw_prvdir.">") " save certain window-oriented variables into buffer-oriented variables {{{3 keepj call s:SetBufWinVars() keepj call s:NetrwOptionRestore("w:") " set display to netrw display settings -" call Decho("set display to netrw display settings (noma nomod etc)") +" call Decho("(PerformListing) set display to netrw display settings (".g:netrw_bufsettings.")") exe "setl ".g:netrw_bufsettings if g:netrw_liststyle == s:LONGLIST -" call Decho("(LocalListing) exe setl ts=".(g:netrw_maxfilenamelen+1)) +" call Decho("(PerformListing) exe setl ts=".(g:netrw_maxfilenamelen+1)) exe "setl ts=".(g:netrw_maxfilenamelen+1) endif if exists("s:treecurpos") @@ -7333,7 +7746,7 @@ fun! s:SetupNetrwStatusLine(statline) " insure that windows have a statusline " make sure statusline is displayed let &stl=a:statline - setlocal laststatus=2 + setl laststatus=2 " call Decho("stl=".&stl) redraw @@ -7634,7 +8047,6 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) endif elseif ok =~ 'q\%[uit]' " call Decho("ok==".ok) - break endif else @@ -7677,7 +8089,7 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) endif elseif ok =~ 'q\%[uit]' - break +" call Decho("ok==".ok) endif endif @@ -7696,8 +8108,8 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) " because WinXX ftp uses unix style input let ffkeep= &ff - setlocal ma ff=unix noro -" call Decho("setlocal ma ff=unix noro") + setl ma ff=unix noro +" call Decho("setl ma ff=unix noro") " clear off any older non-banner lines " note that w:netrw_bannercnt indexes the line after the banner @@ -7727,7 +8139,7 @@ fun! s:NetrwRemoteFtpCmd(path,listcmd) "......................................... elseif w:netrw_method == 3 " ftp + machine,id,passwd,filename: Method #3 - setlocal ff=unix + setl ff=unix if exists("g:netrw_port") && g:netrw_port != "" keepj put ='open '.g:netrw_machine.' '.g:netrw_port else @@ -7923,7 +8335,8 @@ fun! netrw#FileUrlRead(fname) " call Decho("plainfname<".plainfname.">") exe "sil doau BufReadPre ".fname2396e exe 'keepj r '.plainfname - exe 'file! '.plainfname + exe 'sil! bdelete '.plainfname + exe 'keepalt file! '.plainfname keepj 1d " call Decho("(FileUrlRead) setl nomod") setl nomod @@ -7942,22 +8355,22 @@ fun! netrw#LocalBrowseCheck(dirname) " The &ft == "netrw" test was installed because the BufEnter event " would hit when re-entering netrw windows, creating unexpected " refreshes (and would do so in the middle of NetrwSaveOptions(), too) -" call Decho("netrw#LocalBrowseCheck: isdir<".a:dirname.">=".isdirectory(a:dirname).((exists("s:treeforceredraw")? " treeforceredraw" : ""))) +" call Decho("(LocalBrowseCheck) isdir<".a:dirname.">=".isdirectory(a:dirname).((exists("s:treeforceredraw")? " treeforceredraw" : ""))) " call Dredir("LocalBrowseCheck","ls!")|redraw!|sleep 3 let ykeep= @@ if isdirectory(a:dirname) -" call Decho(" ft<".&ft."> b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : " doesn't exist")."> dirname<".a:dirname.">"." line($)=".line("$")." ft<".&ft."> g:netrw_fastbrowse=".g:netrw_fastbrowse) +" call Decho("(LocalBrowseCheck) 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#NetrwSavePosn() if &ft != "netrw" || (exists("b:netrw_curdir") && b:netrw_curdir != a:dirname) || g:netrw_fastbrowse <= 1 - sil! keepj call s:NetrwBrowse(1,a:dirname) - call netrw#NetrwRestorePosn(svposn) + sil! keepj keepalt call s:NetrwBrowse(1,a:dirname) + keepalt call netrw#NetrwRestorePosn(svposn) elseif &ft == "netrw" && line("$") == 1 - sil! keepj call s:NetrwBrowse(1,a:dirname) - call netrw#NetrwRestorePosn(svposn) + sil! keepj keepalt call s:NetrwBrowse(1,a:dirname) + keepalt call netrw#NetrwRestorePosn(svposn) elseif exists("s:treeforceredraw") unlet s:treeforceredraw - sil! keepj call s:NetrwBrowse(1,a:dirname) - call netrw#NetrwRestorePosn(svposn) + sil! keepj keepalt call s:NetrwBrowse(1,a:dirname) + keepalt call netrw#NetrwRestorePosn(svposn) endif endif " following code wipes out currently unused netrw buffers @@ -7968,7 +8381,7 @@ fun! netrw#LocalBrowseCheck(dirname) let buflast = bufnr("$") while ibuf <= buflast if bufwinnr(ibuf) == -1 && isdirectory(bufname(ibuf)) - exe "sil! ".ibuf."bw!" + exe "sil! keepalt ".ibuf."bw!" endif let ibuf= ibuf + 1 endwhile @@ -7984,74 +8397,36 @@ fun! s:LocalListing() " call Decho("(LocalListing) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)") " call Decho("(LocalListing) 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 +" if exists("b:netrw_curdir") |call Decho('(LocalListing) b:netrw_curdir<'.b:netrw_curdir.">") |else|call Decho("(LocalListing) b:netrw_curdir doesn't exist") |endif +" if exists("g:netrw_sort_by")|call Decho('(LocalListing) g:netrw_sort_by<'.g:netrw_sort_by.">")|else|call Decho("(LocalListing) g:netrw_sort_by doesn't exist")|endif " get the list of files contained in the current directory let dirname = b:netrw_curdir let dirnamelen = s:Strlen(b:netrw_curdir) - let filelist = glob(s:ComposePath(dirname,"*")) -" call Decho("(LocalListing) glob(dirname<".dirname."/*>)=".filelist) - if filelist != "" - let filelist= filelist."\n" - endif - let filelist= filelist.glob(s:ComposePath(dirname,".*")) -" call Decho("(LocalListing) glob(dirname<".dirname."/.*>)=".filelist) - - " Coding choice: either elide ./ if present - " or include ./ if not present - if filelist =~ '[\\/]\.[\\/]\=\(\n\|$\)' - " elide /path/. from glob() entries if present -" call Decho("(LocalListing) elide /path/. from glob entries if present") - let filelist = substitute(filelist,'\n','\t','g') - let filelist = substitute(filelist,'^[^\t]\+[/\\]\.\t','','') - let filelist = substitute(filelist,'[^\t]\+[/\\]\.$','','') - let filelist = substitute(filelist,'\t\zs[^\t]\+[/\\]\.\t','','') - let filelist = substitute(filelist,'\t','\n','g') - endif -" call Decho("(LocalListing) filelist<".filelist.">") - if filelist !~ '[\\/]\.\.[\\/]\=\(\n\|$\)' + let filelist = glob(s:ComposePath(dirname,"*"),0,1) + let filelist = filelist + glob(s:ComposePath(dirname,".*"),0,1) +" call Decho("(LocalListing) filelist=".filelist) + + if index(filelist,'..') == -1 && b:netrw_curdir != '/' " include ../ in the glob() entry if its missing -" call Decho("(LocalListing) forcibly tacking on ..") - let filelist= filelist."\n".s:ComposePath(b:netrw_curdir,"../") -" call Decho("(LocalListing) filelist<".filelist.">") - endif - if b:netrw_curdir == '/' - " remove .. from filelist when current directory is root directory -" call Decho("(LocalListing) remove .. from filelist") - let filelist= substitute(filelist,'/\.\.\n','','') - endif - " remove multiple contiguous newlines - let filelist= substitute(filelist,'\n\{2,}','\n','ge') - if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) - " change all \s to /s -" call Decho('(LocalListing) change all \s to /s') - let filelist= substitute(filelist,'\','/','g') - else - " escape all \s to \\ -" call Decho('(LocalListing) escape all \s to \\') - let filelist= substitute(filelist,'\','\\','g') +" call Decho("(LocalListing) forcibly tacking on \"..\"") + let filelist= filelist+[s:ComposePath(b:netrw_curdir,"../")] +" call Decho("(LocalListing) filelist=".string(filelist)) endif " call Decho("(LocalListing) (before while) dirname<".dirname.">") " call Decho("(LocalListing) (before while) dirnamelen<".dirnamelen.">") -" call Decho("(LocalListing) (before while) filelist<".filelist.">") - +" call Decho("(LocalListing) (before while) filelist=".string(filelist)) if get(g:, 'netrw_dynamic_maxfilenamelen', 0) - let g:netrw_maxfilenamelen = max(map(split(filelist, '\n'), 'len(fnamemodify(v:val, ":t"))')) + 1 + let filelistcopy = map(deepcopy(filelist),'fnamemodify(v:val, ":t")') + let g:netrw_maxfilenamelen = max(map(filelistcopy,'len(v:val)')) + 1 +" call Decho("(LocalListing) dynamic_maxfilenamelen: filenames =".string(filelistcopy)) +" call Decho("(LocalListing) dynamic_maxfilenamelen: g:netrw_maxfilenamelen=".g:netrw_maxfilenamelen) endif - while filelist != "" - if filelist =~ '\n' - let filename = substitute(filelist,'\n.*$','','e') - let filelist = substitute(filelist,'^.\{-}\n\(.*\)$','\1','e') - else - let filename = filelist - let filelist = "" - endif -" call Decho(" ") -" call Decho("(LocalListing) (while) filelist<".filelist.">") + for filename in filelist +" call Decho("(LocalListing) ") " call Decho("(LocalListing) (while) filename<".filename.">") if getftype(filename) == "link" @@ -8117,7 +8492,7 @@ fun! s:LocalListing() 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("(LocalListing) getftime(".filename.")=".getftime(filename)) let t = getftime(filename) let ft = strpart("000000000000000000",1,18-strlen(t)).t " call Decho("(LocalListing) exe keepjumps put ='".ft.'/'.filename."'") @@ -8138,7 +8513,7 @@ fun! s:LocalListing() " call Decho("(LocalListing) exe keepjumps put ='".pfile."'") sil! keepj put=pfile endif - endwhile + endfor " cleanup any windows mess at end-of-line sil! keepj g/^$/d @@ -8182,25 +8557,25 @@ fun! s:LocalBrowseShellCmdRefresh() 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("(LocalBrowseShellCmdRefresh) buftablist".string(buftablist)) +" call Decho("(LocalBrowseShellCmdRefresh) s:netrw_browselist<".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "").">") " GO through all buffers on netrw_browselist (ie. just local-netrw buffers): " | refresh any netrw window " | wipe out any non-displaying netrw buffer let curwin = winnr() let ibl = 0 for ibuf in s:netrw_browselist -" call Decho("bufwinnr(".ibuf.") index(buftablist,".ibuf.")=".index(buftablist,ibuf)) +" call Decho("(LocalBrowseShellCmdRefresh) bufwinnr(".ibuf.") index(buftablist,".ibuf.")=".index(buftablist,ibuf)) if bufwinnr(ibuf) == -1 && index(buftablist,ibuf) == -1 " wipe out any non-displaying netrw buffer -" call Decho("wiping buf#".ibuf,"<".bufname(ibuf).">") +" call Decho("(LocalBrowseShellCmdRefresh) wiping buf#".ibuf,"<".bufname(ibuf).">") exe "sil! bd ".fnameescape(ibuf) call remove(s:netrw_browselist,ibl) -" call Decho("browselist=".string(s:netrw_browselist)) +" call Decho("(LocalBrowseShellCmdRefresh) browselist=".string(s:netrw_browselist)) continue elseif index(tabpagebuflist(),ibuf) != -1 " refresh any netrw buffer -" call Decho("refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf)) +" call Decho("(LocalBrowseShellCmdRefresh) refresh buf#".ibuf.'-> win#'.bufwinnr(ibuf)) exe bufwinnr(ibuf)."wincmd w" keepj call s:NetrwRefresh(1,s:NetrwBrowseChgDir(1,'./')) endif @@ -8229,15 +8604,15 @@ fun! s:LocalFastBrowser() " 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("(LocalFastBrowser) initialize s:netrw_browselist") 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("(LocalFastBrowser) appendng current buffer to browselist") call add(s:netrw_browselist,bufnr("%")) -" call Decho("browselist=".string(s:netrw_browselist)) +" call Decho("(LocalFastBrowser) browselist=".string(s:netrw_browselist)) endif " enable autocmd events to handle refreshing/removing local browser buffers @@ -8247,16 +8622,16 @@ fun! s:LocalFastBrowser() " =1 : medium speed, re-use directory listing for remote only " =2 : fast speed, always re-use directory listing when possible if !exists("s:netrw_browser_shellcmd") && g:netrw_fastbrowse <= 1 -" call Decho("setting up local-browser shell command refresh") +" call Decho("(LocalFastBrowser) setting up local-browser shell command refresh") let s:netrw_browser_shellcmd= 1 augroup AuNetrwShellCmd au! if (has("win32") || has("win95") || has("win64") || has("win16")) -" call Decho("autocmd: ShellCmdPost * call s:LocalBrowseShellCmdRefresh()") +" call Decho("(LocalFastBrowser) autocmd: ShellCmdPost * call s:LocalBrowseShellCmdRefresh()") au ShellCmdPost * call s:LocalBrowseShellCmdRefresh() else au ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh() -" call Decho("autocmd: ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh()") +" call Decho("(LocalFastBrowser) autocmd: ShellCmdPost,FocusGained * call s:LocalBrowseShellCmdRefresh()") endif augroup END endif @@ -8264,7 +8639,7 @@ fun! s:LocalFastBrowser() " user must have changed fastbrowse to its fast setting, so remove " the associated autocmd events if g:netrw_fastbrowse > 1 && exists("s:netrw_browser_shellcmd") -" call Decho("remove AuNetrwShellCmd autcmd group") +" call Decho("(LocalFastBrowser) remove AuNetrwShellCmd autcmd group") unlet s:netrw_browser_shellcmd augroup AuNetrwShellCmd au! @@ -8535,7 +8910,9 @@ fun! netrw#NetrwRestorePosn(...) let eikeep= &ei set ei=all if expand("%") == "NetrwMessage" - exe s:winBeforeErr."wincmd w" + if exists("s:winBeforeErr") + exe s:winBeforeErr."wincmd w" + endif endif if a:0 > 0 @@ -8544,7 +8921,7 @@ fun! netrw#NetrwRestorePosn(...) " restore window if exists("w:netrw_winnr") -" call Decho("restore window: exe sil! ".w:netrw_winnr."wincmd w") +" call Decho("(NetrwRestorePosn) restore window: exe sil! ".w:netrw_winnr."wincmd w") exe "sil! ".w:netrw_winnr."wincmd w" endif if v:shell_error == 0 @@ -8555,29 +8932,29 @@ fun! netrw#NetrwRestorePosn(...) " restore top-of-screen line if exists("w:netrw_hline") -" call Decho("restore topofscreen: exe keepj norm! ".w:netrw_hline."G0z") +" call Decho("(NetrwRestorePosn) restore topofscreen: exe keepj norm! ".w:netrw_hline."G0z") exe "keepj norm! ".w:netrw_hline."G0z\<CR>" endif " restore position if exists("w:netrw_line") && exists("w:netrw_col") -" call Decho("restore posn: exe keepj norm! ".w:netrw_line."G0".w:netrw_col."|") +" call Decho("(NetrwRestorePosn) restore posn: exe keepj norm! ".w:netrw_line."G0".w:netrw_col."|") exe "keepj norm! ".w:netrw_line."G0".w:netrw_col."\<bar>" endif let &ei= eikeep -" call Dret("netrw#NetrwRestorePosn") +" call Dret("netrw#NetrwRestorePosn : line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()) endfun " --------------------------------------------------------------------- " netrw#NetrwSavePosn: saves position of cursor on screen {{{2 fun! netrw#NetrwSavePosn() -" call Dfunc("netrw#NetrwSavePosn()") +" call Dfunc("netrw#NetrwSavePosn() 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("(NetrwSavePosn) currently, win#".w:netrw_winnr." line#".w:netrw_line." col#".w:netrw_col) " Save top-of-screen line keepj norm! H0 @@ -8805,11 +9182,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: setlocal cul cuc") +" call Decho("case g:netrw_cursor==3 and wide: setl cul cuc") setl cursorline setl cursorcolumn else -" call Decho("case g:netrw_cursor==3 and not wide: setlocal cul (use user's cuc)") +" call Decho("case g:netrw_cursor==3 and not wide: setl cul (use user's cuc)") setl cursorline let &l:cursorcolumn = s:netrw_usercuc endif @@ -8817,7 +9194,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: setlocal cuc (use user's cul)") +" call Decho("case g:netrw_cursor==2: setl cuc (use user's cul)") let &l:cursorcolumn = s:netrw_usercuc setl cursorline @@ -8826,7 +9203,7 @@ 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: setlocal cul (use user's cuc)") +" call Decho("case g:netrw_cursor==2 and wide: setl cul (use user's cuc)") set cursorline else " call Decho("case g:netrw_cursor==2 and not wide: (use user's cul,cuc)") @@ -8868,7 +9245,7 @@ fun! s:NetrwDelete(path) if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) if exists("+shellslash") let sskeep= &shellslash - setlocal noshellslash + setl noshellslash let result = delete(path) let &shellslash = sskeep else @@ -8948,7 +9325,7 @@ fun! s:NetrwEnew(...) if b:netrw_curdir =~ '/$' if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST file NetrwTreeListing - set bt=nowrite noswf + set bt=nowrite noswf bh=hide nno <silent> <buffer> [ :sil call <SID>TreeListMove('[')<cr> nno <silent> <buffer> ] :sil call <SID>TreeListMove(']')<cr> else @@ -8957,7 +9334,7 @@ fun! s:NetrwEnew(...) endif endif -" call Dret("s:NetrwEnew : buf#".bufnr("%")."<".bufname("%")."> expand(%)<".expand("%")."> expand(#)<".expand("#").">") +" call Dret("s:NetrwEnew : buf#".bufnr("%")."<".bufname("%")."> expand(%)<".expand("%")."> expand(#)<".expand("#")."> bh=".&bh) endfun " --------------------------------------------------------------------- @@ -8977,7 +9354,7 @@ fun! s:NetrwInsureWinVars() endif let iwin= iwin + 1 endwhile - exe curwin."wincmd w" + exe "keepalt ".curwin."wincmd w" if exists("winvars") " call Decho("copying w#".iwin." window variables to w#".curwin) for k in keys(winvars) @@ -9105,6 +9482,9 @@ endfun " " s:nbcd_curpos_{bufnr('%')} is set up by s:NetrwBrowseChgDir() 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.">") if !exists("w:netrw_rexlocal") " " call Dret("s:NetrwRexplore() w:netrw_rexlocal doesn't exist") @@ -9204,7 +9584,7 @@ endfun " --------------------------------------------------------------------- " s:Strlen: this function returns the length of a string, even if its {{{2 -" using two-byte etc characters. +" using multiple-byte characters. " Solution from Nicolai Weibull, vim docs (:help strlen()), Tony Mechelynck, " and a bit from me. " if g:netrw_xstrlen is zero (default), then the builtin strlen() function is used. @@ -9231,6 +9611,7 @@ fun! s:Strlen(x) call setline(line("."),a:x) let ret= virtcol("$") - 1 keepj d + keepj norm! k let &mod= modkeep else diff --git a/runtime/autoload/netrwFileHandlers.vim b/runtime/autoload/netrwFileHandlers.vim index b11e3cfbf..84f70c4f8 100644 --- a/runtime/autoload/netrwFileHandlers.vim +++ b/runtime/autoload/netrwFileHandlers.vim @@ -1,9 +1,9 @@ " netrwFileHandlers: contains various extension-based file handlers for " netrw's browsers' x command ("eXecute launcher") -" Author: Charles E. Campbell, Jr. +" Author: Charles E. Campbell " Date: Mar 14, 2012 " Version: 11a -" Copyright: Copyright (C) 1999-2012 Charles E. Campbell, Jr. {{{1 +" Copyright: Copyright (C) 1999-2012 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, diff --git a/runtime/autoload/netrwSettings.vim b/runtime/autoload/netrwSettings.vim index ef361dc21..68348d8d0 100644 --- a/runtime/autoload/netrwSettings.vim +++ b/runtime/autoload/netrwSettings.vim @@ -1,8 +1,8 @@ " netrwSettings.vim: makes netrw settings simpler " Date: Sep 03, 2008 -" Maintainer: Charles E Campbell, Jr <drchipNOSPAM at campbellfamily dot biz> +" Maintainer: Charles E Campbell <drchipNOSPAM at campbellfamily dot biz> " Version: 13 -" Copyright: Copyright (C) 1999-2007 Charles E. Campbell, Jr. {{{1 +" Copyright: Copyright (C) 1999-2007 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, @@ -63,7 +63,7 @@ fun! netrwSettings#NetrwSettings() endif put ='+ ---------------------------------------------' - put ='+ NetrwSettings: by Charles E. Campbell, Jr.' + put ='+ NetrwSettings: by Charles E. Campbell' put ='+ Press <F1> with cursor atop any line for help' put ='+ ---------------------------------------------' let s:netrw_settings_stop= line(".") diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim index d67212934..5e76870cc 100644 --- a/runtime/autoload/tar.vim +++ b/runtime/autoload/tar.vim @@ -1,13 +1,13 @@ " tar.vim: Handles browsing tarfiles " AUTOLOAD PORTION -" Date: Jan 17, 2012 -" Version: 28 -" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> +" Date: Apr 17, 2013 +" Version: 29 +" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " License: Vim License (see vim's :help license) " " Contains many ideas from Michael Toren's <tar.vim> " -" Copyright: Copyright (C) 2005-2011 Charles E. Campbell, Jr. {{{1 +" Copyright: Copyright (C) 2005-2011 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, @@ -22,7 +22,7 @@ if &cp || exists("g:loaded_tar") finish endif -let g:loaded_tar= "v28" +let g:loaded_tar= "v29" if v:version < 702 echohl WarningMsg echo "***warning*** this version of tar needs vim 7.2" @@ -31,6 +31,7 @@ if v:version < 702 endif let s:keepcpo= &cpo set cpo&vim +"DechoTabOn "call Decho("loading autoload/tar.vim") " --------------------------------------------------------------------- @@ -80,7 +81,7 @@ endif " set up shell quoting character if !exists("g:tar_shq") - if exists("&shq") && &shq != "" + if exists("+shq") && exists("&shq") && &shq != "" let g:tar_shq= &shq elseif has("win32") || has("win95") || has("win64") || has("win16") if exists("g:netrw_cygwin") && g:netrw_cygwin @@ -147,7 +148,7 @@ fun! tar#Browse(tarfile) keepj $ let tarfile= a:tarfile - if has("win32") && executable("cygpath") + if has("win32unix") && executable("cygpath") " assuming cygwin let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') endif @@ -227,7 +228,7 @@ fun! s:TarBrowseSelect() " about to make a new window, need to use b:tarfile let tarfile= b:tarfile let curfile= expand("%") - if has("win32") && executable("cygpath") + if has("win32unix") && executable("cygpath") " assuming cygwin let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') endif @@ -239,6 +240,8 @@ fun! s:TarBrowseSelect() let s:tblfile_{winnr()}= curfile call tar#Read("tarfile:".tarfile.'::'.fname,1) filetype detect + set nomod + exe 'com! -buffer -nargs=? -complete=file TarDiff :call tar#Diff(<q-args>,"'.fnameescape(fname).'")' let &report= repkeep " call Dret("TarBrowseSelect : s:tblfile_".winnr()."<".s:tblfile_{winnr()}.">") @@ -252,7 +255,7 @@ fun! tar#Read(fname,mode) set report=10 let tarfile = substitute(a:fname,'tarfile:\(.\{-}\)::.*$','\1','') let fname = substitute(a:fname,'tarfile:.\{-}::\(.*\)$','\1','') - if has("win32") && executable("cygpath") + if has("win32unix") && executable("cygpath") " assuming cygwin let tarfile=substitute(system("cygpath -u ".shellescape(tarfile,0)),'\n$','','e') endif @@ -425,7 +428,7 @@ fun! tar#Write(fname) if fname =~ '/' let dirpath = substitute(fname,'/[^/]\+$','','e') - if executable("cygpath") + if has("win32unix") && executable("cygpath") let dirpath = substitute(system("cygpath ".shellescape(dirpath, 0)),'\n','','e') endif call mkdir(dirpath,"p") @@ -445,7 +448,7 @@ fun! tar#Write(fname) let tar_secure= " " endif exe "w! ".fnameescape(fname) - if executable("cygpath") + if has("win32unix") && executable("cygpath") let tarfile = substitute(system("cygpath ".shellescape(tarfile,0)),'\n','','e') endif @@ -501,6 +504,30 @@ fun! tar#Write(fname) endfun " --------------------------------------------------------------------- +" tar#Diff: {{{2 +fun! tar#Diff(userfname,fname) +" call Dfunc("tar#Diff(userfname<".a:userfname."> fname<".a:fname.")") + let fname= a:fname + if a:userfname != "" + let fname= a:userfname + endif + if filereadable(fname) + " sets current file (from tarball) for diff'ing + " splits window vertically + " opens original file, sets it for diff'ing + " sets up b:tardiff_otherbuf variables so each buffer knows about the other (for closing purposes) + diffthis + wincmd v + exe "e ".fnameescape(fname) + diffthis + else + redraw! + echo "***warning*** unable to read file<".fname.">" + endif +" call Dret("tar#Diff") +endfun + +" --------------------------------------------------------------------- " s:Rmdir: {{{2 fun! s:Rmdir(fname) " call Dfunc("Rmdir(fname<".a:fname.">)") diff --git a/runtime/autoload/zip.vim b/runtime/autoload/zip.vim index ad5cce2ed..b7a5bffbf 100644 --- a/runtime/autoload/zip.vim +++ b/runtime/autoload/zip.vim @@ -1,10 +1,10 @@ " zip.vim: Handles browsing zipfiles " AUTOLOAD PORTION -" Date: Jan 17, 2012 -" Version: 25 -" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> +" Date: Apr 17, 2013 +" Version: 26 +" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " License: Vim License (see vim's :help license) -" Copyright: Copyright (C) 2005-2012 Charles E. Campbell, Jr. {{{1 +" Copyright: Copyright (C) 2005-2012 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, @@ -19,7 +19,7 @@ if &cp || exists("g:loaded_zip") finish endif -let g:loaded_zip= "v25" +let g:loaded_zip= "v26" if v:version < 702 echohl WarningMsg echo "***warning*** this version of zip needs vim 7.2" @@ -188,13 +188,23 @@ fun! zip#Read(fname,mode) else let zipfile = substitute(a:fname,'^.\{-}zipfile:\(.\{-}\)::[^\\].*$','\1','') let fname = substitute(a:fname,'^.\{-}zipfile:.\{-}::\([^\\].*\)$','\1','') - let fname = substitute(fname, '[', '[[]', 'g') + let fname = substitute(fname, '[', '[[]', 'g') endif " call Decho("zipfile<".zipfile.">") " call Decho("fname <".fname.">") -" call Decho("exe r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1)) - exe "keepj sil! r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1) + " the following code does much the same thing as + " exe "keepj sil! r! ".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1) + " but allows zipfile:... entries in quickfix lists + let temp = tempname() + let fn = expand('%:p') + exe "sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1).' > '.temp +" call Decho("exe sil! !".g:zip_unzipcmd." -p -- ".s:Escape(zipfile,1)." ".s:Escape(fnameescape(fname),1).' > '.temp) + sil exe 'keepalt file '.temp + sil keepj e! + sil exe 'keepalt file '.fnameescape(fn) + call delete(temp) + filetype detect " cleanup @@ -267,7 +277,7 @@ fun! zip#Write(fname) if fname =~ '/' let dirpath = substitute(fname,'/[^/]\+$','','e') - if executable("cygpath") + if has("win32unix") && executable("cygpath") let dirpath = substitute(system("cygpath ".s:Escape(dirpath,0)),'\n','','e') endif " call Decho("mkdir(dirpath<".dirpath.">,p)") @@ -279,7 +289,7 @@ fun! zip#Write(fname) " call Decho("zipfile<".zipfile."> fname<".fname.">") exe "w! ".fnameescape(fname) - if executable("cygpath") + if has("win32unix") && executable("cygpath") let zipfile = substitute(system("cygpath ".s:Escape(zipfile,0)),'\n','','e') endif diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index 7565c898e..332dbee6d 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1,4 +1,4 @@ -*pattern.txt* For Vim version 7.3. Last change: 2013 Jan 25 +*pattern.txt* For Vim version 7.3. Last change: 2013 Apr 20 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1061,6 +1061,8 @@ x A single character, with no special meaning, matches itself any character that's not in "^]-\bdertnoUux". "[\xyz]" matches '\', 'x', 'y' and 'z'. It's better to use "\\" though, future expansions may use other characters after '\'. + - Omitting the trailing ] is not considered an error. "[]" works like + "[]]", it matches the ']' character. - The following translations are accepted when the 'l' flag is not included in 'cpoptions' {not in Vi}: \e <Esc> diff --git a/runtime/doc/pi_getscript.txt b/runtime/doc/pi_getscript.txt index 5543573eb..fa2523cc7 100644 --- a/runtime/doc/pi_getscript.txt +++ b/runtime/doc/pi_getscript.txt @@ -1,11 +1,11 @@ -*pi_getscript.txt* For Vim version 7.0. Last change: 2011 Jun 23 +*pi_getscript.txt* For Vim version 7.0. Last change: 2012 Apr 07 > - GETSCRIPT REFERENCE MANUAL by Charles E. Campbell, Jr. + GETSCRIPT REFERENCE MANUAL by Charles E. Campbell < -Authors: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamilyA.Mbiz> +Authors: Charles E. Campbell <NdrOchip@ScampbellPfamilyA.Mbiz> (remove NOSPAM from the email address) *GetLatestVimScripts-copyright* -Copyright: (c) 2004-2012 by Charles E. Campbell, Jr. *glvs-copyright* +Copyright: (c) 2004-2012 by Charles E. Campbell *glvs-copyright* The VIM LICENSE (see |copyright|) applies to the files in this package, including getscriptPlugin.vim, getscript.vim, GetLatestVimScripts.dist, and pi_getscript.txt, except use "getscript" @@ -343,6 +343,11 @@ after/syntax/c.vim contained in it to overwrite a user's c.vim. default= $HOME/vimfiles (windows) Override where :AutoInstall: scripts will be installed. Doesn't override vimball installation. +> + g:GetLatestVimScripts_scriptaddr +< default='http://vim.sourceforge.net/script.php?script_id=' + Override this if your system needs + ... ='http://vim.sourceforge.net/script/script.php?script_id=' ============================================================================== 8. GetLatestVimScripts Algorithm *glvs-algorithm* *glvs-alg* @@ -380,7 +385,11 @@ The AutoInstall process will: ============================================================================== 9. GetLatestVimScripts History *getscript-history* *glvs-hist* {{{1 -v44 Jun 23, 2011 : * handles additional decompression options for tarballs +v35 Apr 07, 2012 : * (MengHuan Yu) pointed out that the script url has + changed (somewhat). However, it doesn't work, and + the original one does (under Linux). I'll make it + yet-another-option. +v34 Jun 23, 2011 : * handles additional decompression options for tarballs (tgz taz tbz txz) v33 May 31, 2011 : * using fnameescape() instead of escape() * *.xz support diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index c17ca5f7c..98515647a 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -1,12 +1,12 @@ -*pi_netrw.txt* For Vim version 7.3. Last change: 2012 Oct 25 +*pi_netrw.txt* For Vim version 7.3. Last change: 2013 Apr 19 - ----------------------------------------------------- - NETRW REFERENCE MANUAL by Charles E. Campbell, Jr. - ----------------------------------------------------- -Author: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamily.AbizM> + ------------------------------------------------ + NETRW REFERENCE MANUAL by Charles E. Campbell + ------------------------------------------------ +Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM> (remove NOSPAM from Campbell's email first) -Copyright: Copyright (C) 1999-2012 Charles E Campbell, Jr *netrw-copyright* +Copyright: Copyright (C) 1999-2013 Charles E Campbell *netrw-copyright* The VIM LICENSE applies to the files in this package, including netrw.vim, pi_netrw.txt, netrwFileHandlers.vim, netrwSettings.vim, and syntax/netrw.vim. Like anything else that's free, netrw.vim and its @@ -25,83 +25,87 @@ Copyright: Copyright (C) 1999-2012 Charles E Campbell, Jr *netrw-copyright* ============================================================================== 1. Contents *netrw-contents* {{{1 -1. Contents.............................................|netrw-contents| -2. Starting With Netrw..................................|netrw-start| -3. Netrw Reference......................................|netrw-ref| - EXTERNAL APPLICATIONS AND PROTOCOLS................|netrw-externapp| - READING............................................|netrw-read| - WRITING............................................|netrw-write| - SOURCING...........................................|netrw-source| - DIRECTORY LISTING..................................|netrw-dirlist| - CHANGING THE USERID AND PASSWORD...................|netrw-chgup| - VARIABLES AND SETTINGS.............................|netrw-variables| - PATHS..............................................|netrw-path| -4. Network-Oriented File Transfer.......................|netrw-xfer| - NETRC..............................................|netrw-netrc| - PASSWORD...........................................|netrw-passwd| -5. Activation...........................................|netrw-activate| -6. Transparent Remote File Editing......................|netrw-transparent| -7. Ex Commands..........................................|netrw-ex| -8. Variables and Options................................|netrw-variables| -9. Browsing.............................................|netrw-browse| - Introduction To Browsing...........................|netrw-intro-browse| - Quick Reference: Maps..............................|netrw-browse-maps| - Quick Reference: Commands..........................|netrw-browse-cmds| - Bookmarking A Directory............................|netrw-mb| - Browsing...........................................|netrw-cr| - Browsing With A Horizontally Split Window..........|netrw-o| - Browsing With A New Tab............................|netrw-t| - Browsing With A Vertically Split Window............|netrw-v| - Change Listing Style.(thin wide long tree).........|netrw-i| - Changing To A Bookmarked Directory.................|netrw-gb| - Changing To A Predecessor Directory................|netrw-u| - Changing To A Successor Directory..................|netrw-U| - Customizing Browsing With A User Function..........|netrw-x| - Deleting Bookmarks.................................|netrw-mB| - Deleting Files Or Directories......................|netrw-D| - Directory Exploring Commands.......................|netrw-explore| - Exploring With Stars and Patterns..................|netrw-star| - Displaying Information About File..................|netrw-qf| - Edit File Or Directory Hiding List.................|netrw-ctrl-h| - Editing The Sorting Sequence.......................|netrw-S| - Forcing treatment as a file or directory...........|netrw-gd| |netrw-gf| - Going Up...........................................|netrw--| - Hiding Files Or Directories........................|netrw-a| - Improving Browsing.................................|netrw-ssh-hack| - Listing Bookmarks And History......................|netrw-qb| - Making A New Directory.............................|netrw-d| - Making The Browsing Directory The Current Directory|netrw-c| - Marking Files......................................|netrw-mf| - Marking Files By Regular Expression................|netrw-mr| - Marked Files: Arbitrary Command....................|netrw-mx| - Marked Files: Compression And Decompression........|netrw-mz| - Marked Files: Copying..............................|netrw-mc| - Marked Files: Diff.................................|netrw-md| - Marked Files: Editing..............................|netrw-me| - Marked Files: Grep.................................|netrw-mg| - Marked Files: Hiding and Unhiding by Suffix........|netrw-mh| - Marked Files: Moving...............................|netrw-mm| - Marked Files: Printing.............................|netrw-mp| - Marked Files: Sourcing.............................|netrw-ms| - Marked Files: Tagging..............................|netrw-mT| - Marked Files: Setting the Target Directory.........|netrw-mt| - Marked Files: Unmarking............................|netrw-mu| - Netrw Browser Variables............................|netrw-browser-var| - Netrw Browsing And Option Incompatibilities........|netrw-incompatible| - Netrw Settings Window..............................|netrw-settings-window| - Obtaining A File...................................|netrw-O| - Preview Window.....................................|netrw-p| - Previous Window....................................|netrw-P| - Refreshing The Listing.............................|netrw-ctrl-l| - Renaming Files Or Directories......................|netrw-move| - Reversing Sorting Order............................|netrw-r| - Selecting Sorting Style............................|netrw-s| - Setting Editing Window.............................|netrw-C| -10. Problems and Fixes...................................|netrw-problems| -11. Debugging Netrw Itself...............................|netrw-debug| -12. History..............................................|netrw-history| -13. Todo.................................................|netrw-todo| -14. Credits..............................................|netrw-credits| +1. Contents..............................................|netrw-contents| +2. Starting With Netrw...................................|netrw-start| +3. Netrw Reference.......................................|netrw-ref| + EXTERNAL APPLICATIONS AND PROTOCOLS.................|netrw-externapp| + READING.............................................|netrw-read| + WRITING.............................................|netrw-write| + SOURCING............................................|netrw-source| + DIRECTORY LISTING...................................|netrw-dirlist| + CHANGING THE USERID AND PASSWORD....................|netrw-chgup| + VARIABLES AND SETTINGS..............................|netrw-variables| + PATHS...............................................|netrw-path| +4. Network-Oriented File Transfer........................|netrw-xfer| + NETRC...............................................|netrw-netrc| + PASSWORD............................................|netrw-passwd| +5. Activation............................................|netrw-activate| +6. Transparent Remote File Editing.......................|netrw-transparent| +7. Ex Commands...........................................|netrw-ex| +8. Variables and Options.................................|netrw-variables| +9. Browsing..............................................|netrw-browse| + Introduction To Browsing............................|netrw-intro-browse| + Quick Reference: Maps...............................|netrw-browse-maps| + Quick Reference: Commands...........................|netrw-browse-cmds| + Bookmarking A Directory.............................|netrw-mb| + Browsing............................................|netrw-cr| + Browsing With A Horizontally Split Window...........|netrw-o| + Browsing With A New Tab.............................|netrw-t| + Browsing With A Vertically Split Window.............|netrw-v| + Change Listing Style.(thin wide long tree)..........|netrw-i| + Changing To A Bookmarked Directory..................|netrw-gb| + Changing To A Predecessor Directory.................|netrw-u| + Changing To A Successor Directory...................|netrw-U| + Customizing Browsing With A User Function...........|netrw-x| + Deleting Bookmarks..................................|netrw-mB| + Deleting Files Or Directories.......................|netrw-D| + Directory Exploring Commands........................|netrw-explore| + Exploring With Stars and Patterns...................|netrw-star| + Displaying Information About File...................|netrw-qf| + Edit File Or Directory Hiding List..................|netrw-ctrl-h| + Editing The Sorting Sequence........................|netrw-S| + Forcing treatment as a file or directory............|netrw-gd| |netrw-gf| + Going Up............................................|netrw--| + Hiding Files Or Directories.........................|netrw-a| + Improving Browsing..................................|netrw-ssh-hack| + Listing Bookmarks And History.......................|netrw-qb| + Making A New Directory..............................|netrw-d| + Making The Browsing Directory The Current Directory.|netrw-c| + Marking Files.......................................|netrw-mf| + Unmarking Files.....................................|netrw-mF| + Marking Files By QuickFix List......................|netrw-qF| + Marking Files By Regular Expression.................|netrw-mr| + Marked Files: Arbitrary Command.....................|netrw-mx| + Marked Files: Compression And Decompression.........|netrw-mz| + Marked Files: Copying...............................|netrw-mc| + Marked Files: Diff..................................|netrw-md| + Marked Files: Editing...............................|netrw-me| + Marked Files: Grep..................................|netrw-mg| + Marked Files: Hiding and Unhiding by Suffix.........|netrw-mh| + Marked Files: Moving................................|netrw-mm| + Marked Files: Printing..............................|netrw-mp| + Marked Files: Sourcing..............................|netrw-ms| + Marked Files: Setting the Target Directory..........|netrw-mt| + Marked Files: Tagging...............................|netrw-mT| + Marked Files: Target Directory Using Bookmarks......|netrw-Tb| + Marked Files: Target Directory Using History........|netrw-Th| + Marked Files: Unmarking.............................|netrw-mu| + Netrw Browser Variables.............................|netrw-browser-var| + Netrw Browsing And Option Incompatibilities.........|netrw-incompatible| + Netrw Settings Window...............................|netrw-settings-window| + Obtaining A File....................................|netrw-O| + Preview Window......................................|netrw-p| + Previous Window.....................................|netrw-P| + Refreshing The Listing..............................|netrw-ctrl-l| + Reversing Sorting Order.............................|netrw-r| + Renaming Files Or Directories.......................|netrw-R| + Selecting Sorting Style.............................|netrw-s| + Setting Editing Window..............................|netrw-C| +10. Problems and Fixes....................................|netrw-problems| +11. Debugging Netrw Itself................................|netrw-debug| +12. History...............................................|netrw-history| +13. Todo..................................................|netrw-todo| +14. Credits...............................................|netrw-credits| {Vi does not have any of this} @@ -142,7 +146,7 @@ and has lines resembling > < Windows' ftp doesn't support .netrc; however, one may have in one's .vimrc: > - let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\Myself\MACHINE' + let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\Myself\MACHINE' < Netrw will substitute the host's machine name for MACHINE from the url it is attempting to open, and so one may specify > @@ -282,7 +286,7 @@ SOURCING *netrw-source* {{{2 :Nsource "scp://[user@]machine[[:#]port]/path" uses scp :Nsource "sftp://[user@]machine/path" uses sftp -DIRECTORY LISTING *netrw-trailingslash* *netrw-dirlist* {{{2 +DIRECTORY LISTING *netrw-trailingslash* *netrw-dirlist* {{{2 One may browse a directory to get a listing by simply attempting to edit the directory: > @@ -538,8 +542,8 @@ netrw will substitute the current machine name requested for ftp connections for MACHINE. Hence one can have multiple machine.ftp files containing login and password for ftp. Example: > - let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\Myself\MACHINE' - vim ftp://myhost.somewhere.net/ + let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\Myself\MACHINE' + vim ftp://myhost.somewhere.net/ will use a file > C:\Users\Myself\myhost.ftp < @@ -1086,8 +1090,8 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 <2-leftmouse> (gvim only) when: * in a netrw-selected file, AND * |g:netrw_retmap| == 1 AND - * the user doesn't already have a <2-leftmouse> mapping - defined before netrw is autoloaded, + * the user doesn't already have a <2-leftmouse> + mapping defined before netrw is autoloaded, then a double clicked leftmouse button will return to the netrw browser window. See |g:netrw_retmap|. <s-leftmouse> (gvim only) like mf, will mark files @@ -1183,17 +1187,18 @@ cursor at the top. Associated setting variables: |g:netrw_alto| |g:netrw_winsize| -Related Actions |netrw-cr| |netrw-p| |netrw-t| |netrw-T| |netrw-v| +Related Actions |netrw-cr| |netrw-p| |netrw-t| |netrw-v| Associated setting variables: |g:netrw_alto| control above/below splitting |g:netrw_winsize| control initial sizing -BROWSING WITH A NEW TAB *netrw-t* *netrw-T* {{{2 +BROWSING WITH A NEW TAB *netrw-t* Normally one enters a file or directory using the <cr>. The "t" map allows one to open a new window holding the new directory listing or file in -a new tab. The "T" version puts the file or directory into a background tab -(see |gT|) +a new tab. + +If you'd like to have the new listing in a background tab, use |gT|. Related Actions |netrw-cr| |netrw-o| |netrw-p| |netrw-v| Associated setting variables: @@ -1213,7 +1218,7 @@ will split the screen, but the same buffer will be shown twice. Associated setting variable: |g:netrw_altv| |g:netrw_winsize| -Related Actions |netrw-cr| |netrw-o| |netrw-t| |netrw-T| |netrw-v| +Related Actions |netrw-cr| |netrw-o| |netrw-t| |netrw-v| Associated setting variables: |g:netrw_altv| control right/left splitting |g:netrw_winsize| control initial sizing @@ -1276,6 +1281,8 @@ To change directory back to a bookmarked directory, use {cnt}gb Any count may be used to reference any of the bookmarks. +Note that |netrw-qb| shows both bookmarks and history; to go +to a location stored in the history see |netrw-u| and |netrw-U|. Related Topics: |netrw-mB| how to delete bookmarks @@ -1291,6 +1298,13 @@ list (unless |g:netrw_dirhistmax| is zero; by default, it's ten). With the "u" map, one can change to an earlier directory (predecessor). To do 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. + +See |g:netrw_dirhistmax| for how to control the quantity of history stack +slots. + CHANGING TO A SUCCESSOR DIRECTORY *netrw-U* *netrw-downdir* {{{2 @@ -1298,6 +1312,11 @@ 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|) +The "U" map also accepts counts to go forward in the history several slots. + +See |g:netrw_dirhistmax| for how to control the quantity of history stack +slots. + NETRW CLEAN *netrw-clean* *:NetrwClean* @@ -1674,7 +1693,7 @@ As a quick shortcut, one may press > to toggle between hiding files which begin with a period (dot) and not hiding them. -Associated setting variable: |g:netrw_list_hide| +Associated setting variable: |g:netrw_list_hide| |g:netrw_hide| Associated topics: |netrw-a| |netrw-ctrl-h| |netrw-mh| IMPROVING BROWSING *netrw-listhack* *netrw-ssh-hack* {{{2 @@ -1785,9 +1804,10 @@ Associated setting variables: |g:netrw_localmkdir| |g:netrw_mkdir_cmd| MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-c* {{{2 By default, |g:netrw_keepdir| is 1. This setting means that the current -directory will not track the browsing directory. +directory will not track the browsing directory. (done for backwards +compatibility with v6's file explorer). -Setting g:netrw_keepdir to 0 tells netrw to make vim's current directory to +Setting g:netrw_keepdir to 0 tells netrw to make vim's current directory track netrw's browsing directory. However, given the default setting for g:netrw_keepdir of 1 where netrw @@ -1810,6 +1830,7 @@ maps make use of marked files: |netrw-mc| Copy marked files to target |netrw-md| Apply vimdiff to marked files |netrw-me| Edit marked files + |netrw-mF| Unmark marked files |netrw-mg| Apply vimgrep to marked files |netrw-mm| Move marked files |netrw-mp| Print marked files @@ -1817,6 +1838,7 @@ maps make use of marked files: |netrw-mT| Generate tags using marked files |netrw-mx| Apply shell command to marked files |netrw-mz| Compress/Decompress marked files + |netrw-qF| Mark files using quickfix list |netrw-O| Obtain marked files |netrw-R| Rename marked files @@ -1844,6 +1866,22 @@ commands which operate on marked files use one or the other of the marked file lists. +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. + + +MARKING FILES BY QUICKFIX LIST *netrw-qF* + (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|. + + MARKING FILES BY REGULAR EXPRESSION *netrw-mr* {{{2 (also see |netrw-mf|) @@ -1902,17 +1940,27 @@ MARKED FILES: EDITING *netrw-me* {{{2 This 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) 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 command will ask -for the requested pattern; one may enter: > +This 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 +desried contents-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) @@ -1958,6 +2006,36 @@ MARKED FILES: SOURCING *netrw-ms* {{{2 Netrw will source the marked files (using vim's |:source| command) +MARKED FILES: SETTING THE TARGET DIRECTORY *netrw-mt* {{{2 + (See |netrw-mf| and |netrw-mr| for how to mark files) + +Set the marked file copy/move-to target (see |netrw-mc| and |netrw-mm|): + + * If the cursor is atop a file name, then the netrw window's currently + displayed directory is used for the copy/move-to target. + + * Also, if the cursor is in the banner, then the netrw window's currently + displayed directory is used for the copy/move-to target. + Unless the target already is the current directory. In which case, + remove the target. + + * However, if the cursor is atop a directory name, then that directory is + used for the copy/move-to target + +There is only one copy/move-to target per vim session; ie. the target is a +script variable (see |s:var|) and is shared between all netrw windows (in an +instance of vim). + +When using menus and gvim, netrw provides a "Targets" entry which allows one +to pick a target from the list of bookmarks and history. + +Related topics: + Marking Files......................................|netrw-mf| + Marking Files by Regular Expression................|netrw-mr| + Marked Files: Target Directory Using Bookmarks.....|netrw-Tb| + Marked Files: Target Directory Using History.......|netrw-Th| + + MARKED FILES: TAGGING *netrw-mT* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the global marked file list) @@ -1983,24 +2061,37 @@ edit the desired file and go to the tag. Associated setting variables: |g:netrw_ctags| |g:netrw_ssh_cmd| +MARKED FILES: TARGET DIRECTORY USING BOOKMARKS *netrw-Tb* {{{2 -MARKED FILES: SETTING THE TARGET DIRECTORY *netrw-mt* {{{2 - (See |netrw-mf| and |netrw-mr| for how to mark files) +Sets the marked file copy/move-to target (see |netrw-mc| and |netrw-mm|). -Set the marked file copy/move-to target (see |netrw-mc| and |netrw-mm|): +The |netrw-qb| map will give you a list of bookmarks (and history). +One may choose one of the bookmarks to become your marked file +target by using [count]Tb (default count: 1). - * if the cursor is atop a file name, then the netrw window's currently - displayed directory is used for the copy/move-to target. +Related topics: + Listing Bookmarks and History......................|netrw-qb| + Marked Files: Setting The Target Directory.........|netrw-mt| + Marked Files: Target Directory Using History.......|netrw-Th| + Marking Files......................................|netrw-mf| + Marking Files by Regular Expression................|netrw-mr| - * also, if the cursor is in the banner, then the netrw window's currently - displayed directory is used for the copy/move-to target. - * however, if the cursor is atop a directory name, then that directory is - used for the copy/move-to target +MARKED FILES: TARGET DIRECTORY USING HISTORY *netrw-Th* {{{2 + +Sets the marked file copy/move-to target (see |netrw-mc| and |netrw-mm|). + +The |netrw-qb| map will give you a list of history (and bookmarks). +One may choose one of the history entries to become your marked file +target by using [count]Th (default count: 0; ie. the current directory). + +Related topics: + Listing Bookmarks and History......................|netrw-qb| + Marked Files: Setting The Target Directory.........|netrw-mt| + Marked Files: Target Directory Using Bookmarks.....|netrw-Tb| + Marking Files......................................|netrw-mf| + Marking Files by Regular Expression................|netrw-mr| -There is only one copy/move-to target per vim session; ie. the target is a -script variable (see |s:var|) and is shared between all netrw windows (in an -instance of vim). MARKED FILES: UNMARKING *netrw-mu* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) @@ -2020,21 +2111,21 @@ your browsing preferences. (see also: |netrw-settings|) --- ----------- Var Explanation --- ----------- -< *g:netrw_alto* change from above splitting to below splitting +< *g:netrw_alto* change from above splitting to below splitting by setting this variable (see |netrw-o|) default: =&sb (see |'sb'|) - *g:netrw_altv* change from left splitting to right splitting + *g:netrw_altv* change from left splitting to right splitting by setting this variable (see |netrw-v|) default: =&spr (see |'spr'|) - *g:netrw_banner* enable/suppress the banner + *g:netrw_banner* enable/suppress the banner =0: suppress the banner =1: banner is enabled (default) NOTE: suppressing the banner is a new feature which may cause problems. - *g:netrw_browse_split* when browsing, <cr> will open the file by: + *g:netrw_browse_split* when browsing, <cr> will open the file by: =0: re-using the same window =1: horizontally splitting the window first =2: vertically splitting the window first @@ -2044,7 +2135,7 @@ your browsing preferences. (see also: |netrw-settings|) to get vertical splitting instead of horizontal splitting. - *g:netrw_browsex_viewer* specify user's preference for a viewer: > + *g:netrw_browsex_viewer* specify user's preference for a viewer: > "kfmclient exec" "gnome-open" < If > @@ -2053,15 +2144,15 @@ your browsing preferences. (see also: |netrw-settings|) a script/function to handle the given extension. (see |netrw_filehandler|). - *g:netrw_chgperm* Unix/Linux: "chmod PERM FILENAME" + *g:netrw_chgperm* Unix/Linux: "chmod PERM FILENAME" Windows: "cacls FILENAME /e /p PERM" Used to change access permission for a file. - *g:netrw_compress* ="gzip" + *g:netrw_compress* ="gzip" Will compress marked files with this command - *g:Netrw_corehandler* Allows one to specify something additional + *g:Netrw_corehandler* Allows one to specify something additional to do when handling <core> files via netrw's browser's "x" command (see |netrw-x|). If present, g:Netrw_corehandler specifies @@ -2070,10 +2161,11 @@ your browsing preferences. (see also: |netrw-settings|) is required its holding a function reference) - *g:netrw_ctags* ="ctags" - The default external program used to create tags + *g:netrw_ctags* ="ctags" + The default external program used to create + tags - *g:netrw_cursor* = 2 (default) + *g:netrw_cursor* = 2 (default) This option controls the use of the |'cursorline'| (cul) and |'cursorcolumn'| (cuc) settings by netrw: @@ -2091,7 +2183,7 @@ your browsing preferences. (see also: |netrw-settings|) cul : |'cursorline'| locally set cuc : |'cursorcolumn'| locally set - *g:netrw_decompress* = { ".gz" : "gunzip" , + *g:netrw_decompress* = { ".gz" : "gunzip" , ".bz2" : "bunzip2" , ".zip" : "unzip" , ".tar" : "tar -xf"} @@ -2112,7 +2204,7 @@ your browsing preferences. (see also: |netrw-settings|) 1: warnings 2: errors - *g:netrw_fastbrowse* =0: slow speed directory browsing; + *g:netrw_fastbrowse* =0: slow speed directory browsing; never re-uses directory listings, always obtains directory listings. =1: medium speed directory browsing; @@ -2136,10 +2228,10 @@ your browsing preferences. (see also: |netrw-settings|) trading off accuracy (ie. up-to-date listing) versus speed. - *g:netrw_fname_escape* =' ?&;%' + *g:netrw_fname_escape* =' ?&;%' Used on filenames before remote reading/writing - *g:netrw_ftp_browse_reject* ftp can produce a number of errors and warnings + *g:netrw_ftp_browse_reject* ftp can produce a number of errors and warnings that can show up as "directories" and "files" in the listing. This pattern is used to remove such embedded messages. By default its @@ -2152,19 +2244,19 @@ your browsing preferences. (see also: |netrw-settings|) : connect to address [0-9a-fA-F:]* : No route to host$' - *g:netrw_ftp_list_cmd* options for passing along to ftp for directory + *g:netrw_ftp_list_cmd* options for passing along to ftp for directory listing. Defaults: unix or g:netrw_cygwin set: : "ls -lF" otherwise "dir" - *g:netrw_ftp_sizelist_cmd* options for passing along to ftp for directory + *g:netrw_ftp_sizelist_cmd* options for passing along to ftp for directory listing, sorted by size of file. Defaults: unix or g:netrw_cygwin set: : "ls -slF" otherwise "dir" - *g:netrw_ftp_timelist_cmd* options for passing along to ftp for directory + *g:netrw_ftp_timelist_cmd* options for passing along to ftp for directory listing, sorted by time of last modification. Defaults: unix or g:netrw_cygwin set: : "ls -tlF" @@ -2175,61 +2267,64 @@ your browsing preferences. (see also: |netrw-settings|) These characters in directory names are escaped before applying glob() - *g:netrw_hide* if true, the hiding list is used + *g:netrw_hide* Controlled by the "a" map (see |netrw-a|) + =0 : show all + =1 : show not-hidden files + =2 : show hidden files only default: =0 - *g:netrw_home* The home directory for where bookmarks and + *g:netrw_home* The home directory for where bookmarks and history are saved (as .netrwbook and .netrwhist). default: the first directory on the |'runtimepath'| - *g:netrw_keepdir* =1 (default) keep current directory immune from + *g:netrw_keepdir* =1 (default) keep current directory immune from the browsing directory. =0 keep the current directory the same as the browsing directory. The current browsing directory is contained in b:netrw_curdir (also see |netrw-c|) - *g:netrw_list_cmd* command for listing remote directories + *g:netrw_list_cmd* command for listing remote directories default: (if ssh is executable) "ssh HOSTNAME ls -FLa" - *g:netrw_liststyle* Set the default listing style: + *g:netrw_liststyle* Set the default listing style: = 0: thin listing (one file per line) = 1: long listing (one file per line with time stamp information and file size) = 2: wide listing (multiple files in columns) = 3: tree style listing - *g:netrw_list_hide* comma separated pattern list for hiding files + *g:netrw_list_hide* comma separated pattern list for hiding files Patterns are regular expressions (see |regexp|) Example: let g:netrw_list_hide= '.*\.swp$' default: "" - *g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin + *g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin ="copy" Windows Copies marked files (|netrw-mf|) to target directory (|netrw-mt|, |netrw-mc|) - *g:netrw_localmovecmd* ="mv" Linux/Unix/MacOS/Cygwin + *g:netrw_localmovecmd* ="mv" Linux/Unix/MacOS/Cygwin ="move" Windows Moves marked files (|netrw-mf|) to target directory (|netrw-mt|, |netrw-mm|) - *g:netrw_localmkdir* command for making a local directory + *g:netrw_localmkdir* command for making a local directory default: "mkdir" - *g:netrw_localrmdir* remove directory command (rmdir) + *g:netrw_localrmdir* remove directory command (rmdir) default: "rmdir" - *g:netrw_maxfilenamelen* =32 by default, selected so as to make long + *g:netrw_maxfilenamelen* =32 by default, selected so as to make long listings fit on 80 column displays. If your screen is wider, and you have file or directory names longer than 32 bytes, you may set this option to keep listings columnar. - *g:netrw_mkdir_cmd* command for making a remote directory + *g:netrw_mkdir_cmd* command for making a remote directory via ssh (also see |g:netrw_remote_mkdir|) default: "ssh USEPORT HOSTNAME mkdir" @@ -2246,11 +2341,11 @@ your browsing preferences. (see also: |netrw-settings|) evaluation will be suppressed (see |'ballooneval'|) - *g:netrw_remote_mkdir* command for making a local directory + *g:netrw_remote_mkdir* command for making a local directory via ftp (also see |g:netrw_mkdir_cmd|) default: "mkdir" - *g:netrw_retmap* if it exists and is set to one, then: + *g:netrw_retmap* if it exists and is set to one, then: * if in a netrw-selected file, AND * no normal-mode <2-leftmouse> mapping exists, then the <2-leftmouse> will be mapped for easy @@ -2269,22 +2364,22 @@ your browsing preferences. (see also: |netrw-settings|) default: =0 - *g:netrw_rm_cmd* command for removing files + *g:netrw_rm_cmd* command for removing files default: "ssh USEPORT HOSTNAME rm" - *g:netrw_rmdir_cmd* command for removing directories + *g:netrw_rmdir_cmd* command for removing directories default: "ssh USEPORT HOSTNAME rmdir" - *g:netrw_rmf_cmd* command for removing softlinks + *g:netrw_rmf_cmd* command for removing softlinks default: "ssh USEPORT HOSTNAME rm -f" - *g:netrw_sort_by* sort by "name", "time", or "size" + *g:netrw_sort_by* sort by "name", "time", or "size" default: "name" - *g:netrw_sort_direction* sorting direction: "normal" or "reverse" + *g:netrw_sort_direction* sorting direction: "normal" or "reverse" default: "normal" - *g:netrw_sort_options* sorting is done using |:sort|; this + *g:netrw_sort_options* sorting is done using |:sort|; this variable's value is appended to the sort command. Thus one may ignore case, for example, with the following in your @@ -2292,14 +2387,14 @@ your browsing preferences. (see also: |netrw-settings|) let g:netrw_sort_options="i" < default: "" - *g:netrw_sort_sequence* when sorting by name, first sort by the + *g:netrw_sort_sequence* when sorting by name, first sort by the comma-separated pattern sequence. Note that the filigree added to indicate filetypes should be accounted for in your pattern. default: '[\/]$,*,\.bak$,\.o$,\.h$, \.info$,\.swp$,\.obj$' - *g:netrw_special_syntax* If true, then certain files will be shown + *g:netrw_special_syntax* If true, then certain files will be shown using special syntax in the browser: netrwBak : *.bak @@ -2321,12 +2416,12 @@ your browsing preferences. (see also: |netrw-settings|) < into one's <.vimrc> to use one's own preferences. - *g:netrw_ssh_cmd* One may specify an executable command + *g:netrw_ssh_cmd* One may specify an executable command to use instead of ssh for remote actions such as listing, file removal, etc. default: ssh - *g:netrw_ssh_browse_reject* ssh can sometimes produce unwanted lines, + *g:netrw_ssh_browse_reject* ssh can sometimes produce unwanted lines, messages, banners, and whatnot that one doesn't want masquerading as "directories" and "files". Use this pattern to remove such embedded @@ -2334,11 +2429,11 @@ your browsing preferences. (see also: |netrw-settings|) '^total\s\+\d\+$' - *g:netrw_tmpfile_escape* =' &;' + *g:netrw_tmpfile_escape* =' &;' escape() is applied to all temporary files to escape these characters. - *g:netrw_timefmt* specify format string to vim's strftime(). + *g:netrw_timefmt* specify format string to vim's strftime(). The default, "%c", is "the preferred date and time representation for the current locale" according to my manpage entry for @@ -2348,7 +2443,7 @@ your browsing preferences. (see also: |netrw-settings|) " %a %Y-%m-%d %I-%M-%S %p" default: "%c" - *g:netrw_use_noswf* netrw normally avoids writing swapfiles + *g:netrw_use_noswf* netrw normally avoids writing swapfiles for browser buffers. However, under some systems this apparently is causing nasty ml_get errors to appear; if you're getting @@ -2356,7 +2451,7 @@ your browsing preferences. (see also: |netrw-settings|) let g:netrw_use_noswf= 0 in your .vimrc. - *g:netrw_winsize* specify initial size of new windows made with + *g:netrw_winsize* specify initial size of new windows made with "o" (see |netrw-o|), "v" (see |netrw-v|), |:Hexplore| or |:Vexplore|. The g:netrw_winsize is an integer describing the percentage of the @@ -2367,7 +2462,7 @@ your browsing preferences. (see also: |netrw-settings|) or columns will be used for the new window. default: 50 (for 50%) - *g:netrw_xstrlen* Controls how netrw computes string lengths, + *g:netrw_xstrlen* Controls how netrw computes string lengths, including multi-byte characters' string length. (thanks to N Weibull, T Mechelynck) =0: uses Vim's built-in strlen() @@ -2383,7 +2478,7 @@ your browsing preferences. (see also: |netrw-settings|) immediately preceded by lam, one otherwise, etc) - *g:NetrwTopLvlMenu* This variable specifies the top level + *g:NetrwTopLvlMenu* This variable specifies the top level menu name; by default, it's "Netrw.". If you wish to change this, do so in your .vimrc. @@ -2483,7 +2578,7 @@ has been modified, and there's only one window with that buffer, then the user will be asked if s/he wishes to save the buffer first (yes, no, or cancel). -Related Actions |netrw-cr| |netrw-o| |netrw-t| |netrw-T| |netrw-v| +Related Actions |netrw-cr| |netrw-o| |netrw-t| |netrw-v| Associated setting variables: |g:netrw_alto| control above/below splitting |g:netrw_altv| control right/left splitting @@ -2498,6 +2593,15 @@ hit the <cr> when atop the ./ directory entry in the listing. One may also refresh a local directory by using ":e .". +REVERSING SORTING ORDER *netrw-r* *netrw-reverse* {{{2 + +One may toggle between normal and reverse sorting order by pressing the +"r" key. + +Related topics: |netrw-s| +Associated setting variable: |g:netrw_sort_direction| + + RENAMING FILES OR DIRECTORIES *netrw-move* *netrw-rename* *netrw-R* {{{2 If there are no marked files: (see |netrw-mf|) @@ -2528,15 +2632,6 @@ One may rename a block of files and directories by selecting them with the V (|linewise-visual|). -REVERSING SORTING ORDER *netrw-r* *netrw-reverse* {{{2 - -One may toggle between normal and reverse sorting order by pressing the -"r" key. - -Related topics: |netrw-s| -Associated setting variable: |g:netrw_sort_direction| - - SELECTING SORTING STYLE *netrw-s* *netrw-sort* {{{2 One may select the sorting style by name, time, or (file) size. The "s" map @@ -2620,9 +2715,9 @@ Associated setting variables: |g:netrw_chgwin| P5. My times come up oddly in local browsing Does your system's strftime() accept the "%c" to yield dates - such as "Sun Apr 27 11:49:23 1997"? If not, do a "man strftime" - and find out what option should be used. Then put it into - your |.vimrc|: > + such as "Sun Apr 27 11:49:23 1997"? If not, do a + "man strftime" and find out what option should be used. Then + put it into your |.vimrc|: > let g:netrw_timefmt= "%X" (where X is the option) < @@ -2895,6 +2990,57 @@ which is loaded automatically at startup (assuming :set nocp). ============================================================================== 12. History *netrw-history* {{{1 + v148: Apr 16, 2013 * changed Netrw's Style menu to allow direct + choice of listing style, hiding style, and + sorting style + v147: Nov 24, 2012 * (James McCoy) Even with g:netrw_dirhistmax + at zero, the .vim/ directory would be + created to support history/bookmarks. I've + gone over netrw to suppress history and + bookmarking when g:netrw_dirhistmax is zero. + For instance, the menus will display + (disabled) when attempts to use + bookmarks/history are made. + Nov 29, 2012 * (Kim Jang-hwan) reported that with + g:Align_xstrlen set to 3 that the cursor was + moved (linewise) after invocation. This + problem also afflicted netrw. + (see |g:netrw_xstrlen|) Fixed. + Jan 21, 2013 * (mattn) provided a patch to insert some + endifs needed with the code implementing + |netrw-O|. + Jan 24, 2013 * (John Szakmeister) found that remote file + editing resulted in filetype options being + overwritten by NetrwOptionRestore(). I + moved filetype detect from NetrwGetFile() + to NetrwOptionRestore. + Feb 17, 2013 * (Yukhiro Nakadaira) provided a patch + correcting some syntax errors. + Feb 28, 2013 * (Ingo Karkat) provided a patch preventing + receipt of an |E95| when revisiting a + file://... style url. + Mar 18, 2013 * (Gary Johnson) pointed out that changing + cedit to <Esc> caused problems with visincr; + the cedit setting is now bypassed in netrw too. + Apr 02, 2013 * (Paul Domaskis) reported an undefined + variable error (s:didstarstar) was + occurring. It is now defined at + initialization. + * included additional sanity checking for the + marked file functions. + * included |netrw-qF| and special "j" option + handling for |netrw-mg| + Apr 12, 2013 * |netrw-u| and |netrw-U| now handle counts + * the former mapping for "T" has been removed; + in its place are new maps, |netrw-Tb| and |netrw-Th|. + * the menu now supports a "Targets" entry for + easier target selection. (see |netrw-mt|) + * (Paul Domaskis) reported some problems with + moving/copying files under Windows' gvim + (ie. not cygwin). Fixed. + * (Paul Mueller) provided a patch to get + start and rundll working via |netrw-gx| + by bypassing the user's |'shellslash'| option. v146: Oct 20, 2012 * (David Kotchan) reported that under Windows, directories named with unusual characters such as "#" or "$" were not being listed @@ -2904,6 +3050,10 @@ which is loaded automatically at startup (assuming :set nocp). Netrw will now |:bwipe| netrw buffers upon editing a file if g:netrw_fastbrowse is zero and its not in tree listing style. + * fixed a bug with s:NetrwInit() that + prevented initialization with |Lists| and + |Dictionaries|. + * |netrw-mu| now unmarks marked-file lists v145: Apr 05, 2012 * moved some command from a g:netrw_local_... format to g:netwr_local... format * included some NOTE level messages about diff --git a/runtime/doc/pi_tar.txt b/runtime/doc/pi_tar.txt index 1ff4d7c4c..ad23413c6 100644 --- a/runtime/doc/pi_tar.txt +++ b/runtime/doc/pi_tar.txt @@ -1,10 +1,10 @@ -*pi_tar.txt* For Vim version 7.3. Last change: 2012 Jan 17 +*pi_tar.txt* For Vim version 7.3. Last change: 2013 Apr 17 +====================+ | Tar File Interface | +====================+ -Author: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamily.AbizM> +Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM> (remove NOSPAM from Campbell's email first) Copyright 2005-2012: *tar-copyright* The VIM LICENSE (see |copyright|) applies to the files in this @@ -50,6 +50,21 @@ Copyright 2005-2012: *tar-copyright* *g:tar_extractcmd* , which by default is > "tar -xf" < + *:TarDiff* + DIFFERENCING SUPPORT~ + + :TarDiff [filename] + + This command will attempt to show the differences between the tarball + version of a file and the associated file on the system. In order to + find that file on the system, the script uses the path associated with + the file mentioned in the tarball. If the current directory is not + correct for that path, :TarDiff will fail to find the associated file. + + If the [filename] is given, that that filename (and path) will be used + to specify the associated file. + + PREVENTING LOADING~ If for some reason you do not wish to use vim to examine tar'd files, diff --git a/runtime/doc/pi_zip.txt b/runtime/doc/pi_zip.txt index d976055ea..e72d981ce 100644 --- a/runtime/doc/pi_zip.txt +++ b/runtime/doc/pi_zip.txt @@ -1,12 +1,12 @@ -*pi_zip.txt* For Vim version 7.3. Last change: 2012 Jan 17 +*pi_zip.txt* For Vim version 7.3. Last change: 2013 Apr 17 +====================+ | Zip File Interface | +====================+ -Author: Charles E. Campbell, Jr. <NdrOchip@ScampbellPfamily.AbizM> +Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM> (remove NOSPAM from Campbell's email first) -Copyright: Copyright (C) 2005-2011 Charles E Campbell, Jr *zip-copyright* +Copyright: Copyright (C) 2005-2012 Charles E Campbell *zip-copyright* The VIM LICENSE (see |copyright|) applies to the files in this package, including zipPlugin.vim, zip.vim, and pi_zip.vim. except use "zip.vim" instead of "VIM". Like anything else that's free, zip.vim @@ -85,8 +85,13 @@ Copyright: Copyright (C) 2005-2011 Charles E Campbell, Jr *zip-copyright* ============================================================================== 4. History *zip-history* {{{1 + v26 Nov 15, 2012 * (Jason Spiro) provided a lot of new extensions that + are synonyms for .zip v25 Jun 27, 2011 * using keepj with unzip -Z (consistent with the -p variant) + * (Ben Staniford) now uses + has("win32unix") && executable("cygpath") + before converting to cygwin-style paths v24 Jun 21, 2010 * (Cédric Bosdonnat) unzip seems to need its filenames fnameescape'd as well as shellquote'd * (Motoya Kurotsu) inserted keepj before 0d to protect diff --git a/runtime/doc/tags b/runtime/doc/tags index 4db1f5ef1..c9b714077 100644 --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -1834,6 +1834,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME* :RmVimball pi_vimball.txt /*:RmVimball* :Sexplore pi_netrw.txt /*:Sexplore* :TOhtml syntax.txt /*:TOhtml* +:TarDiff pi_tar.txt /*:TarDiff* :Texplore pi_netrw.txt /*:Texplore* :UseVimball pi_vimball.txt /*:UseVimball* :Vexplore pi_netrw.txt /*:Vexplore* @@ -6862,7 +6863,8 @@ netrw-O pi_netrw.txt /*netrw-O* netrw-P pi_netrw.txt /*netrw-P* netrw-R pi_netrw.txt /*netrw-R* netrw-S pi_netrw.txt /*netrw-S* -netrw-T pi_netrw.txt /*netrw-T* +netrw-Tb pi_netrw.txt /*netrw-Tb* +netrw-Th pi_netrw.txt /*netrw-Th* netrw-U pi_netrw.txt /*netrw-U* netrw-X pi_netrw.txt /*netrw-X* netrw-a pi_netrw.txt /*netrw-a* @@ -6931,6 +6933,7 @@ netrw-listbookmark pi_netrw.txt /*netrw-listbookmark* netrw-listhack pi_netrw.txt /*netrw-listhack* netrw-login pi_netrw.txt /*netrw-login* netrw-mB pi_netrw.txt /*netrw-mB* +netrw-mF pi_netrw.txt /*netrw-mF* netrw-mT pi_netrw.txt /*netrw-mT* netrw-mb pi_netrw.txt /*netrw-mb* netrw-mc pi_netrw.txt /*netrw-mc* @@ -6985,6 +6988,7 @@ netrw-prvwin pi_netrw.txt /*netrw-prvwin* netrw-pscp pi_netrw.txt /*netrw-pscp* netrw-psftp pi_netrw.txt /*netrw-psftp* netrw-putty pi_netrw.txt /*netrw-putty* +netrw-qF pi_netrw.txt /*netrw-qF* netrw-qb pi_netrw.txt /*netrw-qb* netrw-qf pi_netrw.txt /*netrw-qf* netrw-quickcom pi_netrw.txt /*netrw-quickcom* @@ -7328,7 +7332,9 @@ python-input if_pyth.txt /*python-input* python-output if_pyth.txt /*python-output* python-pyeval if_pyth.txt /*python-pyeval* python-range if_pyth.txt /*python-range* +python-vars if_pyth.txt /*python-vars* python-vim if_pyth.txt /*python-vim* +python-vvars if_pyth.txt /*python-vvars* python-window if_pyth.txt /*python-window* python-windows if_pyth.txt /*python-windows* python.vim syntax.txt /*python.vim* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt index 2774864d7..8381e6b5f 100644 --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 7.3. Last change: 2013 Apr 12 +*todo.txt* For Vim version 7.3. Last change: 2013 Apr 24 VIM REFERENCE MANUAL by Bram Moolenaar @@ -39,8 +39,6 @@ highlight group. Add a "\zs" after it? Go through more coverity reports. -Valgrind errors in test 16. - Discussion about canonicalization of Hebrew. (Ron Aaron, 2011 April 10) Checking runtime scripts: Thilo Six, 2012 Jun 6. @@ -59,16 +57,14 @@ That is, calling a dictionary function on an autoloaded dict. Works OK for echo, just not for ":call" and ":call call()". (Ted, 2011 Mar 17) Patch by Christian Brabandt, 2013 Mar 23. - -Patch to make building with Ruby 2.0 on 64 bit system work. (eagletmt (Kohei -Suzuki), 2013 Mar 25) +Not 100% sure this is the right solution. Win32: When a directory name contains an exclamation mark, completion doesn't complete the contents of the directory. No escaping for the "!"? (Jan Stocker, 2012 Jan 5) -Patch to avoid that visul motion breaks repeat with ".". (Sung Pae, 2013 Mar -25) +Patch to load ~/.vim/vimrc when ~/.vimrc isn't found. (Lech Lorens, 2013 Apr +13) Problem caused by patch 7.3.638: window->open does not update window correctly. Issue 91. @@ -87,22 +83,31 @@ Patch to support 'u' in interactive substitute. (Christian Brabandt, 2012 Sep Patch to make fold updates much faster. (Christian Brabandt, 2012 Dec) -Patch to add more testing for Visual operators. (glts, 2013 Mar 28) - Patch for IME handling, adds 'imactivatefunc' and 'imstatusfunc' option. (Yukihiro Nakadaira, 2012 Aug 16) Patch to improve IME handling. (Yasuhiro Matsumoto, 2012 Jul 18) +Undo problem: line not removed as expected when using setline() from Insert +mode. (Israel Chauca, 2010 May 13, more in second msg) +Break undo when CTRL-R = changes the text? Or save more lines? +Patch by Christian Brabandt, 2012 Nov 16. + Issue 54: document behavior of -complete, also expands arg. Matches might be highlighted correctly. Inefficient patch by Christian Brabandt, 2013 Feb 26. -New syntax files for apt. (quidame, 2012 Sep 21) +- Add regex for 'paragraphs' and 'sections': 'parare' and 'sectre'. Combine + the two into a regex for searching. (Ned Konz) +Patch by Christian Brabandt, 2013 Apr 20, unfinished. Patch to use bold/italic fonts when 'guifontewide' is set. (Ken Takata, 2013 Mar 31) +Patch to fix finding toolbar bitmaps. Issue 129. + +Patch to handle Python SystemExit. (Yasuhiro Matsumoto, 2013 Apr 15) + v:register is not directly reset to " after a delete command that specifies a register. It is reset after the next command. (Steve Vermeulen, 2013 Mar 16) @@ -116,15 +121,8 @@ Patch to check if 'foldexpr' sets did_emsg. (Christian Brabandt, 2013 Mar 20) Patch to set antialiasing style on Windows. (Ondrej Balaz, 2013 Mar 14) Needs a different check for CLEARTYPE_QUALITY. -Patch for repeating change that uses ":normal". (glts, 2013 March 23) - Issue 72: 'autochdir' causes problems for :vimgrep. -Undo problem: line not removed as expected when using setline() from Insert -mode. (Israel Chauca, 2010 May 13, more in second msg) -Break undo when CTRL-R = changes the text? Or save more lines? -Patch by Christian Brabandt, 2012 Nov 16. - In the ATTENTION message about an existing swap file, mention the name of the process that is running. It might actually be some other program, e.g. after a reboot. @@ -177,6 +175,9 @@ Patch to improve equivalence classes in regexp patterns. Patch with suggestions for starting.txt. (Tony Mechelynck, 2012 Oct 24) But use Gnome instead of GTK? +Patch to make FocusGained and FocusLost work in modern terminals. (Hayaki +Saito, 2013 Apr 24) + Should be possible to enable/disable matchparen per window or buffer. Add a check for b:no_match_paren in Highlight_matching_Pair() (Marcin Szamotulski, 2012 Nov 8) @@ -246,6 +247,9 @@ Patch for input method status. (Hirohito Higashi, 2012 Apr 18) Patch to print the result of a :python command. (Maxim Philippov <philippovmi@gmail.com>, 2012 Aug 16) Update Aug 17. +Patch to use .png icons for the toolbar on MS-Windows. (Martin Gieseking, 2013 +Apr 18) + Problem with winfixheight and resizing. (Yukihiro Nakadaira, 2011 Sep 17) Patch Sep 18. @@ -934,6 +938,7 @@ ATTENTION message? (Tony Mechelynck, 2008 Dec 1) Also: swap files are in ~/tmp/ One has relative file name ".mozilla/...". Add v:motion_force. (Kana Natsuno, 2008 Dec 6) +Maybe call it v:motiontype. Runtime files for Clojure. (Toralf Wittner, 2008 Jun 25) @@ -5086,8 +5091,6 @@ Various improvements: - Add a variant of CTRL-V that stops interpretation of more than one character. For entering mappings on the command line where a key contains several special characters, e.g. a trailing newline. -- Add regex for 'paragraphs' and 'sections': 'parare' and 'sectre'. Combine - the two into a regex for searching. (Ned Konz) - Make '2' option in 'formatoptions' also work inside comments. - Add 's' flag to 'formatoptions': Do not break when inside a string. (Dodt) - When window size changed (with the mouse) and made too small, set it back diff --git a/runtime/ftplugin/make.vim b/runtime/ftplugin/make.vim index 38ee030f5..fb180c0e5 100644 --- a/runtime/ftplugin/make.vim +++ b/runtime/ftplugin/make.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: Make " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2006 Jun 17 +" Last Change: 2013 Apr 22 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -26,3 +26,8 @@ setlocal commentstring=#\ %s " Including files. let &l:include = '^\s*include' + +" For matchit.vim, suggested by Albert Netymk. +if exists("loaded_matchit") + let b:match_words = '\<if\(n\)\=\(eq\|def\)\>:\<else\>:\<endif\>,\<define\>:\<endef\>' +endif diff --git a/runtime/plugin/getscriptPlugin.vim b/runtime/plugin/getscriptPlugin.vim index 2697cdbc3..45c858aac 100644 --- a/runtime/plugin/getscriptPlugin.vim +++ b/runtime/plugin/getscriptPlugin.vim @@ -1,6 +1,6 @@ " --------------------------------------------------------------------- " getscriptPlugin.vim -" Author: Charles E. Campbell, Jr. +" Author: Charles E. Campbell " Date: Jan 07, 2008 " Installing: :help glvs-install " Usage: :help glvs @@ -19,7 +19,7 @@ if &cp || exists("g:loaded_getscriptPlugin") endif finish endif -let g:loaded_getscriptPlugin = "v34" +let g:loaded_getscriptPlugin = "v35" let s:keepcpo = &cpo set cpo&vim diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim index ac4dfc6ac..cff812b44 100644 --- a/runtime/plugin/netrwPlugin.vim +++ b/runtime/plugin/netrwPlugin.vim @@ -1,9 +1,9 @@ " netrwPlugin.vim: Handles file transfer and remote directory listing across a network " PLUGIN SECTION -" Date: Aug 24, 2011 -" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> +" Date: Dec 06, 2012 +" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim -" Copyright: Copyright (C) 1999-2008 Charles E. Campbell, Jr. {{{1 +" Copyright: Copyright (C) 1999-2012 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, @@ -20,7 +20,7 @@ if &cp || exists("g:loaded_netrwPlugin") finish endif -let g:loaded_netrwPlugin = "v146" +let g:loaded_netrwPlugin = "v148" if v:version < 702 echohl WarningMsg | echo "***netrw*** you need vim version 7.2 for this version of netrw" | echohl None finish @@ -48,10 +48,10 @@ augroup END augroup Network au! au BufReadCmd file://* call netrw#FileUrlRead(expand("<amatch>")) - au BufReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau BufReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(2,expand("<amatch>"))|exe "silent doau BufReadPost ".fnameescape(expand("<amatch>")) - au FileReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau FileReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(1,expand("<amatch>"))|exe "silent doau FileReadPost ".fnameescape(expand("<amatch>")) - au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau BufWritePre ".fnameescape(expand("<amatch>"))|exe 'Nwrite '.fnameescape(expand("<amatch>"))|exe "silent doau BufWritePost ".fnameescape(expand("<amatch>")) - au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,davs://*,rsync://*,sftp://* exe "silent doau FileWritePre ".fnameescape(expand("<amatch>"))|exe "'[,']".'Nwrite '.fnameescape(expand("<amatch>"))|exe "silent doau FileWritePost ".fnameescape(expand("<amatch>")) + au BufReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(2,expand("<amatch>"))|exe "sil doau BufReadPost ".fnameescape(expand("<amatch>")) + au FileReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(1,expand("<amatch>"))|exe "sil doau FileReadPost ".fnameescape(expand("<amatch>")) + au BufWriteCmd ftp://*,rcp://*,scp://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufWritePre ".fnameescape(expand("<amatch>"))|exe 'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau BufWritePost ".fnameescape(expand("<amatch>")) + au FileWriteCmd ftp://*,rcp://*,scp://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileWritePre ".fnameescape(expand("<amatch>"))|exe "'[,']".'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau FileWritePost ".fnameescape(expand("<amatch>")) try au SourceCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe 'Nsource '.fnameescape(expand("<amatch>")) catch /^Vim\%((\a\+)\)\=:E216/ diff --git a/runtime/plugin/tarPlugin.vim b/runtime/plugin/tarPlugin.vim index 01ddd48df..034cbe225 100644 --- a/runtime/plugin/tarPlugin.vim +++ b/runtime/plugin/tarPlugin.vim @@ -1,6 +1,6 @@ " tarPlugin.vim -- a Vim plugin for browsing tarfiles " Original was copyright (c) 2002, Michael C. Toren <mct@toren.net> -" Modified by Charles E. Campbell, Jr. +" Modified by Charles E. Campbell " Distributed under the GNU General Public License. " " Updates are available from <http://michael.toren.net/code/>. If you @@ -14,7 +14,7 @@ if &cp || exists("g:loaded_tarPlugin") finish endif -let g:loaded_tarPlugin = "v28" +let g:loaded_tarPlugin = "v29" let s:keepcpo = &cpo set cpo&vim diff --git a/runtime/plugin/zipPlugin.vim b/runtime/plugin/zipPlugin.vim index ebb6427f5..c86230cc5 100644 --- a/runtime/plugin/zipPlugin.vim +++ b/runtime/plugin/zipPlugin.vim @@ -1,9 +1,9 @@ " zipPlugin.vim: Handles browsing zipfiles " PLUGIN PORTION -" Date: Aug 15, 2011 -" Maintainer: Charles E Campbell, Jr <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> +" Date: Nov 15, 2012 +" Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " License: Vim License (see vim's :help license) -" Copyright: Copyright (C) 2005-2011 Charles E. Campbell, Jr. {{{1 +" Copyright: Copyright (C) 2005-2012 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, @@ -20,7 +20,7 @@ if &cp || exists("g:loaded_zipPlugin") finish endif -let g:loaded_zipPlugin = "v25" +let g:loaded_zipPlugin = "v26" let s:keepcpo = &cpo set cpo&vim @@ -40,7 +40,7 @@ augroup zip au FileWriteCmd zipfile:*/* call zip#Write(expand("<amatch>")) endif - au BufReadCmd *.zip,*.jar,*.xpi,*.war,*.ear,*.celzip,*.oxt call zip#Browse(expand("<amatch>")) + au BufReadCmd *.zip,*.jar,*.xpi,*.ja,*.war,*.ear,*.celzip,*.oxt,*.kmz,*.wsz,*.xap,*.docx,*.docm,*.dotx,*.dotm,*.potx,*.potm,*.ppsx,*.ppsm,*.pptx,*.pptm,*.ppam,*.sldx,*.thmx,*.xlam,*.xlsx,*.xlsm,*.xlsb,*.xltx,*.xltm,*.xlam,*.crtx,*.vdw,*.glox,*.gcsx,*.gqsx call zip#Browse(expand("<amatch>")) augroup END " --------------------------------------------------------------------- diff --git a/runtime/syntax/aptconf.vim b/runtime/syntax/aptconf.vim index dabfe56e7..0607ca10f 100644 --- a/runtime/syntax/aptconf.vim +++ b/runtime/syntax/aptconf.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: APT config file " Maintainer: Yann Amar <quidame@poivron.org> -" Last Change: 2012 Oct 06 +" Last Change: 2013 Apr 12 " For version 5.x: Clear all syntax items " For version 6.x and 7.x: Quit when a syntax file was already loaded @@ -17,7 +17,6 @@ endif let s:cpo_save = &cpo set cpo&vim - " Errors: " Catch all that is not overridden by next rules/items: syn match aptconfError display '[^[:blank:]]' @@ -198,6 +197,24 @@ syn keyword aptconfAptitudeUI contained \ Package-Status-Format Pause-After-Download Preview-Limit \ Prompt-On-Exit Styles ViewTabs +syn keyword aptconfAptitudeUIKeyBindings contained + \ ApplySolution Begin BugReport Cancel Changelog ChangePkgTreeGrouping + \ ChangePkgTreeLimit ChangePkgTreeSorting ClearAuto CollapseAll + \ CollapseTree Commit Confirm Cycle CycleNext CycleOrder CyclePrev + \ DelBOL DelBack DelEOL DelForward Dependencies DescriptionCycle + \ DescriptionDown DescriptionUp DoInstallRun Down DpkgReconfigure + \ DumpResolver EditHier End ExamineSolution ExpandAll ExpandTree + \ FirstSolution ForbidUpgrade ForgetNewPackages Help HistoryNext + \ HistoryPrev Hold Install InstallSingle Keep LastSolution Left + \ LevelDown LevelUp MarkUpgradable MineFlagSquare MineLoadGame + \ MineSaveGame MineSweepSquare MineUncoverSquare MineUncoverSweepSquare + \ NextPage NextSolution No Parent PrevPage PrevSolution Purge + \ PushButton Quit QuitProgram RejectBreakHolds Refresh Remove + \ ReInstall RepeatSearchBack ReSearch ReverseDependencies Right + \ SaveHier Search SearchBack SearchBroken SetAuto ShowHideDescription + \ SolutionActionApprove SolutionActionReject ToggleExpanded + \ ToggleMenuActive Undo Up UpdatePackageList Versions Yes + syn keyword aptconfAptitudeUIStyles contained \ Bullet ChangeLogNewerVersion Default DepBroken DisabledMenuEntry \ DownloadHit DownloadProgress EditLine Error Header HighlightedMenuBar @@ -220,7 +237,8 @@ syn cluster aptconfAptitude_ contains=aptconfAptitude, \ aptconfAptitudeCmdlineSafeUpgrade,aptconfAptitudeLogging, \ aptconfAptitudeProblemResolver,aptconfAptitudeSafeResolver, \ aptconfAptitudeScreenshot,aptconfAptitudeSections,aptconfAptitudeUI, - \ aptconfAptitudeUIStyles,aptconfAptitudeUIStylesElements + \ aptconfAptitudeUIKeyBindings,aptconfAptitudeUIStyles, + \ aptconfAptitudeUIStylesElements " }}} " DebTags: {{{ syn keyword aptconfDebTags contained @@ -449,6 +467,7 @@ hi def link aptconfAptitudeSafeResolver aptconfOption hi def link aptconfAptitudeScreenshot aptconfOption hi def link aptconfAptitudeSections aptconfOption hi def link aptconfAptitudeUI aptconfOption +hi def link aptconfAptitudeUIKeyBindings aptconfOption hi def link aptconfAptitudeUIStyles aptconfOption hi def link aptconfAptitudeUIStylesElements aptconfOption diff --git a/runtime/syntax/groovy.vim b/runtime/syntax/groovy.vim index 745a0971e..2056bd16d 100644 --- a/runtime/syntax/groovy.vim +++ b/runtime/syntax/groovy.vim @@ -2,9 +2,9 @@ " Language: Groovy " Original Author: Alessio Pace <billy.corgan@tiscali.it> " Maintainer: Tobias Rapp <yahuxo@gmx.de> -" Version: 0.1.12 +" Version: 0.1.13 " URL: http://www.vim.org/scripts/script.php?script_id=945 -" Last Change: 2013 Mar 14 +" Last Change: 2013 Apr 24 " THE ORIGINAL AUTHOR'S NOTES: " @@ -74,7 +74,7 @@ endif " keyword definitions syn keyword groovyExternal native package -syn match groovyExternal "\<import\(\s\+static\>\)\?" +syn match groovyExternal "\<import\>\(\s\+static\>\)\?" syn keyword groovyError goto const syn keyword groovyConditional if else switch syn keyword groovyRepeat while for do diff --git a/runtime/syntax/netrw.vim b/runtime/syntax/netrw.vim index d4d266c39..a319d7cb1 100644 --- a/runtime/syntax/netrw.vim +++ b/runtime/syntax/netrw.vim @@ -1,7 +1,7 @@ " Language : Netrw Remote-Directory Listing Syntax " Maintainer : Charles E. Campbell, Jr. -" Last change: Jan 14, 2009 -" Version : 16 +" Last change: Dec 18, 2012 +" Version : 17 " --------------------------------------------------------------------- " Syntax Clearing: {{{1 @@ -56,13 +56,16 @@ if exists("g:netrw_special_syntax") && netrw_special_syntax if has("unix") syn match netrwCoreDump "\<core\%(\.\d\+\)\=\>" contains=netrwTreeBar,@NoSpell endif + syn match netrwLex "\(\S\+ \)*\S\+\.\%(l\|lex\)\>" contains=netrwTreeBar,@NoSpell + syn match netrwYacc "\(\S\+ \)*\S\+\.y\>" contains=netrwTreeBar,@NoSpell syn match netrwData "\(\S\+ \)*\S\+\.dat\>" contains=netrwTreeBar,@NoSpell - syn match netrwHdr "\(\S\+ \)*\S\+\.h\>" contains=netrwTreeBar,@NoSpell + syn match netrwDoc "\(\S\+ \)*\S\+\.\%(doc\|txt\|pdf\|ps\)" contains=netrwTreeBar,@NoSpell + syn match netrwHdr "\(\S\+ \)*\S\+\.\%(h\|hpp\)\>" contains=netrwTreeBar,@NoSpell syn match netrwLib "\(\S\+ \)*\S*\.\%(a\|so\|lib\|dll\)\>" contains=netrwTreeBar,@NoSpell syn match netrwMakeFile "\<[mM]akefile\>\|\(\S\+ \)*\S\+\.mak\>" contains=netrwTreeBar,@NoSpell syn match netrwObj "\(\S\+ \)*\S*\.\%(o\|obj\)\>" contains=netrwTreeBar,@NoSpell - syn match netrwTags "\<tags\>" contains=netrwTreeBar,@NoSpell syn match netrwTags "\<\(ANmenu\|ANtags\)\>" contains=netrwTreeBar,@NoSpell + syn match netrwTags "\<tags\>" contains=netrwTreeBar,@NoSpell syn match netrwTilde "\(\S\+ \)*\S\+\~\*\=\>" contains=netrwTreeBar,@NoSpell syn match netrwTmp "\<tmp\(\S\+ \)*\S\+\>\|\(\S\+ \)*\S*tmp\>" contains=netrwTreeBar,@NoSpell endif @@ -95,12 +98,15 @@ if !exists("did_drchip_netrwlist_syntax") hi default link netrwCompress Folded hi default link netrwCoreDump WarningMsg hi default link netrwData DiffChange + hi default link netrwHdr netrwPlain + hi default link netrwLex netrwPlain hi default link netrwLib DiffChange hi default link netrwMakefile DiffChange hi default link netrwObj Folded hi default link netrwTilde Folded hi default link netrwTmp Folded hi default link netrwTags Folded + hi default link netrwYacc netrwPlain endif " Current Syntax: {{{1 diff --git a/runtime/syntax/ninja.vim b/runtime/syntax/ninja.vim index f7008ecfd..d81326781 100644 --- a/runtime/syntax/ninja.vim +++ b/runtime/syntax/ninja.vim @@ -2,8 +2,11 @@ " Language: ninja build file as described at " http://martine.github.com/ninja/manual.html " Version: 1.3 -" Last Change: 2013 Apr 12 +" Last Change: 2013/04/16 " Maintainer: Nicolas Weber <nicolasweber@gmx.de> +" Version 1.3 of this script is in the upstream vim repository and will be +" included in the next vim release. If you change this, please send your change +" upstream. " ninja lexer and parser are at " https://github.com/martine/ninja/blob/master/src/lexer.in.cc @@ -13,6 +16,9 @@ if exists("b:current_syntax") finish endif +let s:cpo_save = &cpo +set cpo&vim + syn case match syn match ninjaComment /#.*/ contains=@Spell @@ -33,7 +39,8 @@ syn match ninjaKeyword "^subninja\>" " let assignments. " manifest_parser.cc, ParseRule() syn region ninjaRule start="^rule" end="^\ze\S" contains=ALL transparent -syn keyword ninjaRuleCommand contained command deps depfile description generator pool restat rspfile rspfile_content +syn keyword ninjaRuleCommand contained command deps depfile description generator + \ pool restat rspfile rspfile_content syn region ninjaPool start="^pool" end="^\ze\S" contains=ALL transparent syn keyword ninjaPoolCommand contained depth @@ -69,3 +76,6 @@ hi def link ninjaSimpleVar ninjaVar hi def link ninjaVar Identifier let b:current_syntax = "ninja" + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/syntax/redif.vim b/runtime/syntax/redif.vim index 554de5802..1b83c0779 100644 --- a/runtime/syntax/redif.vim +++ b/runtime/syntax/redif.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: ReDIF " Maintainer: Axel Castellane <axel.castellane@polytechnique.edu> -" Last Change: 2013 April 08 +" Last Change: 2013 April 17 " Original Author: Axel Castellane " Source: http://openlib.org/acmes/root/docu/redif_1.html " File Extension: rdf @@ -581,6 +581,7 @@ syntax region redifArgumentNameMiddle start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/m syntax region redifArgumentNamePrefix start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained syntax region redifArgumentNameSuffix start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained syntax region redifArgumentName start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained +syntax region redifArgumentNumber start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained syntax region redifArgumentOrderHomepage start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained syntax region redifArgumentOrderURL start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained syntax region redifArgumentPhone start=/\%(^\S\{-}:\)\@!\S/ end=/^\S\{-}:/me=s-1 contained @@ -793,12 +794,11 @@ highlight def link redifSpecialPublicationStatus redifSpecial " Month " TODO Are numbers also allowed? syntax match redifArgumentMonth /\%(^\S\{-}:\)\@!\S.*/ contains=redifGoodMonth contained display -syntax match redifGoodMonth /\<\(Jan\%(uary\)\=\|Feb\%(ruary\)\=\|Mar\%(ch\)\=\|Apr\%(il\)\=\|May\|June\=\|July\=\|Aug\%(ust\)\=\|Sep\%(tember\)\=\|Oct\%(ober\)\=\|Nov\%(ember\)\=\|Dec\%(ember\)\=\)\>/ nextgroup=redifWrongLineEnding contained display +syntax match redifGoodMonth /\<\(Jan\%(uary\)\=\|Feb\%(ruary\)\=\|Mar\%(ch\)\=\|Apr\%(il\)\=\|May\|June\=\|July\=\|Aug\%(ust\)\=\|Sep\%(tember\)\=\|Oct\%(ober\)\=\|Nov\%(ember\)\=\|Dec\%(ember\)\=\)\>/ contained display highlight def link redifGoodMonth redifSpecial -" Integers: Number, Volume, Chapter -syntax match redifArgumentNumber /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectInteger contained display +" Integers: Volume, Chapter syntax match redifArgumentVolume /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectInteger contained display syntax match redifArgumentChapter /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectInteger contained display syntax match redifCorrectInteger /[1-9]\d*/ nextgroup=redifWrongLineEnding contained display @@ -815,19 +815,19 @@ highlight def link redifArgumentYear redifError " Edition " Based on the example in the documentation. syntax match redifArgumentEdition /\%(^\S\{-}:\)\@!\S.*/ contains=redifGoodEdition contained display -syntax match redifGoodEdition /1st\|2nd\|3rd\|[4-9]th\|[1-9]\d*\%(1st\|2nd\|3rd\|[4-9]th\)\|[1-9]\d*/ nextgroup=redifWrongLineEnding contained display +syntax match redifGoodEdition /1st\|2nd\|3rd\|[4-9]th\|[1-9]\d*\%(1st\|2nd\|3rd\|[4-9]th\)\|[1-9]\d*/ contained display highlight def link redifGoodEdition redifSpecial " ISBN syntax match redifArgumentISBN /\%(^\S\{-}:\)\@!\S.*/ contains=redifGoodISBN contained display -syntax match redifGoodISBN /\d[0-9-]\{8,15}\d/ nextgroup=redifWrongLineEnding contained display +syntax match redifGoodISBN /\d[0-9-]\{8,15}\d/ contained display highlight def link redifGoodISBN redifSpecial " ISSN syntax match redifArgumentISSN /\%(^\S\{-}:\)\@!\S.*/ contains=redifGoodISSN contained display -syntax match redifGoodISSN /\d\{4}-\d\{3}[0-9X]/ nextgroup=redifWrongLineEnding contained display +syntax match redifGoodISSN /\d\{4}-\d\{3}[0-9X]/ contained display highlight def link redifGoodISSN redifSpecial @@ -862,7 +862,7 @@ highlight def link redifArgumentRevisionDate redifError " Classification-JEL syntax match redifArgumentClassificationJEL /\%(^\S\{-}:\)\@!\S.*/ contains=redifCorrectJEL contained display -syntax match redifCorrectJEL /\<\u\d\{,2}\%([,; \t]\s*\)\=/ contains=redifSpecialJEL nextgroup=redifWrongLineEnding contained display +syntax match redifCorrectJEL /\<\%(\u\d\{,2}[,; \t]\s*\)*\u\d\{,2}/ contains=redifSpecialJEL nextgroup=redifWrongLineEnding contained display syntax match redifSpecialJEL /\<\u\d\{,2}/ contained display highlight def link redifArgumentClassificationJEL redifError diff --git a/runtime/tutor/tutor.eo b/runtime/tutor/tutor.eo index cc9a8be10..c075ec7a9 100644 --- a/runtime/tutor/tutor.eo +++ b/runtime/tutor/tutor.eo @@ -645,7 +645,7 @@ RIMARKO: iuj : komandoj devas finii per tajpo de <Enenklavo> 3. Nun tajpu: :w TESTO (kie TESTO estas la elektita dosiernomo) 4. Tio konservas la tutan dosieron (instruilon de Vim) kun la nomo TESTO. - Por kontroli tion, tajpu :!dir a !ls denove por vidigi vian + Por kontroli tion, tajpu :!dir a :!ls denove por vidigi vian dosierujon. RIMARKO: Se vi volus eliri el Vim kaj restartigi in denove per vim TESTO, diff --git a/src/po/fi.po b/src/po/fi.po index cacb00a87..5685d171b 100644 --- a/src/po/fi.po +++ b/src/po/fi.po @@ -367,7 +367,7 @@ msgstr "E684: Indeksi %ld luettelon rajojen ulkopuolella" #, c-format msgid "E121: Undefined variable: %s" -msgstr "E121: Mrittelemtn muuttuja %s" +msgstr "E121: Mrittelemtn muuttuja: %s" msgid "E111: Missing ']'" msgstr "E111: ] puuttuu" @@ -392,7 +392,7 @@ msgstr "E715: Sanakirja tarvitaan" #, c-format msgid "E118: Too many arguments for function: %s" -msgstr "E118: Liikaa argumentteja funktiolle %s" +msgstr "E118: Liikaa argumentteja funktiolle: %s" #, c-format msgid "E716: Key not present in Dictionary: %s" @@ -1266,7 +1266,7 @@ msgstr "E179: -complete vaatii argumentin" #, c-format msgid "E181: Invalid attribute: %s" -msgstr "E181: Virheellinen attribuutti %s" +msgstr "E181: Virheellinen attribuutti: %s" msgid "E182: Invalid command name" msgstr "E182: Virheellinen komennon nimi" @@ -2220,7 +2220,7 @@ msgstr "E253: Fontsetin nimi: %s\n" #, c-format msgid "Font0: %s\n" -msgstr "Fontti0. %s\n" +msgstr "Fontti0: %s\n" #, c-format msgid "Font1: %s\n" @@ -2481,7 +2481,7 @@ msgstr "" #, c-format msgid "E625: cannot open cscope database: %s" -msgstr "E625: ei voi avata csope-tietokantaa %s" +msgstr "E625: ei voi avata cscope-tietokantaa: %s" msgid "E626: cannot get cscope database information" msgstr "E626: ei voi hakea cscope-tietokannan tietoja" @@ -5328,7 +5328,7 @@ msgstr "E397: Tiedostonimi puuttuu" #, c-format msgid "E789: Missing ']': %s" -msgstr "E789: ] puuttuu; %s" +msgstr "E789: ] puuttuu: %s" #, c-format msgid "E398: Missing '=': %s" @@ -6173,11 +6173,11 @@ msgstr "E474: Virheellinen argumentti" #, c-format msgid "E475: Invalid argument: %s" -msgstr "E475: Virheellinen argumentti %s" +msgstr "E475: Virheellinen argumentti: %s" #, c-format msgid "E15: Invalid expression: %s" -msgstr "E15: Virheellinen ilmaus %s" +msgstr "E15: Virheellinen ilmaus: %s" msgid "E16: Invalid range" msgstr "E16: Virheellinen arvoalue" diff --git a/src/po/ja.po b/src/po/ja.po index 14ae378d7..7f4587349 100644 --- a/src/po/ja.po +++ b/src/po/ja.po @@ -3,7 +3,7 @@ # Do ":help uganda" in Vim to read copying and usage conditions. # Do ":help credits" in Vim to see a list of people who contributed. # -# Last Change: 24-Feb-2013. +# Last Change: 17-Apr-2013. # # Copyright (C) 2001-12 MURAOKA Taro <koron.kaoriya@gmail.com> # THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. @@ -12,8 +12,8 @@ msgid "" msgstr "" "Project-Id-Version: Vim 7.3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-02-24 12:38+0900\n" -"PO-Revision-Date: 2013-02-24 13:30+0900\n" +"POT-Creation-Date: 2013-04-17 19:56+0900\n" +"PO-Revision-Date: 2013-04-17 20:00+0900\n" "Last-Translator: MURAOKA Taro <koron.kaoriya@gmail.com>\n" "Language-Team: MURAOKA Taro <koron.kaoriya@gmail.com>\n" "Language: Japanese\n" @@ -569,7 +569,7 @@ msgid "add() argument" msgstr "add() ΰ" msgid "E699: Too many arguments" -msgstr "E699: ¿ޤ" +msgstr "E699: ¿ޤ" msgid "E785: complete() can only be used in Insert mode" msgstr "E785: complete() ⡼ɤǤѤǤޤ" @@ -685,7 +685,7 @@ msgid "E730: using List as a String" msgstr "E730: ꥹȷʸȤưäƤޤ" msgid "E731: using Dictionary as a String" -msgstr "E731: ѿʸȤưäƤޤ" +msgstr "E731: ʸȤưäƤޤ" msgid "E806: using Float as a String" msgstr "E806: ưʸȤưäƤޤ" @@ -998,6 +998,10 @@ msgstr "E148: globalޥɤɽꤵƤޤ" msgid "Pattern found in every line: %s" msgstr "ѥƤιԤǸĤޤ: %s" +#, c-format +msgid "Pattern not found: %s" +msgstr "ѥϸĤޤǤ: %s" + msgid "" "\n" "# Last Substitute String:\n" diff --git a/src/po/ja.sjis.po b/src/po/ja.sjis.po index bc2ee9023..ac984f6ea 100644 --- a/src/po/ja.sjis.po +++ b/src/po/ja.sjis.po @@ -3,7 +3,7 @@ # Do ":help uganda" in Vim to read copying and usage conditions. # Do ":help credits" in Vim to see a list of people who contributed. # -# Last Change: 24-Feb-2013. +# Last Change: 17-Apr-2013. # # Copyright (C) 2001-12 MURAOKA Taro <koron.kaoriya@gmail.com> # THIS FILE IS DISTRIBUTED UNDER THE VIM LICENSE. @@ -12,8 +12,8 @@ msgid "" msgstr "" "Project-Id-Version: Vim 7.3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-02-24 12:38+0900\n" -"PO-Revision-Date: 2013-02-24 13:30+0900\n" +"POT-Creation-Date: 2013-04-17 19:56+0900\n" +"PO-Revision-Date: 2013-04-17 20:00+0900\n" "Last-Translator: MURAOKA Taro <koron.kaoriya@gmail.com>\n" "Language-Team: MURAOKA Taro <koron.kaoriya@gmail.com>\n" "Language: Japanese\n" @@ -569,7 +569,7 @@ msgid "add() argument" msgstr "add() ̈" msgid "E699: Too many arguments" -msgstr "E699: ߂܂" +msgstr "E699: ߂܂" msgid "E785: complete() can only be used in Insert mode" msgstr "E785: complete() ͑}[hłpł܂" @@ -685,7 +685,7 @@ msgid "E730: using List as a String" msgstr "E730: Xg^ƂĈĂ܂" msgid "E731: using Dictionary as a String" -msgstr "E731: ϐ^ƂĈĂ܂" +msgstr "E731: ^ƂĈĂ܂" msgid "E806: using Float as a String" msgstr "E806: _ƂĈĂ܂" @@ -998,6 +998,10 @@ msgstr "E148: globalR}hɐK\\w肳Ă܂" msgid "Pattern found in every line: %s" msgstr "p^[SĂ̍sŌ܂: %s" +#, c-format +msgid "Pattern not found: %s" +msgstr "p^[͌܂ł: %s" + msgid "" "\n" "# Last Substitute String:\n" |