]> git.earman.xyz Git - emacsinit.git/commitdiff
More reorganizing, mode line changes
authorrearman <rearman@r717.net>
Wed, 17 Jun 2026 21:31:16 +0000 (17:31 -0400)
committerrearman <rearman@r717.net>
Wed, 17 Jun 2026 21:31:16 +0000 (17:31 -0400)
config.org

index 037313d49d89a99d5f5d883e1d64173c23ad1f5d..e80c143a7e241bbe4afe886b86706345ff8c0df2 100644 (file)
@@ -433,9 +433,9 @@ Libraries Not from the package manager
 (dolist (file '(eng-paper-theme sedit-mouse))
   (require file))
 #+END_SRC
-* Editing
-** UNIX/vi-like bindings
-=C-h=, =C-w=, =C-u=, et. al to work as I expect.  Some functions get re-bound when these take over a default.
+
+* UNIX/vi-like bindings
+=C-h=, =C-w=, =C-u=, et. al to work as I expect (like acme).  Some functions get re-bound when these take over a default.
 #+BEGIN_SRC emacs-lisp
 (defun re/open-line-below (n)
   "Creates a new empty line below the current line and moves to it."
@@ -468,8 +468,10 @@ Libraries Not from the package manager
 (keymap-global-set "C-S-U" #'universal-argument)
 (keymap-set key-translation-map "C-h" "<DEL>") ; Rather F1 for help, also C-S-H works
 (keymap-global-set "M-j" (lambda () (interactive) (join-line 0))) ; join-line other way
+(keymap-global-set "<home>" #'beginning-of-buffer)
+(keymap-global-set "<end>" #'end-of-buffer)
 #+END_SRC
-** Commenting and defun-level bindings
+* Commenting and defun-level bindings
 #+BEGIN_SRC emacs-lisp
 (defun re/comment-dwim (&optional arg)
   "Comment region if active, otherwise comment line.
@@ -499,8 +501,7 @@ Libraries Not from the package manager
 
 (keymap-global-set "C-M-S-K" #'re/kill-defun)
 #+END_SRC
-
-** Misc QOL bindings
+* Misc QOL bindings
 #+BEGIN_SRC emacs-lisp
 (keymap-global-set "<insert>" nil) ; I keep toggliĊ‹ overwrite-mode haply
 (keymap-global-set "C-\\" #'undo-redo) ; issues with C-? sometimes
@@ -591,9 +592,8 @@ Start a repl in a new frame, open dired in a new frame, etc. etc.
      (select-frame (make-frame '((name . ,(eval frname)))))
      (call-interactively ,function)))
 #+END_SRC
-* Motion
+* Scratch buffer easy access
 #+BEGIN_SRC emacs-lisp
-;; Motion
 (defun re/scratch-only ()
   "Bring up the scratch buffer as the only visible buffer."
   (interactive)
@@ -602,7 +602,10 @@ Start a repl in a new frame, open dired in a new frame, etc. etc.
 
 (keymap-global-set "<f5>" #'scratch-buffer)
 (keymap-global-set "S-<f5>" #'re/scratch-only)
-
+#+END_SRC
+* Switch or split window
+Game changer.  Auto choose how to split, or just switch to the next, all on the same binding.  Ripped from an early version of the lem editor.
+#+BEGIN_SRC emacs-lisp
 (defun re/other-window-or-split-window (&optional window)
   "Go to other window or split sensibly."
   (interactive)
@@ -611,7 +614,10 @@ Start a repl in a new frame, open dired in a new frame, etc. etc.
     (other-window 1)))
 
 (keymap-global-set "C-M-o" #'re/other-window-or-split-window)
-
+#+END_SRC
+* Smart End/Beginning of line
+Similar to what org does, and indeed calls the org function if in org-mode
+#+BEGIN_SRC emacs-lisp
 (defun re/smart-beginning-of-line ()
   "Move point to first non-whitespace character or `beginning-of-visual-line'.
 If point was already at that position, call `back-to-indentation'.
@@ -647,7 +653,10 @@ If in org-mode, call `org-end-of-line' first."
 
 (keymap-global-set "<remap> <move-end-of-line>" #'re/smart-end-of-line)
 (keymap-set visual-line-mode-map "C-e" #'re/smart-end-of-line)
-
+#+END_SRC
+* Goto line with numbers
+I only care about line numbers when I want to jump, so only show them then
+#+BEGIN_SRC emacs-lisp
 (defun re/goto-line ()
   "Show line numbers before going to line, then hide them again."
   (interactive)
@@ -656,14 +665,17 @@ If in org-mode, call `org-end-of-line' first."
   (display-line-numbers-mode -1))
 
 (keymap-global-set "<remap> <goto-line>" #'re/goto-line)
-(keymap-global-set "<home>" #'beginning-of-buffer)
-(keymap-global-set "<end>" #'end-of-buffer)
+#+END_SRC
+* Switching between buffers
+#+BEGIN_SRC emacs-lisp
 (keymap-global-set "C-." #'next-buffer)
 (keymap-global-set "C-," #'previous-buffer)
 (keymap-global-set "C-<tab>" (lambda () (interactive) (switch-to-buffer nil))) ; toggle last two buffers
 (keymap-global-set "<mouse-4>" #'previous-buffer) ; Back button
 (keymap-global-set "<mouse-5>" #'next-buffer) ; Forward button
-;; Disable M-mouse for window manager bindings
+#+END_SRC
+* Disable M-mouse for window manager bindings
+#+BEGIN_SRC emacs-lisp
 (keymap-global-unset "M-<down-mouse-1>")
 (keymap-global-unset "M-<drag-mouse-1>")
 (keymap-global-unset "M-<mouse-1>")
@@ -715,7 +727,6 @@ Stolen from https://www.masteringemacs.org/article/fixing-mark-commands-transien
 #+END_SRC
 * Recent Files/Buffers
 #+BEGIN_SRC emacs-lisp
-;; Recent Files/Buffers
 (midnight-mode t)
 (setq clean-buffer-list-delay-general 1)
 (dolist (never-re '("\\` \\*tramp/.*\\'"
@@ -726,7 +737,6 @@ Stolen from https://www.masteringemacs.org/article/fixing-mark-commands-transien
 #+END_SRC
 * File Handling
 #+BEGIN_SRC emacs-lisp
-;; File Handling
 (defun re/rename-current-buffer-file nil
   "Renames the current buffer and the file it is visiting."
   (interactive)
@@ -773,7 +783,6 @@ Stolen from https://www.masteringemacs.org/article/fixing-mark-commands-transien
 #+END_SRC
 * Dired
 #+BEGIN_SRC emacs-lisp
-;; Dired
 (defun re/dired-display-direction ()
   "In dired mode, visit the file at the cursor in the right/below/left/above window."
   (interactive)
@@ -897,20 +906,23 @@ Stolen from https://www.masteringemacs.org/article/fixing-mark-commands-transien
 
 (setq-default cursor-type 'hbar
               cursor-in-non-selected-windows nil
-              mode-line-format
-              '("%e"
-                (:eval (propertize "  "
-                                   'face
-                                   (when (buffer-modified-p)
-                                       'mode-line-highlight)))
-                " "
-                (:propertize (buffer-file-name "%f" "%b")
-                             face
-                             mode-line)
-                (vc-mode vc-mode)
-                mode-line-format-right-align
-                (:eval (number-to-string (line-number-at-pos (point-max))))
-                "L @ %I%n %l,%C "))
+              mode-line-format '("%e"
+                                 (:eval (propertize "  "
+                                                    'face
+                                                    (when (buffer-modified-p)
+                                                      'mode-line-highlight)))
+                                 " "
+                                 (:propertize (buffer-file-name "%f" "%b")
+                                              'face
+                                              mode-line)
+                                 " "
+                                 mode-line-modes
+                                 (vc-mode vc-mode)
+                                 mode-line-format-right-align
+                                 (:eval (propertize "%n " 'face (when (buffer-narrowed-p)
+                                                                    'mode-line-highlight)))
+                                 (:eval (number-to-string (line-number-at-pos (point-max))))
+                                 " Lines | %Ib | %l,%C "))
 
 (setq prettify-symbols-alist '(("lambda" . 955)
                                ("delta" . 120517)