Completing words without popup: is it possible?

Hi! I’m a bit new to Kakoune, but not shy of shell scripting or C programming.

Some editors have a feature which I really like: word completion without the completion popup. It works like this:

  • Partially type some word
  • Press a certain keybinding → first available word completion is inserted, without the popup
  • Press kebinding again → next available word completion is inserted
  • Repeat pressing while the desired completion is found (insertion of candidates wraps around if end is reached)

In Emacs this is called dabbrev-expand for example and is usually bound to Alt + /.

I wasn’t able to find such functionality, so I would like to implement it for myself, but I’m not sure how to.

I’ve searched :doc expansions and found no expansion which would give me word completions, also I’m not sure how to approach “cycling” them in the insert mode.

Any help or pointers in the right direction are appreciated!

Closest thing you could do is stop the completion popup from automatically appearing:

set-option global autocomplete prompt

Now the completion popup will only appear when you press either C-n or C-p.

The insert_completer seems to be hardcoded to show a menu with completions:

Yes, I have already disabled auto-popup with that option.

So it seems like no way to achieve this currently. I can think of writing a custom program which would manually scan buffer for words and return successive completions, but this is more complex stuff: need to do basic lexing, etc.

It could be possible with an explicit command to hide the completion menu, similarly to <c-o> in insert mode.

Right this could work!

I’ve been looking for this as well.
@alexherbo2 you are saying it isn’t possible now if I understand correctly? the ‘c-o’ thing reauires a change on kakoune’s side?

Yes, I asked @mawww on Discord what did he think about it. It doesn’t require changing ctrl-o, as ctrl-o disables completion, but another insert command that could be useful interactively to hide the menu when it hides the contents behind.