Updates to thoom-emacs

This commit is contained in:
2022-10-04 22:44:24 -07:00
parent c53cc43c23
commit 0c45659f22

View File

@@ -1,3 +1,9 @@
;;; init.el --- Support for the Foo programming language -*- lexical-binding: t; -*-
;;; Commentary:
;;; This is here to shut up the elisp linter.
;;; Code:
;; Install straight.el ;; Install straight.el
(defvar bootstrap-version) (defvar bootstrap-version)
(let ((bootstrap-file (let ((bootstrap-file
@@ -12,133 +18,339 @@
(eval-print-last-sexp))) (eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage)) (load bootstrap-file nil 'nomessage))
(straight-use-package 'use-package)
(setq inhibit-startup-message t (setq inhibit-startup-message t
use-dialog-box nil) use-dialog-box nil)
(tool-bar-mode -1)
(scroll-bar-mode -1)
;; TODO - only on non-Darwin
(menu-bar-mode -1)
(setq custom-file (locate-user-emacs-file "custom-vars.el")) (setq custom-file (locate-user-emacs-file "custom-vars.el"))
(load custom-file 'noerror 'nomessage)
;; Revert buffers when the underlying file has changed ;; Revert buffers when the underlying file has changed
(global-auto-revert-mode 1) (global-auto-revert-mode 1)
(setq global-auto-revert-non-file-buffers t)
;; Remember recent files ;; Remember recent files
(recentf-mode 1) (recentf-mode 1)
;; TODO - bind recentf-open-files
;; Save what you enter into minibuffer prompts ;; Save what you enter into minibuffer prompts
(setq history-length 25) (setq history-length 25)
(savehist-mode 1) (savehist-mode 1)
(straight-use-package
'(nano-emacs :type git :host github :repo "rougier/nano-emacs"))
(require 'nano-layout)
(require 'nano-theme-dark)
(require 'nano-faces)
(require 'nano-theme)
(require 'nano-modeline)
(require 'nano-defaults)
(nano-faces)
(nano-theme)
(hl-line-mode 1) (hl-line-mode 1)
(use-package doom-themes
:straight t
:config
;; Global settings (defaults)
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled
doom-themes-enable-italic t) ; if nil, italics is universally disabled
(load-theme 'doom-one t)
(straight-use-package 'meow) ;; Enable flashing mode-line on errors
(defun meow-setup () (doom-themes-visual-bell-config)
(setq meow-cheatsheet-layout meow-cheatsheet-layout-qwerty) ;; Corrects (and improves) org-mode's native fontification.
(meow-motion-overwrite-define-key (doom-themes-org-config))
'("j" . meow-next)
'("k" . meow-prev) (use-package vertico
'("<escape>" . ignore)) :straight t
(meow-leader-define-key :init
;; SPC j/k will run the original command in MOTION state. (vertico-mode))
'("j" . "H-j")
'("k" . "H-k") (use-package marginalia
;; Use SPC (0-9) for digit arguments. :straight t
'("1" . meow-digit-argument) ;; Either bind `marginalia-cycle' globally or only in the minibuffer
'("2" . meow-digit-argument) :bind (:map minibuffer-local-map
'("3" . meow-digit-argument) ("M-A" . marginalia-cycle))
'("4" . meow-digit-argument)
'("5" . meow-digit-argument) :init
'("6" . meow-digit-argument) (marginalia-mode))
'("7" . meow-digit-argument)
'("8" . meow-digit-argument) (use-package orderless
'("9" . meow-digit-argument) :straight t
'("0" . meow-digit-argument) :init
'("/" . meow-keypad-describe-key) ;; Configure a custom style dispatcher (see the Consult wiki)
'("?" . meow-cheatsheet)) ;; (setq orderless-style-dispatchers '(+orderless-dispatch)
(meow-define-keys 'insert ;; orderless-component-separator #'orderless-escapable-split-on-space)
'("ESC" . meow-insert-exit)) (setq completion-styles '(orderless basic)
(meow-normal-define-key completion-category-defaults nil
'("0" . meow-expand-0) completion-category-overrides '((file (styles partial-completion)))))
'("9" . meow-expand-9)
'("8" . meow-expand-8) (use-package consult
'("7" . meow-expand-7) :straight t
'("6" . meow-expand-6) ;; Replace bindings. Lazily loaded due by `use-package'.
'("5" . meow-expand-5) :bind (;; C-c bindings (mode-specific-map)
'("4" . meow-expand-4) ("C-c h" . consult-history)
'("3" . meow-expand-3) ("C-c m" . consult-mode-command)
'("2" . meow-expand-2) ("C-c k" . consult-kmacro)
'("1" . meow-expand-1) ;; C-x bindings (ctl-x-map)
'("-" . negative-argument) ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
'(";" . meow-reverse) ("C-x b" . consult-buffer) ;; orig. switch-to-buffer
'("," . meow-inner-of-thing) ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
'("." . meow-bounds-of-thing) ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
'("[" . meow-beginning-of-thing) ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
'("]" . meow-end-of-thing) ("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
'("a" . meow-append) ;; Custom M-# bindings for fast register access
'("A" . meow-open-below) ("M-#" . consult-register-load)
'("b" . meow-back-word) ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
'("B" . meow-back-symbol) ("C-M-#" . consult-register)
'("c" . meow-change) ;; Other custom bindings
'("d" . meow-delete) ("M-y" . consult-yank-pop) ;; orig. yank-pop
'("D" . meow-backward-delete) ("<help> a" . consult-apropos) ;; orig. apropos-command
'("e" . meow-next-word) ;; M-g bindings (goto-map)
'("E" . meow-next-symbol) ("M-g e" . consult-compile-error)
'("f" . meow-find) ("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
'("g" . meow-cancel-selection) ("M-g g" . consult-goto-line) ;; orig. goto-line
'("G" . meow-grab) ("M-g M-g" . consult-goto-line) ;; orig. goto-line
'("h" . meow-left) ("M-g o" . consult-outline) ;; Alternative: consult-org-heading
'("H" . meow-left-expand) ("M-g m" . consult-mark)
'("i" . meow-insert) ("M-g k" . consult-global-mark)
'("I" . meow-open-above) ("M-g i" . consult-imenu)
'("j" . meow-next) ("M-g I" . consult-imenu-multi)
'("J" . meow-next-expand) ;; M-s bindings (search-map)
'("k" . meow-prev) ("M-s d" . consult-find)
'("K" . meow-prev-expand) ("M-s D" . consult-locate)
'("l" . meow-right) ("M-s g" . consult-grep)
'("L" . meow-right-expand) ("M-s G" . consult-git-grep)
'("m" . meow-join) ("M-s r" . consult-ripgrep)
'("n" . meow-search) ("M-s l" . consult-line)
'("o" . meow-block) ("M-s L" . consult-line-multi)
'("O" . meow-to-block) ("M-s m" . consult-multi-occur)
'("p" . meow-yank) ("M-s k" . consult-keep-lines)
'("q" . meow-quit) ("M-s u" . consult-focus-lines)
'("r" . meow-replace) ;; Isearch integration
'("R" . meow-swap-grab) ("M-s e" . consult-isearch-history)
'("s" . meow-kill) :map isearch-mode-map
'("t" . meow-till) ("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
'("u" . meow-undo) ("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
'("U" . meow-undo-in-selection) ("M-s l" . consult-line) ;; needed by consult-line to detect isearch
'("v" . meow-visit) ("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
'("w" . meow-mark-word) ;; Minibuffer history
'("W" . meow-mark-symbol) :map minibuffer-local-map
'("x" . meow-line) ("M-s" . consult-history) ;; orig. next-matching-history-element
'("X" . meow-goto-line) ("M-r" . consult-history)) ;; orig. previous-matching-history-element
'("y" . meow-save)
'("Y" . meow-sync-grab) ;; Enable automatic preview at point in the *Completions* buffer. This is
'("z" . meow-pop-selection) ;; relevant when you use the default completion UI.
'("'" . repeat) :hook (completion-list-mode . consult-preview-at-point-mode)
'("/" . meow-comment)
'("ESC" . ignore))) ;; The :init configuration is always executed (Not lazy)
(require 'meow) :init
(meow-setup)
(meow-global-mode 1) ;; Optionally configure the register formatting. This improves the register
;; preview for `consult-register', `consult-register-load',
;; `consult-register-store' and the Emacs built-ins.
(setq register-preview-delay 0.5
register-preview-function #'consult-register-format)
;; Optionally tweak the register preview window.
;; This adds thin lines, sorting and hides the mode line of the window.
(advice-add #'register-preview :override #'consult-register-window)
;; Use Consult to select xref locations with preview
(setq xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref)
;; Configure other variables and modes in the :config section,
;; after lazily loading the package.
:config
;; Optionally configure preview. The default value
;; is 'any, such that any key triggers the preview.
;; (setq consult-preview-key 'any)
;; (setq consult-preview-key (kbd "M-."))
;; (setq consult-preview-key (list (kbd "<S-down>") (kbd "<S-up>")))
;; For some commands and buffer sources it is useful to configure the
;; :preview-key on a per-command basis using the `consult-customize' macro.
(consult-customize
consult-theme
:preview-key '(:debounce 0.2 any)
consult-ripgrep consult-git-grep consult-grep
consult-bookmark consult-recent-file consult-xref
consult--source-bookmark consult--source-recent-file
consult--source-project-recent-file
:preview-key (kbd "M-."))
;; Optionally configure the narrowing key.
;; Both < and C-+ work reasonably well.
(setq consult-narrow-key "<") ;; (kbd "C-+")
;; Optionally make narrowing help available in the minibuffer.
;; You may want to use `embark-prefix-help-command' or which-key instead.
;; (define-key consult-narrow-map (vconcat consult-narrow-key "?") #'consult-narrow-help)
;; By default `consult-project-function' uses `project-root' from project.el.
;; Optionally configure a different project root function.
;; There are multiple reasonable alternatives to chose from.
;;;; 1. project.el (the default)
;; (setq consult-project-function #'consult--default-project--function)
;;;; 2. projectile.el (projectile-project-root)
;; (autoload 'projectile-project-root "projectile")
;; (setq consult-project-function (lambda (_) (projectile-project-root)))
;;;; 3. vc.el (vc-root-dir)
;; (setq consult-project-function (lambda (_) (vc-root-dir)))
;;;; 4. locate-dominating-file
;; (setq consult-project-function (lambda (_) (locate-dominating-file "." ".git")))
)
(use-package embark
:straight t
:bind
(("C-." . embark-act) ;; pick some comfortable binding
("C-;" . embark-dwim) ;; good alternative: M-.
("C-h B" . embark-bindings)) ;; alternative for `describe-bindings'
:init
;; Optionally replace the key help with a completing-read interface
(setq prefix-help-command #'embark-prefix-help-command)
:config
;; Hide the mode line of the Embark live/completions buffers
(add-to-list 'display-buffer-alist
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
nil
(window-parameters (mode-line-format . none)))))
;; Consult users will also want the embark-consult package.
(use-package embark-consult
:straight t
:after (embark consult)
:demand t ; only necessary if you have the hook below
;; if you want to have consult previews as you move around an
;; auto-updating embark collect buffer
:hook
(embark-collect-mode . consult-preview-at-point-mode))
(use-package which-key
:straight t
:init
(which-key-mode)
(which-key-setup-side-window-bottom))
(use-package meow
:straight t
:init
(defun meow-setup ()
"Wow, the elisp linter is pedantic."
(setq meow-use-clipboard t
meow-char-thing-table '((?\( . round)
(?\) . round)
(?\[ . square)
(?\] . square)
(?\{ . curly)
(?\} . curly)
(?\" . string)
(?\' . string)
(?e . symbol)
(?w . window)
(?b . buffer)
(?p . paragraph)
(?l . line)
(?d . defun)
(?. . sentence))
meow-cheatsheet-layout meow-cheatsheet-layout-qwerty
meow-keypad-self-insert-undefined nil)
(add-to-list 'meow-mode-state-list
'(eshell-mode . insert) t)
(meow-motion-overwrite-define-key
'("j" . meow-next)
'("k" . meow-prev)
'("<escape>" . ignore))
(meow-leader-define-key
;; SPC j/k will run the original command in MOTION state.
'("j" . "H-j")
'("k" . "H-k")
;; Use SPC (0-9) for digit arguments.
'("1" . meow-digit-argument)
'("2" . meow-digit-argument)
'("3" . meow-digit-argument)
'("4" . meow-digit-argument)
'("5" . meow-digit-argument)
'("6" . meow-digit-argument)
'("7" . meow-digit-argument)
'("8" . meow-digit-argument)
'("9" . meow-digit-argument)
'("0" . meow-digit-argument)
'("/" . meow-keypad-describe-key)
'("?" . meow-cheatsheet))
(meow-define-keys 'insert
'("ESC" . meow-insert-exit))
(meow-normal-define-key
'("0" . meow-expand-0)
'("9" . meow-expand-9)
'("8" . meow-expand-8)
'("7" . meow-expand-7)
'("6" . meow-expand-6)
'("5" . meow-expand-5)
'("4" . meow-expand-4)
'("3" . meow-expand-3)
'("2" . meow-expand-2)
'("1" . meow-expand-1)
'("-" . negative-argument)
'(";" . meow-reverse)
'("," . meow-inner-of-thing)
'("." . meow-bounds-of-thing)
'("[" . meow-beginning-of-thing)
'("]" . meow-end-of-thing)
'("a" . meow-append)
'("A" . meow-open-below)
'("b" . meow-back-word)
'("B" . meow-back-symbol)
'("c" . meow-change)
'("d" . meow-delete)
'("D" . meow-backward-delete)
'("e" . meow-next-word)
'("E" . meow-next-symbol)
'("f" . meow-find)
'("g" . meow-cancel-selection)
'("G" . meow-grab)
'("h" . meow-left)
'("H" . meow-left-expand)
'("i" . meow-insert)
'("I" . meow-open-above)
'("j" . meow-next)
'("J" . meow-next-expand)
'("k" . meow-prev)
'("K" . meow-prev-expand)
'("l" . meow-right)
'("L" . meow-right-expand)
'("m" . meow-join)
'("n" . meow-search)
'("o" . meow-block)
'("O" . meow-to-block)
'("p" . meow-yank)
'("q" . meow-quit)
'("r" . meow-replace)
'("R" . meow-swap-grab)
'("s" . meow-kill)
'("t" . meow-till)
'("u" . meow-undo)
'("U" . meow-undo-in-selection)
'("v" . meow-visit)
'("w" . meow-mark-word)
'("W" . meow-mark-symbol)
'("x" . meow-line)
'("X" . meow-goto-line)
'("y" . meow-save)
'("Y" . meow-sync-grab)
'("z" . meow-pop-selection)
'("'" . repeat)
'("/" . meow-comment)
'("=" . indent-region)))
(require 'meow)
(meow-setup)
(meow-global-mode 1))
;; Meow-tutor notes: ;; Meow-tutor notes:
;; r replaces selection with yank buffer ;; r replaces selection with yank buffer
@@ -154,17 +366,28 @@
;; Why doesn't visit work consistently in beacon mode? ;; Why doesn't visit work consistently in beacon mode?
;; TODO ;; TODO
;; make C-[ work as ESC for exiting insert mode ;; equivalents of evil <, > for indentation
;; use ([{ instead of rsc for brackets and " instead of g for string?
;; equivalents of evil <, >, = for indentation
;; interactive/case insensitive visit? ;; interactive/case insensitive visit?
;; equivalents of evil C-o, C-i ;; equivalents of evil C-o, C-i
;; equivalent of gd/gu ;; equivalent of gd/gu (use embark?)
;; gd = (+lookup/definition)
;; gu = (+lookup/references)
;;
;; equivalent of r ;; equivalent of r
;; equivalent of . for repeating edits
;;
;; learn kmacros ;; learn kmacros
;; learn emacs undo / undo tree
;; bind page up/down, make them act more like vim: center new cursor position, go all the way to the end of file if possible ;; bind page up/down, make them act more like vim: center new cursor position, go all the way to the end of file if possible
;; vim surround ;; vim surround
;; system clipboard integration ;; system clipboard integration
;; cmd-z undo on mac ;; cmd-z undo on mac
;; How the fuck does Emacs' default undo/redo work?
(use-package hl-todo
:straight t
:init
(global-hl-todo-mode))
(provide 'init)
;;; init.el ends here