AutoYADM commit: 2025-05-21 03:33:33
This commit is contained in:
parent
2f7643d380
commit
f9d20cf2c4
5 changed files with 72 additions and 39 deletions
23
.config/fish/functions/kakman.fish
Normal file
23
.config/fish/functions/kakman.fish
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
function kakman --wraps man --description 'Display manual pages with Kakoune'
|
||||||
|
set -lx MANPATH (string join : $MANPATH)
|
||||||
|
if test -z "$MANPATH"
|
||||||
|
type -q manpath
|
||||||
|
and set MANPATH (command manpath)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Check data dir for Fish 2.x compatibility
|
||||||
|
set -l fish_data_dir
|
||||||
|
if set -q __fish_data_dir
|
||||||
|
set fish_data_dir $__fish_data_dir
|
||||||
|
else
|
||||||
|
set fish_data_dir $__fish_datadir
|
||||||
|
end
|
||||||
|
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
|
||||||
|
$mancmd
|
||||||
|
return
|
||||||
|
end
|
||||||
|
$mancmd
|
||||||
|
end
|
38
.config/fish/functions/lessman.fish
Normal file
38
.config/fish/functions/lessman.fish
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
function lessman --wraps man --description 'Format and display manual pages with less'
|
||||||
|
set -l end (printf "\e[0m")
|
||||||
|
|
||||||
|
set -lx LESS_TERMCAP_mb (set_color -o red)
|
||||||
|
set -lx LESS_TERMCAP_md (set_color -o B14242)
|
||||||
|
set -lx LESS_TERMCAP_me $end
|
||||||
|
set -lx LESS_TERMCAP_so (set_color 4A8B8B)
|
||||||
|
set -lx LESS_TERMCAP_se $end
|
||||||
|
set -lx LESS_TERMCAP_us (set_color -o D87C4A)
|
||||||
|
set -lx LESS_TERMCAP_ue $end
|
||||||
|
set -lx LESS '-R -s'
|
||||||
|
|
||||||
|
set -lx GROFF_NO_SGR yes # fedora
|
||||||
|
|
||||||
|
set -lx MANPATH (string join : $MANPATH)
|
||||||
|
if test -z "$MANPATH"
|
||||||
|
type -q manpath
|
||||||
|
and set MANPATH (command manpath)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Check data dir for Fish 2.x compatibility
|
||||||
|
set -l fish_data_dir
|
||||||
|
if set -q __fish_data_dir
|
||||||
|
set fish_data_dir $__fish_data_dir
|
||||||
|
else
|
||||||
|
set fish_data_dir $__fish_datadir
|
||||||
|
end
|
||||||
|
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
|
||||||
|
return
|
||||||
|
end
|
||||||
|
command man $argv
|
||||||
|
$mancmd
|
||||||
|
end
|
|
@ -1,39 +1,3 @@
|
||||||
function man --wraps man --description 'Format and display manual pages'
|
function man --wraps man --description 'Format and display manual pages'
|
||||||
set -l end (printf "\e[0m")
|
kakman $argv
|
||||||
|
|
||||||
set -lx LESS_TERMCAP_mb (set_color -o red)
|
|
||||||
set -lx LESS_TERMCAP_md (set_color -o B14242)
|
|
||||||
set -lx LESS_TERMCAP_me $end
|
|
||||||
set -lx LESS_TERMCAP_so (set_color 4A8B8B)
|
|
||||||
set -lx LESS_TERMCAP_se $end
|
|
||||||
set -lx LESS_TERMCAP_us (set_color -o D87C4A)
|
|
||||||
set -lx LESS_TERMCAP_ue $end
|
|
||||||
set -lx LESS '-R -s'
|
|
||||||
|
|
||||||
set -lx GROFF_NO_SGR yes # fedora
|
|
||||||
|
|
||||||
set -lx MANPATH (string join : $MANPATH)
|
|
||||||
if test -z "$MANPATH"
|
|
||||||
type -q manpath
|
|
||||||
and set MANPATH (command manpath)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Check data dir for Fish 2.x compatibility
|
|
||||||
set -l fish_data_dir
|
|
||||||
if set -q __fish_data_dir
|
|
||||||
set fish_data_dir $__fish_data_dir
|
|
||||||
else
|
|
||||||
set fish_data_dir $__fish_datadir
|
|
||||||
end
|
|
||||||
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 "$kakargs"
|
|
||||||
$mancmd
|
|
||||||
return
|
|
||||||
end
|
|
||||||
# command man $argv | kak -e "$kakargs"
|
|
||||||
$mancmd
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,6 +31,9 @@ hook global WinSetOption filetype=fish %{
|
||||||
set-option window formatcmd "fish_indent"
|
set-option window formatcmd "fish_indent"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# TODO: modify man.kak so that it leaves one char of whitespace
|
||||||
|
# on the rightmost column of the whole file, so that selecting the whole
|
||||||
|
# line doesn't cause hortizonal overflow!
|
||||||
hook global WinSetOption filetype=man %{
|
hook global WinSetOption filetype=man %{
|
||||||
try %{
|
try %{
|
||||||
# remove these highlighters so everything displays properly
|
# remove these highlighters so everything displays properly
|
||||||
|
@ -42,9 +45,11 @@ hook global WinSetOption filetype=man %{
|
||||||
# This is needed because we can't modify the selection
|
# This is needed because we can't modify the selection
|
||||||
# in WinSetOption's context
|
# in WinSetOption's context
|
||||||
hook -once global User manpageloaded %{
|
hook -once global User manpageloaded %{
|
||||||
|
# This will move the cursor to the enter of the screen
|
||||||
execute-keys %sh{
|
execute-keys %sh{
|
||||||
result=$((kak_window_height / 2 - 1))
|
result=$((kak_window_height / 2 - 1))
|
||||||
printf '%d%s' "$result" 'j'
|
printf '%d%s' "$result" 'j'
|
||||||
}
|
}
|
||||||
|
set-option window scrolloff "99,0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
# CHANGES BY DANIEL:
|
||||||
|
# man-impl emits the 'manpageloaded' User hook event after it's done.
|
||||||
|
# It also unsets readonly before changing the buffer, and re-sets it when
|
||||||
|
# it's done.
|
||||||
|
|
||||||
declare-option -docstring "name of the client in which documentation is to be displayed" \
|
declare-option -docstring "name of the client in which documentation is to be displayed" \
|
||||||
str docsclient
|
str docsclient
|
||||||
|
|
||||||
|
@ -67,8 +72,6 @@ define-command -hidden -params ..3 man-impl %{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# MAN COMMAND
|
|
||||||
# TODO: REMOVE number lines and show whitespace highlighters!
|
|
||||||
define-command -params ..1 \
|
define-command -params ..1 \
|
||||||
-shell-script-candidates %{
|
-shell-script-candidates %{
|
||||||
find /usr/share/man/ $(printf %s "${MANPATH}" |
|
find /usr/share/man/ $(printf %s "${MANPATH}" |
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue