diff --git a/rc/tools/doc.kak b/rc/tools/doc.kak index 6e0cf74e..b68f9363 100644 --- a/rc/tools/doc.kak +++ b/rc/tools/doc.kak @@ -137,9 +137,19 @@ define-command -params 1 -hidden doc-render %{ define-command -params 1..2 \ -shell-script-candidates %{ if [ "$kak_token_to_complete" -eq 0 ]; then - find "${kak_runtime}/doc/" -type f -name "*.asciidoc" | sed 's,.*/,,; s/\.[^/]*$//' + ( + find "${kak_runtime}/doc/" -type f -name "*.asciidoc" + find "${kak_runtime}/rc/" -type f -name "*.asciidoc" + find "${kak_config}/autoload/" -type f -name "*.asciidoc" + ) | sed 's,.*/,,; s/\.[^/]*$//' elif [ "$kak_token_to_complete" -eq 1 ]; then - readonly page="${kak_runtime}/doc/${1}.asciidoc" + page=$( + ( + find "${kak_runtime}/doc/" -type f -name "$1.asciidoc" + find "${kak_runtime}/rc/" -type f -name "$1.asciidoc" + find "${kak_config}/autoload/" -type f -name "$1.asciidoc" + ) | head -1 + ) if [ -f "${page}" ]; then awk ' /^==+ +/ { sub(/^==+ +/, ""); print } @@ -153,7 +163,13 @@ define-command -params 1..2 \ An optional keyword argument can be passed to the function, which will be automatically selected in the documentation } %{ evaluate-commands %sh{ - readonly page="${kak_runtime}/doc/${1}.asciidoc" + page=$( + ( + find "${kak_runtime}/doc/" -type f -name "$1.asciidoc" + find "${kak_runtime}/rc/" -type f -name "$1.asciidoc" + find "${kak_config}/autoload/" -type f -name "$1.asciidoc" + ) | head -1 + ) if [ -f "${page}" ]; then jump_cmd="" if [ $# -eq 2 ]; then