Git Product home page Git Product logo

dot-emacs's Introduction

Emacs Config

My personal emacs configuration.

TODOs

  • Clean up the mess that is my config.
  • Eliminate the need for modifier keys. I should be able to do everything without the use of Ctrl
  • Add key bind to traverse up in vertico while finding a file.
  • Change terminal to one that works well with god-mode.

Preamble

Lexical scope

Inspired by this blog post. Adds lexical scope to the configuration.

;; -*- coding: utf-8; lexical-binding: t -*-

Helper Functions

Different functions to do common tasks.

; A function I can hook to different modes when I don't want line numbers.
(defun mjalen/remove_line_numbers ()
  (interactive)
  (display-line-numbers-mode 0))

Misc.

Get rid of a bunch of UI, we don’t need it!

 (setq inhibit-startup-screen t
	use-package-always-ensure t
	initial-scratch-message nil
	sentence-end-double-space nil
	ring-bell-function 'ignore
	use-dialog-box nil
	mark-even-if-inactive nil
	default-directory "~"
	display-line-numbers-mode 1
	load-prefer-newer t)

 (setq-default indent-tabs-mode nil)
 (menu-bar-mode -1)
 (tool-bar-mode -1)
 (scroll-bar-mode -1)
 (tooltip-mode -1)
 (delete-selection-mode t)

 (use-package exec-path-from-shell
   :init (exec-path-from-shell-initialize))

 (set-charset-priority 'unicode)
 (prefer-coding-system 'utf-8-unix)

 (use-package s)
 (use-package dash)

 (setq read-process-output-max (* 1024 1024))

Garbage Collection

(setq gc-cons-threshold 1000000000
      create-lockfiles nil
      make-backup-files nil
      create-lockfiles nil
      delete-by-moving-to-trash t)

(setq custom-file (make-temp-name "/tmp/")
      custom-safe-themes t)

(use-package recentf
  :config
  (add-to-list 'recentf-exclude "\\elpa")
  (add-to-list 'recentf-exclude "private/tmp")
  (recentf-mode))

; remove whitespace
(add-hook 'before-save-hook #'delete-trailing-whitespace)
(setq require-final-newline t)

Lines

(global-display-line-numbers-mode)
(column-number-mode t)
(setq auto-fill-mode t
      global-visual-fill-column-mode nil)
(global-visual-line-mode t)
(blink-cursor-mode t)
(set-display-table-slot standard-display-table 'wrap ?\ )

(require 'hl-line)

Evil Mode

(use-package evil
  :config
  (evil-mode 1))

Theme

Baseline

I had to switch over to the modus-vivendi theme. It may be ugly, but my eyes feel much better. Future me: the theme has honestly grown on me. It is very pleasant to look at for long periods of time.

(load-theme 'modus-vivendi t)

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

Icons

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

Modeline

A nice modeline that cleans up the clutter.

(use-package diminish
  :config
  (diminish 'visual-line-mode))

(use-package mood-line
  :config (mood-line-mode))

Dimmer

This essentially dims non-active buffers. Makes the current buffer more apparent.

(use-package dimmer
  :custom (dimmer-fraction 0.3)
  :config (dimmer-mode))

Delimiters

Make delimiters and parentheses easier to follow

(use-package paren
  :config (show-paren-mode)
  :custom (show-paren-style 'expression))

(use-package rainbow-delimiters
  :hook ((prog-mode . rainbow-delimiters-mode)))

Fonts

(add-to-list 'default-frame-alist '(font . "Victor Mono"))
(set-frame-font "Victor Mono")

Indent Guides

(use-package highlight-indent-guides
  :custom
  (highlight-indent-guides-method 'bitmap)
  :config
  (set-face-background 'highlight-indent-guides-odd-face "ffffff")
  (set-face-background 'highlight-indent-guides-even-face "ffffff")
  (set-face-foreground 'highlight-indent-guides-character-face "ffffff")
  (add-hook 'prog-mode-hook 'highlight-indent-guides-mode))

Keybinds

;; first we unbind
(-map (lambda (x) (unbind-key x)) '("C-x C-d"
                                    "M-o"
                                    "<mouse-2>"
                                    "<C-wheel-down>"
                                    "<C-wheel-up>"
                                    "s-n"
                                    "C-x C-q"
                                    "C-c C-k"))

(bind-key "C-c /" #'comment-dwim)
(bind-key "C-c C-'" #'org-edit-src-exit)

(use-package which-key
  :init (which-key-mode)
  :diminish which-key-mode
  :config
  (setq which-key-idle-delay 0.2)
  (which-key-enable-god-mode-support))

Completion

I used to use Helm, but it doesn’t really work well with god-mode and was giving me RSI. So I am using vertico now since I can enter god-mode from within it :)

(use-package vertico :init (vertico-mode)) ; Vertical display of completion options.
(use-package orderless) ; Actual completion style.
(use-package marginalia :init (marginalia-mode)) ; Displays margin info to the right of completion options.

(setq read-file-name-completion-ignore-case t
      read-buffer-completion-ignore-case t
      completion-styles '(orderless basic)
      completion-category-defaults '((file (styles basic partial-completion))))

Tools

Snippets

(use-package yasnippet
  :custom
  (yas-snippet-dirs
   '("~/.emacs.d/snippets"))
  :config
  (yas-global-mode 1))

Org

My org mode configuration, so I can live and breathe org.

(use-package org
  :hook
  ((org-mode . variable-pitch-mode)
   (org-mode . visual-line-mode)
   (org-mode . mjalen/remove_line_numbers))
  :bind
  (:map org-mode-map
        ("C-c C-'" . #'org-edit-special)) ; For convenience with god mode. c' instead of c '.
  :config
  (setq org-ellipsis ""
        org-hide-emphasis-markers t
        line-spacing 2
        org-highlight-latex-and-related '(latex script entitles)
        org-list-allow-alphabetical t
        org-startup-indented t
        org-pretty-entities t
        org-use-sub-superscripts "{}"
        org-startup-with-inline-images t
        org-image-actual-width '(300)))

(use-package org-appear :hook (org-mode . org-appear-mode))

(use-package toc-org
  :hook
  ((org-mode . toc-org-mode)
   (markdown-mode . toc-org-mode)))

(use-package org-fragtog
  :after org
  :custom
  (org-startup-with-latex-preview t)
  :hook
  (org-mode . org-fragtog-mode)
  :custom
  (org-format-latex-options
   (plist-put org-format-latex-options :scale 0.8)
   (plist-put org-format-latex-options :foreground 'auto)
   (plist-put org-format-latex-options :background 'auto)))

(use-package org-superstar
  :after org
  :hook (org-mode . org-superstar-mode)
  :custom
  (org-superstar-remove-leading-stars t)
  (org-superstar-headline-bullets-list '("" "" "" "" "" "" "")))

(use-package org-modern
  :hook
  (org-mode . global-org-modern-mode)
  :custom
  (org-modern-keyword nil)
  (org-modern-checkbox nil)
  (org-modern-table nil))

(use-package markdown-mode)

LaTeX

(setq TeX-auto-save t
      Tex-parse-self t)

(setq-default TeX-master nil)

(use-package flyspell)

(add-hook 'TeX-mode-hook 'turn-on-reftex)
(use-package latex-pretty-symbols)

Term

(add-hook 'term-mode-hook 'mjalen/remove_line_numbers)

Nix

(use-package nix-mode
  :mode "\\.nix\\'")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.