Updating Doom Emacs.

This commit is contained in:
Derek Taylor
2020-06-19 22:43:40 -05:00
parent 0f664d532a
commit a5c86c514a
453 changed files with 13527 additions and 12455 deletions

View File

@@ -28,14 +28,12 @@
;; TODO (evil-ex-define-cmd "rx" 'doom:regex) ; open re-builder
(evil-ex-define-cmd "sh[ell]" #'+eshell:run)
(evil-ex-define-cmd "t[mux]" #'+tmux:run) ; send to tmux
(evil-ex-define-cmd "tcd" #'+tmux:cd-here) ; cd to default-directory in tmux
(evil-ex-define-cmd "pad" #'+evil:open-scratch-buffer)
;;; GIT
(evil-ex-define-cmd "gist" #'+gist:send) ; send current buffer/region to gist
(evil-ex-define-cmd "gistl" #'+gist:list) ; list gists by user
(evil-ex-define-cmd "gbrowse" #'+vc:git-browse) ; show file/region in github/gitlab
(evil-ex-define-cmd "gbrowse" #'+vc/browse-at-remote-file-or-region) ; show file/region in github/gitlab
(evil-ex-define-cmd "gissues" #'forge-browse-issues) ; show github issues
(evil-ex-define-cmd "git" #'magit-status) ; open magit status window
(evil-ex-define-cmd "gstage" #'magit-stage)
@@ -49,9 +47,9 @@
(evil-ex-define-cmd "k[ill]m" #'+evil:kill-matching-buffers)
(evil-ex-define-cmd "k[ill]o" #'doom/kill-other-buffers)
(evil-ex-define-cmd "k[ill]b" #'doom/kill-buried-buffers)
(evil-ex-define-cmd "l[ast]" #'doom/popup-restore)
(evil-ex-define-cmd "l[ast]" #'+popup/restore)
(evil-ex-define-cmd "messages" #'view-echo-area-messages)
(evil-ex-define-cmd "pop[up]" #'doom/popup-this-buffer)
(evil-ex-define-cmd "pop[up]" #'+popup/buffer)
;;; Project navigation
(evil-ex-define-cmd "a" #'projectile-find-other-file)
@@ -73,8 +71,9 @@
(evil-ex-define-cmd "pg[grep]d" #'+helm:project-search-from-cwd)))
;;; Project tools
(evil-ex-define-cmd "compile" #'+evil:compile)
(evil-ex-define-cmd "mak[e]" #'+evil:make)
(evil-ex-define-cmd "com[pile]" #'+evil:compile)
(evil-ex-define-cmd "make" #'+evil:make)
(evil-ex-define-cmd "mk" #'+evil:make) ; convenience alias
(evil-ex-define-cmd "debug" #'+debugger/start)
(evil-ex-define-cmd "er[rors]" #'flycheck-list-errors)
@@ -99,4 +98,8 @@
(evil-ex-define-cmd "tabsave" #'+workspace:save)
;;; Org-mode
(evil-ex-define-cmd "cap" #'org-capture)
(evil-ex-define-cmd "cap[ture]" #'org-capture)
;;; ibuffer
(when (featurep! :emacs ibuffer)
(evil-ex-define-cmd "buffers" #'ibuffer))

View File

@@ -1,238 +0,0 @@
;;; editor/evil/+everywhere.el -*- lexical-binding: t; -*-
;; We load evil-collection ourselves for these reasons:
;;
;; 1. To truly lazy load it. Some of its modules, like
;; evil-collection-{elisp-mode,buff-menu} are loaded immediately, because
;; Emacs loads their packages immediately, which pulls in all of
;; evil-collection (and other packages with it, sometimes).
;; 2. This ensures a predictable load order, versus lazy loading using :defer or
;; :after-call. This means users can use (after! org ...) and be sure that
;; their changes will override evil-collection's.
;; 3. Ideally, we'd do away with evil-collection entirely. It changes too often,
;; introduces breaking bugs too frequently, and I don't agree with all their
;; design choices. Regardless, it does mork than it causes trouble, so it may
;; be here to stay.
;; 4. Adds `+evil-collection-disabled-list', to make it easier for users to
;; disable modules, and to reduce the effort required to maintain our copy of
;; `evil-collection-list' (now I can just copy it from time to time).
(defvar +evil-collection-disabled-list
'(anaconda-mode
buff-menu
comint
company
custom
eldoc
elisp-mode
ert
free-keys
help
helm
image
kotlin-mode
occur
package-menu
ruby-mode
simple
slime)
"A list of `evil-collection' modules to ignore. See the definition of this
variable for an explanation of the defaults (in comments). See
`evil-collection-mode-list' for a list of available options.")
(defvar evil-collection-setup-minibuffer nil)
;; We do this ourselves, and better.
(defvar evil-collection-want-unimpaired-p nil)
;; This has to be defined here since evil-collection doesn't autoload its own.
;; It must be updated whenever evil-collection updates theirs. Here's an easy
;; way to update it:
;;
;; (with-current-buffer
;; (url-retrieve-synchronously "https://raw.githubusercontent.com/emacs-evil/evil-collection/master/evil-collection.el" t t)
;; (goto-char (point-min))
;; (when (re-search-forward "^(defvar evil-collection--supported-modes\n[^(]+")
;; (let ((list (sexp-at-point)))
;; ;; Fixes
;; (when (assq 'pdf list)
;; (setf (alist-get 'pdf list) '(pdf-tools)))
;; (kill-new (prin1-to-string list)))))
(defvar evil-collection-mode-list
`(2048-game
ag
alchemist
anaconda-mode
apropos
arc-mode
bookmark
(buff-menu "buff-menu")
calc
calendar
cider
cmake-mode
comint
company
compile
(custom cus-edit)
cus-theme
daemons
deadgrep
debbugs
debug
diff-mode
dired
disk-usage
doc-view
docker
ebib
edbi
edebug
ediff
eglot
elfeed
elisp-mode
elisp-refs
elisp-slime-nav
emms
epa
ert
eshell
eval-sexp-fu
evil-mc
eww
flycheck
flymake
free-keys
geiser
ggtags
git-timemachine
go-mode
grep
guix
hackernews
helm
help
helpful
hg-histedit
hungry-delete
ibuffer
image
image-dired
image+
imenu-list
indium
info
ivy
js2-mode
leetcode
log-edit
log-view
lsp-ui-imenu
lua-mode
kotlin-mode
macrostep
man
magit
magit-todos
,@(if evil-collection-setup-minibuffer '(minibuffer))
monky
mu4e
mu4e-conversation
neotree
notmuch
nov
(occur replace)
omnisharp
outline
p4
(package-menu package)
pass
(pdf pdf-tools)
popup
proced
process-menu
prodigy
profiler
python
quickrun
racer
realgud
reftex
restclient
rjsx-mode
robe
rtags
ruby-mode
simple
slime
sly
tablist
(term term ansi-term multi-term)
tetris
tide
transmission
typescript-mode
vc-annotate
vc-dir
vc-git
vdiff
view
vlf
vterm
w3m
wdired
wgrep
which-key
woman
xref
youtube-dl
(ztree ztree-diff)))
(defun +evil-collection-init (module &optional disabled-list)
"Initialize evil-collection-MODULE.
Unlike `evil-collection-init', this respects `+evil-collection-disabled-list',
and complains if a module is loaded too early (during startup)."
(unless (memq (or (car-safe module) module) disabled-list)
(doom-log "Initialized evil-collection-%s %s"
(or (car-safe module) module)
(if doom-init-time "" "(too early!)"))
(with-demoted-errors "evil-collection error: %s"
(evil-collection-init (list module)))))
;;
;;; Bootstrap
;; These modes belong to packages that Emacs always loads at startup, causing
;; evil-collection to load immediately. We avoid this by loading them after
;; evil-collection has first loaded...
(with-eval-after-load 'evil-collection
(mapc #'+evil-collection-init '(comint custom help)))
;; ...or on first invokation of their associated major/minor modes.
(add-transient-hook! 'Buffer-menu-mode
(+evil-collection-init '(buff-menu "buff-menu")))
(add-transient-hook! 'image-mode
(+evil-collection-init 'image))
(add-transient-hook! 'emacs-lisp-mode
(+evil-collection-init 'elisp-mode))
(add-transient-hook! 'occur-mode
(+evil-collection-init 'replace))
(evil-define-key* 'normal process-menu-mode-map
"q" #'kill-current-buffer
"d" #'process-menu-delete-process)
;; Don't overwrite the leader keys
(setq evil-collection-key-blacklist
(list doom-leader-key doom-localleader-key
doom-leader-alt-key doom-localleader-alt-key))
;; Load the rest
(dolist (mode evil-collection-mode-list)
(dolist (req (or (cdr-safe mode) (list mode)))
(with-eval-after-load req
(+evil-collection-init mode +evil-collection-disabled-list))))

View File

@@ -1,7 +1,7 @@
#+TITLE: feature/evil
#+DATE: February 2, 2017
#+SINCE: v2.0
#+STARTUP: inlineimages
#+STARTUP: inlineimages nofold
* Table of Contents :TOC_3:noexport:
- [[#description][Description]]
@@ -16,6 +16,8 @@
- [[#configuration][Configuration]]
- [[#removing-evil-mode][Removing evil-mode]]
- [[#restoring-old-substitution-behavior-on-ss][Restoring old substitution behavior on s/S]]
- [[#restoring-old-y-behavior-yank-the-whole-line][Restoring old Y behavior (yank the whole line)]]
- [[#disabling-cursor-movement-when-exiting-insert-mode][Disabling cursor movement when exiting insert mode]]
* Description
This holy module brings the vim experience to Emacs.
@@ -32,8 +34,8 @@ This holy module brings the vim experience to Emacs.
+ [[https://github.com/syl20bnr/evil-escape][evil-escape]]
+ [[https://github.com/Dewdrops/evil-exchange][evil-exchange]]
+ [[https://github.com/TheBB/evil-indent-plus][evil-indent-plus]]
+ [[https://github.com/edkolev/evil-lion][evil-lion]]
+ [[https://github.com/redguardtoo/evil-nerd-commenter][evil-nerd-commentary]]
+ [[https://github.com/redguardtoo/evil-matchit][evil-matchit]]
+ [[https://github.com/cofi/evil-numbers][evil-numbers]]
+ [[https://github.com/noctuid/evil-textobj-anyblock][evil-textobj-anyblock]]
+ [[https://github.com/hlissner/evil-snipe][evil-snipe]]
@@ -66,8 +68,10 @@ The following vim plugins have been ported to evil:
|-----------------------+--------------------------------+--------------------------------------------|
| vim-commentary | evil-nerd-commenter | omap =gc= |
| vim-easymotion | evil-easymotion | omap =gs= |
| vim-lion | evil-lion | omap =gl= / =gL= |
| vim-seek or vim-sneak | evil-snipe | mmap =s= / =S=, omap =z= / =Z= & =x= / =X= |
| vim-surround | evil-embrace and evil-surround | vmap =S=, omap =ys= |
| vim-unimpaired | (provided by Doom) | [[https://github.com/hlissner/doom-emacs/blob/develop/modules/editor/evil/config.el#L413-L460][see the list]] |
This module has also ported vim-unimpaired keybinds to Emacs.
@@ -96,6 +100,10 @@ And these are text objects added by this module:
+ =a= C-style function arguments (provided by ~evil-args~)
+ =B= any block delimited by braces, parentheses or brackets (provided by
~evil-textobj-anyblock~)
+ =c= Comments
+ =f= For functions (but relies on the major mode to have sane definitions for
~beginning-of-defun-function~ and ~end-of-defun-function~)
+ =g= The entire buffer
+ =i j k= by indentation (=k= includes one line above; =j= includes one line
above and below) (provided by ~evil-indent-plus~)
+ =x= XML attributes (provided by ~exato~)
@@ -104,15 +112,11 @@ And these are text objects added by this module:
| Ex Command | Description |
|-----------------------+--------------------------------------------------------------------------------------|
| ~:@~ | Apply macro on selected lines |
| ~:ag[!] REGEXP~ | Perform a project search with ag |
| ~:agcwd[!] REGEXP~ | Perform a project search with ag from the current directory |
| ~:al[ign][!] REGEXP~ | Align text to the first match of REGEXP. If BANG, align all matches on each line |
| ~:cp[!] NEWPATH~ | Copy the current file to NEWPATH |
| ~:dash QUERY~ | Look up QUERY (or the symbol at point) in dash docsets |
| ~:dehtml [INPUT]~ | HTML decode selected text / inserts result if INPUT is given |
| ~:enhtml [INPUT]~ | HTML encode selected text / inserts result if INPUT is given |
| ~:grep[!]~ | Perform a project search with git-grep |
| ~:grepcwd[!]~ | Perform a project search with git-grep from the current directory |
| ~:iedit REGEXP~ | Invoke iedit on all matches for REGEXP |
| ~:k[ill]all[!]~ | Kill all buffers (if BANG, affect buffer across workspaces) |
| ~:k[ill]b~ | Kill all buried buffers |
@@ -128,8 +132,6 @@ And these are text objects added by this module:
| ~:repl~ | Open a REPL and/or copy the current selection to it |
| ~:retab~ | Convert indentation to the default within the selection |
| ~:rev[erse]~ | Reverse the selected lines |
| ~:rg[!]~ | Perform a project search with ripgrep |
| ~:rgcwd[!]~ | Perform a project search with ripgrep from the current directory |
| ~:rm[!] [PATH]~ | Delete the current buffer's file and buffer |
| ~:tcd[!]~ | Send =cd X= to tmux. X = the project root if BANG, X = ~default-directory~ otherwise |
@@ -138,7 +140,7 @@ And these are text objects added by this module:
You must do two things to remove Evil:
1. Remove =:editor evil= from =~/.doom.d/init.el=,
2. Run ~doom refresh~ to clean up lingering dependencies and refresh your
2. Run ~doom sync~ to clean up lingering dependencies and regenerate your
autoloads files.
3. [OPTIONAL] You may want to assign new values to ~doom-leader-alt-key~ and
~doom-localleader-alt-key~. These are bound to =C-c= and =C-c l= by default.
@@ -174,3 +176,23 @@ To disable evil-snipe on s/S, you can either:
added to =$DOOMDIR/packages.el=, but this will also disable incremental
highlighting for the f/F/t/T motions keys.
3. Or use =cl= and =cc=, respectively; they do the same thing.
** Restoring old Y behavior (yank the whole line)
Doom changes the behavior of the =Y= key in normal mode to yank-to-EOL
(equivalent to =y$=). This was to make it consistent with the =C= and =D=
capital operators, and because it was redundant with =yy=, which is easier to
type than =y$=.
If you prefer the old behavior, it can be reversed with:
#+BEGIN_SRC elisp
;; add to ~/.doom.d/config.el
(setq! evil-want-Y-yank-to-eol nil)
#+END_SRC
** Disabling cursor movement when exiting insert mode
Vim (and evil) move the cursor one character back when exiting insert mode. If
you prefer that it didn't, set:
#+BEGIN_SRC elisp
;; add to ~/.doom.d/config.el
(setq evil-move-cursor-back nil)
#+END_SRC

View File

@@ -7,7 +7,7 @@
(call-interactively #'doom/escape)))
;;;###autoload
(defun +evil-resolve-vim-path-a (file-name)
(defun +evil-replace-filename-modifiers-a (file-name)
"Take a path and resolve any vim-like filename modifiers in it. This adds
support for most vim file modifiers, as well as:
@@ -15,76 +15,65 @@ support for most vim file modifiers, as well as:
See http://vimdoc.sourceforge.net/htmldoc/cmdline.html#filename-modifiers for
more information on modifiers."
(let* (case-fold-search
(regexp (concat "\\(?:^\\|[^\\\\]\\)"
"\\([#%]\\)"
"\\(\\(?::\\(?:[PphtreS~.]\\|g?s[^:\t\n ]+\\)\\)*\\)"))
(matches
(cl-loop with i = 0
while (and (< i (length file-name))
(string-match regexp file-name i))
do (setq i (1+ (match-beginning 0)))
and collect
(cl-loop for j to (/ (length (match-data)) 2)
collect (match-string j file-name)))))
(dolist (match matches)
(let ((flags (split-string (car (cdr (cdr match))) ":" t))
(path (and buffer-file-name
(pcase (car (cdr match))
("%" (file-relative-name buffer-file-name))
("#" (save-excursion (other-window 1) (file-relative-name buffer-file-name))))))
flag global)
(if (not path)
(setq path "")
(while flags
(setq flag (pop flags))
(when (string-suffix-p "\\" flag)
(setq flag (concat flag (pop flags))))
(when (string-prefix-p "gs" flag)
(setq global t
flag (substring flag 1)))
(setq path
(or (pcase (substring flag 0 1)
("p" (expand-file-name path))
("~" (concat "~/" (file-relative-name path "~")))
("." (file-relative-name path default-directory))
("t" (file-name-nondirectory (directory-file-name path)))
("r" (file-name-sans-extension path))
("e" (file-name-extension path))
("S" (shell-quote-argument path))
("h"
(let ((parent (file-name-directory (expand-file-name path))))
(unless (equal (file-truename path)
(file-truename parent))
(if (file-name-absolute-p path)
(directory-file-name parent)
(file-relative-name parent)))))
("s"
(if (featurep 'evil)
(when-let (args (evil-delimited-arguments (substring flag 1) 2))
(let ((pattern (evil-transform-vim-style-regexp (car args)))
(replace (cadr args)))
(replace-regexp-in-string
(if global pattern (concat "\\(" pattern "\\).*\\'"))
(evil-transform-vim-style-regexp replace) path t t
(unless global 1))))
path))
("P"
(let ((project-root (doom-project-root (file-name-directory (expand-file-name path)))))
(unless project-root
(user-error "Not in a project"))
(abbreviate-file-name project-root)))
(_ path))
"")))
;; strip trailing slash, if applicable
(when (and (not (string= path "")) (equal (substring path -1) "/"))
(setq path (substring path 0 -1))))
(setq file-name
(replace-regexp-in-string
(format "\\(?:^\\|[^\\\\]\\)\\(%s\\)"
(regexp-quote (string-trim-left (car match))))
path file-name t t 1))))
(replace-regexp-in-string regexp "\\1" file-name t)))
(let ((origin-buffer (current-buffer))
case-fold-search)
(with-temp-buffer
(let ((buffer-file-name (buffer-file-name origin-buffer)))
(save-excursion (insert file-name))
(while (re-search-forward "\\(^\\|[^\\\\]\\)\\(\\([%#]\\)\\(:\\([PphtreS~.]\\|g?s\\)\\)*\\)" nil t)
(if (null buffer-file-name)
(replace-match (match-string 1) t t nil 2)
(let ((beg (match-beginning 2))
(end (match-end 3))
(path (pcase (match-string 3)
("%" (file-relative-name buffer-file-name default-directory))
("#" (and (other-buffer origin-buffer)
(buffer-file-name (other-buffer origin-buffer)))))))
(save-match-data
(goto-char beg)
(while (re-search-forward ":\\([PphtreS~.]\\|g?s\\)" (+ (point) 3) t)
(let* ((modifier (match-string 1))
(global (string-prefix-p "gs" modifier)))
(when global
(setq modifier (substring modifier 1)))
(setq end (match-end 1)
path
(pcase (and path (substring modifier 0 1))
(`nil "")
("p" (expand-file-name path))
("~" (concat "~/" (file-relative-name path "~")))
("." (file-relative-name path))
("t" (file-name-nondirectory (directory-file-name path)))
("r" (file-name-sans-extension path))
("e" (file-name-extension path))
("S" (shell-quote-argument path))
("h"
(let ((parent (file-name-directory (expand-file-name path))))
(unless (file-equal-p path parent)
(if (file-name-absolute-p path)
(directory-file-name parent)
(file-relative-name parent)))))
("s"
(if (featurep 'evil)
(when-let (args (evil-delimited-arguments (substring modifier 1) 2))
(let ((pattern (evil-transform-vim-style-regexp (car args)))
(replace (cadr args)))
(replace-regexp-in-string
(if global pattern (concat "\\(" pattern "\\).*\\'"))
(evil-transform-vim-style-regexp replace) path t t
(unless global 1))))
path))
("P"
(let ((project-root (doom-project-root (file-name-directory (expand-file-name path)))))
(unless project-root
(user-error "Not in a project"))
(abbreviate-file-name project-root)))))
;; strip trailing slash, if applicable
(or (string-empty-p path)
(not (equal (substring path -1) "/"))
(setq path (substring path 0 -1))))))
(replace-match path t t nil 2))))
(replace-regexp-in-string "\\\\\\([#%]\\)" "\\1" (buffer-string) t)))))
(defun +evil--insert-newline (&optional above _noextranewline)
(let ((pos (save-excursion (beginning-of-line-text) (point)))
@@ -134,8 +123,7 @@ more information on modifiers."
(not (eq this-command 'evil-open-below))
(evil-insert-state-p))
(funcall orig-fn count)
(cl-letf (((symbol-function 'evil-insert-newline-below)
(lambda () (+evil--insert-newline))))
(letf! (defun evil-insert-newline-below () (+evil--insert-newline))
(let ((evil-auto-indent evil-auto-indent))
(funcall orig-fn count)))))
@@ -145,8 +133,7 @@ more information on modifiers."
(not (eq this-command 'evil-open-above))
(evil-insert-state-p))
(funcall orig-fn count)
(cl-letf (((symbol-function 'evil-insert-newline-above)
(lambda () (+evil--insert-newline 'above))))
(letf! (defun evil-insert-newline-above () (+evil--insert-newline 'above))
(let ((evil-auto-indent evil-auto-indent))
(funcall orig-fn count)))))

View File

@@ -31,11 +31,12 @@
(evil-visual-restore))
;;;###autoload
(defun +evil/paste-preserve-register ()
"Call `evil-paste-after' without overwriting the clipboard (by writing to the
0 register instead). This allows you to paste the same text again afterwards."
(defun +evil/alt-paste ()
"Call `evil-paste-after' but invert `evil-kill-on-visual-paste'.
By default, this replaces the selection with what's in the clipboard without
replacing its contents."
(interactive)
(let ((evil-this-register ?0))
(let ((evil-kill-on-visual-paste (not evil-kill-on-visual-paste)))
(call-interactively #'evil-paste-after)))
(defun +evil--window-swap (direction)
@@ -75,30 +76,21 @@ the only window, use evil-window-move-* (e.g. `evil-window-move-far-left')."
(select-window that-window))))
;;;###autoload
(defun +evil/window-move-left () "See `+evil--window-swap'" (interactive) (+evil--window-swap 'left))
(defun +evil/window-move-left ()
"Swap windows to the left."
(interactive) (+evil--window-swap 'left))
;;;###autoload
(defun +evil/window-move-right () "See `+evil--window-swap'" (interactive) (+evil--window-swap 'right))
(defun +evil/window-move-right ()
"Swap windows to the right"
(interactive) (+evil--window-swap 'right))
;;;###autoload
(defun +evil/window-move-up () "See `+evil--window-swap'" (interactive) (+evil--window-swap 'up))
(defun +evil/window-move-up ()
"Swap windows upward."
(interactive) (+evil--window-swap 'up))
;;;###autoload
(defun +evil/window-move-down () "See `+evil--window-swap'" (interactive) (+evil--window-swap 'down))
;;;###autoload
(defun +evil/easymotion ()
"Invoke and lazy-load `evil-easymotion' without compromising which-key
integration."
(interactive)
(let ((prefix (this-command-keys)))
(evil-define-key* 'motion 'global prefix nil)
(evilem-default-keybindings (key-description prefix))
(setq prefix-arg current-prefix-arg
unread-command-events
(mapcar (lambda (e) (cons t e))
(vconcat (when evil-this-operator
(where-is-internal evil-this-operator
evil-normal-state-map
t))
prefix)))))
(defun +evil/window-move-down ()
"Swap windows downward."
(interactive) (+evil--window-swap 'down))
;;;###autoload (autoload '+evil:apply-macro "editor/evil/autoload/evil" nil t)
(evil-define-operator +evil:apply-macro (beg end)

View File

@@ -108,12 +108,13 @@ g Repeat alignment on all matches in each line"
If BANG is non-nil, open compilation output in a comint buffer.
If BANG, then run ARGUMENTS as a full command. This command understands vim file
modifiers (like %:p:h). See `+evil-resolve-vim-path-a' for details."
modifiers (like %:p:h). See `+evil-replace-filename-modifiers-a' for details."
(interactive "<sh><!>")
(+evil:compile (format "make %s"
(evil-ex-replace-special-filenames
arguments))
bang))
(let ((compile-command "make"))
(+evil:compile (if (stringp arguments)
(evil-ex-replace-special-filenames arguments)
"")
bang)))
;;;###autoload (autoload '+evil:compile "editor/evil/autoload/ex" nil t)
(evil-define-command +evil:compile (arguments &optional bang)
@@ -121,7 +122,7 @@ modifiers (like %:p:h). See `+evil-resolve-vim-path-a' for details."
If BANG is non-nil, open compilation output in a comint buffer.
This command understands vim file modifiers (like %:p:h). See
`+evil-resolve-vim-path-a' for details."
`+evil-replace-filename-modifiers-a' for details."
(interactive "<sh><!>")
(compile (evil-ex-replace-special-filenames
(format "%s %s"
@@ -168,10 +169,11 @@ function and open its documentation with `helpful-function'. Otherwise, it will
search for it with `apropos'.
If QUERY is empty, this runs the equivalent of 'M-x apropos'. If BANG is
non-nil, a search is preformed against Doom's manual (with `doom/help-search')."
non-nil, a search is preformed against Doom's manual (with
`doom/help-search-headings')."
(interactive "<!><a>")
(if bang
(doom/help-search query)
(doom/help-search-headings query)
(save-match-data
(cond ((or (null query) (string-empty-p (string-trim query)))
(call-interactively

View File

@@ -6,8 +6,7 @@
kills the buffer. If FORCE-P, force the deletion (don't ask for confirmation)."
:repeat nil
(interactive "<f><!>")
(doom/delete-this-file (or filename (file-truename buffer-file-name))
force-p))
(doom/delete-this-file filename force-p))
;;;###autoload (autoload '+evil:move-this-file "editor/evil/autoload/files" nil t)
(evil-define-command +evil:move-this-file (new-path &optional force-p)
@@ -20,7 +19,7 @@ overwrite the destination file if it exists, without confirmation."
(user-error "No new path was specified"))
(doom/move-this-file new-path force-p))
;;;###autoload (autoload '+evil:copy-this-file "editor/evil/autoload/files" nil nil)
;;;###autoload (autoload '+evil:copy-this-file "editor/evil/autoload/files" nil t)
(evil-define-command +evil:copy-this-file (new-path &optional force-p)
"Copy current buffer's file to NEW-PATH. Replaces %, # and other vim-esque
filename modifiers (see `+evil*ex-replace-special-filenames'). If FORCE-P,
@@ -30,4 +29,3 @@ overwrite the destination file if it exists, without confirmation."
(when (or (not new-path) (string-empty-p new-path))
(user-error "No new path was specified"))
(doom/copy-this-file new-path force-p))

View File

@@ -7,7 +7,38 @@
;;;###autoload (autoload '+evil:defun-txtobj "editor/evil/autoload/textobjects" nil nil)
(evil-define-text-object +evil:defun-txtobj (count &optional _beg _end type)
"Text object to select the whole buffer."
"Text object to select the top-level Lisp form or function definition at
point."
(cl-destructuring-bind (beg . end)
(bounds-of-thing-at-point 'defun)
(evil-range beg end type)))
;;;###autoload (autoload '+evil:inner-url-txtobj "editor/evil/autoload/textobjects" nil nil)
(evil-define-text-object +evil:inner-url-txtobj (count &optional _beg _end type)
"Text object to select the inner url at point.
This excludes the protocol and querystring."
(cl-destructuring-bind (beg . end)
(bounds-of-thing-at-point 'url)
(evil-range
(save-excursion
(goto-char beg)
(re-search-forward "://" end t))
(save-excursion
(goto-char end)
(- (if-let (pos (re-search-backward "[?#]" beg t))
pos
end)
(if (evil-visual-state-p)
1
0)))
type)))
;;;###autoload (autoload '+evil:outer-url-txtobj "editor/evil/autoload/textobjects" nil nil)
(evil-define-text-object +evil:outer-url-txtobj (count &optional _beg _end type)
"Text object to select the whole url at point."
(cl-destructuring-bind (beg . end)
(bounds-of-thing-at-point 'url)
(evil-range
beg (- end (if (evil-visual-state-p) 1 0))
type)))

View File

@@ -1,13 +1,10 @@
;;; editor/evil/config.el -*- lexical-binding: t; -*-
;; I'm a vimmer at heart. Its modal philosophy suits me better, and this module
;; strives to make Emacs a much better vim than vim was.
(defvar +evil-repeat-keys (cons ";" ",")
"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.")
(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
@@ -20,9 +17,12 @@ directives. By default, this only recognizes C directives.")
;; Set these defaults before `evil'; use `defvar' so they can be changed prior
;; to loading.
(defvar evil-want-C-g-bindings t)
(defvar evil-want-C-i-jump (or (daemonp) (display-graphic-p)))
(defvar evil-want-C-u-scroll t)
(defvar evil-want-C-u-scroll t) ; moved the universal arg to <leader> u
(defvar evil-want-C-u-delete t)
(defvar evil-want-C-w-scroll t)
(defvar evil-want-C-w-delete t)
(defvar evil-want-Y-yank-to-eol t)
(defvar evil-want-abbrev-expand-on-insert-exit nil)
@@ -31,15 +31,10 @@ directives. By default, this only recognizes C directives.")
:demand t
:preface
(setq evil-want-visual-char-semi-exclusive t
evil-magic t
evil-echo-state t
evil-indent-convert-tabs 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-insert-skip-empty-lines t
evil-mode-line-format 'nil
evil-respect-visual-line-mode t
;; more vim-like behavior
evil-symbol-word-search t
;; cursor appearance
@@ -48,12 +43,15 @@ directives. By default, this only recognizes C directives.")
evil-emacs-state-cursor '(box +evil-emacs-cursor-fn)
evil-insert-state-cursor 'bar
evil-visual-state-cursor 'hollow
;; must be set before evil/evil-collection is loaded
evil-want-keybinding (not (featurep! +everywhere))
;; Only do highlighting in selected window so that Emacs has less work
;; to do highlighting them all.
evil-ex-interactive-search-highlight 'selected-window)
;; 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)
:config
(evil-select-search-module 'evil-search-module 'evil-search)
@@ -124,24 +122,42 @@ directives. By default, this only recognizes C directives.")
(count-lines (point-min) (point-max))
(buffer-size)))))
;; 'gq' moves the cursor to the beginning of selection. Disable this, since
;; it's more disruptive than helpful.
;; HACK '=' moves the cursor to the beginning of selection. Disable this,
;; since it's more disruptive than helpful.
(defadvice! +evil--dont-move-cursor-a (orig-fn &rest args)
:around #'evil-indent
(save-excursion (apply orig-fn args)))
;; In evil, registers 2-9 are buffer-local. In vim, they're global, so...
(defadvice! +evil--make-numbered-markers-global-a (_arg)
;; REVIEW In evil, registers 2-9 are buffer-local. In vim, they're global,
;; so... Perhaps this should be PRed upstream?
(defadvice! +evil--make-numbered-markers-global-a (char)
:after-until #'evil-global-marker-p
(and (>= char ?2) (<= char ?9)))
;; REVIEW Fix #2493: dir-locals cannot target fundamental-mode when evil-mode
;; is active. See hlissner/doom-emacs#2493. Revert this if
;; emacs-evil/evil#1268 is resolved upstream.
(defadvice! +evil--fix-local-vars-a (&rest _)
:before #'turn-on-evil-mode
(when (eq major-mode 'fundamental-mode)
(hack-local-variables)))
;; HACK Invoking helpful from evil-ex throws a "No recursive edit is in
;; progress" error because, between evil-ex and helpful,
;; `abort-recursive-edit' gets called one time too many.
(defadvice! +evil--fix-helpful-key-in-evil-ex-a (key-sequence)
:before #'helpful-key
(when (evil-ex-p)
(run-at-time 0.1 nil #'helpful-key key-sequence)
(abort-recursive-edit)))
;; Make ESC (from normal mode) the universal escaper. See `doom-escape-hook'.
(advice-add #'evil-force-normal-state :after #'+evil-escape-a)
;; monkey patch `evil-ex-replace-special-filenames' to improve support for
;; file modifiers like %:p:h. This adds support for most of vim's modifiers,
;; and one custom one: %:P (expand to the project root).
(advice-add #'evil-ex-replace-special-filenames :override #'+evil-resolve-vim-path-a)
(advice-add #'evil-ex-replace-special-filenames :override #'+evil-replace-filename-modifiers-a)
;; make `try-expand-dabbrev' (from `hippie-expand') work in minibuffer
(add-hook 'minibuffer-inactive-mode-hook #'+evil--fix-dabbrev-in-minibuffer-h)
@@ -150,19 +166,10 @@ directives. By default, this only recognizes C directives.")
(advice-add #'evil-window-split :override #'+evil-window-split-a)
(advice-add #'evil-window-vsplit :override #'+evil-window-vsplit-a)
;; Make o/O continue comments (see `+evil-want-o/O-to-continue-comments')
;; Make o/O continue comments (see `+evil-want-o/O-to-continue-comments' to disable)
(advice-add #'evil-open-above :around #'+evil--insert-newline-above-and-respect-comments-a)
(advice-add #'evil-open-below :around #'+evil--insert-newline-below-and-respect-comments-a)
;; Recenter screen after most searches
(dolist (fn '(evil-visualstar/begin-search-forward
evil-visualstar/begin-search-backward
evil-ex-search-word-backward
evil-ex-search-word-backward
evil-ex-search-forward
evil-ex-search-backward))
(advice-add fn :after #'doom-recenter-a))
;; --- custom interactive codes -----------
;; These arg types will highlight matches in the current buffer
(evil-ex-define-argument-type regexp-match
@@ -201,6 +208,7 @@ directives. By default, this only recognizes C directives.")
;;; Packages
(use-package! evil-easymotion
:after-call pre-command-hook
:commands evilem-create evilem-default-keybindings
:config
;; Use evil-search backend, instead of isearch
@@ -208,7 +216,6 @@ directives. By default, this only recognizes C directives.")
:bind ((evil-ex-search-highlight-all nil)))
(evilem-make-motion evilem-motion-search-previous #'evil-ex-search-previous
:bind ((evil-ex-search-highlight-all nil)))
(evilem-make-motion evilem-motion-search-word-forward #'evil-ex-search-word-forward
:bind ((evil-ex-search-highlight-all nil)))
(evilem-make-motion evilem-motion-search-word-backward #'evil-ex-search-word-backward
@@ -218,24 +225,30 @@ directives. By default, this only recognizes C directives.")
(use-package! evil-embrace
:commands embrace-add-pair embrace-add-pair-regexp
:hook (LaTeX-mode . embrace-LaTeX-mode-hook)
:hook (LaTeX-mode . +evil-embrace-latex-mode-hook-h)
:hook (org-mode . embrace-org-mode-hook)
:hook ((ruby-mode enh-ruby-mode) . embrace-ruby-mode-hook)
:hook (ruby-mode . embrace-ruby-mode-hook)
:hook (emacs-lisp-mode . embrace-emacs-lisp-mode-hook)
:hook ((lisp-mode emacs-lisp-mode clojure-mode racket-mode)
:hook ((lisp-mode emacs-lisp-mode clojure-mode racket-mode hy-mode)
. +evil-embrace-lisp-mode-hook-h)
:hook ((org-mode LaTeX-mode) . +evil-embrace-latex-mode-hook-h)
:hook ((c++-mode rust-mode rustic-mode csharp-mode java-mode swift-mode typescript-mode)
:hook ((c++-mode rustic-mode csharp-mode java-mode swift-mode typescript-mode)
. +evil-embrace-angle-bracket-modes-hook-h)
:hook (scala-mode . +evil-embrace-scala-mode-hook-h)
:init
(after! evil-surround
(evil-embrace-enable-evil-surround-integration))
:config
(setq evil-embrace-show-help-p nil)
(defun +evil-embrace-scala-mode-hook-h ()
(embrace-add-pair ?$ "${" "}"))
(defun +evil-embrace-latex-mode-hook-h ()
(embrace-add-pair-regexp ?l "\\[a-z]+{" "}" #'+evil--embrace-latex))
(defun +evil-embrace-lisp-mode-hook-h ()
;; Avoid `embrace-add-pair-regexp' because it would overwrite the default
;; `f' rule, which we want for other modes
(push (cons ?f (make-embrace-pair-struct
:key ?f
:read-function #'+evil--embrace-elisp-fn
@@ -244,14 +257,11 @@ directives. By default, this only recognizes C directives.")
embrace--pairs-list))
(defun +evil-embrace-angle-bracket-modes-hook-h ()
(set (make-local-variable 'evil-embrace-evil-surround-keys)
(delq ?< evil-embrace-evil-surround-keys))
(push (cons ?< (make-embrace-pair-struct
:key ?<
:read-function #'+evil--embrace-angle-brackets
:left-regexp "\\[a-z]+<"
:right-regexp ">"))
embrace--pairs-list))
(let ((var (make-local-variable 'evil-embrace-evil-surround-keys)))
(set var (delq ?< evil-embrace-evil-surround-keys))
(set var (delq ?> evil-embrace-evil-surround-keys)))
(embrace-add-pair-regexp ?< "\\_<[a-z0-9-_]+<" ">" #'+evil--embrace-angle-brackets)
(embrace-add-pair ?> "<" ">"))
;; Add escaped-sequence support to embrace
(setf (alist-get ?\\ (default-value 'embrace--pairs-list))
@@ -272,8 +282,13 @@ directives. By default, this only recognizes C directives.")
evil-escape-delay 0.15)
(evil-define-key* '(insert replace visual operator) 'global "\C-g" #'evil-escape)
:config
;; no `evil-escape' in minibuffer
(add-hook 'evil-escape-inhibit-functions #'minibufferp)
;; no `evil-escape' in minibuffer, unless `evil-collection-setup-minibuffer'
;; is enabled, where we could be in insert mode in the minibuffer.
(add-hook! 'evil-escape-inhibit-functions
(defun +evil-inhibit-escape-in-minibuffer-fn ()
(and (minibufferp)
(or (not (bound-and-true-p evil-collection-setup-minibuffer))
(evil-normal-state-p)))))
;; so that evil-escape-mode-hook runs, and can be toggled by evil-mc
(evil-escape-mode +1))
@@ -356,14 +371,12 @@ directives. By default, this only recognizes C directives.")
(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'."
(let ((fn-sym (intern (format "+evil/repeat-%s" (doom-unquote command)))))
`(progn
(defun ,fn-sym (&rest _)
(when +evil-repeat-keys
(evil-define-key* 'motion 'local
(kbd (car +evil-repeat-keys)) #',next-func
(kbd (cdr +evil-repeat-keys)) #',prev-func)))
(advice-add #',command :after-while #',fn-sym))))
`(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)
@@ -391,26 +404,6 @@ To change these keys see `+evil-repeat-keys'."
evil-ex-search-previous evil-ex-search-next)
;; `evil-collection'
(when (featurep! +everywhere)
(unless doom-reloading-p
(load! "+everywhere"))
(setq evil-collection-company-use-tng (featurep! :completion company +tng))
;; Don't let evil-collection interfere with certain keys
(appendq! evil-collection-key-blacklist
(append (when (featurep! :tools lookup)
'("gd" "gf" "K"))
(when (featurep! :tools eval)
'("gr" "gR"))
'("[" "]" "gz" "<escape>")))
(defadvice! +evil-collection-disable-blacklist-a (orig-fn)
:around #'evil-collection-vterm-toggle-send-escape ; allow binding to ESC
(let (evil-collection-key-blacklist)
(apply orig-fn))))
;; 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
@@ -434,19 +427,22 @@ To change these keys see `+evil-repeat-keys'."
:m "]y" #'+evil:c-string-encode
:m "[y" #'+evil:c-string-decode
(:when (featurep! :lang web)
:m "]x" #'+web:encode-html-entities
:m "[x" #'+web:decode-html-entities)
:m "]x" #'+web:encode-html-entities
:m "[x" #'+web:decode-html-entities)
(:when (featurep! :ui vc-gutter)
:m "]d" #'git-gutter:next-hunk
:m "[d" #'git-gutter:previous-hunk)
:m "]d" #'git-gutter:next-hunk
:m "[d" #'git-gutter:previous-hunk)
(:when (featurep! :ui hl-todo)
:m "]t" #'hl-todo-next
:m "[t" #'hl-todo-previous)
:m "]t" #'hl-todo-next
:m "[t" #'hl-todo-previous)
(:when (featurep! :ui workspaces)
:n "gt" #'+workspace:switch-next
:n "gT" #'+workspace:switch-previous
:n "]w" #'+workspace/switch-right
:n "[w" #'+workspace/switch-left)
:n "gt" #'+workspace:switch-next
:n "gT" #'+workspace:switch-previous
:n "]w" #'+workspace/switch-right
:n "[w" #'+workspace/switch-left)
(:when (featurep! :ui tabs)
:n "gt" #'centaur-tabs-forward
:n "gT" #'centaur-tabs-backward)
;; custom vim-unmpaired-esque keys
:m "]#" #'+evil/next-preproc-directive
@@ -468,7 +464,7 @@ To change these keys see `+evil-repeat-keys'."
:n "[o" #'+evil/insert-newline-above
:n "]o" #'+evil/insert-newline-below
:n "gp" #'+evil/reselect-paste
:v "gp" #'+evil/paste-preserve-register
:v "gp" #'+evil/alt-paste
:nv "g@" #'+evil:apply-macro
:nv "gc" #'evilnc-comment-operator
:nv "gx" #'evil-exchange
@@ -479,29 +475,28 @@ To change these keys see `+evil-repeat-keys'."
:v "g-" #'evil-numbers/dec-at-pt-incremental
:v "g+" #'evil-numbers/inc-at-pt
(:when (featurep! :tools lookup)
:nv "K" #'+lookup/documentation
:nv "gd" #'+lookup/definition
:nv "gD" #'+lookup/references
:nv "gf" #'+lookup/file)
:nv "K" #'+lookup/documentation
:nv "gd" #'+lookup/definition
:nv "gD" #'+lookup/references
:nv "gf" #'+lookup/file)
(:when (featurep! :tools eval)
:nv "gr" #'+eval:region
:n "gR" #'+eval/buffer
:v "gR" #'+eval:replace-region
;; Restore these keybinds, since the blacklisted/overwritten gr/gR will
;; undo them:
(:after dired
:map dired-mode-map
:n "gr" #'revert-buffer)
(:after notmuch
:map notmuch-common-keymap
:n "gr" #'notmuch-refresh-this-buffer
:n "gR" #'notmuch-poll-and-refresh-this-buffer)
(:after elfeed
:map elfeed-search-update--force
:n "gr" #'elfeed-search-update--force
:n "gR" #'elfeed-search-fetch))
:nv "gr" #'+eval:region
:n "gR" #'+eval/buffer
:v "gR" #'+eval:replace-region
;; Restore these keybinds, since the blacklisted/overwritten gr/gR will
;; undo them:
(:after dired
:map dired-mode-map
:n "gr" #'revert-buffer)
(:after notmuch
:map notmuch-common-keymap
:n "gr" #'notmuch-refresh-this-buffer
:n "gR" #'notmuch-poll-and-refresh-this-buffer)
(:after elfeed
:map elfeed-search-mode-map
:n "gr" #'elfeed-search-update--force
:n "gR" #'elfeed-search-fetch))
:nv "z=" #'flyspell-correct-word-generic
;; custom evil keybinds
:nv "zn" #'+evil:narrow-buffer
:n "zN" #'doom/widen-indirectly-narrowed-buffer
@@ -513,30 +508,30 @@ To change these keys see `+evil-repeat-keys'."
;; window management (prefix "C-w")
(:map evil-window-map
;; Navigation
"C-h" #'evil-window-left
"C-j" #'evil-window-down
"C-k" #'evil-window-up
"C-l" #'evil-window-right
"C-w" #'other-window
;; Swapping windows
"H" #'+evil/window-move-left
"J" #'+evil/window-move-down
"K" #'+evil/window-move-up
"L" #'+evil/window-move-right
"C-S-w" #'ace-swap-window
;; Window undo/redo
(:prefix "m"
"m" #'doom/window-maximize-buffer
"v" #'doom/window-maximize-vertically
"s" #'doom/window-maximize-horizontally)
"u" #'winner-undo
"C-u" #'winner-undo
"C-r" #'winner-redo
"o" #'doom/window-enlargen
;; Delete window
"d" #'evil-window-delete
"C-C" #'ace-delete-window)
;; Navigation
"C-h" #'evil-window-left
"C-j" #'evil-window-down
"C-k" #'evil-window-up
"C-l" #'evil-window-right
"C-w" #'other-window
;; Swapping windows
"H" #'+evil/window-move-left
"J" #'+evil/window-move-down
"K" #'+evil/window-move-up
"L" #'+evil/window-move-right
"C-S-w" #'ace-swap-window
;; Window undo/redo
(:prefix "m"
"m" #'doom/window-maximize-buffer
"v" #'doom/window-maximize-vertically
"s" #'doom/window-maximize-horizontally)
"u" #'winner-undo
"C-u" #'winner-undo
"C-r" #'winner-redo
"o" #'doom/window-enlargen
;; Delete window
"d" #'evil-window-delete
"C-C" #'ace-delete-window)
;; text objects
:textobj "a" #'evil-inner-arg #'evil-outer-arg
@@ -547,41 +542,49 @@ To change these keys see `+evil-repeat-keys'."
:textobj "i" #'evil-indent-plus-i-indent #'evil-indent-plus-a-indent
:textobj "j" #'evil-indent-plus-i-indent-up-down #'evil-indent-plus-a-indent-up-down
:textobj "k" #'evil-indent-plus-i-indent-up #'evil-indent-plus-a-indent-up
:textobj "u" #'+evil:inner-url-txtobj #'+evil:outer-url-txtobj
:textobj "x" #'evil-inner-xml-attr #'evil-outer-xml-attr
;; evil-easymotion
;; evil-easymotion (see `+evil/easymotion')
(:after evil-easymotion
:map evilem-map
:m "gs" evilem-map
(:map evilem-map
"a" (evilem-create #'evil-forward-arg)
"A" (evilem-create #'evil-backward-arg)
"s" #'evil-avy-goto-char-2
"SPC" (λ!! #'evil-avy-goto-char-timer t)
"/" #'evil-avy-goto-char-timer)
"SPC" (cmd!! #'evil-avy-goto-char-timer t)
"/" #'evil-avy-goto-char-timer))
;; evil-snipe
(:after evil-snipe
:map evil-snipe-parent-transient-map
"C-;" (λ! (require 'evil-easymotion)
(call-interactively
(evilem-create #'evil-snipe-repeat
:bind ((evil-snipe-scope 'whole-buffer)
(evil-snipe-enable-highlight)
(evil-snipe-enable-incremental-highlight))))))
:map evil-snipe-parent-transient-map
"C-;" (cmd! (require 'evil-easymotion)
(call-interactively
(evilem-create #'evil-snipe-repeat
:bind ((evil-snipe-scope 'whole-buffer)
(evil-snipe-enable-highlight)
(evil-snipe-enable-incremental-highlight))))))
;; evil-surround
:v "S" #'evil-surround-region
:o "s" #'evil-surround-edit
:o "S" #'evil-Surround-edit
;; evil-lion
:n "gl" #'evil-lion-left
:n "gL" #'evil-lion-right
:v "gl" #'evil-lion-left
:v "gL" #'evil-lion-right
;; Omni-completion
(:when (featurep! :completion company)
(:prefix "C-x"
:i "C-l" #'+company/whole-lines
:i "C-k" #'+company/dict-or-keywords
:i "C-f" #'company-files
:i "C-]" #'company-etags
:i "s" #'company-ispell
:i "C-s" #'company-yasnippet
:i "C-o" #'company-capf
:i "C-n" #'+company/dabbrev
:i "C-p" #'+company/dabbrev-code-previous)))
(:prefix "C-x"
:i "C-l" #'+company/whole-lines
:i "C-k" #'+company/dict-or-keywords
:i "C-f" #'company-files
:i "C-]" #'company-etags
:i "s" #'company-ispell
:i "C-s" #'company-yasnippet
:i "C-o" #'company-capf
:i "C-n" #'+company/dabbrev
:i "C-p" #'+company/dabbrev-code-previous)))

View File

@@ -1,22 +1,29 @@
;; -*- no-byte-compile: t; -*-
;;; editor/evil/packages.el
(package! evil)
(package! evil-args)
(package! evil-easymotion)
(package! evil-embrace)
(package! evil-escape)
(package! evil-exchange)
(package! evil-indent-plus)
(package! evil-nerd-commenter)
(package! evil-numbers :recipe (:host github :repo "janpath/evil-numbers"))
(package! evil-snipe)
(package! evil-surround)
(package! evil-textobj-anyblock)
(package! evil-traces)
(package! evil-visualstar)
(package! exato)
(package! evil-quick-diff :recipe (:host github :repo "rgrinberg/evil-quick-diff"))
(package! evil :pin "25fc5c6647979357cf3e39f0667a9b7ae5266af9")
(package! evil-args :pin "758ad5ae54ad34202064fec192c88151c08cb387")
(package! evil-easymotion :pin "f96c2ed38ddc07908db7c3c11bcd6285a3e8c2e9")
(package! evil-embrace :pin "4379adea032b25e359d01a36301b4a5afdd0d1b7")
(package! evil-escape
:recipe (:host github :repo "hlissner/evil-escape")
:pin "819f1ee1cf3f69a1ae920e6004f2c0baeebbe077")
(package! evil-exchange :pin "3030e21ee16a42dfce7f7cf86147b778b3f5d8c1")
(package! evil-indent-plus :pin "0c7501e6efed661242c3a20e0a6c79a6455c2c40")
(package! evil-lion :pin "6b03593f5dd6e7c9ca02207f9a73615cf94c93ab")
(package! evil-nerd-commenter :pin "1bd2de52011c39777a3e8779b14cee2790dc873b")
(package! evil-numbers
:recipe (:host github :repo "janpath/evil-numbers")
:pin "c2cfdd1eb1f193bea28ee79b191b78309677058a")
(package! evil-snipe :pin "6dcac7f2516c6137a2de532fc2c052f242559ee3")
(package! evil-surround :pin "1c34944d8c98da4a2385d24ee89eef9cdf569a12")
(package! evil-textobj-anyblock :pin "ff00980f0634f95bf2ad9956b615a155ea8743be")
(package! evil-traces :pin "bc25cae9fa5ab0ba1507827f0944f52ce0ca7462")
(package! evil-visualstar :pin "06c053d8f7381f91c53311b1234872ca96ced752")
(package! exato :pin "aee7af7b7a0e7551478f453d1de7d5b9cb2e06c4")
(package! evil-quick-diff
:recipe (:host github :repo "rgrinberg/evil-quick-diff")
:pin "69c883720b30a892c63bc89f49d4f0e8b8028908")
;;
(when (featurep! +everywhere)
@@ -26,4 +33,4 @@
(package! neotree)
(autoload 'neotree-make-executor "neotree" nil nil 'macro))
(package! evil-collection))
(package! evil-collection :pin "e065da3732f015428bd0068481dadad9e0e6d09c"))

View File

@@ -1,7 +1,7 @@
;; -*- no-byte-compile: t; -*-
;;; editor/evil/test/test-evil.el
(describe "feature/evil"
(describe "editor/evil"
:var (resv project-root)
(require! :editor evil)
@@ -9,10 +9,10 @@
(load! "../autoload/evil")
(before-each
(fset 'resv #'+evil-resolve-vim-path-a)
(fset 'resv #'+evil-replace-filename-modifiers-a)
(spy-on 'doom-project-root :and-call-fake (lambda () project-root)))
;; `evil-ex-replace-special-filenames' / `+evil-resolve-vim-path-a'
;; `evil-ex-replace-special-filenames' / `+evil-replace-filename-modifiers-a'
(describe "file modifiers"
(it "supports basic vim file modifiers"
(let ((buffer-file-name "~/.emacs.d/test/modules/feature/test-evil.el")

View File

@@ -4,21 +4,21 @@
#+STARTUP: inlineimages
* Table of Contents :TOC_2:noexport:
- [[Description][Description]]
- [[Module Flags][Module Flags]]
- [[Plugins][Plugins]]
- [[Prerequisites][Prerequisites]]
- [[Usage][Usage]]
- [[Inserting OSS licenses][Inserting OSS licenses]]
- [[Configuration][Configuration]]
- [[Registering a new file template][Registering a new file template]]
- [[Changing existing file templates][Changing existing file templates]]
- [[Adding new OSS licenses][Adding new OSS licenses]]
- [[Troubleshooting][Troubleshooting]]
- [[Appendix][Appendix]]
- [[API][API]]
- [[Commands][Commands]]
- [[Variables][Variables]]
- [[#description][Description]]
- [[#module-flags][Module Flags]]
- [[#plugins][Plugins]]
- [[#prerequisites][Prerequisites]]
- [[#usage][Usage]]
- [[#inserting-oss-licenses][Inserting OSS licenses]]
- [[#configuration][Configuration]]
- [[#registering-a-new-file-template][Registering a new file template]]
- [[#changing-existing-file-templates][Changing existing file templates]]
- [[#adding-new-oss-licenses][Adding new OSS licenses]]
- [[#troubleshooting][Troubleshooting]]
- [[#appendix][Appendix]]
- [[#api][API]]
- [[#commands][Commands]]
- [[#variables][Variables]]
* Description
This module adds file templates for blank files, powered by yasnippet.
@@ -49,8 +49,12 @@ for comment headers in code.
#+end_quote
* Configuration
** TODO Registering a new file template
** TODO Changing existing file templates
** Registering a new file template
Look into the documentation of ~set-file-template!~ and ~set-file-templates!~.
** Changing existing file templates
Simply register a new template (using ~set-file-template!~) that matches the same
file. The new template would be pushed to the top of ~+file-template-alist~ and
thus would take priority while searching for a template to insert.
** Adding new OSS licenses
The ~+file-templates/insert-license~ command searches for snippets under
~text-mode~ that are named ~__license-ABC~, where ABC is the short name of the

View File

@@ -41,7 +41,7 @@ these properties:
;;;###autodef
(defun set-file-templates! (&rest templates)
"Like `set-file-templates!', but can register multiple file templates at once.
"Like `set-file-template!', but can register multiple file templates at once.
\(fn &rest (PRED &key WHEN TRIGGER MODE PROJECT IGNORE))"
(defer-until! (boundp '+file-templates-alist)
@@ -100,6 +100,8 @@ evil is loaded and enabled)."
"Insert a license file template into the current file."
(interactive)
(require 'yasnippet)
(unless (gethash 'text-mode yas--tables)
(yas-reload-all t))
(let ((templates
(let (yas-choose-tables-first ; avoid prompts
yas-choose-keys-first)

View File

@@ -9,7 +9,7 @@
don't have a :trigger property in `+file-templates-alist'.")
(defvar +file-templates-alist
`(;; General
'(;; General
(gitignore-mode)
(dockerfile-mode)
("/docker-compose\\.yml$" :mode yaml-mode)
@@ -29,7 +29,7 @@ don't have a :trigger property in `+file-templates-alist'.")
:trigger "__doom-module"
:mode emacs-lisp-mode)
("-test\\.el$" :mode emacs-ert-mode)
(emacs-lisp-mode :trigger "__initfile")
(emacs-lisp-mode :trigger "__package")
(snippet-mode)
;; C/C++
("/main\\.c\\(?:c\\|pp\\)$" :trigger "__main.cpp" :mode c++-mode)
@@ -73,7 +73,8 @@ don't have a :trigger property in `+file-templates-alist'.")
:when +file-templates-in-emacs-dirs-p
:trigger "__doom-readme"
:mode org-mode)
("\\.org$" :trigger "__" :mode org-mode)
(org-journal-mode :ignore t)
(org-mode)
;; PHP
("\\.class\\.php$" :trigger "__.class.php" :mode php-mode)
(php-mode)
@@ -107,7 +108,7 @@ information.")
;;
;; Library
;;; Library
(defun +file-templates-in-emacs-dirs-p (file)
"Returns t if FILE is in Doom or your private directory."
@@ -118,11 +119,14 @@ information.")
"Return t if RULE applies to the current buffer."
(let ((pred (car rule))
(plist (cdr rule)))
(and (cond ((symbolp pred) (eq major-mode pred))
((and (stringp pred) buffer-file-name)
(string-match-p pred buffer-file-name))
((not (plist-member plist :when)) t)
((funcall (plist-get plist :when) buffer-file-name)))
(and (or (and (symbolp pred)
(eq major-mode pred))
(and (stringp pred)
(stringp buffer-file-name)
(string-match-p pred buffer-file-name)))
(or (not (plist-member plist :when))
(funcall (plist-get plist :when)
buffer-file-name))
rule)))
(defun +file-templates-check-h ()
@@ -134,10 +138,7 @@ must be non-read-only, empty, and there must be a rule in
(bobp) (eobp)
(not (member (substring (buffer-name) 0 1) '("*" " ")))
(not (file-exists-p buffer-file-name))
;; Prevent file-templates from breaking org-capture when target file
;; doesn't exist and has a file template.
(or (not (fboundp 'org-capture-get))
(not (org-capture-get :new-buffer)))
(not (buffer-modified-p))
(when-let (rule (cl-find-if #'+file-template-p +file-templates-alist))
(apply #'+file-templates--expand rule))))
@@ -156,4 +157,4 @@ must be non-read-only, empty, and there must be a rule in
(yas-reload-all)))
;;
(add-hook 'find-file-hook #'+file-templates-check-h)
(add-hook 'doom-switch-buffer-hook #'+file-templates-check-h)

View File

@@ -1,5 +1,4 @@
;; -*- no-byte-compile: t; -*-
;;; editor/file-templates/packages.el
(package! yasnippet)
(package! yasnippet :pin "5b1217ab085fab4abeb1118dccb260691b446703")

View File

@@ -1,6 +0,0 @@
;;; `(file-name-nondirectory buffer-file-name)`${1: --- ${2:description}} -*- lexical-binding: t; -*-
$0
(provide '`(file-name-base buffer-file-name)`)
;;; `(file-name-nondirectory buffer-file-name)` ends here

View File

@@ -1,9 +0,0 @@
(defun yas-java-project-package ()
(or (and (eq major-mode 'java-mode)
(+java-current-package))
""))
(defun yas-java-class-name ()
(or (and (eq major-mode 'java-mode)
(+java-current-class))
""))

View File

@@ -1,9 +1,9 @@
# -*- mode: snippet -*-
# name: Java file template
# --
package `(yas-java-project-package)`;
package `(+java-current-package)`;
public class `(yas-java-class-name)` $1
public class `(+java-current-class)` $1
{
$0
}

View File

@@ -1,9 +1,9 @@
# -*- mode: snippet -*-
# name: Java MAIN file template
# --
package `(yas-java-project-package)`;
package `(+java-current-package)`;
public class `(yas-java-class-name)` $1
public class `(+java-current-class)` $1
{
public static void main(String[] args) {
$0

View File

@@ -1,6 +1,20 @@
# -*- mode: snippet -*-
# name: Org template
# --
#+TITLE: ${1:`(file-name-base buffer-file-name)`}
#+TITLE: ${1:`
(string-join
(mapcar #'capitalize
;; Replace -,_... with space
(split-string
(let (case-fold-search)
;; Seperating lower from upper: hello|World
(replace-regexp-in-string
"\\([[:lower:]]\\)\\([[:upper:]]\\)" "\\1 \\2"
;; Separating upper from (upper and lower): HTTP|Server
(replace-regexp-in-string "\\([[:upper:]]\\)\\([[:upper:]][0-9[:lower:]]\\)"
"\\1 \\2" (file-name-base buffer-file-name))))
"[^[:word:]0-9]+"
)) " " )
`}
$0

View File

@@ -1,5 +1,5 @@
# -*- mode: snippet -*-
# name: Doom module readme
# name: Doom module readme
# --
#+TITLE: ${1:`(if (string-match "modules/\\([^/]+\\)/\\([^/]+\\)/.+" buffer-file-name)
(format "%s/%s"
@@ -7,36 +7,64 @@
(match-string 2 buffer-file-name))
"")`}
#+DATE: `(format (format-time-string "%B %%s, %Y") (string-to-number (format-time-string "%d")))`
#+SINCE: ${2:{replace with next tagged release version}}
#+STARTUP: inlineimages
#+SINCE: ${2:<replace with next tagged release version>}
#+STARTUP: inlineimages nofold
* Table of Contents :TOC_3:noexport:
* Description
${3:A summary of what this module does.}
${3:# A summary of what this module does.}
+ If possible, include a brief list of feature highlights here
+ Like code completion, syntax checking or available snippets
+ Include links to packages & external things where possible
** Maintainers
+ @username_linked_to_gihub (Author)
+ @username_linked_to_gihub
+ @username_linked_to_gihub
# If this module has no maintainers, then...
This module has no dedicated maintainers.
** Module Flags
+ =+flag1= A short description of what this flag does and what it might need
when enabled.
+ =+flag2= A short description of what this flag does and what it might need
when enabled.
+ =+flag3= A short description of what this flag does and what it might need
when enabled.
# If this module has no flags, then...
This module provides no flags.
** Plugins
{A list of linked plugins}
# A list of linked plugins
+ [[https://orgmode.org/][org-plus-contrib]]
+ [[https://github.com/sabof/org-bullets][org-bullets]]
+ [[https://github.com/TobiasZawada/org-yt][org-yt]]
+ [[https://github.com/sebastiencs/company-box][company-box]]* (=+childframe=)
+ =:lang crystal=
+ [[https://github.com/brantou/ob-crystal][ob-crystal]]
+ =:lang go=
+ [[https://github.com/pope/ob-go][ob-go]]
+ =+present=
+ [[https://github.com/anler/centered-window-mode][centered-window]]
+ [[https://github.com/takaxp/org-tree-slide][org-tree-slide]]
+ [[https://gitlab.com/oer/org-re-reveal][org-re-reveal]]
** Hacks
{A list of internal modifications to included packages}
# A list of internal modifications to included packages; omit if unneeded
* Prerequisites
This module has no prereqisites.
This module has no prerequisites.
* Features
An in-depth list of features, how to use them, and their dependencies.
# An in-depth list of features, how to use them, and their dependencies.
* Configuration
How to configure this module, including common problems and how to address them.
# How to configure this module, including common problems and how to address them.
* Troubleshooting
Common issues and their solution, or places to look for help.
# Common issues and their solution, or places to look for help.
$0

View File

@@ -1,3 +1,4 @@
#!/usr/bin/env `(if (equal (file-name-extension buffer-file-name) "zsh") "zsh" "bash")`
set -euo pipefail
$0

View File

@@ -27,7 +27,10 @@
(save-excursion
(ignore-errors
(or (hs-looking-at-block-start-p)
(hs-find-block-beginning)))))
(hs-find-block-beginning)
(unless (eolp)
(end-of-line)
(+fold--hideshow-fold-p))))))
(defun +fold--invisible-points (count)
(let (points)

View File

@@ -29,7 +29,7 @@
hs-set-up-overlay #'+fold-hideshow-set-up-overlay-fn)
(defadvice! +fold--hideshow-ensure-mode-a (&rest _)
"Ensure `hs-minor-mode' is enabled."
"Ensure `hs-minor-mode' is enabled when we need it, no sooner or later."
:before '(hs-toggle-hiding hs-hide-block hs-hide-level hs-show-all hs-hide-all)
(unless (bound-and-true-p hs-minor-mode)
(hs-minor-mode +1)))
@@ -48,16 +48,24 @@
"end\\|[]}]"
"#\\|=begin"
ruby-forward-sexp)
(enh-ruby-mode "class\\|d\\(?:ef\\|o\\)\\|module\\|[[{]"
"end\\|[]}]"
"#\\|=begin"
enh-ruby-forward-sexp nil)
(matlab-mode "if\\|switch\\|case\\|otherwise\\|while\\|for\\|try\\|catch"
"end"
nil (lambda (_arg) (matlab-forward-sexp)))
(nxml-mode "<!--\\|<[^/>]*[^/]>"
"-->\\|</[^/>]*[^/]>"
"<!--" sgml-skip-tag-forward nil))
"<!--" sgml-skip-tag-forward nil)
(latex-mode
;; LaTeX-find-matching-end needs to be inside the env
("\\\\begin{[a-zA-Z*]+}\\(\\)" 1)
"\\\\end{[a-zA-Z*]+}"
"%"
(lambda (_arg)
;; Don't fold whole document, that's useless
(unless (save-excursion
(search-backward "\\begin{document}"
(line-beginning-position) t))
(LaTeX-find-matching-end)))
nil))
hs-special-modes-alist
'((t))))))

View File

@@ -1,5 +1,8 @@
;; -*- no-byte-compile: t; -*-
;;; editor/fold/packages.el
(package! hideshow :built-in t)
(package! vimish-fold :pin "63685239655a151181b9152e45478dad587f86f2")
(when (featurep! :editor evil)
(package! evil-vimish-fold))
(package! evil-vimish-fold :pin "b6e0e6b91b8cd047e80debef1a536d9d49eef31a"))

View File

@@ -92,126 +92,142 @@ Stolen shamelessly from go-mode"
;; Public library
(defun +format-completing-read ()
"TODO"
(require 'format-all)
(let* ((fmtlist (mapcar #'symbol-name (hash-table-keys format-all--format-table)))
(fmt (completing-read "Formatter: " fmtlist)))
(if fmt (cons (intern fmt) t))))
(if fmt (intern fmt))))
;;;###autoload
(defun +format-probe-a (orig-fn)
"Use `+format-with' instead, if it is set."
(if +format-with
(list +format-with t)
(funcall orig-fn)))
"Use `+format-with' instead, if it is set.
Prompts for a formatter if universal arg is set."
(cond ((or (eq +format-with :none)
(doom-temp-buffer-p (current-buffer))
(doom-special-buffer-p (current-buffer)))
(list nil nil))
(current-prefix-arg
(list (or (+format-completing-read)
(user-error "Aborted"))
t))
(+format-with
(list +format-with t))
((funcall orig-fn))))
;;;###autoload
(defun +format-buffer (formatter mode-result &optional preserve-indent-p)
"Format the source code in the current buffer.
(defun +format-buffer-a (orig-fn formatter mode-result)
"Advice that extends `format-all-buffer--with' to:
Returns any of the following values:
'unknown No formatter is defined for this major-mode
'error Couldn't format buffer due to formatter errors
'noop Buffer is already formatted
Otherwise, returns a list: (list OUTPUT ERRORS FIRST-DIFF), where OUTPUT is the
formatted text, ERRORS are any errors in string format, and FIRST-DIFF is the
position of the first change in the buffer.
1. Enable partial/region reformatting, while preserving leading indentation,
2. Applies changes via RCS patch, line by line, to protect buffer markers and
reduce cursor movement or window scrolling.
See `+format/buffer' for the interactive version of this function, and
`+format-buffer-h' to use as a `before-save-hook' hook."
(if (not formatter)
'no-formatter
(let ((f-function (gethash formatter format-all--format-table))
(executable (format-all--formatter-executable formatter))
(indent 0))
(pcase-let
((`(,output ,errput ,first-diff)
;; Since `format-all' functions (and various formatting functions,
;; like `gofmt') widen the buffer, in order to only format a region of
;; text, we must make a copy of the buffer to apply formatting to.
(let ((output (buffer-substring-no-properties (point-min) (point-max)))
(origin-buffer-file-name (buffer-file-name (buffer-base-buffer)))
(origin-default-directory default-directory))
(with-temp-buffer
(with-silent-modifications
(insert output)
;; Ensure this temp buffer _seems_ as much like the origin
;; buffer as possible.
(setq default-directory origin-default-directory
buffer-file-name origin-buffer-file-name)
;; Since we're piping a region of text to the formatter, remove
;; any leading indentation to make it look like a file.
(when preserve-indent-p
(setq indent (+format--current-indentation))
(when (> indent 0)
(indent-rigidly (point-min) (point-max) (- indent))))
(funcall f-function executable mode-result))))))
(unwind-protect
(cond ((null output) 'error)
((eq output t) 'noop)
((let ((tmpfile (make-temp-file "doom-format"))
(patchbuf (get-buffer-create " *doom format patch*"))
(coding-system-for-read coding-system-for-read)
(coding-system-for-write coding-system-for-write))
(unless IS-WINDOWS
(setq coding-system-for-read 'utf-8
coding-system-for-write 'utf-8))
(unwind-protect
(progn
(with-current-buffer patchbuf
(erase-buffer))
(with-temp-file tmpfile
(erase-buffer)
(insert output)
(when (> indent 0)
;; restore indentation without affecting new
;; indentation
(indent-rigidly (point-min) (point-max)
(max 0 (- indent (+format--current-indentation))))))
(if (zerop (call-process-region (point-min) (point-max) "diff" nil patchbuf nil "-n" "-" tmpfile))
'noop
(+format--apply-rcs-patch patchbuf)
(list output errput first-diff)))
(kill-buffer patchbuf)
(delete-file tmpfile)))))
(unless (= 0 (length errput))
(message "Formatter error output:\n%s" errput)))))))
(let ((f-function (gethash formatter format-all--format-table))
(executable (format-all--formatter-executable formatter))
(indent 0)
(old-line-number (line-number-at-pos))
(old-column (current-column)))
(pcase-let*
((`(,output ,errput)
;; To reliably format regions, rather than the whole buffer, and
;; `format-all' (and various formatting functions, like `gofmt') widen
;; the buffer, we must copy the region first.
(let ((output (buffer-substring-no-properties (point-min) (point-max)))
(origin-buffer (or (buffer-base-buffer) (current-buffer))))
(with-temp-buffer
(with-silent-modifications
(insert output)
;; Ensure this temp buffer seems as much like the origin
;; buffer as possible, in case the formatter is an elisp
;; function, like `gofmt'.
(cl-loop for (var . val)
in (cl-remove-if-not #'listp (buffer-local-variables origin-buffer))
;; Making enable-multibyte-characters buffer-local
;; causes an error.
unless (eq var 'enable-multibyte-characters)
;; Using setq-local would quote var.
do (set (make-local-variable var) val))
;; Since we're piping a region of text to the formatter, remove
;; any leading indentation to make it look like a file.
(setq indent (+format--current-indentation))
(when (> indent 0)
(indent-rigidly (point-min) (point-max) (- indent)))
(funcall f-function executable mode-result)))))
(`,status
(cond ((null output) :error)
((eq output t) :already-formatted)
(t :reformatted))))
(unwind-protect
(when (eq status :reformatted)
(let ((tmpfile (make-temp-file "doom-format"))
(patchbuf (get-buffer-create " *doom format patch*"))
(coding-system-for-read coding-system-for-read)
(coding-system-for-write coding-system-for-write))
(unless IS-WINDOWS
(setq coding-system-for-read 'utf-8
coding-system-for-write 'utf-8))
(unwind-protect
(progn
(with-current-buffer patchbuf
(erase-buffer))
(with-temp-file tmpfile
(erase-buffer)
(insert output)
(when (> indent 0)
;; restore indentation without affecting new
;; indentation
(indent-rigidly (point-min) (point-max)
(max 0 (- indent (+format--current-indentation))))))
(if (zerop (call-process-region (point-min) (point-max) "diff" nil patchbuf nil "-n" "-" tmpfile))
(setq status :already-formatted)
(+format--apply-rcs-patch patchbuf)
(list output errput)))
(kill-buffer patchbuf)
(delete-file tmpfile))))
(format-all--show-or-hide-errors errput)
(goto-char (point-min))
(forward-line (1- old-line-number))
(let ((line-length (- (point-at-eol) (point-at-bol))))
(goto-char (+ (point) (min old-column line-length))))
(run-hook-with-args 'format-all-after-format-functions formatter status)
(message (pcase status
(:error "Formatting error")
(:already-formatted "Already formatted")
(:reformatted (format "Reformatted with %s" formatter))))))))
;;
;; Commands
;;; Commands
;;;###autoload
(defun +format/buffer (&optional arg)
"Format the source code in the current buffer."
(interactive "P")
(let ((+format-with (or (if arg (+format-completing-read)) +format-with)))
(pcase-let ((`(,formatter ,mode-result) (format-all--probe)))
(pcase
(+format-buffer
formatter mode-result
(or +format-preserve-indentation +format-region-p))
(`no-formatter
(when (called-interactively-p 'any)
(message "No formatter specified for %s" major-mode))
nil)
(`error (message "Failed to format buffer due to errors") nil)
(`noop (message "Buffer was already formatted") nil)
(_ (message "Formatted (%s)" formatter) t)))))
(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)))
;;;###autoload
(defun +format/region (beg end &optional arg)
(defun +format/region (beg end)
"Runs the active formatter on the lines within BEG and END.
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")
(save-restriction
(narrow-to-region beg end)
(let ((+format-region-p t))
(+format/buffer arg))))
(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)))))
;;;###autoload
(defun +format/region-or-buffer ()
@@ -219,7 +235,7 @@ snippets or single lines."
is selected)."
(interactive)
(call-interactively
(if (use-region-p)
(if (doom-region-active-p)
#'+format/region
#'+format/buffer)))

View File

@@ -67,7 +67,7 @@
(doom-log "formatter (arglist) %s" args)
(if ,(and (or ok-statuses error-regexp) t)
(apply #'format-all--buffer-hard
',ok-statuses ,error-regexp
',ok-statuses ,error-regexp nil
(reverse args))
(apply #'format-all--buffer-easy (reverse args)))))
@@ -91,7 +91,7 @@
(name formatter &key modes filter ok-statuses error-regexp)
"Define (or modify) a formatter named NAME.
Supported keywords: :modes :install :filter :ok-statuses :error-regexp
Supported keywords: :modes :filter :ok-statuses :error-regexp
NAME is a symbol that identifies this formatter.

View File

@@ -23,6 +23,12 @@ Indentation is always preserved when formatting regions.")
(defvar-local +format-with nil
"Set this to explicitly use a certain formatter for the current buffer.")
(defvar +format-with-lsp t
"If non-nil, format with LSP formatter if it's available.
This can be set buffer-locally with `setq-hook!' to disable LSP formatting in
select buffers.")
;;
;;; Bootstrap
@@ -55,4 +61,4 @@ This is controlled by `+format-on-save-enabled-modes'."
;; 1. Enables partial reformatting (while preserving leading indentation),
;; 2. Applies changes via RCS patch, line by line, to protect buffer markers
;; and avoid any jarring cursor+window scrolling.
(advice-add #'format-all-buffer :override #'+format/buffer)
(advice-add #'format-all-buffer--with :around #'+format-buffer-a)

View File

@@ -1,4 +1,4 @@
;; -*- no-byte-compile: t; -*-
;;; editor/format/packages.el
(package! format-all)
(package! format-all :pin "47d862d40a")

View File

@@ -3,26 +3,5 @@
(use-package! god-mode
:hook (doom-after-init-modules . god-mode-all)
:config
(pushnew! god-exempt-major-modes
'Custom-mode
'Info-mode
'ag-mode
'calculator-mode
'calendar-mode
'cider-test-report-mode
'compilation-mode
'debugger-mode
'edebug-mode
'ediff-mode
'eww-mode
'geben-breakpoint-list-mode
'ibuffer-mode
'org-agenda-mode
'pdf-outline-buffer-mode
'recentf-dialog-mode
'sldb-mode
'sly-db-mode
'wdired-mode)
(add-hook 'post-command-hook #'+god--configure-cursor-and-modeline-h)
(add-hook 'overwrite-mode-hook #'+god--toggle-on-overwrite-h))

View File

@@ -1,4 +1,4 @@
;; -*- no-byte-compile: t; -*-
;;; editor/god/packages.el
(package! god-mode)
(package! god-mode :pin "1eb6ef3a4f67a805c5d6deb1e3895b6c853707d7")

View File

@@ -1,5 +1,15 @@
#+TITLE: :editor lispy
#+TITLE: editor/lispy
#+DATE: October 27, 2018
#+SINCE: v2.0
#+STARTUP: inlineimages
* Table of Contents :TOC_3:noexport:
- [[#description][Description]]
- [[#prerequisites][Prerequisites]]
- [[#troubleshooting][Troubleshooting]]
- [[#mouse-wheel-and-wrapadditional-wrap-key-themes-in-tty-emacs-2573][Mouse wheel and =wrap=/=additional-wrap= key themes in TTY Emacs (#2573)]]
* Description
This module adds [[https://github.com/noctuid/lispyville][lispy]] key functionality in Lisp languages.
This includes:
@@ -18,19 +28,25 @@ lispy is active
The default key themes that are set are as follows:
#+BEGIN_SRC emacs-lisp
(lispyville-set-key-theme
'((operators normal)
c-w
(prettify insert)
(atom-movement normal visual)
slurp/barf-lispy
(wrap normal insert)
additional
additional-insert
(additional-wrap normal insert)
(escape insert)))
'((operators normal)
c-w
(prettify insert)
(atom-movement normal visual)
slurp/barf-lispy
additional
additional-insert)
#+END_SRC
See noctuid's [[https://github.com/noctuid/lispyville/blob/master/README.org][README]] for more info on specific keybindings (starting [[https://github.com/noctuid/lispyville#operators-key-theme][here]]) of
each key theme. Think of ~lispyville-set-key-theme~ as adding
~parinfer-extensions~ via ~(setq parinfer-extensions '(blah blah blah))~.
To change the key themes set ~lispyville-key-theme~. Think of
~lispyville-key-theme~ as the equivalent of ~parinfer-extensions~. See
lispyville's [[https://github.com/noctuid/lispyville/blob/master/README.org][README]] for more info on the specific keybindings of each key theme
(starting [[https://github.com/noctuid/lispyville#operators-key-theme][here]]).
* Prerequisites
This module has no prerequisites.
* Troubleshooting
** Mouse wheel and =wrap=/=additional-wrap= key themes in TTY Emacs ([[https://github.com/hlissner/doom-emacs/issues/2573][#2573]])
lispyville binds =M-[= to ~lispyville-wrap-brackets~ when the =wrap= or
=additional-wrap= key theme are enabled. In terminal Emacs, this is the key
Emacs receives when you scroll with your mouse wheel.

View File

@@ -1,29 +1,30 @@
;;; editor/lispy/config.el -*- lexical-binding: t; -*-
(use-package! lispy
:hook ((common-lisp-mode . lispy-mode)
:hook ((lisp-mode . lispy-mode)
(emacs-lisp-mode . lispy-mode)
(scheme-mode . lispy-mode)
(racket-mode . lispy-mode)
(hy-mode . lispy-mode)
(lfe-mode . lispy-mode)
(dune-mode . lispy-mode)
(clojure-mode . lispy-mode))
:config
(setq lispy-close-quotes-at-end-p t)
(add-hook 'lispy-mode-hook #'turn-off-smartparens-mode))
(use-package! lispyville
:when (featurep! :editor evil)
:hook (lispy-mode . lispyville-mode)
:init
(setq lispyville-key-theme
'((operators normal)
c-w
(prettify insert)
(atom-movement normal visual)
slurp/barf-lispy
additional
additional-insert))
:config
(lispyville-set-key-theme
'((operators normal)
c-w
(prettify insert)
(atom-movement normal visual)
slurp/barf-lispy
(wrap normal insert)
additional
additional-insert
(additional-wrap normal insert)
(escape insert))))
(lispyville-set-key-theme))

View File

@@ -1,7 +1,6 @@
;; -*- no-byte-compile: t; -*-
;;; editor/lispyville/packages.el
(package! lispy)
(package! lispy :pin "cdaa9c70ca39a880163cbbce924bb46cc56b9fa4")
(when (featurep! :editor evil)
(package! lispyville))
(package! lispyville :pin "25a70126ea807653e0a8c512d4128c90ed673d7a"))

View File

@@ -13,8 +13,8 @@
(message "evil-mc paused")
(message "evil-mc resumed")))
;;;###autoload (autoload '+multiple-cursors/evil-mc-make-cursor-here "editor/multiple-cursors/autoload/evil-mc" nil t)
(evil-define-command +multiple-cursors/evil-mc-make-cursor-here ()
;;;###autoload (autoload '+multiple-cursors/evil-mc-toggle-cursor-here "editor/multiple-cursors/autoload/evil-mc" nil t)
(evil-define-command +multiple-cursors/evil-mc-toggle-cursor-here ()
"Create a cursor at point. If in visual block or line mode, then create
cursors on each line of the selection, on the column of the cursor. Otherwise
pauses cursors."
@@ -22,7 +22,18 @@ pauses cursors."
:keep-visual nil
:evil-mc t
(interactive)
(cond ((memq evil-this-type '(block line))
(cond ((and (evil-mc-has-cursors-p)
(evil-normal-state-p)
(let* ((pos (point))
(cursor (cl-find-if (lambda (cursor)
(eq pos (evil-mc-get-cursor-start cursor)))
evil-mc-cursor-list)))
(when cursor
(evil-mc-delete-cursor cursor)
(setq evil-mc-cursor-list (delq cursor evil-mc-cursor-list))
t))))
((memq evil-this-type '(block line))
(let ((col (evil-column))
(line-at-pt (line-number-at-pos)))
;; Fix off-by-one error
@@ -51,39 +62,61 @@ pauses cursors."
(evil-define-command +multiple-cursors:evil-mc (beg end type pattern &optional flags bang)
"Create mc cursors at each match of PATTERN within BEG and END.
This leaves the cursor at the final match. If BANG, then treat PATTERN as
literal. PATTERN is a delimited regexp (the same that :g or :s uses)."
:move-point nil
This leaves the cursor where the final cursor would be. If BANG, then treat
PATTERN as literal. PATTERN is a delimited regexp (the same that :g or :s uses).
FLAGS can be g and/or i; which mean the same thing they do in
`evil-ex-substitute'."
:evil-mc t
:keep-visual t
(interactive "<R><//!><!>")
(unless (and (stringp pattern)
(not (string-empty-p pattern)))
(user-error "A regexp pattern is required"))
(require 'evil-mc)
(setq evil-mc-pattern
(cons (evil-ex-make-search-pattern
(if bang (regexp-quote pattern) pattern))
(list beg end type)))
(evil-with-restriction beg end
(let ((point (point)))
(save-excursion
(goto-char (point-min))
(while (eq (evil-ex-find-next (evil-mc-get-pattern) 'forward t) t)
(goto-char (1- (point)))
(when (/= point (point))
(evil-mc-run-cursors-before)
(evil-mc-make-cursor-at-pos (point)))
(goto-char
(if (memq ?g flags)
(line-beginning-position 2)
(1+ (point))))))))
(evil-exit-visual-state)
(evil-mc-goto-cursor
(if (= (evil-visual-direction) 1)
(evil-mc-find-last-cursor)
(evil-mc-find-first-cursor))
nil)
(evil-mc-undo-cursor-at-pos (point))
(if (evil-mc-has-cursors-p)
(evil-mc-print-cursors-info "Created")
(evil-mc-message "No cursors were created")))
(let ((m (evil-ex-make-pattern
(if bang (regexp-quote pattern) pattern)
(cond ((memq ?i flags) 'insensitive)
((memq ?I flags) 'sensitive)
((not +multiple-cursors-evil-mc-ex-case)
evil-ex-search-case)
(t +multiple-cursors-evil-mc-ex-case))
(or (and +multiple-cursors-evil-mc-ex-global
(not (memq ?g flags)))
(and (not +multiple-cursors-evil-mc-ex-global)
(memq ?g flags))))))
(evil-mc-run-cursors-before)
(setq evil-mc-pattern (cons m (list beg end type)))
(evil-with-restriction beg end
(goto-char beg)
(while (eq (evil-ex-find-next m 'forward t) t)
(evil-mc-make-cursor-at-pos (1- (point)))
(unless (evil-ex-pattern-whole-line m)
(goto-char (line-beginning-position 2)))))
(evil-mc-goto-cursor
(if (= (evil-visual-direction) 1)
(evil-mc-find-last-cursor)
(evil-mc-find-first-cursor))
nil)
(evil-mc-undo-cursor-at-pos (1- (point)))
(if (evil-mc-has-cursors-p)
(evil-mc-print-cursors-info "Created")
(evil-mc-message "No cursors were created"))))
;;;###autoload (autoload '+multiple-cursors/evil-mc-undo-cursor "editor/multiple-cursors/autoload/evil-mc" nil t)
(evil-define-command +multiple-cursors/evil-mc-undo-cursor ()
"Undos last cursor, or all cursors in visual region."
:repeat nil
:evil-mc t
(interactive)
(if (evil-visual-state-p)
(or (mapc (lambda (c)
(evil-mc-delete-cursor c)
(setq evil-mc-cursor-list (delq c evil-mc-cursor-list)))
(cl-remove-if-not
(lambda (pos)
(and (>= pos evil-visual-beginning)
(< pos evil-visual-end)))
evil-mc-cursor-list
:key #'evil-mc-get-cursor-start))
(message "No cursors to undo in region"))
(evil-mc-undo-last-added-cursor)))

View File

@@ -1,5 +1,15 @@
;;; editor/multiple-cursors/config.el -*- lexical-binding: t; -*-
(defvar +multiple-cursors-evil-mc-ex-global t
"TODO")
(defvar +multiple-cursors-evil-mc-ex-case nil
"TODO")
;;
;;; Packages
(use-package! evil-multiedit
:when (featurep! :editor evil)
:defer t
@@ -57,7 +67,7 @@
(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)
(doom/backward-kill-to-bol-and-indent . evil-mc-execute-default-call)
(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
@@ -72,12 +82,32 @@
:test #'eq
:key #'car))
;; HACK Allow these commands to be repeated by prefixing them with a numerical
;; argument. See gabesoft/evil-mc#110
(defadvice! +multiple-cursors--make-repeatable-a (orig-fn)
:around '(evil-mc-make-and-goto-first-cursor
evil-mc-make-and-goto-last-cursor
evil-mc-make-and-goto-prev-cursor
evil-mc-make-and-goto-next-cursor
evil-mc-skip-and-goto-prev-cursor
evil-mc-skip-and-goto-next-cursor
evil-mc-make-and-goto-prev-match
evil-mc-make-and-goto-next-match
evil-mc-skip-and-goto-prev-match
evil-mc-skip-and-goto-next-match)
(dotimes (i (if (integerp current-prefix-arg) current-prefix-arg 1))
(funcall orig-fn)))
;; If we're entering insert mode, it's a good bet that we want to start using
;; 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))
(add-hook! 'doom-escape-hook
(defun +multiple-cursors-escape-multiple-cursors-h ()

View File

@@ -1,9 +1,9 @@
;; -*- no-byte-compile: t; -*-
;;; editor/multiple-cursors/packages.el
(cond ((featurep! :editor evil)
(package! evil-multiedit)
(package! evil-mc))
((package! multiple-cursors)))
(cond
((featurep! :editor evil)
(package! evil-multiedit :pin "9f271e0e6048297692f80ed6c5ae8994ac523abc")
(package! evil-mc :pin "4d4c0172e4c7f80acc1d0e73d5fb3e536929b262"))
((package! multiple-cursors :pin "b880554d04b8f61165afba7d4de19ac9e39bb7ab")))

View File

@@ -4,9 +4,7 @@
:after-call pre-command-hook
:config
;; Prevent undo actions from exiting edit state
(add-to-list 'objed-keeper-commands 'undo-tree-undo)
(add-to-list 'objed-keeper-commands 'undo-tree-redo)
(add-to-list 'objed-keeper-commands 'undo-tree-visualize)
(pushnew! objed-keeper-commands 'undo-fu-only-undo 'undo-fu-only-redo)
(defvar +objed--extra-face-remaps nil)

View File

@@ -1,4 +1,4 @@
;; -*- no-byte-compile: t; -*-
;;; editor/objed/packages.el
(package! objed)
(package! objed :pin "e89d8dae3b2d4331a4455d2a7b203500537d184d")

View File

@@ -1,7 +1,12 @@
;;; editor/parinfer/config.el -*- lexical-binding: t; -*-
(use-package! parinfer
:hook ((emacs-lisp-mode clojure-mode scheme-mode lisp-mode) . parinfer-mode)
:hook ((emacs-lisp-mode
clojure-mode
scheme-mode
lisp-mode
racket-mode
hy-mode) . parinfer-mode)
:init
(setq parinfer-extensions
'(defaults

View File

@@ -11,4 +11,4 @@
;; separate session:
(autoload 'evil-define-key "evil-core" nil nil 'macro))
(package! parinfer)
(package! parinfer :pin "eaad857ae4351f72a561ee3dec8943713510003f")

View File

@@ -1,4 +1,6 @@
;; -*- no-byte-compile: t; -*-
;;; editor/rotate-text/packages.el
(package! rotate-text :recipe (:host github :repo "debug-ito/rotate-text.el"))
(package! rotate-text
:recipe (:host github :repo "debug-ito/rotate-text.el")
:pin "48f193697db996855aee1ad2bc99b38c6646fe76")

View File

@@ -288,16 +288,27 @@ shadow the default snippet)."
;;;###autoload
(defun +snippets-expand-on-region-a (orig-fn &optional no-condition)
"Fix off-by-one issue with expanding snippets on an evil visual region, and
switches to insert mode.
"Fix off-by-one when expanding snippets on an evil visual region.
If evil-local-mode isn't enabled, run ORIG-FN as is."
Also strips whitespace out of selection. Also switches to insert mode. If
`evil-local-mode' isn't enabled, or we're not in visual mode, run ORIG-FN as
is."
(if (not (and (bound-and-true-p evil-local-mode)
(evil-visual-state-p)))
(funcall orig-fn no-condition)
(evil-visual-select evil-visual-beginning evil-visual-end 'inclusive)
(cl-letf (((symbol-function 'region-beginning) (lambda () evil-visual-beginning))
((symbol-function 'region-end) (lambda () evil-visual-end)))
;; Trim whitespace in selected region, so as not to introduce extra
;; whitespace into `yas-selected-text'.
(evil-visual-select (save-excursion
(goto-char evil-visual-beginning)
(skip-chars-forward " \t")
(point))
(save-excursion
(goto-char evil-visual-end)
(skip-chars-backward " \t")
(point))
'inclusive)
(letf! ((defun region-beginning () evil-visual-beginning)
(defun region-end () evil-visual-end))
(funcall orig-fn no-condition)))
(when (and (bound-and-true-p evil-local-mode)
(yas-active-snippets))

View File

@@ -5,9 +5,10 @@
;;
;; Packages
;;; Packages
(use-package! yasnippet
:defer-incrementally eldoc easymenu help-mode
:commands (yas-minor-mode-on
yas-expand
yas-expand-snippet
@@ -19,9 +20,11 @@
;; Remove default ~/.emacs.d/snippets
(defvar yas-snippet-dirs nil)
;; Ensure `yas-reload-all' is called as late as possible. Other modules could
;; have additional configuration for yasnippet. For example, file-templates.
(add-transient-hook! 'yas-minor-mode-hook (yas-reload-all))
(unless (daemonp)
;; Ensure `yas-reload-all' is called as late as possible. Other modules
;; could have additional configuration for yasnippet. For example,
;; file-templates.
(add-transient-hook! 'yas-minor-mode-hook (yas-reload-all)))
(add-hook! '(text-mode-hook
prog-mode-hook
@@ -30,24 +33,26 @@
#'yas-minor-mode-on)
:config
(setq yas-verbosity (if doom-debug-mode 3 0)
yas-also-auto-indent-first-line t)
(add-to-list 'load-path +snippets-dir)
;; default snippets library, if available
(require 'doom-snippets nil t)
;; Allow private snippets in DOOMDIR/snippets
(add-to-list 'yas-snippet-dirs '+snippets-dir)
;; In case `+snippets-dir' and `doom-snippets-dir' are the same
;; Reduce verbosity. 3 is too chatty about initializing yasnippet. 2 is just
;; right (only shows errors).
(setq yas-verbosity (if doom-debug-p 3 0))
;; default snippets library, if available
(add-to-list 'load-path +snippets-dir)
(require 'doom-snippets nil t)
;; HACK In case `+snippets-dir' and `doom-snippets-dir' are the same, or
;; duplicates exist in `yas-snippet-dirs'.
(advice-add #'yas-snippet-dirs :filter-return #'delete-dups)
;; Remove GUI dropdown prompt (prefer ivy/helm)
(delq! 'yas-dropdown-prompt yas-prompt-functions)
;; Prioritize private snippets in `+snippets-dir' over built-in ones if there
;; are multiple choices.
(add-to-list 'yas-prompt-functions #'+snippets-prompt-private nil #'eq)
(add-to-list 'yas-prompt-functions #'+snippets-prompt-private)
;; Register `def-project-mode!' modes with yasnippet. This enables project
;; specific snippet libraries (e.g. for Laravel, React or Jekyll projects).
@@ -60,22 +65,14 @@
;; tell smartparens overlays not to interfere with yasnippet keybinds
(advice-add #'yas-expand :before #'sp-remove-active-pair-overlay))
;; Enable `read-only-mode' for built-in snippets (in `doom-local-dir')
(add-hook 'snippet-mode-hook #'+snippets-read-only-maybe-h)
;; (Evil only) fix off-by-one issue with line-wise visual selections in
;; `yas-insert-snippet', and switches to insert mode afterwards.
(advice-add #'yas-insert-snippet :around #'+snippets-expand-on-region-a)
(define-key! snippet-mode-map
"C-c C-k" #'+snippet--abort
"C-c C-e" #'+snippet--edit)
;; Show keybind hints in snippet header-line
(add-hook 'snippet-mode-hook #'+snippets-show-hints-in-header-line-h)
;; Replace commands with superior alternatives
(define-key! yas-minor-mode-map
[remap yas-new-snippet] #'+snippets/new
[remap yas-visit-snippet-file] #'+snippets/edit)
;; Enable `read-only-mode' for built-in snippets (in `doom-local-dir')
(add-hook 'snippet-mode-hook #'+snippets-read-only-maybe-h)
(map! :map yas-keymap
"C-e" #'+snippets/goto-end-of-field
@@ -84,7 +81,20 @@
[M-left] #'+snippets/goto-start-of-field
[M-backspace] #'+snippets/delete-to-start-of-field
[backspace] #'+snippets/delete-backward-char
[delete] #'+snippets/delete-forward-char-or-field))
[delete] #'+snippets/delete-forward-char-or-field
;; Replace commands with superior alternatives
:map yas-minor-mode-map
[remap yas-new-snippet] #'+snippets/new
[remap yas-visit-snippet-file] #'+snippets/edit)
;; REVIEW Fix #2639: For some reason `yas--all-templates' returns duplicates
;; of some templates. Until I figure out the real cause this fixes it.
(defadvice! +snippets--remove-duplicates-a (templates)
:filter-return #'yas--all-templates
(cl-delete-duplicates templates :test #'equal))
;; If in a daemon session, front-load this expensive work:
(if (daemonp) (yas-reload-all)))
(use-package! auto-yasnippet
@@ -96,6 +106,6 @@
us who use yas-minor-mode and enable yasnippet more selectively. This advice
swaps `yas-global-mode' with `yas-minor-mode'."
:around '(aya-expand aya-open-line)
(cl-letf (((symbol-function #'yas-global-mode) #'yas-minor-mode)
(yas-global-mode yas-minor-mode))
(letf! ((#'yas-global-mode #'yas-minor-mode)
(yas-global-mode yas-minor-mode))
(apply orig-fn args))))

View File

@@ -1,10 +1,10 @@
;; -*- no-byte-compile: t; -*-
;;; editor/snippets/packages.el
(package! yasnippet)
(package! auto-yasnippet)
(package! yasnippet :pin "5b1217ab085fab4abeb1118dccb260691b446703")
(package! auto-yasnippet :pin "db9e0dd4335b2202cd5dac95bbbc87a1032d9bbe")
(package! doom-snippets
:recipe (:host github
:repo "hlissner/doom-snippets"
:files ("*.el" "*")))
:files ("*.el" "*"))
:pin "422f683adfbec1b01fe00524690b64dc9e702ae0")

View File

@@ -24,3 +24,7 @@ Otherwise no extra indentation will be used.")
'(text-mode markdown-mode markdown-view-mode gfm-mode gfm-view-mode rst-mode
latex-mode LaTeX-mode)
"Major-modes where `+word-wrap-mode' should not provide extra indentation.")
(when (memq 'visual-line-mode text-mode-hook)
(remove-hook 'text-mode-hook #'visual-line-mode)
(add-hook 'text-mode-hook #'+word-wrap-mode))

View File

@@ -1,4 +1,4 @@
;; -*- no-byte-compile: t; -*-
;;; editor/word-wrap/packages.el
(package! adaptive-wrap)
(package! adaptive-wrap :pin "1810c0ee8d827dd502ddeaae5bd759d4811fcbce")