# HG changeset patch # User Christian Brabandt # Date 1509903005 -3600 # Node ID 65d7fd8381a302ac41dae7fc4098b2745626f01d # Parent b38715f6a7587cdd18b6fabf83aafc95b376b7c5 Update runtime files. commit https://github.com/vim/vim/commit/b0d45e7f5354375edd02afafde3bd37dac1515ff Author: Bram Moolenaar Date: Sun Nov 5 18:19:24 2017 +0100 Update runtime files. diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim --- a/runtime/autoload/netrw.vim +++ b/runtime/autoload/netrw.vim @@ -1,7 +1,7 @@ " netrw.vim: Handles file transfer and remote directory listing across " AUTOLOAD SECTION -" Date: Apr 20, 2016 -" Version: 156 +" Date: Nov 03, 2017 +" Version: 162 " Maintainer: Charles E Campbell " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 2016 Charles E. Campbell {{{1 @@ -22,15 +22,24 @@ if &cp || exists("g:loaded_netrw") finish endif -" netrw requires vim having patch 7.4.213; netrw will benefit from vim's having patch#656, too -if v:version < 704 || (v:version == 704 && !has("patch213")) - if !exists("s:needpatch213") - unsilent echomsg "***sorry*** this version of netrw requires vim v7.4 with patch 213" - endif - let s:needpatch213= 1 - finish + +" Check that vim has patches that netrw requires. +" Patches needed: 1557, and 213. +" (netrw will benefit from vim's having patch#656, too) +let s:needspatches=[1557,213] +if exists("s:needspatches") + for ptch in s:needspatches + if v:version < 704 || (v:version == 704 && !has("patch".ptch)) + if !exists("s:needpatch{ptch}") + unsilent echomsg "***sorry*** this version of netrw requires vim v7.4 with patch#".ptch + endif + let s:needpatch{ptch}= 1 + finish + endif + endfor endif -let g:loaded_netrw = "v156" + +let g:loaded_netrw = "v162" if !exists("s:NOTE") let s:NOTE = 0 let s:WARNING = 1 @@ -55,7 +64,7 @@ setl cpo&vim " Usage: netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,"some message",error-number) " netrw#ErrorMsg(s:NOTE | s:WARNING | s:ERROR,["message1","message2",...],error-number) " (this function can optionally take a list of messages) -" Jan 19, 2016 : max errnum currently is 103 +" Mar 21, 2017 : max errnum currently is 105 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) @@ -181,6 +190,14 @@ if !exists("s:LONGLIST") endif " --------------------------------------------------------------------- +" Default option values: {{{2 +let g:netrw_localcopycmdopt = "" +let g:netrw_localcopydircmdopt = "" +let g:netrw_localmkdiropt = "" +let g:netrw_localmovecmdopt = "" +let g:netrw_localrmdiropt = "" + +" --------------------------------------------------------------------- " Default values for netrw's global protocol variables {{{2 call s:NetrwInit("g:netrw_use_errorwindow",1) @@ -215,21 +232,21 @@ if !exists("g:netrw_ftp_options") let g:netrw_ftp_options= "-i -n" endif if !exists("g:netrw_http_cmd") - if executable("elinks") - let g:netrw_http_cmd = "elinks" - call s:NetrwInit("g:netrw_http_xcmd","-source >") - elseif executable("links") - let g:netrw_http_cmd = "links" - call s:NetrwInit("g:netrw_http_xcmd","-source >") - elseif executable("curl") + if executable("curl") let g:netrw_http_cmd = "curl" - call s:NetrwInit("g:netrw_http_xcmd","-o") + call s:NetrwInit("g:netrw_http_xcmd","-L -o") elseif executable("wget") let g:netrw_http_cmd = "wget" call s:NetrwInit("g:netrw_http_xcmd","-q -O") + elseif executable("elinks") + let g:netrw_http_cmd = "elinks" + call s:NetrwInit("g:netrw_http_xcmd","-source >") elseif executable("fetch") let g:netrw_http_cmd = "fetch" call s:NetrwInit("g:netrw_http_xcmd","-o") + elseif executable("links") + let g:netrw_http_cmd = "links" + call s:NetrwInit("g:netrw_http_xcmd","-http.extra-header ".shellescape("Accept-Encoding: identity", 1)." -source >") else let g:netrw_http_cmd = "" endif @@ -238,6 +255,7 @@ call s:NetrwInit("g:netrw_http_put_cmd", call s:NetrwInit("g:netrw_keepj","keepj") call s:NetrwInit("g:netrw_rcp_cmd" , "rcp") call s:NetrwInit("g:netrw_rsync_cmd", "rsync") +call s:NetrwInit("g:netrw_rsync_sep", "/") if !exists("g:netrw_scp_cmd") if executable("scp") call s:NetrwInit("g:netrw_scp_cmd" , "scp -q") @@ -364,7 +382,8 @@ if !exists("g:netrw_localcopycmd") if g:netrw_cygwin let g:netrw_localcopycmd= "cp" else - let g:netrw_localcopycmd= expand("$COMSPEC")." /c copy" + let g:netrw_localcopycmd = expand("$COMSPEC") + let g:netrw_localcopycmdopt= " /c copy" endif elseif has("unix") || has("macunix") let g:netrw_localcopycmd= "cp" @@ -375,14 +394,20 @@ endif if !exists("g:netrw_localcopydircmd") if has("win32") || has("win95") || has("win64") || has("win16") if g:netrw_cygwin - let g:netrw_localcopydircmd= "cp -R" - else - let g:netrw_localcopycmd= expand("$COMSPEC")." /c xcopy /e /c /h /i /k" - endif - elseif has("unix") || has("macunix") - let g:netrw_localcopydircmd= "cp -R" + let g:netrw_localcopydircmd = "cp" + let g:netrw_localcopydircmdopt= " -R" + else + let g:netrw_localcopydircmd = expand("$COMSPEC") + let g:netrw_localcopydircmdopt= " /c xcopy /e /c /h /i /k" + endif + elseif has("unix") + let g:netrw_localcopydircmd = "cp" + let g:netrw_localcopydircmdopt= " -R" + elseif has("macunix") + let g:netrw_localcopydircmd = "cp" + let g:netrw_localcopydircmdopt= " -R" else - let g:netrw_localcopycmd= "" + let g:netrw_localcopydircmd= "" endif endif if exists("g:netrw_local_mkdir") @@ -393,7 +418,8 @@ if has("win32") || has("win95") || has(" if g:netrw_cygwin call s:NetrwInit("g:netrw_localmkdir","mkdir") else - let g:netrw_localmkdir= expand("$COMSPEC")." /c mkdir" + let g:netrw_localmkdir = expand("$COMSPEC") + let g:netrw_localmkdiropt= " /c mkdir" endif else call s:NetrwInit("g:netrw_localmkdir","mkdir") @@ -408,7 +434,8 @@ if !exists("g:netrw_localmovecmd") if g:netrw_cygwin let g:netrw_localmovecmd= "mv" else - let g:netrw_localmovecmd= expand("$COMSPEC")." /c move" + let g:netrw_localmovecmd = expand("$COMSPEC") + let g:netrw_localmovecmdopt= " /c move" endif elseif has("unix") || has("macunix") let g:netrw_localmovecmd= "mv" @@ -416,7 +443,8 @@ if !exists("g:netrw_localmovecmd") let g:netrw_localmovecmd= "" endif endif -if v:version < 704 || !has("patch1109") +if v:version < 704 || (v:version == 704 && !has("patch1107")) + " 1109 provides for delete(tmpdir,"d") which is what will be used if exists("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) @@ -425,7 +453,8 @@ if v:version < 704 || !has("patch1109") if g:netrw_cygwin call s:NetrwInit("g:netrw_localrmdir","rmdir") else - let g:netrw_localrmdir= expand("$COMSPEC")." /c rmdir" + let g:netrw_localrmdir = expand("$COMSPEC") + let g:netrw_localrmdiropt= " /c rmdir" endif else call s:NetrwInit("g:netrw_localrmdir","rmdir") @@ -527,7 +556,7 @@ if has("gui_running") && (&enc == 'utf-8 else let s:treedepthstring= "| " endif -call s:NetrwInit("s:netrw_nbcd",'{}') +call s:NetrwInit("s:netrw_posn",'{}') " BufEnter event ignored by decho when following variable is true " Has a side effect that doau BufReadPost doesn't work, so @@ -888,7 +917,7 @@ fun! netrw#Explore(indx,dosplit,style,.. NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Nexplore or improperly; see help for netrw-starstar",40) if has("clipboard") sil! let @* = keepregstar - sil! let @+ = keepregstar + sil! let @+ = keepregplus endif sil! let @/ = keepregslash " call Dret("netrw#Explore") @@ -913,7 +942,7 @@ fun! netrw#Explore(indx,dosplit,style,.. NetrwKeepj call netrw#ErrorMsg(s:WARNING,"using Pexplore or improperly; see help for netrw-starstar",41) if has("clipboard") sil! let @* = keepregstar - sil! let @+ = keepregstar + sil! let @+ = keepregplus endif sil! let @/ = keepregslash " call Dret("netrw#Explore") @@ -967,8 +996,8 @@ fun! netrw#Explore(indx,dosplit,style,.. keepalt call netrw#ErrorMsg(s:WARNING,'no files matched pattern<'.pattern.'>',45) if &hls | let keepregslash= s:ExplorePatHls(pattern) | endif if has("clipboard") - sil! let @* = keepregstar - sil! let @+ = keepregstar + sil! let @* = keepregstar + sil! let @+ = keepregplus endif sil! let @/ = keepregslash " call Dret("netrw#Explore : no files matched pattern") @@ -1004,7 +1033,7 @@ fun! netrw#Explore(indx,dosplit,style,.. keepalt NetrwKeepj call netrw#ErrorMsg(s:WARNING,"no files matched",42) if has("clipboard") sil! let @* = keepregstar - sil! let @+ = keepregstar + sil! let @+ = keepregplus endif sil! let @/ = keepregslash " call Dret("netrw#Explore : no files matched") @@ -1052,7 +1081,7 @@ fun! netrw#Explore(indx,dosplit,style,.. endif if has("clipboard") sil! let @* = keepregstar - sil! let @+ = keepregstar + sil! let @+ = keepregplus endif sil! let @/ = keepregslash " call Dret("netrw#Explore : missing +path_extra") @@ -1106,7 +1135,9 @@ fun! netrw#Explore(indx,dosplit,style,.. let prvfname= fname endfor " call Decho("explore_match<".s:explore_match.">",'~'.expand("")) - exe "2match netrwMarkFile /".s:explore_match."/" + if has("syntax") && exists("g:syntax_on") && g:syntax_on + exe "2match netrwMarkFile /".s:explore_match."/" + endif endif echo "==Pexplore ==Nexplore" else @@ -1123,7 +1154,7 @@ fun! netrw#Explore(indx,dosplit,style,.. let s:netrw_events= 2 if has("clipboard") sil! let @* = keepregstar - sil! let @+ = keepregstar + sil! let @+ = keepregplus endif sil! let @/ = keepregslash " call Dret("netrw#Explore : @/<".@/.">") @@ -1132,13 +1163,14 @@ endfun " --------------------------------------------------------------------- " netrw#Lexplore: toggle Explorer window, keeping it on the left of the current tab {{{2 fun! netrw#Lexplore(count,rightside,...) -" call Dfunc("netrw#Lexplore(count=".a:count."rightside=".a:rightside.",...) a:0=".a:0." ft=".&ft) +" call Dfunc("netrw#Lexplore(count=".a:count." rightside=".a:rightside.",...) a:0=".a:0." ft=".&ft) let curwin= winnr() if a:0 > 0 && a:1 != "" " if a netrw window is already on the left-side of the tab " and a directory has been specified, explore with that " directory. +" call Decho("case has input argument(s) (a:1<".a:1.">)") let a1 = expand(a:1) " call Decho("a:1<".a:1."> curwin#".curwin,'~'.expand("")) exe "1wincmd w" @@ -1156,18 +1188,22 @@ fun! netrw#Lexplore(count,rightside,...) exe curwin."wincmd w" else let a1= "" +" call Decho("no input arguments") endif if exists("t:netrw_lexbufnr") " check if t:netrw_lexbufnr refers to a netrw window let lexwinnr = bufwinnr(t:netrw_lexbufnr) +" call Decho("lexwinnr= bufwinnr(t:netrw_lexbufnr#".t:netrw_lexbufnr.")=".lexwinnr) else let lexwinnr= 0 - endif +" call Decho("t:netrw_lexbufnr doesn't exist") + endif +" call Decho("lexwinnr=".lexwinnr,'~'.expand("")) if lexwinnr > 0 " close down netrw explorer window -" call Decho("t:netrw_lexbufnr#".t:netrw_lexbufnr.": close down netrw window",'~'.expand("")) +" call Decho("t:netrw_lexbufnr#".t:netrw_lexbufnr.": close down netrw window",'~'.expand("")) exe lexwinnr."wincmd w" let g:netrw_winsize = -winwidth(0) let t:netrw_lexposn = winsaveview() @@ -1177,8 +1213,11 @@ fun! netrw#Lexplore(count,rightside,...) if lexwinnr < curwin let curwin= curwin - 1 endif - exe curwin."wincmd w" + if lexwinnr != curwin + exe curwin."wincmd w" + endif unlet t:netrw_lexbufnr +" call Decho("unlet t:netrw_lexbufnr") else " open netrw explorer window @@ -1193,15 +1232,17 @@ fun! netrw#Lexplore(count,rightside,...) let curfile= expand("%") " call Decho("curfile<".curfile.">",'~'.expand("")) exe (a:rightside? "botright" : "topleft")." vertical ".((g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize) . " new" +" call Decho("new buf#".bufnr("%")." win#".winnr()) if a:0 > 0 && a1 != "" " call Decho("case 1: Explore ".a1,'~'.expand("")) + call netrw#Explore(0,0,0,a1) exe "Explore ".fnameescape(a1) elseif curfile =~ '^\a\{3,}://' " call Decho("case 2: Explore ".substitute(curfile,'[^/\\]*$','',''),'~'.expand("")) - exe "Explore ".substitute(curfile,'[^/\\]*$','','') + call netrw#Explore(0,0,0,substitute(curfile,'[^/\\]*$','','')) else " call Decho("case 3: Explore .",'~'.expand("")) - Explore . + call netrw#Explore(0,0,0,".") endif if a:count != 0 let g:netrw_winsize = netrw_winsize @@ -1209,6 +1250,8 @@ fun! netrw#Lexplore(count,rightside,...) setlocal winfixwidth let g:netrw_altv = keep_altv let t:netrw_lexbufnr = bufnr("%") +" call Decho("let t:netrw_lexbufnr=".t:netrw_lexbufnr) +" call Decho("t:netrw_lexposn".(exists("t:netrw_lexposn")? string(t:netrw_lexposn) : " n/a")) if exists("t:netrw_lexposn") " call Decho("restoring to t:netrw_lexposn",'~'.expand("")) " call Decho("restoring posn to t:netrw_lexposn<".string(t:netrw_lexposn).">",'~'.expand("")) @@ -1224,6 +1267,7 @@ fun! netrw#Lexplore(count,rightside,...) else let g:netrw_chgwin= 2 endif +" call Decho("let g:netrw_chgwin=".g:netrw_chgwin) endif " call Dret("netrw#Lexplore") @@ -1341,7 +1385,7 @@ fun! netrw#Obtain(islocal,fname,...) " call Decho("transfer files one at a time",'~'.expand("")) for fname in fnamelist " call Decho("system(".g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath).")",'~'.expand("")) - call system(g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath)) + call system(g:netrw_localcopycmd.g:netrw_localcopycmdopt." ".s:ShellEscape(fname)." ".s:ShellEscape(topath)) if v:shell_error != 0 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) " call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath)) @@ -1353,7 +1397,7 @@ fun! netrw#Obtain(islocal,fname,...) " call Decho("transfer files with one command",'~'.expand("")) let filelist= join(map(deepcopy(fnamelist),"s:ShellEscape(v:val)")) " call Decho("system(".g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath).")",'~'.expand("")) - call system(g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath)) + call system(g:netrw_localcopycmd.g:netrw_localcopycmdopt." ".filelist." ".s:ShellEscape(topath)) if v:shell_error != 0 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localcopycmd<".g:netrw_localcopycmd."> to something that works",80) " call Dret("s:NetrwObtain 0 : failed: ".g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath)) @@ -1387,7 +1431,7 @@ fun! netrw#Obtain(islocal,fname,...) else let path= "" endif - let filelist= join(map(deepcopy(fnamelist),'s:ShellEscape(g:netrw_machine.":".path.v:val,1)')) + let filelist= join(map(deepcopy(fnamelist),'escape(s:ShellEscape(g:netrw_machine.":".path.v:val,1)," ")')) call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.s:ShellEscape(useport,1)." ".filelist." ".s:ShellEscape(tgtdir,1)) elseif b:netrw_method == 2 @@ -1562,7 +1606,6 @@ fun! s:NetrwOptionRestore(vt) " call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("")) if !exists("{a:vt}netrw_optionsave") - call s:RestorePosn(s:netrw_nbcd) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("")) " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) " call Dret("s:NetrwOptionRestore : ".a:vt."netrw_optionsave doesn't exist") @@ -1581,47 +1624,45 @@ fun! s:NetrwOptionRestore(vt) endif endif 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_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 - if exists("{a:vt}netrw_comkeep") |let &l:com = {a:vt}netrw_comkeep |unlet {a:vt}netrw_comkeep |endif - if exists("{a:vt}netrw_cpokeep") |let &l:cpo = {a:vt}netrw_cpokeep |unlet {a:vt}netrw_cpokeep |endif - if exists("{a:vt}netrw_diffkeep") |let &l:diff = {a:vt}netrw_diffkeep |unlet {a:vt}netrw_diffkeep |endif - if exists("{a:vt}netrw_fenkeep") |let &l:fen = {a:vt}netrw_fenkeep |unlet {a:vt}netrw_fenkeep |endif - if exists("g:netrw_ffkep") && g:netrw_ffkeep - if exists("{a:vt}netrw_ffkeep") |let &l:ff = {a:vt}netrw_ffkeep |unlet {a:vt}netrw_ffkeep |endif - endif - if exists("{a:vt}netrw_fokeep") |let &l:fo = {a:vt}netrw_fokeep |unlet {a:vt}netrw_fokeep |endif - if exists("{a:vt}netrw_gdkeep") |let &l:gd = {a:vt}netrw_gdkeep |unlet {a:vt}netrw_gdkeep |endif - if exists("{a:vt}netrw_hidkeep") |let &l:hidden = {a:vt}netrw_hidkeep |unlet {a:vt}netrw_hidkeep |endif - if exists("{a:vt}netrw_imkeep") |let &l:im = {a:vt}netrw_imkeep |unlet {a:vt}netrw_imkeep |endif - if exists("{a:vt}netrw_iskkeep") |let &l:isk = {a:vt}netrw_iskkeep |unlet {a:vt}netrw_iskkeep |endif - if exists("{a:vt}netrw_lskeep") |let &l:ls = {a:vt}netrw_lskeep |unlet {a:vt}netrw_lskeep |endif - if exists("{a:vt}netrw_makeep") |let &l:ma = {a:vt}netrw_makeep |unlet {a:vt}netrw_makeep |endif - if exists("{a:vt}netrw_magickeep")|let &l:magic = {a:vt}netrw_magickeep |unlet {a:vt}netrw_magickeep|endif - if exists("{a:vt}netrw_modkeep") |let &l:mod = {a:vt}netrw_modkeep |unlet {a:vt}netrw_modkeep |endif - if exists("{a:vt}netrw_nukeep") |let &l:nu = {a:vt}netrw_nukeep |unlet {a:vt}netrw_nukeep |endif - if exists("{a:vt}netrw_rnukeep") |let &l:rnu = {a:vt}netrw_rnukeep |unlet {a:vt}netrw_rnukeep |endif - if exists("{a:vt}netrw_repkeep") |let &l:report = {a:vt}netrw_repkeep |unlet {a:vt}netrw_repkeep |endif - if exists("{a:vt}netrw_rokeep") |let &l:ro = {a:vt}netrw_rokeep |unlet {a:vt}netrw_rokeep |endif - if exists("{a:vt}netrw_selkeep") |let &l:sel = {a:vt}netrw_selkeep |unlet {a:vt}netrw_selkeep |endif - if exists("{a:vt}netrw_spellkeep")|let &l:spell = {a:vt}netrw_spellkeep |unlet {a:vt}netrw_spellkeep|endif - if has("clipboard") - if exists("{a:vt}netrw_starkeep") |let @* = {a:vt}netrw_starkeep |unlet {a:vt}netrw_starkeep |endif - endif + call s:NetrwRestoreSetting(a:vt."netrw_aikeep","&l:ai") + call s:NetrwRestoreSetting(a:vt."netrw_awkeep","&l:aw") + call s:NetrwRestoreSetting(a:vt."netrw_blkeep","&l:bl") + call s:NetrwRestoreSetting(a:vt."netrw_btkeep","&l:bt") + call s:NetrwRestoreSetting(a:vt."netrw_bombkeep","&l:bomb") + call s:NetrwRestoreSetting(a:vt."netrw_cedit","&cedit") + call s:NetrwRestoreSetting(a:vt."netrw_cikeep","&l:ci") + call s:NetrwRestoreSetting(a:vt."netrw_cinkeep","&l:cin") + call s:NetrwRestoreSetting(a:vt."netrw_cinokeep","&l:cino") + call s:NetrwRestoreSetting(a:vt."netrw_comkeep","&l:com") + call s:NetrwRestoreSetting(a:vt."netrw_cpokeep","&l:cpo") + call s:NetrwRestoreSetting(a:vt."netrw_diffkeep","&l:diff") + call s:NetrwRestoreSetting(a:vt."netrw_fenkeep","&l:fen") + if exists("g:netrw_ffkeep") && g:netrw_ffkeep + call s:NetrwRestoreSetting(a:vt."netrw_ffkeep")","&l:ff") + endif + call s:NetrwRestoreSetting(a:vt."netrw_fokeep","&l:fo") + call s:NetrwRestoreSetting(a:vt."netrw_gdkeep","&l:gd") + call s:NetrwRestoreSetting(a:vt."netrw_hidkeep","&l:hidden") + call s:NetrwRestoreSetting(a:vt."netrw_imkeep","&l:im") + call s:NetrwRestoreSetting(a:vt."netrw_iskkeep","&l:isk") + call s:NetrwRestoreSetting(a:vt."netrw_lskeep","&l:ls") + call s:NetrwRestoreSetting(a:vt."netrw_makeep","&l:ma") + call s:NetrwRestoreSetting(a:vt."netrw_magickeep","&l:magic") + call s:NetrwRestoreSetting(a:vt."netrw_modkeep","&l:mod") + call s:NetrwRestoreSetting(a:vt."netrw_nukeep","&l:nu") + call s:NetrwRestoreSetting(a:vt."netrw_rnukeep","&l:rnu") + call s:NetrwRestoreSetting(a:vt."netrw_repkeep","&l:report") + call s:NetrwRestoreSetting(a:vt."netrw_rokeep","&l:ro") + call s:NetrwRestoreSetting(a:vt."netrw_selkeep","&l:sel") + call s:NetrwRestoreSetting(a:vt."netrw_spellkeep","&l:spell") + call s:NetrwRestoreSetting(a:vt."netrw_twkeep","&l:tw") + call s:NetrwRestoreSetting(a:vt."netrw_wigkeep","&l:wig") + call s:NetrwRestoreSetting(a:vt."netrw_wrapkeep","&l:wrap") + call s:NetrwRestoreSetting(a:vt."netrw_writekeep","&l:write") + call s:NetrwRestoreSetting("s:yykeep","@@") " Problem: start with liststyle=0; press : result, following line resets l:ts. -" if exists("{a:vt}netrw_tskeep") |let &l:ts = {a:vt}netrw_tskeep |unlet {a:vt}netrw_tskeep |endif - if exists("{a:vt}netrw_twkeep") |let &l:tw = {a:vt}netrw_twkeep |unlet {a:vt}netrw_twkeep |endif - if exists("{a:vt}netrw_wigkeep") |let &l:wig = {a:vt}netrw_wigkeep |unlet {a:vt}netrw_wigkeep |endif - if exists("{a:vt}netrw_wrapkeep") |let &l:wrap = {a:vt}netrw_wrapkeep |unlet {a:vt}netrw_wrapkeep |endif - if exists("{a:vt}netrw_writekeep")|let &l:write = {a:vt}netrw_writekeep |unlet {a:vt}netrw_writekeep|endif - if exists("s:yykeep") |let @@ = s:yykeep |unlet s:yykeep |endif + call s:NetrwRestoreSetting(a:vt."netrw_tskeep","&l:ts") + if exists("{a:vt}netrw_swfkeep") if &directory == "" " user hasn't specified a swapfile directory; @@ -1647,10 +1688,10 @@ fun! s:NetrwOptionRestore(vt) endif endif if has("clipboard") - if exists("{a:vt}netrw_regstar") |sil! let @*= {a:vt}netrw_regstar |unlet {a:vt}netrw_regstar |endif - endif - if exists("{a:vt}netrw_regslash")|sil! let @/= {a:vt}netrw_regslash|unlet {a:vt}netrw_regslash|endif - call s:RestorePosn(s:netrw_nbcd) + call s:NetrwRestoreSetting(a:vt."netrw_starkeep","@*") + call s:NetrwRestoreSetting(a:vt."netrw_pluskeep","@+") + endif + call s:NetrwRestoreSetting(a:vt."netrw_slashkeep","@/") " call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("")) " call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist"),'~'.expand("")) @@ -1728,9 +1769,6 @@ fun! s:NetrwOptionSave(vt) if !g:netrw_use_noswf let {a:vt}netrw_swfkeep = &l:swf endif - if has("clipboard") - let {a:vt}netrw_starkeep = @* - endif let {a:vt}netrw_tskeep = &l:ts let {a:vt}netrw_twkeep = &l:tw " textwidth let {a:vt}netrw_wigkeep = &l:wig " wildignore @@ -1743,15 +1781,54 @@ fun! s:NetrwOptionSave(vt) let {a:vt}netrw_dirkeep = getcwd() endif if has("clipboard") - if &go =~# 'a' | sil! let {a:vt}netrw_regstar = @* | endif - endif - sil! let {a:vt}netrw_regslash= @/ + sil! let {a:vt}netrw_starkeep = @* + sil! let {a:vt}netrw_pluskeep = @+ + endif + sil! let {a:vt}netrw_slashkeep= @/ " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("")) " call Dret("s:NetrwOptionSave : tab#".tabpagenr()." win#".winnr()) endfun " ------------------------------------------------------------------------ +" s:NetrwRestoreSetting: restores specified setting using associated keepvar, {{{2 +" but only if the setting value differs from the associated keepvar. +" Doing this means that netrw will not come up as having changed a +" setting last when it really didn't actually change it. +" Used by s:NetrwOptionRestore() to restore each netrw-senstive setting +" and by s:NetrwSafeOptions() +fun! s:NetrwRestoreSetting(keepvar,setting) +" call Dfunc("s:NetrwRestoreSetting(keepvar<".a:keepvar."> setting<".a:setting.">)") + + if a:keepvar =~ '^&' + exe "let keepvarval= ".a:keepvar + if keepvarval != a:setting + if type(a:setting) == 0 + exe "let ".a:keepvar."=".a:setting + elseif type(a:setting) == 1 + exe "let ".a:keepvar."= '".a:setting."'" + else + call netrw#ErrorMsg(s:ERROR,"(s:NetrwRestoreSetting) doesn't know how to restore ".a:keepvar." with a setting of type#".type(a:setting),105) + endif + endif + + elseif exists(a:keepvar) + exe "let keepvarval= '".a:keepvar."'" + if keepvarval != a:setting + if type(a:setting) == 0 + exe "let ".a:keepvar."= ".a:setting + elseif type(a:setting) == 1 + exe "let ".a:keepvar."= '".a:setting."'" + else + call netrw#ErrorMsg(s:ERROR,"(s:NetrwRestoreSetting) doesn't know how to restore ".a:keepvar." with a setting of type#".type(a:setting),105) + endif + endif + exe "unlet ".a:keepvar + endif +" call Dret("s:NetrwRestoreSetting") +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 @@ -1759,32 +1836,32 @@ fun! s:NetrwSafeOptions() " call Dfunc("s:NetrwSafeOptions() win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%"))."> winnr($)=".winnr("$")) " call Decho("win#".winnr()."'s ft=".&ft,'~'.expand("")) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) - if exists("+acd") | setl noacd | endif - setl noai - setl noaw - setl nobl - setl nobomb - setl bt=nofile - setl noci - setl nocin - setl bh=hide - setl cino= - setl com= - setl cpo-=a - setl cpo-=A + if exists("+acd") | call s:NetrwRestoreSetting("&l:acd",0)|endif + call s:NetrwRestoreSetting("&l:ai",0) + call s:NetrwRestoreSetting("&l:aw",0) + call s:NetrwRestoreSetting("&l:bl",0) + call s:NetrwRestoreSetting("&l:bomb",0) + call s:NetrwRestoreSetting("&l:bt","nofile") + call s:NetrwRestoreSetting("&l:ci",0) + call s:NetrwRestoreSetting("&l:cin",0) + call s:NetrwRestoreSetting("&l:bh","hide") + call s:NetrwRestoreSetting("&l:cino","") + call s:NetrwRestoreSetting("&l:com","") + if &cpo =~ 'a' | call s:NetrwRestoreSetting("&cpo",substitute(&cpo,'a','','g')) | endif + if &cpo =~ 'A' | call s:NetrwRestoreSetting("&cpo",substitute(&cpo,'A','','g')) | endif setl fo=nroql2 - setl nohid - setl noim + call s:NetrwRestoreSetting("&l:hid",0) + call s:NetrwRestoreSetting("&l:im",0) setl isk+=@ isk+=* isk+=/ - setl magic + call s:NetrwRestoreSetting("&l:magic",1) if g:netrw_use_noswf - setl noswf - endif - setl report=10000 - setl sel=inclusive - setl nospell - setl tw=0 - setl wig= + call s:NetrwRestoreSetting("swf",0) + endif + call s:NetrwRestoreSetting("&l:report",10000) + call s:NetrwRestoreSetting("&l:sel","inclusive") + call s:NetrwRestoreSetting("&l:spell",0) + call s:NetrwRestoreSetting("&l:tw",0) + call s:NetrwRestoreSetting("&l:wig","") setl cedit& call s:NetrwCursor() @@ -1792,7 +1869,7 @@ fun! s:NetrwSafeOptions() " call Decho("ft<".&ft."> ei=".&ei,'~'.expand("")) if &ft == "netrw" " call Decho("do any netrw FileType autocmds (doau FileType netrw)",'~'.expand("")) - sil! keepalt NetrwKeepj doau FileType netrw + keepalt NetrwKeepj doau FileType netrw endif " call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." bh=".&l:bh." bt<".&bt.">",'~'.expand("")) @@ -1833,7 +1910,7 @@ fun! NetrwStatusLine() endif endfun -" --------------------------------------------------------------------- +" =============================== " Netrw Transfer Functions: {{{1 " =============================== @@ -1943,7 +2020,7 @@ fun! netrw#NetRead(mode,...) " NetRead: Determine method of read (ftp, rcp, etc) {{{3 call s:NetrwMethod(choice) if !exists("b:netrw_method") || b:netrw_method < 0 -" call Dfunc("netrw#NetRead : unsupported method") +" call Dret("netrw#NetRead : unsupported method") return endif let tmpfile= s:GetTempfile(b:netrw_fname) " apply correct suffix @@ -2103,7 +2180,7 @@ fun! netrw#NetRead(mode,...) else let tmpfile_get = tmpfile endif - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)." ".s:ShellEscape(tmpfile_get,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.useport." ".escape(s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1),' ')." ".s:ShellEscape(tmpfile_get,1)) let result = s:NetrwGetFile(readcmd, tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -2185,7 +2262,7 @@ fun! netrw#NetRead(mode,...) " NetRead: (rsync) NetRead Method #7 {{{3 elseif b:netrw_method == 7 " call Decho("read via rsync (method #7)",'~'.expand("")) - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".s:ShellEscape(g:netrw_machine.g:netrw_rsync_sep.b:netrw_fname,1)." ".s:ShellEscape(tmpfile,1)) let result = s:NetrwGetFile(readcmd,tmpfile, b:netrw_method) let b:netrw_lastfile = choice @@ -2527,7 +2604,7 @@ fun! netrw#NetWrite(...) range let url= g:netrw_choice call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_http_put_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(url,1) ) elseif !exists("g:netrw_quiet") - call netrw#ErrorMsg(s:ERROR,"can't write to http using <".g:netrw_http_put_cmd".">".",16) + call netrw#ErrorMsg(s:ERROR,"can't write to http using <".g:netrw_http_put_cmd.">".",16) endif "......................................... @@ -2571,7 +2648,7 @@ fun! netrw#NetWrite(...) range " NetWrite: (rsync) NetWrite Method #7 {{{3 elseif b:netrw_method == 7 " call Decho("write via rsync (method #7)",'~'.expand("")) - call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(g:netrw_machine.":".b:netrw_fname,1)) + call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_rsync_cmd." ".s:ShellEscape(tmpfile,1)." ".s:ShellEscape(g:netrw_machine.g:netrw_rsync_sep.b:netrw_fname,1)) let b:netrw_lastfile = choice "......................................... @@ -2676,9 +2753,13 @@ endfun " --------------------------------------------------------------------- " netrw#SetTreetop: resets the tree top to the current directory/specified directory {{{2 " (implements the :Ntree command) -fun! netrw#SetTreetop(...) -" call Dfunc("netrw#SetTreetop(".((a:0 > 0)? a:1 : "").") a:0=".a:0) - +fun! netrw#SetTreetop(iscmd,...) +" call Dfunc("netrw#SetTreetop(iscmd=".a:iscmd." ".((a:0 > 0)? a:1 : "").") a:0=".a:0) +" call Decho("w:netrw_treetop<".w:netrw_treetop.">") + + " iscmd==0: netrw#SetTreetop called using gn mapping + " iscmd==1: netrw#SetTreetop called using :Ntree from the command line +" call Decho("(iscmd=".a:iscmd.": called using :Ntree from command line",'~'.expand("")) " clear out the current tree if exists("w:netrw_treetop") " call Decho("clearing out current tree",'~'.expand("")) @@ -2689,8 +2770,9 @@ fun! netrw#SetTreetop(...) " call Decho("freeing w:netrw_treedict",'~'.expand("")) unlet w:netrw_treedict endif - - if a:1 == "" && exists("inittreetop") +" call Decho("inittreetop<".(exists("inittreetop")? inittreetop : "n/a").">") + + if (a:iscmd == 0 || a:1 == "") && exists("inittreetop") let treedir= s:NetrwTreePath(inittreetop) " call Decho("treedir<".treedir.">",'~'.expand("")) else @@ -2699,7 +2781,7 @@ fun! netrw#SetTreetop(...) let treedir= a:1 elseif exists("b:netrw_curdir") && (isdirectory(s:NetrwFile(b:netrw_curdir."/".a:1)) || a:1 =~ '^\a\{3,}://') let treedir= b:netrw_curdir."/".a:1 -" call Decho("a:1<".a:1."> is NOT a directory, trying treedir<".treedir.">",'~'.expand("")) +" call Decho("a:1<".a:1."> is NOT a directory, using treedir<".treedir.">",'~'.expand("")) else " normally the cursor is left in the message window. " However, here this results in the directory being listed in the message window, which is not wanted. @@ -2710,13 +2792,18 @@ fun! netrw#SetTreetop(...) endif endif " call Decho("treedir<".treedir.">",'~'.expand("")) + + " determine if treedir is remote or local let islocal= expand("%") !~ '^\a\{3,}://' " call Decho("islocal=".islocal,'~'.expand("")) + + " browse the resulting directory if islocal call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(islocal,treedir)) else call s:NetrwBrowse(islocal,s:NetrwBrowseChgDir(islocal,treedir)) endif + " call Dret("netrw#SetTreetop") endfun @@ -2755,8 +2842,7 @@ fun! s:NetrwGetFile(readcmd, tfile, meth else let tfile= a:tfile endif -" call Decho("exe sil! keepalt file ".fnameescape(tfile),'~'.expand("")) - exe "sil! keepalt file ".fnameescape(tfile) + call s:NetrwBufRename(tfile) " edit temporary file (ie. read the temporary file in) if rfile =~ '\.zip$' @@ -2783,8 +2869,7 @@ fun! s:NetrwGetFile(readcmd, tfile, meth endif " rename buffer back to remote filename -" call Decho("exe sil! keepalt file ".fnameescape(rfile),'~'.expand("")) - exe "sil! NetrwKeepj keepalt file ".fnameescape(rfile) + call s:NetrwBufRename(rfile) " Detect filetype of local version of remote file. " Note that isk must not include a "/" for scripts.vim @@ -2793,7 +2878,7 @@ fun! s:NetrwGetFile(readcmd, tfile, meth let iskkeep= &l:isk setl isk-=/ let &l:isk= iskkeep -" call Dredir("renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">","ls!") +" call Dredir("ls!","NetrwGetFile (renamed buffer back to remote filename<".rfile."> : expand(%)<".expand("%").">)") let line1 = 1 let line2 = line("$") @@ -2864,13 +2949,13 @@ endfun " g:netrw_port = optional port number (for ftp) " g:netrw_choice = copy of input url (choice) fun! s:NetrwMethod(choice) -" call Dfunc("NetrwMethod(a:choice<".a:choice.">)") +" call Dfunc("s:NetrwMethod(a:choice<".a:choice.">)") " sanity check: choice should have at least three slashes in it if strlen(substitute(a:choice,'[^/]','','g')) < 3 call netrw#ErrorMsg(s:ERROR,"not a netrw-style url; netrw uses protocol://[user@]hostname[:port]/[path])",78) let b:netrw_method = -1 -" call Dret("NetrwMethod : incorrect url format<".a:choice.">") +" call Dret("s:NetrwMethod : incorrect url format<".a:choice.">") return endif @@ -2983,7 +3068,7 @@ fun! s:NetrwMethod(choice) endif if curmachine != g:netrw_machine - if exists("s:netwr_hup[".g:netrw_machine."]") + if exists("s:netrw_hup[".g:netrw_machine."]") call NetUserPass("ftp:".g:netrw_machine) elseif exists("s:netrw_passwd") " if there's a change in hostname, require password re-entry @@ -3113,7 +3198,7 @@ fun! s:NetrwMethod(choice) " call Decho("s:netrw_passwd <".s:netrw_passwd.">",'~'.expand("")) " endif "Decho " call Decho("b:netrw_fname <".b:netrw_fname.">",'~'.expand("")) -" call Dret("NetrwMethod : b:netrw_method=".b:netrw_method." g:netrw_port=".g:netrw_port) +" call Dret("s:NetrwMethod : b:netrw_method=".b:netrw_method." g:netrw_port=".g:netrw_port) endfun " ------------------------------------------------------------------------ @@ -3257,9 +3342,9 @@ fun! NetUserPass(...) " call Dret("NetUserPass : uid<".g:netrw_uid."> passwd<".s:netrw_passwd.">") endfun -" =========================================== +" ================================= " Shared Browsing Support: {{{1 -" =========================================== +" ================================= " --------------------------------------------------------------------- " s:ExplorePatHls: converts an Explore pattern into a regular expression search pattern {{{2 @@ -3562,7 +3647,7 @@ fun! s:NetrwBrowse(islocal,dirname) " call Dfunc("s:NetrwBrowse(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".w:netrw_liststyle." ".g:loaded_netrw." buf#".bufnr("%")."<".bufname("%")."> win#".winnr()) " call Decho("modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("")) " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) -" call Dredir("ls!") +" call Dredir("ls!","s:NetrwBrowse") " save alternate-file's filename if w:netrw_rexlocal doesn't exist " This is useful when one edits a local file, then :e ., then :Rex @@ -3583,6 +3668,12 @@ fun! s:NetrwBrowse(islocal,dirname) let dirname= a:dirname endif + " repoint t:netrw_lexbufnr if appropriate + if exists("t:netrw_lexbufnr") && bufnr("%") == t:netrw_lexbufnr +" call Decho("set repointlexbufnr to true!") + let repointlexbufnr= 1 + endif + if exists("s:netrw_skipbrowse") unlet s:netrw_skipbrowse " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." filename<".expand("%")."> win#".winnr()." ft<".&ft.">",'~'.expand("")) @@ -3606,17 +3697,22 @@ fun! s:NetrwBrowse(islocal,dirname) call s:NetrwOptionSave("w:") " s:NetrwBrowse : re-instate any marked files {{{3 - if exists("s:netrwmarkfilelist_{bufnr('%')}") -" call Decho("clearing marked files",'~'.expand("")) - exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" + if has("syntax") && exists("g:syntax_on") && g:syntax_on + if exists("s:netrwmarkfilelist_{bufnr('%')}") +" call Decho("clearing marked files",'~'.expand("")) + exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" + endif 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:",'~'.expand("")) " call Decho("NetrwKeepj lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")",'~'.expand("")) - call s:NetrwLcd(dirname) - call s:NetrwSafeOptions() + if s:NetrwLcd(dirname) +" call Dret("s:NetrwBrowse : lcd failure") + return + endif + " call s:NetrwSafeOptions() " tst953 failed with this enabled. " call Decho("getcwd<".getcwd().">",'~'.expand("")) elseif !a:islocal && dirname !~ '[\/]$' && dirname !~ '^"' @@ -3643,8 +3739,7 @@ fun! s:NetrwBrowse(islocal,dirname) " call Decho("setl ma noro",'~'.expand("")) let b:netrw_curdir = dirname let url = s:method."://".((s:user == "")? "" : s:user."@").s:machine.(s:port ? ":".s:port : "")."/".s:path -" call Decho("exe sil! keepalt file ".fnameescape(url)." (bt=".&bt.")",'~'.expand("")) - exe "sil! NetrwKeepj keepalt file ".fnameescape(url) + call s:NetrwBufRename(url) exe "sil! NetrwKeepj keepalt doau BufReadPre ".fnameescape(s:fname) sil call netrw#NetRead(2,url) " netrw.vim and tar.vim have already handled decompression of the tarball; avoiding gzip.vim error @@ -3691,13 +3786,15 @@ 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('%'),'~'.expand("")) -" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/",'~'.expand("")) - exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" - else -" call Decho("2match none",'~'.expand("")) - 2match none + if has("syntax") && exists("g:syntax_on") && g:syntax_on + if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" +" " call Decho("bufnr(%)=".bufnr('%'),'~'.expand("")) +" " call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/",'~'.expand("")) + exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" + else +" " call Decho("2match none",'~'.expand("")) + 2match none + endif endif if reusing && line("$") > 1 call s:NetrwOptionRestore("w:") @@ -3746,7 +3843,10 @@ fun! s:NetrwBrowse(islocal,dirname) " call Decho("handle g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("")) " call Decho("l:acd".(exists("&l:acd")? "=".&l:acd : " doesn't exist"),'~'.expand("")) if !exists("&l:acd") || !&l:acd - call s:NetrwLcd(b:netrw_curdir) + if s:NetrwLcd(b:netrw_curdir) +" call Dret("s:NetrwBrowse : lcd failure") + return + endif endif endif @@ -3817,6 +3917,12 @@ fun! s:NetrwBrowse(islocal,dirname) setl beval endif + " repoint t:netrw_lexbufnr if appropriate + if exists("repointlexbufnr") + let t:netrw_lexbufnr= bufnr("%") +" call Decho("repoint t:netrw_lexbufnr to #".t:netrw_lexbufnr) + endif + " restore position if reusing " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) @@ -3960,31 +4066,59 @@ fun! s:NetrwFullPath(filename) endfun " --------------------------------------------------------------------- -" s:NetrwGetBuffer: {{{2 +" s:NetrwGetBuffer: [get a new|find an old netrw] buffer for a netrw listing {{{2 " returns 0=cleared buffer " 1=re-used buffer (buffer not cleared) fun! s:NetrwGetBuffer(islocal,dirname) " call Dfunc("s:NetrwGetBuffer(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".g:netrw_liststyle) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) -" call Decho("netrwbuf dictionary=".string(s:netrwbuf),'~'.expand("")) +" call Decho("netrwbuf dictionary=".(exists("s:netrwbuf")? string(s:netrwbuf) : 'n/a'),'~'.expand("")) let dirname= a:dirname " re-use buffer if possible {{{3 " call Decho("--re-use a buffer if possible--",'~'.expand("")) if !exists("s:netrwbuf") +" call Decho(" s:netrwbuf initialized to {}",'~'.expand("")) let s:netrwbuf= {} endif - if has_key(s:netrwbuf,s:NetrwFullPath(dirname)) +" call Decho(" s:netrwbuf =".string(s:netrwbuf),'~'.expand("")) +" call Decho(" w:netrw_liststyle =".(exists("w:netrw_liststyle")? w:netrw_liststyle : "n/a"),'~'.expand("")) + + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST + let bufnum = -1 + + if !empty(s:netrwbuf) && has_key(s:netrwbuf,s:NetrwFullPath(dirname)) + if has_key(s:netrwbuf,"NetrwTreeListing") + let bufnum= s:netrwbuf["NetrwTreeListing"] + else + let bufnum= s:netrwbuf[s:NetrwFullPath(dirname)] + endif +" call Decho(" NetrwTreeListing: bufnum#".bufnum,'~'.expand("")) + if !bufexists(bufnum) + call remove(s:netrwbuf,"NetrwTreeListing"]) + let bufnum= -1 + endif + elseif bufnr("NetrwTreeListing") != -1 + let bufnum= bufnr("NetrwTreeListing") +" call Decho(" NetrwTreeListing".": bufnum#".bufnum,'~'.expand("")) + else +" call Decho(" did not find a NetrwTreeListing buffer",'~'.expand("")) + let bufnum= -1 + endif + + elseif has_key(s:netrwbuf,s:NetrwFullPath(dirname)) let bufnum= s:netrwbuf[s:NetrwFullPath(dirname)] -" call Decho("lookup netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."]=".bufnum) +" call Decho(" lookup netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."]=".bufnum,'~'.expand("")) if !bufexists(bufnum) call remove(s:netrwbuf,s:NetrwFullPath(dirname)) let bufnum= -1 endif - else -" call Decho("lookup netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."] not a key") + + else +" call Decho(" lookup netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."] not a key",'~'.expand("")) let bufnum= -1 endif +" call Decho(" bufnum#".bufnum,'~'.expand("")) " get enew buffer and name it -or- re-use buffer {{{3 if bufnum < 0 " get enew buffer and name it @@ -3995,14 +4129,8 @@ fun! s:NetrwGetBuffer(islocal,dirname) 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 --",'~'.expand("")) - if !exists("s:netrw_treelistnum") - let s:netrw_treelistnum= 1 - else - let s:netrw_treelistnum= s:netrw_treelistnum + 1 - endif - let w:netrw_treebufnr= bufnr("%") -" call Decho(" exe sil! keepalt file NetrwTreeListing ".fnameescape(s:netrw_treelistnum),'~'.expand("")) - exe 'sil! keepalt file NetrwTreeListing\ '.fnameescape(s:netrw_treelistnum) + let w:netrw_treebufnr = bufnr("%") + call s:NetrwBufRename("NetrwTreeListing") if g:netrw_use_noswf setl nobl bt=nofile noswf else @@ -4012,15 +4140,9 @@ fun! s:NetrwGetBuffer(islocal,dirname) nnoremap ]] :sil call TreeListMove(']]') nnoremap [] :sil call TreeListMove('[]') nnoremap ][ :sil call TreeListMove('][') -" call Decho(" tree listing#".s:netrw_treelistnum." bufnr=".w:netrw_treebufnr,'~'.expand("")) - else -" let v:errmsg = "" " Decho - let escdirname = fnameescape(dirname) -" call Decho(" errmsg<".v:errmsg."> bufnr(escdirname<".escdirname.">)=".bufnr(escdirname)." bufname()<".bufname(bufnr(escdirname)).">",'~'.expand("")) -" call Decho(' exe sil! keepalt file '.escdirname,'~'.expand("")) -" let v:errmsg= "" " Decho - exe 'sil! keepj keepalt file '.escdirname -" call Decho(" errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">",'~'.expand("")) +" call Decho(" tree listing bufnr=".w:netrw_treebufnr,'~'.expand("")) + else + call s:NetrwBufRename(dirname) " enter the new buffer into the s:netrwbuf dictionary let s:netrwbuf[s:NetrwFullPath(dirname)]= bufnr("%") " call Decho("update netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."]=".bufnr("%"),'~'.expand("")) @@ -4041,8 +4163,7 @@ fun! s:NetrwGetBuffer(islocal,dirname) endif " call Decho(" line($)=".line("$"),'~'.expand("")) if bufname("%") == '.' -" call Decho("exe sil! keepalt file ".fnameescape(getcwd()),'~'.expand("")) - exe "sil! NetrwKeepj keepalt file ".fnameescape(getcwd()) + call s:NetrwBufRename(getcwd()) endif let &ei= eikeep @@ -4066,6 +4187,7 @@ fun! s:NetrwGetBuffer(islocal,dirname) elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST " call Decho("--re-use tree listing--",'~'.expand("")) " call Decho(" clear buffer<".expand("%")."> with :%d",'~'.expand("")) + setl ma sil NetrwKeepj %d _ NetrwKeepj call s:NetrwListSettings(a:islocal) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) @@ -4089,8 +4211,7 @@ fun! s:NetrwGetBuffer(islocal,dirname) " call Decho("--do netrw settings: make this buffer#".bufnr("%")." not-a-file, modifiable, not line-numbered, etc--",'~'.expand("")) let fname= expand("%") NetrwKeepj call s:NetrwListSettings(a:islocal) -" call Decho("exe sil! keepalt file ".fnameescape(fname),'~'.expand("")) - exe "sil! NetrwKeepj keepalt file ".fnameescape(fname) + call s:NetrwBufRename(fname) " delete all lines from buffer {{{3 " call Decho("--delete all lines from buffer--",'~'.expand("")) @@ -4233,19 +4354,21 @@ fun! s:NetrwGetWord() endfun " --------------------------------------------------------------------- -" s:NetrwListSettings: make standard settings for a netrw listing {{{2 +" s:NetrwListSettings: make standard settings for making a netrw listing {{{2 +" g:netrw_bufsettings will be used after the listing is produced. +" Called by s:NetrwGetBuffer() fun! s:NetrwListSettings(islocal) " call Dfunc("s:NetrwListSettings(islocal=".a:islocal.")") " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) let fname= bufname("%") " " call Decho("(NetrwListSettings) setl bt=nofile nobl ma nonu nowrap noro nornu",'~'.expand("")) - setl bt=nofile nobl ma nonu nowrap noro nornu -" call Decho("(NetrwListSettings) exe sil! keepalt file ".fnameescape(fname),'~'.expand("")) - exe "sil! keepalt file ".fnameescape(fname) + " nobl noma nomod nonu noma nowrap ro nornu (std g:netrw_bufsettings) + setl bt=nofile nobl ma nonu nowrap noro nornu + call s:NetrwBufRename(fname) if g:netrw_use_noswf setl noswf endif -" call Dredir("ls!") +" call Dredir("ls!","s:NetrwListSettings") " call Decho("(NetrwListSettings) exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("")) exe "setl ts=".(g:netrw_maxfilenamelen+1) setl isk+=.,~,- @@ -4259,7 +4382,7 @@ fun! s:NetrwListSettings(islocal) endfun " --------------------------------------------------------------------- -" s:NetrwListStyle: {{{2 +" s:NetrwListStyle: change list style (thin - long - wide - tree) {{{2 " islocal=0: remote browsing " =1: local browsing fun! s:NetrwListStyle(islocal) @@ -4275,6 +4398,12 @@ fun! s:NetrwListStyle(islocal) " call Decho("chgd w:netrw_liststyle to ".w:netrw_liststyle,'~'.expand("")) " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">",'~'.expand("")) + " repoint t:netrw_lexbufnr if appropriate + if exists("t:netrw_lexbufnr") && bufnr("%") == t:netrw_lexbufnr +" call Decho("set repointlexbufnr to true!") + let repointlexbufnr= 1 + endif + if w:netrw_liststyle == s:THINLIST " use one column listing " call Decho("use one column list",'~'.expand("")) @@ -4316,6 +4445,12 @@ fun! s:NetrwListStyle(islocal) NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) NetrwKeepj call s:NetrwCursor() + " repoint t:netrw_lexbufnr if appropriate + if exists("repointlexbufnr") + let t:netrw_lexbufnr= bufnr("%") +" call Decho("repoint t:netrw_lexbufnr to #".t:netrw_lexbufnr) + endif + " restore position; keep cursor on the filename " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("")) NetrwKeepj call winrestview(svpos) @@ -4339,12 +4474,14 @@ fun! s:NetrwBannerCtrl(islocal) call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) " keep cursor on the filename - let fname= s:NetrwGetWord() - sil NetrwKeepj $ - let result= search('\%(^\%(|\+\s\)\=\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bc') -" call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A'),'~'.expand("")) - if result <= 0 && exists("w:netrw_bannercnt") - exe "NetrwKeepj ".w:netrw_bannercnt + if g:netrw_banner && exists("w:netrw_bannercnt") && line(".") >= w:netrw_bannercnt + let fname= s:NetrwGetWord() + sil NetrwKeepj $ + let result= search('\%(^\%(|\+\s\)\=\|\s\{2,}\)\zs'.escape(fname,'.\[]*$^').'\%(\s\{2,}\|$\)','bc') +" " call Decho("search result=".result." w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'N/A'),'~'.expand("")) + if result <= 0 && exists("w:netrw_bannercnt") + exe "NetrwKeepj ".w:netrw_bannercnt + endif endif let @@= ykeep " call Dret("s:NetrwBannerCtrl : g:netrw_banner=".g:netrw_banner) @@ -4506,7 +4643,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir, let @@= ykeep " call Decho("b:netrw_curdir doesn't exist!",'~'.expand("")) " call Decho("getcwd<".getcwd().">",'~'.expand("")) -" call Dredir("ls!") +" call Dredir("ls!","s:NetrwBrowseChgDir") " call Dret("s:NetrwBrowseChgDir") return endif @@ -4514,7 +4651,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir, " NetrwBrowseChgDir: save options and initialize {{{3 " call Decho("saving options",'~'.expand("")) - call s:SavePosn(s:netrw_nbcd) + call s:SavePosn(s:netrw_posn) NetrwKeepj call s:NetrwOptionSave("s:") NetrwKeepj call s:NetrwSafeOptions() if (has("win32") || has("win95") || has("win64") || has("win16")) @@ -4539,7 +4676,6 @@ fun! s:NetrwBrowseChgDir(islocal,newdir, setl ma noro nowrap NetrwKeepj call setline(line('.'),'" Quick Help: :help '.s:QuickHelp[g:netrw_quickhelp]) setl noma nomod nowrap - call s:RestorePosn(s:netrw_nbcd) NetrwKeepj call s:NetrwOptionRestore("s:") " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) endif @@ -4869,7 +5005,6 @@ fun! s:NetrwBrowseChgDir(islocal,newdir, " else " Decho " call Decho("skipping option restore (dorestore==0): hidden=".&hidden." bufhidden=".&bufhidden." mod=".&mod,'~'.expand("")) endif - call s:RestorePosn(s:netrw_nbcd) if dolockout && dorestore " call Decho("restore: filewritable(dirname<".dirname.">)=".filewritable(dirname),'~'.expand("")) if filewritable(dirname) @@ -4884,6 +5019,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir, " call Decho("restore: ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) endif endif + call s:RestorePosn(s:netrw_posn) let @@= ykeep " call Dret("s:NetrwBrowseChgDir <".dirname."> : curpos<".string(getpos(".")).">") @@ -4905,10 +5041,6 @@ fun! s:NetrwBrowseUpDir(islocal) return endif - if !exists("w:netrw_liststyle") || w:netrw_liststyle != s:TREELIST - call s:SavePosn(s:netrw_nbcd) - endif - norm! 0 if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " call Decho("case: treestyle",'~'.expand("")) @@ -4916,28 +5048,40 @@ fun! s:NetrwBrowseUpDir(islocal) let swwline= winline() - 1 if exists("w:netrw_treetop") let b:netrw_curdir= w:netrw_treetop - endif - let curdir= b:netrw_curdir + elseif exists("b:netrw_curdir") + let w:netrw_treetop= b:netrw_curdir + else + let w:netrw_treetop= getcwd() + let b:netrw_curdir = w:netrw_treetop + endif + let curfile = getline(".") + let curpath = s:NetrwTreePath(w:netrw_treetop) if a:islocal call netrw#LocalBrowseCheck(s:NetrwBrowseChgDir(1,'../')) else call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,'../')) endif - if !search('\c^'.s:treedepthstring.curline,'cw') - if !search('\c^'.curline,'cw') - sil! NetrwKeepj 1 - endif - endif - exe "sil! NetrwKeepj norm! z\" - while winline() < swwline - let curwinline= winline() - exe "sil! NetrwKeepj norm! \" - if curwinline == winline() - break - endif - endwhile +" call Decho("looking for curfile<^".s:treedepthstring.curfile.">",'~'.expand("")) +" call Decho("having curpath<".curpath.">",'~'.expand("")) + if w:netrw_treetop == '/' + keepj call search('^\M'.curfile,"w") + elseif curfile == '../' + keepj call search('^\M'.curfile,"wb") + else +" call Decho("search(^\\M".s:treedepthstring.curfile.") backwards")) + while 1 + keepj call search('^\M'.s:treedepthstring.curfile,"wb") + let treepath= s:NetrwTreePath(w:netrw_treetop) +" call Decho("..current treepath<".treepath.">",'~'.expand("")) + if treepath == curpath + break + endif + endwhile + endif + else " call Decho("case: not treestyle",'~'.expand("")) + call s:SavePosn(s:netrw_posn) if exists("b:netrw_curdir") let curdir= b:netrw_curdir else @@ -4948,17 +5092,10 @@ fun! s:NetrwBrowseUpDir(islocal) else call s:NetrwBrowse(0,s:NetrwBrowseChgDir(0,'../')) endif - if has_key(s:netrw_nbcd,bufnr("%")) - call s:RestorePosn(s:netrw_nbcd) - elseif exists("w:netrw_bannercnt") -" call Decho("moving to line#".w:netrw_bannercnt,'~'.expand("")) - exe w:netrw_bannercnt - else - 1 - endif - endif - let curdir= substitute(curdir,'^.*[\/]','','') - call search('\<'.curdir.'\>','wc') + call s:RestorePosn(s:netrw_posn) + let curdir= substitute(curdir,'^.*[\/]','','') + call search('\<'.curdir.'/','wc') + endif " call Dret("s:NetrwBrowseUpDir") endfun @@ -4969,16 +5106,15 @@ endfun fun! netrw#BrowseX(fname,remote) " call Dfunc("netrw#BrowseX(fname<".a:fname."> remote=".a:remote.")") - " if its really just a directory, then do a "gf" instead - if (a:remote == 0 && isdirectory(a:fname)) || (a:remote == 1 && fname =~ '/$' && fname !~ '^https\=:') + " if its really just a local directory, then do a "gf" instead + if (a:remote == 0 && isdirectory(a:fname)) || (a:remote == 1 && a:fname =~ '/$' && a:fname !~ '^https\=:') norm! gf -" call Dret("netrw#BrowseX : did gf instead") - endif - +" call Dret("(netrw#BrowseX) did gf instead") + endif let ykeep = @@ let screenposn = winsaveview() -" call Decho("saving posn to screenposn<".string(screenposn).">",'~'.expand("")) +" call Decho("(netrw#BrowseX) saving posn to screenposn<".string(screenposn).">",'~'.expand("")) " need to save and restore aw setting as gx can invoke this function from non-netrw buffers let awkeep = &aw @@ -4989,18 +5125,18 @@ fun! netrw#BrowseX(fname,remote) if exists("g:Netrw_corehandler") if type(g:Netrw_corehandler) == 2 " g:Netrw_corehandler is a function reference (see :help Funcref) -" call Decho("g:Netrw_corehandler is a funcref",'~'.expand("")) +" call Decho("(netrw#BrowseX) g:Netrw_corehandler is a funcref",'~'.expand("")) call g:Netrw_corehandler(s:NetrwFile(a:fname)) elseif type(g:Netrw_corehandler) == 3 " g:Netrw_corehandler is a List of function references (see :help Funcref) -" call Decho("g:Netrw_corehandler is a List",'~'.expand("")) +" call Decho("(netrw#BrowseX) g:Netrw_corehandler is a List",'~'.expand("")) for Fncref in g:Netrw_corehandler if type(FncRef) == 2 call FncRef(a:fname) endif endfor endif -" call Decho("restoring posn to screenposn<".string(screenposn).">,'~'.expand(""))" +" call Decho("(netrw#BrowseX) restoring posn: screenposn<".string(screenposn).">,'~'.expand(""))" call winrestview(screenposn) let @@= ykeep let &aw= awkeep @@ -5015,27 +5151,36 @@ fun! netrw#BrowseX(fname,remote) if has("win32") || has("win95") || has("win64") || has("win16") let exten= substitute(exten,'^.*$','\L&\E','') endif -" call Decho("exten<".exten.">",'~'.expand("")) + if exten =~ "[\\/]" + let exten= "" + endif +" call Decho("(netrw#BrowseX) exten<".exten.">",'~'.expand("")) if a:remote == 1 " create a local copy -" call Decho("remote: a:remote=".a:remote.": create a local copy of <".a:fname.">",'~'.expand("")) +" call Decho("(netrw#BrowseX) remote: a:remote=".a:remote.": create a local copy of <".a:fname.">",'~'.expand("")) setl bh=delete call netrw#NetRead(3,a:fname) " attempt to rename tempfile let basename= substitute(a:fname,'^\(.*\)/\(.*\)\.\([^.]*\)$','\2','') let newname = substitute(s:netrw_tmpfile,'^\(.*\)/\(.*\)\.\([^.]*\)$','\1/'.basename.'.\3','') -" call Decho("basename<".basename.">",'~'.expand("")) -" call Decho("newname <".newname.">",'~'.expand("")) - if rename(s:netrw_tmpfile,newname) == 0 - " renaming succeeded - let fname= newname - else - " renaming failed +" call Decho("(netrw#BrowseX) basename<".basename.">",'~'.expand("")) +" call Decho("(netrw#BrowseX) newname <".newname.">",'~'.expand("")) + if s:netrw_tmpfile != newname && newname != "" + if rename(s:netrw_tmpfile,newname) == 0 + " renaming succeeded +" call Decho("(netrw#BrowseX) renaming succeeded (tmpfile<".s:netrw_tmpfile."> to <".newname.">)") + let fname= newname + else + " renaming failed +" call Decho("(netrw#BrowseX) renaming failed (tmpfile<".s:netrw_tmpfile."> to <".newname.">)") + let fname= s:netrw_tmpfile + endif + else let fname= s:netrw_tmpfile endif else -" call Decho("local: a:remote=".a:remote.": handling local copy of <".a:fname.">",'~'.expand("")) +" call Decho("(netrw#BrowseX) local: a:remote=".a:remote.": handling local copy of <".a:fname.">",'~'.expand("")) let fname= a:fname " special ~ handler for local if fname =~ '^\~' && expand("$HOME") != "" @@ -5043,8 +5188,8 @@ fun! netrw#BrowseX(fname,remote) let fname= s:NetrwFile(substitute(fname,'^\~',expand("$HOME"),'')) endif endif -" call Decho("fname<".fname.">",'~'.expand("")) -" call Decho("exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten),'~'.expand("")) +" call Decho("(netrw#BrowseX) fname<".fname.">",'~'.expand("")) +" call Decho("(netrw#BrowseX) exten<".exten."> "."netrwFileHandlers#NFH_".exten."():exists=".exists("*netrwFileHandlers#NFH_".exten),'~'.expand("")) " set up redirection (avoids browser messages) " by default, g:netrw_suppress_gx_mesg is true @@ -5061,12 +5206,12 @@ fun! netrw#BrowseX(fname,remote) let redir= &srr . "/dev/null" endif endif -" call Decho("set up redirection: redir{".redir."} srr{".&srr."}",'~'.expand("")) +" call Decho("(netrw#BrowseX) set up redirection: redir{".redir."} srr{".&srr."}",'~'.expand("")) " extract any viewing options. Assumes that they're set apart by quotes. -" call Decho("extract any viewing options",'~'.expand("")) +" call Decho("(netrw#BrowseX) extract any viewing options",'~'.expand("")) if exists("g:netrw_browsex_viewer") -" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("")) +" call Decho("(netrw#BrowseX) g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("")) if g:netrw_browsex_viewer =~ '\s' let viewer = substitute(g:netrw_browsex_viewer,'\s.*$','','') let viewopt = substitute(g:netrw_browsex_viewer,'^\S\+\s*','','')." " @@ -5077,28 +5222,28 @@ fun! netrw#BrowseX(fname,remote) let viewopt = substitute(g:netrw_browsex_viewer,'^\(\(^\S\+\s\+\)\{'.cnt.'}\S\+\)\(.*\)$','\3','')." " let cnt = cnt + 1 let oviewer = viewer -" call Decho("!exe: viewer<".viewer."> viewopt<".viewopt.">",'~'.expand("")) +" call Decho("(netrw#BrowseX) !exe: viewer<".viewer."> viewopt<".viewopt.">",'~'.expand("")) endwhile else let viewer = g:netrw_browsex_viewer let viewopt = "" endif -" call Decho("viewer<".viewer."> viewopt<".viewopt.">",'~'.expand("")) +" call Decho("(netrw#BrowseX) viewer<".viewer."> viewopt<".viewopt.">",'~'.expand("")) endif " execute the file handler -" call Decho("execute the file handler (if any)",'~'.expand("")) +" call Decho("(netrw#BrowseX) execute the file handler (if any)",'~'.expand("")) if exists("g:netrw_browsex_viewer") && g:netrw_browsex_viewer == '-' -" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("")) +" call Decho("(netrw#BrowseX) g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("")) let ret= netrwFileHandlers#Invoke(exten,fname) elseif exists("g:netrw_browsex_viewer") && executable(viewer) -" call Decho("g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("")) +" call Decho("(netrw#BrowseX) g:netrw_browsex_viewer<".g:netrw_browsex_viewer.">",'~'.expand("")) call s:NetrwExe("sil !".viewer." ".viewopt.s:ShellEscape(fname,1).redir) let ret= v:shell_error elseif has("win32") || has("win64") -" call Decho("windows",'~'.expand("")) +" call Decho("(netrw#BrowseX) win".(has("win32")? "32" : "64")",'~'.expand("")) if executable("start") call s:NetrwExe('sil! !start rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(fname,1)) elseif executable("rundll32") @@ -5106,12 +5251,12 @@ fun! netrw#BrowseX(fname,remote) else call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) endif - call inputsave()|call input("Press to continue")|call inputrestore() + " call inputsave()|call input("Press to continue")|call inputrestore() let ret= v:shell_error elseif has("win32unix") let winfname= 'c:\cygwin'.substitute(fname,'/','\\','g') -" call Decho("cygwin: winfname<".s:ShellEscape(winfname,1).">",'~'.expand("")) +" call Decho("(netrw#BrowseX) cygwin: winfname<".s:ShellEscape(winfname,1).">",'~'.expand("")) if executable("start") call s:NetrwExe('sil !start rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(winfname,1)) elseif executable("rundll32") @@ -5121,26 +5266,31 @@ fun! netrw#BrowseX(fname,remote) else call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) endif - call inputsave()|call input("Press to continue")|call inputrestore() + " call inputsave()|call input("Press to continue")|call inputrestore() let ret= v:shell_error elseif has("unix") && executable("kfmclient") && s:CheckIfKde() -" call Decho("unix and kfmclient",'~'.expand("")) +" call Decho("(netrw#BrowseX) unix and kfmclient",'~'.expand("")) call s:NetrwExe("sil !kfmclient exec ".s:ShellEscape(fname,1)." ".redir) let ret= v:shell_error elseif has("unix") && executable("exo-open") && executable("xdg-open") && executable("setsid") -" call Decho("unix, exo-open, xdg-open",'~'.expand("")) +" call Decho("(netrw#BrowseX) unix, exo-open, xdg-open",'~'.expand("")) call s:NetrwExe("sil !setsid xdg-open ".s:ShellEscape(fname,1).redir) let ret= v:shell_error + elseif has("unix") && $DESKTOP_SESSION == "mate" && executable("atril") +" call Decho("(netrw#BrowseX) unix and atril",'~'.expand("")) + call s:NetrwExe("sil !atril ".s:ShellEscape(fname,1).redir) + let ret= v:shell_error + elseif has("unix") && executable("xdg-open") -" call Decho("unix and xdg-open",'~'.expand("")) +" call Decho("(netrw#BrowseX) unix and xdg-open",'~'.expand("")) call s:NetrwExe("sil !xdg-open ".s:ShellEscape(fname,1).redir) let ret= v:shell_error elseif has("macunix") && executable("open") -" call Decho("macunix and open",'~'.expand("")) +" call Decho("(netrw#BrowseX) macunix and open",'~'.expand("")) call s:NetrwExe("sil !open ".s:ShellEscape(fname,1)." ".redir) let ret= v:shell_error @@ -5175,7 +5325,7 @@ fun! netrw#BrowseX(fname,remote) exe "sil! NetrwKeepj norm! \" " redraw! endif -" call Decho("restoring posn to screenposn<".string(screenposn).">",'~'.expand("")) +" call Decho("(netrw#BrowseX) restoring posn to screenposn<".string(screenposn).">",'~'.expand("")) call winrestview(screenposn) let @@ = ykeep let &aw= awkeep @@ -5184,22 +5334,64 @@ fun! netrw#BrowseX(fname,remote) endfun " --------------------------------------------------------------------- +" netrw#GX: gets word under cursor for gx support {{{2 +" See also: netrw#BrowseXVis +" netrw#BrowseX +fun! netrw#GX() +" call Dfunc("netrw#GX()") + if &ft == "netrw" + let fname= s:NetrwGetWord() + else + let fname= expand((exists("g:netrw_gx")? g:netrw_gx : '')) + endif +" call Dret("netrw#GX <".fname.">") + return fname +endfun + +" --------------------------------------------------------------------- " netrw#BrowseXVis: used by gx in visual mode to select a file for browsing {{{2 fun! netrw#BrowseXVis() " call Dfunc("netrw#BrowseXVis()") let atkeep = @@ norm! gvy " call Decho("@@<".@@.">",'~'.expand("")) - call netrw#BrowseX(@@,netrw#CheckIfRemote()) + call netrw#BrowseX(@@,netrw#CheckIfRemote(@@)) let @@ = atkeep " call Dret("netrw#BrowseXVis") endfun " --------------------------------------------------------------------- +" s:NetrwBufRename: renames a buffer without the side effect of retaining an unlisted buffer having the old name {{{2 +" Using the file command on a "[No Name]" buffer does not seem to cause the old "[No Name]" buffer +" to become an unlisted buffer, so in that case don't bwipe it. +fun! s:NetrwBufRename(newname) +" call Dfunc("s:NetrwBufRename(newname<".a:newname.">) buf(%)#".bufnr("%")."<".bufname(bufnr("%")).">") +" call Dredir("ls!","s:NetrwBufRename (before rename)") + let oldbufname= bufname(bufnr("%")) +" call Decho("buf#".bufnr("%").": oldbufname<".oldbufname.">",'~'.expand("")) + if oldbufname != a:newname +" call Decho("do renaming (oldbufname != a:newname)",'~'.expand("")) + exe 'sil! keepj keepalt file '.fnameescape(a:newname) + let oldbufnr= bufnr(oldbufname) + if oldbufname != "" && oldbufnr != -1 + exe "bwipe! ".oldbufnr + endif + endif +" call Dredir("ls!","s:NetrwBufRename (after rename)") +" call Dret("s:NetrwBufRename : buf#".bufnr("%").": oldname<".oldbufname."> newname<".a:newname."> expand(%)<".expand("%").">") +endfun + +" --------------------------------------------------------------------- " netrw#CheckIfRemote: returns 1 if current file looks like an url, 0 else {{{2 -fun! netrw#CheckIfRemote() -" call Dfunc("netrw#CheckIfRemote()") - if expand("%") =~ '^\a\{3,}://' +fun! netrw#CheckIfRemote(...) +" call Dfunc("netrw#CheckIfRemote() a:0=".a:0) + if a:0 > 0 + let curfile= a:1 + else + let curfile= expand("%") + endif +" call Decho("curfile<".curfile.">") + if curfile =~ '^\a\{3,}://' " call Dret("netrw#CheckIfRemote 1") return 1 else @@ -5465,17 +5657,23 @@ fun! s:NetrwHidden(islocal) " call Dfunc("s:NetrwHidden()") let ykeep= @@ " save current position - let svpos= winsaveview() + let svpos = winsaveview() " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) if g:netrw_list_hide =~ '\(^\|,\)\\(^\\|\\s\\s\\)\\zs\\.\\S\\+' - " remove pattern from hiding list + " remove .file pattern from hiding list +" call Decho("remove .file pattern from hiding list",'~'.expand("")) let g:netrw_list_hide= substitute(g:netrw_list_hide,'\(^\|,\)\\(^\\|\\s\\s\\)\\zs\\.\\S\\+','','') elseif s:Strlen(g:netrw_list_hide) >= 1 +" call Decho("add .file pattern from hiding list",'~'.expand("")) let g:netrw_list_hide= g:netrw_list_hide . ',\(^\|\s\s\)\zs\.\S\+' else +" call Decho("set .file pattern as hiding list",'~'.expand("")) let g:netrw_list_hide= '\(^\|\s\s\)\zs\.\S\+' endif + if g:netrw_list_hide =~ '^,' + let g:netrw_list_hide= strpart(g:netrw_list_hide,1) + endif " refresh screen and return to saved position NetrwKeepj call s:NetrwRefresh(a:islocal,s:NetrwBrowseChgDir(a:islocal,'./')) @@ -5489,7 +5687,7 @@ endfun " s:NetrwHome: this function determines a "home" for saving bookmarks and history {{{2 fun! s:NetrwHome() if exists("g:netrw_home") - let home= g:netrw_home + let home= expand(g:netrw_home) else " go to vim plugin home for home in split(&rtp,',') + [''] @@ -5510,9 +5708,12 @@ fun! s:NetrwHome() endif " insure that the home directory exists if g:netrw_dirhistmax > 0 && !isdirectory(s:NetrwFile(home)) +" call Decho("insure that the home<".home."> directory exists") if exists("g:netrw_mkdir") +" call Decho("call system(".g:netrw_mkdir." ".s:ShellEscape(s:NetrwFile(home)).")") call system(g:netrw_mkdir." ".s:ShellEscape(s:NetrwFile(home))) else +" call Decho("mkdir(".home.")") call mkdir(home) endif endif @@ -5526,6 +5727,9 @@ fun! s:NetrwLeftmouse(islocal) if exists("s:netrwdrag") return endif + if &ft != "netrw" + return + endif " call Dfunc("s:NetrwLeftmouse(islocal=".a:islocal.")") let ykeep= @@ @@ -5573,6 +5777,9 @@ endfun " --------------------------------------------------------------------- " s:NetrwCLeftmouse: used to select a file/directory for a target {{{2 fun! s:NetrwCLeftmouse(islocal) + if &ft != "netrw" + return + endif " call Dfunc("s:NetrwCLeftmouse(islocal=".a:islocal.")") call s:NetrwMarkFileTgt(a:islocal) " call Dret("s:NetrwCLeftmouse") @@ -5581,7 +5788,7 @@ endfun " --------------------------------------------------------------------- " s:NetrwServerEdit: edit file in a server gvim, usually NETRWSERVER (implements ){{{2 " a:islocal=0 : not used, remote -" a:islocal=1 : no used, local +" a:islocal=1 : not used, local " a:islocal=2 : used, remote " a:islocal=3 : used, local fun! s:NetrwServerEdit(islocal,fname) @@ -5706,6 +5913,9 @@ endfun " --------------------------------------------------------------------- " s:NetrwSLeftmouse: marks the file under the cursor. May be dragged to select additional files {{{2 fun! s:NetrwSLeftmouse(islocal) + if &ft != "netrw" + return + endif " call Dfunc("s:NetrwSLeftmouse(islocal=".a:islocal.")") let s:ngw= s:NetrwGetWord() @@ -5758,6 +5968,7 @@ endfun " separated patterns given in g:netrw_list_hide fun! s:NetrwListHide() " call Dfunc("s:NetrwListHide() g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">") +" call Decho("initial: ".string(getline(w:netrw_bannercnt,'$'))) let ykeep= @@ " find a character not in the "hide" string to use as a separator for :g and :v commands @@ -5776,19 +5987,23 @@ fun! s:NetrwListHide() let hide = listhide let listhide = "" endif +" call Decho("hide<".hide."> listhide<".listhide.'>','~'.expand("")) " Prune the list by hiding any files which match if g:netrw_hide == 1 -" call Decho("hiding<".hide."> listhide<".listhide.">",'~'.expand("")) +" call Decho("..hiding<".hide.">",'~'.expand("")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d' elseif g:netrw_hide == 2 -" call Decho("showing<".hide."> listhide<".listhide.">",'~'.expand("")) +" call Decho("..showing<".hide.">",'~'.expand("")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'s@^@ /-KEEP-/ @' endif +" call Decho("..result: ".string(getline(w:netrw_bannercnt,'$')),'~'.expand("")) endwhile if g:netrw_hide == 2 exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$v@^ /-KEEP-/ @d' +" call Decho("..v KEEP: ".string(getline(w:netrw_bannercnt,'$')),'~'.expand("")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s@^\%( /-KEEP-/ \)\+@@e' +" call Decho("..g KEEP: ".string(getline(w:netrw_bannercnt,'$')),'~'.expand("")) endif " remove any blank lines that have somehow remained. @@ -5854,9 +6069,12 @@ fun! s:NetrwMakeDir(usrhost) endif else let netrw_origdir= s:NetrwGetcwd(1) - call s:NetrwLcd(b:netrw_curdir) + if s:NetrwLcd(b:netrw_curdir) +" call Dret("s:NetrwMakeDir : lcd failure") + return + endif " call Decho("netrw_origdir<".netrw_origdir.">: lcd b:netrw_curdir<".fnameescape(b:netrw_curdir).">",'~'.expand("")) - call s:NetrwExe("sil! !".g:netrw_localmkdir.' '.s:ShellEscape(newdirname,1)) + call s:NetrwExe("sil! !".g:netrw_localmkdir.g:netrw_localmkdiropt.' '.s:ShellEscape(newdirname,1)) if v:shell_error != 0 let @@= ykeep call netrw#ErrorMsg(s:ERROR,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80) @@ -5865,7 +6083,10 @@ fun! s:NetrwMakeDir(usrhost) endif if !g:netrw_keepdir " call Decho("restoring netrw_origdir since g:netrw_keepdir=".g:netrw_keepdir,'~'.expand("")) - call s:NetrwLcd(netrw_origdir) + if s:NetrwLcd(netrw_origdir) +" call Dret("s:NetrwBrowse : lcd failure") + return + endif endif endif @@ -5977,6 +6198,7 @@ endfun fun! s:NetrwMaps(islocal) " call Dfunc("s:NetrwMaps(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">") + " mouse maps: {{{3 if g:netrw_mousemaps && g:netrw_retmap " call Decho("set up Rexplore 2-leftmouse",'~'.expand("")) if !hasmapto("NetrwReturn") @@ -5992,22 +6214,87 @@ fun! s:NetrwMaps(islocal) " call Decho("made NetrwReturn map",'~'.expand("")) endif + " generate default maps {{{3 + if !hasmapto('NetrwHide') |nmap a NetrwHide_a|endif + if !hasmapto('NetrwBrowseUpDir') |nmap - NetrwBrowseUpDir |endif + if !hasmapto('NetrwOpenFile') |nmap % NetrwOpenFile|endif + if !hasmapto('NetrwBadd_cb') |nmap cb NetrwBadd_cb|endif + if !hasmapto('NetrwBadd_cB') |nmap cB NetrwBadd_cB|endif + if !hasmapto('NetrwLcd') |nmap cd NetrwLcd|endif + if !hasmapto('NetrwSetChgwin') |nmap C NetrwSetChgwin|endif + if !hasmapto('NetrwRefresh') |nmap NetrwRefresh|endif + if !hasmapto('NetrwLocalBrowseCheck') |nmap NetrwLocalBrowseCheck|endif + if !hasmapto('NetrwServerEdit') |nmap NetrwServerEdit|endif + if !hasmapto('NetrwMakeDir') |nmap d NetrwMakeDir|endif + if !hasmapto('NetrwBookHistHandler_gb')|nmap gb NetrwBookHistHandler_gb|endif +" --------------------------------------------------------------------- +" if !hasmapto('NetrwForceChgDir') |nmap gd NetrwForceChgDir|endif +" if !hasmapto('NetrwForceFile') |nmap gf NetrwForceFile|endif +" if !hasmapto('NetrwHidden') |nmap gh NetrwHidden|endif +" if !hasmapto('NetrwSetTreetop') |nmap gn NetrwSetTreetop|endif +" if !hasmapto('NetrwChgPerm') |nmap gp NetrwChgPerm|endif +" if !hasmapto('NetrwBannerCtrl') |nmap I NetrwBannerCtrl|endif +" if !hasmapto('NetrwListStyle') |nmap i NetrwListStyle|endif +" if !hasmapto('NetrwMarkMoveMF2Arglist')|nmap ma NetrwMarkMoveMF2Arglist|endif +" if !hasmapto('NetrwMarkMoveArglist2MF')|nmap mA NetrwMarkMoveArglist2MF|endif +" if !hasmapto('NetrwBookHistHandler_mA')|nmap mb NetrwBookHistHandler_mA|endif +" if !hasmapto('NetrwBookHistHandler_mB')|nmap mB NetrwBookHistHandler_mB|endif +" if !hasmapto('NetrwMarkFileCopy') |nmap mc NetrwMarkFileCopy|endif +" if !hasmapto('NetrwMarkFileDiff') |nmap md NetrwMarkFileDiff|endif +" if !hasmapto('NetrwMarkFileEdit') |nmap me NetrwMarkFileEdit|endif +" if !hasmapto('NetrwMarkFile') |nmap mf NetrwMarkFile|endif +" if !hasmapto('NetrwUnmarkList') |nmap mF NetrwUnmarkList|endif +" if !hasmapto('NetrwMarkFileGrep') |nmap mg NetrwMarkFileGrep|endif +" if !hasmapto('NetrwMarkHideSfx') |nmap mh NetrwMarkHideSfx|endif +" if !hasmapto('NetrwMarkFileMove') |nmap mm NetrwMarkFileMove|endif +" if !hasmapto('NetrwMarkFilePrint') |nmap mp NetrwMarkFilePrint|endif +" if !hasmapto('NetrwMarkFileRegexp') |nmap mr NetrwMarkFileRegexp|endif +" if !hasmapto('NetrwMarkFileSource') |nmap ms NetrwMarkFileSource|endif +" if !hasmapto('NetrwMarkFileTag') |nmap mT NetrwMarkFileTag|endif +" if !hasmapto('NetrwMarkFileTgt') |nmap mt NetrwMarkFileTgt|endif +" if !hasmapto('NetrwUnMarkFile') |nmap mu NetrwUnMarkFile|endif +" if !hasmapto('NetrwMarkFileVimCmd') |nmap mv NetrwMarkFileVimCmd|endif +" if !hasmapto('NetrwMarkFileExe_mx') |nmap mx NetrwMarkFileExe_mx|endif +" if !hasmapto('NetrwMarkFileExe_mX') |nmap mX NetrwMarkFileExe_mX|endif +" if !hasmapto('NetrwMarkFileCompress') |nmap mz NetrwMarkFileCompress|endif +" if !hasmapto('NetrwObtain') |nmap O NetrwObtain|endif +" if !hasmapto('NetrwSplit_o') |nmap o NetrwSplit_o|endif +" if !hasmapto('NetrwPreview') |nmap p NetrwPreview|endif +" if !hasmapto('NetrwPrevWinOpen') |nmap P NetrwPrevWinOpen|endif +" if !hasmapto('NetrwBookHistHandler_qb')|nmap qb NetrwBookHistHandler_qb|endif +" if !hasmapto('NetrwFileInfo') |nmap qf NetrwFileInfo|endif +" if !hasmapto('NetrwMarkFileQFEL_qF') |nmap qF NetrwMarkFileQFEL_qF|endif +" if !hasmapto('NetrwMarkFileQFEL_qL') |nmap qL NetrwMarkFileQFEL_qL|endif +" if !hasmapto('NetrwSortStyle') |nmap s NetrwSortStyle|endif +" if !hasmapto('NetSortSequence') |nmap S NetSortSequence|endif +" if !hasmapto('NetrwSetTgt_Tb') |nmap Tb NetrwSetTgt_Tb|endif +" if !hasmapto('NetrwSetTgt_Th') |nmap Th NetrwSetTgt_Th|endif +" if !hasmapto('NetrwSplit_t') |nmap t NetrwSplit_t|endif +" if !hasmapto('NetrwBookHistHandler_u') |nmap u NetrwBookHistHandler_u|endif +" if !hasmapto('NetrwBookHistHandler_U') |nmap U NetrwBookHistHandler_U|endif +" if !hasmapto('NetrwSplit_v') |nmap v NetrwSplit_v|endif +" if !hasmapto('NetrwBrowseX') |nmap x NetrwBrowseX|endif +" if !hasmapto('NetrwLocalExecute') |nmap X NetrwLocalExecute|endif + if a:islocal " call Decho("make local maps",'~'.expand("")) - " local normal-mode maps - nnoremap a :call NetrwHide(1) - nnoremap - :call NetrwBrowseUpDir(1) - nnoremap % :call NetrwOpenFile(1) - nnoremap c :call NetrwLcd(b:netrw_curdir) - nnoremap C :call NetrwSetChgwin() - nnoremap :call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,NetrwGetWord())) - nnoremap :call NetrwServerEdit(3,NetrwGetWord()) - nnoremap d :call NetrwMakeDir("") - nnoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) + " local normal-mode maps {{{3 + nnoremap NetrwHide_a :call NetrwHide(1) + nnoremap NetrwBrowseUpDir :call NetrwBrowseUpDir(1) + nnoremap NetrwOpenFile :call NetrwOpenFile(1) + nnoremap NetrwBadd_cb :call NetrwBadd(1,0) + nnoremap NetrwBadd_cB :call NetrwBadd(1,1) + nnoremap NetrwLcd :call NetrwLcd(b:netrw_curdir) + nnoremap NetrwSetChgwin :call NetrwSetChgwin() + nnoremap NetrwLocalBrowseCheck :call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,NetrwGetWord())) + nnoremap NetrwServerEdit :call NetrwServerEdit(3,NetrwGetWord()) + nnoremap NetrwMakeDir :call NetrwMakeDir("") + nnoremap NetrwBookHistHandler_gb :call NetrwBookHistHandler(1,b:netrw_curdir) +" --------------------------------------------------------------------- nnoremap gd :call NetrwForceChgDir(1,NetrwGetWord()) nnoremap gf :call NetrwForceFile(1,NetrwGetWord()) nnoremap gh :call NetrwHidden(1) - nnoremap gn :call netrw#SetTreetop(NetrwGetWord()) + nnoremap gn :call netrw#SetTreetop(0,NetrwGetWord()) nnoremap gp :call NetrwChgPerm(1,b:netrw_curdir) nnoremap I :call NetrwBannerCtrl(1) nnoremap i :call NetrwListStyle(1) @@ -6041,7 +6328,6 @@ fun! s:NetrwMaps(islocal) nnoremap qf :call NetrwFileInfo(1,NetrwGetWord()) nnoremap qF :call NetrwMarkFileQFEL(1,getqflist()) nnoremap qL :call NetrwMarkFileQFEL(1,getloclist(v:count)) - nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'exe "norm! 0"call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) nnoremap s :call NetrwSortStyle(1) nnoremap S :call NetSortSequence(1) nnoremap Tb :call NetrwSetTgt(1,'b',v:count1) @@ -6052,104 +6338,44 @@ fun! s:NetrwMaps(islocal) nnoremap v :call NetrwSplit(5) nnoremap x :call netrw#BrowseX(NetrwBrowseChgDir(1,NetrwGetWord(),0),0)" nnoremap X :call NetrwLocalExecute(expand(""))" -" " local insert-mode maps -" inoremap a :call NetrwHide(1) -" inoremap c :exe "NetrwKeepj lcd ".fnameescape(b:netrw_curdir) -" inoremap c :call NetrwLcd(b:netrw_curdir) -" inoremap C :call NetrwSetChgwin() -" inoremap % :call NetrwOpenFile(1) -" inoremap - :call NetrwBrowseUpDir(1) -" inoremap :call netrw#LocalBrowseCheck(NetrwBrowseChgDir(1,NetrwGetWord())) -" inoremap d :call NetrwMakeDir("") -" inoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) -" inoremap gh :call NetrwHidden(1) -" nnoremap gn :call netrw#SetTreetop(NetrwGetWord()) -" inoremap gp :call NetrwChgPerm(1,b:netrw_curdir) -" inoremap I :call NetrwBannerCtrl(1) -" inoremap i :call NetrwListStyle(1) -" inoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) -" inoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) -" inoremap mc :call NetrwMarkFileCopy(1) -" inoremap md :call NetrwMarkFileDiff(1) -" inoremap me :call NetrwMarkFileEdit(1) -" inoremap mf :call NetrwMarkFile(1,NetrwGetWord()) -" inoremap mg :call NetrwMarkFileGrep(1) -" inoremap mh :call NetrwMarkHideSfx(1) -" inoremap mm :call NetrwMarkFileMove(1) -" inoremap mp :call NetrwMarkFilePrint(1) -" inoremap mr :call NetrwMarkFileRegexp(1) -" inoremap ms :call NetrwMarkFileSource(1) -" inoremap mT :call NetrwMarkFileTag(1) -" inoremap mt :call NetrwMarkFileTgt(1) -" inoremap mu :call NetrwUnMarkFile(1) -" inoremap mv :call NetrwMarkFileVimCmd(1) -" inoremap mx :call NetrwMarkFileExe(1,0) -" inoremap mX :call NetrwMarkFileExe(1,1) -" inoremap mz :call NetrwMarkFileCompress(1) -" inoremap O :call NetrwObtain(1) -" inoremap o :call NetrwSplit(3) -" inoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) -" inoremap P :call NetrwPrevWinOpen(1) -" inoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) -" inoremap qf :call NetrwFileInfo(1,NetrwGetWord()) -" inoremap qF :call NetrwMarkFileQFEL(1,getqflist()) -" inoremap qL :call NetrwMarkFileQFEL(1,getloclist(v:count)) -" inoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'exe "norm! 0"call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) -" inoremap s :call NetrwSortStyle(1) -" inoremap S :call NetSortSequence(1) -" inoremap t :call NetrwSplit(4) -" inoremap Tb :call NetrwSetTgt(1,'b',v:count1) -" inoremap Th :call NetrwSetTgt(1,'h',v:count) -" inoremap u :call NetrwBookHistHandler(4,expand("%")) -" inoremap U :call NetrwBookHistHandler(5,expand("%")) -" inoremap v :call NetrwSplit(5) -" inoremap x :call netrw#BrowseX(NetrwBrowseChgDir(1,NetrwGetWord(),0),0)" + + nnoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'exe "norm! 0"call NetrwRefresh(1,NetrwBrowseChgDir(1,'./')) if !hasmapto('NetrwHideEdit') nmap NetrwHideEdit -" imap NetrwHideEdit endif nnoremap NetrwHideEdit :call NetrwHideEdit(1) if !hasmapto('NetrwRefresh') nmap NetrwRefresh -" imap NetrwRefresh endif nnoremap NetrwRefresh :call NetrwRefresh(1,NetrwBrowseChgDir(1,(w:netrw_liststyle == 3)? w:netrw_treetop : './')) if s:didstarstar || !mapcheck("","n") nnoremap :Nexplore -" inoremap :Nexplore endif if s:didstarstar || !mapcheck("","n") nnoremap :Pexplore -" inoremap :Pexplore endif if !hasmapto('NetrwTreeSqueeze') nmap NetrwTreeSqueeze -" imap NetrwTreeSqueeze endif nnoremap NetrwTreeSqueeze :call TreeSqueezeDir(1) let mapsafecurdir = escape(b:netrw_curdir, s:netrw_map_escape) if g:netrw_mousemaps == 1 - nmap NetrwLeftmouse + nmap NetrwLeftmouse + nmap NetrwCLeftmouse + nmap NetrwMiddlemouse + nmap NetrwSLeftmouse + nmap NetrwSLeftdrag + nmap <2-leftmouse> Netrw2Leftmouse + imap ILeftmouse + imap IMiddlemouse nno NetrwLeftmouse :call NetrwLeftmouse(1) - nmap NetrwCLeftmouse nno NetrwCLeftmouse :call NetrwCLeftmouse(1) - nmap NetrwMiddlemouse nno NetrwMiddlemouse :call NetrwPrevWinOpen(1) - nmap NetrwSLeftmouse nno NetrwSLeftmouse :call NetrwSLeftmouse(1) - nmap NetrwSLeftdrag nno NetrwSLeftdrag :call NetrwSLeftdrag(1) - nmap <2-leftmouse> Netrw2Leftmouse nmap Netrw2Leftmouse - - imap ILeftmouse -" ino ILeftmouse :call NetrwLeftmouse(1) - imap IMiddlemouse -" ino IMiddlemouse :call NetrwPrevWinOpen(1) -" imap ISLeftmouse -" ino ISLeftmouse :call NetrwMarkFile(1,NetrwGetWord()) exe 'nnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' exe 'vnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' -" exe 'inoremap :call NetrwLocalRm("'.mapsafecurdir.'")' endif exe 'nnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' exe 'nnoremap D :call NetrwLocalRm("'.mapsafecurdir.'")' @@ -6158,27 +6384,27 @@ fun! s:NetrwMaps(islocal) exe 'vnoremap :call NetrwLocalRm("'.mapsafecurdir.'")' exe 'vnoremap D :call NetrwLocalRm("'.mapsafecurdir.'")' exe 'vnoremap R :call NetrwLocalRename("'.mapsafecurdir.'")' -" exe 'inoremap :call NetrwLocalRm("'.mapsafecurdir.'")' -" exe 'inoremap D :call NetrwLocalRm("'.mapsafecurdir.'")' -" exe 'inoremap R :call NetrwLocalRename("'.mapsafecurdir.'")' -" exe 'inoremap d :call NetrwMakeDir("")' nnoremap :he netrw-quickhelp " support user-specified maps call netrw#UserMaps(1) - else " remote + else + " remote normal-mode maps {{{3 " call Decho("make remote maps",'~'.expand("")) call s:RemotePathAnalysis(b:netrw_curdir) - " remote normal-mode maps - nnoremap a :call NetrwHide(0) - nnoremap - :call NetrwBrowseUpDir(0) - nnoremap % :call NetrwOpenFile(0) - nnoremap C :call NetrwSetChgwin() - nnoremap :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) - nnoremap :call NetrwBrowse(0,NetrwBrowseChgDir(0,NetrwGetWord())) - nnoremap :call NetrwServerEdit(2,NetrwGetWord()) - nnoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) + nnoremap NetrwHide_a :call NetrwHide(0) + nnoremap NetrwBrowseUpDir :call NetrwBrowseUpDir(0) + nnoremap NetrwOpenFile :call NetrwOpenFile(0) + nnoremap NetrwBadd_cb :call NetrwBadd(0,0) + nnoremap NetrwBadd_cB :call NetrwBadd(0,1) + nnoremap NetrwLcd :call NetrwLcd(b:netrw_curdir) + nnoremap NetrwSetChgwin :call NetrwSetChgwin() + nnoremap NetrwRefresh :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) + nnoremap NetrwLocalBrowseCheck :call NetrwBrowse(0,NetrwBrowseChgDir(0,NetrwGetWord())) + nnoremap NetrwServerEdit :call NetrwServerEdit(2,NetrwGetWord()) + nnoremap NetrwBookHistHandler_gb :call NetrwBookHistHandler(1,b:netrw_curdir) +" --------------------------------------------------------------------- nnoremap gd :call NetrwForceChgDir(0,NetrwGetWord()) nnoremap gf :call NetrwForceFile(0,NetrwGetWord()) nnoremap gh :call NetrwHidden(0) @@ -6225,69 +6451,15 @@ fun! s:NetrwMaps(islocal) nnoremap U :call NetrwBookHistHandler(5,b:netrw_curdir) nnoremap v :call NetrwSplit(2) nnoremap x :call netrw#BrowseX(NetrwBrowseChgDir(0,NetrwGetWord()),1) -" " remote insert-mode maps -" inoremap :call NetrwBrowse(0,NetrwBrowseChgDir(0,NetrwGetWord())) -" inoremap :call NetrwRefresh(0,NetrwBrowseChgDir(0,'./')) -" inoremap :call TreeSqueezeDir(0) -" inoremap - :call NetrwBrowseUpDir(0) -" inoremap a :call NetrwHide(0) -" inoremap mb :call NetrwBookHistHandler(0,b:netrw_curdir) -" inoremap mc :call NetrwMarkFileCopy(0) -" inoremap md :call NetrwMarkFileDiff(0) -" inoremap me :call NetrwMarkFileEdit(0) -" inoremap mf :call NetrwMarkFile(0,NetrwGetWord()) -" inoremap mg :call NetrwMarkFileGrep(0) -" inoremap mh :call NetrwMarkHideSfx(0) -" inoremap mm :call NetrwMarkFileMove(0) -" inoremap mp :call NetrwMarkFilePrint(0) -" inoremap mr :call NetrwMarkFileRegexp(0) -" inoremap ms :call NetrwMarkFileSource(0) -" inoremap mt :call NetrwMarkFileTgt(0) -" inoremap mT :call NetrwMarkFileTag(0) -" inoremap mu :call NetrwUnMarkFile(0) -" nnoremap mv :call NetrwMarkFileVimCmd(1) -" inoremap mx :call NetrwMarkFileExe(0,0) -" inoremap mX :call NetrwMarkFileExe(0,1) -" inoremap mv :call NetrwMarkFileVimCmd(0) -" inoremap mz :call NetrwMarkFileCompress(0) -" inoremap gb :call NetrwBookHistHandler(1,b:netrw_curdir) -" inoremap gh :call NetrwHidden(0) -" inoremap gp :call NetrwChgPerm(0,b:netrw_curdir) -" inoremap C :call NetrwSetChgwin() -" inoremap i :call NetrwListStyle(0) -" inoremap I :call NetrwBannerCtrl(1) -" inoremap o :call NetrwSplit(0) -" inoremap O :call NetrwObtain(0) -" inoremap p :call NetrwPreview(NetrwBrowseChgDir(1,NetrwGetWord(),1)) -" inoremap P :call NetrwPrevWinOpen(0) -" inoremap qb :call NetrwBookHistHandler(2,b:netrw_curdir) -" inoremap mB :call NetrwBookHistHandler(6,b:netrw_curdir) -" inoremap qf :call NetrwFileInfo(0,NetrwGetWord()) -" inoremap qF :call NetrwMarkFileQFEL(0,getqflist()) -" inoremap qL :call NetrwMarkFileQFEL(0,getloclist(v:count)) -" inoremap r :let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'exe "norm! 0"call NetrwBrowse(0,NetrwBrowseChgDir(0,'./')) -" inoremap s :call NetrwSortStyle(0) -" inoremap S :call NetSortSequence(0) -" inoremap t :call NetrwSplit(1) -" inoremap Tb :call NetrwSetTgt('b',v:count1) -" inoremap Th :call NetrwSetTgt('h',v:count) -" inoremap u :call NetrwBookHistHandler(4,b:netrw_curdir) -" inoremap U :call NetrwBookHistHandler(5,b:netrw_curdir) -" inoremap v :call NetrwSplit(2) -" inoremap x :call netrw#BrowseX(NetrwBrowseChgDir(0,NetrwGetWord()),1) -" inoremap % :call NetrwOpenFile(0) if !hasmapto('NetrwHideEdit') nmap NetrwHideEdit -" imap NetrwHideEdit endif nnoremap NetrwHideEdit :call NetrwHideEdit(0) if !hasmapto('NetrwRefresh') nmap NetrwRefresh -" imap NetrwRefresh endif if !hasmapto('NetrwTreeSqueeze') nmap NetrwTreeSqueeze -" imap NetrwTreeSqueeze endif nnoremap NetrwTreeSqueeze :call TreeSqueezeDir(0) @@ -6309,14 +6481,10 @@ fun! s:NetrwMaps(islocal) nmap <2-leftmouse> Netrw2Leftmouse nmap Netrw2Leftmouse - imap ILeftmouse -" ino ILeftmouse :call NetrwLeftmouse(0) imap IMiddlemouse -" ino IMiddlemouse :call NetrwPrevWinOpen(0) imap ISLeftmouse -" ino ISLeftmouse :call NetrwMarkFile(0,NetrwGetWord()) exe 'nnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' exe 'vnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' -" exe 'inoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' endif exe 'nnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' exe 'nnoremap d :call NetrwMakeDir("'.mapsafeusermach.'")' @@ -6325,16 +6493,11 @@ fun! s:NetrwMaps(islocal) exe 'vnoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' exe 'vnoremap D :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' exe 'vnoremap R :call NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")' -" exe 'inoremap :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' -" exe 'inoremap d :call NetrwMakeDir("'.mapsafeusermach.'")' -" exe 'inoremap D :call NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")' -" exe 'inoremap R :call NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")' nnoremap :he netrw-quickhelp -" inoremap :he netrw-quickhelp " support user-specified maps call netrw#UserMaps(0) - endif + endif " }}}3 " call Dret("s:NetrwMaps") endfun @@ -6531,14 +6694,16 @@ fun! s:NetrwMarkFile(islocal,fname) endif " set up 2match'ing to netrwmarkfilemtch_# list - if exists("s:netrwmarkfilemtch_{curbufnr}") && s:netrwmarkfilemtch_{curbufnr} != "" -" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/",'~'.expand("")) - if exists("g:did_drchip_netrwlist_syntax") - exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/" - endif - else -" call Decho("2match none",'~'.expand("")) - 2match none + if has("syntax") && exists("g:syntax_on") && g:syntax_on + if exists("s:netrwmarkfilemtch_{curbufnr}") && s:netrwmarkfilemtch_{curbufnr} != "" +" " call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/",'~'.expand("")) + if exists("g:did_drchip_netrwlist_syntax") + exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/" + endif + else +" " call Decho("2match none",'~'.expand("")) + 2match none + endif endif let @@= ykeep " call Dret("s:NetrwMarkFile : s:netrwmarkfilelist_".curbufnr."<".(exists("s:netrwmarkfilelist_{curbufnr}")? string(s:netrwmarkfilelist_{curbufnr}) : " doesn't exist").">") @@ -6624,18 +6789,15 @@ fun! s:NetrwMarkFileCompress(islocal) if g:netrw_keepdir let fname= s:ShellEscape(s:ComposePath(curdir,fname)) endif + call system(exe." ".fname) + if v:shell_error + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"unable to apply<".exe."> to file<".fname.">",50) + endif else let fname= s:ShellEscape(b:netrw_curdir.fname,1) - endif - if executable(exe) - if a:islocal - call system(exe." ".fname) - else - NetrwKeepj call s:RemoteSystem(exe." ".fname) - endif - else - NetrwKeepj call netrw#ErrorMsg(s:WARNING,"unable to apply<".exe."> to file<".fname.">",50) - endif + NetrwKeepj call s:RemoteSystem(exe." ".fname) + endif + endif unlet sfx @@ -6644,6 +6806,9 @@ fun! s:NetrwMarkFileCompress(islocal) elseif a:islocal " fname not a compressed file, so compress it call system(netrw#WinPath(g:netrw_compress)." ".s:ShellEscape(s:ComposePath(b:netrw_curdir,fname))) + if v:shell_error + call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_compress<".g:netrw_compress."> to something that works",104) + endif else " fname not a compressed file, so compress it NetrwKeepj call s:RemoteSystem(netrw#WinPath(g:netrw_compress)." ".s:ShellEscape(fname)) @@ -6695,7 +6860,7 @@ fun! s:NetrwMarkFileCopy(islocal,...) if a:islocal && s:netrwmftgt_islocal " Copy marked files, local directory to local directory " call Decho("copy from local to local",'~'.expand("")) - if !executable(g:netrw_localcopycmd) && g:netrw_localcopycmd !~ '^'.expand("$COMSPEC").'\s' + if !executable(g:netrw_localcopycmd) 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 @@ -6777,7 +6942,7 @@ fun! s:NetrwMarkFileCopy(islocal,...) " call Decho("tgt <".tgt.">",'~'.expand("")) " call Decho("copycmd<".copycmd.">",'~'.expand("")) " call Decho("system(".copycmd." '".args."' '".tgt."')",'~'.expand("")) - call system(copycmd." '".args."' '".tgt."'") + call system(copycmd.g:netrw_localcopycmdopt." '".args."' '".tgt."'") if v:shell_error != 0 if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir call netrw#ErrorMsg(s:ERROR,"copy failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-c)",101) @@ -6809,7 +6974,7 @@ fun! s:NetrwMarkFileCopy(islocal,...) if exists("*mkdir") call mkdir(tmpdir) else - call s:NetrwExe("sil! !".g:netrw_localmkdir.' '.s:ShellEscape(tmpdir,1)) + call s:NetrwExe("sil! !".g:netrw_localmkdir.g:netrw_localmkdiropt.' '.s:ShellEscape(tmpdir,1)) if v:shell_error != 0 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localmkdir<".g:netrw_localmkdir."> to something that works",80) " call Dret("s:NetrwMarkFileCopy : failed: sil! !".g:netrw_localmkdir.' '.s:ShellEscape(tmpdir,1) ) @@ -6817,7 +6982,10 @@ fun! s:NetrwMarkFileCopy(islocal,...) endif endif if isdirectory(s:NetrwFile(tmpdir)) - call s:NetrwLcd(tmpdir) + if s:NetrwLcd(tmpdir) +" call Dret("s:NetrwMarkFileCopy : lcd failure") + return + endif NetrwKeepj call netrw#Obtain(a:islocal,s:netrwmarkfilelist_{bufnr('%')},tmpdir) let localfiles= map(deepcopy(s:netrwmarkfilelist_{bufnr('%')}),'substitute(v:val,"^.*/","","")') NetrwKeepj call s:NetrwUpload(localfiles,s:netrwmftgt) @@ -6825,9 +6993,12 @@ fun! s:NetrwMarkFileCopy(islocal,...) for fname in s:netrwmarkfilelist_{bufnr('%')} NetrwKeepj call s:NetrwDelete(fname) endfor - call s:NetrwLcd(curdir) - if v:version < 704 || !has("patch1109") - call s:NetrwExe("sil !".g:netrw_localrmdir." ".s:ShellEscape(tmpdir,1)) + if s:NetrwLcd(curdir) +" call Dret("s:NetrwMarkFileCopy : lcd failure") + return + endif + if v:version < 704 || (v:version == 704 && !has("patch1107")) + call s:NetrwExe("sil !".g:netrw_localrmdir.g:netrw_localrmdiropt." ".s:ShellEscape(tmpdir,1)) if v:shell_error != 0 call netrw#ErrorMsg(s:WARNING,"consider setting g:netrw_localrmdir<".g:netrw_localrmdir."> to something that works",80) " " call Dret("s:NetrwMarkFileCopy : failed: sil !".g:netrw_localrmdir." ".s:ShellEscape(tmpdir,1) ) @@ -6839,7 +7010,10 @@ fun! s:NetrwMarkFileCopy(islocal,...) endif endif else - call s:NetrwLcd(curdir) + if s:NetrwLcd(curdir) +" call Dret("s:NetrwMarkFileCopy : lcd failure") + return + endif endif endif endif @@ -7366,15 +7540,15 @@ fun! s:NetrwMarkFileMove(islocal) " move: local -> local " call Decho("move from local to local",'~'.expand("")) " call Decho("local to local move",'~'.expand("")) - if !executable(g:netrw_localmovecmd) && g:netrw_localmovecmd !~ '^'.expand("$COMSPEC").'\s' + if !executable(g:netrw_localmovecmd) 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 = s:ShellEscape(s:netrwmftgt) + let tgt = s:ShellEscape(s:netrwmftgt) " call Decho("tgt<".tgt.">",'~'.expand("")) if !g:netrw_cygwin && (has("win32") || has("win95") || has("win64") || has("win16")) - let tgt = substitute(tgt, '/','\\','g') + let tgt= substitute(tgt, '/','\\','g') " call Decho("windows exception: tgt<".tgt.">",'~'.expand("")) if g:netrw_localmovecmd =~ '\s' let movecmd = substitute(g:netrw_localmovecmd,'\s.*$','','') @@ -7394,7 +7568,7 @@ fun! s:NetrwMarkFileMove(islocal) let fname= substitute(fname,'/','\\','g') endif " call Decho("system(".movecmd." ".s:ShellEscape(fname)." ".tgt.")",'~'.expand("")) - let ret= system(movecmd." ".s:ShellEscape(fname)." ".tgt) + let ret= system(movecmd.g:netrw_localmovecmdopt." ".s:ShellEscape(fname)." ".tgt) if v:shell_error != 0 if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir call netrw#ErrorMsg(s:ERROR,"move failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-c)",100) @@ -7649,12 +7823,13 @@ fun! s:NetrwMarkFileTag(islocal) call s:NetrwUnmarkAll() if a:islocal - if executable(g:netrw_ctags) -" call Decho("call system(".g:netrw_ctags." ".netrwmarkfilelist.")",'~'.expand("")) - call system(g:netrw_ctags." ".netrwmarkfilelist) - else + +" call Decho("call system(".g:netrw_ctags." ".netrwmarkfilelist.")",'~'.expand("")) + call system(g:netrw_ctags." ".netrwmarkfilelist) + if v:shell_error call netrw#ErrorMsg(s:ERROR,"g:netrw_ctags<".g:netrw_ctags."> is not executable!",51) endif + else let cmd = s:RemoteSystem(g:netrw_ctags." ".netrwmarkfilelist) call netrw#Obtain(a:islocal,"tags") @@ -8109,7 +8284,7 @@ fun! s:NetrwObtain(islocal) call netrw#Obtain(islocal,s:netrwmarkfilelist_{bufnr('%')}) call s:NetrwUnmarkList(bufnr('%'),b:netrw_curdir) else - call netrw#Obtain(a:islocal,expand("")) + call netrw#Obtain(a:islocal,s:NetrwGetWord()) endif let @@= ykeep @@ -8144,14 +8319,16 @@ fun! s:NetrwPrevWinOpen(islocal) if lastwinnr == 1 " if only one window, open a new one first " call Decho("only one window, so open a new one (g:netrw_alto=".g:netrw_alto.")",'~'.expand("")) + " g:netrw_preview=0: preview window shown in a horizontally split window + " g:netrw_preview=1: preview window shown in a vertically split window if g:netrw_preview " vertically split preview window - let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize + let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize " call Decho("exe ".(g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s",'~'.expand("")) exe (g:netrw_alto? "top " : "bot ")."vert ".winsz."wincmd s" else " horizontally split preview window - let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize + let winsz= (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize " call Decho("exe ".(g:netrw_alto? "bel " : "abo ").winsz."wincmd s",'~'.expand("")) exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" endif @@ -8283,7 +8460,10 @@ fun! s:NetrwUpload(fname,tgt,...) " call Decho("handle uploading a list of files via scp",'~'.expand("")) let curdir= getcwd() if a:tgt =~ '^scp:' - call s:NetrwLcd(fromdir) + if s:NetrwLcd(fromdir) +" call Dret("s:NetrwUpload : lcd failure") + return + endif let filelist= deepcopy(s:netrwmarkfilelist_{bufnr('%')}) let args = join(map(filelist,"s:ShellEscape(v:val, 1)")) if exists("g:netrw_port") && g:netrw_port != "" @@ -8294,7 +8474,10 @@ fun! s:NetrwUpload(fname,tgt,...) let machine = substitute(a:tgt,'^scp://\([^/:]\+\).*$','\1','') let tgt = substitute(a:tgt,'^scp://[^/]\+/\(.*\)$','\1','') call s:NetrwExe(s:netrw_silentxfer."!".g:netrw_scp_cmd.s:ShellEscape(useport,1)." ".args." ".s:ShellEscape(machine.":".tgt,1)) - call s:NetrwLcd(curdir) + if s:NetrwLcd(curdir) +" call Dret("s:NetrwUpload : lcd failure") + return + endif elseif a:tgt =~ '^ftp:' call s:NetrwMethod(a:tgt) @@ -8408,7 +8591,7 @@ fun! s:NetrwUpload(fname,tgt,...) bw!|q endif elseif !exists("b:netrw_method") || b:netrw_method < 0 -" call Dfunc("netrw#NetrwUpload : unsupported method") +" call Dret("s:#NetrwUpload : unsupported method") return endif else @@ -8457,6 +8640,16 @@ fun! s:NetrwRefresh(islocal,dirname) " call Decho("setl ma noro",'~'.expand("")) " call Decho("clear buffer<".expand("%")."> with :%d",'~'.expand("")) let ykeep = @@ + if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST + if !exists("w:netrw_treetop") + if exists("b:netrw_curdir") + let w:netrw_treetop= b:netrw_curdir + else + let w:netrw_treetop= getcwd() + endif + endif + NetrwKeepj call s:NetrwRefreshTreeDict(w:netrw_treetop) + endif " save the cursor position before refresh. let screenposn = winsaveview() @@ -8476,13 +8669,15 @@ fun! s:NetrwRefresh(islocal,dirname) NetrwKeepj call winrestview(screenposn) " restore file marks - if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" -" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/",'~'.expand("")) - exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" - else -" call Decho("2match none (bufnr(%)=".bufnr("%")."<".bufname("%").">)",'~'.expand("")) - 2match none - endif + if has("syntax") && exists("g:syntax_on") && g:syntax_on + if exists("s:netrwmarkfilemtch_{bufnr('%')}") && s:netrwmarkfilemtch_{bufnr("%")} != "" +" " call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/",'~'.expand("")) + exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" + else +" " call Decho("2match none (bufnr(%)=".bufnr("%")."<".bufname("%").">)",'~'.expand("")) + 2match none + endif + endif " restore let @@= ykeep @@ -8958,6 +9153,36 @@ fun! s:NetrwTreeDisplay(dir,depth) let depth= s:treedepthstring.a:depth " call Decho("display subtrees with depth<".depth."> and current leaves",'~'.expand("")) + " implement g:netrw_hide for tree listings (uses g:netrw_list_hide) + if g:netrw_hide == 1 + " hide given patterns + let listhide= split(g:netrw_list_hide,',') +" call Decho("listhide=".string(listhide)) + for pat in listhide + call filter(w:netrw_treedict[dir],'v:val !~ "'.pat.'"') + endfor + + elseif g:netrw_hide == 2 + " show given patterns (only) + let listhide= split(g:netrw_list_hide,',') +" call Decho("listhide=".string(listhide)) + let entries=[] + for entry in w:netrw_treedict[dir] + for pat in listhide + if entry =~ pat + call add(entries,entry) + break + endif + endfor + endfor + let w:netrw_treedict[dir]= entries + endif + if depth != "" + " always remove "." and ".." entries when there's depth + call filter(w:netrw_treedict[dir],'v:val !~ "\\.\\.$"') + call filter(w:netrw_treedict[dir],'v:val !~ "\\.$"') + endif + " call Decho("for every entry in w:netrw_treedict[".dir."]=".string(w:netrw_treedict[dir]),'~'.expand("")) for entry in w:netrw_treedict[dir] if dir =~ '/$' @@ -8980,6 +9205,7 @@ fun! s:NetrwTreeDisplay(dir,depth) sil! NetrwKeepj call setline(line("$")+1,depth.entry) endif endfor +" call Decho("displaying: ".string(getline(w:netrw_bannercnt,'$'))) " call Dret("NetrwTreeDisplay") endfun @@ -8988,6 +9214,11 @@ endfun " s:NetrwRefreshTreeDict: updates the contents information for a tree (w:netrw_treedict) {{{2 fun! s:NetrwRefreshTreeDict(dir) " call Dfunc("s:NetrwRefreshTreeDict(dir<".a:dir.">)") + if !exists("w:netrw_treedict") +" call Dret("s:NetrwRefreshTreeDict : w:netrw_treedict doesn't exist") + return + endif + for entry in w:netrw_treedict[a:dir] let direntry= substitute(a:dir.'/'.entry,'[@/]$','','e') " call Decho("a:dir<".a:dir."> entry<".entry."> direntry<".direntry.">",'~'.expand("")) @@ -9016,7 +9247,7 @@ fun! s:NetrwRefreshTreeDict(dir) " call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("")) else -" call Decho('not updating w:netrw_treedict['.direntry.'] with entry<'.entry.'> (no subtree)',,'~'.expand("")) +" call Decho('not updating w:netrw_treedict['.string(direntry).'] with entry<'.string(entry).'> (no subtree)','~'.expand("")) endif endfor " call Dret("s:NetrwRefreshTreeDict") @@ -9083,12 +9314,21 @@ fun! s:NetrwTreeListing(dirname) endfun " --------------------------------------------------------------------- -" s:NetrwTreePath: returns path to current file in tree listing {{{2 +" s:NetrwTreePath: returns path to current file/directory in tree listing {{{2 " Normally, treetop is w:netrw_treetop, but a " user of the function ( netrw#SetTreetop() ) " wipes that out prior to calling this function fun! s:NetrwTreePath(treetop) -" call Dfunc("s:NetrwTreePath() line#".line(".")."<".getline(".").">") +" call Dfunc("s:NetrwTreePath(treetop<".a:treetop.">) line#".line(".")."<".getline(".").">") + if line(".") < w:netrw_bannercnt + 2 + let treedir= a:treetop + if treedir !~ '/$' + let treedir= treedir.'/' + endif +" call Dret("s:NetrwTreePath ".treedir." : line#".line(".")." ≤ ".(w:netrw_bannercnt+2)) + return treedir + endif + let svpos = winsaveview() " call Decho("saving posn to svpos<".string(svpos).">",'~'.expand("")) let depth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') @@ -9119,12 +9359,15 @@ fun! s:NetrwTreePath(treetop) let depth = substitute(depth,'^'.s:treedepthstring,'','') " call Decho("constructing treedir<".treedir.">: dirname<".dirname."> while depth<".depth.">",'~'.expand("")) endwhile +" call Decho("treedir#1<".treedir.">",'~'.expand("")) if a:treetop =~ '/$' let treedir= a:treetop.treedir else let treedir= a:treetop.'/'.treedir endif +" call Decho("treedir#2<".treedir.">",'~'.expand("")) let treedir= substitute(treedir,'//$','/','') +" call Decho("treedir#3<".treedir.">",'~'.expand("")) " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand(""))" call winrestview(svpos) " call Dret("s:NetrwTreePath <".treedir.">") @@ -9214,7 +9457,7 @@ endfun fun! s:PerformListing(islocal) " call Dfunc("s:PerformListing(islocal=".a:islocal.")") " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("")) -" call Decho("settings: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (enter)",'~'.expand("")) +" call Decho("settings: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (enter)"." ei<".&ei.">",'~'.expand("")) " set up syntax highlighting {{{3 " call Decho("--set up syntax highlighting (ie. setl ft=netrw)",'~'.expand("")) @@ -9294,7 +9537,7 @@ fun! s:PerformListing(islocal) " call Decho("g:netrw_banner=".g:netrw_banner.": banner ".(g:netrw_banner? "enabled" : "suppressed").": (line($)=".line("$")." byte2line(1)=".byte2line(1)." bannercnt=".w:netrw_bannercnt.")",'~'.expand("")) endif - " show copy/move target, if any + " show copy/move target, if any {{{3 if g:netrw_banner if exists("s:netrwmftgt") && exists("s:netrwmftgt_islocal") " call Decho("--show copy/move target<".s:netrwmftgt.">",'~'.expand("")) @@ -9450,7 +9693,7 @@ fun! s:PerformListing(islocal) " resolve symbolic links if local and (thin or tree) if a:islocal && (w:netrw_liststyle == s:THINLIST || (exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST)) " call Decho("--resolve symbolic links if local and thin|tree",'~'.expand("")) - g/@$/call s:ShowLink() + sil! g/@$/call s:ShowLink() endif if exists("w:netrw_bannercnt") && (line("$") >= w:netrw_bannercnt || !g:netrw_banner) @@ -9543,9 +9786,9 @@ fun! s:SetupNetrwStatusLine(statline) " call Dret("SetupNetrwStatusLine : stl=".&stl) endfun -" --------------------------------------------------------------------- -" Remote Directory Browsing Support: {{{1 -" =========================================== +" ========================================= +" Remote Directory Browsing Support: {{{1 +" ========================================= " --------------------------------------------------------------------- " s:NetrwRemoteFtpCmd: unfortunately, not all ftp servers honor options for ls {{{2 @@ -10146,12 +10389,12 @@ fun! s:NetrwRemoteRename(usrhost,path) r " call Dret("NetrwRemoteRename") endfun -" --------------------------------------------------------------------- +" ========================================== " Local Directory Browsing Support: {{{1 " ========================================== " --------------------------------------------------------------------- -" netrw#FileUrlRead: handles reading file://* files {{{2 +" netrw#FileUrlEdit: handles editing file://* files {{{2 " Should accept: file://localhost/etc/fstab " file:///etc/fstab " file:///c:/WINDOWS/clock.avi @@ -10161,8 +10404,8 @@ endfun " file://c:/foo.txt " file:///c:/foo.txt " and %XX (where X is [0-9a-fA-F] is converted into a character with the given hexadecimal value -fun! netrw#FileUrlRead(fname) -" call Dfunc("netrw#FileUrlRead(fname<".a:fname.">)") +fun! netrw#FileUrlEdit(fname) +" call Dfunc("netrw#FileUrlEdit(fname<".a:fname.">)") let fname = a:fname if fname =~ '^file://localhost/' " call Decho('converting file://localhost/ -to- file:///','~'.expand("")) @@ -10186,17 +10429,15 @@ fun! netrw#FileUrlRead(fname) let plainfname= substitute(plainfname,'^/\+\(\a:\)','\1','') endif endif + " call Decho("fname2396<".fname2396.">",'~'.expand("")) " call Decho("plainfname<".plainfname.">",'~'.expand("")) exe "sil doau BufReadPre ".fname2396e - exe 'NetrwKeepj r '.plainfname - exe 'sil! bdelete '.plainfname - exe 'keepalt file! '.plainfname - NetrwKeepj 1d -" call Decho("setl nomod",'~'.expand("")) - setl nomod + exe 'NetrwKeepj keepalt edit '.plainfname + exe 'sil! NetrwKeepj keepalt bdelete '.fnameescape(a:fname) + " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) -" call Dret("netrw#FileUrlRead") +" call Dret("netrw#FileUrlEdit") exe "sil doau BufReadPost ".fname2396e endfun @@ -10214,7 +10455,7 @@ fun! netrw#LocalBrowseCheck(dirname) " call Dfunc("netrw#LocalBrowseCheck(dirname<".a:dirname.">") " call Decho("isdir<".a:dirname."> =".isdirectory(s:NetrwFile(a:dirname)).((exists("s:treeforceredraw")? " treeforceredraw" : "")).'~'.expand("")) " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) -" call Dredir("ls!","ls!") +" call Dredir("ls!","netrw#LocalBrowseCheck") " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("")) " call Decho("current buffer#".bufnr("%")."<".bufname("%")."> ft=".&ft,'~'.expand("")) @@ -10293,19 +10534,21 @@ fun! s:LocalBrowseRefresh() while itab <= tabpagenr("$") let buftablist = buftablist + tabpagebuflist() let itab = itab + 1 - tabn + sil! tabn endwhile " call Decho("buftablist".string(buftablist),'~'.expand("")) " call Decho("s:netrw_browselist<".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "").">",'~'.expand("")) " GO through all buffers on netrw_browselist (ie. just local-netrw buffers): " | refresh any netrw window " | wipe out any non-displaying netrw buffer - let curwin = winnr() + let curwinid = win_getid(winnr()) let ibl = 0 for ibuf in s:netrw_browselist " call Decho("bufwinnr(".ibuf.") index(buftablist,".ibuf.")=".index(buftablist,ibuf),'~'.expand("")) if bufwinnr(ibuf) == -1 && index(buftablist,ibuf) == -1 " wipe out any non-displaying netrw buffer + " (ibuf not shown in a current window AND + " ibuf not in any tab) " call Decho("wiping buf#".ibuf,"<".bufname(ibuf).">",'~'.expand("")) exe "sil! keepj bd ".fnameescape(ibuf) call remove(s:netrw_browselist,ibl) @@ -10329,8 +10572,8 @@ fun! s:LocalBrowseRefresh() let ibl= ibl + 1 " call Decho("bottom of s:netrw_browselist for loop: ibl=".ibl,'~'.expand("")) endfor -" call Decho("restore window: exe ".curwin."wincmd w",'~'.expand("")) - exe curwin."wincmd w" +" call Decho("restore window: win_gotoid(".curwinid.")") + call win_gotoid(curwinid) let @@= ykeep " call Dret("s:LocalBrowseRefresh") @@ -10786,7 +11029,7 @@ fun! s:NetrwLocalRmFile(path,fname,all) let rmfile= substitute(rmfile,'[\/]$','','e') if all || ok =~# 'y\%[es]' || ok == "" - if v:version < 704 || !has("patch1109") + if v:version < 704 || (v:version == 704 && !has("patch1107")) " " call Decho("1st attempt: system(netrw#WinPath(".g:netrw_localrmdir.') '.s:ShellEscape(rmfile).')','~'.expand("")) call system(netrw#WinPath(g:netrw_localrmdir).' '.s:ShellEscape(rmfile)) " " call Decho("v:shell_error=".v:shell_error,'~'.expand("")) @@ -10822,21 +11065,10 @@ fun! s:NetrwLocalRmFile(path,fname,all) return ok endfun -" --------------------------------------------------------------------- +" ===================================================================== " Support Functions: {{{1 " --------------------------------------------------------------------- -" s:WinNames: COMBAK {{{2 -fun! s:WinNames(id) - let curwin= winnr() - 1wincmd w -" call Decho("--- Windows By Name --- #".a:id) -" windo call Decho("win#".winnr()."<".expand("%").">") -" call Decho("--- --- --- --- --- ---") - exe curwin."wincmd w" -endfun - -" --------------------------------------------------------------------- " netrw#Access: intended to provide access to variable values for netrw's test suite {{{2 " 0: marked file list of current buffer " 1: marked file target @@ -10849,18 +11081,13 @@ fun! netrw#Access(ilist) endif elseif a:ilist == 1 return s:netrwmftgt + endif endfun " --------------------------------------------------------------------- " netrw#Call: allows user-specified mappings to call internal netrw functions {{{2 fun! netrw#Call(funcname,...) -" call Dfunc("netrw#Call(funcname<".a:funcname.">,".string(a:000).")") - if a:0 > 0 - exe "call s:".a:funcname."(".string(a:000).")" - else - exe "call s:".a:funcname."()" - endif -" call Dret("netrw#Call") + return call("s:".a:funcname,a:000) endfun " --------------------------------------------------------------------- @@ -10970,6 +11197,35 @@ fun! netrw#WinPath(path) endfun " --------------------------------------------------------------------- +" s:NetrwBadd: adds marked files to buffer list or vice versa {{{2 +" cb : bl2mf=0 add marked files to buffer list +" cB : bl2mf=1 use bufferlist to mark files +" (mnemonic: cb = copy (marked files) to buffer list) +fun! s:NetrwBadd(islocal,bl2mf) +" " call Dfunc("s:NetrwBadd(islocal=".a:islocal." mf2bl=".mf2bl.")") + if a:bl2mf + " cB: add buffer list to marked files + redir => bufl + ls + redir END + let bufl = map(split(bufl,"\n"),'substitute(v:val,''^.\{-}"\(.*\)".\{-}$'',''\1'','''')') + for fname in bufl + call s:NetrwMarkFile(a:islocal,fname) + endfor + else + " cb: add marked files to buffer list + for fname in s:netrwmarkfilelist_{bufnr("%")} +" " call Decho("badd ".fname,'~'.expand("")) + exe "badd ".fnameescape(fname) + endfor + let curbufnr = bufnr("%") + let curdir = s:NetrwGetCurdir(a:islocal) + call s:NetrwUnmarkList(curbufnr,curdir) " remove markings from local buffer + endif +" call Dret("s:NetrwBadd") +endfun + +" --------------------------------------------------------------------- " s:ComposePath: Appends a new part to a path taking different systems into consideration {{{2 fun! s:ComposePath(base,subdir) " call Dfunc("s:ComposePath(base<".a:base."> subdir<".a:subdir.">)") @@ -10983,11 +11239,12 @@ fun! s:ComposePath(base,subdir) let ret = a:base.a:subdir endif - elseif a:subdir =~ '^\a:[/\\][^/\\]' && (has("win32") || has("win95") || has("win64") || has("win16")) + " COMBAK: test on windows with changing to root directory: :e C:/ + elseif a:subdir =~ '^\a:[/\\]\([^/\\]\|$\)' && (has("win32") || has("win95") || has("win64") || has("win16")) " call Decho("windows",'~'.expand("")) let ret= a:subdir - elseif a:base =~ '^\a:[/\\][^/\\]' && (has("win32") || has("win95") || has("win64") || has("win16")) + elseif a:base =~ '^\a:[/\\]\([^/\\]\|$\)' && (has("win32") || has("win95") || has("win64") || has("win16")) " call Decho("windows",'~'.expand("")) if a:base =~ '[/\\]$' let ret= a:base.a:subdir @@ -11329,7 +11586,7 @@ endfun " --------------------------------------------------------------------- " s:NetrwEnew: opens a new buffer, passes netrw buffer variables through {{{2 fun! s:NetrwEnew(...) -" call Dfunc("s:NetrwEnew() a:0=".a:0." bufnr($)=".bufnr("$")) +" call Dfunc("s:NetrwEnew() a:0=".a:0." bufnr($)=".bufnr("$")." expand(%)<".expand("%").">") " call Decho("curdir<".((a:0>0)? a:1 : "")."> buf#".bufnr("%")."<".bufname("%").">",'~'.expand("")) " grab a function-local-variable copy of buffer variables @@ -11392,7 +11649,7 @@ fun! s:NetrwEnew(...) nno [ :sil call TreeListMove('[') nno ] :sil call TreeListMove(']') else - exe "sil! keepalt file ".fnameescape(b:netrw_curdir) + call s:NetrwBufRename(b:netrw_curdir) endif endif endif @@ -11403,17 +11660,19 @@ endfun " --------------------------------------------------------------------- " s:NetrwExe: executes a string using "!" {{{2 fun! s:NetrwExe(cmd) -" call Dfunc("s:NetrwExe(a:cmd)") +" call Dfunc("s:NetrwExe(a:cmd<".a:cmd.">)") if has("win32") && &shell !~? 'cmd' && !g:netrw_cygwin +" call Decho("using win32:",expand("")) let savedShell=[&shell,&shellcmdflag,&shellxquote,&shellxescape,&shellquote,&shellpipe,&shellredir,&shellslash] set shell& shellcmdflag& shellxquote& shellxescape& set shellquote& shellpipe& shellredir& shellslash& exe a:cmd let [&shell,&shellcmdflag,&shellxquote,&shellxescape,&shellquote,&shellpipe,&shellredir,&shellslash] = savedShell else +" call Decho("exe ".a:cmd,'~'.expand("")) exe a:cmd endif -" call Dret("s:NetrwExe") +" call Dret("s:NetrwExe : v:shell_error=".v:shell_error) endfun " --------------------------------------------------------------------- @@ -11446,9 +11705,12 @@ endfun " --------------------------------------------------------------------- " s:NetrwLcd: handles changing the (local) directory {{{2 +" Returns: 0=success +" -1=failed fun! s:NetrwLcd(newdir) " call Dfunc("s:NetrwLcd(newdir<".a:newdir.">)") + let err472= 0 try exe 'NetrwKeepj sil lcd '.fnameescape(a:newdir) catch /^Vim\%((\a\+)\)\=:E344/ @@ -11464,6 +11726,10 @@ fun! s:NetrwLcd(newdir) endif endif catch /^Vim\%((\a\+)\)\=:E472/ + let err472= 1 + endtry + + if err472 call netrw#ErrorMsg(s:ERROR,"unable to change directory to <".a:newdir."> (permissions?)",61) if exists("w:netrw_prvdir") let a:newdir= w:netrw_prvdir @@ -11473,12 +11739,13 @@ fun! s:NetrwLcd(newdir) exe "setl ".g:netrw_bufsettings " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("")) let a:newdir= dirname -" call Dret("s:NetrwBrowse : reusing buffer#".(exists("bufnum")? bufnum : 'N/A')."<".dirname."> getcwd<".getcwd().">") - return - endif - endtry - -" call Dret("s:NetrwLcd") + endif +" call Dret("s:NetrwBrowse -1 : reusing buffer#".(exists("bufnum")? bufnum : 'N/A')."<".dirname."> getcwd<".getcwd().">") + return -1 + endif + +" call Dret("s:NetrwLcd 0") + return 0 endfun " ------------------------------------------------------------------------ @@ -11646,7 +11913,7 @@ endfun " s:SetRexDir() sets up <2-leftmouse> maps (if g:netrw_retmap " is true) and a command, :Rexplore, which call this function. " -" s:netrw_nbcd is set up by s:NetrwBrowseChgDir() +" s:netrw_posn is set up by s:NetrwBrowseChgDir() " " s:rexposn_BUFNR used to save/restore cursor position fun! s:NetrwRexplore(islocal,dirname) @@ -11702,8 +11969,10 @@ fun! s:NetrwRexplore(islocal,dirname) " call Decho("s:rexposn_".bufnr('%')."<".bufname("%")."> doesn't exist",'~'.expand("")) endif - if exists("s:explore_match") - exe "2match netrwMarkFile /".s:explore_match."/" + if has("syntax") && exists("g:syntax_on") && g:syntax_on + if exists("s:explore_match") + exe "2match netrwMarkFile /".s:explore_match."/" + endif endif " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo,'~'.expand("")) @@ -11731,8 +12000,12 @@ endfun fun! s:SavePosn(posndict) " call Dfunc("s:SavePosn(posndict) curbuf#".bufnr("%")."<".bufname("%").">") - let a:posndict[bufnr("%")]= winsaveview() -" call Decho("saving posn: posndict[".bufnr("%")."]=".string(winsaveview()),'~'.expand("")) + if !exists("a:posndict[bufnr('%')]") + let a:posndict[bufnr("%")]= [] + endif +" call Decho("before push: a:posndict[buf#".bufnr("%")."]=".string(a:posndict[bufnr('%')])) + call add(a:posndict[bufnr("%")],winsaveview()) +" call Decho("after push: a:posndict[buf#".bufnr("%")."]=".string(a:posndict[bufnr('%')])) " call Dret("s:SavePosn posndict") return a:posndict @@ -11742,9 +12015,18 @@ endfun " s:RestorePosn: restores position associated with current buffer using dictionary {{{2 fun! s:RestorePosn(posndict) " call Dfunc("s:RestorePosn(posndict) curbuf#".bufnr("%")."<".bufname("%").">") - if has_key(a:posndict,bufnr("%")) - call winrestview(a:posndict[bufnr("%")]) -" call Decho("restoring posn: posndict[".bufnr("%")."]=".string(a:posndict[bufnr("%")]),'~'.expand("")) + if exists("a:posndict") + if has_key(a:posndict,bufnr("%")) +" call Decho("before pop: a:posndict[buf#".bufnr("%")."]=".string(a:posndict[bufnr('%')])) + let posnlen= len(a:posndict[bufnr("%")]) + if posnlen > 0 + let posnlen= posnlen - 1 +" call Decho("restoring posn posndict[".bufnr("%")."][".posnlen."]=".string(a:posndict[bufnr("%")][posnlen]),'~'.expand("")) + call winrestview(a:posndict[bufnr("%")][posnlen]) + call remove(a:posndict[bufnr("%")],posnlen) +" call Decho("after pop: a:posndict[buf#".bufnr("%")."]=".string(a:posndict[bufnr('%')])) + endif + endif endif " call Dret("s:RestorePosn") endfun @@ -12032,11 +12314,13 @@ fun! s:UserMaps(islocal,funcname) " call Dret("s:UserMaps") endfun -" --------------------------------------------------------------------- +" ========================== " Settings Restoration: {{{1 +" ========================== let &cpo= s:keepcpo unlet s:keepcpo -" ------------------------------------------------------------------------ +" =============== " Modelines: {{{1 +" =============== " vim:ts=8 fdm=marker diff --git a/runtime/autoload/netrwSettings.vim b/runtime/autoload/netrwSettings.vim --- a/runtime/autoload/netrwSettings.vim +++ b/runtime/autoload/netrwSettings.vim @@ -1,7 +1,7 @@ " netrwSettings.vim: makes netrw settings simpler -" Date: Dec 30, 2014 +" Date: Nov 09, 2016 " Maintainer: Charles E Campbell -" Version: 15 +" Version: 16 " 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 @@ -19,7 +19,7 @@ if exists("g:loaded_netrwSettings") || &cp finish endif -let g:loaded_netrwSettings = "v15" +let g:loaded_netrwSettings = "v16" if v:version < 700 echohl WarningMsg echo "***warning*** this version of netrwSettings needs vim 7.0" @@ -154,9 +154,13 @@ fun! netrwSettings#NetrwSettings() put = 'let g:netrw_list_hide = '.g:netrw_list_hide put = 'let g:netrw_liststyle = '.g:netrw_liststyle put = 'let g:netrw_localcopycmd = '.g:netrw_localcopycmd + put = 'let g:netrw_localcopycmdopt = '.g:netrw_localcopycmdopt put = 'let g:netrw_localmkdir = '.g:netrw_localmkdir + put = 'let g:netrw_localmkdiropt = '.g:netrw_localmkdiropt put = 'let g:netrw_localmovecmd = '.g:netrw_localmovecmd + put = 'let g:netrw_localmovecmdopt = '.g:netrw_localmovecmdopt put = 'let g:netrw_localrmdir = '.g:netrw_localrmdir + put = 'let g:netrw_localrmdiropt = '.g:netrw_localrmdiropt put = 'let g:netrw_maxfilenamelen = '.g:netrw_maxfilenamelen put = 'let g:netrw_menu = '.g:netrw_menu put = 'let g:netrw_mousemaps = '.g:netrw_mousemaps diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -1,4 +1,4 @@ -*autocmd.txt* For Vim version 8.0. Last change: 2017 Oct 21 +*autocmd.txt* For Vim version 8.0. Last change: 2017 Nov 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -68,7 +68,14 @@ Note: The ":autocmd" command can only be '|' appears before {cmd}. This works: > :augroup mine | au! BufRead | augroup END But this sees "augroup" as part of the defined command: > + :augroup mine | au! BufRead * | augroup END :augroup mine | au BufRead * set tw=70 | augroup END +Instead you can put the group name into the command: > + :au! mine BufRead * + :au mine BufRead * set tw=70 +Or use `:execute`: > + :augroup mine | exe "au! BufRead *" | augroup END + :augroup mine | exe "au BufRead * set tw=70" | augroup END Note that special characters (e.g., "%", "") in the ":autocmd" arguments are not expanded when the autocommand is defined. These will be diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1048,7 +1048,7 @@ When expr8 is a |Funcref| type variable, *expr9* number ------ -number number constant *expr-number* +number number constant *expr-number* *hex-number* *octal-number* *binary-number* Decimal, Hexadecimal (starting with 0x or 0X), Binary (starting with 0b or 0B) @@ -1647,7 +1647,7 @@ v:foldstart Used for 'foldtext': first l Read-only in the |sandbox|. |fold-foldtext| *v:hlsearch* *hlsearch-variable* -v:hlsearch Variable that indicates whether search highlighting is on. +v:hlsearch Variable that indicates whether search highlighting is on. Setting it makes sense only if 'hlsearch' is enabled which requires |+extra_search|. Setting this variable to zero acts like the |:nohlsearch| command, setting it to one acts like > @@ -1818,7 +1818,7 @@ v:scrollstart String describing the scri v:servername The resulting registered |client-server-name| if any. Read-only. - + v:searchforward *v:searchforward* *searchforward-variable* Search direction: 1 after a forward search, 0 after a backward search. It is reset to forward when directly setting @@ -1930,7 +1930,7 @@ v:termu7resp The escape sequence returne *v:testing* *testing-variable* v:testing Must be set before using `test_garbagecollect_now()`. Also, when set certain error messages won't be shown for 2 - seconds. (e.g. "'dictionary' option is empty") + seconds. (e.g. "'dictionary' option is empty") *v:this_session* *this_session-variable* v:this_session Full filename of the last loaded or saved session file. See @@ -2074,7 +2074,7 @@ ch_setoptions({handle}, {options}) ch_status({handle} [, {options}]) String status of channel {handle} changenr() Number current change number -char2nr({expr}[, {utf8}]) Number ASCII/UTF8 value of first char in {expr} +char2nr({expr} [, {utf8}]) Number ASCII/UTF8 value of first char in {expr} cindent({lnum}) Number C indent for line {lnum} clearmatches() none clear all matches col({expr}) Number column nr of cursor or mark @@ -2116,9 +2116,9 @@ filereadable({file}) Number |TRUE| if { filewritable({file}) Number |TRUE| if {file} is a writable file filter({expr1}, {expr2}) List/Dict remove items from {expr1} where {expr2} is 0 -finddir({name}[, {path}[, {count}]]) +finddir({name} [, {path} [, {count}]]) String find directory {name} in {path} -findfile({name}[, {path}[, {count}]]) +findfile({name} [, {path} [, {count}]]) String find file {name} in {path} float2nr({expr}) Number convert Float {expr} to a Number floor({expr}) Float round {expr} down @@ -2162,7 +2162,7 @@ getftime({fname}) Number last modificat getftype({fname}) String description of type of file {fname} getline({lnum}) String line {lnum} of current buffer getline({lnum}, {end}) List lines {lnum} to {end} of current buffer -getloclist({nr}[, {what}]) List list of location list items +getloclist({nr} [, {what}]) List list of location list items getmatches() List list of current matches getpid() Number process ID of Vim getpos({expr}) List position of cursor, mark, etc. @@ -2238,28 +2238,28 @@ lispindent({lnum}) Number Lisp indent f localtime() Number current time log({expr}) Float natural logarithm (base e) of {expr} log10({expr}) Float logarithm of Float {expr} to base 10 -luaeval({expr}[, {expr}]) any evaluate |Lua| expression +luaeval({expr} [, {expr}]) any evaluate |Lua| expression map({expr1}, {expr2}) List/Dict change each item in {expr1} to {expr} -maparg({name}[, {mode} [, {abbr} [, {dict}]]]) +maparg({name} [, {mode} [, {abbr} [, {dict}]]]) String or Dict rhs of mapping {name} in mode {mode} -mapcheck({name}[, {mode} [, {abbr}]]) +mapcheck({name} [, {mode} [, {abbr}]]) String check for mappings matching {name} -match({expr}, {pat}[, {start}[, {count}]]) +match({expr}, {pat} [, {start} [, {count}]]) Number position where {pat} matches in {expr} -matchadd({group}, {pattern}[, {priority}[, {id} [, {dict}]]]) +matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]]) Number highlight {pattern} with {group} -matchaddpos({group}, {pos}[, {priority}[, {id}[, {dict}]]]) +matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]]) Number highlight positions with {group} matcharg({nr}) List arguments of |:match| matchdelete({id}) Number delete match identified by {id} -matchend({expr}, {pat}[, {start}[, {count}]]) +matchend({expr}, {pat} [, {start} [, {count}]]) Number position where {pat} ends in {expr} -matchlist({expr}, {pat}[, {start}[, {count}]]) +matchlist({expr}, {pat} [, {start} [, {count}]]) List match and submatches of {pat} in {expr} -matchstr({expr}, {pat}[, {start}[, {count}]]) +matchstr({expr}, {pat} [, {start} [, {count}]]) String {count}'th match of {pat} in {expr} -matchstrpos({expr}, {pat}[, {start}[, {count}]]) +matchstrpos({expr}, {pat} [, {start} [, {count}]]) List {count}'th match of {pat} in {expr} max({expr}) Number maximum value of items in {expr} min({expr}) Number minimum value of items in {expr} @@ -2268,7 +2268,7 @@ mkdir({name} [, {path} [, {prot}]]) mode([expr]) String current editing mode mzeval({expr}) any evaluate |MzScheme| expression nextnonblank({lnum}) Number line nr of non-blank line >= {lnum} -nr2char({expr}[, {utf8}]) String single char with ASCII/UTF8 value {expr} +nr2char({expr} [, {utf8}]) String single char with ASCII/UTF8 value {expr} or({expr}, {expr}) Number bitwise OR pathshorten({expr}) String shorten directory names in a path perleval({expr}) any evaluate |Perl| expression @@ -2330,13 +2330,13 @@ setcharsearch({dict}) Dict set characte setcmdpos({pos}) Number set cursor position in command-line setfperm({fname}, {mode}) Number set {fname} file permissions to {mode} setline({lnum}, {line}) Number set line {lnum} to {line} -setloclist({nr}, {list}[, {action}[, {what}]]) +setloclist({nr}, {list} [, {action} [, {what}]]) Number modify location list using {list} setmatches({list}) Number restore a list of matches setpos({expr}, {list}) Number set the {expr} position to {list} -setqflist({list}[, {action}[, {what}]]) +setqflist({list} [, {action} [, {what}]]) Number modify quickfix list using {list} -setreg({n}, {v}[, {opt}]) Number set register to value and type +setreg({n}, {v} [, {opt}]) Number set register to value and type settabvar({nr}, {varname}, {val}) none set {varname} in tab page {nr} to {val} settabwinvar({tabnr}, {winnr}, {varname}, {val}) none set {varname} in window {winnr} in tab @@ -2362,22 +2362,22 @@ sqrt({expr}) Float square root of {exp str2float({expr}) Float convert String to Float str2nr({expr} [, {base}]) Number convert String to Number strchars({expr} [, {skipcc}]) Number character length of the String {expr} -strcharpart({str}, {start}[, {len}]) +strcharpart({str}, {start} [, {len}]) String {len} characters of {str} at {start} strdisplaywidth({expr} [, {col}]) Number display length of the String {expr} -strftime({format}[, {time}]) String time in specified format +strftime({format} [, {time}]) String time in specified format strgetchar({str}, {index}) Number get char {index} from {str} -stridx({haystack}, {needle}[, {start}]) +stridx({haystack}, {needle} [, {start}]) Number index of {needle} in {haystack} string({expr}) String String representation of {expr} value strlen({expr}) Number length of the String {expr} -strpart({str}, {start}[, {len}]) +strpart({str}, {start} [, {len}]) String {len} characters of {str} at {start} strridx({haystack}, {needle} [, {start}]) Number last index of {needle} in {haystack} strtrans({expr}) String translate string to make it printable strwidth({expr}) Number display cell length of the String {expr} -submatch({nr}[, {list}]) String or List +submatch({nr} [, {list}]) String or List specific match in ":s" or substitute() substitute({expr}, {pat}, {sub}, {flags}) String all {pat} in {expr} replaced with {sub} @@ -2391,8 +2391,8 @@ system({expr} [, {input}]) String output systemlist({expr} [, {input}]) List output of shell command/filter {expr} tabpagebuflist([{arg}]) List list of buffer numbers in tab page tabpagenr([{arg}]) Number number of current or last tab page -tabpagewinnr({tabarg}[, {arg}]) Number number of current window in tab page -taglist({expr}[, {filename}]) List list of tags matching {expr} +tabpagewinnr({tabarg} [, {arg}]) Number number of current window in tab page +taglist({expr} [, {filename}]) List list of tags matching {expr} tagfiles() List tags files used tan({expr}) Float tangent of {expr} tanh({expr}) Float hyperbolic tangent of {expr} @@ -2406,7 +2406,7 @@ term_getscrolled({buf}) Number get the term_getsize({buf}) List get the size of a terminal term_getstatus({buf}) String get the status of a terminal term_gettitle({buf}) String get the title of a terminal -term_getttty({buf}, [{input}]) String get the tty name of a terminal +term_gettty({buf}, [{input}]) String get the tty name of a terminal term_list() List get the list of terminal buffers term_scrape({buf}, {row}) List get row of a terminal screen term_sendkeys({buf}, {keys}) none send keystrokes to a terminal @@ -2951,7 +2951,7 @@ ch_evalraw({handle}, {string} [, {option in NL mode, the caller must do that. The NL in the response is removed. Note that Vim does not know when the text received on a raw - channel is complete, it may only return the first part and you + channel is complete, it may only return the first part and you need to use ch_readraw() to fetch the rest. See |channel-use|. @@ -3104,7 +3104,7 @@ changenr() *changenr()* redo it is the number of the redone change. After undo it is one less than the number of the undone change. -char2nr({expr}[, {utf8}]) *char2nr()* +char2nr({expr} [, {utf8}]) *char2nr()* Return number value of the first char in {expr}. Examples: > char2nr(" ") returns 32 char2nr("ABC") returns 65 @@ -3298,7 +3298,7 @@ cosh({expr}) *cosh()* < -1.127626 {only available when compiled with the |+float| feature} - + count({comp}, {expr} [, {ic} [, {start}]]) *count()* Return the number of times an item with value {expr} appears in |String|, |List| or |Dictionary| {comp}. @@ -3383,7 +3383,7 @@ cursor({list}) Returns 0 when the position could be set, -1 otherwise. -deepcopy({expr}[, {noref}]) *deepcopy()* *E698* +deepcopy({expr} [, {noref}]) *deepcopy()* *E698* Make a copy of {expr}. For Numbers and Strings this isn't different from using {expr} directly. When {expr} is a |List| a full copy is created. This means @@ -3410,14 +3410,14 @@ delete({fname} [, {flags}]) *delete( When {flags} is "d": Deletes the directory by the name {fname}. This fails when directory {fname} is not empty. - + When {flags} is "rf": Deletes the directory by the name {fname} and everything in it, recursively. BE CAREFUL! Note: on MS-Windows it is not possible to delete a directory that is being used. A symbolic link itself is deleted, not what it points to. - + The result is a Number, which is 0 if the delete operation was successful and -1 when the deletion failed or partly failed. @@ -3461,6 +3461,7 @@ empty({expr}) *empty()* Return the Number 1 if {expr} is empty, zero otherwise. - A |List| or |Dictionary| is empty when it does not have any items. + - A String is empty when its length is zero. - A Number and Float is empty when its value is zero. - |v:false|, |v:none| and |v:null| are empty, |v:true| is not. - A Job is empty when it failed to start. @@ -3823,7 +3824,7 @@ filter({expr1}, {expr2}) *filter()* For each item in {expr1} evaluate {expr2} and when the result is zero remove the item from the |List| or |Dictionary|. {expr2} must be a |string| or |Funcref|. - + If {expr2} is a |string|, inside {expr2} |v:val| has the value of the current item. For a |Dictionary| |v:key| has the key of the current item and for a |List| |v:key| has the index of @@ -3865,7 +3866,7 @@ filter({expr1}, {expr2}) *filter()* defined with the "abort" flag. -finddir({name}[, {path}[, {count}]]) *finddir()* +finddir({name} [, {path} [, {count}]]) *finddir()* Find directory {name} in {path}. Supports both downwards and upwards recursive directory searches. See |file-searching| for the syntax of {path}. @@ -3880,7 +3881,7 @@ finddir({name}[, {path}[, {count}]]) {only available when compiled with the |+file_in_path| feature} -findfile({name}[, {path}[, {count}]]) *findfile()* +findfile({name} [, {path} [, {count}]]) *findfile()* Just like |finddir()|, but find a file instead of a directory. Uses 'suffixesadd'. Example: > @@ -3923,7 +3924,7 @@ floor({expr}) *floor()* echo floor(4.0) < 4.0 {only available when compiled with the |+float| feature} - + fmod({expr1}, {expr2}) *fmod()* Return the remainder of {expr1} / {expr2}, even if the @@ -4052,7 +4053,7 @@ function({name} [, {arglist}] [, {dict}] When {arglist} or {dict} is present this creates a partial. That means the argument list and/or the dictionary is stored in the Funcref and will be used when the Funcref is called. - + The arguments are passed to the function in front of other arguments. Example: > func Callback(arg1, arg2, name) @@ -4104,7 +4105,7 @@ function({name} [, {arglist}] [, {dict}] garbagecollect([{atexit}]) *garbagecollect()* Cleanup unused |Lists|, |Dictionaries|, |Channels| and |Jobs| that have circular references. - + There is hardly ever a need to invoke this function, as it is automatically done when Vim runs out of memory or is waiting for the user to press a key after 'updatetime'. Items without @@ -4551,7 +4552,7 @@ getline({lnum} [, {end}]) < To get lines from another buffer see |getbufline()| -getloclist({nr}[, {what}]) *getloclist()* +getloclist({nr} [, {what}]) *getloclist()* Returns a list with all the entries in the location list for window {nr}. {nr} can be the window number or the |window-ID|. When {nr} is zero the current window is used. @@ -5316,7 +5317,7 @@ job_status({job}) *job_status()* *E9 "run" job is running "fail" job failed to start "dead" job died or was stopped after running - + On Unix a non-existing command results in "dead" instead of "fail", because a fork happens before the failure can be detected. @@ -5555,7 +5556,7 @@ line({expr}) The result is a Number, whi This autocommand jumps to the last known position in a file just after opening it, if the '" mark is set: > :au BufReadPost * - \ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit' + \ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit' \ | exe "normal! g`\"" \ | endif @@ -5607,16 +5608,16 @@ log10({expr}) *log10()* :echo log10(0.01) < -2.0 {only available when compiled with the |+float| feature} - -luaeval({expr}[, {expr}]) *luaeval()* - Evaluate Lua expression {expr} and return its result converted - to Vim data structures. Second {expr} may hold additional + +luaeval({expr} [, {expr}]) *luaeval()* + Evaluate Lua expression {expr} and return its result converted + to Vim data structures. Second {expr} may hold additional argument accessible as _A inside first {expr}. Strings are returned as they are. Boolean objects are converted to numbers. - Numbers are converted to |Float| values if vim was compiled + Numbers are converted to |Float| values if vim was compiled with |+float| and to numbers otherwise. - Dictionaries and lists obtained by vim.eval() are returned + Dictionaries and lists obtained by vim.eval() are returned as-is. Other objects are returned as zero without any errors. See |lua-luaeval| for more details. @@ -5626,7 +5627,7 @@ map({expr1}, {expr2}) *map()* {expr1} must be a |List| or a |Dictionary|. Replace each item in {expr1} with the result of evaluating {expr2}. {expr2} must be a |string| or |Funcref|. - + If {expr2} is a |string|, inside {expr2} |v:val| has the value of the current item. For a |Dictionary| |v:key| has the key of the current item and for a |List| |v:key| has the index of @@ -5665,12 +5666,12 @@ map({expr1}, {expr2}) *map()* defined with the "abort" flag. -maparg({name}[, {mode} [, {abbr} [, {dict}]]]) *maparg()* +maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()* When {dict} is omitted or zero: Return the rhs of mapping {name} in mode {mode}. The returned String has special characters translated like in the output of the ":map" command listing. - + When there is no mapping for {name}, an empty String is returned. @@ -5720,7 +5721,7 @@ maparg({name}[, {mode} [, {abbr} [, {dic exe 'nnoremap ==' . maparg('', 'n') -mapcheck({name}[, {mode} [, {abbr}]]) *mapcheck()* +mapcheck({name} [, {mode} [, {abbr}]]) *mapcheck()* Check if there is a mapping that matches with {name} in mode {mode}. See |maparg()| for {mode} and special names in {name}. @@ -5752,7 +5753,7 @@ mapcheck({name}[, {mode} [, {abbr}]]) < This avoids adding the "_vv" mapping when there already is a mapping for "_v" or for "_vvv". -match({expr}, {pat}[, {start}[, {count}]]) *match()* +match({expr}, {pat} [, {start} [, {count}]]) *match()* When {expr} is a |List| then this returns the index of the first item where {pat} matches. Each item is used as a String, |Lists| and |Dictionaries| are used as echoed. @@ -5808,7 +5809,7 @@ match({expr}, {pat}[, {start}[, {count}] done like 'magic' is set and 'cpoptions' is empty. *matchadd()* *E798* *E799* *E801* -matchadd({group}, {pattern}[, {priority}[, {id}[, {dict}]]]) +matchadd({group}, {pattern} [, {priority} [, {id} [, {dict}]]]) Defines a pattern to be highlighted in the current window (a "match"). It will be highlighted with {group}. Returns an identification number (ID), which can be used to delete the @@ -5861,7 +5862,7 @@ matchadd({group}, {pattern}[, {priority} one operation by |clearmatches()|. *matchaddpos()* -matchaddpos({group}, {pos}[, {priority}[, {id}[, {dict}]]]) +matchaddpos({group}, {pos} [, {priority} [, {id} [, {dict}]]]) Same as |matchadd()|, but requires a list of positions {pos} instead of a pattern. This command is faster than |matchadd()| because it does not require to handle regular expressions and @@ -5881,7 +5882,7 @@ matchaddpos({group}, {pos}[, {priority}[ be highlighted. - A list with three numbers, e.g., [23, 11, 3]. As above, but the third number gives the length of the highlight in bytes. - + The maximum number of positions is 8. Example: > @@ -5914,7 +5915,7 @@ matchdelete({id}) *matchdelete( otherwise -1. See example for |matchadd()|. All matches can be deleted in one operation by |clearmatches()|. -matchend({expr}, {pat}[, {start}[, {count}]]) *matchend()* +matchend({expr}, {pat} [, {start} [, {count}]]) *matchend()* Same as |match()|, but return the index of first character after the match. Example: > :echo matchend("testing", "ing") @@ -5933,7 +5934,7 @@ matchend({expr}, {pat}[, {start}[, {coun < result is "-1". When {expr} is a |List| the result is equal to |match()|. -matchlist({expr}, {pat}[, {start}[, {count}]]) *matchlist()* +matchlist({expr}, {pat} [, {start} [, {count}]]) *matchlist()* Same as |match()|, but return a |List|. The first item in the list is the matched string, same as what matchstr() would return. Following items are submatches, like "\1", "\2", etc. @@ -5943,7 +5944,7 @@ matchlist({expr}, {pat}[, {start}[, {cou < Results in: ['acd', 'a', '', 'c', 'd', '', '', '', '', ''] When there is no match an empty list is returned. -matchstr({expr}, {pat}[, {start}[, {count}]]) *matchstr()* +matchstr({expr}, {pat} [, {start} [, {count}]]) *matchstr()* Same as |match()|, but return the matched string. Example: > :echo matchstr("testing", "ing") < results in "ing". @@ -5956,7 +5957,7 @@ matchstr({expr}, {pat}[, {start}[, {coun When {expr} is a |List| then the matching item is returned. The type isn't changed, it's not necessarily a String. -matchstrpos({expr}, {pat}[, {start}[, {count}]]) *matchstrpos()* +matchstrpos({expr}, {pat} [, {start} [, {count}]]) *matchstrpos()* Same as |matchstr()|, but return the matched string, the start position and the end position of the match. Example: > :echo matchstrpos("testing", "ing") @@ -6066,7 +6067,7 @@ nextnonblank({lnum}) *nextnonblank() below it, zero is returned. See also |prevnonblank()|. -nr2char({expr}[, {utf8}]) *nr2char()* +nr2char({expr} [, {utf8}]) *nr2char()* Return a string with a single character, which has the number value {expr}. Examples: > nr2char(64) returns "@" @@ -6118,7 +6119,7 @@ pow({x}, {y}) *pow()* :echo pow(32, 0.20) < 2.0 {only available when compiled with the |+float| feature} - + prevnonblank({lnum}) *prevnonblank()* Return the line number of the first line at or above {lnum} that is not blank. Example: > @@ -6278,7 +6279,7 @@ printf({fmt}, {expr1} ...) *printf()* feature works just like 's'. *printf-f* *E807* - f F The Float argument is converted into a string of the + f F The Float argument is converted into a string of the form 123.456. The precision specifies the number of digits after the decimal point. When the precision is zero the decimal point is omitted. When the precision @@ -6332,11 +6333,11 @@ pumvisible() *pumvisible()* py3eval({expr}) *py3eval()* Evaluate Python expression {expr} and return its result converted to Vim data structures. - Numbers and strings are returned as they are (strings are - copied though, Unicode strings are additionally converted to + Numbers and strings are returned as they are (strings are + copied though, Unicode strings are additionally converted to 'encoding'). Lists are represented as Vim |List| type. - Dictionaries are represented as Vim |Dictionary| type with + Dictionaries are represented as Vim |Dictionary| type with keys converted to strings. {only available when compiled with the |+python3| feature} @@ -6344,10 +6345,10 @@ py3eval({expr}) *py3eval()* pyeval({expr}) *pyeval()* Evaluate Python expression {expr} and return its result converted to Vim data structures. - Numbers and strings are returned as they are (strings are + Numbers and strings are returned as they are (strings are copied though). Lists are represented as Vim |List| type. - Dictionaries are represented as Vim |Dictionary| type, + Dictionaries are represented as Vim |Dictionary| type, non-string keys result in error. {only available when compiled with the |+python| feature} @@ -6468,7 +6469,7 @@ remote_expr({server}, {string} [, {idvar and the result will be the empty string. Variables will be evaluated in the global namespace, - independent of a function currently being activel. Except + independent of a function currently being active. Except when in debug mode, then local function variables and arguments can be evaluated. @@ -6614,12 +6615,12 @@ round({expr}) *round()* < -5.0 {only available when compiled with the |+float| feature} -screenattr(row, col) *screenattr()* +screenattr({row}, {col}) *screenattr()* Like |screenchar()|, but return the attribute. This is a rather arbitrary number that can only be used to compare to the attribute at other positions. -screenchar(row, col) *screenchar()* +screenchar({row}, {col}) *screenchar()* The result is a Number, which is the character at position [row, col] on the screen. This works for every possible screen position, also status lines, window separators and the @@ -6675,7 +6676,7 @@ search({pattern} [, {flags} [, {stopline flag. 'ignorecase', 'smartcase' and 'magic' are used. - + When the 'z' flag is not given, searching always starts in column zero and then matches before the cursor are skipped. When the 'c' flag is present in 'cpo' the next search starts @@ -6992,7 +6993,7 @@ setline({lnum}, {text}) *setline()* < Note: The '[ and '] marks are not set. -setloclist({nr}, {list}[, {action}[, {what}]]) *setloclist()* +setloclist({nr}, {list} [, {action} [, {what}]]) *setloclist()* Create or replace or add to the location list for window {nr}. {nr} can be the window number or the |window-ID|. When {nr} is zero the current window is used. @@ -7060,9 +7061,9 @@ setpos({expr}, {list}) also set the preferred column. Also see the "curswant" key in |winrestview()|. -setqflist({list} [, {action}[, {what}]]) *setqflist()* +setqflist({list} [, {action} [, {what}]]) *setqflist()* Create or replace or add to the quickfix list. - + When {what} is not present, use the items in {list}. Each item must be a dictionary. Non-dictionary items in {list} are ignored. Each dictionary item can contain the following @@ -7101,12 +7102,12 @@ setqflist({list} [, {action}[, {what}]]) 'a' The items from {list} are added to the existing quickfix list. If there is no existing list, then a new list is created. - + 'r' The items from the current quickfix list are replaced with the items from {list}. This can also be used to clear the list: > :call setqflist([], 'r') -< +< 'f' All the quickfix lists in the quickfix stack are freed. @@ -7157,7 +7158,7 @@ setqflist({list} [, {action}[, {what}]]) *setreg()* setreg({regname}, {value} [, {options}]) Set the register {regname} to {value}. - {value} may be any value returned by |getreg()|, including + {value} may be any value returned by |getreg()|, including a |List|. If {options} contains "a" or {regname} is upper case, then the value is appended. @@ -7171,14 +7172,14 @@ setreg({regname}, {value} [, {options}]) in the longest line (counting a as 1 character). If {options} contains no register settings, then the default - is to use character mode unless {value} ends in a for - string {value} and linewise mode for list {value}. Blockwise + is to use character mode unless {value} ends in a for + string {value} and linewise mode for list {value}. Blockwise mode is never selected automatically. Returns zero for success, non-zero for failure. *E883* - Note: you may not use |List| containing more than one item to - set search and expression registers. Lists containing no + Note: you may not use |List| containing more than one item to + set search and expression registers. Lists containing no items act like empty strings. Examples: > @@ -7192,8 +7193,8 @@ setreg({regname}, {value} [, {options}]) :let var_amode = getregtype('a') .... :call setreg('a', var_a, var_amode) -< Note: you may not reliably restore register value - without using the third argument to |getreg()| as without it +< Note: you may not reliably restore register value + without using the third argument to |getreg()| as without it newlines are represented as newlines AND Nul bytes are represented as newlines as well, see |NL-used-for-Nul|. @@ -7298,7 +7299,7 @@ sin({expr}) *sin()* :echo sin(-4.01) < 0.763301 {only available when compiled with the |+float| feature} - + sinh({expr}) *sinh()* Return the hyperbolic sine of {expr} as a |Float| in the range @@ -7314,7 +7315,7 @@ sinh({expr}) *sinh()* sort({list} [, {func} [, {dict}]]) *sort()* *E702* Sort the items in {list} in-place. Returns {list}. - + If you want a list to remain unmodified make a copy first: > :let sortedlist = sort(copy(mylist)) @@ -7325,7 +7326,7 @@ sort({list} [, {func} [, {dict}]]) *so When {func} is given and it is '1' or 'i' then case is ignored. - + When {func} is given and it is 'n' then all items will be sorted numerical (Implementation detail: This uses the strtod() function to parse numbers, Strings, Lists, Dicts and @@ -7460,7 +7461,7 @@ sqrt({expr}) *sqrt()* < nan "nan" may be different, it depends on system libraries. {only available when compiled with the |+float| feature} - + str2float({expr}) *str2float()* Convert String {expr} to a Float. This mostly works the same @@ -7497,7 +7498,7 @@ strchars({expr} [, {skipcc}]) *strch counted separately. When {skipcc} set to 1, Composing characters are ignored. Also see |strlen()|, |strdisplaywidth()| and |strwidth()|. - + {skipcc} is only available after 7.4.755. For backward compatibility, you can define a wrapper function: > if has("patch-7.4.755") @@ -7514,7 +7515,7 @@ strchars({expr} [, {skipcc}]) *strch endfunction endif < -strcharpart({src}, {start}[, {len}]) *strcharpart()* +strcharpart({src}, {start} [, {len}]) *strcharpart()* Like |strpart()| but using character index and length instead of byte index and length. When a character index is used where a character does not @@ -7522,7 +7523,7 @@ strcharpart({src}, {start}[, {len}]) * strcharpart('abc', -1, 2) < results in 'a'. -strdisplaywidth({expr}[, {col}]) *strdisplaywidth()* +strdisplaywidth({expr} [, {col}]) *strdisplaywidth()* The result is a Number, which is the number of display cells String {expr} occupies on the screen when it starts at {col}. When {col} is omitted zero is used. Otherwise it is the @@ -7606,7 +7607,7 @@ strlen({expr}) The result is a Number, w |strchars()|. Also see |len()|, |strdisplaywidth()| and |strwidth()|. -strpart({src}, {start}[, {len}]) *strpart()* +strpart({src}, {start} [, {len}]) *strpart()* The result is a String, which is part of {src}, starting from byte {start}, with the byte length {len}. To count characters instead of bytes use |strcharpart()|. @@ -7658,7 +7659,7 @@ strwidth({expr}) *strwidth()* Ambiguous, this function's return value depends on 'ambiwidth'. Also see |strlen()|, |strdisplaywidth()| and |strchars()|. -submatch({nr}[, {list}]) *submatch()* *E935* +submatch({nr} [, {list}]) *submatch()* *E935* Only for an expression in a |:substitute| command or substitute() function. Returns the {nr}'th submatch of the matched text. When {nr} @@ -7667,8 +7668,8 @@ submatch({nr}[, {list}]) *submatch()* multi-line match or a NUL character in the text. Also see |sub-replace-expression|. - If {list} is present and non-zero then submatch() returns - a list of strings, similar to |getline()| with two arguments. + If {list} is present and non-zero then submatch() returns + a list of strings, similar to |getline()| with two arguments. NL characters in the text represent NUL characters in the text. Only returns more than one item for |:substitute|, inside @@ -7688,7 +7689,7 @@ substitute({expr}, {pat}, {sub}, {flags} the first match of {pat} is replaced with {sub}. When {flags} is "g", all matches of {pat} in {expr} are replaced. Otherwise {flags} should be "". - + This works like the ":substitute" command (without any flags). But the matching with {pat} is always done like the 'magic' option is set and 'cpoptions' is empty (to make scripts @@ -7837,9 +7838,9 @@ system({expr} [, {input}]) *system()* Get the output of the shell command {expr} as a string. See |systemlist()| to get the output as a List. - When {input} is given and is a string this string is written - to a file and passed as stdin to the command. The string is - written as-is, you need to take care of using the correct line + When {input} is given and is a string this string is written + to a file and passed as stdin to the command. The string is + written as-is, you need to take care of using the correct line separators yourself. If {input} is given and is a |List| it is written to the file in a way |writefile()| does with {binary} set to "b" (i.e. @@ -7858,10 +7859,10 @@ system({expr} [, {input}]) *system()* up on the screen which require |CTRL-L| to remove. > :silent let f = system('ls *.vim') < - Note: Use |shellescape()| or |::S| with |expand()| or - |fnamemodify()| to escape special characters in a command - argument. Newlines in {expr} may cause the command to fail. - The characters in 'shellquote' and 'shellxquote' may also + Note: Use |shellescape()| or |::S| with |expand()| or + |fnamemodify()| to escape special characters in a command + argument. Newlines in {expr} may cause the command to fail. + The characters in 'shellquote' and 'shellxquote' may also cause trouble. This is not to be used for interactive commands. @@ -7895,9 +7896,9 @@ system({expr} [, {input}]) *system()* systemlist({expr} [, {input}]) *systemlist()* - Same as |system()|, but returns a |List| with lines (parts of - output separated by NL) with NULs transformed into NLs. Output - is the same as |readfile()| will output with {binary} argument + Same as |system()|, but returns a |List| with lines (parts of + output separated by NL) with NULs transformed into NLs. Output + is the same as |readfile()| will output with {binary} argument set to "b". Note that on MS-Windows you may get trailing CR characters. @@ -7944,7 +7945,7 @@ tagfiles() Returns a |List| with the fil for the current buffer. This is the 'tags' option expanded. -taglist({expr}[, {filename}]) *taglist()* +taglist({expr} [, {filename}]) *taglist()* Returns a list of tags matching the regular expression {expr}. If {filename} is passed it is used to prioritize the results @@ -8139,7 +8140,7 @@ term_scrape({buf}, {row}) *term_scrap line is used. When {row} is invalid an empty string is returned. - Return a List containing a Dict for each screen cell: + Return a List containing a Dict for each screen cell: "chars" character(s) at the cell "fg" foreground color as #rrggbb "bg" background color as #rrggbb @@ -8279,7 +8280,7 @@ test_override({name}, {val}) *test_ov to run tests. Only to be used for testing Vim! The override is enabled when {val} is non-zero and removed when {val} is zero. - Current supported values for name are: + Current supported values for name are: name effect when {val} is non-zero ~ redraw disable the redrawing() function @@ -8424,7 +8425,7 @@ trunc({expr}) *trunc()* echo trunc(4.0) < 4.0 {only available when compiled with the |+float| feature} - + *type()* type({expr}) The result is a Number representing the type of {expr}. Instead of using the number directly, it is better to use the @@ -8477,7 +8478,7 @@ undotree() *undotree()* "save_last" Number of the last file write. Zero when no write yet. "save_cur" Number of the current position in the undo - tree. + tree. "synced" Non-zero when the last undo block was synced. This happens when waiting from input from the user. See |undo-blocks|. @@ -8761,7 +8762,7 @@ writefile({list}, {fname} [, {flags}]) appended to the file: > :call writefile(["foo"], "event.log", "a") :call writefile(["bar"], "event.log", "a") -> + < All NL characters are replaced with a NUL character. Inserting CR characters needs to be done before passing {list} to writefile(). @@ -9072,7 +9073,7 @@ See |:verbose-cmd| for more information. Define a new function by the name {name}. The body of the function follows in the next lines, until the matching |:endfunction|. - + The name must be made of alphanumeric characters and '_', and must start with a capital or "s:" (see above). Note that using "b:" or "g:" is not allowed. @@ -11059,7 +11060,7 @@ code can be used: > redir => scriptnames_output silent scriptnames redir END - + " Split the output into lines and parse each line. Add an entry to the " "scripts" dictionary. let scripts = {} diff --git a/runtime/doc/gui.txt b/runtime/doc/gui.txt --- a/runtime/doc/gui.txt +++ b/runtime/doc/gui.txt @@ -162,7 +162,7 @@ window Vim is running in with these comm *gui-IME* *iBus* Input methods for international characters in X that rely on the XIM framework, most notably iBus, have been known to produce undesirable results -in gVim. These may include an inability to enter spaces, or long delays +in gvim. These may include an inability to enter spaces, or long delays between typing a character and it being recognized by the application. One workaround that has been successful, for unknown reasons, is to prevent diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -640,7 +640,7 @@ starts. It can be fixed in one of these write the file twice and set the clock back. If you get W11 all the time, you may need to disable "Acronis Active -Protection" or register vim as a trusted service/application. +Protection" or register Vim as a trusted service/application. *W12* > Warning: File "{filename}" has changed and the buffer was changed in Vim as well diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4083,7 +4083,7 @@ A jump table for the options with a shor set. |hl-Question| r |hit-enter| prompt and yes/no questions |hl-StatusLine| s status line of current window |status-line| - |hl-StatusLineNC| S status lines of not-current windows + |hl-StatusLineNC| S status lines of not-current windows |hl-Title| t Titles for output from ":set all", ":autocmd" etc. |hl-VertSplit| c column used to separate vertically split windows |hl-Visual| v Visual mode @@ -5487,7 +5487,7 @@ A jump table for the options with a shor Specifies the name of the MzScheme shared library. The default is DYNAMIC_MZSCH_DLL which was specified at compile time. Environment variables are expanded |:set_env|. - The value must be set in the |vimrc| script or ealier. In the + The value must be set in the |vimrc| script or earlier. In the startup, before the |load-plugins| step. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -1,4 +1,4 @@ -*pi_netrw.txt* For Vim version 8.0. Last change: 2016 Apr 20 +*pi_netrw.txt* For Vim version 8.0. Last change: 2017 Nov 03 ------------------------------------------------ NETRW REFERENCE MANUAL by Charles E. Campbell @@ -6,7 +6,7 @@ Author: Charles E. Campbell (remove NOSPAM from Campbell's email first) -Copyright: Copyright (C) 2016 Charles E Campbell *netrw-copyright* +Copyright: Copyright (C) 2017 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 @@ -17,7 +17,6 @@ Copyright: Copyright (C) 2016 Charles E holder be liable for any damages resulting from the use of this software. Use at your own risk! - *netrw* *dav* *ftp* *netrw-file* *rcp* *scp* *davs* *http* *netrw.vim* *rsync* *sftp* @@ -73,7 +72,7 @@ 9. Browsing............................ 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| + Making The Browsing Directory The Current Directory.|netrw-cd| Marking Files.......................................|netrw-mf| Unmarking Files.....................................|netrw-mF| Marking Files By Location List......................|netrw-qL| @@ -83,6 +82,7 @@ 9. Browsing............................ Marked Files: Arbitrary Shell Command, En Bloc......|netrw-mX| Marked Files: Arbitrary Vim Command.................|netrw-mv| Marked Files: Argument List.........................|netrw-ma| |netrw-mA| + Marked Files: Buffer List...........................|netrw-cb| |netrw-cB| Marked Files: Compression And Decompression.........|netrw-mz| Marked Files: Copying...............................|netrw-mc| Marked Files: Diff..................................|netrw-md| @@ -155,7 +155,7 @@ Windows' ftp doesn't support .netrc; how let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\MyUserName\MACHINE' < -Netrw will substitute the host's machine name for "MACHINE" from the url it is +Netrw will substitute the host's machine name for "MACHINE" from the URL it is attempting to open, and so one may specify > userid password @@ -212,7 +212,7 @@ EXTERNAL APPLICATIONS AND PROTOCOLS *n http: g:netrw_http_cmd = "fetch" elseif fetch is available http: *g:netrw_http_put_cmd* = "curl -T" rcp: *g:netrw_rcp_cmd* = "rcp" - rsync: *g:netrw_rsync_cmd* = "rsync -a" + rsync: *g:netrw_rsync_cmd* = "rsync" (see |g:netrw_rsync_sep|) scp: *g:netrw_scp_cmd* = "scp -q" sftp: *g:netrw_sftp_cmd* = "sftp" file: *g:netrw_file_cmd* = "elinks" or "links" @@ -223,7 +223,7 @@ EXTERNAL APPLICATIONS AND PROTOCOLS *n elinks : "-source >" links : "-dump >" - curl : "-o" + curl : "-L -o" wget : "-q -O" fetch : "-o" < @@ -238,7 +238,7 @@ EXTERNAL APPLICATIONS AND PROTOCOLS *n READING *netrw-read* *netrw-nread* {{{2 - Generally, one may just use the url notation with a normal editing + Generally, one may just use the URL notation with a normal editing command, such as > :e ftp://[user@]machine/path @@ -260,7 +260,7 @@ READING *netrw-read* *netrw-nread* WRITING *netrw-write* *netrw-nwrite* {{{2 - One may just use the url notation with a normal file writing + One may just use the URL notation with a normal file writing command, such as > :w ftp://[user@]machine/path @@ -281,7 +281,7 @@ WRITING *netrw-write* *netrw-nwrite* SOURCING *netrw-source* {{{2 - One may just use the url notation with the normal file sourcing + One may just use the URL notation with the normal file sourcing command, such as > :so ftp://[user@]machine/path @@ -479,7 +479,7 @@ file using root-relative paths, use the ============================================================================== 4. Network-Oriented File Transfer *netrw-xfer* {{{1 -Network-oriented file transfer under Vim is implemented by a VimL-based script +Network-oriented file transfer under Vim is implemented by a vim script () using plugin techniques. It currently supports both reading and writing across networks using rcp, scp, ftp or ftp+<.netrc>, scp, fetch, dav/cadaver, rsync, or sftp. @@ -532,7 +532,7 @@ variable (ex. scp uses the variable g:ne let g:netrw_sftp_cmd= '"c:\Program Files\PuTTY\psftp.exe"' < (note: it has been reported that windows 7 with putty v0.6's "-batch" option - doesn't work, so it's best to leave it off for that system) + doesn't work, so its best to leave it off for that system) See |netrw-p8| for more about putty, pscp, psftp, etc. @@ -734,11 +734,11 @@ 7. Ex Commands *netrw-ex* {{{1 The usual read/write commands are supported. There are also a few additional commands available. Often you won't need to use Nwrite or Nread as shown in |netrw-transparent| (ie. simply use > - :e url - :r url - :w url + :e URL + :r URL + :w URL instead, as appropriate) -- see |netrw-urls|. In the explanations -below, a {netfile} is an url to a remote file. +below, a {netfile} is a URL to a remote file. *:Nwrite* *:Nw* :[range]Nw[rite] Write the specified lines to the current @@ -868,9 +868,11 @@ variables listed below, and may be modif g:netrw_http_cmd var ="fetch -o" if fetch is available g:netrw_http_cmd var ="wget -O" else if wget is available g:netrw_http_put_cmd var ="curl -T" - |g:netrw_list_cmd| var ="ssh USEPORT HOSTNAME ls -Fa" + |g:netrw_list_cmd| var ="ssh USEPORT HOSTNAME ls -Fa" g:netrw_rcp_cmd var ="rcp" - g:netrw_rsync_cmd var ="rsync -a" + g:netrw_rsync_cmd var ="rsync" + *g:netrw_rsync_sep* var ="/" used to separate the hostname + from the file spec g:netrw_scp_cmd var ="scp -q" g:netrw_sftp_cmd var ="sftp" > ------------------------------------------------------------------------- @@ -1007,7 +1009,7 @@ where [protocol] is typically scp or ftp vim ftp://ftp.home.vim.org/pub/vim/ < For local directories, the trailing slash is not required. Again, because it's -easy to miss: to browse remote directories, the url must terminate with a +easy to miss: to browse remote directories, the URL must terminate with a slash! If you'd like to avoid entering the password repeatedly for remote directory @@ -1077,9 +1079,9 @@ QUICK REFERENCE: MAPS *netrw-browse-m Browse using a gvim server |netrw-ctrl-r| Shrink/expand a netrw/explore window |netrw-c-tab| - Makes Netrw go up one directory |netrw--| - a Toggles between normal display, |netrw-a| + a Cycles between normal display, |netrw-a| hiding (suppress display of files matching g:netrw_list_hide) - showing (display only files which match g:netrw_list_hide) + and showing (display only files which match g:netrw_list_hide) c Make browsing directory the current directory |netrw-c| C Setting the editing window |netrw-C| d Make a directory |netrw-d| @@ -1090,6 +1092,7 @@ QUICK REFERENCE: MAPS *netrw-browse-m gh Quick hide/unhide of dot-files |netrw-gh| gn Make top of tree the directory below the cursor |netrw-gn| i Cycle between thin, long, wide, and tree listings |netrw-i| + I Toggle the displaying of the banner |netrw-I| mb Bookmark current directory |netrw-mb| mc Copy marked files to marked-file target directory |netrw-mc| md Apply diff to marked files (up to 3) |netrw-md| @@ -1169,25 +1172,26 @@ QUICK REFERENCE: COMMANDS *netrw-explore BANNER DISPLAY *netrw-I* -One may toggle the banner display on and off by pressing "I". +One may toggle the displaying of the banner by pressing "I". Also See: |g:netrw_banner| -BOOKMARKING A DIRECTORY *netrw-mb* *netrw-bookmark* *netrw-bookmarks* {{{2 +BOOKMARKING A DIRECTORY *netrw-mb* *netrw-bookmark* *netrw-bookmarks* {{{2 One may easily "bookmark" the currently browsed directory by using > mb < *.netrwbook* -Bookmarks are retained in between sessions in a $HOME/.netrwbook file, and are -kept in sorted order. +Bookmarks are retained in between sessions of vim in a file called .netrwbook +as a |List|, which is typically stored in the first directory on the user's +'|runtimepath|'; entries are kept in sorted order. If there are marked files and/or directories, mb will add them to the bookmark list. -*netrw-:NetrwMB* + *netrw-:NetrwMB* Addtionally, one may use :NetrwMB to bookmark files or directories. > :NetrwMB[!] [files/directories] @@ -1206,7 +1210,7 @@ The :NetrwMB command is available outsid invoked in the session). The file ".netrwbook" holds bookmarks when netrw (and vim) is not active. By -default, it's stored on the first directory on the user's |'runtimepath'|. +default, its stored on the first directory on the user's |'runtimepath'|. Related Topics: |netrw-gb| how to return (go) to a bookmark @@ -1418,20 +1422,20 @@ Related Topics: CHANGING TO A PREDECESSOR DIRECTORY *netrw-u* *netrw-updir* {{{2 -Every time you change to a new directory (new for the current session), -netrw will save the directory in a recently-visited directory history -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, qb (see |netrw-qb|) lists the history number which may -be used in that count. +Every time you change to a new directory (new for the current session), netrw +will save the directory in a recently-visited directory history list (unless +|g:netrw_dirhistmax| is zero; by default, it holds ten entries). 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, qb (see |netrw-qb|) lists the history number which may be +used in that count. *.netrwhist* See |g:netrw_dirhistmax| for how to control the quantity of history stack slots. The file ".netrwhist" holds history when netrw (and vim) is not -active. By default, it's stored on the first directory on the user's +active. By default, its stored on the first directory on the user's |'runtimepath'|. Related Topics: @@ -1467,10 +1471,10 @@ changing the top of the tree listing. NETRW CLEAN *netrw-clean* *:NetrwClean* {{{2 -With NetrwClean one may easily remove netrw from one's home directory; +With :NetrwClean one may easily remove netrw from one's home directory; more precisely, from the first directory on your |'runtimepath'|. -With NetrwClean!, netrw will attempt to remove netrw from all directories on +With :NetrwClean!, netrw will attempt to remove netrw from all directories on your |'runtimepath'|. Of course, you have to have write/delete permissions correct to do this. @@ -1502,7 +1506,7 @@ Netrw determines which special handler b If g:netrw_browsex_viewer == '-', then netrwFileHandlers#Invoke() will be used instead (see |netrw_filehandler|). - * for Windows 32 or 64, the url and FileProtocolHandler dlls are used. + * for Windows 32 or 64, the URL and FileProtocolHandler dlls are used. * for Gnome (with gnome-open): gnome-open is used. * for KDE (with kfmclient) : kfmclient is used * for Mac OS X : open is used. @@ -1518,9 +1522,10 @@ will apply a special handler to it (like One may also use visual mode (see |visual-start|) to select the text that the special handler will use. Normally gx uses expand("") to pick up the text under the cursor; one may change what |expand()| uses via the -|g:netrw_gx| variable. Alternatively, one may select the text to be used by -gx via first making a visual selection (see |visual-block|) or by changing -the |'isfname'| option (which is global, so netrw doesn't modify it). +|g:netrw_gx| variable (options include "", ""). Note that +expand("") depends on the |'isfname'| setting. Alternatively, one may +select the text to be used by gx by making a visual selection (see +|visual-block|) and then pressing gx. Associated setting variables: |g:netrw_gx| control how gx picks up the text under the cursor @@ -1612,6 +1617,11 @@ A further approach is to delete files wh This will cause the matching files to be marked. Then, press "D". +If your vim has 7.4 with patch#1107, then |g:netrw_localrmdir| no longer +is used to remove directories; instead, vim's |delete()| is used with +the "d" option. Please note that only empty directories may be deleted +with the "D" mapping. Regular files are deleted with |delete()|, too. + The |g:netrw_rm_cmd|, |g:netrw_rmf_cmd|, and |g:netrw_rmdir_cmd| variables are used to control the attempts to remove remote files and directories. The g:netrw_rm_cmd is used with files, and its default value is: @@ -1675,17 +1685,18 @@ DIRECTORY EXPLORATION COMMANDS {{{2 The [N] specifies a |g:netrw_winsize| just for the new :Lexplore window. - Those who like this method often also often like tree style displays; + Those who like this method often also like tree style displays; see |g:netrw_liststyle|. +:[N]Lexplore! [dir] is similar to :Lexplore, except that the full-height + Explorer window will open on the right hand side and an + uninitialized |g:netrw_chgwin| will be set to 1 (eg. edits will + preferentially occur in the leftmost window). + Also see: |netrw-C| |g:netrw_browse_split| |g:netrw_wiw| |netrw-p| |netrw-P| |g:netrw_chgwin| |netrw-c-tab| |g:netrw_winsize| -:[N]Lexplore! is like :Lexplore, except that the full-height Explorer window - will open on the right hand side and an uninitialized |g:netrw_chgwin| - will be set to 1. - *netrw-:Sexplore* :[N]Sexplore will always split the window before invoking the local-directory browser. As with Explore, the splitting is normally done @@ -1847,9 +1858,11 @@ EXECUTING FILE UNDER CURSOR VIA SYSTEM() Pressing X while the cursor is atop an executable file will yield a prompt using the filename asking for any arguments. Upon pressing a [return], netrw -will then call |system()| with that command and arguments. The result will -be displayed by |:echomsg|, and so |:messages| will repeat display of the -result. Ansi escape sequences will be stripped out. +will then call |system()| with that command and arguments. The result will be +displayed by |:echomsg|, and so |:messages| will repeat display of the result. +Ansi escape sequences will be stripped out. + +See |cmdline-window| for directions for more on how to edit the arguments. FORCING TREATMENT AS A FILE OR DIRECTORY *netrw-gd* *netrw-gf* {{{2 @@ -2072,7 +2085,7 @@ Associated setting variables: |g:netrw_l |g:netrw_remote_mkdir| |netrw-%| -MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-c* {{{2 +MAKING THE BROWSING DIRECTORY THE CURRENT DIRECTORY *netrw-cd* {{{2 By default, |g:netrw_keepdir| is 1. This setting means that the current directory will not track the browsing directory. (done for backwards @@ -2087,6 +2100,9 @@ the two directories the same, use the "c set Vim's notion of the current directory to netrw's current browsing directory. +*netrw-c* : This map's name has been changed from "c" to cd (see |netrw-cd|). + This change was done to allow for |netrw-cb| and |netrw-cB| maps. + Associated setting variable: |g:netrw_keepdir| MARKING FILES *netrw-:MF* *netrw-mf* {{{2 @@ -2131,6 +2147,7 @@ The following netrw maps make use of mar |netrw-mg| Apply vimgrep to marked files |netrw-mm| Move marked files to target |netrw-mp| Print marked files + |netrw-ms| Netrw will source marked files |netrw-mt| Set target for |netrw-mm| and |netrw-mc| |netrw-mT| Generate tags using marked files |netrw-mv| Apply vim command to marked files @@ -2205,6 +2222,9 @@ converts "*" into ".*" (see |regexp|) an future I may make it possible to use |regexp|s instead of glob()-style expressions (yet-another-option). +See |cmdline-window| for directions on more on how to edit the regular +expression. + MARKED FILES, ARBITRARY VIM COMMAND *netrw-mv* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) @@ -2218,8 +2238,9 @@ the local marked file list, individually * run vim command * sil! keepalt wq! -A prompt, "Enter vim command: ", will be issued to elicit the vim command -you wish used. +A prompt, "Enter vim command: ", will be issued to elicit the vim command you +wish used. See |cmdline-window| for directions for more on how to edit the +command. MARKED FILES, ARBITRARY SHELL COMMAND *netrw-mx* {{{2 @@ -2270,7 +2291,17 @@ MARKED FILES: ARGUMENT LIST *netrw-ma Using ma, one moves filenames from the marked file list to the argument list. Using mA, one moves filenames from the argument list to the marked file list. -See Also: |netrw-qF| |argument-list| |:args| +See Also: |netrw-cb| |netrw-cB| |netrw-qF| |argument-list| |:args| + + +MARKED FILES: BUFFER LIST *netrw-cb* *netrw-cB* + (See |netrw-mf| and |netrw-mr| for how to mark files) + (uses the global marked-file list) + +Using cb, one moves filenames from the marked file list to the buffer list. +Using cB, one copies filenames from the buffer list to the marked file list. + +See Also: |netrw-ma| |netrw-mA| |netrw-qF| |buffer-list| |:buffers| MARKED FILES: COMPRESSION AND DECOMPRESSION *netrw-mz* {{{2 @@ -2306,8 +2337,8 @@ One may also copy directories and their directory. Associated setting variables: - |g:netrw_localcopycmd| - |g:netrw_localcopydircmd| + |g:netrw_localcopycmd| |g:netrw_localcopycmdopt| + |g:netrw_localcopydircmd| |g:netrw_localcopydircmdopt| |g:netrw_ssh_cmd| MARKED FILES: DIFF *netrw-md* {{{2 @@ -2452,8 +2483,8 @@ When a remote set of files are tagged, t ie. a copy is transferred to the local system's directory. The now local tags file is then modified so that one may use it through the network. The modification made concerns the names of the files in the tags; each filename is -preceded by the netrw-compatible url used to obtain it. When one subsequently -uses one of the go to tag actions (|tags|), the url will be used by netrw to +preceded by the netrw-compatible URL used to obtain it. When one subsequently +uses one of the go to tag actions (|tags|), the URL will be used by netrw to edit the desired file and go to the tag. Associated setting variables: |g:netrw_ctags| |g:netrw_ssh_cmd| @@ -2555,8 +2586,8 @@ your browsing preferences. (see also: | editing. It will also use the specified tab and window numbers to perform editing (see |clientserver|, |netrw-ctrl-r|) - This option does not affect |:Lexplore| - windows. + This option does not affect the production of + |:Lexplore| windows. Related topics: |g:netrw_alto| |g:netrw_altv| @@ -2715,6 +2746,7 @@ your browsing preferences. (see also: | *g:netrw_home* The home directory for where bookmarks and history are saved (as .netrwbook and .netrwhist). + Netrw uses |expand()|on the string. default: the first directory on the |'runtimepath'| @@ -2735,7 +2767,7 @@ your browsing preferences. (see also: | default: (if ssh is executable) "ssh HOSTNAME ls -FLa" - *g:netrw_list_cmd_options* If this variable exists, then its contents are + *g:netrw_list_cmd_options* If this variable exists, then its contents are appended to the g:netrw_list_cmd. For example, use "2>/dev/null" to get rid of banner messages on unix systems. @@ -2761,26 +2793,52 @@ your browsing preferences. (see also: | let g:netrw_list_hide= netrw_gitignore#Hide().'.*\.swp$' default: "" - *g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin - ="copy" Windows + *g:netrw_localcopycmd* ="cp" Linux/Unix/MacOS/Cygwin + =expand("$COMSPEC") Windows Copies marked files (|netrw-mf|) to target directory (|netrw-mt|, |netrw-mc|) - *g:netrw_localcopydircmd* ="cp -R" Linux/Unix/MacOS/Cygwin - ="xcopy /e /c /h/ /i /k" Windows + *g:netrw_localcopycmdopt* ='' Linux/Unix/MacOS/Cygwin + =' \c copy' Windows + Options for the |g:netrw_localcopycmd| + + *g:netrw_localcopydircmd* ="cp" Linux/Unix/MacOS/Cygwin + =expand("$COMSPEC") Windows Copies directories to target directory. (|netrw-mc|, |netrw-mt|) - *g:netrw_localmkdir* command for making a local directory - default: "mkdir" - - *g:netrw_localmovecmd* ="mv" Linux/Unix/MacOS/Cygwin - ="move" Windows + *g:netrw_localcopydircmdopt* =" -R" Linux/Unix/MacOS/Cygwin + =" /c xcopy /e /c /h/ /i /k" Windows + Options for |g:netrw_localcopydircmd| + + *g:netrw_localmkdir* ="mkdir" Linux/Unix/MacOS/Cygwin + =expand("$COMSPEC") Windows + command for making a local directory + + *g:netrw_localmkdiropt* ="" Linux/Unix/MacOS/Cygwin + =" /c mkdir" Windows + Options for |g:netrw_localmkdir| + + *g:netrw_localmovecmd* ="mv" Linux/Unix/MacOS/Cygwin + =expand("$COMSPEC") Windows Moves marked files (|netrw-mf|) to target directory (|netrw-mt|, |netrw-mm|) - *g:netrw_localrmdir* remove directory command (rmdir) - default: "rmdir" + *g:netrw_localmovecmdopt* ="" Linux/Unix/MacOS/Cygwin + =" /c move" Windows + Options for |g:netrw_localmovecmd| + + *g:netrw_localrmdir* ="rmdir" Linux/Unix/MacOS/Cygwin + =expand("$COMSPEC") Windows + Remove directory command (rmdir) + This variable is only used if your vim is + earlier than 7.4 or if your vim doesn't + have patch#1107. Otherwise, |delete()| + is used with the "d" option. + + *g:netrw_localrmdiropt* ="" Linux/Unix/MacOS/Cygwin + =" /c rmdir" Windows + Options for |g:netrw_localrmdir| *g:netrw_maxfilenamelen* =32 by default, selected so as to make long listings fit on 80 column displays. @@ -2893,17 +2951,23 @@ your browsing preferences. (see also: | netrwTilde : * netrwTmp : tmp* *tmp - These syntax highlighting groups are linked - to Folded or DiffChange by default - (see |hl-Folded| and |hl-DiffChange|), but - one may put lines like > + In addition, those groups mentioned in + |'suffixes'| are also added to the special + file highlighting group. + These syntax highlighting groups are linked + to netrwGray or Folded by default + (see |hl-Folded|), but one may put lines like > hi link netrwCompress Visual < into one's <.vimrc> to use one's own preferences. Alternatively, one may - put such specifications into - .vim/after/syntax/netrw.vim. - - As an example, I myself use a dark-background + put such specifications into > + .vim/after/syntax/netrw.vim. +< The netrwGray highlighting is set up by + netrw when > + * netrwGray has not been previously + defined + * the gui is running +< As an example, I myself use a dark-background colorscheme with the following in .vim/after/syntax/netrw.vim: > @@ -3138,8 +3202,8 @@ If there are no marked files: (see |netr Renaming files and directories involves moving the cursor to the file/directory to be moved (renamed) and pressing "R". You will then be - queried for what you want the file/directory to be renamed to You may select - a range of lines with the "V" command (visual selection), and then + queried for what you want the file/directory to be renamed to. You may + select a range of lines with the "V" command (visual selection), and then press "R"; you will be queried for each file as to what you want it renamed to. @@ -3171,16 +3235,20 @@ If there are marked files: (see |netrw- Note that moving files is a dangerous operation; copies are safer. That's because a "move" for remote files is actually a copy + delete -- and if - the copy fails and the delete does not, you may lose the file. + the copy fails and the delete succeeds you may lose the file. Use at your own risk. -The g:netrw_rename_cmd variable is used to implement remote renaming. By -default its value is: +The *g:netrw_rename_cmd* variable is used to implement remote renaming. By +default its value is: > ssh HOSTNAME mv - +< One may rename a block of files and directories by selecting them with -V (|linewise-visual|) when using thin style +V (|linewise-visual|) when using thin style. + +See |cmdline-editing| for more on how to edit the command line; in particular, +you'll find (initiates cmdline window editing) and (uses the +command line under the cursor) useful in conjunction with the R command. SELECTING SORTING STYLE *netrw-s* *netrw-sort* {{{2 @@ -3201,8 +3269,8 @@ number. Subsequent selection of a file window. * C : by itself, will select the current window holding a netrw buffer - for editing via |netrw-cr|. The C mapping is only available while in - netrw buffers. + for subsequent editing via |netrw-cr|. The C mapping is only available + while in netrw buffers. * [count]C : the count will be used as the window number to be used for subsequent editing via |netrw-cr|. @@ -3215,7 +3283,7 @@ window. Using > let g:netrw_chgwin= -1 will restore the default editing behavior -(ie. editing will use the current window). +(ie. subsequent editing will use the current window). Related topics: |netrw-cr| |g:netrw_browse_split| Associated setting variables: |g:netrw_chgwin| @@ -3236,9 +3304,9 @@ only if your terminal supports different * Else bring up a |:Lexplore| window -If |g:netrw_usetab| exists or is zero, or if there is a pre-existing mapping +If |g:netrw_usetab| exists and is zero, or if there is a pre-existing mapping for , then the will not be mapped. One may map something other -than a , too: (but you'll still need to have had g:netrw_usetab set) > +than a , too: (but you'll still need to have had |g:netrw_usetab| set). > nmap (whatever) NetrwShrink < @@ -3271,9 +3339,10 @@ The user function is passed one argument fun! ExampleUserMapFunc(islocal) < -where a:islocal is 1 if it's a local-directory system call or 0 when +where a:islocal is 1 if its a local-directory system call or 0 when remote-directory system call. + *netrw-call* *netrw-expose* *netrw-modify* Use netrw#Expose("varname") to access netrw-internal (script-local) variables. Use netrw#Modify("varname",newvalue) to change netrw-internal variables. @@ -3595,7 +3664,7 @@ 10. Problems and Fixes *netrw-proble *netrw-p16* P16. When editing remote files (ex. :e ftp://hostname/path/file), - under Windows I get an |E303| message complaining that it's unable + under Windows I get an |E303| message complaining that its unable to open a swap file. (romainl) It looks like you are starting Vim from a protected @@ -3649,7 +3718,7 @@ 10. Problems and Fixes *netrw-proble P21. I've made a directory (or file) with an accented character, but netrw isn't letting me enter that directory/read that file: - It's likely that the shell or o/s is using a different encoding + Its likely that the shell or o/s is using a different encoding than you have vim (netrw) using. A patch to vim supporting "systemencoding" may address this issue in the future; for now, just have netrw use the proper encoding. For example: > @@ -3765,6 +3834,102 @@ netrw: ============================================================================== 12. History *netrw-history* {{{1 + v162: Sep 19, 2016 * (haya14busa) pointed out two syntax errors + with a patch; these are now fixed. + Oct 26, 2016 * I started using mate-terminal and found that + x and gx (|netrw-x| and |netrw-gx|) were no + longer working. Fixed (using atril when + $DESKTOP_SESSION is "mate"). + Nov 04, 2016 * (Martin Vuille) pointed out that @+ was + being restored with keepregstar rather than + keepregplus. + Nov 09, 2016 * Broke apart the command from the options, + mostly for Windows. Introduced new netrw + settings: |g:netrw_localcopycmdopt| + |g:netrw_localcopydircmdopt| |g:netrw_localmkdiropt| + |g:netrw_localmovecmdopt| |g:netrw_localrmdiropt| + Nov 21, 2016 * (mattn) provided a patch for preview; swapped + winwidth() with winheight() + Nov 22, 2016 * (glacambre) reported that files containing + spaces weren't being obtained properly via + scp. Fix: apparently using single quotes + such as with 'file name' wasn't enough; the + spaces inside the quotes also had to be + escaped (ie. 'file\ name'). + * Also fixed obtain (|netrw-O|) to be able to + obtain files with spaces in their names + Dec 20, 2016 * (xc1427) Reported that using "I" (|netrw-I|) + when atop "Hiding" in the banner also caused + the active-banner hiding control to occur + Jan 03, 2017 * (Enno Nagel) reported that attempting to + apply netrw to a directory that was without + read permission caused a syntax error. + Jan 13, 2017 * (Ingo Karkat) provided a patch which makes + using netrw#Call() better. Now returns + value of internal routines return, for example. + Jan 13, 2017 * (Ingo Karkat) changed netrw#FileUrlRead to + use |:edit| instead of |:read|. I also + changed the routine name to netrw#FileUrlEdit. + Jan 16, 2017 * (Sayem) reported a problem where :Lexplore + could generate a new listing buffer and + window instead of toggling the netrw display. + Unfortunately, the directions for eliciting + the problem weren't complete, so I may or + may not have fixed that issue. + Feb 06, 2017 * Implemented cb and cB. Changed "c" to "cd". + (see |netrw-cb|, |netrw-cB|, and |netrw-cd|) + Mar 21, 2017 * previously, netrw would specify (safe) settings + even when the setting was already safe for + netrw. Netrw now attempts to leave such + already-netrw-safe settings alone. + (affects s:NetrwOptionRestore() and + s:NetrwSafeOptions(); also introduced + s:NetrwRestoreSetting()) + Jun 26, 2017 * (Christian Brabandt) provided a patch to + allow curl to follow redirects (ie. -L + option) + Jun 26, 2017 * (Callum Howard) reported a problem with + :Lexpore not removing the Lexplore window + after a change-directory + Aug 30, 2017 * (Ingo Karkat) one cannot switch to the + previously edited file (e.g. with CTRL-^) + after editing a file:// URL. Patch to + have a "keepalt" included. + Oct 17, 2017 * (Adam Faryna) reported that gn (|netrw-gn|) + did not work on directories in the current + tree + v157: Apr 20, 2016 * (Nicola) had set up a "nmap ..." with + a function that returned a 0 while silently + invoking a shell command. The shell command + activated a ShellCmdPost event which in turn + called s:LocalBrowseRefresh(). That looks + over all netrw buffers for changes needing + refreshes. However, inside a |:map-|, + tab and window changes are disallowed. Fixed. + (affects netrw's s:LocalBrowseRefresh()) + * |g:netrw_localrmdir| not used any more, but + the relevant patch that causes |delete()| to + take over was #1107 (not #1109). + * |expand()| is now used on |g:netrw_home|; + consequently, g:netrw_home may now use + environment variables + * s:NetrwLeftmouse and s:NetrwCLeftmouse will + return without doing anything if invoked + when inside a non-netrw window + Jun 15, 2016 * gx now calls netrw#GX() which returns + the word under the cursor. The new + wrinkle: if one is in a netrw buffer, + then netrw's s:NetrwGetWord(). + Jun 22, 2016 * Netrw was executing all its associated + Filetype commands silently; I'm going + to try doing that "noisily" and see if + folks have a problem with that. + Aug 12, 2016 * Changed order of tool selection for + handling http://... viewing. + (Nikolay Aleksandrovich Pavlov) + Aug 21, 2016 * Included hiding/showing/all for tree + listings + * Fixed refresh (^L) for tree listings v156: Feb 18, 2016 * Changed =~ to =~# where appropriate Feb 23, 2016 * s:ComposePath(base,subdir) now uses fnameescape() on the base portion @@ -3796,9 +3961,9 @@ 12. History *netrw-history* {{{1 tell me how they're useful and should be retained? Nov 20, 2015 * Added |netrw-ma| and |netrw-mA| support - Nov 20, 2015 * gx (|netrw-gx|) on an url downloaded the + Nov 20, 2015 * gx (|netrw-gx|) on a URL downloaded the file in addition to simply bringing up the - url in a browser. Fixed. + URL in a browser. Fixed. Nov 23, 2015 * Added |g:netrw_sizestyle| support Nov 27, 2015 * Inserted a lot of s into various netrw maps. diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -873,7 +873,7 @@ 3. Execute Ex commands, from environment (*) Using this file or environment variable will cause 'compatible' to be off by default. See |compatible-default|. - Note: When using the |mzscheme| interface, it is initialzed after loading + Note: When using the |mzscheme| interface, it is initialized after loading the vimrc file. Changing 'mzschemedll' later has no effect. 4. Load the plugin scripts. *load-plugins* diff --git a/runtime/doc/tags b/runtime/doc/tags --- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -6393,10 +6393,15 @@ g:netrw_list_cmd_options pi_netrw.txt /* g:netrw_list_hide pi_netrw.txt /*g:netrw_list_hide* g:netrw_liststyle pi_netrw.txt /*g:netrw_liststyle* g:netrw_localcopycmd pi_netrw.txt /*g:netrw_localcopycmd* +g:netrw_localcopycmdopt pi_netrw.txt /*g:netrw_localcopycmdopt* g:netrw_localcopydircmd pi_netrw.txt /*g:netrw_localcopydircmd* +g:netrw_localcopydircmdopt pi_netrw.txt /*g:netrw_localcopydircmdopt* g:netrw_localmkdir pi_netrw.txt /*g:netrw_localmkdir* +g:netrw_localmkdiropt pi_netrw.txt /*g:netrw_localmkdiropt* g:netrw_localmovecmd pi_netrw.txt /*g:netrw_localmovecmd* +g:netrw_localmovecmdopt pi_netrw.txt /*g:netrw_localmovecmdopt* g:netrw_localrmdir pi_netrw.txt /*g:netrw_localrmdir* +g:netrw_localrmdiropt pi_netrw.txt /*g:netrw_localrmdiropt* g:netrw_maxfilenamelen pi_netrw.txt /*g:netrw_maxfilenamelen* g:netrw_menu pi_netrw.txt /*g:netrw_menu* g:netrw_mkdir_cmd pi_netrw.txt /*g:netrw_mkdir_cmd* @@ -6406,11 +6411,13 @@ g:netrw_nogx pi_netrw.txt /*g:netrw_nogx g:netrw_preview pi_netrw.txt /*g:netrw_preview* g:netrw_rcp_cmd pi_netrw.txt /*g:netrw_rcp_cmd* g:netrw_remote_mkdir pi_netrw.txt /*g:netrw_remote_mkdir* +g:netrw_rename_cmd pi_netrw.txt /*g:netrw_rename_cmd* g:netrw_retmap pi_netrw.txt /*g:netrw_retmap* g:netrw_rm_cmd pi_netrw.txt /*g:netrw_rm_cmd* g:netrw_rmdir_cmd pi_netrw.txt /*g:netrw_rmdir_cmd* g:netrw_rmf_cmd pi_netrw.txt /*g:netrw_rmf_cmd* g:netrw_rsync_cmd pi_netrw.txt /*g:netrw_rsync_cmd* +g:netrw_rsync_sep pi_netrw.txt /*g:netrw_rsync_sep* g:netrw_scp_cmd pi_netrw.txt /*g:netrw_scp_cmd* g:netrw_scpport pi_netrw.txt /*g:netrw_scpport* g:netrw_sepchr pi_netrw.txt /*g:netrw_sepchr* @@ -7485,7 +7492,11 @@ netrw-browser-var pi_netrw.txt /*netrw-b netrw-browsing pi_netrw.txt /*netrw-browsing* netrw-c pi_netrw.txt /*netrw-c* netrw-c-tab pi_netrw.txt /*netrw-c-tab* +netrw-cB pi_netrw.txt /*netrw-cB* netrw-cadaver pi_netrw.txt /*netrw-cadaver* +netrw-call pi_netrw.txt /*netrw-call* +netrw-cb pi_netrw.txt /*netrw-cb* +netrw-cd pi_netrw.txt /*netrw-cd* netrw-chgup pi_netrw.txt /*netrw-chgup* netrw-clean pi_netrw.txt /*netrw-clean* netrw-contents pi_netrw.txt /*netrw-contents* @@ -7511,6 +7522,7 @@ netrw-enter pi_netrw.txt /*netrw-enter* netrw-ex pi_netrw.txt /*netrw-ex* netrw-explore pi_netrw.txt /*netrw-explore* netrw-explore-cmds pi_netrw.txt /*netrw-explore-cmds* +netrw-expose pi_netrw.txt /*netrw-expose* netrw-externapp pi_netrw.txt /*netrw-externapp* netrw-file pi_netrw.txt /*netrw-file* netrw-filigree pi_netrw.txt /*netrw-filigree* @@ -7560,6 +7572,7 @@ netrw-mh pi_netrw.txt /*netrw-mh* netrw-middlemouse pi_netrw.txt /*netrw-middlemouse* netrw-ml_get pi_netrw.txt /*netrw-ml_get* netrw-mm pi_netrw.txt /*netrw-mm* +netrw-modify pi_netrw.txt /*netrw-modify* netrw-mouse pi_netrw.txt /*netrw-mouse* netrw-move pi_netrw.txt /*netrw-move* netrw-mp pi_netrw.txt /*netrw-mp* diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt --- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -1,4 +1,4 @@ -*todo.txt* For Vim version 8.0. Last change: 2017 Nov 02 +*todo.txt* For Vim version 8.0. Last change: 2017 Nov 05 VIM REFERENCE MANUAL by Bram Moolenaar @@ -35,9 +35,6 @@ entered there will not be repeated below *known-bugs* -------------------- Known bugs and current work ----------------------- -Universal solution to detect if t_RS is working, using cursor position. -Koichi Iwamoto, #2126 - No maintainer for Vietnamese translations. No maintainer for Simplified Chinese translations. @@ -153,20 +150,13 @@ Compiler warnings (geeknik, 2017 Oct 26) - signed integer overflow in nfa_regatom() (#2251) - undefined left shift in get_string_tv() (#2250) -Patch to recognize neumutt temp files. (Teubel György, 2017 Oct 31, #2269) - When starting with --clean packages under "start" are not loaded. Make this work: :packadd START {name} similar to :runtime START name When using :packadd files under "later" are not used, which is inconsistent with packages under "start". (xtal8, #1994) -Patch to test autocommand effects. (James McCoy, 2017 Oct 31, #2271) - -After 8.0.0962 pasting leaves the cursor in another position. (Ken Takata, -2017 Aug 23, #2015) Also (zdm, 2017 Aug 23) - -fold at end of the buffer behaves inconsistently. (James McCoy, 2017 Oct 9) +Fold at end of the buffer behaves inconsistently. (James McCoy, 2017 Oct 9) With foldmethod=syntax and nofoldenable comment highlighting isn't removed. (Marcin Szewczyk, 2017 Apr 26) @@ -191,6 +181,9 @@ redrawn properly. (xtal8, 2017 Oct 23, # Patch for manpager plugin. (Lcd, 2017 Oct 12) Asked maintainer. +Universal solution to detect if t_RS is working, using cursor position. +Koichi Iwamoto, #2126 + Default install on MS-Windows should source defaults.vim. Ask whether to use Windows or Vim key behavior? @@ -222,11 +215,8 @@ Still happens (2017 Jul 9) When bracketed paste is used, pasting at the ":append" prompt does not get the line breaks. (Ken Takata, 2017 Aug 22) -This example in the help does not work (Andy Wokula, 2017 Aug 20): - augroup mine | au! BufRead | augroup END - -24 bit color support in MS-Windows console, using vcon. (Nobuhiro Takasaki, -2017 Oct 1, #2060). Should not set 'tgc' automatically. +Patch for 24 bit color support in MS-Windows console, using vcon. (Nobuhiro +Takasaki, 2017 Oct 1, #2060). Should not set 'tgc' automatically. Patch to change GUI behavior: instead of changing the window size change the lines/columns when menu/toolbar/etc. is added/removed. (Ychin, 2016 Mar 20, @@ -629,9 +619,6 @@ Patch to add ":syn foldlevel" to use fol Completion for input() does not expand environment variables. (chdiza, 2016 Jul 25, #948) -Patch to fix wrong encoding of error message on Cygwin/MSYS terminal. -(Ken Takata, 2016 Oct 4) - Patch to add 'systemencoding', convert between 'encoding' and this for file names, shell commands and the like. (Kikuchan, 2010 Oct 14) Assume the system converts between the actual encoding of the filesystem to diff --git a/runtime/doc/usr_09.txt b/runtime/doc/usr_09.txt --- a/runtime/doc/usr_09.txt +++ b/runtime/doc/usr_09.txt @@ -21,7 +21,7 @@ Table of contents: |usr_toc.txt| ============================================================================== *09.1* Parts of the GUI -You might have an icon on your desktop that starts gVim. Otherwise, one of +You might have an icon on your desktop that starts gvim. Otherwise, one of these commands should do it: > gvim file.txt @@ -184,12 +184,12 @@ currently highlighted. In Vim this is t using the default option settings). You can paste this selection in another application without any further action. For example, in this text select a few words with the mouse. Vim will -switch to Visual mode and highlight the text. Now start another gVim, without +switch to Visual mode and highlight the text. Now start another gvim, without a file name argument, so that it displays an empty window. Click the middle mouse button. The selected text will be inserted. The "current selection" will only remain valid until some other text is -selected. After doing the paste in the other gVim, now select some characters +selected. After doing the paste in the other gvim, now select some characters in that window. You will notice that the words that were previously selected in the other gvim window are displayed differently. This means that it no longer is the current selection. @@ -204,10 +204,10 @@ Now for the other place with which text "real clipboard", to avoid confusion. Often both the "current selection" and the "real clipboard" are called clipboard, you'll have to get used to that. To put text on the real clipboard, select a few different words in one of -the gVims you have running. Then use the Edit/Copy menu entry. Now the text +the gvims you have running. Then use the Edit/Copy menu entry. Now the text has been copied to the real clipboard. You can't see this, unless you have some application that shows the clipboard contents (e.g., KDE's Klipper). - Now select the other gVim, position the cursor somewhere and use the + Now select the other gvim, position the cursor somewhere and use the Edit/Paste menu. You will see the text from the real clipboard is inserted. diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -447,7 +447,7 @@ N *+visualextra* extra Visual mode comm N *+vreplace* |gR| and |gr| N *+wildignore* |'wildignore'| N *+wildmenu* |'wildmenu'| - *+windows* more than one window; Always enabled sinde 8.0.1118. + *+windows* more than one window; Always enabled since 8.0.1118. m *+writebackup* |'writebackup'| is default on m *+xim* X input method |xim| *+xfontset* X fontset support |xfontset| diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim --- a/runtime/plugin/netrwPlugin.vim +++ b/runtime/plugin/netrwPlugin.vim @@ -20,7 +20,7 @@ if &cp || exists("g:loaded_netrwPlugin") finish endif -let g:loaded_netrwPlugin = "v156" +let g:loaded_netrwPlugin = "v162" let s:keepcpo = &cpo set cpo&vim "DechoRemOn @@ -42,8 +42,8 @@ augroup END " Network Browsing Reading Writing: {{{2 augroup Network au! - au BufReadCmd file://* call netrw#FileUrlRead(expand("")) - au BufReadCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufReadPre ".fnameescape(expand(""))|call netrw#Nread(2,expand(""))|exe "sil doau BufReadPost ".fnameescape(expand("")) + au BufReadCmd file://* call netrw#FileUrlEdit(expand("")) + au BufReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufReadPre ".fnameescape(expand(""))|call netrw#Nread(2,expand(""))|exe "sil doau BufReadPost ".fnameescape(expand("")) au FileReadCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileReadPre ".fnameescape(expand(""))|call netrw#Nread(1,expand(""))|exe "sil doau FileReadPost ".fnameescape(expand("")) au BufWriteCmd ftp://*,rcp://*,scp://*,http://*,file://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufWritePre ".fnameescape(expand(""))|exe 'Nwrite '.fnameescape(expand(""))|exe "sil doau BufWritePost ".fnameescape(expand("")) au FileWriteCmd ftp://*,rcp://*,scp://*,http://*,file://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileWritePre ".fnameescape(expand(""))|exe "'[,']".'Nwrite '.fnameescape(expand(""))|exe "sil doau FileWritePost ".fnameescape(expand("")) @@ -59,7 +59,7 @@ com! -count=1 -nargs=* Nread let s:svpo com! -range=% -nargs=* Nwrite let s:svpos= winsaveview(),call netrw#NetWrite()call winrestview(s:svpos) com! -nargs=* NetUserPass call NetUserPass() com! -nargs=* Nsource let s:svpos= winsaveview()call netrw#NetSource()call winrestview(s:svpos) -com! -nargs=? Ntree call netrw#SetTreetop() +com! -nargs=? Ntree call netrw#SetTreetop(1,) " Commands: :Explore, :Sexplore, Hexplore, Vexplore, Lexplore {{{2 com! -nargs=* -bar -bang -count=0 -complete=dir Explore call netrw#Explore(,0,0+0,) @@ -81,7 +81,7 @@ if !exists("g:netrw_nogx") if !hasmapto('NetrwBrowseX') nmap gx NetrwBrowseX endif - nno NetrwBrowseX :call netrw#BrowseX(expand((exists("g:netrw_gx")? g:netrw_gx : '')),netrw#CheckIfRemote()) + nno NetrwBrowseX :call netrw#BrowseX(netrw#GX(),netrw#CheckIfRemote(netrw#GX())) endif if maparg('gx','v') == "" if !hasmapto('NetrwBrowseXVis') @@ -129,19 +129,15 @@ fun! s:LocalBrowse(dirname) elseif isdirectory(a:dirname) " call Decho("(LocalBrowse) dirname<".a:dirname."> ft=".&ft." (isdirectory, not amiga)") " call Dredir("LocalBrowse ft last set: ","verbose set ft") -" call Decho("(s:LocalBrowse) COMBAK#23: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col(".")) sil! call netrw#LocalBrowseCheck(a:dirname) -" call Decho("(s:LocalBrowse) COMBAK#24: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col(".")) if exists("w:netrw_bannercnt") && line('.') < w:netrw_bannercnt exe w:netrw_bannercnt -" call Decho("(s:LocalBrowse) COMBAK#25: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col(".")) endif else " not a directory, ignore it " call Decho("(LocalBrowse) dirname<".a:dirname."> not a directory, ignoring...") endif -" call Decho("(s:LocalBrowse) COMBAK#26: buf#".bufnr("%")." file<".expand("%")."> line#".line(".")." col#".col(".")) " call Dret("s:LocalBrowse") endfun diff --git a/runtime/syntax/doxygen.vim b/runtime/syntax/doxygen.vim --- a/runtime/syntax/doxygen.vim +++ b/runtime/syntax/doxygen.vim @@ -2,7 +2,8 @@ " Language: doxygen on top of c, cpp, idl, java, php " Maintainer: Michael Geddes " Author: Michael Geddes -" Last Change: Jan 2009 (\tparam by Domnique Pelle, Aug 2013) +" Last Changes: Jan 2009 (\tparam by Domnique Pelle, Aug 2013) +" Nov 2017 (@throws by Domnique Pelle) " Version: 1.23 " " Copyright 2004-2008 Michael Geddes @@ -181,13 +182,13 @@ endif syn match doxygenParamDirection contained "\v\[(\s*in>((]\s*\[|\s*,\s*)out>)=|out>((]\s*\[|\s*,\s*)in>)=)\]" nextgroup=doxygenParamName skipwhite syn keyword doxygenParam contained param tparam nextgroup=doxygenParamName,doxygenParamDirection skipwhite syn match doxygenParamName contained +[A-Za-z0-9_:]\++ nextgroup=doxygenSpecialMultilineDesc skipwhite - syn keyword doxygenRetval contained retval throw exception nextgroup=doxygenParamName skipwhite + syn keyword doxygenRetval contained retval throw throws exception nextgroup=doxygenParamName skipwhite " Match one line identifiers. syn keyword doxygenOther contained addindex anchor \ dontinclude endhtmlonly endlatexonly showinitializer hideinitializer \ example htmlonly image include ingroup internal latexonly line - \ overload relates relatesalso sa skip skipline + \ overload related relates relatedalso relatesalso sa skip skipline \ until verbinclude version addtogroup htmlinclude copydoc dotfile \ xmlonly endxmlonly \ nextgroup=doxygenSpecialOnelineDesc @@ -223,7 +224,7 @@ endif syn keyword doxygenOther contained par nextgroup=doxygenHeaderLine syn region doxygenHeaderLine start=+.+ end=+^+ contained skipwhite nextgroup=doxygenSpecialMultilineDesc - syn keyword doxygenOther contained arg author date deprecated li return returns see invariant note post pre remarks since test nextgroup=doxygenSpecialMultilineDesc + syn keyword doxygenOther contained arg author authors date deprecated li result return returns see invariant note post pre remark remarks since test nextgroup=doxygenSpecialMultilineDesc syn keyword doxygenOtherTODO contained todo attention nextgroup=doxygenSpecialMultilineDesc syn keyword doxygenOtherWARN contained warning nextgroup=doxygenSpecialMultilineDesc syn keyword doxygenOtherBUG contained bug nextgroup=doxygenSpecialMultilineDesc diff --git a/runtime/syntax/netrw.vim b/runtime/syntax/netrw.vim --- a/runtime/syntax/netrw.vim +++ b/runtime/syntax/netrw.vim @@ -1,11 +1,8 @@ -" Language : Netrw Remote-Directory Listing Syntax +" Language : Netrw Listing Syntax " Maintainer : Charles E. Campbell -" Last change: Oct 06, 2014 -" Version : 19 +" Last change: Oct 31, 2016 +" Version : 20 NOT RELEASED " --------------------------------------------------------------------- - -" Syntax Clearing: {{{1 -" quit when a syntax file was already loaded if exists("b:current_syntax") finish endif @@ -55,24 +52,30 @@ syn match netrwLink "-->" contained " ----------------------------- " Special filetype highlighting {{{1 " ----------------------------- -if exists("g:netrw_special_syntax") && netrw_special_syntax - syn match netrwBak "\(\S\+ \)*\S\+\.bak\>" contains=netrwTreeBar,@NoSpell - syn match netrwCompress "\(\S\+ \)*\S\+\.\%(gz\|bz2\|Z\|zip\)\>" contains=netrwTreeBar,@NoSpell +if exists("g:netrw_special_syntax") && g:netrw_special_syntax + if exists("+suffixes") && &suffixes != "" + let suflist= join(split(&suffixes,',')) + let suflist= escape(substitute(suflist," ",'\\|','g'),'.~') + exe "syn match netrwSpecFile '\\(\\S\\+ \\)*\\S*\\(".suflist."\\)\\>' contains=netrwTreeBar,@NoSpell" + endif + syn match netrwBak "\(\S\+ \)*\S\+\.bak\>" contains=netrwTreeBar,@NoSpell + syn match netrwCompress "\(\S\+ \)*\S\+\.\%(gz\|bz2\|Z\|zip\)\>" contains=netrwTreeBar,@NoSpell if has("unix") - syn match netrwCoreDump "\" contains=netrwTreeBar,@NoSpell + syn match netrwCoreDump "\" 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 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 "\<\(ANmenu\|ANtags\)\>" contains=netrwTreeBar,@NoSpell - syn match netrwTags "\" contains=netrwTreeBar,@NoSpell - syn match netrwTilde "\(\S\+ \)*\S\+\~\*\=\>" contains=netrwTreeBar,@NoSpell - syn match netrwTmp "\\|\(\S\+ \)*\S*tmp\>" contains=netrwTreeBar,@NoSpell + 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 netrwDoc "\(\S\+ \)*\S\+\.\%(doc\|txt\|pdf\|ps\|docx\)\>" 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 netrwPix "\c\(\S\+ \)*\S*\.\%(bmp\|fits\=\|gif\|je\=pg\|pcx\|ppc\|pgm\|png\|ppm\|psd\|rgb\|tif\|xbm\|xcf\)\>" contains=netrwTreeBar,@NoSpell + syn match netrwTags "\<\(ANmenu\|ANtags\)\>" contains=netrwTreeBar,@NoSpell + syn match netrwTags "\" contains=netrwTreeBar,@NoSpell + syn match netrwTilde "\(\S\+ \)*\S\+\~\*\=\>" contains=netrwTreeBar,@NoSpell + syn match netrwTmp "\\|\(\S\+ \)*\S*tmp\>" contains=netrwTreeBar,@NoSpell endif " --------------------------------------------------------------------- @@ -101,21 +104,42 @@ if !exists("did_drchip_netrwlist_syntax" hi default link netrwLink Special " special syntax highlighting (see :he g:netrw_special_syntax) - hi default link netrwBak NonText - 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 + hi default link netrwPix Special + + hi default link netrwBak netrwGray + hi default link netrwCompress netrwGray + hi default link netrwSpecFile netrwGray + hi default link netrwObj netrwGray + hi default link netrwTags netrwGray + hi default link netrwTilde netrwGray + hi default link netrwTmp netrwGray endif + " set up netrwGray to be understated (but not Ignore'd or Conceal'd, as those + " can be hard/impossible to read). Users may override this in a colorscheme by + " specifying netrwGray highlighting. + redir => s:netrwgray + sil hi netrwGray + redir END + if s:netrwgray !~ 'guifg' + if has("gui") && has("gui_running") + if &bg == "dark" + exe "hi netrwGray gui=NONE guifg=gray30" + else + exe "hi netrwGray gui=NONE guifg=gray70" + endif + else + hi link netrwGray Folded + endif + endif + " Current Syntax: {{{1 let b:current_syntax = "netrwlist" " --------------------------------------------------------------------- diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim --- a/runtime/syntax/sh.vim +++ b/runtime/syntax/sh.vim @@ -2,8 +2,8 @@ " Language: shell (sh) Korn shell (ksh) bash (sh) " Maintainer: Charles E. Campbell " Previous Maintainer: Lennart Schultz -" Last Change: Jan 30, 2017 -" Version: 168 +" Last Change: Oct 02, 2017 +" Version: 172 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_SH " For options and settings, please use: :help ft-sh-syntax " This file includes many ideas from Eric Brunet (eric.brunet@ens.fr) @@ -128,7 +128,7 @@ syn cluster shArithParenList contains=sh syn cluster shArithList contains=@shArithParenList,shParenError syn cluster shCaseEsacList contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq,@shErrorList,shStringSpecial,shCaseRange syn cluster shCaseList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq -syn cluster shCommandSubList contains=shAlias,shArithmetic,shComment,shCmdParenRegion,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shHereString,shRedir,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable +syn cluster shCommandSubList contains=shAlias,shArithmetic,shCmdParenRegion,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shEcho,shEscape,shExDoubleQuote,shExpr,shExSingleQuote,shHereDoc,shNumber,shOperator,shOption,shPosnParm,shHereString,shRedir,shSingleQuote,shSpecial,shStatement,shSubSh,shTest,shVariable syn cluster shCurlyList contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial syn cluster shDblQuoteList contains=shCommandSub,shDeref,shDerefSimple,shEscape,shPosnParm,shCtrlSeq,shSpecial syn cluster shDerefList contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPSR,shDerefPPS @@ -150,6 +150,7 @@ syn cluster shLoopList contains=@shCaseL syn cluster shPPSRightList contains=shComment,shDeref,shDerefSimple,shEscape,shPosnParm syn cluster shSubShList contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator syn cluster shTestList contains=shCharClass,shCommandSub,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr +syn cluster shNoZSList contains=shSpecialNoZS " Echo: {{{1 " ==== @@ -220,13 +221,13 @@ syn region shSubSh transparent matchgrou "======= syn region shExpr matchgroup=shRange start="\[" skip=+\\\\\|\\$\|\[+ end="\]" contains=@shTestList,shSpecial syn region shTest transparent matchgroup=shStatement start="\]\+\)\"" matchgroup=shHereDoc02 end="^\z1\s*$" ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc03 start="<<-\s*\z([^ \t|>]\+\)" matchgroup=shHereDoc03 end="^\s*\z1\s*$" contains=@shDblQuoteList -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc04 start="<<-\s*'\z([^ \t|>]\+\)'" matchgroup=shHereDoc04 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc05 start="<<\s*'\z([^ \t|>]\+\)'" matchgroup=shHereDoc05 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc04 start="<<-\s*'\z([^']\+\)'" matchgroup=shHereDoc04 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc05 start="<<\s*'\z([^']\+\)'" matchgroup=shHereDoc05 end="^\z1\s*$" ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc06 start="<<-\s*\"\z([^ \t|>]\+\)\"" matchgroup=shHereDoc06 end="^\s*\z1\s*$" ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc07 start="<<\s*\\\_$\_s*\z([^ \t|>]\+\)" matchgroup=shHereDoc07 end="^\z1\s*$" contains=@shDblQuoteList ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc08 start="<<\s*\\\_$\_s*'\z([^ \t|>]\+\)'" matchgroup=shHereDoc08 end="^\z1\s*$" @@ -428,14 +434,14 @@ endif if !exists("g:sh_no_error") syn match shDerefWordError "[^}$[~]" contained endif -syn match shDerefSimple "\$\%(\h\w*\|\d\)" +syn match shDerefSimple "\$\%(\h\w*\|\d\)" nextgroup=@shNoZSList syn region shDeref matchgroup=PreProc start="\${" end="}" contains=@shDerefList,shDerefVarArray -syn match shDerefSimple "\$[-#*@!?]" -syn match shDerefSimple "\$\$" -syn match shDerefSimple "\${\d}" +syn match shDerefSimple "\$[-#*@!?]" nextgroup=@shNoZSList +syn match shDerefSimple "\$\$" nextgroup=@shNoZSList +syn match shDerefSimple "\${\d}" nextgroup=@shNoZSList if exists("b:is_bash") || exists("b:is_kornshell") - syn region shDeref matchgroup=PreProc start="\${##\=" end="}" contains=@shDerefList - syn region shDeref matchgroup=PreProc start="\${\$\$" end="}" contains=@shDerefList + syn region shDeref matchgroup=PreProc start="\${##\=" end="}" contains=@shDerefList nextgroup=@shSpecialNoZS + syn region shDeref matchgroup=PreProc start="\${\$\$" end="}" contains=@shDerefList nextgroup=@shSpecialNoZS endif " ksh: ${!var[*]} array index list syntax: {{{1 @@ -685,6 +691,7 @@ if !exists("skip_sh_syntax_inits") hi def link shSetList Identifier hi def link shShellVariables PreProc hi def link shSpecial Special + hi def link shSpecialNoZS shSpecial hi def link shStatement Statement hi def link shString String hi def link shTodo Todo diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim --- a/runtime/syntax/tex.vim +++ b/runtime/syntax/tex.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: TeX " Maintainer: Charles E. Campbell -" Last Change: Jan 31, 2017 -" Version: 103 +" Last Change: Oct 12, 2017 +" Version: 105 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX " " Notes: {{{1 @@ -259,6 +259,7 @@ syn match texAccent +\\[=^.\~"`']+ syn match texAccent +\\['=t'.c^ud"vb~Hr]{\a}+ syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)$" + " \begin{}/\end{} section markers: {{{1 syn match texBeginEnd "\\begin\>\|\\end\>" nextgroup=texBeginEndName if s:tex_fast =~# 'm' @@ -511,7 +512,7 @@ if !exists("g:tex_no_math") if &ambw == "double" || exists("g:tex_usedblwidth") let s:texMathDelimList= s:texMathDelimList + [ \ ['\\langle' , '〈'] , - \ ['\\rangle' , '〉']] + \ ['\\rangle' , '〉'] , else let s:texMathDelimList= s:texMathDelimList + [ \ ['\\langle' , '<'] , @@ -588,12 +589,21 @@ else endif endif +" %begin-include ... %end-include acts like a texDocZone for \include'd files. Permits spell checking, for example, in such files. +if !s:tex_nospell + TexFold syn region texDocZone matchgroup=texSection start='^\s*%begin-include\>' end='^\s*%end-include\>' contains=@texFoldGroup,@texDocGroup,@Spell +else + TexFold syn region texDocZone matchgroup=texSection start='^\s*%begin-include\>' end='^\s*%end-include\>' contains=@texFoldGroup,@texDocGroup +endif + " Separate lines used for verb` and verb# so that the end conditions {{{1 " will appropriately terminate. " If g:tex_verbspell exists, then verbatim texZones will permit spellchecking there. if s:tex_fast =~# 'v' if exists("g:tex_verbspell") && g:tex_verbspell syn region texZone start="\\begin{[vV]erbatim}" end="\\end{[vV]erbatim}\|%stopzone\>" contains=@Spell + " listings package: + syn region texZone start="\\begin{lstlisting}" end="\\end{lstlisting}\|%stopzone\>" contains=@Spell if b:tex_stylish syn region texZone start="\\verb\*\=\z([^\ta-zA-Z@]\)" end="\z1\|%stopzone\>" contains=@Spell else @@ -1183,11 +1193,13 @@ if has("conceal") && &enc == 'utf-8' delfun s:SuperSub endif - " Accented characters: {{{2 + " Accented characters and Ligatures: {{{2 if s:tex_conceal =~# 'a' if b:tex_stylish syn match texAccent "\\[bcdvuH][^a-zA-Z@]"me=e-1 - syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1 + syn match texLigature "\\\([ijolL]\|ae\|oe\|ss\|AA\|AE\|OE\)[^a-zA-Z@]"me=e-1 + syn match texLigature '--' + syn match texLigature '---' else fun! s:Accents(chr,...) let i= 1 @@ -1248,15 +1260,17 @@ if has("conceal") && &enc == 'utf-8' call s:Accents('\\i','ì','í','î','ï','ĩ','į',' ',' ',' ',' ',' ','ĭ',' ') " \` \' \^ \" \~ \. \= \c \H \k \r \u \v delfun s:Accents - syn match texAccent '\\aa\>' conceal cchar=å - syn match texAccent '\\AA\>' conceal cchar=Å - syn match texAccent '\\o\>' conceal cchar=ø - syn match texAccent '\\O\>' conceal cchar=Ø + syn match texAccent '\\aa\>' conceal cchar=å + syn match texAccent '\\AA\>' conceal cchar=Å + syn match texAccent '\\o\>' conceal cchar=ø + syn match texAccent '\\O\>' conceal cchar=Ø syn match texLigature '\\AE\>' conceal cchar=Æ syn match texLigature '\\ae\>' conceal cchar=æ syn match texLigature '\\oe\>' conceal cchar=œ syn match texLigature '\\OE\>' conceal cchar=Œ syn match texLigature '\\ss\>' conceal cchar=ß + syn match texLigature '--' conceal cchar=– + syn match texLigature '---' conceal cchar=— endif endif endif diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: Vim 8.0 script " Maintainer: Charles E. Campbell -" Last Change: Jan 19, 2017 -" Version: 8.0-02 +" Last Change: November 03, 2017 +" Version: 8.0-04 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_VIM " Automatically generated keyword lists: {{{1 @@ -19,24 +19,24 @@ syn keyword vimTodo contained COMBAK FIX syn cluster vimCommentGroup contains=vimTodo,@Spell " regular vim commands {{{2 -syn keyword vimCommand contained a argd[elete] as[cii] bd[elete] bo[tright] breakl[ist] cN[ext] caddf[ile] ccl[ose] cfdo chd[ir] cle[arjumps] co[py] con[tinue] cr[ewind] d[elete] deletel delm[arks] diffo[ff] dir dp earlier em[enu] ene[w] filet fir[st] foldo[pen] grepa[dd] helpf[ind] i in ju[mps] keepp[atterns] lad[dexpr] later lcl[ose] lefta[bove] lg[etfile] lh[elpgrep] lmak[e] lo[adview] lol[der] ls lv[imgrep] mak[e] messages mkvie[w] nb[key] noa nos[wapfile] on[ly] packl[oadall] po[p] pro ps[earch] ptl[ast] pu[t] pydo quita[ll] redr[aw] retu[rn] rub[y] sI sIn sal[l] sba[ll] sbp[revious] scg scripte[ncoding] setg[lobal] sgI sgn sic sim[alt] sla[st] smile so[urce] spelli[nfo] sr sri sta[g] stopi[nsert] sus[pend] sync ta[g] tabe[dit] tabn[ext] tabs te[aroff] tm[enu] try undoj[oin] up[date] vi[sual] vmapc[lear] wa[ll] winp[os] ws[verb] xmapc[lear] xprop -syn keyword vimCommand contained abc[lear] argdo au bel[owright] bp[revious] bro[wse] cNf[ile] cal[l] cd cfir[st] che[ckpath] clo[se] col[der] conf[irm] cs debug deletep delp diffp[atch] dj[ump] dr[op] echoe[rr] en[dif] ex filetype fix[del] for gui helpg[rep] iabc[lear] intro k lN[ext] laddb[uffer] lb[uffer] lcs lex[pr] lgetb[uffer] lhi[story] lmapc[lear] loadk lop[en] lt[ag] lvimgrepa[dd] marks mk[exrc] mod[e] nbc[lose] noautocmd nu[mber] opt[ions] pc[lose] popu[p] prof[ile] ptN[ext] ptn[ext] pw[d] pyf[ile] r[ead] redraws[tatus] rew[ind] rubyd[o] sIc sIp san[dbox] sbf[irst] sbr[ewind] sci scs setl[ocal] sgc sgp sie sin sm[agic] sn[ext] sor[t] spellr[epall] srI srl star[tinsert] sts[elect] sv[iew] syncbind tab tabf[ind] tabnew tags tf[irst] tn[ext] ts[elect] undol[ist] v vie[w] vne[w] wh[ile] wn[ext] wundo xme xunme -syn keyword vimCommand contained abo[veleft] arge[dit] bN[ext] bf[irst] br[ewind] bufdo c[hange] cat[ch] cdo cg[etfile] checkt[ime] cmapc[lear] colo[rscheme] cope[n] cscope debugg[reedy] deletl dep diffpu[t] dl ds[earch] echom[sg] endf[unction] exi[t] filt[er] fo[ld] fu[nction] gvim helpt[ags] if is[earch] kee[pmarks] lNf[ile] laddf[ile] lbo[ttom] lcscope lf[ile] lgete[xpr] ll lne[xt] loadkeymap lp[revious] lua lw[indow] mat[ch] mks[ession] mz[scheme] nbs[tart] noh[lsearch] o[pen] ownsyntax pe[rl] pp[op] profd[el] pta[g] ptp[revious] py3 python3 rec[over] reg[isters] ri[ght] rubyf[ile] sIe sIr sav[eas] sbl[ast] sc scl scscope sf[ind] sge sgr sig sip sm[ap] sno[magic] sp[lit] spellu[ndo] src srn startg[replace] sun[hide] sw[apname] syntime tabN[ext] tabfir[st] tabo[nly] tc[l] th[row] to[pleft] tu[nmenu] unh[ide] ve[rsion] vim[grep] vs[plit] win[size] wp[revious] wv[iminfo] xmenu xunmenu -syn keyword vimCommand contained al[l] argg[lobal] b[uffer] bl[ast] brea[k] buffers cabc[lear] cb[uffer] ce[nter] cgetb[uffer] chi[story] cn[ext] com cp[revious] cstag delc[ommand] deletp di[splay] diffs[plit] dli[st] dsp[lit] echon endfo[r] exu[sage] fin[d] foldc[lose] g h[elp] hi ij[ump] isp[lit] keepa l[ist] lan[guage] lc[d] ld[o] lfdo lgr[ep] lla[st] lnew[er] loc[kmarks] lpf[ile] luado m[ove] menut[ranslate] mksp[ell] mzf[ile] new nor ol[dfiles] p[rint] ped[it] pre[serve] promptf[ind] ptf[irst] ptr[ewind] py3do q[uit] red[o] res[ize] rightb[elow] rundo sIg sN[ext] sbN[ext] sbm[odified] scI scp se[t] sfir[st] sgi sh[ell] sign sir sme snoreme spe[llgood] spellw[rong] sre[wind] srp startr[eplace] sunme sy t tabc[lose] tabl[ast] tabp[revious] tcld[o] tj[ump] tp[revious] u[ndo] unlo[ckvar] verb[ose] vimgrepa[dd] wN[ext] winc[md] wq x[it] xnoreme xwininfo -syn keyword vimCommand contained ar[gs] argl[ocal] ba[ll] bm[odified] breaka[dd] bun[load] cad[dbuffer] cbo[ttom] cex[pr] cgete[xpr] cl[ist] cnew[er] comc[lear] cpf[ile] cuna[bbrev] delel delf[unction] dif[fupdate] difft[his] do e[dit] el[se] endt[ry] f[ile] fina[lly] foldd[oopen] go[to] ha[rdcopy] hid[e] il[ist] iuna[bbrev] keepalt la[st] lat lch[dir] le[ft] lfir[st] lgrepa[dd] lli[st] lnf[ile] lockv[ar] lr[ewind] luafile ma[rk] mes mkv[imrc] n[ext] nmapc[lear] nore omapc[lear] pa[ckadd] perld[o] prev[ious] promptr[epl] ptj[ump] pts[elect] py[thon] qa[ll] redi[r] ret[ab] ru[ntime] rv[iminfo] sIl sa[rgument] sb[uffer] sbn[ext] sce scr[iptnames] setf[iletype] sg sgl si sil[ent] sl[eep] smenu snoremenu spelld[ump] spr[evious] srg st[op] stj[ump] sunmenu syn tN[ext] tabd[o] tabm[ove] tabr[ewind] tclf[ile] tl[ast] tr[ewind] una[bbreviate] uns[ilent] vert[ical] viu[sage] w[rite] windo wqa[ll] xa[ll] xnoremenu y[ank] -syn keyword vimCommand contained arga[dd] argu[ment] bad[d] bn[ext] breakd[el] bw[ipeout] cadde[xpr] cc cf[ile] changes cla[st] cnf[ile] comp[iler] cq[uit] cw[indow] delep dell diffg[et] dig[raphs] doau ea elsei[f] endw[hile] files fini[sh] folddoc[losed] gr[ep] helpc[lose] his[tory] imapc[lear] j[oin] keepj[umps] +syn keyword vimCommand contained a arga[dd] argu[ment] bad[d] bn[ext] breakd[el] bw[ipeout] cadde[xpr] cc cf[ile] changes cla[st] cnf[ile] comp[iler] cq[uit] cw[indow] delep dell diffg[et] dig[raphs] doau ea el[se] endt[ry] f[ile] fina[lly] foldd[oopen] go[to] ha[rdcopy] hid[e] ij[ump] isp[lit] keepa l[ist] lat lcl[ose] lex[pr] lgete[xpr] lla[st] lnf[ile] lol[der] lt[ag] lw[indow] menut[ranslate] mkv[imrc] n[ext] nmapc[lear] nore omapc[lear] pa[ckadd] perld[o] prev[ious] promptr[epl] ptj[ump] pts[elect] py[thon] pyx quita[ll] redr[aw] retu[rn] rub[y] sI sIn sal[l] sba[ll] sbp[revious] scg scripte[ncoding] setg[lobal] sgI sgn sic sim[alt] sla[st] smile so[urce] spelli[nfo] sr sri sta[g] stopi[nsert] sus[pend] sync ta[g] tabe[dit] tabn[ext] tabs te[aroff] tm[enu] to[pleft] tu[nmenu] undol[ist] up[date] vi[sual] vmapc[lear] wa[ll] winp[os] ws[verb] xmapc[lear] xprop +syn keyword vimCommand contained ab argd[elete] as[cii] bd[elete] bo[tright] breakl[ist] cN[ext] caddf[ile] ccl[ose] cfdo chd[ir] cle[arjumps] co[py] con[tinue] cr[ewind] d[elete] deletel delm[arks] diffo[ff] dir dp earlier elsei[f] endw[hile] files fini[sh] folddoc[losed] gr[ep] helpc[lose] his[tory] il[ist] iuna[bbrev] keepalt la[st] later lcs lf[ile] lgr[ep] lli[st] lo[adview] lop[en] lua m[ove] mes mkvie[w] nb[key] noa nos[wapfile] on[ly] packl[oadall] po[p] pro ps[earch] ptl[ast] pu[t] pydo pyxdo r[ead] redraws[tatus] rew[ind] rubyd[o] sIc sIp san[dbox] sbf[irst] sbr[ewind] sci scs setl[ocal] sgc sgp sie sin sm[agic] sn[ext] sor[t] spellr[epall] srI srl star[tinsert] sts[elect] sv[iew] syncbind tab tabf[ind] tabnew tags tf[irst] tma[p] tp[revious] tunma[p] unh[ide] v vie[w] vne[w] wh[ile] wn[ext] wundo xme xunme +syn keyword vimCommand contained abc[lear] argdo au bel[owright] bp[revious] bro[wse] cNf[ile] cal[l] cd cfir[st] che[ckpath] clo[se] col[der] conf[irm] cs debug deletep delp diffp[atch] dj[ump] dr[op] ec em[enu] ene[w] filet fir[st] foldo[pen] grepa[dd] helpf[ind] i imapc[lear] j[oin] keepj[umps] lad[dexpr] lb[uffer] lcscope lfdo lgrepa[dd] lmak[e] loadk lp[revious] luado ma[rk] messages mod[e] nbc[lose] noautocmd nu[mber] opt[ions] pc[lose] popu[p] prof[ile] ptN[ext] ptn[ext] pw[d] pyf[ile] pyxfile rec[over] reg[isters] ri[ght] rubyf[ile] sIe sIr sav[eas] sbl[ast] sc scl scscope sf[ind] sge sgr sig sip sm[ap] sno[magic] sp[lit] spellu[ndo] src srn startg[replace] sun[hide] sw[apname] syntime tabN[ext] tabfir[st] tabo[nly] tc[l] th[row] tmapc[lear] tr[ewind] u[ndo] unl ve[rsion] vim[grep] vs[plit] win[size] wp[revious] wv[iminfo] xmenu xunmenu +syn keyword vimCommand contained abo[veleft] arge[dit] bN[ext] bf[irst] br[ewind] bufdo c[hange] cat[ch] cdo cg[etfile] checkt[ime] cmapc[lear] colo[rscheme] cope[n] cscope debugg[reedy] deletl dep diffpu[t] dl ds[earch] echoe[rr] en[dif] ex filetype fix[del] for gui helpg[rep] ia in ju[mps] keepp[atterns] laddb[uffer] lbo[ttom] ld[o] lfir[st] lh[elpgrep] lmapc[lear] loadkeymap lpf[ile] luafile mak[e] mk[exrc] mz[scheme] nbs[tart] noh[lsearch] o[pen] ownsyntax pe[rl] pp[op] profd[el] pta[g] ptp[revious] py3 python3 q[uit] red[o] res[ize] rightb[elow] rundo sIg sN[ext] sbN[ext] sbm[odified] scI scp se[t] sfir[st] sgi sh[ell] sign sir sme snoreme spe[llgood] spellw[rong] sre[wind] srp startr[eplace] sunme sy t tabc[lose] tabl[ast] tabp[revious] tcld[o] tj[ump] tn[ext] try una[bbreviate] unlo[ckvar] verb[ose] vimgrepa[dd] wN[ext] winc[md] wq x[it] xnoreme xwininfo +syn keyword vimCommand contained al[l] argg[lobal] b[uffer] bl[ast] brea[k] buffers cabc[lear] cb[uffer] ce[nter] cgetb[uffer] chi[story] cn[ext] com cp[revious] cstag delc[ommand] deletp di[splay] diffs[plit] dli[st] dsp[lit] echom[sg] endf[unction] exi[t] filt[er] fo[ld] fu[nction] gvim helpt[ags] iabc[lear] intro k lN[ext] laddf[ile] lc[d] le[ft] lg[etfile] lhi[story] lne[xt] loc[kmarks] lr[ewind] lv[imgrep] marks mks[ession] mzf[ile] new nor ol[dfiles] p[rint] ped[it] pre[serve] promptf[ind] ptf[irst] ptr[ewind] py3do pythonx qa[ll] redi[r] ret[ab] ru[ntime] rv[iminfo] sIl sa[rgument] sb[uffer] sbn[ext] sce scr[iptnames] setf[iletype] sg sgl si sil[ent] sl[eep] smenu snoremenu spelld[ump] spr[evious] srg st[op] stj[ump] sunmenu syn tN[ext] tabd[o] tabm[ove] tabr[ewind] tclf[ile] tl[ast] tno[remap] ts[elect] undoj[oin] uns[ilent] vert[ical] viu[sage] w[rite] windo wqa[ll] xa[ll] xnoremenu y[ank] +syn keyword vimCommand contained ar[gs] argl[ocal] ba[ll] bm[odified] breaka[dd] bun[load] cad[dbuffer] cbo[ttom] cex[pr] cgete[xpr] cl[ist] cnew[er] comc[lear] cpf[ile] cuna[bbrev] delel delf[unction] dif[fupdate] difft[his] do e[dit] echon endfo[r] exu[sage] fin[d] foldc[lose] g h[elp] hi if is[earch] kee[pmarks] lNf[ile] lan[guage] lch[dir] lefta[bove] lgetb[uffer] ll lnew[er] lockv[ar] ls lvimgrepa[dd] mat[ch] mksp[ell] syn match vimCommand contained "\" -syn keyword vimStdPlugin contained DiffOrig Man N[ext] P[rint] S TOhtml XMLent XMLns +syn keyword vimStdPlugin contained DiffOrig Man N[ext] P[rint] S TOhtml XMLent XMLns " vimOptions are caught only when contained in a vimSet {{{2 -syn keyword vimOption contained acd ambw arshape background ballooneval bg bomb bs cb ch cinoptions cms commentstring copyindent cscopepathcomp csprg cursorbind delcombine digraph eadirection ek ep et fdc fdo ffs filetype fml foldignore foldopen fs gfn grepprg guiheadroom helplang history hls imactivatefunc imdisable inc indk isfname joinspaces kmp lazyredraw lispwords lpl ma matchtime mco ml modeline mousefocus mousetime nrformats ofu packpath path ph pp printfont pumheight rdt renderoptions rl ru sbo scrollbind secure shcf shelltemp shortmess showtabline sj smd spell splitbelow ssl stl sw sxe tabpagemax tags tbs termguicolors tgst titleold top ttimeoutlen ttyscroll ul ur verbosefile visualbell wcm wi wildmenu winfixwidth wm wrapscan -syn keyword vimOption contained ai anti autochdir backspace balloonexpr bh breakat bsdir cc charconvert cinw co compatible cot cscopeprg csqf cursorcolumn dex dip eb emo equalalways eventignore fde fdt fic fillchars fmr foldlevel foldtext fsync gfs gtl guioptions hf hk hlsearch imactivatekey imi include inex isi js kp lbr list lrm macatsui maxcombine mef mls modelines mousehide mp nu omnifunc para pdev pheader preserveindent printheader pvh re report rlc rubydll sbr scrolljump sel shell shelltype shortname shq slm sn spellcapcheck splitright ssop stmp swapfile sxq tabstop tagstack tc terse thesaurus titlestring tpm ttm ttytype undodir ut vfile vop wd wic wildmode winheight wmh write -syn keyword vimOption contained akm antialias autoindent backup bdir bin breakindent bsk ccv ci cinwords cocu complete cp cscopequickfix csre cursorline dg dir ed emoji equalprg ex fdi fen fileencoding fixendofline fo foldlevelstart formatexpr ft gfw gtt guipty hh hkmap ic imaf iminsert includeexpr inf isident key langmap lcs listchars ls magic maxfuncdepth menuitems mm modifiable mousem mps number opendevice paragraphs penc pi previewheight printmbcharset pvw readonly restorescreen rnu ruf sc scrolloff selection shellcmdflag shellxescape showbreak si sm so spellfile spr st sts swapsync syn tag tal tcldll textauto tildeop tl tr tty tw undofile vb vi wa weirdinvert wig wildoptions winminheight wmnu writeany -syn keyword vimOption contained al ar autoread backupcopy bdlay binary breakindentopt bt cd cin clipboard cole completefunc cpo cscoperelative cst cwh dict directory edcompatible enc errorbells expandtab fdl fenc fileencodings fixeol foldclose foldmarker formatlistpat gcr ghr guicursor guitablabel hi hkmapp icon imak ims incsearch infercase isk keymap langmenu linebreak lm lsp makeef maxmapdepth mfd mmd modified mousemodel msm numberwidth operatorfunc paste perldll pm previewwindow printmbfont pythondll redrawtime revins ro ruler scb scrollopt selectmode shellpipe shellxquote showcmd sidescroll smartcase softtabstop spelllang sps sta su swb synmaxcol tagbsearch tb tenc textmode timeout tm ts ttybuiltin tx undolevels vbs viewdir wak wfh wildchar wim winminwidth wmw writebackup -syn keyword vimOption contained aleph arab autowrite backupdir belloff bk bri bufhidden cdpath cindent cm colorcolumn completeopt cpoptions cscopetag csto debug dictionary display ef encoding errorfile exrc fdls fencs fileformat fk foldcolumn foldmethod formatoptions gd go guifont guitabtooltip hid hkp iconstring imc imsearch inde insertmode iskeyword keymodel langnoremap lines lmap luadll makeprg maxmem mh mmp more mouses mzq nuw opfunc pastetoggle pex pmbcs printdevice printoptions pythonthreedll regexpengine ri rop rulerformat scl scs sessionoptions shellquote shiftround showfulltag sidescrolloff smartindent sol spellsuggest sr stal sua swf syntax tagcase tbi term textwidth timeoutlen to tsl ttyfast uc undoreload vdir viewoptions warn wfw wildcharm winaltkeys winwidth wop writedelay -syn keyword vimOption contained allowrevins arabic autowriteall backupext beval bkc briopt buflisted cedit cink cmdheight columns concealcursor cpt cscopetagorder csverb deco diff dy efm endofline errorformat fcl fdm fex fileformats fkmap foldenable foldminlines formatprg gdefault gp guifontset helpfile hidden hl ignorecase imcmdline imsf indentexpr is isp keywordprg langremap linespace lnr lw mat maxmempattern mis mmt mouse mouseshape mzquantum odev osfiletype patchexpr pexpr pmbfn printencoding prompt qe relativenumber rightleft rs runtimepath scr sect sft shellredir shiftwidth showmatch signcolumn smarttab sp spf srr startofline suffixes switchbuf ta taglength tbidi termbidi tf title toolbar tsr ttym udf updatecount ve viminfo wb wh wildignore window wiv wrap ws -syn keyword vimOption contained altkeymap arabicshape aw backupskip bex bl brk buftype cf cinkeys cmdwinheight com conceallevel crb cscopeverbose cuc def diffexpr ea ei eol esckeys fcs fdn ff fileignorecase flp foldexpr foldnestmax fp gfm grepformat guifontwide helpheight highlight hlg im imd imstatusfunc indentkeys isf isprint km laststatus lisp loadplugins lz matchpairs maxmemtot mkspellmem mod mousef mouset nf oft pa patchmode pfn popt printexpr pt quoteescape remap rightleftcmd rtp sb scroll sections sh shellslash shm showmode siso smc spc spl ss statusline suffixesadd sws tabline tagrelative tbis termencoding tgc titlelen toolbariconsize ttimeout ttymouse udir updatetime verbose virtualedit wc whichwrap wildignorecase winfixheight wiw wrapmargin ww -syn keyword vimOption contained ambiwidth ari awa balloondelay bexpr bo browsedir casemap cfu cino cmp comments confirm cryptmethod cspc cul define diffopt ead +syn keyword vimOption contained acd ambw arshape background ballooneval bg bomb bs cb ch cinoptions cms commentstring copyindent cscopepathcomp csprg cursorbind delcombine digraph eadirection emo equalprg expandtab fdls fex fileignorecase fml foldlevel formatexpr gcr go guifontset helpheight history hlsearch imactivatekey imi imstyle indentkeys isf isprint km laststatus lisp loadplugins lz mat maxmempattern mh mmp more mouses mzq number opendevice paragraphs penc pi previewheight printmbcharset pvw rdt renderoptions rl ru sbo scrollbind secure shcf shelltemp shortmess showtabline sj smd spell splitbelow ssl stl sw sxe tabpagemax tags tbs termguicolors tf title tms ts ttybuiltin tx undolevels vbs viewdir vop wd wic wildmode winheight wm wrapscan +syn keyword vimOption contained ai anti autochdir backspace balloonexpr bh breakat bsdir cc charconvert cinw co compatible cot cscopeprg csqf cursorcolumn dex dip eb emoji errorbells exrc fdm ff filetype fmr foldlevelstart formatlistpat gd gp guifontwide helplang hk ic imaf iminsert inc indk isfname joinspaces kmp lazyredraw lispwords lpl ma matchpairs maxmemtot mis mmt mouse mouseshape mzquantum numberwidth operatorfunc paste perldll pm previewwindow printmbfont pythondll re report rlc rubydll sbr scrolljump sel shell shelltype shortname shq slm sn spellcapcheck splitright ssop stmp swapfile sxq tabstop tagstack tc termkey tgc titlelen to tsl ttyfast uc undoreload vdir viewoptions wa weirdinvert wig wildoptions winminheight wmh write +syn keyword vimOption contained akm antialias autoindent backup bdir bin breakindent bsk ccv ci cinwords cocu complete cp cscopequickfix csre cursorline dg dir ed enc errorfile fcl fdn ffs fillchars fo foldmarker formatoptions gdefault grepformat guiheadroom hf hkmap icon imak ims include inex isi js kp lbr list lrm macatsui matchtime mco mkspellmem mod mousef mouset mzschemedll nuw opfunc pastetoggle pex pmbcs printdevice printoptions pythonthreedll readonly restorescreen rnu ruf sc scrolloff selection shellcmdflag shellxescape showbreak si sm so spellfile spr st sts swapsync syn tag tal tcldll termsize tgst titleold toolbar tsr ttym udf updatecount ve vif wak wfh wildchar wim winminwidth wmnu writeany +syn keyword vimOption contained al ar autoread backupcopy bdlay binary breakindentopt bt cd cin clipboard cole completefunc cpo cscoperelative cst cwh dict directory edcompatible encoding errorformat fcs fdo fic fixendofline foldclose foldmethod formatprg gfm grepprg guioptions hh hkmapp iconstring imc imsearch includeexpr inf isident key langmap lcs listchars ls magic maxcombine mef ml modeline mousefocus mousetime mzschemegcdll odev osfiletype patchexpr pexpr pmbfn printencoding prompt pyx redrawtime revins ro ruler scb scrollopt selectmode shellpipe shellxquote showcmd sidescroll smartcase softtabstop spelllang sps sta su swb synmaxcol tagbsearch tb tenc terse thesaurus titlestring toolbariconsize ttimeout ttymouse udir updatetime verbose viminfo warn wfw wildcharm winaltkeys winptydll wmw writebackup +syn keyword vimOption contained aleph arab autowrite backupdir belloff bk bri bufhidden cdpath cindent cm colorcolumn completeopt cpoptions cscopetag csto debug dictionary display ef endofline esckeys fdc fdt fileencoding fixeol foldcolumn foldminlines fp gfn gtl guipty hi hkp ignorecase imcmdline imsf incsearch infercase isk keymap langmenu linebreak lm lsp makeef maxfuncdepth menc mls modelines mousehide mp nf oft pa patchmode pfn popt printexpr pt pyxversion regexpengine ri rop rulerformat scl scs sessionoptions shellquote shiftround showfulltag sidescrolloff smartindent sol spellsuggest sr stal sua swf syntax tagcase tbi term textauto tildeop tk top ttimeoutlen ttyscroll ul ur verbosefile viminfofile wb wh wildignore window winwidth wop writedelay +syn keyword vimOption contained allowrevins arabic autowriteall backupext beval bkc briopt buflisted cedit cink cmdheight columns concealcursor cpt cscopetagorder csverb deco diff dy efm eol et fde fen fileencodings fk foldenable foldnestmax fs gfs gtt guitablabel hid hl im imd imst inde insertmode iskeyword keymodel langnoremap lines lmap luadll makeencoding maxmapdepth menuitems mm modifiable mousem mps nrformats ofu packpath path ph pp printfont pumheight qe relativenumber rightleft rs runtimepath scr sect sft shellredir shiftwidth showmatch signcolumn smarttab sp spf srr startofline suffixes switchbuf ta taglength tbidi termbidi textmode timeout tl tpm ttm ttytype undodir ut vfile virtualedit wc whichwrap wildignorecase winfixheight wiv wrap ws +syn keyword vimOption contained altkeymap arabicshape aw backupskip bex bl brk buftype cf cinkeys cmdwinheight com conceallevel crb cscopeverbose cuc def diffexpr ea ei ep eventignore fdi fenc fileformat fkmap foldexpr foldopen fsync gfw guicursor guitabtooltip hidden hlg imactivatefunc imdisable imstatusfunc indentexpr is isp keywordprg langremap linespace lnr lw makeprg maxmem mfd mmd modified mousemodel msm nu omnifunc para pdev pheader preserveindent printheader pvh quoteescape remap rightleftcmd rtp sb scroll sections sh shellslash shm showmode siso smc spc spl ss statusline suffixesadd sws tabline tagrelative tbis termencoding textwidth timeoutlen tm tr tty tw undofile vb vi visualbell wcm wi wildmenu winfixwidth wiw wrapmargin ww +syn keyword vimOption contained ambiwidth ari awa balloondelay bexpr bo browsedir casemap cfu cino cmp comments confirm cryptmethod cspc cul define diffopt ead ek equalalways ex fdl fencs fileformats flp foldignore foldtext ft ghr guifont helpfile highlight hls " vimOptions: These are the turn-off setting variants {{{2 syn keyword vimOption contained noacd noallowrevins noantialias noarabic noarshape noautoread noaw noballooneval nobinary nobomb nobuflisted nocin noconfirm nocrb nocscopeverbose nocsverb nocursorbind nodeco nodiff noeb noek noendofline noerrorbells noex nofen nofixendofline nofkmap nofsync noguipty nohk nohkp noic noim noimd noinf nois nolangnoremap nolazyredraw nolinebreak nolist noloadplugins nolrm noma nomagic noml nomodeline nomodified nomousef nomousehide nonumber noopendevice nopi nopreviewwindow nopvw norelativenumber norestorescreen nori norl noro noru nosb noscb noscs nosft noshelltemp noshortname noshowfulltag noshowmode nosm nosmartindent nosmd nosol nosplitbelow nospr nossl nostartofline noswapfile nota notagrelative notbi notbs noterse notextmode notgst notimeout noto notr nottybuiltin notx noundofile novisualbell nowarn noweirdinvert nowfw nowildignorecase nowinfixheight nowiv nowrap nowrite nowritebackup @@ -49,15 +49,15 @@ syn keyword vimOption contained invai in syn keyword vimOption contained invakm invanti invarab invari invautoindent invautowriteall invbackup invbin invbl invbri invci invcompatible invcp invcscopetag invcst invcul invcursorline invdg invea invedcompatible invemoji invequalalways invet invexrc invfileignorecase invfk invfs invgdefault invhidden invhkmapp invhlsearch invignorecase invimcmdline invincsearch invinsertmode invjs " termcap codes (which can also be set) {{{2 -syn keyword vimOption contained t_8b t_AB t_AL t_CV t_Co t_DL t_F1 t_F3 t_F5 t_F7 t_F9 t_IS t_K1 t_K3 t_K4 t_K5 t_K6 t_K7 t_K8 t_K9 t_KA t_KB t_KC t_KD t_KE t_KF t_KG t_KH t_KI t_KJ t_KK t_KL t_RB t_RI t_RV t_SI t_SR t_Sb t_Sf t_WP t_WS t_ZH t_ZR t_al t_bc t_cd t_ce t_cl t_cm t_cs t_da t_db t_dl t_fs t_k1 t_k2 t_k3 t_k4 t_k5 t_k6 t_k7 t_k8 t_k9 t_kB t_kD t_kI t_kN t_kP t_kb t_kd t_ke t_kh t_kl t_kr t_ks t_ku t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_se t_so t_sr t_te t_ti t_ts t_u7 t_ue t_us t_ut t_vb t_ve t_vi t_vs t_xn t_xs -syn keyword vimOption contained t_8f t_AF t_CS t_Ce t_Cs t_EI t_F2 t_F4 t_F6 t_F8 t_IE +syn keyword vimOption contained t_8b t_AB t_al t_bc t_BE t_ce t_cl t_Co t_Cs t_CV t_db t_DL t_EI t_F2 t_F4 t_F6 t_F8 t_fs t_IE t_k1 t_k2 t_K3 t_K4 t_K5 t_K6 t_K7 t_k8 t_K8 t_k9 t_K9 t_KA t_kb t_kB t_KB t_KC t_kd t_kD t_KD t_ke t_KE t_KF t_KG t_kh t_KH t_kI t_KI t_KJ t_KK t_kl t_KL t_kN t_kP t_kr t_ks t_ku t_le t_mb t_md t_me t_mr t_ms t_nd t_op t_PE t_PS t_RB t_RC t_RF t_RI t_RS t_RV t_Sb t_SC t_se t_Sf t_SH t_SI t_so t_sr t_SR t_te t_Te t_ti t_ts t_Ts t_u7 t_ue t_us t_ut t_vb t_ve t_vi t_vs t_VS t_WP t_WS t_xn t_xs t_ZH t_ZR +syn keyword vimOption contained t_8f t_AF t_AL t_BD t_cd t_Ce t_cm t_cs t_CS t_da t_dl t_EC t_F1 t_F3 t_F5 t_F7 t_F9 t_GP t_IS t_K1 t_k3 t_k4 t_k5 t_k6 t_k7 +syn match vimOption contained "t_%1" syn match vimOption contained "t_#2" syn match vimOption contained "t_#4" -syn match vimOption contained "t_%1" -syn match vimOption contained "t_%i" +syn match vimOption contained "t_@7" +syn match vimOption contained "t_*7" syn match vimOption contained "t_&8" -syn match vimOption contained "t_*7" -syn match vimOption contained "t_@7" +syn match vimOption contained "t_%i" syn match vimOption contained "t_k;" " unsupported settings: some were supported by vi but don't do anything in vim {{{2 @@ -66,21 +66,21 @@ syn keyword vimErrSetting contained bios " AutoCmd Events {{{2 syn case ignore -syn keyword vimAutoEvent contained BufAdd BufCreate BufDelete BufEnter BufFilePost BufFilePre BufHidden BufLeave BufNew BufNewFile BufRead BufReadCmd BufReadPost BufReadPre BufUnload BufWinEnter BufWinLeave BufWipeout BufWrite BufWriteCmd BufWritePost BufWritePre CmdUndefined CmdwinEnter CmdwinLeave ColorScheme CompleteDone CursorHold CursorHoldI CursorMoved CursorMovedI EncodingChanged FileAppendCmd FileAppendPost FileAppendPre FileChangedRO FileChangedShell FileChangedShellPost FileEncoding FileReadCmd FileReadPost FileReadPre FileType FileWriteCmd FileWritePost FileWritePre FilterReadPost FilterReadPre FilterWritePost FilterWritePre FocusGained FocusLost FuncUndefined GUIEnter GUIFailed InsertChange InsertCharPre InsertEnter InsertLeave MenuPopup OptionSet QuickFixCmdPost QuickFixCmdPre QuitPre RemoteReply SessionLoadPost ShellCmdPost ShellFilterPost SourceCmd SourcePre SpellFileMissing StdinReadPost StdinReadPre SwapExists Syntax TabClosed TabEnter TabLeave TabNew TermChanged TermResponse TextChanged TextChangedI User VimEnter VimLeave VimLeavePre VimResized WinEnter WinLeave WinNew +syn keyword vimAutoEvent contained BufAdd BufCreate BufDelete BufEnter BufFilePost BufFilePre BufHidden BufLeave BufNew BufNewFile BufRead BufReadCmd BufReadPost BufReadPre BufUnload BufWinEnter BufWinLeave BufWipeout BufWrite BufWriteCmd BufWritePost BufWritePre CmdlineEnter CmdlineLeave CmdUndefined CmdwinEnter CmdwinLeave ColorScheme CompleteDone CursorHold CursorHoldI CursorMoved CursorMovedI EncodingChanged FileAppendCmd FileAppendPost FileAppendPre FileChangedRO FileChangedShell FileChangedShellPost FileEncoding FileReadCmd FileReadPost FileReadPre FileType FileWriteCmd FileWritePost FileWritePre FilterReadPost FilterReadPre FilterWritePost FilterWritePre FocusGained FocusLost FuncUndefined GUIEnter GUIFailed InsertChange InsertCharPre InsertEnter InsertLeave MenuPopup OptionSet QuickFixCmdPost QuickFixCmdPre QuitPre RemoteReply SessionLoadPost ShellCmdPost ShellFilterPost SourceCmd SourcePre SpellFileMissing StdinReadPost StdinReadPre SwapExists Syntax TabClosed TabEnter TabLeave TabNew TermChanged TermResponse TextChanged TextChangedI User VimEnter VimLeave VimLeavePre VimResized WinEnter WinLeave WinNew " Highlight commonly used Groupnames {{{2 syn keyword vimGroup contained Comment Constant String Character Number Boolean Float Identifier Function Statement Conditional Repeat Label Operator Keyword Exception PreProc Include Define Macro PreCondit Type StorageClass Structure Typedef Special SpecialChar Tag Delimiter SpecialComment Debug Underlined Ignore Error Todo " Default highlighting groups {{{2 -syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineNr DiffAdd DiffChange DiffDelete DiffText Directory EndOfBuffer ErrorMsg FoldColumn Folded IncSearch LineNr MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC TabLine TabLineFill TabLineSel Title Tooltip VertSplit Visual VisualNOS WarningMsg WildMenu +syn keyword vimHLGroup contained ColorColumn Cursor CursorColumn CursorIM CursorLine CursorLineNr DiffAdd DiffChange DiffDelete DiffText Directory EndOfBuffer ErrorMsg FoldColumn Folded IncSearch LineNr MatchParen Menu ModeMsg MoreMsg NonText Normal Pmenu PmenuSbar PmenuSel PmenuThumb Question QuickFixLine Scrollbar Search SignColumn SpecialKey SpellBad SpellCap SpellLocal SpellRare StatusLine StatusLineNC TabLine TabLineFill TabLineSel Title Tooltip VertSplit Visual VisualNOS WarningMsg WildMenu syn match vimHLGroup contained "Conceal" syn case match " Function Names {{{2 -syn keyword vimFuncName contained abs append argv assert_fails assert_notequal atan2 buflisted bufwinid byteidxcomp ch_close_in ch_getjob ch_open ch_sendraw char2nr complete copy cscope_connection did_filetype escape execute expand filewritable float2nr fnamemodify foldtext function getbufline getcharsearch getcmdwintype getfontname getftype getpid getregtype getwininfo glob has_key histdel hlexists index inputrestore invert items job_start js_decode json_encode libcall line2byte log map match matcharg matchlist max mode nr2char perleval printf pyeval reltime remote_expr remote_read rename reverse screenchar search searchpairpos serverlist setcmdpos setloclist setqflist settabwinvar shellescape sin soundfold split str2nr strdisplaywidth stridx strpart strwidth synID synconcealed systemlist tabpagewinnr tan test_alloc_fail test_garbagecollect_now test_null_job test_null_string timer_pause timer_stopall tr undofile values wildmenumode win_gotoid winbufnr winline winrestview wordcount -syn keyword vimFuncName contained acos argc asin assert_false assert_notmatch browse bufloaded bufwinnr call ch_evalexpr ch_info ch_read ch_setoptions cindent complete_add cos cursor diff_filler eval exepath extend filter floor foldclosed foldtextresult garbagecollect getbufvar getcmdline getcompletion getfperm getline getpos gettabinfo getwinposx glob2regpat haslocaldir histget hostname input inputsave isdirectory job_getchannel job_status js_encode keys libcallnr lispindent log10 maparg matchadd matchdelete matchstr min mzeval or pow pumvisible range reltimefloat remote_foreground remote_send repeat round screencol searchdecl searchpos setbufline setbufvar setfperm setmatches setreg setwinvar shiftwidth sinh spellbadword sqrt strcharpart strftime string strridx submatch synIDattr synstack tabpagebuflist tagfiles tanh test_autochdir test_null_channel test_null_list test_settime timer_start tolower trunc undotree virtcol win_findbuf win_id2tabwin wincol winnr winsaveview writefile -syn keyword vimFuncName contained add argidx assert_equal assert_inrange assert_true browsedir bufname byte2line ceil ch_evalraw ch_log ch_readraw ch_status clearmatches complete_check cosh deepcopy diff_hlID eventhandler exists feedkeys finddir fmod foldclosedend foreground get getchar getcmdpos getcurpos getfsize getloclist getqflist gettabvar getwinposy globpath hasmapto histnr iconv inputdialog inputsecret islocked job_info job_stop json_decode len line localtime luaeval mapcheck matchaddpos matchend matchstrpos mkdir nextnonblank pathshorten prevnonblank py3eval readfile reltimestr remote_peek remove resolve screenattr screenrow searchpair server2client setcharsearch setline setpos settabvar sha256 simplify sort spellsuggest str2float strchars strgetchar strlen strtrans substitute synIDtrans system tabpagenr taglist tempname test_disable_char_avail test_null_dict test_null_partial timer_info timer_stop toupper type uniq visualmode win_getid win_id2win winheight winrestcmd winwidth xor -syn keyword vimFuncName contained and arglistid assert_exception assert_match atan bufexists bufnr byteidx ch_close ch_getbufnr ch_logfile ch_sendexpr changenr col confirm count delete empty executable exp filereadable findfile fnameescape foldlevel funcref getbufinfo getcharmod getcmdtype getcwd getftime getmatches getreg gettabwinvar getwinvar has histadd hlID indent inputlist insert isnan job_setoptions join +syn keyword vimFuncName contained abs append argv assert_fails assert_notequal atan browsedir bufname byte2line ceil ch_close ch_getbufnr ch_logfile ch_sendexpr cindent complete_add cos cursor diff_filler eval exepath extend filter floor foldclosed foldtextresult garbagecollect getbufvar getcmdline getcompletion getfperm getline getpos gettabinfo getwinposx glob2regpat haslocaldir histget hostname input inputsave isdirectory job_getchannel job_status js_encode len line2byte log10 mapcheck matcharg matchstr mkdir nr2char pow py3eval readfile remote_expr remote_send repeat screenattr search searchpos setbufvar setline setqflist setwinvar simplify soundfold sqrt strcharpart strftime string strridx submatch synID synstack tabpagebuflist tagfiles tanh term_getattr term_getline term_getstatus term_gettty term_sendkeys term_wait test_feedinput test_null_channel test_null_list test_override timer_pause timer_stopall tr undofile values wildmenumode win_findbuf winheight winline winrestview wordcount +syn keyword vimFuncName contained acos argc asin assert_false assert_notmatch atan2 bufexists bufnr byteidx changenr ch_close_in ch_getjob ch_open ch_sendraw clearmatches complete_check cosh deepcopy diff_hlID eventhandler exists feedkeys finddir fmod foldclosedend foreground get getchar getcmdpos getcurpos getfsize getloclist getqflist gettabvar getwinposy globpath hasmapto histnr iconv inputdialog inputsecret islocked job_info job_stop json_decode libcall lispindent luaeval match matchdelete matchstrpos mode or prevnonblank pyeval reltime remote_foreground remote_startserver resolve screenchar searchdecl server2client setcharsearch setloclist setreg sha256 sin spellbadword str2float strchars strgetchar strlen strtrans substitute synIDattr system tabpagenr taglist tempname term_getcursor term_getscrolled term_gettitle term_list term_setsize test_alloc_fail test_garbagecollect_now test_null_dict test_null_partial test_settime timer_start tolower trunc undotree virtcol winbufnr win_getid win_id2tabwin winnr winsaveview writefile +syn keyword vimFuncName contained add argidx assert_equal assert_inrange assert_report balloon_show buflisted bufwinid byteidxcomp char2nr ch_evalexpr ch_info ch_read ch_setoptions col confirm count delete empty executable exp filereadable findfile fnameescape foldlevel funcref getbufinfo getcharmod getcmdtype getcwd getftime getmatches getreg gettabwinvar getwinvar has histadd hlexists indent inputlist insert isnan job_setoptions join json_encode libcallnr localtime map matchadd matchend max mzeval pathshorten printf pyxeval reltimefloat remote_peek remove reverse screencol searchpair serverlist setcmdpos setmatches settabvar shellescape sinh spellsuggest str2nr strdisplaywidth stridx strpart strwidth synconcealed synIDtrans systemlist tabpagewinnr tan term_getaltscreen term_getjob term_getsize term_getttty term_scrape term_start test_autochdir test_ignore_error test_null_job test_null_string timer_info timer_stop toupper type uniq visualmode wincol win_gotoid win_id2win winrestcmd winwidth xor +syn keyword vimFuncName contained and arglistid assert_exception assert_match assert_true browse bufloaded bufwinnr call ch_canread ch_evalraw ch_log ch_readraw ch_status complete copy cscope_connection did_filetype escape execute expand filewritable float2nr fnamemodify foldtext function getbufline getcharsearch getcmdwintype getfontname getftype getpid getregtype getwininfo glob has_key histdel hlID index inputrestore invert items job_start js_decode keys line log maparg matchaddpos matchlist min nextnonblank perleval pumvisible range reltimestr remote_read rename round screenrow searchpairpos setbufline setfperm setpos settabwinvar shiftwidth sort split "--- syntax here and above generated by mkvimvim --- " Special Vim Highlighting (not automatic) {{{1 @@ -164,7 +164,6 @@ endif syn match vimNumber "\<\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=" skipwhite nextgroup=vimGlobal,vimSubst,vimCommand syn match vimNumber "-\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=" skipwhite nextgroup=vimGlobal,vimSubst,vimCommand syn match vimNumber "\<0[xX]\x\+" -syn match vimNumber "\<0[bB][01]\+" syn match vimNumber "\%(^\|[^a-zA-Z]\)\zs#\x\{6}" " All vimCommands are contained by vimIsCommands. {{{2 @@ -299,8 +298,8 @@ syn region vimPatSepZone oneline conta syn region vimPatRegion contained transparent matchgroup=vimPatSepR start="\\[z%]\=(" end="\\)" contains=@vimSubstList oneline syn match vimNotPatSep contained "\\\\" syn cluster vimStringGroup contains=vimEscapeBrace,vimPatSep,vimNotPatSep,vimPatSepErr,vimPatSepZone,@Spell -syn region vimString oneline keepend start=+[^:a-zA-Z>!\\@]"+lc=1 skip=+\\\\\|\\"+ end=+"+ contains=@vimStringGroup -syn region vimString oneline keepend start=+[^:a-zA-Z>!\\@]'+lc=1 end=+'+ +syn region vimString oneline keepend start=+[^a-zA-Z>!\\@]"+lc=1 skip=+\\\\\|\\"+ end=+"+ contains=@vimStringGroup +syn region vimString oneline keepend start=+[^a-zA-Z>!\\@]'+lc=1 end=+'+ syn region vimString oneline start=+=!+lc=1 skip=+\\\\\|\\!+ end=+!+ contains=@vimStringGroup syn region vimString oneline start="=+"lc=1 skip="\\\\\|\\+" end="+" contains=@vimStringGroup syn region vimString oneline start="\s/\s*\A"lc=1 skip="\\\\\|\\+" end="/" contains=@vimStringGroup @@ -560,7 +559,7 @@ syn match vimHiBang contained "!" skipwh syn match vimHiGroup contained "\i\+" syn case ignore -syn keyword vimHiAttrib contained none bold inverse italic reverse standout underline undercurl nocombine +syn keyword vimHiAttrib contained none bold inverse italic reverse standout underline undercurl syn keyword vimFgBgAttrib contained none bg background fg foreground syn case match syn match vimHiAttribList contained "\i\+" contains=vimHiAttrib