From 75dfe61a72f41c55b281bc81aa2e8b6e708a6124 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 26 Jan 2021 14:38:46 +0100 Subject: gkleen@sif: fancier emacs --- accounts/gkleen@sif/default.nix | 1 + accounts/gkleen@sif/emacs.el | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) (limited to 'accounts') 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 { nix-mode yaml-mode json-mode shakespeare-mode smart-mode-line highlight-parentheses highlight-symbol notmuch ag sass-mode lua-mode fira-code-mode + use-package use-package-ensure-system-package git-gutter ]; }; 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 @@ (scroll-bar-mode -1) (tool-bar-mode -1) +(setq inhibit-startup-message t) +(defalias 'yes-or-no-p 'y-or-n-p) + (set-face-attribute 'default nil :font "FiraCode Nerd Font Mono" :height 49) +(require 'package) +(setq package-archives nil) +(package-initialize) +(require 'use-package) +(use-package use-package-ensure-system-package :ensure t) + (require 'evil) (evil-mode 1) -(setq evil-undo-system 'undo-tree) (global-subword-mode) (global-undo-tree-mode) (global-fira-code-mode) +(evil-set-undo-system 'undo-tree) + (global-set-key (kbd "RET") 'newline-and-indent) (global-set-key (kbd "M-g") 'magit-status) (global-set-key (kbd "M-?") 'vc-git-grep) +(require 'git-gutter) +(global-git-gutter-mode t) +(custom-set-variables '(git-gutter:update-interval 2)) +(custom-set-variables '(git-gutter:hide-gutter t)) + (setq backup-directory-alist `(("." . "~/.saves"))) (setq undo-tree-history-directory-alist `(("." . "~/.undo"))) (setq delete-old-versions t @@ -46,6 +61,27 @@ (setq undo-tree-auto-save-history t) +(defvar expand-file-name-custom-tilde-alist '()) +(defun my/add-to-tilde-alist (hash) + (let* ((tilde:dir (split-string hash "=")) + (tilde (car tilde:dir)) + (dir (cadr tilde:dir))) + (push (cons tilde dir) expand-file-name-custom-tilde-alist))) +(mapc #'my/add-to-tilde-alist + (split-string (with-output-to-string + (call-process "zsh" nil standard-output nil "-ic" "hash -d")) + "\n" t)) + +(defadvice expand-file-name (before expand-file-name-custom-tilde + (name &optional default-directory) + activate compile) + "User-defined expansions for ~NAME in file names." + (save-match-data + (when (string-match "\\`\\(\\(.*/\\)?~\\([^:/]+\\)\\)/" name) + (let ((replacement (assoc (match-string 3 name) expand-file-name-custom-tilde-alist))) + (when replacement + (setq name (replace-match (cdr replacement) t t name 1))))))) + (setq notmuch-address-internal-completion '(received nil)) (setq notmuch-always-prompt-for-sender t) (setq notmuch-command "notmuch-ssh") -- cgit v1.2.3