Skip to content

Commit 79abe58

Browse files
committed
Fix the pattern detection regex, take compression into account when suggesting doc pages
1 parent 77beeaf commit 79abe58

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

rc/doc.kak

+5-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def -hidden -params 1..2 _doc-open %{
2121
"
2222
2323
if [ $# -gt 1 ]; then
24-
echo "try %{ exec '%<a-s><a-k>^\s+\S*\Q${2}\E<ret>\'' } catch %{ exec <space>gg }"
24+
echo "try %{ exec '%<a-s><a-k>(?i)^\h+[^\n]*?\Q${2}\E<ret>\'' } catch %{ exec <space>gg }"
2525
fi
2626
else
2727
echo "echo -color Error %{doc '$@' failed: see *debug* buffer for details}"
@@ -32,11 +32,13 @@ def -hidden -params 1..2 _doc-open %{
3232

3333
def -params 1..2 \
3434
-shell-completion %{
35-
find "${kak_opt_doc_path}" -type f -iname "*$@*" -printf '%f\n'
35+
find "${kak_opt_doc_path}" -type f -iname "*$@*.gz" -printf '%f\n' | while read l; do
36+
echo "${l%.*}"
37+
done
3638
} \
3739
doc -docstring "Open a buffer containing the documentation about a given subject" %{
3840
%sh{
39-
readonly PATH_DOC="${kak_opt_doc_path}/${1}"
41+
readonly PATH_DOC="${kak_opt_doc_path}/${1}.gz"
4042
4143
shift
4244
if [ ! -f "${PATH_DOC}" ]; then

0 commit comments

Comments
 (0)