mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-24 12:00:24 +10:00
Updating dotfiles.
This commit is contained in:
@@ -8,8 +8,9 @@
|
||||
- [[#module-flags][Module Flags]]
|
||||
- [[#plugins][Plugins]]
|
||||
- [[#prerequisites][Prerequisites]]
|
||||
- [[#lsp-servers][LSP servers]]
|
||||
- [[#irony-server][irony-server]]
|
||||
- [[#macos][MacOS]]
|
||||
- [[#macos][macOS]]
|
||||
- [[#arch-linux][Arch Linux]]
|
||||
- [[#opensuse][openSUSE]]
|
||||
- [[#rtags][rtags]]
|
||||
@@ -56,18 +57,36 @@ This module adds support for the C-family of languages: C, C++, and Objective-C.
|
||||
+ [[https://github.com/Andersbakken/rtags][helm-rtags]]
|
||||
|
||||
* Prerequisites
|
||||
This module requires
|
||||
This module's requirements change depending on how you use it.
|
||||
|
||||
+ irony-server
|
||||
+ rtags
|
||||
+ If =+lsp= is enabled, you need one of *clangd v9+* or *ccls*.
|
||||
+ If =+lsp= is *not* enabled, you need *irony-server* and *rtags*.
|
||||
+ Other features in this module depend on:
|
||||
+ (optional) glslangValidator, for GLSL completion in ~glsl-mode~
|
||||
+ (optional) cmake, for code completion in ~cmake-mode~
|
||||
+ You will need a C/C++ compiler, like =gcc= or =clang=.
|
||||
|
||||
** LSP servers
|
||||
=lsp-mode= and =eglot= support a few LSP servers, but =clangd= and =ccls= are
|
||||
recommended.
|
||||
|
||||
+ clangd (must be v9 or newer) :: Clangd is included with =llvm= which should be
|
||||
available through your OS' package manager.
|
||||
- Debian/Ubuntu: ~sudo apt-get install clangd-9~
|
||||
- macOS: ~brew install llvm~
|
||||
- Windows: install from [[https://releases.llvm.org/download.html][LLVM download page]]
|
||||
- clangd is available on some Linux distros from a =clang-tools= package, if
|
||||
you'd like to avoid the full =llvm=.
|
||||
+ ccls :: Available in many OS' package managers as =ccls=. Otherwise, there are
|
||||
alternative install methods listed [[https://github.com/MaskRay/ccls/wiki/Install][in the project's wiki]].
|
||||
|
||||
** irony-server
|
||||
Irony powers the code completion, eldoc and syntax checking systems.
|
||||
|
||||
After installing its dependencies, run ~M-x irony-install-server~ in Emacs.
|
||||
|
||||
*** MacOS
|
||||
Due to linking issues, MacOS users must compile irony-server manually:
|
||||
*** macOS
|
||||
Due to linking issues, macOS users must compile irony-server manually:
|
||||
|
||||
#+BEGIN_SRC sh
|
||||
brew install cmake
|
||||
@@ -118,12 +137,11 @@ rc -J $PROJECT_ROOT # loads PROJECT_ROOT's compile_commands.json
|
||||
** Project compile settings
|
||||
By default, a set of default compile settings are defined in
|
||||
~+cc-default-compiler-options~ for C, C++ and Objective C. Irony, rtags and
|
||||
flycheck will fall back to these.
|
||||
flycheck will fall back to these. *This variable does nothing for LSP users.*
|
||||
|
||||
To make these tools aware of project specific build settings, you need a JSON
|
||||
[[https://sarcasm.github.io/notes/dev/compilation-database.html#ninja][compilation database]] present (i.e. a ~compile_commands.json~ file).
|
||||
|
||||
There are [[https://sarcasm.github.io/notes/dev/compilation-database.html][many ways to generate one]]. I use [[http://www.cmake.org/][CMake]] or [[https://github.com/rizsotto/Bear][bear]]:
|
||||
For a more universal solution: both LSP servers and irony will recognize a
|
||||
[[https://sarcasm.github.io/notes/dev/compilation-database.html#ninja][compilation database]] (a ~compile_commands.json~ file). There are [[https://sarcasm.github.io/notes/dev/compilation-database.html][many ways to
|
||||
generate one]]. Here is an example using [[http://www.cmake.org/][CMake]] and [[https://github.com/rizsotto/Bear][bear]]:
|
||||
|
||||
#+BEGIN_SRC sh
|
||||
# For CMake projects
|
||||
|
||||
@@ -108,7 +108,12 @@ simpler."
|
||||
(rtags-call-rc :silent t "-J" (or (doom-project-root) default-directory))))
|
||||
;; then irony
|
||||
(when (and (featurep 'irony) irony-mode)
|
||||
(+cc-init-irony-compile-options-h)))
|
||||
(+cc-init-irony-compile-options-h))
|
||||
;; Otherwise, LSP
|
||||
(when (bound-and-true-p lsp-mode)
|
||||
(lsp-workspace-restart))
|
||||
(when (bound-and-true-p eglot-managed-mode)
|
||||
(eglot-reconnect)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +cc/imenu ()
|
||||
|
||||
@@ -51,7 +51,7 @@ This is ignored by ccls.")
|
||||
(set-rotate-patterns! 'c++-mode
|
||||
:symbols '(("public" "protected" "private")
|
||||
("class" "struct")))
|
||||
(set-pretty-symbols! '(c-mode c++-mode)
|
||||
(set-ligatures! '(c-mode c++-mode)
|
||||
;; Functional
|
||||
;; :def "void "
|
||||
;; Types
|
||||
@@ -247,13 +247,13 @@ If rtags or rdm aren't available, fail silently instead of throwing a breaking e
|
||||
`((:ccls . ((:clang . ,(list :extraArgs ["-isystem/Library/Developer/CommandLineTools/usr/include/c++/v1"
|
||||
"-isystem/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"
|
||||
"-isystem/usr/local/include"]
|
||||
:resourceDir (string-trim (shell-command-to-string "clang -print-resource-dir"))))))))))))
|
||||
|
||||
:resourceDir (cdr (doom-call-process "clang" "-print-resource-dir"))))))))))))
|
||||
|
||||
|
||||
(use-package! ccls
|
||||
:when (and (featurep! +lsp) (not (featurep! :tools lsp +eglot)))
|
||||
:after lsp
|
||||
:when (featurep! +lsp)
|
||||
:unless (featurep! :tools lsp +eglot)
|
||||
:after lsp-mode
|
||||
:init
|
||||
(after! projectile
|
||||
(add-to-list 'projectile-globally-ignored-directories ".ccls-cache")
|
||||
@@ -265,4 +265,4 @@ If rtags or rdm aren't available, fail silently instead of throwing a breaking e
|
||||
`(:clang ,(list :extraArgs ["-isystem/Library/Developer/CommandLineTools/usr/include/c++/v1"
|
||||
"-isystem/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"
|
||||
"-isystem/usr/local/include"]
|
||||
:resourceDir (string-trim (shell-command-to-string "clang -print-resource-dir")))))))
|
||||
:resourceDir (cdr (doom-call-process "clang" "-print-resource-dir")))))))
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
(package! cmake-mode
|
||||
:recipe (:host github :repo "emacsmirror/cmake-mode" :files (:defaults "*"))
|
||||
:pin "bfe85bc009c4778b44e246d5c27d0f888f0bfc0c")
|
||||
:pin "e58c41145a879f0314b2821eada7fd0dc898b6b6")
|
||||
(package! cuda-mode :pin "9ae9eacfdba3559b5456342d0d03296290df8ff5")
|
||||
(package! demangle-mode :pin "697c1dbde93f164eac7ea0dc530d7e8b799272d6")
|
||||
(package! disaster :pin "10a785facc60d89d78e0d5177985ab1af1741bb4")
|
||||
@@ -19,15 +19,15 @@
|
||||
(if (featurep! +lsp)
|
||||
(unless (featurep! :tools lsp +eglot)
|
||||
;; ccls package is necessary only for lsp-mode.
|
||||
(package! ccls :pin "b8e2f4d9b5bed5b5e8b387ac8e43eff723120b80"))
|
||||
(when (package! irony :pin "5f75fc0c9274f4622470e2324e2f4457087aa643")
|
||||
(package! ccls :pin "675a5704c14a27931e835a431beea3631d92e8e6"))
|
||||
(when (package! irony :pin "1e1aabaa686a08767ab33e5cd43ce8f0ebf8d020")
|
||||
(package! irony-eldoc :pin "73e79a89fad982a2ba072f2fcc1b4e41f0aa2978")
|
||||
(when (featurep! :checkers syntax)
|
||||
(package! flycheck-irony :pin "42dbecd4a865cabeb301193bb4d660e26ae3befe"))
|
||||
(when (featurep! :completion company)
|
||||
(package! company-irony :pin "b44711dfce445610c1ffaec4951c6ff3882b216a")
|
||||
(package! company-irony-c-headers :pin "72c386aeb079fb261d9ec02e39211272f76bbd97")))
|
||||
(when (package! rtags :pin "080cb0e6b025b5d3d40fe9f7aecc791c0ea53f36")
|
||||
(when (package! rtags :pin "b57b36039f6411f23009c4ec0315ca5a7adb6824")
|
||||
(when (featurep! :completion ivy)
|
||||
(package! ivy-rtags))
|
||||
(when (featurep! :completion helm)
|
||||
|
||||
Reference in New Issue
Block a user