diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2021-01-26 14:38:46 +0100 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2021-01-26 14:38:46 +0100 |
commit | 75dfe61a72f41c55b281bc81aa2e8b6e708a6124 (patch) | |
tree | dd16a4638648d771245d30c47106c22d047336f0 /accounts/gkleen@sif | |
parent | 6a72f2ad6d62d58081971dc8a90f0a07262fa96a (diff) | |
download | nixos-75dfe61a72f41c55b281bc81aa2e8b6e708a6124.tar nixos-75dfe61a72f41c55b281bc81aa2e8b6e708a6124.tar.gz nixos-75dfe61a72f41c55b281bc81aa2e8b6e708a6124.tar.bz2 nixos-75dfe61a72f41c55b281bc81aa2e8b6e708a6124.tar.xz nixos-75dfe61a72f41c55b281bc81aa2e8b6e708a6124.zip |
gkleen@sif: fancier emacs
Diffstat (limited to 'accounts/gkleen@sif')
-rw-r--r-- | accounts/gkleen@sif/default.nix | 1 | ||||
-rw-r--r-- | accounts/gkleen@sif/emacs.el | 38 |
2 files changed, 38 insertions, 1 deletions
diff --git a/accounts/gkleen@sif/default.nix b/accounts/gkleen@sif/default.nix index 79824844..9dbe4634 100644 --- a/accounts/gkleen@sif/default.nix +++ b/accounts/gkleen@sif/default.nix | |||
@@ -34,6 +34,7 @@ in { | |||
34 | nix-mode yaml-mode json-mode shakespeare-mode | 34 | nix-mode yaml-mode json-mode shakespeare-mode |
35 | smart-mode-line highlight-parentheses highlight-symbol | 35 | smart-mode-line highlight-parentheses highlight-symbol |
36 | notmuch ag sass-mode lua-mode fira-code-mode | 36 | notmuch ag sass-mode lua-mode fira-code-mode |
37 | use-package use-package-ensure-system-package git-gutter | ||
37 | ]; | 38 | ]; |
38 | }; | 39 | }; |
39 | firefox = { | 40 | firefox = { |
diff --git a/accounts/gkleen@sif/emacs.el b/accounts/gkleen@sif/emacs.el index a304703b..d7080e36 100644 --- a/accounts/gkleen@sif/emacs.el +++ b/accounts/gkleen@sif/emacs.el | |||
@@ -2,20 +2,35 @@ | |||
2 | (scroll-bar-mode -1) | 2 | (scroll-bar-mode -1) |
3 | (tool-bar-mode -1) | 3 | (tool-bar-mode -1) |
4 | 4 | ||
5 | (setq inhibit-startup-message t) | ||
6 | (defalias 'yes-or-no-p 'y-or-n-p) | ||
7 | |||
5 | (set-face-attribute 'default nil :font "FiraCode Nerd Font Mono" :height 49) | 8 | (set-face-attribute 'default nil :font "FiraCode Nerd Font Mono" :height 49) |
6 | 9 | ||
10 | (require 'package) | ||
11 | (setq package-archives nil) | ||
12 | (package-initialize) | ||
13 | (require 'use-package) | ||
14 | (use-package use-package-ensure-system-package :ensure t) | ||
15 | |||
7 | (require 'evil) | 16 | (require 'evil) |
8 | (evil-mode 1) | 17 | (evil-mode 1) |
9 | (setq evil-undo-system 'undo-tree) | ||
10 | 18 | ||
11 | (global-subword-mode) | 19 | (global-subword-mode) |
12 | (global-undo-tree-mode) | 20 | (global-undo-tree-mode) |
13 | (global-fira-code-mode) | 21 | (global-fira-code-mode) |
14 | 22 | ||
23 | (evil-set-undo-system 'undo-tree) | ||
24 | |||
15 | (global-set-key (kbd "RET") 'newline-and-indent) | 25 | (global-set-key (kbd "RET") 'newline-and-indent) |
16 | (global-set-key (kbd "M-g") 'magit-status) | 26 | (global-set-key (kbd "M-g") 'magit-status) |
17 | (global-set-key (kbd "M-?") 'vc-git-grep) | 27 | (global-set-key (kbd "M-?") 'vc-git-grep) |
18 | 28 | ||
29 | (require 'git-gutter) | ||
30 | (global-git-gutter-mode t) | ||
31 | (custom-set-variables '(git-gutter:update-interval 2)) | ||
32 | (custom-set-variables '(git-gutter:hide-gutter t)) | ||
33 | |||
19 | (setq backup-directory-alist `(("." . "~/.saves"))) | 34 | (setq backup-directory-alist `(("." . "~/.saves"))) |
20 | (setq undo-tree-history-directory-alist `(("." . "~/.undo"))) | 35 | (setq undo-tree-history-directory-alist `(("." . "~/.undo"))) |
21 | (setq delete-old-versions t | 36 | (setq delete-old-versions t |
@@ -46,6 +61,27 @@ | |||
46 | 61 | ||
47 | (setq undo-tree-auto-save-history t) | 62 | (setq undo-tree-auto-save-history t) |
48 | 63 | ||
64 | (defvar expand-file-name-custom-tilde-alist '()) | ||
65 | (defun my/add-to-tilde-alist (hash) | ||
66 | (let* ((tilde:dir (split-string hash "=")) | ||
67 | (tilde (car tilde:dir)) | ||
68 | (dir (cadr tilde:dir))) | ||
69 | (push (cons tilde dir) expand-file-name-custom-tilde-alist))) | ||
70 | (mapc #'my/add-to-tilde-alist | ||
71 | (split-string (with-output-to-string | ||
72 | (call-process "zsh" nil standard-output nil "-ic" "hash -d")) | ||
73 | "\n" t)) | ||
74 | |||
75 | (defadvice expand-file-name (before expand-file-name-custom-tilde | ||
76 | (name &optional default-directory) | ||
77 | activate compile) | ||
78 | "User-defined expansions for ~NAME in file names." | ||
79 | (save-match-data | ||
80 | (when (string-match "\\`\\(\\(.*/\\)?~\\([^:/]+\\)\\)/" name) | ||
81 | (let ((replacement (assoc (match-string 3 name) expand-file-name-custom-tilde-alist))) | ||
82 | (when replacement | ||
83 | (setq name (replace-match (cdr replacement) t t name 1))))))) | ||
84 | |||
49 | (setq notmuch-address-internal-completion '(received nil)) | 85 | (setq notmuch-address-internal-completion '(received nil)) |
50 | (setq notmuch-always-prompt-for-sender t) | 86 | (setq notmuch-always-prompt-for-sender t) |
51 | (setq notmuch-command "notmuch-ssh") | 87 | (setq notmuch-command "notmuch-ssh") |