From 1fab727f2be4be4e4b6e85887c283daf86aef722 Mon Sep 17 00:00:00 2001 From: Justin Frank Date: Tue, 12 Mar 2019 22:24:33 -0700 Subject: [PATCH] Modified a bunch of language support files to use modules --- rc/filetype/asciidoc.kak | 8 ++++++++ rc/filetype/c-family.kak | 9 +++++++++ rc/filetype/clojure.kak | 8 ++++++++ rc/filetype/css.kak | 8 ++++++++ rc/filetype/d.kak | 8 ++++++++ rc/filetype/dart.kak | 9 +++++++++ rc/filetype/dockerfile.kak | 8 ++++++++ rc/filetype/go.kak | 8 ++++++++ rc/filetype/html.kak | 13 +++++++++++++ rc/filetype/javascript.kak | 8 ++++++++ rc/filetype/json.kak | 8 ++++++++ rc/filetype/kakrc.kak | 12 +++++++++++- rc/filetype/lisp.kak | 8 ++++++++ rc/filetype/makefile.kak | 8 ++++++++ rc/filetype/markdown.kak | 8 ++++++++ rc/filetype/nim.kak | 8 ++++++++ rc/filetype/ocaml.kak | 10 +++++++++- rc/filetype/perl.kak | 8 ++++++++ rc/filetype/pony.kak | 8 ++++++++ rc/filetype/protobuf.kak | 8 ++++++++ rc/filetype/python.kak | 8 ++++++++ rc/filetype/restructuredtext.kak | 8 ++++++++ rc/filetype/ruby.kak | 8 ++++++++ rc/filetype/scheme.kak | 14 +++++++++++--- rc/filetype/sh.kak | 8 ++++++++ rc/filetype/sql.kak | 8 ++++++++ rc/tools/clang.kak | 8 ++++++++ rc/tools/go/go-tools.kak | 8 ++++++++ 28 files changed, 238 insertions(+), 5 deletions(-) diff --git a/rc/filetype/asciidoc.kak b/rc/filetype/asciidoc.kak index 8bdcce07e..21607da0b 100644 --- a/rc/filetype/asciidoc.kak +++ b/rc/filetype/asciidoc.kak @@ -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 } } + +} diff --git a/rc/filetype/c-family.kak b/rc/filetype/c-family.kak index fbfa702af..68c2a387a 100644 --- a/rc/filetype/c-family.kak +++ b/rc/filetype/c-family.kak @@ -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 1s^(\h+)$ 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 } + +🦀 diff --git a/rc/filetype/clojure.kak b/rc/filetype/clojure.kak index da6134a65..d19708af8 100644 --- a/rc/filetype/clojure.kak +++ b/rc/filetype/clojure.kak @@ -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-.+ } ] + +} diff --git a/rc/filetype/css.kak b/rc/filetype/css.kak index ecc456ed1..8c5def9c3 100644 --- a/rc/filetype/css.kak +++ b/rc/filetype/css.kak @@ -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-.+ } ] + +] diff --git a/rc/filetype/d.kak b/rc/filetype/d.kak index f0f082489..b042f4f93 100644 --- a/rc/filetype/d.kak +++ b/rc/filetype/d.kak @@ -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-.+ } } + +🦀 diff --git a/rc/filetype/dart.kak b/rc/filetype/dart.kak index 5b5600cb4..497014290 100644 --- a/rc/filetype/dart.kak +++ b/rc/filetype/dart.kak @@ -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 }}} +} diff --git a/rc/filetype/dockerfile.kak b/rc/filetype/dockerfile.kak index 07da23475..b76716e26 100644 --- a/rc/filetype/dockerfile.kak +++ b/rc/filetype/dockerfile.kak @@ -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 } } + +} diff --git a/rc/filetype/go.kak b/rc/filetype/go.kak index 8aebe657f..2df0ba9da 100644 --- a/rc/filetype/go.kak +++ b/rc/filetype/go.kak @@ -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-.+ } } + +🦀 diff --git a/rc/filetype/html.kak b/rc/filetype/html.kak index 5f76721da..81db5c9b2 100644 --- a/rc/filetype/html.kak +++ b/rc/filetype/html.kak @@ -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}-.+"" " } + +] diff --git a/rc/filetype/javascript.kak b/rc/filetype/javascript.kak index 4d16ee68a..7dc2034da 100644 --- a/rc/filetype/javascript.kak +++ b/rc/filetype/javascript.kak @@ -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 + +🦀 diff --git a/rc/filetype/json.kak b/rc/filetype/json.kak index ae04c55ac..d863d5963 100644 --- a/rc/filetype/json.kak +++ b/rc/filetype/json.kak @@ -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-.+ } } + +) diff --git a/rc/filetype/kakrc.kak b/rc/filetype/kakrc.kak index 7a9af9894..1b270b80b 100644 --- a/rc/filetype/kakrc.kak +++ b/rc/filetype/kakrc.kak @@ -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-.+ } ~ + +🦀 diff --git a/rc/filetype/lisp.kak b/rc/filetype/lisp.kak index 378bb3c52..39f946e7d 100644 --- a/rc/filetype/lisp.kak +++ b/rc/filetype/lisp.kak @@ -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-.+ } } + +} diff --git a/rc/filetype/makefile.kak b/rc/filetype/makefile.kak index 569d51f97..c6f13dfd2 100644 --- a/rc/filetype/makefile.kak +++ b/rc/filetype/makefile.kak @@ -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-.+ } } + +} diff --git a/rc/filetype/markdown.kak b/rc/filetype/markdown.kak index 18f3ccf6f..be1932697 100644 --- a/rc/filetype/markdown.kak +++ b/rc/filetype/markdown.kak @@ -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-.+ } } + +} diff --git a/rc/filetype/nim.kak b/rc/filetype/nim.kak index 901ce68a9..0bdd8ef6d 100644 --- a/rc/filetype/nim.kak +++ b/rc/filetype/nim.kak @@ -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-.+ } } + +} diff --git a/rc/filetype/ocaml.kak b/rc/filetype/ocaml.kak index 0a3d49bf5..8b8c771cf 100644 --- a/rc/filetype/ocaml.kak +++ b/rc/filetype/ocaml.kak @@ -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{ } " } + +} diff --git a/rc/filetype/perl.kak b/rc/filetype/perl.kak index e69058d3c..342eb3b28 100644 --- a/rc/filetype/perl.kak +++ b/rc/filetype/perl.kak @@ -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-.+ } } + +🦀 diff --git a/rc/filetype/pony.kak b/rc/filetype/pony.kak index 713cc2951..8aaa0233d 100644 --- a/rc/filetype/pony.kak +++ b/rc/filetype/pony.kak @@ -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-.+ } } + +} diff --git a/rc/filetype/protobuf.kak b/rc/filetype/protobuf.kak index 2ef10480f..4924cb05d 100644 --- a/rc/filetype/protobuf.kak +++ b/rc/filetype/protobuf.kak @@ -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-.+ } ] + +] diff --git a/rc/filetype/python.kak b/rc/filetype/python.kak index 9084dd1cb..82fe99718 100644 --- a/rc/filetype/python.kak +++ b/rc/filetype/python.kak @@ -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 \; s ^\h+$ d } } hook -once -always window WinSetOption filetype=.* %{ remove-hooks window python-.+ } } + +} diff --git a/rc/filetype/restructuredtext.kak b/rc/filetype/restructuredtext.kak index 1eaf4bfc9..362c98067 100644 --- a/rc/filetype/restructuredtext.kak +++ b/rc/filetype/restructuredtext.kak @@ -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 } } + +} diff --git a/rc/filetype/ruby.kak b/rc/filetype/ruby.kak index 3e5cfcfa5..d9bdcfe6c 100644 --- a/rc/filetype/ruby.kak +++ b/rc/filetype/ruby.kak @@ -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 } } + +] diff --git a/rc/filetype/scheme.kak b/rc/filetype/scheme.kak index ec86638b9..20d2f35f8 100644 --- a/rc/filetype/scheme.kak +++ b/rc/filetype/scheme.kak @@ -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-.+ } } + +} diff --git a/rc/filetype/sh.kak b/rc/filetype/sh.kak index acd629935..b74685206 100644 --- a/rc/filetype/sh.kak +++ b/rc/filetype/sh.kak @@ -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 %{(? /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} } } + +}