1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-23 07:15:52 +03:00

Modified a bunch of language support files to use modules

This commit is contained in:
Justin Frank 2019-03-12 22:24:33 -07:00
parent 6092852640
commit 1fab727f2b
28 changed files with 238 additions and 5 deletions

View File

@ -8,6 +8,12 @@ hook global BufCreate .+\.(a(scii)?doc|asc) %{
set-option buffer filetype asciidoc
}
hook -once global BufSetOption filetype=asciidoc %{
require-module asciidoc
}
provide-module asciidoc %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -41,3 +47,5 @@ hook -group asciidoc-highlight global WinSetOption filetype=asciidoc %{
add-highlighter window/asciidoc ref asciidoc
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/asciidoc }
}
}

View File

@ -23,6 +23,13 @@ hook global BufCreate .*\.m %{
set-option buffer filetype objc
}
hook -once global BufSetOption filetype=(c|cpp|objc) %{
require-module c-family
}
provide-module c-family %🦀
define-command -hidden c-family-trim-indent %{
# remove the line if it's empty when leaving the insert mode
try %{ execute-keys -draft <a-x> 1s^(\h+)$<ret> d }
@ -441,3 +448,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)" %{
c-family-alternative-file
}
🦀

View File

@ -10,6 +10,12 @@ hook global BufCreate .*[.](clj|cljc|cljs|cljx|edn) %{
set-option buffer filetype clojure
}
hook -once global BufSetOption filetype=clojure %{
require-module clojure
}
provide-module clojure %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -206,3 +212,5 @@ hook global WinSetOption filetype=clojure %[
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window clojure-.+ }
]
}

View File

@ -8,6 +8,12 @@ hook global BufCreate .*[.](css) %{
set-option buffer filetype css
}
hook -once global BufSetOption filetype=css %{
require-module css
}
provide-module css %[
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -74,3 +80,5 @@ hook global WinSetOption filetype=css %[
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window css-.+ }
]
]

View File

@ -8,6 +8,12 @@ hook global BufCreate .*\.di? %{
set-option buffer filetype d
}
hook -once global BufSetOption filetype=d %{
require-module d
}
provide-module d %🦀
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -130,3 +136,5 @@ hook global WinSetOption filetype=d %{
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window d-.+ }
}
🦀

View File

@ -8,6 +8,12 @@ hook global BufCreate .*\.dart %{
set-option buffer filetype dart
}
hook -once global BufSetOption filetype=dart %{
require-module dart
}
provide-module dart %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -104,3 +110,6 @@ hook global WinSetOption filetype=dart %{
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window dart-.+ }
}
# balancing }}}
}

View File

@ -10,6 +10,12 @@ hook global BufCreate .*/?Dockerfile(\.\w+)?$ %{
set-option buffer filetype dockerfile
}
hook -once global BufSetOption filetype=dockerfile %{
require-module dockerfile
}
provide-module dockerfile %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -46,3 +52,5 @@ hook -group dockerfile-highlight global WinSetOption filetype=dockerfile %{
add-highlighter window/dockerfile ref dockerfile
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/dockerfile }
}
}

View File

@ -8,6 +8,12 @@ hook global BufCreate .*\.go %{
set-option buffer filetype go
}
hook -once global BufSetOption filetype=go %{
require-module go
}
provide-module go %🦀
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -95,3 +101,5 @@ hook global WinSetOption filetype=go %{
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window go-.+ }
}
🦀

View File

@ -12,6 +12,17 @@ hook global BufCreate .*\.xml %{
set-option buffer filetype xml
}
hook -once global BufSetOption filetype=(html|xml) %{
require-module html
}
provide-module html %[
try %{
require-module css
require-module javascript
}
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -73,3 +84,5 @@ hook global WinSetOption filetype=(html|xml) %{
remove-hooks window ""%val{hook_param_capture_1}-.+""
"
}
]

View File

@ -9,6 +9,12 @@ hook global BufCreate .*[.](ts)x? %{
set-option buffer filetype typescript
}
hook -once global BufSetOption filetype=(java|type)script %{
require-module javascript
}
provide-module javascript %🦀
# Commands
# ‾‾‾‾‾‾‾‾
@ -115,3 +121,5 @@ add-highlighter shared/typescript/code/ regex \b(array|boolean|date|number|objec
# 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
🦀

View File

@ -8,6 +8,12 @@ hook global BufCreate .*[.](json) %{
set-option buffer filetype json
}
hook -once global BufSetOption filetype=json %{
require-module json
}
provide-module json %(
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -58,3 +64,5 @@ hook global WinSetOption filetype=json %{
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window json-.+ }
}
)

View File

@ -8,6 +8,14 @@ hook global BufCreate (.*/)?(kakrc|.*.kak) %{
set-option buffer filetype kak
}
hook -once global BufSetOption filetype=kak %{
require-module kak
}
provide-module kak %🦀
require-module sh
# Highlighters & Completion
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
@ -33,7 +41,7 @@ evaluate-commands %sh{
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
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
normal insert menu prompt goto view user object
number-lines show-matching show-whitespaces fill regex dynregex group flag-lines
@ -108,3 +116,5 @@ hook global WinSetOption filetype=kak %~
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window kak-.+ }
~
🦀

View File

@ -8,6 +8,12 @@ hook global BufCreate .*[.](lisp) %{
set-option buffer filetype lisp
}
hook -once global BufSetOption filetype=lisp %{
require-module lisp
}
provide-module lisp %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -72,3 +78,5 @@ hook global WinSetOption filetype=lisp %{
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window lisp-.+ }
}
}

View File

@ -5,6 +5,12 @@ hook global BufCreate .*(/?[mM]akefile|\.mk) %{
set-option buffer filetype makefile
}
hook -once global BufSetOption filetype=makefile %{
require-module makefile
}
provide-module makefile %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -58,3 +64,5 @@ 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-.+ }
}
}

View File

@ -8,6 +8,12 @@ hook global BufCreate .*[.](markdown|md|mkd) %{
set-option buffer filetype markdown
}
hook -once global BufSetOption filetype=markdown %{
require-module markdown
}
provide-module markdown %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -83,3 +89,5 @@ 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-.+ }
}
}

View File

@ -8,6 +8,12 @@ hook global BufCreate .*\.nim(s|ble)? %{
set-option buffer filetype nim
}
hook -once global BufSetOption filetype=nim %{
require-module nim
}
provide-module nim %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -110,3 +116,5 @@ hook global WinSetOption filetype=nim %{
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window nim-.+ }
}
}

View File

@ -5,9 +5,15 @@
# ‾‾‾‾‾‾‾‾‾
hook global BufCreate .*\.mli? %{
set-option buffer filetype ocaml
set-option buffer filetype ocaml
}
hook -once global BufSetOption filetype=ocaml %{
require-module ocaml
}
provide-module ocaml %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -36,3 +42,5 @@ evaluate-commands %sh{
}
"
}
}

View File

@ -8,6 +8,12 @@ hook global BufCreate .*\.(t|p[lm])$ %{
set-option buffer filetype perl
}
hook -once global BufSetOption filetype=perl %{
require-module perl
}
provide-module perl %🦀
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -112,3 +118,5 @@ hook global WinSetOption filetype=perl %{
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window perl-.+ }
}
🦀

View File

@ -8,6 +8,12 @@ hook global BufCreate .*[.](pony) %{
set-option buffer filetype pony
}
hook -once global BufSetOption filetype=pony %{
require-module pony
}
provide-module pony %{
# Highlighters & Completion
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
@ -90,3 +96,5 @@ hook global WinSetOption filetype=pony %{
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window pony-.+ }
}
}

View File

@ -7,6 +7,12 @@ hook global BufCreate .*\.proto$ %{
set-option buffer filetype protobuf
}
hook -once global BufSetOption filetype=protobuf %{
require-module protobuf
}
provide-module protobuf %[
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -83,3 +89,5 @@ hook global WinSetOption filetype=protobuf %[
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window protobuf-.+ }
]
]

View File

@ -8,6 +8,12 @@ hook global BufCreate .*[.](py) %{
set-option buffer filetype python
}
hook -once global BufSetOption filetype=python %{
require-module python
}
provide-module python %{
# Highlighters & Completion
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
@ -146,3 +152,5 @@ hook global WinSetOption filetype=python %{
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-.+ }
}
}

View File

@ -5,6 +5,12 @@ hook global BufCreate .*[.](rst) %{
set-option buffer filetype restructuredtext
}
hook -once global BufSetOption filetype=restructuredtext %{
require-module restructuredtext
}
provide-module restructuredtext %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -72,3 +78,5 @@ hook -group restructuredtext-highlight global WinSetOption filetype=restructured
add-highlighter window/restructuredtext ref restructuredtext
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/restructuredtext }
}
}

View File

@ -8,6 +8,12 @@ hook global BufCreate .*(([.](rb))|(irbrc)|(pryrc)|(Brewfile)|(Capfile|[.]cap)|(
set-option buffer filetype ruby
}
hook -once global BufSetOption filetype=ruby %{
require-module ruby
}
provide-module ruby %[
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -166,3 +172,5 @@ hook global WinSetOption filetype=ruby %{
unalias window alt ruby-alternative-file
}
}
]

View File

@ -1,8 +1,6 @@
# http://www.scheme-reports.org
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
# require lisp.kak
# Detection
# ‾‾‾‾‾‾‾‾‾
@ -10,6 +8,14 @@ hook global BufCreate (.*/)?(.*\.(scm|ss|sld)) %{
set-option buffer filetype scheme
}
hook -once global BufSetOption filetype=scheme %{
require-module scheme
}
provide-module scheme %{
require-module lisp
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -100,7 +106,7 @@ evaluate-commands %sh{ exec awk -f - <<'EOF'
BEGIN {
printf("hook global WinSetOption filetype=scheme %%{ set-option window 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")
add_word_highlighter(keywords, "keyword");
@ -131,3 +137,5 @@ hook global WinSetOption filetype=scheme %{
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window scheme-.+ }
}
}

View File

@ -2,6 +2,12 @@ hook global BufCreate .*\.(z|ba|c|k|mk)?sh(rc|_profile)? %{
set-option buffer filetype sh
}
hook -once global BufSetOption filetype=sh %{
require-module sh
}
provide-module sh %[
add-highlighter shared/sh regions
add-highlighter shared/sh/code default-region group
add-highlighter shared/sh/double_string region %{(?<!\\)(?:\\\\)*\K"} %{(?<!\\)(?:\\\\)*"} group
@ -42,3 +48,5 @@ hook -group sh-highlight global WinSetOption filetype=sh %{
add-highlighter window/sh ref sh
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/sh }
}
]

View File

@ -8,6 +8,12 @@ hook global BufCreate .*/?(?i)sql %{
set-option buffer filetype sql
}
hook -once global BufSetOption filetype=sql %{
require-module sql
}
provide-module sql %{
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
@ -105,3 +111,5 @@ hook -group sql-highlight global WinSetOption filetype=sql %{
add-highlighter window/sql ref sql
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/sql }
}
}

View File

@ -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" \
str clang_options
@ -178,3 +184,5 @@ define-command clang-diagnostics-next -docstring "Jump to the next line that con
echo "echo -markup '{Error}no next clang diagnostic'"
fi
} }
]

View File

@ -5,6 +5,12 @@
# Needs the following tools in the path:
# - jq for json deserializaton
hook -once global BufSetOption filetype=go %{
require-module go-tools
}
provide-module go-tools %{
evaluate-commands %sh{
for dep in gocode goimports gogetdoc jq; do
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 @-)
printf "echo https://play.golang.org/p/%s" ${snippet_id}
} }
}