From 2f7643d380b61ba32fc9a07f7d4502ea4306ac02 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Wed, 21 May 2025 03:18:27 -0400 Subject: [PATCH] AutoYADM commit: 2025-05-21 03:18:27 --- .config/fish/functions/man.fish | 9 ++++++--- .config/kak/autoload/filetype.kak | 10 +++++----- .config/kak/autoload/man.kak | 5 ++++- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.config/fish/functions/man.fish b/.config/fish/functions/man.fish index c0b39f23..6a401397 100644 --- a/.config/fish/functions/man.fish +++ b/.config/fish/functions/man.fish @@ -25,12 +25,15 @@ function man --wraps man --description 'Format and display manual pages' else set fish_data_dir $__fish_datadir end - set -l kakcmd 'set buffer filetype man; set buffer readonly true' + set -l kakargs 'set buffer filetype man; set buffer readonly true; execute-keys %sh{ }' + set -l mancmd kak -e "man '$argv'" set -l fish_manpath (dirname $fish_data_dir)/fish/man if test -d "$fish_manpath" -a -n "$MANPATH" set MANPATH "$fish_manpath":$MANPATH - command man $argv | kak -e "$kakcmd" + # command man $argv | kak -e "$kakargs" + $mancmd return end - command man $argv | kak -e "$kakcmd" + # command man $argv | kak -e "$kakargs" + $mancmd end diff --git a/.config/kak/autoload/filetype.kak b/.config/kak/autoload/filetype.kak index d6c79ddd..9b6f1d11 100644 --- a/.config/kak/autoload/filetype.kak +++ b/.config/kak/autoload/filetype.kak @@ -33,18 +33,18 @@ hook global WinSetOption filetype=fish %{ hook global WinSetOption filetype=man %{ try %{ + # remove these highlighters so everything displays properly remove-highlighter window/number-lines remove-highlighter window/show-whitespaces ui-wrap-disable } - define-command mantest %{ + # man.kak emits this user hook event + # This is needed because we can't modify the selection + # in WinSetOption's context + hook -once global User manpageloaded %{ execute-keys %sh{ result=$((kak_window_height / 2 - 1)) - notify-send 'this' printf '%d%s' "$result" 'j' } - } - hook window User manpageloaded %{ - mantest } } diff --git a/.config/kak/autoload/man.kak b/.config/kak/autoload/man.kak index 4338ed2e..48b5cc5e 100644 --- a/.config/kak/autoload/man.kak +++ b/.config/kak/autoload/man.kak @@ -28,6 +28,7 @@ hook global WinSetOption filetype=man %{ } define-command -hidden -params ..3 man-impl %{ + set-option buffer readonly false evaluate-commands %sh{ buffer_name="$1" if [ -z "${buffer_name}" ]; then @@ -60,8 +61,10 @@ define-command -hidden -params ..3 man-impl %{ nop %%sh{ rm "%s"; rm "%s" } ' "$(cat "$manerr")" "${colout}" "${manerr}" fi + echo "trigger-user-hook manpageloaded" } - trigger-user-hook manpageloaded + set-option buffer readonly true + } # MAN COMMAND