kakoune/test/regression/0-autocomplete-overrules-completers/rc
Johannes Altmanninger 43fc5b0078 Make <c-n> show completion menu again when autocomplete is off
As pointed out in [1], when insert mode autocomplete is disabled,
<c-n> could be used to activate insert mode completions temporarily
[2].  This regressed in 6f7c5aed (Do not show custom completions when
autocomplete is off, 2022-01-03). Fix this by enabling completions
on <c-n>/<c-p>. This allows us to remove a special case for explicit
completers.

Alternative behavior (future?): make <c-n> toggle completion like
<c-o>.  This can be done today, as suggested by Screwtape on IRC:

	map global insert <c-n> %{<c-o><c-n><a-;>:toggle-ctrl-n<ret>}
	define-command toggle-ctrl-n %{
		hook global InsertCompletionShow .* %{ map window insert <c-n> <c-n> }
		hook global InsertCompletionHide .* %{ unmap window insert <c-n> <c-n> }
	}

[1] https://github.com/mawww/kakoune/pull/4493#issuecomment-1031189823
[2] <c-n> completion only lives for the lifetime of the completion
    menu, whereas <c-o> lasts until you exit insert mode. This means
    that autocompletion is much more convenient than <c-n> or <c-x>f,
    because those require an explicit completion request for each
    path component.
2022-02-07 14:52:51 +01:00

9 lines
524 B
Plaintext

set-option global autocomplete prompt
declare-option -hidden completions line1_completions
declare-option -hidden completions line2_completions
declare-option -hidden completions line3_completions
set-option global completers option=line1_completions option=line2_completions option=line3_completions
set-option global line1_completions "1.1+0@%val(timestamp)" "a1||a1"
set-option global line2_completions "2.1+0@%val(timestamp)" "a2||a2"
set-option global line3_completions "3.1+0@%sh{echo $(($kak_timestamp+1))}" "a3||a3"