diff options
| author | Joel Klinghed <the_jk@yahoo.com> | 2017-10-12 21:47:05 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@yahoo.com> | 2017-10-12 21:47:26 +0200 |
| commit | b5557b1407eac12a050bb19f9c82a81cc3a22eef (patch) | |
| tree | 607395722c084dac3baf57aec1e60c077753d432 | |
| parent | 6e08a69d34fb37192f12f9204e2d536035e0cd5c (diff) | |
Add You Complete Me code completion
| -rw-r--r-- | emacs-willow | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/emacs-willow b/emacs-willow index 71386de..8ce5647 100644 --- a/emacs-willow +++ b/emacs-willow @@ -12,7 +12,7 @@ '("melpa" . "https://melpa.org/packages/")) (package-initialize) (setq - package-selected-packages '(meson-mode groovy-mode gradle-mode flycheck)) + package-selected-packages '(meson-mode groovy-mode gradle-mode flycheck-ycmd company-ycmd)) ;; use (package-install-selected-packages) to install the ones above ;; show matching parentheses (and other characters) @@ -212,6 +212,37 @@ (require 'flycheck) (global-flycheck-mode) +;; code completion + +;; ycmd setup +;; # git clone https://github.com/Valloric/ycmd.git +;; # cd ycmd +;; # git submodule update --init --recursive +;; # ./build.py --system-libclang --clang-completer +;; # mkdir -p ~/.emacs.d/ycmd/third_party +;; # cp -r {ycmd,ycm_core.so,CORE_VERSION,cpp,clang_includes} ~/.emacs.d/ycmd/ +;; # cp -r third_party/{argparse,bottle,frozendict,JediHTTP,python-future,requests,waitress} ~/.emacs.d/ycmd/third_party/ + +(set-variable 'ycmd-server-command `("python3" ,(file-truename "~/.emacs.d/ycmd/ycmd/"))) +(set-variable 'ycmd-extra-conf-whitelist '("~/source/*")) +(require 'ycmd) +(add-hook 'after-init-hook #'global-ycmd-mode) + +(require 'company-ycmd) +(company-ycmd-setup) +(add-hook 'after-init-hook 'global-company-mode) + +(require 'flycheck-ycmd) +(flycheck-ycmd-setup) + +(add-hook 'python-mode-hook (lambda () (add-to-list 'flycheck-disabled-checkers 'ycmd))) +(add-hook 'java-mode-hook (lambda () (add-to-list 'flycheck-disabled-checkers 'ycmd))) + +;; disable flycheck indicatoion in terminal mode as it will conflict with +;; company +(when (not (display-graphic-p)) + (setq flycheck-indication-mode nil)) + (c-add-style "common c" '("gnu" @@ -241,36 +272,7 @@ flycheck-clang-definitions '("HAVE_CONFIG_H") flycheck-clang-include-path '("../src" "../build")) - (c-set-style "default c++") - (when (and buffer-file-name - (string-match "/source/monmon/" buffer-file-name)) - (setq flycheck-clang-include-path - '("../src" "../build" - "/usr/include/cairo" - "/usr/include/pango-1.0" - "/usr/include/pixman-1" - "/usr/include/freetype2" - "/usr/include/libpng16" - "/usr/include/harfbuzz" - "/usr/include/glib-2.0" - "/usr/lib/glib-2.0/include" - "/usr/lib/icecream/include"))) - (when (and buffer-file-name - (string-match "/source/sawmill-0.5/" buffer-file-name)) - (setq flycheck-clang-include-path - '("../src" "../build" - "/usr/include/librsvg-2.0" - "/usr/include/gdk-pixbuf-2.0" - "/usr/include/cairo" - "/usr/include/pixman-1" - "/usr/include/freetype2" - "/usr/include/libpng16" - "/usr/include/harfbuzz" - "/usr/include/glib-2.0" - "/usr/lib/glib-2.0/include" - "../subprojects/googletest-release-1.8.0/googletest/include" - "../subprojects/googletest-release-1.8.0/googlemock/include" - ))))) + (c-set-style "default c++"))) ;; Opera Java hook (add-hook 'java-mode-hook |
