1
0
Fork 0

Add reformatter and lsp to my C configuration

This commit is contained in:
Tom Willemse 2020-12-12 21:36:53 -08:00
parent 0b7c98baf1
commit 44037781b1

View file

@ -4,8 +4,8 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 2020.1210.205244 ;; Version: 2020.1212.220101
;; Package-Requires: (oni-flycheck oni-fci) ;; Package-Requires: (oni-flycheck oni-fci oni-lsp reformatter)
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by ;; it under the terms of the GNU General Public License as published by
@ -27,17 +27,25 @@
;;; Code: ;;; Code:
(require 'cc-mode) (require 'cc-mode)
(require 'reformatter)
(defun oni-c--auto-fill-mode () (defun oni-c--auto-fill-mode ()
"Enable auto-fill-mode only for comments." "Enable auto-fill-mode only for comments."
(setq-local comment-auto-fill-only-comments t) (setq-local comment-auto-fill-only-comments t)
(auto-fill-mode)) (auto-fill-mode))
(reformatter-define oni-c-clang-formatter
:program "clang-format"
:lighter ""
:group 'oni-c)
(add-hook 'c-mode-hook 'abbrev-mode) (add-hook 'c-mode-hook 'abbrev-mode)
(add-hook 'c-mode-hook 'electric-indent-local-mode) (add-hook 'c-mode-hook 'electric-indent-local-mode)
(add-hook 'c-mode-hook 'electric-pair-local-mode) (add-hook 'c-mode-hook 'electric-pair-local-mode)
(add-hook 'c-mode-hook 'flycheck-mode) (add-hook 'c-mode-hook 'flycheck-mode)
(add-hook 'c-mode-hook 'lsp)
(add-hook 'c-mode-hook 'oni-c--auto-fill-mode) (add-hook 'c-mode-hook 'oni-c--auto-fill-mode)
(add-hook 'c-mode-hook 'oni-c-clang-formatter-on-save-mode)
(add-hook 'c-mode-hook (add-hook 'c-mode-hook
(if (fboundp 'display-fill-column-indicator-mode) (if (fboundp 'display-fill-column-indicator-mode)