More 2023 C++ environment
Uses clangd as an LSP. Uses clang-format to format code. I may enjoy develop in C++ again.
This commit is contained in:
85
.emacs
85
.emacs
@@ -44,7 +44,7 @@
|
||||
'(org-agenda-files '("~/org/1.TODO.org"))
|
||||
'(package-enable-at-startup nil)
|
||||
'(package-selected-packages
|
||||
'(xterm-color dockerfile-mode web-mode prettier json-mode py-isort blacken pyvenv yaml-mode lsp-pyright ng2-mode lsp-ltex lsp-treemacs treemacs-nerd-icons treemacs-projectile treemacs lsp-ui lsp-mode which-key flycheck vterm projectile yasnippet-snippets yasnippet aggressive-indent doom-themes company-go zenburn-theme langtool smart-tabs-mode typescript-mode protobuf-mode opencl-mode glsl-mode go-mode markdown-mode srefactor irony cmake-mode company magit use-package))
|
||||
'(clang-format+ cmake-format xterm-color dockerfile-mode web-mode prettier json-mode py-isort blacken pyvenv yaml-mode lsp-pyright ng2-mode lsp-ltex lsp-treemacs treemacs-nerd-icons treemacs-projectile treemacs lsp-ui lsp-mode which-key flycheck vterm projectile yasnippet-snippets yasnippet aggressive-indent doom-themes company-go zenburn-theme langtool smart-tabs-mode typescript-mode protobuf-mode opencl-mode glsl-mode go-mode markdown-mode srefactor irony cmake-mode company magit use-package))
|
||||
'(safe-local-variable-values
|
||||
'((vc-follow-symlinks . t)
|
||||
(TeX-master . t)
|
||||
@@ -101,6 +101,7 @@
|
||||
)
|
||||
|
||||
|
||||
|
||||
(use-package doom-modeline
|
||||
:init
|
||||
(doom-modeline-mode 1)
|
||||
@@ -157,16 +158,12 @@
|
||||
|
||||
(use-package xterm-color
|
||||
:config
|
||||
(defun atu/colorize-compilation-buffer ()
|
||||
(font-lock-mode -1)
|
||||
;; Prevent font-locking from being re-enabled in this buffer
|
||||
(make-local-variable 'font-lock-function)
|
||||
(setq font-lock-function (lambda (_) nil))
|
||||
(setq xterm-color-debug t)
|
||||
(add-hook 'comint-preoutput-filter-functions 'xterm-color-filter nil t)
|
||||
)
|
||||
:hook
|
||||
(compilation-filter . atu/colorize-compilation-buffer)
|
||||
(setq compilation-environment '("TERM=xterm-256color"))
|
||||
|
||||
(defun atu/advice-compilation-filter (f proc string)
|
||||
(funcall f proc (xterm-color-filter string)))
|
||||
|
||||
(advice-add 'compilation-filter :around #'atu/advice-compilation-filter)
|
||||
)
|
||||
|
||||
|
||||
@@ -237,12 +234,49 @@
|
||||
)
|
||||
|
||||
(use-package cmake-mode
|
||||
:hook
|
||||
(cmake-mode . lsp-deferred)
|
||||
:ensure-system-package (
|
||||
(cmake . cmake)
|
||||
(pip . python3-pip)
|
||||
(cmake-format . "pip install --user cmakelang[YAML]")
|
||||
)
|
||||
:config
|
||||
(setq cmake-tab-width 4)
|
||||
(defun atu/cmake-format-buffer ()
|
||||
"Formats the current buffer using cmake-format"
|
||||
(interactive)
|
||||
(shell-command-on-region
|
||||
;; region to execute on
|
||||
(point-min)
|
||||
(point-max)
|
||||
;; command
|
||||
"cmake-format -"
|
||||
;; replace
|
||||
t
|
||||
;; name of the error bufer
|
||||
"* cmake-format Error Buffer *"
|
||||
;;
|
||||
t))
|
||||
|
||||
:hook
|
||||
(cmake-mode . lsp-deferred)
|
||||
(cmake-mode . (lambda () (add-hook 'before-save-hook 'atu/cmake-format-buffer nil 'local)))
|
||||
)
|
||||
|
||||
(use-package cc-mode
|
||||
:ensure nil
|
||||
:ensure-system-package
|
||||
(clangd . clangd)
|
||||
:hook
|
||||
(c-mode . lsp-deferred)
|
||||
(c++-mode . lsp-deferred)
|
||||
)
|
||||
|
||||
(use-package clang-format+
|
||||
:ensure-system-package
|
||||
(clang-format . clang-format)
|
||||
:hook
|
||||
(c-mode-common . clang-format+-mode)
|
||||
)
|
||||
|
||||
(use-package yasnippet
|
||||
:delight yas-minor-mode
|
||||
@@ -329,11 +363,11 @@
|
||||
:bind (
|
||||
("C-c C-d" . lsp-ui-doc-toggle)
|
||||
)
|
||||
:hook (
|
||||
(c++-mode . lsp-deferred)
|
||||
(lsp-mode . lsp-enable-which-key-integration)
|
||||
)
|
||||
:commands (lsp lsp-deferred))
|
||||
:hook
|
||||
(lsp-mode . lsp-enable-which-key-integration)
|
||||
:commands
|
||||
(lsp lsp-deferred)
|
||||
)
|
||||
|
||||
(use-package lsp-ui
|
||||
:commands lsp-ui-mode
|
||||
@@ -507,21 +541,6 @@
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.h\\'" . c-c++-header))
|
||||
|
||||
(defconst tuleu-cc-style
|
||||
'("gnu"
|
||||
(c-offsets-alist . ((innamespace . [0])))
|
||||
)
|
||||
)
|
||||
(c-add-style "tuleu-c++" tuleu-cc-style)
|
||||
|
||||
(defun my-c-common-hook ()
|
||||
(smart-tabs-mode)
|
||||
(if (derived-mode-p 'c-mode 'c++-mode)
|
||||
(cppcm-reload-all)
|
||||
)
|
||||
)
|
||||
(add-hook 'c-mode-common-hook 'my-c-common-hook)
|
||||
|
||||
(use-package markdown-mode)
|
||||
|
||||
(use-package go-mode
|
||||
|
||||
Reference in New Issue
Block a user