blob: b9318a57780c67129c53f0107a1b56fdae6b25ee (
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
|
;; Time-stamp: <2020-03-28 13:02:05 (tslil@bison)>
;; -------------------------------------------------------------------
;; Repeated key presses for region, deletion, and movement
(use-package expand-region :ensure t
:bind ("C-r" . er/expand-region)
:config
(setq expand-region-fast-keys-enabled t
expand-region-contract-fast-key "c"
expand-region-reset-fast-key "e"
expand-region-autocopy-register "i"))
(use-package viking-mode
:disabled
:after expand-region
:bind (:map viking-mode-map
("C-d" . nil)
("C-c d" . viking-kill-thing-at-point))
:config
(setq viking-use-expand-region-when-loaded t
viking-really-delete nil)
(viking-global-mode))
;; (defun goto-begin-dwim ()
;; "Read the source."
;; (interactive)
;; (let ((iter (viking-last-key-repeats))
;; (lisp (memq major-mode '(emacs-lisp-mode
;; lisp-mode
;; scheme-mode
;; slime-repl-mode))))
;; (if lisp
;; (cond
;; ((= iter 1) (back-to-indentation))
;; ((= iter 2) (backward-sexp))
;; ((= iter 3) (beginning-of-defun))
;; (t (beginning-of-defun 1)))
;; (cond
;; ((= iter 1) (back-to-indentation))
;; ((= iter 2) (beginning-of-line))
;; ((= iter 3) (backward-paragraph))
;; (t (goto-char (point-min)))))))
;; (defun goto-end-dwim ()
;; "Read the source."
;; (interactive)
;; (let ((iter (viking-last-key-repeats))
;; (lisp (memq major-mode '(emacs-lisp-mode lisp-mode scheme-mode slime-repl-mode))))
;; (if lisp
;; (cond
;; ((= iter 1) (end-of-line))
;; ((= iter 2) (end-of-defun))
;; (t (end-of-defun 1)))
;; (if (< (point) (point-at-eol)) (end-of-line)
;; (forward-paragraph)))))
;; (global-set-key (kbd "C-a") 'goto-begin-dwim)
;; (global-set-key (kbd "C-e") 'goto-end-dwim)
;; -------------------------------------------------------------------
;; Window switching
(use-package switch-window :ensure t
:bind (("C-x o" . switch-window)
("C-x C-o" . other-frame)
("C-c o" . switch-window)
("C-c n" . switch-window-then-maximize)
:map switch-window-extra-map
("u" . switch-window-mvborder-up)
("e" . switch-window-mvborder-down)
("n" . switch-window-mvborder-left)
("o" . switch-window-mvborder-right)
("i" . nil)
("j" . nil)
("k" . nil)
("l" . nil))
:config
(setq switch-window-input-style 'minibuffer
switch-window-shortcut-style 'qwerty
switch-window-multiple-frames nil
switch-window-qwerty-shortcuts
'("a" "s" "t" "h" "n" "e" "o" "i" "d" "r" "w" "f" "u" "p")))
;; -------------------------------------------------------------------
;; Character jumping
(use-package avy
:ensure t
:demand
:bind (("C-," . avy-goto-char-timer)
("C-." . avy-goto-char-in-line)
("M-g s" . avy-goto-word-or-subword-1)
("M-g w" . avy-goto-word-1)
("M-g a" . avy-goto-word-0)
("M-g M-g" . avy-goto-line))
:config
(setq avy-keys '(?a ?s ?t ?h ?n ?e ?o ?i ?d ?r ?u ?p)
avy-dispatch-alist '((?w . avy-action-kill-move)
(?W . avy-action-kill-stay)
(?j . avy-action-teleport)
(?m . avy-action-mark)
(?c . avy-action-copy)
(?y . avy-action-yank)
(?i . avy-action-ispell)
(?z . avy-action-zap-to-char))))
;; -------------------------------------------------------------------
;; General stuff
(global-set-key (kbd "C-M-e") 'end-of-buffer)
(global-set-key (kbd "C-M-a") 'beginning-of-buffer)
(global-set-key (kbd "M-h") 'backward-kill-word)
(global-set-key (kbd "M-z") 'zap-up-to-char)
;; Fast movement
(global-set-key (kbd "M-n") 'scroll-up-command)
(global-set-key (kbd "M-p") 'scroll-down-command)
(global-set-key (kbd "C-S-n")
(lambda () (interactive) (ignore-errors (forward-line 5))))
(global-set-key (kbd "C-S-p")
(lambda () (interactive) (ignore-errors (forward-line -5))))
(global-set-key (kbd "C-S-f")
(lambda () (interactive) (ignore-errors (forward-char 5))))
(global-set-key (kbd "C-S-b")
(lambda () (interactive) (ignore-errors (backward-char 5))))
;; Hardcore mode
(defconst hardcore-nav-mode t)
(when hardcore-nav-mode
(global-set-key (kbd "<XF86Back>") nil)
(global-set-key (kbd "<XF86Forward>") nil)
(global-set-key (kbd "<right>") nil)
(global-set-key (kbd "<left>") nil)
(global-set-key (kbd "<up>") nil)
(global-set-key (kbd "<down>") nil)
(global-set-key (kbd "S-<right>") nil)
(global-set-key (kbd "S-<left>") nil)
(global-set-key (kbd "S-<up>") nil)
(global-set-key (kbd "C-<down>") nil)
(global-set-key (kbd "C-<right>") nil)
(global-set-key (kbd "C-<left>") nil)
(global-set-key (kbd "C-<up>") nil)
(global-set-key (kbd "C-<down>") nil)
(global-set-key (kbd "<Home>") nil)
(global-set-key (kbd "<End>") nil))
|