aboutsummaryrefslogtreecommitdiff
path: root/Doom/.config/doom/modules/private/bindings/README.org
blob: 6bc6f6823169073d9d886d54b8b8be139215d038 (plain)
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#+TITLE: private/bindings Literate configuration

* Introduction
This is the main document for this module (=private/bindings=).
To compile, simply execute the source code block below
#+BEGIN_SRC elisp :tangle no
(org-babel-tangle-file "README.org" "config.el")
#+END_SRC
* Initial
Set the localleader to "SPC ,"
#+BEGIN_SRC elisp
;;; private/bindings/config.el -*- lexical-binding: t; -*-
(setq doom-leader-key "SPC")
(setq doom-localleader-key "SPC ,")
#+END_SRC
* Leader
Bindings for the leader map
** Single binds
These are immediate bindings to the leader map that instantly launch functions when pressed.
This binding space is reserved for stuff I use quite often.
#+BEGIN_SRC elisp
(map!
 :leader
 "SPC" #'execute-extended-command
 "!"   #'async-shell-command
 "T"   #'eshell
 "C"   #'calc
 "-"   #'dired-jump
 "_"   #'dired-jump-other-window
 ";"   #'eval-expression
 "h"   #'help-command
 "w"   #'ace-window)
#+END_SRC
** Files
#+BEGIN_SRC elisp
(map!
 :leader
 :prefix "f"
 "r"  #'recentf-open-files
 (:after projectile
  "p"  #'(lambda () (interactive) (doom-project-find-file "~/Dotfiles")))
 "f"  #'find-file
 "s"  #'save-buffer
 "d"  #'dired)
#+END_SRC
** Buffers
#+BEGIN_SRC elisp
(map!
 :leader
 :prefix "b"
 "n" #'next-buffer
 "p" #'previous-buffer
 "d" #'kill-current-buffer
 "b" #'switch-to-buffer
 "i" #'ibuffer)
#+END_SRC
** Search
#+BEGIN_SRC elisp
(map!
 :leader
 :prefix "s"
 "i"  #'imenu
 "o"  #'+lookup/online
 (:after counsel
  "s" #'swiper
  "r" #'counsel-rg)
 (:after counsel-etags
  "t" #'counsel-etags-find-tag))
#+END_SRC
** Projectile
#+BEGIN_SRC elisp
(map!
 :leader
 :after projectile
 ">"  #'projectile-switch-to-buffer
 (:prefix ("p" . "project")
  "p" #'projectile-switch-project
  "g" #'projectile-regenerate-tags
  "f" #'projectile-find-file
  "i" #'projectile-invalidate-cache))
#+END_SRC
** Code
#+BEGIN_SRC elisp
(map!
 :leader
 :prefix ("c" . "code") ; Code
 :desc "Compile"            "c"       #'compile
 :desc "Compile via make"   "m"       #'+make/run
 :desc "Flycheck"           "v"       #'flycheck-list-errors
 :desc "Undo tree"          "u"       #'undo-tree-visualize
 (:after lsp
  :desc "Format code lsp"   "f"       #'+default/lsp-format-region-or-buffer
  :desc "Execute action"    "a"       #'lsp-execute-code-action))
#+END_SRC
** Magit and VC
#+BEGIN_SRC elisp
(map!
 :leader
 :after magit
 :prefix "g"
 "g" #'magit-status
 "c" #'magit-clone
 "f" #'magit-fetch
 "p" #'magit-pull)
#+END_SRC
** Notes
#+BEGIN_SRC elisp
(map!
 :leader
 :prefix ("n" . "notes")
 :desc  "Open notes in dired" "-"  #'(lambda () (interactive) (dired org-directory))
 :desc  "Open quicknotes"     "q"  #'(lambda () (interactive) (find-file (format "%s/qnotes.org" org-directory))))
#+END_SRC
** Frames
#+BEGIN_SRC elisp
(map!
 :leader
 :prefix "F"
 "d" #'delete-frame)
#+END_SRC
** Toggle
Bindings that usually toggle stuff based bindings
#+BEGIN_SRC elisp
(map!
 :leader
 :prefix "t"
 "s" #'flyspell-mode
 "f" #'flycheck-mode
 "t" #'toggle-truncate-lines
 "l" #'doom/toggle-line-numbers
 "F" #'toggle-frame-fullscreen)
#+END_SRC
** Quit
Quit Emacs or restart it
#+BEGIN_SRC elisp
(map!
 :leader
 :prefix "q"
 "q" #'save-buffers-kill-terminal
 "r" #'doom/restart)
#+END_SRC
* Ivy
Bindings for ivy based functions
#+BEGIN_SRC elisp
(map!
 :after ivy
 :map ivy-minibuffer-map
 "C-j" #'ivy-next-line-or-history
 "C-k" #'ivy-previous-line-or-history)
#+END_SRC
* Company
#+BEGIN_SRC elisp
(map!
 :i "C-SPC" #'company-complete-common
 :map company-active-map
 "C-j"   #'company-select-next-or-abort
 "C-k"   #'company-select-previous-or-abort)
#+END_SRC
* Multi cursors
Setup bindings for multi cursors.
As it's a motion based system, use the "gz" namespace.
#+BEGIN_SRC elisp
(map!
 :after evil
 :m "gzm" #'evil-mc-resume-cursors
 :m "gzp" #'evil-mc-pause-cursors
 :m "gzd" #'evil-mc-make-all-cursors
 :m "gzj" #'evil-mc-make-cursor-move-next-line
 :m "gzk" #'evil-mc-make-cursor-move-prev-line
 :m "gzz" #'evil-mc-make-cursor-here)
#+END_SRC
* Remaps
Remap certain functions to more useful counterparts
#+BEGIN_SRC elisp
(after! org
  (define-key!
    [remap org-goto] #'imenu))
#+END_SRC
* Misc
Misc bindings that don't fit to any other category.
#+BEGIN_SRC elisp
(map!
 "C-x C-z" #'text-scale-adjust
 (:after evil
  "TAB" #'evil-jump-item)
 "M-c" #'count-words-region
 "M-s" #'occur)
#+END_SRC