go-tools.kak: quote completions and scope

Since the gocode completions contain white space, they cannot be used without quotations.

Also, since I'm in there, the buffer should be quoted for heathens who use white space in their paths.
This commit is contained in:
Scott W. Dunlop 2018-09-04 11:41:35 -07:00
parent adf372b6fd
commit 575b02b171

View File

@ -33,9 +33,9 @@ define-command go-complete -docstring "Complete the current selection with gocod
column_offset=$(echo "${gocode_data}" | head -n1 | cut -d, -f1)
header="${kak_cursor_line}.$((${kak_cursor_column} - $column_offset))@${kak_timestamp}"
compl=$(echo "${gocode_data}" | sed 1d | awk -F ",," '{print $2 "||" $1}' | paste -s -d: -)
compl=$(echo "${gocode_data}" | sed 1d | awk -F ",," '{print "%~" $2 "||" $1 "~"}' | paste -s -)
printf %s\\n "evaluate-commands -client '${kak_client}' %{
set-option buffer=${kak_bufname} gocode_completions '${header}' '${compl}'
set-option 'buffer=${kak_bufname}' gocode_completions ${header} ${compl}
}" | kak -p ${kak_session}
) > /dev/null 2>&1 < /dev/null &
}