From efe350c5f913a83293050270c53b1c315ce14fc2 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 14 Dec 2025 15:52:34 +0530 Subject: Add uiua lsp + repl mode config changes --- autoload/lsp-config.kak | 11 +++++++++++ autoload/refactor/javascript.kak | 1 + autoload/repl.kak | 22 ++++++++++++++++++---- autoload/window.kak | 1 + 4 files changed, 31 insertions(+), 4 deletions(-) (limited to 'autoload') diff --git a/autoload/lsp-config.kak b/autoload/lsp-config.kak index 2851011..888085a 100644 --- a/autoload/lsp-config.kak +++ b/autoload/lsp-config.kak @@ -87,6 +87,17 @@ hook -group lsp-filetype-haskell global BufSetOption filetype=haskell %{ } } +hook global BufCreate .*[.]ua %{ set-option buffer filetype uiua } +hook global BufSetOption filetype=uiua %{ + set-option buffer lsp_servers %{ + [uiua] + args = [ "lsp" ] + root_globs = [ "main.ua", ".fmt.ua", ".git" ] + } + # Auto-formatter for uiua (TODO: Move to formatter.kak) + hook buffer BufWritePre .* %{ lsp-formatting-sync } +} + hook global WinSetOption filetype=.* %{ hook window -group semantic-tokens BufReload .* lsp-semantic-tokens hook window -group semantic-tokens NormalIdle .* lsp-semantic-tokens diff --git a/autoload/refactor/javascript.kak b/autoload/refactor/javascript.kak index 51797de..514b883 100644 --- a/autoload/refactor/javascript.kak +++ b/autoload/refactor/javascript.kak @@ -2,6 +2,7 @@ hook global BufSetOption filetype=(?:javascript|typescript|jsx|tsx) %{ map global refactor o ': js-test-toggle-it-state' -docstring 'Toggle it/it.only' } +# TODO: Doesnt work right. Switch to treesitter code mods define-command js-test-toggle-it-state %{ try %{ execute-keys 'Zimxsit\(cit.only(z' diff --git a/autoload/repl.kak b/autoload/repl.kak index 10c2367..910815a 100644 --- a/autoload/repl.kak +++ b/autoload/repl.kak @@ -14,6 +14,8 @@ declare-option bool xrepl_running false; declare-option str xrepl_current_name; declare-option str xrepl_current_cmd; declare-option str xrepl_current_transform; +declare-option str xrepl_current_split_size; +declare-option bool xrepl_current_split_vertical false; declare-option bool xrepl_current_clear_screen false; # TODO: Use register set to selection (paragraph) instead of selection @@ -24,17 +26,17 @@ declare-option bool xrepl_current_clear_screen false; declare-user-mode repl-mode-select define-command define-repl-mode -params 4 %{ - # TODO: USe a hidden command and use for keymap + # TODO: Use a hidden command and use for keymap map %arg{1} repl-mode-select %arg{2} -docstring %arg{3} %sh{ kak_escape() { printf "'"; printf '%s' "$1" | sed "s/'/''/g"; printf "'"; } printf ": xrepl-quit" printf ": set global xrepl_current_name '$3'" printf ": set global xrepl_current_cmd \"\$SHELL\"" printf ": set global xrepl_current_transform \"\"" + printf ": set global xrepl_current_split_size 45%%" + printf ": set global xrepl_current_split_vertical false" printf ": set global xrepl_current_clear_screen false" printf ": evaluate-commands $(kak_escape "$(echo "$4" | tr '\n' ';')")" - # echo "$4" >> foobarity - # echo "$(kak_escape "$(echo "$4" | tr '\n' ';')")" >> foobarity printf ": xrepl-begin" } } @@ -66,7 +68,18 @@ hook global BufSetOption filetype=ruby %{ } } +hook global BufSetOption filetype=clojure %{ + # TODO: Just temporary for messing around. Remove module name + map buffer repl r ': repl-send-text %{(require ''[pluribus.core :as p] :reload)}; xrepl-send-keys Enter' -docstring 'Cljs reload' + define-repl-mode buffer j 'Clojurescript repl' %{ + set global xrepl_current_cmd 'clj -M -m cljs.main --repl-opts "{:launch-browser false}" --compile pluribus.core --repl' + set global xrepl_current_split_size 30%% + set global xrepl_current_split_vertical true + } +} + hook global BufSetOption filetype=(?:javascript|typescript|jsx|tsx) %{ + # TODO: Search for root cypress config file and cd into it define-repl-mode buffer c 'Cypress' %{ set global xrepl_current_cmd '$SHELL' set global xrepl_current_transform 'cat > /dev/null @@ -128,7 +141,8 @@ define-command xrepl-begin %{ if [ -z "$init_cmd" ]; then init_cmd="$SHELL"; fi echo "info %opt{xrepl_current_name}" echo "set-option global xrepl_running true" - echo "repl-new -l 45% $init_cmd" + cmd=$([ "$kak_opt_xrepl_current_split_vertical" == "true" ] && echo "tmux-repl-vertical" || echo "tmux-repl-horizontal") + echo "$cmd -l $kak_opt_xrepl_current_split_size $init_cmd" echo "nop %sh{ tmux last-pane }" fi } diff --git a/autoload/window.kak b/autoload/window.kak index b3b9371..96372be 100644 --- a/autoload/window.kak +++ b/autoload/window.kak @@ -6,6 +6,7 @@ map global win ': quit' -docstring 'Quit' map global win s ': tmux-terminal-horizontal kak -c %val{session}' -docstring 'Split vertical' map global win v ': tmux-terminal-vertical kak -c %val{session}' -docstring 'Split horizontal' map global win z ': wq' +map global win t ': toolsclient' def toolsclient %{ rename-client main -- cgit v1.3.1