1
0
Fork 0

Add abbrevs to C, Java, and C# modes

This commit is contained in:
Tom Willemse 2020-12-10 20:52:52 -08:00
parent 70e2eb93c4
commit 0f22bb9729
3 changed files with 18 additions and 4 deletions

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; Version: 2020.0907.143822
;; Version: 2020.1210.205244
;; Package-Requires: (oni-flycheck oni-fci)
;; This program is free software; you can redistribute it and/or modify
@ -26,13 +26,16 @@
;;; Code:
(require 'cc-mode)
(defun oni-c--auto-fill-mode ()
"Enable auto-fill-mode only for comments."
(setq-local comment-auto-fill-only-comments t)
(auto-fill-mode))
(add-hook 'c-mode-hook 'electric-pair-local-mode)
(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 'oni-c--auto-fill-mode)
@ -41,6 +44,9 @@
'display-fill-column-indicator-mode
'fci-mode))
(define-abbrev c-mode-abbrev-table "and" "&&")
(define-abbrev c-mode-abbrev-table "or" "||")
;;;###autoload(with-eval-after-load 'cc-mode (require 'oni-c))
(provide 'oni-c)

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; Version: 2020.0907.151110
;; Version: 2020.1210.205218
;; Package-Requires: (csharp-mode oni-company oni-flycheck oni-yasnippet oni-hydra oni-fci oni-lsp smartparens)
;; This program is free software; you can redistribute it and/or modify
@ -142,6 +142,7 @@ _cs_: Solution
"Set style rules according to personal (or recommended) preference."
(setf (alist-get 'arglist-intro c-offsets-alist) '+))
(add-hook 'csharp-mode-hook 'abbrev-mode)
(add-hook 'csharp-mode-hook 'company-mode)
(add-hook 'csharp-mode-hook 'electric-indent-local-mode)
(add-hook 'csharp-mode-hook 'flycheck-mode)
@ -158,6 +159,9 @@ _cs_: Solution
(define-key csharp-mode-map (kbd "C-c SPC") 'oni-csharp-hydra/body)
(define-abbrev csharp-mode-abbrev-table "and" "&&")
(define-abbrev csharp-mode-abbrev-table "or" "||")
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.xaml\\'" . nxml-mode))

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
;; Version: 2020.1030.182339
;; Version: 2020.1210.205100
;; Package-Requires: (oni-fci oni-data-dir oni-lsp oni-hydra lsp-java)
;; This program is free software; you can redistribute it and/or modify
@ -69,6 +69,7 @@
(add-hook 'java-mode-hook #'oni-java-enable-buffer-formatting)
(add-hook 'java-mode-hook #'oni-java-only-fill-comments)
(add-hook 'java-mode-hook 'abbrev-mode)
(add-hook 'java-mode-hook 'auto-fill-mode)
(add-hook 'java-mode-hook 'electric-indent-local-mode)
(add-hook 'java-mode-hook 'electric-pair-local-mode)
@ -82,6 +83,9 @@
(define-key java-mode-map (kbd "C-c r") 'java-refactor-hydra/body)
(define-key java-mode-map (kbd "C-c d") 'java-documentation-hydra/body)
(define-abbrev java-mode-abbrev-table "and" "&&")
(define-abbrev java-mode-abbrev-table "or" "||")
(add-to-list 'auto-insert-alist
'("\\.java\\'"
() "public class "