mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-27 12:16:22 +03:00
doc.kak: anchor/section completion support
This commit is contained in:
parent
b63f16e7a2
commit
b8fdcff7b0
@ -122,7 +122,17 @@ define-command -params 1 -hidden doc-render %{
|
|||||||
|
|
||||||
define-command -params 1..2 \
|
define-command -params 1..2 \
|
||||||
-shell-candidates %{
|
-shell-candidates %{
|
||||||
find "${kak_runtime}/doc/" -type f -name "*.asciidoc" | sed 's,.*/,,; s/\.[^/]*$//'
|
if [ "$kak_token_to_complete" -eq 0 ]; then
|
||||||
|
find "${kak_runtime}/doc/" -type f -name "*.asciidoc" | sed 's,.*/,,; s/\.[^/]*$//'
|
||||||
|
elif [ "$kak_token_to_complete" -eq 1 ]; then
|
||||||
|
readonly page="${kak_runtime}/doc/${1}.asciidoc"
|
||||||
|
if [ -f "${page}" ]; then
|
||||||
|
awk '
|
||||||
|
/^==+ +/ { sub(/^==+ +/, ""); print }
|
||||||
|
/^\[\[[^\]]+\]\]/ { sub(/^\[\[/, ""); sub(/\]\].*/, ""); print }
|
||||||
|
' < $page
|
||||||
|
fi
|
||||||
|
fi
|
||||||
} \
|
} \
|
||||||
doc -docstring %{doc <topic> [<keyword>]: open a buffer containing documentation about a given topic
|
doc -docstring %{doc <topic> [<keyword>]: open a buffer containing documentation about a given topic
|
||||||
An optional keyword argument can be passed to the function, which will be automatically selected in the documentation} %{
|
An optional keyword argument can be passed to the function, which will be automatically selected in the documentation} %{
|
||||||
|
Loading…
Reference in New Issue
Block a user