blob: f0c6a27e674cbf6e4f8f7fb93a44182dab8e9f4e (
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
|
;;; mf-keybindings.el --- Keybinding configuration -*- lexical-binding: t -*-
;;; Code:
(require 'cl-lib)
(declare-function 'magit "magit")
(declare-function 'winner-undo "winner")
(declare-function 'winner-redo "winner")
(defvar mf/leader-prefix-key "C-c"
"Prefix key for my personal keybindings.")
(define-prefix-command 'mf/leader-map)
(cl-defmacro mf/leader (key func &key (mode nil))
"Bind (kbd `mf/leader-prefix-key' KEY) to FUNC in MODE."
(let ((map (intern (concat (symbol-name mode) "-map"))))
(if mode
`(define-key ,map (kbd (concat mf/leader-prefix-key " " ,key)) #',func)
`(define-key 'mf/leader-map (kbd ,key) #',func))))
(mf/leader "C-SPC" execute-extended-command)
(mf/leader "k" kill-current-buffer)
(mf/leader "g" magit)
(mf/leader "C-p" winner-undo)
(mf/leader "C-n" winner-redo)
(mf/leader "RET" emacs-lisp-macroexpand :mode emacs-lisp-mode)
(global-set-key (kbd mf/leader-prefix-key) 'mf/leader-map)
(global-set-key (kbd "C-x w s") #'window-toggle-side-windows)
(global-set-key (kbd "C-M-y") #'duplicate-dwim)
(global-set-key (kbd "M-[") #'backward-paragraph)
(global-set-key (kbd "M-]") #'forward-paragraph)
(define-key emacs-lisp-mode-map (kbd "C-c C-c") #'eval-defun)
;; Quit help buffers and kill the window at the same time
(with-eval-after-load 'help-mode
(define-key help-mode-map (kbd "q") #'kill-current-buffer))
(mf/install ace-window
(setq aw-keys (list ?a ?o ?e ?u ?i)))
(ace-window-display-mode 1)
(global-set-key (kbd "C-x o") #'ace-window)
(mf/install avy
(setq avy-keys (list ?a ?o ?e ?u ?i)))
(provide 'mf-keybindings)
;;; mf-keybindings.el ends here
|