summaryrefslogtreecommitdiff
path: root/emacs-config.org
blob: 47d793cf11d5eb76c9c53531686511ed8d8efd07 (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
#+title: Emacs Config
#+property: header-args:elisp :mkdirp yes :results silent :padline no
#+property: header-args:elisp+ :tangle "~/.config/emacs/init.el"

* General
** Settings
Quality of life settings.
#+begin_src elisp
  (setq-default
   help-window-select t
   delete-by-moving-to-trash t
   sentence-end-double-space nil
   confirm-kill-emacs 'yes-or-no-p)
#+end_src

** GUI Bars
Disable GUI bars.
#+begin_src elisp
  (tool-bar-mode -1)
  (menu-bar-mode -1)
  (scroll-bar-mode -1)
#+end_src

** Editor
Tab behaviour settings.
#+begin_src elisp
  (setq-default
   tab-width 4
   tab-always-indent 'complete
   backward-delete-char-untabify-method 'hungry
   indent-tabs-mode nil)
#+end_src

Replace selected region when yanking text.
#+begin_src elisp
  (delete-selection-mode)
#+end_src

Automatically remove trailing whitespace on file-save.
#+begin_src elisp
  (add-hook 'before-save-hook #'whitespace-cleanup)
#+end_src

Set whitespace column length and symbols.
#+begin_src elisp
  (with-eval-after-load 'whitespace
    (setq-default
     whitespace-line-column fill-column
     whitespace-display-mappings '((space-mark ?\s [?·] [?.])
                                   (newline-mark ?\n [?↴ ?\n])
                                   (tab-mark ?\t [?➔ ?\t] [?\\ ?\t]))))
#+end_src

** Theme
Enable theme.
#+begin_src elisp
  (load-theme 'modus-vivendi)
#+end_src

** Completion
Enable completions previews.
#+begin_src elisp
  (add-hook 'prog-mode-hook
            #'completion-preview-mode)
#+end_src

Set completion keybindings.
#+begin_src elisp
  (with-eval-after-load 'completion-preview
    (let ((map completion-preview-active-mode-map))
      (keymap-set map "M-n" #'completion-preview-next-candidate)
      (keymap-set map "M-p" #'completion-preview-prev-candidate)))
#+end_src

** Which-key
Enable which-key that displays a pop-up window of posisble keybindings sequences.
#+begin_src elisp
  (which-key-mode)
#+end_src

* Global Keybindings
File actions.
#+begin_src elisp
  (keymap-global-set "C-x x R" #'rename-visited-file)
  (keymap-global-set "C-x x D" #'delete-file)
#+end_src

Window actions.
#+begin_src elisp
  (keymap-global-set "M-O" #'window-swap-states)
  (keymap-global-set "M-o" #'other-window)
#+end_src

Improve region text manipulation.
#+begin_src elisp
  (keymap-global-set "M-c" #'capitalize-dwim)
  (keymap-global-set "M-l" #'downcase-dwim)
  (keymap-global-set "M-u" #'upcase-dwim)
#+end_src