diff options
76 files changed, 4954 insertions, 1477 deletions
diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 76485c2f38..a5b47e06d5 100644 --- 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: Jul 16, 2019 +" Version: 165 " Maintainer: Charles E Campbell <NdrOchip@ScampbellPfamily.AbizM-NOSPAM> " 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 for v7.4: 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 = "v165" if !exists("s:NOTE") let s:NOTE = 0 let s:WARNING = 1 @@ -39,7 +48,7 @@ endif let s:keepcpo= &cpo setl cpo&vim -"let g:dechofuncname= 1 +"DechoFuncName 1 "DechoRemOn "call Decho("doing autoload/netrw.vim version ".g:loaded_netrw,'~'.expand("<slnum>")) @@ -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) @@ -100,7 +109,7 @@ fun! netrw#ErrorMsg(level,msg,errnum) " call Decho("create a NetrwMessage buffer window",'~'.expand("<slnum>")) bo 1split sil! call s:NetrwEnew() - sil! NetrwKeepj call s:NetrwSafeOptions() + sil! NetrwKeepj call s:NetrwOptionsSafe(1) setl bt=nofile NetrwKeepj file NetrwMessage " call Decho("setl ma noro",'~'.expand("<slnum>")) @@ -171,7 +180,7 @@ endfun " --------------------------------------------------------------------- " Netrw Constants: {{{2 -call s:NetrwInit("g:netrw_dirhist_cnt",0) +call s:NetrwInit("g:netrw_dirhistcnt",0) if !exists("s:LONGLIST") call s:NetrwInit("s:THINLIST",0) call s:NetrwInit("s:LONGLIST",1) @@ -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","curl -T") 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") @@ -299,7 +317,7 @@ let s:netrw_usercuc = &cursorcolumn call s:NetrwInit("g:netrw_cygdrive","/cygdrive") " Default values - d-g ---------- {{{3 call s:NetrwInit("s:didstarstar",0) -call s:NetrwInit("g:netrw_dirhist_cnt" , 0) +call s:NetrwInit("g:netrw_dirhistcnt" , 0) call s:NetrwInit("g:netrw_decompress" , '{ ".gz" : "gunzip", ".bz2" : "bunzip2", ".zip" : "unzip", ".tar" : "tar -xf", ".xz" : "unxz" }') call s:NetrwInit("g:netrw_dirhistmax" , 10) call s:NetrwInit("g:netrw_errorlvl" , s:NOTE) @@ -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" + let g:netrw_localcopydircmd = "cp" + let g:netrw_localcopydircmdopt= " -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 = 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("win64") || has("win16") 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' || &enc == 'utf-16' || &enc == 'ucs-4' 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 <s-down> 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 <s-up> 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("<slnum>")) - 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 "<s-up>==Pexplore <s-down>==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("<slnum>")) 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 +" call Decho("t:netrw_lexbufnr doesn't exist") endif +" call Decho("lexwinnr=".lexwinnr,'~'.expand("<slnum>")) if lexwinnr > 0 " close down netrw explorer window -" call Decho("t:netrw_lexbufnr#".t:netrw_lexbufnr.": close down netrw window",'~'.expand("<slnum>")) +" call Decho("t:netrw_lexbufnr#".t:netrw_lexbufnr.": close down netrw window",'~'.expand("<slnum>")) 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("<slnum>")) 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("<slnum>")) + call netrw#Explore(0,0,0,a1) exe "Explore ".fnameescape(a1) elseif curfile =~ '^\a\{3,}://' " call Decho("case 2: Explore ".substitute(curfile,'[^/\\]*$','',''),'~'.expand("<slnum>")) - exe "Explore ".substitute(curfile,'[^/\\]*$','','') + call netrw#Explore(0,0,0,substitute(curfile,'[^/\\]*$','','')) else " call Decho("case 3: Explore .",'~'.expand("<slnum>")) - 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("<slnum>")) " call Decho("restoring posn to t:netrw_lexposn<".string(t:netrw_lexposn).">",'~'.expand("<slnum>")) @@ -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("<slnum>")) for fname in fnamelist " call Decho("system(".g:netrw_localcopycmd." ".s:ShellEscape(fname)." ".s:ShellEscape(topath).")",'~'.expand("<slnum>")) - 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("<slnum>")) let filelist= join(map(deepcopy(fnamelist),"s:ShellEscape(v:val)")) " call Decho("system(".g:netrw_localcopycmd." ".filelist." ".s:ShellEscape(topath).")",'~'.expand("<slnum>")) - 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 @@ -1557,134 +1601,25 @@ fun! netrw#Nread(mode,fname) endfun " ------------------------------------------------------------------------ -" s:NetrwOptionRestore: restore options (based on prior s:NetrwOptionSave) {{{2 -fun! s:NetrwOptionRestore(vt) -" call Dfunc("s:NetrwOptionRestore(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> winnr($)=".winnr("$")) -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) - 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("<slnum>")) -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) -" call Dret("s:NetrwOptionRestore : ".a:vt."netrw_optionsave doesn't exist") - return - endif - unlet {a:vt}netrw_optionsave - - if exists("+acd") - if exists("{a:vt}netrw_acdkeep") -" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("<slnum>")) - let curdir = getcwd() - let &l:acd = {a:vt}netrw_acdkeep - unlet {a:vt}netrw_acdkeep - if &l:acd - call s:NetrwLcd(curdir) - 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 - " Problem: start with liststyle=0; press <i> : 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 - if exists("{a:vt}netrw_swfkeep") - if &directory == "" - " user hasn't specified a swapfile directory; - " netrw will temporarily set the swapfile directory - " to the current directory as returned by getcwd(). - let &l:directory= getcwd() - sil! let &l:swf = {a:vt}netrw_swfkeep - setl directory= - unlet {a:vt}netrw_swfkeep - elseif &l:swf != {a:vt}netrw_swfkeep - if !g:netrw_use_noswf - " following line causes a Press ENTER in windows -- can't seem to work around it!!! - sil! let &l:swf= {a:vt}netrw_swfkeep - endif - unlet {a:vt}netrw_swfkeep - endif - endif - if exists("{a:vt}netrw_dirkeep") && isdirectory(s:NetrwFile({a:vt}netrw_dirkeep)) && g:netrw_keepdir - let dirkeep = substitute({a:vt}netrw_dirkeep,'\\','/','g') - if exists("{a:vt}netrw_dirkeep") - call s:NetrwLcd(dirkeep) - unlet {a:vt}netrw_dirkeep - 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 Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("<slnum>")) -" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist"),'~'.expand("<slnum>")) -" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) -" call Decho("diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist"),'~'.expand("<slnum>")) -" call Decho("ts=".&l:ts,'~'.expand("<slnum>")) - " Moved the filetype detect here from NetrwGetFile() because remote files - " were having their filetype detect-generated settings overwritten by - " NetrwOptionRestore. - if &ft != "netrw" -" call Decho("filetype detect (ft=".&ft.")",'~'.expand("<slnum>")) - filetype detect - endif -" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) -" call Dret("s:NetrwOptionRestore : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) -endfun - -" --------------------------------------------------------------------- -" s:NetrwOptionSave: save options prior to setting to "netrw-buffer-standard" form {{{2 -" Options get restored by s:NetrwOptionRestore() -" 06/08/07 : removed call to NetrwSafeOptions(), either placed -" immediately after NetrwOptionSave() calls in NetRead -" and NetWrite, or after the s:NetrwEnew() call in -" NetrwBrowse. -" vt: normally its "w:" or "s:" (a variable type) -fun! s:NetrwOptionSave(vt) -" call Dfunc("s:NetrwOptionSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">"." winnr($)=".winnr("$")." mod=".&mod." ma=".&ma) +" s:NetrwOptionsSave: save options prior to setting to "netrw-buffer-standard" form {{{2 +" Options get restored by s:NetrwOptionsRestore() +" +" Option handling: +" * save user's options (s:NetrwOptionsSave) +" * set netrw-safe options (s:NetrwOptionsSafe) +" - change an option only when user option != safe option (s:netrwSetSafeSetting) +" * restore user's options (s:netrwOPtionsRestore) +" - restore a user option when != safe option (s:NetrwRestoreSetting) +" vt: (variable type) normally its either "w:" or "s:" +fun! s:NetrwOptionsSave(vt) +" call Dfunc("s:NetrwOptionsSave(vt<".a:vt.">) win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%")).">"." winnr($)=".winnr("$")." mod=".&mod." ma=".&ma) " call Decho(a:vt."netrw_optionsave".(exists("{a:vt}netrw_optionsave")? ("=".{a:vt}netrw_optionsave) : " doesn't exist"),'~'.expand("<slnum>")) " 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("<slnum>")) if !exists("{a:vt}netrw_optionsave") let {a:vt}netrw_optionsave= 1 else -" call Dret("s:NetrwOptionSave : options already saved") +" call Dret("s:NetrwOptionsSave : options already saved") return endif " call Decho("prior to save: fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist")." diff=".&l:diff,'~'.expand("<slnum>")) @@ -1707,6 +1642,7 @@ fun! s:NetrwOptionSave(vt) let {a:vt}netrw_cpokeep = &l:cpo let {a:vt}netrw_diffkeep = &l:diff let {a:vt}netrw_fenkeep = &l:fen +" call Decho("saving current settings: got here#1",'~'.expand("<slnum>")) if !exists("g:netrw_ffkeep") || g:netrw_ffkeep let {a:vt}netrw_ffkeep = &l:ff endif @@ -1725,12 +1661,10 @@ fun! s:NetrwOptionSave(vt) let {a:vt}netrw_rokeep = &l:ro let {a:vt}netrw_selkeep = &l:sel let {a:vt}netrw_spellkeep = &l:spell +" call Decho("saving current settings: got here#2",'~'.expand("<slnum>")) 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,48 +1677,53 @@ fun! s:NetrwOptionSave(vt) let {a:vt}netrw_dirkeep = getcwd() endif if has("clipboard") - if &go =~# 'a' | sil! let {a:vt}netrw_regstar = @* | endif + sil! let {a:vt}netrw_starkeep = @* + sil! let {a:vt}netrw_pluskeep = @+ endif - sil! let {a:vt}netrw_regslash= @/ + 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("<slnum>")) -" call Dret("s:NetrwOptionSave : tab#".tabpagenr()." win#".winnr()) +" call Dret("s:NetrwOptionsSave : tab#".tabpagenr()." win#".winnr()) endfun -" ------------------------------------------------------------------------ -" s:NetrwSafeOptions: sets options to help netrw do its job {{{2 +" --------------------------------------------------------------------- +" s:NetrwOptionsSafe: sets options to help netrw do its job {{{2 " Use s:NetrwSaveOptions() to save user settings -" Use s:NetrwOptionRestore() to restore user settings -fun! s:NetrwSafeOptions() -" call Dfunc("s:NetrwSafeOptions() win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%"))."> winnr($)=".winnr("$")) +" Use s:NetrwOptionsRestore() to restore user settings +fun! s:NetrwOptionsSafe(islocal) +" call Dfunc("s:NetrwOptionsSafe(islocal=".a:islocal.") win#".winnr()." buf#".bufnr("%")."<".bufname(bufnr("%"))."> winnr($)=".winnr("$")) " call Decho("win#".winnr()."'s ft=".&ft,'~'.expand("<slnum>")) " 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("<slnum>")) - 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:NetrwSetSafeSetting("&l:acd",0)|endif + call s:NetrwSetSafeSetting("&l:ai",0) + call s:NetrwSetSafeSetting("&l:aw",0) + call s:NetrwSetSafeSetting("&l:bl",0) + call s:NetrwSetSafeSetting("&l:bomb",0) + if a:islocal + call s:NetrwSetSafeSetting("&l:bt","nofile") + else + call s:NetrwSetSafeSetting("&l:bt","acwrite") + endif + call s:NetrwSetSafeSetting("&l:ci",0) + call s:NetrwSetSafeSetting("&l:cin",0) + call s:NetrwSetSafeSetting("&l:bh","hide") + call s:NetrwSetSafeSetting("&l:cino","") + call s:NetrwSetSafeSetting("&l:com","") + if &cpo =~ 'a' | call s:NetrwSetSafeSetting("&cpo",substitute(&cpo,'a','','g')) | endif + if &cpo =~ 'A' | call s:NetrwSetSafeSetting("&cpo",substitute(&cpo,'A','','g')) | endif setl fo=nroql2 - setl nohid - setl noim + call s:NetrwSetSafeSetting("&l:hid",0) + call s:NetrwSetSafeSetting("&l:im",0) setl isk+=@ isk+=* isk+=/ - setl magic + call s:NetrwSetSafeSetting("&l:magic",1) if g:netrw_use_noswf - setl noswf + call s:NetrwSetSafeSetting("swf",0) endif - setl report=10000 - setl sel=inclusive - setl nospell - setl tw=0 - setl wig= + call s:NetrwSetSafeSetting("&l:report",10000) + call s:NetrwSetSafeSetting("&l:sel","inclusive") + call s:NetrwSetSafeSetting("&l:spell",0) + call s:NetrwSetSafeSetting("&l:tw",0) + call s:NetrwSetSafeSetting("&l:wig","") setl cedit& call s:NetrwCursor() @@ -1792,12 +1731,194 @@ fun! s:NetrwSafeOptions() " call Decho("ft<".&ft."> ei=".&ei,'~'.expand("<slnum>")) if &ft == "netrw" " call Decho("do any netrw FileType autocmds (doau FileType netrw)",'~'.expand("<slnum>")) - 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("<slnum>")) " 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("<slnum>")) -" call Dret("s:NetrwSafeOptions") +" call Dret("s:NetrwOptionsSafe") +endfun + +" --------------------------------------------------------------------- +" s:NetrwOptionsRestore: restore options (based on prior s:NetrwOptionsSave) {{{2 +fun! s:NetrwOptionsRestore(vt) +" call Dfunc("s:NetrwOptionsRestore(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("<slnum>")) + if !exists("{a:vt}netrw_optionsave") +" 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("<slnum>")) +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) +" call Dret("s:NetrwOptionsRestore : ".a:vt."netrw_optionsave doesn't exist") + return + endif + unlet {a:vt}netrw_optionsave + + if exists("+acd") + if exists("{a:vt}netrw_acdkeep") +" call Decho("g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("<slnum>")) + let curdir = getcwd() + let &l:acd = {a:vt}netrw_acdkeep + unlet {a:vt}netrw_acdkeep + if &l:acd + call s:NetrwLcd(curdir) + endif + 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","@@") + " former problem: start with liststyle=0; press <i> : result, following line resets l:ts. + " Fixed; in s:PerformListing, when w:netrw_liststyle is s:LONGLIST, will use a printf to pad filename with spaces + " rather than by appending a tab which previously was using "&ts" to set the desired spacing. (Sep 28, 2018) + call s:NetrwRestoreSetting(a:vt."netrw_tskeep","&l:ts") + + if exists("{a:vt}netrw_swfkeep") + if &directory == "" + " user hasn't specified a swapfile directory; + " netrw will temporarily set the swapfile directory + " to the current directory as returned by getcwd(). + let &l:directory= getcwd() + sil! let &l:swf = {a:vt}netrw_swfkeep + setl directory= + unlet {a:vt}netrw_swfkeep + elseif &l:swf != {a:vt}netrw_swfkeep + if !g:netrw_use_noswf + " following line causes a Press ENTER in windows -- can't seem to work around it!!! + sil! let &l:swf= {a:vt}netrw_swfkeep + endif + unlet {a:vt}netrw_swfkeep + endif + endif + if exists("{a:vt}netrw_dirkeep") && isdirectory(s:NetrwFile({a:vt}netrw_dirkeep)) && g:netrw_keepdir + let dirkeep = substitute({a:vt}netrw_dirkeep,'\\','/','g') + if exists("{a:vt}netrw_dirkeep") + call s:NetrwLcd(dirkeep) + unlet {a:vt}netrw_dirkeep + endif + endif + if has("clipboard") + 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("<slnum>")) +" call Decho("fo=".&fo.(exists("+acd")? " acd=".&acd : " acd doesn't exist"),'~'.expand("<slnum>")) +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) +" call Decho("diff=".&l:diff." win#".winnr()." w:netrw_diffkeep=".(exists("w:netrw_diffkeep")? w:netrw_diffkeep : "doesn't exist"),'~'.expand("<slnum>")) +" call Decho("ts=".&l:ts,'~'.expand("<slnum>")) + " Moved the filetype detect here from NetrwGetFile() because remote files + " were having their filetype detect-generated settings overwritten by + " NetrwOptionRestore. + if &ft != "netrw" +" call Decho("filetype detect (ft=".&ft.")",'~'.expand("<slnum>")) + filetype detect + endif +" call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo." a:vt=".a:vt,'~'.expand("<slnum>")) +" call Dret("s:NetrwOptionsRestore : tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> modified=".&modified." modifiable=".&modifiable." readonly=".&readonly) +endfun + +" --------------------------------------------------------------------- +" s:NetrwSetSafeSetting: sets an option to a safe setting {{{2 +" but only when the options' value and the safe setting differ +" Doing this means that netrw will not come up as having changed a +" setting last when it really didn't actually change it. +" +" Called from s:NetrwOptionsSafe +" ex. call s:NetrwSetSafeSetting("&l:sel","inclusive") +fun! s:NetrwSetSafeSetting(setting,safesetting) +" call Dfunc("s:NetrwSetSafeSetting(setting<".a:setting."> safesetting<".a:safesetting.">)") + + if a:setting =~ '^&' +" call Decho("fyi: a:setting starts with &") + exe "let settingval= ".a:setting +" call Decho("fyi: settingval<".settingval.">") + + if settingval != a:safesetting +" call Decho("set setting<".a:setting."> to option value<".a:safesetting.">") + if type(a:safesetting) == 0 + exe "let ".a:setting."=".a:safesetting + elseif type(a:safesetting) == 1 + exe "let ".a:setting."= '".a:safesetting."'" + else + call netrw#ErrorMsg(s:ERROR,"(s:NetrwRestoreSetting) doesn't know how to restore ".a:setting." with a safesetting of type#".type(a:safesetting),105) + endif + endif + endif + +" call Dret("s:NetrwSetSafeSetting") +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:NetrwOptionsRestore() to restore each netrw-senstive setting +" keepvars are set up by s:NetrwOptionsSave +fun! s:NetrwRestoreSetting(keepvar,setting) +"" call Dfunc("s:NetrwRestoreSetting(a:keepvar<".a:keepvar."> a:setting<".a:setting.">)") + + " typically called from s:NetrwOptionsRestore + " call s:NetrwRestoreSettings(keep-option-variable-name,'associated-option') + " ex. call s:NetrwRestoreSetting(a:vt."netrw_selkeep","&l:sel") + " Restores option (if different) from a keepvar + if exists(a:keepvar) + exe "let keepvarval= ".a:keepvar + exe "let setting= ".a:setting + +"" call Decho("fyi: a:keepvar<".a:keepvar."> exists") +"" call Decho("fyi: keepvarval=".keepvarval) +"" call Decho("fyi: a:setting<".a:setting."> setting<".setting.">") + + if setting != keepvarval +"" call Decho("restore setting<".a:setting."=".setting."> to keepvarval<".keepvarval.">") + if type(a:setting) == 0 + exe "let ".a:setting."= ".keepvarval + elseif type(a:setting) == 1 + exe "let ".a:setting."= '".keepvarval."'" + 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 " --------------------------------------------------------------------- @@ -1833,7 +1954,7 @@ fun! NetrwStatusLine() endif endfun -" --------------------------------------------------------------------- +" =============================== " Netrw Transfer Functions: {{{1 " =============================== @@ -1847,13 +1968,13 @@ fun! netrw#NetRead(mode,...) " call Dfunc("netrw#NetRead(mode=".a:mode.",...) a:0=".a:0." ".g:loaded_netrw.((a:0 > 0)? " a:1<".a:1.">" : "")) " NetRead: save options {{{3 - call s:NetrwOptionSave("w:") - call s:NetrwSafeOptions() + call s:NetrwOptionsSave("w:") + call s:NetrwOptionsSafe(0) call s:RestoreCursorline() " NetrwSafeOptions sets a buffer up for a netrw listing, which includes buflisting off. " However, this setting is not wanted for a remote editing session. The buffer should be "nofile", still. setl bl -" call Decho("(netrw#NetRead) buf#".bufnr("%")."<".bufname("%")."> bl=".&bl." bt=".&bt." bh=".&bh,'~'.expand("<slnum>")) +" call Decho("buf#".bufnr("%")."<".bufname("%")."> bl=".&bl." bt=".&bt." bh=".&bh,'~'.expand("<slnum>")) " NetRead: interpret mode into a readcmd {{{3 if a:mode == 0 " read remote file before current line @@ -1943,7 +2064,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 +2224,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 +2306,7 @@ fun! netrw#NetRead(mode,...) " NetRead: (rsync) NetRead Method #7 {{{3 elseif b:netrw_method == 7 " call Decho("read via rsync (method #7)",'~'.expand("<slnum>")) - 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 @@ -2252,7 +2373,7 @@ fun! netrw#NetRead(mode,...) " call Decho("cleanup by deleting tmpfile<".tmpfile.">",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwDelete(tmpfile) endif - NetrwKeepj call s:NetrwOptionRestore("w:") + NetrwKeepj call s:NetrwOptionsRestore("w:") " call Dret("netrw#NetRead :5 getcwd<".getcwd().">") endfun @@ -2264,8 +2385,8 @@ fun! netrw#NetWrite(...) range " NetWrite: option handling {{{3 let mod= 0 - call s:NetrwOptionSave("w:") - call s:NetrwSafeOptions() + call s:NetrwOptionsSave("w:") + call s:NetrwOptionsSafe(0) " NetWrite: Get Temporary Filename {{{3 let tmpfile= s:GetTempfile("") @@ -2374,7 +2495,7 @@ fun! netrw#NetWrite(...) range " ============================ if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 echo "(netrw) Processing your write request..." -" call Decho("(netrw) Processing your write request...",'~'.expand("<slnum>")) +" call Decho("Processing your write request...",'~'.expand("<slnum>")) endif "......................................... @@ -2527,7 +2648,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 +2692,7 @@ fun! netrw#NetWrite(...) range " NetWrite: (rsync) NetWrite Method #7 {{{3 elseif b:netrw_method == 7 " call Decho("write via rsync (method #7)",'~'.expand("<slnum>")) - 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 "......................................... @@ -2616,7 +2737,7 @@ fun! netrw#NetWrite(...) range " call Decho("tmpfile<".tmpfile."> readable, will now delete it",'~'.expand("<slnum>")) call s:NetrwDelete(tmpfile) endif - call s:NetrwOptionRestore("w:") + call s:NetrwOptionsRestore("w:") if a:firstline == 1 && a:lastline == line("$") " restore modifiability; usually equivalent to set nomod @@ -2676,9 +2797,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("<slnum>")) " clear out the current tree if exists("w:netrw_treetop") " call Decho("clearing out current tree",'~'.expand("<slnum>")) @@ -2689,8 +2814,9 @@ fun! netrw#SetTreetop(...) " call Decho("freeing w:netrw_treedict",'~'.expand("<slnum>")) unlet w:netrw_treedict endif +" call Decho("inittreetop<".(exists("inittreetop")? inittreetop : "n/a").">") - if a:1 == "" && exists("inittreetop") + if (a:iscmd == 0 || a:1 == "") && exists("inittreetop") let treedir= s:NetrwTreePath(inittreetop) " call Decho("treedir<".treedir.">",'~'.expand("<slnum>")) else @@ -2699,7 +2825,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("<slnum>")) +" call Decho("a:1<".a:1."> is NOT a directory, using treedir<".treedir.">",'~'.expand("<slnum>")) 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 +2836,18 @@ fun! netrw#SetTreetop(...) endif endif " call Decho("treedir<".treedir.">",'~'.expand("<slnum>")) + + " determine if treedir is remote or local let islocal= expand("%") !~ '^\a\{3,}://' " call Decho("islocal=".islocal,'~'.expand("<slnum>")) + + " 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 +2886,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method) else let tfile= a:tfile endif -" call Decho("exe sil! keepalt file ".fnameescape(tfile),'~'.expand("<slnum>")) - exe "sil! keepalt file ".fnameescape(tfile) + call s:NetrwBufRename(tfile) " edit temporary file (ie. read the temporary file in) if rfile =~ '\.zip$' @@ -2783,8 +2913,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method) endif " rename buffer back to remote filename -" call Decho("exe sil! keepalt file ".fnameescape(rfile),'~'.expand("<slnum>")) - 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 +2922,7 @@ fun! s:NetrwGetFile(readcmd, tfile, method) 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 +2993,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 +3112,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 +3242,7 @@ fun! s:NetrwMethod(choice) " call Decho("s:netrw_passwd <".s:netrw_passwd.">",'~'.expand("<slnum>")) " endif "Decho " call Decho("b:netrw_fname <".b:netrw_fname.">",'~'.expand("<slnum>")) -" 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 +3386,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 @@ -3284,7 +3413,7 @@ endfun " 5: (user: <U>) go down (next) directory, using history " 6: (user: <mB>) delete bookmark fun! s:NetrwBookHistHandler(chg,curdir) -" call Dfunc("s:NetrwBookHistHandler(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count." histcnt=".g:netrw_dirhist_cnt." histmax=".g:netrw_dirhistmax) +" call Dfunc("s:NetrwBookHistHandler(chg=".a:chg." curdir<".a:curdir.">) cnt=".v:count." histcnt=".g:netrw_dirhistcnt." histmax=".g:netrw_dirhistmax) if !exists("g:netrw_dirhistmax") || g:netrw_dirhistmax <= 0 " " call Dret("s:NetrwBookHistHandler - suppressed due to g:netrw_dirhistmax") return @@ -3331,12 +3460,14 @@ fun! s:NetrwBookHistHandler(chg,curdir) endif " list directory history - let cnt = g:netrw_dirhist_cnt + " Note: history is saved only when PerformListing is done; + " ie. when netrw can re-use a netrw buffer, the current directory is not saved in the history. + let cnt = g:netrw_dirhistcnt let first = 1 let histcnt = 0 if g:netrw_dirhistmax > 0 - while ( first || cnt != g:netrw_dirhist_cnt ) -" call Decho("first=".first." cnt=".cnt." dirhist_cnt=".g:netrw_dirhist_cnt,'~'.expand("<slnum>")) + while ( first || cnt != g:netrw_dirhistcnt ) +" call Decho("first=".first." cnt=".cnt." dirhistcnt=".g:netrw_dirhistcnt,'~'.expand("<slnum>")) if exists("g:netrw_dirhist_{cnt}") " call Decho("Netrw History#".histcnt.": ".g:netrw_dirhist_{cnt},'~'.expand("<slnum>")) echo printf("Netrw History#%-2d: %s",histcnt,g:netrw_dirhist_{cnt}) @@ -3350,7 +3481,7 @@ fun! s:NetrwBookHistHandler(chg,curdir) endif endwhile else - let g:netrw_dirhist_cnt= 0 + let g:netrw_dirhistcnt= 0 endif if didwork call inputsave()|call input("Press <cr> to continue")|call inputrestore() @@ -3359,27 +3490,27 @@ fun! s:NetrwBookHistHandler(chg,curdir) elseif a:chg == 3 " saves most recently visited directories (when they differ) " call Decho("(browsing) record curdir history",'~'.expand("<slnum>")) - if !exists("g:netrw_dirhist_cnt") || !exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") || g:netrw_dirhist_{g:netrw_dirhist_cnt} != a:curdir + if !exists("g:netrw_dirhistcnt") || !exists("g:netrw_dirhist_{g:netrw_dirhistcnt}") || g:netrw_dirhist_{g:netrw_dirhistcnt} != a:curdir if g:netrw_dirhistmax > 0 - let g:netrw_dirhist_cnt = ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax - let g:netrw_dirhist_{g:netrw_dirhist_cnt} = a:curdir + let g:netrw_dirhistcnt = ( g:netrw_dirhistcnt + 1 ) % g:netrw_dirhistmax + let g:netrw_dirhist_{g:netrw_dirhistcnt} = a:curdir endif -" call Decho("save dirhist#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">",'~'.expand("<slnum>")) +" call Decho("save dirhist#".g:netrw_dirhistcnt."<".g:netrw_dirhist_{g:netrw_dirhistcnt}.">",'~'.expand("<slnum>")) endif elseif a:chg == 4 " u: change to the previous directory stored on the history list " call Decho("(user: <u>) chg to prev dir from history",'~'.expand("<slnum>")) if g:netrw_dirhistmax > 0 - let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - v:count1 ) % g:netrw_dirhistmax - if g:netrw_dirhist_cnt < 0 - let g:netrw_dirhist_cnt= g:netrw_dirhist_cnt + g:netrw_dirhistmax + let g:netrw_dirhistcnt= ( g:netrw_dirhistcnt - v:count1 ) % g:netrw_dirhistmax + if g:netrw_dirhistcnt < 0 + let g:netrw_dirhistcnt= g:netrw_dirhistcnt + g:netrw_dirhistmax endif else - let g:netrw_dirhist_cnt= 0 + let g:netrw_dirhistcnt= 0 endif - if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") -" call Decho("changedir u#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">",'~'.expand("<slnum>")) + if exists("g:netrw_dirhist_{g:netrw_dirhistcnt}") +" call Decho("changedir u#".g:netrw_dirhistcnt."<".g:netrw_dirhist_{g:netrw_dirhistcnt}.">",'~'.expand("<slnum>")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") setl ma noro " call Decho("setl ma noro",'~'.expand("<slnum>")) @@ -3388,13 +3519,13 @@ fun! s:NetrwBookHistHandler(chg,curdir) " call Decho("setl nomod",'~'.expand("<slnum>")) " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) endif -" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}),'~'.expand("<slnum>")) - exe "NetrwKeepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) +" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhistcnt}),'~'.expand("<slnum>")) + exe "NetrwKeepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhistcnt}) else if g:netrw_dirhistmax > 0 - let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + v:count1 ) % g:netrw_dirhistmax + let g:netrw_dirhistcnt= ( g:netrw_dirhistcnt + v:count1 ) % g:netrw_dirhistmax else - let g:netrw_dirhist_cnt= 0 + let g:netrw_dirhistcnt= 0 endif echo "Sorry, no predecessor directory exists yet" endif @@ -3403,9 +3534,9 @@ fun! s:NetrwBookHistHandler(chg,curdir) " U: change to the subsequent directory stored on the history list " call Decho("(user: <U>) chg to next dir from history",'~'.expand("<slnum>")) if g:netrw_dirhistmax > 0 - let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt + 1 ) % g:netrw_dirhistmax - if exists("g:netrw_dirhist_{g:netrw_dirhist_cnt}") -" call Decho("changedir U#".g:netrw_dirhist_cnt."<".g:netrw_dirhist_{g:netrw_dirhist_cnt}.">",'~'.expand("<slnum>")) + let g:netrw_dirhistcnt= ( g:netrw_dirhistcnt + 1 ) % g:netrw_dirhistmax + if exists("g:netrw_dirhist_{g:netrw_dirhistcnt}") +" call Decho("changedir U#".g:netrw_dirhistcnt."<".g:netrw_dirhist_{g:netrw_dirhistcnt}.">",'~'.expand("<slnum>")) if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("b:netrw_curdir") " call Decho("setl ma noro",'~'.expand("<slnum>")) setl ma noro @@ -3415,17 +3546,17 @@ fun! s:NetrwBookHistHandler(chg,curdir) setl nomod " call Decho("(set nomod) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) endif -" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}),'~'.expand("<slnum>")) - exe "NetrwKeepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhist_cnt}) +" call Decho("exe e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhistcnt}),'~'.expand("<slnum>")) + exe "NetrwKeepj e! ".fnameescape(g:netrw_dirhist_{g:netrw_dirhistcnt}) else - let g:netrw_dirhist_cnt= ( g:netrw_dirhist_cnt - 1 ) % g:netrw_dirhistmax - if g:netrw_dirhist_cnt < 0 - let g:netrw_dirhist_cnt= g:netrw_dirhist_cnt + g:netrw_dirhistmax + let g:netrw_dirhistcnt= ( g:netrw_dirhistcnt - 1 ) % g:netrw_dirhistmax + if g:netrw_dirhistcnt < 0 + let g:netrw_dirhistcnt= g:netrw_dirhistcnt + g:netrw_dirhistmax endif echo "Sorry, no successor directory exists yet" endif else - let g:netrw_dirhist_cnt= 0 + let g:netrw_dirhistcnt= 0 echo "Sorry, no successor directory exists yet (g:netrw_dirhistmax is ".g:netrw_dirhistmax.")" endif @@ -3460,10 +3591,12 @@ endfun fun! s:NetrwBookHistRead() " call Dfunc("s:NetrwBookHistRead()") if !exists("g:netrw_dirhistmax") || g:netrw_dirhistmax <= 0 -" " call Dret("s:NetrwBookHistRead - suppressed due to g:netrw_dirhistmax") +" call Dret("s:NetrwBookHistRead - nothing read (suppressed due to dirhistmax=".(exists("g:netrw_dirhistmax")? g:netrw_dirhistmax : "n/a").")") return endif let ykeep= @@ + + " read bookmarks if !exists("s:netrw_initbookhist") let home = s:NetrwHome() let savefile= home."/.netrwbook" @@ -3471,6 +3604,8 @@ fun! s:NetrwBookHistRead() " call Decho("sourcing .netrwbook",'~'.expand("<slnum>")) exe "keepalt NetrwKeepj so ".savefile endif + + " read history if g:netrw_dirhistmax > 0 let savefile= home."/.netrwhist" if filereadable(s:NetrwFile(savefile)) @@ -3481,27 +3616,33 @@ fun! s:NetrwBookHistRead() au VimLeave * call s:NetrwBookHistSave() endif endif + let @@= ykeep +" call Decho("dirhistmax=".(exists("g:netrw_dirhistmax")? g:netrw_dirhistmax : "n/a"),'~'.expand("<slnum>")) +" call Decho("dirhistcnt=".(exists("g:netrw_dirhistcnt")? g:netrw_dirhistcnt : "n/a"),'~'.expand("<slnum>")) " call Dret("s:NetrwBookHistRead") endfun " --------------------------------------------------------------------- -" s:NetrwBookHistSave: this function saves bookmarks and history {{{2 +" s:NetrwBookHistSave: this function saves bookmarks and history to files {{{2 " Sister function: s:NetrwBookHistRead() " I used to do this via viminfo but that appears to " be unreliable for long-term storage " If g:netrw_dirhistmax is <= 0, no history or bookmarks " will be saved. +" (s:NetrwBookHistHandler(3,...) used to record history) fun! s:NetrwBookHistSave() -" call Dfunc("s:NetrwBookHistSave() dirhistmax=".g:netrw_dirhistmax) +" call Dfunc("s:NetrwBookHistSave() dirhistmax=".g:netrw_dirhistmax." dirhistcnt=".g:netrw_dirhistcnt) if !exists("g:netrw_dirhistmax") || g:netrw_dirhistmax <= 0 -" call Dret("s:NetrwBookHistSave : dirhistmax=".g:netrw_dirhistmax) +" call Dret("s:NetrwBookHistSave : nothing saved (dirhistmax=".g:netrw_dirhistmax.")") return endif let savefile= s:NetrwHome()."/.netrwhist" +" call Decho("savefile<".savefile.">",'~'.expand("<slnum>")) 1split call s:NetrwEnew() +" call Decho("case g:netrw_use_noswf=".g:netrw_use_noswf.(exists("+acd")? " +acd" : " -acd"),'~'.expand("<slnum>")) if g:netrw_use_noswf setl cino= com= cpo-=a cpo-=A fo=nroql2 tw=0 report=10000 noswf else @@ -3512,20 +3653,37 @@ fun! s:NetrwBookHistSave() if exists("+acd") | setl noacd | endif sil! NetrwKeepj keepalt %d _ - " save .netrwhist -- no attempt to merge + " rename enew'd file: .netrwhist -- no attempt to merge + " record dirhistmax and current dirhistcnt + " save history +" call Decho("saving history: dirhistmax=".g:netrw_dirhistmax." dirhistcnt=".g:netrw_dirhistcnt." lastline=".line("$"),'~'.expand("<slnum>")) sil! keepalt file .netrwhist call setline(1,"let g:netrw_dirhistmax =".g:netrw_dirhistmax) - call setline(2,"let g:netrw_dirhist_cnt =".g:netrw_dirhist_cnt) - let lastline = line("$") - let cnt = 1 - while cnt <= g:netrw_dirhist_cnt - call setline((cnt+lastline),'let g:netrw_dirhist_'.cnt."='".g:netrw_dirhist_{cnt}."'") - let cnt= cnt + 1 - endwhile - exe "sil! w! ".savefile + call setline(2,"let g:netrw_dirhistcnt =".g:netrw_dirhistcnt) + if g:netrw_dirhistmax > 0 + let lastline = line("$") + let cnt = g:netrw_dirhistcnt + let first = 1 + while ( first || cnt != g:netrw_dirhistcnt ) + let lastline= lastline + 1 + if exists("g:netrw_dirhist_{cnt}") + call setline(lastline,'let g:netrw_dirhist_'.cnt."='".g:netrw_dirhist_{cnt}."'") +" call Decho("..".lastline.'let g:netrw_dirhist_'.cnt."='".g:netrw_dirhist_{cnt}."'",'~'.expand("<slnum>")) + endif + let first = 0 + let cnt = ( cnt - 1 ) % g:netrw_dirhistmax + if cnt < 0 + let cnt= cnt + g:netrw_dirhistmax + endif + endwhile + exe "sil! w! ".savefile +" call Decho("exe sil! w! ".savefile,'~'.expand("<slnum>")) + endif + " save bookmarks sil NetrwKeepj %d _ if exists("g:netrw_bookmarklist") && g:netrw_bookmarklist != [] +" call Decho("saving bookmarks",'~'.expand("<slnum>")) " merge and write .netrwbook let savefile= s:NetrwHome()."/.netrwbook" @@ -3543,7 +3701,10 @@ fun! s:NetrwBookHistSave() " construct and save .netrwbook call setline(1,"let g:netrw_bookmarklist= ".string(g:netrw_bookmarklist)) exe "sil! w! ".savefile +" call Decho("exe sil! w! ".savefile,'~'.expand("<slnum>")) endif + + " cleanup -- remove buffer used to construct history let bgone= bufnr("%") q! exe "keepalt ".bgone."bwipe!" @@ -3560,9 +3721,9 @@ endfun fun! s:NetrwBrowse(islocal,dirname) if !exists("w:netrw_liststyle")|let w:netrw_liststyle= g:netrw_liststyle|endif " call Dfunc("s:NetrwBrowse(islocal=".a:islocal." dirname<".a:dirname.">) liststyle=".w:netrw_liststyle." ".g:loaded_netrw." buf#".bufnr("%")."<".bufname("%")."> win#".winnr()) -" call Decho("modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("<slnum>")) -" call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) -" call Dredir("ls!") +" call Decho("fyi: modified=".&modified." modifiable=".&modifiable." readonly=".&readonly,'~'.expand("<slnum>")) +" call Decho("fyi: tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) +" 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 @@ -3579,18 +3740,24 @@ fun! s:NetrwBrowse(islocal,dirname) " s:NetrwBrowse : simplify the dirname (especially for ".."s in dirnames) {{{3 if a:dirname !~ '^\a\{3,}://' let dirname= simplify(a:dirname) +" call Decho("simplified dirname<".dirname.">") else 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 + + " s:NetrwBrowse : sanity checks: {{{3 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("<slnum>")) " call Dret("s:NetrwBrowse : s:netrw_skipbrowse existed") return endif - - " s:NetrwBrowse : sanity checks: {{{3 if !exists("*shellescape") NetrwKeepj call netrw#ErrorMsg(s:ERROR,"netrw can't run -- your vim is missing shellescape()",69) " call Dret("s:NetrwBrowse : missing shellescape()") @@ -3603,20 +3770,25 @@ fun! s:NetrwBrowse(islocal,dirname) endif " s:NetrwBrowse : save options: {{{3 - call s:NetrwOptionSave("w:") + call s:NetrwOptionsSave("w:") " s:NetrwBrowse : re-instate any marked files {{{3 - if exists("s:netrwmarkfilelist_{bufnr('%')}") -" call Decho("clearing marked files",'~'.expand("<slnum>")) - 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("<slnum>")) + 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("<slnum>")) " call Decho("NetrwKeepj lcd ".fnameescape(dirname)." (due to w:netrw_acdkeep=".w:netrw_acdkeep." - acd=".&acd.")",'~'.expand("<slnum>")) - call s:NetrwLcd(dirname) - call s:NetrwSafeOptions() + if s:NetrwLcd(dirname) +" call Dret("s:NetrwBrowse : lcd failure") + return + endif + " call s:NetrwOptionsSafe() " tst952 failed with this enabled. " call Decho("getcwd<".getcwd().">",'~'.expand("<slnum>")) elseif !a:islocal && dirname !~ '[\/]$' && dirname !~ '^"' @@ -3638,13 +3810,12 @@ fun! s:NetrwBrowse(islocal,dirname) " s:NetrwBrowse : remote-read the requested file into current buffer {{{3 call s:NetrwEnew(dirname) - call s:NetrwSafeOptions() + call s:NetrwOptionsSafe(a:islocal) setl ma noro " call Decho("setl ma noro",'~'.expand("<slnum>")) 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("<slnum>")) - 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 @@ -3664,7 +3835,7 @@ fun! s:NetrwBrowse(islocal,dirname) " s:NetrwBrowse : save certain window-oriented variables into buffer-oriented variables {{{3 call s:SetBufWinVars() - call s:NetrwOptionRestore("w:") + call s:NetrwOptionsRestore("w:") " call Decho("setl ma nomod",'~'.expand("<slnum>")) setl ma nomod noro " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) @@ -3691,16 +3862,18 @@ 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("<slnum>")) -" call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/",'~'.expand("<slnum>")) - exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" - else -" call Decho("2match none",'~'.expand("<slnum>")) - 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("<slnum>")) +" " call Decho("exe 2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/",'~'.expand("<slnum>")) + exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" + else +" " call Decho("2match none",'~'.expand("<slnum>")) + 2match none + endif endif if reusing && line("$") > 1 - call s:NetrwOptionRestore("w:") + call s:NetrwOptionsRestore("w:") " call Decho("setl noma nomod nowrap",'~'.expand("<slnum>")) setl noma nomod nowrap " call Decho("(set noma nomod nowrap) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) @@ -3746,7 +3919,10 @@ fun! s:NetrwBrowse(islocal,dirname) " call Decho("handle g:netrw_keepdir=".g:netrw_keepdir.": getcwd<".getcwd()."> acd=".&acd,'~'.expand("<slnum>")) " call Decho("l:acd".(exists("&l:acd")? "=".&l:acd : " doesn't exist"),'~'.expand("<slnum>")) 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 @@ -3778,7 +3954,7 @@ fun! s:NetrwBrowse(islocal,dirname) if !exists("g:netrw_quiet") NetrwKeepj call netrw#ErrorMsg(s:ERROR,"netrw doesn't understand your dirname<".dirname.">",20) endif - NetrwKeepj call s:NetrwOptionRestore("w:") + NetrwKeepj call s:NetrwOptionsRestore("w:") " call Decho("setl noma nomod nowrap",'~'.expand("<slnum>")) setl noma nomod nowrap " call Decho(" ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) @@ -3789,15 +3965,15 @@ fun! s:NetrwBrowse(islocal,dirname) " call Decho("b:netrw_curdir<".b:netrw_curdir."> (remote)",'~'.expand("<slnum>")) endif " (additional remote handling) - " ----------------------- - " Directory Listing: {{{3 - " ----------------------- + " ------------------------------- + " Perform Directory Listing: {{{3 + " ------------------------------- NetrwKeepj call s:NetrwMaps(a:islocal) NetrwKeepj call s:NetrwCommands(a:islocal) NetrwKeepj call s:PerformListing(a:islocal) " restore option(s) - call s:NetrwOptionRestore("w:") + call s:NetrwOptionsRestore("w:") " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) " If there is a rexposn: restore position with rexposn @@ -3817,6 +3993,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("<slnum>")) @@ -3824,8 +4006,8 @@ fun! s:NetrwBrowse(islocal,dirname) endif " The s:LocalBrowseRefresh() function is called by an autocmd - " installed by s:LocalFastBrowser() when g:netrw_fastbrowse <= 1 (ie. slow, medium speed). - " However, s:NetrwBrowse() causes the FocusGained event to fire the firstt time. + " installed by s:LocalFastBrowser() when g:netrw_fastbrowse <= 1 (ie. slow or medium speed). + " However, s:NetrwBrowse() causes the FocusGained event to fire the first time. " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol(),'~'.expand("<slnum>")) " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("s:NetrwBrowse : did PerformListing ft<".&ft.">") @@ -3837,17 +4019,18 @@ endfun " may not apply correctly; ie. netrw's idea of the current directory may " differ from vim's. This function insures that netrw's idea of the current " directory is used. +" Returns a path to the file specified by a:fname fun! s:NetrwFile(fname) -" call Dfunc("s:NetrwFile(fname<".a:fname.">) win#".winnr()) -" call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a'),'~'.expand("<slnum>")) -" call Decho("g:netrw_cygwin =".(exists("g:netrw_cygwin")? g:netrw_cygwin : 'n/a'),'~'.expand("<slnum>")) -" call Decho("g:netrw_liststyle=".(exists("g:netrw_liststyle")? g:netrw_liststyle : 'n/a'),'~'.expand("<slnum>")) -" call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("<slnum>")) +" "" call Dfunc("s:NetrwFile(fname<".a:fname.">) win#".winnr()) +" "" call Decho("g:netrw_keepdir =".(exists("g:netrw_keepdir")? g:netrw_keepdir : 'n/a'),'~'.expand("<slnum>")) +" "" call Decho("g:netrw_cygwin =".(exists("g:netrw_cygwin")? g:netrw_cygwin : 'n/a'),'~'.expand("<slnum>")) +" "" call Decho("g:netrw_liststyle=".(exists("g:netrw_liststyle")? g:netrw_liststyle : 'n/a'),'~'.expand("<slnum>")) +" "" call Decho("w:netrw_liststyle=".(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("<slnum>")) " clean up any leading treedepthstring if exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST let fname= substitute(a:fname,'^'.s:treedepthstring.'\+','','') -" call Decho("clean up any leading treedepthstring: fname<".fname.">",'~'.expand("<slnum>")) +" "" call Decho("clean up any leading treedepthstring: fname<".fname.">",'~'.expand("<slnum>")) else let fname= a:fname endif @@ -3862,31 +4045,31 @@ fun! s:NetrwFile(fname) if fname =~ '^\' || fname =~ '^\a:\' " windows, but full path given let ret= fname -" call Decho("windows+full path: isdirectory(".fname.")",'~'.expand("<slnum>")) +" "" call Decho("windows+full path: isdirectory(".fname.")",'~'.expand("<slnum>")) else " windows, relative path given let ret= s:ComposePath(b:netrw_curdir,fname) -" call Decho("windows+rltv path: isdirectory(".fname.")",'~'.expand("<slnum>")) +" "" call Decho("windows+rltv path: isdirectory(".fname.")",'~'.expand("<slnum>")) endif elseif fname =~ '^/' " not windows, full path given let ret= fname -" call Decho("unix+full path: isdirectory(".fname.")",'~'.expand("<slnum>")) +" "" call Decho("unix+full path: isdirectory(".fname.")",'~'.expand("<slnum>")) else " not windows, relative path given let ret= s:ComposePath(b:netrw_curdir,fname) -" call Decho("unix+rltv path: isdirectory(".fname.")",'~'.expand("<slnum>")) +" "" call Decho("unix+rltv path: isdirectory(".fname.")",'~'.expand("<slnum>")) endif else " vim and netrw agree on the current directory let ret= fname -" call Decho("vim and netrw agree on current directory (g:netrw_keepdir=".g:netrw_keepdir.")",'~'.expand("<slnum>")) -" call Decho("vim directory: ".getcwd(),'~'.expand("<slnum>")) -" call Decho("netrw directory: ".(exists("b:netrw_curdir")? b:netrw_curdir : 'n/a'),'~'.expand("<slnum>")) +" "" call Decho("vim and netrw agree on current directory (g:netrw_keepdir=".g:netrw_keepdir.")",'~'.expand("<slnum>")) +" "" call Decho("vim directory: ".getcwd(),'~'.expand("<slnum>")) +" "" call Decho("netrw directory: ".(exists("b:netrw_curdir")? b:netrw_curdir : 'n/a'),'~'.expand("<slnum>")) endif -" call Dret("s:NetrwFile ".ret) +" "" call Dret("s:NetrwFile ".ret) return ret endfun @@ -3960,31 +4143,72 @@ 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("<slnum>")) -" call Decho("netrwbuf dictionary=".string(s:netrwbuf),'~'.expand("<slnum>")) +" call Decho("netrwbuf dictionary=".(exists("s:netrwbuf")? string(s:netrwbuf) : 'n/a'),'~'.expand("<slnum>")) +" call Dredir("ls!","s:NetrwGetBuffer") let dirname= a:dirname " re-use buffer if possible {{{3 " call Decho("--re-use a buffer if possible--",'~'.expand("<slnum>")) if !exists("s:netrwbuf") +" call Decho(" s:netrwbuf initialized to {}",'~'.expand("<slnum>")) let s:netrwbuf= {} endif - if has_key(s:netrwbuf,s:NetrwFullPath(dirname)) +" call Decho(" s:netrwbuf =".string(s:netrwbuf),'~'.expand("<slnum>")) +" call Decho(" w:netrw_liststyle =".(exists("w:netrw_liststyle")? w:netrw_liststyle : "n/a"),'~'.expand("<slnum>")) + + 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("<slnum>")) + 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("<slnum>")) + else +" call Decho(" did not find a NetrwTreeListing buffer",'~'.expand("<slnum>")) + 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("<slnum>")) 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") +" call Decho(" lookup netrwbuf dictionary: s:netrwbuf[".s:NetrwFullPath(dirname)."] not a key",'~'.expand("<slnum>")) let bufnum= -1 endif +" call Decho(" bufnum#".bufnum,'~'.expand("<slnum>")) + + " highjack the current buffer if + " it has the desired name + " it is empty +" call Decho("deciding if I can highjack the current buffer#".bufnr("%"),'~'.expand("<slnum>")) +" call Decho("..dirname<".dirname.">",'~'.expand("<slnum>")) +" call Decho("..bufname<".bufname("%").">",'~'.expand("<slnum>")) +" call Decho("..getline($)<".getline("$").">",'~'.expand("<slnum>")) + if dirname == bufname("%") && line("$") == 1 && getline("%") == "" +" call Dret("s:NetrwGetBuffer 0<cleared buffer> : highjacking buffer#".bufnr("%")) + return 0 + endif " get enew buffer and name it -or- re-use buffer {{{3 if bufnum < 0 " get enew buffer and name it @@ -3995,14 +4219,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("<slnum>")) - 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("<slnum>")) - 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 +4230,9 @@ fun! s:NetrwGetBuffer(islocal,dirname) nnoremap <silent> <buffer> ]] :sil call <SID>TreeListMove(']]')<cr> nnoremap <silent> <buffer> [] :sil call <SID>TreeListMove('[]')<cr> nnoremap <silent> <buffer> ][ :sil call <SID>TreeListMove('][')<cr> -" call Decho(" tree listing#".s:netrw_treelistnum." bufnr=".w:netrw_treebufnr,'~'.expand("<slnum>")) - else -" let v:errmsg = "" " Decho - let escdirname = fnameescape(dirname) -" call Decho(" errmsg<".v:errmsg."> bufnr(escdirname<".escdirname.">)=".bufnr(escdirname)." bufname()<".bufname(bufnr(escdirname)).">",'~'.expand("<slnum>")) -" call Decho(' exe sil! keepalt file '.escdirname,'~'.expand("<slnum>")) -" let v:errmsg= "" " Decho - exe 'sil! keepj keepalt file '.escdirname -" call Decho(" errmsg<".v:errmsg."> bufnr(".escdirname.")=".bufnr(escdirname)."<".bufname(bufnr(escdirname)).">",'~'.expand("<slnum>")) +" call Decho(" tree listing bufnr=".w:netrw_treebufnr,'~'.expand("<slnum>")) + 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("<slnum>")) @@ -4041,8 +4253,7 @@ fun! s:NetrwGetBuffer(islocal,dirname) endif " call Decho(" line($)=".line("$"),'~'.expand("<slnum>")) if bufname("%") == '.' -" call Decho("exe sil! keepalt file ".fnameescape(getcwd()),'~'.expand("<slnum>")) - exe "sil! NetrwKeepj keepalt file ".fnameescape(getcwd()) + call s:NetrwBufRename(getcwd()) endif let &ei= eikeep @@ -4066,6 +4277,7 @@ fun! s:NetrwGetBuffer(islocal,dirname) elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST " call Decho("--re-use tree listing--",'~'.expand("<slnum>")) " call Decho(" clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>")) + 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("<slnum>")) @@ -4089,8 +4301,7 @@ fun! s:NetrwGetBuffer(islocal,dirname) " call Decho("--do netrw settings: make this buffer#".bufnr("%")." not-a-file, modifiable, not line-numbered, etc--",'~'.expand("<slnum>")) let fname= expand("%") NetrwKeepj call s:NetrwListSettings(a:islocal) -" call Decho("exe sil! keepalt file ".fnameescape(fname),'~'.expand("<slnum>")) - 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("<slnum>")) @@ -4148,7 +4359,7 @@ fun! s:NetrwGetWord() let curline= getline('.') if curline =~# '"\s*Sorted by\s' - NetrwKeepj norm s + NetrwKeepj norm! s let s:netrw_skipbrowse= 1 echo 'Pressing "s" also works' @@ -4157,11 +4368,11 @@ fun! s:NetrwGetWord() echo 'Press "S" to edit sorting sequence' elseif curline =~# '"\s*Quick Help:' - NetrwKeepj norm ? + NetrwKeepj norm! ? let s:netrw_skipbrowse= 1 elseif curline =~# '"\s*\%(Hiding\|Showing\):' - NetrwKeepj norm a + NetrwKeepj norm! a let s:netrw_skipbrowse= 1 echo 'Pressing "a" also works' @@ -4233,20 +4444,22 @@ 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("<slnum>")) let fname= bufname("%") -" " call Decho("(NetrwListSettings) setl bt=nofile nobl ma nonu nowrap noro nornu",'~'.expand("<slnum>")) - setl bt=nofile nobl ma nonu nowrap noro nornu -" call Decho("(NetrwListSettings) exe sil! keepalt file ".fnameescape(fname),'~'.expand("<slnum>")) - exe "sil! keepalt file ".fnameescape(fname) +" " call Decho("setl bt=nofile nobl ma nonu nowrap noro nornu",'~'.expand("<slnum>")) + " 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 Decho("(NetrwListSettings) exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("<slnum>")) +" call Dredir("ls!","s:NetrwListSettings") +" call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("<slnum>")) exe "setl ts=".(g:netrw_maxfilenamelen+1) setl isk+=.,~,- if g:netrw_fastbrowse > a:islocal @@ -4259,7 +4472,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 +4488,12 @@ fun! s:NetrwListStyle(islocal) " call Decho("chgd w:netrw_liststyle to ".w:netrw_liststyle,'~'.expand("<slnum>")) " call Decho("b:netrw_curdir<".(exists("b:netrw_curdir")? b:netrw_curdir : "doesn't exist").">",'~'.expand("<slnum>")) + " 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("<slnum>")) @@ -4316,6 +4535,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("<slnum>")) NetrwKeepj call winrestview(svpos) @@ -4339,12 +4564,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("<slnum>")) - 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("<slnum>")) + 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) @@ -4435,7 +4662,7 @@ fun! s:NetrwBookmarkMenu() if !exists("s:netrw_menucnt") return endif -" call Dfunc("NetrwBookmarkMenu() histcnt=".g:netrw_dirhist_cnt." menucnt=".s:netrw_menucnt) +" call Dfunc("NetrwBookmarkMenu() histcnt=".g:netrw_dirhistcnt." menucnt=".s:netrw_menucnt) " the following test assures that gvim is running, has menus available, and has menus enabled. if has("gui") && has("menu") && has("gui_running") && &go =~# 'm' && g:netrw_menu @@ -4467,12 +4694,12 @@ fun! s:NetrwBookmarkMenu() " show directory browsing history if g:netrw_dirhistmax > 0 - let cnt = g:netrw_dirhist_cnt + let cnt = g:netrw_dirhistcnt let first = 1 let histcnt = 0 - while ( first || cnt != g:netrw_dirhist_cnt ) + while ( first || cnt != g:netrw_dirhistcnt ) let histcnt = histcnt + 1 - let priority = g:netrw_dirhist_cnt + histcnt + let priority = g:netrw_dirhistcnt + histcnt if exists("g:netrw_dirhist_{cnt}") let histdir= escape(g:netrw_dirhist_{cnt},g:netrw_menu_escape) " call Decho('sil! menu '.g:NetrwMenuPriority.".3.".priority." ".g:NetrwTopLvlMenu.'History.'.histdir.' :e '.histdir,'~'.expand("<slnum>")) @@ -4506,7 +4733,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) let @@= ykeep " call Decho("b:netrw_curdir doesn't exist!",'~'.expand("<slnum>")) " call Decho("getcwd<".getcwd().">",'~'.expand("<slnum>")) -" call Dredir("ls!") +" call Dredir("ls!","s:NetrwBrowseChgDir") " call Dret("s:NetrwBrowseChgDir") return endif @@ -4514,9 +4741,9 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " NetrwBrowseChgDir: save options and initialize {{{3 " call Decho("saving options",'~'.expand("<slnum>")) - call s:SavePosn(s:netrw_nbcd) - NetrwKeepj call s:NetrwOptionSave("s:") - NetrwKeepj call s:NetrwSafeOptions() + call s:SavePosn(s:netrw_posn) + NetrwKeepj call s:NetrwOptionsSave("s:") + NetrwKeepj call s:NetrwOptionsSafe(a:islocal) if (has("win32") || has("win95") || has("win64") || has("win16")) let dirname = substitute(b:netrw_curdir,'\\','/','ge') else @@ -4526,9 +4753,10 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) let dolockout = 0 let dorestore = 1 " call Decho("dirname<".dirname.">",'~'.expand("<slnum>")) +" call Decho("newdir<".newdir.">",'~'.expand("<slnum>")) " ignore <cr>s when done in the banner -" call Decho('ignore [return]s when done in banner (g:netrw_banner='.g:netrw_banner.")",'~'.expand("<slnum>")) +" call Decho('(s:NetrwBrowseChgDir) ignore [return]s when done in banner (g:netrw_banner='.g:netrw_banner.")",'~'.expand("<slnum>")) if g:netrw_banner " call Decho("w:netrw_bannercnt=".(exists("w:netrw_bannercnt")? w:netrw_bannercnt : 'n/a')." line(.)#".line('.')." line($)#".line("#"),'~'.expand("<slnum>")) if exists("w:netrw_bannercnt") && line(".") < w:netrw_bannercnt && line("$") >= w:netrw_bannercnt @@ -4539,13 +4767,12 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) setl ma noro nowrap NetrwKeepj call setline(line('.'),'" Quick Help: <F1>:help '.s:QuickHelp[g:netrw_quickhelp]) setl noma nomod nowrap - call s:RestorePosn(s:netrw_nbcd) - NetrwKeepj call s:NetrwOptionRestore("s:") + NetrwKeepj call s:NetrwOptionsRestore("s:") " call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) endif endif " else " Decho -" call Decho("(s:NetrwBrowseChgdir) g:netrw_banner=".g:netrw_banner." (no banner)",'~'.expand("<slnum>")) +" call Decho("g:netrw_banner=".g:netrw_banner." (no banner)",'~'.expand("<slnum>")) endif " set up o/s-dependent directory recognition pattern @@ -4568,7 +4795,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " ------------------------------ " NetrwBrowseChgDir: edit a file {{{3 " ------------------------------ -" call Decho('edit-a-file: case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">",'~'.expand("<slnum>")) +" call Decho('(s:NetrwBrowseChgDir) edit-a-file: case "handling a file": newdir<'.newdir.'> !~ dirpat<'.dirpat.">",'~'.expand("<slnum>")) " save position for benefit of Rexplore let s:rexposn_{bufnr("%")}= winsaveview() @@ -4580,6 +4807,9 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Decho("edit-a-file: handle tree listing: w:netrw_treedict<".(exists("w:netrw_treedict")? string(w:netrw_treedict) : 'n/a').">",'~'.expand("<slnum>")) " call Decho("edit-a-file: newdir<".newdir.">",'~'.expand("<slnum>")) let dirname= s:NetrwTreeDir(a:islocal) + "COMBAK : not working for a symlink -- but what about a regular file? a directory? +" call Decho("COMBAK : not working for a symlink -- but what about a regular file? a directory?") + " Feb 17, 2019: following if-else-endif restored -- wasn't editing a file in tree mode if dirname =~ '/$' let dirname= dirname.newdir else @@ -4597,7 +4827,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " this lets netrw#BrowseX avoid the edit if a:0 < 1 " call Decho("edit-a-file: (a:0=".a:0."<1) set up windows for editing<".fnameescape(dirname)."> didsplit=".(exists("s:didsplit")? s:didsplit : "doesn't exist"),'~'.expand("<slnum>")) - NetrwKeepj call s:NetrwOptionRestore("s:") + NetrwKeepj call s:NetrwOptionsRestore("s:") let curdir= b:netrw_curdir if !exists("s:didsplit") " call Decho("edit-a-file: s:didsplit does not exist; g:netrw_browse_split=".string(g:netrw_browse_split)." win#".winnr(),'~'.expand("<slnum>")) @@ -4712,14 +4942,14 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Decho('goto-newdir: case "just go to new directory spec": newdir<'.newdir.'>','~'.expand("<slnum>")) let dirname = newdir NetrwKeepj call s:SetRexDir(a:islocal,dirname) - NetrwKeepj call s:NetrwOptionRestore("s:") + NetrwKeepj call s:NetrwOptionsRestore("s:") norm! m` elseif newdir == './' " --------------------------------------------- " NetrwBrowseChgDir: refresh the directory list {{{3 " --------------------------------------------- -" call Decho('refresh-dirlist: case "refresh directory listing": newdir == "./"','~'.expand("<slnum>")) +" call Decho('(s:NetrwBrowseChgDir)refresh-dirlist: case "refresh directory listing": newdir == "./"','~'.expand("<slnum>")) NetrwKeepj call s:SetRexDir(a:islocal,dirname) norm! m` @@ -4727,7 +4957,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " -------------------------------------- " NetrwBrowseChgDir: go up one directory {{{3 " -------------------------------------- -" call Decho('go-up: case "go up one directory": newdir == "../"','~'.expand("<slnum>")) +" call Decho('(s:NetrwBrowseChgDir)go-up: case "go up one directory": newdir == "../"','~'.expand("<slnum>")) if w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " force a refresh @@ -4765,7 +4995,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) else " unix or cygwin -" call Decho('go-up: case "go up one directory": newdir == "../" and unix or cygwin','~'.expand("<slnum>")) +" call Decho('(s:NetrwBrowseChgDir)go-up: case "go up one directory": newdir == "../" and unix or cygwin','~'.expand("<slnum>")) if a:islocal let dirname= substitute(dirname,'^\(.*\)/\([^/]\+\)/$','\1','') if dirname == "" @@ -4777,13 +5007,13 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " call Decho("go-up: unix: dirname<".dirname."> (go up one dir)",'~'.expand("<slnum>")) endif NetrwKeepj call s:SetRexDir(a:islocal,dirname) - norm m` + norm! m` elseif exists("w:netrw_liststyle") && w:netrw_liststyle == s:TREELIST && exists("w:netrw_treedict") " -------------------------------------- " NetrwBrowseChgDir: Handle Tree Listing {{{3 " -------------------------------------- -" call Decho('tree-list: case liststyle is TREELIST and w:netrw_treedict exists','~'.expand("<slnum>")) +" call Decho('(s:NetrwBrowseChgDir)tree-list: case liststyle is TREELIST and w:netrw_treedict exists','~'.expand("<slnum>")) " force a refresh (for TREELIST, NetrwTreeDir() will force the refresh) " call Decho("tree-list: setl noro ma",'~'.expand("<slnum>")) setl noro ma @@ -4800,10 +5030,10 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " search treedict for tree dir as-is " call Decho("tree-list: search treedict for tree dir as-is",'~'.expand("<slnum>")) if has_key(w:netrw_treedict,treedir) -" call Decho('tree-list: ....searched for treedir<'.treedir.'> : found it!','~'.expand("<slnum>")) +" call Decho('(s:NetrwBrowseChgDir)tree-list: ....searched for treedir<'.treedir.'> : found it!','~'.expand("<slnum>")) let haskey= 1 else -" call Decho('tree-list: ....searched for treedir<'.treedir.'> : not found','~'.expand("<slnum>")) +" call Decho('(s:NetrwBrowseChgDir)tree-list: ....searched for treedir<'.treedir.'> : not found','~'.expand("<slnum>")) endif " search treedict for treedir with a [/@] appended @@ -4811,10 +5041,10 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) if !haskey && treedir !~ '[/@]$' if has_key(w:netrw_treedict,treedir."/") let treedir= treedir."/" -" call Decho('tree-list: ....searched.for treedir<'.treedir.'> found it!','~'.expand("<slnum>")) +" call Decho('(s:NetrwBrowseChgDir)tree-list: ....searched.for treedir<'.treedir.'> found it!','~'.expand("<slnum>")) let haskey = 1 else -" call Decho('tree-list: ....searched for treedir<'.treedir.'/> : not found','~'.expand("<slnum>")) +" call Decho('(s:NetrwBrowseChgDir)tree-list: ....searched for treedir<'.treedir.'/> : not found','~'.expand("<slnum>")) endif endif @@ -4823,10 +5053,10 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) if !haskey && treedir =~ '/$' let treedir= substitute(treedir,'/$','','') if has_key(w:netrw_treedict,treedir) -" call Decho('tree-list: ....searched.for treedir<'.treedir.'> found it!','~'.expand("<slnum>")) +" call Decho('(s:NetrwBrowseChgDir)tree-list: ....searched.for treedir<'.treedir.'> found it!','~'.expand("<slnum>")) let haskey = 1 else -" call Decho('tree-list: ....searched for treedir<'.treedir.'> : not found','~'.expand("<slnum>")) +" call Decho('(s:NetrwBrowseChgDir)tree-list: ....searched for treedir<'.treedir.'> : not found','~'.expand("<slnum>")) endif endif @@ -4855,7 +5085,7 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) let dirname = s:ComposePath(dirname,newdir) " call Decho("go down one dir: dirname<".dirname."> newdir<".newdir.">",'~'.expand("<slnum>")) NetrwKeepj call s:SetRexDir(a:islocal,dirname) - norm m` + norm! m` endif " -------------------------------------- @@ -4865,11 +5095,10 @@ fun! s:NetrwBrowseChgDir(islocal,newdir,...) " dorestore is zero'd when a local file was hidden or bufhidden; " in such a case, we want to keep whatever settings it may have. " call Decho("doing option restore (dorestore=".dorestore.")",'~'.expand("<slnum>")) - NetrwKeepj call s:NetrwOptionRestore("s:") + NetrwKeepj call s:NetrwOptionsRestore("s:") " else " Decho " call Decho("skipping option restore (dorestore==0): hidden=".&hidden." bufhidden=".&bufhidden." mod=".&mod,'~'.expand("<slnum>")) endif - call s:RestorePosn(s:netrw_nbcd) if dolockout && dorestore " call Decho("restore: filewritable(dirname<".dirname.">)=".filewritable(dirname),'~'.expand("<slnum>")) if filewritable(dirname) @@ -4884,6 +5113,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("<slnum>")) endif endif + call s:RestorePosn(s:netrw_posn) let @@= ykeep " call Dret("s:NetrwBrowseChgDir <".dirname."> : curpos<".string(getpos(".")).">") @@ -4905,10 +5135,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("<slnum>")) @@ -4916,28 +5142,40 @@ fun! s:NetrwBrowseUpDir(islocal) let swwline= winline() - 1 if exists("w:netrw_treetop") let b:netrw_curdir= w:netrw_treetop + 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 curdir= b:netrw_curdir + 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 +" call Decho("looking for curfile<^".s:treedepthstring.curfile.">",'~'.expand("<slnum>")) +" call Decho("having curpath<".curpath.">",'~'.expand("<slnum>")) + 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("<slnum>")) + if treepath == curpath + break + endif + endwhile endif - exe "sil! NetrwKeepj norm! z\<cr>" - while winline() < swwline - let curwinline= winline() - exe "sil! NetrwKeepj norm! \<c-y>" - if curwinline == winline() - break - endif - endwhile + else " call Decho("case: not treestyle",'~'.expand("<slnum>")) + call s:SavePosn(s:netrw_posn) if exists("b:netrw_curdir") let curdir= b:netrw_curdir else @@ -4948,17 +5186,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("<slnum>")) - exe w:netrw_bannercnt - else - 1 - endif + call s:RestorePosn(s:netrw_posn) + let curdir= substitute(curdir,'^.*[\/]','','') + call search('\<'.curdir.'/','wc') endif - let curdir= substitute(curdir,'^.*[\/]','','') - call search('\<'.curdir.'\>','wc') " call Dret("s:NetrwBrowseUpDir") endfun @@ -4969,13 +5200,12 @@ 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") +" call Dret("(netrw#BrowseX) did gf instead") endif - let ykeep = @@ let screenposn = winsaveview() " call Decho("saving posn to screenposn<".string(screenposn).">",'~'.expand("<slnum>")) @@ -5000,7 +5230,7 @@ fun! netrw#BrowseX(fname,remote) endif endfor endif -" call Decho("restoring posn to screenposn<".string(screenposn).">,'~'.expand("<slnum>"))" +" call Decho("restoring posn: screenposn<".string(screenposn).">,'~'.expand("<slnum>"))" call winrestview(screenposn) let @@= ykeep let &aw= awkeep @@ -5015,6 +5245,9 @@ fun! netrw#BrowseX(fname,remote) if has("win32") || has("win95") || has("win64") || has("win16") let exten= substitute(exten,'^.*$','\L&\E','') endif + if exten =~ "[\\/]" + let exten= "" + endif " call Decho("exten<".exten.">",'~'.expand("<slnum>")) if a:remote == 1 @@ -5027,11 +5260,17 @@ fun! netrw#BrowseX(fname,remote) let newname = substitute(s:netrw_tmpfile,'^\(.*\)/\(.*\)\.\([^.]*\)$','\1/'.basename.'.\3','') " call Decho("basename<".basename.">",'~'.expand("<slnum>")) " call Decho("newname <".newname.">",'~'.expand("<slnum>")) - if rename(s:netrw_tmpfile,newname) == 0 - " renaming succeeded - let fname= newname + if s:netrw_tmpfile != newname && newname != "" + if rename(s:netrw_tmpfile,newname) == 0 + " renaming succeeded +" call Decho("renaming succeeded (tmpfile<".s:netrw_tmpfile."> to <".newname.">)") + let fname= newname + else + " renaming failed +" call Decho("renaming failed (tmpfile<".s:netrw_tmpfile."> to <".newname.">)") + let fname= s:netrw_tmpfile + endif else - " renaming failed let fname= s:netrw_tmpfile endif else @@ -5098,7 +5337,7 @@ fun! netrw#BrowseX(fname,remote) let ret= v:shell_error elseif has("win32") || has("win64") -" call Decho("windows",'~'.expand("<slnum>")) +" call Decho("win".(has("win32")? "32" : "64")",'~'.expand("<slnum>")) if executable("start") call s:NetrwExe('sil! !start rundll32 url.dll,FileProtocolHandler '.s:ShellEscape(fname,1)) elseif executable("rundll32") @@ -5106,7 +5345,7 @@ fun! netrw#BrowseX(fname,remote) else call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) endif - call inputsave()|call input("Press <cr> to continue")|call inputrestore() + " call inputsave()|call input("Press <cr> to continue")|call inputrestore() let ret= v:shell_error elseif has("win32unix") @@ -5121,7 +5360,7 @@ fun! netrw#BrowseX(fname,remote) else call netrw#ErrorMsg(s:WARNING,"rundll32 not on path",74) endif - call inputsave()|call input("Press <cr> to continue")|call inputrestore() + " call inputsave()|call input("Press <cr> to continue")|call inputrestore() let ret= v:shell_error elseif has("unix") && executable("kfmclient") && s:CheckIfKde() @@ -5134,6 +5373,11 @@ fun! netrw#BrowseX(fname,remote) 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("unix and atril",'~'.expand("<slnum>")) + 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("<slnum>")) call s:NetrwExe("sil !xdg-open ".s:ShellEscape(fname,1).redir) @@ -5184,22 +5428,76 @@ 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 : '<cfile>')) + 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("<slnum>")) - 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("<slnum>")) + + if oldbufname != a:newname +" call Decho("do buffer rename: oldbufname<".oldbufname."> ≠ a:newname<".a:newname.">",'~'.expand("<slnum>")) + let b:junk= 1 +" call Decho("rename buffer: sil! keepj keepalt file ".fnameescape(a:newname),'~'.expand("<slnum>")) + exe 'sil! keepj keepalt file '.fnameescape(a:newname) +" call Dredir("ls!","s:NetrwBufRename (before bwipe)") + let oldbufnr= bufnr(oldbufname) +" call Decho("oldbufname<".oldbufname."> oldbufnr#".oldbufnr,'~'.expand("<slnum>")) +" call Decho("bufnr(%)=".bufnr("%"),'~'.expand("<slnum>")) + if oldbufname != "" && oldbufnr != -1 && oldbufnr != bufnr("%") +" call Decho("bwipe ".oldbufnr,'~'.expand("<slnum>")) + exe "bwipe! ".oldbufnr +" else " Decho +" call Decho("did *not* bwipe buf#".oldbufnr,'~'.expand("<slnum>")) + endif +" call Dredir("ls!","s:NetrwBufRename (after rename)") +" else " Decho +" call Decho("oldbufname<".oldbufname."> == a:newname: did *not* rename",'~'.expand("<slnum>")) + endif + +" 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 +5763,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("<slnum>")) 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("<slnum>")) 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("<slnum>")) let g:netrw_list_hide= g:netrw_list_hide . ',\(^\|\s\s\)\zs\.\S\+' else +" call Decho("set .file pattern as hiding list",'~'.expand("<slnum>")) 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 +5793,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 +5814,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 +5833,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 +5883,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 +5894,7 @@ endfun " --------------------------------------------------------------------- " s:NetrwServerEdit: edit file in a server gvim, usually NETRWSERVER (implements <c-r>){{{2 " a:islocal=0 : <c-r> not used, remote -" a:islocal=1 : <c-r> no used, local +" a:islocal=1 : <c-r> not used, local " a:islocal=2 : <c-r> used, remote " a:islocal=3 : <c-r> used, local fun! s:NetrwServerEdit(islocal,fname) @@ -5706,6 +6019,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,12 +6074,16 @@ 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= @@ +" call DechoBuf(bufnr("%"),"COMBAK#3") " find a character not in the "hide" string to use as a separator for :g and :v commands - " How-it-works: take the hiding command, convert it into a range. Duplicate - " characters don't matter. Remove all such characters from the '/~...90' - " string. Use the first character left as a separator character. + " How-it-works: take the hiding command, convert it into a range. + " Duplicate characters don't matter. + " Remove all such characters from the '/~@#...890' string. + " Use the first character left as a separator character. +" call Decho("find a character not in the hide string to use as a separator") let listhide= g:netrw_list_hide let sep = strpart(substitute('/~@#$%^&*{};:,<.>?|1234567890','['.escape(listhide,'-]^\').']','','ge'),1,1) " call Decho("sep=".sep,'~'.expand("<slnum>")) @@ -5776,24 +6096,31 @@ fun! s:NetrwListHide() let hide = listhide let listhide = "" endif +" call Decho("hide<".hide."> listhide<".listhide.'>','~'.expand("<slnum>")) " Prune the list by hiding any files which match +" call Decho("prune the list by hiding any files which ",((g:netrw_hide == 1)? "" : "don't")." match hide<".hide.">") if g:netrw_hide == 1 -" call Decho("hiding<".hide."> listhide<".listhide.">",'~'.expand("<slnum>")) +" call Decho("..hiding<".hide.">",'~'.expand("<slnum>")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'d' elseif g:netrw_hide == 2 -" call Decho("showing<".hide."> listhide<".listhide.">",'~'.expand("<slnum>")) +" call Decho("..showing<".hide.">",'~'.expand("<slnum>")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$g'.sep.hide.sep.'s@^@ /-KEEP-/ @' endif +" call Decho("..result: ".string(getline(w:netrw_bannercnt,'$')),'~'.expand("<slnum>")) 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("<slnum>")) exe 'sil! NetrwKeepj '.w:netrw_bannercnt.',$s@^\%( /-KEEP-/ \)\+@@e' +" call Decho("..g KEEP: ".string(getline(w:netrw_bannercnt,'$')),'~'.expand("<slnum>")) endif " remove any blank lines that have somehow remained. " This seems to happen under Windows. exe 'sil! NetrwKeepj 1,$g@^\s*$@d' +" call DechoBuf(bufnr("%"),"COMBAK#4") let @@= ykeep " call Dret("s:NetrwListHide") @@ -5854,9 +6181,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("<slnum>")) - 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 +6195,10 @@ fun! s:NetrwMakeDir(usrhost) endif if !g:netrw_keepdir " call Decho("restoring netrw_origdir since g:netrw_keepdir=".g:netrw_keepdir,'~'.expand("<slnum>")) - call s:NetrwLcd(netrw_origdir) + if s:NetrwLcd(netrw_origdir) +" call Dret("s:NetrwBrowse : lcd failure") + return + endif endif endif @@ -5977,6 +6310,7 @@ endfun fun! s:NetrwMaps(islocal) " call Dfunc("s:NetrwMaps(islocal=".a:islocal.") b:netrw_curdir<".b:netrw_curdir.">") + " mouse <Plug> maps: {{{3 if g:netrw_mousemaps && g:netrw_retmap " call Decho("set up Rexplore 2-leftmouse",'~'.expand("<slnum>")) if !hasmapto("<Plug>NetrwReturn") @@ -5992,22 +6326,87 @@ fun! s:NetrwMaps(islocal) " call Decho("made <Plug>NetrwReturn map",'~'.expand("<slnum>")) endif + " generate default <Plug> maps {{{3 + if !hasmapto('<Plug>NetrwHide') |nmap <buffer> <silent> <nowait> a <Plug>NetrwHide_a|endif + if !hasmapto('<Plug>NetrwBrowseUpDir') |nmap <buffer> <silent> <nowait> - <Plug>NetrwBrowseUpDir |endif + if !hasmapto('<Plug>NetrwOpenFile') |nmap <buffer> <silent> <nowait> % <Plug>NetrwOpenFile|endif + if !hasmapto('<Plug>NetrwBadd_cb') |nmap <buffer> <silent> <nowait> cb <Plug>NetrwBadd_cb|endif + if !hasmapto('<Plug>NetrwBadd_cB') |nmap <buffer> <silent> <nowait> cB <Plug>NetrwBadd_cB|endif + if !hasmapto('<Plug>NetrwLcd') |nmap <buffer> <silent> <nowait> cd <Plug>NetrwLcd|endif + if !hasmapto('<Plug>NetrwSetChgwin') |nmap <buffer> <silent> <nowait> C <Plug>NetrwSetChgwin|endif + if !hasmapto('<Plug>NetrwRefresh') |nmap <buffer> <silent> <nowait> <c-l> <Plug>NetrwRefresh|endif + if !hasmapto('<Plug>NetrwLocalBrowseCheck') |nmap <buffer> <silent> <nowait> <cr> <Plug>NetrwLocalBrowseCheck|endif + if !hasmapto('<Plug>NetrwServerEdit') |nmap <buffer> <silent> <nowait> <c-r> <Plug>NetrwServerEdit|endif + if !hasmapto('<Plug>NetrwMakeDir') |nmap <buffer> <silent> <nowait> d <Plug>NetrwMakeDir|endif + if !hasmapto('<Plug>NetrwBookHistHandler_gb')|nmap <buffer> <silent> <nowait> gb <Plug>NetrwBookHistHandler_gb|endif +" --------------------------------------------------------------------- +" if !hasmapto('<Plug>NetrwForceChgDir') |nmap <buffer> <silent> <nowait> gd <Plug>NetrwForceChgDir|endif +" if !hasmapto('<Plug>NetrwForceFile') |nmap <buffer> <silent> <nowait> gf <Plug>NetrwForceFile|endif +" if !hasmapto('<Plug>NetrwHidden') |nmap <buffer> <silent> <nowait> gh <Plug>NetrwHidden|endif +" if !hasmapto('<Plug>NetrwSetTreetop') |nmap <buffer> <silent> <nowait> gn <Plug>NetrwSetTreetop|endif +" if !hasmapto('<Plug>NetrwChgPerm') |nmap <buffer> <silent> <nowait> gp <Plug>NetrwChgPerm|endif +" if !hasmapto('<Plug>NetrwBannerCtrl') |nmap <buffer> <silent> <nowait> I <Plug>NetrwBannerCtrl|endif +" if !hasmapto('<Plug>NetrwListStyle') |nmap <buffer> <silent> <nowait> i <Plug>NetrwListStyle|endif +" if !hasmapto('<Plug>NetrwMarkMoveMF2Arglist')|nmap <buffer> <silent> <nowait> ma <Plug>NetrwMarkMoveMF2Arglist|endif +" if !hasmapto('<Plug>NetrwMarkMoveArglist2MF')|nmap <buffer> <silent> <nowait> mA <Plug>NetrwMarkMoveArglist2MF|endif +" if !hasmapto('<Plug>NetrwBookHistHandler_mA')|nmap <buffer> <silent> <nowait> mb <Plug>NetrwBookHistHandler_mA|endif +" if !hasmapto('<Plug>NetrwBookHistHandler_mB')|nmap <buffer> <silent> <nowait> mB <Plug>NetrwBookHistHandler_mB|endif +" if !hasmapto('<Plug>NetrwMarkFileCopy') |nmap <buffer> <silent> <nowait> mc <Plug>NetrwMarkFileCopy|endif +" if !hasmapto('<Plug>NetrwMarkFileDiff') |nmap <buffer> <silent> <nowait> md <Plug>NetrwMarkFileDiff|endif +" if !hasmapto('<Plug>NetrwMarkFileEdit') |nmap <buffer> <silent> <nowait> me <Plug>NetrwMarkFileEdit|endif +" if !hasmapto('<Plug>NetrwMarkFile') |nmap <buffer> <silent> <nowait> mf <Plug>NetrwMarkFile|endif +" if !hasmapto('<Plug>NetrwUnmarkList') |nmap <buffer> <silent> <nowait> mF <Plug>NetrwUnmarkList|endif +" if !hasmapto('<Plug>NetrwMarkFileGrep') |nmap <buffer> <silent> <nowait> mg <Plug>NetrwMarkFileGrep|endif +" if !hasmapto('<Plug>NetrwMarkHideSfx') |nmap <buffer> <silent> <nowait> mh <Plug>NetrwMarkHideSfx|endif +" if !hasmapto('<Plug>NetrwMarkFileMove') |nmap <buffer> <silent> <nowait> mm <Plug>NetrwMarkFileMove|endif +" if !hasmapto('<Plug>NetrwMarkFilePrint') |nmap <buffer> <silent> <nowait> mp <Plug>NetrwMarkFilePrint|endif +" if !hasmapto('<Plug>NetrwMarkFileRegexp') |nmap <buffer> <silent> <nowait> mr <Plug>NetrwMarkFileRegexp|endif +" if !hasmapto('<Plug>NetrwMarkFileSource') |nmap <buffer> <silent> <nowait> ms <Plug>NetrwMarkFileSource|endif +" if !hasmapto('<Plug>NetrwMarkFileTag') |nmap <buffer> <silent> <nowait> mT <Plug>NetrwMarkFileTag|endif +" if !hasmapto('<Plug>NetrwMarkFileTgt') |nmap <buffer> <silent> <nowait> mt <Plug>NetrwMarkFileTgt|endif +" if !hasmapto('<Plug>NetrwUnMarkFile') |nmap <buffer> <silent> <nowait> mu <Plug>NetrwUnMarkFile|endif +" if !hasmapto('<Plug>NetrwMarkFileVimCmd') |nmap <buffer> <silent> <nowait> mv <Plug>NetrwMarkFileVimCmd|endif +" if !hasmapto('<Plug>NetrwMarkFileExe_mx') |nmap <buffer> <silent> <nowait> mx <Plug>NetrwMarkFileExe_mx|endif +" if !hasmapto('<Plug>NetrwMarkFileExe_mX') |nmap <buffer> <silent> <nowait> mX <Plug>NetrwMarkFileExe_mX|endif +" if !hasmapto('<Plug>NetrwMarkFileCompress') |nmap <buffer> <silent> <nowait> mz <Plug>NetrwMarkFileCompress|endif +" if !hasmapto('<Plug>NetrwObtain') |nmap <buffer> <silent> <nowait> O <Plug>NetrwObtain|endif +" if !hasmapto('<Plug>NetrwSplit_o') |nmap <buffer> <silent> <nowait> o <Plug>NetrwSplit_o|endif +" if !hasmapto('<Plug>NetrwPreview') |nmap <buffer> <silent> <nowait> p <Plug>NetrwPreview|endif +" if !hasmapto('<Plug>NetrwPrevWinOpen') |nmap <buffer> <silent> <nowait> P <Plug>NetrwPrevWinOpen|endif +" if !hasmapto('<Plug>NetrwBookHistHandler_qb')|nmap <buffer> <silent> <nowait> qb <Plug>NetrwBookHistHandler_qb|endif +" if !hasmapto('<Plug>NetrwFileInfo') |nmap <buffer> <silent> <nowait> qf <Plug>NetrwFileInfo|endif +" if !hasmapto('<Plug>NetrwMarkFileQFEL_qF') |nmap <buffer> <silent> <nowait> qF <Plug>NetrwMarkFileQFEL_qF|endif +" if !hasmapto('<Plug>NetrwMarkFileQFEL_qL') |nmap <buffer> <silent> <nowait> qL <Plug>NetrwMarkFileQFEL_qL|endif +" if !hasmapto('<Plug>NetrwSortStyle') |nmap <buffer> <silent> <nowait> s <Plug>NetrwSortStyle|endif +" if !hasmapto('<Plug>NetSortSequence') |nmap <buffer> <silent> <nowait> S <Plug>NetSortSequence|endif +" if !hasmapto('<Plug>NetrwSetTgt_Tb') |nmap <buffer> <silent> <nowait> Tb <Plug>NetrwSetTgt_Tb|endif +" if !hasmapto('<Plug>NetrwSetTgt_Th') |nmap <buffer> <silent> <nowait> Th <Plug>NetrwSetTgt_Th|endif +" if !hasmapto('<Plug>NetrwSplit_t') |nmap <buffer> <silent> <nowait> t <Plug>NetrwSplit_t|endif +" if !hasmapto('<Plug>NetrwBookHistHandler_u') |nmap <buffer> <silent> <nowait> u <Plug>NetrwBookHistHandler_u|endif +" if !hasmapto('<Plug>NetrwBookHistHandler_U') |nmap <buffer> <silent> <nowait> U <Plug>NetrwBookHistHandler_U|endif +" if !hasmapto('<Plug>NetrwSplit_v') |nmap <buffer> <silent> <nowait> v <Plug>NetrwSplit_v|endif +" if !hasmapto('<Plug>NetrwBrowseX') |nmap <buffer> <silent> <nowait> x <Plug>NetrwBrowseX|endif +" if !hasmapto('<Plug>NetrwLocalExecute') |nmap <buffer> <silent> <nowait> X <Plug>NetrwLocalExecute|endif + if a:islocal " call Decho("make local maps",'~'.expand("<slnum>")) - " local normal-mode maps - nnoremap <buffer> <silent> <nowait> a :<c-u>call <SID>NetrwHide(1)<cr> - nnoremap <buffer> <silent> <nowait> - :<c-u>call <SID>NetrwBrowseUpDir(1)<cr> - nnoremap <buffer> <silent> <nowait> % :<c-u>call <SID>NetrwOpenFile(1)<cr> - nnoremap <buffer> <silent> <nowait> c :<c-u>call <SID>NetrwLcd(b:netrw_curdir)<cr> - nnoremap <buffer> <silent> <nowait> C :<c-u>call <SID>NetrwSetChgwin()<cr> - nnoremap <buffer> <silent> <nowait> <cr> :<c-u>call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr> - nnoremap <buffer> <silent> <nowait> <c-r> :<c-u>call <SID>NetrwServerEdit(3,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> <nowait> d :<c-u>call <SID>NetrwMakeDir("")<cr> - nnoremap <buffer> <silent> <nowait> gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> + " local normal-mode maps {{{3 + nnoremap <buffer> <silent> <Plug>NetrwHide_a :<c-u>call <SID>NetrwHide(1)<cr> + nnoremap <buffer> <silent> <Plug>NetrwBrowseUpDir :<c-u>call <SID>NetrwBrowseUpDir(1)<cr> + nnoremap <buffer> <silent> <Plug>NetrwOpenFile :<c-u>call <SID>NetrwOpenFile(1)<cr> + nnoremap <buffer> <silent> <Plug>NetrwBadd_cb :<c-u>call <SID>NetrwBadd(1,0)<cr> + nnoremap <buffer> <silent> <Plug>NetrwBadd_cB :<c-u>call <SID>NetrwBadd(1,1)<cr> + nnoremap <buffer> <silent> <Plug>NetrwLcd :<c-u>call <SID>NetrwLcd(b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <Plug>NetrwSetChgwin :<c-u>call <SID>NetrwSetChgwin()<cr> + nnoremap <buffer> <silent> <Plug>NetrwLocalBrowseCheck :<c-u>call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr> + nnoremap <buffer> <silent> <Plug>NetrwServerEdit :<c-u>call <SID>NetrwServerEdit(3,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <Plug>NetrwMakeDir :<c-u>call <SID>NetrwMakeDir("")<cr> + nnoremap <buffer> <silent> <Plug>NetrwBookHistHandler_gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> +" --------------------------------------------------------------------- nnoremap <buffer> <silent> <nowait> gd :<c-u>call <SID>NetrwForceChgDir(1,<SID>NetrwGetWord())<cr> nnoremap <buffer> <silent> <nowait> gf :<c-u>call <SID>NetrwForceFile(1,<SID>NetrwGetWord())<cr> nnoremap <buffer> <silent> <nowait> gh :<c-u>call <SID>NetrwHidden(1)<cr> - nnoremap <buffer> <silent> <nowait> gn :<c-u>call netrw#SetTreetop(<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <nowait> gn :<c-u>call netrw#SetTreetop(0,<SID>NetrwGetWord())<cr> nnoremap <buffer> <silent> <nowait> gp :<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr> nnoremap <buffer> <silent> <nowait> I :<c-u>call <SID>NetrwBannerCtrl(1)<cr> nnoremap <buffer> <silent> <nowait> i :<c-u>call <SID>NetrwListStyle(1)<cr> @@ -6041,7 +6440,6 @@ fun! s:NetrwMaps(islocal) nnoremap <buffer> <silent> <nowait> qf :<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr> nnoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(1,getqflist())<cr> nnoremap <buffer> <silent> <nowait> qL :<c-u>call <SID>NetrwMarkFileQFEL(1,getloclist(v:count))<cr> - nnoremap <buffer> <silent> <nowait> r :<c-u>let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> nnoremap <buffer> <silent> <nowait> s :call <SID>NetrwSortStyle(1)<cr> nnoremap <buffer> <silent> <nowait> S :<c-u>call <SID>NetSortSequence(1)<cr> nnoremap <buffer> <silent> <nowait> Tb :<c-u>call <SID>NetrwSetTgt(1,'b',v:count1)<cr> @@ -6052,104 +6450,44 @@ fun! s:NetrwMaps(islocal) nnoremap <buffer> <silent> <nowait> v :call <SID>NetrwSplit(5)<cr> nnoremap <buffer> <silent> <nowait> x :<c-u>call netrw#BrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr> nnoremap <buffer> <silent> <nowait> X :<c-u>call <SID>NetrwLocalExecute(expand("<cword>"))"<cr> -" " local insert-mode maps -" inoremap <buffer> <silent> <nowait> a <c-o>:call <SID>NetrwHide(1)<cr> -" inoremap <buffer> <silent> <nowait> c <c-o>:exe "NetrwKeepj lcd ".fnameescape(b:netrw_curdir)<cr> -" inoremap <buffer> <silent> <nowait> c <c-o>:call <SID>NetrwLcd(b:netrw_curdir)<cr> -" inoremap <buffer> <silent> <nowait> C <c-o>:call <SID>NetrwSetChgwin()<cr> -" inoremap <buffer> <silent> <nowait> % <c-o>:call <SID>NetrwOpenFile(1)<cr> -" inoremap <buffer> <silent> <nowait> - <c-o>:call <SID>NetrwBrowseUpDir(1)<cr> -" inoremap <buffer> <silent> <nowait> <cr> <c-o>:call netrw#LocalBrowseCheck(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord()))<cr> -" inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("")<cr> -" inoremap <buffer> <silent> <nowait> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> -" inoremap <buffer> <silent> <nowait> gh <c-o>:<c-u>call <SID>NetrwHidden(1)<cr> -" nnoremap <buffer> <silent> <nowait> gn :<c-u>call netrw#SetTreetop(<SID>NetrwGetWord())<cr> -" inoremap <buffer> <silent> <nowait> gp <c-o>:<c-u>call <SID>NetrwChgPerm(1,b:netrw_curdir)<cr> -" inoremap <buffer> <silent> <nowait> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr> -" inoremap <buffer> <silent> <nowait> i <c-o>:call <SID>NetrwListStyle(1)<cr> -" inoremap <buffer> <silent> <nowait> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> -" inoremap <buffer> <silent> <nowait> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> -" inoremap <buffer> <silent> <nowait> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(1)<cr> -" inoremap <buffer> <silent> <nowait> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(1)<cr> -" inoremap <buffer> <silent> <nowait> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(1)<cr> -" inoremap <buffer> <silent> <nowait> mf <c-o>:<c-u>call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> -" inoremap <buffer> <silent> <nowait> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(1)<cr> -" inoremap <buffer> <silent> <nowait> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(1)<cr> -" inoremap <buffer> <silent> <nowait> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(1)<cr> -" inoremap <buffer> <silent> <nowait> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(1)<cr> -" inoremap <buffer> <silent> <nowait> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(1)<cr> -" inoremap <buffer> <silent> <nowait> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(1)<cr> -" inoremap <buffer> <silent> <nowait> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(1)<cr> -" inoremap <buffer> <silent> <nowait> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(1)<cr> -" inoremap <buffer> <silent> <nowait> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(1)<cr> -" inoremap <buffer> <silent> <nowait> mv <c-o>:<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr> -" inoremap <buffer> <silent> <nowait> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(1,0)<cr> -" inoremap <buffer> <silent> <nowait> mX <c-o>:<c-u>call <SID>NetrwMarkFileExe(1,1)<cr> -" inoremap <buffer> <silent> <nowait> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(1)<cr> -" inoremap <buffer> <silent> <nowait> O <c-o>:call <SID>NetrwObtain(1)<cr> -" inoremap <buffer> <silent> <nowait> o <c-o>:call <SID>NetrwSplit(3)<cr> -" inoremap <buffer> <silent> <nowait> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> -" inoremap <buffer> <silent> <nowait> P <c-o>:call <SID>NetrwPrevWinOpen(1)<cr> -" inoremap <buffer> <silent> <nowait> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> -" inoremap <buffer> <silent> <nowait> qf <c-o>:<c-u>call <SID>NetrwFileInfo(1,<SID>NetrwGetWord())<cr> -" inoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(1,getqflist())<cr> -" inoremap <buffer> <silent> <nowait> qL :<c-u>call <SID>NetrwMarkFileQFEL(1,getloclist(v:count))<cr> -" inoremap <buffer> <silent> <nowait> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> -" inoremap <buffer> <silent> <nowait> s <c-o>:call <SID>NetrwSortStyle(1)<cr> -" inoremap <buffer> <silent> <nowait> S <c-o>:call <SID>NetSortSequence(1)<cr> -" inoremap <buffer> <silent> <nowait> t <c-o>:call <SID>NetrwSplit(4)<cr> -" inoremap <buffer> <silent> <nowait> Tb <c-o>:<c-u>call <SID>NetrwSetTgt(1,'b',v:count1)<cr> -" inoremap <buffer> <silent> <nowait> Th <c-o>:<c-u>call <SID>NetrwSetTgt(1,'h',v:count)<cr> -" inoremap <buffer> <silent> <nowait> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,expand("%"))<cr> -" inoremap <buffer> <silent> <nowait> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,expand("%"))<cr> -" inoremap <buffer> <silent> <nowait> v <c-o>:call <SID>NetrwSplit(5)<cr> -" inoremap <buffer> <silent> <nowait> x <c-o>:call netrw#BrowseX(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),0),0)"<cr> + + nnoremap <buffer> <silent> <nowait> r :<c-u>let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,'./'))<cr> if !hasmapto('<Plug>NetrwHideEdit') nmap <buffer> <unique> <c-h> <Plug>NetrwHideEdit -" imap <buffer> <unique> <c-h> <c-o><Plug>NetrwHideEdit endif nnoremap <buffer> <silent> <Plug>NetrwHideEdit :call <SID>NetrwHideEdit(1)<cr> if !hasmapto('<Plug>NetrwRefresh') nmap <buffer> <unique> <c-l> <Plug>NetrwRefresh -" imap <buffer> <unique> <c-l> <c-o><Plug>NetrwRefresh endif nnoremap <buffer> <silent> <Plug>NetrwRefresh <c-l>:call <SID>NetrwRefresh(1,<SID>NetrwBrowseChgDir(1,(w:netrw_liststyle == 3)? w:netrw_treetop : './'))<cr> if s:didstarstar || !mapcheck("<s-down>","n") nnoremap <buffer> <silent> <s-down> :Nexplore<cr> -" inoremap <buffer> <silent> <s-down> <c-o>:Nexplore<cr> endif if s:didstarstar || !mapcheck("<s-up>","n") nnoremap <buffer> <silent> <s-up> :Pexplore<cr> -" inoremap <buffer> <silent> <s-up> <c-o>:Pexplore<cr> endif if !hasmapto('<Plug>NetrwTreeSqueeze') nmap <buffer> <silent> <nowait> <s-cr> <Plug>NetrwTreeSqueeze -" imap <buffer> <silent> <nowait> <s-cr> <c-o><Plug>NetrwTreeSqueeze endif nnoremap <buffer> <silent> <Plug>NetrwTreeSqueeze :call <SID>TreeSqueezeDir(1)<cr> let mapsafecurdir = escape(b:netrw_curdir, s:netrw_map_escape) if g:netrw_mousemaps == 1 - nmap <buffer> <leftmouse> <Plug>NetrwLeftmouse + nmap <buffer> <leftmouse> <Plug>NetrwLeftmouse + nmap <buffer> <c-leftmouse> <Plug>NetrwCLeftmouse + nmap <buffer> <middlemouse> <Plug>NetrwMiddlemouse + nmap <buffer> <s-leftmouse> <Plug>NetrwSLeftmouse + nmap <buffer> <s-leftdrag> <Plug>NetrwSLeftdrag + nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse + imap <buffer> <leftmouse> <Plug>ILeftmouse + imap <buffer> <middlemouse> <Plug>IMiddlemouse nno <buffer> <silent> <Plug>NetrwLeftmouse <leftmouse>:call <SID>NetrwLeftmouse(1)<cr> - nmap <buffer> <c-leftmouse> <Plug>NetrwCLeftmouse nno <buffer> <silent> <Plug>NetrwCLeftmouse <leftmouse>:call <SID>NetrwCLeftmouse(1)<cr> - nmap <buffer> <middlemouse> <Plug>NetrwMiddlemouse nno <buffer> <silent> <Plug>NetrwMiddlemouse <leftmouse>:call <SID>NetrwPrevWinOpen(1)<cr> - nmap <buffer> <s-leftmouse> <Plug>NetrwSLeftmouse nno <buffer> <silent> <Plug>NetrwSLeftmouse <leftmouse>:call <SID>NetrwSLeftmouse(1)<cr> - nmap <buffer> <s-leftdrag> <Plug>NetrwSLeftdrag nno <buffer> <silent> <Plug>NetrwSLeftdrag <leftmouse>:call <SID>NetrwSLeftdrag(1)<cr> - nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse nmap <buffer> <silent> <Plug>Netrw2Leftmouse - - imap <buffer> <leftmouse> <Plug>ILeftmouse -" ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(1)<cr> - imap <buffer> <middlemouse> <Plug>IMiddlemouse -" ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(1)<cr> -" imap <buffer> <s-leftmouse> <Plug>ISLeftmouse -" ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(1,<SID>NetrwGetWord())<cr> exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' -" exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' endif exe 'nnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'nnoremap <buffer> <silent> <nowait> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' @@ -6158,27 +6496,27 @@ fun! s:NetrwMaps(islocal) exe 'vnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'vnoremap <buffer> <silent> <nowait> D :call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' exe 'vnoremap <buffer> <silent> <nowait> R :call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' -" exe 'inoremap <buffer> <silent> <nowait> <del> <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' -" exe 'inoremap <buffer> <silent> <nowait> D <c-o>:call <SID>NetrwLocalRm("'.mapsafecurdir.'")<cr>' -" exe 'inoremap <buffer> <silent> <nowait> R <c-o>:call <SID>NetrwLocalRename("'.mapsafecurdir.'")<cr>' -" exe 'inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("")<cr>' nnoremap <buffer> <F1> :he netrw-quickhelp<cr> " support user-specified maps call netrw#UserMaps(1) - else " remote + else + " remote normal-mode maps {{{3 " call Decho("make remote maps",'~'.expand("<slnum>")) call s:RemotePathAnalysis(b:netrw_curdir) - " remote normal-mode maps - nnoremap <buffer> <silent> <nowait> a :<c-u>call <SID>NetrwHide(0)<cr> - nnoremap <buffer> <silent> <nowait> - :<c-u>call <SID>NetrwBrowseUpDir(0)<cr> - nnoremap <buffer> <silent> <nowait> % :<c-u>call <SID>NetrwOpenFile(0)<cr> - nnoremap <buffer> <silent> <nowait> C :<c-u>call <SID>NetrwSetChgwin()<cr> - nnoremap <buffer> <silent> <nowait> <c-l> :<c-u>call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> - nnoremap <buffer> <silent> <nowait> <cr> :<c-u>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr> - nnoremap <buffer> <silent> <nowait> <c-r> :<c-u>call <SID>NetrwServerEdit(2,<SID>NetrwGetWord())<cr> - nnoremap <buffer> <silent> <nowait> gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <Plug>NetrwHide_a :<c-u>call <SID>NetrwHide(0)<cr> + nnoremap <buffer> <silent> <Plug>NetrwBrowseUpDir :<c-u>call <SID>NetrwBrowseUpDir(0)<cr> + nnoremap <buffer> <silent> <Plug>NetrwOpenFile :<c-u>call <SID>NetrwOpenFile(0)<cr> + nnoremap <buffer> <silent> <Plug>NetrwBadd_cb :<c-u>call <SID>NetrwBadd(0,0)<cr> + nnoremap <buffer> <silent> <Plug>NetrwBadd_cB :<c-u>call <SID>NetrwBadd(0,1)<cr> + nnoremap <buffer> <silent> <Plug>NetrwLcd :<c-u>call <SID>NetrwLcd(b:netrw_curdir)<cr> + nnoremap <buffer> <silent> <Plug>NetrwSetChgwin :<c-u>call <SID>NetrwSetChgwin()<cr> + nnoremap <buffer> <silent> <Plug>NetrwRefresh :<c-u>call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> + nnoremap <buffer> <silent> <Plug>NetrwLocalBrowseCheck :<c-u>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr> + nnoremap <buffer> <silent> <Plug>NetrwServerEdit :<c-u>call <SID>NetrwServerEdit(2,<SID>NetrwGetWord())<cr> + nnoremap <buffer> <silent> <Plug>NetrwBookHistHandler_gb :<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> +" --------------------------------------------------------------------- nnoremap <buffer> <silent> <nowait> gd :<c-u>call <SID>NetrwForceChgDir(0,<SID>NetrwGetWord())<cr> nnoremap <buffer> <silent> <nowait> gf :<c-u>call <SID>NetrwForceFile(0,<SID>NetrwGetWord())<cr> nnoremap <buffer> <silent> <nowait> gh :<c-u>call <SID>NetrwHidden(0)<cr> @@ -6225,69 +6563,15 @@ fun! s:NetrwMaps(islocal) nnoremap <buffer> <silent> <nowait> U :<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr> nnoremap <buffer> <silent> <nowait> v :call <SID>NetrwSplit(2)<cr> nnoremap <buffer> <silent> <nowait> x :<c-u>call netrw#BrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr> -" " remote insert-mode maps -" inoremap <buffer> <silent> <nowait> <cr> <c-o>:call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()))<cr> -" inoremap <buffer> <silent> <nowait> <c-l> <c-o>:call <SID>NetrwRefresh(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> -" inoremap <buffer> <silent> <nowait> <s-cr> <c-o>:call <SID>TreeSqueezeDir(0)<cr> -" inoremap <buffer> <silent> <nowait> - <c-o>:call <SID>NetrwBrowseUpDir(0)<cr> -" inoremap <buffer> <silent> <nowait> a <c-o>:call <SID>NetrwHide(0)<cr> -" inoremap <buffer> <silent> <nowait> mb <c-o>:<c-u>call <SID>NetrwBookHistHandler(0,b:netrw_curdir)<cr> -" inoremap <buffer> <silent> <nowait> mc <c-o>:<c-u>call <SID>NetrwMarkFileCopy(0)<cr> -" inoremap <buffer> <silent> <nowait> md <c-o>:<c-u>call <SID>NetrwMarkFileDiff(0)<cr> -" inoremap <buffer> <silent> <nowait> me <c-o>:<c-u>call <SID>NetrwMarkFileEdit(0)<cr> -" inoremap <buffer> <silent> <nowait> mf <c-o>:<c-u>call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> -" inoremap <buffer> <silent> <nowait> mg <c-o>:<c-u>call <SID>NetrwMarkFileGrep(0)<cr> -" inoremap <buffer> <silent> <nowait> mh <c-o>:<c-u>call <SID>NetrwMarkHideSfx(0)<cr> -" inoremap <buffer> <silent> <nowait> mm <c-o>:<c-u>call <SID>NetrwMarkFileMove(0)<cr> -" inoremap <buffer> <silent> <nowait> mp <c-o>:<c-u>call <SID>NetrwMarkFilePrint(0)<cr> -" inoremap <buffer> <silent> <nowait> mr <c-o>:<c-u>call <SID>NetrwMarkFileRegexp(0)<cr> -" inoremap <buffer> <silent> <nowait> ms <c-o>:<c-u>call <SID>NetrwMarkFileSource(0)<cr> -" inoremap <buffer> <silent> <nowait> mt <c-o>:<c-u>call <SID>NetrwMarkFileTgt(0)<cr> -" inoremap <buffer> <silent> <nowait> mT <c-o>:<c-u>call <SID>NetrwMarkFileTag(0)<cr> -" inoremap <buffer> <silent> <nowait> mu <c-o>:<c-u>call <SID>NetrwUnMarkFile(0)<cr> -" nnoremap <buffer> <silent> <nowait> mv :<c-u>call <SID>NetrwMarkFileVimCmd(1)<cr> -" inoremap <buffer> <silent> <nowait> mx <c-o>:<c-u>call <SID>NetrwMarkFileExe(0,0)<cr> -" inoremap <buffer> <silent> <nowait> mX <c-o>:<c-u>call <SID>NetrwMarkFileExe(0,1)<cr> -" inoremap <buffer> <silent> <nowait> mv <c-o>:<c-u>call <SID>NetrwMarkFileVimCmd(0)<cr> -" inoremap <buffer> <silent> <nowait> mz <c-o>:<c-u>call <SID>NetrwMarkFileCompress(0)<cr> -" inoremap <buffer> <silent> <nowait> gb <c-o>:<c-u>call <SID>NetrwBookHistHandler(1,b:netrw_curdir)<cr> -" inoremap <buffer> <silent> <nowait> gh <c-o>:<c-u>call <SID>NetrwHidden(0)<cr> -" inoremap <buffer> <silent> <nowait> gp <c-o>:<c-u>call <SID>NetrwChgPerm(0,b:netrw_curdir)<cr> -" inoremap <buffer> <silent> <nowait> C <c-o>:call <SID>NetrwSetChgwin()<cr> -" inoremap <buffer> <silent> <nowait> i <c-o>:call <SID>NetrwListStyle(0)<cr> -" inoremap <buffer> <silent> <nowait> I <c-o>:call <SID>NetrwBannerCtrl(1)<cr> -" inoremap <buffer> <silent> <nowait> o <c-o>:call <SID>NetrwSplit(0)<cr> -" inoremap <buffer> <silent> <nowait> O <c-o>:call <SID>NetrwObtain(0)<cr> -" inoremap <buffer> <silent> <nowait> p <c-o>:call <SID>NetrwPreview(<SID>NetrwBrowseChgDir(1,<SID>NetrwGetWord(),1))<cr> -" inoremap <buffer> <silent> <nowait> P <c-o>:call <SID>NetrwPrevWinOpen(0)<cr> -" inoremap <buffer> <silent> <nowait> qb <c-o>:<c-u>call <SID>NetrwBookHistHandler(2,b:netrw_curdir)<cr> -" inoremap <buffer> <silent> <nowait> mB <c-o>:<c-u>call <SID>NetrwBookHistHandler(6,b:netrw_curdir)<cr> -" inoremap <buffer> <silent> <nowait> qf <c-o>:<c-u>call <SID>NetrwFileInfo(0,<SID>NetrwGetWord())<cr> -" inoremap <buffer> <silent> <nowait> qF :<c-u>call <SID>NetrwMarkFileQFEL(0,getqflist())<cr> -" inoremap <buffer> <silent> <nowait> qL :<c-u>call <SID>NetrwMarkFileQFEL(0,getloclist(v:count))<cr> -" inoremap <buffer> <silent> <nowait> r <c-o>:let g:netrw_sort_direction= (g:netrw_sort_direction =~# 'n')? 'r' : 'n'<bar>exe "norm! 0"<bar>call <SID>NetrwBrowse(0,<SID>NetrwBrowseChgDir(0,'./'))<cr> -" inoremap <buffer> <silent> <nowait> s <c-o>:call <SID>NetrwSortStyle(0)<cr> -" inoremap <buffer> <silent> <nowait> S <c-o>:call <SID>NetSortSequence(0)<cr> -" inoremap <buffer> <silent> <nowait> t <c-o>:call <SID>NetrwSplit(1)<cr> -" inoremap <buffer> <silent> <nowait> Tb <c-o>:<c-u>call <SID>NetrwSetTgt('b',v:count1)<cr> -" inoremap <buffer> <silent> <nowait> Th <c-o>:<c-u>call <SID>NetrwSetTgt('h',v:count)<cr> -" inoremap <buffer> <silent> <nowait> u <c-o>:<c-u>call <SID>NetrwBookHistHandler(4,b:netrw_curdir)<cr> -" inoremap <buffer> <silent> <nowait> U <c-o>:<c-u>call <SID>NetrwBookHistHandler(5,b:netrw_curdir)<cr> -" inoremap <buffer> <silent> <nowait> v <c-o>:call <SID>NetrwSplit(2)<cr> -" inoremap <buffer> <silent> <nowait> x <c-o>:call netrw#BrowseX(<SID>NetrwBrowseChgDir(0,<SID>NetrwGetWord()),1)<cr> -" inoremap <buffer> <silent> <nowait> % <c-o>:call <SID>NetrwOpenFile(0)<cr> if !hasmapto('<Plug>NetrwHideEdit') nmap <buffer> <c-h> <Plug>NetrwHideEdit -" imap <buffer> <c-h> <Plug>NetrwHideEdit endif nnoremap <buffer> <silent> <Plug>NetrwHideEdit :call <SID>NetrwHideEdit(0)<cr> if !hasmapto('<Plug>NetrwRefresh') nmap <buffer> <c-l> <Plug>NetrwRefresh -" imap <buffer> <c-l> <Plug>NetrwRefresh endif if !hasmapto('<Plug>NetrwTreeSqueeze') nmap <buffer> <silent> <nowait> <s-cr> <Plug>NetrwTreeSqueeze -" imap <buffer> <silent> <nowait> <s-cr> <c-o><Plug>NetrwTreeSqueeze endif nnoremap <buffer> <silent> <Plug>NetrwTreeSqueeze :call <SID>TreeSqueezeDir(0)<cr> @@ -6309,14 +6593,10 @@ fun! s:NetrwMaps(islocal) nmap <buffer> <2-leftmouse> <Plug>Netrw2Leftmouse nmap <buffer> <silent> <Plug>Netrw2Leftmouse - imap <buffer> <leftmouse> <Plug>ILeftmouse -" ino <buffer> <silent> <Plug>ILeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwLeftmouse(0)<cr> imap <buffer> <middlemouse> <Plug>IMiddlemouse -" ino <buffer> <silent> <Plug>IMiddlemouse <c-o><leftmouse><c-o>:call <SID>NetrwPrevWinOpen(0)<cr> imap <buffer> <s-leftmouse> <Plug>ISLeftmouse -" ino <buffer> <silent> <Plug>ISLeftmouse <c-o><leftmouse><c-o>:call <SID>NetrwMarkFile(0,<SID>NetrwGetWord())<cr> exe 'nnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' exe 'vnoremap <buffer> <silent> <rightmouse> <leftmouse>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' -" exe 'inoremap <buffer> <silent> <rightmouse> <c-o><leftmouse><c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' endif exe 'nnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' exe 'nnoremap <buffer> <silent> <nowait> d :call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>' @@ -6325,16 +6605,11 @@ fun! s:NetrwMaps(islocal) exe 'vnoremap <buffer> <silent> <nowait> <del> :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' exe 'vnoremap <buffer> <silent> <nowait> D :call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' exe 'vnoremap <buffer> <silent> <nowait> R :call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' -" exe 'inoremap <buffer> <silent> <nowait> <del> <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' -" exe 'inoremap <buffer> <silent> <nowait> d <c-o>:call <SID>NetrwMakeDir("'.mapsafeusermach.'")<cr>' -" exe 'inoremap <buffer> <silent> <nowait> D <c-o>:call <SID>NetrwRemoteRm("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' -" exe 'inoremap <buffer> <silent> <nowait> R <c-o>:call <SID>NetrwRemoteRename("'.mapsafeusermach.'","'.mapsafepath.'")<cr>' nnoremap <buffer> <F1> :he netrw-quickhelp<cr> -" inoremap <buffer> <F1> <c-o>:he netrw-quickhelp<cr> " support user-specified maps call netrw#UserMaps(0) - endif + endif " }}}3 " call Dret("s:NetrwMaps") endfun @@ -6531,14 +6806,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("<slnum>")) - if exists("g:did_drchip_netrwlist_syntax") - exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/" + 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("<slnum>")) + if exists("g:did_drchip_netrwlist_syntax") + exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{curbufnr}."/" + endif + else +" " call Decho("2match none",'~'.expand("<slnum>")) + 2match none endif - else -" call Decho("2match none",'~'.expand("<slnum>")) - 2match none endif let @@= ykeep " call Dret("s:NetrwMarkFile : s:netrwmarkfilelist_".curbufnr."<".(exists("s:netrwmarkfilelist_{curbufnr}")? string(s:netrwmarkfilelist_{curbufnr}) : " doesn't exist").">") @@ -6624,18 +6901,15 @@ fun! s:NetrwMarkFileCompress(islocal) if g:netrw_keepdir let fname= s:ShellEscape(s:ComposePath(curdir,fname)) 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) + call system(exe." ".fname) + if v:shell_error + NetrwKeepj call netrw#ErrorMsg(s:WARNING,"unable to apply<".exe."> to file<".fname.">",50) endif else - NetrwKeepj call netrw#ErrorMsg(s:WARNING,"unable to apply<".exe."> to file<".fname.">",50) + let fname= s:ShellEscape(b:netrw_curdir.fname,1) + NetrwKeepj call s:RemoteSystem(exe." ".fname) endif + endif unlet sfx @@ -6644,6 +6918,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 +6972,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("<slnum>")) - 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,10 +7054,10 @@ fun! s:NetrwMarkFileCopy(islocal,...) " call Decho("tgt <".tgt.">",'~'.expand("<slnum>")) " call Decho("copycmd<".copycmd.">",'~'.expand("<slnum>")) " call Decho("system(".copycmd." '".args."' '".tgt."')",'~'.expand("<slnum>")) - 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) + 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-cd)",101) else call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localcopycmd<".g:netrw_localcopycmd.">; it doesn't work!",80) endif @@ -6809,7 +7086,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 +7094,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 +7105,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 +7122,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 +7652,15 @@ fun! s:NetrwMarkFileMove(islocal) " move: local -> local " call Decho("move from local to local",'~'.expand("<slnum>")) " call Decho("local to local move",'~'.expand("<slnum>")) - 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("<slnum>")) 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("<slnum>")) if g:netrw_localmovecmd =~ '\s' let movecmd = substitute(g:netrw_localmovecmd,'\s.*$','','') @@ -7394,10 +7680,10 @@ fun! s:NetrwMarkFileMove(islocal) let fname= substitute(fname,'/','\\','g') endif " call Decho("system(".movecmd." ".s:ShellEscape(fname)." ".tgt.")",'~'.expand("<slnum>")) - 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) + 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-cd)",100) else call netrw#ErrorMsg(s:ERROR,"tried using g:netrw_localmovecmd<".g:netrw_localmovecmd.">; it doesn't work!",54) endif @@ -7524,21 +7810,27 @@ fun! s:NetrwMarkFileRegexp(islocal) if a:islocal let curdir= s:NetrwGetCurdir(a:islocal) +" call Decho("curdir<".fnameescape(curdir).">") " get the matching list of files using local glob() " call Decho("handle local regexp",'~'.expand("<slnum>")) let dirname = escape(b:netrw_curdir,g:netrw_glob_escape) if v:version > 704 || (v:version == 704 && has("patch656")) - let files = glob(s:ComposePath(dirname,regexp),0,0,1) + let filelist= glob(s:ComposePath(dirname,regexp),0,1,1) else let files = glob(s:ComposePath(dirname,regexp),0,0) + let filelist= split(files,"\n") endif -" call Decho("files<".files.">",'~'.expand("<slnum>")) - let filelist= split(files,"\n") +" call Decho("files<".string(filelist).">",'~'.expand("<slnum>")) " mark the list of files for fname in filelist -" call Decho("fname<".fname.">",'~'.expand("<slnum>")) - NetrwKeepj call s:NetrwMarkFile(a:islocal,substitute(fname,'^.*/','','')) + if fname =~ '^'.fnameescape(curdir) +" call Decho("fname<".substitute(fname,'^'.fnameescape(curdir).'/','','').">",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwMarkFile(a:islocal,substitute(fname,'^'.fnameescape(curdir).'/','','')) + else +" call Decho("fname<".fname.">",'~'.expand("<slnum>")) + NetrwKeepj call s:NetrwMarkFile(a:islocal,substitute(fname,'^.*/','','')) + endif endfor else @@ -7552,7 +7844,7 @@ fun! s:NetrwMarkFileRegexp(islocal) " call Decho("setl ei=all ma",'~'.expand("<slnum>")) 1split NetrwKeepj call s:NetrwEnew() - NetrwKeepj call s:NetrwSafeOptions() + NetrwKeepj call s:NetrwOptionsSafe(a:islocal) sil NetrwKeepj norm! "ap NetrwKeepj 2 let bannercnt= search('^" =====','W') @@ -7649,12 +7941,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("<slnum>")) - call system(g:netrw_ctags." ".netrwmarkfilelist) - else + +" call Decho("call system(".g:netrw_ctags." ".netrwmarkfilelist.")",'~'.expand("<slnum>")) + 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 +8402,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("<cWORD>")) + call netrw#Obtain(a:islocal,s:NetrwGetWord()) endif let @@= ykeep @@ -8144,14 +8437,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("<slnum>")) + " 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("<slnum>")) 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("<slnum>")) exe (g:netrw_alto? "bel " : "abo ").winsz."wincmd s" endif @@ -8189,7 +8484,7 @@ fun! s:NetrwPrevWinOpen(islocal) " only one copy of the modified buffer in a window, and " hidden not set, so overwriting will lose the modified file. Ask first... let choice = confirm("Save modified buffer<".prevbufname."> first?","&Yes\n&No\n&Cancel") -" call Decho("(NetrwPrevWinOpen) prevbufname<".prevbufname."> choice=".choice." current-winnr#".winnr(),'~'.expand("<slnum>")) +" call Decho("prevbufname<".prevbufname."> choice=".choice." current-winnr#".winnr(),'~'.expand("<slnum>")) let &ei= eikeep if choice == 1 @@ -8283,7 +8578,10 @@ fun! s:NetrwUpload(fname,tgt,...) " call Decho("handle uploading a list of files via scp",'~'.expand("<slnum>")) 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 +8592,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 +8709,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 @@ -8420,20 +8721,49 @@ fun! s:NetrwUpload(fname,tgt,...) endfun " --------------------------------------------------------------------- -" s:NetrwPreview: {{{2 +" s:NetrwPreview: supports netrw's "p" map {{{2 fun! s:NetrwPreview(path) range " call Dfunc("NetrwPreview(path<".a:path.">)") +" call Decho("g:netrw_alto =".(exists("g:netrw_alto")? g:netrw_alto : 'n/a'),'~'.expand("<slnum>")) +" call Decho("g:netrw_preview=".(exists("g:netrw_preview")? g:netrw_preview : 'n/a'),'~'.expand("<slnum>")) let ykeep= @@ - NetrwKeepj call s:NetrwOptionSave("s:") - NetrwKeepj call s:NetrwSafeOptions() + NetrwKeepj call s:NetrwOptionsSave("s:") + if a:path !~ '^\*\{1,2}/' && a:path !~ '^\a\{3,}://' + NetrwKeepj call s:NetrwOptionsSafe(1) + else + NetrwKeepj call s:NetrwOptionsSafe(0) + endif if has("quickfix") +" call Decho("has quickfix",'~'.expand("<slnum>")) if !isdirectory(s:NetrwFile(a:path)) - if g:netrw_preview && !g:netrw_alto +" call Decho("good; not previewing a directory",'~'.expand("<slnum>")) + if g:netrw_preview + " vertical split let pvhkeep = &pvh let winsz = (g:netrw_winsize > 0)? (g:netrw_winsize*winwidth(0))/100 : -g:netrw_winsize let &pvh = winwidth(0) - winsz - endif +" call Decho("g:netrw_preview: winsz=".winsz." &pvh=".&pvh." (temporarily) g:netrw_winsize=".g:netrw_winsize,'~'.expand("<slnum>")) + else + " horizontal split + let pvhkeep = &pvh + let winsz = (g:netrw_winsize > 0)? (g:netrw_winsize*winheight(0))/100 : -g:netrw_winsize + let &pvh = winheight(0) - winsz +" call Decho("!g:netrw_preview: winsz=".winsz." &pvh=".&pvh." (temporarily) g:netrw_winsize=".g:netrw_winsize,'~'.expand("<slnum>")) + endif + " g:netrw_preview g:netrw_alto + " 1 : vert 1: top -- preview window is vertically split off and on the left + " 1 : vert 0: bot -- preview window is vertically split off and on the right + " 0 : 1: top -- preview window is horizontally split off and on the top + " 0 : 0: bot -- preview window is horizontally split off and on the bottom + " + " Note that the file being previewed is already known to not be a directory, hence we can avoid doing a LocalBrowse() check via + " the BufEnter event set up in netrwPlugin.vim +" call Decho("exe ".(g:netrw_alto? "top " : "bot ").(g:netrw_preview? "vert " : "")."pedit ".fnameescape(a:path),'~'.expand("<slnum>")) + let eikeep = &ei + set ei=BufEnter exe (g:netrw_alto? "top " : "bot ").(g:netrw_preview? "vert " : "")."pedit ".fnameescape(a:path) + let &ei= eikeep +" call Decho("winnr($)=".winnr("$"),'~'.expand("<slnum>")) if exists("pvhkeep") let &pvh= pvhkeep endif @@ -8443,7 +8773,7 @@ fun! s:NetrwPreview(path) range elseif !exists("g:netrw_quiet") NetrwKeepj call netrw#ErrorMsg(s:WARNING,"sorry, to preview your vim needs the quickfix feature compiled in",39) endif - NetrwKeepj call s:NetrwOptionRestore("s:") + NetrwKeepj call s:NetrwOptionsRestore("s:") let @@= ykeep " call Dret("NetrwPreview") endfun @@ -8451,12 +8781,22 @@ endfun " --------------------------------------------------------------------- " s:NetrwRefresh: {{{2 fun! s:NetrwRefresh(islocal,dirname) -" call Dfunc("s:NetrwRefresh(islocal<".a:islocal.">,dirname=".a:dirname.") hide=".g:netrw_hide." sortdir=".g:netrw_sort_direction) +" call Dfunc("s:NetrwRefresh(islocal<".a:islocal.">,dirname=".a:dirname.") g:netrw_hide=".g:netrw_hide." g:netrw_sort_direction=".g:netrw_sort_direction) " at the current time (Mar 19, 2007) all calls to NetrwRefresh() call NetrwBrowseChgDir() first. setl ma noro " call Decho("setl ma noro",'~'.expand("<slnum>")) " call Decho("clear buffer<".expand("%")."> with :%d",'~'.expand("<slnum>")) 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 +8816,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("<slnum>")) - exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" - else -" call Decho("2match none (bufnr(%)=".bufnr("%")."<".bufname("%").">)",'~'.expand("<slnum>")) - 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("<slnum>")) + exe "2match netrwMarkFile /".s:netrwmarkfilemtch_{bufnr("%")}."/" + else +" " call Decho("2match none (bufnr(%)=".bufnr("%")."<".bufname("%").">)",'~'.expand("<slnum>")) + 2match none + endif + endif " restore let @@= ykeep @@ -8657,7 +8999,7 @@ fun! s:NetrwSetTgt(islocal,bookhist,choice) endfun " ===================================================================== -" s:NetrwSortStyle: change sorting style (name - time - size) and refresh display {{{2 +" s:NetrwSortStyle: change sorting style (name - time - size - exten) and refresh display {{{2 fun! s:NetrwSortStyle(islocal) " call Dfunc("s:NetrwSortStyle(islocal=".a:islocal.") netrw_sort_by<".g:netrw_sort_by.">") NetrwKeepj call s:NetrwSaveWordPosn() @@ -8821,7 +9163,7 @@ fun! s:NetrwTgtMenu() " call Decho("installing history as easy targets (histmax=".g:netrw_dirhistmax.")",'~'.expand("<slnum>")) let histcnt = 1 while histcnt <= g:netrw_dirhistmax - let priority = g:netrw_dirhist_cnt + histcnt + let priority = g:netrw_dirhistcnt + histcnt if exists("g:netrw_dirhist_{histcnt}") let histentry = g:netrw_dirhist_{histcnt} if has_key(tgtdict,histentry) @@ -8958,6 +9300,36 @@ fun! s:NetrwTreeDisplay(dir,depth) let depth= s:treedepthstring.a:depth " call Decho("display subtrees with depth<".depth."> and current leaves",'~'.expand("<slnum>")) + " 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("<slnum>")) for entry in w:netrw_treedict[dir] if dir =~ '/$' @@ -8980,6 +9352,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 +9361,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("<slnum>")) @@ -9016,7 +9394,7 @@ fun! s:NetrwRefreshTreeDict(dir) " call Decho("updating w:netrw_treedict[".direntry.']='.string(w:netrw_treedict[direntry]),'~'.expand("<slnum>")) else -" call Decho('not updating w:netrw_treedict['.direntry.'] with entry<'.entry.'> (no subtree)',,'~'.expand("<slnum>")) +" call Decho('not updating w:netrw_treedict['.string(direntry).'] with entry<'.string(entry).'> (no subtree)','~'.expand("<slnum>")) endif endfor " call Dret("s:NetrwRefreshTreeDict") @@ -9083,12 +9461,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("<slnum>")) let depth = substitute(getline('.'),'^\(\%('.s:treedepthstring.'\)*\)[^'.s:treedepthstring.'].\{-}$','\1','e') @@ -9119,12 +9506,15 @@ fun! s:NetrwTreePath(treetop) let depth = substitute(depth,'^'.s:treedepthstring,'','') " call Decho("constructing treedir<".treedir.">: dirname<".dirname."> while depth<".depth.">",'~'.expand("<slnum>")) endwhile +" call Decho("treedir#1<".treedir.">",'~'.expand("<slnum>")) if a:treetop =~ '/$' let treedir= a:treetop.treedir else let treedir= a:treetop.'/'.treedir endif +" call Decho("treedir#2<".treedir.">",'~'.expand("<slnum>")) let treedir= substitute(treedir,'//$','/','') +" call Decho("treedir#3<".treedir.">",'~'.expand("<slnum>")) " call Decho("restoring posn to svpos<".string(svpos).">",'~'.expand("<slnum>"))" call winrestview(svpos) " call Dret("s:NetrwTreePath <".treedir.">") @@ -9195,7 +9585,7 @@ fun! s:NetrwWideListing() exe 'nno <buffer> <silent> b :call search(''^.\\|\s\s\zs\S'',''bW'')'."\<cr>" " call Decho("NetrwWideListing) setl noma nomod ro",'~'.expand("<slnum>")) exe "setl ".g:netrw_bufsettings -" call Decho("(NetrwWideListing) ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) +" call Decho("ro=".&l:ro." ma=".&l:ma." mod=".&l:mod." wrap=".&l:wrap." (filename<".expand("%")."> win#".winnr()." ft<".&ft.">)",'~'.expand("<slnum>")) " call Dret("NetrwWideListing") return else @@ -9214,18 +9604,20 @@ 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("<slnum>")) -" 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("<slnum>")) +" 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("<slnum>")) + sil! NetrwKeepj %d _ +" call DechoBuf(bufnr("%")) " set up syntax highlighting {{{3 " call Decho("--set up syntax highlighting (ie. setl ft=netrw)",'~'.expand("<slnum>")) sil! setl ft=netrw - NetrwKeepj call s:NetrwSafeOptions() + NetrwKeepj call s:NetrwOptionsSafe(a:islocal) setl noro ma " call Decho("setl noro ma bh=".&bh,'~'.expand("<slnum>")) " if exists("g:netrw_silent") && g:netrw_silent == 0 && &ch >= 1 " Decho -" call Decho("(netrw) Processing your browsing request...",'~'.expand("<slnum>")) +" call Decho("Processing your browsing request...",'~'.expand("<slnum>")) " endif " Decho " call Decho('w:netrw_liststyle='.(exists("w:netrw_liststyle")? w:netrw_liststyle : 'n/a'),'~'.expand("<slnum>")) @@ -9269,6 +9661,7 @@ fun! s:PerformListing(islocal) " call Decho("w:netrw_bannercnt=".w:netrw_bannercnt." win#".winnr(),'~'.expand("<slnum>")) " call Decho("tab#".tabpagenr()." win#".winnr()." buf#".bufnr("%")."<".bufname("%")."> line#".line(".")." col#".col(".")." winline#".winline()." wincol#".wincol()." line($)=".line("$"),'~'.expand("<slnum>")) + " construct sortby string: [name|time|size|exten] [reversed] let sortby= g:netrw_sort_by if g:netrw_sort_direction =~# "^r" let sortby= sortby." reversed" @@ -9279,13 +9672,13 @@ fun! s:PerformListing(islocal) " call Decho("--handle specified sorting: g:netrw_sort_by<".g:netrw_sort_by.">",'~'.expand("<slnum>")) if g:netrw_sort_by =~# "^n" " call Decho("directories will be sorted by name",'~'.expand("<slnum>")) - " sorted by name + " sorted by name (also includes the sorting sequence in the banner) NetrwKeepj put ='\" Sorted by '.sortby NetrwKeepj put ='\" Sort sequence: '.g:netrw_sort_sequence let w:netrw_bannercnt= w:netrw_bannercnt + 2 else " call Decho("directories will be sorted by size or time",'~'.expand("<slnum>")) - " sorted by size or date + " sorted by time, size, exten NetrwKeepj put ='\" Sorted by '.sortby let w:netrw_bannercnt= w:netrw_bannercnt + 1 endif @@ -9294,7 +9687,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("<slnum>")) 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("<slnum>")) @@ -9313,7 +9706,7 @@ fun! s:PerformListing(islocal) " Hiding... -or- Showing... {{{3 if g:netrw_banner -" call Decho("--handle hiding/showing (g:netrw_hide=".g:netrw_list_hide." g:netrw_list_hide<".g:netrw_list_hide.">)",'~'.expand("<slnum>")) +" call Decho("--handle hiding/showing (g:netrw_hide=".g:netrw_hide." g:netrw_list_hide<".g:netrw_list_hide.">)",'~'.expand("<slnum>")) if g:netrw_list_hide != "" && g:netrw_hide if g:netrw_hide == 1 NetrwKeepj put ='\" Hiding: '.g:netrw_list_hide @@ -9376,12 +9769,13 @@ fun! s:PerformListing(islocal) if g:netrw_sort_by =~# "^n" " sort by name +" call Decho("sort by name",'~'.expand("<slnum>")) NetrwKeepj call s:NetrwSetSort() if !g:netrw_banner || w:netrw_bannercnt < line("$") " call Decho("g:netrw_sort_direction=".g:netrw_sort_direction." (bannercnt=".w:netrw_bannercnt.")",'~'.expand("<slnum>")) if g:netrw_sort_direction =~# 'n' - " normal direction sorting + " name: sort by name of file exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$sort'.' '.g:netrw_sort_options else " reverse direction sorting @@ -9394,7 +9788,9 @@ fun! s:PerformListing(islocal) NetrwKeepj call histdel("/",-1) elseif g:netrw_sort_by =~# "^ext" - " sort by extension + " exten: sort by extension + " The histdel(...,-1) calls remove the last search from the search history +" call Decho("sort by extension",'~'.expand("<slnum>")) exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$g+/+s/^/001'.g:netrw_sepchr.'/' NetrwKeepj call histdel("/",-1) exe 'sil NetrwKeepj '.w:netrw_bannercnt.',$v+[./]+s/^/002'.g:netrw_sepchr.'/' @@ -9450,7 +9846,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("<slnum>")) - g/@$/call s:ShowLink() + sil! g/@$/call s:ShowLink() endif if exists("w:netrw_bannercnt") && (line("$") >= w:netrw_bannercnt || !g:netrw_banner) @@ -9475,7 +9871,7 @@ fun! s:PerformListing(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. " (internal#4)",'~'.expand("<slnum>")) NetrwKeepj call s:SetBufWinVars() " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#5)",'~'.expand("<slnum>")) - NetrwKeepj call s:NetrwOptionRestore("w:") + NetrwKeepj call s:NetrwOptionsRestore("w:") " call Decho("settings buf#".bufnr("%")."<".bufname("%").">: ".((&l:ma == 0)? "no" : "")."ma ".((&l:mod == 0)? "no" : "")."mod ".((&l:bl == 0)? "no" : "")."bl ".((&l:ro == 0)? "no" : "")."ro fo=".&l:fo. " (internal#6)",'~'.expand("<slnum>")) " set display to netrw display settings @@ -9486,6 +9882,7 @@ fun! s:PerformListing(islocal) " call Decho("exe setl ts=".(g:netrw_maxfilenamelen+1),'~'.expand("<slnum>")) exe "setl ts=".(g:netrw_maxfilenamelen+1) endif +" call DechoBuf(bufnr("%")) if exists("s:treecurpos") " call Decho("s:treecurpos exists; restore posn",'~'.expand("<slnum>")) @@ -9543,9 +9940,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 @@ -9714,7 +10111,7 @@ fun! s:NetrwRemoteListing() if !exists("g:netrw_quiet") call netrw#ErrorMsg(s:ERROR,"this system doesn't support remote directory listing via ftp",18) endif - call s:NetrwOptionRestore("w:") + call s:NetrwOptionsRestore("w:") " call Dret("s:NetrwRemoteListing -1") return -1 endif @@ -9729,7 +10126,7 @@ fun! s:NetrwRemoteListing() endif endif - NetrwKeepj call s:NetrwOptionRestore("w:") + NetrwKeepj call s:NetrwOptionsRestore("w:") " call Dret("s:NetrwRemoteListing -1") return -1 endif " (remote handling sanity check) @@ -9762,7 +10159,7 @@ fun! s:NetrwRemoteListing() exe w:netrw_bannercnt.",$d _" setl noma endif - NetrwKeepj call s:NetrwOptionRestore("w:") + NetrwKeepj call s:NetrwOptionsRestore("w:") call netrw#ErrorMsg(s:WARNING,mesg,96) " call Dret("s:NetrwRemoteListing : -1") return -1 @@ -10005,7 +10402,7 @@ fun! s:NetrwRemoteRmFile(path,rmfile,all) let ret= system(netrw_rm_cmd) if v:shell_error != 0 if exists("b:netrw_curdir") && b:netrw_curdir != getcwd() && !g:netrw_keepdir - call netrw#ErrorMsg(s:ERROR,"remove failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-c)",102) + call netrw#ErrorMsg(s:ERROR,"remove failed; perhaps due to vim's current directory<".getcwd()."> not matching netrw's (".b:netrw_curdir.") (see :help netrw-cd)",102) else call netrw#ErrorMsg(s:WARNING,"cmd<".netrw_rm_cmd."> failed",60) endif @@ -10146,12 +10543,12 @@ fun! s:NetrwRemoteRename(usrhost,path) range " 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 +10558,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("<slnum>")) @@ -10186,35 +10583,36 @@ fun! netrw#FileUrlRead(fname) let plainfname= substitute(plainfname,'^/\+\(\a:\)','\1','') endif endif + " call Decho("fname2396<".fname2396.">",'~'.expand("<slnum>")) " call Decho("plainfname<".plainfname.">",'~'.expand("<slnum>")) exe "sil doau BufReadPre ".fname2396e - exe 'NetrwKeepj r '.plainfname - exe 'sil! bdelete '.plainfname - exe 'keepalt file! '.plainfname - NetrwKeepj 1d -" call Decho("setl nomod",'~'.expand("<slnum>")) - 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("<slnum>")) -" call Dret("netrw#FileUrlRead") +" call Dret("netrw#FileUrlEdit") exe "sil doau BufReadPost ".fname2396e endfun " --------------------------------------------------------------------- " netrw#LocalBrowseCheck: {{{2 fun! netrw#LocalBrowseCheck(dirname) - " This function is called by netrwPlugin.vim's s:LocalBrowse(), s:NetrwRexplore(), and by <cr> when atop listed file/directory - " unfortunate interaction -- split window debugging can't be - " used here, must use D-echoRemOn or D-echoTabOn -- the BufEnter - " event triggers another call to LocalBrowseCheck() when attempts - " to write to the DBG buffer are made. + " This function is called by netrwPlugin.vim's s:LocalBrowse(), s:NetrwRexplore(), + " and by <cr> when atop a listed file/directory (via a buffer-local map) + " + " unfortunate interaction -- split window debugging can't be used here, must use + " D-echoRemOn or D-echoTabOn as the BufEnter event triggers + " another call to LocalBrowseCheck() when attempts to write + " to the DBG buffer are made. + " " The &ft == "netrw" test was installed because the BufEnter event " would hit when re-entering netrw windows, creating unexpected " refreshes (and would do so in the middle of NetrwSaveOptions(), too) -" call Dfunc("netrw#LocalBrowseCheck(dirname<".a:dirname.">") +" call Dfunc("netrw#LocalBrowseCheck(dirname<".a:dirname.">)") " call Decho("isdir<".a:dirname."> =".isdirectory(s:NetrwFile(a:dirname)).((exists("s:treeforceredraw")? " treeforceredraw" : "")).'~'.expand("<slnum>")) " 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("<slnum>")) -" 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("<slnum>")) " call Decho("current buffer#".bufnr("%")."<".bufname("%")."> ft=".&ft,'~'.expand("<slnum>")) @@ -10241,7 +10639,7 @@ fun! netrw#LocalBrowseCheck(dirname) return endif - " following code wipes out currently unused netrw buffers + " The following code wipes out currently unused netrw buffers " IF g:netrw_fastbrowse is zero (ie. slow browsing selected) " AND IF the listing style is not a tree listing if exists("g:netrw_fastbrowse") && g:netrw_fastbrowse == 0 && g:netrw_liststyle != s:TREELIST @@ -10293,19 +10691,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("<slnum>")) " call Decho("s:netrw_browselist<".(exists("s:netrw_browselist")? string(s:netrw_browselist) : "").">",'~'.expand("<slnum>")) " 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("<slnum>")) 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("<slnum>")) exe "sil! keepj bd ".fnameescape(ibuf) call remove(s:netrw_browselist,ibl) @@ -10329,8 +10729,8 @@ fun! s:LocalBrowseRefresh() let ibl= ibl + 1 " call Decho("bottom of s:netrw_browselist for loop: ibl=".ibl,'~'.expand("<slnum>")) endfor -" call Decho("restore window: exe ".curwin."wincmd w",'~'.expand("<slnum>")) - exe curwin."wincmd w" +" call Decho("restore window: win_gotoid(".curwinid.")") + call win_gotoid(curwinid) let @@= ykeep " call Dret("s:LocalBrowseRefresh") @@ -10355,10 +10755,10 @@ endfun " If :Explore used: it sets s:netrw_events to 2, so no FocusGained events are ignored. " =2: autocmds installed (doesn't ignore any FocusGained events) fun! s:LocalFastBrowser() -" call Dfunc("LocalFastBrowser() g:netrw_fastbrowse=".g:netrw_fastbrowse) -" call Decho("s:netrw_events ".(exists("s:netrw_events")? "exists" : 'n/a'),'~'.expand("<slnum>")) -" call Decho("autocmd: ShellCmdPost ".(exists("#ShellCmdPost")? "installed" : "not installed"),'~'.expand("<slnum>")) -" call Decho("autocmd: FocusGained ".(exists("#FocusGained")? "installed" : "not installed"),'~'.expand("<slnum>")) +" call Dfunc("s:LocalFastBrowser() g:netrw_fastbrowse=".g:netrw_fastbrowse) +" call Decho("s:netrw_events ".(exists("s:netrw_events")? "exists" : 'n/a'),'~'.expand("<slnum>")) +" call Decho("autocmd: ShellCmdPost ".(exists("#ShellCmdPost")? "already installed" : "not installed"),'~'.expand("<slnum>")) +" call Decho("autocmd: FocusGained ".(exists("#FocusGained")? "already installed" : "not installed"),'~'.expand("<slnum>")) " initialize browselist, a list of buffer numbers that the local browser has used if !exists("s:netrw_browselist") @@ -10403,7 +10803,7 @@ fun! s:LocalFastBrowser() augroup! AuNetrwEvent endif -" call Dret("LocalFastBrowser : browselist<".string(s:netrw_browselist).">") +" call Dret("s:LocalFastBrowser : browselist<".string(s:netrw_browselist).">") endfun " --------------------------------------------------------------------- @@ -10449,6 +10849,7 @@ fun! s:LocalListing() for filename in filelist " call Decho(" ",'~'.expand("<slnum>")) " call Decho("for filename in filelist: filename<".filename.">",'~'.expand("<slnum>")) +" call DechoBuf(bufnr("%"),"COMBAK#1") if getftype(filename) == "link" " indicate a symbolic link @@ -10509,8 +10910,9 @@ fun! s:LocalListing() if g:netrw_sizestyle =~# "[hH]" let sz= s:NetrwHumanReadable(sz) endif - let fsz = strpart(" ",1,15-strlen(sz)).sz - let pfile= pfile."\t".fsz." ".strftime(g:netrw_timefmt,getftime(filename)) + let fsz = strpart(" ",1,15-strlen(sz)).sz + let longfile= printf("%-".(g:netrw_maxfilenamelen+1)."s",pfile) + let pfile = longfile.fsz." ".strftime(g:netrw_timefmt,getftime(filename)) " call Decho("longlist support: sz=".sz." fsz=".fsz,'~'.expand("<slnum>")) endif @@ -10540,6 +10942,7 @@ fun! s:LocalListing() " call Decho("exe NetrwKeepj put ='".pfile."'",'~'.expand("<slnum>")) sil! NetrwKeepj put=pfile endif +" call DechoBuf(bufnr("%"),"COMBAK#2") endfor " cleanup any windows mess at end-of-line @@ -10786,7 +11189,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("<slnum>")) call system(netrw#WinPath(g:netrw_localrmdir).' '.s:ShellEscape(rmfile)) " " call Decho("v:shell_error=".v:shell_error,'~'.expand("<slnum>")) @@ -10822,21 +11225,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 +11241,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 " --------------------------------------------------------------------- @@ -10922,7 +11309,7 @@ endfun " or it may return a List of strings. " " Each keymap-sequence will be set up with a nnoremap -" to invoke netrw#UserMaps(islocal). +" to invoke netrw#UserMaps(a:islocal). " Related functions: " netrw#Expose(varname) -- see s:varname variables " netrw#Modify(varname,newvalue) -- modify value of s:varname variable @@ -10970,6 +11357,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("<slnum>")) + 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 +11399,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("<slnum>")) 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("<slnum>")) if a:base =~ '[/\\]$' let ret= a:base.a:subdir @@ -11329,7 +11746,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("<slnum>")) " grab a function-local-variable copy of buffer variables @@ -11351,7 +11768,7 @@ fun! s:NetrwEnew(...) if exists("b:netrw_option") |let netrw_option = b:netrw_option |endif if exists("b:netrw_prvdir") |let netrw_prvdir = b:netrw_prvdir |endif - NetrwKeepj call s:NetrwOptionRestore("w:") + NetrwKeepj call s:NetrwOptionsRestore("w:") " call Decho("generate a buffer with NetrwKeepj keepalt enew!",'~'.expand("<slnum>")) " when tree listing uses file TreeListing... a new buffer is made. " Want the old buffer to be unlisted. @@ -11361,7 +11778,7 @@ fun! s:NetrwEnew(...) noswapfile NetrwKeepj keepalt enew! let &l:diff= netrw_keepdiff " call Decho("bufnr($)=".bufnr("$")."<".bufname(bufnr("$"))."> winnr($)=".winnr("$"),'~'.expand("<slnum>")) - NetrwKeepj call s:NetrwOptionSave("w:") + NetrwKeepj call s:NetrwOptionsSave("w:") " copy function-local-variables to buffer variable equivalents " call Decho("copy function-local variables back to buffer netrw variables",'~'.expand("<slnum>")) @@ -11392,7 +11809,7 @@ fun! s:NetrwEnew(...) nno <silent> <buffer> [ :sil call <SID>TreeListMove('[')<cr> nno <silent> <buffer> ] :sil call <SID>TreeListMove(']')<cr> else - exe "sil! keepalt file ".fnameescape(b:netrw_curdir) + call s:NetrwBufRename(b:netrw_curdir) endif endif endif @@ -11403,17 +11820,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("<slnum>")) 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("<slnum>")) exe a:cmd endif -" call Dret("s:NetrwExe") +" call Dret("s:NetrwExe : v:shell_error=".v:shell_error) endfun " --------------------------------------------------------------------- @@ -11446,9 +11865,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,21 +11886,26 @@ 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 else - call s:NetrwOptionRestore("w:") + call s:NetrwOptionsRestore("w:") " call Decho("setl noma nomod nowrap",'~'.expand("<slnum>")) 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("<slnum>")) let a:newdir= dirname -" call Dret("s:NetrwBrowse : reusing buffer#".(exists("bufnum")? bufnum : 'N/A')."<".dirname."> getcwd<".getcwd().">") - return endif - endtry +" call Dret("s:NetrwBrowse -1 : reusing buffer#".(exists("bufnum")? bufnum : 'N/A')."<".dirname."> getcwd<".getcwd().">") + return -1 + endif -" call Dret("s:NetrwLcd") +" call Dret("s:NetrwLcd 0") + return 0 endfun " ------------------------------------------------------------------------ @@ -11646,7 +12073,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 +12129,10 @@ fun! s:NetrwRexplore(islocal,dirname) " call Decho("s:rexposn_".bufnr('%')."<".bufname("%")."> doesn't exist",'~'.expand("<slnum>")) 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("<slnum>")) @@ -11731,8 +12160,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("<slnum>")) + 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 +12175,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("<slnum>")) + 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("<slnum>")) + 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 +12474,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 index 4639909ee8..327db6a540 100644 --- 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 <drchipNOSPAM at campbellfamily dot biz> -" 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/compiler/cs.vim b/runtime/compiler/cs.vim index 4cc1784678..4f6dd3cdfd 100644 --- a/runtime/compiler/cs.vim +++ b/runtime/compiler/cs.vim @@ -1,8 +1,8 @@ " Vim compiler file -" Compiler: Microsoft Visual Studio C# -" Maintainer: Zhou YiChao (broken.zhou@gmail.com) -" Previous Maintainer: Joseph H. Yao (hyao@sina.com) -" Last Change: 2012 Apr 30 +" Compiler: Microsoft Visual Studio C# +" Maintainer: Yichao Zhou (broken.zhou@gmail.com) +" Previous Maintainer: Joseph H. Yao (hyao@sina.com) +" Last Change: Jul 22, 2019 if exists("current_compiler") finish @@ -20,7 +20,7 @@ CompilerSet errorformat+=%f(%l\\,%v):\ %t%*[^:]:\ %m, \%trror%*[^:]:\ %m, \%tarning%*[^:]:\ %m -CompilerSet makeprg=csc\ % +CompilerSet makeprg=csc\ %:S let &cpo = s:keepcpo unlet s:keepcpo diff --git a/runtime/compiler/erlang.vim b/runtime/compiler/erlang.vim index e177a279c5..e22887e05e 100644 --- a/runtime/compiler/erlang.vim +++ b/runtime/compiler/erlang.vim @@ -1,13 +1,13 @@ " Vim compiler file " Compiler: Erlang " Maintainer: Dmitry Vasiliev <dima at hlabs dot org> -" Last Change: 2012-02-13 +" Last Change: 2019 Jul 23 if exists("current_compiler") finish endif let current_compiler = "erlang" -CompilerSet makeprg=erlc\ -Wall\ % +CompilerSet makeprg=erlc\ -Wall\ %:S CompilerSet errorformat=%f:%l:\ %m diff --git a/runtime/compiler/fortran_cv.vim b/runtime/compiler/fortran_cv.vim index 089d3b27c2..bc217bdc66 100644 --- a/runtime/compiler/fortran_cv.vim +++ b/runtime/compiler/fortran_cv.vim @@ -22,7 +22,7 @@ CompilerSet errorformat= \%-Z%p%^%.%#, \%-G%.%#, " Compiler call -CompilerSet makeprg=df\ /nologo\ /noobj\ /c\ % +CompilerSet makeprg=df\ /nologo\ /noobj\ /c\ %:S " Visual fortran defaults to printing output on stderr " Adjust option shellpipe accordingly diff --git a/runtime/compiler/gcc.vim b/runtime/compiler/gcc.vim index 1af568de57..30e5149f9f 100644 --- a/runtime/compiler/gcc.vim +++ b/runtime/compiler/gcc.vim @@ -2,6 +2,8 @@ " Compiler: GNU C Compiler " Previous Maintainer: Nikolai Weibull <now@bitwi.se> " Latest Revision: 2010-10-14 +" changed pattern for entering/leaving directories +" by Daniel Hahler, 2019 Jul 12 " added line suggested by Anton Lindqvist 2016 Mar 31 if exists("current_compiler") @@ -27,10 +29,10 @@ CompilerSet errorformat= \%f:%l:\ %m, \%f:\\(%*[^\\)]\\):\ %m, \\"%f\"\\,\ line\ %l%*\\D%c%*[^\ ]\ %m, - \%D%*\\a[%*\\d]:\ Entering\ directory\ [`']%f', - \%X%*\\a[%*\\d]:\ Leaving\ directory\ [`']%f', - \%D%*\\a:\ Entering\ directory\ [`']%f', - \%X%*\\a:\ Leaving\ directory\ [`']%f', + \%D%*\\a[%*\\d]:\ Entering\ directory\ %*[`']%f', + \%X%*\\a[%*\\d]:\ Leaving\ directory\ %*[`']%f', + \%D%*\\a:\ Entering\ directory\ %*[`']%f', + \%X%*\\a:\ Leaving\ directory\ %*[`']%f', \%DMaking\ %*\\a\ in\ %f if exists('g:compiler_gcc_ignore_unmatched_lines') diff --git a/runtime/compiler/jikes.vim b/runtime/compiler/jikes.vim index 5125128535..2d4500e894 100644 --- a/runtime/compiler/jikes.vim +++ b/runtime/compiler/jikes.vim @@ -1,7 +1,7 @@ " Vim Compiler File " Compiler: Jikes " Maintainer: Dan Sharp <dwsharp at hotmail dot com> -" Last Change: 20 Jan 2009 +" Last Change: 2019 Jul 23 " URL: http://dwsharp.users.sourceforge.net/vim/compiler if exists("current_compiler") @@ -14,5 +14,5 @@ if exists(":CompilerSet") != 2 " older Vim always used :setlocal endif " Jikes defaults to printing output on stderr -CompilerSet makeprg=jikes\ -Xstdout\ +E\ \"%\" +CompilerSet makeprg=jikes\ -Xstdout\ +E\ \"%:S\" CompilerSet errorformat=%f:%l:%v:%*\\d:%*\\d:%*\\s%m diff --git a/runtime/compiler/onsgmls.vim b/runtime/compiler/onsgmls.vim index 130d3e21b3..68925ef459 100644 --- a/runtime/compiler/onsgmls.vim +++ b/runtime/compiler/onsgmls.vim @@ -1,7 +1,7 @@ " Vim compiler file " Compiler: onsgmls " Maintainer: Robert Rowsome <rowsome@wam.umd.edu> -" Last Change: 2004 Mar 27 +" Last Change: 2019 Jul 23 if exists("current_compiler") finish @@ -15,7 +15,7 @@ endif let s:cpo_save = &cpo set cpo-=C -CompilerSet makeprg=onsgmls\ -s\ % +CompilerSet makeprg=onsgmls\ -s\ %:S CompilerSet errorformat=onsgmls:%f:%l:%c:%t:%m, \onsgmls:%f:%l:%c:%m diff --git a/runtime/compiler/perl.vim b/runtime/compiler/perl.vim index 583c6c3787..a857caed8f 100644 --- a/runtime/compiler/perl.vim +++ b/runtime/compiler/perl.vim @@ -1,7 +1,7 @@ " Vim Compiler File " Compiler: Perl syntax checks (perl -Wc) " Maintainer: Christian J. Robinson <heptite@gmail.com> -" Last Change: 2006 Aug 13 +" Last Change: 2019 Jul 22 if exists("current_compiler") finish @@ -27,7 +27,7 @@ else let s:taintopt = '' endif -exe 'CompilerSet makeprg=perl\ -' . s:warnopt . s:taintopt . 'c\ %' +exe 'CompilerSet makeprg=perl\ -' . s:warnopt . s:taintopt . 'c\ %:S' CompilerSet errorformat= \%-G%.%#had\ compilation\ errors., diff --git a/runtime/compiler/rustc.vim b/runtime/compiler/rustc.vim index c27bdc9c0c..5e5b9a4e0a 100644 --- a/runtime/compiler/rustc.vim +++ b/runtime/compiler/rustc.vim @@ -19,7 +19,7 @@ endif if exists("g:rustc_makeprg_no_percent") && g:rustc_makeprg_no_percent != 0 CompilerSet makeprg=rustc else - CompilerSet makeprg=rustc\ \% + CompilerSet makeprg=rustc\ \%:S endif " Old errorformat (before nightly 2016/08/10) diff --git a/runtime/compiler/splint.vim b/runtime/compiler/splint.vim index 6239ca7139..3d7ada6d1d 100644 --- a/runtime/compiler/splint.vim +++ b/runtime/compiler/splint.vim @@ -2,7 +2,7 @@ " Compiler: splint/lclint (C source code checker) " Maintainer: Ralf Wildenhues <Ralf.Wildenhues@gmx.de> " Splint Home: http://www.splint.org/ -" Last Change: 2005 Apr 21 +" Last Change: 2019 Jul 23 " $Revision: 1.3 $ if exists("current_compiler") @@ -19,7 +19,7 @@ set cpo-=C " adapt this if you want to check more than one file at a time. " put command line options in .splintrc or ~/.splintrc -CompilerSet makeprg=splint\ % +CompilerSet makeprg=splint\ %:S " Note: when using the new array bounds checking flags: Each warning " usually has several lines and several references to source code mostly diff --git a/runtime/compiler/xmlwf.vim b/runtime/compiler/xmlwf.vim index cd2e2bb6ad..3de9d08d55 100644 --- a/runtime/compiler/xmlwf.vim +++ b/runtime/compiler/xmlwf.vim @@ -1,7 +1,7 @@ " Vim Compiler File " Compiler: xmlwf " Maintainer: Robert Rowsome <rowsome@wam.umd.edu> -" Last Change: 2004 Mar 27 +" Last Change: 2019 Jul 23 if exists("current_compiler") finish @@ -15,7 +15,7 @@ if exists(":CompilerSet") != 2 " older Vim always used :setlocal command -nargs=* CompilerSet setlocal <args> endif -CompilerSet makeprg=xmlwf\ % +CompilerSet makeprg=xmlwf\ %:S CompilerSet errorformat=%f:%l%c:%m diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index e37fe9e5ce..ba89c207c2 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -877,12 +877,33 @@ MenuPopup Just before showing the popup menu (under the *OptionSet* OptionSet After setting an option (except during |startup|). The |autocmd-pattern| is matched - against the long option name. - |v:option_old| indicates the old option value, - |v:option_new| indicates the new value, + against the long option name. |<amatch>| + indicates what option has been set. + |v:option_type| indicates whether it's global - or local scoped and |<amatch>| indicates which - option was set. + or local scoped. + |v:option_command| indicates what type of + set/let command was used (follow the tag to + see the table). + |v:option_new| indicates the newly set value. + |v:option_oldlocal| has the old local value. + |v:option_oldglobal| has the old global value. + |v:option_old| indicates the old option value. + + |v:option_oldlocal| is only set when |:set| + or |:setlocal| or a |modeline| was used to set + the option. Similarly |v:option_oldglobal| is + only set when |:set| or |:setglobal| was used. + + Note that when setting a |global-local| string + option with |:set|, then |v:option_old| is the + old global value. However, for all other kinds + of options (local string options, global-local + number options, ...) it is the old local + value. + + OptionSet is not triggered on startup and for + the 'key' option for obvious reasons. Usage example: Check for the existence of the directory in the 'backupdir' and 'undodir' @@ -1051,8 +1072,7 @@ TextChanged After a change was made to the text in the was defined). Not triggered when there is typeahead or when an operator is pending. - Note: This can not be skipped with - `:noautocmd`. + Note: Cannot be skipped with `:noautocmd`. Careful: This is triggered very often, don't do anything that the user does not expect or that is slow. @@ -1352,7 +1372,7 @@ have changed autocommands, or when Vim has executed the wrong autocommands Note that the 'eventignore' option applies here too. Events listed in this option will not cause any commands to be executed. - *:do* *:doau* *:doautocmd* *E217* + *:do* *:doau* *:doaut* *:doautocmd* *E217* :do[autocmd] [<nomodeline>] [group] {event} [fname] Apply the autocommands matching [fname] (default: current file name) for {event} to the current buffer. diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 2259eddb6a..bd3f22a371 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -162,8 +162,6 @@ gR Enter Virtual Replace mode: Each character you type <Tab> may replace several characters at once. Repeat the entered text [count]-1 times. See |Virtual-Replace-mode| for more details. - {not available when compiled without the |+vreplace| - feature} *c* ["x]c{motion} Delete {motion} text [into register x] and start @@ -282,14 +280,11 @@ gr{char} Replace the virtual characters under the cursor with space. See |gR| and |Virtual-Replace-mode| for more details. As with |r| a count may be given. {char} can be entered like with |r|. - {not available when compiled without the |+vreplace| - feature} *digraph-arg* The argument for Normal mode commands like |r| and |t| is a single character. When 'cpo' doesn't contain the 'D' flag, this character can also be entered like |digraphs|. First type CTRL-K and then the two digraph characters. -{not available when compiled without the |+digraphs| feature} *case* The following commands change the case of letters. The currently active @@ -1137,9 +1132,9 @@ There are ten types of registers: *registers* *E354* 2. 10 numbered registers "0 to "9 3. The small delete register "- 4. 26 named registers "a to "z or "A to "Z -5. three read-only registers ":, "., "% -6. alternate buffer register "# -7. the expression register "= +5. Three read-only registers ":, "., "% +6. Alternate buffer register "# +7. The expression register "= 8. The selection registers "* and "+ 9. The black hole register "_ 10. Last search pattern register "/ diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt index ab002b4dcb..dcc3035d41 100644 --- a/runtime/doc/diff.txt +++ b/runtime/doc/diff.txt @@ -175,7 +175,7 @@ hidden buffers. You can use ":hide" to close a window without unloading the buffer. If you don't want a buffer to remain used for the diff do ":set nodiff" before hiding it. - *:dif* *:diffupdate* + *:dif* *:diff* *:diffupdate* :dif[fupdate][!] Update the diff highlighting and folds. Vim attempts to keep the differences updated when you make changes to the @@ -325,7 +325,7 @@ After setting this variable, reload the syntax script: > FINDING THE DIFFERENCES *diff-diffexpr* The 'diffexpr' option can be set to use something else than the standard -"diff" program to compare two files and find the differences. +"diff" program to compare two files and find the differences. *E959* When 'diffexpr' is empty, Vim uses this command to find the differences between file1 and file2: > diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index f4d3164dbc..23a65f16e4 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -555,7 +555,7 @@ You can use the argument list with the following commands, and with the expression functions |argc()| and |argv()|. These all work on the argument list of the current window. - *:ar* *:args* + *:ar* *:arg* *:args* :ar[gs] Print the argument list, with the current file in square brackets. diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 57ef380cc5..697e456817 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1010,8 +1010,9 @@ There must not be white space before or after the dot. Examples: > :let dict = {"one": 1, 2: "two"} - :echo dict.one - :echo dict .2 + :echo dict.one " shows "1" + :echo dict.2 " shows "two" + :echo dict .2 " error because of space before the dot Note that the dot is also used for String concatenation. To avoid confusion always put spaces around the dot for String concatenation. @@ -1588,7 +1589,7 @@ v:exception The value of the exception most recently caught and not :try : throw "oops" :catch /.*/ - : echo "caught" v:exception + : echo "caught " .. v:exception :endtry < Output: "caught oops". @@ -3982,7 +3983,10 @@ get({list}, {idx} [, {default}]) *get()* get({dict}, {key} [, {default}]) Get item with key {key} from |Dictionary| {dict}. When this item is not available return {default}. Return zero when - {default} is omitted. + {default} is omitted. Useful example: > + let val = get(g:, 'var_name', 'default') +< This gets the value of g:var_name if it exists, and uses + 'default' when it does not exist. get({func}, {what}) Get item {what} from Funcref {func}. Possible values for {what} are: @@ -5038,7 +5042,6 @@ iconv({expr}, {from}, {to}) *iconv()* Note that Vim uses UTF-8 for all Unicode encodings, conversion from/to UCS-2 is automatically changed to use UTF-8. You cannot use UCS-2 in a string anyway, because of the NUL bytes. - {only available when compiled with the |+multi_byte| feature} *indent()* indent({lnum}) The result is a Number, which is indent of line {lnum} in the @@ -5470,8 +5473,6 @@ libcall({libname}, {funcname}, {argument}) the DLL is not in the usual places. For Unix: When compiling your own plugins, remember that the object code must be compiled as position-independent ('PIC'). - {only in Win32 and some Unix versions, when the |+libcall| - feature is present} Examples: > :echo libcall("libc.so", "getenv", "HOME") < @@ -5479,8 +5480,6 @@ libcall({libname}, {funcname}, {argument}) libcallnr({libname}, {funcname}, {argument}) Just like |libcall()|, but used for a function that returns an int instead of a string. - {only in Win32 on some Unix versions, when the |+libcall| - feature is present} Examples: > :echo libcallnr("/usr/lib/libc.so", "getpid", "") :call libcallnr("libc.so", "printf", "Hello World!\n") @@ -6408,7 +6407,6 @@ py3eval({expr}) *py3eval()* Lists are represented as Vim |List| type. Dictionaries are represented as Vim |Dictionary| type with keys converted to strings. - {only available when compiled with the |+python3| feature} *E858* *E859* pyeval({expr}) *pyeval()* @@ -6419,7 +6417,6 @@ pyeval({expr}) *pyeval()* Lists are represented as Vim |List| type. Dictionaries are represented as Vim |Dictionary| type, non-string keys result in error. - {only available when compiled with the |+python| feature} pyxeval({expr}) *pyxeval()* Evaluate Python expression {expr} and return its result @@ -6553,7 +6550,6 @@ remote_expr({server}, {string} [, {idvar} [, {timeout}]]) seconds. Otherwise a timeout of 600 seconds is used. See also |clientserver| |RemoteReply|. This function is not available in the |sandbox|. - {only available when compiled with the |+clientserver| feature} Note: Any errors will cause a local error message to be issued and the result will be the empty string. @@ -6589,7 +6585,6 @@ remote_peek({serverid} [, {retvar}]) *remote_peek()* Returns -1 if something is wrong. See also |clientserver|. This function is not available in the |sandbox|. - {only available when compiled with the |+clientserver| feature} Examples: > :let repl = "" :echo "PEEK: ".remote_peek(id, "repl").": ".repl @@ -6600,7 +6595,6 @@ remote_read({serverid}, [{timeout}]) *remote_read()* reply is available. See also |clientserver|. This function is not available in the |sandbox|. - {only available when compiled with the |+clientserver| feature} Example: > :echo remote_read(id) < @@ -6614,7 +6608,6 @@ remote_send({server}, {string} [, {idvar}]) there. See also |clientserver| |RemoteReply|. This function is not available in the |sandbox|. - {only available when compiled with the |+clientserver| feature} Note: Any errors will be reported in the server and may mess up the display. @@ -6631,7 +6624,6 @@ remote_send({server}, {string} [, {idvar}]) remote_startserver({name}) Become the server {name}. This fails if already running as a server, when |v:servername| is not empty. - {only available when compiled with the |+clientserver| feature} remove({list}, {idx} [, {end}]) *remove()* Without {end}: Remove the item at {idx} from |List| {list} and @@ -6645,7 +6637,8 @@ remove({list}, {idx} [, {end}]) *remove()* :echo "last item: " . remove(mylist, -1) :call remove(mylist, 0, 9) remove({dict}, {key}) - Remove the entry from {dict} with key {key}. Example: > + Remove the entry from {dict} with key {key} and return it. + Example: > :echo "removed " . remove(dict, "one") < If there is no {key} in {dict} this is an error. @@ -6802,7 +6795,6 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()* {timeout} is 500 the search stops after half a second. The value must not be negative. A zero value is like not giving the argument. - {only available when compiled with the |+reltime| feature} *search()-sub-match* With the 'p' flag the returned value is one more than the @@ -6978,7 +6970,6 @@ searchpos({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *searchpos()* server2client({clientid}, {string}) *server2client()* Send a reply string to {clientid}. The most recent {clientid} that sent a string can be retrieved with expand("<client>"). - {only available when compiled with the |+clientserver| feature} Note: This id has to be stored before the next command can be received. I.e. before returning from the received command and @@ -9328,7 +9319,7 @@ This function can then be called with: > *:cal* *:call* *E107* *E117* :[range]cal[l] {name}([arguments]) Call a function. The name of the function and its arguments - are as specified with |:function|. Up to 20 arguments can be + are as specified with `:function`. Up to 20 arguments can be used. The returned value is discarded. Without a range and for functions that accept a range, the function is called once. When a range is given the cursor is @@ -9382,9 +9373,9 @@ Using an autocommand ~ This is introduced in the user manual, section |41.14|. The autocommand is useful if you have a plugin that is a long Vim script file. -You can define the autocommand and quickly quit the script with |:finish|. +You can define the autocommand and quickly quit the script with `:finish`. That makes Vim startup faster. The autocommand should then load the same file -again, setting a variable to skip the |:finish| command. +again, setting a variable to skip the `:finish` command. Use the FuncUndefined autocommand event with a pattern that matches the function(s) to be defined. Example: > @@ -9699,6 +9690,11 @@ This does NOT work: > register values cannot be used here, since they cannot be locked. +:cons[t] +:cons[t] {var-name} + If no argument is given or only {var-name} is given, + the behavior is the same as |:let|. + :lockv[ar][!] [depth] {name} ... *:lockvar* *:lockv* Lock the internal variable {name}. Locking means that it can no longer be changed (until it is unlocked). @@ -9750,7 +9746,7 @@ This does NOT work: > opposite of |:lockvar|. -:if {expr1} *:if* *:endif* *:en* *E171* *E579* *E580* +:if {expr1} *:if* *:end* *:endif* *:en* *E171* *E579* *E580* :en[dif] Execute the commands until the next matching ":else" or ":endif" if {expr1} evaluates to non-zero. diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index ad834e1f6c..1f7d09ae32 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -579,6 +579,16 @@ To disable this behavior, set the following variable in your vimrc: > let g:python_recommended_style = 0 +QF QUICKFIX *qf.vim* *ft-qf-plugin* + +The "qf" filetype is used for the quickfix window, see |quickfix-window|. + +The quickfix filetype plugin includes configuration for displaying the command +that produced the quickfix list in the |status-line|. To disable this setting, +configure as follows: > + :let g:qf_disable_statusline = 1 + + R MARKDOWN *ft-rmd-plugin* By default ftplugin/html.vim is not sourced. If you want it sourced, add to diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt index b7d92fb229..f2f6c70b0c 100644 --- a/runtime/doc/fold.txt +++ b/runtime/doc/fold.txt @@ -436,7 +436,7 @@ zk Move upwards to the end of the previous fold. A closed fold EXECUTING COMMANDS ON FOLDS ~ -:[range]foldd[oopen] {cmd} *:foldd* *:folddoopen* +:[range]foldd[oopen] {cmd} *:foldd* *:folddo* *:folddoopen* Execute {cmd} on all lines that are not in a closed fold. When [range] is given, only these lines are used. Each time {cmd} is executed the cursor is positioned on the diff --git a/runtime/doc/if_lua.txt b/runtime/doc/if_lua.txt index 6dcf3f9fa9..f886fd28c5 100644 --- a/runtime/doc/if_lua.txt +++ b/runtime/doc/if_lua.txt @@ -189,16 +189,16 @@ To see the LuaJIT version: > :lua print(jit.version) < -:[range]lua << {endmarker} +:[range]lua << [endmarker] {script} {endmarker} - Execute Lua script {script}. + Execute Lua script {script}. Useful for including Lua + code in Vim scripts. -{endmarker} must NOT be preceded by any white space. If {endmarker} is -omitted from after the "<<", a dot '.' must be used after {script}, like -for the |:append| and |:insert| commands. -This form of the |:lua| command is mainly useful for including Lua code -in Vim scripts. +The {endmarker} must NOT be preceded by any white space. + +If [endmarker] is omitted from after the "<<", a dot '.' must be used after +{script}, like for the |:append| and |:insert| commands. Example: > diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt index ac725a9b5d..ed3bdcf277 100644 --- a/runtime/doc/if_pyth.txt +++ b/runtime/doc/if_pyth.txt @@ -19,18 +19,17 @@ Commands *python-commands* the `:python` command is working: > :python print "Hello" -:[range]py[thon] << {endmarker} +:[range]py[thon] << [endmarker] {script} {endmarker} - Execute Python script {script}. - Note: This command doesn't work when Python isn't - available. To avoid errors, see |script-here|. - -{endmarker} must NOT be preceded by any white space. If {endmarker} is -omitted from after the "<<", a dot '.' must be used after {script}, like -for the |:append| and |:insert| commands. -This form of the |:python| command is mainly useful for including python code -in Vim scripts. + Execute Python script {script}. Useful for including + python code in Vim scripts. Requires Python, see + |script-here|. + +The {endmarker} below the {script} must NOT be preceded by any white space. + +If [endmarker] is omitted from after the "<<", a dot '.' must be used after +{script}, like for the |:append| and |:insert| commands. Example: > function! IcecreamInitialize() diff --git a/runtime/doc/if_ruby.txt b/runtime/doc/if_ruby.txt index 3c7c800fbf..6468e4c81e 100644 --- a/runtime/doc/if_ruby.txt +++ b/runtime/doc/if_ruby.txt @@ -19,15 +19,19 @@ downloading Ruby there. :rub[y] {cmd} Execute Ruby command {cmd}. A command to try it out: > :ruby print "Hello" -:rub[y] << {endpattern} +:rub[y] << [endpattern] {script} {endpattern} Execute Ruby script {script}. - {endpattern} must NOT be preceded by any white space. - If {endpattern} is omitted, it defaults to a dot '.' - like for the |:append| and |:insert| commands. This - form of the |:ruby| command is mainly useful for + The {endpattern} after {script} must NOT be preceded + by any white space. + + If [endpattern] is omitted, it defaults to a dot '.' + like for the |:append| and |:insert| commands. + + This form of the |:ruby| command is mainly useful for including ruby code in vim scripts. + Note: This command doesn't work when the Ruby feature wasn't compiled in. To avoid errors, see |script-here|. diff --git a/runtime/doc/indent.txt b/runtime/doc/indent.txt index e69497e1ab..a99d84e969 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -827,7 +827,7 @@ PHP indenting can be altered in several ways by modifying the values of some global variables: *php-comment* *PHP_autoformatcomment* -To not enable auto-formatting of comments by default (if you want to use your +To not enable auto-formating of comments by default (if you want to use your own 'formatoptions'): > :let g:PHP_autoformatcomment = 0 @@ -897,7 +897,7 @@ NOTE: Indenting will be a bit slower if this option is used because some optimizations won't be available. ------------- - *PHP_vintage_case_default_indent* + *PHP_vintage_case_default_indent* To indent 'case:' and 'default:' statements in switch() blocks: > :let g:PHP_vintage_case_default_indent = 1 @@ -924,6 +924,41 @@ You will obtain the following result: > ->age() ->info(); +------------- + + *PHP_IndentFunctionCallParameters* +Extra indentation levels to add to parameters in multi-line function calls. > + let g:PHP_IndentFunctionCallParameters = 1 + +Function call arguments will indent 1 extra level. For two-space indentation: > + + function call_the_thing( + $with_this, + $and_that + ) { + $this->do_the_thing( + $with_this, + $and_that + ); + } + +------------- + + *PHP_IndentFunctionDeclarationParameters* +Extra indentation levels to add to arguments in multi-line function definitions. > + let g:PHP_IndentFunctionDeclarationParameters = 1 + +Function arguments in declarations will indent 1 extra level. For two-space indentation: > + + function call_the_thing( + $with_this, + $and_that + ) { + $this->do_the_thing( + $with_this, + $and_that + ); + } PYTHON *ft-python-indent* diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index da48f7f84d..47c789713c 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -153,7 +153,6 @@ commands in CTRL-X submode *i_CTRL-X_index* |i_CTRL-X_CTRL-V| CTRL-X CTRL-V complete like in : command line |i_CTRL-X_CTRL-]| CTRL-X CTRL-] complete tags |i_CTRL-X_s| CTRL-X s spelling suggestions -{not available when compiled without the |+insert_expand| feature} commands in completion mode (see |popupmenu-keys|) @@ -1195,6 +1194,7 @@ tag command action ~ |:compiler| :comp[iler] do settings for a specific compiler |:continue| :con[tinue] go back to :while |:confirm| :conf[irm] prompt user when confirmation required +|:const| :cons[t] create a variable as a constant |:copen| :cope[n] open quickfix window |:cprevious| :cp[revious] go to previous error |:cpfile| :cpf[ile] go to last error in previous file diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index a2fdd821ff..abe86749c4 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -39,7 +39,7 @@ modes. :om[ap] {lhs} {rhs} |mapmode-o| *:om* *:omap* :map! {lhs} {rhs} |mapmode-ic| *:map!* :im[ap] {lhs} {rhs} |mapmode-i| *:im* *:imap* -:lm[ap] {lhs} {rhs} |mapmode-l| *:lm* *:lmap* +:lm[ap] {lhs} {rhs} |mapmode-l| *:lm* *:lma* *:lmap* :cm[ap] {lhs} {rhs} |mapmode-c| *:cm* *:cmap* :tma[p] {lhs} {rhs} |mapmode-t| *:tma* *:tmap* Map the key sequence {lhs} to {rhs} for the modes @@ -52,12 +52,12 @@ modes. :nn[oremap] {lhs} {rhs} |mapmode-n| *:nn* *:nnoremap* :vn[oremap] {lhs} {rhs} |mapmode-v| *:vn* *:vnoremap* :xn[oremap] {lhs} {rhs} |mapmode-x| *:xn* *:xnoremap* -:snor[emap] {lhs} {rhs} |mapmode-s| *:snor* *:snoremap* +:snor[emap] {lhs} {rhs} |mapmode-s| *:snor* *:snore* *:snoremap* :ono[remap] {lhs} {rhs} |mapmode-o| *:ono* *:onoremap* :no[remap]! {lhs} {rhs} |mapmode-ic| *:no!* *:noremap!* -:ino[remap] {lhs} {rhs} |mapmode-i| *:ino* *:inoremap* +:ino[remap] {lhs} {rhs} |mapmode-i| *:ino* *:inor* *:inoremap* :ln[oremap] {lhs} {rhs} |mapmode-l| *:ln* *:lnoremap* -:cno[remap] {lhs} {rhs} |mapmode-c| *:cno* *:cnoremap* +:cno[remap] {lhs} {rhs} |mapmode-c| *:cno* *:cnor* *:cnoremap* :tno[remap] {lhs} {rhs} |mapmode-t| *:tno* *:tnoremap* Map the key sequence {lhs} to {rhs} for the modes where the map command applies. Disallow mapping of @@ -74,7 +74,7 @@ modes. :unm[ap]! {lhs} |mapmode-ic| *:unm!* *:unmap!* :iu[nmap] {lhs} |mapmode-i| *:iu* *:iunmap* :lu[nmap] {lhs} |mapmode-l| *:lu* *:lunmap* -:cu[nmap] {lhs} |mapmode-c| *:cu* *:cunmap* +:cu[nmap] {lhs} |mapmode-c| *:cu* *:cun* *:cunmap* :tunma[p] {lhs} |mapmode-t| *:tunma* *:tunmap* Remove the mapping of {lhs} for the modes where the map command applies. The mapping may remain defined @@ -790,8 +790,6 @@ g@{motion} Call the function set by the 'operatorfunc' option. "block" {motion} was |blockwise-visual| Although "block" would rarely appear, since it can only result from Visual mode where "g@" is not useful. - {not available when compiled without the |+eval| - feature} Here is an example that counts the number of spaces with <F4>: > @@ -972,7 +970,7 @@ See |:verbose-cmd| for more information. :norea[bbrev] [<expr>] [<buffer>] [lhs] [rhs] same as ":ab", but no remapping for this {rhs} - *:ca* *:cabbrev* + *:ca* *:cab* *:cabbrev* :ca[bbrev] [<expr>] [<buffer>] [lhs] [rhs] same as ":ab", but for Command-line mode only. diff --git a/runtime/doc/mbyte.txt b/runtime/doc/mbyte.txt index 24d9d01af0..127c46c27d 100644 --- a/runtime/doc/mbyte.txt +++ b/runtime/doc/mbyte.txt @@ -696,80 +696,6 @@ For example, when you are using kinput2 as |IM-server| and sh, > < ============================================================================== -Input on MS-Windows *mbyte-IME* - -(Windows IME support) *multibyte-ime* *IME* - -{only works Windows GUI and compiled with the |+multi_byte_ime| feature} - -To input multibyte characters on Windows, you can use an Input Method Editor -(IME). In process of your editing text, you must switch status (on/off) of -IME many many many times. Because IME with status on is hooking all of your -key inputs, you cannot input 'j', 'k', or almost all of keys to Vim directly. - -This |+multi_byte_ime| feature help this. It reduce times of switch status of -IME manually. In normal mode, there are almost no need working IME, even -editing multibyte text. So exiting insert mode with ESC, Vim memorize last -status of IME and force turn off IME. When re-enter insert mode, Vim revert -IME status to that memorized automatically. - -This works on not only insert-normal mode, but also search-command input and -replace mode. -The options 'iminsert', 'imsearch' and 'imcmdline' can be used to chose -the different input methods or disable them temporarily. - -WHAT IS IME - IME is a part of East asian version Windows. That helps you to input - multibyte character. English and other language version Windows does not - have any IME. (Also there is no need usually.) But there is one that - called Microsoft Global IME. Global IME is a part of Internet Explorer - 4.0 or above. You can get more information about Global IME, at below - URL. - -WHAT IS GLOBAL IME *global-ime* - Global IME enables input of Chinese, Japanese, and Korean text into Vim - buffer on any language version of Windows. Global IME is built in, and - the Input Locales can be added through Control Panel/Regional - Options/Input Locales. Please see below URL for detail of Global IME. - You can also find various language version of Global IME at same place. - - - Global IME detailed information. - http://search.microsoft.com/results.aspx?q=global+ime - - - Active Input Method Manager (Global IME) - http://msdn.microsoft.com/en-us/library/aa741221(v=VS.85).aspx - - Support for Global IME is an experimental feature. - -NOTE: For IME to work you must make sure the input locales of your language -are added to your system. The exact location of this depends on the version -of Windows you use. For example, on my Windows 2000 box: -1. Control Panel -2. Regional Options -3. Input Locales Tab -4. Add Installed input locales -> Chinese(PRC) - The default is still English (United Stated) - - -Cursor color when IME or XIM is on *CursorIM* - There is a little cute feature for IME. Cursor can indicate status of IME - by changing its color. Usually status of IME was indicated by little icon - at a corner of desktop (or taskbar). It is not easy to verify status of - IME. But this feature help this. - This works in the same way when using XIM. - - You can select cursor color when status is on by using highlight group - CursorIM. For example, add these lines to your |ginit.vim|: > - - if has('multi_byte_ime') - highlight Cursor guifg=NONE guibg=Green - highlight CursorIM guifg=NONE guibg=Purple - endif -< - Cursor color with off IME is green. And purple cursor indicates that - status is on. - -============================================================================== Input with a keymap *mbyte-keymap* When the keyboard doesn't produce the characters you want to enter in your @@ -777,7 +703,6 @@ text, you can use the 'keymap' option. This will translate one or more (English) characters to another (non-English) character. This only happens when typing text, not when typing Vim commands. This avoids having to switch between two keyboard settings. -{only available when compiled with the |+keymap| feature} The value of the 'keymap' option specifies a keymap file to use. The name of this file is one of these two: diff --git a/runtime/doc/message.txt b/runtime/doc/message.txt index 864eea8f7f..97a1882159 100644 --- a/runtime/doc/message.txt +++ b/runtime/doc/message.txt @@ -240,6 +240,9 @@ format of the file. The file will not be marked unmodified. If you care about the loss of information, set the 'fileencoding' option to another value that can handle the characters in the buffer and write again. If you don't care, you can abandon the buffer or reset the 'modified' option. +If there is a backup file, when 'writebackup' or 'backup' is set, it will not +be deleted, so you can move it back into place if you want to discard the +changes. *E302* > Could not rename swap file diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index 818bbf9eb7..97c7d1cc43 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -46,6 +46,7 @@ or change text. The following operators are available: |!| ! filter through an external program |=| = filter through 'equalprg' or C-indenting if empty |gq| gq text formatting + |gw| gw text formatting with no cursor movement |g?| g? ROT13 encoding |>| > shift right |<| < shift left @@ -923,7 +924,7 @@ These commands are not marks themselves, but jump to a mark: [` [count] times to lowercase mark before the cursor. -:loc[kmarks] {command} *:loc* *:lockmarks* +:loc[kmarks] {command} *:loc* *:lock* *:lockmarks* Execute {command} without adjusting marks. This is useful when changing text in a way that the line count will be the same when the change has completed. @@ -949,7 +950,7 @@ These commands are not marks themselves, but jump to a mark: - folds - diffs -:kee[pmarks] {command} *:kee* *:keepmarks* +:kee[pmarks] {command} *:kee* *:keep* *:keepmarks* Currently only has effect for the filter command |:range!|: - When the number of lines after filtering is equal to diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index a206bec44e..ce0e01265b 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -3145,8 +3145,6 @@ A jump table for the options with a short description can be found at |Q_op|. 0 :lmap is off and IM is off 1 :lmap is ON and IM is off 2 :lmap is off and IM is ON - 2 is available only when compiled with the |+multi_byte_ime|, |+xim| - or |global-ime|. To always reset the option to zero when leaving Insert mode with <Esc> this can be used: > :inoremap <ESC> <ESC>:set iminsert=0<CR> diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index 7f6a74e3f6..adfab07758 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -1189,7 +1189,6 @@ x A single character, with no special meaning, matches itself To include a "[" use "[[]" and for "]" use []]", e.g.,: > /index\%[[[]0[]]] < matches "index" "index[", "index[0" and "index[0]". - {not available when compiled without the |+syntax| feature} */\%d* */\%x* */\%o* */\%u* */\%U* *E678* diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 95726324ef..9a75a95f23 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -1,4 +1,4 @@ -*pi_netrw.txt* Nvim +*pi_netrw.txt* For Vim version 8.1. Last change: 2019 Jul 17 ------------------------------------------------ NETRW REFERENCE MANUAL by Charles E. Campbell @@ -6,7 +6,7 @@ Author: Charles E. Campbell <NdrOchip@ScampbellPfamily.AbizM> (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 Campbell *netrw-copyright* 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 @@ Copyright: Copyright (C) 2016 Charles E Campbell *netrw-copyright* 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 @@ Copyright: Copyright (C) 2016 Charles E Campbell *netrw-copyright* 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| @@ -153,7 +153,7 @@ Windows' ftp doesn't support .netrc; however, one may have in one's .vimrc: > let g:netrw_ftp_cmd= 'c:\Windows\System32\ftp -s:C:\Users\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 @@ -210,7 +210,7 @@ EXTERNAL APPLICATIONS AND PROTOCOLS *netrw-externapp* {{{2 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" @@ -221,7 +221,7 @@ EXTERNAL APPLICATIONS AND PROTOCOLS *netrw-externapp* {{{2 elinks : "-source >" links : "-dump >" - curl : "-o" + curl : "-L -o" wget : "-q -O" fetch : "-o" < @@ -236,7 +236,7 @@ EXTERNAL APPLICATIONS AND PROTOCOLS *netrw-externapp* {{{2 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 @@ -258,7 +258,7 @@ READING *netrw-read* *netrw-nread* {{{2 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 @@ -279,7 +279,7 @@ WRITING *netrw-write* *netrw-nwrite* {{{2 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 @@ -477,7 +477,7 @@ file using root-relative paths, use the full path: ============================================================================== 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 (<netrw.vim>) 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. @@ -530,7 +530,7 @@ variable (ex. scp uses the variable g:netrw_scp_cmd, which is defaulted to 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. @@ -732,11 +732,11 @@ such as netrw. 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 @@ -866,9 +866,11 @@ variables listed below, and may be modified by the user. 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" > ------------------------------------------------------------------------- @@ -1005,7 +1007,7 @@ where [protocol] is typically scp or ftp. As an example, try: > 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 @@ -1075,9 +1077,9 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 <c-r> Browse using a gvim server |netrw-ctrl-r| <c-tab> 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| @@ -1088,6 +1090,7 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 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| @@ -1167,25 +1170,26 @@ QUICK REFERENCE: COMMANDS *netrw-explore-cmds* *netrw-browse-cmds* {{{2 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] @@ -1204,7 +1208,7 @@ The :NetrwMB command is available outside of netrw buffers (once netrw has been 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 @@ -1416,20 +1420,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|. +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. +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: @@ -1465,10 +1469,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. @@ -1500,7 +1504,7 @@ Netrw determines which special handler by the following method: 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. @@ -1516,9 +1520,10 @@ will apply a special handler to it (like "x" works when in a netrw buffer). One may also use visual mode (see |visual-start|) to select the text that the special handler will use. Normally gx uses expand("<cfile>") 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 "<cword>", "<cWORD>"). Note that +expand("<cfile>") 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 @@ -1610,6 +1615,11 @@ A further approach is to delete files which match a pattern. 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: @@ -1673,17 +1683,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 @@ -1845,9 +1856,11 @@ EXECUTING FILE UNDER CURSOR VIA SYSTEM() *netrw-X* {{{2 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 @@ -2070,7 +2083,7 @@ Associated setting variables: |g:netrw_localmkdir| |g:netrw_mkdir_cmd| |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 @@ -2081,10 +2094,13 @@ track netrw's browsing directory. However, given the default setting for g:netrw_keepdir of 1 where netrw maintains its own separate notion of the current directory, in order to make -the two directories the same, use the "c" map (just type c). That map will +the two directories the same, use the "cd" map (type cd). That map will 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 @@ -2129,6 +2145,7 @@ The following netrw maps make use of marked files: |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 @@ -2203,6 +2220,9 @@ converts "*" into ".*" (see |regexp|) and marks files based on that. In the 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) @@ -2216,8 +2236,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 @@ -2268,7 +2289,17 @@ MARKED FILES: ARGUMENT LIST *netrw-ma* *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 @@ -2304,15 +2335,15 @@ One may also copy directories and their contents (local only) to a target 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 (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the global marked file list) -Use |diff-mode| to visualize difference between selected files (two or +Use |vimdiff| to visualize difference between selected files (two or three may be selected for this). Uses the global marked file list. MARKED FILES: EDITING *netrw-me* {{{2 @@ -2450,8 +2481,8 @@ When a remote set of files are tagged, the resulting tags file is "obtained"; 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| @@ -2553,8 +2584,8 @@ your browsing preferences. (see also: |netrw-settings|) 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| @@ -2708,11 +2739,12 @@ your browsing preferences. (see also: |netrw-settings|) =0 : show all =1 : show not-hidden files =2 : show hidden files only - default: =0 + default: =1 *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'| @@ -2733,7 +2765,7 @@ your browsing preferences. (see also: |netrw-settings|) 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. @@ -2759,26 +2791,52 @@ your browsing preferences. (see also: |netrw-settings|) 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_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_localmovecmd* ="mv" Linux/Unix/MacOS/Cygwin - ="move" Windows + *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. @@ -2882,26 +2940,41 @@ your browsing preferences. (see also: |netrw-settings|) netrwBak : *.bak netrwCompress: *.gz *.bz2 *.Z *.zip + netrwCoreDump: core.\d\+ netrwData : *.dat + netrwDoc : *.doc,*.txt,*.pdf, + *.pdf,*.docx netrwHdr : *.h + netrwLex : *.l *.lex netrwLib : *.a *.so *.lib *.dll netrwMakefile: [mM]akefile *.mak netrwObj : *.o *.obj + netrwPix : *.bmp,*.fit,*.fits,*.gif, + *.jpg,*.jpeg,*.pcx,*.ppc + *.pgm,*.png,*.psd,*.rgb + *.tif,*.xbm,*.xcf netrwTags : tags ANmenu ANtags 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 > + netrwYacc : *.y + + 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: > @@ -2968,8 +3041,9 @@ your browsing preferences. (see also: |netrw-settings|) current netrw buffer's window to be used for the new window. If g:netrw_winsize is less than zero, then - the absolute value of g:netrw_winsize lines - or columns will be used for the new window. + the absolute value of g:netrw_winsize will be + used to specify the quantity of lines or + columns for the new window. If g:netrw_winsize is zero, then a normal split will be made (ie. |'equalalways'| will take effect, for example). @@ -3136,8 +3210,8 @@ If there are no marked files: (see |netrw-mf|) 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. @@ -3169,16 +3243,20 @@ If there are marked files: (see |netrw-mf|) 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 <ctrl-f> (initiates cmdline window editing) and <ctrl-c> (uses the +command line under the cursor) useful in conjunction with the R command. SELECTING SORTING STYLE *netrw-s* *netrw-sort* {{{2 @@ -3199,8 +3277,8 @@ number. Subsequent selection of a file to edit (|netrw-cr|) will use that 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|. @@ -3213,7 +3291,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| @@ -3234,9 +3312,9 @@ only if your terminal supports differentiating <c-tab> from a plain * 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 <c-tab>, then the <c-tab> will not be mapped. One may map something other -than a <c-tab>, too: (but you'll still need to have had g:netrw_usetab set) > +than a <c-tab>, too: (but you'll still need to have had |g:netrw_usetab| set). > nmap <unique> (whatever) <Plug>NetrwShrink < @@ -3269,9 +3347,10 @@ The user function is passed one argument; it resembles > 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. @@ -3302,7 +3381,7 @@ Example: Clear netrw's marked file list via a mapping on gu > (This section is likely to grow as I get feedback) (also see |netrw-debug|) *netrw-p1* - P1. I use windows 95, and my ftp dumps four blank lines at the + P1. I use windows 95, and my ftp dumps four blank lines at the {{{2 end of every read. See |netrw-fixup|, and put the following into your @@ -3311,7 +3390,7 @@ Example: Clear netrw's marked file list via a mapping on gu > let g:netrw_win95ftp= 1 *netrw-p2* - P2. I use Windows, and my network browsing with ftp doesn't sort by + P2. I use Windows, and my network browsing with ftp doesn't sort by {{{2 time or size! -or- The remote system is a Windows server; why don't I get sorts by time or size? @@ -3338,7 +3417,7 @@ Example: Clear netrw's marked file list via a mapping on gu > *netrw-p3* - P3. I tried rcp://user@host/ (or protocol other than ftp) and netrw + P3. I tried rcp://user@host/ (or protocol other than ftp) and netrw {{{2 used ssh! That wasn't what I asked for... Netrw has two methods for browsing remote directories: ssh @@ -3347,7 +3426,7 @@ Example: Clear netrw's marked file list via a mapping on gu > listing), netrw will use the given protocol to do so. *netrw-p4* - P4. I would like long listings to be the default. + P4. I would like long listings to be the default. {{{2 Put the following statement into your |.vimrc|: > @@ -3357,7 +3436,7 @@ Example: Clear netrw's marked file list via a mapping on gu > you can set. *netrw-p5* - P5. My times come up oddly in local browsing + P5. My times come up oddly in local browsing {{{2 Does your system's strftime() accept the "%c" to yield dates such as "Sun Apr 27 11:49:23 1997"? If not, do a @@ -3367,7 +3446,7 @@ Example: Clear netrw's marked file list via a mapping on gu > let g:netrw_timefmt= "%X" (where X is the option) < *netrw-p6* - P6. I want my current directory to track my browsing. + P6. I want my current directory to track my browsing. {{{2 How do I do that? Put the following line in your |.vimrc|: @@ -3375,8 +3454,8 @@ Example: Clear netrw's marked file list via a mapping on gu > let g:netrw_keepdir= 0 < *netrw-p7* - P7. I use Chinese (or other non-ascii) characters in my filenames, and - netrw (Explore, Sexplore, Hexplore, etc) doesn't display them! + P7. I use Chinese (or other non-ascii) characters in my filenames, {{{2 + and netrw (Explore, Sexplore, Hexplore, etc) doesn't display them! (taken from an answer provided by Wu Yongwei on the vim mailing list) @@ -3390,7 +3469,7 @@ Example: Clear netrw's marked file list via a mapping on gu > (...it is one more reason to recommend that people use utf-8!) *netrw-p8* - P8. I'm getting "ssh is not executable on your system" -- what do I + P8. I'm getting "ssh is not executable on your system" -- what do I {{{2 do? (Dudley Fox) Most people I know use putty for windows ssh. It @@ -3433,7 +3512,7 @@ Example: Clear netrw's marked file list via a mapping on gu > - Click "Add..." - Set External Editor (adjust path as needed, include the quotes and !.! at the end): - "c:\Program Files\Vim\vim81\gvim.exe" !.! + "c:\Program Files\Vim\vim70\gvim.exe" !.! - Check that the filetype in the box below is {asterisk}.{asterisk} (all files), or whatever types you want (cec: change {asterisk} to * ; I had to @@ -3473,7 +3552,7 @@ Example: Clear netrw's marked file list via a mapping on gu > default. *netrw-p9* *netrw-ml_get* - P9. I'm browsing, changing directory, and bang! ml_get errors + P9. I'm browsing, changing directory, and bang! ml_get errors {{{2 appear and I have to kill vim. Any way around this? Normally netrw attempts to avoid writing swapfiles for @@ -3484,7 +3563,7 @@ Example: Clear netrw's marked file list via a mapping on gu > let g:netrw_use_noswf= 0 < *netrw-p10* - P10. I'm being pestered with "[something] is a directory" and + P10. I'm being pestered with "[something] is a directory" and {{{2 "Press ENTER or type command to continue" prompts... The "[something] is a directory" prompt is issued by Vim, @@ -3495,8 +3574,8 @@ Example: Clear netrw's marked file list via a mapping on gu > your <.vimrc> file. *netrw-p11* - P11. I want to have two windows; a thin one on the left and my editing - window on the right. How may I accomplish this? + P11. I want to have two windows; a thin one on the left and my {{{2 + editing window on the right. How may I accomplish this? You probably want netrw running as in a side window. If so, you will likely find that ":[N]Lexplore" does what you want. The @@ -3521,7 +3600,7 @@ Example: Clear netrw's marked file list via a mapping on gu > *netrw-p12* - P12. My directory isn't sorting correctly, or unwanted letters are + P12. My directory isn't sorting correctly, or unwanted letters are {{{2 appearing in the listed filenames, or things aren't lining up properly in the wide listing, ... @@ -3531,9 +3610,9 @@ Example: Clear netrw's marked file list via a mapping on gu > You may need to change |g:netrw_sepchr| and/or |g:netrw_xstrlen|. *netrw-p13* - P13. I'm a Windows + putty + ssh user, and when I attempt to browse, - the directories are missing trailing "/"s so netrw treats them - as file transfers instead of as attempts to browse + P13. I'm a Windows + putty + ssh user, and when I attempt to {{{2 + browse, the directories are missing trailing "/"s so netrw treats + them as file transfers instead of as attempts to browse subdirectories. How may I fix this? (mikeyao) If you want to use vim via ssh and putty under Windows, @@ -3552,7 +3631,7 @@ Example: Clear netrw's marked file list via a mapping on gu > "let g:netrw_scp_cmd = "d:\\dev\\putty\\PSCP.exe" < *netrw-p14* - P14. I would like to speed up writes using Nwrite and scp/ssh + P14. I would like to speed up writes using Nwrite and scp/ssh {{{2 style connections. How? (Thomer M. Gil) Try using ssh's ControlMaster and ControlPath (see the ssh_config @@ -3579,8 +3658,8 @@ Example: Clear netrw's marked file list via a mapping on gu > vim scp://host.domain.com//home/user/.bashrc < *netrw-p15* - P15. How may I use a double-click instead of netrw's usual single click - to open a file or directory? (Ben Fritz) + P15. How may I use a double-click instead of netrw's usual single {{{2 + click to open a file or directory? (Ben Fritz) First, disable netrw's mapping with > let g:netrw_mousemaps= 0 @@ -3592,8 +3671,8 @@ Example: Clear netrw's marked file list via a mapping on gu > (see |g:netrw_mousemaps|) *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 + P16. When editing remote files (ex. :e ftp://hostname/path/file), {{{2 + 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 @@ -3601,7 +3680,7 @@ Example: Clear netrw's marked file list via a mapping on gu > directory. *netrw-p17* - P17. Netrw is closing buffers on its own. + P17. Netrw is closing buffers on its own. {{{2 What steps will reproduce the problem? 1. :Explore, navigate directories, open a file 2. :Explore, open another file @@ -3615,14 +3694,14 @@ Example: Clear netrw's marked file list via a mapping on gu > a ":ls!" will show them (although ":ls" does not). *netrw-P18* - P18. How to locally edit a file that's only available via + P18. How to locally edit a file that's only available via {{{2 another server accessible via ssh? See http://stackoverflow.com/questions/12469645/ "Using Vim to Remotely Edit A File on ServerB Only Accessible From ServerA" *netrw-P19* - P19. How do I get numbering on in directory listings? + P19. How do I get numbering on in directory listings? {{{2 With |g:netrw_bufsettings|, you can control netrw's buffer settings; try putting > let g:netrw_bufsettings="noma nomod nu nobl nowrap ro nornu" @@ -3631,7 +3710,7 @@ Example: Clear netrw's marked file list via a mapping on gu > let g:netrw_bufsettings="noma nomod nonu nobl nowrap ro rnu" < *netrw-P20* - P20. How may I have gvim start up showing a directory listing? + P20. How may I have gvim start up showing a directory listing? {{{2 Try putting the following code snippet into your .vimrc: > augroup VimStartup au! @@ -3644,10 +3723,10 @@ Example: Clear netrw's marked file list via a mapping on gu > (ie. a "huge" vim version). *netrw-P21* - P21. I've made a directory (or file) with an accented character, but - netrw isn't letting me enter that directory/read that file: + P21. I've made a directory (or file) with an accented character, {{{2 + 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: > @@ -3655,7 +3734,7 @@ Example: Clear netrw's marked file list via a mapping on gu > au FileType netrw set enc=latin1 < *netrw-P22* - P22. I get an error message when I try to copy or move a file: + P22. I get an error message when I try to copy or move a file: {{{2 **error** (netrw) tried using g:netrw_localcopycmd<cp>; it doesn't work! @@ -3683,8 +3762,8 @@ by obtaining a copy of the latest (often developmental) netrw at: The <netrw.vim> script is typically installed on systems as something like: > - /usr/local/share/vim/vim8x/plugin/netrwPlugin.vim - /usr/local/share/vim/vim8x/autoload/netrw.vim + /usr/local/share/vim/vim7x/plugin/netrwPlugin.vim + /usr/local/share/vim/vim7x/autoload/netrw.vim (see output of :echo &rtp) < which is loaded automatically at startup (assuming :set nocp). If you @@ -3719,6 +3798,8 @@ netrw: or http://vim.sourceforge.net/scripts/script.php?script_id=120 + Decho.vim is provided as a "vimball"; see |vimball-intro|. + 2. Edit the <netrw.vim> file by typing: > vim netrw.vim @@ -3761,6 +3842,112 @@ netrw: ============================================================================== 12. History *netrw-history* {{{1 + v163: Dec 05, 2017 * (Cristi Balan) reported that a setting ('sel') + was left changed + * (Holger Mitschke) reported a problem with + saving and restoring history. Fixed. + * Hopefully I fixed a nasty bug that caused a + file rename to wipe out a buffer that it + should not have wiped out. + * (Holger Mitschke) amended this help file + with additional |g:netrw_special_syntax| + items + 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 <expr> ..." 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-<expr>|, + 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 @@ -3792,9 +3979,9 @@ netrw: 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 <c-u>s into various netrw maps. diff --git a/runtime/doc/print.txt b/runtime/doc/print.txt index b6d781c1ca..d744735b96 100644 --- a/runtime/doc/print.txt +++ b/runtime/doc/print.txt @@ -44,8 +44,6 @@ Note: If you have problems printing with |:hardcopy|, an alternative is to use {filename}. Things like "%" are expanded |cmdline-special| Careful: An existing file is silently overwritten. - {only available when compiled with the |+postscript| - feature} On MS-Windows use the "print to file" feature of the printer driver. diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index ca836fea67..14a25c102d 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -87,7 +87,7 @@ processing a quickfix or location list command, it will be aborted. :ll[!] [nr] Same as ":cc", except the location list for the current window is used instead of the quickfix list. - *:cn* *:cnext* *E553* + *:cn* *:cne* *:cnext* *E553* :[count]cn[ext][!] Display the [count] next error in the list that includes a file name. If there are no file names at all, go to the [count] next error. See |:cc| for @@ -177,7 +177,7 @@ processing a quickfix or location list command, it will be aborted. 'encoding' option, you can use the 'makeencoding' option to specify the encoding. - *:lf* *:lfile* + *:lf* *:lfi* *:lfile* :lf[ile][!] [errorfile] Same as ":cfile", except the location list for the current window is used instead of the quickfix list. You can not use the -q command-line option to set @@ -192,7 +192,7 @@ processing a quickfix or location list command, it will be aborted. option to specify the encoding. -:lg[etfile] [errorfile] *:lg* *:lgetfile* +:lg[etfile] [errorfile] *:lg* *:lge* *:lgetfile* Same as ":cgetfile", except the location list for the current window is used instead of the quickfix list. @@ -230,7 +230,7 @@ processing a quickfix or location list command, it will be aborted. the current window is used instead of the quickfix list. - *:cad* *:caddbuffer* + *:cad* *:cadd* *:caddbuffer* :cad[dbuffer] [bufnr] Read the error list from the current buffer and add the errors to the current quickfix list. If a quickfix list is not present, then a new list is @@ -277,7 +277,7 @@ processing a quickfix or location list command, it will be aborted. Example: > :g/mypattern/caddexpr expand("%") . ":" . line(".") . ":" . getline(".") < - *:lad* *:laddexpr* + *:lad* *:addd* *:laddexpr* :lad[dexpr] {expr} Same as ":caddexpr", except the location list for the current window is used instead of the quickfix list. @@ -557,9 +557,9 @@ You can use CTRL-W <Enter> to open a new window and jump to the error there. When the quickfix window has been filled, two autocommand events are triggered. First the 'filetype' option is set to "qf", which triggers the -FileType event. Then the BufReadPost event is triggered, using "quickfix" for -the buffer name. This can be used to perform some action on the listed -errors. Example: > +FileType event (also see |qf.vim|). Then the BufReadPost event is triggered, +using "quickfix" for the buffer name. This can be used to perform some action +on the listed errors. Example: > au BufReadPost quickfix setlocal modifiable \ | silent exe 'g/^/s//\=line(".")." "/' \ | setlocal nomodifiable @@ -1088,8 +1088,6 @@ need to write down a "todo" list. If you use ":compiler foo" in "file.foo" and then ":compiler! bar" in another buffer, Vim will keep on using "foo" in "file.foo". - {not available when compiled without the - |+eval| feature} The Vim plugins in the "compiler" directory will set options to use the diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index cbfcfa4010..87cb9b54f5 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -771,6 +771,7 @@ Short explanation of each option: *option-list* 'menuitems' 'mis' maximum number of items in a menu 'mkspellmem' 'msm' memory used before |:mkspell| compresses the tree 'modeline' 'ml' recognize modelines at start or end of file +'modelineexpr' 'mle' allow setting expression options from a modeline 'modelines' 'mls' number of lines checked for modelines 'modifiable' 'ma' changes to the text are not possible 'modified' 'mod' buffer has been modified @@ -797,6 +798,7 @@ Short explanation of each option: *option-list* 'perldll' name of the Perl dynamic library 'preserveindent' 'pi' preserve the indent structure when reindenting 'previewheight' 'pvh' height of the preview window +'previewpopup' 'pvp' use popup window for preview 'previewwindow' 'pvw' identifies the preview window 'printdevice' 'pdev' name of the printer to be used for :hardcopy 'printencoding' 'penc' encoding to be used for printing @@ -927,6 +929,7 @@ Short explanation of each option: *option-list* 'winaltkeys' 'wak' when the windows system handles ALT keys 'window' 'wi' nr of lines to scroll for CTRL-F and CTRL-B 'winheight' 'wh' minimum number of lines for the current window +'winhighlight' 'winhl' window-local highlighting 'winfixheight' 'wfh' keep window height when opening/closing windows 'winfixwidth' 'wfw' keep window width when opening/closing windows 'winminheight' 'wmh' minimum number of lines for any window diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index d4eb3f0f6e..425ef4e926 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -165,7 +165,7 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. :so[urce] {file} Read Ex commands from {file}. These are commands that start with a ":". Triggers the |SourcePre| autocommand. - + *:source!* :so[urce]! {file} Read Vim commands from {file}. These are commands that are executed from Normal mode, like you type them. @@ -173,6 +173,7 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. |:bufdo|, in a loop or when another command follows the display won't be updated while executing the commands. + Cannot be used in the |sandbox|. *:ru* *:runtime* :ru[ntime][!] [where] {file} .. @@ -265,9 +266,16 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. after loading your .vimrc file. With this command it can be done earlier. - Packages will be loaded only once. After this command - it won't happen again. When the optional ! is added - this command will load packages even when done before. + Packages will be loaded only once. Using + `:packloadall` a second time will have no effect. + When the optional ! is added this command will load + packages even when done before. + + Note that when using `:packloadall` in the |vimrc| + file, the 'runtimepath' option is updated, and later + all plugins in 'runtimepath' will be loaded, which + means they are loaded again. Plugins are expected to + handle that. An error only causes sourcing the script where it happens to be aborted, further plugins will be loaded. diff --git a/runtime/doc/scroll.txt b/runtime/doc/scroll.txt index 7906214111..7d1da3b409 100644 --- a/runtime/doc/scroll.txt +++ b/runtime/doc/scroll.txt @@ -80,9 +80,6 @@ CTRL-U Scroll window Upwards in the buffer. The number of may be a difference). When the cursor is on the first line of the buffer nothing happens and a beep is produced. See also 'startofline' option. - {difference from vi: Vim scrolls 'scroll' screen - lines, instead of file lines; makes a difference when - lines wrap} <S-Up> or *<S-Up>* *<kPageUp>* <PageUp> or *<PageUp>* *CTRL-B* diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index 955861bd2d..110c6ef221 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -298,25 +298,25 @@ Exceptions: spell file is used. For example, with these values: - 'runtimepath' is "~/.config/nvim,/usr/local/share/nvim/runtime/,~/.config/nvim/after" + 'runtimepath' is "~/.config/nvim,/usr/share/nvim/runtime/,~/.config/nvim/after" 'encoding' is "iso-8859-2" 'spelllang' is "pl" Vim will look for: 1. ~/.config/nvim/spell/pl.iso-8859-2.spl -2. /usr/local/share/nvim/runtime/spell/pl.iso-8859-2.spl +2. /usr/share/nvim/runtime/spell/pl.iso-8859-2.spl 3. ~/.config/nvim/spell/pl.iso-8859-2.add.spl -4. /usr/local/share/nvim/runtime/spell/pl.iso-8859-2.add.spl +4. /usr/share/nvim/runtime/spell/pl.iso-8859-2.add.spl 5. ~/.config/nvim/after/spell/pl.iso-8859-2.add.spl This assumes 1. is not found and 2. is found. If 'encoding' is "latin1" Vim will look for: 1. ~/.config/nvim/spell/pl.latin1.spl -2. /usr/local/share/nvim/runtime/spell/pl.latin1.spl +2. /usr/share/nvim/runtime/spell/pl.latin1.spl 3. ~/.config/nvim/after/spell/pl.latin1.spl 4. ~/.config/nvim/spell/pl.ascii.spl -5. /usr/local/share/nvim/runtime/spell/pl.ascii.spl +5. /usr/share/nvim/runtime/spell/pl.ascii.spl 6. ~/.config/nvim/after/spell/pl.ascii.spl This assumes none of them are found (Polish doesn't make sense when leaving diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 6e68753292..fa4d87e915 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -257,7 +257,6 @@ argument. *-D* -D Debugging. Go to debugging mode when executing the first command from a script. |debug-mode| - {not available when compiled without the |+eval| feature} *-n* -n No |swap-file| will be used. Recovery after a crash will be @@ -676,7 +675,7 @@ After doing this once, Nvim sets the $VIMRUNTIME environment variable. In case you need the value of $VIMRUNTIME in a shell (e.g., for a script that greps in the help files) you might be able to use this: > - VIMRUNTIME="$(nvim -e --cmd 'echo $VIMRUNTIME|quit' 2>&1)" + VIMRUNTIME="$(nvim --clean --headless --cmd 'echo $VIMRUNTIME|q')" ============================================================================== 4. Suspending *suspend* @@ -731,7 +730,7 @@ vimrc file. options to [file] (default ".exrc" in the current directory). - *:mkv* *:mkvimrc* + *:mkv* *:mkvi* *:mkvimrc* :mkv[imrc][!] [file] Like ":mkexrc", but the default is ".nvimrc" in the current directory. The ":version" command is also written to the file. diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 208e8ea48d..e5b65554d4 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -2591,7 +2591,6 @@ preceding last option and unsetting all other ones): > Note: only existence of these options matter, not their value. You can replace 1 above with anything. - QUAKE *quake.vim* *ft-quake-syntax* The Quake syntax definition should work for most any FPS (First Person @@ -3108,7 +3107,7 @@ in your vimrc, and :set fdm=syntax. I suggest doing the latter via a modeline at the end of your LaTeX file: > % vim: fdm=syntax If your system becomes too slow, then you might wish to look into > - https://vimhelp.appspot.com/vim_faq.txt.html#faq-29.7 + https://vimhelp.org/vim_faq.txt.html#faq-29.7 < *g:tex_nospell* Tex: No Spell Checking Wanted~ @@ -3986,7 +3985,6 @@ This will make each {} block form one fold. The fold will start on the line where the item starts, and end where the item ends. If the start and end are within the same line, there is no fold. The 'foldnestmax' option limits the nesting of syntax folds. -{not available when Vim was compiled without |+folding| feature} *:syn-contains* *E405* *E406* *E407* *E408* *E409* @@ -5124,6 +5122,15 @@ load the syntax file. The command also deletes the "b:current_syntax" variable, since no syntax is loaded after this command. +To clean up specific syntax groups for the current buffer: > + :syntax clear {group-name} .. +This removes all patterns and keywords for {group-name}. + +To clean up specific syntax group lists for the current buffer: > + :syntax clear @{grouplist-name} .. +This sets {grouplist-name}'s contents to an empty list. + + *:syntax-off* *:syn-off* If you want to disable syntax highlighting for all buffers, you need to remove the autocommands that load the syntax files: > :syntax off @@ -5133,14 +5140,6 @@ What this command actually does, is executing the command > See the "nosyntax.vim" file for details. Note that for this to work $VIMRUNTIME must be valid. See |$VIMRUNTIME|. -To clean up specific syntax groups for the current buffer: > - :syntax clear {group-name} .. -This removes all patterns and keywords for {group-name}. - -To clean up specific syntax group lists for the current buffer: > - :syntax clear @{grouplist-name} .. -This sets {grouplist-name}'s contents to an empty list. - *:syntax-reset* *:syn-reset* If you have changed the colors and messed them up, use this command to get the defaults back: > diff --git a/runtime/doc/tabpage.txt b/runtime/doc/tabpage.txt index a0459d27bc..d0a5678179 100644 --- a/runtime/doc/tabpage.txt +++ b/runtime/doc/tabpage.txt @@ -74,8 +74,6 @@ For the related autocommands see |tabnew-autocmd|. :[count]tabf[ind] [++opt] [+cmd] {file} *:tabf* *:tabfind* Open a new tab page and edit {file} in 'path', like with |:find|. For [count] see |:tabnew| above. - {not available when the |+file_in_path| feature was disabled - at compile time} :[count]tab {cmd} *:tab* Execute {cmd} and when it opens a new window open a new tab diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt index 4890cf3848..58dd3259fd 100644 --- a/runtime/doc/tagsrch.txt +++ b/runtime/doc/tagsrch.txt @@ -79,18 +79,21 @@ changed, to avoid confusion when using ":tnext". It is changed when using ":tag {name}". The ignore-case matches are not found for a ":tag" command when: -- the 'ignorecase' option is off and 'tagcase' is "followic" +- 'tagcase' is "followic" and the 'ignorecase' option is off +- 'tagcase' is "followscs" and the 'ignorecase' option is off and the + 'smartcase' option is off or the pattern contains an upper case character. - 'tagcase' is "match" - 'tagcase' is "smart" and the pattern contains an upper case character. -- 'tagcase' is "followscs" and 'smartcase' option is on and the pattern - contains an upper case character. The ignore-case matches are found when: - a pattern is used (starting with a "/") - for ":tselect" -- when 'tagcase' is "followic" and 'ignorecase' is off -- when 'tagcase' is "match" -- when 'tagcase' is "followscs" and the 'smartcase' option is off +- when 'tagcase' is "followic" and 'ignorecase' is on +- when 'tagcase' is "followscs" and 'ignorecase' is on or the 'smartcase' + option is on and the pattern does not contain an upper case character +- when 'tagcase' is "ignore" +- when 'tagcase' is "smart" and the patter does not contain an upper case + character Note that using ignore-case tag searching disables binary searching in the tags file, which causes a slowdown. This can be avoided by fold-case sorting @@ -300,7 +303,6 @@ message is given. *tag-preview* The tag match list can also be used in the preview window. The commands are the same as above, with a "p" prepended. -{not available when compiled without the |+quickfix| feature} *:pts* *:ptselect* :pts[elect][!] [name] Does ":tselect[!] [name]" and shows the new tag in a @@ -488,7 +490,7 @@ Some programs that generate tags files: ctags As found on most Unix systems. Only supports C. Only does the basic work. *Exuberant_ctags* -exuberant ctags This a very good one. It works for C, C++, Java, +exuberant ctags This is a very good one. It works for C, C++, Java, Fortran, Eiffel and others. It can generate tags for many items. See http://ctags.sourceforge.net. JTags For Java, in Java. It can be found at @@ -802,7 +804,7 @@ CTRL-W d Open a new window, with the cursor on the first (default: whole file). See |:search-args| for [/] and [!]. - *:che* *:checkpath* + *:che* *:chec* *:check* *:checkpath* :che[ckpath] List all the included files that could not be found. :che[ckpath]! List all the included files. diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt index e21481af17..70a0ad97c1 100644 --- a/runtime/doc/usr_05.txt +++ b/runtime/doc/usr_05.txt @@ -294,7 +294,6 @@ More information about packages can be found here: |packages|. Vim's functionality can be extended by adding plugins. A plugin is nothing more than a Vim script file that is loaded automatically when Vim starts. You can add a plugin very easily by dropping it in your plugin directory. -{not available when Vim was compiled without the |+eval| feature} There are two types of plugins: diff --git a/runtime/doc/usr_06.txt b/runtime/doc/usr_06.txt index beffb92877..360f72ec63 100644 --- a/runtime/doc/usr_06.txt +++ b/runtime/doc/usr_06.txt @@ -193,13 +193,12 @@ too slow, you might want to disable syntax highlighting for a moment: > When editing another file (or the same one) the colors will come back. - *:syn-off* If you want to stop highlighting completely use: > :syntax off This will completely disable syntax highlighting and remove it immediately for -all buffers. +all buffers. See |:syntax-off| for more details. *:syn-manual* If you want syntax highlighting only for specific files, use this: > diff --git a/runtime/doc/usr_27.txt b/runtime/doc/usr_27.txt index cd01308c6e..637523b9ee 100644 --- a/runtime/doc/usr_27.txt +++ b/runtime/doc/usr_27.txt @@ -474,19 +474,19 @@ the line break happens, because all items mentioned so far don't match a line break. To check for a line break in a specific place, use the "\n" item: > - /the\nword + /one\ntwo -This will match at a line that ends in "the" and the next line starts with -"word". To match "the word" as well, you need to match a space or a line +This will match at a line that ends in "one" and the next line starts with +"two". To match "one two" as well, you need to match a space or a line break. The item to use for it is "\_s": > - /the\_sword + /one\_stwo To allow any amount of white space: > - /the\_s\+word + /one\_s\+two -This also matches when "the " is at the end of a line and " word" at the +This also matches when "one " is at the end of a line and " two" at the start of the next one. "\s" matches white space, "\_s" matches white space or a line break. diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index a80ab963b1..c806507c3e 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -105,20 +105,21 @@ We won't explain how |:for| and |range()| work until later. Follow the links if you are impatient. -THREE KINDS OF NUMBERS +FOUR KINDS OF NUMBERS -Numbers can be decimal, hexadecimal or octal. A hexadecimal number starts -with "0x" or "0X". For example "0x1f" is decimal 31. An octal number starts -with a zero. "017" is decimal 15. Careful: don't put a zero before a decimal -number, it will be interpreted as an octal number! +Numbers can be decimal, hexadecimal, octal or binary. A hexadecimal number +starts with "0x" or "0X". For example "0x1f" is decimal 31. An octal number +starts with a zero. "017" is decimal 15. A binary number starts with "0b" or +"0B". For example "0b101" is decimal 5. Careful: don't put a zero before a +decimal number, it will be interpreted as an octal number! The ":echo" command always prints decimal numbers. Example: > :echo 0x7f 036 < 127 30 ~ -A number is made negative with a minus sign. This also works for hexadecimal -and octal numbers. A minus sign is also used for subtraction. Compare this -with the previous example: > +A number is made negative with a minus sign. This also works for hexadecimal, +octal and binary numbers. A minus sign is also used for subtraction. Compare +this with the previous example: > :echo 0x7f -036 < 97 ~ @@ -612,6 +613,7 @@ String manipulation: *string-functions* repeat() repeat a string multiple times eval() evaluate a string expression execute() execute an Ex command and get the output + win_execute() like execute() but in a specified window trim() trim characters from a string List manipulation: *list-functions* diff --git a/runtime/doc/usr_toc.txt b/runtime/doc/usr_toc.txt index 148dd161ac..69846f1bcf 100644 --- a/runtime/doc/usr_toc.txt +++ b/runtime/doc/usr_toc.txt @@ -99,12 +99,13 @@ Read this from start to end to learn the essential commands. |usr_05.txt| Set your settings |05.1| The vimrc file |05.2| The example vimrc file explained - |05.3| Simple mappings - |05.4| Adding a package - |05.5| Adding a plugin - |05.6| Adding a help file - |05.7| The option window - |05.8| Often used options + |05.3| The defaults.vim file explained + |05.4| Simple mappings + |05.5| Adding a package + |05.6| Adding a plugin + |05.7| Adding a help file + |05.8| The option window + |05.9| Often used options |usr_06.txt| Using syntax highlighting |06.1| Switching it on diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index 0429341b6f..32551815b0 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -283,7 +283,7 @@ g8 Print the hex values of the bytes used in the *:!!* :!! Repeat last ":!{cmd}". - *:ve* *:version* + *:ve* *:ver* *:version* :ve[rsion] Print editor version and build information. See also |feature-compile|. @@ -451,7 +451,6 @@ or an autocommand will also display where it was last defined. If it was defined manually then there will be no "Last set" message. When it was defined while executing a function, user command or autocommand, the script in which it was defined is reported. -{not available when compiled without the |+eval| feature} *K* [count]K Run a program to lookup the keyword under the diff --git a/runtime/doc/visual.txt b/runtime/doc/visual.txt index 2062696a4e..ccbbc092ec 100644 --- a/runtime/doc/visual.txt +++ b/runtime/doc/visual.txt @@ -292,8 +292,6 @@ mode. ============================================================================== 5. Blockwise operators *blockwise-operators* -{not available when compiled without the |+visualextra| feature} - Reminder: Use 'virtualedit' to be able to select blocks that start or end after the end of a line or halfway through a tab. diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index b93945a340..76bb096ee3 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -138,6 +138,10 @@ CTRL-W CTRL-S *CTRL-W_CTRL-S* Note: CTRL-S does not work on all terminals and might block further input, use CTRL-Q to get going again. Also see |++opt| and |+cmd|. + *E242* + Be careful when splitting a window in an autocommand, it may + mess up the window layout if this happens while making other + window layout changes. CTRL-W CTRL-V *CTRL-W_CTRL-V* CTRL-W v *CTRL-W_v* @@ -192,7 +196,7 @@ CTRL-W CTRL_N *CTRL-W_CTRL-N* :[N]sv[iew] [++opt] [+cmd] {file} *:sv* *:sview* *splitview* Same as ":split", but set 'readonly' option for this buffer. -:[N]sf[ind] [++opt] [+cmd] {file} *:sf* *:sfind* *splitfind* +:[N]sf[ind] [++opt] [+cmd] {file} *:sf* *:sfi* *:sfind* *splitfind* Same as ":split", but search for {file} in 'path' like in |:find|. Doesn't split if {file} is not found. @@ -405,7 +409,6 @@ CTRL-W CTRL-P Go to previous (last accessed) window. *CTRL-W_P* *E441* CTRL-W P Go to preview window. When there is no preview window this is an error. - {not available when compiled without the |+quickfix| feature} If Visual mode is active and the new window is not for the same buffer, the Visual mode is ended. If the window is on the same buffer, the cursor @@ -635,6 +638,8 @@ can also get to them with the buffer list commands, like ":bnext". |:vertical| was prepended). Buf/Win Enter/Leave autocommands are not executed for the new windows here, that's only done when they are really entered. + If autocommands change the window layout while this command is + busy an error will be given. *E249* :[N]sa[rgument][!] [++opt] [+cmd] [N] *:sa* *:sargument* Short for ":split | argument [N]": split window and go to Nth @@ -782,30 +787,22 @@ CTRL-W CTRL-F Split current window in two. Edit file name under cursor. If the name is a hypertext link that looks like "type://machine/path", only "/path" is used. If a count is given, the count'th matching file is edited. - {not available when the |+file_in_path| feature was disabled - at compile time} CTRL-W F *CTRL-W_F* Split current window in two. Edit file name under cursor and jump to the line number following the file name. See |gF| for details on how the line number is obtained. - {not available when the |+file_in_path| feature was disabled - at compile time} CTRL-W gf *CTRL-W_gf* Open a new tab page and edit the file name under the cursor. Like "tab split" and "gf", but the new tab page isn't created if the file does not exist. - {not available when the |+file_in_path| feature was disabled - at compile time} CTRL-W gF *CTRL-W_gF* Open a new tab page and edit the file name under the cursor and jump to the line number following the file name. Like "tab split" and "gF", but the new tab page isn't created if the file does not exist. - {not available when the |+file_in_path| feature was disabled - at compile time} CTRL-W gt *CTRL-W_gt* Go to next tab page, same as `gt`. @@ -822,7 +819,6 @@ the keyword under the cursor. The preview window is a special window to show (preview) another file. It is normally a small window used to show an include file or definition of a function. -{not available when compiled without the |+quickfix| feature} There can be only one preview window (per tab page). It is created with one of the commands below. The 'previewheight' option can be set to specify the @@ -949,7 +945,6 @@ is no word under the cursor, and a few other things: > A hidden buffer is not displayed in a window, but is still loaded into memory. This makes it possible to jump from file to file, without the need to read or write the file every time you get another buffer in a window. -{not available when compiled without the |+listcmds| feature} *:buffer-!* If the option 'hidden' ('hid') is set, abandoned buffers are kept for all @@ -1154,7 +1149,6 @@ list of buffers. |unlisted-buffer| the way when you're browsing code/text buffers. The next three commands also work like this. - *:sbn* *:sbnext* :[N]sbn[ext] [+cmd] [N] Split window and go to [N]th next buffer in buffer list. @@ -1175,7 +1169,7 @@ list of buffers. |unlisted-buffer| Uses 'switchbuf'. Also see |+cmd|. -:br[ewind][!] [+cmd] *:br* *:brewind* +:br[ewind][!] [+cmd] *:br* *:bre* *:brewind* Go to first buffer in buffer list. If the buffer list is empty, go to the first unlisted buffer. See |:buffer-!| for [!]. diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 6504f610a0..473c169061 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -703,6 +703,9 @@ au BufNewFile,BufRead *.t.html setf tilde " HTML (.shtml and .stm for server side) au BufNewFile,BufRead *.html,*.htm,*.shtml,*.stm call dist#ft#FThtml() +" Vue.js Single File Component +au BufNewFile,BufRead *.vue setf vuejs + " HTML with Ruby - eRuby au BufNewFile,BufRead *.erb,*.rhtml setf eruby diff --git a/runtime/ftplugin/qf.vim b/runtime/ftplugin/qf.vim index 80e86c4d16..a3dfce0e76 100644 --- a/runtime/ftplugin/qf.vim +++ b/runtime/ftplugin/qf.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: Vim's quickfix window " Maintainer: Lech Lorens <Lech.Lorens@gmail.com> -" Last Changed: 30 Apr 2012 +" Last Change: 2019 Jul 15 if exists("b:did_ftplugin") finish @@ -10,10 +10,12 @@ endif " Don't load another plugin for this buffer let b:did_ftplugin = 1 -let b:undo_ftplugin = "set stl<" +if !get(g:, 'qf_disable_statusline') + let b:undo_ftplugin = "set stl<" -" Display the command that produced the list in the quickfix window: -setlocal stl=%t%{exists('w:quickfix_title')?\ '\ '.w:quickfix_title\ :\ ''}\ %=%-15(%l,%c%V%)\ %P + " Display the command that produced the list in the quickfix window: + setlocal stl=%t%{exists('w:quickfix_title')?\ '\ '.w:quickfix_title\ :\ ''}\ %=%-15(%l,%c%V%)\ %P +endif function! s:setup_toc() abort if get(w:, 'quickfix_title') !~# '\<TOC$' || &syntax != 'qf' diff --git a/runtime/indent/php.vim b/runtime/indent/php.vim index 5dee6c9f47..67a1327dc9 100644 --- a/runtime/indent/php.vim +++ b/runtime/indent/php.vim @@ -1,10 +1,10 @@ " Vim indent file " Language: PHP -" Author: John Wellesz <John.wellesz (AT) teaser (DOT) fr> -" URL: http://www.2072productions.com/vim/indent/php.vim +" Author: John Wellesz <John.wellesz (AT) gmail (DOT) com> +" URL: https://www.2072productions.com/vim/indent/php.vim " Home: https://github.com/2072/PHP-Indenting-for-VIm -" Last Change: 2018 May 18th -" Version: 1.66 +" Last Change: 2019 Jully 21st +" Version: 1.70 " " " Type :help php-indent for available options @@ -19,7 +19,7 @@ " NOTE: This script must be used with PHP syntax ON and with the php syntax " script by Lutz Eymers (http://www.isp.de/data/php.vim ) or with the -" script by Peter Hodge (http://www.vim.org/scripts/script.php?script_id=1571 ) +" script by Peter Hodge (https://www.vim.org/scripts/script.php?script_id=1571 ) " the later is bunbdled by default with Vim 7. " " @@ -41,7 +41,6 @@ " silently remove them when VIM load this script (at each bufread). - if exists("b:did_indent") finish endif @@ -95,7 +94,17 @@ else let b:PHP_vintage_case_default_indent = 0 endif +if exists("PHP_IndentFunctionCallParameters") + let b:PHP_IndentFunctionCallParameters = PHP_IndentFunctionCallParameters +else + let b:PHP_IndentFunctionCallParameters = 0 +endif +if exists("PHP_IndentFunctionDeclarationParameters") + let b:PHP_IndentFunctionDeclarationParameters = PHP_IndentFunctionDeclarationParameters +else + let b:PHP_IndentFunctionDeclarationParameters = 0 +endif let b:PHP_lastindented = 0 let b:PHP_indentbeforelast = 0 @@ -129,15 +138,19 @@ endif if exists("*GetPhpIndent") call ResetPhpOptions() - finish + finish " XXX -- comment this line for easy dev endif -let s:PHP_validVariable = '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' -let s:notPhpHereDoc = '\%(break\|return\|continue\|exit\|die\|else\)' -let s:blockstart = '\%(\%(\%(}\s*\)\=else\%(\s\+\)\=\)\=if\>\|\%(}\s*\)\?else\>\|do\>\|while\>\|switch\>\|case\>\|default\>\|for\%(each\)\=\>\|declare\>\|class\>\|trait\>\|use\>\|interface\>\|abstract\>\|final\>\|try\>\|\%(}\s*\)\=catch\>\|\%(}\s*\)\=finally\>\)' -let s:functionDecl = '\<function\>\%(\s\+&\='.s:PHP_validVariable.'\)\=\s*(.*' let s:endline = '\s*\%(//.*\|#.*\|/\*.*\*/\s*\)\=$' +let s:PHP_validVariable = '[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*' +let s:notPhpHereDoc = '\%(break\|return\|continue\|exit\|die\|else\|end\%(if\|while\|for\|foreach\|switch\)\)' +let s:blockstart = '\%(\%(\%(}\s*\)\=else\%(\s\+\)\=\)\=if\>\|\%(}\s*\)\?else\>\|do\>\|while\>\|switch\>\|case\>\|default\>\|for\%(each\)\=\>\|declare\>\|class\>\|trait\>\|\%()\s*\)\=use\>\|interface\>\|abstract\>\|final\>\|try\>\|\%(}\s*\)\=catch\>\|\%(}\s*\)\=finally\>\)' +let s:functionDeclPrefix = '\<function\>\%(\s\+&\='.s:PHP_validVariable.'\)\=\s*(' +let s:functionDecl = s:functionDeclPrefix.'.*' +let s:multilineFunctionDecl = s:functionDeclPrefix.s:endline +let s:arrayDecl = '\<array\>\s*(.*' +let s:multilineFunctionCall = s:PHP_validVariable.'\s*('.s:endline let s:unstated = '\%(^\s*'.s:blockstart.'.*)\|\%(//.*\)\@<!\<e'.'lse\>\)'.s:endline @@ -210,7 +223,7 @@ function! GetLastRealCodeLNum(startline) " {{{ while getline(lnum) !~? tofind && lnum > 1 let lnum = lnum - 1 endwhile - elseif lastline =~ '^[^''"`]*[''"`][;,]'.s:endline + elseif lastline =~ '^\s*[''"`][;,]' || (lastline =~ '^[^''"`]*[''"`][;,]'.s:endline && IslinePHP(lnum, "") == "SpecStringEntrails") let tofind=substitute( lastline, '^.*\([''"`]\)[;,].*$', '^[^\1]\\+[\1]$\\|^[^\1]\\+[=([]\\s*[\1]', '') let trylnum = lnum @@ -289,17 +302,23 @@ function! FindOpenBracket(lnum, blockStarter) " {{{ endfun " }}} let s:blockChars = {'{':1, '[': 1, '(': 1, ')':-1, ']':-1, '}':-1} +let s:blockCharsLUT = {'{':'{', '}':'{', '[':'[', ']':'[', '(':'(', ')':'('} function! BalanceDirection (str) - let balance = 0 + let balance = {'{':0, '[': 0, '(': 0, 'none':0} + let director = 'none' for c in split(a:str, '\zs') if has_key(s:blockChars, c) - let balance += s:blockChars[c] + let balance[s:blockCharsLUT[c]] += s:blockChars[c] + + if balance[s:blockCharsLUT[c]] + let director = s:blockCharsLUT[c] + endif endif endfor - return balance + return balance[director] endfun function! StripEndlineComments (line) @@ -308,7 +327,8 @@ endfun function! FindArrowIndent (lnum) " {{{ - let parrentArrowPos = 0 + let parrentArrowPos = -1 + let cursorPos = -1 let lnum = a:lnum while lnum > 1 let last_line = getline(lnum) @@ -316,31 +336,46 @@ function! FindArrowIndent (lnum) " {{{ let parrentArrowPos = indent(a:lnum) break else - call cursor(lnum, 1) - let cleanedLnum = StripEndlineComments(last_line) - if cleanedLnum =~ '->' - if ! b:PHP_noArrowMatching - let parrentArrowPos = searchpos('->', 'W', lnum)[1] - 1 - else - let parrentArrowPos = indent(lnum) + shiftwidth() - endif + + if b:PHP_noArrowMatching break - elseif cleanedLnum =~ ')'.s:endline && BalanceDirection(last_line) < 0 - call searchpos(')'.s:endline, 'cW', lnum) - let openedparent = searchpair('(', '', ')', 'bW', 'Skippmatch()') - if openedparent != lnum - let lnum = openedparent + endif + + let cleanedLnum = StripEndlineComments(last_line) + + if cleanedLnum =~ ')'.s:endline + if BalanceDirection(cleanedLnum) <= 0 + call cursor(lnum, 1) + call searchpos(')'.s:endline, 'cW', lnum) + let openedparent = searchpair('(', '', ')', 'bW', 'Skippmatch()') + let cursorPos = col(".") + if openedparent != lnum + let lnum = openedparent + continue + else + endif else - let openedparent = -1 - endif + let parrentArrowPos = -1 + break + end + endif + + if cleanedLnum =~ '->' + call cursor(lnum, cursorPos == -1 ? strwidth(cleanedLnum) : cursorPos) + let parrentArrowPos = searchpos('->', 'cWb', lnum)[1] - 1 + break else - let parrentArrowPos = indent(lnum) + shiftwidth() + let parrentArrowPos = -1 break endif endif endwhile + if parrentArrowPos == -1 + let parrentArrowPos = indent(lnum) + shiftwidth() + end + return parrentArrowPos endfun "}}} @@ -432,7 +467,7 @@ function! IslinePHP (lnum, tofind) " {{{ let synname = synIDattr(synID(a:lnum, coltotest, 0), "name") if synname ==? 'phpStringSingle' || synname ==? 'phpStringDouble' || synname ==? 'phpBacktick' - if cline !~ '^\s*[''"`]' + if cline !~ '^\s*[''"`]' " ??? XXX return "SpecStringEntrails" else return synname @@ -471,7 +506,7 @@ endfunc call ResetPhpOptions() function! GetPhpIndentVersion() - return "1.66-bundle" + return "1.70-bundle" endfun function! GetPhpIndent() @@ -615,7 +650,7 @@ function! GetPhpIndent() let b:InPHPcode_and_script = 1 endif - elseif last_line =~ '^[^''"`]\+[''"`]$' " a string identifier with nothing after it and no other string identifier before + elseif last_line =~ '^[^''"`]\+[''"`]$' && last_line !~ '^\s*\%(//\|#\|/\*.*\*/\s*$\)' " a string identifier with nothing after it and no other string identifier before let b:InPHPcode = -1 let b:InPHPcode_tofind = substitute( last_line, '^.*\([''"`]\).*$', '^[^\1]*\1[;,]$', '') elseif last_line =~? '<<<\s*[''"]\=\a\w*[''"]\=$' @@ -723,7 +758,7 @@ function! GetPhpIndent() endif - if last_line =~ '[;}]'.endline && last_line !~ '^[)\]]' && last_line !~# s:defaultORcase + if last_line =~ '[;}]'.endline && last_line !~ '^[)\]]' && last_line !~# s:defaultORcase && last_line !~ '^\s*[''"`][;,]' if ind==b:PHP_default_indenting return b:PHP_default_indenting + addSpecial elseif b:PHP_indentinghuge && ind==b:PHP_CurrentIndentLevel && cline !~# '^\s*\%(else\|\%(case\|default\).*:\|[})];\=\)' && last_line !~# '^\s*\%(\%(}\s*\)\=else\)' && getline(GetLastRealCodeLNum(lnum - 1))=~';'.endline @@ -869,6 +904,14 @@ function! GetPhpIndent() let ind = ind + shiftwidth() endif + if b:PHP_IndentFunctionCallParameters && last_line =~ s:multilineFunctionCall && last_line !~ s:structureHead && last_line !~ s:arrayDecl + let ind = ind + b:PHP_IndentFunctionCallParameters * shiftwidth() + endif + + if b:PHP_IndentFunctionDeclarationParameters && last_line =~ s:multilineFunctionDecl + let ind = ind + b:PHP_IndentFunctionDeclarationParameters * shiftwidth() + endif + if b:PHP_BracesAtCodeLevel || b:PHP_vintage_case_default_indent == 1 let b:PHP_CurrentIndentLevel = ind @@ -897,10 +940,15 @@ function! GetPhpIndent() endif if cline =~ '^\s*[)\]];\=' - let ind = ind - shiftwidth() - endif + call cursor(v:lnum, 1) + call searchpos('[)\]]', 'cW') + let matchedBlockChar = cline[col('.')-1] + let openedparent = searchpair('\M'.s:blockCharsLUT[matchedBlockChar], '', '\M'.matchedBlockChar, 'bW', 'Skippmatch()') + if openedparent != v:lnum + let ind = indent(openedparent) + endif - if last_line =~ '^\s*->' && last_line !~? s:structureHead && BalanceDirection(last_line) <= 0 + elseif last_line =~ '^\s*->' && last_line !~? s:structureHead && BalanceDirection(last_line) <= 0 let ind = ind - shiftwidth() endif diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim index 148a86ed67..3df6abbf97 100644 --- a/runtime/indent/sh.vim +++ b/runtime/indent/sh.vim @@ -3,10 +3,13 @@ " Maintainer: Christian Brabandt <cb@256bit.org> " Original Author: Nikolai Weibull <now@bitwi.se> " Previous Maintainer: Peter Aronoff <telemachus@arpinum.org> -" Latest Revision: 2019-04-27 +" Latest Revision: 2019-07-26 " License: Vim (see :h license) " Repository: https://github.com/chrisbra/vim-sh-indent " Changelog: +" 20190726 - Correctly skip if keywords in syntax comments +" (issue #17) +" 20190603 - Do not indent in zsh filetypes with an `if` in comments " 20190428 - De-indent fi correctly when typing with " https://github.com/chrisbra/vim-sh-indent/issues/15 " 20190325 - Indent fi; correctly @@ -80,8 +83,9 @@ function! GetShIndent() let ind = indent(lnum) " Check contents of previous lines + " should not apply to e.g. commented lines if line =~ '^\s*\%(if\|then\|do\|else\|elif\|case\|while\|until\|for\|select\|foreach\)\>' || - \ (&ft is# 'zsh' && line =~ '\<\%(if\|then\|do\|else\|elif\|case\|while\|until\|for\|select\|foreach\)\>') + \ (&ft is# 'zsh' && line =~ '^\s*\<\%(if\|then\|do\|else\|elif\|case\|while\|until\|for\|select\|foreach\)\>') if !s:is_end_expression(line) let ind += s:indent_value('default') endif @@ -129,7 +133,8 @@ function! GetShIndent() " Current line is a endif line, so get indent from start of "if condition" line " TODO: should we do the same for other "end" lines? if curline =~ '^\s*\%(fi\);\?\s*\%(#.*\)\=$' - let previous_line = searchpair('\<if\>', '', '\<fi\>\zs', 'bnW') + let ind = indent(v:lnum) + let previous_line = searchpair('\<if\>', '', '\<fi\>\zs', 'bnW', 'synIDattr(synID(line("."),col("."), 1),"name") =~? "comment"') if previous_line > 0 let ind = indent(previous_line) endif diff --git a/runtime/indent/typescript.vim b/runtime/indent/typescript.vim new file mode 100644 index 0000000000..69accaa054 --- /dev/null +++ b/runtime/indent/typescript.vim @@ -0,0 +1,503 @@ +" Vim indent file +" Language: TypeScript +" Maintainer: See https://github.com/HerringtonDarkholme/yats.vim +" Last Change: 2019 Jun 06 +" Acknowledgement: Based off of vim-ruby maintained by Nikolai Weibull http://vim-ruby.rubyforge.org + +" 0. Initialization {{{1 +" ================= + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal nosmartindent + +" Now, set up our indentation expression and keys that trigger it. +setlocal indentexpr=GetTypescriptIndent() +setlocal formatexpr=Fixedgq(v:lnum,v:count) +setlocal indentkeys=0{,0},0),0],0\,,!^F,o,O,e + +" Only define the function once. +if exists("*GetTypescriptIndent") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +" 1. Variables {{{1 +" ============ + +let s:js_keywords = '^\s*\(break\|case\|catch\|continue\|debugger\|default\|delete\|do\|else\|finally\|for\|function\|if\|in\|instanceof\|new\|return\|switch\|this\|throw\|try\|typeof\|var\|void\|while\|with\)' + +" Regex of syntax group names that are or delimit string or are comments. +let s:syng_strcom = 'string\|regex\|comment\c' + +" Regex of syntax group names that are strings. +let s:syng_string = 'regex\c' + +" Regex of syntax group names that are strings or documentation. +let s:syng_multiline = 'comment\c' + +" Regex of syntax group names that are line comment. +let s:syng_linecom = 'linecomment\c' + +" Expression used to check whether we should skip a match with searchpair(). +let s:skip_expr = "synIDattr(synID(line('.'),col('.'),1),'name') =~ '".s:syng_strcom."'" + +let s:line_term = '\s*\%(\%(\/\/\).*\)\=$' + +" Regex that defines continuation lines, not including (, {, or [. +let s:continuation_regex = '\%([\\*+/.:]\|\%(<%\)\@<![=-]\|\W[|&?]\|||\|&&\|[^=]=[^=].*,\)' . s:line_term + +" Regex that defines continuation lines. +" TODO: this needs to deal with if ...: and so on +let s:msl_regex = s:continuation_regex + +let s:one_line_scope_regex = '\<\%(if\|else\|for\|while\)\>[^{;]*' . s:line_term + +" Regex that defines blocks. +let s:block_regex = '\%([{[]\)\s*\%(|\%([*@]\=\h\w*,\=\s*\)\%(,\s*[*@]\=\h\w*\)*|\)\=' . s:line_term + +let s:var_stmt = '^\s*var' + +let s:comma_first = '^\s*,' +let s:comma_last = ',\s*$' + +let s:ternary = '^\s\+[?|:]' +let s:ternary_q = '^\s\+?' + +" 2. Auxiliary Functions {{{1 +" ====================== + +" Check if the character at lnum:col is inside a string, comment, or is ascii. +function s:IsInStringOrComment(lnum, col) + return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_strcom +endfunction + +" Check if the character at lnum:col is inside a string. +function s:IsInString(lnum, col) + return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_string +endfunction + +" Check if the character at lnum:col is inside a multi-line comment. +function s:IsInMultilineComment(lnum, col) + return !s:IsLineComment(a:lnum, a:col) && synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_multiline +endfunction + +" Check if the character at lnum:col is a line comment. +function s:IsLineComment(lnum, col) + return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_linecom +endfunction + +" Find line above 'lnum' that isn't empty, in a comment, or in a string. +function s:PrevNonBlankNonString(lnum) + let in_block = 0 + let lnum = prevnonblank(a:lnum) + while lnum > 0 + " Go in and out of blocks comments as necessary. + " If the line isn't empty (with opt. comment) or in a string, end search. + let line = getline(lnum) + if line =~ '/\*' + if in_block + let in_block = 0 + else + break + endif + elseif !in_block && line =~ '\*/' + let in_block = 1 + elseif !in_block && line !~ '^\s*\%(//\).*$' && !(s:IsInStringOrComment(lnum, 1) && s:IsInStringOrComment(lnum, strlen(line))) + break + endif + let lnum = prevnonblank(lnum - 1) + endwhile + return lnum +endfunction + +" Find line above 'lnum' that started the continuation 'lnum' may be part of. +function s:GetMSL(lnum, in_one_line_scope) + " Start on the line we're at and use its indent. + let msl = a:lnum + let lnum = s:PrevNonBlankNonString(a:lnum - 1) + while lnum > 0 + " If we have a continuation line, or we're in a string, use line as MSL. + " Otherwise, terminate search as we have found our MSL already. + let line = getline(lnum) + let col = match(line, s:msl_regex) + 1 + if (col > 0 && !s:IsInStringOrComment(lnum, col)) || s:IsInString(lnum, strlen(line)) + let msl = lnum + else + " Don't use lines that are part of a one line scope as msl unless the + " flag in_one_line_scope is set to 1 + " + if a:in_one_line_scope + break + end + let msl_one_line = s:Match(lnum, s:one_line_scope_regex) + if msl_one_line == 0 + break + endif + endif + let lnum = s:PrevNonBlankNonString(lnum - 1) + endwhile + return msl +endfunction + +function s:RemoveTrailingComments(content) + let single = '\/\/\(.*\)\s*$' + let multi = '\/\*\(.*\)\*\/\s*$' + return substitute(substitute(a:content, single, '', ''), multi, '', '') +endfunction + +" Find if the string is inside var statement (but not the first string) +function s:InMultiVarStatement(lnum) + let lnum = s:PrevNonBlankNonString(a:lnum - 1) + +" let type = synIDattr(synID(lnum, indent(lnum) + 1, 0), 'name') + + " loop through previous expressions to find a var statement + while lnum > 0 + let line = getline(lnum) + + " if the line is a js keyword + if (line =~ s:js_keywords) + " check if the line is a var stmt + " if the line has a comma first or comma last then we can assume that we + " are in a multiple var statement + if (line =~ s:var_stmt) + return lnum + endif + + " other js keywords, not a var + return 0 + endif + + let lnum = s:PrevNonBlankNonString(lnum - 1) + endwhile + + " beginning of program, not a var + return 0 +endfunction + +" Find line above with beginning of the var statement or returns 0 if it's not +" this statement +function s:GetVarIndent(lnum) + let lvar = s:InMultiVarStatement(a:lnum) + let prev_lnum = s:PrevNonBlankNonString(a:lnum - 1) + + if lvar + let line = s:RemoveTrailingComments(getline(prev_lnum)) + + " if the previous line doesn't end in a comma, return to regular indent + if (line !~ s:comma_last) + return indent(prev_lnum) - shiftwidth() + else + return indent(lvar) + shiftwidth() + endif + endif + + return -1 +endfunction + + +" Check if line 'lnum' has more opening brackets than closing ones. +function s:LineHasOpeningBrackets(lnum) + let open_0 = 0 + let open_2 = 0 + let open_4 = 0 + let line = getline(a:lnum) + let pos = match(line, '[][(){}]', 0) + while pos != -1 + if !s:IsInStringOrComment(a:lnum, pos + 1) + let idx = stridx('(){}[]', line[pos]) + if idx % 2 == 0 + let open_{idx} = open_{idx} + 1 + else + let open_{idx - 1} = open_{idx - 1} - 1 + endif + endif + let pos = match(line, '[][(){}]', pos + 1) + endwhile + return (open_0 > 0) . (open_2 > 0) . (open_4 > 0) +endfunction + +function s:Match(lnum, regex) + let col = match(getline(a:lnum), a:regex) + 1 + return col > 0 && !s:IsInStringOrComment(a:lnum, col) ? col : 0 +endfunction + +function s:IndentWithContinuation(lnum, ind, width) + " Set up variables to use and search for MSL to the previous line. + let p_lnum = a:lnum + let lnum = s:GetMSL(a:lnum, 1) + let line = getline(lnum) + + " If the previous line wasn't a MSL and is continuation return its indent. + " TODO: the || s:IsInString() thing worries me a bit. + if p_lnum != lnum + if s:Match(p_lnum,s:continuation_regex)||s:IsInString(p_lnum,strlen(line)) + return a:ind + endif + endif + + " Set up more variables now that we know we aren't continuation bound. + let msl_ind = indent(lnum) + + " If the previous line ended with [*+/.-=], start a continuation that + " indents an extra level. + if s:Match(lnum, s:continuation_regex) + if lnum == p_lnum + return msl_ind + a:width + else + return msl_ind + endif + endif + + return a:ind +endfunction + +function s:InOneLineScope(lnum) + let msl = s:GetMSL(a:lnum, 1) + if msl > 0 && s:Match(msl, s:one_line_scope_regex) + return msl + endif + return 0 +endfunction + +function s:ExitingOneLineScope(lnum) + let msl = s:GetMSL(a:lnum, 1) + if msl > 0 + " if the current line is in a one line scope .. + if s:Match(msl, s:one_line_scope_regex) + return 0 + else + let prev_msl = s:GetMSL(msl - 1, 1) + if s:Match(prev_msl, s:one_line_scope_regex) + return prev_msl + endif + endif + endif + return 0 +endfunction + +" 3. GetTypescriptIndent Function {{{1 +" ========================= + +function GetTypescriptIndent() + " 3.1. Setup {{{2 + " ---------- + + " Set up variables for restoring position in file. Could use v:lnum here. + let vcol = col('.') + + " 3.2. Work on the current line {{{2 + " ----------------------------- + + let ind = -1 + " Get the current line. + let line = getline(v:lnum) + " previous nonblank line number + let prevline = prevnonblank(v:lnum - 1) + + " If we got a closing bracket on an empty line, find its match and indent + " according to it. For parentheses we indent to its column - 1, for the + " others we indent to the containing line's MSL's level. Return -1 if fail. + let col = matchend(line, '^\s*[],})]') + if col > 0 && !s:IsInStringOrComment(v:lnum, col) + call cursor(v:lnum, col) + + let lvar = s:InMultiVarStatement(v:lnum) + if lvar + let prevline_contents = s:RemoveTrailingComments(getline(prevline)) + + " check for comma first + if (line[col - 1] =~ ',') + " if the previous line ends in comma or semicolon don't indent + if (prevline_contents =~ '[;,]\s*$') + return indent(s:GetMSL(line('.'), 0)) + " get previous line indent, if it's comma first return prevline indent + elseif (prevline_contents =~ s:comma_first) + return indent(prevline) + " otherwise we indent 1 level + else + return indent(lvar) + shiftwidth() + endif + endif + endif + + + let bs = strpart('(){}[]', stridx(')}]', line[col - 1]) * 2, 2) + if searchpair(escape(bs[0], '\['), '', bs[1], 'bW', s:skip_expr) > 0 + if line[col-1]==')' && col('.') != col('$') - 1 + let ind = virtcol('.')-1 + else + let ind = indent(s:GetMSL(line('.'), 0)) + endif + endif + return ind + endif + + " If the line is comma first, dedent 1 level + if (getline(prevline) =~ s:comma_first) + return indent(prevline) - shiftwidth() + endif + + if (line =~ s:ternary) + if (getline(prevline) =~ s:ternary_q) + return indent(prevline) + else + return indent(prevline) + shiftwidth() + endif + endif + + " If we are in a multi-line comment, cindent does the right thing. + if s:IsInMultilineComment(v:lnum, 1) && !s:IsLineComment(v:lnum, 1) + return cindent(v:lnum) + endif + + " Check for multiple var assignments +" let var_indent = s:GetVarIndent(v:lnum) +" if var_indent >= 0 +" return var_indent +" endif + + " 3.3. Work on the previous line. {{{2 + " ------------------------------- + + " If the line is empty and the previous nonblank line was a multi-line + " comment, use that comment's indent. Deduct one char to account for the + " space in ' */'. + if line =~ '^\s*$' && s:IsInMultilineComment(prevline, 1) + return indent(prevline) - 1 + endif + + " Find a non-blank, non-multi-line string line above the current line. + let lnum = s:PrevNonBlankNonString(v:lnum - 1) + + " If the line is empty and inside a string, use the previous line. + if line =~ '^\s*$' && lnum != prevline + return indent(prevnonblank(v:lnum)) + endif + + " At the start of the file use zero indent. + if lnum == 0 + return 0 + endif + + " Set up variables for current line. + let line = getline(lnum) + let ind = indent(lnum) + + " If the previous line ended with a block opening, add a level of indent. + if s:Match(lnum, s:block_regex) + return indent(s:GetMSL(lnum, 0)) + shiftwidth() + endif + + " If the previous line contained an opening bracket, and we are still in it, + " add indent depending on the bracket type. + if line =~ '[[({]' + let counts = s:LineHasOpeningBrackets(lnum) + if counts[0] == '1' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 + if col('.') + 1 == col('$') + return ind + shiftwidth() + else + return virtcol('.') + endif + elseif counts[1] == '1' || counts[2] == '1' + return ind + shiftwidth() + else + call cursor(v:lnum, vcol) + end + endif + + " 3.4. Work on the MSL line. {{{2 + " -------------------------- + + let ind_con = ind + let ind = s:IndentWithContinuation(lnum, ind_con, shiftwidth()) + + " }}}2 + " + " + let ols = s:InOneLineScope(lnum) + if ols > 0 + let ind = ind + shiftwidth() + else + let ols = s:ExitingOneLineScope(lnum) + while ols > 0 && ind > 0 + let ind = ind - shiftwidth() + let ols = s:InOneLineScope(ols - 1) + endwhile + endif + + return ind +endfunction + +" }}}1 + +let &cpo = s:cpo_save +unlet s:cpo_save + +function! Fixedgq(lnum, count) + let l:tw = &tw ? &tw : 80; + + let l:count = a:count + let l:first_char = indent(a:lnum) + 1 + + if mode() == 'i' " gq was not pressed, but tw was set + return 1 + endif + + " This gq is only meant to do code with strings, not comments + if s:IsLineComment(a:lnum, l:first_char) || s:IsInMultilineComment(a:lnum, l:first_char) + return 1 + endif + + if len(getline(a:lnum)) < l:tw && l:count == 1 " No need for gq + return 1 + endif + + " Put all the lines on one line and do normal spliting after that + if l:count > 1 + while l:count > 1 + let l:count -= 1 + normal J + endwhile + endif + + let l:winview = winsaveview() + + call cursor(a:lnum, l:tw + 1) + let orig_breakpoint = searchpairpos(' ', '', '\.', 'bcW', '', a:lnum) + call cursor(a:lnum, l:tw + 1) + let breakpoint = searchpairpos(' ', '', '\.', 'bcW', s:skip_expr, a:lnum) + + " No need for special treatment, normal gq handles edgecases better + if breakpoint[1] == orig_breakpoint[1] + call winrestview(l:winview) + return 1 + endif + + " Try breaking after string + if breakpoint[1] <= indent(a:lnum) + call cursor(a:lnum, l:tw + 1) + let breakpoint = searchpairpos('\.', '', ' ', 'cW', s:skip_expr, a:lnum) + endif + + + if breakpoint[1] != 0 + call feedkeys("r\<CR>") + else + let l:count = l:count - 1 + endif + + " run gq on new lines + if l:count == 1 + call feedkeys("gqq") + endif + + return 0 +endfunction diff --git a/runtime/indent/xml.vim b/runtime/indent/xml.vim index ad22de1d50..883af98563 100644 --- a/runtime/indent/xml.vim +++ b/runtime/indent/xml.vim @@ -1,9 +1,10 @@ " Language: xml " Repository: https://github.com/chrisbra/vim-xml-ftplugin -" Last Changed: Feb 04, 2019 +" Last Changed: July 27, 2019 " Maintainer: Christian Brabandt <cb@256bit.org> " Previous Maintainer: Johannes Zellner <johannes@zellner.org> " Last Change: +" 20190726 - Correctly handle non-tagged data " 20190204 - correctly handle wrap tags " https://github.com/chrisbra/vim-xml-ftplugin/issues/5 " 20190128 - Make sure to find previous tag @@ -33,6 +34,8 @@ set cpo&vim " Attention: Parameter use_syntax_check is used by the docbk.vim indent script setlocal indentexpr=XmlIndentGet(v:lnum,1) setlocal indentkeys=o,O,*<Return>,<>>,<<>,/,{,},!^F +" autoindent: used when the indentexpr returns -1 +setlocal autoindent if !exists('b:xml_indent_open') let b:xml_indent_open = '.\{-}<[:A-Z_a-z]' @@ -103,37 +106,43 @@ fun! XmlIndentGet(lnum, use_syntax_check) return 0 endif " Find previous line with a tag (regardless whether open or closed, - " but always start restrict the match to a line before the current one + " but always restrict the match to a line before the current one " Note: xml declaration: <?xml version="1.0"?> " won't be found, as it is not a legal tag name - let ptag_pattern = '\%(.\{-}<[/:A-Z_a-z]\)'. '\%(\&\%<'. line('.').'l\)' + let ptag_pattern = '\%(.\{-}<[/:A-Z_a-z]\)'. '\%(\&\%<'. a:lnum .'l\)' let ptag = search(ptag_pattern, 'bnW') " no previous tag if ptag == 0 return 0 endif - let syn_name = '' + let pline = getline(ptag) + let pind = indent(ptag) + + let syn_name_start = '' " Syntax element at start of line (excluding whitespace) + let syn_name_end = '' " Syntax element at end of line + let curline = getline(a:lnum) if a:use_syntax_check let check_lnum = <SID>XmlIndentSynCheck(ptag) let check_alnum = <SID>XmlIndentSynCheck(a:lnum) if check_lnum == 0 || check_alnum == 0 return indent(a:lnum) endif - let syn_name = synIDattr(synID(a:lnum, strlen(getline(a:lnum)) - 1, 1), 'name') + let syn_name_end = synIDattr(synID(a:lnum, strlen(curline) - 1, 1), 'name') + let syn_name_start = synIDattr(synID(a:lnum, match(curline, '\S') + 1, 1), 'name') endif - if syn_name =~ 'Comment' + if syn_name_end =~ 'Comment' && syn_name_start =~ 'Comment' return <SID>XmlIndentComment(a:lnum) + elseif empty(syn_name_start) && empty(syn_name_end) + " non-xml tag content: use indent from 'autoindent' + return pind + shiftwidth() endif - let pline = getline(ptag) - let pind = indent(ptag) " Get indent from previous tag line let ind = <SID>XmlIndentSum(pline, -1, pind) - let t_ind = ind " Determine indent from current line - let ind = <SID>XmlIndentSum(getline(a:lnum), 0, ind) + let ind = <SID>XmlIndentSum(curline, 0, ind) return ind endfun @@ -148,7 +157,7 @@ func! <SID>HasNoTagEnd(line) endfunc " return indent for a commented line, -" the middle part might be indented on additional level +" the middle part might be indented one additional level func! <SID>XmlIndentComment(lnum) let ptagopen = search(b:xml_indent_open, 'bnW') let ptagclose = search(b:xml_indent_close, 'bnW') diff --git a/runtime/makemenu.vim b/runtime/makemenu.vim index 3d76b4240e..7fb126977a 100644 --- a/runtime/makemenu.vim +++ b/runtime/makemenu.vim @@ -272,6 +272,7 @@ SynMenu HIJK.HTML.HTML\ with\ M4:htmlm4 SynMenu HIJK.HTML.HTML\ with\ Ruby\ (eRuby):eruby SynMenu HIJK.HTML.Cheetah\ HTML\ template:htmlcheetah SynMenu HIJK.HTML.Django\ HTML\ template:htmldjango +SynMenu HIJK.HTML.Vue.js\ HTML\ template:vuejs SynMenu HIJK.HTML.HTML/OS:htmlos SynMenu HIJK.HTML.XHTML:xhtml SynMenu HIJK.Host\.conf:hostconf diff --git a/runtime/optwin.vim b/runtime/optwin.vim index a590cf8bfc..51b2bbb583 100644 --- a/runtime/optwin.vim +++ b/runtime/optwin.vim @@ -1,7 +1,7 @@ " These commands create the option window. " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2019 Jan 27 +" Last Change: 2019 Jul 18 " If there already is an option window, jump to that one. let buf = bufnr('option-window') @@ -471,6 +471,8 @@ call append("$", " \tset wmw=" . &wmw) call append("$", "helpheight\tinitial height of the help window") call append("$", " \tset hh=" . &hh) if has("quickfix") + " call append("$", "previewpopup\tuse a popup window for preview") + " call append("$", " \tset pvp=" . &pvp) call append("$", "previewheight\tdefault height for the preview window") call append("$", " \tset pvh=" . &pvh) call append("$", "previewwindow\tidentifies the preview window") @@ -932,6 +934,8 @@ call <SID>Header("reading and writing files") call append("$", "modeline\tenable using settings from modelines when reading a file") call append("$", "\t(local to buffer)") call <SID>BinOptionL("ml") +call append("$", "modelineexpr\tallow setting expression options from a modeline") +call <SID>BinOptionG("mle", &mle) call append("$", "modelines\tnumber of lines to check for modelines") call append("$", " \tset mls=" . &mls) call append("$", "binary\tbinary file editing") diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim index 28e1c3ecf8..e39bde88a7 100644 --- 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 = "v165" 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("<amatch>")) - au BufReadCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(2,expand("<amatch>"))|exe "sil doau BufReadPost ".fnameescape(expand("<amatch>")) + au BufReadCmd file://* call netrw#FileUrlEdit(expand("<amatch>")) + au BufReadCmd ftp://*,rcp://*,scp://*,http://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(2,expand("<amatch>"))|exe "sil doau BufReadPost ".fnameescape(expand("<amatch>")) au FileReadCmd ftp://*,rcp://*,scp://*,http://*,file://*,https://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileReadPre ".fnameescape(expand("<amatch>"))|call netrw#Nread(1,expand("<amatch>"))|exe "sil doau FileReadPost ".fnameescape(expand("<amatch>")) au BufWriteCmd ftp://*,rcp://*,scp://*,http://*,file://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau BufWritePre ".fnameescape(expand("<amatch>"))|exe 'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau BufWritePost ".fnameescape(expand("<amatch>")) au FileWriteCmd ftp://*,rcp://*,scp://*,http://*,file://*,dav://*,davs://*,rsync://*,sftp://* exe "sil doau FileWritePre ".fnameescape(expand("<amatch>"))|exe "'[,']".'Nwrite '.fnameescape(expand("<amatch>"))|exe "sil doau FileWritePost ".fnameescape(expand("<amatch>")) @@ -59,7 +59,7 @@ com! -count=1 -nargs=* Nread let s:svpos= winsaveview()<bar>call netrw#NetRead( com! -range=% -nargs=* Nwrite let s:svpos= winsaveview()<bar><line1>,<line2>call netrw#NetWrite(<f-args>)<bar>call winrestview(s:svpos) com! -nargs=* NetUserPass call NetUserPass(<f-args>) com! -nargs=* Nsource let s:svpos= winsaveview()<bar>call netrw#NetSource(<f-args>)<bar>call winrestview(s:svpos) -com! -nargs=? Ntree call netrw#SetTreetop(<q-args>) +com! -nargs=? Ntree call netrw#SetTreetop(1,<q-args>) " Commands: :Explore, :Sexplore, Hexplore, Vexplore, Lexplore {{{2 com! -nargs=* -bar -bang -count=0 -complete=dir Explore call netrw#Explore(<count>,0,0+<bang>0,<q-args>) @@ -81,7 +81,7 @@ if !exists("g:netrw_nogx") if !hasmapto('<Plug>NetrwBrowseX') nmap <unique> gx <Plug>NetrwBrowseX endif - nno <silent> <Plug>NetrwBrowseX :call netrw#BrowseX(expand((exists("g:netrw_gx")? g:netrw_gx : '<cfile>')),netrw#CheckIfRemote())<cr> + nno <silent> <Plug>NetrwBrowseX :call netrw#BrowseX(netrw#GX(),netrw#CheckIfRemote(netrw#GX()))<cr> endif if maparg('gx','v') == "" if !hasmapto('<Plug>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/synmenu.vim b/runtime/synmenu.vim index ec4c48b3da..e8c9933abf 100644 --- a/runtime/synmenu.vim +++ b/runtime/synmenu.vim @@ -252,48 +252,49 @@ an 50.50.220 &Syntax.HIJK.HTML.HTML\ with\ M4 :cal SetSyn("htmlm4")<CR> an 50.50.230 &Syntax.HIJK.HTML.HTML\ with\ Ruby\ (eRuby) :cal SetSyn("eruby")<CR> an 50.50.240 &Syntax.HIJK.HTML.Cheetah\ HTML\ template :cal SetSyn("htmlcheetah")<CR> an 50.50.250 &Syntax.HIJK.HTML.Django\ HTML\ template :cal SetSyn("htmldjango")<CR> -an 50.50.260 &Syntax.HIJK.HTML.HTML/OS :cal SetSyn("htmlos")<CR> -an 50.50.270 &Syntax.HIJK.HTML.XHTML :cal SetSyn("xhtml")<CR> -an 50.50.280 &Syntax.HIJK.Host\.conf :cal SetSyn("hostconf")<CR> -an 50.50.290 &Syntax.HIJK.Hosts\ access :cal SetSyn("hostsaccess")<CR> -an 50.50.300 &Syntax.HIJK.Hyper\ Builder :cal SetSyn("hb")<CR> -an 50.50.320 &Syntax.HIJK.Icewm\ menu :cal SetSyn("icemenu")<CR> -an 50.50.330 &Syntax.HIJK.Icon :cal SetSyn("icon")<CR> -an 50.50.340 &Syntax.HIJK.IDL\Generic\ IDL :cal SetSyn("idl")<CR> -an 50.50.350 &Syntax.HIJK.IDL\Microsoft\ IDL :cal SetSyn("msidl")<CR> -an 50.50.360 &Syntax.HIJK.Indent\ profile :cal SetSyn("indent")<CR> -an 50.50.370 &Syntax.HIJK.Inform :cal SetSyn("inform")<CR> -an 50.50.380 &Syntax.HIJK.Informix\ 4GL :cal SetSyn("fgl")<CR> -an 50.50.390 &Syntax.HIJK.Initng :cal SetSyn("initng")<CR> -an 50.50.400 &Syntax.HIJK.Inittab :cal SetSyn("inittab")<CR> -an 50.50.410 &Syntax.HIJK.Inno\ setup :cal SetSyn("iss")<CR> -an 50.50.420 &Syntax.HIJK.Innovation\ Data\ Processing.Upstream\ dat :cal SetSyn("upstreamdat")<CR> -an 50.50.430 &Syntax.HIJK.Innovation\ Data\ Processing.Upstream\ log :cal SetSyn("upstreamlog")<CR> -an 50.50.440 &Syntax.HIJK.Innovation\ Data\ Processing.Upstream\ rpt :cal SetSyn("upstreamrpt")<CR> -an 50.50.450 &Syntax.HIJK.Innovation\ Data\ Processing.Upstream\ Install\ log :cal SetSyn("upstreaminstalllog")<CR> -an 50.50.460 &Syntax.HIJK.Innovation\ Data\ Processing.Usserver\ log :cal SetSyn("usserverlog")<CR> -an 50.50.470 &Syntax.HIJK.Innovation\ Data\ Processing.USW2KAgt\ log :cal SetSyn("usw2kagtlog")<CR> -an 50.50.480 &Syntax.HIJK.InstallShield\ script :cal SetSyn("ishd")<CR> -an 50.50.490 &Syntax.HIJK.Interactive\ Data\ Lang :cal SetSyn("idlang")<CR> -an 50.50.500 &Syntax.HIJK.IPfilter :cal SetSyn("ipfilter")<CR> -an 50.50.520 &Syntax.HIJK.J :cal SetSyn("j")<CR> -an 50.50.530 &Syntax.HIJK.JAL :cal SetSyn("jal")<CR> -an 50.50.540 &Syntax.HIJK.JAM :cal SetSyn("jam")<CR> -an 50.50.550 &Syntax.HIJK.Jargon :cal SetSyn("jargon")<CR> -an 50.50.560 &Syntax.HIJK.Java.Java :cal SetSyn("java")<CR> -an 50.50.570 &Syntax.HIJK.Java.JavaCC :cal SetSyn("javacc")<CR> -an 50.50.580 &Syntax.HIJK.Java.Java\ Server\ Pages :cal SetSyn("jsp")<CR> -an 50.50.590 &Syntax.HIJK.Java.Java\ Properties :cal SetSyn("jproperties")<CR> -an 50.50.600 &Syntax.HIJK.JavaScript :cal SetSyn("javascript")<CR> -an 50.50.610 &Syntax.HIJK.Jess :cal SetSyn("jess")<CR> -an 50.50.620 &Syntax.HIJK.Jgraph :cal SetSyn("jgraph")<CR> -an 50.50.630 &Syntax.HIJK.Jovial :cal SetSyn("jovial")<CR> -an 50.50.640 &Syntax.HIJK.JSON :cal SetSyn("json")<CR> -an 50.50.660 &Syntax.HIJK.Kconfig :cal SetSyn("kconfig")<CR> -an 50.50.670 &Syntax.HIJK.KDE\ script :cal SetSyn("kscript")<CR> -an 50.50.680 &Syntax.HIJK.Kimwitu++ :cal SetSyn("kwt")<CR> -an 50.50.690 &Syntax.HIJK.Kivy :cal SetSyn("kivy")<CR> -an 50.50.700 &Syntax.HIJK.KixTart :cal SetSyn("kix")<CR> +an 50.50.260 &Syntax.HIJK.HTML.Vue.js\ HTML\ template :cal SetSyn("vuejs")<CR> +an 50.50.270 &Syntax.HIJK.HTML.HTML/OS :cal SetSyn("htmlos")<CR> +an 50.50.280 &Syntax.HIJK.HTML.XHTML :cal SetSyn("xhtml")<CR> +an 50.50.290 &Syntax.HIJK.Host\.conf :cal SetSyn("hostconf")<CR> +an 50.50.300 &Syntax.HIJK.Hosts\ access :cal SetSyn("hostsaccess")<CR> +an 50.50.310 &Syntax.HIJK.Hyper\ Builder :cal SetSyn("hb")<CR> +an 50.50.330 &Syntax.HIJK.Icewm\ menu :cal SetSyn("icemenu")<CR> +an 50.50.340 &Syntax.HIJK.Icon :cal SetSyn("icon")<CR> +an 50.50.350 &Syntax.HIJK.IDL\Generic\ IDL :cal SetSyn("idl")<CR> +an 50.50.360 &Syntax.HIJK.IDL\Microsoft\ IDL :cal SetSyn("msidl")<CR> +an 50.50.370 &Syntax.HIJK.Indent\ profile :cal SetSyn("indent")<CR> +an 50.50.380 &Syntax.HIJK.Inform :cal SetSyn("inform")<CR> +an 50.50.390 &Syntax.HIJK.Informix\ 4GL :cal SetSyn("fgl")<CR> +an 50.50.400 &Syntax.HIJK.Initng :cal SetSyn("initng")<CR> +an 50.50.410 &Syntax.HIJK.Inittab :cal SetSyn("inittab")<CR> +an 50.50.420 &Syntax.HIJK.Inno\ setup :cal SetSyn("iss")<CR> +an 50.50.430 &Syntax.HIJK.Innovation\ Data\ Processing.Upstream\ dat :cal SetSyn("upstreamdat")<CR> +an 50.50.440 &Syntax.HIJK.Innovation\ Data\ Processing.Upstream\ log :cal SetSyn("upstreamlog")<CR> +an 50.50.450 &Syntax.HIJK.Innovation\ Data\ Processing.Upstream\ rpt :cal SetSyn("upstreamrpt")<CR> +an 50.50.460 &Syntax.HIJK.Innovation\ Data\ Processing.Upstream\ Install\ log :cal SetSyn("upstreaminstalllog")<CR> +an 50.50.470 &Syntax.HIJK.Innovation\ Data\ Processing.Usserver\ log :cal SetSyn("usserverlog")<CR> +an 50.50.480 &Syntax.HIJK.Innovation\ Data\ Processing.USW2KAgt\ log :cal SetSyn("usw2kagtlog")<CR> +an 50.50.490 &Syntax.HIJK.InstallShield\ script :cal SetSyn("ishd")<CR> +an 50.50.500 &Syntax.HIJK.Interactive\ Data\ Lang :cal SetSyn("idlang")<CR> +an 50.50.510 &Syntax.HIJK.IPfilter :cal SetSyn("ipfilter")<CR> +an 50.50.530 &Syntax.HIJK.J :cal SetSyn("j")<CR> +an 50.50.540 &Syntax.HIJK.JAL :cal SetSyn("jal")<CR> +an 50.50.550 &Syntax.HIJK.JAM :cal SetSyn("jam")<CR> +an 50.50.560 &Syntax.HIJK.Jargon :cal SetSyn("jargon")<CR> +an 50.50.570 &Syntax.HIJK.Java.Java :cal SetSyn("java")<CR> +an 50.50.580 &Syntax.HIJK.Java.JavaCC :cal SetSyn("javacc")<CR> +an 50.50.590 &Syntax.HIJK.Java.Java\ Server\ Pages :cal SetSyn("jsp")<CR> +an 50.50.600 &Syntax.HIJK.Java.Java\ Properties :cal SetSyn("jproperties")<CR> +an 50.50.610 &Syntax.HIJK.JavaScript :cal SetSyn("javascript")<CR> +an 50.50.620 &Syntax.HIJK.Jess :cal SetSyn("jess")<CR> +an 50.50.630 &Syntax.HIJK.Jgraph :cal SetSyn("jgraph")<CR> +an 50.50.640 &Syntax.HIJK.Jovial :cal SetSyn("jovial")<CR> +an 50.50.650 &Syntax.HIJK.JSON :cal SetSyn("json")<CR> +an 50.50.670 &Syntax.HIJK.Kconfig :cal SetSyn("kconfig")<CR> +an 50.50.680 &Syntax.HIJK.KDE\ script :cal SetSyn("kscript")<CR> +an 50.50.690 &Syntax.HIJK.Kimwitu++ :cal SetSyn("kwt")<CR> +an 50.50.700 &Syntax.HIJK.Kivy :cal SetSyn("kivy")<CR> +an 50.50.710 &Syntax.HIJK.KixTart :cal SetSyn("kix")<CR> an 50.60.100 &Syntax.L.Lace :cal SetSyn("lace")<CR> an 50.60.110 &Syntax.L.LamdaProlog :cal SetSyn("lprolog")<CR> an 50.60.120 &Syntax.L.Latte :cal SetSyn("latte")<CR> diff --git a/runtime/syntax/fstab.vim b/runtime/syntax/fstab.vim index 56237c0770..e416a9abfc 100644 --- a/runtime/syntax/fstab.vim +++ b/runtime/syntax/fstab.vim @@ -2,8 +2,8 @@ " Language: fstab file " Maintainer: Radu Dineiu <radu.dineiu@gmail.com> " URL: https://raw.github.com/rid9/vim-fstab/master/fstab.vim -" Last Change: 2017 Nov 09 -" Version: 1.2 +" Last Change: 2019 Jun 06 +" Version: 1.3 " " Credits: " David Necas (Yeti) <yeti@physics.muni.cz> @@ -68,7 +68,7 @@ syn match fsOptionsString /[a-zA-Z0-9_-]\+/ syn keyword fsOptionsYesNo yes no syn cluster fsOptionsCheckCluster contains=fsOptionsExt2Check,fsOptionsFatCheck syn keyword fsOptionsSize 512 1024 2048 -syn keyword fsOptionsGeneral async atime auto bind current defaults dev devgid devmode devmtime devuid dirsync exec force fstab kudzu loop mand move noatime noauto noclusterr noclusterw nodev nodevmtime nodiratime noexec nomand norelatime nosuid nosymfollow nouser owner rbind rdonly relatime remount ro rq rw suid suiddir supermount sw sync union update user users wxallowed xx +syn keyword fsOptionsGeneral async atime auto bind current defaults dev devgid devmode devmtime devuid dirsync exec force fstab kudzu loop mand move noatime noauto noclusterr noclusterw nodev nodevmtime nodiratime noexec nomand norelatime nosuid nosymfollow nouser owner rbind rdonly relatime remount ro rq rw suid suiddir supermount sw sync union update user users wxallowed xx nofail syn match fsOptionsGeneral /_netdev/ " Options: adfs diff --git a/runtime/syntax/help.vim b/runtime/syntax/help.vim index db5ad3728c..642d177cdd 100644 --- a/runtime/syntax/help.vim +++ b/runtime/syntax/help.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: Vim help file " Maintainer: Bram Moolenaar (Bram@vim.org) -" Last Change: 2017 Oct 19 +" Last Change: 2019 May 12 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -11,7 +11,7 @@ endif let s:cpo_save = &cpo set cpo&vim -syn match helpHeadline "^[-A-Z .][-A-Z0-9 .()]*[ \t]\+\*"me=e-1 +syn match helpHeadline "^[-A-Z .][-A-Z0-9 .()_]*[ \t]\+\*"me=e-1 syn match helpSectionDelim "^===.*===$" syn match helpSectionDelim "^---.*--$" if has("conceal") diff --git a/runtime/syntax/hitest.vim b/runtime/syntax/hitest.vim index 1e39451dcd..9d60cec802 100644 --- a/runtime/syntax/hitest.vim +++ b/runtime/syntax/hitest.vim @@ -1,8 +1,9 @@ " Vim syntax file " Language: none; used to see highlighting " Maintainer: Ronald Schild <rs@scutum.de> -" Last Change: 2017 Jul 28 +" Last Change: 2019 Jun 06 " Version: 5.4n.1 +" Additional Changes By: Lifepillar, Bram " To see your current highlight settings, do " :so $VIMRUNTIME/syntax/hitest.vim @@ -12,6 +13,7 @@ let s:hidden = &hidden let s:lazyredraw = &lazyredraw let s:more = &more let s:report = &report +let s:whichwrap = &whichwrap let s:shortmess = &shortmess let s:wrapscan = &wrapscan let s:register_a = @a @@ -19,10 +21,11 @@ let s:register_se = @/ " set global options set hidden lazyredraw nomore report=99999 shortmess=aoOstTW wrapscan +set whichwrap& " print current highlight settings into register a redir @a -highlight +silent highlight redir END " Open a new window if the current one isn't empty @@ -34,25 +37,32 @@ endif edit Highlight\ test " set local options -setlocal autoindent noexpandtab formatoptions=t shiftwidth=16 noswapfile tabstop=16 +setlocal autoindent noexpandtab formatoptions=t shiftwidth=18 noswapfile tabstop=18 let &textwidth=&columns " insert highlight settings % delete put a +" remove cleared groups +silent! g/ cleared$/d + " remove the colored xxx items g/xxx /s///e " remove color settings (not needed here) global! /links to/ substitute /\s.*$//e +" Move split 'links to' lines to the same line +% substitute /^\(\w\+\)\n\s*\(links to.*\)/\1\t\2/e + " move linked groups to the end of file global /links to/ move $ " move linked group names to the matching preferred groups +" TODO: this fails if the group linked to isn't defined % substitute /^\(\w\+\)\s*\(links to\)\s*\(\w\+\)$/\3\t\2 \1/e -global /links to/ normal mz3ElD0#$p'zdd +silent! global /links to/ normal mz3ElD0#$p'zdd " delete empty lines global /^ *$/ delete @@ -124,6 +134,7 @@ let &lazyredraw = s:lazyredraw let &more = s:more let &report = s:report let &shortmess = s:shortmess +let &whichwrap = s:whichwrap let &wrapscan = s:wrapscan let @a = s:register_a @@ -133,6 +144,6 @@ let @/ = s:register_se " remove variables unlet s:hidden s:lazyredraw s:more s:report s:shortmess -unlet s:wrapscan s:register_a s:register_se +unlet s:whichwrap s:wrapscan s:register_a s:register_se " vim: ts=8 diff --git a/runtime/syntax/json.vim b/runtime/syntax/json.vim index d80af84312..e3210a9702 100644 --- a/runtime/syntax/json.vim +++ b/runtime/syntax/json.vim @@ -1,7 +1,8 @@ " Vim syntax file " Language: JSON -" Maintainer: Eli Parra <eli@elzr.com> -" Last Change: 2014 Aug 23 +" Maintainer: vacancy +" Previous Maintainer: Eli Parra <eli@elzr.com> +" Last Change: 2019 Jul 08 " Version: 0.12 if !exists("main_syntax") @@ -16,8 +17,19 @@ syntax match jsonNoise /\%(:\|,\)/ " NOTE that for the concealing to work your conceallevel should be set to 2 +" Syntax: JSON Keywords +" Separated into a match and region because a region by itself is always greedy +syn match jsonKeywordMatch /"\([^"]\|\\\"\)\+"[[:blank:]\r\n]*\:/ contains=jsonKeyword +if has('conceal') + syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ concealends contained +else + syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contained +endif + " Syntax: Strings " Separated into a match and region because a region by itself is always greedy +" Needs to come after keywords or else a json encoded string will break the +" syntax syn match jsonStringMatch /"\([^"]\|\\\"\)\+"\ze[[:blank:]\r\n]*[,}\]]/ contains=jsonString if has('conceal') syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ concealends contains=jsonEscape contained @@ -28,14 +40,6 @@ endif " Syntax: JSON does not allow strings with single quotes, unlike JavaScript. syn region jsonStringSQError oneline start=+'+ skip=+\\\\\|\\"+ end=+'+ -" Syntax: JSON Keywords -" Separated into a match and region because a region by itself is always greedy -syn match jsonKeywordMatch /"\([^"]\|\\\"\)\+"[[:blank:]\r\n]*\:/ contains=jsonKeyword -if has('conceal') - syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ concealends contained -else - syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contained -endif " Syntax: Escape sequences syn match jsonEscape "\\["\\/bfnrt]" contained diff --git a/runtime/syntax/lisp.vim b/runtime/syntax/lisp.vim index d99e032bbf..17c54d1a4f 100644 --- a/runtime/syntax/lisp.vim +++ b/runtime/syntax/lisp.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: Lisp " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Mar 26, 2019 -" Version: 28 +" Last Change: Jul 11, 2019 +" Version: 29 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_LISP " " Thanks to F Xavier Noria for a list of 978 Common Lisp symbols taken from HyperSpec @@ -54,7 +54,7 @@ if exists("g:lisp_rainbow") && g:lisp_rainbow != 0 syn region lispParen8 contained matchgroup=hlLevel8 start="`\=(" end=")" skip="|.\{-}|" contains=@lispListCluster,lispParen9 syn region lispParen9 contained matchgroup=hlLevel9 start="`\=(" end=")" skip="|.\{-}|" contains=@lispListCluster,lispParen0 else - syn region lispList matchgroup=Delimiter start="(" skip="|.\{-}|" matchgroup=Delimiter end=")" contains=@lispListCluster + syn region lispList matchgroup=lispParen start="(" skip="|.\{-}|" matchgroup=lispParen end=")" contains=@lispListCluster syn region lispBQList matchgroup=PreProc start="`(" skip="|.\{-}|" matchgroup=PreProc end=")" contains=@lispListCluster endif @@ -608,6 +608,8 @@ if !exists("skip_lisp_syntax_inits") hi def hlLevel8 ctermfg=blue guifg=darkslateblue hi def hlLevel9 ctermfg=darkmagenta guifg=darkviolet endif + else + hi def link lispParen Delimiter endif endif diff --git a/runtime/syntax/matlab.vim b/runtime/syntax/matlab.vim index 5228bb5c43..520280980a 100644 --- a/runtime/syntax/matlab.vim +++ b/runtime/syntax/matlab.vim @@ -4,9 +4,10 @@ " Credits: Preben 'Peppe' Guldberg <peppe-vim@wielders.org> " Maurizio Tranchero - maurizio(.)tranchero(@)gmail(.)com " Original author: Mario Eusebio -" Last Change: Mon Jan 23 2017 -" added support for cell mode +" Last Change: June 10 2019 +" added highlight rule for double-quoted string literals " Change History: +" - double-quoted string literals added " - now highlights cell-mode separator comments " - 'global' and 'persistent' keyword are now recognized @@ -40,6 +41,7 @@ syn match matlabLineContinuation "\.\{3}" " String " MT_ADDON - added 'skip' in order to deal with 'tic' escaping sequence syn region matlabString start=+'+ end=+'+ oneline skip=+''+ +syn region matlabStringArray start=+"+ end=+"+ oneline skip=+""+ " If you don't like tabs syn match matlabTab "\t" @@ -87,6 +89,7 @@ hi def link matlabExceptions Conditional hi def link matlabRepeat Repeat hi def link matlabTodo Todo hi def link matlabString String +hi def link matlabStringArray String hi def link matlabDelimiter Identifier hi def link matlabTransposeOther Identifier hi def link matlabNumber Number diff --git a/runtime/syntax/netrw.vim b/runtime/syntax/netrw.vim index 3d3aa993bd..c4d3cf5fda 100644 --- 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 skipwhite " ----------------------------- " 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 "\<core\%(\.\d\+\)\=\>" contains=netrwTreeBar,@NoSpell + syn match netrwCoreDump "\<core\%(\.\d\+\)\=\>" contains=netrwTreeBar,@NoSpell endif - syn match netrwLex "\(\S\+ \)*\S\+\.\%(l\|lex\)\>" contains=netrwTreeBar,@NoSpell - syn match netrwYacc "\(\S\+ \)*\S\+\.y\>" contains=netrwTreeBar,@NoSpell - syn match netrwData "\(\S\+ \)*\S\+\.dat\>" contains=netrwTreeBar,@NoSpell - syn match 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 "\<tags\>" contains=netrwTreeBar,@NoSpell - syn match netrwTilde "\(\S\+ \)*\S\+\~\*\=\>" contains=netrwTreeBar,@NoSpell - syn match netrwTmp "\<tmp\(\S\+ \)*\S\+\>\|\(\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 "\<tags\>" contains=netrwTreeBar,@NoSpell + syn match netrwTilde "\(\S\+ \)*\S\+\~\*\=\>" contains=netrwTreeBar,@NoSpell + syn match netrwTmp "\<tmp\(\S\+ \)*\S\+\>\|\(\S\+ \)*\S*tmp\>" contains=netrwTreeBar,@NoSpell endif " --------------------------------------------------------------------- @@ -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/ocaml.vim b/runtime/syntax/ocaml.vim index 06d8f416b5..42913f228e 100644 --- a/runtime/syntax/ocaml.vim +++ b/runtime/syntax/ocaml.vim @@ -5,9 +5,14 @@ " Karl-Heinz Sylla <Karl-Heinz.Sylla@gmd.de> " Issac Trotts <ijtrotts@ucdavis.edu> " URL: https://github.com/rgrinberg/vim-ocaml -" Last Change: 2012 May 12 - Added Dominique Pellé's spell checking patch (MM) -" 2012 Feb 01 - Improved module path highlighting (MM) -" 2010 Oct 11 - Added highlighting of lnot (MM, thanks to Erick Matsen) +" Last Change: +" 2018 Nov 08 - Improved highlighting of operators (Maëlan) +" 2018 Apr 22 - Improved support for PPX (Andrey Popp) +" 2018 Mar 16 - Remove raise, lnot and not from keywords (Étienne Millon, "copy") +" 2017 Apr 11 - Improved matching of negative numbers (MM) +" 2016 Mar 11 - Improved support for quoted strings (Glen Mével) +" 2015 Aug 13 - Allow apostrophes in identifiers (Jonathan Chan, Einar Lielmanis) +" 2015 Jun 17 - Added new "nonrec" keyword (MM) " A minor patch was applied to the official version so that object/end " can be distinguished from begin/end, which is used for indentation, @@ -18,6 +23,9 @@ if exists("b:current_syntax") && b:current_syntax == "ocaml" finish endif +" ' can be used in OCaml identifiers +setlocal iskeyword+=' + " OCaml is case sensitive. syn case match @@ -28,7 +36,7 @@ syn match ocamlMethod "#" syn match ocamlComment "^#!.*" contains=@Spell " Scripting directives -syn match ocamlScript "^#\<\(quit\|labels\|warnings\|directory\|cd\|load\|use\|install_printer\|remove_printer\|require\|thread\|trace\|untrace\|untrace_all\|print_depth\|print_length\|camlp4o\)\>" +syn match ocamlScript "^#\<\(quit\|labels\|warnings\|warn_error\|directory\|remove_directory\|cd\|load\|load_rec\|use\|mod_use\|install_printer\|remove_printer\|require\|list\|ppx\|principal\|predicates\|rectypes\|thread\|trace\|untrace\|untrace_all\|print_depth\|print_length\|camlp4o\|camlp4r\|topfind_log\|topfind_verbose\)\>" " lowercase identifier - the standard way to match syn match ocamlLCIdentifier /\<\(\l\|_\)\(\w\|'\)*\>/ @@ -66,7 +74,7 @@ syn cluster ocamlAllErrs contains=ocamlBraceErr,ocamlBrackErr,ocamlParenErr,oca syn cluster ocamlAENoParen contains=ocamlBraceErr,ocamlBrackErr,ocamlCommentErr,ocamlCountErr,ocamlDoErr,ocamlDoneErr,ocamlEndErr,ocamlThenErr -syn cluster ocamlContained contains=ocamlTodo,ocamlPreDef,ocamlModParam,ocamlModParam1,ocamlPreMPRestr,ocamlMPRestr,ocamlMPRestr1,ocamlMPRestr2,ocamlMPRestr3,ocamlModRHS,ocamlFuncWith,ocamlFuncStruct,ocamlModTypeRestr,ocamlModTRWith,ocamlWith,ocamlWithRest,ocamlModType,ocamlFullMod,ocamlVal +syn cluster ocamlContained contains=ocamlTodo,ocamlPreDef,ocamlModParam,ocamlModParam1,ocamlMPRestr,ocamlMPRestr1,ocamlMPRestr2,ocamlMPRestr3,ocamlModRHS,ocamlFuncWith,ocamlFuncStruct,ocamlModTypeRestr,ocamlModTRWith,ocamlWith,ocamlWithRest,ocamlModType,ocamlFullMod,ocamlVal " Enclosing delimiters @@ -103,11 +111,15 @@ endif " "if" syn region ocamlNone matchgroup=ocamlKeyword start="\<if\>" matchgroup=ocamlKeyword end="\<then\>" contains=ALLBUT,@ocamlContained,ocamlThenErr +"" PPX nodes + +syn match ocamlPpxIdentifier /\(\[@\{1,3\}\)\@<=\w\+\(\.\w\+\)*/ +syn region ocamlPpx matchgroup=ocamlPpxEncl start="\[@\{1,3\}" contains=TOP end="\]" "" Modules " "sig" -syn region ocamlSig matchgroup=ocamlModule start="\<sig\>" matchgroup=ocamlModule end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr,ocamlModule +syn region ocamlSig matchgroup=ocamlSigEncl start="\<sig\>" matchgroup=ocamlSigEncl end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr,ocamlModule syn region ocamlModSpec matchgroup=ocamlKeyword start="\<module\>" matchgroup=ocamlModule end="\<\u\(\w\|'\)*\>" contained contains=@ocamlAllErrs,ocamlComment skipwhite skipempty nextgroup=ocamlModTRWith,ocamlMPRestr " "open" @@ -118,15 +130,14 @@ syn match ocamlKeyword "\<include\>" skipwhite skipempty nextgroup=ocamlModPa " "module" - somewhat complicated stuff ;-) syn region ocamlModule matchgroup=ocamlKeyword start="\<module\>" matchgroup=ocamlModule end="\<\u\(\w\|'\)*\>" contains=@ocamlAllErrs,ocamlComment skipwhite skipempty nextgroup=ocamlPreDef -syn region ocamlPreDef start="."me=e-1 matchgroup=ocamlKeyword end="\l\|=\|)"me=e-1 contained contains=@ocamlAllErrs,ocamlComment,ocamlModParam,ocamlModTypeRestr,ocamlModTRWith nextgroup=ocamlModPreRHS -syn region ocamlModParam start="([^*]" end=")" contained contains=@ocamlAENoParen,ocamlModParam1,ocamlVal -syn match ocamlModParam1 "\<\u\(\w\|'\)*\>" contained skipwhite skipempty nextgroup=ocamlPreMPRestr - -syn region ocamlPreMPRestr start="."me=e-1 end=")"me=e-1 contained contains=@ocamlAllErrs,ocamlComment,ocamlMPRestr,ocamlModTypeRestr +syn region ocamlPreDef start="."me=e-1 matchgroup=ocamlKeyword end="\l\|=\|)"me=e-1 contained contains=@ocamlAllErrs,ocamlComment,ocamlModParam,ocamlGenMod,ocamlModTypeRestr,ocamlModTRWith nextgroup=ocamlModPreRHS +syn region ocamlModParam start="([^*]" end=")" contained contains=ocamlGenMod,ocamlModParam1,ocamlSig,ocamlVal +syn match ocamlModParam1 "\<\u\(\w\|'\)*\>" contained skipwhite skipempty +syn match ocamlGenMod "()" contained skipwhite skipempty syn region ocamlMPRestr start=":" end="."me=e-1 contained contains=@ocamlComment skipwhite skipempty nextgroup=ocamlMPRestr1,ocamlMPRestr2,ocamlMPRestr3 -syn region ocamlMPRestr1 matchgroup=ocamlModule start="\ssig\s\=" matchgroup=ocamlModule end="\<end\>" contained contains=ALLBUT,@ocamlContained,ocamlEndErr,ocamlModule -syn region ocamlMPRestr2 start="\sfunctor\(\s\|(\)\="me=e-1 matchgroup=ocamlKeyword end="->" contained contains=@ocamlAllErrs,ocamlComment,ocamlModParam skipwhite skipempty nextgroup=ocamlFuncWith,ocamlMPRestr2 +syn region ocamlMPRestr1 matchgroup=ocamlSigEncl start="\ssig\s\=" matchgroup=ocamlSigEncl end="\<end\>" contained contains=ALLBUT,@ocamlContained,ocamlEndErr,ocamlModule +syn region ocamlMPRestr2 start="\sfunctor\(\s\|(\)\="me=e-1 matchgroup=ocamlKeyword end="->" contained contains=@ocamlAllErrs,ocamlComment,ocamlModParam,ocamlGenMod skipwhite skipempty nextgroup=ocamlFuncWith,ocamlMPRestr2 syn match ocamlMPRestr3 "\w\(\w\|'\)*\( *\. *\w\(\w\|'\)*\)*" contained syn match ocamlModPreRHS "=" contained skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod syn keyword ocamlKeyword val @@ -134,8 +145,8 @@ syn region ocamlVal matchgroup=ocamlKeyword start="\<val\>" matchgroup=ocamlLC syn region ocamlModRHS start="." end=". *\w\|([^*]"me=e-2 contained contains=ocamlComment skipwhite skipempty nextgroup=ocamlModParam,ocamlFullMod syn match ocamlFullMod "\<\u\(\w\|'\)*\( *\. *\u\(\w\|'\)*\)*" contained skipwhite skipempty nextgroup=ocamlFuncWith -syn region ocamlFuncWith start="([^*]"me=e-1 end=")" contained contains=ocamlComment,ocamlWith,ocamlFuncStruct skipwhite skipempty nextgroup=ocamlFuncWith -syn region ocamlFuncStruct matchgroup=ocamlModule start="[^a-zA-Z]struct\>"hs=s+1 matchgroup=ocamlModule end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr +syn region ocamlFuncWith start="([^*)]"me=e-1 end=")" contained contains=ocamlComment,ocamlWith,ocamlFuncStruct skipwhite skipempty nextgroup=ocamlFuncWith +syn region ocamlFuncStruct matchgroup=ocamlStructEncl start="[^a-zA-Z]struct\>"hs=s+1 matchgroup=ocamlStructEncl end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr syn match ocamlModTypeRestr "\<\w\(\w\|'\)*\( *\. *\w\(\w\|'\)*\)*\>" contained syn region ocamlModTRWith start=":\s*("hs=s+1 end=")" contained contains=@ocamlAENoParen,ocamlWith @@ -143,20 +154,23 @@ syn match ocamlWith "\<\(\u\(\w\|'\)* *\. *\)*\w\(\w\|'\)*\>" contained skipw syn region ocamlWithRest start="[^)]" end=")"me=e-1 contained contains=ALLBUT,@ocamlContained " "struct" -syn region ocamlStruct matchgroup=ocamlModule start="\<\(module\s\+\)\=struct\>" matchgroup=ocamlModule end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr +syn region ocamlStruct matchgroup=ocamlStructEncl start="\<\(module\s\+\)\=struct\>" matchgroup=ocamlStructEncl end="\<end\>" contains=ALLBUT,@ocamlContained,ocamlEndErr " "module type" syn region ocamlKeyword start="\<module\>\s*\<type\>\(\s*\<of\>\)\=" matchgroup=ocamlModule end="\<\w\(\w\|'\)*\>" contains=ocamlComment skipwhite skipempty nextgroup=ocamlMTDef syn match ocamlMTDef "=\s*\w\(\w\|'\)*\>"hs=s+1,me=s+1 skipwhite skipempty nextgroup=ocamlFullMod +" Quoted strings +syn region ocamlString matchgroup=ocamlQuotedStringDelim start="{\z\([a-z_]*\)|" end="|\z1}" contains=@Spell + syn keyword ocamlKeyword and as assert class syn keyword ocamlKeyword constraint else syn keyword ocamlKeyword exception external fun syn keyword ocamlKeyword in inherit initializer -syn keyword ocamlKeyword land lazy let match -syn keyword ocamlKeyword method mutable new of -syn keyword ocamlKeyword parser private raise rec +syn keyword ocamlKeyword lazy let match +syn keyword ocamlKeyword method mutable new nonrec of +syn keyword ocamlKeyword parser private rec syn keyword ocamlKeyword try type syn keyword ocamlKeyword virtual when while with @@ -166,14 +180,11 @@ if exists("ocaml_revised") else syn keyword ocamlKeyword function syn keyword ocamlBoolean true false - syn match ocamlKeyChar "!" endif syn keyword ocamlType array bool char exn float format format4 syn keyword ocamlType int int32 int64 lazy_t list nativeint option -syn keyword ocamlType string unit - -syn keyword ocamlOperator asr lnot lor lsl lsr lxor mod not +syn keyword ocamlType bytes string unit syn match ocamlConstructor "(\s*)" syn match ocamlConstructor "\[\s*\]" @@ -193,39 +204,61 @@ syn match ocamlCharErr "'\\\d\d'\|'\\\d'" syn match ocamlCharErr "'\\[^\'ntbr]'" syn region ocamlString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@Spell -syn match ocamlFunDef "->" -syn match ocamlRefAssign ":=" syn match ocamlTopStop ";;" -syn match ocamlOperator "\^" -syn match ocamlOperator "::" -syn match ocamlOperator "&&" -syn match ocamlOperator "<" -syn match ocamlOperator ">" syn match ocamlAnyVar "\<_\>" syn match ocamlKeyChar "|[^\]]"me=e-1 syn match ocamlKeyChar ";" syn match ocamlKeyChar "\~" syn match ocamlKeyChar "?" -syn match ocamlKeyChar "\*" -syn match ocamlKeyChar "=" +"" Operators + +" The grammar of operators is found there: +" https://caml.inria.fr/pub/docs/manual-ocaml/names.html#operator-name +" https://caml.inria.fr/pub/docs/manual-ocaml/extn.html#s:ext-ops +" https://caml.inria.fr/pub/docs/manual-ocaml/extn.html#s:index-operators +" =, *, < and > are both operator names and keywords, we let the user choose how +" to display them (has to be declared before regular infix operators): +syn match ocamlEqual "=" +syn match ocamlStar "*" +syn match ocamlAngle "<" +syn match ocamlAngle ">" +" Custom indexing operators: +syn match ocamlIndexingOp "\.[~?!:|&$%=>@^/*+-][~?!.:|&$%<=>@^*/+-]*\(()\|\[]\|{}\)\(<-\)\?" +" Extension operators (has to be declared before regular infix operators): +syn match ocamlExtensionOp "#[#~?!.:|&$%<=>@^*/+-]\+" +" Infix and prefix operators: +syn match ocamlPrefixOp "![~?!.:|&$%<=>@^*/+-]*" +syn match ocamlPrefixOp "[~?][~?!.:|&$%<=>@^*/+-]\+" +syn match ocamlInfixOp "[&$%@^/+-][~?!.:|&$%<=>@^*/+-]*" +syn match ocamlInfixOp "[|<=>*][~?!.:|&$%<=>@^*/+-]\+" +syn match ocamlInfixOp "#[~?!.:|&$%<=>@^*/+-]\+#\@!" +syn match ocamlInfixOp "!=[~?!.:|&$%<=>@^*/+-]\@!" +syn keyword ocamlInfixOpKeyword asr land lor lsl lsr lxor mod or +" := is technically an infix operator, but we may want to show it as a keyword +" (somewhat analogously to = for let‐bindings and <- for assignations): +syn match ocamlRefAssign ":=" +" :: is technically not an operator, but we may want to show it as such: +syn match ocamlCons "::" +" -> and <- are keywords, not operators (but can appear in longer operators): +syn match ocamlArrow "->[~?!.:|&$%<=>@^*/+-]\@!" if exists("ocaml_revised") - syn match ocamlErr "<-" + syn match ocamlErr "<-[~?!.:|&$%<=>@^*/+-]\@!" else - syn match ocamlOperator "<-" + syn match ocamlKeyChar "<-[~?!.:|&$%<=>@^*/+-]\@!" endif -syn match ocamlNumber "\<-\=\d\(_\|\d\)*[l|L|n]\?\>" -syn match ocamlNumber "\<-\=0[x|X]\(\x\|_\)\+[l|L|n]\?\>" -syn match ocamlNumber "\<-\=0[o|O]\(\o\|_\)\+[l|L|n]\?\>" -syn match ocamlNumber "\<-\=0[b|B]\([01]\|_\)\+[l|L|n]\?\>" -syn match ocamlFloat "\<-\=\d\(_\|\d\)*\.\?\(_\|\d\)*\([eE][-+]\=\d\(_\|\d\)*\)\=\>" +syn match ocamlNumber "-\=\<\d\(_\|\d\)*[l|L|n]\?\>" +syn match ocamlNumber "-\=\<0[x|X]\(\x\|_\)\+[l|L|n]\?\>" +syn match ocamlNumber "-\=\<0[o|O]\(\o\|_\)\+[l|L|n]\?\>" +syn match ocamlNumber "-\=\<0[b|B]\([01]\|_\)\+[l|L|n]\?\>" +syn match ocamlFloat "-\=\<\d\(_\|\d\)*\.\?\(_\|\d\)*\([eE][-+]\=\d\(_\|\d\)*\)\=\>" " Labels syn match ocamlLabel "\~\(\l\|_\)\(\w\|'\)*"lc=1 syn match ocamlLabel "?\(\l\|_\)\(\w\|'\)*"lc=1 -syn region ocamlLabel transparent matchgroup=ocamlLabel start="?(\(\l\|_\)\(\w\|'\)*"lc=2 end=")"me=e-1 contains=ALLBUT,@ocamlContained,ocamlParenErr +syn region ocamlLabel transparent matchgroup=ocamlLabel start="[~?](\(\l\|_\)\(\w\|'\)*"lc=2 end=")"me=e-1 contains=ALLBUT,@ocamlContained,ocamlParenErr " Synchronization @@ -281,6 +314,8 @@ hi def link ocamlFullMod Include hi def link ocamlModTypeRestr Include hi def link ocamlWith Include hi def link ocamlMTDef Include +hi def link ocamlSigEncl ocamlModule +hi def link ocamlStructEncl ocamlModule hi def link ocamlScript Include @@ -291,18 +326,34 @@ hi def link ocamlModPreRHS Keyword hi def link ocamlMPRestr2 Keyword hi def link ocamlKeyword Keyword hi def link ocamlMethod Include -hi def link ocamlFunDef Keyword -hi def link ocamlRefAssign Keyword hi def link ocamlKeyChar Keyword hi def link ocamlAnyVar Keyword hi def link ocamlTopStop Keyword -hi def link ocamlOperator Keyword + +hi def link ocamlRefAssign ocamlKeyChar +hi def link ocamlEqual ocamlKeyChar +hi def link ocamlStar ocamlInfixOp +hi def link ocamlAngle ocamlInfixOp +hi def link ocamlCons ocamlInfixOp + +hi def link ocamlPrefixOp ocamlOperator +hi def link ocamlInfixOp ocamlOperator +hi def link ocamlExtensionOp ocamlOperator +hi def link ocamlIndexingOp ocamlOperator + +if exists("ocaml_highlight_operators") + hi def link ocamlInfixOpKeyword ocamlOperator + hi def link ocamlOperator Operator +else + hi def link ocamlInfixOpKeyword Keyword +endif hi def link ocamlBoolean Boolean hi def link ocamlCharacter Character hi def link ocamlNumber Number hi def link ocamlFloat Float hi def link ocamlString String +hi def link ocamlQuotedStringDelim Identifier hi def link ocamlLabel Identifier @@ -312,6 +363,7 @@ hi def link ocamlTodo Todo hi def link ocamlEncl Keyword +hi def link ocamlPpxEncl ocamlEncl let b:current_syntax = "ocaml" diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index b9c71de4c4..ae62e195a4 100644 --- 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 <NdrOchipS@PcampbellAfamily.Mbiz> " Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int> -" Last Change: Mar 26, 2019 -" Version: 186 +" Last Change: Jun 16, 2019 +" Version: 188 " 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) @@ -381,22 +381,23 @@ syn match shBQComment contained "#.\{-}\ze`" contains=@shCommentGroup " Here Documents: {{{1 " ========================================= +" Note : shHereDoc0[137] only had shDblQuoteList contained ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc01 start="<<\s*\\\=\z([^ \t|>]\+\)" matchgroup=shHereDoc01 end="^\z1\s*$" contains=@shDblQuoteList ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc02 start="<<\s*\"\z([^"]\+\)\"" 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([^']\+\)'" 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([^"]\+\)\"" 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*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc09 start="<<\s*\\\_$\_s*\"\z([^ \t|>]\+\)\"" matchgroup=shHereDoc09 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc07 start="<<\s*\\\_$\_s*\z([^ \t'"|>]\+\)" matchgroup=shHereDoc07 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc08 start="<<\s*\\\_$\_s*'\z([^\t|>]\+\)'" matchgroup=shHereDoc08 end="^\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc09 start="<<\s*\\\_$\_s*\"\z([^\t|>]\+\)\"" matchgroup=shHereDoc09 end="^\z1\s*$" ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc10 start="<<-\s*\\\_$\_s*\z([^ \t|>]\+\)" matchgroup=shHereDoc10 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc11 start="<<-\s*\\\_$\_s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc11 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc11 start="<<-\s*\\\_$\_s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc11 end="^\s*\z1\s*$" contains=@shDblQuoteList ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc12 start="<<-\s*\\\_$\_s*'\z([^']\+\)'" matchgroup=shHereDoc12 end="^\s*\z1\s*$" ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc13 start="<<-\s*\\\_$\_s*\"\z([^"]\+\)\"" matchgroup=shHereDoc13 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc14 start="<<\\\z([^ \t|>]\+\)" matchgroup=shHereDoc14 end="^\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc15 start="<<-\s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc15 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc16 start="<<-\s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc15 end="^\s*\z1\s*$" +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc14 start="<<\\\z([^ \t|>]\+\)" matchgroup=shHereDoc14 end="^\z1\s*$" contains=@shDblQuoteList +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc15 start="<<-\s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc15 end="^\s*\z1\s*$" contains=@shDblQuoteList +ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc16 start="<<-\s*\\\z([^ \t|>]\+\)" matchgroup=shHereDoc15 end="^\s*\z1\s*$" contains=@shDblQuoteList " Here Strings: {{{1 " ============= diff --git a/runtime/syntax/sshdconfig.vim b/runtime/syntax/sshdconfig.vim index 3924aaf94a..f381668d16 100644 --- a/runtime/syntax/sshdconfig.vim +++ b/runtime/syntax/sshdconfig.vim @@ -6,8 +6,8 @@ " Contributor: Leonard Ehrenfried <leonard.ehrenfried@web.de> " Contributor: Karsten Hopp <karsten@redhat.com> " Originally: 2009-07-09 -" Last Change: 2017 Oct 25 -" SSH Version: 7.6p1 +" Last Change: 2019-05-31 +" SSH Version: 7.9p1 " " Setup @@ -137,7 +137,8 @@ syn case ignore " Keywords -syn keyword sshdconfigMatch Host User Group Address +" Also includes RDomain, but that is a keyword. +syn keyword sshdconfigMatch Host User Group Address LocalAddress LocalPort syn keyword sshdconfigKeyword AcceptEnv syn keyword sshdconfigKeyword AddressFamily @@ -150,8 +151,11 @@ syn keyword sshdconfigKeyword AuthenticationMethods syn keyword sshdconfigKeyword AuthorizedKeysFile syn keyword sshdconfigKeyword AuthorizedKeysCommand syn keyword sshdconfigKeyword AuthorizedKeysCommandUser +syn keyword sshdconfigKeyword AuthorizedPrincipalsCommand +syn keyword sshdconfigKeyword AuthorizedPrincipalsCommandUser syn keyword sshdconfigKeyword AuthorizedPrincipalsFile syn keyword sshdconfigKeyword Banner +syn keyword sshdconfigKeyword CASignatureAlgorithms syn keyword sshdconfigKeyword ChallengeResponseAuthentication syn keyword sshdconfigKeyword ChrootDirectory syn keyword sshdconfigKeyword Ciphers @@ -162,13 +166,17 @@ syn keyword sshdconfigKeyword DebianBanner syn keyword sshdconfigKeyword DenyGroups syn keyword sshdconfigKeyword DenyUsers syn keyword sshdconfigKeyword DisableForwarding +syn keyword sshdconfigKeyword ExposeAuthInfo +syn keyword sshdconfigKeyword FingerprintHash syn keyword sshdconfigKeyword ForceCommand +syn keyword sshdconfigKeyword GatewayPorts syn keyword sshdconfigKeyword GSSAPIAuthentication syn keyword sshdconfigKeyword GSSAPICleanupCredentials +syn keyword sshdconfigKeyword GSSAPIEnablek5users syn keyword sshdconfigKeyword GSSAPIKeyExchange +syn keyword sshdconfigKeyword GSSAPIKexAlgorithms syn keyword sshdconfigKeyword GSSAPIStoreCredentialsOnRekey syn keyword sshdconfigKeyword GSSAPIStrictAcceptorCheck -syn keyword sshdconfigKeyword GatewayPorts syn keyword sshdconfigKeyword HostCertificate syn keyword sshdconfigKeyword HostKey syn keyword sshdconfigKeyword HostKeyAgent @@ -184,6 +192,8 @@ syn keyword sshdconfigKeyword KerberosAuthentication syn keyword sshdconfigKeyword KerberosGetAFSToken syn keyword sshdconfigKeyword KerberosOrLocalPasswd syn keyword sshdconfigKeyword KerberosTicketCleanup +syn keyword sshdconfigKeyword KerberosUniqueCCache +syn keyword sshdconfigKeyword KerberosUseKuserok syn keyword sshdconfigKeyword KexAlgorithms syn keyword sshdconfigKeyword KeyRegenerationInterval syn keyword sshdconfigKeyword ListenAddress @@ -197,6 +207,7 @@ syn keyword sshdconfigKeyword MaxStartups syn keyword sshdconfigKeyword PasswordAuthentication syn keyword sshdconfigKeyword PermitBlacklistedKeys syn keyword sshdconfigKeyword PermitEmptyPasswords +syn keyword sshdconfigKeyword PermitListen syn keyword sshdconfigKeyword PermitOpen syn keyword sshdconfigKeyword PermitRootLogin syn keyword sshdconfigKeyword PermitTTY @@ -213,10 +224,14 @@ syn keyword sshdconfigKeyword PubkeyAuthentication syn keyword sshdconfigKeyword RSAAuthentication syn keyword sshdconfigKeyword RekeyLimit syn keyword sshdconfigKeyword RevokedKeys +syn keyword sshdconfigKeyword RDomain syn keyword sshdconfigKeyword RhostsRSAAuthentication syn keyword sshdconfigKeyword ServerKeyBits +syn keyword sshdconfigKeyword SetEnv syn keyword sshdconfigKeyword ShowPatchLevel syn keyword sshdconfigKeyword StrictModes +syn keyword sshdconfigKeyword StreamLocalBindMask +syn keyword sshdconfigKeyword StreamLocalBindUnlink syn keyword sshdconfigKeyword Subsystem syn keyword sshdconfigKeyword SyslogFacility syn keyword sshdconfigKeyword TCPKeepAlive @@ -227,6 +242,7 @@ syn keyword sshdconfigKeyword UsePAM syn keyword sshdconfigKeyword VersionAddendum syn keyword sshdconfigKeyword X11DisplayOffset syn keyword sshdconfigKeyword X11Forwarding +syn keyword sshdconfigKeyword X11MaxDisplays syn keyword sshdconfigKeyword X11UseLocalhost syn keyword sshdconfigKeyword XAuthLocation diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim index 6381028de5..363c781d0f 100644 --- a/runtime/syntax/tex.vim +++ b/runtime/syntax/tex.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: TeX " Maintainer: Charles E. Campbell <NdrchipO@ScampbellPfamily.AbizM> -" Last Change: Apr 01, 2019 -" Version: 113 +" Last Change: May 14, 2019 +" Version: 114 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX " " Notes: {{{1 @@ -947,6 +947,7 @@ if has("conceal") && &enc == 'utf-8' call s:Greek('texGreek','\\eta\>' ,'η') call s:Greek('texGreek','\\theta\>' ,'θ') call s:Greek('texGreek','\\vartheta\>' ,'ϑ') + call s:Greek('texGreek','\\iota\>' ,'ι') call s:Greek('texGreek','\\kappa\>' ,'κ') call s:Greek('texGreek','\\lambda\>' ,'λ') call s:Greek('texGreek','\\mu\>' ,'μ') @@ -969,11 +970,12 @@ if has("conceal") && &enc == 'utf-8' call s:Greek('texGreek','\\Delta\>' ,'Δ') call s:Greek('texGreek','\\Theta\>' ,'Θ') call s:Greek('texGreek','\\Lambda\>' ,'Λ') - call s:Greek('texGreek','\\Xi\>' ,'Χ') + call s:Greek('texGreek','\\Xi\>' ,'Ξ') call s:Greek('texGreek','\\Pi\>' ,'Π') call s:Greek('texGreek','\\Sigma\>' ,'Σ') call s:Greek('texGreek','\\Upsilon\>' ,'Υ') call s:Greek('texGreek','\\Phi\>' ,'Φ') + call s:Greek('texGreek','\\Chi\>' ,'Χ') call s:Greek('texGreek','\\Psi\>' ,'Ψ') call s:Greek('texGreek','\\Omega\>' ,'Ω') delfun s:Greek diff --git a/runtime/syntax/tmux.vim b/runtime/syntax/tmux.vim index 62c0ce521a..d32016e566 100644 --- a/runtime/syntax/tmux.vim +++ b/runtime/syntax/tmux.vim @@ -1,5 +1,5 @@ " Language: tmux(1) configuration file -" Version: 2.7 (git-e4e060f2) +" Version: 2.9a (git-0d64531f) " URL: https://github.com/ericpruitt/tmux.vim/ " Maintainer: Eric Pruitt <eric.pruitt@gmail.com> " License: 2-Clause BSD (http://opensource.org/licenses/BSD-2-Clause) @@ -64,60 +64,51 @@ endfor syn keyword tmuxOptions \ buffer-limit command-alias default-terminal escape-time exit-empty \ activity-action assume-paste-time base-index bell-action default-command -\ default-shell destroy-unattached detach-on-destroy +\ default-shell default-size destroy-unattached detach-on-destroy \ display-panes-active-colour display-panes-colour display-panes-time \ display-time exit-unattached focus-events history-file history-limit -\ key-table lock-after-time lock-command message-attr message-bg -\ message-command-attr message-command-bg message-command-fg -\ message-command-style message-fg message-limit message-style mouse -\ aggressive-resize allow-rename alternate-screen automatic-rename -\ automatic-rename-format clock-mode-colour clock-mode-style force-height -\ force-width main-pane-height main-pane-width mode-attr mode-bg mode-fg -\ mode-keys mode-style monitor-activity monitor-bell monitor-silence -\ other-pane-height other-pane-width pane-active-border-bg -\ pane-active-border-fg pane-active-border-style pane-base-index -\ pane-border-bg pane-border-fg pane-border-format pane-border-status -\ pane-border-style prefix prefix2 remain-on-exit renumber-windows -\ repeat-time set-clipboard set-titles set-titles-string silence-action -\ status status-attr status-bg status-fg status-interval status-justify -\ status-keys status-left status-left-attr status-left-bg status-left-fg -\ status-left-length status-left-style status-position status-right -\ status-right-attr status-right-bg status-right-fg status-right-length +\ key-table lock-after-time lock-command message-command-style message-limit +\ message-style mouse aggressive-resize allow-rename alternate-screen +\ automatic-rename automatic-rename-format clock-mode-colour +\ clock-mode-style main-pane-height main-pane-width mode-keys mode-style +\ monitor-activity monitor-bell monitor-silence other-pane-height +\ other-pane-width pane-active-border-style pane-base-index +\ pane-border-format pane-border-status pane-border-style prefix prefix2 +\ remain-on-exit renumber-windows repeat-time set-clipboard set-titles +\ set-titles-string silence-action status status-bg status-fg status-format +\ status-interval status-justify status-keys status-left status-left-length +\ status-left-style status-position status-right status-right-length \ status-right-style status-style synchronize-panes terminal-overrides \ update-environment user-keys visual-activity visual-bell visual-silence -\ window-active-style window-status-activity-attr window-status-activity-bg -\ window-status-activity-fg window-status-activity-style window-status-attr -\ window-status-bell-attr window-status-bell-bg window-status-bell-fg -\ window-status-bell-style window-status-bg window-status-current-attr -\ window-status-current-bg window-status-current-fg -\ window-status-current-format window-status-current-style window-status-fg -\ window-status-format window-status-last-attr window-status-last-bg -\ window-status-last-fg window-status-last-style window-status-separator -\ window-status-style window-style word-separators wrap-search xterm-keys +\ window-active-style window-size window-status-activity-style +\ window-status-bell-style window-status-current-format +\ window-status-current-style window-status-format window-status-last-style +\ window-status-separator window-status-style window-style word-separators +\ wrap-search xterm-keys syn keyword tmuxCommands \ attach attach-session bind bind-key break-pane breakp capture-pane \ capturep choose-buffer choose-client choose-tree clear-history clearhist \ clock-mode command-prompt confirm confirm-before copy-mode detach -\ detach-client display display-message display-panes displayp find-window -\ findw if if-shell join-pane joinp kill-pane kill-server kill-session -\ kill-window killp has-session has killw link-window linkw list-buffers -\ list-clients list-commands list-keys list-panes list-sessions list-windows -\ load-buffer loadb lock lock-client lock-server lock-session last-pane -\ lastp lockc locks last-window last ls lsb delete-buffer deleteb lsc lscm -\ lsk lsp lsw move-pane move-window movep movew new new-session new-window -\ neww next next-layout next-window nextl paste-buffer pasteb pipe-pane -\ pipep prev previous-layout previous-window prevl refresh refresh-client -\ rename rename-session rename-window renamew resize-pane resizep -\ respawn-pane respawn-window respawnp respawnw rotate-window rotatew run -\ run-shell save-buffer saveb select-layout select-pane select-window -\ selectl selectp selectw send send-keys send-prefix set set-buffer -\ set-environment set-hook set-option set-window-option setb setenv setw -\ show show-buffer show-environment show-hooks show-messages show-options -\ show-window-options showb showenv showmsgs showw source source-file -\ split-window splitw start start-server suspend-client suspendc swap-pane -\ swap-window swapp swapw switch-client switchc unbind unbind-key -\ unlink-window unlinkw wait wait-for +\ detach-client display display-menu display-message display-panes displayp +\ find-window findw if if-shell join-pane joinp kill-pane kill-server +\ kill-session kill-window killp has-session has killw link-window linkw +\ list-buffers list-clients list-commands list-keys list-panes list-sessions +\ list-windows load-buffer loadb lock lock-client lock-server lock-session +\ lockc last-pane lastp locks ls last-window last lsb lsc delete-buffer +\ deleteb lscm lsk lsp lsw menu move-pane move-window movep movew new +\ new-session new-window neww next next-layout next-window nextl +\ paste-buffer pasteb pipe-pane pipep prev previous-layout previous-window +\ prevl refresh refresh-client rename rename-session rename-window renamew +\ resize-pane resize-window resizep resizew respawn-pane respawn-window +\ respawnp respawnw rotate-window rotatew run run-shell save-buffer saveb +\ select-layout select-pane select-window selectl selectp selectw send +\ send-keys send-prefix set set-buffer set-environment set-hook set-option +\ set-window-option setb setenv setw show show-buffer show-environment +\ show-hooks show-messages show-options show-window-options showb showenv +\ showmsgs showw source source-file split-window splitw start start-server +\ suspend-client suspendc swap-pane swap-window swapp swapw switch-client +\ switchc unbind unbind-key unlink-window unlinkw wait wait-for let &cpo = s:original_cpo unlet! s:original_cpo s:bg s:i diff --git a/runtime/syntax/typescript.vim b/runtime/syntax/typescript.vim new file mode 100644 index 0000000000..bc382610a9 --- /dev/null +++ b/runtime/syntax/typescript.vim @@ -0,0 +1,2077 @@ +" Vim syntax file +" Language: TypeScript +" Maintainer: Bram Moolenaar +" Last Change: 2019 Jun 07 +" Based On: Herrington Darkholme's yats.vim +" Changes: See https:github.com/HerringtonDarkholme/yats.vim +" Credits: See yats.vim + +" This is the same syntax that is in yats.vim, but: +" - flattened into one file +" - HiLink commands changed to "hi def link" +" - Setting 'cpo' to the Vim value + +if !exists("main_syntax") + if exists("b:current_syntax") + finish + endif + let main_syntax = 'typescript' +endif + +let s:cpo_save = &cpo +set cpo&vim + +" nextgroup doesn't contain objectLiteral, let outer region contains it +syntax region typescriptTypeCast matchgroup=typescriptTypeBrackets + \ start=/< \@!/ end=/>/ + \ contains=@typescriptType + \ nextgroup=@typescriptExpression + \ contained skipwhite oneline + +" runtime syntax/common.vim + +" NOTE: this results in accurate highlighting, but can be slow. +syntax sync fromstart + +"Dollar sign is permitted anywhere in an identifier +setlocal iskeyword-=$ +if main_syntax == 'typescript' || main_syntax == 'typescript.tsx' + setlocal iskeyword+=$ + " syntax cluster htmlJavaScript contains=TOP +endif + +" lowest priority on least used feature +syntax match typescriptLabel /[a-zA-Z_$]\k*:/he=e-1 contains=typescriptReserved nextgroup=@typescriptStatement skipwhite skipempty + +" other keywords like return,case,yield uses containedin +syntax region typescriptBlock matchgroup=typescriptBraces start=/{/ end=/}/ contains=@typescriptStatement,@typescriptComments fold + + +"runtime syntax/basic/identifiers.vim +syntax cluster afterIdentifier contains= + \ typescriptDotNotation, + \ typescriptFuncCallArg, + \ typescriptTemplate, + \ typescriptIndexExpr, + \ @typescriptSymbols, + \ typescriptTypeArguments + +syntax match typescriptIdentifierName /\<\K\k*/ + \ nextgroup=@afterIdentifier + \ transparent + \ contains=@_semantic + \ skipnl skipwhite + +syntax match typescriptProp contained /\K\k*!\?/ + \ transparent + \ contains=@props + \ nextgroup=@afterIdentifier + \ skipwhite skipempty + +syntax region typescriptIndexExpr contained matchgroup=typescriptProperty start=/\[/rs=s+1 end=/]/he=e-1 contains=@typescriptValue nextgroup=@typescriptSymbols,typescriptDotNotation,typescriptFuncCallArg skipwhite skipempty + +syntax match typescriptDotNotation /\./ nextgroup=typescriptProp skipnl +syntax match typescriptDotStyleNotation /\.style\./ nextgroup=typescriptDOMStyle transparent +" syntax match typescriptFuncCall contained /[a-zA-Z]\k*\ze(/ nextgroup=typescriptFuncCallArg +syntax region typescriptParenExp matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptComments,@typescriptValue,typescriptCastKeyword nextgroup=@typescriptSymbols skipwhite skipempty +syntax region typescriptFuncCallArg contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptValue,@typescriptComments nextgroup=@typescriptSymbols,typescriptDotNotation skipwhite skipempty skipnl +syntax region typescriptEventFuncCallArg contained matchgroup=typescriptParens start=/(/ end=/)/ contains=@typescriptEventExpression +syntax region typescriptEventString contained start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/ contains=typescriptASCII,@events + +"runtime syntax/basic/literal.vim +"Syntax in the JavaScript code + +" String +syntax match typescriptASCII contained /\\\d\d\d/ + +syntax region typescriptTemplateSubstitution matchgroup=typescriptTemplateSB + \ start=/\${/ end=/}/ + \ contains=@typescriptValue + \ contained + + +syntax region typescriptString + \ start=+\z(["']\)+ skip=+\\\%(\z1\|$\)+ end=+\z1+ end=+$+ + \ contains=typescriptSpecial,@Spell + \ extend + +syntax match typescriptSpecial contained "\v\\%(x\x\x|u%(\x{4}|\{\x{4,5}})|c\u|.)" + +" From vim runtime +" <https://github.com/vim/vim/blob/master/runtime/syntax/javascript.vim#L48> +syntax region typescriptRegexpString start=+/[^/*]+me=e-1 skip=+\\\\\|\\/+ end=+/[gimuy]\{0,5\}\s*$+ end=+/[gimuy]\{0,5\}\s*[;.,)\]}]+me=e-1 nextgroup=typescriptDotNotation oneline + +syntax region typescriptTemplate + \ start=/`/ skip=/\\\\\|\\`\|\n/ end=/`\|$/ + \ contains=typescriptTemplateSubstitution + \ nextgroup=@typescriptSymbols + \ skipwhite skipempty + +"Array +syntax region typescriptArray matchgroup=typescriptBraces + \ start=/\[/ end=/]/ + \ contains=@typescriptValue,@typescriptComments + \ nextgroup=@typescriptSymbols,typescriptDotNotation + \ skipwhite skipempty fold + +" Number +syntax match typescriptNumber /\<0[bB][01][01_]*\>/ nextgroup=@typescriptSymbols skipwhite skipempty +syntax match typescriptNumber /\<0[oO][0-7][0-7_]*\>/ nextgroup=@typescriptSymbols skipwhite skipempty +syntax match typescriptNumber /\<0[xX][0-9a-fA-F][0-9a-fA-F_]*\>/ nextgroup=@typescriptSymbols skipwhite skipempty +syntax match typescriptNumber /\d[0-9_]*\.\d[0-9_]*\|\d[0-9_]*\|\.\d[0-9]*/ + \ nextgroup=typescriptExponent,@typescriptSymbols skipwhite skipempty +syntax match typescriptExponent /[eE][+-]\=\d[0-9]*\>/ + \ nextgroup=@typescriptSymbols skipwhite skipempty contained + + +" runtime syntax/basic/object.vim +syntax region typescriptObjectLiteral matchgroup=typescriptBraces + \ start=/{/ end=/}/ + \ contains=@typescriptComments,typescriptObjectLabel,typescriptStringProperty,typescriptComputedPropertyName + \ fold contained + +syntax match typescriptObjectLabel contained /\k\+\_s*/ + \ nextgroup=typescriptObjectColon,@typescriptCallImpl + \ skipwhite skipempty + +syntax region typescriptStringProperty contained + \ start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1/ + \ nextgroup=typescriptObjectColon,@typescriptCallImpl + \ skipwhite skipempty + +" syntax region typescriptPropertyName contained start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1(/me=e-1 nextgroup=@typescriptCallSignature skipwhite skipempty oneline +syntax region typescriptComputedPropertyName contained matchgroup=typescriptBraces + \ start=/\[/rs=s+1 end=/]/ + \ contains=@typescriptValue + \ nextgroup=typescriptObjectColon,@typescriptCallImpl + \ skipwhite skipempty + +" syntax region typescriptComputedPropertyName contained matchgroup=typescriptPropertyName start=/\[/rs=s+1 end=/]\_s*:/he=e-1 contains=@typescriptValue nextgroup=@typescriptValue skipwhite skipempty +" syntax region typescriptComputedPropertyName contained matchgroup=typescriptPropertyName start=/\[/rs=s+1 end=/]\_s*(/me=e-1 contains=@typescriptValue nextgroup=@typescriptCallSignature skipwhite skipempty +" Value for object, statement for label statement +syntax match typescriptRestOrSpread /\.\.\./ contained +syntax match typescriptObjectSpread /\.\.\./ contained containedin=typescriptObjectLiteral,typescriptArray nextgroup=@typescriptValue + +syntax match typescriptObjectColon contained /:/ nextgroup=@typescriptValue skipwhite skipempty + +"runtime syntax/basic/symbols.vim +" + - ^ ~ +syntax match typescriptUnaryOp /[+\-~!]/ + \ nextgroup=@typescriptValue + \ skipwhite + +syntax region typescriptTernary matchgroup=typescriptTernaryOp start=/?/ end=/:/ contained contains=@typescriptValue,@typescriptComments nextgroup=@typescriptValue skipwhite skipempty + +syntax match typescriptAssign /=/ nextgroup=@typescriptValue + \ skipwhite skipempty + +" 2: ==, === +syntax match typescriptBinaryOp contained /===\?/ nextgroup=@typescriptValue skipwhite skipempty +" 6: >>>=, >>>, >>=, >>, >=, > +syntax match typescriptBinaryOp contained />\(>>=\|>>\|>=\|>\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty +" 4: <<=, <<, <=, < +syntax match typescriptBinaryOp contained /<\(<=\|<\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty +" 3: ||, |=, | +syntax match typescriptBinaryOp contained /|\(|\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty +" 3: &&, &=, & +syntax match typescriptBinaryOp contained /&\(&\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty +" 2: *=, * +syntax match typescriptBinaryOp contained /\*=\?/ nextgroup=@typescriptValue skipwhite skipempty +" 2: %=, % +syntax match typescriptBinaryOp contained /%=\?/ nextgroup=@typescriptValue skipwhite skipempty +" 2: /=, / +syntax match typescriptBinaryOp contained +/\(=\|[^\*/]\@=\)+ nextgroup=@typescriptValue skipwhite skipempty +syntax match typescriptBinaryOp contained /!==\?/ nextgroup=@typescriptValue skipwhite skipempty +" 2: !=, !== +syntax match typescriptBinaryOp contained /+\(+\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty +" 3: +, ++, += +syntax match typescriptBinaryOp contained /-\(-\|=\)\?/ nextgroup=@typescriptValue skipwhite skipempty +" 3: -, --, -= + +" exponentiation operator +" 2: **, **= +syntax match typescriptBinaryOp contained /\*\*=\?/ nextgroup=@typescriptValue + +syntax cluster typescriptSymbols contains=typescriptBinaryOp,typescriptKeywordOp,typescriptTernary,typescriptAssign,typescriptCastKeyword + +"" runtime syntax/basic/reserved.vim + +"runtime syntax/basic/keyword.vim +"Import +syntax keyword typescriptImport from as import +syntax keyword typescriptExport export +syntax keyword typescriptModule namespace module + +"this + +"JavaScript Prototype +syntax keyword typescriptPrototype prototype + \ nextgroup=@afterIdentifier + +syntax keyword typescriptCastKeyword as + \ nextgroup=@typescriptType + \ skipwhite + +"Program Keywords +syntax keyword typescriptIdentifier arguments this super + \ nextgroup=@afterIdentifier + +syntax keyword typescriptVariable let var + \ nextgroup=typescriptVariableDeclaration + \ skipwhite skipempty skipnl + +syntax keyword typescriptVariable const + \ nextgroup=typescriptEnum,typescriptVariableDeclaration + \ skipwhite + +syntax match typescriptVariableDeclaration /[A-Za-z_$]\k*/ + \ nextgroup=typescriptTypeAnnotation,typescriptAssign + \ contained skipwhite skipempty skipnl + +syntax region typescriptEnum matchgroup=typescriptEnumKeyword start=/enum / end=/\ze{/ + \ nextgroup=typescriptBlock + \ skipwhite + +syntax keyword typescriptKeywordOp + \ contained in instanceof nextgroup=@typescriptValue +syntax keyword typescriptOperator delete new typeof void + \ nextgroup=@typescriptValue + \ skipwhite skipempty + +syntax keyword typescriptForOperator contained in of +syntax keyword typescriptBoolean true false nextgroup=@typescriptSymbols skipwhite skipempty +syntax keyword typescriptNull null undefined nextgroup=@typescriptSymbols skipwhite skipempty +syntax keyword typescriptMessage alert confirm prompt status + \ nextgroup=typescriptDotNotation,typescriptFuncCallArg +syntax keyword typescriptGlobal self top parent + \ nextgroup=@afterIdentifier + +"Statement Keywords +syntax keyword typescriptConditional if else switch + \ nextgroup=typescriptConditionalParen + \ skipwhite skipempty skipnl +syntax keyword typescriptConditionalElse else +syntax keyword typescriptRepeat do while for nextgroup=typescriptLoopParen skipwhite skipempty +syntax keyword typescriptRepeat for nextgroup=typescriptLoopParen,typescriptAsyncFor skipwhite skipempty +syntax keyword typescriptBranch break continue containedin=typescriptBlock +syntax keyword typescriptCase case nextgroup=@typescriptPrimitive skipwhite containedin=typescriptBlock +syntax keyword typescriptDefault default containedin=typescriptBlock nextgroup=@typescriptValue,typescriptClassKeyword,typescriptInterfaceKeyword skipwhite oneline +syntax keyword typescriptStatementKeyword with +syntax keyword typescriptStatementKeyword yield skipwhite nextgroup=@typescriptValue containedin=typescriptBlock +syntax keyword typescriptStatementKeyword return skipwhite contained nextgroup=@typescriptValue containedin=typescriptBlock + +syntax keyword typescriptTry try +syntax keyword typescriptExceptions catch throw finally +syntax keyword typescriptDebugger debugger + +syntax keyword typescriptAsyncFor await nextgroup=typescriptLoopParen skipwhite skipempty contained + +syntax region typescriptLoopParen contained matchgroup=typescriptParens + \ start=/(/ end=/)/ + \ contains=typescriptVariable,typescriptForOperator,typescriptEndColons,@typescriptValue,@typescriptComments + \ nextgroup=typescriptBlock + \ skipwhite skipempty +syntax region typescriptConditionalParen contained matchgroup=typescriptParens + \ start=/(/ end=/)/ + \ contains=@typescriptValue,@typescriptComments + \ nextgroup=typescriptBlock + \ skipwhite skipempty +syntax match typescriptEndColons /[;,]/ contained + +syntax keyword typescriptAmbientDeclaration declare nextgroup=@typescriptAmbients + \ skipwhite skipempty + +syntax cluster typescriptAmbients contains= + \ typescriptVariable, + \ typescriptFuncKeyword, + \ typescriptClassKeyword, + \ typescriptAbstract, + \ typescriptEnumKeyword,typescriptEnum, + \ typescriptModule + +"runtime syntax/basic/doc.vim +"Syntax coloring for Node.js shebang line +syntax match shellbang "^#!.*node\>" +syntax match shellbang "^#!.*iojs\>" + + +"JavaScript comments +syntax keyword typescriptCommentTodo TODO FIXME XXX TBD +syntax match typescriptLineComment "//.*" + \ contains=@Spell,typescriptCommentTodo,typescriptRef +syntax region typescriptComment + \ start="/\*" end="\*/" + \ contains=@Spell,typescriptCommentTodo extend +syntax cluster typescriptComments + \ contains=typescriptDocComment,typescriptComment,typescriptLineComment + +syntax match typescriptRef +///\s*<reference\s\+.*\/>$+ + \ contains=typescriptString +syntax match typescriptRef +///\s*<amd-dependency\s\+.*\/>$+ + \ contains=typescriptString +syntax match typescriptRef +///\s*<amd-module\s\+.*\/>$+ + \ contains=typescriptString + +"JSDoc +syntax case ignore + +syntax region typescriptDocComment matchgroup=typescriptComment + \ start="/\*\*" end="\*/" + \ contains=typescriptDocNotation,typescriptCommentTodo,@Spell + \ fold keepend +syntax match typescriptDocNotation contained /@/ nextgroup=typescriptDocTags + +syntax keyword typescriptDocTags contained constant constructor constructs function ignore inner private public readonly static +syntax keyword typescriptDocTags contained const dict expose inheritDoc interface nosideeffects override protected struct internal +syntax keyword typescriptDocTags contained example global + +" syntax keyword typescriptDocTags contained ngdoc nextgroup=typescriptDocNGDirective +syntax keyword typescriptDocTags contained ngdoc scope priority animations +syntax keyword typescriptDocTags contained ngdoc restrict methodOf propertyOf eventOf eventType nextgroup=typescriptDocParam skipwhite +syntax keyword typescriptDocNGDirective contained overview service object function method property event directive filter inputType error + +syntax keyword typescriptDocTags contained abstract virtual access augments + +syntax keyword typescriptDocTags contained arguments callback lends memberOf name type kind link mixes mixin tutorial nextgroup=typescriptDocParam skipwhite +syntax keyword typescriptDocTags contained variation nextgroup=typescriptDocNumParam skipwhite + +syntax keyword typescriptDocTags contained author class classdesc copyright default defaultvalue nextgroup=typescriptDocDesc skipwhite +syntax keyword typescriptDocTags contained deprecated description external host nextgroup=typescriptDocDesc skipwhite +syntax keyword typescriptDocTags contained file fileOverview overview namespace requires since version nextgroup=typescriptDocDesc skipwhite +syntax keyword typescriptDocTags contained summary todo license preserve nextgroup=typescriptDocDesc skipwhite + +syntax keyword typescriptDocTags contained borrows exports nextgroup=typescriptDocA skipwhite +syntax keyword typescriptDocTags contained param arg argument property prop module nextgroup=typescriptDocNamedParamType,typescriptDocParamName skipwhite +syntax keyword typescriptDocTags contained define enum extends implements this typedef nextgroup=typescriptDocParamType skipwhite +syntax keyword typescriptDocTags contained return returns throws exception nextgroup=typescriptDocParamType,typescriptDocParamName skipwhite +syntax keyword typescriptDocTags contained see nextgroup=typescriptDocRef skipwhite + +syntax keyword typescriptDocTags contained function func method nextgroup=typescriptDocName skipwhite +syntax match typescriptDocName contained /\h\w*/ + +syntax keyword typescriptDocTags contained fires event nextgroup=typescriptDocEventRef skipwhite +syntax match typescriptDocEventRef contained /\h\w*#\(\h\w*\:\)\?\h\w*/ + +syntax match typescriptDocNamedParamType contained /{.\+}/ nextgroup=typescriptDocParamName skipwhite +syntax match typescriptDocParamName contained /\[\?0-9a-zA-Z_\.]\+\]\?/ nextgroup=typescriptDocDesc skipwhite +syntax match typescriptDocParamType contained /{.\+}/ nextgroup=typescriptDocDesc skipwhite +syntax match typescriptDocA contained /\%(#\|\w\|\.\|:\|\/\)\+/ nextgroup=typescriptDocAs skipwhite +syntax match typescriptDocAs contained /\s*as\s*/ nextgroup=typescriptDocB skipwhite +syntax match typescriptDocB contained /\%(#\|\w\|\.\|:\|\/\)\+/ +syntax match typescriptDocParam contained /\%(#\|\w\|\.\|:\|\/\|-\)\+/ +syntax match typescriptDocNumParam contained /\d\+/ +syntax match typescriptDocRef contained /\%(#\|\w\|\.\|:\|\/\)\+/ +syntax region typescriptDocLinkTag contained matchgroup=typescriptDocLinkTag start=/{/ end=/}/ contains=typescriptDocTags + +syntax cluster typescriptDocs contains=typescriptDocParamType,typescriptDocNamedParamType,typescriptDocParam + +if main_syntax == "typescript" + syntax sync clear + syntax sync ccomment typescriptComment minlines=200 +endif + +syntax case match + +"runtime syntax/basic/type.vim +" Types +syntax match typescriptOptionalMark /?/ contained + +syntax region typescriptTypeParameters matchgroup=typescriptTypeBrackets + \ start=/</ end=/>/ + \ contains=typescriptTypeParameter + \ contained + +syntax match typescriptTypeParameter /\K\k*/ + \ nextgroup=typescriptConstraint,typescriptGenericDefault + \ contained skipwhite skipnl + +syntax keyword typescriptConstraint extends + \ nextgroup=@typescriptType + \ contained skipwhite skipnl + +syntax match typescriptGenericDefault /=/ + \ nextgroup=@typescriptType + \ contained skipwhite + +">< +" class A extend B<T> {} // ClassBlock +" func<T>() // FuncCallArg +syntax region typescriptTypeArguments matchgroup=typescriptTypeBrackets + \ start=/\></ end=/>/ + \ contains=@typescriptType + \ nextgroup=typescriptFuncCallArg,@typescriptTypeOperator + \ contained skipwhite + + +syntax cluster typescriptType contains= + \ @typescriptPrimaryType, + \ typescriptUnion, + \ @typescriptFunctionType, + \ typescriptConstructorType + +" array type: A[] +" type indexing A['key'] +syntax region typescriptTypeBracket contained + \ start=/\[/ end=/\]/ + \ contains=typescriptString,typescriptNumber + \ nextgroup=@typescriptTypeOperator + \ skipwhite skipempty + +syntax cluster typescriptPrimaryType contains= + \ typescriptParenthesizedType, + \ typescriptPredefinedType, + \ typescriptTypeReference, + \ typescriptObjectType, + \ typescriptTupleType, + \ typescriptTypeQuery, + \ typescriptStringLiteralType, + \ typescriptReadonlyArrayKeyword + +syntax region typescriptStringLiteralType contained + \ start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1\|$/ + \ nextgroup=typescriptUnion + \ skipwhite skipempty + +syntax region typescriptParenthesizedType matchgroup=typescriptParens + \ start=/(/ end=/)/ + \ contains=@typescriptType + \ nextgroup=@typescriptTypeOperator + \ contained skipwhite skipempty fold + +syntax match typescriptTypeReference /\K\k*\(\.\K\k*\)*/ + \ nextgroup=typescriptTypeArguments,@typescriptTypeOperator,typescriptUserDefinedType + \ skipwhite contained skipempty + +syntax keyword typescriptPredefinedType any number boolean string void never undefined null object unknown + \ nextgroup=@typescriptTypeOperator + \ contained skipwhite skipempty + +syntax match typescriptPredefinedType /unique symbol/ + \ nextgroup=@typescriptTypeOperator + \ contained skipwhite skipempty + +syntax region typescriptObjectType matchgroup=typescriptBraces + \ start=/{/ end=/}/ + \ contains=@typescriptTypeMember,typescriptEndColons,@typescriptComments,typescriptAccessibilityModifier,typescriptReadonlyModifier + \ nextgroup=@typescriptTypeOperator + \ contained skipwhite fold + +syntax cluster typescriptTypeMember contains= + \ @typescriptCallSignature, + \ typescriptConstructSignature, + \ typescriptIndexSignature, + \ @typescriptMembers + +syntax region typescriptTupleType matchgroup=typescriptBraces + \ start=/\[/ end=/\]/ + \ contains=@typescriptType + \ contained skipwhite oneline + +syntax cluster typescriptTypeOperator + \ contains=typescriptUnion,typescriptTypeBracket + +syntax match typescriptUnion /|\|&/ contained nextgroup=@typescriptPrimaryType skipwhite skipempty + +syntax cluster typescriptFunctionType contains=typescriptGenericFunc,typescriptFuncType +syntax region typescriptGenericFunc matchgroup=typescriptTypeBrackets + \ start=/</ end=/>/ + \ contains=typescriptTypeParameter + \ nextgroup=typescriptFuncType + \ containedin=typescriptFunctionType + \ contained skipwhite skipnl + +syntax region typescriptFuncType matchgroup=typescriptParens + \ start=/(/ end=/)\s*=>/me=e-2 + \ contains=@typescriptParameterList + \ nextgroup=typescriptFuncTypeArrow + \ contained skipwhite skipnl oneline + +syntax match typescriptFuncTypeArrow /=>/ + \ nextgroup=@typescriptType + \ containedin=typescriptFuncType + \ contained skipwhite skipnl + + +syntax keyword typescriptConstructorType new + \ nextgroup=@typescriptFunctionType + \ contained skipwhite skipnl + +syntax keyword typescriptUserDefinedType is + \ contained nextgroup=@typescriptType skipwhite skipempty + +syntax keyword typescriptTypeQuery typeof keyof + \ nextgroup=typescriptTypeReference + \ contained skipwhite skipnl + +syntax cluster typescriptCallSignature contains=typescriptGenericCall,typescriptCall +syntax region typescriptGenericCall matchgroup=typescriptTypeBrackets + \ start=/</ end=/>/ + \ contains=typescriptTypeParameter + \ nextgroup=typescriptCall + \ contained skipwhite skipnl +syntax region typescriptCall matchgroup=typescriptParens + \ start=/(/ end=/)/ + \ contains=typescriptDecorator,@typescriptParameterList,@typescriptComments + \ nextgroup=typescriptTypeAnnotation,typescriptBlock + \ contained skipwhite skipnl + +syntax match typescriptTypeAnnotation /:/ + \ nextgroup=@typescriptType + \ contained skipwhite skipnl + +syntax cluster typescriptParameterList contains= + \ typescriptTypeAnnotation, + \ typescriptAccessibilityModifier, + \ typescriptOptionalMark, + \ typescriptRestOrSpread, + \ typescriptFuncComma, + \ typescriptDefaultParam + +syntax match typescriptFuncComma /,/ contained + +syntax match typescriptDefaultParam /=/ + \ nextgroup=@typescriptValue + \ contained skipwhite + +syntax keyword typescriptConstructSignature new + \ nextgroup=@typescriptCallSignature + \ contained skipwhite + +syntax region typescriptIndexSignature matchgroup=typescriptBraces + \ start=/\[/ end=/\]/ + \ contains=typescriptPredefinedType,typescriptMappedIn,typescriptString + \ nextgroup=typescriptTypeAnnotation + \ contained skipwhite oneline + +syntax keyword typescriptMappedIn in + \ nextgroup=@typescriptType + \ contained skipwhite skipnl skipempty + +syntax keyword typescriptAliasKeyword type + \ nextgroup=typescriptAliasDeclaration + \ skipwhite skipnl skipempty + +syntax region typescriptAliasDeclaration matchgroup=typescriptUnion + \ start=/ / end=/=/ + \ nextgroup=@typescriptType + \ contains=typescriptConstraint,typescriptTypeParameters + \ contained skipwhite skipempty + +syntax keyword typescriptReadonlyArrayKeyword readonly + \ nextgroup=@typescriptPrimaryType + \ skipwhite + +" extension +if get(g:, 'yats_host_keyword', 1) + "runtime syntax/yats.vim + "runtime syntax/yats/typescript.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Function Boolean + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Error EvalError + syntax keyword typescriptGlobal containedin=typescriptIdentifierName InternalError + syntax keyword typescriptGlobal containedin=typescriptIdentifierName RangeError ReferenceError + syntax keyword typescriptGlobal containedin=typescriptIdentifierName StopIteration + syntax keyword typescriptGlobal containedin=typescriptIdentifierName SyntaxError TypeError + syntax keyword typescriptGlobal containedin=typescriptIdentifierName URIError Date + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Float32Array + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Float64Array + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Int16Array Int32Array + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Int8Array Uint16Array + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Uint32Array Uint8Array + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Uint8ClampedArray + syntax keyword typescriptGlobal containedin=typescriptIdentifierName ParallelArray + syntax keyword typescriptGlobal containedin=typescriptIdentifierName ArrayBuffer DataView + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Iterator Generator + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Reflect Proxy + syntax keyword typescriptGlobal containedin=typescriptIdentifierName arguments + hi def link typescriptGlobal Structure + syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName eval uneval nextgroup=typescriptFuncCallArg + syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName isFinite nextgroup=typescriptFuncCallArg + syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName isNaN parseFloat nextgroup=typescriptFuncCallArg + syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName parseInt nextgroup=typescriptFuncCallArg + syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName decodeURI nextgroup=typescriptFuncCallArg + syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName decodeURIComponent nextgroup=typescriptFuncCallArg + syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName encodeURI nextgroup=typescriptFuncCallArg + syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName encodeURIComponent nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptGlobalMethod + hi def link typescriptGlobalMethod Structure + + "runtime syntax/yats/es6-number.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Number nextgroup=typescriptGlobalNumberDot,typescriptFuncCallArg + syntax match typescriptGlobalNumberDot /\./ contained nextgroup=typescriptNumberStaticProp,typescriptNumberStaticMethod,typescriptProp + syntax keyword typescriptNumberStaticProp contained EPSILON MAX_SAFE_INTEGER MAX_VALUE + syntax keyword typescriptNumberStaticProp contained MIN_SAFE_INTEGER MIN_VALUE NEGATIVE_INFINITY + syntax keyword typescriptNumberStaticProp contained NaN POSITIVE_INFINITY + hi def link typescriptNumberStaticProp Keyword + syntax keyword typescriptNumberStaticMethod contained isFinite isInteger isNaN isSafeInteger nextgroup=typescriptFuncCallArg + syntax keyword typescriptNumberStaticMethod contained parseFloat parseInt nextgroup=typescriptFuncCallArg + hi def link typescriptNumberStaticMethod Keyword + syntax keyword typescriptNumberMethod contained toExponential toFixed toLocaleString nextgroup=typescriptFuncCallArg + syntax keyword typescriptNumberMethod contained toPrecision toSource toString valueOf nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptNumberMethod + hi def link typescriptNumberMethod Keyword + + "runtime syntax/yats/es6-string.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName String nextgroup=typescriptGlobalStringDot,typescriptFuncCallArg + syntax match typescriptGlobalStringDot /\./ contained nextgroup=typescriptStringStaticMethod,typescriptProp + syntax keyword typescriptStringStaticMethod contained fromCharCode fromCodePoint raw nextgroup=typescriptFuncCallArg + hi def link typescriptStringStaticMethod Keyword + syntax keyword typescriptStringMethod contained anchor charAt charCodeAt codePointAt nextgroup=typescriptFuncCallArg + syntax keyword typescriptStringMethod contained concat endsWith includes indexOf lastIndexOf nextgroup=typescriptFuncCallArg + syntax keyword typescriptStringMethod contained link localeCompare match normalize nextgroup=typescriptFuncCallArg + syntax keyword typescriptStringMethod contained padStart padEnd repeat replace search nextgroup=typescriptFuncCallArg + syntax keyword typescriptStringMethod contained slice split startsWith substr substring nextgroup=typescriptFuncCallArg + syntax keyword typescriptStringMethod contained toLocaleLowerCase toLocaleUpperCase nextgroup=typescriptFuncCallArg + syntax keyword typescriptStringMethod contained toLowerCase toString toUpperCase trim nextgroup=typescriptFuncCallArg + syntax keyword typescriptStringMethod contained valueOf nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptStringMethod + hi def link typescriptStringMethod Keyword + + "runtime syntax/yats/es6-array.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Array nextgroup=typescriptGlobalArrayDot,typescriptFuncCallArg + syntax match typescriptGlobalArrayDot /\./ contained nextgroup=typescriptArrayStaticMethod,typescriptProp + syntax keyword typescriptArrayStaticMethod contained from isArray of nextgroup=typescriptFuncCallArg + hi def link typescriptArrayStaticMethod Keyword + syntax keyword typescriptArrayMethod contained concat copyWithin entries every fill nextgroup=typescriptFuncCallArg + syntax keyword typescriptArrayMethod contained filter find findIndex forEach indexOf nextgroup=typescriptFuncCallArg + syntax keyword typescriptArrayMethod contained includes join keys lastIndexOf map nextgroup=typescriptFuncCallArg + syntax keyword typescriptArrayMethod contained pop push reduce reduceRight reverse nextgroup=typescriptFuncCallArg + syntax keyword typescriptArrayMethod contained shift slice some sort splice toLocaleString nextgroup=typescriptFuncCallArg + syntax keyword typescriptArrayMethod contained toSource toString unshift nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptArrayMethod + hi def link typescriptArrayMethod Keyword + + "runtime syntax/yats/es6-object.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Object nextgroup=typescriptGlobalObjectDot,typescriptFuncCallArg + syntax match typescriptGlobalObjectDot /\./ contained nextgroup=typescriptObjectStaticMethod,typescriptProp + syntax keyword typescriptObjectStaticMethod contained create defineProperties defineProperty nextgroup=typescriptFuncCallArg + syntax keyword typescriptObjectStaticMethod contained entries freeze getOwnPropertyDescriptors nextgroup=typescriptFuncCallArg + syntax keyword typescriptObjectStaticMethod contained getOwnPropertyDescriptor getOwnPropertyNames nextgroup=typescriptFuncCallArg + syntax keyword typescriptObjectStaticMethod contained getOwnPropertySymbols getPrototypeOf nextgroup=typescriptFuncCallArg + syntax keyword typescriptObjectStaticMethod contained is isExtensible isFrozen isSealed nextgroup=typescriptFuncCallArg + syntax keyword typescriptObjectStaticMethod contained keys preventExtensions values nextgroup=typescriptFuncCallArg + hi def link typescriptObjectStaticMethod Keyword + syntax keyword typescriptObjectMethod contained getOwnPropertyDescriptors hasOwnProperty nextgroup=typescriptFuncCallArg + syntax keyword typescriptObjectMethod contained isPrototypeOf propertyIsEnumerable nextgroup=typescriptFuncCallArg + syntax keyword typescriptObjectMethod contained toLocaleString toString valueOf seal nextgroup=typescriptFuncCallArg + syntax keyword typescriptObjectMethod contained setPrototypeOf nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptObjectMethod + hi def link typescriptObjectMethod Keyword + + "runtime syntax/yats/es6-symbol.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Symbol nextgroup=typescriptGlobalSymbolDot,typescriptFuncCallArg + syntax match typescriptGlobalSymbolDot /\./ contained nextgroup=typescriptSymbolStaticProp,typescriptSymbolStaticMethod,typescriptProp + syntax keyword typescriptSymbolStaticProp contained length iterator match replace + syntax keyword typescriptSymbolStaticProp contained search split hasInstance isConcatSpreadable + syntax keyword typescriptSymbolStaticProp contained unscopables species toPrimitive + syntax keyword typescriptSymbolStaticProp contained toStringTag + hi def link typescriptSymbolStaticProp Keyword + syntax keyword typescriptSymbolStaticMethod contained for keyFor nextgroup=typescriptFuncCallArg + hi def link typescriptSymbolStaticMethod Keyword + + "runtime syntax/yats/es6-function.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Function + syntax keyword typescriptFunctionMethod contained apply bind call nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptFunctionMethod + hi def link typescriptFunctionMethod Keyword + + "runtime syntax/yats/es6-math.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Math nextgroup=typescriptGlobalMathDot,typescriptFuncCallArg + syntax match typescriptGlobalMathDot /\./ contained nextgroup=typescriptMathStaticProp,typescriptMathStaticMethod,typescriptProp + syntax keyword typescriptMathStaticProp contained E LN10 LN2 LOG10E LOG2E PI SQRT1_2 + syntax keyword typescriptMathStaticProp contained SQRT2 + hi def link typescriptMathStaticProp Keyword + syntax keyword typescriptMathStaticMethod contained abs acos acosh asin asinh atan nextgroup=typescriptFuncCallArg + syntax keyword typescriptMathStaticMethod contained atan2 atanh cbrt ceil clz32 cos nextgroup=typescriptFuncCallArg + syntax keyword typescriptMathStaticMethod contained cosh exp expm1 floor fround hypot nextgroup=typescriptFuncCallArg + syntax keyword typescriptMathStaticMethod contained imul log log10 log1p log2 max nextgroup=typescriptFuncCallArg + syntax keyword typescriptMathStaticMethod contained min pow random round sign sin nextgroup=typescriptFuncCallArg + syntax keyword typescriptMathStaticMethod contained sinh sqrt tan tanh trunc nextgroup=typescriptFuncCallArg + hi def link typescriptMathStaticMethod Keyword + + "runtime syntax/yats/es6-date.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Date nextgroup=typescriptGlobalDateDot,typescriptFuncCallArg + syntax match typescriptGlobalDateDot /\./ contained nextgroup=typescriptDateStaticMethod,typescriptProp + syntax keyword typescriptDateStaticMethod contained UTC now parse nextgroup=typescriptFuncCallArg + hi def link typescriptDateStaticMethod Keyword + syntax keyword typescriptDateMethod contained getDate getDay getFullYear getHours nextgroup=typescriptFuncCallArg + syntax keyword typescriptDateMethod contained getMilliseconds getMinutes getMonth nextgroup=typescriptFuncCallArg + syntax keyword typescriptDateMethod contained getSeconds getTime getTimezoneOffset nextgroup=typescriptFuncCallArg + syntax keyword typescriptDateMethod contained getUTCDate getUTCDay getUTCFullYear nextgroup=typescriptFuncCallArg + syntax keyword typescriptDateMethod contained getUTCHours getUTCMilliseconds getUTCMinutes nextgroup=typescriptFuncCallArg + syntax keyword typescriptDateMethod contained getUTCMonth getUTCSeconds setDate setFullYear nextgroup=typescriptFuncCallArg + syntax keyword typescriptDateMethod contained setHours setMilliseconds setMinutes nextgroup=typescriptFuncCallArg + syntax keyword typescriptDateMethod contained setMonth setSeconds setTime setUTCDate nextgroup=typescriptFuncCallArg + syntax keyword typescriptDateMethod contained setUTCFullYear setUTCHours setUTCMilliseconds nextgroup=typescriptFuncCallArg + syntax keyword typescriptDateMethod contained setUTCMinutes setUTCMonth setUTCSeconds nextgroup=typescriptFuncCallArg + syntax keyword typescriptDateMethod contained toDateString toISOString toJSON toLocaleDateString nextgroup=typescriptFuncCallArg + syntax keyword typescriptDateMethod contained toLocaleFormat toLocaleString toLocaleTimeString nextgroup=typescriptFuncCallArg + syntax keyword typescriptDateMethod contained toSource toString toTimeString toUTCString nextgroup=typescriptFuncCallArg + syntax keyword typescriptDateMethod contained valueOf nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptDateMethod + hi def link typescriptDateMethod Keyword + + "runtime syntax/yats/es6-json.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName JSON nextgroup=typescriptGlobalJSONDot,typescriptFuncCallArg + syntax match typescriptGlobalJSONDot /\./ contained nextgroup=typescriptJSONStaticMethod,typescriptProp + syntax keyword typescriptJSONStaticMethod contained parse stringify nextgroup=typescriptFuncCallArg + hi def link typescriptJSONStaticMethod Keyword + + "runtime syntax/yats/es6-regexp.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName RegExp nextgroup=typescriptGlobalRegExpDot,typescriptFuncCallArg + syntax match typescriptGlobalRegExpDot /\./ contained nextgroup=typescriptRegExpStaticProp,typescriptProp + syntax keyword typescriptRegExpStaticProp contained lastIndex + hi def link typescriptRegExpStaticProp Keyword + syntax keyword typescriptRegExpProp contained global ignoreCase multiline source sticky + syntax cluster props add=typescriptRegExpProp + hi def link typescriptRegExpProp Keyword + syntax keyword typescriptRegExpMethod contained exec test nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptRegExpMethod + hi def link typescriptRegExpMethod Keyword + + "runtime syntax/yats/es6-map.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Map WeakMap + syntax keyword typescriptES6MapProp contained size + syntax cluster props add=typescriptES6MapProp + hi def link typescriptES6MapProp Keyword + syntax keyword typescriptES6MapMethod contained clear delete entries forEach get has nextgroup=typescriptFuncCallArg + syntax keyword typescriptES6MapMethod contained keys set values nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptES6MapMethod + hi def link typescriptES6MapMethod Keyword + + "runtime syntax/yats/es6-set.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Set WeakSet + syntax keyword typescriptES6SetProp contained size + syntax cluster props add=typescriptES6SetProp + hi def link typescriptES6SetProp Keyword + syntax keyword typescriptES6SetMethod contained add clear delete entries forEach has nextgroup=typescriptFuncCallArg + syntax keyword typescriptES6SetMethod contained values nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptES6SetMethod + hi def link typescriptES6SetMethod Keyword + + "runtime syntax/yats/es6-proxy.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Proxy + syntax keyword typescriptProxyAPI contained getOwnPropertyDescriptor getOwnPropertyNames + syntax keyword typescriptProxyAPI contained defineProperty deleteProperty freeze seal + syntax keyword typescriptProxyAPI contained preventExtensions has hasOwn get set enumerate + syntax keyword typescriptProxyAPI contained iterate ownKeys apply construct + hi def link typescriptProxyAPI Keyword + + "runtime syntax/yats/es6-promise.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Promise nextgroup=typescriptGlobalPromiseDot,typescriptFuncCallArg + syntax match typescriptGlobalPromiseDot /\./ contained nextgroup=typescriptPromiseStaticMethod,typescriptProp + syntax keyword typescriptPromiseStaticMethod contained resolve reject all race nextgroup=typescriptFuncCallArg + hi def link typescriptPromiseStaticMethod Keyword + syntax keyword typescriptPromiseMethod contained then catch finally nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptPromiseMethod + hi def link typescriptPromiseMethod Keyword + + "runtime syntax/yats/es6-reflect.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Reflect + syntax keyword typescriptReflectMethod contained apply construct defineProperty deleteProperty nextgroup=typescriptFuncCallArg + syntax keyword typescriptReflectMethod contained enumerate get getOwnPropertyDescriptor nextgroup=typescriptFuncCallArg + syntax keyword typescriptReflectMethod contained getPrototypeOf has isExtensible ownKeys nextgroup=typescriptFuncCallArg + syntax keyword typescriptReflectMethod contained preventExtensions set setPrototypeOf nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptReflectMethod + hi def link typescriptReflectMethod Keyword + + "runtime syntax/yats/ecma-402.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Intl + syntax keyword typescriptIntlMethod contained Collator DateTimeFormat NumberFormat nextgroup=typescriptFuncCallArg + syntax keyword typescriptIntlMethod contained PluralRules nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptIntlMethod + hi def link typescriptIntlMethod Keyword + + "runtime syntax/yats/node.vim + syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName global process + syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName console Buffer + syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName module exports + syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName setTimeout + syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName clearTimeout + syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName setInterval + syntax keyword typescriptNodeGlobal containedin=typescriptIdentifierName clearInterval + hi def link typescriptNodeGlobal Structure + + syntax keyword typescriptGlobal containedin=typescriptIdentifierName describe it test + syntax keyword typescriptGlobal containedin=typescriptIdentifierName before after + syntax keyword typescriptGlobal containedin=typescriptIdentifierName beforeEach afterEach + syntax keyword typescriptGlobal containedin=typescriptIdentifierName beforeAll afterAll + syntax keyword typescriptGlobal containedin=typescriptIdentifierName expect assert + + "runtime syntax/yats/web.vim + syntax keyword typescriptBOM containedin=typescriptIdentifierName AbortController + syntax keyword typescriptBOM containedin=typescriptIdentifierName AbstractWorker AnalyserNode + syntax keyword typescriptBOM containedin=typescriptIdentifierName App Apps ArrayBuffer + syntax keyword typescriptBOM containedin=typescriptIdentifierName ArrayBufferView + syntax keyword typescriptBOM containedin=typescriptIdentifierName Attr AudioBuffer + syntax keyword typescriptBOM containedin=typescriptIdentifierName AudioBufferSourceNode + syntax keyword typescriptBOM containedin=typescriptIdentifierName AudioContext AudioDestinationNode + syntax keyword typescriptBOM containedin=typescriptIdentifierName AudioListener AudioNode + syntax keyword typescriptBOM containedin=typescriptIdentifierName AudioParam BatteryManager + syntax keyword typescriptBOM containedin=typescriptIdentifierName BiquadFilterNode + syntax keyword typescriptBOM containedin=typescriptIdentifierName BlobEvent BluetoothAdapter + syntax keyword typescriptBOM containedin=typescriptIdentifierName BluetoothDevice + syntax keyword typescriptBOM containedin=typescriptIdentifierName BluetoothManager + syntax keyword typescriptBOM containedin=typescriptIdentifierName CameraCapabilities + syntax keyword typescriptBOM containedin=typescriptIdentifierName CameraControl CameraManager + syntax keyword typescriptBOM containedin=typescriptIdentifierName CanvasGradient CanvasImageSource + syntax keyword typescriptBOM containedin=typescriptIdentifierName CanvasPattern CanvasRenderingContext2D + syntax keyword typescriptBOM containedin=typescriptIdentifierName CaretPosition CDATASection + syntax keyword typescriptBOM containedin=typescriptIdentifierName ChannelMergerNode + syntax keyword typescriptBOM containedin=typescriptIdentifierName ChannelSplitterNode + syntax keyword typescriptBOM containedin=typescriptIdentifierName CharacterData ChildNode + syntax keyword typescriptBOM containedin=typescriptIdentifierName ChromeWorker Comment + syntax keyword typescriptBOM containedin=typescriptIdentifierName Connection Console + syntax keyword typescriptBOM containedin=typescriptIdentifierName ContactManager Contacts + syntax keyword typescriptBOM containedin=typescriptIdentifierName ConvolverNode Coordinates + syntax keyword typescriptBOM containedin=typescriptIdentifierName CSS CSSConditionRule + syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSGroupingRule + syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSKeyframeRule + syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSKeyframesRule + syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSMediaRule CSSNamespaceRule + syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSPageRule CSSRule + syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSRuleList CSSStyleDeclaration + syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSStyleRule CSSStyleSheet + syntax keyword typescriptBOM containedin=typescriptIdentifierName CSSSupportsRule + syntax keyword typescriptBOM containedin=typescriptIdentifierName DataTransfer DataView + syntax keyword typescriptBOM containedin=typescriptIdentifierName DedicatedWorkerGlobalScope + syntax keyword typescriptBOM containedin=typescriptIdentifierName DelayNode DeviceAcceleration + syntax keyword typescriptBOM containedin=typescriptIdentifierName DeviceRotationRate + syntax keyword typescriptBOM containedin=typescriptIdentifierName DeviceStorage DirectoryEntry + syntax keyword typescriptBOM containedin=typescriptIdentifierName DirectoryEntrySync + syntax keyword typescriptBOM containedin=typescriptIdentifierName DirectoryReader + syntax keyword typescriptBOM containedin=typescriptIdentifierName DirectoryReaderSync + syntax keyword typescriptBOM containedin=typescriptIdentifierName Document DocumentFragment + syntax keyword typescriptBOM containedin=typescriptIdentifierName DocumentTouch DocumentType + syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMCursor DOMError + syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMException DOMHighResTimeStamp + syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMImplementation + syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMImplementationRegistry + syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMParser DOMRequest + syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMString DOMStringList + syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMStringMap DOMTimeStamp + syntax keyword typescriptBOM containedin=typescriptIdentifierName DOMTokenList DynamicsCompressorNode + syntax keyword typescriptBOM containedin=typescriptIdentifierName Element Entry EntrySync + syntax keyword typescriptBOM containedin=typescriptIdentifierName Extensions FileException + syntax keyword typescriptBOM containedin=typescriptIdentifierName Float32Array Float64Array + syntax keyword typescriptBOM containedin=typescriptIdentifierName FMRadio FormData + syntax keyword typescriptBOM containedin=typescriptIdentifierName GainNode Gamepad + syntax keyword typescriptBOM containedin=typescriptIdentifierName GamepadButton Geolocation + syntax keyword typescriptBOM containedin=typescriptIdentifierName History HTMLAnchorElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLAreaElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLAudioElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLBaseElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLBodyElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLBRElement HTMLButtonElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLCanvasElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLCollection HTMLDataElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLDataListElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLDivElement HTMLDListElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLDocument HTMLElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLEmbedElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLFieldSetElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLFormControlsCollection + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLFormElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLHeadElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLHeadingElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLHRElement HTMLHtmlElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLIFrameElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLImageElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLInputElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLKeygenElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLLabelElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLLegendElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLLIElement HTMLLinkElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLMapElement HTMLMediaElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLMetaElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLMeterElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLModElement HTMLObjectElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLOListElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLOptGroupElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLOptionElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLOptionsCollection + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLOutputElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLParagraphElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLParamElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLPreElement HTMLProgressElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLQuoteElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLScriptElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLSelectElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLSourceElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLSpanElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLStyleElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableCaptionElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableCellElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableColElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableDataCellElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableHeaderCellElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableRowElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTableSectionElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTextAreaElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTimeElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTitleElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLTrackElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLUListElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLUnknownElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName HTMLVideoElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBCursor IDBCursorSync + syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBCursorWithValue + syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBDatabase IDBDatabaseSync + syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBEnvironment IDBEnvironmentSync + syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBFactory IDBFactorySync + syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBIndex IDBIndexSync + syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBKeyRange IDBObjectStore + syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBObjectStoreSync + syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBOpenDBRequest + syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBRequest IDBTransaction + syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBTransactionSync + syntax keyword typescriptBOM containedin=typescriptIdentifierName IDBVersionChangeEvent + syntax keyword typescriptBOM containedin=typescriptIdentifierName ImageData IndexedDB + syntax keyword typescriptBOM containedin=typescriptIdentifierName Int16Array Int32Array + syntax keyword typescriptBOM containedin=typescriptIdentifierName Int8Array L10n LinkStyle + syntax keyword typescriptBOM containedin=typescriptIdentifierName LocalFileSystem + syntax keyword typescriptBOM containedin=typescriptIdentifierName LocalFileSystemSync + syntax keyword typescriptBOM containedin=typescriptIdentifierName Location LockedFile + syntax keyword typescriptBOM containedin=typescriptIdentifierName MediaQueryList MediaQueryListListener + syntax keyword typescriptBOM containedin=typescriptIdentifierName MediaRecorder MediaSource + syntax keyword typescriptBOM containedin=typescriptIdentifierName MediaStream MediaStreamTrack + syntax keyword typescriptBOM containedin=typescriptIdentifierName MutationObserver + syntax keyword typescriptBOM containedin=typescriptIdentifierName Navigator NavigatorGeolocation + syntax keyword typescriptBOM containedin=typescriptIdentifierName NavigatorID NavigatorLanguage + syntax keyword typescriptBOM containedin=typescriptIdentifierName NavigatorOnLine + syntax keyword typescriptBOM containedin=typescriptIdentifierName NavigatorPlugins + syntax keyword typescriptBOM containedin=typescriptIdentifierName Node NodeFilter + syntax keyword typescriptBOM containedin=typescriptIdentifierName NodeIterator NodeList + syntax keyword typescriptBOM containedin=typescriptIdentifierName Notification OfflineAudioContext + syntax keyword typescriptBOM containedin=typescriptIdentifierName OscillatorNode PannerNode + syntax keyword typescriptBOM containedin=typescriptIdentifierName ParentNode Performance + syntax keyword typescriptBOM containedin=typescriptIdentifierName PerformanceNavigation + syntax keyword typescriptBOM containedin=typescriptIdentifierName PerformanceTiming + syntax keyword typescriptBOM containedin=typescriptIdentifierName Permissions PermissionSettings + syntax keyword typescriptBOM containedin=typescriptIdentifierName Plugin PluginArray + syntax keyword typescriptBOM containedin=typescriptIdentifierName Position PositionError + syntax keyword typescriptBOM containedin=typescriptIdentifierName PositionOptions + syntax keyword typescriptBOM containedin=typescriptIdentifierName PowerManager ProcessingInstruction + syntax keyword typescriptBOM containedin=typescriptIdentifierName PromiseResolver + syntax keyword typescriptBOM containedin=typescriptIdentifierName PushManager Range + syntax keyword typescriptBOM containedin=typescriptIdentifierName RTCConfiguration + syntax keyword typescriptBOM containedin=typescriptIdentifierName RTCPeerConnection + syntax keyword typescriptBOM containedin=typescriptIdentifierName RTCPeerConnectionErrorCallback + syntax keyword typescriptBOM containedin=typescriptIdentifierName RTCSessionDescription + syntax keyword typescriptBOM containedin=typescriptIdentifierName RTCSessionDescriptionCallback + syntax keyword typescriptBOM containedin=typescriptIdentifierName ScriptProcessorNode + syntax keyword typescriptBOM containedin=typescriptIdentifierName Selection SettingsLock + syntax keyword typescriptBOM containedin=typescriptIdentifierName SettingsManager + syntax keyword typescriptBOM containedin=typescriptIdentifierName SharedWorker StyleSheet + syntax keyword typescriptBOM containedin=typescriptIdentifierName StyleSheetList SVGAElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAngle SVGAnimateColorElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedAngle + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedBoolean + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedEnumeration + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedInteger + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedLength + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedLengthList + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedNumber + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedNumberList + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedPoints + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedPreserveAspectRatio + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedRect + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedString + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimatedTransformList + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimateElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimateMotionElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimateTransformElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGAnimationElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGCircleElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGClipPathElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGCursorElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGDefsElement SVGDescElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGElement SVGEllipseElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGFilterElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGFontElement SVGFontFaceElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGFontFaceFormatElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGFontFaceNameElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGFontFaceSrcElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGFontFaceUriElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGForeignObjectElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGGElement SVGGlyphElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGGradientElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGHKernElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGImageElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGLength SVGLengthList + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGLinearGradientElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGLineElement SVGMaskElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGMatrix SVGMissingGlyphElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGMPathElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGNumber SVGNumberList + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGPathElement SVGPatternElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGPoint SVGPolygonElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGPolylineElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGPreserveAspectRatio + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGRadialGradientElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGRect SVGRectElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGScriptElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGSetElement SVGStopElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGStringList SVGStylable + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGStyleElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGSVGElement SVGSwitchElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGSymbolElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGTests SVGTextElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGTextPositioningElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGTitleElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGTransform SVGTransformable + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGTransformList + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGTRefElement SVGTSpanElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGUseElement SVGViewElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName SVGVKernElement + syntax keyword typescriptBOM containedin=typescriptIdentifierName TCPServerSocket + syntax keyword typescriptBOM containedin=typescriptIdentifierName TCPSocket Telephony + syntax keyword typescriptBOM containedin=typescriptIdentifierName TelephonyCall Text + syntax keyword typescriptBOM containedin=typescriptIdentifierName TextDecoder TextEncoder + syntax keyword typescriptBOM containedin=typescriptIdentifierName TextMetrics TimeRanges + syntax keyword typescriptBOM containedin=typescriptIdentifierName Touch TouchList + syntax keyword typescriptBOM containedin=typescriptIdentifierName Transferable TreeWalker + syntax keyword typescriptBOM containedin=typescriptIdentifierName Uint16Array Uint32Array + syntax keyword typescriptBOM containedin=typescriptIdentifierName Uint8Array Uint8ClampedArray + syntax keyword typescriptBOM containedin=typescriptIdentifierName URLSearchParams + syntax keyword typescriptBOM containedin=typescriptIdentifierName URLUtilsReadOnly + syntax keyword typescriptBOM containedin=typescriptIdentifierName UserProximityEvent + syntax keyword typescriptBOM containedin=typescriptIdentifierName ValidityState VideoPlaybackQuality + syntax keyword typescriptBOM containedin=typescriptIdentifierName WaveShaperNode WebBluetooth + syntax keyword typescriptBOM containedin=typescriptIdentifierName WebGLRenderingContext + syntax keyword typescriptBOM containedin=typescriptIdentifierName WebSMS WebSocket + syntax keyword typescriptBOM containedin=typescriptIdentifierName WebVTT WifiManager + syntax keyword typescriptBOM containedin=typescriptIdentifierName Window Worker WorkerConsole + syntax keyword typescriptBOM containedin=typescriptIdentifierName WorkerLocation WorkerNavigator + syntax keyword typescriptBOM containedin=typescriptIdentifierName XDomainRequest XMLDocument + syntax keyword typescriptBOM containedin=typescriptIdentifierName XMLHttpRequestEventTarget + hi def link typescriptBOM Structure + + "runtime syntax/yats/web-window.vim + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName applicationCache + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName closed + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName Components + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName controllers + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName dialogArguments + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName document + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName frameElement + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName frames + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName fullScreen + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName history + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName innerHeight + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName innerWidth + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName length + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName location + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName locationbar + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName menubar + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName messageManager + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName name navigator + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName opener + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName outerHeight + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName outerWidth + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName pageXOffset + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName pageYOffset + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName parent + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName performance + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName personalbar + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName returnValue + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName screen + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName screenX + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName screenY + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName scrollbars + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName scrollMaxX + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName scrollMaxY + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName scrollX + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName scrollY + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName self sidebar + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName status + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName statusbar + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName toolbar + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName top visualViewport + syntax keyword typescriptBOMWindowProp containedin=typescriptIdentifierName window + syntax cluster props add=typescriptBOMWindowProp + hi def link typescriptBOMWindowProp Structure + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName alert nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName atob nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName blur nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName btoa nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName clearImmediate nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName clearInterval nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName clearTimeout nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName close nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName confirm nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName dispatchEvent nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName find nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName focus nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName getAttention nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName getAttentionWithCycleCount nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName getComputedStyle nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName getDefaulComputedStyle nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName getSelection nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName matchMedia nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName maximize nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName moveBy nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName moveTo nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName open nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName openDialog nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName postMessage nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName print nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName prompt nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName removeEventListener nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName resizeBy nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName resizeTo nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName restore nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName scroll nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName scrollBy nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName scrollByLines nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName scrollByPages nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName scrollTo nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName setCursor nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName setImmediate nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName setInterval nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName setResizable nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName setTimeout nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName showModalDialog nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName sizeToContent nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName stop nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMWindowMethod containedin=typescriptIdentifierName updateCommands nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptBOMWindowMethod + hi def link typescriptBOMWindowMethod Structure + syntax keyword typescriptBOMWindowEvent contained onabort onbeforeunload onblur onchange + syntax keyword typescriptBOMWindowEvent contained onclick onclose oncontextmenu ondevicelight + syntax keyword typescriptBOMWindowEvent contained ondevicemotion ondeviceorientation + syntax keyword typescriptBOMWindowEvent contained ondeviceproximity ondragdrop onerror + syntax keyword typescriptBOMWindowEvent contained onfocus onhashchange onkeydown onkeypress + syntax keyword typescriptBOMWindowEvent contained onkeyup onload onmousedown onmousemove + syntax keyword typescriptBOMWindowEvent contained onmouseout onmouseover onmouseup + syntax keyword typescriptBOMWindowEvent contained onmozbeforepaint onpaint onpopstate + syntax keyword typescriptBOMWindowEvent contained onreset onresize onscroll onselect + syntax keyword typescriptBOMWindowEvent contained onsubmit onunload onuserproximity + syntax keyword typescriptBOMWindowEvent contained onpageshow onpagehide + hi def link typescriptBOMWindowEvent Keyword + syntax keyword typescriptBOMWindowCons containedin=typescriptIdentifierName DOMParser + syntax keyword typescriptBOMWindowCons containedin=typescriptIdentifierName QueryInterface + syntax keyword typescriptBOMWindowCons containedin=typescriptIdentifierName XMLSerializer + hi def link typescriptBOMWindowCons Structure + + "runtime syntax/yats/web-navigator.vim + syntax keyword typescriptBOMNavigatorProp contained battery buildID connection cookieEnabled + syntax keyword typescriptBOMNavigatorProp contained doNotTrack maxTouchPoints oscpu + syntax keyword typescriptBOMNavigatorProp contained productSub push serviceWorker + syntax keyword typescriptBOMNavigatorProp contained vendor vendorSub + syntax cluster props add=typescriptBOMNavigatorProp + hi def link typescriptBOMNavigatorProp Keyword + syntax keyword typescriptBOMNavigatorMethod contained addIdleObserver geolocation nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMNavigatorMethod contained getDeviceStorage getDeviceStorages nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMNavigatorMethod contained getGamepads getUserMedia registerContentHandler nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMNavigatorMethod contained removeIdleObserver requestWakeLock nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMNavigatorMethod contained share vibrate watch registerProtocolHandler nextgroup=typescriptFuncCallArg + syntax keyword typescriptBOMNavigatorMethod contained sendBeacon nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptBOMNavigatorMethod + hi def link typescriptBOMNavigatorMethod Keyword + syntax keyword typescriptServiceWorkerMethod contained register nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptServiceWorkerMethod + hi def link typescriptServiceWorkerMethod Keyword + + "runtime syntax/yats/web-location.vim + syntax keyword typescriptBOMLocationProp contained href protocol host hostname port + syntax keyword typescriptBOMLocationProp contained pathname search hash username password + syntax keyword typescriptBOMLocationProp contained origin + syntax cluster props add=typescriptBOMLocationProp + hi def link typescriptBOMLocationProp Keyword + syntax keyword typescriptBOMLocationMethod contained assign reload replace toString nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptBOMLocationMethod + hi def link typescriptBOMLocationMethod Keyword + + "runtime syntax/yats/web-history.vim + syntax keyword typescriptBOMHistoryProp contained length current next previous state + syntax keyword typescriptBOMHistoryProp contained scrollRestoration + syntax cluster props add=typescriptBOMHistoryProp + hi def link typescriptBOMHistoryProp Keyword + syntax keyword typescriptBOMHistoryMethod contained back forward go pushState replaceState nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptBOMHistoryMethod + hi def link typescriptBOMHistoryMethod Keyword + + "runtime syntax/yats/web-console.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName console + syntax keyword typescriptConsoleMethod contained count dir error group groupCollapsed nextgroup=typescriptFuncCallArg + syntax keyword typescriptConsoleMethod contained groupEnd info log time timeEnd trace nextgroup=typescriptFuncCallArg + syntax keyword typescriptConsoleMethod contained warn nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptConsoleMethod + hi def link typescriptConsoleMethod Keyword + + "runtime syntax/yats/web-xhr.vim + syntax keyword typescriptXHRGlobal containedin=typescriptIdentifierName XMLHttpRequest + hi def link typescriptXHRGlobal Structure + syntax keyword typescriptXHRProp contained onreadystatechange readyState response + syntax keyword typescriptXHRProp contained responseText responseType responseXML status + syntax keyword typescriptXHRProp contained statusText timeout ontimeout upload withCredentials + syntax cluster props add=typescriptXHRProp + hi def link typescriptXHRProp Keyword + syntax keyword typescriptXHRMethod contained abort getAllResponseHeaders getResponseHeader nextgroup=typescriptFuncCallArg + syntax keyword typescriptXHRMethod contained open overrideMimeType send setRequestHeader nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptXHRMethod + hi def link typescriptXHRMethod Keyword + + "runtime syntax/yats/web-blob.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Blob BlobBuilder + syntax keyword typescriptGlobal containedin=typescriptIdentifierName File FileReader + syntax keyword typescriptGlobal containedin=typescriptIdentifierName FileReaderSync + syntax keyword typescriptGlobal containedin=typescriptIdentifierName URL nextgroup=typescriptGlobalURLDot,typescriptFuncCallArg + syntax match typescriptGlobalURLDot /\./ contained nextgroup=typescriptURLStaticMethod,typescriptProp + syntax keyword typescriptGlobal containedin=typescriptIdentifierName URLUtils + syntax keyword typescriptFileMethod contained readAsArrayBuffer readAsBinaryString nextgroup=typescriptFuncCallArg + syntax keyword typescriptFileMethod contained readAsDataURL readAsText nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptFileMethod + hi def link typescriptFileMethod Keyword + syntax keyword typescriptFileReaderProp contained error readyState result + syntax cluster props add=typescriptFileReaderProp + hi def link typescriptFileReaderProp Keyword + syntax keyword typescriptFileReaderMethod contained abort readAsArrayBuffer readAsBinaryString nextgroup=typescriptFuncCallArg + syntax keyword typescriptFileReaderMethod contained readAsDataURL readAsText nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptFileReaderMethod + hi def link typescriptFileReaderMethod Keyword + syntax keyword typescriptFileListMethod contained item nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptFileListMethod + hi def link typescriptFileListMethod Keyword + syntax keyword typescriptBlobMethod contained append getBlob getFile nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptBlobMethod + hi def link typescriptBlobMethod Keyword + syntax keyword typescriptURLUtilsProp contained hash host hostname href origin password + syntax keyword typescriptURLUtilsProp contained pathname port protocol search searchParams + syntax keyword typescriptURLUtilsProp contained username + syntax cluster props add=typescriptURLUtilsProp + hi def link typescriptURLUtilsProp Keyword + syntax keyword typescriptURLStaticMethod contained createObjectURL revokeObjectURL nextgroup=typescriptFuncCallArg + hi def link typescriptURLStaticMethod Keyword + + "runtime syntax/yats/web-crypto.vim + syntax keyword typescriptCryptoGlobal containedin=typescriptIdentifierName crypto + hi def link typescriptCryptoGlobal Structure + syntax keyword typescriptSubtleCryptoMethod contained encrypt decrypt sign verify nextgroup=typescriptFuncCallArg + syntax keyword typescriptSubtleCryptoMethod contained digest nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptSubtleCryptoMethod + hi def link typescriptSubtleCryptoMethod Keyword + syntax keyword typescriptCryptoProp contained subtle + syntax cluster props add=typescriptCryptoProp + hi def link typescriptCryptoProp Keyword + syntax keyword typescriptCryptoMethod contained getRandomValues nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptCryptoMethod + hi def link typescriptCryptoMethod Keyword + + "runtime syntax/yats/web-fetch.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Headers Request + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Response + syntax keyword typescriptGlobalMethod containedin=typescriptIdentifierName fetch nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptGlobalMethod + hi def link typescriptGlobalMethod Structure + syntax keyword typescriptHeadersMethod contained append delete get getAll has set nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptHeadersMethod + hi def link typescriptHeadersMethod Keyword + syntax keyword typescriptRequestProp contained method url headers context referrer + syntax keyword typescriptRequestProp contained mode credentials cache + syntax cluster props add=typescriptRequestProp + hi def link typescriptRequestProp Keyword + syntax keyword typescriptRequestMethod contained clone nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptRequestMethod + hi def link typescriptRequestMethod Keyword + syntax keyword typescriptResponseProp contained type url status statusText headers + syntax keyword typescriptResponseProp contained redirected + syntax cluster props add=typescriptResponseProp + hi def link typescriptResponseProp Keyword + syntax keyword typescriptResponseMethod contained clone nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptResponseMethod + hi def link typescriptResponseMethod Keyword + + "runtime syntax/yats/web-service-worker.vim + syntax keyword typescriptServiceWorkerProp contained controller ready + syntax cluster props add=typescriptServiceWorkerProp + hi def link typescriptServiceWorkerProp Keyword + syntax keyword typescriptServiceWorkerMethod contained register getRegistration nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptServiceWorkerMethod + hi def link typescriptServiceWorkerMethod Keyword + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Cache + syntax keyword typescriptCacheMethod contained match matchAll add addAll put delete nextgroup=typescriptFuncCallArg + syntax keyword typescriptCacheMethod contained keys nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptCacheMethod + hi def link typescriptCacheMethod Keyword + + "runtime syntax/yats/web-encoding.vim + syntax keyword typescriptEncodingGlobal containedin=typescriptIdentifierName TextEncoder + syntax keyword typescriptEncodingGlobal containedin=typescriptIdentifierName TextDecoder + hi def link typescriptEncodingGlobal Structure + syntax keyword typescriptEncodingProp contained encoding fatal ignoreBOM + syntax cluster props add=typescriptEncodingProp + hi def link typescriptEncodingProp Keyword + syntax keyword typescriptEncodingMethod contained encode decode nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptEncodingMethod + hi def link typescriptEncodingMethod Keyword + + "runtime syntax/yats/web-geo.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName Geolocation + syntax keyword typescriptGeolocationMethod contained getCurrentPosition watchPosition nextgroup=typescriptFuncCallArg + syntax keyword typescriptGeolocationMethod contained clearWatch nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptGeolocationMethod + hi def link typescriptGeolocationMethod Keyword + + "runtime syntax/yats/web-network.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName NetworkInformation + syntax keyword typescriptBOMNetworkProp contained downlink downlinkMax effectiveType + syntax keyword typescriptBOMNetworkProp contained rtt type + syntax cluster props add=typescriptBOMNetworkProp + hi def link typescriptBOMNetworkProp Keyword + + "runtime syntax/yats/web-payment.vim + syntax keyword typescriptGlobal containedin=typescriptIdentifierName PaymentRequest + syntax keyword typescriptPaymentMethod contained show abort canMakePayment nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptPaymentMethod + hi def link typescriptPaymentMethod Keyword + syntax keyword typescriptPaymentProp contained shippingAddress shippingOption result + syntax cluster props add=typescriptPaymentProp + hi def link typescriptPaymentProp Keyword + syntax keyword typescriptPaymentEvent contained onshippingaddresschange onshippingoptionchange + hi def link typescriptPaymentEvent Keyword + syntax keyword typescriptPaymentResponseMethod contained complete nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptPaymentResponseMethod + hi def link typescriptPaymentResponseMethod Keyword + syntax keyword typescriptPaymentResponseProp contained details methodName payerEmail + syntax keyword typescriptPaymentResponseProp contained payerPhone shippingAddress + syntax keyword typescriptPaymentResponseProp contained shippingOption + syntax cluster props add=typescriptPaymentResponseProp + hi def link typescriptPaymentResponseProp Keyword + syntax keyword typescriptPaymentAddressProp contained addressLine careOf city country + syntax keyword typescriptPaymentAddressProp contained country dependentLocality languageCode + syntax keyword typescriptPaymentAddressProp contained organization phone postalCode + syntax keyword typescriptPaymentAddressProp contained recipient region sortingCode + syntax cluster props add=typescriptPaymentAddressProp + hi def link typescriptPaymentAddressProp Keyword + syntax keyword typescriptPaymentShippingOptionProp contained id label amount selected + syntax cluster props add=typescriptPaymentShippingOptionProp + hi def link typescriptPaymentShippingOptionProp Keyword + + "runtime syntax/yats/dom-node.vim + syntax keyword typescriptDOMNodeProp contained attributes baseURI baseURIObject childNodes + syntax keyword typescriptDOMNodeProp contained firstChild lastChild localName namespaceURI + syntax keyword typescriptDOMNodeProp contained nextSibling nodeName nodePrincipal + syntax keyword typescriptDOMNodeProp contained nodeType nodeValue ownerDocument parentElement + syntax keyword typescriptDOMNodeProp contained parentNode prefix previousSibling textContent + syntax cluster props add=typescriptDOMNodeProp + hi def link typescriptDOMNodeProp Keyword + syntax keyword typescriptDOMNodeMethod contained appendChild cloneNode compareDocumentPosition nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMNodeMethod contained getUserData hasAttributes hasChildNodes nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMNodeMethod contained insertBefore isDefaultNamespace isEqualNode nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMNodeMethod contained isSameNode isSupported lookupNamespaceURI nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMNodeMethod contained lookupPrefix normalize removeChild nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMNodeMethod contained replaceChild setUserData nextgroup=typescriptFuncCallArg + syntax match typescriptDOMNodeMethod contained /contains/ + syntax cluster props add=typescriptDOMNodeMethod + hi def link typescriptDOMNodeMethod Keyword + syntax keyword typescriptDOMNodeType contained ELEMENT_NODE ATTRIBUTE_NODE TEXT_NODE + syntax keyword typescriptDOMNodeType contained CDATA_SECTION_NODEN_NODE ENTITY_REFERENCE_NODE + syntax keyword typescriptDOMNodeType contained ENTITY_NODE PROCESSING_INSTRUCTION_NODEN_NODE + syntax keyword typescriptDOMNodeType contained COMMENT_NODE DOCUMENT_NODE DOCUMENT_TYPE_NODE + syntax keyword typescriptDOMNodeType contained DOCUMENT_FRAGMENT_NODE NOTATION_NODE + hi def link typescriptDOMNodeType Keyword + + "runtime syntax/yats/dom-elem.vim + syntax keyword typescriptDOMElemAttrs contained accessKey clientHeight clientLeft + syntax keyword typescriptDOMElemAttrs contained clientTop clientWidth id innerHTML + syntax keyword typescriptDOMElemAttrs contained length onafterscriptexecute onbeforescriptexecute + syntax keyword typescriptDOMElemAttrs contained oncopy oncut onpaste onwheel scrollHeight + syntax keyword typescriptDOMElemAttrs contained scrollLeft scrollTop scrollWidth tagName + syntax keyword typescriptDOMElemAttrs contained classList className name outerHTML + syntax keyword typescriptDOMElemAttrs contained style + hi def link typescriptDOMElemAttrs Keyword + syntax keyword typescriptDOMElemFuncs contained getAttributeNS getAttributeNode getAttributeNodeNS + syntax keyword typescriptDOMElemFuncs contained getBoundingClientRect getClientRects + syntax keyword typescriptDOMElemFuncs contained getElementsByClassName getElementsByTagName + syntax keyword typescriptDOMElemFuncs contained getElementsByTagNameNS hasAttribute + syntax keyword typescriptDOMElemFuncs contained hasAttributeNS insertAdjacentHTML + syntax keyword typescriptDOMElemFuncs contained matches querySelector querySelectorAll + syntax keyword typescriptDOMElemFuncs contained removeAttribute removeAttributeNS + syntax keyword typescriptDOMElemFuncs contained removeAttributeNode requestFullscreen + syntax keyword typescriptDOMElemFuncs contained requestPointerLock scrollIntoView + syntax keyword typescriptDOMElemFuncs contained setAttribute setAttributeNS setAttributeNode + syntax keyword typescriptDOMElemFuncs contained setAttributeNodeNS setCapture supports + syntax keyword typescriptDOMElemFuncs contained getAttribute + hi def link typescriptDOMElemFuncs Keyword + + "runtime syntax/yats/dom-document.vim + syntax keyword typescriptDOMDocProp contained activeElement body cookie defaultView + syntax keyword typescriptDOMDocProp contained designMode dir domain embeds forms head + syntax keyword typescriptDOMDocProp contained images lastModified links location plugins + syntax keyword typescriptDOMDocProp contained postMessage readyState referrer registerElement + syntax keyword typescriptDOMDocProp contained scripts styleSheets title vlinkColor + syntax keyword typescriptDOMDocProp contained xmlEncoding characterSet compatMode + syntax keyword typescriptDOMDocProp contained contentType currentScript doctype documentElement + syntax keyword typescriptDOMDocProp contained documentURI documentURIObject firstChild + syntax keyword typescriptDOMDocProp contained implementation lastStyleSheetSet namespaceURI + syntax keyword typescriptDOMDocProp contained nodePrincipal ononline pointerLockElement + syntax keyword typescriptDOMDocProp contained popupNode preferredStyleSheetSet selectedStyleSheetSet + syntax keyword typescriptDOMDocProp contained styleSheetSets textContent tooltipNode + syntax cluster props add=typescriptDOMDocProp + hi def link typescriptDOMDocProp Keyword + syntax keyword typescriptDOMDocMethod contained caretPositionFromPoint close createNodeIterator nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMDocMethod contained createRange createTreeWalker elementFromPoint nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMDocMethod contained getElementsByName adoptNode createAttribute nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMDocMethod contained createCDATASection createComment createDocumentFragment nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMDocMethod contained createElement createElementNS createEvent nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMDocMethod contained createExpression createNSResolver nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMDocMethod contained createProcessingInstruction createTextNode nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMDocMethod contained enableStyleSheetsForSet evaluate execCommand nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMDocMethod contained exitPointerLock getBoxObjectFor getElementById nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMDocMethod contained getElementsByClassName getElementsByTagName nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMDocMethod contained getElementsByTagNameNS getSelection nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMDocMethod contained hasFocus importNode loadOverlay open nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMDocMethod contained queryCommandSupported querySelector nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMDocMethod contained querySelectorAll write writeln nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptDOMDocMethod + hi def link typescriptDOMDocMethod Keyword + + "runtime syntax/yats/dom-event.vim + syntax keyword typescriptDOMEventTargetMethod contained addEventListener removeEventListener nextgroup=typescriptEventFuncCallArg + syntax keyword typescriptDOMEventTargetMethod contained dispatchEvent waitUntil nextgroup=typescriptEventFuncCallArg + syntax cluster props add=typescriptDOMEventTargetMethod + hi def link typescriptDOMEventTargetMethod Keyword + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName AnimationEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName AudioProcessingEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName BeforeInputEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName BeforeUnloadEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName BlobEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName ClipboardEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName CloseEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName CompositionEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName CSSFontFaceLoadEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName CustomEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName DeviceLightEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName DeviceMotionEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName DeviceOrientationEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName DeviceProximityEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName DOMTransactionEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName DragEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName EditingBeforeInputEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName ErrorEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName FocusEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName GamepadEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName HashChangeEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName IDBVersionChangeEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName KeyboardEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName MediaStreamEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName MessageEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName MouseEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName MutationEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName OfflineAudioCompletionEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName PageTransitionEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName PointerEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName PopStateEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName ProgressEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName RelatedEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName RTCPeerConnectionIceEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName SensorEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName StorageEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName SVGEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName SVGZoomEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName TimeEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName TouchEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName TrackEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName TransitionEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName UIEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName UserProximityEvent + syntax keyword typescriptDOMEventCons containedin=typescriptIdentifierName WheelEvent + hi def link typescriptDOMEventCons Structure + syntax keyword typescriptDOMEventProp contained bubbles cancelable currentTarget defaultPrevented + syntax keyword typescriptDOMEventProp contained eventPhase target timeStamp type isTrusted + syntax keyword typescriptDOMEventProp contained isReload + syntax cluster props add=typescriptDOMEventProp + hi def link typescriptDOMEventProp Keyword + syntax keyword typescriptDOMEventMethod contained initEvent preventDefault stopImmediatePropagation nextgroup=typescriptEventFuncCallArg + syntax keyword typescriptDOMEventMethod contained stopPropagation respondWith default nextgroup=typescriptEventFuncCallArg + syntax cluster props add=typescriptDOMEventMethod + hi def link typescriptDOMEventMethod Keyword + + "runtime syntax/yats/dom-storage.vim + syntax keyword typescriptDOMStorage contained sessionStorage localStorage + hi def link typescriptDOMStorage Keyword + syntax keyword typescriptDOMStorageProp contained length + syntax cluster props add=typescriptDOMStorageProp + hi def link typescriptDOMStorageProp Keyword + syntax keyword typescriptDOMStorageMethod contained getItem key setItem removeItem nextgroup=typescriptFuncCallArg + syntax keyword typescriptDOMStorageMethod contained clear nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptDOMStorageMethod + hi def link typescriptDOMStorageMethod Keyword + + "runtime syntax/yats/dom-form.vim + syntax keyword typescriptDOMFormProp contained acceptCharset action elements encoding + syntax keyword typescriptDOMFormProp contained enctype length method name target + syntax cluster props add=typescriptDOMFormProp + hi def link typescriptDOMFormProp Keyword + syntax keyword typescriptDOMFormMethod contained reportValidity reset submit nextgroup=typescriptFuncCallArg + syntax cluster props add=typescriptDOMFormMethod + hi def link typescriptDOMFormMethod Keyword + + "runtime syntax/yats/css.vim + syntax keyword typescriptDOMStyle contained alignContent alignItems alignSelf animation + syntax keyword typescriptDOMStyle contained animationDelay animationDirection animationDuration + syntax keyword typescriptDOMStyle contained animationFillMode animationIterationCount + syntax keyword typescriptDOMStyle contained animationName animationPlayState animationTimingFunction + syntax keyword typescriptDOMStyle contained appearance backfaceVisibility background + syntax keyword typescriptDOMStyle contained backgroundAttachment backgroundBlendMode + syntax keyword typescriptDOMStyle contained backgroundClip backgroundColor backgroundImage + syntax keyword typescriptDOMStyle contained backgroundOrigin backgroundPosition backgroundRepeat + syntax keyword typescriptDOMStyle contained backgroundSize border borderBottom borderBottomColor + syntax keyword typescriptDOMStyle contained borderBottomLeftRadius borderBottomRightRadius + syntax keyword typescriptDOMStyle contained borderBottomStyle borderBottomWidth borderCollapse + syntax keyword typescriptDOMStyle contained borderColor borderImage borderImageOutset + syntax keyword typescriptDOMStyle contained borderImageRepeat borderImageSlice borderImageSource + syntax keyword typescriptDOMStyle contained borderImageWidth borderLeft borderLeftColor + syntax keyword typescriptDOMStyle contained borderLeftStyle borderLeftWidth borderRadius + syntax keyword typescriptDOMStyle contained borderRight borderRightColor borderRightStyle + syntax keyword typescriptDOMStyle contained borderRightWidth borderSpacing borderStyle + syntax keyword typescriptDOMStyle contained borderTop borderTopColor borderTopLeftRadius + syntax keyword typescriptDOMStyle contained borderTopRightRadius borderTopStyle borderTopWidth + syntax keyword typescriptDOMStyle contained borderWidth bottom boxDecorationBreak + syntax keyword typescriptDOMStyle contained boxShadow boxSizing breakAfter breakBefore + syntax keyword typescriptDOMStyle contained breakInside captionSide caretColor caretShape + syntax keyword typescriptDOMStyle contained caret clear clip clipPath color columns + syntax keyword typescriptDOMStyle contained columnCount columnFill columnGap columnRule + syntax keyword typescriptDOMStyle contained columnRuleColor columnRuleStyle columnRuleWidth + syntax keyword typescriptDOMStyle contained columnSpan columnWidth content counterIncrement + syntax keyword typescriptDOMStyle contained counterReset cursor direction display + syntax keyword typescriptDOMStyle contained emptyCells flex flexBasis flexDirection + syntax keyword typescriptDOMStyle contained flexFlow flexGrow flexShrink flexWrap + syntax keyword typescriptDOMStyle contained float font fontFamily fontFeatureSettings + syntax keyword typescriptDOMStyle contained fontKerning fontLanguageOverride fontSize + syntax keyword typescriptDOMStyle contained fontSizeAdjust fontStretch fontStyle fontSynthesis + syntax keyword typescriptDOMStyle contained fontVariant fontVariantAlternates fontVariantCaps + syntax keyword typescriptDOMStyle contained fontVariantEastAsian fontVariantLigatures + syntax keyword typescriptDOMStyle contained fontVariantNumeric fontVariantPosition + syntax keyword typescriptDOMStyle contained fontWeight grad grid gridArea gridAutoColumns + syntax keyword typescriptDOMStyle contained gridAutoFlow gridAutoPosition gridAutoRows + syntax keyword typescriptDOMStyle contained gridColumn gridColumnStart gridColumnEnd + syntax keyword typescriptDOMStyle contained gridRow gridRowStart gridRowEnd gridTemplate + syntax keyword typescriptDOMStyle contained gridTemplateAreas gridTemplateRows gridTemplateColumns + syntax keyword typescriptDOMStyle contained height hyphens imageRendering imageResolution + syntax keyword typescriptDOMStyle contained imageOrientation imeMode inherit justifyContent + syntax keyword typescriptDOMStyle contained left letterSpacing lineBreak lineHeight + syntax keyword typescriptDOMStyle contained listStyle listStyleImage listStylePosition + syntax keyword typescriptDOMStyle contained listStyleType margin marginBottom marginLeft + syntax keyword typescriptDOMStyle contained marginRight marginTop marks mask maskType + syntax keyword typescriptDOMStyle contained maxHeight maxWidth minHeight minWidth + syntax keyword typescriptDOMStyle contained mixBlendMode objectFit objectPosition + syntax keyword typescriptDOMStyle contained opacity order orphans outline outlineColor + syntax keyword typescriptDOMStyle contained outlineOffset outlineStyle outlineWidth + syntax keyword typescriptDOMStyle contained overflow overflowWrap overflowX overflowY + syntax keyword typescriptDOMStyle contained overflowClipBox padding paddingBottom + syntax keyword typescriptDOMStyle contained paddingLeft paddingRight paddingTop pageBreakAfter + syntax keyword typescriptDOMStyle contained pageBreakBefore pageBreakInside perspective + syntax keyword typescriptDOMStyle contained perspectiveOrigin pointerEvents position + syntax keyword typescriptDOMStyle contained quotes resize right shapeImageThreshold + syntax keyword typescriptDOMStyle contained shapeMargin shapeOutside tableLayout tabSize + syntax keyword typescriptDOMStyle contained textAlign textAlignLast textCombineHorizontal + syntax keyword typescriptDOMStyle contained textDecoration textDecorationColor textDecorationLine + syntax keyword typescriptDOMStyle contained textDecorationStyle textIndent textOrientation + syntax keyword typescriptDOMStyle contained textOverflow textRendering textShadow + syntax keyword typescriptDOMStyle contained textTransform textUnderlinePosition top + syntax keyword typescriptDOMStyle contained touchAction transform transformOrigin + syntax keyword typescriptDOMStyle contained transformStyle transition transitionDelay + syntax keyword typescriptDOMStyle contained transitionDuration transitionProperty + syntax keyword typescriptDOMStyle contained transitionTimingFunction unicodeBidi unicodeRange + syntax keyword typescriptDOMStyle contained userSelect userZoom verticalAlign visibility + syntax keyword typescriptDOMStyle contained whiteSpace width willChange wordBreak + syntax keyword typescriptDOMStyle contained wordSpacing wordWrap writingMode zIndex + hi def link typescriptDOMStyle Keyword + + + + let typescript_props = 1 + + "runtime syntax/yats/event.vim + syntax keyword typescriptAnimationEvent contained animationend animationiteration + syntax keyword typescriptAnimationEvent contained animationstart beginEvent endEvent + syntax keyword typescriptAnimationEvent contained repeatEvent + syntax cluster events add=typescriptAnimationEvent + hi def link typescriptAnimationEvent Title + syntax keyword typescriptCSSEvent contained CssRuleViewRefreshed CssRuleViewChanged + syntax keyword typescriptCSSEvent contained CssRuleViewCSSLinkClicked transitionend + syntax cluster events add=typescriptCSSEvent + hi def link typescriptCSSEvent Title + syntax keyword typescriptDatabaseEvent contained blocked complete error success upgradeneeded + syntax keyword typescriptDatabaseEvent contained versionchange + syntax cluster events add=typescriptDatabaseEvent + hi def link typescriptDatabaseEvent Title + syntax keyword typescriptDocumentEvent contained DOMLinkAdded DOMLinkRemoved DOMMetaAdded + syntax keyword typescriptDocumentEvent contained DOMMetaRemoved DOMWillOpenModalDialog + syntax keyword typescriptDocumentEvent contained DOMModalDialogClosed unload + syntax cluster events add=typescriptDocumentEvent + hi def link typescriptDocumentEvent Title + syntax keyword typescriptDOMMutationEvent contained DOMAttributeNameChanged DOMAttrModified + syntax keyword typescriptDOMMutationEvent contained DOMCharacterDataModified DOMContentLoaded + syntax keyword typescriptDOMMutationEvent contained DOMElementNameChanged DOMNodeInserted + syntax keyword typescriptDOMMutationEvent contained DOMNodeInsertedIntoDocument DOMNodeRemoved + syntax keyword typescriptDOMMutationEvent contained DOMNodeRemovedFromDocument DOMSubtreeModified + syntax cluster events add=typescriptDOMMutationEvent + hi def link typescriptDOMMutationEvent Title + syntax keyword typescriptDragEvent contained drag dragdrop dragend dragenter dragexit + syntax keyword typescriptDragEvent contained draggesture dragleave dragover dragstart + syntax keyword typescriptDragEvent contained drop + syntax cluster events add=typescriptDragEvent + hi def link typescriptDragEvent Title + syntax keyword typescriptElementEvent contained invalid overflow underflow DOMAutoComplete + syntax keyword typescriptElementEvent contained command commandupdate + syntax cluster events add=typescriptElementEvent + hi def link typescriptElementEvent Title + syntax keyword typescriptFocusEvent contained blur change DOMFocusIn DOMFocusOut focus + syntax keyword typescriptFocusEvent contained focusin focusout + syntax cluster events add=typescriptFocusEvent + hi def link typescriptFocusEvent Title + syntax keyword typescriptFormEvent contained reset submit + syntax cluster events add=typescriptFormEvent + hi def link typescriptFormEvent Title + syntax keyword typescriptFrameEvent contained DOMFrameContentLoaded + syntax cluster events add=typescriptFrameEvent + hi def link typescriptFrameEvent Title + syntax keyword typescriptInputDeviceEvent contained click contextmenu DOMMouseScroll + syntax keyword typescriptInputDeviceEvent contained dblclick gamepadconnected gamepaddisconnected + syntax keyword typescriptInputDeviceEvent contained keydown keypress keyup MozGamepadButtonDown + syntax keyword typescriptInputDeviceEvent contained MozGamepadButtonUp mousedown mouseenter + syntax keyword typescriptInputDeviceEvent contained mouseleave mousemove mouseout + syntax keyword typescriptInputDeviceEvent contained mouseover mouseup mousewheel MozMousePixelScroll + syntax keyword typescriptInputDeviceEvent contained pointerlockchange pointerlockerror + syntax keyword typescriptInputDeviceEvent contained wheel + syntax cluster events add=typescriptInputDeviceEvent + hi def link typescriptInputDeviceEvent Title + syntax keyword typescriptMediaEvent contained audioprocess canplay canplaythrough + syntax keyword typescriptMediaEvent contained durationchange emptied ended ended loadeddata + syntax keyword typescriptMediaEvent contained loadedmetadata MozAudioAvailable pause + syntax keyword typescriptMediaEvent contained play playing ratechange seeked seeking + syntax keyword typescriptMediaEvent contained stalled suspend timeupdate volumechange + syntax keyword typescriptMediaEvent contained waiting complete + syntax cluster events add=typescriptMediaEvent + hi def link typescriptMediaEvent Title + syntax keyword typescriptMenuEvent contained DOMMenuItemActive DOMMenuItemInactive + syntax cluster events add=typescriptMenuEvent + hi def link typescriptMenuEvent Title + syntax keyword typescriptNetworkEvent contained datachange dataerror disabled enabled + syntax keyword typescriptNetworkEvent contained offline online statuschange connectionInfoUpdate + syntax cluster events add=typescriptNetworkEvent + hi def link typescriptNetworkEvent Title + syntax keyword typescriptProgressEvent contained abort error load loadend loadstart + syntax keyword typescriptProgressEvent contained progress timeout uploadprogress + syntax cluster events add=typescriptProgressEvent + hi def link typescriptProgressEvent Title + syntax keyword typescriptResourceEvent contained cached error load + syntax cluster events add=typescriptResourceEvent + hi def link typescriptResourceEvent Title + syntax keyword typescriptScriptEvent contained afterscriptexecute beforescriptexecute + syntax cluster events add=typescriptScriptEvent + hi def link typescriptScriptEvent Title + syntax keyword typescriptSensorEvent contained compassneedscalibration devicelight + syntax keyword typescriptSensorEvent contained devicemotion deviceorientation deviceproximity + syntax keyword typescriptSensorEvent contained orientationchange userproximity + syntax cluster events add=typescriptSensorEvent + hi def link typescriptSensorEvent Title + syntax keyword typescriptSessionHistoryEvent contained pagehide pageshow popstate + syntax cluster events add=typescriptSessionHistoryEvent + hi def link typescriptSessionHistoryEvent Title + syntax keyword typescriptStorageEvent contained change storage + syntax cluster events add=typescriptStorageEvent + hi def link typescriptStorageEvent Title + syntax keyword typescriptSVGEvent contained SVGAbort SVGError SVGLoad SVGResize SVGScroll + syntax keyword typescriptSVGEvent contained SVGUnload SVGZoom + syntax cluster events add=typescriptSVGEvent + hi def link typescriptSVGEvent Title + syntax keyword typescriptTabEvent contained visibilitychange + syntax cluster events add=typescriptTabEvent + hi def link typescriptTabEvent Title + syntax keyword typescriptTextEvent contained compositionend compositionstart compositionupdate + syntax keyword typescriptTextEvent contained copy cut paste select text + syntax cluster events add=typescriptTextEvent + hi def link typescriptTextEvent Title + syntax keyword typescriptTouchEvent contained touchcancel touchend touchenter touchleave + syntax keyword typescriptTouchEvent contained touchmove touchstart + syntax cluster events add=typescriptTouchEvent + hi def link typescriptTouchEvent Title + syntax keyword typescriptUpdateEvent contained checking downloading error noupdate + syntax keyword typescriptUpdateEvent contained obsolete updateready + syntax cluster events add=typescriptUpdateEvent + hi def link typescriptUpdateEvent Title + syntax keyword typescriptValueChangeEvent contained hashchange input readystatechange + syntax cluster events add=typescriptValueChangeEvent + hi def link typescriptValueChangeEvent Title + syntax keyword typescriptViewEvent contained fullscreen fullscreenchange fullscreenerror + syntax keyword typescriptViewEvent contained resize scroll + syntax cluster events add=typescriptViewEvent + hi def link typescriptViewEvent Title + syntax keyword typescriptWebsocketEvent contained close error message open + syntax cluster events add=typescriptWebsocketEvent + hi def link typescriptWebsocketEvent Title + syntax keyword typescriptWindowEvent contained DOMWindowCreated DOMWindowClose DOMTitleChanged + syntax cluster events add=typescriptWindowEvent + hi def link typescriptWindowEvent Title + syntax keyword typescriptUncategorizedEvent contained beforeunload message open show + syntax cluster events add=typescriptUncategorizedEvent + hi def link typescriptUncategorizedEvent Title + syntax keyword typescriptServiceWorkerEvent contained install activate fetch + syntax cluster events add=typescriptServiceWorkerEvent + hi def link typescriptServiceWorkerEvent Title + + +endif + +" patch +"runtime syntax/basic/patch.vim +" patch for generated code +syntax keyword typescriptGlobal Promise + \ nextgroup=typescriptGlobalPromiseDot,typescriptFuncCallArg,typescriptTypeArguments oneline +syntax keyword typescriptGlobal Map WeakMap + \ nextgroup=typescriptGlobalPromiseDot,typescriptFuncCallArg,typescriptTypeArguments oneline + +"runtime syntax/basic/members.vim +syntax keyword typescriptConstructor contained constructor + \ nextgroup=@typescriptCallSignature + \ skipwhite skipempty + + +syntax cluster memberNextGroup contains=typescriptMemberOptionality,typescriptTypeAnnotation,@typescriptCallSignature + +syntax match typescriptMember /\K\k*/ + \ nextgroup=@memberNextGroup + \ contained skipwhite + +syntax match typescriptMethodAccessor contained /\v(get|set)\s\K/me=e-1 + \ nextgroup=@typescriptMembers + +syntax cluster typescriptPropertyMemberDeclaration contains= + \ typescriptClassStatic, + \ typescriptAccessibilityModifier, + \ typescriptReadonlyModifier, + \ typescriptMethodAccessor, + \ @typescriptMembers + " \ typescriptMemberVariableDeclaration + +syntax match typescriptMemberOptionality /?\|!/ contained + \ nextgroup=typescriptTypeAnnotation,@typescriptCallSignature + \ skipwhite skipempty + +syntax cluster typescriptMembers contains=typescriptMember,typescriptStringMember,typescriptComputedMember + +syntax keyword typescriptClassStatic static + \ nextgroup=@typescriptMembers,typescriptAsyncFuncKeyword,typescriptReadonlyModifier + \ skipwhite contained + +syntax keyword typescriptAccessibilityModifier public private protected contained + +syntax keyword typescriptReadonlyModifier readonly contained + +syntax region typescriptStringMember contained + \ start=/\z(["']\)/ skip=/\\\\\|\\\z1\|\\\n/ end=/\z1/ + \ nextgroup=@memberNextGroup + \ skipwhite skipempty + +syntax region typescriptComputedMember contained matchgroup=typescriptProperty + \ start=/\[/rs=s+1 end=/]/ + \ contains=@typescriptValue,typescriptMember,typescriptMappedIn + \ nextgroup=@memberNextGroup + \ skipwhite skipempty + +"runtime syntax/basic/class.vim +"don't add typescriptMembers to nextgroup, let outer scope match it +" so we won't match abstract method outside abstract class +syntax keyword typescriptAbstract abstract + \ nextgroup=typescriptClassKeyword + \ skipwhite skipnl +syntax keyword typescriptClassKeyword class + \ nextgroup=typescriptClassName,typescriptClassExtends,typescriptClassBlock + \ skipwhite + +syntax match typescriptClassName contained /\K\k*/ + \ nextgroup=typescriptClassBlock,typescriptClassExtends,typescriptClassTypeParameter + \ skipwhite skipnl + +syntax region typescriptClassTypeParameter + \ start=/</ end=/>/ + \ contains=typescriptTypeParameter + \ nextgroup=typescriptClassBlock,typescriptClassExtends + \ contained skipwhite skipnl + +syntax keyword typescriptClassExtends contained extends implements nextgroup=typescriptClassHeritage skipwhite skipnl + +syntax match typescriptClassHeritage contained /\v(\k|\.|\(|\))+/ + \ nextgroup=typescriptClassBlock,typescriptClassExtends,typescriptMixinComma,typescriptClassTypeArguments + \ contains=@typescriptValue + \ skipwhite skipnl + \ contained + +syntax region typescriptClassTypeArguments matchgroup=typescriptTypeBrackets + \ start=/</ end=/>/ + \ contains=@typescriptType + \ nextgroup=typescriptClassExtends,typescriptClassBlock,typescriptMixinComma + \ contained skipwhite skipnl + +syntax match typescriptMixinComma /,/ contained nextgroup=typescriptClassHeritage skipwhite skipnl + +" we need add arrowFunc to class block for high order arrow func +" see test case +syntax region typescriptClassBlock matchgroup=typescriptBraces start=/{/ end=/}/ + \ contains=@typescriptPropertyMemberDeclaration,typescriptAbstract,@typescriptComments,typescriptBlock,typescriptAssign,typescriptDecorator,typescriptAsyncFuncKeyword,typescriptArrowFunc + \ contained fold + +syntax keyword typescriptInterfaceKeyword interface nextgroup=typescriptInterfaceName skipwhite +syntax match typescriptInterfaceName contained /\k\+/ + \ nextgroup=typescriptObjectType,typescriptInterfaceExtends,typescriptInterfaceTypeParameter + \ skipwhite skipnl +syntax region typescriptInterfaceTypeParameter + \ start=/</ end=/>/ + \ contains=typescriptTypeParameter + \ nextgroup=typescriptObjectType,typescriptInterfaceExtends + \ contained + \ skipwhite skipnl + +syntax keyword typescriptInterfaceExtends contained extends nextgroup=typescriptInterfaceHeritage skipwhite skipnl + +syntax match typescriptInterfaceHeritage contained /\v(\k|\.)+/ + \ nextgroup=typescriptObjectType,typescriptInterfaceComma,typescriptInterfaceTypeArguments + \ skipwhite + +syntax region typescriptInterfaceTypeArguments matchgroup=typescriptTypeBrackets + \ start=/</ end=/>/ skip=/\s*,\s*/ + \ contains=@typescriptType + \ nextgroup=typescriptObjectType,typescriptInterfaceComma + \ contained skipwhite + +syntax match typescriptInterfaceComma /,/ contained nextgroup=typescriptInterfaceHeritage skipwhite skipnl + +"runtime syntax/basic/cluster.vim +"Block VariableStatement EmptyStatement ExpressionStatement IfStatement IterationStatement ContinueStatement BreakStatement ReturnStatement WithStatement LabelledStatement SwitchStatement ThrowStatement TryStatement DebuggerStatement +syntax cluster typescriptStatement + \ contains=typescriptBlock,typescriptVariable, + \ @typescriptTopExpression,typescriptAssign, + \ typescriptConditional,typescriptRepeat,typescriptBranch, + \ typescriptLabel,typescriptStatementKeyword, + \ typescriptFuncKeyword, + \ typescriptTry,typescriptExceptions,typescriptDebugger, + \ typescriptExport,typescriptInterfaceKeyword,typescriptEnum, + \ typescriptModule,typescriptAliasKeyword,typescriptImport + +syntax cluster typescriptPrimitive contains=typescriptString,typescriptTemplate,typescriptRegexpString,typescriptNumber,typescriptBoolean,typescriptNull,typescriptArray + +syntax cluster typescriptEventTypes contains=typescriptEventString,typescriptTemplate,typescriptNumber,typescriptBoolean,typescriptNull + +" top level expression: no arrow func +" also no func keyword. funcKeyword is contained in statement +" funcKeyword allows overloading (func without body) +" funcImpl requires body +syntax cluster typescriptTopExpression + \ contains=@typescriptPrimitive, + \ typescriptIdentifier,typescriptIdentifierName, + \ typescriptOperator,typescriptUnaryOp, + \ typescriptParenExp,typescriptRegexpString, + \ typescriptGlobal,typescriptAsyncFuncKeyword, + \ typescriptClassKeyword,typescriptTypeCast + +" no object literal, used in type cast and arrow func +" TODO: change func keyword to funcImpl +syntax cluster typescriptExpression + \ contains=@typescriptTopExpression, + \ typescriptArrowFuncDef, + \ typescriptFuncImpl + +syntax cluster typescriptValue + \ contains=@typescriptExpression,typescriptObjectLiteral + +syntax cluster typescriptEventExpression contains=typescriptArrowFuncDef,typescriptParenExp,@typescriptValue,typescriptRegexpString,@typescriptEventTypes,typescriptOperator,typescriptGlobal,jsxRegion + +"runtime syntax/basic/function.vim +syntax keyword typescriptAsyncFuncKeyword async + \ nextgroup=typescriptFuncKeyword,typescriptArrowFuncDef + \ skipwhite + +syntax keyword typescriptAsyncFuncKeyword await + \ nextgroup=@typescriptValue + \ skipwhite + +syntax keyword typescriptFuncKeyword function + \ nextgroup=typescriptAsyncFunc,typescriptFuncName,@typescriptCallSignature + \ skipwhite skipempty + +syntax match typescriptAsyncFunc contained /*/ + \ nextgroup=typescriptFuncName,@typescriptCallSignature + \ skipwhite skipempty + +syntax match typescriptFuncName contained /\K\k*/ + \ nextgroup=@typescriptCallSignature + \ skipwhite + +" destructuring ({ a: ee }) => +syntax match typescriptArrowFuncDef contained /({\_[^}]*}\(:\_[^)]\)\?)\s*=>/ + \ contains=typescriptArrowFuncArg,typescriptArrowFunc + \ nextgroup=@typescriptExpression,typescriptBlock + \ skipwhite skipempty + +" matches `(a) =>` or `([a]) =>` or +" `( +" a) =>` +syntax match typescriptArrowFuncDef contained /(\(\_s*[a-zA-Z\$_\[]\_[^)]*\)*)\s*=>/ + \ contains=typescriptArrowFuncArg,typescriptArrowFunc + \ nextgroup=@typescriptExpression,typescriptBlock + \ skipwhite skipempty + +syntax match typescriptArrowFuncDef contained /\K\k*\s*=>/ + \ contains=typescriptArrowFuncArg,typescriptArrowFunc + \ nextgroup=@typescriptExpression,typescriptBlock + \ skipwhite skipempty + +" TODO: optimize this pattern +syntax region typescriptArrowFuncDef contained start=/(\_[^)]*):/ end=/=>/ + \ contains=typescriptArrowFuncArg,typescriptArrowFunc,typescriptTypeAnnotation + \ nextgroup=@typescriptExpression,typescriptBlock + \ skipwhite skipempty keepend + +syntax match typescriptArrowFunc /=>/ +syntax match typescriptArrowFuncArg contained /\K\k*/ +syntax region typescriptArrowFuncArg contained start=/<\|(/ end=/\ze=>/ contains=@typescriptCallSignature + +syntax region typescriptReturnAnnotation contained start=/:/ end=/{/me=e-1 contains=@typescriptType nextgroup=typescriptBlock + + +syntax region typescriptFuncImpl contained start=/function/ end=/{/me=e-1 + \ contains=typescriptFuncKeyword + \ nextgroup=typescriptBlock + +syntax cluster typescriptCallImpl contains=typescriptGenericImpl,typescriptParamImpl +syntax region typescriptGenericImpl matchgroup=typescriptTypeBrackets + \ start=/</ end=/>/ skip=/\s*,\s*/ + \ contains=typescriptTypeParameter + \ nextgroup=typescriptParamImpl + \ contained skipwhite +syntax region typescriptParamImpl matchgroup=typescriptParens + \ start=/(/ end=/)/ + \ contains=typescriptDecorator,@typescriptParameterList,@typescriptComments + \ nextgroup=typescriptReturnAnnotation,typescriptBlock + \ contained skipwhite skipnl + +"runtime syntax/basic/decorator.vim +syntax match typescriptDecorator /@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>/ + \ nextgroup=typescriptArgumentList + \ contains=@_semantic,typescriptDotNotation + +" Define the default highlighting. +hi def link typescriptReserved Error + +hi def link typescriptEndColons Exception +hi def link typescriptSymbols Normal +hi def link typescriptBraces Function +hi def link typescriptParens Normal +hi def link typescriptComment Comment +hi def link typescriptLineComment Comment +hi def link typescriptDocComment Comment +hi def link typescriptCommentTodo Todo +hi def link typescriptRef Include +hi def link typescriptDocNotation SpecialComment +hi def link typescriptDocTags SpecialComment +hi def link typescriptDocNGParam typescriptDocParam +hi def link typescriptDocParam Function +hi def link typescriptDocNumParam Function +hi def link typescriptDocEventRef Function +hi def link typescriptDocNamedParamType Type +hi def link typescriptDocParamName Type +hi def link typescriptDocParamType Type +hi def link typescriptString String +hi def link typescriptSpecial Special +hi def link typescriptStringLiteralType String +hi def link typescriptStringMember String +hi def link typescriptTemplate String +hi def link typescriptEventString String +hi def link typescriptASCII Special +hi def link typescriptTemplateSB Label +hi def link typescriptRegexpString String +hi def link typescriptGlobal Constant +hi def link typescriptPrototype Type +hi def link typescriptConditional Conditional +hi def link typescriptConditionalElse Conditional +hi def link typescriptCase Conditional +hi def link typescriptDefault typescriptCase +hi def link typescriptBranch Conditional +hi def link typescriptIdentifier Structure +hi def link typescriptVariable Identifier +hi def link typescriptEnumKeyword Identifier +hi def link typescriptRepeat Repeat +hi def link typescriptForOperator Repeat +hi def link typescriptStatementKeyword Statement +hi def link typescriptMessage Keyword +hi def link typescriptOperator Identifier +hi def link typescriptKeywordOp Identifier +hi def link typescriptCastKeyword Special +hi def link typescriptType Type +hi def link typescriptNull Boolean +hi def link typescriptNumber Number +hi def link typescriptExponent Number +hi def link typescriptBoolean Boolean +hi def link typescriptObjectLabel typescriptLabel +hi def link typescriptLabel Label +hi def link typescriptStringProperty String +hi def link typescriptImport Special +hi def link typescriptAmbientDeclaration Special +hi def link typescriptExport Special +hi def link typescriptModule Special +hi def link typescriptTry Special +hi def link typescriptExceptions Special + +hi def link typescriptMember Function +hi def link typescriptMethodAccessor Operator + +hi def link typescriptAsyncFuncKeyword Keyword +hi def link typescriptAsyncFor Keyword +hi def link typescriptFuncKeyword Keyword +hi def link typescriptAsyncFunc Keyword +hi def link typescriptArrowFunc Type +hi def link typescriptFuncName Function +hi def link typescriptFuncArg PreProc +hi def link typescriptArrowFuncArg PreProc +hi def link typescriptFuncComma Operator + +hi def link typescriptClassKeyword Keyword +hi def link typescriptClassExtends Keyword +" hi def link typescriptClassName Function +hi def link typescriptAbstract Special +" hi def link typescriptClassHeritage Function +" hi def link typescriptInterfaceHeritage Function +hi def link typescriptClassStatic StorageClass +hi def link typescriptReadonlyModifier Keyword +hi def link typescriptInterfaceKeyword Keyword +hi def link typescriptInterfaceExtends Keyword +hi def link typescriptInterfaceName Function + +hi def link shellbang Comment + +hi def link typescriptTypeParameter Identifier +hi def link typescriptConstraint Keyword +hi def link typescriptPredefinedType Type +hi def link typescriptReadonlyArrayKeyword Keyword +hi def link typescriptUnion Operator +hi def link typescriptFuncTypeArrow Function +hi def link typescriptConstructorType Function +hi def link typescriptTypeQuery Keyword +hi def link typescriptAccessibilityModifier Keyword +hi def link typescriptOptionalMark PreProc +hi def link typescriptFuncType Special +hi def link typescriptMappedIn Special +hi def link typescriptCall PreProc +hi def link typescriptParamImpl PreProc +hi def link typescriptConstructSignature Identifier +hi def link typescriptAliasDeclaration Identifier +hi def link typescriptAliasKeyword Keyword +hi def link typescriptUserDefinedType Keyword +hi def link typescriptTypeReference Identifier +hi def link typescriptConstructor Keyword +hi def link typescriptDecorator Special + +hi link typeScript NONE + +let b:current_syntax = "typescript" +if main_syntax == 'typescript' + unlet main_syntax +endif + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/syntax/valgrind.vim b/runtime/syntax/valgrind.vim index d099971826..a9b4a8c8e7 100644 --- a/runtime/syntax/valgrind.vim +++ b/runtime/syntax/valgrind.vim @@ -2,8 +2,7 @@ " Language: Valgrind Memory Debugger Output " Maintainer: Roger Luethi <rl@hellgate.ch> " Program URL: http://devel-home.kde.org/~sewardj/ -" Last Change: 2015 Jan 27 -" Included improvement by Dominique Pelle +" Last Change: 2019 Jul 24 " " Notes: mostly based on strace.vim and xml.vim " @@ -26,7 +25,7 @@ syn match valgrindSpecLine "^[+-]\{2}\d\+[+-]\{2}.*$" syn region valgrindRegion \ start=+^==\z(\d\+\)== \w.*$+ - \ skip=+^==\z1==\( \| .*\)$+ + \ skip=+^==\z1==\( \| .*\| \S.*\)$+ \ end=+^+ \ fold \ keepend @@ -70,7 +69,7 @@ syn match valgrindLoc "\s\+\(by\|at\|Address\).*$" contained syn match valgrindAt "at\s\@=" contained syn match valgrindAddr "\W\zs0x\x\+" contained -syn match valgrindFunc ": \zs\h[a-zA-Z0-9_:\[\]()<>&*+\-,=%!|^ ]*\ze([^)]*)$" contained +syn match valgrindFunc ": \zs\h[a-zA-Z0-9_:\[\]()<>&*+\-,=%!|^ @.]*\ze([^)]*)$" contained syn match valgrindBin "(\(with\)\=in \zs\S\+)\@=" contained syn match valgrindSrc "(\zs[^)]*:\d\+)\@=" contained diff --git a/runtime/syntax/vim.vim b/runtime/syntax/vim.vim index 9544de4e07..b177fe641d 100644 --- a/runtime/syntax/vim.vim +++ b/runtime/syntax/vim.vim @@ -142,7 +142,7 @@ syn match vimNumber "-\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=" skipwhite nextgro syn match vimNumber "\<0[xX]\x\+" skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment syn match vimNumber "\%(^\|\A\)\zs#\x\{6}" skipwhite nextgroup=vimGlobal,vimSubst,vimCommand,vimComment -" All vimCommands are contained by vimIsCommands. {{{2 +" All vimCommands are contained by vimIsCommand. {{{2 syn match vimCmdSep "[:|]\+" skipwhite nextgroup=vimAddress,vimAutoCmd,vimEcho,vimIsCommand,vimExtCmd,vimFilter,vimLet,vimMap,vimMark,vimSet,vimSyntax,vimUserCmd syn match vimIsCommand "\<\h\w*\>" contains=vimCommand syn match vimVar contained "\<\h[a-zA-Z0-9#_]*\>" @@ -177,7 +177,7 @@ syn keyword vimFTOption contained detect indent off on plugin " Augroup : vimAugroupError removed because long augroups caused sync'ing problems. {{{2 " ======= : Trade-off: Increasing synclines with slower editing vs augroup END error checking. -syn cluster vimAugroupList contains=vimAugroup,vimIsCommand,vimCommand,vimUserCmd,vimExecute,vimNotFunc,vimFuncName,vimFunction,vimFunctionError,vimLineComment,vimMap,vimSpecFile,vimOper,vimNumber,vimOperParen,vimComment,vimString,vimSubst,vimMark,vimRegister,vimAddress,vimFilter,vimCmplxRepeat,vimComment,vimLet,vimSet,vimAutoCmd,vimRegion,vimSynLine,vimNotation,vimCtrlChar,vimFuncVar,vimContinue,vimSetEqual,vimOption +syn cluster vimAugroupList contains=vimAugroup,vimIsCommand,vimUserCmd,vimExecute,vimNotFunc,vimFuncName,vimFunction,vimFunctionError,vimLineComment,vimNotFunc,vimMap,vimSpecFile,vimOper,vimNumber,vimOperParen,vimComment,vimString,vimSubst,vimMark,vimRegister,vimAddress,vimFilter,vimCmplxRepeat,vimComment,vimLet,vimSet,vimAutoCmd,vimRegion,vimSynLine,vimNotation,vimCtrlChar,vimFuncVar,vimContinue,vimSetEqual,vimOption if exists("g:vimsyn_folding") && g:vimsyn_folding =~# 'a' syn region vimAugroup fold matchgroup=vimAugroupKey start="\<aug\%[roup]\>\ze\s\+\K\k*" end="\<aug\%[roup]\>\ze\s\+[eE][nN][dD]\>" contains=vimAutoCmd,@vimAugroupList else @@ -193,8 +193,8 @@ syn keyword vimAugroupKey contained aug[roup] " ========= syn cluster vimOperGroup contains=vimEnvvar,vimFunc,vimFuncVar,vimOper,vimOperParen,vimNumber,vimString,vimRegister,vimContinue syn match vimOper "\%#=1\(==\|!=\|>=\|<=\|=\~\|!\~\|>\|<\|=\)[?#]\{0,2}" skipwhite nextgroup=vimString,vimSpecFile -syn match vimOper "\(\<is\|\<isnot\)[?#]\{0,2}\>" skipwhite nextgroup=vimString,vimSpecFile -syn match vimOper "||\|&&\|[-+.]" skipwhite nextgroup=vimString,vimSpecFile +syn match vimOper "\(\<is\|\<isnot\)[?#]\{0,2}\>" skipwhite nextgroup=vimString,vimSpecFile +syn match vimOper "||\|&&\|[-+.!]" skipwhite nextgroup=vimString,vimSpecFile syn region vimOperParen matchgroup=vimParenSep start="(" end=")" contains=@vimOperGroup syn region vimOperParen matchgroup=vimSep start="{" end="}" contains=@vimOperGroup nextgroup=vimVar,vimFuncVar if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_noopererror") @@ -231,7 +231,7 @@ syn match vimSpecFileMod "\(:[phtre]\)\+" contained " User-Specified Commands: {{{2 " ======================= -syn cluster vimUserCmdList contains=vimAddress,vimSyntax,vimHighlight,vimAutoCmd,vimCmplxRepeat,vimComment,vimCtrlChar,vimEscapeBrace,vimFilter,vimFunc,vimFuncName,vimFunction,vimFunctionError,vimIsCommand,vimMark,vimNotation,vimNumber,vimOper,vimRegion,vimRegister,vimLet,vimSet,vimSetEqual,vimSetString,vimSpecFile,vimString,vimSubst,vimSubstRep,vimSubstRange,vimSynLine +syn cluster vimUserCmdList contains=vimAddress,vimSyntax,vimHighlight,vimAutoCmd,vimCmplxRepeat,vimComment,vimCtrlChar,vimEscapeBrace,vimFunc,vimFuncName,vimFunction,vimFunctionError,vimIsCommand,vimMark,vimNotation,vimNumber,vimOper,vimRegion,vimRegister,vimLet,vimSet,vimSetEqual,vimSetString,vimSpecFile,vimString,vimSubst,vimSubstRep,vimSubstRange,vimSynLine syn keyword vimUserCommand contained com[mand] syn match vimUserCmd "\<com\%[mand]!\=\>.*$" contains=vimUserAttrb,vimUserAttrbError,vimUserCommand,@vimUserCmdList syn match vimUserAttrbError contained "-\a\+\ze\s" @@ -310,13 +310,14 @@ syn match vimSubstFlags contained "[&cegiIpr]\+" syn match vimString "[^(,]'[^']\{-}\zs'" " Marks, Registers, Addresses, Filters: {{{2 -syn match vimMark "'[a-zA-Z0-9]\ze[-+,!]" nextgroup=vimOper,vimMarkNumber,vimSubst -syn match vimMark "'[<>]\ze[-+,!]" nextgroup=vimOper,vimMarkNumber,vimSubst -syn match vimMark ",\zs'[<>]\ze" nextgroup=vimOper,vimMarkNumber,vimSubst -syn match vimMark "[!,:]\zs'[a-zA-Z0-9]" nextgroup=vimOper,vimMarkNumber,vimSubst -syn match vimMark "\<norm\%[al]\s\zs'[a-zA-Z0-9]" nextgroup=vimOper,vimMarkNumber,vimSubst +syn match vimMark "'[a-zA-Z0-9]\ze[-+,!]" nextgroup=vimFilter,vimMarkNumber,vimSubst +syn match vimMark "'[<>]\ze[-+,!]" nextgroup=vimFilter,vimMarkNumber,vimSubst +syn match vimMark ",\zs'[<>]\ze" nextgroup=vimFilter,vimMarkNumber,vimSubst +syn match vimMark "[!,:]\zs'[a-zA-Z0-9]" nextgroup=vimFilter,vimMarkNumber,vimSubst +syn match vimMark "\<norm\%[al]\s\zs'[a-zA-Z0-9]" nextgroup=vimFilter,vimMarkNumber,vimSubst syn match vimMarkNumber "[-+]\d\+" contained contains=vimOper nextgroup=vimSubst2 syn match vimPlainMark contained "'[a-zA-Z0-9]" +syn match vimRange "[`'][a-zA-Z0-9],[`'][a-zA-Z0-9]" contains=vimMark skipwhite nextgroup=vimFilter syn match vimRegister '[^,;[{: \t]\zs"[a-zA-Z0-9.%#:_\-/]\ze[^a-zA-Z_":0-9]' syn match vimRegister '\<norm\s\+\zs"[a-zA-Z0-9]' @@ -327,8 +328,8 @@ syn match vimPlainRegister contained '"[a-zA-Z0-9\-:.%#*+=]' syn match vimAddress ",\zs[.$]" skipwhite nextgroup=vimSubst1 syn match vimAddress "%\ze\a" skipwhite nextgroup=vimString,vimSubst1 -syn match vimFilter contained "^!.\{-}\(|\|$\)" contains=vimSpecFile -syn match vimFilter contained "\A!.\{-}\(|\|$\)"ms=s+1 contains=vimSpecFile,vimFunction,vimFuncName,vimOperParen +syn match vimFilter "^!!\=[^"]\{-}\(|\|\ze\"\|$\)" contains=vimOper,vimSpecFile +syn match vimFilter contained "!!\=[^"]\{-}\(|\|\ze\"\|$\)" contains=vimOper,vimSpecFile " Complex repeats (:h complex-repeat) {{{2 syn match vimCmplxRepeat '[^a-zA-Z_/\\()]q[0-9a-zA-Z"]\>'lc=1 @@ -411,17 +412,18 @@ syn case match " ========================== syn match vimFunc "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\ze\s*(" contains=vimFuncName,vimUserFunc,vimExecute syn match vimUserFunc contained "\%(\%([sSgGbBwWtTlL]:\|<[sS][iI][dD]>\)\=\%(\w\+\.\)*\I[a-zA-Z0-9_.]*\)\|\<\u[a-zA-Z0-9.]*\>\|\<if\>" contains=vimNotation -syn match vimNotFunc "\<if\>\|\<el\%[seif]\>\|\<return\>\|\<while\>" " Errors And Warnings: {{{2 " ==================== if !exists("g:vimsyn_noerror") && !exists("g:vimsyn_novimfunctionerror") syn match vimFunctionError "\s\zs[a-z0-9]\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank -" syn match vimFunctionError "\s\zs\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)\d\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank + syn match vimFunctionError "\s\zs\%(<[sS][iI][dD]>\|[sSgGbBwWtTlL]:\)\d\i\{-}\ze\s*(" contained contains=vimFuncKey,vimFuncBlank syn match vimElseIfErr "\<else\s\+if\>" syn match vimBufnrWarn /\<bufnr\s*(\s*["']\.['"]\s*)/ endif +syn match vimNotFunc "\<if\>\|\<el\%[seif]\>\|\<return\>\|\<while\>" skipwhite nextgroup=vimOper,vimOperParen,vimVar,vimFunc,vimNotation + " Norm {{{2 " ==== syn match vimNorm "\<norm\%[al]!\=" skipwhite nextgroup=vimNormCmds @@ -631,7 +633,7 @@ if g:vimsyn_embed =~# 'l' && filereadable(s:luapath) syn cluster vimFuncBodyList add=vimLuaRegion exe "syn include @vimLuaScript ".s:luapath VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*\z(.*\)$+ end=+^\z1$+ contains=@vimLuaScript - VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*$+ end=+\.$+ contains=@vimLuaScript + VimFoldl syn region vimLuaRegion matchgroup=vimScriptDelim start=+lua\s*<<\s*$+ end=+\.$+ contains=@vimLuaScript syn cluster vimFuncBodyList add=vimLuaRegion else syn region vimEmbedError start=+lua\s*<<\s*\z(.*\)$+ end=+^\z1$+ diff --git a/runtime/syntax/vuejs.vim b/runtime/syntax/vuejs.vim new file mode 100644 index 0000000000..bad0e26c42 --- /dev/null +++ b/runtime/syntax/vuejs.vim @@ -0,0 +1,14 @@ +" Vim syntax file +" Language: Vue.js Single File Component +" Maintainer: Ralph Giles <giles@thaumas.net> +" URL: https://vuejs.org/v2/guide/single-file-components.html +" Last Change: 2019 Jul 8 + +" Quit if a syntax file was already loaded. +if exists("b:current_syntax") + finish +endif + +" We have a collection of html, css and javascript wrapped in +" tags. The default HTML syntax highlight works well enough. +runtime! syntax/html.vim diff --git a/runtime/tools/check_colors.vim b/runtime/tools/check_colors.vim index b1aefa1126..57b71b19db 100644 --- a/runtime/tools/check_colors.vim +++ b/runtime/tools/check_colors.vim @@ -1,11 +1,12 @@ -" This script tests a color scheme for some errors. Load the scheme and source -" this script. e.g. :e colors/desert.vim | :so check_colors.vim -" Will output possible errors. +" This script tests a color scheme for some errors and lists potential errors. +" Load the scheme and source this script, like this: +" :edit colors/desert.vim | :so colors/tools/check_colors.vim let s:save_cpo= &cpo set cpo&vim func! Test_check_colors() + let l:savedview = winsaveview() call cursor(1,1) let err={} @@ -17,11 +18,69 @@ func! Test_check_colors() endif " 2) Check for some well-defined highlighting groups - " Some items, check several groups, e.g. Diff, Spell - let hi_groups = ['ColorColumn', 'Diff', 'ErrorMsg', 'Folded', - \ 'FoldColumn', 'IncSearch', 'LineNr', 'ModeMsg', 'MoreMsg', 'NonText', - \ 'Normal', 'Pmenu', 'Todo', 'Search', 'Spell', 'StatusLine', 'TabLine', - \ 'Title', 'Visual', 'WarningMsg', 'WildMenu'] + let hi_groups = [ + \ 'ColorColumn', + \ 'Comment', + \ 'Conceal', + \ 'Constant', + \ 'Cursor', + \ 'CursorColumn', + \ 'CursorLine', + \ 'CursorLineNr', + \ 'DiffAdd', + \ 'DiffChange', + \ 'DiffDelete', + \ 'DiffText', + \ 'Directory', + \ 'EndOfBuffer', + \ 'Error', + \ 'ErrorMsg', + \ 'FoldColumn', + \ 'Folded', + \ 'Identifier', + \ 'Ignore', + \ 'IncSearch', + \ 'LineNr', + \ 'MatchParen', + \ 'ModeMsg', + \ 'MoreMsg', + \ 'NonText', + \ 'Normal', + \ 'Pmenu', + \ 'PmenuSbar', + \ 'PmenuSel', + \ 'PmenuThumb', + \ 'PreProc', + \ 'Question', + \ 'QuickFixLine', + \ 'Search', + \ 'SignColumn', + \ 'Special', + \ 'SpecialKey', + \ 'SpellBad', + \ 'SpellCap', + \ 'SpellLocal', + \ 'SpellRare', + \ 'Statement', + \ 'StatusLine', + \ 'StatusLineNC', + \ 'StatusLineTerm', + \ 'StatusLineTermNC', + \ 'TabLine', + \ 'TabLineFill', + \ 'TabLineSel', + \ 'Title', + \ 'Todo', + \ 'ToolbarButton', + \ 'ToolbarLine', + \ 'Type', + \ 'Underlined', + \ 'VertSplit', + \ 'Visual', + \ 'VisualNOS', + \ 'WarningMsg', + \ 'WildMenu', + \ ] let groups={} for group in hi_groups if search('\c@suppress\s\+'.group, 'cnW') @@ -30,6 +89,9 @@ func! Test_check_colors() let groups[group] = 'Ignoring '.group continue endif + if search('hi\%[ghlight]!\= \+link \+'.group, 'cnW') " Linked group + continue + endif if !search('hi\%[ghlight] \+'.group, 'cnW') let groups[group] = 'No highlight definition for '.group continue @@ -43,12 +105,15 @@ func! Test_check_colors() let groups[group] = 'Missing bg terminal color for '.group continue endif - call search('hi\%[ghlight] \+'.group, 'cW') - " only check in the current line - if !search('guifg', 'cnW', line('.')) || !search('ctermfg', 'cnW', line('.')) - " do not check for background colors, they could be intentionally left out - let groups[group] = 'Missing fg definition for '.group + if !search('hi\%[ghlight] \+'.group. '.*guifg=', 'cnW') + let groups[group] = 'Missing guifg definition for '.group + continue endif + if !search('hi\%[ghlight] \+'.group. '.*ctermfg=', 'cnW') + let groups[group] = 'Missing ctermfg definition for '.group + continue + endif + " do not check for background colors, they could be intentionally left out call cursor(1,1) endfor let err['highlight'] = groups @@ -91,15 +156,43 @@ func! Test_check_colors() endif " 7) Does not define filetype specific groups like vimCommand, htmlTag, - let hi_groups = ['vim', 'html', 'python', 'sh', 'ruby'] + let hi_groups = filter(getcompletion('', 'filetype'), { _,v -> v !~# '\%[no]syn\%(color\|load\|tax\)' }) + let ft_groups = [] + " let group = '\%('.join(hi_groups, '\|').'\)' " More efficient than a for loop, but less informative for group in hi_groups - let pat='\Chi\%[ghlight]\s*\zs'.group.'\w\+\>' + let pat='\Chi\%[ghlight]!\= *\%[link] \+\zs'.group.'\w\+\>\ze \+.' " Skips `hi clear` + if search(pat, 'cW') + call add(ft_groups, matchstr(getline('.'), pat)) + endif + call cursor(1,1) + endfor + if !empty(ft_groups) + let err['filetype'] = get(err, 'filetype', 'Should not define: ') . join(uniq(sort(ft_groups))) + endif + + " 8) Were debugPC and debugBreakpoint defined? + for group in ['debugPC', 'debugBreakpoint'] + let pat='\Chi\%[ghlight]!\= *\%[link] \+\zs'.group.'\>' if search(pat, 'cnW') let line = search(pat, 'cW') let err['filetype'] = get(err, 'filetype', 'Should not define: ') . matchstr(getline('.'), pat). ' ' endif call cursor(1,1) endfor + + " 9) Normal should be defined first, not use reverse, fg or bg + call cursor(1,1) + let pat = 'hi\%[light] \+\%(link\|clear\)\@!\w\+\>' + call search(pat, 'cW') " Look for the first hi def, skipping `hi link` and `hi clear` + if getline('.') !~# '\m\<Normal\>' + let err['highlight']['Normal'] = 'Should be defined first' + elseif getline('.') =~# '\m\%(=\%(fg\|bg\)\)' + let err['highlight']['Normal'] = "Should not use 'fg' or 'bg'" + elseif getline('.') =~# '\m=\%(inv\|rev\)erse' + let err['highlight']['Normal'] = 'Should not use reverse mode' + endif + + call winrestview(l:savedview) let g:err = err " print Result @@ -107,11 +200,11 @@ func! Test_check_colors() endfu fu! Result(err) - let do_roups = 0 + let do_groups = 0 echohl Title|echomsg "---------------"|echohl Normal for key in sort(keys(a:err)) if key is# 'highlight' - let do_groups = 1 + let do_groups = !empty(a:err[key]) continue else if a:err[key] !~ 'OK' |