Deindent everything in the 'provide-module crystal...' block
This commit is contained in:
parent
a78b6e6ccb
commit
3248f7279c
|
@ -26,83 +26,84 @@ hook global WinSetOption filetype=crystal %{
|
||||||
}
|
}
|
||||||
|
|
||||||
provide-module crystal %§
|
provide-module crystal %§
|
||||||
declare-option -hidden str-list crystal_keywords 'abstract' 'alias' 'annotation' 'as' 'asm' 'begin' 'break' 'case' 'class' 'def' 'do' 'else' 'elsif' 'end' 'ensure' 'enum' 'extend' 'false' 'for' 'fun' 'if' 'include' 'instance_sizeof' 'is_a?' 'lib' 'macro' 'module' 'next' 'nil' 'nil?' 'of' 'offsetof' 'out' 'pointerof' 'private' 'protected' 'require' 'rescue' 'responds_to?' 'return' 'select' 'self' 'sizeof' 'struct' 'super' 'then' 'true' 'type' 'typeof' 'uninitialized' 'union' 'unless' 'until' 'verbatim' 'when' 'while' 'with' 'yield'
|
|
||||||
# https://crystal-lang.org/reference/syntax_and_semantics/methods_and_instance_variables.html#getters-and-setters
|
|
||||||
declare-option -hidden str-list crystal_attributes 'getter' 'setter' 'property'
|
|
||||||
declare-option -hidden str-list crystal_operators '+' '-' '*' '/' '//' '%' '|' '&' '^' '~' '**' '<<' '<' '<=' '==' '!=' '=~' '!~' '>>' '>' '>=' '<=>' '===' '[]' '[]=' '[]?' '[' '&+' '&-' '&*' '&**'
|
|
||||||
declare-option -hidden str-list crystal_objects 'Adler32' 'ArgumentError' 'Array' 'Atomic' 'Base64' 'Benchmark' 'BigDecimal' 'BigFloat' 'BigInt' 'BigRational' 'BitArray' 'Bool' 'Box' 'Bytes' 'Channel' 'Char' 'Class' 'Colorize' 'Comparable' 'Complex' 'Concurrent' 'ConcurrentExecutionException' 'CRC32' 'Crypto' 'Crystal' 'CSV' 'Debug' 'Deprecated' 'Deque' 'Digest' 'Dir' 'DivisionByZeroError' 'DL' 'ECR' 'Enum' 'Enumerable' 'ENV' 'Errno' 'Exception' 'Fiber' 'File' 'FileUtils' 'Flags' 'Flate' 'Float' 'Float32' 'Float64' 'GC' 'Gzip' 'Hash' 'HTML' 'HTTP' 'Indexable' 'IndexError' 'INI' 'Int' 'Int128' 'Int16' 'Int32' 'Int64' 'Int8' 'InvalidBigDecimalException' 'InvalidByteSequenceError' 'IO' 'IPSocket' 'Iterable' 'Iterator' 'JSON' 'KeyError' 'Levenshtein' 'Link' 'LLVM' 'Logger' 'Markdown' 'Math' 'MIME' 'Mutex' 'NamedTuple' 'Nil' 'NilAssertionError' 'NotImplementedError' 'Number' 'OAuth' 'OAuth2' 'Object' 'OpenSSL' 'OptionParser' 'OverflowError' 'PartialComparable' 'Path' 'Pointer' 'PrettyPrint' 'Proc' 'Process' 'Random' 'Range' 'Readline' 'Reference' 'Reflect' 'Regex' 'SemanticVersion' 'Set' 'Signal' 'Slice' 'Socket' 'Spec' 'StaticArray' 'String' 'StringPool' 'StringScanner' 'Struct' 'Symbol' 'System' 'TCPServer' 'TCPSocket' 'Termios' 'Time' 'Tuple' 'TypeCastError' 'UDPSocket' 'UInt128' 'UInt16' 'UInt32' 'UInt64' 'UInt8' 'Unicode' 'Union' 'UNIXServer' 'UNIXSocket' 'URI' 'UUID' 'VaList' 'Value' 'WeakRef' 'XML' 'YAML' 'Zip' 'Zlib'
|
|
||||||
|
|
||||||
# Highlighters
|
declare-option -hidden str-list crystal_keywords 'abstract' 'alias' 'annotation' 'as' 'asm' 'begin' 'break' 'case' 'class' 'def' 'do' 'else' 'elsif' 'end' 'ensure' 'enum' 'extend' 'false' 'for' 'fun' 'if' 'include' 'instance_sizeof' 'is_a?' 'lib' 'macro' 'module' 'next' 'nil' 'nil?' 'of' 'offsetof' 'out' 'pointerof' 'private' 'protected' 'require' 'rescue' 'responds_to?' 'return' 'select' 'self' 'sizeof' 'struct' 'super' 'then' 'true' 'type' 'typeof' 'uninitialized' 'union' 'unless' 'until' 'verbatim' 'when' 'while' 'with' 'yield'
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# https://crystal-lang.org/reference/syntax_and_semantics/methods_and_instance_variables.html#getters-and-setters
|
||||||
|
declare-option -hidden str-list crystal_attributes 'getter' 'setter' 'property'
|
||||||
|
declare-option -hidden str-list crystal_operators '+' '-' '*' '/' '//' '%' '|' '&' '^' '~' '**' '<<' '<' '<=' '==' '!=' '=~' '!~' '>>' '>' '>=' '<=>' '===' '[]' '[]=' '[]?' '[' '&+' '&-' '&*' '&**'
|
||||||
|
declare-option -hidden str-list crystal_objects 'Adler32' 'ArgumentError' 'Array' 'Atomic' 'Base64' 'Benchmark' 'BigDecimal' 'BigFloat' 'BigInt' 'BigRational' 'BitArray' 'Bool' 'Box' 'Bytes' 'Channel' 'Char' 'Class' 'Colorize' 'Comparable' 'Complex' 'Concurrent' 'ConcurrentExecutionException' 'CRC32' 'Crypto' 'Crystal' 'CSV' 'Debug' 'Deprecated' 'Deque' 'Digest' 'Dir' 'DivisionByZeroError' 'DL' 'ECR' 'Enum' 'Enumerable' 'ENV' 'Errno' 'Exception' 'Fiber' 'File' 'FileUtils' 'Flags' 'Flate' 'Float' 'Float32' 'Float64' 'GC' 'Gzip' 'Hash' 'HTML' 'HTTP' 'Indexable' 'IndexError' 'INI' 'Int' 'Int128' 'Int16' 'Int32' 'Int64' 'Int8' 'InvalidBigDecimalException' 'InvalidByteSequenceError' 'IO' 'IPSocket' 'Iterable' 'Iterator' 'JSON' 'KeyError' 'Levenshtein' 'Link' 'LLVM' 'Logger' 'Markdown' 'Math' 'MIME' 'Mutex' 'NamedTuple' 'Nil' 'NilAssertionError' 'NotImplementedError' 'Number' 'OAuth' 'OAuth2' 'Object' 'OpenSSL' 'OptionParser' 'OverflowError' 'PartialComparable' 'Path' 'Pointer' 'PrettyPrint' 'Proc' 'Process' 'Random' 'Range' 'Readline' 'Reference' 'Reflect' 'Regex' 'SemanticVersion' 'Set' 'Signal' 'Slice' 'Socket' 'Spec' 'StaticArray' 'String' 'StringPool' 'StringScanner' 'Struct' 'Symbol' 'System' 'TCPServer' 'TCPSocket' 'Termios' 'Time' 'Tuple' 'TypeCastError' 'UDPSocket' 'UInt128' 'UInt16' 'UInt32' 'UInt64' 'UInt8' 'Unicode' 'Union' 'UNIXServer' 'UNIXSocket' 'URI' 'UUID' 'VaList' 'Value' 'WeakRef' 'XML' 'YAML' 'Zip' 'Zlib'
|
||||||
|
|
||||||
add-highlighter shared/crystal regions
|
# Highlighters
|
||||||
add-highlighter shared/crystal/code default-region group
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
# Comments
|
add-highlighter shared/crystal regions
|
||||||
# https://crystal-lang.org/reference/syntax_and_semantics/comments.html
|
add-highlighter shared/crystal/code default-region group
|
||||||
# Avoid string literals with interpolation
|
|
||||||
add-highlighter shared/crystal/comment region '#(?!\{)' '$' fill comment
|
|
||||||
|
|
||||||
# String
|
# Comments
|
||||||
# https://crystal-lang.org/reference/syntax_and_semantics/literals/string.html
|
# https://crystal-lang.org/reference/syntax_and_semantics/comments.html
|
||||||
add-highlighter shared/crystal/string region '"' '(?<!\\)"' regions
|
# Avoid string literals with interpolation
|
||||||
|
add-highlighter shared/crystal/comment region '#(?!\{)' '$' fill comment
|
||||||
|
|
||||||
# Percent string literals
|
# String
|
||||||
# https://crystal-lang.org/reference/syntax_and_semantics/literals/string.html#percent-string-literals
|
# https://crystal-lang.org/reference/syntax_and_semantics/literals/string.html
|
||||||
add-highlighter shared/crystal/parenthesis-string region -recurse '\(' '%Q?\(' '\)' regions
|
add-highlighter shared/crystal/string region '"' '(?<!\\)"' regions
|
||||||
add-highlighter shared/crystal/bracket-string region -recurse '\[' '%Q?\[' '\]' regions
|
|
||||||
add-highlighter shared/crystal/brace-string region -recurse '\{' '%Q?\{' '\}' regions
|
|
||||||
add-highlighter shared/crystal/angle-string region -recurse '<' '%Q?<' '>' regions
|
|
||||||
add-highlighter shared/crystal/pipe-string region '%Q?\|' '\|' regions
|
|
||||||
# Raw
|
|
||||||
# https://crystal-lang.org/reference/syntax_and_semantics/literals/string.html#percent-string-literals
|
|
||||||
# https://crystal-lang.org/reference/syntax_and_semantics/literals/string.html#percent-string-array-literal
|
|
||||||
# https://crystal-lang.org/reference/syntax_and_semantics/literals/symbol.html#percent-symbol-array-literal
|
|
||||||
add-highlighter shared/crystal/raw-parenthesis-string region -recurse '\(' '%[qwi]\(' '\)' fill string
|
|
||||||
add-highlighter shared/crystal/raw-bracket-string region -recurse '\[' '%[qwi]\[' '\]' fill string
|
|
||||||
add-highlighter shared/crystal/raw-brace-string region -recurse '\{' '%[qwi]\{' '\}' fill string
|
|
||||||
add-highlighter shared/crystal/raw-angle-string region -recurse '<' '%[qwi]<' '>' fill string
|
|
||||||
add-highlighter shared/crystal/raw-pipe-string region '%[qwi]\|' '\|' fill string
|
|
||||||
|
|
||||||
# Here document
|
# Percent string literals
|
||||||
# https://crystal-lang.org/reference/syntax_and_semantics/literals/string.html#heredoc
|
# https://crystal-lang.org/reference/syntax_and_semantics/literals/string.html#percent-string-literals
|
||||||
add-highlighter shared/crystal/heredoc region -match-capture '<<-(\w+)' '^\h*(\w+)$' regions
|
add-highlighter shared/crystal/parenthesis-string region -recurse '\(' '%Q?\(' '\)' regions
|
||||||
# Raw
|
add-highlighter shared/crystal/bracket-string region -recurse '\[' '%Q?\[' '\]' regions
|
||||||
add-highlighter shared/crystal/raw-heredoc region -match-capture "<<-'(\w+)'" '^\h*(\w+)$' regions
|
add-highlighter shared/crystal/brace-string region -recurse '\{' '%Q?\{' '\}' regions
|
||||||
add-highlighter shared/crystal/raw-heredoc/fill default-region fill string
|
add-highlighter shared/crystal/angle-string region -recurse '<' '%Q?<' '>' regions
|
||||||
add-highlighter shared/crystal/raw-heredoc/interpolation region -recurse '\{' '#\{' '\}' fill meta
|
add-highlighter shared/crystal/pipe-string region '%Q?\|' '\|' regions
|
||||||
|
# Raw
|
||||||
|
# https://crystal-lang.org/reference/syntax_and_semantics/literals/string.html#percent-string-literals
|
||||||
|
# https://crystal-lang.org/reference/syntax_and_semantics/literals/string.html#percent-string-array-literal
|
||||||
|
# https://crystal-lang.org/reference/syntax_and_semantics/literals/symbol.html#percent-symbol-array-literal
|
||||||
|
add-highlighter shared/crystal/raw-parenthesis-string region -recurse '\(' '%[qwi]\(' '\)' fill string
|
||||||
|
add-highlighter shared/crystal/raw-bracket-string region -recurse '\[' '%[qwi]\[' '\]' fill string
|
||||||
|
add-highlighter shared/crystal/raw-brace-string region -recurse '\{' '%[qwi]\{' '\}' fill string
|
||||||
|
add-highlighter shared/crystal/raw-angle-string region -recurse '<' '%[qwi]<' '>' fill string
|
||||||
|
add-highlighter shared/crystal/raw-pipe-string region '%[qwi]\|' '\|' fill string
|
||||||
|
|
||||||
# Symbol
|
# Here document
|
||||||
# https://crystal-lang.org/reference/syntax_and_semantics/literals/symbol.html
|
# https://crystal-lang.org/reference/syntax_and_semantics/literals/string.html#heredoc
|
||||||
add-highlighter shared/crystal/quoted-symbol region ':"' '(?<!\\)"' fill value
|
add-highlighter shared/crystal/heredoc region -match-capture '<<-(\w+)' '^\h*(\w+)$' regions
|
||||||
|
# Raw
|
||||||
|
add-highlighter shared/crystal/raw-heredoc region -match-capture "<<-'(\w+)'" '^\h*(\w+)$' regions
|
||||||
|
add-highlighter shared/crystal/raw-heredoc/fill default-region fill string
|
||||||
|
add-highlighter shared/crystal/raw-heredoc/interpolation region -recurse '\{' '#\{' '\}' fill meta
|
||||||
|
|
||||||
# Regular expressions
|
# Symbol
|
||||||
# https://crystal-lang.org/reference/syntax_and_semantics/literals/regex.html
|
# https://crystal-lang.org/reference/syntax_and_semantics/literals/symbol.html
|
||||||
# https://crystal-lang.org/reference/syntax_and_semantics/literals/regex.html#modifiers
|
add-highlighter shared/crystal/quoted-symbol region ':"' '(?<!\\)"' fill value
|
||||||
add-highlighter shared/crystal/regex region '/' '(?<!\\)/[imx]*' regions
|
|
||||||
# Avoid unterminated regular expression
|
|
||||||
add-highlighter shared/crystal/division region ' / ' '.\K' group
|
|
||||||
|
|
||||||
# Percent regex literals
|
# Regular expressions
|
||||||
# https://crystal-lang.org/reference/syntax_and_semantics/literals/regex.html#percent-regex-literals
|
# https://crystal-lang.org/reference/syntax_and_semantics/literals/regex.html
|
||||||
add-highlighter shared/crystal/parenthesis-regex region -recurse '\(' '%r?\(' '\)[imx]*' regions
|
# https://crystal-lang.org/reference/syntax_and_semantics/literals/regex.html#modifiers
|
||||||
add-highlighter shared/crystal/bracket-regex region -recurse '\[' '%r?\[' '\][imx]*' regions
|
add-highlighter shared/crystal/regex region '/' '(?<!\\)/[imx]*' regions
|
||||||
add-highlighter shared/crystal/brace-regex region -recurse '\{' '%r?\{' '\}[imx]*' regions
|
# Avoid unterminated regular expression
|
||||||
add-highlighter shared/crystal/angle-regex region -recurse '<' '%r?<' '>[imx]*' regions
|
add-highlighter shared/crystal/division region ' / ' '.\K' group
|
||||||
add-highlighter shared/crystal/pipe-regex region '%r?\|' '\|[imx]*' regions
|
|
||||||
|
|
||||||
# Command
|
# Percent regex literals
|
||||||
# https://crystal-lang.org/reference/syntax_and_semantics/literals/command.html
|
# https://crystal-lang.org/reference/syntax_and_semantics/literals/regex.html#percent-regex-literals
|
||||||
add-highlighter shared/crystal/command region '`' '(?<!\\)`' regions
|
add-highlighter shared/crystal/parenthesis-regex region -recurse '\(' '%r?\(' '\)[imx]*' regions
|
||||||
|
add-highlighter shared/crystal/bracket-regex region -recurse '\[' '%r?\[' '\][imx]*' regions
|
||||||
|
add-highlighter shared/crystal/brace-regex region -recurse '\{' '%r?\{' '\}[imx]*' regions
|
||||||
|
add-highlighter shared/crystal/angle-regex region -recurse '<' '%r?<' '>[imx]*' regions
|
||||||
|
add-highlighter shared/crystal/pipe-regex region '%r?\|' '\|[imx]*' regions
|
||||||
|
|
||||||
# Percent command literals
|
# Command
|
||||||
add-highlighter shared/crystal/parenthesis-command region -recurse '\(' '%x?\(' '\)' regions
|
# https://crystal-lang.org/reference/syntax_and_semantics/literals/command.html
|
||||||
add-highlighter shared/crystal/bracket-command region -recurse '\[' '%x?\[' '\]' regions
|
add-highlighter shared/crystal/command region '`' '(?<!\\)`' regions
|
||||||
add-highlighter shared/crystal/brace-command region -recurse '\{' '%x?\{' '\}' regions
|
|
||||||
add-highlighter shared/crystal/angle-command region -recurse '<' '%x?<' '>' regions
|
|
||||||
add-highlighter shared/crystal/pipe-command region '%x?\|' '\|' regions
|
|
||||||
|
|
||||||
evaluate-commands %sh[
|
# Percent command literals
|
||||||
|
add-highlighter shared/crystal/parenthesis-command region -recurse '\(' '%x?\(' '\)' regions
|
||||||
|
add-highlighter shared/crystal/bracket-command region -recurse '\[' '%x?\[' '\]' regions
|
||||||
|
add-highlighter shared/crystal/brace-command region -recurse '\{' '%x?\{' '\}' regions
|
||||||
|
add-highlighter shared/crystal/angle-command region -recurse '<' '%x?<' '>' regions
|
||||||
|
add-highlighter shared/crystal/pipe-command region '%x?\|' '\|' regions
|
||||||
|
|
||||||
|
evaluate-commands %sh[
|
||||||
# Keywords
|
# Keywords
|
||||||
eval "set -- $kak_quoted_opt_crystal_keywords"
|
eval "set -- $kak_quoted_opt_crystal_keywords"
|
||||||
regex="\\b(?:\\Q$1\\E"
|
regex="\\b(?:\\Q$1\\E"
|
||||||
|
@ -169,12 +170,12 @@ provide-module crystal %§
|
||||||
add-highlighter shared/crystal/$id/interpolation region -recurse '\\{' '#\\{' '\\}' ref crystal
|
add-highlighter shared/crystal/$id/interpolation region -recurse '\\{' '#\\{' '\\}' ref crystal
|
||||||
"
|
"
|
||||||
done
|
done
|
||||||
]
|
]
|
||||||
|
|
||||||
# Commands
|
# Commands
|
||||||
# ‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
define-command -hidden crystal-new-line-inserted %{
|
define-command -hidden crystal-new-line-inserted %{
|
||||||
# Copy previous line indent
|
# Copy previous line indent
|
||||||
try %{
|
try %{
|
||||||
execute-keys -draft 'K<a-&>'
|
execute-keys -draft 'K<a-&>'
|
||||||
|
@ -183,27 +184,28 @@ provide-module crystal %§
|
||||||
try %{
|
try %{
|
||||||
execute-keys -draft 'k<a-x>s^\h+$<ret>d'
|
execute-keys -draft 'k<a-x>s^\h+$<ret>d'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define-command -hidden crystal-fetch-keywords %{
|
define-command -hidden crystal-fetch-keywords %{
|
||||||
set-register dquote %sh{
|
set-register dquote %sh{
|
||||||
curl --location https://github.com/crystal-lang/crystal/raw/master/src/compiler/crystal/syntax/lexer.cr |
|
curl --location https://github.com/crystal-lang/crystal/raw/master/src/compiler/crystal/syntax/lexer.cr |
|
||||||
kak -f '%1scheck_ident_or_keyword\(:(\w+\??), \w+\)<ret>y%<a-R>a<ret><esc><a-_>a<del><esc>|sort<ret>'
|
kak -f '%1scheck_ident_or_keyword\(:(\w+\??), \w+\)<ret>y%<a-R>a<ret><esc><a-_>a<del><esc>|sort<ret>'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define-command -hidden crystal-fetch-operators %{
|
define-command -hidden crystal-fetch-operators %{
|
||||||
set-register dquote %sh{
|
set-register dquote %sh{
|
||||||
curl --location https://github.com/crystal-lang/crystal/raw/master/src/compiler/crystal/syntax/parser.cr |
|
curl --location https://github.com/crystal-lang/crystal/raw/master/src/compiler/crystal/syntax/parser.cr |
|
||||||
kak -f '/AtomicWithMethodCheck =<ret>x1s:"([^"]+)"<ret>y%<a-R>i''<esc>a''<ret><esc><a-_>a<del><esc>'
|
kak -f '/AtomicWithMethodCheck =<ret>x1s:"([^"]+)"<ret>y%<a-R>i''<esc>a''<ret><esc><a-_>a<del><esc>'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
define-command -hidden crystal-fetch-objects %{
|
define-command -hidden crystal-fetch-objects %{
|
||||||
set-register dquote %sh{
|
set-register dquote %sh{
|
||||||
curl --location https://crystal-lang.org/api/ |
|
curl --location https://crystal-lang.org/api/ |
|
||||||
# Remove Top Level Namespace
|
# Remove Top Level Namespace
|
||||||
kak -f '%1sdata-id="github.com/crystal-lang/crystal/(\w+)"<ret>)<a-space>y%<a-R>a<ret><esc><a-_>a<del><esc>'
|
kak -f '%1sdata-id="github.com/crystal-lang/crystal/(\w+)"<ret>)<a-space>y%<a-R>a<ret><esc><a-_>a<del><esc>'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
§
|
§
|
||||||
|
|
Loading…
Reference in New Issue
Block a user