Runtime: Add nixInherit matcher in nix.vim syntax
Commit:
https://github.com/vim/vim/commit/72904d5fda0a1bc78f4bc9080c158226e6e90d5c
Author: James Fleming <[email protected]>
Date: Sat Jul 29 12:01:18 2023 +0200
Runtime: Add nixInherit matcher in nix.vim syntax
Perform the lookahead in `nixInheritAttributeScope`, then hand over to a
new region called `nixInheritAttributeSubExpr`, which sets the match
start to one char after the opening bracket to avoid a double-match.
Finally, only do a lookahead to `)` in `nixInheritAttributeSubExpr` (and
thus make sure the region is closed to not get a match of `nixParen`
here) and let `nixInheritAttributeScope` close the bracket.
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/runtime/syntax/nix.vim b/runtime/syntax/nix.vim
index c07676a4a..671b269c0 100644
--- a/runtime/syntax/nix.vim
+++ b/runtime/syntax/nix.vim
@@ -1,11 +1,12 @@
" Vim syntax file
" Language: Nix
-" Maintainer: James Fleming <[email protected]>
+" Maintainer: James Fleming <[email protected]>
+" (Github username: equill)
" Original Author: Daiderd Jordan <[email protected]>
" Acknowledgement: Based on vim-nix maintained by Daiderd Jordan
<[email protected]>
" https://github.com/LnL7/vim-nix
" License: MIT
-" Last Change: 2022 Dec 06
+" Last Change: 2023 Aug 19
if exists("b:current_syntax")
finish
@@ -68,7 +69,8 @@ syn match nixAttribute
"[a-zA-Z_][a-zA-Z0-9_'-]*\ze\%([^a-zA-Z0-9_'.-]\|$\)" con
syn region nixAttributeAssignment start="=" end="\ze;" contained
contains=@nixExpr
syn region nixAttributeDefinition start=/\ze[a-zA-Z_"$]/ end=";" contained
contains=nixComment,nixAttribute,nixInterpolation,nixSimpleString,nixAttributeDot,nixAttributeAssignment
-syn region nixInheritAttributeScope start="(" end="\ze)" contained
contains=@nixExpr
+syn region nixInheritAttributeSubExpr start="("ms=e+1 end="\ze)" contained
contains=nixAttributeDot,@nixExpr
+syn region nixInheritAttributeScope start="\ze(" end=")" contained
contains=nixInheritAttributeSubExpr
syn region nixAttributeDefinition matchgroup=nixInherit start="\<inherit\>"
end=";" contained contains=nixComment,nixInheritAttributeScope,nixAttribute
syn region nixAttributeSet start="{" end="}"
contains=nixComment,nixAttributeDefinition
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/E1qXmFa-00Amt7-SU%40256bit.org.