aboutsummaryrefslogtreecommitdiff
path: root/bard-emacs-modules/bard-emacs-keyboard.el
blob: 350c3f4b3b3461c9d5eea1187e01f5039c7c6bd2 (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
(require 'bard-ryo)

(use-package hydra
  :ensure t
  :config
  )

(use-package ryo-modal
  :ensure t
  :bind (("C-c SPC" . ryo-modal-mode)
         ("<escape>" . ryo-modal-mode))
  :config
  (setq-default cursor-type '(bar . 2))
  (setq ryo-modal-cursor-type 'box)
  (ryo-modal-keys
   ("," ryo-modal-repeat)
   ("f" ryo-modal-mode)
   ;; movement
   ("i" previous-line)
   ("j" backward-char)
   ("k" next-line)
   ("l" forward-char)
   ;; word movement
   ("o" forward-word)
   ("u" backward-word)

   ;; sexp movement
   ("(" backward-sexp)
   (")" forward-sexp)

   ;; deletion
   ("e" backward-kill-word)
   ("r" kill-word)
   ("d" backward-delete-char)

   ;; copy/paste/cut
   ("x" kill-region)
   ("c" kill-ring-save)
   ("v" yank)

   ("s" open-line)
   ("y" undo)
   ("t" set-mark-command)

   ;; searching
   ("n" isearch-forward)
   ("N" isearch-backward)

   ;; command mode
   ("a" "M-x")

   ;;window management
   ("1" delete-other-windows)
   ("2" split-window-below)
   ("3" split-window-right))

  (define-key global-map (kbd "C-<SPC>") nil)

  (ryo-modal-key
   "SPC"
   '(("SPC" ryo-modal-mode)
     ("w" save-buffer)
     ("j" dired-jump)
     ("f" find-file)
     ("m" pop-to-mark-command)))

  (ryo-modal-key
   "SPC r" :hydra
   '(hydra-replace ()
                      "Replace/Substitute hydra"
                      ("a" substitute-target-above-point "above")
                      ("b" substitute-target-below-point "below")
                      ("d" substitute-target-in-defun "defun")
                      ("s" substitute-target-in-buffer "buffer")
                      ("r" query-replace-regexp "regexp"))
   :norepeat t)

  (ryo-modal-key
   "SPC n" :hydra
   '(hydra-denote ()
                  "Denote hydra"
                  ("n" denote "new note")
                  ("<SPC>" denote-region "note region")
                  ("o" denote-sort-dired "sort dired")
                  ("j" denote-journal-extras-new-entry "journal")
                  ("r" denote-rename-file-using-front-matter "rename note")
                  ("k" denote-rename-file-keywords "edit keywords")
                  ("i" denote-link "insert link")
                  ("I" denote-add-links "insert listed links")
                  ("b" denote-backlinks "list backlinks")
                  ("f" bard/find-notes-file "find in notes")
                  ("s" bard/search-notes-directory "search in notes")
                  ("l" denote-find-link "list links")
                  ("L" denote-find-backlink "list backlinks")
                  ("q" nil "cancel" :color red)
                  )
   :norepeat t)

  (ryo-modal-key
   "SPC s" :hydra
   '(hydra-consult ()
                  "Consult hydra"
                  ("f" consult-find "find")
                  ("g" consult-grep "grep")
                  ("k" consult-kmacro "kmacro")
                  ("o" consult-outline "outline")
                  ("r" consult-register "register")
                  ("l" consult-line "search file")
                  ("q" nil "cancel" :color red))
   :norepeat t)

  (ryo-modal-key
   "SPC o" :hydra
   '(hydra-open ()
                "Open hydra"
                ("a" bard/default-agenda "agenda")
                ("c" calendar "calendar")
                ("g" magit-status "git")
                ("m" notmuch "mail")
                ("q" nil "cancel" :color red)
                ("r" elfeed "rss")
                ("w" eww "web browser")
                ("x" org-capture "capture"))
   :norepeat t)

  (ryo-modal-key
   "SPC t" :hydra
   '(hydra-tab ()
               "Tab hydra"
               ("0" tab-close "close")
               ("1" tab-close-other "delete others")
               ("2" tab-new "new")
               ("t" tab-next "next")
               ("T" tab-next "prev")
               ("d" dired-other-tab "dired tab")
               ("q" nil "cancel" :color red))
   :norepeat t)

  (ryo-modal-key
   "SPC b" :hydra
   '(hydra-buffer ()
               "Buffer hydra"
               ("k" kill-buffer "kill buffer")
               ("b" consult-buffer "switch-buffer")
               ("l" ibuffer "buffer list")
               ("q" nil "cancel" :color red))
   :norepeat t)

  )

(provide 'bard-emacs-keyboard)