added c-mode config with LSP support, and added flymake to sh-mode

This commit is contained in:
2024-07-01 20:07:01 +02:00
parent c16659037c
commit 47eb117e9f
4 changed files with 25 additions and 6 deletions

20
lisp/init-c.el Normal file
View File

@@ -0,0 +1,20 @@
;; *** C
(use-package c-mode
:ensure nil ;; installed in site-lisp
:defer nil
:init
(when (fboundp 'lsp-deferred)
(defun lsp-c-install-save-hooks ()
(add-hook 'before-save-hook #'lsp-format-buffer t t)
(add-hook 'before-save-hook #'lsp-organize-imports t t))
(add-hook 'c-mode-hook #'lsp-deferred)
(add-hook 'c-mode-hook #'lsp-c-install-save-hooks)
;; c-mode sets TAB to 'c-indent-line-or-region by default which collides with corfu.
(add-hook 'c-mode-hook (lambda () (define-key c-mode-map (kbd "<tab>") #'indent-for-tab-command)))))
(provide 'init-c)
;;; init-c.el ends here