This repository has been archived by the owner on May 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinit.el
2376 lines (1908 loc) · 65.7 KB
/
init.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
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;; init.el --- GNU Emacs Setup by Eric James Michael Ritz
;;
;;; Commentary:
;;
;; My personal GNU Emacs configuration.
;;
;;; Code:
(server-start)
;;; Package Support and Themes
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(package-initialize)
(eval-when-compile
(require 'use-package))
(require 'bind-key)
(require 'diminish)
(setq use-package-always-ensure t)
(setq use-package-enable-imenu-support t)
;;; TODO: Ideally I would like to have (package-menu-execute t) at the
;;; end of this but it simply does not work.
(defun ejmr-update-available-packages ()
"Open the list of packages and mark all available for update."
(interactive)
(package-list-packages)
(package-menu-mark-upgrades))
(defun ejmr-local-package-directory (name &optional root-dir)
"Return directories in ROOT-DIR that contain package NAME.
Ideally this function should always return a list of one element,
i.e. the one directory that contains the requested package."
(let ((root-dir (or root-dir package-user-dir (error "No package directory"))))
(when (and (f-directory-p root-dir)
(f-readable-p root-dir))
(f-directories (f-full root-dir)
#'(lambda (dir)
(s-matches? (concat "/" name "-[0-9]+\\.[0-9]+") dir))))))
(eval-and-compile
(defun ejmr-get-local-load-path-for (name)
"Returns the local directory containing the package NAME."
(interactive)
(let ((root-dir "/home/eric/.emacs.d/local/"))
(concat root-dir name))))
;;; TODO: Setup a local mirror of the Emacs Wiki.
;;; https://emacsmirror.net/manual/epkg/Installation.html#Installation
(use-package epkg :disabled t)
(use-package theme-looper
:disabled t
:defer nil
:config
(bind-key "l" (defhydra hydra-theme-loop (:color amaranth)
"Themes"
("n" theme-looper-enable-next-theme "Next")
("e" (lambda ()
(interactive)
(theme-looper-enable-theme (car custom-enabled-themes)))
"Enable" :color blue)
("r" theme-looper-enable-random-theme "Random")
("q" nil "quit" :color blue))
ejmr-hydra-map))
;;; Initialization and Splash Screen
(progn
(let ((file-name-handler-alist nil))
"~/.emacs.d/init.elc")
(defun ejmr-compile-and-load-config ()
"Compiles my `init.el' file and loads it."
(interactive)
(find-file-noselect "/home/eric/.emacs.d/init.el")
(byte-compile-file "/home/eric/.emacs.d/init.el" t))
(bind-key "s-i" #'ejmr-compile-and-load-config))
(use-package dashboard :disabled t)
(use-package recover-buffers :disabled t)
;;; Global Custom Keymap Prefixes
;;;
;;; This page defines keymaps which I use throughout for a lot of my
;;; custom key-bindings. It is important to create these keymaps as
;;; soon as possible so that the rest of the configuration can use
;;; them. Therefore, this page should always come early.
;;; This key-map variable is an alias for `C-c`.
(defvaralias 'ejmr-custom-bindings-map 'mode-specific-map)
;;; `C-c h` is specifically for (most) hydra.
(bind-key "h" (define-prefix-command 'ejmr-hydra-map) ejmr-custom-bindings-map)
;;; `s-x` maps to individual commands, rarely modes or toggles.
(bind-key "s-x" (define-prefix-command 'ejmr-command-shortcut-map))
;;; `s-x s-w` is for packages which use web services.
(bind-key "s-w" (define-prefix-command 'ejmr-web-service-map) ejmr-command-shortcut-map)
;;; Global Key Shortcuts
(use-package schrute
:diminish schrute-mode
:config
(use-package bln-mode
:commands (bln-forward-half bln-backward-half)
:config
(bind-key "s-[" #'bln-backward-half)
(bind-key "s-]" #'bln-forward-half))
(setq schrute-command-repetitions 10)
(setq schrute-shortcuts-commands
'((avy-goto-line . (next-line previous-line))
(avy-goto-word-1 . (backward-char forward-char))
(kill-buffer . (kill-or-bury-alive))
;; (scroll-down-command . )
;; (screll-up-command . )
(delete-char . (avy-zap-to-char-dwim))
(forward-char . (bln-forward-half))
(backward-char . (bln-backward-half))
(comment-region . (comment-dwim-2))
(isearch . (swiper))
(find-file . (counsel-recentf))
(zap-char . (avy-zap-up-to-char-dwim))))
(schrute-mode 1))
;;; Global Minor Modes
(use-package auto-minor-mode :disabled t)
(transient-mark-mode t)
(progn
(show-paren-mode t)
(setq-default show-paren-style 'mixed))
(menu-bar-mode -1)
(scroll-bar-mode -1)
(which-function-mode t)
(global-auto-revert-mode t)
(diminish 'auto-revert-mode)
(electric-indent-mode t)
(electric-pair-mode t)
(column-number-mode t)
(tool-bar-mode -1)
(global-prettify-symbols-mode t)
(global-hl-line-mode t)
(pending-delete-mode t)
;;; Global Variables
(setq backup-inhibited t)
(setq make-backup-files nil)
(setq auto-save-default nil)
(setq byte-compile-warnings nil)
(setq ejmr-dvorak-keys (list ?a ?o ?e ?u ?h ?t ?n ?s))
;;; Global Registers
(defun ejmr-edit-registers ()
"Call `refine' on the `register-alist' variable.
This command allows for easier editing of registers, including
killing registers which I no longer need, by using the `refine'
command. This function is a shortcut for `M-x refine <RET>
register-alist'."
(interactive)
(refine 'register-alist))
(bind-key "C-x r e" #'ejmr-edit-registers)
(set-register ?i '(file . "/home/eric/.emacs.d/init.el"))
(set-register ?g '(file . "/home/eric/.gitconfig"))
(set-register ?\C-f '(file . "/home/eric/.config/fish/"))
(set-register ?s '(file . "/tmp/Sudden-Thoughts.org"))
(set-register ?n '(file . "/home/eric/Documents/Notes.org"))
(set-register ?c '(file . "/home/eric/.conkerorrc/"))
(set-register ?u '(file . "/home/eric/.conkerorrc/saved-buffers.txt"))
(set-register ?p '(file . "/media/eric/ejmr-fillip1/Projects"))
;;; Global Utilities
(use-package try :disabled t)
(use-package snoopy
:load-path (lambda () (ejmr-get-local-load-path-for "snoopy-mode"))
:commands snoopy-mode
:bind ("s-s" . snoopy-mode))
(use-package neotree
:commands neotree-toggle
:bind (:map ejmr-command-shortcut-map ("n" . neotree-toggle))
:config (setq neo-theme 'state))
(use-package vlf)
(use-package general :disabled t)
(use-package direnv :disabled t)
(use-package rpn-calc)
(use-package kill-or-bury-alive
:config
(key-seq-define-global "ZK" #'kill-or-bury-alive)
(key-seq-define-global "ZP" #'kill-or-bury-alive-purge-buffers))
(use-package refine)
(use-package restart-emacs)
(use-package zone :disabled t)
(use-package tldr :disabled t)
(use-package fn)
(use-package find-temp-file
:bind (:map ejmr-command-shortcut-map ("f" . find-temp-file)))
(use-package editorconfig
:diminish editorconfig-mode
:config
(editorconfig-mode t)
(use-package editorconfig-custom-majormode
:config
(add-hook 'editorconfig-custom-hooks 'editorconfig-custom-majormode)))
;;; TODO: Remove `selected' in favor of this and copy its
;;; functionality into this mode? And while I'm at in, remove
;;; key-seq? Maybe just go nuts cleaning house.
(use-package composable
:diminish composable-mode
:config
(bind-key "x" 'er/expand-region composable-object-mode-map)
(composable-mode t)
(composable-mark-mode t))
(use-package caps-lock
:bind (:map ejmr-custom-bindings-map ("l" . caps-lock-mode)))
(use-package tomatinho
:bind (:map ejmr-command-shortcut-map ("o" . tomatinho)))
(use-package linum
:diminish 'linum-mode
:config
(use-package linum-relative
:diminish 'linum-relative-mode
:bind (:map ejmr-custom-bindings-map ("n" . linum-relative-global-mode))))
(use-package qwe
:disabled t
:load-path ("/home/eric/.emacs.d/local/qwe-0.9.5/src"
"/home/eric/.emacs.d/local/qwe-0.9.5/ext"))
;;; Buffer Management
(use-package midnight :defer nil)
(use-package buffer-manage :disabled t)
(use-package related
:bind (("s-<right>" . related-switch-forward)
("s-<left>" . related-switch-backward)))
(defhydra hydra-buffer-menu (:color pink :hint nil)
"
^Mark^ ^Unmark^ ^Actions^ ^Search
^^^^^^^^----------------------------------------------------------------- (__)
_m_: mark _u_: unmark _x_: execute _R_: re-isearch (oo)
_s_: save _U_: unmark up _b_: bury _I_: isearch /------\\/
_d_: delete ^ ^ _g_: refresh _O_: multi-occur / | ||
_D_: delete up ^ ^ _T_: files only: % -28`Buffer-menu-files-only^^ * /\\---/\\
_~_: modified ^ ^ ^ ^ ^^ ~~ ~~
"
("m" Buffer-menu-mark)
("u" Buffer-menu-unmark)
("U" Buffer-menu-backup-unmark)
("d" Buffer-menu-delete)
("D" Buffer-menu-delete-backwards)
("s" Buffer-menu-save)
("~" Buffer-menu-not-modified)
("x" Buffer-menu-execute)
("b" Buffer-menu-bury)
("g" revert-buffer)
("T" Buffer-menu-toggle-files-only)
("O" Buffer-menu-multi-occur :color blue)
("I" Buffer-menu-isearch-buffers :color blue)
("R" Buffer-menu-isearch-buffers-regexp :color blue)
("c" nil "cancel")
("v" Buffer-menu-select "select" :color blue)
("o" Buffer-menu-other-window "other-window" :color blue)
("q" quit-window "quit" :color blue))
(bind-key "." #'hydra-buffer-menu/body Buffer-menu-mode-map)
(use-package auto-dim-other-buffers :disabled t)
(use-package inherit-local
:commands (inherit-local-permanent))
(use-package iflipb
:disabled t
:bind (("s-b" . iflipb-next-buffer)
("C-s-b" . iflipb-previous-buffer)))
;;; Mode Line
(use-package anzu
:diminish anzu-mode
:bind ("s-%" . anzu-replace-at-cursor-thing)
:config
(global-anzu-mode t)
(global-set-key [remap query-replace] #'anzu-query-replace)
(global-set-key [remap query-replace-regexp] #'anzu-query-replace-regexp))
;;; Minibuffer
(use-package amx
:defer nil
:load-path (lambda () (ejmr-get-local-load-path-for "amx"))
:bind ("M-s-x" . amx-major-mode-commands)
:config (amx-mode t))
(use-package historian
:config
(use-package ivy-historian
:config (ivy-historian-mode t)))
(use-package quickref
:diminish quickref-mode
:init
(setq quickref-command-prefix (kbd "s-x s-q"))
:config
(quickref-global-mode t))
;;; Windows and Frames
(use-package resize-window
:bind ("C-x ^" . resize-window))
;;; Use `s-w' as a prefix key for various window commands.
(define-prefix-command 'ejmr-window-map)
(bind-key "s-w" 'ejmr-window-map)
(bind-key "s-w" #'ace-window ejmr-window-map)
(bind-key "0" #'delete-window ejmr-window-map)
(bind-key "1" #'delete-other-windows ejmr-window-map)
(bind-key "3" #'split-window-horizontally ejmr-window-map)
(bind-key "f" #'find-file-other-window ejmr-window-map)
(bind-key "r" #'find-file-read-only-other-window ejmr-window-map)
(bind-key "b" #'ivy-switch-buffer-other-window ejmr-window-map)
(bind-key "d" #'dired-other-window ejmr-window-map)
(bind-key "." #'xref-find-definitions-other-window ejmr-window-map)
(progn
(defun ejmr-switch-buffer-only-window ()
"Switches to a buffer and makes it the sole window.
This is the equivalent of `C-x 4 b` and then `C-x 1`."
(interactive)
(ivy-switch-buffer-other-window)
(delete-other-windows))
(bind-key "o" #'ejmr-switch-buffer-only-window ejmr-window-map))
(defun ejmr-split-window-vertically-and-balance ()
"Splits the window vertically then balances all windows.
This is the equivalent of `C-x 2' followed by `C-x +'."
(interactive)
(split-window-vertically)
(balance-windows))
(bind-key "2" #'ejmr-split-window-vertically-and-balance ejmr-window-map)
(defhydra hydra-window (ejmr-window-map "s" :color amaranth :hint nil)
"Window Size"
("t" enlarge-window "Taller")
("n" shrink-window-horizontally "Narrower")
("w" enlarge-window-horizontally "Wider")
("s" shrink-window-if-larger-than-buffer "Shrink")
("b" balance-windows "Balance")
("q" nil "Quit" :color blue))
;;; Expanding and Folding Text
(use-package tiny
:bind (:map ejmr-command-shortcut-map ("t" . tiny-expand)))
(use-package vimish-fold
:config
(defhydra hydra-vimish-fold (:color pink :hint nil :delay 0.5)
"
Vimish Fold
-----------
[_f_]old [_d_]elete [_u_]nfold [_r_]efold [_t_]oggle
Prefix CTRL for `*-all' variants
[_a_]vy [_q_]uit
"
("f" vimish-fold)
("C-f" vimish-fold-all)
("d" vimish-fold-delete)
("C-d" vimish-fold-delete-all)
("u" vimish-unfold)
("C-u" vimish-fold-unfold-all)
("r" vimish-fold-refold)
("C-r" vimish-fold-refold-all)
("t" vimish-fold-toggle)
("C-t" vimish-fold-toggle-all)
("a" vimish-fold-avy)
("q" nil :color blue))
(bind-key "s-f" #'hydra-vimish-fold/body ejmr-command-shortcut-map))
(use-package origami
:disabled t
:diminish 'origami-mode
:config
(global-origami-mode t)
(defhydra hydra-origami (:color pink :columns 4)
"Origami Folds"
("t" origami-recursively-toggle-node "Toggle")
("s" origami-show-only-node "Single")
("r" origami-redo "Redo")
("u" origami-undo "Undo")
("o" origami-open-all-nodes "Open")
("c" origami-close-all-nodes "Close")
("n" origami-next-fold "Next")
("p" origami-previous-fold "Previous")
("q" nil "Quit" :color blue))
(bind-key "o" #'hydra-origami/body ejmr-hydra-map))
;;; External Searching
(use-package ag
:config
(bind-key "a" (defhydra hydra-ag (:color blue :hint nil)
"
Silver Searcher: _q_uit
_a_g _p_roject _d_ired
_f_iles file_s_ re_g_exp
_r_egexp rege_x_p
"
("a" ag)
("f" ag-files)
("r" ag-regexp)
("p" ag-project)
("s" ag-project-files)
("x" ag-project-regexp)
("d" ag-dired)
("g" ag-dired-regexp)
("q" nil))
ejmr-hydra-map))
;;; External Shell Utilities
(use-package insert-shebang
:disabled t
:config (bind-key "b" #'insert-shebang ejmr-command-shortcut-map))
(use-package with-editor
:config (shell-command-with-editor-mode t))
;;; Undo, Redo, and Kill Ring
(defhydra hydra-yank-pop ()
"Yank"
("C-y" yank nil)
("M-y" yank-pop nil)
("y" (yank-pop 1) "next")
("Y" (yank-pop -1) "previous")
("c" counsel-yank-pop "counsel")
("l" (refine 'kill-ring) "list" :color blue)
("w" hydra-webpaste/body "web" :color blue)
("o" org-cliplink "org-cliplink" :color blue)
("q" nil "quit" :color blue))
(bind-key "C-y" #'hydra-yank-pop/yank)
(bind-key "M-y" #'hydra-yank-pop/yank-pop)
(bind-key "s-y" #'hydra-yank-pop/body)
(bind-key "C-s-y" #'counsel-yank-pop)
(use-package undo-tree
:diminish undo-tree-mode
:config
(global-undo-tree-mode t))
;;; Indentation
(use-package indent-tools
:bind (:map ejmr-hydra-map (">" . indent-tools-hydra/body)))
(use-package aggressive-indent
:commands (aggressive-indent-mode)
:config
(global-aggressive-indent-mode t))
(use-package indent-guide
:diminish indent-guide-mode
:config (add-hook 'prog-mode-hook #'indent-guide-mode))
;;; Help and Info
(defhydra hydra-info (:color blue :hint nil)
"
Info-mode:
^^_]_ forward (next logical node) ^^_l_ast (←) _u_p (↑) _f_ollow reference _T_OC
^^_[_ backward (prev logical node) ^^_r_eturn (→) _m_enu (↓) (C-u for new window) _i_ndex _d_irectory
^^_n_ext (same level only) ^^_H_istory _g_oto (C-u for new window) _,_ next index item _c_opy node name
^^_p_rev (same level only) _<_/_t_op _b_eginning of buffer virtual _I_ndex _C_lone buffer
regex _s_earch (_S_ case sensitive) ^^_>_ final _e_nd of buffer ^^ _a_propos
_1_ .. _9_ Pick first .. ninth item in the node's menu.
"
("]" Info-forward-node)
("[" Info-backward-node)
("n" Info-next)
("p" Info-prev)
("s" Info-search)
("S" Info-search-case-sensitively)
("l" Info-history-back)
("r" Info-history-forward)
("H" Info-history)
("t" Info-top-node)
("<" Info-top-node)
(">" Info-final-node)
("u" Info-up)
("^" Info-up)
("m" Info-menu)
("g" Info-goto-node)
("b" beginning-of-buffer)
("e" end-of-buffer)
("f" Info-follow-reference)
("i" Info-index)
("," Info-index-next)
("I" Info-virtual-index)
("T" Info-toc)
("d" Info-directory)
("c" Info-copy-current-node-name)
("C" clone-buffer)
("a" info-apropos)
("1" Info-nth-menu-item)
("2" Info-nth-menu-item)
("3" Info-nth-menu-item)
("4" Info-nth-menu-item)
("5" Info-nth-menu-item)
("6" Info-nth-menu-item)
("7" Info-nth-menu-item)
("8" Info-nth-menu-item)
("9" Info-nth-menu-item)
("?" Info-summary "Info summary")
("h" Info-help "Info help")
("q" Info-exit "Info exit")
("C-g" nil "cancel" :color blue))
(bind-key "?" #'hydra-info/body Info-mode-map)
(use-package helpful
:config
(defhydra hydra-helpful (:color blue)
"Helpful"
("f" helpful-function "Function")
("c" helpful-command "Command")
("m" helpful-macro "Macro"))
(bind-key "h" #'hydra-helpful/body ejmr-hydra-map))
;;; TODO: Leave disabled until is supports image links is at least
;;; Markdown, AsciiDoc, and RST.
(use-package uimage :disabled t)
;;; Rectangular Editing
(defhydra hydra-rectangle (:body-pre (rectangle-mark-mode 1)
:color pink
:post (deactivate-mark))
"
^_k_^ _d_elete _s_tring
_h_ _l_ _o_k _y_ank
^_j_^ _n_ew-copy _r_eset
^^^^ _e_xchange _u_ndo
^^^^ ^ ^ _p_aste
"
("h" backward-char nil)
("l" forward-char nil)
("k" previous-line nil)
("j" next-line nil)
("e" exchange-point-and-mark nil)
("n" copy-rectangle-as-kill nil)
("d" delete-rectangle nil)
("r" (if (region-active-p)
(deactivate-mark)
(rectangle-mark-mode 1)) nil)
("y" yank-rectangle nil)
("u" undo nil)
("s" string-rectangle nil)
("p" kill-rectangle nil)
("o" nil nil))
(bind-key "r" #'hydra-rectangle/body ejmr-hydra-map)
(use-package multiple-cursors
:disabled t
:config
(defhydra hydra-multiple-cursors (:hint nil)
"
^Up^ ^Down^ ^Other^
----------------------------------------------
[_p_] Next [_n_] Next [_l_] Edit lines
[_P_] Skip [_N_] Skip [_a_] Mark all
[_M-p_] Unmark [_M-n_] Unmark [_r_] Mark by regexp
^ ^ ^ ^ [_q_] Quit
"
("l" mc/edit-lines :exit t)
("a" mc/mark-all-like-this :exit t)
("n" mc/mark-next-like-this)
("N" mc/skip-to-next-like-this)
("M-n" mc/unmark-next-like-this)
("p" mc/mark-previous-like-this)
("P" mc/skip-to-previous-like-this)
("M-p" mc/unmark-previous-like-this)
("r" mc/mark-all-in-region-regexp :exit t)
("q" nil))
(bind-key "c" #'hydra-multiple-cursors/body ejmr-hydra-map))
(use-package anyins
:commands (anyins-mode)
:bind ("C-x r a" . anyins-mode))
;;; Modal Input
(use-package modalka :disabled t)
(use-package ryo-modal
:disabled t
:commands ryo-modal-mode
;; TODO: Before using `ryo-modal' I need to choose a different
;; key-binding to avoid conflicts.
:bind (:map ejmr-custom-bindings-map ("SPC" . ryo-modal-mode))
:init
(add-hook 'ryo-modal-mode-hook
(lambda () (if ryo-modal-mode
(selected-minor-mode 1)
(selected-minor-mode -1))))
:config
(define-key ryo-modal-mode-map (kbd ".") 'ryo-modal-repeat)
(add-to-list 'ryo-modal-bindings-list '("." "ryo-modal-repeat"))
(ryo-modal-keys ("q" ryo-modal-mode)
("n" next-line)
("p" previous-line)))
(use-package god-mode
:bind (:map ejmr-command-shortcut-map
("s-g" . god-mode-all)
:map god-local-mode-map
("." . repeat)))
;;; Org Mode
(use-package org
:config
(setq org-M-RET-may-split-line '((default . nil)))
(setq org-todo-keywords
'((sequence "TODO(t)" "IN PROGRESS(p)" "|" "DONE(d)")
(sequence "REPORT(r)" "BUG(b)" "TESTING(t)" "|" "CLOSED(c)")
(sequence "BRAINSTORMING(b)" "RFC(r)" "FEEDBACK(f)" "|" "ACCEPTED(a) REJECTED(j)")
(sequence "|" "CANCELED(c)")))
(use-package org-tree-slide)
(use-package org-webpage :disabled t)
(use-package org-cliplink)
(use-package interleave)
(use-package org-ref)
(use-package calfw :config (use-package calfw-org))
(use-package worf
:config
(bind-key "o" #'worf-mode ejmr-custom-bindings-map)
(add-hook 'org-mode-hook #'worf-mode))
(use-package yankpad
:init
(setq yankpad-file "/home/eric/.emacs.d/org/yankpad.org")
:config
(define-prefix-command 'ejmr-yankpad-map)
(bind-key "y" 'ejmr-yankpad-map ejmr-command-shortcut-map)
(bind-key "m" #'yankpad-map ejmr-yankpad-map)
(bind-key "e" #'yankpad-expand ejmr-yankpad-map)
(add-to-list 'company-backends #'company-yankpad))
(use-package org-readme)
(use-package org-parser)
(use-package org-journal :disabled t)
(use-package org-wiki
:disabled t
:load-path (lambda () (ejmr-get-local-load-path-for "org-wiki"))
:config
(setq org-wiki-location "/home/eric/Documents/Wiki")
(setq org-wiki-server-port "7331")
(setq org-wiki-server-host "127.0.0.1"))
(use-package org-board)
(use-package ob-php)
(use-package ox-pandoc)
(use-package ox-gfm)
(use-package org-brain
:disabled t
:init
(setq org-brain-path "/home/eric/.emacs.d/org")
:config
(org-brain-activate-cache-saving)))
;;; Font
(set-frame-font "Bitstream Vera Sans Mono-13" nil t)
(defhydra hydra-zoom ()
"Zoom"
("+" text-scale-increase "in")
("-" text-scale-decrease "out")
("0" (text-scale-increase 0) "default")
("q" nil "quit"))
(bind-key "z" #'hydra-zoom/body ejmr-hydra-map)
;;; Disabled Features
(put 'narrow-to-region 'disabled nil)
;;; Global Hooks
(add-hook 'text-mode-hook 'visual-line-mode)
;;; Global Generic Key-Bindings
(bind-key "<M-return>" #'indent-new-comment-line)
(bind-key "s-o" #'overwrite-mode)
;;; Setup `s-1' and `s-9` as a prefix keys for help commands. Having
;;; this prefix on multiple keys, on seperate sides of the keyboard
;;; makes it easier to perform certain key-sequences.
(define-prefix-command 'ejmr-help-map)
(bind-key "s-1" 'ejmr-help-map)
(bind-key "s-9" 'ejmr-help-map)
(use-package mykie :disabled t)
(use-package free-keys
:commands (free-keys)
:bind ("C-~" . free-keys))
(use-package which-key
:diminish 'which-key-mode
:config (which-key-mode t))
;;; Auto Completion
(use-package bbyac
:defer nil
:diminish bbyac-mode
:config
(bbyac-global-mode t))
(use-package git-complete
:load-path (lambda () (ejmr-get-local-load-path-for "git-complete"))
:commands git-complete
:bind ("M-s-/" . git-complete)
:config
(setq git-complete-enable-autopair t)
(setq git-complete-ignore-case nil))
;;; Company
(use-package company-mode
:diminish 'company-mode
:bind ("s-/" . company-complete)
:config
(global-company-mode t)
(use-package company-emoji
:config
(add-to-list 'company-backends 'company-emoji))
(use-package company-lua)
(use-package company-quickhelp
:diminish 'company-quickhelp-mode
:config
(company-quickhelp-mode 1)
(bind-key "M-h" #'company-quickhelp-manual-begin company-active-map)))
;;; Key Chord Mode
(use-package key-chord
:config
(use-package key-seq)
(key-chord-mode 1)
(setq key-chord-two-keys-delay 0.4))
;;; TODO: Make sure that `:chords` uses the `key-seq` functionality
;;; before I switch any of my current bindings. And ensure that it
;;; supports `:map` for local chords.
(use-package use-package-chords :disabled t)
;;; Global Chords
(key-seq-define-global "ZB" #'ivy-switch-buffer)
(key-seq-define-global "ZW" #'kill-buffer-and-window)
(defun ejmr-server-edit-save-and-kill ()
"Set current buffer as 'done' for the server, save then kill.
This is equivalent to `C-x C-s' followed by `C-x #'. The latter
will automatically kill the buffer."
(interactive)
(save-buffer)
(server-edit))
(key-seq-define-global "Z#" #'ejmr-server-edit-save-and-kill)
;;; Page Breaks
(use-package pp-c-l
:config (pretty-control-l-mode 1))
;;; Hydra
(use-package hydra
:config
(setq hydra-verbose nil))
;;; Hydra for Minor Modes
(defhydra hydra-minor-modes (:hint nil)
"
^Indenting^ ^Coding^ ^Writing^
------------------------------------------------------------
[_A_]ggresive [_N_]ameless Dark_r_oom
[_S_]tupid [_C_]ompany Fly_s_pell
[_G_]uide [_E_]mmet _P_andoc
[_D_]iff HL _W_S Butler
[_F_]irestarter _V_isual Line
"
("A" global-aggressive-indent-mode)
("S" stupid-indent-mode)
("G" indent-guide-mode)
("N" nameless-mode)
("C" global-company-mode)
("E" emmet-mode)
("F" firestarter-mode)
("D" global-diff-hl-mode)
("r" darkroom-tentative-mode)
("s" flyspell-mode)
("P" pandoc-mode)
("W" ws-butler-mode)
("V" visual-line-mode)
("q" nil :color blue))
(bind-key "n" #'hydra-minor-modes/body ejmr-hydra-map)
;;; Hydra for Major Modes
(defhydra hydra-major-modes (:color blue)
"Major Mode"
("a" adoc-mode "Asciidoc")
("i" intero-mode "Intero")
("m" markdown-mode "Markdown")
("n" nasm-mode "NASM")
("p" projectile-mode "Projectile")
("t" text-mode "Text"))
(bind-key "m" #'hydra-major-modes/body ejmr-hydra-map)
;;; Flycheck
(use-package flycheck
:config
(use-package flycheck-inline :ensure t)
(use-package flycheck-proselint
:load-path (lambda () (ejmr-get-local-load-path-for "flycheck-proselint")))
(use-package flycheck-clangcheck
:disabled t
:config
(setq flycheck-clangcheck-analyze t))
(use-package flycheck-mypy :disabled t)
(use-package flycheck-package
:config (flycheck-package-setup))
(use-package flycheck-rust
:disabled t
:config
(add-hook 'flycheck-mode-hook #'flycheck-rust-setup))
(bind-key "<s-up>" #'flycheck-previous-error)
(bind-key "<s-down>" #'flycheck-next-error))
(defhydra hydra-flycheck (:color blue)
"
^
^Flycheck^ ^Errors^ ^Checker^
^────────^──────────^──────^────────────^───────^───────────
[_q_] quit [_c_] check [_s_] select
[_v_] verify setup [_n_] next [_d_] disable
[_m_] manual [_p_] previous [_?_] describe
[_i_] inline
^^ ^^ ^^
"
("q" nil)
("c" flycheck-buffer)
("d" flycheck-disable-checker)
("m" flycheck-manual)
("n" flycheck-next-error :color red)
("p" flycheck-previous-error :color red)
("s" flycheck-select-checker)
("v" flycheck-verify-setup)
("i" (lambda ()
(interactive)
(if (eq 'flycheck-display-errors-function 'flycheck-display-error-messages)
(setq-local flycheck-display-error-function 'flycheck-inline)
(setq-local flycheck-display-error-function 'flycheck-display-error-messages)))
:color amaranth)
("?" flycheck-describe-checker))
(bind-key "f" #'hydra-flycheck/body ejmr-hydra-map)
;;; Hydra for Misc Commands
(defhydra hydra-commands (:color blue :columns 4)
"Commands"
("b" ejmr-browse-current-file "Browse")
("c" rpn-calc "RPN Calculator")
("e" editorconfig-mode-apply "EditorConfig")
("f" elfeed "Elfeed")
("l" refine "Refine List")
("m" man "Man")
("r" revert-buffer "Revert Buffer")
("s" ejmr-edit-current-file-as-root "Sudo File")
("t" find-temp-file "Temp File")
("T" tldr "TL;DR")
("u" ejmr-update-available-packages "Update Packages")
("v" vlf "View Large File")
("w" woman "WoMan")
("x" re-builder "Regex Builder")
("z" zone "Zone"))
(bind-key "x" #'hydra-commands/body ejmr-hydra-map)
(bind-key "x" #'hydra-commands/body ejmr-command-shortcut-map)
(bind-key "s-x" #'hydra-commands/body ejmr-command-shortcut-map)
;;; Commenting
(use-package comment-dwim-2
:bind (:map ejmr-command-shortcut-map (";" . comment-dwim-2)))
;;; Mark Text and Regions
(use-package expand-region
:config
(use-package change-inner)
(defun ejmr-mark-line ()
"Mark the current line."
(interactive)
(end-of-line)
(set-mark (point))
(beginning-of-line))
(defhydra hydra-mark (:color blue :idle 1.5 :columns 4)
"Mark"
("d" er/mark-defun "Defun / Function")
("f" er/mark-defun "Defun / Function")
("w" er/mark-word "Word")
("u" er/mark-url "Url")
("e" mark-sexp "S-Expression")