(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."
(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.
(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
(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)
(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)
(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'.
(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)
(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>")
#+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/.*\\'"
#+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)
#+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)
(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)