summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-12-06 14:10:10 +0800
committerMaxime Coste <mawww@kakoune.org>2017-12-06 14:10:10 +0800
commita9f1a23f35c42b6a2fc3db6dca4dfa93dccfaad0 (patch)
tree0b5db622175651afcb8b1205bb429ec83fdbe86c
parent86fcc55e536eb5b57ec4bde2d0ffabef80b38dbb (diff)
man.kak: use shell-candidates instead of shell-completions
-rw-r--r--rc/core/man.kak12
1 files changed, 2 insertions, 10 deletions
diff --git a/rc/core/man.kak b/rc/core/man.kak
index 27cdf7f6..22659bb8 100644
--- a/rc/core/man.kak
+++ b/rc/core/man.kak
@@ -49,16 +49,8 @@ define-command -hidden -params 1..2 man-impl %{ %sh{
} }
define-command -params ..1 \
- -shell-completion %{
- prefix=$(printf %s\\n "$1" | cut -c1-${kak_pos_in_token} 2>/dev/null)
- for page in /usr/share/man/*/${prefix}*.[1-8]*; do
- candidate=$(basename ${page%%.[1-8]*})
- pagenum=$(printf %s\\n "$page" | sed 's,^.*\.\([1-8][^.]*\).*$,\1,')
- case $candidate in
- *\*) ;;
- *) printf %s\\n "$candidate($pagenum)";;
- esac
- done
+ -shell-candidates %{
+ find /usr/share/man/ -name '*.[1-8]*' | sed 's,^.*/\(.*\)\.\([1-8][a-zA-Z]*\).*$,\1(\2),'
} \
-docstring %{man [<page>]: manpage viewer wrapper
If no argument is passed to the command, the selection will be used as page