2022-12-19 10:34:56 +00:00
|
|
|
;;; init.el --- Emacs configuration file -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
;; Author: Jessie Hildebrandt <jessieh.net>
|
|
|
|
;; Homepage: https://gitlab.com/jessieh/dot-emacs
|
|
|
|
;; Package-Requires: ((emacs "28.1"))
|
|
|
|
|
|
|
|
;; This file is not part of GNU Emacs.
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2020-07-22 00:48:25 +00:00
|
|
|
;;; Commentary:
|
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; jessieh's (Mostly) Portable Emacs Config
|
2017-11-15 04:15:29 +00:00
|
|
|
;;
|
2022-12-19 10:34:56 +00:00
|
|
|
;; This configuration file was designed to work with Emacs 28.1, and will not
|
|
|
|
;; work with earlier versions. You should probably have native-comp enabled.
|
2017-11-15 04:15:29 +00:00
|
|
|
;;
|
2022-12-19 10:34:56 +00:00
|
|
|
;; This file will automatically generate an early-init.el file upon first run,
|
|
|
|
;; or if early-init.el is missing.
|
2020-07-22 00:48:25 +00:00
|
|
|
;;
|
2022-12-19 10:34:56 +00:00
|
|
|
;; All configuration efforts here are organized around the use of wrapped
|
|
|
|
;; `use-package' macros. The keyword order for any config entry should be:
|
|
|
|
;; - if/when/unless
|
|
|
|
;; - demand
|
|
|
|
;; - after
|
|
|
|
;; - requires
|
|
|
|
;; - defines/functions
|
|
|
|
;; - init/config
|
|
|
|
;; - custom/custom-faces
|
|
|
|
;; - commands
|
|
|
|
;; - mode/interpreter/hook
|
|
|
|
;; - bind/bind*/bind-keymap/bind-keymap*
|
2020-07-22 00:48:25 +00:00
|
|
|
;;
|
2022-12-19 10:34:56 +00:00
|
|
|
;; Custom functions and variables should generally be prefixed with "user/".
|
|
|
|
;; This prefix is purposefully unidiomatic so as to avoid collisions with any
|
|
|
|
;; package prefixes, inbuilt or otherwise.
|
|
|
|
|
|
|
|
;;; License:
|
|
|
|
|
|
|
|
;; This program is free software; you can redistribute it and/or
|
|
|
|
;; modify it under the terms of the GNU General Public License as
|
|
|
|
;; published by the Free Software Foundation; either version 2, or
|
|
|
|
;; (at your option) any later version.
|
|
|
|
;;
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
;; General Public License for more details.
|
|
|
|
;;
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
;; along with this program; see the file COPYING. If not, write to
|
|
|
|
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
|
|
|
;; Floor, Boston, MA 02110-1301, USA.
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2020-07-22 00:48:25 +00:00
|
|
|
;;; Code:
|
2018-08-04 23:32:42 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; -------------------------------------------------------------------------- ;;
|
2017-11-15 04:15:29 +00:00
|
|
|
;;
|
2022-12-19 10:34:56 +00:00
|
|
|
;; Startup
|
2017-11-15 04:15:29 +00:00
|
|
|
;;
|
2022-12-19 10:34:56 +00:00
|
|
|
;; -------------------------------------------------------------------------- ;;
|
|
|
|
|
2022-12-20 03:37:28 +00:00
|
|
|
(defconst user/font "Fira Code 10" "Default font.")
|
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(defconst user/init-file (locate-user-emacs-file "init.el") "Location of user init file.")
|
|
|
|
(defconst user/early-init-file (locate-user-emacs-file "early-init.el") "Location of user early-init file.")
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; early-init.el file creation
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(defvar user/early-init-forms
|
2022-12-20 03:37:28 +00:00
|
|
|
`(";;; early-init.el --- Early initialization -*- lexical-binding: t; -*-"
|
2022-12-19 10:34:56 +00:00
|
|
|
|
|
|
|
";; This file is not part of GNU Emacs."
|
|
|
|
|
|
|
|
";;; Commentary:"
|
|
|
|
|
|
|
|
";; This file has been automatically generated by init.el."
|
|
|
|
";; More relevant commentary is likely in init.el, not here."
|
|
|
|
|
|
|
|
";;; Code:"
|
|
|
|
|
|
|
|
(defconst user/gc-cons-threshold (* 32 1024 1024) "Preferred garbage collection threshold value (32MB).")
|
|
|
|
(defconst user/gc-cons-percentage 0.1 "Preferred garbage collection percentage value (10%).")
|
|
|
|
|
|
|
|
(defun user/defer-garbage-collection ()
|
|
|
|
"Defer garbage collection by maximizing the collection threshold."
|
|
|
|
(setq gc-cons-threshold most-positive-fixnum
|
|
|
|
gc-cons-percentage 1.0))
|
|
|
|
(defun user/restore-garbage-collection ()
|
|
|
|
"Restore the garbage collection threshold parameters in a deferred fashion."
|
|
|
|
(setq gc-cons-threshold user/gc-cons-threshold
|
|
|
|
gc-cons-percentage user/gc-cons-percentage))
|
|
|
|
|
|
|
|
";; Defer garbage collection until after initialization"
|
|
|
|
(user/defer-garbage-collection)
|
|
|
|
(add-hook 'emacs-startup-hook #'user/restore-garbage-collection)
|
|
|
|
|
|
|
|
";; Clear `file-name-handler-alist' until after initialization"
|
|
|
|
(let ((default-file-name-handler-alist file-name-handler-alist))
|
|
|
|
(setq file-name-handler-alist nil)
|
|
|
|
(add-hook 'emacs-startup-hook (lambda () (setq file-name-handler-alist default-file-name-handler-alist))))
|
|
|
|
|
|
|
|
";; Configure GUI components before initial frame creation"
|
2022-12-30 01:37:36 +00:00
|
|
|
(setq inhibit-x-resources t
|
|
|
|
frame-inhibit-implied-resize t
|
2022-12-30 01:51:45 +00:00
|
|
|
default-frame-alist '((width . 100)
|
|
|
|
(height . 40)
|
|
|
|
(font . ,user/font)
|
2022-12-20 03:37:28 +00:00
|
|
|
(menu-bar-lines . 0)
|
2022-12-19 10:34:56 +00:00
|
|
|
(tool-bar-lines . 0)
|
|
|
|
(vertical-scroll-bars . nil)
|
|
|
|
(background-color . "gray15")
|
|
|
|
(foreground-color . "gray85")))
|
|
|
|
|
|
|
|
";; package.el initialization is handled manually in init.el"
|
|
|
|
(setq package-enable-at-startup nil)
|
|
|
|
|
|
|
|
";;; init.el ends here")
|
|
|
|
"List of forms that are written to the user early-init file.")
|
|
|
|
|
|
|
|
(defun user/write-forms-to-file (forms file)
|
|
|
|
"Format and pretty-print list FORMS to FILE."
|
|
|
|
(with-temp-file file
|
|
|
|
(mapcar (lambda (form)
|
|
|
|
(insert (concat
|
|
|
|
(if (stringp form)
|
|
|
|
(prin1-to-string form :no-escape)
|
|
|
|
(pp-to-string form))
|
|
|
|
"\n")))
|
|
|
|
forms)))
|
|
|
|
|
|
|
|
;; Create (and load) early-init file if it does not yet exist, or if this file
|
|
|
|
;; is currently being recompiled. We recreate early-init.el during compilation
|
|
|
|
;; in case `user/early-init-forms' has been changed
|
|
|
|
(unless (file-exists-p user/early-init-file)
|
|
|
|
(user/write-forms-to-file user/early-init-forms user/early-init-file)
|
|
|
|
(load user/early-init-file nil nil :no-suffix))
|
|
|
|
|
|
|
|
;; Make sure that the user init files are byte-compiled.
|
|
|
|
(let ((byte-compile-warnings nil))
|
|
|
|
(when (file-newer-than-file-p user/early-init-file (concat user/early-init-file "c"))
|
|
|
|
(byte-compile-file user/early-init-file))
|
|
|
|
(when (file-newer-than-file-p user/init-file (concat user/init-file "c"))
|
|
|
|
(byte-compile-file user/init-file)))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; Package manager initialization
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
;; To be evaluated at both compile time and run time
|
2019-04-12 08:35:58 +00:00
|
|
|
(eval-and-compile
|
2022-12-19 10:34:56 +00:00
|
|
|
(setq package-user-dir (locate-user-emacs-file "package/")
|
|
|
|
package-native-compile t
|
2019-04-12 08:35:58 +00:00
|
|
|
package-check-signature nil
|
2022-12-19 10:34:56 +00:00
|
|
|
use-package-hook-name-suffix nil
|
|
|
|
use-package-always-demand (daemonp)))
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; To be evaluated only at compile time
|
2019-04-12 08:35:58 +00:00
|
|
|
(eval-when-compile
|
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; Initialize package.el
|
2019-04-12 08:35:58 +00:00
|
|
|
(require 'package)
|
2022-12-19 10:34:56 +00:00
|
|
|
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
|
|
|
|
(unless (bound-and-true-p package--initialized)
|
|
|
|
(package-initialize))
|
2017-11-15 04:15:29 +00:00
|
|
|
(package-refresh-contents)
|
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; Install use-package
|
2019-04-12 08:35:58 +00:00
|
|
|
(unless (package-installed-p 'use-package)
|
|
|
|
(package-install 'use-package))
|
2022-12-19 10:34:56 +00:00
|
|
|
(require 'use-package)
|
|
|
|
|
|
|
|
;; After initialization, build quickstart file containing package autoload defs
|
|
|
|
;; and compile it alongside any other uncompiled Elisp files in installed packages
|
|
|
|
(add-hook 'emacs-startup-hook (lambda ()
|
2022-12-22 08:29:49 +00:00
|
|
|
(let ((byte-compile-warnings nil))
|
|
|
|
(byte-recompile-directory package-user-dir 0)
|
|
|
|
(package-quickstart-refresh)))))
|
2022-12-19 10:34:56 +00:00
|
|
|
|
|
|
|
;; Load "package-quickstart.el" file containing package autoload defs with a
|
|
|
|
;; call to `package-activate-all'. This is must be done to load any installed
|
|
|
|
;; packages during initialization outside of compile time because we won't have
|
|
|
|
;; called `package-initialize'. We also require `bind-key' here, which the
|
|
|
|
;; compiled `use-package' macros still rely on for handling keybinds
|
|
|
|
(unless (bound-and-true-p package--initialized)
|
|
|
|
(package-activate-all)
|
|
|
|
(require 'bind-key))
|
|
|
|
|
|
|
|
;; -------------------------------------------------------------------------- ;;
|
|
|
|
;;
|
|
|
|
;; Custom interactive functions
|
|
|
|
;;
|
|
|
|
;; -------------------------------------------------------------------------- ;;
|
2018-08-04 23:46:46 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(defun user/open-init-file ()
|
|
|
|
"Opens the user init file in a new buffer."
|
2019-04-12 08:35:58 +00:00
|
|
|
(interactive)
|
2022-12-19 10:34:56 +00:00
|
|
|
(find-file user/init-file))
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(defun user/byte-compile-init-files ()
|
|
|
|
"Byte-compile the user init and early-init files."
|
2020-07-21 04:19:49 +00:00
|
|
|
(interactive)
|
2022-12-19 10:34:56 +00:00
|
|
|
(message "Byte-compiling init and early-init file...")
|
|
|
|
(byte-compile-file user/init-file)
|
|
|
|
(byte-compile-file user/early-init-file))
|
|
|
|
|
|
|
|
(defun user/download-latest-init-file ()
|
|
|
|
"Download the latest user init file from jessieh.net/emacs.
|
2020-07-21 00:16:31 +00:00
|
|
|
|
2022-12-20 01:51:16 +00:00
|
|
|
The user init file will be automatically recompiled after downloading.
|
|
|
|
|
|
|
|
If `user/init-file' points to a symlink, nothing will be downloaded."
|
2019-04-12 08:35:58 +00:00
|
|
|
(interactive)
|
2022-12-20 01:51:16 +00:00
|
|
|
(if (file-symlink-p user/init-file)
|
|
|
|
(message "%s is a symlink, operation aborted. Please update the init file manually." user/init-file)
|
|
|
|
(when (yes-or-no-p "Download latest init file from jessieh.net/emacs? ")
|
|
|
|
(message "Updating init file...")
|
|
|
|
(url-copy-file "https://jessieh.net/emacs" user/init-file :ok-if-already-exists)
|
|
|
|
(user/byte-compile-init-files))))
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-20 03:37:06 +00:00
|
|
|
(defun user/refresh-packages ()
|
2022-12-20 22:39:38 +00:00
|
|
|
"Refresh packages that have been configured for use in the user init file.
|
2022-12-20 03:37:06 +00:00
|
|
|
|
|
|
|
This is accomplished by deleting `package-user-dir' and recompiling the user
|
|
|
|
init file, which initializes the package manager during compile time."
|
|
|
|
(interactive)
|
|
|
|
(when (yes-or-no-p "Redownload and refresh packages? ")
|
|
|
|
(message "Refreshing packages...")
|
|
|
|
(delete-directory package-user-dir :recursive)
|
|
|
|
(user/byte-compile-init-files)))
|
|
|
|
|
2022-12-20 03:37:41 +00:00
|
|
|
(defun user/indent-buffer ()
|
|
|
|
"Call `indent-region' on the contents of the active buffer."
|
|
|
|
(interactive)
|
|
|
|
(indent-region (point-min) (point-max)))
|
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(defun user/select-minibuffer-window ()
|
|
|
|
"Select the minibuffer window if it is active."
|
2019-04-12 08:35:58 +00:00
|
|
|
(interactive)
|
2022-12-19 10:34:56 +00:00
|
|
|
(when (active-minibuffer-window)
|
|
|
|
(select-window (active-minibuffer-window))))
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(defun user/scratch-buffer ()
|
|
|
|
"Open the scratch buffer, (re)creating it if not present."
|
2019-04-12 08:35:58 +00:00
|
|
|
(interactive)
|
2022-12-19 10:34:56 +00:00
|
|
|
(pop-to-buffer (get-buffer-create "*scratch*") '((display-buffer-reuse-window display-buffer-same-window)))
|
|
|
|
(lisp-interaction-mode))
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(defun user/scan-directory-for-projects ()
|
|
|
|
"Prompt for a directory and then scan for any project roots within.
|
|
|
|
|
|
|
|
Inaccessible directories and .git directories are skipped during searching.
|
|
|
|
When done searching, you will be shown a buffer of all discovered project
|
|
|
|
directories and will be prompted to index them. Choosing to index the project
|
|
|
|
directories will register them with Emacs' project management system."
|
2022-06-27 04:36:53 +00:00
|
|
|
(interactive)
|
|
|
|
(when-let* ((valid-root-p (lambda (path)
|
|
|
|
(and (file-accessible-directory-p path)
|
|
|
|
(not (string= (file-name-nondirectory path) ".git")))))
|
|
|
|
(directory (read-directory-name "Look for projects in: "))
|
2022-12-19 10:34:56 +00:00
|
|
|
(project-dir-list (mapcar #'file-name-directory
|
|
|
|
(directory-files-recursively directory "\\.git$" #'valid-root-p t)))
|
|
|
|
(num-projects-found (length project-dir-list))
|
|
|
|
(temp-buffer-name (concat "*" (number-to-string num-projects-found) " Project Roots Found*")))
|
|
|
|
(with-output-to-temp-buffer temp-buffer-name
|
|
|
|
(princ (mapconcat #'identity project-dir-list "\n")))
|
2022-06-27 04:36:53 +00:00
|
|
|
(when (yes-or-no-p "Index all of these directories as projects? ")
|
2022-12-19 10:34:56 +00:00
|
|
|
(unless (fboundp 'project-remember-projects-under)
|
|
|
|
(require 'project))
|
|
|
|
(mapc #'project-remember-projects-under project-dir-list)
|
2022-06-27 04:36:53 +00:00
|
|
|
(message "%d%s" num-projects-found " directories indexed as projects."))
|
2022-12-19 10:34:56 +00:00
|
|
|
(with-current-buffer temp-buffer-name
|
|
|
|
(kill-buffer-and-window))))
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; -------------------------------------------------------------------------- ;;
|
2017-11-15 04:15:29 +00:00
|
|
|
;;
|
2022-12-19 10:34:56 +00:00
|
|
|
;; Internal/built-in packages
|
2017-11-15 04:15:29 +00:00
|
|
|
;;
|
2022-12-19 10:34:56 +00:00
|
|
|
;; -------------------------------------------------------------------------- ;;
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(defmacro editor-feature (name docstring &rest args)
|
|
|
|
"Apply NAME and ARGS to `use-package' with `:ensure' defaulted to nil.
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
DOCSTRING is an optional form that is discarded upon expansion."
|
|
|
|
(declare (doc-string 2)
|
|
|
|
(indent defun))
|
|
|
|
(ignore docstring)
|
|
|
|
`(use-package ,name :ensure nil ,@args))
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
2022-12-20 03:37:06 +00:00
|
|
|
;; emacs
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
2021-02-14 23:09:53 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(defun user/ensure-region-active (func &rest args)
|
|
|
|
"Apply ARGS to FUNC only if `region-active-p' is non-nil."
|
|
|
|
(when (region-active-p)
|
|
|
|
(apply func args)))
|
|
|
|
|
|
|
|
(editor-feature emacs
|
2022-12-22 12:11:44 +00:00
|
|
|
"Provides an extensible, customizable, self-documenting real-time display editor."
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2019-06-06 09:57:55 +00:00
|
|
|
:config
|
2022-12-19 10:34:56 +00:00
|
|
|
|
|
|
|
;; Enable upcase/downcase region commands
|
|
|
|
(put 'upcase-region 'disabled nil)
|
|
|
|
(put 'downcase-region 'disabled nil)
|
|
|
|
(advice-add 'upcase-region :around 'user/ensure-region-active)
|
|
|
|
(advice-add 'downcase-region :around 'user/ensure-region-active)
|
|
|
|
|
|
|
|
:custom
|
|
|
|
|
|
|
|
;; Default working directory
|
|
|
|
(default-directory (if (eq system-type 'windows-nt)
|
|
|
|
(setq default-directory (getenv "USERPROFILE"))
|
|
|
|
(setq default-directory "~/")))
|
|
|
|
|
|
|
|
;; General configuration
|
|
|
|
(frame-title-format '("Emacs - %b") "Set frame title to buffer name")
|
|
|
|
(truncate-lines t "Truncate lines instead of wrapping")
|
|
|
|
(message-truncate-lines t "Truncate messages in the echo area")
|
|
|
|
(cursor-in-non-selected-windows nil "Hide cursor in inactive windows")
|
|
|
|
(x-gtk-use-system-tooltips nil "Disable GTK tooltips in favor of in-editor tooltips")
|
|
|
|
(ring-bell-function 'ignore "Disable terminal bell")
|
2022-12-20 22:40:03 +00:00
|
|
|
(fill-column 80 "Set default line-wrap column to column 80")
|
2022-12-19 10:34:56 +00:00
|
|
|
(max-mini-window-height 10 "Limit minibuffer height to 10 lines")
|
|
|
|
(enable-recursive-minibuffers t "Allow minibuffer commands to be called in the minibuffer")
|
|
|
|
(load-prefer-newer t "Load from source files if they are newer than bytecode files")
|
|
|
|
|
|
|
|
;; Startup
|
|
|
|
(initial-scratch-message "" "Leave scratch buffer empty on startup")
|
2022-12-30 01:37:50 +00:00
|
|
|
(initial-major-mode 'text-mode "Set initial mode to text-mode on startup")
|
2022-12-19 10:34:56 +00:00
|
|
|
(inhibit-startup-screen t "Do not create or show the initial splash screen")
|
|
|
|
(inhibit-default-init t "Do not attempt to load any OS-provided init files")
|
|
|
|
|
|
|
|
;; Default style rules
|
|
|
|
(indent-tabs-mode nil "Use spaces for indentation")
|
|
|
|
(tab-width 4 "Use 4 spaces for indentation")
|
|
|
|
|
|
|
|
;; Scrolling
|
|
|
|
(mouse-wheel-progressive-speed nil "Disable mouse wheel acceleration during scrolling")
|
|
|
|
(scroll-preserve-screen-position 1 "Prevent the cursor from moving during scrolling")
|
|
|
|
(scroll-conservatively 101 "Scroll only one line at a time when cursor leaves view")
|
|
|
|
(scroll-margin 5 "Maintain margin of 5 lines around cursor during scrolling")
|
|
|
|
|
|
|
|
;; Performance tweaks
|
|
|
|
(redisplay-skip-fontification-on-input t "Improve redisplay performance while scrolling")
|
|
|
|
(fast-but-imprecise-scrolling t "Improve redisplay performance while scrolling")
|
|
|
|
(jit-lock-defer-time 0 "Defer fontification while input is pending")
|
|
|
|
(auto-window-vscroll nil "Prevent calcuation of arbitrary line heights while scrolling")
|
|
|
|
(auto-mode-case-fold nil "Disable case-insensitive second pass over `auto-mode-alist'")
|
|
|
|
|
|
|
|
;; Bidirectional text
|
|
|
|
(bidi-inhibit-bpa t "Disable parentheses matching for bidirectional text")
|
|
|
|
(bidi-display-reordering 'left-to-right "Force global left-to-right text direction")
|
|
|
|
(bidi-paragraph-direction 'left-to-right "Disable paragraph directionality detection")
|
|
|
|
|
|
|
|
;; Elisp compilation warnings
|
|
|
|
(native-comp-async-report-warnings-errors nil "Don't report errors from async native compilation")
|
|
|
|
(byte-compile-warnings '(not lexical
|
2022-12-22 08:29:49 +00:00
|
|
|
free-vars
|
2022-12-19 10:34:56 +00:00
|
|
|
noruntime
|
|
|
|
unresolved
|
|
|
|
docstrings))
|
|
|
|
|
|
|
|
;; Filter out buffer-incompatible interactive commands by default
|
|
|
|
(read-extended-command-predicate #'command-completion-default-include-p)
|
|
|
|
|
|
|
|
:bind
|
|
|
|
|
|
|
|
;; General binds
|
|
|
|
("C-z" . undo)
|
|
|
|
("C-c SPC" . tmm-menubar)
|
2022-12-21 01:21:22 +00:00
|
|
|
("C-c DEL" . fixup-whitespace)
|
2022-12-19 10:34:56 +00:00
|
|
|
("C-c d" . delete-pair)
|
2022-12-20 22:40:03 +00:00
|
|
|
("C-c q" . visual-line-mode)
|
2022-12-19 10:34:56 +00:00
|
|
|
("C-c r" . revert-buffer-quick)
|
2022-12-20 22:40:03 +00:00
|
|
|
("C-c f" . display-fill-column-indicator-mode)
|
2022-12-20 03:37:41 +00:00
|
|
|
("C-c \\" . user/indent-buffer)
|
2022-12-19 10:34:56 +00:00
|
|
|
("C-c o" . user/select-minibuffer-window)
|
|
|
|
("C-c s" . user/scratch-buffer)
|
|
|
|
|
|
|
|
;; Navigation
|
|
|
|
("M-n" . scroll-up-line)
|
|
|
|
("M-p" . scroll-down-line)
|
|
|
|
("C-M-n" . forward-paragraph)
|
|
|
|
("C-M-p" . backward-paragraph)
|
|
|
|
|
|
|
|
:bind*
|
|
|
|
|
|
|
|
;; Window navigation
|
|
|
|
("C-c C-i" . windmove-up)
|
|
|
|
("C-c C-k" . windmove-down)
|
|
|
|
("C-c C-j" . windmove-left)
|
|
|
|
("C-c C-l" . windmove-right))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; autorevert
|
|
|
|
;; ---------------------------------- ;;
|
2020-08-29 21:29:40 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(editor-feature autorevert
|
2022-12-22 12:11:44 +00:00
|
|
|
"Displays on-disk changes to files in unmodified buffers automatically."
|
2022-12-19 10:34:56 +00:00
|
|
|
:config
|
|
|
|
(global-auto-revert-mode))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; display-line-numbers
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(editor-feature display-line-numbers
|
2022-12-22 12:11:44 +00:00
|
|
|
"Displays the absolute number of each line in a buffer."
|
2022-12-19 12:04:35 +00:00
|
|
|
:custom
|
|
|
|
(display-line-numbers-width-start 100 "Count number of lines (+100) in buffer for initial line number width")
|
2022-12-19 10:34:56 +00:00
|
|
|
:hook
|
|
|
|
(prog-mode-hook . (lambda ()
|
|
|
|
(unless (derived-mode-p 'lisp-interaction-mode)
|
|
|
|
(display-line-numbers-mode))))
|
|
|
|
:bind
|
|
|
|
("C-c n" . display-line-numbers-mode))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; elec-pair
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(editor-feature elec-pair
|
2022-12-22 12:11:44 +00:00
|
|
|
"Enables automatic pairing of most paired delimiters."
|
2022-12-19 10:34:56 +00:00
|
|
|
:hook
|
|
|
|
(prog-mode-hook . electric-pair-local-mode))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; eshell
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(defun user/abbrev-path (path)
|
|
|
|
"Return a PATH with all but the last directory name abbreviated."
|
|
|
|
(let* ((components (split-string (abbreviate-file-name path) "/"))
|
|
|
|
(str ""))
|
|
|
|
(while (cdr components)
|
|
|
|
(setq str (concat str
|
|
|
|
(cond ((= 0 (length (car components)))
|
|
|
|
"/")
|
|
|
|
((= 1 (length (car components)))
|
|
|
|
(concat (car components) "/"))
|
|
|
|
(t
|
|
|
|
(if (string= "." (string (elt (car components) 0)))
|
|
|
|
(concat (substring (car components) 0 2) "/")
|
|
|
|
(string (elt (car components) 0) ?/)))))
|
|
|
|
components (cdr components)))
|
|
|
|
(concat (propertize str 'face 'font-lock-comment-face)
|
|
|
|
(propertize (cl-reduce (lambda (a b) (concat a "/" b)) components) 'face 'font-lock-doc-face))))
|
|
|
|
|
|
|
|
(defun user/open-eshell ()
|
|
|
|
"Switch to an active unfocused `eshell' session, or start a new one."
|
|
|
|
(interactive)
|
|
|
|
(let ((eshell-buffer (cl-find-if (lambda (buffer)
|
|
|
|
(eq (buffer-local-value 'major-mode buffer)
|
|
|
|
'eshell-mode))
|
|
|
|
(buffer-list))))
|
|
|
|
(if eshell-buffer
|
|
|
|
(if (eq (current-buffer) eshell-buffer)
|
|
|
|
(eshell :new-session)
|
|
|
|
(pop-to-buffer eshell-buffer '((display-buffer-reuse-window display-buffer-same-window))))
|
|
|
|
(eshell))))
|
|
|
|
|
|
|
|
(editor-feature eshell
|
2022-12-22 12:11:44 +00:00
|
|
|
"Provides a shell-like interpreter that can process shell or Lisp commands."
|
2020-08-29 21:29:40 +00:00
|
|
|
:custom
|
2022-12-19 10:34:56 +00:00
|
|
|
(eshell-banner-message '(concat "\n" (if (executable-find "fortune")
|
|
|
|
(shell-command-to-string "fortune -s computers")
|
|
|
|
"Hello, commander.")))
|
|
|
|
(eshell-prompt-function (lambda ()
|
|
|
|
(concat "\n" (user/abbrev-path (eshell/pwd)) (if (= (user-uid) 0) " # " " ❱ "))))
|
|
|
|
(eshell-prompt-regexp "^[^#❱\n]* [#❱] ")
|
|
|
|
(eshell-visual-commands '("fish" "bash"
|
|
|
|
"ssh" "mosh"
|
|
|
|
"fzf" "top" "htop" "less"))
|
|
|
|
(eshell-destroy-buffer-when-process-dies t "Destroys child buffers after their process returns")
|
|
|
|
(eshell-error-if-no-glob t "Produces an error if a glob pattern fails to match, like zsh")
|
|
|
|
(eshell-hist-ignoredups t "Treat multiple repeating history entries as a single entry")
|
|
|
|
:hook
|
|
|
|
(eshell-post-command-hook . (lambda ()
|
|
|
|
(rename-buffer (concat eshell-buffer-name
|
|
|
|
" "
|
|
|
|
(user/abbrev-path (eshell/pwd)))
|
|
|
|
:unique)))
|
|
|
|
(eshell-mode-hook . (lambda ()
|
2022-12-30 01:39:19 +00:00
|
|
|
(setq-local line-spacing 0.15
|
|
|
|
global-hl-line-mode nil
|
2022-12-19 10:34:56 +00:00
|
|
|
tab-line-tabs-function #'tab-line-tabs-mode-buffers)
|
|
|
|
(tab-line-mode)))
|
|
|
|
:bind
|
|
|
|
("C-c RET" . user/open-eshell))
|
|
|
|
|
|
|
|
;; `eshell-mode-map' is not available until the `esh-mode' module is loaded, so
|
|
|
|
;; the local keymap bindings are set up here
|
|
|
|
|
|
|
|
(editor-feature esh-mode
|
2022-12-22 12:11:44 +00:00
|
|
|
"Handles input from the user and provides `eshell-mode' for eshell."
|
2022-12-19 10:34:56 +00:00
|
|
|
:bind
|
|
|
|
(:map eshell-mode-map
|
|
|
|
("C-c RET" . nil)
|
|
|
|
("C-<return> . eshell-copy-old-input")
|
|
|
|
("C-c j" . tab-line-switch-to-prev-tab)
|
|
|
|
("C-c l" . tab-line-switch-to-next-tab)))
|
|
|
|
|
2022-12-20 03:37:06 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; files
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(defconst user/custom-file (locate-user-emacs-file "custom.el") "Location of user customizations file.")
|
|
|
|
(defconst user/backup-directory (locate-user-emacs-file "backup/") "Location of user backup directory.")
|
|
|
|
(defconst user/auto-save-directory (locate-user-emacs-file "auto-save/") "Location of user auto save directory.")
|
|
|
|
(defconst user/lock-file-directory (locate-user-emacs-file "lock-file/") "Location of user lock file directory.")
|
|
|
|
|
|
|
|
(make-directory user/backup-directory :parents)
|
|
|
|
(make-directory user/auto-save-directory :parents)
|
|
|
|
(make-directory user/lock-file-directory :parents)
|
|
|
|
|
|
|
|
(editor-feature files
|
2022-12-22 12:11:44 +00:00
|
|
|
"Defines most of Emacs' file-handling functionality."
|
2022-12-20 03:37:06 +00:00
|
|
|
|
|
|
|
:custom
|
|
|
|
|
|
|
|
;; Config file
|
|
|
|
(custom-file user/custom-file "Store customization info in a separate file")
|
|
|
|
|
|
|
|
;; Directories
|
|
|
|
(backup-directory-alist `((".*" . ,user/backup-directory)))
|
|
|
|
(auto-save-file-name-transforms `((".*" ,user/auto-save-directory t)))
|
|
|
|
(lock-file-name-transforms `((".*" ,user/lock-file-directory t)))
|
|
|
|
|
|
|
|
;; Backup behavior
|
|
|
|
(backup-by-copying t "Use copying unconditionally when creating backups")
|
|
|
|
(version-control t "Use version numbers on backup files")
|
|
|
|
(delete-old-versions t "Clean up old backup files")
|
|
|
|
(kept-new-versions 5 "Keep 5 recent backup files")
|
|
|
|
(kept-old-versions 3 "Keep 3 old backup files")
|
|
|
|
|
|
|
|
:hook
|
|
|
|
(before-save-hook . delete-trailing-whitespace))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; frame
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(defvar user/initial-frame-created nil "Whether or not the first frame has been initialized by the server.")
|
|
|
|
(defvar user/after-daemon-make-initial-frame-functions nil "Run when the first frame is produced by the server in daemon mode.")
|
|
|
|
|
|
|
|
(defun user/set-up-frame (frame)
|
|
|
|
"Set up newly-created frame FRAME."
|
|
|
|
(when (display-graphic-p frame)
|
|
|
|
(let ((winid (frame-parameter frame 'outer-window-id)))
|
|
|
|
(start-process "" nil "xprop" "-f" "_GTK_THEME_VARIANT" "8u" "-set" "_GTK_THEME_VARIANT" "dark" "-id" winid))
|
|
|
|
(when (and (daemonp)
|
|
|
|
(not user/initial-frame-created))
|
|
|
|
(with-selected-frame frame
|
|
|
|
(run-hooks 'user/after-daemon-make-initial-frame-functions)
|
|
|
|
(setq user/initial-frame-created t)))))
|
|
|
|
|
|
|
|
(editor-feature frame
|
2022-12-22 12:11:44 +00:00
|
|
|
"Graphical frame configuration."
|
2022-12-20 03:37:06 +00:00
|
|
|
:config
|
|
|
|
(mapc #'user/set-up-frame (frame-list))
|
|
|
|
:hook
|
|
|
|
(after-make-frame-functions . user/set-up-frame))
|
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; hl-line
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(editor-feature hl-line
|
2022-12-22 12:11:44 +00:00
|
|
|
"Highlights the current line in a buffer."
|
2020-08-29 21:29:40 +00:00
|
|
|
:config
|
2022-12-19 10:34:56 +00:00
|
|
|
(global-hl-line-mode))
|
2020-08-29 21:29:40 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; ispell
|
|
|
|
;; ---------------------------------- ;;
|
2018-07-14 03:04:45 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(editor-feature ispell
|
2022-12-22 12:11:44 +00:00
|
|
|
"Checks for spelling errors and suggests corrections from a dictionary."
|
2022-12-19 10:34:56 +00:00
|
|
|
:bind
|
|
|
|
("C-c ' '" . ispell)
|
|
|
|
("C-c ' w" . ispell-word)
|
|
|
|
("C-c ' r" . ispell-region)
|
|
|
|
("C-c ' b" . ispell-buffer)
|
|
|
|
("C-c ' ;" . ispell-comment-or-string-at-point)
|
|
|
|
("C-c ' C-;" . ispell-comments-and-strings))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; paren
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(editor-feature paren
|
2022-12-22 12:11:44 +00:00
|
|
|
"Highlights matching delimiter pairs under the cursor."
|
2022-12-19 10:34:56 +00:00
|
|
|
:config
|
|
|
|
(show-paren-mode)
|
|
|
|
:custom
|
|
|
|
(show-paren-delay 0.0 "Highlight matching delimiters instantly"))
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; savehist
|
|
|
|
;; ---------------------------------- ;;
|
2021-07-13 00:11:53 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(editor-feature savehist
|
2022-12-22 12:11:44 +00:00
|
|
|
"Persists minibuffer history between sessions."
|
2022-12-19 10:34:56 +00:00
|
|
|
:config
|
|
|
|
(savehist-mode))
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-20 03:37:06 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; server
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(editor-feature server
|
2022-12-22 12:11:44 +00:00
|
|
|
"Allows Emacs to operate as a server for other Emacs processes."
|
2022-12-20 03:37:06 +00:00
|
|
|
:config
|
|
|
|
;; When running in a server/client configuration, we don't want the
|
2022-12-20 22:40:26 +00:00
|
|
|
;; foreground/background colors in `default-frame-alist' to overwrite the
|
|
|
|
;; colors set by the active theme every time we open a new client frame
|
2022-12-20 03:37:06 +00:00
|
|
|
(when (daemonp)
|
2022-12-20 22:40:26 +00:00
|
|
|
(assoc-delete-all 'foreground-color default-frame-alist)
|
|
|
|
(assoc-delete-all 'background-color default-frame-alist))
|
2022-12-20 03:37:06 +00:00
|
|
|
:custom
|
|
|
|
(server-client-instructions nil "Suppress help messages from the server for new frames"))
|
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; so-long
|
|
|
|
;; ---------------------------------- ;;
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(editor-feature so-long
|
2022-12-22 12:11:44 +00:00
|
|
|
"Deactivates certain editor features when opening files with very long lines."
|
2022-12-19 10:34:56 +00:00
|
|
|
:config
|
|
|
|
(global-so-long-mode))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; subword
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(editor-feature subword
|
2022-12-22 12:11:44 +00:00
|
|
|
"Enables detection of subwords as words in camel case or pascal case names."
|
2022-12-19 10:34:56 +00:00
|
|
|
:config
|
|
|
|
(global-subword-mode))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; tab-bar
|
|
|
|
;; ---------------------------------- ;;
|
2021-07-13 00:11:53 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(editor-feature tab-bar
|
2022-12-22 12:11:44 +00:00
|
|
|
"Provides a frame-wide tab bar that allows for tabbed workspace switching."
|
2020-07-21 00:30:34 +00:00
|
|
|
:custom
|
2022-12-19 10:34:56 +00:00
|
|
|
(tab-bar-format '(tab-bar-format-tabs tab-bar-separator))
|
|
|
|
(tab-bar-close-button-show nil "Disable close button on tabs"))
|
2020-10-17 22:12:33 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; tab-line
|
|
|
|
;; ---------------------------------- ;;
|
2020-07-21 00:16:51 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(editor-feature tab-line
|
2022-12-22 12:11:44 +00:00
|
|
|
"Provides a buffer-local tab line that facilitates quick buffer switching."
|
2022-12-19 10:34:56 +00:00
|
|
|
:custom
|
|
|
|
(tab-line-close-button-show nil "Disable close button on tabs")
|
|
|
|
(tab-line-new-button-show nil "Disable tab creation button")
|
|
|
|
(tab-line-left-button nil "Disable the left scroll button")
|
|
|
|
(tab-line-right-button nil "Disable the right scroll button")
|
|
|
|
(tab-line-switch-cycling t "Enable wrap-around tab cycling"))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; uniquify
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(editor-feature uniquify
|
2022-12-22 12:11:44 +00:00
|
|
|
"Provides better unique names when there are name conflicts between buffers."
|
2022-12-19 10:34:56 +00:00
|
|
|
:custom
|
|
|
|
(uniquify-buffer-name-style 'forward "Show file path before buffer name")
|
|
|
|
(uniquify-after-kill-buffer-p t "Update buffer names after killing")
|
|
|
|
(uniquify-ignore-buffers-re "^\\*" "Avoid renaming special buffers"))
|
|
|
|
|
2022-12-22 10:40:01 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; whitespace
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(editor-feature whitespace
|
2022-12-22 12:11:44 +00:00
|
|
|
"Visualizes blank characters."
|
2022-12-22 10:40:01 +00:00
|
|
|
:custom
|
|
|
|
(whitespace-line-column nil "Use the value of `fill-column' instead of a set value")
|
|
|
|
(whitespace-display-mappings '((tab-mark 9 [8677 9]) ; Tab
|
|
|
|
(space-mark 32 [8729]) ; Space
|
|
|
|
(space-mark 160 [8999]) ; Non-breaking space
|
2022-12-29 07:59:48 +00:00
|
|
|
(newline-mark 10 [8626 10])))) ; Newline
|
2022-12-22 10:40:01 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; -------------------------------------------------------------------------- ;;
|
|
|
|
;;
|
|
|
|
;; External packages
|
|
|
|
;;
|
|
|
|
;; -------------------------------------------------------------------------- ;;
|
|
|
|
|
|
|
|
(defmacro external-package (name docstring &rest args)
|
|
|
|
"Apply NAME and ARGS to `use-package' with `:ensure' defaulted to t.
|
|
|
|
|
|
|
|
DOCSTRING is an optional form that is discarded upon expansion."
|
|
|
|
(declare (doc-string 2)
|
|
|
|
(indent defun))
|
|
|
|
(ignore docstring)
|
|
|
|
`(use-package ,name :ensure t ,@args))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; Theme setup
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
2022-12-26 01:51:31 +00:00
|
|
|
(external-package adwaita-dark-theme
|
2022-12-22 12:11:44 +00:00
|
|
|
"Provides the `adwaita-dark' theme and custom fringe bitmaps."
|
2022-12-19 10:34:56 +00:00
|
|
|
:config
|
|
|
|
(load-theme 'adwaita-dark :no-confirm)
|
|
|
|
(adwaita-dark-theme-arrow-fringe-bmp-enable)
|
|
|
|
(eval-after-load 'diff-hl #'adwaita-dark-theme-diff-hl-fringe-bmp-enable)
|
|
|
|
(eval-after-load 'flymake #'adwaita-dark-theme-flymake-fringe-bmp-enable)
|
|
|
|
(eval-after-load 'flycheck #'adwaita-dark-theme-flycheck-fringe-bmp-enable)
|
|
|
|
(eval-after-load 'neotree #'adwaita-dark-theme-neotree-configuration-enable)
|
2022-12-22 12:10:44 +00:00
|
|
|
:custom
|
|
|
|
(adwaita-dark-theme-gray-rainbow-delimiters t "Use a gray color for rainbow-delimiters faces")
|
2022-12-19 10:34:56 +00:00
|
|
|
:hook
|
|
|
|
(user/after-daemon-make-initial-frame-functions . (lambda ()
|
|
|
|
(load-theme 'adwaita-dark :no-confirm))))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; Simple language modes
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(external-package csharp-mode
|
2022-12-22 12:11:44 +00:00
|
|
|
"Major mode for C#."
|
2020-07-21 00:16:51 +00:00
|
|
|
:mode
|
2022-12-19 10:34:56 +00:00
|
|
|
("\\.cs\\'" . csharp-mode))
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package dart-mode
|
2022-12-22 12:11:44 +00:00
|
|
|
"Major mode for Dart."
|
2017-11-15 04:15:29 +00:00
|
|
|
:mode
|
2022-12-19 10:34:56 +00:00
|
|
|
("\\.dart\\'" . dart-mode))
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package docker-compose-mode
|
2022-12-22 12:11:44 +00:00
|
|
|
"Major mdoe for docker-compose files."
|
2017-11-15 04:15:29 +00:00
|
|
|
:mode
|
2022-12-19 10:34:56 +00:00
|
|
|
("\\docker-compose.yml\\'" . docker-compose-mode))
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package dockerfile-mode
|
2022-12-22 12:11:44 +00:00
|
|
|
"Major mode for Docker files."
|
2019-10-30 08:25:51 +00:00
|
|
|
:mode
|
2022-12-19 10:34:56 +00:00
|
|
|
("\\Dockerfile\\'" . dockerfile-mode))
|
2019-10-30 08:25:51 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package fennel-mode
|
2022-12-22 12:11:44 +00:00
|
|
|
"Major mode for Fennel."
|
2020-03-10 10:09:23 +00:00
|
|
|
:mode
|
2022-12-19 10:34:56 +00:00
|
|
|
("\\.fnl\\'" . fennel-mode))
|
2020-03-10 10:09:23 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package fish-mode
|
2022-12-22 12:11:44 +00:00
|
|
|
"Major mode for fish files."
|
2020-03-10 10:09:23 +00:00
|
|
|
:mode
|
2022-12-19 10:34:56 +00:00
|
|
|
("\\.fish\\'" . fish-mode))
|
2020-03-10 10:09:23 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package gdscript-mode
|
2022-12-22 12:11:44 +00:00
|
|
|
"Major mode for GDScript."
|
2020-04-29 03:17:15 +00:00
|
|
|
:mode
|
|
|
|
("\\.gd\\'" . gdscript-mode)
|
|
|
|
("\\.tscn\\'" . gdscript-mode))
|
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package git-modes
|
2022-12-22 12:11:44 +00:00
|
|
|
"Major modes for git files."
|
2022-12-19 10:34:56 +00:00
|
|
|
:mode
|
|
|
|
("\\.gitignore\\'" . gitignore-mode)
|
|
|
|
("\\.gitconfig\\'" . gitconfig-mode)
|
|
|
|
("\\.gitmodules\\'" . gitconfig-mode)
|
|
|
|
("\\.gitattributes\\'" . gitattributes-mode))
|
|
|
|
|
|
|
|
(external-package glsl-mode
|
2022-12-22 12:11:44 +00:00
|
|
|
"Major mode for GLSL."
|
2021-09-16 21:18:31 +00:00
|
|
|
:mode
|
|
|
|
("\\.frag\\'" . glsl-mode)
|
|
|
|
("\\.vert\\'" . glsl-mode))
|
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package json-mode
|
2022-12-22 12:11:44 +00:00
|
|
|
"Major mode for JSON files."
|
2022-12-19 10:34:56 +00:00
|
|
|
:mode
|
|
|
|
("\\.json\\'" . json-mode))
|
2021-09-16 21:18:52 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package kotlin-mode
|
2022-12-22 12:11:44 +00:00
|
|
|
"Major mode for Kotlin."
|
2021-09-16 21:18:52 +00:00
|
|
|
:mode
|
2022-12-19 10:34:56 +00:00
|
|
|
("\\.kt\\'" . kotlin-mode))
|
2021-09-16 21:18:52 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package lua-mode
|
2022-12-22 12:11:44 +00:00
|
|
|
"Major mode for Lua."
|
2021-09-16 21:18:52 +00:00
|
|
|
:mode
|
2022-12-19 10:34:56 +00:00
|
|
|
(("\\.lua\\'" . lua-mode)
|
|
|
|
("\\.rockspec\\'" . lua-mode)))
|
2021-09-16 21:18:52 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package rust-mode
|
2022-12-22 12:11:44 +00:00
|
|
|
"Major mode for Rust."
|
2021-09-16 21:18:52 +00:00
|
|
|
:mode
|
2022-12-19 10:34:56 +00:00
|
|
|
("\\.rs\\'" . rust-mode))
|
2021-09-16 21:18:52 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package typescript-mode
|
2022-12-22 12:11:44 +00:00
|
|
|
"Major mode for TypeScript."
|
2022-12-19 10:34:56 +00:00
|
|
|
:mode
|
|
|
|
("\\.tsx?\\'" . typescript-mode))
|
2020-07-16 23:49:09 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package web-mode
|
2022-12-22 12:11:44 +00:00
|
|
|
"Major mode for web templates."
|
2020-08-29 21:28:17 +00:00
|
|
|
:custom
|
2022-12-19 10:34:56 +00:00
|
|
|
(web-mode-markup-indent-offset 2 "Use 2 spaces instead of 4 for indenting HTML elements")
|
|
|
|
(web-mode-enable-auto-quoting nil "Do not automatically insert quotes after HTML attributes")
|
|
|
|
:mode
|
|
|
|
(("\\.php\\'" . web-mode)
|
|
|
|
("\\.html\\'" . web-mode)))
|
2020-07-16 23:49:09 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; anzu
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(external-package anzu
|
2022-12-22 12:11:44 +00:00
|
|
|
"Displays matching and replacement information in the mode line."
|
2020-08-29 21:28:17 +00:00
|
|
|
:config
|
2022-12-19 10:34:56 +00:00
|
|
|
(global-anzu-mode)
|
2020-08-29 21:28:17 +00:00
|
|
|
:bind
|
2022-12-22 10:39:30 +00:00
|
|
|
(("M-s r ." . anzu-query-replace-at-cursor)
|
|
|
|
("<remap> <query-replace>" . anzu-query-replace)
|
2022-12-19 10:34:56 +00:00
|
|
|
("<remap> <query-replace-regexp>" . anzu-query-replace-regexp)))
|
2020-08-29 21:28:17 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; bufler
|
|
|
|
;; ---------------------------------- ;;
|
2022-06-27 19:07:30 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package bufler
|
2022-12-22 12:11:44 +00:00
|
|
|
"Presents open buffers in a grouped and organized menu."
|
2022-06-27 19:07:30 +00:00
|
|
|
:custom
|
2022-12-19 10:34:56 +00:00
|
|
|
(bufler-columns '("Name" "Path"))
|
|
|
|
(bufler-list-group-separators '((0 . "\n")))
|
|
|
|
(bufler-column-name-modified-buffer-sigil " ●")
|
|
|
|
(bufler-list-display-buffer '((display-buffer-reuse-window display-buffer-same-window)))
|
|
|
|
(bufler-groups (bufler-defgroups
|
|
|
|
(group
|
|
|
|
;; Subgroup collecting all named workspaces.
|
|
|
|
(auto-workspace))
|
|
|
|
(group
|
|
|
|
;; Subgroup collecting all `help-mode' and `info-mode' buffers.
|
|
|
|
(group-or "Help/Info"
|
|
|
|
(mode-match "Help" (rx bos "help-"))
|
|
|
|
(mode-match "Info" (rx bos "info-"))))
|
|
|
|
(group
|
|
|
|
;; Subgroup collecting all special buffers (i.e. ones that are not file-backed),
|
|
|
|
;; except certain ones like Dired, Forge, or Magit buffers (which are allowed to
|
|
|
|
;; fall through to other groups, so they end up grouped with their project buffers).
|
|
|
|
(group-not "Special"
|
|
|
|
(group-or "Special"
|
|
|
|
(mode-match "Magit" (rx bos "magit-"))
|
|
|
|
(mode-match "Forge" (rx bos "forge-"))
|
|
|
|
(mode-match "Dired" (rx bos "dired"))
|
|
|
|
(mode-match "grep" (rx bos "grep-"))
|
|
|
|
(mode-match "Compilation" (rx bos "compilation-"))
|
|
|
|
(auto-file)))
|
|
|
|
(group
|
|
|
|
;; Subgroup collecting these "special special" buffers
|
|
|
|
;; separately for convenience.
|
|
|
|
(name-match "Emacs"
|
|
|
|
(rx bos "*" (or "Messages" "Warnings" "scratch" "Backtrace") "*")))
|
|
|
|
(group
|
|
|
|
;; Subgroup collecting all other Magit buffers, grouped by directory.
|
|
|
|
(mode-match "Magit" (rx bos "magit-"))
|
|
|
|
(auto-directory))
|
|
|
|
;; Remaining special buffers are grouped automatically by mode.
|
|
|
|
(auto-mode))
|
|
|
|
(group
|
|
|
|
;; Subgroup collecting buffers in a version-control project,
|
|
|
|
;; grouping them by directory (using the parent project keeps,
|
|
|
|
;; e.g. git worktrees with their parent repos).
|
|
|
|
(auto-parent-project)
|
|
|
|
(group-not "Special"
|
|
|
|
;; This subgroup collects special buffers so they are
|
|
|
|
;; easily distinguished from file buffers.
|
|
|
|
(group-or "Non-file-backed and neither Dired nor Magit"
|
|
|
|
(mode-match "Magit Status" (rx bos "magit-status"))
|
|
|
|
(mode-match "Dired" (rx bos "dired-"))
|
|
|
|
(auto-file))))
|
|
|
|
;; Group remaining buffers by directory, then major mode.
|
|
|
|
(auto-directory)
|
|
|
|
(auto-mode)))
|
|
|
|
:bind
|
|
|
|
(("C-x C-b" . bufler-list)))
|
2022-06-27 19:07:30 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; consult
|
|
|
|
;; ---------------------------------- ;;
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package consult
|
2022-12-22 12:11:44 +00:00
|
|
|
"Provides a number of autocompletion-enhanced replacements for default commands."
|
2022-12-19 10:34:56 +00:00
|
|
|
:config
|
|
|
|
;; `eshell-mode-map' is not available until the `esh-mode' module is loaded
|
|
|
|
(eval-after-load 'esh-mode (lambda ()
|
|
|
|
(bind-key "C-r" #'consult-history 'eshell-mode-map)))
|
|
|
|
:bind
|
|
|
|
(("M-s l" . consult-line)
|
|
|
|
("M-s L" . consult-line-multi)
|
|
|
|
("C-S-s" . consult-line-multi)
|
|
|
|
("C-x M-b" . consult-buffer-other-window)
|
|
|
|
("<remap> <goto-line>" . consult-goto-line)
|
|
|
|
("<remap> <isearch-forward>" . consult-line)
|
|
|
|
("<remap> <switch-to-buffer>" . consult-buffer)
|
|
|
|
("<remap> <yank-pop>" . consult-yank-from-kill-ring)
|
|
|
|
("<remap> <project-find-regexp>" . consult-ripgrep)))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; corfu
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(external-package corfu
|
2022-12-22 12:11:44 +00:00
|
|
|
"Enhances completion suggestions with a visible popup."
|
2022-12-19 12:05:05 +00:00
|
|
|
:init
|
2022-12-19 10:34:56 +00:00
|
|
|
(global-corfu-mode)
|
2022-12-19 12:05:05 +00:00
|
|
|
:config
|
2022-12-19 10:34:56 +00:00
|
|
|
(corfu-popupinfo-mode)
|
2022-12-30 01:40:21 +00:00
|
|
|
(corfu-history-mode)
|
|
|
|
(add-to-list 'savehist-additional-variables 'corfu-history)
|
2022-12-30 01:39:19 +00:00
|
|
|
;; Set `line-spacing' to a custom value in corfu buffers for some
|
|
|
|
;; added visual separation between completion candidates
|
|
|
|
(advice-add 'corfu--make-buffer :around (lambda (orig-fun &rest args)
|
|
|
|
(let ((line-spacing 0.2))
|
|
|
|
(apply orig-fun args))))
|
2022-12-19 10:34:56 +00:00
|
|
|
:custom
|
|
|
|
(corfu-auto t "Automatically display popups wherever available")
|
|
|
|
(corfu-min-width 20 "Ensure completion popups are at least 20 columns wide")
|
|
|
|
(corfu-max-width 50 "Limit completion popup width to 50 columns")
|
2022-12-19 12:05:05 +00:00
|
|
|
(corfu-popupinfo-hide nil "Don't hide doc popups while scrolling between candidates")
|
|
|
|
(corfu-popupinfo-delay 0.1 "Wait 0.1 seconds before showing a doc popup for a candidate")
|
2022-12-30 01:40:13 +00:00
|
|
|
(corfu-popupinfo-max-width 70 "Limit doc popup width to 70 columns")
|
|
|
|
(corfu-popupinfo-min-height 4 "Ensure doc popups are at least 4 lines tall")
|
2022-12-19 12:05:05 +00:00
|
|
|
(corfu-echo-documentation nil "Disable displaying documentation strings in the echo area")
|
2022-12-20 01:43:15 +00:00
|
|
|
:hook
|
|
|
|
;; Displaying popups aggressively (i.e. without summoning them with a key press) can
|
|
|
|
;; cause the cursor to jump around in `eshell-mode'
|
|
|
|
(eshell-mode-hook . (lambda ()
|
|
|
|
(setq-local corfu-auto nil)))
|
2022-12-19 12:05:05 +00:00
|
|
|
:bind
|
|
|
|
(:map corfu-popupinfo-map
|
|
|
|
("M-n" . corfu-popupinfo-scroll-up)
|
|
|
|
("M-p" . corfu-popupinfo-scroll-down)))
|
2022-12-19 10:34:56 +00:00
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; corfu-terminal
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(external-package corfu-terminal
|
2022-12-22 12:11:44 +00:00
|
|
|
"Allows Corfu to function when not running in a graphical frame."
|
2022-12-19 10:34:56 +00:00
|
|
|
:when
|
2022-12-30 04:42:19 +00:00
|
|
|
(not (or (daemonp)
|
|
|
|
(display-graphic-p)))
|
2022-12-19 10:34:56 +00:00
|
|
|
:config
|
|
|
|
(corfu-terminal-mode))
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; diff-hl
|
|
|
|
;; ---------------------------------- ;;
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package diff-hl
|
2022-12-22 12:11:44 +00:00
|
|
|
"Highlights uncommited changes to version controlled files in the gutter."
|
2022-12-19 10:34:56 +00:00
|
|
|
:config
|
|
|
|
(global-diff-hl-mode)
|
2022-12-22 12:04:28 +00:00
|
|
|
(diff-hl-flydiff-mode))
|
2022-12-19 10:34:56 +00:00
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; fish-completion
|
|
|
|
;; ---------------------------------- ;;
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package fish-completion
|
2022-12-22 12:11:44 +00:00
|
|
|
"Sources shell completion candidates from the fish shell."
|
2022-12-19 10:34:56 +00:00
|
|
|
:when
|
|
|
|
(executable-find "fish")
|
2019-04-12 08:35:58 +00:00
|
|
|
:hook
|
2022-12-19 10:34:56 +00:00
|
|
|
(eshell-mode-hook . fish-completion-mode))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; flycheck
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(external-package flycheck
|
2022-12-22 12:11:44 +00:00
|
|
|
"Enables on-the-fly syntax checking for supported languages."
|
2019-10-01 06:26:29 +00:00
|
|
|
:custom
|
2022-12-19 10:34:56 +00:00
|
|
|
(flycheck-idle-change-delay 2 "Wait for 2 seconds of idling before invoking any checkers")
|
2022-06-08 20:37:55 +00:00
|
|
|
(flycheck-check-syntax-automatically '(save idle-change mode-enabled))
|
2022-12-19 10:34:56 +00:00
|
|
|
:hook
|
|
|
|
(prog-mode-hook . flycheck-mode)
|
2017-11-15 04:15:29 +00:00
|
|
|
:bind
|
|
|
|
("C-c e" . flycheck-list-errors))
|
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; fussy
|
|
|
|
;; ---------------------------------- ;;
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package fussy
|
2022-12-22 12:11:44 +00:00
|
|
|
"Provides a flexible completion style that scores and sorts candidates."
|
2019-04-12 08:35:58 +00:00
|
|
|
:custom
|
2022-12-19 10:34:56 +00:00
|
|
|
(completion-ignore-case t "Ignore case in completion candidates")
|
|
|
|
(completion-category-defaults nil "Disable category-specific completion styles")
|
|
|
|
(completion-category-overrides nil "Disable category-specific completion styles")
|
2022-12-19 12:06:05 +00:00
|
|
|
(completion-styles '(substring fussy basic) "Set fussy as a fallback completion style"))
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; hl-todo
|
|
|
|
;; ---------------------------------- ;;
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package hl-todo
|
2022-12-22 12:11:44 +00:00
|
|
|
"Highlights certain keywords in comments."
|
2022-12-19 10:34:56 +00:00
|
|
|
:custom
|
|
|
|
(hl-todo-keyword-faces '(("TODO" . hl-todo)
|
|
|
|
("TEMP" . hl-todo)
|
|
|
|
("HACK" . hl-todo)
|
|
|
|
("DEBUG" . hl-todo)
|
|
|
|
("FIXME" . hl-todo)))
|
|
|
|
:hook
|
|
|
|
(prog-mode-hook . hl-todo-mode))
|
2022-06-08 00:28:22 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; kind-icon
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(external-package kind-icon
|
2022-12-22 12:11:44 +00:00
|
|
|
"Adds contextual icons in front of Corfu completion candidates."
|
2022-06-08 00:28:22 +00:00
|
|
|
:config
|
|
|
|
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter)
|
|
|
|
:custom
|
2022-12-19 10:34:56 +00:00
|
|
|
(kind-icon-use-icons nil "Use stylized text labels instead of graphical badges")
|
2022-12-30 01:40:13 +00:00
|
|
|
(kind-icon-blend-frac 0.25 "Brighten background colors with heavy blending from foreground colors")
|
2022-12-19 10:34:56 +00:00
|
|
|
(kind-icon-default-face 'corfu-default "Stylize characters using the same face as Corfu"))
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; ligature
|
|
|
|
;; ---------------------------------- ;;
|
2020-08-30 20:11:11 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package ligature
|
2022-12-22 12:11:44 +00:00
|
|
|
"Enables support for mapping characters to ligatures."
|
2020-08-30 20:11:11 +00:00
|
|
|
:config
|
2022-12-19 10:34:56 +00:00
|
|
|
(ligature-set-ligatures 'prog-mode
|
|
|
|
'(;; This set of ligatures is for Fira Code, but
|
|
|
|
;; should work for most any font with ligatures
|
|
|
|
|
|
|
|
;; && &&&
|
|
|
|
;; ;; ;;;
|
|
|
|
;; %% %%%
|
|
|
|
;; ?? ??? ?: ?= ?.
|
|
|
|
;; !! !!! !. !: !!. != !== !~
|
|
|
|
(";" (rx (+ ";")))
|
|
|
|
("&" (rx (+ "&")))
|
|
|
|
("%" (rx (+ "%")))
|
|
|
|
("?" (rx (or ":" "=" "\." (+ "?"))))
|
|
|
|
("!" (rx (+ (or "=" "!" "\." ":" "~"))))
|
|
|
|
|
|
|
|
;; \\ \\\ \/
|
|
|
|
;; ++ +++ ++++ +>
|
|
|
|
;; :: ::: :::: :> :< := :// ::=
|
|
|
|
;; // /// //// /\ /* /> /===:===!=//===>>==>==/
|
|
|
|
;; == === ==== => =| =>>=>=|=>==>> ==< =/=//=// =~ =:= =!=
|
|
|
|
("\\" (rx (or "/" (+ "\\"))))
|
|
|
|
("+" (rx (or ">" (+ "+"))))
|
|
|
|
(":" (rx (or ">" "<" "=" "//" ":=" (+ ":"))))
|
|
|
|
("/" (rx (+ (or ">" "<" "|" "/" "\\" "\*" ":" "!" "="))))
|
|
|
|
("=" (rx (+ (or ">" "<" "|" "/" "~" ":" "!" "="))))
|
|
|
|
|
|
|
|
;; |> ||> |||> ||||> |] |} || ||| |-> ||-||
|
|
|
|
;; |->>-||-<<-| |- |== ||=|| |==>>==<<==<=>==//==/=!==:===>
|
|
|
|
("|" (rx (+ (or ">" "<" "|" "/" ":" "!" "}" "\]" "-" "=" ))))
|
|
|
|
|
|
|
|
;; *> */ *) ** *** ****
|
|
|
|
;; .. ... .... .= .- .? ..= ..<
|
|
|
|
;; -- --- ---- -~ -> ->> -| -|->-->>->--<<-|
|
|
|
|
;; #: #= #! #( #? #[ #{ #_ #_( ## ### #####
|
|
|
|
;; >: >- >>- >--|-> >>-|-> >= >== >>== >=|=:=>> >> >>> >>>>
|
|
|
|
("*" (rx (or ">" "/" ")" (+ "*"))))
|
|
|
|
("\." (rx (or "=" "-" "\?" "\.=" "\.<" (+ "\."))))
|
|
|
|
("-" (rx (+ (or ">" "<" "|" "~" "-"))))
|
|
|
|
("#" (rx (or ":" "=" "!" "(" "\?" "\[" "{" "_(" "_" (+ "#"))))
|
|
|
|
(">" (rx (+ (or ">" "<" "|" "/" ":" "=" "-"))))
|
|
|
|
|
|
|
|
;; <> <!-- <|> <: <~ <~> <~~ <+ <* <$ </ <+> <*>
|
|
|
|
;; <$> </> <| <|| <||| <|||| <- <-| <-<<-|-> <->>
|
|
|
|
;; <<-> <= <=> <<==<<==>=|=>==/==//=!==:=> << <<< <<<<
|
|
|
|
("<" (rx (+ (or "\+" "\*" "\$" "<" ">" ":" "~" "!" "-" "/" "|" "="))))
|
|
|
|
|
|
|
|
;; __ ___ ____ _|_ __|____|_
|
|
|
|
;; ~~ ~~~ ~= ~- ~@ ~> ~~>
|
|
|
|
("_" (rx (+ (or "_" "|"))))
|
|
|
|
("~" (rx (or ">" "=" "-" "@" "~>" (+ "~"))))
|
|
|
|
|
|
|
|
;; {| [\ ]# (* }# $> ^=
|
|
|
|
"{|" "[|" "]#" "(*" "}#" "$>" "^="
|
|
|
|
|
|
|
|
;; www wwww
|
|
|
|
;; 0xFF 0x12
|
|
|
|
;; Fl Tl fi fj fl ft
|
|
|
|
("w" (rx (+ "w")))
|
|
|
|
("0" (rx (and "x" (+ (in "A-F" "a-f" "0-9")))))
|
|
|
|
"Fl" "Tl" "fi" "fj" "fl" "ft"))
|
|
|
|
:hook
|
|
|
|
(prog-mode-hook . ligature-mode))
|
2022-12-11 20:36:50 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; lsp-mode
|
|
|
|
;; ---------------------------------- ;;
|
2022-02-02 05:05:30 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package lsp-mode
|
2022-12-22 12:11:44 +00:00
|
|
|
"Provides Language Server Protocol support and integration."
|
2022-12-19 10:34:56 +00:00
|
|
|
:custom
|
|
|
|
(lsp-eldoc-enable-hover nil "Do not print symbol eldoc information in the echo area")
|
|
|
|
(lsp-signature-auto-activate nil "Do not display function signature docs in the echo area")
|
|
|
|
(lsp-headerline-breadcrumb-enable nil "Do not display a file/function breadcrumb headerline")
|
|
|
|
(lsp-modeline-code-actions-enable nil "Do not display suggested code actions in the mode line")
|
2022-02-02 05:05:30 +00:00
|
|
|
:commands
|
2022-12-19 10:34:56 +00:00
|
|
|
(lsp
|
|
|
|
lsp-deferred)
|
|
|
|
:hook
|
|
|
|
(css-mode-hook . lsp-deferred)
|
|
|
|
(gdscript-mode-hook . lsp-deferred)
|
|
|
|
(js-mode-hook . lsp-deferred)
|
|
|
|
(json-mode-hook . lsp-deferred)
|
|
|
|
(rust-mode-hook . lsp-deferred)
|
|
|
|
(typescript-mode-hook . lsp-deferred)
|
|
|
|
(web-mode-hook . lsp-deferred))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; lsp-ui
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(external-package lsp-ui
|
2022-12-22 12:11:44 +00:00
|
|
|
"Provides higher-level UI integration of LSP features for `lsp-mode'."
|
2022-12-11 21:32:12 +00:00
|
|
|
:config
|
2022-12-19 10:34:56 +00:00
|
|
|
(setq lsp-ui-doc-border (face-background 'lsp-ui-doc-background))
|
|
|
|
:custom
|
|
|
|
(lsp-ui-imenu-enable nil "Disable automatic activation of imenu side window")
|
|
|
|
(lsp-ui-peek-always-show t "Always show peek popup, even with only one entry")
|
|
|
|
(lsp-ui-doc-enable nil "Disable automatic activation of documentation elements")
|
|
|
|
(lsp-ui-doc-max-width 50 "Limit documentation popup width to 50 columns")
|
|
|
|
(lsp-ui-doc-max-height 10 "Limit documentation popup height to 10 lines")
|
|
|
|
(lsp-ui-doc-header t "Show documentation header displaying the symbol name")
|
|
|
|
(lsp-ui-doc-position 'top "Show documentation popups at the top of the window")
|
|
|
|
(lsp-ui-doc-alignment 'window "Align documentation popups with the window, not the frame")
|
|
|
|
(lsp-ui-doc-include-signature t "Show object signature/type in the documentation popup")
|
|
|
|
(lsp-ui-doc-show-with-cursor t "Enable displaying documentation of symbols under the cursor")
|
|
|
|
:bind
|
|
|
|
(:map lsp-ui-mode-map
|
|
|
|
("M-," . lsp-ui-doc-mode)
|
|
|
|
("M-." . lsp-ui-peek-find-definitions)
|
|
|
|
("M-?" . lsp-ui-peek-find-references)))
|
2018-03-07 06:56:17 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; magit
|
|
|
|
;; ---------------------------------- ;;
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package magit
|
2022-12-22 12:11:44 +00:00
|
|
|
"Provides a visual interface to git."
|
2022-06-08 01:21:28 +00:00
|
|
|
:custom
|
2022-12-19 12:10:58 +00:00
|
|
|
(magit-status-margin '(t age magit-log-margin-width nil 18) "Display margin in status buffer")
|
|
|
|
(git-commit-summary-max-length 50 "Highlight characters in commit summaries past column 50")
|
2022-12-19 10:34:56 +00:00
|
|
|
(magit-display-buffer-function 'magit-display-buffer-same-window-except-diff-v1)
|
|
|
|
:bind
|
|
|
|
("C-c g" . magit-status))
|
2018-03-07 06:56:17 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; magit-todos
|
|
|
|
;; ---------------------------------- ;;
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package magit-todos
|
2022-12-22 12:11:44 +00:00
|
|
|
"Shows a list of keyword-containing comments in the Magit status buffer."
|
2019-04-12 08:35:58 +00:00
|
|
|
:hook
|
2022-12-19 10:34:56 +00:00
|
|
|
(magit-mode-hook . magit-todos-mode))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; marginalia
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(external-package marginalia
|
2022-12-22 12:11:44 +00:00
|
|
|
"Adds informative annotations to completion candidates in the minibuffer."
|
2019-04-12 08:35:58 +00:00
|
|
|
:config
|
2022-12-19 10:34:56 +00:00
|
|
|
(defun marginalia--file-owner (_) "")
|
|
|
|
(defun marginalia--file-modes (_) "")
|
|
|
|
(defun marginalia--symbol-class (_) "")
|
|
|
|
(defun marginalia--buffer-status (_) "")
|
|
|
|
(marginalia-mode))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; mood-line
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(external-package mood-line
|
2022-12-22 12:11:44 +00:00
|
|
|
"Gives the mode-line a cleaner appearance."
|
2017-11-15 04:15:29 +00:00
|
|
|
:config
|
2022-12-22 12:11:27 +00:00
|
|
|
(mood-line-mode)
|
|
|
|
:custom
|
|
|
|
(mood-line-glyph-alist mood-line-glyphs-fira-code "Use Fira Code-compatible decorative glyphs"))
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; multiple-cursors
|
|
|
|
;; ---------------------------------- ;;
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package multiple-cursors
|
2022-12-22 12:11:44 +00:00
|
|
|
"Provides the ability to summon additional cursors."
|
2017-11-15 04:15:29 +00:00
|
|
|
:bind
|
|
|
|
(("C->" . mc/mark-next-like-this)
|
|
|
|
("C-<" . mc/mark-previous-like-this)
|
|
|
|
("C-c C->" . mc/mark-all-like-this)
|
|
|
|
("C-c C-<" . mc/mark-all-like-this)))
|
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; neotree
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(external-package neotree
|
2022-12-22 12:11:44 +00:00
|
|
|
"Displays an interactive directory/file tree in a side window."
|
2022-12-30 01:45:16 +00:00
|
|
|
:config
|
|
|
|
(advice-add 'neotree-change-root :after (lambda () (goto-char (point-min))))
|
2022-12-19 10:34:56 +00:00
|
|
|
:custom
|
|
|
|
(neo-smart-open t "Jump to current file when focusing the neotree window")
|
|
|
|
(neo-window-width 30 "Limit neotree window width to 30 columns")
|
|
|
|
(neo-show-updir-line nil "Disable dipspying updir (..) line in the neotree window")
|
|
|
|
(neo-confirm-create-file #'off-p "Skip confirmation when creating a new file from neotree")
|
|
|
|
(neo-confirm-create-directory #'off-p "Skip confirmation when creating a new directory from neotree")
|
|
|
|
:bind
|
|
|
|
(("C-c t" . neotree)
|
|
|
|
(:map neotree-mode-map
|
|
|
|
("C-c w" . (lambda () (interactive) nil))
|
|
|
|
("C-c q" . (lambda () (interactive) nil))
|
|
|
|
("C-c n" . (lambda () (interactive) nil)))))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; package-lint
|
|
|
|
;; ---------------------------------- ;;
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; Load Package-Lint
|
|
|
|
(external-package package-lint
|
2022-12-22 12:11:44 +00:00
|
|
|
"Provides a command for linting Emacs Lisp packages."
|
2022-12-19 10:34:56 +00:00
|
|
|
:commands
|
|
|
|
(package-lint-current-buffer))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; page-break-lines
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(external-package page-break-lines
|
2022-12-22 12:11:44 +00:00
|
|
|
"Displays form feed characters as horizontal rules."
|
2022-12-19 10:34:56 +00:00
|
|
|
:config
|
|
|
|
(global-page-break-lines-mode))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; rainbow-delimiters
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(external-package rainbow-delimiters
|
2022-12-22 12:11:44 +00:00
|
|
|
"Highlights matching delimiters with colors according to depth."
|
2019-04-12 08:35:58 +00:00
|
|
|
:hook
|
2022-12-19 10:34:56 +00:00
|
|
|
(prog-mode-hook . rainbow-delimiters-mode))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; resize-window
|
|
|
|
;; ---------------------------------- ;;
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package resize-window
|
2022-12-22 12:11:44 +00:00
|
|
|
"Provides an overlay that allows for quick window management inputs."
|
2022-12-19 10:34:56 +00:00
|
|
|
:bind
|
|
|
|
("C-c w" . resize-window))
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; restclient
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(external-package restclient
|
2022-12-22 12:11:44 +00:00
|
|
|
"Allows for the execution of HTTP queries from plain-text query sheets."
|
2022-12-19 10:34:56 +00:00
|
|
|
:config
|
|
|
|
(defun restclient ()
|
|
|
|
"Open the restclient buffer, (re)creating it if not present."
|
|
|
|
(interactive)
|
|
|
|
(pop-to-buffer (get-buffer-create "*restclient*") '((display-buffer-reuse-window display-buffer-same-window)))
|
|
|
|
(unless (derived-mode-p 'restclient-mode)
|
|
|
|
(restclient-mode)))
|
|
|
|
:commands
|
|
|
|
(restclient))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; slime
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(external-package slime
|
2022-12-22 12:11:44 +00:00
|
|
|
"Provides an interactive programming environment for Common Lisp."
|
2019-04-12 08:35:58 +00:00
|
|
|
:custom
|
2022-12-19 10:34:56 +00:00
|
|
|
(inferior-lisp-program (executable-find "sbcl") "Set SBCL as the default Common Lisp implementation")
|
|
|
|
:commands
|
|
|
|
(slime))
|
|
|
|
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; slime-docker
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(external-package slime-docker
|
2022-12-22 12:11:44 +00:00
|
|
|
"Integrates SLIME with Lisps running in Docker containers."
|
2022-12-19 10:34:56 +00:00
|
|
|
:custom
|
|
|
|
(slime-docker-program "sbcl" "Set SBCL as the default Common Lisp implementation in containers")
|
|
|
|
:commands
|
|
|
|
(slime-docker))
|
2017-11-16 00:38:23 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; string-inflection
|
|
|
|
;; ---------------------------------- ;;
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package string-inflection
|
2022-12-22 12:11:44 +00:00
|
|
|
"Provides case conversion functions for symbols and strings."
|
2022-12-19 10:34:56 +00:00
|
|
|
:commands
|
|
|
|
(string-inflection-underscore-function
|
|
|
|
string-inflection-pascal-case-function
|
|
|
|
string-inflection-camelcase-function
|
|
|
|
string-inflection-upcase-function
|
|
|
|
string-inflection-kebab-case-function
|
|
|
|
string-inflection-capital-underscore-function))
|
2017-11-15 04:15:29 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; solaire-mode
|
|
|
|
;; ---------------------------------- ;;
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package solaire-mode
|
2022-12-22 12:11:44 +00:00
|
|
|
"Recolors special buffers to distinguish them from regular buffers."
|
2022-12-19 10:34:56 +00:00
|
|
|
:custom
|
|
|
|
(solaire-mode-real-buffer-fn (lambda ()
|
|
|
|
(and (buffer-name (buffer-base-buffer))
|
2022-12-20 23:26:12 +00:00
|
|
|
(not (derived-mode-p 'neotree-mode))
|
2022-12-19 10:34:56 +00:00
|
|
|
(not (string-match "\*Echo Area" (buffer-name (buffer-base-buffer)))))))
|
2019-04-12 08:35:58 +00:00
|
|
|
:hook
|
2022-12-19 10:34:56 +00:00
|
|
|
(server-after-make-frame-hook . solaire-global-mode)
|
|
|
|
(emacs-startup-hook . solaire-global-mode))
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
2022-12-20 23:26:12 +00:00
|
|
|
;; undo-fu-session
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
2019-10-01 06:28:55 +00:00
|
|
|
|
2022-12-20 23:26:12 +00:00
|
|
|
(defconst user/undo-history-directory (locate-user-emacs-file "undo-history/") "Location of undo-fu-session history backups.")
|
2022-12-19 10:34:56 +00:00
|
|
|
|
2022-12-20 23:26:12 +00:00
|
|
|
(external-package undo-fu-session
|
2022-12-22 12:11:44 +00:00
|
|
|
"Saves and recovers undo history of files between editing sessions."
|
2022-12-19 10:34:56 +00:00
|
|
|
:config
|
2022-12-20 23:26:12 +00:00
|
|
|
(global-undo-fu-session-mode)
|
2022-12-19 10:34:56 +00:00
|
|
|
:custom
|
2022-12-20 23:26:12 +00:00
|
|
|
(undo-fu-session-directory user/undo-history-directory "Set custom undo history storage location"))
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; vertico
|
|
|
|
;; ---------------------------------- ;;
|
2020-08-29 21:27:41 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package vertico
|
2022-12-22 12:11:44 +00:00
|
|
|
"Provides a vertical autocompletion UI in the minibuffer."
|
2020-08-29 21:27:41 +00:00
|
|
|
:custom
|
2022-12-19 10:34:56 +00:00
|
|
|
(vertico-cycle t "Enable wrap-around candidate cycling")
|
|
|
|
(vertico-count 9 "Display a maximum of 9 candidates in the minibuffer")
|
|
|
|
(vertico-resize nil "Keep the minibuffer at a static size")
|
|
|
|
(vertico-group-format nil "Disable candidate group titles")
|
|
|
|
(vertico-count-format nil "Disable candidate count display")
|
2022-06-13 01:15:43 +00:00
|
|
|
:hook
|
2022-12-19 10:34:56 +00:00
|
|
|
(emacs-startup-hook . vertico-mode)
|
|
|
|
(vertico-mode-hook . vertico-mouse-mode)
|
2022-06-13 01:15:43 +00:00
|
|
|
(rfn-eshadow-update-overlay-hook . vertico-directory-tidy)
|
2020-08-29 21:27:41 +00:00
|
|
|
:bind
|
2022-06-13 01:15:43 +00:00
|
|
|
(:map vertico-map
|
2022-12-19 10:34:56 +00:00
|
|
|
("\r" . vertico-directory-enter)
|
|
|
|
("\d" . vertico-directory-delete-char)
|
|
|
|
("\M-\d" . vertico-directory-delete-word)))
|
|
|
|
|
2022-12-20 23:26:12 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; vundo
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(external-package vundo
|
2022-12-22 12:11:44 +00:00
|
|
|
"Visualizes undo history as a tree in an interactive buffer."
|
2022-12-20 23:26:12 +00:00
|
|
|
:custom
|
|
|
|
(vundo-glyph-alist vundo-unicode-symbols "Visualize undo history with pretty unicode symbols")
|
|
|
|
:hook
|
|
|
|
(vundo-mode-hook . (lambda ()
|
|
|
|
(setq-local global-hl-line-mode nil)))
|
|
|
|
:bind
|
|
|
|
("C-x u" . vundo))
|
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; writeroom-mode
|
|
|
|
;; ---------------------------------- ;;
|
|
|
|
|
|
|
|
(external-package writeroom-mode
|
2022-12-22 12:11:44 +00:00
|
|
|
"Centers the working text area in the active buffer."
|
2022-12-19 10:34:56 +00:00
|
|
|
:custom
|
|
|
|
(writeroom-width 140 "Set the working area width to 140 columns.")
|
2022-12-19 12:05:39 +00:00
|
|
|
(writeroom-maximize-window nil "Do not maximize the active window.")
|
2022-12-19 10:34:56 +00:00
|
|
|
(writeroom-mode-line t "Show the mode line while writeroom-mode is active.")
|
|
|
|
(writeroom-header-line t "Show the header line while writeroom-mode is active.")
|
|
|
|
(writeroom-global-effects nil "Disable all frame-wide writeroom effects.")
|
|
|
|
(writeroom-fringes-outside-margins nil "Keep the fringes close to the text.")
|
|
|
|
:bind
|
2022-12-20 22:40:03 +00:00
|
|
|
(("C-c c" . writeroom-mode)
|
2022-12-19 10:34:56 +00:00
|
|
|
(:map writeroom-mode-map
|
|
|
|
("C-<next>" . writeroom-decrease-width)
|
|
|
|
("C-<prior>" . writeroom-increase-width))))
|
2020-08-29 21:27:41 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; ---------------------------------- ;;
|
|
|
|
;; yansippet
|
|
|
|
;; ---------------------------------- ;;
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2022-12-20 01:49:10 +00:00
|
|
|
(defconst user/yasnippet-directory (locate-user-emacs-file "snippet/") "Location of user snippet files.")
|
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
(external-package yasnippet
|
2022-12-22 12:11:44 +00:00
|
|
|
"Allows for the definition and automatic expansion of text templates."
|
2022-12-19 10:34:56 +00:00
|
|
|
:custom
|
|
|
|
(yas-also-indent-empty-lines t "Indent lines in expanded templates even if empty")
|
|
|
|
(yas-also-auto-indent-first-line t "Always indent first line in expanded templates")
|
2022-12-20 03:37:48 +00:00
|
|
|
(yas-snippet-dirs '(user/yasnippet-directory) "Set snippet files location")
|
2022-12-22 11:32:54 +00:00
|
|
|
:config
|
|
|
|
(yas-reload-all)
|
2022-12-19 10:34:56 +00:00
|
|
|
:hook
|
|
|
|
(prog-mode-hook . yas-minor-mode)
|
|
|
|
(text-mode-hook . yas-minor-mode)
|
|
|
|
(fundamental-mode-hook . yas-minor-mode))
|
2019-04-12 08:35:58 +00:00
|
|
|
|
2022-12-19 10:34:56 +00:00
|
|
|
;; --------------------------------------------------------------------------
|
2019-04-12 08:35:58 +00:00
|
|
|
;;
|
2022-12-19 10:34:56 +00:00
|
|
|
;; End of init file
|
2019-04-12 08:35:58 +00:00
|
|
|
;;
|
2022-12-19 10:34:56 +00:00
|
|
|
;; --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(provide 'init)
|
2019-04-12 08:35:58 +00:00
|
|
|
|
|
|
|
;;; init.el ends here
|