From 634352cb6a3bbced02a6188f23b5b1da5e92b426 Mon Sep 17 00:00:00 2001 From: Mountain Man <43313373+MountainMan1312@users.noreply.github.com> Date: Thu, 20 Apr 2023 12:48:45 -0400 Subject: Improve whitespace functionality in text editor Show trailing whitespace. End sentences with one space. End files with one newline. Use spaces for indentation. Wrap words at buffer edge. --- init.el | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/init.el b/init.el index 79eb285..faf8233 100644 --- a/init.el +++ b/init.el @@ -58,6 +58,40 @@ +;; --------------------------------------------------------------------- +;;; Text Editor +;; ------------ +;; These tweaks are meant to make the text editor more convenient. +;; --------------------------------------------------------------------- + +;; --------------------------------- +;; Whitespace +;; ---------- +;; Spaces, tabs, indentation, +;; newlines, and text-wrapping. +;; --------------------------------- + +;; Show stray whitespace +(setq-default show-trailing-whitespace t + indicate-empty-lines t + indicate-buffer-boundaries 'left) + +;; Make files end with newline +(setq-default require-final-newline t) + +;; Sentences end with ONE space +(setq-default sentence-end-double-space nil) + +;; Use spaces for indentation +(setq-default indent-tabs-mode nil + tab-width 2) + +;; Wrap words at buffer edge +(global-visual-line-mode) + + + + ;; --------------------------------------------------------------------- ;;; File Management ;; ---------------- -- cgit v1.2.3 From 82c1d4b5ccc6e87c83ec31c88451026e6a04a7c2 Mon Sep 17 00:00:00 2001 From: Mountain Man <43313373+MountainMan1312@users.noreply.github.com> Date: Thu, 20 Apr 2023 13:52:44 -0400 Subject: Enhance scrolling behavior Make scrolling smooth and easy to follow, as opposed to the jumpy default behavior. Add a scroll margin and make point move to the top/bottom of the screen if attempting to scroll past the beginning/end of the buffer. --- init.el | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/init.el b/init.el index faf8233..a578665 100644 --- a/init.el +++ b/init.el @@ -90,6 +90,34 @@ (global-visual-line-mode) +;; --------------------------------- +;; Scrolling +;; --------- +;; This makes the scrolling behavior +;; smoother and easier to follow. +;; --------------------------------- + +;; Small scroll margin makes it +;; easier to see when to stop when +;; scrolling fast. +(setq scroll-margin 2) + +;; Make mouse scroll smoother +(setq mouse-wheel-scroll-amount '(2)) + mouse-wheel-progressive-speed nil + mouse-wheel-follow-mouse t) + +;; Prevent jumpy scrolling +(setq scroll-conservatively 10 + auto-window-vscroll nil + scroll-preserve-screen-position t) + +;; Move point to beginning/end of +;; buffer if attempting to scroll +;; when already at the beginning/end +;; of buffer +(setq scroll-error-top-bottom t) + ;; --------------------------------------------------------------------- -- cgit v1.2.3 From e032e9cca0fbf16d95fbdda9f5d2fabb7748b497 Mon Sep 17 00:00:00 2001 From: Mountain Man <43313373+MountainMan1312@users.noreply.github.com> Date: Thu, 20 Apr 2023 14:06:47 -0400 Subject: Fix mismatched parentheses --- init.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index a578665..b9b7c35 100644 --- a/init.el +++ b/init.el @@ -103,7 +103,7 @@ (setq scroll-margin 2) ;; Make mouse scroll smoother -(setq mouse-wheel-scroll-amount '(2)) +(setq mouse-wheel-scroll-amount '(2) mouse-wheel-progressive-speed nil mouse-wheel-follow-mouse t) @@ -120,6 +120,7 @@ + ;; --------------------------------------------------------------------- ;;; File Management ;; ---------------- -- cgit v1.2.3 From a0a18d5b15ffccbb174f3aad3190c15e373d367e Mon Sep 17 00:00:00 2001 From: Mountain Man <43313373+MountainMan1312@users.noreply.github.com> Date: Thu, 20 Apr 2023 14:08:28 -0400 Subject: refactor: Organize Text Editor subsections Reorder the subsections within the Text Editor section of `init.el`. For me, it makes more sense to have things related to the editor at the top, and things related more to the content within the editor second. --- init.el | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/init.el b/init.el index b9b7c35..efafdd5 100644 --- a/init.el +++ b/init.el @@ -64,32 +64,6 @@ ;; These tweaks are meant to make the text editor more convenient. ;; --------------------------------------------------------------------- -;; --------------------------------- -;; Whitespace -;; ---------- -;; Spaces, tabs, indentation, -;; newlines, and text-wrapping. -;; --------------------------------- - -;; Show stray whitespace -(setq-default show-trailing-whitespace t - indicate-empty-lines t - indicate-buffer-boundaries 'left) - -;; Make files end with newline -(setq-default require-final-newline t) - -;; Sentences end with ONE space -(setq-default sentence-end-double-space nil) - -;; Use spaces for indentation -(setq-default indent-tabs-mode nil - tab-width 2) - -;; Wrap words at buffer edge -(global-visual-line-mode) - - ;; --------------------------------- ;; Scrolling ;; --------- @@ -119,6 +93,32 @@ (setq scroll-error-top-bottom t) +;; --------------------------------- +;; Whitespace +;; ---------- +;; Spaces, tabs, indentation, +;; newlines, and text-wrapping. +;; --------------------------------- + +;; Show stray whitespace +(setq-default show-trailing-whitespace t + indicate-empty-lines t + indicate-buffer-boundaries 'left) + +;; Make files end with newline +(setq-default require-final-newline t) + +;; Sentences end with ONE space +(setq-default sentence-end-double-space nil) + +;; Use spaces for indentation +(setq-default indent-tabs-mode nil + tab-width 2) + +;; Wrap words at buffer edge +(global-visual-line-mode) + + ;; --------------------------------------------------------------------- -- cgit v1.2.3 From 0ccd32f388280cef07ea7962ac2a6151652d0da5 Mon Sep 17 00:00:00 2001 From: Mountain Man <43313373+MountainMan1312@users.noreply.github.com> Date: Thu, 20 Apr 2023 14:43:24 -0400 Subject: Display line & column numbers --- init.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/init.el b/init.el index efafdd5..460bd11 100644 --- a/init.el +++ b/init.el @@ -64,6 +64,16 @@ ;; These tweaks are meant to make the text editor more convenient. ;; --------------------------------------------------------------------- +;; --------------------------------- +;; Line and column numbers +;; ----------------------- +;; It helps to know where you are +;; --------------------------------- + +(column-number-mode) +(global-display-line-numbers-mode t) + + ;; --------------------------------- ;; Scrolling ;; --------- -- cgit v1.2.3 From 304279ebca695e7aab974e1bc2c175be7ba4e714 Mon Sep 17 00:00:00 2001 From: Mountain Man <43313373+MountainMan1312@users.noreply.github.com> Date: Thu, 20 Apr 2023 14:50:17 -0400 Subject: Delete selected text when typing over it --- init.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/init.el b/init.el index 460bd11..806c409 100644 --- a/init.el +++ b/init.el @@ -129,6 +129,16 @@ (global-visual-line-mode) +;; --------------------------------- +;; Type over selected text +;; ----------------------- +;; Typing over selected text should +;; delete the selected text +;; --------------------------------- + +(delete-selection-mode t) + + ;; --------------------------------------------------------------------- -- cgit v1.2.3 From ec35288c2d9572bc741836173b67a510e5731f6c Mon Sep 17 00:00:00 2001 From: Mountain Man <43313373+MountainMan1312@users.noreply.github.com> Date: Thu, 20 Apr 2023 14:53:27 -0400 Subject: Auto-close delimiters with `electric-pair-mode` --- init.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/init.el b/init.el index 806c409..ca189a8 100644 --- a/init.el +++ b/init.el @@ -129,6 +129,17 @@ (global-visual-line-mode) +;; --------------------------------- +;; Delimiters +;; ---------- +;; Parentheses, brackets, and other +;; open-close type things +;; --------------------------------- + +;; Auto-close delimiters +(electric-pair-mode) + + ;; --------------------------------- ;; Type over selected text ;; ----------------------- -- cgit v1.2.3 From 911a8cc587458a44da9856c8f7783caabf119e78 Mon Sep 17 00:00:00 2001 From: Mountain Man <43313373+MountainMan1312@users.noreply.github.com> Date: Thu, 20 Apr 2023 15:02:21 -0400 Subject: Highlight current line --- init.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/init.el b/init.el index ca189a8..6b6ae0b 100644 --- a/init.el +++ b/init.el @@ -74,6 +74,18 @@ (global-display-line-numbers-mode t) +;; --------------------------------- +;; Highlight stuff +;; --------------- +;; Sometimes it's hard to find +;; things. Highlighting makes it a +;; little easier. +;; --------------------------------- + +;; Highlight current line +(when window-system (add-hook 'prog-mode-hook 'hl-line-mode)) + + ;; --------------------------------- ;; Scrolling ;; --------- -- cgit v1.2.3