Compact Emacs C-lang configuration
This commit is contained in:
@@ -3,7 +3,6 @@
|
|||||||
(use-package ibuffer
|
(use-package ibuffer
|
||||||
:ensure t)
|
:ensure t)
|
||||||
|
|
||||||
|
|
||||||
(use-package ibuffer-tramp
|
(use-package ibuffer-tramp
|
||||||
:ensure t)
|
:ensure t)
|
||||||
|
|
||||||
|
|||||||
@@ -4,19 +4,6 @@
|
|||||||
(setq tab-stop-list nil)
|
(setq tab-stop-list nil)
|
||||||
(setq indent-tabs-mode nil)
|
(setq indent-tabs-mode nil)
|
||||||
|
|
||||||
;; C / C++ fallback style (Linux-like)
|
|
||||||
(setq c-default-style "linux"
|
|
||||||
c-basic-offset 4
|
|
||||||
tab-width 8)
|
|
||||||
|
|
||||||
(add-hook 'c-mode-common-hook
|
|
||||||
(lambda ()
|
|
||||||
(setq indent-tabs-mode t)))
|
|
||||||
|
|
||||||
;; Tree-sitter C/C++
|
|
||||||
(setq c-ts-mode-indent-offset 4)
|
|
||||||
(setq c++-ts-mode-indent-offset 4)
|
|
||||||
|
|
||||||
;; Setting variables
|
;; Setting variables
|
||||||
(setq vc-follow-symlinks 't)
|
(setq vc-follow-symlinks 't)
|
||||||
(prefer-coding-system 'utf-8-unix)
|
(prefer-coding-system 'utf-8-unix)
|
||||||
|
|||||||
@@ -1,2 +1,39 @@
|
|||||||
|
;; c.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;; C / C++ fallback style (Linux-like)
|
||||||
|
(setq c-default-style "linux"
|
||||||
|
c-basic-offset 4
|
||||||
|
tab-width 8)
|
||||||
|
|
||||||
|
(add-hook 'c-mode-common-hook
|
||||||
|
(lambda ()
|
||||||
|
(setq indent-tabs-mode t)))
|
||||||
|
|
||||||
|
;; Tree-sitter C/C++
|
||||||
|
(setq c-ts-mode-indent-offset 4)
|
||||||
|
(setq c++-ts-mode-indent-offset 4)
|
||||||
|
|
||||||
|
(with-eval-after-load 'lsp
|
||||||
|
;; Clangd configurations
|
||||||
|
(setq lsp-clients-clangd-args
|
||||||
|
'("--background-index"
|
||||||
|
"--clang-tidy"
|
||||||
|
"--completion-style=detailed"
|
||||||
|
"--header-insertion=never"
|
||||||
|
"--header-insertion-decorators"
|
||||||
|
"--pch-storage=memory"
|
||||||
|
"--log=error"
|
||||||
|
"--ranking-model=heuristics"
|
||||||
|
"--malloc-trim"
|
||||||
|
"--limit-results=500"
|
||||||
|
"--limit-references=2000")))
|
||||||
|
|
||||||
|
(with-eval-after-load 'dap-mode
|
||||||
|
(require 'dap-cpptools))
|
||||||
|
|
||||||
(add-hook 'c-ts-mode-hook #'fscotto/disable-c-formatting)
|
(add-hook 'c-ts-mode-hook #'fscotto/disable-c-formatting)
|
||||||
(add-hook 'c-mode-hook #'fscotto/disable-c-formatting)
|
(add-hook 'c-mode-hook #'fscotto/disable-c-formatting)
|
||||||
|
|
||||||
|
(provide 'c)
|
||||||
|
|
||||||
|
;;; c.el ends here
|
||||||
|
|||||||
@@ -19,8 +19,6 @@
|
|||||||
(dap-ui-repl . ((side . bottom) (slot . 1) (window-height . 0.25)))
|
(dap-ui-repl . ((side . bottom) (slot . 1) (window-height . 0.25)))
|
||||||
(dap-ui-console . ((side . bottom) (slot . 2) (window-height . 0.25)))))
|
(dap-ui-console . ((side . bottom) (slot . 2) (window-height . 0.25)))))
|
||||||
;; Loading DAP adapters
|
;; Loading DAP adapters
|
||||||
;; For C/C++
|
|
||||||
(require 'dap-cpptools)
|
|
||||||
;; For Python
|
;; For Python
|
||||||
(require 'dap-python)
|
(require 'dap-python)
|
||||||
(setq dap-python-debugger 'debugpy))
|
(setq dap-python-debugger 'debugpy))
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
;;; lsp.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(use-package lsp-mode
|
(use-package lsp-mode
|
||||||
:ensure t
|
:ensure t
|
||||||
:commands (lsp lsp-deferred)
|
:commands (lsp lsp-deferred)
|
||||||
@@ -13,8 +15,8 @@
|
|||||||
:config
|
:config
|
||||||
;; Performance
|
;; Performance
|
||||||
(setq lsp-enable-symbol-highlighting t
|
(setq lsp-enable-symbol-highlighting t
|
||||||
lsp-enable-snippet t
|
lsp-enable-snippet t
|
||||||
lsp-log-io nil
|
lsp-log-io nil
|
||||||
lsp-modeline-code-actions-enable nil
|
lsp-modeline-code-actions-enable nil
|
||||||
lsp-modeline-diagnostics-enable nil
|
lsp-modeline-diagnostics-enable nil
|
||||||
lsp-signature-auto-activate nil
|
lsp-signature-auto-activate nil
|
||||||
@@ -25,20 +27,7 @@
|
|||||||
lsp-enable-indentation nil
|
lsp-enable-indentation nil
|
||||||
;; Disable for huge projects
|
;; Disable for huge projects
|
||||||
lsp-enable-file-watchers nil
|
lsp-enable-file-watchers nil
|
||||||
lsp-idle-delay 0.5)
|
lsp-idle-delay 0.5))
|
||||||
;; Clangd configurations
|
|
||||||
(setq lsp-clients-clangd-args
|
|
||||||
'("--background-index"
|
|
||||||
"--clang-tidy"
|
|
||||||
"--completion-style=detailed"
|
|
||||||
"--header-insertion=never"
|
|
||||||
"--header-insertion-decorators"
|
|
||||||
"--pch-storage=memory"
|
|
||||||
"--log=error"
|
|
||||||
"--ranking-model=heuristics"
|
|
||||||
"--malloc-trim"
|
|
||||||
"--limit-results=500"
|
|
||||||
"--limit-references=2000")))
|
|
||||||
|
|
||||||
(use-package lsp-ui
|
(use-package lsp-ui
|
||||||
:ensure t
|
:ensure t
|
||||||
|
|||||||
Reference in New Issue
Block a user