mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-23 19:40:24 +10:00
Minor updates.
This commit is contained in:
@@ -4,7 +4,9 @@
|
||||
"The keys to use for universal repeating motions.
|
||||
|
||||
This is a cons cell whose CAR is the key for repeating a motion forward, and
|
||||
whose CDR is for repeating backward. They should both be `kbd'-able strings.")
|
||||
whose CDR is for repeating backward. They should both be `kbd'-able strings.
|
||||
|
||||
Set this to `nil' to disable universal-repeating on these keys.")
|
||||
|
||||
(defvar +evil-want-o/O-to-continue-comments t
|
||||
"If non-nil, the o/O keys will continue comment lines if the point is on a
|
||||
@@ -32,7 +34,6 @@ directives. By default, this only recognizes C directives.")
|
||||
:preface
|
||||
(setq evil-want-visual-char-semi-exclusive t
|
||||
evil-ex-search-vim-style-regexp t
|
||||
evil-ex-substitute-global t
|
||||
evil-ex-visual-char-range t ; column range for ex commands
|
||||
evil-mode-line-format 'nil
|
||||
;; more vim-like behavior
|
||||
@@ -45,12 +46,15 @@ directives. By default, this only recognizes C directives.")
|
||||
evil-visual-state-cursor 'hollow
|
||||
;; Only do highlighting in selected window so that Emacs has less work
|
||||
;; to do highlighting them all.
|
||||
evil-ex-interactive-search-highlight 'selected-window)
|
||||
evil-ex-interactive-search-highlight 'selected-window
|
||||
;; It's infuriating that innocuous "beginning of line" or "end of line"
|
||||
;; errors will abort macros, so suppress them:
|
||||
evil-kbd-macro-suppress-motion-error t)
|
||||
|
||||
;; Slow this down from 0.02 to prevent blocking in large or folded buffers
|
||||
;; like magit while incrementally highlighting matches.
|
||||
(setq-hook! 'magit-mode-hook evil-ex-hl-update-delay 0.2)
|
||||
(setq-hook! 'so-long-minor-mode-hook evil-ex-hl-update-delay 0.25)
|
||||
(setq-hook! '(magit-mode-hook so-long-minor-mode-hook)
|
||||
evil-ex-hl-update-delay 0.25)
|
||||
|
||||
:config
|
||||
(evil-select-search-module 'evil-search-module 'evil-search)
|
||||
@@ -325,7 +329,7 @@ directives. By default, this only recognizes C directives.")
|
||||
evil-snipe-repeat-scope 'visible
|
||||
evil-snipe-char-fold t)
|
||||
:config
|
||||
(pushnew! evil-snipe-disabled-modes 'Info-mode 'calc-mode)
|
||||
(pushnew! evil-snipe-disabled-modes 'Info-mode 'calc-mode 'treemacs-mode)
|
||||
(evil-snipe-mode +1)
|
||||
(evil-snipe-override-mode +1))
|
||||
|
||||
@@ -368,42 +372,6 @@ directives. By default, this only recognizes C directives.")
|
||||
;;
|
||||
;;; Keybinds
|
||||
|
||||
(defmacro set-repeater! (command next-func prev-func)
|
||||
"Makes ; and , the universal repeat-keys in evil-mode.
|
||||
To change these keys see `+evil-repeat-keys'."
|
||||
`(defadvice! ,(intern (format "+evil--repeat-%s-a" (doom-unquote command))) (&rest _)
|
||||
:after-while #',command
|
||||
(when +evil-repeat-keys
|
||||
(evil-define-key* 'motion 'local
|
||||
(kbd (car +evil-repeat-keys)) #',next-func
|
||||
(kbd (cdr +evil-repeat-keys)) #',prev-func))))
|
||||
|
||||
;; n/N
|
||||
(set-repeater! evil-ex-search-next evil-ex-search-next evil-ex-search-previous)
|
||||
(set-repeater! evil-ex-search-previous evil-ex-search-next evil-ex-search-previous)
|
||||
(set-repeater! evil-ex-search-forward evil-ex-search-next evil-ex-search-previous)
|
||||
(set-repeater! evil-ex-search-backward evil-ex-search-next evil-ex-search-previous)
|
||||
|
||||
;; f/F/t/T/s/S
|
||||
(after! evil-snipe
|
||||
(setq evil-snipe-repeat-keys nil
|
||||
evil-snipe-override-evil-repeat-keys nil) ; causes problems with remapped ;
|
||||
(set-repeater! evil-snipe-f evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(set-repeater! evil-snipe-F evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(set-repeater! evil-snipe-t evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(set-repeater! evil-snipe-T evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(set-repeater! evil-snipe-s evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(set-repeater! evil-snipe-S evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(set-repeater! evil-snipe-x evil-snipe-repeat evil-snipe-repeat-reverse)
|
||||
(set-repeater! evil-snipe-X evil-snipe-repeat evil-snipe-repeat-reverse))
|
||||
|
||||
;; */#
|
||||
(set-repeater! evil-visualstar/begin-search-forward
|
||||
evil-ex-search-next evil-ex-search-previous)
|
||||
(set-repeater! evil-visualstar/begin-search-backward
|
||||
evil-ex-search-previous evil-ex-search-next)
|
||||
|
||||
|
||||
;; Keybinds that have no Emacs+evil analogues (i.e. don't exist):
|
||||
;; zq - mark word at point as good word
|
||||
;; zw - mark word at point as bad
|
||||
@@ -501,7 +469,7 @@ To change these keys see `+evil-repeat-keys'."
|
||||
:nv "zn" #'+evil:narrow-buffer
|
||||
:n "zN" #'doom/widen-indirectly-narrowed-buffer
|
||||
:n "zx" #'kill-current-buffer
|
||||
:n "ZX" #'bury-buffer
|
||||
:n "ZX" #'doom/save-and-kill-buffer
|
||||
;; don't leave visual mode after shifting
|
||||
:v "<" #'+evil/visual-dedent ; vnoremap < <gv
|
||||
:v ">" #'+evil/visual-indent ; vnoremap > >gv
|
||||
@@ -552,7 +520,7 @@ To change these keys see `+evil-repeat-keys'."
|
||||
"a" (evilem-create #'evil-forward-arg)
|
||||
"A" (evilem-create #'evil-backward-arg)
|
||||
"s" #'evil-avy-goto-char-2
|
||||
"SPC" (cmd!! #'evil-avy-goto-char-timer t)
|
||||
"SPC" (cmd! (let ((current-prefix-arg t)) (evil-avy-goto-char-timer)))
|
||||
"/" #'evil-avy-goto-char-timer))
|
||||
|
||||
;; evil-snipe
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; editor/evil/packages.el
|
||||
|
||||
(package! evil :pin "25fc5c6647979357cf3e39f0667a9b7ae5266af9")
|
||||
(package! evil :pin "2bc6ca3587502fde67b93e411e329fc8224c916a")
|
||||
(package! evil-args :pin "758ad5ae54ad34202064fec192c88151c08cb387")
|
||||
(package! evil-easymotion :pin "f96c2ed38ddc07908db7c3c11bcd6285a3e8c2e9")
|
||||
(package! evil-embrace :pin "4379adea032b25e359d01a36301b4a5afdd0d1b7")
|
||||
@@ -11,12 +11,12 @@
|
||||
(package! evil-exchange :pin "3030e21ee16a42dfce7f7cf86147b778b3f5d8c1")
|
||||
(package! evil-indent-plus :pin "0c7501e6efed661242c3a20e0a6c79a6455c2c40")
|
||||
(package! evil-lion :pin "6b03593f5dd6e7c9ca02207f9a73615cf94c93ab")
|
||||
(package! evil-nerd-commenter :pin "1bd2de52011c39777a3e8779b14cee2790dc873b")
|
||||
(package! evil-nerd-commenter :pin "87734b9c7fcd047f73a072b9d03ec05f786eeb03")
|
||||
(package! evil-numbers
|
||||
:recipe (:host github :repo "janpath/evil-numbers")
|
||||
:pin "c2cfdd1eb1f193bea28ee79b191b78309677058a")
|
||||
:pin "006da406d175c05fedca4431cccd569e20bef92c")
|
||||
(package! evil-snipe :pin "6dcac7f2516c6137a2de532fc2c052f242559ee3")
|
||||
(package! evil-surround :pin "1c34944d8c98da4a2385d24ee89eef9cdf569a12")
|
||||
(package! evil-surround :pin "346d4d85fcf1f9517e9c4991c1efe68b4130f93a")
|
||||
(package! evil-textobj-anyblock :pin "ff00980f0634f95bf2ad9956b615a155ea8743be")
|
||||
(package! evil-traces :pin "bc25cae9fa5ab0ba1507827f0944f52ce0ca7462")
|
||||
(package! evil-visualstar :pin "06c053d8f7381f91c53311b1234872ca96ced752")
|
||||
@@ -33,4 +33,4 @@
|
||||
(package! neotree)
|
||||
(autoload 'neotree-make-executor "neotree" nil nil 'macro))
|
||||
|
||||
(package! evil-collection :pin "e065da3732f015428bd0068481dadad9e0e6d09c"))
|
||||
(package! evil-collection :pin "3e62b6b1312f7907081be41a032aaacffa732fef"))
|
||||
|
||||
@@ -89,6 +89,8 @@ evil is loaded and enabled)."
|
||||
(match-string 1 path))
|
||||
((file-in-directory-p path doom-emacs-dir)
|
||||
(file-relative-name path doom-emacs-dir))
|
||||
((file-in-directory-p path doom-private-dir)
|
||||
(file-relative-name path doom-private-dir))
|
||||
((abbreviate-file-name path))))))
|
||||
|
||||
|
||||
|
||||
@@ -201,16 +201,43 @@ See `+format/buffer' for the interactive version of this function, and
|
||||
;;
|
||||
;;; Commands
|
||||
|
||||
(defun +format--org-region (beg end)
|
||||
"Reformat the region within BEG and END.
|
||||
If nil, BEG and/or END will default to the boundaries of the src block at point."
|
||||
(let ((element (org-element-at-point)))
|
||||
(save-excursion
|
||||
(let* ((block-beg (save-excursion
|
||||
(goto-char (org-babel-where-is-src-block-head element))
|
||||
(line-beginning-position 2)))
|
||||
(block-end (save-excursion
|
||||
(goto-char (org-element-property :end element))
|
||||
(skip-chars-backward " \t\n")
|
||||
(line-beginning-position)))
|
||||
(beg (if beg (max beg block-beg) block-beg))
|
||||
(end (if end (min end block-end) block-end))
|
||||
(lang (org-element-property :language element))
|
||||
(major-mode (org-src-get-lang-mode lang)))
|
||||
(if (eq major-mode 'org-mode)
|
||||
(user-error "Cannot reformat an org src block in org-mode")
|
||||
(+format/region beg end))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +format/buffer ()
|
||||
"Reformat the current buffer using LSP or `format-all-buffer'."
|
||||
(interactive)
|
||||
(call-interactively
|
||||
(if (and +format-with-lsp
|
||||
(bound-and-true-p lsp-mode)
|
||||
(lsp-feature? "textDocument/formatting"))
|
||||
#'lsp-format-buffer
|
||||
#'format-all-buffer)))
|
||||
(if (and (eq major-mode 'org-mode)
|
||||
(org-in-src-block-p t))
|
||||
(+format--org-region nil nil)
|
||||
(call-interactively
|
||||
(cond ((and +format-with-lsp
|
||||
(bound-and-true-p lsp-mode)
|
||||
(lsp-feature? "textDocument/formatting"))
|
||||
#'lsp-format-buffer)
|
||||
((and +format-with-lsp
|
||||
(bound-and-true-p eglot--managed-mode)
|
||||
(eglot--server-capable :documentFormattingProvider))
|
||||
#'eglot-format-buffer)
|
||||
(#'format-all-buffer)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +format/region (beg end)
|
||||
@@ -220,14 +247,21 @@ WARNING: this may not work everywhere. It will throw errors if the region
|
||||
contains a syntax error in isolation. It is mostly useful for formatting
|
||||
snippets or single lines."
|
||||
(interactive "rP")
|
||||
(if (and +format-with-lsp
|
||||
(bound-and-true-p lsp-mode)
|
||||
(lsp-feature? "textDocument/rangeFormatting"))
|
||||
(call-interactively #'lsp-format-region)
|
||||
(save-restriction
|
||||
(narrow-to-region beg end)
|
||||
(let ((+format-region-p t))
|
||||
(+format/buffer)))))
|
||||
(if (and (eq major-mode 'org-mode)
|
||||
(org-in-src-block-p t))
|
||||
(+format--org-region beg end)
|
||||
(cond ((and +format-with-lsp
|
||||
(bound-and-true-p lsp-mode)
|
||||
(lsp-feature? "textDocument/rangeFormatting"))
|
||||
(call-interactively #'lsp-format-region))
|
||||
((and +format-with-lsp
|
||||
(bound-and-true-p eglot--managed-mode)
|
||||
(eglot--server-capable :documentRangeFormattingProvider))
|
||||
(call-interactively #'eglot-format))
|
||||
((save-restriction
|
||||
(narrow-to-region beg end)
|
||||
(let ((+format-region-p t))
|
||||
(+format/buffer)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +format/region-or-buffer ()
|
||||
|
||||
@@ -120,3 +120,12 @@ FLAGS can be g and/or i; which mean the same thing they do in
|
||||
:key #'evil-mc-get-cursor-start))
|
||||
(message "No cursors to undo in region"))
|
||||
(evil-mc-undo-last-added-cursor)))
|
||||
|
||||
|
||||
;;;###autoload (autoload '+multiple-cursors-execute-default-operator-fn "editor/multiple-cursors/autoload/evil-mc" nil t)
|
||||
|
||||
(after! evil-mc
|
||||
(evil-mc-define-handler +multiple-cursors-execute-default-operator-fn ()
|
||||
:cursor-clear region
|
||||
(evil-mc-with-region-or-execute-macro region t
|
||||
(funcall (evil-mc-get-command-name) region-start region-end))))
|
||||
|
||||
@@ -67,20 +67,22 @@
|
||||
(company-complete-common . evil-mc-execute-default-complete)
|
||||
(doom/backward-to-bol-or-indent . evil-mc-execute-default-call)
|
||||
(doom/forward-to-last-non-comment-or-eol . evil-mc-execute-default-call)
|
||||
;; :emacs undo
|
||||
(undo-fu-only-undo . evil-mc-execute-default-undo)
|
||||
(undo-fu-only-redo . evil-mc-execute-default-redo)
|
||||
;; :editor evil
|
||||
(evil-delete-back-to-indentation . evil-mc-execute-default-call)
|
||||
;; Have evil-mc work with explicit `evil-escape' (on C-g)
|
||||
(evil-escape . evil-mc-execute-default-evil-normal-state)
|
||||
;; Add `evil-org' support
|
||||
(evil-org-delete . evil-mc-execute-default-evil-delete)
|
||||
(evil-org-delete-char . evil-mc-execute-default-evil-delete)
|
||||
(evil-org-delete-backward-char . evil-mc-execute-default-evil-delete)
|
||||
;; `evil-numbers'
|
||||
(evil-escape . evil-mc-execute-default-evil-normal-state) ; C-g
|
||||
(evil-numbers/inc-at-pt-incremental)
|
||||
(evil-numbers/dec-at-pt-incremental)))
|
||||
(cl-pushnew `(,(car fn) (:default . ,(or (cdr fn) #'evil-mc-execute-default-call-with-count)))
|
||||
evil-mc-custom-known-commands
|
||||
:test #'eq
|
||||
:key #'car))
|
||||
(evil-numbers/dec-at-pt-incremental)
|
||||
;; :tools eval
|
||||
(+eval:replace-region . +multiple-cursors-execute-default-operator-fn)
|
||||
;; :lang org
|
||||
(evil-org-delete . evil-mc-execute-default-evil-delete)))
|
||||
(setf (alist-get (car fn) evil-mc-custom-known-commands)
|
||||
(list (cons :default
|
||||
(or (cdr fn)
|
||||
#'evil-mc-execute-default-call-with-count)))))
|
||||
|
||||
;; HACK Allow these commands to be repeated by prefixing them with a numerical
|
||||
;; argument. See gabesoft/evil-mc#110
|
||||
@@ -102,12 +104,12 @@
|
||||
;; our multiple cursors
|
||||
(add-hook 'evil-insert-state-entry-hook #'evil-mc-resume-cursors)
|
||||
|
||||
;; evil-escape's escape key sequence leaves behind extraneous characters
|
||||
(cl-pushnew 'evil-escape-mode evil-mc-incompatible-minor-modes)
|
||||
;; Lispy commands don't register on more than 1 cursor. Lispyville is fine
|
||||
;; though.
|
||||
(when (featurep! :editor lispy)
|
||||
(cl-pushnew 'lispy-mode evil-mc-incompatible-minor-modes))
|
||||
(pushnew! evil-mc-incompatible-minor-modes
|
||||
;; evil-escape's escape key leaves behind extraneous characters
|
||||
'evil-escape-mode
|
||||
;; Lispy commands don't register on more than 1 cursor. Lispyville
|
||||
;; is fine though.
|
||||
'lispy-mode)
|
||||
|
||||
(add-hook! 'doom-escape-hook
|
||||
(defun +multiple-cursors-escape-multiple-cursors-h ()
|
||||
@@ -132,6 +134,9 @@
|
||||
(after! multiple-cursors-core
|
||||
(setq mc/list-file (concat doom-etc-dir "mc-lists.el"))
|
||||
|
||||
;; Can't use `mc/cmds-to-run-once' because mc-lists.el overwrites it
|
||||
(add-to-list 'mc--default-cmds-to-run-once 'swiper-mc)
|
||||
|
||||
;; TODO multiple-cursors config for Emacs users?
|
||||
|
||||
;; mc doesn't play well with evil, this attempts to assuage some of its
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
|
||||
(cond
|
||||
((featurep! :editor evil)
|
||||
;; REVIEW Broken in 8abf2c1f4f0ade64cbb06c8f47055f04ab83e8d6 (latest commit at
|
||||
;; time of writing). Revisit later.
|
||||
(package! iedit :pin "77eb0a1e2e44b453e4ebf4c38409affa353f5139")
|
||||
(package! evil-multiedit :pin "9f271e0e6048297692f80ed6c5ae8994ac523abc")
|
||||
(package! evil-mc :pin "4d4c0172e4c7f80acc1d0e73d5fb3e536929b262"))
|
||||
|
||||
|
||||
@@ -11,9 +11,10 @@ This modules adds [[https://github.com/clemera/objed][objed]], a global minor-mo
|
||||
text objects. It combines the ideas of versor-mode and other editors like Vim or
|
||||
Kakoune and tries to align them with regular Emacs conventions.
|
||||
|
||||
Note that =objed= is intended as an *alternative* to =evil=, for people who
|
||||
prefer standard Emacs key-bindings and conventions. It's not recommended to use
|
||||
these modules together.
|
||||
#+begin_quote
|
||||
This module is incompatible with the =:editor evil=. Enabling them both will
|
||||
cause errors.
|
||||
#+end_quote
|
||||
|
||||
[[https://github.com/clemera/objed][See the objed project README]] for information on keybinds and usage.
|
||||
|
||||
|
||||
@@ -93,14 +93,39 @@
|
||||
:filter-return #'yas--all-templates
|
||||
(cl-delete-duplicates templates :test #'equal))
|
||||
|
||||
;; HACK Smartparens will interfere with snippets expanded by `hippie-expand`,
|
||||
;; so temporarily disable smartparens during snippet expansion.
|
||||
(after! hippie-exp
|
||||
(defvar +snippets--smartparens-enabled-p t)
|
||||
(defvar +snippets--expanding-p nil)
|
||||
|
||||
;; Is called for all snippet expansions,
|
||||
(add-hook! 'yas-before-expand-snippet-hook
|
||||
(defun +snippets--disable-smartparens-before-expand-h ()
|
||||
;; Remember the initial smartparens state only once, when expanding a
|
||||
;; top-level snippet.
|
||||
(unless +snippets--expanding-p
|
||||
(setq +snippets--expanding-p t
|
||||
+snippets--smartparens-enabled-p smartparens-mode))
|
||||
(when smartparens-mode
|
||||
(smartparens-mode -1))))
|
||||
|
||||
;; Is called only for the top level snippet, but not for the nested ones.
|
||||
;; Hence `+snippets--expanding-p'.
|
||||
(add-hook! 'yas-after-exit-snippet-hook
|
||||
(defun +snippets--restore-smartparens-after-expand-h ()
|
||||
(setq +snippets--expanding-p nil)
|
||||
(when +snippets--smartparens-enabled-p
|
||||
(smartparens-mode 1)))))
|
||||
|
||||
;; If in a daemon session, front-load this expensive work:
|
||||
(if (daemonp) (yas-reload-all)))
|
||||
|
||||
|
||||
(use-package! auto-yasnippet
|
||||
:defer t
|
||||
:init (setq aya-persist-snippets-dir (concat doom-etc-dir "auto-snippets/"))
|
||||
:config
|
||||
(setq aya-persist-snippets-dir +snippets-dir)
|
||||
(defadvice! +snippets--inhibit-yas-global-mode-a (orig-fn &rest args)
|
||||
"auto-yasnippet enables `yas-global-mode'. This is obnoxious for folks like
|
||||
us who use yas-minor-mode and enable yasnippet more selectively. This advice
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
;; -*- no-byte-compile: t; -*-
|
||||
;;; editor/snippets/packages.el
|
||||
|
||||
(package! yasnippet :pin "5b1217ab085fab4abeb1118dccb260691b446703")
|
||||
(package! yasnippet :pin "5cbdbf0d2015540c59ed8ee0fcf4788effdf75b6")
|
||||
(package! auto-yasnippet :pin "db9e0dd4335b2202cd5dac95bbbc87a1032d9bbe")
|
||||
(package! doom-snippets
|
||||
:recipe (:host github
|
||||
:repo "hlissner/doom-snippets"
|
||||
:files ("*.el" "*"))
|
||||
:pin "422f683adfbec1b01fe00524690b64dc9e702ae0")
|
||||
:pin "21b7c8d37224768091a34a6c3ede68d52d03fb18")
|
||||
|
||||
Reference in New Issue
Block a user