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
+5
View File
@@ -0,0 +1,5 @@
evaluate-commands %sh{
command -v kak-debug >/dev/null || exit 0
kak-debug init --session "$kak_session"
printf "%s\n" "map global user d ':enter-user-mode dap<ret>' -docstring 'DAP mode'"
}
+7
View File
@@ -0,0 +1,7 @@
set-option global tabstop 4
set-option global indentwidth 4
set-option global scrolloff 1,3
hook global BufWritePre .* %{
try %{ execute-keys -draft '%@' }
}
+19
View File
@@ -0,0 +1,19 @@
declare-option -hidden str-list filetype_modules
define-command -hidden -params 1 filetype-module-load %{
evaluate-commands %sh{
ft="$1"
file="$kak_config/filetypes/$ft.kak"
[ -f "$file" ] || exit 0
for loaded in $kak_opt_filetype_modules; do
[ "$loaded" = "$ft" ] && exit 0
done
printf 'set-option -add global filetype_modules %%{%s}\n' "$ft"
printf 'source %%{%s}\n' "$file"
printf 'try %%{ filetype-%s }\n' "$ft"
}
}
hook global WinSetOption filetype=(.+) %{
filetype-module-load %val{hook_param_capture_1}
}
+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'
+5
View File
@@ -0,0 +1,5 @@
evaluate-commands %sh{
command -v kak-lsp >/dev/null || exit 0
kak-lsp --kakoune -s "$kak_session"
printf '%s\n' 'lsp-enable'
}
+13
View File
@@ -0,0 +1,13 @@
map -docstring "yank the selection into the clipboard" global user y "<a-|> wl-copy<ret>"
map -docstring "paste the clipboard" global user p "<a-!> wl-paste<ret>"
map -docstring "Show filetype" global user t ': echo %opt{filetype}<ret>'
map -docstring "Open file" global user o ': tmux-repl-vertical "echo ""evaluate-commands -client %val{client} e $(fzf)"" | kak -p %val{session}"<ret>'
map -docstring "Zeile auskommentieren" global normal <C-l> ":comment-line<ret>"
map -docstring "Speichern" global normal <C-s> ":w<ret>"
map -docstring "Beenden" global normal <C-q> ":q<ret>"
map -docstring "Cursor nach oben erweitern" global normal <C-k> "<a-C><ret>"
map -docstring "Cursor nach unten erweitern" global normal <C-j> "<C><ret>"
map global normal <C-up> '|echo "$(($kak_selection + 1))"<ret>'
map global normal <C-down> '|echo "$(($kak_selection - 1))"<ret>'
+8
View File
@@ -0,0 +1,8 @@
colorscheme mygruvbox
add-highlighter global/ number-lines -hlcursor
add-highlighter global/ wrap -word -indent -marker ">>>"
add-highlighter global/ show-whitespaces
set-option -add global ui_options terminal_status_on_top=true
set-option -add global ui_options terminal_assistant=cat