Merge remote-tracking branch 'Screwtapello/fix-racer-integration'

This commit is contained in:
Maxime Coste 2018-07-14 23:17:45 +10:00
commit 8e1bd88958

View File

@ -7,7 +7,7 @@ define-command racer-complete -docstring "Complete the current selection with ra
printf %s\\n "set-option buffer racer_tmp_dir ${dir}" printf %s\\n "set-option buffer racer_tmp_dir ${dir}"
printf %s\\n "evaluate-commands -no-hooks %{ write ${dir}/buf }" printf %s\\n "evaluate-commands -no-hooks %{ write ${dir}/buf }"
} }
nop %sh{ evaluate-commands %sh{
dir=${kak_opt_racer_tmp_dir} dir=${kak_opt_racer_tmp_dir}
( (
cursor="${kak_cursor_line} $((${kak_cursor_column} - 1))" cursor="${kak_cursor_line} $((${kak_cursor_column} - 1))"
@ -16,7 +16,7 @@ define-command racer-complete -docstring "Complete the current selection with ra
BEGIN { FS = "\t"; ORS = ":" } BEGIN { FS = "\t"; ORS = ":" }
/^PREFIX/ { /^PREFIX/ {
column = ENVIRON["kak_cursor_column"] + $2 - $3 column = ENVIRON["kak_cursor_column"] + $2 - $3
print ENVIRON["kak_cursor_line"] "." column "\\@" ENVIRON["kak_timestamp"] print ENVIRON["kak_cursor_line"] "." column "@@" ENVIRON["kak_timestamp"]
} }
/^MATCH/ { /^MATCH/ {
word = $2 word = $2
@ -80,7 +80,7 @@ define-command racer-complete -docstring "Complete the current selection with ra
} }
define-command racer-enable-autocomplete -docstring "Add racer completion candidates to the completer" %{ define-command racer-enable-autocomplete -docstring "Add racer completion candidates to the completer" %{
set-option window completers "option=racer_completions:%opt{completers}" set-option window completers option=racer_completions %opt{completers}
hook window -group racer-autocomplete InsertIdle .* %{ try %{ hook window -group racer-autocomplete InsertIdle .* %{ try %{
execute-keys -draft <a-h><a-k>([\w\.]|::).\z<ret> execute-keys -draft <a-h><a-k>([\w\.]|::).\z<ret>
racer-complete racer-complete
@ -89,7 +89,7 @@ define-command racer-enable-autocomplete -docstring "Add racer completion candid
} }
define-command racer-disable-autocomplete -docstring "Disable racer completion" %{ define-command racer-disable-autocomplete -docstring "Disable racer completion" %{
set-option window completers %sh{ printf %s\\n "'${kak_opt_completers}'" | sed 's/option=racer_completions://g' } evaluate-commands %sh{ printf "set-option window completers %s\n" $(printf %s "${kak_opt_completers}" | sed -e "s/'option=racer_completions'//g") }
remove-hooks window racer-autocomplete remove-hooks window racer-autocomplete
unalias window complete racer-complete unalias window complete racer-complete
} }