-
Notifications
You must be signed in to change notification settings - Fork 11
Added Basic Vlang Highlighter #7
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
Draft
Cons-Cat
wants to merge
8
commits into
kakoune-editor:master
Choose a base branch
from
Cons-Cat:vlang
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
11878a8
Added Basic Vlang Highlighter
Cons-Cat 6e84122
Added Static Keywords
Cons-Cat 57081c8
Decl Comment Line
Cons-Cat 8bb74e0
Updated Value Regex
Cons-Cat f05c8d9
Added Types and Builtins to Static Keywords
Cons-Cat 0f81c86
Various Improvements
Cons-Cat c78c06a
More Minor Improvements
Cons-Cat 4c35dd6
Fixed Comments
Cons-Cat 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
## | ||
## v.kak by Conscat | ||
## | ||
|
||
# https://vlang.io | ||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ | ||
|
||
# Detection | ||
# ‾‾‾‾‾‾‾‾‾ | ||
|
||
hook global BufCreate .+\.(v|vsh) %{ | ||
set-option buffer filetype v | ||
} | ||
|
||
# Initialization | ||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ | ||
|
||
hook global WinSetOption filetype=v %{ | ||
require-module v | ||
add-highlighter window/v ref v | ||
} | ||
|
||
hook global WinSetOption filetype=(?!v).* %{ | ||
remove-highlighter window/v | ||
} | ||
|
||
hook global BufSetOption filetype=v %{ | ||
set-option buffer comment_line '//' | ||
} | ||
|
||
provide-module v %§ | ||
|
||
# Highlighters | ||
# ‾‾‾‾‾‾‾‾‾‾‾‾ | ||
|
||
add-highlighter shared/v regions | ||
add-highlighter shared/v/code default-region group | ||
|
||
add-highlighter shared/v/back_string region '`' '`' fill string | ||
add-highlighter shared/v/double_string region '"' (?<!\\)(\\\\)*" fill string | ||
add-highlighter shared/v/single_string region "'" (?<!\\)(\\\\)*' fill string | ||
add-highlighter shared/v/comment region -recurse /\* /\* \*/ fill comment | ||
add-highlighter shared/v/comment_line region '//' $ fill comment | ||
|
||
add-highlighter shared/v/code/ regex (\b(if|as|asm|assert|atomic|break|const|continue|else|embed|enum|fn|for|go|import|in|interface|is|lock|match|module|mut|or|pub|return|rlock|select|shared|sizeof|static|struct|type|typeof|union|__offsetof|free|unsafe|strlen|strncmp|malloc|goto|defer)\b|\$(if|else|for)|\[(deprecated|inline|heap|manualfree|live|direct_array_access|typedef|windows_stdcall|console|json:|raw)([^\]|(^\n)]*)\]) 0:keyword | ||
Cons-Cat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
add-highlighter shared/v/code/ regex %{-?([0-9]*\.(?!0[xX]))?\b([0-9_]+|0[xX][0-9a-fA-F]+)\.?([eE][+-]?[0-9]+)?\.*|none|true|false\b} 0:value | ||
Cons-Cat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
add-highlighter shared/v/code/ regex \b(chan|err|i8|u8|byte|i16|u16|int|u32|i64|u64|f32|f64|ptr|voidptr|r|size_t|map|rune|string)\b 0:type | ||
|
||
add-highlighter shared/v/code/ regex \b(print|println|eprint|eprintln|exit|panic|print_backtrace|dump|rmdir_all|mkdir|exec|ls|mv)\b 0:builtin | ||
|
||
add-highlighter shared/v/code/ regex (<|>|=|\+|-|\*|/|%|~|&|\|||\^|!|\?|:=) 0:operator | ||
|
||
§ |
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.
Uh oh!
There was an error while loading. Please reload this page.