Combine various config files into init.el
This commit is contained in:
parent
ea498b169d
commit
58e0b8a4f3
@ -1,8 +1,12 @@
|
|||||||
;;; early-init.el -*- lexical-binding: t; -*-
|
;;; early-init.el --- Early initialization for Emacs. -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
;; Emacs 27.1 introduced early-init.el, which is run before init.el, before
|
;; Emacs 27.1 introduced early-init.el, which is run before init.el, before
|
||||||
;; package and UI initialization happens, and before site files are loaded.
|
;; package and UI initialization happens, and before site files are loaded.
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
;; Minimize garbage collection during startup.
|
;; Minimize garbage collection during startup.
|
||||||
(setq gc-cons-threshold most-positive-fixnum)
|
(setq gc-cons-threshold most-positive-fixnum)
|
||||||
|
|
||||||
@ -10,3 +14,6 @@
|
|||||||
(add-hook 'emacs-startup-hook
|
(add-hook 'emacs-startup-hook
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(setq gc-cons-threshold (expt 2 23))))
|
(setq gc-cons-threshold (expt 2 23))))
|
||||||
|
|
||||||
|
(provide 'early-init)
|
||||||
|
;;; early-init.el ends here
|
||||||
|
32
editor.el
32
editor.el
@ -1,32 +0,0 @@
|
|||||||
;; Automatically reload files if modified outside of the editor.
|
|
||||||
(global-auto-revert-mode)
|
|
||||||
|
|
||||||
;; Overwrite selected text when typing.
|
|
||||||
(delete-selection-mode)
|
|
||||||
|
|
||||||
;; Display line numbers.
|
|
||||||
(global-display-line-numbers-mode)
|
|
||||||
|
|
||||||
;; Display a ruler in the 80th column.
|
|
||||||
(setq-default display-fill-column-indicator-column 80)
|
|
||||||
(add-hook 'prog-mode-hook #'display-fill-column-indicator-mode)
|
|
||||||
(add-hook 'text-mode-hook #'display-fill-column-indicator-mode)
|
|
||||||
|
|
||||||
;; Whitespace settings:
|
|
||||||
;; - Tabs are 4 space characters (as the gods intended)
|
|
||||||
;; - Ensure a newline character is present at the end files when saving
|
|
||||||
;; - Clean up extraneous whitespace when saving
|
|
||||||
(setq-default indent-tabs-mode nil
|
|
||||||
tab-width 4)
|
|
||||||
(setq require-final-newline t)
|
|
||||||
(add-hook 'before-save-hook 'whitespace-cleanup)
|
|
||||||
|
|
||||||
;; Make sure that UTF-8 is *ALWAYS* the default encoding.
|
|
||||||
(set-charset-priority 'unicode)
|
|
||||||
(prefer-coding-system 'utf-8-unix)
|
|
||||||
|
|
||||||
;; Prettify symbols (eg. lambda -> λ).
|
|
||||||
(global-prettify-symbols-mode)
|
|
||||||
|
|
||||||
;; Enable mouse support.
|
|
||||||
(xterm-mouse-mode +1)
|
|
159
init.el
159
init.el
@ -1,7 +1,12 @@
|
|||||||
;;; init.el --- A (reasonably) minimal initialization file for Emacs.
|
;;; init.el --- A (reasonably) minimal init file for Emacs. -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
|
||||||
;; Manage package configuration via `use-package`.
|
;; ----------------------------------------------------------------------------
|
||||||
|
;; Manage packages via `use-package`.
|
||||||
;; https://github.com/jwiegley/use-package
|
;; https://github.com/jwiegley/use-package
|
||||||
|
|
||||||
(require 'package)
|
(require 'package)
|
||||||
@ -17,31 +22,17 @@
|
|||||||
(package-install 'use-package))
|
(package-install 'use-package))
|
||||||
|
|
||||||
|
|
||||||
;; Configure how and where backup files are created.
|
;; ----------------------------------------------------------------------------
|
||||||
|
;; Define some simple helper functions for loading user-defined configuration
|
||||||
(setq backup-directory-alist '(("." . "~/.emacs.d/backup"))
|
;; files. Load all configuration files for third-party packages and language
|
||||||
backup-by-copying t ; Don't delink hardlinks
|
;; support.
|
||||||
version-control t ; Use version numbers on backups
|
|
||||||
delete-old-versions t ; Automatically delete excess backups
|
|
||||||
kept-new-versions 20 ; How many of the newest versions to keep
|
|
||||||
kept-old-versions 5 ; How many of the oldest versions to keep
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
;; On macOS, `ls` does not support the `--dired` option.
|
|
||||||
(when (string= system-type "darwin")
|
|
||||||
(setq dired-use-ls-dired nil))
|
|
||||||
|
|
||||||
|
|
||||||
;; Define a couple simple helper functions for loading user-defined
|
|
||||||
;; configuration files.
|
|
||||||
|
|
||||||
(defconst user-init-dir "~/.emacs.d/")
|
(defconst user-init-dir "~/.emacs.d/")
|
||||||
|
|
||||||
(defun load-user-file (file)
|
(defun load-user-file (file)
|
||||||
"Load FILE in the current user's configuration directory.
|
"Load FILE in the current user's configuration directory.
|
||||||
File names which are prefixed with an underscore or which do not have the
|
File names which are prefixed with an underscore and/or which do not have
|
||||||
extension '.el' will be ignored."
|
the extension '.el' will be ignored."
|
||||||
(interactive "f")
|
(interactive "f")
|
||||||
(setq file-name (file-name-nondirectory file))
|
(setq file-name (file-name-nondirectory file))
|
||||||
(when (and (string-suffix-p ".el" file-name)
|
(when (and (string-suffix-p ".el" file-name)
|
||||||
@ -57,23 +48,130 @@
|
|||||||
(load-user-file file)))
|
(load-user-file file)))
|
||||||
|
|
||||||
|
|
||||||
;; Load all user-defined configuration files.
|
|
||||||
|
|
||||||
(load-user-file "editor.el")
|
|
||||||
(load-user-file "interface.el")
|
|
||||||
(load-user-file "key-bindings.el")
|
|
||||||
(load-user-file "theme.el")
|
|
||||||
|
|
||||||
(load-user-dir "pkg")
|
(load-user-dir "pkg")
|
||||||
(load-user-dir "lang")
|
(load-user-dir "lang")
|
||||||
|
|
||||||
|
|
||||||
|
;; ----------------------------------------------------------------------------
|
||||||
|
;; Configure how and where backup files are created.
|
||||||
|
|
||||||
|
(setq backup-directory-alist '(("." . "~/.emacs.d/backup"))
|
||||||
|
backup-by-copying t ; Don't delink hardlinks
|
||||||
|
version-control t ; Use version numbers on backups
|
||||||
|
delete-old-versions t ; Automatically delete excess backups
|
||||||
|
kept-new-versions 20 ; How many of the newest versions to keep
|
||||||
|
kept-old-versions 5 ; How many of the oldest versions to keep
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
;; ----------------------------------------------------------------------------
|
||||||
|
;; Interface settings:
|
||||||
|
;; - Open new windows to the right, not on the bottom
|
||||||
|
;; - Don't use double-spaces after periods
|
||||||
|
;; - Use unicode ellipses
|
||||||
|
;; - Don't require full yes/no answers, allow y/n instead
|
||||||
|
;; - Hide the menu bar
|
||||||
|
;; - Make it easier to move between windows. Windows can be navigated using
|
||||||
|
;; <shift> in combination with the arrow keys
|
||||||
|
|
||||||
|
(setq split-height-threshold nil
|
||||||
|
split-width-threshold 0
|
||||||
|
sentence-end-double-space nil
|
||||||
|
truncate-string-ellipsis "…")
|
||||||
|
|
||||||
|
(fset 'yes-or-no-p 'y-or-n-p)
|
||||||
|
(menu-bar-mode -1)
|
||||||
|
|
||||||
|
(setq windmove-wrap-around t)
|
||||||
|
(windmove-default-keybindings)
|
||||||
|
|
||||||
|
|
||||||
|
;; ----------------------------------------------------------------------------
|
||||||
|
;; Mode line configuration:
|
||||||
|
;; - Hide the frame identifier
|
||||||
|
;; - Display the column and line numbers of the cursor
|
||||||
|
;; - Display the file size
|
||||||
|
|
||||||
|
(setq mode-line-frame-identification " ")
|
||||||
|
|
||||||
|
(column-number-mode)
|
||||||
|
(size-indication-mode)
|
||||||
|
|
||||||
|
|
||||||
|
;; ----------------------------------------------------------------------------
|
||||||
|
;; Editor configuration:
|
||||||
|
;; - Scroll line-by-line, rather than jumping around haphazardly
|
||||||
|
;; - Automatically reload files if modified outside of the editor
|
||||||
|
;; - Overwrite selected text when typing
|
||||||
|
;; - Display line numbers
|
||||||
|
;; - Prettify symbols (eg. lambda -> λ)
|
||||||
|
;; - Enable mouse support
|
||||||
|
;; - Display a ruler in the 80th column
|
||||||
|
;; - Make sure that UTF-8 is *ALWAYS* the default encoding
|
||||||
|
|
||||||
|
(setq scroll-conservatively 10000
|
||||||
|
scroll-margin 0
|
||||||
|
scroll-preserve-screen-position 1)
|
||||||
|
|
||||||
|
(global-auto-revert-mode)
|
||||||
|
(delete-selection-mode)
|
||||||
|
(global-display-line-numbers-mode)
|
||||||
|
(global-prettify-symbols-mode)
|
||||||
|
(xterm-mouse-mode +1)
|
||||||
|
|
||||||
|
(setq-default display-fill-column-indicator-column 80)
|
||||||
|
(add-hook 'prog-mode-hook #'display-fill-column-indicator-mode)
|
||||||
|
(add-hook 'text-mode-hook #'display-fill-column-indicator-mode)
|
||||||
|
|
||||||
|
(set-charset-priority 'unicode)
|
||||||
|
(prefer-coding-system 'utf-8-unix)
|
||||||
|
|
||||||
|
|
||||||
|
;; ----------------------------------------------------------------------------
|
||||||
|
;; Whitespace settings:
|
||||||
|
;; - Tabs are 4 space characters (as the gods intended)
|
||||||
|
;; - Ensure a newline character is present at the end files when saving
|
||||||
|
;; - Clean up extraneous whitespace when saving
|
||||||
|
|
||||||
|
(setq-default indent-tabs-mode nil
|
||||||
|
tab-width 4
|
||||||
|
require-final-newline t)
|
||||||
|
|
||||||
|
(add-hook 'before-save-hook 'whitespace-cleanup)
|
||||||
|
|
||||||
|
|
||||||
|
;; ----------------------------------------------------------------------------
|
||||||
|
;; Dired-mode configuration:
|
||||||
|
;; - Show human-readable file sizes in dired mode
|
||||||
|
;; - On macOS, `ls` does not support the `--dired` option
|
||||||
|
|
||||||
|
(setq dired-listing-switches "-alh")
|
||||||
|
|
||||||
|
(when (string= system-type "darwin")
|
||||||
|
(setq dired-use-ls-dired nil))
|
||||||
|
|
||||||
|
|
||||||
|
;; ----------------------------------------------------------------------------
|
||||||
;; Diminish some built-in modes that we don't really care about.
|
;; Diminish some built-in modes that we don't really care about.
|
||||||
|
|
||||||
(add-hook 'eldoc-mode-hook (lambda () (diminish 'eldoc-mode)))
|
(add-hook 'eldoc-mode-hook (lambda () (diminish 'eldoc-mode)))
|
||||||
(add-hook 'hs-minor-mode-hook (lambda () (diminish 'hs-minor-mode)))
|
(add-hook 'hs-minor-mode-hook (lambda () (diminish 'hs-minor-mode)))
|
||||||
|
|
||||||
|
|
||||||
|
;; ----------------------------------------------------------------------------
|
||||||
|
;; Custom key-bindings.
|
||||||
|
|
||||||
|
;; Globally un-set "C-z", which suspends Emacs by default.
|
||||||
|
(global-unset-key (kbd "C-z"))
|
||||||
|
|
||||||
|
;; Enable code folding in programming modes, and set some more reasonable
|
||||||
|
;; shortcuts.
|
||||||
|
(add-hook 'prog-mode-hook #'hs-minor-mode)
|
||||||
|
(global-set-key (kbd "C-c C-h") (kbd "C-c @ C-h")) ; Hide a block
|
||||||
|
(global-set-key (kbd "C-c C-s") (kbd "C-c @ C-s")) ; Show a block
|
||||||
|
|
||||||
|
|
||||||
|
;; ----------------------------------------------------------------------------
|
||||||
;; WARNING: Don't touch anything after this comment!
|
;; WARNING: Don't touch anything after this comment!
|
||||||
|
|
||||||
(custom-set-variables
|
(custom-set-variables
|
||||||
@ -91,3 +189,6 @@
|
|||||||
;; Your init file should contain only one such instance.
|
;; Your init file should contain only one such instance.
|
||||||
;; If there is more than one, they won't work right.
|
;; If there is more than one, they won't work right.
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(provide 'init)
|
||||||
|
;;; init.el ends here
|
||||||
|
29
interface.el
29
interface.el
@ -1,29 +0,0 @@
|
|||||||
;; Hide the menu bar.
|
|
||||||
(menu-bar-mode -1)
|
|
||||||
|
|
||||||
;; Don't use double-spaces after periods.
|
|
||||||
(setq sentence-end-double-space nil)
|
|
||||||
|
|
||||||
;; Use unicode ellipses, because they're nicer.
|
|
||||||
(setq truncate-string-ellipsis "…")
|
|
||||||
|
|
||||||
;; Don't require full yes/no answers, allow y/n instead.
|
|
||||||
(fset 'yes-or-no-p 'y-or-n-p)
|
|
||||||
|
|
||||||
;; Open new windows to the right, not on the bottom.
|
|
||||||
(setq split-height-threshold nil
|
|
||||||
split-width-threshold 0)
|
|
||||||
|
|
||||||
;; Scroll line-by-line, rather than jumping around haphazardly.
|
|
||||||
(setq scroll-conservatively 10000
|
|
||||||
scroll-margin 0
|
|
||||||
scroll-preserve-screen-position 1)
|
|
||||||
|
|
||||||
;; Hide the frame identifier in the mode line.
|
|
||||||
(setq mode-line-frame-identification " ")
|
|
||||||
|
|
||||||
;; Display the column and line numbers of the cursor in the mode line.
|
|
||||||
(column-number-mode)
|
|
||||||
|
|
||||||
;; Display the file size in the mode line.
|
|
||||||
(size-indication-mode)
|
|
@ -1,14 +0,0 @@
|
|||||||
;; Globally un-set "C-z", which suspends Emacs by default (and is super
|
|
||||||
;; annoying!).
|
|
||||||
(global-unset-key (kbd "C-z"))
|
|
||||||
|
|
||||||
;; Make it easier to move between windows. Windows can be navigated using
|
|
||||||
;; <shift> in combination with the arrow keys.
|
|
||||||
(setq windmove-wrap-around t)
|
|
||||||
(windmove-default-keybindings)
|
|
||||||
|
|
||||||
;; Enable code folding in programming modes, and set some more reasonable
|
|
||||||
;; shortcuts.
|
|
||||||
(add-hook 'prog-mode-hook #'hs-minor-mode)
|
|
||||||
(global-set-key (kbd "C-c C-h") (kbd "C-c @ C-h")) ; Hide a block
|
|
||||||
(global-set-key (kbd "C-c C-s") (kbd "C-c @ C-s")) ; Show a block
|
|
@ -1,3 +1,4 @@
|
|||||||
|
;; Use the `doom-tokyo-night` theme.
|
||||||
;; https://github.com/doomemacs/themes
|
;; https://github.com/doomemacs/themes
|
||||||
(use-package doom-themes
|
(use-package doom-themes
|
||||||
:ensure t
|
:ensure t
|
Loading…
Reference in New Issue
Block a user