summaryrefslogtreecommitdiffstats
path: root/lisp/init-editing.el
blob: 20392b9983e4877a2ec52fc92617f7a1e6cd2b09 (plain) (blame)
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
;;; init-editing.el --- configure editing bindings and behaviour  -*- lexical-binding:t -*-
;;; Commentary:
;;; Code:

;; enable subword-mode in prog-mode
(use-package subword
  :diminish subword-mode
  :hook ((prog-mode . subword-mode)))

;; M-z runs zap-up-to-char instead of zap-to-char
(global-set-key (kbd "M-z") 'zap-up-to-char)

;; C-c @ opens a simple calculator
(global-set-key (kbd "C-c @") 'quick-calc)

;; M-j joins line
(global-set-key (kbd "M-j") 'join-line)

;; C-c d duplicates the current line or region
(global-set-key (kbd "C-c d") 'duplicate-dwim)

;; C-c n renames visited file
(global-set-key (kbd "C-c n") 'rename-visited-file)

;; C-x k kills current buffer
(global-set-key (kbd "C-x k") 'kill-current-buffer)

;; C-- undoes
(global-set-key (kbd "C--") 'undo)

;; use dwim variants when changing case
(global-set-key (kbd "M-u") 'upcase-dwim)
(global-set-key (kbd "M-l") 'downcase-dwim)
(global-set-key (kbd "M-c") 'capitalize-dwim)

;; kill line also kills newline character
(setq kill-whole-line t)

;; yank discards all text properties
(setq yank-excluded-properties t)

(provide 'init-editing)

;;; init-editing.el ends here