dotfiles/emacs.d/keybinds.el
Gered 22af19b907 initial emacs.d config
probably a bunch of dumb things in here
2024-12-02 23:56:33 -05:00

31 lines
958 B
EmacsLisp

;; move through windows (aka "panes") with C-arrowkeys
(windmove-default-keybindings 'control)
;; use "normal" (aka. non-default-emacs, or what most other apps do)
;; key bindings for C-z, C-x, C-c and C-v. C-x and C-c only do cut/copy
;; when a region is selected.
(cua-mode)
;; alternative key binding handler for C-g which does the following:
;; - if a region is active, disable it
;; - when the completions buffer is selected, close it
;; - if the minibuffer is open but not focused, close it
;; - otherwise, run keyboard-quit
(defun prot/keyboard-quit-dwim ()
(interactive)
(cond
((region-active-p)
(keyboard-quit))
((derived-mode-p 'completion-list-mode)
(delete-completion-window))
((> (minibuffer-depth) 0)
(abort-recursive-edit))
(t
(keyboard-quit))))
(define-key global-map (kbd "C-g") #'prot/keyboard-quit-dwim)
(global-set-key (kbd "C-x C-S-E") #'eval-buffer)
(global-set-key (kbd "C-c w") #'whitespace-mode)