Skip to content

Latest commit

 

History

History
169 lines (128 loc) · 5.89 KB

buffer-management.org

File metadata and controls

169 lines (128 loc) · 5.89 KB

Buffers and Navigation

Listing buffers, opening buffers, moving around buffers, colours of buffers, other things about buffers. And undo for some reason…

Buffer List

List buffers using Bufler which groups buffers by project without any extra configuration which is great. It also uses Magit keybindings for navigation.

(use-package bufler
  :commands (bufler)
  :init
  (bind-key "C-x C-b" 'bufler))

Controlling New Buffers

Controlling what happens when a buffer is popped up ventures into swiss-army chainsaw territory. It explained really well in the ‘Controlling Buffer and Window Display’ section of this excellent article. Currently just ensure help windows don’t pop up all over the place.

(setq display-buffer-alist '((eq major-mode "helpful-mode")
                             (display-buffer-reuse-mode-window)))

Window Navigation

Ace Window allows jumping between numbered windows which is useful when there are more than a couple to navigate.

(use-package ace-window :bind ("C-x o" . ace-window))

(use-package winum
  :bind (("M-1" . winum-select-window-1)
         ("M-2" . winum-select-window-2)
         ("M-3" . winum-select-window-3)
         ("M-4" . winum-select-window-4))
  :config
  (winum-mode))

PDF Buffers

(use-package pdf-tools
  :config
  (pdf-tools-install :no-query)
  (define-key pdf-view-mode-map (kbd "C-s") 'isearch-forward))

Buffer Navigation

(use-package avy
  :bind (("C-x l" . #'avy-goto-line)
         ("C-x j" . #'avy-goto-char-timer)
         ("C-x v" . #'avy-goto-word-1)))

Colour Theme

I find themes fiddly so just stick with using solarized dark mostly. Base 16 Emacs has a version which is nice enough. I apply a few minor tweaks to it, like changing the horrible red cursor to something less scary. The config is in a function so if I do change theme while running (I quite like the modus ones sometimes and I’ve just discovered the Nord colour scheme) I can change back without the red cursor returning from the depths to haunt me once again.

(use-package base16-theme
  :init
  (load-theme 'base16-solarized-dark t)
  :config
  (defun mjr/configure-base16-solarized-dark ()
    (interactive)
    (setq base16-theme-distinct-fringe-background nil)
    (setq base16-solarized-dark-theme-colors
          (plist-put base16-solarized-dark-theme-colors ':base09 "#586e75"))
    (set-face-attribute 'mode-line nil :background
                        (plist-get base16-solarized-dark-theme-colors ':base01))
    (face-spec-set 'font-lock-variable-name-face
                   `((t :foreground ,(plist-get base16-solarized-dark-theme-colors ':base06))) 'face-override-spec)
    (set-face-attribute 'org-document-title nil :weight 'bold :foreground "#eee8d5" :background "#002b36" :inverse-video nil :weight 'bold :height 1.5)
    (set-face-attribute 'org-level-1 nil :inverse-video t :weight 'semibold)
    (set-face-attribute 'org-level-2 nil :weight 'semibold)
    (set-face-attribute 'org-block-begin-line nil :background "#002b36")
    (set-face-attribute 'org-block nil :background "#002b36")
    (set-face-attribute 'org-block-end-line nil :background "#002b36")
    (set-cursor-color (plist-get base16-solarized-dark-theme-colors ':base02)))

  (mjr/configure-base16-solarized-dark))

(use-package modus-themes
  :config
  (setq modus-themes-org-blocks 'gray-background
        modus-themes-bold-constructs t
        modus-themes-italic-constructs t
        modus-themes-mixed-fonts t)

  (setq modus-themes-headings
        '((0 . (1.2))
          (1 . (1))
          (2 . (semibold))))

  (setq modus-vivendi-tinted-palette-overrides
        '((border-mode-line-active unspecified)
          (border-mode-line-inactive unspecified)
          (bg-main "#1e1e1e")
          (bg-heading-1 blue-faint)
          (fg-heading-1 bg-main))))

Undo

(use-package undo-tree
  :init
  (global-undo-tree-mode)
  (unbind-key "C-/" global-map)
  (unbind-key "C-?" global-map)
  :bind
  ("C-_" . undo-tree-undo)
  ("M-_" . undo-tree-redo)
  :config
  (unbind-key "C-/" undo-tree-map)
  (unbind-key "C-?" undo-tree-map)
  (setq undo-tree-history-directory-alist '(("." . "~/.emacs.d/undo")))
  (setq undo-tree-visualizer-timestamps t
        undo-tree-visualizer-diff t))

Icons

Add icons so we can pretend we live in the modern world. We can also use these in completion candidates which is configured here

(use-package all-the-icons :if (display-graphic-p))

(use-package all-the-icons-dired
  :after all-the-icons
  :hook (dired-mode . all-the-icons-dired-mode))

Emojis

https://github.com/iqbalansari/emacs-emojify

(use-package emojify :hook (after-init . global-emojify-mode))