In a big C++ project I use dabberv-expand (aka M-/). Rtags, ctags, csope etc do not work by different reasons. Unfortunately I do not know how to enforce dabbrev to use a fuzzy search. So I decided to use ivy. The following code does almost everything I want:
(defun ivy-complete () (interactive) (dabbrev--reset-global-variables) (let* ((abbrev (dabbrev--abbrev-at-point)) (candidates (dabbrev--find-all-expansions abbrev t))) (when (not (null candidates)) (let* ((found-match (ivy-read "matches " candidates :preselect (thing-at-point 'word) :sort t)) (abbrev-length (length abbrev))) (insert (substring found-match abbrev-length))))))
One thing is missed. The completion shows the candidates in the minibuffer. I want them to be displayed in a popup window near the entry point. I tried to use ivy-display-function-popup and ivy-display-function-overlay but failed.
Questions: how to show the candidates in a popup or overlay window? May be it is possible to use ivy as a backend for some other packet like company?