Kakoune restructure

This commit is contained in:
2026-08-27 13:44:15 +02:00
parent d984cbb7af
commit 5ee19b70c5
21 changed files with 213 additions and 56 deletions
+46
View File
@@ -0,0 +1,46 @@
declare-option str llm_ctx "/tmp/kak-fim.buf"
declare-option str llm_gen "/tmp/kak-gen.out"
define-command fim-complete -docstring "FIM-Completion am Cursor (Mistral)" %{
write -force %opt{llm_ctx}
execute-keys "!python3 %val{config}/scripts/mistral-fim.py %opt{llm_ctx} %val{cursor_line} %val{cursor_column}<ret>"
}
map global user f ': fim-complete<ret>' -docstring 'FIM complete'
define-command -params 1 gen -docstring 'LLM: Codeblock generieren & einfügen' %{
write -force %opt{llm_ctx}
nop %sh{
{ printf 'Anweisung: %s\n\nVorhandener Code als Kontext:\n' "$1"
cat "$kak_opt_llm_ctx"; } | sc default > "$kak_opt_llm_gen"
}
execute-keys "!cat %opt{llm_gen}<ret>"
}
map global user G ': gen ""<left>' -docstring 'Codeblock generieren'
define-command -params 1 gen-sel -docstring 'LLM: Selektion neu generieren' %{
nop %sh{
printf 'Anweisung: %s\n\nCode:\n%s' "$1" "$kak_selection" \
| sc default > "$kak_opt_llm_gen"
}
execute-keys "|cat %opt{llm_gen}<ret>"
}
map global user g ': gen-sel ""<left>' -docstring 'Selektion neu generieren'
define-command -params 1 ask -docstring 'LLM-Frage zum Buffer' %{
write -force %opt{llm_ctx}
evaluate-commands %sh{
ans=$( { printf 'Frage: %s\n\nCode:\n' "$1"; cat "$kak_opt_llm_ctx"; } \
| sc ask | sed "s/'/''/g")
printf "info -title 'Le Chat' '%s'" "$ans"
}
}
map global user A ': ask ""<left>' -docstring 'Ask about the buffer'
define-command -params 1 ask-sel -docstring 'LLM-Frage zur Selektion' %{
evaluate-commands %sh{
ans=$(printf 'Frage: %s\n\nCode:\n%s' "$1" "$kak_selection" \
| sc ask | sed "s/'/''/g")
printf "info -title 'Le Chat' '%s'" "$ans"
}
}
map global user a ': ask-sel ""<left>' -docstring 'Ask about selection'