summaryrefslogtreecommitdiff
path: root/rc/base
diff options
context:
space:
mode:
authorAlex Leferry 2 <alexherbo2@gmail.com>2019-03-18 19:56:34 +0100
committerAlex Leferry 2 <alexherbo2@gmail.com>2019-03-21 01:06:16 +0100
commitc0dccdd90dd615cf663d95fd94fbdbdf2a88b165 (patch)
treecb48fb1b7fb74e6e3b98a62f6e2768686bb75c98 /rc/base
parentf87e844244d5ee81e9c1ceb04c354726002ae760 (diff)
Add categories in rc/
Closes #2783
Diffstat (limited to 'rc/base')
-rw-r--r--rc/base/autowrap.kak48
-rw-r--r--rc/base/clojure.kak208
-rw-r--r--rc/base/css.kak76
-rw-r--r--rc/base/ctags.kak123
-rw-r--r--rc/base/d.kak132
-rw-r--r--rc/base/etc.kak79
-rw-r--r--rc/base/file.kak17
-rw-r--r--rc/base/fish.kak84
-rw-r--r--rc/base/gas.kak91
-rw-r--r--rc/base/git.kak40
-rw-r--r--rc/base/go.kak97
-rw-r--r--rc/base/haskell.kak105
-rw-r--r--rc/base/html.kak75
-rw-r--r--rc/base/ini.kak15
-rw-r--r--rc/base/java.kak65
-rw-r--r--rc/base/javascript.kak117
-rw-r--r--rc/base/json.kak60
-rw-r--r--rc/base/julia.kak30
-rw-r--r--rc/base/lint.kak176
-rw-r--r--rc/base/lisp.kak74
-rw-r--r--rc/base/lua.kak103
-rw-r--r--rc/base/mail.kak13
-rw-r--r--rc/base/markdown.kak85
-rw-r--r--rc/base/mercurial.kak18
-rw-r--r--rc/base/new-client.kak12
-rw-r--r--rc/base/ocaml.kak38
-rw-r--r--rc/base/perl.kak114
-rw-r--r--rc/base/restructuredtext.kak74
-rw-r--r--rc/base/ruby.kak168
-rw-r--r--rc/base/rust.kak88
-rw-r--r--rc/base/scala.kak75
-rw-r--r--rc/base/screen.kak69
-rw-r--r--rc/base/spell.kak121
-rw-r--r--rc/base/sql.kak107
-rw-r--r--rc/base/swift.kak28
-rw-r--r--rc/base/tmux.kak61
-rw-r--r--rc/base/x11.kak73
-rw-r--r--rc/base/yaml.kak58
38 files changed, 0 insertions, 3017 deletions
diff --git a/rc/base/autowrap.kak b/rc/base/autowrap.kak
deleted file mode 100644
index 0fb12123..00000000
--- a/rc/base/autowrap.kak
+++ /dev/null
@@ -1,48 +0,0 @@
-declare-option -docstring "maximum amount of characters per line, after which a newline character will be inserted" \
- int autowrap_column 80
-
-declare-option -docstring %{when enabled, paragraph formatting will reformat the whole paragraph in which characters are being inserted
-This can potentially break formatting of documents containing markup (e.g. markdown)} \
- bool autowrap_format_paragraph no
-declare-option -docstring %{command to which the paragraphs to wrap will be passed
-all occurences of '%c' are replaced with `autowrap_column`} \
- str autowrap_fmtcmd 'fold -s -w %c'
-
-define-command -hidden autowrap-cursor %{ evaluate-commands -save-regs '/"|^@m' %{
- try %{
- ## if the line isn't too long, do nothing
- execute-keys -draft "<a-x><a-k>^[^\n]{%opt{autowrap_column},}[^\n]<ret>"
-
- try %{
- reg m "%val{selections_desc}"
-
- ## if we're adding characters past the limit, just wrap them around
- execute-keys -draft "<a-h><a-k>.{%opt{autowrap_column}}\h*[^\s]*<ret>1s(\h+)[^\h]*\z<ret>c<ret>"
- } catch %{
- ## if we're adding characters in the middle of a sentence, use
- ## the `fmtcmd` command to wrap the entire paragraph
- evaluate-commands %sh{
- if [ "${kak_opt_autowrap_format_paragraph}" = true ] \
- && [ -n "${kak_opt_autowrap_fmtcmd}" ]; then
- format_cmd=$(printf %s "${kak_opt_autowrap_fmtcmd}" \
- | sed "s/%c/${kak_opt_autowrap_column}/g")
- printf %s "
- evaluate-commands -draft %{
- execute-keys '<a-]>p<a-x><a-j>|${format_cmd}<ret>'
- try %{ execute-keys s\h+$<ret> d }
- }
- select '${kak_main_reg_m}'
- "
- fi
- }
- }
- }
-} }
-
-define-command autowrap-enable -docstring "Automatically wrap the lines in which characters are inserted" %{
- hook -group autowrap window InsertChar [^\n] autowrap-cursor
-}
-
-define-command autowrap-disable -docstring "Disable automatic line wrapping" %{
- remove-hooks window autowrap
-}
diff --git a/rc/base/clojure.kak b/rc/base/clojure.kak
deleted file mode 100644
index da6134a6..00000000
--- a/rc/base/clojure.kak
+++ /dev/null
@@ -1,208 +0,0 @@
-# http://clojure.org
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# require lisp.kak
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*[.](clj|cljc|cljs|cljx|edn) %{
- set-option buffer filetype clojure
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/clojure regions
-add-highlighter shared/clojure/code default-region group
-add-highlighter shared/clojure/comment region '(?<!\\)(?:\\\\)*\K;' '$' fill comment
-add-highlighter shared/clojure/shebang region '(?<!\\)(?:\\\\)*\K#!' '$' fill comment
-add-highlighter shared/clojure/string region '(?<!\\)(?:\\\\)*\K"' '(?<!\\)(?:\\\\)*"' fill string
-
-add-highlighter shared/clojure/code/ regex \b(nil|true|false)\b 0:value
-add-highlighter shared/clojure/code/ regex \
- \\(?:space|tab|newline|return|backspace|formfeed|u[0-9a-fA-F]{4}|o[0-3]?[0-7]{1,2}|.)\b 0:string
-
-hook global WinSetOption filetype=clojure %{
- set-option window extra_word_chars '_' . / * ? + - < > ! : "'"
-}
-
-evaluate-commands %sh{
- exec awk -f - <<'EOF'
- BEGIN{
- symbol_char="[^\\s()\\[\\]{}\"\\;@^`~\\\\%/]";
- in_core="(clojure\\.core/|(?<!/))";
- split( \
- "case cond condp cond-> cond->> def definline definterface defmacro defmethod "\
- "defmulti defn defn- defonce defprotocol defrecord defstruct deftype fn if "\
- "if-let if-not if-some let letfn new ns when when-first when-let when-not "\
- "when-some . ..", keywords);
-
- split( \
- "* *' + +' - -' -> ->> ->ArrayChunk ->Eduction ->Vec ->VecNode ->VecSeq / < "\
- "<= = == > >= StackTraceElement->vec Throwable->map accessor aclone "\
- "add-classpath add-watch agent agent-error agent-errors aget alength alias "\
- "all-ns alter alter-meta! alter-var-root amap ancestors and any? apply "\
- "areduce array-map as-> aset aset-boolean aset-byte aset-char aset-double "\
- "aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in "\
- "associative? atom await await-for bases bean bigdec bigint biginteger "\
- "binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set "\
- "bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array "\
- "boolean? booleans bound-fn bound-fn* bound? bounded-count butlast byte "\
- "byte-array bytes bytes? cast cat catch char char-array char-escape-string "\
- "char-name-string char? chars class class? clear-agent-errors "\
- "clojure-version coll? comment commute comp comparator compare "\
- "compare-and-set! compile complement completing concat conj conj! cons "\
- "constantly construct-proxy contains? count counted? create-ns "\
- "create-struct cycle dec dec' decimal? declare dedupe default-data-readers "\
- "delay delay? deliver denominator deref derive descendants disj disj! "\
- "dissoc dissoc! distinct distinct? do doall dorun doseq dosync dotimes doto "\
- "double double-array double? doubles drop drop-last drop-while eduction "\
- "empty empty? ensure ensure-reduced enumeration-seq error-handler "\
- "error-mode eval even? every-pred every? ex-data ex-info extend "\
- "extend-protocol extend-type extenders extends? false? ffirst file-seq "\
- "filter filterv finally find find-keyword find-ns find-var first flatten "\
- "float float-array float? floats flush fn? fnext fnil for force format "\
- "frequencies future future-call future-cancel future-cancelled? "\
- "future-done? future? gen-class gen-interface gensym get get-in get-method "\
- "get-proxy-class get-thread-bindings get-validator group-by halt-when hash "\
- "hash-map hash-ordered-coll hash-set hash-unordered-coll ident? identical? "\
- "identity ifn? import in-ns inc inc' indexed? init-proxy inst-ms inst? "\
- "instance? int int-array int? integer? interleave intern interpose into "\
- "into-array ints io! isa? iterate iterator-seq juxt keep keep-indexed key "\
- "keys keyword keyword? last lazy-cat lazy-seq line-seq list list* list? "\
- "load load-file load-reader load-string loaded-libs locking long long-array "\
- "longs loop macroexpand macroexpand-1 make-array make-hierarchy map "\
- "map-entry? map-indexed map? mapcat mapv max max-key memfn memoize merge "\
- "merge-with meta methods min min-key mix-collection-hash mod monitor-enter "\
- "monitor-exit name namespace namespace-munge nat-int? neg-int? neg? newline "\
- "next nfirst nil? nnext not not-any? not-empty not-every? not= ns-aliases "\
- "ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve "\
- "ns-unalias ns-unmap nth nthnext nthrest num number? numerator object-array "\
- "odd? or parents partial partition partition-all partition-by pcalls peek "\
- "persistent! pmap pop pop! pop-thread-bindings pos-int? pos? pr pr-str "\
- "prefer-method prefers print print-str printf println println-str prn "\
- "prn-str promise proxy proxy-mappings proxy-super push-thread-bindings "\
- "pvalues qualified-ident? qualified-keyword? qualified-symbol? quot quote "\
- "rand rand-int rand-nth random-sample range ratio? rational? rationalize "\
- "re-find re-groups re-matcher re-matches re-pattern re-seq read read-line "\
- "read-string reader-conditional reader-conditional? realized? record? recur "\
- "reduce reduce-kv reduced reduced? reductions ref ref-history-count "\
- "ref-max-history ref-min-history ref-set refer refer-clojure reify "\
- "release-pending-sends rem remove remove-all-methods remove-method "\
- "remove-ns remove-watch repeat repeatedly replace replicate require reset! "\
- "reset-meta! reset-vals! resolve rest restart-agent resultset-seq reverse "\
- "reversible? rseq rsubseq run! satisfies? second select-keys send send-off "\
- "send-via seq seq? seqable? seque sequence sequential? set set! "\
- "set-agent-send-executor! set-agent-send-off-executor! set-error-handler! "\
- "set-error-mode! set-validator! set? short short-array shorts shuffle "\
- "shutdown-agents simple-ident? simple-keyword? simple-symbol? slurp some "\
- "some-> some->> some-fn some? sort sort-by sorted-map sorted-map-by "\
- "sorted-set sorted-set-by sorted? special-symbol? spit split-at split-with "\
- "str string? struct struct-map subs subseq subvec supers swap! swap-vals! "\
- "symbol symbol? sync tagged-literal tagged-literal? take take-last take-nth "\
- "take-while test the-ns thread-bound? throw time to-array to-array-2d "\
- "trampoline transduce transient tree-seq true? try type unchecked-add "\
- "unchecked-add-int unchecked-byte unchecked-char unchecked-dec "\
- "unchecked-dec-int unchecked-divide-int unchecked-double unchecked-float "\
- "unchecked-inc unchecked-inc-int unchecked-int unchecked-long "\
- "unchecked-multiply unchecked-multiply-int unchecked-negate "\
- "unchecked-negate-int unchecked-remainder-int unchecked-short "\
- "unchecked-subtract unchecked-subtract-int underive unreduced "\
- "unsigned-bit-shift-right update update-in update-proxy uri? use uuid? val "\
- "vals var var-get var-set var? vary-meta vec vector vector-of vector? "\
- "volatile! volatile? vreset! vswap! while with-bindings with-bindings* "\
- "with-in-str with-local-vars with-meta with-open with-out-str "\
- "with-precision with-redefs with-redefs-fn xml-seq zero? zipmap", core_fns);
-
- split( \
- "*1 *2 *3 *agent* *clojure-version* *command-line-args* *compile-files* "\
- "*compile-path* *compiler-options* *data-readers* *default-data-reader-fn* "\
- "*e *err* *file* *flush-on-newline* *in* *ns* *out* *print-dup* "\
- "*print-length* *print-level* *print-meta* *print-namespace-maps* "\
- "*print-readably* *read-eval* *unchecked-math* *warn-on-reflection*", core_vars);
- }
- function print_word_highlighter(words, face, first) {
- printf("add-highlighter shared/clojure/code/ regex (?<!%s)%s(", \
- symbol_char, in_core);
- first = 1;
- for (i in words) {
- if (!first) { printf("|"); }
- printf("\\Q%s\\E", words[i]);
- first = 0;
- }
- printf(")(?!%s) 0:%s\n", symbol_char, face);
- }
- function print_static_words(words) {
- for (i in words) {
- printf("%s clojure.core/%s ", words[i], words[i]);
- }
- }
- BEGIN{
- # Keywords
- printf("add-highlighter shared/clojure/code/ regex ::?(%s+/)?%s+ 0:value\n", symbol_char, symbol_char);
-
- # Numbers
- printf("add-highlighter shared/clojure/code/ regex (?<!%s)[-+]?(?:0(?:[xX][0-9a-fA-F]+|[0-7]*)|[1-9]\\d*)N? 0:value\n", symbol_char);
- printf("add-highlighter shared/clojure/code/ regex (?<!%s)[-+]?(?:0|[1-9]\\d*)(?:\\.\\d*)(?:M|[eE][-+]?\\d+)? 0:value\n", symbol_char);
- printf("add-highlighter shared/clojure/code/ regex (?<!%s)[-+]?(?:0|[1-9]\\d*)/(?:0|[1-9]\\d*) 0:value\n", symbol_char);
-
- print_word_highlighter(keywords, "keyword");
- print_word_highlighter(core_fns, "function");
- print_word_highlighter(core_vars, "variable");
-
- printf(" hook global WinSetOption filetype=clojure %%{\n"\
- " set-option window static_words ");
- print_static_words(keywords);
- print_static_words(core_fns);
- print_static_words(core_vars);
- printf("\n }\n");
- }
-EOF
-}
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden clojure-trim-indent lisp-trim-indent
-
-declare-option \
- -docstring 'regex matching the head of forms which have options *and* indented bodies' \
- regex clojure_special_indent_forms \
- '(?:def.*|doseq|for|fn\*?|if(-.*|)|let.*|loop|ns|testing|with-.*|when(-.*|))'
-
-define-command -hidden clojure-indent-on-new-line %{
- # registers: i = best align point so far; w = start of first word of form
- evaluate-commands -draft -save-regs '/"|^@iw' -itersel %{
- execute-keys -draft 'gk"iZ'
- try %{
- execute-keys -draft '[bl"i<a-Z><gt>"wZ'
-
- try %{
- # If a special form, indent another (indentwidth - 1) spaces
- execute-keys -draft '"wze<a-k>\A' %opt{clojure_special_indent_forms} '\z<ret>'
- execute-keys -draft '"wze<a-L>s.{' %sh{printf $(( kak_opt_indentwidth - 1 ))} '}\K.*<ret><a-;>;"i<a-Z><gt>'
- } catch %{
- # If not special and parameter appears on line 1, indent to parameter
- execute-keys -draft '"wze<a-l>s\h\K[^\s].*<ret><a-;>;"i<a-Z><gt>'
- }
- }
- try %{ execute-keys -draft '[rl"i<a-Z><gt>' }
- try %{ execute-keys -draft '[Bl"i<a-Z><gt>' }
- execute-keys -draft ';"i<a-z>a&<space>'
- }
-}
-
-# 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-.+ }
-]
diff --git a/rc/base/css.kak b/rc/base/css.kak
deleted file mode 100644
index ecc456ed..00000000
--- a/rc/base/css.kak
+++ /dev/null
@@ -1,76 +0,0 @@
-# http://w3.org/Style/CSS
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*[.](css) %{
- set-option buffer filetype css
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/css regions
-add-highlighter shared/css/selector default-region group
-add-highlighter shared/css/declaration region [{] [}] regions
-add-highlighter shared/css/comment region /[*] [*]/ fill comment
-
-add-highlighter shared/css/declaration/base default-region group
-add-highlighter shared/css/declaration/double_string region '"' (?<!\\)(\\\\)*" fill string
-add-highlighter shared/css/declaration/single_string region "'" "'" fill string
-
-# https://developer.mozilla.org/en-US/docs/Web/CSS/length
-add-highlighter shared/css/declaration/base/ regex (#[0-9A-Fa-f]+)|((\d*\.)?\d+(ch|cm|em|ex|mm|pc|pt|px|rem|vh|vmax|vmin|vw)) 0:value
-
-add-highlighter shared/css/declaration/base/ regex ([A-Za-z][A-Za-z0-9_-]*)\h*: 1:keyword
-add-highlighter shared/css/declaration/base/ regex :(before|after) 0:attribute
-add-highlighter shared/css/declaration/base/ regex !important 0:keyword
-
-# element#id element.class
-# universal selector
-add-highlighter shared/css/selector/ regex [A-Za-z][A-Za-z0-9_-]* 0:keyword
-add-highlighter shared/css/selector/ regex [*]|[#.][A-Za-z][A-Za-z0-9_-]* 0:variable
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden css-trim-indent %{
- # remove trailing white spaces
- try %{ execute-keys -draft -itersel <a-x> s \h+$ <ret> d }
-}
-
-define-command -hidden css-indent-on-new-line %[
- evaluate-commands -draft -itersel %[
- # preserve previous line indent
- try %[ execute-keys -draft \; K <a-&> ]
- # filter previous line
- try %[ execute-keys -draft k : css-trim-indent <ret> ]
- # indent after lines ending with with {
- try %[ execute-keys -draft k <a-x> <a-k> \{$ <ret> j <a-gt> ]
- ]
-]
-
-define-command -hidden css-indent-on-closing-curly-brace %[
- evaluate-commands -draft -itersel %[
- # align to opening curly brace when alone on a line
- try %[ execute-keys -draft <a-h> <a-k> ^\h+\}$ <ret> m s \A|.\z <ret> 1<a-&> ]
- ]
-]
-
-# 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-.+ }
-]
diff --git a/rc/base/ctags.kak b/rc/base/ctags.kak
deleted file mode 100644
index 20eabac0..00000000
--- a/rc/base/ctags.kak
+++ /dev/null
@@ -1,123 +0,0 @@
-# Kakoune Exuberant CTags support script
-#
-# This script requires the readtags command available in ctags source but
-# not installed by default
-
-declare-option -docstring "list of paths to tag files to parse when looking up a symbol" \
- str-list ctagsfiles 'tags'
-
-define-command -params ..1 \
- -shell-script-candidates %{
- realpath() { ( cd "$(dirname "$1")"; printf "%s/%s\n" "$(pwd -P)" "$(basename "$1")" ) }
- eval "set -- $kak_opt_ctagsfiles"
- for candidate in "$@"; do
- [ -f "$candidate" ] && realpath "$candidate"
- done | awk '!x[$0]++' | # remove duplicates
- while read -r tags; do
- namecache="${tags%/*}/.kak.${tags##*/}.namecache"
- if [ -z "$(find "$namecache" -prune -newer "$tags")" ]; then
- cut -f 1 "$tags" | grep -v '^!' | uniq > "$namecache"
- fi
- cat "$namecache"
- done} \
- -docstring %{ctags-search [<symbol>]: jump to a symbol's definition
-If no symbol is passed then the current selection is used as symbol name} \
- ctags-search \
- %{ evaluate-commands %sh{
- realpath() { ( cd "$(dirname "$1")"; printf "%s/%s\n" "$(pwd -P)" "$(basename "$1")" ) }
- export tagname=${1:-${kak_selection}}
- eval "set -- $kak_opt_ctagsfiles"
- for candidate in "$@"; do
- [ -f "$candidate" ] && realpath "$candidate"
- done | awk '!x[$0]++' | # remove duplicates
- while read -r tags; do
- printf '!TAGROOT\t%s\n' "$(realpath "${tags%/*}")/"
- readtags -t "$tags" $tagname
- done | awk -F '\t|\n' '
- /^!TAGROOT\t/ { tagroot=$2 }
- /[^\t]+\t[^\t]+\t\/\^.*\$?\// {
- re=$0;
- sub(".*\t/\\^", "", re); sub("\\$?/$", "", re); gsub("(\\{|\\}|\\\\E).*$", "", re);
- keys=re; gsub(/</, "<lt>", keys); gsub(/\t/, "<c-v><c-i>", keys);
- out = out " %{" $2 " {MenuInfo}" re "} %{evaluate-commands %{ try %{ edit %{" path($2) "}; execute-keys %{/\\Q" keys "<ret>vc} } catch %{ echo %{unable to find tag} } } }"
- }
- /[^\t]+\t[^\t]+\t[0-9]+/ { out = out " %{" $2 ":" $3 "} %{evaluate-commands %{ edit %{" path($2) "} %{" $3 "}}}" }
- END { print ( length(out) == 0 ? "echo -markup %{{Error}no such tag " ENVIRON["tagname"] "}" : "menu -markup -auto-single " out ) }
-
- # Ensure x is an absolute file path, by prepending with tagroot
- function path(x) { return x ~/^\// ? x : tagroot x }'
- }}
-
-define-command ctags-complete -docstring "Insert completion candidates for the current selection into the buffer's local variables" %{ evaluate-commands -draft %{
- execute-keys <space>hb<a-k>^\w+$<ret>
- nop %sh{ {
- compl=$(readtags -p "$kak_selection" | cut -f 1 | sort | uniq | sed -e 's/:/\\:/g' | sed -e 's/\n/:/g' )
- compl="${kak_cursor_line}.${kak_cursor_column}+${#kak_selection}@${kak_timestamp}:${compl}"
- printf %s\\n "set-option buffer=$kak_bufname ctags_completions '${compl}'" | kak -p ${kak_session}
- } > /dev/null 2>&1 < /dev/null & }
-}}
-
-define-command ctags-funcinfo -docstring "Display ctags information about a selected function" %{
- evaluate-commands -draft %{
- try %{
- execute-keys '[(;B<a-k>[a-zA-Z_]+\(<ret><a-;>'
- evaluate-commands %sh{
- f=${kak_selection%?}
- sig='\tsignature:(.*)'
- csn='\t(class|struct|namespace):(\S+)'
- sigs=$(readtags -e -Q '(eq? $kind "f")' "${f}" | sed -re "s/^.*${csn}.*${sig}$/\3 [\2::${f}]/ ;t ;s/^.*${sig}$/\1 [${f}]/")
- if [ -n "$sigs" ]; then
- printf %s\\n "evaluate-commands -client ${kak_client} %{info -anchor $kak_cursor_line.$kak_cursor_column -placement above '$sigs'}"
- fi
- }
- }
- }
-}
-
-define-command ctags-enable-autoinfo -docstring "Automatically display ctags information about function" %{
- hook window -group ctags-autoinfo NormalIdle .* ctags-funcinfo
- hook window -group ctags-autoinfo InsertIdle .* ctags-funcinfo
-}
-
-define-command ctags-disable-autoinfo -docstring "Disable automatic ctags information displaying" %{ remove-hooks window ctags-autoinfo }
-
-declare-option -docstring "shell command to run" \
- str ctagscmd "ctags -R --fields=+S"
-declare-option -docstring "path to the directory in which the tags file will be generated" str ctagspaths "."
-
-define-command ctags-generate -docstring 'Generate tag file asynchronously' %{
- echo -markup "{Information}launching tag generation in the background"
- nop %sh{ (
- while ! mkdir .tags.kaklock 2>/dev/null; do sleep 1; done
- trap 'rmdir .tags.kaklock' EXIT
-
- if ${kak_opt_ctagscmd} -f .tags.kaktmp ${kak_opt_ctagspaths}; then
- mv .tags.kaktmp tags
- msg="tags generation complete"
- else
- msg="tags generation failed"
- fi
-
- printf %s\\n "evaluate-commands -client $kak_client echo -markup '{Information}${msg}'" | kak -p ${kak_session}
- ) > /dev/null 2>&1 < /dev/null & }
-}
-
-define-command ctags-update-tags -docstring 'Update tags for the given file' %{
- nop %sh{ (
- while ! mkdir .tags.kaklock 2>/dev/null; do sleep 1; done
- trap 'rmdir .tags.kaklock' EXIT
-
- if ${kak_opt_ctagscmd} -f .file_tags.kaktmp $kak_bufname; then
- export LC_COLLATE=C LC_ALL=C # ensure ASCII sorting order
- # merge the updated tags tags with the general tags (filtering out out of date tags from it) into the target file
- grep -Fv "$(printf '\t%s\t' "$kak_bufname")" tags | grep -v '^!' | sort --merge - .file_tags.kaktmp >> .tags.kaktmp
- rm .file_tags.kaktmp
- mv .tags.kaktmp tags
- msg="tags updated for $kak_bufname"
- else
- msg="tags update failed for $kak_bufname"
- fi
-
- printf %s\\n "evaluate-commands -client $kak_client echo -markup '{Information}${msg}'" | kak -p ${kak_session}
- ) > /dev/null 2>&1 < /dev/null & }
-}
diff --git a/rc/base/d.kak b/rc/base/d.kak
deleted file mode 100644
index f0f08248..00000000
--- a/rc/base/d.kak
+++ /dev/null
@@ -1,132 +0,0 @@
-# http://dlang.org/
-#
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*\.di? %{
- set-option buffer filetype d
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/d regions
-add-highlighter shared/d/code default-region group
-add-highlighter shared/d/string region %{(?<!')(?<!'\\)"} %{(?<!\\)(?:\\\\)*"} group
-add-highlighter shared/d/verbatim_string1 region ` ` fill meta
-add-highlighter shared/d/verbatim_string2 region %{(?<!')(?<!'\\)`} %{(?<!\\)(?:\\\\)*`} fill meta
-add-highlighter shared/d/verbatim_string_prefixed region %{r`([^(]*)\(} %{\)([^)]*)`} fill meta
-add-highlighter shared/d/disabled region '/\+[^+]?' '\+/' fill comment
-add-highlighter shared/d/comment1 region '/\*[^*]?' '\*/' fill comment
-add-highlighter shared/d/comment2 region '//[^/]?' $ fill comment
-add-highlighter shared/d/docstring1 region '/\+\+' '\+/' fill comment
-add-highlighter shared/d/docstring2 region '/\*\*' '\*/' fill comment
-add-highlighter shared/d/docstring3 region /// $ fill comment
-
-add-highlighter shared/d/string/ fill string
-add-highlighter shared/d/string/ regex %{\\(x[0-9a-fA-F]{2}|[0-7]{1,3}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})\b} 0:value
-add-highlighter shared/d/code/ regex %{'((\\.)?|[^'\\])'} 0:value
-add-highlighter shared/d/code/ regex "-?([0-9_]*\.(?!0[xXbB]))?\b([0-9_]+|0[xX][0-9a-fA-F_]*\.?[0-9a-fA-F_]+|0[bb][01_]+)([ep]-?[0-9_]+)?[fFlLuUi]*\b" 0:value
-add-highlighter shared/d/code/ regex "\b(this)\b\s*[^(]" 1:value
-add-highlighter shared/d/code/ regex "((?:~|\b)this)\b\s*\(" 1:function
-add-highlighter shared/d/code/ regex '#\s*line\b.*' 0:meta
-
-evaluate-commands %sh{
- # Grammar
-
- keywords="abstract|alias|align|asm|assert|auto|body|break|case|cast"
- keywords="${keywords}|catch|cent|class|const|continue|debug"
- keywords="${keywords}|default|delegate|delete|deprecated|do|else|enum|export|extern"
- keywords="${keywords}|final|finally|for|foreach|foreach_reverse|function|goto"
- keywords="${keywords}|if|immutable|import|in|inout|interface|invariant"
- keywords="${keywords}|is|lazy|macro|mixin|module|new|nothrow|out|override"
- keywords="${keywords}|package|pragma|private|protected|public|pure|ref|return|scope"
- keywords="${keywords}|shared|static|struct|super|switch|synchronized|template"
- keywords="${keywords}|throw|try|typedef|typeid|typeof|union"
- keywords="${keywords}|unittest|version|volatile|while|with"
- attributes="abstract|align|auto|const|debug|deprecated|export|extern|final"
- attributes="${attributes}|immutable|inout|nothrow|package|private|protected"
- attributes="${attributes}|public|pure|ref|override|scope|shared|static|synchronized|version"
- attributes="${attributes}|__gshared|__traits|__vector|__parameters"
- types="bool|byte|cdouble|cent|cfloat|char|creal|dchar|double|dstring|float"
- types="${types}|idouble|ifloat|int|ireal|long|ptrdiff_t|real|size_t|short"
- types="${types}|string|ubyte|ucent|uint|ulong|ushort|void|wchar|wstring"
- values="true|false|null"
- tokens="__FILE__|__MODULE__|__LINE__|__FUNCTION__"
- tokens="${tokens}|__PRETTY_FUNCTION__|__DATE__|__EOF__|__TIME__"
- tokens="${tokens}|__TIMESTAMP__|__VENDOR__|__VERSION__|#line"
- properties="this|init|sizeof|alignof|mangleof|stringof|infinity|nan|dig|epsilon|mant_dig"
- properties="${properties}|max_10_exp|min_exp|max|min_normal|re|im|classinfo"
- properties="${properties}|length|dup|keys|values|rehash|clear"
- decorators="disable|property|nogc|safe|trusted|system"
-
- # Add the language's grammar to the static completion list
- printf %s\\n "hook global WinSetOption filetype=d %{
- set-option window static_words ${keywords} ${attributes} ${types} ${values} ${decorators} ${properties}
- }" | tr '|' ' '
-
- # Highlight keywords
- printf %s "
- add-highlighter shared/d/code/ regex \b(${keywords})\b 0:keyword
- add-highlighter shared/d/code/ regex \b(${attributes})\b 0:attribute
- add-highlighter shared/d/code/ regex \b(${types})\b 0:type
- add-highlighter shared/d/code/ regex \b(${values})\b 0:value
- add-highlighter shared/d/code/ regex @(${decorators})\b 0:attribute
- add-highlighter shared/d/code/ regex \b(${tokens})\b 0:builtin
- add-highlighter shared/d/code/ regex \.(${properties})\b 1:builtin
- "
-}
-
-add-highlighter shared/d/code/ regex "\bimport\s+([\w._-]+)(?:\s*=\s*([\w._-]+))?" 1:module 2:module
-add-highlighter shared/d/code/ regex "\bmodule\s+([\w_-]+)\b" 1:module
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden d-indent-on-new-line %~
- evaluate-commands -draft -itersel %=
- # preserve previous line indent
- try %{ execute-keys -draft \;K<a-&> }
- # indent after lines ending with { or (
- try %[ execute-keys -draft k<a-x> <a-k> [{(]\h*$ <ret> j<a-gt> ]
- # cleanup trailing white spaces on the previous line
- try %{ execute-keys -draft k<a-x> s \h+$ <ret>d }
- # align to opening paren of previous line
- try %{ execute-keys -draft [( <a-k> \A\([^\n]+\n[^\n]*\n?\z <ret> s \A\(\h*.|.\z <ret> '<a-;>' & }
- # copy // comments prefix
- try %{ execute-keys -draft \;<c-s>k<a-x> s ^\h*\K/{2,} <ret> y<c-o>P<esc> }
- # indent after a switch's case/default statements
- try %[ execute-keys -draft k<a-x> <a-k> ^\h*(case|default).*:$ <ret> j<a-gt> ]
- # indent after if|else|while|for
- try %[ execute-keys -draft \;<a-F>)MB <a-k> \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z <ret> s \A|.\z <ret> 1<a-&>1<a-space><a-gt> ]
- =
-~
-
-define-command -hidden d-indent-on-opening-curly-brace %[
- # align indent with opening paren when { is entered on a new line after the closing paren
- try %[ execute-keys -draft -itersel h<a-F>)M <a-k> \A\(.*\)\h*\n\h*\{\z <ret> s \A|.\z <ret> 1<a-&> ]
-]
-
-define-command -hidden d-indent-on-closing-curly-brace %[
- # align to opening curly brace when alone on a line
- 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-.+ }
-}
diff --git a/rc/base/etc.kak b/rc/base/etc.kak
deleted file mode 100644
index 1e2067fe..00000000
--- a/rc/base/etc.kak
+++ /dev/null
@@ -1,79 +0,0 @@
-# Highlighting for common files in /etc
-hook global BufCreate .*/etc/(hosts|networks|services) %{ set-option buffer filetype etc-hosts }
-hook global BufCreate .*/etc/resolv.conf %{ set-option buffer filetype etc-resolv-conf }
-hook global BufCreate .*/etc/shadow %{ set-option buffer filetype etc-shadow }
-hook global BufCreate .*/etc/passwd %{ set-option buffer filetype etc-passwd }
-hook global BufCreate .*/etc/gshadow %{ set-option buffer filetype etc-gshadow }
-hook global BufCreate .*/etc/group %{ set-option buffer filetype etc-group }
-hook global BufCreate .*/etc/(fs|m)tab %{ set-option buffer filetype etc-fstab }
-hook global BufCreate .*/etc/environment %{ set-option buffer filetype sh }
-hook global BufCreate .*/etc/env.d/.* %{ 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 }
-
-# Highlighters
-## /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
-
-hook -group etc-resolv-conf-highlight global WinSetOption filetype=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 }
-}
-
-## /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 %{
- add-highlighter window/etc-hosts ref 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 %{
- add-highlighter window/etc-fstab ref 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 %{
- add-highlighter window/etc-group ref 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 %{
- add-highlighter window/etc-gshadow ref 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 %{
- add-highlighter window/etc-shadow ref 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 %{
- add-highlighter window/etc-passwd ref etc-passwd
- hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/etc-passwd }
-}
diff --git a/rc/base/file.kak b/rc/base/file.kak
deleted file mode 100644
index 073e9ce0..00000000
--- a/rc/base/file.kak
+++ /dev/null
@@ -1,17 +0,0 @@
-hook global BufOpenFile .* %{ evaluate-commands %sh{
- if [ -z "${kak_opt_filetype}" ]; then
- mime=$(file -b --mime-type "${kak_buffile}")
- case "${mime}" in
- application/*+xml) filetype="xml" ;;
- image/*+xml) filetype="xml" ;; #SVG
- message/rfc822) filetype="mail" ;;
- text/x-shellscript) filetype="sh" ;;
- text/x-*) filetype="${mime#text/x-}" ;;
- text/*) filetype="${mime#text/}" ;;
- application/*) filetype="${mime#application/}" ;;
- esac
- if [ -n "${filetype}" ]; then
- printf "set-option buffer filetype '%s'\n" "${filetype}"
- fi
- fi
-} }
diff --git a/rc/base/fish.kak b/rc/base/fish.kak
deleted file mode 100644
index 8e23ede4..00000000
--- a/rc/base/fish.kak
+++ /dev/null
@@ -1,84 +0,0 @@
-# http://fishshell.com
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*[.](fish) %{
- set-option buffer filetype fish
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/fish regions
-add-highlighter shared/fish/code default-region group
-add-highlighter shared/fish/double_string region '"' (?<!\\)(\\\\)*" group
-add-highlighter shared/fish/single_string region "'" "'" fill string
-add-highlighter shared/fish/comment region '#' '$' fill comment
-
-add-highlighter shared/fish/double_string/ fill string
-add-highlighter shared/fish/double_string/ regex (\$\w+)|(\{\$\w+\}) 0:variable
-
-add-highlighter shared/fish/code/ regex (\$\w+)|(\{\$\w+\}) 0:variable
-
-# Command names are collected using `builtin --names` and 'eval' from `functions --names`
-add-highlighter shared/fish/code/ regex \b(and|begin|bg|bind|block|break|breakpoint|builtin|case|cd|command|commandline|complete|contains|continue|count|echo|else|emit|end|eval|exec|exit|fg|for|function|functions|history|if|jobs|not|or|printf|pwd|random|read|return|set|set_color|source|status|switch|test|ulimit|while)\b 0:keyword
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden fish-trim-indent %{
- evaluate-commands -no-hooks -draft -itersel %{
- # remove trailing white spaces
- try %{ execute-keys -draft <a-x>s\h+$<ret>d }
- }
-}
-
-define-command -hidden fish-indent-on-char %{
- evaluate-commands -no-hooks -draft -itersel %{
- # align middle and end structures to start and indent when necessary
- try %{ execute-keys -draft <a-x><a-k>^\h*(else)$<ret><a-\;><a-?>^\h*(if)<ret>s\A|\z<ret>)<a-&> }
- try %{ execute-keys -draft <a-x><a-k>^\h*(end)$<ret><a-\;><a-?>^\h*(begin|for|function|if|switch|while)<ret>s\A|\z<ret>)<a-&> }
- try %{ execute-keys -draft <a-x><a-k>^\h*(case)$<ret><a-\;><a-?>^\h*(switch)<ret>s\A|\z<ret>)<a-&>)<space><a-gt> }
- }
-}
-
-define-command -hidden fish-indent-on-new-line %{
- evaluate-commands -no-hooks -draft -itersel %{
- # preserve previous line indent
- try %{ execute-keys -draft <space>K<a-&> }
- # filter previous line
- try %{ execute-keys -draft k:fish-trim-indent<ret> }
- # indent after start structure
- try %{ execute-keys -draft k<a-x><a-k>^\h*(begin|case|else|for|function|if|switch|while)\b<ret>j<a-gt> }
- }
-}
-
-define-command -hidden fish-insert-on-new-line %{
- evaluate-commands -no-hooks -draft -itersel %{
- # copy _#_ comment prefix and following white spaces
- try %{ execute-keys -draft k<a-x>s^\h*\K#\h*<ret>yjp }
- # wisely add end structure
- evaluate-commands -save-regs x %{
- try %{ execute-keys -draft k<a-x>s^\h+<ret>"xy } catch %{ reg x '' }
- try %{ execute-keys -draft k<a-x><a-k>^<c-r>x(begin|for|function|if|switch|while)<ret>j<a-a>iX<a-\;>K<a-K>^<c-r>x(begin|for|function|if|switch|while).*\n<c-r>xend$<ret>jxypjaend<esc><a-lt> }
- }
- }
-}
-
-# 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-insert fish-insert-on-new-line
- hook window InsertChar \n -group fish-indent fish-indent-on-new-line
-
- hook -once -always window WinSetOption filetype=.* %{ remove-hooks window fish-.+ }
-}
diff --git a/rc/base/gas.kak b/rc/base/gas.kak
deleted file mode 100644
index 0c1f79f8..00000000
--- a/rc/base/gas.kak
+++ /dev/null
@@ -1,91 +0,0 @@
-# Detection
-# ---------
-hook global BufCreate .*\.(s|S|asm)$ %{
- set-option buffer filetype gas
-}
-
-add-highlighter shared/gas regions
-add-highlighter shared/gas/code default-region group
-add-highlighter shared/gas/string region '"' (?<!\\)(\\\\)*" fill string
-add-highlighter shared/gas/commentMulti region /\* \*/ fill comment
-add-highlighter shared/gas/commentSingle1 region '#' '$' fill comment
-add-highlighter shared/gas/commentSingle2 region ';' '$' fill comment
-
-# Constant
-add-highlighter shared/gas/code/ regex (0[xX][0-9a-fA-F]+|\b[0-9]+)\b 0:value
-
-# Labels
-add-highlighter shared/gas/code/ regex ^\h*([A-Za-z0-9_.-]+): 0:operator
-
-# ARM Directives
-add-highlighter shared/gas/code/ regex ((^|\s+)\.([248]byte|align|arch(_extension)?|arm|bsscantunwind|code|[cf]pu|[dq]n|eabi_attribute|even|extend|ldouble|fnend|fnstart|force_thumb|handlerdata|inst(\.[nw])?|ltorg|movsp|object_arch|packed|pad|personality(index)?|pool|req|save|setfp|screl32|syntax|thumb(_func|_set)?|tlsdescseq|unreq|unwind_raw|vsave)(\h+|$)) 0:type
-
-# Assembler Directives
-add-highlighter shared/gas/code/ regex ((^|\s+)\.(abort|ABORT|align|app-file|ascii|asciz|balign[wl]|byte|comm|data|def|desc|dim|double|eject|else|endif|equ|extern|file|fill|float|global|globl|hword|ident|if|include|int|irp|irpc|lcomm|iflags|line|linkonce|ln|mri|list|loc|local|long|macro|nolist|octa|org|print|purgem|p2align[wl]|psize|quad|rept|sbttl|section|set|short|single|size|skip|space|stab[dns]|string|struct|tag|text|title|type|title|uleb128|val|vtable_entry|weak|word|rodata|zero)(\h+|$)) 0:type
-
-# Registers
-add-highlighter shared/gas/code/ regex \%(([re](ax|bx|cx|dx|si|di|bp|sp))|(al|bl|cl|dl|sil|dil|bpl|spl)|(r[8-9][dwb])|(r1[0-5][dwb])|(cs|ds|es|fs|gs|ss|ip|eflags)|([xy]mm[0-9]|[xy]mm1[0-5]))\b 0:variable
-
-# General Instructions
-add-highlighter shared/gas/code/ regex \
-^\h*(mov|lea|call|test|cmp)([bwlq])?\b|\
-^\h*(bswap[lq]|cmpxchg[bwlq]|cmpxchg8b|cwt[ld]|movabs([bwlq])?|popa([lw])?|pusha([wl])?)\b|\
-^\h*(and|or|not|xor|sar|sal|shr|shl|sub|add|(i)?mul|(i)?div|inc|dec|adc|sbb)([bwlq])?\b|\
-^\h*(rcl|rcr|rol|ror|shld|shrd)([bwlq])?\b|\
-^\h*(bsf|bsr|bt|btc|btr|bts)([wlq])?\b|\
-^\h*(cmps|lods|movs)([sxbwdq])?\b|\
-^\h*(ret([bwlq])?|[il]ret([dq])?|leave|movzb[wlq]|movzw[lq]|movsb[wlq]|movsw[lq]|movslq|cwt[dl]|clt[sdq]|cqt[od])\b|\
-^\h*set(([bagl])?e|(n)?[zlesgabop]|(n)?(ae|le|ge|be))\b|\
-^\h*(cmovn[eszlgba]|cmov[glab]e|cmov[esglabz]|cmovn[lgba]e)\b|\
-^\h*(jmp|j[esglabzcop]|jn[esglabzcop]|j[glasbp]e|jn[glab]e|j(e)?cxz|jpo)\b|\
-^\h*(aa[adms]|da[as]|xadd[bwlq]|xchg[lwq])\b|\
-^\h*(rep|repnz|repz|scas([qlwb])?|stos([qlwb])?)\b|\
-^\h*(cl[cdi]|cmc|lahf|popf([lwq])?|pushf([lwq])?|sahf|st[cdi])\b|\
-^\h*(l[defgs]s([wl])?|cpuid|nop|ud2|xlat(b)?)\b|\
-^\h*(lea|call|push|pop)([wlq])?\b|\
-^\h*(in|ins([lwb])?|out|outs([lwb])?)\b|\
-^\h*(cb(t)?w|cwde|cdqe|cwd|cdq|cqo|sahf|lahf|por|pxor|movap[ds])\b|\
-^\h*(bound([wl])?|enter|int(o)?|lcall|loop(n)?[ez]|pause)\b 0:keyword
-
-#Floating Point Instructions
-add-highlighter shared/gas/code/ regex \
-^\h*f(add|sub|mul|com|comp|sub|subr|div|divr|ld|xch|st|nop|stp|ldenv|chs|abs)\b|\
-^\h*f(tst|xam|ldcw|ld1|ld2[te]|ldpi|ld[gn]2|ldz|(n)?stenv|2xm1|yl2x|p(a)?tan)\b|\
-^\h*f(xtract|prem(1)?|(dec|inc)stp|(n)?stcw|yl2xp1|sqrt|sincos|rndint|scale|sin|cos|iadd)\b|\
-^\h*f(cmov[bn]e|cmove|cmovn[beu]|cmovnbe|cmovu|imul|icom|icomp|isub|isubr|icomp)\b|\
-^\h*(div|add|sub|mul|div)[ps]s\b|\
-^\h*(div|add|sub|mul|div)[ps]d\b|\
-^\h*(vmovs[ds]|vmovap[sd])\b|\
-^\h*(vcvtts[ds]2si(q)?|vcvtsi2s[d](q)?|vunpcklps|vcvtps2pd|vmovddup|vcvtpd2psx)\b|\
-^\h*(cvtss2s[di]|cvtsi2s[ds]|cvtsd2s[is]|cvtdq2p[ds]|cvtpd2(dq|pi|ps)|cvtpi2p[ds]|cvtps2p[id])\b|\
-^\h*(cvttp[ds]2dq|cvttp[ds]2pi|cvtts[ds]2si)\b|\
-^\h*(vxorp[sd]|vandp[sd]|ucomis[sd])\b 0:keyword
-
-define-command -hidden gas-trim-indent %{
- evaluate-commands -draft -itersel %{
- execute-keys <a-x>
- # remove trailing white spaces
- try %{ execute-keys -draft s \h+$ <ret> d }
- }
-}
-
-define-command -hidden gas-indent-on-new-line %~
- evaluate-commands -draft -itersel %<
- # preserve previous line indent
- try %{ execute-keys -draft \; K <a-&> }
- # filter previous line
- try %{ execute-keys -draft k : gas-trim-indent <ret> }
- # indent after label
- try %[ execute-keys -draft k <a-x> <a-k> :$ <ret> j <a-gt> ]
- >
-~
-
-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-.+ }
-}
diff --git a/rc/base/git.kak b/rc/base/git.kak
deleted file mode 100644
index 13d58f0a..00000000
--- a/rc/base/git.kak
+++ /dev/null
@@ -1,40 +0,0 @@
-hook global BufCreate .*(COMMIT_EDITMSG|MERGE_MSG) %{
- set-option buffer filetype git-commit
-}
-
-hook global BufCreate .*/NOTES_EDITMSG %{
- set-option buffer filetype git-notes
-}
-
-hook global BufCreate .*(\.gitconfig|git/config) %{
- 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 %{
- set-option buffer filetype git-rebase
-}
-
-hook -group git-rebase-highlight global WinSetOption filetype=git-rebase %{
- add-highlighter window/git-rebase-highlight group
- 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 -once -always window WinSetOption filetype=.* %{ remove-highlighter window/git-rebase-highlight }
-}
diff --git a/rc/base/go.kak b/rc/base/go.kak
deleted file mode 100644
index 8aebe657..00000000
--- a/rc/base/go.kak
+++ /dev/null
@@ -1,97 +0,0 @@
-# https://golang.org/
-#
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*\.go %{
- set-option buffer filetype go
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/go regions
-add-highlighter shared/go/code default-region group
-add-highlighter shared/go/back_string region '`' '`' fill string
-add-highlighter shared/go/double_string region '"' (?<!\\)(\\\\)*" fill string
-add-highlighter shared/go/single_string region "'" (?<!\\)(\\\\)*' fill string
-add-highlighter shared/go/comment region /\* \*/ fill comment
-add-highlighter shared/go/comment_line region '//' $ fill comment
-
-add-highlighter shared/go/code/ regex %{-?([0-9]*\.(?!0[xX]))?\b([0-9]+|0[xX][0-9a-fA-F]+)\.?([eE][+-]?[0-9]+)?i?\b} 0:value
-
-evaluate-commands %sh{
- # Grammar
- keywords="break|default|func|interface|select|case|defer|go|map|struct"
- keywords="${keywords}|chan|else|goto|package|switch|const|fallthrough|if|range|type"
- keywords="${keywords}|continue|for|import|return|var"
- 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"
- values="false|true|nil|iota"
- functions="append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover"
-
- # Add the language's grammar to the static completion list
- printf %s\\n "hook global WinSetOption filetype=go %{
- set-option window static_words ${keywords} ${attributes} ${types} ${values} ${functions}
- }" | tr '|' ' '
-
- # Highlight keywords
- printf %s "
- add-highlighter shared/go/code/ regex \b(${keywords})\b 0:keyword
- add-highlighter shared/go/code/ regex \b(${attributes})\b 0:attribute
- add-highlighter shared/go/code/ regex \b(${types})\b 0:type
- add-highlighter shared/go/code/ regex \b(${values})\b 0:value
- add-highlighter shared/go/code/ regex \b(${functions})\b 0:builtin
- "
-}
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden go-indent-on-new-line %~
- evaluate-commands -draft -itersel %=
- # preserve previous line indent
- try %{ execute-keys -draft \;K<a-&> }
- # indent after lines ending with { or (
- try %[ execute-keys -draft k<a-x> <a-k> [{(]\h*$ <ret> j<a-gt> ]
- # cleanup trailing white spaces on the previous line
- try %{ execute-keys -draft k<a-x> s \h+$ <ret>d }
- # align to opening paren of previous line
- try %{ execute-keys -draft [( <a-k> \A\([^\n]+\n[^\n]*\n?\z <ret> s \A\(\h*.|.\z <ret> '<a-;>' & }
- # copy // comments prefix
- try %{ execute-keys -draft \;<c-s>k<a-x> s ^\h*\K/{2,} <ret> y<c-o>P<esc> }
- # indent after a switch's case/default statements
- try %[ execute-keys -draft k<a-x> <a-k> ^\h*(case|default).*:$ <ret> j<a-gt> ]
- # indent after if|else|while|for
- try %[ execute-keys -draft \;<a-F>)MB <a-k> \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z <ret> s \A|.\z <ret> 1<a-&>1<a-space><a-gt> ]
- =
-~
-
-define-command -hidden go-indent-on-opening-curly-brace %[
- # align indent with opening paren when { is entered on a new line after the closing paren
- try %[ execute-keys -draft -itersel h<a-F>)M <a-k> \A\(.*\)\h*\n\h*\{\z <ret> s \A|.\z <ret> 1<a-&> ]
-]
-
-define-command -hidden go-indent-on-closing-curly-brace %[
- # align to opening curly brace when alone on a line
- 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-.+ }
-}
diff --git a/rc/base/haskell.kak b/rc/base/haskell.kak
deleted file mode 100644
index c51bcaf4..00000000
--- a/rc/base/haskell.kak
+++ /dev/null
@@ -1,105 +0,0 @@
-# http://haskell.org
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*[.](hs) %{
- set-option buffer filetype haskell
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/haskell regions
-add-highlighter shared/haskell/code default-region group
-add-highlighter shared/haskell/string region (?<!'\\)(?<!')" (?<!\\)(\\\\)*" fill string
-add-highlighter shared/haskell/macro region ^\h*?\K# (?<!\\)\n fill meta
-add-highlighter shared/haskell/pragma region -recurse \{- \{-# '#-\}' fill meta
-add-highlighter shared/haskell/comment region -recurse \{- \{- -\} fill comment
-add-highlighter shared/haskell/line_comment region --(?:[^!#$%&*+./<>?@\\\^|~=]|$) $ fill comment
-
-add-highlighter shared/haskell/code/ regex (?<!')\b0x+[A-Fa-f0-9]+ 0:value
-add-highlighter shared/haskell/code/ regex (?<!')\b\d+([.]\d+)? 0:value
-add-highlighter shared/haskell/code/ regex (?<!')\b(import|hiding|qualified|module)(?!')\b 0:keyword
-add-highlighter shared/haskell/code/ regex (?<!')\b(import)(?!')\b[^\n]+(?<!')\b(as)(?!')\b 2:keyword
-add-highlighter shared/haskell/code/ regex (?<!')\b(class|data|default|deriving|infix|infixl|infixr|instance|module|newtype|pattern|type|where)(?!')\b 0:keyword
-add-highlighter shared/haskell/code/ regex (?<!')\b(case|do|else|if|in|let|mdo|of|proc|rec|then)(?!')\b 0:attribute
-
-# The complications below is because period has many uses:
-# As function composition operator (possibly without spaces) like "." and "f.g"
-# Hierarchical modules like "Data.Maybe"
-# Qualified imports like "Data.Maybe.Just", "Data.Maybe.maybe", "Control.Applicative.<$>"
-# Quantifier separator in "forall a . [a] -> [a]"
-# Enum comprehensions like "[1..]" and "[a..b]" (making ".." and "Module..." illegal)
-
-# matches uppercase identifiers: Monad Control.Monad
-# not non-space separated dot: Just.const
-add-highlighter shared/haskell/code/ regex \b([A-Z]['\w]*\.)*[A-Z]['\w]*(?!['\w])(?![.a-z]) 0:variable
-
-# matches infix identifier: `mod` `Apa._T'M`
-add-highlighter shared/haskell/code/ regex `\b([A-Z]['\w]*\.)*[\w]['\w]*` 0:operator
-# matches imported operators: M.! M.. Control.Monad.>>
-# not operator keywords: M... M.->
-add-highlighter shared/haskell/code/ regex \b[A-Z]['\w]*\.[~<=>|:!?/.@$*&#%+\^\-\\]+ 0:operator
-# matches dot: .
-# not possibly incomplete import: a.
-# not other operators: !. .!
-add-highlighter shared/haskell/code/ regex (?<![\w~<=>|:!?/.@$*&#%+\^\-\\])\.(?![~<=>|:!?/.@$*&#%+\^\-\\]) 0:operator
-# matches other operators: ... > < <= ^ <*> <$> etc
-# not dot: .
-# not operator keywords: @ .. -> :: ~
-add-highlighter shared/haskell/code/ regex (?<![~<=>|:!?/.@$*&#%+\^\-\\])[~<=>|:!?/.@$*&#%+\^\-\\]+ 0:operator
-
-# matches operator keywords: @ ->
-add-highlighter shared/haskell/code/ regex (?<![~<=>|:!?/.@$*&#%+\^\-\\])(@|~|<-|->|=>|::|=|:|[|])(?![~<=>|:!?/.@$*&#%+\^\-\\]) 1:keyword
-# matches: forall [..variables..] .
-# not the variables
-add-highlighter shared/haskell/code/ regex \b(forall)\b[^.\n]*?(\.) 1:keyword 2:keyword
-
-# matches 'x' '\\' '\'' '\n' '\0'
-# not incomplete literals: '\'
-# not valid identifiers: w' _'
-add-highlighter shared/haskell/code/ regex \B'([^\\]|[\\]['"\w\d\\])' 0:string
-# this has to come after operators so '-' etc is correct
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-# http://en.wikibooks.org/wiki/Haskell/Indentation
-
-define-command -hidden haskell-trim-indent %{
- # remove trailing white spaces
- try %{ execute-keys -draft -itersel <a-x> s \h+$ <ret> d }
-}
-
-define-command -hidden haskell-indent-on-new-line %{
- evaluate-commands -draft -itersel %{
- # copy -- comments prefix and following white spaces
- try %{ execute-keys -draft k <a-x> s ^\h*\K--\h* <ret> y gh j P }
- # preserve previous line indent
- try %{ execute-keys -draft \; K <a-&> }
- # align to first clause
- try %{ execute-keys -draft \; k x X s ^\h*(if|then|else)?\h*(([\w']+\h+)+=)?\h*(case\h+[\w']+\h+of|do|let|where)\h+\K.* <ret> s \A|.\z <ret> & }
- # filter previous line
- try %{ execute-keys -draft k : haskell-trim-indent <ret> }
- # indent after lines beginning with condition or ending with expression or =(
- try %{ execute-keys -draft \; k x <a-k> ^\h*(if)|(case\h+[\w']+\h+of|do|let|where|[=(])$ <ret> j <a-gt> }
- }
-}
-
-# 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-.+ }
-}
diff --git a/rc/base/html.kak b/rc/base/html.kak
deleted file mode 100644
index 5f76721d..00000000
--- a/rc/base/html.kak
+++ /dev/null
@@ -1,75 +0,0 @@
-# http://w3.org/html
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*\.html %{
- set-option buffer filetype html
-}
-
-hook global BufCreate .*\.xml %{
- set-option buffer filetype xml
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/html regions
-add-highlighter shared/html/comment region <!-- --> fill comment
-add-highlighter shared/html/tag region < > regions
-add-highlighter shared/html/style region <style\b.*?>\K (?=</style>) ref css
-add-highlighter shared/html/script region <script\b.*?>\K (?=</script>) ref javascript
-
-add-highlighter shared/html/tag/base default-region group
-add-highlighter shared/html/tag/ region '"' (?<!\\)(\\\\)*" fill string
-add-highlighter shared/html/tag/ region "'" "'" fill string
-
-add-highlighter shared/html/tag/base/ regex \b([a-zA-Z0-9_-]+)=? 1:attribute
-add-highlighter shared/html/tag/base/ regex </?(\w+) 1:keyword
-add-highlighter shared/html/tag/base/ regex <(!DOCTYPE(\h+\w+)+) 1:meta
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden html-trim-indent %{
- # remove trailing white spaces
- try %{ execute-keys -draft -itersel <a-x> s \h+$ <ret> d }
-}
-
-define-command -hidden html-indent-on-greater-than %[
- evaluate-commands -draft -itersel %[
- # align closing tag to opening when alone on a line
- try %[ execute-keys -draft <space> <a-h> s ^\h+<lt>/(\w+)<gt>$ <ret> {c<lt><c-r>1,<lt>/<c-r>1<gt> <ret> s \A|.\z <ret> 1<a-&> ]
- ]
-]
-
-define-command -hidden html-indent-on-new-line %{
- evaluate-commands -draft -itersel %{
- # preserve previous line indent
- try %{ execute-keys -draft \; K <a-&> }
- # filter previous line
- try %{ execute-keys -draft k : html-trim-indent <ret> }
- # indent after lines ending with opening tag
- 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}-.+""
- "
-}
diff --git a/rc/base/ini.kak b/rc/base/ini.kak
deleted file mode 100644
index c03cae4e..00000000
--- a/rc/base/ini.kak
+++ /dev/null
@@ -1,15 +0,0 @@
-hook global BufCreate .+\.(repo|ini|cfg|properties) %{
- set-option buffer filetype ini
-}
-
-add-highlighter shared/ini regions
-add-highlighter shared/ini/code default-region group
-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*([^\[][^=\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 }
-}
diff --git a/rc/base/java.kak b/rc/base/java.kak
deleted file mode 100644
index 7caa5aee..00000000
--- a/rc/base/java.kak
+++ /dev/null
@@ -1,65 +0,0 @@
-hook global BufCreate .*\.java %{
- set-option buffer filetype java
-}
-
-add-highlighter shared/java regions
-add-highlighter shared/java/code default-region group
-add-highlighter shared/java/string region %{(?<!')"} %{(?<!\\)(\\\\)*"} fill string
-add-highlighter shared/java/comment region /\* \*/ fill comment
-add-highlighter shared/java/line_comment region // $ fill comment
-
-add-highlighter shared/java/code/ regex %{\b(this|true|false|null)\b} 0:value
-add-highlighter shared/java/code/ regex "\b(void|int|char|unsigned|float|boolean|double)\b" 0:type
-add-highlighter shared/java/code/ regex "\b(while|for|if|else|do|static|switch|case|default|class|interface|enum|goto|break|continue|return|import|try|catch|throw|new|package|extends|implements|throws|instanceof)\b" 0:keyword
-add-highlighter shared/java/code/ regex "\b(final|public|protected|private|abstract|synchronized|native|transient|volatile)\b" 0:attribute
-add-highlighter shared/java/code/ regex "(?<!\w)@\w+\b" 0:meta
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden java-indent-on-new-line %~
- evaluate-commands -draft -itersel %=
- # preserve previous line indent
- try %{ execute-keys -draft \;K<a-&> }
- # indent after lines ending with { or (
- try %[ execute-keys -draft k<a-x> <a-k> [{(]\h*$ <ret> j<a-gt> ]
- # cleanup trailing white spaces on the previous line
- try %{ execute-keys -draft k<a-x> s \h+$ <ret>d }
- # align to opening paren of previous line
- try %{ execute-keys -draft [( <a-k> \A\([^\n]+\n[^\n]*\n?\z <ret> s \A\(\h*.|.\z <ret> '<a-;>' & }
- # copy // comments prefix
- try %{ execute-keys -draft \;<c-s>k<a-x> s ^\h*\K/{2,} <ret> y<c-o>P<esc> }
- # indent after a switch's case/default statements
- try %[ execute-keys -draft k<a-x> <a-k> ^\h*(case|default).*:$ <ret> j<a-gt> ]
- # indent after keywords
- try %[ execute-keys -draft \;<a-F>)MB <a-k> \A(if|else|while|for|try|catch)\h*\(.*\)\h*\n\h*\n?\z <ret> s \A|.\z <ret> 1<a-&>1<a-space><a-gt> ]
- =
-~
-
-define-command -hidden java-indent-on-opening-curly-brace %[
- # align indent with opening paren when { is entered on a new line after the closing paren
- try %[ execute-keys -draft -itersel h<a-F>)M <a-k> \A\(.*\)\h*\n\h*\{\z <ret> s \A|.\z <ret> 1<a-&> ]
-]
-
-define-command -hidden java-indent-on-closing-curly-brace %[
- # align to opening curly brace when alone on a line
- 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-.+ }
-}
diff --git a/rc/base/javascript.kak b/rc/base/javascript.kak
deleted file mode 100644
index 4d16ee68..00000000
--- a/rc/base/javascript.kak
+++ /dev/null
@@ -1,117 +0,0 @@
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*[.](js)x? %{
- set-option buffer filetype javascript
-}
-
-hook global BufCreate .*[.](ts)x? %{
- set-option buffer filetype typescript
-}
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden javascript-trim-indent %{
- # remove trailing white spaces
- try %{ execute-keys -draft -itersel <a-x> s \h+$ <ret> d }
-}
-
-define-command -hidden javascript-indent-on-char %<
- evaluate-commands -draft -itersel %<
- # align closer token to its opener when alone on a line
- try %/ execute-keys -draft <a-h> <a-k> ^\h+[\]}]$ <ret> m s \A|.\z <ret> 1<a-&> /
- >
->
-
-define-command -hidden javascript-indent-on-new-line %<
- evaluate-commands -draft -itersel %<
- # copy // comments prefix and following white spaces
- try %{ execute-keys -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P }
- # preserve previous line indent
- try %{ execute-keys -draft \; K <a-&> }
- # filter previous line
- try %{ execute-keys -draft k : javascript-trim-indent <ret> }
- # indent after lines beginning / ending with opener token
- try %_ execute-keys -draft k <a-x> <a-k> ^\h*[[{]|[[{]$ <ret> j <a-gt> _
- >
->
-
-# Highlighting and hooks bulder for JavaScript and TypeScript
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-define-command -hidden init-javascript-filetype -params 1 %~
- # Highlighters
- # ‾‾‾‾‾‾‾‾‾‾‾‾
-
- add-highlighter "shared/%arg{1}" regions
- add-highlighter "shared/%arg{1}/code" default-region group
- add-highlighter "shared/%arg{1}/double_string" region '"' (?<!\\)(\\\\)*" fill string
- add-highlighter "shared/%arg{1}/single_string" region "'" (?<!\\)(\\\\)*' fill string
- add-highlighter "shared/%arg{1}/literal" region "`" (?<!\\)(\\\\)*` group
- add-highlighter "shared/%arg{1}/comment_line" region // '$' fill comment
- add-highlighter "shared/%arg{1}/comment" region /\* \*/ fill comment
- add-highlighter "shared/%arg{1}/shebang" region ^#! $ fill meta
- add-highlighter "shared/%arg{1}/regex" region / (?<!\\)(\\\\)*/[gimuy]* fill meta
- add-highlighter "shared/%arg{1}/jsx" region -recurse (?<![\w<])<[a-zA-Z][\w:.-]* (?<![\w<])<[a-zA-Z][\w:.-]*(?!\hextends)(?=[\s/>])(?!>\()) (</.*?>|/>) regions
- add-highlighter "shared/%arg{1}/division" region '[\w\)\]]\K(/|(\h+/\h+))' '(?=\w)' group # Help Kakoune to better detect /…/ literals
-
- # Regular expression flags are: g → global match, i → ignore case, m → multi-lines, u → unicode, y → sticky
- # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
-
- add-highlighter "shared/%arg{1}/literal/" fill string
- add-highlighter "shared/%arg{1}/literal/" regex \$\{.*?\} 0:value
-
- add-highlighter "shared/%arg{1}/code/" regex [^$_]\b(document|false|null|parent|self|this|true|undefined|window)\b 1:value
- add-highlighter "shared/%arg{1}/code/" regex "-?\b[0-9]*\.?[0-9]+" 0:value
- add-highlighter "shared/%arg{1}/code/" regex \b(Array|Boolean|Date|Function|Number|Object|RegExp|String|Symbol)\b 0:type
-
- # jsx: In well-formed xml the number of opening and closing tags match up regardless of tag name.
- #
- # We inline a small XML highlighter here since it anyway need to recurse back up to the starting highlighter.
- # To make things simple we assume that jsx is always enabled.
-
- add-highlighter "shared/%arg{1}/jsx/tag" region -recurse < <(?=[/a-zA-Z]) (?<!=)> regions
- add-highlighter "shared/%arg{1}/jsx/expr" region -recurse \{ \{ \} ref %arg{1}
-
- add-highlighter "shared/%arg{1}/jsx/tag/base" default-region group
- add-highlighter "shared/%arg{1}/jsx/tag/double_string" region =\K" (?<!\\)(\\\\)*" fill string
- add-highlighter "shared/%arg{1}/jsx/tag/single_string" region =\K' (?<!\\)(\\\\)*' fill string
- add-highlighter "shared/%arg{1}/jsx/tag/expr" region -recurse \{ \{ \} group
-
- add-highlighter "shared/%arg{1}/jsx/tag/base/" regex (\w+) 1:attribute
- add-highlighter "shared/%arg{1}/jsx/tag/base/" regex </?([\w-$]+) 1:keyword
- add-highlighter "shared/%arg{1}/jsx/tag/base/" regex (</?|/?>) 0:meta
-
- add-highlighter "shared/%arg{1}/jsx/tag/expr/" ref %arg{1}
-
- # Keywords are collected at
- # https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#Keywords
- 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|if|import|in|instanceof|let|new|of|return|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 typescript
-
-# Highlighting specific to TypeScript
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-add-highlighter shared/typescript/code/ regex \b(array|boolean|date|number|object|regexp|string|symbol)\b 0:type
-
-# 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/base/json.kak b/rc/base/json.kak
deleted file mode 100644
index ae04c55a..00000000
--- a/rc/base/json.kak
+++ /dev/null
@@ -1,60 +0,0 @@
-# http://json.org
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*[.](json) %{
- set-option buffer filetype json
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/json regions
-add-highlighter shared/json/code default-region group
-add-highlighter shared/json/string region '"' (?<!\\)(\\\\)*" fill string
-
-add-highlighter shared/json/code/ regex \b(true|false|null|\d+(?:\.\d+)?(?:[eE][+-]?\d*)?)\b 0:value
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden json-trim-indent %{
- # remove trailing white spaces
- try %{ execute-keys -draft -itersel <a-x> s \h+$ <ret> d }
-}
-
-define-command -hidden json-indent-on-char %<
- evaluate-commands -draft -itersel %<
- # align closer token to its opener when alone on a line
- try %< execute-keys -draft <a-h> <a-k> ^\h+[]}]$ <ret> m s \A|.\z <ret> 1<a-&> >
- >
->
-
-define-command -hidden json-indent-on-new-line %<
- evaluate-commands -draft -itersel %<
- # preserve previous line indent
- try %{ execute-keys -draft \; K <a-&> }
- # filter previous line
- try %{ execute-keys -draft k : json-trim-indent <ret> }
- # indent after lines beginning with opener token
- try %< execute-keys -draft k <a-x> <a-k> ^\h*[[{] <ret> j <a-gt> >
- >
->
-
-# 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-.+ }
-}
diff --git a/rc/base/julia.kak b/rc/base/julia.kak
deleted file mode 100644
index abdf547a..00000000
--- a/rc/base/julia.kak
+++ /dev/null
@@ -1,30 +0,0 @@
-# http://julialang.org
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*\.(jl) %{
- set-option buffer filetype julia
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/julia regions
-add-highlighter shared/julia/code default-region group
-add-highlighter shared/julia/string region '"' (?<!\\)(\\\\)*" fill string
-add-highlighter shared/julia/comment region '#' '$' fill comment
-
-# taken from https://github.com/JuliaLang/julia/blob/master/contrib/julia-mode.el
-add-highlighter shared/julia/code/ regex %{\b(true|false|C_NULL|Inf|NaN|Inf32|NaN32|nothing|\b-?\d+[fdiu]?)\b} 0:value
-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
-
-# 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 }
-}
diff --git a/rc/base/lint.kak b/rc/base/lint.kak
deleted file mode 100644
index 11189315..00000000
--- a/rc/base/lint.kak
+++ /dev/null
@@ -1,176 +0,0 @@
-declare-option -docstring %{shell command to which the path of a copy of the current buffer will be passed
-The output returned by this command is expected to comply with the following format:
- {filename}:{line}:{column}: {kind}: {message}} \
- str lintcmd
-
-declare-option -hidden line-specs lint_flags
-declare-option -hidden range-specs lint_errors
-declare-option -hidden int lint_error_count
-declare-option -hidden int lint_warning_count
-
-define-command lint -docstring 'Parse the current buffer with a linter' %{
- evaluate-commands %sh{
- if [ -z "${kak_opt_lintcmd}" ]; then
- printf %s\\n 'echo -markup {Error}The `lintcmd` option is not set'
- exit 1
- fi
-
- extension=""
- if printf %s "${kak_buffile}" | grep -qE '[^/.]\.[[:alnum:]]+$'; then
- extension=".${kak_buffile##*.}"
- fi
-
- dir=$(mktemp -d "${TMPDIR:-/tmp}"/kak-lint.XXXXXXXX)
- mkfifo "$dir"/fifo
- printf '%s\n' "evaluate-commands -no-hooks write -sync $dir/buf${extension}"
-
- printf '%s\n' "evaluate-commands -draft %{
- edit! -fifo $dir/fifo -debug *lint-output*
- set-option buffer filetype make
- set-option buffer make_current_error_line 0
- hook -always -once buffer BufCloseFifo .* %{ nop %sh{ rm -r '$dir' } }
- }"
-
- { # do the parsing in the background and when ready send to the session
-
- eval "$kak_opt_lintcmd '$dir'/buf${extension}" | sort -t: -k2,2 -n > "$dir"/stderr
-
- # Flags for the gutter:
- # stamp l3|{red}█ l11|{yellow}█
- # Contextual error messages:
- # stamp 'l1.c1,l1.c1|kind:message' 'l2.c2,l2.c2|kind:message'
- awk -F: -v file="$kak_buffile" -v stamp="$kak_timestamp" -v client="$kak_client" '
- BEGIN {
- error_count = 0
- warning_count = 0
- }
- /:[1-9][0-9]*:[1-9][0-9]*: ([Ff]atal )?[Ee]rror/ {
- flags = flags " " $2 "|{red}█"
- error_count++
- }
- /:[1-9][0-9]*:[1-9][0-9]*:/ {
- if ($4 !~ /[Ee]rror/) {
- flags = flags " " $2 "|{yellow}█"
- warning_count++
- }
- }
- /:[1-9][0-9]*:[1-9][0-9]*:/ {
- kind = substr($4, 2)
- error = $2 "." $3 "," $2 "." $3 "|" kind
- msg = ""
- # fix case where $5 is not the last field because of extra colons in the message
- for (i=5; i<=NF; i++) msg = msg ":" $i
- gsub(/\|/, "\\|", msg)
- gsub("'\''", "'"''"'", msg)
- error = error msg " (col " $3 ")"
- errors = errors " '\''" error "'\''"
- }
- END {
- print "set-option \"buffer=" file "\" lint_flags " stamp flags
- gsub("~", "\\~", errors)
- print "set-option \"buffer=" file "\" lint_errors " stamp errors
- print "set-option \"buffer=" file "\" lint_error_count " error_count
- print "set-option \"buffer=" file "\" lint_warning_count " warning_count
- print "evaluate-commands -client " client " lint-show-counters"
- }
- ' "$dir"/stderr | kak -p "$kak_session"
-
- cut -d: -f2- "$dir"/stderr | awk -v bufname="${kak_bufname}" '
- /^[1-9][0-9]*:[1-9][0-9]*:/ {
- print bufname ":" $0
- }
- ' > "$dir"/fifo
-
- } >/dev/null 2>&1 </dev/null &
- }
-}
-
-define-command -hidden lint-show %{
- update-option buffer lint_errors
- evaluate-commands %sh{
- eval "set -- ${kak_opt_lint_errors}"
- shift
-
- s=""
- for i in "$@"; do
- s="${s}
-${i}"
- done
-
- printf %s\\n "${s}" | awk -v line="${kak_cursor_line}" \
- -v column="${kak_cursor_column}" \
- "/^${kak_cursor_line}\./"' {
- gsub(/"|%/, "&&")
- msg = substr($0, index($0, "|"))
- sub(/^[^ \t]+[ \t]+/, "", msg)
- printf "info -anchor %d.%d \"%s\"\n", line, column, msg
- }'
- }
-}
-
-define-command -hidden lint-show-counters %{
- echo -markup linting results:{red} %opt{lint_error_count} error(s){yellow} %opt{lint_warning_count} warning(s)
-}
-
-define-command lint-enable -docstring "Activate automatic diagnostics of the code" %{
- add-highlighter window/lint flag-lines default lint_flags
- hook window -group lint-diagnostics NormalIdle .* %{ lint-show }
- hook window -group lint-diagnostics WinSetOption lint_flags=.* %{ info; lint-show }
-}
-
-define-command lint-disable -docstring "Disable automatic diagnostics of the code" %{
- remove-highlighter window/lint
- remove-hooks window lint-diagnostics
-}
-
-define-command lint-next-error -docstring "Jump to the next line that contains an error" %{
- update-option buffer lint_errors
-
- evaluate-commands %sh{
- eval "set -- ${kak_opt_lint_errors}"
- shift
-
- for i in "$@"; do
- candidate="${i%%|*}"
- if [ "${candidate%%.*}" -gt "${kak_cursor_line}" ]; then
- range="${candidate}"
- break
- fi
- done
-
- range="${range-${1%%|*}}"
- if [ -n "${range}" ]; then
- printf 'select %s\n' "${range}"
- else
- printf 'echo -markup "{Error}no lint diagnostics"\n'
- fi
- }
-}
-
-define-command lint-previous-error -docstring "Jump to the previous line that contains an error" %{
- update-option buffer lint_errors
-
- evaluate-commands %sh{
- eval "set -- ${kak_opt_lint_errors}"
- shift
-
- for i in "$@"; do
- candidate="${i%%|*}"
-
- if [ "${candidate%%.*}" -ge "${kak_cursor_line}" ]; then
- range="${last_candidate}"
- break
- fi
-
- last_candidate="${candidate}"
- done
-
- if [ $# -ge 1 ]; then
- shift $(($# - 1))
- range="${range:-${1%%|*}}"
- printf 'select %s\n' "${range}"
- else
- printf 'echo -markup "{Error}no lint diagnostics"\n'
- fi
- }
-}
diff --git a/rc/base/lisp.kak b/rc/base/lisp.kak
deleted file mode 100644
index 378bb3c5..00000000
--- a/rc/base/lisp.kak
+++ /dev/null
@@ -1,74 +0,0 @@
-# http://common-lisp.net
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*[.](lisp) %{
- set-option buffer filetype lisp
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/lisp regions
-add-highlighter shared/lisp/code default-region group
-add-highlighter shared/lisp/string region '"' (?<!\\)(\\\\)*" fill string
-add-highlighter shared/lisp/comment region ';' '$' fill comment
-
-add-highlighter shared/lisp/code/ regex \b(nil|true|false)\b 0:value
-add-highlighter shared/lisp/code/ regex (((\Q***\E)|(///)|(\Q+++\E)){1,3})|(1[+-])|(<|>|<=|=|>=) 0:operator
-add-highlighter shared/lisp/code/ regex \b(def[a-z]+|if|do|let|lambda|catch|and|assert|while|def|do|fn|finally|let|loop|new|quote|recur|set!|throw|try|var|case|if-let|if-not|when|when-first|when-let|when-not|(cond(->|->>)?))\b 0:keyword
-add-highlighter shared/lisp/code/ regex (#?(['`:]|,@?))?\b[a-zA-Z][\w!$%&*+./:<=>?@^_~-]* 0:variable
-add-highlighter shared/lisp/code/ regex \*[a-zA-Z][\w!$%&*+./:<=>?@^_~-]*\* 0:variable
-add-highlighter shared/lisp/code/ regex (\b\d+)?\.\d+([eEsSfFdDlL]\d+)?\b 0:value
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden lisp-trim-indent %{
- # remove trailing white spaces
- try %{ execute-keys -draft -itersel <a-x> s \h+$ <ret> d }
-}
-
-declare-option \
- -docstring 'regex matching the head of forms which have options *and* indented bodies' \
- regex lisp_special_indent_forms \
- '(?:def.*|if(-.*|)|let.*|lambda|with-.*|when(-.*|))'
-
-define-command -hidden lisp-indent-on-new-line %{
- # registers: i = best align point so far; w = start of first word of form
- evaluate-commands -draft -save-regs '/"|^@iw' -itersel %{
- execute-keys -draft 'gk"iZ'
- try %{
- execute-keys -draft '[bl"i<a-Z><gt>"wZ'
-
- try %{
- # If a special form, indent another (indentwidth - 1) spaces
- execute-keys -draft '"wze<a-k>\A' %opt{lisp_special_indent_forms} '\z<ret>'
- execute-keys -draft '"wze<a-L>s.{' %sh{printf $(( kak_opt_indentwidth - 1 ))} '}\K.*<ret><a-;>;"i<a-Z><gt>'
- } catch %{
- # If not "special" form and parameter appears on line 1, indent to parameter
- execute-keys -draft '"wze<a-l>s\h\K[^\s].*<ret><a-;>;"i<a-Z><gt>'
- }
- }
- try %{ execute-keys -draft '[rl"i<a-Z><gt>' }
- try %{ execute-keys -draft '[Bl"i<a-Z><gt>' }
- execute-keys -draft ';"i<a-z>a&<space>'
- }
-}
-
-# 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-.+ }
-}
diff --git a/rc/base/lua.kak b/rc/base/lua.kak
deleted file mode 100644
index 605148e0..00000000
--- a/rc/base/lua.kak
+++ /dev/null
@@ -1,103 +0,0 @@
-# http://lua.org
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*[.](lua) %{
- set-option buffer filetype lua
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/lua regions
-add-highlighter shared/lua/code default-region group
-add-highlighter shared/lua/raw_string region -match-capture '\[(=*)\[' '\](=*)\]' fill string
-add-highlighter shared/lua/raw_comment region -match-capture '--\[(=*)\[' '\](=*)\]' fill comment
-add-highlighter shared/lua/double_string region '"' (?<!\\)(?:\\\\)*" fill string
-add-highlighter shared/lua/single_string region "'" (?<!\\)(?:\\\\)*' fill string
-add-highlighter shared/lua/comment region '--' $ fill comment
-
-add-highlighter shared/lua/code/ regex \b(and|break|do|else|elseif|end|false|for|function|goto|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b 0:keyword
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command lua-alternative-file -docstring 'Jump to the alternate file (implementation ↔ test)' %{ evaluate-commands %sh{
- case $kak_buffile in
- *spec/*_spec.lua)
- altfile=$(eval printf %s\\n $(printf %s\\n $kak_buffile | sed s+spec/+'*'/+';'s/_spec//))
- [ ! -f $altfile ] && echo "echo -markup '{Error}implementation file not found'" && exit
- ;;
- *.lua)
- path=$kak_buffile
- dirs=$(while [ $path ]; do printf %s\\n $path; path=${path%/*}; done | tail -n +2)
- for dir in $dirs; do
- altdir=$dir/spec
- if [ -d $altdir ]; then
- altfile=$altdir/$(realpath $kak_buffile --relative-to $dir | sed s+[^/]'*'/++';'s/.lua$/_spec.lua/)
- break
- fi
- done
- [ ! -d $altdir ] && echo "echo -markup '{Error}spec/ not found'" && exit
- ;;
- *)
- echo "echo -markup '{Error}alternative file not found'" && exit
- ;;
- esac
- printf %s\\n "edit $altfile"
-}}
-
-define-command -hidden lua-indent-on-char %{
- evaluate-commands -no-hooks -draft -itersel %{
- # align middle and end structures to start and indent when necessary, elseif is already covered by else
- try %{ execute-keys -draft <a-x><a-k>^\h*(else)$<ret><a-\;><a-?>^\h*(if)<ret>s\A|\z<ret>)<a-&> }
- try %{ execute-keys -draft <a-x><a-k>^\h*(end)$<ret><a-\;><a-?>^\h*(for|function|if|while)<ret>s\A|\z<ret>)<a-&> }
- }
-}
-
-define-command -hidden lua-indent-on-new-line %{
- evaluate-commands -no-hooks -draft -itersel %{
- # preserve previous line indent
- try %{ execute-keys -draft <space>K<a-&> }
- # remove trailing white spaces from previous line
- try %{ execute-keys -draft k<a-x>s\h+$<ret>d }
- # indent after start structure
- try %{ execute-keys -draft k<a-x><a-k>^\h*(else|elseif|for|function|if|while)\b<ret>j<a-gt> }
- }
-}
-
-define-command -hidden lua-insert-on-new-line %[
- evaluate-commands -no-hooks -draft -itersel %[
- # copy -- comment prefix and following white spaces
- try %{ execute-keys -draft k<a-x>s^\h*\K--\h*<ret>yghjP }
- # wisely add end structure
- evaluate-commands -save-regs x %[
- try %{ execute-keys -draft k<a-x>s^\h+<ret>"xy } catch %{ reg x '' } # Save previous line indent in register x
- try %[ execute-keys -draft k<a-x> <a-k>^<c-r>x(for|function|if|while)<ret> J}iJ<a-x> <a-K>^<c-r>x(else|end|elseif)$<ret> # Validate previous line and that it is not closed yet
- execute-keys -draft o<c-r>xend<esc> ] # auto insert end
- ]
- ]
-]
-
-# 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
- }
-}
diff --git a/rc/base/mail.kak b/rc/base/mail.kak
deleted file mode 100644
index 4323d28c..00000000
--- a/rc/base/mail.kak
+++ /dev/null
@@ -1,13 +0,0 @@
-hook global BufCreate .+\.eml %{
- set-option buffer filetype mail
-}
-
-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 <[^@>]+@.*?> 0:string
-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 }
-}
diff --git a/rc/base/markdown.kak b/rc/base/markdown.kak
deleted file mode 100644
index 18f3ccf6..00000000
--- a/rc/base/markdown.kak
+++ /dev/null
@@ -1,85 +0,0 @@
-# http://daringfireball.net/projects/markdown
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*[.](markdown|md|mkd) %{
- set-option buffer filetype markdown
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/markdown regions
-add-highlighter shared/markdown/inline default-region regions
-add-highlighter shared/markdown/inline/text default-region group
-
-evaluate-commands %sh{
- languages="
- c cabal clojure coffee cpp css cucumber d diff dockerfile fish gas go
- haml haskell html ini java javascript json julia kak kickstart latex
- lisp lua makefile markdown moon objc perl pug python ragel ruby rust
- sass scala scss sh swift toml tupfile typescript yaml sql
- "
- for lang in ${languages}; do
- printf 'add-highlighter shared/markdown/%s region -match-capture ^(\h*)```\h*%s\\b ^(\h*)``` regions\n' "${lang}" "${lang}"
- printf 'add-highlighter shared/markdown/%s/ default-region fill meta\n' "${lang}"
- [ "${lang}" = kak ] && ref=kakrc || ref="${lang}"
- printf 'add-highlighter shared/markdown/%s/inner region \A```[^\\n]*\K (?=```) ref %s\n' "${lang}" "${ref}"
- done
-}
-
-add-highlighter shared/markdown/codeblock region -match-capture \
- ^(\h*)```\h* \
- ^(\h*)```\h*$ \
- fill meta
-
-add-highlighter shared/markdown/listblock region ^\h*[-*]\s ^\h*((?=[-*])|$) regions
-add-highlighter shared/markdown/listblock/marker region \A [-*]\s fill bullet
-add-highlighter shared/markdown/listblock/content default-region ref markdown/inline
-
-add-highlighter shared/markdown/inline/code region -match-capture (`+) (`+) fill mono
-
-# Setext-style header
-add-highlighter shared/markdown/inline/text/ regex (\A|\n\n)[^\n]+\n={2,}\h*\n\h*$ 0:title
-add-highlighter shared/markdown/inline/text/ regex (\A|\n\n)[^\n]+\n-{2,}\h*\n\h*$ 0:header
-
-# Atx-style header
-add-highlighter shared/markdown/inline/text/ regex ^#[^\n]* 0:header
-
-add-highlighter shared/markdown/inline/text/ regex (?<!\*)(\*([^\s*]|([^\s*](\n?[^\n*])*[^\s*]))\*)(?!\*) 1:italic
-add-highlighter shared/markdown/inline/text/ regex (?<!_)(_([^\s_]|([^\s_](\n?[^\n_])*[^\s_]))_)(?!_) 1:italic
-add-highlighter shared/markdown/inline/text/ regex (?<!\*)(\*\*([^\s*]|([^\s*](\n?[^\n*])*[^\s*]))\*\*)(?!\*) 1:bold
-add-highlighter shared/markdown/inline/text/ regex (?<!_)(__([^\s_]|([^\s_](\n?[^\n_])*[^\s_]))__)(?!_) 1:bold
-add-highlighter shared/markdown/inline/text/ regex <(([a-z]+://.*?)|((mailto:)?[\w+-]+@[a-z]+[.][a-z]+))> 0:link
-add-highlighter shared/markdown/inline/text/ regex ^\[[^\]\n]*\]:\h*([^\n]*) 1:link
-add-highlighter shared/markdown/inline/text/ regex ^\h*(>\h*)+ 0:comment
-add-highlighter shared/markdown/inline/text/ regex \H\K\h\h$ 0:PrimarySelection
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden markdown-indent-on-new-line %{
- evaluate-commands -draft -itersel %{
- # copy block quote(s), list item prefix and following white spaces
- try %{ execute-keys -draft k <a-x> s ^\h*\K((>\h*)+([*+-]\h)?|(>\h*)*[*+-]\h)\h* <ret> y gh j P }
- # preserve previous line indent
- try %{ execute-keys -draft \; K <a-&> }
- # remove trailing white spaces
- try %{ execute-keys -draft -itersel %{ k<a-x> s \h+$ <ret> d } }
- }
-}
-
-# 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-.+ }
-}
diff --git a/rc/base/mercurial.kak b/rc/base/mercurial.kak
deleted file mode 100644
index 3f84eea2..00000000
--- a/rc/base/mercurial.kak
+++ /dev/null
@@ -1,18 +0,0 @@
-# https://www.mercurial-scm.org/
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*hg-editor-\w+\.txt$ %{
- set-option buffer filetype hg-commit
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-hook -group hg-commit-highlight global WinSetOption filetype=hg-commit %{
- add-highlighter window/ group hg-commit-highlight
- add-highlighter window/hg-commit-highlight regex '^HG:[^\n]*' 0:comment
- hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/hg-commit-highlight }
-}
diff --git a/rc/base/new-client.kak b/rc/base/new-client.kak
deleted file mode 100644
index 6ec538a9..00000000
--- a/rc/base/new-client.kak
+++ /dev/null
@@ -1,12 +0,0 @@
-define-command new -params .. -command-completion -docstring '
-new [<commands>]: create a new kakoune client
-The ''terminal'' alias is being used to determine the user''s preferred terminal emulator
-The optional arguments are passed as commands to the new client' \
-%{
- try %{
- terminal kak -c %val{session} -e "%arg{@}"
- } catch %{
- fail "The 'terminal' alias must be defined to use this command"
- }
-}
-
diff --git a/rc/base/ocaml.kak b/rc/base/ocaml.kak
deleted file mode 100644
index 0a3d49bf..00000000
--- a/rc/base/ocaml.kak
+++ /dev/null
@@ -1,38 +0,0 @@
-# http://ocaml.org
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*\.mli? %{
- set-option buffer filetype ocaml
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/ocaml regions
-add-highlighter shared/ocaml/code default-region group
-add-highlighter shared/ocaml/string region '"' (?<!\\)(\\\\)*" fill string
-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
-# ‾‾‾‾‾
-
-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
- echo "
- add-highlighter shared/ocaml/code/ regex \b($(printf $keywords | tr : '|'))\b 0:keyword
- hook global WinSetOption filetype=ocaml %{
- set-option window static_words $keywords
- }
- "
-}
diff --git a/rc/base/perl.kak b/rc/base/perl.kak
deleted file mode 100644
index e69058d3..00000000
--- a/rc/base/perl.kak
+++ /dev/null
@@ -1,114 +0,0 @@
-# https://www.perl.org/
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*\.(t|p[lm])$ %{
- set-option buffer filetype perl
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/perl regions
-add-highlighter shared/perl/code default-region group
-add-highlighter shared/perl/command region (?<!\$)(?<!\\)` (?<!\\)(\\\\)*` fill meta
-add-highlighter shared/perl/double_string region (?<!\$)(?<!\\)" (?<!\\)(\\\\)*" fill string
-add-highlighter shared/perl/single_string region (?<!\$)(?<!\\\\)' (?<!\\)(\\\\)*' fill string
-add-highlighter shared/perl/comment region (?<!\$)(?<!\\)# $ fill comment
-
-evaluate-commands %sh{
- # 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"
- attributes="END|AUTOLOAD|BEGIN|CHECK|UNITCHECK|INIT|DESTROY"
- attributes="${attributes}|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"
- attributes="${attributes}|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"
- attributes="${attributes}|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"
- attributes="${attributes}|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"
- attributes="${attributes}|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"
- 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"
- values="ARGV|STDERR|STDOUT|ARGVOUT|STDIN|__DATA__|__END__|__FILE__|__LINE__|__PACKAGE__"
-
- # Add the language's grammar to the static completion list
- printf %s\\n "hook global WinSetOption filetype=perl %{
- set-option window static_words ${keywords} ${attributes} ${values}
- }" | tr '|' ' '
-
- # Highlight keywords
- printf %s "
- add-highlighter shared/perl/code/ regex \b(${keywords})\b 0:keyword
- add-highlighter shared/perl/code/ regex \b(${attributes})\b 0:attribute
- add-highlighter shared/perl/code/ regex \b(${values})\b 0:value
- "
-}
-
-add-highlighter shared/perl/code/ regex (?!\$)-?([0-9]*\.(?!0[xXbB]))?\b([0-9]+|0[xX][0-9a-fA-F]+|0[bb][01_]+)\.?([eE][+-]?[0-9]+)?i?\b 0:value
-add-highlighter shared/perl/code/ regex %{\$!|\$"|\$#|\$\$|\$%|\$&|\$'|\$\(|\$\)|\$\*|\$\+|\$,|\$_|\$-|\$`|\$\.|\$/|\$:|\$;|\$<|\$=|\$>|\$\?|\$@|\$\[|\$\\|\$\]|\$\^|\$\||\$~|%!|@\+|@-|@_} 0:value
-add-highlighter shared/perl/code/ regex (%ENV|%INC|%OVERLOAD|%SIG|@ARGV|@INC|@LAST_MATCH_START) 0:value
-add-highlighter shared/perl/code/ regex %{%\^(H)\b} 0:value
-add-highlighter shared/perl/code/ regex \$\^(S|T|V|W|X|A|C|D|E|F|H|I|L|M|N|O|P|R)\b 0:value
-add-highlighter shared/perl/code/ regex \$\^(RE_TRIE_MAXBUF|TAINT|UNICODE|UTF8LOCALE|WARNING_BITS|WIDE_SYSTEM_CALLS|CHILD_ERROR_NATIVE|ENCODING|OPEN|RE_DEBUG_FLAGS)\b 0:value
-
-add-highlighter shared/perl/code/ regex \$[0-9]+ 0:attribute
-add-highlighter shared/perl/code/ regex \b-(B|b|C|c|d|e|f|g|k|l|M|O|o|p|r|R|S|s|T|t|u|w|W|X|x|z)\b 0:attribute
-
-add-highlighter shared/perl/code/ regex \$[a-zA-Z_][a-zA-Z0-9_]* 0:variable
-
-add-highlighter shared/perl/code/ regex \$(a|b|LAST_REGEXP_CODE_RESULT|LIST_SEPARATOR|MATCH|MULTILINE_MATCHING|NR|OFMT|OFS|ORS|OS_ERROR|OSNAME|OUTPUT_AUTO_FLUSH|OUTPUT_FIELD_SEPARATOR|OUTPUT_RECORD_SEPARATOR)\b 0:value
-add-highlighter shared/perl/code/ regex \$(LAST_REGEXP_CODE_RESULT|LIST_SEPARATOR|MATCH|MULTILINE_MATCHING|NR|OFMT|OFS|ORS|OS_ERROR|OSNAME|OUTPUT_AUTO_FLUSH|OUTPUT_FIELD_SEPARATOR|OUTPUT_RECORD_SEPARATOR|PERL_VERSION|ACCUMULATOR|PERLDB|ARG|PID|ARGV|POSTMATCH|PREMATCH|BASETIME|PROCESS_ID|CHILD_ERROR|PROGRAM_NAME|COMPILING|REAL_GROUP_ID|DEBUGGING|REAL_USER_ID|EFFECTIVE_GROUP_ID|RS|EFFECTIVE_USER_ID|SUBSCRIPT_SEPARATOR|EGID|SUBSEP|ERRNO|SYSTEM_FD_MAX|EUID|UID|EVAL_ERROR|WARNING|EXCEPTIONS_BEING_CAUGHT|EXECUTABLE_NAME|EXTENDED_OS_ERROR|FORMAT_FORMFEED|FORMAT_LINE_BREAK_CHARACTERS|FORMAT_LINES_LEFT|FORMAT_LINES_PER_PAGE|FORMAT_NAME|FORMAT_PAGE_NUMBER|FORMAT_TOP_NAME|GID|INPLACE_EDIT|INPUT_LINE_NUMBER|INPUT_RECORD_SEPARATOR|LAST_MATCH_END|LAST_PAREN_MATCH)\b 0:value
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden perl-indent-on-new-line %~
- evaluate-commands -draft -itersel %=
- # preserve previous line indent
- try %{ execute-keys -draft \;K<a-&> }
- # indent after lines ending with { or (
- try %[ execute-keys -draft k<a-x> <a-k> [{(]\h*$ <ret> j<a-gt> ]
- # cleanup trailing white spaces on the previous line
- try %{ execute-keys -draft k<a-x> s \h+$ <ret>d }
- # align to opening paren of previous line
- try %{ execute-keys -draft [( <a-k> \A\([^\n]+\n[^\n]*\n?\z <ret> s \A\(\h*.|.\z <ret> '<a-;>' & }
- # copy // comments prefix
- try %{ execute-keys -draft \;<c-s>k<a-x> s ^\h*\K/{2,} <ret> y<c-o>P<esc> }
- # indent after a switch's case/default statements
- try %[ execute-keys -draft k<a-x> <a-k> ^\h*(case|default).*:$ <ret> j<a-gt> ]
- # indent after if|else|while|for
- try %[ execute-keys -draft \;<a-F>)MB <a-k> \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z <ret> s \A|.\z <ret> 1<a-&>1<a-space><a-gt> ]
- =
-~
-
-define-command -hidden perl-indent-on-opening-curly-brace %[
- # align indent with opening paren when { is entered on a new line after the closing paren
- try %[ execute-keys -draft -itersel h<a-F>)M <a-k> \A\(.*\)\h*\n\h*\{) <ret> s \A|.\z <ret> 1<a-&> ]
-]
-
-define-command -hidden perl-indent-on-closing-curly-brace %[
- # align to opening curly brace when alone on a line
- 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-.+ }
-}
diff --git a/rc/base/restructuredtext.kak b/rc/base/restructuredtext.kak
deleted file mode 100644
index 1eaf4bfc..00000000
--- a/rc/base/restructuredtext.kak
+++ /dev/null
@@ -1,74 +0,0 @@
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*[.](rst) %{
- set-option buffer filetype restructuredtext
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/restructuredtext regions
-add-highlighter shared/restructuredtext/content default-region group
-add-highlighter shared/restructuredtext/code region ::\h*\n ^[^\s] fill meta
-
-evaluate-commands %sh{
- for ft in c cabal clojure coffee cpp css cucumber ddiff dockerfile \
- fish gas go haml haskell html ini java javascript json \
- julia kak kickstart latex lisp lua makefile moon objc \
- perl pug python ragel ruby rust sass scala scss sh swift \
- tupfile yaml; do
- if [ "$ft" = kak ]; then ref="kakrc"; else ref="$ft"; fi
- printf 'add-highlighter shared/restructuredtext/%s region %s %s ref %s\n' "$ft" '\.\.\h*'$ft'::\h*c\h*\n' '^\S' "$ref"
- done
-}
-
-# Setext-style header
-# Valid header characters:
-# # ! " $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~
-
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(#{3,}\n)?[^\n]+\n(#{3,})$ 0:title
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(!{3,}\n)?[^\n]+\n(!{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)("{3,}\n)?[^\n]+\n("{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\${3,}\n)?[^\n]+\n(\${3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(%{3,}\n)?[^\n]+\n(%{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(&{3,}\n)?[^\n]+\n(&{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)('{3,}\n)?[^\n]+\n('{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\({3,}\n)?[^\n]+\n(\({3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\){3,}\n)?[^\n]+\n(\){3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\*{3,}\n)?[^\n]+\n(\*{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\+{3,}\n)?[^\n]+\n(\+{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(,{3,}\n)?[^\n]+\n(,{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(-{3,}\n)?[^\n]+\n(-{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\.{3,}\n)?[^\n]+\n(\.{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(/{3,}\n)?[^\n]+\n(/{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(:{3,}\n)?[^\n]+\n(:{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\;{3,}\n)?[^\n]+\n(\;{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(<{3,}\n)?[^\n]+\n(<{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(={3,}\n)?[^\n]+\n(={3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(>{3,}\n)?[^\n]+\n(>{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\?{3,}\n)?[^\n]+\n(\?{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(@{3,}\n)?[^\n]+\n(@{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\[{3,}\n)?[^\n]+\n(\[{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\\{3,}\n)?[^\n]+\n(\\{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\]{3,}\n)?[^\n]+\n(\]{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\^{3,}\n)?[^\n]+\n(\^{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(_{3,}\n)?[^\n]+\n(_{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(`{3,}\n)?[^\n]+\n(`{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\{{3,}\n)?[^\n]+\n(\{{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\|{3,}\n)?[^\n]+\n(\|{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(\}{3,}\n)?[^\n]+\n(\}{3,})$ 0:header
-add-highlighter shared/restructuredtext/content/ regex (\A|\n\n)(~{3,}\n)?[^\n]+\n(~{3,})$ 0:header
-
-# Inline markup
-add-highlighter shared/restructuredtext/content/ regex [^*](\*\*([^\s*]|([^\s*][^*]*[^\s*]))\*\*)[^*] 1:bold
-add-highlighter shared/restructuredtext/content/ regex [^*](\*([^\s*]|([^\s*][^*]*[^\s*]))\*)[^*] 1:italic
-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 }
-}
diff --git a/rc/base/ruby.kak b/rc/base/ruby.kak
deleted file mode 100644
index 3e5cfcfa..00000000
--- a/rc/base/ruby.kak
+++ /dev/null
@@ -1,168 +0,0 @@
-# http://ruby-lang.org
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*(([.](rb))|(irbrc)|(pryrc)|(Brewfile)|(Capfile|[.]cap)|(Gemfile|[.]gemspec)|(Guardfile)|(Rakefile|[.]rake)|(Thorfile|[.]thor)|(Vagrantfile)) %{
- set-option buffer filetype ruby
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/ruby regions
-add-highlighter shared/ruby/code default-region group
-add-highlighter shared/ruby/double_symbol region ':"' (?<!\\)(\\\\)*" regions
-add-highlighter shared/ruby/single_symbol region ":'" (?<!\\)(\\\\)*' fill variable
-add-highlighter shared/ruby/double_string region '"' (?<!\\)(\\\\)*" regions
-add-highlighter shared/ruby/single_string region "'" (?<!\\)(\\\\)*' fill string
-add-highlighter shared/ruby/backtick region '(?<![$:])`' (?<!\\)(\\\\)*` regions
-add-highlighter shared/ruby/regex region '(?<![$:])/' (?<!\\)(\\\\)*/[imox]* regions
-add-highlighter shared/ruby/ region '#' '$' fill comment
-add-highlighter shared/ruby/ region ^=begin ^=end fill comment
-add-highlighter shared/ruby/ region -recurse \( '%[iqrswxIQRSWX]\(' \) fill meta
-add-highlighter shared/ruby/ region -recurse \{ '%[iqrswxIQRSWX]\{' \} fill meta
-add-highlighter shared/ruby/ region -recurse \[ '%[iqrswxIQRSWX]\[' \] fill meta
-add-highlighter shared/ruby/ region -recurse < '%[iqrswxIQRSWX]<' > fill meta
-add-highlighter shared/ruby/heredoc region '<<[-~]?(?!self)(\w+)' '^\h*(\w+)$' fill string
-add-highlighter shared/ruby/division region '[\w\)\]](/|(\h+/\h+))' '\w' group # Help Kakoune to better detect /…/ literals
-
-# Regular expression flags are: i → ignore case, m → multi-lines, o → only interpolate #{} blocks once, x → extended mode (ignore white spaces)
-# Literals are: i → array of symbols, q → string, r → regular expression, s → symbol, w → array of words, x → capture shell result
-
-add-highlighter shared/ruby/double_string/ default-region fill string
-add-highlighter shared/ruby/double_string/interpolation region -recurse \{ \Q#{ \} fill meta
-
-add-highlighter shared/ruby/double_symbol/ default-region fill variable
-add-highlighter shared/ruby/double_symbol/interpolation region -recurse \{ \Q#{ \} fill meta
-
-add-highlighter shared/ruby/backtick/ default-region fill meta
-add-highlighter shared/ruby/backtick/interpolation region -recurse \{ \Q#{ \} fill meta
-
-add-highlighter shared/ruby/regex/ default-region fill meta
-add-highlighter shared/ruby/regex/interpolation region -recurse \{ \Q#{ \} fill meta
-
-evaluate-commands %sh{
- # Grammar
- # Keywords are collected searching for keywords at
- # https://github.com/ruby/ruby/blob/trunk/parse.y
- keywords="alias|and|begin|break|case|class|def|defined|do|else|elsif|end"
- keywords="${keywords}|ensure|false|for|if|in|module|next|nil|not|or|private|protected|public|redo"
- keywords="${keywords}|rescue|retry|return|self|super|then|true|undef|unless|until|when|while|yield"
- attributes="attr_reader|attr_writer|attr_accessor"
- values="false|true|nil"
- meta="require|include|extend"
-
- # Add the language's grammar to the static completion list
- printf %s\\n "hook global WinSetOption filetype=ruby %{
- set-option window static_words ${keywords} ${attributes} ${values} ${meta}
- }" | tr '|' ' '
-
- # Highlight keywords
- printf %s "
- add-highlighter shared/ruby/code/ regex \b(${keywords})\b 0:keyword
- add-highlighter shared/ruby/code/ regex \b(${attributes})\b 0:attribute
- add-highlighter shared/ruby/code/ regex \b(${values})\b 0:value
- add-highlighter shared/ruby/code/ regex \b(${meta})\b 0:meta
- "
-}
-
-add-highlighter shared/ruby/code/ regex \b(\w+:(?!:))|(:?(\$(-[0FIKWadilpvw]|["'`/~&+=!$*,:.\;<>?@\\])|(\$|@@?)\w+))|((?<!:):(![~=]|=~|>[=>]?|<((=>?)|<)?|[+\-]@?|\*\*?|===?|[/`%&!^|~]|(\w+[=?!]?)|(\[\]=?)))|([A-Z]\w*|^|\h)\K::(?=[A-Z]) 0:variable
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command ruby-alternative-file -docstring 'Jump to the alternate file (implementation ↔ test)' %{ evaluate-commands %sh{
- case $kak_buffile in
- *spec/*_spec.rb)
- altfile=$(eval echo $(echo $kak_buffile | sed s+spec/+'*'/+';'s/_spec//))
- [ ! -f $altfile ] && echo "echo -markup '{Error}implementation file not found'" && exit
- ;;
- *.rb)
- path=$kak_buffile
- dirs=$(while [ $path ]; do echo $path; path=${path%/*}; done | tail -n +2)
- for dir in $dirs; do
- altdir=$dir/spec
- if [ -d $altdir ]; then
- altfile=$altdir/$(realpath $kak_buffile --relative-to $dir | sed s+[^/]'*'/++';'s/.rb$/_spec.rb/)
- break
- fi
- done
- [ ! -d $altdir ] && echo "echo -markup '{Error}spec/ not found'" && exit
- ;;
- *)
- echo "echo -markup '{Error}alternative file not found'" && exit
- ;;
- esac
- echo "edit $altfile"
-}}
-
-define-command -hidden ruby-trim-indent %{
- evaluate-commands -no-hooks -draft -itersel %{
- execute-keys <a-x>
- # remove trailing white spaces
- try %{ execute-keys -draft s \h + $ <ret> d }
- }
-}
-
-define-command -hidden ruby-indent-on-char %{
- evaluate-commands -no-hooks -draft -itersel %{
- # align middle and end structures to start
- try %{ execute-keys -draft <a-x> <a-k> ^ \h * (else|elsif) $ <ret> <a-\;> <a-?> ^ \h * (if) <ret> s \A | \z <ret> ) <a-&> }
- try %{ execute-keys -draft <a-x> <a-k> ^ \h * (when) $ <ret> <a-\;> <a-?> ^ \h * (case) <ret> s \A | \z <ret> ) <a-&> }
- try %{ execute-keys -draft <a-x> <a-k> ^ \h * (rescue) $ <ret> <a-\;> <a-?> ^ \h * (begin) <ret> s \A | \z <ret> ) <a-&> }
- try %{ execute-keys -draft <a-x> <a-k> ^ \h * (end) $ <ret> <a-\;> <a-?> ^ \h * (begin|case|class|def|do|for|if|module|unless|until|while) <ret> s \A | \z <ret> ) <a-&> }
- }
-}
-
-define-command -hidden ruby-indent-on-new-line %{
- evaluate-commands -no-hooks -draft -itersel %{
- # preserve previous line indent
- try %{ execute-keys -draft K <a-&> }
- # filter previous line
- try %{ execute-keys -draft k : ruby-trim-indent <ret> }
- # indent after start structure
- try %{ execute-keys -draft k <a-x> <a-k> ^ \h * (begin|case|class|def|do|else|elsif|ensure|for|if|module|rescue|unless|until|when|while) \b <ret> j <a-gt> }
- }
-}
-
-define-command -hidden ruby-insert-on-new-line %[
- evaluate-commands -no-hooks -draft -itersel %[
- # copy _#_ comment prefix and following white spaces
- try %{ execute-keys -draft k <a-x> s '^\h*\K#\h*' <ret> y gh j P }
- # wisely add end structure
- evaluate-commands -save-regs x %[
- try %{ execute-keys -draft k <a-x> s ^ \h + <ret> \" x y } catch %{ reg x '' }
- try %[
- evaluate-commands -draft %[
- execute-keys -draft k<a-x> <a-k>^<c-r>x(begin|case|class|def|do|for|if|module|unless|until|while)<ret> # Check if previous line opens a block
- # Check that we do not already have an end for this indent level, or that we have another block opening at that indent level first
- execute-keys -draft Ge <a-K>\A(^\n|^<c-r>x(?!begin)(?!case)(?!class)(?!def)(?!do)(?!for)(?!if)(?!module)(?!unless)(?!until)(?!while)[^\n]*\n)+<c-r>xend$<ret>
- ]
- execute-keys -draft o<c-r>xend<esc> # insert a new line with containing end
- ]
- ]
- ]
-]
-
-# 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
- }
-}
diff --git a/rc/base/rust.kak b/rc/base/rust.kak
deleted file mode 100644
index 9cbca842..00000000
--- a/rc/base/rust.kak
+++ /dev/null
@@ -1,88 +0,0 @@
-# http://rust-lang.org
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*[.](rust|rs) %{
- set-option buffer filetype rust
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/rust regions
-add-highlighter shared/rust/code default-region group
-add-highlighter shared/rust/string region %{(?<!')"} (?<!\\)(\\\\)*" fill string
-add-highlighter shared/rust/raw_string region -match-capture %{(?<!')r(#*)"} %{"(#*)} fill string
-add-highlighter shared/rust/comment region -recurse /\* /\* \*/ fill comment
-add-highlighter shared/rust/line_comment region // $ fill comment
-
-add-highlighter shared/rust/code/ regex \b[A-z0-9_]+! 0:meta
-# the number literals syntax is defined here:
-# https://doc.rust-lang.org/reference.html#number-literals
-add-highlighter shared/rust/code/ regex \b(?:self|true|false|[0-9][_0-9]*(?:\.[0-9][_0-9]*|(?:\.[0-9][_0-9]*)?E[\+\-][_0-9]+)(?:f(?:32|64))?|(?:0x[_0-9a-fA-F]+|0o[_0-7]+|0b[_01]+|[0-9][_0-9]*)(?:(?:i|u|f)(?:8|16|32|64|128|size))?)\b 0:value
-add-highlighter shared/rust/code/ regex \b(?:&&|\|\|)\b 0:operator
-# the language keywords are defined here, but many of them are reserved and unused yet:
-# https://doc.rust-lang.org/grammar.html#keywords
-add-highlighter shared/rust/code/ regex (?:#!?\[.*?\]) 0:meta
-add-highlighter shared/rust/code/ regex \b(?:let|as|fn|return|match|if|else|loop|for|in|while|break|continue|move|box|where|impl|dyn|pub|unsafe)\b 0:keyword
-add-highlighter shared/rust/code/ regex \b(?:trait|struct|enum|type|mut|ref|static|const)\b 0:attribute
-add-highlighter shared/rust/code/ regex \b(?:u8|u16|u32|u64|u128|usize|i8|i16|i32|i64|i128|isize|f32|f64|bool|char|str|Self)\b 0:type
-add-highlighter shared/rust/code/ regex \b(?:mod|crate|use|extern)\b 0:module
-add-highlighter shared/rust/code/ regex \$\w+\b 0:variable
-add-highlighter shared/rust/code/ regex "'\\\\?.'" 0:value
-add-highlighter shared/rust/code/ regex "('\w+)[^']" 1:meta
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden rust-trim-indent %{
- # remove trailing white spaces
- try %{ execute-keys -draft -itersel <a-x> s \h+$ <ret> d }
-}
-
-define-command -hidden rust-indent-on-new-line %~
- evaluate-commands -draft -itersel %<
- # copy // comments prefix and following white spaces
- try %{ execute-keys -draft k <a-x> s ^\h*\K//[!/]?\h* <ret> y gh j P }
- # preserve previous line indent
- try %{ execute-keys -draft \; K <a-&> }
- # filter previous line
- try %{ execute-keys -draft k : rust-trim-indent <ret> }
- # indent after lines ending with { or (
- try %[ execute-keys -draft k <a-x> <a-k> [{(]\h*$ <ret> j <a-gt> ]
- # align to opening paren of previous line
- try %{ execute-keys -draft [( <a-k> \A\([^\n]+\n[^\n]*\n?\z <ret> s \A\(\h*.|.\z <ret> & }
- >
-~
-
-define-command -hidden rust-indent-on-opening-curly-brace %[
- evaluate-commands -draft -itersel %_
- # align indent with opening paren when { is entered on a new line after the closing paren
- try %[ execute-keys -draft h <a-F> ) M <a-k> \A\(.*\)\h*\n\h*\{\z <ret> s \A|.\z <ret> 1<a-&> ]
- _
-]
-
-define-command -hidden rust-indent-on-closing-curly-brace %[
- evaluate-commands -draft -itersel %_
- # align to opening curly brace when alone on a line
- try %[ execute-keys -draft <a-h> <a-k> ^\h+\}$ <ret> h m s \A|.\z <ret> 1<a-&> ]
- _
-]
-
-# 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-curly-brace
- hook -once -always window WinSetOption filetype=.* %{ remove-hooks window rust-.+ }
-]
diff --git a/rc/base/scala.kak b/rc/base/scala.kak
deleted file mode 100644
index 1e62e2ad..00000000
--- a/rc/base/scala.kak
+++ /dev/null
@@ -1,75 +0,0 @@
-# http://scala-lang.org
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*[.](scala) %{
- set-option buffer filetype scala
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/scala regions
-add-highlighter shared/scala/code default-region group
-add-highlighter shared/scala/string region '"' (?<!\\)(\\\\)*" fill string
-add-highlighter shared/scala/literal region ` ` fill variable
-add-highlighter shared/scala/comment region -recurse /[*] /[*] [*]/ fill comment
-add-highlighter shared/scala/line_comment region // $ fill comment
-
-# Keywords are collected at
-# http://tutorialspoint.com/scala/scala_basic_syntax.htm
-
-add-highlighter shared/scala/code/ regex (?:\b|\W)(@\w+|import|package)\b 0:meta
-add-highlighter shared/scala/code/ regex \b(true|false|null)\b 0:value
-add-highlighter shared/scala/code/ regex \b(?:class|extends|with)\s+(\w+) 0:type
-add-highlighter shared/scala/code/ regex \b([A-Z]\w*)\b 0:type
-add-highlighter shared/scala/code/ regex (?:def|var|val)\s+(\w+) 0:variable
-add-highlighter shared/scala/code/ regex \b(become|case|catch|class|def|do|else|extends|final|finally|for|forSome|goto|if|initialize|macro|match|new|object|onTransition|return|startWith|stay|this|super|throw|trait|try|unbecome|using|val|var|when|while|with|yield)\b 0:keyword
-add-highlighter shared/scala/code/ regex \b(abstract|final|implicit|implicitly|lazy|override|private|protected|require|sealed)\b 0:attribute
-add-highlighter shared/scala/code/ regex (\[|\]|=>|<:|:>|=:=|::|&&|\|\|) 0:operator
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden scala-trim-indent %{
- # remove trailing white spaces
- try %{ execute-keys -draft -itersel <a-x> s \h+$ <ret> d }
-}
-
-define-command -hidden scala-indent-on-new-line %[
- evaluate-commands -draft -itersel %[
- # copy // comments prefix and following white spaces
- try %[ execute-keys -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P ]
- # preserve previous line indent
- try %[ execute-keys -draft \; K <a-&> ]
- # filter previous line
- try %[ execute-keys -draft k : scala-trim-indent <ret> ]
- # indent after lines ending with {
- try %[ execute-keys -draft k <a-x> <a-k> \{$ <ret> j <a-gt> ]
- ]
-]
-
-define-command -hidden scala-indent-on-closing-curly-brace %[
- evaluate-commands -draft -itersel %[
- # align to opening curly brace when alone on a line
- try %[ execute-keys -draft <a-h> <a-k> ^\h+\}$ <ret> m s \A|.\z <ret> 1<a-&> ]
- ]
-]
-
-# 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-.+ }
-]
diff --git a/rc/base/screen.kak b/rc/base/screen.kak
deleted file mode 100644
index e4ddd2e9..00000000
--- a/rc/base/screen.kak
+++ /dev/null
@@ -1,69 +0,0 @@
-# http://gnu.org/software/screen/
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-hook -group GNUscreen global KakBegin .* %sh{
- [ -z "${STY}" ] && exit
- echo "
- alias global focus screen-focus
- alias global terminal screen-terminal-vertical
- "
-}
-
-define-command screen-terminal-impl -hidden -params 3.. %{
- nop %sh{
- tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
- screen -X eval "$1" "$2"
- shift 2
- # see x11.kak for what this achieves
- args=$(
- for i in "$@"; do
- if [ "$i" = '' ]; then
- printf "'' "
- else
- printf %s "$i" | sed -e "s|'|'\\\\''|g; s|^|'|; s|$|' |"
- fi
- done
- )
- screen -X screen sh -c "${args} ; screen -X remove" < "/dev/$tty"
- }
-}
-
-define-command screen-terminal-vertical -params 1.. -shell-completion -docstring '
-screen-terminal-vertical <program> [<arguments>] [<arguments>]: create a new terminal as a screen pane
-The current pane is split into two, left and right
-The program passed as argument will be executed in the new terminal' \
-%{
- screen-terminal-impl 'split -v' 'focus right' %arg{@}
-}
-define-command screen-terminal-horizontal -params 1.. -shell-completion -docstring '
-screen-terminal-horizontal <program> [<arguments>]: create a new terminal as a screen pane
-The current pane is split into two, top and bottom
-The program passed as argument will be executed in the new terminal' \
-%{
- screen-terminal-impl 'split -h' 'focus down' %arg{@}
-}
-define-command screen-terminal-window -params 1.. -shell-completion -docstring '
-screen-terminal-window <program> [<arguments>]: create a new terminal as a screen window
-The program passed as argument will be executed in the new terminal' \
-%{
- nop %sh{
- tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
- screen -X screen "$@" < "/dev/$tty"
- }
-}
-
-define-command screen-focus -params ..1 -client-completion -docstring '
-screen-focus [<client>]: focus the given client
-If no client is passed then the current one is used' \
-%{
- evaluate-commands %sh{
- if [ $# -eq 1 ]; then
- printf %s\\n "
- evaluate-commands -client '$1' focus
- "
- elif [ -n "${kak_client_env_STY}" ]; then
- tty="$(ps -o tty ${kak_client_pid} | tail -n 1)"
- screen -X select "${kak_client_env_WINDOW}" < "/dev/$tty"
- fi
- }
-}
diff --git a/rc/base/spell.kak b/rc/base/spell.kak
deleted file mode 100644
index 10c0f915..00000000
--- a/rc/base/spell.kak
+++ /dev/null
@@ -1,121 +0,0 @@
-declare-option -hidden range-specs spell_regions
-declare-option -hidden str spell_lang
-declare-option -hidden str spell_tmp_file
-
-define-command -params ..1 \
- -docstring %{spell [<language>]: spell check the current buffer
-The first optional argument is the language against which the check will be performed
-Formats of language supported:
- - ISO language code, e.g. 'en'
- - language code above followed by a dash or underscore with an ISO country code, e.g. 'en-US'} \
- spell %{
- try %{ add-highlighter window/ ranges 'spell_regions' }
- evaluate-commands %sh{
- file=$(mktemp -d "${TMPDIR:-/tmp}"/kak-spell.XXXXXXXX)/buffer
- printf 'eval -no-hooks write -sync %s\n' "${file}"
- printf 'set-option buffer spell_tmp_file %s\n' "${file}"
- }
- evaluate-commands %sh{
- if [ $# -ge 1 ]; then
- if [ ${#1} -ne 2 ] && [ ${#1} -ne 5 ]; then
- echo "echo -markup '{Error}Invalid language code (examples of expected format: en, en_US, en-US)'"
- rm -rf "$(dirname "$kak_opt_spell_tmp_file")"
- exit 1
- else
- options="-l '$1'"
- printf 'set-option buffer spell_lang %s\n' "$1"
- fi
- fi
-
- {
- sed 's/^/^/' "$kak_opt_spell_tmp_file" | eval "aspell --byte-offsets -a $options" 2>&1 | {
- line_num=1
- regions=$kak_timestamp
- read line # drop the identification message
- while read -r line; do
- case "$line" in
- [\#\&]*)
- if expr "$line" : '^&' >/dev/null; then
- pos=$(printf %s\\n "$line" | cut -d ' ' -f 4 | sed 's/:$//')
- else
- pos=$(printf %s\\n "$line" | cut -d ' ' -f 3)
- fi
- word=$(printf %s\\n "$line" | cut -d ' ' -f 2)
- len=$(printf %s "$word" | wc -c)
- regions="$regions $line_num.$pos+${len}|Error"
- ;;
- '') line_num=$((line_num + 1));;
- \*) ;;
- *) printf 'echo -markup %%{{Error}%s}\n' "${line}" | kak -p "${kak_session}";;
- esac
- done
- printf 'set-option "buffer=%s" spell_regions %s' "${kak_bufname}" "${regions}" \
- | kak -p "${kak_session}"
- }
- rm -rf $(dirname "$kak_opt_spell_tmp_file")
- } </dev/null >/dev/null 2>&1 &
- }
-}
-
-define-command spell-clear %{
- unset-option buffer spell_regions
-}
-
-define-command spell-next %{ evaluate-commands %sh{
- anchor_line="${kak_selection_desc%%.*}"
- anchor_col="${kak_selection_desc%%,*}"
- anchor_col="${anchor_col##*.}"
-
- start_first="${kak_opt_spell_regions#* }"
- start_first="${start_first%%|*}"
- start_first="${start_first#\'}"
-
- find_next_word_desc() {
- ## XXX: the `spell` command adds sorted selection descriptions to the range
- printf %s\\n "${1}" \
- | sed -e "s/'//g" -e 's/^[0-9]* //' -e 's/|[^ ]*//g' \
- | tr ' ' '\n' \
- | while IFS=, read -r start end; do
- start_line="${start%.*}"
- start_col="${start#*.}"
- end_line="${end%.*}"
- end_col="${end#*.}"
-
- if [ "${start_line}" -lt "${anchor_line}" ]; then
- continue
- elif [ "${start_line}" -eq "${anchor_line}" ] \
- && [ "${start_col}" -le "${anchor_col}" ]; then
- continue
- fi
-
- printf 'select %s,%s\n' "${start}" "${end}"
- break
- done
- }
-
- # no selection descriptions are in `spell_regions`
- if ! expr "${start_first}" : '[0-9][0-9]*\.[0-9][0-9]*,[0-9][0-9]*\.[0-9]' >/dev/null; then
- exit
- fi
-
- next_word_desc=$(find_next_word_desc "${kak_opt_spell_regions}")
- if [ -n "${next_word_desc}" ]; then
- printf %s\\n "${next_word_desc}"
- else
- printf 'select %s\n' "${start_first}"
- fi
-} }
-
-define-command spell-replace %{ evaluate-commands %sh{
- if [ -n "$kak_opt_spell_lang" ]; then
- options="-l '$kak_opt_spell_lang'"
- fi
- suggestions=$(printf %s "$kak_selection" | eval "aspell -a $options" | grep '^&' | cut -d: -f2)
- menu=$(printf %s "${suggestions#?}" | awk -F', ' '
- {
- for (i=1; i<=NF; i++)
- printf "%s", "%{"$i"}" "%{execute-keys -itersel %{c"$i"<esc>be}}"
- }
- ')
- printf 'try %%{ menu -auto-single %s }' "${menu}"
-} }
diff --git a/rc/base/sql.kak b/rc/base/sql.kak
deleted file mode 100644
index dbecea9c..00000000
--- a/rc/base/sql.kak
+++ /dev/null
@@ -1,107 +0,0 @@
-# https://www.w3schools.com/sql/default.asp
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*/?(?i)sql %{
- set-option buffer filetype sql
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/sql regions
-add-highlighter shared/sql/code default-region group
-add-highlighter shared/sql/double_string region '"' (?<!\\)(\\\\)*" fill string
-add-highlighter shared/sql/single_string region "'" (?<!\\)(\\\\)*' fill string
-add-highlighter shared/sql/comment1 region '--' '$' fill comment
-add-highlighter shared/sql/comment2 region '#' '$' fill comment
-add-highlighter shared/sql/comment3 region '/\*' '\*/' fill comment
-
-evaluate-commands %sh{
- # Keywords
- keywords="ALTER|AS|ASC|AUTO_INCREMENT|CHECK|CONSTRAINT|CREATE|DATABASE|DEFAULT|DELETE|DESC|DISTINCT|DROP"
- keywords="${keywords}|EXISTS|FOREIGN KEY|FROM|FULL JOIN|FULL OUTER JOIN|GROUP BY|HAVING|INDEX|INNER JOIN"
- keywords="${keywords}|INSERT INTO|INTO|JOIN|LEFT JOIN|LEFT OUTER JOIN|LIMIT|MODIFY|NOT NULL|ON|ORDER BY|PRIMARY KEY"
- keywords="${keywords}|REFERENCES|RIGHT JOIN|RIGHT OUTER JOIN|SELECT|SELECT TOP|SET|TABLE|TRUNCATE|UNION|UNIQUE"
- keywords="${keywords}|UPDATE|VALUES|VIEW|WHERE"
-
- # Operators
- operators="ALL|AND|ANY|BETWEEN|EXISTS|IN|IS|LIKE|NOT|OR|SOME"
-
- # MySQL functions
- functions="ABS|ACOS|ADDDATE|ADDTIME|ASCII|ASIN|ATAN|AVG|BIN|BINARY|CASE|CAST|CEIL|CEILING"
- functions="${functions}|CHARACTER_LENGTH|CHAR_LENGTH|COALESCE|CONCAT|CONCAT_WS|CONNECTION_ID|CONV|CONVERT"
- functions="${functions}|COS|COT|COUNT|CURDATE|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER"
- functions="${functions}|CURTIME|DATABASE|DATE|DATE_ADD|DATEDIFF|DATE_FORMAT|DATE_SUB|DAY|DAYNAME"
- functions="${functions}|DAYOFMONTH|DAYOFWEEK|DAYOFYEAR|DEGREES|DIV|EXP|EXTRACT|FIELD|FIND_IN_SET|FLOOR"
- functions="${functions}|FORMAT|FROM_DAYS|GREATEST|HOUR|IF|IFNULL|INSERT|INSTR|ISNULL|LAST_DAY"
- functions="${functions}|LAST_INSERT_ID|LCASE|LEAST|LEFT|LENGTH|LN|LOCALTIME|LOCALTIMESTAMP|LOCATE|LOG"
- functions="${functions}|LOWER|LPAD|LTRIM|MAKEDATE|MAKETIME|MAX|MICROSECOND|MID|MIN|MINUTE|MOD|MONTH"
- functions="${functions}|MONTHNAME|NOW|NULLIF|PERIOD_ADD|PERIOD_DIFF|PI|POSITION|POW|POWER|QUARTER|RADIANS"
- functions="${functions}|RAND|REPEAT|REPLACE|REVERSE|RIGHT|ROUND|RPAD|RTRIM|SECOND|SEC_TO_TIME|SESSION_USER"
- functions="${functions}|SIGN|SIN|SPACE|SQRT|STRCMP|STR_TO_DATE|SUBDATE|SUBSTR|SUBSTRING|SUBSTRING_INDEX"
- functions="${functions}|SUBTIME|SUM|SYSDATE|SYSTEM_USER|TAN|TIME|TIMEDIFF|TIME_FORMAT|TIMESTAMP"
- functions="${functions}|TIME_TO_SEC|TO_DAYS|TRIM|TRUNCATE|UCASE|UPPER|USER|VERSION|WEEK|WEEKDAY|WEEKOFYEAR"
- functions="${functions}|YEAR|YEARWEEK"
-
- # SQL Server functions
- functions="${functions}|CHAR|CHARINDEX|DATALENGTH|DATEADD|DATENAME|DATEPART|GETDATE|GETUTCDATE|ISDATE"
- functions="${functions}|ISNUMERIC|LEN|NCHAR|PATINDEX|SESSIONPROPERTY|STR|STUFF|USER_NAME"
-
- # MS Access functions
- functions="${functions}|Abs|Asc|Atn|Avg|Chr|Cos|Count|CurDir|CurrentUser|Date|DateAdd|DateDiff|DatePart"
- functions="${functions}|DateSerial|DateValue|Day|Environ|Exp|Fix|Format|Hour|InStr|InstrRev|Int|IsDate"
- functions="${functions}|IsNull|IsNumeric|LCase|Left|Len|LTrim|Max|Mid|Min|Minute|Month|MonthName|Now"
- functions="${functions}|Randomize|Replace|Right|Rnd|Round|RTrim|Second|Sgn|Space|Split|Sqr|Str|StrComp"
- functions="${functions}|StrConv|StrReverse|Sum|Time|TimeSerial|TimeValue|Trim|UCase|Val|Weekday"
- functions="${functions}|WeekdayName|Year"
-
- # Oracle functions
- functions="${functions}|ADD_MONTHS|ASCIISTR|BITAND|CHR|COMPOSE|COSH|DBTIMEZONE|DECOMPOSE|DUMP|INITCAP|INSTRB"
- functions="${functions}|INSTRC|LENGTHB|LENGTHC|MEDIAN|MONTHS_BETWEEN|NCHR|NEW_TIME|NEXT_DAY|REGEXP_COUNT"
- functions="${functions}|REGEXP_INSTR|REGEXP_REPLACE|REGEXP_SUBSTR|REMAINDER|ROWNUM|SESSIONTIMEZONE|SOUNDEX"
- functions="${functions}|SYSTIMESTAMP|TANH|TRANSLATE|TRUNC|TZ_OFFSET|VSIZE"
-
- # MySQL data types
- data_types="LONGBLOB|LONGTEXT|MEDIUMBLOB|MEDIUMTEXT|SET|TEXT|TINYTEXT"
- data_types_fn="BIGINT|BLOB|CHAR|DATE|DATETIME|DECIMAL|DOUBLE|ENUM|FLOAT|INT"
- data_types_fn="${data_types_fn}|MEDIUMINT|SMALLINT|TIME|TIMESTAMP|TINYINT|VARCHAR|YEAR"
-
- # SQL Server data types
- data_types="${data_types}|bigint|bit|cursor|date|datetime|datetime2|datetimeoffset|image|int|money|nchar|ntext"
- data_types="${data_types}|nvarchar|real|smalldatetime|smallint|smallmoney|sql_variant|table|text|time"
- data_types="${data_types}|timestamp|tinyint|uniqueidentifier|varbinary|xml"
- data_types_fn="${data_types_fn}|binary|char|decimal|float|numeric|nvarchar|varbinary|varchar|varchar"
-
- # MS Access data types
- data_types="${data_types}|Text|Memo|Byte|Integer|Long|Single|Double|Currency|AutoNumber|Date"
- data_types="${data_types}|Time|Ole Object|Hyperlink|Lookup Wizard"
-
- # Add the language's grammar to the static completion list
- printf %s\\n "hook global WinSetOption filetype=sql %{
- set-option window static_words ${keywords} ${operators} ${functions} ${data_types} ${data_types_fn} NULL
- }" | tr '|' ' '
-
- # Highlight keywords
- printf %s "
- add-highlighter shared/sql/code/ regex '(?i)\b(${functions})\(.*\)' 0:function
- add-highlighter shared/sql/code/ regex '(?i)\b(${data_types_fn})\(.*?\)' 0:type
- add-highlighter shared/sql/code/ regex '(?i)\b(${keywords})\b' 0:keyword
- add-highlighter shared/sql/code/ regex '(?i)\b(${operators})\b' 0:operator
- add-highlighter shared/sql/code/ regex '(?i)\b(${data_types})\b' 0:type
- "
-}
-
-add-highlighter shared/sql/code/ regex '\+|-|\*|/|%|&|\||^|=|>|<|>=|<=|<>|\+=|-=|\*=|/=|%=|&=|^-=|\|\*=' 0:operator
-add-highlighter shared/sql/code/ regex \bNULL\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 }
-}
diff --git a/rc/base/swift.kak b/rc/base/swift.kak
deleted file mode 100644
index 1526cadb..00000000
--- a/rc/base/swift.kak
+++ /dev/null
@@ -1,28 +0,0 @@
-hook global BufCreate .*\.(swift) %{
- set-option buffer filetype swift
-}
-
-add-highlighter shared/swift regions
-add-highlighter shared/swift/code default-region group
-add-highlighter shared/swift/string region %{(?<!')"} %{(?<!\\)(\\\\)*"} fill string
-add-highlighter shared/swift/comment region /\* \*/ group
-add-highlighter shared/swift/line_comment region // $ ref swift/comment
-
-add-highlighter shared/swift/comment/ fill comment
-add-highlighter shared/swift/comment/ regex "\b(TODO|XXX|MARK)\b" 0:red
-
-add-highlighter shared/swift/code/ regex %{\b(true|false|nil)\b|\b-?(?!\$)\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
-add-highlighter shared/swift/code/ regex "\b(let|var|while|in|for|if|else|do|switch|case|default|break|continue|return|try|catch|throw|new|delete|and|or|not|operator|explicit|func|import|return|init|deinit|get|set)\b" 0:keyword
-add-highlighter shared/swift/code/ regex "\bas\b[!?]?" 0:keyword
-add-highlighter shared/swift/code/ regex "(\$[0-9])\b" 0:keyword
-add-highlighter shared/swift/code/ regex "\b(const|mutable|auto|namespace|inline|static|volatile|class|struct|enum|union|public|protected|private|typedef|virtual|friend|extern|typename|override|final|required|convenience|dynamic)\b" 0:attribute
-
-add-highlighter shared/swift/code/ regex "\b(self|nil|id|super)\b" 0:value
-add-highlighter shared/swift/code/ regex "\b(Bool|String|UInt|UInt16|UInt32|UInt64|UInt8)\b" 0:type
-add-highlighter shared/swift/code/ regex "\b(IBAction|IBOutlet)\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 }
-}
diff --git a/rc/base/tmux.kak b/rc/base/tmux.kak
deleted file mode 100644
index acc5c097..00000000
--- a/rc/base/tmux.kak
+++ /dev/null
@@ -1,61 +0,0 @@
-# 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{
- if [ -n "$TMUX" ]; then
- echo "
- alias global focus tmux-focus
- alias global terminal tmux-terminal-horizontal
- "
- fi
-}
-
-define-command -hidden -params 2.. tmux-terminal-impl %{
- evaluate-commands %sh{
- tmux=${kak_client_env_TMUX:-$TMUX}
- if [ -z "$tmux" ]; then
- echo "fail 'This command is only available in a tmux session'"
- exit
- fi
- tmux_args="$1"
- shift
- # ideally we should escape single ';' to stop tmux from interpreting it as a new command
- # but that's probably too rare to care
- TMUX=$tmux tmux $tmux_args env TMPDIR="$TMPDIR" "$@" < /dev/null > /dev/null 2>&1 &
- }
-}
-
-define-command tmux-terminal-vertical -params 1.. -shell-completion -docstring '
-tmux-terminal-vertical <program> [<arguments>]: create a new terminal as a tmux pane
-The current pane is split into two, top and bottom
-The program passed as argument will be executed in the new terminal' \
-%{
- tmux-terminal-impl 'split-window -v' %arg{@}
-}
-define-command tmux-terminal-horizontal -params 1.. -shell-completion -docstring '
-tmux-terminal-horizontal <program> [<arguments>]: create a new terminal as a tmux pane
-The current pane is split into two, left and right
-The program passed as argument will be executed in the new terminal' \
-%{
- tmux-terminal-impl 'split-window -h' %arg{@}
-}
-define-command tmux-terminal-window -params 1.. -shell-completion -docstring '
-tmux-terminal-window <program> [<arguments>] [<arguments>]: create a new terminal as a tmux window
-The program passed as argument will be executed in the new terminal' \
-%{
- tmux-terminal-impl 'new-window' %arg{@}
-}
-
-define-command tmux-focus -params ..1 -client-completion -docstring '
-tmux-focus [<client>]: focus the given client
-If no client is passed then the current one is used' \
-%{
- evaluate-commands %sh{
- if [ $# -eq 1 ]; then
- printf "evaluate-commands -client '%s' focus" "$1"
- elif [ -n "${kak_client_env_TMUX}" ]; then
- TMUX="${kak_client_env_TMUX}" tmux select-pane -t "${kak_client_env_TMUX_PANE}" > /dev/null
- fi
- }
-}
diff --git a/rc/base/x11.kak b/rc/base/x11.kak
deleted file mode 100644
index 27b637ae..00000000
--- a/rc/base/x11.kak
+++ /dev/null
@@ -1,73 +0,0 @@
-# termcmd should be set such as the next argument is the whole
-# command line to execute
-declare-option -docstring %{shell command run to spawn a new terminal
-A shell command is appended to the one set in this option at runtime} \
- str termcmd %sh{
- for termcmd in 'alacritty -e sh -c' \
- 'kitty sh -c' \
- 'termite -e ' \
- 'urxvt -e sh -c' \
- 'rxvt -e sh -c' \
- 'xterm -e sh -c' \
- 'roxterm -e sh -c' \
- 'mintty -e sh -c' \
- 'sakura -x ' \
- 'gnome-terminal -e ' \
- 'xfce4-terminal -e ' \
- 'konsole -e '; do
- terminal=${termcmd%% *}
- if command -v $terminal >/dev/null 2>&1; then
- printf %s\\n "$termcmd"
- exit
- fi
- done
-}
-
-define-command x11-terminal -params 1.. -shell-completion -docstring '
-x11-terminal <program> [<arguments>]: create a new terminal as an x11 window
-The program passed as argument will be executed in the new terminal' \
-%{
- evaluate-commands %sh{
- if [ -z "${kak_opt_termcmd}" ]; then
- echo "fail 'termcmd option is not set'"
- exit
- fi
- # join arguments into a single string, in which they're delimited
- # by single quotes, and with single quotes inside transformed to '\''
- # so that sh -c "$args" will re-split the arguments properly
- # example:
- # $1 = ab
- # $2 = foo bar
- # $3 =
- # $4 = foo'bar
- # $args = 'ab' 'foo bar' '' 'foo'\''bar'
- # would be nicer to do in a single sed/awk call but that's difficult
- args=$(
- for i in "$@"; do
- # special case to preserve empty variables as sed won't touch these
- if [ "$i" = '' ]; then
- printf "'' "
- else
- printf %s "$i" | sed -e "s|'|'\\\\''|g; s|^|'|; s|$|' |"
- fi
- done
- )
- setsid ${kak_opt_termcmd} "$args" < /dev/null > /dev/null 2>&1 &
- }
-}
-
-define-command x11-focus -params ..1 -client-completion -docstring '
-x11-focus [<kakoune_client>]: focus a given client''s window
-If no client is passed, then the current client is used' \
-%{
- evaluate-commands %sh{
- if [ $# -eq 1 ]; then
- printf "evaluate-commands -client '%s' focus" "$1"
- else
- xdotool windowactivate $kak_client_env_WINDOWID > /dev/null
- fi
- }
-}
-
-alias global focus x11-focus
-alias global terminal x11-terminal
diff --git a/rc/base/yaml.kak b/rc/base/yaml.kak
deleted file mode 100644
index 7076e13d..00000000
--- a/rc/base/yaml.kak
+++ /dev/null
@@ -1,58 +0,0 @@
-# http://yaml.org
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*[.](ya?ml) %{
- set-option buffer filetype yaml
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/yaml regions
-add-highlighter shared/yaml/code default-region group
-add-highlighter shared/yaml/double_string region '"' (?<!\\)(\\\\)*" fill string
-add-highlighter shared/yaml/single_string region "'" "'" fill string
-add-highlighter shared/yaml/comment region '#' '$' fill comment
-
-add-highlighter shared/yaml/code/ regex ^(---|\.\.\.)$ 0:meta
-add-highlighter shared/yaml/code/ regex ^(\h*:\w*) 0:keyword
-add-highlighter shared/yaml/code/ regex \b(true|false|null)\b 0:value
-add-highlighter shared/yaml/code/ regex ^\h*-?\h*(\S+): 1:attribute
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden yaml-trim-indent %{
- # remove trailing white spaces
- try %{ execute-keys -draft -itersel <a-x> s \h+$ <ret> d }
-}
-
-define-command -hidden yaml-indent-on-new-line %{
- evaluate-commands -draft -itersel %{
- # copy '#' comment prefix and following white spaces
- try %{ execute-keys -draft k <a-x> s ^\h*\K#\h* <ret> y gh j P }
- # preserve previous line indent
- try %{ execute-keys -draft \; K <a-&> }
- # filter previous line
- try %{ execute-keys -draft k : yaml-trim-indent <ret> }
- # indent after :
- try %{ execute-keys -draft <space> k x <a-k> :$ <ret> j <a-gt> }
- }
-}
-
-# 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-.+ }
-}