AutoYADM commit: 2025-05-21 03:18:27

This commit is contained in:
Daniel Fichtinger 2025-05-21 03:18:27 -04:00
parent 7c524d8e20
commit 2f7643d380
3 changed files with 15 additions and 9 deletions

View file

@ -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

View file

@ -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
}
}

View file

@ -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