Allow man buffer to be redrawn automatically when the window is resized
Tweaked by Maxime Coste Closes #671
This commit is contained in:
parent
e2bfd9e3b2
commit
4747ba6be9
|
@ -1,5 +1,7 @@
|
||||||
decl str docsclient
|
decl str docsclient
|
||||||
|
|
||||||
|
decl -hidden str _manpage
|
||||||
|
|
||||||
hook global WinSetOption filetype=man %{
|
hook global WinSetOption filetype=man %{
|
||||||
addhl group man-highlight
|
addhl group man-highlight
|
||||||
# Sections
|
# Sections
|
||||||
|
@ -10,6 +12,10 @@ hook global WinSetOption filetype=man %{
|
||||||
addhl -group man-highlight regex '^ {7}-[^\s,]+(,\s+-[^\s,]+)*' 0:yellow
|
addhl -group man-highlight regex '^ {7}-[^\s,]+(,\s+-[^\s,]+)*' 0:yellow
|
||||||
# References to other manpages
|
# References to other manpages
|
||||||
addhl -group man-highlight regex [-a-zA-Z0-9_.]+\(\d\) 0:green
|
addhl -group man-highlight regex [-a-zA-Z0-9_.]+\(\d\) 0:green
|
||||||
|
|
||||||
|
hook -group man-hooks window WinResize .* %{
|
||||||
|
_man %opt{_manpage}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
hook global WinSetOption filetype=(?!man).* %{
|
hook global WinSetOption filetype=(?!man).* %{
|
||||||
|
@ -17,7 +23,7 @@ hook global WinSetOption filetype=(?!man).* %{
|
||||||
rmhooks window man-hooks
|
rmhooks window man-hooks
|
||||||
}
|
}
|
||||||
|
|
||||||
def -hidden -params .. _man %{ %sh{
|
def -hidden -params 1..2 _man %{ %sh{
|
||||||
manout=$(mktemp /tmp/kak-man-XXXXXX)
|
manout=$(mktemp /tmp/kak-man-XXXXXX)
|
||||||
colout=$(mktemp /tmp/kak-man-XXXXXX)
|
colout=$(mktemp /tmp/kak-man-XXXXXX)
|
||||||
MANWIDTH=${kak_window_width} man "$@" > $manout
|
MANWIDTH=${kak_window_width} man "$@" > $manout
|
||||||
|
@ -25,10 +31,13 @@ def -hidden -params .. _man %{ %sh{
|
||||||
col -b -x > ${colout} < ${manout}
|
col -b -x > ${colout} < ${manout}
|
||||||
rm ${manout}
|
rm ${manout}
|
||||||
if [ "${retval}" -eq 0 ]; then
|
if [ "${retval}" -eq 0 ]; then
|
||||||
printf %s\\n "edit! -scratch '*man*'
|
printf %s\\n "
|
||||||
exec |cat<space>${colout}<ret>gk
|
edit -scratch '*man*'
|
||||||
|
exec '%|cat<space>${colout}<ret>gk'
|
||||||
nop %sh{rm ${colout}}
|
nop %sh{rm ${colout}}
|
||||||
set buffer filetype man"
|
set buffer filetype man
|
||||||
|
set window _manpage '$@'
|
||||||
|
"
|
||||||
else
|
else
|
||||||
printf %s\\n "echo -color Error %{man '$@' failed: see *debug* buffer for details }"
|
printf %s\\n "echo -color Error %{man '$@' failed: see *debug* buffer for details }"
|
||||||
rm ${colout}
|
rm ${colout}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user