From a9f1a23f35c42b6a2fc3db6dca4dfa93dccfaad0 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 6 Dec 2017 14:10:10 +0800 Subject: [PATCH] man.kak: use shell-candidates instead of shell-completions --- rc/core/man.kak | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/rc/core/man.kak b/rc/core/man.kak index 27cdf7f6b..22659bb8a 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 []: manpage viewer wrapper If no argument is passed to the command, the selection will be used as page