3 ms·
Hi Hendzen, I found in one of your previous comments that you have set up your emacs to have full support for c++ projects, like auto-completion and reference f
by Martinsos 9y ago
Hi Hendzen, I found in one of your previous comments that you have set up your emacs to have full support for c++ projects, like auto-completion and reference following and similar.
I have been using Emacs for a few years now, for js/python/html/C/C++/anything else and have just started working on a larger C++ project where intelligent auto completion and navigation would help a lot. Would you mind providing some more details on how you got it set up, maybe share your init.el file? It is a Cmake project, uses ninja as a generator. Thanks!
- hendzen 9y agoI'm writing less C++ than I used to recently, but here's the basic setup I use: 1) Emacs prelude w/ helm enabled everywhere -https://github.com/bbatsov/prelude https://github.com/bbatsov/prelude 2) Irony-mode for auto completion. Since you're using Cmake, you can just add CMAKE_EXPORT_COMPILE_COMMANDS to your invocation to output the needed metadata for completion to work. - https://github.com/Sarcasm/irony-mode https://github.com/Sarcasm/irony-mode 3) helm-flycheck for syntax checking https://github.com/yasuyk/helm-flycheck https://github.com/yasuyk/helm-flycheck 4) For jump to definition I generally just use helm-ag (grep) , I never actually got this working to my satisfaction despite trying a few things like rtags (slow, unstable) and clang-ctags (promising but annoying to set up at the time). 5) For formatting I usually just enable clang-format on save w/ something like this (requires clang-format mode installed): (add-hook 'c++-mode-hook (lambda () (add-hook 'before-save-hook #'clang-format-buffer nil t)))