diff options
| -rw-r--r-- | ravi-init-insertion.el | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/ravi-init-insertion.el b/ravi-init-insertion.el index aea9cee..4bb9fc5 100644 --- a/ravi-init-insertion.el +++ b/ravi-init-insertion.el @@ -86,7 +86,33 @@ (if (company-manual-begin) (company-complete-common) (indent-according-to-mode))) - (bind-key "\t" 'ravi/complete-or-indent)) + (bind-key "\t" 'ravi/complete-or-indent) + + (use-package company-c-headers + :init + (progn + (add-to-list 'company-backends 'company-c-headers)) + :config + (progn + (defun ravi/get-default-include-paths () + (let* ((gcc-out (shell-command-to-string "g++ -E -x c++ - -v < /dev/null")) + (gcc-list-match (string-match "#include <...> search starts here:\n\\(.*\\(?:\n.*\\)*?\\)End of search list.\n" gcc-out)) + (combined-list (match-string 1 gcc-out)) + ;; Need the following rigamarole to handle paths with spaces in them + (path-list-with-spaces (and combined-list (split-string combined-list "\n" t))) + (path-list (and path-list-with-spaces (mapcar 's-trim-left path-list-with-spaces)))) + path-list)) + (mapc (lambda (dir) (add-to-list 'company-c-headers-path-system dir)) (ravi/get-default-include-paths)) + ) + :ensure t) + + ;; Get rid of company-semantic as it interferes with clang-based backends + (setq company-backends (delete 'company-semantic company-backends)) + ;; Get rid of company-clang since it is too noisy at this point + (setq company-backends (delete 'company-clang company-backends)) + + (require 'company-yasnippet) + (bind-key "<backtab>" 'company-yasnippet)) :ensure t) |
