#+END_SRC
** Basic UI preferences
-I want no menus, no tool-bars, left-side scroll-bars, no blinking cursor, no messages when starting up, make resizing work properly, and start up maximized. I just want the scratch buffer with a report on =emacs-init-time=.
+I want no menus, no tool-bars, left-side scroll-bars, no blinking cursor, no messages when starting up, and to make resizing work properly. I just want the scratch buffer with a report on =emacs-init-time=.
#+BEGIN_SRC emacs-lisp :tangle ./early-init.el
(menu-bar-mode -1)
(tool-bar-mode -1)
inhibit-startup-buffer-menu t
server-client-instructions nil
frame-resize-pixelwise t
- default-frame-alist '((fullscreen . maximized))
initial-scratch-message (message ";;; Emacs loaded in %s.\n\n" (emacs-init-time)))
#+END_SRC
Load packages first, so there is no question about dependencies later in the file.
*** Package Repositories
Non-gnu is in the defaults now, so I only need to add melpa.
-
#+BEGIN_SRC emacs-lisp
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
#+END_SRC
+
*** almost-mono-themes
-Exactly what they say they are
+Exactly what they say they are!
#+BEGIN_SRC emacs-lisp
(use-package almost-mono-themes
:ensure t
**** Main Corfu
The basics for corfu. Auto popup after one letter, enable globally.
-
#+BEGIN_SRC emacs-lisp
(use-package corfu
:ensure t
**** corfu-popupinfo
This comes with base corfu, but is configured separately.
-
#+BEGIN_SRC emacs-lisp
(use-package corfu-popupinfo
:ensure nil ; Part of corfu
*** expand-region
Seldom used, but nothing else does it.
-
#+BEGIN_SRC emacs-lisp
(use-package expand-region :ensure t)
(keymap-global-set "C-=" 'er/expand-region)
((:map ctl-x-map ("g" . magit-status))))
#+END_SRC
+*** Recentf
+#+BEGIN_SRC emacs-lisp
+(use-package recentf
+ :ensure t
+ :config
+ (recentf-mode 1))
+
+(keymap-global-set "C-c r" 'recentf-open)
+#+END_SRC
+
*** openwith
I need to open binary files with their own editor. Disgusting.
#+END_SRC
**** Auto Revert
-When files change on disk, and there are no changes in the open buffer, revert to the on-disk version.
+When files (or folders in dired) change on disk, and there are no changes in the open buffer, revert to the on-disk version.
#+BEGIN_SRC emacs-lisp
(global-auto-revert-mode t)
+(setq global-auto-revert-non-file-buffers t)
#+END_SRC
**** Segfault recovery
(keymap-global-set "M-o" 're/open-line-above)
#+END_SRC
+**** Line sorting
+Stolen from [[https:github.com/magnars/emacsd-reboot/blob/main/settings/editing.el]]
+#+BEGIN_SRC emacs-lisp
+(keymap-global-set "C-c s" 'sort-lines)
+#+END_SRC
+
**** Commenting
I stole this directly from [[https://depp.brause.cc/dotemacs][depp.brause.cc/dotemacs]]. Very good, simple solution.
#+BEGIN_SRC emacs-lisp
(keymap-global-set "C-M-o" 're/other-window-or-split-window)
#+END_SRC
**** Search and Replace
+***** Search with region
+#+BEGIN_SRC emacs-lisp
+(defun re/isearch-forward-use-region ()
+ (interactive)
+ (when (use-region-p)
+ (add-to-history 'search-ring (buffer-substring (region-beginning)
+ (region-end)))
+ (deactivate-mark))
+ (call-interactively 'isearch-forward))
+
+(defun re/isearch-backward-use-region ()
+ (interactive)
+ (when (use-region-p)
+ (add-to-history 'search-ring (buffer-substring (region-beginning)
+ (region-end)))
+ (deactivate-mark))
+ (call-interactively 'isearch-backward))
+
+
+#+END_SRC
+
+***** Bindings
I made these bindings to put my more-used commands on better keys, and swap them with the less-used ones. Also add bindings for ~isearch-*-regexp~.
#+BEGIN_SRC emacs-lisp
(keymap-global-set "M-s ." 'isearch-forward-thing-at-point)
(keymap-global-set "M-s M-." 'isearch-forward-symbol-at-point)
(keymap-global-set "M-%" 'replace-regexp)
(keymap-global-set "C-%" 'replace-string)
+(keymap-global-set "C-s" 're/isearch-forward-use-region)
+(keymap-global-set "C-r" 're/isearch-backward-use-region)
(keymap-global-set "C-S-S" 'isearch-forward-regexp)
(keymap-global-set "C-S-R" 'isearch-backward-regexp)
#+END_SRC
-
**** Insert Key
I keep accidentally enabling ~overwrite-mode~, so disable the ~insert~ key
#+BEGIN_SRC emacs-lisp
Capture Templates per my proclivities.
#+BEGIN_SRC emacs-lisp
(setq org-capture-templates '(("n" "Note" entry (file org-default-notes-file)
- "* %? %u"
+ "* %?"
:clock-in t
:clock-resume t)
("t" "TODO" entry (file org-default-notes-file)
Here are the various customizations I have for eshell.
*** Binding to start eshell
#+BEGIN_SRC emacs-lisp
-(keymap-global-set "C-c s" 'eshell)
+(keymap-global-set "C-c e" 'eshell)
#+END_SRC
*** Make it play nice with corfu