From 8aba344904be35706205b12dc4c5be10ba81fc8e Mon Sep 17 00:00:00 2001 From: irrlicht Date: Sun, 26 Apr 2026 00:28:41 +0200 Subject: [PATCH] Added Kakoune --- .gitignore | 2 + kak/colors/mygruvbox.kak | 95 ++++++++++++++++++++++++++++++++++++++++ kak/kakrc | 67 ++++++++++++++++++++++++++++ 3 files changed, 164 insertions(+) create mode 100644 kak/colors/mygruvbox.kak create mode 100644 kak/kakrc diff --git a/.gitignore b/.gitignore index 4f306bf..a31ef61 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ !.gitignore !wezterm/ !wezterm/** +!kak/ +!kak/** diff --git a/kak/colors/mygruvbox.kak b/kak/colors/mygruvbox.kak new file mode 100644 index 0000000..b9a453b --- /dev/null +++ b/kak/colors/mygruvbox.kak @@ -0,0 +1,95 @@ +# Mygruvbox theme for Kakoune + +# Color palette +# declare-option str black 'rgb:282828' +declare-option str black default +declare-option str dark 'rgb:1d2021' +declare-option str gray 'rgb:928374' +declare-option str aqua 'rgb:8ec07c' +declare-option str white 'rgb:ebdbb2' +declare-option str blue 'rgb:83a598' +declare-option str cyan 'rgb:8be9fd' +declare-option str green 'rgb:b8bb26' +declare-option str peach 'rgb:E5C07B' +declare-option str orange 'rgb:fe8019' +declare-option str pink 'rgb:F879C6' +declare-option str purple 'rgb:d3869b' +declare-option str red 'rgb:fb4934' +declare-option str yellow 'rgb:fab2df' +declare-option str dimgray 'rgb:424242' + +declare-option str psel 'rgba:50494580' +declare-option str ssel 'rgba:3c383880' +declare-option str background %opt{black} +declare-option str dimmed_background %opt{dark} +declare-option str foreground %opt{white} + +# Reference +# https://github.com/mawww/kakoune/blob/master/colors/default.kak +# For code +set-face global value "%opt{purple}" +set-face global type "%opt{aqua}" +set-face global variable "%opt{orange}" +set-face global module "%opt{white}" +set-face global function "%opt{aqua}" +set-face global string "%opt{green}" +set-face global keyword "%opt{red}" +set-face global operator "%opt{pink}" +set-face global attribute "%opt{orange}" +set-face global bracket "%opt{white}+b" +set-face global arguement "%opt{orange}" +set-face global comma "%opt{white}" +# set-face global constant "%opt{white}+b" +set-face global comment "%opt{gray}+i" +set-face global meta "%opt{aqua}" +set-face global builtin "%opt{aqua}+b" + +# For markup +set-face global title "%opt{pink}" +set-face global header "%opt{orange}" +set-face global bold "%opt{pink}" +set-face global italic "%opt{purple}" +set-face global mono "%opt{green}" +set-face global block "%opt{cyan}" +set-face global link "%opt{green}" +set-face global bullet "%opt{green}" +set-face global list "%opt{white}" + +# Builtin faces +set-face global Default "%opt{white},%opt{black}" +# set-face global Default "%opt{white},default" +set-face global PrimarySelection "default,%opt{psel}" +set-face global SecondarySelection "default,%opt{ssel}" +set-face global PrimaryCursor "%opt{dark},%opt{purple}" +set-face global SecondaryCursor "%opt{dark},%opt{aqua}" +set-face global PrimaryCursorEol "%opt{dark},%opt{yellow}" +set-face global SecondaryCursorEol "%opt{dark},%opt{cyan}" +set-face global LineNumbers "%opt{gray},%opt{black}" +set-face global LineNumberCursor "%opt{yellow},%opt{black}+b" +set-face global LineNumbersWrapped "%opt{gray},%opt{black}+i" +set-face global MenuForeground "%opt{dark},%opt{white}+b" +set-face global MenuBackground "%opt{white},%opt{dark}" +set-face global MenuInfo "%opt{dark},%opt{orange}" +set-face global Information "%opt{yellow},%opt{black}" +set-face global Error "%opt{red},%opt{black}" +set-face global StatusLine "%opt{white},%opt{black}" +set-face global StatusLineMode "%opt{aqua},%opt{black}" +set-face global StatusLineInfo "%opt{purple},%opt{black}" +set-face global StatusLineValue "%opt{orange},%opt{black}" +set-face global StatusCursor "%opt{white},%opt{blue}" +set-face global Prompt "%opt{green},%opt{black}" +set-face global MatchingChar "%opt{blue},%opt{black}" +set-face global Whitespace "%opt{dimgray},%opt{black}+f" +set-face global WrapMarker Whitespace +set-face global BufferPadding "%opt{gray},%opt{black}" + +# Dimmed background +hook -always global ModeChange 'push:normal:insert' %{ + set-face window Default "%opt{foreground},%opt{dimmed_background}" +} + +# Restore background +hook -always global ModeChange 'pop:insert:normal' %{ + set-face window Default "%opt{foreground},%opt{background}" +} + diff --git a/kak/kakrc b/kak/kakrc new file mode 100644 index 0000000..1ebe495 --- /dev/null +++ b/kak/kakrc @@ -0,0 +1,67 @@ +colorscheme mygruvbox +add-highlighter global/ number-lines -hlcursor + +# Highlight trailing whitespace +# Softwrap long lines +add-highlighter global/ wrap -word -indent -marker ">>>" +add-highlighter global/ show-whitespaces + +set-option global ui_options terminal_status_on_top=true + +set-option global tabstop 4 +set-option global indentwidth 4 +set-option global scrolloff 1,3 + +# Clipboard management mappings +map -docstring "yank the selection into the clipboard" global user y " wl-copy" +map -docstring "paste the clipboard" global user p " wl-paste" + +map -docstring "Show filetype" global user t ': echo %opt{filetype}' +map -docstring "Open file" global user o ': tmux-repl-vertical "echo ""evaluate-commands -client %val{client} e $(fzf)"" | kak -p %val{session}"' +map -docstring "Zeile auskommentieren" global normal ":comment-line" +map -docstring "Speichern" global normal ":w" +map -docstring "Beenden" global normal ":q" +map -docstring "Cursor nach oben erweitern" global normal "" +map -docstring "Cursor nach unten erweitern" global normal "" + +map global normal '|echo "$(($kak_selection + 1))"' +map global normal '|echo "$(($kak_selection - 1))"' + +hook global InsertCompletionShow .* %{ + try %{ + # this command temporarily removes cursors preceded by whitespace; + # if there are no cursors left, it raises an error, does not + # continue to execute the mapping commands, and the error is eaten + # by the `try` command so no warning appears. + execute-keys -draft 'h\h' + map window insert + map window insert + map window insert + hook -once -always window InsertCompletionHide .* %{ + unmap window insert + unmap window insert + unmap window insert + } + } +} + +# Convert spaces to tabs +hook global BufWritePre .* %{ + try %{ execute-keys -draft '%@' } +} + +# hook global BufWritePost .* %{ +# echo %sh{ sassc main.scss > main.css } +# } + +nop %sh{ { + sleep 10 + echo "eval -client '$kak_client' 'echo sleep ended'" | + kak -p ${kak_session} +} > /dev/null 2>&1 < /dev/null & } + +eval %sh{kak-lsp} +lsp-enable + +lsp-inlay-diagnostics-enable global +