Emacs: Refactor keybindings.
This commit is contained in:
parent
38f201a68c
commit
53520e3aed
|
@ -1,6 +1,6 @@
|
||||||
;;; early-packages.el --- Packages that need to be loaded early -*- lexical-binding: t; -*-
|
;;; early-packages.el --- Packages that need to be loaded early -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Time-stamp: <2020-03-18T14:51:22+0100>
|
;; Time-stamp: <2020-03-31T02:02:59+0200>
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
|
|
||||||
|
@ -8,8 +8,11 @@
|
||||||
|
|
||||||
(require 'basics/package-management)
|
(require 'basics/package-management)
|
||||||
|
|
||||||
;; Hide minor-mode from modeline.
|
;; Hide minor-mode from modeline, make :diminish work.
|
||||||
(use-package diminish)
|
(use-package diminish)
|
||||||
|
|
||||||
|
;; Bind keys, make :bind work.
|
||||||
|
(use-package bind-key)
|
||||||
|
|
||||||
(provide 'basics/early-packages)
|
(provide 'basics/early-packages)
|
||||||
;;; early-packages.el ends here
|
;;; early-packages.el ends here
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;;; input.el --- Configure behaviour of input devices. -*- lexical-binding: t; -*-
|
;;; input.el --- Configure behaviour of input devices. -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
;; Time-stamp: <2020-03-29T22:58:40+0200>
|
;; Time-stamp: <2020-03-31T03:47:07+0200>
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;; * Setup mouse & keyboard behaviour.
|
;; * Setup mouse & keyboard behaviour.
|
||||||
|
@ -11,6 +11,7 @@
|
||||||
(require 'basics/package-management)
|
(require 'basics/package-management)
|
||||||
|
|
||||||
(use-package emacs
|
(use-package emacs
|
||||||
|
:demand t
|
||||||
:custom ((mouse-wheel-scroll-amount '(1 ((shift) . 1))) ; Scroll 1 line.
|
:custom ((mouse-wheel-scroll-amount '(1 ((shift) . 1))) ; Scroll 1 line.
|
||||||
;; Paste text where the cursor is, not where the mouse is.
|
;; Paste text where the cursor is, not where the mouse is.
|
||||||
(mouse-yank-at-point t)
|
(mouse-yank-at-point t)
|
||||||
|
@ -32,11 +33,7 @@
|
||||||
(if (use-region-p)
|
(if (use-region-p)
|
||||||
(list (region-beginning) (region-end))
|
(list (region-beginning) (region-end))
|
||||||
(list (line-beginning-position)
|
(list (line-beginning-position)
|
||||||
(line-beginning-position 2)))))))
|
(line-beginning-position 2)))))
|
||||||
|
|
||||||
(use-package bind-key
|
|
||||||
:functions (my/delete-word my/backward-delete-word)
|
|
||||||
:config (progn
|
|
||||||
(defun my/delete-word (arg)
|
(defun my/delete-word (arg)
|
||||||
"Delete characters forward until encountering the end of a word.
|
"Delete characters forward until encountering the end of a word.
|
||||||
With ARG, do it that many times."
|
With ARG, do it that many times."
|
||||||
|
@ -44,17 +41,13 @@ With ARG, do it that many times."
|
||||||
(if (use-region-p)
|
(if (use-region-p)
|
||||||
(delete-region (region-beginning) (region-end))
|
(delete-region (region-beginning) (region-end))
|
||||||
(delete-region (point) (progn (forward-word arg) (point)))))
|
(delete-region (point) (progn (forward-word arg) (point)))))
|
||||||
|
|
||||||
(defun my/backward-delete-word (arg)
|
(defun my/backward-delete-word (arg)
|
||||||
"Delete characters backward until encountering the end of a word.
|
"Delete characters backward until encountering the end of a word.
|
||||||
With ARG, do it that many times."
|
With ARG, do it that many times."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(my/delete-word (- arg)))
|
(my/delete-word (- arg))))
|
||||||
(bind-keys
|
:bind (("C-S-<delete>" . fixup-whitespace) ; Reduce whitespace around cursor.
|
||||||
;; Reduce whitespace around cursor to 0 or 1, according to context.
|
("M-<down>" . scroll-up-line) ; Scroll without moving the cursor.
|
||||||
("C-S-<delete>" . fixup-whitespace)
|
|
||||||
;; Scroll without moving the cursor.
|
|
||||||
("M-<down>" . scroll-up-line)
|
|
||||||
("M-<up>" . scroll-down-line)
|
("M-<up>" . scroll-down-line)
|
||||||
;; Delete words without storing them in the kill buffer.
|
;; Delete words without storing them in the kill buffer.
|
||||||
("C-<delete>" . my/delete-word)
|
("C-<delete>" . my/delete-word)
|
||||||
|
@ -65,7 +58,7 @@ With ARG, do it that many times."
|
||||||
("C-S-v" . quoted-insert)
|
("C-S-v" . quoted-insert)
|
||||||
;; C-x C-f will be replaced with projectile-find-file.
|
;; C-x C-f will be replaced with projectile-find-file.
|
||||||
("C-x C-S-f" . find-file)
|
("C-x C-S-f" . find-file)
|
||||||
("C-x F" . find-file)))) ; Workaround for terminals.
|
("C-x F" . find-file))) ; Workaround for terminals.
|
||||||
|
|
||||||
; Multiple cursors.
|
; Multiple cursors.
|
||||||
(use-package multiple-cursors
|
(use-package multiple-cursors
|
||||||
|
|
Loading…
Reference in New Issue
Block a user