-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
grugru-default.el
147 lines (134 loc) · 4.9 KB
/
grugru-default.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
;;; grugru-default.el --- Default setting of grugru -*- lexical-binding: t; -*-
;; Copyright (C) 2020-2021 ROCKTAKEY
;; Author: ROCKTAKEY <[email protected]>
;; Keywords: tools
;; URL: https://github.com/ROCKTAKEY/grugru
;; 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
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Define default setupper.
;;; Code:
(require 'grugru)
(require 'grugru-utils)
(defun grugru-default@emacs-lisp+nth!aref (str &optional _)
"Return STR exchanged `nth' and `aref' with argument permutation."
(cond
((string-match "^(\\_<\\(nth\\)\\_>" str)
(cons
(cons (match-beginning 1) (match-end 1))
(grugru-utils-lisp-exchange-args
(replace-match "aref" nil nil str 1)
'(2 1))))
((string-match "^(\\_<\\(aref\\)\\_>" str)
(cons
(cons (match-beginning 1) (match-end 1))
(grugru-utils-lisp-exchange-args
(replace-match "nth" nil nil str 1)
'(2 1))))))
;;;###autoload
(defun grugru-default-setup ()
"Setup default value.
If some are not confortable, you can remove some of them,
with `grugru-remove-on-major-mode' or `grugru-remove-global'."
(grugru-define-multiple
((c-mode c++-mode)
(non-alphabet "&&" "||")
(non-alphabet "&" "|")
(non-alphabet "+" "-")
(non-alphabet "*" "/" "%")
(non-alphabet ">>" "<<")
(non-alphabet "+=" "-=")
(non-alphabet "*=" "/=" "%=")
(non-alphabet "&=" "|=" "^=")
(non-alphabet ">>=" "<<=")
(non-alphabet "++" "--")
(non-alphabet "==" "!=")
(non-alphabet "<" "<=" ">" ">=")
(symbol "break" "continue")
(symbol "signed" "unsigned"))
(c++-mode
(symbol "true" "false")
(symbol "vector" "array" "deque")
(symbol "class" "struct")
(symbol "float" "double")
(symbol "private" "public" "protected")
(symbol "pair" "tuple")
(symbol "static_cast" "dynamic_cast" "reinterpret_cast" "const_cast"))
(emacs-lisp-mode
(symbol "defun" "cl-defun")
(symbol "defvar" "defcustom" "defconst")
(symbol "add-hook" "remove-hook")
(symbol "setq" "setq-default")
(word "global" "local")
(symbol "assoc" "assq" "alist-get")
(symbol "assoc-delete-all" "assq-delete-all")
(symbol "rassoc" "rassq")
(symbol "member" "memq")
(symbol "delete" "delq")
(symbol "remove" "remq")
(symbol "plist-get" "plist-put")
(symbol "lax-plist-get" "lax-plist-put")
(symbol "car-safe" "cdr-safe")
(list . grugru-default@emacs-lisp+nth!aref))
((emacs-lisp-mode lisp-mode)
(symbol "nil" "t")
(symbol "eq" "equal")
(symbol "let" "let*")
(symbol "if" "when" "unless")
(symbol "car" "cdr")
(symbol "mapc" "mapcar"))
(lisp-mode
(symbol "defvar" "defparameter"))
((tex-mode latex-mode yatex-mode)
(symbol "figure" "table")
(char "^" "_")
(tex-command "\\leq" "\\geq")
(tex-command "\\leqq" "\\geqq")
(tex-command "\\in" "\\ni")
(tex-command "\\subset" "\\supset")
(tex-command "\\coloneqq" "\\eqqcolon")
(tex-command "\\forall" "\\exists")
(tex-command "\\rightarrow" "\\leftarrow")
(tex-command "\\Rightarrow" "\\Leftarrow")
(tex-command "\\epsilon" "\\varepsilon")
(tex-command "\\phi" "\\varphi")
(tex-command "\\sum" "\\prod")
(tex-command "\\dv" "\\pdv")
(tex-command "\\mp" "\\pm"))
(org-mode ;; v9.3.6
(word ":t" ":nil")
(word "overview" "showall")
(word "fold" "unfold" "content" "showeverything")
(word "indent" "noindent")
(word "align" "noalign")
(word "inlineimages" "noinlineimages")
(word "latexpreview" "nolatexpreview")
(word "hideblocks" "showblocks") ;; nohideblocks
(word "odd" "oddeven")
(word "nologrefile" "logrefile" "lognoterefile")
(word "nologdone" "logdone" "lognotedone")
(word "nologreschedule" "logreschedule" "lognotereschedule")
(word "nologredeadline" "logredeadline" "lognoteredeadline")
(word "lognoteclock-out" "nolognoteclock-out")
(word "logdrawer" "nologdrawer")
(word "logstatesreversed" "nologstatesreversed")
(word "nologrepeat" "logrepeat" "lognoterepeat")
(word "hidestars" "showstars")
(word "fninline" "nofninline" "fnlocal")
(word "fnauto" "fnprompt" "fnconfirm" "fnplain") ;; TODO
(word "nofnadjust" "fnadjust")
(word "entitiespretty" "entitiesplain")
(word "title" "author" "email" "date")
;; source block
;; TODO
)))
(provide 'grugru-default)
;;; grugru-default.el ends here