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>
;; Keywords: local
;; Version: 2020.1210.205244
;; Package-Requires: (oni-flycheck oni-fci)
;; Version: 2020.1212.220101
;; Package-Requires: (oni-flycheck oni-fci oni-lsp reformatter)
;; 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
@ -27,17 +27,25 @@
;;; Code:
(require 'cc-mode)
(require 'reformatter)
(defun oni-c--auto-fill-mode ()
"Enable auto-fill-mode only for comments."
(setq-local comment-auto-fill-only-comments t)
(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 'electric-indent-local-mode)
(add-hook 'c-mode-hook 'electric-pair-local-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-clang-formatter-on-save-mode)
(add-hook 'c-mode-hook
(if (fboundp 'display-fill-column-indicator-mode)