From 8a7ebce5c536141264511a6bcb4692383c18ab14 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sun, 1 Dec 2024 11:08:41 +0100 Subject: emacs: Add a windowing module --- .config/emacs/init.el | 30 ++-------------- .config/emacs/modules/mm-window.el | 72 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+), 28 deletions(-) create mode 100644 .config/emacs/modules/mm-window.el (limited to '.config/emacs') diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 8726462..d8997fe 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -177,7 +177,6 @@ buffer suppressed." (echo-keystrokes 0.01) ; 0 disables echoing (echo-keystrokes-help nil) (extended-command-suggest-shorter nil) - (help-window-select t) (initial-buffer-choice t) (initial-scratch-message mm-initial-scratch-message) (kill-do-not-save-duplicates t) @@ -190,18 +189,13 @@ buffer suppressed." (remote-file-name-inhibit-delete-by-moving-to-trash t) (require-final-newline nil) (save-interprogram-paste-before-kill t) - (scroll-conservatively 101) ; (info "(Emacs)Auto Scrolling") - (scroll-error-top-bottom t) - (scroll-margin 10) (user-full-name "Thomas Voss") (user-mail-address "mail@thomasvoss.com") (vc-follow-symlinks t) (vc-handled-backends '(Git)) :config (load custom-file :noerror) - (setq-default - fill-column 80 - truncate-partial-width-windows nil) + (setq-default fill-column 80) (dolist (mode '(text-mode emacs-lisp-mode lisp-mode)) (add-hook (mm-mode-to-hook mode) (defun mm-set-fill-column () @@ -229,16 +223,6 @@ buffer suppressed." :custom (show-paren-delay 0)) - -;;; Display Line Numbers - -(use-package display-line-numbers - :hook prog-mode - :custom - (display-line-numbers-type 'relative) - (display-line-numbers-width-start 99) - (display-line-numbers-grow-only t)) - ;;; Auto Revert Buffers @@ -259,17 +243,6 @@ buffer suppressed." :custom (bookmark-save-flag 1)) - -;;; Smoother Scrolling - -(use-package pixel-scroll - :init - (pixel-scroll-precision-mode) - :config - ;; Make it easier to use custom scroll functions - (dolist (binding '("" "")) - (keymap-unset pixel-scroll-precision-mode-map binding :remove))) - ;;; Automatically Create- and Delete Directories @@ -340,6 +313,7 @@ the buffer without saving it." (require 'mm-tetris) ; Emacs Tetris (require 'mm-theme) ; Themeing (require 'mm-treesit) ; Tree-Sitter +(require 'mm-window) ; Windowing (when mm-darwin-p (require 'mm-darwin)) ; MacOS (when mm-lsp-p diff --git a/.config/emacs/modules/mm-window.el b/.config/emacs/modules/mm-window.el new file mode 100644 index 0000000..0ce77c7 --- /dev/null +++ b/.config/emacs/modules/mm-window.el @@ -0,0 +1,72 @@ +;;; mm-window.el --- Window configurations -*- lexical-binding: t; -*- + + +;;; Unique Buffer Names + +(use-package uniquify + :custom + (uniquify-buffer-name-style 'forward)) + + +;;; Highlight Whitespace + +(use-package whitespace + :bind (("" . whitespace-mode) + ("C-c z" . delete-trailing-whitespace)) + :custom + (whitespace-style + '( face trailing spaces tabs space-mark tab-mark empty indentation + space-after-tab space-before-tab)) + (whitespace-display-mappings + '((space-mark 32 [?·] [?.]) ; Space + (space-mark 160 [?␣] [?_]) ; Non-Breaking Space + (tab-mark 9 [?» ?\t] [?> ?\t])))) + + +;;; Line Numbers + +(use-package display-line-numbers + :bind ("" . display-line-numbers-mode) + :custom + (display-line-numbers-grow-only t) + (display-line-numbers-type 'relative) + (display-line-numbers-width-start 99)) + + +;;; Select Help Windows + +(use-package help + :custom + (help-window-select t)) + + +;;; Window Scrolling + +(use-package window + :custom + (scroll-conservatively 101) ; (info "(Emacs)Auto Scrolling") + (scroll-error-top-bottom t) + (scroll-margin 10) + :config + (setq-default truncate-partial-width-windows nil)) + + +;;; Smoother Scrolling + +(mm-comment + (use-package pixel-scroll + :init + (pixel-scroll-precision-mode) + :config + ;; Make it easier to use custom scroll functions + (dolist (binding '("" "")) + (keymap-unset pixel-scroll-precision-mode-map binding :remove)))) + + +;;; Ace Window + +(use-package ace-window + :ensure t + :bind ("M-o" . ace-window)) + +(provide 'mm-window) \ No newline at end of file -- cgit v1.2.3