diff options
Diffstat (limited to 'runtime')
193 files changed, 10456 insertions, 4465 deletions
diff --git a/runtime/autoload/RstFold.vim b/runtime/autoload/RstFold.vim index 5becb04685..238b1e3537 100644 --- a/runtime/autoload/RstFold.vim +++ b/runtime/autoload/RstFold.vim @@ -1,8 +1,12 @@ " Author: Antony Lee <anntzer.lee@gmail.com> " Description: Helper functions for reStructuredText syntax folding -" Last Modified: 2018-01-07 +" Last Modified: 2018-12-29 function s:CacheRstFold() + if !g:rst_fold_enabled + return + endif + let closure = {'header_types': {}, 'max_level': 0, 'levels': {}} function closure.Process(match) dict let curline = getcurpos()[1] @@ -20,12 +24,18 @@ function s:CacheRstFold() let self.levels[curline] = self.header_types[key] endfunction let save_cursor = getcurpos() + let save_mark = getpos("'[") silent keeppatterns %s/\v^%(%(([=`:.'"~^_*+#-])\1+\n)?.{1,2}\n([=`:.'"~^_*+#-])\2+)|%(%(([=`:.''"~^_*+#-])\3{2,}\n)?.{3,}\n([=`:.''"~^_*+#-])\4{2,})$/\=closure.Process(submatch(0))/gn call setpos('.', save_cursor) + call setpos("'[", save_mark) let b:RstFoldCache = closure.levels endfunction function RstFold#GetRstFold() + if !g:rst_fold_enabled + return + endif + if !has_key(b:, 'RstFoldCache') call s:CacheRstFold() endif @@ -37,6 +47,10 @@ function RstFold#GetRstFold() endfunction function RstFold#GetRstFoldText() + if !g:rst_fold_enabled + return + endif + if !has_key(b:, 'RstFoldCache') call s:CacheRstFold() endif diff --git a/runtime/autoload/dist/ft.vim b/runtime/autoload/dist/ft.vim index 6ed39cb9f1..e85ffc763b 100644 --- a/runtime/autoload/dist/ft.vim +++ b/runtime/autoload/dist/ft.vim @@ -1,7 +1,7 @@ " Vim functions for file type detection " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2019 Jan 18 +" Last Change: 2019 Mar 08 " These functions are moved here from runtime/filetype.vim to make startup " faster. @@ -126,7 +126,7 @@ endfunc " This function checks if one of the first ten lines start with a '@'. In " that case it is probably a change file. " If the first line starts with # or ! it's probably a ch file. -" If a line has "main", "include", "//" ir "/*" it's probably ch. +" If a line has "main", "include", "//" or "/*" it's probably ch. " Otherwise CHILL is assumed. func dist#ft#FTchange() let lnum = 1 diff --git a/runtime/autoload/health/nvim.vim b/runtime/autoload/health/nvim.vim index 8fcea2e941..c25f5ee64f 100644 --- a/runtime/autoload/health/nvim.vim +++ b/runtime/autoload/health/nvim.vim @@ -8,7 +8,7 @@ function! s:check_config() abort if !filereadable(vimrc) let ok = v:false let has_vim = filereadable(expand('~/.vimrc')) - call health#report_warn('Missing user config file: '.vimrc, + call health#report_warn((-1 == getfsize(vimrc) ? 'Missing' : 'Unreadable').' user config file: '.vimrc, \[ has_vim ? ':help nvim-from-vim' : ':help init.vim' ]) endif @@ -41,6 +41,12 @@ function! s:check_config() abort \ 'Check `:verbose set paste?` to see if a plugin or script set the option.', ]) endif + let shadafile = (empty(&shadafile) || &shadafile ==# 'NONE') ? stdpath('data').'/shada/main.shada' : &shadafile + if !empty(shadafile) && (!filereadable(shadafile) || !filewritable(shadafile)) + let ok = v:false + call health#report_error('shada file is not '.(filereadable(shadafile) ? 'writeable' : 'readable').":\n".shadafile) + endif + if ok call health#report_ok('no issues found') endif @@ -117,7 +123,7 @@ function! s:check_performance() abort else call health#report_info(buildtype) call health#report_warn( - \ 'Non-optimized build-type. Nvim will be slower.', + \ 'Non-optimized '.(has('debug')?'(DEBUG) ':'').'build. Nvim will be slower.', \ ['Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.', \ s:suggest_faq]) endif diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim index 29bbee4888..87d82150b6 100644 --- a/runtime/autoload/health/provider.vim +++ b/runtime/autoload/health/provider.vim @@ -564,7 +564,10 @@ function! s:check_node() abort endif call health#report_info('Neovim node.js host: '. host) - let latest_npm_cmd = has('win32') ? 'cmd /c npm info neovim --json' : 'npm info neovim --json' + let manager = executable('npm') ? 'npm' : 'yarn' + let latest_npm_cmd = has('win32') ? + \ 'cmd /c '. manager .' info neovim --json' : + \ manager .' info neovim --json' let latest_npm = s:system(split(latest_npm_cmd)) if s:shell_error || empty(latest_npm) call health#report_error('Failed to run: '. latest_npm_cmd, @@ -593,7 +596,8 @@ function! s:check_node() abort call health#report_warn( \ printf('Package "neovim" is out-of-date. Installed: %s, latest: %s', \ current_npm, latest_npm), - \ ['Run in shell: npm install -g neovim']) + \ ['Run in shell: npm install -g neovim', + \ 'Run in shell (if you use yarn): yarn global add neovim']) else call health#report_ok('Latest "neovim" npm/yarn package is installed: '. current_npm) endif 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/autoload/paste.vim b/runtime/autoload/paste.vim index dd7b3ae54a..2d787e7a1d 100644 --- a/runtime/autoload/paste.vim +++ b/runtime/autoload/paste.vim @@ -1,35 +1,25 @@ " Vim support file to help with paste mappings and menus " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2017 Aug 30 +" Last Change: 2019 Jan 27 " Define the string to use for items that are present both in Edit, Popup and " Toolbar menu. Also used in mswin.vim and macmap.vim. -" Pasting blockwise and linewise selections is not possible in Insert and -" Visual mode without the +virtualedit feature. They are pasted as if they -" were characterwise instead. Add to that some tricks to leave the cursor in -" the right position, also for "gi". -if has("virtualedit") - let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"} - let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n'] - let paste#paste_cmd['i'] = "\<c-\>\<c-o>\"+gP" +let paste#paste_cmd = {'n': ":call paste#Paste()<CR>"} +let paste#paste_cmd['v'] = '"-c<Esc>' . paste#paste_cmd['n'] +let paste#paste_cmd['i'] = "\<c-\>\<c-o>\"+gP" - func! paste#Paste() - let ove = &ve - set ve=all - normal! `^ - if @+ != '' - normal! "+gP - endif - let c = col(".") - normal! i - if col(".") < c " compensate for i<ESC> moving the cursor left - normal! l - endif - let &ve = ove - endfunc -else - let paste#paste_cmd = {'n': "\"=@+.'xy'<CR>gPFx\"_2x"} - let paste#paste_cmd['v'] = '"-c<Esc>gix<Esc>' . paste#paste_cmd['n'] . '"_x' - let paste#paste_cmd['i'] = 'x<Esc>' . paste#paste_cmd['n'] . '"_s' -endif +func! paste#Paste() + let ove = &ve + set ve=all + normal! `^ + if @+ != '' + normal! "+gP + endif + let c = col(".") + normal! i + if col(".") < c " compensate for i<ESC> moving the cursor left + normal! l + endif + let &ve = ove +endfunc diff --git a/runtime/autoload/provider/clipboard.vim b/runtime/autoload/provider/clipboard.vim index 2b06ee8c48..ce140b0948 100644 --- a/runtime/autoload/provider/clipboard.vim +++ b/runtime/autoload/provider/clipboard.vim @@ -1,6 +1,16 @@ " The clipboard provider uses shell commands to communicate with the clipboard. " The provider function will only be registered if a supported command is " available. + +if exists('g:loaded_clipboard_provider') + finish +endif +" Default to 1. provider#clipboard#Executable() may set 2. +" To force a reload: +" :unlet g:loaded_clipboard_provider +" :runtime autoload/provider/clipboard.vim +let g:loaded_clipboard_provider = 1 + let s:copy = {} let s:paste = {} let s:clipboard = {} @@ -120,13 +130,6 @@ function! provider#clipboard#Executable() abort return '' endfunction -if empty(provider#clipboard#Executable()) - " provider#clipboard#Call() *must not* be defined if the provider is broken. - " Otherwise eval_has_provider() thinks the clipboard provider is - " functioning, and eval_call_provider() will happily call it. - finish -endif - function! s:clipboard.get(reg) abort if type(s:paste[a:reg]) == v:t_func return s:paste[a:reg]() @@ -192,3 +195,6 @@ function! provider#clipboard#Call(method, args) abort let s:here = v:false endtry endfunction + +" eval_has_provider() decides based on this variable. +let g:loaded_clipboard_provider = empty(provider#clipboard#Executable()) ? 1 : 2 diff --git a/runtime/autoload/provider/node.vim b/runtime/autoload/provider/node.vim index 35882849bd..b2a3b3ee08 100644 --- a/runtime/autoload/provider/node.vim +++ b/runtime/autoload/provider/node.vim @@ -140,8 +140,9 @@ endfunction let s:err = '' let s:prog = provider#node#Detect() +let g:loaded_node_provider = empty(s:prog) ? 1 : 2 -if empty(s:prog) +if g:loaded_node_provider != 2 let s:err = 'Cannot find the "neovim" node package. Try :checkhealth' endif diff --git a/runtime/autoload/provider/python.vim b/runtime/autoload/provider/python.vim index a06cbe4814..8a1d162784 100644 --- a/runtime/autoload/provider/python.vim +++ b/runtime/autoload/provider/python.vim @@ -7,9 +7,8 @@ if exists('g:loaded_python_provider') finish endif -let g:loaded_python_provider = 1 - let [s:prog, s:err] = provider#pythonx#Detect(2) +let g:loaded_python_provider = empty(s:prog) ? 1 : 2 function! provider#python#Prog() abort return s:prog @@ -19,11 +18,6 @@ function! provider#python#Error() abort return s:err endfunction -if s:prog == '' - " Detection failed - finish -endif - " The Python provider plugin will run in a separate instance of the Python " host. call remote#host#RegisterClone('legacy-python-provider', 'python') diff --git a/runtime/autoload/provider/python3.vim b/runtime/autoload/provider/python3.vim index 242a224cb3..38ef0cccfc 100644 --- a/runtime/autoload/provider/python3.vim +++ b/runtime/autoload/provider/python3.vim @@ -7,9 +7,8 @@ if exists('g:loaded_python3_provider') finish endif -let g:loaded_python3_provider = 1 - let [s:prog, s:err] = provider#pythonx#Detect(3) +let g:loaded_python3_provider = empty(s:prog) ? 1 : 2 function! provider#python3#Prog() abort return s:prog @@ -19,11 +18,6 @@ function! provider#python3#Error() abort return s:err endfunction -if s:prog == '' - " Detection failed - finish -endif - " The Python3 provider plugin will run in a separate instance of the Python3 " host. call remote#host#RegisterClone('legacy-python3-provider', 'python3') diff --git a/runtime/autoload/provider/ruby.vim b/runtime/autoload/provider/ruby.vim index 3b4c6c4839..f843050df9 100644 --- a/runtime/autoload/provider/ruby.vim +++ b/runtime/autoload/provider/ruby.vim @@ -62,8 +62,9 @@ endfunction let s:err = '' let s:prog = s:detect() let s:plugin_path = expand('<sfile>:p:h') . '/script_host.rb' +let g:loaded_ruby_provider = empty(s:prog) ? 1 : 2 -if empty(s:prog) +if g:loaded_ruby_provider != 2 let s:err = 'Cannot find the neovim RubyGem. Try :checkhealth' endif diff --git a/runtime/autoload/python3complete.vim b/runtime/autoload/python3complete.vim index f0f3aaddb3..a3b057d4d0 100644 --- a/runtime/autoload/python3complete.vim +++ b/runtime/autoload/python3complete.vim @@ -44,7 +44,7 @@ " if !has('python3') - echo "Error: Required vim compiled with +python3" + echo 'Error: Requires python3 + pynvim. :help provider-python' finish endif diff --git a/runtime/autoload/pythoncomplete.vim b/runtime/autoload/pythoncomplete.vim index ecc36646d9..9cc0ae0d79 100644 --- a/runtime/autoload/pythoncomplete.vim +++ b/runtime/autoload/pythoncomplete.vim @@ -42,7 +42,7 @@ " if !has('python') - echo "Error: Required vim compiled with +python" + echo 'Error: Requires python + pynvim. :help provider-python' finish endif diff --git a/runtime/autoload/remote/host.vim b/runtime/autoload/remote/host.vim index 6266b312bd..1cf328e08d 100644 --- a/runtime/autoload/remote/host.vim +++ b/runtime/autoload/remote/host.vim @@ -147,7 +147,7 @@ function! s:RegistrationCommands(host) abort \ a:host, string(map(registered, "fnamemodify(v:val, ':t')"))) " Delete the temporary host clone - call rpcstop(s:hosts[host_id].channel) + call jobstop(s:hosts[host_id].channel) call remove(s:hosts, host_id) call remove(s:plugins_for_host, host_id) return lines diff --git a/runtime/autoload/rubycomplete.vim b/runtime/autoload/rubycomplete.vim index 40b87f4cbe..ea18470232 100644 --- a/runtime/autoload/rubycomplete.vim +++ b/runtime/autoload/rubycomplete.vim @@ -1,9 +1,9 @@ " Vim completion script -" Language: Ruby -" Maintainer: Mark Guzman <segfault@hasno.info> -" URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns <dougkearns@gmail.com> -" Maintainer Version: 0.8.1 +" Language: Ruby +" Maintainer: Mark Guzman <segfault@hasno.info> +" URL: https://github.com/vim-ruby/vim-ruby +" Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2019 Jan 06 " ---------------------------------------------------------------------------- " " Ruby IRB/Complete author: Keiju ISHITSUKA(keiju@ishitsuka.com) @@ -103,7 +103,7 @@ function! s:GetBufferRubyEntity( name, type, ... ) endif let curpos = getpos(".") - let [enum,ecol] = searchpairpos( crex, '', '\(end\|}\)', 'wr' ) + let [enum,ecol] = searchpairpos( crex, '', '\(end\|}\)', 'W' ) call cursor(lastpos[1], lastpos[2]) if lnum > enum @@ -253,15 +253,27 @@ class VimRubyCompletion # {{{ buffer analysis magic def load_requires + + custom_paths = VIM::evaluate("get(g:, 'rubycomplete_load_paths', [])") + + if !custom_paths.empty? + $LOAD_PATH.concat(custom_paths).uniq! + end + buf = VIM::Buffer.current enum = buf.line_number nums = Range.new( 1, enum ) nums.each do |x| + ln = buf[x] begin - eval( "require %s" % $1 ) if /.*require\s*(.*)$/.match( ln ) - rescue Exception - #ignore? + if /.*require_relative\s*(.*)$/.match( ln ) + eval( "require %s" % File.expand_path($1) ) + elsif /.*require\s*(["'].*?["'])/.match( ln ) + eval( "require %s" % $1 ) + end + rescue Exception => e + dprint e.inspect end end end @@ -344,8 +356,13 @@ class VimRubyCompletion if x != cur_line next if x == 0 ln = buf[x] - if /^\s*(module|class|def|include)\s+/.match(ln) - clscnt += 1 if $1 == "class" + is_const = false + if /^\s*(module|class|def|include)\s+/.match(ln) || is_const = /^\s*?[A-Z]([A-z]|[1-9])*\s*?[|]{0,2}=\s*?.+\s*?/.match(ln) + clscnt += 1 if /class|module/.match($1) + # We must make sure to load each constant only once to avoid errors + if is_const + ln.gsub!(/\s*?[|]{0,2}=\s*?/, '||=') + end #dprint "\$1$1 classdef += "%s\n" % ln classdef += "end\n" if /def\s+/.match(ln) @@ -423,7 +440,6 @@ class VimRubyCompletion return get_buffer_entity_list( "class" ) end - def load_rails allow_rails = VIM::evaluate("exists('g:rubycomplete_rails') && g:rubycomplete_rails") return if allow_rails.to_i.zero? @@ -529,7 +545,6 @@ class VimRubyCompletion ret += ActiveRecord::ConnectionAdapters::SchemaStatements.methods end - return ret end @@ -587,11 +602,13 @@ class VimRubyCompletion # {{{ main completion code def self.preload_rails a = VimRubyCompletion.new - require 'Thread' - Thread.new(a) do |b| - begin - b.load_rails - rescue + if VIM::evaluate("has('nvim')") == 0 + require 'thread' + Thread.new(a) do |b| + begin + b.load_rails + rescue + end end end a.load_rails @@ -612,7 +629,6 @@ class VimRubyCompletion want_gems = VIM::evaluate("get(g:, 'rubycomplete_load_gemfile')") load_gems unless want_gems.to_i.zero? - input = VIM::Buffer.current.line cpos = VIM::Window.current.cursor[1] - 1 @@ -666,6 +682,7 @@ class VimRubyCompletion message = Regexp.quote($4) dprint "const or cls 2 [recv: \'%s\', msg: \'%s\']" % [ receiver, message ] load_buffer_class( receiver ) + load_buffer_module( receiver ) begin classes = eval("#{receiver}.constants") #methods = eval("#{receiver}.methods") @@ -786,7 +803,6 @@ class VimRubyCompletion methods += Kernel.public_methods end - include_object = VIM::evaluate("exists('g:rubycomplete_include_object') && g:rubycomplete_include_object") methods = clean_sel( methods, message ) methods = (methods-Object.instance_methods) if include_object == "0" @@ -829,5 +845,4 @@ let s:rubycomplete_rails_loaded = 0 call s:DefRuby() "}}} ruby-side code - " vim:tw=78:sw=4:ts=8:et:fdm=marker:ft=vim:norl: diff --git a/runtime/autoload/tohtml.vim b/runtime/autoload/tohtml.vim index d972ad63fe..2d874c690d 100644 --- a/runtime/autoload/tohtml.vim +++ b/runtime/autoload/tohtml.vim @@ -1,6 +1,6 @@ " Vim autoload file for the tohtml plugin. " Maintainer: Ben Fritz <fritzophrenic@gmail.com> -" Last Change: 2013 Sep 03 +" Last Change: 2018 Nov 11 " " Additional contributors: " @@ -544,12 +544,16 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{ " add required javascript in reverse order so we can just call append again " and again without adjusting {{{ - " insert script closing tag - call append(style_start, [ - \ '', - \ s:settings.use_xhtml ? '//]]>' : '-->', - \ "</script>" - \ ]) + let s:uses_script = s:settings.dynamic_folds || s:settings.line_ids || !empty(s:settings.prevent_copy) + + " insert script closing tag if needed + if s:uses_script + call append(style_start, [ + \ '', + \ s:settings.use_xhtml ? '//]]>' : '-->', + \ "</script>" + \ ]) + endif " insert script which corrects the size of small input elements in " prevent_copy mode. See 2html.vim for details on why this is needed and how @@ -575,55 +579,61 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{ \ '}' \ ]) endif - " + " insert javascript to get IDs from line numbers, and to open a fold before " jumping to any lines contained therein - call append(style_start, [ - \ " /* Always jump to new location even if the line was hidden inside a fold, or", - \ " * we corrected the raw number to a line ID.", - \ " */", - \ " if (lineElem) {", - \ " lineElem.scrollIntoView(true);", - \ " }", - \ " return true;", - \ "}", - \ "if ('onhashchange' in window) {", - \ " window.onhashchange = JumpToLine;", - \ "}" - \ ]) - if s:settings.dynamic_folds + if s:settings.line_ids + call append(style_start, [ + \ " /* Always jump to new location even if the line was hidden inside a fold, or", + \ " * we corrected the raw number to a line ID.", + \ " */", + \ " if (lineElem) {", + \ " lineElem.scrollIntoView(true);", + \ " }", + \ " return true;", + \ "}", + \ "if ('onhashchange' in window) {", + \ " window.onhashchange = JumpToLine;", + \ "}" + \ ]) + + if s:settings.dynamic_folds + call append(style_start, [ + \ "", + \ " /* navigate upwards in the DOM tree to open all folds containing the line */", + \ " var node = lineElem;", + \ " while (node && node.id != 'vimCodeElement".s:settings.id_suffix."')", + \ " {", + \ " if (node.className == 'closed-fold')", + \ " {", + \ " /* toggle open the fold ID (remove window ID) */", + \ " toggleFold(node.id.substr(4));", + \ " }", + \ " node = node.parentNode;", + \ " }", + \ ]) + endif + endif + + if s:settings.line_ids call append(style_start, [ \ "", - \ " /* navigate upwards in the DOM tree to open all folds containing the line */", - \ " var node = lineElem;", - \ " while (node && node.id != 'vimCodeElement".s:settings.id_suffix."')", - \ " {", - \ " if (node.className == 'closed-fold')", - \ " {", - \ " /* toggle open the fold ID (remove window ID) */", - \ " toggleFold(node.id.substr(4));", - \ " }", - \ " node = node.parentNode;", + \ "/* function to open any folds containing a jumped-to line before jumping to it */", + \ "function JumpToLine()", + \ "{", + \ " var lineNum;", + \ " lineNum = window.location.hash;", + \ " lineNum = lineNum.substr(1); /* strip off '#' */", + \ "", + \ " if (lineNum.indexOf('L') == -1) {", + \ " lineNum = 'L'+lineNum;", + \ " }", + \ " if (lineNum.indexOf('W') == -1) {", + \ " lineNum = 'W1'+lineNum;", \ " }", + \ " var lineElem = document.getElementById(lineNum);" \ ]) endif - call append(style_start, [ - \ "", - \ "/* function to open any folds containing a jumped-to line before jumping to it */", - \ "function JumpToLine()", - \ "{", - \ " var lineNum;", - \ " lineNum = window.location.hash;", - \ " lineNum = lineNum.substr(1); /* strip off '#' */", - \ "", - \ " if (lineNum.indexOf('L') == -1) {", - \ " lineNum = 'L'+lineNum;", - \ " }", - \ " if (lineNum.indexOf('W') == -1) {", - \ " lineNum = 'W1'+lineNum;", - \ " }", - \ " lineElem = document.getElementById(lineNum);" - \ ]) " Insert javascript to toggle matching folds open and closed in all windows, " if dynamic folding is active. @@ -648,11 +658,13 @@ func! tohtml#Diff2HTML(win_list, buf_list) "{{{ \ ]) endif - " insert script tag; javascript is always needed for the line number - " normalization for URL hashes - call append(style_start, [ - \ "<script type='text/javascript'>", - \ s:settings.use_xhtml ? '//<![CDATA[' : "<!--"]) + if s:uses_script + " insert script tag; javascript is always needed for the line number + " normalization for URL hashes + call append(style_start, [ + \ "<script type='text/javascript'>", + \ s:settings.use_xhtml ? '//<![CDATA[' : "<!--"]) + endif " Insert styles from all the generated html documents and additional styles " for the table-based layout of the side-by-side diff. The diff should take @@ -767,7 +779,7 @@ func! tohtml#GetUserSettings() "{{{ if user_settings.no_pre == 0 call tohtml#GetOption(user_settings, \ 'expand_tabs', - \ &expandtab || &ts != 8 || user_settings.number_lines || + \ &expandtab || &ts != 8 || &vts != '' || user_settings.number_lines || \ (user_settings.dynamic_folds && !user_settings.no_foldcolumn)) else let user_settings.expand_tabs = 1 diff --git a/runtime/autoload/xmlformat.vim b/runtime/autoload/xmlformat.vim index f227b5ee25..ea89401977 100644 --- a/runtime/autoload/xmlformat.vim +++ b/runtime/autoload/xmlformat.vim @@ -1,9 +1,9 @@ " Vim plugin for formatting XML -" Last Change: Thu, 22 May 2018 21:26:55 +0100 -" Version: 0.1 -" Author: Christian Brabandt <cb@256bit.org> -" Repository: https://github.com/chrisbra/vim-xml-ftplugin -" License: VIM License +" Last Change: Thu, 07 Dec 2018 +" Version: 0.1 +" Author: Christian Brabandt <cb@256bit.org> +" Repository: https://github.com/chrisbra/vim-xml-ftplugin +" License: VIM License " Documentation: see :h xmlformat.txt (TODO!) " --------------------------------------------------------------------- " Load Once: {{{1 @@ -85,7 +85,11 @@ func! s:Trim(item) endfunc " Check if tag is a new opening tag <tag> {{{1 func! s:StartTag(tag) - return a:tag =~? '^\s*<[^/?]' + let is_comment = s:IsComment(a:tag) + return a:tag =~? '^\s*<[^/?]' && !is_comment +endfunc +func! s:IsComment(tag) + return a:tag =~? '<!--' endfunc " Remove one level of indentation {{{1 func! s:DecreaseIndent() diff --git a/runtime/bugreport.vim b/runtime/bugreport.vim index 650e37940d..27761ca011 100644 --- a/runtime/bugreport.vim +++ b/runtime/bugreport.vim @@ -2,7 +2,7 @@ :" information about the environment of a possible bug in Vim. :" :" Maintainer: Bram Moolenaar <Bram@vim.org> -:" Last change: 2005 Jun 12 +:" Last change: 2019 Jan 27 :" :" To use inside Vim: :" :so $VIMRUNTIME/bugreport.vim 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/eruby.vim b/runtime/compiler/eruby.vim index 45ad5eeadf..a81a3f3b77 100644 --- a/runtime/compiler/eruby.vim +++ b/runtime/compiler/eruby.vim @@ -3,6 +3,7 @@ " Maintainer: Doug Kearns <dougkearns@gmail.com> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2018 Jan 25 if exists("current_compiler") finish @@ -28,8 +29,8 @@ CompilerSet errorformat= \%W%f:%l:\ warning:\ %m, \%E%f:%l:in\ %*[^:]:\ %m, \%E%f:%l:\ %m, - \%-C%\tfrom\ %f:%l:in\ %.%#, - \%-Z%\tfrom\ %f:%l, + \%-C%\t%\\d%#:%#\ %#from\ %f:%l:in\ %.%#, + \%-Z%\t%\\d%#:%#\ %#from\ %f:%l, \%-Z%p^, \%-G%.%# 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/ocaml.vim b/runtime/compiler/ocaml.vim index da15bce8fe..7f8a7eab67 100644 --- a/runtime/compiler/ocaml.vim +++ b/runtime/compiler/ocaml.vim @@ -1,7 +1,11 @@ " Vim Compiler File -" Compiler: ocaml -" Maintainer: See ftplugin/ocaml.vim (?) -" Last Change: June 2013 by Marc Weber +" Compiler: ocaml +" Maintainer: Markus Mottl <markus.mottl@gmail.com> +" URL: https://github.com/rgrinberg/vim-ocaml +" Last Change: +" 2017 Nov 26 - Improved error format (Markus Mottl) +" 2013 Aug 27 - Added a new OCaml error format (Markus Mottl) +" 2013 Jun 30 - Initial version (Marc Weber) " " Marc Weber's comments: " Setting makeprg doesn't make sense, because there is ocamlc, ocamlopt, @@ -17,7 +21,6 @@ " " So having it here makes people opt-in - if exists("current_compiler") finish endif @@ -28,6 +31,7 @@ set cpo&vim CompilerSet errorformat = \%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d:, + \%EFile\ \"%f\"\\,\ line\ %l\\,\ characters\ %c-%*\\d\ %.%#, \%EFile\ \"%f\"\\,\ line\ %l\\,\ character\ %c:%m, \%+EReference\ to\ unbound\ regexp\ name\ %m, \%Eocamlyacc:\ e\ -\ line\ %l\ of\ \"%f\"\\,\ %m, @@ -38,6 +42,12 @@ CompilerSet errorformat = \%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', + \%DEntering\ directory\ '%f', + \%XLeaving\ directory\ '%f', \%DMaking\ %*\\a\ in\ %f let &cpo = s:cpo_save 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/rake.vim b/runtime/compiler/rake.vim index 8490f2a9e9..3d11a31f89 100644 --- a/runtime/compiler/rake.vim +++ b/runtime/compiler/rake.vim @@ -3,6 +3,7 @@ " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2018 Mar 02 if exists("current_compiler") finish @@ -20,12 +21,12 @@ CompilerSet makeprg=rake CompilerSet errorformat= \%D(in\ %f), - \%\\s%#from\ %f:%l:%m, - \%\\s%#from\ %f:%l:, - \%\\s%##\ %f:%l:%m, - \%\\s%##\ %f:%l, - \%\\s%#[%f:%l:\ %#%m, - \%\\s%#%f:%l:\ %#%m, + \%\\s%#%\\d%#:%#\ %#from\ %f:%l:%m, + \%\\s%#%\\d%#:%#\ %#from\ %f:%l:, + \%\\s%##\ %f:%l:%m%\\&%.%#%\\D:%\\d%\\+:%.%#, + \%\\s%##\ %f:%l%\\&%.%#%\\D:%\\d%\\+, + \%\\s%#[%f:%l:\ %#%m%\\&%.%#%\\D:%\\d%\\+:%.%#, + \%\\s%#%f:%l:\ %#%m%\\&%.%#%\\D:%\\d%\\+:%.%#, \%\\s%#%f:%l:, \%m\ [%f:%l]:, \%+Erake\ aborted!, diff --git a/runtime/compiler/rspec.vim b/runtime/compiler/rspec.vim index c77bd70da7..0cfce04572 100644 --- a/runtime/compiler/rspec.vim +++ b/runtime/compiler/rspec.vim @@ -3,6 +3,7 @@ " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2018 Aug 07 if exists("current_compiler") finish @@ -23,7 +24,8 @@ CompilerSet errorformat= \%E%.%#:in\ `load':\ %f:%l:%m, \%E%f:%l:in\ `%*[^']':\ %m, \%-Z\ \ \ \ \ %\\+\#\ %f:%l:%.%#, - \%E\ \ %\\d%\\+)%.%#, + \%E\ \ \ \ \ Failure/Error:\ %m, + \%E\ \ \ \ \ Failure/Error:, \%C\ \ \ \ \ %m, \%C%\\s%#, \%-G%.%# diff --git a/runtime/compiler/ruby.vim b/runtime/compiler/ruby.vim index dcf7a40129..82d4d1c876 100644 --- a/runtime/compiler/ruby.vim +++ b/runtime/compiler/ruby.vim @@ -4,7 +4,7 @@ " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> -" ---------------------------------------------------------------------------- +" Last Change: 2019 Jan 06 if exists("current_compiler") finish @@ -21,21 +21,21 @@ set cpo-=C " default settings runs script normally " add '-c' switch to run syntax check only: " -" CompilerSet makeprg=ruby\ -wc\ $* +" CompilerSet makeprg=ruby\ -c " " or add '-c' at :make command line: " " :make -c %<CR> " -CompilerSet makeprg=ruby\ -w\ $* +CompilerSet makeprg=ruby CompilerSet errorformat= \%+E%f:%l:\ parse\ error, \%W%f:%l:\ warning:\ %m, \%E%f:%l:in\ %*[^:]:\ %m, \%E%f:%l:\ %m, - \%-C%\tfrom\ %f:%l:in\ %.%#, - \%-Z%\tfrom\ %f:%l, + \%-C%\t%\\d%#:%#\ %#from\ %f:%l:in\ %.%#, + \%-Z%\t%\\d%#:%#\ %#from\ %f:%l, \%-Z%p^, \%-G%.%# diff --git a/runtime/compiler/rubyunit.vim b/runtime/compiler/rubyunit.vim index ed0639b581..48e8fa41ab 100644 --- a/runtime/compiler/rubyunit.vim +++ b/runtime/compiler/rubyunit.vim @@ -3,6 +3,7 @@ " Maintainer: Doug Kearns <dougkearns@gmail.com> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2014 Mar 23 if exists("current_compiler") finish 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/api.txt b/runtime/doc/api.txt index a529a9b32e..2c6b053994 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -200,17 +200,26 @@ User reloads the buffer with ":edit", emits: > nvim_buf_detach_event[{buf}] *api-buffer-updates-lua* -In-process lua plugins can also recieve buffer updates, in the form of lua +In-process lua plugins can also receive buffer updates, in the form of lua callbacks. These callbacks are called frequently in various contexts, buffer contents or window layout should not be changed inside these |textlock|. -|lua-vim.schedule| can be used to defer these operations to the main loop, -where they are allowed. +|vim.schedule| can be used to defer these operations to the main loop, where +they are allowed. |nvim_buf_attach| will take keyword args for the callbacks. "on_lines" will -receive parameters ("lines", {buf}, {changedtick}, {firstline}, {lastline}, {new_lastline}). -Unlike remote channels the text contents are not passed. The new text can be -accessed inside the callback as -`vim.api.nvim_buf_get_lines(buf, firstline, new_lastline, true)` +receive parameters ("lines", {buf}, {changedtick}, {firstline}, {lastline}, +{new_lastline}, {old_byte_size}[, {old_utf32_size}, {old_utf16_size}]). +Unlike remote channel events the text contents are not passed. The new text can +be accessed inside the callback as + + `vim.api.nvim_buf_get_lines(buf, firstline, new_lastline, true)` + +{old_byte_size} is the total size of the replaced region {firstline} to +{lastline} in bytes, including the final newline after {lastline}. if +`utf_sizes` is set to true in |nvim_buf_attach()| keyword args, then the +UTF-32 and UTF-16 sizes of the deleted region is also passed as additional +arguments {old_utf32_size} and {old_utf16_size}. + "on_changedtick" is invoked when |b:changedtick| was incremented but no text was changed. The parameters recieved are ("changedtick", {buf}, {changedtick}). @@ -284,14 +293,18 @@ highlighting, or |api-highlights|. By default, floats will use |hl-NormalFloat| as normal highlight, which links to |hl-Pmenu| in the builtin color scheme. The 'winhighlight' option can be used to override it. Currently, floating windows don't support any visual -decorations like a border or additional widgets like scrollbar. +decorations like a border or additional widgets like scrollbar. By default, +floats will inherit options from the current window. This is not always +useful for some options, like 'number'. Use `style='minimal'` flag to +|nvim_open_win()| to disable many UI features that are unwanted for a simple +float, like end-of-buffer region or special columns. Here is an example for creating a float with scratch buffer: > let buf = nvim_create_buf(v:false, v:true) call nvim_buf_set_lines(buf, 0, -1, v:true, ["test", "text"]) let opts = {'relative': 'cursor', 'width': 10, 'height': 2, 'col': 0, - \ 'row': 1, 'anchor': 'NW'} + \ 'row': 1, 'anchor': 'NW', 'style': 'minimal'} let win = nvim_open_win(buf, 0, opts) " optional: change highlight, otherwise Pmenu is used call nvim_win_set_option(win, 'winhl', 'Normal:MyHighlight') diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 4cc1f53cca..6b39f1a103 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -305,6 +305,7 @@ Name triggered by ~ |FuncUndefined| a user function is used but it isn't defined |SpellFileMissing| a spell file is used but it can't be found |SourcePre| before sourcing a Vim script +|SourcePost| after sourcing a Vim script |SourceCmd| before sourcing a Vim script |Cmd-event| |VimResized| after the Vim window size changed @@ -397,8 +398,8 @@ BufFilePost After changing the name of the current buffer BufFilePre Before changing the name of the current buffer with the ":file" or ":saveas" command. *BufHidden* -BufHidden Just after a buffer has become hidden. That - is, when there are no longer windows that show +BufHidden Just before a buffer becomes hidden. That is, + when there are no longer windows that show the buffer, but the buffer is not unloaded or deleted. Not used for ":qa" or ":q" when exiting Vim. @@ -590,18 +591,19 @@ CompleteDone After Insert mode completion is done. Either completed item. CompleteChanged *CompleteChanged* - After each time popup menu changed, not fired - on popup menu hide, use |CompleteDone| for popup - menu hide. + After each time the Insert mode completion + menu changed. Not fired on popup menu hide, + use |CompleteDone| for that. Never triggered + recursively. Sets these |v:event| keys: - completed_item - height - width - row - col - size - scrollbar + completed_item See |complete-items|. + height nr of items visible + width screen cells + row top screen row + col leftmost screen column + size total nr of items + scrollbar TRUE if visible It is not allowed to change the text |textlock|. @@ -646,6 +648,7 @@ CursorMoved After the cursor was moved in Normal or Visual Not triggered when there is typeahead or when an operator is pending. For an example see |match-parens|. + 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. @@ -775,13 +778,14 @@ FilterReadPre Before reading a file from a filter command. Not triggered when 'shelltemp' is off. *FilterWritePost* FilterWritePost After writing a file for a filter command or - making a diff. + making a diff with an external diff (see + DiffUpdated for internal diff). Vim checks the pattern against the name of the current buffer as with FilterWritePre. Not triggered when 'shelltemp' is off. *FilterWritePre* FilterWritePre Before writing a file for a filter command or - making a diff. + making a diff with an external diff. Vim checks the pattern against the name of the current buffer, not the name of the temporary file that is the output of the @@ -873,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' @@ -955,6 +980,12 @@ ShellFilterPost After executing a shell command with *SourcePre* SourcePre Before sourcing a Vim script. |:source| <afile> is the name of the file being sourced. + *SourcePost* +SourcePost After sourcing a Vim script. |:source| + <afile> is the name of the file being sourced. + Not triggered when sourcing was interrupted. + Also triggered after a SourceCmd autocommand + was triggered. *SourceCmd* SourceCmd When sourcing a Vim script. |:source| <afile> is the name of the file being sourced. @@ -1035,10 +1066,13 @@ TermResponse After the response to t_RV is received from anything else that takes time is involved). *TextChanged* TextChanged After a change was made to the text in the - current buffer in Normal mode. That is when - |b:changedtick| has changed. + current buffer in Normal mode. That is after + |b:changedtick| has changed (also when that + happened before the TextChanged autocommand + was defined). Not triggered when there is typeahead or when an operator is pending. + 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. @@ -1053,14 +1087,12 @@ TextChangedP After a change was made to the text in the popup menu is visible. Otherwise the same as TextChanged. *User* -User Never executed automatically. To be used for - autocommands that are only executed with - ":doautocmd". - Note that when `:doautocmd User MyEvent` is - used while there are no matching autocommands, - you will get an error. If you don't want - that, define a dummy autocommand yourself. - *UserGettingBored* +User Not executed automatically. Use |:doautocmd| + to trigger this, typically for "custom events" + in a plugin. Example: > + :autocmd User MyPlugin echom 'got MyPlugin event' + :doautocmd User MyPlugin +< *UserGettingBored* UserGettingBored When the user presses the same key 42 times. Just kidding! :-) *VimEnter* @@ -1338,7 +1370,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. @@ -1355,18 +1387,17 @@ option will not cause any commands to be executed. When the [group] argument is not given, Vim executes the autocommands for all groups. When the [group] argument is included, Vim executes only the matching - autocommands for that group. Note: if you use an - undefined group name, Vim gives you an error message. + autocommands for that group. Undefined group is an + error. *<nomodeline>* After applying the autocommands the modelines are processed, so that their settings overrule the - settings from autocommands, like what happens when - editing a file. This is skipped when the <nomodeline> - argument is present. You probably want to use - <nomodeline> for events that are not used when loading - a buffer, such as |User|. - Processing modelines is also skipped when no - matching autocommands were executed. + settings from autocommands when editing a file. This + is skipped if <nomodeline> is specified. You probably + want to use <nomodeline> for events not used when + loading a buffer, such as |User|. + Modelines are also skipped when no matching + autocommands were executed. *:doautoa* *:doautoall* :doautoa[ll] [<nomodeline>] [group] {event} [fname] @@ -1463,8 +1494,8 @@ If you want the buffer to be unmodified after changing it, reset the instead of ":q!". *autocmd-nested* *E218* -By default, autocommands do not nest. If you use ":e" or ":w" in an -autocommand, Vim does not execute the BufRead and BufWrite autocommands for +By default, autocommands do not nest. For example, if you use ":e" or ":w" in +an autocommand, Vim does not execute the BufRead and BufWrite autocommands for those commands. If you do want this, use the "++nested" flag for those commands in which you want nesting. For example: > :autocmd FileChangedShell *.c ++nested e! @@ -1610,5 +1641,8 @@ following command. Example: > This will write the file without triggering the autocommands defined by the gzip plugin. +Note that some autocommands are not triggered right away, but only later. +This specifically applies to |CursorMoved| and |TextChanged|. + vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 912231bfcd..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 @@ -600,11 +595,11 @@ Directory for temporary files is created in the first suitable directory of: For the {pattern} see |pattern|. {string} can be a literal string, or something special; see |sub-replace-special|. - *E939* When [range] and [count] are omitted, replace in the current line only. When [count] is given, replace in [count] lines, starting with the last line in [range]. When [range] is omitted start in the current line. + *E939* [count] must be a positive number. Also see |cmdline-ranges|. @@ -800,7 +795,7 @@ the |substitute()| function with the following exceptions: - magic is always set without regard to 'magic'. - A ~ inserts a tilde literally. - <CR> and \r inserts a carriage-return (CTRL-M). - - \<CR> does not have a special meaning. it's just one of \x. + - \<CR> does not have a special meaning. It's just one of \x. Examples: > :s/a\|b/xxx\0xxx/g modifies "a b" to "xxxaxxx xxxbxxx" @@ -886,9 +881,9 @@ When the result is a |List| then the items are joined with separating line breaks. Thus each item becomes a line, except that they can contain line breaks themselves. -The whole matched text can be accessed with "submatch(0)". The text matched -with the first pair of () with "submatch(1)". Likewise for further -sub-matches in (). +The |submatch()| function can be used to obtain matched text. The whole +matched text can be accessed with "submatch(0)". The text matched with the +first pair of () with "submatch(1)". Likewise for further sub-matches in (). Be careful: The separation character must not appear in the expression! Consider using a character like "@" or ":". There is no problem if the result @@ -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/cmdline.txt b/runtime/doc/cmdline.txt index a3b5f6b22a..119fd924f1 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -416,6 +416,10 @@ a previous version <Esc> was used). In the pattern standard wildcards '*' and '?' are accepted when matching file names. '*' matches any string, '?' matches exactly one character. +When repeating 'wildchar' or CTRL-N you cycle through the matches, eventually +ending up back to what was typed. If the first match is not what you wanted, +you can use <S-Tab> or CTRL-P to go straight back to what you typed. + The 'wildignorecase' option can be set to ignore case in filenames. The 'wildmenu' option can be set to show the matches just above the command @@ -495,7 +499,6 @@ that see the '"' as part of their argument: :autocmd :bufdo :cexpr (and the like) - :call :cdo (and the like) :command :cscope (and the like) diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index b56240353f..27e60be368 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -44,6 +44,11 @@ Functions ~ *jobclose()* Obsolete name for |chanclose()| *jobsend()* Obsolete name for |chansend()| *last_buffer_nr()* Obsolete name for bufnr("$"). +*rpcstop()* Deprecated. Instead use |jobstop()| to stop any job, + or chanclose(id, "rpc") to close RPC communication + without stopping the job. Use chanclose(id) to close + any socket. + Modifiers ~ *cpo-<* @@ -58,6 +63,10 @@ Normal commands ~ Options ~ *'cscopeverbose'* Enabled by default. Use |:silent| instead. +*'exrc'* *'ex'* Security risk: downloaded files could include + a malicious .nvimrc or .exrc file. See 'secure'. + Recommended alternative: define an autocommand in your + |vimrc| to set options for a matching directory. 'gd' 'gdefault' Enables the |:substitute| flag 'g' by default. *'fe'* 'fenc'+'enc' before Vim 6.0; no longer used. diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt index 843e23ee54..3262d9dec7 100644 --- a/runtime/doc/develop.txt +++ b/runtime/doc/develop.txt @@ -84,12 +84,11 @@ Developer guidelines *dev-guidelines* PROVIDERS *dev-provider* -A goal of Nvim is to allow extension of the editor without special knowledge -in the core. But some Vim components are too tightly coupled; in those cases -a "provider" hook is exposed. +A primary goal of Nvim is to allow extension of the editor without special +knowledge in the core. Some core functions are delegated to "providers" +implemented as external scripts. -Consider two examples of integration with external systems that are -implemented in Vim and are now decoupled from Nvim core as providers: +Examples: 1. In the Vim source code, clipboard logic accounts for more than 1k lines of C source code (ui.c), to perform two tasks that are now accomplished with @@ -101,29 +100,28 @@ implemented in Vim and are now decoupled from Nvim core as providers: scripting is performed by an external host process implemented in ~2k lines of Python. -Ideally we could implement Python and clipboard integration in pure vimscript -and without touching the C code. But this is infeasible without compromising -backwards compatibility with Vim; that's where providers help. +The provider framework invokes VimL from C. It is composed of two functions +in eval.c: -The provider framework helps call vimscript from C. It is composed of two -functions in eval.c: - -- eval_call_provider(name, method, arguments): calls provider#(name)#Call +- eval_call_provider(name, method, arguments): calls provider#{name}#Call with the method and arguments. -- eval_has_provider(name): Checks if a provider is implemented. Returns true - if the provider#(name)#Call function is implemented. Called by |has()| - (vimscript) to check if features are available. - -The provider#(name)#Call function implements integration with an external -system, because shell commands and |RPC| clients are easier to work with in -vimscript. +- eval_has_provider(name): Checks the `g:loaded_{name}_provider` variable + which must be set to 2 by the provider script to indicate that it is + "enabled and working". Called by |has()| to check if features are available. For example, the Python provider is implemented by the -autoload/provider/python.vim script; the provider#python#Call function is only -defined if a valid external Python host is found. That works well with the -`has('python')` expression (normally used by Python plugins) because if the -Python host isn't installed then the plugin will "think" it is running in -a Vim compiled without the "+python" feature. +"autoload/provider/python.vim" script, which sets `g:loaded_python_provider` +to 2 only if a valid external Python host is found. Then `has("python")` +reflects whether Python support is working. + + *provider-reload* +Sometimes a GUI or other application may want to force a provider to +"reload". To reload a provider, undefine its "loaded" flag, then use +|:runtime| to reload it: > + + :unlet g:loaded_clipboard_provider + :runtime autoload/provider/clipboard.vim + DOCUMENTATION *dev-doc* 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/digraph.txt b/runtime/doc/digraph.txt index 95bc3722d0..b106e625f2 100644 --- a/runtime/doc/digraph.txt +++ b/runtime/doc/digraph.txt @@ -50,6 +50,10 @@ conversion to be available, it might fail. For the NUL character you will see "10". That's because NUL characters are internally represented with a NL character. When you write the file it will become a NUL character. +Example: > + digraph oe 339 +This defines the "oe" digraph for a character that is number 339 in Unicode. + ============================================================================== 2. Using digraphs *digraphs-use* @@ -91,11 +95,14 @@ this, you will have to type <BS> e again. To avoid this don't set the You may have problems using Vim with characters which have a value above 128. For example: You insert ue (u-umlaut) and the editor echoes \334 in Insert -mode. After leaving the Insert mode everything is fine. Note that fmt -removes all characters with a value above 128 from the text being formatted. -On some Unix systems this means you have to define the environment-variable -LC_CTYPE. If you are using csh, then put the following line in your .cshrc: > - setenv LC_CTYPE iso_8859_1 +mode. After leaving the Insert mode everything is fine. On some Unix systems +this means you have to define the environment-variable LC_CTYPE. If you are +using csh, then put the following line in your .cshrc: > + setenv LC_CTYPE en_US.utf8 +(or similar for a different language or country). The value must be a valid +locale on your system, i.e. on Unix-like systems it must be present in the +output of > + locale -a ============================================================================== 3. Default digraphs *digraphs-default* 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 4dc63763ab..5e8c5151f2 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -69,7 +69,7 @@ To force conversion from String to Number, add zero to it: > To avoid a leading zero to cause octal conversion, or for using a different base, use |str2nr()|. - *TRUE* *FALSE* + *TRUE* *FALSE* *Boolean* For boolean operators Numbers are used. Zero is FALSE, non-zero is TRUE. You can also use |v:false| and |v:true|. When TRUE is returned from a function it is the Number one, FALSE is the number zero. @@ -92,10 +92,11 @@ Note that " " and "0" are also non-empty strings, thus considered to be TRUE. A List, Dictionary or Float is not a Number or String, thus evaluate to FALSE. *E745* *E728* *E703* *E729* *E730* *E731* -List, Dictionary and Funcref types are not automatically converted. +|List|, |Dictionary|, |Funcref|, and |Blob| types are not automatically +converted. *E805* *E806* *E808* -When mixing Number and Float the Number is converted to Float. Otherwise +When mixing Number and Float the Number is converted to Float. Otherwise there is no automatic conversion of Float. You can use str2float() for String to Float, printf() for Float to String and float2nr() for Float to Number. @@ -104,13 +105,14 @@ When expecting a Float a Number can also be used, but nothing else. *no-type-checking* You will not get an error if you try to change the type of a variable. - + + 1.2 Function references ~ *Funcref* *E695* *E718* -A Funcref variable is obtained with the |function()| function or created with -the lambda expression |expr-lambda|. It can be used in an expression in the -place of a function name, before the parenthesis around the arguments, to -invoke the function it refers to. Example: > +A Funcref variable is obtained with the |function()| function, the |funcref()| +function or created with the lambda expression |expr-lambda|. It can be used +in an expression in the place of a function name, before the parenthesis +around the arguments, to invoke the function it refers to. Example: > :let Fn = function("MyFunc") :echo Fn() @@ -142,14 +144,14 @@ arguments: > *Partial* A Funcref optionally binds a Dictionary and/or arguments. This is also called a Partial. This is created by passing the Dictionary and/or arguments to -function(). When calling the function the Dictionary and/or arguments will be -passed to the function. Example: > +function() or funcref(). When calling the function the Dictionary and/or +arguments will be passed to the function. Example: > let Cb = function('Callback', ['foo'], myDict) - call Cb() + call Cb('bar') This will invoke the function as if using: > - call myDict.Callback('foo') + call myDict.Callback('foo', 'bar') Note that binding a function to a Dictionary also happens when the function is a member of the Dictionary: > @@ -177,7 +179,7 @@ Here "self" will be "myDict", because it was bound explicitly. 1.3 Lists ~ *list* *List* *Lists* *E686* A List is an ordered sequence of items. An item can be of any type. Items -can be accessed by their index number. Items can be added and removed at any +can be accessed by their index number. Items can be added and removed at any position in the sequence. @@ -188,7 +190,7 @@ Examples: > :let mylist = [1, two, 3, "four"] :let emptylist = [] -An item can be any expression. Using a List for an item creates a +An item can be any expression. Using a List for an item creates a List of Lists: > :let nestlist = [[11, 12], [21, 22], [31, 32]] @@ -247,7 +249,7 @@ length minus one is used: > :echo mylist[2:8] " result: [2, 3] NOTE: mylist[s:e] means using the variable "s:e" as index. Watch out for -using a single letter variable before the ":". Insert a space when needed: +using a single letter variable before the ":". Insert a space when needed: mylist[s : e]. @@ -376,7 +378,7 @@ This works like: > If all you want to do is modify each item in the list then the |map()| function will be a simpler method than a for loop. -Just like the |:let| command, |:for| also accepts a list of variables. This +Just like the |:let| command, |:for| also accepts a list of variables. This requires the argument to be a list of lists. > :for [lnum, col] in [[1, 3], [2, 8], [3, 0]] : call Doit(lnum, col) @@ -433,11 +435,11 @@ only appear once. Examples: > < *E713* *E716* *E717* A key is always a String. You can use a Number, it will be converted to a String automatically. Thus the String '4' and the number 4 will find the same -entry. Note that the String '04' and the Number 04 are different, since the +entry. Note that the String '04' and the Number 04 are different, since the Number will be converted to the String '4'. The empty string can be used as a key. -A value can be any expression. Using a Dictionary for a value creates a +A value can be any expression. Using a Dictionary for a value creates a nested Dictionary: > :let nestdict = {1: {11: 'a', 12: 'b'}, 2: {21: 'c'}} @@ -464,7 +466,7 @@ key lookup can be repeated: > Dictionary to List conversion ~ -You may want to loop over the entries in a dictionary. For this you need to +You may want to loop over the entries in a dictionary. For this you need to turn the Dictionary into a List and pass it to |:for|. Most often you want to loop over the keys, using the |keys()| function: > @@ -481,7 +483,7 @@ To loop over the values use the |values()| function: > :endfor If you want both the key and the value use the |items()| function. It returns -a List in which each item is a List with two items, the key and the value: > +a List in which each item is a List with two items, the key and the value: > :for [key, value] in items(mydict) : echo key . ': ' . value :endfor @@ -531,7 +533,7 @@ This removes all entries from "dict" with a value not matching 'x'. Dictionary function ~ *Dictionary-function* *self* *E725* *E862* When a function is defined with the "dict" attribute it can be used in a -special way with a dictionary. Example: > +special way with a dictionary. Example: > :function Mylen() dict : return len(self.data) :endfunction @@ -555,7 +557,7 @@ assigned to a Dictionary in this way: > :echo mydict.len() The function will then get a number and the value of dict.len is a |Funcref| -that references this function. The function can only be used through a +that references this function. The function can only be used through a |Funcref|. It will automatically be deleted when there is no |Funcref| remaining that refers to it. @@ -815,10 +817,10 @@ values are different: > "is#"/"isnot#" and "is?"/"isnot?" can be used to match and ignore case. When comparing a String with a Number, the String is converted to a Number, -and the comparison is done on Numbers. This means that: > +and the comparison is done on Numbers. This means that: > echo 0 == 'x' 1 -because 'x' converted to a Number is zero. However: > +because 'x' converted to a Number is zero. However: > echo [0] == ['x'] 0 Inside a List or Dictionary this conversion is not used. @@ -914,7 +916,7 @@ For '+' the number is unchanged. A String will be converted to a Number first. -These three can be repeated and mixed. Examples: +These three can be repeated and mixed. Examples: !-1 == 0 !!8 == 1 --9 == 9 @@ -948,7 +950,7 @@ compatibility). Use [-1:] to get the last byte. If expr8 is a |List| then it results the item at index expr1. See |list-index| for possible index values. If the index is out of range this results in an -error. Example: > +error. Example: > :let item = mylist[-1] " get last item Generally, if a |List| index is equal to or higher than the length of the @@ -980,7 +982,7 @@ Examples: > < *slice* If expr8 is a |List| this results in a new |List| with the items indicated by -the indexes expr1a and expr1b. This works like with a String, as explained +the indexes expr1a and expr1b. This works like with a String, as explained just above. Also see |sublist| below. Examples: > :let l = mylist[:3] " first four items :let l = mylist[4:4] " List with one item @@ -1008,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. @@ -1040,7 +1043,7 @@ Floating point numbers can be written in two forms: contain digits. [-+] means there is an optional plus or minus sign. {exp} is the exponent, power of 10. -Only a decimal point is accepted, not a comma. No matter what the current +Only a decimal point is accepted, not a comma. No matter what the current locale is. Examples: @@ -1129,11 +1132,11 @@ literal-string *literal-string* *E115* Note that single quotes are used. -This string is taken as it is. No backslashes are removed or have a special +This string is taken as it is. No backslashes are removed or have a special meaning. The only exception is that two quotes stand for one quote. Single quoted strings are useful for patterns, so that backslashes do not need -to be doubled. These two commands are equivalent: > +to be doubled. These two commands are equivalent: > if a =~ "\\s*" if a =~ '\s*' @@ -1159,7 +1162,7 @@ register *expr-register* *@r* The result is the contents of the named register, as a single string. Newlines are inserted where required. To get the contents of the unnamed -register use @" or @@. See |registers| for an explanation of the available +register use @" or @@. See |registers| for an explanation of the available registers. When using the '=' register you get the expression itself, not what it @@ -1177,6 +1180,13 @@ $VAR environment variable The String value of any environment variable. When it is not defined, the result is an empty string. + +The functions `getenv()` and `setenv()` can also be used and work for +environment variables with non-alphanumeric names. +The function `environ()` can be used to get a Dict with all environment +variables. + + *expr-env-expand* Note that there is a difference between using $VAR directly and using expand("$VAR"). Using it directly will only expand environment variables that @@ -1321,7 +1331,7 @@ It is deleted when the tab page is closed. *global-variable* *g:var* *g:* Inside functions global variables are accessed with "g:". Omitting this will -access a variable local to a function. But "g:" can also be used in any other +access a variable local to a function. But "g:" can also be used in any other place if you like. *local-variable* *l:var* *l:* @@ -1407,7 +1417,9 @@ Note that this means that filetype plugins don't get a different set of script variables for each buffer. Use local buffer variables instead |b:var|. -Predefined Vim variables: *vim-variable* *v:var* *v:* +PREDEFINED VIM VARIABLES *vim-variable* *v:var* *v:* + *E963* +Some variables can be set by the user, but the type cannot be changed. *v:beval_col* *beval_col-variable* v:beval_col The number of the column, over which the mouse pointer is. @@ -1463,7 +1475,7 @@ v:cmdarg This variable is used for two purposes: set before an autocommand event for a file read/write command is triggered. There is a leading space to make it possible to append this variable directly after the - read/write command. Note: The "+cmd" argument isn't + read/write command. Note: The "+cmd" argument isn't included here, because it will be executed anyway. 2. When printing a PostScript file with ":hardcopy" this is the argument for the ":hardcopy" command. This can be used @@ -1483,7 +1495,7 @@ v:completed_item *v:count* *count-variable* v:count The count given for the last Normal mode command. Can be used - to get the count before a mapping. Read-only. Example: > + to get the count before a mapping. Read-only. Example: > :map _x :<C-U>echo "the count is " . v:count<CR> < Note: The <C-U> is required to remove the line range that you get when typing ':' after a count. @@ -1505,7 +1517,7 @@ v:ctype The current locale setting for characters of the runtime See |multi-lang|. *v:dying* *dying-variable* -v:dying Normally zero. When a deadly signal is caught it's set to +v:dying Normally zero. When a deadly signal is caught it's set to one. When multiple signals are caught the number increases. Can be used in an autocommand to check if Vim didn't terminate normally. {only works on Unix} @@ -1584,7 +1596,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". @@ -1638,7 +1650,7 @@ v:fname_out The name of the output file. Only valid while 'diffexpr' output of diff 'patchexpr' resulting patched file (*) When doing conversion for a write command (e.g., ":w - file") it will be equal to v:fname_in. When doing conversion + file") it will be equal to v:fname_in. When doing conversion for a read command (e.g., ":e file") it will be a temporary file and different from v:fname_in. @@ -1787,7 +1799,7 @@ v:prevcount The count given for the last but one Normal mode command. < Read-only. *v:profiling* *profiling-variable* -v:profiling Normally zero. Set to one after using ":profile start". +v:profiling Normally zero. Set to one after using ":profile start". See |profiling|. *v:progname* *progname-variable* @@ -1867,14 +1879,14 @@ v:swapchoice |SwapExists| autocommands can set this to the selected choice 'd' Delete swapfile 'q' Quit 'a' Abort - The value should be a single-character string. An empty value + The value should be a single-character string. An empty value results in the user being asked, as would happen when there is no SwapExists autocommand. The default is empty. *v:swapcommand* *swapcommand-variable* v:swapcommand Normal mode command to be executed after a file has been opened. Can be used for a |SwapExists| autocommand to have - another Vim open the file and jump to the right place. For + another Vim open the file and jump to the right place. For example, when jumping to a tag the value is ":tag tagname\r". For ":edit +cmd file" the value is ":cmd\r". @@ -1917,7 +1929,7 @@ v:this_session Full filename of the last loaded or saved session file. *v:throwpoint* *throwpoint-variable* v:throwpoint The point where the exception most recently caught and not - finished was thrown. Not set when commands are typed. See + finished was thrown. Not set when commands are typed. See also |v:exception| and |throw-variables|. Example: > :try @@ -1935,7 +1947,7 @@ v:true Special value used to put "true" in JSON and msgpack. See |expr7| when used with numeric operators). Read-only. *v:val* *val-variable* -v:val Value of the current item of a |List| or |Dictionary|. Only +v:val Value of the current item of a |List| or |Dictionary|. Only valid while evaluating the expression used with |map()| and |filter()|. Read-only. @@ -2006,8 +2018,10 @@ atan2({expr}, {expr}) Float arc tangent of {expr1} / {expr2} browse({save}, {title}, {initdir}, {default}) String put up a file requester browsedir({title}, {initdir}) String put up a directory requester +bufadd({name}) Number add a buffer to the buffer list bufexists({expr}) Number |TRUE| if buffer {expr} exists buflisted({expr}) Number |TRUE| if buffer {expr} is listed +bufload({expr}) Number load buffer {expr} if not loaded yet bufloaded({expr}) Number |TRUE| if buffer {expr} is loaded bufname({expr}) String Name of the buffer {expr} bufnr({expr} [, {create}]) Number Number of the buffer {expr} @@ -2054,6 +2068,7 @@ did_filetype() Number |TRUE| if FileType autocommand event used diff_filler({lnum}) Number diff filler lines about {lnum} diff_hlID({lnum}, {col}) Number diff highlighting at {lnum}/{col} empty({expr}) Number |TRUE| if {expr} is empty +environ() Dict return environment variables escape({string}, {chars}) String escape {chars} in {string} with '\' eval({string}) any evaluate {string} into its value eventhandler() Number |TRUE| if inside an event handler @@ -2111,6 +2126,7 @@ getcompletion({pat}, {type} [, {filtered}]) List list of cmdline completion matches getcurpos() List position of the cursor getcwd([{winnr} [, {tabnr}]]) String get the current working directory +getenv({name}) String return environment variable getfontname([{name}]) String name of font being used getfperm({fname}) String file permissions of file {fname} getfsize({fname}) Number size in bytes of file {fname} @@ -2227,8 +2243,6 @@ msgpackdump({list}) List dump a list of objects to msgpack msgpackparse({list}) List parse msgpack to a list of objects nextnonblank({lnum}) Number line nr of non-blank line >= {lnum} nr2char({expr}[, {utf8}]) String single char with ASCII/UTF8 value {expr} -option_restore({list}) none restore options saved by option_save() -option_save({list}) List save options values nvim_...({args}...) any call nvim |api| functions or({expr}, {expr}) Number bitwise OR pathshorten({expr}) String shorten directory names in a path @@ -2241,6 +2255,7 @@ py3eval({expr}) any evaluate |python3| expression pyxeval({expr}) any evaluate |python_x| expression range({expr} [, {max} [, {stride}]]) List items from {expr} to {max} +readdir({dir} [, {expr}]) List file names in {dir} selected by {expr} readfile({fname} [, {binary} [, {max}]]) List get list of lines from file {fname} reg_executing() Number get the executing register name @@ -2286,9 +2301,13 @@ searchpos({pattern} [, {flags} [, {stopline} [, {timeout}]]]) server2client({clientid}, {string}) Number send reply string serverlist() String get a list of available servers +setbufline( {expr}, {lnum}, {line}) + Number set line {lnum} to {line} in buffer + {expr} setbufvar({expr}, {varname}, {val}) set {varname} in buffer {expr} to {val} setcharsearch({dict}) Dict set character search from {dict} setcmdpos({pos}) Number set cursor position in command-line +setenv({name}, {val}) none set environment variable setfperm({fname}, {mode} Number set {fname} file permissions to {mode} setline({lnum}, {line}) Number set line {lnum} to {line} setloclist({nr}, {list}[, {action}[, {what}]]) @@ -2473,7 +2492,7 @@ append({lnum}, {text}) *append()* the current buffer. {lnum} can be zero to insert a line before the first one. Returns 1 for failure ({lnum} out of range or out of memory), - 0 for success. Example: > + 0 for success. Example: > :let failed = append(line('$'), "# THE END") :let failed = append(0, ["Chapter 1", "the beginning"]) < @@ -2569,9 +2588,9 @@ assert_false({actual} [, {msg}]) *assert_false()* "Expected False but got {actual}" is produced. assert_inrange({lower}, {upper}, {actual} [, {msg}]) *assert_inrange()* - This asserts number values. When {actual} is lower than - {lower} or higher than {upper} an error message is added to - |v:errors|. + This asserts number and |Float| values. When {actual} is lower + than {lower} or higher than {upper} an error message is added + to |v:errors|. Also see |assert-return|. When {msg} is omitted an error in the form "Expected range {lower} - {upper}, but got {actual}" is produced. @@ -2676,6 +2695,14 @@ browsedir({title}, {initdir}) When the "Cancel" button is hit, something went wrong, or browsing is not possible, an empty string is returned. +bufadd({name}) *bufadd()* + Add a buffer to the buffer list with {name}. + If a buffer for file {name} already exists, return that buffer + number. Otherwise return the buffer number of the newly + created buffer. When {name} is an empty string then a new + buffer is always created. + The buffer will not have' 'buflisted' set. + bufexists({expr}) *bufexists()* The result is a Number, which is |TRUE| if a buffer called {expr} exists. @@ -2703,6 +2730,15 @@ buflisted({expr}) *buflisted()* {expr} exists and is listed (has the 'buflisted' option set). The {expr} argument is used like with |bufexists()|. +bufload({expr}) *bufload()* + Ensure the buffer {expr} is loaded. When the buffer name + refers to an existing file then the file is read. Otherwise + the buffer will be empty. If the buffer was already loaded + then there is no change. + If there is an existing swap file for the file of the buffer, + there will be no dialog, the buffer will be loaded anyway. + The {expr} argument is used like with |bufexists()|. + bufloaded({expr}) *bufloaded()* The result is a Number, which is |TRUE| if a buffer called {expr} exists and is loaded (shown in a window or hidden). @@ -2714,7 +2750,7 @@ bufname({expr}) *bufname()* If {expr} is a Number, that buffer number's name is given. Number zero is the alternate buffer for the current window. If {expr} is a String, it is used as a |file-pattern| to match - with the buffer names. This is always done like 'magic' is + with the buffer names. This is always done like 'magic' is set and 'cpoptions' is empty. When there is more than one match an empty string is returned. "" or "%" can be used for the current buffer, "#" for the @@ -2764,7 +2800,7 @@ bufwinid({expr}) *bufwinid()* bufwinnr({expr}) *bufwinnr()* The result is a Number, which is the number of the first window associated with buffer {expr}. For the use of {expr}, - see |bufname()| above. If buffer {expr} doesn't exist or + see |bufname()| above. If buffer {expr} doesn't exist or there is no such window, -1 is returned. Example: > echo "A window containing buffer 1 is " . (bufwinnr(1)) @@ -2921,7 +2957,7 @@ col({expr}) The result is a Number, which is the byte index of the column col("$") length of cursor line plus one col("'t") column of mark t col("'" . markname) column of mark markname -< The first column is 1. 0 is returned for an error. +< The first column is 1. 0 is returned for an error. For an uppercase mark the column may actually be in another buffer. For the cursor position, when 'virtualedit' is active, the @@ -2968,7 +3004,7 @@ complete_add({expr}) *complete_add()* Returns 0 for failure (empty string or out of memory), 1 when the match was added, 2 when the match was already in the list. - See |complete-functions| for an explanation of {expr}. It is + See |complete-functions| for an explanation of {expr}. It is the same as one item in the list that 'omnifunc' would return. complete_check() *complete_check()* @@ -2985,7 +3021,7 @@ complete_info([{what}]) completion. See |ins-completion|. The items are: mode Current completion mode name string. - See |completion_info_mode| for the values. + See |complete_info_mode| for the values. pum_visible |TRUE| if popup menu is visible. See |pumvisible()|. items List of completion matches. Each item is a @@ -3075,19 +3111,20 @@ confirm({msg} [, {choices} [, {default} [, {type}]]]) :endif < In a GUI dialog, buttons are used. The layout of the buttons depends on the 'v' flag in 'guioptions'. If it is included, - the buttons are always put vertically. Otherwise, confirm() + the buttons are always put vertically. Otherwise, confirm() tries to put the buttons in one horizontal line. If they don't fit, a vertical layout is used anyway. For some systems the horizontal layout is always used. *copy()* -copy({expr}) Make a copy of {expr}. For Numbers and Strings this isn't +copy({expr}) Make a copy of {expr}. For Numbers and Strings this isn't different from using {expr} directly. When {expr} is a |List| a shallow copy is created. This means that the original |List| can be changed without changing the copy, and vice versa. But the items are identical, thus - changing an item changes the contents of both |Lists|. Also - see |deepcopy()|. + changing an item changes the contents of both |Lists|. + A |Dictionary| is copied in a similar way as a |List|. + Also see |deepcopy()|. cos({expr}) *cos()* Return the cosine of {expr}, measured in radians, as a |Float|. @@ -3195,7 +3232,7 @@ cursor({list}) deepcopy({expr}[, {noref}]) *deepcopy()* *E698* - Make a copy of {expr}. For Numbers and Strings this isn't + Make a copy of {expr}. For Numbers and Strings this isn't different from using {expr} directly. When {expr} is a |List| a full copy is created. This means that the original |List| can be changed without changing the @@ -3317,6 +3354,14 @@ diff_hlID({lnum}, {col}) *diff_hlID()* The highlight ID can be used with |synIDattr()| to obtain syntax information about the highlighting. +environ() *environ()* + Return all of environment variables as dictionary. You can + check if an environment variable exists like this: > + :echo has_key(environ(), 'HOME') +< Note that the variable name may be CamelCase; to ignore case + use this: > + :echo index(keys(environ()), 'HOME', 0, 1) != -1 + empty({expr}) *empty()* Return the Number 1 if {expr} is empty, zero otherwise. A |List| or |Dictionary| is empty when it does not have any @@ -3352,10 +3397,10 @@ executable({expr}) *executable()* searchpath for programs. *PATHEXT* On Windows the ".exe", ".bat", etc. can optionally be included. Then the extensions in $PATHEXT are - tried. Thus if "foo.exe" does not exist, "foo.exe.bat" can be - found. If $PATHEXT is not set then ".exe;.com;.bat;.cmd" is + tried. Thus if "foo.exe" does not exist, "foo.exe.bat" can be + found. If $PATHEXT is not set then ".exe;.com;.bat;.cmd" is used. A dot by itself can be used in $PATHEXT to try using - the name without an extension. When 'shell' looks like a + the name without an extension. When 'shell' looks like a Unix shell, then the name is also tried without adding an extension. On Windows it only checks if the file exists and @@ -3418,7 +3463,7 @@ exists({expr}) The result is a Number, which is |TRUE| if {expr} is |user-functions|). Also works for a variable that is a Funcref. varname internal variable (see - |internal-variables|). Also works + |internal-variables|). Also works for |curly-braces-names|, |Dictionary| entries, |List| items, etc. Beware that evaluating an index may cause an @@ -3503,7 +3548,7 @@ expand({expr} [, {nosuf} [, {list}]]) *expand()* Otherwise the result is a String and when there are several matches, they are separated by <NL> characters. - If the expansion fails, the result is an empty string. A name + If the expansion fails, the result is an empty string. A name for a non-existing file is not included, unless {expr} does not start with '%', '#' or '<', see below. @@ -3567,7 +3612,7 @@ expand({expr} [, {nosuf} [, {list}]]) *expand()* slow, because a shell may be used to do the expansion. See |expr-env-expand|. The expanded variable is still handled like a list of file - names. When an environment variable cannot be expanded, it is + names. When an environment variable cannot be expanded, it is left unchanged. Thus ":echo expand('$FOOBAR')" results in "$FOOBAR". @@ -3590,7 +3635,7 @@ extend({expr1}, {expr2} [, {expr3}]) *extend()* items copied is equal to the original length of the List. E.g., when {expr3} is 1 you get N new copies of the first item (where N is the original length of the List). - Use |add()| to concatenate one item to a list. To concatenate + Use |add()| to concatenate one item to a list. To concatenate two lists into a new list use the + operator: > :let newlist = [1, 2, 3] + [4, 5] < @@ -3790,7 +3835,7 @@ fmod({expr1}, {expr2}) *fmod()* fnameescape({string}) *fnameescape()* - Escape {string} for use as file name command argument. All + Escape {string} for use as file name command argument. All characters that have a special meaning, such as '%' and '|' are escaped with a backslash. For most systems the characters escaped are @@ -3827,7 +3872,7 @@ foldclosedend({lnum}) *foldclosedend()* foldlevel({lnum}) *foldlevel()* The result is a Number, which is the foldlevel of line {lnum} - in the current buffer. For nested folds the deepest level is + in the current buffer. For nested folds the deepest level is returned. If there is no fold at line {lnum}, zero is returned. It doesn't matter if the folds are open or closed. When used while updating folds (from 'foldexpr') -1 is @@ -3842,7 +3887,7 @@ foldtext() Returns a String, to be displayed for a closed fold. This is |v:foldstart|, |v:foldend| and |v:folddashes| variables. The returned string looks like this: > +-- 45 lines: abcdef -< The number of leading dashes depends on the foldlevel. The +< The number of leading dashes depends on the foldlevel. The "45" is the number of lines in the fold. "abcdef" is the text in the first non-blank line of the fold. Leading white space, "//" or "/*" and the text from the 'foldmarker' and @@ -3861,7 +3906,7 @@ foldtextresult({lnum}) *foldtextresult()* Useful when exporting folded text, e.g., to HTML. *foreground()* -foreground() Move the Vim window to the foreground. Useful when sent from +foreground() Move the Vim window to the foreground. Useful when sent from a client to a Vim server. |remote_send()| On Win32 systems this might not work, the OS does not always allow a window to bring itself to the foreground. Use @@ -3956,7 +4001,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: @@ -4163,7 +4211,7 @@ getcharmod() *getcharmod()* 96 mouse quadruple click (== 32 + 64) 128 command (Macintosh only) Only the modifiers that have not been included in the - character itself are obtained. Thus Shift-a results in "A" + character itself are obtained. Thus Shift-a results in "A" without a modifier. getcharsearch() *getcharsearch()* @@ -4303,14 +4351,11 @@ getcwd([{winnr}[, {tabnr}]]) *getcwd()* < If {winnr} is -1 it is ignored, only the tab is resolved. {winnr} can be the window number or the |window-ID|. - -getfsize({fname}) *getfsize()* - The result is a Number, which is the size in bytes of the - given file {fname}. - If {fname} is a directory, 0 is returned. - If the file {fname} can't be found, -1 is returned. - If the size of {fname} is too big to fit in a Number then -2 - is returned. +getenv({name}) *getenv()* + Return the value of environment variable {name}. + When the variable does not exist |v:null| is returned. That + is different from a variable set to an empty string. + See also |expr-env|. getfontname([{name}]) *getfontname()* Without an argument returns the name of the normal font being @@ -4341,6 +4386,14 @@ getfperm({fname}) *getfperm()* For setting permissions use |setfperm()|. +getfsize({fname}) *getfsize()* + The result is a Number, which is the size in bytes of the + given file {fname}. + If {fname} is a directory, 0 is returned. + If the file {fname} can't be found, -1 is returned. + If the size of {fname} is too big to fit in a Number then -2 + is returned. + getftime({fname}) *getftime()* The result is a Number, which is the last modification time of the given file {fname}. The value is measured as seconds @@ -4606,7 +4659,7 @@ gettabinfo([{arg}]) *gettabinfo()* tabnr tab page number. variables a reference to the dictionary with tabpage-local variables - windows List of |window-ID|s in the tag page. + windows List of |window-ID|s in the tab page. gettabvar({tabnr}, {varname} [, {def}]) *gettabvar()* Get the value of a tab-local variable {varname} in tab page @@ -4674,7 +4727,7 @@ gettagstack([{nr}]) *gettagstack()* getwinpos([{timeout}]) *getwinpos()* The result is a list with two numbers, the result of - getwinposx() and getwinposy() combined: + getwinposx() and getwinposy() combined: [x-pos, y-pos] {timeout} can be used to specify how long to wait in msec for a response from the terminal. When omitted 100 msec is used. @@ -4687,7 +4740,7 @@ getwinposx() The result is a Number, which is the X coordinate in pixels of *getwinposy()* getwinposy() The result is a Number, which is the Y coordinate in pixels of - the top of the GUI Vim window. The result will be -1 if the + the top of the GUI Vim window. The result will be -1 if the information is not available. The value can be used with `:winpos`. @@ -4707,6 +4760,7 @@ getwininfo([{winid}]) *getwininfo()* height window height (excluding winbar) loclist 1 if showing a location list quickfix 1 if quickfix or location list window + terminal 1 if a terminal window tabnr tab page number topline first displayed buffer line variables a reference to the dictionary with @@ -4743,6 +4797,9 @@ glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()* If the expansion fails, the result is an empty String or List. + You can also use |readdir()| if you need to do complicated + things, such as limiting the number of matches. + A name for a non-existing file is not included. A symbolic link is only included if it points to an existing file. However, when the {alllinks} argument is present and it is @@ -4753,7 +4810,7 @@ glob({expr} [, {nosuf} [, {list} [, {alllinks}]]]) *glob()* :let tagfiles = glob("`find . -name tags -print`") :let &tags = substitute(tagfiles, "\n", ",", "g") < The result of the program inside the backticks should be one - item per line. Spaces inside an item are allowed. + item per line. Spaces inside an item are allowed. See |expand()| for expanding special Vim variables. See |system()| for getting the raw output of an external command. @@ -4768,7 +4825,7 @@ glob2regpat({expr}) *glob2regpat()* < When {expr} is an empty string the result is "^$", match an empty string. Note that the result depends on the system. On MS-Windows - a backslash usually means a patch separator. + a backslash usually means a path separator. *globpath()* globpath({path}, {expr} [, {nosuf} [, {list} [, {allinks}]]]) @@ -4890,7 +4947,7 @@ hasmapto({what} [, {mode} [, {abbr}]]) *hasmapto()* When {mode} is omitted, "nvo" is used. This function is useful to check if a mapping already exists - to a function in a Vim script. Example: > + to a function in a Vim script. Example: > :if !hasmapto('\ABCdoit') : map <Leader>d \ABCdoit :endif @@ -4985,7 +5042,7 @@ hlID({name}) The result is a Number, which is the ID of the highlight group with name {name}. When the highlight group doesn't exist, zero is returned. This can be used to retrieve information about the highlight - group. For example, to get the background color of the + group. For example, to get the background color of the "Comment" group: > :echo synIDattr(synIDtrans(hlID("Comment")), "bg") @@ -5008,7 +5065,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 @@ -5055,7 +5111,7 @@ input({opts}) The highlighting set with |:echohl| is used for the prompt. The input is entered just like a command-line, with the same - editing commands and mappings. There is a separate history + editing commands and mappings. There is a separate history for lines typed for input(). Example: > :if input("Coffee or beer? ") == "beer" @@ -5069,9 +5125,9 @@ input({opts}) < The optional {completion} argument specifies the type of completion supported for the input. Without it completion is - not performed. The supported completion types are the same as + not performed. The supported completion types are the same as that can be supplied to a user-defined command using the - "-complete=" argument. Refer to |:command-completion| for + "-complete=" argument. Refer to |:command-completion| for more information. Example: > let fname = input("File: ", "", "file") @@ -5151,12 +5207,12 @@ inputlist({textlist}) *inputlist()* displayed, one string per line. The user will be prompted to enter a number, which is returned. The user can also select an item by clicking on it with the - mouse. For the first string 0 is returned. When clicking + mouse. For the first string 0 is returned. When clicking above the first item a negative number is returned. When clicking on the prompt one more than the length of {textlist} is returned. Make sure {textlist} has less than 'lines' entries, otherwise - it won't work. It's a good idea to put the entry number at + it won't work. It's a good idea to put the entry number at the start of the string. And put a prompt in the first item. Example: > let color = inputlist(['Select color:', '1. red', @@ -5190,7 +5246,7 @@ inputsecret({prompt} [, {text}]) *inputsecret()* insert({list}, {item} [, {idx}]) *insert()* Insert {item} at the start of |List| {list}. If {idx} is specified insert {item} before the item with index - {idx}. If {idx} is zero it goes before the first item, just + {idx}. If {idx} is zero it goes before the first item, just like omitting {idx}. A negative {idx} is also possible, see |list-index|. -1 inserts just before the last item. Returns the resulting |List|. Examples: > @@ -5328,10 +5384,12 @@ jobwait({ids}[, {timeout}]) *jobwait()* Wait for a set of jobs to complete. {ids} is a list of |job-id|s to wait for. - {timeout} is the maximum number of milliseconds to wait. - {timeout} of zero can be used to check if a job-id is valid, - without waiting. + {timeout} is the maximum waiting time in milliseconds, -1 + means forever. + Timeout of 0 can be used to check the status of a job: > + let running = jobwait([{job-id}], 0)[0] == -1 +< During jobwait() callbacks for jobs not in the {ids} list may be invoked. The screen will not redraw unless |:redraw| is invoked by a callback. @@ -5392,6 +5450,7 @@ len({expr}) The result is a Number, which is the length of the argument. used, as with |strlen()|. When {expr} is a |List| the number of items in the |List| is returned. + When {expr} is a |Blob| the number of bytes is returned. When {expr} is a |Dictionary| the number of entries in the |Dictionary| is returned. Otherwise an error is given. @@ -5437,8 +5496,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") < @@ -5446,8 +5503,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") @@ -5476,13 +5531,6 @@ line({expr}) The result is a Number, which is the line number of the file line(".") line number of the cursor line("'t") line number of mark t line("'" . marker) line number of mark marker -< *last-position-jump* - This autocommand jumps to the last known position in a file - just after opening it, if the '" mark is set: > - :au BufReadPost * - \ if line("'\"") > 1 && line("'\"") <= line("$") && &ft !~# 'commit' - \ | exe "normal! g`\"" - \ | endif line2byte({lnum}) *line2byte()* Return the byte count from the start of the buffer for line @@ -5532,7 +5580,7 @@ log10({expr}) *log10()* luaeval({expr}[, {expr}]) Evaluate Lua expression {expr} and return its result converted - to Vim data structures. See |lua-luaeval| for more details. + to Vim data structures. See |lua-eval| for more details. map({expr1}, {expr2}) *map()* {expr1} must be a |List| or a |Dictionary|. @@ -5671,7 +5719,7 @@ match({expr}, {pat} [, {start} [, {count}]]) *match()* first item where {pat} matches. Each item is used as a String, |Lists| and |Dictionaries| are used as echoed. - Otherwise, {expr} is used as a String. The result is a + Otherwise, {expr} is used as a String. The result is a Number, which gives the index (byte offset) in {expr} where {pat} matches. @@ -5684,7 +5732,7 @@ match({expr}, {pat} [, {start} [, {count}]]) *match()* :echo match([1, 'x'], '\a') " results in 1 < See |string-match| for how {pat} is used. *strpbrk()* - Vim doesn't have a strpbrk() function. But you can do: > + Vim doesn't have a strpbrk() function. But you can do: > :let sepidx = match(line, '[.,;: \t]') < *strcasestr()* Vim doesn't have a strcasestr() function. But you can add @@ -5721,7 +5769,7 @@ match({expr}, {pat} [, {start} [, {count}]]) *match()* See |pattern| for the patterns that are accepted. The 'ignorecase' option is used to set the ignore-caseness of - the pattern. 'smartcase' is NOT used. The matching is always + the pattern. 'smartcase' is NOT used. The matching is always done like 'magic' is set and 'cpoptions' is empty. *matchadd()* *E798* *E799* *E801* *E957* @@ -5737,7 +5785,7 @@ matchadd({group}, {pattern}[, {priority}[, {id} [, {dict}]]]) concealed. The optional {priority} argument assigns a priority to the - match. A match with a high priority will have its + match. A match with a high priority will have its highlighting overrule that of a match with a lower priority. A priority is specified as an integer (negative numbers are no exception). If the {priority} argument is not specified, the @@ -5776,7 +5824,7 @@ matchadd({group}, {pattern}[, {priority}[, {id} [, {dict}]]]) :call matchdelete(m) < A list of matches defined by |matchadd()| and |:match| are - available from |getmatches()|. All matches can be deleted in + available from |getmatches()|. All matches can be deleted in one operation by |clearmatches()|. *matchaddpos()* @@ -5964,7 +6012,7 @@ mkdir({name} [, {path} [, {prot}]]) necessary. Otherwise it must be "". If {prot} is given it is used to set the protection bits of the new directory. The default is 0755 (rwxr-xr-x: r/w for - the user readable for others). Use 0700 to make it unreadable + the user readable for others). Use 0700 to make it unreadable for others. {prot} is applied for all parts of {name}. Thus if you create @@ -6245,7 +6293,7 @@ printf({fmt}, {expr1} ...) *printf()* number produced by a signed conversion (d). + A sign must always be placed before a number - produced by a signed conversion. A + overrides + produced by a signed conversion. A + overrides a space if both are used. field-width @@ -6271,7 +6319,7 @@ printf({fmt}, {expr1} ...) *printf()* A field width or precision, or both, may be indicated by an asterisk '*' instead of a digit string. In this case, a - Number argument supplies the field width or precision. A + Number argument supplies the field width or precision. A negative field width is treated as a left adjustment flag followed by a positive field width; a negative precision is treated as though it were missing. Example: > @@ -6319,8 +6367,7 @@ printf({fmt}, {expr1} ...) *printf()* *printf-S* S The text of the String argument is used. If a precision is specified, no more display cells than the - number specified are used. Without the |+multi_byte| - feature works just like 's'. + number specified are used. *printf-f* *E807* f F The Float argument is converted into a string of the @@ -6383,7 +6430,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()* @@ -6394,7 +6440,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 @@ -6452,6 +6497,17 @@ readfile({fname} [, {binary} [, {max}]]) the result is an empty list. Also see |writefile()|. + *readdir()* +readdir({directory} [, {expr}]) + Return a list with file and directory names in {directory}. + You can also use |glob()| if you don't need to do complicated + things, such as limiting the number of matches. + + When {expr} is omitted all entries are included. + When {expr} is given, it is evaluated to check what to do: + If {expr} results in -1 then no further entries will + be handled. + reg_executing() *reg_executing()* Returns the single letter name of the register being executed. Returns an empty string when no register is being executed. @@ -6505,7 +6561,7 @@ reltimestr({time}) *reltimestr()* *remote_expr()* *E449* remote_expr({server}, {string} [, {idvar} [, {timeout}]]) - Send the {string} to {server}. The string is sent as an + Send the {string} to {server}. The string is sent as an expression and the result is returned after evaluation. The result must be a String or a |List|. A |List| is turned into a String by joining the items with a line break in @@ -6517,7 +6573,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. @@ -6547,13 +6602,12 @@ remote_foreground({server}) *remote_foreground()* remote_peek({serverid} [, {retvar}]) *remote_peek()* Returns a positive number if there are available strings from {serverid}. Copies any reply string into the variable - {retvar} if specified. {retvar} must be a string with the + {retvar} if specified. {retvar} must be a string with the name of a variable. Returns zero if none are available. 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 @@ -6564,13 +6618,12 @@ 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) < *remote_send()* *E241* remote_send({server}, {string} [, {idvar}]) - Send the {string} to {server}. The string is sent as input + Send the {string} to {server}. The string is sent as input keys and the function returns immediately. At the Vim server the keys are not mapped |:map|. If {idvar} is present, it is taken as the name of a variable @@ -6578,7 +6631,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. @@ -6595,7 +6647,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 @@ -6609,7 +6660,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. @@ -6629,7 +6681,7 @@ repeat({expr}, {count}) *repeat()* :let separator = repeat('-', 80) < When {count} is zero or negative the result is empty. When {expr} is a |List| the result is {expr} concatenated - {count} times. Example: > + {count} times. Example: > :let longlist = repeat(['a', 'b'], 3) < Results in ['a', 'b', 'a', 'b', 'a', 'b']. @@ -6648,7 +6700,7 @@ resolve({filename}) *resolve()* *E655* path name) and also keeps a trailing path separator. *reverse()* -reverse({list}) Reverse the order of items in {list} in-place. Returns +reverse({list}) Reverse the order of items in {list} in-place. Returns {list}. If you want a list to remain unmodified make a copy first: > :let revlist = reverse(copy(mylist)) @@ -6684,11 +6736,6 @@ rpcstart({prog}[, {argv}]) *rpcstart()* < with > :let id = jobstart(['prog', 'arg1', 'arg2'], {'rpc': v:true}) -rpcstop({channel}) *rpcstop()* - Deprecated. Instead use |jobstop()| to stop any job, and - chanclose(id, "rpc") to close RPC communication without - stopping the job. Use chanclose(id) to close any socket. - screenattr({row}, {col}) *screenattr()* Like |screenchar()|, but return the attribute. This is a rather arbitrary number that can only be used to compare to the @@ -6767,11 +6814,10 @@ search({pattern} [, {flags} [, {stopline} [, {timeout}]]]) *search()* A zero value is equal to not giving the argument. When the {timeout} argument is given the search stops when - more than this many milliseconds have passed. Thus when + more than this many milliseconds have passed. Thus when {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 @@ -6886,7 +6932,7 @@ searchpair({start}, {middle}, {end} [, {flags} [, {skip} < When starting at the "if 2", with the cursor on the "i", and searching forwards, the "endif 2" is found. When starting on the character just before the "if 2", the "endif 1" will be - found. That's because the "if 2" will be found first, and + found. That's because the "if 2" will be found first, and then this is considered to be a nested if/endif from "if 2" to "endif 2". When searching backwards and {end} is more than one character, @@ -6947,7 +6993,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 @@ -6996,6 +7041,19 @@ serverstop({address}) *serverstop()* If |v:servername| is stopped it is set to the next available address returned by |serverlist()|. +setbufline({expr}, {lnum}, {text}) *setbufline()* + Set line {lnum} to {text} in buffer {expr}. To insert + lines use |append()|. + + For the use of {expr}, see |bufname()| above. + + {lnum} is used like with |setline()|. + This works like |setline()| for the specified buffer. + On success 0 is returned, on failure 1 is returned. + + If {expr} is not a valid buffer or {lnum} is not valid, an + error message is given. + setbufvar({expr}, {varname}, {val}) *setbufvar()* Set option or local variable {varname} in buffer {expr} to {val}. @@ -7031,7 +7089,7 @@ setcharsearch({dict}) *setcharsearch()* setcmdpos({pos}) *setcmdpos()* Set the cursor position in the command line to byte position - {pos}. The first position is 1. + {pos}. The first position is 1. Use |getcmdpos()| to obtain the current position. Only works while editing the command line, thus you must use |c_CTRL-\_e|, |c_CTRL-R_=| or |c_CTRL-R_CTRL-R| with '='. For @@ -7044,6 +7102,11 @@ setcmdpos({pos}) *setcmdpos()* Returns 0 when successful, 1 when not editing the command line. +setenv({name}, {val}) *setenv()* + Set environment variable {name} to {val}. + When {val} is |v:null| the environment variable is deleted. + See also |expr-env|. + setfperm({fname}, {mode}) *setfperm()* *chmod* Set the file permissions for {fname} to {mode}. {mode} must be a string with 9 characters. It is of the form @@ -7063,13 +7126,19 @@ setfperm({fname}, {mode}) *setfperm()* *chmod* setline({lnum}, {text}) *setline()* Set line {lnum} of the current buffer to {text}. To insert - lines use |append()|. + lines use |append()|. To set lines in another buffer use + |setbufline()|. + {lnum} is used like with |getline()|. When {lnum} is just below the last line the {text} will be added as a new line. + If this succeeds, 0 is returned. If this fails (most likely - because {lnum} is invalid) 1 is returned. Example: > + because {lnum} is invalid) 1 is returned. + + Example: > :call setline(5, strftime("%c")) + < When {text} is a |List| then line {lnum} and following lines will be set to the items in the list. Example: > :call setline(5, ['aaa', 'bbb', 'ccc']) @@ -7080,7 +7149,7 @@ setline({lnum}, {text}) *setline()* < Note: The '[ and '] marks are not set. -setloclist({nr}, {list} [, {action}[, {what}]]) *setloclist()* +setloclist({nr}, {list}[, {action}[, {what}]]) *setloclist()* Create or replace or add to the location list for window {nr}. {nr} can be the window number or the |window-ID|. When {nr} is zero the current window is used. @@ -7475,9 +7544,9 @@ sign_getplaced([{expr} [, {dict}]]) *sign_getplaced()* list of signs placed in that buffer is returned. For the use of {expr}, see |bufname()|. The optional {dict} can contain the following entries: - group select only signs in this group - id select sign with this identifier - lnum select signs placed in this line. For the use + group select only signs in this group + id select sign with this identifier + lnum select signs placed in this line. For the use of {lnum}, see |line()|. If {group} is '*', then signs in all the groups including the global group are returned. If {group} is not supplied or is an @@ -7518,11 +7587,11 @@ sign_getplaced([{expr} [, {dict}]]) *sign_getplaced()* echo sign_getplaced("eval.c", {'lnum' : 10}) " Get sign with identifier 10 placed in a.py - echo sign_getplaced("a.py", {'id' : 10'}) + echo sign_getplaced("a.py", {'id' : 10}) " Get sign with id 20 in group 'g1' placed in a.py echo sign_getplaced("a.py", {'group' : 'g1', - \ 'id' : 20'}) + \ 'id' : 20}) " Get a List of all the placed signs echo sign_getplaced() @@ -7607,7 +7676,7 @@ sign_undefine([{name}]) *sign_undefine()* < sign_unplace({group} [, {dict}]) *sign_unplace()* Remove a previously placed sign in one or more buffers. This - is similar to the |:sign-unplace()| command. + is similar to the |:sign-unplace| command. {group} is the sign group name. To use the global sign group, use an empty string. If {group} is set to '*', then all the @@ -7897,7 +7966,8 @@ str2float({expr}) *str2float()* as when using a floating point number in an expression, see |floating-point-format|. But it's a bit more permissive. E.g., "1e40" is accepted, while in an expression you need to - write "1.0e40". + write "1.0e40". The hexadecimal form "0x123" is also + accepted, but not others, like binary or octal. Text after the number is silently ignored. The decimal point is always '.', no matter what the locale is set to. A comma ends the number: "12,345.67" is converted to @@ -7953,10 +8023,10 @@ strcharpart({src}, {start} [, {len}]) *strcharpart()* strdisplaywidth({expr} [, {col}]) *strdisplaywidth()* The result is a Number, which is the number of display cells - String {expr} occupies on the screen when it starts at {col}. - When {col} is omitted zero is used. Otherwise it is the - screen column where to start. This matters for Tab - characters. + String {expr} occupies on the screen when it starts at {col} + (first column is zero). When {col} is omitted zero is used. + Otherwise it is the screen column where to start. This + matters for Tab characters. The option settings of the current window are used. This matters for anything that's displayed differently, such as 'tabstop' and 'display'. @@ -8134,7 +8204,7 @@ substitute({expr}, {pat}, {sub}, {flags}) *substitute()* A "~" in {sub} is not replaced with the previous {sub}. Note that some codes in {sub} have a special meaning - |sub-replace-special|. For example, to replace something with + |sub-replace-special|. For example, to replace something with "\n" (two characters), use "\\\\n" or '\\n'. When {pat} does not match in {expr}, {expr} is returned @@ -8155,9 +8225,9 @@ substitute({expr}, {pat}, {sub}, {flags}) *substitute()* optional argument. Example: > :echo substitute(s, '%\(\x\x\)', SubNr, 'g') < The optional argument is a list which contains the whole - matched string and up to nine submatches,like what - |submatch()| returns. Example: > - :echo substitute(s, '\(\x\x\)', {m -> '0x' . m[1]}, 'g') + matched string and up to nine submatches, like what + |submatch()| returns. Example: > + :echo substitute(s, '%\(\x\x\)', {m -> '0x' . m[1]}, 'g') swapinfo({fname}) *swapinfo()* The result is a dictionary, which holds information about the @@ -8197,7 +8267,7 @@ synID({lnum}, {col}, {trans}) *synID()* zero. When {trans} is |TRUE|, transparent items are reduced to the - item that they reveal. This is useful when wanting to know + item that they reveal. This is useful when wanting to know the effective color. When {trans} is |FALSE|, the transparent item is returned. This is useful when wanting to know which syntax item is effective (e.g. inside parens). @@ -8213,7 +8283,7 @@ synIDattr({synID}, {what} [, {mode}]) *synIDattr()* syntax ID {synID}. This can be used to obtain information about a syntax item. {mode} can be "gui", "cterm" or "term", to get the attributes - for that mode. When {mode} is omitted, or an invalid value is + for that mode. When {mode} is omitted, or an invalid value is used, the attributes for the currently active highlighting are used (GUI, cterm or term). Use synIDtrans() to follow linked highlight groups. @@ -8442,7 +8512,7 @@ taglist({expr} [, {filename}]) *taglist()* tempname() *tempname()* *temp-file-name* The result is a String, which is the name of a file that - doesn't exist. It can be used for a temporary file. Example: > + doesn't exist. It can be used for a temporary file. Example: > :let tmpfile = tempname() :exe "redir > " . tmpfile < For Unix, the file will be in a private directory |tempfile|. @@ -8534,13 +8604,10 @@ timer_start({time}, {callback} [, {options}]) waiting for input. {options} is a dictionary. Supported entries: - "repeat" Number of times to repeat calling the - callback. -1 means forever. When not present - the callback will be called once. + "repeat" Number of times to repeat the callback. + -1 means forever. Default is 1. If the timer causes an error three times in a - row the repeat is cancelled. This avoids that - Vim becomes unusable because of all the error - messages. + row the repeat is cancelled. Example: > func MyHandler(timer) @@ -8548,8 +8615,7 @@ timer_start({time}, {callback} [, {options}]) endfunc let timer = timer_start(500, 'MyHandler', \ {'repeat': 3}) -< This will invoke MyHandler() three times at 500 msec - intervals. +< This invokes MyHandler() three times at 500 msec intervals. timer_stop({timer}) *timer_stop()* Stop a timer. The timer callback will no longer be invoked. @@ -8704,7 +8770,7 @@ uniq({list} [, {func} [, {dict}]]) *uniq()* *E882* each item. For the use of {func} and {dict} see |sort()|. values({dict}) *values()* - Return a |List| with all the values of {dict}. The |List| is + Return a |List| with all the values of {dict}. The |List| is in arbitrary order. @@ -8740,7 +8806,7 @@ virtcol({expr}) *virtcol()* virtcol(".") with text "foo^Lbar", with cursor on the "^L", returns 5 virtcol("$") with text "foo^Lbar", returns 9 virtcol("'t") with text " there", with 't at 'h', returns 6 -< The first column is 1. 0 is returned for an error. +< The first column is 1. 0 is returned for an error. A more advanced example that echoes the maximum length of all lines: > echo max(map(range(1, line('$')), "virtcol([v:val, '$'])")) @@ -8784,7 +8850,7 @@ win_getid([{win} [, {tab}]]) *win_getid()* Get the |window-ID| for the specified window. When {win} is missing use the current window. With {win} this is the window number. The top window has - number 1. Use `win_getid(winnr())` for the current window. + number 1. Without {tab} use the current tab, otherwise the tab with number {tab}. The first tab has number one. Return zero if the window cannot be found. @@ -8867,7 +8933,7 @@ winlayout([{tabnr}]) *winlayout()* < *winline()* winline() The result is a Number, which is the screen line of the cursor - in the window. This is counting screen lines from the top of + in the window. This is counting screen lines from the top of the window. The first line is one. If the cursor was moved the view on the file will be updated first, this may cause a scroll. @@ -9075,9 +9141,9 @@ functions. *:fu* *:function* *E128* *E129* *E123* :fu[nction] List all functions and their arguments. -:fu[nction] {name} List function {name}. - {name} can also be a |Dictionary| entry that is a - |Funcref|: > +:fu[nction][!] {name} List function {name}, annotated with line numbers + unless "!" is given. + {name} may be a |Dictionary| |Funcref| entry: > :function dict.init :fu[nction] /{pattern} List functions with a name matching {pattern}. @@ -9110,9 +9176,9 @@ See |:verbose-cmd| for more information. {name} can also be a |Dictionary| entry that is a |Funcref|: > :function dict.init(arg) -< "dict" must be an existing dictionary. The entry +< "dict" must be an existing dictionary. The entry "init" is added if it didn't exist yet. Otherwise [!] - is required to overwrite an existing function. The + is required to overwrite an existing function. The result is a |Funcref| to a numbered function. The function can only be used with a |Funcref| and will be deleted if there are no more references to it. @@ -9141,7 +9207,7 @@ See |:verbose-cmd| for more information. abort as soon as an error is detected. *:func-dict* When the [dict] argument is added, the function must - be invoked through an entry in a |Dictionary|. The + be invoked through an entry in a |Dictionary|. The local variable "self" will then be set to the dictionary. See |Dictionary-function|. *:func-closure* *E932* @@ -9220,7 +9286,7 @@ See |:verbose-cmd| for more information. returns at the outermost ":endtry". *function-argument* *a:var* -An argument can be defined by giving its name. In the function this can then +An argument can be defined by giving its name. In the function this can then be used as "a:name" ("a:" for argument). *a:0* *a:1* *a:000* *E740* *...* Up to 20 arguments can be given, separated by commas. After the named @@ -9281,7 +9347,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 @@ -9291,7 +9357,7 @@ This function can then be called with: > itself, the function is executed for each line in the range, with the cursor in the first column of that line. The cursor is left at the last line (possibly moved by the last function - call). The arguments are re-evaluated for each line. Thus + call). The arguments are re-evaluated for each line. Thus this works: *function-range-example* > :function Mynumber(arg) @@ -9335,9 +9401,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|. -That makes Vim startup faster. The autocommand should then load the same file -again, setting a variable to skip the |:finish| command. +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. Use the FuncUndefined autocommand event with a pattern that matches the function(s) to be defined. Example: > @@ -9415,7 +9481,7 @@ name. So in the above example, if the variable "adjective" was set to "adjective" was set to "quiet", then it would be to "my_quiet_variable". One application for this is to create a set of variables governed by an option -value. For example, the statement > +value. For example, the statement > echo my_{&background}_message would output the contents of "my_dark_message" or "my_light_message" depending @@ -9461,7 +9527,7 @@ This does NOT work: > must be a valid index in that list. For nested list the index can be repeated. This cannot be used to add an item to a |List|. - This cannot be used to set a byte in a String. You + This cannot be used to set a byte in a String. You can do that like this: > :let var = var[0:2] . 'X' . var[4:] < @@ -9510,7 +9576,7 @@ This does NOT work: > that would match everywhere. :let @{reg-name} .= {expr1} - Append {expr1} to register {reg-name}. If the + Append {expr1} to register {reg-name}. If the register was empty it's like setting it to {expr1}. :let &{option-name} = {expr1} *:let-option* *:let-&* @@ -9586,7 +9652,7 @@ This does NOT work: > |List| item. *E121* -:let {var-name} .. List the value of variable {var-name}. Multiple +:let {var-name} .. List the value of variable {var-name}. Multiple variable names may be given. Special names recognized here: *E738* g: global variables @@ -9628,7 +9694,34 @@ This does NOT work: > No error message is given for a non-existing variable, also without !. If the system does not support deleting an environment - variable, it is made emtpy. + variable, it is made empty. + + *:cons* *:const* +:cons[t] {var-name} = {expr1} +:cons[t] [{name1}, {name2}, ...] = {expr1} +:cons[t] [{name}, ..., ; {lastname}] = {expr1} + Similar to |:let|, but additionally lock the variable + after setting the value. This is the same as locking + the variable with |:lockvar| just after |:let|, thus: > + :const x = 1 +< is equivalent to: > + :let x = 1 + :lockvar 1 x +< This is useful if you want to make sure the variable + is not modified. + *E995* + |:const| does not allow to for changing a variable. > + :let x = 1 + :const x = 2 " Error! +< *E996* + Note that environment variables, option values and + 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 @@ -9681,7 +9774,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. @@ -9746,7 +9839,7 @@ This does NOT work: > :for item in copy(mylist) < When not making a copy, Vim stores a reference to the next item in the list, before executing the commands - with the current item. Thus the current item can be + with the current item. Thus the current item can be removed without effect. Removing any later item means it will not be found. Thus the following example works (an inefficient way to make a list empty): > @@ -9965,7 +10058,7 @@ This does NOT work: > message in the |message-history|. When used in a script or function the line number will be added. Spaces are placed between the arguments as with the - :echo command. When used inside a try conditional, + :echo command. When used inside a try conditional, the message is raised as an error exception instead (see |try-echoerr|). Example: > @@ -10094,14 +10187,14 @@ the finally clause. It is resumed at the ":endtry", so that commands after the ":endtry" are not executed and the exception might be caught elsewhere, see |try-nesting|. When during execution of a catch clause another exception is thrown, the -remaining lines in that catch clause are not executed. The new exception is +remaining lines in that catch clause are not executed. The new exception is not matched against the patterns in any of the ":catch" commands of the same try conditional and none of its catch clauses is taken. If there is, however, a finally clause, it is executed, and the exception pends during its execution. The commands following the ":endtry" are not executed. The new exception might, however, be caught elsewhere, see |try-nesting|. When during execution of the finally clause (if present) an exception is -thrown, the remaining lines in the finally clause are skipped. If the finally +thrown, the remaining lines in the finally clause are skipped. If the finally clause has been taken because of an exception from the try block or one of the catch clauses, the original (pending) exception is discarded. The commands following the ":endtry" are not executed, and the exception from the finally @@ -10135,7 +10228,7 @@ catch an exception thrown in its try block or throws a new exception from one of its catch clauses or its finally clause, the outer try conditional is checked according to the rules above. If the inner try conditional is in the try block of the outer try conditional, its catch clauses are checked, but -otherwise only the finally clause is executed. It does not matter for +otherwise only the finally clause is executed. It does not matter for nesting, whether the inner try conditional is directly contained in the outer one, or whether the outer one sources a script or calls a function containing the inner try conditional. @@ -10198,7 +10291,7 @@ executed. > however displays "in Bar" and throws 4711. Any other command that takes an expression as argument might also be -abandoned by an (uncaught) exception during the expression evaluation. The +abandoned by an (uncaught) exception during the expression evaluation. The exception is then propagated to the caller of the command. Example: > @@ -10382,13 +10475,13 @@ CLEANUP CODE *try-finally* Scripts often change global settings and restore them at their end. If the user however interrupts the script by pressing CTRL-C, the settings remain in -an inconsistent state. The same may happen to you in the development phase of +an inconsistent state. The same may happen to you in the development phase of a script when an error occurs or you explicitly throw an exception without catching it. You can solve these problems by using a try conditional with a finally clause for restoring the settings. Its execution is guaranteed on normal control flow, on error, on an explicit ":throw", and on interrupt. (Note that errors and interrupts from inside the try conditional are converted -to exceptions. When not caught, they terminate the script after the finally +to exceptions. When not caught, they terminate the script after the finally clause has been executed.) Example: > @@ -10446,7 +10539,7 @@ This displays "first", "cleanup", "second", "cleanup", and "end". > :echo Foo() "returned by Foo" This displays "cleanup" and "4711 returned by Foo". You don't need to add an -extra ":return" in the finally clause. (Above all, this would override the +extra ":return" in the finally clause. (Above all, this would override the return value.) *except-from-finally* @@ -10490,7 +10583,7 @@ or > Vim:{errmsg} {cmdname} is the name of the command that failed; the second form is used when -the command name is not known. {errmsg} is the error message usually produced +the command name is not known. {errmsg} is the error message usually produced when the error occurs outside try conditionals. It always begins with a capital "E", followed by a two or three-digit error number, a colon, and a space. @@ -10595,7 +10688,7 @@ This works also when a try conditional is active. CATCHING INTERRUPTS *catch-interrupt* When there are active try conditionals, an interrupt (CTRL-C) is converted to -the exception "Vim:Interrupt". You can catch it like every exception. The +the exception "Vim:Interrupt". You can catch it like every exception. The script is not terminated, then. Example: > @@ -10629,7 +10722,7 @@ script is not terminated, then. :endwhile You can interrupt a task here by pressing CTRL-C; the script then asks for -a new command. If you press CTRL-C at the prompt, the script is terminated. +a new command. If you press CTRL-C at the prompt, the script is terminated. For testing what happens when CTRL-C would be pressed on a specific line in your script, use the debug mode and execute the |>quit| or |>interrupt| @@ -10786,7 +10879,7 @@ For some commands, the normal action can be replaced by a sequence of autocommands. Exceptions from that sequence will be catchable by the caller of the command. Example: For the ":write" command, the caller cannot know whether the file -had actually been written when the exception occurred. You need to tell it in +had actually been written when the exception occurred. You need to tell it in some way. > :if !exists("cnt") @@ -10934,8 +11027,8 @@ or ":endif". On the other hand, errors should be catchable as exceptions This problem has been solved by converting errors to exceptions and using immediate abortion (if not suppressed by ":silent!") only when a try -conditional is active. This is no restriction since an (error) exception can -be caught only from an active try conditional. If you want an immediate +conditional is active. This is no restriction since an (error) exception can +be caught only from an active try conditional. If you want an immediate termination without catching the error, just use a try conditional without catch clause. (You can cause cleanup code being executed before termination by specifying a finally clause.) @@ -10950,8 +11043,8 @@ conditional of a new script, you might change the control flow of the existing script on error. You get the immediate abortion on error and can catch the error in the new script. If however the sourced script suppresses error messages by using the ":silent!" command (checking for errors by testing -|v:errmsg| if appropriate), its execution path is not changed. The error is -not converted to an exception. (See |:silent|.) So the only remaining cause +|v:errmsg| if appropriate), its execution path is not changed. The error is +not converted to an exception. (See |:silent|.) So the only remaining cause where this happens is for scripts that don't care about errors and produce error messages. You probably won't want to use such code from your new scripts. diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index a4a5d6188b..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 @@ -599,6 +609,15 @@ your |vimrc|: > let rrst_dynamic_comments = 0 +RESTRUCTUREDTEXT *ft-rst-plugin* + +The following formatting setting are optionally available: > + setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=8 + +To enable this behavior, set the following variable in your vimrc: > + let g:rst_style = 1 + + RPM SPEC *ft-spec-plugin* Since the text for this plugin is rather long it has been put in a separate 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/help.txt b/runtime/doc/help.txt index 7fcf08e2a1..68e94ef5c5 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -9,7 +9,7 @@ Close this window: Use ":q<Enter>". Jump to a subject: Position the cursor on a tag (e.g. |bars|) and hit CTRL-]. With the mouse: Double-click the left mouse button on a tag, e.g. |bars|. - Jump back: Type CTRL-T or CTRL-O. Repeat to go further back. + Jump back: Type CTRL-O. Repeat to go further back. Get specific help: It is possible to go directly to whatever you want help on, by giving an argument to the |:help| command. @@ -30,13 +30,17 @@ Get specific help: It is possible to go directly to whatever you want help help entries for "word". Or use ":helpgrep word". |:helpgrep| + Getting started: Do the Vim tutor, a 20 minute interactive training for the + basic commands, see |vimtutor|. + Read the user manual from start to end: |usr_01.txt| + Vim stands for Vi IMproved. Most of Vim was made by Bram Moolenaar, but only through the help of many others. See |credits|. ------------------------------------------------------------------------------ *doc-file-list* *Q_ct* BASIC: |quickref| Overview of the most common commands you will use -|tutor| 30 minutes training course for beginners +|tutor| 20 minutes training course for beginners |copying| About copyrights |iccf| Helping poor children in Uganda |sponsor| Sponsor Vim development, become a registered Vim user @@ -106,7 +110,6 @@ Basic editing ~ |scroll.txt| scrolling the text in the window |insert.txt| Insert and Replace mode |change.txt| deleting and replacing text -|indent.txt| automatic indenting for C and other languages |undo.txt| Undo and Redo |repeat.txt| repeating commands, Vim scripts and debugging |visual.txt| using the Visual mode (selecting a text area) @@ -119,30 +122,36 @@ Advanced editing ~ |pattern.txt| regexp patterns and search commands |map.txt| key mapping and abbreviations |tagsrch.txt| tags and special searches -|quickfix.txt| commands for a quick edit-compile-fix cycle |windows.txt| commands for using multiple windows and buffers |tabpage.txt| commands for using multiple tab pages -|syntax.txt| syntax highlighting |spell.txt| spell checking |diff.txt| working with two to four versions of the same file |autocmd.txt| automatically executing commands on an event -|filetype.txt| settings done specifically for a type of file |eval.txt| expression evaluation, conditional commands |fold.txt| hide (fold) ranges of lines Special issues ~ |print.txt| printing |remote.txt| using Vim as a server or client + +Programming language support ~ +|indent.txt| automatic indenting for C and other languages +|syntax.txt| syntax highlighting +|textprop.txt| Attaching properties to text for highlighting or other +|filetype.txt| settings done specifically for a type of file +|quickfix.txt| commands for a quick edit-compile-fix cycle +|ft_ada.txt| Ada (the programming language) support +|ft_rust.txt| Filetype plugin for Rust +|ft_sql.txt| about the SQL filetype plugin + +Language support ~ |digraph.txt| list of available digraphs |mbyte.txt| multi-byte text support |mlang.txt| non-English language support +|rileft.txt| right-to-left editing mode |arabic.txt| Arabic language support and editing |hebrew.txt| Hebrew language support and editing |russian.txt| Russian language support and editing -|ft_ada.txt| Ada (the programming language) support -|ft_rust.txt| Filetype plugin for Rust -|ft_sql.txt| about the SQL filetype plugin -|rileft.txt| right-to-left editing mode GUI ~ |gui.txt| Graphical User Interface (GUI) diff --git a/runtime/doc/if_lua.txt b/runtime/doc/if_lua.txt index 8ee5718349..a9b8c5fae8 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: > @@ -258,8 +258,7 @@ position are restricted when the command is executed in the |sandbox|. ============================================================================== -luaeval() *lua-luaeval* *lua-eval* - *luaeval()* +luaeval() *lua-eval* *luaeval()* The (dual) equivalent of "vim.eval" for passing Lua values to Nvim is "luaeval". "luaeval" takes an expression string and an optional argument used @@ -366,46 +365,151 @@ VIM.API *lua-api* `vim.api` exposes the full Nvim |API| as a table of Lua functions. -For example, to use the "nvim_get_current_line()" API function, call +Example: to use the "nvim_get_current_line()" API function, call "vim.api.nvim_get_current_line()": > print(tostring(vim.api.nvim_get_current_line())) ------------------------------------------------------------------------------ -VIM *lua-util* +VIM.LOOP *lua-loop* + +`vim.loop` exposes all features of the Nvim event-loop. This is a lower-level +API that provides functionality for networking, filesystem, and process +management. Try this command to see available functions: > + + :lua print(vim.inspect(vim.loop)) + +See http://docs.libuv.org for complete documentation. +See https://github.com/luvit/luv/tree/master/examples for examples. + + *E5560* *lua-loop-callbacks* +Note: it is not allowed to directly invoke most of the Nvim API from `vim.loop` +callbacks. This will result in an error: > + + local timer = vim.loop.new_timer() + timer:start(1000, 0, function() + vim.api.nvim_command('echomsg "test"') + end) + +The `vim.schedule_wrap` helper can be used to defer the callback until it +is safe to execute API methods. > + + local timer = vim.loop.new_timer() + timer:start(1000, 0, vim.schedule_wrap(function() + vim.api.nvim_command('echomsg "test"') + end)) -vim.stricmp(a, b) *lua-vim.stricmp* - Function used for case-insensitive string comparison. Takes two - string arguments and returns 0, 1 or -1 if strings are equal, a is - greater then b or a is lesser then b respectively. +A subset of the API is available in direct luv callbacks ("fast" callbacks), +most notably |nvim_get_mode()| and |nvim_input()|. It is possible to +check whether code is running in this context using |vim.in_fast_event()|. -vim.schedule(callback) *lua-vim.schedule* - Schedule `callback` to be called soon by the main event loop. This is - useful in contexts where some functionality is blocked, like an - autocommand or callback running with |textlock|. Then the scheduled - callback could invoke this functionality later when it is allowed. -vim.type_idx *lua-vim.type_idx* +Example: repeating timer + 1. Save this code to a file. + 2. Execute it with ":luafile %". > + + -- Create a timer handle (implementation detail: uv_timer_t). + local timer = vim.loop.new_timer() + local i = 0 + -- Waits 1000ms, then repeats every 750ms until timer:close(). + timer:start(1000, 750, function() + print('timer invoked! i='..tostring(i)) + if i > 4 then + timer:close() -- Always close handles to avoid leaks. + end + i = i + 1 + end) + print('sleeping'); + + +Example: TCP echo-server *tcp-server* + 1. Save this code to a file. + 2. Execute it with ":luafile %". + 3. Note the port number. + 4. Connect from any TCP client (e.g. "nc 0.0.0.0 36795"): > + + local function create_server(host, port, on_connection) + local server = vim.loop.new_tcp() + server:bind(host, port) + server:listen(128, function(err) + assert(not err, err) -- Check for errors. + local sock = vim.loop.new_tcp() + server:accept(sock) -- Accept client connection. + on_connection(sock) -- Start reading messages. + end) + return server + end + local server = create_server('0.0.0.0', 0, function(sock) + sock:read_start(function(err, chunk) + assert(not err, err) -- Check for errors. + if chunk then + sock:write(chunk) -- Echo received messages to the channel. + else -- EOF (stream closed). + sock:close() -- Always close handles to avoid leaks. + end + end) + end) + print('TCP echo-server listening on port: '..server:getsockname().port) + +------------------------------------------------------------------------------ +VIM *lua-util* + +vim.stricmp({a}, {b}) *vim.stricmp()* + Compares strings case-insensitively. Returns 0, 1 or -1 if strings + are equal, {a} is greater than {b} or {a} is lesser than {b}, + respectively. + +vim.str_utfindex({str}[, {index}]) *vim.str_utfindex()* + Convert byte index to UTF-32 and UTF-16 indicies. If {index} is not + supplied, the length of the string is used. All indicies are zero-based. + Returns two values: the UTF-32 and UTF-16 indicies respectively. + + Embedded NUL bytes are treated as terminating the string. Invalid + UTF-8 bytes, and embedded surrogates are counted as one code + point each. An {index} in the middle of a UTF-8 sequence is rounded + upwards to the end of that sequence. + +vim.str_byteindex({str}, {index}[, {use_utf16}]) *vim.str_byteindex()* + Convert UTF-32 or UTF-16 {index} to byte index. If {use_utf16} is not + supplied, it defaults to false (use UTF-32). Returns the byte index. + + Invalid UTF-8 and NUL is treated like by |vim.str_byteindex()|. An {index} + in the middle of a UTF-16 sequence is rounded upwards to the end of that + sequence. + +vim.schedule({callback}) *vim.schedule()* + Schedules {callback} to be invoked soon by the main event-loop. Useful + to avoid |textlock| or other temporary restrictions. + +vim.in_fast_event() *vim.in_fast_event()* + Returns true if the code is executing as part of a "fast" event + handler, where most of the API is disabled. These are low-level event + such as luv callbacks |lua-loop-callbacks|, which can be invoked at + any time nvim polls for input. When this returns `false` most API + functions are callable, but can be subjected to other restrictions, + such as |textlock|. + +vim.type_idx *vim.type_idx* Type index for use in |lua-special-tbl|. Specifying one of the - values from |lua-vim.types| allows typing the empty table (it is + values from |vim.types| allows typing the empty table (it is unclear whether empty lua table represents empty list or empty array) and forcing integral numbers to be |Float|. See |lua-special-tbl| for more details. -vim.val_idx *lua-vim.val_idx* +vim.val_idx *vim.val_idx* Value index for tables representing |Float|s. A table representing floating-point value 1.0 looks like this: > { [vim.type_idx] = vim.types.float, [vim.val_idx] = 1.0, } -< See also |lua-vim.type_idx| and |lua-special-tbl|. +< See also |vim.type_idx| and |lua-special-tbl|. -vim.types *lua-vim.types* - Table with possible values for |lua-vim.type_idx|. Contains two sets - of key-value pairs: first maps possible values for |lua-vim.type_idx| +vim.types *vim.types* + Table with possible values for |vim.type_idx|. Contains two sets + of key-value pairs: first maps possible values for |vim.type_idx| to human-readable strings, second maps human-readable type names to - values for |lua-vim.type_idx|. Currently contains pairs for `float`, + values for |vim.type_idx|. Currently contains pairs for `float`, `array` and `dictionary` types. Note: one must expect that values corresponding to `vim.types.float`, 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 6820b9c240..a99d84e969 100644 --- a/runtime/doc/indent.txt +++ b/runtime/doc/indent.txt @@ -585,8 +585,9 @@ The basics for using flexible indenting are explained in section |30.3| of the user manual. If you want to write your own indent file, it must set the 'indentexpr' -option. Setting the 'indentkeys' option is often useful. See the -$VIMRUNTIME/indent directory for examples. +option. Setting the 'indentkeys' option is often useful. +See the $VIMRUNTIME/indent/README.txt file for hints. +See the $VIMRUNTIME/indent directory for examples. REMARKS ABOUT SPECIFIC INDENT FILES ~ @@ -599,14 +600,14 @@ the use of square and curly brackets, and otherwise by community convention. These conventions are not universally followed, so the Clojure indent script offers a few configurable options, listed below. -If the current vim does not include searchpairpos(), the indent script falls +If the current vim does not include |searchpairpos()|, the indent script falls back to normal 'lisp' indenting, and the following options are ignored. *g:clojure_maxlines* -Set maximum scan distance of searchpairpos(). Larger values trade performance -for correctness when dealing with very long forms. A value of 0 will scan -without limits. +Set maximum scan distance of |searchpairpos()|. Larger values trade +performance for correctness when dealing with very long forms. A value of 0 +will scan without limits. > " Default let g:clojure_maxlines = 100 @@ -826,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 @@ -896,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 @@ -923,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* @@ -932,17 +968,22 @@ given are the defaults. Note that the variables are set to an expression, so that you can change the value of 'shiftwidth' later. Indent after an open paren: > - let g:pyindent_open_paren = '&sw * 2' + let g:pyindent_open_paren = 'shiftwidth() * 2' Indent after a nested paren: > - let g:pyindent_nested_paren = '&sw' + let g:pyindent_nested_paren = 'shiftwidth()' Indent for a continuation line: > - let g:pyindent_continue = '&sw * 2' + let g:pyindent_continue = 'shiftwidth() * 2' -The method uses searchpair() to look back for unclosed parenthesis. This can -sometimes be slow, thus it timeouts after 150 msec. If you notice the +The method uses |searchpair()| to look back for unclosed parenthesis. This +can sometimes be slow, thus it timeouts after 150 msec. If you notice the indenting isn't correct, you can set a larger timeout in msec: > let g:pyindent_searchpair_timeout = 500 +If looking back for unclosed parenthesis is still too slow, especially during +a copy-paste operation, or if you don't need indenting inside multi-line +parentheses, you can completely disable this feature: > + let g:pyindent_disable_parentheses_indenting = 1 + R *ft-r-indent* @@ -1035,7 +1076,7 @@ Furthermore, setting the variable b:verilog_indent_width to change the indenting width (default is 'shiftwidth'): > let b:verilog_indent_width = 4 - let b:verilog_indent_width = &sw * 2 + let b:verilog_indent_width = shiftwidth() * 2 In addition, you can turn the verbose mode for debug issue: > @@ -1158,7 +1199,7 @@ VIM *ft-vim-indent* For indenting Vim scripts there is one variable that specifies the amount of indent for a continuation line, a line that starts with a backslash: > - :let g:vim_indent_cont = &sw * 3 + :let g:vim_indent_cont = shiftwidth() * 3 Three times shiftwidth is the default value. diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index 765f8ce3a1..47c789713c 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -153,7 +153,20 @@ 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|) + +|complete_CTRL-E| CTRL-E stop completion and go back to original text +|complete_CTRL-Y| CTRL-Y accept selected match and stop completion + CTRL-L insert one character from the current match + <CR> insert currently selected match + <BS> delete one character and redo search + CTRL-H same as <BS> + <Up> select the previous match + <Down> select the next match + <PageUp> select a match several entries back + <PageDown> select a match several entries forward + other stop completion and insert the typed character ============================================================================== 2. Normal mode *normal-index* @@ -555,6 +568,8 @@ tag command action in Normal mode ~ |CTRL-W_gF| CTRL-W g F edit file name under the cursor in a new tab page and jump to the line number following the file name. +|CTRL-W_gt| CTRL-W g t same as `gt`: go to next tab page +|CTRL-W_gT| CTRL-W g T same as `gT`: go to previous tab page |CTRL-W_h| CTRL-W h go to Nth left window (stop at first window) |CTRL-W_i| CTRL-W i split window and jump to declaration of identifier under the cursor @@ -840,6 +855,17 @@ tag char note action in Normal mode ~ |z<Right>| z<Right> same as "zl" ============================================================================== +2.6 Operator-pending mode *operator-pending-index* + +These can be used after an operator, but before a {motion} has been entered. + +tag char action in Operator-pending mode ~ +----------------------------------------------------------------------- +|o_v| v force operator to work characterwise +|o_V| V force operator to work linewise +|o_CTRL-V| CTRL-V force operator to work blockwise + +============================================================================== 3. Visual mode *visual-index* Most commands in Visual mode are the same as in Normal mode. The ones listed @@ -961,7 +987,7 @@ Normal characters are inserted at the current cursor position. "Completion" below refers to context-sensitive completion. It will complete file names, tags, commands etc. as appropriate. -tag command action in Command-line editing mode ~ +tag command action in Command-line editing mode ~ ------------------------------------------------------------------------------ CTRL-@ not used |c_CTRL-A| CTRL-A do completion on the pattern in front of the @@ -1001,10 +1027,11 @@ tag command action in Command-line editing mode ~ command-line from history. |c_CTRL-Q| CTRL-Q same as CTRL-V, unless it's used for terminal control flow -|c_CTRL-R| CTRL-R {0-9a-z"%#*:= CTRL-F CTRL-P CTRL-W CTRL-A} +|c_CTRL-R| CTRL-R {regname} insert the contents of a register or object under the cursor as if typed -|c_CTRL-R_CTRL-R| CTRL-R CTRL-R {0-9a-z"%#*:= CTRL-F CTRL-P CTRL-W CTRL-A} +|c_CTRL-R_CTRL-R| CTRL-R CTRL-R {regname} +|c_CTRL-R_CTRL-O| CTRL-R CTRL-O {regname} insert the contents of a register or object under the cursor literally CTRL-S (used for terminal control flow) @@ -1060,7 +1087,7 @@ This is a brief but complete listing of all the ":" commands, without mentioning any arguments. The optional part of the command name is inside []. The commands are sorted on the non-optional part of their name. -tag command action ~ +tag command action ~ ------------------------------------------------------------------------------ |:!| :! filter lines or execute an external command |:!!| :!! repeat last ":!" command @@ -1167,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 @@ -1429,8 +1457,9 @@ tag command action ~ |:recover| :rec[over] recover a file from a swap file |:redo| :red[o] redo one undone change |:redir| :redi[r] redirect messages to a file or register -|:redraw| :redr[aw] force a redraw of the display -|:redrawstatus| :redraws[tatus] force a redraw of the status line(s) +|:redraw| :redr[aw] force a redraw of the display +|:redrawstatus| :redraws[tatus] force a redraw of the status line(s) +|:redrawtabline| :redrawt[abline] force a redraw of the tabline |:registers| :reg[isters] display the contents of registers |:resize| :res[ize] change current window height |:retab| :ret[ab] change tab size @@ -1467,7 +1496,8 @@ tag command action ~ |:sbrewind| :sbr[ewind] split window and go to first file in the buffer list |:scriptnames| :scr[iptnames] list names of all sourced Vim scripts -|:scriptencoding| :scripte[ncoding] encoding used in sourced Vim script +|:scriptencoding| :scripte[ncoding] encoding used in sourced Vim script +|:scriptversion| :scriptv[ersion] version of Vim script used |:scscope| :scs[cope] split window and execute cscope command |:set| :se[t] show or set options |:setfiletype| :setf[iletype] set 'filetype', unless it was set already diff --git a/runtime/doc/job_control.txt b/runtime/doc/job_control.txt index e5cd765e83..ae208c0755 100644 --- a/runtime/doc/job_control.txt +++ b/runtime/doc/job_control.txt @@ -67,7 +67,7 @@ For |on_stdout| and |on_stderr| see |channel-callback|. *on_exit* Arguments passed to on_exit callback: 0: |job-id| - 1: Exit-code of the process. + 1: Exit-code of the process, or 128+SIGNUM if by signal (e.g. 143 on SIGTERM). 2: Event type: "exit" diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index eac42df791..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 @@ -438,6 +438,7 @@ When listing mappings the characters in the first two columns are: i Insert l ":lmap" mappings for Insert, Command-line and Lang-Arg c Command-line + t Terminal-Job Just before the {rhs} a special character can appear: * indicates that it is not remappable @@ -536,9 +537,9 @@ scenario: > :imap <M-C> foo :set encoding=utf-8 The mapping for <M-C> is defined with the latin1 encoding, resulting in a 0xc3 -byte. If you type the character á (0xe1 <M-a>) in UTF-8 encoding this is the +byte. If you type the character á (0xe1 <M-a>) in UTF-8 encoding this is the two bytes 0xc3 0xa1. You don't want the 0xc3 byte to be mapped then or -otherwise it would be impossible to type the á character. +otherwise it would be impossible to type the á character. *<Leader>* *mapleader* To define a mapping which uses the "mapleader" variable, the special string @@ -789,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>: > @@ -971,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. @@ -1189,7 +1188,7 @@ reported if any are supplied). However, it is possible to specify that the command can take arguments, using the -nargs attribute. Valid cases are: -nargs=0 No arguments are allowed (the default) - -nargs=1 Exactly one argument is required, it includes spaces + -nargs=1 Exactly one argument is required, it includes spaces -nargs=* Any number of arguments are allowed (0, 1, or many), separated by white space -nargs=? 0 or 1 arguments are allowed @@ -1212,8 +1211,9 @@ defined, not where it is invoked! Example: Executing script2.vim will result in "None" being echoed. Not what you intended! Calling a function may be an alternative. -Completion behavior *:command-completion* *E179* - *E180* *E181* *:command-complete* +Completion behavior ~ + *:command-completion* *E179* *E180* *E181* + *:command-complete* By default, the arguments of user defined commands do not undergo completion. However, by specifying one or the other of the following attributes, argument completion can be enabled: @@ -1334,12 +1334,13 @@ which by default correspond to the current line, last line and the whole buffer, relate to arguments, (loaded) buffers, windows or tab pages. Possible values are: - -addr=lines Range of lines (this is the default) - -addr=arguments Range for arguments - -addr=buffers Range for buffers (also not loaded buffers) - -addr=loaded_buffers Range for loaded buffers - -addr=windows Range for windows - -addr=tabs Range for tab pages + -addr=lines Range of lines (this is the default) + -addr=arguments Range for arguments + -addr=buffers Range for buffers (also not loaded buffers) + -addr=loaded_buffers Range for loaded buffers + -addr=windows Range for windows + -addr=tabs Range for tab pages + -addr=other other kind of range Special cases *:command-bang* *:command-bar* 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 205db12f3b..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 @@ -534,14 +537,6 @@ This message is only given when Vim detects a problem when searching for a tag. Sometimes this message is not given, even though the tags file is not properly sorted. - *E460* > - The resource fork would be lost (add ! to override) - -On the Macintosh (classic), when writing a file, Vim attempts to preserve all -info about a file, including its resource fork. If this is not possible you -get this error message. Append "!" to the command name to write anyway (and -lose the info). - *E424* > Too many different highlighting attributes in use @@ -678,11 +673,13 @@ being disabled. Remove the 'C' flag from the 'cpoptions' option to enable it. This happens when an Ex command with mandatory argument(s) was executed, but no argument has been specified. - *E474* *E475* > + *E474* *E475* *E983* > Invalid argument Invalid argument: {arg} + Duplicate argument: {arg} -An Ex command has been executed, but an invalid argument has been specified. +An Ex command or function has been executed, but an invalid argument has been +specified. *E488* > Trailing characters diff --git a/runtime/doc/mlang.txt b/runtime/doc/mlang.txt index a19d9fd2f4..03c48b962d 100644 --- a/runtime/doc/mlang.txt +++ b/runtime/doc/mlang.txt @@ -95,8 +95,10 @@ Or: This also contains tools xgettext, msgformat and others. -libintl.dll should be placed in same directory with (g)vim.exe, or some -place where PATH environment value describe. Vim also finds libintl-8.dll. +libintl.dll should be placed in same directory as (g)vim.exe, or one of the +directories listed in the PATH environment value. Vim also looks for the +alternate names "libintl-8.dll" and "intl.dll". + Message files (vim.mo) have to be placed in "$VIMRUNTIME/lang/xx/LC_MESSAGES", where "xx" is the abbreviation of the language (mostly two letters). diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index d5a123e3ea..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 @@ -107,7 +108,7 @@ This cannot be repeated: > endif<CR> Note that when using ":" any motion becomes characterwise exclusive. - + *forced-motion* FORCING A MOTION TO BE LINEWISE, CHARACTERWISE OR BLOCKWISE When a motion is not of the type you would like to use, you can force another @@ -310,7 +311,7 @@ _ <underscore> [count] - 1 lines downward, on the first non-blank G Goto line [count], default last line, on the first non-blank character |linewise|. If 'startofline' not set, keep the same column. - G is a one of |jump-motions|. + G is one of the |jump-motions|. *<C-End>* <C-End> Goto line [count], default last line, on the last @@ -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 @@ -989,11 +990,11 @@ These commands are not marks themselves, but jump to a mark: A "jump" is a command that normally moves the cursor several lines away. If you make the cursor "jump" the position of the cursor before the jump is -remembered. You can return to that position with the "''" and "``" command, +remembered. You can return to that position with the "''" and "``" commands, unless the line containing that position was changed or deleted. The following commands are "jump" commands: "'", "`", "G", "/", "?", "n", "N", "%", "(", ")", "[[", "]]", "{", "}", ":s", ":tag", "L", "M", "H" and the -commands that start editing a new file. +commands that start editing a new file. *CTRL-O* CTRL-O Go to [count] Older cursor position in jump list diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt index aba0571dc0..d1831a8de6 100644 --- a/runtime/doc/nvim_terminal_emulator.txt +++ b/runtime/doc/nvim_terminal_emulator.txt @@ -117,21 +117,22 @@ higher precedence: it is applied after terminal colors are resolved. ============================================================================== Status Variables *terminal-status* -Terminal buffers maintain some information about the terminal in buffer-local -variables: +Terminal buffers maintain some buffer-local variables and options. The values +are initialized before TermOpen, so you can use them in a local 'statusline'. +Example: > + :autocmd TermOpen * setlocal statusline=%{b:term_title} -- *b:term_title* The settable title of the terminal, typically displayed in - the window title or tab title of a graphical terminal emulator. Programs - running in the terminal can set this title via an escape sequence. -- |'channel'| The nvim channel ID for the underlying PTY. - |chansend()| can be used to send input to the terminal. +- *b:term_title* Terminal title (user-writable), typically displayed in the + window title or tab title of a graphical terminal emulator. Terminal + programs can set this by emitting an escape sequence. +- |'channel'| Terminal PTY |job-id|. Can be used with |chansend()| to send + input to the terminal. + +Use |jobwait()| to check if the terminal job has finished: > + let running = jobwait([&channel], 0)[0] == -1 -These variables are initialized before TermOpen, so you can use them in -a local 'statusline'. Example: > - :autocmd TermOpen * setlocal statusline=%{b:term_title} -< ============================================================================== -5. Debugging *terminal-debug* *terminal-debugger* +:Termdebug plugin *terminal-debug* The Terminal debugging plugin can be used to debug a program with gdb and view the source code in a Vim window. Since this is completely contained inside diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index e780dba53c..6fcead0894 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -295,12 +295,12 @@ files. You use this command: > :setlocal makeprg=perlmake You can switch back to using the global value by making the local value empty: > :setlocal makeprg= -This only works for a string option. For a boolean option you need to use the -"<" flag, like this: > +This only works for a string option. For a number or boolean option you need +to use the "<" flag, like this: > :setlocal autoread< -Note that for non-boolean options using "<" copies the global value to the -local value, it doesn't switch back to using the global value (that matters -when the global value changes later). You can also use: > +Note that for non-boolean and non-number options using "<" copies the global +value to the local value, it doesn't switch back to using the global value +(that matters when the global value changes later). You can also use: > :set path< This will make the local value of 'path' empty, so that the global value is used. Thus it does the same as: > @@ -324,9 +324,9 @@ Setting the filetype When the optional FALLBACK argument is present, a later :setfiletype command will override the - 'filetype'. This is to used for filetype detections - that are just a guess. |did_filetype()| will return - false after this command. + 'filetype'. This is to be used for filetype + detections that are just a guess. |did_filetype()| + will return false after this command. *option-window* *optwin* :bro[wse] se[t] *:set-browse* *:browse-set* *:opt* *:options* @@ -478,14 +478,17 @@ backslash in front of the ':' will be removed. Example: /* vi:set dir=c\:\tmp: */ ~ This sets the 'dir' option to "c:\tmp". Only a single backslash before the ':' is removed. Thus to include "\:" you have to specify "\\:". - + *E992* No other commands than "set" are supported, for security reasons (somebody might create a Trojan horse text file with modelines). And not all options -can be set. For some options a flag is set, so that when it's used the -|sandbox| is effective. Still, there is always a small risk that a modeline -causes trouble. E.g., when some joker sets 'textwidth' to 5 all your lines -are wrapped unexpectedly. So disable modelines before editing untrusted text. -The mail ftplugin does this, for example. +can be set. For some options a flag is set, so that when the value is used +the |sandbox| is effective. Some options can only be set from the modeline +when 'modelineexpr' is set (the default is off). + +Still, there is always a small risk that a modeline causes trouble. E.g., +when some joker sets 'textwidth' to 5 all your lines are wrapped unexpectedly. +So disable modelines before editing untrusted text. The mail ftplugin does +this, for example. Hint: If you would like to do something else than setting an option, you could define an autocommand that checks the file for a specific string. For @@ -874,7 +877,9 @@ A jump table for the options with a short description can be found at |Q_op|. < Use 'backupdir' to put the backup in a different directory. *'backupskip'* *'bsk'* -'backupskip' 'bsk' string (default: "/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*") +'backupskip' 'bsk' string (default: "$TMPDIR/*,$TMP/*,$TEMP/*" + Unix: "/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*" + Mac: "/private/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*") global A list of file patterns. When one of the patterns matches with the name of the file which is written, no backup file is created. Both @@ -1656,7 +1661,10 @@ A jump table for the options with a short description can be found at |Q_op|. deleted only once. Also when repeating "R" with "." and a count. *cpo-y* - y A yank command can be redone with ".". + y A yank command can be redone with ".". Think twice if + you really want to use this, it may break some + plugins, since most people expect "." to only repeat a + change. *cpo-Z* Z When using "w!" while the 'readonly' option is set, don't reset 'readonly'. @@ -1802,7 +1810,16 @@ A jump table for the options with a short description can be found at |Q_op|. The default value is for C programs. For C++ this value would be useful, to include const type declarations: > ^\(#\s*define\|[a-z]*\s*const\s*[a-z]*\) +< You can also use "\ze" just before the name and continue the pattern + to check what is following. E.g. for Javascript, if a function is + defined with "func_name = function(args)": > + ^\s*\ze\i\+\s*=\s*function( +< If the function is defined with "func_name : function() {...": > + ^\s*\ze\i\+\s*[:]\s*(*function\s*( < When using the ":set" command, you need to double the backslashes! + To avoid that use `:let` with a single quote string: > + let &l:define = '^\s*\ze\k\+\s*=\s*function(' +< *'delcombine'* *'deco'* *'nodelcombine'* *'nodeco'* 'delcombine' 'deco' boolean (default off) @@ -1825,8 +1842,11 @@ A jump table for the options with a short description can be found at |Q_op|. contain a list of words. This can be one word per line, or several words per line, separated by non-keyword characters (white space is preferred). Maximum line length is 510 bytes. - When this option is empty, or an entry "spell" is present, spell - checking is enabled the currently active spelling is used. |spell| + + When this option is empty or an entry "spell" is present, and spell + checking is enabled, words in the word lists for the currently active + 'spelllang' are used. See |spell|. + To include a comma in a file name precede it with a backslash. Spaces after a comma are ignored, otherwise spaces are included in the file name. See |option-backslash| about using backslashes. @@ -1869,6 +1889,9 @@ A jump table for the options with a short description can be found at |Q_op|. context:{n} Use a context of {n} lines between a change and a fold that contains unchanged lines. When omitted a context of six lines is used. + When using zero the context is actually one, + since folds require a line in between, also + for a deleted line. See |fold-diff|. iblank Ignore changes where lines are all blank. Adds @@ -1927,7 +1950,7 @@ A jump table for the options with a short description can be found at |Q_op|. diff library. algorithm:{text} Use the specified diff algorithm with the - internal diff engine. Currently supported + internal diff engine. Currently supported algorithms are: myers the default algorithm minimal spend extra time to generate the @@ -2126,22 +2149,6 @@ A jump table for the options with a short description can be found at |Q_op|. This option is reset when the 'paste' option is set and restored when the 'paste' option is reset. - *'exrc'* *'ex'* *'noexrc'* *'noex'* -'exrc' 'ex' boolean (default off) - global - Enables the reading of .vimrc and .exrc in the current directory. - Setting this option is a potential security leak. E.g., consider - unpacking a package or fetching files from github, a .vimrc in there - might be a trojan horse. BETTER NOT SET THIS OPTION! - Instead, define an autocommand in your .vimrc to set options for a - matching directory. - - If you do switch this option on you should also consider setting the - 'secure' option (see |initialization|). - This option cannot be set from a |modeline| or in the |sandbox|, for - security reasons. - Also see |init.vim| and |gui-init|. - *'fileencoding'* *'fenc'* *E213* 'fileencoding' 'fenc' string (default: "") local to buffer @@ -2422,7 +2429,7 @@ A jump table for the options with a short description can be found at |Q_op|. The expression will be evaluated in the |sandbox| if set from a modeline, see |sandbox-option|. This option can't be set from a |modeline| when the 'diff' option is - on. + on or the 'modelineexpr' option is off. It is not allowed to change text or jump to another window while evaluating 'foldexpr' |textlock|. @@ -2537,6 +2544,7 @@ A jump table for the options with a short description can be found at |Q_op|. The expression will be evaluated in the |sandbox| if set from a modeline, see |sandbox-option|. + This option cannot be set in a modeline when 'modelineexpr' is off. It is not allowed to change text or jump to another window while evaluating 'foldtext' |textlock|. @@ -2572,16 +2580,8 @@ A jump table for the options with a short description can be found at |Q_op|. The expression will be evaluated in the |sandbox| when set from a modeline, see |sandbox-option|. That stops the option from working, since changing the buffer text is not allowed. - - *'formatoptions'* *'fo'* -'formatoptions' 'fo' string (default: "tcqj", Vi default: "vt") - local to buffer - This is a sequence of letters which describes how automatic - formatting is to be done. See |fo-table|. When the 'paste' option is - on, no formatting is done (like 'formatoptions' is empty). Commas can - be inserted for readability. - To avoid problems with flags that are added in the future, use the - "+=" and "-=" feature of ":set" |add-option-flags|. + This option cannot be set in a modeline when 'modelineexpr' is off. + NOTE: This option is set to "" when 'compatible' is set. *'formatlistpat'* *'flp'* 'formatlistpat' 'flp' string (default: "^\s*\d\+[\]:.)}\t ]\s*") @@ -2596,6 +2596,16 @@ A jump table for the options with a short description can be found at |Q_op|. The default recognizes a number, followed by an optional punctuation character and white space. + *'formatoptions'* *'fo'* +'formatoptions' 'fo' string (default: "tcqj", Vi default: "vt") + local to buffer + This is a sequence of letters which describes how automatic + formatting is to be done. See |fo-table|. When the 'paste' option is + on, no formatting is done (like 'formatoptions' is empty). Commas can + be inserted for readability. + To avoid problems with flags that are added in the future, use the + "+=" and "-=" feature of ":set" |add-option-flags|. + *'formatprg'* *'fp'* 'formatprg' 'fp' string (default "") global or local to buffer |global-local| @@ -2626,6 +2636,9 @@ A jump table for the options with a short description can be found at |Q_op|. - system signals low battery life - Nvim exits abnormally + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. + *'gdefault'* *'gd'* *'nogdefault'* *'nogd'* 'gdefault' 'gd' boolean (default off) global @@ -2948,7 +2961,13 @@ A jump table for the options with a short description can be found at |Q_op|. the right moment, try adding this flag. This must be done before starting the GUI. Set it in your |gvimrc|. Adding or removing it after the GUI has started has no effect. - + *'go-k'* + 'k' Keep the GUI window size when adding/removing a scrollbar, or + toolbar, tabline, etc. Instead, the behavior is similar to + when the window is maximized and will adjust 'lines' and + 'columns' to fit to the window. Without the 'k' flag Vim will + try to keep 'lines' and 'columns the same when adding and + removing GUI components. *'guitablabel'* *'gtl'* 'guitablabel' 'gtl' string (default empty) @@ -2961,6 +2980,7 @@ A jump table for the options with a short description can be found at |Q_op|. 'guitabtooltip' is used for the tooltip, see below. The expression will be evaluated in the |sandbox| when set from a modeline, see |sandbox-option|. + This option cannot be set in a modeline when 'modelineexpr' is off. Only used when the GUI tab pages line is displayed. 'e' must be present in 'guioptions'. For the non-GUI tab pages line 'tabline' is @@ -3089,6 +3109,7 @@ A jump table for the options with a short description can be found at |Q_op|. When this option contains printf-style '%' items, they will be expanded according to the rules used for 'statusline'. See 'titlestring' for example settings. + This option cannot be set in a modeline when 'modelineexpr' is off. *'ignorecase'* *'ic'* *'noignorecase'* *'noic'* 'ignorecase' 'ic' boolean (default off) @@ -3124,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> @@ -3192,6 +3211,7 @@ A jump table for the options with a short description can be found at |Q_op|. The expression will be evaluated in the |sandbox| when set from a modeline, see |sandbox-option|. + This option cannot be set in a modeline when 'modelineexpr' is off. It is not allowed to change text or jump to another window while evaluating 'includeexpr' |textlock|. @@ -3203,7 +3223,7 @@ A jump table for the options with a short description can be found at |Q_op|. so far, matches. The matched string is highlighted. If the pattern is invalid or not found, nothing is shown. The screen will be updated often, this is only useful on fast terminals. -< Note that the match will be shown, but the cursor will return to its + Note that the match will be shown, but the cursor will return to its original position when no match is found and when pressing <Esc>. You still need to finish the search command with <Enter> to move the cursor to the match. @@ -3260,6 +3280,7 @@ A jump table for the options with a short description can be found at |Q_op|. The expression will be evaluated in the |sandbox| when set from a modeline, see |sandbox-option|. + This option cannot be set in a modeline when 'modelineexpr' is off. It is not allowed to change text or jump to another window while evaluating 'indentexpr' |textlock|. @@ -3877,10 +3898,23 @@ A jump table for the options with a short description can be found at |Q_op|. < If you have less than 512 Mbyte |:mkspell| may fail for some languages, no matter what you set 'mkspellmem' to. + This option cannot be set from a |modeline| or in the |sandbox|. + *'modeline'* *'ml'* *'nomodeline'* *'noml'* 'modeline' 'ml' boolean (Vim default: on (off for root), Vi default: off) local to buffer + If 'modeline' is on 'modelines' gives the number of lines that is + checked for set commands. If 'modeline' is off or 'modelines' is zero + no lines are checked. See |modeline|. + + *'modelineexpr'* *'mle'* *'nomodelineexpr'* *'nomle'* +'modelineexpr' 'mle' boolean (default: off) + global + When on allow some options that are an expression to be set in the + modeline. Check the option for whether it is affected by + 'modelineexpr'. Also see |modeline|. + *'modelines'* *'mls'* 'modelines' 'mls' number (default 5) global @@ -4181,7 +4215,7 @@ A jump table for the options with a short description can be found at |Q_op|. rows in the window, depending on whether 'number' or 'relativenumber' is set. Thus with the Vim default of 4 there is room for a line number up to 999. When the buffer has 1000 lines five columns will be used. - The minimum value is 1, the maximum value is 10. + The minimum value is 1, the maximum value is 20. *'omnifunc'* *'ofu'* 'omnifunc' 'ofu' string (default: empty) @@ -4476,6 +4510,13 @@ A jump table for the options with a short description can be found at |Q_op|. the range of 0 for fully opaque popupmenu (disabled) to 100 for fully transparent background. Values between 0-30 are typically most useful. + It is possible to override the level for individual highlights within + the popupmenu using |highlight-blend|. For instance, to enable + transparency but force the current selected element to be fully opaque: > + + :set pumblend=15 + :hi PmenuSel blend=0 +< UI-dependent. Works best with RGB colors. 'termguicolors' *'pyxversion'* *'pyx'* @@ -4524,6 +4565,25 @@ A jump table for the options with a short description can be found at |Q_op|. set for the newly edited buffer. See 'modifiable' for disallowing changes to the buffer. + *'redrawdebug'* *'rdb'* +'redrawdebug' 'rdb' string (default '') + global + Flags to change the way redrawing works, for debugging purposes. + Most useful with 'writedelay' set to some reasonable value. + Supports the following flags: + compositor Indicate what redraws come from the compositor + by briefly flashing the redrawn regions in colors + indicating the redraw type. These are the highlight + groups used (and their default colors): + RedrawDebugNormal gui=reverse normal redraw passed through + RedrawDebugClear guibg=Yellow clear event passed through + RedrawDebugComposed guibg=Green redraw event modified by the + compositor (due to + overlapping grids, etc) + RedrawDebugRecompose guibg=Red redraw generated by the + compositor itself, due to a + grid being moved or deleted. + *'redrawtime'* *'rdt'* 'redrawtime' 'rdt' number (default 2000) global @@ -4657,6 +4717,8 @@ A jump table for the options with a short description can be found at |Q_op|. When this option is not empty, it determines the content of the ruler string, as displayed for the 'ruler' option. The format of this option is like that of 'statusline'. + This option cannot be set in a modeline when 'modelineexpr' is off. + The default ruler width is 17 characters. To make the ruler 15 characters wide, put "%15(" at the start and "%)" at the end. Example: > @@ -5054,6 +5116,8 @@ A jump table for the options with a short description can be found at |Q_op|. When equal to "NONE" no shada file will be read or written. This option can be set with the |-i| command line flag. The |--clean| command line flag sets it to "NONE". + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. *'shell'* *'sh'* *E91* 'shell' 'sh' string (default $SHELL or "sh", @@ -5095,8 +5159,9 @@ A jump table for the options with a short description can be found at |Q_op|. unescaping, so to keep yourself sane use |:let-&| like shown above. *shell-powershell* To use powershell (on Windows): > - set shell=powershell shellquote=( shellpipe=\| shellredir=> shellxquote= + set shell=powershell shellquote=( shellpipe=\| shellxquote= set shellcmdflag=-NoLogo\ -NoProfile\ -ExecutionPolicy\ RemoteSigned\ -Command + set shellredir=\|\ Out-File\ -Encoding\ UTF8 < This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. @@ -5277,7 +5342,8 @@ A jump table for the options with a short description can be found at |Q_op|. O message for reading a file overwrites any previous message. Also for quickfix message (e.g., ":cn"). s don't give "search hit BOTTOM, continuing at TOP" or "search - hit TOP, continuing at BOTTOM" messages + hit TOP, continuing at BOTTOM" messages; when using the search + count do not show "W" after the count message (see S below) t truncate file message at the start if it is too long to fit on the command-line, "<" will appear in the left most column. Ignored in Ex mode. @@ -5293,7 +5359,8 @@ A jump table for the options with a short description can be found at |Q_op|. "Pattern not found", "Back at original", etc. q use "recording" instead of "recording @a" F don't give the file info when editing a file, like `:silent` - was used for the command + was used for the command; note that this also affects messages + from autocommands S do not show search count message when searching, e.g. "[1/5]" @@ -5548,7 +5615,8 @@ A jump table for the options with a short description can be found at |Q_op|. set spelllang=en_us,nl,medical < This means US English, Dutch and medical words are recognized. Words that are not recognized will be highlighted. - The word list name must not include a comma or dot. Using a dash is + The word list name must consist of alphanumeric characters, a dash or + an underscore. It should not include a comma or dot. Using a dash is recommended to separate the two letter language name from a specification. Thus "en-rare" is used for rare English words. A region name must come last and have the form "_xx", where "xx" is @@ -5574,8 +5642,8 @@ A jump table for the options with a short description can be found at |Q_op|. After this option has been set successfully, Vim will source the files "spell/LANG.vim" in 'runtimepath'. "LANG" is the value of 'spelllang' - up to the first character that is not an ASCII letter and not a dash. - Also see |set-spc-auto|. + up to the first character that is not an ASCII letter or number and + not a dash. Also see |set-spc-auto|. *'spellsuggest'* *'sps'* @@ -5820,6 +5888,7 @@ A jump table for the options with a short description can be found at |Q_op|. The 'statusline' option will be evaluated in the |sandbox| if set from a modeline, see |sandbox-option|. + This option cannot be set in a modeline when 'modelineexpr' is off. It is not allowed to change text or jump to another window while evaluating 'statusline' |textlock|. @@ -5915,7 +5984,9 @@ A jump table for the options with a short description can be found at |Q_op|. pages. split If included, split the current window before loading a buffer for a |quickfix| command that display errors. - Otherwise: do not split, use current window. + Otherwise: do not split, use current window (when used + in the quickfix window: the previously used window or + split if there is no other window). vsplit Just like "split" but split vertically. newtab Like "split", but open a new tab page. Overrules "split" when both are present. @@ -5974,6 +6045,10 @@ A jump table for the options with a short description can be found at |Q_op|. the text to be displayed. Use "%1T" for the first label, "%2T" for the second one, etc. Use "%X" items for closing labels. + When changing something that is used in 'tabline' that does not + trigger it to be updated, use |:redrawtabline|. + This option cannot be set in a modeline when 'modelineexpr' is off. + Keep in mind that only one of the tab pages is the current one, others are invisible and you can't jump to their windows. @@ -6160,10 +6235,11 @@ A jump table for the options with a short description can be found at |Q_op|. 'thesaurus' 'tsr' string (default "") global or local to buffer |global-local| List of file names, separated by commas, that are used to lookup words - for thesaurus completion commands |i_CTRL-X_CTRL-T|. Each line in - the file should contain words with similar meaning, separated by - non-keyword characters (white space is preferred). Maximum line - length is 510 bytes. + for thesaurus completion commands |i_CTRL-X_CTRL-T|. + + Each line in the file should contain words with similar meaning, + separated by non-keyword characters (white space is preferred). + Maximum line length is 510 bytes. To include a comma in a file name precede it with a backslash. Spaces after a comma are ignored, otherwise spaces are included in the file @@ -6253,8 +6329,11 @@ A jump table for the options with a short description can be found at |Q_op|. global When this option is not empty, it will be used for the title of the window. This happens only when the 'title' option is on. + When this option contains printf-style '%' items, they will be expanded according to the rules used for 'statusline'. + This option cannot be set in a modeline when 'modelineexpr' is off. + Example: > :auto BufEnter * let &titlestring = hostname() . "/" . expand("%:p") :set title titlestring=%<%F%=%l/%L-%P titlelen=70 @@ -6288,6 +6367,8 @@ A jump table for the options with a short description can be found at |Q_op|. undo file that exists is used. When it cannot be read an error is given, no further entry is used. See |undo-persistence|. + This option cannot be set from a |modeline| or in the |sandbox|, for + security reasons. *'undofile'* *'noundofile'* *'udf'* *'noudf'* 'undofile' 'udf' boolean (default off) @@ -6612,17 +6693,16 @@ A jump table for the options with a short description can be found at |Q_op|. More info here: |cmdline-completion|. *'wildoptions'* *'wop'* -'wildoptions' 'wop' string (default "") +'wildoptions' 'wop' string (default "pum,tagfile") global - A list of words that change how command line completion is done. + List of words that change how |cmdline-completion| is done. + pum Display the completion matches using the popupmenu + in the same style as the |ins-completion-menu|. tagfile When using CTRL-D to list matching tags, the kind of tag and the file of the tag is listed. Only one match is displayed per line. Often used tag kinds are: d #define f function - pum Display the completion matches using the popupmenu - in the same style as the |ins-completion-menu|. - Also see |cmdline-completion|. *'winaltkeys'* *'wak'* 'winaltkeys' 'wak' string (default "menu") @@ -6643,6 +6723,15 @@ A jump table for the options with a short description can be found at |Q_op|. key is never used for the menu. This option is not used for <F10>; on Win32. + *'winblend'* *'winbl'* +'winblend' 'winbl' number (default 0) + local to window + Enables pseudo-transparency for a floating window. Valid values are in + the range of 0 for fully opaque window (disabled) to 100 for fully + transparent background. Values between 0-30 are typically most useful. + + UI-dependent. Works best with RGB colors. 'termguicolors' + *'window'* *'wi'* 'window' 'wi' number (default screen height - 1) global diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index 022dc5607e..adfab07758 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -295,7 +295,7 @@ the "*" is under your right hand middle finger (search to the right and down). *E956* In very rare cases a regular expression is used recursively. This can happen -when executing a pattern takes a long time and when checkig for messages on +when executing a pattern takes a long time and when checking for messages on channels a callback is invoked that also uses a pattern or an autocommand is triggered. In most cases this should be fine, but if a pattern is in use when it's used again it fails. Usually this means there is something wrong with @@ -398,11 +398,11 @@ Use of "\m" makes the pattern after it be interpreted as if 'magic' is set, ignoring the actual value of the 'magic' option. Use of "\M" makes the pattern after it be interpreted as if 'nomagic' is used. */\v* */\V* -Use of "\v" means that in the pattern after it all ASCII characters except -'0'-'9', 'a'-'z', 'A'-'Z' and '_' have a special meaning. "very magic" +Use of "\v" means that after it, all ASCII characters except '0'-'9', 'a'-'z', +'A'-'Z' and '_' have special meaning: "very magic" -Use of "\V" means that in the pattern after it only the backslash and the -terminating character (/ or ?) has a special meaning. "very nomagic" +Use of "\V" means that after it, only a backslash and terminating character +(usually / or ?) have special meaning: "very nomagic" Examples: after: \v \m \M \V matches ~ @@ -1125,7 +1125,7 @@ x A single character, with no special meaning, matches itself The "Func" column shows what library function is used. The implementation depends on the system. Otherwise: (1) Uses islower() for ASCII and Vim builtin rules for other - characters when built with the |+multi_byte| feature. + characters. (2) Uses Vim builtin rules (3) As with (1) but using isupper() */[[=* *[==]* @@ -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* @@ -1201,7 +1200,7 @@ x A single character, with no special meaning, matches itself \%u20AC Matches the character specified with up to four hexadecimal characters. \%U1234abcd Matches the character specified with up to eight hexadecimal - characters. + characters, up to 0x7fffffff ============================================================================== 7. Ignoring case in a pattern */ignorecase* diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index a0e071d4dd..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 @@ -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! @@ -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 084ad4e521..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. @@ -99,10 +97,9 @@ not recognized by Vim will just be converted to lower case and underscores replaced with '-' signs. If 'printencoding' is empty or Vim cannot find the file then it will use -'encoding' (if Vim is compiled with |+multi_byte| and it is set an 8-bit -encoding) to find the print character encoding file. If Vim is unable to find -a character encoding file then it will use the "latin1" print character -encoding file. +'encoding' (if it is set an 8-bit encoding) to find the print character +encoding file. If Vim is unable to find a character encoding file then it +will use the "latin1" print character encoding file. When 'encoding' is set to a multi-byte encoding, Vim will try to convert characters to the printing encoding for printing (if 'printencoding' is empty @@ -238,9 +235,9 @@ possible. The following tables show the valid combinations: Japanese JIS_C_1978 x x JIS_X_1983 x x JIS_X_1990 x x x - MSWINDOWS x - KANJITALK6 x - KANJITALK7 x + MSWINDOWS x + KANJITALK6 x + KANJITALK7 x euc-kr cp949 ucs-2 utf-8 ~ Korean KS_X_1992 x diff --git a/runtime/doc/provider.txt b/runtime/doc/provider.txt index 364fbac351..dc045c360a 100644 --- a/runtime/doc/provider.txt +++ b/runtime/doc/provider.txt @@ -57,22 +57,22 @@ If you run into problems, uninstall _both_ then install "pynvim" again: > PYTHON PROVIDER CONFIGURATION ~ *g:python_host_prog* -Path to Python 2 interpreter. Setting this makes startup faster. Also useful -for working with virtualenvs. > - let g:python_host_prog = '/path/to/python' " Python 2 +Command to start Python 2 (executable, not directory). Setting this makes +startup faster. Useful for working with virtualenvs. > + let g:python_host_prog = '/path/to/python' < *g:python3_host_prog* -Path to Python 3 interpreter. Setting this makes startup faster. Also useful -for working with virtualenvs. > - let g:python3_host_prog = '/path/to/python3' " Python 3 +Command to start Python 3 (executable, not directory). Setting this makes +startup faster. Useful for working with virtualenvs. > + let g:python3_host_prog = '/path/to/python3' < *g:loaded_python_provider* To disable Python 2 support: > - let g:loaded_python_provider = 1 + let g:loaded_python_provider = 0 < *g:loaded_python3_provider* To disable Python 3 support: > - let g:loaded_python3_provider = 1 + let g:loaded_python3_provider = 0 PYTHON VIRTUALENVS ~ @@ -111,7 +111,7 @@ Run |:checkhealth| to see if your system is up-to-date. RUBY PROVIDER CONFIGURATION ~ *g:loaded_ruby_provider* To disable Ruby support: > - let g:loaded_ruby_provider = 1 + let g:loaded_ruby_provider = 0 < *g:ruby_host_prog* Command to start the Ruby host. By default this is "neovim-ruby-host". With @@ -142,7 +142,7 @@ Run |:checkhealth| to see if your system is up-to-date. NODEJS PROVIDER CONFIGURATION~ *g:loaded_node_provider* To disable Node.js support: > - :let g:loaded_node_provider = 1 + :let g:loaded_node_provider = 0 < *g:node_host_prog* Command to start the Node.js host. Setting this makes startup faster. diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index d20a91dc2d..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 @@ -97,14 +97,14 @@ processing a quickfix or location list command, it will be aborted. :[count]lne[xt][!] Same as ":cnext", except the location list for the current window is used instead of the quickfix list. -:[count]cN[ext][!] *:cp* *:cprevious* *:cN* *:cNext* +:[count]cN[ext][!] *:cp* *:cprevious* *:cprev* *:cN* *:cNext* :[count]cp[revious][!] Display the [count] previous error in the list that includes a file name. If there are no file names at all, go to the [count] previous error. See |:cc| for [!] and 'switchbuf'. -:[count]lN[ext][!] *:lp* *:lprevious* *:lN* *:lNext* +:[count]lN[ext][!] *:lp* *:lprevious* *:lprev* *:lN* *:lNext* :[count]lp[revious][!] Same as ":cNext" and ":cprevious", except the location list for the current window is used instead of the quickfix list. @@ -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. @@ -355,6 +355,23 @@ modify the title of a quickfix and location list respectively. Examples: > call setloclist(3, [], 'a', {'title' : 'Cmd output'}) echo getloclist(3, {'title' : 1}) < + *quickfix-index* +When you jump to a quickfix/location list entry using any of the quickfix +commands (e.g. |:cc|, |:cnext|, |:cprev|, etc.), that entry becomes the +currently selected entry. The index of the currently selected entry in a +quickfix/location list can be obtained using the getqflist()/getloclist() +functions. Examples: > + echo getqflist({'idx' : 0}).idx + echo getqflist({'id' : qfid, 'idx' : 0}).idx + echo getloclist(2, {'idx' : 0}).idx +< +For a new quickfix list, the first entry is selected and the index is 1. Any +entry in any quickfix/location list can be set as the currently selected entry +using the setqflist() function. Examples: > + call setqflist([], 'a', {'idx' : 12}) + call setqflist([], 'a', {'id' : qfid, 'idx' : 7}) + call setloclist(1, [], 'a', {'idx' : 7}) +< *quickfix-size* You can get the number of entries (size) in a quickfix and a location list using the |getqflist()| and |getloclist()| functions respectively. Examples: > @@ -540,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 @@ -889,7 +906,7 @@ commands can be combined to create a NewGrep command: > 'smartcase' is not used. If {pattern} is empty (e.g. // is specified), the last used search pattern is used. |last-pattern| - +:{count}vim[grep] ... When a number is put before the command this is used as the maximum number of matches to find. Use ":1vimgrep pattern file" to find only the first. @@ -1071,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 @@ -1257,7 +1272,7 @@ to the file. Changing directory The following uppercase conversion characters specify the type of special -format strings. At most one of them may be given as a prefix at the begin +format strings. At most one of them may be given as a prefix at the beginning of a single comma-separated format pattern. Some compilers produce messages that consist of directory names that have to be prepended to each file name read by %f (example: GNU make). The following @@ -1515,7 +1530,7 @@ The backslashes before the pipe character are required to avoid it to be recognized as a command separator. The backslash before each space is required for the set command. - *cfilter-plugin* *Cfilter* *Lfilter* + *cfilter-plugin* *:Cfilter* *:Lfilter* If you have too many matching messages, you can use the cfilter plugin to reduce the number of entries. Load the plugin with: > packadd cfilter diff --git a/runtime/doc/quickref.txt b/runtime/doc/quickref.txt index d3d9303d3c..87cb9b54f5 100644 --- a/runtime/doc/quickref.txt +++ b/runtime/doc/quickref.txt @@ -38,7 +38,7 @@ N is used to indicate an optional count that can be given before the command. |l| N l right (also: <Space> or <Right> key) |0| 0 to first character in the line (also: <Home> key) |^| ^ to first non-blank character in the line -|$| N $ to the last character in the line (N-1 lines lower) +|$| N $ to the next EOL (end of line) position (also: <End> key) |g0| g0 to first character in screen line (differs from "0" when lines wrap) @@ -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 0a552a1309..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. @@ -306,7 +314,10 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. |<SID>|. :scr[iptnames][!] {scriptId} *:script* - Edit script {scriptId}. Suggested name is ":script". + Edit script {scriptId}. Although ":scriptnames name" + works, using ":script name" is recommended. + When the current buffer can't be |abandon|ed and the ! + is not present, the command fails. *:fini* *:finish* *E168* :fini[sh] Stop sourcing a script. Can only be used in a Vim diff --git a/runtime/doc/russian.txt b/runtime/doc/russian.txt index 724c4f9454..776630a52b 100644 --- a/runtime/doc/russian.txt +++ b/runtime/doc/russian.txt @@ -52,8 +52,7 @@ automatic installs. Vim also needs to be compiled with |+gettext| feature for user interface items translations to work. After downloading an archive from RuVim project, unpack it into your -$VIMRUNTIME directory. We recommend using UTF-8 archive, if your version of -Vim is compiled with |+multi_byte| feature enabled. +$VIMRUNTIME directory. We recommend using UTF-8 archive. In order to use the Russian documentation, make sure you have set the 'helplang' option to "ru". 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/sign.txt b/runtime/doc/sign.txt index cf7e01bcea..4e0d91dae0 100644 --- a/runtime/doc/sign.txt +++ b/runtime/doc/sign.txt @@ -37,6 +37,7 @@ There are two steps in using signs: displayed. A defined sign can be placed several times in different lines and files. + *sign-column* When signs are defined for a file, Vim will automatically add a column of two characters to display them in. When the last sign is unplaced the column disappears again. This behavior can be changed with the 'signcolumn' option. @@ -49,7 +50,7 @@ Example to set the color: > *sign-identifier* Each placed sign is identified by a number called the sign identifier. This identifier is used to jump to the sign or to remove the sign. The identifier -is assigned when placing the sign using the |sign-place| command or the +is assigned when placing the sign using the |:sign-place| command or the |sign_place()| function. Each sign identifier should be a unique number. If multiple placed signs use the same identifier, then jumping to or removing a sign becomes unpredictable. To avoid overlapping identifiers, sign groups can @@ -70,6 +71,10 @@ on the same line, the attributes of the sign with the highest priority is used independent of the sign group. The default priority for a sign is 10. The priority is assigned at the time of placing a sign. +When the line on which the sign is placed is deleted, the sign is moved to the +next line (or the last line of the buffer, if there is no next line). When +the delete is undone the sign does not move back. + ============================================================================== 2. Commands *sign-commands* *:sig* *:sign* @@ -92,7 +97,7 @@ See |sign_define()| for the equivalent Vim script function. :sign define {name} {argument}... Define a new sign or set attributes for an existing sign. The {name} can either be a number (all digits) or a name - starting with a non-digit. Leading digits are ignored, thus + starting with a non-digit. Leading zeros are ignored, thus "0012", "012" and "12" are considered the same name. About 120 different signs can be defined. diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index 875f3f2c08..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/share/vim70,~/.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/share/vim70/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/share/vim70/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/share/vim70/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/share/vim70/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 @@ -558,7 +558,7 @@ When the Myspell files are updated you can merge the differences: nvim -d xx_YY.orig.dic xx_YY.new.dic 3. Take over the changes you like in xx_YY.dic. You may also need to change xx_YY.aff. -4. Rename xx_YY.new.dic to xx_YY.orig.dic and xx_YY.new.aff to xx_YY.new.aff. +4. Rename xx_YY.new.dic to xx_YY.orig.dic and xx_YY.new.aff to xx_YY.orig.aff. SPELL FILE VERSIONS *E770* *E771* *E772* @@ -1562,6 +1562,10 @@ CHECKCOMPOUNDTRIPLE (Hunspell) *spell-CHECKCOMPOUNDTRIPLE* Forbid three identical characters when compounding. Not supported. +CHECKSHARPS (Hunspell)) *spell-CHECKSHARPS* + SS letter pair in uppercased (German) words may be upper case + sharp s (ß). Not supported. + COMPLEXPREFIXES (Hunspell) *spell-COMPLEXPREFIXES* Enables using two prefixes. Not supported. @@ -1575,12 +1579,21 @@ COMPOUNDFIRST (Hunspell) *spell-COMPOUNDFIRST* Use COMPOUNDRULE instead. |spell-COMPOUNDRULE| COMPOUNDBEGIN (Hunspell) *spell-COMPOUNDBEGIN* + Words signed with COMPOUNDBEGIN may be first elements in + compound words. Use COMPOUNDRULE instead. |spell-COMPOUNDRULE| -COMPOUNDEND (Hunspell) *spell-COMPOUNDEND* +COMPOUNDLAST (Hunspell) *spell-COMPOUNDLAST* + Words signed with COMPOUNDLAST may be last elements in + compound words. Use COMPOUNDRULE instead. |spell-COMPOUNDRULE| +COMPOUNDEND (Hunspell) *spell-COMPOUNDEND* + Probably the same as COMPOUNDLAST + COMPOUNDMIDDLE (Hunspell) *spell-COMPOUNDMIDDLE* + Words signed with COMPOUNDMIDDLE may be middle elements in + compound words. Use COMPOUNDRULE instead. |spell-COMPOUNDRULE| COMPOUNDRULES (Hunspell) *spell-COMPOUNDRULES* diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 2a230d9449..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 @@ -451,14 +450,10 @@ accordingly. Vim proceeds in this order: - Environment variable $EXINIT, used as an Ex command line. c. If the 'exrc' option is on (which is NOT the default), the current - directory is searched for three files. The first that exists is used, + directory is searched for two files. The first that exists is used, the others are ignored. - - The file ".nvimrc" (for Unix) - "_nvimrc" (for Win32) - - The file "_nvimrc" (for Unix) - ".nvimrc" (for Win32) - - The file ".exrc" (for Unix) - "_exrc" (for Win32) + - The file ".nvimrc" + - The file ".exrc" 4. Enable filetype and indent plugins. This does the same as the commands: > @@ -680,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* @@ -735,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 b60a952def..e5b65554d4 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -346,20 +346,9 @@ Upon loading a file, Vim finds the relevant syntax file as follows: syntax. ============================================================================== -4. Syntax file remarks *:syn-file-remarks* +4. Conversion to HTML *2html.vim* *convert-to-HTML* - *b:current_syntax-variable* -Vim stores the name of the syntax that has been loaded in the -"b:current_syntax" variable. You can use this if you want to load other -settings, depending on which syntax is active. Example: > - :au BufReadPost * if b:current_syntax == "csh" - :au BufReadPost * do-some-things - :au BufReadPost * endif - - -2HTML *2html.vim* *convert-to-HTML* - -This is not a syntax file itself, but a script that converts the current +2html is not a syntax file itself, but a script that converts the current window into HTML. Vim opens a new window in which it builds the HTML file. After you save the resulting file, you can view it with any browser. The @@ -649,12 +638,12 @@ the rendered page generated by 2html.vim. :let g:html_no_pre = 1 < *g:html_expand_tabs* -Default: 1 if 'tabstop' is 8, 'expandtab' is 0, and no fold column or line - numbers occur in the generated HTML; - 0 otherwise. -When 0, <Tab> characters in the buffer text are replaced with an appropriate +Default: 0 if 'tabstop' is 8, 'expandtab' is 0, 'vartabstop' is not in use, + and no fold column or line numbers occur in the generated HTML; + 1 otherwise. +When 1, <Tab> characters in the buffer text are replaced with an appropriate number of space characters, or references if |g:html_no_pre| is 1. -When 1, if |g:html_no_pre| is 0 or unset, <Tab> characters in the buffer text +When 0, if |g:html_no_pre| is 0 or unset, <Tab> characters in the buffer text are included as-is in the generated HTML. This is useful for when you want to allow copy and paste from a browser without losing the actual whitespace in the source document. Note that this can easily break text alignment and @@ -751,6 +740,18 @@ When 1, generate XHTML 1.0 instead (XML compliant HTML). > :let g:html_use_xhtml = 1 < +============================================================================== +5. Syntax file remarks *:syn-file-remarks* + + *b:current_syntax-variable* +Vim stores the name of the syntax that has been loaded in the +"b:current_syntax" variable. You can use this if you want to load other +settings, depending on which syntax is active. Example: > + :au BufReadPost * if b:current_syntax == "csh" + :au BufReadPost * do-some-things + :au BufReadPost * endif + + ABEL *abel.vim* *ft-abel-syntax* @@ -917,6 +918,9 @@ to the respective variable. Example: > To disable them use ":unlet". Example: > :unlet c_comment_strings +An alternative is to switch to the C++ highlighting: > + :set filetype=cpp + Variable Highlight ~ *c_gnu* GNU gcc specific items *c_comment_strings* strings and numbers inside a comment @@ -2587,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 @@ -2666,9 +2669,29 @@ later, and part earlier) adds. RESTRUCTURED TEXT *rst.vim* *ft-rst-syntax* -You may set what syntax definitions should be used for code blocks via > +Syntax highlighting is enabled for code blocks within the document for a +select number of file types. See $VIMRUNTIME/syntax/rst.vim for the default +syntax list. + +To set a user-defined list of code block syntax highlighting: > let rst_syntax_code_list = ['vim', 'lisp', ...] -< + +To assign multiple code block types to a single syntax, define +`rst_syntax_code_list` as a mapping: > + let rst_syntax_code_list = { + \ 'cpp' = ['cpp', 'c++'], + \ 'bash' = ['bash', 'sh'], + ... + } + +To use color highlighting for emphasis text: > + let rst_use_emphasis_colors = 1 + +To enable folding of sections: > + let rst_fold_enabled = 1 + +Note that folding can cause performance issues on some platforms. + REXX *rexx.vim* *ft-rexx-syntax* @@ -3084,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~ @@ -3437,7 +3460,7 @@ The syntax script for zsh allows for syntax-based folding: > :let g:zsh_fold_enable = 1 ============================================================================== -5. Defining a syntax *:syn-define* *E410* +6. Defining a syntax *:syn-define* *E410* Vim understands three types of syntax items: @@ -3796,7 +3819,7 @@ DEFINING REGIONS *:syn-region* *:syn-start* *:syn-skip* *:syn-end* The maximum number of syntax groups is 19999. ============================================================================== -6. :syntax arguments *:syn-arguments* +7. :syntax arguments *:syn-arguments* The :syntax commands that define syntax items take a number of arguments. The common ones are explained here. The arguments may be given in any order @@ -3962,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* @@ -4117,7 +4139,7 @@ IMPLICIT CONCEAL *:syn-conceal-implicit* Show either "syntax conceal on" or "syntax conceal off" (translated). ============================================================================== -7. Syntax patterns *:syn-pattern* *E401* *E402* +8. Syntax patterns *:syn-pattern* *E401* *E402* In the syntax commands, a pattern must be surrounded by two identical characters. This is like it works for the ":s" command. The most common to @@ -4295,7 +4317,7 @@ Note that only matches within a single line can be used. Multi-line matches cannot be referred to. ============================================================================== -8. Syntax clusters *:syn-cluster* *E400* +9. Syntax clusters *:syn-cluster* *E400* :sy[ntax] cluster {cluster-name} [contains={group-name}..] [add={group-name}..] @@ -4341,7 +4363,7 @@ This also has implications for nested clusters: > The maximum number of clusters is 9767. ============================================================================== -9. Including syntax files *:syn-include* *E397* +10. Including syntax files *:syn-include* *E397* It is often useful for one language's syntax file to include a syntax file for a related language. Depending on the exact relationship, this can be done in @@ -4382,7 +4404,7 @@ two different ways: The maximum number of includes is 999. ============================================================================== -10. Synchronizing *:syn-sync* *E403* *E404* +11. Synchronizing *:syn-sync* *E403* *E404* Vim wants to be able to start redrawing in any position in the document. To make this possible it needs to know the syntax state at the position where @@ -4574,7 +4596,7 @@ You can clear specific sync patterns with: > :syntax sync clear {sync-group-name} .. ============================================================================== -11. Listing syntax items *:syntax* *:sy* *:syn* *:syn-list* +12. Listing syntax items *:syntax* *:sy* *:syn* *:syn-list* This command lists all the syntax items: > @@ -4879,6 +4901,11 @@ guisp={color-name} *highlight-guisp* All values are hexadecimal, range from "00" to "ff". Examples: > :highlight Comment guifg=#11f0c3 guibg=#ff00ff < +blend={integer} *highlight-blend* + Override the blend level for a highlight group within the popupmenu + or floating windows. Only takes effect if 'pumblend' or 'winblend' + is set for the menu or window. See the help at the respective option. + *highlight-groups* *highlight-default* These are the builtin highlighting groups. Note that the highlighting depends on the value of 'background'. You can see the current settings with the @@ -5082,7 +5109,7 @@ Without the "default" in the C syntax file, the highlighting would be overruled when the syntax file is loaded. ============================================================================== -14. Cleaning up *:syn-clear* *E391* +15. Cleaning up *:syn-clear* *E391* If you want to clear the syntax stuff for the current buffer, you can use this command: > @@ -5095,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 @@ -5104,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: > @@ -5172,7 +5200,7 @@ syntax/syncolor.vim files are loaded: them. ============================================================================== -15. Highlighting tags *tag-highlight* +16. Highlighting tags *tag-highlight* If you want to highlight all the tags in your file, you can use the following mappings. @@ -5207,7 +5235,7 @@ And put these lines in your vimrc: > autocmd BufRead,BufNewFile *.[ch] endif ============================================================================== -16. Window-local syntax *:ownsyntax* +17. Window-local syntax *:ownsyntax* Normally all windows on a buffer share the same syntax settings. It is possible, however, to set a particular window on a file to have its own 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 a4526a7f2c..bb3134feb6 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 @@ -173,8 +176,8 @@ commands explained above the tag stack will look like this: 1 1 main 1 harddisk2:text/vim/test 2 1 FuncB 59 harddisk2:text/vim/src/main.c -The gettagstack() function returns the tag stack of a specified window. The -settagstack() function modifies the tag stack of a window. +The |gettagstack()| function returns the tag stack of a specified window. The +|settagstack()| function modifies the tag stack of a window. *E73* When you try to use the tag stack while it doesn't contain anything you will @@ -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 @@ -523,8 +525,7 @@ only supported by new versions of ctags (such as Exuberant ctags). be any identifier. It cannot contain a <Tab>. {TAB} One <Tab> character. Note: previous versions allowed any white space here. This has been abandoned to allow spaces in - {tagfile}. It can be re-enabled by including the - |+tag_any_white| feature at compile time. *tag-any-white* + {tagfile}. {tagfile} The file that contains the definition of {tagname}. It can have an absolute or relative path. It may contain environment variables and wildcards (although the use of wildcards is @@ -536,7 +537,14 @@ only supported by new versions of ctags (such as Exuberant ctags). {term} ;" The two characters semicolon and double quote. This is interpreted by Vi as the start of a comment, which makes the following be ignored. This is for backwards compatibility - with Vi, it ignores the following fields. + with Vi, it ignores the following fields. Example: + APP file /^static int APP;$/;" v + When {tagaddress} is not a line number or search pattern, then + {term} must be |;". Here the bar ends the command (excluding + the bar) and ;" is used to have Vi ignore the rest of the + line. Example: + APP file.c call cursor(3, 4)|;" v + {field} .. A list of optional fields. Each field has the form: <Tab>{fieldname}:{value} @@ -572,8 +580,7 @@ ignored. (Case is ignored when 'ignorecase' is set and 'tagcase' is The value '2' should be used then: !_TAG_FILE_SORTED<Tab>2<Tab>{anything} ~ -The other tag that Vim recognizes, but only when compiled with the -|+multi_byte| feature, is the encoding of the tags file: +The other tag that Vim recognizes is the encoding of the tags file: !_TAG_FILE_ENCODING<Tab>utf-8<Tab>{anything} ~ Here "utf-8" is the encoding used for the tags. Vim will then convert the tag being searched for from 'encoding' to the encoding of the tags file. And when @@ -804,7 +811,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/ui.txt b/runtime/doc/ui.txt index ca10edccba..1440e2ac78 100644 --- a/runtime/doc/ui.txt +++ b/runtime/doc/ui.txt @@ -316,6 +316,14 @@ numerical highlight ids to the actual attributes. `info` is an empty array by default, and will be used by the |ui-hlstate| extension explained below. +["hl_group_set", name, hl_id] + The bulitin highlight group `name` was set to use the attributes `hl_id` + defined by a previous `hl_attr_define` call. This event is not needed + to render the grids which use attribute ids directly, but is useful + for an UI who want to render its own elements with consistent + highlighting. For instance an UI using |ui-popupmenu| events, might + use the |hl-Pmenu| family of builtin highlights. + *ui-event-grid_line* ["grid_line", grid, row, col_start, cells] Redraw a continuous part of a `row` on a `grid`, starting at the column @@ -706,6 +714,7 @@ events, which the UI must handle. "rpc_error" Error response from |rpcrequest()| "return_prompt" |press-enter| prompt after a multiple messages "quickfix" Quickfix navigation message + "search_count" Search count message ("S" flag of 'shortmess') "wmsg" Warning ("search hit BOTTOM", |W10|, …) New kinds may be added in the future; clients should treat unknown kinds as the empty kind. diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt index af17d75656..70a0ad97c1 100644 --- a/runtime/doc/usr_05.txt +++ b/runtime/doc/usr_05.txt @@ -11,12 +11,13 @@ Vim's capabilities. Or define your own macros. |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 Next chapter: |usr_06.txt| Using syntax highlighting Previous chapter: |usr_04.txt| Making small changes @@ -172,21 +173,12 @@ This switches on three very clever mechanisms: automatically. Vim comes with these indent rules for a number of filetypes. See |:filetype-indent-on| and 'indentexpr'. -> - autocmd FileType text setlocal textwidth=78 - -This makes Vim break text to avoid lines getting longer than 78 characters. -But only for files that have been detected to be plain text. There are -actually two parts here. "autocmd FileType text" is an autocommand. This -defines that when the file type is set to "text" the following command is -automatically executed. "setlocal textwidth=78" sets the 'textwidth' option -to 78, but only locally in one file. - *restore-cursor* > - autocmd BufReadPost * - \ if line("'\"") > 1 && line("'\"") <= line("$") | - \ exe "normal! g`\"" | - \ endif + *restore-cursor* *last-position-jump* > + autocmd BufReadPost * + \ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit' + \ | exe "normal! g`\"" + \ | endif Another autocommand. This time it is used after reading any file. The complicated stuff after it checks if the '" mark is defined, and jumps to it @@ -195,8 +187,22 @@ from the previous line. That avoids a line getting very long. See |line-continuation|. This only works in a Vim script file, not when typing commands at the command-line. +> + command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis + \ | wincmd p | diffthis + +This adds the ":DiffOrig" command. Use this in a modified buffer to see the +differences with the file it was loaded from. See |diff| and |:DiffOrig|. + +> + set nolangremap + +Prevent that the langmap option applies to characters that result from a +mapping. If set (default), this may break plugins (but it's backward +compatible). See 'langremap'. + ============================================================================== -*05.3* Simple mappings +*05.4* Simple mappings A mapping enables you to bind a set of Vim commands to a single key. Suppose, for example, that you need to surround certain words with curly braces. In @@ -243,7 +249,7 @@ The ":map" command (with no arguments) lists your current mappings. At least the ones for Normal mode. More about mappings in section |40.1|. ============================================================================== -*05.4* Adding a package *add-package* *vimball-install* +*05.5* Adding a package *add-package* *vimball-install* A package is a set of files that you can add to Vim. There are two kinds of packages: optional and automatically loaded on startup. @@ -283,12 +289,11 @@ an archive or as a repository. For an archive you can follow these steps: More information about packages can be found here: |packages|. ============================================================================== -*05.5* Adding a plugin *add-plugin* *plugin* +*05.6* Adding a plugin *add-plugin* *plugin* 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: @@ -420,7 +425,7 @@ Further reading: |new-filetype| How to detect a new file type. ============================================================================== -*05.6* Adding a help file *add-local-help* +*05.7* Adding a help file *add-local-help* If you are lucky, the plugin you installed also comes with a help file. We will explain how to install the help file, so that you can easily find help @@ -453,7 +458,7 @@ them through the tag. For writing a local help file, see |write-local-help|. ============================================================================== -*05.7* The option window +*05.8* The option window If you are looking for an option that does what you want, you can search in the help files here: |options|. Another way is by using this command: > @@ -492,7 +497,7 @@ border. This is what the 'scrolloff' option does, it specifies an offset from the window border where scrolling starts. ============================================================================== -*05.8* Often used options +*05.9* Often used options There are an awful lot of options. Most of them you will hardly ever use. Some of the more useful ones will be mentioned here. Don't forget you can 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_11.txt b/runtime/doc/usr_11.txt index 42b564e962..c26f1e8f09 100644 --- a/runtime/doc/usr_11.txt +++ b/runtime/doc/usr_11.txt @@ -120,7 +120,7 @@ the resulting files if they are what you expected. USING A SPECIFIC SWAP FILE If you know which swap file needs to be used, you can recover by giving the -swap file name. Vim will then finds out the name of the original file from +swap file name. Vim will then find out the name of the original file from the swap file. Example: > 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 def781c109..b26b7cb646 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,8 @@ 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* get() get an item without error for wrong index @@ -767,9 +770,13 @@ System functions and manipulation of files: rename() rename a file system() get the result of a shell command as a string systemlist() get the result of a shell command as a list + environ() get all environment variables + getenv() get one environment variable + setenv() set an environment variable hostname() name of the system readfile() read a file into a List of lines - writefile() write a List of lines into a file + readdir() get a List of file names in a directory + writefile() write a List of lines or Blob into a file Date and Time: *date-functions* *time-functions* getftime() get last modification time of a file @@ -798,6 +805,9 @@ Buffers, windows and the argument list: bufwinnr() get the window number of a specific buffer winbufnr() get the buffer number of a specific window getbufline() get a list of lines from the specified buffer + setbufline() replace a line in the specified buffer + appendbufline() append a list of lines in the specified buffer + deletebufline() delete lines from a specified buffer win_findbuf() find windows containing a buffer win_getid() get window ID of a window win_gotoid() go to window with ID @@ -808,6 +818,8 @@ Buffers, windows and the argument list: getwininfo() get a list with window information getchangelist() get a list of change list entries getjumplist() get a list of jump list entries + swapinfo() information about a swap file + swapname() get the swap file path of a buffer Command line: *command-line-functions* getcmdline() get the current command line @@ -890,6 +902,7 @@ GUI: *gui-functions* getwinposy() Y position of the Vim window balloon_show() set the balloon content balloon_split() split a message for a balloon + balloon_gettext() get the text in the balloon Vim server: *server-functions* serverlist() return the list of server names @@ -906,6 +919,7 @@ Window size and position: *window-size-functions* winheight() get height of a specific window winwidth() get width of a specific window win_screenpos() get screen position of a window + winlayout() get layout of windows in a tab page winrestcmd() return command to restore window sizes winsaveview() get view of current window winrestview() restore saved view of current window @@ -928,6 +942,7 @@ Signs: *sign-functions* Testing: *test-functions* assert_equal() assert that two expressions values are equal + assert_equalfile() assert that two file contents are equal assert_notequal() assert that two expressions values are not equal assert_inrange() assert that an expression is inside a range assert_match() assert that a pattern matches the value @@ -940,7 +955,21 @@ Testing: *test-functions* Timers: *timer-functions* timer_start() create a timer + timer_pause() pause or unpause a timer timer_stop() stop a timer + timer_stopall() stop all timers + timer_info() get information about timers + +Tags: *tag-functions* + taglist() get list of matching tags + tagfiles() get a list of tags files + gettagstack() get the tag stack of a window + settagstack() modify the tag stack of a window + +Prompt Buffer: *promptbuffer-functions* + prompt_setcallback() set prompt callback for a buffer + prompt_setinterrupt() set interrupt callback for a buffer + prompt_setprompt() set the prompt text for a buffer Various: *various-functions* mode() get current editing mode @@ -969,15 +998,11 @@ Various: *various-functions* wordcount() get byte/word/char count of buffer - taglist() get list of matching tags - tagfiles() get a list of tags files - gettagstack() get the tag stack - settagstack() modify the tag stack - luaeval() evaluate Lua expression py3eval() evaluate Python expression (|+python3|) pyeval() evaluate Python expression (|+python|) pyxeval() evaluate |python_x| expression + debugbreak() interrupt a program being debugged ============================================================================== *41.7* Defining a function diff --git a/runtime/doc/usr_45.txt b/runtime/doc/usr_45.txt index be33f0be6d..1ce6969d37 100644 --- a/runtime/doc/usr_45.txt +++ b/runtime/doc/usr_45.txt @@ -152,12 +152,6 @@ language than the text. language, the default should work fine and you don't need to do anything. The following is only relevant when you want to edit different languages. - Note: - Using different encodings only works when Vim was compiled to handle - it. To find out if it works, use the ":version" command and check the - output for "+multi_byte". If it's there, you are OK. If you see - "-multi_byte" you will have to find another Vim. - USING UNICODE IN THE GUI 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 2b6afcbdbc..32551815b0 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -12,22 +12,29 @@ Various commands *various* 1. Various commands *various-cmds* *CTRL-L* -CTRL-L Clear and redraw the screen. The redraw may happen +CTRL-L Clears and redraws the screen. The redraw may happen later, after processing typeahead. + *:mod* *:mode* +:mod[e] Clears and redraws the screen. + *:redr* *:redraw* -:redr[aw][!] Redraw the screen right now. When ! is included it is - cleared first. - Useful to update the screen halfway through executing - a script or function (or a mapping if 'lazyredraw' - set). +:redr[aw][!] Redraws pending screen updates now, or the entire + screen if "!" is included. To CLEAR the screen use + |:mode| or |CTRL-L|. + Useful to update the screen during a script or + function (or a mapping if 'lazyredraw' set). *:redraws* *:redrawstatus* -:redraws[tatus][!] Redraw the status line of the current window. When ! - is included all status lines are redrawn. - Useful to update the status line(s) when 'statusline' - includes an item that doesn't cause automatic - updating. +:redraws[tatus][!] Redraws the status line of the current window, or all + status lines if "!" is included. + Useful if 'statusline' includes an item that doesn't + cause automatic updating. + + *:redrawt* *:redrawtabline* +:redrawt[abline] Redraw the tabline. Useful to update the tabline when + 'tabline' includes an item that doesn't trigger + automatic updating. *N<Del>* <Del> When entering a number: Remove the last digit. @@ -276,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|. @@ -356,7 +363,20 @@ g8 Print the hex values of the bytes used in the The pattern is matched against the relevant part of the output, not necessarily the whole line. Only some commands support filtering, try it out to check if it - works. + works. Some of the commands that support filtering: + |:#| - filter whole line + |:clist| - filter by file name or module name + |:command| - filter by command name + |:files| - filter by file name + |:highlight| - filter by highlight group + |:jumps| - filter by file name + |:let| - filter by variable name + |:list| - filter whole line + |:llist| - filter by file name or module name + |:marks| - filter by text in the current file, + or file name for other files + |:oldfiles| - filter by file name + |:set| - filter by variable name Only normal messages are filtered, error messages are not. @@ -431,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/vi_diff.txt b/runtime/doc/vi_diff.txt index d908f484c6..beecca2480 100644 --- a/runtime/doc/vi_diff.txt +++ b/runtime/doc/vi_diff.txt @@ -179,6 +179,12 @@ Command-line editing and history. |cmdline-editing| forward/backward one character. The shifted right/left cursor keys can be used to move forward/backward one word. CTRL-B/CTRL-E can be used to go to the begin/end of the command-line. + {Vi: can only alter the last character in the line} + {Vi: when hitting <Esc> the command-line is executed. This is + unexpected for most people; therefore it was changed in Vim. But when + the <Esc> is part of a mapping, the command-line is executed. If you + want the Vi behaviour also when typing <Esc>, use ":cmap ^V<Esc> + ^V^M"} |cmdline-history| The command-lines are remembered. The up/down cursor keys can be used to recall previous command-lines. The 'history' option can be set to diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index fd71067542..a358da460c 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -26,13 +26,14 @@ the differences. - Syntax highlighting is enabled by default - ":filetype plugin indent on" is enabled by default -- 'autoindent' is set by default -- 'autoread' is set by default -- 'background' always defaults to "dark" +- 'autoindent' is enabled +- 'autoread' is enabled +- 'background' defaults to "dark" (unless set automatically by the terminal/UI) - 'backspace' defaults to "indent,eol,start" - 'backupdir' defaults to .,~/.local/share/nvim/backup (|xdg|) - 'belloff' defaults to "all" -- 'complete' doesn't include "i" +- 'compatible' is always disabled +- 'complete' excludes "i" - 'cscopeverbose' is enabled - 'directory' defaults to ~/.local/share/nvim/swap// (|xdg|), auto-created - 'display' defaults to "lastline,msgsep" @@ -41,27 +42,31 @@ the differences. - 'formatoptions' defaults to "tcqj" - 'fsync' is disabled - 'history' defaults to 10000 (the maximum) -- 'hlsearch' is set by default -- 'incsearch' is set by default -- 'langnoremap' is enabled by default -- 'langremap' is disabled by default +- 'hlsearch' is enabled +- 'incsearch' is enabled +- 'langnoremap' is enabled +- 'langremap' is disabled - 'laststatus' defaults to 2 (statusline is always shown) - 'listchars' defaults to "tab:> ,trail:-,nbsp:+" -- 'nocompatible' is always set - 'nrformats' defaults to "bin,hex" -- 'ruler' is set by default -- 'sessionoptions' doesn't include "options" +- 'ruler' is enabled +- 'sessionoptions' excludes "options" - 'shortmess' includes "F", excludes "S" -- 'showcmd' is set by default +- 'showcmd' is enabled - 'sidescroll' defaults to 1 -- 'smarttab' is set by default +- 'smarttab' is enabled - 'tabpagemax' defaults to 50 - 'tags' defaults to "./tags;,tags" - 'ttimeoutlen' defaults to 50 - 'ttyfast' is always set - 'undodir' defaults to ~/.local/share/nvim/undo (|xdg|), auto-created - 'viminfo' includes "!" -- 'wildmenu' is set by default +- 'wildmenu' is enabled +- 'wildoptions' defaults to "pum,tagfile" + +- The |man.vim| plugin is enabled, to provide the |:Man| command. +- The |matchit| plugin is enabled. To disable it in your config: > + :let loaded_matchit = 1 ============================================================================== 3. New Features *nvim-features* @@ -305,6 +310,9 @@ other arguments if used). |input()| and |inputdialog()| support user-defined cmdline highlighting. +Commands: + |:doautocmd| does not warn about "No matching autocommands". + Highlight groups: |hl-ColorColumn|, |hl-CursorColumn| are lower priority than most other groups diff --git a/runtime/doc/visual.txt b/runtime/doc/visual.txt index 252a1ca8b8..ccbbc092ec 100644 --- a/runtime/doc/visual.txt +++ b/runtime/doc/visual.txt @@ -103,6 +103,8 @@ gn Search forward for the last used search pattern, like E.g., "dgn" deletes the text of the next match. If Visual mode is active, extends the selection until the end of the next match. + Note: Unlike `n` the search direction does not depend + on the previous search command. *gN* *v_gN* gN Like |gn| but searches backward, like with `N`. @@ -290,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 63ffd91bfc..76bb096ee3 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -64,6 +64,10 @@ will not change within a Vim session. The |win_getid()| and |win_id2tabwin()| functions can be used to convert between the window/tab number and the identifier. There is also the window number, which may change whenever windows are opened or closed, see |winnr()|. +The window number is only valid in one specific tab. The window ID is valid +across tabs. For most functions that take a window ID or a window number, the +window number only applies to the current tab, while the window ID can refer +to a window in any tab. Each buffer has a unique number and the number will not change within a Vim session. The |bufnr()| and |bufname()| functions can be used to convert @@ -134,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* @@ -188,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. @@ -401,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 @@ -520,9 +527,6 @@ CTRL-W > Increase current window width by N (default 1). :vertical res[ize] [N] *:vertical-resize* *CTRL-W_bar* CTRL-W | Set current window width to N (default: widest possible). - *:mod* *:mode* -:mod[e] Detects the screen size and redraws the screen. - You can also resize a window by dragging a status line up or down with the mouse. Or by dragging a vertical separator line left or right. This only works if the version of Vim that is being used supports the mouse and the @@ -634,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 @@ -781,30 +787,28 @@ 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`. + +CTRL-W gT *CTRL-W_gT* + Go to previous tab page, same as `gT`. Also see |CTRL-W_CTRL-I|: open window for an included file that includes the keyword under the cursor. @@ -815,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 @@ -942,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 @@ -1147,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. @@ -1168,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 a670f54898..4cc2f49a63 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2018 Feb 14 +" Last Change: 2019 Jul 27 " Listen very carefully, I will say this only once if exists("did_load_filetypes") @@ -42,6 +42,8 @@ endif " Function used for patterns that end in a star: don't set the filetype if the " file name matches ft_ignore_pat. +" When using this, the entry should probably be further down below with the +" other StarSetf() calls. func! s:StarSetf(ft) if expand("<amatch>") !~ g:ft_ignore_pat exe 'setf ' . a:ft @@ -54,6 +56,9 @@ au BufNewFile,BufRead $VIMRUNTIME/doc/*.txt setf help " Abaqus or Trasys au BufNewFile,BufRead *.inp call dist#ft#Check_inp() +" 8th (Firth-derivative) +au BufNewFile,BufRead *.8th setf 8th + " A-A-P recipe au BufNewFile,BufRead *.aap setf aap @@ -88,11 +93,9 @@ au BufNewFile,BufRead build.xml setf ant " Arduino au BufNewFile,BufRead *.ino,*.pde setf arduino -" Apache style config file -au BufNewFile,BufRead proftpd.conf* call s:StarSetf('apachestyle') - " Apache config file au BufNewFile,BufRead .htaccess,*/etc/httpd/*.conf setf apache +au BufNewFile,BufRead */etc/apache2/sites-*/*.com setf apache " XA65 MOS6510 cross assembler au BufNewFile,BufRead *.a65 setf a65 @@ -647,7 +650,6 @@ au BufNewFile,BufRead gnashrc,.gnashrc,gnashpluginrc,.gnashpluginrc setf gnash " Gitolite au BufNewFile,BufRead gitolite.conf setf gitolite -au BufNewFile,BufRead */gitolite-admin/conf/* call s:StarSetf('gitolite') au BufNewFile,BufRead {,.}gitolite.rc,example.gitolite.rc setf perl " Gnuplot scripts @@ -796,7 +798,6 @@ au BufNewFile,BufRead *.jsp setf jsp " Java Properties resource file (note: doesn't catch font.properties.pl) au BufNewFile,BufRead *.properties,*.properties_??,*.properties_??_?? setf jproperties -au BufNewFile,BufRead *.properties_??_??_* call s:StarSetf('jproperties') " Jess au BufNewFile,BufRead *.clp setf jess @@ -1169,6 +1170,10 @@ au BufNewFile,BufRead *.rcp setf pilrc " Pine config au BufNewFile,BufRead .pinerc,pinerc,.pinercex,pinercex setf pine +" Pipenv Pipfiles +au BufNewFile,BufRead Pipfile setf config +au BufNewFile,BufRead Pipfile.lock setf json + " PL/1, PL/I au BufNewFile,BufRead *.pli,*.pl1 setf pli @@ -1454,7 +1459,6 @@ au BufNewFile,BufRead *.decl,*.dcl,*.dec " SGML catalog file au BufNewFile,BufRead catalog setf catalog -au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog') " Shell scripts (sh, ksh, bash, bash2, csh); Allow .profile_foo etc. " Gentoo ebuilds and Arch Linux PKGBUILDs are actually bash scripts @@ -1609,6 +1613,10 @@ au BufNewFile,BufRead */etc/sysctl.conf,*/etc/sysctl.d/*.conf setf sysctl " Systemd unit files au BufNewFile,BufRead */systemd/*.{automount,mount,path,service,socket,swap,target,timer} setf systemd +" Systemd overrides +au BufNewFile,BufRead /etc/systemd/system/*.d/*.conf setf systemd +" Systemd temp files +au BufNewFile,BufRead /etc/systemd/system/*.d/.#* setf systemd " Synopsys Design Constraints au BufNewFile,BufRead *.sdc setf sdc @@ -1737,7 +1745,6 @@ au BufNewFile,BufRead *.sv,*.svh setf systemverilog " VHDL au BufNewFile,BufRead *.hdl,*.vhd,*.vhdl,*.vbe,*.vst setf vhdl -au BufNewFile,BufRead *.vhdl_[0-9]* call s:StarSetf('vhdl') " Vim script au BufNewFile,BufRead *.vim,*.vba,.exrc,_exrc setf vim @@ -1768,12 +1775,15 @@ au BufNewFile,BufRead *.wrl setf vrml " Vroom (vim testing and executable documentation) au BufNewFile,BufRead *.vroom setf vroom -" Webmacro -au BufNewFile,BufRead *.wm setf webmacro +" Vue.js Single File Component +au BufNewFile,BufRead *.vue setf vue " WebAssembly au BufNewFile,BufRead *.wast,*.wat setf wast +" Webmacro +au BufNewFile,BufRead *.wm setf webmacro + " Wget config au BufNewFile,BufRead .wgetrc,wgetrc setf wget @@ -1859,7 +1869,8 @@ au BufNewFile,BufRead *.xmi setf xml au BufNewFile,BufRead *.csproj,*.csproj.user setf xml " Qt Linguist translation source and Qt User Interface Files are XML -au BufNewFile,BufRead *.ts,*.ui setf xml +" However, for .ts Typescript is more common. +au BufNewFile,BufRead *.ui setf xml " TPM's are RDF-based descriptions of TeX packages (Nikolai Weibull) au BufNewFile,BufRead *.tpm setf xml @@ -1950,6 +1961,7 @@ au StdinReadPost * if !did_filetype() | runtime! scripts.vim | endif " More Apache style config files au BufNewFile,BufRead */etc/proftpd/*.conf*,*/etc/proftpd/conf.*/* call s:StarSetf('apachestyle') +au BufNewFile,BufRead proftpd.conf* call s:StarSetf('apachestyle') " More Apache config files au BufNewFile,BufRead access.conf*,apache.conf*,apache2.conf*,httpd.conf*,srm.conf* call s:StarSetf('apache') @@ -2006,6 +2018,12 @@ au BufNewFile,BufRead *fvwm2rc* " Gedcom au BufNewFile,BufRead */tmp/lltmp* call s:StarSetf('gedcom') +" Git +au BufNewFile,BufRead */.gitconfig.d/*,/etc/gitconfig.d/* call s:StarSetf('gitconfig') + +" Gitolite +au BufNewFile,BufRead */gitolite-admin/conf/* call s:StarSetf('gitolite') + " GTK RC au BufNewFile,BufRead .gtkrc*,gtkrc* call s:StarSetf('gtkrc') @@ -2018,6 +2036,9 @@ au! BufNewFile,BufRead *jarg* \| call s:StarSetf('jargon') \|endif +" Java Properties resource file (note: doesn't catch font.properties.pl) +au BufNewFile,BufRead *.properties_??_??_* call s:StarSetf('jproperties') + " Kconfig au BufNewFile,BufRead Kconfig.* call s:StarSetf('kconfig') @@ -2079,6 +2100,9 @@ au BufRead,BufNewFile *.rdf call dist#ft#Redif() " Remind au BufNewFile,BufRead .reminders* call s:StarSetf('remind') +" SGML catalog file +au BufNewFile,BufRead sgml.catalog* call s:StarSetf('catalog') + " Shell scripts ending in a star au BufNewFile,BufRead .bashrc*,.bash[_-]profile*,.bash[_-]logout*,.bash[_-]aliases*,bash-fc[-.]*,,PKGBUILD* call dist#ft#SetFileTypeSH("bash") au BufNewFile,BufRead .kshrc* call dist#ft#SetFileTypeSH("ksh") @@ -2090,6 +2114,9 @@ au BufNewFile,BufRead .tcshrc* call dist#ft#SetFileTypeShell("tcsh") " csh scripts ending in a star au BufNewFile,BufRead .login*,.cshrc* call dist#ft#CSH() +" VHDL +au BufNewFile,BufRead *.vhdl_[0-9]* call s:StarSetf('vhdl') + " Vim script au BufNewFile,BufRead *vimrc* call s:StarSetf('vim') diff --git a/runtime/ftplugin/8th.vim b/runtime/ftplugin/8th.vim new file mode 100644 index 0000000000..14301187d6 --- /dev/null +++ b/runtime/ftplugin/8th.vim @@ -0,0 +1,25 @@ +" Vim ftplugin file +" Language: 8th +" Version: any +" Last Change: 2015/11/08 +" Maintainer: Ron Aaron <ron@aaron-tech.com> +" URL: https://8th-dev.com/ +" Filetypes: *.8th +" NOTE: 8th allows any non-whitespace in a name, so you need to do: +" setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255 +" This goes with the syntax/8th.vim file. + +" Only do this when not done yet for this buffer +if exists("b:did_8thplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_8thplugin = 1 + +setlocal ts=2 sts=2 sw=2 et +setlocal com=s1:/*,mb:*,ex:*/,:\|,:\\ +setlocal fo=tcrqol +setlocal matchpairs+=\::; +setlocal iskeyword=!,@,33-35,%,$,38-64,A-Z,91-96,a-z,123-126,128-255 +setlocal suffixesadd=.8th diff --git a/runtime/ftplugin/bash.vim b/runtime/ftplugin/bash.vim new file mode 100644 index 0000000000..a3d01fc2ad --- /dev/null +++ b/runtime/ftplugin/bash.vim @@ -0,0 +1,31 @@ +" Vim filetype plugin file +" Language: bash +" Maintainer: Bram Moolenaar +" Last Changed: 2019 Jan 12 +" +" This is not a real filetype plugin. It allows for someone to set 'filetype' +" to "bash" in the modeline, and gets the effect of filetype "sh" with +" b:is_bash set. Idea from Mahmode Al-Qudsi. + +if exists("b:did_ftplugin") + finish +endif + +let b:is_bash = 1 +if exists("b:is_sh") + unlet b:is_sh +endif +if exists("b:is_kornshell") + unlet b:is_kornshell +endif + +" Setting 'filetype' here directly won't work, since we are being invoked +" through an autocommand. Do it later, on the BufWinEnter event. +augroup bash_filetype + au BufWinEnter * call SetBashFt() +augroup END + +func SetBashFt() + au! bash_filetype + set ft=sh +endfunc diff --git a/runtime/ftplugin/cfg.vim b/runtime/ftplugin/cfg.vim new file mode 100644 index 0000000000..b5835ba7a9 --- /dev/null +++ b/runtime/ftplugin/cfg.vim @@ -0,0 +1,19 @@ +" Vim filetype plugin file +" Language: Configuration File +" Maintainer: Christian Brabandt <cb@256bit.org> +" Latest Revision: 2018-12-24 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +let s:cpo_save = &cpo +set cpo&vim + +let b:undo_ftplugin = "setl cms< fo<" + +setlocal commentstring=#\ %s formatoptions-=t formatoptions+=croql + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/ftplugin/cobol.vim b/runtime/ftplugin/cobol.vim index 11ad3ad727..d96a1bf281 100644 --- a/runtime/ftplugin/cobol.vim +++ b/runtime/ftplugin/cobol.vim @@ -1,7 +1,8 @@ " Vim filetype plugin file " Language: cobol -" Author: Tim Pope <vimNOSPAM@tpope.info> -" Last Update: By ZyX: use shiftwidth() +" Maintainer: Ankit Jain <ajatkj@yahoo.co.in> +" (formerly Tim Pope <vimNOSPAM@tpope.info>) +" Last Update: By Ankit Jain (changed maintainer) on 22.03.2019 " Insert mode mappings: <C-T> <C-D> <Tab> " Normal mode mappings: < > << >> [[ ]] [] ][ diff --git a/runtime/ftplugin/dosbatch.vim b/runtime/ftplugin/dosbatch.vim index dbc02d80f8..070bdc4ba2 100644 --- a/runtime/ftplugin/dosbatch.vim +++ b/runtime/ftplugin/dosbatch.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: MS-DOS .bat files " Maintainer: Mike Williams <mrw@eandem.co.uk> -" Last Change: 8th May 2012 +" Last Change: 14th April 2019 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -16,6 +16,7 @@ set cpo&vim " BAT comment formatting setlocal comments=b:rem,b:@rem,b:REM,b:@REM,::: +setlocal commentstring=::\ %s setlocal formatoptions-=t formatoptions+=rol " Define patterns for the browse file filter diff --git a/runtime/ftplugin/dune.vim b/runtime/ftplugin/dune.vim new file mode 100644 index 0000000000..8b1f8b4125 --- /dev/null +++ b/runtime/ftplugin/dune.vim @@ -0,0 +1,20 @@ +" Language: Dune buildsystem +" Maintainer: Markus Mottl <markus.mottl@gmail.com> +" Anton Kochkov <anton.kochkov@gmail.com> +" URL: https://github.com/rgrinberg/vim-ocaml +" Last Change: +" 2018 Nov 3 - Added commentstring (Markus Mottl) +" 2017 Sep 6 - Initial version (Etienne Millon) + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin=1 + +set lisp + +" Comment string +setl commentstring=;\ %s +setl comments=:; + +setl iskeyword+=#,?,.,/ diff --git a/runtime/ftplugin/eruby.vim b/runtime/ftplugin/eruby.vim index 32f3fb868f..3c18bada78 100644 --- a/runtime/ftplugin/eruby.vim +++ b/runtime/ftplugin/eruby.vim @@ -3,6 +3,7 @@ " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2019 Jan 06 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -27,7 +28,7 @@ elseif !exists("b:eruby_subtype") let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$") let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+') if b:eruby_subtype == '' - let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$') + let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\|\.example\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$') endif if b:eruby_subtype == 'rhtml' let b:eruby_subtype = 'html' @@ -45,7 +46,7 @@ elseif !exists("b:eruby_subtype") endif endif -if exists("b:eruby_subtype") && b:eruby_subtype != '' +if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=? 'eruby' exe "runtime! ftplugin/".b:eruby_subtype.".vim ftplugin/".b:eruby_subtype."_*.vim ftplugin/".b:eruby_subtype."/*.vim" else runtime! ftplugin/html.vim ftplugin/html_*.vim ftplugin/html/*.vim @@ -66,6 +67,21 @@ if exists("b:match_words") unlet b:match_words endif +let s:cfilemap = v:version >= 704 ? maparg('<Plug><cfile>', 'c', 0, 1) : {} +if !get(s:cfilemap, 'buffer') || !s:cfilemap.expr || s:cfilemap.rhs =~# 'ErubyAtCursor()' + let s:cfilemap = {} +endif +if !has_key(s:cfilemap, 'rhs') + let s:cfilemap.rhs = "substitute(&l:inex =~# '\\<v:fname\\>' && len(expand('<cfile>')) ? eval(substitute(&l:inex, '\\<v:fname\\>', '\\=string(expand(\"<cfile>\"))', 'g')) : '', '^$', \"\\022\\006\",'')" +endif +let s:ctagmap = v:version >= 704 ? maparg('<Plug><ctag>', 'c', 0, 1) : {} +if !get(s:ctagmap, 'buffer') || !s:ctagmap.expr || s:ctagmap.rhs =~# 'ErubyAtCursor()' + let s:ctagmap = {} +endif +let s:include = &l:include +let s:path = &l:path +let s:suffixesadd = &l:suffixesadd + runtime! ftplugin/ruby.vim ftplugin/ruby_*.vim ftplugin/ruby/*.vim let b:did_ftplugin = 1 @@ -80,6 +96,15 @@ if exists("b:match_words") let s:match_words = b:match_words . ',' . s:match_words endif +if len(s:include) + let &l:include = s:include +endif +let &l:path = s:path . (s:path =~# ',$\|^$' ? '' : ',') . &l:path +let &l:suffixesadd = s:suffixesadd . (s:suffixesadd =~# ',$\|^$' ? '' : ',') . &l:suffixesadd +exe 'cmap <buffer><script><expr> <Plug><cfile> ErubyAtCursor() ? ' . maparg('<Plug><cfile>', 'c') . ' : ' . s:cfilemap.rhs +exe 'cmap <buffer><script><expr> <Plug><ctag> ErubyAtCursor() ? ' . maparg('<Plug><ctag>', 'c') . ' : ' . get(s:ctagmap, 'rhs', '"\022\027"') +unlet s:cfilemap s:ctagmap s:include s:path s:suffixesadd + " Change the browse dialog on Win32 to show mainly eRuby-related files if has("gui_win32") let b:browsefilter="eRuby Files (*.erb, *.rhtml)\t*.erb;*.rhtml\n" . s:browsefilter @@ -99,4 +124,9 @@ let b:undo_ftplugin = "setl cms< " let &cpo = s:save_cpo unlet s:save_cpo +function! ErubyAtCursor() abort + let groups = map(['erubyBlock', 'erubyComment', 'erubyExpression', 'erubyOneLiner'], 'hlID(v:val)') + return !empty(filter(synstack(line('.'), col('.')), 'index(groups, v:val) >= 0')) +endfunction + " vim: nowrap sw=2 sts=2 ts=8: diff --git a/runtime/ftplugin/help.vim b/runtime/ftplugin/help.vim index 0f448bd306..a6a6652b2f 100644 --- a/runtime/ftplugin/help.vim +++ b/runtime/ftplugin/help.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: Vim help file " Previous Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2008-07-09 +" Latest Revision: 2018-12-29 if exists("b:did_ftplugin") finish diff --git a/runtime/ftplugin/logcheck.vim b/runtime/ftplugin/logcheck.vim index 7d4671d875..9d664b2d09 100644 --- a/runtime/ftplugin/logcheck.vim +++ b/runtime/ftplugin/logcheck.vim @@ -1,16 +1,16 @@ " Vim filetype plugin file " Language: Logcheck -" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> -" Last Change: 2012 Jan 15 +" Maintainer: Debian Vim Maintainers +" Last Change: 2018 Dec 27 " License: Vim License -" URL: http://hg.debian.org/hg/pkg-vim/vim/file/unstable/runtime/ftplugin/logcheck.vim +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/ftplugin/logcheck.vim -if exists("b:did_ftplugin") +if exists('b:did_ftplugin') finish endif let b:did_ftplugin = 1 -let b:undo_ftplugin = "setl fo<" +let b:undo_ftplugin = 'setl fo<' " Do not hard-wrap non-comment lines since each line is a self-contained " regular expression diff --git a/runtime/ftplugin/make.vim b/runtime/ftplugin/make.vim index fb180c0e5f..bfa8703082 100644 --- a/runtime/ftplugin/make.vim +++ b/runtime/ftplugin/make.vim @@ -1,7 +1,7 @@ " Vim filetype plugin file " Language: Make " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2013 Apr 22 +" Last Change: 2019 Apr 02 " Only do this when not done yet for this buffer if exists("b:did_ftplugin") @@ -27,7 +27,7 @@ setlocal commentstring=#\ %s " Including files. let &l:include = '^\s*include' -" For matchit.vim, suggested by Albert Netymk. +" For matchit.vim, suggested by Albert Netymk and Ken Takata. if exists("loaded_matchit") - let b:match_words = '\<if\(n\)\=\(eq\|def\)\>:\<else\>:\<endif\>,\<define\>:\<endef\>' + let b:match_words = '^ *ifn\=\(eq\|def\)\>:^ *else\(\s\+ifn\=\(eq\|def\)\)\=\>:^ *endif\>,\<define\>:\<endef\>,^!\s*if\(n\=def\)\=\>:^!\s*else\(if\(n\=def\)\=\)\=\>:^!\s*endif\>' endif diff --git a/runtime/ftplugin/mma.vim b/runtime/ftplugin/mma.vim new file mode 100644 index 0000000000..ce4cee18ae --- /dev/null +++ b/runtime/ftplugin/mma.vim @@ -0,0 +1,16 @@ +" Vim filetype plugin file +" Language: Mathematica +" Maintainer: Ian Ford <ianf@wolfram.com> +" Last Change: 22 January 2019 + +" Only do this when not done yet for this buffer +if exists("b:did_ftplugin") + finish +endif + +" Don't load another plugin for this buffer +let b:did_ftplugin = 1 + +let b:undo_ftplugin = "setlocal commentstring<" + +setlocal commentstring=\(*%s*\) diff --git a/runtime/ftplugin/nroff.vim b/runtime/ftplugin/nroff.vim new file mode 100644 index 0000000000..069c02e59a --- /dev/null +++ b/runtime/ftplugin/nroff.vim @@ -0,0 +1,11 @@ +" Vim filetype plugin +" Language: roff(7) +" Maintainer: Chris Spiegel <cspiegel@gmail.com> +" Last Change: 2019 Apr 24 + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +setlocal commentstring=.\\\"%s diff --git a/runtime/ftplugin/ocaml.vim b/runtime/ftplugin/ocaml.vim index 3ee7849063..d9336421cf 100644 --- a/runtime/ftplugin/ocaml.vim +++ b/runtime/ftplugin/ocaml.vim @@ -5,12 +5,12 @@ " Pierre Vittet <pierre-vittet@pvittet.com> " Stefano Zacchiroli <zack@bononia.it> " Vincent Aravantinos <firstname.name@imag.fr> -" URL: http://www.ocaml.info/vim/ftplugin/ocaml.vim +" URL: https://github.com/rgrinberg/vim-ocaml " Last Change: +" 2013 Oct 27 - Added commentstring (MM) " 2013 Jul 26 - load default compiler settings (MM) " 2013 Jul 24 - removed superfluous efm-setting (MM) " 2013 Jul 22 - applied fixes supplied by Hirotaka Hamada (MM) -" 2013 Mar 15 - Improved error format (MM) if exists("b:did_ftplugin") finish @@ -37,6 +37,10 @@ endif let s:cposet=&cpoptions set cpo&vim +" Comment string +setlocal comments= +setlocal commentstring=(*%s*) + " Add mappings, unless the user didn't want this. if !exists("no_plugin_maps") && !exists("no_ocaml_maps") " (un)commenting @@ -60,16 +64,39 @@ if !exists("no_plugin_maps") && !exists("no_ocaml_maps") endif " Let % jump between structure elements (due to Issac Trotts) -let b:mw = '' -let b:mw = b:mw . ',\<let\>:\<and\>:\(\<in\>\|;;\)' +let b:mw = '\<let\>:\<and\>:\(\<in\>\|;;\)' let b:mw = b:mw . ',\<if\>:\<then\>:\<else\>' -let b:mw = b:mw . ',\<\(for\|while\)\>:\<do\>:\<done\>,' +let b:mw = b:mw . ',\<\(for\|while\)\>:\<do\>:\<done\>' let b:mw = b:mw . ',\<\(object\|sig\|struct\|begin\)\>:\<end\>' let b:mw = b:mw . ',\<\(match\|try\)\>:\<with\>' let b:match_words = b:mw let b:match_ignorecase=0 +function! s:OcpGrep(bang,args) abort + let grepprg = &l:grepprg + let grepformat = &l:grepformat + let shellpipe = &shellpipe + try + let &l:grepprg = "ocp-grep -c never" + setlocal grepformat=%f:%l:%m + if &shellpipe ==# '2>&1| tee' || &shellpipe ==# '|& tee' + let &shellpipe = "| tee" + endif + execute 'grep! '.a:args + if empty(a:bang) && !empty(getqflist()) + return 'cfirst' + else + return '' + endif + finally + let &l:grepprg = grepprg + let &l:grepformat = grepformat + let &shellpipe = shellpipe + endtry +endfunction +command! -bar -bang -complete=file -nargs=+ Ocpgrep exe s:OcpGrep(<q-bang>, <q-args>) + " switching between interfaces (.mli) and implementations (.ml) if !exists("g:did_ocaml_switch") let g:did_ocaml_switch = 1 @@ -97,15 +124,8 @@ endif " Folding support " Get the modeline because folding depends on indentation -let s:s = line2byte(line('.'))+col('.')-1 -if search('^\s*(\*:o\?caml:') - let s:modeline = getline(".") -else - let s:modeline = "" -endif -if s:s > 0 - exe 'goto' s:s -endif +let lnum = search('^\s*(\*:o\?caml:', 'n') +let s:modeline = lnum? getline(lnum): "" " Get the indentation params let s:m = matchstr(s:modeline,'default\s*=\s*\d\+') @@ -372,8 +392,8 @@ endfunction endfun " This variable contain a dictionnary of list. Each element of the dictionnary - " represent an annotation system. An annotation system is a list with : - " - annotation file name as it's key + " represent an annotation system. An annotation system is a list with: + " - annotation file name as its key " - annotation file path as first element of the contained list " - build path as second element of the contained list " - annot_file_last_mod (contain the date of .annot file) as third element diff --git a/runtime/ftplugin/python.vim b/runtime/ftplugin/python.vim index 5c4a59b1a9..64c1a87a69 100644 --- a/runtime/ftplugin/python.vim +++ b/runtime/ftplugin/python.vim @@ -3,7 +3,7 @@ " Maintainer: Tom Picton <tom@tompicton.co.uk> " Previous Maintainer: James Sully <sullyj3@gmail.com> " Previous Maintainer: Johannes Zellner <johannes@zellner.org> -" Last Change: Sun, 15 April 2018 +" Last Change: Sun 17 Mar 2019 " https://github.com/tpict/vim-ftplugin-python if exists("b:did_ftplugin") | finish | endif @@ -37,9 +37,10 @@ setlocal suffixesadd=.py setlocal comments=b:#,fb:- setlocal commentstring=#\ %s -setlocal omnifunc=pythoncomplete#Complete if has('python3') - setlocal omnifunc=python3complete#Complete + setlocal omnifunc=python3complete#Complete +elseif has('python') + setlocal omnifunc=pythoncomplete#Complete endif set wildignore+=*.pyc @@ -53,32 +54,34 @@ let b:prev='\v^\s*(class\|def\|async def)>' let b:next_end='\v\S\n*(%$\|^(\s*\n*)*(class\|def\|async def)\|^\S)' let b:prev_end='\v\S\n*(^(\s*\n*)*(class\|def\|async def)\|^\S)' -execute "nnoremap <silent> <buffer> ]] :call <SID>Python_jump('n', '". b:next_toplevel."', 'W', v:count1)<cr>" -execute "nnoremap <silent> <buffer> [[ :call <SID>Python_jump('n', '". b:prev_toplevel."', 'Wb', v:count1)<cr>" -execute "nnoremap <silent> <buffer> ][ :call <SID>Python_jump('n', '". b:next_endtoplevel."', 'W', 0, v:count1)<cr>" -execute "nnoremap <silent> <buffer> [] :call <SID>Python_jump('n', '". b:prev_endtoplevel."', 'Wb', 0, v:count1)<cr>" -execute "nnoremap <silent> <buffer> ]m :call <SID>Python_jump('n', '". b:next."', 'W', v:count1)<cr>" -execute "nnoremap <silent> <buffer> [m :call <SID>Python_jump('n', '". b:prev."', 'Wb', v:count1)<cr>" -execute "nnoremap <silent> <buffer> ]M :call <SID>Python_jump('n', '". b:next_end."', 'W', 0, v:count1)<cr>" -execute "nnoremap <silent> <buffer> [M :call <SID>Python_jump('n', '". b:prev_end."', 'Wb', 0, v:count1)<cr>" - -execute "onoremap <silent> <buffer> ]] :call <SID>Python_jump('o', '". b:next_toplevel."', 'W', v:count1)<cr>" -execute "onoremap <silent> <buffer> [[ :call <SID>Python_jump('o', '". b:prev_toplevel."', 'Wb', v:count1)<cr>" -execute "onoremap <silent> <buffer> ][ :call <SID>Python_jump('o', '". b:next_endtoplevel."', 'W', 0, v:count1)<cr>" -execute "onoremap <silent> <buffer> [] :call <SID>Python_jump('o', '". b:prev_endtoplevel."', 'Wb', 0, v:count1)<cr>" -execute "onoremap <silent> <buffer> ]m :call <SID>Python_jump('o', '". b:next."', 'W', v:count1)<cr>" -execute "onoremap <silent> <buffer> [m :call <SID>Python_jump('o', '". b:prev."', 'Wb', v:count1)<cr>" -execute "onoremap <silent> <buffer> ]M :call <SID>Python_jump('o', '". b:next_end."', 'W', 0, v:count1)<cr>" -execute "onoremap <silent> <buffer> [M :call <SID>Python_jump('o', '". b:prev_end."', 'Wb', 0, v:count1)<cr>" - -execute "xnoremap <silent> <buffer> ]] :call <SID>Python_jump('x', '". b:next_toplevel."', 'W', v:count1)<cr>" -execute "xnoremap <silent> <buffer> [[ :call <SID>Python_jump('x', '". b:prev_toplevel."', 'Wb', v:count1)<cr>" -execute "xnoremap <silent> <buffer> ][ :call <SID>Python_jump('x', '". b:next_endtoplevel."', 'W', 0, v:count1)<cr>" -execute "xnoremap <silent> <buffer> [] :call <SID>Python_jump('x', '". b:prev_endtoplevel."', 'Wb', 0, v:count1)<cr>" -execute "xnoremap <silent> <buffer> ]m :call <SID>Python_jump('x', '". b:next."', 'W', v:count1)<cr>" -execute "xnoremap <silent> <buffer> [m :call <SID>Python_jump('x', '". b:prev."', 'Wb', v:count1)<cr>" -execute "xnoremap <silent> <buffer> ]M :call <SID>Python_jump('x', '". b:next_end."', 'W', 0, v:count1)<cr>" -execute "xnoremap <silent> <buffer> [M :call <SID>Python_jump('x', '". b:prev_end."', 'Wb', 0, v:count1)<cr>" +if !exists('g:no_plugin_maps') && !exists('g:no_python_maps') + execute "nnoremap <silent> <buffer> ]] :call <SID>Python_jump('n', '". b:next_toplevel."', 'W', v:count1)<cr>" + execute "nnoremap <silent> <buffer> [[ :call <SID>Python_jump('n', '". b:prev_toplevel."', 'Wb', v:count1)<cr>" + execute "nnoremap <silent> <buffer> ][ :call <SID>Python_jump('n', '". b:next_endtoplevel."', 'W', v:count1, 0)<cr>" + execute "nnoremap <silent> <buffer> [] :call <SID>Python_jump('n', '". b:prev_endtoplevel."', 'Wb', v:count1, 0)<cr>" + execute "nnoremap <silent> <buffer> ]m :call <SID>Python_jump('n', '". b:next."', 'W', v:count1)<cr>" + execute "nnoremap <silent> <buffer> [m :call <SID>Python_jump('n', '". b:prev."', 'Wb', v:count1)<cr>" + execute "nnoremap <silent> <buffer> ]M :call <SID>Python_jump('n', '". b:next_end."', 'W', v:count1, 0)<cr>" + execute "nnoremap <silent> <buffer> [M :call <SID>Python_jump('n', '". b:prev_end."', 'Wb', v:count1, 0)<cr>" + + execute "onoremap <silent> <buffer> ]] :call <SID>Python_jump('o', '". b:next_toplevel."', 'W', v:count1)<cr>" + execute "onoremap <silent> <buffer> [[ :call <SID>Python_jump('o', '". b:prev_toplevel."', 'Wb', v:count1)<cr>" + execute "onoremap <silent> <buffer> ][ :call <SID>Python_jump('o', '". b:next_endtoplevel."', 'W', v:count1, 0)<cr>" + execute "onoremap <silent> <buffer> [] :call <SID>Python_jump('o', '". b:prev_endtoplevel."', 'Wb', v:count1, 0)<cr>" + execute "onoremap <silent> <buffer> ]m :call <SID>Python_jump('o', '". b:next."', 'W', v:count1)<cr>" + execute "onoremap <silent> <buffer> [m :call <SID>Python_jump('o', '". b:prev."', 'Wb', v:count1)<cr>" + execute "onoremap <silent> <buffer> ]M :call <SID>Python_jump('o', '". b:next_end."', 'W', v:count1, 0)<cr>" + execute "onoremap <silent> <buffer> [M :call <SID>Python_jump('o', '". b:prev_end."', 'Wb', v:count1, 0)<cr>" + + execute "xnoremap <silent> <buffer> ]] :call <SID>Python_jump('x', '". b:next_toplevel."', 'W', v:count1)<cr>" + execute "xnoremap <silent> <buffer> [[ :call <SID>Python_jump('x', '". b:prev_toplevel."', 'Wb', v:count1)<cr>" + execute "xnoremap <silent> <buffer> ][ :call <SID>Python_jump('x', '". b:next_endtoplevel."', 'W', v:count1, 0)<cr>" + execute "xnoremap <silent> <buffer> [] :call <SID>Python_jump('x', '". b:prev_endtoplevel."', 'Wb', v:count1, 0)<cr>" + execute "xnoremap <silent> <buffer> ]m :call <SID>Python_jump('x', '". b:next."', 'W', v:count1)<cr>" + execute "xnoremap <silent> <buffer> [m :call <SID>Python_jump('x', '". b:prev."', 'Wb', v:count1)<cr>" + execute "xnoremap <silent> <buffer> ]M :call <SID>Python_jump('x', '". b:next_end."', 'W', v:count1, 0)<cr>" + execute "xnoremap <silent> <buffer> [M :call <SID>Python_jump('x', '". b:prev_end."', 'Wb', v:count1, 0)<cr>" +endif if !exists('*<SID>Python_jump') fun! <SID>Python_jump(mode, motion, flags, count, ...) range @@ -123,10 +126,80 @@ if !exists('g:pydoc_executable') let g:pydoc_executable = 0 endif endif + +" Windows-specific pydoc setup +if has('win32') || has('win64') + if executable('python') + " available as Tools\scripts\pydoc.py + let g:pydoc_executable = 1 + else + let g:pydoc_executable = 0 + endif +endif + " If "pydoc" was found use it for keywordprg. if g:pydoc_executable - setlocal keywordprg=pydoc + if has('win32') || has('win64') + setlocal keywordprg=python\ -m\ pydoc\ + else + setlocal keywordprg=pydoc + endif endif +" Script for filetype switching to undo the local stuff we may have changed +let b:undo_ftplugin = 'setlocal cinkeys<' + \ . '|setlocal comments<' + \ . '|setlocal commentstring<' + \ . '|setlocal expandtab<' + \ . '|setlocal include<' + \ . '|setlocal includeexpr<' + \ . '|setlocal indentkeys<' + \ . '|setlocal keywordprg<' + \ . '|setlocal omnifunc<' + \ . '|setlocal shiftwidth<' + \ . '|setlocal softtabstop<' + \ . '|setlocal suffixesadd<' + \ . '|setlocal tabstop<' + \ . '|silent! nunmap <buffer> [M' + \ . '|silent! nunmap <buffer> [[' + \ . '|silent! nunmap <buffer> []' + \ . '|silent! nunmap <buffer> [m' + \ . '|silent! nunmap <buffer> ]M' + \ . '|silent! nunmap <buffer> ][' + \ . '|silent! nunmap <buffer> ]]' + \ . '|silent! nunmap <buffer> ]m' + \ . '|silent! ounmap <buffer> [M' + \ . '|silent! ounmap <buffer> [[' + \ . '|silent! ounmap <buffer> []' + \ . '|silent! ounmap <buffer> [m' + \ . '|silent! ounmap <buffer> ]M' + \ . '|silent! ounmap <buffer> ][' + \ . '|silent! ounmap <buffer> ]]' + \ . '|silent! ounmap <buffer> ]m' + \ . '|silent! xunmap <buffer> [M' + \ . '|silent! xunmap <buffer> [[' + \ . '|silent! xunmap <buffer> []' + \ . '|silent! xunmap <buffer> [m' + \ . '|silent! xunmap <buffer> ]M' + \ . '|silent! xunmap <buffer> ][' + \ . '|silent! xunmap <buffer> ]]' + \ . '|silent! xunmap <buffer> ]m' + \ . '|unlet! b:browsefilter' + \ . '|unlet! b:child_match' + \ . '|unlet! b:child_sub' + \ . '|unlet! b:grandparent_match' + \ . '|unlet! b:grandparent_sub' + \ . '|unlet! b:next' + \ . '|unlet! b:next_end' + \ . '|unlet! b:next_endtoplevel' + \ . '|unlet! b:next_toplevel' + \ . '|unlet! b:parent_match' + \ . '|unlet! b:parent_sub' + \ . '|unlet! b:prev' + \ . '|unlet! b:prev_end' + \ . '|unlet! b:prev_endtoplevel' + \ . '|unlet! b:prev_toplevel' + \ . '|unlet! b:undo_ftplugin' + let &cpo = s:keepcpo unlet s:keepcpo 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/ftplugin/rst.vim b/runtime/ftplugin/rst.vim index 9d737cde44..f0646e9f36 100644 --- a/runtime/ftplugin/rst.vim +++ b/runtime/ftplugin/rst.vim @@ -3,7 +3,7 @@ " Maintainer: Marshall Ward <marshall.ward@gmail.com> " Original Maintainer: Nikolai Weibull <now@bitwi.se> " Website: https://github.com/marshallward/vim-restructuredtext -" Latest Revision: 2018-01-07 +" Latest Revision: 2018-12-29 if exists("b:did_ftplugin") finish @@ -13,6 +13,11 @@ let b:did_ftplugin = 1 let s:cpo_save = &cpo set cpo&vim +"Disable folding +if !exists('g:rst_fold_enabled') + let g:rst_fold_enabled = 0 +endif + let b:undo_ftplugin = "setl com< cms< et< fo<" setlocal comments=fb:.. commentstring=..\ %s expandtab @@ -25,7 +30,7 @@ setlocal formatoptions+=tcroql " " More sophisticated indentation rules should be revisted in the future. -if !exists("g:rst_style") || g:rst_style != 0 +if exists("g:rst_style") && g:rst_style != 0 setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=8 endif diff --git a/runtime/ftplugin/ruby.vim b/runtime/ftplugin/ruby.vim index 84fb9930a4..054c35e5fa 100644 --- a/runtime/ftplugin/ruby.vim +++ b/runtime/ftplugin/ruby.vim @@ -2,8 +2,8 @@ " Language: Ruby " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby -" Release Coordinator: Doug Kearns <dougkearns@gmail.com> -" ---------------------------------------------------------------------------- +" Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2019 Jan 06 if (exists("b:did_ftplugin")) finish @@ -44,19 +44,12 @@ endif setlocal formatoptions-=t formatoptions+=croql setlocal include=^\\s*\\<\\(load\\>\\\|require\\>\\\|autoload\\s*:\\=[\"']\\=\\h\\w*[\"']\\=,\\) -setlocal includeexpr=substitute(substitute(v:fname,'::','/','g'),'\%(\.rb\)\=$','.rb','') setlocal suffixesadd=.rb if exists("&ofu") && has("ruby") setlocal omnifunc=rubycomplete#Complete endif -" To activate, :set ballooneval -if has('balloon_eval') && exists('+balloonexpr') - setlocal balloonexpr=RubyBalloonexpr() -endif - - " TODO: "setlocal define=^\\s*def @@ -69,7 +62,7 @@ endif function! s:query_path(root) abort let code = "print $:.join %q{,}" - if &shell =~# 'sh' + if &shell =~# 'sh' && empty(&shellxquote) let prefix = 'env PATH='.shellescape($PATH).' ' else let prefix = '' @@ -141,44 +134,54 @@ if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") \ "All Files (*.*)\t*.*\n" endif -let b:undo_ftplugin = "setl fo< inc< inex< sua< def< com< cms< path< tags< kp<" +let b:undo_ftplugin = "setl inc= sua= path= tags= fo< com< cms< kp=" \."| unlet! b:browsefilter b:match_ignorecase b:match_words b:match_skip" \."| if exists('&ofu') && has('ruby') | setl ofu< | endif" - \."| if has('balloon_eval') && exists('+bexpr') | setl bexpr< | endif" + +if get(g:, 'ruby_recommended_style', 1) + setlocal shiftwidth=2 softtabstop=2 expandtab + let b:undo_ftplugin .= ' | setl sw< sts< et<' +endif + +" To activate, :set ballooneval +if exists('+balloonexpr') && get(g:, 'ruby_balloonexpr') + setlocal balloonexpr=RubyBalloonexpr() + let b:undo_ftplugin .= "| setl bexpr=" +endif function! s:map(mode, flags, map) abort let from = matchstr(a:map, '\S\+') if empty(mapcheck(from, a:mode)) - exe a:mode.'map' '<buffer>'.(a:0 ? a:1 : '') a:map + exe a:mode.'map' '<buffer>' a:map let b:undo_ftplugin .= '|sil! '.a:mode.'unmap <buffer> '.from endif endfunction -cmap <buffer><script><expr> <Plug><cword> substitute(RubyCursorIdentifier(),'^$',"\022\027",'') +cmap <buffer><script><expr> <Plug><ctag> substitute(RubyCursorTag(),'^$',"\022\027",'') cmap <buffer><script><expr> <Plug><cfile> substitute(RubyCursorFile(),'^$',"\022\006",'') -let b:undo_ftplugin .= "| sil! cunmap <buffer> <Plug><cword>| sil! cunmap <buffer> <Plug><cfile>" +let b:undo_ftplugin .= "| sil! cunmap <buffer> <Plug><ctag>| sil! cunmap <buffer> <Plug><cfile>" if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps") nmap <buffer><script> <SID>: :<C-U> nmap <buffer><script> <SID>c: :<C-U><C-R>=v:count ? v:count : ''<CR> - nnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','b','n')<CR> - nnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','','n')<CR> - nnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','b','n')<CR> - nnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','','n')<CR> - xnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','b','v')<CR> - xnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>','rubyDefine','','v')<CR> - xnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','b','v')<CR> - xnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>','rubyDefine','','v')<CR> - - nnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','b','n')<CR> - nnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','','n')<CR> - nnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','b','n')<CR> - nnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','','n')<CR> - xnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','b','v')<CR> - xnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>','rubyModule\<Bar>rubyClass','','v')<CR> - xnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','b','v')<CR> - xnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>','rubyModule\<Bar>rubyClass','','v')<CR> + nnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'b','n')<CR> + nnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'','n')<CR> + nnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'b','n')<CR> + nnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'','n')<CR> + xnoremap <silent> <buffer> [m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'b','v')<CR> + xnoremap <silent> <buffer> ]m :<C-U>call <SID>searchsyn('\<def\>',['rubyDefine'],'','v')<CR> + xnoremap <silent> <buffer> [M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'b','v')<CR> + xnoremap <silent> <buffer> ]M :<C-U>call <SID>searchsyn('\<end\>',['rubyDefine'],'','v')<CR> + + nnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'b','n')<CR> + nnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'','n')<CR> + nnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'b','n')<CR> + nnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'','n')<CR> + xnoremap <silent> <buffer> [[ :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'b','v')<CR> + xnoremap <silent> <buffer> ]] :<C-U>call <SID>searchsyn('\<\%(class\<Bar>module\)\>',['rubyModule','rubyClass'],'','v')<CR> + xnoremap <silent> <buffer> [] :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'b','v')<CR> + xnoremap <silent> <buffer> ][ :<C-U>call <SID>searchsyn('\<end\>',['rubyModule','rubyClass'],'','v')<CR> let b:undo_ftplugin = b:undo_ftplugin \."| sil! exe 'unmap <buffer> [[' | sil! exe 'unmap <buffer> ]]' | sil! exe 'unmap <buffer> []' | sil! exe 'unmap <buffer> ]['" @@ -204,19 +207,18 @@ if !exists("g:no_plugin_maps") && !exists("g:no_ruby_maps") \."| sil! exe 'xunmap <buffer> iM' | sil! exe 'xunmap <buffer> aM'" endif - call s:map('c', '', '<C-R><C-W> <Plug><cword>') call s:map('c', '', '<C-R><C-F> <Plug><cfile>') cmap <buffer><script><expr> <SID>tagzv &foldopen =~# 'tag' ? '<Bar>norm! zv' : '' - call s:map('n', '<silent>', '<C-]> <SID>:exe v:count1."tag <Plug><cword>"<SID>tagzv<CR>') - call s:map('n', '<silent>', 'g<C-]> <SID>:exe "tjump <Plug><cword>"<SID>tagzv<CR>') - call s:map('n', '<silent>', 'g] <SID>:exe "tselect <Plug><cword>"<SID>tagzv<CR>') - call s:map('n', '<silent>', '<C-W>] <SID>:exe v:count1."stag <Plug><cword>"<SID>tagzv<CR>') - call s:map('n', '<silent>', '<C-W><C-]> <SID>:exe v:count1."stag <Plug><cword>"<SID>tagzv<CR>') - call s:map('n', '<silent>', '<C-W>g<C-]> <SID>:exe "stjump <Plug><cword>"<SID>tagzv<CR>') - call s:map('n', '<silent>', '<C-W>g] <SID>:exe "stselect <Plug><cword>"<SID>tagzv<CR>') - call s:map('n', '<silent>', '<C-W>} <SID>:exe v:count1."ptag <Plug><cword>"<CR>') - call s:map('n', '<silent>', '<C-W>g} <SID>:exe "ptjump <Plug><cword>"<CR>') + call s:map('n', '<silent>', '<C-]> <SID>:exe v:count1."tag <Plug><ctag>"<SID>tagzv<CR>') + call s:map('n', '<silent>', 'g<C-]> <SID>:exe "tjump <Plug><ctag>"<SID>tagzv<CR>') + call s:map('n', '<silent>', 'g] <SID>:exe "tselect <Plug><ctag>"<SID>tagzv<CR>') + call s:map('n', '<silent>', '<C-W>] <SID>:exe v:count1."stag <Plug><ctag>"<SID>tagzv<CR>') + call s:map('n', '<silent>', '<C-W><C-]> <SID>:exe v:count1."stag <Plug><ctag>"<SID>tagzv<CR>') + call s:map('n', '<silent>', '<C-W>g<C-]> <SID>:exe "stjump <Plug><ctag>"<SID>tagzv<CR>') + call s:map('n', '<silent>', '<C-W>g] <SID>:exe "stselect <Plug><ctag>"<SID>tagzv<CR>') + call s:map('n', '<silent>', '<C-W>} <SID>:exe v:count1."ptag <Plug><ctag>"<CR>') + call s:map('n', '<silent>', '<C-W>g} <SID>:exe "ptjump <Plug><ctag>"<CR>') call s:map('n', '<silent>', 'gf <SID>c:find <Plug><cfile><CR>') call s:map('n', '<silent>', '<C-W>f <SID>c:sfind <Plug><cfile><CR>') @@ -288,12 +290,13 @@ function! s:searchsyn(pattern, syn, flags, mode) abort norm! gv endif let i = 0 + call map(a:syn, 'hlID(v:val)') while i < cnt let i = i + 1 let line = line('.') let col = col('.') let pos = search(a:pattern,'W'.a:flags) - while pos != 0 && s:synname() !~# a:syn + while pos != 0 && index(a:syn, s:synid()) < 0 let pos = search(a:pattern,'W'.a:flags) endwhile if pos == 0 @@ -303,8 +306,8 @@ function! s:searchsyn(pattern, syn, flags, mode) abort endwhile endfunction -function! s:synname() abort - return synIDattr(synID(line('.'),col('.'),0),'name') +function! s:synid() abort + return synID(line('.'),col('.'),0) endfunction function! s:wrap_i(back,forward) abort @@ -349,6 +352,10 @@ function! RubyCursorIdentifier() abort return stripped == '' ? expand("<cword>") : stripped endfunction +function! RubyCursorTag() abort + return substitute(RubyCursorIdentifier(), '^[$@]*', '', '') +endfunction + function! RubyCursorFile() abort let isfname = &isfname try @@ -360,8 +367,9 @@ function! RubyCursorFile() abort let pre = matchstr(strpart(getline('.'), 0, col('.')-1), '.*\f\@<!') let post = matchstr(strpart(getline('.'), col('.')), '\f\@!.*') let ext = getline('.') =~# '^\s*\%(require\%(_relative\)\=\|autoload\)\>' && cfile !~# '\.rb$' ? '.rb' : '' - if s:synname() ==# 'rubyConstant' + if s:synid() ==# hlID('rubyConstant') let cfile = substitute(cfile,'\.\w\+[?!=]\=$','','') + let cfile = substitute(cfile,'^::','','') let cfile = substitute(cfile,'::','/','g') let cfile = substitute(cfile,'\(\u\+\)\(\u\l\)','\1_\2', 'g') let cfile = substitute(cfile,'\(\l\|\d\)\(\u\)','\1_\2', 'g') diff --git a/runtime/ftplugin/sql.vim b/runtime/ftplugin/sql.vim index 4d6fcd9564..1c02a98c7c 100644 --- a/runtime/ftplugin/sql.vim +++ b/runtime/ftplugin/sql.vim @@ -400,7 +400,7 @@ endif " Predefined SQL objects what are used by the below mappings using " the ]} style maps. -" This global variable allows the users to override it's value +" This global variable allows the users to override its value " from within their vimrc. " Note, you cannot use \?, since these patterns can be used to search " backwards, you must use \{,1} @@ -486,10 +486,10 @@ if exists('&omnifunc') " OMNI function prior to setting up the SQL OMNI function let b:sql_compl_savefunc = &omnifunc - " Source it to determine it's version + " Source it to determine its version runtime autoload/sqlcomplete.vim " This is used by the sqlcomplete.vim plugin - " Source it for it's global functions + " Source it for its global functions runtime autoload/syntaxcomplete.vim setlocal omnifunc=sqlcomplete#Complete diff --git a/runtime/ftplugin/text.vim b/runtime/ftplugin/text.vim index ec84ac6f79..c4cbcb54c3 100644 --- a/runtime/ftplugin/text.vim +++ b/runtime/ftplugin/text.vim @@ -1,7 +1,7 @@ " Vim filetype plugin " Language: Text " Maintainer: David Barnett <daviebdawg+vim@gmail.com> -" Last Change: 2014 Jul 09 +" Last Change: 2019 Jan 10 if exists('b:did_ftplugin') finish @@ -12,6 +12,7 @@ let b:undo_ftplugin = 'setlocal comments< commentstring<' " We intentionally don't set formatoptions-=t since text should wrap as text. -" Pseudo comment leaders to indent bulleted lists. -setlocal comments=fb:-,fb:* +" Pseudo comment leaders to indent bulleted lists with '-' and '*'. And allow +" for Mail quoted text with '>'. +setlocal comments=fb:-,fb:*,n:> setlocal commentstring= diff --git a/runtime/ftplugin/xml.vim b/runtime/ftplugin/xml.vim index 573a6ba441..1d43521155 100644 --- a/runtime/ftplugin/xml.vim +++ b/runtime/ftplugin/xml.vim @@ -1,8 +1,8 @@ " Vim filetype plugin file -" Language: xml -" Maintainer: Christian Brabandt <cb@256bit.org> -" Last Changed: May 08th, 2018 -" Repository: https://github.com/chrisbra/vim-xml-ftplugin +" Language: xml +" Maintainer: Christian Brabandt <cb@256bit.org> +" Last Changed: Dec 07th, 2018 +" Repository: https://github.com/chrisbra/vim-xml-ftplugin " Previous Maintainer: Dan Sharp <dwsharp at users dot sourceforge dot net> " URL: http://dwsharp.users.sourceforge.net/vim/ftplugin diff --git a/runtime/indent/awk.vim b/runtime/indent/awk.vim index aad73ee71f..e65331977c 100644 --- a/runtime/indent/awk.vim +++ b/runtime/indent/awk.vim @@ -47,7 +47,7 @@ endif function! GetAwkIndent() - " Find previous line and get it's indentation + " Find previous line and get its indentation let prev_lineno = s:Get_prev_line( v:lnum ) if prev_lineno == 0 return 0 diff --git a/runtime/indent/cobol.vim b/runtime/indent/cobol.vim index c08444ac40..590a729df4 100644 --- a/runtime/indent/cobol.vim +++ b/runtime/indent/cobol.vim @@ -1,7 +1,12 @@ " Vim indent file " Language: cobol -" Author: Tim Pope <vimNOSPAM@tpope.info> +" Maintainer: Ankit Jain <ajatkj@yahoo.co.in> +" (formerly Tim Pope <vimNOSPAM@tpope.info>) " $Id: cobol.vim,v 1.1 2007/05/05 18:08:19 vimboss Exp $ +" Last Update: By Ankit Jain on 22.03.2019 +" Ankit Jain 22.03.2019 Changes & fixes: +" Allow chars in 1st 6 columns +" #C22032019 if exists("b:did_indent") finish @@ -66,7 +71,9 @@ function! GetCobolIndent(lnum) abort let ashft = minshft + 1 let bshft = ashft + 4 " (Obsolete) numbered lines - if getline(a:lnum) =~? '^\s*\d\{6\}\%($\|[ */$CD-]\)' + " #C22032019: Columns 1-6 could have alphabets as well as numbers + "if getline(a:lnum) =~? '^\s*\d\{6\}\%($\|[ */$CD-]\)' + if getline(a:lnum) =~? '^\s*[a-zA-Z0-9]\{6\}\%($\|[ */$CD-]\)' return 0 endif let cline = s:stripped(a:lnum) diff --git a/runtime/indent/cs.vim b/runtime/indent/cs.vim index 4a040b6fe2..76c12efecf 100644 --- a/runtime/indent/cs.vim +++ b/runtime/indent/cs.vim @@ -1,15 +1,73 @@ " Vim indent file -" Language: C# -" Maintainer: Johannes Zellner <johannes@zellner.org> -" Last Change: Fri, 15 Mar 2002 07:53:54 CET +" Language: C# +" Maintainer: Nick Jensen <nickspoon@gmail.com> +" Former Maintainers: Aquila Deus +" Johannes Zellner <johannes@zellner.org> +" Last Change: 2018-11-21 +" Filenames: *.cs +" License: Vim (see :h license) +" Repository: https://github.com/nickspoons/vim-cs +" " Only load this indent file when no other was loaded. -if exists("b:did_indent") - finish +if exists('b:did_indent') + finish endif let b:did_indent = 1 -" C# is like indenting C -setlocal cindent +let s:save_cpo = &cpoptions +set cpoptions&vim -let b:undo_indent = "setl cin<" + +setlocal indentexpr=GetCSIndent(v:lnum) + +function! s:IsCompilerDirective(line) + return a:line =~? '^\s*#' +endf + +function! s:IsAttributeLine(line) + return a:line =~? '^\s*\[[A-Za-z]' && a:line =~? '\]$' +endf + +function! s:FindPreviousNonCompilerDirectiveLine(start_lnum) + for delta in range(0, a:start_lnum) + let lnum = a:start_lnum - delta + let line = getline(lnum) + let is_directive = s:IsCompilerDirective(line) + if !is_directive + return lnum + endif + endfor + return 0 +endf + +function! GetCSIndent(lnum) abort + " Hit the start of the file, use zero indent. + if a:lnum == 0 + return 0 + endif + + let this_line = getline(a:lnum) + + " Compiler directives use zero indent if so configured. + let is_first_col_macro = s:IsCompilerDirective(this_line) && stridx(&l:cinkeys, '0#') >= 0 + if is_first_col_macro + return cindent(a:lnum) + endif + + let lnum = s:FindPreviousNonCompilerDirectiveLine(a:lnum - 1) + let previous_code_line = getline(lnum) + if s:IsAttributeLine(previous_code_line) + let ind = indent(lnum) + return ind + else + return cindent(a:lnum) + endif +endfunction + +let b:undo_indent = 'setlocal indentexpr<' + +let &cpoptions = s:save_cpo +unlet s:save_cpo + +" vim:et:sw=2:sts=2 diff --git a/runtime/indent/eruby.vim b/runtime/indent/eruby.vim index 5058325495..6ff15ab958 100644 --- a/runtime/indent/eruby.vim +++ b/runtime/indent/eruby.vim @@ -3,6 +3,7 @@ " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2019 Jan 06 if exists("b:did_indent") finish @@ -12,7 +13,7 @@ runtime! indent/ruby.vim unlet! b:did_indent setlocal indentexpr= -if exists("b:eruby_subtype") +if exists("b:eruby_subtype") && b:eruby_subtype != '' && b:eruby_subtype !=# 'eruby' exe "runtime! indent/".b:eruby_subtype.".vim" else runtime! indent/html.vim @@ -47,7 +48,11 @@ set cpo&vim function! GetErubyIndent(...) " The value of a single shift-width - let sw = shiftwidth() + if exists('*shiftwidth') + let sw = shiftwidth() + else + let sw = &sw + endif if a:0 && a:1 == '.' let v:lnum = line('.') @@ -91,6 +96,7 @@ function! GetErubyIndent(...) let ind = ind + sw endif if line !~# '^\s*<%' && line =~# '%>\s*$' && line !~# '^\s*end\>' + \ && synID(v:lnum, match(cline, '\S') + 1, 1) != hlID('htmlEndTag') let ind = ind - sw endif if cline =~# '^\s*[-=]\=%>\s*$' diff --git a/runtime/indent/falcon.vim b/runtime/indent/falcon.vim index b34e7cfd47..664ad61aa5 100644 --- a/runtime/indent/falcon.vim +++ b/runtime/indent/falcon.vim @@ -368,7 +368,7 @@ function FalconGetIndent(...) return indent('.') endif else - call cursor(clnum, vcol) + call cursor(clnum, 0) " FIXME: column was vcol end endif diff --git a/runtime/indent/html.vim b/runtime/indent/html.vim index 6c866594c5..1d2043ae9e 100644 --- a/runtime/indent/html.vim +++ b/runtime/indent/html.vim @@ -2,7 +2,7 @@ " Header: "{{{ " Maintainer: Bram Moolenaar " Original Author: Andy Wokula <anwoku@yahoo.de> -" Last Change: 2018 Mar 28 +" Last Change: 2019 Mar 20 " Version: 1.0 " Description: HTML indent script with cached state for faster indenting on a " range of lines. @@ -216,8 +216,9 @@ endfunc "}}} " Add known tag pairs. " Self-closing tags and tags that are sometimes {{{ " self-closing (e.g., <p>) are not here (when encountering </p> we can find -" the matching <p>, but not the other way around). Known self-closing tags: -" 'p', 'img', 'source'. +" the matching <p>, but not the other way around). +" Known self-closing tags: " 'p', 'img', 'source', 'area', 'keygen', 'track', +" 'wbr'. " Old HTML tags: call s:AddITags(s:indent_tags, [ \ 'a', 'abbr', 'acronym', 'address', 'b', 'bdo', 'big', @@ -232,11 +233,11 @@ call s:AddITags(s:indent_tags, [ " New HTML5 elements: call s:AddITags(s:indent_tags, [ - \ 'area', 'article', 'aside', 'audio', 'bdi', 'canvas', - \ 'command', 'data', 'datalist', 'details', 'embed', 'figcaption', - \ 'figure', 'footer', 'header', 'keygen', 'main', 'mark', 'meter', - \ 'nav', 'output', 'picture', 'progress', 'rp', 'rt', 'ruby', 'section', - \ 'summary', 'svg', 'time', 'track', 'video', 'wbr']) + \ 'article', 'aside', 'audio', 'bdi', 'canvas', 'command', 'data', + \ 'datalist', 'details', 'dialog', 'embed', 'figcaption', 'figure', + \ 'footer', 'header', 'hgroup', 'main', 'mark', 'meter', 'nav', 'output', + \ 'picture', 'progress', 'rp', 'rt', 'ruby', 'section', 'summary', + \ 'svg', 'time', 'video']) " Tags added for web components: call s:AddITags(s:indent_tags, [ @@ -625,7 +626,7 @@ func! s:CSSIndent() return eval(b:hi_css1indent) endif - " If the current line starts with "}" align with it's match. + " If the current line starts with "}" align with its match. if curtext =~ '^\s*}' call cursor(v:lnum, 1) try @@ -901,12 +902,19 @@ func! s:InsideTag(foundHtmlString) "{{{ if a:foundHtmlString " Inside an attribute string. - " Align with the previous line or use an external function. + " Align with the opening quote or use an external function. let lnum = v:lnum - 1 if lnum > 1 if exists('b:html_indent_tag_string_func') return b:html_indent_tag_string_func(lnum) endif + " If there is a double quote in the previous line, indent with the + " character after it. + if getline(lnum) =~ '"' + call cursor(lnum, 0) + normal f" + return virtcol('.') + endif return indent(lnum) endif endif @@ -934,7 +942,7 @@ func! s:InsideTag(foundHtmlString) let idx = match(text, '<' . s:tagname . '\s\+\zs\w') endif if idx == -1 - " after just <tag indent one level more + " after just "<tag" indent one level more let idx = match(text, '<' . s:tagname . '$') if idx >= 0 call cursor(lnum, idx) diff --git a/runtime/indent/matlab.vim b/runtime/indent/matlab.vim index 6a31624389..d2818a18ea 100644 --- a/runtime/indent/matlab.vim +++ b/runtime/indent/matlab.vim @@ -1,74 +1,121 @@ -" Matlab indent file -" Language: Matlab -" Maintainer: Christophe Poucet <christophe.poucet@pandora.be> -" Last Change: 6 January, 2001 - -" Only load this indent file when no other was loaded. -if exists("b:did_indent") - finish -endif +" Vim indent file +" Language: MATLAB +" Maintainer: Axel Forsman <axelsfor@gmail.com> +" Previous maintainer: Christophe Poucet <christophe.poucet@pandora.be> + +" Only load if no other indent file is loaded +if exists('b:did_indent') | finish | endif let b:did_indent = 1 -" Some preliminary setting -setlocal indentkeys=!,o,O=end,=case,=else,=elseif,=otherwise,=catch - - -setlocal indentexpr=GetMatlabIndent(v:lnum) - -" Only define the function once. -if exists("*GetMatlabIndent") - finish -endif - -function GetMatlabIndent(lnum) - " Give up if this line is explicitly joined. - if getline(a:lnum - 1) =~ '\\$' - return -1 - endif - - " Search backwards for the first non-empty line. - let plnum = a:lnum - 1 - while plnum > 0 && getline(plnum) =~ '^\s*$' - let plnum = plnum - 1 - endwhile - - if plnum == 0 - " This is the first non-empty line, use zero indent. - return 0 - endif - - let curind = indent(plnum) - - " If the current line is a stop-block statement... - if getline(v:lnum) =~ '^\s*\(end\|else\|elseif\|case\|otherwise\|catch\)\>' - " See if this line does not follow the line right after an openblock - if getline(plnum) =~ '^\s*\(for\|if\|else\|elseif\|case\|while\|switch\|try\|otherwise\|catch\)\>' - " See if the user has already dedented - elseif indent(v:lnum) > curind - shiftwidth() - " If not, recommend one dedent - let curind = curind - shiftwidth() - else - " Otherwise, trust the user - return -1 - endif -" endif - - " If the previous line opened a block - elseif getline(plnum) =~ '^\s*\(for\|if\|else\|elseif\|case\|while\|switch\|try\|otherwise\|catch\)\>' - " See if the user has already indented - if indent(v:lnum) < curind + shiftwidth() - "If not, recommend indent - let curind = curind + shiftwidth() - else - " Otherwise, trust the user - return -1 - endif - endif - - - - " If we got to here, it means that the user takes the standardversion, so we return it - return curind +setlocal indentexpr=GetMatlabIndent() +setlocal indentkeys=!,o,O,e,0=end,0=elseif,0=case,0=otherwise,0=catch,0=function,0=elsei + +" The value of the Function indenting format in +" MATLAB Editor/Debugger Language Preferences. +" The possible values are 0 for Classic, 1 for Indent nested functions +" and 2 for Indent all functions (default). +let b:MATLAB_function_indent = get(g:, 'MATLAB_function_indent', 2) +" The previous value of b:changedtick +let b:MATLAB_lasttick = -1 +" The previously indented line +let b:MATLAB_lastline = -1 +" Whether the line above was a line continuation +let b:MATLAB_waslc = 0 +let b:MATLAB_bracketlevel = 0 + +" Only define the function once +if exists("*GetMatlabIndent") | finish | endif + +let s:keepcpo = &cpo +set cpo&vim + +let s:end = '\<end\>\%([^(]*)\)\@!' " Array indexing heuristic +let s:open_pat = 'for\|if\|parfor\|spmd\|switch\|try\|while\|classdef\|properties\|methods\|events\|enumeration' +let s:dedent_pat = '\C^\s*\zs\<\%(end\|else\|elseif\|catch\|\(case\|otherwise\|function\)\)\>' +let s:start_pat = '\C\<\%(function\|' . s:open_pat . '\)\>' +let s:bracket_pair_pat = '\(\[\|{\)\|\(\]\|}\)' +let s:zflag = has('patch-7.4.984') ? 'z' : '' + +" Returns whether a comment or string envelops the specified column. +function! s:IsCommentOrString(lnum, col) + return synIDattr(synID(a:lnum, a:col, 1), "name") =~# 'matlabComment\|matlabMultilineComment\|matlabString' +endfunction + +" Returns whether the specified line continues on the next line. +function! s:IsLineContinuation(lnum) + let l = getline(a:lnum) | let c = -3 + while 1 + let c = match(l, '\.\{3}', c + 3) + if c == -1 | return 0 + elseif !s:IsCommentOrString(a:lnum, c) | return 1 | endif + endwhile +endfunction + +function! s:SubmatchCount(lnum, pattern, ...) + let endcol = a:0 >= 1 ? a:1 : 1 / 0 | let x = [0, 0, 0, 0] + call cursor(a:lnum, 1) + while 1 + let [lnum, c, submatch] = searchpos(a:pattern, 'cpe' . s:zflag, a:lnum) + if !submatch || c >= endcol | break | endif + if !s:IsCommentOrString(lnum, c) | let x[submatch - 2] += 1 | endif + if cursor(0, c + 1) == -1 || col('.') == c | break | endif + endwhile + return x +endfunction + +function! s:GetOpenCloseCount(lnum, pattern, ...) + let counts = call('s:SubmatchCount', [a:lnum, a:pattern] + a:000) + return counts[0] - counts[1] +endfunction + +function! GetMatlabIndent() + let prevlnum = prevnonblank(v:lnum - 1) + + if b:MATLAB_lasttick != b:changedtick || b:MATLAB_lastline != prevlnum + " Recalculate bracket count (only have to check same block and line above) + let b:MATLAB_bracketlevel = 0 + let previndent = indent(prevlnum) | let l = prevlnum + while 1 + let l = prevnonblank(l - 1) | let indent = indent(l) + if l <= 0 || previndent < indent | break | endif + let b:MATLAB_bracketlevel += s:GetOpenCloseCount(l, s:bracket_pair_pat) + if previndent != indent | break | endif + endwhile + + let b:MATLAB_waslc = s:IsLineContinuation(prevlnum - 1) + endif + " If line above was blank it can impossibly have been a LC + let above_lc = b:MATLAB_lasttick == b:changedtick && prevlnum != v:lnum - 1 && b:MATLAB_lastline == prevlnum ? 0 : s:IsLineContinuation(v:lnum - 1) + + let pair_pat = '\C\<\(' . s:open_pat . '\|' + \ . (b:MATLAB_function_indent == 1 ? '^\@<!' : '') + \ . (b:MATLAB_function_indent >= 1 ? 'function\|' : '') + \ . '\|\%(^\s*\)\@<=\%(else\|elseif\|case\|otherwise\|catch\)\)\>' + \ . '\|\S\s*\zs\(' . s:end . '\)' + let [open, close, b_open, b_close] = prevlnum ? s:SubmatchCount(prevlnum, + \ pair_pat . '\|' . s:bracket_pair_pat) : [0, 0, 0, 0] + let curbracketlevel = b:MATLAB_bracketlevel + b_open - b_close + + call cursor(v:lnum, 1) + let submatch = search(s:dedent_pat, 'cp' . s:zflag, v:lnum) + if submatch && !s:IsCommentOrString(v:lnum, col('.')) + " Align end, et cetera with start of block + let [lnum, col] = searchpairpos(s:start_pat, '', '\C' . s:end, 'bW', 's:IsCommentOrString(line("."), col("."))') + let result = lnum ? indent(lnum) + shiftwidth() * (s:GetOpenCloseCount(lnum, pair_pat, col) + submatch == 2) : 0 + else + " Count how many blocks the previous line opens/closes + " Line continuations/brackets indent once per statement + let result = indent(prevlnum) + shiftwidth() * (open - close + \ + (b:MATLAB_bracketlevel ? -!curbracketlevel : !!curbracketlevel) + \ + (curbracketlevel <= 0) * (above_lc - b:MATLAB_waslc)) + endif + + let b:MATLAB_waslc = above_lc + let b:MATLAB_bracketlevel = curbracketlevel + let b:MATLAB_lasttick = b:changedtick + let b:MATLAB_lastline = v:lnum + return result endfunction -" vim:sw=2 +let &cpo = s:keepcpo +unlet s:keepcpo diff --git a/runtime/indent/mma.vim b/runtime/indent/mma.vim index 8298ad98cd..a76fa8ede0 100644 --- a/runtime/indent/mma.vim +++ b/runtime/indent/mma.vim @@ -57,7 +57,7 @@ function GetMmaIndent() if getline(v:lnum) =~ '[^[]*]\s*$' " move to the closing bracket call search(']','bW') - " and find it's partner's indent + " and find its partner's indent let ind = indent(searchpair('\[','',']','bWn')) " same for ( blocks elseif getline(v:lnum) =~ '[^(]*)$' diff --git a/runtime/indent/php.vim b/runtime/indent/php.vim index b0430dea8d..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 @@ -12,14 +12,14 @@ " A fully commented version of this file is available on github " " -" If you find a bug, please open a ticket on github.org +" If you find a bug, please open a ticket on github.com " ( https://github.com/2072/PHP-Indenting-for-VIm/issues ) with an example of " code that breaks the algorithm. " " 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/python.vim b/runtime/indent/python.vim index 7ab3cb9f50..e53987a0de 100644 --- a/runtime/indent/python.vim +++ b/runtime/indent/python.vim @@ -2,7 +2,7 @@ " Language: Python " Maintainer: Bram Moolenaar <Bram@vim.org> " Original Author: David Bustos <bustos@caltech.edu> -" Last Change: 2013 Jul 9 +" Last Change: 2019 Feb 21 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -53,58 +53,68 @@ function GetPythonIndent(lnum) return 0 endif - " searchpair() can be slow sometimes, limit the time to 100 msec or what is - " put in g:pyindent_searchpair_timeout - let searchpair_stopline = 0 - let searchpair_timeout = get(g:, 'pyindent_searchpair_timeout', 150) - - " If the previous line is inside parenthesis, use the indent of the starting - " line. - " Trick: use the non-existing "dummy" variable to break out of the loop when - " going too far back. call cursor(plnum, 1) - let parlnum = searchpair('(\|{\|\[', '', ')\|}\|\]', 'nbW', - \ "line('.') < " . (plnum - s:maxoff) . " ? dummy :" - \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" - \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", - \ searchpair_stopline, searchpair_timeout) - if parlnum > 0 - let plindent = indent(parlnum) - let plnumstart = parlnum - else + + " Identing inside parentheses can be very slow, regardless of the searchpair() + " timeout, so let the user disable this feature if he doesn't need it + let disable_parentheses_indenting = get(g:, "pyindent_disable_parentheses_indenting", 0) + + if disable_parentheses_indenting == 1 let plindent = indent(plnum) let plnumstart = plnum - endif - + else + " searchpair() can be slow sometimes, limit the time to 150 msec or what is + " put in g:pyindent_searchpair_timeout + let searchpair_stopline = 0 + let searchpair_timeout = get(g:, 'pyindent_searchpair_timeout', 150) + + " If the previous line is inside parenthesis, use the indent of the starting + " line. + " Trick: use the non-existing "dummy" variable to break out of the loop when + " going too far back. + let parlnum = searchpair('(\|{\|\[', '', ')\|}\|\]', 'nbW', + \ "line('.') < " . (plnum - s:maxoff) . " ? dummy :" + \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" + \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", + \ searchpair_stopline, searchpair_timeout) + if parlnum > 0 + let plindent = indent(parlnum) + let plnumstart = parlnum + else + let plindent = indent(plnum) + let plnumstart = plnum + endif - " When inside parenthesis: If at the first line below the parenthesis add - " two 'shiftwidth', otherwise same as previous line. - " i = (a - " + b - " + c) - call cursor(a:lnum, 1) - let p = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', - \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" - \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" - \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", - \ searchpair_stopline, searchpair_timeout) - if p > 0 - if p == plnum - " When the start is inside parenthesis, only indent one 'shiftwidth'. - let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', - \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" - \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" - \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", - \ searchpair_stopline, searchpair_timeout) - if pp > 0 - return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth()) + " When inside parenthesis: If at the first line below the parenthesis add + " two 'shiftwidth', otherwise same as previous line. + " i = (a + " + b + " + c) + call cursor(a:lnum, 1) + let p = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', + \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" + \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" + \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", + \ searchpair_stopline, searchpair_timeout) + if p > 0 + if p == plnum + " When the start is inside parenthesis, only indent one 'shiftwidth'. + let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW', + \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" + \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')" + \ . " =~ '\\(Comment\\|Todo\\|String\\)$'", + \ searchpair_stopline, searchpair_timeout) + if pp > 0 + return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth()) + endif + return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (shiftwidth() * 2)) endif - return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (shiftwidth() * 2)) - endif - if plnumstart == p - return indent(plnum) + if plnumstart == p + return indent(plnum) + endif + return plindent endif - return plindent + endif diff --git a/runtime/indent/raml.vim b/runtime/indent/raml.vim new file mode 100644 index 0000000000..73756ae7de --- /dev/null +++ b/runtime/indent/raml.vim @@ -0,0 +1,12 @@ +" Vim indent file +" Language: RAML (RESTful API Modeling Language) +" Maintainer: mucheng <leisurelicht@gmail.com> +" License: VIM LICENSE +" Latest Revision: 2018-11-03 + +if exists("b:did_indent") + finish +endif + +" Same as yaml indenting. +runtime! indent/yaml.vim diff --git a/runtime/indent/rmd.vim b/runtime/indent/rmd.vim index 182b07cbaa..83fe4e4fed 100644 --- a/runtime/indent/rmd.vim +++ b/runtime/indent/rmd.vim @@ -39,7 +39,7 @@ endfunction function s:GetYamlIndent() let pline = getline(v:lnum - 1) if pline =~ ':\s*$' - return indent(v:lnum) + &sw + return indent(v:lnum) + shiftwidth() elseif pline =~ '^\s*- ' return indent(v:lnum) + 2 endif diff --git a/runtime/indent/ruby.vim b/runtime/indent/ruby.vim index d8733db305..5c420d7543 100644 --- a/runtime/indent/ruby.vim +++ b/runtime/indent/ruby.vim @@ -1,8 +1,10 @@ " Vim indent file " Language: Ruby -" Maintainer: Nikolai Weibull <now at bitwi.se> +" Maintainer: Andrew Radev <andrey.radev@gmail.com> +" Previous Maintainer: Nikolai Weibull <now at bitwi.se> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2019 Jan 06 " 0. Initialization {{{1 " ================= @@ -18,6 +20,11 @@ if !exists('g:ruby_indent_access_modifier_style') let g:ruby_indent_access_modifier_style = 'normal' endif +if !exists('g:ruby_indent_assignment_style') + " Possible values: "variable", "hanging" + let g:ruby_indent_assignment_style = 'hanging' +endif + if !exists('g:ruby_indent_block_style') " Possible values: "expression", "do" let g:ruby_indent_block_style = 'expression' @@ -42,28 +49,27 @@ set cpo&vim " 1. Variables {{{1 " ============ -" Regex of syntax group names that are or delimit strings/symbols or are comments. -let s:syng_strcom = '\<ruby\%(Regexp\|RegexpDelimiter\|RegexpEscape' . - \ '\|Symbol\|String\|StringDelimiter\|StringEscape\|ASCIICode' . - \ '\|Interpolation\|InterpolationDelimiter\|NoInterpolation\|Comment\|Documentation\)\>' - -" Regex of syntax group names that are strings. +" Syntax group names that are strings. let s:syng_string = - \ '\<ruby\%(String\|Interpolation\|NoInterpolation\|StringEscape\)\>' + \ ['String', 'Interpolation', 'InterpolationDelimiter', 'NoInterpolation', 'StringEscape'] + +" Syntax group names that are strings or documentation. +let s:syng_stringdoc = s:syng_string + ['Documentation'] -" Regex of syntax group names that are strings or documentation. -let s:syng_stringdoc = - \'\<ruby\%(String\|Interpolation\|NoInterpolation\|StringEscape\|Documentation\)\>' +" Syntax group names that are or delimit strings/symbols/regexes or are comments. +let s:syng_strcom = s:syng_stringdoc + + \ ['Regexp', 'RegexpDelimiter', 'RegexpEscape', + \ 'Symbol', 'StringDelimiter', 'ASCIICode', 'Comment'] " 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."'" + \ 'index(map('.string(s:syng_strcom).',"hlID(''ruby''.v:val)"), synID(line("."),col("."),1)) >= 0' " Regex used for words that, at the start of a line, add a level of indent. let s:ruby_indent_keywords = \ '^\s*\zs\<\%(module\|class\|if\|for' . \ '\|while\|until\|else\|elsif\|case\|when\|unless\|begin\|ensure\|rescue' . - \ '\|\%(public\|protected\|private\)\=\s*def\):\@!\>' . + \ '\|\%(\K\k*[!?]\?\)\=\s*def\):\@!\>' . \ '\|\%([=,*/%+-]\|<<\|>>\|:\s\)\s*\zs' . \ '\<\%(if\|for\|while\|until\|case\|unless\|begin\):\@!\>' @@ -77,7 +83,7 @@ let s:ruby_deindent_keywords = let s:end_start_regex = \ '\C\%(^\s*\|[=,*/%+\-|;{]\|<<\|>>\|:\s\)\s*\zs' . \ '\<\%(module\|class\|if\|for\|while\|until\|case\|unless\|begin' . - \ '\|\%(public\|protected\|private\)\=\s*def\):\@!\>' . + \ '\|\%(\K\k*[!?]\?\)\=\s*def\):\@!\>' . \ '\|\%(^\|[^.:@$]\)\@<=\<do:\@!\>' " Regex that defines the middle-match for the 'end' keyword. @@ -142,31 +148,562 @@ let s:block_continuation_regex = '^\s*[^])}\t ].*'.s:block_regex " Regex that describes a leading operator (only a method call's dot for now) let s:leading_operator_regex = '^\s*[.]' -" 2. Auxiliary Functions {{{1 +" 2. GetRubyIndent Function {{{1 +" ========================= + +function! GetRubyIndent(...) abort + " 2.1. Setup {{{2 + " ---------- + + let indent_info = {} + + " The value of a single shift-width + if exists('*shiftwidth') + let indent_info.sw = shiftwidth() + else + let indent_info.sw = &sw + endif + + " For the current line, use the first argument if given, else v:lnum + let indent_info.clnum = a:0 ? a:1 : v:lnum + let indent_info.cline = getline(indent_info.clnum) + + " Set up variables for restoring position in file. Could use clnum here. + let indent_info.col = col('.') + + " 2.2. Work on the current line {{{2 + " ----------------------------- + let indent_callback_names = [ + \ 's:AccessModifier', + \ 's:ClosingBracketOnEmptyLine', + \ 's:BlockComment', + \ 's:DeindentingKeyword', + \ 's:MultilineStringOrLineComment', + \ 's:ClosingHeredocDelimiter', + \ 's:LeadingOperator', + \ ] + + for callback_name in indent_callback_names +" Decho "Running: ".callback_name + let indent = call(function(callback_name), [indent_info]) + + if indent >= 0 +" Decho "Match: ".callback_name." indent=".indent." info=".string(indent_info) + return indent + endif + endfor + + " 2.3. Work on the previous line. {{{2 + " ------------------------------- + + " Special case: we don't need the real s:PrevNonBlankNonString for an empty + " line inside a string. And that call can be quite expensive in that + " particular situation. + let indent_callback_names = [ + \ 's:EmptyInsideString', + \ ] + + for callback_name in indent_callback_names +" Decho "Running: ".callback_name + let indent = call(function(callback_name), [indent_info]) + + if indent >= 0 +" Decho "Match: ".callback_name." indent=".indent." info=".string(indent_info) + return indent + endif + endfor + + " Previous line number + let indent_info.plnum = s:PrevNonBlankNonString(indent_info.clnum - 1) + let indent_info.pline = getline(indent_info.plnum) + + let indent_callback_names = [ + \ 's:StartOfFile', + \ 's:AfterAccessModifier', + \ 's:ContinuedLine', + \ 's:AfterBlockOpening', + \ 's:AfterHangingSplat', + \ 's:AfterUnbalancedBracket', + \ 's:AfterLeadingOperator', + \ 's:AfterEndKeyword', + \ 's:AfterIndentKeyword', + \ ] + + for callback_name in indent_callback_names +" Decho "Running: ".callback_name + let indent = call(function(callback_name), [indent_info]) + + if indent >= 0 +" Decho "Match: ".callback_name." indent=".indent." info=".string(indent_info) + return indent + endif + endfor + + " 2.4. Work on the MSL line. {{{2 + " -------------------------- + let indent_callback_names = [ + \ 's:PreviousNotMSL', + \ 's:IndentingKeywordInMSL', + \ 's:ContinuedHangingOperator', + \ ] + + " Most Significant line based on the previous one -- in case it's a + " contination of something above + let indent_info.plnum_msl = s:GetMSL(indent_info.plnum) + + for callback_name in indent_callback_names +" Decho "Running: ".callback_name + let indent = call(function(callback_name), [indent_info]) + + if indent >= 0 +" Decho "Match: ".callback_name." indent=".indent." info=".string(indent_info) + return indent + endif + endfor + + " }}}2 + + " By default, just return the previous line's indent +" Decho "Default case matched" + return indent(indent_info.plnum) +endfunction + +" 3. Indenting Logic Callbacks {{{1 +" ============================ + +function! s:AccessModifier(cline_info) abort + let info = a:cline_info + + " If this line is an access modifier keyword, align according to the closest + " class declaration. + if g:ruby_indent_access_modifier_style == 'indent' + if s:Match(info.clnum, s:access_modifier_regex) + let class_lnum = s:FindContainingClass() + if class_lnum > 0 + return indent(class_lnum) + info.sw + endif + endif + elseif g:ruby_indent_access_modifier_style == 'outdent' + if s:Match(info.clnum, s:access_modifier_regex) + let class_lnum = s:FindContainingClass() + if class_lnum > 0 + return indent(class_lnum) + endif + endif + endif + + return -1 +endfunction + +function! s:ClosingBracketOnEmptyLine(cline_info) abort + let info = a:cline_info + + " 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(info.cline, '^\s*[]})]') + + if col > 0 && !s:IsInStringOrComment(info.clnum, col) + call cursor(info.clnum, col) + let closing_bracket = info.cline[col - 1] + let bracket_pair = strpart('(){}[]', stridx(')}]', closing_bracket) * 2, 2) + + if searchpair(escape(bracket_pair[0], '\['), '', bracket_pair[1], 'bW', s:skip_expr) > 0 + if closing_bracket == ')' && col('.') != col('$') - 1 + let ind = virtcol('.') - 1 + elseif g:ruby_indent_block_style == 'do' + let ind = indent(line('.')) + else " g:ruby_indent_block_style == 'expression' + let ind = indent(s:GetMSL(line('.'))) + endif + endif + + return ind + endif + + return -1 +endfunction + +function! s:BlockComment(cline_info) abort + " If we have a =begin or =end set indent to first column. + if match(a:cline_info.cline, '^\s*\%(=begin\|=end\)$') != -1 + return 0 + endif + return -1 +endfunction + +function! s:DeindentingKeyword(cline_info) abort + let info = a:cline_info + + " If we have a deindenting keyword, find its match and indent to its level. + " TODO: this is messy + if s:Match(info.clnum, s:ruby_deindent_keywords) + call cursor(info.clnum, 1) + + if searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW', + \ s:end_skip_expr) > 0 + let msl = s:GetMSL(line('.')) + let line = getline(line('.')) + + if s:IsAssignment(line, col('.')) && + \ strpart(line, col('.') - 1, 2) !~ 'do' + " assignment to case/begin/etc, on the same line + if g:ruby_indent_assignment_style == 'hanging' + " hanging indent + let ind = virtcol('.') - 1 + else + " align with variable + let ind = indent(line('.')) + endif + elseif g:ruby_indent_block_style == 'do' + " align to line of the "do", not to the MSL + let ind = indent(line('.')) + elseif getline(msl) =~ '=\s*\(#.*\)\=$' + " in the case of assignment to the MSL, align to the starting line, + " not to the MSL + let ind = indent(line('.')) + else + " align to the MSL + let ind = indent(msl) + endif + endif + return ind + endif + + return -1 +endfunction + +function! s:MultilineStringOrLineComment(cline_info) abort + let info = a:cline_info + + " If we are in a multi-line string or line-comment, don't do anything to it. + if s:IsInStringOrDocumentation(info.clnum, matchend(info.cline, '^\s*') + 1) + return indent(info.clnum) + endif + return -1 +endfunction + +function! s:ClosingHeredocDelimiter(cline_info) abort + let info = a:cline_info + + " If we are at the closing delimiter of a "<<" heredoc-style string, set the + " indent to 0. + if info.cline =~ '^\k\+\s*$' + \ && s:IsInStringDelimiter(info.clnum, 1) + \ && search('\V<<'.info.cline, 'nbW') > 0 + return 0 + endif + + return -1 +endfunction + +function! s:LeadingOperator(cline_info) abort + " If the current line starts with a leading operator, add a level of indent. + if s:Match(a:cline_info.clnum, s:leading_operator_regex) + return indent(s:GetMSL(a:cline_info.clnum)) + a:cline_info.sw + endif + return -1 +endfunction + +function! s:EmptyInsideString(pline_info) abort + " If the line is empty and inside a string (the previous line is a string, + " too), use the previous line's indent + let info = a:pline_info + + let plnum = prevnonblank(info.clnum - 1) + let pline = getline(plnum) + + if info.cline =~ '^\s*$' + \ && s:IsInStringOrComment(plnum, 1) + \ && s:IsInStringOrComment(plnum, strlen(pline)) + return indent(plnum) + endif + return -1 +endfunction + +function! s:StartOfFile(pline_info) abort + " At the start of the file use zero indent. + if a:pline_info.plnum == 0 + return 0 + endif + return -1 +endfunction + +function! s:AfterAccessModifier(pline_info) abort + let info = a:pline_info + + if g:ruby_indent_access_modifier_style == 'indent' + " If the previous line was a private/protected keyword, add a + " level of indent. + if s:Match(info.plnum, s:indent_access_modifier_regex) + return indent(info.plnum) + info.sw + endif + elseif g:ruby_indent_access_modifier_style == 'outdent' + " If the previous line was a private/protected/public keyword, add + " a level of indent, since the keyword has been out-dented. + if s:Match(info.plnum, s:access_modifier_regex) + return indent(info.plnum) + info.sw + endif + endif + return -1 +endfunction + +" Example: +" +" if foo || bar || +" baz || bing +" puts "foo" +" end +" +function! s:ContinuedLine(pline_info) abort + let info = a:pline_info + + let col = s:Match(info.plnum, s:ruby_indent_keywords) + if s:Match(info.plnum, s:continuable_regex) && + \ s:Match(info.plnum, s:continuation_regex) + if col > 0 && s:IsAssignment(info.pline, col) + if g:ruby_indent_assignment_style == 'hanging' + " hanging indent + let ind = col - 1 + else + " align with variable + let ind = indent(info.plnum) + endif + else + let ind = indent(s:GetMSL(info.plnum)) + endif + return ind + info.sw + info.sw + endif + return -1 +endfunction + +function! s:AfterBlockOpening(pline_info) abort + let info = a:pline_info + + " If the previous line ended with a block opening, add a level of indent. + if s:Match(info.plnum, s:block_regex) + if g:ruby_indent_block_style == 'do' + " don't align to the msl, align to the "do" + let ind = indent(info.plnum) + info.sw + else + let plnum_msl = s:GetMSL(info.plnum) + + if getline(plnum_msl) =~ '=\s*\(#.*\)\=$' + " in the case of assignment to the msl, align to the starting line, + " not to the msl + let ind = indent(info.plnum) + info.sw + else + let ind = indent(plnum_msl) + info.sw + endif + endif + + return ind + endif + + return -1 +endfunction + +function! s:AfterLeadingOperator(pline_info) abort + " If the previous line started with a leading operator, use its MSL's level + " of indent + if s:Match(a:pline_info.plnum, s:leading_operator_regex) + return indent(s:GetMSL(a:pline_info.plnum)) + endif + return -1 +endfunction + +function! s:AfterHangingSplat(pline_info) abort + let info = a:pline_info + + " If the previous line ended with the "*" of a splat, add a level of indent + if info.pline =~ s:splat_regex + return indent(info.plnum) + info.sw + endif + return -1 +endfunction + +function! s:AfterUnbalancedBracket(pline_info) abort + let info = a:pline_info + + " If the previous line contained unclosed opening brackets and we are still + " in them, find the rightmost one and add indent depending on the bracket + " type. + " + " If it contained hanging closing brackets, find the rightmost one, find its + " match and indent according to that. + if info.pline =~ '[[({]' || info.pline =~ '[])}]\s*\%(#.*\)\=$' + let [opening, closing] = s:ExtraBrackets(info.plnum) + + if opening.pos != -1 + if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 + if col('.') + 1 == col('$') + return indent(info.plnum) + info.sw + else + return virtcol('.') + endif + else + let nonspace = matchend(info.pline, '\S', opening.pos + 1) - 1 + return nonspace > 0 ? nonspace : indent(info.plnum) + info.sw + endif + elseif closing.pos != -1 + call cursor(info.plnum, closing.pos + 1) + normal! % + + if s:Match(line('.'), s:ruby_indent_keywords) + return indent('.') + info.sw + else + return indent(s:GetMSL(line('.'))) + endif + else + call cursor(info.clnum, info.col) + end + endif + + return -1 +endfunction + +function! s:AfterEndKeyword(pline_info) abort + let info = a:pline_info + " If the previous line ended with an "end", match that "end"s beginning's + " indent. + let col = s:Match(info.plnum, '\%(^\|[^.:@$]\)\<end\>\s*\%(#.*\)\=$') + if col > 0 + call cursor(info.plnum, col) + if searchpair(s:end_start_regex, '', s:end_end_regex, 'bW', + \ s:end_skip_expr) > 0 + let n = line('.') + let ind = indent('.') + let msl = s:GetMSL(n) + if msl != n + let ind = indent(msl) + end + return ind + endif + end + return -1 +endfunction + +function! s:AfterIndentKeyword(pline_info) abort + let info = a:pline_info + let col = s:Match(info.plnum, s:ruby_indent_keywords) + + if col > 0 + call cursor(info.plnum, col) + let ind = virtcol('.') - 1 + info.sw + " TODO: make this better (we need to count them) (or, if a searchpair + " fails, we know that something is lacking an end and thus we indent a + " level + if s:Match(info.plnum, s:end_end_regex) + let ind = indent('.') + elseif s:IsAssignment(info.pline, col) + if g:ruby_indent_assignment_style == 'hanging' + " hanging indent + let ind = col + info.sw - 1 + else + " align with variable + let ind = indent(info.plnum) + info.sw + endif + endif + return ind + endif + + return -1 +endfunction + +function! s:PreviousNotMSL(msl_info) abort + let info = a:msl_info + + " If the previous line wasn't a MSL + if info.plnum != info.plnum_msl + " If previous line ends bracket and begins non-bracket continuation decrease indent by 1. + if s:Match(info.plnum, s:bracket_switch_continuation_regex) + " TODO (2016-10-07) Wrong/unused? How could it be "1"? + return indent(info.plnum) - 1 + " If previous line is a continuation return its indent. + " TODO: the || s:IsInString() thing worries me a bit. + elseif s:Match(info.plnum, s:non_bracket_continuation_regex) || s:IsInString(info.plnum, strlen(line)) + return indent(info.plnum) + endif + endif + + return -1 +endfunction + +function! s:IndentingKeywordInMSL(msl_info) abort + let info = a:msl_info + " If the MSL line had an indenting keyword in it, add a level of indent. + " TODO: this does not take into account contrived things such as + " module Foo; class Bar; end + let col = s:Match(info.plnum_msl, s:ruby_indent_keywords) + if col > 0 + let ind = indent(info.plnum_msl) + info.sw + if s:Match(info.plnum_msl, s:end_end_regex) + let ind = ind - info.sw + elseif s:IsAssignment(getline(info.plnum_msl), col) + if g:ruby_indent_assignment_style == 'hanging' + " hanging indent + let ind = col + info.sw - 1 + else + " align with variable + let ind = indent(info.plnum_msl) + info.sw + endif + endif + return ind + endif + return -1 +endfunction + +function! s:ContinuedHangingOperator(msl_info) abort + let info = a:msl_info + + " If the previous line ended with [*+/.,-=], but wasn't a block ending or a + " closing bracket, indent one extra level. + if s:Match(info.plnum_msl, s:non_bracket_continuation_regex) && !s:Match(info.plnum_msl, '^\s*\([\])}]\|end\)') + if info.plnum_msl == info.plnum + let ind = indent(info.plnum_msl) + info.sw + else + let ind = indent(info.plnum_msl) + endif + return ind + endif + + return -1 +endfunction + +" 4. Auxiliary Functions {{{1 " ====================== +function! s:IsInRubyGroup(groups, lnum, col) abort + let ids = map(copy(a:groups), 'hlID("ruby".v:val)') + return index(ids, synID(a:lnum, a:col, 1)) >= 0 +endfunction + " 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 +function! s:IsInStringOrComment(lnum, col) abort + return s:IsInRubyGroup(s:syng_strcom, a:lnum, a:col) 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 +function! s:IsInString(lnum, col) abort + return s:IsInRubyGroup(s:syng_string, a:lnum, a:col) endfunction " Check if the character at lnum:col is inside a string or documentation. -function s:IsInStringOrDocumentation(lnum, col) - return synIDattr(synID(a:lnum, a:col, 1), 'name') =~ s:syng_stringdoc +function! s:IsInStringOrDocumentation(lnum, col) abort + return s:IsInRubyGroup(s:syng_stringdoc, a:lnum, a:col) endfunction " Check if the character at lnum:col is inside a string delimiter -function s:IsInStringDelimiter(lnum, col) - return synIDattr(synID(a:lnum, a:col, 1), 'name') == 'rubyStringDelimiter' +function! s:IsInStringDelimiter(lnum, col) abort + return s:IsInRubyGroup(['StringDelimiter'], a:lnum, a:col) +endfunction + +function! s:IsAssignment(str, pos) abort + return strpart(a:str, 0, a:pos - 1) =~ '=\s*$' endfunction " Find line above 'lnum' that isn't empty, in a comment, or in a string. -function s:PrevNonBlankNonString(lnum) +function! s:PrevNonBlankNonString(lnum) abort let in_block = 0 let lnum = prevnonblank(a:lnum) while lnum > 0 @@ -191,10 +728,9 @@ function s:PrevNonBlankNonString(lnum) endfunction " Find line above 'lnum' that started the continuation 'lnum' may be part of. -function s:GetMSL(lnum) +function! s:GetMSL(lnum) abort " Start on the line we're at and use its indent. let msl = a:lnum - let msl_body = getline(msl) 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. @@ -291,14 +827,13 @@ function s:GetMSL(lnum) endif endif - let msl_body = getline(msl) let lnum = s:PrevNonBlankNonString(lnum - 1) endwhile return msl endfunction " Check if line 'lnum' has more opening brackets than closing ones. -function s:ExtraBrackets(lnum) +function! s:ExtraBrackets(lnum) abort let opening = {'parentheses': [], 'braces': [], 'brackets': []} let closing = {'parentheses': [], 'braces': [], 'brackets': []} @@ -360,7 +895,7 @@ function s:ExtraBrackets(lnum) return [rightmost_opening, rightmost_closing] endfunction -function s:Match(lnum, regex) +function! s:Match(lnum, regex) abort let line = getline(a:lnum) let offset = match(line, '\C'.a:regex) let col = offset + 1 @@ -380,7 +915,7 @@ endfunction " Locates the containing class/module's definition line, ignoring nested classes " along the way. " -function! s:FindContainingClass() +function! s:FindContainingClass() abort let saved_position = getpos('.') while searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW', @@ -396,297 +931,6 @@ function! s:FindContainingClass() return 0 endfunction -" 3. GetRubyIndent Function {{{1 -" ========================= - -function GetRubyIndent(...) - " 3.1. Setup {{{2 - " ---------- - - " The value of a single shift-width - let sw = shiftwidth() - - " For the current line, use the first argument if given, else v:lnum - let clnum = a:0 ? a:1 : v:lnum - - " Set up variables for restoring position in file. Could use clnum here. - let vcol = col('.') - - " 3.2. Work on the current line {{{2 - " ----------------------------- - - " Get the current line. - let line = getline(clnum) - let ind = -1 - - " If this line is an access modifier keyword, align according to the closest - " class declaration. - if g:ruby_indent_access_modifier_style == 'indent' - if s:Match(clnum, s:access_modifier_regex) - let class_line = s:FindContainingClass() - if class_line > 0 - return indent(class_line) + sw - endif - endif - elseif g:ruby_indent_access_modifier_style == 'outdent' - if s:Match(clnum, s:access_modifier_regex) - let class_line = s:FindContainingClass() - if class_line > 0 - return indent(class_line) - endif - endif - endif - - " 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(clnum, col) - call cursor(clnum, col) - 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 - elseif g:ruby_indent_block_style == 'do' - let ind = indent(line('.')) - else " g:ruby_indent_block_style == 'expression' - let ind = indent(s:GetMSL(line('.'))) - endif - endif - return ind - endif - - " If we have a =begin or =end set indent to first column. - if match(line, '^\s*\%(=begin\|=end\)$') != -1 - return 0 - endif - - " If we have a deindenting keyword, find its match and indent to its level. - " TODO: this is messy - if s:Match(clnum, s:ruby_deindent_keywords) - call cursor(clnum, 1) - if searchpair(s:end_start_regex, s:end_middle_regex, s:end_end_regex, 'bW', - \ s:end_skip_expr) > 0 - let msl = s:GetMSL(line('.')) - let line = getline(line('.')) - - if strpart(line, 0, col('.') - 1) =~ '=\s*$' && - \ strpart(line, col('.') - 1, 2) !~ 'do' - " assignment to case/begin/etc, on the same line, hanging indent - let ind = virtcol('.') - 1 - elseif g:ruby_indent_block_style == 'do' - " align to line of the "do", not to the MSL - let ind = indent(line('.')) - elseif getline(msl) =~ '=\s*\(#.*\)\=$' - " in the case of assignment to the MSL, align to the starting line, - " not to the MSL - let ind = indent(line('.')) - else - " align to the MSL - let ind = indent(msl) - endif - endif - return ind - endif - - " If we are in a multi-line string or line-comment, don't do anything to it. - if s:IsInStringOrDocumentation(clnum, matchend(line, '^\s*') + 1) - return indent('.') - endif - - " If we are at the closing delimiter of a "<<" heredoc-style string, set the - " indent to 0. - if line =~ '^\k\+\s*$' - \ && s:IsInStringDelimiter(clnum, 1) - \ && search('\V<<'.line, 'nbW') > 0 - return 0 - endif - - " If the current line starts with a leading operator, add a level of indent. - if s:Match(clnum, s:leading_operator_regex) - return indent(s:GetMSL(clnum)) + sw - endif - - " 3.3. Work on the previous line. {{{2 - " ------------------------------- - - " Find a non-blank, non-multi-line string line above the current line. - let lnum = s:PrevNonBlankNonString(clnum - 1) - - " If the line is empty and inside a string, use the previous line. - if line =~ '^\s*$' && lnum != prevnonblank(clnum - 1) - return indent(prevnonblank(clnum)) - endif - - " At the start of the file use zero indent. - if lnum == 0 - return 0 - endif - - " Set up variables for the previous line. - let line = getline(lnum) - let ind = indent(lnum) - - if g:ruby_indent_access_modifier_style == 'indent' - " If the previous line was a private/protected keyword, add a - " level of indent. - if s:Match(lnum, s:indent_access_modifier_regex) - return indent(lnum) + sw - endif - elseif g:ruby_indent_access_modifier_style == 'outdent' - " If the previous line was a private/protected/public keyword, add - " a level of indent, since the keyword has been out-dented. - if s:Match(lnum, s:access_modifier_regex) - return indent(lnum) + sw - endif - endif - - if s:Match(lnum, s:continuable_regex) && s:Match(lnum, s:continuation_regex) - return indent(s:GetMSL(lnum)) + sw + sw - endif - - " If the previous line ended with a block opening, add a level of indent. - if s:Match(lnum, s:block_regex) - let msl = s:GetMSL(lnum) - - if g:ruby_indent_block_style == 'do' - " don't align to the msl, align to the "do" - let ind = indent(lnum) + sw - elseif getline(msl) =~ '=\s*\(#.*\)\=$' - " in the case of assignment to the msl, align to the starting line, - " not to the msl - let ind = indent(lnum) + sw - else - let ind = indent(msl) + sw - endif - return ind - endif - - " If the previous line started with a leading operator, use its MSL's level - " of indent - if s:Match(lnum, s:leading_operator_regex) - return indent(s:GetMSL(lnum)) - endif - - " If the previous line ended with the "*" of a splat, add a level of indent - if line =~ s:splat_regex - return indent(lnum) + sw - endif - - " If the previous line contained unclosed opening brackets and we are still - " in them, find the rightmost one and add indent depending on the bracket - " type. - " - " If it contained hanging closing brackets, find the rightmost one, find its - " match and indent according to that. - if line =~ '[[({]' || line =~ '[])}]\s*\%(#.*\)\=$' - let [opening, closing] = s:ExtraBrackets(lnum) - - if opening.pos != -1 - if opening.type == '(' && searchpair('(', '', ')', 'bW', s:skip_expr) > 0 - if col('.') + 1 == col('$') - return ind + sw - else - return virtcol('.') - endif - else - let nonspace = matchend(line, '\S', opening.pos + 1) - 1 - return nonspace > 0 ? nonspace : ind + sw - endif - elseif closing.pos != -1 - call cursor(lnum, closing.pos + 1) - normal! % - - if s:Match(line('.'), s:ruby_indent_keywords) - return indent('.') + sw - else - return indent(s:GetMSL(line('.'))) - endif - else - call cursor(clnum, vcol) - end - endif - - " If the previous line ended with an "end", match that "end"s beginning's - " indent. - let col = s:Match(lnum, '\%(^\|[^.:@$]\)\<end\>\s*\%(#.*\)\=$') - if col > 0 - call cursor(lnum, col) - if searchpair(s:end_start_regex, '', s:end_end_regex, 'bW', - \ s:end_skip_expr) > 0 - let n = line('.') - let ind = indent('.') - let msl = s:GetMSL(n) - if msl != n - let ind = indent(msl) - end - return ind - endif - end - - let col = s:Match(lnum, s:ruby_indent_keywords) - if col > 0 - call cursor(lnum, col) - let ind = virtcol('.') - 1 + sw - " TODO: make this better (we need to count them) (or, if a searchpair - " fails, we know that something is lacking an end and thus we indent a - " level - if s:Match(lnum, s:end_end_regex) - let ind = indent('.') - endif - return ind - endif - - " 3.4. Work on the MSL line. {{{2 - " -------------------------- - - " Set up variables to use and search for MSL to the previous line. - let p_lnum = lnum - let lnum = s:GetMSL(lnum) - - " If the previous line wasn't a MSL. - if p_lnum != lnum - " If previous line ends bracket and begins non-bracket continuation decrease indent by 1. - if s:Match(p_lnum, s:bracket_switch_continuation_regex) - return ind - 1 - " If previous line is a continuation return its indent. - " TODO: the || s:IsInString() thing worries me a bit. - elseif s:Match(p_lnum, s:non_bracket_continuation_regex) || s:IsInString(p_lnum,strlen(line)) - return ind - endif - endif - - " Set up more variables, now that we know we wasn't continuation bound. - let line = getline(lnum) - let msl_ind = indent(lnum) - - " If the MSL line had an indenting keyword in it, add a level of indent. - " TODO: this does not take into account contrived things such as - " module Foo; class Bar; end - if s:Match(lnum, s:ruby_indent_keywords) - let ind = msl_ind + sw - if s:Match(lnum, s:end_end_regex) - let ind = ind - sw - endif - return ind - endif - - " If the previous line ended with [*+/.,-=], but wasn't a block ending or a - " closing bracket, indent one extra level. - if s:Match(lnum, s:non_bracket_continuation_regex) && !s:Match(lnum, '^\s*\([\])}]\|end\)') - if lnum == p_lnum - let ind = msl_ind + sw - else - let ind = msl_ind - endif - return ind - endif - - " }}}2 - - return ind -endfunction - " }}}1 let &cpo = s:cpo_save diff --git a/runtime/indent/sh.vim b/runtime/indent/sh.vim index 32bc9f35bb..3df6abbf97 100644 --- a/runtime/indent/sh.vim +++ b/runtime/indent/sh.vim @@ -3,10 +3,22 @@ " Maintainer: Christian Brabandt <cb@256bit.org> " Original Author: Nikolai Weibull <now@bitwi.se> " Previous Maintainer: Peter Aronoff <telemachus@arpinum.org> -" Latest Revision: 2018-03-26 +" 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 +" https://github.com/chrisbra/vim-sh-indent/issues/14 +" 20190319 - Indent arrays (only zsh and bash) +" https://github.com/chrisbra/vim-sh-indent/issues/13 +" 20190316 - Make use of searchpairpos for nested if sections +" fixes https://github.com/chrisbra/vim-sh-indent/issues/11 +" 20190201 - Better check for closing if sections " 20180724 - make check for zsh syntax more rigid (needs word-boundaries) " 20180326 - better support for line continuation " 20180325 - better detection of function definitions @@ -59,6 +71,7 @@ function! s:indent_value(option) endfunction function! GetShIndent() + let curline = getline(v:lnum) let lnum = prevnonblank(v:lnum - 1) if lnum == 0 return 0 @@ -70,9 +83,10 @@ 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\)\>') - if line !~ '\<\%(fi\|esac\|done\|end\)\>\s*\%(#.*\)\=$' + \ (&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 elseif s:is_case_label(line, pnum) @@ -84,13 +98,22 @@ function! GetShIndent() if line !~ '}\s*\%(#.*\)\=$' let ind += s:indent_value('default') endif + " array (only works for zsh or bash) + elseif s:is_array(line) && line !~ ')\s*$' && (&ft is# 'zsh' || s:is_bash()) + let ind += s:indent_value('continuation-line') + " end of array + elseif curline =~ '^\s*)$' + let ind -= s:indent_value('continuation-line') elseif s:is_continuation_line(line) if pnum == 0 || !s:is_continuation_line(pline) let ind += s:indent_value('continuation-line') endif elseif s:end_block(line) && !s:start_block(line) let ind -= s:indent_value('default') - elseif pnum != 0 && s:is_continuation_line(pline) && !s:end_block(getline(v:lnum)) + elseif pnum != 0 && + \ s:is_continuation_line(pline) && + \ !s:end_block(curline) && + \ !s:is_end_expression(curline) " only add indent, if line and pline is in the same block let i = v:lnum let ind2 = indent(s:find_continued_lnum(pnum)) @@ -106,8 +129,16 @@ function! GetShIndent() let pine = line " Check content of current line - let line = getline(v:lnum) - if line =~ '^\s*\%(then\|do\|else\|elif\|fi\|done\|end\)\>' || s:end_block(line) + let line = curline + " 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 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 + elseif line =~ '^\s*\%(then\|do\|else\|elif\|done\|end\)\>' || s:end_block(line) let ind -= s:indent_value('default') elseif line =~ '^\s*esac\>' && s:is_case_empty(getline(v:lnum - 1)) let ind -= s:indent_value('default') @@ -167,6 +198,10 @@ function! s:is_function_definition(line) \ a:line =~ '^\s*function\s*\w\S\+\s*\%(()\)\?\s*{' endfunction +function! s:is_array(line) + return a:line =~ '^\s*\<\k\+\>=(' +endfunction + function! s:is_case_label(line, pnum) if a:line !~ '^\s*(\=.*)' return 0 @@ -210,8 +245,8 @@ endfunction function! s:is_here_doc(line) if a:line =~ '^\w\+$' - let here_pat = '<<-\?'. s:escape(a:line). '\$' - return search(here_pat, 'bnW') > 0 + let here_pat = '<<-\?'. s:escape(a:line). '\$' + return search(here_pat, 'bnW') > 0 endif return 0 endfunction @@ -256,5 +291,13 @@ function! s:is_comment(line) return a:line =~ '^\s*#' endfunction +function! s:is_end_expression(line) + return a:line =~ '\<\%(fi\|esac\|done\|end\)\>\s*\%(#.*\)\=$' +endfunction + +function! s:is_bash() + return get(g:, 'is_bash', 0) || get(b:, 'is_bash', 0) +endfunction + let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/indent/tcl.vim b/runtime/indent/tcl.vim index e9d61e4366..d77081841d 100644 --- a/runtime/indent/tcl.vim +++ b/runtime/indent/tcl.vim @@ -1,7 +1,8 @@ " Vim indent file -" Language: Tcl -" Maintainer: Nikolai Weibull <now@bitwi.se> -" Latest Revision: 2006-12-20 +" Language: Tcl +" Previous Maintainer: Nikolai Weibull <now@bitwi.se> +" Latest Update: Chris Heithoff <chrisheithoff@gmail.com> +" Latest Revision: 2018-12-05 if exists("b:did_indent") finish @@ -28,6 +29,15 @@ function s:prevnonblanknoncomment(lnum) return lnum endfunction +function s:ends_with_backslash(lnum) + let line = getline(a:lnum) + if line =~ '\\\s*$' + return 1 + else + return 0 + endif +endfunction + function s:count_braces(lnum, count_open) let n_open = 0 let n_close = 0 @@ -53,23 +63,39 @@ endfunction function GetTclIndent() let line = getline(v:lnum) - if line =~ '^\s*\*' - return cindent(v:lnum) - elseif line =~ '^\s*}' - return indent(v:lnum) - shiftwidth() - endif + " Get the line number of the previous non-blank or non-comment line. let pnum = s:prevnonblanknoncomment(v:lnum - 1) if pnum == 0 return 0 endif - let ind = indent(pnum) + s:count_braces(pnum, 1) * shiftwidth() + " ..and the previous line before the previous line. + let pnum2 = s:prevnonblanknoncomment(pnum-1) - let pline = getline(pnum) - if pline =~ '}\s*$' - let ind -= (s:count_braces(pnum, 0) - (pline =~ '^\s*}' ? 1 : 0)) * shiftwidth() + " Default indentation is to preserve the previous indentation. + let ind = indent(pnum) + + " ...but if previous line introduces an open brace, then increase current line's indentation + if s:count_braces(pnum, 1) > 0 + let ind += shiftwidth() + else + " Look for backslash line continuation on the previous two lines. + let slash1 = s:ends_with_backslash(pnum) + let slash2 = s:ends_with_backslash(pnum2) + if slash1 && !slash2 + " If the previous line begins a line continuation. + let ind += shiftwidth() + elseif !slash1 && slash2 + " If two lines ago was the end of a line continuation group of lines. + let ind -= shiftwidth() + endif endif + " If the current line begins with a closed brace, then decrease the indentation by one. + if line =~ '^\s*}' + let ind -= shiftwidth() + endif + return ind endfunction diff --git a/runtime/indent/testdir/html.in b/runtime/indent/testdir/html.in new file mode 100644 index 0000000000..9c776d61c6 --- /dev/null +++ b/runtime/indent/testdir/html.in @@ -0,0 +1,26 @@ +" vim: set ft=html sw=4 : + + +" START_INDENT +<div> +<div> +text +</div> +</div> + +<div +class="foo bar"> +text +</div> + +<div class="foo bar" +data="something"> +text +</div> + +<div class="foo +bar"> +text +</div> + +" END_INDENT diff --git a/runtime/indent/testdir/html.ok b/runtime/indent/testdir/html.ok new file mode 100644 index 0000000000..ad819333cc --- /dev/null +++ b/runtime/indent/testdir/html.ok @@ -0,0 +1,26 @@ +" vim: set ft=html sw=4 : + + +" START_INDENT +<div> + <div> + text + </div> +</div> + +<div + class="foo bar"> + text +</div> + +<div class="foo bar" + data="something"> + text +</div> + +<div class="foo + bar"> + text +</div> + +" END_INDENT diff --git a/runtime/indent/testdir/matlab.in b/runtime/indent/testdir/matlab.in new file mode 100644 index 0000000000..5bba1a56dd --- /dev/null +++ b/runtime/indent/testdir/matlab.in @@ -0,0 +1,80 @@ +% vim: set ft=matlab sw=4 : + +% START_INDENT +if true +disp foo +elseif false +disp bar +end +% END_INDENT + +% START_INDENT +try +statements +catch exception +statements +end +% END_INDENT + +% START_INDENT +if true, ... +if true +disp hello +end +end +% END_INDENT + +% START_INDENT +switch a +case expr +if true, foo; end +disp hello +otherwise +disp bar +end +% END_INDENT + +% START_INDENT +if true +A(1:end - 1) +disp foo +end +% END_INDENT + +% START_INDENT +A = [{ +} +] ... +disp foo +disp bar +% END_INDENT + +% START_INDENT +% INDENT_EXE let b:MATLAB_function_indent = 0 +function foo +disp foo +function nested +disp bar +end +end +% END_INDENT + +% START_INDENT +% INDENT_EXE let b:MATLAB_function_indent = 1 +function foo +disp foo +function nested +disp bar +end +end +% END_INDENT + +% START_INDENT +% INDENT_EXE let b:MATLAB_function_indent = 2 +function foo +disp foo +function nested +disp bar +end +end +% END_INDENT diff --git a/runtime/indent/testdir/matlab.ok b/runtime/indent/testdir/matlab.ok new file mode 100644 index 0000000000..b1112263b2 --- /dev/null +++ b/runtime/indent/testdir/matlab.ok @@ -0,0 +1,80 @@ +% vim: set ft=matlab sw=4 : + +% START_INDENT +if true + disp foo +elseif false + disp bar +end +% END_INDENT + +% START_INDENT +try + statements +catch exception + statements +end +% END_INDENT + +% START_INDENT +if true, ... + if true + disp hello + end +end +% END_INDENT + +% START_INDENT +switch a + case expr + if true, foo; end + disp hello + otherwise + disp bar +end +% END_INDENT + +% START_INDENT +if true + A(1:end - 1) + disp foo +end +% END_INDENT + +% START_INDENT +A = [{ + } + ] ... + disp foo +disp bar +% END_INDENT + +% START_INDENT +% INDENT_EXE let b:MATLAB_function_indent = 0 +function foo +disp foo + function nested + disp bar + end +end +% END_INDENT + +% START_INDENT +% INDENT_EXE let b:MATLAB_function_indent = 1 +function foo +disp foo + function nested + disp bar + end +end +% END_INDENT + +% START_INDENT +% INDENT_EXE let b:MATLAB_function_indent = 2 +function foo + disp foo + function nested + disp bar + end +end +% END_INDENT diff --git a/runtime/indent/testdir/tcl.in b/runtime/indent/testdir/tcl.in new file mode 100644 index 0000000000..c769d5bf5e --- /dev/null +++ b/runtime/indent/testdir/tcl.in @@ -0,0 +1,19 @@ +# vim: set filetype=tcl shiftwidth=4 tabstop=8 expandtab : + +# START_INDENT +proc abc {} { +set a 5 +if {[some_cmd]==1} { +foreach i [list {1 2 3}] { +# Does this comment affect anything? +puts $i +} +} +} + +command_with_a_long_time -arg1 "First" \ +-arg2 "Second" \ +-arg3 "Third" + +puts "Move indent back after line continuation is complete" +# END_INDENT
\ No newline at end of file diff --git a/runtime/indent/testdir/tcl.ok b/runtime/indent/testdir/tcl.ok new file mode 100644 index 0000000000..77f24e9044 --- /dev/null +++ b/runtime/indent/testdir/tcl.ok @@ -0,0 +1,19 @@ +# vim: set filetype=tcl shiftwidth=4 tabstop=8 expandtab : + +# START_INDENT +proc abc {} { + set a 5 + if {[some_cmd]==1} { + foreach i [list {1 2 3}] { + # Does this comment affect anything? + puts $i + } + } +} + +command_with_a_long_time -arg1 "First" \ + -arg2 "Second" \ + -arg3 "Third" + +puts "Move indent back after line continuation is complete" +# END_INDENT diff --git a/runtime/indent/testdir/xml.in b/runtime/indent/testdir/xml.in new file mode 100644 index 0000000000..b6333340e2 --- /dev/null +++ b/runtime/indent/testdir/xml.in @@ -0,0 +1,32 @@ +<!-- vim: set ft=xml ts=8 sw=0 sts=-1 et : --> +<!-- START_INDENT --> +<?xml version="1.0" encoding="utf-8"?> +<tag0> + <tag1> +<!-- comment --> +<tag2> + <tag3/> +</tag2> +<!-- text comment --> + +<!-- +text comment +--> +</tag1> +<!-- +text comment +end coment --> +</tag0> +<!-- END_INDENT --> + +<!-- START_INDENT --> +<?xml version="1.0" encoding="utf-8"?> +<tag0> + <tag1> +<!-- comment --> +<tag2> + <tag3/> +</tag2> +</tag1> +</tag0> +<!-- END_INDENT --> diff --git a/runtime/indent/testdir/xml.ok b/runtime/indent/testdir/xml.ok new file mode 100644 index 0000000000..cfdf701c11 --- /dev/null +++ b/runtime/indent/testdir/xml.ok @@ -0,0 +1,32 @@ +<!-- vim: set ft=xml ts=8 sw=0 sts=-1 et : --> +<!-- START_INDENT --> +<?xml version="1.0" encoding="utf-8"?> +<tag0> + <tag1> + <!-- comment --> + <tag2> + <tag3/> + </tag2> + <!-- text comment --> + + <!-- + text comment + --> + </tag1> + <!-- + text comment + end coment --> +</tag0> +<!-- END_INDENT --> + +<!-- START_INDENT --> +<?xml version="1.0" encoding="utf-8"?> +<tag0> + <tag1> + <!-- comment --> + <tag2> + <tag3/> + </tag2> + </tag1> +</tag0> +<!-- END_INDENT --> 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 dcafb467a6..883af98563 100644 --- a/runtime/indent/xml.vim +++ b/runtime/indent/xml.vim @@ -1,13 +1,26 @@ -" Language: xml -" Repository: https://github.com/chrisbra/vim-xml-ftplugin -" Maintainer: Christian Brabandt <cb@256bit.org> -" Previous Maintainer: Johannes Zellner <johannes@zellner.org> -" Last Change: 20180724 - Correctly indent xml comments https://github.com/vim/vim/issues/3200 -" Notes: 1) does not indent pure non-xml code (e.g. embedded scripts) -" 2) will be confused by unbalanced tags in comments -" or CDATA sections. -" 2009-05-26 patch by Nikolai Weibull -" TODO: implement pre-like tags, see xml_indent_open / xml_indent_close +" Language: xml +" Repository: https://github.com/chrisbra/vim-xml-ftplugin +" 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 +" https://github.com/chrisbra/vim-xml-ftplugin/issues/4 +" 20181116 - Fix indentation when tags start with a colon or an underscore +" https://github.com/vim/vim/pull/926 +" 20181022 - Do not overwrite indentkeys setting +" https://github.com/chrisbra/vim-xml-ftplugin/issues/1 +" 20180724 - Correctly indent xml comments https://github.com/vim/vim/issues/3200 +" +" Notes: +" 1) does not indent pure non-xml code (e.g. embedded scripts) +" 2) will be confused by unbalanced tags in comments +" or CDATA sections. +" 2009-05-26 patch by Nikolai Weibull +" TODO: implement pre-like tags, see xml_indent_open / xml_indent_close " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -18,11 +31,14 @@ let s:keepcpo= &cpo set cpo&vim " [-- local settings (must come before aborting the script) --] +" Attention: Parameter use_syntax_check is used by the docbk.vim indent script setlocal indentexpr=XmlIndentGet(v:lnum,1) -setlocal indentkeys=o,O,*<Return>,<>>,<<>,/,{,} +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' + let b:xml_indent_open = '.\{-}<[:A-Z_a-z]' " pre tag, e.g. <address> " let b:xml_indent_open = '.\{-}<[/]\@!\(address\)\@!' endif @@ -38,7 +54,7 @@ unlet s:keepcpo " [-- finish, if the function already exists --] if exists('*XmlIndentGet') - finish + finish endif let s:keepcpo= &cpo @@ -51,56 +67,119 @@ endfun " [-- check if it's xml --] fun! <SID>XmlIndentSynCheck(lnum) - if '' != &syntax - let syn1 = synIDattr(synID(a:lnum, 1, 1), 'name') - let syn2 = synIDattr(synID(a:lnum, strlen(getline(a:lnum)) - 1, 1), 'name') - if '' != syn1 && syn1 !~ 'xml' && '' != syn2 && syn2 !~ 'xml' - " don't indent pure non-xml code - return 0 - endif + if &syntax != '' + let syn1 = synIDattr(synID(a:lnum, 1, 1), 'name') + let syn2 = synIDattr(synID(a:lnum, strlen(getline(a:lnum)) - 1, 1), 'name') + if syn1 != '' && syn1 !~ 'xml' && syn2 != '' && syn2 !~ 'xml' + " don't indent pure non-xml code + return 0 + endif endif return 1 endfun " [-- return the sum of indents of a:lnum --] -fun! <SID>XmlIndentSum(lnum, style, add) - let line = getline(a:lnum) - if a:style == match(line, '^\s*</') - return (shiftwidth() * - \ (<SID>XmlIndentWithPattern(line, b:xml_indent_open) - \ - <SID>XmlIndentWithPattern(line, b:xml_indent_close) - \ - <SID>XmlIndentWithPattern(line, '.\{-}/>'))) + a:add +fun! <SID>XmlIndentSum(line, style, add) + if <SID>IsXMLContinuation(a:line) && a:style == 0 + " no complete tag, add one additional indent level + " but only for the current line + return a:add + shiftwidth() + elseif <SID>HasNoTagEnd(a:line) + " no complete tag, return initial indent + return a:add + endif + if a:style == match(a:line, '^\s*</') + return (shiftwidth() * + \ (<SID>XmlIndentWithPattern(a:line, b:xml_indent_open) + \ - <SID>XmlIndentWithPattern(a:line, b:xml_indent_close) + \ - <SID>XmlIndentWithPattern(a:line, '.\{-}/>'))) + a:add else - return a:add + return a:add endif endfun +" Main indent function fun! XmlIndentGet(lnum, use_syntax_check) " Find a non-empty line above the current line. - let lnum = prevnonblank(a:lnum - 1) - - " Hit the start of the file, use zero indent. - if lnum == 0 - return 0 + if prevnonblank(a:lnum - 1) == 0 + " Hit the start of the file, use zero indent. + return 0 endif + " Find previous line with a tag (regardless whether open or closed, + " 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]\)'. '\%(\&\%<'. a:lnum .'l\)' + let ptag = search(ptag_pattern, 'bnW') + " no previous tag + if ptag == 0 + return 0 + endif + + 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(lnum) - let check_alnum = <SID>XmlIndentSynCheck(a:lnum) - if 0 == check_lnum || 0 == check_alnum - return indent(a:lnum) - elseif -1 == check_lnum || -1 == check_alnum - return -1 - endif + 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_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 - let ind = <SID>XmlIndentSum(lnum, -1, indent(lnum)) - let ind = <SID>XmlIndentSum(a:lnum, 0, ind) + 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 + " Get indent from previous tag line + let ind = <SID>XmlIndentSum(pline, -1, pind) + " Determine indent from current line + let ind = <SID>XmlIndentSum(curline, 0, ind) return ind endfun +func! <SID>IsXMLContinuation(line) + " Checks, whether or not the line matches a start-of-tag + return a:line !~ '^\s*<' +endfunc + +func! <SID>HasNoTagEnd(line) + " Checks whether or not the line matches '>' (so finishes a tag) + return a:line !~ '>\s*$' +endfunc + +" return indent for a commented line, +" 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') + if getline(a:lnum) =~ '<!--' + " if previous tag was a closing tag, do not add + " one additional level of indent + if ptagclose > ptagopen && a:lnum > ptagclose + return indent(ptagclose) + else + " start of comment, add one indentation level + return indent(ptagopen) + shiftwidth() + endif + elseif getline(a:lnum) =~ '-->' + " end of comment, same as start of comment + return indent(search('<!--', 'bnW')) + else + " middle part of comment, add one additional level + return indent(search('<!--', 'bnW')) + shiftwidth() + endif +endfunc + let &cpo = s:keepcpo unlet s:keepcpo -" vim:ts=8 +" vim:ts=4 et sts=-1 sw=0 diff --git a/runtime/lua/man.lua b/runtime/lua/man.lua index 1da8ed85fc..ba6b9d09c9 100644 --- a/runtime/lua/man.lua +++ b/runtime/lua/man.lua @@ -107,7 +107,9 @@ local function highlight_line(line, linenr) -- followed by '[', then a series of parameter and intermediate bytes in -- the range 0x20 - 0x3f, then 'm'. (See ECMA-48, sections 5.4 & 8.3.117) local sgr = prev_char:match("^%[([\032-\063]*)m$") - if sgr then + -- Ignore escape sequences with : characters, as specified by ITU's T.416 + -- Open Document Architecture and interchange format. + if sgr and not string.find(sgr, ":") then local match while sgr and #sgr > 0 do -- Match against SGR parameters, which may be separated by ';' diff --git a/runtime/makemenu.vim b/runtime/makemenu.vim index 839dbdac07..7fb126977a 100644 --- a/runtime/makemenu.vim +++ b/runtime/makemenu.vim @@ -1,6 +1,6 @@ " Script to define the syntax menu in synmenu.vim " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2013 Jul 28 +" Last Change: 2018 May 17 " This is used by "make menu" in the src directory. edit <sfile>:p:h/synmenu.vim @@ -69,11 +69,13 @@ SynMenu AB.Applix\ ELF:elf SynMenu AB.APT\ config:aptconf SynMenu AB.Arc\ Macro\ Language:aml SynMenu AB.Arch\ inventory:arch +SynMenu AB.Arduino:arduino SynMenu AB.ART:art SynMenu AB.Ascii\ Doc:asciidoc SynMenu AB.ASP\ with\ VBScript:aspvbs SynMenu AB.ASP\ with\ Perl:aspperl SynMenu AB.Assembly.680x0:asm68k +SynMenu AB.Assembly.AVR:avra SynMenu AB.Assembly.Flat:fasm SynMenu AB.Assembly.GNU:asm SynMenu AB.Assembly.GNU\ H-8300:asmh8300 @@ -89,6 +91,7 @@ SynMenu AB.ASN\.1:asn SynMenu AB.Asterisk\ config:asterisk SynMenu AB.Asterisk\ voicemail\ config:asteriskvm SynMenu AB.Atlas:atlas +SynMenu AB.Autodoc:autodoc SynMenu AB.AutoHotKey:autohotkey SynMenu AB.AutoIt:autoit SynMenu AB.Automake:automake @@ -103,6 +106,7 @@ SynMenu AB.Basic.IBasic:ibasic SynMenu AB.Basic.QBasic:basic SynMenu AB.Basic.Visual\ Basic:vb SynMenu AB.Bazaar\ commit\ file:bzr +SynMenu AB.Bazel:bzl SynMenu AB.BC\ calculator:bc SynMenu AB.BDF\ font:bdf SynMenu AB.BibTeX.Bibliography\ database:bib @@ -132,6 +136,7 @@ SynMenu C.Clever:cl SynMenu C.Clipper:clipper SynMenu C.Clojure:clojure SynMenu C.Cmake:cmake +SynMenu C.Cmod:cmod SynMenu C.Cmusrc:cmusrc SynMenu C.Cobol:cobol SynMenu C.Coco/R:coco @@ -158,6 +163,7 @@ SynMenu DE.D:d SynMenu DE.Datascript:datascript SynMenu DE.Debian.Debian\ ChangeLog:debchangelog SynMenu DE.Debian.Debian\ Control:debcontrol +SynMenu DE.Debian.Debian\ Copyright:debcopyright SynMenu DE.Debian.Debian\ Sources\.list:debsources SynMenu DE.Denyhosts:denyhosts SynMenu DE.Desktop:desktop @@ -166,12 +172,14 @@ SynMenu DE.Dictd\ config:dictdconf SynMenu DE.Diff:diff SynMenu DE.Digital\ Command\ Lang:dcl SynMenu DE.Dircolors:dircolors +SynMenu DE.Dirpager:dirpager SynMenu DE.Django\ template:django SynMenu DE.DNS/BIND\ zone:bindzone SynMenu DE.Dnsmasq\ config:dnsmasq SynMenu DE.DocBook.auto-detect:docbk SynMenu DE.DocBook.SGML:docbksgml SynMenu DE.DocBook.XML:docbkxml +SynMenu DE.Dockerfile:dockerfile SynMenu DE.Dot:dot SynMenu DE.Doxygen.C\ with\ doxygen:c.doxygen SynMenu DE.Doxygen.C++\ with\ doxygen:cpp.doxygen @@ -199,6 +207,8 @@ SynMenu DE.ESQL-C:esqlc SynMenu DE.Essbase\ script:csc SynMenu DE.Esterel:esterel SynMenu DE.Eterm\ config:eterm +SynMenu DE.Euphoria\ 3:euphoria3 +SynMenu DE.Euphoria\ 4:euphoria4 SynMenu DE.Eviews:eviews SynMenu DE.Exim\ conf:exim SynMenu DE.Expect:expect @@ -231,6 +241,8 @@ SynMenu FG.Git.Send\ Email:gitsendemail SynMenu FG.Gitolite:gitolite SynMenu FG.Gkrellmrc:gkrellmrc SynMenu FG.Gnash:gnash +SynMenu FG.Go:go +SynMenu FG.Godoc:godoc SynMenu FG.GP:gp SynMenu FG.GPG:gpg SynMenu FG.Grof:gprof @@ -260,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 @@ -277,12 +290,14 @@ SynMenu HIJK.Inittab:inittab SynMenu HIJK.Inno\ setup:iss SynMenu HIJK.Innovation\ Data\ Processing.Upstream\ dat:upstreamdat SynMenu HIJK.Innovation\ Data\ Processing.Upstream\ log:upstreamlog +SynMenu HIJK.Innovation\ Data\ Processing.Upstream\ rpt:upstreamrpt SynMenu HIJK.Innovation\ Data\ Processing.Upstream\ Install\ log:upstreaminstalllog SynMenu HIJK.Innovation\ Data\ Processing.Usserver\ log:usserverlog SynMenu HIJK.Innovation\ Data\ Processing.USW2KAgt\ log:usw2kagtlog SynMenu HIJK.InstallShield\ script:ishd SynMenu HIJK.Interactive\ Data\ Lang:idlang SynMenu HIJK.IPfilter:ipfilter +SynMenu HIJK.J:j SynMenu HIJK.JAL:jal SynMenu HIJK.JAM:jam SynMenu HIJK.Jargon:jargon @@ -294,9 +309,11 @@ SynMenu HIJK.JavaScript:javascript SynMenu HIJK.Jess:jess SynMenu HIJK.Jgraph:jgraph SynMenu HIJK.Jovial:jovial +SynMenu HIJK.JSON:json SynMenu HIJK.Kconfig:kconfig SynMenu HIJK.KDE\ script:kscript SynMenu HIJK.Kimwitu++:kwt +SynMenu HIJK.Kivy:kivy SynMenu HIJK.KixTart:kix SynMenu L.Lace:lace @@ -305,6 +322,7 @@ SynMenu L.Latte:latte SynMenu L.Ld\ script:ld SynMenu L.LDAP.LDIF:ldif SynMenu L.LDAP.Configuration:ldapconf +SynMenu L.Less:less SynMenu L.Lex:lex SynMenu L.LFTP\ config:lftp SynMenu L.Libao:libao @@ -340,6 +358,7 @@ SynMenu M.Man\ page:man SynMenu M.Man\.conf:manconf SynMenu M.Maple\ V:maple SynMenu M.Markdown:markdown +SynMenu M.Markdown\ with\ R\ statements:rmd SynMenu M.Mason:mason SynMenu M.Mathematica:mma SynMenu M.Matlab:matlab @@ -349,6 +368,7 @@ SynMenu M.Messages\ (/var/log):messages SynMenu M.Metafont:mf SynMenu M.MetaPost:mp SynMenu M.MGL:mgl +SynMenu M.MIX:mix SynMenu M.MMIX:mmix SynMenu M.Modconf:modconf SynMenu M.Model:model @@ -356,6 +376,7 @@ SynMenu M.Modsim\ III:modsim3 SynMenu M.Modula\ 2:modula2 SynMenu M.Modula\ 3:modula3 SynMenu M.Monk:monk +SynMenu M.Motorola\ S-Record:srec SynMenu M.Mplayer\ config:mplayerconf SynMenu M.MOO:moo SynMenu M.Mrxvtrc:mrxvtrc @@ -368,12 +389,15 @@ SynMenu M.MS-DOS/Windows.Registry:registry SynMenu M.MS-DOS/Windows.Resource\ file:rc SynMenu M.Msql:msql SynMenu M.MuPAD:mupad +SynMenu M.Murphi:murphi SynMenu M.MUSHcode:mush SynMenu M.Muttrc:muttrc +SynMenu NO.N1QL:n1ql SynMenu NO.Nanorc:nanorc SynMenu NO.Nastran\ input/DMAP:nastran SynMenu NO.Natural:natural +SynMenu NO.NeoMutt\ setup\ files:neomuttrc SynMenu NO.Netrc:netrc SynMenu NO.Ninja:ninja SynMenu NO.Novell\ NCF\ batch:ncf @@ -461,14 +485,18 @@ SynMenu R.RockLinux\ package\ desc\.:desc SynMenu R.Rpcgen:rpcgen SynMenu R.RPL/2:rpl SynMenu R.ReStructuredText:rst +SynMenu M.ReStructuredText\ with\ R\ statements:rrst SynMenu R.RTF:rtf SynMenu R.Ruby:ruby +SynMenu R.Rust:rust SynMenu S-Sm.S-Lang:slang SynMenu S-Sm.Samba\ config:samba SynMenu S-Sm.SAS:sas SynMenu S-Sm.Sass:sass SynMenu S-Sm.Sather:sather +SynMenu S-Sm.Sbt:sbt +SynMenu S-Sm.Scala:scala SynMenu S-Sm.Scheme:scheme SynMenu S-Sm.Scilab:scilab SynMenu S-Sm.Screen\ RC:screen @@ -546,6 +574,8 @@ SynMenu Sn-Sy.Sudoers:sudoers SynMenu Sn-Sy.SVG:svg SynMenu Sn-Sy.Symbian\ meta-makefile:mmp SynMenu Sn-Sy.Sysctl\.conf:sysctl +SynMenu Sn-Sy.Systemd:systemd +SynMenu Sn-Sy.SystemVerilog:systemverilog SynMenu T.TADS:tads SynMenu T.Tags:tags @@ -560,6 +590,7 @@ SynMenu T.TealInfo:tli SynMenu T.Telix\ Salt:tsalt SynMenu T.Termcap/Printcap:ptcap SynMenu T.Terminfo:terminfo +SynMenu T.Tera\ Term:teraterm SynMenu T.TeX.TeX/LaTeX:tex SynMenu T.TeX.plain\ TeX:plaintex SynMenu T.TeX.Initex:initex @@ -569,6 +600,7 @@ SynMenu T.TeX.Texinfo:texinfo SynMenu T.TF\ mud\ client:tf SynMenu T.Tidy\ configuration:tidy SynMenu T.Tilde:tilde +SynMenu T.Tmux\ configuration:tmux SynMenu T.TPP:tpp SynMenu T.Trasys\ input:trasys SynMenu T.Treetop:treetop @@ -586,6 +618,7 @@ SynMenu UV.Updatedb\.conf:updatedb SynMenu UV.Upstart:upstart SynMenu UV.Valgrind:valgrind SynMenu UV.Vera:vera +SynMenu UV.Verbose\ TAP\ Output:tap SynMenu UV.Verilog-AMS\ HDL:verilogams SynMenu UV.Verilog\ HDL:verilog SynMenu UV.Vgrindefs:vgrindefs @@ -597,6 +630,7 @@ SynMenu UV.Virata\ config:virata SynMenu UV.Visual\ Basic:vb SynMenu UV.VOS\ CM\ macro:voscm SynMenu UV.VRML:vrml +SynMenu UV.Vroom:vroom SynMenu UV.VSE\ JCL:vsejcl SynMenu WXYZ.WEB.CWEB:cweb diff --git a/runtime/menu.vim b/runtime/menu.vim index 5e4bd1f11b..3756787e7f 100644 --- a/runtime/menu.vim +++ b/runtime/menu.vim @@ -2,7 +2,7 @@ " You can also use this as a start for your own set of menus. " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2018 May 17 +" Last Change: 2019 Jan 27 " Note that ":an" (short for ":anoremenu") is often used to make a menu work " in all modes and avoid side effects from mappings defined by the user. @@ -853,17 +853,15 @@ an 70.300 &Window.&New<Tab>^Wn <C-W>n an 70.310 &Window.S&plit<Tab>^Ws <C-W>s an 70.320 &Window.Sp&lit\ To\ #<Tab>^W^^ <C-W><C-^> an 70.330 &Window.Split\ &Vertically<Tab>^Wv <C-W>v -if has("vertsplit") - an <silent> 70.332 &Window.Split\ File\ E&xplorer :call MenuExplOpen()<CR> - if !exists("*MenuExplOpen") - fun MenuExplOpen() - if @% == "" - 20vsp . - else - exe "20vsp " . s:FnameEscape(expand("%:p:h")) - endif - endfun - endif +an <silent> 70.332 &Window.Split\ File\ E&xplorer :call MenuExplOpen()<CR> +if !exists("*MenuExplOpen") + fun MenuExplOpen() + if @% == "" + 20vsp . + else + exe "20vsp " . s:FnameEscape(expand("%:p:h")) + endif + endfun endif an 70.335 &Window.-SEP1- <Nop> an 70.340 &Window.&Close<Tab>^Wc :confirm close<CR> diff --git a/runtime/mswin.vim b/runtime/mswin.vim index 5ec21491fe..2b04c1aea3 100644 --- a/runtime/mswin.vim +++ b/runtime/mswin.vim @@ -1,9 +1,9 @@ " Set options and add mapping such that Vim behaves a lot like MS-Windows " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last change: 2017 Oct 28 +" Last Change: 2018 Dec 07 -" bail out if this isn't wanted (mrsvim.vim uses this). +" Bail out if this isn't wanted. if exists("g:skip_loading_mswin") && g:skip_loading_mswin finish endif diff --git a/runtime/optwin.vim b/runtime/optwin.vim index f3d7d3729b..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: 2018 May 15 +" Last Change: 2019 Jul 18 " If there already is an option window, jump to that one. let buf = bufnr('option-window') @@ -395,11 +395,9 @@ endif call <SID>Header("syntax, highlighting and spelling") call append("$", "background\t\"dark\" or \"light\"; the background color brightness") call <SID>OptionG("bg", &bg) -if has("autocmd") - call append("$", "filetype\ttype of file; triggers the FileType event when set") - call append("$", "\t(local to buffer)") - call <SID>OptionL("ft") -endif +call append("$", "filetype\ttype of file; triggers the FileType event when set") +call append("$", "\t(local to buffer)") +call <SID>OptionL("ft") if has("syntax") call append("$", "syntax\tname of syntax highlighting used") call append("$", "\t(local to buffer)") @@ -454,10 +452,8 @@ if has("statusline") endif call append("$", "equalalways\tmake all windows the same size when adding/removing windows") call <SID>BinOptionG("ea", &ea) -if has("vertsplit") - call append("$", "eadirection\tin which direction 'equalalways' works: \"ver\", \"hor\" or \"both\"") - call <SID>OptionG("ead", &ead) -endif +call append("$", "eadirection\tin which direction 'equalalways' works: \"ver\", \"hor\" or \"both\"") +call <SID>OptionG("ead", &ead) call append("$", "winheight\tminimal number of lines used for the current window") call append("$", " \tset wh=" . &wh) call append("$", "winminheight\tminimal number of lines used for any window") @@ -465,18 +461,18 @@ call append("$", " \tset wmh=" . &wmh) call append("$", "winfixheight\tkeep the height of the window") call append("$", "\t(local to window)") call <SID>BinOptionL("wfh") -if has("vertsplit") call append("$", "winfixwidth\tkeep the width of the window") call append("$", "\t(local to window)") call <SID>BinOptionL("wfw") - call append("$", "winwidth\tminimal number of columns used for the current window") - call append("$", " \tset wiw=" . &wiw) - call append("$", "winminwidth\tminimal number of columns used for any window") - call append("$", " \tset wmw=" . &wmw) -endif +call append("$", "winwidth\tminimal number of columns used for the current window") +call append("$", " \tset wiw=" . &wiw) +call append("$", "winminwidth\tminimal number of columns used for any window") +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") @@ -490,22 +486,16 @@ call append("$", "\tto a buffer") call <SID>OptionG("swb", &swb) call append("$", "splitbelow\ta new window is put below the current one") call <SID>BinOptionG("sb", &sb) -if has("vertsplit") - call append("$", "splitright\ta new window is put right of the current one") - call <SID>BinOptionG("spr", &spr) -endif -if has("scrollbind") - call append("$", "scrollbind\tthis window scrolls together with other bound windows") - call append("$", "\t(local to window)") - call <SID>BinOptionL("scb") - call append("$", "scrollopt\t\"ver\", \"hor\" and/or \"jump\"; list of options for 'scrollbind'") - call <SID>OptionG("sbo", &sbo) -endif -if has("cursorbind") - call append("$", "cursorbind\tthis window's cursor moves together with other bound windows") - call append("$", "\t(local to window)") - call <SID>BinOptionL("crb") -endif +call append("$", "splitright\ta new window is put right of the current one") +call <SID>BinOptionG("spr", &spr) +call append("$", "scrollbind\tthis window scrolls together with other bound windows") +call append("$", "\t(local to window)") +call <SID>BinOptionL("scb") +call append("$", "scrollopt\t\"ver\", \"hor\" and/or \"jump\"; list of options for 'scrollbind'") +call <SID>OptionG("sbo", &sbo) +call append("$", "cursorbind\tthis window's cursor moves together with other bound windows") +call append("$", "\t(local to window)") +call <SID>BinOptionL("crb") if has("terminal") call append("$", "termsize\tsize of a terminal window") call append("$", "\t(local to window)") @@ -944,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") @@ -1040,12 +1032,10 @@ if has("wildmenu") call append("$", "wildmenu\tcommand-line completion shows a list of matches") call <SID>BinOptionG("wmnu", &wmnu) endif -if has("vertsplit") - call append("$", "cedit\tkey used to open the command-line window") - call <SID>OptionG("cedit", &cedit) - call append("$", "cmdwinheight\theight of the command-line window") - call <SID>OptionG("cwh", &cwh) -endif +call append("$", "cedit\tkey used to open the command-line window") +call <SID>OptionG("cedit", &cedit) +call append("$", "cmdwinheight\theight of the command-line window") +call <SID>OptionG("cwh", &cwh) call <SID>Header("executing external commands") @@ -1208,14 +1198,10 @@ endif call <SID>Header("various") -if has("virtualedit") - call append("$", "virtualedit\twhen to use virtual editing: \"block\", \"insert\" and/or \"all\"") - call <SID>OptionG("ve", &ve) -endif -if has("autocmd") - call append("$", "eventignore\tlist of autocommand events which are to be ignored") - call <SID>OptionG("ei", &ei) -endif +call append("$", "virtualedit\twhen to use virtual editing: \"block\", \"insert\" and/or \"all\"") +call <SID>OptionG("ve", &ve) +call append("$", "eventignore\tlist of autocommand events which are to be ignored") +call <SID>OptionG("ei", &ei) call append("$", "loadplugins\tload plugin scripts when starting up") call <SID>BinOptionG("lpl", &lpl) call append("$", "exrc\tenable reading .vimrc/.exrc/.gvimrc in the current directory") diff --git a/runtime/pack/dist/opt/matchit/autoload/matchit.vim b/runtime/pack/dist/opt/matchit/autoload/matchit.vim new file mode 100644 index 0000000000..abf06d3c4c --- /dev/null +++ b/runtime/pack/dist/opt/matchit/autoload/matchit.vim @@ -0,0 +1,754 @@ +" matchit.vim: (global plugin) Extended "%" matching +" autload script of matchit plugin, see ../plugin/matchit.vim +" Last Change: 2019 Jan 28 + +let s:last_mps = "" +let s:last_words = ":" +let s:patBR = "" + +let s:save_cpo = &cpo +set cpo&vim + +" Auto-complete mappings: (not yet "ready for prime time") +" TODO Read :help write-plugin for the "right" way to let the user +" specify a key binding. +" let g:match_auto = '<C-]>' +" let g:match_autoCR = '<C-CR>' +" if exists("g:match_auto") +" execute "inoremap " . g:match_auto . ' x<Esc>"=<SID>Autocomplete()<CR>Pls' +" endif +" if exists("g:match_autoCR") +" execute "inoremap " . g:match_autoCR . ' <CR><C-R>=<SID>Autocomplete()<CR>' +" endif +" if exists("g:match_gthhoh") +" execute "inoremap " . g:match_gthhoh . ' <C-O>:call <SID>Gthhoh()<CR>' +" endif " gthhoh = "Get the heck out of here!" + +let s:notslash = '\\\@1<!\%(\\\\\)*' + +function s:RestoreOptions() + " In s:CleanUp(), :execute "set" restore_options . + let restore_options = "" + if get(b:, 'match_ignorecase', &ic) != &ic + let restore_options .= (&ic ? " " : " no") . "ignorecase" + let &ignorecase = b:match_ignorecase + endif + if &ve != '' + let restore_options = " ve=" . &ve . restore_options + set ve= + endif + return restore_options +endfunction + +function matchit#Match_wrapper(word, forward, mode) range + let restore_options = s:RestoreOptions() + " If this function was called from Visual mode, make sure that the cursor + " is at the correct end of the Visual range: + if a:mode == "v" + execute "normal! gv\<Esc>" + elseif a:mode == "o" && mode(1) !~# '[vV]' + exe "norm! v" + endif + " In s:CleanUp(), we may need to check whether the cursor moved forward. + let startpos = [line("."), col(".")] + " Use default behavior if called with a count. + if v:count + exe "normal! " . v:count . "%" + return s:CleanUp(restore_options, a:mode, startpos) + end + + " First step: if not already done, set the script variables + " s:do_BR flag for whether there are backrefs + " s:pat parsed version of b:match_words + " s:all regexp based on s:pat and the default groups + if !exists("b:match_words") || b:match_words == "" + let match_words = "" + elseif b:match_words =~ ":" + let match_words = b:match_words + else + " Allow b:match_words = "GetVimMatchWords()" . + execute "let match_words =" b:match_words + endif +" Thanks to Preben "Peppe" Guldberg and Bram Moolenaar for this suggestion! + if (match_words != s:last_words) || (&mps != s:last_mps) + \ || exists("b:match_debug") + let s:last_mps = &mps + " quote the special chars in 'matchpairs', replace [,:] with \| and then + " append the builtin pairs (/*, */, #if, #ifdef, #ifndef, #else, #elif, + " #endif) + let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") . + \ '\/\*:\*\/,#\s*if\%(n\=def\)\=:#\s*else\>:#\s*elif\>:#\s*endif\>' + " s:all = pattern with all the keywords + let match_words = match_words . (strlen(match_words) ? "," : "") . default + let s:last_words = match_words + if match_words !~ s:notslash . '\\\d' + let s:do_BR = 0 + let s:pat = match_words + else + let s:do_BR = 1 + let s:pat = s:ParseWords(match_words) + endif + let s:all = substitute(s:pat, s:notslash . '\zs[,:]\+', '\\|', 'g') + " Just in case there are too many '\(...)' groups inside the pattern, make + " sure to use \%(...) groups, so that error E872 can be avoided + let s:all = substitute(s:all, '\\(', '\\%(', 'g') + let s:all = '\%(' . s:all . '\)' + if exists("b:match_debug") + let b:match_pat = s:pat + endif + " Reconstruct the version with unresolved backrefs. + let s:patBR = substitute(match_words.',', + \ s:notslash.'\zs[,:]*,[,:]*', ',', 'g') + let s:patBR = substitute(s:patBR, s:notslash.'\zs:\{2,}', ':', 'g') + endif + + " Second step: set the following local variables: + " matchline = line on which the cursor started + " curcol = number of characters before match + " prefix = regexp for start of line to start of match + " suffix = regexp for end of match to end of line + " Require match to end on or after the cursor and prefer it to + " start on or before the cursor. + let matchline = getline(startpos[0]) + if a:word != '' + " word given + if a:word !~ s:all + echohl WarningMsg|echo 'Missing rule for word:"'.a:word.'"'|echohl NONE + return s:CleanUp(restore_options, a:mode, startpos) + endif + let matchline = a:word + let curcol = 0 + let prefix = '^\%(' + let suffix = '\)$' + " Now the case when "word" is not given + else " Find the match that ends on or after the cursor and set curcol. + let regexp = s:Wholematch(matchline, s:all, startpos[1]-1) + let curcol = match(matchline, regexp) + " If there is no match, give up. + if curcol == -1 + return s:CleanUp(restore_options, a:mode, startpos) + endif + let endcol = matchend(matchline, regexp) + let suf = strlen(matchline) - endcol + let prefix = (curcol ? '^.*\%' . (curcol + 1) . 'c\%(' : '^\%(') + let suffix = (suf ? '\)\%' . (endcol + 1) . 'c.*$' : '\)$') + endif + if exists("b:match_debug") + let b:match_match = matchstr(matchline, regexp) + let b:match_col = curcol+1 + endif + + " Third step: Find the group and single word that match, and the original + " (backref) versions of these. Then, resolve the backrefs. + " Set the following local variable: + " group = colon-separated list of patterns, one of which matches + " = ini:mid:fin or ini:fin + " + " Now, set group and groupBR to the matching group: 'if:endif' or + " 'while:endwhile' or whatever. A bit of a kluge: s:Choose() returns + " group . "," . groupBR, and we pick it apart. + let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, s:patBR) + let i = matchend(group, s:notslash . ",") + let groupBR = strpart(group, i) + let group = strpart(group, 0, i-1) + " Now, matchline =~ prefix . substitute(group,':','\|','g') . suffix + if s:do_BR " Do the hard part: resolve those backrefs! + let group = s:InsertRefs(groupBR, prefix, group, suffix, matchline) + endif + if exists("b:match_debug") + let b:match_wholeBR = groupBR + let i = matchend(groupBR, s:notslash . ":") + let b:match_iniBR = strpart(groupBR, 0, i-1) + endif + + " Fourth step: Set the arguments for searchpair(). + let i = matchend(group, s:notslash . ":") + let j = matchend(group, '.*' . s:notslash . ":") + let ini = strpart(group, 0, i-1) + let mid = substitute(strpart(group, i,j-i-1), s:notslash.'\zs:', '\\|', 'g') + let fin = strpart(group, j) + "Un-escape the remaining , and : characters. + let ini = substitute(ini, s:notslash . '\zs\\\(:\|,\)', '\1', 'g') + let mid = substitute(mid, s:notslash . '\zs\\\(:\|,\)', '\1', 'g') + let fin = substitute(fin, s:notslash . '\zs\\\(:\|,\)', '\1', 'g') + " searchpair() requires that these patterns avoid \(\) groups. + let ini = substitute(ini, s:notslash . '\zs\\(', '\\%(', 'g') + let mid = substitute(mid, s:notslash . '\zs\\(', '\\%(', 'g') + let fin = substitute(fin, s:notslash . '\zs\\(', '\\%(', 'g') + " Set mid. This is optimized for readability, not micro-efficiency! + if a:forward && matchline =~ prefix . fin . suffix + \ || !a:forward && matchline =~ prefix . ini . suffix + let mid = "" + endif + " Set flag. This is optimized for readability, not micro-efficiency! + if a:forward && matchline =~ prefix . fin . suffix + \ || !a:forward && matchline !~ prefix . ini . suffix + let flag = "bW" + else + let flag = "W" + endif + " Set skip. + if exists("b:match_skip") + let skip = b:match_skip + elseif exists("b:match_comment") " backwards compatibility and testing! + let skip = "r:" . b:match_comment + else + let skip = 's:comment\|string' + endif + let skip = s:ParseSkip(skip) + if exists("b:match_debug") + let b:match_ini = ini + let b:match_tail = (strlen(mid) ? mid.'\|' : '') . fin + endif + + " Fifth step: actually start moving the cursor and call searchpair(). + " Later, :execute restore_cursor to get to the original screen. + let view = winsaveview() + call cursor(0, curcol + 1) + if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on")) + let skip = "0" + else + execute "if " . skip . "| let skip = '0' | endif" + endif + let sp_return = searchpair(ini, mid, fin, flag, skip) + let final_position = "call cursor(" . line(".") . "," . col(".") . ")" + " Restore cursor position and original screen. + call winrestview(view) + normal! m' + if sp_return > 0 + execute final_position + endif + return s:CleanUp(restore_options, a:mode, startpos, mid.'\|'.fin) +endfun + +" Restore options and do some special handling for Operator-pending mode. +" The optional argument is the tail of the matching group. +fun! s:CleanUp(options, mode, startpos, ...) + if strlen(a:options) + execute "set" a:options + endif + " Open folds, if appropriate. + if a:mode != "o" + if &foldopen =~ "percent" + normal! zv + endif + " In Operator-pending mode, we want to include the whole match + " (for example, d%). + " This is only a problem if we end up moving in the forward direction. + elseif (a:startpos[0] < line(".")) || + \ (a:startpos[0] == line(".") && a:startpos[1] < col(".")) + if a:0 + " Check whether the match is a single character. If not, move to the + " end of the match. + let matchline = getline(".") + let currcol = col(".") + let regexp = s:Wholematch(matchline, a:1, currcol-1) + let endcol = matchend(matchline, regexp) + if endcol > currcol " This is NOT off by one! + call cursor(0, endcol) + endif + endif " a:0 + endif " a:mode != "o" && etc. + return 0 +endfun + +" Example (simplified HTML patterns): if +" a:groupBR = '<\(\k\+\)>:</\1>' +" a:prefix = '^.\{3}\(' +" a:group = '<\(\k\+\)>:</\(\k\+\)>' +" a:suffix = '\).\{2}$' +" a:matchline = "123<tag>12" or "123</tag>12" +" then extract "tag" from a:matchline and return "<tag>:</tag>" . +fun! s:InsertRefs(groupBR, prefix, group, suffix, matchline) + if a:matchline !~ a:prefix . + \ substitute(a:group, s:notslash . '\zs:', '\\|', 'g') . a:suffix + return a:group + endif + let i = matchend(a:groupBR, s:notslash . ':') + let ini = strpart(a:groupBR, 0, i-1) + let tailBR = strpart(a:groupBR, i) + let word = s:Choose(a:group, a:matchline, ":", "", a:prefix, a:suffix, + \ a:groupBR) + let i = matchend(word, s:notslash . ":") + let wordBR = strpart(word, i) + let word = strpart(word, 0, i-1) + " Now, a:matchline =~ a:prefix . word . a:suffix + if wordBR != ini + let table = s:Resolve(ini, wordBR, "table") + else + let table = "" + let d = 0 + while d < 10 + if tailBR =~ s:notslash . '\\' . d + let table = table . d + else + let table = table . "-" + endif + let d = d + 1 + endwhile + endif + let d = 9 + while d + if table[d] != "-" + let backref = substitute(a:matchline, a:prefix.word.a:suffix, + \ '\'.table[d], "") + " Are there any other characters that should be escaped? + let backref = escape(backref, '*,:') + execute s:Ref(ini, d, "start", "len") + let ini = strpart(ini, 0, start) . backref . strpart(ini, start+len) + let tailBR = substitute(tailBR, s:notslash . '\zs\\' . d, + \ escape(backref, '\\&'), 'g') + endif + let d = d-1 + endwhile + if exists("b:match_debug") + if s:do_BR + let b:match_table = table + let b:match_word = word + else + let b:match_table = "" + let b:match_word = "" + endif + endif + return ini . ":" . tailBR +endfun + +" Input a comma-separated list of groups with backrefs, such as +" a:groups = '\(foo\):end\1,\(bar\):end\1' +" and return a comma-separated list of groups with backrefs replaced: +" return '\(foo\):end\(foo\),\(bar\):end\(bar\)' +fun! s:ParseWords(groups) + let groups = substitute(a:groups.",", s:notslash.'\zs[,:]*,[,:]*', ',', 'g') + let groups = substitute(groups, s:notslash . '\zs:\{2,}', ':', 'g') + let parsed = "" + while groups =~ '[^,:]' + let i = matchend(groups, s:notslash . ':') + let j = matchend(groups, s:notslash . ',') + let ini = strpart(groups, 0, i-1) + let tail = strpart(groups, i, j-i-1) . ":" + let groups = strpart(groups, j) + let parsed = parsed . ini + let i = matchend(tail, s:notslash . ':') + while i != -1 + " In 'if:else:endif', ini='if' and word='else' and then word='endif'. + let word = strpart(tail, 0, i-1) + let tail = strpart(tail, i) + let i = matchend(tail, s:notslash . ':') + let parsed = parsed . ":" . s:Resolve(ini, word, "word") + endwhile " Now, tail has been used up. + let parsed = parsed . "," + endwhile " groups =~ '[^,:]' + let parsed = substitute(parsed, ',$', '', '') + return parsed +endfun + +" TODO I think this can be simplified and/or made more efficient. +" TODO What should I do if a:start is out of range? +" Return a regexp that matches all of a:string, such that +" matchstr(a:string, regexp) represents the match for a:pat that starts +" as close to a:start as possible, before being preferred to after, and +" ends after a:start . +" Usage: +" let regexp = s:Wholematch(getline("."), 'foo\|bar', col(".")-1) +" let i = match(getline("."), regexp) +" let j = matchend(getline("."), regexp) +" let match = matchstr(getline("."), regexp) +fun! s:Wholematch(string, pat, start) + let group = '\%(' . a:pat . '\)' + let prefix = (a:start ? '\(^.*\%<' . (a:start + 2) . 'c\)\zs' : '^') + let len = strlen(a:string) + let suffix = (a:start+1 < len ? '\(\%>'.(a:start+1).'c.*$\)\@=' : '$') + if a:string !~ prefix . group . suffix + let prefix = '' + endif + return prefix . group . suffix +endfun + +" No extra arguments: s:Ref(string, d) will +" find the d'th occurrence of '\(' and return it, along with everything up +" to and including the matching '\)'. +" One argument: s:Ref(string, d, "start") returns the index of the start +" of the d'th '\(' and any other argument returns the length of the group. +" Two arguments: s:Ref(string, d, "foo", "bar") returns a string to be +" executed, having the effect of +" :let foo = s:Ref(string, d, "start") +" :let bar = s:Ref(string, d, "len") +fun! s:Ref(string, d, ...) + let len = strlen(a:string) + if a:d == 0 + let start = 0 + else + let cnt = a:d + let match = a:string + while cnt + let cnt = cnt - 1 + let index = matchend(match, s:notslash . '\\(') + if index == -1 + return "" + endif + let match = strpart(match, index) + endwhile + let start = len - strlen(match) + if a:0 == 1 && a:1 == "start" + return start - 2 + endif + let cnt = 1 + while cnt + let index = matchend(match, s:notslash . '\\(\|\\)') - 1 + if index == -2 + return "" + endif + " Increment if an open, decrement if a ')': + let cnt = cnt + (match[index]=="(" ? 1 : -1) " ')' + let match = strpart(match, index+1) + endwhile + let start = start - 2 + let len = len - start - strlen(match) + endif + if a:0 == 1 + return len + elseif a:0 == 2 + return "let " . a:1 . "=" . start . "| let " . a:2 . "=" . len + else + return strpart(a:string, start, len) + endif +endfun + +" Count the number of disjoint copies of pattern in string. +" If the pattern is a literal string and contains no '0' or '1' characters +" then s:Count(string, pattern, '0', '1') should be faster than +" s:Count(string, pattern). +fun! s:Count(string, pattern, ...) + let pat = escape(a:pattern, '\\') + if a:0 > 1 + let foo = substitute(a:string, '[^'.a:pattern.']', "a:1", "g") + let foo = substitute(a:string, pat, a:2, "g") + let foo = substitute(foo, '[^' . a:2 . ']', "", "g") + return strlen(foo) + endif + let result = 0 + let foo = a:string + let index = matchend(foo, pat) + while index != -1 + let result = result + 1 + let foo = strpart(foo, index) + let index = matchend(foo, pat) + endwhile + return result +endfun + +" s:Resolve('\(a\)\(b\)', '\(c\)\2\1\1\2') should return table.word, where +" word = '\(c\)\(b\)\(a\)\3\2' and table = '-32-------'. That is, the first +" '\1' in target is replaced by '\(a\)' in word, table[1] = 3, and this +" indicates that all other instances of '\1' in target are to be replaced +" by '\3'. The hard part is dealing with nesting... +" Note that ":" is an illegal character for source and target, +" unless it is preceded by "\". +fun! s:Resolve(source, target, output) + let word = a:target + let i = matchend(word, s:notslash . '\\\d') - 1 + let table = "----------" + while i != -2 " There are back references to be replaced. + let d = word[i] + let backref = s:Ref(a:source, d) + " The idea is to replace '\d' with backref. Before we do this, + " replace any \(\) groups in backref with :1, :2, ... if they + " correspond to the first, second, ... group already inserted + " into backref. Later, replace :1 with \1 and so on. The group + " number w+b within backref corresponds to the group number + " s within a:source. + " w = number of '\(' in word before the current one + let w = s:Count( + \ substitute(strpart(word, 0, i-1), '\\\\', '', 'g'), '\(', '1') + let b = 1 " number of the current '\(' in backref + let s = d " number of the current '\(' in a:source + while b <= s:Count(substitute(backref, '\\\\', '', 'g'), '\(', '1') + \ && s < 10 + if table[s] == "-" + if w + b < 10 + " let table[s] = w + b + let table = strpart(table, 0, s) . (w+b) . strpart(table, s+1) + endif + let b = b + 1 + let s = s + 1 + else + execute s:Ref(backref, b, "start", "len") + let ref = strpart(backref, start, len) + let backref = strpart(backref, 0, start) . ":". table[s] + \ . strpart(backref, start+len) + let s = s + s:Count(substitute(ref, '\\\\', '', 'g'), '\(', '1') + endif + endwhile + let word = strpart(word, 0, i-1) . backref . strpart(word, i+1) + let i = matchend(word, s:notslash . '\\\d') - 1 + endwhile + let word = substitute(word, s:notslash . '\zs:', '\\', 'g') + if a:output == "table" + return table + elseif a:output == "word" + return word + else + return table . word + endif +endfun + +" Assume a:comma = ",". Then the format for a:patterns and a:1 is +" a:patterns = "<pat1>,<pat2>,..." +" a:1 = "<alt1>,<alt2>,..." +" If <patn> is the first pattern that matches a:string then return <patn> +" if no optional arguments are given; return <patn>,<altn> if a:1 is given. +fun! s:Choose(patterns, string, comma, branch, prefix, suffix, ...) + let tail = (a:patterns =~ a:comma."$" ? a:patterns : a:patterns . a:comma) + let i = matchend(tail, s:notslash . a:comma) + if a:0 + let alttail = (a:1 =~ a:comma."$" ? a:1 : a:1 . a:comma) + let j = matchend(alttail, s:notslash . a:comma) + endif + let current = strpart(tail, 0, i-1) + if a:branch == "" + let currpat = current + else + let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g') + endif + while a:string !~ a:prefix . currpat . a:suffix + let tail = strpart(tail, i) + let i = matchend(tail, s:notslash . a:comma) + if i == -1 + return -1 + endif + let current = strpart(tail, 0, i-1) + if a:branch == "" + let currpat = current + else + let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g') + endif + if a:0 + let alttail = strpart(alttail, j) + let j = matchend(alttail, s:notslash . a:comma) + endif + endwhile + if a:0 + let current = current . a:comma . strpart(alttail, 0, j-1) + endif + return current +endfun + +fun! matchit#Match_debug() + let b:match_debug = 1 " Save debugging information. + " pat = all of b:match_words with backrefs parsed + amenu &Matchit.&pat :echo b:match_pat<CR> + " match = bit of text that is recognized as a match + amenu &Matchit.&match :echo b:match_match<CR> + " curcol = cursor column of the start of the matching text + amenu &Matchit.&curcol :echo b:match_col<CR> + " wholeBR = matching group, original version + amenu &Matchit.wh&oleBR :echo b:match_wholeBR<CR> + " iniBR = 'if' piece, original version + amenu &Matchit.ini&BR :echo b:match_iniBR<CR> + " ini = 'if' piece, with all backrefs resolved from match + amenu &Matchit.&ini :echo b:match_ini<CR> + " tail = 'else\|endif' piece, with all backrefs resolved from match + amenu &Matchit.&tail :echo b:match_tail<CR> + " fin = 'endif' piece, with all backrefs resolved from match + amenu &Matchit.&word :echo b:match_word<CR> + " '\'.d in ini refers to the same thing as '\'.table[d] in word. + amenu &Matchit.t&able :echo '0:' . b:match_table . ':9'<CR> +endfun + +" Jump to the nearest unmatched "(" or "if" or "<tag>" if a:spflag == "bW" +" or the nearest unmatched "</tag>" or "endif" or ")" if a:spflag == "W". +" Return a "mark" for the original position, so that +" let m = MultiMatch("bW", "n") ... call winrestview(m) +" will return to the original position. If there is a problem, do not +" move the cursor and return {}, unless a count is given, in which case +" go up or down as many levels as possible and again return {}. +" TODO This relies on the same patterns as % matching. It might be a good +" idea to give it its own matching patterns. +fun! matchit#MultiMatch(spflag, mode) + let restore_options = s:RestoreOptions() + let startpos = [line("."), col(".")] + " save v:count1 variable, might be reset from the restore_cursor command + let level = v:count1 + if a:mode == "o" && mode(1) !~# '[vV]' + exe "norm! v" + endif + + " First step: if not already done, set the script variables + " s:do_BR flag for whether there are backrefs + " s:pat parsed version of b:match_words + " s:all regexp based on s:pat and the default groups + " This part is copied and slightly modified from matchit#Match_wrapper(). + if !exists("b:match_words") || b:match_words == "" + let match_words = "" + " Allow b:match_words = "GetVimMatchWords()" . + elseif b:match_words =~ ":" + let match_words = b:match_words + else + execute "let match_words =" b:match_words + endif + if (match_words != s:last_words) || (&mps != s:last_mps) || + \ exists("b:match_debug") + let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") . + \ '\/\*:\*\/,#\s*if\%(n\=def\)\=:#\s*else\>:#\s*elif\>:#\s*endif\>' + let s:last_mps = &mps + let match_words = match_words . (strlen(match_words) ? "," : "") . default + let s:last_words = match_words + if match_words !~ s:notslash . '\\\d' + let s:do_BR = 0 + let s:pat = match_words + else + let s:do_BR = 1 + let s:pat = s:ParseWords(match_words) + endif + let s:all = '\%(' . substitute(s:pat, '[,:]\+', '\\|', 'g') . '\)' + if exists("b:match_debug") + let b:match_pat = s:pat + endif + " Reconstruct the version with unresolved backrefs. + let s:patBR = substitute(match_words.',', + \ s:notslash.'\zs[,:]*,[,:]*', ',', 'g') + let s:patBR = substitute(s:patBR, s:notslash.'\zs:\{2,}', ':', 'g') + endif + + " Second step: figure out the patterns for searchpair() + " and save the screen, cursor position, and 'ignorecase'. + " - TODO: A lot of this is copied from matchit#Match_wrapper(). + " - maybe even more functionality should be split off + " - into separate functions! + let openlist = split(s:pat . ',', s:notslash . '\zs:.\{-}' . s:notslash . ',') + let midclolist = split(',' . s:pat, s:notslash . '\zs,.\{-}' . s:notslash . ':') + call map(midclolist, {-> split(v:val, s:notslash . ':')}) + let closelist = [] + let middlelist = [] + call map(midclolist, {i,v -> [extend(closelist, v[-1 : -1]), + \ extend(middlelist, v[0 : -2])]}) + call map(openlist, {i,v -> v =~# s:notslash . '\\|' ? '\%(' . v . '\)' : v}) + call map(middlelist, {i,v -> v =~# s:notslash . '\\|' ? '\%(' . v . '\)' : v}) + call map(closelist, {i,v -> v =~# s:notslash . '\\|' ? '\%(' . v . '\)' : v}) + let open = join(openlist, ',') + let middle = join(middlelist, ',') + let close = join(closelist, ',') + if exists("b:match_skip") + let skip = b:match_skip + elseif exists("b:match_comment") " backwards compatibility and testing! + let skip = "r:" . b:match_comment + else + let skip = 's:comment\|string' + endif + let skip = s:ParseSkip(skip) + let view = winsaveview() + + " Third step: call searchpair(). + " Replace '\('--but not '\\('--with '\%(' and ',' with '\|'. + let openpat = substitute(open, '\%(' . s:notslash . '\)\@<=\\(', '\\%(', 'g') + let openpat = substitute(openpat, ',', '\\|', 'g') + let closepat = substitute(close, '\%(' . s:notslash . '\)\@<=\\(', '\\%(', 'g') + let closepat = substitute(closepat, ',', '\\|', 'g') + let middlepat = substitute(middle, '\%(' . s:notslash . '\)\@<=\\(', '\\%(', 'g') + let middlepat = substitute(middlepat, ',', '\\|', 'g') + + if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on")) + let skip = '0' + else + try + execute "if " . skip . "| let skip = '0' | endif" + catch /^Vim\%((\a\+)\)\=:E363/ + " We won't find anything, so skip searching, should keep Vim responsive. + return {} + endtry + endif + mark ' + while level + if searchpair(openpat, middlepat, closepat, a:spflag, skip) < 1 + call s:CleanUp(restore_options, a:mode, startpos) + return {} + endif + let level = level - 1 + endwhile + + " Restore options and return a string to restore the original position. + call s:CleanUp(restore_options, a:mode, startpos) + return view +endfun + +" Search backwards for "if" or "while" or "<tag>" or ... +" and return "endif" or "endwhile" or "</tag>" or ... . +" For now, this uses b:match_words and the same script variables +" as matchit#Match_wrapper() . Later, it may get its own patterns, +" either from a buffer variable or passed as arguments. +" fun! s:Autocomplete() +" echo "autocomplete not yet implemented :-(" +" if !exists("b:match_words") || b:match_words == "" +" return "" +" end +" let startpos = matchit#MultiMatch("bW") +" +" if startpos == "" +" return "" +" endif +" " - TODO: figure out whether 'if' or '<tag>' matched, and construct +" " - the appropriate closing. +" let matchline = getline(".") +" let curcol = col(".") - 1 +" " - TODO: Change the s:all argument if there is a new set of match pats. +" let regexp = s:Wholematch(matchline, s:all, curcol) +" let suf = strlen(matchline) - matchend(matchline, regexp) +" let prefix = (curcol ? '^.\{' . curcol . '}\%(' : '^\%(') +" let suffix = (suf ? '\).\{' . suf . '}$' : '\)$') +" " Reconstruct the version with unresolved backrefs. +" let patBR = substitute(b:match_words.',', '[,:]*,[,:]*', ',', 'g') +" let patBR = substitute(patBR, ':\{2,}', ':', "g") +" " Now, set group and groupBR to the matching group: 'if:endif' or +" " 'while:endwhile' or whatever. +" let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, patBR) +" let i = matchend(group, s:notslash . ",") +" let groupBR = strpart(group, i) +" let group = strpart(group, 0, i-1) +" " Now, matchline =~ prefix . substitute(group,':','\|','g') . suffix +" if s:do_BR +" let group = s:InsertRefs(groupBR, prefix, group, suffix, matchline) +" endif +" " let g:group = group +" +" " - TODO: Construct the closing from group. +" let fake = "end" . expand("<cword>") +" execute startpos +" return fake +" endfun + +" Close all open structures. "Get the heck out of here!" +" fun! s:Gthhoh() +" let close = s:Autocomplete() +" while strlen(close) +" put=close +" let close = s:Autocomplete() +" endwhile +" endfun + +" Parse special strings as typical skip arguments for searchpair(): +" s:foo becomes (current syntax item) =~ foo +" S:foo becomes (current syntax item) !~ foo +" r:foo becomes (line before cursor) =~ foo +" R:foo becomes (line before cursor) !~ foo +fun! s:ParseSkip(str) + let skip = a:str + if skip[1] == ":" + if skip[0] == "s" + let skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '" . + \ strpart(skip,2) . "'" + elseif skip[0] == "S" + let skip = "synIDattr(synID(line('.'),col('.'),1),'name') !~? '" . + \ strpart(skip,2) . "'" + elseif skip[0] == "r" + let skip = "strpart(getline('.'),0,col('.'))=~'" . strpart(skip,2). "'" + elseif skip[0] == "R" + let skip = "strpart(getline('.'),0,col('.'))!~'" . strpart(skip,2). "'" + endif + endif + return skip +endfun + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim:sts=2:sw=2:et: diff --git a/runtime/doc/pi_matchit.txt b/runtime/pack/dist/opt/matchit/doc/matchit.txt index 652734f7bb..b2b78089a0 100644 --- a/runtime/doc/pi_matchit.txt +++ b/runtime/pack/dist/opt/matchit/doc/matchit.txt @@ -1,6 +1,13 @@ -*pi_matchit.txt* Extended "%" matching +*matchit.txt* Extended "%" matching -For Vim version 6.3. Last change: 2017 May 14 +For instructions on installing this file, type + `:help matchit-install` +inside Vim. + +For Vim version 8.1. Last change: 2019 May 05 + + + VIM REFERENCE MANUAL by Benji Fisher et al *matchit* *matchit.vim* @@ -34,7 +41,7 @@ g% Cycle backwards through matching groups, as specified by ]% Go to [count] next unmatched group, as specified by |b:match_words|. Similar to |]}|. - *a%* *v_a%* + *v_a%* a% In Visual mode, select the matching group, as specified by |b:match_words|, containing the cursor. Similar to |v_a[|. A [count] is ignored, and only the first character of the closing @@ -62,12 +69,8 @@ for how to specify matching patterns. MODES: *matchit-modes* *matchit-v_%* *matchit-o_%* -Mostly, % and related motions (|g%| and |[%| and |]%|) work just like built-in -motion commands in |Operator-pending| and |Visual| modes. However, you -cannot make these motions |linewise| or |characterwise|, since the |:omap|s -that define them start with "v" in order to make the default behavior -inclusive. (See |o_v|.) In other words, "dV%" will not work. The -work-around is to go through Visual mode: "V%d" will work. +Mostly, % and related motions (|g%| and |[%| and |]%|) should just work like built-in +|motion| commands in |Operator-pending| and |Visual| modes (as of 8.1.648) LANGUAGES: *matchit-languages* @@ -81,9 +84,9 @@ To support a new language, see |matchit-newlang| below. DETAILS: *matchit-details* *matchit-parse* Here is an outline of what matchit.vim does each time you hit the "%" key. If -there are backrefs in |b:match_words| then the first step is to produce a +there are |backref|s in |b:match_words| then the first step is to produce a version in which these back references have been eliminated; if there are no -backrefs then this step is skipped. This step is called parsing. For +|backref|s then this step is skipped. This step is called parsing. For example, "\(foo\|bar\):end\1" is parsed to yield "\(foo\|bar\):end\(foo\|bar\)". This can get tricky, especially if there are nested groups. If debugging is turned on, the parsed version is saved as @@ -128,9 +131,9 @@ column of the start of the match is saved as |b:match_col|. Next, the script looks through |b:match_words| (original and parsed versions) for the group and pattern that match. If debugging is turned on, the group is saved as |b:match_ini| (the first pattern) and |b:match_tail| (the rest). If -there are backrefs then, in addition, the matching pattern is saved as +there are |backref|s then, in addition, the matching pattern is saved as |b:match_word| and a table of translations is saved as |b:match_table|. If -there are backrefs, these are determined from the matching pattern and +there are |backref|s, these are determined from the matching pattern and |b:match_match| and substituted into each pattern in the matching group. The script decides whether to search forwards or backwards and chooses @@ -142,11 +145,32 @@ setting |b:match_skip|. ============================================================================== 2. Activation *matchit-activate* -For a new language, you can add a line such as > +To use the matchit plugin add this line to your |vimrc|: > + packadd! matchit + +The script should start working the next time you start Vim. + +(Earlier versions of the script did nothing unless a |buffer-variable| named +|b:match_words| was defined. Even earlier versions contained autocommands +that set this variable for various file types. Now, |b:match_words| is +defined in many of the default |filetype-plugin|s instead.) + +For a new language, you can add autocommands to the script or to your vimrc +file, but the recommended method is to add a line such as > let b:match_words = '\<foo\>:\<bar\>' -to the corresponding |filetype-plugin|. See |b:match_words| below for how +to the |filetype-plugin| for your language. See |b:match_words| below for how this variable is interpreted. +TROUBLESHOOTING *matchit-troubleshoot* + +The script should work in most installations of Vim. It may not work if Vim +was compiled with a minimal feature set, for example if the |+syntax| option +was not enabled. If your Vim has support for syntax compiled in, but you do +not have |syntax| highlighting turned on, matchit.vim should work, but it may +fail to skip matching groups in comments and strings. If the |filetype| +mechanism is turned off, the |b:match_words| variable will probably not be +defined automatically. + ============================================================================== 3. Configuration *matchit-configure* @@ -235,7 +259,7 @@ have only one group; the effect is undefined if a group has only one pattern. A simple example is > :let b:match_words = '\<if\>:\<endif\>,' \ . '\<while\>:\<continue\>:\<break\>:\<endwhile\>' -(In Vim regular expressions, |/\<| and |/\>| denote word boundaries. Thus "if" +(In Vim regular expressions, |\<| and |\>| denote word boundaries. Thus "if" matches the end of "endif" but "\<if\>" does not.) Then banging on the "%" key will bounce the cursor between "if" and the matching "endif"; and from "while" to any matching "continue" or "break", then to the matching "endwhile" @@ -256,7 +280,7 @@ definition to a |filetype-plugin| file. Tips: Be careful that your initial pattern does not match your final pattern. See the example above for the use of word-boundary expressions. It is usually better to use ".\{-}" (as many as necessary) instead of ".*" (as many as -possible). See |/\{-|. For example, in the string "<tag>label</tag>", "<.*>" +possible). See |\{-|. For example, in the string "<tag>label</tag>", "<.*>" matches the whole string whereas "<.\{-}>" and "<[^>]*>" match "<tag>" and "</tag>". @@ -275,18 +299,18 @@ if keywords are only recognized after the start of a line or after a semicolon (;), with optional white space. *matchit-backref* *matchit-\1* -In any group, the expressions `\1`, `\2`, ..., `\9` (see |/\1|) refer to parts of the -INITIAL pattern enclosed in escaped parentheses. These are referred to as -back references, or backrefs. For example, > +In any group, the expressions |\1|, |\2|, ..., |\9| refer to parts of the +INITIAL pattern enclosed in |\(|escaped parentheses|\)|. These are referred +to as back references, or backrefs. For example, > :let b:match_words = '\<b\(o\+\)\>:\(h\)\1\>' means that "bo" pairs with "ho" and "boo" pairs with "hoo" and so on. Note that "\1" does not refer to the "\(h\)" in this example. If you have "\(nested \(parentheses\)\) then "\d" refers to the d-th "\(" and everything up to and including the matching "\)": in "\(nested\(parentheses\)\)", "\1" refers to everything and "\2" refers to "\(parentheses\)". If you use a -variable such as `s:notend` or `s:sol` in the previous paragraph then remember +variable such as |s:notend| or |s:sol| in the previous paragraph then remember to count any "\(" patterns in this variable. You do not have to count groups -defined by |/\%(\)|. +defined by |\%(\)|. It should be possible to resolve back references from any pattern in the group. For example, > @@ -297,7 +321,7 @@ cannot be determined from "andbar". On the other hand, > should work (and have the same effect as "foobar:barfoo:endfoobar"), although this has not been thoroughly tested. -You can use |/zero-width| patterns such as |/\@<=| and |/\zs|. (The latter has +You can use |zero-width| patterns such as |\@<=| and |\zs|. (The latter has not been thouroughly tested in matchit.vim.) For example, if the keyword "if" must occur at the start of the line, with optional white space, you might use the pattern "\(^\s*\)\@<=if" so that the cursor will end on the "i" instead of @@ -305,7 +329,7 @@ at the start of the line. For another example, if HTML had only one tag then one could > :let b:match_words = '<:>,<\@<=tag>:<\@<=/tag>' so that "%" can bounce between matching "<" and ">" pairs or (starting on -"tag" or "/tag") between matching tags. Without the |/\@<=|, the script would +"tag" or "/tag") between matching tags. Without the |\@<=|, the script would bounce from "tag" to the "<" in "</tag>", and another "%" would not take you back to where you started. @@ -322,10 +346,10 @@ the variables described below. You will probably also want to read Defining the variable |b:match_debug| causes the script to set the following variables, each time you hit the "%" key. Several of these are only defined -if |b:match_words| includes backrefs. +if |b:match_words| includes |backref|s. *b:match_pat* -The b:match_pat variable is set to |b:match_words| with backrefs parsed. +The b:match_pat variable is set to |b:match_words| with |backref|s parsed. *b:match_match* The b:match_match variable is set to the bit of text that is recognized as a match. @@ -334,15 +358,15 @@ The b:match_col variable is set to the cursor column of the start of the matching text. *b:match_wholeBR* The b:match_wholeBR variable is set to the comma-separated group of patterns -that matches, with backrefs unparsed. +that matches, with |backref|s unparsed. *b:match_iniBR* The b:match_iniBR variable is set to the first pattern in |b:match_wholeBR|. *b:match_ini* The b:match_ini variable is set to the first pattern in |b:match_wholeBR|, -with backrefs resolved from |b:match_match|. +with |backref|s resolved from |b:match_match|. *b:match_tail* The b:match_tail variable is set to the remaining patterns in -|b:match_wholeBR|, with backrefs resolved from |b:match_match|. +|b:match_wholeBR|, with |backref|s resolved from |b:match_match|. *b:match_word* The b:match_word variable is set to the pattern from |b:match_wholeBR| that matches |b:match_match|. @@ -353,14 +377,15 @@ The back reference '\'.d refers to the same thing as '\'.b:match_table[d] in ============================================================================== 5. Known Bugs and Limitations *matchit-bugs* -The various |:vmap|s defined in the script (%, |g%|, |[%|, |]%|, |a%|) may -have undesired effects in Select mode |Select-mode-mapping|. At least, if you -want to replace the selection with any character in "ag%[]" there will be a -pause of |'updatetime'| first. E.g., "yV%" would normally work linewise, but -the plugin mapping makes it characterwise. +Just because I know about a bug does not mean that it is on my todo list. I +try to respond to reports of bugs that cause real problems. If it does not +cause serious problems, or if there is a work-around, a bug may sit there for +a while. Moral: if a bug (known or not) bothers you, let me know. It would be nice if "\0" were recognized as the entire pattern. That is, it -would be nice if "foo:\end\0" had the same effect as "\(foo\):\end\1". +would be nice if "foo:\end\0" had the same effect as "\(foo\):\end\1". I may +try to implement this in a future version. (This is not so easy to arrange as +you might think!) ============================================================================== - vim:tw=78:ts=8:noet:ft=help:norl: +vim:tw=78:fo=tcq2:ft=help: diff --git a/runtime/pack/dist/opt/matchit/plugin/matchit.vim b/runtime/pack/dist/opt/matchit/plugin/matchit.vim new file mode 100644 index 0000000000..84147f1fc8 --- /dev/null +++ b/runtime/pack/dist/opt/matchit/plugin/matchit.vim @@ -0,0 +1,92 @@ +" matchit.vim: (global plugin) Extended "%" matching +" Maintainer: Christian Brabandt +" Version: 1.15 +" Last Change: 2019 Jan 28 +" Repository: https://github.com/chrisbra/matchit +" Previous URL:http://www.vim.org/script.php?script_id=39 +" Previous Maintainer: Benji Fisher PhD <benji@member.AMS.org> + +" Documentation: +" The documentation is in a separate file: ../doc/matchit.txt . + +" Credits: +" Vim editor by Bram Moolenaar (Thanks, Bram!) +" Original script and design by Raul Segura Acevedo +" Support for comments by Douglas Potts +" Support for back references and other improvements by Benji Fisher +" Support for many languages by Johannes Zellner +" Suggestions for improvement, bug reports, and support for additional +" languages by Jordi-Albert Batalla, Neil Bird, Servatius Brandt, Mark +" Collett, Stephen Wall, Dany St-Amant, Yuheng Xie, and Johannes Zellner. + +" Debugging: +" If you'd like to try the built-in debugging commands... +" :MatchDebug to activate debugging for the current buffer +" This saves the values of several key script variables as buffer-local +" variables. See the MatchDebug() function, below, for details. + +" TODO: I should think about multi-line patterns for b:match_words. +" This would require an option: how many lines to scan (default 1). +" This would be useful for Python, maybe also for *ML. +" TODO: Maybe I should add a menu so that people will actually use some of +" the features that I have implemented. +" TODO: Eliminate the MultiMatch function. Add yet another argument to +" Match_wrapper() instead. +" TODO: Allow :let b:match_words = '\(\(foo\)\(bar\)\):\3\2:end\1' +" TODO: Make backrefs safer by using '\V' (very no-magic). +" TODO: Add a level of indirection, so that custom % scripts can use my +" work but extend it. + +" Allow user to prevent loading and prevent duplicate loading. +if exists("g:loaded_matchit") || &cp + finish +endif +let g:loaded_matchit = 1 + +let s:save_cpo = &cpo +set cpo&vim + +nnoremap <silent> <Plug>(MatchitNormalForward) :<C-U>call matchit#Match_wrapper('',1,'n')<CR> +nnoremap <silent> <Plug>(MatchitNormalBackward) :<C-U>call matchit#Match_wrapper('',0,'n')<CR> +vnoremap <silent> <Plug>(MatchitVisualForward) :<C-U>call matchit#Match_wrapper('',1,'v')<CR>m'gv`` +vnoremap <silent> <Plug>(MatchitVisualBackward) :<C-U>call matchit#Match_wrapper('',0,'v')<CR>m'gv`` +onoremap <silent> <Plug>(MatchitOperationForward) :<C-U>call matchit#Match_wrapper('',1,'o')<CR> +onoremap <silent> <Plug>(MatchitOperationBackward) :<C-U>call matchit#Match_wrapper('',0,'o')<CR> + +nmap <silent> % <Plug>(MatchitNormalForward) +nmap <silent> g% <Plug>(MatchitNormalBackward) +xmap <silent> % <Plug>(MatchitVisualForward) +xmap <silent> g% <Plug>(MatchitVisualBackward) +omap <silent> % <Plug>(MatchitOperationForward) +omap <silent> g% <Plug>(MatchitOperationBackward) + +" Analogues of [{ and ]} using matching patterns: +nnoremap <silent> <Plug>(MatchitNormalMultiBackward) :<C-U>call matchit#MultiMatch("bW", "n")<CR> +nnoremap <silent> <Plug>(MatchitNormalMultiForward) :<C-U>call matchit#MultiMatch("W", "n")<CR> +vnoremap <silent> <Plug>(MatchitVisualMultiBackward) :<C-U>call matchit#MultiMatch("bW", "n")<CR>m'gv`` +vnoremap <silent> <Plug>(MatchitVisualMultiForward) :<C-U>call matchit#MultiMatch("W", "n")<CR>m'gv`` +onoremap <silent> <Plug>(MatchitOperationMultiBackward) :<C-U>call matchit#MultiMatch("bW", "o")<CR> +onoremap <silent> <Plug>(MatchitOperationMultiForward) :<C-U>call matchit#MultiMatch("W", "o")<CR> + +nmap <silent> [% <Plug>(MatchitNormalMultiBackward) +nmap <silent> ]% <Plug>(MatchitNormalMultiForward) +xmap <silent> [% <Plug>(MatchitVisualMultiBackward) +xmap <silent> ]% <Plug>(MatchitVisualMultiForward) +omap <silent> [% <Plug>(MatchitOperationMultiBackward) +omap <silent> ]% <Plug>(MatchitOperationMultiForward) + +" text object: +vmap <silent> <Plug>(MatchitVisualTextObject) <Plug>(MatchitVisualMultiBackward)o<Plug>(MatchitVisualMultiForward) +xmap a% <Plug>(MatchitVisualTextObject) + +" Call this function to turn on debugging information. Every time the main +" script is run, buffer variables will be saved. These can be used directly +" or viewed using the menu items below. +if !exists(":MatchDebug") + command! -nargs=0 MatchDebug call matchit#Match_debug() +endif + +let &cpo = s:save_cpo +unlet s:save_cpo + +" vim:sts=2:sw=2:et: diff --git a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim index 04d940948a..a3356d35a5 100644 --- a/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim +++ b/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim @@ -119,10 +119,14 @@ func s:StartDebug_internal(dict) let s:startsigncolumn = &signcolumn let s:save_columns = 0 + let s:allleft = 0 if exists('g:termdebug_wide') if &columns < g:termdebug_wide let s:save_columns = &columns let &columns = g:termdebug_wide + " If we make the Vim window wider, use the whole left halve for the debug + " windows. + let s:allleft = 1 endif let s:vertical = 1 else @@ -140,7 +144,7 @@ endfunc func s:StartDebug_term(dict) " Open a terminal window without a job, to run the debugged program in. - execute 'new' + execute s:vertical ? 'vnew' : 'new' let s:pty_job_id = termopen('tail -f /dev/null;#gdb program') if s:pty_job_id == 0 echoerr 'invalid argument (or job table is full) while opening terminal window' @@ -157,6 +161,10 @@ func s:StartDebug_term(dict) " Assuming the source code window will get a signcolumn, use two more " columns for that, thus one less for the terminal window. exe (&columns / 2 - 1) . "wincmd |" + if s:allleft + " use the whole left column + wincmd H + endif endif " Create a hidden terminal window to communicate with gdb diff --git a/runtime/plugin/matchit.vim b/runtime/plugin/matchit.vim index c160522f90..63be644062 100644 --- a/runtime/plugin/matchit.vim +++ b/runtime/plugin/matchit.vim @@ -1,817 +1,4 @@ -" matchit.vim: (global plugin) Extended "%" matching -" Last Change: 2018 Jul 3 by Christian Brabandt -" Maintainer: Benji Fisher PhD <benji@member.AMS.org> -" Version: 1.13.3, for Vim 6.3+ -" Fix from Tommy Allen included. -" Fix from Fernando Torres included. -" Improvement from Ken Takata included. -" URL: http://www.vim.org/script.php?script_id=39 - -" Documentation: -" The documentation is in a separate file, matchit.txt . - -" Credits: -" Vim editor by Bram Moolenaar (Thanks, Bram!) -" Original script and design by Raul Segura Acevedo -" Support for comments by Douglas Potts -" Support for back references and other improvements by Benji Fisher -" Support for many languages by Johannes Zellner -" Suggestions for improvement, bug reports, and support for additional -" languages by Jordi-Albert Batalla, Neil Bird, Servatius Brandt, Mark -" Collett, Stephen Wall, Dany St-Amant, Yuheng Xie, and Johannes Zellner. - -" Debugging: -" If you'd like to try the built-in debugging commands... -" :MatchDebug to activate debugging for the current buffer -" This saves the values of several key script variables as buffer-local -" variables. See the MatchDebug() function, below, for details. - -" TODO: I should think about multi-line patterns for b:match_words. -" This would require an option: how many lines to scan (default 1). -" This would be useful for Python, maybe also for *ML. -" TODO: Maybe I should add a menu so that people will actually use some of -" the features that I have implemented. -" TODO: Eliminate the MultiMatch function. Add yet another argument to -" Match_wrapper() instead. -" TODO: Allow :let b:match_words = '\(\(foo\)\(bar\)\):\3\2:end\1' -" TODO: Make backrefs safer by using '\V' (very no-magic). -" TODO: Add a level of indirection, so that custom % scripts can use my -" work but extend it. - -" allow user to prevent loading -" and prevent duplicate loading -if exists("loaded_matchit") || &cp - finish +" Nvim: load the matchit plugin by default. +if stridx(&packpath, $VIMRUNTIME) >= 0 + packadd matchit endif -let loaded_matchit = 1 -let s:last_mps = "" -let s:last_words = ":" -let s:patBR = "" - -let s:save_cpo = &cpo -set cpo&vim - -nnoremap <silent> % :<C-U>call <SID>Match_wrapper('',1,'n') <CR> -nnoremap <silent> g% :<C-U>call <SID>Match_wrapper('',0,'n') <CR> -vnoremap <silent> % :<C-U>call <SID>Match_wrapper('',1,'v') <CR>m'gv`` -vnoremap <silent> g% :<C-U>call <SID>Match_wrapper('',0,'v') <CR>m'gv`` -onoremap <silent> % v:<C-U>call <SID>Match_wrapper('',1,'o') <CR> -onoremap <silent> g% v:<C-U>call <SID>Match_wrapper('',0,'o') <CR> - -" Analogues of [{ and ]} using matching patterns: -nnoremap <silent> [% :<C-U>call <SID>MultiMatch("bW", "n") <CR> -nnoremap <silent> ]% :<C-U>call <SID>MultiMatch("W", "n") <CR> -vmap [% <Esc>[%m'gv`` -vmap ]% <Esc>]%m'gv`` -" vnoremap <silent> [% :<C-U>call <SID>MultiMatch("bW", "v") <CR>m'gv`` -" vnoremap <silent> ]% :<C-U>call <SID>MultiMatch("W", "v") <CR>m'gv`` -onoremap <silent> [% v:<C-U>call <SID>MultiMatch("bW", "o") <CR> -onoremap <silent> ]% v:<C-U>call <SID>MultiMatch("W", "o") <CR> - -" text object: -vmap a% <Esc>[%v]% - -" Auto-complete mappings: (not yet "ready for prime time") -" TODO Read :help write-plugin for the "right" way to let the user -" specify a key binding. -" let g:match_auto = '<C-]>' -" let g:match_autoCR = '<C-CR>' -" if exists("g:match_auto") -" execute "inoremap " . g:match_auto . ' x<Esc>"=<SID>Autocomplete()<CR>Pls' -" endif -" if exists("g:match_autoCR") -" execute "inoremap " . g:match_autoCR . ' <CR><C-R>=<SID>Autocomplete()<CR>' -" endif -" if exists("g:match_gthhoh") -" execute "inoremap " . g:match_gthhoh . ' <C-O>:call <SID>Gthhoh()<CR>' -" endif " gthhoh = "Get the heck out of here!" - -let s:notslash = '\\\@<!\%(\\\\\)*' - -function! s:Match_wrapper(word, forward, mode) range - " In s:CleanUp(), :execute "set" restore_options . - let restore_options = "" - if exists("b:match_ignorecase") && b:match_ignorecase != &ic - let restore_options .= (&ic ? " " : " no") . "ignorecase" - let &ignorecase = b:match_ignorecase - endif - if &ve != '' - let restore_options = " ve=" . &ve . restore_options - set ve= - endif - " If this function was called from Visual mode, make sure that the cursor - " is at the correct end of the Visual range: - if a:mode == "v" - execute "normal! gv\<Esc>" - endif - " In s:CleanUp(), we may need to check whether the cursor moved forward. - let startline = line(".") - let startcol = col(".") - " Use default behavior if called with a count. - if v:count - exe "normal! " . v:count . "%" - return s:CleanUp(restore_options, a:mode, startline, startcol) - end - - " First step: if not already done, set the script variables - " s:do_BR flag for whether there are backrefs - " s:pat parsed version of b:match_words - " s:all regexp based on s:pat and the default groups - " - if !exists("b:match_words") || b:match_words == "" - let match_words = "" - " Allow b:match_words = "GetVimMatchWords()" . - elseif b:match_words =~ ":" - let match_words = b:match_words - else - execute "let match_words =" b:match_words - endif -" Thanks to Preben "Peppe" Guldberg and Bram Moolenaar for this suggestion! - if (match_words != s:last_words) || (&mps != s:last_mps) - \ || exists("b:match_debug") - let s:last_mps = &mps - " The next several lines were here before - " BF started messing with this script. - " quote the special chars in 'matchpairs', replace [,:] with \| and then - " append the builtin pairs (/*, */, #if, #ifdef, #else, #elif, #endif) - " let default = substitute(escape(&mps, '[$^.*~\\/?]'), '[,:]\+', - " \ '\\|', 'g').'\|\/\*\|\*\/\|#if\>\|#ifdef\>\|#else\>\|#elif\>\|#endif\>' - let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") . - \ '\/\*:\*\/,#\s*if\%(def\)\=:#\s*else\>:#\s*elif\>:#\s*endif\>' - " s:all = pattern with all the keywords - let match_words = match_words . (strlen(match_words) ? "," : "") . default - let s:last_words = match_words - if match_words !~ s:notslash . '\\\d' - let s:do_BR = 0 - let s:pat = match_words - else - let s:do_BR = 1 - let s:pat = s:ParseWords(match_words) - endif - let s:all = substitute(s:pat, s:notslash . '\zs[,:]\+', '\\|', 'g') - let s:all = '\%(' . s:all . '\)' - " let s:all = '\%(' . substitute(s:all, '\\\ze[,:]', '', 'g') . '\)' - if exists("b:match_debug") - let b:match_pat = s:pat - endif - " Reconstruct the version with unresolved backrefs. - let s:patBR = substitute(match_words.',', - \ s:notslash.'\zs[,:]*,[,:]*', ',', 'g') - let s:patBR = substitute(s:patBR, s:notslash.'\zs:\{2,}', ':', 'g') - endif - - " Second step: set the following local variables: - " matchline = line on which the cursor started - " curcol = number of characters before match - " prefix = regexp for start of line to start of match - " suffix = regexp for end of match to end of line - " Require match to end on or after the cursor and prefer it to - " start on or before the cursor. - let matchline = getline(startline) - if a:word != '' - " word given - if a:word !~ s:all - echohl WarningMsg|echo 'Missing rule for word:"'.a:word.'"'|echohl NONE - return s:CleanUp(restore_options, a:mode, startline, startcol) - endif - let matchline = a:word - let curcol = 0 - let prefix = '^\%(' - let suffix = '\)$' - " Now the case when "word" is not given - else " Find the match that ends on or after the cursor and set curcol. - let regexp = s:Wholematch(matchline, s:all, startcol-1) - let curcol = match(matchline, regexp) - " If there is no match, give up. - if curcol == -1 - return s:CleanUp(restore_options, a:mode, startline, startcol) - endif - let endcol = matchend(matchline, regexp) - let suf = strlen(matchline) - endcol - let prefix = (curcol ? '^.*\%' . (curcol + 1) . 'c\%(' : '^\%(') - let suffix = (suf ? '\)\%' . (endcol + 1) . 'c.*$' : '\)$') - endif - if exists("b:match_debug") - let b:match_match = matchstr(matchline, regexp) - let b:match_col = curcol+1 - endif - - " Third step: Find the group and single word that match, and the original - " (backref) versions of these. Then, resolve the backrefs. - " Set the following local variable: - " group = colon-separated list of patterns, one of which matches - " = ini:mid:fin or ini:fin - " - " Now, set group and groupBR to the matching group: 'if:endif' or - " 'while:endwhile' or whatever. A bit of a kluge: s:Choose() returns - " group . "," . groupBR, and we pick it apart. - let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, s:patBR) - let i = matchend(group, s:notslash . ",") - let groupBR = strpart(group, i) - let group = strpart(group, 0, i-1) - " Now, matchline =~ prefix . substitute(group,':','\|','g') . suffix - if s:do_BR " Do the hard part: resolve those backrefs! - let group = s:InsertRefs(groupBR, prefix, group, suffix, matchline) - endif - if exists("b:match_debug") - let b:match_wholeBR = groupBR - let i = matchend(groupBR, s:notslash . ":") - let b:match_iniBR = strpart(groupBR, 0, i-1) - endif - - " Fourth step: Set the arguments for searchpair(). - let i = matchend(group, s:notslash . ":") - let j = matchend(group, '.*' . s:notslash . ":") - let ini = strpart(group, 0, i-1) - let mid = substitute(strpart(group, i,j-i-1), s:notslash.'\zs:', '\\|', 'g') - let fin = strpart(group, j) - "Un-escape the remaining , and : characters. - let ini = substitute(ini, s:notslash . '\zs\\\(:\|,\)', '\1', 'g') - let mid = substitute(mid, s:notslash . '\zs\\\(:\|,\)', '\1', 'g') - let fin = substitute(fin, s:notslash . '\zs\\\(:\|,\)', '\1', 'g') - " searchpair() requires that these patterns avoid \(\) groups. - let ini = substitute(ini, s:notslash . '\zs\\(', '\\%(', 'g') - let mid = substitute(mid, s:notslash . '\zs\\(', '\\%(', 'g') - let fin = substitute(fin, s:notslash . '\zs\\(', '\\%(', 'g') - " Set mid. This is optimized for readability, not micro-efficiency! - if a:forward && matchline =~ prefix . fin . suffix - \ || !a:forward && matchline =~ prefix . ini . suffix - let mid = "" - endif - " Set flag. This is optimized for readability, not micro-efficiency! - if a:forward && matchline =~ prefix . fin . suffix - \ || !a:forward && matchline !~ prefix . ini . suffix - let flag = "bW" - else - let flag = "W" - endif - " Set skip. - if exists("b:match_skip") - let skip = b:match_skip - elseif exists("b:match_comment") " backwards compatibility and testing! - let skip = "r:" . b:match_comment - else - let skip = 's:comment\|string' - endif - let skip = s:ParseSkip(skip) - if exists("b:match_debug") - let b:match_ini = ini - let b:match_tail = (strlen(mid) ? mid.'\|' : '') . fin - endif - - " Fifth step: actually start moving the cursor and call searchpair(). - " Later, :execute restore_cursor to get to the original screen. - let view = winsaveview() - call cursor(0, curcol + 1) - " normal! 0 - " if curcol - " execute "normal!" . curcol . "l" - " endif - if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on")) - let skip = '0' - else - execute "if " . skip . "| let skip = '0' | endif" - endif - let sp_return = searchpair(ini, mid, fin, flag, skip) - let final_position = "call cursor(" . line(".") . "," . col(".") . ")" - " Restore cursor position and original screen. - call winrestview(view) - normal! m' - if sp_return > 0 - execute final_position - endif - return s:CleanUp(restore_options, a:mode, startline, startcol, mid.'\|'.fin) -endfun - -" Restore options and do some special handling for Operator-pending mode. -" The optional argument is the tail of the matching group. -fun! s:CleanUp(options, mode, startline, startcol, ...) - if strlen(a:options) - execute "set" a:options - endif - " Open folds, if appropriate. - if a:mode != "o" - if &foldopen =~ "percent" - normal! zv - endif - " In Operator-pending mode, we want to include the whole match - " (for example, d%). - " This is only a problem if we end up moving in the forward direction. - elseif (a:startline < line(".")) || - \ (a:startline == line(".") && a:startcol < col(".")) - if a:0 - " Check whether the match is a single character. If not, move to the - " end of the match. - let matchline = getline(".") - let currcol = col(".") - let regexp = s:Wholematch(matchline, a:1, currcol-1) - let endcol = matchend(matchline, regexp) - if endcol > currcol " This is NOT off by one! - call cursor(0, endcol) - endif - endif " a:0 - endif " a:mode != "o" && etc. - return 0 -endfun - -" Example (simplified HTML patterns): if -" a:groupBR = '<\(\k\+\)>:</\1>' -" a:prefix = '^.\{3}\(' -" a:group = '<\(\k\+\)>:</\(\k\+\)>' -" a:suffix = '\).\{2}$' -" a:matchline = "123<tag>12" or "123</tag>12" -" then extract "tag" from a:matchline and return "<tag>:</tag>" . -fun! s:InsertRefs(groupBR, prefix, group, suffix, matchline) - if a:matchline !~ a:prefix . - \ substitute(a:group, s:notslash . '\zs:', '\\|', 'g') . a:suffix - return a:group - endif - let i = matchend(a:groupBR, s:notslash . ':') - let ini = strpart(a:groupBR, 0, i-1) - let tailBR = strpart(a:groupBR, i) - let word = s:Choose(a:group, a:matchline, ":", "", a:prefix, a:suffix, - \ a:groupBR) - let i = matchend(word, s:notslash . ":") - let wordBR = strpart(word, i) - let word = strpart(word, 0, i-1) - " Now, a:matchline =~ a:prefix . word . a:suffix - if wordBR != ini - let table = s:Resolve(ini, wordBR, "table") - else - " let table = "----------" - let table = "" - let d = 0 - while d < 10 - if tailBR =~ s:notslash . '\\' . d - " let table[d] = d - let table = table . d - else - let table = table . "-" - endif - let d = d + 1 - endwhile - endif - let d = 9 - while d - if table[d] != "-" - let backref = substitute(a:matchline, a:prefix.word.a:suffix, - \ '\'.table[d], "") - " Are there any other characters that should be escaped? - let backref = escape(backref, '*,:') - execute s:Ref(ini, d, "start", "len") - let ini = strpart(ini, 0, start) . backref . strpart(ini, start+len) - let tailBR = substitute(tailBR, s:notslash . '\zs\\' . d, - \ escape(backref, '\\&'), 'g') - endif - let d = d-1 - endwhile - if exists("b:match_debug") - if s:do_BR - let b:match_table = table - let b:match_word = word - else - let b:match_table = "" - let b:match_word = "" - endif - endif - return ini . ":" . tailBR -endfun - -" Input a comma-separated list of groups with backrefs, such as -" a:groups = '\(foo\):end\1,\(bar\):end\1' -" and return a comma-separated list of groups with backrefs replaced: -" return '\(foo\):end\(foo\),\(bar\):end\(bar\)' -fun! s:ParseWords(groups) - let groups = substitute(a:groups.",", s:notslash.'\zs[,:]*,[,:]*', ',', 'g') - let groups = substitute(groups, s:notslash . '\zs:\{2,}', ':', 'g') - let parsed = "" - while groups =~ '[^,:]' - let i = matchend(groups, s:notslash . ':') - let j = matchend(groups, s:notslash . ',') - let ini = strpart(groups, 0, i-1) - let tail = strpart(groups, i, j-i-1) . ":" - let groups = strpart(groups, j) - let parsed = parsed . ini - let i = matchend(tail, s:notslash . ':') - while i != -1 - " In 'if:else:endif', ini='if' and word='else' and then word='endif'. - let word = strpart(tail, 0, i-1) - let tail = strpart(tail, i) - let i = matchend(tail, s:notslash . ':') - let parsed = parsed . ":" . s:Resolve(ini, word, "word") - endwhile " Now, tail has been used up. - let parsed = parsed . "," - endwhile " groups =~ '[^,:]' - let parsed = substitute(parsed, ',$', '', '') - return parsed -endfun - -" TODO I think this can be simplified and/or made more efficient. -" TODO What should I do if a:start is out of range? -" Return a regexp that matches all of a:string, such that -" matchstr(a:string, regexp) represents the match for a:pat that starts -" as close to a:start as possible, before being preferred to after, and -" ends after a:start . -" Usage: -" let regexp = s:Wholematch(getline("."), 'foo\|bar', col(".")-1) -" let i = match(getline("."), regexp) -" let j = matchend(getline("."), regexp) -" let match = matchstr(getline("."), regexp) -fun! s:Wholematch(string, pat, start) - let group = '\%(' . a:pat . '\)' - let prefix = (a:start ? '\(^.*\%<' . (a:start + 2) . 'c\)\zs' : '^') - let len = strlen(a:string) - let suffix = (a:start+1 < len ? '\(\%>'.(a:start+1).'c.*$\)\@=' : '$') - if a:string !~ prefix . group . suffix - let prefix = '' - endif - return prefix . group . suffix -endfun - -" No extra arguments: s:Ref(string, d) will -" find the d'th occurrence of '\(' and return it, along with everything up -" to and including the matching '\)'. -" One argument: s:Ref(string, d, "start") returns the index of the start -" of the d'th '\(' and any other argument returns the length of the group. -" Two arguments: s:Ref(string, d, "foo", "bar") returns a string to be -" executed, having the effect of -" :let foo = s:Ref(string, d, "start") -" :let bar = s:Ref(string, d, "len") -fun! s:Ref(string, d, ...) - let len = strlen(a:string) - if a:d == 0 - let start = 0 - else - let cnt = a:d - let match = a:string - while cnt - let cnt = cnt - 1 - let index = matchend(match, s:notslash . '\\(') - if index == -1 - return "" - endif - let match = strpart(match, index) - endwhile - let start = len - strlen(match) - if a:0 == 1 && a:1 == "start" - return start - 2 - endif - let cnt = 1 - while cnt - let index = matchend(match, s:notslash . '\\(\|\\)') - 1 - if index == -2 - return "" - endif - " Increment if an open, decrement if a ')': - let cnt = cnt + (match[index]=="(" ? 1 : -1) " ')' - " let cnt = stridx('0(', match[index]) + cnt - let match = strpart(match, index+1) - endwhile - let start = start - 2 - let len = len - start - strlen(match) - endif - if a:0 == 1 - return len - elseif a:0 == 2 - return "let " . a:1 . "=" . start . "| let " . a:2 . "=" . len - else - return strpart(a:string, start, len) - endif -endfun - -" Count the number of disjoint copies of pattern in string. -" If the pattern is a literal string and contains no '0' or '1' characters -" then s:Count(string, pattern, '0', '1') should be faster than -" s:Count(string, pattern). -fun! s:Count(string, pattern, ...) - let pat = escape(a:pattern, '\\') - if a:0 > 1 - let foo = substitute(a:string, '[^'.a:pattern.']', "a:1", "g") - let foo = substitute(a:string, pat, a:2, "g") - let foo = substitute(foo, '[^' . a:2 . ']', "", "g") - return strlen(foo) - endif - let result = 0 - let foo = a:string - let index = matchend(foo, pat) - while index != -1 - let result = result + 1 - let foo = strpart(foo, index) - let index = matchend(foo, pat) - endwhile - return result -endfun - -" s:Resolve('\(a\)\(b\)', '\(c\)\2\1\1\2') should return table.word, where -" word = '\(c\)\(b\)\(a\)\3\2' and table = '-32-------'. That is, the first -" '\1' in target is replaced by '\(a\)' in word, table[1] = 3, and this -" indicates that all other instances of '\1' in target are to be replaced -" by '\3'. The hard part is dealing with nesting... -" Note that ":" is an illegal character for source and target, -" unless it is preceded by "\". -fun! s:Resolve(source, target, output) - let word = a:target - let i = matchend(word, s:notslash . '\\\d') - 1 - let table = "----------" - while i != -2 " There are back references to be replaced. - let d = word[i] - let backref = s:Ref(a:source, d) - " The idea is to replace '\d' with backref. Before we do this, - " replace any \(\) groups in backref with :1, :2, ... if they - " correspond to the first, second, ... group already inserted - " into backref. Later, replace :1 with \1 and so on. The group - " number w+b within backref corresponds to the group number - " s within a:source. - " w = number of '\(' in word before the current one - let w = s:Count( - \ substitute(strpart(word, 0, i-1), '\\\\', '', 'g'), '\(', '1') - let b = 1 " number of the current '\(' in backref - let s = d " number of the current '\(' in a:source - while b <= s:Count(substitute(backref, '\\\\', '', 'g'), '\(', '1') - \ && s < 10 - if table[s] == "-" - if w + b < 10 - " let table[s] = w + b - let table = strpart(table, 0, s) . (w+b) . strpart(table, s+1) - endif - let b = b + 1 - let s = s + 1 - else - execute s:Ref(backref, b, "start", "len") - let ref = strpart(backref, start, len) - let backref = strpart(backref, 0, start) . ":". table[s] - \ . strpart(backref, start+len) - let s = s + s:Count(substitute(ref, '\\\\', '', 'g'), '\(', '1') - endif - endwhile - let word = strpart(word, 0, i-1) . backref . strpart(word, i+1) - let i = matchend(word, s:notslash . '\\\d') - 1 - endwhile - let word = substitute(word, s:notslash . '\zs:', '\\', 'g') - if a:output == "table" - return table - elseif a:output == "word" - return word - else - return table . word - endif -endfun - -" Assume a:comma = ",". Then the format for a:patterns and a:1 is -" a:patterns = "<pat1>,<pat2>,..." -" a:1 = "<alt1>,<alt2>,..." -" If <patn> is the first pattern that matches a:string then return <patn> -" if no optional arguments are given; return <patn>,<altn> if a:1 is given. -fun! s:Choose(patterns, string, comma, branch, prefix, suffix, ...) - let tail = (a:patterns =~ a:comma."$" ? a:patterns : a:patterns . a:comma) - let i = matchend(tail, s:notslash . a:comma) - if a:0 - let alttail = (a:1 =~ a:comma."$" ? a:1 : a:1 . a:comma) - let j = matchend(alttail, s:notslash . a:comma) - endif - let current = strpart(tail, 0, i-1) - if a:branch == "" - let currpat = current - else - let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g') - endif - while a:string !~ a:prefix . currpat . a:suffix - let tail = strpart(tail, i) - let i = matchend(tail, s:notslash . a:comma) - if i == -1 - return -1 - endif - let current = strpart(tail, 0, i-1) - if a:branch == "" - let currpat = current - else - let currpat = substitute(current, s:notslash . a:branch, '\\|', 'g') - endif - if a:0 - let alttail = strpart(alttail, j) - let j = matchend(alttail, s:notslash . a:comma) - endif - endwhile - if a:0 - let current = current . a:comma . strpart(alttail, 0, j-1) - endif - return current -endfun - -" Call this function to turn on debugging information. Every time the main -" script is run, buffer variables will be saved. These can be used directly -" or viewed using the menu items below. -if !exists(":MatchDebug") - command! -nargs=0 MatchDebug call s:Match_debug() -endif - -fun! s:Match_debug() - let b:match_debug = 1 " Save debugging information. - " pat = all of b:match_words with backrefs parsed - amenu &Matchit.&pat :echo b:match_pat<CR> - " match = bit of text that is recognized as a match - amenu &Matchit.&match :echo b:match_match<CR> - " curcol = cursor column of the start of the matching text - amenu &Matchit.&curcol :echo b:match_col<CR> - " wholeBR = matching group, original version - amenu &Matchit.wh&oleBR :echo b:match_wholeBR<CR> - " iniBR = 'if' piece, original version - amenu &Matchit.ini&BR :echo b:match_iniBR<CR> - " ini = 'if' piece, with all backrefs resolved from match - amenu &Matchit.&ini :echo b:match_ini<CR> - " tail = 'else\|endif' piece, with all backrefs resolved from match - amenu &Matchit.&tail :echo b:match_tail<CR> - " fin = 'endif' piece, with all backrefs resolved from match - amenu &Matchit.&word :echo b:match_word<CR> - " '\'.d in ini refers to the same thing as '\'.table[d] in word. - amenu &Matchit.t&able :echo '0:' . b:match_table . ':9'<CR> -endfun - -" Jump to the nearest unmatched "(" or "if" or "<tag>" if a:spflag == "bW" -" or the nearest unmatched "</tag>" or "endif" or ")" if a:spflag == "W". -" Return a "mark" for the original position, so that -" let m = MultiMatch("bW", "n") ... execute m -" will return to the original position. If there is a problem, do not -" move the cursor and return "", unless a count is given, in which case -" go up or down as many levels as possible and again return "". -" TODO This relies on the same patterns as % matching. It might be a good -" idea to give it its own matching patterns. -fun! s:MultiMatch(spflag, mode) - if !exists("b:match_words") || b:match_words == "" - return {} - end - let restore_options = "" - if exists("b:match_ignorecase") && b:match_ignorecase != &ic - let restore_options .= (&ic ? " " : " no") . "ignorecase" - let &ignorecase = b:match_ignorecase - endif - let startline = line(".") - let startcol = col(".") - - " First step: if not already done, set the script variables - " s:do_BR flag for whether there are backrefs - " s:pat parsed version of b:match_words - " s:all regexp based on s:pat and the default groups - " This part is copied and slightly modified from s:Match_wrapper(). - let default = escape(&mps, '[$^.*~\\/?]') . (strlen(&mps) ? "," : "") . - \ '\/\*:\*\/,#\s*if\%(def\)\=:#\s*else\>:#\s*elif\>:#\s*endif\>' - " Allow b:match_words = "GetVimMatchWords()" . - if b:match_words =~ ":" - let match_words = b:match_words - else - execute "let match_words =" b:match_words - endif - if (match_words != s:last_words) || (&mps != s:last_mps) || - \ exists("b:match_debug") - let s:last_words = match_words - let s:last_mps = &mps - let match_words = match_words . (strlen(match_words) ? "," : "") . default - if match_words !~ s:notslash . '\\\d' - let s:do_BR = 0 - let s:pat = match_words - else - let s:do_BR = 1 - let s:pat = s:ParseWords(match_words) - endif - let s:all = '\%(' . substitute(s:pat . (strlen(s:pat) ? "," : "") . default, - \ '[,:]\+', '\\|', 'g') . '\)' - if exists("b:match_debug") - let b:match_pat = s:pat - endif - endif - - " Second step: figure out the patterns for searchpair() - " and save the screen, cursor position, and 'ignorecase'. - " - TODO: A lot of this is copied from s:Match_wrapper(). - " - maybe even more functionality should be split off - " - into separate functions! - let cdefault = (s:pat =~ '[^,]$' ? "," : "") . default - let open = substitute(s:pat . cdefault, - \ s:notslash . '\zs:.\{-}' . s:notslash . ',', '\\),\\(', 'g') - let open = '\(' . substitute(open, s:notslash . '\zs:.*$', '\\)', '') - let close = substitute(s:pat . cdefault, - \ s:notslash . '\zs,.\{-}' . s:notslash . ':', '\\),\\(', 'g') - let close = substitute(close, '^.\{-}' . s:notslash . ':', '\\(', '') . '\)' - if exists("b:match_skip") - let skip = b:match_skip - elseif exists("b:match_comment") " backwards compatibility and testing! - let skip = "r:" . b:match_comment - else - let skip = 's:comment\|string' - endif - let skip = s:ParseSkip(skip) - let view = winsaveview() - - " Third step: call searchpair(). - " Replace '\('--but not '\\('--with '\%(' and ',' with '\|'. - let openpat = substitute(open, '\(\\\@<!\(\\\\\)*\)\@<=\\(', '\\%(', 'g') - let openpat = substitute(openpat, ',', '\\|', 'g') - let closepat = substitute(close, '\(\\\@<!\(\\\\\)*\)\@<=\\(', '\\%(', 'g') - let closepat = substitute(closepat, ',', '\\|', 'g') - - if skip =~ 'synID' && !(has("syntax") && exists("g:syntax_on")) - let skip = '0' - else - try - execute "if " . skip . "| let skip = '0' | endif" - catch /^Vim\%((\a\+)\)\=:E363/ - " We won't find anything, so skip searching, should keep Vim responsive. - return {} - endtry - endif - mark ' - let level = v:count1 - while level - if searchpair(openpat, '', closepat, a:spflag, skip) < 1 - call s:CleanUp(restore_options, a:mode, startline, startcol) - return {} - endif - let level = level - 1 - endwhile - - " Restore options and return view dict to restore the original position. - call s:CleanUp(restore_options, a:mode, startline, startcol) - return view -endfun - -" Search backwards for "if" or "while" or "<tag>" or ... -" and return "endif" or "endwhile" or "</tag>" or ... . -" For now, this uses b:match_words and the same script variables -" as s:Match_wrapper() . Later, it may get its own patterns, -" either from a buffer variable or passed as arguments. -" fun! s:Autocomplete() -" echo "autocomplete not yet implemented :-(" -" if !exists("b:match_words") || b:match_words == "" -" return "" -" end -" let startpos = s:MultiMatch("bW") -" -" if startpos == "" -" return "" -" endif -" " - TODO: figure out whether 'if' or '<tag>' matched, and construct -" " - the appropriate closing. -" let matchline = getline(".") -" let curcol = col(".") - 1 -" " - TODO: Change the s:all argument if there is a new set of match pats. -" let regexp = s:Wholematch(matchline, s:all, curcol) -" let suf = strlen(matchline) - matchend(matchline, regexp) -" let prefix = (curcol ? '^.\{' . curcol . '}\%(' : '^\%(') -" let suffix = (suf ? '\).\{' . suf . '}$' : '\)$') -" " Reconstruct the version with unresolved backrefs. -" let patBR = substitute(b:match_words.',', '[,:]*,[,:]*', ',', 'g') -" let patBR = substitute(patBR, ':\{2,}', ':', "g") -" " Now, set group and groupBR to the matching group: 'if:endif' or -" " 'while:endwhile' or whatever. -" let group = s:Choose(s:pat, matchline, ",", ":", prefix, suffix, patBR) -" let i = matchend(group, s:notslash . ",") -" let groupBR = strpart(group, i) -" let group = strpart(group, 0, i-1) -" " Now, matchline =~ prefix . substitute(group,':','\|','g') . suffix -" if s:do_BR -" let group = s:InsertRefs(groupBR, prefix, group, suffix, matchline) -" endif -" " let g:group = group -" -" " - TODO: Construct the closing from group. -" let fake = "end" . expand("<cword>") -" execute startpos -" return fake -" endfun - -" Close all open structures. "Get the heck out of here!" -" fun! s:Gthhoh() -" let close = s:Autocomplete() -" while strlen(close) -" put=close -" let close = s:Autocomplete() -" endwhile -" endfun - -" Parse special strings as typical skip arguments for searchpair(): -" s:foo becomes (current syntax item) =~ foo -" S:foo becomes (current syntax item) !~ foo -" r:foo becomes (line before cursor) =~ foo -" R:foo becomes (line before cursor) !~ foo -fun! s:ParseSkip(str) - let skip = a:str - if skip[1] == ":" - if skip[0] == "s" - let skip = "synIDattr(synID(line('.'),col('.'),1),'name') =~? '" . - \ strpart(skip,2) . "'" - elseif skip[0] == "S" - let skip = "synIDattr(synID(line('.'),col('.'),1),'name') !~? '" . - \ strpart(skip,2) . "'" - elseif skip[0] == "r" - let skip = "strpart(getline('.'),0,col('.'))=~'" . strpart(skip,2). "'" - elseif skip[0] == "R" - let skip = "strpart(getline('.'),0,col('.'))!~'" . strpart(skip,2). "'" - endif - endif - return skip -endfun - -let &cpo = s:save_cpo -unlet s:save_cpo - -" vim:sts=2:sw=2: 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/plugin/tohtml.vim b/runtime/plugin/tohtml.vim index b438dea811..0cd931eada 100644 --- a/runtime/plugin/tohtml.vim +++ b/runtime/plugin/tohtml.vim @@ -1,82 +1,33 @@ " Vim plugin for converting a syntax highlighted file to HTML. " Maintainer: Ben Fritz <fritzophrenic@gmail.com> -" Last Change: 2015 Sep 08 +" Last Change: 2018 Nov 11 " " The core of the code is in $VIMRUNTIME/autoload/tohtml.vim and " $VIMRUNTIME/syntax/2html.vim " -" TODO: {{{ -" * Options for generating the CSS in external style sheets. New :TOcss -" command to convert the current color scheme into a (mostly) generic CSS -" stylesheet which can be re-used. Alternate stylesheet support? Good start -" by Erik Falor -" ( https://groups.google.com/d/topic/vim_use/7XTmC4D22dU/discussion ). -" * Add optional argument to :TOhtml command to specify mode (gui, cterm, -" term) to use for the styling. Suggestion by "nacitar". -" * Add way to override or specify which RGB colors map to the color numbers -" in cterm. Get better defaults than just guessing? Suggestion by "nacitar". -" * Disable filetype detection until after all processing is done. -" * Add option for not generating the hyperlink on stuff that looks like a -" URL? Or just color the link to fit with the colorscheme (and only special -" when hovering)? -" * Bug: Opera does not allow printing more than one page if uncopyable -" regions is turned on. Possible solution: Add normal text line numbers with -" display:none, set to display:inline for print style sheets, and hide -" <input> elements for print, to allow Opera printing multiple pages (and -" other uncopyable areas?). May need to make the new text invisible to IE -" with conditional comments to prevent copying it, IE for some reason likes -" to copy hidden text. Other browsers too? -" * Bug: still a 1px gap throughout the fold column when html_prevent_copy is -" "fn" in some browsers. Specifically, in Chromium on Ubuntu (but not Chrome -" on Windows). Perhaps it is font related? -" * Bug: still some gaps in the fold column when html_prevent_copy contains -" 'd' and showing the whole diff (observed in multiple browsers). Only gaps -" on diff lines though. -" * Undercurl support via CSS3, with fallback to dotted or something: -" https://groups.google.com/d/topic/vim_use/BzXA6He1pHg/discussion -" * Redo updates for modified default foldtext (v11) when/if the patch is -" accepted to modify it. -" * Test case +diff_one_file-dynamic_folds+expand_tabs-hover_unfold -" +ignore_conceal-ignore_folding+no_foldcolumn+no_pre+no_progress -" +number_lines-pre_wrap-use_css+use_xhtml+whole_filler.xhtml -" does not show the whole diff filler as it is supposed to? -" * Bug: when 'isprint' is wrong for the current encoding, will generate -" invalid content. Can/should anything be done about this? Maybe a separate -" plugin to correct 'isprint' based on encoding? -" * Check to see if the windows-125\d encodings actually work in Unix without -" the 8bit- prefix. Add prefix to autoload dictionaries for Unix if not. -" * Font auto-detection similar to -" http://www.vim.org/scripts/script.php?script_id=2384 but for a variety of -" platforms. -" * Error thrown when sourcing 2html.vim directly when plugins are not loaded. -" * Pull in code from http://www.vim.org/scripts/script.php?script_id=3113 : -" - listchars support -" - full-line background highlight -" - other? -" * Make it so deleted lines in a diff don't create side-scrolling (get it -" free with full-line background highlight above). -" * Restore open/closed folds and cursor position after processing each file -" with option not to restore for speed increase. -" * Add extra meta info (generation time, etc.)? -" * Tidy up so we can use strict doctype in even more situations -" * Implementation detail: add threshold for writing the lines to the html -" buffer before we're done (5000 or so lines should do it) -" * TODO comments for code cleanup scattered throughout -"}}} - if exists('g:loaded_2html_plugin') finish endif -let g:loaded_2html_plugin = 'vim7.4_v2' +let g:loaded_2html_plugin = 'vim8.1_v1' " " Changelog: {{{ -" 7.4_v2 (this version): Fix error raised when converting a diff containing +" 8.1_v1 (this version): Fix Bitbucket issue #6: Don't generate empty script +" tag. +" Fix Bitbucket issue #5: javascript should +" declare variables with "var". +" Fix Bitbucket issue #13: errors thrown sourcing +" 2html.vim directly when plugins not loaded. +" Fix Bitbucket issue #16: support 'vartabstop'. +" +" 7.4 updates: {{{ +" 7.4_v2 (Vim 7.4.0899): Fix error raised when converting a diff containing " an empty buffer. Jan Stocker: allow g:html_font to " take a list so it is easier to specfiy fallback " fonts in the generated CSS. " 7.4_v1 (Vim 7.4.0000): Fix modeline mangling for new "Vim:" format, and " also for version-specific modelines like "vim>703:". +"}}} " " 7.3 updates: {{{ " 7.3_v14 (Vim 7.3.1246): Allow suppressing line number anchors using @@ -170,9 +121,69 @@ let g:loaded_2html_plugin = 'vim7.4_v2' "}}} "}}} +" TODO: {{{ +" * Check the issue tracker: +" https://bitbucket.org/fritzophrenic/vim-tohtml/issues?status=new&status=open +" * Options for generating the CSS in external style sheets. New :TOcss +" command to convert the current color scheme into a (mostly) generic CSS +" stylesheet which can be re-used. Alternate stylesheet support? Good start +" by Erik Falor +" ( https://groups.google.com/d/topic/vim_use/7XTmC4D22dU/discussion ). +" * Add optional argument to :TOhtml command to specify mode (gui, cterm, +" term) to use for the styling. Suggestion by "nacitar". +" * Add way to override or specify which RGB colors map to the color numbers +" in cterm. Get better defaults than just guessing? Suggestion by "nacitar". +" * Disable filetype detection until after all processing is done. +" * Add option for not generating the hyperlink on stuff that looks like a +" URL? Or just color the link to fit with the colorscheme (and only special +" when hovering)? +" * Bug: Opera does not allow printing more than one page if uncopyable +" regions is turned on. Possible solution: Add normal text line numbers with +" display:none, set to display:inline for print style sheets, and hide +" <input> elements for print, to allow Opera printing multiple pages (and +" other uncopyable areas?). May need to make the new text invisible to IE +" with conditional comments to prevent copying it, IE for some reason likes +" to copy hidden text. Other browsers too? +" * Bug: still a 1px gap throughout the fold column when html_prevent_copy is +" "fn" in some browsers. Specifically, in Chromium on Ubuntu (but not Chrome +" on Windows). Perhaps it is font related? +" * Bug: still some gaps in the fold column when html_prevent_copy contains +" 'd' and showing the whole diff (observed in multiple browsers). Only gaps +" on diff lines though. +" * Undercurl support via CSS3, with fallback to dotted or something: +" https://groups.google.com/d/topic/vim_use/BzXA6He1pHg/discussion +" * Redo updates for modified default foldtext (v11) when/if the patch is +" accepted to modify it. +" * Test case +diff_one_file-dynamic_folds+expand_tabs-hover_unfold +" +ignore_conceal-ignore_folding+no_foldcolumn+no_pre+no_progress +" +number_lines-pre_wrap-use_css+use_xhtml+whole_filler.xhtml +" does not show the whole diff filler as it is supposed to? +" * Bug: when 'isprint' is wrong for the current encoding, will generate +" invalid content. Can/should anything be done about this? Maybe a separate +" plugin to correct 'isprint' based on encoding? +" * Check to see if the windows-125\d encodings actually work in Unix without +" the 8bit- prefix. Add prefix to autoload dictionaries for Unix if not. +" * Font auto-detection similar to +" http://www.vim.org/scripts/script.php?script_id=2384 but for a variety of +" platforms. +" * Pull in code from http://www.vim.org/scripts/script.php?script_id=3113 : +" - listchars support +" - full-line background highlight +" - other? +" * Make it so deleted lines in a diff don't create side-scrolling (get it +" free with full-line background highlight above). +" * Restore open/closed folds and cursor position after processing each file +" with option not to restore for speed increase. +" * Add extra meta info (generation time, etc.)? +" * Tidy up so we can use strict doctype in even more situations +" * Implementation detail: add threshold for writing the lines to the html +" buffer before we're done (5000 or so lines should do it) +" * TODO comments for code cleanup scattered throughout +"}}} + " Define the :TOhtml command when: " - 'compatible' is not set -" - this plugin was not already loaded +" - this plugin or user override was not already loaded " - user commands are available. {{{ if !&cp && !exists(":TOhtml") && has("user_commands") command -range=% -bar TOhtml :call tohtml#Convert2HTML(<line1>, <line2>) diff --git a/runtime/scripts.vim b/runtime/scripts.vim index ab66c0c0a1..a690431014 100644 --- a/runtime/scripts.vim +++ b/runtime/scripts.vim @@ -1,7 +1,7 @@ " Vim support file to detect file types in scripts " " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last change: 2018 Feb 03 +" Last change: 2019 Jun 25 " This file is called by an autocommand for every file that has just been " loaded into a buffer. It checks if the type of file can be recognized by @@ -195,7 +195,7 @@ else if s:line1 =~# '^:$' call dist#ft#SetFileTypeSH(s:line1) " defined in filetype.vim - " Z shell scripts + " Z shell scripts elseif s:line1 =~# '^#compdef\>' || s:line1 =~# '^#autoload\>' || \ "\n".s:line1."\n".s:line2."\n".s:line3."\n".s:line4."\n".s:line5 =~# '\n\s*emulate\s\+\%(-[LR]\s\+\)\=[ckz]\=sh\>' set ft=zsh @@ -204,15 +204,20 @@ else elseif s:line1 =~# '^From \([a-zA-Z][a-zA-Z_0-9\.=-]*\(@[^ ]*\)\=\|-\) .* \(19\|20\)\d\d$' set ft=mail - " Mason + " Mason elseif s:line1 =~# '^<[%&].*>' set ft=mason - " Vim scripts (must have '" vim' as the first line to trigger this) + " Vim scripts (must have '" vim' as the first line to trigger this) elseif s:line1 =~# '^" *[vV]im$' set ft=vim - " MOO + " libcxx and libstdc++ standard library headers like "iostream" do not have + " an extension, recognize the Emacs file mode. + elseif s:line1 =~? '-\*-.*C++.*-\*-' + set ft=cpp + + " MOO elseif s:line1 =~# '^\*\* LambdaMOO Database, Format Version \%([1-3]\>\)\@!\d\+ \*\*$' set ft=moo diff --git a/runtime/synmenu.vim b/runtime/synmenu.vim index 6814c60e88..e8c9933abf 100644 --- a/runtime/synmenu.vim +++ b/runtime/synmenu.vim @@ -56,46 +56,50 @@ an 50.10.270 &Syntax.AB.Applix\ ELF :cal SetSyn("elf")<CR> an 50.10.280 &Syntax.AB.APT\ config :cal SetSyn("aptconf")<CR> an 50.10.290 &Syntax.AB.Arc\ Macro\ Language :cal SetSyn("aml")<CR> an 50.10.300 &Syntax.AB.Arch\ inventory :cal SetSyn("arch")<CR> -an 50.10.310 &Syntax.AB.ART :cal SetSyn("art")<CR> -an 50.10.320 &Syntax.AB.Ascii\ Doc :cal SetSyn("asciidoc")<CR> -an 50.10.330 &Syntax.AB.ASP\ with\ VBScript :cal SetSyn("aspvbs")<CR> -an 50.10.340 &Syntax.AB.ASP\ with\ Perl :cal SetSyn("aspperl")<CR> -an 50.10.350 &Syntax.AB.Assembly.680x0 :cal SetSyn("asm68k")<CR> -an 50.10.360 &Syntax.AB.Assembly.Flat :cal SetSyn("fasm")<CR> -an 50.10.370 &Syntax.AB.Assembly.GNU :cal SetSyn("asm")<CR> -an 50.10.380 &Syntax.AB.Assembly.GNU\ H-8300 :cal SetSyn("asmh8300")<CR> -an 50.10.390 &Syntax.AB.Assembly.Intel\ IA-64 :cal SetSyn("ia64")<CR> -an 50.10.400 &Syntax.AB.Assembly.Microsoft :cal SetSyn("masm")<CR> -an 50.10.410 &Syntax.AB.Assembly.Netwide :cal SetSyn("nasm")<CR> -an 50.10.420 &Syntax.AB.Assembly.PIC :cal SetSyn("pic")<CR> -an 50.10.430 &Syntax.AB.Assembly.Turbo :cal SetSyn("tasm")<CR> -an 50.10.440 &Syntax.AB.Assembly.VAX\ Macro\ Assembly :cal SetSyn("vmasm")<CR> -an 50.10.450 &Syntax.AB.Assembly.Z-80 :cal SetSyn("z8a")<CR> -an 50.10.460 &Syntax.AB.Assembly.xa\ 6502\ cross\ assember :cal SetSyn("a65")<CR> -an 50.10.470 &Syntax.AB.ASN\.1 :cal SetSyn("asn")<CR> -an 50.10.480 &Syntax.AB.Asterisk\ config :cal SetSyn("asterisk")<CR> -an 50.10.490 &Syntax.AB.Asterisk\ voicemail\ config :cal SetSyn("asteriskvm")<CR> -an 50.10.500 &Syntax.AB.Atlas :cal SetSyn("atlas")<CR> -an 50.10.510 &Syntax.AB.AutoHotKey :cal SetSyn("autohotkey")<CR> -an 50.10.520 &Syntax.AB.AutoIt :cal SetSyn("autoit")<CR> -an 50.10.530 &Syntax.AB.Automake :cal SetSyn("automake")<CR> -an 50.10.540 &Syntax.AB.Avenue :cal SetSyn("ave")<CR> -an 50.10.550 &Syntax.AB.Awk :cal SetSyn("awk")<CR> -an 50.10.560 &Syntax.AB.AYacc :cal SetSyn("ayacc")<CR> -an 50.10.580 &Syntax.AB.B :cal SetSyn("b")<CR> -an 50.10.590 &Syntax.AB.Baan :cal SetSyn("baan")<CR> -an 50.10.600 &Syntax.AB.Basic.FreeBasic :cal SetSyn("freebasic")<CR> -an 50.10.610 &Syntax.AB.Basic.IBasic :cal SetSyn("ibasic")<CR> -an 50.10.620 &Syntax.AB.Basic.QBasic :cal SetSyn("basic")<CR> -an 50.10.630 &Syntax.AB.Basic.Visual\ Basic :cal SetSyn("vb")<CR> -an 50.10.640 &Syntax.AB.Bazaar\ commit\ file :cal SetSyn("bzr")<CR> -an 50.10.650 &Syntax.AB.BC\ calculator :cal SetSyn("bc")<CR> -an 50.10.660 &Syntax.AB.BDF\ font :cal SetSyn("bdf")<CR> -an 50.10.670 &Syntax.AB.BibTeX.Bibliography\ database :cal SetSyn("bib")<CR> -an 50.10.680 &Syntax.AB.BibTeX.Bibliography\ Style :cal SetSyn("bst")<CR> -an 50.10.690 &Syntax.AB.BIND.BIND\ config :cal SetSyn("named")<CR> -an 50.10.700 &Syntax.AB.BIND.BIND\ zone :cal SetSyn("bindzone")<CR> -an 50.10.710 &Syntax.AB.Blank :cal SetSyn("blank")<CR> +an 50.10.310 &Syntax.AB.Arduino :cal SetSyn("arduino")<CR> +an 50.10.320 &Syntax.AB.ART :cal SetSyn("art")<CR> +an 50.10.330 &Syntax.AB.Ascii\ Doc :cal SetSyn("asciidoc")<CR> +an 50.10.340 &Syntax.AB.ASP\ with\ VBScript :cal SetSyn("aspvbs")<CR> +an 50.10.350 &Syntax.AB.ASP\ with\ Perl :cal SetSyn("aspperl")<CR> +an 50.10.360 &Syntax.AB.Assembly.680x0 :cal SetSyn("asm68k")<CR> +an 50.10.370 &Syntax.AB.Assembly.AVR :cal SetSyn("avra")<CR> +an 50.10.380 &Syntax.AB.Assembly.Flat :cal SetSyn("fasm")<CR> +an 50.10.390 &Syntax.AB.Assembly.GNU :cal SetSyn("asm")<CR> +an 50.10.400 &Syntax.AB.Assembly.GNU\ H-8300 :cal SetSyn("asmh8300")<CR> +an 50.10.410 &Syntax.AB.Assembly.Intel\ IA-64 :cal SetSyn("ia64")<CR> +an 50.10.420 &Syntax.AB.Assembly.Microsoft :cal SetSyn("masm")<CR> +an 50.10.430 &Syntax.AB.Assembly.Netwide :cal SetSyn("nasm")<CR> +an 50.10.440 &Syntax.AB.Assembly.PIC :cal SetSyn("pic")<CR> +an 50.10.450 &Syntax.AB.Assembly.Turbo :cal SetSyn("tasm")<CR> +an 50.10.460 &Syntax.AB.Assembly.VAX\ Macro\ Assembly :cal SetSyn("vmasm")<CR> +an 50.10.470 &Syntax.AB.Assembly.Z-80 :cal SetSyn("z8a")<CR> +an 50.10.480 &Syntax.AB.Assembly.xa\ 6502\ cross\ assember :cal SetSyn("a65")<CR> +an 50.10.490 &Syntax.AB.ASN\.1 :cal SetSyn("asn")<CR> +an 50.10.500 &Syntax.AB.Asterisk\ config :cal SetSyn("asterisk")<CR> +an 50.10.510 &Syntax.AB.Asterisk\ voicemail\ config :cal SetSyn("asteriskvm")<CR> +an 50.10.520 &Syntax.AB.Atlas :cal SetSyn("atlas")<CR> +an 50.10.530 &Syntax.AB.Autodoc :cal SetSyn("autodoc")<CR> +an 50.10.540 &Syntax.AB.AutoHotKey :cal SetSyn("autohotkey")<CR> +an 50.10.550 &Syntax.AB.AutoIt :cal SetSyn("autoit")<CR> +an 50.10.560 &Syntax.AB.Automake :cal SetSyn("automake")<CR> +an 50.10.570 &Syntax.AB.Avenue :cal SetSyn("ave")<CR> +an 50.10.580 &Syntax.AB.Awk :cal SetSyn("awk")<CR> +an 50.10.590 &Syntax.AB.AYacc :cal SetSyn("ayacc")<CR> +an 50.10.610 &Syntax.AB.B :cal SetSyn("b")<CR> +an 50.10.620 &Syntax.AB.Baan :cal SetSyn("baan")<CR> +an 50.10.630 &Syntax.AB.Basic.FreeBasic :cal SetSyn("freebasic")<CR> +an 50.10.640 &Syntax.AB.Basic.IBasic :cal SetSyn("ibasic")<CR> +an 50.10.650 &Syntax.AB.Basic.QBasic :cal SetSyn("basic")<CR> +an 50.10.660 &Syntax.AB.Basic.Visual\ Basic :cal SetSyn("vb")<CR> +an 50.10.670 &Syntax.AB.Bazaar\ commit\ file :cal SetSyn("bzr")<CR> +an 50.10.680 &Syntax.AB.Bazel :cal SetSyn("bzl")<CR> +an 50.10.690 &Syntax.AB.BC\ calculator :cal SetSyn("bc")<CR> +an 50.10.700 &Syntax.AB.BDF\ font :cal SetSyn("bdf")<CR> +an 50.10.710 &Syntax.AB.BibTeX.Bibliography\ database :cal SetSyn("bib")<CR> +an 50.10.720 &Syntax.AB.BibTeX.Bibliography\ Style :cal SetSyn("bst")<CR> +an 50.10.730 &Syntax.AB.BIND.BIND\ config :cal SetSyn("named")<CR> +an 50.10.740 &Syntax.AB.BIND.BIND\ zone :cal SetSyn("bindzone")<CR> +an 50.10.750 &Syntax.AB.Blank :cal SetSyn("blank")<CR> an 50.20.100 &Syntax.C.C :cal SetSyn("c")<CR> an 50.20.110 &Syntax.C.C++ :cal SetSyn("cpp")<CR> an 50.20.120 &Syntax.C.C# :cal SetSyn("cs")<CR> @@ -117,75 +121,81 @@ an 50.20.270 &Syntax.C.Clever :cal SetSyn("cl")<CR> an 50.20.280 &Syntax.C.Clipper :cal SetSyn("clipper")<CR> an 50.20.290 &Syntax.C.Clojure :cal SetSyn("clojure")<CR> an 50.20.300 &Syntax.C.Cmake :cal SetSyn("cmake")<CR> -an 50.20.310 &Syntax.C.Cmusrc :cal SetSyn("cmusrc")<CR> -an 50.20.320 &Syntax.C.Cobol :cal SetSyn("cobol")<CR> -an 50.20.330 &Syntax.C.Coco/R :cal SetSyn("coco")<CR> -an 50.20.340 &Syntax.C.Cold\ Fusion :cal SetSyn("cf")<CR> -an 50.20.350 &Syntax.C.Conary\ Recipe :cal SetSyn("conaryrecipe")<CR> -an 50.20.360 &Syntax.C.Config.Cfg\ Config\ file :cal SetSyn("cfg")<CR> -an 50.20.370 &Syntax.C.Config.Configure\.in :cal SetSyn("config")<CR> -an 50.20.380 &Syntax.C.Config.Generic\ Config\ file :cal SetSyn("conf")<CR> -an 50.20.390 &Syntax.C.CRM114 :cal SetSyn("crm")<CR> -an 50.20.400 &Syntax.C.Crontab :cal SetSyn("crontab")<CR> -an 50.20.410 &Syntax.C.CSDL :cal SetSyn("csdl")<CR> -an 50.20.420 &Syntax.C.CSP :cal SetSyn("csp")<CR> -an 50.20.430 &Syntax.C.Ctrl-H :cal SetSyn("ctrlh")<CR> -an 50.20.440 &Syntax.C.Cucumber :cal SetSyn("cucumber")<CR> -an 50.20.450 &Syntax.C.CUDA :cal SetSyn("cuda")<CR> -an 50.20.460 &Syntax.C.CUPL.CUPL :cal SetSyn("cupl")<CR> -an 50.20.470 &Syntax.C.CUPL.Simulation :cal SetSyn("cuplsim")<CR> -an 50.20.480 &Syntax.C.CVS.commit\ file :cal SetSyn("cvs")<CR> -an 50.20.490 &Syntax.C.CVS.cvsrc :cal SetSyn("cvsrc")<CR> -an 50.20.500 &Syntax.C.Cyn++ :cal SetSyn("cynpp")<CR> -an 50.20.510 &Syntax.C.Cynlib :cal SetSyn("cynlib")<CR> +an 50.20.310 &Syntax.C.Cmod :cal SetSyn("cmod")<CR> +an 50.20.320 &Syntax.C.Cmusrc :cal SetSyn("cmusrc")<CR> +an 50.20.330 &Syntax.C.Cobol :cal SetSyn("cobol")<CR> +an 50.20.340 &Syntax.C.Coco/R :cal SetSyn("coco")<CR> +an 50.20.350 &Syntax.C.Cold\ Fusion :cal SetSyn("cf")<CR> +an 50.20.360 &Syntax.C.Conary\ Recipe :cal SetSyn("conaryrecipe")<CR> +an 50.20.370 &Syntax.C.Config.Cfg\ Config\ file :cal SetSyn("cfg")<CR> +an 50.20.380 &Syntax.C.Config.Configure\.in :cal SetSyn("config")<CR> +an 50.20.390 &Syntax.C.Config.Generic\ Config\ file :cal SetSyn("conf")<CR> +an 50.20.400 &Syntax.C.CRM114 :cal SetSyn("crm")<CR> +an 50.20.410 &Syntax.C.Crontab :cal SetSyn("crontab")<CR> +an 50.20.420 &Syntax.C.CSDL :cal SetSyn("csdl")<CR> +an 50.20.430 &Syntax.C.CSP :cal SetSyn("csp")<CR> +an 50.20.440 &Syntax.C.Ctrl-H :cal SetSyn("ctrlh")<CR> +an 50.20.450 &Syntax.C.Cucumber :cal SetSyn("cucumber")<CR> +an 50.20.460 &Syntax.C.CUDA :cal SetSyn("cuda")<CR> +an 50.20.470 &Syntax.C.CUPL.CUPL :cal SetSyn("cupl")<CR> +an 50.20.480 &Syntax.C.CUPL.Simulation :cal SetSyn("cuplsim")<CR> +an 50.20.490 &Syntax.C.CVS.commit\ file :cal SetSyn("cvs")<CR> +an 50.20.500 &Syntax.C.CVS.cvsrc :cal SetSyn("cvsrc")<CR> +an 50.20.510 &Syntax.C.Cyn++ :cal SetSyn("cynpp")<CR> +an 50.20.520 &Syntax.C.Cynlib :cal SetSyn("cynlib")<CR> an 50.30.100 &Syntax.DE.D :cal SetSyn("d")<CR> an 50.30.110 &Syntax.DE.Datascript :cal SetSyn("datascript")<CR> an 50.30.120 &Syntax.DE.Debian.Debian\ ChangeLog :cal SetSyn("debchangelog")<CR> an 50.30.130 &Syntax.DE.Debian.Debian\ Control :cal SetSyn("debcontrol")<CR> -an 50.30.140 &Syntax.DE.Debian.Debian\ Sources\.list :cal SetSyn("debsources")<CR> -an 50.30.150 &Syntax.DE.Denyhosts :cal SetSyn("denyhosts")<CR> -an 50.30.160 &Syntax.DE.Desktop :cal SetSyn("desktop")<CR> -an 50.30.170 &Syntax.DE.Dict\ config :cal SetSyn("dictconf")<CR> -an 50.30.180 &Syntax.DE.Dictd\ config :cal SetSyn("dictdconf")<CR> -an 50.30.190 &Syntax.DE.Diff :cal SetSyn("diff")<CR> -an 50.30.200 &Syntax.DE.Digital\ Command\ Lang :cal SetSyn("dcl")<CR> -an 50.30.210 &Syntax.DE.Dircolors :cal SetSyn("dircolors")<CR> -an 50.30.220 &Syntax.DE.Django\ template :cal SetSyn("django")<CR> -an 50.30.230 &Syntax.DE.DNS/BIND\ zone :cal SetSyn("bindzone")<CR> -an 50.30.240 &Syntax.DE.Dnsmasq\ config :cal SetSyn("dnsmasq")<CR> -an 50.30.250 &Syntax.DE.DocBook.auto-detect :cal SetSyn("docbk")<CR> -an 50.30.260 &Syntax.DE.DocBook.SGML :cal SetSyn("docbksgml")<CR> -an 50.30.270 &Syntax.DE.DocBook.XML :cal SetSyn("docbkxml")<CR> -an 50.30.280 &Syntax.DE.Dot :cal SetSyn("dot")<CR> -an 50.30.290 &Syntax.DE.Doxygen.C\ with\ doxygen :cal SetSyn("c.doxygen")<CR> -an 50.30.300 &Syntax.DE.Doxygen.C++\ with\ doxygen :cal SetSyn("cpp.doxygen")<CR> -an 50.30.310 &Syntax.DE.Doxygen.IDL\ with\ doxygen :cal SetSyn("idl.doxygen")<CR> -an 50.30.320 &Syntax.DE.Doxygen.Java\ with\ doxygen :cal SetSyn("java.doxygen")<CR> -an 50.30.330 &Syntax.DE.Doxygen.DataScript\ with\ doxygen :cal SetSyn("datascript.doxygen")<CR> -an 50.30.340 &Syntax.DE.Dracula :cal SetSyn("dracula")<CR> -an 50.30.350 &Syntax.DE.DSSSL :cal SetSyn("dsl")<CR> -an 50.30.360 &Syntax.DE.DTD :cal SetSyn("dtd")<CR> -an 50.30.370 &Syntax.DE.DTML\ (Zope) :cal SetSyn("dtml")<CR> -an 50.30.380 &Syntax.DE.DTrace :cal SetSyn("dtrace")<CR> -an 50.30.390 &Syntax.DE.Dts/dtsi :cal SetSyn("dts")<CR> -an 50.30.400 &Syntax.DE.Dylan.Dylan :cal SetSyn("dylan")<CR> -an 50.30.410 &Syntax.DE.Dylan.Dylan\ interface :cal SetSyn("dylanintr")<CR> -an 50.30.420 &Syntax.DE.Dylan.Dylan\ lid :cal SetSyn("dylanlid")<CR> -an 50.30.440 &Syntax.DE.EDIF :cal SetSyn("edif")<CR> -an 50.30.450 &Syntax.DE.Eiffel :cal SetSyn("eiffel")<CR> -an 50.30.460 &Syntax.DE.Elinks\ config :cal SetSyn("elinks")<CR> -an 50.30.470 &Syntax.DE.Elm\ filter\ rules :cal SetSyn("elmfilt")<CR> -an 50.30.480 &Syntax.DE.Embedix\ Component\ Description :cal SetSyn("ecd")<CR> -an 50.30.490 &Syntax.DE.ERicsson\ LANGuage :cal SetSyn("erlang")<CR> -an 50.30.500 &Syntax.DE.ESMTP\ rc :cal SetSyn("esmtprc")<CR> -an 50.30.510 &Syntax.DE.ESQL-C :cal SetSyn("esqlc")<CR> -an 50.30.520 &Syntax.DE.Essbase\ script :cal SetSyn("csc")<CR> -an 50.30.530 &Syntax.DE.Esterel :cal SetSyn("esterel")<CR> -an 50.30.540 &Syntax.DE.Eterm\ config :cal SetSyn("eterm")<CR> -an 50.30.550 &Syntax.DE.Eviews :cal SetSyn("eviews")<CR> -an 50.30.560 &Syntax.DE.Exim\ conf :cal SetSyn("exim")<CR> -an 50.30.570 &Syntax.DE.Expect :cal SetSyn("expect")<CR> -an 50.30.580 &Syntax.DE.Exports :cal SetSyn("exports")<CR> +an 50.30.140 &Syntax.DE.Debian.Debian\ Copyright :cal SetSyn("debcopyright")<CR> +an 50.30.150 &Syntax.DE.Debian.Debian\ Sources\.list :cal SetSyn("debsources")<CR> +an 50.30.160 &Syntax.DE.Denyhosts :cal SetSyn("denyhosts")<CR> +an 50.30.170 &Syntax.DE.Desktop :cal SetSyn("desktop")<CR> +an 50.30.180 &Syntax.DE.Dict\ config :cal SetSyn("dictconf")<CR> +an 50.30.190 &Syntax.DE.Dictd\ config :cal SetSyn("dictdconf")<CR> +an 50.30.200 &Syntax.DE.Diff :cal SetSyn("diff")<CR> +an 50.30.210 &Syntax.DE.Digital\ Command\ Lang :cal SetSyn("dcl")<CR> +an 50.30.220 &Syntax.DE.Dircolors :cal SetSyn("dircolors")<CR> +an 50.30.230 &Syntax.DE.Dirpager :cal SetSyn("dirpager")<CR> +an 50.30.240 &Syntax.DE.Django\ template :cal SetSyn("django")<CR> +an 50.30.250 &Syntax.DE.DNS/BIND\ zone :cal SetSyn("bindzone")<CR> +an 50.30.260 &Syntax.DE.Dnsmasq\ config :cal SetSyn("dnsmasq")<CR> +an 50.30.270 &Syntax.DE.DocBook.auto-detect :cal SetSyn("docbk")<CR> +an 50.30.280 &Syntax.DE.DocBook.SGML :cal SetSyn("docbksgml")<CR> +an 50.30.290 &Syntax.DE.DocBook.XML :cal SetSyn("docbkxml")<CR> +an 50.30.300 &Syntax.DE.Dockerfile :cal SetSyn("dockerfile")<CR> +an 50.30.310 &Syntax.DE.Dot :cal SetSyn("dot")<CR> +an 50.30.320 &Syntax.DE.Doxygen.C\ with\ doxygen :cal SetSyn("c.doxygen")<CR> +an 50.30.330 &Syntax.DE.Doxygen.C++\ with\ doxygen :cal SetSyn("cpp.doxygen")<CR> +an 50.30.340 &Syntax.DE.Doxygen.IDL\ with\ doxygen :cal SetSyn("idl.doxygen")<CR> +an 50.30.350 &Syntax.DE.Doxygen.Java\ with\ doxygen :cal SetSyn("java.doxygen")<CR> +an 50.30.360 &Syntax.DE.Doxygen.DataScript\ with\ doxygen :cal SetSyn("datascript.doxygen")<CR> +an 50.30.370 &Syntax.DE.Dracula :cal SetSyn("dracula")<CR> +an 50.30.380 &Syntax.DE.DSSSL :cal SetSyn("dsl")<CR> +an 50.30.390 &Syntax.DE.DTD :cal SetSyn("dtd")<CR> +an 50.30.400 &Syntax.DE.DTML\ (Zope) :cal SetSyn("dtml")<CR> +an 50.30.410 &Syntax.DE.DTrace :cal SetSyn("dtrace")<CR> +an 50.30.420 &Syntax.DE.Dts/dtsi :cal SetSyn("dts")<CR> +an 50.30.430 &Syntax.DE.Dylan.Dylan :cal SetSyn("dylan")<CR> +an 50.30.440 &Syntax.DE.Dylan.Dylan\ interface :cal SetSyn("dylanintr")<CR> +an 50.30.450 &Syntax.DE.Dylan.Dylan\ lid :cal SetSyn("dylanlid")<CR> +an 50.30.470 &Syntax.DE.EDIF :cal SetSyn("edif")<CR> +an 50.30.480 &Syntax.DE.Eiffel :cal SetSyn("eiffel")<CR> +an 50.30.490 &Syntax.DE.Elinks\ config :cal SetSyn("elinks")<CR> +an 50.30.500 &Syntax.DE.Elm\ filter\ rules :cal SetSyn("elmfilt")<CR> +an 50.30.510 &Syntax.DE.Embedix\ Component\ Description :cal SetSyn("ecd")<CR> +an 50.30.520 &Syntax.DE.ERicsson\ LANGuage :cal SetSyn("erlang")<CR> +an 50.30.530 &Syntax.DE.ESMTP\ rc :cal SetSyn("esmtprc")<CR> +an 50.30.540 &Syntax.DE.ESQL-C :cal SetSyn("esqlc")<CR> +an 50.30.550 &Syntax.DE.Essbase\ script :cal SetSyn("csc")<CR> +an 50.30.560 &Syntax.DE.Esterel :cal SetSyn("esterel")<CR> +an 50.30.570 &Syntax.DE.Eterm\ config :cal SetSyn("eterm")<CR> +an 50.30.580 &Syntax.DE.Euphoria\ 3 :cal SetSyn("euphoria3")<CR> +an 50.30.590 &Syntax.DE.Euphoria\ 4 :cal SetSyn("euphoria4")<CR> +an 50.30.600 &Syntax.DE.Eviews :cal SetSyn("eviews")<CR> +an 50.30.610 &Syntax.DE.Exim\ conf :cal SetSyn("exim")<CR> +an 50.30.620 &Syntax.DE.Expect :cal SetSyn("expect")<CR> +an 50.30.630 &Syntax.DE.Exports :cal SetSyn("exports")<CR> an 50.40.100 &Syntax.FG.Falcon :cal SetSyn("falcon")<CR> an 50.40.110 &Syntax.FG.Fantom :cal SetSyn("fan")<CR> an 50.40.120 &Syntax.FG.Fetchmail :cal SetSyn("fetchmail")<CR> @@ -212,18 +222,20 @@ an 50.40.330 &Syntax.FG.Git.Send\ Email :cal SetSyn("gitsendemail")<CR> an 50.40.340 &Syntax.FG.Gitolite :cal SetSyn("gitolite")<CR> an 50.40.350 &Syntax.FG.Gkrellmrc :cal SetSyn("gkrellmrc")<CR> an 50.40.360 &Syntax.FG.Gnash :cal SetSyn("gnash")<CR> -an 50.40.370 &Syntax.FG.GP :cal SetSyn("gp")<CR> -an 50.40.380 &Syntax.FG.GPG :cal SetSyn("gpg")<CR> -an 50.40.390 &Syntax.FG.Grof :cal SetSyn("gprof")<CR> -an 50.40.400 &Syntax.FG.Group\ file :cal SetSyn("group")<CR> -an 50.40.410 &Syntax.FG.Grub :cal SetSyn("grub")<CR> -an 50.40.420 &Syntax.FG.GNU\ Server\ Pages :cal SetSyn("gsp")<CR> -an 50.40.430 &Syntax.FG.GNUplot :cal SetSyn("gnuplot")<CR> -an 50.40.440 &Syntax.FG.GrADS\ scripts :cal SetSyn("grads")<CR> -an 50.40.450 &Syntax.FG.Gretl :cal SetSyn("gretl")<CR> -an 50.40.460 &Syntax.FG.Groff :cal SetSyn("groff")<CR> -an 50.40.470 &Syntax.FG.Groovy :cal SetSyn("groovy")<CR> -an 50.40.480 &Syntax.FG.GTKrc :cal SetSyn("gtkrc")<CR> +an 50.40.370 &Syntax.FG.Go :cal SetSyn("go")<CR> +an 50.40.380 &Syntax.FG.Godoc :cal SetSyn("godoc")<CR> +an 50.40.390 &Syntax.FG.GP :cal SetSyn("gp")<CR> +an 50.40.400 &Syntax.FG.GPG :cal SetSyn("gpg")<CR> +an 50.40.410 &Syntax.FG.Grof :cal SetSyn("gprof")<CR> +an 50.40.420 &Syntax.FG.Group\ file :cal SetSyn("group")<CR> +an 50.40.430 &Syntax.FG.Grub :cal SetSyn("grub")<CR> +an 50.40.440 &Syntax.FG.GNU\ Server\ Pages :cal SetSyn("gsp")<CR> +an 50.40.450 &Syntax.FG.GNUplot :cal SetSyn("gnuplot")<CR> +an 50.40.460 &Syntax.FG.GrADS\ scripts :cal SetSyn("grads")<CR> +an 50.40.470 &Syntax.FG.Gretl :cal SetSyn("gretl")<CR> +an 50.40.480 &Syntax.FG.Groff :cal SetSyn("groff")<CR> +an 50.40.490 &Syntax.FG.Groovy :cal SetSyn("groovy")<CR> +an 50.40.500 &Syntax.FG.GTKrc :cal SetSyn("gtkrc")<CR> an 50.50.100 &Syntax.HIJK.Haml :cal SetSyn("haml")<CR> an 50.50.110 &Syntax.HIJK.Hamster :cal SetSyn("hamster")<CR> an 50.50.120 &Syntax.HIJK.Haskell.Haskell :cal SetSyn("haskell")<CR> @@ -240,72 +252,78 @@ 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\ Install\ log :cal SetSyn("upstreaminstalllog")<CR> -an 50.50.450 &Syntax.HIJK.Innovation\ Data\ Processing.Usserver\ log :cal SetSyn("usserverlog")<CR> -an 50.50.460 &Syntax.HIJK.Innovation\ Data\ Processing.USW2KAgt\ log :cal SetSyn("usw2kagtlog")<CR> -an 50.50.470 &Syntax.HIJK.InstallShield\ script :cal SetSyn("ishd")<CR> -an 50.50.480 &Syntax.HIJK.Interactive\ Data\ Lang :cal SetSyn("idlang")<CR> -an 50.50.490 &Syntax.HIJK.IPfilter :cal SetSyn("ipfilter")<CR> -an 50.50.510 &Syntax.HIJK.JAL :cal SetSyn("jal")<CR> -an 50.50.520 &Syntax.HIJK.JAM :cal SetSyn("jam")<CR> -an 50.50.530 &Syntax.HIJK.Jargon :cal SetSyn("jargon")<CR> -an 50.50.540 &Syntax.HIJK.Java.Java :cal SetSyn("java")<CR> -an 50.50.550 &Syntax.HIJK.Java.JavaCC :cal SetSyn("javacc")<CR> -an 50.50.560 &Syntax.HIJK.Java.Java\ Server\ Pages :cal SetSyn("jsp")<CR> -an 50.50.570 &Syntax.HIJK.Java.Java\ Properties :cal SetSyn("jproperties")<CR> -an 50.50.580 &Syntax.HIJK.JavaScript :cal SetSyn("javascript")<CR> -an 50.50.590 &Syntax.HIJK.Jess :cal SetSyn("jess")<CR> -an 50.50.600 &Syntax.HIJK.Jgraph :cal SetSyn("jgraph")<CR> -an 50.50.610 &Syntax.HIJK.Jovial :cal SetSyn("jovial")<CR> -an 50.50.630 &Syntax.HIJK.Kconfig :cal SetSyn("kconfig")<CR> -an 50.50.640 &Syntax.HIJK.KDE\ script :cal SetSyn("kscript")<CR> -an 50.50.650 &Syntax.HIJK.Kimwitu++ :cal SetSyn("kwt")<CR> -an 50.50.660 &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> an 50.60.130 &Syntax.L.Ld\ script :cal SetSyn("ld")<CR> an 50.60.140 &Syntax.L.LDAP.LDIF :cal SetSyn("ldif")<CR> an 50.60.150 &Syntax.L.LDAP.Configuration :cal SetSyn("ldapconf")<CR> -an 50.60.160 &Syntax.L.Lex :cal SetSyn("lex")<CR> -an 50.60.170 &Syntax.L.LFTP\ config :cal SetSyn("lftp")<CR> -an 50.60.180 &Syntax.L.Libao :cal SetSyn("libao")<CR> -an 50.60.190 &Syntax.L.LifeLines\ script :cal SetSyn("lifelines")<CR> -an 50.60.200 &Syntax.L.Lilo :cal SetSyn("lilo")<CR> -an 50.60.210 &Syntax.L.Limits\ config :cal SetSyn("limits")<CR> -an 50.60.220 &Syntax.L.Linden\ scripting :cal SetSyn("lsl")<CR> -an 50.60.230 &Syntax.L.Liquid :cal SetSyn("liquid")<CR> -an 50.60.240 &Syntax.L.Lisp :cal SetSyn("lisp")<CR> -an 50.60.250 &Syntax.L.Lite :cal SetSyn("lite")<CR> -an 50.60.260 &Syntax.L.LiteStep\ RC :cal SetSyn("litestep")<CR> -an 50.60.270 &Syntax.L.Locale\ Input :cal SetSyn("fdcc")<CR> -an 50.60.280 &Syntax.L.Login\.access :cal SetSyn("loginaccess")<CR> -an 50.60.290 &Syntax.L.Login\.defs :cal SetSyn("logindefs")<CR> -an 50.60.300 &Syntax.L.Logtalk :cal SetSyn("logtalk")<CR> -an 50.60.310 &Syntax.L.LOTOS :cal SetSyn("lotos")<CR> -an 50.60.320 &Syntax.L.LotusScript :cal SetSyn("lscript")<CR> -an 50.60.330 &Syntax.L.Lout :cal SetSyn("lout")<CR> -an 50.60.340 &Syntax.L.LPC :cal SetSyn("lpc")<CR> -an 50.60.350 &Syntax.L.Lua :cal SetSyn("lua")<CR> -an 50.60.360 &Syntax.L.Lynx\ Style :cal SetSyn("lss")<CR> -an 50.60.370 &Syntax.L.Lynx\ config :cal SetSyn("lynx")<CR> +an 50.60.160 &Syntax.L.Less :cal SetSyn("less")<CR> +an 50.60.170 &Syntax.L.Lex :cal SetSyn("lex")<CR> +an 50.60.180 &Syntax.L.LFTP\ config :cal SetSyn("lftp")<CR> +an 50.60.190 &Syntax.L.Libao :cal SetSyn("libao")<CR> +an 50.60.200 &Syntax.L.LifeLines\ script :cal SetSyn("lifelines")<CR> +an 50.60.210 &Syntax.L.Lilo :cal SetSyn("lilo")<CR> +an 50.60.220 &Syntax.L.Limits\ config :cal SetSyn("limits")<CR> +an 50.60.230 &Syntax.L.Linden\ scripting :cal SetSyn("lsl")<CR> +an 50.60.240 &Syntax.L.Liquid :cal SetSyn("liquid")<CR> +an 50.60.250 &Syntax.L.Lisp :cal SetSyn("lisp")<CR> +an 50.60.260 &Syntax.L.Lite :cal SetSyn("lite")<CR> +an 50.60.270 &Syntax.L.LiteStep\ RC :cal SetSyn("litestep")<CR> +an 50.60.280 &Syntax.L.Locale\ Input :cal SetSyn("fdcc")<CR> +an 50.60.290 &Syntax.L.Login\.access :cal SetSyn("loginaccess")<CR> +an 50.60.300 &Syntax.L.Login\.defs :cal SetSyn("logindefs")<CR> +an 50.60.310 &Syntax.L.Logtalk :cal SetSyn("logtalk")<CR> +an 50.60.320 &Syntax.L.LOTOS :cal SetSyn("lotos")<CR> +an 50.60.330 &Syntax.L.LotusScript :cal SetSyn("lscript")<CR> +an 50.60.340 &Syntax.L.Lout :cal SetSyn("lout")<CR> +an 50.60.350 &Syntax.L.LPC :cal SetSyn("lpc")<CR> +an 50.60.360 &Syntax.L.Lua :cal SetSyn("lua")<CR> +an 50.60.370 &Syntax.L.Lynx\ Style :cal SetSyn("lss")<CR> +an 50.60.380 &Syntax.L.Lynx\ config :cal SetSyn("lynx")<CR> an 50.70.100 &Syntax.M.M4 :cal SetSyn("m4")<CR> an 50.70.110 &Syntax.M.MaGic\ Point :cal SetSyn("mgp")<CR> an 50.70.120 &Syntax.M.Mail :cal SetSyn("mail")<CR> @@ -318,55 +336,60 @@ an 50.70.180 &Syntax.M.Man\ page :cal SetSyn("man")<CR> an 50.70.190 &Syntax.M.Man\.conf :cal SetSyn("manconf")<CR> an 50.70.200 &Syntax.M.Maple\ V :cal SetSyn("maple")<CR> an 50.70.210 &Syntax.M.Markdown :cal SetSyn("markdown")<CR> -an 50.70.220 &Syntax.M.Mason :cal SetSyn("mason")<CR> -an 50.70.230 &Syntax.M.Mathematica :cal SetSyn("mma")<CR> -an 50.70.240 &Syntax.M.Matlab :cal SetSyn("matlab")<CR> -an 50.70.250 &Syntax.M.Maxima :cal SetSyn("maxima")<CR> -an 50.70.260 &Syntax.M.MEL\ (for\ Maya) :cal SetSyn("mel")<CR> -an 50.70.270 &Syntax.M.Messages\ (/var/log) :cal SetSyn("messages")<CR> -an 50.70.280 &Syntax.M.Metafont :cal SetSyn("mf")<CR> -an 50.70.290 &Syntax.M.MetaPost :cal SetSyn("mp")<CR> -an 50.70.300 &Syntax.M.MGL :cal SetSyn("mgl")<CR> -an 50.70.310 &Syntax.M.MMIX :cal SetSyn("mmix")<CR> -an 50.70.320 &Syntax.M.Modconf :cal SetSyn("modconf")<CR> -an 50.70.330 &Syntax.M.Model :cal SetSyn("model")<CR> -an 50.70.340 &Syntax.M.Modsim\ III :cal SetSyn("modsim3")<CR> -an 50.70.350 &Syntax.M.Modula\ 2 :cal SetSyn("modula2")<CR> -an 50.70.360 &Syntax.M.Modula\ 3 :cal SetSyn("modula3")<CR> -an 50.70.370 &Syntax.M.Monk :cal SetSyn("monk")<CR> -an 50.70.380 &Syntax.M.Mplayer\ config :cal SetSyn("mplayerconf")<CR> -an 50.70.390 &Syntax.M.MOO :cal SetSyn("moo")<CR> -an 50.70.400 &Syntax.M.Mrxvtrc :cal SetSyn("mrxvtrc")<CR> -an 50.70.410 &Syntax.M.MS-DOS/Windows.4DOS\ \.bat\ file :cal SetSyn("btm")<CR> -an 50.70.420 &Syntax.M.MS-DOS/Windows.\.bat\/\.cmd\ file :cal SetSyn("dosbatch")<CR> -an 50.70.430 &Syntax.M.MS-DOS/Windows.\.ini\ file :cal SetSyn("dosini")<CR> -an 50.70.440 &Syntax.M.MS-DOS/Windows.Message\ text :cal SetSyn("msmessages")<CR> -an 50.70.450 &Syntax.M.MS-DOS/Windows.Module\ Definition :cal SetSyn("def")<CR> -an 50.70.460 &Syntax.M.MS-DOS/Windows.Registry :cal SetSyn("registry")<CR> -an 50.70.470 &Syntax.M.MS-DOS/Windows.Resource\ file :cal SetSyn("rc")<CR> -an 50.70.480 &Syntax.M.Msql :cal SetSyn("msql")<CR> -an 50.70.490 &Syntax.M.MuPAD :cal SetSyn("mupad")<CR> -an 50.70.500 &Syntax.M.MUSHcode :cal SetSyn("mush")<CR> -an 50.70.510 &Syntax.M.Muttrc :cal SetSyn("muttrc")<CR> -an 50.80.100 &Syntax.NO.Nanorc :cal SetSyn("nanorc")<CR> -an 50.80.110 &Syntax.NO.Nastran\ input/DMAP :cal SetSyn("nastran")<CR> -an 50.80.120 &Syntax.NO.Natural :cal SetSyn("natural")<CR> -an 50.80.130 &Syntax.NO.Neomuttrc :cal SetSyn("neomuttrc")<CR> -an 50.80.140 &Syntax.NO.Netrc :cal SetSyn("netrc")<CR> -an 50.80.150 &Syntax.NO.Ninja :cal SetSyn("ninja")<CR> -an 50.80.160 &Syntax.NO.Novell\ NCF\ batch :cal SetSyn("ncf")<CR> -an 50.80.170 &Syntax.NO.Not\ Quite\ C\ (LEGO) :cal SetSyn("nqc")<CR> -an 50.80.180 &Syntax.NO.Nroff :cal SetSyn("nroff")<CR> -an 50.80.190 &Syntax.NO.NSIS\ script :cal SetSyn("nsis")<CR> -an 50.80.200 &Syntax.NO.Obj\ 3D\ wavefront :cal SetSyn("obj")<CR> -an 50.80.210 &Syntax.NO.Objective\ C :cal SetSyn("objc")<CR> -an 50.80.220 &Syntax.NO.Objective\ C++ :cal SetSyn("objcpp")<CR> -an 50.80.230 &Syntax.NO.OCAML :cal SetSyn("ocaml")<CR> -an 50.80.240 &Syntax.NO.Occam :cal SetSyn("occam")<CR> -an 50.80.250 &Syntax.NO.Omnimark :cal SetSyn("omnimark")<CR> -an 50.80.260 &Syntax.NO.OpenROAD :cal SetSyn("openroad")<CR> -an 50.80.270 &Syntax.NO.Open\ Psion\ Lang :cal SetSyn("opl")<CR> -an 50.80.280 &Syntax.NO.Oracle\ config :cal SetSyn("ora")<CR> +an 50.70.220 &Syntax.M.Markdown\ with\ R\ statements :cal SetSyn("rmd")<CR> +an 50.70.230 &Syntax.M.Mason :cal SetSyn("mason")<CR> +an 50.70.240 &Syntax.M.Mathematica :cal SetSyn("mma")<CR> +an 50.70.250 &Syntax.M.Matlab :cal SetSyn("matlab")<CR> +an 50.70.260 &Syntax.M.Maxima :cal SetSyn("maxima")<CR> +an 50.70.270 &Syntax.M.MEL\ (for\ Maya) :cal SetSyn("mel")<CR> +an 50.70.280 &Syntax.M.Messages\ (/var/log) :cal SetSyn("messages")<CR> +an 50.70.290 &Syntax.M.Metafont :cal SetSyn("mf")<CR> +an 50.70.300 &Syntax.M.MetaPost :cal SetSyn("mp")<CR> +an 50.70.310 &Syntax.M.MGL :cal SetSyn("mgl")<CR> +an 50.70.320 &Syntax.M.MIX :cal SetSyn("mix")<CR> +an 50.70.330 &Syntax.M.MMIX :cal SetSyn("mmix")<CR> +an 50.70.340 &Syntax.M.Modconf :cal SetSyn("modconf")<CR> +an 50.70.350 &Syntax.M.Model :cal SetSyn("model")<CR> +an 50.70.360 &Syntax.M.Modsim\ III :cal SetSyn("modsim3")<CR> +an 50.70.370 &Syntax.M.Modula\ 2 :cal SetSyn("modula2")<CR> +an 50.70.380 &Syntax.M.Modula\ 3 :cal SetSyn("modula3")<CR> +an 50.70.390 &Syntax.M.Monk :cal SetSyn("monk")<CR> +an 50.70.400 &Syntax.M.Motorola\ S-Record :cal SetSyn("srec")<CR> +an 50.70.410 &Syntax.M.Mplayer\ config :cal SetSyn("mplayerconf")<CR> +an 50.70.420 &Syntax.M.MOO :cal SetSyn("moo")<CR> +an 50.70.430 &Syntax.M.Mrxvtrc :cal SetSyn("mrxvtrc")<CR> +an 50.70.440 &Syntax.M.MS-DOS/Windows.4DOS\ \.bat\ file :cal SetSyn("btm")<CR> +an 50.70.450 &Syntax.M.MS-DOS/Windows.\.bat\/\.cmd\ file :cal SetSyn("dosbatch")<CR> +an 50.70.460 &Syntax.M.MS-DOS/Windows.\.ini\ file :cal SetSyn("dosini")<CR> +an 50.70.470 &Syntax.M.MS-DOS/Windows.Message\ text :cal SetSyn("msmessages")<CR> +an 50.70.480 &Syntax.M.MS-DOS/Windows.Module\ Definition :cal SetSyn("def")<CR> +an 50.70.490 &Syntax.M.MS-DOS/Windows.Registry :cal SetSyn("registry")<CR> +an 50.70.500 &Syntax.M.MS-DOS/Windows.Resource\ file :cal SetSyn("rc")<CR> +an 50.70.510 &Syntax.M.Msql :cal SetSyn("msql")<CR> +an 50.70.520 &Syntax.M.MuPAD :cal SetSyn("mupad")<CR> +an 50.70.530 &Syntax.M.Murphi :cal SetSyn("murphi")<CR> +an 50.70.540 &Syntax.M.MUSHcode :cal SetSyn("mush")<CR> +an 50.70.550 &Syntax.M.Muttrc :cal SetSyn("muttrc")<CR> +an 50.80.100 &Syntax.NO.N1QL :cal SetSyn("n1ql")<CR> +an 50.80.110 &Syntax.NO.Nanorc :cal SetSyn("nanorc")<CR> +an 50.80.120 &Syntax.NO.Nastran\ input/DMAP :cal SetSyn("nastran")<CR> +an 50.80.130 &Syntax.NO.Natural :cal SetSyn("natural")<CR> +an 50.80.140 &Syntax.NO.NeoMutt\ setup\ files :cal SetSyn("neomuttrc")<CR> +an 50.80.150 &Syntax.NO.Netrc :cal SetSyn("netrc")<CR> +an 50.80.160 &Syntax.NO.Ninja :cal SetSyn("ninja")<CR> +an 50.80.170 &Syntax.NO.Novell\ NCF\ batch :cal SetSyn("ncf")<CR> +an 50.80.180 &Syntax.NO.Not\ Quite\ C\ (LEGO) :cal SetSyn("nqc")<CR> +an 50.80.190 &Syntax.NO.Nroff :cal SetSyn("nroff")<CR> +an 50.80.200 &Syntax.NO.NSIS\ script :cal SetSyn("nsis")<CR> +an 50.80.220 &Syntax.NO.Obj\ 3D\ wavefront :cal SetSyn("obj")<CR> +an 50.80.230 &Syntax.NO.Objective\ C :cal SetSyn("objc")<CR> +an 50.80.240 &Syntax.NO.Objective\ C++ :cal SetSyn("objcpp")<CR> +an 50.80.250 &Syntax.NO.OCAML :cal SetSyn("ocaml")<CR> +an 50.80.260 &Syntax.NO.Occam :cal SetSyn("occam")<CR> +an 50.80.270 &Syntax.NO.Omnimark :cal SetSyn("omnimark")<CR> +an 50.80.280 &Syntax.NO.OpenROAD :cal SetSyn("openroad")<CR> +an 50.80.290 &Syntax.NO.Open\ Psion\ Lang :cal SetSyn("opl")<CR> +an 50.80.300 &Syntax.NO.Oracle\ config :cal SetSyn("ora")<CR> an 50.90.100 &Syntax.PQ.Packet\ filter\ conf :cal SetSyn("pf")<CR> an 50.90.110 &Syntax.PQ.Palm\ resource\ compiler :cal SetSyn("pilrc")<CR> an 50.90.120 &Syntax.PQ.Pam\ config :cal SetSyn("pamconf")<CR> @@ -437,168 +460,178 @@ an 50.100.300 &Syntax.R.RockLinux\ package\ desc\. :cal SetSyn("desc")<CR> an 50.100.310 &Syntax.R.Rpcgen :cal SetSyn("rpcgen")<CR> an 50.100.320 &Syntax.R.RPL/2 :cal SetSyn("rpl")<CR> an 50.100.330 &Syntax.R.ReStructuredText :cal SetSyn("rst")<CR> -an 50.100.340 &Syntax.R.RTF :cal SetSyn("rtf")<CR> -an 50.100.350 &Syntax.R.Ruby :cal SetSyn("ruby")<CR> -an 50.110.100 &Syntax.S-Sm.S-Lang :cal SetSyn("slang")<CR> -an 50.110.110 &Syntax.S-Sm.Samba\ config :cal SetSyn("samba")<CR> -an 50.110.120 &Syntax.S-Sm.SAS :cal SetSyn("sas")<CR> -an 50.110.130 &Syntax.S-Sm.Sass :cal SetSyn("sass")<CR> -an 50.110.140 &Syntax.S-Sm.Sather :cal SetSyn("sather")<CR> -an 50.110.150 &Syntax.S-Sm.Scheme :cal SetSyn("scheme")<CR> -an 50.110.160 &Syntax.S-Sm.Scilab :cal SetSyn("scilab")<CR> -an 50.110.170 &Syntax.S-Sm.Screen\ RC :cal SetSyn("screen")<CR> -an 50.110.180 &Syntax.S-Sm.SCSS :cal SetSyn("scss")<CR> -an 50.110.190 &Syntax.S-Sm.SDC\ Synopsys\ Design\ Constraints :cal SetSyn("sdc")<CR> -an 50.110.200 &Syntax.S-Sm.SDL :cal SetSyn("sdl")<CR> -an 50.110.210 &Syntax.S-Sm.Sed :cal SetSyn("sed")<CR> -an 50.110.220 &Syntax.S-Sm.Sendmail\.cf :cal SetSyn("sm")<CR> -an 50.110.230 &Syntax.S-Sm.Send-pr :cal SetSyn("sendpr")<CR> -an 50.110.240 &Syntax.S-Sm.Sensors\.conf :cal SetSyn("sensors")<CR> -an 50.110.250 &Syntax.S-Sm.Service\ Location\ config :cal SetSyn("slpconf")<CR> -an 50.110.260 &Syntax.S-Sm.Service\ Location\ registration :cal SetSyn("slpreg")<CR> -an 50.110.270 &Syntax.S-Sm.Service\ Location\ SPI :cal SetSyn("slpspi")<CR> -an 50.110.280 &Syntax.S-Sm.Services :cal SetSyn("services")<CR> -an 50.110.290 &Syntax.S-Sm.Setserial\ config :cal SetSyn("setserial")<CR> -an 50.110.300 &Syntax.S-Sm.SGML.SGML\ catalog :cal SetSyn("catalog")<CR> -an 50.110.310 &Syntax.S-Sm.SGML.SGML\ DTD :cal SetSyn("sgml")<CR> -an 50.110.320 &Syntax.S-Sm.SGML.SGML\ Declaration :cal SetSyn("sgmldecl")<CR> -an 50.110.330 &Syntax.S-Sm.SGML.SGML-linuxdoc :cal SetSyn("sgmllnx")<CR> -an 50.110.340 &Syntax.S-Sm.Shell\ script.sh\ and\ ksh :cal SetSyn("sh")<CR> -an 50.110.350 &Syntax.S-Sm.Shell\ script.csh :cal SetSyn("csh")<CR> -an 50.110.360 &Syntax.S-Sm.Shell\ script.tcsh :cal SetSyn("tcsh")<CR> -an 50.110.370 &Syntax.S-Sm.Shell\ script.zsh :cal SetSyn("zsh")<CR> -an 50.110.380 &Syntax.S-Sm.SiCAD :cal SetSyn("sicad")<CR> -an 50.110.390 &Syntax.S-Sm.Sieve :cal SetSyn("sieve")<CR> -an 50.110.400 &Syntax.S-Sm.Simula :cal SetSyn("simula")<CR> -an 50.110.410 &Syntax.S-Sm.Sinda.Sinda\ compare :cal SetSyn("sindacmp")<CR> -an 50.110.420 &Syntax.S-Sm.Sinda.Sinda\ input :cal SetSyn("sinda")<CR> -an 50.110.430 &Syntax.S-Sm.Sinda.Sinda\ output :cal SetSyn("sindaout")<CR> -an 50.110.440 &Syntax.S-Sm.SiSU :cal SetSyn("sisu")<CR> -an 50.110.450 &Syntax.S-Sm.SKILL.SKILL :cal SetSyn("skill")<CR> -an 50.110.460 &Syntax.S-Sm.SKILL.SKILL\ for\ Diva :cal SetSyn("diva")<CR> -an 50.110.470 &Syntax.S-Sm.Slice :cal SetSyn("slice")<CR> -an 50.110.480 &Syntax.S-Sm.SLRN.Slrn\ rc :cal SetSyn("slrnrc")<CR> -an 50.110.490 &Syntax.S-Sm.SLRN.Slrn\ score :cal SetSyn("slrnsc")<CR> -an 50.110.500 &Syntax.S-Sm.SmallTalk :cal SetSyn("st")<CR> -an 50.110.510 &Syntax.S-Sm.Smarty\ Templates :cal SetSyn("smarty")<CR> -an 50.110.520 &Syntax.S-Sm.SMIL :cal SetSyn("smil")<CR> -an 50.110.530 &Syntax.S-Sm.SMITH :cal SetSyn("smith")<CR> -an 50.120.100 &Syntax.Sn-Sy.SNMP\ MIB :cal SetSyn("mib")<CR> -an 50.120.110 &Syntax.Sn-Sy.SNNS.SNNS\ network :cal SetSyn("snnsnet")<CR> -an 50.120.120 &Syntax.Sn-Sy.SNNS.SNNS\ pattern :cal SetSyn("snnspat")<CR> -an 50.120.130 &Syntax.Sn-Sy.SNNS.SNNS\ result :cal SetSyn("snnsres")<CR> -an 50.120.140 &Syntax.Sn-Sy.Snobol4 :cal SetSyn("snobol4")<CR> -an 50.120.150 &Syntax.Sn-Sy.Snort\ Configuration :cal SetSyn("hog")<CR> -an 50.120.160 &Syntax.Sn-Sy.SPEC\ (Linux\ RPM) :cal SetSyn("spec")<CR> -an 50.120.170 &Syntax.Sn-Sy.Specman :cal SetSyn("specman")<CR> -an 50.120.180 &Syntax.Sn-Sy.Spice :cal SetSyn("spice")<CR> -an 50.120.190 &Syntax.Sn-Sy.Spyce :cal SetSyn("spyce")<CR> -an 50.120.200 &Syntax.Sn-Sy.Speedup :cal SetSyn("spup")<CR> -an 50.120.210 &Syntax.Sn-Sy.Splint :cal SetSyn("splint")<CR> -an 50.120.220 &Syntax.Sn-Sy.Squid\ config :cal SetSyn("squid")<CR> -an 50.120.230 &Syntax.Sn-Sy.SQL.SAP\ HANA :cal SetSyn("sqlhana")<CR> -an 50.120.240 &Syntax.Sn-Sy.SQL.ESQL-C :cal SetSyn("esqlc")<CR> -an 50.120.250 &Syntax.Sn-Sy.SQL.MySQL :cal SetSyn("mysql")<CR> -an 50.120.260 &Syntax.Sn-Sy.SQL.PL/SQL :cal SetSyn("plsql")<CR> -an 50.120.270 &Syntax.Sn-Sy.SQL.SQL\ Anywhere :cal SetSyn("sqlanywhere")<CR> -an 50.120.280 &Syntax.Sn-Sy.SQL.SQL\ (automatic) :cal SetSyn("sql")<CR> -an 50.120.290 &Syntax.Sn-Sy.SQL.SQL\ (Oracle) :cal SetSyn("sqloracle")<CR> -an 50.120.300 &Syntax.Sn-Sy.SQL.SQL\ Forms :cal SetSyn("sqlforms")<CR> -an 50.120.310 &Syntax.Sn-Sy.SQL.SQLJ :cal SetSyn("sqlj")<CR> -an 50.120.320 &Syntax.Sn-Sy.SQL.SQL-Informix :cal SetSyn("sqlinformix")<CR> -an 50.120.330 &Syntax.Sn-Sy.SQR :cal SetSyn("sqr")<CR> -an 50.120.340 &Syntax.Sn-Sy.Ssh.ssh_config :cal SetSyn("sshconfig")<CR> -an 50.120.350 &Syntax.Sn-Sy.Ssh.sshd_config :cal SetSyn("sshdconfig")<CR> -an 50.120.360 &Syntax.Sn-Sy.Standard\ ML :cal SetSyn("sml")<CR> -an 50.120.370 &Syntax.Sn-Sy.Stata.SMCL :cal SetSyn("smcl")<CR> -an 50.120.380 &Syntax.Sn-Sy.Stata.Stata :cal SetSyn("stata")<CR> -an 50.120.390 &Syntax.Sn-Sy.Stored\ Procedures :cal SetSyn("stp")<CR> -an 50.120.400 &Syntax.Sn-Sy.Strace :cal SetSyn("strace")<CR> -an 50.120.410 &Syntax.Sn-Sy.Streaming\ descriptor\ file :cal SetSyn("sd")<CR> -an 50.120.420 &Syntax.Sn-Sy.Subversion\ commit :cal SetSyn("svn")<CR> -an 50.120.430 &Syntax.Sn-Sy.Sudoers :cal SetSyn("sudoers")<CR> -an 50.120.440 &Syntax.Sn-Sy.SVG :cal SetSyn("svg")<CR> -an 50.120.450 &Syntax.Sn-Sy.Symbian\ meta-makefile :cal SetSyn("mmp")<CR> -an 50.120.460 &Syntax.Sn-Sy.Sysctl\.conf :cal SetSyn("sysctl")<CR> -an 50.130.100 &Syntax.T.TADS :cal SetSyn("tads")<CR> -an 50.130.110 &Syntax.T.Tags :cal SetSyn("tags")<CR> -an 50.130.120 &Syntax.T.TAK.TAK\ compare :cal SetSyn("takcmp")<CR> -an 50.130.130 &Syntax.T.TAK.TAK\ input :cal SetSyn("tak")<CR> -an 50.130.140 &Syntax.T.TAK.TAK\ output :cal SetSyn("takout")<CR> -an 50.130.150 &Syntax.T.Tar\ listing :cal SetSyn("tar")<CR> -an 50.130.160 &Syntax.T.Task\ data :cal SetSyn("taskdata")<CR> -an 50.130.170 &Syntax.T.Task\ 42\ edit :cal SetSyn("taskedit")<CR> -an 50.130.180 &Syntax.T.Tcl/Tk :cal SetSyn("tcl")<CR> -an 50.130.190 &Syntax.T.TealInfo :cal SetSyn("tli")<CR> -an 50.130.200 &Syntax.T.Telix\ Salt :cal SetSyn("tsalt")<CR> -an 50.130.210 &Syntax.T.Termcap/Printcap :cal SetSyn("ptcap")<CR> -an 50.130.220 &Syntax.T.Terminfo :cal SetSyn("terminfo")<CR> -an 50.130.230 &Syntax.T.TeX.TeX/LaTeX :cal SetSyn("tex")<CR> -an 50.130.240 &Syntax.T.TeX.plain\ TeX :cal SetSyn("plaintex")<CR> -an 50.130.250 &Syntax.T.TeX.Initex :cal SetSyn("initex")<CR> -an 50.130.260 &Syntax.T.TeX.ConTeXt :cal SetSyn("context")<CR> -an 50.130.270 &Syntax.T.TeX.TeX\ configuration :cal SetSyn("texmf")<CR> -an 50.130.280 &Syntax.T.TeX.Texinfo :cal SetSyn("texinfo")<CR> -an 50.130.290 &Syntax.T.TF\ mud\ client :cal SetSyn("tf")<CR> -an 50.130.300 &Syntax.T.Tidy\ configuration :cal SetSyn("tidy")<CR> -an 50.130.310 &Syntax.T.Tilde :cal SetSyn("tilde")<CR> -an 50.130.320 &Syntax.T.TPP :cal SetSyn("tpp")<CR> -an 50.130.330 &Syntax.T.Trasys\ input :cal SetSyn("trasys")<CR> -an 50.130.340 &Syntax.T.Treetop :cal SetSyn("treetop")<CR> -an 50.130.350 &Syntax.T.Trustees :cal SetSyn("trustees")<CR> -an 50.130.360 &Syntax.T.TSS.Command\ Line :cal SetSyn("tsscl")<CR> -an 50.130.370 &Syntax.T.TSS.Geometry :cal SetSyn("tssgm")<CR> -an 50.130.380 &Syntax.T.TSS.Optics :cal SetSyn("tssop")<CR> -an 50.140.100 &Syntax.UV.Udev\ config :cal SetSyn("udevconf")<CR> -an 50.140.110 &Syntax.UV.Udev\ permissions :cal SetSyn("udevperm")<CR> -an 50.140.120 &Syntax.UV.Udev\ rules :cal SetSyn("udevrules")<CR> -an 50.140.130 &Syntax.UV.UIT/UIL :cal SetSyn("uil")<CR> -an 50.140.140 &Syntax.UV.UnrealScript :cal SetSyn("uc")<CR> -an 50.140.150 &Syntax.UV.Updatedb\.conf :cal SetSyn("updatedb")<CR> -an 50.140.160 &Syntax.UV.Upstart :cal SetSyn("upstart")<CR> -an 50.140.180 &Syntax.UV.Valgrind :cal SetSyn("valgrind")<CR> -an 50.140.190 &Syntax.UV.Vera :cal SetSyn("vera")<CR> -an 50.140.200 &Syntax.UV.Verilog-AMS\ HDL :cal SetSyn("verilogams")<CR> -an 50.140.210 &Syntax.UV.Verilog\ HDL :cal SetSyn("verilog")<CR> -an 50.140.220 &Syntax.UV.Vgrindefs :cal SetSyn("vgrindefs")<CR> -an 50.140.230 &Syntax.UV.VHDL :cal SetSyn("vhdl")<CR> -an 50.140.240 &Syntax.UV.Vim.Vim\ help\ file :cal SetSyn("help")<CR> -an 50.140.250 &Syntax.UV.Vim.Vim\ script :cal SetSyn("vim")<CR> -an 50.140.260 &Syntax.UV.Vim.Viminfo\ file :cal SetSyn("viminfo")<CR> -an 50.140.270 &Syntax.UV.Virata\ config :cal SetSyn("virata")<CR> -an 50.140.280 &Syntax.UV.Visual\ Basic :cal SetSyn("vb")<CR> -an 50.140.290 &Syntax.UV.VOS\ CM\ macro :cal SetSyn("voscm")<CR> -an 50.140.300 &Syntax.UV.VRML :cal SetSyn("vrml")<CR> -an 50.140.310 &Syntax.UV.VSE\ JCL :cal SetSyn("vsejcl")<CR> -an 50.150.100 &Syntax.WXYZ.WEB.CWEB :cal SetSyn("cweb")<CR> -an 50.150.110 &Syntax.WXYZ.WEB.WEB :cal SetSyn("web")<CR> -an 50.150.120 &Syntax.WXYZ.WEB.WEB\ Changes :cal SetSyn("change")<CR> -an 50.150.130 &Syntax.WXYZ.Webmacro :cal SetSyn("webmacro")<CR> -an 50.150.140 &Syntax.WXYZ.Website\ MetaLanguage :cal SetSyn("wml")<CR> -an 50.150.160 &Syntax.WXYZ.wDiff :cal SetSyn("wdiff")<CR> -an 50.150.180 &Syntax.WXYZ.Wget\ config :cal SetSyn("wget")<CR> -an 50.150.190 &Syntax.WXYZ.Whitespace\ (add) :cal SetSyn("whitespace")<CR> -an 50.150.200 &Syntax.WXYZ.WildPackets\ EtherPeek\ Decoder :cal SetSyn("dcd")<CR> -an 50.150.210 &Syntax.WXYZ.WinBatch/Webbatch :cal SetSyn("winbatch")<CR> -an 50.150.220 &Syntax.WXYZ.Windows\ Scripting\ Host :cal SetSyn("wsh")<CR> -an 50.150.230 &Syntax.WXYZ.WSML :cal SetSyn("wsml")<CR> -an 50.150.240 &Syntax.WXYZ.WvDial :cal SetSyn("wvdial")<CR> -an 50.150.260 &Syntax.WXYZ.X\ Keyboard\ Extension :cal SetSyn("xkb")<CR> -an 50.150.270 &Syntax.WXYZ.X\ Pixmap :cal SetSyn("xpm")<CR> -an 50.150.280 &Syntax.WXYZ.X\ Pixmap\ (2) :cal SetSyn("xpm2")<CR> -an 50.150.290 &Syntax.WXYZ.X\ resources :cal SetSyn("xdefaults")<CR> -an 50.150.300 &Syntax.WXYZ.XBL :cal SetSyn("xbl")<CR> -an 50.150.310 &Syntax.WXYZ.Xinetd\.conf :cal SetSyn("xinetd")<CR> -an 50.150.320 &Syntax.WXYZ.Xmodmap :cal SetSyn("xmodmap")<CR> -an 50.150.330 &Syntax.WXYZ.Xmath :cal SetSyn("xmath")<CR> -an 50.150.340 &Syntax.WXYZ.XML :cal SetSyn("xml")<CR> -an 50.150.350 &Syntax.WXYZ.XML\ Schema\ (XSD) :cal SetSyn("xsd")<CR> -an 50.150.360 &Syntax.WXYZ.XQuery :cal SetSyn("xquery")<CR> -an 50.150.370 &Syntax.WXYZ.Xslt :cal SetSyn("xslt")<CR> -an 50.150.380 &Syntax.WXYZ.XFree86\ Config :cal SetSyn("xf86conf")<CR> -an 50.150.400 &Syntax.WXYZ.YAML :cal SetSyn("yaml")<CR> -an 50.150.410 &Syntax.WXYZ.Yacc :cal SetSyn("yacc")<CR> -an 50.150.430 &Syntax.WXYZ.Zimbu :cal SetSyn("zimbu")<CR> +an 50.110.100 &Syntax.M.ReStructuredText\ with\ R\ statements :cal SetSyn("rrst")<CR> +an 50.120.100 &Syntax.R.RTF :cal SetSyn("rtf")<CR> +an 50.120.110 &Syntax.R.Ruby :cal SetSyn("ruby")<CR> +an 50.120.120 &Syntax.R.Rust :cal SetSyn("rust")<CR> +an 50.130.100 &Syntax.S-Sm.S-Lang :cal SetSyn("slang")<CR> +an 50.130.110 &Syntax.S-Sm.Samba\ config :cal SetSyn("samba")<CR> +an 50.130.120 &Syntax.S-Sm.SAS :cal SetSyn("sas")<CR> +an 50.130.130 &Syntax.S-Sm.Sass :cal SetSyn("sass")<CR> +an 50.130.140 &Syntax.S-Sm.Sather :cal SetSyn("sather")<CR> +an 50.130.150 &Syntax.S-Sm.Sbt :cal SetSyn("sbt")<CR> +an 50.130.160 &Syntax.S-Sm.Scala :cal SetSyn("scala")<CR> +an 50.130.170 &Syntax.S-Sm.Scheme :cal SetSyn("scheme")<CR> +an 50.130.180 &Syntax.S-Sm.Scilab :cal SetSyn("scilab")<CR> +an 50.130.190 &Syntax.S-Sm.Screen\ RC :cal SetSyn("screen")<CR> +an 50.130.200 &Syntax.S-Sm.SCSS :cal SetSyn("scss")<CR> +an 50.130.210 &Syntax.S-Sm.SDC\ Synopsys\ Design\ Constraints :cal SetSyn("sdc")<CR> +an 50.130.220 &Syntax.S-Sm.SDL :cal SetSyn("sdl")<CR> +an 50.130.230 &Syntax.S-Sm.Sed :cal SetSyn("sed")<CR> +an 50.130.240 &Syntax.S-Sm.Sendmail\.cf :cal SetSyn("sm")<CR> +an 50.130.250 &Syntax.S-Sm.Send-pr :cal SetSyn("sendpr")<CR> +an 50.130.260 &Syntax.S-Sm.Sensors\.conf :cal SetSyn("sensors")<CR> +an 50.130.270 &Syntax.S-Sm.Service\ Location\ config :cal SetSyn("slpconf")<CR> +an 50.130.280 &Syntax.S-Sm.Service\ Location\ registration :cal SetSyn("slpreg")<CR> +an 50.130.290 &Syntax.S-Sm.Service\ Location\ SPI :cal SetSyn("slpspi")<CR> +an 50.130.300 &Syntax.S-Sm.Services :cal SetSyn("services")<CR> +an 50.130.310 &Syntax.S-Sm.Setserial\ config :cal SetSyn("setserial")<CR> +an 50.130.320 &Syntax.S-Sm.SGML.SGML\ catalog :cal SetSyn("catalog")<CR> +an 50.130.330 &Syntax.S-Sm.SGML.SGML\ DTD :cal SetSyn("sgml")<CR> +an 50.130.340 &Syntax.S-Sm.SGML.SGML\ Declaration :cal SetSyn("sgmldecl")<CR> +an 50.130.350 &Syntax.S-Sm.SGML.SGML-linuxdoc :cal SetSyn("sgmllnx")<CR> +an 50.130.360 &Syntax.S-Sm.Shell\ script.sh\ and\ ksh :cal SetSyn("sh")<CR> +an 50.130.370 &Syntax.S-Sm.Shell\ script.csh :cal SetSyn("csh")<CR> +an 50.130.380 &Syntax.S-Sm.Shell\ script.tcsh :cal SetSyn("tcsh")<CR> +an 50.130.390 &Syntax.S-Sm.Shell\ script.zsh :cal SetSyn("zsh")<CR> +an 50.130.400 &Syntax.S-Sm.SiCAD :cal SetSyn("sicad")<CR> +an 50.130.410 &Syntax.S-Sm.Sieve :cal SetSyn("sieve")<CR> +an 50.130.420 &Syntax.S-Sm.Simula :cal SetSyn("simula")<CR> +an 50.130.430 &Syntax.S-Sm.Sinda.Sinda\ compare :cal SetSyn("sindacmp")<CR> +an 50.130.440 &Syntax.S-Sm.Sinda.Sinda\ input :cal SetSyn("sinda")<CR> +an 50.130.450 &Syntax.S-Sm.Sinda.Sinda\ output :cal SetSyn("sindaout")<CR> +an 50.130.460 &Syntax.S-Sm.SiSU :cal SetSyn("sisu")<CR> +an 50.130.470 &Syntax.S-Sm.SKILL.SKILL :cal SetSyn("skill")<CR> +an 50.130.480 &Syntax.S-Sm.SKILL.SKILL\ for\ Diva :cal SetSyn("diva")<CR> +an 50.130.490 &Syntax.S-Sm.Slice :cal SetSyn("slice")<CR> +an 50.130.500 &Syntax.S-Sm.SLRN.Slrn\ rc :cal SetSyn("slrnrc")<CR> +an 50.130.510 &Syntax.S-Sm.SLRN.Slrn\ score :cal SetSyn("slrnsc")<CR> +an 50.130.520 &Syntax.S-Sm.SmallTalk :cal SetSyn("st")<CR> +an 50.130.530 &Syntax.S-Sm.Smarty\ Templates :cal SetSyn("smarty")<CR> +an 50.130.540 &Syntax.S-Sm.SMIL :cal SetSyn("smil")<CR> +an 50.130.550 &Syntax.S-Sm.SMITH :cal SetSyn("smith")<CR> +an 50.140.100 &Syntax.Sn-Sy.SNMP\ MIB :cal SetSyn("mib")<CR> +an 50.140.110 &Syntax.Sn-Sy.SNNS.SNNS\ network :cal SetSyn("snnsnet")<CR> +an 50.140.120 &Syntax.Sn-Sy.SNNS.SNNS\ pattern :cal SetSyn("snnspat")<CR> +an 50.140.130 &Syntax.Sn-Sy.SNNS.SNNS\ result :cal SetSyn("snnsres")<CR> +an 50.140.140 &Syntax.Sn-Sy.Snobol4 :cal SetSyn("snobol4")<CR> +an 50.140.150 &Syntax.Sn-Sy.Snort\ Configuration :cal SetSyn("hog")<CR> +an 50.140.160 &Syntax.Sn-Sy.SPEC\ (Linux\ RPM) :cal SetSyn("spec")<CR> +an 50.140.170 &Syntax.Sn-Sy.Specman :cal SetSyn("specman")<CR> +an 50.140.180 &Syntax.Sn-Sy.Spice :cal SetSyn("spice")<CR> +an 50.140.190 &Syntax.Sn-Sy.Spyce :cal SetSyn("spyce")<CR> +an 50.140.200 &Syntax.Sn-Sy.Speedup :cal SetSyn("spup")<CR> +an 50.140.210 &Syntax.Sn-Sy.Splint :cal SetSyn("splint")<CR> +an 50.140.220 &Syntax.Sn-Sy.Squid\ config :cal SetSyn("squid")<CR> +an 50.140.230 &Syntax.Sn-Sy.SQL.SAP\ HANA :cal SetSyn("sqlhana")<CR> +an 50.140.240 &Syntax.Sn-Sy.SQL.ESQL-C :cal SetSyn("esqlc")<CR> +an 50.140.250 &Syntax.Sn-Sy.SQL.MySQL :cal SetSyn("mysql")<CR> +an 50.140.260 &Syntax.Sn-Sy.SQL.PL/SQL :cal SetSyn("plsql")<CR> +an 50.140.270 &Syntax.Sn-Sy.SQL.SQL\ Anywhere :cal SetSyn("sqlanywhere")<CR> +an 50.140.280 &Syntax.Sn-Sy.SQL.SQL\ (automatic) :cal SetSyn("sql")<CR> +an 50.140.290 &Syntax.Sn-Sy.SQL.SQL\ (Oracle) :cal SetSyn("sqloracle")<CR> +an 50.140.300 &Syntax.Sn-Sy.SQL.SQL\ Forms :cal SetSyn("sqlforms")<CR> +an 50.140.310 &Syntax.Sn-Sy.SQL.SQLJ :cal SetSyn("sqlj")<CR> +an 50.140.320 &Syntax.Sn-Sy.SQL.SQL-Informix :cal SetSyn("sqlinformix")<CR> +an 50.140.330 &Syntax.Sn-Sy.SQR :cal SetSyn("sqr")<CR> +an 50.140.340 &Syntax.Sn-Sy.Ssh.ssh_config :cal SetSyn("sshconfig")<CR> +an 50.140.350 &Syntax.Sn-Sy.Ssh.sshd_config :cal SetSyn("sshdconfig")<CR> +an 50.140.360 &Syntax.Sn-Sy.Standard\ ML :cal SetSyn("sml")<CR> +an 50.140.370 &Syntax.Sn-Sy.Stata.SMCL :cal SetSyn("smcl")<CR> +an 50.140.380 &Syntax.Sn-Sy.Stata.Stata :cal SetSyn("stata")<CR> +an 50.140.390 &Syntax.Sn-Sy.Stored\ Procedures :cal SetSyn("stp")<CR> +an 50.140.400 &Syntax.Sn-Sy.Strace :cal SetSyn("strace")<CR> +an 50.140.410 &Syntax.Sn-Sy.Streaming\ descriptor\ file :cal SetSyn("sd")<CR> +an 50.140.420 &Syntax.Sn-Sy.Subversion\ commit :cal SetSyn("svn")<CR> +an 50.140.430 &Syntax.Sn-Sy.Sudoers :cal SetSyn("sudoers")<CR> +an 50.140.440 &Syntax.Sn-Sy.SVG :cal SetSyn("svg")<CR> +an 50.140.450 &Syntax.Sn-Sy.Symbian\ meta-makefile :cal SetSyn("mmp")<CR> +an 50.140.460 &Syntax.Sn-Sy.Sysctl\.conf :cal SetSyn("sysctl")<CR> +an 50.140.470 &Syntax.Sn-Sy.Systemd :cal SetSyn("systemd")<CR> +an 50.140.480 &Syntax.Sn-Sy.SystemVerilog :cal SetSyn("systemverilog")<CR> +an 50.150.100 &Syntax.T.TADS :cal SetSyn("tads")<CR> +an 50.150.110 &Syntax.T.Tags :cal SetSyn("tags")<CR> +an 50.150.120 &Syntax.T.TAK.TAK\ compare :cal SetSyn("takcmp")<CR> +an 50.150.130 &Syntax.T.TAK.TAK\ input :cal SetSyn("tak")<CR> +an 50.150.140 &Syntax.T.TAK.TAK\ output :cal SetSyn("takout")<CR> +an 50.150.150 &Syntax.T.Tar\ listing :cal SetSyn("tar")<CR> +an 50.150.160 &Syntax.T.Task\ data :cal SetSyn("taskdata")<CR> +an 50.150.170 &Syntax.T.Task\ 42\ edit :cal SetSyn("taskedit")<CR> +an 50.150.180 &Syntax.T.Tcl/Tk :cal SetSyn("tcl")<CR> +an 50.150.190 &Syntax.T.TealInfo :cal SetSyn("tli")<CR> +an 50.150.200 &Syntax.T.Telix\ Salt :cal SetSyn("tsalt")<CR> +an 50.150.210 &Syntax.T.Termcap/Printcap :cal SetSyn("ptcap")<CR> +an 50.150.220 &Syntax.T.Terminfo :cal SetSyn("terminfo")<CR> +an 50.150.230 &Syntax.T.Tera\ Term :cal SetSyn("teraterm")<CR> +an 50.150.240 &Syntax.T.TeX.TeX/LaTeX :cal SetSyn("tex")<CR> +an 50.150.250 &Syntax.T.TeX.plain\ TeX :cal SetSyn("plaintex")<CR> +an 50.150.260 &Syntax.T.TeX.Initex :cal SetSyn("initex")<CR> +an 50.150.270 &Syntax.T.TeX.ConTeXt :cal SetSyn("context")<CR> +an 50.150.280 &Syntax.T.TeX.TeX\ configuration :cal SetSyn("texmf")<CR> +an 50.150.290 &Syntax.T.TeX.Texinfo :cal SetSyn("texinfo")<CR> +an 50.150.300 &Syntax.T.TF\ mud\ client :cal SetSyn("tf")<CR> +an 50.150.310 &Syntax.T.Tidy\ configuration :cal SetSyn("tidy")<CR> +an 50.150.320 &Syntax.T.Tilde :cal SetSyn("tilde")<CR> +an 50.150.330 &Syntax.T.Tmux\ configuration :cal SetSyn("tmux")<CR> +an 50.150.340 &Syntax.T.TPP :cal SetSyn("tpp")<CR> +an 50.150.350 &Syntax.T.Trasys\ input :cal SetSyn("trasys")<CR> +an 50.150.360 &Syntax.T.Treetop :cal SetSyn("treetop")<CR> +an 50.150.370 &Syntax.T.Trustees :cal SetSyn("trustees")<CR> +an 50.150.380 &Syntax.T.TSS.Command\ Line :cal SetSyn("tsscl")<CR> +an 50.150.390 &Syntax.T.TSS.Geometry :cal SetSyn("tssgm")<CR> +an 50.150.400 &Syntax.T.TSS.Optics :cal SetSyn("tssop")<CR> +an 50.160.100 &Syntax.UV.Udev\ config :cal SetSyn("udevconf")<CR> +an 50.160.110 &Syntax.UV.Udev\ permissions :cal SetSyn("udevperm")<CR> +an 50.160.120 &Syntax.UV.Udev\ rules :cal SetSyn("udevrules")<CR> +an 50.160.130 &Syntax.UV.UIT/UIL :cal SetSyn("uil")<CR> +an 50.160.140 &Syntax.UV.UnrealScript :cal SetSyn("uc")<CR> +an 50.160.150 &Syntax.UV.Updatedb\.conf :cal SetSyn("updatedb")<CR> +an 50.160.160 &Syntax.UV.Upstart :cal SetSyn("upstart")<CR> +an 50.160.180 &Syntax.UV.Valgrind :cal SetSyn("valgrind")<CR> +an 50.160.190 &Syntax.UV.Vera :cal SetSyn("vera")<CR> +an 50.160.200 &Syntax.UV.Verbose\ TAP\ Output :cal SetSyn("tap")<CR> +an 50.160.210 &Syntax.UV.Verilog-AMS\ HDL :cal SetSyn("verilogams")<CR> +an 50.160.220 &Syntax.UV.Verilog\ HDL :cal SetSyn("verilog")<CR> +an 50.160.230 &Syntax.UV.Vgrindefs :cal SetSyn("vgrindefs")<CR> +an 50.160.240 &Syntax.UV.VHDL :cal SetSyn("vhdl")<CR> +an 50.160.250 &Syntax.UV.Vim.Vim\ help\ file :cal SetSyn("help")<CR> +an 50.160.260 &Syntax.UV.Vim.Vim\ script :cal SetSyn("vim")<CR> +an 50.160.270 &Syntax.UV.Vim.Viminfo\ file :cal SetSyn("viminfo")<CR> +an 50.160.280 &Syntax.UV.Virata\ config :cal SetSyn("virata")<CR> +an 50.160.290 &Syntax.UV.Visual\ Basic :cal SetSyn("vb")<CR> +an 50.160.300 &Syntax.UV.VOS\ CM\ macro :cal SetSyn("voscm")<CR> +an 50.160.310 &Syntax.UV.VRML :cal SetSyn("vrml")<CR> +an 50.160.320 &Syntax.UV.Vroom :cal SetSyn("vroom")<CR> +an 50.160.330 &Syntax.UV.VSE\ JCL :cal SetSyn("vsejcl")<CR> +an 50.170.100 &Syntax.WXYZ.WEB.CWEB :cal SetSyn("cweb")<CR> +an 50.170.110 &Syntax.WXYZ.WEB.WEB :cal SetSyn("web")<CR> +an 50.170.120 &Syntax.WXYZ.WEB.WEB\ Changes :cal SetSyn("change")<CR> +an 50.170.130 &Syntax.WXYZ.Webmacro :cal SetSyn("webmacro")<CR> +an 50.170.140 &Syntax.WXYZ.Website\ MetaLanguage :cal SetSyn("wml")<CR> +an 50.170.160 &Syntax.WXYZ.wDiff :cal SetSyn("wdiff")<CR> +an 50.170.180 &Syntax.WXYZ.Wget\ config :cal SetSyn("wget")<CR> +an 50.170.190 &Syntax.WXYZ.Whitespace\ (add) :cal SetSyn("whitespace")<CR> +an 50.170.200 &Syntax.WXYZ.WildPackets\ EtherPeek\ Decoder :cal SetSyn("dcd")<CR> +an 50.170.210 &Syntax.WXYZ.WinBatch/Webbatch :cal SetSyn("winbatch")<CR> +an 50.170.220 &Syntax.WXYZ.Windows\ Scripting\ Host :cal SetSyn("wsh")<CR> +an 50.170.230 &Syntax.WXYZ.WSML :cal SetSyn("wsml")<CR> +an 50.170.240 &Syntax.WXYZ.WvDial :cal SetSyn("wvdial")<CR> +an 50.170.260 &Syntax.WXYZ.X\ Keyboard\ Extension :cal SetSyn("xkb")<CR> +an 50.170.270 &Syntax.WXYZ.X\ Pixmap :cal SetSyn("xpm")<CR> +an 50.170.280 &Syntax.WXYZ.X\ Pixmap\ (2) :cal SetSyn("xpm2")<CR> +an 50.170.290 &Syntax.WXYZ.X\ resources :cal SetSyn("xdefaults")<CR> +an 50.170.300 &Syntax.WXYZ.XBL :cal SetSyn("xbl")<CR> +an 50.170.310 &Syntax.WXYZ.Xinetd\.conf :cal SetSyn("xinetd")<CR> +an 50.170.320 &Syntax.WXYZ.Xmodmap :cal SetSyn("xmodmap")<CR> +an 50.170.330 &Syntax.WXYZ.Xmath :cal SetSyn("xmath")<CR> +an 50.170.340 &Syntax.WXYZ.XML :cal SetSyn("xml")<CR> +an 50.170.350 &Syntax.WXYZ.XML\ Schema\ (XSD) :cal SetSyn("xsd")<CR> +an 50.170.360 &Syntax.WXYZ.XQuery :cal SetSyn("xquery")<CR> +an 50.170.370 &Syntax.WXYZ.Xslt :cal SetSyn("xslt")<CR> +an 50.170.380 &Syntax.WXYZ.XFree86\ Config :cal SetSyn("xf86conf")<CR> +an 50.170.400 &Syntax.WXYZ.YAML :cal SetSyn("yaml")<CR> +an 50.170.410 &Syntax.WXYZ.Yacc :cal SetSyn("yacc")<CR> +an 50.170.430 &Syntax.WXYZ.Zimbu :cal SetSyn("zimbu")<CR> " The End Of The Syntax Menu diff --git a/runtime/syntax/2html.vim b/runtime/syntax/2html.vim index ddc7819be2..4a2d1d3959 100644 --- a/runtime/syntax/2html.vim +++ b/runtime/syntax/2html.vim @@ -1,6 +1,6 @@ " Vim syntax support file " Maintainer: Ben Fritz <fritzophrenic@gmail.com> -" Last Change: 2015 Sep 08 +" Last Change: 2018 Nov 11 " " Additional contributors: " @@ -633,6 +633,45 @@ if s:current_syntax == '' let s:current_syntax = 'none' endif +" If the user is sourcing this script directly then the plugin version isn't +" known because the main plugin script didn't load. In the usual case where the +" user still has the full Vim runtime installed, or has this full plugin +" installed in a package or something, then we can extract the version from the +" main plugin file at it's usual spot relative to this file. Otherwise the user +" is assembling their runtime piecemeal and we have no idea what versions of +" other files may be present so don't even try to make a guess or assume the +" presence of other specific files with specific meaning. +" +" We don't want to actually source the main plugin file here because the user +" may have a good reason not to (e.g. they define their own TOhtml command or +" something). +" +" If this seems way too complicated and convoluted, it is. Probably I should +" have put the version information in the autoload file from the start. But the +" version has been in the global variable for so long that changing it could +" break a lot of user scripts. +if exists("g:loaded_2html_plugin") + let s:pluginversion = g:loaded_2html_plugin +else + if !exists("g:unloaded_tohtml_plugin") + let s:main_plugin_path = expand("<sfile>:p:h:h")."/plugin/tohtml.vim" + if filereadable(s:main_plugin_path) + let s:lines = readfile(s:main_plugin_path, "", 20) + call filter(s:lines, 'v:val =~ "loaded_2html_plugin = "') + if empty(s:lines) + let g:unloaded_tohtml_plugin = "unknown" + else + let g:unloaded_tohtml_plugin = substitute(s:lines[0], '.*loaded_2html_plugin = \([''"]\)\(\%(\1\@!.\)\+\)\1', '\2', '') + endif + unlet s:lines + else + let g:unloaded_tohtml_plugin = "unknown" + endif + unlet s:main_plugin_path + endif + let s:pluginversion = g:unloaded_tohtml_plugin +endif + " Split window to create a buffer with the HTML file. let s:orgbufnr = winbufnr(0) let s:origwin_stl = &l:stl @@ -721,7 +760,7 @@ endif call extend(s:lines, [ \ ("<title>".expand("%:p:~")."</title>"), \ ("<meta name=\"Generator\" content=\"Vim/".v:version/100.".".v:version%100.'"'.s:tag_close), - \ ("<meta name=\"plugin-version\" content=\"".g:loaded_2html_plugin.'"'.s:tag_close) + \ ("<meta name=\"plugin-version\" content=\"".s:pluginversion.'"'.s:tag_close) \ ]) call add(s:lines, '<meta name="syntax" content="'.s:current_syntax.'"'.s:tag_close) call add(s:lines, '<meta name="settings" content="'. @@ -807,12 +846,15 @@ if s:settings.use_css endif endif -" insert script tag; javascript is always needed for the line number -" normalization for URL hashes -call extend(s:lines, [ - \ "", - \ "<script type='text/javascript'>", - \ s:settings.use_xhtml ? '//<![CDATA[' : "<!--"]) +let s:uses_script = s:settings.dynamic_folds || s:settings.line_ids || !empty(s:settings.prevent_copy) + +" insert script tag if needed +if s:uses_script + call extend(s:lines, [ + \ "", + \ "<script type='text/javascript'>", + \ s:settings.use_xhtml ? '//<![CDATA[' : "<!--"]) +endif " insert javascript to toggle folds open and closed if s:settings.dynamic_folds @@ -849,8 +891,9 @@ if s:settings.line_ids \ " if (lineNum.indexOf('L') == -1) {", \ " lineNum = 'L'+lineNum;", \ " }", - \ " lineElem = document.getElementById(lineNum);" + \ " var lineElem = document.getElementById(lineNum);" \ ]) + if s:settings.dynamic_folds call extend(s:lines, [ \ "", @@ -940,12 +983,14 @@ if !empty(s:settings.prevent_copy) \ ]) endif -" insert script closing tag -call extend(s:lines, [ - \ '', - \ s:settings.use_xhtml ? '//]]>' : '-->', - \ "</script>" - \ ]) +" insert script closing tag if needed +if s:uses_script + call extend(s:lines, [ + \ '', + \ s:settings.use_xhtml ? '//]]>' : '-->', + \ "</script>" + \ ]) +endif call extend(s:lines, ["</head>"]) if !empty(s:settings.prevent_copy) @@ -1525,10 +1570,22 @@ while s:lnum <= s:end if s:settings.expand_tabs let s:offset = 0 let s:idx = stridx(s:expandedtab, "\t") + let s:tablist = split(&vts,',') + if empty(s:tablist) + let s:tablist = [ &ts ] + endif + let s:tabidx = 0 + let s:tabwidth = 0 while s:idx >= 0 + while s:startcol+s:idx > s:tabwidth + s:tablist[s:tabidx] + let s:tabwidth += s:tablist[s:tabidx] + if s:tabidx < len(s:tablist)-1 + let s:tabidx = s:tabidx+1 + endif + endwhile if has("multi_byte_encoding") if s:startcol + s:idx == 1 - let s:i = &ts + let s:i = s:tablist[s:tabidx] else if s:idx == 0 let s:prevc = matchstr(s:line, '.\%' . (s:startcol + s:idx + s:offset) . 'c') @@ -1536,11 +1593,11 @@ while s:lnum <= s:end let s:prevc = matchstr(s:expandedtab, '.\%' . (s:idx + 1) . 'c') endif let s:vcol = virtcol([s:lnum, s:startcol + s:idx + s:offset - len(s:prevc)]) - let s:i = &ts - (s:vcol % &ts) + let s:i = s:tablist[s:tabidx] - (s:vcol - s:tabwidth) endif let s:offset -= s:i - 1 else - let s:i = &ts - ((s:idx + s:startcol - 1) % &ts) + let s:i = s:tablist[s:tabidx] - ((s:idx + s:startcol - 1) - s:tabwidth) endif let s:expandedtab = substitute(s:expandedtab, '\t', repeat(' ', s:i), '') let s:idx = stridx(s:expandedtab, "\t") diff --git a/runtime/syntax/8th.vim b/runtime/syntax/8th.vim new file mode 100644 index 0000000000..ddc1084c9f --- /dev/null +++ b/runtime/syntax/8th.vim @@ -0,0 +1,335 @@ +" Vim syntax file +" Language: 8th +" Version: 19.01d +" Maintainer: Ron Aaron <ron@aaron-tech.com> +" URL: https://8th-dev.com/ +" Filetypes: *.8th +" NOTE: You should also have the ftplugin/8th.vim file to set 'isk' + +if version < 600 + syntax clear + finish +elseif exists("b:current_syntax") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim +syn clear +" Synchronization method +syn sync ccomment +syn sync maxlines=100 +syn case match +syn match eighthColonName "\S\+" contained +syn match eighthColonDef ":\s\+\S\+" contains=eighthColonName + +" new words +syn match eighthClasses "\<\S\+:" contained +syn match eighthClassWord "\<\S\+:.\+" contains=eighthClasses + +syn keyword eighthEndOfColonDef ; i; +syn keyword eighthDefine var var, + +" Built in words +com! -nargs=+ Builtin syn keyword eighthBuiltin <args> +"Builtin ^ < <# <#> = > - -- ,# ; ;; ! ??? / . .# ' () @ * */ \ + +Builtin ! G:! #! G:#! ## G:## #> G:#> #if G:#if ' G:' ( G:( (* G:(* (:) G:(:) (code) G:(code) (getc) G:(getc) +Builtin (gets) G:(gets) (interp) G:(interp) (needs) G:(needs) (putc) G:(putc) (puts) G:(puts) (putslim) G:(putslim) +Builtin (say) G:(say) (stat) G:(stat) ) G:) +listener G:+listener +ref G:+ref ,# G:,# -- G:-- -----BEGIN G:-----BEGIN +Builtin -Inf G:-Inf -Inf? G:-Inf? -listener G:-listener -ref G:-ref -rot G:-rot . G:. .# G:.# .needs G:.needs +Builtin .r G:.r .s G:.s .stats G:.stats .ver G:.ver .with G:.with 0; G:0; 2dip G:2dip 2drop G:2drop +Builtin 2dup G:2dup 2over G:2over 2swap G:2swap 3drop G:3drop 4drop G:4drop 8thdt? G:8thdt? 8thver? G:8thver? +Builtin : G:: ; G:; ;; G:;; ;;; G:;;; ;then G:;then ;with G:;with <# G:<# <#> G:<#> >clip G:>clip >json G:>json +Builtin >kind G:>kind >n G:>n >r G:>r >s G:>s ?: G:?: ??? G:??? @ G:@ Inf G:Inf Inf? G:Inf? NaN G:NaN +Builtin NaN? G:NaN? SED-CHECK G:SED-CHECK SED: G:SED: SED: G:SED: \ G:\ ` G:` `` G:`` actor: G:actor: +Builtin again G:again ahead G:ahead and G:and appname G:appname apropos G:apropos argc G:argc args G:args +Builtin array? G:array? assert G:assert base G:base bi G:bi bits G:bits break G:break break? G:break? +Builtin build? G:build? buildver? G:buildver? bye G:bye c# G:c# c/does G:c/does case G:case caseof G:caseof +Builtin chdir G:chdir clip> G:clip> clone G:clone clone-shallow G:clone-shallow cold G:cold compat-level G:compat-level +Builtin compile G:compile compile? G:compile? conflict G:conflict const G:const container? G:container? +Builtin cr G:cr curlang G:curlang curry G:curry curry: G:curry: decimal G:decimal defer: G:defer: deg>rad G:deg>rad +Builtin depth G:depth die G:die dip G:dip drop G:drop dstack G:dstack dump G:dump dup G:dup dup? G:dup? +Builtin else G:else enum: G:enum: eval G:eval eval! G:eval! eval0 G:eval0 execnull G:execnull expect G:expect +Builtin extra! G:extra! extra@ G:extra@ false G:false fnv G:fnv fourth G:fourth free G:free func: G:func: +Builtin getc G:getc getcwd G:getcwd getenv G:getenv gets G:gets handler G:handler header G:header help G:help +Builtin hex G:hex i: G:i: i; G:i; if G:if if; G:if; isa? G:isa? items-used G:items-used jcall G:jcall +Builtin jclass G:jclass jmethod G:jmethod json-nesting G:json-nesting json-pretty G:json-pretty json-throw G:json-throw +Builtin json> G:json> k32 G:k32 keep G:keep l: G:l: last G:last lib G:lib libbin G:libbin libc G:libc +Builtin listener@ G:listener@ literal G:literal locals: G:locals: lock G:lock lock-to G:lock-to locked? G:locked? +Builtin log G:log log-async G:log-async log-task G:log-task log-time G:log-time log-time-local G:log-time-local +Builtin long-days G:long-days long-months G:long-months loop G:loop loop- G:loop- map? G:map? mark G:mark +Builtin mark? G:mark? memfree G:memfree mobile? G:mobile? n# G:n# name>os G:name>os name>sem G:name>sem +Builtin ndrop G:ndrop needs G:needs new G:new next-arg G:next-arg nip G:nip noop G:noop not G:not ns G:ns +Builtin ns: G:ns: ns>ls G:ns>ls ns>s G:ns>s ns? G:ns? null G:null null; G:null; null? G:null? number? G:number? +Builtin off G:off on G:on onexit G:onexit only G:only op! G:op! or G:or os G:os os-names G:os-names +Builtin os>long-name G:os>long-name os>name G:os>name over G:over p: G:p: pack G:pack parse G:parse +Builtin parsech G:parsech parseln G:parseln parsews G:parsews pick G:pick poke G:poke pool-clear G:pool-clear +Builtin prior G:prior private G:private process-args G:process-args prompt G:prompt public G:public +Builtin putc G:putc puts G:puts putslim G:putslim quote G:quote r! G:r! r> G:r> r@ G:r@ rad>deg G:rad>deg +Builtin rand G:rand rand-pcg G:rand-pcg rand-pcg-seed G:rand-pcg-seed randbuf G:randbuf randbuf-pcg G:randbuf-pcg +Builtin rdrop G:rdrop recurse G:recurse recurse-stack G:recurse-stack ref@ G:ref@ reg! G:reg! reg@ G:reg@ +Builtin regbin@ G:regbin@ remaining-args G:remaining-args repeat G:repeat reset G:reset roll G:roll +Builtin rop! G:rop! rot G:rot rpick G:rpick rroll G:rroll rstack G:rstack rswap G:rswap rusage G:rusage +Builtin s>ns G:s>ns same? G:same? scriptdir G:scriptdir scriptfile G:scriptfile sem G:sem sem-post G:sem-post +Builtin sem-rm G:sem-rm sem-wait G:sem-wait sem-wait? G:sem-wait? sem>name G:sem>name semi-throw G:semi-throw +Builtin set-wipe G:set-wipe setenv G:setenv settings! G:settings! settings![] G:settings![] settings@ G:settings@ +Builtin settings@? G:settings@? settings@[] G:settings@[] sh G:sh sh$ G:sh$ short-days G:short-days +Builtin short-months G:short-months sleep G:sleep space G:space stack-check G:stack-check stack-size G:stack-size +Builtin step G:step string? G:string? struct: G:struct: swap G:swap syslang G:syslang sysregion G:sysregion +Builtin tab-hook G:tab-hook tell-conflict G:tell-conflict tempdir G:tempdir tempfilename G:tempfilename +Builtin then G:then third G:third throw G:throw thrownull G:thrownull times G:times tlog G:tlog tri G:tri +Builtin true G:true tuck G:tuck type-check G:type-check typeassert G:typeassert unlock G:unlock unpack G:unpack +Builtin until G:until until! G:until! var G:var var, G:var, while G:while while! G:while! with: G:with: +Builtin words G:words words-like G:words-like words/ G:words/ xchg G:xchg xor G:xor >auth HTTP:>auth +Builtin sh I:sh tpush I:tpush trace-word I:trace-word call JSONRPC:call auth-string OAuth:auth-string +Builtin gen-nonce OAuth:gen-nonce params OAuth:params call SOAP:call ! a:! + a:+ - a:- 2each a:2each +Builtin 2map a:2map 2map+ a:2map+ 2map= a:2map= = a:= >map a:>map @ a:@ @@ a:@@ bsearch a:bsearch clear a:clear +Builtin close a:close diff a:diff dot a:dot each a:each each-slice a:each-slice exists? a:exists? filter a:filter +Builtin generate a:generate group a:group indexof a:indexof insert a:insert intersect a:intersect join a:join +Builtin len a:len map a:map map+ a:map+ map= a:map= mean a:mean mean&variance a:mean&variance new a:new +Builtin op a:op op! a:op! op= a:op= open a:open pop a:pop push a:push qsort a:qsort randeach a:randeach +Builtin reduce a:reduce reduce+ a:reduce+ rev a:rev shift a:shift shuffle a:shuffle slice a:slice slice+ a:slice+ +Builtin slide a:slide sort a:sort union a:union when a:when when! a:when! x a:x x-each a:x-each xchg a:xchg +Builtin y a:y zip a:zip 8thdir app:8thdir asset app:asset atrun app:atrun atrun app:atrun atrun app:atrun +Builtin basedir app:basedir current app:current datadir app:datadir exename app:exename isgui app:isgui +Builtin main app:main oncrash app:oncrash orientation app:orientation pid app:pid restart app:restart +Builtin resumed app:resumed shared? app:shared? standalone app:standalone subdir app:subdir suspended app:suspended +Builtin sysquit app:sysquit (here) asm:(here) >n asm:>n avail asm:avail c, asm:c, here! asm:here! n> asm:n> +Builtin used asm:used w, asm:w, ! b:! + b:+ / b:/ = b:= >base64 b:>base64 >hex b:>hex >mpack b:>mpack +Builtin @ b:@ append b:append base64> b:base64> bit! b:bit! bit@ b:bit@ clear b:clear compress b:compress +Builtin conv b:conv each b:each each-slice b:each-slice expand b:expand fill b:fill getb b:getb hex> b:hex> +Builtin len b:len mem> b:mem> move b:move mpack-date b:mpack-date mpack-ignore b:mpack-ignore mpack> b:mpack> +Builtin new b:new op b:op rev b:rev search b:search shmem b:shmem slice b:slice splice b:splice ungetb b:ungetb +Builtin writable b:writable xor b:xor +block bc:+block .blocks bc:.blocks add-block bc:add-block block-hash bc:block-hash +Builtin block@ bc:block@ first-block bc:first-block hash bc:hash last-block bc:last-block load bc:load +Builtin new bc:new save bc:save set-sql bc:set-sql validate bc:validate validate-block bc:validate-block +Builtin add bloom:add filter bloom:filter in? bloom:in? accept bt:accept ch! bt:ch! ch@ bt:ch@ connect bt:connect +Builtin disconnect bt:disconnect err? bt:err? leconnect bt:leconnect lescan bt:lescan listen bt:listen +Builtin on? bt:on? read bt:read scan bt:scan service? bt:service? services? bt:services? write bt:write +Builtin * c:* * c:* + c:+ + c:+ = c:= = c:= >ri c:>ri >ri c:>ri abs c:abs abs c:abs arg c:arg arg c:arg +Builtin conj c:conj conj c:conj im c:im n> c:n> new c:new new c:new re c:re >aes128gcm cr:>aes128gcm +Builtin >aes256gcm cr:>aes256gcm >cp cr:>cp >cpe cr:>cpe >decrypt cr:>decrypt >edbox cr:>edbox >encrypt cr:>encrypt +Builtin >nbuf cr:>nbuf >rsabox cr:>rsabox >uuid cr:>uuid CBC cr:CBC CFB cr:CFB CTR cr:CTR ECB cr:ECB +Builtin GCM cr:GCM OFB cr:OFB aad? cr:aad? aes128box-sig cr:aes128box-sig aes128gcm> cr:aes128gcm> +Builtin aes256box-sig cr:aes256box-sig aes256gcm> cr:aes256gcm> aesgcm cr:aesgcm blakehash cr:blakehash +Builtin chacha20box-sig cr:chacha20box-sig chachapoly cr:chachapoly cipher! cr:cipher! cipher@ cr:cipher@ +Builtin cp> cr:cp> cpe> cr:cpe> decrypt cr:decrypt decrypt+ cr:decrypt+ decrypt> cr:decrypt> dh-genkey cr:dh-genkey +Builtin dh-secret cr:dh-secret dh-sign cr:dh-sign dh-verify cr:dh-verify ebox-sig cr:ebox-sig ecc-genkey cr:ecc-genkey +Builtin ecc-secret cr:ecc-secret ecc-sign cr:ecc-sign ecc-verify cr:ecc-verify edbox-sig cr:edbox-sig +Builtin edbox> cr:edbox> encrypt cr:encrypt encrypt+ cr:encrypt+ encrypt> cr:encrypt> ensurekey cr:ensurekey +Builtin err? cr:err? gcm-tag-size cr:gcm-tag-size genkey cr:genkey hash cr:hash hash! cr:hash! hash+ cr:hash+ +Builtin hash>b cr:hash>b hash>s cr:hash>s hash@ cr:hash@ hmac cr:hmac hotp cr:hotp iv? cr:iv? mode cr:mode +Builtin mode@ cr:mode@ randkey cr:randkey restore cr:restore root-certs cr:root-certs rsa_decrypt cr:rsa_decrypt +Builtin rsa_encrypt cr:rsa_encrypt rsa_sign cr:rsa_sign rsa_verify cr:rsa_verify rsabox-sig cr:rsabox-sig +Builtin rsabox> cr:rsabox> rsagenkey cr:rsagenkey save cr:save sbox-sig cr:sbox-sig sha1-hmac cr:sha1-hmac +Builtin shard cr:shard tag? cr:tag? totp cr:totp totp-epoch cr:totp-epoch totp-time-step cr:totp-time-step +Builtin unshard cr:unshard uuid cr:uuid uuid> cr:uuid> validate-pgp-sig cr:validate-pgp-sig (.hebrew) d:(.hebrew) +Builtin (.islamic) d:(.islamic) + d:+ +day d:+day +hour d:+hour +min d:+min +msec d:+msec - d:- .hebrew d:.hebrew +Builtin .islamic d:.islamic .time d:.time / d:/ = d:= >fixed d:>fixed >hebepoch d:>hebepoch >msec d:>msec +Builtin >unix d:>unix >ymd d:>ymd Adar d:Adar Adar2 d:Adar2 Adar2 d:Adar2 Av d:Av Elul d:Elul Fri d:Fri +Builtin Heshvan d:Heshvan Iyar d:Iyar Kislev d:Kislev Mon d:Mon Nissan d:Nissan Sat d:Sat Shevat d:Shevat +Builtin Sivan d:Sivan Sun d:Sun Tammuz d:Tammuz Tevet d:Tevet Thu d:Thu Tishrei d:Tishrei Tue d:Tue +Builtin Wed d:Wed adjust-dst d:adjust-dst between d:between d. d:d. dawn d:dawn days-in-hebrew-year d:days-in-hebrew-year +Builtin displaying-hebrew d:displaying-hebrew do-dawn d:do-dawn do-dusk d:do-dusk do-rise d:do-rise +Builtin doy d:doy dst? d:dst? dstquery d:dstquery dstzones? d:dstzones? dusk d:dusk elapsed-timer d:elapsed-timer +Builtin elapsed-timer-seconds d:elapsed-timer-seconds first-dow d:first-dow fixed> d:fixed> fixed>dow d:fixed>dow +Builtin fixed>hebrew d:fixed>hebrew fixed>islamic d:fixed>islamic format d:format hanukkah d:hanukkah +Builtin hebrew-epoch d:hebrew-epoch hebrew>fixed d:hebrew>fixed hebrewtoday d:hebrewtoday hmonth-name d:hmonth-name +Builtin islamic.epoch d:islamic.epoch islamic>fixed d:islamic>fixed islamictoday d:islamictoday join d:join +Builtin last-day-of-hebrew-month d:last-day-of-hebrew-month last-dow d:last-dow last-month d:last-month +Builtin last-week d:last-week last-year d:last-year latitude d:latitude longitude d:longitude longitude d:longitude +Builtin msec d:msec msec> d:msec> new d:new next-dow d:next-dow next-month d:next-month next-week d:next-week +Builtin next-year d:next-year number>hebrew d:number>hebrew omer d:omer parse d:parse pesach d:pesach +Builtin prev-dow d:prev-dow purim d:purim rosh-chodesh? d:rosh-chodesh? rosh-hashanah d:rosh-hashanah +Builtin shavuot d:shavuot start-timer d:start-timer sunrise d:sunrise taanit-esther d:taanit-esther +Builtin ticks d:ticks ticks/sec d:ticks/sec timer d:timer tisha-beav d:tisha-beav tzadjust d:tzadjust +Builtin unix> d:unix> updatetz d:updatetz year@ d:year@ ymd d:ymd ymd> d:ymd> yom-haatsmaut d:yom-haatsmaut +Builtin yom-kippur d:yom-kippur add-func db:add-func bind db:bind close db:close col db:col col[] db:col[] +Builtin col{} db:col{} err? db:err? errmsg db:errmsg exec db:exec exec-cb db:exec-cb key db:key mysql? db:mysql? +Builtin odbc? db:odbc? open db:open open? db:open? prepare db:prepare query db:query query-all db:query-all +Builtin rekey db:rekey sqlerrmsg db:sqlerrmsg bp dbg:bp except-task@ dbg:except-task@ go dbg:go line-info dbg:line-info +Builtin prompt dbg:prompt stop dbg:stop trace dbg:trace trace-enter dbg:trace-enter trace-leave dbg:trace-leave +Builtin abspath f:abspath append f:append associate f:associate atime f:atime canwrite? f:canwrite? +Builtin chmod f:chmod close f:close copy f:copy copydir f:copydir create f:create ctime f:ctime dir? f:dir? +Builtin dname f:dname eachbuf f:eachbuf eachline f:eachline enssep f:enssep eof? f:eof? err? f:err? +Builtin exists? f:exists? flush f:flush fname f:fname getb f:getb getc f:getc getline f:getline getmod f:getmod +Builtin glob f:glob glob-nocase f:glob-nocase include f:include launch f:launch link f:link link> f:link> +Builtin link? f:link? mkdir f:mkdir mmap f:mmap mmap-range f:mmap-range mmap-range? f:mmap-range? mtime f:mtime +Builtin mv f:mv open f:open open-ro f:open-ro popen f:popen print f:print read f:read relpath f:relpath +Builtin rglob f:rglob rm f:rm rmdir f:rmdir seek f:seek sep f:sep show f:show size f:size slurp f:slurp +Builtin stderr f:stderr stdin f:stdin stdout f:stdout tell f:tell times f:times trash f:trash ungetb f:ungetb +Builtin ungetc f:ungetc unzip f:unzip unzip-entry f:unzip-entry watch f:watch write f:write writen f:writen +Builtin zip+ f:zip+ zip@ f:zip@ zipentry f:zipentry zipnew f:zipnew zipopen f:zipopen zipsave f:zipsave +Builtin bold font:bold face? font:face? glyph-path font:glyph-path glyph-pos font:glyph-pos info font:info +Builtin italic font:italic ls font:ls measure font:measure new font:new pixels font:pixels pixels? font:pixels? +Builtin points font:points points? font:points? styles font:styles styles? font:styles? underline font:underline +Builtin +child g:+child +kind g:+kind +path g:+path -child g:-child /path g:/path >img g:>img >progress g:>progress +Builtin add-items g:add-items adjustwidth g:adjustwidth allow-orient g:allow-orient arc g:arc arc2 g:arc2 +Builtin autohide g:autohide back g:back bezier g:bezier bg g:bg bg? g:bg? bounds g:bounds bounds? g:bounds? +Builtin box-label g:box-label btn-font g:btn-font bubble g:bubble button-size g:button-size buttons-visible g:buttons-visible +Builtin c-text g:c-text callout g:callout center g:center child g:child clear g:clear clearpath g:clearpath +Builtin clr>n g:clr>n coleven g:coleven colordlg g:colordlg colwidth g:colwidth connectededges g:connectededges +Builtin contrasting g:contrasting cp g:cp curmouse? g:curmouse? default-font g:default-font deselect-row g:deselect-row +Builtin dismiss g:dismiss do g:do draw-fitted-text g:draw-fitted-text draw-text g:draw-text draw-text-at g:draw-text-at +Builtin each g:each edit-on-double-click g:edit-on-double-click editable g:editable editdlg g:editdlg +Builtin empty-text g:empty-text enable g:enable enabled? g:enabled? fade g:fade fb-files g:fb-files +Builtin fcolor g:fcolor fg g:fg fg? g:fg? file-filter g:file-filter file-name g:file-name filedlg g:filedlg +Builtin fill g:fill fillall g:fillall fit-text g:fit-text flex! g:flex! focus g:focus fontdlg g:fontdlg +Builtin forward g:forward fullscreen g:fullscreen get-lasso-items g:get-lasso-items get-tab g:get-tab +Builtin getclr g:getclr getfont g:getfont getimage g:getimage getpath g:getpath getroot g:getroot gradient g:gradient +Builtin gui? g:gui? handle g:handle headerheight g:headerheight hide g:hide image g:image image-at g:image-at +Builtin invalidate g:invalidate ix? g:ix? justify g:justify keyinfo g:keyinfo l-text g:l-text laf g:laf +Builtin laf! g:laf! laf? g:laf? len g:len line-width g:line-width lineto g:lineto list+ g:list+ list- g:list- +Builtin loadcontent g:loadcontent localize g:localize m! g:m! m@ g:m@ menu-font g:menu-font menu-update g:menu-update +Builtin menuenabled g:menuenabled mouse? g:mouse? mousepos? g:mousepos? moveto g:moveto msgdlg g:msgdlg +Builtin multi g:multi name g:name named-skin g:named-skin new g:new new-laf g:new-laf next g:next obj g:obj +Builtin on g:on on? g:on? ontop g:ontop oshandle g:oshandle outlinethickness g:outlinethickness panel-size g:panel-size +Builtin panel-size? g:panel-size? parent g:parent path g:path path>s g:path>s pie g:pie pix! g:pix! +Builtin pop g:pop popmenu g:popmenu pos? g:pos? prev g:prev propval! g:propval! propval@ g:propval@ +Builtin push g:push qbezier g:qbezier quit g:quit r-text g:r-text readonly g:readonly rect g:rect refresh g:refresh +Builtin restore g:restore root g:root root-item-visible g:root-item-visible rotate g:rotate rowheight g:rowheight +Builtin rrect g:rrect s>path g:s>path save g:save say g:say scale g:scale scolor g:scolor scrollthickness g:scrollthickness +Builtin sectionenable g:sectionenable select! g:select! select@ g:select@ selected-rows g:selected-rows +Builtin set-lasso g:set-lasso set-long-press g:set-long-press set-popup-font g:set-popup-font set-range g:set-range +Builtin set-swipe g:set-swipe set-value g:set-value setcursor g:setcursor setfont g:setfont setheader g:setheader +Builtin sethtml g:sethtml setimage g:setimage setname g:setname setroot g:setroot settab g:settab show g:show +Builtin show-line-numbers g:show-line-numbers show-pct g:show-pct showmenu g:showmenu showtooltip g:showtooltip +Builtin size g:size size? g:size? skin g:skin skin-class g:skin-class stackix g:stackix state g:state +Builtin state? g:state? stepsize g:stepsize stroke g:stroke stroke-fill g:stroke-fill style g:style +Builtin tabname g:tabname text g:text text-box-style g:text-box-style text? g:text? textcolor g:textcolor +Builtin textsize g:textsize timer! g:timer! timer@ g:timer@ toback g:toback tofront g:tofront toggle-row g:toggle-row +Builtin tooltip g:tooltip top g:top transition g:transition translate g:translate tree-open g:tree-open +Builtin triangle g:triangle update g:update updateitems g:updateitems url g:url user g:user user! g:user! +Builtin vertical g:vertical view g:view visible? g:visible? vpos! g:vpos! vpos@ g:vpos@ waitcursor g:waitcursor +Builtin winding g:winding xy g:xy xy? g:xy? +edge gr:+edge +edge+w gr:+edge+w +node gr:+node connect gr:connect +Builtin edges gr:edges m! gr:m! m@ gr:m@ neighbors gr:neighbors new gr:new node-edges gr:node-edges +Builtin nodes gr:nodes traverse gr:traverse + h:+ clear h:clear len h:len new h:new peek h:peek pop h:pop +Builtin push h:push unique h:unique arm? hw:arm? camera hw:camera camera-fmt hw:camera-fmt camera-img hw:camera-img +Builtin camera? hw:camera? cpu? hw:cpu? device? hw:device? displays? hw:displays? displaysize? hw:displaysize? +Builtin err? hw:err? gpio hw:gpio gpio! hw:gpio! gpio-mmap hw:gpio-mmap gpio@ hw:gpio@ i2c hw:i2c i2c! hw:i2c! +Builtin i2c!reg hw:i2c!reg i2c@ hw:i2c@ i2c@reg hw:i2c@reg isround? hw:isround? iswatch? hw:iswatch? +Builtin mac? hw:mac? mem? hw:mem? poll hw:poll sensor hw:sensor start hw:start stop hw:stop fetch-full imap:fetch-full +Builtin fetch-uid-mail imap:fetch-uid-mail login imap:login new imap:new select-inbox imap:select-inbox +Builtin >file img:>file copy img:copy crop img:crop data img:data desat img:desat fill img:fill filter img:filter +Builtin flip img:flip from-svg img:from-svg new img:new pix! img:pix! pix@ img:pix@ qr-gen img:qr-gen +Builtin qr-parse img:qr-parse rotate img:rotate scale img:scale scroll img:scroll size img:size countries iso:countries +Builtin find loc:find sort loc:sort ! m:! !? m:!? + m:+ +? m:+? - m:- @ m:@ @? m:@? @@ m:@@ clear m:clear +Builtin data m:data each m:each exists? m:exists? iter m:iter iter-all m:iter-all keys m:keys len m:len +Builtin map m:map new m:new op! m:op! open m:open vals m:vals xchg m:xchg ! mat:! * mat:* + mat:+ = mat:= +Builtin @ mat:@ col mat:col data mat:data det mat:det dim? mat:dim? get-n mat:get-n ident mat:ident +Builtin m. mat:m. minor mat:minor n* mat:n* new mat:new row mat:row same-size? mat:same-size? trans mat:trans +Builtin ! n:! * n:* */ n:*/ + n:+ +! n:+! - n:- / n:/ /mod n:/mod 1+ n:1+ 1- n:1- < n:< = n:= > n:> +Builtin BIGE n:BIGE BIGPI n:BIGPI E n:E PI n:PI ^ n:^ abs n:abs acos n:acos acos n:acos asin n:asin +Builtin asin n:asin atan n:atan atan n:atan atan2 n:atan2 band n:band between n:between bfloat n:bfloat +Builtin bic n:bic bint n:bint binv n:binv bnot n:bnot bor n:bor bxor n:bxor ceil n:ceil clamp n:clamp +Builtin cmp n:cmp comb n:comb cos n:cos cosd n:cosd exp n:exp expmod n:expmod float n:float floor n:floor +Builtin fmod n:fmod frac n:frac gcd n:gcd int n:int invmod n:invmod kind? n:kind? lcm n:lcm ln n:ln +Builtin max n:max median n:median min n:min mod n:mod neg n:neg odd? n:odd? perm n:perm prime? n:prime? +Builtin quantize n:quantize quantize! n:quantize! r+ n:r+ range n:range rot32l n:rot32l rot32r n:rot32r +Builtin round n:round round2 n:round2 running-variance n:running-variance running-variance-finalize n:running-variance-finalize +Builtin sgn n:sgn shl n:shl shr n:shr sin n:sin sind n:sind sqr n:sqr sqrt n:sqrt tan n:tan tand n:tand +Builtin trunc n:trunc ~= n:~= ! net:! >url net:>url @ net:@ DGRAM net:DGRAM INET4 net:INET4 INET6 net:INET6 +Builtin PROTO_TCP net:PROTO_TCP PROTO_UDP net:PROTO_UDP STREAM net:STREAM accept net:accept addrinfo>o net:addrinfo>o +Builtin again? net:again? alloc-and-read net:alloc-and-read alloc-buf net:alloc-buf bind net:bind browse net:browse +Builtin close net:close connect net:connect err>s net:err>s err? net:err? get net:get getaddrinfo net:getaddrinfo +Builtin getpeername net:getpeername head net:head ifaces? net:ifaces? listen net:listen net-socket net:net-socket +Builtin opts net:opts port-is-ssl? net:port-is-ssl? post net:post proxy! net:proxy! read net:read recvfrom net:recvfrom +Builtin s>url net:s>url sendto net:sendto server net:server setsockopt net:setsockopt socket net:socket +Builtin tlshello net:tlshello url> net:url> user-agent net:user-agent wait net:wait write net:write +Builtin MAX ns:MAX cast ptr:cast len ptr:len pack ptr:pack unpack ptr:unpack unpack_orig ptr:unpack_orig +Builtin + q:+ clear q:clear len q:len new q:new notify q:notify overwrite q:overwrite peek q:peek pick q:pick +Builtin pop q:pop push q:push shift q:shift size q:size slide q:slide throwing q:throwing wait q:wait +Builtin ++match r:++match +/ r:+/ +match r:+match / r:/ @ r:@ err? r:err? len r:len match r:match new r:new +Builtin rx r:rx str r:str ! s:! * s:* + s:+ - s:- / s:/ /scripts s:/scripts <+ s:<+ = s:= =ic s:=ic +Builtin >base64 s:>base64 >ucs2 s:>ucs2 @ s:@ append s:append base64> s:base64> clear s:clear cmp s:cmp +Builtin cmpi s:cmpi compress s:compress days! s:days! each s:each eachline s:eachline expand s:expand +Builtin fill s:fill fmt s:fmt gershayim s:gershayim globmatch s:globmatch hexupr s:hexupr insert s:insert +Builtin intl s:intl intl! s:intl! lang s:lang lc s:lc len s:len lsub s:lsub ltrim s:ltrim map s:map +Builtin months! s:months! new s:new replace s:replace replace! s:replace! rev s:rev rsearch s:rsearch +Builtin rsub s:rsub rtrim s:rtrim script? s:script? search s:search size s:size slice s:slice strfmap s:strfmap +Builtin strfmt s:strfmt trim s:trim tsub s:tsub uc s:uc ucs2> s:ucs2> utf8? s:utf8? zt s:zt close sio:close +Builtin enum sio:enum open sio:open opts! sio:opts! opts@ sio:opts@ read sio:read write sio:write new smtp:new +Builtin send smtp:send apply-filter snd:apply-filter devices? snd:devices? end-record snd:end-record +Builtin filter snd:filter formats? snd:formats? freq snd:freq gain snd:gain gain? snd:gain? len snd:len +Builtin loop snd:loop mix snd:mix new snd:new pause snd:pause play snd:play played snd:played rate snd:rate +Builtin record snd:record seek snd:seek stop snd:stop stopall snd:stopall unmix snd:unmix volume snd:volume +Builtin volume? snd:volume? + st:+ . st:. clear st:clear len st:len ndrop st:ndrop new st:new op! st:op! +Builtin peek st:peek pick st:pick pop st:pop push st:push roll st:roll shift st:shift size st:size +Builtin slide st:slide swap st:swap throwing st:throwing >buf struct:>buf arr> struct:arr> buf struct:buf +Builtin buf> struct:buf> byte struct:byte double struct:double field! struct:field! field@ struct:field@ +Builtin float struct:float ignore struct:ignore int struct:int long struct:long struct; struct:struct; +Builtin word struct:word ! t:! @ t:@ assign t:assign curtask t:curtask def-queue t:def-queue def-stack t:def-stack +Builtin done? t:done? err! t:err! err? t:err? getq t:getq guitask t:guitask handler t:handler kill t:kill +Builtin list t:list main t:main name! t:name! name@ t:name@ notify t:notify pop t:pop priority t:priority +Builtin push t:push push< t:push< q-notify t:q-notify q-wait t:q-wait qlen t:qlen result t:result task t:task +Builtin task-n t:task-n task-stop t:task-stop wait t:wait ! w:! @ w:@ alias: w:alias: cb w:cb deprecate w:deprecate +Builtin exec w:exec exec? w:exec? ffifail w:ffifail find w:find forget w:forget is w:is undo w:undo +Builtin >s xml:>s >txt xml:>txt parse xml:parse parse-html xml:parse-html parse-stream xml:parse-stream +Builtin getmsg[] zmq:getmsg[] sendmsg[] zmq:sendmsg[] +" numbers +syn keyword eighthMath decimal hex base@ base! +syn match eighthInteger '\<-\=[0-9.]*[0-9.]\+\>' +" recognize hex and binary numbers, the '$' and '%' notation is for eighth +syn match eighthInteger '\<\$\x*\x\+\>' " *1* --- dont't mess +syn match eighthInteger '\<\x*\d\x*\>' " *2* --- this order! +syn match eighthInteger '\<%[0-1]*[0-1]\+\>' +syn match eighthInteger "\<'.\>" + +" Strings +syn region eighthString start=+\.\?\"+ skip=+"+ end=+$+ +syn keyword jsonNull null +syn keyword jsonBool /\(true\|false\)/ + syn region eighthString start=/\<"/ end=/"\>/ +syn match jsonObjEntry /"\"[^"]\+\"\ze\s*:/ + +"syn region jsonObject start=/{/ end=/}/ contained contains=jsonObjEntry,jsonArray,jsonObject, jsonBool, eighthString +"syn region jsonArray start=/\[/ end=/\]/ contained contains=jsonArray,jsonObject, jsonBool, eighthString + +" Include files +" syn match eighthInclude '\<\(libinclude\|include\|needs\)\s\+\S\+' +syn region eighthComment start="\zs\\" end="$" contains=eighthTodo + +" Define the default highlighting. +if !exists("did_eighth_syntax_inits") + let did_eighth_syntax_inits=1 + " The default methods for highlighting. Can be overriden later. + hi def link eighthTodo Todo + hi def link eighthOperators Operator + hi def link eighthMath Number + hi def link eighthInteger Number + hi def link eighthStack Special + hi def link eighthFStack Special + hi def link eighthSP Special + hi def link eighthColonDef Define + hi def link eighthColonName Operator + hi def link eighthEndOfColonDef Define + hi def link eighthDefine Define + hi def link eighthDebug Debug + hi def link eighthCharOps Character + hi def link eighthConversion String + hi def link eighthForth Statement + hi def link eighthVocs Statement + hi def link eighthString String + hi def link eighthComment Comment + hi def link eighthClassDef Define + hi def link eighthEndOfClassDef Define + hi def link eighthObjectDef Define + hi def link eighthEndOfObjectDef Define + hi def link eighthInclude Include + hi def link eighthBuiltin Define + hi def link eighthClasses Define + hi def link eighthClassWord Keyword + + hi def link jsonObject Delimiter + hi def link jsonObjEntry Label + hi def link jsonArray Special + hi def link jsonNull Function + hi def link jsonBool Boolean +endif + +let b:current_syntax = "8th" +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: ts=8:sw=4:nocindent:smartindent: diff --git a/runtime/syntax/abap.vim b/runtime/syntax/abap.vim index c2857a5f30..4650109fb1 100644 --- a/runtime/syntax/abap.vim +++ b/runtime/syntax/abap.vim @@ -1,11 +1,10 @@ " Vim ABAP syntax file " Language: SAP - ABAP/R4 -" Revision: 2.1 " Maintainer: Marius Piedallu van Wyk <lailoken@gmail.com> -" Last Change: 2013 Jun 13 +" Last Change: 2018 Dec 12 " Comment: Thanks to EPI-USE Labs for all your assistance. :) -" quit when a syntax file was already loaded +" Quit when a syntax file was already loaded if exists("b:current_syntax") finish endif @@ -55,6 +54,7 @@ syn match abapComplexStatement "\<RESPECTING\W\+BLANKS\>" syn match abapComplexStatement "\<SEPARATED\W\+BY\>" syn match abapComplexStatement "\<USING\(\W\+EDIT\W\+MASK\)\?\>" syn match abapComplexStatement "\<WHERE\(\W\+LINE\)\?\>" +syn match abapComplexStatement "\<GET\W\+\(TIME\(\W\+STAMP\)\?\(\W\+FIELD\)\?\|PF-STATUS\|BADI\|BIT\|CONNECTION\|CURSOR\|REFERENCE\W\+OF\)\>" syn match abapComplexStatement "\<RADIOBUTTON\W\+GROUP\>" syn match abapComplexStatement "\<REF\W\+TO\>" syn match abapComplexStatement "\<\(PUBLIC\|PRIVATE\|PROTECTED\)\(\W\+SECTION\)\?\>" @@ -109,7 +109,7 @@ syn keyword abapStatement CALL CASE CATCH CHECK CLASS CLEAR CLOSE CNT COLLECT CO syn keyword abapStatement DATA DEFINE DEFINITION DEFERRED DELETE DESCRIBE DETAIL DIVIDE DO syn keyword abapStatement ELSE ELSEIF ENDAT ENDCASE ENDCLASS ENDDO ENDEXEC ENDFORM ENDFUNCTION ENDIF ENDIFEND ENDINTERFACE ENDLOOP ENDMETHOD ENDMODULE ENDON ENDPROVIDE ENDSELECT ENDTRY ENDWHILE EVENT EVENTS EXEC EXIT EXPORT EXPORTING EXTRACT syn keyword abapStatement FETCH FIELDS FORM FORMAT FREE FROM FUNCTION -syn keyword abapStatement GENERATE GET +syn keyword abapStatement GENERATE syn keyword abapStatement HIDE syn keyword abapStatement IF IMPORT IMPORTING INDEX INFOTYPES INITIALIZATION INTERFACE INTERFACES INPUT INSERT IMPLEMENTATION syn keyword abapStatement LEAVE LIKE LINE LOAD LOCAL LOOP @@ -147,7 +147,7 @@ syn keyword abapSpecial TRUE FALSE NULL SPACE syn region abapInclude start="include" end="." contains=abapComment " Types -syn keyword abapTypes c n i p f d t x string xstring decfloat16 decfloat34 +syn keyword abapTypes c n i int8 p f d t x string xstring decfloat16 decfloat34 " Atritmitic operators syn keyword abapOperator abs sign ceil floor trunc frac acos asin atan cos sin tan @@ -193,5 +193,4 @@ hi def link abapHex Number let b:current_syntax = "abap" -" vim: ts=8 sw=2 - +" vim: ts=8 sw=2
\ No newline at end of file diff --git a/runtime/syntax/apache.vim b/runtime/syntax/apache.vim index e2315db0d7..71babfba36 100644 --- a/runtime/syntax/apache.vim +++ b/runtime/syntax/apache.vim @@ -3,7 +3,7 @@ " Maintainer: David Necas (Yeti) <yeti@physics.muni.cz> " License: This file can be redistribued and/or modified under the same terms " as Vim itself. -" Last Change: 2014-03-04 +" Last Change: 2018-12-06 " Notes: Last synced with apache-2.2.3, version 1.x is no longer supported " TODO: see particular FIXME's scattered through the file " make it really linewise? @@ -159,7 +159,7 @@ syn keyword apacheOption inherit syn keyword apacheDeclaration BrowserMatch BrowserMatchNoCase SetEnvIf SetEnvIfNoCase syn keyword apacheDeclaration LoadFile LoadModule syn keyword apacheDeclaration CheckSpelling CheckCaseOnly -syn keyword apacheDeclaration SSLCACertificateFile SSLCACertificatePath SSLCADNRequestFile SSLCADNRequestPath SSLCARevocationFile SSLCARevocationPath SSLCertificateChainFile SSLCertificateFile SSLCertificateKeyFile SSLCipherSuite SSLCryptoDevice SSLEngine SSLHonorCipherOrder SSLMutex SSLOptions SSLPassPhraseDialog SSLProtocol SSLProxyCACertificateFile SSLProxyCACertificatePath SSLProxyCARevocationFile SSLProxyCARevocationPath SSLProxyCipherSuite SSLProxyEngine SSLProxyMachineCertificateFile SSLProxyMachineCertificatePath SSLProxyProtocol SSLProxyVerify SSLProxyVerifyDepth SSLRandomSeed SSLRequire SSLRequireSSL SSLSessionCache SSLSessionCacheTimeout SSLUserName SSLVerifyClient SSLVerifyDepth +syn keyword apacheDeclaration SSLCACertificateFile SSLCACertificatePath SSLCADNRequestFile SSLCADNRequestPath SSLCARevocationFile SSLCARevocationPath SSLCertificateChainFile SSLCertificateFile SSLCertificateKeyFile SSLCipherSuite SSLCompression SSLCryptoDevice SSLEngine SSLFIPS SSLHonorCipherOrder SSLInsecureRenegotiation SSLMutex SSLOptions SSLPassPhraseDialog SSLProtocol SSLProxyCACertificateFile SSLProxyCACertificatePath SSLProxyCARevocationFile SSLProxyCARevocationPath SSLProxyCheckPeerCN SSLProxyCheckPeerExpire SSLProxyCipherSuite SSLProxyEngine SSLProxyMachineCertificateChainFile SSLProxyMachineCertificateFile SSLProxyMachineCertificatePath SSLProxyProtocol SSLProxyVerify SSLProxyVerifyDepth SSLRandomSeed SSLRenegBufferSize SSLRequire SSLRequireSSL SSLSessionCache SSLSessionCacheTimeout SSLSessionTicketKeyFile SSLSessionTickets SSLStrictSNIVHostCheck SSLUserName SSLVerifyClient SSLVerifyDepth syn match apacheOption "[+-]\?\<\(StdEnvVars\|CompatEnvVars\|ExportCertData\|FakeBasicAuth\|StrictRequire\|OptRenegotiate\)\>" syn keyword apacheOption builtin sem syn match apacheOption "\(file\|exec\|egd\|dbm\|shm\):" diff --git a/runtime/syntax/automake.vim b/runtime/syntax/automake.vim index 2a215a9e04..8a7db7c27b 100644 --- a/runtime/syntax/automake.vim +++ b/runtime/syntax/automake.vim @@ -1,9 +1,9 @@ " Vim syntax file -" Language: automake Makefile.am -" Maintainer: Debian VIM Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> -" Former Maintainer: John Williams <jrw@pobox.com> -" Last Change: 2011-06-13 -" URL: http://anonscm.debian.org/hg/pkg-vim/vim/raw-file/unstable/runtime/syntax/automake.vim +" Language: automake Makefile.am +" Maintainer: Debian Vim Maintainers +" Former Maintainer: John Williams <jrw@pobox.com> +" Last Change: 2018 Dec 27 +" URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/automake.vim " " XXX This file is in need of a new maintainer, Debian VIM Maintainers maintain " it only because patches have been submitted for it by Debian users and the @@ -18,7 +18,7 @@ " EXTRA_SOURCES. " Standard syntax initialization -if exists("b:current_syntax") +if exists('b:current_syntax') finish endif @@ -37,8 +37,8 @@ syn match automakeConditional "^\(if\s*!\=\w\+\|else\|endif\)\s*$" syn match automakeSubst "@\w\+@" syn match automakeSubst "^\s*@\w\+@" -syn match automakeComment1 "#.*$" contains=automakeSubst -syn match automakeComment2 "##.*$" +syn match automakeComment1 "#.*$" contains=automakeSubst,@Spell +syn match automakeComment2 "##.*$" contains=@Spell syn match automakeMakeError "$[{(][^})]*[^a-zA-Z0-9_})][^})]*[})]" " GNU make function call syn match automakeMakeError "^AM_LDADD\s*\ze+\==" " Common mistake @@ -72,6 +72,6 @@ hi def link automakeMakeSString makeSString hi def link automakeMakeBString makeBString -let b:current_syntax = "automake" +let b:current_syntax = 'automake' " vi: ts=8 sw=4 sts=4 diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim index 95d3455dde..2a14ae0c46 100644 --- a/runtime/syntax/c.vim +++ b/runtime/syntax/c.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: C " Maintainer: Bram Moolenaar <Bram@vim.org> -" Last Change: 2018 Sep 21 +" Last Change: 2019 Apr 23 " Quit when a (custom) syntax file was already loaded if exists("b:current_syntax") @@ -289,6 +289,22 @@ if !exists("c_no_c11") syn keyword cOperator _Static_assert static_assert syn keyword cStorageClass _Thread_local thread_local syn keyword cType char16_t char32_t + " C11 atomics (take down the shield wall!) + syn keyword cType atomic_bool atomic_char atomic_schar atomic_uchar + syn keyword Ctype atomic_short atomic_ushort atomic_int atomic_uint + syn keyword cType atomic_long atomic_ulong atomic_llong atomic_ullong + syn keyword cType atomic_char16_t atomic_char32_t atomic_wchar_t + syn keyword cType atomic_int_least8_t atomic_uint_least8_t + syn keyword cType atomic_int_least16_t atomic_uint_least16_t + syn keyword cType atomic_int_least32_t atomic_uint_least32_t + syn keyword cType atomic_int_least64_t atomic_uint_least64_t + syn keyword cType atomic_int_fast8_t atomic_uint_fast8_t + syn keyword cType atomic_int_fast16_t atomic_uint_fast16_t + syn keyword cType atomic_int_fast32_t atomic_uint_fast32_t + syn keyword cType atomic_int_fast64_t atomic_uint_fast64_t + syn keyword cType atomic_intptr_t atomic_uintptr_t + syn keyword cType atomic_size_t atomic_ptrdiff_t + syn keyword cType atomic_intmax_t atomic_uintmax_t endif if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu") @@ -342,7 +358,7 @@ if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu") syn keyword cConstant EINPROGRESS EINTR EINVAL EIO EISCONN EISDIR ELOOP EMFILE EMLINK EMSGSIZE syn keyword cConstant EMULTIHOP ENAMETOOLONG ENETDOWN ENETRESET ENETUNREACH ENFILE ENOBUFS ENODATA syn keyword cConstant ENODEV ENOENT ENOEXEC ENOLCK ENOLINK ENOMEM ENOMSG ENOPROTOOPT ENOSPC ENOSR - syn keyword cConstant ENOSTR ENOSYS ENOTCONN ENOTDIR ENOTEMPTY ENOTRECOVERABLE ENOTSOCK ENOTSUP + syn keyword cConstant ENOSTR ENOSYS ENOTBLK ENOTCONN ENOTDIR ENOTEMPTY ENOTRECOVERABLE ENOTSOCK ENOTSUP syn keyword cConstant ENOTTY ENXIO EOPNOTSUPP EOVERFLOW EOWNERDEAD EPERM EPIPE EPROTO syn keyword cConstant EPROTONOSUPPORT EPROTOTYPE ERANGE EROFS ESPIPE ESRCH ESTALE ETIME ETIMEDOUT syn keyword cConstant ETXTBSY EWOULDBLOCK EXDEV diff --git a/runtime/syntax/cobol.vim b/runtime/syntax/cobol.vim index 2d481bba0b..5d649441a3 100644 --- a/runtime/syntax/cobol.vim +++ b/runtime/syntax/cobol.vim @@ -1,10 +1,23 @@ " Vim syntax file " Language: COBOL -" Maintainer: Tim Pope <vimNOSPAM@tpope.org> +" Maintainer: Ankit Jain <ajatkj@yahoo.co.in> +" (formerly Tim Pope <vimNOSPAM@tpope.info>) " (formerly Davyd Ondrejko <vondraco@columbus.rr.com>) " (formerly Sitaram Chamarty <sitaram@diac.com> and " James Mitchell <james_mitchell@acm.org>) -" Last Change: 2015 Feb 13 +" Last Change: 2019 Mar 22 +" Ankit Jain 22.03.2019 Changes & fixes: +" 1. Include inline comments +" 2. Use comment highlight for bad lines +" 3. Change certain 'keywords' to 'matches' +" for additional highlighting +" 4. Different highlighting for COPY, GO TO & +" CALL lines +" 5. Fix for COMP keyword +" 6. Fix for PROCEDURE DIVISION highlighting +" 7. Highlight EXIT PROGRAM like STOP RUN +" 8. Highlight X & A in PIC clause +" Tag: #C22032019 " quit when a syntax file was already loaded if exists("b:current_syntax") @@ -12,7 +25,11 @@ if exists("b:current_syntax") endif " MOST important - else most of the keywords wont work! -setlocal isk=@,48-57,- +setlocal isk=@,48-57,-,_ + +if !exists('g:cobol_inline_comment') + let g:cobol_inline_comment=0 +endif syn case ignore @@ -29,7 +46,10 @@ syn match cobolComment "[/*C].*$" contained syn match cobolCompiler "$.*$" contained syn match cobolLine ".*$" contained contains=cobolReserved,@cobolLine -syn match cobolDivision "[A-Z][A-Z0-9-]*[A-Z0-9]\s\+DIVISION\."he=e-1 contained contains=cobolDivisionName +"#C22032019: Fix for PROCEDURE DIVISION USING highlighting, removed . from the +"end of the regex +"syn match cobolDivision \"[A-Z][A-Z0-9-]*[A-Z0-9]\s\+DIVISION\."he=e-1 contained contains=cobolDivisionName +syn match cobolDivision "[A-Z][A-Z0-9-]*[A-Z0-9]\s\+DIVISION" contained contains=cobolDivisionName syn keyword cobolDivisionName contained IDENTIFICATION ENVIRONMENT DATA PROCEDURE syn match cobolSection "[A-Z][A-Z0-9-]*[A-Z0-9]\s\+SECTION\."he=e-1 contained contains=cobolSectionName syn keyword cobolSectionName contained CONFIGURATION INPUT-OUTPUT FILE WORKING-STORAGE LOCAL-STORAGE LINKAGE @@ -38,10 +58,12 @@ syn keyword cobolParagraphName contained PROGRAM-ID SOURCE-COMPUTER OBJECT-COMP "syn match cobolKeys "^\a\{1,6\}" contains=cobolReserved +"#C22032019: Remove BY, REPLACING, PROGRAM, TO, IN from 'keyword' group and add +"to 'match' group or other 'keyword' group syn keyword cobolReserved contained ACCEPT ACCESS ADD ADDRESS ADVANCING AFTER ALPHABET ALPHABETIC syn keyword cobolReserved contained ALPHABETIC-LOWER ALPHABETIC-UPPER ALPHANUMERIC ALPHANUMERIC-EDITED ALS syn keyword cobolReserved contained ALTERNATE AND ANY ARE AREA AREAS ASCENDING ASSIGN AT AUTHOR BEFORE BINARY -syn keyword cobolReserved contained BLANK BLOCK BOTTOM BY CANCEL CBLL CD CF CH CHARACTER CHARACTERS CLASS +syn keyword cobolReserved contained BLANK BLOCK BOTTOM CANCEL CBLL CD CF CH CHARACTER CHARACTERS CLASS syn keyword cobolReserved contained CLOCK-UNITS CLOSE COBOL CODE CODE-SET COLLATING COLUMN COMMA COMMON syn keyword cobolReserved contained COMMUNICATIONS COMPUTATIONAL COMPUTE CONTENT CONTINUE syn keyword cobolReserved contained CONTROL CONVERTING CORR CORRESPONDING COUNT CURRENCY DATE DATE-COMPILED @@ -55,52 +77,79 @@ syn keyword cobolReserved contained END-REWRITE END-SEARCH END-START END-STRING syn keyword cobolReserved contained END-WRITE EQUAL ERROR ESI EVALUATE EVERY EXCEPTION EXIT syn keyword cobolReserved contained EXTEND EXTERNAL FALSE FD FILLER FINAL FIRST FOOTING FOR FROM syn keyword cobolReserved contained GENERATE GIVING GLOBAL GREATER GROUP HEADING HIGH-VALUE HIGH-VALUES I-O -syn keyword cobolReserved contained IN INDEX INDEXED INDICATE INITIAL INITIALIZE +syn keyword cobolReserved contained INDEX INDEXED INDICATE INITIAL INITIALIZE syn keyword cobolReserved contained INITIATE INPUT INSPECT INSTALLATION INTO IS JUST syn keyword cobolReserved contained JUSTIFIED KEY LABEL LAST LEADING LEFT LENGTH LOCK MEMORY syn keyword cobolReserved contained MERGE MESSAGE MODE MODULES MOVE MULTIPLE MULTIPLY NATIVE NEGATIVE NEXT NO NOT syn keyword cobolReserved contained NUMBER NUMERIC NUMERIC-EDITED OCCURS OF OFF OMITTED ON OPEN syn keyword cobolReserved contained OPTIONAL OR ORDER ORGANIZATION OTHER OUTPUT OVERFLOW PACKED-DECIMAL PADDING syn keyword cobolReserved contained PAGE PAGE-COUNTER PERFORM PF PH PIC PICTURE PLUS POINTER POSITION POSITIVE -syn keyword cobolReserved contained PRINTING PROCEDURES PROCEDD PROGRAM PURGE QUEUE QUOTES +syn keyword cobolReserved contained PRINTING PROCEDURES PROCEDD PURGE QUEUE QUOTES syn keyword cobolReserved contained RANDOM RD READ RECEIVE RECORD RECORDS REDEFINES REEL REFERENCE REFERENCES -syn keyword cobolReserved contained RELATIVE RELEASE REMAINDER REMOVAL REPLACE REPLACING REPORT REPORTING +syn keyword cobolReserved contained RELATIVE RELEASE REMAINDER REMOVAL REPLACE REPORT REPORTING syn keyword cobolReserved contained REPORTS RERUN RESERVE RESET RETURN RETURNING REVERSED REWIND REWRITE RF RH syn keyword cobolReserved contained RIGHT ROUNDED RUN SAME SD SEARCH SECTION SECURITY SEGMENT SEGMENT-LIMITED syn keyword cobolReserved contained SELECT SEND SENTENCE SEPARATE SEQUENCE SEQUENTIAL SET SIGN SIZE SORT syn keyword cobolReserved contained SORT-MERGE SOURCE STANDARD syn keyword cobolReserved contained STANDARD-1 STANDARD-2 START STATUS STOP STRING SUB-QUEUE-1 SUB-QUEUE-2 syn keyword cobolReserved contained SUB-QUEUE-3 SUBTRACT SUM SUPPRESS SYMBOLIC SYNC SYNCHRONIZED TABLE TALLYING -syn keyword cobolReserved contained TAPE TERMINAL TERMINATE TEST TEXT THAN THEN THROUGH THRU TIME TIMES TO TOP +syn keyword cobolReserved contained TAPE TERMINAL TERMINATE TEST TEXT THAN THEN THROUGH THRU TIME TIMES TOP syn keyword cobolReserved contained TRAILING TRUE TYPE UNIT UNSTRING UNTIL UP UPON USAGE USE USING VALUE VALUES syn keyword cobolReserved contained VARYING WHEN WITH WORDS WRITE syn match cobolReserved contained "\<CONTAINS\>" syn match cobolReserved contained "\<\(IF\|INVALID\|END\|EOP\)\>" syn match cobolReserved contained "\<ALL\>" +" #C22032019: Add BY as match instead of keyword: BY not followed by == +syn match cobolReserved contained "\<BY\>\s\+\(==\)\@!" +syn match cobolReserved contained "\<TO\>" syn cluster cobolLine add=cobolConstant,cobolNumber,cobolPic syn keyword cobolConstant SPACE SPACES NULL ZERO ZEROES ZEROS LOW-VALUE LOW-VALUES +" #C22032019: Fix for many pic clauses syn match cobolNumber "\<-\=\d*\.\=\d\+\>" contained -syn match cobolPic "\<S*9\+\>" contained +" syn match cobolPic \"\<S*9\+\>" contained +syn match cobolPic "\<S*9\+V*9*\>" contained syn match cobolPic "\<$*\.\=9\+\>" contained syn match cobolPic "\<Z*\.\=9\+\>" contained syn match cobolPic "\<V9\+\>" contained syn match cobolPic "\<9\+V\>" contained -syn match cobolPic "\<-\+[Z9]\+\>" contained -syn match cobolTodo "todo" contained containedin=cobolComment +" syn match cobolPic \"\<-\+[Z9]\+\>" contained +syn match cobolPic "\<-*[Z9]\+-*\>" contained +" #C22032019: Add Z,X and A to cobolPic +syn match cobolPic "\<[ZXA]\+\>" contained +syn match cobolTodo "todo" contained containedin=cobolInlineComment,cobolComment " For MicroFocus or other inline comments, include this line. -" syn region cobolComment start="*>" end="$" contains=cobolTodo,cobolMarker +if g:cobol_inline_comment == 1 + syn region cobolInlineComment start="*>" end="$" contains=cobolTodo,cobolMarker + syn cluster cobolLine add=cobolInlineComment +endif syn match cobolBadLine "[^ D\*$/-].*" contained + " If comment mark somehow gets into column past Column 7. -syn match cobolBadLine "\s\+\*.*" contained +if g:cobol_inline_comment == 1 + " #C22032019: It is a bad line only if * is not followed by > when inline + " comments enabled + syn match cobolBadLine "\s\+\*\(>\)\@!.*" contained +else + syn match cobolBadLine "\s\+\*.*" contained +endif syn cluster cobolStart add=cobolBadLine - -syn keyword cobolGoTo GO GOTO -syn keyword cobolCopy COPY +" #C22032019: Different highlighting for GO TO statements +" syn keyword cobolGoTo GO GOTO +syn keyword cobolGoTo GOTO +syn match cobolGoTo /\<GO\>\s\+\<TO\>/ +syn match cobolGoToPara /\<GO\>\s\+\<TO\>\s\+[A-Z0-9-]\+/ contains=cobolGoTo +" #C22032019: Highlight copybook name and location in using different group +" syn keyword cobolCopy COPY +syn match cobolCopy "\<COPY\>\|\<IN\>" +syn match cobolCopy "\<REPLACING\>\s\+\(==\)\@=" +syn match cobolCopy "\<BY\>\s\+\(==\)\@=" +syn match cobolCopyName "\<COPY\>\s\+[A-Z0-9]\+\(\s\+\<IN\>\s\+[A-Z0-9]\+\)\?" contains=cobolCopy +syn cluster cobolLine add=cobolGoToPara,cobolCopyName " cobolBAD: things that are BAD NEWS! syn keyword cobolBAD ALTER ENTER RENAMES @@ -109,8 +158,14 @@ syn cluster cobolLine add=cobolGoTo,cobolCopy,cobolBAD,cobolWatch,cobolEXE " cobolWatch: things that are important when trying to understand a program syn keyword cobolWatch OCCURS DEPENDING VARYING BINARY COMP REDEFINES -syn keyword cobolWatch REPLACING RUN -syn match cobolWatch "COMP-[123456XN]" +" #C22032019: Remove REPLACING from cobolWatch 'keyword' group and add to cobolCopy & +" cobolWatch 'match' group +" syn keyword cobolWatch REPLACING RUN +syn keyword cobolWatch RUN PROGRAM +syn match cobolWatch contained "\<REPLACING\>\s\+\(==\)\@!" +" #C22032019: Look for word starting with COMP +" syn match cobolWatch \"COMP-[123456XN]" +syn match cobolWatch "\<COMP-[123456XN]" syn keyword cobolEXECs EXEC END-EXEC @@ -127,9 +182,15 @@ syn match cobolWatch "88 " contained nextgroup=cobolLine "syn match cobolBadID "\k\+-\($\|[^-A-Z0-9]\)" contained syn cluster cobolLine add=cobolCALLs,cobolString,cobolCondFlow -syn keyword cobolCALLs CALL END-CALL CANCEL GOBACK PERFORM END-PERFORM INVOKE -syn match cobolCALLs "EXIT \+PROGRAM" +" #C22032019: Changes for cobolCALLs group to include thru +" syn keyword cobolCALLs CALL END-CALL CANCEL GOBACK PERFORM END-PERFORM INVOKE +syn keyword cobolCALLs END-CALL CANCEL GOBACK PERFORM END-PERFORM INVOKE THRU +" #C22032019: Highlight called program +" syn match cobolCALLs \"EXIT \+PROGRAM" +syn match cobolCALLs "\<CALL\>" +syn match cobolCALLProg /\<CALL\>\s\+"\{0,1\}[A-Z0-9]\+"\{0,1\}/ contains=cobolCALLs syn match cobolExtras /\<VALUE \+\d\+\./hs=s+6,he=e-1 +syn cluster cobolLine add=cobolCALLProg syn match cobolString /"[^"]*\("\|$\)/ syn match cobolString /'[^']*\('\|$\)/ @@ -138,7 +199,7 @@ syn match cobolString /'[^']*\('\|$\)/ syn match cobolIndicator "\%7c[D-]" contained if exists("cobol_legacy_code") - syn region cobolCondFlow contains=ALLBUT,cobolLine,cobolBadLine start="\<\(IF\|INVALID\|END\|EOP\)\>" skip=/\('\|"\)[^"]\{-}\("\|'\|$\)/ end="\." keepend + syn region cobolCondFlow contains=ALLBUT,cobolLine start="\<\(IF\|INVALID\|END\|EOP\)\>" skip=/\('\|"\)[^"]\{-}\("\|'\|$\)/ end="\." keepend endif " many legacy sources have junk in columns 1-6: must be before others @@ -146,7 +207,9 @@ endif if exists("cobol_legacy_code") syn match cobolBadLine "\%73c.*" containedin=ALLBUT,cobolComment else - syn match cobolBadLine "\%73c.*" containedin=ALL + " #C22032019: Use comment highlighting for bad lines + " syn match cobolBadLine \"\%73c.*" containedin=ALL + syn match cobolBadLine "\%73c.*" containedin=ALL,cobolInlineComment,cobolComment endif " Define the default highlighting. @@ -160,31 +223,36 @@ if exists("g:cobol_legacy_code") else hi def link cobolMarker Error endif -hi def link cobolCALLs Function -hi def link cobolComment Comment -hi def link cobolKeys Comment -hi def link cobolAreaB Special -hi def link cobolCompiler PreProc -hi def link cobolCondFlow Special -hi def link cobolCopy PreProc -hi def link cobolDeclA cobolDecl -hi def link cobolDecl Type -hi def link cobolExtras Special -hi def link cobolGoTo Special -hi def link cobolConstant Constant -hi def link cobolNumber Constant -hi def link cobolPic Constant -hi def link cobolReserved Statement -hi def link cobolDivision Label -hi def link cobolSection Label -hi def link cobolParagraph Label -hi def link cobolDivisionName Keyword -hi def link cobolSectionName Keyword -hi def link cobolParagraphName Keyword -hi def link cobolString Constant -hi def link cobolTodo Todo -hi def link cobolWatch Special -hi def link cobolIndicator Special +hi def link cobolCALLs Function +hi def link cobolCALLProg Special +hi def link cobolComment Comment +hi def link cobolInlineComment Comment +hi def link cobolKeys Comment +hi def link cobolAreaB Special +hi def link cobolCompiler PreProc +hi def link cobolCondFlow Special +hi def link cobolCopy PreProc +hi def link cobolCopyName Special +hi def link cobolDeclA cobolDecl +hi def link cobolDecl Type +hi def link cobolExtras Special +hi def link cobolGoTo Special +hi def link cobolGoToPara Function +hi def link cobolConstant Constant +hi def link cobolNumber Constant +hi def link cobolPic Constant +hi def link cobolReserved Statement +hi def link cobolDivision Label +hi def link cobolSection Label +hi def link cobolParagraph Label +hi def link cobolDivisionName Keyword +hi def link cobolSectionName Keyword +hi def link cobolParagraphName Keyword +hi def link cobolString Constant +hi def link cobolTodo Todo +hi def link cobolWatch Special +hi def link cobolIndicator Special +hi def link cobolStart Comment let b:current_syntax = "cobol" diff --git a/runtime/syntax/cs.vim b/runtime/syntax/cs.vim index 116afe0b72..1652cb63c3 100644 --- a/runtime/syntax/cs.vim +++ b/runtime/syntax/cs.vim @@ -3,7 +3,7 @@ " Maintainer: Nick Jensen <nickspoon@gmail.com> " Former Maintainers: Anduin Withers <awithers@anduin.com> " Johannes Zellner <johannes@zellner.org> -" Last Change: 2018-06-29 +" Last Change: 2018-11-26 " Filenames: *.cs " License: Vim (see :h license) " Repository: https://github.com/nickspoons/vim-cs @@ -11,12 +11,12 @@ " REFERENCES: " [1] ECMA TC39: C# Language Specification (WD13Oct01.doc) -if exists("b:current_syntax") - finish +if exists('b:current_syntax') + finish endif -let s:cs_cpo_save = &cpo -set cpo&vim +let s:save_cpo = &cpoptions +set cpoptions&vim syn keyword csType bool byte char decimal double float int long object sbyte short string T uint ulong ushort var void dynamic @@ -34,7 +34,7 @@ syn keyword csException try catch finally throw when syn keyword csLinq ascending by descending equals from group in into join let on orderby select where syn keyword csAsync async await -syn keyword csUnspecifiedStatement as base checked event fixed in is lock nameof operator out params ref sizeof stackalloc this typeof unchecked unsafe using +syn keyword csUnspecifiedStatement as base checked event fixed in is lock nameof operator out params ref sizeof stackalloc this unchecked unsafe using syn keyword csUnsupportedStatement add remove value syn keyword csUnspecifiedKeyword explicit implicit @@ -44,10 +44,16 @@ syn match csContextualStatement /\<partial[[:space:]\n]\+\(class\|struct\|interf syn match csContextualStatement /\<\(get\|set\)\(;\|[[:space:]\n]*{\)/me=s+3 syn match csContextualStatement /\<where\>[^:]\+:/me=s+5 +" Operators +syn keyword csTypeOf typeof contained +syn region csTypeOfStatement start="typeof(" end=")" contains=csType, csTypeOf + " Punctuation syn match csBraces "[{}\[\]]" display syn match csParens "[()]" display -syn match csOpSymbols "[+\-><=]\{1,2}" display +syn match csOpSymbols "[+\-=]\{1,2}" display +syn match csOpSymbols "[><]\{2}" display +syn match csOpSymbols "\s\zs[><]\ze\_s" display syn match csOpSymbols "[!><+\-*/]=" display syn match csOpSymbols "[!*/^]" display syn match csOpSymbols "=>" display @@ -144,17 +150,18 @@ syn cluster csAll contains=csCharacter,csClassType,csComment,csContextualStateme " The default highlighting. hi def link csType Type -hi def link csNewType Type hi def link csClassType Type hi def link csIsType Type -hi def link csStorage StorageClass -hi def link csClass StorageClass +hi def link csStorage Structure +hi def link csClass Structure hi def link csRepeat Repeat hi def link csConditional Conditional hi def link csLabel Label hi def link csModifier StorageClass hi def link csConstant Constant hi def link csException Exception +hi def link csTypeOf Operator +hi def link csTypeOfStatement Typedef hi def link csUnspecifiedStatement Statement hi def link csUnsupportedStatement Statement hi def link csUnspecifiedKeyword Keyword @@ -164,16 +171,12 @@ hi def link csIsAs Keyword hi def link csAsync Keyword hi def link csContextualStatement Statement hi def link csOperatorError Error -hi def link csInterfaceDeclaration Include hi def link csTodo Todo hi def link csComment Comment -hi def link csEndColon Statement hi def link csOpSymbols Operator -hi def link csLogicSymbols Boolean -hi def link csBraces Function -hi def link csParens Operator +hi def link csLogicSymbols Operator hi def link csSpecialError Error hi def link csSpecialCharError Error @@ -200,9 +203,9 @@ hi def link csXmlCommentLeader Comment hi def link csXmlComment Comment hi def link csXmlTag Statement -let b:current_syntax = "cs" +let b:current_syntax = 'cs' -let &cpo = s:cs_cpo_save -unlet s:cs_cpo_save +let &cpoptions = s:save_cpo +unlet s:save_cpo " vim: vts=16,28 diff --git a/runtime/syntax/dcl.vim b/runtime/syntax/dcl.vim index b973db3434..c0d0ebcf95 100644 --- a/runtime/syntax/dcl.vim +++ b/runtime/syntax/dcl.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: DCL (Digital Command Language - vms) " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Aug 31, 2016 -" Version: 11 +" Last Change: Mar 26, 2019 +" Version: 12 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_DCL " quit when a syntax file was already loaded @@ -10,10 +10,10 @@ if exists("b:current_syntax") finish endif -if !has("patch-7.4.1142") - setlocal iskeyword=$,@,48-57,_ -else +if (v:version == 704 && has("patch-7.4.1142")) || v:version > 704 syn iskeyword $,@,48-57,_ +else + setlocal iskeyword=$,@,48-57,_ endif syn case ignore diff --git a/runtime/syntax/debchangelog.vim b/runtime/syntax/debchangelog.vim index edaaf6128f..9d6dfe96a5 100644 --- a/runtime/syntax/debchangelog.vim +++ b/runtime/syntax/debchangelog.vim @@ -3,7 +3,7 @@ " Maintainer: Debian Vim Maintainers " Former Maintainers: Gerfried Fuchs <alfie@ist.org> " Wichert Akkerman <wakkerma@debian.org> -" Last Change: 2018 May 03 +" Last Change: 2019 Apr 21 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debchangelog.vim " Standard syntax initialization @@ -14,14 +14,14 @@ endif " Case doesn't matter for us syn case ignore -let s:urgency='urgency=\(low\|medium\|high\|critical\)\( [^[:space:],][^,]*\)\=' +let s:urgency='urgency=\(low\|medium\|high\|emergency\|critical\)\( [^[:space:],][^,]*\)\=' let s:binNMU='binary-only=yes' " Define some common expressions we can use later on syn match debchangelogName contained "^[[:alnum:]][[:alnum:].+-]\+ " exe 'syn match debchangelogFirstKV contained "; \('.s:urgency.'\|'.s:binNMU.'\)"' exe 'syn match debchangelogOtherKV contained ", \('.s:urgency.'\|'.s:binNMU.'\)"' -syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|squeeze-%(backports%(-sloppy)=|volatile|lts|security)|%(wheezy|jessie)%(-backports%(-sloppy)=|-security)=|stretch%(-backports|-security)=|%(devel|precise|trusty|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic)%(-%(security|proposed|updates|backports|commercial|partner))=)+" +syn match debchangelogTarget contained "\v %(frozen|unstable|sid|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|%(squeeze|wheezy|jessie)-%(backports%(-sloppy)=|lts|security)|stretch%(-backports%(-sloppy)=|-security)=|buster%(-backports|-security)=|bullseye|%(devel|precise|trusty|vivid|wily|xenial|yakkety|zesty|artful|bionic|cosmic|disco|eoan)%(-%(security|proposed|updates|backports|commercial|partner))=)+" syn match debchangelogVersion contained "(.\{-})" syn match debchangelogCloses contained "closes:\_s*\(bug\)\=#\=\_s\=\d\+\(,\_s*\(bug\)\=#\=\_s\=\d\+\)*" syn match debchangelogLP contained "\clp:\s\+#\d\+\(,\s*#\d\+\)*" diff --git a/runtime/syntax/debsources.vim b/runtime/syntax/debsources.vim index 74e8d42d1c..f90476fe25 100644 --- a/runtime/syntax/debsources.vim +++ b/runtime/syntax/debsources.vim @@ -2,7 +2,7 @@ " Language: Debian sources.list " Maintainer: Debian Vim Maintainers " Former Maintainer: Matthijs Mohlmann <matthijs@cacholong.nl> -" Last Change: 2018 Aug 11 +" Last Change: 2019 Apr 21 " URL: https://salsa.debian.org/vim-team/vim-debian/blob/master/syntax/debsources.vim " Standard syntax initialization @@ -23,9 +23,10 @@ let s:cpo = &cpo set cpo-=C let s:supported = [ \ 'oldstable', 'stable', 'testing', 'unstable', 'experimental', - \ 'wheezy', 'jessie', 'stretch', 'sid', 'rc-buggy', + \ 'wheezy', 'jessie', 'stretch', 'buster', 'bullseye', 'bookworm', + \ 'sid', 'rc-buggy', \ - \ 'trusty', 'xenial', 'bionic', 'cosmic', 'devel' + \ 'trusty', 'xenial', 'bionic', 'cosmic', 'disco', 'eoan', 'devel' \ ] let s:unsupported = [ \ 'buzz', 'rex', 'bo', 'hamm', 'slink', 'potato', diff --git a/runtime/syntax/dune.vim b/runtime/syntax/dune.vim new file mode 100644 index 0000000000..f901813d24 --- /dev/null +++ b/runtime/syntax/dune.vim @@ -0,0 +1,46 @@ +" Language: Dune buildsystem +" Maintainer: Markus Mottl <markus.mottl@gmail.com> +" Anton Kochkov <anton.kochkov@gmail.com> +" URL: https://github.com/rgrinberg/vim-ocaml +" Last Change: +" 2019 Feb 27 - Add newer keywords to the syntax (Simon Cruanes) +" 2018 May 8 - Check current_syntax (Kawahara Satoru) +" 2018 Mar 29 - Extend jbuild syntax with more keywords (Petter A. Urkedal) +" 2017 Sep 6 - Initial version (Etienne Millon) + +if exists("b:current_syntax") + finish +endif + +set syntax=lisp +syn case match + +" The syn-iskeyword setting lacks #,? from the iskeyword setting here. +" Clearing it avoids maintaining keyword characters in multiple places. +syn iskeyword clear + +syn keyword lispDecl jbuild_version library executable executables rule ocamllex ocamlyacc menhir alias install + +syn keyword lispKey name public_name synopsis modules libraries wrapped +syn keyword lispKey preprocess preprocessor_deps optional c_names cxx_names +syn keyword lispKey install_c_headers modes no_dynlink self_build_stubs_archive +syn keyword lispKey ppx_runtime_libraries virtual_deps js_of_ocaml link_flags +syn keyword lispKey javascript_files flags ocamlc_flags ocamlopt_flags pps staged_pps +syn keyword lispKey library_flags c_flags c_library_flags kind package action +syn keyword lispKey deps targets locks fallback +syn keyword lispKey inline_tests tests names + +syn keyword lispAtom true false + +syn keyword lispFunc cat chdir copy# diff? echo run setenv +syn keyword lispFunc ignore-stdout ignore-stderr ignore-outputs +syn keyword lispFunc with-stdout-to with-stderr-to with-outputs-to +syn keyword lispFunc write-file system bash + +syn cluster lispBaseListCluster add=duneVar +syn match duneVar '\${[@<^]}' containedin=lispSymbol +syn match duneVar '\${\k\+\(:\k\+\)\?}' containedin=lispSymbol + +hi def link duneVar Identifier + +let b:current_syntax = "dune" diff --git a/runtime/syntax/eruby.vim b/runtime/syntax/eruby.vim index 4e175bcc25..6bb24fe562 100644 --- a/runtime/syntax/eruby.vim +++ b/runtime/syntax/eruby.vim @@ -3,8 +3,9 @@ " Maintainer: Tim Pope <vimNOSPAM@tpope.org> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2018 Jul 04 -if exists("b:current_syntax") +if &syntax !~# '\<eruby\>' || get(b:, 'current_syntax') =~# '\<eruby\>' finish endif @@ -18,11 +19,13 @@ endif if &filetype =~ '^eruby\.' let b:eruby_subtype = matchstr(&filetype,'^eruby\.\zs\w\+') +elseif &filetype =~ '^.*\.eruby\>' + let b:eruby_subtype = matchstr(&filetype,'^.\{-\}\ze\.eruby\>') elseif !exists("b:eruby_subtype") && main_syntax == 'eruby' let s:lines = getline(1)."\n".getline(2)."\n".getline(3)."\n".getline(4)."\n".getline(5)."\n".getline("$") let b:eruby_subtype = matchstr(s:lines,'eruby_subtype=\zs\w\+') if b:eruby_subtype == '' - let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$') + let b:eruby_subtype = matchstr(substitute(expand("%:t"),'\c\%(\.erb\|\.eruby\|\.erubis\|\.example\)\+$','',''),'\.\zs\w\+\%(\ze+\w\+\)\=$') endif if b:eruby_subtype == 'rhtml' let b:eruby_subtype = 'html' @@ -41,16 +44,20 @@ elseif !exists("b:eruby_subtype") && main_syntax == 'eruby' endif if !exists("b:eruby_nest_level") - let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.\%(erb\|rhtml\)\>','@','g'),'[^@]','','g')) + if &syntax =~# '\<eruby\.eruby\>' + let b:eruby_nest_level = strlen(substitute(substitute(&filetype,'\C\<eruby\>','@','g'),'[^@]','','g')) + else + let b:eruby_nest_level = strlen(substitute(substitute(substitute(expand("%:t"),'@','','g'),'\c\.\%(erb\|rhtml\)\>','@','g'),'[^@]','','g')) + endif endif if !b:eruby_nest_level let b:eruby_nest_level = 1 endif -if exists("b:eruby_subtype") && b:eruby_subtype != '' +if get(b:, 'eruby_subtype', '') !~# '^\%(eruby\)\=$' && &syntax =~# '^eruby\>' exe "runtime! syntax/".b:eruby_subtype.".vim" - unlet! b:current_syntax endif +unlet! b:current_syntax syn include @rubyTop syntax/ruby.vim syn cluster erubyRegions contains=erubyOneLiner,erubyBlock,erubyExpression,erubyComment @@ -65,7 +72,7 @@ exe 'syn region erubyComment matchgroup=erubyDelimiter start="<%\{1,'.b:erub hi def link erubyDelimiter PreProc hi def link erubyComment Comment -let b:current_syntax = 'eruby' +let b:current_syntax = matchstr(&syntax, '^.*\<eruby\>') if main_syntax == 'eruby' unlet main_syntax 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/html.vim b/runtime/syntax/html.vim index cde5269d02..d16ee1817f 100644 --- a/runtime/syntax/html.vim +++ b/runtime/syntax/html.vim @@ -3,8 +3,8 @@ " Maintainer: Jorge Maldonado Ventura <jorgesumle@freakspot.net> " Previous Maintainer: Claudio Fleiner <claudio@fleiner.com> " Repository: https://notabug.org/jorgesumle/vim-html-syntax -" Last Change: 2018 May 31 -" Included patch from Jay Sitter to add WAI-ARIA htmlArg keywords +" Last Change: 2018 Apr 7 +" Included patch from Jorge Maldonado Ventura to fix rendering " " Please check :help html.vim for some comments and a description of the options @@ -159,47 +159,47 @@ if !exists("html_no_rendering") " rendering syn cluster htmlTop contains=@Spell,htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,htmlLink,javaScript,@htmlPreproc - syn region htmlStrike start="<del\>" end="</del>"me=e-6 contains=@htmlTop - syn region htmlStrike start="<strike\>" end="</strike>"me=e-9 contains=@htmlTop - - syn region htmlBold start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlBoldUnderline,htmlBoldItalic - syn region htmlBold start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlBoldUnderline,htmlBoldItalic - syn region htmlBoldUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlBoldUnderlineItalic - syn region htmlBoldItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop,htmlBoldItalicUnderline - syn region htmlBoldItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop,htmlBoldItalicUnderline - syn region htmlBoldUnderlineItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop - syn region htmlBoldUnderlineItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop - syn region htmlBoldItalicUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlBoldUnderlineItalic - - syn region htmlUnderline start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlUnderlineBold,htmlUnderlineItalic - syn region htmlUnderlineBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlUnderlineBoldItalic - syn region htmlUnderlineBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlUnderlineBoldItalic - syn region htmlUnderlineItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop,htmlUnderlineItalicBold - syn region htmlUnderlineItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop,htmlUnderlineItalicBold - syn region htmlUnderlineItalicBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop - syn region htmlUnderlineItalicBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop - syn region htmlUnderlineBoldItalic contained start="<i\>" end="</i>"me=e-4 contains=@htmlTop - syn region htmlUnderlineBoldItalic contained start="<em\>" end="</em>"me=e-5 contains=@htmlTop - - syn region htmlItalic start="<i\>" end="</i>"me=e-4 contains=@htmlTop,htmlItalicBold,htmlItalicUnderline - syn region htmlItalic start="<em\>" end="</em>"me=e-5 contains=@htmlTop - syn region htmlItalicBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop,htmlItalicBoldUnderline - syn region htmlItalicBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop,htmlItalicBoldUnderline - syn region htmlItalicBoldUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop - syn region htmlItalicUnderline contained start="<u\>" end="</u>"me=e-4 contains=@htmlTop,htmlItalicUnderlineBold - syn region htmlItalicUnderlineBold contained start="<b\>" end="</b>"me=e-4 contains=@htmlTop - syn region htmlItalicUnderlineBold contained start="<strong\>" end="</strong>"me=e-9 contains=@htmlTop + syn region htmlStrike start="<del\>" end="</del\_s*>"me=s-1 contains=@htmlTop + syn region htmlStrike start="<strike\>" end="</strike\_s*>"me=s-1 contains=@htmlTop + + syn region htmlBold start="<b\>" end="</b\_s*>"me=s-1 contains=@htmlTop,htmlBoldUnderline,htmlBoldItalic + syn region htmlBold start="<strong\>" end="</strong\_s*>"me=s-1 contains=@htmlTop,htmlBoldUnderline,htmlBoldItalic + syn region htmlBoldUnderline contained start="<u\>" end="</u\_s*>"me=s-1 contains=@htmlTop,htmlBoldUnderlineItalic + syn region htmlBoldItalic contained start="<i\>" end="</i\_s*>"me=s-1 contains=@htmlTop,htmlBoldItalicUnderline + syn region htmlBoldItalic contained start="<em\>" end="</em\_s*>"me=s-1 contains=@htmlTop,htmlBoldItalicUnderline + syn region htmlBoldUnderlineItalic contained start="<i\>" end="</i\_s*>"me=s-1 contains=@htmlTop + syn region htmlBoldUnderlineItalic contained start="<em\>" end="</em\_s*>"me=s-1 contains=@htmlTop + syn region htmlBoldItalicUnderline contained start="<u\>" end="</u\_s*>"me=s-1 contains=@htmlTop,htmlBoldUnderlineItalic + + syn region htmlUnderline start="<u\>" end="</u\_s*>"me=s-1 contains=@htmlTop,htmlUnderlineBold,htmlUnderlineItalic + syn region htmlUnderlineBold contained start="<b\>" end="</b\_s*>"me=s-1 contains=@htmlTop,htmlUnderlineBoldItalic + syn region htmlUnderlineBold contained start="<strong\>" end="</strong\_s*>"me=s-1 contains=@htmlTop,htmlUnderlineBoldItalic + syn region htmlUnderlineItalic contained start="<i\>" end="</i\_s*>"me=s-1 contains=@htmlTop,htmlUnderlineItalicBold + syn region htmlUnderlineItalic contained start="<em\>" end="</em\_s*>"me=s-1 contains=@htmlTop,htmlUnderlineItalicBold + syn region htmlUnderlineItalicBold contained start="<b\>" end="</b\_s*>"me=s-1 contains=@htmlTop + syn region htmlUnderlineItalicBold contained start="<strong\>" end="</strong\_s*>"me=s-1 contains=@htmlTop + syn region htmlUnderlineBoldItalic contained start="<i\>" end="</i\_s*>"me=s-1 contains=@htmlTop + syn region htmlUnderlineBoldItalic contained start="<em\>" end="</em\_s*>"me=s-1 contains=@htmlTop + + syn region htmlItalic start="<i\>" end="</i\_s*>"me=s-1 contains=@htmlTop,htmlItalicBold,htmlItalicUnderline + syn region htmlItalic start="<em\>" end="</em\_s*>"me=s-1 contains=@htmlTop + syn region htmlItalicBold contained start="<b\>" end="</b\_s*>"me=s-1 contains=@htmlTop,htmlItalicBoldUnderline + syn region htmlItalicBold contained start="<strong\>" end="</strong\_s*>"me=s-1 contains=@htmlTop,htmlItalicBoldUnderline + syn region htmlItalicBoldUnderline contained start="<u\>" end="</u\_s*>"me=s-1 contains=@htmlTop + syn region htmlItalicUnderline contained start="<u\>" end="</u\_s*>"me=s-1 contains=@htmlTop,htmlItalicUnderlineBold + syn region htmlItalicUnderlineBold contained start="<b\>" end="</b\_s*>"me=s-1 contains=@htmlTop + syn region htmlItalicUnderlineBold contained start="<strong\>" end="</strong\_s*>"me=s-1 contains=@htmlTop syn match htmlLeadingSpace "^\s\+" contained - syn region htmlLink start="<a\>\_[^>]*\<href\>" end="</a>"me=e-4 contains=@Spell,htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,htmlLeadingSpace,javaScript,@htmlPreproc - syn region htmlH1 start="<h1\>" end="</h1>"me=e-5 contains=@htmlTop - syn region htmlH2 start="<h2\>" end="</h2>"me=e-5 contains=@htmlTop - syn region htmlH3 start="<h3\>" end="</h3>"me=e-5 contains=@htmlTop - syn region htmlH4 start="<h4\>" end="</h4>"me=e-5 contains=@htmlTop - syn region htmlH5 start="<h5\>" end="</h5>"me=e-5 contains=@htmlTop - syn region htmlH6 start="<h6\>" end="</h6>"me=e-5 contains=@htmlTop - syn region htmlHead start="<head\>" end="</head>"me=e-7 end="<body\>"me=e-5 end="<h[1-6]\>"me=e-3 contains=htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,htmlLink,htmlTitle,javaScript,cssStyle,@htmlPreproc - syn region htmlTitle start="<title\>" end="</title>"me=e-8 contains=htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,javaScript,@htmlPreproc + syn region htmlLink start="<a\>\_[^>]*\<href\>" end="</a\_s*>"me=s-1 contains=@Spell,htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,htmlLeadingSpace,javaScript,@htmlPreproc + syn region htmlH1 start="<h1\>" end="</h1\_s*>"me=s-1 contains=@htmlTop + syn region htmlH2 start="<h2\>" end="</h2\_s*>"me=s-1 contains=@htmlTop + syn region htmlH3 start="<h3\>" end="</h3\_s*>"me=s-1 contains=@htmlTop + syn region htmlH4 start="<h4\>" end="</h4\_s*>"me=s-1 contains=@htmlTop + syn region htmlH5 start="<h5\>" end="</h5\_s*>"me=s-1 contains=@htmlTop + syn region htmlH6 start="<h6\>" end="</h6\_s*>"me=s-1 contains=@htmlTop + syn region htmlHead start="<head\>" end="</head\_s*>"me=s-1 end="<body\>"me=s-1 end="<h[1-6]\>"me=s-1 contains=htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,htmlLink,htmlTitle,javaScript,cssStyle,@htmlPreproc + syn region htmlTitle start="<title\>" end="</title\_s*>"me=s-1 contains=htmlTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,javaScript,@htmlPreproc endif syn keyword htmlTagName contained noscript 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 b6aa04b2c7..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: Feb 15, 2018 -" Version: 27 +" 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 @@ -16,10 +16,10 @@ endif if exists("g:lisp_isk") exe "setl isk=".g:lisp_isk -elseif !has("patch-7.4.1142") - setl isk=38,42,43,45,47-58,60-62,64-90,97-122,_ -else +elseif (v:version == 704 && has("patch-7.4.1142")) || v:version > 704 syn iskeyword 38,42,43,45,47-58,60-62,64-90,97-122,_ +else + setl isk=38,42,43,45,47-58,60-62,64-90,97-122,_ endif if exists("g:lispsyntax_ignorecase") || exists("g:lispsyntax_clisp") @@ -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/make.vim b/runtime/syntax/make.vim index 7072bab988..377e4450d9 100644 --- a/runtime/syntax/make.vim +++ b/runtime/syntax/make.vim @@ -1,8 +1,9 @@ " Vim syntax file " Language: Makefile -" Maintainer: Claudio Fleiner <claudio@fleiner.com> -" URL: http://www.fleiner.com/vim/syntax/make.vim -" Last Change: 2015 Feb 28 +" Maintainer: Roland Hieber <rohieb+vim-iR0jGdkV@rohieb.name> +" Previous Maintainer: Claudio Fleiner <claudio@fleiner.com> +" URL: https://github.com/vim/vim/syntax/make.vim +" Last Change: 2019 Apr 02 " quit when a syntax file was already loaded if exists("b:current_syntax") @@ -18,7 +19,7 @@ syn match makeSpecial "^\s*[@+-]\+" syn match makeNextLine "\\\n\s*" " some directives -syn match makePreCondit "^ *\(ifeq\>\|else\>\|endif\>\|ifneq\>\|ifdef\>\|ifndef\>\)" +syn match makePreCondit "^ *\(ifn\=\(eq\|def\)\>\|else\(\s\+ifn\=\(eq\|def\)\)\=\>\|endif\>\)" syn match makeInclude "^ *[-s]\=include" syn match makeStatement "^ *vpath" syn match makeExport "^ *\(export\|unexport\)\>" @@ -31,8 +32,8 @@ syn region makeDefine start="^\s*define\s" end="^\s*endef\s*\(#.*\)\?$" contains " Microsoft Makefile specials syn case ignore -syn match makeInclude "^! *include" -syn match makePreCondit "! *\(cmdswitches\|error\|message\|include\|if\|ifdef\|ifndef\|else\|elseif\|else if\|else\s*ifdef\|else\s*ifndef\|endif\|undef\)\>" +syn match makeInclude "^!\s*include" +syn match makePreCondit "^!\s*\(cmdswitches\|error\|message\|include\|if\|ifdef\|ifndef\|else\|else\s*if\|else\s*ifdef\|else\s*ifndef\|endif\|undef\)\>" syn case match " identifiers @@ -64,7 +65,7 @@ syn match makeCmdNextLine "\\\n."he=e-1 contained " Statements / Functions (GNU make) -syn match makeStatement contained "(\(subst\|abspath\|addprefix\|addsuffix\|and\|basename\|call\|dir\|error\|eval\|filter-out\|filter\|findstring\|firstword\|flavor\|foreach\|if\|info\|join\|lastword\|notdir\|or\|origin\|patsubst\|realpath\|shell\|sort\|strip\|suffix\|value\|warning\|wildcard\|word\|wordlist\|words\)\>"ms=s+1 +syn match makeStatement contained "(\(abspath\|addprefix\|addsuffix\|and\|basename\|call\|dir\|error\|eval\|file\|filter-out\|filter\|findstring\|firstword\|flavor\|foreach\|guile\|if\|info\|join\|lastword\|notdir\|or\|origin\|patsubst\|realpath\|shell\|sort\|strip\|subst\|suffix\|value\|warning\|wildcard\|word\|wordlist\|words\)\>"ms=s+1 " Comment if exists("make_microsoft") @@ -100,17 +101,17 @@ syn sync match makeCommandSync groupthere makeCommands "^[A-Za-z0-9_./$()%-][A-Z " Define the default highlighting. " Only when an item doesn't have highlighting yet -hi def link makeNextLine makeSpecial +hi def link makeNextLine makeSpecial hi def link makeCmdNextLine makeSpecial -hi def link makeSpecTarget Statement +hi def link makeSpecTarget Statement if !exists("make_no_commands") -hi def link makeCommands Number +hi def link makeCommands Number endif -hi def link makeImplicit Function +hi def link makeImplicit Function hi def link makeTarget Function hi def link makeInclude Include -hi def link makePreCondit PreCondit -hi def link makeStatement Statement +hi def link makePreCondit PreCondit +hi def link makeStatement Statement hi def link makeIdent Identifier hi def link makeSpecial Special hi def link makeComment Comment diff --git a/runtime/syntax/maple.vim b/runtime/syntax/maple.vim index 1261ff5a47..f14cf79cf4 100644 --- a/runtime/syntax/maple.vim +++ b/runtime/syntax/maple.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: Maple V (based on release 4) " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Aug 31, 2016 -" Version: 15 +" Last Change: Mar 26, 2019 +" Version: 16 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_MAPLE " " Package Function Selection: {{{1 @@ -27,10 +27,10 @@ if exists("b:current_syntax") endif " Iskeyword Effects: {{{1 -if !has("patch-7.4.1142") - setl isk=$,48-57,_,a-z,@-Z -else +if (v:version == 704 && has("patch-7.4.1142")) || v:version > 704 syn iskeyword $,48-57,_,a-z,@-Z +else + setl isk=$,48-57,_,a-z,@-Z endif " Package Selection: {{{1 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 68c1feddae..42913f228e 100644 --- a/runtime/syntax/ocaml.vim +++ b/runtime/syntax/ocaml.vim @@ -4,10 +4,15 @@ " Maintainers: Markus Mottl <markus.mottl@gmail.com> " Karl-Heinz Sylla <Karl-Heinz.Sylla@gmd.de> " Issac Trotts <ijtrotts@ucdavis.edu> -" URL: http://www.ocaml.info/vim/syntax/ocaml.vim -" 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) +" URL: https://github.com/rgrinberg/vim-ocaml +" 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/php.vim b/runtime/syntax/php.vim index 5a7a2c3794..1c5c24e56b 100644 --- a/runtime/syntax/php.vim +++ b/runtime/syntax/php.vim @@ -261,7 +261,7 @@ syn keyword phpStatement return break continue exit goto yield contained syn keyword phpKeyword var const contained " Type -syn keyword phpType bool boolean int integer real double float string array object NULL callable iterable contained +syn keyword phpType void bool boolean int integer real double float string array object NULL callable iterable contained " Structure syn keyword phpStructure namespace extends implements instanceof parent self contained diff --git a/runtime/syntax/raml.vim b/runtime/syntax/raml.vim new file mode 100644 index 0000000000..062a71c81b --- /dev/null +++ b/runtime/syntax/raml.vim @@ -0,0 +1,106 @@ +" Vim syntax file +" Language: RAML (RESTful API Modeling Language) +" Maintainer: Eric Hopkins <eric.on.tech@gmail.com> +" URL: https://github.com/in3d/vim-raml +" License: Same as Vim +" Last Change: 2018-11-03 + +if exists("b:current_syntax") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +syn keyword ramlTodo contained TODO FIXME XXX NOTE + +syn region ramlComment display oneline start='\%(^\|\s\)#' end='$' + \ contains=ramlTodo,@Spell + +syn region ramlVersion display oneline start='#%RAML' end='$' + +syn match ramlNodeProperty '!\%(![^\\^% ]\+\|[^!][^:/ ]*\)' + +syn match ramlAnchor '&.\+' + +syn match ramlAlias '\*.\+' + +syn match ramlDelimiter '[-,:]' +syn match ramlBlock '[\[\]{}>|]' +syn match ramlOperator '[?+-]' +syn match ramlKey '\h\+\(?\)\?\ze\s*:' +syn match ramlKey '\w\+\(\s\+\w\+\)*\(?\)\?\ze\s*:' +syn match routeKey '\/\w\+\(\s\+\w\+\)*\ze\s*:' +syn match routeKey 'application\/\w\+\ze\s*:' +syn match routeParamKey '\/{\w\+}*\ze\s*:' + +syn region ramlString matchgroup=ramlStringDelimiter + \ start=+\s"+ skip=+\\"+ end=+"+ + \ contains=ramlEscape +syn region ramlString matchgroup=ramlStringDelimiter + \ start=+\s'+ skip=+''+ end=+'+ + \ contains=ramlStringEscape +syn region ramlParameter matchgroup=ramlParameterDelimiter + \ start=+<<+ skip=+''+ end=+>>+ +syn match ramlEscape contained display +\\[\\"abefnrtv^0_ NLP]+ +syn match ramlEscape contained display '\\x\x\{2}' +syn match ramlEscape contained display '\\u\x\{4}' +syn match ramlEscape contained display '\\U\x\{8}' +syn match ramlEscape display '\\\%(\r\n\|[\r\n]\)' +syn match ramlStringEscape contained +''+ + +syn match ramlNumber display + \ '\<[+-]\=\d\+\%(\.\d\+\%([eE][+-]\=\d\+\)\=\)\=' +syn match ramlNumber display '0\o\+' +syn match ramlNumber display '0x\x\+' +syn match ramlNumber display '([+-]\=[iI]nf)' +syn match ramlNumber display '(NaN)' + +syn match ramlConstant '\<[~yn]\>' +syn keyword ramlConstant true True TRUE false False FALSE +syn keyword ramlConstant yes Yes on ON no No off OFF +syn keyword ramlConstant null Null NULL nil Nil NIL + +syn keyword httpVerbs get post put delete head patch options +syn keyword ramlTypes string number integer date boolean file + +syn match ramlTimestamp '\d\d\d\d-\%(1[0-2]\|\d\)-\%(3[0-2]\|2\d\|1\d\|\d\)\%( \%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\d\d [+-]\%([01]\d\|2[0-3]\):[0-5]\d\|t\%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\d\d[+-]\%([01]\d\|2[0-3]\):[0-5]\d\|T\%([01]\d\|2[0-3]\):[0-5]\d:[0-5]\d.\dZ\)\=' + +syn region ramlDocumentHeader start='---' end='$' contains=ramlDirective +syn match ramlDocumentEnd '\.\.\.' + +syn match ramlDirective contained '%[^:]\+:.\+' + +hi def link ramlVersion String +hi def link routeInterpolation String +hi def link ramlInterpolation Constant +hi def link ramlTodo Todo +hi def link ramlComment Comment +hi def link ramlDocumentHeader PreProc +hi def link ramlDocumentEnd PreProc +hi def link ramlDirective Keyword +hi def link ramlNodeProperty Type +hi def link ramlAnchor Type +hi def link ramlAlias Type +hi def link ramlBlock Operator +hi def link ramlOperator Operator +hi def link routeParamKey SpecialChar +hi def link ramlKey Identifier +hi def link routeKey SpecialChar +hi def link ramlParameterDelimiter Type +hi def link ramlParameter Type +hi def link ramlString String +hi def link ramlStringDelimiter ramlString +hi def link ramlEscape SpecialChar +hi def link ramlStringEscape SpecialChar +hi def link ramlNumber Number +hi def link ramlConstant Constant +hi def link ramlTimestamp Number +hi def link httpVerbs Statement +hi def link ramlTypes Type +hi def link ramlDelimiter Delimiter + +let b:current_syntax = "raml" + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/syntax/rmd.vim b/runtime/syntax/rmd.vim index a26389024d..d852d225bc 100644 --- a/runtime/syntax/rmd.vim +++ b/runtime/syntax/rmd.vim @@ -1,7 +1,7 @@ " markdown Text with R statements " Language: markdown with R code chunks " Homepage: https://github.com/jalvesaq/R-Vim-runtime -" Last Change: Sat Aug 25, 2018 03:44PM +" Last Change: Thu Apr 18, 2019 09:17PM " " For highlighting pandoc extensions to markdown like citations and TeX and " many other advanced features like folding of markdown sections, it is @@ -54,14 +54,14 @@ runtime syntax/markdown.vim " Now highlight chunks: for s:type in g:rmd_fenced_languages if s:type =~ '=' - let s:lng = substitute(s:type, '=.*', '') - let s:nm = substitute(s:type, '.*=', '') + let s:ft = substitute(s:type, '.*=', '', '') + let s:nm = substitute(s:type, '=.*', '', '') else - let s:lng = s:type + let s:ft = s:type let s:nm = s:type endif unlet! b:current_syntax - exe 'syn include @Rmd'.s:nm.' syntax/'.s:lng.'.vim' + exe 'syn include @Rmd'.s:nm.' syntax/'.s:ft.'.vim' if g:rmd_syn_hl_chunk exe 'syn region rmd'.s:nm.'ChunkDelim matchgroup=rmdCodeDelim start="^\s*```\s*{\s*'.s:nm.'\>" matchgroup=rmdCodeDelim end="}$" keepend containedin=rmd'.s:nm.'Chunk contains=@Rmd'.s:nm exe 'syn region rmd'.s:nm.'Chunk start="^\s*```\s*{\s*'.s:nm.'\>.*$" matchgroup=rmdCodeDelim end="^\s*```\ze\s*$" keepend contains=rmd'.s:nm.'ChunkDelim,@Rmd'.s:nm diff --git a/runtime/syntax/rst.vim b/runtime/syntax/rst.vim index d620d91f4a..c865cf6905 100644 --- a/runtime/syntax/rst.vim +++ b/runtime/syntax/rst.vim @@ -3,7 +3,7 @@ " Maintainer: Marshall Ward <marshall.ward@gmail.com> " Previous Maintainer: Nikolai Weibull <now@bitwi.se> " Website: https://github.com/marshallward/vim-restructuredtext -" Latest Revision: 2018-07-23 +" Latest Revision: 2018-12-29 if exists("b:current_syntax") finish @@ -59,6 +59,7 @@ syn keyword rstTodo contained FIXME TODO XXX NOTE execute 'syn region rstComment contained' . \ ' start=/.*/' + \ ' skip=+^$+' . \ ' end=/^\s\@!/ contains=rstTodo' execute 'syn region rstFootnote contained matchgroup=rstDirective' . diff --git a/runtime/syntax/ruby.vim b/runtime/syntax/ruby.vim index ca7f51b1ea..8b88378e60 100644 --- a/runtime/syntax/ruby.vim +++ b/runtime/syntax/ruby.vim @@ -3,6 +3,7 @@ " Maintainer: Doug Kearns <dougkearns@gmail.com> " URL: https://github.com/vim-ruby/vim-ruby " Release Coordinator: Doug Kearns <dougkearns@gmail.com> +" Last Change: 2018 Jul 09 " ---------------------------------------------------------------------------- " " Previous Maintainer: Mirko Nasato @@ -45,7 +46,7 @@ function! s:foldable(...) abort return 0 endfunction " }}} -syn cluster rubyNotTop contains=@rubyExtendedStringSpecial,@rubyRegexpSpecial,@rubyDeclaration,rubyConditional,rubyExceptional,rubyMethodExceptional,rubyTodo +syn cluster rubyNotTop contains=@rubyExtendedStringSpecial,@rubyRegexpSpecial,@rubyDeclaration,rubyConditional,rubyExceptional,rubyMethodExceptional,rubyTodo,rubyModuleName,rubyClassName,rubySymbolDelimiter " Whitespace Errors {{{1 if exists("ruby_space_errors") @@ -122,21 +123,24 @@ syn match rubyFloat "\%(\%(\w\|[]})\"']\s*\)\@<!-\)\=\<\%(0\|[1-9]\d*\%(_\d\+\)* syn match rubyLocalVariableOrMethod "\<[_[:lower:]][_[:alnum:]]*[?!=]\=" contains=NONE display transparent syn match rubyBlockArgument "&[_[:lower:]][_[:alnum:]]" contains=NONE display transparent +syn match rubyClassName "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!" contained +syn match rubyModuleName "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!" contained syn match rubyConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)\@!" syn match rubyClassVariable "@@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display syn match rubyInstanceVariable "@\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" display syn match rubyGlobalVariable "$\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\|-.\)" -syn match rubySymbol "[]})\"':]\@1<!:\%(\^\|\~@\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!@\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" -syn match rubySymbol "[]})\"':]\@1<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)" -syn match rubySymbol "[]})\"':]\@1<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" -syn match rubySymbol "[]})\"':]\@1<!:\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\=" +syn match rubySymbolDelimiter ":" contained +syn match rubySymbol "[]})\"':]\@1<!:\%(\^\|\~@\|\~\|<<\|<=>\|<=\|<\|===\|[=!]=\|[=!]\~\|!@\|!\|>>\|>=\|>\||\|-@\|-\|/\|\[]=\|\[]\|\*\*\|\*\|&\|%\|+@\|+\|`\)" contains=rubySymbolDelimiter +syn match rubySymbol "[]})\"':]\@1<!:\$\%(-.\|[`~<=>_,;:!?/.'"@$*\&+0]\)" contains=rubySymbolDelimiter +syn match rubySymbol "[]})\"':]\@1<!:\%(\$\|@@\=\)\=\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*" contains=rubySymbolDelimiter +syn match rubySymbol "[]})\"':]\@1<!:\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\%([?!=]>\@!\)\=" contains=rubySymbolDelimiter if s:foldable(':') - syn region rubySymbol start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape fold - syn region rubySymbol start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold + syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape fold + syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial fold else - syn region rubySymbol start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape - syn region rubySymbol start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial + syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':]\@1<!:'" end="'" skip="\\\\\|\\'" contains=rubyQuoteEscape + syn region rubySymbol matchgroup=rubySymbolDelimiter start="[]})\"':]\@1<!:\"" end="\"" skip="\\\\\|\\\"" contains=@rubyStringSpecial endif syn match rubyCapitalizedMethod "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\u\%(\w\|[^\x00-\x7F]\)*\>\%(\s*(\)*\s*(\@=" @@ -157,10 +161,10 @@ syn match rubyPredefinedConstant "\%(\%(^\|[^.]\)\.\s*\)\@<!\<\%(RUBY_\%(VERSION " Normal Regular Expression {{{1 if s:foldable('/') syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,{[<>?:*+-]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold - syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/\%([ \t=]\|$\)\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial fold else syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\%(^\|\<\%(and\|or\|while\|until\|unless\|if\|elsif\|when\|not\|then\|else\)\|[;\~=!|&(,{[<>?:*+-]\)\s*\)\@<=/" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial - syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/[ \t=]\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial + syn region rubyRegexp matchgroup=rubyRegexpDelimiter start="\%(\h\k*\s\+\)\@<=/\%([ \t=]\|$\)\@!" end="/[iomxneus]*" skip="\\\\\|\\/" contains=@rubyRegexpSpecial endif " Generalized Regular Expression {{{1 @@ -275,10 +279,10 @@ else endif " Here Document {{{1 -syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)+ end=+$+ oneline contains=ALLBUT,@rubyNotTop -syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs"\%([^"]*\)"+ end=+$+ oneline contains=ALLBUT,@rubyNotTop -syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs'\%([^']*\)'+ end=+$+ oneline contains=ALLBUT,@rubyNotTop -syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\s*\|\%([]})"'.]\|::\)\)\_s*\|\w\)\@<!<<[-~]\=\zs`\%([^`]*\)`+ end=+$+ oneline contains=ALLBUT,@rubyNotTop +syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<[-~]\=\zs\%(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)+ end=+$+ oneline contains=ALLBUT,@rubyNotTop +syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<[-~]\=\zs"\%([^"]*\)"+ end=+$+ oneline contains=ALLBUT,@rubyNotTop +syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<[-~]\=\zs'\%([^']*\)'+ end=+$+ oneline contains=ALLBUT,@rubyNotTop +syn region rubyHeredocStart matchgroup=rubyStringDelimiter start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<[-~]\=\zs`\%([^`]*\)`+ end=+$+ oneline contains=ALLBUT,@rubyNotTop if s:foldable('<<') syn region rubyString start=+\%(\%(class\|::\)\_s*\|\%([]})"'.]\)\s\|\w\)\@<!<<\z(\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*\)\ze\%(.*<<[-~]\=['`"]\=\h\)\@!+hs=s+2 matchgroup=rubyStringDelimiter end=+^\z1$+ contains=rubyHeredocStart,rubyHeredoc,@rubyStringSpecial fold keepend @@ -305,19 +309,19 @@ endif " eRuby Config {{{1 if exists('main_syntax') && main_syntax == 'eruby' let b:ruby_no_expensive = 1 -end +endif " Module, Class, Method and Alias Declarations {{{1 syn match rubyAliasDeclaration "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable,rubyPredefinedVariable nextgroup=rubyAliasDeclaration2 skipwhite syn match rubyAliasDeclaration2 "[^[:space:];#.()]\+" contained contains=rubySymbol,rubyGlobalVariable,rubyPredefinedVariable syn match rubyMethodDeclaration "[^[:space:];#(]\+" contained contains=rubyConstant,rubyBoolean,rubyPseudoVariable,rubyInstanceVariable,rubyClassVariable,rubyGlobalVariable -syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator -syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyConstant,rubyOperator -syn match rubyFunction "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=rubyMethodDeclaration -syn match rubyFunction "\%(\s\|^\)\@1<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 -syn match rubyFunction "\%([[:space:].]\|^\)\@2<=\%(\[\]=\=\|\*\*\|[-+!~]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration +syn match rubyClassDeclaration "[^[:space:];#<]\+" contained contains=rubyClassName,rubyOperator +syn match rubyModuleDeclaration "[^[:space:];#<]\+" contained contains=rubyModuleName,rubyOperator +syn match rubyMethodName "\<[_[:alpha:]][_[:alnum:]]*[?!=]\=[[:alnum:]_.:?!=]\@!" contained containedin=rubyMethodDeclaration +syn match rubyMethodName "\%(\s\|^\)\@1<=[_[:alpha:]][_[:alnum:]]*[?!=]\=\%(\s\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2 +syn match rubyMethodName "\%([[:space:].]\|^\)\@2<=\%(\[\]=\=\|\*\*\|[-+!~]@\=\|[*/%|&^~]\|<<\|>>\|[<>]=\=\|<=>\|===\|[=!]=\|[=!]\~\|!\|`\)\%([[:space:];#(]\|$\)\@=" contained containedin=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration -syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyModuleDeclaration,rubyClassDeclaration,rubyFunction,rubyBlockParameter +syn cluster rubyDeclaration contains=rubyAliasDeclaration,rubyAliasDeclaration2,rubyMethodDeclaration,rubyModuleDeclaration,rubyClassDeclaration,rubyMethodName,rubyBlockParameter " Keywords {{{1 " Note: the following keywords have already been defined: @@ -335,7 +339,7 @@ syn match rubyBeginEnd "\<\%(BEGIN\|END\)\>[?!]\@!" if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") syn match rubyDefine "\<alias\>" nextgroup=rubyAliasDeclaration skipwhite skipnl syn match rubyDefine "\<def\>" nextgroup=rubyMethodDeclaration skipwhite skipnl - syn match rubyDefine "\<undef\>" nextgroup=rubyFunction skipwhite skipnl + syn match rubyDefine "\<undef\>" nextgroup=rubyMethodName skipwhite skipnl syn match rubyClass "\<class\>" nextgroup=rubyClassDeclaration skipwhite skipnl syn match rubyModule "\<module\>" nextgroup=rubyModuleDeclaration skipwhite skipnl @@ -377,8 +381,6 @@ if !exists("b:ruby_no_expensive") && !exists("ruby_no_expensive") if s:foldable('[') syn region rubyArrayLiteral matchgroup=rubyArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@rubyNotTop fold - else - syn region rubyArrayLiteral matchgroup=rubyArrayDelimiter start="\%(\w\|[\]})]\)\@<!\[" end="]" contains=ALLBUT,@rubyNotTop endif " statements without 'do' @@ -437,10 +439,12 @@ if !exists("ruby_no_special_methods") syn match rubyControl "\<\%(exit!\|\%(abort\|at_exit\|exit\|fork\|loop\|trap\)\>[?!]\@!\)" syn keyword rubyEval eval class_eval instance_eval module_eval syn keyword rubyException raise fail catch throw - " false positive with 'include?' - syn match rubyInclude "\<include\>[?!]\@!" - syn keyword rubyInclude autoload extend load prepend refine require require_relative using + syn keyword rubyInclude autoload gem load require require_relative syn keyword rubyKeyword callcc caller lambda proc + " false positive with 'include?' + syn match rubyMacro "\<include\>[?!]\@!" + syn keyword rubyMacro extend prepend refine using + syn keyword rubyMacro alias_method define_method define_singleton_method remove_method undef_method endif " Comments and Documentation {{{1 @@ -461,7 +465,7 @@ syn match rubyKeywordAsMethod "\(defined?\|exit!\)\@!\<[_[:lower:]][_[:alnum:]]* " More Symbols {{{1 syn match rubySymbol "\%([{(,]\_s*\)\zs\l\w*[!?]\=::\@!"he=e-1 -syn match rubySymbol "[]})\"':]\@1<!\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@="he=e-1 +syn match rubySymbol "[]})\"':]\@1<!\<\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@="he=e-1 syn match rubySymbol "\%([{(,]\_s*\)\zs[[:space:],{]\l\w*[!?]\=::\@!"hs=s+1,he=e-1 syn match rubySymbol "[[:space:],{(]\%(\h\|[^\x00-\x7F]\)\%(\w\|[^\x00-\x7F]\)*[!?]\=:[[:space:],]\@="hs=s+1,he=e-1 @@ -477,6 +481,10 @@ hi def link rubyClass rubyDefine hi def link rubyModule rubyDefine hi def link rubyMethodExceptional rubyDefine hi def link rubyDefine Define +hi def link rubyAccess rubyMacro +hi def link rubyAttribute rubyMacro +hi def link rubyMacro Macro +hi def link rubyMethodName rubyFunction hi def link rubyFunction Function hi def link rubyConditional Conditional hi def link rubyConditionalModifier rubyConditional @@ -498,8 +506,9 @@ else endif hi def link rubyClassVariable rubyIdentifier hi def link rubyConstant Type +hi def link rubyClassName rubyConstant +hi def link rubyModuleName rubyConstant hi def link rubyGlobalVariable rubyIdentifier -hi def link rubyBlockParameter rubyIdentifier hi def link rubyInstanceVariable rubyIdentifier hi def link rubyPredefinedIdentifier rubyIdentifier hi def link rubyPredefinedConstant rubyPredefinedIdentifier @@ -508,8 +517,6 @@ hi def link rubySymbol Constant hi def link rubyKeyword Keyword hi def link rubyOperator Operator hi def link rubyBeginEnd Statement -hi def link rubyAccess Statement -hi def link rubyAttribute Statement hi def link rubyEval Statement hi def link rubyPseudoVariable Constant hi def link rubyCapitalizedMethod rubyLocalVariableOrMethod diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index 5e0d1fd76a..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: Sep 04, 2018 -" Version: 182 +" 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) @@ -89,7 +89,7 @@ if g:sh_fold_enabled && &fdm == "manual" endif " set up the syntax-highlighting iskeyword -if has("patch-7.4.1142") +if (v:version == 704 && has("patch-7.4.1142")) || v:version > 704 if exists("b:is_bash") exe "syn iskeyword ".&iskeyword.",-,:" else @@ -144,12 +144,12 @@ endif syn cluster shHereBeginList contains=@shCommandSubList syn cluster shHereList contains=shBeginHere,shHerePayload syn cluster shHereListDQ contains=shBeginHere,@shDblQuoteList,shHerePayload -syn cluster shIdList contains=shCommandSub,shCommandSubBQ,shWrapLineOperator,shSetOption,shComment,shDeref,shDerefSimple,shHereString,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr +syn cluster shIdList contains=shCommandSub,shCommandSubBQ,shWrapLineOperator,shSetOption,shComment,shDeref,shDerefSimple,shHereString,shNumber,shOperator,shRedir,shExSingleQuote,shExDoubleQuote,shSingleQuote,shDoubleQuote,shExpr,shCtrlSeq,shStringSpecial,shAtExpr syn cluster shIfList contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionTwo syn cluster shLoopList contains=@shCaseList,@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr,shTouch syn cluster shPPSRightList contains=shComment,shDeref,shDerefSimple,shEscape,shPosnParm syn cluster shSubShList contains=@shCommandSubList,shCommandSubBQ,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shIf,shHereString,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator -syn cluster shTestList contains=shCharClass,shCommandSub,shCommandSubBQ,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shSpecialDQ,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr +syn cluster shTestList contains=shArithmetic,shCharClass,shCommandSub,shCommandSubBQ,shCtrlSeq,shDeref,shDerefSimple,shDoubleQuote,shSpecialDQ,shExDoubleQuote,shExpr,shExSingleQuote,shNumber,shOperator,shSingleQuote,shTest,shTestOpr syn cluster shNoZSList contains=shSpecialNoZS syn cluster shForList contains=shTestOpr,shNumber,shDerefSimple,shDeref,shCommandSub,shCommandSubBQ,shArithmetic @@ -292,7 +292,9 @@ endif "====== syn match shWrapLineOperator "\\$" syn region shCommandSubBQ start="`" skip="\\\\\|\\." end="`" contains=shBQComment,@shCommandSubList -syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' nextgroup=shSingleQuote,shDoubleQuote,shComment +"see ksh13 +"syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' nextgroup=shSingleQuote,shDoubleQuote,shComment +syn match shEscape contained '\%(^\)\@!\%(\\\\\)*\\.' nextgroup=shComment " $() and $(()): {{{1 " $(..) is not supported by sh (Bourne shell). However, apparently @@ -379,22 +381,23 @@ syn match shBQComment contained "#.\{-}\ze`" contains=@shCommentGroup " Here Documents: {{{1 " ========================================= -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc01 start="<<\s*\\\=\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc01 end="^\z1\s*$" contains=@shDblQuoteList -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc02 start="<<\s*\"\z([^ \t|>]\+\)\"" matchgroup=shHereDoc02 end="^\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc03 start="<<-\s*\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc03 end="^\s*\z1\s*$" contains=@shDblQuoteList +" 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([^ \t|>]\+\)\"" matchgroup=shHereDoc06 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc07 start="<<\s*\\\_$\_s*\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc07 end="^\z1\s*$" contains=@shDblQuoteList -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc08 start="<<\s*\\\_$\_s*'\z([^ \t0-9|>]\+\)'" matchgroup=shHereDoc08 end="^\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc09 start="<<\s*\\\_$\_s*\"\z([^ \t0-9|>]\+\)\"" matchgroup=shHereDoc09 end="^\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc10 start="<<-\s*\\\_$\_s*\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc10 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc11 start="<<-\s*\\\_$\_s*\\\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc11 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc12 start="<<-\s*\\\_$\_s*'\z([^ \t|>]\+\)'" matchgroup=shHereDoc12 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc13 start="<<-\s*\\\_$\_s*\"\z([^ \t|>]\+\)\"" matchgroup=shHereDoc13 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc14 start="<<\\\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc14 end="^\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc15 start="<<-\s*\\\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc15 end="^\s*\z1\s*$" -ShFoldHereDoc syn region shHereDoc matchgroup=shHereDoc16 start="<<-\s*\\\z([^ \t0-9|>]\+\)" matchgroup=shHereDoc15 end="^\s*\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*$" +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*$" 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*$" 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 " ============= @@ -407,18 +410,19 @@ endif "============= syn match shSetOption "\s\zs[-+][a-zA-Z0-9]\+\>" contained syn match shVariable "\<\([bwglsav]:\)\=[a-zA-Z0-9.!@_%+,]*\ze=" nextgroup=shVarAssign -syn match shVarAssign "=" contained nextgroup=shCmdParenRegion,shPattern,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shSingleQuote,shExSingleQuote +syn match shVarAssign "=" contained nextgroup=shCmdParenRegion,shPattern,shDeref,shDerefSimple,shDoubleQuote,shExDoubleQuote,shSingleQuote,shExSingleQuote,shVar +syn match shVar contained "\h\w*" syn region shAtExpr contained start="@(" end=")" contains=@shIdList if exists("b:is_bash") - syn match shSet "^\s*set\ze\s*$" - syn region shSetList oneline matchgroup=shSet start="\<\(declare\|typeset\|local\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+#\|=" contains=@shIdList - syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="\ze[;|#)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+=" contains=@shIdList nextgroup=shComment + syn match shSet "^\s*set\ze\s\+$" + syn region shSetList oneline matchgroup=shSet start="\<\%(declare\|local\|export\)\>\ze[/a-zA-Z_]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+#\|=" contains=@shIdList + syn region shSetList oneline matchgroup=shSet start="\<\%(set\|unset\)\>[/a-zA-Z_]\@!" end="\ze[;|#)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+=" contains=@shIdList nextgroup=shComment elseif exists("b:is_kornshell") || exists("b:is_posix") - syn match shSet "^\s*set\ze\s*$" - syn region shSetList oneline matchgroup=shSet start="\<\(typeset\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList - syn region shSetList oneline matchgroup=shSet start="\<set\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList + syn match shSet "^\s*set\ze\s\+$" + syn region shSetList oneline matchgroup=shSet start="\<\(export\)\>\ze[/]\@!" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList + syn region shSetList oneline matchgroup=shSet start="\<\%(set\|unset\>\)\ze[/a-zA-Z_]\@!" end="\ze[;|#)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList nextgroup=shComment else - syn region shSetList oneline matchgroup=shSet start="\<\(set\|export\|unset\)\>\ze[^/]" end="$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList + syn region shSetList oneline matchgroup=shSet start="\<\(set\|export\|unset\)\>\ze[/a-zA-Z_]\@!" end="\ze[;|#)]\|$" matchgroup=shSetListDelim end="\ze[}|);&]" matchgroup=NONE end="\ze\s\+[#=]" contains=@shIdList endif " Functions: {{{1 @@ -523,12 +527,12 @@ if exists("b:is_bash") " bash : ${parameter//pattern/string} " bash : ${parameter//pattern} syn match shDerefPPS contained '/\{1,2}' nextgroup=shDerefPPSleft - syn region shDerefPPSleft contained start='.' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList - syn region shDerefPPSright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' contains=@shPPSRightList + syn region shDerefPPSleft contained start='.' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPPSright contains=@shCommandSubList + syn region shDerefPPSright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' contains=@shPPSRightList " bash : ${parameter/#substring/replacement} syn match shDerefPSR contained '/#' nextgroup=shDerefPSRleft,shDoubleQuote,shSingleQuote - syn region shDerefPSRleft contained start='[^"']' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPSRright + syn region shDerefPSRleft contained start='[^"']' skip=@\%(\\\\\)*\\/@ matchgroup=shDerefOp end='/' end='\ze}' nextgroup=shDerefPSRright syn region shDerefPSRright contained start='.' skip=@\%(\\\\\)\+@ end='\ze}' endif @@ -546,8 +550,9 @@ endif " Additional ksh Keywords and Aliases: {{{1 " =================================== -if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix") - syn keyword shStatement bg builtin disown enum export false fg getconf getopts hist jobs let printf sleep true typeset unalias unset whence +if exists("b:is_kornshell") || exists("b:is_posix") + syn keyword shStatement bg builtin disown enum export false fg getconf getopts hist jobs let printf sleep true unalias whence + syn keyword shStatement typeset skipwhite nextgroup=shSetOption syn keyword shStatement autoload compound fc float functions hash history integer nameref nohup r redirect source stop suspend times type if exists("b:is_posix") syn keyword shStatement command @@ -557,12 +562,13 @@ if exists("b:is_kornshell") || exists("b:is_bash") || exists("b:is_posix") " Additional bash Keywords: {{{1 " ===================== - if exists("b:is_bash") -" syn keyword shStatement bind builtin dirs disown enable help logout popd pushd shopt source -syn keyword shStatement bind builtin caller compopt declare dirs disown enable export help local logout mapfile popd pushd readarray shopt source typeset unset - else - syn keyword shStatement login newgrp - endif +elseif exists("b:is_bash") + syn keyword shStatement bg builtin disown export false fg getopts jobs let printf sleep true unalias + syn keyword shStatement typeset nextgroup=shSetOption + syn keyword shStatement fc hash history source suspend times type + syn keyword shStatement bind builtin caller compopt declare dirs disown enable export help logout mapfile popd pushd readarray shopt source typeset +else + syn keyword shStatement login newgrp endif " Synchronization: {{{1 diff --git a/runtime/syntax/spec.vim b/runtime/syntax/spec.vim index 3a7dc9e422..2d2550559b 100644 --- a/runtime/syntax/spec.vim +++ b/runtime/syntax/spec.vim @@ -3,7 +3,7 @@ " Language: SPEC: Build/install scripts for Linux RPM packages " Maintainer: Igor Gnatenko i.gnatenko.brain@gmail.com " Former Maintainer: Donovan Rebbechi elflord@panix.com (until March 2014) -" Last Change: Sat Apr 9 15:30 2016 Filip SzymaÅ„ski +" Last Change: 2019 May 07 " quit when a syntax file was already loaded if exists("b:current_syntax") @@ -86,9 +86,9 @@ syn region specSectionMacroBracketArea oneline matchgroup=specSectionMacro start "%% Files Section %% "TODO %config valid parameters: missingok\|noreplace "TODO %verify valid parameters: \(not\)\= \(md5\|atime\|...\) -syn region specFilesArea matchgroup=specSection start='^%[Ff][Ii][Ll][Ee][Ss]\>' skip='%\(attrib\|defattr\|attr\|dir\|config\|docdir\|doc\|lang\|verify\|ghost\)\>' end='^%[a-zA-Z]'me=e-2 contains=specFilesOpts,specFilesDirective,@specListedFiles,specComment,specCommandSpecial,specMacroIdentifier +syn region specFilesArea matchgroup=specSection start='^%[Ff][Ii][Ll][Ee][Ss]\>' skip='%\(attrib\|defattr\|attr\|dir\|config\|docdir\|doc\|lang\|license\|verify\|ghost\|exclude\)\>' end='^%[a-zA-Z]'me=e-2 contains=specFilesOpts,specFilesDirective,@specListedFiles,specComment,specCommandSpecial,specMacroIdentifier "tip: remember to include new itens in specFilesArea above -syn match specFilesDirective contained '%\(attrib\|defattr\|attr\|dir\|config\|docdir\|doc\|lang\|verify\|ghost\)\>' +syn match specFilesDirective contained '%\(attrib\|defattr\|attr\|dir\|config\|docdir\|doc\|lang\|license\|verify\|ghost\|exclude\)\>' "valid options for certain section headers syn match specDescriptionOpts contained '\s-[ln]\s*\a'ms=s+1,me=e-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/tasm.vim b/runtime/syntax/tasm.vim index c9fc8186d0..1d6e570752 100644 --- a/runtime/syntax/tasm.vim +++ b/runtime/syntax/tasm.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: TASM: turbo assembler by Borland " Maintaner: FooLman of United Force <foolman@bigfoot.com> -" Last Change: 2012 Feb 03 by Thilo Six +" Last Change: 2012 Feb 03 by Thilo Six, and 2018 Nov 27. " quit when a syntax file was already loaded if exists("b:current_syntax") @@ -109,7 +109,7 @@ hi def link tasmComment Comment hi def link tasmLabel Label -let b:curret_syntax = "tasm" +let b:current_syntax = "tasm" let &cpo = s:cpo_save unlet s:cpo_save diff --git a/runtime/syntax/template.vim b/runtime/syntax/template.vim new file mode 100644 index 0000000000..5bf580fc11 --- /dev/null +++ b/runtime/syntax/template.vim @@ -0,0 +1,15 @@ +" Vim syntax file +" Language: Generic template +" Maintainer: Bram Moolenaar <Bram@vim.org> +" Last Change: 2019 May 06 + +" Quit when a (custom) syntax file was already loaded +if exists("b:current_syntax") + finish +endif + +" Known template types are very similar to HTML, E.g. golang and "Xfire User +" Interface Template" +" If you know how to recognize a more specific type for *.tmpl suggest a +" change to runtime/scripts.vim. +runtime! syntax/html.vim diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim index 18c3a04877..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: Sep 09, 2018 -" Version: 110 +" Last Change: May 14, 2019 +" Version: 114 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX " " Notes: {{{1 @@ -127,7 +127,7 @@ elseif b:tex_stylish else let b:tex_isk="48-57,a-z,A-Z,192-255" endif -if v:version > 704 || (v:version == 704 && has("patch-7.4.1142")) +if (v:version == 704 && has("patch-7.4.1142")) || v:version > 704 exe "syn iskeyword ".b:tex_isk else exe "setl isk=".b:tex_isk @@ -155,13 +155,13 @@ if !s:tex_no_error syn cluster texCmdGroup add=texMathError endif syn cluster texEnvGroup contains=texMatcher,texMathDelim,texSpecialChar,texStatement -syn cluster texFoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texItalStyle,texNoSpell +syn cluster texFoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texItalStyle,texEmphStyle,texNoSpell syn cluster texBoldGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texBoldStyle,texBoldItalStyle,texNoSpell -syn cluster texItalGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texItalStyle,texItalBoldStyle,texNoSpell +syn cluster texItalGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texInputFile,texLength,texLigature,texMatcher,texMathZoneV,texMathZoneW,texMathZoneX,texMathZoneY,texMathZoneZ,texNewCmd,texNewEnv,texOnlyMath,texOption,texParen,texRefZone,texSection,texBeginEnd,texSectionZone,texSpaceCode,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,@texMathZones,texTitle,texAbstract,texItalStyle,texEmphStyle,texItalBoldStyle,texNoSpell if !s:tex_nospell - syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,@Spell - syn cluster texMatchNMGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,@Spell - syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption,texStyleStatement,@Spell,texStyleMatcher + syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,@Spell + syn cluster texMatchNMGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,@Spell + syn cluster texStyleGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texBoldStyle,texBoldItalStyle,texItalStyle,texItalBoldStyle,texZone,texInputFile,texOption,texStyleStatement,texStyleMatcher,@Spell else syn cluster texMatchGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcher,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption syn cluster texMatchNMGroup contains=texAccent,texBadMath,texComment,texDefCmd,texDelimiter,texDocType,texInput,texLength,texLigature,texMatcherNM,texNewCmd,texNewEnv,texOnlyMath,texParen,texRefZone,texSection,texSpecialChar,texStatement,texString,texTypeSize,texTypeStyle,texZone,texInputFile,texOption @@ -301,6 +301,7 @@ syn match texTypeStyle "\\tt\>" if s:tex_conceal !~# 'b' syn match texTypeStyle "\\textbf\>" syn match texTypeStyle "\\textit\>" + syn match texTypeStyle "\\emph\>" endif syn match texTypeStyle "\\textmd\>" syn match texTypeStyle "\\textrm\>" @@ -309,7 +310,6 @@ syn match texTypeStyle "\\textsf\>" syn match texTypeStyle "\\textsl\>" syn match texTypeStyle "\\texttt\>" syn match texTypeStyle "\\textup\>" -syn match texTypeStyle "\\emph\>" syn match texTypeStyle "\\mathbb\>" syn match texTypeStyle "\\mathbf\>" @@ -385,11 +385,13 @@ if s:tex_fast =~# 'b' syn region texBoldItalStyle matchgroup=texTypeStyle start="\\textit\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texItalGroup,@Spell syn region texItalStyle matchgroup=texTypeStyle start="\\textit\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texItalGroup,@Spell syn region texItalBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texBoldGroup,@Spell + syn region texEmphStyle matchgroup=texTypeStyle start="\\emph\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texItalGroup,@Spell else syn region texBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texBoldGroup syn region texBoldItalStyle matchgroup=texTypeStyle start="\\textit\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texItalGroup syn region texItalStyle matchgroup=texTypeStyle start="\\textit\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texItalGroup syn region texItalBoldStyle matchgroup=texTypeStyle start="\\textbf\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texBoldGroup + syn region texEmphStyle matchgroup=texTypeStyle start="\\emph\s*{" matchgroup=texTypeStyle end="}" concealends contains=@texItalGroup endif endif endif @@ -790,6 +792,8 @@ if has("conceal") && &enc == 'utf-8' \ ['propto' , 'âˆ'], \ ['rceil' , '⌉'], \ ['Re' , 'ℜ'], + \ ['quad' , ' '], + \ ['qquad' , 'â€'], \ ['rfloor' , '⌋'], \ ['right)' , ')'], \ ['right]' , ']'], @@ -943,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\>' ,'μ') @@ -965,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 @@ -1228,6 +1234,7 @@ if !exists("skip_tex_syntax_inits") hi texItalStyle gui=italic cterm=italic hi texBoldItalStyle gui=bold,italic cterm=bold,italic hi texItalBoldStyle gui=bold,italic cterm=bold,italic + hi def link texEmphStyle texItalStyle hi def link texCite texRefZone hi def link texDefCmd texDef hi def link texDefName texDef 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/tpp.vim b/runtime/syntax/tpp.vim index 1244b97f08..ca64b5dce1 100644 --- a/runtime/syntax/tpp.vim +++ b/runtime/syntax/tpp.vim @@ -1,11 +1,11 @@ " Vim syntax file -" Language: tpp - Text Presentation Program -" Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> -" Former Maintainer: Gerfried Fuchs <alfie@ist.org> -" Last Change: 2007-10-14 -" URL: http://git.debian.org/?p=pkg-vim/vim.git;a=blob_plain;f=runtime/syntax/tpp.vim;hb=debian -" Filenames: *.tpp -" License: BSD +" Language: tpp - Text Presentation Program +" Maintainer: Debian Vim Maintainers +" Former Maintainer: Gerfried Fuchs <alfie@ist.org> +" Last Change: 2018 Dec 27 +" URL: https://salsa.debian.org/vim-team/vim-debian/master/syntax/tpp.vim +" Filenames: *.tpp +" License: BSD " " XXX This file is in need of a new maintainer, Debian VIM Maintainers maintain " it only because patches have been submitted for it by Debian users and the @@ -18,11 +18,11 @@ " SPAM is _NOT_ welcome - be ready to be reported! " quit when a syntax file was already loaded -if exists("b:current_syntax") +if exists('b:current_syntax') finish endif -if !exists("main_syntax") +if !exists('main_syntax') let main_syntax = 'tpp' endif @@ -46,7 +46,7 @@ syn region tppNewPageOption start="^--newpage" end="$" contains=tppNewPageOption syn region tppPageLocalOption start="^--\%(heading\|center\|right\|huge\|sethugefont\|exec\)" end="$" contains=tppPageLocalOptionKey oneline syn region tppAbstractOption start="^--\%(author\|title\|date\|footer\)" end="$" contains=tppAbstractOptionKey oneline -if main_syntax != 'sh' +if main_syntax !=# 'sh' " shell command syn include @tppShExec syntax/sh.vim unlet b:current_syntax @@ -78,6 +78,6 @@ hi def link tppNewPageOption Error hi def link tppTimeOption Error -let b:current_syntax = "tpp" +let b:current_syntax = 'tpp' " vim: ts=8 sw=2 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/upstreamrpt.vim b/runtime/syntax/upstreamrpt.vim index 170fc8f509..21c25633a2 100644 --- a/runtime/syntax/upstreamrpt.vim +++ b/runtime/syntax/upstreamrpt.vim @@ -307,4 +307,4 @@ hi def link upstreamdat_Parameter Type "hi def link upstreamdat_Filespec Underlined hi def link upstreamdat_Comment Comment -let b:current_syntax = "upstreamdat" +let b:current_syntax = "upstreamrpt" 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 444b6d8d17..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" @@ -273,7 +273,7 @@ syn match vimEnvvar "\${\I\i*}" syn region vimEscapeBrace oneline contained transparent start="[^\\]\(\\\\\)*\[\zs\^\=\]\=" skip="\\\\\|\\\]" end="]"me=e-1 syn match vimPatSepErr contained "\\)" syn match vimPatSep contained "\\|" -syn region vimPatSepZone oneline contained matchgroup=vimPatSepZ start="\\%\=\ze(" skip="\\\\" end="\\)\|[^\]['"]" contains=@vimStringGroup +syn region vimPatSepZone oneline contained matchgroup=vimPatSepZ start="\\%\=\ze(" skip="\\\\" end="\\)\|[^\\]['"]" contains=@vimStringGroup syn region vimPatRegion contained transparent matchgroup=vimPatSepR start="\\[z%]\=(" end="\\)" contains=@vimSubstList oneline syn match vimNotPatSep contained "\\\\" syn cluster vimStringGroup contains=vimEscapeBrace,vimPatSep,vimNotPatSep,vimPatSepErr,vimPatSepZone,@Spell @@ -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/syntax/yacc.vim b/runtime/syntax/yacc.vim index 8d5eb13071..3f27bce443 100644 --- a/runtime/syntax/yacc.vim +++ b/runtime/syntax/yacc.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: Yacc " Maintainer: Charles E. Campbell <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Aug 31, 2016 -" Version: 15 +" Last Change: Mar 25, 2019 +" Version: 16 " URL: http://www.drchip.org/astronaut/vim/index.html#SYNTAX_YACC " " Options: {{{1 @@ -43,12 +43,12 @@ syn cluster yaccRulesCluster contains=yaccNonterminal,yaccString " --------------------------------------------------------------------- " Yacc Sections: {{{1 -SynFold syn region yaccInit start='.'ms=s-1,rs=s-1 matchgroup=yaccSectionSep end='^%%$'me=e-2,re=e-2 contains=@yaccInitCluster nextgroup=yaccRules skipwhite skipempty contained -SynFold syn region yaccInit2 start='\%^.'ms=s-1,rs=s-1 matchgroup=yaccSectionSep end='^%%$'me=e-2,re=e-2 contains=@yaccInitCluster nextgroup=yaccRules skipwhite skipempty -SynFold syn region yaccHeader2 matchgroup=yaccSep start="^\s*\zs%{" end="^\s*%}" contains=@yaccCode nextgroup=yaccInit skipwhite skipempty contained -SynFold syn region yaccHeader matchgroup=yaccSep start="^\s*\zs%{" end="^\s*%}" contains=@yaccCode nextgroup=yaccInit skipwhite skipempty -SynFold syn region yaccRules matchgroup=yaccSectionSep start='^%%$' end='^%%$'me=e-2,re=e-2 contains=@yaccRulesCluster nextgroup=yaccEndCode skipwhite skipempty contained -SynFold syn region yaccEndCode matchgroup=yaccSectionSep start='^%%$' end='\%$' contains=@yaccCode contained +SynFold syn region yaccInit start='.'ms=s-1,rs=s-1 matchgroup=yaccSectionSep end='^%%\ze\(\s*/[*/].*\)\=$'me=e-2,re=e-2 contains=@yaccInitCluster nextgroup=yaccRules skipwhite skipempty contained +SynFold syn region yaccInit2 start='\%^.'ms=s-1,rs=s-1 matchgroup=yaccSectionSep end='^%%\ze\(\s*/[*/].*\)\=$'me=e-2,re=e-2 contains=@yaccInitCluster nextgroup=yaccRules skipwhite skipempty +SynFold syn region yaccHeader2 matchgroup=yaccSep start="^\s*\zs%{" end="^\s*%}" contains=@yaccCode nextgroup=yaccInit skipwhite skipempty contained +SynFold syn region yaccHeader matchgroup=yaccSep start="^\s*\zs%{" end="^\s*%}" contains=@yaccCode nextgroup=yaccInit skipwhite skipempty +SynFold syn region yaccRules matchgroup=yaccSectionSep start='^%%\ze\(\s*/[*/].*\)\=$' end='^%%\ze\(\s*/[*/].*\)\=$'me=e-2,re=e-2 contains=@yaccRulesCluster nextgroup=yaccEndCode skipwhite skipempty contained +SynFold syn region yaccEndCode matchgroup=yaccSectionSep start='^%%\ze\(\s*/[*/].*\)\=$' end='\%$' contains=@yaccCode contained " --------------------------------------------------------------------- " Yacc Commands: {{{1 @@ -72,6 +72,7 @@ syn match yaccType "<[a-zA-Z_][a-zA-Z0-9_]*>" contains=yaccBrkt contained SynFold syn region yaccNonterminal start="^\s*\a\w*\ze\_s*\(/\*\_.\{-}\*/\)\=\_s*:" matchgroup=yaccDelim end=";" matchgroup=yaccSectionSep end='^%%$'me=e-2,re=e-2 contains=yaccAction,yaccDelim,yaccString,yaccComment contained syn region yaccComment start="/\*" end="\*/" +syn region yaccComment start="//" end="$" syn match yaccString "'[^']*'" contained 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' |