aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/lsp-config.kak9
-rw-r--r--autoload/repl.kak97
-rw-r--r--colors/phenax.kak24
3 files changed, 71 insertions, 59 deletions
diff --git a/autoload/lsp-config.kak b/autoload/lsp-config.kak
index bb24686..22ed178 100644
--- a/autoload/lsp-config.kak
+++ b/autoload/lsp-config.kak
@@ -7,14 +7,13 @@ set-option global lsp_diagnostic_line_info_sign '■'
set-option global lsp_diagnostic_line_hint_sign '■'
lsp-enable
-map global user l ':enter-user-mode lsp<ret>' -docstring 'LSP mode'
+lsp-inlay-diagnostics-enable global
-map global object a '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
-map global object <a-a> '<a-semicolon>lsp-object<ret>' -docstring 'LSP any symbol'
+map global user l ':enter-user-mode lsp<ret>' -docstring 'LSP mode'
+# map global user t ':enter-user-mode tree-sitter<ret>' -docstring 'Treesitter mode'
map global object f '<a-semicolon>lsp-object Function Method<ret>' -docstring 'LSP function or method'
map global object t '<a-semicolon>lsp-object Class Interface Struct<ret>' -docstring 'LSP class interface or struct'
map global object d '<a-semicolon>lsp-diagnostic-object --include-warnings<ret>' -docstring 'LSP errors and warnings'
-map global object D '<a-semicolon>lsp-diagnostic-object<ret>' -docstring 'LSP errors'
map global insert <c-n> '<a-;>:lsp-snippets-select-next-placeholders<ret>' -docstring 'Select next snippet placeholder'
hook global InsertCompletionShow .* %{
@@ -48,7 +47,7 @@ hook global BufSetOption filetype=ruby %{
}
}
-hook global WinSetOption filetype=(?:javascript|typescript|ruby) %{
+hook global WinSetOption filetype=.* %{
hook window -group semantic-tokens BufReload .* lsp-semantic-tokens
hook window -group semantic-tokens NormalIdle .* lsp-semantic-tokens
hook window -group semantic-tokens InsertIdle .* lsp-semantic-tokens
diff --git a/autoload/repl.kak b/autoload/repl.kak
index f5dacef..372a54a 100644
--- a/autoload/repl.kak
+++ b/autoload/repl.kak
@@ -1,59 +1,67 @@
-declare-option str xrepl_mode_config;
declare-option bool xrepl_running false;
-declare-option str-to-str-map xrepl_modes;
+declare-option str xrepl_current_cmd;
+declare-option str xrepl_current_transform;
-set-option -add global xrepl_modes %{node={
- "cmd": "node"
-}}
-set-option -add global xrepl_modes %{shell={
- "cmd": "$SHELL",
- "transform": "echo 'echo 123 $foooo :: \\$kak_buffile :: \\$kak_selection :: \\$kak_seletion_desc'"
-}}
+# TODO: Add env
+# TODO: Add clear screen
+# TODO: Migrate curly
+# TODO: Preserve original selection with send paragraph
+# TODO: Add prompt
+# TODO: Add send c-c
+# TODO: Add send buffile
-define-command xrepl-set-mode -params 1 %{
- xrepl-quit
- # TODO: This preevaluates the params in transform.
- fennel %arg{1} %opt{xrepl_modes} %{
- (local [mode & modestxt] [(args)])
- (each [_ val (ipairs modestxt)]
- (local (key config) (string.match val "^%s*([^=]*)=(.*)$"))
- (kak.info config)
- (when (= key mode)
- (kak.set "global" "xrepl_mode_config" config)))
+declare-user-mode repl-mode-select
+define-command define-repl-mode -params 3 %{
+ map global repl-mode-select %arg{1} -docstring %arg{2} %sh{
+ kak_escape() { printf "'"; printf '%s' "$1" | sed "s/'/''/g"; printf "'"; }
+ printf ": xrepl-quit<ret>"
+ printf ": evaluate-commands $(kak_escape "$(echo "$3" | tr '\n' ';')")<ret>"
+ printf ": xrepl-begin<ret>"
}
- xrepl-begin
}
-define-command xrepl-select %{
- fennel %opt{xrepl_modes} %{
- (local modes [(args)])
- (local modenames [])
- (each [_ val (ipairs modes)]
- (local (key _config) (string.match val "^%s*([^=]*)=(.*)$"))
- (when key (table.insert modenames key)))
- (local compl (.. "echo -e \"" (table.concat modenames "\n") "\""))
- (kak.prompt :-menu
- :-shell-script-candidates compl
- "repl mode: "
- "xrepl-set-mode %val{text}")
- }
+define-repl-mode n 'Node' %{
+ set global xrepl_current_cmd 'node'
+ set global xrepl_current_transform ""
+}
+define-repl-mode s 'Shell' %{
+ set global xrepl_current_cmd '$SHELL'
+ set global xrepl_current_transform ""
+}
+define-repl-mode j 'Jest' %{
+ set global xrepl_current_cmd '$SHELL'
+ set global xrepl_current_transform 'cat > /dev/null
+ echo "cd \"$(dirname "$kak_buffile")\" && npx jest --runTestsByPath \\\"$kak_buffile\\\";"
+ '
+}
+define-repl-mode c 'Cypress' %{
+ set global xrepl_current_cmd '$SHELL'
+ set global xrepl_current_transform 'cat > /dev/null
+ echo "npx cypress run --headless --e2e --spec $kak_buffile;"
+ '
+}
+define-repl-mode a 'AI: Gemini' %{
+ set global xrepl_current_cmd 'gemini'
+ set global xrepl_current_transform ""
}
define-command xrepl-send-command %{
- evaluate-commands %sh{
- transform="$(echo "$kak_opt_xrepl_mode_config" | jq -rj '.transform? // ""')"
+ evaluate-commands -draft %sh{
+ transform="$kak_opt_xrepl_current_transform"
value="$kak_selection"
if ! [ -z "$transform" ]; then
- export kak_buffile="$kak_buffile"
- export kak_selection="$kak_selection"
- export kak_selection_desc="$kak_selection_desc"
- value=$(echo "$value" | foooo=qwe sh -c "$transform")
+ export kak_buffile kak_selection kak_selection_desc kak_cursor_line kak_cursor_column
+ value=$(echo "$kak_selection" | sh -c "$transform")
fi
- echo "info %{$value//$transform\n$kak_opt_xrepl_mode_config}"
- echo "repl-send-text %{$value}"
+ echo -e "repl-send-text %{$value\n}"
}
}
+define-command xrepl-send-paragraph %{
+ execute-keys '<a-i>p'
+ xrepl-send-command
+}
+
define-command xrepl-send-keys -params 1.. %{
nop %sh{ tmux send-keys -t "$kak_opt_tmux_repl_id" "$@" }
}
@@ -70,7 +78,7 @@ define-command xrepl-quit %{
define-command xrepl-begin %{
evaluate-commands %sh{
if [ "$kak_opt_xrepl_running" = "false" ]; then
- init_cmd="$(echo "$kak_opt_xrepl_mode_config" | jq -rj '.cmd? // ""')"
+ init_cmd="$kak_opt_xrepl_current_cmd"
if [ -z "$init_cmd" ]; then init_cmd="$SHELL"; fi
echo "set-option global xrepl_running true"
echo "repl-new $init_cmd"
@@ -83,9 +91,10 @@ declare-user-mode repl
map global normal <c-t> ': enter-user-mode repl<ret>'
map global repl <c-t> ': xrepl-begin<ret>'
map global repl t ': xrepl-begin<ret>'
-map global repl <ret> '<c-s><a-i>p: xrepl-send-command<ret><c-o>'
+map global repl <ret> ': xrepl-send-paragraph<ret>'
map global repl l ': xrepl-send-command<ret>'
map global repl r ': xrepl-send-keys Enter<ret>'
map global repl c ': xrepl-send-keys C-c<ret>'
map global repl q ': xrepl-quit<ret>'
-map global repl <tab> ': xrepl-select<ret>'
+# map global repl <tab> ': xrepl-select<ret>'
+map global repl <tab> ': enter-user-mode repl-mode-select<ret>'
diff --git a/colors/phenax.kak b/colors/phenax.kak
index ccc6760..025679b 100644
--- a/colors/phenax.kak
+++ b/colors/phenax.kak
@@ -60,8 +60,8 @@ evaluate-commands %sh{
face global inlineUnderline ${foreground}+fu
face global inlineCode ${foreground2},${mildhighlight2}+a
face global inlineLink ${accent2}+a
- face global header1 ${accent2}+b
- face global header2 ${accent3}+b
+ face global header1 ${accent3}+b
+ face global header2 ${accent1}+b
face global header3 ${blue1}+b
face global header4 ${green}+b
face global header5 ${purple}+b
@@ -109,8 +109,6 @@ evaluate-commands %sh{
face global MenuInfo ${red}
face global Information ${foreground2},${background}
face global Error ${foreground},${red}
- face global DiagnosticError ${red}+u
- face global DiagnosticWarning ${yellow}+u
face global StatusLine ${foreground},${background}
face global StatusLineMode ${yellow}+b
face global StatusLineInfo ${aqua},default
@@ -145,19 +143,25 @@ evaluate-commands %sh{
face global LineFlagError ${red},default
face global LineFlagWarning ${orange},default
face global LineFlagHint ${purple},default
- face global LineFlagInfo Information
+ face global LineFlagInfo ${purple},default
face global InfoDefault Information
face global InfoBlock Information
face global InfoBlockQuote Information
face global InfoBullet Information
- face global InfoHeader Information
+ face global InfoHeader default,default+b
face global InfoLink Information
face global InfoLinkMono Information
face global InfoMono Information
face global InfoRule Information
- face global InfoDiagnosticError Information
- face global InfoDiagnosticHint Information
- face global InfoDiagnosticInformation Information
- face global InfoDiagnosticWarning Information
+ face global InfoDiagnosticError ${red},default
+ face global InfoDiagnosticWarning ${orange},default
+ face global InfoDiagnosticHint ${purple},default
+ face global InfoDiagnosticInformation ${purple},default
+ face global DiagnosticError ${red}+u
+ face global DiagnosticWarning ${yellow}+u
+ face global InlayDiagnosticError ${red}
+ face global InlayDiagnosticWarning ${yellow}
+ face global InlayDiagnosticHint ${purple}
+ face global InlayDiagnosticInfo ${purple}
"
}