-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
runtime(filetype): Added suppprt for kitty #18280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
+123
−0
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8c2daca
runtime(filetype): Added suppprt for kitty
OXY2DEV 479b569
runtime(syntax): Added basic syntax for kitty
OXY2DEV 5dd7578
src(testdir): Updated test order
OXY2DEV e610611
runtime(syntax): Completed basic syntax for kitty
OXY2DEV 94c7ad8
runtime(syntax): Updated syntax files for kitty
OXY2DEV File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
" Vim syntax file | ||
" Language: Kitty configuration files | ||
" Maintainer: MD. Mouinul Hossain Shawon <mdmouinulhossainshawon [at] gmail.com> | ||
" Last Change: Sun Sep 14 13:56:41 +06 2025 | ||
|
||
if exists("b:current_syntax") | ||
finish | ||
endif | ||
|
||
syn sync fromstart | ||
|
||
" Option """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | ||
" Format: `<option_name> ...`< | ||
|
||
syn match kittyString /\S\+/ contains=Alpha contained | ||
syn match kittyNumber /[+\-*\/]\{0,1}[0-9.]\+/ contained | ||
syn match kittyAlpha /@[0-9.]\+/ contained | ||
syn match kittyColor /#[0-9a-fA-F]\{3,6}/ nextgroup=Alpha contained | ||
syn keyword kittyBoolean contained yes no | ||
syn keyword kittyConstant contained none auto monospace bold italic ratio always never | ||
|
||
syn match kittyFlag /[+-]\{1,2}[a-zA-Z0-9-_]\+/ contained | ||
syn match kittyParameter /-\{1,2}[a-zA-Z0-9-]\+=\S\+/ contained | ||
|
||
syn cluster kittyPrimitive contains=kittyNumber,kittyBoolean,kittyConstant,kittyColor,kittyString,kittyFlag,kittyParameter,kittyAlpha | ||
|
||
syn region kittyOption start="^\w" skip="[\n\r][ \t]*\\" end="[\r\n]" contains=kittyOptionName | ||
syn match kittyOptionName /\w\+/ nextgroup=kittyOptionValue skipwhite contained | ||
syn region kittyOptionValue start="\S" skip="[\r\n][ \t]*\\" end="\ze[\r\n]" contains=@kittyPrimitive contained | ||
|
||
" Keyboard shortcut """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" | ||
" Format: `map <keys> <action>?` | ||
|
||
syn match kittyKey /[^ \t\r\n+>]\+/ contained | ||
syn match kittyCtrl /\<\(ctrl\|control\)\>\|\^/ contained | ||
syn match kittyAlt /\<\(alt\|opt\|option\)\>\|⌥/ contained | ||
syn match kittyShift /\<\(shift\)\>\|⇧/ contained | ||
syn match kittySuper /\<\(cmd\|super\|command\)\>\|⌘/ contained | ||
|
||
syn match kittyAnd /+/ contained | ||
syn match kittyWith />/ contained | ||
|
||
syn region kittyMap start="^\s*map" skip="[\r\n][ \t]*\\" end="[\r\n]" contains=kittyMapName,kittyMapValue | ||
|
||
syn keyword kittyMapName nextgroup=kittyMapValue skipwhite contained map | ||
syn region kittyMapValue start="\S" skip="[\r\n][ \t]*\\" end="\ze[\r\n]" contains=kittyMapSeq,kittyMapAction contained | ||
|
||
syn region kittyMapAction start="\S" skip="[\r\n][ \t]*\\" end="\ze[\r\n]" contains=@kittyPrimitive contained | ||
syn region kittyMapSeq start="\S" end="\ze\s\|^\ze[ \t]*\\" nextgroup=kittyMapAction,kittyMouseMapType skipwhite contains=kittyCtrl,kittyAlt,kittyShift,kittySuper,kittyAnd,kittyWith,kittyKey contained | ||
|
||
" Mouse shortcut """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | ||
" Format: `mouse_map <keys> <type> <grabbed> <action>?` | ||
|
||
syn region kittyMouseMap start="^\s*mouse_map" skip="[\r\n][ \t]*\\" end="[\r\n]" contains=kittyMouseMapName,kittyMouseMapValue | ||
|
||
syn keyword kittyMouseMapName nextgroup=kittyMouseMapValue contained mouse_map | ||
syn region kittyMouseMapValue start="\S" skip="[\r\n][ \t]*\\" end="\ze[\r\n]" contains=kittyMapSeq,kittyMouseMapType,kittyMouseMapGrabbed contained | ||
|
||
syn region kittyMouseMapAction start="\S" skip="[\r\n][ \t]*\\" end="\ze[\r\n]" contains=@kittyPrimitive contained | ||
|
||
syn keyword kittyMouseMapType nextgroup=kittyMouseMapGrabbed skipwhite contained press release doublepress triplepress click doubleclick | ||
syn match kittyMouseMapGrabbed /\(grabbed\|ungrabbed\)\%(,\(grabbed\|ungrabbed\)\)\?/ nextgroup=kittyMouseMapAction skipwhite contained | ||
|
||
" Kitty modifier """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | ||
" Format: `kitty_mod <keys>` | ||
|
||
syn region kittyMod start="^\s*kitty_mod" end="[\r\n]" contains=kittyModName,kittyMapSeq | ||
|
||
syn keyword kittyModName nextgroup=kittyMapSeq contained kitty_mod | ||
|
||
" Comment """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | ||
" Format: `# <content>`` | ||
|
||
syn match kittyComment /^#.*$/ | ||
|
||
" Line continuation """"""""""""""""""""""""""""""""""""""""""""""""""""""""""" | ||
" Allows continuing lines by adding `\` at the start of a line. | ||
" May have leading spaces & tabs. | ||
|
||
syn match kittyLineContinue /^[ \t]*\\[ \t]*/ containedin=kittyOptionValue,kittyMap,kittyMapAction,kittyMouseMap,kittyMouseMapValue contained | ||
|
||
" Highlight groups """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | ||
|
||
hi link kittyString String | ||
hi link kittyNumber Number | ||
hi link kittyAlpha Type | ||
hi link kittyColor Constant | ||
hi link kittyBoolean Boolean | ||
hi link kittyConstant Constant | ||
|
||
hi link kittyFlag Constant | ||
hi link kittyParameter Specual | ||
|
||
hi link kittyOptionName Keyword | ||
hi link kittyModName Keyword | ||
|
||
hi link kittyKey Special | ||
hi link kittyCtrl Constant | ||
hi link kittyAlt Constant | ||
hi link kittyShift Constant | ||
hi link kittySuper Constant | ||
|
||
hi link kittyAnd Operator | ||
hi link kittyWith Operator | ||
|
||
hi link kittyMapName Function | ||
|
||
hi link kittyMouseMapName Function | ||
hi link kittyMouseMapType Type | ||
hi link kittyMouseMapGrabbed Constant | ||
|
||
hi link kittyComment Comment | ||
hi link kittyLineContinue Comment | ||
|
||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | ||
|
||
let b:current_syntax = "kitty" | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be
nextgroup=kittyAlpha
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because you can use colour names(e.g.
red@0.3
).And I didn't want to make a huge regex pattern for it(or use a very long
syn keyword
). I was also unsure if it would have performance issues since there's quite a few colour names.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood, but I think there's a typo:
contains=Alpha
versuscontains=kittyAlpha
?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's a typo. My bad. It should be
kittyAlpha
.But, how do I push the changes? My new commit isn't showing up here anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make a new PR with your changes please