Tweak completer scripts
This commit is contained in:
parent
5ef4dd84b9
commit
e8f2ebb737
11
rc/clang.kak
11
rc/clang.kak
|
@ -23,15 +23,16 @@ def clang-complete %{
|
||||||
rmhooks buffer clang-cleanup
|
rmhooks buffer clang-cleanup
|
||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
# this runs in a detached shell, asynchronously, so that kakoune does not hang while clang is running.
|
# this runs in a detached shell, asynchronously, so that kakoune does
|
||||||
# As completions references a cursor position and a buffer timestamp, only valid completions should be
|
# not hang while clang is running. As completions references a cursor
|
||||||
|
# position and a buffer timestamp, only valid completions should be
|
||||||
# displayed.
|
# displayed.
|
||||||
(
|
(
|
||||||
pos=-:${kak_cursor_line}:${kak_cursor_column}
|
pos=-:${kak_cursor_line}:${kak_cursor_column}
|
||||||
cd $(dirname ${kak_buffile})
|
cd $(dirname ${kak_buffile})
|
||||||
header="${kak_cursor_line}.${kak_cursor_column}@${kak_timestamp}"
|
header="${kak_cursor_line}.${kak_cursor_column}@${kak_timestamp}"
|
||||||
compl=$(clang++ -x c++ -fsyntax-only ${kak_opt_clang_options} -Xclang -code-completion-at=${pos} - < ${dir}/buf 2>&1 |
|
compl=$(clang++ -x c++ -fsyntax-only ${kak_opt_clang_options} -Xclang -code-completion-at=${pos} - < ${dir}/buf 2> ${dir}/fifo |
|
||||||
tee ${dir}/fifo | grep ^COMPLETION: | grep -v '(Hidden)' | sed -re 's/^COMPLETION: ([^:]+) :.*/\1/; s/:/\\:/g' | uniq | paste -s -d ':')
|
grep ^COMPLETION: | grep -v '(Hidden)' | sed -re 's/^COMPLETION: (.+) : .*/\1/; s/:/\\:/g' | uniq | paste -s -d ':')
|
||||||
|
|
||||||
echo "eval -client ${kak_client} %[ echo completed; set 'buffer=${kak_buffile}' clang_completions %[${header}:${compl}] ]" | kak -p ${kak_session}
|
echo "eval -client ${kak_client} %[ echo completed; set 'buffer=${kak_buffile}' clang_completions %[${header}:${compl}] ]" | kak -p ${kak_session}
|
||||||
) > /dev/null 2>&1 < /dev/null &
|
) > /dev/null 2>&1 < /dev/null &
|
||||||
|
@ -39,7 +40,7 @@ def clang-complete %{
|
||||||
}
|
}
|
||||||
|
|
||||||
def clang-enable-autocomplete %{
|
def clang-enable-autocomplete %{
|
||||||
set window completers %sh{ echo "'option=clang_completions:${kak_opt_completers}'" }
|
set window completers %rec{option=clang_completions:%opt{completers}}
|
||||||
hook window -group clang-autocomplete InsertIdle .* %{ try %{
|
hook window -group clang-autocomplete InsertIdle .* %{ try %{
|
||||||
exec -draft <a-h><a-k>(\.|->|::).\'<ret>
|
exec -draft <a-h><a-k>(\.|->|::).\'<ret>
|
||||||
echo 'completing...'
|
echo 'completing...'
|
||||||
|
|
|
@ -21,7 +21,7 @@ def jedi-complete %{
|
||||||
cd $(dirname ${kak_buffile})
|
cd $(dirname ${kak_buffile})
|
||||||
header="${kak_cursor_line}.${kak_cursor_column}@${kak_timestamp}"
|
header="${kak_cursor_line}.${kak_cursor_column}@${kak_timestamp}"
|
||||||
|
|
||||||
compl=$( (python | 2>&1 tee "${dir}/fifo") <<-END
|
compl=$(python 2> "${dir}/fifo" <<-END
|
||||||
import jedi
|
import jedi
|
||||||
script=jedi.Script(open('$dir/buf', 'r').read(), $kak_cursor_line, $kak_cursor_column - 1, '$kak_buffile')
|
script=jedi.Script(open('$dir/buf', 'r').read(), $kak_cursor_line, $kak_cursor_column - 1, '$kak_buffile')
|
||||||
print ':'.join([str(c.name) for c in script.completions()])
|
print ':'.join([str(c.name) for c in script.completions()])
|
||||||
|
@ -34,7 +34,7 @@ def jedi-complete %{
|
||||||
}
|
}
|
||||||
|
|
||||||
def jedi-enable-autocomplete %{
|
def jedi-enable-autocomplete %{
|
||||||
set window completers %sh{ echo "'option=jedi_completions:${kak_opt_completers}'" }
|
set window completers %rec{option=jedi_completions:%opt{completers}} }
|
||||||
hook window -group jedi-autocomplete InsertIdle .* %{ try %{
|
hook window -group jedi-autocomplete InsertIdle .* %{ try %{
|
||||||
exec -draft <a-h><a-k>\..\'<ret>
|
exec -draft <a-h><a-k>\..\'<ret>
|
||||||
echo 'completing...'
|
echo 'completing...'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user