I have been using Emacs for 15 years. In that time, I have had large configs, spacemacs, doom, evil/non-evil. This is my current configuration. Package installation is managed via a home-manager nix flake.
I am surprised that I was able to remove everything surrounding vertico
and go with fido-mode
easily.
I have a parallel configuration that removes lsp and uses eglot, but it’s not as fleshed out. I need to be able to use both eslint and typescript language servers and I don’t have a reliable way to do that in eglot.
I am currently using emacs-head. I know I don’t need to use-package
builtin emacs packages but I do anyway.
(use-package isearch
:init (setq isearch-allow-motion t
isearch-motion-changes-direction t
isearch-allow-scroll t
isearch-lazy-count t))
(use-package frame
:bind (("C-z" . nil))
:config (set-frame-font "Iosevka-12" nil t))
(use-package icomplete
:config (fido-vertical-mode 1))
(use-package minibuffer
:init (setq completion-cycle-threshold t))
(use-package battery :config (display-battery-mode 1))
(use-package cus-edit :init (setq custom-file "~/.emacs.d/custom.el"))
(use-package custom :config (load-theme 'modus-vivendi-tinted t))
(use-package ediff-wind :init (setq ediff-window-setup-function 'ediff-setup-windows-plain))
(use-package files
:init (setq make-backup-files nil
confirm-kill-emacs 'y-or-n-p
find-file-visit-truename t))
(use-package menu-bar :config (menu-bar-mode -1))
(use-package mouse :init (setq mouse-yank-at-point t))
(use-package tool-bar :config (tool-bar-mode -1))
(use-package savehist :init (savehist-mode))
(use-package scroll-bar :config (scroll-bar-mode -1))
(use-package grep :config (grep-apply-setting 'grep-find-command '("rg -n -H --no-heading -e '' $(git rev-parse --show-toplevel || pwd)" . 27)))
(use-package magit
:init
(setq git-commit-summary-max-length 50)
:config
(add-to-list 'git-commit-style-convention-checks 'overlong-summary-line))
(use-package git-timemachine)
(use-package minions
:config (minions-mode 1))
(use-package js
:after apheleia
:init
(setq js-indent-level 2)
(when (featurep 'treesit)
(add-to-list 'apheleia-mode-alist '(js-ts-mode . prettier-javascript))))
(use-package js
:bind
(:map js-ts-mode-map ("M-." . nil))
(:map js-mode-map ("M-." . nil)))
(use-package nix-mode)
(use-package markdown-mode)
(use-package project)
(use-package apheleia
:config
(apheleia-global-mode +1)
(defalias 'format-mode 'apheleia-mode))
(use-package go-mode)
(use-package deadgrep :bind ("<f5>" . deadgrep))
(use-package org-roam
:init
(setq org-roam-directory (file-truename "~/org/roam"))
:config
(org-roam-db-autosync-mode))
(use-package treesit
:if (featurep 'treesit)
:init
(setq treesit-font-lock-level 4))
(use-package treesit-auto
:if (featurep 'treesit)
:config
(global-treesit-auto-mode))
(use-package webpaste)
(use-package copilot
:hook (prog-mode . copilot-mode)
:bind (("C-c c" . copilot-complete)
(:map copilot-completion-map
("C-g" . copilot-clear-overlay)
("C-c a" . copilot-accept-completion)
("C-c n" . copilot-next-completion)
("C-c p" . copilot-previous-completion))))
(use-package lsp-mode
:init
(setq lsp-headerline-breadcrumb-enable nil
lsp-enable-snippet nil
lsp-completion-provider :none)
:hook ((js-ts-mode . lsp-deferred)
(go-mode . lsp-deferred)
(typescript-ts-mode . lsp-deferred))
:commands (lsp lsp-deffered))
(use-package flycheck
:init (global-flycheck-mode))
(use-package all-the-icons
:if (display-graphic-p))
Would you elaborate the part about home-manager? Do you use it to manage emacs packages?
Yes, I use
home-manager
to manage my emacs packages, among other things. Here’s the snippet that includes my emacs configuration. It’s in a file calledcommon.nix
which I include in my baselinux.nix
anddarwin,nix
configurations.There is a bit dynamism in the config that makes
lsp
oreglot
orvertico
configurations active. There is a bit at the bottom of myinit.el
that includes those files if they are present. It’s not the cleanest solution, but it’s mine.{ pkgs, ... }: let # myEmacs = if pkgs.stdenv.isDarwin then pkgs.emacsGit else pkgs.emacsPgtk; myEmacs = pkgs.emacsGit; useVertico = false; useLsp = true; emacsWithPackages = (pkgs.emacsPackagesFor myEmacs).emacsWithPackages; in { home.packages = [ pkgs.tree-sitter pkgs.nixfmt pkgs.ripgrep pkgs.bc pkgs.file pkgs.syncthing pkgs.streamlink pkgs.unzip (emacsWithPackages (epkgs: [ (pkgs.callPackage ./copilot.nix { inherit (pkgs) fetchFromGitHub; inherit (epkgs) trivialBuild; inherit (epkgs.nongnuPackages) editorconfig; inherit (epkgs.melpaStablePackages) dash s; }) ] ++ (with epkgs.elpaPackages; [ transient ]) ++ (with epkgs.nongnuPackages; [ go-mode magit markdown-mode webpaste ]) ++ (with epkgs.melpaStablePackages; [ apheleia deadgrep emojify eslint-disable-rule flymake-eslint minions treesit-auto ]) ++ (with epkgs.melpaPackages; [ nix-mode org-roam git-timemachine ]) ++ (if useLsp then [ (with epkgs.melpaPackages; [ lsp-mode all-the-icons flycheck ]) ] else [ ]) ++ (if useVertico then [ (with epkgs.elpaPackages; [ consult corfu embark embark-consult marginalia orderless vertico ]) ] else [ ]))) ] ++ (if useLsp then [ pkgs.emacs-all-the-icons-fonts ] else [ ]); home.stateVersion = "22.11"; programs.home-manager.enable = true; programs.bash = { enable = true; enableCompletion = true; historyControl = [ "erasedups" "ignoredups" "ignorespace" ]; }; programs.btop.enable = true; programs.dircolors.enable = true; home.file = { ".gitignore_global".source = ./gitignore_global; ".emacs.d/init.el".source = ./init.el; } // (if useVertico then { ".emacs.d/vertico.el".source = ./vertico.el; } else { }) // (if useLsp then { ".emacs.d/lsp.el".source = ./lsp.el; } else { ".emacs.d/eglot.el".source = ./eglot.el; }); programs.git = { enable = true; extraConfig = { core = { excludesFile = "~/.gitignore_global"; }; pull = { rebase = true; }; init = { defaultBranch = "main"; }; }; }; programs.htop.enable = true; programs.less.enable = true; programs.man.enable = true; }