abo-abo / swiper

Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!
https://oremacs.com/swiper/
2.27k stars 337 forks source link

counsel-irony completion #1427

Open piojanu opened 6 years ago

piojanu commented 6 years ago

Hi!

I tried to set up counsel-irony like in here, but it doesn't work :( I use use-package, here is my config:

(use-package irony
  :hook ((c++-mode . irony-mode)
     (c-mode . irony-mode))
  :defer t
  :config
  ;; counsel-irony setup
  (define-key irony-mode-map
      [remap completion-at-point] 'counsel-irony)
  (define-key irony-mode-map
      [remap complete-symbol] 'counsel-irony)
  (irony-cdb-autosetup-compile-options)

  (use-package irony-eldoc
    :pin melpa
    :hook (irony-mode . irony-eldoc))

  (use-package flycheck-irony
    :after flycheck
    :hook (flycheck-mode . flycheck-irony-setup))
)

I set (setq-default tab-always-indent 'complete) to be able to complete with TAB, it works in python buffer (I use anaconda-mode) and in elisp buffer, but it doesn't work in cpp buffer :(

Also, when I do C-M-i or M-x complete-at-point/complete-symbol it gives different results then M-x counsel-irony (latter is better, it gives info about arguments), so I suppose remap doesn't work.

Can someone help me with it? How to properly remap keybinds and make it work with TAB.

Thanks! Piotr

abo-abo commented 6 years ago

I'm not familiar with workflows where TAB isn't just used for indenting.

You can try:

(define-key c++-mode-map (kbd "C-M-i") 'counsel-irony)
piojanu commented 6 years ago

That's what I did for now. I suppose it will be easier to change habit and use C-M-i, thanks ;) If anybody else has solution, I look forward.