From 80c399ee0330698b67756fc61da1b5b4fd0a37c5 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Tue, 17 Jun 2025 20:47:57 -0400 Subject: [PATCH] AutoYADM commit: 2025-06-17 20:47:57 --- .config/fish/functions/dfmt.fish | 7 + .config/kak-tree-sitter/config.toml | 22 +++ .config/kak/autoload/bootstrap.kak | 2 + .config/kak/autoload/clipboard.kak | 3 +- .config/kak/autoload/filetype.kak | 1 + .config/kak/autoload/filetype/sh.kak | 7 + .config/kak/autoload/format.kak | 4 +- .config/kak/autoload/lsp.kak | 84 +++------ .config/kak/autoload/paragraph.kak | 21 ++- .config/kak/autoload/plugins.kak | 4 + .config/kak/autoload/sh.kak | 9 +- .config/kak/autoload/yazi.kak | 2 + .config/kak/colors/ashen-local.kak | 267 +++++++++++++++++++++++++++ .config/kak/kakrc | 154 ++++++++------- .config/kak/scripts/bash-lsp.sh | 4 + .config/task/hooks/on-exit-sync.sh | 16 +- 16 files changed, 476 insertions(+), 131 deletions(-) create mode 100644 .config/fish/functions/dfmt.fish create mode 100644 .config/kak/autoload/filetype/sh.kak create mode 100644 .config/kak/colors/ashen-local.kak create mode 100755 .config/kak/scripts/bash-lsp.sh diff --git a/.config/fish/functions/dfmt.fish b/.config/fish/functions/dfmt.fish new file mode 100644 index 00000000..b9d49377 --- /dev/null +++ b/.config/fish/functions/dfmt.fish @@ -0,0 +1,7 @@ +function dfmt --description 'Format date for task' + if not date -d "$argv" +%Y-%m-%dT%H:%M &>/dev/null + date +%Y-%m-%dT%H:%M + else + date -d "$argv" +%Y-%m-%dT%H:%M + end +end diff --git a/.config/kak-tree-sitter/config.toml b/.config/kak-tree-sitter/config.toml index 2a50774c..5c14208b 100644 --- a/.config/kak-tree-sitter/config.toml +++ b/.config/kak-tree-sitter/config.toml @@ -183,3 +183,25 @@ pin = "fed3edcab70b31b416eb31c2ccf4a979c120d640" [language.bibtex.queries] path = "runtime/queries/bibtex" + +# man + +# [language.man.grammar.source.git] +# url = "https://github.com/ribru17/tree-sitter-man" +# pin = "e332ea95d5c921d1108a46d1b2b0f017079e1fd8" + +# [language.man.grammar] +# path = "src" +# compile = "cc" +# compile_args = ["-c", "-fpic", "../parser.c", "-I", ".."] +# compile_flags = ["-O3"] +# link = "cc" +# link_args = ["-shared", "-fpic", "parser.o", "-o", "man.so"] +# link_flags = ["-O3"] + +# [language.man.queries.source.git] +# url = "https://github.com/ribru17/tree-sitter-man" +# pin = "e332ea95d5c921d1108a46d1b2b0f017079e1fd8" + +# [language.man.queries] +# path = "queries/man" diff --git a/.config/kak/autoload/bootstrap.kak b/.config/kak/autoload/bootstrap.kak index 536076d0..757c3b69 100644 --- a/.config/kak/autoload/bootstrap.kak +++ b/.config/kak/autoload/bootstrap.kak @@ -1,3 +1,4 @@ +provide-module bootstrap %~ # this is for bootstrapping all external dependencies of my kakoune setup # installs: @@ -43,3 +44,4 @@ define-command -docstring %{ install-pacman install-cargo } +~ diff --git a/.config/kak/autoload/clipboard.kak b/.config/kak/autoload/clipboard.kak index 9c735a44..8aa7eadc 100644 --- a/.config/kak/autoload/clipboard.kak +++ b/.config/kak/autoload/clipboard.kak @@ -1,3 +1,4 @@ +provide-module clipboard %~ declare-option -docstring %{ Command for copying to system clipboard. } str clipboard_copy_cmd 'wl-copy' @@ -55,4 +56,4 @@ map -docstring "yank the split selections into the clipboard" global user Y ": c map -docstring "paste the clipboard" global user p " wl-paste -n" map -docstring "paste the clipboard before" global user P "! wl-paste -n" map -docstring "replace with the clipboard" global user R '"_d! wl-paste -n' - +~ diff --git a/.config/kak/autoload/filetype.kak b/.config/kak/autoload/filetype.kak index 887d2d32..203dffa0 100644 --- a/.config/kak/autoload/filetype.kak +++ b/.config/kak/autoload/filetype.kak @@ -138,3 +138,4 @@ hook global BufCreate .*[.](jinja) %{ set-option buffer filetype html } + diff --git a/.config/kak/autoload/filetype/sh.kak b/.config/kak/autoload/filetype/sh.kak new file mode 100644 index 00000000..02fa58b3 --- /dev/null +++ b/.config/kak/autoload/filetype/sh.kak @@ -0,0 +1,7 @@ +hook global WinSetOption tree_sitter_lang=sh %{ + set-option window tree_sitter_lang bash +} + +hook global WinSetOption filetype=(bash|sh) %{ + set-option window formatcmd 'shfmt -i 4 -ln=auto -ci -bn' +} diff --git a/.config/kak/autoload/format.kak b/.config/kak/autoload/format.kak index 7caa9b21..2beb7ce4 100644 --- a/.config/kak/autoload/format.kak +++ b/.config/kak/autoload/format.kak @@ -3,7 +3,7 @@ declare-option -docstring "shell command used for the 'format-selections' and 'f declare-option -docstring "whether the LSP should be preferred for formatting" bool lsp_fmt false define-command format-buffer -docstring "Format the contents of the buffer" %{ - evaluate-commands %sh{ + evaluate-commands -draft %sh{ if [ "$kak_opt_lsp_fmt" = "false" ]; then echo "format-buffer-pipe" else @@ -13,7 +13,7 @@ define-command format-buffer -docstring "Format the contents of the buffer" %{ } define-command format-selections -docstring "Format the selections individually" %{ - evaluate-commands %sh{ + evaluate-commands -draft %sh{ if [ "${kak_opt_lsp_fmt}" = "false" ]; then echo "format-selections-pipe" else diff --git a/.config/kak/autoload/lsp.kak b/.config/kak/autoload/lsp.kak index a9f8de53..eeaf7379 100644 --- a/.config/kak/autoload/lsp.kak +++ b/.config/kak/autoload/lsp.kak @@ -40,6 +40,20 @@ define-command -override -hidden lsp-do-send-sync %{ } } +define-command -override lsp-progress-disable %{ + # override to do nothing b/c it's annoying lol + define-command -hidden -override lsp-handle-progress -params 6 nop +} +define-command -override lsp-progress-enable %{ + # identical to kak-lsp default + define-command -hidden -override lsp-handle-progress -params 6 %{ + set-option global lsp_modeline_progress %sh{ + if ! "$6"; then + echo "$kak_opt_lsp_progress_indicator" + fi + } + } +} @@ -137,6 +151,15 @@ define-command -hidden lsp-filetype-hooks-update %{ # commands to execute for lsp window settings lsp-enable-window inlay-on + + # hooks to disable inline diagnostics while typing + hook -group dynamic-inline-diags window ModeChange (push|pop):.*insert %{ + try inline-diagnostics-off + } + hook -group dynamic-inline-diags window ModeChange (push|pop):insert:.* %{ + try inline-diagnostics-on + } + # only map to UI mode if that module is available map -docstring 'toggle inlay hints' window ui h ': inlay-toggle' map -docstring 'toggle inlay diagnostics' window ui d ': inlay-diagnostics-toggle' @@ -329,59 +352,12 @@ hook -group lsp-filetype-toml global BufSetOption filetype=toml %{ } } -# # can be empty, global, or file -# declare-option -hidden str harper_add "" -# define-command -hidden harper-add -params 1 %{ -# set-option window harper_add %arg{1} -# lsp-code-actions -auto-single -# } - -# # can override this to customize what's rendered in the menu -# # Each code action is two args: its name, and the corresponding command -# define-command -override -hidden lsp-perform-code-action -params 1.. -docstring "Called on :lsp-code-actions" %{ -# evaluate-commands %sh{ -# # harper specific filtering -# if printf '%s' "$kak_opt_lsp_servers" | grep -q 'harper-ls'; then -# if [ "$kak_opt_harper_add" = "global" ]; then -# # filter and keep only -# echo "echo -debug 'harper adding global'" -# fi -# fi -# echo "echo -debug dumping $# code actions args:" -# echo "echo -debug %arg{@}" - -# } -# lsp-menu %arg{@} -# } - -define-command lsp-inlay-hint-raw %{ - evaluate-commands %sh{ - tmp=$(mktemp -d) - pipe="${tmp}/fifo" - mkfifo "$pipe" || { echo "fail failed to create fifo"; exit 1; } - trap "rm -f \"$pipe\"; rmdir \"$tmp\"" EXIT INT QUIT - - reg_a="$kak_session - $kak_client - true - false - $kak_buffile - $kak_timestamp - $kak_opt_filetype - $kak_opt_lsp_language_id - $kak_opt_lsp_servers - $kak_opt_lsp_semantic_tokens - $kak_opt_lsp_config - $kak_opt_lsp_server_initialization_options - map-end - textDocument/inlayHint - $kak_buf_line_count" - - printf "%s '%s' " "$reg_a" "$pipe" > "$kak_opt_lsp_fifo" - - raw=$(cat "$pipe") - raw_escaped=$(printf %s "$raw" | sed "s/'/''/g") - printf "set-register z '%s'\n" "$raw_escaped" - } +remove-hooks global lsp-filetype-sh +hook -group lsp-filetype-sh global BufSetOption filetype=sh %{ + set-option buffer lsp_servers %{ + [bash-language-server] + root_globs = [".git", ".hg"] + args = ["start"] + } } diff --git a/.config/kak/autoload/paragraph.kak b/.config/kak/autoload/paragraph.kak index 65b39f1e..268a8c03 100644 --- a/.config/kak/autoload/paragraph.kak +++ b/.config/kak/autoload/paragraph.kak @@ -1,8 +1,27 @@ declare-user-mode paragraph declare-option -hidden str paragraph_select 'pj[p' -map global normal 'pj[p' +define-command format-paragraph %{ + execute-keys -draft p_x:format-selections +} + +define-command -override -params 0..1 reflow-paragraph %{ + evaluate-commands -draft -save-regs 'a' %{ + set-register a %sh{ + if [ "$#" = 0 ]; then + printf '%s' '|fmt' + else + printf '%s' ':format-selections' + fi + } + echo -debug %reg{a} + execute-keys -draft 'p_x:exec a' + } +} + +map global normal ': reflow-paragraph' map global normal 'pj[p' +map global normal ': reflow-paragraph formatcmd' map -docstring 'paragraph mode' global user "%opt{paragraph_select}: enter-user-mode -lock paragraph" map global paragraph I '>' -docstring 'move right' map global paragraph M '<' -docstring 'move left' diff --git a/.config/kak/autoload/plugins.kak b/.config/kak/autoload/plugins.kak index 399bae9d..a3311a16 100644 --- a/.config/kak/autoload/plugins.kak +++ b/.config/kak/autoload/plugins.kak @@ -9,6 +9,8 @@ # echo "nop" # fi # } + +provide-module plugins %— # init bundle source "%val{config}/bundle/kak-bundle/rc/kak-bundle.kak" @@ -113,3 +115,5 @@ bundle pykak https://github.com/tomKPZ/pykak # bundle kak-ansi https://github.com/eraserhd/kak-ansi bundle-theme one.kak https://github.com/raiguard/one.kak + +— diff --git a/.config/kak/autoload/sh.kak b/.config/kak/autoload/sh.kak index d22f50b8..7c0e3e94 100644 --- a/.config/kak/autoload/sh.kak +++ b/.config/kak/autoload/sh.kak @@ -1,8 +1,9 @@ define-command -docstring %{ - sh [switches] : Run the given shell command. Display its output in an info modal. + shell-command [switches] : Run the given shell command. Display + its output in an info modal. Switches: - -d echo stdout to *debug* buffer -} -params 1.. sh %{ + -d echo stdout to *debug* buffer as well +} -params 1.. shell-command %{ evaluate-commands %sh{ if [ "$1" = "-d" ]; then debug="true" @@ -15,3 +16,5 @@ define-command -docstring %{ fi } } +alias global sh shell-command +alias global ! shell-command diff --git a/.config/kak/autoload/yazi.kak b/.config/kak/autoload/yazi.kak index 3de4fa1a..db444c51 100644 --- a/.config/kak/autoload/yazi.kak +++ b/.config/kak/autoload/yazi.kak @@ -1,3 +1,4 @@ +provide-module yazi %~ declare-user-mode yazi map -docstring "Yazi" global user ': enter-user-mode yazi' @@ -37,3 +38,4 @@ define-command open-yazi-new-client %{ } } map -docstring "open with yazi in new client" global yazi n ': open-yazi-new-client' +~ diff --git a/.config/kak/colors/ashen-local.kak b/.config/kak/colors/ashen-local.kak new file mode 100644 index 00000000..e3540ae0 --- /dev/null +++ b/.config/kak/colors/ashen-local.kak @@ -0,0 +1,267 @@ +# Ashen for Kakoune +# Supports kak-tree-sitter and kak-lsp +# Author: Daniel Fichtinger +# License: MIT +# Upstream: https://sr.ht/~ficd/ashen + +# palette +declare-option str cursorline "rgb:191919" +declare-option str text "rgb:b4b4b4" +declare-option str red_flame "rgb:C53030" +declare-option str red_glowing "rgb:DF6464" +declare-option str red_ember "rgb:B14242" +declare-option str orange_glow "rgb:D87C4A" +declare-option str orange_blaze "rgb:C4693D" +declare-option str orange_muted "rgb:6D3B22" +declare-option str orange_smolder "rgb:E49A44" +declare-option str orange_golden "rgb:E5A72A" +declare-option str golden_muted "rgb:6D4D0D" +declare-option str brown "rgb:89492a" +declare-option str brown_dark "rgb:322119" +declare-option str brown_darker "rgb:22150F" +declare-option str blue "rgb:4A8B8B" +declare-option str background "rgb:121212" +declare-option str g_1 "rgb:e5e5e5" +declare-option str g_2 "rgb:d5d5d5" +declare-option str g_3 "rgb:b4b4b4" +declare-option str g_4 "rgb:a7a7a7" +declare-option str g_5 "rgb:949494" +declare-option str g_6 "rgb:737373" +declare-option str g_7 "rgb:535353" +declare-option str g_8 "rgb:323232" +declare-option str g_9 "rgb:212121" +declare-option str g_10 "rgb:1d1d1d" +declare-option str g_11 "rgb:191919" +declare-option str g_12 "rgb:151515" + +# Built-in Code Highlighting +set-face global value "%opt{blue}" +set-face global type "%opt{blue}" +set-face global variable "%opt{g_3}" +set-face global module "%opt{orange_glow}+b" +set-face global function "%opt{g_3}+b" +set-face global string "%opt{red_glowing}" +set-face global keyword "%opt{red_ember}" +set-face global operator "%opt{orange_glow}" +set-face global attribute "%opt{g_4}" +set-face global comment "%opt{g_6}+i" +set-face global documentation comment +set-face global meta "%opt{red_ember}" +set-face global builtin function + +# Markdown Highlighting +set-face global title "%opt{red_glowing}+b" +set-face global header "%opt{red_glowing}" +set-face global mono "%opt{g_2},%opt{g_10}" +set-face global block "%opt{g_2},%opt{g_10}" +set-face global link "%opt{red_glowing}+ui" +set-face global bullet "%opt{orange_glow}" +set-face global list "%opt{orange_glow}" + +# SPECIAL CURSOR BLOCK +# We implement a Helix-like cursor changing color. +# Off by default; ashen_dynamic_cursor option must be set to true. + +try %{ + declare-option bool ashen_dynamic_cursor false + declare-option bool ashen_eol_cursor false +} +# Helix-like insert/normal mode cursor +set-face global PrimaryCursorNormal "%opt{background},%opt{orange_blaze}+b" +set-face global SecondaryCursorNormal "%opt{background},%opt{orange_muted}" +set-face global PrimaryCursorInsert "%opt{background},%opt{g_3}+b" +set-face global SecondaryCursorInsert "%opt{background},%opt{g_7}" + +set-face global PrimaryCursorNormalEol "%opt{background},%opt{orange_smolder}+b" +set-face global SecondaryCursorNormalEol "%opt{background},%opt{golden_muted}" +set-face global PrimaryCursorInsertEol "%opt{background},%opt{g_1}+b" +set-face global SecondaryCursorInsertEol "%opt{background},%opt{g_5}" + +set-face global PrimaryCursor PrimaryCursorNormal +set-face global SecondaryCursor SecondaryCursorNormal + +try %{ + hook global WinCreate .* %{ + evaluate-commands %sh{ + if [ "$kak_opt_ashen_eol_cursor" = "true" ]; then + echo "set-face window PrimaryCursorEol PrimaryCursorNormalEol" + echo "set-face window SecondaryCursorEol SecondaryCursorNormalEol" + else + echo "set-face window PrimaryCursorEol PrimaryCursorNormal" + echo "set-face window SecondaryCursorEol SecondaryCursorNormal" + fi + } + } + + define-command -hidden ashen-set-cursor-mode -params 1 %{ + evaluate-commands %sh{ + MODE="$1" + if [ "$kak_opt_ashen_dynamic_cursor" = "true" ]; then + echo "set-face window PrimaryCursor PrimaryCursor$MODE" + echo "set-face window SecondaryCursor SecondaryCursor$MODE" + if [ "$kak_opt_ashen_eol_cursor" = "true" ]; then + echo "set-face window PrimaryCursorEol PrimaryCursor${MODE}Eol" + echo "set-face window SecondaryCursorEol SecondaryCursor${MODE}Eol" + else + echo "set-face window PrimaryCursorEol PrimaryCursor$MODE" + echo "set-face window SecondaryCursorEol SecondaryCursor$MODE" + fi + fi + } + } + + hook global ModeChange (push|pop):.*insert %{ + ashen-set-cursor-mode "Insert" + } + + hook global ModeChange (push|pop):insert:.* %{ + ashen-set-cursor-mode "Normal" + } +} + +# Built-in UI +set-face global Default "%opt{text},%opt{background}" +set-face global PrimarySelection ",%opt{brown_dark}+g" +set-face global SecondarySelection ",%opt{brown_darker}+g" +set-face global PrimaryCursorEol PrimaryCursor +set-face global SecondaryCursorEol SecondaryCursor +set-face global LineNumbers "%opt{g_8}" +set-face global LineNumberCursor "%opt{g_5},%opt{brown_dark}" +set-face global LineNumbersWrapped LineNumbers +set-face global MenuForeground "%opt{background},%opt{orange_blaze}+b" +set-face global MenuBackground "%opt{g_3},%opt{g_9}" +set-face global MenuInfo "%opt{text},%opt{g_9}" +set-face global Information MenuInfo +set-face global InlineInformation "%opt{g_6}+i" +set-face global Error "%opt{red_flame},%opt{background}" +set-face global DiagnosticError ",,%opt{red_flame}+c" +set-face global DiagnosticWarning ",,%opt{orange_golden}+c" +set-face global StatusLine "%opt{g_3},%opt{g_9}" +set-face global StatusLineMode "%opt{orange_glow}+b" +set-face global StatusLineInfo "%opt{red_ember}" +set-face global StatusLineValue "%opt{blue}" +set-face global StatusCursor "%opt{background},%opt{g_3}+b" +set-face global Prompt "%opt{orange_glow}" +set-face global MatchingChar "%opt{orange_smolder}+uf" +set-face global BufferPadding LineNumbers +set-face global Whitespace "%opt{g_7}+f" + +# Tree-sitter () + +# kak-tree-sitter defaults +set-face global ts_attribute "%opt{g_4}" +set-face global ts_comment "%opt{g_6}+i" +set-face global ts_comment_unused "%opt{g_6}+is" +set-face global ts_conceal "%opt{red_ember}+i" +set-face global ts_constant "%opt{orange_blaze}" +set-face global ts_constant_builtin_boolean "%opt{blue}" +set-face global ts_constant_character "%opt{red_glowing}+b" +set-face global ts_constant_macro "%opt{blue}" +set-face global ts_constructor "%opt{g_1}" +set-face global ts_diff_plus "%opt{g_6}" +set-face global ts_diff_minus "%opt{red_ember}" +set-face global ts_diff_delta "%opt{brown}" +set-face global ts_diff_delta_moved ts_diff_delta +set-face global ts_error "%opt{red_flame}" +set-face global ts_function "%opt{g_3}+b" +set-face global ts_function_builtin "%opt{g_3}+bi" +set-face global ts_function_macro "%opt{red_ember}" +set-face global ts_hint "%opt{g_4}" +set-face global ts_info "%opt{g_2}" +set-face global ts_keyword "%opt{red_ember}" +set-face global ts_keyword_conditional "%opt{red_ember}" +set-face global ts_keyword_control_conditional "%opt{red_ember}" +set-face global ts_keyword_control_directive "%opt{red_ember}+i" +set-face global ts_keyword_control_import "%opt{red_ember}" +set-face global ts_keyword_directive "%opt{red_ember}+i" +set-face global ts_keyword_storage "%opt{red_ember}" +set-face global ts_keyword_storage_modifier "%opt{red_ember}+i" +set-face global ts_keyword_storage_modifier_mut "%opt{red_ember}+i" +set-face global ts_keyword_storage_modifier_ref "%opt{red_ember}+i" +set-face global ts_label "%opt{red_ember}" +set-face global ts_markup_bold "+b" +set-face global ts_markup_heading "%opt{red_glowing}+b" +set-face global ts_markup_italic "+i" +set-face global ts_markup_list_checked "%opt{orange_glow}" +set-face global ts_markup_list_numbered "%opt{orange_glow}" +set-face global ts_markup_list_unchecked "%opt{orange_glow}" +set-face global ts_markup_list_unnumbered "%opt{orange_glow}" +set-face global ts_markup_link_label "%opt{red_ember}" +set-face global ts_markup_link_url "%opt{red_glowing}+iu" +set-face global ts_markup_link_uri "%opt{red_glowing}+iu" +set-face global ts_markup_link_text "%opt{red_glowing}" +set-face global ts_markup_quote "+i" +set-face global ts_markup_raw_block "%opt{g_2}" +set-face global ts_markup_raw_inline "%opt{g_2},%opt{g_10}" +set-face global ts_markup_strikethrough "+s" +set-face global ts_namespace "%opt{orange_glow}+b" +set-face global ts_operator "%opt{orange_blaze}" +set-face global ts_property "%opt{g_2}" +set-face global ts_punctuation "%opt{g_2}" +set-face global ts_punctuation_special "%opt{orange_golden}" +set-face global ts_special "%opt{orange_smolder}" +set-face global ts_spell ",,%opt{g_5}+c" +set-face global ts_string "%opt{red_glowing}" +set-face global ts_string_regex "%opt{orange_glow}" +set-face global ts_string_regexp "%opt{orange_glow}" +set-face global ts_string_escape "%opt{g_2}" +set-face global ts_string_special "%opt{g_2}" +set-face global ts_string_special_path "%opt{red_glowing}+b" +set-face global ts_string_special_symbol "%opt{orange_smolder}" +set-face global ts_string_symbol "%opt{orange_glow}" +set-face global ts_tag "%opt{orange_glow}+i" +set-face global ts_tag_error "%opt{red_flame}+i" +set-face global ts_text "%opt{text}" +set-face global ts_text_title "%opt{red_glowing}+b" +set-face global ts_type "%opt{blue}" +set-face global ts_type_enum_variant "%opt{orange_blaze}" +set-face global ts_type_enum_variant_builtin "%opt{orange_blaze}" +set-face global ts_variable "%opt{g_3}" +set-face global ts_variable_builtin "%opt{blue}" +set-face global ts_variable_other_member "%opt{g_2}" +set-face global ts_variable_parameter "%opt{g_2}+i" +set-face global ts_warning "%opt{orange_golden}" + +# Helix capture groups +set-face global ts_punctuation_delimiter "%opt{orange_smolder}" +set-face global ts_punctuation_bracket "%opt{g_6}" +set-face global ts_type_builtin "%opt{blue}" +set-face global ts_type_parameter "%opt{orange_glow}" +set-face global ts_constant_builtin "%opt{blue}" +set-face global ts_constant_character_escape "%opt{g_2}" +set-face global ts_constant_numeric "%opt{blue}" +set-face global ts_string_special_url "%opt{red_glowing}+b" +set-face global ts_comment_block_documentation "%opt{g_5}+i" +set-face global ts_keyword_operator "%opt{orange_blaze}" +set-face global ts_markup_list "%opt{orange_glow}" + +# kak-lsp +set-face global InlayHint "%opt{g_5},%opt{g_12}+i" +set-face global parameter "@ts_variable_paramter" +set-face global enum "@ts_type_enum_variant" +set-face global InlayDiagnosticError Error +set-face global InlayDiagnosticWarning "%opt{orange_golden}" +set-face global InlayDiagnosticInfo "%opt{g_2}" +set-face global InlayDiagnosticHint "%opt{g_4}" +set-face global LineFlagError "%opt{red_flame}" +set-face global LineFlagWarning "%opt{orange_golden}" +set-face global LineFlagInfo "%opt{g_2}" +set-face global LineFlagHint "%opt{g_4}" +set-face global DiagnosticError ",,%opt{red_flame}+c" +set-face global DiagnosticWarning ",,%opt{orange_golden}+c" +set-face global DiagnosticInfo ",,%opt{g_2}+c" +set-face global DiagnosticHint ",,%opt{g_4}+c" +# Infobox faces +set-face global InfoDefault Information +set-face global InfoBlock block +set-face global InfoBlockQuote block +set-face global InfoBullet bullet +set-face global InfoHeader header +set-face global InfoLink link +set-face global InfoLinkMono header +set-face global InfoMono mono +set-face global InfoRule comment +set-face global InfoDiagnosticError InlayDiagnosticError +set-face global InfoDiagnosticHint InlayDiagnosticHint +set-face global InfoDiagnosticInformation InlayDiagnosticInfo +set-face global InfoDiagnosticWarning InlayDiagnosticWarning diff --git a/.config/kak/kakrc b/.config/kak/kakrc index 7b7ef8a1..f5d1c28c 100644 --- a/.config/kak/kakrc +++ b/.config/kak/kakrc @@ -2,22 +2,101 @@ # Author: Daniel Fichtinger # See README.md for explanations. -evaluate-commands %sh{ kak-tree-sitter -dks --init $kak_session } -evaluate-commands %sh{kak-popup init} -colorscheme ashen -require-module hop-kak -require-module fishr +# TODO: refactor config s.t. everything defined in autoload +# provides a module +# Then, use an environment variable to determine whether +# we're on a server. If we are, we don't load a bunch of +# the modules. This lets us keep a unified config without requiring +# all dependencies to be installed. + +declare-option -hidden bool on_server %sh{ + if [ -z "$KAK_ON_SERVER" ]; then + printf 'false' + else + printf 'true' + fi +} + +define-command -override true nop +define-command -override false fail + +try %{ + %opt{on_server} + colorscheme ashen-local +} catch %{ + evaluate-commands %sh{ kak-tree-sitter -dks --init $kak_session } + evaluate-commands %sh{kak-popup init} + colorscheme ashen + require-module hop-kak + require-module fishr + require-module title-bar + require-module notes + require-module plugins + require-module yazi + require-module luar + set-option global luar_interpreter luajit + # only set to foot if we are on wayland + hook global ModuleLoaded wayland %{ + set-option global termcmd 'footclient dash -c' + } +# needed for tree-sitter to respect show-matching +define-command -override tree-sitter-user-after-highlighter %{ + add-highlighter -override buffer/show-matching show-matching +} + +# manually requiring needed for some reason 😢 +require-module peneira + +declare-user-mode peneira +map -docstring %{ + Picker mode +} global user f ': enter-user-mode peneira' +map -docstring 'pick file' global peneira f ': peneira-files' +map -docstring 'pick unopened file' global peneira F ': peneira-files -hide-opened' +map -docstring %{ + pick line in buffer +} global peneira '/' ': peneira-lines' +define-command -override -hidden consume %{ + nop %sh{ + niri msg action consume-or-expel-window-left + } +} + +define-command terminal-consume %{ + terminal dash -c 'niri msg action consume-or-expel-window-left; exec fish' +} + +alias global tc terminal-consume + +define-command -docstring %{ + Create a new client in vertial split +} new-consume %{ + new consume +} + +alias global nc new-consume +alias global n new +define-command -docstring 'open popup shell' popup-shell %{ + popup fish +} +alias global pp popup-shell + +map -docstring 'popup shell' global user . ': popup-shell' + +try %{ + evaluate-commands %sh{kak-lsp-diags} + map -docstring 'enable diagnostic hover' global ui "'" ': lsp-diag-hover-enable' + map -docstring 'disable diagnostic hover' global ui '"' ': lsp-diag-hover-disable' +} +} + require-module surround require-module ficgrep require-module byline require-module spell -require-module title-bar -require-module notes set-option global scrolloff 3,3 require-module ui-mode -require-module luar -set-option global luar_interpreter luajit try %{ @@ -27,24 +106,11 @@ try %{ # disable clippy 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 dash -c' -} # This gets overridden by editorconfig but we set sane default anyways set-option global tabstop 4 set-option global indentwidth 4 -# needed for tree-sitter to respect show-matching -define-command -override tree-sitter-user-after-highlighter %{ - add-highlighter -override buffer/show-matching show-matching - # try %{ - # remove-highlighter window/bracket - # remove-highlighter window/regex-escaped - # } -} - hook global WinSetOption filetype=kak %{ # make brackets gray a-la Ashen add-highlighter window/bracket regex [\[\]\(\)\{\}]{1} 0:rgb:737373 @@ -121,18 +187,6 @@ define-command -docstring "New terminal in cwd" cwd-terminal %{ # make easy to open new shell alias global t cwd-terminal -# manually requiring needed for some reason 😢 -require-module peneira - -declare-user-mode peneira -map -docstring %{ - Picker mode -} global user f ': enter-user-mode peneira' -map -docstring 'pick file' global peneira f ': peneira-files' -map -docstring 'pick unopened file' global peneira F ': peneira-files -hide-opened' -map -docstring %{ - pick line in buffer -} global peneira '/' ': peneira-lines' map global normal '"_' define-command goto-debug %{ @@ -155,26 +209,6 @@ map -docstring 'execute selection' global debug x ': exec-selection' define-command repl %{ new %{ edit -scratch; set buffer filetype kak } } -define-command -override -hidden consume %{ - nop %sh{ - niri msg action consume-or-expel-window-left - } -} - -define-command terminal-consume %{ - terminal dash -c 'niri msg action consume-or-expel-window-left; exec fish' -} - -alias global tc terminal-consume - -define-command -docstring %{ - Create a new client in vertial split -} new-consume %{ - new consume -} - -alias global nc new-consume -alias global n new # jumplist @@ -184,13 +218,6 @@ map -docstring 'save to jumplist' global normal # selection saving map -docstring 'add selection' global normal Y a -define-command -docstring 'open popup shell' popup-shell %{ - popup fish -} -alias global pp popup-shell - -map -docstring 'popup shell' global user . ': popup-shell' - # hook -once global ClientCreate .* %{ # evaluate-commands %sh{ # if [ "$kak_buflist" != "*debug* *scratch*" ]; then @@ -202,8 +229,3 @@ map -docstring 'popup shell' global user . ': popup-shell' # } # } -try %{ - evaluate-commands %sh{kak-lsp-diags} - map -docstring 'enable diagnostic hover' global ui "'" ': lsp-diag-hover-enable' - map -docstring 'disable diagnostic hover' global ui '"' ': lsp-diag-hover-disable' -} diff --git a/.config/kak/scripts/bash-lsp.sh b/.config/kak/scripts/bash-lsp.sh new file mode 100755 index 00000000..a5e7f926 --- /dev/null +++ b/.config/kak/scripts/bash-lsp.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +export EXPLAINSHELL_ENDPOINT="https://explainshell.com" +exec bash-language-server start diff --git a/.config/task/hooks/on-exit-sync.sh b/.config/task/hooks/on-exit-sync.sh index e5fd6ca4..5f35ed90 100755 --- a/.config/task/hooks/on-exit-sync.sh +++ b/.config/task/hooks/on-exit-sync.sh @@ -1,5 +1,12 @@ #!/bin/sh +# Hook for Taskwarrior to automaticaly sync. +# If the state has been modified, we fork into the background +# and run task sync. If the command fails, then we spawn an +# urgent desktop notification, and use sendmail to send ourselves +# an email with an error log. For this to work, sendmail must +# be configured with capability to send emails from our account. + DATA="$HOME/.local/share/task" n=0 @@ -13,7 +20,9 @@ if [ "$n" -gt 0 ]; then errfile="$DATA/sync_hook.err" lerrfile="$DATA/sync_hook.errl" logfile="$DATA/sync_hook.log" + address='daniel@ficd.ca' + # shellcheck disable=SC2016 flock "$lockfile" sh -c ' task sync >>"$1" 2>"$2" status=$? @@ -22,8 +31,8 @@ if [ "$n" -gt 0 ]; then if command -v sendmail >/dev/null 2>&1; then { - echo "To: daniel@ficd.ca" - echo "From: daniel@ficd.ca" + echo "To: $5" + echo "From: $5" echo "Subject: Taskwarrior Sync Failed on $(hostname)" echo "Date: $(date -R)" echo "" @@ -41,9 +50,8 @@ if [ "$n" -gt 0 ]; then exit 1 fi - ' sh "$logfile" "$lerrfile" "$errfile" "$(hostname)" + ' sh "$logfile" "$lerrfile" "$errfile" "$(hostname)" "$address" } >/dev/null 2>&1