summaryrefslogtreecommitdiff
path: root/rc/core
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/core
parentf87e844244d5ee81e9c1ceb04c354726002ae760 (diff)
Add categories in rc/
Closes #2783
Diffstat (limited to 'rc/core')
-rw-r--r--rc/core/asciidoc.kak43
-rw-r--r--rc/core/c-family.kak437
-rw-r--r--rc/core/comment.kak180
-rw-r--r--rc/core/diff.kak13
-rw-r--r--rc/core/doc.kak165
-rw-r--r--rc/core/formatter.kak31
-rw-r--r--rc/core/grep.kak73
-rw-r--r--rc/core/kakrc.kak110
-rw-r--r--rc/core/make.kak84
-rw-r--r--rc/core/makefile.kak60
-rw-r--r--rc/core/man.kak68
-rw-r--r--rc/core/python.kak148
-rw-r--r--rc/core/sh.kak43
13 files changed, 0 insertions, 1455 deletions
diff --git a/rc/core/asciidoc.kak b/rc/core/asciidoc.kak
deleted file mode 100644
index 8bdcce07..00000000
--- a/rc/core/asciidoc.kak
+++ /dev/null
@@ -1,43 +0,0 @@
-# http://asciidoc.org/
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .+\.(a(scii)?doc|asc) %{
- set-option buffer filetype asciidoc
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/asciidoc group
-
-add-highlighter shared/asciidoc/ regex (\A|\n\n)[^\n]+\n={2,}\h*$ 0:title
-add-highlighter shared/asciidoc/ regex (\A|\n\n)[^\n]+\n-{2,}\h*$ 0:header
-add-highlighter shared/asciidoc/ regex (\A|\n\n)[^\n]+\n~{2,}\h*$ 0:header
-add-highlighter shared/asciidoc/ regex (\A|\n\n)[^\n]+\n\^{2,}\h*$ 0:header
-
-add-highlighter shared/asciidoc/ regex (\A|\n\n)=\h+[^\n]+$ 0:title
-add-highlighter shared/asciidoc/ regex (\A|\n\n)={2,}\h+[^\n]+$ 0:header
-
-add-highlighter shared/asciidoc/ regex ^\h+([-\*])\h+[^\n]*(\n\h+[^-\*]\S+[^\n]*)*$ 0:list 1:bullet
-add-highlighter shared/asciidoc/ regex ^(-{3,})\n[^\n\h].*?\n(-{3,})$ 0:block
-add-highlighter shared/asciidoc/ regex ^(={3,})\n[^\n\h].*?\n(={3,})$ 0:block
-add-highlighter shared/asciidoc/ regex ^(~{3,})\n[^\n\h].*?\n(~{3,})$ 0:block
-add-highlighter shared/asciidoc/ regex ^(\*{3,})\n[^\n\h].*?\n(\*{3,})$ 0:block
-add-highlighter shared/asciidoc/ regex \B(?:\+[^\n]+?\+|`[^\n]+?`)\B 0:mono
-add-highlighter shared/asciidoc/ regex \b_[^\n]+?_\b 0:italic
-add-highlighter shared/asciidoc/ regex \B\*[^\n]+?\*\B 0:bold
-add-highlighter shared/asciidoc/ regex ^:[-\w]+: 0:meta
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-# Initialization
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-hook -group asciidoc-highlight global WinSetOption filetype=asciidoc %{
- add-highlighter window/asciidoc ref asciidoc
- hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/asciidoc }
-}
diff --git a/rc/core/c-family.kak b/rc/core/c-family.kak
deleted file mode 100644
index 461545fb..00000000
--- a/rc/core/c-family.kak
+++ /dev/null
@@ -1,437 +0,0 @@
-hook global BufCreate .*\.(cc|cpp|cxx|C|hh|hpp|hxx|H)$ %{
- set-option buffer filetype cpp
-}
-
-hook global BufSetOption filetype=c\+\+ %{
- hook -once buffer NormalIdle '' "set-option buffer filetype cpp"
-}
-
-hook global BufCreate .*\.c$ %{
- set-option buffer filetype c
-}
-
-hook global BufCreate .*\.h$ %{
- try %{
- execute-keys -draft %{%s\b::\b|\btemplate\h*<lt>|\bclass\h+\w+|\b(typename|namespace)\b|\b(public|private|protected)\h*:<ret>}
- set-option buffer filetype cpp
- } catch %{
- set-option buffer filetype c
- }
-}
-
-hook global BufCreate .*\.m %{
- set-option buffer filetype objc
-}
-
-define-command -hidden c-family-trim-indent %{
- # remove the line if it's empty when leaving the insert mode
- try %{ execute-keys -draft <a-x> 1s^(\h+)$<ret> d }
-}
-
-define-command -hidden c-family-indent-on-newline %< evaluate-commands -draft -itersel %<
- execute-keys \;
- try %<
- # if previous line is part of a comment, do nothing
- execute-keys -draft <a-?>/\*<ret> <a-K>^\h*[^/*\h]<ret>
- > catch %<
- # else if previous line closed a paren (possibly followed by words and a comment),
- # copy indent of the opening paren line
- execute-keys -draft k<a-x> 1s(\))(\h+\w+)*\h*(\;\h*)?(?://[^\n]+)?\n\z<ret> m<a-\;>J <a-S> 1<a-&>
- > catch %<
- # else indent new lines with the same level as the previous one
- execute-keys -draft K <a-&>
- >
- # remove previous empty lines resulting from the automatic indent
- try %< execute-keys -draft k <a-x> <a-k>^\h+$<ret> Hd >
- # indent after an opening brace or parenthesis at end of line
- try %< execute-keys -draft k <a-x> s[{(]\h*$<ret> j <a-gt> >
- # indent after a label
- try %< execute-keys -draft k <a-x> s[a-zA-Z0-9_-]+:\h*$<ret> j <a-gt> >
- # indent after a statement not followed by an opening brace
- try %< execute-keys -draft k <a-x> s\)\h*(?://[^\n]+)?\n\z<ret> \
- <a-\;>mB <a-k>\A\b(if|for|while)\b<ret> <a-\;>j <a-gt> >
- try %< execute-keys -draft k <a-x> s \belse\b\h*(?://[^\n]+)?\n\z<ret> \
- j <a-gt> >
- # deindent after a single line statement end
- try %< execute-keys -draft K <a-x> <a-k>\;\h*(//[^\n]+)?$<ret> \
- K <a-x> s\)(\h+\w+)*\h*(//[^\n]+)?\n([^\n]*\n){2}\z<ret> \
- MB <a-k>\A\b(if|for|while)\b<ret> <a-S>1<a-&> >
- try %< execute-keys -draft K <a-x> <a-k>\;\h*(//[^\n]+)?$<ret> \
- K <a-x> s \belse\b\h*(?://[^\n]+)?\n([^\n]*\n){2}\z<ret> \
- <a-S>1<a-&> >
- # align to the opening parenthesis or opening brace (whichever is first)
- # on a previous line if its followed by text on the same line
- try %< evaluate-commands -draft %<
- # Go to opening parenthesis and opening brace, then select the most nested one
- try %< execute-keys [c [({],[)}] <ret> >
- # Validate selection and get first and last char
- execute-keys <a-k>\A[{(](\h*\S+)+\n<ret> <a-:><a-\;>L <a-S>
- # Remove eventual indent from new line
- try %< execute-keys -draft <space> <a-h> s\h+<ret> d >
- # Now align that new line with the opening parenthesis/brace
- execute-keys &
- > >
-> >
-
-define-command -hidden c-family-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> <a-S> 1<a-&> ]
-]
-
-define-command -hidden c-family-indent-on-closing-curly-brace %[
- # align to opening curly brace when alone on a line
- try %[ execute-keys -itersel -draft <a-h><a-:><a-k>^\h+\}$<ret>hm<a-S>1<a-&> ]
-]
-
-define-command -hidden c-family-insert-on-closing-curly-brace %[
- # add a semicolon after a closing brace if part of a class, union or struct definition
- try %[ execute-keys -itersel -draft hm<a-x>B<a-x><a-k>\A\h*(class|struct|union|enum)<ret> '<a-;>;i;<esc>' ]
-]
-
-define-command -hidden c-family-insert-on-newline %[ evaluate-commands -itersel -draft %[
- execute-keys \;
- try %[
- evaluate-commands -draft -save-regs '/"' %[
- # copy the commenting prefix
- execute-keys -save-regs '' k <a-x>1s^\h*(//+\h*)<ret> y
- try %[
- # if the previous comment isn't empty, create a new one
- execute-keys <a-x><a-K>^\h*//+\h*$<ret> j<a-x>s^\h*<ret>P
- ] catch %[
- # if there is no text in the previous comment, remove it completely
- execute-keys d
- ]
- ]
- ]
- try %[
- # if the previous line isn't within a comment scope, break
- execute-keys -draft k<a-x> <a-k>^(\h*/\*|\h+\*(?!/))<ret>
-
- # find comment opening, validate it was not closed, and check its using star prefixes
- execute-keys -draft <a-?>/\*<ret><a-H> <a-K>\*/<ret> <a-k>\A\h*/\*([^\n]*\n\h*\*)*[^\n]*\n\h*.\z<ret>
-
- try %[
- # if the previous line is opening the comment, insert star preceeded by space
- execute-keys -draft k<a-x><a-k>^\h*/\*<ret>
- execute-keys -draft i*<space><esc>
- ] catch %[
- try %[
- # if the next line is a comment line insert a star
- execute-keys -draft j<a-x><a-k>^\h+\*<ret>
- execute-keys -draft i*<space><esc>
- ] catch %[
- try %[
- # if the previous line is an empty comment line, close the comment scope
- execute-keys -draft k<a-x><a-k>^\h+\*\h+$<ret> <a-x>1s\*(\h*)<ret>c/<esc>
- ] catch %[
- # if the previous line is a non-empty comment line, add a star
- execute-keys -draft i*<space><esc>
- ]
- ]
- ]
-
- # trim trailing whitespace on the previous line
- try %[ execute-keys -draft s\h+$<ret> d ]
- # align the new star with the previous one
- execute-keys K<a-x>1s^[^*]*(\*)<ret>&
- ]
-] ]
-
-# Regions definition are the same between c++ and objective-c
-evaluate-commands %sh{
- for ft in c cpp objc; do
- if [ "${ft}" = "objc" ]; then
- maybe_at='@?'
- else
- maybe_at=''
- fi
-
- cat <<-EOF
- add-highlighter shared/$ft regions
- add-highlighter shared/$ft/code default-region group
- add-highlighter shared/$ft/string region %{$maybe_at(?<!')(?<!'\\\\)"} %{(?<!\\\\)(?:\\\\\\\\)*"} fill string
- add-highlighter shared/$ft/raw_string region -match-capture %{R"([^(]*)\\(} %{\\)([^")]*)"} fill string
- add-highlighter shared/$ft/comment region /\\* \\*/ fill comment
- add-highlighter shared/$ft/line_comment region // (?<!\\\\)(?=\\n) fill comment
- add-highlighter shared/$ft/disabled region -recurse "#\\h*if(?:def)?" ^\\h*?#\\h*if\\h+(?:0|FALSE)\\b "#\\h*(?:else|elif|endif)" fill comment
- add-highlighter shared/$ft/macro region %{^\\h*?\\K#} %{(?<!\\\\)(?=\\n)|(?=//)} group
-
- add-highlighter shared/$ft/macro/ fill meta
- add-highlighter shared/$ft/macro/ regex ^\\h*#include\\h+(\\S*) 1:module
- add-highlighter shared/$ft/macro/ regex /\\*.*?\\*/ 0:comment
- EOF
- done
-}
-
-# c specific
-add-highlighter shared/c/code/numbers regex %{\b-?(0x[0-9a-fA-F]+|\d+)([uU][lL]{0,2}|[lL]{1,2}[uU]?|[fFdDiI]|([eE][-+]?\d+))?|'((\\.)?|[^'\\])'} 0:value
-evaluate-commands %sh{
- # Grammar
- keywords='asm break case continue default do else for goto if return
- sizeof switch while offsetof alignas alignof'
- attributes='auto atomic const enum extern inline register restrict static
- struct typedef union volatile thread_local'
- types='char double float int long short signed unsigned void
- complex imaginary
- fenv_t fexcept_t
- imaxdiv_t
- lconv
- float_t double_t
- jmp_buf
- sig_atomic_t
- va_list
- memory_order atomic_flag atomic_bool atomic_char atomic_schar atomic_uchar atomic_wchar atomic_short atomic_ushort atomic_int atomic_uint atomic_long atomic_llong atomic_ulong atomic_ullong atomic_char16_t atomic_char32_t atomic_intptr_t atomic_intmax_t atomic_int8_t atomic_int16_t atomic_int32_t atomic_int64_t atomic_int_least8_t atomic_int_least16_t atomic_int_least32_t atomic_int_least64_t atomic_int_fast8_t atomic_int_fast16_t atomic_int_fast32_t atomic_int_fast64_t atomic_uintptr_t atomic_uintmax_t atomic_uint8_t atomic_uint16_t atomic_uint32_t atomic_uint64_t atomic_uint_least8_t atomic_uint_least16_t atomic_uint_least32_t atomic_uint_least64_t atomic_uint_fast8_t atomic_uint_fast16_t atomic_uint_fast32_t atomic_uint_fast64_t atomic_size_t atomic_ptrdiff_t
- bool
- ptrdiff_t size_t max_align_t wchar_t
- intptr_t intmax_t int8_t int16_t int32_t int64_t int_least8_t int_least16_t int_least32_t int_least64_t int_fast8_t int_fast16_t int_fast32_t int_fast64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t uint_least8_t uint_least16_t uint_least32_t uint_least64_t uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t
- FILE fpos_t
- div_t ldiv_t lldiv_t
- cnd_t thrd_t thrd_start_t tss_t tss_dtor_t mtx_t once_flag
- clock_t time_t timespec tm
- mbstate_t wint_t
- wctrans_t wctype_t
- char16_t char32_t
- ssize_t gid_t uid_t off_t off64_t useconds_t pid_t socklen_t'
-
- macros='assert static_assert NDEBUG
- I
- EDOM EILSEQ ERANGE errno
- FE_DIVBYZERO FE_INEXACT FE_INVALID FE_OVERFLOW FE_UNDERFLOW FE_ALL_EXCEPT FE_DOWNWARD FE_TONEAREST FE_TOWARDZERO FE_UPWARD FE_DFL_ENV
- DECIMAL_DIG FLT_ROUNDS FLT_EVAL_METHOD FLT_RADIX FLT_DIG FLT_MANT_DIG FLT_DECIMAL_DIG FLT_MIN_EXP FLT_MIN_10_EXP FLT_MAX_EXP FLT_MAX FLT_EPSILON FLT_TRUE_MIN FLT_HAS_SUBNORM DBL_DIG DBL_MANT_DIG DBL_DECIMAL_DIG DBL_MIN_EXP DBL_MIN_10_EXP DBL_MAX_EXP DBL_MAX DBL_EPSILON DBL_TRUE_MIN DBL_HAS_SUBNORM LDBL_DIG LDBL_MANT_DIG LDBL_DECIMAL_DIG LDBL_MIN_EXP LDBL_MIN_10_EXP LDBL_MAX_EXP LDBL_MAX LDBL_EPSILON LDBL_TRUE_MIN LDBL_HAS_SUBNORM
- PRIdMAX PRIdPTR PRId8 PRId16 PRId32 PRId64 PRIdLEAST8 PRIdLEAST16 PRIdLEAST32 PRIdLEAST64 PRIdFAST8 PRIdFAST16 PRIdFAST32 PRIdFAST64 PRIiMAX PRIiPTR PRIi8 PRIi16 PRIi32 PRIi64 PRIiLEAST8 PRIiLEAST16 PRIiLEAST32 PRIiLEAST64 PRIiFAST8 PRIiFAST16 PRIiFAST32 PRIiFAST64 PRIoMAX PRIoPTR PRIo8 PRIo16 PRIo32 PRIo64 PRIoLEAST8 PRIoLEAST16 PRIoLEAST32 PRIoLEAST64 PRIoFAST8 PRIoFAST16 PRIoFAST32 PRIoFAST64 PRIuMAX PRIuPTR PRIu8 PRIu16 PRIu32 PRIu64 PRIuLEAST8 PRIuLEAST16 PRIuLEAST32 PRIuLEAST64 PRIuFAST8 PRIuFAST16 PRIuFAST32 PRIuFAST64 PRIxMAX PRIxPTR PRIx8 PRIx16 PRIx32 PRIx64 PRIxLEAST8 PRIxLEAST16 PRIxLEAST32 PRIxLEAST64 PRIxFAST8 PRIxFAST16 PRIxFAST32 PRIxFAST64 PRIXMAX PRIXPTR PRIX8 PRIX16 PRIX32 PRIX64 PRIXLEAST8 PRIXLEAST16 PRIXLEAST32 PRIXLEAST64 PRIXFAST8 PRIXFAST16 PRIXFAST32 PRIXFAST64 SCNdMAX SCNdPTR SCNd8 SCNd16 SCNd32 SCNd64 SCNdLEAST8 SCNdLEAST16 SCNdLEAST32 SCNdLEAST64 SCNdFAST8 SCNdFAST16 SCNdFAST32 SCNdFAST64 SCNiMAX SCNiPTR SCNi8 SCNi16 SCNi32 SCNi64 SCNiLEAST8 SCNiLEAST16 SCNiLEAST32 SCNiLEAST64 SCNiFAST8 SCNiFAST16 SCNiFAST32 SCNiFAST64 SCNoMAX SCNoPTR SCNo8 SCNo16 SCNo32 SCNo64 SCNoLEAST8 SCNoLEAST16 SCNoLEAST32 SCNoLEAST64 SCNoFAST8 SCNoFAST16 SCNoFAST32 SCNoFAST64 SCNuMAX SCNuPTR SCNu8 SCNu16 SCNu32 SCNu64 SCNuLEAST8 SCNuLEAST16 SCNuLEAST32 SCNuLEAST64 SCNuFAST8 SCNuFAST16 SCNuFAST32 SCNuFAST64 SCNxMAX SCNxPTR SCNx8 SCNx16 SCNx32 SCNx64 SCNxLEAST8 SCNxLEAST16 SCNxLEAST32 SCNxLEAST64 SCNxFAST8 SCNxFAST16 SCNxFAST32 SCNxFAST64
- and and_eq bitand bitor compl not not_eq or or_eq xor xor_eq
- CHAR_MIN CHAR_MAX SCHAR_MIN SCHAR_MAX WCHAR_MIN WCHAR_MAX SHRT_MIN SHRT_MAX INT_MIN INT_MAX LONG_MIN LONG_MAX LLONG_MIN LLONG_MAX MB_LEN_MAX UCHAR_MAX USHRT_MAX UINT_MAX ULONG_MAX ULLONG_MAX CHAR_BIT
- LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY LC_NUMERIC LC_TIME
- HUGE_VAL HUGE_VALF HUGE_VALL INFINITY NAN FP_INFINITE FP_NAN FP_NORMAL FP_SUBNORMAL FP_ZERO FP_FAST_FMA FP_FAST_FMAF FP_FAST_FMAL FP_ILOGB0 FP_ILOGBNAN MATH_ERRNO MATH_ERREXCEPT math_errhandling isgreater isgreaterequal isless islessequal islessgreater isunordered
- setjmp
- SIG_DFL SIG_ERR SIG_IGN SIGABRT SIGFPE SIGILL SIGINT SIGSEGV SIGTERM
- va_start va_arg va_end va_copy
- ATOMIC_BOOL_LOCK_FREE ATOMIC_CHAR_LOCK_FREE ATOMIC_CHAR16_T_LOCK_FREE ATOMIC_CHAR32_T_LOCK_FREE ATOMIC_WCHAR_T_LOCK_FREE ATOMIC_SHORT_LOCK_FREE ATOMIC_INT_LOCK_FREE ATOMIC_LONG_LOCK_FREE ATOMIC_LLONG_LOCK_FREE ATOMIC_POINTER_LOCK_FREE ATOMIC_FLAG_INIT ATOMIC_VAR_INIT memory_order_relaxed memory_order_consume memory_order_acquire memory_order_release memory_order_acq_rel memory_order_seq_cst kill_dependency
- true false
- NULL
- _IOFBF _IOLBF _IONBF BUFSIZ EOF FOPEN_MAX FILENAME_MAX TMP_MAX L_tmpnam SEEK_CUR SEEK_END SEEK_SET stderr stdin stdout
- EXIT_FAILURE EXIT_SUCCESS MB_CUR_MAX RAND_MAX
- PTRDIFF_MIN PTRDIFF_MAX SIG_ATOMIC_MIN SIG_ATOMIC_MAX WINT_MIN WINT_MAX INTMAX_MIN INTMAX_MAX INTPTR_MIN INTPTR_MAX INT8_MIN INT8_MAX INT16_MIN INT16_MAX INT32_MIN INT32_MAX INT64_MIN INT64_MAX INT_LEAST8_MIN INT_LEAST8_MAX INT_LEAST16_MIN INT_LEAST16_MAX INT_LEAST32_MIN INT_LEAST32_MAX INT_LEAST64_MIN INT_LEAST64_MAX INT_FAST8_MIN INT_FAST8_MAX INT_FAST16_MIN INT_FAST16_MAX INT_FAST32_MIN INT_FAST32_MAX INT_FAST64_MIN INT_FAST64_MAX UINTMAX_MAX UINTPTR_MAX UINT8_MAX UINT16_MAX UINT32_MAX UINT64_MAX UINT_LEAST8_MAX UINT_LEAST16_MAX UINT_LEAST32_MAX UINT_LEAST64_MAX UINT_FAST8_MAX UINT_FAST16_MAX UINT_FAST32_MAX UINT_FAST64_MAX INTMAX_C INT8_C INT16_C INT32_C INT64_C UINTMAX_C UINT8_C UINT16_C UINT32_C UINT64_C
- mtx_plain mtx_recursive mtx_timed thrd_timedout thrd_success thrd_busy thrd_error thrd_nomem ONCE_FLAG_INIT TSS_DTOR_ITERATION
- CLOCKS_PER_SEC TIME_UTC
- WEOF
- noreturn
- R_OK W_OK X_OK F_OK F_LOCK F_ULOCK F_TLOCK F_TEST'
-
- join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
-
- # Add the language's grammar to the static completion list
- printf '%s\n' "hook global WinSetOption filetype=c %{
- set-option window static_words $(join "${keywords} ${attributes} ${types} ${macros}" ' ')
- }"
-
- # Highlight keywords
- printf %s "
- add-highlighter shared/c/code/keywords regex \b($(join "${keywords}" '|'))\b 0:keyword
- add-highlighter shared/c/code/attributes regex \b($(join "${attributes}" '|'))\b 0:attribute
- add-highlighter shared/c/code/types regex \b($(join "${types}" '|'))\b 0:type
- add-highlighter shared/c/code/values regex \b($(join "${macros}" '|'))\b 0:value
- "
-}
-
-# c++ specific
-
-# integer literals
-add-highlighter shared/cpp/code/ regex %{(?i)(?<!\.)\b[1-9]('?\d+)*(ul?l?|ll?u?)?\b(?!\.)} 0:value
-add-highlighter shared/cpp/code/ regex %{(?i)(?<!\.)\b0b[01]('?[01]+)*(ul?l?|ll?u?)?\b(?!\.)} 0:value
-add-highlighter shared/cpp/code/ regex %{(?i)(?<!\.)\b0('?[0-7]+)*(ul?l?|ll?u?)?\b(?!\.)} 0:value
-add-highlighter shared/cpp/code/ regex %{(?i)(?<!\.)\b0x[\da-f]('?[\da-f]+)*(ul?l?|ll?u?)?\b(?!\.)} 0:value
-
-# floating point literals
-add-highlighter shared/cpp/code/ regex %{(?i)(?<!\.)\b\d('?\d+)*\.([fl]\b|\B)(?!\.)} 0:value
-add-highlighter shared/cpp/code/ regex %{(?i)(?<!\.)\b\d('?\d+)*\.?e[+-]?\d('?\d+)*[fl]?\b(?!\.)} 0:value
-add-highlighter shared/cpp/code/ regex %{(?i)(?<!\.)(\b(\d('?\d+)*)|\B)\.\d('?[\d]+)*(e[+-]?\d('?\d+)*)?[fl]?\b(?!\.)} 0:value
-add-highlighter shared/cpp/code/ regex %{(?i)(?<!\.)\b0x[\da-f]('?[\da-f]+)*\.([fl]\b|\B)(?!\.)} 0:value
-add-highlighter shared/cpp/code/ regex %{(?i)(?<!\.)\b0x[\da-f]('?[\da-f]+)*\.?p[+-]?\d('?\d+)*)?[fl]?\b(?!\.)} 0:value
-add-highlighter shared/cpp/code/ regex %{(?i)(?<!\.)\b0x([\da-f]('?[\da-f]+)*)?\.\d('?[\d]+)*(p[+-]?\d('?\d+)*)?[fl]?\b(?!\.)} 0:value
-
-# character literals (no multi-character literals)
-add-highlighter shared/cpp/code/char regex %{(\b(u8|u|U|L)|\B)'((\\.)|[^'\\])'\B} 0:value
-
-evaluate-commands %sh{
- # Grammar
- keywords='alignas alignof and and_eq asm bitand bitor break case catch
- compl const_cast continue decltype delete do dynamic_cast
- else export for goto if new not not_eq operator or or_eq
- reinterpret_cast return sizeof static_assert static_cast switch
- throw try typedef typeid using while xor xor_eq'
- attributes='audit auto axiom const consteval constexpr default explicit
- extern final friend inline mutable noexcept override private
- protected public register requires static thread_local typename
- virtual volatile'
- entities='class concept enum namespace struct template union'
- types='bool byte char char8_t char16_t char32_t double float int long
- max_align_t nullptr_t ptrdiff_t short signed size_t unsigned void
- wchar_t'
- values='NULL false nullptr this true'
-
- join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
-
- # Add the language's grammar to the static completion list
- printf %s\\n "hook global WinSetOption filetype=cpp %{
- set-option window static_words $(join "${keywords} ${attributes} ${entities} ${types} ${values}" ' ')
- }"
-
- # Highlight keywords
- printf %s "
- add-highlighter shared/cpp/code/keywords regex \b($(join "${keywords}" '|'))\b 0:keyword
- add-highlighter shared/cpp/code/attributes regex \b($(join "${attributes} ${entities}" '|'))\b 0:attribute
- add-highlighter shared/cpp/code/types regex \b($(join "${types}" '|'))\b 0:type
- add-highlighter shared/cpp/code/values regex \b($(join "${values}" '|'))\b 0:value
- "
-}
-
-# c and c++ compiler macros
-evaluate-commands %sh{
- builtin_macros="__cplusplus|__STDC_HOSTED__|__FILE__|__LINE__|__DATE__|__TIME__|__STDCPP_DEFAULT_NEW_ALIGNMENT__"
-
- printf %s "
- add-highlighter shared/c/code/macros regex \b(${builtin_macros})\b 0:builtin
- add-highlighter shared/cpp/code/macros regex \b(${builtin_macros})\b 0:builtin
- "
-}
-
-# objective-c specific
-add-highlighter shared/objc/code/number regex %{\b-?\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:value
-
-evaluate-commands %sh{
- # Grammar
- keywords='break case continue default do else for goto if return switch
- while'
- attributes='IBAction IBOutlet __block assign auto const copy enum extern
- inline nonatomic readonly retain static strong struct typedef
- union volatile weak'
- types='BOOL CGFloat NSInteger NSString NSUInteger bool char float
- instancetype int long short signed size_t unsigned void'
- values='FALSE NO NULL TRUE YES id nil self super'
- decorators='autoreleasepool catch class end implementation interface
- property protocol selector synchronized synthesize try'
-
- join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
-
- # Add the language's grammar to the static completion list
- printf %s\\n "hook global WinSetOption filetype=objc %{
- set-option window static_words $(join "${keywords} ${attributes} ${types} ${values} ${decorators}" ' ')
- }"
-
- # Highlight keywords
- printf %s "
- add-highlighter shared/objc/code/keywords regex \b($(join "${keywords}" '|'))\b 0:keyword
- add-highlighter shared/objc/code/attributes regex \b($(join "${attributes}" '|'))\b 0:attribute
- add-highlighter shared/objc/code/types regex \b($(join "${types}" '|'))\b 0:type
- add-highlighter shared/objc/code/values regex \b($(join "${values}" '|'))\b 0:value
- add-highlighter shared/objc/code/decorators regex @($(join "${decorators}" '|'))\b 0:attribute
- "
-}
-
-hook global WinSetOption filetype=(c|cpp|objc) %[
- hook -group "%val{hook_param_capture_1}-trim-indent" window ModeChange insert:.* c-family-trim-indent
- hook -group "%val{hook_param_capture_1}-insert" window InsertChar \n c-family-insert-on-newline
- hook -group "%val{hook_param_capture_1}-indent" window InsertChar \n c-family-indent-on-newline
- hook -group "%val{hook_param_capture_1}-indent" window InsertChar \{ c-family-indent-on-opening-curly-brace
- hook -group "%val{hook_param_capture_1}-indent" window InsertChar \} c-family-indent-on-closing-curly-brace
- hook -group "%val{hook_param_capture_1}-insert" window InsertChar \} c-family-insert-on-closing-curly-brace
-
- alias window alt "%val{hook_param_capture_1}-alternative-file"
-
- hook -once -always window WinSetOption filetype=.* "
- remove-hooks window %val{hook_param_capture_1}-.+
- unalias window alt %val{hook_param_capture_1}-alternative-file
- "
-]
-
-hook -group c-highlight global WinSetOption filetype=c %{
- add-highlighter window/c ref c
- hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/c }
-}
-
-hook -group cpp-highlight global WinSetOption filetype=cpp %{
- add-highlighter window/cpp ref cpp
- hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cpp }
-}
-
-hook -group objc-highlight global WinSetOption filetype=objc %{
- add-highlighter window/objc ref objc
- hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/objc }
-}
-
-declare-option -docstring %{control the type of include guard to be inserted in empty headers
-Can be one of the following:
- ifdef: old style ifndef/define guard
- pragma: newer type of guard using "pragma once"} \
- str c_include_guard_style "ifdef"
-
-define-command -hidden c-family-insert-include-guards %{
- evaluate-commands %sh{
- case "${kak_opt_c_include_guard_style}" in
- ifdef)
- echo 'execute-keys ggi<c-r>%<ret><esc>ggxs\.<ret>c_<esc><space>A_INCLUDED<esc>ggxyppI#ifndef<space><esc>jI#define<space><esc>jI#endif<space>//<space><esc>O<esc>'
- ;;
- pragma)
- echo 'execute-keys ggi#pragma<space>once<esc>'
- ;;
- *);;
- esac
- }
-}
-
-hook -group c-family-insert global BufNewFile .*\.(h|hh|hpp|hxx|H) c-family-insert-include-guards
-
-declare-option -docstring "colon separated list of path in which header files will be looked for" \
- str-list alt_dirs '.' '..'
-
-define-command -hidden c-family-alternative-file %{
- evaluate-commands %sh{
- file="${kak_buffile##*/}"
- file_noext="${file%.*}"
- dir=$(dirname "${kak_buffile}")
-
- # Set $@ to alt_dirs
- eval "set -- ${kak_opt_alt_dirs}"
-
- case ${file} in
- *.c|*.cc|*.cpp|*.cxx|*.C|*.inl|*.m)
- for alt_dir in "$@"; do
- for ext in h hh hpp hxx H; do
- altname="${dir}/${alt_dir}/${file_noext}.${ext}"
- if [ -f ${altname} ]; then
- printf 'edit %%{%s}\n' "${altname}"
- exit
- fi
- done
- done
- ;;
- *.h|*.hh|*.hpp|*.hxx|*.H)
- for alt_dir in "$@"; do
- for ext in c cc cpp cxx C m; do
- altname="${dir}/${alt_dir}/${file_noext}.${ext}"
- if [ -f ${altname} ]; then
- printf 'edit %%{%s}\n' "${altname}"
- exit
- fi
- done
- done
- ;;
- *)
- echo "echo -markup '{Error}extension not recognized'"
- exit
- ;;
- esac
- echo "echo -markup '{Error}alternative file not found'"
- }
-}
-
-define-command c-alternative-file -docstring "Jump to the alternate c file (header/implementation)" %{
- c-family-alternative-file
-}
-define-command cpp-alternative-file -docstring "Jump to the alternate cpp file (header/implementation)" %{
- c-family-alternative-file
-}
-define-command objc-alternative-file -docstring "Jump to the alternate objc file (header/implementation)" %{
- c-family-alternative-file
-}
diff --git a/rc/core/comment.kak b/rc/core/comment.kak
deleted file mode 100644
index fbfb8267..00000000
--- a/rc/core/comment.kak
+++ /dev/null
@@ -1,180 +0,0 @@
-# Line comments
-declare-option -docstring "characters inserted at the beginning of a commented line" \
- str comment_line '#'
-
-# Block comments
-declare-option -docstring "characters inserted before a commented block" \
- str comment_block_begin
-declare-option -docstring "characters inserted after a commented block" \
- str comment_block_end
-
-# Default comments for all languages
-hook global BufSetOption filetype=asciidoc %{
- set-option buffer comment_block_begin '///'
- set-option buffer comment_block_end '///'
-}
-
-hook global BufSetOption filetype=(c|cpp|dart|go|java|javascript|objc|php|rust|sass|scala|scss|swift|typescript) %{
- set-option buffer comment_line '//'
- set-option buffer comment_block_begin '/*'
- set-option buffer comment_block_end '*/'
-}
-
-hook global BufSetOption filetype=(cabal|haskell|moon|idris|elm) %{
- set-option buffer comment_line '--'
- set-option buffer comment_block_begin '{-'
- set-option buffer comment_block_end '-}'
-}
-
-hook global BufSetOption filetype=clojure %{
- set-option buffer comment_line '#_'
- set-option buffer comment_block_begin '(comment '
- set-option buffer comment_block_end ')'
-}
-
-hook global BufSetOption filetype=coffee %{
- set-option buffer comment_block_begin '###'
- set-option buffer comment_block_end '###'
-}
-
-hook global BufSetOption filetype=css %{
- set-option buffer comment_line ''
- set-option buffer comment_block_begin '/*'
- set-option buffer comment_block_end '*/'
-}
-
-hook global BufSetOption filetype=d %{
- set-option buffer comment_line '//'
- set-option buffer comment_block_begin '/+'
- set-option buffer comment_block_end '+/'
-}
-
-hook global BufSetOption filetype=(gas|ini) %{
- set-option buffer comment_line ';'
-}
-
-hook global BufSetOption filetype=haml %{
- set-option buffer comment_line '-#'
-}
-
-hook global BufSetOption filetype=(html|xml) %{
- set-option buffer comment_line ''
- set-option buffer comment_block_begin '<!--'
- set-option buffer comment_block_end '-->'
-}
-
-hook global BufSetOption filetype=latex %{
- set-option buffer comment_line '%'
-}
-
-hook global BufSetOption filetype=lisp %{
- set-option buffer comment_line ';'
- set-option buffer comment_block_begin '#|'
- set-option buffer comment_block_end '|#'
-}
-
-hook global BufSetOption filetype=lua %{
- set-option buffer comment_line '--'
- set-option buffer comment_block_begin '--[['
- set-option buffer comment_block_end ']]'
-}
-
-hook global BufSetOption filetype=markdown %{
- set-option buffer comment_line ''
- set-option buffer comment_block_begin '[//]'
- set-option buffer comment_block_end '# (:)'
-}
-
-hook global BufSetOption filetype=perl %{
- set-option buffer comment_block_begin '#['
- set-option buffer comment_block_end ']'
-}
-
-hook global BufSetOption filetype=pug %{
- set-option buffer comment_line '//'
-}
-
-hook global BufSetOption filetype=python %{
- set-option buffer comment_block_begin "'''"
- set-option buffer comment_block_end "'''"
-}
-
-hook global BufSetOption filetype=ragel %{
- set-option buffer comment_line '%%'
- set-option buffer comment_block_begin '%%{'
- set-option buffer comment_block_end '}%%'
-}
-
-hook global BufSetOption filetype=ruby %{
- set-option buffer comment_block_begin '^begin='
- set-option buffer comment_block_end '^=end'
-}
-
-define-command comment-block -docstring '(un)comment selections using block comments' %{
- evaluate-commands %sh{
- if [ -z "${kak_opt_comment_block_begin}" ] || [ -z "${kak_opt_comment_block_end}" ]; then
- echo "fail \"The 'comment_block' options are empty, could not comment the selection\""
- fi
- }
- evaluate-commands -save-regs '"/' -draft %{
- # Keep non-empty selections
- execute-keys <a-K>\A\s*\z<ret>
-
- try %{
- # Assert that the selection has been commented
- set-register / "\A\Q%opt{comment_block_begin}\E.*\Q%opt{comment_block_end}\E\n*\z"
- execute-keys "s<ret>"
- # Uncomment it
- set-register / "\A\Q%opt{comment_block_begin}\E|\Q%opt{comment_block_end}\E\n*\z"
- execute-keys s<ret>d
- } catch %{
- # Comment the selection
- set-register '"' "%opt{comment_block_begin}"
- execute-keys P
- set-register '"' "%opt{comment_block_end}"
- execute-keys p
- }
- }
-}
-
-define-command comment-line -docstring '(un)comment selected lines using line comments' %{
- evaluate-commands %sh{
- if [ -z "${kak_opt_comment_line}" ]; then
- echo "fail \"The 'comment_line' option is empty, could not comment the line\""
- fi
- }
- evaluate-commands -save-regs '"/' -draft %{
- # Select the content of the lines, without indentation
- execute-keys <a-s>gi<a-l>
-
- try %{
- # Keep non-empty lines
- execute-keys <a-K>\A\s*\z<ret>
- }
-
- try %{
- set-register / "\A\Q%opt{comment_line}\E\h?"
-
- try %{
- # See if there are any uncommented lines in the selection
- execute-keys -draft <a-K><ret>
-
- # There are uncommented lines, so comment everything
- set-register '"' "%opt{comment_line} "
- align-selections-left
- execute-keys P
- } catch %{
- # All lines were commented, so uncomment everything
- execute-keys s<ret>d
- }
- }
- }
-}
-
-define-command align-selections-left -docstring 'extend selections to the left to align with the leftmost selected column' %{
- evaluate-commands %sh{
- leftmost_column=$(echo "$kak_selections_desc" | tr ' ' '\n' | cut -d',' -f1 | cut -d'.' -f2 | sort -n | head -n1)
- aligned_selections=$(echo "$kak_selections_desc" | sed -E "s/\.[0-9]+,/.$leftmost_column,/g")
- echo "select $aligned_selections"
- }
-}
diff --git a/rc/core/diff.kak b/rc/core/diff.kak
deleted file mode 100644
index 5b4e065b..00000000
--- a/rc/core/diff.kak
+++ /dev/null
@@ -1,13 +0,0 @@
-hook global BufCreate .*\.(diff|patch) %{
- set-option buffer filetype diff
-}
-
-add-highlighter shared/diff group
-add-highlighter shared/diff/ regex "^\+[^\n]*\n" 0:green,default
-add-highlighter shared/diff/ regex "^-[^\n]*\n" 0:red,default
-add-highlighter shared/diff/ regex "^@@[^\n]*@@" 0:cyan,default
-
-hook -group diff-highlight global WinSetOption filetype=diff %{
- add-highlighter window/diff ref diff
- hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/diff }
-}
diff --git a/rc/core/doc.kak b/rc/core/doc.kak
deleted file mode 100644
index f1dbc850..00000000
--- a/rc/core/doc.kak
+++ /dev/null
@@ -1,165 +0,0 @@
-declare-option -docstring "name of the client in which documentation is to be displayed" \
- str docsclient
-
-declare-option -hidden range-specs doc_render_ranges
-declare-option -hidden range-specs doc_render_links
-declare-option -hidden range-specs doc_links
-declare-option -hidden range-specs doc_anchors
-
-define-command -hidden -params 4 doc-render-regex %{
- evaluate-commands -draft %{ try %{
- execute-keys \%s %arg{1} <ret>
- execute-keys -draft s %arg{2} <ret> d
- execute-keys "%arg{3}"
- evaluate-commands %sh{
- face="$4"
- eval "set -- $kak_selections_desc"
- for desc in "$@"; do ranges="$ranges '$desc|$face'"; done
- echo "update-option buffer doc_render_ranges"
- echo "set-option -add buffer doc_render_ranges $ranges"
- }
- } }
-}
-
-define-command -hidden doc-parse-links %{
- evaluate-commands -draft %{ try %{
- execute-keys \%s <lt><lt>(.*?),.*?<gt><gt> <ret>
- execute-keys -draft s <lt><lt>.*,|<gt><gt> <ret> d
- execute-keys H
- set-option buffer doc_links %val{timestamp}
- set-option buffer doc_render_links %val{timestamp}
- evaluate-commands -itersel %{
- set-option -add buffer doc_links "%val{selection_desc}|%reg{1}"
- set-option -add buffer doc_render_links "%val{selection_desc}|default+u"
- }
- } }
-}
-
-define-command -hidden doc-parse-anchors %{
- evaluate-commands -draft %{ try %{
- set-option buffer doc_anchors %val{timestamp}
- # Find sections as add them as imlicit anchors
- execute-keys \%s ^={2,}\h+([^\n]+)$ <ret>
- evaluate-commands -itersel %{
- set-option -add buffer doc_anchors "%val{selection_desc}|%sh{printf '%s' ""$kak_main_reg_1"" | tr '[A-Z ]' '[a-z-]'}"
- }
-
- # Parse explicit anchors and remove their text
- execute-keys \%s \[\[(.*?)\]\]\s* <ret>
- evaluate-commands -itersel %{
- set-option -add buffer doc_anchors "%val{selection_desc}|%reg{1}"
- }
- execute-keys d
- update-option buffer doc_anchors
- } }
-}
-
-define-command doc-jump-to-anchor -params 1 %{
- update-option buffer doc_anchors
- evaluate-commands %sh{
- anchor="$1"
- eval "set -- $kak_opt_doc_anchors"
-
- shift
- for range in "$@"; do
- if [ "${range#*|}" = "$anchor" ]; then
- printf '%s\n' "select '${range%|*}'; execute-keys vv"
- exit
- fi
- done
- printf "echo -markup {Error}No such anchor '%s'" "${anchor}"
- }
-}
-
-define-command doc-follow-link %{
- update-option buffer doc_links
- evaluate-commands %sh{
- eval "set -- $kak_opt_doc_links"
- for link in "$@"; do
- printf '%s\n' "$link"
- done | awk -v FS='[.,|#]' '
- BEGIN {
- l=ENVIRON["kak_cursor_line"];
- c=ENVIRON["kak_cursor_column"];
- }
- l >= $1 && c >= $2 && l <= $3 && c <= $4 {
- if (NF == 6) {
- print "doc " $5
- if ($6 != "") {
- print "doc-jump-to-anchor %{" $6 "}"
- }
- } else {
- print "doc-jump-to-anchor %{" $5 "}"
- }
- exit
- }
- '
- }
-}
-
-define-command -params 1 -hidden doc-render %{
- edit! -scratch "*doc-%sh{basename $1 .asciidoc}*"
- execute-keys "!cat %arg{1}<ret>gg"
-
- doc-parse-anchors
-
- # Join paragraphs together
- try %{
- execute-keys -draft '%S\n{2,}|(?<=\+)\n|^[^\n]+::\n|^\h*[*-]\h+<ret>' \
- <a-K>^\h*-{2,}(\n|\z)<ret> S\n\z<ret> <a-k>\n<ret> <a-j>
- }
-
- # Remove some line end markers
- try %{ execute-keys -draft \%s \h*(\+|:{2,})$ <ret> d }
-
- # Setup the doc_render_ranges option
- set-option buffer doc_render_ranges %val{timestamp}
- doc-render-regex \B(?<!\\)\*(?=\S)[^\n]+?(?<=\S)(?<!\\)\*\B \A|.\z 'H' default+b
- doc-render-regex \b(?<!\\)_(?=\S)[^\n]+?(?<=\S)(?<!\\)_\b \A|.\z 'H' default+i
- doc-render-regex \B(?<!\\)`(?=\S)[^\n]+?(?<=\S)(?<!\\)`\B \A|.\z 'H' mono
- doc-render-regex ^=\h+[^\n]+ ^=\h+ '~' title
- doc-render-regex ^={2,}\h+[^\n]+ ^={2,}\h+ '' header
- doc-render-regex ^\h*-{2,}\n\h*.*?^\h*-{2,}\n ^\h*-{2,}\n '' block
-
- doc-parse-links
-
- # Remove escaping of * and `
- try %{ execute-keys -draft \%s \\((?=\*)|(?=`)) <ret> d }
-
- set-option buffer readonly true
- add-highlighter buffer/ ranges doc_render_ranges
- add-highlighter buffer/ ranges doc_render_links
- add-highlighter buffer/ wrap -word -indent
- map buffer normal <ret> ': doc-follow-link<ret>'
-}
-
-define-command -params 1..2 \
- -shell-script-candidates %{
- if [ "$kak_token_to_complete" -eq 0 ]; then
- find "${kak_runtime}/doc/" -type f -name "*.asciidoc" | sed 's,.*/,,; s/\.[^/]*$//'
- elif [ "$kak_token_to_complete" -eq 1 ]; then
- readonly page="${kak_runtime}/doc/${1}.asciidoc"
- if [ -f "${page}" ]; then
- awk '
- /^==+ +/ { sub(/^==+ +/, ""); print }
- /^\[\[[^\]]+\]\]/ { sub(/^\[\[/, ""); sub(/\]\].*/, ""); print }
- ' < $page | tr '[A-Z ]' '[a-z-]'
- fi
- fi
- } \
- doc -docstring %{doc <topic> [<keyword>]: open a buffer containing documentation about a given topic
-An optional keyword argument can be passed to the function, which will be automatically selected in the documentation} %{
- evaluate-commands %sh{
- readonly page="${kak_runtime}/doc/${1}.asciidoc"
- if [ -f "${page}" ]; then
- if [ $# -eq 2 ]; then
- jump_cmd="doc-jump-to-anchor '$2'"
- fi
- printf %s\\n "evaluate-commands -try-client %opt{docsclient} %{ doc-render ${page}; ${jump_cmd} }"
- else
- printf %s\\n "echo -markup '{Error}No such doc file: ${page}'"
- fi
- }
-}
-
-alias global help doc
diff --git a/rc/core/formatter.kak b/rc/core/formatter.kak
deleted file mode 100644
index 40c38444..00000000
--- a/rc/core/formatter.kak
+++ /dev/null
@@ -1,31 +0,0 @@
-declare-option -docstring "shell command to which the contents of the current buffer is piped" \
- str formatcmd
-
-define-command format -docstring "Format the contents of the current buffer" %{ evaluate-commands -draft -no-hooks %{
- evaluate-commands %sh{
- if [ -n "${kak_opt_formatcmd}" ]; then
- path_file_tmp=$(mktemp "${TMPDIR:-/tmp}"/kak-formatter-XXXXXX)
- printf %s\\n "
- write -sync \"${path_file_tmp}\"
-
- evaluate-commands %sh{
- readonly path_file_out=\$(mktemp \"${TMPDIR:-/tmp}\"/kak-formatter-XXXXXX)
-
- if cat \"${path_file_tmp}\" | eval \"${kak_opt_formatcmd}\" > \"\${path_file_out}\"; then
- printf '%s\\n' \"execute-keys \\%|cat<space>'\${path_file_out}'<ret>\"
- printf '%s\\n' \"nop %sh{ rm -f '\${path_file_out}' }\"
- else
- printf '%s\\n' \"
- evaluate-commands -client '${kak_client}' echo -markup '{Error}formatter returned an error (\$?)'
- \"
- rm -f \"\${path_file_out}\"
- fi
-
- rm -f \"${path_file_tmp}\"
- }
- "
- else
- printf '%s\n' "evaluate-commands -client '${kak_client}' echo -markup '{Error}formatcmd option not specified'"
- fi
- }
-} }
diff --git a/rc/core/grep.kak b/rc/core/grep.kak
deleted file mode 100644
index 9e6ed5ab..00000000
--- a/rc/core/grep.kak
+++ /dev/null
@@ -1,73 +0,0 @@
-declare-option -docstring "shell command run to search for subtext in a file/directory" \
- str grepcmd 'grep -RHn'
-declare-option -docstring "name of the client in which utilities display information" \
- str toolsclient
-declare-option -hidden int grep_current_line 0
-
-define-command -params .. -file-completion \
- -docstring %{grep [<arguments>]: grep utility wrapper
-All the optional arguments are forwarded to the grep utility} \
- grep %{ evaluate-commands %sh{
- output=$(mktemp -d "${TMPDIR:-/tmp}"/kak-grep.XXXXXXXX)/fifo
- mkfifo ${output}
- if [ $# -gt 0 ]; then
- ( ${kak_opt_grepcmd} "$@" | tr -d '\r' > ${output} 2>&1 ) > /dev/null 2>&1 < /dev/null &
- else
- ( ${kak_opt_grepcmd} "${kak_selection}" | tr -d '\r' > ${output} 2>&1 ) > /dev/null 2>&1 < /dev/null &
- fi
-
- printf %s\\n "evaluate-commands -try-client '$kak_opt_toolsclient' %{
- edit! -fifo ${output} -scroll *grep*
- set-option buffer filetype grep
- set-option buffer grep_current_line 0
- hook -always -once buffer BufCloseFifo .* %{ nop %sh{ rm -r $(dirname ${output}) } }
- }"
-}}
-
-hook -group grep-highlight global WinSetOption filetype=grep %{
- add-highlighter window/grep group
- add-highlighter window/grep/ regex "^((?:\w:)?[^:\n]+):(\d+):(\d+)?" 1:cyan 2:green 3:green
- add-highlighter window/grep/ line %{%opt{grep_current_line}} default+b
- hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/grep }
-}
-
-hook global WinSetOption filetype=grep %{
- hook buffer -group grep-hooks NormalKey <ret> grep-jump
- hook -once -always window WinSetOption filetype=.* %{ remove-hooks buffer grep-hooks }
-}
-
-declare-option -docstring "name of the client in which all source code jumps will be executed" \
- str jumpclient
-
-define-command -hidden grep-jump %{
- evaluate-commands %{ # use evaluate-commands to ensure jumps are collapsed
- try %{
- execute-keys '<a-x>s^((?:\w:)?[^:]+):(\d+):(\d+)?<ret>'
- set-option buffer grep_current_line %val{cursor_line}
- evaluate-commands -try-client %opt{jumpclient} edit -existing %reg{1} %reg{2} %reg{3}
- try %{ focus %opt{jumpclient} }
- }
- }
-}
-
-define-command grep-next-match -docstring 'Jump to the next grep match' %{
- evaluate-commands -try-client %opt{jumpclient} %{
- buffer '*grep*'
- # First jump to enf of buffer so that if grep_current_line == 0
- # 0g<a-l> will be a no-op and we'll jump to the first result.
- # Yeah, thats ugly...
- execute-keys "ge %opt{grep_current_line}g<a-l> /^[^:]+:\d+:<ret>"
- grep-jump
- }
- try %{ evaluate-commands -client %opt{toolsclient} %{ execute-keys gg %opt{grep_current_line}g } }
-}
-
-define-command grep-previous-match -docstring 'Jump to the previous grep match' %{
- evaluate-commands -try-client %opt{jumpclient} %{
- buffer '*grep*'
- # See comment in grep-next-match
- execute-keys "ge %opt{grep_current_line}g<a-h> <a-/>^[^:]+:\d+:<ret>"
- grep-jump
- }
- try %{ evaluate-commands -client %opt{toolsclient} %{ execute-keys gg %opt{grep_current_line}g } }
-}
diff --git a/rc/core/kakrc.kak b/rc/core/kakrc.kak
deleted file mode 100644
index 7a9af989..00000000
--- a/rc/core/kakrc.kak
+++ /dev/null
@@ -1,110 +0,0 @@
-# http://kakoune.org
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate (.*/)?(kakrc|.*.kak) %{
- set-option buffer filetype kak
-}
-
-# Highlighters & Completion
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/kakrc regions
-add-highlighter shared/kakrc/code default-region group
-add-highlighter shared/kakrc/comment region (^|\h)\K# $ fill comment
-add-highlighter shared/kakrc/double_string region -recurse %{(?<!")("")+(?!")} %{(^|\h)\K"} %{"(?!")} group
-add-highlighter shared/kakrc/single_string region -recurse %{(?<!')('')+(?!')} %{(^|\h)\K'} %{'(?!')} group
-add-highlighter shared/kakrc/shell1 region -recurse '\{' '(^|\h)\K%?%sh\{' '\}' ref sh
-add-highlighter shared/kakrc/shell2 region -recurse '\(' '(^|\h)\K%?%sh\(' '\)' ref sh
-add-highlighter shared/kakrc/shell3 region -recurse '\[' '(^|\h)\K%?%sh\[' '\]' ref sh
-add-highlighter shared/kakrc/shell4 region -recurse '<' '(^|\h)\K%?%sh<' '>' ref sh
-add-highlighter shared/kakrc/shell5 region -recurse '\{' '(^|\h)\K-shell-script-(completion|candidates)\h+%\{' '\}' ref sh
-add-highlighter shared/kakrc/shell6 region -recurse '\(' '(^|\h)\K-shell-script-(completion|candidates)\h+%\(' '\)' ref sh
-add-highlighter shared/kakrc/shell7 region -recurse '\[' '(^|\h)\K-shell-script-(completion|candidates)\h+%\[' '\]' ref sh
-add-highlighter shared/kakrc/shell8 region -recurse '<' '(^|\h)\K-shell-script-(completion|candidates)\h+%<' '>' ref sh
-
-evaluate-commands %sh{
- # Grammar
- keywords="edit write write-all kill quit write-quit write-all-quit map unmap alias unalias
- buffer buffer-next buffer-previous delete-buffer add-highlighter remove-highlighter
- hook remove-hooks define-command echo debug source try catch fail nop
- set-option unset-option update-option declare-option execute-keys evaluate-commands
- prompt menu on-key info set-face unset-face rename-client set-register select
- change-directory rename-session colorscheme declare-user-mode enter-user-mode
- edit! write! kill! quit! write-quit! delete-buffer!"
- attributes="global buffer window current
- normal insert menu prompt goto view user object
- number-lines show-matching show-whitespaces fill regex dynregex group flag-lines
- ranges line column wrap ref regions region default-region replace-ranges"
- types="int bool str regex int-list str-list completions line-specs range-specs"
- values="default black red green yellow blue magenta cyan white yes no false true"
-
- join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
-
- # Add the language's grammar to the static completion list
- printf '%s\n' "hook global WinSetOption filetype=kak %{
- set-option window static_words $(join "${keywords} ${attributes} ${types} ${values}" ' ')'
- set-option -- window extra_word_chars '_' '-'
- }"
-
- # Highlight keywords (which are always surrounded by whitespace)
- printf '%s\n' "add-highlighter shared/kakrc/code/keywords regex (?:\s|\A)\K($(join "${keywords}" '|'))(?:(?=\s)|\z) 0:keyword
- add-highlighter shared/kakrc/code/attributes regex (?:\s|\A)\K($(join "${attributes}" '|'))(?:(?=\s)|\z) 0:attribute
- add-highlighter shared/kakrc/code/types regex (?:\s|\A)\K($(join "${types}" '|'))(?:(?=\s)|\z) 0:type
- add-highlighter shared/kakrc/code/values regex (?:\s|\A)\K($(join "${values}" '|'))(?:(?=\s)|\z) 0:value"
-}
-
-add-highlighter shared/kakrc/code/colors regex \brgb:[0-9a-fA-F]{6}\b 0:value
-add-highlighter shared/kakrc/code/scopes regex \b(global|shared|buffer|window)(?:\b|/) 0:value
-
-add-highlighter shared/kakrc/double_string/fill fill string
-add-highlighter shared/kakrc/double_string/escape regex '""' 0:default+b
-add-highlighter shared/kakrc/single_string/fill fill string
-add-highlighter shared/kakrc/single_string/escape regex "''" 0:default+b
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden kak-indent-on-new-line %{
- evaluate-commands -draft -itersel %{
- # copy '#' comment prefix and following white spaces
- try %{ execute-keys -draft k <a-x> s ^\h*#\h* <ret> y jgh P }
- # preserve previous line indent
- try %{ execute-keys -draft \; K <a-&> }
- # cleanup trailing whitespaces from previous line
- try %{ execute-keys -draft k <a-x> s \h+$ <ret> d }
- # indent after line ending with %\w*[^\s\w]
- try %{ execute-keys -draft k <a-x> <a-k> \%\w*[^\s\w]$ <ret> j <a-gt> }
- }
-}
-
-define-command -hidden kak-indent-on-closing-matching %~
- # align to opening matching brace when alone on a line
- try %= execute-keys -draft -itersel <a-h><a-k>^\h*\Q %val{hook_param} \E$<ret> mGi s \A|.\z<ret> 1<a-&> =
-~
-
-define-command -hidden kak-indent-on-closing-char %{
- # align to opening matching character when alone on a line
- try %{ execute-keys -draft -itersel <a-h><a-k>^\h*\Q %val{hook_param} \E$<ret>gi<a-f> %val{hook_param} <a-T>%<a-k>\w*\Q %val{hook_param} \E$<ret> s \A|.\z<ret> gi 1<a-&> }
-}
-
-# Initialization
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-hook -group kak-highlight global WinSetOption filetype=kak %{
- add-highlighter window/kakrc ref kakrc
- hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/kakrc }
-}
-
-hook global WinSetOption filetype=kak %~
- hook window InsertChar \n -group kak-indent kak-indent-on-new-line
- hook window InsertChar [>)}\]] -group kak-indent kak-indent-on-closing-matching
- hook window InsertChar (?![[{(<>)}\]])[^\s\w] -group kak-indent kak-indent-on-closing-char
- # cleanup trailing whitespaces on current line insert end
- hook window ModeChange insert:.* -group kak-trim-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
- set-option buffer extra_word_chars '_' '-'
-
- hook -once -always window WinSetOption filetype=.* %{ remove-hooks window kak-.+ }
-~
diff --git a/rc/core/make.kak b/rc/core/make.kak
deleted file mode 100644
index 89533a59..00000000
--- a/rc/core/make.kak
+++ /dev/null
@@ -1,84 +0,0 @@
-declare-option -docstring "shell command run to build the project" \
- str makecmd make
-declare-option -docstring "pattern that describes lines containing information about errors in the output of the `makecmd` command" \
- str make_error_pattern " (?:fatal )?error:"
-
-declare-option -docstring "name of the client in which utilities display information" \
- str toolsclient
-declare-option -hidden int make_current_error_line
-
-define-command -params .. \
- -docstring %{make [<arguments>]: make utility wrapper
-All the optional arguments are forwarded to the make utility} \
- make %{ evaluate-commands %sh{
- output=$(mktemp -d "${TMPDIR:-/tmp}"/kak-make.XXXXXXXX)/fifo
- mkfifo ${output}
- ( eval ${kak_opt_makecmd} "$@" > ${output} 2>&1 ) > /dev/null 2>&1 < /dev/null &
-
- printf %s\\n "evaluate-commands -try-client '$kak_opt_toolsclient' %{
- edit! -fifo ${output} -scroll *make*
- set-option buffer filetype make
- set-option buffer make_current_error_line 0
- hook -always -once buffer BufCloseFifo .* %{ nop %sh{ rm -r $(dirname ${output}) } }
- }"
-}}
-
-add-highlighter shared/make group
-add-highlighter shared/make/ regex "^((?:\w:)?[^:\n]+):(\d+):(?:(\d+):)?\h+(?:((?:fatal )?error)|(warning)|(note)|(required from(?: here)?))?.*?$" 1:cyan 2:green 3:green 4:red 5:yellow 6:blue 7:yellow
-add-highlighter shared/make/ regex "^\h*(~*(?:(\^)~*)?)$" 1:green 2:cyan+b
-add-highlighter shared/make/ line '%opt{make_current_error_line}' default+b
-
-hook -group make-highlight global WinSetOption filetype=make %{
- add-highlighter window/make ref make
- hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/make }
-}
-
-hook global WinSetOption filetype=make %{
- hook buffer -group make-hooks NormalKey <ret> make-jump
- hook -once -always window WinSetOption filetype=.* %{ remove-hooks buffer make-hooks }
-}
-
-declare-option -docstring "name of the client in which all source code jumps will be executed" \
- str jumpclient
-
-define-command -hidden make-open-error -params 4 %{
- evaluate-commands -try-client %opt{jumpclient} %{
- edit -existing "%arg{1}" %arg{2} %arg{3}
- echo -markup "{Information}%arg{4}"
- try %{ focus }
- }
-}
-
-define-command -hidden make-jump %{
- evaluate-commands %{
- try %{
- execute-keys gl<a-?> "Entering directory" <ret><a-:>
- # Try to parse the error into capture groups, failing on absolute paths
- execute-keys s "Entering directory [`']([^']+)'.*\n([^:/][^:]*):(\d+):(?:(\d+):)?([^\n]+)\z" <ret>l
- set-option buffer make_current_error_line %val{cursor_line}
- make-open-error "%reg{1}/%reg{2}" "%reg{3}" "%reg{4}" "%reg{5}"
- } catch %{
- execute-keys <a-h><a-l> s "((?:\w:)?[^:]+):(\d+):(?:(\d+):)?([^\n]+)\z" <ret>l
- set-option buffer make_current_error_line %val{cursor_line}
- make-open-error "%reg{1}" "%reg{2}" "%reg{3}" "%reg{4}"
- }
- }
-}
-
-define-command make-next-error -docstring 'Jump to the next make error' %{
- evaluate-commands -try-client %opt{jumpclient} %{
- buffer '*make*'
- execute-keys "%opt{make_current_error_line}ggl" "/^(?:\w:)?[^:\n]+:\d+:(?:\d+:)?%opt{make_error_pattern}<ret>"
- make-jump
- }
- try %{ evaluate-commands -client %opt{toolsclient} %{ execute-keys %opt{make_current_error_line}g } }
-}
-
-define-command make-previous-error -docstring 'Jump to the previous make error' %{
- evaluate-commands -try-client %opt{jumpclient} %{
- buffer '*make*'
- execute-keys "%opt{make_current_error_line}g" "<a-/>^(?:\w:)?[^:\n]+:\d+:(?:\d+:)?%opt{make_error_pattern}<ret>"
- make-jump
- }
- try %{ evaluate-commands -client %opt{toolsclient} %{ execute-keys %opt{make_current_error_line}g } }
-}
diff --git a/rc/core/makefile.kak b/rc/core/makefile.kak
deleted file mode 100644
index 569d51f9..00000000
--- a/rc/core/makefile.kak
+++ /dev/null
@@ -1,60 +0,0 @@
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*(/?[mM]akefile|\.mk) %{
- set-option buffer filetype makefile
-}
-
-# Highlighters
-# ‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/makefile regions
-
-add-highlighter shared/makefile/content default-region group
-add-highlighter shared/makefile/comment region '#' '$' fill comment
-add-highlighter shared/makefile/evaluate-commands region -recurse '\(' '\$\(' '\)' fill value
-
-add-highlighter shared/makefile/content/ regex ^[\w.%-]+\h*:\s 0:variable
-add-highlighter shared/makefile/content/ regex [+?:]= 0:operator
-
-evaluate-commands %sh{
- # Grammar
- keywords="ifeq|ifneq|ifdef|ifndef|else|endif|define|endef"
-
- # Add the language's grammar to the static completion list
- printf %s\\n "hook global WinSetOption filetype=makefile %{
- set-option window static_words ${keywords}
- }" | tr '|' ' '
-
- # Highlight keywords
- printf %s "add-highlighter shared/makefile/content/ regex \b(${keywords})\b 0:keyword"
-}
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden makefile-indent-on-new-line %{
- evaluate-commands -draft -itersel %{
- # preserve previous line indent
- try %{ execute-keys -draft \;K<a-&> }
- ## If the line above is a target indent with a tab
- try %{ execute-keys -draft Z k<a-x> <a-k>^[^:]+:\s<ret> z i<tab> }
- # cleanup trailing white space son previous line
- try %{ execute-keys -draft k<a-x> s \h+$ <ret>d }
- # indent after some keywords
- try %{ execute-keys -draft Z k<a-x> <a-k> ^\h*(ifeq|ifneq|ifdef|ifndef|else|define)\b<ret> z <a-gt> }
- }
-}
-
-# Initialization
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-hook -group makefile-highlight global WinSetOption filetype=makefile %{
- add-highlighter window/makefile ref makefile
- hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/makefile }
-}
-
-hook global WinSetOption filetype=makefile %{
- hook window InsertChar \n -group makefile-indent makefile-indent-on-new-line
- hook -once -always window WinSetOption filetype=.* %{ remove-hooks window makefile-.+ }
-}
diff --git a/rc/core/man.kak b/rc/core/man.kak
deleted file mode 100644
index 41d91104..00000000
--- a/rc/core/man.kak
+++ /dev/null
@@ -1,68 +0,0 @@
-declare-option -docstring "name of the client in which documentation is to be displayed" \
- str docsclient
-
-declare-option -hidden str manpage
-
-hook -group man-highlight global WinSetOption filetype=man %{
- add-highlighter window/man-highlight group
- # Sections
- add-highlighter window/man-highlight/ regex ^\S.*?$ 0:title
- # Subsections
- add-highlighter window/man-highlight/ regex '^ {3}\S.*?$' 0:default+b
- # Command line options
- add-highlighter window/man-highlight/ regex '^ {7}-[^\s,]+(,\s+-[^\s,]+)*' 0:list
- # References to other manpages
- add-highlighter window/man-highlight/ regex [-a-zA-Z0-9_.]+\([a-z0-9]+\) 0:header
-
- hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/man-highlight }
-}
-
-hook global WinSetOption filetype=man %{
- hook -group man-hooks window WinResize .* %{ man-impl %val{bufname} %opt{manpage} }
- hook -once -always window WinSetOption filetype=.* %{ remove-hooks window man-hooks }
-}
-
-define-command -hidden -params 2..3 man-impl %{ evaluate-commands %sh{
- buffer_name="$1"
- shift
- manout=$(mktemp "${TMPDIR:-/tmp}"/kak-man-XXXXXX)
- colout=$(mktemp "${TMPDIR:-/tmp}"/kak-man-XXXXXX)
- MANWIDTH=${kak_window_width} man "$@" > $manout 2>/dev/null
- retval=$?
- col -b -x > ${colout} < ${manout}
- rm ${manout}
- if [ "${retval}" -eq 0 ]; then
- printf %s\\n "
- edit -scratch '$buffer_name'
- execute-keys '%|cat<space>${colout}<ret>gk'
- nop %sh{rm ${colout}}
- set-option buffer filetype man
- set-option window manpage '$@'
- "
- else
- printf %s\\n "echo -markup %{{Error}man '$@' failed: see *debug* buffer for details}"
- rm ${colout}
- fi
-} }
-
-define-command -params ..1 \
- -shell-script-candidates %{
- find /usr/share/man/ -name '*.[1-8]*' | sed 's,^.*/\(.*\)\.\([1-8][a-zA-Z]*\).*$,\1(\2),'
- } \
- -docstring %{man [<page>]: manpage viewer wrapper
-If no argument is passed to the command, the selection will be used as page
-The page can be a word, or a word directly followed by a section number between parenthesis, e.g. kak(1)} \
- man %{ evaluate-commands %sh{
- subject=${1-$kak_selection}
-
- ## The completion suggestions display the page number, strip them if present
- case "${subject}" in
- *\([1-8]*\))
- pagenum="${subject##*(}"
- pagenum="${pagenum%)}"
- subject="${subject%%(*}"
- ;;
- esac
-
- printf %s\\n "evaluate-commands -try-client %opt{docsclient} man-impl *man* $pagenum $subject"
-} }
diff --git a/rc/core/python.kak b/rc/core/python.kak
deleted file mode 100644
index fb9477b9..00000000
--- a/rc/core/python.kak
+++ /dev/null
@@ -1,148 +0,0 @@
-# http://python.org
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-# Detection
-# ‾‾‾‾‾‾‾‾‾
-
-hook global BufCreate .*[.](py) %{
- set-option buffer filetype python
-}
-
-# Highlighters & Completion
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-add-highlighter shared/python regions
-add-highlighter shared/python/code default-region group
-add-highlighter shared/python/docstring region -match-capture ("""|''') ("""|''') regions
-add-highlighter shared/python/double_string region '"' (?<!\\)(\\\\)*" fill string
-add-highlighter shared/python/single_string region "'" (?<!\\)(\\\\)*' fill string
-add-highlighter shared/python/comment region '#' '$' fill comment
-
-# Integer formats
-add-highlighter shared/python/code/ regex '(?i)\b0b[01]+l?\b' 0:value
-add-highlighter shared/python/code/ regex '(?i)\b0x[\da-f]+l?\b' 0:value
-add-highlighter shared/python/code/ regex '(?i)\b0o?[0-7]+l?\b' 0:value
-add-highlighter shared/python/code/ regex '(?i)\b([1-9]\d*|0)l?\b' 0:value
-# Float formats
-add-highlighter shared/python/code/ regex '\b\d+[eE][+-]?\d+\b' 0:value
-add-highlighter shared/python/code/ regex '(\b\d+)?\.\d+\b' 0:value
-add-highlighter shared/python/code/ regex '\b\d+\.' 0:value
-# Imaginary formats
-add-highlighter shared/python/code/ regex '\b\d+\+\d+[jJ]\b' 0:value
-
-add-highlighter shared/python/docstring/ default-region fill string
-add-highlighter shared/python/docstring/ region '>>> \K' '\z' ref python
-add-highlighter shared/python/docstring/ region '\.\.\. \K' '\z' ref python
-
-evaluate-commands %sh{
- # Grammar
- values="True|False|None|self|inf"
- meta="import|from"
-
- # attributes and methods list based on https://docs.python.org/3/reference/datamodel.html
- attributes="__annotations__|__closure__|__code__|__defaults__|__dict__|__doc__"
- attributes="${attributes}|__globals__|__kwdefaults__|__module__|__name__|__qualname__"
- methods="__abs__|__add__|__aenter__|__aexit__|__aiter__|__and__|__anext__"
- methods="${methods}|__await__|__bool__|__bytes__|__call__|__complex__|__contains__"
- methods="${methods}|__del__|__delattr__|__delete__|__delitem__|__dir__|__divmod__"
- methods="${methods}|__enter__|__eq__|__exit__|__float__|__floordiv__|__format__"
- methods="${methods}|__ge__|__get__|__getattr__|__getattribute__|__getitem__"
- methods="${methods}|__gt__|__hash__|__iadd__|__iand__|__ifloordiv__|__ilshift__"
- methods="${methods}|__imatmul__|__imod__|__imul__|__index__|__init__"
- methods="${methods}|__init_subclass__|__int__|__invert__|__ior__|__ipow__"
- methods="${methods}|__irshift__|__isub__|__iter__|__itruediv__|__ixor__|__le__"
- methods="${methods}|__len__|__length_hint__|__lshift__|__lt__|__matmul__"
- methods="${methods}|__missing__|__mod__|__mul__|__ne__|__neg__|__new__|__or__"
- methods="${methods}|__pos__|__pow__|__radd__|__rand__|__rdivmod__|__repr__"
- methods="${methods}|__reversed__|__rfloordiv__|__rlshift__|__rmatmul__|__rmod__"
- methods="${methods}|__rmul__|__ror__|__round__|__rpow__|__rrshift__|__rshift__"
- methods="${methods}|__rsub__|__rtruediv__|__rxor__|__set__|__setattr__"
- methods="${methods}|__setitem__|__set_name__|__slots__|__str__|__sub__"
- methods="${methods}|__truediv__|__xor__"
-
- # built-in exceptions https://docs.python.org/3/library/exceptions.html
- exceptions="ArithmeticError|AssertionError|AttributeError|BaseException|BlockingIOError"
- exceptions="${exceptions}|BrokenPipeError|BufferError|BytesWarning|ChildProcessError"
- exceptions="${exceptions}|ConnectionAbortedError|ConnectionError|ConnectionRefusedError"
- exceptions="${exceptions}|ConnectionResetError|DeprecationWarning|EOFError|Exception"
- exceptions="${exceptions}|FileExistsError|FileNotFoundError|FloatingPointError|FutureWarning"
- exceptions="${exceptions}|GeneratorExit|ImportError|ImportWarning|IndentationError"
- exceptions="${exceptions}|IndexError|InterruptedError|IsADirectoryError|KeyboardInterrupt"
- exceptions="${exceptions}|KeyError|LookupError|MemoryError|ModuleNotFoundError|NameError"
- exceptions="${exceptions}|NotADirectoryError|NotImplementedError|OSError|OverflowError"
- exceptions="${exceptions}|PendingDeprecationWarning|PermissionError|ProcessLookupError"
- exceptions="${exceptions}|RecursionError|ReferenceError|ResourceWarning|RuntimeError"
- exceptions="${exceptions}|RuntimeWarning|StopAsyncIteration|StopIteration|SyntaxError"
- exceptions="${exceptions}|SyntaxWarning|SystemError|SystemExit|TabError|TimeoutError|TypeError"
- exceptions="${exceptions}|UnboundLocalError|UnicodeDecodeError|UnicodeEncodeError|UnicodeError"
- exceptions="${exceptions}|UnicodeTranslateError|UnicodeWarning|UserWarning|ValueError|Warning"
- exceptions="${exceptions}|ZeroDivisionError"
-
- # Keyword list is collected using `keyword.kwlist` from `keyword`
- keywords="and|as|assert|async|await|break|class|continue|def|del|elif|else|except|exec"
- keywords="${keywords}|finally|for|global|if|in|is|lambda|nonlocal|not|or|pass|print"
- keywords="${keywords}|raise|return|try|while|with|yield"
-
- types="bool|buffer|bytearray|bytes|complex|dict|file|float|frozenset|int"
- types="${types}|list|long|memoryview|object|set|str|tuple|unicode|xrange"
-
- functions="abs|all|any|ascii|bin|callable|chr|classmethod|compile|complex"
- functions="${functions}|delattr|dict|dir|divmod|enumerate|eval|exec|filter"
- functions="${functions}|format|frozenset|getattr|globals|hasattr|hash|help"
- functions="${functions}|hex|id|__import__|input|isinstance|issubclass|iter"
- functions="${functions}|len|locals|map|max|memoryview|min|next|oct|open|ord"
- functions="${functions}|pow|print|property|range|repr|reversed|round"
- functions="${functions}|setattr|slice|sorted|staticmethod|sum|super|type|vars|zip"
-
- # Add the language's grammar to the static completion list
- printf %s\\n "hook global WinSetOption filetype=python %{
- set-option window static_words ${values} ${meta} ${attributes} ${methods} ${exceptions} ${keywords} ${types} ${functions}
- }" | tr '|' ' '
-
- # Highlight keywords
- printf %s "
- add-highlighter shared/python/code/ regex '\b(${values})\b' 0:value
- add-highlighter shared/python/code/ regex '\b(${meta})\b' 0:meta
- add-highlighter shared/python/code/ regex '\b(${attribute})\b' 0:attribute
- add-highlighter shared/python/code/ regex '\bdef\s+(${methods})\b' 1:function
- add-highlighter shared/python/code/ regex '\b(${exceptions})\b' 0:function
- add-highlighter shared/python/code/ regex '\b(${keywords})\b' 0:keyword
- add-highlighter shared/python/code/ regex '\b(${functions})\b\(' 1:builtin
- add-highlighter shared/python/code/ regex '\b(${types})\b' 0:type
- add-highlighter shared/python/code/ regex '@[\w_]+\b' 0:attribute
- "
-}
-
-add-highlighter shared/python/code/ regex (?<=[\w\s\d'"_])(<=|<<|>>|>=|<>|<|>|!=|==|\||\^|&|\+|-|\*\*|\*|//|/|%|~) 0:operator
-add-highlighter shared/python/code/ regex (?<=[\w\s\d'"_])((?<![=<>!])=(?![=])|[+*-]=) 0:builtin
-
-# Commands
-# ‾‾‾‾‾‾‾‾
-
-define-command -hidden python-indent-on-new-line %{
- evaluate-commands -draft -itersel %{
- # copy '#' comment prefix and following white spaces
- try %{ execute-keys -draft k <a-x> s ^\h*#\h* <ret> y jgh P }
- # preserve previous line indent
- try %{ execute-keys -draft \; K <a-&> }
- # cleanup trailing whitespaces from previous line
- try %{ execute-keys -draft k <a-x> s \h+$ <ret> d }
- # indent after line ending with :
- try %{ execute-keys -draft <space> k <a-x> <a-k> :$ <ret> j <a-gt> }
- }
-}
-
-# Initialization
-# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾
-
-hook -group python-highlight global WinSetOption filetype=python %{
- add-highlighter window/python ref python
- hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/python }
-}
-
-hook global WinSetOption filetype=python %{
- hook window InsertChar \n -group python-indent python-indent-on-new-line
- # cleanup trailing whitespaces on current line insert end
- hook window ModeChange insert:.* -group python-trim-indent %{ try %{ execute-keys -draft \; <a-x> s ^\h+$ <ret> d } }
- hook -once -always window WinSetOption filetype=.* %{ remove-hooks window python-.+ }
-}
diff --git a/rc/core/sh.kak b/rc/core/sh.kak
deleted file mode 100644
index 517f6a18..00000000
--- a/rc/core/sh.kak
+++ /dev/null
@@ -1,43 +0,0 @@
-hook global BufCreate .*\.(z|ba|c|k|mk)?sh(rc|_profile)? %{
- set-option buffer filetype sh
-}
-
-add-highlighter shared/sh regions
-add-highlighter shared/sh/code default-region group
-add-highlighter shared/sh/double_string region %{(?<!\\)(?:\\\\)*\K"} %{(?<!\\)(?:\\\\)*"} group
-add-highlighter shared/sh/single_string region %{(?<!\\)(?:\\\\)*\K'} %{'} fill string
-add-highlighter shared/sh/comment region '(?<!\$)(?<!\$\{)#' '$' fill comment
-add-highlighter shared/sh/heredoc region -match-capture '<<-?''?(\w+)''?' '^\t*(\w+)$' fill string
-
-add-highlighter shared/sh/double_string/fill fill string
-
-evaluate-commands %sh{
- # Grammar
- keywords="alias bind builtin caller case cd command coproc declare do done
- echo elif else enable esac exit fi for function help
- if in let local logout mapfile printf read readarray
- readonly return select set shift source test then
- time type typeset ulimit unalias until while break continue"
-
- join() { sep=$2; eval set -- $1; IFS="$sep"; echo "$*"; }
-
- # Add the language's grammar to the static completion list
- printf %s\\n "hook global WinSetOption filetype=sh %{
- set-option window static_words $(join "${keywords}" ' ')
- }"
-
- # Highlight keywords
- printf %s "add-highlighter shared/sh/code/ regex \b($(join "${keywords}" '|'))\b 0:keyword"
-}
-
-add-highlighter shared/sh/code/operators regex [\[\]\(\)&|]{1,2} 0:operator
-add-highlighter shared/sh/code/variable regex (\w+)= 1:variable
-add-highlighter shared/sh/code/function regex ^\h*(\w+)\h*\(\) 1:function
-
-add-highlighter shared/sh/code/expansion regex \$(\w+|\{.+?\}|#|@|\?|\$|!|-|\*) 0:value
-add-highlighter shared/sh/double_string/expansion regex \$(\w+|\{.+?\}) 0:value
-
-hook -group sh-highlight global WinSetOption filetype=sh %{
- add-highlighter window/sh ref sh
- hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/sh }
-}