diff --git a/files/kak/kakrc b/files/kak/kakrc index f605577..027b226 100644 --- a/files/kak/kakrc +++ b/files/kak/kakrc @@ -12,8 +12,8 @@ set-option global scrolloff 2,2 set-option -add global ui_options terminal_assistant=cat hook global ModuleLoaded x11 %{ - set-option global termcmd 'st -e dash -c ' -} # Set st as default terminal + set-option global termcmd "%sh{echo $TERM} -c dash -e" +} # Set termcmd # __________ Commands __________ define-command -override lf-open \ @@ -57,29 +57,19 @@ define-command -override colorscheme-config \ define-command -override config \ -docstring 'edit kakoune main configuration file' %{ - edit "%val{config}/kakrc" + edit "~/area/code/scm/radix/files/kak/kakrc" } define-command -override rss \ -docstring 'edit rss feeds file' %{ - edit '~/.config/newsraft/feeds' + edit '~/area/code/scm/radix/files/newsraft/feeds' } -define-command -override latin \ - -docstring 'edit latin-portuguese dictionary' %{ - edit '~/Projects/markdown/latim-portugues.md' -} define-command -override remind \ -docstring 'Edit reminders' %{ execute-keys ': e /home/radio/.local/share/reminders/' } -define-command -override parse-latin \ - -docstring 'Parse latin text, replacing ^ for short and ~ for long' %{ - execute-keys '|sed y/ãẽĩõũ/āēīōū/' - execute-keys '|sed y/âêîôû/ăěĭŏŭ/' -} - define-command -params 1 -override tex-project \ -docstring 'edit or create a new tex-project' %{ evaluate-commands 'cd ~/Projects/latex/' @@ -105,7 +95,7 @@ define-command -override toggle-readonly \ define-command -override qalc \ -params .. %{echo %sh{qalc ${@}}} \ - -docstring 'compute equation with Qalculate!' + -docstring 'compute equation with Qalculate!' complete-command qalc shell-script-candidates %{ { echo $(qalc --list-functions | head -n -3) echo $(qalc --list-variables | head -n -3) } | tr ' ' '\n' | sort | uniq @@ -135,7 +125,7 @@ define-command -override -hidden edit-from-file %{ define-command -override -hidden spawn-terminal-from-file %{ set-register b "%sh{pwd}" change-directory "%sh{dirname $kak_buffile}" - evaluate-commands 'terminal dash' + evaluate-commands "terminal %sh{echo $SHELL} -c" change-directory "%reg{b}" } # Spawn a terminal in the current buffer's file directory @@ -161,7 +151,7 @@ map global user ': comment-block' \ map global user D '| date +"%d %b %Y %a" -f -' \ -docstring 'parse date to 01 Feb 2001 Tue format' - + map global user d ': lf-open' \ -docstring 'pick a file with lf' @@ -186,7 +176,7 @@ map global user u ': echo -markup "{Information}U+%sh{printf ''%04x'' ""$kak_cur map global user q ': delete-buffer' \ -docstring 'delete current buffer' - + map global user Q ': delete-buffer!' \ -docstring 'delete current buffer' @@ -213,28 +203,6 @@ map global git s ': git status' -docstring 'status' map global git h ': git show-diff' -docstring 'show diff' map global git H ': git-hide-diff' -docstring 'hide diff' -# try %{ declare-user-mode gdb } -# map global gdb ': gdb-session-new-defaults' -docstring 'new session' -# map global gdb ': gdb-session-stop' -docstring 'stop session' -# map global gdb r ': gdb-run' -docstring 'run' -# map global gdb R ': gdb-cmd start' -docstring 'start' -# map global gdb k ': gdb-cmd kill' -docstring 'kill' -# map global gdb s ': gdb-step' -docstring 'step' -# map global gdb n ': gdb-next' -docstring 'next line' -# map global gdb f ': gdb-finish' -docstring 'finish' -# map global gdb c ': gdb-continue' -docstring 'continue' # swap with C? -# map global gdb C ': gdb-continue-or-run' -docstring 'continue/run' -# map global gdb j ': gdb-jump-to-location' -docstring 'jump to IP' -# map global gdb J ': gdb-toggle-autojump' -docstring 'toggle autojump' -# map global gdb b ': gdb-toggle-breakpoint' -docstring 'toggle breakpoint' -# map global gdb p ': gdb-print' -docstring 'print selection expression' -# map global gdb t ': gdb-backtrace' -docstring 'backtrace' -# map global gdb ': gdb-backtrace-up' -docstring 'backtrace ↑' -# map global gdb ': gdb-backtrace-down' -docstring 'backtrace ↓' -# map global gdb : ':gdb-cmd ' -docstring 'custom command' # ? -# map global gdb ': gdb-to-cursor' -docstring 'to cursor' -# map global gdb m ': gdb-cmd kill; make' -docstring 'kill and make' # ? - # __________ Hooks __________ hook -group config global BufCreate 'kakrc' %{ set-option buffer filetype kak @@ -270,12 +238,12 @@ hook global BufOpenFile "%val{config}/autoload/colorscheme.kak" %{ } # Display faces in the colorscheme file hook global BufOpenFile .* %{ - add-highlighter buffer/ wrap -indent -word -marker '↩' + add-highlighter buffer/ wrap -indent -word -marker '↩' add-highlighter buffer/ show-whitespaces -tab '→' } # Set highlighters for file buffers hook global BufCreate '\*scratch\*' %{ - add-highlighter buffer/ wrap -indent -word -marker '↩' + add-highlighter buffer/ wrap -indent -word -marker '↩' add-highlighter buffer/ show-whitespaces -tab '→' } # Set highlighters for scratch buffers @@ -314,6 +282,13 @@ hook -group config global BufSetOption filetype=clojure %{ evaluate-commands 'rainbow-enable' } # Clojure comment tokens +hook -group config global BufSetOption filetype=scheme %{ + set-option buffer indentwidth 2 + set-option window formatcmd 'guix style --whole-file' + set-option buffer line_comment_t ';;' + set-option buffer block_comment_tokens '#|' '|#' +} # Scheme comment tokens + hook -group config global BufSetOption filetype=(c|cpp) %{ set-option window formatcmd 'clazy' set-option buffer line_comment_token '//' @@ -341,39 +316,23 @@ hook -group config global BufSetOption filetype=zig %{ set-option buffer line_comment_token '//' } # Zig comment tokens -#hook global BufWritePre "/home/radio/Projects/Markdown/latim-portugues.md" %{ -# execute-keys '"aZ' # Save registers -# execute-keys '%s`[a-zA-ZâêîôûãẽĩõũÂÊÎÔÛÃẼĨÕŨ]+`' # Select latin text -# evaluate-commands 'parse-latin' # Mark properly longs and shorts -# execute-keys '"az' # Restore registers -# evaluate-commands 'echo' -#} # Use proper signaling for longs and shorts in latin - -hook global BufOpenFile "/home/radio/Projects/markdown/latim-portugues.md" %{ - hook buffer InsertKey '' %{ - execute-keys '"bZ' # Save registers - execute-keys 'kx' # Select entered line - execute-keys 's`[a-zA-Z ,âêîôûãẽĩõũÂÊÎÔÛÃẼĨÕŨ]+`' # Select latin text - evaluate-commands 'parse-latin' # Mark properly longs and shorts - execute-keys '|par' # Format line properly - execute-keys '"bzi' # Restore registers and return to insert mode - evaluate-commands 'echo' - } -} - hook global WinSetOption filetype=kak %{ hook global NormalIdle .* %{ - evaluate-commands -save-regs 'a' %{ try %{ - execute-keys -draft w"ay - evaluate-commands %sh{ ( - color="${kak_reg_a}" - inverted_color=$(echo "${color}" | perl -pe 'tr/0123456789abcdefABCDEF/fedcba9876543210543210/') - printf "%s\n" "evaluate-commands -client $kak_client %{ try %{ - echo -markup %{{rgb:${inverted_color},rgb:${color}+b} #${color} } - }}" | kak -p $kak_session - ) >/dev/null 2>&1 w"ay + evaluate-commands %sh{ ( + color="${kak_reg_a}" + inverted_color=$(echo "${color}" | perl -pe 'tr/0123456789abcdefABCDEF/fedcba9876543210543210/') + printf "%s\n" "evaluate-commands -client $kak_client %{ try %{ + echo -markup %{{rgb:${inverted_color},rgb:${color}+b} #${color} } + }}" | kak -p $kak_session + ) >/dev/null 2>&1 ' -# -docstring 'auto-percent s' -# map global selectors 'p' ': if-cursor S S' -# -docstring 'auto-percent S' -# map global selectors '' ': if-cursor a-s> a-s> no-hooks' -# -docstring 'auto-percent ' -# map global selectors 'm' ': if-cursor a-S> a-S> no-hooks' -# -docstring 'auto-percent ' -# map global selectors 'f' ': if-cursor a-s>a-k> a-k>' -# -docstring 'auto-percent ' -# map global selectors 'r' ': if-cursor a-s>a-K> a-K>' -# -docstring 'auto-percent ' -# map global selectors 'v' ': select-view' -# -docstring 'select view' -# map global normal s ': enter-user-mode selectors' -# -docstring 'selectors' -#} # Add text objects to kakoune - # __________ LSP __________ hook global BufSetOption filetype=(c|clojure|cpp|crystal|css|haskell|html|js|json|lua|python|scheme|sh|sql|latex|zig) %{ add-highlighter buffer/ column 80 StatusLine