From ee13cbc2ec64c151d08d8bab598f60488a2b31f1 Mon Sep 17 00:00:00 2001 From: Laurens Miers Date: Sun, 20 Aug 2017 16:30:15 +0200 Subject: [PATCH] Use sarcasm/irony-mode for autocompletion + flycheck --- README.md | 6 +++++- custom/setup-autocompletion.el | 19 ++++++++++++++++--- custom/setup-editing.el | 2 +- init.el | 5 ++++- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 11eb460..b631bf4 100644 --- a/README.md +++ b/README.md @@ -5,4 +5,8 @@ It is mostly based on tuhdo's emacs ide demo: https://github.com/tuhdo/emacs-c-i This configuration requires the installation of : - the GNU global package (for gtags) - + - clang (for ivory) + - cmake (for ivory) + - llvm-libs (for cmake, somehow not a dependency on Manjaro when installing cmake) + +When first checking out this config, run irony-install-server to make and install the irony-server. diff --git a/custom/setup-autocompletion.el b/custom/setup-autocompletion.el index 6e0793b..71b8de5 100644 --- a/custom/setup-autocompletion.el +++ b/custom/setup-autocompletion.el @@ -1,6 +1,19 @@ +;; Add irony as company-backend (eval-after-load 'company - '(progn - (define-key company-mode-map (kbd "C-:") 'helm-company) - (define-key company-active-map (kbd "C-:") 'helm-company))) + '(add-to-list 'company-backends 'company-irony)) + +;; Add irony as flycheck hook +(eval-after-load 'flycheck + '(add-hook 'flycheck-mode-hook 'flycheck-irony-setup)) + +(add-hook 'irony-mode-hook 'irony-cdb-autosetup-compile-options) + +;; Add irony-, flycheck-, company-mode to c-mode +(add-hook 'c-mode-hook 'irony-mode) +(add-hook 'c-mode-hook 'flycheck-mode) +(add-hook 'c-mode-hook 'company-mode) + +;; Set tab to autocomplete or indent depending on context +(global-set-key (kbd "") 'company-indent-or-complete-common) (provide 'setup-autocompletion) diff --git a/custom/setup-editing.el b/custom/setup-editing.el index d5a3e27..ccbca5d 100644 --- a/custom/setup-editing.el +++ b/custom/setup-editing.el @@ -1,4 +1,4 @@ - (setq global-mark-ring-max 5000 ; increase mark ring to contains 5000 entries +(setq global-mark-ring-max 5000 ; increase mark ring to contains 5000 entries mark-ring-max 5000 ; increase kill ring to contains 5000 entries mode-require-final-newline t ; add a newline to end of file ) diff --git a/init.el b/init.el index c69868b..b7729b7 100644 --- a/init.el +++ b/init.el @@ -46,6 +46,9 @@ yasnippet sr-speedbar company + irony + company-irony + flycheck-irony helm helm-gtags helm-swoop @@ -97,7 +100,7 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. - '(package-selected-packages (quote (helm-swoop helm)))) + '(package-selected-packages (quote (irony helm-swoop helm)))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful.