Closed VKondakoff closed 1 month ago
In your examples, open_buffer_picker
is a command which accepts no arguments, but Kakoune is told to use buffer-completion anyway. Because of the -menu
option, Kakoune will force you to choose a buffer name to add to the command-line, guaranteeing a "wrong argument count" error.
When the command is invoked without an argument (such as from a user-mode mapping), it runs the prompt
command, which uses a similar user-interface, but which asks the user for a string which will be handled by a user script, rather than being executed by Kakoune as a command. As a result, it has its own, independent settings.
declare-command
options like -buffer-completion
have been deprecated in favour of the separate complete-command
command, which modifies the completion settings for a specific user-declared command. However, prompt
is a built-in command, not a user-declared command. It still requires options like -buffer-completion
to control what kind of completion it provides, they have not been deprecated, and complete-command
does not affect it.
Long story short, the "old" code you present under "Expectations" is still correct, and still the way to achieve the result you want with modern versions of Kakoune.
Incidentally, I assume this is a simplified test-case meant to demonstrate the problem, and not something you actually use in your kakrc. If you want a buffer picker, you could just use map global user b :b<space>
since the buffer
command already uses buffer-completion and already switches to the selected buffer when you hit <ret>
.
declare-command options like -buffer-completion have been deprecated in favour of the separate complete-command command, which modifies the completion settings for a specific user-declared command. However, prompt is a built-in command, not a user-declared command. It still requires options like -buffer-completion to control what kind of completion it provides, they have not been deprecated, and complete-command does not affect it.
Got it, thank you! Closing the issue.
If you want a buffer picker, you could just use map global user b :b
since the buffer command already uses buffer-completion and already switches to the selected buffer when you hit .
This! Exactly, thank you once again.
Version of Kakoune
v2023.08.05
Reproducer
I created a simple command to browse the open buffers:
Outcome
If I launch the command from the command prompt the completion works:
If I launch the same command from user-mode (by pressing
<Space>-b
) there is no completion:Expectations
I was expecting to see completion when launching command from command prompt AND user mode. It is interesting that the old completion syntax works both in prompt and in user mode:
Is this a bug or am I doing something wrong?
Additional information
MacOS 12.7.4, zsh.