about summary refs log tree commit diff
path: root/users/aspen/emacs.d/cpp.el
blob: 6068736eca47ccd57594c0b4dfea78681b7728fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
;;; -*- lexical-binding: t; -*-


(load! "google-c-style")

(after! flycheck
  (add-to-list 'flycheck-disabled-checkers 'c/c++-gcc)
  (add-to-list 'flycheck-disabled-checkers 'c/c++-clang))

(defun +aspen/cpp-setup ()
  (when (s-starts-with?
         "/home/aspen/code/depot/third_party/nix"
         (buffer-file-name))
    (setq lsp-clients-clangd-executable "/home/aspen/code/depot/users/aspen/emacs.d/nix-clangd.sh"
          lsp-clients-clangd-args nil)
    (google-set-c-style)
    (lsp)
    (add-to-list 'flycheck-disabled-checkers 'c/c++-gcc)
    (add-to-list 'flycheck-disabled-checkers 'c/c++-clang)))

(add-hook 'c++-mode-hook #'+aspen/cpp-setup)

(use-package! protobuf-mode)

(use-package! clang-format+
  :config
  (add-hook 'c-mode-common-hook #'clang-format+-mode))

(map!
 (:map c++-mode-map
  :leader
  (:n "/ i" #'counsel-semantic-or-imenu)))

(comment
 (setq
  lsp-clients-clangd-executable
  "/home/aspen/code/depot/third_party/nix/clangd.sh"
  lsp-clients-clangd-args nil)
 )