blob: 3f60222dfeb9b62fc44f594bfa86b657ec40b62d (
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
|
#+TITLE: mms's Emacs Config - Keyboard configuration
#+AUTHOR: MichaĆ Sapka (https://michal.sapka.me)
#+STARTUP: showall indent logdoneGeneral settings
#+HUGO_BASE_DIR: ~/ghq/vcs.sapka.me/michal-sapka-me/
#+HUGO_WEIGHT: 10
#+HUGO_SECTION: emacs/config
#+HUGO_CATEGORIES: emacs emacs-config
#+HUGO_MENU :menu "emacs-config"
#+HUGO_CUSTOM_FRONT_MATTER: :abstract "My emacs config - keyboard config"
#+HUGO_CUSTOM_FRONT_MATTER: :menu-abstract "evil mode, basic key bindings and misc"
#+EXPORT_FILE_NAME: keyboard
* Which key
WK adds a on-the-fly cheatsheet.
#+begin_src emacs-lisp
(use-package which-key
:ensure t
:config
(which-key-mode))
#+end_src
* Xah Lee Flykeys
#+begin_src emacs-lisp
;; (use-package xah-fly-keys
;; :config
;; (xah-fly-keys-set-layout "qwerty")
;; (xah-fly-keys 1)
;;
;; (define-key xah-fly-command-map (kbd "SPC i o") 'consult-bookmark)
;; (define-key xah-fly-command-map (kbd "SPC i f") 'consult-find)
;; (define-key xah-fly-command-map (kbd "SPC i F") 'find-file)
;; (define-key xah-fly-command-map (kbd "SPC i g") 'consult-ripgrep)
;; (
;; load-file "~/.emacs.d/ext/xah-fk-org.el")
;; )
#+end_src
* Avy
Avy is a quick jump-to-place package.
I use it in a very basic way.
#+begin_src emacs-lisp
;; (use-package avy
;; :ensure t)
;; :after xah-fly-keys
;; :config
;; (define-key xah-fly-command-map (kbd "-") 'avy-goto-char-timer)
;; )
#+end_src
* VI keys
#+begin_src emacs-lisp
(use-package evil
:ensure t
:init
:config
(evil-mode 1))
(use-package general
:ensure t
:config
(general-evil-setup))
(elpaca-wait)
#+end_src
#+begin_src emacs-lisp
(use-package fzf
:config
(setq fzf/args "-x --color bw --print-query --margin=1,0 --no-hscroll"
fzf/executable "fzf"
fzf/git-grep-args "-i --line-number %s"
;; command used for `fzf-grep-*` functions
;; example usage for ripgrep:
;; fzf/grep-command "rg --no-heading -nH"
fzf/grep-command "grep -nrH"
;; If nil, the fzf buffer will appear at the top of the window
fzf/position-bottom t
fzf/window-height 15))
#+end_src
#+begin_src emacs-lisp
(general-create-definer my-leader-def
:keymaps 'override
:prefix "SPC"
:states '(normal motion emacs))
;; Git
(my-leader-def "g" 'magit)
;; Navigation
(my-leader-def "io" 'consult-bookmark)
(my-leader-def "ib" 'bookmark-set)
(my-leader-def "if" 'fzf-git-files)
(my-leader-def "ig" 'fzf-grep-dwim-with-narrowing)
;; (define-key xah-fly-command-map (kbd "SPC i o") 'consult-bookmark)
;; (define-key xah-fly-command-map (kbd "SPC i f") 'consult-find)
;; (define-key xah-fly-command-map (kbd "SPC i F") 'find-file)
;; (define-key xah-fly-command-map (kbd "SPC i g") 'consult-ripgrep)
;; Email
(my-leader-def "mm" 'notmuch)
#+end_src
#+begin_src emacs-lisp
(general-define-key
:keymaps 'override
"C-h" 'evil-window-left
"C-l" 'evil-window-right
"C-k" 'evil-window-up
"C-j" 'evil-window-down
"C-x h" 'previous-buffer
"C-x l" 'next-buffer)
(general-define-key
:keymaps 'evil-window-map
"x" 'kill-buffer-and-window
"d" 'kill-current-buffer)
#+end_src
|