Merge remote-tracking branch 'laelath/provides-requires'
This commit is contained in:
commit
0cc89b2b9f
|
@ -24,13 +24,20 @@ released versions.
|
||||||
* `InsertCompletionSelect` hook has been removed as
|
* `InsertCompletionSelect` hook has been removed as
|
||||||
`completions` commands now provides a similar feature.
|
`completions` commands now provides a similar feature.
|
||||||
|
|
||||||
|
* Introduced a module system using the `provide-module` and
|
||||||
|
`require-module` commands that allows for lazily loading language
|
||||||
|
support files with dependency resolution.
|
||||||
|
|
||||||
|
* Added a new hook `ModuleLoad` which is run when a module is loaded,
|
||||||
|
allowing for module specific configuration.
|
||||||
|
|
||||||
== Kakoune 2019.01.20
|
== Kakoune 2019.01.20
|
||||||
|
|
||||||
* `auto_complete` has been renamed to `autocomplete` for more
|
* `auto_complete` has been renamed to `autocomplete` for more
|
||||||
consistency.
|
consistency.
|
||||||
|
|
||||||
* Start of a builtin key parser in the ncurses ui bypassing
|
* Start of a builtin key parser in the ncurses ui bypassing
|
||||||
the ncurses one. Can be favored by setting the ui option
|
the ncurses one. Can be favored by setting the ui option
|
||||||
`ncurses_builtin_key_parser` to `true`.
|
`ncurses_builtin_key_parser` to `true`.
|
||||||
|
|
||||||
* Right clicks extend the current selection, the control modifier allows
|
* Right clicks extend the current selection, the control modifier allows
|
||||||
|
|
|
@ -328,6 +328,22 @@ but not really useful in that context.
|
||||||
*debug* {info,buffers,options,memory,shared-strings,profile-hash-maps,faces,mappings}::
|
*debug* {info,buffers,options,memory,shared-strings,profile-hash-maps,faces,mappings}::
|
||||||
print some debug information in the *\*debug** buffer
|
print some debug information in the *\*debug** buffer
|
||||||
|
|
||||||
|
== Module commands
|
||||||
|
|
||||||
|
*provide-module* [<switches>] <name> <commands>::
|
||||||
|
declares a module *name* that is defined by *commands*. *commands* will be
|
||||||
|
evaluated as if by source the first time *require-module <name>* is run.
|
||||||
|
|
||||||
|
*-override*:::
|
||||||
|
allow the module to replace an existing one with the same name. Fails if
|
||||||
|
the module has already been evaluated.
|
||||||
|
|
||||||
|
*require-module* <name>::
|
||||||
|
guarantees the commands associated with *name* have been evaluated before
|
||||||
|
continuing command execution. Fails if *name* has not been defined by a
|
||||||
|
*provide-module* command. Does nothing if the associated commands have
|
||||||
|
already been evaluated.
|
||||||
|
|
||||||
== Multiple commands
|
== Multiple commands
|
||||||
|
|
||||||
Commands (c.f. previous sections) can be chained, by being separated either
|
Commands (c.f. previous sections) can be chained, by being separated either
|
||||||
|
|
|
@ -176,6 +176,9 @@ name. Hooks with no description will always use an empty string.
|
||||||
*RawKey* `key`::
|
*RawKey* `key`::
|
||||||
Triggered whenever a key is pressed by the user
|
Triggered whenever a key is pressed by the user
|
||||||
|
|
||||||
|
*ModuleLoad* `module`::
|
||||||
|
Triggered when a module is evaluated by the first `require-module` call
|
||||||
|
|
||||||
Note that some hooks will not consider underlying scopes depending on what
|
Note that some hooks will not consider underlying scopes depending on what
|
||||||
context they are bound to be run into, e.g. the `BufWritePost` hook is a buffer
|
context they are bound to be run into, e.g. the `BufWritePost` hook is a buffer
|
||||||
hook, and will not consider the `window` scope.
|
hook, and will not consider the `window` scope.
|
||||||
|
|
|
@ -8,7 +8,7 @@ hook global BufCreate .*[.](editorconfig) %{
|
||||||
set-option buffer filetype ini
|
set-option buffer filetype ini
|
||||||
set-option buffer static_words indent_style indent_size tab_width \
|
set-option buffer static_words indent_style indent_size tab_width \
|
||||||
end_of_line charset insert_final_newline trim_trailing_whitespace root \
|
end_of_line charset insert_final_newline trim_trailing_whitespace root \
|
||||||
latin1 utf-8 utf-8-bom utf-16be utf-16le lf cr crlf unset space tab
|
latin1 utf-8 utf-8-bom utf-16be utf-16le lf cr crlf unset space tab
|
||||||
}
|
}
|
||||||
|
|
||||||
declare-option -hidden bool editorconfig_trim_trailing_whitespace false
|
declare-option -hidden bool editorconfig_trim_trailing_whitespace false
|
||||||
|
|
|
@ -8,6 +8,18 @@ hook global BufCreate .+\.(a(scii)?doc|asc) %{
|
||||||
set-option buffer filetype asciidoc
|
set-option buffer filetype asciidoc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook -group asciidoc-highlight global WinSetOption filetype=asciidoc %{
|
||||||
|
require-module asciidoc
|
||||||
|
|
||||||
|
add-highlighter window/asciidoc ref asciidoc
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/asciidoc }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module asciidoc %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -34,10 +46,4 @@ add-highlighter shared/asciidoc/ regex ^:[-\w]+: 0:meta
|
||||||
# Commands
|
# Commands
|
||||||
# ‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group asciidoc-highlight global WinSetOption filetype=asciidoc %{
|
|
||||||
add-highlighter window/asciidoc ref asciidoc
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/asciidoc }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,44 @@ hook global BufCreate .*\.m %{
|
||||||
set-option buffer filetype objc
|
set-option buffer filetype objc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=(c|cpp|objc) %[
|
||||||
|
require-module c-family
|
||||||
|
|
||||||
|
evaluate-commands "set-option window static_words %%opt{%val{hook_param_capture_1}_static_words}"
|
||||||
|
|
||||||
|
hook -group "%val{hook_param_capture_1}-trim-indent" window ModeChange insert:.* c-family-trim-indent
|
||||||
|
hook -group "%val{hook_param_capture_1}-insert" window InsertChar \n c-family-insert-on-newline
|
||||||
|
hook -group "%val{hook_param_capture_1}-indent" window InsertChar \n c-family-indent-on-newline
|
||||||
|
hook -group "%val{hook_param_capture_1}-indent" window InsertChar \{ c-family-indent-on-opening-curly-brace
|
||||||
|
hook -group "%val{hook_param_capture_1}-indent" window InsertChar \} c-family-indent-on-closing-curly-brace
|
||||||
|
hook -group "%val{hook_param_capture_1}-insert" window InsertChar \} c-family-insert-on-closing-curly-brace
|
||||||
|
|
||||||
|
alias window alt "%val{hook_param_capture_1}-alternative-file"
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* "
|
||||||
|
remove-hooks window %val{hook_param_capture_1}-.+
|
||||||
|
unalias window alt %val{hook_param_capture_1}-alternative-file
|
||||||
|
"
|
||||||
|
]
|
||||||
|
|
||||||
|
hook -group c-highlight global WinSetOption filetype=c %{
|
||||||
|
add-highlighter window/c ref c
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/c }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group cpp-highlight global WinSetOption filetype=cpp %{
|
||||||
|
add-highlighter window/cpp ref cpp
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cpp }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group objc-highlight global WinSetOption filetype=objc %{
|
||||||
|
add-highlighter window/objc ref objc
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/objc }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module c-family %§
|
||||||
|
|
||||||
define-command -hidden c-family-trim-indent %{
|
define-command -hidden c-family-trim-indent %{
|
||||||
# remove the line if it's empty when leaving the insert mode
|
# remove the line if it's empty when leaving the insert mode
|
||||||
try %{ execute-keys -draft <a-x> 1s^(\h+)$<ret> d }
|
try %{ execute-keys -draft <a-x> 1s^(\h+)$<ret> d }
|
||||||
|
@ -227,9 +265,7 @@ evaluate-commands %sh{
|
||||||
join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
|
join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
|
||||||
|
|
||||||
# Add the language's grammar to the static completion list
|
# Add the language's grammar to the static completion list
|
||||||
printf '%s\n' "hook global WinSetOption filetype=c %{
|
printf %s\\n "declare-option str-list c_static_words $(join "${keywords} ${attributes} ${types} ${macros}" ' ')"
|
||||||
set-option window static_words $(join "${keywords} ${attributes} ${types} ${macros}" ' ')
|
|
||||||
}"
|
|
||||||
|
|
||||||
# Highlight keywords
|
# Highlight keywords
|
||||||
printf %s "
|
printf %s "
|
||||||
|
@ -279,9 +315,7 @@ evaluate-commands %sh{
|
||||||
join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
|
join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
|
||||||
|
|
||||||
# Add the language's grammar to the static completion list
|
# Add the language's grammar to the static completion list
|
||||||
printf %s\\n "hook global WinSetOption filetype=cpp %{
|
printf %s\\n "declare-option str-list cpp_static_words $(join "${keywords} ${attributes} ${entities} ${types} ${values}" ' ')"
|
||||||
set-option window static_words $(join "${keywords} ${attributes} ${entities} ${types} ${values}" ' ')
|
|
||||||
}"
|
|
||||||
|
|
||||||
# Highlight keywords
|
# Highlight keywords
|
||||||
printf %s "
|
printf %s "
|
||||||
|
@ -321,9 +355,7 @@ evaluate-commands %sh{
|
||||||
join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
|
join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
|
||||||
|
|
||||||
# Add the language's grammar to the static completion list
|
# Add the language's grammar to the static completion list
|
||||||
printf %s\\n "hook global WinSetOption filetype=objc %{
|
printf %s\\n "declare-option str-list objc_static_words $(join "${keywords} ${attributes} ${types} ${values} ${decorators}" ' ')"
|
||||||
set-option window static_words $(join "${keywords} ${attributes} ${types} ${values} ${decorators}" ' ')
|
|
||||||
}"
|
|
||||||
|
|
||||||
# Highlight keywords
|
# Highlight keywords
|
||||||
printf %s "
|
printf %s "
|
||||||
|
@ -335,37 +367,6 @@ evaluate-commands %sh{
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global WinSetOption filetype=(c|cpp|objc) %[
|
|
||||||
hook -group "%val{hook_param_capture_1}-trim-indent" window ModeChange insert:.* c-family-trim-indent
|
|
||||||
hook -group "%val{hook_param_capture_1}-insert" window InsertChar \n c-family-insert-on-newline
|
|
||||||
hook -group "%val{hook_param_capture_1}-indent" window InsertChar \n c-family-indent-on-newline
|
|
||||||
hook -group "%val{hook_param_capture_1}-indent" window InsertChar \{ c-family-indent-on-opening-curly-brace
|
|
||||||
hook -group "%val{hook_param_capture_1}-indent" window InsertChar \} c-family-indent-on-closing-curly-brace
|
|
||||||
hook -group "%val{hook_param_capture_1}-insert" window InsertChar \} c-family-insert-on-closing-curly-brace
|
|
||||||
|
|
||||||
alias window alt "%val{hook_param_capture_1}-alternative-file"
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* "
|
|
||||||
remove-hooks window %val{hook_param_capture_1}-.+
|
|
||||||
unalias window alt %val{hook_param_capture_1}-alternative-file
|
|
||||||
"
|
|
||||||
]
|
|
||||||
|
|
||||||
hook -group c-highlight global WinSetOption filetype=c %{
|
|
||||||
add-highlighter window/c ref c
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/c }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook -group cpp-highlight global WinSetOption filetype=cpp %{
|
|
||||||
add-highlighter window/cpp ref cpp
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cpp }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook -group objc-highlight global WinSetOption filetype=objc %{
|
|
||||||
add-highlighter window/objc ref objc
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/objc }
|
|
||||||
}
|
|
||||||
|
|
||||||
declare-option -docstring %{control the type of include guard to be inserted in empty headers
|
declare-option -docstring %{control the type of include guard to be inserted in empty headers
|
||||||
Can be one of the following:
|
Can be one of the following:
|
||||||
ifdef: old style ifndef/define guard
|
ifdef: old style ifndef/define guard
|
||||||
|
@ -441,3 +442,5 @@ define-command cpp-alternative-file -docstring "Jump to the alternate cpp file (
|
||||||
define-command objc-alternative-file -docstring "Jump to the alternate objc file (header/implementation)" %{
|
define-command objc-alternative-file -docstring "Jump to the alternate objc file (header/implementation)" %{
|
||||||
c-family-alternative-file
|
c-family-alternative-file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
§
|
||||||
|
|
|
@ -8,6 +8,28 @@ hook global BufCreate .*[.](cabal) %{
|
||||||
set-option buffer filetype cabal
|
set-option buffer filetype cabal
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=cabal %[
|
||||||
|
require-module cabal
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group cabal-trim-indent cabal-trim-indent
|
||||||
|
hook window InsertChar \n -group cabal-indent cabal-indent-on-new-line
|
||||||
|
hook window InsertChar \{ -group cabal-indent cabal-indent-on-opening-curly-brace
|
||||||
|
hook window InsertChar \} -group cabal-indent cabal-indent-on-closing-curly-brace
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window cabal-.+ }
|
||||||
|
]
|
||||||
|
|
||||||
|
hook -group cabal-highlight global WinSetOption filetype=cabal %{
|
||||||
|
add-highlighter window/cabal ref cabal
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cabal }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module cabal %[
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -55,20 +77,4 @@ define-command -hidden cabal-indent-on-closing-curly-brace %[
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group cabal-highlight global WinSetOption filetype=cabal %{
|
|
||||||
add-highlighter window/cabal ref cabal
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cabal }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=cabal %[
|
|
||||||
hook window ModeChange insert:.* -group cabal-trim-indent cabal-trim-indent
|
|
||||||
hook window InsertChar \n -group cabal-indent cabal-indent-on-new-line
|
|
||||||
hook window InsertChar \{ -group cabal-indent cabal-indent-on-opening-curly-brace
|
|
||||||
hook window InsertChar \} -group cabal-indent cabal-indent-on-closing-curly-brace
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window cabal-.+ }
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# http://clojure.org
|
# http://clojure.org
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
# require lisp.kak
|
|
||||||
|
|
||||||
# Detection
|
# Detection
|
||||||
# ‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -10,6 +8,28 @@ hook global BufCreate .*[.](clj|cljc|cljs|cljx|edn) %{
|
||||||
set-option buffer filetype clojure
|
set-option buffer filetype clojure
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
hook global WinSetOption filetype=clojure %[
|
||||||
|
require-module clojure
|
||||||
|
|
||||||
|
set-option window static_words %opt{clojure_static_words}
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group clojure-trim-indent clojure-trim-indent
|
||||||
|
hook window InsertChar \n -group clojure-indent clojure-indent-on-new-line
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window clojure-.+ }
|
||||||
|
]
|
||||||
|
|
||||||
|
hook -group clojure-highlight global WinSetOption filetype=clojure %{
|
||||||
|
add-highlighter window/clojure ref clojure
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/clojure }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module clojure %{
|
||||||
|
|
||||||
|
require-module lisp
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -151,12 +171,11 @@ evaluate-commands %sh{
|
||||||
print_word_highlighter(core_fns, "function");
|
print_word_highlighter(core_fns, "function");
|
||||||
print_word_highlighter(core_vars, "variable");
|
print_word_highlighter(core_vars, "variable");
|
||||||
|
|
||||||
printf(" hook global WinSetOption filetype=clojure %%{\n"\
|
printf("declare-option str-list clojure_static_words ")
|
||||||
" set-option window static_words ");
|
|
||||||
print_static_words(keywords);
|
print_static_words(keywords);
|
||||||
print_static_words(core_fns);
|
print_static_words(core_fns);
|
||||||
print_static_words(core_vars);
|
print_static_words(core_vars);
|
||||||
printf("\n }\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
@ -193,16 +212,4 @@ define-command -hidden clojure-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
hook -group clojure-highlight global WinSetOption filetype=clojure %{
|
|
||||||
add-highlighter window/clojure ref clojure
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/clojure }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global WinSetOption filetype=clojure %[
|
|
||||||
hook window ModeChange insert:.* -group clojure-trim-indent clojure-trim-indent
|
|
||||||
hook window InsertChar \n -group clojure-indent clojure-indent-on-new-line
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window clojure-.+ }
|
|
||||||
]
|
|
||||||
|
|
|
@ -6,6 +6,17 @@ hook global BufCreate .*/CMakeCache.txt %{
|
||||||
set-option buffer filetype ini
|
set-option buffer filetype ini
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=cmake %{
|
||||||
|
require-module cmake
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group cmake-highlight global WinSetOption filetype=cmake %{
|
||||||
|
add-highlighter window/cmake ref cmake
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cmake }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module cmake %{
|
||||||
|
|
||||||
add-highlighter shared/cmake regions
|
add-highlighter shared/cmake regions
|
||||||
add-highlighter shared/cmake/code default-region group
|
add-highlighter shared/cmake/code default-region group
|
||||||
add-highlighter shared/cmake/comment region '#' '$' fill comment
|
add-highlighter shared/cmake/comment region '#' '$' fill comment
|
||||||
|
@ -21,7 +32,4 @@ add-highlighter shared/cmake/argument/quoted/ fill string
|
||||||
add-highlighter shared/cmake/argument/quoted/ regex '\$\{\w+\}' 0:variable
|
add-highlighter shared/cmake/argument/quoted/ regex '\$\{\w+\}' 0:variable
|
||||||
add-highlighter shared/cmake/argument/quoted/ regex '\w+\h*(?=\()' 0:function
|
add-highlighter shared/cmake/argument/quoted/ regex '\w+\h*(?=\()' 0:function
|
||||||
|
|
||||||
hook -group cmake-highlight global WinSetOption filetype=cmake %{
|
|
||||||
add-highlighter window/cmake ref cmake
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cmake }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,26 @@ hook global BufCreate .*[.](coffee) %{
|
||||||
set-option buffer filetype coffee
|
set-option buffer filetype coffee
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=coffee %{
|
||||||
|
require-module coffee
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group coffee-trim-indent coffee-trim-indent
|
||||||
|
hook window InsertChar \n -group coffee-indent coffee-indent-on-new-line
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window coffee-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group coffee-highlight global WinSetOption filetype=coffee %{
|
||||||
|
add-highlighter window/coffee ref coffee
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/coffee }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module coffee %[
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -63,17 +83,4 @@ define-command -hidden coffee-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
]
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group coffee-highlight global WinSetOption filetype=coffee %{
|
|
||||||
add-highlighter window/coffee ref coffee
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/coffee }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=coffee %{
|
|
||||||
hook window ModeChange insert:.* -group coffee-trim-indent coffee-trim-indent
|
|
||||||
hook window InsertChar \n -group coffee-indent coffee-indent-on-new-line
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window coffee-.+ }
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,6 +8,28 @@ hook global BufCreate .*[.](css) %{
|
||||||
set-option buffer filetype css
|
set-option buffer filetype css
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=css %[
|
||||||
|
require-module css
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group css-trim-indent css-trim-indent
|
||||||
|
hook window InsertChar \n -group css-indent css-indent-on-new-line
|
||||||
|
hook window InsertChar \} -group css-indent css-indent-on-closing-curly-brace
|
||||||
|
set-option buffer extra_word_chars '_' '-'
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window css-.+ }
|
||||||
|
]
|
||||||
|
|
||||||
|
hook -group css-highlight global WinSetOption filetype=css %{
|
||||||
|
add-highlighter window/css ref css
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/css }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module css %[
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -58,19 +80,4 @@ define-command -hidden css-indent-on-closing-curly-brace %[
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group css-highlight global WinSetOption filetype=css %{
|
|
||||||
add-highlighter window/css ref css
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/css }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=css %[
|
|
||||||
hook window ModeChange insert:.* -group css-trim-indent css-trim-indent
|
|
||||||
hook window InsertChar \n -group css-indent css-indent-on-new-line
|
|
||||||
hook window InsertChar \} -group css-indent css-indent-on-closing-curly-brace
|
|
||||||
set-option buffer extra_word_chars '_' '-'
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window css-.+ }
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -8,6 +8,26 @@ hook global BufCreate .*[.](feature|story) %{
|
||||||
set-option buffer filetype cucumber
|
set-option buffer filetype cucumber
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=cucumber %{
|
||||||
|
require-module cucumber
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group cucumber-trim-indent cucumber-trim-indent
|
||||||
|
hook window InsertChar \n -group cucumber-indent cucumber-indent-on-new-line
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window cucumber-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group cucumber-highlight global WinSetOption filetype=cucumber %{
|
||||||
|
add-highlighter window/cucumber ref cucumber
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cucumber }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module cucumber %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -73,17 +93,4 @@ define-command -hidden cucumber-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group cucumber-highlight global WinSetOption filetype=cucumber %{
|
|
||||||
add-highlighter window/cucumber ref cucumber
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cucumber }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=cucumber %{
|
|
||||||
hook window ModeChange insert:.* -group cucumber-trim-indent cucumber-trim-indent
|
|
||||||
hook window InsertChar \n -group cucumber-indent cucumber-indent-on-new-line
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window cucumber-.+ }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,30 @@ hook global BufCreate .*\.di? %{
|
||||||
set-option buffer filetype d
|
set-option buffer filetype d
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=d %{
|
||||||
|
require-module d
|
||||||
|
|
||||||
|
set-option window static_words %opt{d_static_words}
|
||||||
|
|
||||||
|
# cleanup trailing whitespaces when exiting insert mode
|
||||||
|
hook window ModeChange insert:.* -group d-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
||||||
|
hook window InsertChar \n -group d-indent d-indent-on-new-line
|
||||||
|
hook window InsertChar \{ -group d-indent d-indent-on-opening-curly-brace
|
||||||
|
hook window InsertChar \} -group d-indent d-indent-on-closing-curly-brace
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window d-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group d-highlight global WinSetOption filetype=d %{
|
||||||
|
add-highlighter window/d ref d
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/d }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module d %§
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -62,9 +86,7 @@ evaluate-commands %sh{
|
||||||
decorators="disable|property|nogc|safe|trusted|system"
|
decorators="disable|property|nogc|safe|trusted|system"
|
||||||
|
|
||||||
# Add the language's grammar to the static completion list
|
# Add the language's grammar to the static completion list
|
||||||
printf %s\\n "hook global WinSetOption filetype=d %{
|
printf %s\\n "declare-option str-list d_static_words ${keywords} ${attributes} ${types} ${values} ${decorators} ${properties}" | tr '|' ' '
|
||||||
set-option window static_words ${keywords} ${attributes} ${types} ${values} ${decorators} ${properties}
|
|
||||||
}" | tr '|' ' '
|
|
||||||
|
|
||||||
# Highlight keywords
|
# Highlight keywords
|
||||||
printf %s "
|
printf %s "
|
||||||
|
@ -113,20 +135,4 @@ define-command -hidden d-indent-on-closing-curly-brace %[
|
||||||
try %[ execute-keys -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
try %[ execute-keys -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Initialization
|
§
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group d-highlight global WinSetOption filetype=d %{
|
|
||||||
add-highlighter window/d ref d
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/d }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=d %{
|
|
||||||
# cleanup trailing whitespaces when exiting insert mode
|
|
||||||
hook window ModeChange insert:.* -group d-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
|
||||||
hook window InsertChar \n -group d-indent d-indent-on-new-line
|
|
||||||
hook window InsertChar \{ -group d-indent d-indent-on-opening-curly-brace
|
|
||||||
hook window InsertChar \} -group d-indent d-indent-on-closing-curly-brace
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window d-.+ }
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,6 +8,31 @@ hook global BufCreate .*\.dart %{
|
||||||
set-option buffer filetype dart
|
set-option buffer filetype dart
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=dart %{
|
||||||
|
require-module dart
|
||||||
|
|
||||||
|
set-option window static_words %opt{dart_static_words}
|
||||||
|
|
||||||
|
# cleanup trailing whitespaces when exiting insert mode
|
||||||
|
hook window ModeChange insert:.* -group dart-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
||||||
|
hook window InsertChar \n -group dart-indent dart-indent-on-new-line
|
||||||
|
hook window InsertChar \{ -group dart-indent dart-indent-on-opening-curly-brace
|
||||||
|
hook window InsertChar \} -group dart-indent dart-indent-on-closing-curly-brace
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window dart-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group dart-highlight global WinSetOption filetype=dart %{
|
||||||
|
add-highlighter window/dart ref dart
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/dart }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module dart %§
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -38,9 +63,7 @@ evaluate-commands %sh{
|
||||||
classes="[A-Z][a-zA-Z0-9]*"
|
classes="[A-Z][a-zA-Z0-9]*"
|
||||||
|
|
||||||
# Add the language's grammar to the static completion list
|
# Add the language's grammar to the static completion list
|
||||||
printf %s\\n "hook global WinSetOption filetype=dart %{
|
printf %s\\n "declare-option str-list dart_static_words ${keywords} ${attributes} ${types} ${values}" | tr '|' ' '
|
||||||
set-option window static_words ${keywords} ${attributes} ${types} ${values}
|
|
||||||
}" | tr '|' ' '
|
|
||||||
|
|
||||||
# Highlight keywords
|
# Highlight keywords
|
||||||
printf %s "
|
printf %s "
|
||||||
|
@ -87,20 +110,4 @@ define-command -hidden dart-indent-on-closing-curly-brace %[
|
||||||
try %[ execute-keys -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
try %[ execute-keys -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Initialization
|
§
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group dart-highlight global WinSetOption filetype=dart %{
|
|
||||||
add-highlighter window/dart ref dart
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/dart }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=dart %{
|
|
||||||
# cleanup trailing whitespaces when exiting insert mode
|
|
||||||
hook window ModeChange insert:.* -group dart-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
|
||||||
hook window InsertChar \n -group dart-indent dart-indent-on-new-line
|
|
||||||
hook window InsertChar \{ -group dart-indent dart-indent-on-opening-curly-brace
|
|
||||||
hook window InsertChar \} -group dart-indent dart-indent-on-closing-curly-brace
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window dart-.+ }
|
|
||||||
}
|
|
||||||
|
|
|
@ -10,6 +10,21 @@ hook global BufCreate .*/?Dockerfile(\.\w+)?$ %{
|
||||||
set-option buffer filetype dockerfile
|
set-option buffer filetype dockerfile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=dockerfile %{
|
||||||
|
require-module dockerfile
|
||||||
|
set-option window static_words %opt{dockerfile_static_words}
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group dockerfile-highlight global WinSetOption filetype=dockerfile %{
|
||||||
|
add-highlighter window/dockerfile ref dockerfile
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/dockerfile }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module dockerfile %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -25,9 +40,7 @@ evaluate-commands %sh{
|
||||||
keywords="${keywords}|MAINTAINER|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR"
|
keywords="${keywords}|MAINTAINER|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR"
|
||||||
|
|
||||||
# Add the language's grammar to the static completion list
|
# Add the language's grammar to the static completion list
|
||||||
printf %s\\n "hook global WinSetOption filetype=dockerfile %{
|
printf %s\\n "declare-option str-list dockerfile_static_words ONBUILD|${keywords}" | tr '|' ' '
|
||||||
set window static_words ONBUILD|${keywords}
|
|
||||||
}" | tr '|' ' '
|
|
||||||
|
|
||||||
# Highlight keywords
|
# Highlight keywords
|
||||||
printf %s "
|
printf %s "
|
||||||
|
@ -39,10 +52,4 @@ evaluate-commands %sh{
|
||||||
add-highlighter shared/dockerfile/code/ regex '\$\{[\w_]+\}' 0:value
|
add-highlighter shared/dockerfile/code/ regex '\$\{[\w_]+\}' 0:value
|
||||||
add-highlighter shared/dockerfile/code/ regex '\$[\w_]+' 0:value
|
add-highlighter shared/dockerfile/code/ regex '\$[\w_]+' 0:value
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group dockerfile-highlight global WinSetOption filetype=dockerfile %{
|
|
||||||
add-highlighter window/dockerfile ref dockerfile
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/dockerfile }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,25 @@ hook global BufCreate .*[.](ex|exs) %{
|
||||||
set-option buffer filetype elixir
|
set-option buffer filetype elixir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=elixir %{
|
||||||
|
require-module elixir
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group elixir-trim-indent elixir-trim-indent
|
||||||
|
hook window InsertChar \n -group elixir-indent elixir-indent-on-new-line
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window elixir-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group elixir-highlight global WinSetOption filetype=elixir %{
|
||||||
|
add-highlighter window/elixir ref elixir
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/elixir }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module elixir %[
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
@ -48,11 +67,11 @@ define-command -hidden elixir-trim-indent %{
|
||||||
|
|
||||||
define-command -hidden elixir-indent-on-new-line %{
|
define-command -hidden elixir-indent-on-new-line %{
|
||||||
evaluate-commands -draft -itersel %{
|
evaluate-commands -draft -itersel %{
|
||||||
# copy -- comments prefix and following white spaces
|
# copy -- comments prefix and following white spaces
|
||||||
try %{ execute-keys -draft k <a-x> s ^\h*\K--\h* <ret> y gh j P }
|
try %{ execute-keys -draft k <a-x> s ^\h*\K--\h* <ret> y gh j P }
|
||||||
# preserve previous line indent
|
# preserve previous line indent
|
||||||
try %{ execute-keys -draft \; K <a-&> }
|
try %{ execute-keys -draft \; K <a-&> }
|
||||||
# indent after line ending with:
|
# indent after line ending with:
|
||||||
# try %{ execute-keys -draft k x <a-k> (do|else|->)$ <ret> & }
|
# try %{ execute-keys -draft k x <a-k> (do|else|->)$ <ret> & }
|
||||||
# filter previous line
|
# filter previous line
|
||||||
try %{ execute-keys -draft k : elixir-trim-indent <ret> }
|
try %{ execute-keys -draft k : elixir-trim-indent <ret> }
|
||||||
|
@ -61,17 +80,4 @@ define-command -hidden elixir-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
]
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group elixir-highlight global WinSetOption filetype=elixir %{
|
|
||||||
add-highlighter window/elixir ref elixir
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/elixir }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=elixir %{
|
|
||||||
hook window ModeChange insert:.* -group elixir-trim-indent elixir-trim-indent
|
|
||||||
hook window InsertChar \n -group elixir-indent elixir-indent-on-new-line
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window elixir-.+ }
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,6 +8,25 @@ hook global BufCreate .*[.](elm) %{
|
||||||
set-option buffer filetype elm
|
set-option buffer filetype elm
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=elm %{
|
||||||
|
require-module elm
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group elm-trim-indent elm-trim-indent
|
||||||
|
hook window InsertChar \n -group elm-indent elm-indent-on-new-line
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window elm-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group elm-highlight global WinSetOption filetype=elm %{
|
||||||
|
add-highlighter window/elm ref elm
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/elm }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module elm %[
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -51,17 +70,4 @@ define-command -hidden elm-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
]
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group elm-highlight global WinSetOption filetype=elm %{
|
|
||||||
add-highlighter window/elm ref elm
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/elm }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=elm %{
|
|
||||||
hook window ModeChange insert:.* -group elm-trim-indent elm-trim-indent
|
|
||||||
hook window InsertChar \n -group elm-indent elm-indent-on-new-line
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window elm-.+ }
|
|
||||||
}
|
|
||||||
|
|
|
@ -11,69 +11,85 @@ hook global BufCreate .*/etc/env.d/.* %{ set-option buffer fil
|
||||||
hook global BufCreate .*/etc/profile(\.(csh|env))? %{ set-option buffer filetype sh }
|
hook global BufCreate .*/etc/profile(\.(csh|env))? %{ set-option buffer filetype sh }
|
||||||
hook global BufCreate .*/etc/profile\.d/.* %{ set-option buffer filetype sh }
|
hook global BufCreate .*/etc/profile\.d/.* %{ set-option buffer filetype sh }
|
||||||
|
|
||||||
# Highlighters
|
|
||||||
## /etc/resolv.conf
|
hook global WinSetOption filetype=etc-(hosts|resolv-conf|shadow|passwd|gshadow|group|fstab) %{
|
||||||
add-highlighter shared/etc-resolv-conf group
|
require-module "etc-%val{hook_param_capture_1}"
|
||||||
add-highlighter shared/etc-resolv-conf/ regex ^#.*?$ 0:comment
|
}
|
||||||
add-highlighter shared/etc-resolv-conf/ regex ^(nameserver|server|domain|sortlist|options)[\s\t]+(.*?)$ 1:type 2:attribute
|
|
||||||
|
|
||||||
hook -group etc-resolv-conf-highlight global WinSetOption filetype=etc-resolv-conf %{
|
hook -group etc-resolv-conf-highlight global WinSetOption filetype=etc-resolv-conf %{
|
||||||
add-highlighter window/etc-resolv-conf ref etc-resolv-conf
|
add-highlighter window/etc-resolv-conf ref etc-resolv-conf
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-resolv-conf }
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-resolv-conf }
|
||||||
}
|
}
|
||||||
|
|
||||||
## /etc/hosts
|
|
||||||
add-highlighter shared/etc-hosts group
|
|
||||||
add-highlighter shared/etc-hosts/ regex ^(.+?)[\s\t]+?(.*?)$ 1:type 2:attribute
|
|
||||||
add-highlighter shared/etc-hosts/ regex '#.*?$' 0:comment
|
|
||||||
|
|
||||||
hook -group etc-hosts-highlight global WinSetOption filetype=etc-hosts %{
|
hook -group etc-hosts-highlight global WinSetOption filetype=etc-hosts %{
|
||||||
add-highlighter window/etc-hosts ref etc-hosts
|
add-highlighter window/etc-hosts ref etc-hosts
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-hosts }
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-hosts }
|
||||||
}
|
}
|
||||||
|
|
||||||
## /etc/fstab
|
|
||||||
add-highlighter shared/etc-fstab group
|
|
||||||
add-highlighter shared/etc-fstab/ regex ^(\S{1,})\s+?(\S{1,})\s+?(\S{1,})\s+?(\S{1,})\s+?(\S{1,})\s+?(\S{1,})(?:\s+)?$ 1:keyword 2:value 3:type 4:string 5:attribute 6:attribute
|
|
||||||
add-highlighter shared/etc-fstab/ regex '#.*?$' 0:comment
|
|
||||||
|
|
||||||
hook -group etc-fstab-highlight global WinSetOption filetype=etc-fstab %{
|
hook -group etc-fstab-highlight global WinSetOption filetype=etc-fstab %{
|
||||||
add-highlighter window/etc-fstab ref etc-fstab
|
add-highlighter window/etc-fstab ref etc-fstab
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-fstab }
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-fstab }
|
||||||
}
|
}
|
||||||
|
|
||||||
## /etc/group
|
|
||||||
add-highlighter shared/etc-group group
|
|
||||||
add-highlighter shared/etc-group/ regex ^(\S+?):(\S+?)?:(\S+?)?:(\S+?)?$ 1:keyword 2:type 3:value 4:string
|
|
||||||
|
|
||||||
hook -group etc-group-highlight global WinSetOption filetype=etc-group %{
|
hook -group etc-group-highlight global WinSetOption filetype=etc-group %{
|
||||||
add-highlighter window/etc-group ref etc-group
|
add-highlighter window/etc-group ref etc-group
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-group }
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-group }
|
||||||
}
|
}
|
||||||
|
|
||||||
## /etc/gshadow
|
|
||||||
add-highlighter shared/etc-gshadow group
|
|
||||||
add-highlighter shared/etc-gshadow/ regex ^(\S+?):(\S+?)?:(\S+?)?:(\S+?)?$ 1:keyword 2:type 3:value 4:string
|
|
||||||
|
|
||||||
hook -group etc-gshadow-highlight global WinSetOption filetype=etc-gshadow %{
|
hook -group etc-gshadow-highlight global WinSetOption filetype=etc-gshadow %{
|
||||||
add-highlighter window/etc-gshadow ref etc-gshadow
|
add-highlighter window/etc-gshadow ref etc-gshadow
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-gshadow }
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-gshadow }
|
||||||
}
|
}
|
||||||
|
|
||||||
## /etc/shadow
|
|
||||||
add-highlighter shared/etc-shadow group
|
|
||||||
add-highlighter shared/etc-shadow/ regex ^(\S+?):(\S+?):([0-9]+?):([0-9]+?)?:([0-9]+?)?:([0-9]+?)?:([0-9]+?)?:([0-9]+?)?:(.*?)?$ 1:keyword 2:type 3:value 4:value 5:value 6:value 7:value 8:value
|
|
||||||
|
|
||||||
hook -group etc-shadow-highlight global WinSetOption filetype=etc-shadow %{
|
hook -group etc-shadow-highlight global WinSetOption filetype=etc-shadow %{
|
||||||
add-highlighter window/etc-shadow ref etc-shadow
|
add-highlighter window/etc-shadow ref etc-shadow
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-shadow }
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-shadow }
|
||||||
}
|
}
|
||||||
|
|
||||||
## /etc/passwd
|
|
||||||
add-highlighter shared/etc-passwd group
|
|
||||||
add-highlighter shared/etc-passwd/ regex ^(\S+?):(\S+?):([0-9]+?):([0-9]+?):(.*?)?:(.+?):(.+?)$ 1:keyword 2:type 3:value 4:value 5:string 6:attribute 7:attribute
|
|
||||||
|
|
||||||
hook -group etc-passwd-highlight global WinSetOption filetype=etc-passwd %{
|
hook -group etc-passwd-highlight global WinSetOption filetype=etc-passwd %{
|
||||||
add-highlighter window/etc-passwd ref etc-passwd
|
add-highlighter window/etc-passwd ref etc-passwd
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-passwd }
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-passwd }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Highlighters
|
||||||
|
|
||||||
|
provide-module etc-resolv-conf %{
|
||||||
|
## /etc/resolv.conf
|
||||||
|
add-highlighter shared/etc-resolv-conf group
|
||||||
|
add-highlighter shared/etc-resolv-conf/ regex ^#.*?$ 0:comment
|
||||||
|
add-highlighter shared/etc-resolv-conf/ regex ^(nameserver|server|domain|sortlist|options)[\s\t]+(.*?)$ 1:type 2:attribute
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module etc-hosts %{
|
||||||
|
## /etc/hosts
|
||||||
|
add-highlighter shared/etc-hosts group
|
||||||
|
add-highlighter shared/etc-hosts/ regex ^(.+?)[\s\t]+?(.*?)$ 1:type 2:attribute
|
||||||
|
add-highlighter shared/etc-hosts/ regex '#.*?$' 0:comment
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module etc-fstab %{
|
||||||
|
## /etc/fstab
|
||||||
|
add-highlighter shared/etc-fstab group
|
||||||
|
add-highlighter shared/etc-fstab/ regex ^(\S{1,})\s+?(\S{1,})\s+?(\S{1,})\s+?(\S{1,})\s+?(\S{1,})\s+?(\S{1,})(?:\s+)?$ 1:keyword 2:value 3:type 4:string 5:attribute 6:attribute
|
||||||
|
add-highlighter shared/etc-fstab/ regex '#.*?$' 0:comment
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module etc-group %{
|
||||||
|
## /etc/group
|
||||||
|
add-highlighter shared/etc-group group
|
||||||
|
add-highlighter shared/etc-group/ regex ^(\S+?):(\S+?)?:(\S+?)?:(\S+?)?$ 1:keyword 2:type 3:value 4:string
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module etc-gshadow %{
|
||||||
|
## /etc/gshadow
|
||||||
|
add-highlighter shared/etc-gshadow group
|
||||||
|
add-highlighter shared/etc-gshadow/ regex ^(\S+?):(\S+?)?:(\S+?)?:(\S+?)?$ 1:keyword 2:type 3:value 4:string
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module etc-shadow %{
|
||||||
|
## /etc/shadow
|
||||||
|
add-highlighter shared/etc-shadow group
|
||||||
|
add-highlighter shared/etc-shadow/ regex ^(\S+?):(\S+?):([0-9]+?):([0-9]+?)?:([0-9]+?)?:([0-9]+?)?:([0-9]+?)?:([0-9]+?)?:(.*?)?$ 1:keyword 2:type 3:value 4:value 5:value 6:value 7:value 8:value
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module etc-passwd %{
|
||||||
|
## /etc/passwd
|
||||||
|
add-highlighter shared/etc-passwd group
|
||||||
|
add-highlighter shared/etc-passwd/ regex ^(\S+?):(\S+?):([0-9]+?):([0-9]+?):(.*?)?:(.+?):(.+?)$ 1:keyword 2:type 3:value 4:value 5:string 6:attribute 7:attribute
|
||||||
|
}
|
||||||
|
|
|
@ -25,6 +25,26 @@ hook global BufCreate .*/etc/paludis(-.*)?/repository_defaults\.conf
|
||||||
hook global BufCreate .*/etc/paludis(-.*)?/specpath\.conf %{ set-option buffer filetype paludis-key-value-conf }
|
hook global BufCreate .*/etc/paludis(-.*)?/specpath\.conf %{ set-option buffer filetype paludis-key-value-conf }
|
||||||
hook global BufCreate .*/etc/paludis(-.*)?/suggestions(\.conf.d/.*.conf|\.conf) %{ set-option buffer filetype paludis-specs-conf }
|
hook global BufCreate .*/etc/paludis(-.*)?/suggestions(\.conf.d/.*.conf|\.conf) %{ set-option buffer filetype paludis-specs-conf }
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=exheres-0-(metadata|options-descriptions|licence-groups) %{
|
||||||
|
require-module exheres
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group exheres-0-metadata-highlight global WinSetOption filetype=exheres-0-metadata %{
|
||||||
|
add-highlighter window/exheres-0-metadata ref exheres-0-metadata
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/exheres-0-metadata }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group exheres-0-options-descriptions-highlight global WinSetOption filetype=exheres-0-options-descriptions %{
|
||||||
|
add-highlighter window/exheres-0-options-descriptions ref exheres-0-options-descriptions
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/exheres-0-options-descriptions }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group exheres-0-licence-groups-highlight global WinSetOption filetype=exheres-0-licence-groups %{
|
||||||
|
add-highlighter window/exheres-0-licence-groups ref exheres-0-licence-groups
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/exheres-0-licence-groups }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module exheres %{
|
||||||
# Highlighters
|
# Highlighters
|
||||||
## exheres-0 Repository metadata files
|
## exheres-0 Repository metadata files
|
||||||
add-highlighter shared/exheres-0-metadata group
|
add-highlighter shared/exheres-0-metadata group
|
||||||
|
@ -34,11 +54,6 @@ add-highlighter shared/exheres-0-metadata/ regex ^(?:[\s\t]+)?[\S]+[\s\t]+=[\s\t
|
||||||
add-highlighter shared/exheres-0-metadata/ regex ^(?:[\s\t]+)?(\S+)\s\[\[$ 0:type
|
add-highlighter shared/exheres-0-metadata/ regex ^(?:[\s\t]+)?(\S+)\s\[\[$ 0:type
|
||||||
add-highlighter shared/exheres-0-metadata/ regex ^(?:[\s\t]+)?\]\]$ 0:type
|
add-highlighter shared/exheres-0-metadata/ regex ^(?:[\s\t]+)?\]\]$ 0:type
|
||||||
|
|
||||||
hook -group exheres-0-metadata-highlight global WinSetOption filetype=exheres-0-metadata %{
|
|
||||||
add-highlighter window/exheres-0-metadata ref exheres-0-metadata
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/exheres-0-metadata }
|
|
||||||
}
|
|
||||||
|
|
||||||
## exheres-0 options descriptions
|
## exheres-0 options descriptions
|
||||||
add-highlighter shared/exheres-0-options-descriptions group
|
add-highlighter shared/exheres-0-options-descriptions group
|
||||||
add-highlighter shared/exheres-0-options-descriptions/ regex ^#.*?$ 0:comment
|
add-highlighter shared/exheres-0-options-descriptions/ regex ^#.*?$ 0:comment
|
||||||
|
@ -46,22 +61,37 @@ add-highlighter shared/exheres-0-options-descriptions/ regex ^(?:[\s\t]+)?[\S]+[
|
||||||
add-highlighter shared/exheres-0-options-descriptions/ regex ^(?:[\s\t]+)?(\S+)\s\[\[$ 0:type
|
add-highlighter shared/exheres-0-options-descriptions/ regex ^(?:[\s\t]+)?(\S+)\s\[\[$ 0:type
|
||||||
add-highlighter shared/exheres-0-options-descriptions/ regex ^(?:[\s\t]+)?\]\]$ 0:type
|
add-highlighter shared/exheres-0-options-descriptions/ regex ^(?:[\s\t]+)?\]\]$ 0:type
|
||||||
|
|
||||||
hook -group exheres-0-options-descriptions-highlight global WinSetOption filetype=exheres-0-options-descriptions %{
|
|
||||||
add-highlighter window/exheres-0-options-descriptions ref exheres-0-options-descriptions
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/exheres-0-options-descriptions }
|
|
||||||
}
|
|
||||||
|
|
||||||
## metadata/licence_groups.conf
|
## metadata/licence_groups.conf
|
||||||
add-highlighter shared/exheres-0-licence-groups group
|
add-highlighter shared/exheres-0-licence-groups group
|
||||||
add-highlighter shared/exheres-0-licence-groups/ regex [\s\t]+(\S+(?:[\s\t]+))*$ 0:attribute
|
add-highlighter shared/exheres-0-licence-groups/ regex [\s\t]+(\S+(?:[\s\t]+))*$ 0:attribute
|
||||||
add-highlighter shared/exheres-0-licence-groups/ regex ^(\S+) 0:type
|
add-highlighter shared/exheres-0-licence-groups/ regex ^(\S+) 0:type
|
||||||
add-highlighter shared/exheres-0-licence-groups/ regex ^#.*?$ 0:comment
|
add-highlighter shared/exheres-0-licence-groups/ regex ^#.*?$ 0:comment
|
||||||
|
|
||||||
hook -group exheres-0-licence-groups-highlight global WinSetOption filetype=exheres-0-licence-groups %{
|
|
||||||
add-highlighter window/exheres-0-licence-groups ref exheres-0-licence-groups
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/exheres-0-licence-groups }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=paludis-(key-value|options|mirrors|specs)-conf %{
|
||||||
|
require-module paludis
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group paludis-options-conf-highlight global WinSetOption filetype=paludis-options-conf %{
|
||||||
|
add-highlighter window/paludis-options-conf ref paludis-options-conf
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/paludis-options-conf }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group paludis-key-value-conf-highlight global WinSetOption filetype=paludis-key-value-conf %{
|
||||||
|
add-highlighter window/paludis-key-value-conf ref paludis-key-value-conf
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/paludis-key-value-conf }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group paludis-mirrors-conf-highlight global WinSetOption filetype=paludis-mirrors-conf %{
|
||||||
|
add-highlighter window/paludis-mirrors-conf ref paludis-mirrors-conf
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/paludis-mirrors-conf }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group paludis-specs-conf-highlight global WinSetOption filetype=paludis-specs-conf %{
|
||||||
|
add-highlighter window/paludis-specs-conf ref paludis-specs-conf
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/paludis-specs-conf }
|
||||||
|
}
|
||||||
|
provide-module paludis %{
|
||||||
## Paludis configurations
|
## Paludis configurations
|
||||||
### options.conf
|
### options.conf
|
||||||
add-highlighter shared/paludis-options-conf group
|
add-highlighter shared/paludis-options-conf group
|
||||||
|
@ -73,49 +103,36 @@ add-highlighter shared/paludis-options-conf/ regex [\s\t](-\S+)(.*?) 1:red
|
||||||
add-highlighter shared/paludis-options-conf/ regex ^(\S+/\S+) 0:type
|
add-highlighter shared/paludis-options-conf/ regex ^(\S+/\S+) 0:type
|
||||||
add-highlighter shared/paludis-options-conf/ regex ^#.*?$ 0:comment
|
add-highlighter shared/paludis-options-conf/ regex ^#.*?$ 0:comment
|
||||||
|
|
||||||
hook -group paludis-options-conf-highlight global WinSetOption filetype=paludis-options-conf %{
|
|
||||||
add-highlighter window/paludis-options-conf ref paludis-options-conf
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/paludis-options-conf }
|
|
||||||
}
|
|
||||||
|
|
||||||
## general.conf, repository.template
|
## general.conf, repository.template
|
||||||
add-highlighter shared/paludis-key-value-conf group
|
add-highlighter shared/paludis-key-value-conf group
|
||||||
add-highlighter shared/paludis-key-value-conf/ regex ^[\s\t]?(\S+)[\s\t+]=[\s\t+](.*?)$ 1:attribute 2:value
|
add-highlighter shared/paludis-key-value-conf/ regex ^[\s\t]?(\S+)[\s\t+]=[\s\t+](.*?)$ 1:attribute 2:value
|
||||||
add-highlighter shared/paludis-key-value-conf/ regex ^#.*?$ 0:comment
|
add-highlighter shared/paludis-key-value-conf/ regex ^#.*?$ 0:comment
|
||||||
|
|
||||||
hook -group paludis-key-value-conf-highlight global WinSetOption filetype=paludis-key-value-conf %{
|
|
||||||
add-highlighter window/paludis-key-value-conf ref paludis-key-value-conf
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/paludis-key-value-conf }
|
|
||||||
}
|
|
||||||
|
|
||||||
## mirrors.conf
|
## mirrors.conf
|
||||||
add-highlighter shared/paludis-mirrors-conf group
|
add-highlighter shared/paludis-mirrors-conf group
|
||||||
add-highlighter shared/paludis-mirrors-conf/ regex ^[\s\t+]?(\S+)[\s\t+](.*?)$ 1:type 2:value
|
add-highlighter shared/paludis-mirrors-conf/ regex ^[\s\t+]?(\S+)[\s\t+](.*?)$ 1:type 2:value
|
||||||
add-highlighter shared/paludis-mirrors-conf/ regex ^#.*?$ 0:comment
|
add-highlighter shared/paludis-mirrors-conf/ regex ^#.*?$ 0:comment
|
||||||
|
|
||||||
hook -group paludis-mirrors-conf-highlight global WinSetOption filetype=paludis-mirrors-conf %{
|
|
||||||
add-highlighter window/paludis-mirrors-conf ref paludis-mirrors-conf
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/paludis-mirrors-conf }
|
|
||||||
}
|
|
||||||
|
|
||||||
## package_(unmask|mask).conf, platforms.conf
|
## package_(unmask|mask).conf, platforms.conf
|
||||||
add-highlighter shared/paludis-specs-conf group
|
add-highlighter shared/paludis-specs-conf group
|
||||||
add-highlighter shared/paludis-specs-conf/ regex [\s\t]+(\S+(?:[\s\t]+))*$ 0:attribute
|
add-highlighter shared/paludis-specs-conf/ regex [\s\t]+(\S+(?:[\s\t]+))*$ 0:attribute
|
||||||
add-highlighter shared/paludis-specs-conf/ regex ^(\S+/\S+) 0:type
|
add-highlighter shared/paludis-specs-conf/ regex ^(\S+/\S+) 0:type
|
||||||
add-highlighter shared/paludis-specs-conf/ regex ^#.*?$ 0:comment
|
add-highlighter shared/paludis-specs-conf/ regex ^#.*?$ 0:comment
|
||||||
|
|
||||||
hook -group paludis-specs-conf-highlight global WinSetOption filetype=paludis-specs-conf %{
|
|
||||||
add-highlighter window/paludis-specs-conf ref paludis-specs-conf
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/paludis-specs-conf }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
## News items (GLEP42)
|
hook global WinSetOption filetype=glep42 %{
|
||||||
add-highlighter shared/glep42 group
|
require-module glep42
|
||||||
add-highlighter shared/glep42/ regex ^(Title|Author|Translator|Content-Type|Posted|Revision|News-Item-Format|Display-If-Installed|Display-If-Keyword|Display-If-Profile):([^\n]*(?:\n\h+[^\n]+)*)$ 1:keyword 2:attribute
|
}
|
||||||
add-highlighter shared/glep42/ regex <[^@>]+@.*?> 0:string
|
|
||||||
add-highlighter shared/glep42/ regex ^>.*?$ 0:comment
|
|
||||||
|
|
||||||
hook -group glep42-highlight global WinSetOption filetype=glep42 %{
|
hook -group glep42-highlight global WinSetOption filetype=glep42 %{
|
||||||
add-highlighter window/glep42 ref glep42
|
add-highlighter window/glep42 ref glep42
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/glep42 }
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/glep42 }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provide-module glep42 %{
|
||||||
|
## News items (GLEP42)
|
||||||
|
add-highlighter shared/glep42 group
|
||||||
|
add-highlighter shared/glep42/ regex ^(Title|Author|Translator|Content-Type|Posted|Revision|News-Item-Format|Display-If-Installed|Display-If-Keyword|Display-If-Profile):([^\n]*(?:\n\h+[^\n]+)*)$ 1:keyword 2:attribute
|
||||||
|
add-highlighter shared/glep42/ regex <[^@>]+@.*?> 0:string
|
||||||
|
add-highlighter shared/glep42/ regex ^>.*?$ 0:comment
|
||||||
|
}
|
||||||
|
|
|
@ -8,6 +8,26 @@ hook global BufCreate .*[.](fish) %{
|
||||||
set-option buffer filetype fish
|
set-option buffer filetype fish
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=fish %{
|
||||||
|
require-module fish
|
||||||
|
|
||||||
|
hook window InsertChar .* -group fish-indent fish-indent-on-char
|
||||||
|
hook window InsertChar \n -group fish-indent fish-indent-on-new-line
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window fish-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group fish-highlight global WinSetOption filetype=fish %{
|
||||||
|
add-highlighter window/fish ref fish
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/fish }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module fish %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -57,17 +77,4 @@ define-command -hidden fish-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group fish-highlight global WinSetOption filetype=fish %{
|
|
||||||
add-highlighter window/fish ref fish
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/fish }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=fish %{
|
|
||||||
hook window InsertChar .* -group fish-indent fish-indent-on-char
|
|
||||||
hook window InsertChar \n -group fish-indent fish-indent-on-new-line
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window fish-.+ }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,21 @@ hook global BufCreate .*\.(s|S|asm)$ %{
|
||||||
set-option buffer filetype gas
|
set-option buffer filetype gas
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=gas %{
|
||||||
|
require-module gas
|
||||||
|
|
||||||
|
hook window InsertChar \n -group gas-indent gas-indent-on-new-line
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window gas-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group gas-highlight global WinSetOption filetype=gas %{
|
||||||
|
add-highlighter window/gas ref gas
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/gas }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module gas %{
|
||||||
|
|
||||||
add-highlighter shared/gas regions
|
add-highlighter shared/gas regions
|
||||||
add-highlighter shared/gas/code default-region group
|
add-highlighter shared/gas/code default-region group
|
||||||
add-highlighter shared/gas/string region '"' (?<!\\)(\\\\)*" fill string
|
add-highlighter shared/gas/string region '"' (?<!\\)(\\\\)*" fill string
|
||||||
|
@ -80,12 +95,4 @@ define-command -hidden gas-indent-on-new-line %~
|
||||||
>
|
>
|
||||||
~
|
~
|
||||||
|
|
||||||
hook -group gas-highlight global WinSetOption filetype=gas %{
|
|
||||||
add-highlighter window/gas ref gas
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/gas }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=gas %{
|
|
||||||
hook window InsertChar \n -group gas-indent gas-indent-on-new-line
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window gas-.+ }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,31 +10,44 @@ hook global BufCreate .*(\.gitconfig|git/config) %{
|
||||||
set-option buffer filetype ini
|
set-option buffer filetype ini
|
||||||
}
|
}
|
||||||
|
|
||||||
hook -group git-commit-highlight global WinSetOption filetype=git-commit %{
|
|
||||||
add-highlighter window/git-commit-highlight regions
|
|
||||||
add-highlighter window/git-commit-highlight/diff region '^diff --git' '^(?=diff --git)' ref diff # highlight potential diffs from the -v option
|
|
||||||
add-highlighter window/git-commit-highlight/comments region '^\h*#' '$' group
|
|
||||||
add-highlighter window/git-commit-highlight/comments/ fill comment
|
|
||||||
add-highlighter window/git-commit-highlight/comments/ regex "\b(?:(modified)|(deleted)|(new file)|(renamed|copied)):([^\n]*)$" 1:yellow 2:red 3:green 4:blue 5:magenta
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-commit-highlight }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook -group git-commit-highlight global WinSetOption filetype=git-notes %{
|
|
||||||
add-highlighter window/git-notes-highlight regex '^\h*#[^\n]*$' 0:comment
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-notes-highlight }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
hook global BufCreate .*git-rebase-todo %{
|
hook global BufCreate .*git-rebase-todo %{
|
||||||
set-option buffer filetype git-rebase
|
set-option buffer filetype git-rebase
|
||||||
}
|
}
|
||||||
|
|
||||||
hook -group git-rebase-highlight global WinSetOption filetype=git-rebase %{
|
hook global WinSetOption filetype=git-(commit|notes|rebase) %{
|
||||||
add-highlighter window/git-rebase-highlight group
|
require-module "git-%val{hook_param_capture_1}"
|
||||||
add-highlighter window/git-rebase-highlight/ regex "#[^\n]*\n" 0:comment
|
}
|
||||||
add-highlighter window/git-rebase-highlight/ regex "^(pick|edit|reword|squash|fixup|exec|break|drop|label|reset|merge|[persfxbdltm]) (\w+)" 1:keyword 2:meta
|
|
||||||
|
hook -group git-commit-highlight global WinSetOption filetype=git-commit %{
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-rebase-highlight }
|
add-highlighter window/git-commit ref git-commit
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-commit }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group git-notes-highlight global WinSetOption filetype=git-notes %{
|
||||||
|
add-highlighter window/git-notes ref git-notes
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-notes }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group git-rebase-highlight global WinSetOption filetype=git-rebase %{
|
||||||
|
add-highlighter window/git-rebase ref git-rebase
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-rebase }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module git-commit %{
|
||||||
|
add-highlighter shared/git-commit regions
|
||||||
|
add-highlighter shared/git-commit/diff region '^diff --git' '^(?=diff --git)' ref diff # highlight potential diffs from the -v option
|
||||||
|
add-highlighter shared/git-commit/comments region '^\h*#' '$' group
|
||||||
|
add-highlighter shared/git-commit/comments/ fill comment
|
||||||
|
add-highlighter shared/git-commit/comments/ regex "\b(?:(modified)|(deleted)|(new file)|(renamed|copied)):([^\n]*)$" 1:yellow 2:red 3:green 4:blue 5:magenta
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module git-notes %{
|
||||||
|
add-highlighter shared/git-notes regex '^\h*#[^\n]*$' 0:comment
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module git-rebase %{
|
||||||
|
add-highlighter shared/git-rebase group
|
||||||
|
add-highlighter shared/git-rebase/ regex "#[^\n]*\n" 0:comment
|
||||||
|
add-highlighter shared/git-rebase/ regex "^(pick|edit|reword|squash|fixup|exec|break|drop|label|reset|merge|[persfxbdltm]) (\w+)" 1:keyword 2:meta
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,30 @@ hook global BufCreate .*\.go %{
|
||||||
set-option buffer filetype go
|
set-option buffer filetype go
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=go %{
|
||||||
|
require-module go
|
||||||
|
|
||||||
|
set-option window static_words %opt{go_static_words}
|
||||||
|
|
||||||
|
# cleanup trailing whitespaces when exiting insert mode
|
||||||
|
hook window ModeChange insert:.* -group go-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
||||||
|
hook window InsertChar \n -group go-indent go-indent-on-new-line
|
||||||
|
hook window InsertChar \{ -group go-indent go-indent-on-opening-curly-brace
|
||||||
|
hook window InsertChar \} -group go-indent go-indent-on-closing-curly-brace
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window go-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group go-highlight global WinSetOption filetype=go %{
|
||||||
|
add-highlighter window/go ref go
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/go }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module go %§
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -23,26 +47,26 @@ add-highlighter shared/go/code/ regex %{-?([0-9]*\.(?!0[xX]))?\b([0-9]+|0[xX][0-
|
||||||
|
|
||||||
evaluate-commands %sh{
|
evaluate-commands %sh{
|
||||||
# Grammar
|
# Grammar
|
||||||
keywords="break|default|func|interface|select|case|defer|go|map|struct"
|
keywords='break default func interface select case defer go map struct
|
||||||
keywords="${keywords}|chan|else|goto|package|switch|const|fallthrough|if|range|type"
|
chan else goto package switch const fallthrough if range type
|
||||||
keywords="${keywords}|continue|for|import|return|var"
|
continue for import return var'
|
||||||
types="bool|byte|chan|complex128|complex64|error|float32|float64|int|int16|int32"
|
types='bool byte chan complex128 complex64 error float32 float64 int int16 int32
|
||||||
types="${types}|int64|int8|interface|intptr|map|rune|string|struct|uint|uint16|uint32|uint64|uint8"
|
int64 int8 interface intptr map rune string struct uint uint16 uint32 uint64 uint8'
|
||||||
values="false|true|nil|iota"
|
values='false true nil iota'
|
||||||
functions="append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover"
|
functions='append cap close complex copy delete imag len make new panic print println real recover'
|
||||||
|
|
||||||
|
join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
|
||||||
|
|
||||||
# Add the language's grammar to the static completion list
|
# Add the language's grammar to the static completion list
|
||||||
printf %s\\n "hook global WinSetOption filetype=go %{
|
printf %s\\n "declare-option str-list go_static_words $(join "${keywords} ${attributes} ${types} ${values} ${functions}" ' ')"
|
||||||
set-option window static_words ${keywords} ${attributes} ${types} ${values} ${functions}
|
|
||||||
}" | tr '|' ' '
|
|
||||||
|
|
||||||
# Highlight keywords
|
# Highlight keywords
|
||||||
printf %s "
|
printf %s "
|
||||||
add-highlighter shared/go/code/ regex \b(${keywords})\b 0:keyword
|
add-highlighter shared/go/code/ regex \b($(join "${keywords}" '|'))\b 0:keyword
|
||||||
add-highlighter shared/go/code/ regex \b(${attributes})\b 0:attribute
|
add-highlighter shared/go/code/ regex \b($(join "${attributes}" '|'))\b 0:attribute
|
||||||
add-highlighter shared/go/code/ regex \b(${types})\b 0:type
|
add-highlighter shared/go/code/ regex \b($(join "${types}" '|'))\b 0:type
|
||||||
add-highlighter shared/go/code/ regex \b(${values})\b 0:value
|
add-highlighter shared/go/code/ regex \b($(join "${values}" '|'))\b 0:value
|
||||||
add-highlighter shared/go/code/ regex \b(${functions})\b 0:builtin
|
add-highlighter shared/go/code/ regex \b($(join "${functions}" '|'))\b 0:builtin
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,20 +102,4 @@ define-command -hidden go-indent-on-closing-curly-brace %[
|
||||||
try %[ execute-keys -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
try %[ execute-keys -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Initialization
|
§
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group go-highlight global WinSetOption filetype=go %{
|
|
||||||
add-highlighter window/go ref go
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/go }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=go %{
|
|
||||||
# cleanup trailing whitespaces when exiting insert mode
|
|
||||||
hook window ModeChange insert:.* -group go-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
|
||||||
hook window InsertChar \n -group go-indent go-indent-on-new-line
|
|
||||||
hook window InsertChar \{ -group go-indent go-indent-on-opening-curly-brace
|
|
||||||
hook window InsertChar \} -group go-indent go-indent-on-closing-curly-brace
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window go-.+ }
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,6 +8,29 @@ hook global BufCreate .*[.](haml) %{
|
||||||
set-option buffer filetype haml
|
set-option buffer filetype haml
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=haml %{
|
||||||
|
require-module haml
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group haml-trim-indent haml-trim-indent
|
||||||
|
hook window InsertChar \n -group haml-indent haml-indent-on-new-line
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window haml-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group haml-highlight global WinSetOption filetype=haml %{
|
||||||
|
add-highlighter window/haml ref haml
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/haml }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module haml %[
|
||||||
|
require-module ruby
|
||||||
|
require-module coffee
|
||||||
|
require-module sass
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -46,17 +69,4 @@ define-command -hidden haml-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
]
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group haml-highlight global WinSetOption filetype=haml %{
|
|
||||||
add-highlighter window/haml ref haml
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/haml }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=haml %{
|
|
||||||
hook window ModeChange insert:.* -group haml-trim-indent haml-trim-indent
|
|
||||||
hook window InsertChar \n -group haml-indent haml-indent-on-new-line
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window haml-.+ }
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,6 +8,27 @@ hook global BufCreate .*[.](hs) %{
|
||||||
set-option buffer filetype haskell
|
set-option buffer filetype haskell
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=haskell %{
|
||||||
|
require-module haskell
|
||||||
|
|
||||||
|
set-option window extra_word_chars '_' "'"
|
||||||
|
hook window ModeChange insert:.* -group haskell-trim-indent haskell-trim-indent
|
||||||
|
hook window InsertChar \n -group haskell-indent haskell-indent-on-new-line
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window haskell-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group haskell-highlight global WinSetOption filetype=haskell %{
|
||||||
|
add-highlighter window/haskell ref haskell
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/haskell }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module haskell %[
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -88,18 +109,4 @@ define-command -hidden haskell-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
]
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group haskell-highlight global WinSetOption filetype=haskell %{
|
|
||||||
add-highlighter window/haskell ref haskell
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/haskell }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=haskell %{
|
|
||||||
set-option window extra_word_chars '_' "'"
|
|
||||||
hook window ModeChange insert:.* -group haskell-trim-indent haskell-trim-indent
|
|
||||||
hook window InsertChar \n -group haskell-indent haskell-indent-on-new-line
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window haskell-.+ }
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,6 +8,27 @@ hook global BufCreate .*[.](hbs) %{
|
||||||
set-option buffer filetype hbs
|
set-option buffer filetype hbs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=hbs %{
|
||||||
|
require-module hbs
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group hbs-trim-indent hbs-trim-indent
|
||||||
|
hook window InsertChar \n -group hbs-indent hbs-indent-on-new-line
|
||||||
|
hook window InsertChar .* -group hbs-indent hbs-indent-on-char
|
||||||
|
hook window InsertChar '>' -group hbs-indent html-indent-on-greater-than
|
||||||
|
hook window InsertChar \n -group hbs-indent html-indent-on-new-line
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window hbs-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group hbs-highlight global WinSetOption filetype=hbs %{
|
||||||
|
maybe-add-hbs-to-html
|
||||||
|
add-highlighter window/hbs-file ref hbs-file
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/hbs-file }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module hbs %[
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -80,18 +101,4 @@ define-command -hidden maybe-add-hbs-to-html %{ evaluate-commands %sh{
|
||||||
fi
|
fi
|
||||||
} }
|
} }
|
||||||
|
|
||||||
hook -group hbs-highlight global WinSetOption filetype=hbs %{
|
]
|
||||||
maybe-add-hbs-to-html
|
|
||||||
add-highlighter window/hbs-file ref hbs-file
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/hbs-file }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=hbs %{
|
|
||||||
hook window ModeChange insert:.* -group hbs-trim-indent hbs-trim-indent
|
|
||||||
hook window InsertChar \n -group hbs-indent hbs-indent-on-new-line
|
|
||||||
hook window InsertChar .* -group hbs-indent hbs-indent-on-char
|
|
||||||
hook window InsertChar '>' -group hbs-indent html-indent-on-greater-than
|
|
||||||
hook window InsertChar \n -group hbs-indent html-indent-on-new-line
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window hbs-.+ }
|
|
||||||
}
|
|
||||||
|
|
|
@ -12,6 +12,36 @@ hook global BufCreate .*\.xml %{
|
||||||
set-option buffer filetype xml
|
set-option buffer filetype xml
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=(html|xml) %{
|
||||||
|
require-module html
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group "%val{hook_param_capture_1}-trim-indent" html-trim-indent
|
||||||
|
hook window InsertChar '>' -group "%val{hook_param_capture_1}-indent" html-indent-on-greater-than
|
||||||
|
hook window InsertChar \n -group "%val{hook_param_capture_1}-indent" html-indent-on-new-line
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption "filetype=.*" "
|
||||||
|
remove-hooks window ""%val{hook_param_capture_1}-.+""
|
||||||
|
"
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group html-highlight global WinSetOption filetype=(html|xml) %{
|
||||||
|
add-highlighter "window/%val{hook_param_capture_1}" ref html
|
||||||
|
hook -once -always window WinSetOption "filetype=.*" "
|
||||||
|
remove-highlighter ""window/%val{hook_param_capture_1}""
|
||||||
|
"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module html %[
|
||||||
|
|
||||||
|
try %{
|
||||||
|
require-module css
|
||||||
|
require-module javascript
|
||||||
|
}
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -54,22 +84,4 @@ define-command -hidden html-indent-on-new-line %{
|
||||||
try %{ execute-keys -draft k <a-x> <a-k> <lt>(?!area)(?!base)(?!br)(?!col)(?!command)(?!embed)(?!hr)(?!img)(?!input)(?!keygen)(?!link)(?!menuitem)(?!meta)(?!param)(?!source)(?!track)(?!wbr)(?!/)(?!>)[a-zA-Z0-9_-]+[^>]*?>$ <ret> j <a-gt> } }
|
try %{ execute-keys -draft k <a-x> <a-k> <lt>(?!area)(?!base)(?!br)(?!col)(?!command)(?!embed)(?!hr)(?!img)(?!input)(?!keygen)(?!link)(?!menuitem)(?!meta)(?!param)(?!source)(?!track)(?!wbr)(?!/)(?!>)[a-zA-Z0-9_-]+[^>]*?>$ <ret> j <a-gt> } }
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
]
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group html-highlight global WinSetOption filetype=(html|xml) %{
|
|
||||||
add-highlighter "window/%val{hook_param_capture_1}" ref html
|
|
||||||
hook -once -always window WinSetOption "filetype=.*" "
|
|
||||||
remove-highlighter ""window/%val{hook_param_capture_1}""
|
|
||||||
"
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=(html|xml) %{
|
|
||||||
hook window ModeChange insert:.* -group "%val{hook_param_capture_1}-trim-indent" html-trim-indent
|
|
||||||
hook window InsertChar '>' -group "%val{hook_param_capture_1}-indent" html-indent-on-greater-than
|
|
||||||
hook window InsertChar \n -group "%val{hook_param_capture_1}-indent" html-indent-on-new-line
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption "filetype=.*" "
|
|
||||||
remove-hooks window ""%val{hook_param_capture_1}-.+""
|
|
||||||
"
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,6 +2,28 @@ hook global BufCreate .*(sway|i3)/config %{
|
||||||
set buffer filetype i3
|
set buffer filetype i3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=i3 %[
|
||||||
|
require-module i3
|
||||||
|
|
||||||
|
# cleanup trailing whitespaces when exiting insert mode
|
||||||
|
hook window ModeChange insert:.* -group i3-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
||||||
|
hook window InsertChar \n -group i3-indent i3-indent-on-new-line
|
||||||
|
hook window InsertChar \} -group i3-indent i3-indent-on-closing-curly-brace
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window i3-.+ }
|
||||||
|
]
|
||||||
|
|
||||||
|
hook -group i3-highlight global WinSetOption filetype=i3 %{
|
||||||
|
add-highlighter window/i3 ref i3
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/i3 }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module i3 %[
|
||||||
|
|
||||||
add-highlighter shared/i3 regions
|
add-highlighter shared/i3 regions
|
||||||
add-highlighter shared/i3/code default-region group
|
add-highlighter shared/i3/code default-region group
|
||||||
add-highlighter shared/i3/double_string region %{"} %{"} group
|
add-highlighter shared/i3/double_string region %{"} %{"} group
|
||||||
|
@ -63,19 +85,4 @@ define-command -hidden i3-indent-on-closing-curly-brace %[
|
||||||
try %[ execute-keys -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
try %[ execute-keys -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group i3-highlight global WinSetOption filetype=i3 %{
|
|
||||||
add-highlighter window/i3 ref i3
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/i3 }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=i3 %[
|
|
||||||
# cleanup trailing whitespaces when exiting insert mode
|
|
||||||
hook window ModeChange insert:.* -group i3-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
|
||||||
hook window InsertChar \n -group i3-indent i3-indent-on-new-line
|
|
||||||
hook window InsertChar \} -group i3-indent i3-indent-on-closing-curly-brace
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window i3-.+ }
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -2,6 +2,18 @@ hook global BufCreate .+\.(repo|ini|cfg|properties) %{
|
||||||
set-option buffer filetype ini
|
set-option buffer filetype ini
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=ini %{
|
||||||
|
require-module ini
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group ini-highlight global WinSetOption filetype=ini %{
|
||||||
|
add-highlighter window/ini ref ini
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ini }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module ini %{
|
||||||
|
|
||||||
add-highlighter shared/ini regions
|
add-highlighter shared/ini regions
|
||||||
add-highlighter shared/ini/code default-region group
|
add-highlighter shared/ini/code default-region group
|
||||||
add-highlighter shared/ini/comment region '(^|\h)\K[#;]' $ fill comment
|
add-highlighter shared/ini/comment region '(^|\h)\K[#;]' $ fill comment
|
||||||
|
@ -9,7 +21,4 @@ add-highlighter shared/ini/comment region '(^|\h)\K[#;]' $ fill comment
|
||||||
add-highlighter shared/ini/code/ regex "^\h*\[[^\]]*\]" 0:title
|
add-highlighter shared/ini/code/ regex "^\h*\[[^\]]*\]" 0:title
|
||||||
add-highlighter shared/ini/code/ regex "^\h*([^\[][^=\n]*)=([^\n]*)" 1:variable 2:value
|
add-highlighter shared/ini/code/ regex "^\h*([^\[][^=\n]*)=([^\n]*)" 1:variable 2:value
|
||||||
|
|
||||||
hook -group ini-highlight global WinSetOption filetype=ini %{
|
|
||||||
add-highlighter window/ini ref ini
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ini }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,29 @@ hook global BufCreate .*\.java %{
|
||||||
set-option buffer filetype java
|
set-option buffer filetype java
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=java %{
|
||||||
|
require-module java
|
||||||
|
|
||||||
|
# cleanup trailing whitespaces when exiting insert mode
|
||||||
|
hook window ModeChange insert:.* -group java-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
||||||
|
hook window InsertChar \n -group java-indent java-indent-on-new-line
|
||||||
|
hook window InsertChar \{ -group java-indent java-indent-on-opening-curly-brace
|
||||||
|
hook window InsertChar \} -group java-indent java-indent-on-closing-curly-brace
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window java-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group java-highlight global WinSetOption filetype=java %{
|
||||||
|
add-highlighter window/java ref java
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/java }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module java %§
|
||||||
|
|
||||||
add-highlighter shared/java regions
|
add-highlighter shared/java regions
|
||||||
add-highlighter shared/java/code default-region group
|
add-highlighter shared/java/code default-region group
|
||||||
add-highlighter shared/java/string region %{(?<!')"} %{(?<!\\)(\\\\)*"} fill string
|
add-highlighter shared/java/string region %{(?<!')"} %{(?<!\\)(\\\\)*"} fill string
|
||||||
|
@ -46,20 +69,4 @@ define-command -hidden java-indent-on-closing-curly-brace %[
|
||||||
try %[ execute-keys -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
try %[ execute-keys -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Initialization
|
§
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group java-highlight global WinSetOption filetype=java %{
|
|
||||||
add-highlighter window/java ref java
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/java }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=java %{
|
|
||||||
# cleanup trailing whitespaces when exiting insert mode
|
|
||||||
hook window ModeChange insert:.* -group java-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
|
||||||
hook window InsertChar \n -group java-indent java-indent-on-new-line
|
|
||||||
hook window InsertChar \{ -group java-indent java-indent-on-opening-curly-brace
|
|
||||||
hook window InsertChar \} -group java-indent java-indent-on-closing-curly-brace
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window java-.+ }
|
|
||||||
}
|
|
||||||
|
|
|
@ -9,6 +9,34 @@ hook global BufCreate .*[.](ts)x? %{
|
||||||
set-option buffer filetype typescript
|
set-option buffer filetype typescript
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=(javascript|typescript) %{
|
||||||
|
require-module javascript
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group "%val{hook_param_capture_1}-trim-indent" javascript-trim-indent
|
||||||
|
hook window InsertChar .* -group "%val{hook_param_capture_1}-indent" javascript-indent-on-char
|
||||||
|
hook window InsertChar \n -group "%val{hook_param_capture_1}-indent" javascript-indent-on-new-line
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* "
|
||||||
|
remove-hooks window %val{hook_param_capture_1}-.+
|
||||||
|
"
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group javascript-highlight global WinSetOption filetype=javascript %{
|
||||||
|
add-highlighter window/javascript ref javascript
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/javascript }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group typescript-highlight global WinSetOption filetype=typescript %{
|
||||||
|
add-highlighter window/typescript ref typescript
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/typescript }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module javascript %§
|
||||||
|
|
||||||
# Commands
|
# Commands
|
||||||
# ‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -89,23 +117,6 @@ define-command -hidden init-javascript-filetype -params 1 %~
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get
|
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get
|
||||||
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set
|
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set
|
||||||
add-highlighter "shared/%arg{1}/code/" regex \b(async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|export|extends|finally|for|function|get|if|import|in|instanceof|let|new|of|return|set|static|super|switch|throw|try|typeof|var|void|while|with|yield)\b 0:keyword
|
add-highlighter "shared/%arg{1}/code/" regex \b(async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|export|extends|finally|for|function|get|if|import|in|instanceof|let|new|of|return|set|static|super|switch|throw|try|typeof|var|void|while|with|yield)\b 0:keyword
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group "%arg{1}-highlight" global WinSetOption "filetype=%arg{1}" "
|
|
||||||
add-highlighter window/%arg{1} ref %arg{1}
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %%{ remove-highlighter window/%arg{1} }
|
|
||||||
"
|
|
||||||
|
|
||||||
hook global WinSetOption "filetype=%arg{1}" "
|
|
||||||
hook window ModeChange insert:.* -group %arg{1}-trim-indent javascript-trim-indent
|
|
||||||
hook window InsertChar .* -group %arg{1}-indent javascript-indent-on-char
|
|
||||||
hook window InsertChar \n -group %arg{1}-indent javascript-indent-on-new-line
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %%{ remove-hooks window %arg{1}-.+ }
|
|
||||||
"
|
|
||||||
~
|
~
|
||||||
|
|
||||||
init-javascript-filetype javascript
|
init-javascript-filetype javascript
|
||||||
|
@ -117,3 +128,5 @@ add-highlighter shared/typescript/code/ regex \b(array|boolean|date|number|objec
|
||||||
|
|
||||||
# Keywords grabbed from https://github.com/Microsoft/TypeScript/issues/2536
|
# Keywords grabbed from https://github.com/Microsoft/TypeScript/issues/2536
|
||||||
add-highlighter shared/typescript/code/ regex \b(as|constructor|declare|enum|from|implements|interface|module|namespace|package|private|protected|public|readonly|static|type)\b 0:keyword
|
add-highlighter shared/typescript/code/ regex \b(as|constructor|declare|enum|from|implements|interface|module|namespace|package|private|protected|public|readonly|static|type)\b 0:keyword
|
||||||
|
|
||||||
|
§
|
||||||
|
|
|
@ -8,6 +8,27 @@ hook global BufCreate .*[.](json) %{
|
||||||
set-option buffer filetype json
|
set-option buffer filetype json
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=json %{
|
||||||
|
require-module json
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group json-trim-indent json-trim-indent
|
||||||
|
hook window InsertChar .* -group json-indent json-indent-on-char
|
||||||
|
hook window InsertChar \n -group json-indent json-indent-on-new-line
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window json-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group json-highlight global WinSetOption filetype=json %{
|
||||||
|
add-highlighter window/json ref json
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/json }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module json %(
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -43,18 +64,4 @@ define-command -hidden json-indent-on-new-line %<
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
|
|
||||||
# Initialization
|
)
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group json-highlight global WinSetOption filetype=json %{
|
|
||||||
add-highlighter window/json ref json
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/json }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=json %{
|
|
||||||
hook window ModeChange insert:.* -group json-trim-indent json-trim-indent
|
|
||||||
hook window InsertChar .* -group json-indent json-indent-on-char
|
|
||||||
hook window InsertChar \n -group json-indent json-indent-on-new-line
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window json-.+ }
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,6 +8,21 @@ hook global BufCreate .*\.(jl) %{
|
||||||
set-option buffer filetype julia
|
set-option buffer filetype julia
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=julia %{
|
||||||
|
require-module julia
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group julia-highlight global WinSetOption filetype=julia %{
|
||||||
|
add-highlighter window/julia ref julia
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/julia }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module julia %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -21,10 +36,4 @@ add-highlighter shared/julia/code/ regex %{\b(true|false|C_NULL|Inf|NaN|Inf32|Na
|
||||||
add-highlighter shared/julia/code/ regex \b(if|else|elseif|while|for|begin|end|quote|try|catch|return|local|abstract|function|macro|ccall|finally|typealias|break|continue|type|global|module|using|import|export|const|let|bitstype|do|in|baremodule|importall|immutable)\b 0:keyword
|
add-highlighter shared/julia/code/ regex \b(if|else|elseif|while|for|begin|end|quote|try|catch|return|local|abstract|function|macro|ccall|finally|typealias|break|continue|type|global|module|using|import|export|const|let|bitstype|do|in|baremodule|importall|immutable)\b 0:keyword
|
||||||
add-highlighter shared/julia/code/ regex \b(Number|Real|BigInt|Integer|UInt|UInt8|UInt16|UInt32|UInt64|UInt128|Int|Int8|Int16|Int32|Int64|Int128|BigFloat|FloatingPoint|Float16|Float32|Float64|Complex128|Complex64|Bool|Cuchar|Cshort|Cushort|Cint|Cuint|Clonglong|Culonglong|Cintmax_t|Cuintmax_t|Cfloat|Cdouble|Cptrdiff_t|Cssize_t|Csize_t|Cchar|Clong|Culong|Cwchar_t|Char|ASCIIString|UTF8String|ByteString|SubString|AbstractString|Array|DArray|AbstractArray|AbstractVector|AbstractMatrix|AbstractSparseMatrix|SubArray|StridedArray|StridedVector|StridedMatrix|VecOrMat|StridedVecOrMat|DenseArray|SparseMatrixCSC|BitArray|Range|OrdinalRange|StepRange|UnitRange|FloatRange|Tuple|NTuple|Vararg|DataType|Symbol|Function|Vector|Matrix|Union|Type|Any|Complex|String|Ptr|Void|Exception|Task|Signed|Unsigned|Associative|Dict|IO|IOStream|Rational|Regex|RegexMatch|Set|IntSet|Expr|WeakRef|ObjectIdDict|AbstractRNG|MersenneTwister)\b 0:type
|
add-highlighter shared/julia/code/ regex \b(Number|Real|BigInt|Integer|UInt|UInt8|UInt16|UInt32|UInt64|UInt128|Int|Int8|Int16|Int32|Int64|Int128|BigFloat|FloatingPoint|Float16|Float32|Float64|Complex128|Complex64|Bool|Cuchar|Cshort|Cushort|Cint|Cuint|Clonglong|Culonglong|Cintmax_t|Cuintmax_t|Cfloat|Cdouble|Cptrdiff_t|Cssize_t|Csize_t|Cchar|Clong|Culong|Cwchar_t|Char|ASCIIString|UTF8String|ByteString|SubString|AbstractString|Array|DArray|AbstractArray|AbstractVector|AbstractMatrix|AbstractSparseMatrix|SubArray|StridedArray|StridedVector|StridedMatrix|VecOrMat|StridedVecOrMat|DenseArray|SparseMatrixCSC|BitArray|Range|OrdinalRange|StepRange|UnitRange|FloatRange|Tuple|NTuple|Vararg|DataType|Symbol|Function|Vector|Matrix|Union|Type|Any|Complex|String|Ptr|Void|Exception|Task|Signed|Unsigned|Associative|Dict|IO|IOStream|Rational|Regex|RegexMatch|Set|IntSet|Expr|WeakRef|ObjectIdDict|AbstractRNG|MersenneTwister)\b 0:type
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group julia-highlight global WinSetOption filetype=julia %{
|
|
||||||
add-highlighter window/julia ref julia
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/julia }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,21 @@ hook global BufCreate .*/?[jJ]ustfile %{
|
||||||
set-option buffer filetype justfile
|
set-option buffer filetype justfile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=justfile %{
|
||||||
|
require-module justfile
|
||||||
|
|
||||||
|
hook window InsertChar \n -group justfile-indent just-indent-on-new-line
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window justfile-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group justfile-highlight global WinSetOption filetype=justfile %{
|
||||||
|
add-highlighter window/justfile ref justfile
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/justfile }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module justfile %{
|
||||||
|
|
||||||
# Indentation
|
# Indentation
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -37,12 +52,4 @@ add-highlighter shared/justfile/content/ regex '^(@)?([\w-]+)(?:\s(.+))?\s?(:)(.
|
||||||
add-highlighter shared/justfile/content/ regex '([=+])' 1:operator
|
add-highlighter shared/justfile/content/ regex '([=+])' 1:operator
|
||||||
add-highlighter shared/justfile/content/ regex '^([\w-]+)\s=' 1:value
|
add-highlighter shared/justfile/content/ regex '^([\w-]+)\s=' 1:value
|
||||||
|
|
||||||
hook -group justfile-highlight global WinSetOption filetype=justfile %{
|
|
||||||
add-highlighter window/justfile ref justfile
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/justfile }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=justfile %{
|
|
||||||
hook window InsertChar \n -group justfile-indent just-indent-on-new-line
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window justfile-.+ }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,33 @@ hook global BufCreate (.*/)?(kakrc|.*\.kak) %{
|
||||||
set-option buffer filetype kak
|
set-option buffer filetype kak
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=kak %~
|
||||||
|
require-module kak
|
||||||
|
|
||||||
|
set-option window static_words %opt{kak_static_words}
|
||||||
|
|
||||||
|
hook window InsertChar \n -group kak-indent kak-indent-on-new-line
|
||||||
|
hook window InsertChar [>)}\]] -group kak-indent kak-indent-on-closing-matching
|
||||||
|
hook window InsertChar (?![[{(<>)}\]])[^\s\w] -group kak-indent kak-indent-on-closing-char
|
||||||
|
# cleanup trailing whitespaces on current line insert end
|
||||||
|
hook window ModeChange insert:.* -group kak-trim-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
|
||||||
|
set-option buffer extra_word_chars '_' '-'
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window kak-.+ }
|
||||||
|
~
|
||||||
|
|
||||||
|
hook -group kak-highlight global WinSetOption filetype=kak %{
|
||||||
|
add-highlighter window/kakrc ref kakrc
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/kakrc }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module kak %§
|
||||||
|
|
||||||
|
require-module sh
|
||||||
|
|
||||||
# Highlighters & Completion
|
# Highlighters & Completion
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -33,7 +60,7 @@ evaluate-commands %sh{
|
||||||
set-option unset-option update-option declare-option execute-keys evaluate-commands
|
set-option unset-option update-option declare-option execute-keys evaluate-commands
|
||||||
prompt menu on-key info set-face unset-face rename-client set-register select
|
prompt menu on-key info set-face unset-face rename-client set-register select
|
||||||
change-directory rename-session colorscheme declare-user-mode enter-user-mode
|
change-directory rename-session colorscheme declare-user-mode enter-user-mode
|
||||||
edit! write! kill! quit! write-quit! delete-buffer!"
|
edit! write! kill! quit! write-quit! delete-buffer! provide-module require-module"
|
||||||
attributes="global buffer window current
|
attributes="global buffer window current
|
||||||
normal insert menu prompt goto view user object
|
normal insert menu prompt goto view user object
|
||||||
number-lines show-matching show-whitespaces fill regex dynregex group flag-lines
|
number-lines show-matching show-whitespaces fill regex dynregex group flag-lines
|
||||||
|
@ -44,10 +71,7 @@ evaluate-commands %sh{
|
||||||
join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
|
join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
|
||||||
|
|
||||||
# Add the language's grammar to the static completion list
|
# Add the language's grammar to the static completion list
|
||||||
printf '%s\n' "hook global WinSetOption filetype=kak %{
|
printf %s\\n "declare-option str-list kak_static_words $(join "${keywords} ${attributes} ${types} ${values}" ' ')'"
|
||||||
set-option window static_words $(join "${keywords} ${attributes} ${types} ${values}" ' ')'
|
|
||||||
set-option -- window extra_word_chars '_' '-'
|
|
||||||
}"
|
|
||||||
|
|
||||||
# Highlight keywords (which are always surrounded by whitespace)
|
# Highlight keywords (which are always surrounded by whitespace)
|
||||||
printf '%s\n' "add-highlighter shared/kakrc/code/keywords regex (?:\s|\A)\K($(join "${keywords}" '|'))(?:(?=\s)|\z) 0:keyword
|
printf '%s\n' "add-highlighter shared/kakrc/code/keywords regex (?:\s|\A)\K($(join "${keywords}" '|'))(?:(?=\s)|\z) 0:keyword
|
||||||
|
@ -90,21 +114,4 @@ define-command -hidden kak-indent-on-closing-char %{
|
||||||
try %{ execute-keys -draft -itersel <a-h><a-k>^\h*\Q %val{hook_param} \E$<ret>gi<a-f> %val{hook_param} <a-T>%<a-k>\w*\Q %val{hook_param} \E$<ret> s \A|.\z<ret> gi 1<a-&> }
|
try %{ execute-keys -draft -itersel <a-h><a-k>^\h*\Q %val{hook_param} \E$<ret>gi<a-f> %val{hook_param} <a-T>%<a-k>\w*\Q %val{hook_param} \E$<ret> s \A|.\z<ret> gi 1<a-&> }
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
§
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group kak-highlight global WinSetOption filetype=kak %{
|
|
||||||
add-highlighter window/kakrc ref kakrc
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/kakrc }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=kak %~
|
|
||||||
hook window InsertChar \n -group kak-indent kak-indent-on-new-line
|
|
||||||
hook window InsertChar [>)}\]] -group kak-indent kak-indent-on-closing-matching
|
|
||||||
hook window InsertChar (?![[{(<>)}\]])[^\s\w] -group kak-indent kak-indent-on-closing-char
|
|
||||||
# cleanup trailing whitespaces on current line insert end
|
|
||||||
hook window ModeChange insert:.* -group kak-trim-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
|
|
||||||
set-option buffer extra_word_chars '_' '-'
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window kak-.+ }
|
|
||||||
~
|
|
||||||
|
|
|
@ -2,6 +2,18 @@ hook global BufCreate .*\.ks %{
|
||||||
set-option buffer filetype kickstart
|
set-option buffer filetype kickstart
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=kickstart %{
|
||||||
|
require-module kickstart
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group kickstart-highlight global WinSetOption filetype=kickstart %{
|
||||||
|
add-highlighter window/kickstart ref kickstart
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/kickstart }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module kickstart %{
|
||||||
|
|
||||||
add-highlighter shared/kickstart regions
|
add-highlighter shared/kickstart regions
|
||||||
add-highlighter shared/kickstart/code default-region group
|
add-highlighter shared/kickstart/code default-region group
|
||||||
add-highlighter shared/kickstart/comment region '(^|\h)\K#' $ fill comment
|
add-highlighter shared/kickstart/comment region '(^|\h)\K#' $ fill comment
|
||||||
|
@ -23,8 +35,4 @@ add-highlighter shared/kickstart/shell/ regex '\A\h*\K%(pre-install|pre|post)\b'
|
||||||
add-highlighter shared/kickstart/shell/ regex '^\h*%end\b' 0:type
|
add-highlighter shared/kickstart/shell/ regex '^\h*%end\b' 0:type
|
||||||
add-highlighter shared/kickstart/shell/ ref sh
|
add-highlighter shared/kickstart/shell/ ref sh
|
||||||
|
|
||||||
|
|
||||||
hook -group kickstart-highlight global WinSetOption filetype=kickstart %{
|
|
||||||
add-highlighter window/kickstart ref kickstart
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/kickstart }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,20 @@ hook global BufCreate .*\.tex %{
|
||||||
set-option buffer filetype latex
|
set-option buffer filetype latex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=latex %{
|
||||||
|
require-module latex
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group latex-highlight global WinSetOption filetype=latex %{
|
||||||
|
add-highlighter window/latex ref latex
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/latex }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module latex %(
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -26,10 +40,4 @@ add-highlighter shared/latex/content/ regex '\\(emph|textit)\{([^}]+)\}' 2:defau
|
||||||
# Bold text
|
# Bold text
|
||||||
add-highlighter shared/latex/content/ regex '\\textbf\{([^}]+)\}' 1:default+b
|
add-highlighter shared/latex/content/ regex '\\textbf\{([^}]+)\}' 1:default+b
|
||||||
|
|
||||||
# Initialization
|
)
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group latex-highlight global WinSetOption filetype=latex %{
|
|
||||||
add-highlighter window/latex ref latex
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/latex }
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,6 +8,25 @@ hook global BufCreate .*[.](lisp) %{
|
||||||
set-option buffer filetype lisp
|
set-option buffer filetype lisp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=lisp %{
|
||||||
|
require-module lisp
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group lisp-trim-indent lisp-trim-indent
|
||||||
|
hook window InsertChar \n -group lisp-indent lisp-indent-on-new-line
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window lisp-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group lisp-highlight global WinSetOption filetype=lisp %{
|
||||||
|
add-highlighter window/lisp ref lisp
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/lisp }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module lisp %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -58,17 +77,4 @@ define-command -hidden lisp-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group lisp-highlight global WinSetOption filetype=lisp %{
|
|
||||||
add-highlighter window/lisp ref lisp
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/lisp }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=lisp %{
|
|
||||||
hook window ModeChange insert:.* -group lisp-trim-indent lisp-trim-indent
|
|
||||||
hook window InsertChar \n -group lisp-indent lisp-indent-on-new-line
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window lisp-.+ }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,32 @@ hook global BufCreate .*[.](lua) %{
|
||||||
set-option buffer filetype lua
|
set-option buffer filetype lua
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=lua %{
|
||||||
|
require-module lua
|
||||||
|
|
||||||
|
hook window InsertChar .* -group lua-indent lua-indent-on-char
|
||||||
|
hook window InsertChar \n -group lua-indent lua-indent-on-new-line
|
||||||
|
hook window InsertChar \n -group lua-insert lua-insert-on-new-line
|
||||||
|
|
||||||
|
alias window alt lua-alternative-file
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{
|
||||||
|
remove-hooks window lua-.+
|
||||||
|
unalias window alt lua-alternative-file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group lua-highlight global WinSetOption filetype=lua %{
|
||||||
|
add-highlighter window/lua ref lua
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/lua }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module lua %[
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -81,23 +107,4 @@ define-command -hidden lua-insert-on-new-line %[
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Initialization
|
]
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group lua-highlight global WinSetOption filetype=lua %{
|
|
||||||
add-highlighter window/lua ref lua
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/lua }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=lua %{
|
|
||||||
hook window InsertChar .* -group lua-indent lua-indent-on-char
|
|
||||||
hook window InsertChar \n -group lua-indent lua-indent-on-new-line
|
|
||||||
hook window InsertChar \n -group lua-insert lua-insert-on-new-line
|
|
||||||
|
|
||||||
alias window alt lua-alternative-file
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{
|
|
||||||
remove-hooks window lua-.+
|
|
||||||
unalias window alt lua-alternative-file
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,12 +2,21 @@ hook global BufCreate .+\.eml %{
|
||||||
set-option buffer filetype mail
|
set-option buffer filetype mail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=mail %{
|
||||||
|
require-module mail
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group mail-highlight global WinSetOption filetype=mail %{
|
||||||
|
add-highlighter window/mail ref mail
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/mail }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module mail %{
|
||||||
|
|
||||||
add-highlighter shared/mail group
|
add-highlighter shared/mail group
|
||||||
add-highlighter shared/mail/ regex ^(From|To|Cc|Bcc|Subject|Reply-To|In-Reply-To|Date):([^\n]*(?:\n\h+[^\n]+)*)$ 1:keyword 2:attribute
|
add-highlighter shared/mail/ regex ^(From|To|Cc|Bcc|Subject|Reply-To|In-Reply-To|Date):([^\n]*(?:\n\h+[^\n]+)*)$ 1:keyword 2:attribute
|
||||||
add-highlighter shared/mail/ regex <[^@>]+@.*?> 0:string
|
add-highlighter shared/mail/ regex <[^@>]+@.*?> 0:string
|
||||||
add-highlighter shared/mail/ regex ^>.*?$ 0:comment
|
add-highlighter shared/mail/ regex ^>.*?$ 0:comment
|
||||||
|
|
||||||
hook -group mail-highlight global WinSetOption filetype=mail %{
|
|
||||||
add-highlighter window/mail ref mail
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/mail }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,25 @@ hook global BufCreate .*(/?[mM]akefile|\.mk) %{
|
||||||
set-option buffer filetype makefile
|
set-option buffer filetype makefile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=makefile %{
|
||||||
|
require-module makefile
|
||||||
|
|
||||||
|
set-option window static_words %opt{makefile_static_words}
|
||||||
|
|
||||||
|
hook window InsertChar \n -group makefile-indent makefile-indent-on-new-line
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window makefile-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group makefile-highlight global WinSetOption filetype=makefile %{
|
||||||
|
add-highlighter window/makefile ref makefile
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/makefile }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module makefile %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -22,9 +41,7 @@ evaluate-commands %sh{
|
||||||
keywords="ifeq|ifneq|ifdef|ifndef|else|endif|define|endef"
|
keywords="ifeq|ifneq|ifdef|ifndef|else|endif|define|endef"
|
||||||
|
|
||||||
# Add the language's grammar to the static completion list
|
# Add the language's grammar to the static completion list
|
||||||
printf %s\\n "hook global WinSetOption filetype=makefile %{
|
printf %s\\n "declare-option str-list makefile_static_words ${keywords}" | tr '|' ' '
|
||||||
set-option window static_words ${keywords}
|
|
||||||
}" | tr '|' ' '
|
|
||||||
|
|
||||||
# Highlight keywords
|
# Highlight keywords
|
||||||
printf %s "add-highlighter shared/makefile/content/ regex \b(${keywords})\b 0:keyword"
|
printf %s "add-highlighter shared/makefile/content/ regex \b(${keywords})\b 0:keyword"
|
||||||
|
@ -46,15 +63,4 @@ define-command -hidden makefile-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group makefile-highlight global WinSetOption filetype=makefile %{
|
|
||||||
add-highlighter window/makefile ref makefile
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/makefile }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=makefile %{
|
|
||||||
hook window InsertChar \n -group makefile-indent makefile-indent-on-new-line
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window makefile-.+ }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,24 @@ hook global BufCreate .*[.](markdown|md|mkd) %{
|
||||||
set-option buffer filetype markdown
|
set-option buffer filetype markdown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=markdown %{
|
||||||
|
require-module markdown
|
||||||
|
|
||||||
|
hook window InsertChar \n -group markdown-indent markdown-indent-on-new-line
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window markdown-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group markdown-highlight global WinSetOption filetype=markdown %{
|
||||||
|
add-highlighter window/markdown ref markdown
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/markdown }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module markdown %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -71,15 +89,4 @@ define-command -hidden markdown-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group markdown-highlight global WinSetOption filetype=markdown %{
|
|
||||||
add-highlighter window/markdown ref markdown
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/markdown }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=markdown %{
|
|
||||||
hook window InsertChar \n -group markdown-indent markdown-indent-on-new-line
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window markdown-.+ }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,26 @@ hook global BufCreate .*hg-editor-\w+\.txt$ %{
|
||||||
set-option buffer filetype hg-commit
|
set-option buffer filetype hg-commit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=hg-commit %{
|
||||||
|
require-module hg-commit
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group hg-commit-highlight global WinSetOption filetype=hg-commit %{
|
||||||
|
add-highlighter window/hg-commit ref hg-commit
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/hg-commit-highlight }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module hg-commit %{
|
||||||
|
|
||||||
|
# Faces
|
||||||
|
# ‾‾‾‾‾
|
||||||
|
|
||||||
|
set-face global MercurialCommitComment cyan
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
hook -group hg-commit-highlight global WinSetOption filetype=hg-commit %{
|
add-highlighter shared/hg-commit group
|
||||||
add-highlighter window/ group hg-commit-highlight
|
add-highlighter shared/hg-commit/ regex '^HG:[^\n]*' 0:comment
|
||||||
add-highlighter window/hg-commit-highlight regex '^HG:[^\n]*' 0:comment
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/hg-commit-highlight }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,32 @@ hook global BufCreate .*[.](moon) %{
|
||||||
set-option buffer filetype moon
|
set-option buffer filetype moon
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=moon %{
|
||||||
|
require-module moon
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group moon-trim-indent moon-trim-indent
|
||||||
|
hook window InsertChar .* -group moon-indent moon-indent-on-char
|
||||||
|
hook window InsertChar \n -group moon-indent moon-indent-on-new-line
|
||||||
|
|
||||||
|
alias window alt moon-alternative-file
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{
|
||||||
|
remove-hooks window moon-.+
|
||||||
|
unalias window alt moon-alternative-file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group moon-highlight global WinSetOption filetype=moon %{
|
||||||
|
add-highlighter window/moon ref moon
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/moon }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module moon %[
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -85,23 +111,4 @@ define-command -hidden moon-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
]
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group moon-highlight global WinSetOption filetype=moon %{
|
|
||||||
add-highlighter window/moon ref moon
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/moon }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=moon %{
|
|
||||||
hook window ModeChange insert:.* -group moon-trim-indent moon-trim-indent
|
|
||||||
hook window InsertChar .* -group moon-indent moon-indent-on-char
|
|
||||||
hook window InsertChar \n -group moon-indent moon-indent-on-new-line
|
|
||||||
|
|
||||||
alias window alt moon-alternative-file
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{
|
|
||||||
remove-hooks window moon-.+
|
|
||||||
unalias window alt moon-alternative-file
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,6 +8,28 @@ hook global BufCreate .*\.nim(s|ble)? %{
|
||||||
set-option buffer filetype nim
|
set-option buffer filetype nim
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=nim %{
|
||||||
|
require-module nim
|
||||||
|
|
||||||
|
set-option window static_words %opt{nim_static_words}
|
||||||
|
|
||||||
|
hook window InsertChar \n -group nim-indent nim-indent-on-new-line
|
||||||
|
# cleanup trailing whitespaces on current line insert end
|
||||||
|
hook window ModeChange insert:.* -group nim-trim-indent %{ try %{ exec -draft \; <a-x> s ^\h+$ <ret> d } }
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window nim-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group nim-highlight global WinSetOption filetype=nim %{
|
||||||
|
add-highlighter window/nim ref nim
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/nim }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module nim %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -51,9 +73,7 @@ evaluate-commands %sh{
|
||||||
static_words="$(join "${keywords} ${types} ${operator} ${values}" ' ')"
|
static_words="$(join "${keywords} ${types} ${operator} ${values}" ' ')"
|
||||||
|
|
||||||
# Add the language's grammar to the static completion list
|
# Add the language's grammar to the static completion list
|
||||||
printf %s "hook global WinSetOption filetype=nim %{
|
printf %s\\n "declare-option str-list nim_static_words ${static_words}"
|
||||||
set-option window static_words ${static_words}
|
|
||||||
}"
|
|
||||||
|
|
||||||
keywords="$(join "${keywords}" '|')"
|
keywords="$(join "${keywords}" '|')"
|
||||||
operators="$(join "${operators}" '|')"
|
operators="$(join "${operators}" '|')"
|
||||||
|
@ -95,18 +115,4 @@ def -hidden nim-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group nim-highlight global WinSetOption filetype=nim %{
|
|
||||||
add-highlighter window/nim ref nim
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/nim }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=nim %{
|
|
||||||
hook window InsertChar \n -group nim-indent nim-indent-on-new-line
|
|
||||||
# cleanup trailing whitespaces on current line insert end
|
|
||||||
hook window ModeChange insert:.* -group nim-trim-indent %{ try %{ exec -draft \; <a-x> s ^\h+$ <ret> d } }
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window nim-.+ }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,24 @@
|
||||||
# ‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
hook global BufCreate .*\.mli? %{
|
hook global BufCreate .*\.mli? %{
|
||||||
set-option buffer filetype ocaml
|
set-option buffer filetype ocaml
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=ocaml %{
|
||||||
|
require-module ocaml
|
||||||
|
set-option window static_words %opt{ocaml_static_words}
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group ocaml-highlight global WinSetOption filetype=ocaml %{
|
||||||
|
add-highlighter window/ocaml ref ocaml
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ocaml }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module ocaml %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -16,23 +31,20 @@ add-highlighter shared/ocaml/code default-region group
|
||||||
add-highlighter shared/ocaml/string region '"' (?<!\\)(\\\\)*" fill string
|
add-highlighter shared/ocaml/string region '"' (?<!\\)(\\\\)*" fill string
|
||||||
add-highlighter shared/ocaml/comment region \Q(* \Q*) fill comment
|
add-highlighter shared/ocaml/comment region \Q(* \Q*) fill comment
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group ocaml-highlight global WinSetOption filetype=ocaml %{
|
|
||||||
add-highlighter window/ocaml ref ocaml
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ocaml }
|
|
||||||
}
|
|
||||||
|
|
||||||
# Macro
|
# Macro
|
||||||
# ‾‾‾‾‾
|
# ‾‾‾‾‾
|
||||||
|
|
||||||
evaluate-commands %sh{
|
evaluate-commands %sh{
|
||||||
keywords=and:as:asr:assert:begin:class:constraint:do:done:downto:else:end:exception:external:false:for:fun:function:functor:if:in:include:inherit:initializer:land:lazy:let:lor:lsl:lsr:lxor:match:method:mod:module:mutable:new:nonrec:object:of:open:or:private:rec:sig:struct:then:to:true:try:type:val:virtual:when:while:with
|
keywords="and|as|asr|assert|begin|class|constraint|do|done|downto|else|end|exception|external|false"
|
||||||
echo "
|
keywords="${keywords}|for|fun|function|functor|if|in|include|inherit|initializer|land|lazy|let|lor"
|
||||||
add-highlighter shared/ocaml/code/ regex \b($(printf $keywords | tr : '|'))\b 0:keyword
|
keywords="${keywords}|lsl|lsr|lxor|match|method|mod|module|mutable|new|nonrec|object|of|open|or"
|
||||||
hook global WinSetOption filetype=ocaml %{
|
keywords="${keywords}|private|rec|sig|struct|then|to|true|try|type|val|virtual|when|while|with"
|
||||||
set-option window static_words $keywords
|
|
||||||
}
|
printf %s\\n "declare-option str-list ocaml_static_words ${keywords}" | tr '|' ' '
|
||||||
|
|
||||||
|
printf %s "
|
||||||
|
add-highlighter shared/ocaml/code/ regex \b(${keywords})\b 0:keyword
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -8,6 +8,30 @@ hook global BufCreate .*\.(t|p[lm])$ %{
|
||||||
set-option buffer filetype perl
|
set-option buffer filetype perl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=perl %{
|
||||||
|
require-module perl
|
||||||
|
|
||||||
|
set-option window static_words %opt{perl_static_words}
|
||||||
|
|
||||||
|
# cleanup trailing whitespaces when exiting insert mode
|
||||||
|
hook window ModeChange insert:.* -group perl-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
||||||
|
hook window InsertChar \n -group perl-indent perl-indent-on-new-line
|
||||||
|
hook window InsertChar \{ -group perl-indent perl-indent-on-opening-curly-brace
|
||||||
|
hook window InsertChar \} -group perl-indent perl-indent-on-closing-curly-brace
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window perl-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group perl-highlight global WinSetOption filetype=perl %{
|
||||||
|
add-highlighter window/perl ref perl
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/perl }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module perl %§
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -20,31 +44,31 @@ add-highlighter shared/perl/comment region (?<!\$)(?<!\\)# $
|
||||||
|
|
||||||
evaluate-commands %sh{
|
evaluate-commands %sh{
|
||||||
# Grammar
|
# Grammar
|
||||||
keywords="else|lock|qw|elsif|lt|qx|eq|exp|ne|sub|for|no|my|not|tr|goto|and|foreach|or|break|exit|unless|cmp|ge|package|until|continue|gt|while|if|qq|xor|do|le|qr|return"
|
keywords="else lock qw elsif lt qx eq exp ne sub for no my not tr goto and foreach or break exit unless cmp ge package until continue gt while if qq xor do le qr return"
|
||||||
attributes="END|AUTOLOAD|BEGIN|CHECK|UNITCHECK|INIT|DESTROY"
|
attributes="END AUTOLOAD BEGIN CHECK UNITCHECK INIT DESTROY
|
||||||
attributes="${attributes}|length|setpgrp|endgrent|link|setpriority|endhostent|listen|setprotoent|endnetent|local|setpwent"
|
length setpgrp endgrent link setpriority endhostent listen setprotoent endnetent local setpwent
|
||||||
attributes="${attributes}|endprotoent|localtime|setservent|endpwent|log|setsockopt|endservent|lstat|shift|eof|map|shmctl|eval|mkdir|shmget|exec|msgctl|shmread"
|
endprotoent localtime setservent endpwent log setsockopt endservent lstat shift eof map shmctl eval mkdir shmget exec msgctl shmread
|
||||||
attributes="${attributes}|exists|msgget|shmwrite|msgrcv|shutdown|fcntl|msgsnd|sin|fileno|sleep|flock|next|socket|fork|socketpair|format|oct|sort"
|
exists msgget shmwrite msgrcv shutdown fcntl msgsnd sin fileno sleep flock next socket fork socketpair format oct sort
|
||||||
attributes="${attributes}|formline|open|splice|getc|opendir|split|getgrent|ord|sprintf|getgrgid|our|sqrt|getgrnam|pack|srand|gethostbyaddr|pipe|stat|gethostbyname"
|
formline open splice getc opendir split getgrent ord sprintf getgrgid our sqrt getgrnam pack srand gethostbyaddr pipe stat gethostbyname
|
||||||
attributes="${attributes}|pop|state|gethostent|pos|study|getlogin|print|substr|getnetbyaddr|printf|symlink|abs|getnetbyname|prototype|syscall|accept|getnetent"
|
pop state gethostent pos study getlogin print substr getnetbyaddr printf symlink abs getnetbyname prototype syscall accept getnetent
|
||||||
attributes="${attributes}|push|sysopen|alarm|getpeername|quotemeta|sysread|atan2|getpgrp|rand|sysseek|getppid|read|system|getpriority|readdir|syswrite|bind"
|
push sysopen alarm getpeername quotemeta sysread atan2 getpgrp rand sysseek getppid read system getpriority readdir syswrite bind
|
||||||
attributes="${attributes}|getprotobyname|readline|tell|binmode|getprotobynumber|readlink|telldir|bless|getprotoent|readpipe|tie|getpwent|recv|tied|caller"
|
getprotobyname readline tell binmode getprotobynumber readlink telldir bless getprotoent readpipe tie getpwent recv tied caller
|
||||||
attributes="${attributes}|getpwnam|redo|time|chdir|getpwuid|ref|times|getservbyname|rename|truncate|chmod|getservbyport|require|uc|chomp|getservent|reset|ucfirst"
|
getpwnam redo time chdir getpwuid ref times getservbyname rename truncate chmod getservbyport require uc chomp getservent reset ucfirst
|
||||||
attributes="${attributes}|chop|getsockname|umask|chown|getsockopt|reverse|undef|chr|glob|rewinddir|chroot|gmtime|rindex|unlink|close|rmdir|unpack"
|
chop getsockname umask chown getsockopt reverse undef chr glob rewinddir chroot gmtime rindex unlink close rmdir unpack
|
||||||
attributes="${attributes}|closedir|grep|say|unshift|connect|hex|scalar|untie|cos|index|seek|use|crypt|seekdir|utime|dbmclose|int|select|values|dbmopen|ioctl|semctl"
|
closedir grep say unshift connect hex scalar untie cos index seek use crypt seekdir utime dbmclose int select values dbmopen ioctl semctl
|
||||||
attributes="${attributes}|vec|defined|join|semget|wait|delete|keys|semop|waitpid|kill|send|wantarray|die|last|setgrent|warn|dump|lc|sethostent|write|each|lcfirst|setnetent"
|
vec defined join semget wait delete keys semop waitpid kill send wantarray die last setgrent warn dump lc sethostent write each lcfirst setnetent"
|
||||||
values="ARGV|STDERR|STDOUT|ARGVOUT|STDIN|__DATA__|__END__|__FILE__|__LINE__|__PACKAGE__"
|
values="ARGV STDERR STDOUT ARGVOUT STDIN __DATA__ __END__ __FILE__ __LINE__ __PACKAGE__"
|
||||||
|
|
||||||
|
join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
|
||||||
|
|
||||||
# Add the language's grammar to the static completion list
|
# Add the language's grammar to the static completion list
|
||||||
printf %s\\n "hook global WinSetOption filetype=perl %{
|
printf %s\\n "declare-option str-list perl_static_words $(join "${keywords} ${attributes} ${values}" ' ')"
|
||||||
set-option window static_words ${keywords} ${attributes} ${values}
|
|
||||||
}" | tr '|' ' '
|
|
||||||
|
|
||||||
# Highlight keywords
|
# Highlight keywords
|
||||||
printf %s "
|
printf %s "
|
||||||
add-highlighter shared/perl/code/ regex \b(${keywords})\b 0:keyword
|
add-highlighter shared/perl/code/ regex \b($(join "${keywords}" '|'))\b 0:keyword
|
||||||
add-highlighter shared/perl/code/ regex \b(${attributes})\b 0:attribute
|
add-highlighter shared/perl/code/ regex \b($(join "${attributes}" '|'))\b 0:attribute
|
||||||
add-highlighter shared/perl/code/ regex \b(${values})\b 0:value
|
add-highlighter shared/perl/code/ regex \b($(join "${values}" '|'))\b 0:value
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,20 +119,4 @@ define-command -hidden perl-indent-on-closing-curly-brace %[
|
||||||
try %[ execute-keys -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
try %[ execute-keys -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Initialization
|
§
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group perl-highlight global WinSetOption filetype=perl %{
|
|
||||||
add-highlighter window/perl ref perl
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/perl }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=perl %{
|
|
||||||
# cleanup trailing whitespaces when exiting insert mode
|
|
||||||
hook window ModeChange insert:.* -group perl-trim-indent %{ try %{ execute-keys -draft <a-x>s^\h+$<ret>d } }
|
|
||||||
hook window InsertChar \n -group perl-indent perl-indent-on-new-line
|
|
||||||
hook window InsertChar \{ -group perl-indent perl-indent-on-opening-curly-brace
|
|
||||||
hook window InsertChar \} -group perl-indent perl-indent-on-closing-curly-brace
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window perl-.+ }
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,6 +5,27 @@ hook global BufCreate .*[.](php) %{
|
||||||
set-option buffer filetype php
|
set-option buffer filetype php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=php %{
|
||||||
|
require-module php
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group php-trim-indent php-trim-indent
|
||||||
|
hook window InsertChar .* -group php-indent php-indent-on-char
|
||||||
|
hook window InsertChar \n -group php-indent php-indent-on-new-line
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window php-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group php-highlight global WinSetOption filetype=php %{
|
||||||
|
add-highlighter window/php-file ref php-file
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/php-file }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module php %(
|
||||||
|
require-module html
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -73,18 +94,4 @@ define-command -hidden php-indent-on-new-line %<
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
|
|
||||||
# Initialization
|
)
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group php-highlight global WinSetOption filetype=php %{
|
|
||||||
add-highlighter window/php-file ref php-file
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/php-file }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=php %{
|
|
||||||
hook window ModeChange insert:.* -group php-trim-indent php-trim-indent
|
|
||||||
hook window InsertChar .* -group php-indent php-indent-on-char
|
|
||||||
hook window InsertChar \n -group php-indent php-indent-on-new-line
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window php-.+ }
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,6 +8,28 @@ hook global BufCreate .*[.](pony) %{
|
||||||
set-option buffer filetype pony
|
set-option buffer filetype pony
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=pony %{
|
||||||
|
require-module pony
|
||||||
|
|
||||||
|
set-option window static_words %opt{pony_static_words}
|
||||||
|
|
||||||
|
hook window InsertChar \n -group pony-indent pony-indent-on-new-line
|
||||||
|
# cleanup trailing whitespaces on current line insert end
|
||||||
|
hook window ModeChange insert:.* -group pony-trim-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window pony-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group pony-highlight global WinSetOption filetype=pony %{
|
||||||
|
add-highlighter window/pony ref pony
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter pony }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module pony %{
|
||||||
|
|
||||||
# Highlighters & Completion
|
# Highlighters & Completion
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -33,9 +55,7 @@ evaluate-commands %sh{
|
||||||
# Add the language's grammar to the static completion list
|
# Add the language's grammar to the static completion list
|
||||||
static_words="${values} ${meta} ${keywords} ${types_decl} ${capabilities}"
|
static_words="${values} ${meta} ${keywords} ${types_decl} ${capabilities}"
|
||||||
static_words="${static_words} ${struct}"
|
static_words="${static_words} ${struct}"
|
||||||
printf %s\\n "hook global WinSetOption filetype=pony %{
|
printf %s\\n "declare-option str-list pony_static_words ${static_words}" | tr '|' ' '
|
||||||
set-option window static_words ${static_words}
|
|
||||||
}" | tr '|' ' '
|
|
||||||
|
|
||||||
# Highlight keywords
|
# Highlight keywords
|
||||||
printf %s "
|
printf %s "
|
||||||
|
@ -75,18 +95,4 @@ define-command -hidden pony-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group pony-highlight global WinSetOption filetype=pony %{
|
|
||||||
add-highlighter window/pony ref pony
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter pony }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=pony %{
|
|
||||||
hook window InsertChar \n -group pony-indent pony-indent-on-new-line
|
|
||||||
# cleanup trailing whitespaces on current line insert end
|
|
||||||
hook window ModeChange insert:.* -group pony-trim-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window pony-.+ }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,28 @@ hook global BufCreate .*\.proto$ %{
|
||||||
set-option buffer filetype protobuf
|
set-option buffer filetype protobuf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=protobuf %[
|
||||||
|
require-module protobuf
|
||||||
|
|
||||||
|
set-option window static_words %opt{protobuf_static_words}
|
||||||
|
|
||||||
|
hook -group protobuf-indent window InsertChar \n protobuf-indent-on-newline
|
||||||
|
hook -group protobuf-indent window InsertChar \{ protobuf-indent-on-opening-curly-brace
|
||||||
|
hook -group protobuf-indent window InsertChar \} protobuf-indent-on-closing-curly-brace
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window protobuf-.+ }
|
||||||
|
]
|
||||||
|
|
||||||
|
hook -group protobuf-highlight global WinSetOption filetype=protobuf %{
|
||||||
|
add-highlighter window/protobuf ref protobuf
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/protobuf }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module protobuf %[
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -20,31 +42,30 @@ add-highlighter shared/protobuf/code/ regex %{(0x)?[0-9]+\b} 0:value
|
||||||
|
|
||||||
evaluate-commands %sh{
|
evaluate-commands %sh{
|
||||||
# Grammer
|
# Grammer
|
||||||
keywords="default|deprecated|enum|extend|import|message|oneof|option"
|
keywords='default deprecated enum extend import message oneof option
|
||||||
keywords="${keywords}|package|service|syntax"
|
package service syntax'
|
||||||
attributes="optional|repeated|required"
|
attributes='optional repeated required'
|
||||||
types="double|float|int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64"
|
types='double float int32 int64 uint32 uint64 sint32 sint64 fixed32 fixed64
|
||||||
types="${types}|sfixed32|sfixed64|bool|string|bytes|rpc"
|
sfixed32 sfixed64 bool string bytes rpc'
|
||||||
values="false|true"
|
values='false true'
|
||||||
|
|
||||||
|
join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
|
||||||
|
|
||||||
# Add the language's grammer to the static completion list
|
# Add the language's grammer to the static completion list
|
||||||
printf '%s\n' "hook global WinSetOption filetype=protobuf %{
|
printf %s\\n "declare-option str-list protobuf_static_words $(join "${keywords} ${attributes} ${types} ${values}" ' ')"
|
||||||
set-option window static_words ${keywords} ${attributes} ${types} ${values}
|
|
||||||
}" | tr '|' ' '
|
|
||||||
|
|
||||||
# Highlight keywords
|
# Highlight keywords
|
||||||
printf %s "
|
printf %s "
|
||||||
add-highlighter shared/protobuf/code/keywords regex \b(${keywords})\b 0:keyword
|
add-highlighter shared/protobuf/code/keywords regex \b($(join "${keywords}" '|'))\b 0:keyword
|
||||||
add-highlighter shared/protobuf/code/attributes regex \b(${attributes})\b 0:attribute
|
add-highlighter shared/protobuf/code/attributes regex \b($(join "${attributes}" '|'))\b 0:attribute
|
||||||
add-highlighter shared/protobuf/code/types regex \b(${types})\b 0:type
|
add-highlighter shared/protobuf/code/types regex \b($(join "${types}" '|'))\b 0:type
|
||||||
add-highlighter shared/protobuf/code/values regex \b(${values})\b 0:value
|
add-highlighter shared/protobuf/code/values regex \b($(join "${values}" '|'))\b 0:value
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Commands
|
# Commands
|
||||||
# ‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
|
||||||
define-command -hidden protobuf-indent-on-newline %~
|
define-command -hidden protobuf-indent-on-newline %~
|
||||||
evaluate-commands -draft -itersel %[
|
evaluate-commands -draft -itersel %[
|
||||||
# preserve previous line indent
|
# preserve previous line indent
|
||||||
|
@ -68,18 +89,4 @@ define-command -hidden protobuf-indent-on-closing-curly-brace %[
|
||||||
try %[ execute-keys -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
try %[ execute-keys -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\A|.\z<ret>1<a-&> ]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group protobuf-highlight global WinSetOption filetype=protobuf %{
|
|
||||||
add-highlighter window/protobuf ref protobuf
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/protobuf }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=protobuf %[
|
|
||||||
hook -group protobuf-indent window InsertChar \n protobuf-indent-on-newline
|
|
||||||
hook -group protobuf-indent window InsertChar \{ protobuf-indent-on-opening-curly-brace
|
|
||||||
hook -group protobuf-indent window InsertChar \} protobuf-indent-on-closing-curly-brace
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window protobuf-.+ }
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -12,6 +12,26 @@ hook global BufCreate .*[.](pug|jade) %{
|
||||||
set-option buffer filetype pug
|
set-option buffer filetype pug
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=pug %{
|
||||||
|
require-module pug
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group pug-trim-indent pug-trim-indent
|
||||||
|
hook window InsertChar \n -group pug-indent pug-indent-on-new-line
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window pug-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group pug-highlight global WinSetOption filetype=pug %{
|
||||||
|
add-highlighter window/pug ref pug
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/pug }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module pug %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -58,17 +78,4 @@ define-command -hidden pug-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group pug-highlight global WinSetOption filetype=pug %{
|
|
||||||
add-highlighter window/pug ref pug
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/pug }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=pug %{
|
|
||||||
hook window ModeChange insert:.* -group pug-trim-indent pug-trim-indent
|
|
||||||
hook window InsertChar \n -group pug-indent pug-indent-on-new-line
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window pug-.+ }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,27 @@ hook global BufCreate .*[.](py) %{
|
||||||
set-option buffer filetype python
|
set-option buffer filetype python
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=python %{
|
||||||
|
require-module python
|
||||||
|
|
||||||
|
set-option window static_words %opt{python_static_words}
|
||||||
|
|
||||||
|
hook window InsertChar \n -group python-indent python-indent-on-new-line
|
||||||
|
# cleanup trailing whitespaces on current line insert end
|
||||||
|
hook window ModeChange insert:.* -group python-trim-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window python-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group python-highlight global WinSetOption filetype=python %{
|
||||||
|
add-highlighter window/python ref python
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/python }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module python %{
|
||||||
|
|
||||||
# Highlighters & Completion
|
# Highlighters & Completion
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -36,79 +57,79 @@ add-highlighter shared/python/docstring/ region '\.\.\. \K' '\z' ref python
|
||||||
|
|
||||||
evaluate-commands %sh{
|
evaluate-commands %sh{
|
||||||
# Grammar
|
# Grammar
|
||||||
values="True|False|None|self|inf"
|
values="True False None self inf"
|
||||||
meta="import|from"
|
meta="import from"
|
||||||
|
|
||||||
# attributes and methods list based on https://docs.python.org/3/reference/datamodel.html
|
# attributes and methods list based on https://docs.python.org/3/reference/datamodel.html
|
||||||
attributes="__annotations__|__closure__|__code__|__defaults__|__dict__|__doc__"
|
attributes="__annotations__ __closure__ __code__ __defaults__ __dict__ __doc__
|
||||||
attributes="${attributes}|__globals__|__kwdefaults__|__module__|__name__|__qualname__"
|
__globals__ __kwdefaults__ __module__ __name__ __qualname__"
|
||||||
methods="__abs__|__add__|__aenter__|__aexit__|__aiter__|__and__|__anext__"
|
methods="__abs__ __add__ __aenter__ __aexit__ __aiter__ __and__ __anext__
|
||||||
methods="${methods}|__await__|__bool__|__bytes__|__call__|__complex__|__contains__"
|
__await__ __bool__ __bytes__ __call__ __complex__ __contains__
|
||||||
methods="${methods}|__del__|__delattr__|__delete__|__delitem__|__dir__|__divmod__"
|
__del__ __delattr__ __delete__ __delitem__ __dir__ __divmod__
|
||||||
methods="${methods}|__enter__|__eq__|__exit__|__float__|__floordiv__|__format__"
|
__enter__ __eq__ __exit__ __float__ __floordiv__ __format__
|
||||||
methods="${methods}|__ge__|__get__|__getattr__|__getattribute__|__getitem__"
|
__ge__ __get__ __getattr__ __getattribute__ __getitem__
|
||||||
methods="${methods}|__gt__|__hash__|__iadd__|__iand__|__ifloordiv__|__ilshift__"
|
__gt__ __hash__ __iadd__ __iand__ __ifloordiv__ __ilshift__
|
||||||
methods="${methods}|__imatmul__|__imod__|__imul__|__index__|__init__"
|
__imatmul__ __imod__ __imul__ __index__ __init__
|
||||||
methods="${methods}|__init_subclass__|__int__|__invert__|__ior__|__ipow__"
|
__init_subclass__ __int__ __invert__ __ior__ __ipow__
|
||||||
methods="${methods}|__irshift__|__isub__|__iter__|__itruediv__|__ixor__|__le__"
|
__irshift__ __isub__ __iter__ __itruediv__ __ixor__ __le__
|
||||||
methods="${methods}|__len__|__length_hint__|__lshift__|__lt__|__matmul__"
|
__len__ __length_hint__ __lshift__ __lt__ __matmul__
|
||||||
methods="${methods}|__missing__|__mod__|__mul__|__ne__|__neg__|__new__|__or__"
|
__missing__ __mod__ __mul__ __ne__ __neg__ __new__ __or__
|
||||||
methods="${methods}|__pos__|__pow__|__radd__|__rand__|__rdivmod__|__repr__"
|
__pos__ __pow__ __radd__ __rand__ __rdivmod__ __repr__
|
||||||
methods="${methods}|__reversed__|__rfloordiv__|__rlshift__|__rmatmul__|__rmod__"
|
__reversed__ __rfloordiv__ __rlshift__ __rmatmul__ __rmod__
|
||||||
methods="${methods}|__rmul__|__ror__|__round__|__rpow__|__rrshift__|__rshift__"
|
__rmul__ __ror__ __round__ __rpow__ __rrshift__ __rshift__
|
||||||
methods="${methods}|__rsub__|__rtruediv__|__rxor__|__set__|__setattr__"
|
__rsub__ __rtruediv__ __rxor__ __set__ __setattr__
|
||||||
methods="${methods}|__setitem__|__set_name__|__slots__|__str__|__sub__"
|
__setitem__ __set_name__ __slots__ __str__ __sub__
|
||||||
methods="${methods}|__truediv__|__xor__"
|
__truediv__ __xor__"
|
||||||
|
|
||||||
# built-in exceptions https://docs.python.org/3/library/exceptions.html
|
# built-in exceptions https://docs.python.org/3/library/exceptions.html
|
||||||
exceptions="ArithmeticError|AssertionError|AttributeError|BaseException|BlockingIOError"
|
exceptions="ArithmeticError AssertionError AttributeError BaseException BlockingIOError
|
||||||
exceptions="${exceptions}|BrokenPipeError|BufferError|BytesWarning|ChildProcessError"
|
BrokenPipeError BufferError BytesWarning ChildProcessError
|
||||||
exceptions="${exceptions}|ConnectionAbortedError|ConnectionError|ConnectionRefusedError"
|
ConnectionAbortedError ConnectionError ConnectionRefusedError
|
||||||
exceptions="${exceptions}|ConnectionResetError|DeprecationWarning|EOFError|Exception"
|
ConnectionResetError DeprecationWarning EOFError Exception
|
||||||
exceptions="${exceptions}|FileExistsError|FileNotFoundError|FloatingPointError|FutureWarning"
|
FileExistsError FileNotFoundError FloatingPointError FutureWarning
|
||||||
exceptions="${exceptions}|GeneratorExit|ImportError|ImportWarning|IndentationError"
|
GeneratorExit ImportError ImportWarning IndentationError
|
||||||
exceptions="${exceptions}|IndexError|InterruptedError|IsADirectoryError|KeyboardInterrupt"
|
IndexError InterruptedError IsADirectoryError KeyboardInterrupt
|
||||||
exceptions="${exceptions}|KeyError|LookupError|MemoryError|ModuleNotFoundError|NameError"
|
KeyError LookupError MemoryError ModuleNotFoundError NameError
|
||||||
exceptions="${exceptions}|NotADirectoryError|NotImplementedError|OSError|OverflowError"
|
NotADirectoryError NotImplementedError OSError OverflowError
|
||||||
exceptions="${exceptions}|PendingDeprecationWarning|PermissionError|ProcessLookupError"
|
PendingDeprecationWarning PermissionError ProcessLookupError
|
||||||
exceptions="${exceptions}|RecursionError|ReferenceError|ResourceWarning|RuntimeError"
|
RecursionError ReferenceError ResourceWarning RuntimeError
|
||||||
exceptions="${exceptions}|RuntimeWarning|StopAsyncIteration|StopIteration|SyntaxError"
|
RuntimeWarning StopAsyncIteration StopIteration SyntaxError
|
||||||
exceptions="${exceptions}|SyntaxWarning|SystemError|SystemExit|TabError|TimeoutError|TypeError"
|
SyntaxWarning SystemError SystemExit TabError TimeoutError TypeError
|
||||||
exceptions="${exceptions}|UnboundLocalError|UnicodeDecodeError|UnicodeEncodeError|UnicodeError"
|
UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError
|
||||||
exceptions="${exceptions}|UnicodeTranslateError|UnicodeWarning|UserWarning|ValueError|Warning"
|
UnicodeTranslateError UnicodeWarning UserWarning ValueError Warning
|
||||||
exceptions="${exceptions}|ZeroDivisionError"
|
ZeroDivisionError"
|
||||||
|
|
||||||
# Keyword list is collected using `keyword.kwlist` from `keyword`
|
# Keyword list is collected using `keyword.kwlist` from `keyword`
|
||||||
keywords="and|as|assert|async|await|break|class|continue|def|del|elif|else|except|exec"
|
keywords="and as assert async await break class continue def del elif else except exec
|
||||||
keywords="${keywords}|finally|for|global|if|in|is|lambda|nonlocal|not|or|pass|print"
|
finally for global if in is lambda nonlocal not or pass print
|
||||||
keywords="${keywords}|raise|return|try|while|with|yield"
|
raise return try while with yield"
|
||||||
|
|
||||||
types="bool|buffer|bytearray|bytes|complex|dict|file|float|frozenset|int"
|
types="bool buffer bytearray bytes complex dict file float frozenset int
|
||||||
types="${types}|list|long|memoryview|object|set|str|tuple|unicode|xrange"
|
list long memoryview object set str tuple unicode xrange"
|
||||||
|
|
||||||
functions="abs|all|any|ascii|bin|breakpoint|callable|chr|classmethod|compile|complex"
|
functions="abs all any ascii bin breakpoint callable chr classmethod compile complex
|
||||||
functions="${functions}|delattr|dict|dir|divmod|enumerate|eval|exec|filter"
|
delattr dict dir divmod enumerate eval exec filter
|
||||||
functions="${functions}|format|frozenset|getattr|globals|hasattr|hash|help"
|
format frozenset getattr globals hasattr hash help
|
||||||
functions="${functions}|hex|id|__import__|input|isinstance|issubclass|iter"
|
hex id __import__ input isinstance issubclass iter
|
||||||
functions="${functions}|len|locals|map|max|memoryview|min|next|oct|open|ord"
|
len locals map max memoryview min next oct open ord
|
||||||
functions="${functions}|pow|print|property|range|repr|reversed|round"
|
pow print property range repr reversed round
|
||||||
functions="${functions}|setattr|slice|sorted|staticmethod|sum|super|type|vars|zip"
|
setattr slice sorted staticmethod sum super type vars zip"
|
||||||
|
|
||||||
|
join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
|
||||||
|
|
||||||
# Add the language's grammar to the static completion list
|
# Add the language's grammar to the static completion list
|
||||||
printf %s\\n "hook global WinSetOption filetype=python %{
|
printf %s\\n "declare-option str-list python_static_words $(join "${values} ${meta} ${attributes} ${methods} ${exceptions} ${keywords} ${types} ${functions}" ' ')"
|
||||||
set-option window static_words ${values} ${meta} ${attributes} ${methods} ${exceptions} ${keywords} ${types} ${functions}
|
|
||||||
}" | tr '|' ' '
|
|
||||||
|
|
||||||
# Highlight keywords
|
# Highlight keywords
|
||||||
printf %s "
|
printf %s "
|
||||||
add-highlighter shared/python/code/ regex '\b(${values})\b' 0:value
|
add-highlighter shared/python/code/ regex '\b($(join "${values}" '|'))\b' 0:value
|
||||||
add-highlighter shared/python/code/ regex '\b(${meta})\b' 0:meta
|
add-highlighter shared/python/code/ regex '\b($(join "${meta}" '|'))\b' 0:meta
|
||||||
add-highlighter shared/python/code/ regex '\b(${attribute})\b' 0:attribute
|
add-highlighter shared/python/code/ regex '\b($(join "${attribute}" '|'))\b' 0:attribute
|
||||||
add-highlighter shared/python/code/ regex '\bdef\s+(${methods})\b' 1:function
|
add-highlighter shared/python/code/ regex '\bdef\s+($(join "${methods}" '|'))\b' 1:function
|
||||||
add-highlighter shared/python/code/ regex '\b(${exceptions})\b' 0:function
|
add-highlighter shared/python/code/ regex '\b($(join "${exceptions}" '|'))\b' 0:function
|
||||||
add-highlighter shared/python/code/ regex '\b(${keywords})\b' 0:keyword
|
add-highlighter shared/python/code/ regex '\b($(join "${keywords}" '|'))\b' 0:keyword
|
||||||
add-highlighter shared/python/code/ regex '\b(${functions})\b\(' 1:builtin
|
add-highlighter shared/python/code/ regex '\b($(join "${functions}" '|'))\b\(' 1:builtin
|
||||||
add-highlighter shared/python/code/ regex '\b(${types})\b' 0:type
|
add-highlighter shared/python/code/ regex '\b($(join "${types}" '|'))\b' 0:type
|
||||||
add-highlighter shared/python/code/ regex '@[\w_]+\b' 0:attribute
|
add-highlighter shared/python/code/ regex '@[\w_]+\b' 0:attribute
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
@ -132,17 +153,4 @@ define-command -hidden python-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group python-highlight global WinSetOption filetype=python %{
|
|
||||||
add-highlighter window/python ref python
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/python }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=python %{
|
|
||||||
hook window InsertChar \n -group python-indent python-indent-on-new-line
|
|
||||||
# cleanup trailing whitespaces on current line insert end
|
|
||||||
hook window ModeChange insert:.* -group python-trim-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window python-.+ }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,26 @@ hook global BufCreate .*[.](ragel|rl) %{
|
||||||
set-option buffer filetype ragel
|
set-option buffer filetype ragel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=ragel %{
|
||||||
|
require-module ragel
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group ragel-trim-indent ragel-trim-indent
|
||||||
|
hook window InsertChar .* -group ragel-indent ragel-indent-on-char
|
||||||
|
hook window InsertChar \n -group ragel-indent ragel-indent-on-new-line
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window ragel-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group ragel-highlight global WinSetOption filetype=ragel %{
|
||||||
|
add-highlighter window/ragel ref ragel
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ragel }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module ragel %§
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -53,18 +73,4 @@ define-command -hidden ragel-indent-on-new-line %<
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
|
|
||||||
# Initialization
|
§
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group ragel-highlight global WinSetOption filetype=ragel %{
|
|
||||||
add-highlighter window/ragel ref ragel
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ragel }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=ragel %{
|
|
||||||
hook window ModeChange insert:.* -group ragel-trim-indent ragel-trim-indent
|
|
||||||
hook window InsertChar .* -group ragel-indent ragel-indent-on-char
|
|
||||||
hook window InsertChar \n -group ragel-indent ragel-indent-on-new-line
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window ragel-.+ }
|
|
||||||
}
|
|
||||||
|
|
|
@ -5,6 +5,20 @@ hook global BufCreate .*[.](rst) %{
|
||||||
set-option buffer filetype restructuredtext
|
set-option buffer filetype restructuredtext
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=restructuredtext %{
|
||||||
|
require-module restructuredtext
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group restructuredtext-highlight global WinSetOption filetype=restructuredtext %{
|
||||||
|
add-highlighter window/restructuredtext ref restructuredtext
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/restructuredtext }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module restructuredtext %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -65,10 +79,4 @@ add-highlighter shared/restructuredtext/content/ regex [^*](\*\*([^\s*]|([^\s*][
|
||||||
add-highlighter shared/restructuredtext/content/ regex [^*](\*([^\s*]|([^\s*][^*]*[^\s*]))\*)[^*] 1:italic
|
add-highlighter shared/restructuredtext/content/ regex [^*](\*([^\s*]|([^\s*][^*]*[^\s*]))\*)[^*] 1:italic
|
||||||
add-highlighter shared/restructuredtext/content/ regex [^`](``([^\s`]|([^\s`][^`]*[^\s`]))``)[^`] 1:mono
|
add-highlighter shared/restructuredtext/content/ regex [^`](``([^\s`]|([^\s`][^`]*[^\s`]))``)[^`] 1:mono
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group restructuredtext-highlight global WinSetOption filetype=restructuredtext %{
|
|
||||||
add-highlighter window/restructuredtext ref restructuredtext
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/restructuredtext }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,33 @@ hook global BufCreate .*(([.](rb))|(irbrc)|(pryrc)|(Brewfile)|(Capfile|[.]cap)|(
|
||||||
set-option buffer filetype ruby
|
set-option buffer filetype ruby
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=ruby %{
|
||||||
|
require-module ruby
|
||||||
|
|
||||||
|
set-option window static_words %opt{ruby_static_words}
|
||||||
|
|
||||||
|
hook window InsertChar .* -group ruby-indent ruby-indent-on-char
|
||||||
|
hook window InsertChar \n -group ruby-insert ruby-insert-on-new-line
|
||||||
|
hook window InsertChar \n -group ruby-indent ruby-indent-on-new-line
|
||||||
|
|
||||||
|
alias window alt ruby-alternative-file
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{
|
||||||
|
remove-hooks window ruby-.+
|
||||||
|
unalias window alt ruby-alternative-file
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group ruby-highlight global WinSetOption filetype=ruby %{
|
||||||
|
add-highlighter window/ruby ref ruby
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ruby }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module ruby %[
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -55,9 +82,7 @@ evaluate-commands %sh{
|
||||||
meta="require|include|extend"
|
meta="require|include|extend"
|
||||||
|
|
||||||
# Add the language's grammar to the static completion list
|
# Add the language's grammar to the static completion list
|
||||||
printf %s\\n "hook global WinSetOption filetype=ruby %{
|
printf %s\\n "declare-option str-list ruby_static_words ${keywords} ${attributes} ${values} ${meta}" | tr '|' ' '
|
||||||
set-option window static_words ${keywords} ${attributes} ${values} ${meta}
|
|
||||||
}" | tr '|' ' '
|
|
||||||
|
|
||||||
# Highlight keywords
|
# Highlight keywords
|
||||||
printf %s "
|
printf %s "
|
||||||
|
@ -146,23 +171,4 @@ define-command -hidden ruby-insert-on-new-line %[
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Initialization
|
]
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group ruby-highlight global WinSetOption filetype=ruby %{
|
|
||||||
add-highlighter window/ruby ref ruby
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/ruby }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=ruby %{
|
|
||||||
hook window InsertChar .* -group ruby-indent ruby-indent-on-char
|
|
||||||
hook window InsertChar \n -group ruby-insert ruby-insert-on-new-line
|
|
||||||
hook window InsertChar \n -group ruby-indent ruby-indent-on-new-line
|
|
||||||
|
|
||||||
alias window alt ruby-alternative-file
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{
|
|
||||||
remove-hooks window ruby-.+
|
|
||||||
unalias window alt ruby-alternative-file
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,6 +8,34 @@ hook global BufCreate .*[.](rust|rs) %{
|
||||||
set-option buffer filetype rust
|
set-option buffer filetype rust
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=rust %[
|
||||||
|
require-module rust
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group rust-trim-indent rust-trim-indent
|
||||||
|
hook window InsertChar \n -group rust-indent rust-indent-on-new-line
|
||||||
|
hook window InsertChar \{ -group rust-indent rust-indent-on-opening-curly-brace
|
||||||
|
hook window InsertChar [)}] -group rust-indent rust-indent-on-closing
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window rust-.+ }
|
||||||
|
]
|
||||||
|
|
||||||
|
hook -group rust-highlight global WinSetOption filetype=rust %{
|
||||||
|
add-highlighter window/rust ref rust
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/rust }
|
||||||
|
}
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=rust %[
|
||||||
|
set window formatcmd 'rustfmt'
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
provide-module rust %§
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -71,25 +99,4 @@ define-command -hidden rust-indent-on-closing %[
|
||||||
_
|
_
|
||||||
]
|
]
|
||||||
|
|
||||||
# Initialization
|
§
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group rust-highlight global WinSetOption filetype=rust %{
|
|
||||||
add-highlighter window/rust ref rust
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/rust }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=rust %[
|
|
||||||
hook window ModeChange insert:.* -group rust-trim-indent rust-trim-indent
|
|
||||||
hook window InsertChar \n -group rust-indent rust-indent-on-new-line
|
|
||||||
hook window InsertChar \{ -group rust-indent rust-indent-on-opening-curly-brace
|
|
||||||
hook window InsertChar [)}] -group rust-indent rust-indent-on-closing
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window rust-.+ }
|
|
||||||
]
|
|
||||||
|
|
||||||
# Configuration
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=rust %[
|
|
||||||
set window formatcmd 'rustfmt'
|
|
||||||
]
|
|
||||||
|
|
|
@ -8,6 +8,27 @@ hook global BufCreate .*[.](sass) %{
|
||||||
set-option buffer filetype sass
|
set-option buffer filetype sass
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=sass %{
|
||||||
|
require-module sass
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group sass-trim-indent sass-trim-indent
|
||||||
|
hook window InsertChar \n -group sass-indent sass-indent-on-new-line
|
||||||
|
set-option buffer extra_word_chars '_' '-'
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window sass-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group sass-highlight global WinSetOption filetype=sass %{
|
||||||
|
add-highlighter window/sass ref sass
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/sass }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module sass %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -45,18 +66,4 @@ define-command -hidden sass-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group sass-highlight global WinSetOption filetype=sass %{
|
|
||||||
add-highlighter window/sass ref sass
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/sass }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=sass %{
|
|
||||||
hook window ModeChange insert:.* -group sass-trim-indent sass-trim-indent
|
|
||||||
hook window InsertChar \n -group sass-indent sass-indent-on-new-line
|
|
||||||
set-option buffer extra_word_chars '_' '-'
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window sass-.+ }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,27 @@ hook global BufCreate .*[.](scala) %{
|
||||||
set-option buffer filetype scala
|
set-option buffer filetype scala
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=scala %[
|
||||||
|
require-module scala
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group scala-trim-indent scala-trim-indent
|
||||||
|
hook window InsertChar \n -group scala-indent scala-indent-on-new-line
|
||||||
|
hook window InsertChar \} -group scala-indent scala-indent-on-closing-curly-brace
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window scala-.+ }
|
||||||
|
]
|
||||||
|
|
||||||
|
hook -group scala-highlight global WinSetOption filetype=scala %{
|
||||||
|
add-highlighter window/scala ref scala
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/scala }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module scala %[
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -58,18 +79,4 @@ define-command -hidden scala-indent-on-closing-curly-brace %[
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group scala-highlight global WinSetOption filetype=scala %{
|
|
||||||
add-highlighter window/scala ref scala
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/scala }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=scala %[
|
|
||||||
hook window ModeChange insert:.* -group scala-trim-indent scala-trim-indent
|
|
||||||
hook window InsertChar \n -group scala-indent scala-indent-on-new-line
|
|
||||||
hook window InsertChar \} -group scala-indent scala-indent-on-closing-curly-brace
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window scala-.+ }
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# http://www.scheme-reports.org
|
# http://www.scheme-reports.org
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
# require lisp.kak
|
|
||||||
|
|
||||||
# Detection
|
# Detection
|
||||||
# ‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -10,6 +8,30 @@ hook global BufCreate (.*/)?(.*\.(scm|ss|sld)) %{
|
||||||
set-option buffer filetype scheme
|
set-option buffer filetype scheme
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=scheme %{
|
||||||
|
require-module scheme
|
||||||
|
|
||||||
|
set-option window static_words %opt{scheme_static_words}
|
||||||
|
|
||||||
|
set-option buffer extra_word_chars '_' '-' '!' '%' '?' '<' '>' '='
|
||||||
|
hook window InsertEnd .* -group scheme-trim-indent lisp-trim-indent
|
||||||
|
hook window InsertChar \n -group scheme-indent lisp-indent-on-new-line
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window scheme-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group scheme-highlight global WinSetOption filetype=scheme %{
|
||||||
|
add-highlighter window/scheme ref scheme
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/scheme }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module scheme %{
|
||||||
|
|
||||||
|
require-module lisp
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -99,9 +121,9 @@ evaluate-commands %sh{ exec awk -f - <<'EOF'
|
||||||
}
|
}
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
printf("hook global WinSetOption filetype=scheme %%{ set-option window static_words ");
|
printf("declare-option str-list scheme_static_words ");
|
||||||
print_words(keywords); print_words(meta); print_words(operators); print_words(builtins);
|
print_words(keywords); print_words(meta); print_words(operators); print_words(builtins);
|
||||||
printf(" }\n")
|
printf("\n");
|
||||||
|
|
||||||
add_word_highlighter(keywords, "keyword");
|
add_word_highlighter(keywords, "keyword");
|
||||||
add_word_highlighter(meta, "meta");
|
add_word_highlighter(meta, "meta");
|
||||||
|
@ -115,19 +137,4 @@ evaluate-commands %sh{ exec awk -f - <<'EOF'
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group scheme-highlight global WinSetOption filetype=scheme %{
|
|
||||||
add-highlighter window/scheme ref scheme
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/scheme }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=scheme %{
|
|
||||||
set-option buffer extra_word_chars '_' '-' '!' '%' '?' '<' '>' '='
|
|
||||||
hook window InsertEnd .* -group scheme-trim-indent lisp-trim-indent
|
|
||||||
hook window InsertChar \n -group scheme-indent lisp-indent-on-new-line
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window scheme-.+ }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
# http://sass-lang.com
|
# http://sass-lang.com
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
# require css.kak
|
|
||||||
|
|
||||||
# Detection
|
# Detection
|
||||||
# ‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -10,6 +8,30 @@ hook global BufCreate .*[.](scss) %{
|
||||||
set-option buffer filetype scss
|
set-option buffer filetype scss
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=scss %[
|
||||||
|
require-module scss
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group scss-trim-indent scss-trim-indent
|
||||||
|
hook window InsertChar \n -group scss-indent scss-indent-on-new-line
|
||||||
|
hook window InsertChar \} -group scss-indent scss-indent-on-closing-curly-brace
|
||||||
|
set-option buffer extra_word_chars '_' '-'
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window scss-.+ }
|
||||||
|
]
|
||||||
|
|
||||||
|
hook -group scss-highlight global WinSetOption filetype=scss %{
|
||||||
|
add-highlighter window/scss ref scss
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/scss }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module scss %[
|
||||||
|
|
||||||
|
require-module css
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -27,19 +49,4 @@ define-command -hidden scss-trim-indent css-trim-indent
|
||||||
define-command -hidden scss-indent-on-new-line css-indent-on-new-line
|
define-command -hidden scss-indent-on-new-line css-indent-on-new-line
|
||||||
define-command -hidden scss-indent-on-closing-curly-brace css-indent-on-closing-curly-brace
|
define-command -hidden scss-indent-on-closing-curly-brace css-indent-on-closing-curly-brace
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group scss-highlight global WinSetOption filetype=scss %{
|
|
||||||
add-highlighter window/scss ref scss
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/scss }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=scss %[
|
|
||||||
hook window ModeChange insert:.* -group scss-trim-indent scss-trim-indent
|
|
||||||
hook window InsertChar \n -group scss-indent scss-indent-on-new-line
|
|
||||||
hook window InsertChar \} -group scss-indent scss-indent-on-closing-curly-brace
|
|
||||||
set-option buffer extra_word_chars '_' '-'
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window scss-.+ }
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -2,6 +2,18 @@ hook global BufCreate .*\.(z|ba|c|k|mk)?sh(rc|_profile)? %{
|
||||||
set-option buffer filetype sh
|
set-option buffer filetype sh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=sh %{
|
||||||
|
require-module sh
|
||||||
|
set-option window static_words %opt{sh_static_words}
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group sh-highlight global WinSetOption filetype=sh %{
|
||||||
|
add-highlighter window/sh ref sh
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/sh }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module sh %[
|
||||||
|
|
||||||
add-highlighter shared/sh regions
|
add-highlighter shared/sh regions
|
||||||
add-highlighter shared/sh/code default-region group
|
add-highlighter shared/sh/code default-region group
|
||||||
add-highlighter shared/sh/double_string region %{(?<!\\)(?:\\\\)*\K"} %{(?<!\\)(?:\\\\)*"} group
|
add-highlighter shared/sh/double_string region %{(?<!\\)(?:\\\\)*\K"} %{(?<!\\)(?:\\\\)*"} group
|
||||||
|
@ -23,9 +35,7 @@ evaluate-commands %sh{
|
||||||
join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
|
join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
|
||||||
|
|
||||||
# Add the language's grammar to the static completion list
|
# Add the language's grammar to the static completion list
|
||||||
printf %s\\n "hook global WinSetOption filetype=sh %{
|
printf %s\\n "declare-option str-list sh_static_words $(join "${keywords}" ' ')"
|
||||||
set-option window static_words $(join "${keywords}" ' ')
|
|
||||||
}"
|
|
||||||
|
|
||||||
# Highlight keywords
|
# Highlight keywords
|
||||||
printf %s "add-highlighter shared/sh/code/ regex \b($(join "${keywords}" '|'))\b 0:keyword"
|
printf %s "add-highlighter shared/sh/code/ regex \b($(join "${keywords}" '|'))\b 0:keyword"
|
||||||
|
@ -38,7 +48,4 @@ add-highlighter shared/sh/code/function regex ^\h*(\w+)\h*\(\) 1:function
|
||||||
add-highlighter shared/sh/code/unscoped_expansion regex \$(\w+|#|@|\?|\$|!|-|\*) 0:value
|
add-highlighter shared/sh/code/unscoped_expansion regex \$(\w+|#|@|\?|\$|!|-|\*) 0:value
|
||||||
add-highlighter shared/sh/double_string/expansion regex \$(\w+|\{.+?\}) 0:value
|
add-highlighter shared/sh/double_string/expansion regex \$(\w+|\{.+?\}) 0:value
|
||||||
|
|
||||||
hook -group sh-highlight global WinSetOption filetype=sh %{
|
]
|
||||||
add-highlighter window/sh ref sh
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/sh }
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,6 +8,22 @@ hook global BufCreate .*/?(?i)sql %{
|
||||||
set-option buffer filetype sql
|
set-option buffer filetype sql
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=sql %{
|
||||||
|
require-module sql
|
||||||
|
set-option window static_words %opt{sql_static_words}
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group sql-highlight global WinSetOption filetype=sql %{
|
||||||
|
add-highlighter window/sql ref sql
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/sql }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module sql %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -80,9 +96,7 @@ evaluate-commands %sh{
|
||||||
data_types="${data_types}|Time|Ole Object|Hyperlink|Lookup Wizard"
|
data_types="${data_types}|Time|Ole Object|Hyperlink|Lookup Wizard"
|
||||||
|
|
||||||
# Add the language's grammar to the static completion list
|
# Add the language's grammar to the static completion list
|
||||||
printf %s\\n "hook global WinSetOption filetype=sql %{
|
printf %s\\n "declare-option str-list sql_static_words ${keywords} ${operators} ${functions} ${data_types} ${data_types_fn} NULL" | tr '|' ' '
|
||||||
set-option window static_words ${keywords} ${operators} ${functions} ${data_types} ${data_types_fn} NULL
|
|
||||||
}" | tr '|' ' '
|
|
||||||
|
|
||||||
# Highlight keywords
|
# Highlight keywords
|
||||||
printf %s "
|
printf %s "
|
||||||
|
@ -98,10 +112,4 @@ add-highlighter shared/sql/code/ regex '\+|-|\*|/|%|&|\||^|=|>|<|>=|<=|<>|\+=|-=
|
||||||
add-highlighter shared/sql/code/ regex \bNULL\b 0:value
|
add-highlighter shared/sql/code/ regex \bNULL\b 0:value
|
||||||
add-highlighter shared/sql/code/ regex \b\d+(?:\.\d+)?\b 0:value
|
add-highlighter shared/sql/code/ regex \b\d+(?:\.\d+)?\b 0:value
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group sql-highlight global WinSetOption filetype=sql %{
|
|
||||||
add-highlighter window/sql ref sql
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/sql }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,18 @@ hook global BufCreate .*\.(swift) %{
|
||||||
set-option buffer filetype swift
|
set-option buffer filetype swift
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=swift %{
|
||||||
|
require-module swift
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group swift-highlight global WinSetOption filetype=swift %{
|
||||||
|
add-highlighter window/swift ref swift
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/swift }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module swift %{
|
||||||
|
|
||||||
add-highlighter shared/swift regions
|
add-highlighter shared/swift regions
|
||||||
add-highlighter shared/swift/code default-region group
|
add-highlighter shared/swift/code default-region group
|
||||||
add-highlighter shared/swift/string region %{(?<!')"} %{(?<!\\)(\\\\)*"} fill string
|
add-highlighter shared/swift/string region %{(?<!')"} %{(?<!\\)(\\\\)*"} fill string
|
||||||
|
@ -22,7 +34,4 @@ add-highlighter shared/swift/code/ regex "\b(Bool|String|UInt|UInt16|UInt32|UInt
|
||||||
add-highlighter shared/swift/code/ regex "\b(IBAction|IBOutlet)\b" 0:attribute
|
add-highlighter shared/swift/code/ regex "\b(IBAction|IBOutlet)\b" 0:attribute
|
||||||
add-highlighter shared/swift/code/ regex "@\w+\b" 0:attribute
|
add-highlighter shared/swift/code/ regex "@\w+\b" 0:attribute
|
||||||
|
|
||||||
hook -group swift-highlight global WinSetOption filetype=swift %{
|
|
||||||
add-highlighter window/swift ref swift
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/swift }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,25 @@
|
||||||
|
|
||||||
hook global BufCreate .*\.taskpaper %{
|
hook global BufCreate .*\.taskpaper %{
|
||||||
set-option buffer filetype taskpaper
|
set-option buffer filetype taskpaper
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=taskpaper %{
|
||||||
|
require-module taskpaper
|
||||||
|
|
||||||
|
hook window InsertChar \n -group taskpaper-indent taskpaper-indent-on-new-line
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window taskpaper-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group taskpaper-highlight global WinSetOption filetype=taskpaper %{
|
||||||
|
add-highlighter window/taskpaper ref taskpaper
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/taskpaper }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module taskpaper %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
@ -33,15 +51,4 @@ define-command -hidden taskpaper-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group taskpaper-highlight global WinSetOption filetype=taskpaper %{
|
|
||||||
add-highlighter window/taskpaper ref taskpaper
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/taskpaper }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=taskpaper %{
|
|
||||||
hook window InsertChar \n -group taskpaper-indent taskpaper-indent-on-new-line
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window taskpaper-.+ }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,26 @@ hook global BufCreate .*\.(toml) %{
|
||||||
set-option buffer filetype toml
|
set-option buffer filetype toml
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=toml %{
|
||||||
|
require-module toml
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group toml-trim-indent toml-trim-indent
|
||||||
|
hook window InsertChar \n -group toml-indent toml-indent-on-new-line
|
||||||
|
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window toml-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group toml-highlight global WinSetOption filetype=toml %{
|
||||||
|
add-highlighter window/toml ref toml
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/toml }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module toml %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -47,17 +67,4 @@ define-command -hidden toml-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group toml-highlight global WinSetOption filetype=toml %{
|
|
||||||
add-highlighter window/toml ref toml
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/toml }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=toml %{
|
|
||||||
hook window ModeChange insert:.* -group toml-trim-indent toml-trim-indent
|
|
||||||
hook window InsertChar \n -group toml-indent toml-indent-on-new-line
|
|
||||||
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window toml-.+ }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,20 @@ hook global BufCreate .*\.\d+ %{
|
||||||
set-option buffer filetype troff
|
set-option buffer filetype troff
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=troff %{
|
||||||
|
require-module troff
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group troff-highlight global WinSetOption filetype=troff %{
|
||||||
|
add-highlighter window/troff ref troff
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/troff }
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module troff %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -21,10 +35,4 @@ add-highlighter shared/troff/ regex '^\.BR\s+(\S+)' 1:+b
|
||||||
add-highlighter shared/troff/ regex '^\.I\s+([^\n]+)' 1:+i
|
add-highlighter shared/troff/ regex '^\.I\s+([^\n]+)' 1:+i
|
||||||
add-highlighter shared/troff/ regex '^\.B\s+([^\n]+)' 1:+b
|
add-highlighter shared/troff/ regex '^\.B\s+([^\n]+)' 1:+b
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group troff-highlight global WinSetOption filetype=troff %{
|
|
||||||
add-highlighter window/troff ref troff
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/troff }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,19 @@ hook global BufCreate .*/?Tup(file|rules)(\.\w+)?$ %{
|
||||||
set-option buffer filetype tupfile
|
set-option buffer filetype tupfile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook -group tupfile-highlight global WinSetOption filetype=tupfile %{
|
||||||
|
require-module tupfile
|
||||||
|
|
||||||
|
add-highlighter window/tupfile ref tupfile
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/tupfile }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module tupfile %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -24,10 +37,4 @@ add-highlighter shared/tupfile/code/ regex '^\h*\b(ifn?eq|ifn?def|else|endif|err
|
||||||
add-highlighter shared/tupfile/code/ regex '^\h*\b(&?[\w_]+)\s*[:+]?=' 1:keyword
|
add-highlighter shared/tupfile/code/ regex '^\h*\b(&?[\w_]+)\s*[:+]?=' 1:keyword
|
||||||
add-highlighter shared/tupfile/code/ regex '`[^`\n]+`' 0:meta
|
add-highlighter shared/tupfile/code/ regex '`[^`\n]+`' 0:meta
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group tupfile-highlight global WinSetOption filetype=tupfile %{
|
|
||||||
add-highlighter window/tupfile ref tupfile
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/tupfile }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,25 @@ hook global BufCreate .*[.](ya?ml) %{
|
||||||
set-option buffer filetype yaml
|
set-option buffer filetype yaml
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Initialization
|
||||||
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
hook global WinSetOption filetype=yaml %{
|
||||||
|
require-module yaml
|
||||||
|
|
||||||
|
hook window ModeChange insert:.* -group yaml-trim-indent yaml-trim-indent
|
||||||
|
hook window InsertChar \n -group yaml-indent yaml-indent-on-new-line
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window yaml-.+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
hook -group yaml-highlight global WinSetOption filetype=yaml %{
|
||||||
|
add-highlighter window/yaml ref yaml
|
||||||
|
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/yaml }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
provide-module yaml %{
|
||||||
|
|
||||||
# Highlighters
|
# Highlighters
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
|
@ -43,16 +62,4 @@ define-command -hidden yaml-indent-on-new-line %{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Initialization
|
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
|
||||||
|
|
||||||
hook -group yaml-highlight global WinSetOption filetype=yaml %{
|
|
||||||
add-highlighter window/yaml ref yaml
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/yaml }
|
|
||||||
}
|
|
||||||
|
|
||||||
hook global WinSetOption filetype=yaml %{
|
|
||||||
hook window ModeChange insert:.* -group yaml-trim-indent yaml-trim-indent
|
|
||||||
hook window InsertChar \n -group yaml-indent yaml-indent-on-new-line
|
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window yaml-.+ }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ define-command autorestore-restore-buffer -docstring "Restore the backup for the
|
||||||
echo -debug Old backup file(s) found: will not restore ${older} .
|
echo -debug Old backup file(s) found: will not restore ${older} .
|
||||||
"
|
"
|
||||||
fi
|
fi
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf %s\\n "
|
printf %s\\n "
|
||||||
|
@ -39,7 +39,7 @@ define-command autorestore-restore-buffer -docstring "Restore the backup for the
|
||||||
nop %sh{
|
nop %sh{
|
||||||
if [ \"\${kak_opt_autorestore_purge_restored}\" = true ];
|
if [ \"\${kak_opt_autorestore_purge_restored}\" = true ];
|
||||||
then
|
then
|
||||||
rm -f \"${buffer_dirname}/.${buffer_basename}.kak.\"*
|
rm -f \"${buffer_dirname}/.${buffer_basename}.kak.\"*
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
hook -once global BufSetOption filetype=(c|cpp) %{
|
||||||
|
require-module clang
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module clang %[
|
||||||
|
|
||||||
declare-option -docstring "options to pass to the `clang` shell command" \
|
declare-option -docstring "options to pass to the `clang` shell command" \
|
||||||
str clang_options
|
str clang_options
|
||||||
|
|
||||||
|
@ -179,3 +185,5 @@ define-command clang-diagnostics-next -docstring "Jump to the next line that con
|
||||||
echo "echo -markup '{Error}no next clang diagnostic'"
|
echo "echo -markup '{Error}no next clang diagnostic'"
|
||||||
fi
|
fi
|
||||||
} }
|
} }
|
||||||
|
|
||||||
|
]
|
||||||
|
|
|
@ -5,6 +5,12 @@
|
||||||
# Needs the following tools in the path:
|
# Needs the following tools in the path:
|
||||||
# - jq for json deserializaton
|
# - jq for json deserializaton
|
||||||
|
|
||||||
|
hook -once global BufSetOption filetype=go %{
|
||||||
|
require-module go-tools
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module go-tools %{
|
||||||
|
|
||||||
evaluate-commands %sh{
|
evaluate-commands %sh{
|
||||||
for dep in gocode goimports gogetdoc jq; do
|
for dep in gocode goimports gogetdoc jq; do
|
||||||
if ! command -v $dep > /dev/null 2>&1; then
|
if ! command -v $dep > /dev/null 2>&1; then
|
||||||
|
@ -180,3 +186,5 @@ define-command go-share-selection -docstring "Share the selection using the Go P
|
||||||
snippet_id=$(printf %s\\n "${kak_selection}" | curl -s https://play.golang.org/share --data-binary @-)
|
snippet_id=$(printf %s\\n "${kak_selection}" | curl -s https://play.golang.org/share --data-binary @-)
|
||||||
printf "echo https://play.golang.org/p/%s" ${snippet_id}
|
printf "echo https://play.golang.org/p/%s" ${snippet_id}
|
||||||
} }
|
} }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
hook -once global BufSetOption filetype=python %{
|
||||||
|
require-module jedi
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module jedi %{
|
||||||
|
|
||||||
declare-option -hidden str jedi_tmp_dir
|
declare-option -hidden str jedi_tmp_dir
|
||||||
declare-option -hidden completions jedi_completions
|
declare-option -hidden completions jedi_completions
|
||||||
declare-option -docstring "colon separated list of path added to `python`'s $PYTHONPATH environment variable" \
|
declare-option -docstring "colon separated list of path added to `python`'s $PYTHONPATH environment variable" \
|
||||||
|
@ -17,7 +23,7 @@ define-command jedi-complete -docstring "Complete the current selection" %{
|
||||||
cd $(dirname ${kak_buffile})
|
cd $(dirname ${kak_buffile})
|
||||||
header="${kak_cursor_line}.${kak_cursor_column}@${kak_timestamp}"
|
header="${kak_cursor_line}.${kak_cursor_column}@${kak_timestamp}"
|
||||||
|
|
||||||
export PYTHONPATH="$kak_opt_jedi_python_path:$PYTHONPATH"
|
export PYTHONPATH="$kak_opt_jedi_python_path:$PYTHONPATH"
|
||||||
compl=$(python 2> "${dir}/fifo" <<-END
|
compl=$(python 2> "${dir}/fifo" <<-END
|
||||||
import jedi
|
import jedi
|
||||||
script=jedi.Script(open('$dir/buf', 'r').read(), $kak_cursor_line, $kak_cursor_column - 1, '$kak_buffile')
|
script=jedi.Script(open('$dir/buf', 'r').read(), $kak_cursor_line, $kak_cursor_column - 1, '$kak_buffile')
|
||||||
|
@ -45,3 +51,5 @@ define-command jedi-disable-autocomplete -docstring "Disable jedi completion" %{
|
||||||
remove-hooks window jedi-autocomplete
|
remove-hooks window jedi-autocomplete
|
||||||
unalias window complete jedi-complete
|
unalias window complete jedi-complete
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
hook -once global BufSetOption filetype=rust %{
|
||||||
|
require-module racer
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module racer %{
|
||||||
|
|
||||||
declare-option -hidden str racer_tmp_dir
|
declare-option -hidden str racer_tmp_dir
|
||||||
declare-option -hidden completions racer_completions
|
declare-option -hidden completions racer_completions
|
||||||
|
|
||||||
|
@ -152,3 +158,5 @@ define-command racer-show-doc -docstring "Show the documentation about the rust
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -5,13 +5,12 @@
|
||||||
## an iTerm session if not in a tmux session.
|
## an iTerm session if not in a tmux session.
|
||||||
hook global KakBegin .* %sh{
|
hook global KakBegin .* %sh{
|
||||||
if [ "$TERM_PROGRAM" = "iTerm.app" ] && [ -z "$TMUX" ]; then
|
if [ "$TERM_PROGRAM" = "iTerm.app" ] && [ -z "$TMUX" ]; then
|
||||||
echo "
|
echo "require-module iterm"
|
||||||
alias global focus iterm-focus
|
|
||||||
alias global terminal iterm-terminal-vertical
|
|
||||||
"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provide-module iterm %{
|
||||||
|
|
||||||
define-command -hidden -params 2.. iterm-terminal-split-impl %{
|
define-command -hidden -params 2.. iterm-terminal-split-impl %{
|
||||||
nop %sh{
|
nop %sh{
|
||||||
direction="$1"
|
direction="$1"
|
||||||
|
@ -129,3 +128,8 @@ If no client is passed then the current one is used' \
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alias global focus iterm-focus
|
||||||
|
alias global terminal iterm-terminal-vertical
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
declare-option -docstring %{window type that kitty creates on new and repl calls (kitty|os)} str kitty_window_type kitty
|
|
||||||
|
|
||||||
hook -group kitty-hooks global KakBegin .* %sh{
|
hook -group kitty-hooks global KakBegin .* %sh{
|
||||||
if [ "$TERM" = "xterm-kitty" ] && [ -z "$TMUX" ]; then
|
if [ "$TERM" = "xterm-kitty" ] && [ -z "$TMUX" ]; then
|
||||||
echo "
|
echo "require-module kitty"
|
||||||
alias global terminal kitty-terminal
|
|
||||||
alias global terminal-tab kitty-terminal-tab
|
|
||||||
alias global focus kitty-focus
|
|
||||||
alias global repl kitty-repl
|
|
||||||
alias global send-text kitty-send-text
|
|
||||||
"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provide-module kitty %{
|
||||||
|
|
||||||
|
declare-option -docstring %{window type that kitty creates on new and repl calls (kitty|os)} str kitty_window_type kitty
|
||||||
|
|
||||||
define-command kitty-terminal -params 1.. -shell-completion -docstring '
|
define-command kitty-terminal -params 1.. -shell-completion -docstring '
|
||||||
kitty-terminal <program> [<arguments>]: create a new terminal as a kitty window
|
kitty-terminal <program> [<arguments>]: create a new terminal as a kitty window
|
||||||
The program passed as argument will be executed in the new terminal' \
|
The program passed as argument will be executed in the new terminal' \
|
||||||
|
@ -63,3 +60,11 @@ define-command kitty-send-text -docstring "send the selected text to the repl wi
|
||||||
kitty @ send-text -m=title:kak_repl_window "${kak_selection}"
|
kitty @ send-text -m=title:kak_repl_window "${kak_selection}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alias global terminal kitty-terminal
|
||||||
|
alias global terminal-tab kitty-terminal-tab
|
||||||
|
alias global focus kitty-focus
|
||||||
|
alias global repl kitty-repl
|
||||||
|
alias global send-text kitty-send-text
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,28 +1,14 @@
|
||||||
# http://tmux.github.io/
|
# http://tmux.github.io/
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
declare-option -docstring "tmux pane id in which the REPL is running" str tmux_repl_id
|
hook global ModuleLoad tmux %{
|
||||||
|
require-module tmux-repl
|
||||||
hook global KakBegin .* %sh{
|
|
||||||
if [ -n "$TMUX" ]; then
|
|
||||||
VERSION_TMUX=$(tmux -V | cut -d' ' -f2)
|
|
||||||
VERSION_TMUX=${VERSION_TMUX%%.*}
|
|
||||||
|
|
||||||
if [ "${VERSION_TMUX}" = "master" ] \
|
|
||||||
|| [ "${VERSION_TMUX}" -ge 2 ]; then
|
|
||||||
echo "
|
|
||||||
alias global repl tmux-repl-horizontal
|
|
||||||
alias global send-text tmux-send-text
|
|
||||||
"
|
|
||||||
else
|
|
||||||
echo "
|
|
||||||
alias global repl tmux-repl-disabled
|
|
||||||
alias global send-text tmux-repl-disabled
|
|
||||||
"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provide-module tmux-repl %{
|
||||||
|
|
||||||
|
declare-option -docstring "tmux pane id in which the REPL is running" str tmux_repl_id
|
||||||
|
|
||||||
define-command -hidden -params 1..2 tmux-repl-impl %{
|
define-command -hidden -params 1..2 tmux-repl-impl %{
|
||||||
evaluate-commands %sh{
|
evaluate-commands %sh{
|
||||||
if [ -z "$TMUX" ]; then
|
if [ -z "$TMUX" ]; then
|
||||||
|
@ -52,7 +38,7 @@ define-command tmux-repl-window -params 0..1 -command-completion -docstring "Cre
|
||||||
define-command -hidden tmux-send-text -params 0..1 -docstring "tmux-send-text [text]: Send text(append new line) to the REPL pane.
|
define-command -hidden tmux-send-text -params 0..1 -docstring "tmux-send-text [text]: Send text(append new line) to the REPL pane.
|
||||||
If no text is passed, then the selection is used" %{
|
If no text is passed, then the selection is used" %{
|
||||||
nop %sh{
|
nop %sh{
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
tmux set-buffer -b kak_selection "${kak_selection}"
|
tmux set-buffer -b kak_selection "${kak_selection}"
|
||||||
else
|
else
|
||||||
tmux set-buffer -b kak_selection "$1"
|
tmux set-buffer -b kak_selection "$1"
|
||||||
|
@ -65,3 +51,23 @@ define-command -hidden tmux-repl-disabled %{ evaluate-commands %sh{
|
||||||
VERSION_TMUX=$(tmux -V)
|
VERSION_TMUX=$(tmux -V)
|
||||||
printf %s "echo -markup %{{Error}The version of tmux is too old: got ${VERSION_TMUX}, expected >= 2.x}"
|
printf %s "echo -markup %{{Error}The version of tmux is too old: got ${VERSION_TMUX}, expected >= 2.x}"
|
||||||
} }
|
} }
|
||||||
|
|
||||||
|
evaluate-commands %sh{
|
||||||
|
VERSION_TMUX=$(tmux -V | cut -d' ' -f2)
|
||||||
|
VERSION_TMUX=${VERSION_TMUX%%.*}
|
||||||
|
|
||||||
|
if [ "${VERSION_TMUX}" = "master" ] \
|
||||||
|
|| [ "${VERSION_TMUX}" -ge 2 ]; then
|
||||||
|
echo "
|
||||||
|
alias global repl tmux-repl-horizontal
|
||||||
|
alias global send-text tmux-send-text
|
||||||
|
"
|
||||||
|
else
|
||||||
|
echo "
|
||||||
|
alias global repl tmux-repl-disabled
|
||||||
|
alias global send-text tmux-repl-disabled
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
hook global ModuleLoad x11 %{
|
||||||
|
require-module x11-repl
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module x11-repl %{
|
||||||
|
|
||||||
# termcmd should already be set in x11.kak
|
# termcmd should already be set in x11.kak
|
||||||
define-command -docstring %{x11-repl [<arguments>]: create a new window for repl interaction
|
define-command -docstring %{x11-repl [<arguments>]: create a new window for repl interaction
|
||||||
All optional parameters are forwarded to the new window} \
|
All optional parameters are forwarded to the new window} \
|
||||||
|
@ -24,3 +30,5 @@ define-command x11-send-text -docstring "send the selected text to the repl wind
|
||||||
|
|
||||||
alias global repl x11-repl
|
alias global repl x11-repl
|
||||||
alias global send-text x11-send-text
|
alias global send-text x11-send-text
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -3,12 +3,11 @@
|
||||||
|
|
||||||
hook -group GNUscreen global KakBegin .* %sh{
|
hook -group GNUscreen global KakBegin .* %sh{
|
||||||
[ -z "${STY}" ] && exit
|
[ -z "${STY}" ] && exit
|
||||||
echo "
|
echo "require-module screen"
|
||||||
alias global focus screen-focus
|
|
||||||
alias global terminal screen-terminal-vertical
|
|
||||||
"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provide-module screen %{
|
||||||
|
|
||||||
define-command screen-terminal-impl -hidden -params 3.. %{
|
define-command screen-terminal-impl -hidden -params 3.. %{
|
||||||
nop %sh{
|
nop %sh{
|
||||||
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
|
tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
|
||||||
|
@ -67,3 +66,8 @@ If no client is passed then the current one is used' \
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alias global focus screen-focus
|
||||||
|
alias global terminal screen-terminal-vertical
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
# http://tmux.github.io/
|
# http://tmux.github.io/
|
||||||
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
|
||||||
|
|
||||||
## The default behaviour for the `new` command is to open an horizontal pane in a tmux session
|
|
||||||
hook global KakBegin .* %sh{
|
hook global KakBegin .* %sh{
|
||||||
if [ -n "$TMUX" ]; then
|
if [ -n "$TMUX" ]; then
|
||||||
echo "
|
echo "require-module tmux"
|
||||||
alias global focus tmux-focus
|
|
||||||
alias global terminal tmux-terminal-horizontal
|
|
||||||
"
|
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provide-module tmux %{
|
||||||
|
|
||||||
define-command -hidden -params 2.. tmux-terminal-impl %{
|
define-command -hidden -params 2.. tmux-terminal-impl %{
|
||||||
evaluate-commands %sh{
|
evaluate-commands %sh{
|
||||||
tmux=${kak_client_env_TMUX:-$TMUX}
|
tmux=${kak_client_env_TMUX:-$TMUX}
|
||||||
|
@ -59,3 +57,9 @@ If no client is passed then the current one is used' \
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## The default behaviour for the `new` command is to open an horizontal pane in a tmux session
|
||||||
|
alias global focus tmux-focus
|
||||||
|
alias global terminal tmux-terminal-horizontal
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
# x11
|
||||||
|
|
||||||
|
hook global KakBegin .* %sh{
|
||||||
|
if [ -n "$DISPLAY" ] && [ -z "$TMUX" ]; then
|
||||||
|
echo "require-module x11"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
provide-module x11 %{
|
||||||
|
|
||||||
# termcmd should be set such as the next argument is the whole
|
# termcmd should be set such as the next argument is the whole
|
||||||
# command line to execute
|
# command line to execute
|
||||||
declare-option -docstring %{shell command run to spawn a new terminal
|
declare-option -docstring %{shell command run to spawn a new terminal
|
||||||
|
@ -71,3 +81,5 @@ If no client is passed, then the current client is used' \
|
||||||
|
|
||||||
alias global focus x11-focus
|
alias global focus x11-focus
|
||||||
alias global terminal x11-terminal
|
alias global terminal x11-terminal
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -40,6 +40,36 @@ void CommandManager::register_command(String command_name,
|
||||||
std::move(completer) };
|
std::move(completer) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CommandManager::module_defined(StringView module_name) const
|
||||||
|
{
|
||||||
|
return m_modules.find(module_name) != m_modules.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommandManager::register_module(String module_name, String commands)
|
||||||
|
{
|
||||||
|
auto module = m_modules.find(module_name);
|
||||||
|
if (module != m_modules.end() and module->value.loaded)
|
||||||
|
throw runtime_error{format("module already loaded: '{}'", module_name)};
|
||||||
|
|
||||||
|
m_modules[module_name] = { false, std::move(commands) };
|
||||||
|
}
|
||||||
|
|
||||||
|
void CommandManager::load_module(StringView module_name, Context& context)
|
||||||
|
{
|
||||||
|
auto module = m_modules.find(module_name);
|
||||||
|
if (module == m_modules.end())
|
||||||
|
throw runtime_error{format("no such module: '{}'", module_name)};
|
||||||
|
if (module->value.loaded)
|
||||||
|
return;
|
||||||
|
|
||||||
|
module->value.loaded = true;
|
||||||
|
Context empty_context{Context::EmptyContextFlag{}};
|
||||||
|
execute(module->value.commands, empty_context);
|
||||||
|
module->value.commands.clear();
|
||||||
|
|
||||||
|
context.hooks().run_hook(Hook::ModuleLoad, module_name, context);
|
||||||
|
}
|
||||||
|
|
||||||
struct parse_error : runtime_error
|
struct parse_error : runtime_error
|
||||||
{
|
{
|
||||||
parse_error(StringView error)
|
parse_error(StringView error)
|
||||||
|
|
|
@ -123,6 +123,12 @@ public:
|
||||||
|
|
||||||
void clear_last_complete_command() { m_last_complete_command = String{}; }
|
void clear_last_complete_command() { m_last_complete_command = String{}; }
|
||||||
|
|
||||||
|
bool module_defined(StringView module_name) const;
|
||||||
|
|
||||||
|
void register_module(String module_name, String commands);
|
||||||
|
|
||||||
|
void load_module(StringView module_name, Context& context);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void execute_single_command(CommandParameters params,
|
void execute_single_command(CommandParameters params,
|
||||||
Context& context,
|
Context& context,
|
||||||
|
@ -143,6 +149,14 @@ private:
|
||||||
String m_last_complete_command;
|
String m_last_complete_command;
|
||||||
int m_command_depth = 0;
|
int m_command_depth = 0;
|
||||||
|
|
||||||
|
struct Module
|
||||||
|
{
|
||||||
|
bool loaded;
|
||||||
|
String commands;
|
||||||
|
};
|
||||||
|
using ModuleMap = HashMap<String, Module, MemoryDomain::Commands>;
|
||||||
|
ModuleMap m_modules;
|
||||||
|
|
||||||
CommandMap::const_iterator find_command(const Context& context,
|
CommandMap::const_iterator find_command(const Context& context,
|
||||||
StringView name) const;
|
StringView name) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -2403,6 +2403,46 @@ const CommandDesc enter_user_mode_cmd = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const CommandDesc provide_module_cmd = {
|
||||||
|
"provide-module",
|
||||||
|
nullptr,
|
||||||
|
"provide-module [<switches>] <name> <cmds>: declares a module <name> provided by <cmds>",
|
||||||
|
ParameterDesc{
|
||||||
|
{ { "override", { false, "allow overriding an existing module" } } },
|
||||||
|
ParameterDesc::Flags::None,
|
||||||
|
2, 2
|
||||||
|
},
|
||||||
|
CommandFlags::None,
|
||||||
|
CommandHelper{},
|
||||||
|
CommandCompleter{},
|
||||||
|
[](const ParametersParser& parser, Context& context, const ShellContext&)
|
||||||
|
{
|
||||||
|
const String& module_name = parser[0];
|
||||||
|
auto& cm = CommandManager::instance();
|
||||||
|
|
||||||
|
if (not all_of(module_name, is_identifier))
|
||||||
|
throw runtime_error(format("invalid module name: '{}'", module_name));
|
||||||
|
|
||||||
|
if (cm.module_defined(module_name) and not parser.get_switch("override"))
|
||||||
|
throw runtime_error(format("module '{}' already defined", module_name));
|
||||||
|
cm.register_module(module_name, parser[1]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const CommandDesc require_module_cmd = {
|
||||||
|
"require-module",
|
||||||
|
nullptr,
|
||||||
|
"require-module <name>: ensures that <name> module has been loaded",
|
||||||
|
ParameterDesc{ {}, ParameterDesc::Flags::None, 1, 1 },
|
||||||
|
CommandFlags::None,
|
||||||
|
CommandHelper{},
|
||||||
|
CommandCompleter{},
|
||||||
|
[](const ParametersParser& parser, Context& context, const ShellContext&)
|
||||||
|
{
|
||||||
|
CommandManager::instance().load_module(parser[0], context);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void register_commands()
|
void register_commands()
|
||||||
|
@ -2468,6 +2508,8 @@ void register_commands()
|
||||||
register_command(fail_cmd);
|
register_command(fail_cmd);
|
||||||
register_command(declare_user_mode_cmd);
|
register_command(declare_user_mode_cmd);
|
||||||
register_command(enter_user_mode_cmd);
|
register_command(enter_user_mode_cmd);
|
||||||
|
register_command(provide_module_cmd);
|
||||||
|
register_command(require_module_cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,12 +56,13 @@ enum class Hook
|
||||||
WinCreate,
|
WinCreate,
|
||||||
WinDisplay,
|
WinDisplay,
|
||||||
WinResize,
|
WinResize,
|
||||||
WinSetOption
|
WinSetOption,
|
||||||
|
ModuleLoad
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr auto enum_desc(Meta::Type<Hook>)
|
constexpr auto enum_desc(Meta::Type<Hook>)
|
||||||
{
|
{
|
||||||
return make_array<EnumDesc<Hook>, 40>({
|
return make_array<EnumDesc<Hook>, 41>({
|
||||||
{Hook::BufCreate, "BufCreate"},
|
{Hook::BufCreate, "BufCreate"},
|
||||||
{Hook::BufNewFile, "BufNewFile"},
|
{Hook::BufNewFile, "BufNewFile"},
|
||||||
{Hook::BufOpenFile, "BufOpenFile"},
|
{Hook::BufOpenFile, "BufOpenFile"},
|
||||||
|
@ -102,6 +103,7 @@ constexpr auto enum_desc(Meta::Type<Hook>)
|
||||||
{Hook::WinDisplay, "WinDisplay"},
|
{Hook::WinDisplay, "WinDisplay"},
|
||||||
{Hook::WinResize, "WinResize"},
|
{Hook::WinResize, "WinResize"},
|
||||||
{Hook::WinSetOption, "WinSetOption"},
|
{Hook::WinSetOption, "WinSetOption"},
|
||||||
|
{Hook::ModuleLoad, "ModuleLoad"}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user