AutoYADM commit: 2025-05-21 03:03:07
This commit is contained in:
parent
ec6e7d142a
commit
7c524d8e20
2 changed files with 116 additions and 111 deletions
|
@ -37,9 +37,14 @@ hook global WinSetOption filetype=man %{
|
||||||
remove-highlighter window/show-whitespaces
|
remove-highlighter window/show-whitespaces
|
||||||
ui-wrap-disable
|
ui-wrap-disable
|
||||||
}
|
}
|
||||||
|
define-command mantest %{
|
||||||
execute-keys %sh{
|
execute-keys %sh{
|
||||||
result=$((kak_window_height / 2 - 1))
|
result=$((kak_window_height / 2 - 1))
|
||||||
notify-send 'this'
|
notify-send 'this'
|
||||||
printf '%d%s' "$result" 'j'
|
printf '%d%s' "$result" 'j'
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
hook window User manpageloaded %{
|
||||||
|
mantest
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
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
|
||||||
|
|
||||||
declare-option -hidden str-list manpage
|
declare-option -hidden str-list manpage
|
||||||
|
|
||||||
|
@ -27,7 +27,8 @@ hook global WinSetOption filetype=man %{
|
||||||
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window man-hooks }
|
hook -once -always window WinSetOption filetype=.* %{ remove-hooks window man-hooks }
|
||||||
}
|
}
|
||||||
|
|
||||||
define-command -hidden -params ..3 man-impl %{ evaluate-commands %sh{
|
define-command -hidden -params ..3 man-impl %{
|
||||||
|
evaluate-commands %sh{
|
||||||
buffer_name="$1"
|
buffer_name="$1"
|
||||||
if [ -z "${buffer_name}" ]; then
|
if [ -z "${buffer_name}" ]; then
|
||||||
exit
|
exit
|
||||||
|
@ -59,21 +60,23 @@ define-command -hidden -params ..3 man-impl %{ evaluate-commands %sh{
|
||||||
nop %%sh{ rm "%s"; rm "%s" }
|
nop %%sh{ rm "%s"; rm "%s" }
|
||||||
' "$(cat "$manerr")" "${colout}" "${manerr}"
|
' "$(cat "$manerr")" "${colout}" "${manerr}"
|
||||||
fi
|
fi
|
||||||
} }
|
}
|
||||||
|
trigger-user-hook manpageloaded
|
||||||
|
}
|
||||||
|
|
||||||
# MAN COMMAND
|
# MAN COMMAND
|
||||||
# TODO: REMOVE number lines and show whitespace highlighters!
|
# 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}" |
|
||||||
sed 's/:/ /') -name '*.[1-8]*' |
|
sed 's/:/ /') -name '*.[1-8]*' |
|
||||||
sed 's,^.*/\(.*\)\.\([1-8][a-zA-Z]*\).*$,\1(\2),'
|
sed 's,^.*/\(.*\)\.\([1-8][a-zA-Z]*\).*$,\1(\2),'
|
||||||
} \
|
} \
|
||||||
-docstring %{
|
-docstring %{
|
||||||
man [<page>]: manpage viewer wrapper
|
man [<page>]: manpage viewer wrapper
|
||||||
If no argument is passed to the command, the selection will be used as page
|
If no argument is passed to the command, the selection will be used as page
|
||||||
The page can be a word, or a word directly followed by a section number between parenthesis, e.g. kak(1)
|
The page can be a word, or a word directly followed by a section number between parenthesis, e.g. kak(1)
|
||||||
} man %{ evaluate-commands %sh{
|
} man %{ evaluate-commands %sh{
|
||||||
subject=${1-$kak_selection}
|
subject=${1-$kak_selection}
|
||||||
|
|
||||||
## The completion suggestions display the page number, strip them if present
|
## The completion suggestions display the page number, strip them if present
|
||||||
|
@ -91,8 +94,6 @@ define-command -params ..1 \
|
||||||
printf %s\\n "evaluate-commands -try-client %opt{docsclient} man-impl man $pagenum $subject"
|
printf %s\\n "evaluate-commands -try-client %opt{docsclient} man-impl man $pagenum $subject"
|
||||||
} }
|
} }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# The following section of code enables a user
|
# The following section of code enables a user
|
||||||
# to go to next or previous man page links and to follow man page links,
|
# to go to next or previous man page links and to follow man page links,
|
||||||
# for example, apropos(1), that would normally appear in SEE ALSO sections.
|
# for example, apropos(1), that would normally appear in SEE ALSO sections.
|
||||||
|
@ -102,12 +103,12 @@ define-command -params ..1 \
|
||||||
# Regex pattern defining a man page link.
|
# Regex pattern defining a man page link.
|
||||||
# Used for determining if a selection, which may just be a link, is a link.
|
# Used for determining if a selection, which may just be a link, is a link.
|
||||||
declare-option -hidden regex man_link1 \
|
declare-option -hidden regex man_link1 \
|
||||||
[\w_.:-]+\(\d[a-z]*\)
|
[\w_.:-]+\(\d[a-z]*\)
|
||||||
|
|
||||||
# Same as above but with lookbehind and lookahead patterns.
|
# Same as above but with lookbehind and lookahead patterns.
|
||||||
# Used for searching for a man page link.
|
# Used for searching for a man page link.
|
||||||
declare-option -hidden regex man_link2 \
|
declare-option -hidden regex man_link2 \
|
||||||
"(?:^|(?<=\W))%opt{man_link1}(?=\W)"
|
"(?:^|(?<=\W))%opt{man_link1}(?=\W)"
|
||||||
|
|
||||||
# Define a useful command sequence for searching a given regex
|
# Define a useful command sequence for searching a given regex
|
||||||
# and a given sequence of search keys.
|
# and a given sequence of search keys.
|
||||||
|
@ -139,4 +140,3 @@ map global man 'g' -docstring 'Jump to a man page using selected man page link'
|
||||||
map global man 'j' -docstring 'Go to next man page link' :man-link-next<ret>
|
map global man 'j' -docstring 'Go to next man page link' :man-link-next<ret>
|
||||||
map global man 'k' -docstring 'Go to previous man page link' :man-link-prev<ret>
|
map global man 'k' -docstring 'Go to previous man page link' :man-link-prev<ret>
|
||||||
map global man 'm' -docstring 'Look up a man page' :man<space>
|
map global man 'm' -docstring 'Look up a man page' :man<space>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue