diff --git a/misc/syntax/atom/language-rego/grammars/rego.cson b/misc/syntax/atom/language-rego/grammars/rego.cson
index 20cbf3b3c4..60bb600242 100644
--- a/misc/syntax/atom/language-rego/grammars/rego.cson
+++ b/misc/syntax/atom/language-rego/grammars/rego.cson
@@ -96,9 +96,11 @@ repository:
}
]
head:
- begin: "^([[:alpha:]_][[:alnum:]_]*)"
+ begin: "^(default\s+)?([[:alpha:]_][[:alnum:]_]*)"
beginCaptures:
"1":
+ name: "keyword.control.import.$1.rego"
+ "2":
name: "storage.type.function.rego"
end: "(=|:-)"
name: "meta.function.rego"
diff --git a/misc/syntax/textmate/Rego.tmLanguage b/misc/syntax/textmate/Rego.tmLanguage
index 37eeb49cad..81b70c7b01 100644
--- a/misc/syntax/textmate/Rego.tmLanguage
+++ b/misc/syntax/textmate/Rego.tmLanguage
@@ -181,10 +181,15 @@
head
begin
- ^([[:alpha:]_][[:alnum:]_]*)
+ ^(default\s+)?([[:alpha:]_][[:alnum:]_]*)
beginCaptures
1
+
+ name
+ keyword.control.import.$1.rego
+
+ 2
name
storage.type.function.rego
diff --git a/misc/syntax/vim/syntax/rego.vim b/misc/syntax/vim/syntax/rego.vim
index c782a94f8b..4fd26e491c 100644
--- a/misc/syntax/vim/syntax/rego.vim
+++ b/misc/syntax/vim/syntax/rego.vim
@@ -11,7 +11,7 @@ endif
syn case match
" language keywords
-syn keyword regoKeyword package import as not with
+syn keyword regoKeyword package import as not with default
" comments
syn match regoComment "#.*$" contains=regoTodo,@Spell
@@ -29,7 +29,9 @@ syn match regoStringEscape "\\u[0-9a-fA-F]\{4}" contained
syn match regoStringEscape "\\[nrfvb\\\"]" contained
" rule head
-syn match regoRuleName "^\w\+" nextgroup=regoRuleKey,regoRuleValue skipwhite
+" TODO: how to match 'default' here but highlight as keyword (and still
+" highlight rule name as function)?
+syn match regoRuleName "^\s*\(\w\+\)" nextgroup=regoRuleKey,regoRuleValue skipwhite
syn region regoRuleKey start="\[" end="\]" contained skipwhite
syn match regoRuleValue "=\w\+" nextgroup=regoIfThen skipwhite
diff --git a/misc/syntax/visualstudio/rego/syntaxes/Rego.tmLanguage b/misc/syntax/visualstudio/rego/syntaxes/Rego.tmLanguage
index 37eeb49cad..81b70c7b01 100644
--- a/misc/syntax/visualstudio/rego/syntaxes/Rego.tmLanguage
+++ b/misc/syntax/visualstudio/rego/syntaxes/Rego.tmLanguage
@@ -181,10 +181,15 @@
head
begin
- ^([[:alpha:]_][[:alnum:]_]*)
+ ^(default\s+)?([[:alpha:]_][[:alnum:]_]*)
beginCaptures
1
+
+ name
+ keyword.control.import.$1.rego
+
+ 2
name
storage.type.function.rego