From ecb67ff6832eeb772fb45138003987e4205f5887 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Mon, 26 May 2025 01:28:38 -0400 Subject: [PATCH] AutoYADM commit: 2025-05-26 01:28:38 --- .config/kak/autoload/ui-mode.kak | 22 +--------- .config/kak/kakrc | 71 ++++++++++++++++---------------- 2 files changed, 38 insertions(+), 55 deletions(-) diff --git a/.config/kak/autoload/ui-mode.kak b/.config/kak/autoload/ui-mode.kak index c6621a8a..40b4acd8 100644 --- a/.config/kak/autoload/ui-mode.kak +++ b/.config/kak/autoload/ui-mode.kak @@ -32,37 +32,19 @@ define-command ui-scrolloff-enable %{ define-command ui-scrolloff-toggle -docstring "toggle scrolloff" %{ evaluate-commands %sh{ - # CUR="$kak_opt_scrolloff" - # IFS=, - # read TARG HOR <<<$kak_opt_base_scrolloff - # IFS=, - # read VSCROLL _ <<<$kak_opt_scrolloff - # if [ "$VSCROLL" = 99 ]; then - # final="$TARG,$HOR" - # else - # final="99,$HOR" - # fi - # echo "set-option window scrolloff $final" - # Parse base_scrolloff IFS=, set -- $kak_opt_base_scrolloff TARG=${1:-0} HOR=${2:-0} - # Parse current scrolloff IFS=, set -- $kak_opt_scrolloff VSCROLL=${1:-0} - CURHOR=${2:-0} - # Build the new scrolloff value if [ "$VSCROLL" = 99 ]; then - final="$TARG,$HOR" + final="$TARG" else - final="$VSCROLL,$CURHOR" + final="99,$HOR" fi - echo "set-option window scrolloff $final" - notify-send "$final" - } } diff --git a/.config/kak/kakrc b/.config/kak/kakrc index e75fd109..91b158dd 100644 --- a/.config/kak/kakrc +++ b/.config/kak/kakrc @@ -17,8 +17,9 @@ try %{ set-option global ashen_eol_cursor true } # disable clippy -set-option global ui_options terminal_assistant=none +set-option -add global ui_options terminal_assistant=none +# only set to foot if we are on wayland hook global ModuleLoaded wayland %{ set-option global termcmd 'footclient sh -c' } @@ -27,8 +28,7 @@ hook global ModuleLoaded wayland %{ set-option global tabstop 4 set-option global indentwidth 4 -# set-option global base_scrolloff 3,3 - +# needed for tree-sitter to respect show-matching define-command -override tree-sitter-user-after-highlighter %{ add-highlighter -override buffer/show-matching show-matching } @@ -37,16 +37,23 @@ define-command -override tree-sitter-user-after-highlighter %{ add-highlighter global/bracket regex [\[\]\(\)\{\}]{1} 0:rgb:737373 # special highlighting for escaped goodies in regex add-highlighter global/regex-escaped regex \\[\[\]\(\)\{\}fnrtv0\\dwshDWSH] 0:rgb:e5e5e5 -# add-highlighter global/ show-matching +# default window settings +# wrap enabled +# scrolloff enabled hook global WinCreate .* %{ ui-wrap-enable + # TODO: fix ui-scrolloff-enable and use that instead ui-scrolloff-toggle add-highlighter window/number-lines number-lines -hlcursor -relative -separator " " - add-highlighter window/show-whitespaces show-whitespaces -only-trailing # -lf "" -tab "" -only-trailing + # only-trailing is nice QOL otherwise it gets hard to read the screen + # and it makes it easy to see trailing spaces + add-highlighter window/show-whitespaces show-whitespaces -only-trailing add-highlighter window/show-matching show-matching } +# convenience mappings +# quitting & saving map -docstring "quit" global user q ": q" map -docstring "quit" global normal ": q" map -docstring "force quit" global user Q ": q!" @@ -55,28 +62,22 @@ map -docstring "kill session" global normal ':kill' map -docstring "force kill session" global normal ':kill!' map -docstring "save" global normal ": write" map -docstring "save" global normal ": write!" -# map -docstring "save" global normal ": write-all" -# map -docstring "save" global normal ": write-all!" +# buffer operations map -docstring "close current buffer" global user x ": db" map -docstring "goto previous buffer" global user m ": bp" map -docstring "goto next buffer" global user i ": bn" map -docstring "goto previous buffer" global normal ": bp" map -docstring "goto next buffer" global normal ": bn" -# map global normal X "x" - -# map global normal ":exec vv" -# map global normal ":exec vv" - +# trim whitespace map global normal _ -# map global normal -# map global normal 'p' - +# comments map -docstring "comment line" global normal "#" ": comment-line" map -docstring "comment block" global normal "" ": comment-block" +# formatting map -docstring "format" global normal = ": format-buffer" map -docstring "format" global normal ": format-selections" @@ -86,39 +87,36 @@ map -docstring 'case insensitive backward search' global user '' (?i) map -docstring 'case insensitive extend search' global user '?' ?(?i) map -docstring 'case insensitive backward extend-search' global user '' (?i) -# Arrow keys for menu selections -# map -docstring 'Select next menu' global prompt -# map -docstring 'Select previous menu' global prompt -# hook global InsertCompletionShow .* %{ -# map window insert -# map window insert -# hook -once window InsertCompletionHide .* %{ -# unmap window insert -# unmap window insert -# } -# } - +# TODO: how to bind these to goto mode while respecting g/G?? map -docstring 'Select to file end' global user N "GjL" map -docstring 'Extend to file end' global user n "gjl" -define-command -docstring %{ - Spawns a Zathura pdf preview and Typst watcher for the currently open Typst file -} typst %{ - nop %sh{ - { - "$kak_config/scripts/kak-typ-zathura.fish" -k -w "$kak_buffile" "$kak_client_pid" - } > /dev/null 2>&1 < /dev/null & - } +# Zathura pdf preview only for Typst files + +hook global WinSetOption filetype=typst %{ + define-command -docstring %{ + Spawns a Zathura pdf preview and Typst watcher for the currently open Typst file + } typst %{ + nop %sh{ + { + "$kak_config/scripts/kak-typ-zathura.fish" -k -w "$kak_buffile" "$kak_client_pid" + } > /dev/null 2>&1 < /dev/null & + } + } } + define-command -docstring "Create a scratch buffer" scratch %{ edit -scratch } alias global s scratch + define-command -docstring "New terminal in cwd" cwd-terminal %{ terminal fish } +# make easy to open new shell alias global t cwd-terminal +# manually requiring needed for some reason 😢 require-module peneira declare-user-mode peneira @@ -137,8 +135,11 @@ define-command goto-debug %{ ui-scrolloff-disable execute-keys 'gj' } + + map -docstring 'open debug buffer' global user D ':goto-debug' +# spellcheck using aspell for now (maybe better options?) declare-user-mode spell map -docstring 'show spell' global spell s ': spell'