AutoYADM commit: 2025-05-21 03:18:27
This commit is contained in:
parent
7c524d8e20
commit
2f7643d380
3 changed files with 15 additions and 9 deletions
|
@ -25,12 +25,15 @@ function man --wraps man --description 'Format and display manual pages'
|
||||||
else
|
else
|
||||||
set fish_data_dir $__fish_datadir
|
set fish_data_dir $__fish_datadir
|
||||||
end
|
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
|
set -l fish_manpath (dirname $fish_data_dir)/fish/man
|
||||||
if test -d "$fish_manpath" -a -n "$MANPATH"
|
if test -d "$fish_manpath" -a -n "$MANPATH"
|
||||||
set MANPATH "$fish_manpath":$MANPATH
|
set MANPATH "$fish_manpath":$MANPATH
|
||||||
command man $argv | kak -e "$kakcmd"
|
# command man $argv | kak -e "$kakargs"
|
||||||
|
$mancmd
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
command man $argv | kak -e "$kakcmd"
|
# command man $argv | kak -e "$kakargs"
|
||||||
|
$mancmd
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,18 +33,18 @@ hook global WinSetOption filetype=fish %{
|
||||||
|
|
||||||
hook global WinSetOption filetype=man %{
|
hook global WinSetOption filetype=man %{
|
||||||
try %{
|
try %{
|
||||||
|
# remove these highlighters so everything displays properly
|
||||||
remove-highlighter window/number-lines
|
remove-highlighter window/number-lines
|
||||||
remove-highlighter window/show-whitespaces
|
remove-highlighter window/show-whitespaces
|
||||||
ui-wrap-disable
|
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{
|
execute-keys %sh{
|
||||||
result=$((kak_window_height / 2 - 1))
|
result=$((kak_window_height / 2 - 1))
|
||||||
notify-send 'this'
|
|
||||||
printf '%d%s' "$result" 'j'
|
printf '%d%s' "$result" 'j'
|
||||||
}
|
}
|
||||||
}
|
|
||||||
hook window User manpageloaded %{
|
|
||||||
mantest
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ hook global WinSetOption filetype=man %{
|
||||||
}
|
}
|
||||||
|
|
||||||
define-command -hidden -params ..3 man-impl %{
|
define-command -hidden -params ..3 man-impl %{
|
||||||
|
set-option buffer readonly false
|
||||||
evaluate-commands %sh{
|
evaluate-commands %sh{
|
||||||
buffer_name="$1"
|
buffer_name="$1"
|
||||||
if [ -z "${buffer_name}" ]; then
|
if [ -z "${buffer_name}" ]; then
|
||||||
|
@ -60,8 +61,10 @@ define-command -hidden -params ..3 man-impl %{
|
||||||
nop %%sh{ rm "%s"; rm "%s" }
|
nop %%sh{ rm "%s"; rm "%s" }
|
||||||
' "$(cat "$manerr")" "${colout}" "${manerr}"
|
' "$(cat "$manerr")" "${colout}" "${manerr}"
|
||||||
fi
|
fi
|
||||||
|
echo "trigger-user-hook manpageloaded"
|
||||||
}
|
}
|
||||||
trigger-user-hook manpageloaded
|
set-option buffer readonly true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# MAN COMMAND
|
# MAN COMMAND
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue