1
0
forked from aniani/vim

217 Commits

Author SHA1 Message Date
dkearns
4ba70cab37
runtime(vim): Update base-syntax, fix nested function folding (#14397)
Only match function folding start and end patterns at the start of a
line, excluding heredocs and :append/:change/:insert commands.

Fixes #14393

Signed-off-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
2024-04-14 20:32:56 +02:00
Doug Kearns
ce06493aeb
runtime(vim): Update base-syntax, add legacy header folding
Allow for syntax-based folding of Vim9 script legacy header regions.

This is enabled with the "H" flag of the g:vimsyn_folding config variable.

closes: #14530

Signed-off-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
2024-04-13 18:24:01 +02:00
dkearns
04e5363b82
runtime(vim): Improve Vim9 and legacy-script comment highlighting (#13104)
This is a first-pass attempt to limit matching of Vim9 and legacy-script
comments to the appropriate syntactic contexts.

Vim9-script comments are highlighted at top level in a Vim9-script file,
in all :def functions, and in all :autocmd and :commmand command blocks.
Legacy-script comments are highlighted at top level in a legacy script
file, in all :func functions and in the Vim9-script preamble before the
:vim9script marker command.

Fixes #13047, #11307 and #9587.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-10 22:18:37 +02:00
dkearns
e43ace558a
runtime(vim): Update base-syntax, no curly-brace names in Vim9 script (#14466)
Remove curly-brace name matching for :def functions.  This is not
supported in Vim9 script.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-09 21:19:41 +02:00
Doug Kearns
a44ced5763
runtime(vim): Update syntax generator, autocmd event list parsing
Track changes to the autocommand event list introduced in commit
78d742a (Patch 9.1.0256).

closes: #14430

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-04-07 17:49:57 +02:00
Aliaksei Budavei
80aabaab66
runtime(vim): Distinguish Vim9 builtin object methods from namesake builtin functions (#14348)
Currently, the overriding object method definitions are
matched as vimFunctionError (:help builtin-object-methods,
v9.1.0148).

For example:
------------------------------------------------------------
vim9script

class Test
	def string(): string
		return "Test"
	enddef
endclass

echo string(Test.new()) == Test.new().string()
------------------------------------------------------------

Instead, let's introduce a new syntax group vimMethodName
and make these methods its members.  In order to emphasise
the link between the overriding methods and the overridden
functions for highlighting, vimMethodName is linked by
default to vimFuncName.

Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-31 18:26:32 +02:00
dkearns
982e191b38
runtime(vim): Update base-syntax, match empty blob and :abclear modifiers (#14318)
- Match empty blob literals.
- Match modifier arguments to :abclear commands.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-28 10:06:03 +01:00
dkearns
76d62985c1
runtime(vim): Update base-syntax, remove old unused syntax groups. (#14146)
Remove old unused syntax groups.

- vimRegion, vimPattern and vimKeyword removed in Vim 5.3.
- vimAuSyntax, vimAutoCmdOpt, vimAutoSet and vimStatement removed in 5.6.

The following were linked in :hi commands but never defined with :syn
and, most likely, never used:
 - vimHLMod introduced in 5.0.
 - vimKeycode and vimKeycodeError introduced in 5.4.
 - vimElseif introduced in 5.6.
 - vimFold introduced in 6.4.
 - vimOperStar (and vimoperStar) introduced in 9.0.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-22 19:55:25 +01:00
dkearns
35e6f4ca27
runtime(vim): Update base-syntax, improve function definition highlighting (#14203)
Improve function definition highlighting.

- Match bang and function modifiers - abort etc.
- Only match valid scope modifiers.
- Match listing commands.
- Don't match ex commands in function names.
- Split function syntax groups into :func and :def subgroups.
- Match Vim9-script parameter and return types.
- Limit legacy-script and Vim9-script comments to :func and :def
  definitions, respectively.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-21 20:41:10 +01:00
dkearns
ec21bafc13
runtime(vim): Update base-syntax, disallow '.' at start of menu item names (#14232)
Disallow '.' at the start of a menu item name.

This is the menu path separator character and should be escaped with a
'\' in this case.

Partially fixes #14230.  "popup" is still incorrectly matched as the Ex
command.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-19 18:04:42 +01:00
dkearns
9530fe4f3a
runtime(vim): Update base-syntax, improve :highlight command (#14228)
Improve :highlight command highlighting

- Use the same highlight groups for "default link" with and without
  bang.
- Match some common line-continuation use.
- Match :hi clear variants.
- Highlight color-name values.

Resync vim.vim and generator/vim.vim.base.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-18 19:19:51 +01:00
dkearns
b4b3d7de24
runtime(vim): Update base-syntax, revert last change to vimUserFunc (#14202)
Fix highlighting of ":echo (expr)" (broken in commit 61887b3) by
re-enabling the original fix for #9987.

Addresses https://github.com/vim/vim/pull/14199#issuecomment-1999732062.

This will be fixed more generally when there is context-sensitive
matching for commands and functions.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-15 18:53:53 +01:00
dkearns
61887b3d6f
runtime(vim): Update base-syntax, improve :echo and :execute highlighting (#14199)
Improve :echo and :execute highlighting.

- Add better line-continuation support for both commands.
- Improve the :execute command's expression argument matching.
- Remove the fix for issue #9987 as this is now handled by correctly
  matching the parens in :echo (...) as operator parens.


Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-15 12:45:48 +00:00
dkearns
5cd86c6cff
runtime(vim): Update base-syntax, improve number matching (#14175)
- Limit blob literals to an even number of hexadecimal digits and
  correctly located dots.
- Match octal numbers.

The current version unsuccessfully attempts to match a leading '-' as
part of the float literal.  It's actually parsed as part of the literal
for all numbers but the syntax file hasn't matched it like that for a
long time and highlights negative numbers as UNARY-MINUS NUMBER.  This
will be fixed when better expression matching is implemented.


Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-11 21:40:58 +01:00
dkearns
5d67aef306
runtime(vim): Update base-syntax, improve :map highlighting (#14141)
Improve :map command highlighting.

- Fix multiline RHS matching, allow continued lines and comments.
- Allow ^V-escaped whitespace in LHS.
- Handle map-bar properly and allow trailing commands.

Fixes issue #12672.


Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-09 18:01:22 +01:00
dkearns
62b26040eb
runtime(vim): Update base-syntax, improve :menu{,translate} highlighting (#14162)
Improve :menu and :menutranslate highlighting.

- Match args to :menutranslation and :popup.
- Only highlight special notation in {rhs} of :menu, like :map.
- Allow line continuations in {rhs} of :menu and between {english} and
  {mylang} of :menutranslation, matching common usage.
- Bug fixes.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-09 17:43:28 +01:00
dkearns
e5c9ba6015
runtime(vim): Update base-syntax, fix escaping :syn and :hi sub-groups (#14137)
* runtime(vim): Update base-syntax, fix escaping :syn and :hi sub-groups

- Remove contained :syntax and :highlight sub-groups from the function
  body cluster.  These should only match in the respective commands.
- Remove vimSynLine syntax group from several clusters.  The definition
  of vimSynLine was removed in Vim 5.3.

* runtime(vim): Update syntax generator, use standard Last Change date format

The de facto standard date format is YYYY MMM DD.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-04 19:15:42 +01:00
dkearns
691aee8b07
runtime(vim): Update base-syntax, fix issue #14135 (#14136)
Fix incorrect error highlighting for function calls in :command
definitions.  vimFunctionError should be restricted to :function header
lines.

fixes: #14135

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-03 19:02:47 +01:00
dkearns
c4aef9a97b
runtime(vim): Update base-syntax, improve :augroup highlighting (#14125)
- Explicitly match the bang and group name in :aug! {name}.
- Allow any characters in a group name.
- Match default group switch marker, END.
- Match :aug without arguments (list command).

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-03-03 16:42:47 +01:00
dkearns
b1427b46f5
runtime(vim): Update base-syntax, improve :echo highlighting (#14103)
- Normalise behaviour of :echo commands and improve expression matching.
- Allow continued argument lines.
- Refine string interpolation groups.
- Remove duplicated :menu and :map generated commands that are handled
  specially later in the file.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-27 19:59:30 +01:00
dkearns
2c51e15b66
runtime(vim): Update syntax file, improve :substitute matching (#14093)
- Differentiate between :substitute and substitute(), fixes #13883.
- Match all allowed :substitute delimiters.
- Remove leading context from :substitute matches.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-26 21:10:18 +01:00
dkearns
1624970d32
runtime(vim): Update base-syntax, fix :unabbrev highlighting (#14077)
Fixes issue #7876

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-22 19:45:05 +01:00
Maxim Kim
9ca335aad2
patch 9.1.0122: Some minor issues with the getregion() function
Problem:  Some minor issues with the getregion() function
Solution: Fix examples in the help, use OP_NOP op_type and MBLOCK
          as motion_type in f_getreg(), update vim syntax to
          for getregion() (Maxim Kim)

```
:xnoremap <CR>
\ <Cmd>echow getregion('v', '.', mode())<CR>
```
`echo` while in visual mode has no visible effect, thus people trying
example might be frustrated as it looks like nothing happens.

So the option is to change it to `echow` or `echom`.
With `echom` it is again has no visible effect but one can at least inspect `:messages`.
On the other hand `echow` showes selected text in a popup window.

```
Can also be used as a |method|: >
'.'->getregion("'a', 'v')
```

Here is the typo, which makes example invalid, should be `("'a", ...`

closes: #14064

Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-21 19:53:02 +01:00
Christian Brabandt
f9ca139e3a
runtime(misc): announce adoption of various runtime files
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-19 20:46:49 +01:00
Aliaksei Budavei
dfcef890cb
runtime(vim): Distinguish Vim9 constructor definitions from the :new ex command (#14050)
With the arrival of Vim9 classes, the syntax must allow for
_new_ constructors; multiple constructor definitions are
supported for a class, provided distinct suffix-names are
used.  Currently, the defined constructors match either
vimCommand or vimFunctionError (for any newBar).

For example:
------------------------------------------------------------
vim9script

class Foo
    def new()
    enddef

    def newBar()
    enddef
endclass
------------------------------------------------------------

Since every constructor is required to bear a lower-cased
_new_ prefix name, it should suffice to distinguish them
from functions, and so there are no new highlight or syntax
groups introduced.


Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: h-east <h.east.727@gmail.com>
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-18 19:02:14 +01:00
Doug Kearns
1633de8c35
runtime(vim): Update base-syntax, remove unused vimString region
These were included with the initial release of the syntax file for Vim
5 and were probably intended to allow for syn-region start/skip/end
patterns with a '!' or '+' delimiter.  However, these cases are
currently handled by the vimSynRegPat group.

The removed patterns never match anywhere in the distributed runtime
files and it is believed that this is generally true.

closes: #14035

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-14 21:28:44 +01:00
Doug Kearns
fe6d5b0ae4
runtime(vim): Update base-syntax, fix :behave highlighting
closes: #14036

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-14 21:17:43 +01:00
h-east
5c3855bcab
runtime(vim): update Vim Syntax generator
- Add missing "Last Change:" line.
- The date on this line in vim.vim is updated by update_date.vim at
  Make time. (I made a mistake in the file path)
- Remove unnecessary "b:loaded_syntax_vim_ex".
- Remove "Base File Date:" line in vim.vim.base
- Add Doug Kearns as Maintainer

closes: #14031

Signed-off-by: h-east <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-14 21:00:01 +01:00
h-east
9b53c052d5
runtime(vim): include Vim Syntax generator
fixes: #13939
closes: #14021
related: vim-jp/syntax-vim-ex#28

Signed-off-by: h-east <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-13 21:11:22 +01:00
dkearns
b614b284ee
runtime(vim): Update syntax file (#14009)
- allow comments after :highight commands
- match the bang in a :highlight[!] command
- highlight the bang in :map[!], :menu[!] and :unlet[!] with vimOper
  like all other commands

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-11 17:13:34 +01:00
dkearns
7c5aeaffa2
runtime(vim): Update syntax file (#13969)
Improve string interpolation highlighting.

Use the vimSep group to highlight interpolation braces as vimOperParen
has no highlighting of its own and employs vimSep via matchgroup.

Add vimNumber to the interpolation group's contained list.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: thinca <thinca@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-03 18:18:31 +01:00
dkearns
e3e3934bb1
runtime(vim): Update syntax file (#13948)
Improve string escape sequence and special key matching.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-02-01 21:44:26 +01:00
zeertzjq
bf321806bf
patch 9.1.0060: Recorded register cannot be translated using keytrans()
Problem:  Recorded register cannot be translated using keytrans() when
          it involves character search (iddqd505)
Solution: Record a K_IGNORE instead of a K_NOP (zeertzjq)

related: #13916
closes: #13925

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-28 19:03:00 +01:00
thinca
cf8695d48c
runtime(vim): Highlight string interpolation
closes: #13923

Signed-off-by: thinca <thinca@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-28 18:58:14 +01:00
dkearns
21ce159e05
runtime(vim): Update syntax and ftplugin files (#13924)
Improve matching of line-continuations and interspersed comments.

These are now also matched in multiline syntax command patterns,
dictionary literals, and parenthesised expressions and argument lists.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-28 18:54:08 +01:00
dkearns
b418a51933
runtime(vim): Update syntax file (#13919)
Add foreach() function.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-27 11:24:45 +01:00
Sergey Vlasov
1f47db75fd
patch 9.1.0059: No event triggered before creating a window
Problem:  No event is triggered before creating a window.
          (Sergey Vlasov)
Solution: Add the WinNewPre event (Sergey Vlasov)

fixes: #10635
closes: #12761

Signed-off-by: Sergey Vlasov <sergey@vlasov.me>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-25 23:07:00 +01:00
dkearns
9c5b90db03
runtime(vim): Update syntax file (#13906)
Highlight :2match and :3match and add these to :help ex-cmd-index.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-23 20:34:28 +01:00
PMunch
a606f3ac03
patch 9.1.0030: Cannot use terminal alternate font
Problem:  Cannot use terminal alternate fonts (PMunch)
Solution: Support terminal alternate fonts using
          CSI SGR 10-20 and t_CF code (PMunch)

Add support for alternate font highlighting

This adds support for alternate font highlighting using CSI SGR 10-20.
Few terminals currently support this, but with added tool support this
should improve over time. The change here is more or less taken from how
colors are configured and applied, but there might be some parts I
missed while implementing it. Changing fonts is done through the new
`:hi ctermfont` attribute which takes a number, 0 is the normal font, and
the numbers 1-9 select an "alternative" font. Which fonts are in use is
up to the terminal.

fixes: #13513
closes: #13537

Signed-off-by: PMunch <peterme@peterme.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-15 22:27:35 +01:00
Danek Duvall
d7d560374b
patch 9.1.0029: Cannot act on various terminal response codes
Problem:  Cannot act on various terminal response codes
Solution: Add the TerminalResponseAll autocommand
          (Danek Duvall)

closes: #13829

Signed-off-by: Danek Duvall <duvall@comfychair.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-14 20:19:59 +01:00
Maxim Kim
ceed36873e
runtime(vim): accept dot in completionList for Vim9 syntax (#13832)
if you have autoloaded command complete function in vim9script, it shouldn't be highlighted as Error:

```
import autoload "share.vim"
command! -range=% -nargs=? -complete=custom,share.Complete Share share.Paste(<q-args>, <line1>, <line2>)
```

`share.Complete` is a valid complete function.

Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-08 19:42:02 +01:00
dkearns
c79646dfb1
runtime(vim): Update syntax file (#13671)
Support multiline :syntax commands.

Match :syn-cchar option in :syn-{keyword,region}.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-04 22:58:48 +01:00
Hugo van de Vliert
b5352931b3
runtime(vim): add jumpoptions to syntax file (#13808)
* Add jumpoptions and jop to vim syntax file
* Clean up some whitespace

Signed-off-by: Hugo van de Vliert <hugo.vandevliert@floryn.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-03 18:03:29 +01:00
dezza
80beeef0c6
runtime(vim): Add support for <ScriptCmd> syntax (#10686)
Adding `<ScriptCmd>` to list of angle-bracket notation syntax, just like `<Cmd>`

`<Cmd>` is already highlighted.
```vim
nnoremap <leader>o <Cmd>Oldfiles()<CR>
```

`<ScriptCmd>` is not.

Signed-off-by: dezza <402927+dezza@users.noreply.github.com>
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-03 16:20:22 +01:00
Brad King
d4634a26cd
runtime(vim): Add support for syntax foldlevel command (#6182)
Signed-off-by: Brad King <brad.king@kitware.com>
Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-01-03 16:17:24 +01:00
dkearns
21064ebcd6
runtime(vim): Update syntax file (#13739)
Match all ex commands after ":" and the "|" command separator.

Exceptions are not handled yet and :insert/:change/:append are still not
matched after the command separator bar.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-21 16:56:06 +01:00
dkearns
1c97b5c0c0
runtime(vim): Update syntax file, fix missing for highlight (#13668)
Fix highlighting of :for command.  Link the vimFor syntax group to the
vimCommand highlight group.

Error introduced in commit f686921

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-12 16:47:43 +01:00
dkearns
f6869212c9
runtime(vim): Update syntax file (#13653)
Improve variable highlighting in :let, :unlet, :const and :for commands.

Match registers and local, global and terminal option variables.

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-10 15:53:24 +01:00
dkearns
4e043b1fc7
runtime(vim): Update syntax file and syntax test (#13632)
Add missing assignment operators (:let*=, :let/= and :let%=).

Signed-off-by: Doug Kearns <dougkearns@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-12-05 22:58:40 +01:00
dkearns
69866449dd
runtime(vim): Improve keymap file highlighting (#13550)
- Match :loadkeymap to EOF as a region and contain only allowed items.
- Add highlighting for <Char- notation.
- add basic syntax highlighting tests

Signed-off-by: Christian Brabandt <cb@256bit.org>
2023-11-21 19:43:40 +01:00