Make ctags.kak compatible with original awk

Positional arguments in awk’s printf is a feature that is only available
in the GNU implementation of awk (gawk). So the ctags auto-completion feature
was broken in Kakoune if the installed version of awk was nawk or mawk.
This simple change makes it retro-compatible with those versions.

See https://www.gnu.org/software/gawk/manual/html_node/Printf-Ordering.html
This commit is contained in:
Loric Brevet 2022-11-18 12:29:02 +01:00
parent 91d45a100a
commit 84d72eb4ba
No known key found for this signature in database
GPG Key ID: 6AB3DBD46F8FB159

View File

@ -72,7 +72,7 @@ define-command ctags-complete -docstring "Complete the current selection" %{
eval "set -- $kak_quoted_opt_ctagsfiles" eval "set -- $kak_quoted_opt_ctagsfiles"
for ctagsfile in "$@"; do for ctagsfile in "$@"; do
${kak_opt_readtagscmd} -p -t "$ctagsfile" ${kak_selection} ${kak_opt_readtagscmd} -p -t "$ctagsfile" ${kak_selection}
done | awk '{ uniq[$1]++ } END { for (elem in uniq) printf " %1$s||%1$s", elem }' done | awk '{ uniq[$1]++ } END { for (elem in uniq) printf " %s||%s", elem, elem }'
) )
printf %s\\n "evaluate-commands -client ${kak_client} set-option buffer=${kak_bufname} ctags_completions ${header}${compl}" | \ printf %s\\n "evaluate-commands -client ${kak_client} set-option buffer=${kak_bufname} ctags_completions ${header}${compl}" | \
kak -p ${kak_session} kak -p ${kak_session}