From 2eb14066f4f7669c97e41908a8716972f2f703e0 Mon Sep 17 00:00:00 2001 From: Andre Schaf Date: Sat, 20 Jun 2026 21:51:37 +0200 Subject: [PATCH] more new more improved --- kakrc | 62 +++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 23 deletions(-) diff --git a/kakrc b/kakrc index 89d8886..57f8bcd 100644 --- a/kakrc +++ b/kakrc @@ -3,28 +3,36 @@ colorscheme desertex add-highlighter global/ number-lines -relative -hlcursor add-highlighter global/ show-matching -hook global BufWritePost .* %{ git update-diff } - -eval %sh{kak-lsp} -lsp-enable -lsp-auto-hover-enable - -set-option global modelinefmt "%opt{lsp_modeline} %opt{modelinefmt}" - -define-command split-find-file %{ - zellij-terminal-horizontal fzf --bind "enter:execute(kak -C %val{session} {})" -} - -define-command find-file %{ - zellij-terminal-horizontal sh -c "find . -type f -not -path *.git* | fzf --bind 'enter:execute(echo eval -client %val{client} e {} | kak -p %val{session})+execute(zellij action close-pane)'" -} - -define-command vifm-split %{ - zellij-terminal-horizontal sh -c "kak -c %val{session} $(vifm --choose-files -)" -} +hook global BufWritePost .* %{ git show-diff } +hook global WinCreate .* %{ git show-diff } define-command vifm %{ - zellij-terminal-horizontal sh -c "echo eval -client %val{client} e $(vifm --choose-files -) | kak -p %val{session} && zellij action close-pane" + terminal sh -c %{ + file=$(eval "vifm --select $3 --choose-files -") + printf "evaluate-commands -client '%s' %%{ edit -- '%s' }" \ + "$2" "$file" \ + | kak -p "$1" + } -- %val{session} %val{client} %val{buffile} +} + +declare-option -docstring "command listing files for fzf" \ + str fzf_files_cmd 'find . -type f -not -path *.git* -not -path */node_modules*' + +define-command fzf-files -docstring "pick a file with fzf and open it" %{ + terminal sh -c %{ + file=$(eval "$3" | fzf) || exit 0 + [ -n "$file" ] || exit 0 + printf "evaluate-commands -client '%s' %%{ edit -- '%s' }" \ + "$2" "$file" \ + | kak -p "$1" + } -- %val{session} %val{client} %opt{fzf_files_cmd} +} + +define-command lazygit -docstring "lazygit; 'e' edits in this kak session" %{ + terminal sh -c %{ + export KAK_SESSION=$1 + lazygit + } -- %val{session} } map -docstring 'lsp' global user l ':enter-user-mode lsp' @@ -34,16 +42,24 @@ map -docstring "find" global user f ":enter-user-mode search" # user map -docstring "toogle comment" global user c ":comment-line" map -docstring "format" global user F ":lsp-formatting" -map -docstring "format" global user K ":lsp-hover-buffer" +map -docstring "lsp hint" global user K ":lsp-hover-buffer" +map -docstring "yank" global user y "wl-copy" +map -docstring "paste" global user p "!wl-paste" # git declare-user-mode git map -docstring "preview" global git p ":git show-diff" map -docstring "next change" global git j ":git next-hunk" map -docstring "previous change" global git k ":git prev-hunk" -map -docstring "previous lazygit" global git g ":zellij-terminal-horizontal lazygit" +map -docstring "previous lazygit" global git g ":lazygit" # search declare-user-mode search -map -docstring "file" global search f ":find-file" +map -docstring "file" global search f ":fzf-files" map -docstring "grep" global search g ":grep" +map -docstring "vifm" global search k ":vifm" + +eval %sh{kak-lsp} +lsp-enable +# lsp-auto-hover-enable +# set-option global modelinefmt "%opt{lsp_modeline} %opt{modelinefmt}"