From c9b280b7124752678873eeaa10cb793901450432 Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Fri, 3 Nov 2017 10:34:41 +0300 Subject: [PATCH] rc: Don't use command aliases to highlight keywords properly --- rc/base/autowrap.kak | 12 +++---- rc/base/clojure.kak | 6 ++-- rc/base/css.kak | 8 ++--- rc/base/ctags.kak | 22 ++++++------- rc/base/d.kak | 10 +++--- rc/base/etc.kak | 22 ++++++------- rc/base/file.kak | 2 +- rc/base/fish.kak | 10 +++--- rc/base/gas.kak | 6 ++-- rc/base/git.kak | 4 +-- rc/base/go.kak | 10 +++--- rc/base/haskell.kak | 8 ++--- rc/base/html.kak | 10 +++--- rc/base/ini.kak | 2 +- rc/base/java.kak | 8 ++--- rc/base/javascript.kak | 8 ++--- rc/base/json.kak | 8 ++--- rc/base/julia.kak | 2 +- rc/base/lint.kak | 26 +++++++-------- rc/base/lisp.kak | 6 ++-- rc/base/lua.kak | 12 +++---- rc/base/mail.kak | 2 +- rc/base/markdown.kak | 4 +-- rc/base/mercurial.kak | 4 +-- rc/base/ocaml.kak | 6 ++-- rc/base/perl.kak | 10 +++--- rc/base/ruby.kak | 14 ++++----- rc/base/rust.kak | 10 +++--- rc/base/scala.kak | 8 ++--- rc/base/spell.kak | 18 +++++------ rc/base/sql.kak | 4 +-- rc/base/swift.kak | 2 +- rc/base/tmux.kak | 10 +++--- rc/base/x11.kak | 12 +++---- rc/base/yaml.kak | 6 ++-- rc/core/asciidoc.kak | 2 +- rc/core/c-family.kak | 38 +++++++++++----------- rc/core/comment.kak | 66 +++++++++++++++++++-------------------- rc/core/diff.kak | 2 +- rc/core/doc.kak | 8 ++--- rc/core/formatter.kak | 4 +-- rc/core/grep.kak | 22 ++++++------- rc/core/kakrc.kak | 10 +++--- rc/core/make.kak | 26 +++++++-------- rc/core/makefile.kak | 6 ++-- rc/core/man.kak | 12 +++---- rc/core/python.kak | 6 ++-- rc/core/sh.kak | 4 +-- rc/extra/autorestore.kak | 8 ++--- rc/extra/cabal.kak | 10 +++--- rc/extra/clang.kak | 44 +++++++++++++------------- rc/extra/coffee.kak | 6 ++-- rc/extra/cucumber.kak | 6 ++-- rc/extra/dockerfile.kak | 2 +- rc/extra/editorconfig.kak | 20 ++++++------ rc/extra/elixir.kak | 6 ++-- rc/extra/elm.kak | 8 ++--- rc/extra/exherbo.kak | 38 +++++++++++----------- rc/extra/git-tools.kak | 22 ++++++------- rc/extra/go-tools.kak | 38 +++++++++++----------- rc/extra/haml.kak | 6 ++-- rc/extra/hbs.kak | 6 ++-- rc/extra/iterm.kak | 14 ++++----- rc/extra/jedi.kak | 20 ++++++------ rc/extra/kickstart.kak | 2 +- rc/extra/latex.kak | 2 +- rc/extra/modeline.kak | 10 +++--- rc/extra/moon.kak | 10 +++--- rc/extra/php.kak | 8 ++--- rc/extra/pony.kak | 46 +++++++++++++-------------- rc/extra/pug.kak | 6 ++-- rc/extra/racer.kak | 20 ++++++------ rc/extra/ragel.kak | 8 ++--- rc/extra/ranger.kak | 4 +-- rc/extra/sass.kak | 6 ++-- rc/extra/scss.kak | 8 ++--- rc/extra/taskpaper.kak | 4 +-- rc/extra/tmux-repl.kak | 12 +++---- rc/extra/tupfile.kak | 2 +- rc/extra/typescript.kak | 2 +- rc/extra/x11-repl.kak | 8 ++--- 81 files changed, 465 insertions(+), 465 deletions(-) diff --git a/rc/base/autowrap.kak b/rc/base/autowrap.kak index d723c93e..85a50db0 100644 --- a/rc/base/autowrap.kak +++ b/rc/base/autowrap.kak @@ -1,14 +1,14 @@ -decl -docstring "maximum amount of characters per line, after which a newline character will be inserted" \ +declare-option -docstring "maximum amount of characters per line, after which a newline character will be inserted" \ int autowrap_column 80 -decl -docstring %{when enabled, paragraph formatting will reformat the whole paragraph in which characters are being inserted +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 -decl -docstring %{command to which the paragraphs to wrap will be passed +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' -def -hidden autowrap-cursor %{ eval -save-regs '/"|^@m' %{ +define-command -hidden autowrap-cursor %{ eval -save-regs '/"|^@m' %{ try %{ ## if the line isn't too long, do nothing exec -draft "^[^\n]{%opt{autowrap_column},}[^\n]" @@ -39,10 +39,10 @@ def -hidden autowrap-cursor %{ eval -save-regs '/"|^@m' %{ } } } -def autowrap-enable -docstring "Automatically wrap the lines in which characters are inserted" %{ +define-command autowrap-enable -docstring "Automatically wrap the lines in which characters are inserted" %{ hook -group autowrap window InsertChar [^\n] autowrap-cursor } -def autowrap-disable -docstring "Disable automatic line wrapping" %{ +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 index 77f58681..00c7ca46 100644 --- a/rc/base/clojure.kak +++ b/rc/base/clojure.kak @@ -7,7 +7,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](cljs?) %{ - set buffer filetype clojure + set-option buffer filetype clojure } # Highlighters @@ -22,8 +22,8 @@ add-highlighter shared/clojure regex \b(clojure.core/['/\w]+)\b 0:keyword # Commands # ‾‾‾‾‾‾‾‾ -def -hidden clojure-filter-around-selections lisp-filter-around-selections -def -hidden clojure-indent-on-new-line lisp-indent-on-new-line +define-command -hidden clojure-filter-around-selections lisp-filter-around-selections +define-command -hidden clojure-indent-on-new-line lisp-indent-on-new-line # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ diff --git a/rc/base/css.kak b/rc/base/css.kak index c6a0d7e2..e6e66d12 100644 --- a/rc/base/css.kak +++ b/rc/base/css.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](css) %{ - set buffer filetype css + set-option buffer filetype css } # Highlighters @@ -38,12 +38,12 @@ add-highlighter shared/css/selector regex [*]|[#.][A-Za-z][A-Za-z0-9_-]* 0:varia # Commands # ‾‾‾‾‾‾‾‾ -def -hidden css-filter-around-selections %{ +define-command -hidden css-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden css-indent-on-new-line %[ +define-command -hidden css-indent-on-new-line %[ eval -draft -itersel %[ # preserve previous line indent try %[ exec -draft \; K ] @@ -54,7 +54,7 @@ def -hidden css-indent-on-new-line %[ ] ] -def -hidden css-indent-on-closing-curly-brace %[ +define-command -hidden css-indent-on-closing-curly-brace %[ eval -draft -itersel %[ # align to opening curly brace when alone on a line try %[ exec -draft ^\h+\}$ m s \A|.\z 1 ] diff --git a/rc/base/ctags.kak b/rc/base/ctags.kak index 4c5c193e..b779e710 100644 --- a/rc/base/ctags.kak +++ b/rc/base/ctags.kak @@ -3,10 +3,10 @@ # This script requires the readtags command available in ctags source but # not installed by default -decl -docstring "colon separated list of paths to tag files to parse when looking up a symbol" \ +declare-option -docstring "colon separated list of paths to tag files to parse when looking up a symbol" \ str-list ctagsfiles 'tags' -def -params ..1 \ +define-command -params ..1 \ -shell-candidates ' printf %s\\n "$kak_opt_ctagsfiles" | tr \':\' \'\n\' | while read -r candidate; do @@ -43,16 +43,16 @@ If no symbol is passed then the current selection is used as symbol name} \ END { print ( length(out) == 0 ? "echo -markup %{{Error}no such tag " ENVIRON["tagname"] "}" : "menu -markup -auto-single " out ) }' }} -def ctags-complete -docstring "Insert completion candidates for the current selection into the buffer's local variables" %{ eval -draft %{ +define-command ctags-complete -docstring "Insert completion candidates for the current selection into the buffer's local variables" %{ eval -draft %{ exec hb^\w+$ %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 buffer=$kak_bufname ctags_completions '${compl}'" | kak -p ${kak_session} + printf %s\\n "set-option buffer=$kak_bufname ctags_completions '${compl}'" | kak -p ${kak_session} } > /dev/null 2>&1 < /dev/null & } }} -def ctags-funcinfo -docstring "Display ctags information about a selected function" %{ +define-command ctags-funcinfo -docstring "Display ctags information about a selected function" %{ eval -draft %{ try %{ exec -no-hooks '[(;B[a-zA-Z_]+\(' @@ -66,18 +66,18 @@ def ctags-funcinfo -docstring "Display ctags information about a selected functi } } -def ctags-enable-autoinfo -docstring "Automatically display ctags information about function" %{ +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 } -def ctags-disable-autoinfo -docstring "Disable automatic ctags information displaying" %{ remove-hooks window ctags-autoinfo } +define-command ctags-disable-autoinfo -docstring "Disable automatic ctags information displaying" %{ remove-hooks window ctags-autoinfo } -decl -docstring "options to pass to the `ctags` shell command" \ +declare-option -docstring "options to pass to the `ctags` shell command" \ str ctagsopts "-R" -decl -docstring "path to the directory in which the tags file will be generated" str ctagspaths "." +declare-option -docstring "path to the directory in which the tags file will be generated" str ctagspaths "." -def ctags-generate -docstring 'Generate tag file asynchronously' %{ +define-command ctags-generate -docstring 'Generate tag file asynchronously' %{ echo -markup "{Information}launching tag generation in the background" %sh{ { while ! mkdir .tags.kaklock 2>/dev/null; do sleep 1; done @@ -94,7 +94,7 @@ def ctags-generate -docstring 'Generate tag file asynchronously' %{ } > /dev/null 2>&1 < /dev/null & } } -def ctags-update-tags -docstring 'Update tags for the given file' %{ +define-command ctags-update-tags -docstring 'Update tags for the given file' %{ %sh{ { while ! mkdir .tags.kaklock 2>/dev/null; do sleep 1; done trap 'rmdir .tags.kaklock' EXIT diff --git a/rc/base/d.kak b/rc/base/d.kak index 8fd86b76..3656559c 100644 --- a/rc/base/d.kak +++ b/rc/base/d.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*\.di? %{ - set buffer filetype d + set-option buffer filetype d } # Highlighters @@ -63,7 +63,7 @@ add-highlighter shared/d/code regex "\b(this)\b\s*[^(]" 1:value # Add the language's grammar to the static completion list printf %s\\n "hook global WinSetOption filetype=d %{ - set window static_words '${keywords}:${attributes}:${types}:${values}:${decorators}:${properties}' + set-option window static_words '${keywords}:${attributes}:${types}:${values}:${decorators}:${properties}' }" | sed 's,|,:,g' # Highlight keywords @@ -81,7 +81,7 @@ add-highlighter shared/d/code regex "\b(this)\b\s*[^(]" 1:value # Commands # ‾‾‾‾‾‾‾‾ -def -hidden d-indent-on-new-line %~ +define-command -hidden d-indent-on-new-line %~ eval -draft -itersel %= # preserve previous line indent try %{ exec -draft \;K } @@ -100,12 +100,12 @@ def -hidden d-indent-on-new-line %~ = ~ -def -hidden d-indent-on-opening-curly-brace %[ +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 %[ exec -draft -itersel h)M \A\(.*\)\h*\n\h*\{\z s \A|.\z 1 ] ] -def -hidden d-indent-on-closing-curly-brace %[ +define-command -hidden d-indent-on-closing-curly-brace %[ # align to opening curly brace when alone on a line try %[ exec -itersel -draft ^\h+\}$hms\A|.\z1 ] ] diff --git a/rc/base/etc.kak b/rc/base/etc.kak index 5947bc62..6a0ecf0f 100644 --- a/rc/base/etc.kak +++ b/rc/base/etc.kak @@ -1,15 +1,15 @@ # Highlighting for common files in /etc -hook global BufCreate .*/etc/(hosts|networks|services) %{ set buffer filetype etc-hosts } -hook global BufCreate .*/etc/resolv.conf %{ set buffer filetype etc-resolv-conf } -hook global BufCreate .*/etc/shadow %{ set buffer filetype etc-shadow } -hook global BufCreate .*/etc/passwd %{ set buffer filetype etc-passwd } -hook global BufCreate .*/etc/gshadow %{ set buffer filetype etc-gshadow } -hook global BufCreate .*/etc/group %{ set buffer filetype etc-group } -hook global BufCreate .*/etc/(fs|m)tab %{ set buffer filetype etc-fstab } -hook global BufCreate .*/etc/environment %{ set buffer filetype sh } -hook global BufCreate .*/etc/env.d/.* %{ set buffer filetype sh } -hook global BufCreate .*/etc/profile(\.(csh|env))? %{ set buffer filetype sh } -hook global BufCreate .*/etc/profile\.d/.* %{ set buffer filetype sh } +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 diff --git a/rc/base/file.kak b/rc/base/file.kak index 770db29f..65d5b982 100644 --- a/rc/base/file.kak +++ b/rc/base/file.kak @@ -10,7 +10,7 @@ hook global BufOpenFile .* %{ %sh{ text/*) filetype="${mime#text/}" ;; esac if [ -n "${filetype}" ]; then - printf "set buffer filetype '%s'\n" "${filetype}" + printf "set-option buffer filetype '%s'\n" "${filetype}" fi fi } } diff --git a/rc/base/fish.kak b/rc/base/fish.kak index d7d77e99..cd78589f 100644 --- a/rc/base/fish.kak +++ b/rc/base/fish.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](fish) %{ - set buffer filetype fish + set-option buffer filetype fish } # Highlighters @@ -29,14 +29,14 @@ add-highlighter shared/fish/code regex \b(and|begin|bg|bind|block|break|breakpoi # Commands # ‾‾‾‾‾‾‾‾ -def -hidden fish-filter-around-selections %{ +define-command -hidden fish-filter-around-selections %{ eval -no-hooks -draft -itersel %{ # remove trailing white spaces try %{ exec -draft s\h+$d } } } -def -hidden fish-indent-on-char %{ +define-command -hidden fish-indent-on-char %{ eval -no-hooks -draft -itersel %{ # align middle and end structures to start and indent when necessary try %{ exec -draft ^\h*(else)$^\h*(if)s\A|\z' } @@ -45,7 +45,7 @@ def -hidden fish-indent-on-char %{ } } -def -hidden fish-indent-on-new-line %{ +define-command -hidden fish-indent-on-new-line %{ eval -no-hooks -draft -itersel %{ # preserve previous line indent try %{ exec -draft K } @@ -56,7 +56,7 @@ def -hidden fish-indent-on-new-line %{ } } -def -hidden fish-insert-on-new-line %{ +define-command -hidden fish-insert-on-new-line %{ eval -no-hooks -draft -itersel %{ # copy _#_ comment prefix and following white spaces try %{ exec -draft ks^\h*\K#\h*yjp } diff --git a/rc/base/gas.kak b/rc/base/gas.kak index d6f0aba7..4c9c12c1 100644 --- a/rc/base/gas.kak +++ b/rc/base/gas.kak @@ -1,7 +1,7 @@ # Detection # --------- hook global BufCreate .*\.(s|S|asm)$ %{ - set buffer filetype gas + set-option buffer filetype gas } @@ -66,7 +66,7 @@ add-highlighter shared/gas/code regex \ ^\h*(cvttp[ds]2dq|cvttp[ds]2pi|cvtts[ds]2si)\b|\ ^\h*(vxorp[sd]|vandp[sd]|ucomis[sd])\b 0:keyword -def -hidden gas-filter-around-selections %{ +define-command -hidden gas-filter-around-selections %{ eval -draft -itersel %{ exec # remove trailing white spaces @@ -74,7 +74,7 @@ def -hidden gas-filter-around-selections %{ } } -def -hidden gas-indent-on-new-line %~ +define-command -hidden gas-indent-on-new-line %~ eval -draft -itersel %< # preserve previous line indent try %{ exec -draft \; K } diff --git a/rc/base/git.kak b/rc/base/git.kak index dbf956cf..c3e82ef8 100644 --- a/rc/base/git.kak +++ b/rc/base/git.kak @@ -1,5 +1,5 @@ hook global BufCreate .*(COMMIT_EDITMSG|MERGE_MSG) %{ - set buffer filetype git-commit + set-option buffer filetype git-commit } hook -group git-commit-highlight global WinSetOption filetype=git-commit %{ @@ -12,7 +12,7 @@ hook -group git-commit-highlight global WinSetOption filetype=git-commit %{ hook -group git-commit-highlight global WinSetOption filetype=(?!git-commit).* %{ remove-highlighter window/git-commit-highlight } hook global BufCreate .*git-rebase-todo %{ - set buffer filetype git-rebase + set-option buffer filetype git-rebase } hook -group git-rebase-highlight global WinSetOption filetype=git-rebase %{ diff --git a/rc/base/go.kak b/rc/base/go.kak index 24060882..9c10534b 100644 --- a/rc/base/go.kak +++ b/rc/base/go.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*\.go %{ - set buffer filetype go + set-option buffer filetype go } # Highlighters @@ -37,7 +37,7 @@ add-highlighter shared/go/code regex %{-?([0-9]*\.(?!0[xX]))?\b([0-9]+|0[xX][0-9 # Add the language's grammar to the static completion list printf %s\\n "hook global WinSetOption filetype=go %{ - set window static_words '${keywords}:${attributes}:${types}:${values}:${functions}' + set-option window static_words '${keywords}:${attributes}:${types}:${values}:${functions}' }" | sed 's,|,:,g' # Highlight keywords @@ -53,7 +53,7 @@ add-highlighter shared/go/code regex %{-?([0-9]*\.(?!0[xX]))?\b([0-9]+|0[xX][0-9 # Commands # ‾‾‾‾‾‾‾‾ -def -hidden go-indent-on-new-line %~ +define-command -hidden go-indent-on-new-line %~ eval -draft -itersel %= # preserve previous line indent try %{ exec -draft \;K } @@ -72,12 +72,12 @@ def -hidden go-indent-on-new-line %~ = ~ -def -hidden go-indent-on-opening-curly-brace %[ +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 %[ exec -draft -itersel h)M \A\(.*\)\h*\n\h*\{\z s \A|.\z 1 ] ] -def -hidden go-indent-on-closing-curly-brace %[ +define-command -hidden go-indent-on-closing-curly-brace %[ # align to opening curly brace when alone on a line try %[ exec -itersel -draft ^\h+\}$hms\A|.\z1 ] ] diff --git a/rc/base/haskell.kak b/rc/base/haskell.kak index 2253c2a9..3003e7ec 100644 --- a/rc/base/haskell.kak +++ b/rc/base/haskell.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](hs) %{ - set buffer filetype haskell + set-option buffer filetype haskell } # Highlighters @@ -72,12 +72,12 @@ add-highlighter shared/haskell/code regex \B'([^\\]|[\\]['"\w\d\\])' 0:string # http://en.wikibooks.org/wiki/Haskell/Indentation -def -hidden haskell-filter-around-selections %{ +define-command -hidden haskell-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden haskell-indent-on-new-line %{ +define-command -hidden haskell-indent-on-new-line %{ eval -draft -itersel %{ # copy -- comments prefix and following white spaces try %{ exec -draft k s ^\h*\K--\h* y gh j P } @@ -98,7 +98,7 @@ def -hidden haskell-indent-on-new-line %{ hook -group haskell-highlight global WinSetOption filetype=haskell %{ add-highlighter window ref haskell } hook global WinSetOption filetype=haskell %{ - set window extra_word_chars "'" + set-option window extra_word_chars "'" hook window InsertEnd .* -group haskell-hooks haskell-filter-around-selections hook window InsertChar \n -group haskell-indent haskell-indent-on-new-line } diff --git a/rc/base/html.kak b/rc/base/html.kak index cd43e66d..e6ab2640 100644 --- a/rc/base/html.kak +++ b/rc/base/html.kak @@ -5,11 +5,11 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*\.html %{ - set buffer filetype html + set-option buffer filetype html } hook global BufCreate .*\.xml %{ - set buffer filetype xml + set-option buffer filetype xml } # Highlighters @@ -39,19 +39,19 @@ add-highlighter shared/html/tag/content/string fill string # Commands # ‾‾‾‾‾‾‾‾ -def -hidden html-filter-around-selections %{ +define-command -hidden html-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden html-indent-on-greater-than %[ +define-command -hidden html-indent-on-greater-than %[ eval -draft -itersel %[ # align closing tag to opening when alone on a line try %[ exec -draft s ^\h+/(\w+)$ {c1,/1 s \A|.\z 1 ] ] ] -def -hidden html-indent-on-new-line %{ +define-command -hidden html-indent-on-new-line %{ eval -draft -itersel %{ # preserve previous line indent try %{ exec -draft \; K } diff --git a/rc/base/ini.kak b/rc/base/ini.kak index 3da27982..7f64e87c 100644 --- a/rc/base/ini.kak +++ b/rc/base/ini.kak @@ -1,5 +1,5 @@ hook global BufCreate .*\.(repo|service|target|socket|ini|cfg) %{ - set buffer filetype ini + set-option buffer filetype ini } add-highlighter shared/ regions -default code ini \ diff --git a/rc/base/java.kak b/rc/base/java.kak index 3256bfa9..7534b858 100644 --- a/rc/base/java.kak +++ b/rc/base/java.kak @@ -1,5 +1,5 @@ hook global BufCreate .*\.java %{ - set buffer filetype java + set-option buffer filetype java } add-highlighter shared/ regions -default code java \ @@ -18,7 +18,7 @@ add-highlighter shared/java/code regex "\b(final|public|protected|private|abstra # Commands # ‾‾‾‾‾‾‾‾ -def -hidden java-indent-on-new-line %~ +define-command -hidden java-indent-on-new-line %~ eval -draft -itersel %= # preserve previous line indent try %{ exec -draft \;K } @@ -37,12 +37,12 @@ def -hidden java-indent-on-new-line %~ = ~ -def -hidden java-indent-on-opening-curly-brace %[ +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 %[ exec -draft -itersel h)M \A\(.*\)\h*\n\h*\{\z s \A|.\z 1 ] ] -def -hidden java-indent-on-closing-curly-brace %[ +define-command -hidden java-indent-on-closing-curly-brace %[ # align to opening curly brace when alone on a line try %[ exec -itersel -draft ^\h+\}$hms\A|.\z1 ] ] diff --git a/rc/base/javascript.kak b/rc/base/javascript.kak index a8092707..963b137e 100644 --- a/rc/base/javascript.kak +++ b/rc/base/javascript.kak @@ -2,7 +2,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](js) %{ - set buffer filetype javascript + set-option buffer filetype javascript } # Highlighters @@ -39,19 +39,19 @@ add-highlighter shared/javascript/code regex \b(async|await|break|case|catch|cla # Commands # ‾‾‾‾‾‾‾‾ -def -hidden javascript-filter-around-selections %{ +define-command -hidden javascript-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden javascript-indent-on-char %< +define-command -hidden javascript-indent-on-char %< eval -draft -itersel %< # align closer token to its opener when alone on a line try %/ exec -draft ^\h+[]}]$ m s \A|.\z 1 / > > -def -hidden javascript-indent-on-new-line %< +define-command -hidden javascript-indent-on-new-line %< eval -draft -itersel %< # copy // comments prefix and following white spaces try %{ exec -draft k s ^\h*\K#\h* y gh j P } diff --git a/rc/base/json.kak b/rc/base/json.kak index 848373fe..75a65db8 100644 --- a/rc/base/json.kak +++ b/rc/base/json.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](json) %{ - set buffer filetype json + set-option buffer filetype json } # Highlighters @@ -21,19 +21,19 @@ add-highlighter shared/json/code regex \b(true|false|null|\d+(?:\.\d+)?(?:[eE][+ # Commands # ‾‾‾‾‾‾‾‾ -def -hidden json-filter-around-selections %{ +define-command -hidden json-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden json-indent-on-char %< +define-command -hidden json-indent-on-char %< eval -draft -itersel %< # align closer token to its opener when alone on a line try %< exec -draft ^\h+[]}]$ m s \A|.\z 1 > > > -def -hidden json-indent-on-new-line %< +define-command -hidden json-indent-on-new-line %< eval -draft -itersel %< # preserve previous line indent try %{ exec -draft \; K } diff --git a/rc/base/julia.kak b/rc/base/julia.kak index d04b086f..19219830 100644 --- a/rc/base/julia.kak +++ b/rc/base/julia.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*\.(jl) %{ - set buffer filetype julia + set-option buffer filetype julia } # Highlighters diff --git a/rc/base/lint.kak b/rc/base/lint.kak index 55be2b0e..de17e557 100644 --- a/rc/base/lint.kak +++ b/rc/base/lint.kak @@ -1,12 +1,12 @@ -decl -docstring %{shell command to which the path of a copy of the current buffer will be passed +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 -decl -hidden line-specs lint_flags -decl -hidden range-specs lint_errors +declare-option -hidden line-specs lint_flags +declare-option -hidden range-specs lint_errors -def lint -docstring 'Parse the current buffer with a linter' %{ +define-command lint -docstring 'Parse the current buffer with a linter' %{ %sh{ dir=$(mktemp -d "${TMPDIR:-/tmp}"/kak-lint.XXXXXXXX) mkfifo "$dir"/fifo @@ -14,8 +14,8 @@ def lint -docstring 'Parse the current buffer with a linter' %{ printf '%s\n' "eval -draft %{ edit! -fifo $dir/fifo -debug *lint-output* - set buffer filetype make - set buffer make_current_error_line 0 + set-option buffer filetype make + set-option buffer make_current_error_line 0 hook -group fifo buffer BufCloseFifo .* %{ nop %sh{ rm -r '$dir' } remove-hooks buffer fifo @@ -48,10 +48,10 @@ def lint -docstring 'Parse the current buffer with a linter' %{ errors = substr(errors, 1, length(errors)-1) " (col " $3 ")" } END { - print "set \"buffer=" file "\" lint_flags %{" stamp ":" substr(flags, 1, length(flags)-1) "}" + print "set-option \"buffer=" file "\" lint_flags %{" stamp ":" substr(flags, 1, length(flags)-1) "}" errors = substr(errors, 1, length(errors)-1) gsub("~", "\\~", errors) - print "set \"buffer=" file "\" lint_errors %~" stamp errors "~" + print "set-option \"buffer=" file "\" lint_errors %~" stamp errors "~" } ' "$dir"/stderr | kak -p "$kak_session" @@ -61,7 +61,7 @@ def lint -docstring 'Parse the current buffer with a linter' %{ } } -def -hidden lint-show %{ +define-command -hidden lint-show %{ update-option buffer lint_errors %sh{ desc=$(printf '%s\n' "$kak_opt_lint_errors" | sed -e 's/\([^\\]\):/\1\n/g' | tail -n +2 | @@ -71,17 +71,17 @@ def -hidden lint-show %{ fi } } -def lint-enable -docstring "Activate automatic diagnostics of the code" %{ +define-command lint-enable -docstring "Activate automatic diagnostics of the code" %{ add-highlighter window flag_lines default lint_flags hook window -group lint-diagnostics NormalIdle .* %{ lint-show } } -def lint-disable -docstring "Disable automatic diagnostics of the code" %{ +define-command lint-disable -docstring "Disable automatic diagnostics of the code" %{ remove-highlighter window/hlflags_lint_flags remove-hooks window lint-diagnostics } -def lint-next-error -docstring "Jump to the next line that contains an error" %{ +define-command lint-next-error -docstring "Jump to the next line that contains an error" %{ update-option buffer lint_errors %sh{ printf '%s\n' "$kak_opt_lint_errors" | sed -e 's/\([^\\]\):/\1\n/g' | tail -n +2 | { @@ -102,7 +102,7 @@ def lint-next-error -docstring "Jump to the next line that contains an error" %{ } }} -def lint-previous-error -docstring "Jump to the previous line that contains an error" %{ +define-command lint-previous-error -docstring "Jump to the previous line that contains an error" %{ update-option buffer lint_errors %sh{ printf '%s\n' "$kak_opt_lint_errors" | sed -e 's/\([^\\]\):/\1\n/g' | tail -n +2 | sort -t. -k1,1 -rn | { diff --git a/rc/base/lisp.kak b/rc/base/lisp.kak index 427713c9..3d6c6bc7 100644 --- a/rc/base/lisp.kak +++ b/rc/base/lisp.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](lisp) %{ - set buffer filetype lisp + set-option buffer filetype lisp } # Highlighters @@ -26,12 +26,12 @@ add-highlighter shared/lisp/code regex \b(def[a-z]+|if|do|let|lambda|catch|and|a # Commands # ‾‾‾‾‾‾‾‾ -def -hidden lisp-filter-around-selections %{ +define-command -hidden lisp-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden lisp-indent-on-new-line %{ +define-command -hidden lisp-indent-on-new-line %{ eval -draft -itersel %{ # preserve previous line indent try %{ exec -draft \; K } diff --git a/rc/base/lua.kak b/rc/base/lua.kak index 46979484..ace6d62f 100644 --- a/rc/base/lua.kak +++ b/rc/base/lua.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](lua) %{ - set buffer filetype lua + set-option buffer filetype lua } # Highlighters @@ -26,7 +26,7 @@ add-highlighter shared/lua/code regex \b(and|break|do|else|elseif|end|false|for| # Commands # ‾‾‾‾‾‾‾‾ -def lua-alternative-file -docstring 'Jump to the alternate file (implementation ↔ test)' %{ %sh{ +define-command lua-alternative-file -docstring 'Jump to the alternate file (implementation ↔ test)' %{ %sh{ case $kak_buffile in *spec/*_spec.lua) altfile=$(eval printf %s\\n $(printf %s\\n $kak_buffile | sed s+spec/+'*'/+';'s/_spec//)) @@ -51,14 +51,14 @@ def lua-alternative-file -docstring 'Jump to the alternate file (implementation printf %s\\n "edit $altfile" }} -def -hidden lua-filter-around-selections %{ +define-command -hidden lua-filter-around-selections %{ eval -no-hooks -draft -itersel %{ # remove trailing white spaces try %{ exec -draft s\h+$d } } } -def -hidden lua-indent-on-char %{ +define-command -hidden lua-indent-on-char %{ eval -no-hooks -draft -itersel %{ # align middle and end structures to start and indent when necessary, elseif is already covered by else try %{ exec -draft ^\h*(else)$^\h*(if)s\A|\z' } @@ -66,7 +66,7 @@ def -hidden lua-indent-on-char %{ } } -def -hidden lua-indent-on-new-line %{ +define-command -hidden lua-indent-on-new-line %{ eval -no-hooks -draft -itersel %{ # preserve previous line indent try %{ exec -draft K } @@ -77,7 +77,7 @@ def -hidden lua-indent-on-new-line %{ } } -def -hidden lua-insert-on-new-line %{ +define-command -hidden lua-insert-on-new-line %{ eval -no-hooks -draft -itersel %{ # copy -- comment prefix and following white spaces try %{ exec -draft ks^\h*\K--\h*yghjP } diff --git a/rc/base/mail.kak b/rc/base/mail.kak index 63839e0e..86b76193 100644 --- a/rc/base/mail.kak +++ b/rc/base/mail.kak @@ -1,5 +1,5 @@ hook global BufCreate .+\.eml %{ - set buffer filetype mail + set-option buffer filetype mail } add-highlighter shared/ group mail diff --git a/rc/base/markdown.kak b/rc/base/markdown.kak index d1cbec9b..f0d35854 100644 --- a/rc/base/markdown.kak +++ b/rc/base/markdown.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](markdown|md|mkd) %{ - set buffer filetype markdown + set-option buffer filetype markdown } # Highlighters @@ -123,7 +123,7 @@ add-highlighter shared/markdown/content regex \H\K\h\h$ 0:PrimarySelection # Commands # ‾‾‾‾‾‾‾‾ -def -hidden markdown-indent-on-new-line %{ +define-command -hidden markdown-indent-on-new-line %{ eval -draft -itersel %{ # copy block quote(s), list item prefix and following white spaces try %{ exec -draft k s ^\h*\K((>\h*)+([*+-]\h)?|(>\h*)*[*+-]\h)\h* y gh j P } diff --git a/rc/base/mercurial.kak b/rc/base/mercurial.kak index 3e2a3eac..c626e883 100644 --- a/rc/base/mercurial.kak +++ b/rc/base/mercurial.kak @@ -4,13 +4,13 @@ # Faces # ‾‾‾‾‾ -face MercurialCommitComment cyan +set-face MercurialCommitComment cyan # Detection # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*hg-editor-\w+\.txt$ %{ - set buffer filetype hg-commit + set-option buffer filetype hg-commit } hook -group hg-commit-highlight global WinSetOption filetype=(?!hg-commit).* %{ diff --git a/rc/base/ocaml.kak b/rc/base/ocaml.kak index e6e29dc5..fd3cf362 100644 --- a/rc/base/ocaml.kak +++ b/rc/base/ocaml.kak @@ -7,7 +7,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*\.mli? %{ - set buffer filetype ocaml + set-option buffer filetype ocaml } # Highlighters @@ -23,7 +23,7 @@ add-highlighter shared/ocaml/comment fill comment # Commands # ‾‾‾‾‾‾‾‾ -def -hidden ocaml-indent-on-char %{ +define-command -hidden ocaml-indent-on-char %{ eval -no-hooks -draft -itersel %{ exec ";iGg|ocp-indent --config base=%opt{indentwidth} --indent-empty --lines %val{cursor_line}" } @@ -52,7 +52,7 @@ hook global WinSetOption filetype=(?!ocaml).* %{ echo " add-highlighter shared/ocaml/code regex \b($(printf $keywords | tr : '|'))\b 0:keyword hook global WinSetOption filetype=ocaml %{ - set window static_words $keywords + set-option window static_words $keywords } hook global WinSetOption filetype=(?!ocaml).* %{ unset window static_words diff --git a/rc/base/perl.kak b/rc/base/perl.kak index 89e3b890..03084dc3 100644 --- a/rc/base/perl.kak +++ b/rc/base/perl.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*\.p[lm] %{ - set buffer filetype perl + set-option buffer filetype perl } # Highlighters @@ -41,7 +41,7 @@ add-highlighter shared/perl/comment fill comment # Add the language's grammar to the static completion list printf %s\\n "hook global WinSetOption filetype=perl %{ - set window static_words '${keywords}:${attributes}:${values}' + set-option window static_words '${keywords}:${attributes}:${values}' }" | sed 's,|,:,g' # Highlight keywords @@ -70,7 +70,7 @@ add-highlighter shared/perl/code regex \$(LAST_REGEXP_CODE_RESULT|LIST_SEPARATOR # Commands # ‾‾‾‾‾‾‾‾ -def -hidden perl-indent-on-new-line %~ +define-command -hidden perl-indent-on-new-line %~ eval -draft -itersel %= # preserve previous line indent try %{ exec -draft \;K } @@ -89,12 +89,12 @@ def -hidden perl-indent-on-new-line %~ = ~ -def -hidden perl-indent-on-opening-curly-brace %[ +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 %[ exec -draft -itersel h)M \A\(.*\)\h*\n\h*\{\' s \A|.\z 1 ] ] -def -hidden perl-indent-on-closing-curly-brace %[ +define-command -hidden perl-indent-on-closing-curly-brace %[ # align to opening curly brace when alone on a line try %[ exec -itersel -draft ^\h+\}$hms\A|.\z1 ] ] diff --git a/rc/base/ruby.kak b/rc/base/ruby.kak index eb8bf01a..b0d9d969 100644 --- a/rc/base/ruby.kak +++ b/rc/base/ruby.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*(([.](rb))|(irbrc)|(pryrc)|(Capfile|[.]cap)|(Gemfile)|(Guardfile)|(Rakefile|[.]rake)|(Thorfile|[.]thor)|(Vagrantfile)) %{ - set buffer filetype ruby + set-option buffer filetype ruby } # Highlighters @@ -60,7 +60,7 @@ add-highlighter shared/ruby/code regex \b([A-Za-z]\w*:(?!:))|([$@][A-Za-z]\w*)|( # Add the language's grammar to the static completion list printf %s\\n "hook global WinSetOption filetype=ruby %{ - set window static_words '${keywords}:${attributes}:${values}:${meta}' + set-option window static_words '${keywords}:${attributes}:${values}:${meta}' }" | sed 's,|,:,g' # Highlight keywords @@ -75,7 +75,7 @@ add-highlighter shared/ruby/code regex \b([A-Za-z]\w*:(?!:))|([$@][A-Za-z]\w*)|( # Commands # ‾‾‾‾‾‾‾‾ -def ruby-alternative-file -docstring 'Jump to the alternate file (implementation ↔ test)' %{ %sh{ +define-command ruby-alternative-file -docstring 'Jump to the alternate file (implementation ↔ test)' %{ %sh{ case $kak_buffile in *spec/*_spec.rb) altfile=$(eval echo $(echo $kak_buffile | sed s+spec/+'*'/+';'s/_spec//)) @@ -100,7 +100,7 @@ def ruby-alternative-file -docstring 'Jump to the alternate file (implementation echo "edit $altfile" }} -def -hidden ruby-filter-around-selections %{ +define-command -hidden ruby-filter-around-selections %{ eval -no-hooks -draft -itersel %{ exec # remove trailing white spaces @@ -108,7 +108,7 @@ def -hidden ruby-filter-around-selections %{ } } -def -hidden ruby-indent-on-char %{ +define-command -hidden ruby-indent-on-char %{ eval -no-hooks -draft -itersel %{ # align middle and end structures to start try %{ exec -draft ^ \h * (else|elsif) $ ^ \h * (if) s \A | \z \' } @@ -118,7 +118,7 @@ def -hidden ruby-indent-on-char %{ } } -def -hidden ruby-indent-on-new-line %{ +define-command -hidden ruby-indent-on-new-line %{ eval -no-hooks -draft -itersel %{ # preserve previous line indent try %{ exec -draft K } @@ -129,7 +129,7 @@ def -hidden ruby-indent-on-new-line %{ } } -def -hidden ruby-insert-on-new-line %{ +define-command -hidden ruby-insert-on-new-line %{ eval -no-hooks -draft -itersel %{ # copy _#_ comment prefix and following white spaces try %{ exec -draft k s '^\h*\K#\h*' y gh j P } diff --git a/rc/base/rust.kak b/rc/base/rust.kak index 0b766f00..f52948e6 100644 --- a/rc/base/rust.kak +++ b/rc/base/rust.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](rust|rs) %{ - set buffer filetype rust + set-option buffer filetype rust } # Highlighters @@ -34,12 +34,12 @@ add-highlighter shared/rust/code regex \b(?:u8|u16|u32|u64|usize|i8|i16|i32|i64| # Commands # ‾‾‾‾‾‾‾‾ -def -hidden rust-filter-around-selections %{ +define-command -hidden rust-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden rust-indent-on-new-line %~ +define-command -hidden rust-indent-on-new-line %~ eval -draft -itersel %< # copy // comments prefix and following white spaces try %{ exec -draft k s ^\h*\K//\h* y gh j P } @@ -54,14 +54,14 @@ def -hidden rust-indent-on-new-line %~ > ~ -def -hidden rust-indent-on-opening-curly-brace %[ +define-command -hidden rust-indent-on-opening-curly-brace %[ eval -draft -itersel %_ # align indent with opening paren when { is entered on a new line after the closing paren try %[ exec -draft h ) M \A\(.*\)\h*\n\h*\{\z s \A|.\z 1 ] _ ] -def -hidden rust-indent-on-closing-curly-brace %[ +define-command -hidden rust-indent-on-closing-curly-brace %[ eval -draft -itersel %_ # align to opening curly brace when alone on a line try %[ exec -draft ^\h+\}$ h m s \A|.\z 1 ] diff --git a/rc/base/scala.kak b/rc/base/scala.kak index c080f88d..8f1b782c 100644 --- a/rc/base/scala.kak +++ b/rc/base/scala.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](scala) %{ - set buffer filetype scala + set-option buffer filetype scala } # Highlighters @@ -34,12 +34,12 @@ add-highlighter shared/scala/code regex "'[_A-Za-z0-9$]+" 0:variable # Commands # ‾‾‾‾‾‾‾‾ -def -hidden scala-filter-around-selections %{ +define-command -hidden scala-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden scala-indent-on-new-line %[ +define-command -hidden scala-indent-on-new-line %[ eval -draft -itersel %[ # copy // comments prefix and following white spaces try %[ exec -draft k s ^\h*\K#\h* y gh j P ] @@ -52,7 +52,7 @@ def -hidden scala-indent-on-new-line %[ ] ] -def -hidden scala-indent-on-closing-curly-brace %[ +define-command -hidden scala-indent-on-closing-curly-brace %[ eval -draft -itersel %[ # align to opening curly brace when alone on a line try %[ exec -draft ^\h+\}$ m s \A|.\z 1 ] diff --git a/rc/base/spell.kak b/rc/base/spell.kak index 5fbe56c0..7a870b79 100644 --- a/rc/base/spell.kak +++ b/rc/base/spell.kak @@ -1,8 +1,8 @@ -decl -hidden range-specs spell_regions -decl -hidden str spell_lang -decl -hidden str spell_tmp_file +declare-option -hidden range-specs spell_regions +declare-option -hidden str spell_lang +declare-option -hidden str spell_tmp_file -def -params ..1 \ +define-command -params ..1 \ -docstring %{spell []: spell check the current buffer The first optional argument is the language against which the check will be performed Formats of language supported: @@ -13,7 +13,7 @@ Formats of language supported: %sh{ file=$(mktemp -d "${TMPDIR:-/tmp}"/kak-spell.XXXXXXXX)/buffer printf 'eval -no-hooks write %s\n' "${file}" - printf 'set buffer spell_tmp_file %s\n' "${file}" + printf 'set-option buffer spell_tmp_file %s\n' "${file}" } %sh{ if [ $# -ge 1 ]; then @@ -23,7 +23,7 @@ Formats of language supported: exit 1 else options="-l '$1'" - printf 'set buffer spell_lang %s\n' "$1" + printf 'set-option buffer spell_lang %s\n' "$1" fi fi @@ -49,7 +49,7 @@ Formats of language supported: *) printf 'echo -markup %%{{Error}%s}\n' "${line}" | kak -p "${kak_session}";; esac done - printf 'set "buffer=%s" spell_regions %%{%s}' "${kak_bufname}" "${regions}" \ + printf 'set-option "buffer=%s" spell_regions %%{%s}' "${kak_bufname}" "${regions}" \ | kak -p "${kak_session}" } rm -rf $(dirname "$kak_opt_spell_tmp_file") @@ -57,7 +57,7 @@ Formats of language supported: } } -def spell-next %{ %sh{ +define-command spell-next %{ %sh{ anchor_line="${kak_selection_desc%%.*}" anchor_col="${kak_selection_desc%%,*}" anchor_col="${anchor_col##*.}" @@ -101,7 +101,7 @@ def spell-next %{ %sh{ fi } } -def spell-replace %{ %sh{ +define-command spell-replace %{ %sh{ if [ -n "$kak_opt_spell_lang" ]; then options="-l '$kak_opt_spell_lang'" fi diff --git a/rc/base/sql.kak b/rc/base/sql.kak index ab92e28e..f8360be8 100644 --- a/rc/base/sql.kak +++ b/rc/base/sql.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*/?(?i)sql %{ - set buffer filetype sql + set-option buffer filetype sql } # Highlighters @@ -80,7 +80,7 @@ add-highlighter shared/ regions -default code sql \ # Add the language's grammar to the static completion list printf %s\\n "hook global WinSetOption filetype=sql %{ - set window static_words '${keywords}:${operators}:${functions}:${data_types}:${data_types_fn}:NULL' + set-option window static_words '${keywords}:${operators}:${functions}:${data_types}:${data_types_fn}:NULL' }" | sed 's,|,:,g' # Highlight keywords diff --git a/rc/base/swift.kak b/rc/base/swift.kak index ca768bb2..4cdaa09f 100644 --- a/rc/base/swift.kak +++ b/rc/base/swift.kak @@ -1,5 +1,5 @@ hook global BufCreate .*\.(swift) %{ - set buffer filetype swift + set-option buffer filetype swift } add-highlighter shared/ regions -default code swift \ diff --git a/rc/base/tmux.kak b/rc/base/tmux.kak index 34ece586..b7dbc217 100644 --- a/rc/base/tmux.kak +++ b/rc/base/tmux.kak @@ -14,7 +14,7 @@ hook global KakBegin .* %{ } ## Temporarily override the default client creation command -def -hidden -params 1.. tmux-new-impl %{ +define-command -hidden -params 1.. tmux-new-impl %{ %sh{ tmux=${kak_client_env_TMUX:-$TMUX} if [ -z "$tmux" ]; then @@ -28,19 +28,19 @@ def -hidden -params 1.. tmux-new-impl %{ } } -def tmux-new-vertical -params .. -command-completion -docstring "Create a new vertical pane" %{ +define-command tmux-new-vertical -params .. -command-completion -docstring "Create a new vertical pane" %{ tmux-new-impl 'split-window -v' %arg{@} } -def tmux-new-horizontal -params .. -command-completion -docstring "Create a new horizontal pane" %{ +define-command tmux-new-horizontal -params .. -command-completion -docstring "Create a new horizontal pane" %{ tmux-new-impl 'split-window -h' %arg{@} } -def tmux-new-window -params .. -command-completion -docstring "Create a new window" %{ +define-command tmux-new-window -params .. -command-completion -docstring "Create a new window" %{ tmux-new-impl 'new-window' %arg{@} } -def -docstring %{tmux-focus []: focus the given client +define-command -docstring %{tmux-focus []: focus the given client If no client is passed then the current one is used} \ -params ..1 -client-completion \ tmux-focus %{ %sh{ diff --git a/rc/base/x11.kak b/rc/base/x11.kak index 8c13dd4e..3094b702 100644 --- a/rc/base/x11.kak +++ b/rc/base/x11.kak @@ -1,7 +1,7 @@ -# termcmd should be set such as the next argument is the whole +# termcmd should be set-option such as the next argument is the whole # command line to execute -decl -docstring %{shell command run to spawn a new terminal -A shell command is appended to the one set in this option at runtime} \ +declare-option -docstring %{shell command run to spawn a new terminal +A shell command is appended to the one set-option in this option at runtime} \ str termcmd %sh{ for termcmd in 'alacritty -e sh -c' \ 'termite -e ' \ @@ -21,20 +21,20 @@ A shell command is appended to the one set in this option at runtime} \ done } -def -docstring %{x11-new []: create a new kak client for the current session +define-command -docstring %{x11-new []: create a new kak client for the current session The optional arguments will be passed as arguments to the new client} \ -params .. \ -command-completion \ x11-new %{ %sh{ if [ -z "${kak_opt_termcmd}" ]; then - echo "echo -markup '{Error}termcmd option is not set'" + echo "echo -markup '{Error}termcmd option is not set-option'" exit fi if [ $# -ne 0 ]; then kakoune_params="-e '$@'"; fi setsid ${kak_opt_termcmd} "kak -c ${kak_session} ${kakoune_params}" < /dev/null > /dev/null 2>&1 & }} -def -docstring %{x11-focus []: focus a given client's window +define-command -docstring %{x11-focus []: focus a given client's window If no client is passed, then the current client is used} \ -params ..1 -client-completion \ x11-focus %{ %sh{ diff --git a/rc/base/yaml.kak b/rc/base/yaml.kak index de682a01..da62abbc 100644 --- a/rc/base/yaml.kak +++ b/rc/base/yaml.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](ya?ml) %{ - set buffer filetype yaml + set-option buffer filetype yaml } # Highlighters @@ -28,12 +28,12 @@ add-highlighter shared/yaml/code regex ^\h*-?\h*(\S+): 1:attribute # Commands # ‾‾‾‾‾‾‾‾ -def -hidden yaml-filter-around-selections %{ +define-command -hidden yaml-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden yaml-indent-on-new-line %{ +define-command -hidden yaml-indent-on-new-line %{ eval -draft -itersel %{ # copy '#' comment prefix and following white spaces try %{ exec -draft k s ^\h*\K#\h* y gh j P } diff --git a/rc/core/asciidoc.kak b/rc/core/asciidoc.kak index b0c50442..b2cc2ed9 100644 --- a/rc/core/asciidoc.kak +++ b/rc/core/asciidoc.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .+\.(a(scii)?doc|asc) %{ - set buffer filetype asciidoc + set-option buffer filetype asciidoc } # Highlighters diff --git a/rc/core/c-family.kak b/rc/core/c-family.kak index 67be6470..f2cdf461 100644 --- a/rc/core/c-family.kak +++ b/rc/core/c-family.kak @@ -1,34 +1,34 @@ hook global BufCreate .*\.(cc|cpp|cxx|C|hh|hpp|hxx|H)$ %{ - set buffer filetype cpp + set-option buffer filetype cpp } hook global BufSetOption filetype=c\+\+ %{ - set buffer filetype cpp + set-option buffer filetype cpp } hook global BufCreate .*\.c$ %{ - set buffer filetype c + set-option buffer filetype c } hook global BufCreate .*\.h$ %{ try %{ exec -draft %{%s\b::\b|\btemplate\h*|\bclass\h+\w+|\b(typename|namespace)\b|\b(public|private|protected)\h*:} - set buffer filetype cpp + set-option buffer filetype cpp } catch %{ - set buffer filetype c + set-option buffer filetype c } } hook global BufCreate .*\.m %{ - set buffer filetype objc + set-option buffer filetype objc } -def -hidden c-family-trim-autoindent %[ eval -draft -itersel %[ +define-command -hidden c-family-trim-autoindent %[ eval -draft -itersel %[ # remove the line if it's empty when leaving the insert mode try %[ exec 1s^(\h+)$ d ] ] ] -def -hidden c-family-indent-on-newline %< eval -draft -itersel %< +define-command -hidden c-family-indent-on-newline %< eval -draft -itersel %< exec \; try %< # if previous line closed a paren, copy indent of the opening paren line @@ -59,22 +59,22 @@ def -hidden c-family-indent-on-newline %< eval -draft -itersel %< > > > > -def -hidden c-family-indent-on-opening-curly-brace %[ +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 %[ exec -draft -itersel h)M \A\(.*\)\h*\n\h*\{\z s \A|.\z 1 ] ] -def -hidden c-family-indent-on-closing-curly-brace %[ +define-command -hidden c-family-indent-on-closing-curly-brace %[ # align to opening curly brace when alone on a line try %[ exec -itersel -draft ^\h+\}$hms\A|.\z1 ] ] -def -hidden c-family-insert-on-closing-curly-brace %[ +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 %[ exec -itersel -draft hmB\A\h*(class|struct|union|enum) a\; ] ] -def -hidden c-family-insert-on-newline %[ eval -draft %[ +define-command -hidden c-family-insert-on-newline %[ eval -draft %[ exec \; try %[ eval -draft %[ @@ -161,7 +161,7 @@ add-highlighter shared/c/code regex %{\b-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)?|[ # Add the language's grammar to the static completion list printf %s\\n "hook global WinSetOption filetype=c %{ - set window static_words '${keywords}:${attributes}:${types}:${values}' + set-option window static_words '${keywords}:${attributes}:${types}:${values}' }" | sed 's,|,:,g' # Highlight keywords @@ -192,7 +192,7 @@ add-highlighter shared/cpp/code regex %{\b-?(0x[0-9a-fA-F]+|\d+)[fdiu]?|'((\\.)? # Add the language's grammar to the static completion list printf %s\\n "hook global WinSetOption filetype=cpp %{ - set window static_words '${keywords}:${attributes}:${types}:${values}' + set-option window static_words '${keywords}:${attributes}:${types}:${values}' }" | sed 's,|,:,g' # Highlight keywords @@ -231,7 +231,7 @@ add-highlighter shared/objc/code regex %{\b-?\d+[fdiu]?|'((\\.)?|[^'\\])'} 0:val # Add the language's grammar to the static completion list printf %s\\n "hook global WinSetOption filetype=objc %{ - set window static_words '${keywords}:${attributes}:${types}:${values}:${decorators}' + set-option window static_words '${keywords}:${attributes}:${types}:${values}:${decorators}' }" | sed 's,|,:,g' # Highlight keywords @@ -278,13 +278,13 @@ hook -group cpp-highlight global WinSetOption filetype=(?!cpp).* %[ remove-highl hook -group objc-highlight global WinSetOption filetype=objc %[ add-highlighter window ref objc ] hook -group objc-highlight global WinSetOption filetype=(?!objc).* %[ remove-highlighter window/objc ] -decl -docstring %{control the type of include guard to be inserted in empty headers +declare-option -docstring %{control the type of include guard to be inserted in empty headers Can be one of the following: ifdef: old style ifndef/define guard pragma: newer type of guard using "pragma once"} \ str c_include_guard_style "ifdef" -def -hidden c-family-insert-include-guards %{ +define-command -hidden c-family-insert-include-guards %{ %sh{ case "${kak_opt_c_include_guard_style}" in ifdef) @@ -300,10 +300,10 @@ def -hidden c-family-insert-include-guards %{ hook -group c-family-insert global BufNewFile .*\.(h|hh|hpp|hxx|H) c-family-insert-include-guards -decl -docstring "colon separated list of path in which header files will be looked for" \ +declare-option -docstring "colon separated list of path in which header files will be looked for" \ str-list alt_dirs ".:.." -def c-family-alternative-file -docstring "Jump to the alternate file (header/implementation)" %{ %sh{ +define-command c-family-alternative-file -docstring "Jump to the alternate file (header/implementation)" %{ %sh{ alt_dirs=$(printf %s\\n "${kak_opt_alt_dirs}" | tr ':' '\n') file="${kak_buffile##*/}" file_noext="${file%.*}" diff --git a/rc/core/comment.kak b/rc/core/comment.kak index eebb6ab3..8fd4a90a 100644 --- a/rc/core/comment.kak +++ b/rc/core/comment.kak @@ -1,99 +1,99 @@ ## Line comments -decl -docstring "characters inserted at the beginning of a commented line" \ +declare-option -docstring "characters inserted at the beginning of a commented line" \ str comment_line '#' ## Block comments -decl -docstring "colon separated tuple containing the characters inserted before/after a commented line" \ +declare-option -docstring "colon separated tuple containing the characters inserted before/after a commented line" \ str-list comment_block ## Default comments for all languages hook global BufSetOption filetype=asciidoc %{ - set buffer comment_block '///:///' + set-option buffer comment_block '///:///' } hook global BufSetOption filetype=(c|cpp|go|java|javascript|objc|php|sass|scala|scss|swift) %{ - set buffer comment_line '//' - set buffer comment_block '/*:*/' + set-option buffer comment_line '//' + set-option buffer comment_block '/*:*/' } hook global BufSetOption filetype=(cabal|haskell|moon) %{ - set buffer comment_line '--' - set buffer comment_block '{-:-}' + set-option buffer comment_line '--' + set-option buffer comment_block '{-:-}' } hook global BufSetOption filetype=clojure %{ - set buffer comment_line '#_ ' - set buffer comment_block '(comment :)' + set-option buffer comment_line '#_ ' + set-option buffer comment_block '(comment :)' } hook global BufSetOption filetype=coffee %{ - set buffer comment_block '###:###' + set-option buffer comment_block '###:###' } hook global BufSetOption filetype=css %{ - set buffer comment_line '' - set buffer comment_block '/*:*/' + set-option buffer comment_line '' + set-option buffer comment_block '/*:*/' } hook global BufSetOption filetype=d %{ - set buffer comment_line '//' - set buffer comment_block '/+:+/' + set-option buffer comment_line '//' + set-option buffer comment_block '/+:+/' } hook global BufSetOption filetype=(gas|ini) %{ - set buffer comment_line ';' + set-option buffer comment_line ';' } hook global BufSetOption filetype=haml %{ - set buffer comment_line '-#' + set-option buffer comment_line '-#' } hook global BufSetOption filetype=html %{ - set buffer comment_line '' - set buffer comment_block '' + set-option buffer comment_line '' + set-option buffer comment_block '' } hook global BufSetOption filetype=latex %{ - set buffer comment_line '%' + set-option buffer comment_line '%' } hook global BufSetOption filetype=lisp %{ - set buffer comment_line ';' - set buffer comment_block '#|:|#' + set-option buffer comment_line ';' + set-option buffer comment_block '#|:|#' } hook global BufSetOption filetype=lua %{ - set buffer comment_line '--' - set buffer comment_block '--[[:]]' + set-option buffer comment_line '--' + set-option buffer comment_block '--[[:]]' } hook global BufSetOption filetype=markdown %{ - set buffer comment_line '' - set buffer comment_block '[//]: # (:)' + set-option buffer comment_line '' + set-option buffer comment_block '[//]: # (:)' } hook global BufSetOption filetype=perl %{ - set buffer comment_block '#[:]' + set-option buffer comment_block '#[:]' } hook global BufSetOption filetype=(pug|rust) %{ - set buffer comment_line '//' + set-option buffer comment_line '//' } hook global BufSetOption filetype=python %{ - set buffer comment_block "''':'''" + set-option buffer comment_block "''':'''" } hook global BufSetOption filetype=ragel %{ - set buffer comment_line '%%' - set buffer comment_block '%%{:}%%' + set-option buffer comment_line '%%' + set-option buffer comment_block '%%{:}%%' } hook global BufSetOption filetype=ruby %{ - set buffer comment_block '^begin=:^=end' + set-option buffer comment_block '^begin=:^=end' } -def comment-block -docstring '(un)comment selected lines using block comments' %{ +define-command comment-block -docstring '(un)comment selected lines using block comments' %{ %sh{ exec_proof() { ## Replace the '<' sign that is interpreted differently in `exec` @@ -126,7 +126,7 @@ def comment-block -docstring '(un)comment selected lines using block comments' % } } -def comment-line -docstring '(un)comment selected lines using line comments' %{ +define-command comment-line -docstring '(un)comment selected lines using line comments' %{ %sh{ readonly opening="${kak_opt_comment_line}" readonly opening_escaped="\\Q${opening}\\E" diff --git a/rc/core/diff.kak b/rc/core/diff.kak index 18c934f7..425efaca 100644 --- a/rc/core/diff.kak +++ b/rc/core/diff.kak @@ -1,5 +1,5 @@ hook global BufCreate .*\.(diff|patch) %{ - set buffer filetype diff + set-option buffer filetype diff } add-highlighter shared/ group diff diff --git a/rc/core/doc.kak b/rc/core/doc.kak index c3a03bc9..370a9e2e 100644 --- a/rc/core/doc.kak +++ b/rc/core/doc.kak @@ -1,4 +1,4 @@ -decl -docstring "name of the client in which documentation is to be displayed" \ +declare-option -docstring "name of the client in which documentation is to be displayed" \ str docsclient declare-option -hidden range-specs doc_render_ranges @@ -11,7 +11,7 @@ define-command -hidden -params 4 doc-render-regex %{ %sh{ ranges=$(echo "$kak_selections_desc" | sed -e "s/:/|$4:/g; s/\$/|$4/") echo "update-option buffer doc_render_ranges" - echo "set -add buffer doc_render_ranges '$ranges'" + echo "set-option -add buffer doc_render_ranges '$ranges'" } } } } @@ -27,7 +27,7 @@ define-command -params 1 -hidden doc-render %{ try %{ exec -draft \%s \h*(\+|:{2,})$ d } # Setup the doc_render_ranges option - set buffer doc_render_ranges %val{timestamp} + set-option buffer doc_render_ranges %val{timestamp} doc-render-regex \B(?]: grep utility wrapper All the optional arguments are forwarded to the grep utility} \ grep %{ %sh{ @@ -18,8 +18,8 @@ All the optional arguments are forwarded to the grep utility} \ printf %s\\n "eval -try-client '$kak_opt_toolsclient' %{ edit! -fifo ${output} -scroll *grep* - set buffer filetype grep - set buffer grep_current_line 0 + set-option buffer filetype grep + set-option buffer grep_current_line 0 hook -group fifo buffer BufCloseFifo .* %{ nop %sh{ rm -r $(dirname ${output}) } remove-hooks buffer fifo @@ -43,21 +43,21 @@ hook global WinSetOption filetype=(?!grep).* %{ remove-hooks buffer grep-hooks } -decl -docstring "name of the client in which all source code jumps will be executed" \ +declare-option -docstring "name of the client in which all source code jumps will be executed" \ str jumpclient -def -hidden grep-jump %{ +define-command -hidden grep-jump %{ eval -collapse-jumps %{ try %{ exec 's^((?:\w:)?[^:]+):(\d+):(\d+)?' - set buffer grep_current_line %val{cursor_line} + set-option buffer grep_current_line %val{cursor_line} eval -try-client %opt{jumpclient} edit -existing %reg{1} %reg{2} %reg{3} try %{ focus %opt{jumpclient} } } } } -def grep-next-match -docstring 'Jump to the next grep match' %{ +define-command grep-next-match -docstring 'Jump to the next grep match' %{ eval -collapse-jumps -try-client %opt{jumpclient} %{ buffer '*grep*' # First jump to enf of buffer so that if grep_current_line == 0 @@ -69,7 +69,7 @@ def grep-next-match -docstring 'Jump to the next grep match' %{ try %{ eval -client %opt{toolsclient} %{ exec gg %opt{grep_current_line}g } } } -def grep-previous-match -docstring 'Jump to the previous grep match' %{ +define-command grep-previous-match -docstring 'Jump to the previous grep match' %{ eval -collapse-jumps -try-client %opt{jumpclient} %{ buffer '*grep*' # See comment in grep-next-match diff --git a/rc/core/kakrc.kak b/rc/core/kakrc.kak index b954962d..9479aa22 100644 --- a/rc/core/kakrc.kak +++ b/rc/core/kakrc.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate (.*/)?(kakrc|.*.kak) %{ - set buffer filetype kak + set-option buffer filetype kak } # Highlighters & Completion @@ -42,8 +42,8 @@ add-highlighter shared/ regions -default code kakrc \ # Add the language's grammar to the static completion list printf '%s\n' "hook global WinSetOption filetype=kak %{ - set window static_words '$(join "${keywords}:${attributes}:${types}:${values}" ':')' - set -- window extra_word_chars '-' + set-option window static_words '$(join "${keywords}:${attributes}:${types}:${values}" ':')' + set-option -- window extra_word_chars '-' }" # Highlight keywords (which are always surrounded by whitespace) @@ -63,7 +63,7 @@ add-highlighter shared/kakrc/shell ref sh # Commands # ‾‾‾‾‾‾‾‾ -def -hidden kak-indent-on-new-line %{ +define-command -hidden kak-indent-on-new-line %{ eval -draft -itersel %{ # copy '#' comment prefix and following white spaces try %{ exec -draft k s ^\h*#\h* y jgh P } @@ -85,7 +85,7 @@ hook global WinSetOption filetype=kak %{ hook window InsertChar \n -group kak-indent kak-indent-on-new-line # cleanup trailing whitespaces on current line insert end hook window InsertEnd .* -group kak-indent %{ try %{ exec -draft \; s ^\h+$ d } } - set buffer extra_word_chars '-' + set-option buffer extra_word_chars '-' } hook -group kak-highlight global WinSetOption filetype=(?!kak).* %{ remove-highlighter window/kakrc } diff --git a/rc/core/make.kak b/rc/core/make.kak index 9aba90ba..b3056aa2 100644 --- a/rc/core/make.kak +++ b/rc/core/make.kak @@ -1,13 +1,13 @@ -decl -docstring "shell command run to build the project" \ +declare-option -docstring "shell command run to build the project" \ str makecmd make -decl -docstring "pattern that describes lines containing information about errors in the output of the `makecmd` command" \ +declare-option -docstring "pattern that describes lines containing information about errors in the output of the `makecmd` command" \ str make_error_pattern " (?:fatal )?error:" -decl -docstring "name of the client in which utilities display information" \ +declare-option -docstring "name of the client in which utilities display information" \ str toolsclient -decl -hidden int make_current_error_line +declare-option -hidden int make_current_error_line -def -params .. \ +define-command -params .. \ -docstring %{make []: make utility wrapper All the optional arguments are forwarded to the make utility} \ make %{ %sh{ @@ -17,8 +17,8 @@ All the optional arguments are forwarded to the make utility} \ printf %s\\n "eval -try-client '$kak_opt_toolsclient' %{ edit! -fifo ${output} -scroll *make* - set buffer filetype make - set buffer make_current_error_line 0 + set-option buffer filetype make + set-option buffer make_current_error_line 0 hook -group fifo buffer BufCloseFifo .* %{ nop %sh{ rm -r $(dirname ${output}) } remove-hooks buffer fifo @@ -43,26 +43,26 @@ hook global WinSetOption filetype=(?!make).* %{ remove-hooks buffer make-hooks } -decl -docstring "name of the client in which all source code jumps will be executed" \ +declare-option -docstring "name of the client in which all source code jumps will be executed" \ str jumpclient -def -hidden make-jump %{ +define-command -hidden make-jump %{ eval -collapse-jumps %{ try %{ exec gl "Entering directory" # Try to parse the error into capture groups, failing on absolute paths exec s "Entering directory '([^']+)'.*\n([^:/][^:]*):(\d+):(?:(\d+):)?([^\n]+)\z" l - set buffer make_current_error_line %val{cursor_line} + set-option buffer make_current_error_line %val{cursor_line} eval -try-client %opt{jumpclient} "edit -existing %reg{1}/%reg{2} %reg{3} %reg{4}; echo -markup %{{Information}%reg{5}}; try %{ focus }" } catch %{ exec s "((?:\w:)?[^:]+):(\d+):(?:(\d+):)?([^\n]+)\z" l - set buffer make_current_error_line %val{cursor_line} + set-option buffer make_current_error_line %val{cursor_line} eval -try-client %opt{jumpclient} "edit -existing %reg{1} %reg{2} %reg{3}; echo -markup %{{Information}%reg{4}}; try %{ focus }" } } } -def make-next-error -docstring 'Jump to the next make error' %{ +define-command make-next-error -docstring 'Jump to the next make error' %{ eval -collapse-jumps -try-client %opt{jumpclient} %{ buffer '*make*' exec "%opt{make_current_error_line}ggl" "/^(?:\w:)?[^:\n]+:\d+:(?:\d+:)?%opt{make_error_pattern}" @@ -71,7 +71,7 @@ def make-next-error -docstring 'Jump to the next make error' %{ try %{ eval -client %opt{toolsclient} %{ exec %opt{make_current_error_line}g } } } -def make-previous-error -docstring 'Jump to the previous make error' %{ +define-command make-previous-error -docstring 'Jump to the previous make error' %{ eval -collapse-jumps -try-client %opt{jumpclient} %{ buffer '*make*' exec "%opt{make_current_error_line}g" "^(?:\w:)?[^:\n]+:\d+:(?:\d+:)?%opt{make_error_pattern}" diff --git a/rc/core/makefile.kak b/rc/core/makefile.kak index 06e93402..0567087f 100644 --- a/rc/core/makefile.kak +++ b/rc/core/makefile.kak @@ -2,7 +2,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*/?[mM]akefile %{ - set buffer filetype makefile + set-option buffer filetype makefile } # Highlighters @@ -24,7 +24,7 @@ add-highlighter shared/makefile/content regex [+?:]= 0:operator # Add the language's grammar to the static completion list printf %s\\n "hook global WinSetOption filetype=makefile %{ - set window static_words '${keywords}' + set-option window static_words '${keywords}' }" | sed 's,|,:,g' # Highlight keywords @@ -34,7 +34,7 @@ add-highlighter shared/makefile/content regex [+?:]= 0:operator # Commands # ‾‾‾‾‾‾‾‾ -def -hidden makefile-indent-on-new-line %{ +define-command -hidden makefile-indent-on-new-line %{ eval -draft -itersel %{ # preserve previous line indent try %{ exec -draft \;K } diff --git a/rc/core/man.kak b/rc/core/man.kak index fc0064be..8d997ac4 100644 --- a/rc/core/man.kak +++ b/rc/core/man.kak @@ -1,7 +1,7 @@ -decl -docstring "name of the client in which documentation is to be displayed" \ +declare-option -docstring "name of the client in which documentation is to be displayed" \ str docsclient -decl -hidden str manpage +declare-option -hidden str manpage hook -group man-highlight global WinSetOption filetype=man %{ add-highlighter window group man-highlight @@ -27,7 +27,7 @@ hook global WinSetOption filetype=(?!man).* %{ remove-hooks window man-hooks } -def -hidden -params 1..2 man-impl %{ %sh{ +define-command -hidden -params 1..2 man-impl %{ %sh{ manout=$(mktemp "${TMPDIR:-/tmp}"/kak-man-XXXXXX) colout=$(mktemp "${TMPDIR:-/tmp}"/kak-man-XXXXXX) MANWIDTH=${kak_window_width} man "$@" > $manout 2>/dev/null @@ -39,8 +39,8 @@ def -hidden -params 1..2 man-impl %{ %sh{ edit -scratch '*man*' exec '%|cat${colout}gk' nop %sh{rm ${colout}} - set buffer filetype man - set window manpage '$@' + set-option buffer filetype man + set-option window manpage '$@' " else printf %s\\n "echo -markup %{{Error}man '$@' failed: see *debug* buffer for details}" @@ -48,7 +48,7 @@ def -hidden -params 1..2 man-impl %{ %sh{ fi } } -def -params ..1 \ +define-command -params ..1 \ -shell-completion %{ prefix=$(printf %s\\n "$1" | cut -c1-${kak_pos_in_token} 2>/dev/null) for page in /usr/share/man/*/${prefix}*.[1-8]*; do diff --git a/rc/core/python.kak b/rc/core/python.kak index 15e94806..306cbeba 100644 --- a/rc/core/python.kak +++ b/rc/core/python.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](py) %{ - set buffer filetype python + set-option buffer filetype python } # Highlighters & Completion @@ -42,7 +42,7 @@ add-highlighter shared/python/comment fill comment # Add the language's grammar to the static completion list printf %s\\n "hook global WinSetOption filetype=python %{ - set window static_words '${values}:${meta}:${keywords}:${types}:${functions}' + set-option window static_words '${values}:${meta}:${keywords}:${types}:${functions}' }" | sed 's,|,:,g' # Highlight keywords @@ -63,7 +63,7 @@ add-highlighter shared/python/comment fill comment # Commands # ‾‾‾‾‾‾‾‾ -def -hidden python-indent-on-new-line %{ +define-command -hidden python-indent-on-new-line %{ eval -draft -itersel %{ # copy '#' comment prefix and following white spaces try %{ exec -draft k s ^\h*#\h* y jgh P } diff --git a/rc/core/sh.kak b/rc/core/sh.kak index bd840b5f..1fc0ec49 100644 --- a/rc/core/sh.kak +++ b/rc/core/sh.kak @@ -1,5 +1,5 @@ hook global BufCreate .*\.(z|ba|c|k)?sh(rc|_profile)? %{ - set buffer filetype sh + set-option buffer filetype sh } add-highlighter shared/ regions -default code -match-capture sh \ @@ -23,7 +23,7 @@ add-highlighter shared/sh/heredoc fill string # Add the language's grammar to the static completion list printf %s\\n "hook global WinSetOption filetype=sh %{ - set window static_words '${keywords}' + set-option window static_words '${keywords}' }" | sed 's,|,:,g' # Highlight keywords diff --git a/rc/extra/autorestore.kak b/rc/extra/autorestore.kak index 0db6d3b8..6ded8991 100644 --- a/rc/extra/autorestore.kak +++ b/rc/extra/autorestore.kak @@ -1,8 +1,8 @@ -decl -docstring "remove backups once they've been restored" \ +declare-option -docstring "remove backups once they've been restored" \ bool autorestore_purge_restored true ## Insert the content of the backup file into the current buffer, if a suitable one is found -def autorestore-restore-buffer -docstring "Restore the backup for the current file if it exists" %{ +define-command autorestore-restore-buffer -docstring "Restore the backup for the current file if it exists" %{ %sh{ buffer_basename="${kak_buffile##*/}" buffer_dirname=$(dirname "${kak_buffile}") @@ -48,7 +48,7 @@ def autorestore-restore-buffer -docstring "Restore the backup for the current fi } ## Remove all the backups that have been created for the current buffer -def autorestore-purge-backups -docstring "Remove all the backups of the current buffer" %{ +define-command autorestore-purge-backups -docstring "Remove all the backups of the current buffer" %{ %sh{ [ ! -f "${kak_buffile}" ] && exit @@ -64,7 +64,7 @@ def autorestore-purge-backups -docstring "Remove all the backups of the current } ## If for some reason, backup files need to be ignored -def autorestore-disable -docstring "Disable automatic backup recovering" %{ +define-command autorestore-disable -docstring "Disable automatic backup recovering" %{ remove-hooks global autorestore } diff --git a/rc/extra/cabal.kak b/rc/extra/cabal.kak index 8e11b692..c22f5b1a 100644 --- a/rc/extra/cabal.kak +++ b/rc/extra/cabal.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](cabal) %{ - set buffer filetype cabal + set-option buffer filetype cabal } # Highlighters @@ -24,12 +24,12 @@ add-highlighter shared/cabal/code regex ^\h*([A-Za-z][A-Za-z0-9_-]*)\h*: 1:varia # Commands # ‾‾‾‾‾‾‾‾ -def -hidden cabal-filter-around-selections %{ +define-command -hidden cabal-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden cabal-indent-on-new-line %[ +define-command -hidden cabal-indent-on-new-line %[ eval -draft -itersel %[ # copy '#' comment prefix and following white spaces try %[ exec -draft k s ^\h*\K#\h* y gh j P ] @@ -42,14 +42,14 @@ def -hidden cabal-indent-on-new-line %[ ] ] -def -hidden cabal-indent-on-opening-curly-brace %[ +define-command -hidden cabal-indent-on-opening-curly-brace %[ eval -draft -itersel %[ # align indent with opening paren when { is entered on a new line after the closing paren try %[ exec -draft h ) M \A\(.*\)\h*\n\h*\{\z s \A|.\z 1 ] ] ] -def -hidden cabal-indent-on-closing-curly-brace %[ +define-command -hidden cabal-indent-on-closing-curly-brace %[ eval -draft -itersel %[ # align to opening curly brace when alone on a line try %[ exec -draft ^\h+\}$ h m s \A|.\z 1 ] diff --git a/rc/extra/clang.kak b/rc/extra/clang.kak index 6396a6a0..9d9e3e90 100644 --- a/rc/extra/clang.kak +++ b/rc/extra/clang.kak @@ -1,19 +1,19 @@ -decl -docstring "options to pass to the `clang` shell command" \ +declare-option -docstring "options to pass to the `clang` shell command" \ str clang_options -decl -hidden str clang_tmp_dir -decl -hidden completions clang_completions -decl -hidden line-specs clang_flags -decl -hidden line-specs clang_errors +declare-option -hidden str clang_tmp_dir +declare-option -hidden completions clang_completions +declare-option -hidden line-specs clang_flags +declare-option -hidden line-specs clang_errors -def -params ..1 \ +define-command -params ..1 \ -docstring %{Parse the contents of the current buffer The syntaxic errors detected during parsing are shown when auto-diagnostics are enabled} \ clang-parse %{ %sh{ dir=$(mktemp -d "${TMPDIR:-/tmp}"/kak-clang.XXXXXXXX) mkfifo ${dir}/fifo - printf %s\\n "set buffer clang_tmp_dir ${dir}" + printf %s\\n "set-option buffer clang_tmp_dir ${dir}" printf %s\\n "eval -no-hooks write ${dir}/buf" } # end the previous %sh{} so that its output gets interpreted by kakoune @@ -22,8 +22,8 @@ The syntaxic errors detected during parsing are shown when auto-diagnostics are dir=${kak_opt_clang_tmp_dir} printf %s\\n "eval -draft %{ edit! -fifo ${dir}/fifo -debug *clang-output* - set buffer filetype make - set buffer make_current_error_line 0 + set-option buffer filetype make + set-option buffer make_current_error_line 0 hook -group fifo buffer BufCloseFifo .* %{ nop %sh{ rm -r ${dir} } remove-hooks buffer fifo @@ -76,7 +76,7 @@ The syntaxic errors detected during parsing are shown when auto-diagnostics are } }' | paste -s -d ':' - | sed -e "s/\\\\n/\\n/g; s/'/\\\\'/g") printf %s\\n "eval -client ${kak_client} echo 'clang completion done' - set 'buffer=${kak_buffile}' clang_completions '${header}:${compl}'" | kak -p ${kak_session} + set-option 'buffer=${kak_buffile}' clang_completions '${header}:${compl}'" | kak -p ${kak_session} else clang++ -x ${ft} -fsyntax-only ${kak_opt_clang_options} - < ${dir}/buf 2> ${dir}/stderr printf %s\\n "eval -client ${kak_client} echo 'clang parsing done'" | kak -p ${kak_session} @@ -95,15 +95,15 @@ The syntaxic errors detected during parsing are shown when auto-diagnostics are sed -e "s||${kak_bufname}|g" < ${dir}/stderr > ${dir}/fifo - printf %s\\n "set 'buffer=${kak_buffile}' clang_flags %{${kak_timestamp}:${flags}} - set 'buffer=${kak_buffile}' clang_errors '${kak_timestamp}:${errors}'" | kak -p ${kak_session} + printf %s\\n "set-option 'buffer=${kak_buffile}' clang_flags %{${kak_timestamp}:${flags}} + set-option 'buffer=${kak_buffile}' clang_errors '${kak_timestamp}:${errors}'" | kak -p ${kak_session} ) > /dev/null 2>&1 < /dev/null & } } -def clang-complete -docstring "Complete the current selection" %{ clang-parse -complete } +define-command clang-complete -docstring "Complete the current selection" %{ clang-parse -complete } -def -hidden clang-show-completion-info %[ try %[ +define-command -hidden clang-show-completion-info %[ try %[ eval -draft %[ exec {( ^\( b \A\w+\z %sh[ @@ -114,8 +114,8 @@ def -hidden clang-show-completion-info %[ try %[ ] ] ] ] -def clang-enable-autocomplete -docstring "Enable automatic clang completion" %{ - set window completers "option=clang_completions:%opt{completers}" +define-command clang-enable-autocomplete -docstring "Enable automatic clang completion" %{ + set-option window completers "option=clang_completions:%opt{completers}" hook window -group clang-autocomplete InsertIdle .* %{ try %{ exec -draft (\.|->|::).\z @@ -127,13 +127,13 @@ def clang-enable-autocomplete -docstring "Enable automatic clang completion" %{ alias window complete clang-complete } -def clang-disable-autocomplete -docstring "Disable automatic clang completion" %{ - set window completers %sh{ printf %s\\n "'${kak_opt_completers}'" | sed -e 's/option=clang_completions://g' } +define-command clang-disable-autocomplete -docstring "Disable automatic clang completion" %{ + set-option window completers %sh{ printf %s\\n "'${kak_opt_completers}'" | sed -e 's/option=clang_completions://g' } remove-hooks window clang-autocomplete unalias window complete clang-complete } -def -hidden clang-show-error-info %{ +define-command -hidden clang-show-error-info %{ update-option buffer clang_errors # Ensure we are up to date with buffer changes %sh{ desc=$(printf %s\\n "${kak_opt_clang_errors}" | @@ -144,7 +144,7 @@ def -hidden clang-show-error-info %{ fi } } -def clang-enable-diagnostics -docstring %{Activate automatic error reporting and diagnostics +define-command clang-enable-diagnostics -docstring %{Activate automatic error reporting and diagnostics Information about the analysis are showned after the buffer has been parsed with the clang-parse function} \ %{ add-highlighter window flag_lines default clang_flags @@ -152,12 +152,12 @@ Information about the analysis are showned after the buffer has been parsed with hook window -group clang-diagnostics WinSetOption ^clang_errors=.* %{ info; clang-show-error-info } } -def clang-disable-diagnostics -docstring "Disable automatic error reporting and diagnostics" %{ +define-command clang-disable-diagnostics -docstring "Disable automatic error reporting and diagnostics" %{ remove-highlighter window/hlflags_clang_flags remove-hooks window clang-diagnostics } -def clang-diagnostics-next -docstring "Jump to the next line that contains an error" %{ +define-command clang-diagnostics-next -docstring "Jump to the next line that contains an error" %{ update-option buffer clang_errors # Ensure we are up to date with buffer changes %sh{ printf "%s\n" "${kak_opt_clang_errors}" | sed -e 's/\([^\\]\):/\1\n/g' | tail -n +2 | ( diff --git a/rc/extra/coffee.kak b/rc/extra/coffee.kak index 25d9428c..37b2c443 100644 --- a/rc/extra/coffee.kak +++ b/rc/extra/coffee.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](coffee) %{ - set buffer filetype coffee + set-option buffer filetype coffee } # Highlighters @@ -45,7 +45,7 @@ add-highlighter shared/coffee/code regex \b(break|case|catch|class|const|continu # Commands # ‾‾‾‾‾‾‾‾ -def -hidden coffee-filter-around-selections %{ +define-command -hidden coffee-filter-around-selections %{ eval -draft -itersel %{ exec # remove trailing white spaces @@ -53,7 +53,7 @@ def -hidden coffee-filter-around-selections %{ } } -def -hidden coffee-indent-on-new-line %{ +define-command -hidden coffee-indent-on-new-line %{ eval -draft -itersel %{ # copy '#' comment prefix and following white spaces try %{ exec -draft k s '^\h*\K#\h*' y gh j P } diff --git a/rc/extra/cucumber.kak b/rc/extra/cucumber.kak index b8dee97d..504c3f3b 100644 --- a/rc/extra/cucumber.kak +++ b/rc/extra/cucumber.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](feature|story) %{ - set buffer filetype cucumber + set-option buffer filetype cucumber } # Highlighters @@ -56,12 +56,12 @@ add-highlighter shared/cucumber/code regex \b(Feature|Business\h+Need|Ability|Ba # Commands # ‾‾‾‾‾‾‾‾ -def -hidden cucumber-filter-around-selections %{ +define-command -hidden cucumber-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden cucumber-indent-on-new-line %{ +define-command -hidden cucumber-indent-on-new-line %{ eval -draft -itersel %{ # copy '#' comment prefix and following white spaces try %{ exec -draft k s ^\h*\K#\h* y gh j P } diff --git a/rc/extra/dockerfile.kak b/rc/extra/dockerfile.kak index 11d0ed98..10f87c0e 100644 --- a/rc/extra/dockerfile.kak +++ b/rc/extra/dockerfile.kak @@ -7,7 +7,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*Dockerfile %{ - set buffer filetype dockerfile + set-option buffer filetype dockerfile } # Highlighters diff --git a/rc/extra/editorconfig.kak b/rc/extra/editorconfig.kak index 456eb623..e827613f 100644 --- a/rc/extra/editorconfig.kak +++ b/rc/extra/editorconfig.kak @@ -1,9 +1,9 @@ # http://editorconfig.org/#file-format-details # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -decl -hidden bool editorconfig_trim_trailing_whitespace false +declare-option -hidden bool editorconfig_trim_trailing_whitespace false -def editorconfig-load -params ..1 -docstring "editorconfig-load [file]: set formatting behavior according to editorconfig" %{ +define-command editorconfig-load -params ..1 -docstring "editorconfig-load [file]: set-option formatting behavior according to editorconfig" %{ remove-hooks buffer editorconfig-hooks %sh{ command -v editorconfig >/dev/null 2>&1 || { echo 'echo -markup "{Error}editorconfig could not be found"'; exit 1; } @@ -17,24 +17,24 @@ def editorconfig-load -params ..1 -docstring "editorconfig-load [file]: set form END { if (indent_style == "tab") { - print "set buffer indentwidth 0" - print "set buffer aligntab true" + print "set-option buffer indentwidth 0" + print "set-option buffer aligntab true" } if (indent_style == "space") { - print "set buffer indentwidth " (indent_size == "tab" ? 4 : indent_size) - print "set buffer aligntab false" + print "set-option buffer indentwidth " (indent_size == "tab" ? 4 : indent_size) + print "set-option buffer aligntab false" } if (indent_size || tab_width) { - print "set buffer tabstop " (tab_width ? tab_width : indent_size) + print "set-option buffer tabstop " (tab_width ? tab_width : indent_size) } if (end_of_line == "lf" || end_of_line == "crlf") { - print "set buffer eolformat " end_of_line + print "set-option buffer eolformat " end_of_line } if (charset == "utf-8-bom") { - print "set buffer BOM utf8" + print "set-option buffer BOM utf8" } if (trim_trailing_whitespace == "true") { - print "set buffer editorconfig_trim_trailing_whitespace true" + print "set-option buffer editorconfig_trim_trailing_whitespace true" } } ' diff --git a/rc/extra/elixir.kak b/rc/extra/elixir.kak index b8651fcf..3b30053f 100644 --- a/rc/extra/elixir.kak +++ b/rc/extra/elixir.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](ex|exs) %{ - set buffer filetype elixir + set-option buffer filetype elixir } @@ -42,12 +42,12 @@ add-highlighter shared/elixir/code regex '\b\d+[\d_]*\b' 0:value # Commands # ‾‾‾‾‾‾‾‾ -def -hidden elixir-filter-around-selections %{ +define-command -hidden elixir-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden elixir-indent-on-new-line %{ +define-command -hidden elixir-indent-on-new-line %{ eval -draft -itersel %{ # copy -- comments prefix and following white spaces try %{ exec -draft k s ^\h*\K--\h* y gh j P } diff --git a/rc/extra/elm.kak b/rc/extra/elm.kak index 4764a9a6..f4be40f6 100644 --- a/rc/extra/elm.kak +++ b/rc/extra/elm.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](elm) %{ - set buffer filetype elm + set-option buffer filetype elm } # Highlighters @@ -29,16 +29,16 @@ add-highlighter shared/elm/code regex \b(Array|Bool|Char|Float|Int|String)\b 0:t # http://elm-lang.org/docs/style-guide -def -hidden elm-filter-around-selections %{ +define-command -hidden elm-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden elm-indent-after " +define-command -hidden elm-indent-after " exec -draft \\; k x ^\\h*(if)|(case\\h+[\\w']+\\h+of|let|in|\\{\\h+\\w+|\\w+\\h+->|[=(])$ j " -def -hidden elm-indent-on-new-line %{ +define-command -hidden elm-indent-on-new-line %{ eval -draft -itersel %{ # copy -- comments prefix and following white spaces try %{ exec -draft k s ^\h*\K--\h* y gh j P } diff --git a/rc/extra/exherbo.kak b/rc/extra/exherbo.kak index 07bc05f7..d5bdd772 100644 --- a/rc/extra/exherbo.kak +++ b/rc/extra/exherbo.kak @@ -1,29 +1,29 @@ ## Repository metadata files -hook global BufCreate .*/metadata/mirrors\.conf %{ set buffer filetype paludis-mirrors-conf } -hook global BufCreate .*/metadata/licence_groups.conf %{ set buffer filetype exheres-0-licence-groups } -hook global BufCreate .*/metadata/options/descriptions/.*\.conf %{ set buffer filetype exheres-0-licence-groups } -hook global BufCreate .*/metadata/.*\.conf %{ set buffer filetype exheres-0-metadata } +hook global BufCreate .*/metadata/mirrors\.conf %{ set-option buffer filetype paludis-mirrors-conf } +hook global BufCreate .*/metadata/licence_groups.conf %{ set-option buffer filetype exheres-0-licence-groups } +hook global BufCreate .*/metadata/options/descriptions/.*\.conf %{ set-option buffer filetype exheres-0-licence-groups } +hook global BufCreate .*/metadata/.*\.conf %{ set-option buffer filetype exheres-0-metadata } ## News items -hook global BufCreate .*/metadata/news/.*/.*\.txt %{ set buffer filetype glep42 } +hook global BufCreate .*/metadata/news/.*/.*\.txt %{ set-option buffer filetype glep42 } ## exheres-0, exlib -hook global BufCreate .*\.(exheres-0|exlib) %{ set buffer filetype sh } +hook global BufCreate .*\.(exheres-0|exlib) %{ set-option buffer filetype sh } # Paludis configurations -hook global BufCreate .*/etc/paludis(-.*)?/bashrc %{ set buffer filetype sh } -hook global BufCreate .*/etc/paludis(-.*)?/general(\.conf.d/.*.conf|\.conf) %{ set buffer filetype paludis-key-value-conf } -hook global BufCreate .*/etc/paludis(-.*)?/licences(\.conf.d/.*.conf|\.conf) %{ set buffer filetype paludis-options-conf } -hook global BufCreate .*/etc/paludis(-.*)?/mirrors(\.conf.d/.*.conf|\.conf) %{ set buffer filetype paludis-mirrors-conf } -hook global BufCreate .*/etc/paludis(-.*)?/options(\.conf.d/.*.conf|\.conf) %{ set buffer filetype paludis-options-conf } -hook global BufCreate .*/etc/paludis(-.*)?/output(\.conf.d/.*.conf|\.conf) %{ set buffer filetype paludis-key-value-conf } -hook global BufCreate .*/etc/paludis(-.*)?/package_(unmask|mask)(\.conf.d/.*.conf|\.conf) %{ set buffer filetype paludis-specs-conf } -hook global BufCreate .*/etc/paludis(-.*)?/platforms(\.conf.d/.*.conf|\.conf) %{ set buffer filetype paludis-specs-conf } -hook global BufCreate .*/etc/paludis(-.*)?/repositories/.*\.conf %{ set buffer filetype paludis-key-value-conf } -hook global BufCreate .*/etc/paludis(-.*)?/repository\.template %{ set buffer filetype paludis-key-value-conf } -hook global BufCreate .*/etc/paludis(-.*)?/repository_defaults\.conf %{ set buffer filetype paludis-key-value-conf } -hook global BufCreate .*/etc/paludis(-.*)?/specpath\.conf %{ set buffer filetype paludis-key-value-conf } -hook global BufCreate .*/etc/paludis(-.*)?/suggestions(\.conf.d/.*.conf|\.conf) %{ set buffer filetype paludis-specs-conf } +hook global BufCreate .*/etc/paludis(-.*)?/bashrc %{ set-option buffer filetype sh } +hook global BufCreate .*/etc/paludis(-.*)?/general(\.conf.d/.*.conf|\.conf) %{ set-option buffer filetype paludis-key-value-conf } +hook global BufCreate .*/etc/paludis(-.*)?/licences(\.conf.d/.*.conf|\.conf) %{ set-option buffer filetype paludis-options-conf } +hook global BufCreate .*/etc/paludis(-.*)?/mirrors(\.conf.d/.*.conf|\.conf) %{ set-option buffer filetype paludis-mirrors-conf } +hook global BufCreate .*/etc/paludis(-.*)?/options(\.conf.d/.*.conf|\.conf) %{ set-option buffer filetype paludis-options-conf } +hook global BufCreate .*/etc/paludis(-.*)?/output(\.conf.d/.*.conf|\.conf) %{ set-option buffer filetype paludis-key-value-conf } +hook global BufCreate .*/etc/paludis(-.*)?/package_(unmask|mask)(\.conf.d/.*.conf|\.conf) %{ set-option buffer filetype paludis-specs-conf } +hook global BufCreate .*/etc/paludis(-.*)?/platforms(\.conf.d/.*.conf|\.conf) %{ set-option buffer filetype paludis-specs-conf } +hook global BufCreate .*/etc/paludis(-.*)?/repositories/.*\.conf %{ set-option buffer filetype paludis-key-value-conf } +hook global BufCreate .*/etc/paludis(-.*)?/repository\.template %{ set-option buffer filetype paludis-key-value-conf } +hook global BufCreate .*/etc/paludis(-.*)?/repository_defaults\.conf %{ set-option buffer filetype paludis-key-value-conf } +hook global BufCreate .*/etc/paludis(-.*)?/specpath\.conf %{ set-option buffer filetype paludis-key-value-conf } +hook global BufCreate .*/etc/paludis(-.*)?/suggestions(\.conf.d/.*.conf|\.conf) %{ set-option buffer filetype paludis-specs-conf } # Highlighters ## exheres-0 Repository metadata files diff --git a/rc/extra/git-tools.kak b/rc/extra/git-tools.kak index ad01b212..f5ee8d30 100644 --- a/rc/extra/git-tools.kak +++ b/rc/extra/git-tools.kak @@ -1,4 +1,4 @@ -decl -docstring "name of the client in which documentation is to be displayed" \ +declare-option -docstring "name of the client in which documentation is to be displayed" \ str docsclient hook -group git-log-highlight global WinSetOption filetype=git-log %{ @@ -17,13 +17,13 @@ hook -group git-status-highlight global WinSetOption filetype=git-status %{ hook -group git-status-highlight global WinSetOption filetype=(?!git-status).* %{ remove-highlighter window/git-status-highlight } -decl -hidden line-specs git_blame_flags -decl -hidden line-specs git_diff_flags +declare-option -hidden line-specs git_blame_flags +declare-option -hidden line-specs git_diff_flags -face GitBlame default,magenta -face GitDiffFlags default,black +set-face GitBlame default,magenta +set-face GitDiffFlags default,black -def -params 1.. \ +define-command -params 1.. \ -docstring %sh{printf '%%{git []: git wrapping helper All the optional arguments are forwarded to the git utility Available commands:\n-add\n-rm\n-blame\n-commit\n-checkout\n-diff\n-hide-blame\n-log\n-show\n-show-diff\n-status\n-update-diff}'} \ @@ -45,7 +45,7 @@ Available commands:\n-add\n-rm\n-blame\n-commit\n-checkout\n-diff\n-hide-blame\n printf %s "eval -try-client '$kak_opt_docsclient' %{ edit! -fifo ${output} *git* - set buffer filetype '${filetype}' + set-option buffer filetype '${filetype}' hook -group fifo buffer BufCloseFifo .* %{ nop %sh{ rm -r $(dirname ${output}) } remove-hooks buffer fifo @@ -57,7 +57,7 @@ Available commands:\n-add\n-rm\n-blame\n-commit\n-checkout\n-diff\n-hide-blame\n ( printf %s "eval -client '$kak_client' %{ try %{ add-highlighter window flag_lines GitBlame git_blame_flags } - set buffer=$kak_bufname git_blame_flags '$kak_timestamp' + set-option buffer=$kak_bufname git_blame_flags '$kak_timestamp' }" | kak -p ${kak_session} git blame "$@" --incremental ${kak_buffile} | awk ' function send_flags(text, flag, i) { @@ -70,7 +70,7 @@ Available commands:\n-add\n-rm\n-blame\n-commit\n-checkout\n-diff\n-hide-blame\n flag=flag ":" line+i "|" text } cmd = "kak -p " ENVIRON["kak_session"] - print "set -add buffer=" ENVIRON["kak_bufname"] " git_blame_flags %{" flag "}" | cmd + print "set-option -add buffer=" ENVIRON["kak_bufname"] " git_blame_flags %{" flag "}" | cmd close(cmd) } /^([0-9a-f]{40}) ([0-9]+) ([0-9]+) ([0-9]+)/ { @@ -107,7 +107,7 @@ Available commands:\n-add\n-rm\n-blame\n-commit\n-checkout\n-diff\n-hide-blame\n line++ } /^\-/ { flags=flags ":" line "|{red}-" } - END { print "set buffer git_diff_flags ", flags } + END { print "set-option buffer git_diff_flags ", flags } ' } @@ -142,7 +142,7 @@ Available commands:\n-add\n-rm\n-blame\n-commit\n-checkout\n-diff\n-hide-blame\n blame) shift; run_git_blame "$@" ;; hide-blame) printf %s "try %{ - set buffer=$kak_bufname git_blame_flags '' + set-option buffer=$kak_bufname git_blame_flags '' remove-highlighter window/hlflags_git_blame_flags }" ;; diff --git a/rc/extra/go-tools.kak b/rc/extra/go-tools.kak index 70623fe3..ba5da4fd 100644 --- a/rc/extra/go-tools.kak +++ b/rc/extra/go-tools.kak @@ -16,13 +16,13 @@ # Auto-completion # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -decl -hidden str go_complete_tmp_dir -decl -hidden completions gocode_completions +declare-option -hidden str go_complete_tmp_dir +declare-option -hidden completions gocode_completions -def go-complete -docstring "Complete the current selection with gocode" %{ +define-command go-complete -docstring "Complete the current selection with gocode" %{ %sh{ dir=$(mktemp -d "${TMPDIR:-/tmp}"/kak-go.XXXXXXXX) - printf %s\\n "set buffer go_complete_tmp_dir ${dir}" + printf %s\\n "set-option buffer go_complete_tmp_dir ${dir}" printf %s\\n "eval -no-hooks write ${dir}/buf" } %sh{ @@ -35,14 +35,14 @@ def go-complete -docstring "Complete the current selection with gocode" %{ header="${kak_cursor_line}.$((${kak_cursor_column} - $column_offset))@${kak_timestamp}" compl=$(echo "${gocode_data}" | sed 1d | awk -F ",," '{print $2 "||" $1}' | paste -s -d: -) printf %s\\n "eval -client '${kak_client}' %{ - set buffer=${kak_bufname} gocode_completions '${header}:${compl}' + set-option buffer=${kak_bufname} gocode_completions '${header}:${compl}' }" | kak -p ${kak_session} ) > /dev/null 2>&1 < /dev/null & } } -def go-enable-autocomplete -docstring "Add gocode completion candidates to the completer" %{ - set window completers "option=gocode_completions:%opt{completers}" +define-command go-enable-autocomplete -docstring "Add gocode completion candidates to the completer" %{ + set-option window completers "option=gocode_completions:%opt{completers}" hook window -group go-autocomplete InsertIdle .* %{ try %{ exec -draft [\w\.].\z go-complete @@ -50,8 +50,8 @@ def go-enable-autocomplete -docstring "Add gocode completion candidates to the c alias window complete go-complete } -def go-disable-autocomplete -docstring "Disable gocode completion" %{ - set window completers %sh{ printf %s\\n "'${kak_opt_completers}'" | sed 's/option=gocode_completions://g' } +define-command go-disable-autocomplete -docstring "Disable gocode completion" %{ + set-option window completers %sh{ printf %s\\n "'${kak_opt_completers}'" | sed 's/option=gocode_completions://g' } remove-hooks window go-autocomplete unalias window complete go-complete } @@ -59,13 +59,13 @@ def go-disable-autocomplete -docstring "Disable gocode completion" %{ # Auto-format # ‾‾‾‾‾‾‾‾‾‾‾ -decl -hidden str go_format_tmp_dir +declare-option -hidden str go_format_tmp_dir -def -params ..1 go-format \ +define-command -params ..1 go-format \ -docstring "go-format [-use-goimports]: custom formatter for go files" %{ %sh{ dir=$(mktemp -d "${TMPDIR:-/tmp}"/kak-go.XXXXXXXX) - printf %s\\n "set buffer go_format_tmp_dir ${dir}" + printf %s\\n "set-option buffer go_format_tmp_dir ${dir}" printf %s\\n "eval -no-hooks write ${dir}/buf" } %sh{ @@ -90,13 +90,13 @@ def -params ..1 go-format \ # Documentation # ‾‾‾‾‾‾‾‾‾‾‾‾‾ -decl -hidden str go_doc_tmp_dir +declare-option -hidden str go_doc_tmp_dir # FIXME text escaping -def -hidden -params 1..2 gogetdoc-cmd %{ +define-command -hidden -params 1..2 gogetdoc-cmd %{ %sh{ dir=$(mktemp -d "${TMPDIR:-/tmp}"/kak-go.XXXXXXXX) - printf %s\\n "set buffer go_doc_tmp_dir ${dir}" + printf %s\\n "set-option buffer go_doc_tmp_dir ${dir}" printf %s\\n "eval -no-hooks write ${dir}/buf" } %sh{ @@ -160,19 +160,19 @@ def -hidden -params 1..2 gogetdoc-cmd %{ } } -def go-doc-info -docstring "Show the documention of the symbol under the cursor" %{ +define-command go-doc-info -docstring "Show the documention of the symbol under the cursor" %{ gogetdoc-cmd "info" } -def go-print-signature -docstring "Print the signature of the symbol under the cursor" %{ +define-command go-print-signature -docstring "Print the signature of the symbol under the cursor" %{ gogetdoc-cmd "echo" } -def go-jump -docstring "Jump to the symbol definition" %{ +define-command go-jump -docstring "Jump to the symbol definition" %{ gogetdoc-cmd "jump" 1 } -def go-share-selection -docstring "Share the selection using the Go Playground" %{ %sh{ +define-command go-share-selection -docstring "Share the selection using the Go Playground" %{ %sh{ snippet_id=$(printf %s\\n "${kak_selection}" | curl -s https://play.golang.org/share --data-binary @-) printf "echo https://play.golang.org/p/%s" ${snippet_id} } } diff --git a/rc/extra/haml.kak b/rc/extra/haml.kak index d9806112..856d77d8 100644 --- a/rc/extra/haml.kak +++ b/rc/extra/haml.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](haml) %{ - set buffer filetype haml + set-option buffer filetype haml } # Highlighters @@ -33,12 +33,12 @@ add-highlighter shared/haml/code regex ^\h*%([A-Za-z][A-Za-z0-9_-]*)([#.][A-Za-z # Commands # ‾‾‾‾‾‾‾‾ -def -hidden haml-filter-around-selections %{ +define-command -hidden haml-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden haml-indent-on-new-line %{ +define-command -hidden haml-indent-on-new-line %{ eval -draft -itersel %{ # copy '/' comment prefix and following white spaces try %{ exec -draft k s ^\h*\K/\h* y gh j P } diff --git a/rc/extra/hbs.kak b/rc/extra/hbs.kak index f80dcad1..4f18299e 100644 --- a/rc/extra/hbs.kak +++ b/rc/extra/hbs.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](hbs) %{ - set buffer filetype hbs + set-option buffer filetype hbs } # Highlighters @@ -34,12 +34,12 @@ add-highlighter shared/hbs/block-expression regex ((\w|-)+)=(('|").*?('|")) 1:at # Commands # ‾‾‾‾‾‾‾‾ -def -hidden hbs-filter-around-selections %{ +define-command -hidden hbs-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden hbs-indent-on-new-line %{ +define-command -hidden hbs-indent-on-new-line %{ eval -draft -itersel %{ # copy '/' comment prefix and following white spaces try %{ exec -draft k s ^\h*\K/\h* y j p } diff --git a/rc/extra/iterm.kak b/rc/extra/iterm.kak index 9a35000d..3e4ca05e 100644 --- a/rc/extra/iterm.kak +++ b/rc/extra/iterm.kak @@ -14,7 +14,7 @@ hook global KakBegin .* %{ } } -def -hidden -params 1.. iterm-new-split-impl %{ +define-command -hidden -params 1.. iterm-new-split-impl %{ %sh{ direction="$1" shift @@ -33,15 +33,15 @@ def -hidden -params 1.. iterm-new-split-impl %{ } } -def iterm-new-vertical -params .. -command-completion -docstring "Create a new vertical pane" %{ +define-command iterm-new-vertical -params .. -command-completion -docstring "Create a new vertical pane" %{ iterm-new-split-impl 'vertically' %arg{@} } -def iterm-new-horizontal -params .. -command-completion -docstring "Create a new horizontal pane" %{ +define-command iterm-new-horizontal -params .. -command-completion -docstring "Create a new horizontal pane" %{ iterm-new-split-impl 'horizontally' %arg{@} } -def -params .. -command-completion \ +define-command -params .. -command-completion \ -docstring %{iterm-new-tab []: create a new tab All optional arguments are forwarded to the new kak client} \ iterm-new-tab %{ @@ -60,7 +60,7 @@ All optional arguments are forwarded to the new kak client} \ } } -def -params .. -command-completion \ +define-command -params .. -command-completion \ -docstring %{iterm-new-window []: create a new window All optional arguments are forwarded to the new kak client} \ iterm-new-window %{ @@ -69,7 +69,7 @@ All optional arguments are forwarded to the new kak client} \ sh_cmd="kak -c ${kak_session} ${kakoune_params}" osascript \ -e "tell application \"iTerm\"" \ - -e " set w to (create window with default profile)" \ + -e " set-option w to (create window with default profile)" \ -e " tell current session of w" \ -e " write text \"export TMPDIR='${TMPDIR}'\"" \ -e " write text \"exec ${sh_cmd}\"" \ @@ -78,7 +78,7 @@ All optional arguments are forwarded to the new kak client} \ } } -def -params ..1 -client-completion \ +define-command -params ..1 -client-completion \ -docstring %{iterm-focus []: focus the given client If no client is passed then the current one is used} \ iterm-focus %{ diff --git a/rc/extra/jedi.kak b/rc/extra/jedi.kak index cf3c35f5..a9b4dfbe 100644 --- a/rc/extra/jedi.kak +++ b/rc/extra/jedi.kak @@ -1,13 +1,13 @@ -decl -hidden str jedi_tmp_dir -decl -hidden completions jedi_completions -decl -docstring "colon separated list of path added to `python`'s $PYTHONPATH environment variable" \ +declare-option -hidden str jedi_tmp_dir +declare-option -hidden completions jedi_completions +declare-option -docstring "colon separated list of path added to `python`'s $PYTHONPATH environment variable" \ str-list jedi_python_path -def jedi-complete -docstring "Complete the current selection" %{ +define-command jedi-complete -docstring "Complete the current selection" %{ %sh{ dir=$(mktemp -d "${TMPDIR:-/tmp}"/kak-jedi.XXXXXXXX) mkfifo ${dir}/fifo - printf %s\\n "set buffer jedi_tmp_dir ${dir}" + printf %s\\n "set-option buffer jedi_tmp_dir ${dir}" printf %s\\n "eval -no-hooks write ${dir}/buf" } %sh{ @@ -24,14 +24,14 @@ def jedi-complete -docstring "Complete the current selection" %{ print(':'.join([(str(c.name).replace("|", "\\|") + "|" + str(c.docstring()).replace("|", "\\|")).replace(":", "\\:") + "|" + str(c.name).replace("|", "\\|") for c in script.completions()]).replace("'", r"\\\\'")) END ) - printf %s\\n "eval -client ${kak_client} 'echo completed; set %{buffer=${kak_buffile}} jedi_completions \'${header}:${compl}\''" | kak -p ${kak_session} + printf %s\\n "eval -client ${kak_client} 'echo completed; set-option %{buffer=${kak_buffile}} jedi_completions \'${header}:${compl}\''" | kak -p ${kak_session} rm -r ${dir} ) > /dev/null 2>&1 < /dev/null & } } -def jedi-enable-autocomplete -docstring "Add jedi completion candidates to the completer" %{ - set window completers "option=jedi_completions:%opt{completers}" +define-command jedi-enable-autocomplete -docstring "Add jedi completion candidates to the completer" %{ + set-option window completers "option=jedi_completions:%opt{completers}" hook window -group jedi-autocomplete InsertIdle .* %{ try %{ exec -draft \..\z echo 'completing...' @@ -40,8 +40,8 @@ def jedi-enable-autocomplete -docstring "Add jedi completion candidates to the c alias window complete jedi-complete } -def jedi-disable-autocomplete -docstring "Disable jedi completion" %{ - set window completers %sh{ printf %s\\n "'${kak_opt_completers}'" | sed -e 's/option=jedi_completions://g' } +define-command jedi-disable-autocomplete -docstring "Disable jedi completion" %{ + set-option window completers %sh{ printf %s\\n "'${kak_opt_completers}'" | sed -e 's/option=jedi_completions://g' } remove-hooks window jedi-autocomplete unalias window complete jedi-complete } diff --git a/rc/extra/kickstart.kak b/rc/extra/kickstart.kak index ec33ec58..807d92b1 100644 --- a/rc/extra/kickstart.kak +++ b/rc/extra/kickstart.kak @@ -1,5 +1,5 @@ hook global BufCreate .*\.ks %{ - set buffer filetype kickstart + set-option buffer filetype kickstart } add-highlighter shared/ regions -default code kickstart \ diff --git a/rc/extra/latex.kak b/rc/extra/latex.kak index 49a017ec..0b2ef860 100644 --- a/rc/extra/latex.kak +++ b/rc/extra/latex.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*\.tex %{ - set buffer filetype latex + set-option buffer filetype latex } # Highlighters diff --git a/rc/extra/modeline.kak b/rc/extra/modeline.kak index dc14779a..8e87d1e6 100644 --- a/rc/extra/modeline.kak +++ b/rc/extra/modeline.kak @@ -7,10 +7,10 @@ ## Only a few options are supported, in order to prevent the ## buffers from poking around the configuration too much -decl -docstring "amount of lines that will be checked at the beginning and the end of the buffer" \ +declare-option -docstring "amount of lines that will be checked at the beginning and the end of the buffer" \ int modelines 5 -def -hidden modeline-parse-impl %{ +define-command -hidden modeline-parse-impl %{ %sh{ # Translate a vim option into the corresponding kakoune one translate_opt_vim() { @@ -37,7 +37,7 @@ def -hidden modeline-parse-impl %{ *) printf %s\\n "echo -debug 'Unsupported vim variable: ${key}'";; esac - [ -n "${tr}" ] && printf %s\\n "set buffer ${tr}" + [ -n "${tr}" ] && printf %s\\n "set-option buffer ${tr}" } # Pass a few whitelisted options to kakoune directly @@ -51,7 +51,7 @@ def -hidden modeline-parse-impl %{ return;; esac - printf %s\\n "set buffer ${key} ${value}" + printf %s\\n "set-option buffer ${key} ${value}" } case "${kak_selection}" in @@ -93,7 +93,7 @@ def -hidden modeline-parse-impl %{ # ref. options.txt (in vim `:help options`) : 2 forms of modelines: # [text]{white}{vi:|vim:|ex:}[white]{options} # [text]{white}{vi:|vim:|Vim:|ex:}[white]se[t] {options}:[text] -def modeline-parse -docstring "Read and interpret vi-format modelines at the beginning/end of the buffer" %{ +define-command modeline-parse -docstring "Read and interpret vi-format modelines at the beginning/end of the buffer" %{ try %{ eval -draft %{ exec \%s\A|.\z %opt{modelines}k %opt{modelines}X \ s^\S*?\s+?(vim?|kak(oune)?):\s?[^\n]+ diff --git a/rc/extra/moon.kak b/rc/extra/moon.kak index e8ff52ad..f57a281d 100644 --- a/rc/extra/moon.kak +++ b/rc/extra/moon.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](moon) %{ - set buffer filetype moon + set-option buffer filetype moon } # Highlighters @@ -30,7 +30,7 @@ add-highlighter shared/moon/code regex \b(and|break|catch|class|continue|do|else # Commands # ‾‾‾‾‾‾‾‾ -def moon-alternative-file -docstring 'Jump to the alternate file (implementation ↔ test)' %{ %sh{ +define-command moon-alternative-file -docstring 'Jump to the alternate file (implementation ↔ test)' %{ %sh{ case $kak_buffile in *spec/*_spec.moon) altfile=$(eval printf %s\\n $(printf %s\\n $kak_buffile | sed s+spec/+'*'/+';'s/_spec//)) @@ -55,7 +55,7 @@ def moon-alternative-file -docstring 'Jump to the alternate file (implementation printf %s\\n "edit $altfile" }} -def -hidden moon-filter-around-selections %{ +define-command -hidden moon-filter-around-selections %{ eval -draft -itersel %{ exec # remove trailing white spaces @@ -63,7 +63,7 @@ def -hidden moon-filter-around-selections %{ } } -def -hidden moon-indent-on-char %{ +define-command -hidden moon-indent-on-char %{ eval -draft -itersel %{ # align _else_ statements to start try %{ exec -draft ^ \h * (else(if)?) $ ^ \h * (if|unless|when) s \A | \z \' } @@ -74,7 +74,7 @@ def -hidden moon-indent-on-char %{ } } -def -hidden moon-indent-on-new-line %{ +define-command -hidden moon-indent-on-new-line %{ eval -draft -itersel %{ # copy -- comment prefix and following white spaces try %{ exec -draft k s ^ \h * \K -- \h * y gh j P } diff --git a/rc/extra/php.kak b/rc/extra/php.kak index 3939ca1a..d3993f5d 100644 --- a/rc/extra/php.kak +++ b/rc/extra/php.kak @@ -2,7 +2,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](php) %{ - set buffer filetype php + set-option buffer filetype php } # Highlighters @@ -32,19 +32,19 @@ add-highlighter shared/php/code regex \b(__halt_compiler|abstract|and|array|as|b # Commands # ‾‾‾‾‾‾‾‾ -def -hidden php-filter-around-selections %{ +define-command -hidden php-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden php-indent-on-char %< +define-command -hidden php-indent-on-char %< eval -draft -itersel %< # align closer token to its opener when alone on a line try %/ exec -draft ^\h+[]}]$ m s \A|.\z 1 / > > -def -hidden php-indent-on-new-line %< +define-command -hidden php-indent-on-new-line %< eval -draft -itersel %< # copy // comments prefix and following white spaces try %{ exec -draft k s ^\h*\K#\h* y gh j P } diff --git a/rc/extra/pony.kak b/rc/extra/pony.kak index 44dd290e..eecbc3d3 100644 --- a/rc/extra/pony.kak +++ b/rc/extra/pony.kak @@ -5,21 +5,21 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](pony) %{ - set buffer filetype pony + set-option buffer filetype pony } # Highlighters & Completion # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -addhl shared/ regions -default code pony \ +add-highlighter shared/ regions -default code pony \ double_string '"""' '"""' '' \ double_string '"' (?' 0:type - addhl shared/pony/code regex '\b(${keywords})\b' 0:keyword - addhl shared/pony/code regex ';' 0:keyword - addhl shared/pony/code regex '^\s*|' 0:keyword - addhl shared/pony/code regex '\b(${struct})\b' 0:variable - addhl shared/pony/code regex '\b(${capabilities})\b(!|^)?' 1:builtin 2:builtin + add-highlighter shared/pony/code regex '\b(${values})\b' 0:value + add-highlighter shared/pony/code regex '\b(${meta})\b' 0:meta + add-highlighter shared/pony/code regex '\b(${func_decl})(\s+(${capabilities}))?(\s+\w+)\(' 1:type 3:builtin 4:builtin + add-highlighter shared/pony/code regex '\b(${func_decl})\b' 0:type + add-highlighter shared/pony/code regex '=>' 0:type + add-highlighter shared/pony/code regex '\b(${keywords})\b' 0:keyword + add-highlighter shared/pony/code regex ';' 0:keyword + add-highlighter shared/pony/code regex '^\s*|' 0:keyword + add-highlighter shared/pony/code regex '\b(${struct})\b' 0:variable + add-highlighter shared/pony/code regex '\b(${capabilities})\b(!|^)?' 1:builtin 2:builtin " # Highlight types and attributes printf %s " - addhl shared/pony/code regex '@[\w_]+\b' 0:attribute + add-highlighter shared/pony/code regex '@[\w_]+\b' 0:attribute " } # Commands # ‾‾‾‾‾‾‾‾ -def -hidden pony-indent-on-new-line %{ +define-command -hidden pony-indent-on-new-line %{ eval -draft -itersel %{ # preserve previous line indent try %{ exec -draft K } @@ -82,7 +82,7 @@ def -hidden pony-indent-on-new-line %{ # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook -group pony-highlight global WinSetOption filetype=pony %{ addhl window ref pony } +hook -group pony-highlight global WinSetOption filetype=pony %{ add-highlighter window ref pony } hook global WinSetOption filetype=pony %{ hook window InsertChar \n -group pony-indent pony-indent-on-new-line @@ -91,12 +91,12 @@ hook global WinSetOption filetype=pony %{ } hook global WinSetOption filetype=pony %{ - set buffer tabstop 2 - set buffer indentwidth 2 + set-option buffer tabstop 2 + set-option buffer indentwidth 2 } -hook -group pony-highlight global WinSetOption filetype=(?!pony).* %{ rmhl pony } +hook -group pony-highlight global WinSetOption filetype=(?!pony).* %{ remove-highlighter pony } hook global WinSetOption filetype=(?!pony).* %{ - rmhooks window pony-indent + remove-hooks window pony-indent } diff --git a/rc/extra/pug.kak b/rc/extra/pug.kak index fd2778a8..31efb34c 100644 --- a/rc/extra/pug.kak +++ b/rc/extra/pug.kak @@ -9,7 +9,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](pug|jade) %{ - set buffer filetype pug + set-option buffer filetype pug } # Highlighters @@ -44,12 +44,12 @@ add-highlighter shared/pug/code regex ((?:\.[A-Za-z][A-Za-z0-9_-]* # Commands # ‾‾‾‾‾‾‾‾ -def -hidden pug-filter-around-selections %{ +define-command -hidden pug-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden pug-indent-on-new-line %{ +define-command -hidden pug-indent-on-new-line %{ eval -draft -itersel %{ # preserve previous line indent try %{ exec -draft \; K } diff --git a/rc/extra/racer.kak b/rc/extra/racer.kak index ce8b5190..73b3a6fd 100644 --- a/rc/extra/racer.kak +++ b/rc/extra/racer.kak @@ -1,10 +1,10 @@ -decl -hidden str racer_tmp_dir -decl -hidden completions racer_completions +declare-option -hidden str racer_tmp_dir +declare-option -hidden completions racer_completions -def racer-complete -docstring "Complete the current selection with racer" %{ +define-command racer-complete -docstring "Complete the current selection with racer" %{ %sh{ dir=$(mktemp -d "${TMPDIR:-/tmp}"/kak-racer.XXXXXXXX) - printf %s\\n "set buffer racer_tmp_dir ${dir}" + printf %s\\n "set-option buffer racer_tmp_dir ${dir}" printf %s\\n "eval -no-hooks %{ write ${dir}/buf }" } %sh{ @@ -45,15 +45,15 @@ def racer-complete -docstring "Complete the current selection with racer" %{ }' ) printf %s\\n "eval -client '${kak_client}' %{ - set buffer=${kak_bufname} racer_completions %@${compl}@ + set-option buffer=${kak_bufname} racer_completions %@${compl}@ }" | kak -p ${kak_session} rm -r ${dir} ) > /dev/null 2>&1 < /dev/null & } } -def racer-enable-autocomplete -docstring "Add racer completion candidates to the completer" %{ - set window completers "option=racer_completions:%opt{completers}" +define-command racer-enable-autocomplete -docstring "Add racer completion candidates to the completer" %{ + set-option window completers "option=racer_completions:%opt{completers}" hook window -group racer-autocomplete InsertIdle .* %{ try %{ exec -draft ([\w\.]|::).\z racer-complete @@ -61,8 +61,8 @@ def racer-enable-autocomplete -docstring "Add racer completion candidates to the alias window complete racer-complete } -def racer-disable-autocomplete -docstring "Disable racer completion" %{ - set window completers %sh{ printf %s\\n "'${kak_opt_completers}'" | sed 's/option=racer_completions://g' } - rmhooks window racer-autocomplete +define-command racer-disable-autocomplete -docstring "Disable racer completion" %{ + set-option window completers %sh{ printf %s\\n "'${kak_opt_completers}'" | sed 's/option=racer_completions://g' } + remove-hooks window racer-autocomplete unalias window complete racer-complete } diff --git a/rc/extra/ragel.kak b/rc/extra/ragel.kak index 4f228962..f93bdf88 100644 --- a/rc/extra/ragel.kak +++ b/rc/extra/ragel.kak @@ -7,7 +7,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](ragel|rl) %{ - set buffer filetype ragel + set-option buffer filetype ragel } # Highlighters @@ -29,12 +29,12 @@ add-highlighter shared/ragel/code regex \b(action|alnum|alpha|any|ascii|case|cnt # Commands # ‾‾‾‾‾‾‾‾ -def -hidden ragel-filter-around-selections %{ +define-command -hidden ragel-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden ragel-indent-on-char %< +define-command -hidden ragel-indent-on-char %< eval -draft -itersel %< # align closer token to its opener when alone on a line try %< exec -draft ^\h+[]})]$ m s \A|.\z 1 > @@ -42,7 +42,7 @@ def -hidden ragel-indent-on-char %< > > -def -hidden ragel-indent-on-new-line %< +define-command -hidden ragel-indent-on-new-line %< eval -draft -itersel %< # copy _#_ comment prefix and following white spaces try %{ exec -draft k s ^\h*\K#\h* y gh j P } diff --git a/rc/extra/ranger.kak b/rc/extra/ranger.kak index e27980a6..48687b5c 100644 --- a/rc/extra/ranger.kak +++ b/rc/extra/ranger.kak @@ -1,7 +1,7 @@ # http://ranger.nongnu.org # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -def ranger-open-on-edit-directory \ +define-command ranger-open-on-edit-directory \ -docstring 'Start the ranger file system explorer when trying to edit a directory' %{ hook global RuntimeError "\d+:\d+: '\w+' (.*): is a directory" %{ %sh{ directory=$kak_hook_param_capture_1 @@ -9,7 +9,7 @@ def ranger-open-on-edit-directory \ }} } -def \ +define-command \ -params .. -file-completion \ -docstring %{ranger []: open the file system explorer to select buffers to open All the optional arguments are forwarded to the ranger utility} \ diff --git a/rc/extra/sass.kak b/rc/extra/sass.kak index 7c901797..66f302ea 100644 --- a/rc/extra/sass.kak +++ b/rc/extra/sass.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](sass) %{ - set buffer filetype sass + set-option buffer filetype sass } # Highlighters @@ -29,12 +29,12 @@ add-highlighter shared/sass/code regex !important 0:keyword # Commands # ‾‾‾‾‾‾‾‾ -def -hidden sass-filter-around-selections %{ +define-command -hidden sass-filter-around-selections %{ # remove trailing white spaces try %{ exec -draft -itersel s \h+$ d } } -def -hidden sass-indent-on-new-line %{ +define-command -hidden sass-indent-on-new-line %{ eval -draft -itersel %{ # copy '/' comment prefix and following white spaces try %{ exec -draft k s ^\h*\K/\h* y gh j P } diff --git a/rc/extra/scss.kak b/rc/extra/scss.kak index 791a1afa..4fd1ebcb 100644 --- a/rc/extra/scss.kak +++ b/rc/extra/scss.kak @@ -7,7 +7,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](scss) %{ - set buffer filetype scss + set-option buffer filetype scss } # Highlighters @@ -25,9 +25,9 @@ add-highlighter shared/scss/core regex @[A-Za-z][A-Za-z0-9_-]* 0:meta # Commands # ‾‾‾‾‾‾‾‾ -def -hidden scss-filter-around-selections css-filter-around-selections -def -hidden scss-indent-on-new-line css-indent-on-new-line -def -hidden scss-indent-on-closing-curly-brace css-indent-on-closing-curly-brace +define-command -hidden scss-filter-around-selections css-filter-around-selections +define-command -hidden scss-indent-on-new-line css-indent-on-new-line +define-command -hidden scss-indent-on-closing-curly-brace css-indent-on-closing-curly-brace # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ diff --git a/rc/extra/taskpaper.kak b/rc/extra/taskpaper.kak index 89b1aab4..c1cbc93b 100644 --- a/rc/extra/taskpaper.kak +++ b/rc/extra/taskpaper.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*\.taskpaper %{ - set buffer filetype taskpaper + set-option buffer filetype taskpaper } # Highlighters @@ -22,7 +22,7 @@ add-highlighter shared/taskpaper regex (([a-z]+://\S+)|((mailto:)[\w+-]+@\S+)) 0 # Commands # ‾‾‾‾‾‾‾‾ -def -hidden taskpaper-indent-on-new-line %{ +define-command -hidden taskpaper-indent-on-new-line %{ eval -draft -itersel %{ # preserve previous line indent try %{ exec -draft \;K } diff --git a/rc/extra/tmux-repl.kak b/rc/extra/tmux-repl.kak index f86b84da..1dfd7ab4 100644 --- a/rc/extra/tmux-repl.kak +++ b/rc/extra/tmux-repl.kak @@ -22,7 +22,7 @@ hook global KakBegin .* %{ } } -def -hidden -params 1..2 tmux-repl-impl %{ +define-command -hidden -params 1..2 tmux-repl-impl %{ %sh{ if [ -z "$TMUX" ]; then echo "echo -markup '{Error}This command is only available in a tmux session'" @@ -37,19 +37,19 @@ def -hidden -params 1..2 tmux-repl-impl %{ } } -def tmux-repl-vertical -params 0..1 -command-completion -docstring "Create a new vertical pane for repl interaction" %{ +define-command tmux-repl-vertical -params 0..1 -command-completion -docstring "Create a new vertical pane for repl interaction" %{ tmux-repl-impl 'split-window -v' %arg{@} } -def tmux-repl-horizontal -params 0..1 -command-completion -docstring "Create a new horizontal pane for repl interaction" %{ +define-command tmux-repl-horizontal -params 0..1 -command-completion -docstring "Create a new horizontal pane for repl interaction" %{ tmux-repl-impl 'split-window -h' %arg{@} } -def tmux-repl-window -params 0..1 -command-completion -docstring "Create a new window for repl interaction" %{ +define-command tmux-repl-window -params 0..1 -command-completion -docstring "Create a new window for repl interaction" %{ tmux-repl-impl 'new-window' %arg{@} } -def -hidden tmux-send-text -docstring "Send the selected text to the repl pane" %{ +define-command -hidden tmux-send-text -docstring "Send the selected text to the repl pane" %{ nop %sh{ tmux set-buffer -b kak_selection "${kak_selection}" kak_orig_window=$(tmux display-message -p '#I') @@ -62,7 +62,7 @@ def -hidden tmux-send-text -docstring "Send the selected text to the repl pane" } } -def -hidden tmux-repl-disabled %{ %sh{ +define-command -hidden tmux-repl-disabled %{ %sh{ VERSION_TMUX=$(tmux -V) printf %s "echo -markup %{{Error}The version of tmux is too old: got ${VERSION_TMUX}, expected >= 2.x}" } } diff --git a/rc/extra/tupfile.kak b/rc/extra/tupfile.kak index 74a5f350..77630c2e 100644 --- a/rc/extra/tupfile.kak +++ b/rc/extra/tupfile.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate (.+/)?[Tt]upfile %{ - set buffer filetype tupfile + set-option buffer filetype tupfile } # Highlighters diff --git a/rc/extra/typescript.kak b/rc/extra/typescript.kak index 6212871d..81ab5d6d 100644 --- a/rc/extra/typescript.kak +++ b/rc/extra/typescript.kak @@ -5,7 +5,7 @@ # ‾‾‾‾‾‾‾‾‾ hook global BufCreate .*[.](ts)x? %{ - set buffer filetype typescript + set-option buffer filetype typescript } # Highlighters diff --git a/rc/extra/x11-repl.kak b/rc/extra/x11-repl.kak index 13bcd88b..41fdcb8f 100644 --- a/rc/extra/x11-repl.kak +++ b/rc/extra/x11-repl.kak @@ -1,18 +1,18 @@ -# termcmd should already be set in x11.kak -def -docstring %{x11-repl []: create a new window for repl interaction +# termcmd should already be set-option in x11.kak +define-command -docstring %{x11-repl []: create a new window for repl interaction All optional parameters are forwarded to the new window} \ -params .. \ -command-completion \ x11-repl %{ %sh{ if [ -z "${kak_opt_termcmd}" ]; then - echo "echo -markup '{Error}termcmd option is not set'" + echo "echo -markup '{Error}termcmd option is not set-option'" exit fi if [ $# -eq 0 ]; then cmd="${SHELL:-sh}"; else cmd="$@"; fi setsid ${kak_opt_termcmd} ${cmd} -t kak_repl_window < /dev/null > /dev/null 2>&1 & }} -def x11-send-text -docstring "send the selected text to the repl window" %{ +define-command x11-send-text -docstring "send the selected text to the repl window" %{ nop %sh{ printf %s\\n "${kak_selection}" | xsel -i wid=$(xdotool getactivewindow)