dotfiles/common/.config/emacs/user-interface.org
2024-08-11 12:28:22 -05:00

4.3 KiB

Emacs User Interface

Theming

Set up Source Code Pro with Nerd Font patches as default font and Computer Modern as a variable pitch font.

  (defvar jj/mono-font)
  (defvar jj/var-font)
  (pcase system-type
    (`gnu/linux
     (when (eq (system-name) "gentoo"))
     (setq jj/mono-font "SauceCodePro Nerd Font-11")
     (setq jj/var-font "CMU Serif-14"))
    (`darwin
      (setq jj/mono-font "SauceCodePro Nerd Font-14:weight=thin")
      (setq jj/var-font "CMU Serif-18")))
  (add-to-list 'default-frame-alist
               `(font . ,jj/mono-font))

Use my custom Doom Disco light theme.

  (use-package doom-themes
    :straight (doom-themes :type git :host github :repo "doomemacs/themes"
                           :fork (:host github
                                  :repo "JacobJanzen/emacs-doom-themes"))
    :config
    (setq doom-themes-enable-bold t
          doom-themes-enable-italic t)
    (load-theme 'doom-disco t)
    (doom-themes-org-config))

(add-to-list 'default-frame-alist '(alpha-background . 90))

Use doom-modeline for a nicer modeline.

  (use-package doom-modeline
    :init (doom-modeline-mode 1))

Remove the title bar.

  (add-to-list 'default-frame-alist '(undecorated . t))

Clean UI

Disable the Emacs start screen and make the scratch buffer default to empty.

  (setq inhibit-startup-screen t)
  (setq initial-scratch-message nil)

Disable scroll bar, tool bar, and menu bar.

  (scroll-bar-mode -1)
  (tool-bar-mode -1)
  (menu-bar-mode -1)

Fancy Stuff

Use line numbers by default.

  (global-display-line-numbers-mode 1)

Highlight changes for an operation with evil-goggles.

  (use-package evil-goggles
    :after evil
    :config
    (evil-goggles-mode)
    (evil-goggles-use-diff-faces))

Install nerd font icons.

  (use-package nerd-icons)

Scroll one line at a time.

  (setq scroll-conservatively most-positive-fixnum)

Create parent directories when they don't yet exist.

  (defun jj/create-non-existent-directory ()
  (let ((parent-directory (file-name-directory buffer-file-name)))
    (when (and (not (file-exists-p parent-directory))
               (y-or-n-p (format "Directory `%s' does not exist! Create it?" parent-directory)))
      (make-directory parent-directory t))))
  (add-to-list 'find-file-not-found-functions #'jj/create-non-existent-directory)

Whitespace Management

Use spaces over tabs and set tab width to 4.

  (setq-default indent-tabs-mode nil)
  (setq tab-width 4
    c-basic-offset tab-width)

Delete trailing whitespace on save.

  (defun jj/before-save-hook ()
    (unless (eql (with-current-buffer (current-buffer) major-mode)
                  'markdown-mode)
      (delete-trailing-whitespace)))
  (add-hook 'before-save-hook #'jj/before-save-hook)

Backup Management

Don't create backup files.

  (setq make-backup-files nil)

Customize dired

Use nerd font icons in dired.

  (use-package nerd-icons-dired
    :hook (dired-mode . nerd-icons-dired-mode))

Use colours in dired with diredfl.

  (use-package diredfl
    :init (diredfl-global-mode 1))