From aa6d19bee69e6a2b845553f5ba19cfe4e4cf6b12 Mon Sep 17 00:00:00 2001 From: Justin Frank Date: Wed, 13 Mar 2019 14:00:59 -0700 Subject: [PATCH] Added modules to extra files --- rc/detection/editorconfig.kak | 2 +- rc/filetype/cabal.kak | 8 ++++++ rc/filetype/cmake.kak | 8 ++++++ rc/filetype/coffee.kak | 8 ++++++ rc/filetype/cucumber.kak | 8 ++++++ rc/filetype/elixir.kak | 11 ++++++-- rc/filetype/elm.kak | 8 ++++++ rc/filetype/exherbo.kak | 18 +++++++++++++ rc/filetype/haml.kak | 11 ++++++++ rc/filetype/hbs.kak | 8 ++++++ rc/filetype/i3.kak | 8 ++++++ rc/filetype/just.kak | 8 ++++++ rc/filetype/kickstart.kak | 8 ++++++ rc/filetype/latex.kak | 8 ++++++ rc/filetype/moon.kak | 8 ++++++ rc/filetype/php.kak | 9 +++++++ rc/filetype/pug.kak | 8 ++++++ rc/filetype/ragel.kak | 8 ++++++ rc/filetype/sass.kak | 8 ++++++ rc/filetype/scss.kak | 12 +++++++-- rc/filetype/taskpaper.kak | 10 +++++++- rc/filetype/toml.kak | 8 ++++++ rc/filetype/troff.kak | 8 ++++++ rc/filetype/tupfile.kak | 8 ++++++ rc/tools/autorestore.kak | 4 +-- rc/tools/python/jedi.kak | 10 +++++++- rc/tools/rust/racer.kak | 8 ++++++ rc/windowing/iterm.kak | 12 ++++++--- rc/windowing/kitty.kak | 21 +++++++++------ rc/windowing/repl/tmux.kak | 48 ++++++++++++++++++++--------------- rc/windowing/repl/x11.kak | 8 ++++++ 31 files changed, 278 insertions(+), 42 deletions(-) diff --git a/rc/detection/editorconfig.kak b/rc/detection/editorconfig.kak index 9421e033..388e0540 100644 --- a/rc/detection/editorconfig.kak +++ b/rc/detection/editorconfig.kak @@ -8,7 +8,7 @@ hook global BufCreate .*[.](editorconfig) %{ set-option buffer filetype ini set-option buffer static_words indent_style indent_size tab_width \ end_of_line charset insert_final_newline trim_trailing_whitespace root \ - latin1 utf-8 utf-8-bom utf-16be utf-16le lf cr crlf unset space tab + latin1 utf-8 utf-8-bom utf-16be utf-16le lf cr crlf unset space tab } declare-option -hidden bool editorconfig_trim_trailing_whitespace false diff --git a/rc/filetype/cabal.kak b/rc/filetype/cabal.kak index b3e7e58c..daff0bff 100644 --- a/rc/filetype/cabal.kak +++ b/rc/filetype/cabal.kak @@ -8,6 +8,12 @@ hook global BufCreate .*[.](cabal) %{ set-option buffer filetype cabal } +hook -once global BufSetOption filetype=cabal %{ + require-module cabal +} + +provide-module cabal %[ + # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -72,3 +78,5 @@ hook global WinSetOption filetype=cabal %[ hook -once -always window WinSetOption filetype=.* %{ remove-hooks window cabal-.+ } ] + +] diff --git a/rc/filetype/cmake.kak b/rc/filetype/cmake.kak index 77ec18c5..c0c3bb2c 100644 --- a/rc/filetype/cmake.kak +++ b/rc/filetype/cmake.kak @@ -6,6 +6,12 @@ hook global BufCreate .*/CMakeCache.txt %{ set-option buffer filetype ini } +hook -once global BufSetOption filetype=cmake %{ + require-module cmake +} + +provide-module cmake %{ + add-highlighter shared/cmake regions add-highlighter shared/cmake/code default-region group add-highlighter shared/cmake/comment region '#' '$' fill comment @@ -25,3 +31,5 @@ hook -group cmake-highlight global WinSetOption filetype=cmake %{ add-highlighter window/cmake ref cmake hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/cmake } } + +} diff --git a/rc/filetype/coffee.kak b/rc/filetype/coffee.kak index c8e7384e..f0b5ac58 100644 --- a/rc/filetype/coffee.kak +++ b/rc/filetype/coffee.kak @@ -8,6 +8,12 @@ hook global BufCreate .*[.](coffee) %{ set-option buffer filetype coffee } +hook -once global BufSetOption filetype=coffee %{ + require-module coffee +} + +provide-module coffee %[ + # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -77,3 +83,5 @@ hook global WinSetOption filetype=coffee %{ hook -once -always window WinSetOption filetype=.* %{ remove-hooks window coffee-.+ } } + +] diff --git a/rc/filetype/cucumber.kak b/rc/filetype/cucumber.kak index 180da7d0..55fe892a 100644 --- a/rc/filetype/cucumber.kak +++ b/rc/filetype/cucumber.kak @@ -8,6 +8,12 @@ hook global BufCreate .*[.](feature|story) %{ set-option buffer filetype cucumber } +hook -once global BufSetOption filetype=cucumber %{ + require-module cucumber +} + +provide-module cucumber %{ + # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -87,3 +93,5 @@ hook global WinSetOption filetype=cucumber %{ hook -once -always window WinSetOption filetype=.* %{ remove-hooks window cucumber-.+ } } + +} diff --git a/rc/filetype/elixir.kak b/rc/filetype/elixir.kak index a2587d1e..83321f00 100644 --- a/rc/filetype/elixir.kak +++ b/rc/filetype/elixir.kak @@ -8,6 +8,11 @@ hook global BufCreate .*[.](ex|exs) %{ set-option buffer filetype elixir } +hook -once global BufSetOption filetype=elixir %{ + require-module elixir +} + +provide-module elixir %[ # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -48,11 +53,11 @@ define-command -hidden elixir-trim-indent %{ define-command -hidden elixir-indent-on-new-line %{ evaluate-commands -draft -itersel %{ - # copy -- comments prefix and following white spaces + # copy -- comments prefix and following white spaces try %{ execute-keys -draft k s ^\h*\K--\h* y gh j P } # preserve previous line indent try %{ execute-keys -draft \; K } - # indent after line ending with: + # indent after line ending with: # try %{ execute-keys -draft k x (do|else|->)$ & } # filter previous line try %{ execute-keys -draft k : elixir-trim-indent } @@ -75,3 +80,5 @@ hook global WinSetOption filetype=elixir %{ hook -once -always window WinSetOption filetype=.* %{ remove-hooks window elixir-.+ } } + +] diff --git a/rc/filetype/elm.kak b/rc/filetype/elm.kak index 05d1248b..8b97ff22 100644 --- a/rc/filetype/elm.kak +++ b/rc/filetype/elm.kak @@ -8,6 +8,12 @@ hook global BufCreate .*[.](elm) %{ set-option buffer filetype elm } +hook -once global BufSetOption filetype=elm %{ + require-module elm +} + +provide-module elm %[ + # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -65,3 +71,5 @@ hook global WinSetOption filetype=elm %{ hook -once -always window WinSetOption filetype=.* %{ remove-hooks window elm-.+ } } + +] diff --git a/rc/filetype/exherbo.kak b/rc/filetype/exherbo.kak index 42cc618c..b0f73929 100644 --- a/rc/filetype/exherbo.kak +++ b/rc/filetype/exherbo.kak @@ -25,6 +25,19 @@ hook global BufCreate .*/etc/paludis(-.*)?/repository_defaults\.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 } +hook -once global BufSetOption filetype=exheres-0-(licence-groups|metadata) %{ + require-module exheres +} + +hook -once global BufSetOption filetype=paludis-(key-value|options|mirrors|specs)-conf %{ + require-module paludis +} + +hook -once global BufSetOption filetype=glep42 %{ + require-module glep42 +} + +provide-module exheres %{ # Highlighters ## exheres-0 Repository metadata files add-highlighter shared/exheres-0-metadata group @@ -61,7 +74,9 @@ hook -group exheres-0-licence-groups-highlight global WinSetOption filetype=exhe add-highlighter window/exheres-0-licence-groups ref exheres-0-licence-groups hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/exheres-0-licence-groups } } +} +provide-module paludis %{ ## Paludis configurations ### options.conf add-highlighter shared/paludis-options-conf group @@ -108,7 +123,9 @@ hook -group paludis-specs-conf-highlight global WinSetOption filetype=paludis-sp add-highlighter window/paludis-specs-conf ref paludis-specs-conf hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/paludis-specs-conf } } +} +provide-module glep42 %{ ## News items (GLEP42) add-highlighter shared/glep42 group add-highlighter shared/glep42/ regex ^(Title|Author|Translator|Content-Type|Posted|Revision|News-Item-Format|Display-If-Installed|Display-If-Keyword|Display-If-Profile):([^\n]*(?:\n\h+[^\n]+)*)$ 1:keyword 2:attribute @@ -119,3 +136,4 @@ hook -group glep42-highlight global WinSetOption filetype=glep42 %{ add-highlighter window/glep42 ref glep42 hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/glep42 } } +} diff --git a/rc/filetype/haml.kak b/rc/filetype/haml.kak index e3e7f593..c802e1ff 100644 --- a/rc/filetype/haml.kak +++ b/rc/filetype/haml.kak @@ -8,6 +8,15 @@ hook global BufCreate .*[.](haml) %{ set-option buffer filetype haml } +hook -once global BufSetOption filetype=haml %{ + require-module haml +} + +provide-module haml %[ +require-module ruby +require-module coffee +require-module sass + # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -60,3 +69,5 @@ hook global WinSetOption filetype=haml %{ hook -once -always window WinSetOption filetype=.* %{ remove-hooks window haml-.+ } } + +] diff --git a/rc/filetype/hbs.kak b/rc/filetype/hbs.kak index a0948e6f..d21f8d52 100644 --- a/rc/filetype/hbs.kak +++ b/rc/filetype/hbs.kak @@ -8,6 +8,12 @@ hook global BufCreate .*[.](hbs) %{ set-option buffer filetype hbs } +hook -once global BufSetOption filetype=hbs %{ + require-module hbs +} + +provide-module hbs %[ + # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -95,3 +101,5 @@ hook global WinSetOption filetype=hbs %{ hook -once -always window WinSetOption filetype=.* %{ remove-hooks window hbs-.+ } } + +] diff --git a/rc/filetype/i3.kak b/rc/filetype/i3.kak index e661fcd7..16819cf7 100644 --- a/rc/filetype/i3.kak +++ b/rc/filetype/i3.kak @@ -2,6 +2,12 @@ hook global BufCreate .*(sway|i3)/config %{ set buffer filetype i3 } +hook -once global BufSetOption filetype=i3 %{ + require-module i3 +} + +provide-module i3 %{ + add-highlighter shared/i3 regions add-highlighter shared/i3/code default-region group add-highlighter shared/i3/double_string region %{"} %{"} group @@ -79,3 +85,5 @@ hook global WinSetOption filetype=i3 %[ hook -once -always window WinSetOption filetype=.* %{ remove-hooks window i3-.+ } ] + +} diff --git a/rc/filetype/just.kak b/rc/filetype/just.kak index 201bfc3d..63a847d7 100644 --- a/rc/filetype/just.kak +++ b/rc/filetype/just.kak @@ -5,6 +5,12 @@ hook global BufCreate .*/?[jJ]ustfile %{ set-option buffer filetype justfile } +hook -once global BufSetOption filetype=justfile %{ + require-module justfile +} + +provide-module justfile %{ + # Indentation # ‾‾‾‾‾‾‾‾‾‾‾ @@ -46,3 +52,5 @@ hook global WinSetOption filetype=justfile %{ hook window InsertChar \n -group justfile-indent just-indent-on-new-line hook -once -always window WinSetOption filetype=.* %{ remove-hooks window justfile-.+ } } + +} diff --git a/rc/filetype/kickstart.kak b/rc/filetype/kickstart.kak index 6f30b4b8..c939a252 100644 --- a/rc/filetype/kickstart.kak +++ b/rc/filetype/kickstart.kak @@ -2,6 +2,12 @@ hook global BufCreate .*\.ks %{ set-option buffer filetype kickstart } +hook -once global BufSetOption filetype=kickstart %{ + require-module kickstart +} + +provide-module kickstart %{ + add-highlighter shared/kickstart regions add-highlighter shared/kickstart/code default-region group add-highlighter shared/kickstart/comment region '(^|\h)\K#' $ fill comment @@ -28,3 +34,5 @@ hook -group kickstart-highlight global WinSetOption filetype=kickstart %{ add-highlighter window/kickstart ref kickstart hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/kickstart } } + +} diff --git a/rc/filetype/latex.kak b/rc/filetype/latex.kak index acb5c1fc..3b8511d1 100644 --- a/rc/filetype/latex.kak +++ b/rc/filetype/latex.kak @@ -8,6 +8,12 @@ hook global BufCreate .*\.tex %{ set-option buffer filetype latex } +hook -once global BufSetOption filetype=latex %{ + require-module latex +} + +provide-module latex %( + # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -33,3 +39,5 @@ hook -group latex-highlight global WinSetOption filetype=latex %{ add-highlighter window/latex ref latex hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/latex } } + +) diff --git a/rc/filetype/moon.kak b/rc/filetype/moon.kak index a1d2ecb8..1963905b 100644 --- a/rc/filetype/moon.kak +++ b/rc/filetype/moon.kak @@ -8,6 +8,12 @@ hook global BufCreate .*[.](moon) %{ set-option buffer filetype moon } +hook -once global BufSetOption filetype=moon %{ + require-module moon +} + +provide-module moon %[ + # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -105,3 +111,5 @@ hook global WinSetOption filetype=moon %{ unalias window alt moon-alternative-file } } + +] diff --git a/rc/filetype/php.kak b/rc/filetype/php.kak index 4acfde85..e2759129 100644 --- a/rc/filetype/php.kak +++ b/rc/filetype/php.kak @@ -5,6 +5,13 @@ hook global BufCreate .*[.](php) %{ set-option buffer filetype php } +hook -once global BufSetOption filetype=php %{ + require-module php +} + +provide-module php %( +require-module html + # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -88,3 +95,5 @@ hook global WinSetOption filetype=php %{ hook -once -always window WinSetOption filetype=.* %{ remove-hooks window php-.+ } } + +) diff --git a/rc/filetype/pug.kak b/rc/filetype/pug.kak index 13aa839f..121b0b37 100644 --- a/rc/filetype/pug.kak +++ b/rc/filetype/pug.kak @@ -12,6 +12,12 @@ hook global BufCreate .*[.](pug|jade) %{ set-option buffer filetype pug } +hook -once global BufSetOption filetype=pug %{ + require-module pug +} + +provide-module pug %{ + # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -72,3 +78,5 @@ hook global WinSetOption filetype=pug %{ hook -once -always window WinSetOption filetype=.* %{ remove-hooks window pug-.+ } } + +} diff --git a/rc/filetype/ragel.kak b/rc/filetype/ragel.kak index b6e8dd4c..0aa6ad03 100644 --- a/rc/filetype/ragel.kak +++ b/rc/filetype/ragel.kak @@ -10,6 +10,12 @@ hook global BufCreate .*[.](ragel|rl) %{ set-option buffer filetype ragel } +hook -once global BufSetOption filetype=ragel %{ + require-module ragel +} + +provide-module ragel %🦀 + # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -68,3 +74,5 @@ hook global WinSetOption filetype=ragel %{ hook -once -always window WinSetOption filetype=.* %{ remove-hooks window ragel-.+ } } + +🦀 diff --git a/rc/filetype/sass.kak b/rc/filetype/sass.kak index d23a7b81..46145f7c 100644 --- a/rc/filetype/sass.kak +++ b/rc/filetype/sass.kak @@ -8,6 +8,12 @@ hook global BufCreate .*[.](sass) %{ set-option buffer filetype sass } +hook -once global BufSetOption filetype=sass %{ + require-module sass +} + +provide-module sass %{ + # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -60,3 +66,5 @@ hook global WinSetOption filetype=sass %{ hook -once -always window WinSetOption filetype=.* %{ remove-hooks window sass-.+ } } + +} diff --git a/rc/filetype/scss.kak b/rc/filetype/scss.kak index bb720db5..de5e4acc 100644 --- a/rc/filetype/scss.kak +++ b/rc/filetype/scss.kak @@ -1,8 +1,6 @@ # http://sass-lang.com # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -# require css.kak - # Detection # ‾‾‾‾‾‾‾‾‾ @@ -10,6 +8,14 @@ hook global BufCreate .*[.](scss) %{ set-option buffer filetype scss } +hook -once global BufSetOption filetype=scss %{ + require-module scss +} + +provide-module scss %[ + +require-module css + # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -43,3 +49,5 @@ hook global WinSetOption filetype=scss %[ hook -once -always window WinSetOption filetype=.* %{ remove-hooks window scss-.+ } ] + +] diff --git a/rc/filetype/taskpaper.kak b/rc/filetype/taskpaper.kak index dca5de1e..1e5cb321 100644 --- a/rc/filetype/taskpaper.kak +++ b/rc/filetype/taskpaper.kak @@ -6,7 +6,13 @@ hook global BufCreate .*\.taskpaper %{ set-option buffer filetype taskpaper -} +} + +hook -once global BufSetOption filetype=taskpaper %{ + require-module taskpaper +} + +provide-module taskpaper %{ # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -45,3 +51,5 @@ hook global WinSetOption filetype=taskpaper %{ hook window InsertChar \n -group taskpaper-indent taskpaper-indent-on-new-line hook -once -always window WinSetOption filetype=.* %{ remove-hooks window taskpaper-.+ } } + +} diff --git a/rc/filetype/toml.kak b/rc/filetype/toml.kak index f95fbb9d..141a21fd 100644 --- a/rc/filetype/toml.kak +++ b/rc/filetype/toml.kak @@ -8,6 +8,12 @@ hook global BufCreate .*\.(toml) %{ set-option buffer filetype toml } +hook -once global BufSetOption filetype=toml %{ + require-module toml +} + +provide-module toml %{ + # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -61,3 +67,5 @@ hook global WinSetOption filetype=toml %{ hook -once -always window WinSetOption filetype=.* %{ remove-hooks window toml-.+ } } + +} diff --git a/rc/filetype/troff.kak b/rc/filetype/troff.kak index 072cc3d1..73170675 100644 --- a/rc/filetype/troff.kak +++ b/rc/filetype/troff.kak @@ -5,6 +5,12 @@ hook global BufCreate .*\.\d+ %{ set-option buffer filetype troff } +hook -once global BufSetOption filetype=troff %{ + require-module troff +} + +provide-module troff %{ + # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -28,3 +34,5 @@ hook -group troff-highlight global WinSetOption filetype=troff %{ add-highlighter window/troff ref troff hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/troff } } + +} diff --git a/rc/filetype/tupfile.kak b/rc/filetype/tupfile.kak index e7ba0d52..a21b6408 100644 --- a/rc/filetype/tupfile.kak +++ b/rc/filetype/tupfile.kak @@ -8,6 +8,12 @@ hook global BufCreate .*/?Tup(file|rules)(\.\w+)?$ %{ set-option buffer filetype tupfile } +hook -once global BufSetOption filetype=tupfile %{ + require-module tupfile +} + +provide-module tupfile %{ + # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -31,3 +37,5 @@ hook -group tupfile-highlight global WinSetOption filetype=tupfile %{ add-highlighter window/tupfile ref tupfile hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/tupfile } } + +} diff --git a/rc/tools/autorestore.kak b/rc/tools/autorestore.kak index f8e3e14d..329a45b0 100644 --- a/rc/tools/autorestore.kak +++ b/rc/tools/autorestore.kak @@ -22,7 +22,7 @@ define-command autorestore-restore-buffer -docstring "Restore the backup for the echo -debug Old backup file(s) found: will not restore ${older} . " fi - exit + exit fi printf %s\\n " @@ -39,7 +39,7 @@ define-command autorestore-restore-buffer -docstring "Restore the backup for the nop %sh{ if [ \"\${kak_opt_autorestore_purge_restored}\" = true ]; then - rm -f \"${buffer_dirname}/.${buffer_basename}.kak.\"* + rm -f \"${buffer_dirname}/.${buffer_basename}.kak.\"* fi } } diff --git a/rc/tools/python/jedi.kak b/rc/tools/python/jedi.kak index a0fe9449..69a41da0 100644 --- a/rc/tools/python/jedi.kak +++ b/rc/tools/python/jedi.kak @@ -1,3 +1,9 @@ +hook -once global BufSetOption filetype=python %{ + require-module jedi +} + +provide-module jedi %{ + 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" \ @@ -17,7 +23,7 @@ define-command jedi-complete -docstring "Complete the current selection" %{ cd $(dirname ${kak_buffile}) header="${kak_cursor_line}.${kak_cursor_column}@${kak_timestamp}" - export PYTHONPATH="$kak_opt_jedi_python_path:$PYTHONPATH" + export PYTHONPATH="$kak_opt_jedi_python_path:$PYTHONPATH" compl=$(python 2> "${dir}/fifo" <<-END import jedi script=jedi.Script(open('$dir/buf', 'r').read(), $kak_cursor_line, $kak_cursor_column - 1, '$kak_buffile') @@ -45,3 +51,5 @@ define-command jedi-disable-autocomplete -docstring "Disable jedi completion" %{ remove-hooks window jedi-autocomplete unalias window complete jedi-complete } + +} diff --git a/rc/tools/rust/racer.kak b/rc/tools/rust/racer.kak index 2371c597..53659a05 100644 --- a/rc/tools/rust/racer.kak +++ b/rc/tools/rust/racer.kak @@ -1,3 +1,9 @@ +hook -once global BufSetOption filetype=rust %{ + require-module racer +} + +provide-module racer %{ + declare-option -hidden str racer_tmp_dir declare-option -hidden completions racer_completions @@ -151,3 +157,5 @@ define-command racer-show-doc -docstring "Show the documentation about the rust fi } } + +} diff --git a/rc/windowing/iterm.kak b/rc/windowing/iterm.kak index 7518d2d0..c48aebc8 100644 --- a/rc/windowing/iterm.kak +++ b/rc/windowing/iterm.kak @@ -5,13 +5,12 @@ ## an iTerm session if not in a tmux session. hook global KakBegin .* %sh{ if [ "$TERM_PROGRAM" = "iTerm.app" ] && [ -z "$TMUX" ]; then - echo " - alias global focus iterm-focus - alias global terminal iterm-terminal-vertical - " + echo "require-module iterm" fi } +provide-module iterm %{ + define-command -hidden -params 2.. iterm-terminal-split-impl %{ nop %sh{ direction="$1" @@ -129,3 +128,8 @@ If no client is passed then the current one is used' \ fi } } + +alias global focus iterm-focus +alias global terminal iterm-terminal-vertical + +} diff --git a/rc/windowing/kitty.kak b/rc/windowing/kitty.kak index 1d2155f7..954af045 100644 --- a/rc/windowing/kitty.kak +++ b/rc/windowing/kitty.kak @@ -1,17 +1,14 @@ -declare-option -docstring %{window type that kitty creates on new and repl calls (kitty|os)} str kitty_window_type kitty hook -group kitty-hooks global KakBegin .* %sh{ if [ "$TERM" = "xterm-kitty" ] && [ -z "$TMUX" ]; then - echo " - alias global terminal kitty-terminal - alias global terminal-tab kitty-terminal-tab - alias global focus kitty-focus - alias global repl kitty-repl - alias global send-text kitty-send-text - " + echo "require-module kitty" fi } +provide-module kitty %{ + +declare-option -docstring %{window type that kitty creates on new and repl calls (kitty|os)} str kitty_window_type kitty + define-command kitty-terminal -params 1.. -shell-completion -docstring ' kitty-terminal []: create a new terminal as a kitty window The program passed as argument will be executed in the new terminal' \ @@ -63,3 +60,11 @@ define-command kitty-send-text -docstring "send the selected text to the repl wi kitty @ send-text -m=title:kak_repl_window "${kak_selection}" } } + +alias global terminal kitty-terminal +alias global terminal-tab kitty-terminal-tab +alias global focus kitty-focus +alias global repl kitty-repl +alias global send-text kitty-send-text + +} diff --git a/rc/windowing/repl/tmux.kak b/rc/windowing/repl/tmux.kak index a176f5f5..291717db 100644 --- a/rc/windowing/repl/tmux.kak +++ b/rc/windowing/repl/tmux.kak @@ -1,28 +1,14 @@ # http://tmux.github.io/ # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -declare-option -docstring "tmux pane id in which the REPL is running" str tmux_repl_id - -hook global KakBegin .* %sh{ - if [ -n "$TMUX" ]; then - VERSION_TMUX=$(tmux -V | cut -d' ' -f2) - VERSION_TMUX=${VERSION_TMUX%%.*} - - if [ "${VERSION_TMUX}" = "master" ] \ - || [ "${VERSION_TMUX}" -ge 2 ]; then - echo " - alias global repl tmux-repl-horizontal - alias global send-text tmux-send-text - " - else - echo " - alias global repl tmux-repl-disabled - alias global send-text tmux-repl-disabled - " - fi - fi +hook global ModuleLoad tmux %{ + require-module tmux-repl } +provide-module tmux-repl %{ + +declare-option -docstring "tmux pane id in which the REPL is running" str tmux_repl_id + define-command -hidden -params 1..2 tmux-repl-impl %{ evaluate-commands %sh{ if [ -z "$TMUX" ]; then @@ -52,7 +38,7 @@ define-command tmux-repl-window -params 0..1 -command-completion -docstring "Cre define-command -hidden tmux-send-text -params 0..1 -docstring "tmux-send-text [text]: Send text(append new line) to the REPL pane. If no text is passed, then the selection is used" %{ nop %sh{ - if [ $# -eq 0 ]; then + if [ $# -eq 0 ]; then tmux set-buffer -b kak_selection "${kak_selection}" else tmux set-buffer -b kak_selection "$1" @@ -65,3 +51,23 @@ define-command -hidden tmux-repl-disabled %{ evaluate-commands %sh{ VERSION_TMUX=$(tmux -V) printf %s "echo -markup %{{Error}The version of tmux is too old: got ${VERSION_TMUX}, expected >= 2.x}" } } + +evaluate-commands %sh{ + VERSION_TMUX=$(tmux -V | cut -d' ' -f2) + VERSION_TMUX=${VERSION_TMUX%%.*} + + if [ "${VERSION_TMUX}" = "master" ] \ + || [ "${VERSION_TMUX}" -ge 2 ]; then + echo " + alias global repl tmux-repl-horizontal + alias global send-text tmux-send-text + " + else + echo " + alias global repl tmux-repl-disabled + alias global send-text tmux-repl-disabled + " + fi +} + +} diff --git a/rc/windowing/repl/x11.kak b/rc/windowing/repl/x11.kak index 865e2748..54966c2a 100644 --- a/rc/windowing/repl/x11.kak +++ b/rc/windowing/repl/x11.kak @@ -1,3 +1,9 @@ +hook global ModuleLoad x11 %{ + require-module x11-repl +} + +provide-module x11-repl %{ + # termcmd should already be set in x11.kak define-command -docstring %{x11-repl []: create a new window for repl interaction All optional parameters are forwarded to the new window} \ @@ -24,3 +30,5 @@ define-command x11-send-text -docstring "send the selected text to the repl wind alias global repl x11-repl alias global send-text x11-send-text + +}