-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmk-packages.el
1103 lines (990 loc) · 26.7 KB
/
mk-packages.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
;;; mk-packages.el --- -*- lexical-binding: t; -*-
;;; Commentary:
;; Per-package configurations.
;;; Code:
(require 'mk-utils)
(require 'use-package)
(defvar mk-avy-keys '(?a ?o ?e ?u ?i ?d ?h ?t ?n ?s)
"Home row Dvorak keys.")
(use-package ace-link
:commands (ace-link ace-link-org)
:init
(setq-default ace-link-fallback-function 'ace-link-org)
:config
(ace-link-setup-default)
:bind
("M-o" . ace-link))
(use-package ace-popup-menu
:config
(ace-popup-menu-mode 1))
(use-package ace-window
:commands (ace-window)
:init
(setq-default
aw-keys mk-avy-keys
aw-background nil)
:bind
("<prior>" . ace-window))
(use-package aggressive-indent
:bind
("<next> a g" . aggressive-indent-mode)
:hook
((emacs-lisp-mode . aggressive-indent-mode)
(html-mode . aggressive-indent-mode)))
(use-package align
:bind
("<next> a r" . align-regexp))
(use-package autorevert
:init
(setq-default
auto-revert-verbose nil
global-auto-revert-non-file-buffers t)
:config
(global-auto-revert-mode 1))
(use-package browse-url
:init
(setq
browse-url-browser-function 'browse-url-generic
browse-url-generic-program "google-chrome-stable"))
(use-package calc
:commands (calc)
:bind
("<next> c a" . calc))
(use-package calendar
:commands (calendar)
:init
(setq calendar-week-start-day 1)
:bind
(("<next> c l" . calendar)
:map
calendar-mode-map
("<prior>" . ace-window)))
(use-package cus-edit
:bind
("<next> c g" . customize-group))
(use-package avy
:after (modalka)
:commands (avy-goto-line)
:init
(setq-default
avy-keys mk-avy-keys
avy-style 'at-full)
:bind
(:map
modalka-mode-map
("J" . avy-goto-line)))
(use-package char-menu
:commands (char-menu)
:init
(setq-default
char-menu
'("—" "‘’" "“”" "…" "«»"
("Typography"
"–" "•" "©" "†" "‡" "°" "·" "§" "№" "★")
("Math"
"≈" "≡" "≠" "∞" "×" "±" "∓" "÷" "√" "∇")
("Arrows"
"←" "→" "↑" "↓" "⇐" "⇒" "⇑" "⇓")
("Greek"
"α" "β" "Δ" "δ" "ε" "ζ" "η" "θ" "λ" "μ" "ν" "ξ"
"Ξ" "ο" "π" "ρ" "σ" "τ" "υ" "φ" "χ" "ψ" "ω" "Ω")))
:bind
("<next> DEL" . char-menu))
(use-package counsel
:commands (counsel-M-x)
:bind
("M-x" . counsel-M-x))
(use-package custom
:preface
(defun mk-switch-theme (theme)
"Switch to theme THEME, loading it if necessary."
(interactive
(list
(intern
(completing-read "Switch to theme: "
(mapcar #'symbol-name
(custom-available-themes))))))
(dolist (enabled-theme custom-enabled-themes)
(disable-theme enabled-theme))
(load-theme theme t))
:bind
("<next> t h" . mk-switch-theme))
(use-package cyphejor
:init
(setq
cyphejor-rules
'(:upcase
("bookmark" "→")
("buffer" "β")
("diff" "Δ")
("dired" "δ")
("emacs" "ε")
("eshell" "εsh")
("inferior" "i" :prefix)
("interaction" "i" :prefix)
("interactive" "i" :prefix)
("lisp" "λ" :postfix)
("menu" "▤" :postfix)
("mode" "")
("package" "↓")
("python" "π")
("shell" "sh" :postfix)
("text" "ξ")
("wdired" "↯δ")))
:config
(cyphejor-mode 1))
(use-package dabbrev
:commands (dabbrev-expand)
:bind
("C-," . dabbrev-expand))
(use-package delsel
:demand
:config
(delete-selection-mode 1))
(use-package descr-text
:bind
("<next> d c" . describe-char))
(use-package dired
:init
(setq
delete-by-moving-to-trash t
dired-auto-revert-buffer t
dired-dwim-target t
dired-keep-marker-copy nil
dired-listing-switches "-GAlh --group-directories-first"
dired-recursive-copies 'always
dired-recursive-deletes 'always)
:preface
(defun mk-dired-first-file ()
"Jump to the first file in current directory."
(interactive)
(goto-char (point-min))
(dired-next-line 2))
(defun mk-dired-last-file ()
"Jump to the last file in current directory."
(interactive)
(goto-char (point-max))
(dired-previous-line 1))
(defun mk-dired-open-external (file)
"Open specified FILE with application determined by the OS."
(interactive (list (dired-get-filename)))
(call-process "xdg-open" nil 0 nil file))
:bind
(:map
dired-mode-map
("<down>" . mk-dired-last-file)
("<up>" . mk-dired-first-file)
("b" . dired-up-directory)
("e" . mk-dired-open-external)
("w" . wdired-change-to-wdired-mode))
:hook
((dired-mode . toggle-truncate-lines)))
(use-package dired-x
:init
(setq
dired-clean-up-buffers-too t))
(use-package direnv
:config
(direnv-mode 1))
(use-package eldoc
:init
(setq eldoc-idle-delay 0.1)
:hook
((emacs-lisp-mode . eldoc-mode)))
(use-package electric
:demand
:config
(electric-indent-mode 0))
(use-package elisp-mode
:preface
(defun mk-eval-last-sexp ()
"Evaluate last S-expression and replace it with the result."
(interactive)
(let ((value (eval (elisp--preceding-sexp))))
(kill-sexp -1)
(insert (format "%S" value))))
(defun mk-set-sentence-end-double-space ()
"Set ‘sentence-end-double-space’ to T locally."
(setq-local sentence-end-double-space t))
:bind
("<next> e d" . eval-defun)
("<next> e e" . eval-last-sexp)
("<next> e v" . eval-buffer)
("M-e" . mk-eval-last-sexp)
:hook
((emacs-lisp-mode . mk-set-sentence-end-double-space)
(lisp-interaction-mode . eldoc-mode)))
(use-package files
:demand
:init
(setq
auto-save-default nil
backup-by-copying t
backup-directory-alist (list (cons "." (f-expand "backups" user-emacs-directory)))
delete-old-versions t
kept-new-versions 4
kept-old-versions 2
large-file-warning-threshold 10240000
make-backup-files t
require-final-newline t
vc-display-status nil
version-control t)
:preface
(defun mk-single-empty-line ()
"Make sure we don't have too wide gaps."
(save-excursion
(goto-char (point-min))
(while (re-search-forward "[ \t]*\n[ \t]*\n\\([ \t]*\n\\)+" nil t)
(replace-match "\n\n"))))
(defun mk-exit-emacs (&optional arg)
"Exit Emacs: save all file-visiting buffers, kill terminal.
If ARG is given and it's not NIL, don't ask user if he wants to
exit."
(interactive "P")
(when (or arg (yes-or-no-p "Exit Emacs?"))
(save-buffers-kill-emacs)))
:config
(advice-add 'revert-buffer :filter-args (lambda (&rest _rest) (list nil t)))
:bind
("<f12>" . mk-exit-emacs)
("<next> a s" . write-file)
("<next> r r" . revert-buffer)
:hook
((before-save . whitespace-cleanup)
(before-save . mk-single-empty-line)))
(use-package fix-input
:demand
:config
(fix-input "english-dvorak" "russian-computer" "mk-dvorak-russian"))
(use-package fix-word
:commands (fix-word-capitalize fix-word-downcase fix-word-upcase)
:bind
("M-c" . fix-word-capitalize)
("M-l" . fix-word-downcase)
("M-u" . fix-word-upcase))
(use-package flycheck
:config
(setq-default
flycheck-emacs-lisp-initialize-packages t
flycheck-emacs-lisp-load-path 'inherit
flycheck-temp-prefix ".flycheck"
flycheck-disabled-checkers '(haskell-stack-ghc
haskell-ghc
haskell-hlint))
:bind
("<next> f l" . flycheck-list-errors)
:hook
((gitignore-mode . flycheck-mode)
(markdown-mode . flycheck-mode)
(prog-mode . flycheck-mode)
(proof-mode . flycheck-mode)
(yaml-mode . flycheck-mode))
:custom-face
(flycheck-fringe-error ((t (:background "#6C3333" :weight bold)))))
(use-package flycheck-color-mode-line
:after (flycheck)
:hook
((flycheck-mode . flycheck-color-mode-line-mode)))
(use-package flycheck-mmark
:after (flycheck)
:hook
((flycheck-mode . flycheck-mmark-setup)))
(use-package flyspell
:preface
(defun mk-flyspell-correct-previous (&optional words)
"Correct word before point, reach distant words.
WORDS words at maximum are traversed backward until misspelled
word is found. If it's not found, give up. If argument WORDS is
not specified, traverse 12 words by default.
Return T if misspelled word is found and NIL otherwise. Never
move point."
(interactive "P")
(let* ((delta (- (point-max) (point)))
(counter (string-to-number (or words "12")))
(result
(catch 'result
(while (>= counter 0)
(when (cl-some #'flyspell-overlay-p
(overlays-at (point)))
(flyspell-correct-word-before-point)
(throw 'result t))
(backward-word 1)
(setq counter (1- counter))
nil))))
(goto-char (- (point-max) delta))
result))
:bind
(:map
flyspell-mode-map
(("C-," . nil)
("C-." . nil)
("C-;" . mk-flyspell-correct-previous)
("<next> f b" . flyspell-buffer)))
:hook
((gitignore-mode . flyspell-prog-mode)
(haskell-cabal-mode . flyspell-prog-mode)
(prog-mode . flyspell-prog-mode)
(proof-mode . flyspell-prog-mode)
(text-mode . flyspell-mode)
(yaml-mode . flyspell-prog-mode)))
(use-package flyspell-lazy
:after (flyspell)
:init
(setq-default
flyspell-lazy-disallow-buffers nil
flyspell-lazy-idle-seconds 1)
:config
(flyspell-lazy-mode 1))
(use-package frame
:preface
(defun mk-set-font (font &optional height)
"Set font FONT as main font for all frames.
HEIGHT, if supplied, specifies height of letters to use."
(interactive
(list (completing-read "Use font: " (font-family-list)) nil))
(set-face-attribute 'default nil :family font)
(when height
(set-face-attribute 'default nil :height height))
(set-face-attribute 'variable-pitch nil :family font))
:config
(blink-cursor-mode 0)
(when window-system
(mk-set-font "DejaVu Sans Mono" 120)
(toggle-frame-fullscreen))
:bind
("<next> d f" . delete-frame)
("<next> f o" . mk-set-font)
("<next> n f" . make-frame)
("<next> t f" . toggle-frame-fullscreen))
(use-package git-link
:commands (git-link)
:bind
("<next> g g" . git-link))
(use-package ispell
:after (fix-input)
:init
(setq-default
ispell-program-name "hunspell"
ispell-dictionary "en_US")
:preface
(defun mk-use-lang (input-method dictionary)
"Switch to INPUT-METHOD and Ispell DICTIONARY."
(set-input-method input-method)
(ispell-change-dictionary dictionary))
(defun mk-use-en ()
"Switch to English."
(interactive)
(mk-use-lang nil "en_US"))
(defun mk-use-fr ()
"Switch to French."
(interactive)
(mk-use-lang nil "fr-moderne"))
(defun mk-use-ru ()
"Switch to Russian."
(interactive)
(mk-use-lang "mk-dvorak-russian" "russian"))
:bind
("<next> e n" . mk-use-en)
("<next> f r" . mk-use-fr)
("<next> r u" . mk-use-ru))
(use-package haskell-cabal
:bind
(:map
haskell-cabal-mode-map
("M-n" . mk-transpose-line-down)
("M-p" . mk-transpose-line-up)))
(use-package haskell-interactive-mode
:bind
(:map
haskell-interactive-mode-map
("<end>" . nil)
("<escape>" . nil)
("<home>" . nil)
("<next>" . nil)
("<prior>" . nil)
("C-<prior>" . nil)
("C-c r" . haskell-process-restart)))
(use-package haskell-mode
:after (lsp-haskell)
:init
(setq
haskell-process-load-or-reload-prompt t
haskell-process-show-debug-tips nil
haskell-process-type 'stack-ghci
haskell-process-args-stack-ghci '("--ghci-options=-ferror-spans"))
:preface
(defun mk-haskell-insert-symbol ()
"Insert one of the Haskell symbols that are difficult to type."
(interactive)
(char-menu
'("<-" "::" "->" "=>" "="
"<*" "<$>" "<*>" "<|>" "*>")))
:bind
(("<next> o" . mk-haskell-insert-symbol)
:map
haskell-indentation-mode-map
("RET" . nil)
("<backtab>" . nil)
("," . nil)
(";" . nil)
(")" . nil)
("}" . nil)
("]" . nil))
:hook
((haskell-mode . lsp)))
(use-package hasky-extensions
:after (haskell-mode)
:commands (hasky-extensions)
:bind
(:map
haskell-mode-map
("C-c y" . hasky-extensions))
:hook
((hasky-extensions-prettifying . mk-single-empty-line)
(hasky-extensions-prettifying . whitespace-cleanup)))
(use-package hasky-stack
:commands (hasky-stack-execute hasky-stack-package-action hasky-stack-new)
:init
(setq
hasky-stack-auto-target t
hasky-stack-auto-open-coverage-reports t
hasky-stack-auto-newest-version t)
:bind
("<next> h e" . hasky-stack-execute)
("<next> h o" . hasky-stack-package-action)
("<next> h i" . hasky-stack-new))
(use-package help
:bind
("<next> f k" . describe-key))
(use-package help-fns
:bind
("<next> f f" . describe-function)
("<next> f v" . describe-variable))
(use-package highlight-symbol
:commands
(highlight-symbol-remove-all
highlight-symbol-next
highlight-symbol-prev
highlight-symbol)
:bind
("<next> h a" . highlight-symbol-remove-all)
("<next> h n" . highlight-symbol-next)
("<next> h p" . highlight-symbol-prev)
("<next> h s" . highlight-symbol))
(use-package hl-todo
:hook
((gitignore-mode . hl-todo-mode)
(haskell-cabal-mode . hl-todo-mode)
(markdown-mode . hl-todo-mode)
(prog-mode . hl-todo-mode)
(proof-mode . hl-todo-mode)
(yaml-mode . hl-todo-mode)))
(use-package ivy
:init
(setq-default
ivy-use-selectable-prompt t)
:preface
(defun mk-anti-ivy-advice (func &rest args)
"Temporarily disable Ivy and call function FUNC with arguments ARGS."
(interactive)
(let ((completing-read-function #'completing-read-default))
(if (called-interactively-p 'any)
(call-interactively func)
(apply func args))))
:config
(advice-add 'dired-create-directory :around 'mk-anti-ivy-advice)
(dolist (buffer '("^\\*Backtrace\\*$"
"^\\*Compile-Log\\*$"
"^\\*.+Completions\\*$"
"^\\*Flycheck error messages\\*$"
"^\\*Help\\*$"
"^\\*Ibuffer\\*$"
"^\\*Messages\\*$"
"^\\*inferior-lisp\\*$"
"^\\*scratch\\*$"))
(add-to-list 'ivy-ignore-buffers buffer))
(ivy-mode 1))
(use-package js2-mode
:after (mk-text)
:mode "\\.js$"
:bind
(:map
js2-mode-map
("M-j" . mk-join-lines)))
(use-package kill-or-bury-alive
:commands (kill-or-bury-alive kill-or-bury-alive-purge-buffers)
:bind
("<escape>" . kill-or-bury-alive)
("<next> a a" . kill-or-bury-alive-purge-buffers))
(use-package lsp-haskell
:demand
:config
)
(use-package lsp-ui
:config
(setq lsp-ui-doc-enable nil)
:bind
(("<next> ' '" . lsp-execute-code-action)
("<next> ' d" . lsp-describe-thing-at-point)
("<next> ' f" . lsp-format-buffer)))
(use-package magit
:init
(setq magit-clone-set-remote.pushDefault t)
:bind
(("<next> m c" . magit-clone)
("<next> m i" . magit-init)
("<next> m s" . magit-status)
:map
git-commit-mode-map
("M-n" . mk-transpose-line-down)
("M-p" . mk-transpose-line-up)))
(use-package markdown-mode
:init
(setq markdown-url-compose-char ?…)
:bind
(("<next> m d" . markdown-mode)
:map
markdown-mode-map
("<return>" . nil)
("M-n" . mk-transpose-line-down)
("M-p" . mk-transpose-line-up)))
(use-package minibuf-eldef
:demand
:init
(setq
minibuffer-eldef-shorten-default t)
:config
(minibuffer-electric-default-mode 1))
(use-package modalka
:after (mk-text mk-utils)
:init
(setq-default
modalka-cursor-type 'box)
:preface
(defun mk-modalka-mode-no-git-commit ()
"Enable ‘modalka-mode’ unless get edit git commit message."
(unless (string-equal (buffer-name) "COMMIT_EDITMSG")
(modalka-mode 1)))
(defun mk-open-default-dir ()
"Open default directory."
(interactive)
(find-file default-directory))
:config
(modalka-define-kbd "SPC" "C-SPC")
;; ' (handy as self-inserting)
;; " (handy as self-inserting)
(modalka-define-kbd "," "C-,")
;; - (handy as self-inserting)
(modalka-define-kbd "/" "M-.")
(modalka-define-kbd "." "C-.")
(modalka-define-kbd ":" "M-;")
(modalka-define-kbd ";" "C-;")
(modalka-define-kbd "?" "M-,")
(modalka-define-kbd "0" "C-0")
(modalka-define-kbd "1" "C-1")
(modalka-define-kbd "2" "C-2")
(modalka-define-kbd "3" "C-3")
(modalka-define-kbd "4" "C-4")
(modalka-define-kbd "5" "C-5")
(modalka-define-kbd "6" "C-6")
(modalka-define-kbd "7" "C-7")
(modalka-define-kbd "8" "C-8")
(modalka-define-kbd "9" "C-9")
(modalka-define-kbd "a" "C-a")
(modalka-define-kbd "b" "C-b")
(modalka-define-kbd "c b" "C-c C-b")
(modalka-define-kbd "c c" "C-c C-c")
(modalka-define-kbd "c k" "C-c C-k")
(modalka-define-kbd "c l" "C-c C-l")
(modalka-define-kbd "c n" "C-c C-n")
(modalka-define-kbd "c s" "C-c C-s")
(modalka-define-kbd "c t" "C-c C-t")
(modalka-define-kbd "c u" "C-c C-u")
(modalka-define-kbd "c v" "C-c C-v")
(modalka-define-kbd "c x" "C-c C-x")
(modalka-define-kbd "d" "C-d")
(modalka-define-kbd "e" "C-e")
(modalka-define-kbd "f" "C-f")
(modalka-define-kbd "g" "C-g")
(modalka-define-kbd "h" "M-h")
(modalka-define-kbd "i" "C-i")
(modalka-define-kbd "j" "M-j")
(modalka-define-kbd "k" "C-k")
(modalka-define-kbd "l" "C-l")
(modalka-define-kbd "m" "C-m")
(modalka-define-kbd "n" "C-n")
(modalka-define-kbd "o" "C-o")
(modalka-define-kbd "p" "C-p")
(modalka-define-kbd "q" "M-q")
(modalka-define-kbd "r" "C-r")
(modalka-define-kbd "s" "C-s")
(modalka-define-kbd "t" "C-t")
(modalka-define-kbd "u" "C-u")
(modalka-define-kbd "v" "C-v")
(modalka-define-kbd "w" "C-w")
(modalka-define-kbd "x 3" "C-x #")
(modalka-define-kbd "x ;" "C-x C-;")
(modalka-define-kbd "x e" "C-x C-e")
(modalka-define-kbd "x o" "C-x C-o")
(modalka-define-kbd "y" "C-y")
(modalka-define-kbd "z" "M-z")
(modalka-define-kbd "A" "M-SPC")
(modalka-define-kbd "B" "M-b")
(modalka-define-kbd "C" "M-c")
(modalka-define-kbd "D" "M-d")
(modalka-define-kbd "E" "M-e")
(modalka-define-kbd "F" "M-f")
(modalka-define-kbd "G" "C-`")
(modalka-define-kbd "H" "M-H")
;; I (bound elsewhere)
;; J (bound elsewhere)
(modalka-define-kbd "K" "M-k")
(modalka-define-kbd "L" "M-l")
(modalka-define-kbd "M" "M-m")
(modalka-define-kbd "N" "M-n")
(modalka-define-kbd "O" "M-o")
(modalka-define-kbd "P" "M-p")
;; Q (bound elsewhere)
(modalka-define-kbd "R" "M-r")
(modalka-define-kbd "S" "M-S")
(modalka-define-kbd "T" "M-t")
(modalka-define-kbd "U" "M-u")
(modalka-define-kbd "V" "M-v")
(modalka-define-kbd "W" "M-w")
;; X (not bound)
(modalka-define-kbd "Y" "M-y")
(modalka-define-kbd "Z" "C-z")
:bind
(("<return>" . modalka-mode)
:map
modalka-mode-map
("Q" . mk-sort-lines-dwim)
("X" . mk-open-default-dir))
:hook
((compilation-mode . modalka-mode)
(conf-toml-mode . modalka-mode)
(conf-unix-mode . modalka-mode)
(diff-mode . modalka-mode)
(gitignore-mode . modalka-mode)
(haskell-cabal-mode . modalka-mode)
(help-mode . modalka-mode)
(info-mode . modalka-mode)
(mustache-mode . modalka-mode)
(prog-mode . modalka-mode)
(proof-mode . modalka-mode)
(text-mode . mk-modalka-mode-no-git-commit)
(yaml-mode . modalka-mode)
(ztree-mode . modalka-mode)))
(use-package mk-highlight-line
:demand
:config
(mk-highlight-line-mode 1))
(use-package mk-text
:demand
:commands
(mk-transpose-line-down
mk-transpose-line-up
mk-duplicate-line
mk-mark-command
mk-smart-indent
mk-eat-indent
mk-join-lines
mk-copy-rest-of-line
mk-copy-buffer
mk-yark-primary
mk-narrow-to-region
mk-add-to-end-of-lines
mk-sort-lines-dwim)
:bind
("C-SPC" . mk-mark-command)
("C-r" . mk-smart-indent)
("C-z" . mk-copy-rest-of-line)
("M-S" . mk-eat-indent)
("M-j" . mk-join-lines)
("M-n" . mk-transpose-line-down)
("M-p" . mk-transpose-line-up)
("M-r" . mk-duplicate-line)
("<next> e l" . mk-add-to-end-of-lines)
("<next> n n" . mk-narrow-to-region)
("<next> n w" . widen)
("<next> y p" . mk-yank-primary))
(use-package mule
:preface
(defun mk-russian-phrase (text)
"Put TEXT into the system clipboard.
When called interactively it'll read the phrase using the Russian
input method."
(interactive
(list
(let ((original-input-method current-input-method)
result)
(set-input-method "mk-dvorak-russian")
(setq result (read-string "Russian input: " nil nil nil t))
(set-input-method original-input-method)
result)))
(gui-set-selection 'CLIPBOARD text))
:bind
("<next> c c" . revert-buffer-with-coding-system)
("<next> c s" . set-buffer-file-coding-system)
("<next> x x" . mk-russian-phrase))
(use-package mwheel
:demand
:config
(mouse-wheel-mode 0))
(use-package nix-mode
:mode "\\.nix$")
(use-package package
:bind
("<next> p f" . package-install-file)
("<next> p i" . package-install))
(use-package paragraphs
:bind
("M-H" . mark-paragraph))
(use-package paren
:init
(setq
show-paren-delay 0.05)
:config
(show-paren-mode 1))
(use-package proof-general
:after (proof-script proof-useropts)
:init
(setq
proof-splash-enable nil
proof-three-window-enable nil)
:bind
(:map
proof-mode-map
("C-c C-s" . proof-goto-point)
("M-n" . mk-transpose-line-down)
("M-p" . mk-transpose-line-up)))
(use-package python
:commands (python-mode)
:mode
("\\.bzl$" . python-mode)
("BUILD$" . python-mode)
("WORKSPACE$" . python-mode)
:init
(setq-default
python-fill-docstring-style 'pep-257-nn
python-indent-offset 2)
:bind
("<next> p y" . python-mode))
(use-package rainbow-delimiters
:hook
((emacs-lisp-mode . rainbow-delimiters-mode)))
(use-package rect
:bind
("<next> c r" . copy-rectangle-as-kill)
("<next> k r" . kill-rectangle)
("<next> s r" . string-rectangle)
("<next> y r" . yank-rectangle))
(use-package register
:bind
("<next> r c" . copy-to-register)
("<next> r i" . insert-register))
(use-package rich-minority
:init
(setq
rm-whitelist "^↑$"
rm-text-properties '(("^↑$" 'face 'font-lock-doc-face)))
:config
(rich-minority-mode 1))
(use-package ripgrep
:demand
:commands (ripgrep-regexp)
:bind
("<next> g r" . mk-grep))
(use-package scroll-bar
:demand
:config
(scroll-bar-mode 0))
(use-package server
:demand
:config
(unless (server-running-p)
(server-start))
:bind
("<next> s e" . server-edit))
(use-package sgml-mode
:mode
("\\.tpl$" . html-mode)
("\\.mustache$" . html-mode))
(use-package simple
:demand
:init
(setq
blink-matching-delay 0.5
blink-matching-paren 'jump-offscreen
kill-read-only-ok t
suggest-key-bindings nil)
:preface
(defun mk-auto-fill-mode ()
"Enable ‘auto-fill-mode’ limiting it to comments."
(setq-local comment-auto-fill-only-comments t)
(auto-fill-mode 1))
:config
(column-number-mode 1)
:bind
("C-." . undo)
("C-j" . newline)
("M-h" . mark-word)
("<up>" . beginning-of-buffer)
("<down>" . end-of-buffer)
("<home>" . find-file)
("<end>" . save-buffer)
("<next> a f" . auto-fill-mode)
("<next> c w" . count-words)
("<next> e ;" . eval-expression)
("<next> l l" . list-processes)
("<next> s a" . mark-whole-buffer)
:hook
((gitignore-mode . mk-auto-fill-mode)
(haskell-cabal-mode . mk-auto-fill-mode)
(prog-mode . mk-auto-fill-mode)
(proof-mode . mk-auto-fill-mode)
(text-mode . auto-fill-mode)
(yaml-mode . mk-auto-fill-mode)))
(use-package smart-mode-line
:config
(let ((sml/no-confirm-load-theme t))
(sml/setup)))
(use-package smartparens
:demand
:commands
(sp-backward-kill-sexp
sp-backward-sexp
sp-kill-sexp
sp-forward-sexp
sp-select-next-thing
sp-kill-hybrid-sexp
sp-add-to-previous-sexp)
:init
(setq
sp-highlight-pair-overlay nil
sp-highlight-wrap-overlay nil
sp-highlight-wrap-tag-overlay nil)
:config
(smartparens-global-mode 1)
(advice-add 'sp-add-to-previous-sexp :after (lambda () (just-one-space)))
(advice-add 'sp-add-to-previous-sexp :after (lambda () (sp-forward-sexp)))
(add-to-list 'sp-no-reindent-after-kill-modes 'haskell-cabal-mode)
(add-to-list 'sp-no-reindent-after-kill-modes 'haskell-mode)
:bind
(:map
smartparens-mode-map
("<C-backspace>" . sp-backward-kill-sexp)
("M-b" . sp-backward-sexp)
("M-d" . sp-kill-sexp)
("M-f" . sp-forward-sexp)
("M-h" . sp-select-next-thing)
("M-k" . sp-kill-hybrid-sexp)
("M-t" . sp-add-to-previous-sexp)))
(use-package swiper
:bind
("C-s" . swiper))
(use-package tabify
:preface
(defun mk-untabify ()
"Untabify the current buffer."
(interactive)
(untabify (point-min) (point-max)))
:bind
("<next> u t" . mk-untabify))
(use-package time
:demand
:init
(setq
display-time-24hr-format t
display-time-default-load-average nil)
:config
(display-time-mode 1))