diff --git a/runtime/autoload/netrw.vim b/runtime/autoload/netrw.vim index 6c9938d8bb..c9f66f7927 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: Mar 15, 2023 -" Version: 172 +" Date: May 03, 2023 +" Version: 173 " Maintainer: Charles E Campbell " GetLatestVimScripts: 1075 1 :AutoInstall: netrw.vim " Copyright: Copyright (C) 2016 Charles E. Campbell {{{1 @@ -43,7 +43,7 @@ if exists("s:needspatches") endfor endif -let g:loaded_netrw = "v172" +let g:loaded_netrw = "v173" if !exists("s:NOTE") let s:NOTE = 0 let s:WARNING = 1 @@ -5694,7 +5694,7 @@ fun! s:NetrwEditBuf(bufnum) exe "sil! NetrwKeepj keepalt noswapfile b ".fnameescape(a:bufnum) else " call Decho("exe sil! NetrwKeepj noswapfile b ".fnameescape(a:bufnum)) - exe "sil! NetrwKeepj noswapfile b ".fnameescape(a:bufnume) + exe "sil! NetrwKeepj noswapfile b ".fnameescape(a:bufnum) endif " call Dret("s:NetrwEditBuf") endfun diff --git a/runtime/autoload/netrwSettings.vim b/runtime/autoload/netrwSettings.vim index a910d18be8..d65f83144e 100644 --- a/runtime/autoload/netrwSettings.vim +++ b/runtime/autoload/netrwSettings.vim @@ -19,7 +19,7 @@ if exists("g:loaded_netrwSettings") || &cp finish endif -let g:loaded_netrwSettings = "v18a" +let g:loaded_netrwSettings = "v18" if v:version < 700 echohl WarningMsg echo "***warning*** this version of netrwSettings needs vim 7.0" diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 39448e23a6..7acc764644 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1888,7 +1888,7 @@ execute({command} [, {silent}]) *execute()* The default is "silent". Note that with "silent!", unlike `:redir`, error messages are dropped. - To get a list of lines use |split()| on the result: > + To get a list of lines use `split()` on the result: > execute('args')->split("\n") < This function is not available in the |sandbox|. @@ -6137,17 +6137,20 @@ prompt_setcallback({buf}, {expr}) *prompt_setcallback()* that was entered at the prompt. This can be an empty string if the user only typed Enter. Example: > - call prompt_setcallback(bufnr(''), function('s:TextEntered')) func s:TextEntered(text) if a:text == 'exit' || a:text == 'quit' stopinsert + " Reset 'modified' to allow the buffer to be closed. + " We assume there is nothing useful to be saved. + set nomodified close else + " Do something useful with "a:text". In this example + " we just repeat it. call append(line('$') - 1, 'Entered: "' .. a:text .. '"') - " Reset 'modified' to allow the buffer to be closed. - set nomodified endif endfunc + call prompt_setcallback(bufnr(), function('s:TextEntered')) < Can also be used as a |method|: > GetBuffer()->prompt_setcallback(callback) @@ -9294,7 +9297,7 @@ win_execute({id}, {command} [, {silent}]) *win_execute()* The window will temporarily be made the current window, without triggering autocommands or changing directory. When executing {command} autocommands will be triggered, this may - have unexpected side effects. Use |:noautocmd| if needed. + have unexpected side effects. Use `:noautocmd` if needed. Example: > call win_execute(winid, 'syntax enable') < Doing the same with `setwinvar()` would not trigger diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt index 7b20bab0d4..a96c9fcc0a 100644 --- a/runtime/doc/if_pyth.txt +++ b/runtime/doc/if_pyth.txt @@ -110,26 +110,16 @@ to the next, just like the Python REPL. *script-here* When using a script language in-line, you might want to skip this when the -language isn't supported. Note that this mechanism doesn't work: +language isn't supported. >vim if has('python') python << EOF - this will NOT work! + print("python works") EOF endif - -Instead, put the Python command in a function and call that function: ->vim - if has('python') - function DefPython() - python << EOF - this works - EOF - endfunction - call DefPython() - endif - -Note that "EOF" must be at the start of the line. +< +Note that "EOF" must be at the start of the line without preceding white +space. ============================================================================== The vim module *python-vim* diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index 37158e2e76..ad7901b962 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1730,8 +1730,12 @@ remains unmodified. Also see |f-args-example| below. Overview: XX a\\\ b 'a\ b' XX a\\\\b 'a\\b' XX a\\\\ b 'a\\', 'b' + XX [nothing] +Note that if the "no arguments" situation is to be handled, you have to make +sure that the function can be called without arguments. + Examples for user commands: > " Delete everything after here to the end diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 9f5a089434..c1e0bccfd3 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -706,6 +706,9 @@ A jump table for the options with a short description can be found at |Q_op|. 'autowriteall' for that. Some buffers will not be written, specifically when 'buftype' is "nowrite", "nofile", "terminal" or "prompt". + USE WITH CARE: If you make temporary changes to a buffer that you + don't want to be saved this option may cause it to be saved anyway. + Renaming the buffer with ":file {name}" may help avoid this. *'autowriteall'* *'awa'* *'noautowriteall'* *'noawa'* 'autowriteall' 'awa' boolean (default off) diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 78e2035ad1..276041caac 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -208,7 +208,7 @@ EXTERNAL APPLICATIONS AND PROTOCOLS *netrw-externapp* {{{2 http: g:netrw_http_cmd = "links" elseif links is available http: g:netrw_http_cmd = "curl" elseif curl is available http: g:netrw_http_cmd = "wget" elseif wget is available - http: g:netrw_http_cmd = "fetch" elseif fetch is available + 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" (see |g:netrw_rsync_sep|) @@ -968,7 +968,7 @@ itself: fun! NetReadFixup(method, line1, line2) if method == 3 " ftp (no <.netrc>) let fourblanklines= line2 - 3 - silent fourblanklines.",".line2."g/^\s*/d" + silent fourblanklines .. "," .. line2 .. "g/^\s*/d" endif endfunction endif @@ -1625,8 +1625,10 @@ A further approach is to delete files which match a pattern. This will cause the matching files to be marked. Then, press "D". -Please note that only empty directories may be deleted with the "D" mapping. -Regular files are deleted with |delete()|, too. +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 @@ -1645,7 +1647,8 @@ to remove it again using the g:netrw_rmf_cmd variable. Its default value is: |g:netrw_rmf_cmd|: ssh HOSTNAME rm -f Related topics: |netrw-d| -Associated setting variable: |g:netrw_rm_cmd| |g:netrw_ssh_cmd| +Associated setting variable: |g:netrw_localrmdir| |g:netrw_rm_cmd| + |g:netrw_rmdir_cmd| |g:netrw_ssh_cmd| *netrw-explore* *netrw-hexplore* *netrw-nexplore* *netrw-pexplore* @@ -1688,11 +1691,7 @@ DIRECTORY EXPLORATION COMMANDS {{{2 to 2; edits will thus preferentially be made in window#2. The [N] specifies a |g:netrw_winsize| just for the new :Lexplore - window. That means that - if [N] < 0 : use |N| columns for the Lexplore window - if [N] = 0 : a normal split is made - if [N] > 0 : use N% of the current window will be used for the - new window + window. Those who like this method often also like tree style displays; see |g:netrw_liststyle|. @@ -1976,7 +1975,7 @@ To use this function, simply assign its output to |g:netrw_list_hide| option. > Example: let g:netrw_list_hide= netrw_gitignore#Hide('my_gitignore_file') Function can take additional files with git-ignore patterns. - Example: g:netrw_list_hide= netrw_gitignore#Hide() . '.*\.swp$' + Example: let g:netrw_list_hide= netrw_gitignore#Hide() .. '.*\.swp$' Combining 'netrw_gitignore#Hide' with custom patterns. < @@ -2854,6 +2853,14 @@ your browsing preferences. (see also: |netrw-settings|) =" /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_maxfilenamelen* =32 by default, selected so as to make long listings fit on 80 column displays. If your screen is wider, and you have file @@ -3764,7 +3771,7 @@ Example: Clear netrw's marked file list via a mapping on gu > Netrw uses several system level commands to do things (see |g:netrw_localcopycmd|, |g:netrw_localmovecmd|, - |g:netrw_mkdir_cmd|). + |g:netrw_localrmdir|, |g:netrw_mkdir_cmd|). You may need to adjust the default commands for one or more of these commands by setting them properly in your .vimrc. Another @@ -3890,13 +3897,8 @@ netrw: ============================================================================== 12. History *netrw-history* {{{1 - v172: Sep 02, 2021 * (Bram Moolenaar) Changed "l:go" to "go" - * (Bram Moolenaar) no need for "b" in - netrw-safe guioptions - Nov 15, 2021 * removed netrw_localrm and netrw_localrmdir - references - Aug 18, 2022 * (Miguel Barro) improving compatability with - powershell + v172: Apr 22, 2023 * removed g:netrw_localrmdiropt + removed g:netrw_localrmdir v171: Oct 09, 2020 * included code in s:NetrwOptionsSafe() to allow |'bh'| to be set to delete when rather than hide when g:netrw_fastbrowse @@ -3981,8 +3983,10 @@ netrw: 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 + |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 @@ -4042,7 +4046,7 @@ netrw: refreshes. However, inside a |:map-|, tab and window changes are disallowed. Fixed. (affects netrw's s:LocalBrowseRefresh()) - * g:netrw_localrmdir not used any more, but + * |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|; diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 8644ce4b38..b6cb126c3b 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -56,7 +56,7 @@ Using the underscore after `:d` avoids clobbering registers or the clipboard. This also makes it faster. Instead of the '/' which surrounds the {pattern}, you can use any other -single byte character, but not an alphabetic character, '\', '"' or '|'. +single byte character, but not an alphabetic character, '\', '"', '|' or '!'. This is useful if you want to include a '/' in the search pattern or replacement string. diff --git a/runtime/doc/testing.txt b/runtime/doc/testing.txt index ef5e179c86..2c1c77a51d 100644 --- a/runtime/doc/testing.txt +++ b/runtime/doc/testing.txt @@ -54,13 +54,14 @@ assert_beeps({cmd}) *assert_beeps()* assert_equal({expected}, {actual} [, {msg}]) When {expected} and {actual} are not equal an error message is added to |v:errors| and 1 is returned. Otherwise zero is - returned |assert-return|. + returned. |assert-return| + The error is in the form "Expected {expected} but got + {actual}". When {msg} is present it is prefixed to that. + There is no automatic conversion, the String "4" is different from the Number 4. And the number 4 is different from the Float 4.0. The value of 'ignorecase' is not used here, case always matters. - When {msg} is omitted an error in the form "Expected - {expected} but got {actual}" is produced. Example: > assert_equal('foo', 'bar') < Will result in a string to be added to |v:errors|: @@ -134,11 +135,12 @@ assert_fails({cmd} [, {error} [, {msg} [, {lnum} [, {context}]]]]) assert_false({actual} [, {msg}]) *assert_false()* When {actual} is not false an error message is added to |v:errors|, like with |assert_equal()|. + The error is in the form "Expected False but got {actual}". + When {msg} is present it is prepended to that. Also see |assert-return|. + A value is false when it is zero. When {actual} is not a number the assert fails. - When {msg} is omitted an error in the form - "Expected False but got {actual}" is produced. Can also be used as a |method|: > GetResult()->assert_false() @@ -147,14 +149,16 @@ assert_inrange({lower}, {upper}, {actual} [, {msg}]) *assert_inrange()* 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. + The error is in the form "Expected range {lower} - {upper}, + but got {actual}". When {msg} is present it is prefixed to + that. *assert_match()* assert_match({pattern}, {actual} [, {msg}]) When {pattern} does not match {actual} an error message is added to |v:errors|. Also see |assert-return|. + The error is in the form "Pattern {pattern} does not match + {actual}". When {msg} is present it is prefixed to that. {pattern} is used as with |expr-=~|: The matching is always done like 'magic' was set and 'cpoptions' is empty, no matter what @@ -164,8 +168,6 @@ assert_match({pattern}, {actual} [, {msg}]) Use "^" and "$" to match with the start and end of the text. Use both to match the whole text. - When {msg} is omitted an error in the form - "Pattern {pattern} does not match {actual}" is produced. Example: > assert_match('^f.*o$', 'foobar') < Will result in a string to be added to |v:errors|: @@ -215,8 +217,7 @@ assert_true({actual} [, {msg}]) *assert_true()* Also see |assert-return|. A value is |TRUE| when it is a non-zero number or |v:true|. When {actual} is not a number or |v:true| the assert fails. - When {msg} is omitted an error in the form "Expected True but - got {actual}" is produced. + When {msg} is given it precedes the default message. Can also be used as a |method|: > GetResult()->assert_true() diff --git a/runtime/doc/usr_01.txt b/runtime/doc/usr_01.txt index f0e2462fae..6b94806941 100644 --- a/runtime/doc/usr_01.txt +++ b/runtime/doc/usr_01.txt @@ -81,7 +81,7 @@ from within nvim. The tutorial will lead you from that point. Have fun! ============================================================================== *01.4* Copyright *manual-copyright* -The Vim user manual and reference manual are Copyright (c) 1988-2003 by Bram +The Vim user manual and reference manual are Copyright (c) 1988 by Bram Moolenaar. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later. The latest version is presently available at: diff --git a/runtime/ftplugin/luau.vim b/runtime/ftplugin/luau.vim new file mode 100644 index 0000000000..458d0b05a9 --- /dev/null +++ b/runtime/ftplugin/luau.vim @@ -0,0 +1,14 @@ +" Vim filetype plugin file +" Language: Luau +" Maintainer: None yet +" Last Change: 2023 Apr 30 + +if exists("b:did_ftplugin") + finish +endif + +" Luau is a superset of Lua +runtime! ftplugin/lua.vim + + +" vim: nowrap sw=2 sts=2 ts=8 diff --git a/runtime/ftplugin/usd.vim b/runtime/ftplugin/usd.vim new file mode 100644 index 0000000000..c795ba591b --- /dev/null +++ b/runtime/ftplugin/usd.vim @@ -0,0 +1,18 @@ +" Vim filetype plugin file +" Language: Pixar Animation's Universal Scene Description format +" Maintainer: Colin Kennedy +" Last Change: 2023 May 9 + +if exists("b:did_ftplugin") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +let b:did_ftplugin = 1 + +setlocal commentstring=#\ %s + +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/runtime/indent/dts.vim b/runtime/indent/dts.vim new file mode 100644 index 0000000000..e87f8153c7 --- /dev/null +++ b/runtime/indent/dts.vim @@ -0,0 +1,63 @@ +" Vim indent file +" Language: Device Tree +" Maintainer: Roland Hieber, Pengutronix +" +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal autoindent +setlocal nosmartindent +setlocal indentkeys=o,O,0},0<>>,! +setlocal indentexpr=GetDTSIndent() +setlocal nolisp + +let b:undo_indent = 'setl autoindent< smartindent< indentkeys< indentexpr< lisp<' + +function GetDTSIndent() + let sw = shiftwidth() + let lnum = v:lnum + let line = getline(lnum) + let prevline = getline(prevnonblank(lnum-1)) + let prevind = indent(prevnonblank(lnum-1)) + + if prevnonblank(lnum-1) < 1 + return 0 + endif + + " Don't indent header and preprocessor directives + if line =~ '^\s*\(/dts-\|#\(include\|define\|undef\|warn\(ing\)\?\|error\|if\(n\?def\)\?\|else\|elif\|endif\)\)' + return 0 + + " Don't indent /node and &label blocks + elseif line =~ '^\s*[/&].\+{\s*$' + return 0 + + " Indent to matching bracket or remove one shiftwidth if line begins with } or > + elseif line =~ '^\s*[}>]' + " set cursor to closing bracket on current line + let col = matchend(line, '^\s*[>}]') + call cursor(lnum, col) + + " determine bracket type, {} or <> + let pair = strpart('{}<>', stridx('}>', line[col-1]) * 2, 2) + + " find matching bracket pair + let pairline = searchpair(pair[0], '', pair[1], 'bW') + + if pairline > 0 + return indent(pairline) + else + return prevind - sw + endif + + " else, add one level of indent if line ends in { or < or = or , + elseif prevline =~ '[{<=,]$' + return prevind + sw + + else + return prevind + endif + +endfunction diff --git a/runtime/indent/luau.vim b/runtime/indent/luau.vim new file mode 100644 index 0000000000..69893f7399 --- /dev/null +++ b/runtime/indent/luau.vim @@ -0,0 +1,14 @@ +" Vim filetype indent file +" Language: Luau +" Maintainer: None yet +" Last Change: 2023 Apr 30 + +" Only load this indent file when no other was loaded. +if exists("b:did_indent") + finish +endif + +" Luau is a superset of Lua +runtime! indent/lua.vim + + diff --git a/runtime/indent/testdir/dts.in b/runtime/indent/testdir/dts.in new file mode 100644 index 0000000000..64e56e9017 --- /dev/null +++ b/runtime/indent/testdir/dts.in @@ -0,0 +1,46 @@ +/* vim: set ft=dts noet sw=8 : */ + +/* START_INDENT */ +/dts-v1/; +#include + #include "imx6qdl.dtsi" +#include "imx6qdl-someboard.dtsi" + + /delete-node/ &{/memory@10000000}; + + / { +compatible = "some,board"; +/delete-node/ memory; + + chosen { +environment = &{usdhc4/partitions/partition@0}; +}; +} + + &iomuxc { +pinctrl-names = "default"; +pinctrl-0 = <&pinctrl_hog>; + +pinctrl_gpiohog: gpiohoggrp { +fsl,pins = < +MX6QDL_PAD_GPIO_9__GPIO1_IO09 0x130b0 +MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x130b0 +>; +}; +} + +&usdhc4 { +partitions { +compatible = "fixed-partitions"; + +partition@0 { +label = "environment"; +reg = <0x0 0xe0000>; +}; +}; +}; + +&{/aliases} { +usb0 = &usb; +}; +/* END_INDENT */ diff --git a/runtime/indent/testdir/dts.ok b/runtime/indent/testdir/dts.ok new file mode 100644 index 0000000000..d249766fd4 --- /dev/null +++ b/runtime/indent/testdir/dts.ok @@ -0,0 +1,46 @@ +/* vim: set ft=dts noet sw=8 : */ + +/* START_INDENT */ +/dts-v1/; +#include +#include "imx6qdl.dtsi" +#include "imx6qdl-someboard.dtsi" + +/delete-node/ &{/memory@10000000}; + +/ { + compatible = "some,board"; + /delete-node/ memory; + + chosen { + environment = &{usdhc4/partitions/partition@0}; + }; +} + +&iomuxc { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_hog>; + + pinctrl_gpiohog: gpiohoggrp { + fsl,pins = < + MX6QDL_PAD_GPIO_9__GPIO1_IO09 0x130b0 + MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x130b0 + >; + }; +} + +&usdhc4 { + partitions { + compatible = "fixed-partitions"; + + partition@0 { + label = "environment"; + reg = <0x0 0xe0000>; + }; + }; +}; + +&{/aliases} { + usb0 = &usb; +}; +/* END_INDENT */ diff --git a/runtime/menu.vim b/runtime/menu.vim index 2671bb51cb..d6f22b314c 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 -" Last Change: 2022 Nov 27 +" Last Change: 2023 May 03 " 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. @@ -599,7 +599,9 @@ func s:XxdBack() exe ':%!' . g:xxdprogram . ' -r' endif set ft= - doautocmd filetypedetect BufReadPost + if exists('#filetypedetect') && exists('#BufReadPost') + doautocmd filetypedetect BufReadPost + endif let &mod = mod endfun diff --git a/runtime/plugin/netrwPlugin.vim b/runtime/plugin/netrwPlugin.vim index 431d9ad9c4..a347781e6f 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 = "v172" +let g:loaded_netrwPlugin = "v173" let s:keepcpo = &cpo set cpo&vim "DechoRemOn diff --git a/runtime/syntax/dts.vim b/runtime/syntax/dts.vim index be51ab5b10..bb7eff7be1 100644 --- a/runtime/syntax/dts.vim +++ b/runtime/syntax/dts.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: dts/dtsi (device tree files) " Maintainer: Daniel Mack -" Last Change: 2022 Jun 14 +" Last Change: 2023 Apr 28 if exists("b:current_syntax") finish @@ -10,9 +10,10 @@ let b:current_syntax = 'dts' syntax region dtsComment start="/\*" end="\*/" syntax match dtsReference "&[[:alpha:][:digit:]_]\+" +syntax match dtsReference "&{[[:alpha:][:digit:]@_/-]\+}" syntax region dtsBinaryProperty start="\[" end="\]" syntax match dtsStringProperty "\".*\"" -syntax match dtsKeyword "/.\{-1,\}/" +syntax match dtsKeyword "/[[:alpha:][:digit:]-]\+/\([[:space:]]\|;\)"he=e-1 syntax match dtsLabel "^[[:space:]]*[[:alpha:][:digit:]_]\+:" syntax match dtsNode /[[:alpha:][:digit:]-_]\+\(@[0-9a-fA-F]\+\|\)[[:space:]]*{/he=e-1 syntax region dtsCellProperty start="<" end=">" contains=dtsReference,dtsBinaryProperty,dtsStringProperty,dtsComment diff --git a/runtime/syntax/luau.vim b/runtime/syntax/luau.vim new file mode 100644 index 0000000000..59eccac100 --- /dev/null +++ b/runtime/syntax/luau.vim @@ -0,0 +1,15 @@ +" Vim syntax file +" Language: Luau +" Maintainer: None yet +" Last Change: 2023 Apr 30 + +if exists("b:current_syntax") + finish +endif + +" Luau is a superset of lua +runtime! syntax/lua.vim + +let b:current_syntax = "luau" + +" vim: nowrap sw=2 sts=2 ts=8 noet: diff --git a/runtime/syntax/nasm.vim b/runtime/syntax/nasm.vim index d763033225..0eb82fad10 100644 --- a/runtime/syntax/nasm.vim +++ b/runtime/syntax/nasm.vim @@ -3,8 +3,12 @@ " Maintainer: Andrii Sokolov " Original Author: Manuel M.H. Stol " Former Maintainer: Manuel M.H. Stol -" Contributors: Leonard König (C string highlighting), Peter Stanhope (Add missing 64-bit mode registers) -" Last Change: 2017 Jan 23 +" Contributors: +" Leonard König (C string highlighting), +" Peter Stanhope (Add missing 64-bit mode registers) +" Frédéric Hamel (F16c support, partial AVX +" support, other) +" Last Change: 2022 May 3 " NASM Home: http://www.nasm.us/ @@ -277,7 +281,7 @@ syn match nasmInstrModifier "\"lc=5,ms= " NAsm directives syn keyword nasmRepeat TIMES syn keyword nasmDirective ALIGN[B] INCBIN EQU NOSPLIT SPLIT -syn keyword nasmDirective ABSOLUTE BITS SECTION SEGMENT +syn keyword nasmDirective ABSOLUTE BITS SECTION SEGMENT DEFAULT syn keyword nasmDirective ENDSECTION ENDSEGMENT syn keyword nasmDirective __SECT__ " Macro created standard directives: (requires %include) @@ -309,7 +313,7 @@ syn match nasmStdInstruction "\<\(CMOV\|J\|SET\)\(N\=\([ABGL]E\=\|[CEOSZ]\)\|P syn match nasmStdInstruction "\" syn keyword nasmStdInstruction AAA AAD AAM AAS ADC ADD AND syn keyword nasmStdInstruction BOUND BSF BSR BSWAP BT[C] BTR BTS -syn keyword nasmStdInstruction CALL CBW CDQ CLC CLD CMC CMP CMPSB CMPSD CMPSW CMPSQ +syn keyword nasmStdInstruction CALL CBW CDQ CDQE CLC CLD CMC CMP CMPSB CMPSD CMPSW CMPSQ syn keyword nasmStdInstruction CMPXCHG CMPXCHG8B CPUID CWD[E] CQO syn keyword nasmStdInstruction DAA DAS DEC DIV ENTER syn keyword nasmStdInstruction IDIV IMUL INC INT[O] IRET[D] IRETW IRETQ @@ -319,6 +323,7 @@ syn keyword nasmStdInstruction LODSW LOOP[E] LOOPNE LOOPNZ LOOPZ LSS syn keyword nasmStdInstruction MOVSB MOVSD MOVSW MOVSX MOVSQ MOVZX MUL NEG NOP NOT syn keyword nasmStdInstruction OR POPA[D] POPAW POPF[D] POPFW POPFQ syn keyword nasmStdInstruction PUSH[AD] PUSHAW PUSHF[D] PUSHFW PUSHFQ +syn keyword nasmStdInstruction PAUSE syn keyword nasmStdInstruction RCL RCR RETF RET[N] ROL ROR syn keyword nasmStdInstruction SAHF SAL SAR SBB SCASB SCASD SCASW syn keyword nasmStdInstruction SHL[D] SHR[D] STC STD STOSB STOSD STOSW STOSQ SUB @@ -405,6 +410,62 @@ syn keyword nasmSseInstruction ORPS RCPPS RCPSS RSQRTPS RSQRTSS syn keyword nasmSseInstruction SHUFPS SQRTPS SQRTSS STMXCSR SUBPS SUBSS syn keyword nasmSseInstruction UCOMISS UNPCKHPS UNPCKLPS XORPS +" F16c Instructions +syn keyword nasmF16CInstruction VCVTPH2PS VCVTPS2PH + +" AVX Instructions +syn keyword nasmAVXInstruction VCVTDQ2PD VCVTDQ2PS VCVTPD2DQ VCVTPD2P VCVTPD2PS +syn keyword nasmAVXInstruction VCVTPS2DQ VCVTPS2PD +syn keyword nasmAVXInstruction VCVTSD2SI VCVTSD2SS VCVTSI2SD VCVTSI2SS VCVTSS2SD VCVTSS2SI +syn keyword nasmAVXInstruction VMAXPS VMAXSS VMINPS VMINSS VMOVAPS VMOVHLPS VMOVHPS +syn keyword nasmAVXInstruction VMAXPD VMAXSD VMINPD VMINSD VMOVAPD VMOVHLPD VMOVHPD +syn keyword nasmAVXInstruction VMOVLHPS VMOVLPS VMOVMSKPS VMOVNTPS VMOVSS VMOVUPS +syn keyword nasmAVXInstruction VMULPS VMULSS VPXOR + +syn match nasmInstructnError "\" +syn match nasmAVXInstruction "\" + +syn keyword nasmAVXInstruction VORPS VPABSB VPABSD VPABSW +syn keyword nasmAVXInstruction PACKSSDW VPACKSSWB VPACKUSDW VPACKUSWB VPADDD +syn keyword nasmAVXInstruction PADDQ VPADDSB VPADDSW VPADDUSB VPADDUSW +syn keyword nasmAVXInstruction PADDW VPALIGNR VPAND VPANDN VPAVGB +syn keyword nasmAVXInstruction PAVGW VPBLENDD VPBLENDVB VPBLENDW VPBROADCASTB +syn keyword nasmAVXInstruction PBROADCASTD VPBROADCASTQ VPBROADCASTW VPCLMULQDQ VPCMOV +syn keyword nasmAVXInstruction PCMPEQB VPCMPEQD VPCMPEQQ VPCMPEQW VPCMPESTRI +syn keyword nasmAVXInstruction PCMPESTRM VPCMPGTB VPCMPGTD VPCMPGTQ VPCMPGTW +syn keyword nasmAVXInstruction PCMPISTRI VPCMPISTRM VPCOMB VPCOMD VPCOMQ +syn keyword nasmAVXInstruction PCOMUB VPCOMUD VPCOMUQ VPCOMUW VPCOMW +syn keyword nasmAVXInstruction PERM2FVPERM2IVPERMD VPERMIL2PD VPERMIL2PS VPERMILPD VPERMILPS +syn keyword nasmAVXInstruction PERMPD VPERMPS VPERMQ VPEXTRB VPEXTRD +syn keyword nasmAVXInstruction PEXTRQ VPEXTRW VPGATHERDD VPGATHERDQ VPGATHERQD +syn keyword nasmAVXInstruction PGATHERQQ VPHADDBD VPHADDBQ VPHADDBW VPHADDD +syn keyword nasmAVXInstruction PHADDDQ VPHADDSW VPHADDUBQ VPHADDUBW VPHADDUDQ +syn keyword nasmAVXInstruction PHADDUWD VPHADDUWQ VPHADDW VPHADDWD VPHADDWQ +syn keyword nasmAVXInstruction PHMINPOSUW VPHSUBBW VPHSUBD VPHSUBDQ VPHSUBSW +syn keyword nasmAVXInstruction PHSUBW VPHSUBWD VPINSRB VPINSRD VPINSRQ +syn keyword nasmAVXInstruction PINSRW VPMACSDD VPMACSDQH +syn keyword nasmAVXInstruction VPMACSDQL VPMACSSDD VPMACSSDQL VPMACSSQH VPMACSSWD +syn keyword nasmAVXInstruction VPMACSSWW VPMACSWD VPMACSWW VPMADCSSWD VPMADCSWD +syn keyword nasmAVXInstruction VPMADDUBSW VPMADDWD VPMASKMOVD VPMASKMOVQ VPMAXSB +syn keyword nasmAVXInstruction VPMAXSD VPMAXSW VPMAXUB VPMAXUD VPMAXUW +syn keyword nasmAVXInstruction VPMINSB VPMINSD VPMINSW VPMINUB VPMINUD +syn keyword nasmAVXInstruction VPMINUW VPMOVMSKB VPMOVSXBD VPMOVSXBQ VPMOVSXBW +syn keyword nasmAVXInstruction VPMOVSXDQ VPMOVSXWD VPMOVSXWQ VPMOVZXBD VPMOVZXBQ +syn keyword nasmAVXInstruction VPMOVZXBW VPMOVZXDQ VPMOVZXWD VPMOVZXWQ VPMULDQ +syn keyword nasmAVXInstruction VPMULHRSW VPMULHUW VPMULHW VPMULLD VPMULLW +syn keyword nasmAVXInstruction VPMULUDQ VPOR VPPERM VPROTB VPROTD +syn keyword nasmAVXInstruction VPROTQ VPROTW VPSADBW VPSHAB VPSHAD +syn keyword nasmAVXInstruction VPSHAQ VPSHAW VPSHLB VPSHLD VPSHLQ +syn keyword nasmAVXInstruction VPSHLW VPSHUFB VPSHUFD VPSHUFHW VPSHUFLW +syn keyword nasmAVXInstruction VPSIGNB VPSIGND VPSIGNW VPSLLD VPSLLDQ +syn keyword nasmAVXInstruction VPSLLQ VPSLLVD VPSLLVQ VPSLLW VPSRAD +syn keyword nasmAVXInstruction VPSRAVD VPSRAW VPSRLD VPSRLDQ VPSRLQ +syn keyword nasmAVXInstruction VPSRLVD VPSRLVQ VPSRLW VPSUBB VPSUBD +syn keyword nasmAVXInstruction VPSUBQ VPSUBSB VPSUBSW VPSUBUSB VPSUBUSW +syn keyword nasmAVXInstruction VPSUBW VPTEST VPUNPCKHBW VPUNPCKHDQ VPUNPCKHQDQ +syn keyword nasmAVXInstruction VPUNPCKHWD VPUNPCKLBW VPUNPCKLDQ VPUNPCKLQDQ VPUNPCKLWD +syn keyword nasmAVXInstruction VPXOR VRCPPS + " Three Dimensional Now Packed Instructions: (requires 3DNow! unit) syn keyword nasmNowInstruction FEMMS PAVGUSB PF2ID PFACC PFADD PFCMPEQ PFCMPGE @@ -515,13 +576,14 @@ hi def link nasmDbgInstruction Debug hi def link nasmFpuInstruction Statement hi def link nasmMmxInstruction Statement hi def link nasmSseInstruction Statement +hi def link nasmF16cInstruction Statement +hi def link nasmAVXInstruction Statement hi def link nasmNowInstruction Statement hi def link nasmAmdInstruction Special hi def link nasmCrxInstruction Special hi def link nasmUndInstruction Todo hi def link nasmInstructnError Error - let b:current_syntax = "nasm" " vim:ts=8 sw=4 diff --git a/runtime/syntax/xpm.vim b/runtime/syntax/xpm.vim index be9f38723e..77d82403e9 100644 --- a/runtime/syntax/xpm.vim +++ b/runtime/syntax/xpm.vim @@ -1,10 +1,12 @@ " Vim syntax file " Language: X Pixmap " Maintainer: Ronald Schild -" Last Change: 2021 Oct 04 -" Version: 5.4n.1 +" Last Change: 2023 May 11 +" Version: 5.4n.2 " Jemma Nelson added termguicolors support " Dominique Pellé fixed spelling support +" Christian J. Robinson fixed use of global variables, moved +" loop into a function " quit when a syntax file was already loaded if exists("b:current_syntax") @@ -21,108 +23,119 @@ syn region xpmPixelString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=@xpmCo if has("gui_running") || has("termguicolors") && &termguicolors -let color = "" -let chars = "" -let colors = 0 -let cpp = 0 -let n = 0 -let i = 1 +function s:CreateSyntax() abort + let color = "" + let chars = "" + let colors = 0 + let cpp = 0 + let n = 0 + let lines = getline(1, '$') -while i <= line("$") " scanning all lines + for line in lines " scanning all lines - let s = matchstr(getline(i), '".\{-1,}"') - if s != "" " does line contain a string? + let s = matchstr(line, '".\{-1,}"') - if n == 0 " first string is the Values string + if s != "" " does line contain a string? - " get the 3rd value: colors = number of colors - let colors = substitute(s, '"\s*\d\+\s\+\d\+\s\+\(\d\+\).*"', '\1', '') - " get the 4th value: cpp = number of character per pixel - let cpp = substitute(s, '"\s*\d\+\s\+\d\+\s\+\d\+\s\+\(\d\+\).*"', '\1', '') - if cpp =~ '[^0-9]' - break " if cpp is not made of digits there must be something wrong - endif + if n == 0 " first string is the Values string - " Highlight the Values string as normal string (no pixel string). - " Only when there is no slash, it would terminate the pattern. - if s !~ '/' - exe 'syn match xpmValues /' . s . '/' - endif - hi link xpmValues String + let values = split(s[1 : -2]) - let n = 1 " n = color index + " Values string invalid, bail out + if len(values) != 4 + return + endif - elseif n <= colors " string is a color specification + " get the 3rd value: colors = number of colors + let colors = str2nr(values[2]) + " get the 4th value: cpp = number of character per pixel + let cpp = str2nr(values[3]) - " get chars = length string representing the pixels - " (first incl. the following whitespace) - let chars = substitute(s, '"\(.\{'.cpp.'}\s\).*"', '\1', '') + " these values must be positive, nonzero + if colors < 1 || cpp < 1 + return + endif - " now get color, first try 'c' key if any (color visual) - let color = substitute(s, '".*\sc\s\+\(.\{-}\)\s*\(\(g4\=\|[ms]\)\s.*\)*\s*"', '\1', '') - if color == s - " no 'c' key, try 'g' key (grayscale with more than 4 levels) - let color = substitute(s, '".*\sg\s\+\(.\{-}\)\s*\(\(g4\|[ms]\)\s.*\)*\s*"', '\1', '') + " Highlight the Values string as normal string (no pixel string). + " Only when there is no slash, it would terminate the pattern. + if s !~ '/' + exe 'syn match xpmValues /' .. s .. '/' + endif + hi link xpmValues String + + let n = 1 " n = color index + + elseif n <= colors " string is a color specification + + " get chars = length string representing the pixels + " (first incl. the following whitespace) + let chars = substitute(s, '"\(.\{' .. cpp .. '}\s\).*"', '\1', '') + + " now get color, first try 'c' key if any (color visual) + let color = substitute(s, '".*\sc\s\+\(.\{-}\)\s*\(\(g4\=\|[ms]\)\s.*\)*\s*"', '\1', '') if color == s - " next try: 'g4' key (4-level grayscale) - let color = substitute(s, '".*\sg4\s\+\(.\{-}\)\s*\([ms]\s.*\)*\s*"', '\1', '') + " no 'c' key, try 'g' key (grayscale with more than 4 levels) + let color = substitute(s, '".*\sg\s\+\(.\{-}\)\s*\(\(g4\|[ms]\)\s.*\)*\s*"', '\1', '') if color == s - " finally try 'm' key (mono visual) - let color = substitute(s, '".*\sm\s\+\(.\{-}\)\s*\(s\s.*\)*\s*"', '\1', '') + " next try: 'g4' key (4-level grayscale) + let color = substitute(s, '".*\sg4\s\+\(.\{-}\)\s*\([ms]\s.*\)*\s*"', '\1', '') if color == s - let color = "" + " finally try 'm' key (mono visual) + let color = substitute(s, '".*\sm\s\+\(.\{-}\)\s*\(s\s.*\)*\s*"', '\1', '') + if color == s + let color = "" + endif endif endif endif + + " Vim cannot handle RGB codes with more than 6 hex digits + if color =~ '#\x\{10,}$' + let color = substitute(color, '\(\x\x\)\x\x', '\1', 'g') + elseif color =~ '#\x\{7,}$' + let color = substitute(color, '\(\x\x\)\x', '\1', 'g') + " nor with 3 digits + elseif color =~ '#\x\{3}$' + let color = substitute(color, '\(\x\)\(\x\)\(\x\)', '0\10\20\3', '') + endif + + " escape meta characters in patterns + let s = escape(s, '/\*^$.~[] ') + let chars = escape(chars, '/\*^$.~[] ') + + " now create syntax items + " highlight the color string as normal string (no pixel string) + exe 'syn match xpmCol' .. n .. 'Def /' .. s .. '/ contains=xpmCol' .. n .. 'inDef' + exe 'hi link xpmCol' .. n .. 'Def String' + + " but highlight the first whitespace after chars in its color + exe 'syn match xpmCol' .. n .. 'inDef /"' .. chars .. '/hs=s+' .. (cpp + 1) .. ' contained' + exe 'hi link xpmCol' .. n .. 'inDef xpmColor' .. n + + " remove the following whitespace from chars + let chars = substitute(chars, '.$', '', '') + + " and create the syntax item contained in the pixel strings + exe 'syn match xpmColor' .. n .. ' /' .. chars .. '/ contained' + exe 'syn cluster xpmColors add=xpmColor' .. n + + " if no color or color = "None" show background + if color == "" || substitute(color, '.*', '\L&', '') == 'none' + exe 'hi xpmColor' .. n .. ' guifg=bg' + exe 'hi xpmColor' .. n .. ' guibg=NONE' + elseif color !~ "'" + exe 'hi xpmColor' .. n .. " guifg='" .. color .. "'" + exe 'hi xpmColor' .. n .. " guibg='" .. color .. "'" + endif + let n += 1 + else + break " no more color string endif - - " Vim cannot handle RGB codes with more than 6 hex digits - if color =~ '#\x\{10,}$' - let color = substitute(color, '\(\x\x\)\x\x', '\1', 'g') - elseif color =~ '#\x\{7,}$' - let color = substitute(color, '\(\x\x\)\x', '\1', 'g') - " nor with 3 digits - elseif color =~ '#\x\{3}$' - let color = substitute(color, '\(\x\)\(\x\)\(\x\)', '0\10\20\3', '') - endif - - " escape meta characters in patterns - let s = escape(s, '/\*^$.~[]') - let chars = escape(chars, '/\*^$.~[]') - - " now create syntax items - " highlight the color string as normal string (no pixel string) - exe 'syn match xpmCol'.n.'Def /'.s.'/ contains=xpmCol'.n.'inDef' - exe 'hi link xpmCol'.n.'Def String' - - " but highlight the first whitespace after chars in its color - exe 'syn match xpmCol'.n.'inDef /"'.chars.'/hs=s+'.(cpp+1).' contained' - exe 'hi link xpmCol'.n.'inDef xpmColor'.n - - " remove the following whitespace from chars - let chars = substitute(chars, '.$', '', '') - - " and create the syntax item contained in the pixel strings - exe 'syn match xpmColor'.n.' /'.chars.'/ contained' - exe 'syn cluster xpmColors add=xpmColor'.n - - " if no color or color = "None" show background - if color == "" || substitute(color, '.*', '\L&', '') == 'none' - exe 'hi xpmColor'.n.' guifg=bg' - exe 'hi xpmColor'.n.' guibg=NONE' - elseif color !~ "'" - exe 'hi xpmColor'.n." guifg='".color."'" - exe 'hi xpmColor'.n." guibg='".color."'" - endif - let n = n + 1 - else - break " no more color string endif - endif - let i = i + 1 -endwhile + endfor +endfunction -unlet color chars colors cpp n i s +call s:CreateSyntax() endif " has("gui_running") || has("termguicolors") && &termguicolors