From 6727eafc99788c6dffdc61f5669655fd15798869 Mon Sep 17 00:00:00 2001 From: Jesse Braham Date: Sun, 9 Feb 2025 13:55:16 +0100 Subject: [PATCH] Configure the interface and editing behaviour a bit --- editor.el | 22 ++++++++++++++++++++++ init.el | 2 ++ interface.el | 26 ++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 editor.el create mode 100644 interface.el diff --git a/editor.el b/editor.el new file mode 100644 index 0000000..4d4a330 --- /dev/null +++ b/editor.el @@ -0,0 +1,22 @@ +;; 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) diff --git a/init.el b/init.el index 318a987..9b54be0 100644 --- a/init.el +++ b/init.el @@ -38,5 +38,7 @@ ;; 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 "typography.el") diff --git a/interface.el b/interface.el new file mode 100644 index 0000000..6118b8d --- /dev/null +++ b/interface.el @@ -0,0 +1,26 @@ +;; 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) + +;; 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)