scarydoors / .emacs.d

My personal GNU Emacs configuration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scarydoors Emacs Configuration

Introduction

This is my literate Emacs configuration. This leverages the feature-rich org-mode package which allows Emacs to tangle a .org file into an Emacs Lisp file.

I normally use Emacs for development work, and occasionally some text processing work, I’m also trying to start using Emacs as a means of knowledge management.

I mainly use Emacs on my Mac laptop and my Linux machine. I prefer the Mituharu Emacs Port because it integrates quite well with MacOS works well out of the box.

My initialization files

early-init.el

This file runs a lot earlier than init.el. It sets up a couple things for me, disabling unneeded GUI elements and some tweaks that I stole from Doom Emacs.

init.el

This file bootstraps the package of my choice, straight. I use straight because it allows me to have a reproducible configuration and allows me to install packages from other places such as Git repositories.

Package Management

use-package

This package simplifies a lot of aspects when it comes to Emacs configuration such as deferred loading, key bindings, and improves maintainability.

(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
(setq use-package-always-defer t)
(setq use-package-always-ensure t)

General Configuration

Better Defaults

(use-package emacs
  :ensure nil
  :hook ((prog-mode . display-line-numbers-mode)
         (prog-mode . display-fill-column-indicator-mode)
         (prog-mode . subword-mode))
  :init
  (setq inhibit-startup-screen t
        initial-scratch-message nil
        ring-bell-function 'ignore
        sentence-end-double-space nil
        use-dialog-box nil
        use-short-answers t)

  (setq custom-file (expand-file-name "custom.el" user-emacs-directory))

  (setq load-prefer-newer t)

  ;; split vertically by default 
  (setq split-width-threshold 100
        split-height-threshold 60)

  (setq user-full-name "Alan Strauhs"
        user-mail-address "scarydoorsyeah@gmail.com")

  ;; default to utf-8
  (set-charset-priority 'unicode)
  (setq locale-coding-system 'utf-8
        coding-system-for-read 'utf-8
        coding-system-for-write 'utf-8)
  (set-terminal-coding-system 'utf-8)
  (set-keyboard-coding-system 'utf-8)
  (set-selection-coding-system 'utf-8)
  (prefer-coding-system 'utf-8)
  (setq default-process-coding-system '(utf-8-unix . utf-8-unix))
  (setq require-final-newline nil)

  (delete-selection-mode +1)

  (recentf-mode +1)

  (global-set-key (kbd "<escape>") 'keyboard-quit)

  (setq make-backup-files nil
        auto-save-default nil
        create-lockfiles nil)

  (setq vc-follow-symlinks t)

  (winner-mode +1)

  (setq-default indent-tabs-mode nil)
  (setq-default truncate-lines 1)

  (setq-default fill-column 80)

  ;; better scrolling
  (setq scroll-preserve-screen-position 1
        scroll-step 1
        scroll-margin 4
        scroll-conservatively 10000)

  ;; setup line numbers
  (setq-default display-line-numbers-width 4)
  
  (column-number-mode +1)

  (setq initial-major-mode 'org-mode)

  ;; goodbye window dividers
  (window-divider-mode -1)


  (setq frame-title-format nil))

;; hack to enable native fullscreen from startup on yamamoto mac port
(add-hook 'after-init-hook #'(lambda ()
                               (toggle-frame-fullscreen)
                               (toggle-frame-fullscreen)))

System

Ensure Emacs path variable is same as shell

(use-package exec-path-from-shell
  :demand t
  :config
  (when (memq window-system '(mac ns x))
    (exec-path-from-shell-initialize)))

Garbage Collector Hack

(use-package gcmh
  :demand t
  :config
  (gcmh-mode +1))

User Interface

Theme

(use-package doom-themes
  :demand t
  :config
  (setq doom-themes-enable-bold t
        doom-themes-enable-italic t
        doom-themes-treemacs-theme "doom-colors")
  (doom-themes-org-config)
  (doom-themes-treemacs-config))
(setq modus-themes-italic-constructs t
      modus-themes-bold-constructs t
      modus-themes-region '(bg-only no-extend)
      modus-themes-mode-line '(borderless))

;; (load-theme 'modus-operandi)
(use-package ef-themes
  :demand t)

MacOS Theme Hook

(defvar light-theme 'ef-duo-light)
(defvar dark-theme 'ef-duo-dark)
(defun match-current-mac-appearance ()
  (if (string= (shell-command-to-string "printf %s \"$( osascript -e \'tell application \"System Events\" to tell appearance preferences to return dark mode\' )\"") "true")
      (load-theme dark-theme t)
    (load-theme light-theme t)))
(add-hook 'after-init-hook #'match-current-mac-appearance)
(add-hook 'mac-effective-appearance-change-hook #'match-current-mac-appearance)

Fonts

(set-face-attribute 'default nil
                    :family "Iosevka"
                    :weight 'normal
                    :height 170)
(set-face-attribute 'variable-pitch nil
                    :family "Overpass"
                    :weight 'normal
                    :height 150)

Modeline

Indicators

(display-battery-mode +1)
(display-time-mode +1)

doom-modeline

(use-package doom-modeline
  :hook (after-init . doom-modeline-mode)
  :config
  (setq doom-modeline-height 0
        doom-modeline-mu4e t
        doom-modeline-bar-width 4
        doom-modeline-time-icon nil
        doom-modeline-window-width-limit nil
        all-the-icons-scale-factor 1.2))

anzu

(use-package anzu
  :defer 0.1
  :config
  (global-anzu-mode +1))

which-key

(use-package which-key
  :defer 0.1
  :config
  (which-key-mode +1))

all-the-icons

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

ace-window

(use-package ace-window
  :defer 0.1
  :config
  (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)))

Indent Guides

(use-package highlight-indent-guides
  :hook (prog-mode . highlight-indent-guides-mode)
  :config
  (setq highlight-indent-guides-method 'bitmap))

treemacs

(use-package treemacs
  :bind (:map global-map
              ("M-0" . treemacs-select-window)
              ("C-x t 1" . treemacs-delete-other-windows)
              ("C-x t t" . treemacs)
              ("C-x t d" . treemacs-select-directory)
              ("C-x t B" . treemacs-bookmark)
              ("C-x t C-t" . treemacs-find-file)
              ("C-x t M-t" . treemacs-find-tag))
  :config
  (treemacs-follow-mode +1)
  (treemacs-filewatch-mode +1)
  (treemacs-fringe-indicator-mode 'always)
  ;; treemacs margin
  (add-hook 'treemacs-mode-hook #'(lambda ()
                               (setq left-margin-width 1)
                               (set-window-buffer nil (current-buffer)))))

;; (use-package treemacs-all-the-icons
;;   :after treemacs
;;   :demand t
;;   :config
;;   (treemacs-load-theme "all-the-icons")
;;   (set-face-attribute 'treemacs-root-face nil
;;                       :underline nil
;;                       :inherit '(treemacs-all-the-icons-root-face variable-pitch))
;;   (set-face-attribute 'treemacs-all-the-icons-file-face nil
;;                       :slant 'normal))

imenu-list

(use-package imenu-list
  :config
  (setq imenu-list-position 'left
        imenu-list-size 36))
(use-package svg-lib)

Register

(set-register ?C '(file . "~/.emacs.d/config.org"))
(set-register ?F '(file . "~/finance.ledger"))

magit

(use-package magit
  :defer 0.1)

Magit Forges

(use-package forge
  :after magit)

Git Timemachine

(use-package git-timemachine
  :straight (git-timemachine :type git :host github :repo "emacsmirror/git-timemachine")
  :bind ("C-c g" . git-timemachine-toggle))

Project Management

(use-package projectile
  :demand t
  :init (projectile-mode +1)
  :bind
  (:map projectile-mode-map
        ("C-c p" . projectile-command-map)))

Consult Integration

(use-package consult-projectile
  :demand t
  :bind ("C-<tab>" . consult-projectile))

Completion Frameworks

Vertico

(use-package vertico
  :straight (vertico :files (:defaults "extensions/*")
                     :includes (vertico-quick))
  :demand t
  :bind (:map vertico-map
              ("<escape>" . #'minibuffer-keyboard-quit))
  :config
  (setq vertico-count 13)
  (vertico-mode +1)

  (require 'vertico-quick)

  (define-key vertico-map "\M-q" #'vertico-quick-insert)
  (define-key vertico-map "\C-q" #'vertico-quick-exit))

(use-package emacs
  :init
  (defun crm-indicator (args)
    (cons (format "[CRM%s] %s"
                  (replace-regexp-in-string
                   "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
                   crm-separator)
                  (car args))
          (cdr args)))
  (advice-add #'completing-read-multiple :filter-args #'crm-indicator)

  (setq enable-recursive-minibuffers t))

Orderless

(use-package orderless
  :custom
  (completion-styles '(orderless substring basic))
  (completion-category-defaults nil)
  (completion-category-overrides '((file (styles partial-completion)))))

Consult

(use-package consult
  :bind (;; C-c bindings (mode-specific-map)
         ("C-c h" . consult-history)
         ("C-c m" . consult-mode-command)
         ("C-c k" . consult-kmacro)
         ;; C-x bindings (ctl-x-map)
         ("C-x M-:" . consult-complex-command)     ;; orig. repeat-complex-command
         ("C-x b" . consult-buffer)                ;; orig. switch-to-buffer
         ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
         ("C-x 5 b" . consult-buffer-other-frame)  ;; orig. switch-to-buffer-other-frame
         ("C-x r b" . consult-bookmark)            ;; orig. bookmark-jump
         ("C-x p b" . consult-project-buffer)      ;; orig. project-switch-to-buffer
         ;; Custom M-# bindings for fast register access
         ("M-#" . consult-register-load)
         ("M-'" . consult-register-store)          ;; orig. abbrev-prefix-mark (unrelated)
         ("C-M-#" . consult-register)
         ;; Other custom bindings
         ("M-y" . consult-yank-pop)                ;; orig. yank-pop
         ("<help> a" . consult-apropos)            ;; orig. apropos-command
         ;; M-g bindings (goto-map)
         ("M-g e" . consult-compile-error)
         ("M-g f" . consult-flymake)               ;; Alternative: consult-flycheck
         ("M-g M-g" . consult-goto-line)           ;; orig. goto-line
         ("M-g o" . consult-outline)               ;; Alternative: consult-org-heading
         ("M-g m" . consult-mark)
         ("M-g k" . consult-global-mark)
         ("M-g i" . consult-imenu)
         ("M-g I" . consult-imenu-multi)
         ;; M-s bindings (search-map)
         ("M-s d" . consult-find)
         ("M-s D" . consult-locate)
         ("M-s g" . consult-grep)
         ("M-s G" . consult-git-grep)
         ("M-s r" . consult-ripgrep)
         ("M-s l" . consult-line)
         ("M-s L" . consult-line-multi)
         ("M-s m" . consult-multi-occur)
         ("M-s k" . consult-keep-lines)
         ("M-s u" . consult-focus-lines)
         ;; Isearch integration
         ("M-s e" . consult-isearch-history)
         :map isearch-mode-map
         ("M-e" . consult-isearch-history)         ;; orig. isearch-edit-string
         ("M-s e" . consult-isearch-history)       ;; orig. isearch-edit-string
         ("M-s l" . consult-line)                  ;; needed by consult-line to detect isearch
         ("M-s L" . consult-line-multi)            ;; needed by consult-line to detect isearch
         ;; Minibuffer history
         :map minibuffer-local-map
         ("M-s" . consult-history)                  ;; orig. next-matching-history-element
         ("M-r" . consult-history))                 ;; orig. previous-matching-history-element
  :config
  (setq register-preview-delay 0)
  (setq consult-narrow-key "@"))

consult-dir

(use-package consult-dir
  :bind (("C-x C-d" . consult-dir)
         :map minibuffer-local-completion-map
         ("C-x C-d" . consult-dir)
         ("C-x C-j" . consult-dir-jump-file)))

Ripgrep ignore dir

(defun consult-rg-glob (globs)
  (interactive "sEnter globs: ")
  (setq args-with-glob
        (concat consult-ripgrep-args " -g \"" globs "\""))
  (let (consult-ripgrep-args args-with-glob)
    (consult-ripgrep)))





Marginalia

(use-package marginalia
  :demand t
  :config
  (marginalia-mode +1)
  :bind (:map minibuffer-local-completion-map
              ("M-A" . marginalia-cycle)
              ("C-i" . marginalia-cycle-annotators)))

(use-package all-the-icons-completion
  :straight (all-the-icons-completion :type git :repo "MintSoup/all-the-icons-completion")
  :after (marginalia all-the-icons)
  :hook (marginalia-mode . all-the-icons-completion-marginalia-setup)
  :init
  (all-the-icons-completion-mode))

Embark

(use-package embark
  :ensure t

  :bind
  (("C-." . embark-act)         ;; pick some comfortable binding
   ("C-;" . embark-dwim)        ;; good alternative: M-.
   ("C-h B" . embark-bindings)) ;; alternative for `describe-bindings'

  :init

  ;; Optionally replace the key help with a completing-read interface
  (setq prefix-help-command #'embark-prefix-help-command)

  :config

  ;; Hide the mode line of the Embark live/completions buffers
  (add-to-list 'display-buffer-alist
               '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
                 nil
                 (window-parameters (mode-line-format . none)))))

;; Consult users will also want the embark-consult package.
(use-package embark-consult
  :ensure t
  :after (embark consult)
  :demand t ; only necessary if you have the hook below
  ;; if you want to have consult previews as you move around an
  ;; auto-updating embark collect buffer
  :hook
  (embark-collect-mode . consult-preview-at-point-mode))

Corfu

(use-package corfu
  :demand t
  :init
  (setq corfu-auto t
        corfu-auto-delay 0
        corfu-auto-prefix 1
        corfu-quit-no-match 'separator)
  (setq tab-always-indent 'complete)

  (add-hook 'eshell-mode-hook
            (lambda ()
              (setq-local corfu-auto nil)))
  :config
  (global-corfu-mode))

(use-package cape
  :demand t
  :after corfu
  :init
  (add-to-list 'completion-at-point-functions #'cape-file))

(use-package corfu-doc
  :hook (corfu-mode . corfu-doc-mode)
  :bind
  (
   :map corfu-map
   ("M-p" . corfu-doc-scroll-down)
   ("M-n" . corfu-doc-scroll-up)
   ("M-d" . corfu-doc-toggle)
   ))

(use-package kind-icon
  :demand t
  :after corfu
  :custom
  (kind-icon-default-face 'corfu-default)
  :config
  (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))

Email

(use-package mu4e
  :straight nil
  :defer 0.2
  :load-path "/usr/local/share/emacs/site-lisp/mu/mu4e/"
  :init
  (require 'smtpmail)
  (setq mu4e-mu-binary (executable-find "mu")
        mu4e-maildir "~/.maildir"
        mu4e-get-mail-command (concat (executable-find "mbsync") " -a")
        mu4e-update-interval 300
        mu4e-attachment-dir "~/Desktop"
        mu4e-change-filenames-when-moving t
        mu4e-user-mail-address-list '("alan.strauhs@wearesauce.io")))

(use-package mu4e-alert
  :hook (after-init . (mu4e-alert-enable-mode-line-display mu4e-alert-enable-notifications))
  :after mu4e
  :init
  (defun perso--mu4e-notif ()
    "Display both mode line and desktop alerts for incoming new emails."
    (interactive)
    (mu4e-update-mail-and-index 1)        ; getting new emails is ran in the background
    (mu4e-alert-enable-mode-line-display) ; display new emails in mode-line
    (mu4e-alert-enable-notifications))    ; enable desktop notifications for new emails
  (defun perso--mu4e-refresh ()
    "Refresh emails every 300 seconds and display desktop alerts."
    (interactive)
    (mu4e t)                            ; start silently mu4e mandatory for mu>=1.3.8
    (run-with-timer 0 300 'perso--mu4e-notif))
  :bind ("<f2>" . perso--mu4e-refresh)
  :config
  (mu4e-alert-set-default-style 'notifier)
  (setq mu4e-alert-interesting-mail-query "flag:unread AND NOT flag:trashed"))

PDF Viewing

(use-package pdf-tools
  :mode ("\\.pdf\\'" . pdf-view-mode)
  :config
  (setq-default pdf-view-display-size 'fit-page)
  (setq pdf-view-use-scaling t)
  (pdf-tools-install :no-query)
  (require 'pdf-occur))

Emacs as a Terminal Multiplexer

(use-package vterm)


(use-package multi-vterm
  :demand t
  :bind (("C-c t t" . multi-vterm)
         ("C-c t r" . multi-vterm-rename-buffer)
         ("C-c t n" . multi-vterm-next)
         ("C-c t p" . multi-vterm-prev)
         ("C-c t x" . multi-vterm-project))
  :config
  (defun my/multi-vterm-buffer-names ()
    (mapcar #'buffer-name multi-vterm-buffer-list))

  (setq multi-vterm-buffer-source
    (list :name "Terminals"
          :category 'buffer
          :state #'consult--buffer-state
          :history 'buffer-name-history
          :items #'(lambda ()
                   (my/multi-vterm-buffer-names))))
  (defun my/multi-vterm-switch-buffer ()
    (interactive)
    (if (length= multi-vterm-buffer-list 0)
        (multi-vterm)
      (consult-buffer (list multi-vterm-buffer-source))))

  (bind-key (kbd "C-c t s") #'my/multi-vterm-switch-buffer))


Ledger Mode

(use-package ledger-mode
  :demand t)

Org Mode

General Configuration

(setq org-hide-emphasis-markers t
      org-startup-indented t
      org-src-tab-acts-natively t
      org-pretty-entities t
      org-fontify-whole-heading-line t
      org-fontify-done-headline t
      org-ellipsis ""
      org-fontify-quote-and-verse-blocks t
      org-hidden-keywords '(title))
; add margins on both sides
(add-hook 'org-mode-hook #'(lambda ()
                             (setq left-margin-width 2
                                   right-margin-width 2)
                             (set-window-buffer nil (current-buffer))))

Org Superstar

(defvar after-load-theme-hook nil)
(defadvice load-theme (after run-after-load-theme-hook activate)
  (run-hooks 'after-load-theme-hook))

(use-package org-superstar
  :hook (org-mode . org-superstar-mode)
  :config
  (defun set-org-face-level-heights ()
    (set-face-attribute 'org-level-3 nil :inherit 'org-level-8 :height 1.2) 
    (set-face-attribute 'org-level-2 nil :inherit 'org-level-8 :height 1.3) 
    (set-face-attribute 'org-level-1 nil :inherit 'org-level-8 :height 1.6)

    (set-face-attribute 'org-document-title nil
                        :height 2.074
                        :foreground 'unspecified
                        :inherit 'org-level-8))
  (set-org-face-level-heights)
  (add-hook 'after-load-theme-hook #'set-org-face-level-heights))

Mixed Pitches in Org Mode

(use-package mixed-pitch
  :hook (org-mode . mixed-pitch-mode)
  :config
  (setq mixed-pitch-fixed-pitch-faces
        '(org-block org-block-begin-line org-block-end-line org-code org-document-info-keyword org-meta-line org-table org-verbatim)))

Org Roam

(use-package org-roam
  :custom
  (org-roam-directory "~/roam/")
  :bind (("C-c n l" . org-roam-buffer-toggle)
         ("C-c n f" . org-roam-node-find)
         ("C-c n g" . org-roam-graph)
         ("C-c n i" . org-roam-node-insert)
         ("C-c n c" . org-roam-capture)
         ("C-c n j" . org-roam-dailies-capture-today))
  :config
  (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:10}" 'face 'org-tag)))
  (org-roam-db-autosync-mode))

Editing Packages

expand-region

(use-package expand-region
  :defer 0.1
  :bind ("C-=" . er/expand-region))

smartparens

(use-package smartparens
  :defer 0.1
  :bind ("M-n" . sp-forward-sexp)
  :config
  (require 'smartparens-config)

  (defun indent-between-pair (&rest _ignored)
    (newline)
    (indent-according-to-mode)
    (forward-line -1)
    (indent-according-to-mode))

  (sp-local-pair 'prog-mode "{" nil :post-handlers '((indent-between-pair "RET")))
  (sp-local-pair 'prog-mode "[" nil :post-handlers '((indent-between-pair "RET")))
  (sp-local-pair 'prog-mode "(" nil :post-handlers '((indent-between-pair "RET")))

  (smartparens-global-mode +1))

avy

(use-package avy
  :config
  (avy-setup-default)
  (global-set-key (kbd "C-c C-j") 'avy-resume)
  :bind
  (("M-g w" . avy-goto-word-1)
   ("M-g g" . avy-goto-line)
   ("M-g c" . avy-goto-char-2)
   ("C-c C-'" . avy-pop-mark)))

hungry-delete

(use-package hungry-delete
  :init
  (setq hungry-delete-join-reluctantly t)
  :bind ("M-DEL" . global-hungry-delete-mode))

Yasnippet

(use-package yasnippet
  :defer 0.1
  :config
  (yas-global-mode +1))

Drag Stuff

(use-package drag-stuff
  :hook ((text-mode prog-mode) . drag-stuff-global-mode)
  :config
  (drag-stuff-define-keys))

Programming

LSP Configuration

(use-package lsp-mode
  :init
  (setq read-process-output-max (* 1024 1024))
  (setq lsp-keymap-prefix "C-c l"
        lsp-idle-delay 0.1)
  (setq-default lsp-lens-enable nil)
  (setq lsp-completion-provider :none)
  (defun my/lsp-mode-setup-completion ()
    (setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults))
          '(flex)))
  :hook (((elm-mode c++-mode elixir-mode c-mode rust-mode js-mode web-mode css-mode typescript-mode) . lsp-deferred)
         (lsp-mode . lsp-enable-which-key-integration)
         (lsp-completion-mode . my/lsp-mode-setup-completion))
  :config
  (add-to-list 'lsp-language-id-configuration
               '(web-mode . "html"))

  (setf (alist-get 'web-mode lsp--formatting-indent-alist) 'web-mode-markup-indent-offset)

  :commands lsp lsp-deferred)

Treesitter

(use-package tree-sitter
  :demand t
  :config
  (global-tree-sitter-mode)
  (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode))

(use-package tree-sitter-langs
  :demand t
  :after tree-sitter)

Elixir

(use-package elixir-mode)

JSON

(use-package json-mode)

Rust

(use-package rustic)

Meson

(use-package meson-mode)

Javascript

rjsx-mode

(use-package rjsx-mode
  :mode ("\\.js\\'"
         "\\.jsx\\'")
  :config
  (setq js2-mode-show-parse-errors nil
        js2-mode-show-strict-warnings nil
        js2-basic-offset 2
        js-indent-level 2))

Ensure node modules path is added to exec-path

(use-package add-node-modules-path
  :hook (((js2-mode rjsx-mode) . add-node-modules-path)))

Typescript

(use-package typescript-mode
  :demand t
  :after tree-sitter
  :config
  (setq typescript-indent-level 2)
  (define-derived-mode typescriptreact-mode typescript-mode
    "Typescript TSX")

  (add-to-list 'auto-mode-alist '("\\.tsx?\\'" . typescriptreact-mode))
  (add-to-list 'tree-sitter-major-mode-language-alist '(typescriptreact-mode . tsx)))

Web

(use-package web-mode
  :mode
  (("\\.phtml\\'" . web-mode)
   ("\\.tpl\\.php\\'" . web-mode)      
   ("\\.jsp\\'" . web-mode)            
   ("\\.as[cp]x\\'" . web-mode)        
   ("\\.erb\\'" . web-mode)            
   ("\\.mustache\\'" . web-mode)       
   ("\\.djhtml\\'" . web-mode)         
   ("\\.jst.ejs\\'" . web-mode)        
   ("\\.html?\\'" . web-mode)
   ("\\.hbs\\'" . web-mode)
   ("\\.heex\\'" . web-mode)
   ("\\html.eex\\'" . web-mode))

  :init
  (setq web-mode-enable-block-face t)
  (setq web-mode-enable-comment-keywords t)
  (setq web-mode-enable-current-element-highlight t)
  (setq web-mode-enable-current-column-highlight t)   
  (setq web-mode-script-padding 2)
  (setq web-mode-style-padding 2)
  (setq web-mode-enable-auto-indentation nil)
  (setq web-mode-comment-style 2)
  (setq web-mode-code-indent-offset 2)
  (setq web-mode-markup-indent-offset 2)
  (setq css-indent-level 2)
  (setq css-indent-offset 2))

C/C++

(use-package cc-mode
  :ensure nil
  :defer t
  :config
  (setq c-basic-offset 4
        c-backspace-function #'delete-backward-char)

  ;; TODO: Refine this style
  (c-add-style
   "scary" '((c-comment-only-line-offset . 0)
             (c-hanging-braces-alist (brace-list-open)
                                     (brace-entry-open)
                                     (substatement-open after)
                                     (block-close . c-snug-do-while)
                                     (namespace-open after)
                                     (extern-lang-open after))
             (c-cleanup-list brace-else-brace
                             brace-catch-brace)
             (c-offsets-alist
              (knr-argdecl-intro . 0)
              (defun-close . 0)
              (defun-open . 0)
              (innamespace . 0)
              (substatement-open . 0)
              (substatement-label . 0)
              (statement-cont . +)
              (case-label . +)
              (brace-list-entry . 0)
              (brace-list-intro . +)
              (brace-list-close . 0)
              (arglist-intro . +)
              (arglist-close . 0)
              (inline-open . 0)
              (inlambda . 0)
              (access-label . -)
              (inclass . +)
              (label . 0))))

  (when (listp c-default-style)
    (setf (alist-get 'other c-default-style) "scary")))

ELM!!!!

(use-package elm-mode)

Hydras

(use-package hydra
  :defer 0.1)

(use-package windsize
  :defer 0.1)

(defhydra sd-hydra-window (:hint nil)
  "
Movement    ^Resize^     ^Split^          ^Other^
------------------------------------------------------------------
_h_ left      _C-h_ left   _o_ horizontal   _d_   delete window
_j_ down      _C-j_ down   _v_ vertical     _f_   only this window
_k_ up        _C-k_ up     _m_ maximize     _M-o_ ace-window
_l_ right     _C-l_ right  _b_ balance      _s_   switch buffers
_q_ quit
"
  ;; Movement
  ("h" windmove-left)
  ("j" windmove-down)
  ("k" windmove-up)
  ("l" windmove-right)

  ;; Resize
  ("C-h" windsize-left)
  ("C-j" windsize-down)
  ("C-k" windsize-up)
  ("C-l" windsize-right)

  ;; Split
  ("o" split-window-below)
  ("v" split-window-right)
  ("m" maximize-window :color blue)
  ("b" balance-windows)

  ;; Other
  ("d" delete-window)
  ("f" delete-other-windows :color blue)
  ("M-o" ace-window :color blue)
  ("s" consult-buffer)
  ("q" nil))

(global-set-key (kbd "M-o") #'sd-hydra-window/body)

;; Local Variables: ;; eval: (add-hook ‘after-save-hook (lambda ()(if (y-or-n-p “Reload?”)(load-file user-init-file))) nil t) ;; eval: (add-hook ‘after-save-hook (lambda ()(if (y-or-n-p “Tangle?”)(org-babel-tangle))) nil t) ;; End:

About

My personal GNU Emacs configuration


Languages

Language:Emacs Lisp 100.0%