Merge branch 'develop' into dired
This commit is contained in:
commit
3c4252ffe7
295 changed files with 8141 additions and 6654 deletions
|
@ -10,7 +10,6 @@
|
|||
- [[#lang][:lang]]
|
||||
- [[#email][:email]]
|
||||
- [[#app][:app]]
|
||||
- [[#collab][:collab]]
|
||||
- [[#config][:config]]
|
||||
|
||||
* :completion
|
||||
|
@ -38,7 +37,7 @@ Aesthetic modules that affect the Emacs interface or user experience.
|
|||
+ [[file:ui/ophints/README.org][ophints]]:
|
||||
+ [[file:ui/popup/README.org][popup]] =+all +defaults=: Makes temporary/disposable windows less intrusive
|
||||
+ pretty-code:
|
||||
+ [[file:ui/tabbar/README.org][tabbar]]:
|
||||
+ [[file:ui/tabs/README.org][tabs]]:
|
||||
+ treemacs:
|
||||
+ [[file:ui/unicode/README.org][unicode]]:
|
||||
+ vc-gutter:
|
||||
|
@ -58,6 +57,7 @@ Modules that affect and augment your ability to manipulate or insert text.
|
|||
+ [[file:editor/parinfer/README.org][parinfer]]:
|
||||
+ rotate-text:
|
||||
+ [[file:editor/snippets/README.org][snippets]]: Snippet expansion for lazy typists
|
||||
+ [[file:editor/word-wrap/README.org][word-wrap]]: soft wrapping with language-aware indent
|
||||
|
||||
* :emacs
|
||||
Modules that reconfigure or augment packages or features built into Emacs.
|
||||
|
@ -80,6 +80,7 @@ Small modules that give Emacs access to external tools & services.
|
|||
+ ansible:
|
||||
+ debugger: A (nigh-)universal debugger in Emacs
|
||||
+ [[file:tools/docker/README.org][docker]]:
|
||||
+ [[file:tools/direnv/README.org][direnv]]:
|
||||
+ [[file:tools/editorconfig/README.org][editorconfig]]:
|
||||
+ [[file:tools/ein/README.org][ein]]:
|
||||
+ [[file:tools/eval/README.org][eval]]: REPL & code evaluation support for a variety of languages
|
||||
|
@ -141,7 +142,7 @@ Modules that bring support for a language or group of languages to Emacs.
|
|||
+ qt:
|
||||
+ racket:
|
||||
+ [[file:lang/rest/README.org][rest]]:
|
||||
+ ruby =+lsp=:
|
||||
+ ruby =+lsp +rvm +rbenv=:
|
||||
+ [[file:lang/rust/README.org][rust]] =+lsp=:
|
||||
+ scala:
|
||||
+ [[file:lang/sh/README.org][sh]] =+fish +lsp=:
|
||||
|
@ -166,12 +167,6 @@ Doom-specific porcelains.
|
|||
+ twitter:
|
||||
+ [[file:app/write/README.org][write]] =+wordnut +langtool=:
|
||||
|
||||
* :collab
|
||||
Modules that enable collaborative programming over the internet.
|
||||
|
||||
+ floobits:
|
||||
+ impatient-mode:
|
||||
|
||||
* :config
|
||||
Modules that configure Emacs one way or another, or focus on making it easier
|
||||
for you to customize it yourself.
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +calendar*cfw:render-button (title command &optional state)
|
||||
(defun +calendar-cfw:render-button-a (title command &optional state)
|
||||
"render-button
|
||||
TITLE
|
||||
COMMAND
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
;;
|
||||
;; Packages
|
||||
|
||||
(def-package! calfw
|
||||
:commands (cfw:open-calendar-buffer)
|
||||
(use-package! calfw
|
||||
:commands cfw:open-calendar-buffer
|
||||
:config
|
||||
;; better frame for calendar
|
||||
(setq cfw:face-item-separator-color nil
|
||||
|
@ -24,20 +24,20 @@
|
|||
|
||||
(define-key cfw:calendar-mode-map "q" #'+calendar/quit)
|
||||
|
||||
(add-hook 'cfw:calendar-mode-hook #'doom|mark-buffer-as-real)
|
||||
(add-hook 'cfw:calendar-mode-hook #'doom-mark-buffer-as-real-h)
|
||||
(add-hook 'cfw:calendar-mode-hook 'hide-mode-line-mode)
|
||||
|
||||
(advice-add #'cfw:render-button :override #'+calendar*cfw:render-button))
|
||||
(advice-add #'cfw:render-button :override #'+calendar-cfw:render-button-a))
|
||||
|
||||
|
||||
(def-package! calfw-org
|
||||
(use-package! calfw-org
|
||||
:commands (cfw:open-org-calendar
|
||||
cfw:org-create-source
|
||||
cfw:open-org-calendar-withkevin
|
||||
my-open-calendar))
|
||||
|
||||
|
||||
(def-package! org-gcal
|
||||
(use-package! org-gcal
|
||||
:commands (org-gcal-sync
|
||||
org-gcal-fetch
|
||||
org-gcal-post-at-point
|
||||
|
@ -48,4 +48,4 @@
|
|||
(message "org-gcal::%s - %s" title mes)))
|
||||
|
||||
|
||||
;; (def-package! alert)
|
||||
;; (use-package! alert)
|
||||
|
|
|
@ -97,3 +97,27 @@ argument) is non-nil only show channels in current server."
|
|||
(interactive)
|
||||
(when (derived-mode-p 'circe-mode)
|
||||
(tracking-next-buffer)))
|
||||
|
||||
|
||||
;;
|
||||
;;; Hooks/fns
|
||||
|
||||
;;;###autoload
|
||||
(defun +circe-buffer-p (buf)
|
||||
"Return non-nil if BUF is a `circe-mode' buffer."
|
||||
(with-current-buffer buf
|
||||
(and (derived-mode-p 'circe-mode)
|
||||
(eq (safe-persp-name (get-current-persp))
|
||||
+irc--workspace-name))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +irc--add-circe-buffer-to-persp-h ()
|
||||
(when (bound-and-true-p persp-mode)
|
||||
(let ((persp (get-current-persp))
|
||||
(buf (current-buffer)))
|
||||
;; Add a new circe buffer to irc workspace when we're in another workspace
|
||||
(unless (eq (safe-persp-name persp) +irc--workspace-name)
|
||||
;; Add new circe buffers to the persp containing circe buffers
|
||||
(persp-add-buffer buf (persp-get-by-name +irc--workspace-name))
|
||||
;; Remove new buffer from accidental workspace
|
||||
(persp-remove-buffer buf persp)))))
|
||||
|
|
|
@ -46,8 +46,8 @@ playback.")
|
|||
;;
|
||||
;; Packages
|
||||
|
||||
(def-package! circe
|
||||
:commands (circe circe-server-buffers)
|
||||
(use-package! circe
|
||||
:commands circe circe-server-buffers
|
||||
:init (setq circe-network-defaults nil)
|
||||
:config
|
||||
(setq circe-default-quit-message nil
|
||||
|
@ -90,48 +90,32 @@ playback.")
|
|||
circe-format-server-lurker-activity
|
||||
(+irc--pad "Lurk" "{nick} joined {joindelta} ago"))
|
||||
|
||||
(add-hook 'circe-channel-mode-hook #'turn-on-visual-line-mode)
|
||||
|
||||
(defun +irc*circe-disconnect-hook (&rest _)
|
||||
(run-hooks '+irc-disconnect-hook))
|
||||
(advice-add 'circe--irc-conn-disconnected :after #'+irc*circe-disconnect-hook)
|
||||
|
||||
(defun +irc*circe-truncate-nicks ()
|
||||
"Truncate long nicknames in chat output non-destructively."
|
||||
(when-let (beg (text-property-any (point-min) (point-max) 'lui-format-argument 'nick))
|
||||
(goto-char beg)
|
||||
(let ((end (next-single-property-change beg 'lui-format-argument))
|
||||
(nick (plist-get (plist-get (text-properties-at beg) 'lui-keywords)
|
||||
:nick)))
|
||||
(when (> (length nick) +irc-left-padding)
|
||||
(compose-region (+ beg +irc-left-padding -1) end
|
||||
+irc-truncate-nick-char)))))
|
||||
(add-hook 'lui-pre-output-hook #'+irc*circe-truncate-nicks)
|
||||
|
||||
(defun +circe-buffer-p (buf)
|
||||
"Return non-nil if BUF is a `circe-mode' buffer."
|
||||
(with-current-buffer buf
|
||||
(and (derived-mode-p 'circe-mode)
|
||||
(eq (safe-persp-name (get-current-persp))
|
||||
+irc--workspace-name))))
|
||||
(add-hook 'doom-real-buffer-functions #'+circe-buffer-p)
|
||||
(add-hook 'circe-channel-mode-hook #'turn-on-visual-line-mode)
|
||||
(add-hook 'circe-mode-hook #'+irc--add-circe-buffer-to-persp-h)
|
||||
|
||||
(defun +irc|circe-message-option-bot (nick &rest ignored)
|
||||
"Fontify known bots and mark them to not be tracked."
|
||||
(when (member nick +irc-bot-list)
|
||||
'((text-properties . (face circe-fool-face lui-do-not-track t)))))
|
||||
(add-hook 'circe-message-option-functions #'+irc|circe-message-option-bot)
|
||||
(defadvice! +irc--circe-run-disconnect-hook-a (&rest _)
|
||||
"Runs `+irc-disconnect-hook' after circe disconnects."
|
||||
:after #'circe--irc-conn-disconnected
|
||||
(run-hooks '+irc-disconnect-hook))
|
||||
|
||||
(defun +irc|add-circe-buffer-to-persp ()
|
||||
(let ((persp (get-current-persp))
|
||||
(buf (current-buffer)))
|
||||
;; Add a new circe buffer to irc workspace when we're in another workspace
|
||||
(unless (eq (safe-persp-name persp) +irc--workspace-name)
|
||||
;; Add new circe buffers to the persp containing circe buffers
|
||||
(persp-add-buffer buf (persp-get-by-name +irc--workspace-name))
|
||||
;; Remove new buffer from accidental workspace
|
||||
(persp-remove-buffer buf persp))))
|
||||
(add-hook 'circe-mode-hook #'+irc|add-circe-buffer-to-persp)
|
||||
(add-hook! 'lui-pre-output-hook
|
||||
(defun +irc-circe-truncate-nicks-h ()
|
||||
"Truncate long nicknames in chat output non-destructively."
|
||||
(when-let (beg (text-property-any (point-min) (point-max) 'lui-format-argument 'nick))
|
||||
(goto-char beg)
|
||||
(let ((end (next-single-property-change beg 'lui-format-argument))
|
||||
(nick (plist-get (plist-get (text-properties-at beg) 'lui-keywords)
|
||||
:nick)))
|
||||
(when (> (length nick) +irc-left-padding)
|
||||
(compose-region (+ beg +irc-left-padding -1) end
|
||||
+irc-truncate-nick-char))))))
|
||||
|
||||
(add-hook! 'circe-message-option-functions
|
||||
(defun +irc-circe-message-option-bot-h (nick &rest ignored)
|
||||
"Fontify known bots and mark them to not be tracked."
|
||||
(when (member nick +irc-bot-list)
|
||||
'((text-properties . (face circe-fool-face lui-do-not-track t))))))
|
||||
|
||||
;; Let `+irc/quit' and `circe' handle buffer cleanup
|
||||
(define-key circe-mode-map [remap kill-buffer] #'bury-buffer)
|
||||
|
@ -152,14 +136,14 @@ playback.")
|
|||
"n" #'circe-command-NAMES)))
|
||||
|
||||
|
||||
(def-package! circe-color-nicks
|
||||
(use-package! circe-color-nicks
|
||||
:hook (circe-channel-mode . enable-circe-color-nicks)
|
||||
:config
|
||||
(setq circe-color-nicks-min-constrast-ratio 4.5
|
||||
circe-color-nicks-everywhere t))
|
||||
|
||||
|
||||
(def-package! circe-new-day-notifier
|
||||
(use-package! circe-new-day-notifier
|
||||
:after circe
|
||||
:config
|
||||
(enable-circe-new-day-notifier)
|
||||
|
@ -167,7 +151,7 @@ playback.")
|
|||
(+irc--pad "Day" "Date changed [{day}]")))
|
||||
|
||||
|
||||
(def-package! circe-notifications
|
||||
(use-package! circe-notifications
|
||||
:commands enable-circe-notifications
|
||||
:init
|
||||
(if +irc-defer-notifications
|
||||
|
@ -181,10 +165,11 @@ playback.")
|
|||
circe-notifications-emacs-focused nil
|
||||
circe-notifications-alert-style
|
||||
(cond (IS-MAC 'osx-notifier)
|
||||
(IS-LINUX 'libnotify))))
|
||||
(IS-LINUX 'libnotify)
|
||||
(circe-notifications-alert-style))))
|
||||
|
||||
|
||||
(def-package! lui
|
||||
(use-package! lui
|
||||
:commands lui-mode
|
||||
:config
|
||||
(define-key lui-mode-map "\C-u" #'lui-kill-to-beginning-of-line)
|
||||
|
@ -194,20 +179,21 @@ playback.")
|
|||
(setq lui-flyspell-p t))
|
||||
|
||||
(after! evil
|
||||
(defun +irc|evil-insert ()
|
||||
(defun +irc-evil-insert-h ()
|
||||
"Ensure entering insert mode will put us at the prompt, unless editing
|
||||
after prompt marker."
|
||||
(when (> (marker-position lui-input-marker) (point))
|
||||
(goto-char (point-max))))
|
||||
|
||||
(add-hook! 'lui-mode-hook
|
||||
(add-hook 'evil-insert-state-entry-hook #'+irc|evil-insert nil t))
|
||||
(add-hook 'evil-insert-state-entry-hook #'+irc-evil-insert-h
|
||||
nil 'local))
|
||||
|
||||
(mapc (lambda (cmd) (push cmd +irc-scroll-to-bottom-on-commands))
|
||||
'(evil-paste-after evil-paste-before evil-open-above evil-open-below)))
|
||||
|
||||
|
||||
(defun +irc|preinput-scroll-to-bottom ()
|
||||
(defun +irc-preinput-scroll-to-bottom-h ()
|
||||
"Go to the end of the buffer in all windows showing it.
|
||||
Courtesy of esh-mode.el"
|
||||
(when (memq this-command +irc-scroll-to-bottom-on-commands)
|
||||
|
@ -224,28 +210,26 @@ Courtesy of esh-mode.el"
|
|||
nil t)))))
|
||||
|
||||
(add-hook! 'lui-mode-hook
|
||||
(add-hook 'pre-command-hook #'+irc|preinput-scroll-to-bottom nil t))
|
||||
(add-hook 'pre-command-hook #'+irc-preinput-scroll-to-bottom-h nil t))
|
||||
|
||||
;; enable a horizontal line marking the last read message
|
||||
(add-hook! 'lui-mode-hook #'enable-lui-track-bar)
|
||||
(add-hook 'lui-mode-hook #'enable-lui-track-bar)
|
||||
|
||||
(defun +irc|init-lui-margins ()
|
||||
(setq lui-time-stamp-position 'right-margin
|
||||
lui-time-stamp-format +irc-time-stamp-format
|
||||
right-margin-width (length (format-time-string lui-time-stamp-format))))
|
||||
|
||||
(defun +irc|init-lui-wrapping ()
|
||||
(setq fringes-outside-margins t
|
||||
word-wrap t
|
||||
wrap-prefix (make-string (+ +irc-left-padding 3) ? )))
|
||||
|
||||
(add-hook! 'lui-mode-hook #'(+irc|init-lui-margins +irc|init-lui-wrapping)))
|
||||
(add-hook! 'lui-mode-hook
|
||||
(defun +irc-init-lui-margins-h ()
|
||||
(setq lui-time-stamp-position 'right-margin
|
||||
lui-time-stamp-format +irc-time-stamp-format
|
||||
right-margin-width (length (format-time-string lui-time-stamp-format))))
|
||||
(defun +irc-init-lui-wrapping-a ()
|
||||
(setq fringes-outside-margins t
|
||||
word-wrap t
|
||||
wrap-prefix (make-string (+ +irc-left-padding 3) ? )))))
|
||||
|
||||
|
||||
(def-package! lui-logging
|
||||
(use-package! lui-logging
|
||||
:after lui
|
||||
:config (enable-lui-logging))
|
||||
|
||||
|
||||
(def-package! lui-autopaste
|
||||
(use-package! lui-autopaste
|
||||
:hook (circe-channel-mode . enable-lui-autopaste))
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
;; Hooks
|
||||
|
||||
;;;###autoload
|
||||
(defun +rss|elfeed-wrap ()
|
||||
(defun +rss-elfeed-wrap-h ()
|
||||
"Enhances an elfeed entry's readability by wrapping it to a width of
|
||||
`fill-column'."
|
||||
(let ((inhibit-read-only t)
|
||||
|
@ -57,7 +57,7 @@
|
|||
(set-buffer-modified-p nil)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +rss|cleanup ()
|
||||
(defun +rss-cleanup-h ()
|
||||
"Clean up after an elfeed session. Kills all elfeed and elfeed-org files."
|
||||
(interactive)
|
||||
;; `delete-file-projectile-remove-from-cache' slows down `elfeed-db-compact'
|
||||
|
@ -75,7 +75,7 @@
|
|||
(kill-buffer buf)))
|
||||
(dolist (b search-buffers)
|
||||
(with-current-buffer b
|
||||
(remove-hook 'kill-buffer-hook #'+rss|cleanup :local)
|
||||
(remove-hook 'kill-buffer-hook #'+rss-cleanup-h :local)
|
||||
(kill-buffer b)))
|
||||
(mapc #'kill-buffer show-buffers)))
|
||||
|
||||
|
@ -99,7 +99,7 @@
|
|||
collect url)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +rss-put-sliced-image (spec alt &optional flags)
|
||||
(defun +rss-put-sliced-image-fn (spec alt &optional flags)
|
||||
"TODO"
|
||||
(cl-letf (((symbol-function #'insert-image)
|
||||
(lambda (image &optional alt _area _slice)
|
||||
|
@ -108,7 +108,7 @@
|
|||
(shr-put-image spec alt flags)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +rss-render-image-tag-without-underline (dom &optional url)
|
||||
(defun +rss-render-image-tag-without-underline-fn (dom &optional url)
|
||||
"TODO"
|
||||
(let ((start (point)))
|
||||
(shr-tag-img dom url)
|
||||
|
|
|
@ -19,7 +19,7 @@ easier to scroll through.")
|
|||
;;
|
||||
;; Packages
|
||||
|
||||
(def-package! elfeed
|
||||
(use-package! elfeed
|
||||
:commands elfeed
|
||||
:config
|
||||
(setq elfeed-search-filter "@2-week-ago "
|
||||
|
@ -36,21 +36,21 @@ easier to scroll through.")
|
|||
(make-directory elfeed-db-directory t)
|
||||
|
||||
;; Ensure elfeed buffers are treated as real
|
||||
(defun +rss-buffer-p (buf)
|
||||
(string-match-p "^\\*elfeed" (buffer-name buf)))
|
||||
(add-to-list 'doom-real-buffer-functions #'+rss-buffer-p nil #'eq)
|
||||
(add-hook! 'doom-real-buffer-functions
|
||||
(defun +rss-buffer-p (buf)
|
||||
(string-match-p "^\\*elfeed" (buffer-name buf))))
|
||||
|
||||
;; Enhance readability of a post
|
||||
(add-hook 'elfeed-show-mode-hook #'+rss|elfeed-wrap)
|
||||
(add-hook 'elfeed-show-mode-hook #'+rss-elfeed-wrap-h)
|
||||
(add-hook! 'elfeed-search-mode-hook
|
||||
(add-hook 'kill-buffer-hook #'+rss|cleanup nil t))
|
||||
(add-hook 'kill-buffer-hook #'+rss-cleanup-h nil 'local))
|
||||
|
||||
;; Large images are annoying to scroll through, because scrolling follows the
|
||||
;; cursor, so we force shr to insert images in slices.
|
||||
(when +rss-enable-sliced-images
|
||||
(setq-hook! 'elfeed-show-mode-hook
|
||||
shr-put-image-function #'+rss-put-sliced-image
|
||||
shr-external-rendering-functions '((img . +rss-render-image-tag-without-underline))))
|
||||
shr-put-image-function #'+rss-put-sliced-image-fn
|
||||
shr-external-rendering-functions '((img . +rss-render-image-tag-without-underline-fn))))
|
||||
|
||||
;; Keybindings
|
||||
(after! elfeed-show
|
||||
|
@ -64,11 +64,11 @@ easier to scroll through.")
|
|||
(kbd "M-RET") #'elfeed-search-browse-url)))
|
||||
|
||||
|
||||
(def-package! elfeed-org
|
||||
(use-package! elfeed-org
|
||||
:when (featurep! +org)
|
||||
:after elfeed
|
||||
:config
|
||||
(setq rmh-elfeed-org-files
|
||||
(let ((default-directory org-directory))
|
||||
(let ((default-directory org-directory))
|
||||
(setq rmh-elfeed-org-files
|
||||
(mapcar #'expand-file-name +rss-elfeed-files)))
|
||||
(elfeed-org))
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"The name to use for the twitter workspace.")
|
||||
|
||||
;;;###autoload
|
||||
(defun +twitter-display-buffer (buf)
|
||||
(defun +twitter-display-buffer-fn (buf)
|
||||
"A replacement display-buffer command for `twittering-pop-to-buffer-function'
|
||||
that works with the feature/popup module."
|
||||
(let ((win (selected-window)))
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
;;; app/twitter/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(def-package! twittering-mode
|
||||
(use-package! twittering-mode
|
||||
:commands twit
|
||||
:config
|
||||
(setq twittering-private-info-file (expand-file-name "twittering-mode.gpg" doom-etc-dir)
|
||||
(setq twittering-private-info-file
|
||||
(expand-file-name "twittering-mode.gpg" doom-etc-dir)
|
||||
twittering-use-master-password t
|
||||
twittering-request-confirmation-on-posting t
|
||||
;; twittering-icon-mode t
|
||||
|
@ -35,24 +36,16 @@
|
|||
|
||||
(add-hook 'doom-real-buffer-functions #'+twitter-buffer-p)
|
||||
(when (featurep! :ui popup)
|
||||
(setq twittering-pop-to-buffer-function #'+twitter-display-buffer))
|
||||
(setq twittering-pop-to-buffer-function #'+twitter-display-buffer-fn))
|
||||
|
||||
(after! solaire-mode
|
||||
(add-hook 'twittering-mode-hook #'solaire-mode))
|
||||
|
||||
;; Custom header-line for twitter buffers
|
||||
(defun +twitter|switch-mode-and-header-line ()
|
||||
(setq header-line-format mode-line-format
|
||||
mode-line-format nil))
|
||||
(add-hook 'twittering-mode-hook #'+twitter|switch-mode-and-header-line)
|
||||
|
||||
(cond ((featurep! :ui doom-modeline +new)
|
||||
(setq-hook! 'twittering-mode-hook mode-line-format-right nil))
|
||||
((featurep! :ui doom-modeline)
|
||||
(def-modeline! 'twitter
|
||||
'(bar matches " %b " selection-info)
|
||||
'())
|
||||
(add-hook! 'twittering-mode-hook (doom-set-modeline 'twitter))))
|
||||
(add-hook! 'twittering-mode-hook
|
||||
(defun +twitter-switch-mode-and-header-line-h ()
|
||||
(setq header-line-format mode-line-format
|
||||
mode-line-format nil)))
|
||||
|
||||
;; `epa--decode-coding-string' isn't defined in later versions of Emacs 27
|
||||
(unless (fboundp 'epa--decode-coding-string)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
;;
|
||||
;; Packages
|
||||
|
||||
(def-package! langtool
|
||||
(use-package! langtool
|
||||
:when (featurep! +langtool)
|
||||
:commands (langtool-check
|
||||
langtool-check-done
|
||||
|
@ -23,7 +23,7 @@
|
|||
(locate-file "libexec/languagetool-commandline.jar"
|
||||
(doom-files-in "/usr/local/Cellar/languagetool"
|
||||
:type 'dirs
|
||||
:depth 1)))
|
||||
:depth 2)))
|
||||
(IS-LINUX
|
||||
"/usr/share/java/languagetool/languagetool-commandline.jar")))))
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; collab/foobits/packages.el
|
||||
|
||||
(package! floobits)
|
|
@ -1,24 +0,0 @@
|
|||
;;; collab/impatient-mode/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defun +impatient-mode/toggle ()
|
||||
"Toggle `impatient-mode' in the current buffer."
|
||||
(interactive)
|
||||
(unless (process-status "httpd")
|
||||
(httpd-start))
|
||||
(impatient-mode)
|
||||
(if impatient-mode
|
||||
(add-hook 'kill-buffer-hook '+impatient-mode--cleanup-impatient-mode)
|
||||
(+impatient-mode--cleanup-impatient-mode)))
|
||||
|
||||
(defun +impatient-mode--cleanup-impatient-mode ()
|
||||
(unless (cl-loop for buf in (doom-buffer-list)
|
||||
if (buffer-local-value 'impatient-mode buf)
|
||||
return t)
|
||||
(httpd-stop)
|
||||
(cl-loop for buf in (doom-buffer-list)
|
||||
if (buffer-local-value 'impatient-mode buf)
|
||||
do
|
||||
(with-current-buffer buf
|
||||
(impatient-mode -1)))
|
||||
(remove-hook 'kill-buffer-hook '+impatient-mode--cleanup-impatient-mode)))
|
|
@ -1,5 +0,0 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; collab/impatient-mode/packages.el
|
||||
|
||||
(package! htmlize)
|
||||
(package! impatient-mode)
|
|
@ -65,15 +65,15 @@ Examples:
|
|||
;;; Hooks
|
||||
|
||||
;;;###autoload
|
||||
(defun +company|init-backends ()
|
||||
(defun +company-init-backends-h ()
|
||||
"Set `company-backends' for the current buffer."
|
||||
(if (not company-mode)
|
||||
(remove-hook 'change-major-mode-after-body-hook #'+company|init-backends 'local)
|
||||
(remove-hook 'change-major-mode-after-body-hook #'+company-init-backends-h 'local)
|
||||
(unless (eq major-mode 'fundamental-mode)
|
||||
(setq-local company-backends (+company--backends)))
|
||||
(add-hook 'change-major-mode-after-body-hook #'+company|init-backends nil 'local)))
|
||||
(add-hook 'change-major-mode-after-body-hook #'+company-init-backends-h nil 'local)))
|
||||
|
||||
(put '+company|init-backends 'permanent-local-hook t)
|
||||
(put '+company-init-backends-h 'permanent-local-hook t)
|
||||
|
||||
|
||||
;;
|
||||
|
@ -129,12 +129,13 @@ C-x C-l."
|
|||
(`candidates
|
||||
(all-completions
|
||||
arg
|
||||
(split-string
|
||||
(replace-regexp-in-string
|
||||
"^[\t\s]+" ""
|
||||
(concat (buffer-substring-no-properties (point-min) (line-beginning-position))
|
||||
(buffer-substring-no-properties (line-end-position) (point-max))))
|
||||
"\\(\r\n\\|[\n\r]\\)" t)))))
|
||||
(delete-dups
|
||||
(split-string
|
||||
(replace-regexp-in-string
|
||||
"^[\t\s]+" ""
|
||||
(concat (buffer-substring-no-properties (point-min) (line-beginning-position))
|
||||
(buffer-substring-no-properties (line-end-position) (point-max))))
|
||||
"\\(\r\n\\|[\n\r]\\)" t))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +company/dict-or-keywords ()
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
;;; completion/company/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(def-package! company
|
||||
:commands (company-complete-common company-manual-begin company-grab-line)
|
||||
:after-call (evil-insert-state-entry-hook evil-emacs-state-entry-hook)
|
||||
(use-package! company
|
||||
:commands company-complete-common company-manual-begin company-grab-line
|
||||
:after-call evil-insert-state-entry-hook evil-emacs-state-entry-hook
|
||||
:init
|
||||
(setq company-minimum-prefix-length 2
|
||||
company-tooltip-limit 14
|
||||
|
@ -27,16 +27,16 @@
|
|||
;; Allow users to switch between backends on the fly. E.g. C-x C-s followed
|
||||
;; by C-x C-n, will switch from `company-yasnippet' to
|
||||
;; `company-dabbrev-code'.
|
||||
(defun +company*abort-previous (&rest _) (company-abort))
|
||||
(advice-add #'company-begin-backend :before #'+company*abort-previous))
|
||||
(defadvice! +company--abort-previous-a (&rest _)
|
||||
:before #'company-begin-backend
|
||||
(company-abort)))
|
||||
|
||||
(add-hook 'company-mode-hook #'+company|init-backends)
|
||||
(add-hook 'company-mode-hook #'+company-init-backends-h)
|
||||
(global-company-mode +1))
|
||||
|
||||
|
||||
(def-package! company-tng
|
||||
(use-package! company-tng
|
||||
:when (featurep! +tng)
|
||||
:defer 2
|
||||
:after-call post-self-insert-hook
|
||||
:config
|
||||
(add-to-list 'company-frontends 'company-tng-frontend)
|
||||
|
@ -51,7 +51,7 @@
|
|||
;;
|
||||
;; Packages
|
||||
|
||||
(def-package! company-prescient
|
||||
(use-package! company-prescient
|
||||
:hook (company-mode . company-prescient-mode)
|
||||
:config
|
||||
;; NOTE prescient config duplicated with `ivy'
|
||||
|
@ -59,7 +59,7 @@
|
|||
(prescient-persist-mode +1))
|
||||
|
||||
|
||||
(def-package! company-box
|
||||
(use-package! company-box
|
||||
:when (and EMACS26+ (featurep! +childframe))
|
||||
:hook (company-mode . company-box-mode)
|
||||
:config
|
||||
|
@ -68,7 +68,10 @@
|
|||
company-box-max-candidates 50
|
||||
company-box-icons-alist 'company-box-icons-all-the-icons
|
||||
company-box-icons-functions
|
||||
'(+company-box-icons--yasnippet company-box-icons--lsp +company-box-icons--elisp company-box-icons--acphp)
|
||||
'(+company-box-icons--yasnippet-fn
|
||||
company-box-icons--lsp
|
||||
+company-box-icons--elisp-fn
|
||||
company-box-icons--acphp)
|
||||
company-box-icons-all-the-icons
|
||||
`((Unknown . ,(all-the-icons-material "find_in_page" :height 0.8 :face 'all-the-icons-purple))
|
||||
(Text . ,(all-the-icons-material "text_fields" :height 0.8 :face 'all-the-icons-green))
|
||||
|
@ -103,11 +106,11 @@
|
|||
(ElispFeature . ,(all-the-icons-material "stars" :height 0.8 :face 'all-the-icons-orange))
|
||||
(ElispFace . ,(all-the-icons-material "format_paint" :height 0.8 :face 'all-the-icons-pink))))
|
||||
|
||||
(defun +company-box-icons--yasnippet (candidate)
|
||||
(defun +company-box-icons--yasnippet-fn (candidate)
|
||||
(when (get-text-property 0 'yas-annotation candidate)
|
||||
'Yasnippet))
|
||||
|
||||
(defun +company-box-icons--elisp (candidate)
|
||||
(defun +company-box-icons--elisp-fn (candidate)
|
||||
(when (derived-mode-p 'emacs-lisp-mode)
|
||||
(let ((sym (intern candidate)))
|
||||
(cond ((fboundp sym) 'ElispFunction)
|
||||
|
@ -116,14 +119,13 @@
|
|||
((facep sym) 'ElispFace))))))
|
||||
|
||||
|
||||
(def-package! company-dict
|
||||
(use-package! company-dict
|
||||
:defer t
|
||||
:config
|
||||
(setq company-dict-dir (expand-file-name "dicts" doom-private-dir))
|
||||
(defun +company|enable-project-dicts (mode &rest _)
|
||||
"Enable per-project dictionaries."
|
||||
(if (symbol-value mode)
|
||||
(add-to-list 'company-dict-minor-mode-list mode nil #'eq)
|
||||
(setq company-dict-minor-mode-list (delq mode company-dict-minor-mode-list))))
|
||||
(add-hook 'doom-project-hook #'+company|enable-project-dicts))
|
||||
|
||||
(add-hook! 'doom-project-hook
|
||||
(defun +company-enable-project-dicts-h (mode &rest _)
|
||||
"Enable per-project dictionaries."
|
||||
(if (symbol-value mode)
|
||||
(add-to-list 'company-dict-minor-mode-list mode nil #'eq)
|
||||
(setq company-dict-minor-mode-list (delq mode company-dict-minor-mode-list))))))
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
;;; completion/helm/autoload/posframe.el -*- lexical-binding: t; -*-
|
||||
|
||||
(add-hook 'helm-cleanup-hook #'+helm|posframe-cleanup)
|
||||
|
||||
;;;###autoload
|
||||
(defun +helm-poshandler-frame-center-near-bottom (info)
|
||||
(defun +helm-poshandler-frame-center-near-bottom-fn (info)
|
||||
"Display the child frame in the center of the frame, slightly closer to the
|
||||
bottom, which is easier on the eyes on big displays."
|
||||
(let ((parent-frame (plist-get info :parent-frame))
|
||||
|
@ -14,7 +12,7 @@ bottom, which is easier on the eyes on big displays."
|
|||
|
||||
(defvar +helm--posframe-buffer nil)
|
||||
;;;###autoload
|
||||
(defun +helm-posframe-display (buffer &optional _resume)
|
||||
(defun +helm-posframe-display-fn (buffer &optional _resume)
|
||||
"TODO"
|
||||
(setq helm--buffer-in-new-frame-p t)
|
||||
(let ((solaire-p (bound-and-true-p solaire-mode))
|
||||
|
@ -52,15 +50,10 @@ bottom, which is easier on the eyes on big displays."
|
|||
(text-scale-set +helm-posframe-text-scale)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +helm|posframe-cleanup ()
|
||||
(defun +helm-posframe-cleanup-h ()
|
||||
"TODO"
|
||||
;; Ensure focus is properly returned to the underlying window, by forcing a
|
||||
;; chance in buffer/window focus. This gives the modeline a chance to refresh.
|
||||
(switch-to-buffer +helm--posframe-buffer t)
|
||||
;;
|
||||
(posframe-delete +helm--posframe-buffer))
|
||||
;; Ensure focus is properly returned to the underlying window. This gives the
|
||||
;; modeline a chance to refresh.
|
||||
(switch-to-buffer +helm--posframe-buffer t))
|
||||
|
||||
|
||||
;;;###autoload
|
||||
(defun +helm*fix-get-font-height (orig-fn position)
|
||||
(ignore-errors (funcall orig-fn position)))
|
||||
(add-hook 'helm-cleanup-hook #'+helm-posframe-cleanup-h)
|
||||
|
|
|
@ -11,8 +11,7 @@ silently ignored.
|
|||
This falls back to git-grep (then grep) if none of these available.")
|
||||
|
||||
;; Posframe (requires +childframe)
|
||||
(defvar +helm-posframe-handler
|
||||
#'+helm-poshandler-frame-center-near-bottom
|
||||
(defvar +helm-posframe-handler #'+helm-poshandler-frame-center-near-bottom-fn
|
||||
"The function that determines the location of the childframe. It should return
|
||||
a cons cell representing the X and Y coordinates. See
|
||||
`posframe-poshandler-frame-center' as a reference.")
|
||||
|
@ -33,7 +32,7 @@ be negative.")
|
|||
;;
|
||||
;;; Packages
|
||||
|
||||
(def-package! helm-mode
|
||||
(use-package! helm-mode
|
||||
:defer t
|
||||
:after-call pre-command-hook
|
||||
:init
|
||||
|
@ -58,7 +57,7 @@ be negative.")
|
|||
(add-to-list 'helm-completing-read-handlers-alist (cons #'find-file-at-point nil)))
|
||||
|
||||
|
||||
(def-package! helm
|
||||
(use-package! helm
|
||||
:after helm-mode
|
||||
:preface
|
||||
(setq helm-candidate-number-limit 50
|
||||
|
@ -83,9 +82,7 @@ be negative.")
|
|||
|
||||
:init
|
||||
(when (and EMACS26+ (featurep! +childframe))
|
||||
(setq helm-display-function #'+helm-posframe-display)
|
||||
;; Fix "Specified window is not displaying the current buffer" error
|
||||
(advice-add #'posframe--get-font-height :around #'+helm*fix-get-font-height))
|
||||
(setq helm-display-function #'+helm-posframe-display-fn))
|
||||
|
||||
(let ((fuzzy (featurep! +fuzzy)))
|
||||
(setq helm-M-x-fuzzy-match fuzzy
|
||||
|
@ -110,27 +107,28 @@ be negative.")
|
|||
:config
|
||||
(set-popup-rule! "^\\*helm" :vslot -100 :size 0.22 :ttl nil)
|
||||
|
||||
;; HACK Doom doesn't support these commands, which invite the user to install
|
||||
;; the package via ELPA. Force them to use +helm/* instead, because they work
|
||||
;; out of the box.
|
||||
(advice-add #'helm-projectile-rg :override #'+helm/rg)
|
||||
(advice-add #'helm-projectile-ag :override #'+helm/ag)
|
||||
(advice-add #'helm-projectile-grep :override #'+helm/grep)
|
||||
|
||||
;; Hide the modeline
|
||||
(defun +helm|hide-mode-line (&rest _)
|
||||
(defun +helm--hide-mode-line (&rest _)
|
||||
(with-current-buffer (helm-buffer-get)
|
||||
(unless helm-mode-line-string
|
||||
(hide-mode-line-mode +1))))
|
||||
(add-hook 'helm-after-initialize-hook #'+helm|hide-mode-line)
|
||||
(advice-add #'helm-display-mode-line :override #'+helm|hide-mode-line)
|
||||
(add-hook 'helm-after-initialize-hook #'+helm--hide-mode-line)
|
||||
(advice-add #'helm-display-mode-line :override #'+helm--hide-mode-line)
|
||||
(advice-add #'helm-ag-show-status-default-mode-line :override #'ignore)
|
||||
|
||||
;; TODO Find a better way
|
||||
(defun +helm*use-helpful (orig-fn arg)
|
||||
(cl-letf (((symbol-function #'describe-function)
|
||||
(symbol-function #'helpful-callable))
|
||||
((symbol-function #'describe-variable)
|
||||
(symbol-function #'helpful-variable)))
|
||||
(funcall orig-fn arg)))
|
||||
(advice-add #'helm-describe-variable :around #'+helm*use-helpful)
|
||||
(advice-add #'helm-describe-function :around #'+helm*use-helpful))
|
||||
;; Use helpful instead of describe-* to display documentation
|
||||
(dolist (fn '(helm-describe-variable helm-describe-function))
|
||||
(advice-add fn :around #'doom-use-helpful-a)))
|
||||
|
||||
|
||||
(def-package! helm-flx
|
||||
(use-package! helm-flx
|
||||
:when (featurep! +fuzzy)
|
||||
:hook (helm-mode . helm-flx-mode)
|
||||
:config (helm-flx-mode +1))
|
||||
|
@ -142,9 +140,9 @@ be negative.")
|
|||
(define-key helm-ag-edit-map [remap quit-window] #'helm-ag--edit-abort)
|
||||
(set-popup-rule! "^\\*helm-ag-edit" :size 0.35 :ttl 0 :quit nil)
|
||||
;; Recenter after jumping to match
|
||||
(advice-add #'helm-ag--find-file-action :after-while #'doom*recenter)
|
||||
(advice-add #'helm-ag--find-file-action :after-while #'doom-recenter-a)
|
||||
;; And record position before jumping
|
||||
(advice-add #'helm-ag--find-file-action :around #'doom*set-jump-maybe))
|
||||
(advice-add #'helm-ag--find-file-action :around #'doom-set-jump-maybe-a))
|
||||
|
||||
|
||||
;;;###package helm-bookmark
|
||||
|
@ -164,7 +162,7 @@ be negative.")
|
|||
|
||||
|
||||
;;;###package helm-projectile
|
||||
(def-package! helm-projectile
|
||||
(use-package! helm-projectile
|
||||
:commands (helm-projectile-find-file
|
||||
helm-projectile-recentf
|
||||
helm-projectile-switch-project
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
(package! helm-ag)
|
||||
(package! helm-c-yasnippet)
|
||||
(package! helm-company)
|
||||
(package! helm-describe-modes :recipe (:fetcher github :repo "emacs-helm/helm-describe-modes"))
|
||||
(package! helm-describe-modes :recipe (:host github :repo "emacs-helm/helm-describe-modes"))
|
||||
(package! helm-projectile)
|
||||
(package! swiper-helm)
|
||||
(when (featurep! +fuzzy)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; completion/ido/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defun +ido|init ()
|
||||
(defun +ido-init-h ()
|
||||
(setq ido-ignore-buffers
|
||||
'("\\` " "^\\*ESS\\*" "^\\*Messages\\*" "^\\*Help\\*" "^\\*Buffer"
|
||||
"^\\*.*Completions\\*$" "^\\*Ediff" "^\\*tramp" "^\\*cvs-"
|
||||
|
@ -28,8 +28,9 @@
|
|||
(insert "~/")
|
||||
(call-interactively #'self-insert-command))))
|
||||
|
||||
(defun +ido*sort-mtime ()
|
||||
(defadvice! +ido--sort-mtime-a ()
|
||||
"Sort ido filelist by mtime instead of alphabetically."
|
||||
:override #'ido-sort-mtime
|
||||
(setq ido-temp-list
|
||||
(sort ido-temp-list
|
||||
(lambda (a b)
|
||||
|
@ -40,8 +41,8 @@
|
|||
(cl-loop for x in ido-temp-list
|
||||
if (char-equal (string-to-char x) ?.)
|
||||
collect x)))
|
||||
(advice-add #'ido-sort-mtime :override #'+ido*sort-mtime)
|
||||
(add-hook! (ido-make-file-list ido-make-dir-list) #'+ido*sort-mtime)
|
||||
(add-hook! '(ido-make-file-list-hook ido-make-dir-list-hook)
|
||||
#'ido-sort-mtime)
|
||||
|
||||
;;
|
||||
(ido-mode 1)
|
||||
|
@ -52,7 +53,7 @@
|
|||
(crm-custom-mode +1)
|
||||
|
||||
;;
|
||||
(remove-hook 'ido-setup-hook #'+ido|init))
|
||||
(remove-hook 'ido-setup-hook #'+ido-init-h))
|
||||
|
||||
;;
|
||||
(add-hook 'ido-setup-hook #'+ido|init)
|
||||
(add-hook 'ido-setup-hook #'+ido-init-h)
|
||||
|
|
|
@ -1,32 +1,33 @@
|
|||
;;; completion/ivy/autoload/hydras.el -*- lexical-binding: t; -*-
|
||||
;;;###if (featurep! :ui hydra)
|
||||
|
||||
;;;###autoload
|
||||
(after! ivy-hydra
|
||||
(with-no-warnings
|
||||
(defhydra+ hydra-ivy (:hint nil :color pink)
|
||||
"
|
||||
(eval-when-compile (require 'ivy-hydra))
|
||||
|
||||
;;;###autoload (autoload 'hydra-ivy/body "completion/ivy/autoload/hydras" nil nil)
|
||||
(defhydra+ hydra-ivy (:hint nil :color pink)
|
||||
"
|
||||
Move ^^^^^^^^^^ | Call ^^^^ | Cancel^^ | Options^^ | Action _w_/_s_/_a_: %s(ivy-action-name)
|
||||
----------^^^^^^^^^^-+--------------^^^^-+-------^^-+--------^^-+---------------------------------
|
||||
_g_ ^ ^ _k_ ^ ^ _u_ | _f_orward _o_ccur | _i_nsert | _c_alling: %-7s(if ivy-calling \"on\" \"off\") _C_ase-fold: %-10`ivy-case-fold-search
|
||||
^↨^ _h_ ^+^ _l_ ^↕^ | _RET_ done ^^ | _q_uit | _m_atcher: %-7s(ivy--matcher-desc) _t_runcate: %-11`truncate-lines
|
||||
_G_ ^ ^ _j_ ^ ^ _d_ | _TAB_ alt-done ^^ | ^ ^ | _<_/_>_: shrink/grow
|
||||
"
|
||||
;; arrows
|
||||
("l" ivy-alt-done)
|
||||
("h" ivy-backward-delete-char)
|
||||
("g" ivy-beginning-of-buffer)
|
||||
("G" ivy-end-of-buffer)
|
||||
("d" ivy-scroll-up-command)
|
||||
("u" ivy-scroll-down-command)
|
||||
("e" ivy-scroll-down-command)
|
||||
;; actions
|
||||
("q" keyboard-escape-quit :exit t)
|
||||
("<escape>" keyboard-escape-quit :exit t)
|
||||
("TAB" ivy-alt-done :exit nil)
|
||||
("RET" ivy-done :exit t)
|
||||
("C-SPC" ivy-call-and-recenter :exit nil)
|
||||
("f" ivy-call)
|
||||
("c" ivy-toggle-calling)
|
||||
("m" ivy-toggle-fuzzy)
|
||||
("t" (setq truncate-lines (not truncate-lines)))
|
||||
("o" ivy-occur :exit t))))
|
||||
;; arrows
|
||||
("l" ivy-alt-done)
|
||||
("h" ivy-backward-delete-char)
|
||||
("g" ivy-beginning-of-buffer)
|
||||
("G" ivy-end-of-buffer)
|
||||
("d" ivy-scroll-up-command)
|
||||
("u" ivy-scroll-down-command)
|
||||
("e" ivy-scroll-down-command)
|
||||
;; actions
|
||||
("q" keyboard-escape-quit :exit t)
|
||||
("<escape>" keyboard-escape-quit :exit t)
|
||||
("TAB" ivy-alt-done :exit nil)
|
||||
("RET" ivy-done :exit t)
|
||||
("C-SPC" ivy-call-and-recenter :exit nil)
|
||||
("f" ivy-call)
|
||||
("c" ivy-toggle-calling)
|
||||
("m" ivy-toggle-fuzzy)
|
||||
("t" (setq truncate-lines (not truncate-lines)))
|
||||
("o" ivy-occur :exit t))
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
;;;###if (featurep! +childframe)
|
||||
|
||||
;;;###autoload
|
||||
(defun +ivy-display-at-frame-center-near-bottom (str)
|
||||
(defun +ivy-display-at-frame-center-near-bottom-fn (str)
|
||||
"TODO"
|
||||
(ivy-posframe--display str #'+ivy-poshandler-frame-center-near-bottom))
|
||||
(ivy-posframe--display str #'+ivy-poshandler-frame-center-near-bottom-fn))
|
||||
|
||||
;;;###autoload
|
||||
(defun +ivy-poshandler-frame-center-near-bottom (info)
|
||||
(defun +ivy-poshandler-frame-center-near-bottom-fn (info)
|
||||
"TODO"
|
||||
(let ((parent-frame (plist-get info :parent-frame))
|
||||
(pos (posframe-poshandler-frame-center info)))
|
||||
|
|
|
@ -43,7 +43,7 @@ immediately runs it on the current candidate (ending the ivy session)."
|
|||
;;
|
||||
;;; Packages
|
||||
|
||||
(def-package! ivy
|
||||
(use-package! ivy
|
||||
:defer 1
|
||||
:after-call pre-command-hook
|
||||
:init
|
||||
|
@ -75,31 +75,57 @@ immediately runs it on the current candidate (ending the ivy session)."
|
|||
;; enable ability to select prompt (alternative to `ivy-immediate-done')
|
||||
ivy-use-selectable-prompt t)
|
||||
|
||||
;; REVIEW Move this somewhere else and perhaps generalize this so both
|
||||
;; ivy/helm users can enjoy it.
|
||||
(defadvice! +ivy--counsel-file-jump-use-fd-rg-a (args)
|
||||
"Change `counsel-file-jump' to use fd or ripgrep, if they are available."
|
||||
:override #'counsel--find-return-list
|
||||
(cl-destructuring-bind (find-program . args)
|
||||
(cond ((executable-find "fd")
|
||||
(cons "fd" (list "-t" "f" "-E" ".git")))
|
||||
((executable-find "rg")
|
||||
(cons "rg" (list "--files" "--hidden" "--no-messages")))
|
||||
((cons find-program args)))
|
||||
(unless (listp args)
|
||||
(user-error "`counsel-file-jump-args' is a list now, please customize accordingly."))
|
||||
(counsel--call
|
||||
(cons find-program args)
|
||||
(lambda ()
|
||||
(goto-char (point-min))
|
||||
(let ((offset (if (member find-program '("fd" "rg")) 0 2))
|
||||
files)
|
||||
(while (< (point) (point-max))
|
||||
(push (buffer-substring
|
||||
(+ offset (line-beginning-position)) (line-end-position)) files)
|
||||
(forward-line 1))
|
||||
(nreverse files))))))
|
||||
|
||||
;; Ensure a jump point is registered before jumping to new locations with ivy
|
||||
(defvar +ivy--origin nil)
|
||||
|
||||
(defun +ivy|record-position-maybe ()
|
||||
(defun +ivy--record-position-maybe-fn ()
|
||||
(with-ivy-window
|
||||
(setq +ivy--origin (point-marker))))
|
||||
(setq ivy-hooks-alist '((t . +ivy|record-position-maybe)))
|
||||
(setq ivy-hooks-alist '((t . +ivy--record-position-maybe-fn)))
|
||||
|
||||
(defun +ivy|set-jump-point-maybe ()
|
||||
(when (and (markerp +ivy--origin)
|
||||
(not (equal (with-ivy-window (point-marker)) +ivy--origin)))
|
||||
(with-current-buffer (marker-buffer +ivy--origin)
|
||||
(better-jumper-set-jump +ivy--origin)))
|
||||
(setq +ivy--origin nil))
|
||||
(add-hook 'minibuffer-exit-hook #'+ivy|set-jump-point-maybe)
|
||||
(add-hook! 'minibuffer-exit-hook
|
||||
(defun +ivy--set-jump-point-maybe-h ()
|
||||
(with-demoted-errors "Ivy error: %s"
|
||||
(when (and (markerp +ivy--origin)
|
||||
(not (equal (with-ivy-window (point-marker))
|
||||
+ivy--origin)))
|
||||
(with-current-buffer (marker-buffer +ivy--origin)
|
||||
(better-jumper-set-jump +ivy--origin)))
|
||||
(setq +ivy--origin nil))))
|
||||
|
||||
(after! yasnippet
|
||||
(add-to-list 'yas-prompt-functions #'+ivy-yas-prompt nil #'eq))
|
||||
|
||||
(defun +ivy*inhibit-ivy-in-evil-ex (orig-fn &rest args)
|
||||
(defadvice! +ivy--inhibit-in-evil-ex-a (orig-fn &rest args)
|
||||
"`ivy-completion-in-region' struggles with completing certain
|
||||
evil-ex-specific constructs, so we disable it solely in evil-ex."
|
||||
:around #'evil-ex
|
||||
(let ((completion-in-region-function #'completion--in-region))
|
||||
(apply orig-fn args)))
|
||||
(advice-add #'evil-ex :around #'+ivy*inhibit-ivy-in-evil-ex)
|
||||
|
||||
(define-key! ivy-mode-map
|
||||
[remap switch-to-buffer] #'+ivy/switch-buffer
|
||||
|
@ -110,7 +136,7 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
|
|||
|
||||
(ivy-mode +1)
|
||||
|
||||
(def-package! ivy-hydra
|
||||
(use-package! ivy-hydra
|
||||
:commands (ivy-dispatching-done-hydra ivy--matcher-desc ivy-hydra/body)
|
||||
:init
|
||||
(define-key! ivy-minibuffer-map
|
||||
|
@ -121,7 +147,7 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
|
|||
(define-key ivy-minibuffer-map (kbd "M-o") #'hydra-ivy/body)))
|
||||
|
||||
|
||||
(def-package! ivy-rich
|
||||
(use-package! ivy-rich
|
||||
:after ivy
|
||||
:config
|
||||
(when (featurep! +icons)
|
||||
|
@ -159,7 +185,7 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
|
|||
(ivy-rich-mode +1))
|
||||
|
||||
|
||||
(def-package! all-the-icons-ivy
|
||||
(use-package! all-the-icons-ivy
|
||||
:when (featurep! +icons)
|
||||
:after ivy
|
||||
:config
|
||||
|
@ -175,7 +201,7 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
|
|||
(all-the-icons-ivy-setup))))
|
||||
|
||||
|
||||
(def-package! counsel
|
||||
(use-package! counsel
|
||||
:commands counsel-describe-face
|
||||
:init
|
||||
(map! [remap apropos] #'counsel-apropos
|
||||
|
@ -247,7 +273,7 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
|
|||
'(("O" +ivy-git-grep-other-window-action "open in other window"))))
|
||||
|
||||
|
||||
(def-package! counsel-projectile
|
||||
(use-package! counsel-projectile
|
||||
:defer t
|
||||
:init
|
||||
(map! [remap projectile-find-file] #'+ivy/projectile-find-file
|
||||
|
@ -261,12 +287,12 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
|
|||
(ivy-set-display-transformer #'counsel-projectile-find-file nil))
|
||||
|
||||
|
||||
(def-package! wgrep
|
||||
(use-package! wgrep
|
||||
:commands wgrep-change-to-wgrep-mode
|
||||
:config (setq wgrep-auto-save-buffer t))
|
||||
|
||||
|
||||
(def-package! ivy-posframe
|
||||
(use-package! ivy-posframe
|
||||
:when (and EMACS26+ (featurep! +childframe))
|
||||
:hook (ivy-mode . ivy-posframe-mode)
|
||||
:config
|
||||
|
@ -277,14 +303,16 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
|
|||
(min-height . ,ivy-height)))
|
||||
|
||||
;; default to posframe display function
|
||||
(setf (alist-get t ivy-posframe-display-functions-alist) #'+ivy-display-at-frame-center-near-bottom)
|
||||
(setf (alist-get t ivy-posframe-display-functions-alist)
|
||||
#'+ivy-display-at-frame-center-near-bottom-fn)
|
||||
|
||||
;; posframe doesn't work well with async sources
|
||||
(dolist (fn '(swiper counsel-ag counsel-grep counsel-git-grep))
|
||||
(setf (alist-get fn ivy-posframe-display-functions-alist) #'ivy-display-function-fallback)))
|
||||
(setf (alist-get fn ivy-posframe-display-functions-alist)
|
||||
#'ivy-display-function-fallback)))
|
||||
|
||||
|
||||
(def-package! flx
|
||||
(use-package! flx
|
||||
:when (and (featurep! +fuzzy)
|
||||
(not (featurep! +prescient)))
|
||||
:defer t ; is loaded by ivy
|
||||
|
@ -294,7 +322,7 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
|
|||
ivy-flx-limit 10000))
|
||||
|
||||
|
||||
(def-package! ivy-prescient
|
||||
(use-package! ivy-prescient
|
||||
:hook (ivy-mode . ivy-prescient-mode)
|
||||
:when (featurep! +prescient)
|
||||
:init
|
||||
|
@ -323,5 +351,5 @@ evil-ex-specific constructs, so we disable it solely in evil-ex."
|
|||
(prescient-persist-mode +1))
|
||||
|
||||
|
||||
;; Used by `counsel-M-x'
|
||||
(setq amx-save-file (concat doom-cache-dir "amx-items"))
|
||||
;;;###package amx
|
||||
(setq amx-save-file (concat doom-cache-dir "amx-items")) ; used by `counsel-M-x'
|
||||
|
|
|
@ -150,6 +150,7 @@
|
|||
:desc "Initialize repo" "r" #'magit-init
|
||||
:desc "Clone repo" "R" #'+magit/clone
|
||||
:desc "Commit" "c" #'magit-commit-create
|
||||
:desc "Fixup" "f" #'magit-commit-fixup
|
||||
:desc "Issue" "i" #'forge-create-issue
|
||||
:desc "Pull request" "p" #'forge-create-pullreq)))
|
||||
|
||||
|
|
|
@ -9,15 +9,14 @@
|
|||
(setq shift-select-mode t)
|
||||
(delete-selection-mode +1)
|
||||
|
||||
(def-package! expand-region
|
||||
(use-package! expand-region
|
||||
:commands (er/contract-region er/mark-symbol er/mark-word)
|
||||
:config
|
||||
(defun doom*quit-expand-region ()
|
||||
(defadvice! doom--quit-expand-region-a ()
|
||||
"Properly abort an expand-region region."
|
||||
:before '(evil-escape doom/escape)
|
||||
(when (memq last-command '(er/expand-region er/contract-region))
|
||||
(er/contract-region 0)))
|
||||
(advice-add #'evil-escape :before #'doom*quit-expand-region)
|
||||
(advice-add #'doom/escape :before #'doom*quit-expand-region))
|
||||
(er/contract-region 0))))
|
||||
|
||||
|
||||
;;
|
||||
|
|
|
@ -4,10 +4,15 @@
|
|||
|
||||
;; Don't let evil-collection interfere with certain keys
|
||||
(setq evil-collection-key-blacklist
|
||||
(list "C-j" "C-k" "gd" "gf" "K" "[" "]" "gz" "<escape>"
|
||||
(list "gd" "gf" "K" "[" "]" "gz" "<escape>"
|
||||
doom-leader-key doom-localleader-key
|
||||
doom-leader-alt-key doom-localleader-alt-key))
|
||||
|
||||
(defadvice! +default-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)))
|
||||
|
||||
|
||||
;;
|
||||
;;; Global keybindings
|
||||
|
@ -53,6 +58,9 @@
|
|||
|
||||
;; misc
|
||||
:n "C-S-f" #'toggle-frame-fullscreen
|
||||
:n "C-+" #'doom/reset-font-size
|
||||
:n "C-=" #'doom/increase-font-size
|
||||
:n "C--" #'doom/decrease-font-size
|
||||
|
||||
;; ported from vim
|
||||
:m "]m" #'+evil/next-beginning-of-method
|
||||
|
@ -140,7 +148,6 @@
|
|||
"C-r" #'winner-redo
|
||||
"o" #'doom/window-enlargen
|
||||
;; Delete window
|
||||
"c" #'+workspace/close-window-or-workspace
|
||||
"C-C" #'ace-delete-window)
|
||||
|
||||
;; Plugins
|
||||
|
@ -162,8 +169,8 @@
|
|||
:bind ((evil-snipe-scope 'buffer)
|
||||
(evil-snipe-enable-highlight)
|
||||
(evil-snipe-enable-incremental-highlight)))
|
||||
"SPC" (λ!! #'avy-goto-char-timer t)
|
||||
"/" #'avy-goto-char-timer)
|
||||
"SPC" (λ!! #'evil-avy-goto-char-timer t)
|
||||
"/" #'evil-avy-goto-char-timer)
|
||||
|
||||
;; text object plugins
|
||||
:textobj "x" #'evil-inner-xml-attr #'evil-outer-xml-attr
|
||||
|
@ -520,6 +527,7 @@
|
|||
:desc "Switch workspace buffer" "," #'persp-switch-to-buffer
|
||||
:desc "Switch buffer" "<" #'switch-to-buffer)
|
||||
|
||||
:desc "Switch to last buffer" "`" #'evil-switch-to-windows-last-buffer
|
||||
:desc "Resume last search" "'"
|
||||
(cond ((featurep! :completion ivy) #'ivy-resume)
|
||||
((featurep! :completion helm) #'helm-resume))
|
||||
|
@ -580,7 +588,9 @@
|
|||
:desc "Switch buffer" "B" #'switch-to-buffer)
|
||||
(:unless (featurep! :ui workspaces)
|
||||
:desc "Switch buffer" "b" #'switch-to-buffer)
|
||||
:desc "Kill buffer" "d" #'kill-current-buffer
|
||||
:desc "Kill buffer" "k" #'kill-current-buffer
|
||||
:desc "Switch to last buffer" "l" #'evil-switch-to-windows-last-buffer
|
||||
:desc "Next buffer" "n" #'next-buffer
|
||||
:desc "New empty buffer" "N" #'evil-buffer-new
|
||||
:desc "Kill other buffers" "o" #'doom/kill-other-buffers
|
||||
|
@ -674,6 +684,7 @@
|
|||
:desc "Initialize repo" "r" #'magit-init
|
||||
:desc "Clone repo" "R" #'+magit/clone
|
||||
:desc "Commit" "c" #'magit-commit-create
|
||||
:desc "Fixup" "f" #'magit-commit-fixup
|
||||
:desc "Branch" "b" #'magit-branch-and-checkout
|
||||
:desc "Issue" "i" #'forge-create-issue
|
||||
:desc "Pull request" "p" #'forge-create-pullreq)))
|
||||
|
@ -715,6 +726,9 @@
|
|||
(:when (featurep! :ui treemacs)
|
||||
:desc "Project sidebar" "p" #'+treemacs/toggle
|
||||
:desc "Find file in project sidebar" "P" #'+treemacs/find-file)
|
||||
(:when (featurep! :term shell)
|
||||
:desc "Toggle shell popup" "t" #'+shell/toggle
|
||||
:desc "Open shell here" "T" #'+shell/here)
|
||||
(:when (featurep! :term term)
|
||||
:desc "Toggle terminal popup" "t" #'+term/toggle
|
||||
:desc "Open terminal here" "T" #'+term/here)
|
||||
|
@ -724,16 +738,6 @@
|
|||
(:when (featurep! :term eshell)
|
||||
:desc "Toggle eshell popup" "e" #'+eshell/toggle
|
||||
:desc "Open eshell here" "E" #'+eshell/here)
|
||||
(:when (featurep! :collab floobits)
|
||||
(:prefix ("f" . "floobits")
|
||||
"c" #'floobits-clear-highlights
|
||||
"f" #'floobits-follow-user
|
||||
"j" #'floobits-join-workspace
|
||||
"l" #'floobits-leave-workspace
|
||||
"R" #'floobits-share-dir-private
|
||||
"s" #'floobits-summon
|
||||
"t" #'floobits-follow-mode-toggle
|
||||
"U" #'floobits-share-dir-public))
|
||||
(:when (featurep! :tools macos)
|
||||
:desc "Reveal in Finder" "o" #'+macos/reveal-in-finder
|
||||
:desc "Reveal project in Finder" "O" #'+macos/reveal-project-in-finder
|
||||
|
@ -795,11 +799,11 @@
|
|||
(:prefix-map ("s" . "snippets")
|
||||
:desc "View snippet for mode" "/" #'+snippets/find-for-current-mode
|
||||
:desc "View snippet (global)" "?" #'+snippets/find
|
||||
:desc "Edit snippet" "c" #'+snippet/edit
|
||||
:desc "Edit snippet" "c" #'+snippets/edit
|
||||
:desc "View private snippet" "f" #'+snippets/find-private
|
||||
:desc "Insert snippet" "i" #'yas-insert-snippet
|
||||
:desc "New snippet" "n" #'+snippet/new
|
||||
:desc "New snippet alias" "N" #'+snippet/new-alias
|
||||
:desc "New snippet" "n" #'+snippets/new
|
||||
:desc "New snippet alias" "N" #'+snippets/new-alias
|
||||
:desc "Reload snippets" "r" #'yas-reload-all
|
||||
:desc "Create temporary snippet" "s" #'aya-create
|
||||
:desc "Expand temporary snippet" "e" #'aya-expand))
|
||||
|
@ -810,10 +814,10 @@
|
|||
:desc "Flycheck" "f" #'flycheck-mode
|
||||
:desc "Frame fullscreen" "F" #'toggle-frame-fullscreen
|
||||
:desc "Evil goggles" "g" #'evil-goggles-mode
|
||||
:desc "Impatient mode" "h" #'+impatient-mode/toggle
|
||||
:desc "Indent guides" "i" #'highlight-indent-guides-mode
|
||||
:desc "Indent style" "I" #'doom/toggle-indent-style
|
||||
:desc "Line numbers" "l" #'doom/toggle-line-numbers
|
||||
:desc "Word-wrap mode" "w" #'+word-wrap-mode
|
||||
:desc "org-tree-slide mode" "p" #'+org-present/start
|
||||
:desc "Flyspell" "s" #'flyspell-mode))
|
||||
|
||||
|
@ -831,7 +835,7 @@ whose CDR is for repeating backward. They should both be kbd-able strings.")
|
|||
(defmacro set-repeater! (command next-func prev-func)
|
||||
"Makes ; and , the universal repeat-keys in evil-mode.
|
||||
To change these keys see `+default-repeat-keys'."
|
||||
(let ((fn-sym (intern (format "+default*repeat-%s" (doom-unquote command)))))
|
||||
(let ((fn-sym (intern (format "+default/repeat-%s" (doom-unquote command)))))
|
||||
`(progn
|
||||
(defun ,fn-sym (&rest _)
|
||||
(evil-define-key* 'motion 'local
|
||||
|
|
|
@ -119,6 +119,7 @@ languages)."
|
|||
(if (and (sp-point-in-comment)
|
||||
comment-line-break-function)
|
||||
(funcall comment-line-break-function)
|
||||
(delete-horizontal-space t)
|
||||
(newline nil t)
|
||||
(indent-according-to-mode)))
|
||||
|
||||
|
@ -267,7 +268,7 @@ If prefix ARG is set, prompt for a known project to search from."
|
|||
"Conduct a text search in the current project for symbol at point.
|
||||
If prefix ARG is set, prompt for a known project to search from."
|
||||
(interactive
|
||||
(list current-prefix-arg (thing-at-point 'symbol t)))
|
||||
(list current-prefix-arg (or (thing-at-point 'symbol t) "")))
|
||||
(let ((default-directory
|
||||
(if arg
|
||||
(if-let* ((projects (projectile-relevant-known-projects)))
|
||||
|
@ -304,6 +305,5 @@ ARG is set, prompt for a known project to search from."
|
|||
(defun +default/org-notes-headlines ()
|
||||
"Jump to an Org headline in `org-agenda-files'."
|
||||
(interactive)
|
||||
(completing-read
|
||||
"Jump to org headline: "
|
||||
(doom-completing-read-org-headings org-agenda-files 3 t)))
|
||||
(doom-completing-read-org-headings
|
||||
"Jump to org headline: " org-agenda-files 3 t))
|
||||
|
|
|
@ -44,13 +44,18 @@
|
|||
;; or specific :post-handlers with:
|
||||
;; (sp-pair "{" nil :post-handlers '(:rem ("| " "SPC")))
|
||||
(after! smartparens
|
||||
;; Smartparens is broken in `cc-mode' as of Emacs 27. See
|
||||
;; <https://github.com/Fuco1/smartparens/issues/963>.
|
||||
(unless EMACS27+
|
||||
(pushnew! sp--special-self-insert-commands 'c-electric-paren 'c-electric-brace))
|
||||
|
||||
;; Smartparens' navigation feature is neat, but does not justify how
|
||||
;; expensive it is. It's also less useful for evil users. This may need to
|
||||
;; be reactivated for non-evil users though. Needs more testing!
|
||||
(defun doom|disable-smartparens-navigate-skip-match ()
|
||||
(setq sp-navigate-skip-match nil
|
||||
sp-navigate-consider-sgml-tags nil))
|
||||
(add-hook 'after-change-major-mode-hook #'doom|disable-smartparens-navigate-skip-match)
|
||||
(add-hook! 'after-change-major-mode-hook
|
||||
(defun doom-disable-smartparens-navigate-skip-match-h ()
|
||||
(setq sp-navigate-skip-match nil
|
||||
sp-navigate-consider-sgml-tags nil)))
|
||||
|
||||
;; Autopair quotes more conservatively; if I'm next to a word/before another
|
||||
;; quote, I likely don't want to open a new pair.
|
||||
|
@ -101,10 +106,27 @@
|
|||
;; intelligently. The result isn't very intelligent (causes redundant
|
||||
;; characters), so just do it ourselves.
|
||||
(define-key! c++-mode-map "<" nil ">" nil)
|
||||
|
||||
(defun +default-cc-sp-point-is-template-p (id action context)
|
||||
"Return t if point is in the right place for C++ angle-brackets."
|
||||
(and (sp-in-code-p id action context)
|
||||
(cond ((eq action 'insert)
|
||||
(sp-point-after-word-p id action context))
|
||||
((eq action 'autoskip)
|
||||
(/= (char-before) 32)))))
|
||||
|
||||
(defun +default-cc-sp-point-after-include-p (id action context)
|
||||
"Return t if point is in an #include."
|
||||
(and (sp-in-code-p id action context)
|
||||
(save-excursion
|
||||
(goto-char (line-beginning-position))
|
||||
(looking-at-p "[ ]*#include[^<]+"))))
|
||||
|
||||
;; ...and leave it to smartparens
|
||||
(sp-local-pair '(c++-mode objc-mode)
|
||||
"<" ">"
|
||||
:when '(+cc-sp-point-is-template-p +cc-sp-point-after-include-p)
|
||||
:when '(+default-cc-sp-point-is-template-p
|
||||
+default-cc-sp-point-after-include-p)
|
||||
:post-handlers '(("| " "SPC")))
|
||||
|
||||
(sp-local-pair '(c-mode c++-mode objc-mode java-mode)
|
||||
|
@ -138,6 +160,27 @@
|
|||
:actions '(insert)
|
||||
:post-handlers '(("| " "SPC") ("|\n[i]*)[d-2]" "RET")))))
|
||||
|
||||
(after! smartparens-markdown
|
||||
(sp-with-modes '(markdown-mode gfm-mode)
|
||||
(sp-local-pair "```" "```" :post-handlers '(:add ("||\n[i]" "RET")))
|
||||
|
||||
;; The original rules for smartparens had an odd quirk: inserting two
|
||||
;; asterixex would replace nearby quotes with asterixes. These two rules
|
||||
;; set out to fix this.
|
||||
(sp-local-pair "**" nil :actions :rem)
|
||||
(sp-local-pair "*" "*"
|
||||
:actions '(insert skip)
|
||||
:unless '(:rem sp-point-at-bol-p)
|
||||
;; * then SPC will delete the second asterix and assume
|
||||
;; you wanted a bullet point. * followed by another *
|
||||
;; will produce an extra, assuming you wanted **|**.
|
||||
:post-handlers '(("[d1]" "SPC") ("|*" "*"))))
|
||||
|
||||
;; This keybind allows * to skip over **.
|
||||
(map! :map markdown-mode-map
|
||||
:ig "*" (λ! (if (looking-at-p "\\*\\* *$")
|
||||
(forward-char 2)
|
||||
(call-interactively 'self-insert-command)))))
|
||||
|
||||
;; Highjacks backspace to:
|
||||
;; a) balance spaces inside brackets/parentheses ( | ) -> (|)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
(defalias '+literate/reload #'doom/reload)
|
||||
|
||||
;;;###autoload
|
||||
(defun +literate|recompile-maybe ()
|
||||
(defun +literate-recompile-maybe-h ()
|
||||
"Recompile config.org if we're editing an org file in our DOOMDIR.
|
||||
|
||||
We assume any org file in `doom-private-dir' is connected to your literate
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
;;; config/literate/init.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +literate-config-file
|
||||
(expand-file-name "config.org" doom-private-dir)
|
||||
(concat doom-private-dir "config.org")
|
||||
"The file path of your literate config file.")
|
||||
|
||||
(defvar +literate-config-cache-file
|
||||
(expand-file-name "literate-last-compile" doom-cache-dir)
|
||||
(concat doom-cache-dir "literate-last-compile")
|
||||
"The file path that `+literate-config-file' will be tangled to, then
|
||||
byte-compiled from.")
|
||||
|
||||
|
@ -13,32 +13,34 @@ byte-compiled from.")
|
|||
;;
|
||||
(defun +literate-tangle (&optional force-p)
|
||||
"Tangles `+literate-config-file' if it has changed."
|
||||
(let ((default-directory doom-private-dir)
|
||||
(org +literate-config-file))
|
||||
(when (or force-p (file-newer-than-file-p org +literate-config-cache-file))
|
||||
(let ((default-directory doom-private-dir))
|
||||
(when (or (file-newer-than-file-p +literate-config-file
|
||||
+literate-config-cache-file)
|
||||
force-p)
|
||||
(message "Compiling your literate config...")
|
||||
|
||||
(let* ((org (file-truename +literate-config-file))
|
||||
(dest (concat (file-name-sans-extension org) ".el")))
|
||||
(or (and (if (fboundp 'org-babel-tangle-file)
|
||||
(org-babel-tangle-file org dest "emacs-lisp")
|
||||
;; We tangle in a separate, blank process because loading it
|
||||
;; here would load all of :lang org (very expensive!).
|
||||
(zerop (call-process
|
||||
"emacs" nil nil nil
|
||||
"-q" "--batch" "-l" "ob-tangle" "--eval"
|
||||
(format "(org-babel-tangle-file %S %S \"emacs-lisp\")"
|
||||
org dest))))
|
||||
;; Write the cache file to serve as our mtime cache
|
||||
(with-temp-file +literate-config-cache-file
|
||||
(message "Done!")))
|
||||
(warn "There was a problem tangling your literate config!"))))))
|
||||
(dest (concat (file-name-sans-extension org) ".el"))
|
||||
(output (get-buffer-create "*org-tangle*")))
|
||||
(unwind-protect
|
||||
;; We tangle in a separate, blank process because loading it here
|
||||
;; would load all of :lang org (very expensive!).
|
||||
(or (and (zerop (call-process
|
||||
"emacs" nil output nil
|
||||
"-q" "--batch"
|
||||
"-l" "ob-tangle"
|
||||
"--eval" (format "(org-babel-tangle-file %S %S)"
|
||||
org dest)))
|
||||
(with-current-buffer output
|
||||
(message "%s" (buffer-string))
|
||||
t)
|
||||
;; Write the cache file to serve as our mtime cache
|
||||
(with-temp-file +literate-config-cache-file
|
||||
(message "Done!")))
|
||||
(warn "There was a problem tangling your literate config!"))
|
||||
(kill-buffer output))))))
|
||||
|
||||
|
||||
;; Let 'er rip!
|
||||
(when noninteractive
|
||||
(require 'ob-tangle nil t))
|
||||
|
||||
(+literate-tangle (or doom-reloading-p noninteractive))
|
||||
;; No need to load the resulting file. Doom will do this for us after all
|
||||
;; modules have finished loading.
|
||||
|
@ -46,4 +48,4 @@ byte-compiled from.")
|
|||
|
||||
;; Recompile our literate config if we modify it
|
||||
(after! org
|
||||
(add-hook 'after-save-hook #'+literate|recompile-maybe))
|
||||
(add-hook 'after-save-hook #'+literate-recompile-maybe-h))
|
||||
|
|
|
@ -1,100 +1,6 @@
|
|||
;;; editor/evil/+commands.el -*- lexical-binding: t; -*-
|
||||
|
||||
(evil-define-operator +evil:open-scratch-buffer (bang)
|
||||
(interactive "<!>")
|
||||
(doom/open-scratch-buffer bang))
|
||||
|
||||
(evil-define-command +evil:pwd (bang)
|
||||
"Display the current working directory. If BANG, copy it to your clipboard."
|
||||
(interactive "<!>")
|
||||
(if (not bang)
|
||||
(pwd)
|
||||
(kill-new default-directory)
|
||||
(message "Copied to clipboard")))
|
||||
|
||||
(evil-define-command +evil:make (arguments &optional bang)
|
||||
"Run make with ARGUMENTS.
|
||||
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' for details."
|
||||
(interactive "<sh><!>")
|
||||
(+evil:compile (format "make %s"
|
||||
(evil-ex-replace-special-filenames
|
||||
arguments))
|
||||
bang))
|
||||
|
||||
(evil-define-command +evil:compile (arguments &optional bang)
|
||||
"Run `compile-command' with ARGUMENTS.
|
||||
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' for details."
|
||||
(interactive "<sh><!>")
|
||||
(compile (evil-ex-replace-special-filenames
|
||||
(format "%s %s"
|
||||
(eval compile-command)
|
||||
arguments))
|
||||
bang))
|
||||
|
||||
(evil-define-command +evil:reverse-lines (beg end)
|
||||
"Reverse lines between BEG and END."
|
||||
(interactive "<r>")
|
||||
(reverse-region beg end))
|
||||
|
||||
(evil-define-command +evil:cd (&optional path)
|
||||
"Change `default-directory' with `cd'."
|
||||
(interactive "<f>")
|
||||
(let ((path (or path "~")))
|
||||
(cd path)
|
||||
(message "Changed directory to '%s'" (abbreviate-file-name (expand-file-name path)))))
|
||||
|
||||
(evil-define-command +evil:kill-all-buffers (&optional bang)
|
||||
"Kill all buffers. If BANG, kill current session too."
|
||||
(interactive "<!>")
|
||||
(if (and bang (fboundp '+workspace/kill-session))
|
||||
(+workspace/kill-session)
|
||||
(doom/kill-all-buffers)))
|
||||
|
||||
(evil-define-command +evil:kill-matching-buffers (&optional bang pattern)
|
||||
"Kill all buffers matching PATTERN regexp. If BANG, only match project
|
||||
buffers."
|
||||
(interactive "<a>")
|
||||
(doom/kill-matching-buffers pattern bang))
|
||||
|
||||
(evil-define-command +evil:help (&optional bang query)
|
||||
"Look up help documentation for QUERY in Emacs documentation.
|
||||
|
||||
If BANG, search Doom documentation."
|
||||
(interactive "<!><a>")
|
||||
(if bang
|
||||
(doom/help-search query)
|
||||
(cond ((or (null query) (string-empty-p (string-trim query)))
|
||||
(call-interactively
|
||||
(or (command-remapping #'apropos)
|
||||
#'apropos)))
|
||||
((string-match-p "^ *:[a-z]" query)
|
||||
(let* ((modules
|
||||
(cl-loop for path in (doom-module-load-path 'all)
|
||||
for (cat . mod) = (doom-module-from-path path)
|
||||
for format = (format "%s %s" cat mod)
|
||||
if (doom-module-p cat mod)
|
||||
collect (propertize format 'module (list cat mod))
|
||||
else if (and cat mod)
|
||||
collect (propertize format
|
||||
'face 'font-lock-comment-face
|
||||
'module (list cat mod))))
|
||||
(module (completing-read "Describe module: " modules nil t query))
|
||||
(key (get-text-property 0 'module module)))
|
||||
(doom/help-modules key)))
|
||||
((and (string-match-p "\\(?:SPC\\|[CMsSH]-[^ ]\\|<[^>]+>\\)" query)
|
||||
(helpful-key (kbd (string-trim query)))))
|
||||
((apropos query t)))))
|
||||
|
||||
|
||||
;;
|
||||
;; Commands
|
||||
|
||||
;;; Custom commands
|
||||
;; Editing
|
||||
(evil-ex-define-cmd "@" #'+evil:macro-on-all-lines) ; TODO Test me
|
||||
|
@ -142,7 +48,7 @@ If BANG, search Doom documentation."
|
|||
(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 "m[sg]" #'view-echo-area-messages)
|
||||
(evil-ex-define-cmd "messages" #'view-echo-area-messages)
|
||||
(evil-ex-define-cmd "pop[up]" #'doom/popup-this-buffer)
|
||||
|
||||
;;; Project navigation
|
||||
|
|
|
@ -9,11 +9,10 @@
|
|||
;; 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. Eventually, I'd like to remove evil-collection. It changes too often,
|
||||
;; introduces breaking bugs too frequently, and I don't always agree with
|
||||
;; their design choices. Regardless, there are useful tidbits I'd like to
|
||||
;; keep. This will be a slow transition, but this file is where most of it
|
||||
;; will happen.
|
||||
;; 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).
|
||||
|
@ -43,8 +42,18 @@ variable for an explanation of the defaults (in comments). See
|
|||
|
||||
(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.
|
||||
;; 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 "^(defcustom evil-collection-mode-list\n[^(]+")
|
||||
;; (kill-new (thing-at-point 'sexp t))))
|
||||
(defvar evil-collection-mode-list
|
||||
`(2048-game
|
||||
ag
|
||||
|
@ -152,7 +161,7 @@ variable for an explanation of the defaults (in comments). See
|
|||
rtags
|
||||
simple
|
||||
slime
|
||||
(term term ansi-term)
|
||||
(term term ansi-term multi-term)
|
||||
tetris
|
||||
tide
|
||||
transmission
|
||||
|
@ -173,15 +182,15 @@ variable for an explanation of the defaults (in comments). See
|
|||
youtube-dl
|
||||
(ztree ztree-diff)))
|
||||
|
||||
(defun +evil-collection-init (module)
|
||||
(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) +evil-collection-disabled-list)
|
||||
(let ((module-sym (or (car-safe module) module)))
|
||||
(doom-log "Initialized evil-collection-%s %s"
|
||||
module-sym (if doom-init-time "" "(too early!)")))
|
||||
(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)))))
|
||||
|
||||
|
@ -192,9 +201,8 @@ and complains if a module is loaded too early (during startup)."
|
|||
;; 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...
|
||||
(after! evil-collection
|
||||
(let (+evil-collection-disabled-list)
|
||||
(mapc #'+evil-collection-init '(comint custom help))))
|
||||
(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
|
||||
|
@ -214,4 +222,4 @@ and complains if a module is loaded too early (during startup)."
|
|||
(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-init mode +evil-collection-disabled-list))))
|
||||
|
|
|
@ -1,76 +1,13 @@
|
|||
;;; editor/evil/autoload/advice.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defun +evil--insert-newline (&optional above _noextranewline)
|
||||
(let ((pos (save-excursion (beginning-of-line-text) (point)))
|
||||
comment-auto-fill-only-comments)
|
||||
(require 'smartparens)
|
||||
(evil-narrow-to-field
|
||||
(if above
|
||||
(if (save-excursion (nth 4 (sp--syntax-ppss pos)))
|
||||
(evil-save-goal-column
|
||||
(setq evil-auto-indent nil)
|
||||
(goto-char pos)
|
||||
(let ((ws (abs (skip-chars-backward " \t"))))
|
||||
;; FIXME oh god why
|
||||
(save-excursion
|
||||
(if comment-line-break-function
|
||||
(funcall comment-line-break-function)
|
||||
(comment-indent-new-line))
|
||||
(when (and (derived-mode-p 'c-mode 'c++-mode 'objc-mode 'java-mode 'js2-mode)
|
||||
(eq (char-after) ?/))
|
||||
(insert "*"))
|
||||
(insert
|
||||
(make-string (max 0 (+ ws (skip-chars-backward " \t")))
|
||||
32)))
|
||||
(insert (make-string (max 1 ws) 32))))
|
||||
(evil-move-beginning-of-line)
|
||||
(insert (if use-hard-newlines hard-newline "\n"))
|
||||
(forward-line -1)
|
||||
(back-to-indentation))
|
||||
(evil-move-end-of-line)
|
||||
(cond ((sp-point-in-comment pos)
|
||||
(setq evil-auto-indent nil)
|
||||
(if comment-line-break-function
|
||||
(funcall comment-line-break-function)
|
||||
(comment-indent-new-line)))
|
||||
;; TODO Find a better way to do this
|
||||
((and (eq major-mode 'haskell-mode)
|
||||
(fboundp 'haskell-indentation-newline-and-indent))
|
||||
(setq evil-auto-indent nil)
|
||||
(haskell-indentation-newline-and-indent))
|
||||
(t
|
||||
(insert (if use-hard-newlines hard-newline "\n"))
|
||||
(back-to-indentation)))))))
|
||||
;;;###autoload
|
||||
(defun +evil-escape-a (&rest _)
|
||||
"Call `doom/escape' if `evil-force-normal-state' is called interactively."
|
||||
(when (called-interactively-p 'any)
|
||||
(call-interactively #'doom/escape)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil*insert-newline-below-and-respect-comments (orig-fn count)
|
||||
(if (or (not +evil-want-o/O-to-continue-comments)
|
||||
(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))))
|
||||
(let ((evil-auto-indent evil-auto-indent))
|
||||
(funcall orig-fn count)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil*insert-newline-above-and-respect-comments (orig-fn count)
|
||||
(if (or (not +evil-want-o/O-to-continue-comments)
|
||||
(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))))
|
||||
(let ((evil-auto-indent evil-auto-indent))
|
||||
(funcall orig-fn count)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil*static-reindent (orig-fn &rest args)
|
||||
"Don't move cursor on indent."
|
||||
(save-excursion (apply orig-fn args)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil*resolve-vim-path (file-name)
|
||||
(defun +evil-resolve-vim-path-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:
|
||||
|
||||
|
@ -148,8 +85,77 @@ more information on modifiers."
|
|||
path file-name t t 1))))
|
||||
(replace-regexp-in-string regexp "\\1" file-name t)))
|
||||
|
||||
;;;###autoload (autoload '+evil*window-split "editor/evil/autoload/advice" nil t)
|
||||
(evil-define-command +evil*window-split (&optional count file)
|
||||
(defun +evil--insert-newline (&optional above _noextranewline)
|
||||
(let ((pos (save-excursion (beginning-of-line-text) (point)))
|
||||
comment-auto-fill-only-comments)
|
||||
(require 'smartparens)
|
||||
(evil-narrow-to-field
|
||||
(if above
|
||||
(if (save-excursion (nth 4 (sp--syntax-ppss pos)))
|
||||
(evil-save-goal-column
|
||||
(setq evil-auto-indent nil)
|
||||
(goto-char pos)
|
||||
(let ((ws (abs (skip-chars-backward " \t"))))
|
||||
;; FIXME oh god why
|
||||
(save-excursion
|
||||
(if comment-line-break-function
|
||||
(funcall comment-line-break-function)
|
||||
(comment-indent-new-line))
|
||||
(when (and (derived-mode-p 'c-mode 'c++-mode 'objc-mode 'java-mode 'js2-mode)
|
||||
(eq (char-after) ?/))
|
||||
(insert "*"))
|
||||
(insert
|
||||
(make-string (max 0 (+ ws (skip-chars-backward " \t")))
|
||||
32)))
|
||||
(insert (make-string (max 1 ws) 32))))
|
||||
(evil-move-beginning-of-line)
|
||||
(insert (if use-hard-newlines hard-newline "\n"))
|
||||
(forward-line -1)
|
||||
(back-to-indentation))
|
||||
(evil-move-end-of-line)
|
||||
(cond ((sp-point-in-comment pos)
|
||||
(setq evil-auto-indent nil)
|
||||
(if comment-line-break-function
|
||||
(funcall comment-line-break-function)
|
||||
(comment-indent-new-line)))
|
||||
;; TODO Find a better way to do this
|
||||
((and (eq major-mode 'haskell-mode)
|
||||
(fboundp 'haskell-indentation-newline-and-indent))
|
||||
(setq evil-auto-indent nil)
|
||||
(haskell-indentation-newline-and-indent))
|
||||
(t
|
||||
(insert (if use-hard-newlines hard-newline "\n"))
|
||||
(back-to-indentation)))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil--insert-newline-below-and-respect-comments-a (orig-fn count)
|
||||
(if (or (not +evil-want-o/O-to-continue-comments)
|
||||
(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))))
|
||||
(let ((evil-auto-indent evil-auto-indent))
|
||||
(funcall orig-fn count)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil--insert-newline-above-and-respect-comments-a (orig-fn count)
|
||||
(if (or (not +evil-want-o/O-to-continue-comments)
|
||||
(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))))
|
||||
(let ((evil-auto-indent evil-auto-indent))
|
||||
(funcall orig-fn count)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil--static-reindent-a (orig-fn &rest args)
|
||||
"Don't move cursor on indent."
|
||||
(save-excursion (apply orig-fn args)))
|
||||
|
||||
;;;###autoload (autoload '+evil-window-split-a "editor/evil/autoload/advice" nil t)
|
||||
(evil-define-command +evil-window-split-a (&optional count file)
|
||||
"Same as `evil-window-split', but focuses (and recenters) the new split."
|
||||
:repeat nil
|
||||
(interactive "P<f>")
|
||||
|
@ -164,8 +170,8 @@ more information on modifiers."
|
|||
(balance-windows (window-parent)))
|
||||
(if file (evil-edit file)))
|
||||
|
||||
;;;###autoload (autoload '+evil*window-vsplit "editor/evil/autoload/advice" nil t)
|
||||
(evil-define-command +evil*window-vsplit (&optional count file)
|
||||
;;;###autoload (autoload '+evil-window-vsplit-a "editor/evil/autoload/advice" nil t)
|
||||
(evil-define-command +evil-window-vsplit-a (&optional count file)
|
||||
"Same as `evil-window-vsplit', but focuses (and recenters) the new split."
|
||||
:repeat nil
|
||||
(interactive "P<f>")
|
||||
|
@ -181,18 +187,12 @@ more information on modifiers."
|
|||
(if file (evil-edit file)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil*escape (&rest _)
|
||||
"Call `doom/escape' if `evil-force-normal-state' is called interactively."
|
||||
(when (called-interactively-p 'any)
|
||||
(call-interactively #'doom/escape)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil*make-numbered-markers-global (orig-fn char)
|
||||
(defun +evil--make-numbered-markers-global-a (orig-fn char)
|
||||
(or (and (>= char ?2) (<= char ?9))
|
||||
(funcall orig-fn char)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil*fix-dabbrev-in-minibuffer ()
|
||||
(defun +evil--fix-dabbrev-in-minibuffer-h ()
|
||||
"Make `try-expand-dabbrev' from `hippie-expand' work in minibuffer. See
|
||||
`he-dabbrev-beg', so we need to redefine syntax for '/'."
|
||||
(set-syntax-table (let* ((table (make-syntax-table)))
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
;; editor/evil/autoload/evil.el -*- lexical-binding: t; -*-
|
||||
;;;###if (featurep! :editor evil)
|
||||
|
||||
;;;###autodef
|
||||
(defun set-evil-initial-state! (modes state)
|
||||
|
@ -12,72 +11,6 @@
|
|||
(evil-set-initial-state modes state))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Custom arg handlers
|
||||
|
||||
(defvar +evil--flag nil)
|
||||
|
||||
(defun +evil--ex-match-init (name &optional face update-hook)
|
||||
(with-current-buffer evil-ex-current-buffer
|
||||
(cond
|
||||
((eq +evil--flag 'start)
|
||||
(evil-ex-make-hl name
|
||||
:face (or face 'evil-ex-substitute-matches)
|
||||
:update-hook (or update-hook #'evil-ex-pattern-update-ex-info))
|
||||
(setq +evil--flag 'update))
|
||||
|
||||
((eq +evil--flag 'stop)
|
||||
(evil-ex-delete-hl name)))))
|
||||
|
||||
(defun +evil--ex-buffer-match (arg &optional hl-name flags beg end)
|
||||
(when (and (eq +evil--flag 'update)
|
||||
evil-ex-substitute-highlight-all
|
||||
(not (zerop (length arg))))
|
||||
(condition-case lossage
|
||||
(let ((pattern (evil-ex-make-substitute-pattern
|
||||
arg
|
||||
(or flags (list))))
|
||||
(range (or (evil-copy-range evil-ex-range)
|
||||
(evil-range (or beg (line-beginning-position))
|
||||
(or end (line-end-position))
|
||||
'line
|
||||
:expanded t))))
|
||||
(evil-expand-range range)
|
||||
(evil-ex-hl-set-region hl-name
|
||||
(max (evil-range-beginning range) (window-start))
|
||||
(min (evil-range-end range) (window-end)))
|
||||
(evil-ex-hl-change hl-name pattern))
|
||||
(end-of-file
|
||||
(evil-ex-pattern-update-ex-info nil "incomplete replacement"))
|
||||
(user-error
|
||||
(evil-ex-pattern-update-ex-info nil (format "?%s" lossage))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil-ex-buffer-match (flag &optional arg)
|
||||
(let ((hl-name 'evil-ex-buffer-match)
|
||||
(+evil--flag flag))
|
||||
(with-selected-window (minibuffer-selected-window)
|
||||
(+evil--ex-match-init hl-name)
|
||||
(+evil--ex-buffer-match arg hl-name (list (if evil-ex-substitute-global ?g))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil-ex-global-match (flag &optional arg)
|
||||
(let ((hl-name 'evil-ex-global-match)
|
||||
(+evil--flag flag))
|
||||
(with-selected-window (minibuffer-selected-window)
|
||||
(+evil--ex-match-init hl-name)
|
||||
(+evil--ex-buffer-match arg hl-name nil (point-min) (point-max)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil-ex-global-delim-match (flag &optional arg)
|
||||
(let ((hl-name 'evil-ex-global-delim-match)
|
||||
(+evil--flag flag))
|
||||
(with-selected-window (minibuffer-selected-window)
|
||||
(+evil--ex-match-init hl-name)
|
||||
(let ((result (car-safe (evil-delimited-arguments arg 2))))
|
||||
(+evil--ex-buffer-match result hl-name nil (point-min) (point-max))))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Interactive commands
|
||||
|
||||
|
@ -167,28 +100,6 @@ integration."
|
|||
t))
|
||||
prefix)))))
|
||||
|
||||
;;;###autoload (autoload '+evil:align "editor/evil/autoload/evil" nil t)
|
||||
(evil-define-operator +evil:align (beg end pattern &optional bang)
|
||||
"Ex interface to `align-regexp'. PATTERN is a vim-style regexp. If BANG,
|
||||
repeat the alignment for all matches (otherwise just the first match on each
|
||||
line)."
|
||||
(interactive "<r><//g><!>")
|
||||
(align-regexp
|
||||
beg end
|
||||
(concat "\\(\\s-*\\)" (evil-transform-vim-style-regexp pattern))
|
||||
1 1 bang))
|
||||
|
||||
;;;###autoload (autoload '+evil:align-right "editor/evil/autoload/evil" nil t)
|
||||
(evil-define-operator +evil:align-right (beg end pattern &optional bang)
|
||||
"Like `+evil:align', except alignments are right-justified. PATTERN is a
|
||||
vim-style regexp. If BANG, repeat the alignment for all matches (otherwise just
|
||||
the first match on each line)."
|
||||
(interactive "<r><//g><!>")
|
||||
(align-regexp
|
||||
beg end
|
||||
(concat "\\(" (evil-transform-vim-style-regexp pattern) "\\)")
|
||||
-1 1 bang))
|
||||
|
||||
;;;###autoload (autoload '+evil:apply-macro "editor/evil/autoload/evil" nil t)
|
||||
(evil-define-operator +evil:apply-macro (beg end)
|
||||
"Apply macro to each line."
|
||||
|
|
183
modules/editor/evil/autoload/ex.el
Normal file
183
modules/editor/evil/autoload/ex.el
Normal file
|
@ -0,0 +1,183 @@
|
|||
;;; editor/evil/autoload/ex.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +evil--flag nil)
|
||||
|
||||
(defun +evil--ex-match-init (name &optional face update-hook)
|
||||
(with-current-buffer evil-ex-current-buffer
|
||||
(cond
|
||||
((eq +evil--flag 'start)
|
||||
(evil-ex-make-hl name
|
||||
:face (or face 'evil-ex-lazy-highlight)
|
||||
:update-hook (or update-hook #'evil-ex-pattern-update-ex-info))
|
||||
(setq +evil--flag 'update))
|
||||
|
||||
((eq +evil--flag 'stop)
|
||||
(evil-ex-delete-hl name)))))
|
||||
|
||||
(defun +evil--ex-buffer-match (arg &optional hl-name flags beg end)
|
||||
(when (and (eq +evil--flag 'update)
|
||||
evil-ex-substitute-highlight-all
|
||||
(not (zerop (length arg))))
|
||||
(condition-case lossage
|
||||
(let* ((pattern (evil-ex-make-substitute-pattern
|
||||
arg
|
||||
(or flags (list))))
|
||||
(range (or (evil-copy-range evil-ex-range)
|
||||
(evil-range (or beg (line-beginning-position))
|
||||
(or end (line-end-position))
|
||||
'line
|
||||
:expanded t))))
|
||||
(evil-expand-range range)
|
||||
(evil-ex-hl-set-region hl-name
|
||||
(max (evil-range-beginning range) (window-start))
|
||||
(min (evil-range-end range) (window-end)))
|
||||
(evil-ex-hl-change hl-name pattern))
|
||||
(end-of-file
|
||||
(evil-ex-pattern-update-ex-info nil "incomplete replacement"))
|
||||
(user-error
|
||||
(evil-ex-pattern-update-ex-info nil (format "?%s" lossage))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +evil-ex-regexp-match (flag &optional arg invert)
|
||||
(let ((hl-name 'evil-ex-buffer-match)
|
||||
(+evil--flag flag))
|
||||
(with-selected-window (minibuffer-selected-window)
|
||||
(+evil--ex-match-init hl-name)
|
||||
(cl-destructuring-bind (&optional arg flags)
|
||||
(evil-delimited-arguments arg 2)
|
||||
(let ((evil-ex-substitute-global
|
||||
(if invert
|
||||
(not evil-ex-substitute-global)
|
||||
evil-ex-substitute-global)))
|
||||
(+evil--ex-buffer-match
|
||||
arg hl-name (string-to-list flags)))))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Ex Commands
|
||||
|
||||
;;;###autoload (autoload '+evil:align "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-operator +evil:align (beg end pattern &optional flags)
|
||||
"Ex interface to `align-regexp'. PATTERN is a vim-style regexp. If BANG,
|
||||
repeat the alignment for all matches (otherwise just the first match on each
|
||||
line)."
|
||||
(interactive "<r><//>")
|
||||
(align-regexp
|
||||
beg end
|
||||
(concat "\\(\\s-*\\)" (evil-transform-vim-style-regexp pattern))
|
||||
1 1 (memq ?g flags)))
|
||||
|
||||
;;;###autoload (autoload '+evil:align-right "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-operator +evil:align-right (beg end pattern &optional flags)
|
||||
"Like `+evil:align', except alignments are right-justified. PATTERN is a
|
||||
vim-style regexp. If BANG, repeat the alignment for all matches (otherwise just
|
||||
the first match on each line)."
|
||||
(interactive "<r><//>")
|
||||
(align-regexp
|
||||
beg end
|
||||
(concat "\\(" (evil-transform-vim-style-regexp pattern) "\\)")
|
||||
-1 1 (memq ?g flags)))
|
||||
|
||||
;; ;;;###autoload (autoload '+evil:sort "editor/evil/autoload/ex" nil nil)
|
||||
;; (evil-define-command +evil:sort (beg end &optional pattern flags reverse)
|
||||
;; (interactive "<r><//><!>"))
|
||||
|
||||
;;;###autoload (autoload '+evil:open-scratch-buffer "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-operator +evil:open-scratch-buffer (bang)
|
||||
(interactive "<!>")
|
||||
(doom/open-scratch-buffer bang))
|
||||
|
||||
;;;###autoload (autoload '+evil:pwd "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-command +evil:pwd (bang)
|
||||
"Display the current working directory. If BANG, copy it to your clipboard."
|
||||
(interactive "<!>")
|
||||
(if (not bang)
|
||||
(pwd)
|
||||
(kill-new default-directory)
|
||||
(message "Copied to clipboard")))
|
||||
|
||||
;;;###autoload (autoload '+evil:make "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-command +evil:make (arguments &optional bang)
|
||||
"Run make with ARGUMENTS.
|
||||
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."
|
||||
(interactive "<sh><!>")
|
||||
(+evil:compile (format "make %s"
|
||||
(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)
|
||||
"Run `compile-command' with ARGUMENTS.
|
||||
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."
|
||||
(interactive "<sh><!>")
|
||||
(compile (evil-ex-replace-special-filenames
|
||||
(format "%s %s"
|
||||
(eval compile-command)
|
||||
arguments))
|
||||
bang))
|
||||
|
||||
;;;###autoload (autoload '+evil:reverse-lines "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-command +evil:reverse-lines (beg end)
|
||||
"Reverse lines between BEG and END."
|
||||
(interactive "<r>")
|
||||
(reverse-region beg end))
|
||||
|
||||
;;;###autoload (autoload '+evil:cd "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-command +evil:cd (&optional path)
|
||||
"Change `default-directory' with `cd'."
|
||||
(interactive "<f>")
|
||||
(let ((path (or path "~")))
|
||||
(cd path)
|
||||
(message "Changed directory to '%s'" (abbreviate-file-name (expand-file-name path)))))
|
||||
|
||||
;;;###autoload (autoload '+evil:kill-all-buffers "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-command +evil:kill-all-buffers (&optional bang)
|
||||
"Kill all buffers. If BANG, kill current session too."
|
||||
(interactive "<!>")
|
||||
(if (and bang (fboundp '+workspace/kill-session))
|
||||
(+workspace/kill-session)
|
||||
(doom/kill-all-buffers)))
|
||||
|
||||
;;;###autoload (autoload '+evil:kill-matching-buffers "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-command +evil:kill-matching-buffers (&optional bang pattern)
|
||||
"Kill all buffers matching PATTERN regexp. If BANG, only match project
|
||||
buffers."
|
||||
(interactive "<a>")
|
||||
(doom/kill-matching-buffers pattern bang))
|
||||
|
||||
;;;###autoload (autoload '+evil:help "editor/evil/autoload/ex" nil t)
|
||||
(evil-define-command +evil:help (&optional bang query)
|
||||
"Look up help documentation for QUERY in Emacs documentation.
|
||||
|
||||
If BANG, search Doom documentation."
|
||||
(interactive "<!><a>")
|
||||
(if bang
|
||||
(doom/help-search query)
|
||||
(cond ((or (null query) (string-empty-p (string-trim query)))
|
||||
(call-interactively
|
||||
(or (command-remapping #'apropos)
|
||||
#'apropos)))
|
||||
((string-match-p "^ *:[a-z]" query)
|
||||
(let* ((modules
|
||||
(cl-loop for path in (doom-module-load-path 'all)
|
||||
for (cat . mod) = (doom-module-from-path path)
|
||||
for format = (format "%s %s" cat mod)
|
||||
if (doom-module-p cat mod)
|
||||
collect (propertize format 'module (list cat mod))
|
||||
else if (and cat mod)
|
||||
collect (propertize format
|
||||
'face 'font-lock-comment-face
|
||||
'module (list cat mod))))
|
||||
(module (completing-read "Describe module: " modules nil t query))
|
||||
(key (get-text-property 0 'module module)))
|
||||
(doom/help-modules key)))
|
||||
((and (string-match-p "\\(?:SPC\\|[CMsSH]-[^ ]\\|<[^>]+>\\)" query)
|
||||
(helpful-key (kbd (string-trim query)))))
|
||||
((apropos query t)))))
|
|
@ -44,8 +44,8 @@
|
|||
(user-error "Must be called from a file-visiting buffer"))
|
||||
(let* ((directory (file-name-directory buffer-file-name))
|
||||
(filename (file-name-nondirectory buffer-file-name))
|
||||
(files (doom-files-in directory :depth 0 :sort t :match "/[^._][^/]*$"))
|
||||
(index (cl-position filename files :test #'string=)))
|
||||
(files (doom-glob (file-name-directory buffer-file-name) "[!.]*"))
|
||||
(index (cl-position filename files :test #'file-equal-p)))
|
||||
(when (null index)
|
||||
(user-error "Couldn't find this file in current directory"))
|
||||
(let ((index (+ index n)))
|
||||
|
|
|
@ -18,8 +18,9 @@ directives. By default, this only recognizes C directives.")
|
|||
(defvar evil-want-C-u-scroll t)
|
||||
(defvar evil-want-C-w-scroll t)
|
||||
(defvar evil-want-Y-yank-to-eol t)
|
||||
(defvar evil-want-abbrev-expand-on-insert-exit nil)
|
||||
|
||||
(def-package! evil
|
||||
(use-package! evil
|
||||
:hook (doom-init-modules . evil-mode)
|
||||
:demand t
|
||||
:preface
|
||||
|
@ -36,9 +37,9 @@ directives. By default, this only recognizes C directives.")
|
|||
;; more vim-like behavior
|
||||
evil-symbol-word-search t
|
||||
;; cursor appearance
|
||||
evil-default-cursor '+evil-default-cursor
|
||||
evil-default-cursor '+evil-default-cursor-fn
|
||||
evil-normal-state-cursor 'box
|
||||
evil-emacs-state-cursor '(box +evil-emacs-cursor)
|
||||
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
|
||||
|
@ -49,15 +50,21 @@ directives. By default, this only recognizes C directives.")
|
|||
|
||||
(put 'evil-define-key* 'lisp-indent-function 'defun)
|
||||
|
||||
;; stop copying each visual state move to the clipboard:
|
||||
;; https://bitbucket.org/lyro/evil/issue/336/osx-visual-state-copies-the-region-on
|
||||
;; grokked from:
|
||||
;; http://stackoverflow.com/questions/15873346/elisp-rename-macro
|
||||
(advice-add #'evil-visual-update-x-selection :override #'ignore)
|
||||
|
||||
;; Start help-with-tutorial in emacs state
|
||||
(advice-add #'help-with-tutorial :after (lambda (&rest _) (evil-emacs-state +1)))
|
||||
|
||||
;; Done in a hook to ensure the popup rules load as late as possible
|
||||
(defun +evil|init-popup-rules ()
|
||||
(set-popup-rules!
|
||||
'(("^\\*evil-registers" :size 0.3)
|
||||
("^\\*Command Line" :size 8))))
|
||||
(add-hook 'doom-init-modules-hook #'+evil|init-popup-rules)
|
||||
(add-hook! 'doom-init-modules-hook
|
||||
(defun +evil--init-popup-rules-h ()
|
||||
(set-popup-rules!
|
||||
'(("^\\*evil-registers" :size 0.3)
|
||||
("^\\*Command Line" :size 8)))))
|
||||
|
||||
;; Change the cursor color in emacs state. We do it this roundabout way
|
||||
;; instead of changing `evil-default-cursor' (or `evil-emacs-state-cursor') so
|
||||
|
@ -65,19 +72,17 @@ directives. By default, this only recognizes C directives.")
|
|||
(defvar +evil--default-cursor-color "#ffffff")
|
||||
(defvar +evil--emacs-cursor-color "#ff9999")
|
||||
|
||||
(defun +evil|update-cursor-color ()
|
||||
(setq +evil--default-cursor-color (face-background 'cursor)
|
||||
+evil--emacs-cursor-color (face-foreground 'warning)))
|
||||
(add-hook 'doom-load-theme-hook #'+evil|update-cursor-color)
|
||||
(add-hook! 'doom-load-theme-hook
|
||||
(defun +evil-update-cursor-color-h ()
|
||||
(setq +evil--default-cursor-color (face-background 'cursor)
|
||||
+evil--emacs-cursor-color (face-foreground 'warning))))
|
||||
|
||||
(defun +evil-default-cursor ()
|
||||
(defun +evil-default-cursor-fn ()
|
||||
(evil-set-cursor-color +evil--default-cursor-color))
|
||||
(defun +evil-emacs-cursor ()
|
||||
(defun +evil-emacs-cursor-fn ()
|
||||
(evil-set-cursor-color +evil--emacs-cursor-color))
|
||||
|
||||
(defun +evil|update-shift-width ()
|
||||
(setq evil-shift-width tab-width))
|
||||
(add-hook 'after-change-major-mode-hook #'+evil|update-shift-width)
|
||||
(setq-hook! 'after-change-major-mode-hook evil-shift-width tab-width)
|
||||
|
||||
|
||||
;; --- keybind fixes ----------------------
|
||||
|
@ -86,92 +91,101 @@ directives. By default, this only recognizes C directives.")
|
|||
;; `evil-delete' in wgrep buffers.
|
||||
(define-key wgrep-mode-map [remap evil-delete] #'+evil-delete))
|
||||
|
||||
(defun +evil|disable-highlights ()
|
||||
"Disable ex search buffer highlights."
|
||||
(when (evil-ex-hl-active-p 'evil-ex-search)
|
||||
(evil-ex-nohighlight)
|
||||
t))
|
||||
(add-hook 'doom-escape-hook #'+evil|disable-highlights)
|
||||
(add-hook! 'doom-escape-hook
|
||||
(defun +evil-disable-ex-highlights-h ()
|
||||
"Disable ex search buffer highlights."
|
||||
(when (evil-ex-hl-active-p 'evil-ex-search)
|
||||
(evil-ex-nohighlight)
|
||||
t)))
|
||||
|
||||
|
||||
;; --- evil hacks -------------------------
|
||||
(defun +evil|display-vimlike-save-message ()
|
||||
"Shorter, vim-esque save messages."
|
||||
(message "\"%s\" %dL, %dC written"
|
||||
(if buffer-file-name
|
||||
(file-relative-name (file-truename buffer-file-name) (doom-project-root))
|
||||
(buffer-name))
|
||||
(count-lines (point-min) (point-max))
|
||||
(buffer-size)))
|
||||
(unless noninteractive
|
||||
(setq save-silently t)
|
||||
(add-hook 'after-save-hook #'+evil|display-vimlike-save-message))
|
||||
(add-hook! 'after-save-hook
|
||||
(defun +evil-display-vimlike-save-message-h ()
|
||||
"Shorter, vim-esque save messages."
|
||||
(message "\"%s\" %dL, %dC written"
|
||||
(if buffer-file-name
|
||||
(file-relative-name (file-truename buffer-file-name) (doom-project-root))
|
||||
(buffer-name))
|
||||
(count-lines (point-min) (point-max))
|
||||
(buffer-size)))))
|
||||
;; Make ESC (from normal mode) the universal escaper. See `doom-escape-hook'.
|
||||
(advice-add #'evil-force-normal-state :after #'+evil*escape)
|
||||
(advice-add #'evil-force-normal-state :after #'+evil-escape-a)
|
||||
;; Don't move cursor when indenting
|
||||
(advice-add #'evil-indent :around #'+evil*static-reindent)
|
||||
(advice-add #'evil-indent :around #'+evil--static-reindent-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)
|
||||
(advice-add #'evil-ex-replace-special-filenames :override #'+evil-resolve-vim-path-a)
|
||||
|
||||
;; make `try-expand-dabbrev' (from `hippie-expand') work in minibuffer
|
||||
(add-hook 'minibuffer-inactive-mode-hook #'+evil*fix-dabbrev-in-minibuffer)
|
||||
(add-hook 'minibuffer-inactive-mode-hook #'+evil--fix-dabbrev-in-minibuffer-h)
|
||||
|
||||
;; Focus and recenter new splits
|
||||
(advice-add #'evil-window-split :override #'+evil*window-split)
|
||||
(advice-add #'evil-window-vsplit :override #'+evil*window-vsplit)
|
||||
(advice-add #'evil-window-split :override #'+evil-window-split-a)
|
||||
(advice-add #'evil-window-vsplit :override #'+evil-window-vsplit-a)
|
||||
|
||||
;; In evil, registers 2-9 are buffer-local. In vim, they're global, so...
|
||||
(advice-add #'evil-global-marker-p :around #'+evil*make-numbered-markers-global)
|
||||
(advice-add #'evil-global-marker-p :around #'+evil--make-numbered-markers-global-a)
|
||||
|
||||
;; Make o/O continue comments (see `+evil-want-o/O-to-continue-comments')
|
||||
(advice-add #'evil-open-above :around #'+evil*insert-newline-above-and-respect-comments)
|
||||
(advice-add #'evil-open-below :around #'+evil*insert-newline-below-and-respect-comments)
|
||||
(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
|
||||
(advice-add! '(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)
|
||||
:after #'doom*recenter)
|
||||
(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 buffer-match :runner +evil-ex-buffer-match)
|
||||
(evil-ex-define-argument-type global-match :runner +evil-ex-global-match)
|
||||
(evil-ex-define-argument-type regexp-match
|
||||
:runner (lambda (flag &optional arg) (+evil-ex-regexp-match flag arg 'inverted)))
|
||||
(evil-ex-define-argument-type regexp-global-match
|
||||
:runner +evil-ex-regexp-match)
|
||||
|
||||
(defun +evil--regexp-match-args (arg)
|
||||
(when (evil-ex-p)
|
||||
(cl-destructuring-bind (&optional arg flags)
|
||||
(evil-delimited-arguments arg 2)
|
||||
(list arg (string-to-list flags)))))
|
||||
|
||||
;; Other commands can make use of this
|
||||
(evil-define-interactive-code "<//>"
|
||||
:ex-arg buffer-match (list (if (evil-ex-p) evil-ex-argument)))
|
||||
(evil-define-interactive-code "<//g>"
|
||||
:ex-arg global-match (list (if (evil-ex-p) evil-ex-argument)))
|
||||
:ex-arg regexp-match
|
||||
(+evil--regexp-match-args evil-ex-argument))
|
||||
|
||||
;; By default :g[lobal] doesn't highlight matches in the current buffer. I've
|
||||
;; got to write my own argument type and interactive code to get it to do so.
|
||||
(evil-ex-define-argument-type global-delim-match :runner +evil-ex-global-delim-match)
|
||||
(dolist (sym '(evil-ex-global evil-ex-global-inverted))
|
||||
(evil-set-command-property sym :ex-arg 'global-delim-match))
|
||||
(evil-define-interactive-code "<//!>"
|
||||
:ex-arg regexp-global-match
|
||||
(+evil--regexp-match-args evil-ex-argument))
|
||||
|
||||
;; Forward declare these so that ex completion works, even if the autoloaded
|
||||
;; functions aren't loaded yet.
|
||||
(evil-set-command-properties
|
||||
'+evil:align :move-point t :ex-arg 'buffer-match :ex-bang t :keep-visual t :suppress-operator t)
|
||||
(evil-add-command-properties '+evil:align :ex-arg 'regexp-match)
|
||||
(evil-add-command-properties '+evil:align-right :ex-arg 'regexp-match)
|
||||
(evil-add-command-properties '+multiple-cursors:evil-mc :ex-arg 'regexp-global-match)
|
||||
|
||||
;; `evil-collection'
|
||||
(when (and (featurep! +everywhere)
|
||||
(not doom-reloading-p))
|
||||
(load! "+everywhere"))
|
||||
|
||||
;; Custom evil ex commands
|
||||
(load! "+commands"))
|
||||
;; Lazy load evil ex commands
|
||||
(delq! 'evil-ex features)
|
||||
(add-transient-hook! 'evil-ex (provide 'evil-ex))
|
||||
(after! evil-ex (load! "+commands")))
|
||||
|
||||
|
||||
;;
|
||||
;; Packages
|
||||
|
||||
(def-package! evil-commentary
|
||||
(use-package! evil-commentary
|
||||
:commands (evil-commentary
|
||||
evil-commentary-yank
|
||||
evil-commentary-yank-line
|
||||
|
@ -179,8 +193,8 @@ directives. By default, this only recognizes C directives.")
|
|||
:config (evil-commentary-mode 1))
|
||||
|
||||
|
||||
(def-package! evil-easymotion
|
||||
:commands (evilem-create evilem-default-keybindings)
|
||||
(use-package! evil-easymotion
|
||||
:commands evilem-create evilem-default-keybindings
|
||||
:config
|
||||
;; Use evil-search backend, instead of isearch
|
||||
(evilem-make-motion evilem-motion-search-next #'evil-ex-search-next
|
||||
|
@ -194,27 +208,27 @@ directives. By default, this only recognizes C directives.")
|
|||
:bind ((evil-ex-search-highlight-all nil))))
|
||||
|
||||
|
||||
(def-package! evil-embrace
|
||||
:commands (embrace-add-pair embrace-add-pair-regexp)
|
||||
(use-package! evil-embrace
|
||||
:commands embrace-add-pair embrace-add-pair-regexp
|
||||
:hook (LaTeX-mode . embrace-LaTeX-mode-hook)
|
||||
:hook (org-mode . embrace-org-mode-hook)
|
||||
:hook ((ruby-mode enh-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)
|
||||
. +evil|embrace-lisp-mode-hook)
|
||||
:hook ((org-mode LaTeX-mode) . +evil|embrace-latex-mode-hook)
|
||||
. +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)
|
||||
. +evil|embrace-angle-bracket-modes-hook)
|
||||
. +evil-embrace-angle-bracket-modes-hook-h)
|
||||
:init
|
||||
(after! evil-surround
|
||||
(evil-embrace-enable-evil-surround-integration))
|
||||
:config
|
||||
(setq evil-embrace-show-help-p nil)
|
||||
|
||||
(defun +evil|embrace-latex-mode-hook ()
|
||||
(defun +evil-embrace-latex-mode-hook-h ()
|
||||
(embrace-add-pair-regexp ?l "\\[a-z]+{" "}" #'+evil--embrace-latex))
|
||||
|
||||
(defun +evil|embrace-lisp-mode-hook ()
|
||||
(defun +evil-embrace-lisp-mode-hook-h ()
|
||||
(push (cons ?f (make-embrace-pair-struct
|
||||
:key ?f
|
||||
:read-function #'+evil--embrace-elisp-fn
|
||||
|
@ -222,7 +236,7 @@ directives. By default, this only recognizes C directives.")
|
|||
:right-regexp ")"))
|
||||
embrace--pairs-list))
|
||||
|
||||
(defun +evil|embrace-angle-bracket-modes-hook ()
|
||||
(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
|
||||
|
@ -241,9 +255,9 @@ directives. By default, this only recognizes C directives.")
|
|||
:right-regexp "\\[]})]")))
|
||||
|
||||
|
||||
(def-package! evil-escape
|
||||
:commands (evil-escape)
|
||||
:after-call (evil-normal-state-exit-hook)
|
||||
(use-package! evil-escape
|
||||
:commands evil-escape
|
||||
:after-call evil-normal-state-exit-hook
|
||||
:init
|
||||
(setq evil-escape-excluded-states '(normal visual multiedit emacs motion)
|
||||
evil-escape-excluded-major-modes '(neotree-mode treemacs-mode vterm-mode)
|
||||
|
@ -257,19 +271,21 @@ directives. By default, this only recognizes C directives.")
|
|||
(evil-escape-mode +1))
|
||||
|
||||
|
||||
(def-package! evil-exchange
|
||||
(use-package! evil-exchange
|
||||
:commands evil-exchange
|
||||
:config
|
||||
(defun +evil|escape-exchange ()
|
||||
(when evil-exchange--overlays
|
||||
(evil-exchange-cancel)
|
||||
t))
|
||||
(add-hook 'doom-escape-hook #'+evil|escape-exchange))
|
||||
(add-hook! 'doom-escape-hook
|
||||
(defun +evil--escape-exchange-h ()
|
||||
(when evil-exchange--overlays
|
||||
(evil-exchange-cancel)
|
||||
t))))
|
||||
|
||||
|
||||
(def-package! evil-snipe
|
||||
:commands (evil-snipe-mode evil-snipe-override-mode
|
||||
evil-snipe-local-mode evil-snipe-override-local-mode)
|
||||
(use-package! evil-snipe
|
||||
:commands (evil-snipe-mode
|
||||
evil-snipe-override-mode
|
||||
evil-snipe-local-mode
|
||||
evil-snipe-override-local-mode)
|
||||
:after-call pre-command-hook
|
||||
:init
|
||||
(setq evil-snipe-smart-case t
|
||||
|
@ -282,7 +298,7 @@ directives. By default, this only recognizes C directives.")
|
|||
(evil-snipe-override-mode +1))
|
||||
|
||||
|
||||
(def-package! evil-surround
|
||||
(use-package! evil-surround
|
||||
:commands (global-evil-surround-mode
|
||||
evil-surround-edit
|
||||
evil-Surround-edit
|
||||
|
@ -290,8 +306,17 @@ directives. By default, this only recognizes C directives.")
|
|||
:config (global-evil-surround-mode 1))
|
||||
|
||||
|
||||
(use-package! evil-traces
|
||||
:after evil-ex
|
||||
:config
|
||||
(pushnew! evil-traces-argument-type-alist
|
||||
'(+evil:align . evil-traces-global)
|
||||
'(+evil:align-right . evil-traces-global))
|
||||
(evil-traces-mode))
|
||||
|
||||
|
||||
;; Allows you to use the selection for * and #
|
||||
(def-package! evil-visualstar
|
||||
(use-package! evil-visualstar
|
||||
:commands (evil-visualstar/begin-search
|
||||
evil-visualstar/begin-search-forward
|
||||
evil-visualstar/begin-search-backward)
|
||||
|
@ -302,7 +327,7 @@ directives. By default, this only recognizes C directives.")
|
|||
|
||||
|
||||
;;
|
||||
;; Text object plugins
|
||||
;;; Text object plugins
|
||||
|
||||
(def-package! exato
|
||||
:commands (evil-outer-xml-attr evil-inner-xml-attr))
|
||||
(use-package! exato
|
||||
:commands evil-outer-xml-attr evil-inner-xml-attr)
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
(package! evil-escape)
|
||||
(package! evil-exchange)
|
||||
(package! evil-indent-plus)
|
||||
(package! evil-numbers :recipe (:fetcher github :repo "janpath/evil-numbers"))
|
||||
(package! evil-textobj-anyblock)
|
||||
(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)
|
||||
|
||||
|
||||
;;
|
||||
(when (featurep! +everywhere)
|
||||
;; `evil-collection-neotree' uses the `neotree-make-executor' macro, but this
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
(after-all
|
||||
(unload-feature 'evil t))
|
||||
(before-each
|
||||
(fset 'resv #'+evil*resolve-vim-path)
|
||||
(fset 'resv #'+evil-resolve-vim-path-a)
|
||||
(spy-on 'doom-project-root :and-call-fake (lambda () project-root)))
|
||||
|
||||
;; `evil-ex-replace-special-filenames' / `+evil*resolve-vim-path'
|
||||
;; `evil-ex-replace-special-filenames' / `+evil-resolve-vim-path-a'
|
||||
(describe "file modifiers"
|
||||
(it "supports basic vim file modifiers"
|
||||
(let ((buffer-file-name "~/.emacs.d/test/modules/feature/test-evil.el")
|
||||
|
|
|
@ -114,11 +114,12 @@ information.")
|
|||
(or (file-in-directory-p file doom-private-dir)
|
||||
(file-in-directory-p file doom-emacs-dir)))
|
||||
|
||||
(defun +file-templates|check ()
|
||||
(defun +file-templates-check-h ()
|
||||
"Check if the current buffer is a candidate for file template expansion. It
|
||||
must be non-read-only, empty, and there must be a rule in
|
||||
`+file-templates-alist' that applies to it."
|
||||
(when (and (not buffer-read-only)
|
||||
(when (and (not (file-exists-p (or (buffer-file-name) "")))
|
||||
(not buffer-read-only)
|
||||
(bobp) (eobp)
|
||||
(not (string-match-p "^ *\\*" (buffer-name))))
|
||||
(when-let (rule (cl-find-if #'+file-template-p +file-templates-alist))
|
||||
|
@ -143,4 +144,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)
|
||||
(add-hook 'find-file-hook #'+file-templates-check-h)
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
:group 'doom-themes)
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold-hideshow-haml-forward-sexp (arg)
|
||||
(defun +fold-hideshow-haml-forward-sexp-fn (arg)
|
||||
(haml-forward-sexp arg)
|
||||
(move-beginning-of-line 1))
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold-hideshow-forward-block-by-indent (_arg)
|
||||
(defun +fold-hideshow-forward-block-by-indent-fn (_arg)
|
||||
(let ((start (current-indentation)))
|
||||
(forward-line)
|
||||
(unless (= start (current-indentation))
|
||||
|
@ -20,7 +20,7 @@
|
|||
(end-of-line)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +fold-hideshow-set-up-overlay (ov)
|
||||
(defun +fold-hideshow-set-up-overlay-fn (ov)
|
||||
(when (eq 'code (overlay-get ov 'hs))
|
||||
(when (featurep 'vimish-fold)
|
||||
(overlay-put
|
||||
|
|
|
@ -17,21 +17,22 @@
|
|||
;;
|
||||
;; Packages
|
||||
|
||||
(def-package! hideshow ; built-in
|
||||
:commands (hs-toggle-hiding hs-hide-block hs-hide-level hs-show-all hs-hide-all)
|
||||
(use-package! hideshow ; built-in
|
||||
:commands (hs-toggle-hiding
|
||||
hs-hide-block
|
||||
hs-hide-level
|
||||
hs-show-all
|
||||
hs-hide-all)
|
||||
:config
|
||||
(setq hs-hide-comments-when-hiding-all nil
|
||||
;; Nicer code-folding overlays (with fringe indicators)
|
||||
hs-set-up-overlay #'+fold-hideshow-set-up-overlay)
|
||||
hs-set-up-overlay #'+fold-hideshow-set-up-overlay-fn)
|
||||
|
||||
(defun +fold-hideshow*ensure-mode (&rest _)
|
||||
(defadvice! +fold--hideshow-ensure-mode-a (&rest _)
|
||||
"Ensure `hs-minor-mode' is enabled."
|
||||
: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)))
|
||||
(advice-add! '(hs-toggle-hiding
|
||||
hs-hide-block hs-hide-level
|
||||
hs-show-all hs-hide-all)
|
||||
:before #'+fold-hideshow*ensure-mode)
|
||||
|
||||
;; extra folding support for more languages
|
||||
(unless (assq 't hs-special-modes-alist)
|
||||
|
@ -41,8 +42,8 @@
|
|||
(yaml-mode "\\s-*\\_<\\(?:[^:]+\\)\\_>"
|
||||
""
|
||||
"#"
|
||||
+fold-hideshow-forward-block-by-indent nil)
|
||||
(haml-mode "[#.%]" "\n" "/" +fold-hideshow-haml-forward-sexp nil)
|
||||
+fold-hideshow-forward-block-by-indent-fn nil)
|
||||
(haml-mode "[#.%]" "\n" "/" +fold-hideshow-haml-forward-sexp-fn nil)
|
||||
(ruby-mode "class\\|d\\(?:ef\\|o\\)\\|module\\|[[{]"
|
||||
"end\\|[]}]"
|
||||
"#\\|=begin"
|
||||
|
@ -61,7 +62,7 @@
|
|||
'((t))))))
|
||||
|
||||
|
||||
(def-package! evil-vimish-fold
|
||||
(use-package! evil-vimish-fold
|
||||
:when (featurep! :editor evil)
|
||||
:commands (evil-vimish-fold/next-fold evil-vimish-fold/previous-fold
|
||||
evil-vimish-fold/delete evil-vimish-fold/delete-all
|
||||
|
|
|
@ -98,7 +98,7 @@ Stolen shamelessly from go-mode"
|
|||
(if fmt (cons (intern fmt) t))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +format*probe (orig-fn)
|
||||
(defun +format-probe-a (orig-fn)
|
||||
"Use `+format-with' instead, if it is set."
|
||||
(if +format-with
|
||||
(list +format-with t)
|
||||
|
@ -119,7 +119,7 @@ formatted text, ERRORS are any errors in string format, and FIRST-DIFF is the
|
|||
position of the first change in the buffer.
|
||||
|
||||
See `+format/buffer' for the interactive version of this function, and
|
||||
`+format|buffer' to use as a `before-save-hook' hook."
|
||||
`+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))
|
||||
|
@ -228,12 +228,12 @@ is selected)."
|
|||
;; Hooks
|
||||
|
||||
;;;###autoload
|
||||
(defun +format|enable-on-save ()
|
||||
(defun +format-enable-on-save-h ()
|
||||
"Enables formatting on save."
|
||||
(add-hook 'before-save-hook #'+format|buffer nil t))
|
||||
(add-hook 'before-save-hook #'+format-buffer-h nil t))
|
||||
|
||||
;;;###autoload
|
||||
(defalias '+format|buffer #'+format/buffer
|
||||
(defalias '+format-buffer-h #'+format/buffer
|
||||
"Format the source code in the current buffer with minimal feedback.
|
||||
|
||||
Meant for `before-save-hook'.")
|
||||
|
|
|
@ -25,7 +25,7 @@ Indentation is always preserved when formatting regions.")
|
|||
;;
|
||||
;;; Bootstrap
|
||||
|
||||
(defun +format|enable-on-save-maybe ()
|
||||
(defun +format-enable-on-save-maybe-h ()
|
||||
"Enable formatting on save in certain major modes.
|
||||
|
||||
This is controlled by `+format-on-save-enabled-modes'."
|
||||
|
@ -39,7 +39,7 @@ This is controlled by `+format-on-save-enabled-modes'."
|
|||
(format-all-mode +1)))
|
||||
|
||||
(when (featurep! +onsave)
|
||||
(add-hook 'after-change-major-mode-hook #'+format|enable-on-save-maybe))
|
||||
(add-hook 'after-change-major-mode-hook #'+format-enable-on-save-maybe-h))
|
||||
|
||||
|
||||
;;
|
||||
|
@ -47,7 +47,7 @@ This is controlled by `+format-on-save-enabled-modes'."
|
|||
|
||||
;; Allow a specific formatter to be used by setting `+format-with', either
|
||||
;; buffer-locally or let-bound.
|
||||
(advice-add #'format-all--probe :around #'+format*probe)
|
||||
(advice-add #'format-all--probe :around #'+format-probe-a)
|
||||
|
||||
;; Doom uses a modded `format-all-buffer', which
|
||||
;; 1. Enables partial reformatting (while preserving leading indentation),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; editor/lispy/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(def-package! lispy
|
||||
(use-package! lispy
|
||||
:hook ((common-lisp-mode . lispy-mode)
|
||||
(emacs-lisp-mode . lispy-mode)
|
||||
(scheme-mode . lispy-mode)
|
||||
|
@ -12,7 +12,7 @@
|
|||
(setq lispy-close-quotes-at-end-p t)
|
||||
(add-hook 'lispy-mode-hook #'turn-off-smartparens-mode))
|
||||
|
||||
(def-package! lispyville
|
||||
(use-package! lispyville
|
||||
:when (featurep! :editor evil)
|
||||
:hook (lispy-mode . lispyville-mode)
|
||||
:config
|
||||
|
|
|
@ -1,18 +1,27 @@
|
|||
;;; editor/multiple-cursors/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(def-package! evil-mc
|
||||
(use-package! evil-mc
|
||||
:when (featurep! :editor evil)
|
||||
:commands (evil-mc-make-cursor-here evil-mc-make-all-cursors
|
||||
evil-mc-undo-all-cursors evil-mc-pause-cursors
|
||||
evil-mc-resume-cursors evil-mc-make-and-goto-first-cursor
|
||||
:commands (evil-mc-make-cursor-here
|
||||
evil-mc-make-all-cursors
|
||||
evil-mc-undo-all-cursors
|
||||
evil-mc-pause-cursors
|
||||
evil-mc-resume-cursors
|
||||
evil-mc-make-and-goto-first-cursor
|
||||
evil-mc-make-and-goto-last-cursor
|
||||
evil-mc-make-cursor-move-next-line
|
||||
evil-mc-make-cursor-move-prev-line evil-mc-make-cursor-at-pos
|
||||
evil-mc-has-cursors-p evil-mc-make-and-goto-next-cursor
|
||||
evil-mc-skip-and-goto-next-cursor evil-mc-make-and-goto-prev-cursor
|
||||
evil-mc-skip-and-goto-prev-cursor evil-mc-make-and-goto-next-match
|
||||
evil-mc-skip-and-goto-next-match evil-mc-skip-and-goto-next-match
|
||||
evil-mc-make-and-goto-prev-match evil-mc-skip-and-goto-prev-match)
|
||||
evil-mc-make-cursor-move-prev-line
|
||||
evil-mc-make-cursor-at-pos
|
||||
evil-mc-has-cursors-p
|
||||
evil-mc-make-and-goto-next-cursor
|
||||
evil-mc-skip-and-goto-next-cursor
|
||||
evil-mc-make-and-goto-prev-cursor
|
||||
evil-mc-skip-and-goto-prev-cursor
|
||||
evil-mc-make-and-goto-next-match
|
||||
evil-mc-skip-and-goto-next-match
|
||||
evil-mc-skip-and-goto-next-match
|
||||
evil-mc-make-and-goto-prev-match
|
||||
evil-mc-skip-and-goto-prev-match)
|
||||
:init
|
||||
(defvar evil-mc-key-map (make-sparse-keymap))
|
||||
:config
|
||||
|
@ -39,13 +48,13 @@
|
|||
;; disable evil-escape in evil-mc; causes unwanted text on invocation
|
||||
(add-to-list 'evil-mc-incompatible-minor-modes 'evil-escape-mode nil #'eq)
|
||||
|
||||
(defun +multiple-cursors|escape-multiple-cursors ()
|
||||
"Clear evil-mc cursors and restore state."
|
||||
(when (evil-mc-has-cursors-p)
|
||||
(evil-mc-undo-all-cursors)
|
||||
(evil-mc-resume-cursors)
|
||||
t))
|
||||
(add-hook 'doom-escape-hook #'+multiple-cursors|escape-multiple-cursors)
|
||||
(add-hook! 'doom-escape-hook
|
||||
(defun +multiple-cursors-escape-multiple-cursors-h ()
|
||||
"Clear evil-mc cursors and restore state."
|
||||
(when (evil-mc-has-cursors-p)
|
||||
(evil-mc-undo-all-cursors)
|
||||
(evil-mc-resume-cursors)
|
||||
t)))
|
||||
|
||||
;; Forward declare these so that ex completion and evil-mc support is
|
||||
;; recognized before the autoloaded functions are loaded.
|
||||
|
@ -71,45 +80,45 @@
|
|||
(defvar +mc--compat-evil-prev-state nil)
|
||||
(defvar +mc--compat-mark-was-active nil)
|
||||
|
||||
(defun +multiple-cursors|compat-switch-to-emacs-state ()
|
||||
(when (and (bound-and-true-p evil-mode)
|
||||
(not (memq evil-state '(insert emacs))))
|
||||
(setq +mc--compat-evil-prev-state evil-state)
|
||||
(when (region-active-p)
|
||||
(setq +mc--compat-mark-was-active t))
|
||||
(let ((mark-before (mark))
|
||||
(point-before (point)))
|
||||
(evil-emacs-state 1)
|
||||
(when (or +mc--compat-mark-was-active (region-active-p))
|
||||
(goto-char point-before)
|
||||
(set-mark mark-before)))))
|
||||
(add-hook 'multiple-cursors-mode-enabled-hook #'+multiple-cursors|compat-switch-to-emacs-state)
|
||||
(add-hook! 'multiple-cursors-mode-enabled-hook
|
||||
(defun +multiple-cursors-compat-switch-to-emacs-state-h ()
|
||||
(when (and (bound-and-true-p evil-mode)
|
||||
(not (memq evil-state '(insert emacs))))
|
||||
(setq +mc--compat-evil-prev-state evil-state)
|
||||
(when (region-active-p)
|
||||
(setq +mc--compat-mark-was-active t))
|
||||
(let ((mark-before (mark))
|
||||
(point-before (point)))
|
||||
(evil-emacs-state 1)
|
||||
(when (or +mc--compat-mark-was-active (region-active-p))
|
||||
(goto-char point-before)
|
||||
(set-mark mark-before))))))
|
||||
|
||||
(defun +multiple-cursors|compat-back-to-previous-state ()
|
||||
(when +mc--compat-evil-prev-state
|
||||
(unwind-protect
|
||||
(case +mc--compat-evil-prev-state
|
||||
((normal visual) (evil-force-normal-state))
|
||||
(t (message "Don't know how to handle previous state: %S"
|
||||
+mc--compat-evil-prev-state)))
|
||||
(setq +mc--compat-evil-prev-state nil)
|
||||
(setq +mc--compat-mark-was-active nil))))
|
||||
(add-hook 'multiple-cursors-mode-disabled-hook #'+multiple-cursors|compat-back-to-previous-state)
|
||||
(add-hook! 'multiple-cursors-mode-disabled-hook
|
||||
(defun +multiple-cursors-compat-back-to-previous-state-h ()
|
||||
(when +mc--compat-evil-prev-state
|
||||
(unwind-protect
|
||||
(case +mc--compat-evil-prev-state
|
||||
((normal visual) (evil-force-normal-state))
|
||||
(t (message "Don't know how to handle previous state: %S"
|
||||
+mc--compat-evil-prev-state)))
|
||||
(setq +mc--compat-evil-prev-state nil)
|
||||
(setq +mc--compat-mark-was-active nil)))))
|
||||
|
||||
;; When running edit-lines, point will return (position + 1) as a
|
||||
;; result of how evil deals with regions
|
||||
(defun +multiple-cursors*adjust-mark-for-evil (&rest _)
|
||||
;; When running edit-lines, point will return (position + 1) as a result of
|
||||
;; how evil deals with regions
|
||||
(defadvice! +multiple--cursors-adjust-mark-for-evil-a (&rest _)
|
||||
:before #'mc/edit-lines
|
||||
(when (and (bound-and-true-p evil-mode)
|
||||
(not (memq evil-state '(insert emacs))))
|
||||
(if (> (point) (mark))
|
||||
(goto-char (1- (point)))
|
||||
(push-mark (1- (mark))))))
|
||||
(advice-add #'mc/edit-lines :before #'+multiple-cursors*adjust-mark-for-evil)
|
||||
|
||||
(defun +multiple-cursors|evil-compat-rect-switch-state ()
|
||||
(if rectangular-region-mode
|
||||
(+multiple-cursors|compat-switch-to-emacs-state)
|
||||
(setq +mc--compat-evil-prev-state nil)))
|
||||
(add-hook 'rectangular-region-mode-hook '+multiple-cursors|evil-compat-rect-switch-state)
|
||||
(add-hook! 'rectangular-region-mode-hook
|
||||
(defun +multiple-cursors-evil-compat-rect-switch-state-h ()
|
||||
(if rectangular-region-mode
|
||||
(+multiple-cursors-compat-switch-to-emacs-state-h)
|
||||
(setq +mc--compat-evil-prev-state nil))))
|
||||
|
||||
(defvar mc--default-cmds-to-run-once nil)))
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
;;; editor/objed/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(def-package! objed
|
||||
(use-package! objed
|
||||
: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)
|
||||
|
@ -11,21 +10,20 @@
|
|||
|
||||
(defvar +objed--extra-face-remaps nil)
|
||||
|
||||
(defun +objed*add-face-remaps (&rest _)
|
||||
(defadvice! +objed--add-face-remaps-a (&rest _)
|
||||
"Add extra face remaps when objed activates."
|
||||
:after 'objed--init
|
||||
(when (memq 'objed-hl (assq 'hl-line face-remapping-alist))
|
||||
(push (face-remap-add-relative 'solaire-hl-line-face 'objed-hl)
|
||||
+objed--extra-face-remaps)))
|
||||
|
||||
(defun +objed*remove-face-remaps (&rest _)
|
||||
(defadvice! +objed--remove-face-remaps-a (&rest _)
|
||||
"Remove extra face remaps when objed de-activates."
|
||||
:after 'objed--reset
|
||||
(unless (memq 'objed-hl (assq 'hl-line face-remapping-alist))
|
||||
(dolist (remap +objed--extra-face-remaps)
|
||||
(face-remap-remove-relative remap))
|
||||
(setq +objed--extra-face-remaps nil)))
|
||||
|
||||
(advice-add 'objed--init :after #'+objed*add-face-remaps)
|
||||
(advice-add 'objed--reset :after #'+objed*remove-face-remaps)
|
||||
|
||||
(unless (featurep! +manual)
|
||||
(objed-mode +1)))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; editor/parinfer/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(def-package! parinfer
|
||||
(use-package! parinfer
|
||||
:hook ((emacs-lisp-mode clojure-mode scheme-mode lisp-mode) . parinfer-mode)
|
||||
:init
|
||||
(setq parinfer-extensions
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
`rotate-text' will cycle through."
|
||||
(declare (indent defun))
|
||||
(dolist (mode (doom-enlist modes))
|
||||
(let ((fn-name (intern (format "+rotate-text|init-%s" mode))))
|
||||
(let ((fn-name (intern (format "+rotate-text-init-%s-h" mode))))
|
||||
(fset fn-name
|
||||
(lambda ()
|
||||
(setq-local rotate-text-local-symbols symbols)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; editor/rotate-text/packages.el
|
||||
|
||||
(package! rotate-text :recipe (:fetcher github :repo "debug-ito/rotate-text.el"))
|
||||
(package! rotate-text :recipe (:host github :repo "debug-ito/rotate-text.el"))
|
||||
|
|
|
@ -19,7 +19,7 @@ you will be prompted to select one.
|
|||
If there are conflicting keys across the two camps, the built-in ones are
|
||||
ignored. This makes it easy to override built-in snippets with private ones."
|
||||
(when (eq this-command 'yas-expand)
|
||||
(let* ((gc-cons-threshold doom-gc-cons-upper-limit)
|
||||
(let* ((gc-cons-threshold most-positive-fixnum)
|
||||
(choices (cl-remove-duplicates choices :test #'+snippets--remove-p)))
|
||||
(if (cdr choices)
|
||||
(cl-loop for fn in (cdr (memq '+snippets-prompt-private yas-prompt-functions))
|
||||
|
@ -256,7 +256,7 @@ shadow the default snippet)."
|
|||
+snippets-dir))))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +snippets|show-hints-in-header-line ()
|
||||
(defun +snippets-show-hints-in-header-line-h ()
|
||||
(setq header-line-format
|
||||
(substitute-command-keys
|
||||
(concat "\\[yas-load-snippet-buffer-and-close] to finish, "
|
||||
|
@ -268,7 +268,7 @@ shadow the default snippet)."
|
|||
;;; Hooks
|
||||
|
||||
;;;###autoload
|
||||
(defun +snippets|enable-project-modes (mode &rest _)
|
||||
(defun +snippets-enable-project-modes-h (mode &rest _)
|
||||
"Automatically enable snippet libraries for project minor modes defined with
|
||||
`def-project-mode!'."
|
||||
(if (symbol-value mode)
|
||||
|
@ -276,7 +276,7 @@ shadow the default snippet)."
|
|||
(yas-deactivate-extra-mode mode)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +snippets|read-only-maybe ()
|
||||
(defun +snippets-read-only-maybe-h ()
|
||||
"Enable `read-only-mode' if snippet is built-in."
|
||||
(when (file-in-directory-p default-directory doom-local-dir)
|
||||
(read-only-mode 1)
|
||||
|
@ -287,7 +287,7 @@ shadow the default snippet)."
|
|||
;;; Advice
|
||||
|
||||
;;;###autoload
|
||||
(defun +snippets*expand-on-region (orig-fn &optional no-condition)
|
||||
(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.
|
||||
|
||||
|
|
|
@ -7,22 +7,31 @@
|
|||
;;
|
||||
;; Packages
|
||||
|
||||
(def-package! yasnippet
|
||||
:commands (yas-minor-mode-on yas-expand yas-expand-snippet yas-lookup-snippet
|
||||
yas-insert-snippet yas-new-snippet yas-visit-snippet-file)
|
||||
(use-package! yasnippet
|
||||
:commands (yas-minor-mode-on
|
||||
yas-expand
|
||||
yas-expand-snippet
|
||||
yas-lookup-snippet
|
||||
yas-insert-snippet
|
||||
yas-new-snippet
|
||||
yas-visit-snippet-file)
|
||||
:init
|
||||
;; 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 prog-mode conf-mode snippet-mode)
|
||||
#'yas-minor-mode-on)
|
||||
(add-hook! '(text-mode-hook
|
||||
prog-mode-hook
|
||||
conf-mode-hook
|
||||
snippet-mode-hook)
|
||||
#'yas-minor-mode-on)
|
||||
|
||||
:config
|
||||
(setq yas-verbosity (if doom-debug-mode 3 0)
|
||||
yas-also-auto-indent-first-line t
|
||||
;; Remove default ~/.emacs.d/snippets
|
||||
yas-snippet-dirs (delete yas--default-user-snippets-dir yas-snippet-dirs))
|
||||
yas-snippet-dirs (delete yas--default-user-snippets-dir
|
||||
yas-snippet-dirs))
|
||||
|
||||
;; default snippets library, if available
|
||||
(require 'doom-snippets nil t)
|
||||
|
@ -31,14 +40,14 @@
|
|||
(add-to-list 'yas-snippet-dirs '+snippets-dir nil #'eq)
|
||||
|
||||
;; Remove GUI dropdown prompt (prefer ivy/helm)
|
||||
(setq yas-prompt-functions (delq 'yas-dropdown-prompt yas-prompt-functions))
|
||||
(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)
|
||||
|
||||
;; Register `def-project-mode!' modes with yasnippet. This enables project
|
||||
;; specific snippet libraries (e.g. for Laravel, React or Jekyll projects).
|
||||
(add-hook 'doom-project-hook #'+snippets|enable-project-modes)
|
||||
(add-hook 'doom-project-hook #'+snippets-enable-project-modes-h)
|
||||
|
||||
;; Exit snippets on ESC from normal mode
|
||||
(add-hook 'doom-escape-hook #'yas-abort-snippet)
|
||||
|
@ -48,16 +57,16 @@
|
|||
(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)
|
||||
(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)
|
||||
(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)
|
||||
(add-hook 'snippet-mode-hook #'+snippets|show-hints-in-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
|
||||
|
@ -65,5 +74,15 @@
|
|||
[remap yas-visit-snippet-file] #'+snippets/edit))
|
||||
|
||||
|
||||
;;;###package auto-yasnippet
|
||||
(setq aya-persist-snippets-dir (concat doom-etc-dir "auto-snippets/"))
|
||||
(use-package! auto-yasnippet
|
||||
:defer t
|
||||
:init (setq aya-persist-snippets-dir (concat doom-etc-dir "auto-snippets/"))
|
||||
:config
|
||||
(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
|
||||
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))
|
||||
(apply orig-fn args))))
|
||||
|
|
|
@ -5,6 +5,6 @@
|
|||
(package! auto-yasnippet)
|
||||
|
||||
(package! doom-snippets
|
||||
:recipe (:fetcher github
|
||||
:recipe (:host github
|
||||
:repo "hlissner/doom-snippets"
|
||||
:files ("*.el" "snippets")))
|
||||
|
|
73
modules/editor/word-wrap/README.org
Normal file
73
modules/editor/word-wrap/README.org
Normal file
|
@ -0,0 +1,73 @@
|
|||
#+TITLE: editor/word-wrap
|
||||
#+DATE: August 26, 2019
|
||||
#+SINCE: v2.1
|
||||
|
||||
* Table of Contents :TOC_3:noexport:
|
||||
- [[#description][Description]]
|
||||
- [[#module-flags][Module Flags]]
|
||||
- [[#plugins][Plugins]]
|
||||
- [[#configuration][Configuration]]
|
||||
|
||||
* Description
|
||||
This module adds a minor-mode ~+word-wrap-mode~, which intelligently wraps long
|
||||
lines in the buffer without modifying the buffer content.
|
||||
|
||||
Wrapped lines will be indented to match the preceding line. Lines which are not
|
||||
inside a comment will have extra indentation as determined by
|
||||
~+word-wrap-extra-indent~. The default is to increase the indent by twice the
|
||||
major-mode indent.
|
||||
|
||||
The ~+word-wrap-extra-indent~ variable supports the following values:
|
||||
- ~double~: indent by twice the major-mode indentation
|
||||
- ~single~: indent by the major-mode indentation
|
||||
- a positive integer: indent by this fixed amount
|
||||
- a negative integer: dedent by this fixed amount
|
||||
- ~nil~: no extra indent
|
||||
|
||||
This module also includes a global minor-mode ~+global-word-wrap-mode~ to
|
||||
automatically enable wrapping in most buffers. Wrapping will not be enabled in
|
||||
buffers whose major mode is marked "special", or are listed in
|
||||
~+word-wrap-disabled-modes~.
|
||||
|
||||
** Module Flags
|
||||
This module provides no flags.
|
||||
|
||||
** Plugins
|
||||
+ [[https://elpa.gnu.org/packages/adaptive-wrap.html][adaptive-wrap]]
|
||||
|
||||
* Configuration
|
||||
Word wrapping is not enabled by default.
|
||||
|
||||
Wrapping can be toggled in the current buffer with ~M-x +word-wrap-mode~. The
|
||||
default doom bindings bind this to ~SPC t w~ for ~evil~ users.
|
||||
|
||||
To enable wrapping in a specific mode, add it to the appropriate hook in your
|
||||
~config.el~:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; enable word-wrap in C/C++/ObjC/Java
|
||||
(add-hook 'c-mode-common-hook #'+word-wrap-mode)
|
||||
#+END_SRC
|
||||
|
||||
To customize the extra indent for a specific mode:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; enable word-wrap with fixed extra 2 spaces in org-mode
|
||||
(add-hook! 'org-mode-hook
|
||||
(setq-local +word-wrap-extra-indent 2)
|
||||
(+word-wrap-mode +1))
|
||||
#+END_SRC
|
||||
|
||||
To turn on word wrapping (almost) everywhere:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; enable word-wrap (almost) everywhere
|
||||
(+global-word-wrap-mode +1)
|
||||
#+END_SRC
|
||||
|
||||
To disable global word-wrapping in a specific mode:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
;; disable global word-wrap in emacs-lisp-mode
|
||||
(add-to-list '+word-wrap-disabled-modes 'emacs-lisp-mode)
|
||||
#+END_SRC
|
76
modules/editor/word-wrap/autoload.el
Normal file
76
modules/editor/word-wrap/autoload.el
Normal file
|
@ -0,0 +1,76 @@
|
|||
;;; editor/word-wrap/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +word-wrap--prev-adaptive-wrap-mode nil)
|
||||
(defvar +word-wrap--prev-visual-line-mode nil)
|
||||
(defvar +word-wrap--major-mode-indent-var nil)
|
||||
|
||||
(defun +word-wrap--adjust-extra-indent-a (orig-fn beg end)
|
||||
"Contextually adjust extra word-wrap indentation."
|
||||
(let ((adaptive-wrap-extra-indent (+word-wrap--calc-extra-indent beg)))
|
||||
(funcall orig-fn beg end)))
|
||||
|
||||
(defun +word-wrap--calc-extra-indent (p)
|
||||
"Calculate extra word-wrap indentation at point."
|
||||
(if (not (sp-point-in-comment p))
|
||||
(pcase +word-wrap-extra-indent
|
||||
('double
|
||||
(* 2 (symbol-value +word-wrap--major-mode-indent-var)))
|
||||
('single
|
||||
(symbol-value +word-wrap--major-mode-indent-var))
|
||||
((and (pred integerp) fixed)
|
||||
fixed)
|
||||
(_ 0))
|
||||
0))
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode +word-wrap-mode
|
||||
"Wrap long lines in the buffer with language-aware indentation.
|
||||
|
||||
This mode configures `adaptive-wrap' and `visual-line-mode' to wrap long lines
|
||||
without modifying the buffer content. This is useful when dealing with legacy
|
||||
code which contains gratuitously long lines, or running emacs on your
|
||||
wrist-phone.
|
||||
|
||||
Wrapped lines will be indented to match the preceding line. Lines which are not
|
||||
inside a comment will have additional indentation according to the configuration
|
||||
of `+word-wrap-extra-indent'."
|
||||
:init-value nil
|
||||
(if +word-wrap-mode
|
||||
(progn
|
||||
(require 'adaptive-wrap)
|
||||
(require 'dtrt-indent) ; for dtrt-indent--search-hook-mapping
|
||||
(require 'smartparens) ; for sp-point-in-string-or-comment
|
||||
|
||||
(setq-local +word-wrap--prev-adaptive-wrap-mode adaptive-wrap-prefix-mode)
|
||||
(setq-local +word-wrap--prev-visual-line-mode visual-line-mode)
|
||||
(setq-local +word-wrap--major-mode-indent-var
|
||||
(caddr (dtrt-indent--search-hook-mapping major-mode)))
|
||||
|
||||
(advice-add #'adaptive-wrap-fill-context-prefix :around #'+word-wrap--adjust-extra-indent-a)
|
||||
|
||||
(unless +word-wrap--prev-adaptive-wrap-mode
|
||||
(adaptive-wrap-prefix-mode +1))
|
||||
(unless +word-wrap--prev-visual-line-mode
|
||||
(visual-line-mode +1)))
|
||||
|
||||
;; disable +word-wrap-mode
|
||||
(advice-remove #'adaptive-wrap-fill-context-prefix #'+word-wrap--adjust-extra-indent-a)
|
||||
|
||||
(unless +word-wrap--prev-adaptive-wrap-mode
|
||||
(adaptive-wrap-prefix-mode -1))
|
||||
(unless +word-wrap--prev-visual-line-mode
|
||||
(visual-line-mode -1))))
|
||||
|
||||
(defun +word-wrap--enable-global-mode ()
|
||||
"Enable `+word-wrap-mode' for `+word-wrap-global-mode'.
|
||||
|
||||
Wrapping will be automatically enabled in all modes except special modes, or
|
||||
modes explicitly listed in `+word-wrap-disabled-modes'."
|
||||
(unless (or (eq (get major-mode 'mode-class) 'special)
|
||||
(memq major-mode +word-wrap-disabled-modes))
|
||||
(+word-wrap-mode +1)))
|
||||
|
||||
;;;###autoload
|
||||
(define-globalized-minor-mode +global-word-wrap-mode
|
||||
+word-wrap-mode
|
||||
+word-wrap--enable-global-mode)
|
15
modules/editor/word-wrap/config.el
Normal file
15
modules/editor/word-wrap/config.el
Normal file
|
@ -0,0 +1,15 @@
|
|||
;;; editor/word-wrap/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +word-wrap-extra-indent 'double
|
||||
"The amount of extra indentation for wrapped non-comment lines.
|
||||
|
||||
When 'double, indent by twice the major-mode indentation.
|
||||
When 'single, indent by the major-mode indentation.
|
||||
When a positive integer, indent by this fixed amount.
|
||||
When a negative integer, dedent by this fixed amount.
|
||||
Otherwise no extra indentation will be used.")
|
||||
|
||||
(defvar +word-wrap-disabled-modes
|
||||
'(fundamental-mode so-long-mode)
|
||||
"Major-modes where `+global-word-wrap-mode' should not enable
|
||||
`+word-wrap-mode'.")
|
4
modules/editor/word-wrap/packages.el
Normal file
4
modules/editor/word-wrap/packages.el
Normal file
|
@ -0,0 +1,4 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; editor/word-wrap/packages.el
|
||||
|
||||
(package! adaptive-wrap)
|
46
modules/emacs/dired/README.org
Normal file
46
modules/emacs/dired/README.org
Normal file
|
@ -0,0 +1,46 @@
|
|||
#+TITLE: emacs/dired
|
||||
#+DATE: May 27, 2018
|
||||
#+SINCE: v2.0
|
||||
#+STARTUP: inlineimages
|
||||
|
||||
* Table of Contents :TOC_3:noexport:
|
||||
- [[#description][Description]]
|
||||
- [[#module-flags][Module Flags]]
|
||||
- [[#plugins][Plugins]]
|
||||
- [[#prerequisites][Prerequisites]]
|
||||
- [[#keybindings][Keybindings]]
|
||||
|
||||
* Description
|
||||
|
||||
This module provides configuration for dired.
|
||||
|
||||
** Module Flags
|
||||
|
||||
+ =+ranger= Enables dired to be more like [[https://github.com/ranger/ranger][ranger]].
|
||||
+ =+icons= Enables the display of fancy icons depending on file types in dired
|
||||
buffers.
|
||||
|
||||
** Plugins
|
||||
+ [[https:https://github.com/syohex/emacs-dired-k][dired-k]]
|
||||
+ [[https://github.com/purcell/diredfl][diredfl]]
|
||||
+ [[https://github.com/stsquad/dired-rsync][dired-rsync]]
|
||||
+ =+ranger=
|
||||
+ [[https://github.com/ralesi/ranger.el][ranger]]
|
||||
+ =+icons=
|
||||
+ [[https://github.com/jtbm37/all-the-icons-dired][all-the-icons-dired]]
|
||||
|
||||
* Prerequisites
|
||||
|
||||
This module has no prerequisites *except on BSDs* where =GNU ls= (~gls~) is
|
||||
needed for it to work properly (Doom doctor will notify you if it is missing).
|
||||
|
||||
* Keybindings
|
||||
|
||||
| Keybind | Description |
|
||||
|-----------+------------------------------|
|
||||
| =SPC f d= | Find directory with dired |
|
||||
| =q= | Exit dired buffer |
|
||||
| =C-c C-r= | Run =dired-rsync= |
|
||||
| =C-c C-e= | Rename entries with =wdired= |
|
||||
|
||||
Other keybindings can be found on the official [[https://www.gnu.org/software/emacs/refcards/pdf/dired-ref.pdf][Dired reference card]].
|
|
@ -1,11 +1,15 @@
|
|||
;;; tools/dired/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(def-package! dired
|
||||
(use-package! dired
|
||||
:commands dired-jump
|
||||
:init
|
||||
(setq ;; Always copy/delete recursively
|
||||
dired-recursive-copies 'always
|
||||
dired-recursive-deletes 'top
|
||||
;; Instantly revert Dired buffers on re-visiting them, with no message.
|
||||
;; (A message is shown if insta-revert is either disabled or determined
|
||||
;; dynamically by setting this variable to a function.)
|
||||
dired-auto-revert-buffer t
|
||||
;; Auto refresh dired, but be quiet about it
|
||||
dired-hide-details-hide-symlink-targets nil
|
||||
;; files
|
||||
|
@ -33,15 +37,15 @@
|
|||
"C-c C-e" #'wdired-change-to-wdired-mode))
|
||||
|
||||
|
||||
(def-package! dired-rsync
|
||||
(use-package! dired-rsync
|
||||
:general (dired-mode-map "C-c C-r" #'dired-rsync))
|
||||
|
||||
|
||||
(def-package! diredfl
|
||||
(use-package! diredfl
|
||||
:hook (dired-mode . diredfl-mode))
|
||||
|
||||
|
||||
(def-package! diff-hl
|
||||
(use-package! diff-hl
|
||||
:hook (dired-mode . diff-hl-dired-mode)
|
||||
:init
|
||||
(when (featurep! :tools magit)
|
||||
|
@ -51,7 +55,7 @@
|
|||
(diff-hl-margin-mode))
|
||||
|
||||
|
||||
(def-package! ranger
|
||||
(use-package! ranger
|
||||
:when (featurep! +ranger)
|
||||
:after dired
|
||||
:init
|
||||
|
@ -64,24 +68,24 @@
|
|||
|
||||
(set-popup-rule! "^\\*ranger" :ignore t)
|
||||
|
||||
(defun +dired*cleanup-header-line ()
|
||||
(defadvice! +dired--cleanup-header-line-a ()
|
||||
"Ranger fails to clean up `header-line-format' when it is closed, so..."
|
||||
:before #'ranger-revert
|
||||
(dolist (buffer (buffer-list))
|
||||
(when (buffer-live-p buffer)
|
||||
(with-current-buffer buffer
|
||||
(when (equal header-line-format '(:eval (ranger-header-line)))
|
||||
(setq header-line-format nil))))))
|
||||
(advice-add #'ranger-revert :before #'+dired*cleanup-header-line)
|
||||
|
||||
(defun +dired*cleanup-mouse1-bind ()
|
||||
(defadvice! +dired--cleanup-mouse1-bind-a ()
|
||||
"Ranger binds an anonymous function to mouse-1 after previewing a buffer
|
||||
that prevents the user from escaping the window with the mouse. This command is
|
||||
never cleaned up if the buffer already existed before ranger was initialized, so
|
||||
we have to clean it up ourselves."
|
||||
:after #'ranger-setup-preview
|
||||
(when (window-live-p ranger-preview-window)
|
||||
(with-current-buffer (window-buffer ranger-preview-window)
|
||||
(local-unset-key [mouse-1]))))
|
||||
(advice-add #'ranger-setup-preview :after #'+dired*cleanup-mouse1-bind)
|
||||
|
||||
(setq ranger-cleanup-on-disable t
|
||||
ranger-excluded-extensions '("mkv" "iso" "mp4")
|
||||
|
@ -91,13 +95,16 @@ we have to clean it up ourselves."
|
|||
ranger-hide-cursor nil))
|
||||
|
||||
|
||||
(def-package! all-the-icons-dired
|
||||
(use-package! all-the-icons-dired
|
||||
:when (featurep! +icons)
|
||||
:hook (dired-mode . all-the-icons-dired-mode))
|
||||
|
||||
|
||||
(def-package! dired-x
|
||||
(use-package! dired-x
|
||||
:unless (featurep! +ranger)
|
||||
:hook (dired-mode . dired-omit-mode)
|
||||
:config
|
||||
(setq dired-omit-verbose nil))
|
||||
(setq dired-omit-verbose nil)
|
||||
;; Disable the prompt about whether I want to kill the Dired buffer for a
|
||||
;; deleted directory. Of course I do!
|
||||
(setq dired-clean-confirm-killing-deleted-buffers nil))
|
||||
|
|
|
@ -10,10 +10,9 @@ current line.")
|
|||
(after! electric
|
||||
(setq-default electric-indent-chars '(?\n ?\^?))
|
||||
|
||||
(defun +electric-indent|char (_c)
|
||||
(when (and (eolp) +electric-indent-words)
|
||||
(save-excursion
|
||||
(backward-word)
|
||||
(looking-at-p (concat "\\<" (regexp-opt +electric-indent-words))))))
|
||||
(add-to-list 'electric-indent-functions #'+electric-indent|char nil #'eq))
|
||||
|
||||
(add-hook! 'electric-indent-functions
|
||||
(defun +electric-indent-char-fn (_c)
|
||||
(when (and (eolp) +electric-indent-words)
|
||||
(save-excursion
|
||||
(backward-word)
|
||||
(looking-at-p (concat "\\<" (regexp-opt +electric-indent-words))))))))
|
||||
|
|
41
modules/emacs/vc/autoload/hydra.el
Normal file
41
modules/emacs/vc/autoload/hydra.el
Normal file
|
@ -0,0 +1,41 @@
|
|||
;;; emacs/vc/autoload/hydra.el -*- lexical-binding: t; -*-
|
||||
;;;###if (featurep! :ui hydra)
|
||||
|
||||
;;;###autoload (autoload '+vc/smerge-hydra/body "emacs/vc/autoload/hydra" nil t)
|
||||
(defhydra +vc/smerge-hydra (:hint nil
|
||||
:pre (if (not smerge-mode) (smerge-mode 1))
|
||||
;; Disable `smerge-mode' when quitting hydra if
|
||||
;; no merge conflicts remain.
|
||||
:post (smerge-auto-leave))
|
||||
"
|
||||
[smerge]
|
||||
Movement Keep Diff Other
|
||||
╭─────────────────────────────────────────────────────────╯
|
||||
^_g_^ [_b_] base [_<_] upper/base [_C_] Combine
|
||||
^_C-k_^ [_u_] upper [_=_] upper/lower [_r_] resolve
|
||||
^_k_ ↑^ [_l_] lower [_>_] base/lower [_R_] remove
|
||||
^_j_ ↓^ [_a_] all [_H_] hightlight
|
||||
^_C-j_^ [_RET_] current [_E_] ediff ╭──────────
|
||||
^_G_^ │ [_q_] quit
|
||||
"
|
||||
("g" (progn (goto-char (point-min)) (smerge-next)))
|
||||
("G" (progn (goto-char (point-max)) (smerge-prev)))
|
||||
("C-j" smerge-next)
|
||||
("C-k" smerge-prev)
|
||||
("j" next-line)
|
||||
("k" previous-line)
|
||||
("b" smerge-keep-base)
|
||||
("u" smerge-keep-upper)
|
||||
("l" smerge-keep-lower)
|
||||
("a" smerge-keep-all)
|
||||
("RET" smerge-keep-current)
|
||||
("\C-m" smerge-keep-current)
|
||||
("<" smerge-diff-base-upper)
|
||||
("=" smerge-diff-upper-lower)
|
||||
(">" smerge-diff-base-lower)
|
||||
("H" smerge-refine)
|
||||
("E" smerge-ediff)
|
||||
("C" smerge-combine-with-next)
|
||||
("r" smerge-resolve)
|
||||
("R" smerge-kill-current)
|
||||
("q" nil :color blue))
|
|
@ -26,7 +26,7 @@ repository root."
|
|||
(git-link (git-link--select-remote) beg end)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +vc*update-header-line (revision)
|
||||
(defun +vc-update-header-line-a (revision)
|
||||
"Show revision details in the header-line, instead of the minibuffer.
|
||||
|
||||
Sometimes I forget `git-timemachine' is enabled in a buffer. Putting revision
|
||||
|
@ -40,42 +40,3 @@ info in the `header-line-format' is a good indication."
|
|||
(propertize author 'face 'git-timemachine-minibuffer-author-face)
|
||||
(propertize sha-or-subject 'face 'git-timemachine-minibuffer-detail-face)
|
||||
date-full date-relative))))
|
||||
|
||||
;;;###autoload (autoload '+vc-smerge-hydra/body "emacs/vc/autoload/vc" nil t)
|
||||
(defhydra +vc-smerge-hydra (:hint nil
|
||||
:pre (if (not smerge-mode) (smerge-mode 1))
|
||||
;; Disable `smerge-mode' when quitting hydra if
|
||||
;; no merge conflicts remain.
|
||||
:post (smerge-auto-leave))
|
||||
"
|
||||
[smerge]
|
||||
Movement Keep Diff Other
|
||||
╭─────────────────────────────────────────────────────────╯
|
||||
^_g_^ [_b_] base [_<_] upper/base [_C_] Combine
|
||||
^_C-k_^ [_u_] upper [_=_] upper/lower [_r_] resolve
|
||||
^_k_ ↑^ [_l_] lower [_>_] base/lower [_R_] remove
|
||||
^_j_ ↓^ [_a_] all [_H_] hightlight
|
||||
^_C-j_^ [_RET_] current [_E_] ediff ╭──────────
|
||||
^_G_^ │ [_q_] quit
|
||||
"
|
||||
("g" (progn (goto-char (point-min)) (smerge-next)))
|
||||
("G" (progn (goto-char (point-max)) (smerge-prev)))
|
||||
("C-j" smerge-next)
|
||||
("C-k" smerge-prev)
|
||||
("j" next-line)
|
||||
("k" previous-line)
|
||||
("b" smerge-keep-base)
|
||||
("u" smerge-keep-upper)
|
||||
("l" smerge-keep-lower)
|
||||
("a" smerge-keep-all)
|
||||
("RET" smerge-keep-current)
|
||||
("\C-m" smerge-keep-current)
|
||||
("<" smerge-diff-base-upper)
|
||||
("=" smerge-diff-upper-lower)
|
||||
(">" smerge-diff-base-lower)
|
||||
("H" smerge-refine)
|
||||
("E" smerge-ediff)
|
||||
("C" smerge-combine-with-next)
|
||||
("r" smerge-resolve)
|
||||
("R" smerge-kill-current)
|
||||
("q" nil :color blue))
|
||||
|
|
|
@ -1,59 +1,13 @@
|
|||
;;; emacs/vc/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(setq vc-make-backup-files nil)
|
||||
(when IS-WINDOWS
|
||||
(setenv "GIT_ASKPASS" "git-gui--askpass"))
|
||||
|
||||
|
||||
(after! git-timemachine
|
||||
;; HACK Waiting for https://gitlab.com/pidu/git-timemachine/issues/77
|
||||
(defun +vc*git-timemachine-show-commit ()
|
||||
(interactive)
|
||||
(let ((rev (car git-timemachine-revision)))
|
||||
(if (fboundp 'magit-revision-mode)
|
||||
(with-temp-buffer
|
||||
(save-excursion
|
||||
(magit-setup-buffer #'magit-revision-mode nil
|
||||
(magit-buffer-revision rev)
|
||||
(magit-buffer-range (format "%s^..%s" rev rev))
|
||||
(magit-buffer-diff-args nil)
|
||||
(magit-buffer-diff-files nil))))
|
||||
(message "You need to install magit to show commit"))))
|
||||
(advice-add #'git-timemachine-show-commit :override #'+vc*git-timemachine-show-commit)
|
||||
;;;###package vc
|
||||
(setq vc-make-backup-files nil
|
||||
vc-follow-symlinks t)
|
||||
|
||||
;; Sometimes I forget `git-timemachine' is enabled in a buffer, so instead of
|
||||
;; showing revision details in the minibuffer, show them in
|
||||
;; `header-line-format', which has better visibility.
|
||||
(setq git-timemachine-show-minibuffer-details t)
|
||||
(advice-add #'git-timemachine--show-minibuffer-details :override #'+vc*update-header-line)
|
||||
|
||||
(after! evil
|
||||
;; rehash evil keybindings so they are recognized
|
||||
(add-hook 'git-timemachine-mode-hook #'evil-normalize-keymaps))
|
||||
|
||||
(when (featurep! :tools magit)
|
||||
(add-transient-hook! #'git-timemachine-blame (require 'magit-blame))))
|
||||
|
||||
|
||||
;;;###package git-commit
|
||||
(def-package! git-commit
|
||||
:after-call after-find-file
|
||||
:config
|
||||
(global-git-commit-mode +1)
|
||||
(set-yas-minor-mode! 'git-commit-mode)
|
||||
|
||||
(defun +vc|enforce-git-commit-conventions ()
|
||||
"See https://chris.beams.io/posts/git-commit/"
|
||||
(setq fill-column 72
|
||||
git-commit-summary-max-length 50
|
||||
git-commit-style-convention-checks '(overlong-summary-line non-empty-second-line)))
|
||||
(add-hook 'git-commit-mode-hook #'+vc|enforce-git-commit-conventions)
|
||||
|
||||
(defun +vc|start-in-insert-state-maybe ()
|
||||
"Start git-commit-mode in insert state if in a blank commit message,
|
||||
otherwise in default state."
|
||||
(when (and (bound-and-true-p evil-mode)
|
||||
(bobp) (eolp))
|
||||
(evil-insert-state)))
|
||||
(add-hook 'git-commit-setup-hook #'+vc|start-in-insert-state-maybe))
|
||||
|
||||
(after! vc-annotate
|
||||
(set-popup-rules!
|
||||
|
@ -63,6 +17,47 @@ otherwise in default state."
|
|||
'(vc-annotate-mode vc-git-log-view-mode)
|
||||
'normal))
|
||||
|
||||
|
||||
(after! git-timemachine
|
||||
;; Sometimes I forget `git-timemachine' is enabled in a buffer, so instead of
|
||||
;; showing revision details in the minibuffer, show them in
|
||||
;; `header-line-format', which has better visibility.
|
||||
(setq git-timemachine-show-minibuffer-details t)
|
||||
(advice-add #'git-timemachine--show-minibuffer-details
|
||||
:override #'+vc-update-header-line-a)
|
||||
|
||||
(after! evil
|
||||
;; rehash evil keybindings so they are recognized
|
||||
(add-hook 'git-timemachine-mode-hook #'evil-normalize-keymaps))
|
||||
|
||||
(when (featurep! :tools magit)
|
||||
(add-transient-hook! #'git-timemachine-blame (require 'magit-blame)))
|
||||
|
||||
(map! :map git-timemachine-mode-map
|
||||
:n "gtc" #'git-timemachine-show-commit))
|
||||
|
||||
|
||||
(use-package! git-commit
|
||||
:after-call after-find-file
|
||||
:config
|
||||
(global-git-commit-mode +1)
|
||||
(set-yas-minor-mode! 'git-commit-mode)
|
||||
|
||||
;; Enforce git commit conventions.
|
||||
;; See https://chris.beams.io/posts/git-commit/
|
||||
(setq git-commit-summary-max-length 50
|
||||
git-commit-style-convention-checks '(overlong-summary-line non-empty-second-line))
|
||||
(setq-hook! 'git-commit-mode-hook fill-column 72)
|
||||
|
||||
(add-hook! 'git-commit-setup-hook
|
||||
(defun +vc-start-in-insert-state-maybe ()
|
||||
"Start git-commit-mode in insert state if in a blank commit message,
|
||||
otherwise in default state."
|
||||
(when (and (bound-and-true-p evil-mode)
|
||||
(bobp) (eolp))
|
||||
(evil-insert-state)))))
|
||||
|
||||
|
||||
(after! smerge-mode
|
||||
(unless EMACS26+
|
||||
(with-no-warnings
|
||||
|
|
|
@ -54,6 +54,17 @@ sudo pacman --noconfirm --needed -S mu
|
|||
sudo pacman -S isync # mbsync
|
||||
sudo pacman -S offlineimap
|
||||
#+END_SRC
|
||||
** NixOS
|
||||
#+BEGIN_SRC nix
|
||||
environment.systemPackages = with pkgs; [
|
||||
mu
|
||||
# And one of the following
|
||||
isync
|
||||
offlineimap
|
||||
];
|
||||
#+END_SRC
|
||||
|
||||
[[https://github.com/Emiller88/dotfiles/blob/master/modules/shell/mail.nix][An example of setting up mbsync with home-manager]]
|
||||
|
||||
* TODO Features
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ default/fallback account."
|
|||
(defvar +mu4e-workspace-name "*mu4e*"
|
||||
"TODO")
|
||||
|
||||
(add-hook 'mu4e-main-mode-hook #'+mu4e|init)
|
||||
(add-hook 'mu4e-main-mode-hook #'+mu4e-init-h)
|
||||
|
||||
;;;###autoload
|
||||
(defun =mu4e ()
|
||||
|
@ -69,10 +69,10 @@ default/fallback account."
|
|||
;;
|
||||
;; Hooks
|
||||
|
||||
(defun +mu4e|init ()
|
||||
(add-hook 'kill-buffer-hook #'+mu4e|kill-mu4e nil t))
|
||||
(defun +mu4e-init-h ()
|
||||
(add-hook 'kill-buffer-hook #'+mu4e-kill-mu4e-h nil t))
|
||||
|
||||
(defun +mu4e|kill-mu4e ()
|
||||
(defun +mu4e-kill-mu4e-h ()
|
||||
;; (prolusion-mail-hide)
|
||||
(when (+workspace-exists-p +mu4e-workspace-name)
|
||||
(+workspace/delete +mu4e-workspace-name)))
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
(add-to-list 'auto-mode-alist '("\\.\\(?:offlineimap\\|mbsync\\)rc\\'" . conf-mode))
|
||||
|
||||
|
||||
(def-package! mu4e
|
||||
:commands (mu4e mu4e-compose-new)
|
||||
(use-package! mu4e
|
||||
:commands mu4e mu4e-compose-new
|
||||
:init
|
||||
(provide 'html2text) ; disable obsolete package
|
||||
(setq mu4e-maildir "~/.mail"
|
||||
|
@ -88,9 +88,8 @@
|
|||
(let ((maildir (mu4e-message-field msg :maildir)))
|
||||
(format "%s" (substring maildir 1 (string-match-p "/" maildir 1)))))))
|
||||
|
||||
;; Refresh the current view after marks are executed
|
||||
(defun +mu4e*refresh (&rest _) (mu4e-headers-rerun-search))
|
||||
(advice-add #'mu4e-mark-execute-all :after #'+mu4e*refresh)
|
||||
(defadvice! +mu4e--refresh-current-view-a (&rest _)
|
||||
:after #'mu4e-mark-execute-all (mu4e-headers-rerun-search))
|
||||
|
||||
(when (featurep! :tools flyspell)
|
||||
(add-hook 'mu4e-compose-mode-hook #'flyspell-mode))
|
||||
|
@ -110,14 +109,14 @@
|
|||
'normal))
|
||||
|
||||
|
||||
(def-package! mu4e-maildirs-extension
|
||||
(use-package! mu4e-maildirs-extension
|
||||
:after mu4e
|
||||
:config
|
||||
(mu4e-maildirs-extension)
|
||||
(setq mu4e-maildirs-extension-title nil))
|
||||
|
||||
|
||||
(def-package! org-mu4e
|
||||
(use-package! org-mu4e
|
||||
:hook (mu4e-compose-mode . org-mu4e-compose-org-mode)
|
||||
:config
|
||||
(setq org-mu4e-link-query-in-headers-mode nil
|
||||
|
@ -152,7 +151,7 @@
|
|||
(defun +mu4e--mark-seen (docid _msg target)
|
||||
(mu4e~proc-move docid (mu4e~mark-check-target target) "+S-u-N"))
|
||||
|
||||
(delq (assq 'delete mu4e-marks) mu4e-marks)
|
||||
(delq! 'delete mu4e-marks #'assq)
|
||||
(setf (alist-get 'trash mu4e-marks)
|
||||
(list :char '("d" . "▼")
|
||||
:prompt "dtrash"
|
||||
|
@ -169,10 +168,10 @@
|
|||
;; Without it, refiling (archiving), trashing, and flagging (starring) email
|
||||
;; won't properly result in the corresponding gmail action, since the marks
|
||||
;; are ineffectual otherwise.
|
||||
(defun +mu4e|gmail-fix-flags (mark msg)
|
||||
(pcase mark
|
||||
(`trash (mu4e-action-retag-message msg "-\\Inbox,+\\Trash,-\\Draft"))
|
||||
(`refile (mu4e-action-retag-message msg "-\\Inbox"))
|
||||
(`flag (mu4e-action-retag-message msg "+\\Starred"))
|
||||
(`unflag (mu4e-action-retag-message msg "-\\Starred"))))
|
||||
(add-hook 'mu4e-mark-execute-pre-hook #'+mu4e|gmail-fix-flags)))
|
||||
(add-hook! 'mu4e-mark-execute-pre-hook
|
||||
(defun +mu4e-gmail-fix-flags-h (mark msg)
|
||||
(pcase mark
|
||||
(`trash (mu4e-action-retag-message msg "-\\Inbox,+\\Trash,-\\Draft"))
|
||||
(`refile (mu4e-action-retag-message msg "-\\Inbox"))
|
||||
(`flag (mu4e-action-retag-message msg "+\\Starred"))
|
||||
(`unflag (mu4e-action-retag-message msg "-\\Starred")))))))
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
;; Advice
|
||||
|
||||
;;;###autoload
|
||||
(defun +notmuch*dont-confirm-on-kill-process (orig-fn &rest args)
|
||||
(defun +notmuch-dont-confirm-on-kill-process-a (orig-fn &rest args)
|
||||
"Don't prompt for confirmation when killing notmuch sentinel."
|
||||
(let (confirm-kill-processes)
|
||||
(apply orig-fn args)))
|
||||
|
|
|
@ -42,26 +42,28 @@
|
|||
|
||||
;; (setq-hook! 'notmuch-show-mode-hook line-spacing 0)
|
||||
|
||||
(add-to-list 'doom-real-buffer-functions #'notmuch-interesting-buffer nil #'eq)
|
||||
(add-hook 'doom-real-buffer-functions #'notmuch-interesting-buffer)
|
||||
|
||||
(advice-add #'notmuch-start-notmuch-sentinel :around #'+notmuch*dont-confirm-on-kill-process)
|
||||
(advice-add #'notmuch-start-notmuch-sentinel :around #'+notmuch-dont-confirm-on-kill-process-a)
|
||||
|
||||
;; modeline doesn't have much use in these modes
|
||||
(add-hook! (notmuch-show-mode notmuch-tree-mode notmuch-search-mode)
|
||||
#'hide-mode-line-mode))
|
||||
(add-hook! '(notmuch-show-mode-hook
|
||||
notmuch-tree-mode-hook
|
||||
notmuch-search-mode-hook)
|
||||
#'hide-mode-line-mode))
|
||||
|
||||
|
||||
(def-package! org-mime
|
||||
(use-package! org-mime
|
||||
:after (org notmuch)
|
||||
:config (setq org-mime-library 'mml))
|
||||
|
||||
|
||||
(def-package! counsel-notmuch
|
||||
(use-package! counsel-notmuch
|
||||
:when (featurep! :completion ivy)
|
||||
:commands counsel-notmuch
|
||||
:after notmuch)
|
||||
|
||||
(def-package! helm-notmuch
|
||||
(use-package! helm-notmuch
|
||||
:when (featurep! :completion helm)
|
||||
:commands helm-notmuch
|
||||
:after notmuch)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; app/wanderlust/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(def-package! wl
|
||||
(use-package! wl
|
||||
:defer t
|
||||
:config
|
||||
(setq mail-user-agent 'wl-user-agent
|
||||
|
@ -74,6 +74,6 @@
|
|||
;; Neither wl-folder-mode or wl-summary-mode are correctly defined as major
|
||||
;; modes, so `evil-set-initial-state' won't work here.
|
||||
(add-hook! '(wl-folder-mode-hook wl-summary-mode-hook)
|
||||
#'evil-emacs-state))
|
||||
#'evil-emacs-state))
|
||||
|
||||
(add-hook 'mime-edit-mode-hook #'auto-fill-mode))
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
;;; input/chinese/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(def-package! pyim
|
||||
:after-call (after-find-file pre-command-hook)
|
||||
(use-package! pyim
|
||||
:after-call after-find-file pre-command-hook
|
||||
:config
|
||||
(setq pyim-dcache-directory (concat doom-cache-dir "pyim/")
|
||||
pyim-page-tooltip t
|
||||
default-input-method "pyim"))
|
||||
|
||||
|
||||
(def-package! pangu-spacing
|
||||
(use-package! pangu-spacing
|
||||
:hook (text-mode . pangu-spacing-mode)
|
||||
:config
|
||||
;; Always insert `real' space in org-mode.
|
||||
(setq-hook! 'org-mode-hook pangu-spacing-real-insert-separtor t))
|
||||
|
||||
|
||||
(def-package! fcitx
|
||||
(use-package! fcitx
|
||||
:after evil
|
||||
:config
|
||||
(when (executable-find "fcitx-remote")
|
||||
(fcitx-evil-turn-on)))
|
||||
|
||||
|
||||
(def-package! ace-pinyin
|
||||
(use-package! ace-pinyin
|
||||
:after avy
|
||||
:init (setq ace-pinyin-use-avy t)
|
||||
:config (ace-pinyin-global-mode t))
|
||||
|
@ -31,15 +31,20 @@
|
|||
;;
|
||||
;;; Hacks
|
||||
|
||||
(defun +chinese*org-html-paragraph (paragraph contents info)
|
||||
(defadvice! +chinese--org-html-paragraph-a (args)
|
||||
"Join consecutive Chinese lines into a single long line without unwanted space
|
||||
when exporting org-mode to html."
|
||||
(let* ((fix-regexp "[[:multibyte:]]")
|
||||
(origin-contents contents)
|
||||
(fixed-contents
|
||||
(replace-regexp-in-string
|
||||
(concat "\\(" fix-regexp "\\) *\n *\\(" fix-regexp "\\)")
|
||||
"\\1\\2"
|
||||
origin-contents)))
|
||||
(list paragraph fixed-contents info)))
|
||||
(advice-add #'org-html-paragraph :filter-args #'+chinese*org-html-paragraph)
|
||||
:filter-args #'org-html-paragraph
|
||||
(cl-destructuring-bind (paragraph contents info) args
|
||||
(let* ((fix-regexp "[[:multibyte:]]")
|
||||
(origin-contents
|
||||
(replace-regexp-in-string
|
||||
"<[Bb][Rr] */>"
|
||||
""
|
||||
contents))
|
||||
(fixed-contents
|
||||
(replace-regexp-in-string
|
||||
(concat "\\(" fix-regexp "\\) *\n *\\(" fix-regexp "\\)")
|
||||
"\\1\\2"
|
||||
origin-contents)))
|
||||
(list paragraph fixed-contents info))))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; input/japanese/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(def-package! migemo
|
||||
:after-call (after-find-file pre-command-hook)
|
||||
(use-package! migemo
|
||||
:after-call after-find-file pre-command-hook
|
||||
:init
|
||||
(setq search-default-regexp-mode nil
|
||||
migemo-options '("-q" "--emacs" "-i" "\a")
|
||||
|
@ -14,7 +14,7 @@
|
|||
(when (executable-find migemo-command)
|
||||
(migemo-init)
|
||||
|
||||
(def-package! avy-migemo
|
||||
(use-package! avy-migemo
|
||||
:after avy
|
||||
:config (avy-migemo-mode 1))
|
||||
|
||||
|
@ -34,22 +34,27 @@
|
|||
pangu-spacing-real-insert-separtor t))
|
||||
|
||||
|
||||
(def-package! ddskk
|
||||
(use-package! ddskk
|
||||
:general ("C-x j" #'skk-mode))
|
||||
|
||||
|
||||
;;
|
||||
;;; Hacks
|
||||
|
||||
(defun +japanese*org-html-paragraph (paragraph contents info)
|
||||
(defadvice! +japanese--org-html-paragraph-a (args)
|
||||
"Join consecutive Japanese lines into a single long line without unwanted space
|
||||
when exporting org-mode to html."
|
||||
(let* ((fix-regexp "[[:multibyte:]]")
|
||||
(origin-contents contents)
|
||||
(fixed-contents
|
||||
(replace-regexp-in-string
|
||||
(concat "\\(" fix-regexp "\\) *\n *\\(" fix-regexp "\\)")
|
||||
"\\1\\2"
|
||||
origin-contents)))
|
||||
(list paragraph fixed-contents info)))
|
||||
(advice-add #'org-html-paragraph :filter-args #'+japanese*org-html-paragraph)
|
||||
:filter-args #'org-html-paragraph
|
||||
(cl-destructuring-bind (paragraph contents info) args
|
||||
(let* ((fix-regexp "[[:multibyte:]]")
|
||||
(origin-contents
|
||||
(replace-regexp-in-string
|
||||
"<[Bb][Rr] */>"
|
||||
""
|
||||
contents))
|
||||
(fixed-contents
|
||||
(replace-regexp-in-string
|
||||
(concat "\\(" fix-regexp "\\) *\n *\\(" fix-regexp "\\)")
|
||||
"\\1\\2"
|
||||
origin-contents)))
|
||||
(list paragraph fixed-contents info))))
|
||||
|
|
|
@ -1,41 +1,32 @@
|
|||
;;; lang/agda/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +agda-dir
|
||||
(when (executable-find "agda-mode")
|
||||
(file-name-directory (shell-command-to-string "agda-mode locate"))))
|
||||
|
||||
(def-package! agda2
|
||||
:when +agda-dir
|
||||
:load-path +agda-dir)
|
||||
|
||||
(def-package! agda2-mode
|
||||
:defer t
|
||||
:config
|
||||
(map! :map agda2-mode-map
|
||||
:localleader
|
||||
"?" #'agda2-show-goals
|
||||
"." #'agda2-goal-and-context-and-inferred
|
||||
"," #'agda2-goal-and-context
|
||||
"=" #'agda2-show-constraints
|
||||
"SPC" #'agda2-give
|
||||
"a" #'agda2-auto
|
||||
"b" #'agda2-previous-goal
|
||||
"c" #'agda2-make-case
|
||||
"d" #'agda2-infer-type-maybe-toplevel
|
||||
"e" #'agda2-show-context
|
||||
"f" #'agda2-next-goal
|
||||
"gG" #'agda2-go-back
|
||||
"h" #'agda2-helper-function-type
|
||||
"l" #'agda2-load
|
||||
"n" #'agda2-compute-normalised-maybe-toplevel
|
||||
"p" #'agda2-module-contents-maybe-toplevel
|
||||
"r" #'agda2-refine
|
||||
"s" #'agda2-solveAll
|
||||
"t" #'agda2-goal-type
|
||||
"w" #'agda2-why-in-scope-maybe-toplevel
|
||||
(:prefix "x"
|
||||
"c" #'agda2-compile
|
||||
"d" #'agda2-remove-annotations
|
||||
"h" #'agda2-display-implicit-arguments
|
||||
"q" #'agda2-quit
|
||||
"r" #'agda2-restart)))
|
||||
(map!
|
||||
:after agda2-mode
|
||||
:map agda2-mode-map
|
||||
:localleader
|
||||
"?" #'agda2-show-goals
|
||||
"." #'agda2-goal-and-context-and-inferred
|
||||
"," #'agda2-goal-and-context
|
||||
"=" #'agda2-show-constraints
|
||||
"SPC" #'agda2-give
|
||||
"a" #'agda2-auto-maybe-all
|
||||
"b" #'agda2-previous-goal
|
||||
"c" #'agda2-make-case
|
||||
"d" #'agda2-infer-type-maybe-toplevel
|
||||
"e" #'agda2-show-context
|
||||
"f" #'agda2-next-goal
|
||||
"gG" #'agda2-go-back
|
||||
"h" #'agda2-helper-function-type
|
||||
"l" #'agda2-load
|
||||
"n" #'agda2-compute-normalised-maybe-toplevel
|
||||
"p" #'agda2-module-contents-maybe-toplevel
|
||||
"r" #'agda2-refine
|
||||
"s" #'agda2-solveAll
|
||||
"t" #'agda2-goal-type
|
||||
"w" #'agda2-why-in-scope-maybe-toplevel
|
||||
(:prefix "x"
|
||||
"c" #'agda2-compile
|
||||
"d" #'agda2-remove-annotations
|
||||
"h" #'agda2-display-implicit-arguments
|
||||
"q" #'agda2-quit
|
||||
"r" #'agda2-restart))
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
;; -*- lexical-binding: t; no-byte-compile: t; -*-
|
||||
;;; lang/agda/doctor.el
|
||||
|
||||
(unless (executable-find "agda-mode")
|
||||
(warn! "Couldn't find agda-mode. Agda support won't work"))
|
15
modules/lang/agda/packages.el
Normal file
15
modules/lang/agda/packages.el
Normal file
|
@ -0,0 +1,15 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; lang/agda/packages.el
|
||||
|
||||
|
||||
(package! agda-input
|
||||
:recipe
|
||||
(:host github :repo "agda/agda"
|
||||
:files ("src/data/emacs-mode/agda-input.el")))
|
||||
|
||||
(package! agda2-mode
|
||||
:recipe
|
||||
(:host github :repo "agda/agda"
|
||||
:files
|
||||
("src/data/emacs-mode/*.el"
|
||||
(:exclude "agda-input.el"))))
|
|
@ -7,23 +7,6 @@
|
|||
;;
|
||||
;; Library
|
||||
|
||||
;;;###autoload
|
||||
(defun +cc-sp-point-is-template-p (id action context)
|
||||
"Return t if point is in the right place for C++ angle-brackets."
|
||||
(and (sp-in-code-p id action context)
|
||||
(cond ((eq action 'insert)
|
||||
(sp-point-after-word-p id action context))
|
||||
((eq action 'autoskip)
|
||||
(/= (char-before) 32)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +cc-sp-point-after-include-p (id action context)
|
||||
"Return t if point is in an #include."
|
||||
(and (sp-in-code-p id action context)
|
||||
(save-excursion
|
||||
(goto-char (line-beginning-position))
|
||||
(looking-at-p "[ ]*#include[^<]+"))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +cc-c++-lineup-inclass (langelem)
|
||||
"Indent inclass lines one level further than access modifier keywords."
|
||||
|
@ -120,7 +103,7 @@ simpler."
|
|||
(rtags-call-rc :silent t "-J" (or (doom-project-root) default-directory))))
|
||||
;; then irony
|
||||
(when (and (featurep 'irony) irony-mode)
|
||||
(+cc|irony-init-compile-options)))
|
||||
(+cc-init-irony-compile-options-h)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +cc/imenu ()
|
||||
|
@ -139,7 +122,7 @@ simpler."
|
|||
;; Hooks
|
||||
|
||||
;;;###autoload
|
||||
(defun +cc|fontify-constants ()
|
||||
(defun +cc-fontify-constants-h ()
|
||||
"Better fontification for preprocessor constants"
|
||||
(when (memq major-mode '(c-mode c++-mode))
|
||||
(font-lock-add-keywords
|
||||
|
@ -149,7 +132,7 @@ simpler."
|
|||
|
||||
(defvar +cc--project-includes-alist nil)
|
||||
;;;###autoload
|
||||
(defun +cc|init-irony-compile-options ()
|
||||
(defun +cc-init-irony-compile-options-h ()
|
||||
"Initialize compiler options for irony-mode. It searches for the nearest
|
||||
compilation database and initailizes it, otherwise falling back on
|
||||
`+cc-default-compiler-options' and `+cc-default-include-paths'.
|
||||
|
@ -186,7 +169,7 @@ compilation dbs."
|
|||
;; collect (format "-I%s" path))])))))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +cc|init-ffap-integration ()
|
||||
(defun +cc-init-ffap-integration-h ()
|
||||
"Takes the local project include paths and registers them with ffap.
|
||||
This way, `find-file-at-point' (and `+lookup/file') will know where to find most
|
||||
header files."
|
||||
|
|
|
@ -32,7 +32,7 @@ This is ignored by ccls.")
|
|||
;;
|
||||
;; Packages
|
||||
|
||||
(def-package! cc-mode
|
||||
(use-package! cc-mode
|
||||
:commands (c-mode c++-mode objc-mode java-mode)
|
||||
:mode ("\\.mm\\'" . objc-mode)
|
||||
:init
|
||||
|
@ -50,8 +50,10 @@ This is ignored by ccls.")
|
|||
|
||||
;; Ensure find-file-at-point works in C modes, must be added before irony
|
||||
;; and/or lsp hooks are run.
|
||||
(add-hook! (c-mode-local-vars c++-mode-local-vars objc-mode-local-vars)
|
||||
#'+cc|init-ffap-integration)
|
||||
(add-hook! '(c-mode-local-vars-hook
|
||||
c++-mode-local-vars-hook
|
||||
objc-mode-local-vars-hook)
|
||||
#'+cc-init-ffap-integration-h)
|
||||
|
||||
:config
|
||||
(set-electric! '(c-mode c++-mode objc-mode java-mode) :chars '(?\n ?\} ?\{))
|
||||
|
@ -80,7 +82,7 @@ This is ignored by ccls.")
|
|||
|
||||
;;; Better fontification (also see `modern-cpp-font-lock')
|
||||
(add-hook 'c-mode-common-hook #'rainbow-delimiters-mode)
|
||||
(add-hook! (c-mode c++-mode) #'+cc|fontify-constants)
|
||||
(add-hook! '(c-mode-hook c++-mode-hook) #'+cc-fontify-constants-h)
|
||||
|
||||
;; Custom style, based off of linux
|
||||
(c-add-style
|
||||
|
@ -115,37 +117,38 @@ This is ignored by ccls.")
|
|||
(label . 0)))))
|
||||
|
||||
|
||||
(def-package! modern-cpp-font-lock
|
||||
(use-package! modern-cpp-font-lock
|
||||
:hook (c++-mode . modern-c++-font-lock-mode))
|
||||
|
||||
|
||||
(def-package! irony
|
||||
(use-package! irony
|
||||
:unless (featurep! +lsp)
|
||||
:commands (irony-install-server irony-mode)
|
||||
:preface
|
||||
(setq irony-server-install-prefix (concat doom-etc-dir "irony-server/"))
|
||||
:init
|
||||
(defun +cc|init-irony-mode ()
|
||||
(if (file-directory-p irony-server-install-prefix)
|
||||
(irony-mode +1)
|
||||
(message "Irony server isn't installed")))
|
||||
(add-hook! (c-mode-local-vars c++-mode-local-vars objc-mode-local-vars)
|
||||
#'+cc|init-irony-mode)
|
||||
(add-hook! '(c-mode-local-vars-hook
|
||||
c++-mode-local-vars-hook
|
||||
objc-mode-local-vars-hook)
|
||||
(defun +cc-init-irony-mode-h ()
|
||||
(if (file-directory-p irony-server-install-prefix)
|
||||
(irony-mode +1)
|
||||
(message "Irony server isn't installed"))))
|
||||
:config
|
||||
(setq irony-cdb-search-directory-list '("." "build" "build-conda"))
|
||||
|
||||
;; Initialize compilation database, if present. Otherwise, fall back on
|
||||
;; `+cc-default-compiler-options'.
|
||||
(add-hook 'irony-mode-hook #'+cc|init-irony-compile-options)
|
||||
(add-hook 'irony-mode-hook #'+cc-init-irony-compile-options-h)
|
||||
|
||||
(def-package! irony-eldoc
|
||||
(use-package! irony-eldoc
|
||||
:hook (irony-mode . irony-eldoc))
|
||||
|
||||
(def-package! flycheck-irony
|
||||
(use-package! flycheck-irony
|
||||
:when (featurep! :tools flycheck)
|
||||
:config (flycheck-irony-setup))
|
||||
|
||||
(def-package! company-irony
|
||||
(use-package! company-irony
|
||||
:when (featurep! :completion company)
|
||||
:init
|
||||
(set-company-backend! 'irony-mode
|
||||
|
@ -157,17 +160,17 @@ This is ignored by ccls.")
|
|||
;;
|
||||
;; Major modes
|
||||
|
||||
(def-package! company-cmake ; for `cmake-mode'
|
||||
(use-package! company-cmake ; for `cmake-mode'
|
||||
:when (featurep! :completion company)
|
||||
:after cmake-mode
|
||||
:config (set-company-backend! 'cmake-mode 'company-cmake))
|
||||
|
||||
|
||||
(def-package! demangle-mode
|
||||
(use-package! demangle-mode
|
||||
:hook llvm-mode)
|
||||
|
||||
|
||||
(def-package! company-glsl ; for `glsl-mode'
|
||||
(use-package! company-glsl ; for `glsl-mode'
|
||||
:when (featurep! :completion company)
|
||||
:after glsl-mode
|
||||
:config (set-company-backend! 'glsl-mode 'company-glsl))
|
||||
|
@ -176,19 +179,20 @@ This is ignored by ccls.")
|
|||
;;
|
||||
;; Rtags Support
|
||||
|
||||
(def-package! rtags
|
||||
(use-package! rtags
|
||||
:unless (featurep! +lsp)
|
||||
:commands rtags-executable-find
|
||||
:preface
|
||||
(setq rtags-install-path (concat doom-etc-dir "rtags/"))
|
||||
:init
|
||||
(defun +cc|init-rtags ()
|
||||
"Start an rtags server in c-mode and c++-mode buffers."
|
||||
(when (and (require 'rtags nil t)
|
||||
(rtags-executable-find rtags-rdm-binary-name))
|
||||
(rtags-start-process-unless-running)))
|
||||
(add-hook! (c-mode-local-vars c++-mode-local-vars objc-mode-local-vars)
|
||||
#'+cc|init-rtags)
|
||||
(add-hook! '(c-mode-local-vars-hook
|
||||
c++-mode-local-vars-hook
|
||||
objc-mode-local-vars-hook)
|
||||
(defun +cc-init-rtags-h ()
|
||||
"Start an rtags server in c-mode and c++-mode buffers."
|
||||
(when (and (require 'rtags nil t)
|
||||
(rtags-executable-find rtags-rdm-binary-name))
|
||||
(rtags-start-process-unless-running))))
|
||||
:config
|
||||
(setq rtags-autostart-diagnostics t
|
||||
rtags-use-bookmarks nil
|
||||
|
@ -199,9 +203,11 @@ This is ignored by ccls.")
|
|||
('default))
|
||||
;; These executables are named rtags-* on debian
|
||||
rtags-rc-binary-name
|
||||
(cl-find-if #'executable-find (list rtags-rc-binary-name "rtags-rc"))
|
||||
(or (cl-find-if #'executable-find (list rtags-rc-binary-name "rtags-rc"))
|
||||
rtags-rc-binary-name)
|
||||
rtags-rdm-binary-name
|
||||
(cl-find-if #'executable-find (list rtags-rdm-binary-name "rtags-rdm"))
|
||||
(or (cl-find-if #'executable-find (list rtags-rdm-binary-name "rtags-rdm"))
|
||||
rtags-rdm-binary-name)
|
||||
;; If not using ivy or helm to view results, use a pop-up window rather
|
||||
;; than displaying it in the current window...
|
||||
rtags-results-buffer-other-window t
|
||||
|
@ -224,17 +230,22 @@ This is ignored by ccls.")
|
|||
;;
|
||||
;; LSP
|
||||
|
||||
(def-package! ccls
|
||||
(when (featurep! +lsp)
|
||||
(add-hook! '(c-mode-local-vars-hook
|
||||
c++-mode-local-vars-hook
|
||||
objc-mode-local-vars-hook)
|
||||
(defun +cc-init-lsp-h ()
|
||||
(setq-local company-transformers nil)
|
||||
(setq-local company-lsp-async t)
|
||||
(setq-local company-lsp-cache-candidates nil)
|
||||
(lsp!))))
|
||||
|
||||
|
||||
(use-package! ccls
|
||||
:when (featurep! +lsp)
|
||||
:hook ((c-mode-local-vars c++-mode-local-vars objc-mode-local-vars) . +cc|init-ccls)
|
||||
:after lsp
|
||||
:init
|
||||
(after! projectile
|
||||
(add-to-list 'projectile-globally-ignored-directories ".ccls-cache")
|
||||
(add-to-list 'projectile-project-root-files-bottom-up ".ccls-root")
|
||||
(add-to-list 'projectile-project-root-files-top-down-recurring "compile_commands.json"))
|
||||
:config
|
||||
(defun +cc|init-ccls ()
|
||||
(setq-local company-transformers nil)
|
||||
(setq-local company-lsp-async t)
|
||||
(setq-local company-lsp-cache-candidates nil)
|
||||
(lsp!)))
|
||||
(add-to-list 'projectile-project-root-files-top-down-recurring "compile_commands.json")))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;; -*- no-byte-compile: t; -*-
|
||||
;;; lang/cc/packages.el
|
||||
|
||||
(package! cmake-mode)
|
||||
(package! cmake-mode :recipe (:host github :repo "emacsmirror/cmake-mode" :files (:defaults "*")))
|
||||
(package! cuda-mode)
|
||||
(package! demangle-mode)
|
||||
(package! disaster)
|
||||
|
@ -10,7 +10,7 @@
|
|||
|
||||
(when (package! glsl-mode)
|
||||
(when (featurep! :completion company)
|
||||
(package! company-glsl :recipe (:fetcher github :repo "Kaali/company-glsl"))))
|
||||
(package! company-glsl :recipe (:host github :repo "Kaali/company-glsl"))))
|
||||
|
||||
(if (featurep! +lsp)
|
||||
(package! ccls)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
(add-hook 'clojure-mode-hook #'rainbow-delimiters-mode)
|
||||
|
||||
|
||||
(def-package! cider
|
||||
(use-package! cider
|
||||
;; NOTE: if you don't have an org directory set (the dir doesn't exist),
|
||||
;; cider jack in won't work.
|
||||
:commands (cider-jack-in cider-jack-in-clojurescript)
|
||||
|
@ -27,7 +27,6 @@
|
|||
cider-font-lock-dynamically '(macro core function var)
|
||||
cider-overlays-use-font-lock t
|
||||
cider-prompt-for-symbol nil
|
||||
cider-repl-display-help-banner nil
|
||||
cider-repl-history-display-duplicates nil
|
||||
cider-repl-history-display-style 'one-line
|
||||
cider-repl-history-file (concat doom-cache-dir "cider-repl-history")
|
||||
|
@ -43,10 +42,29 @@
|
|||
cider-repl-wrap-history nil
|
||||
cider-stacktrace-default-filters '(tooling dup))
|
||||
|
||||
;; Error messages emitted from CIDER is silently funneled into *nrepl-server*
|
||||
;; rather than the *cider-repl* buffer. How silly. We might want to see that
|
||||
;; stuff and who's going to check *nrepl-server* on every startup? I've got a
|
||||
;; better idea: we copy these errors into the *cider-repl* buffer.
|
||||
(add-hook! 'cider-connected-hook
|
||||
(defun +clojure--cider-dump-nrepl-server-log-h ()
|
||||
"Copy contents of *nrepl-server* to beginning of *cider-repl*."
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(insert
|
||||
(with-current-buffer nrepl-server-buffer
|
||||
(buffer-string))))))
|
||||
|
||||
;; The CIDER welcome message obscures error messages that the above code is
|
||||
;; supposed to be make visible.
|
||||
(setq cider-repl-display-help-banner nil)
|
||||
|
||||
(map! (:localleader
|
||||
(:map clojure-mode-map
|
||||
"'" #'cider-jack-in
|
||||
"\"" #'cider-jack-in-clojurescript
|
||||
(:map (clojure-mode-map clojurescript-mode-map)
|
||||
"'" #'cider-jack-in-clj
|
||||
"\"" #'cider-jack-in-cljs
|
||||
"c" #'cider-connect-clj
|
||||
"C" #'cider-connect-cljs
|
||||
|
||||
(:prefix ("e" . "eval")
|
||||
"d" #'cider-eval-defun-at-point
|
||||
|
@ -67,6 +85,7 @@
|
|||
"g" #'cider-grimoire-web
|
||||
"j" #'cider-javadoc)
|
||||
(:prefix ("i" . "inspect")
|
||||
"e" #'cider-enlighten-mode
|
||||
"i" #'cider-inspect
|
||||
"r" #'cider-inspect-last-result)
|
||||
(:prefix ("m" . "macro")
|
||||
|
@ -82,11 +101,22 @@
|
|||
"R" #'cider-restart
|
||||
"b" #'cider-switch-to-repl-buffer
|
||||
"B" #'+clojure/cider-switch-to-repl-buffer-and-switch-ns
|
||||
"c" #'cider-find-and-clear-repl-output)))
|
||||
"c" #'cider-find-and-clear-repl-output
|
||||
"l" #'cider-load-buffer
|
||||
"L" #'cider-load-buffer-and-switch-to-repl-buffer)
|
||||
(:prefix ("t" . "test")
|
||||
"a" #'cider-test-rerun-test
|
||||
"l" #'cider-test-run-loaded-tests
|
||||
"n" #'cider-test-run-ns-tests
|
||||
"p" #'cider-test-run-project-tests
|
||||
"r" #'cider-test-rerun-failed-tests
|
||||
"s" #'cider-test-run-ns-tests-with-filters
|
||||
"t" #'cider-test-run-test)))
|
||||
|
||||
(:when (featurep! :editor evil +everywhere)
|
||||
:map cider-repl-mode-map
|
||||
:i [S-return] #'cider-repl-newline-and-indent
|
||||
:i [M-return] #'cider-repl-return
|
||||
(:localleader
|
||||
("n" #'cider-repl-set-ns
|
||||
"q" #'cider-quit
|
||||
|
@ -102,7 +132,7 @@
|
|||
:i "U" #'cider-repl-history-undo-other-window)))
|
||||
|
||||
|
||||
(def-package! clj-refactor
|
||||
(use-package! clj-refactor
|
||||
:hook (clojure-mode . clj-refactor-mode)
|
||||
:init
|
||||
(set-lookup-handlers! 'clj-refactor-mode
|
||||
|
@ -113,6 +143,6 @@
|
|||
:desc "refactor" "R" #'hydra-cljr-help-menu/body))
|
||||
|
||||
|
||||
(def-package! flycheck-joker
|
||||
(use-package! flycheck-joker
|
||||
:when (featurep! :tools flycheck)
|
||||
:after flycheck)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; lang/common-lisp/autoload/common-lisp.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defun +common-lisp*sly-last-sexp (command &rest args)
|
||||
(defun +common-lisp--sly-last-sexp-a (command &rest args)
|
||||
"In normal-state or motion-state, last sexp ends at point."
|
||||
(if (and (not evil-move-beyond-eol)
|
||||
(or (evil-normal-state-p) (evil-motion-state-p)))
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
(sp-local-pair "'" "'" :actions nil)
|
||||
(sp-local-pair "`" "`" :actions nil))
|
||||
|
||||
(defun +common-lisp|cleanup-sly-maybe ()
|
||||
(defun +common-lisp--cleanup-sly-maybe-h ()
|
||||
"Kill processes and leftover buffers when killing the last sly buffer."
|
||||
(unless (cl-loop for buf in (delq (current-buffer) (buffer-list))
|
||||
if (and (buffer-local-value 'sly-mode buf)
|
||||
|
@ -53,27 +53,17 @@
|
|||
if (buffer-local-value 'sly-mode buf)
|
||||
collect buf)))))
|
||||
|
||||
(defun +common-lisp|init-sly ()
|
||||
"Attempt to auto-start sly when opening a lisp buffer."
|
||||
(cond ((or (doom-temp-buffer-p (current-buffer))
|
||||
(sly-connected-p)))
|
||||
((executable-find inferior-lisp-program)
|
||||
(let ((sly-auto-start 'always))
|
||||
(sly-auto-start)
|
||||
(add-hook 'kill-buffer-hook #'+common-lisp|cleanup-sly-maybe nil t)))
|
||||
((message "WARNING: Couldn't find `inferior-lisp-program' (%s)"
|
||||
inferior-lisp-program))))
|
||||
(add-hook 'sly-mode-hook #'+common-lisp|init-sly)
|
||||
|
||||
(defun +common-lisp*refresh-sly-version (version conn)
|
||||
"Update `sly-protocol-version', which will likely be incorrect or nil due to
|
||||
an issue where `load-file-name' is incorrect. Because Doom's packages are
|
||||
installed through an external script (bin/doom), `load-file-name' is set to
|
||||
bin/doom while packages at compile-time (not a runtime though)."
|
||||
(unless sly-protocol-version
|
||||
(setq sly-protocol-version (sly-version nil (locate-library "sly.el"))))
|
||||
(advice-remove #'sly-check-version #'+common-lisp*refresh-sly-version))
|
||||
(advice-add #'sly-check-version :before #'+common-lisp*refresh-sly-version)
|
||||
(add-hook! 'sly-mode-hook
|
||||
(defun +common-lisp-init-sly-h ()
|
||||
"Attempt to auto-start sly when opening a lisp buffer."
|
||||
(cond ((or (doom-temp-buffer-p (current-buffer))
|
||||
(sly-connected-p)))
|
||||
((executable-find inferior-lisp-program)
|
||||
(let ((sly-auto-start 'always))
|
||||
(sly-auto-start)
|
||||
(add-hook 'kill-buffer-hook #'+common-lisp--cleanup-sly-maybe-h nil t)))
|
||||
((message "WARNING: Couldn't find `inferior-lisp-program' (%s)"
|
||||
inferior-lisp-program)))))
|
||||
|
||||
(map! :localleader
|
||||
:map lisp-mode-map
|
||||
|
@ -138,14 +128,20 @@ bin/doom while packages at compile-time (not a runtime though)."
|
|||
(when (featurep! :editor evil +everywhere)
|
||||
(add-hook 'sly-mode-hook #'evil-normalize-keymaps)
|
||||
(add-hook 'sly-popup-buffer-mode-hook #'evil-normalize-keymaps)
|
||||
|
||||
(unless evil-move-beyond-eol
|
||||
(advice-add #'sly-eval-last-expression :around #'+common-lisp*sly-last-sexp)
|
||||
(advice-add #'sly-pprint-eval-last-expression :around #'+common-lisp*sly-last-sexp)
|
||||
(advice-add #'sly-eval-print-last-expression :around #'+common-lisp*sly-last-sexp)
|
||||
(advice-add #'sly-eval-last-expression-in-repl :around #'+common-lisp*sly-last-sexp))
|
||||
(dolist (fn '(sly-eval-last-expression
|
||||
sly-pprint-eval-last-expression
|
||||
sly-eval-print-last-expression
|
||||
sly-eval-last-expression-in-repl))
|
||||
(advice-add fn :around #'+common-lisp--sly-last-sexp-a)))
|
||||
(set-evil-initial-state!
|
||||
'(sly-db-mode sly-inspector-mode sly-popup-buffer-mode sly-xref-mode)
|
||||
'(sly-db-mode
|
||||
sly-inspector-mode
|
||||
sly-popup-buffer-mode
|
||||
sly-xref-mode)
|
||||
'normal)
|
||||
|
||||
(evil-define-key 'insert sly-mrepl-mode-map
|
||||
[S-return] #'newline-and-indent
|
||||
[backspace] #'sp-backward-delete-char
|
||||
|
@ -239,7 +235,8 @@ bin/doom while packages at compile-time (not a runtime though)."
|
|||
"q" 'quit-window
|
||||
"r" 'sly-xref-retract)))
|
||||
|
||||
(def-package! sly-repl-ansi-color
|
||||
|
||||
(use-package! sly-repl-ansi-color
|
||||
:defer t
|
||||
:init
|
||||
(add-to-list 'sly-contribs 'sly-repl-ansi-color nil #'eq))
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
(add-to-list 'dtrt-indent-hook-mapping-list '(crystal-mode ruby crystal-indent-level))))
|
||||
|
||||
|
||||
(def-package! flycheck-crystal
|
||||
(use-package! flycheck-crystal
|
||||
:when (featurep! :tools flycheck)
|
||||
:after crystal-mode)
|
||||
|
||||
|
||||
(def-package! inf-crystal
|
||||
(use-package! inf-crystal
|
||||
:commands crystal-switch-to-inf)
|
||||
|
|
|
@ -12,19 +12,19 @@
|
|||
:post-handlers '(("| " "SPC"))))
|
||||
|
||||
|
||||
(def-package! omnisharp
|
||||
(use-package! omnisharp
|
||||
:hook (csharp-mode . omnisharp-mode)
|
||||
:commands omnisharp-install-server
|
||||
:preface
|
||||
(setq omnisharp-auto-complete-want-documentation nil
|
||||
omnisharp-cache-directory (concat doom-cache-dir "omnisharp"))
|
||||
:config
|
||||
(defun +csharp|cleanup-omnisharp-server ()
|
||||
(defun +csharp-cleanup-omnisharp-server-h ()
|
||||
"Clean up the omnisharp server once you kill the last csharp-mode buffer."
|
||||
(unless (doom-buffers-in-mode 'csharp-mode (buffer-list))
|
||||
(omnisharp-stop-server)))
|
||||
(add-hook! csharp-mode
|
||||
(add-hook 'kill-buffer-hook #'+csharp|cleanup-omnisharp-server nil t))
|
||||
(add-hook! 'csharp-mode-hook
|
||||
(add-hook 'kill-buffer-hook #'+csharp-cleanup-omnisharp-server-h nil t))
|
||||
|
||||
(set-company-backend! 'csharp-mode 'company-omnisharp)
|
||||
(set-lookup-handlers! 'csharp-mode
|
||||
|
@ -36,7 +36,6 @@
|
|||
:map omnisharp-mode-map
|
||||
"b" #'omnisharp-recompile
|
||||
(:prefix "r"
|
||||
"i" #'omnisharp-fix-code-issue-at-point
|
||||
"u" #'omnisharp-fix-usings
|
||||
"r" #'omnisharp-rename
|
||||
"a" #'omnisharp-show-last-auto-complete-result
|
||||
|
@ -52,9 +51,9 @@
|
|||
"ti" #'omnisharp-current-type-information
|
||||
"td" #'omnisharp-current-type-documentation)
|
||||
(:prefix "t"
|
||||
"r" (λ! (omnisharp-unit-test "fixture"))
|
||||
"s" (λ! (omnisharp-unit-test "single"))
|
||||
"a" (λ! (omnisharp-unit-test "all")))))
|
||||
"s" #'omnisharp-unit-test-at-point
|
||||
"l" #'omnisharp-unit-test-last
|
||||
"b" #'omnisharp-unit-test-buffer)))
|
||||
|
||||
|
||||
(when (featurep! +unity)
|
||||
|
@ -62,5 +61,5 @@
|
|||
(add-to-list 'auto-mode-alist '("\\.shader$" . shader-mode))
|
||||
|
||||
(def-project-mode! +csharp-unity-mode
|
||||
:modes (csharp-mode shader-mode)
|
||||
:modes '(csharp-mode shader-mode)
|
||||
:files (and "Assets" "Library/MonoManager.asset" "Library/ScriptMapper")))
|
||||
|
|
|
@ -3,14 +3,20 @@
|
|||
;; Built in plugins
|
||||
(add-to-list 'auto-mode-alist '("/sxhkdrc\\'" . conf-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.\\(?:hex\\|nes\\)\\'" . hexl-mode))
|
||||
(add-to-list 'auto-mode-alist '("\\.plist\\'" . nxml-mode))
|
||||
|
||||
(after! nxml-mode
|
||||
(use-package! nxml-mode
|
||||
:mode "\\.p\\(?:list\\|om\\)\\'" ; plist, pom
|
||||
:mode "\\.xs\\(?:d\\|lt\\)\\'" ; xslt, xsd
|
||||
:mode "\\.rss\\'"
|
||||
:magic "<\\?xml"
|
||||
:config
|
||||
(setq nxml-slash-auto-complete-flag t
|
||||
nxml-auto-insert-xml-declaration-flag t)
|
||||
(set-company-backend! 'nxml-mode '(company-nxml company-yasnippet)))
|
||||
|
||||
|
||||
;;
|
||||
;; Third-party plugins
|
||||
;;; Third-party plugins
|
||||
|
||||
;; `csv-mode'
|
||||
(map! :after csv-mode
|
||||
|
@ -23,18 +29,21 @@
|
|||
"k" #'csv-kill-fields
|
||||
"t" #'csv-transpose)
|
||||
|
||||
(def-package! graphql-mode
|
||||
(use-package! graphql-mode
|
||||
:mode "\\.gql\\'")
|
||||
|
||||
(def-package! json-mode
|
||||
(use-package! json-mode
|
||||
:mode "\\.js\\(?:on\\|[hl]int\\(?:rc\\)?\\)\\'"
|
||||
:config
|
||||
(set-electric! 'json-mode :chars '(?\n ?: ?{ ?})))
|
||||
|
||||
(use-package! jsonnet-mode
|
||||
:defer t
|
||||
:config
|
||||
(set-electric! 'jsonnet-mode :chars '(?\n ?: ?{ ?})))
|
||||
|
||||
;;
|
||||
;; Frameworks
|
||||
|
||||
(def-project-mode! +data-vagrant-mode
|
||||
:files ("Vagrantfile"))
|
||||
|
||||
|
|
|
@ -3,8 +3,9 @@
|
|||
|
||||
(package! graphql-mode)
|
||||
(package! json-mode)
|
||||
(package! jsonnet-mode)
|
||||
(package! toml-mode)
|
||||
(package! yaml-mode)
|
||||
(package! csv-mode)
|
||||
(package! dhall-mode)
|
||||
(package! protobuf-mode)
|
||||
(package! protobuf-mode :recipe (:host github :repo "emacsmirror/protobuf-mode" :files (:defaults "*")))
|
||||
|
|
56
modules/lang/elixir/README.org
Normal file
56
modules/lang/elixir/README.org
Normal file
|
@ -0,0 +1,56 @@
|
|||
#+TITLE: lang/elixir
|
||||
#+DATE: June 24, 2019
|
||||
#+SINCE: v2.0.9
|
||||
|
||||
* Table of Contents :TOC_3:noexport:
|
||||
- [[#description][Description]]
|
||||
- [[#module-flags][Module flags]]
|
||||
- [[#plugins][Plugins]]
|
||||
- [[#prerequisites][Prerequisites]]
|
||||
- [[#install-elixir][Install Elixir]]
|
||||
- [[#with-asdf][With ~asdf~]]
|
||||
- [[#arch-linux][Arch Linux]]
|
||||
- [[#gentoo-linux][Gentoo Linux]]
|
||||
- [[#features][Features]]
|
||||
|
||||
* Description
|
||||
This module provides support for [[https://elixir-lang.org/][Elixir programming language]] via [[https://github.com/tonini/alchemist.el][alchemist.el]]
|
||||
or [[https://github.com/JakeBecker/elixir-ls/][elixir-ls]].
|
||||
|
||||
** Module flags
|
||||
| ~+lsp~ | add support for LSP |
|
||||
|
||||
** Plugins
|
||||
+ [[https://github.com/rust-lang/rust-mode][elixir-mode]]
|
||||
+ [[https://github.com/tonini/alchemist.el][alchemist.el]]
|
||||
+ [[https://github.com/aaronjensen/flycheck-credo][flycheck-credo]]
|
||||
|
||||
* Prerequisites
|
||||
You should have Elixir installed, for example, via your distribution's package
|
||||
manager or a version management tool such as [[https://github.com/asdf-vm/asdf-elixir][asdf]].
|
||||
|
||||
If you want to add support for LSP ([[modules/tools/lsp][:tools lsp]]), be sure to install [[https://github.com/JakeBecker/elixir-ls/][elixir-ls]]
|
||||
and enable ~:tools lsp~ in your ~init.el~.
|
||||
|
||||
To support linting with [[https://github.com/rrrene/credo][credo]], add ~:tools flycheck~ to your ~init.el~
|
||||
** Install Elixir
|
||||
*** With ~asdf~
|
||||
#+BEGIN_SRC sh
|
||||
asdf plugin-add elixir
|
||||
asdf install elixir 1.9.1
|
||||
#+END_SRC
|
||||
*** Arch Linux
|
||||
#+BEGIN_SRC sh :dir /sudo::
|
||||
sudo pacman -S elixir
|
||||
#+END_SRC
|
||||
*** Gentoo Linux
|
||||
#+BEGIN_SRC sh :dir /sudo::
|
||||
sudo emerge -v dev-lang/elixir
|
||||
#+END_SRC
|
||||
* Features
|
||||
- Code completion (~:completion company~)
|
||||
- Documentation lookup (~:tools lookup~)
|
||||
- Mix integration
|
||||
- Phoenix support
|
||||
- ~iex~ integration (~:tools eval~)
|
||||
- Syntax checking (~:tools flycheck~, using [[https://github.com/aaronjensen/flycheck-credo][flycheck-credo]]~)
|
|
@ -1,6 +1,6 @@
|
|||
;;; lang/elixir/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(def-package! elixir-mode
|
||||
(use-package! elixir-mode
|
||||
:defer t
|
||||
:init
|
||||
;; Disable default smartparens config. There are too many pairs; we only want
|
||||
|
@ -21,16 +21,18 @@
|
|||
:return "return" :yield "use")
|
||||
|
||||
;; ...and only complete the basics
|
||||
(after! smartparens
|
||||
(sp-with-modes 'elixir-mode
|
||||
(sp-local-pair "do" "end"
|
||||
:when '(("RET" "<evil-ret>"))
|
||||
:unless '(sp-in-comment-p sp-in-string-p)
|
||||
:post-handlers '("||\n[i]"))
|
||||
(sp-local-pair "do " " end" :unless '(sp-in-comment-p sp-in-string-p))
|
||||
(sp-local-pair "fn " " end" :unless '(sp-in-comment-p sp-in-string-p))))
|
||||
(sp-with-modes 'elixir-mode
|
||||
(sp-local-pair "do" "end"
|
||||
:when '(("RET" "<evil-ret>"))
|
||||
:unless '(sp-in-comment-p sp-in-string-p)
|
||||
:post-handlers '("||\n[i]"))
|
||||
(sp-local-pair "do " " end" :unless '(sp-in-comment-p sp-in-string-p))
|
||||
(sp-local-pair "fn " " end" :unless '(sp-in-comment-p sp-in-string-p)))
|
||||
|
||||
(def-package! alchemist-company
|
||||
(when (featurep! +lsp)
|
||||
(add-hook 'elixir-mode-local-vars-hook #'lsp!))
|
||||
|
||||
(use-package! alchemist-company
|
||||
:when (featurep! :completion company)
|
||||
:commands alchemist-company
|
||||
:init
|
||||
|
@ -42,12 +44,12 @@
|
|||
(remove-hook 'alchemist-mode-hook fn)
|
||||
(remove-hook 'alchemist-iex-mode-hook fn)))
|
||||
|
||||
(def-package! flycheck-credo
|
||||
(use-package! flycheck-credo
|
||||
:when (featurep! :tools flycheck)
|
||||
:config (flycheck-credo-setup)))
|
||||
|
||||
|
||||
(def-package! alchemist
|
||||
(use-package! alchemist
|
||||
:hook (elixir-mode . alchemist-mode)
|
||||
:config
|
||||
(set-lookup-handlers! 'elixir-mode
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
:and "&&" :or "||"))
|
||||
|
||||
|
||||
(def-package! flycheck-elm
|
||||
(use-package! flycheck-elm
|
||||
:when (featurep! :tools flycheck)
|
||||
:after elm-mode
|
||||
:config (add-to-list 'flycheck-checkers 'elm nil #'eq))
|
||||
|
|
|
@ -71,6 +71,13 @@ library/userland functions"
|
|||
(throw 'matcher t)))))))
|
||||
nil))
|
||||
|
||||
;; `+emacs-lisp-highlight-vars-and-faces' is a potentially expensive function
|
||||
;; and should be byte-compiled, no matter what, to ensure it runs as fast as
|
||||
;; possible:
|
||||
(unless (byte-code-function-p (symbol-function '+emacs-lisp-highlight-vars-and-faces))
|
||||
(with-no-warnings
|
||||
(byte-compile #'+emacs-lisp-highlight-vars-and-faces)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +emacs-lisp-lookup-documentation (thing)
|
||||
"Lookup THING with `helpful-variable' if it's a variable, `helpful-callable'
|
||||
|
@ -79,13 +86,6 @@ if it's callable, `apropos' otherwise."
|
|||
(doom/describe-symbol thing)
|
||||
(call-interactively #'doom/describe-symbol)))
|
||||
|
||||
;; `+emacs-lisp-highlight-vars-and-faces' is a potentially expensive function
|
||||
;; and should be byte-compiled, no matter what, to ensure it runs as fast as
|
||||
;; possible:
|
||||
(when (not (byte-code-function-p (symbol-function '+emacs-lisp-highlight-vars-and-faces)))
|
||||
(with-no-warnings
|
||||
(byte-compile #'+emacs-lisp-highlight-vars-and-faces)))
|
||||
|
||||
|
||||
;;
|
||||
;;; Commands
|
||||
|
@ -101,12 +101,35 @@ if it's callable, `apropos' otherwise."
|
|||
(bury-buffer buf)
|
||||
buf)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +emacs-lisp/buttercup-run-file ()
|
||||
"Run all buttercup tests in the focused buffer."
|
||||
(interactive)
|
||||
(let ((load-path (append (list (doom-path (dir!) "..")
|
||||
(or (doom-project-root)
|
||||
default-directory))
|
||||
load-path)))
|
||||
(save-selected-window
|
||||
(eval-buffer)
|
||||
(buttercup-run))
|
||||
(message "File executed successfully")))
|
||||
|
||||
;;;###autoload
|
||||
(defun +emacs-lisp/buttercup-run-project ()
|
||||
"Run all buttercup tests in the project."
|
||||
(interactive)
|
||||
(let* ((default-directory (doom-project-root))
|
||||
(load-path (append (list (doom-path "test")
|
||||
default-directory)
|
||||
load-path)))
|
||||
(buttercup-run-discover)))
|
||||
|
||||
|
||||
;;
|
||||
;;; Hooks
|
||||
|
||||
;;;###autoload
|
||||
(defun +emacs-lisp|extend-imenu ()
|
||||
(defun +emacs-lisp-extend-imenu-h ()
|
||||
"Improve imenu support in `emacs-lisp-mode', including recognition for Doom's API."
|
||||
(setq imenu-generic-expression
|
||||
`(("Section" "^[ \t]*;;;;*[ \t]+\\([^\n]+\\)" 1)
|
||||
|
@ -125,7 +148,7 @@ if it's callable, `apropos' otherwise."
|
|||
("Types" "^\\s-*(\\(cl-def\\(?:struct\\|type\\)\\|def\\(?:class\\|face\\|group\\|ine-\\(?:condition\\|error\\|widget\\)\\|package\\|struct\\|t\\(?:\\(?:hem\\|yp\\)e\\)\\)\\)\\s-+'?\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)+\\)" 2))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +emacs-lisp|reduce-flycheck-errors-in-emacs-config ()
|
||||
(defun +emacs-lisp-reduce-flycheck-errors-in-emacs-config-h ()
|
||||
"Remove `emacs-lisp-checkdoc' checker and reduce `emacs-lisp' checker
|
||||
verbosity when editing a file in `doom-private-dir' or `doom-emacs-dir'."
|
||||
(when (and (bound-and-true-p flycheck-mode)
|
||||
|
|
|
@ -16,7 +16,7 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
|
|||
;;
|
||||
;;; Config
|
||||
|
||||
(def-package! elisp-mode
|
||||
(use-package! elisp-mode
|
||||
:mode ("\\.Cask\\'" . emacs-lisp-mode)
|
||||
:config
|
||||
(set-repl-handler! 'emacs-lisp-mode #'+emacs-lisp/open-repl)
|
||||
|
@ -32,10 +32,12 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
|
|||
("when" "unless")
|
||||
("advice-add" "advice-remove")
|
||||
("add-hook" "remove-hook")
|
||||
("add-hook!" "remove-hook!")))
|
||||
("add-hook!" "remove-hook!")
|
||||
("it" "xit")
|
||||
("describe" "xdescribe")))
|
||||
|
||||
(setq-hook! 'emacs-lisp-mode-hook
|
||||
tab-width 2
|
||||
tab-width (or lisp-indent-offset 2)
|
||||
;; shorter name in modeline
|
||||
mode-name "Elisp"
|
||||
;; Don't treat autoloads or sexp openers as outline headers, we have
|
||||
|
@ -45,20 +47,23 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
|
|||
;; variable-width indentation is superior in elisp
|
||||
(add-to-list 'doom-detect-indentation-excluded-modes 'emacs-lisp-mode nil #'eq)
|
||||
|
||||
;; Use helpful instead of describe-* from `company'
|
||||
(advice-add #'elisp--company-doc-buffer :around #'doom-use-helpful-a)
|
||||
|
||||
(add-hook! 'emacs-lisp-mode-hook
|
||||
#'(outline-minor-mode
|
||||
;; fontificiation
|
||||
rainbow-delimiters-mode
|
||||
highlight-quoted-mode
|
||||
;; initialization
|
||||
+emacs-lisp|extend-imenu))
|
||||
#'outline-minor-mode
|
||||
;; fontificiation
|
||||
#'rainbow-delimiters-mode
|
||||
#'highlight-quoted-mode
|
||||
;; initialization
|
||||
#'+emacs-lisp-extend-imenu-h)
|
||||
|
||||
;; Flycheck's two emacs-lisp checkers produce a *lot* of false positives in
|
||||
;; emacs configs, so we disable `emacs-lisp-checkdoc' and reduce the
|
||||
;; `emacs-lisp' checker's verbosity.
|
||||
(add-hook 'flycheck-mode-hook #'+emacs-lisp|reduce-flycheck-errors-in-emacs-config)
|
||||
(add-hook 'flycheck-mode-hook #'+emacs-lisp-reduce-flycheck-errors-in-emacs-config-h)
|
||||
|
||||
;; Special fontification for elisp
|
||||
;; Special syntax highlighting for elisp...
|
||||
(font-lock-add-keywords
|
||||
'emacs-lisp-mode
|
||||
(append `(;; custom Doom cookies
|
||||
|
@ -68,7 +73,7 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
|
|||
`((+emacs-lisp-highlight-vars-and-faces . +emacs-lisp--face)))))
|
||||
|
||||
;; Recenter window after following definition
|
||||
(advice-add #'elisp-def :after #'doom*recenter)
|
||||
(advice-add #'elisp-def :after #'doom-recenter-a)
|
||||
|
||||
(map! :localleader
|
||||
:map emacs-lisp-mode-map
|
||||
|
@ -78,28 +83,10 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
|
|||
;;
|
||||
;;; Packages
|
||||
|
||||
(when (featurep! :editor evil)
|
||||
(after! macrostep
|
||||
(evil-define-key* 'normal macrostep-keymap
|
||||
[return] #'macrostep-expand
|
||||
"e" #'macrostep-expand
|
||||
"u" #'macrostep-collapse
|
||||
"c" #'macrostep-collapse
|
||||
|
||||
[tab] #'macrostep-next-macro
|
||||
"\C-n" #'macrostep-next-macro
|
||||
"J" #'macrostep-next-macro
|
||||
|
||||
[backtab] #'macrostep-prev-macro
|
||||
"K" #'macrostep-prev-macro
|
||||
"\C-p" #'macrostep-prev-macro
|
||||
|
||||
"q" #'macrostep-collapse-all
|
||||
"C" #'macrostep-collapse-all)
|
||||
|
||||
;; `evil-normalize-keymaps' seems to be required for macrostep or it won't
|
||||
;; apply for the very first invocation
|
||||
(add-hook 'macrostep-mode-hook #'evil-normalize-keymaps)))
|
||||
(map! :when (featurep! :editor evil)
|
||||
:after macrostep
|
||||
:map macrostep-keymap
|
||||
:n [return] #'macrostep-expand)
|
||||
|
||||
|
||||
;;;###package overseer
|
||||
|
@ -107,7 +94,7 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
|
|||
(remove-hook 'emacs-lisp-mode-hook 'overseer-enable-mode)
|
||||
|
||||
|
||||
(def-package! flycheck-cask
|
||||
(use-package! flycheck-cask
|
||||
:when (featurep! :tools flycheck)
|
||||
:defer t
|
||||
:init
|
||||
|
@ -115,25 +102,45 @@ This marks a foldable marker for `outline-minor-mode' in elisp buffers.")
|
|||
(add-hook 'flycheck-mode-hook #'flycheck-cask-setup nil t)))
|
||||
|
||||
|
||||
(def-package! elisp-demos
|
||||
(use-package! elisp-demos
|
||||
:defer t
|
||||
:init
|
||||
(advice-add 'describe-function-1 :after #'elisp-demos-advice-describe-function-1)
|
||||
(advice-add 'helpful-update :after #'elisp-demos-advice-helpful-update))
|
||||
(advice-add 'helpful-update :after #'elisp-demos-advice-helpful-update)
|
||||
:config
|
||||
(defadvice! +emacs-lisp--add-doom-elisp-demos-a (orig-fn symbol)
|
||||
"Add Doom's own demos to help buffers."
|
||||
:around #'elisp-demos--search
|
||||
(or (funcall orig-fn symbol)
|
||||
(when-let* ((elisp-demos--elisp-demos.org (doom-glob doom-docs-dir "api.org")))
|
||||
(funcall orig-fn symbol)))))
|
||||
|
||||
|
||||
(use-package! buttercup
|
||||
:defer t
|
||||
:minor ("/test[/-].+\\.el$" . buttercup-minor-mode)
|
||||
:preface
|
||||
;; buttercup.el doesn't define a keymap for `buttercup-minor-mode', as we have
|
||||
;; to fool its internal `define-minor-mode' call into thinking one exists, so
|
||||
;; it will associate it with the mode.
|
||||
(defvar buttercup-minor-mode-map (make-sparse-keymap))
|
||||
:config
|
||||
(set-popup-rule! "^\\*Buttercup\\*$" :size 0.45 :select nil :ttl 0)
|
||||
(set-yas-minor-mode! 'buttercup-minor-mode)
|
||||
(when (featurep 'evil)
|
||||
(add-hook 'buttercup-minor-mode-hook #'evil-normalize-keymaps))
|
||||
(map! :map buttercup-minor-mode-map
|
||||
:localleader
|
||||
:prefix "t"
|
||||
"t" #'+emacs-lisp/buttercup-run-file
|
||||
"a" #'+emacs-lisp/buttercup-run-project
|
||||
"s" #'buttercup-run-at-point))
|
||||
|
||||
|
||||
;;
|
||||
;;; Project modes
|
||||
|
||||
(def-project-mode! +emacs-lisp-ert-mode
|
||||
:modes (emacs-lisp-mode)
|
||||
:modes '(emacs-lisp-mode)
|
||||
:match "/test[/-].+\\.el$"
|
||||
:add-hooks (overseer-enable-mode))
|
||||
|
||||
(associate! buttercup-minor-mode
|
||||
:modes (emacs-lisp-mode)
|
||||
:match "/test[/-].+\\.el$")
|
||||
|
||||
(after! buttercup
|
||||
(set-yas-minor-mode! 'buttercup-minor-mode))
|
||||
|
||||
:add-hooks '(overseer-enable-mode))
|
||||
|
|
|
@ -11,3 +11,5 @@
|
|||
|
||||
(when (featurep! :tools flycheck)
|
||||
(package! flycheck-cask))
|
||||
|
||||
(package! buttercup)
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
;;; lang/erlang/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(def-package! erlang
|
||||
(use-package! erlang
|
||||
:mode ("\\.erlang$" . erlang-mode)
|
||||
:mode ("/rebar\\.config\\(?:\\.script\\)?$" . erlang-mode)
|
||||
:mode ("/\\(?:app\\|sys\\)\\.config$" . erlang-mode))
|
||||
|
||||
|
||||
(def-package! flycheck-rebar3
|
||||
(use-package! flycheck-rebar3
|
||||
:when (featurep! :tools flycheck)
|
||||
:after flycheck
|
||||
:config (flycheck-rebar3-setup))
|
||||
|
||||
|
||||
(def-package! ivy-erlang-complete
|
||||
(use-package! ivy-erlang-complete
|
||||
:when (featurep! :completion ivy)
|
||||
:hook (erlang-mode . ivy-erlang-complete-init)
|
||||
:config
|
||||
|
@ -20,6 +20,6 @@
|
|||
(add-hook 'after-save-hook #'ivy-erlang-complete-reparse nil t)))
|
||||
|
||||
|
||||
(def-package! company-erlang
|
||||
(use-package! company-erlang
|
||||
:when (featurep! :completion company)
|
||||
:hook (erlang-mode . company-erlang-init))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; lang/ess/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(def-package! ess
|
||||
(use-package! ess
|
||||
:commands (stata SAS)
|
||||
:init
|
||||
(setq ess-smart-S-assign-key nil)
|
||||
|
|
|
@ -53,11 +53,11 @@
|
|||
"n" #'+go/test-nested)))
|
||||
|
||||
|
||||
(def-package! gorepl-mode
|
||||
(use-package! gorepl-mode
|
||||
:commands gorepl-run-load-current-file)
|
||||
|
||||
|
||||
(def-package! company-go
|
||||
(use-package! company-go
|
||||
:when (and (featurep! :completion company)
|
||||
(not (featurep! +lsp)))
|
||||
:after go-mode
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; lang/haskell/+dante.el -*- lexical-binding: t; -*-
|
||||
;;;###if (featurep! +dante)
|
||||
|
||||
(def-package! dante
|
||||
(use-package! dante
|
||||
:hook (haskell-mode-local-vars . dante-mode)
|
||||
:init
|
||||
(setq dante-load-flags '(;; defaults:
|
||||
|
@ -19,15 +19,16 @@
|
|||
|
||||
(set-company-backend! 'dante-mode #'dante-company)
|
||||
|
||||
(defun +haskell*restore-modified-state (orig-fn &rest args)
|
||||
"Dante quietly saves the current buffer (without triggering save hooks) before
|
||||
(defadvice! +haskell--restore-modified-state-a (orig-fn &rest args)
|
||||
"Marks the buffer as falsely modified.
|
||||
Dante quietly saves the current buffer (without triggering save hooks) before
|
||||
invoking flycheck, unexpectedly leaving the buffer in an unmodified state. This
|
||||
is annoying if we depend on save hooks to do work on the buffer (like
|
||||
reformatting), so we restore a (false) modified state."
|
||||
reformatting)."
|
||||
:around #'dante-async-load-current-buffer
|
||||
(let ((modified-p (buffer-modified-p)))
|
||||
(apply orig-fn args)
|
||||
(if modified-p (set-buffer-modified-p t))))
|
||||
(advice-add #'dante-async-load-current-buffer :around #'+haskell*restore-modified-state)
|
||||
|
||||
(when (featurep 'evil)
|
||||
(add-hook 'dante-mode-hook #'evil-normalize-keymaps))
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
;;; lang/haskell/+intero.el -*- lexical-binding: t; -*-
|
||||
;;;###if (featurep! +intero)
|
||||
|
||||
(def-package! intero
|
||||
(use-package! intero
|
||||
:commands intero-mode
|
||||
:init
|
||||
(defun +haskell|init-intero ()
|
||||
"Initializes `intero-mode' in haskell-mode, unless stack isn't installed.
|
||||
(add-hook! 'haskell-mode-local-vars-hook
|
||||
(defun +haskell-init-intero-h ()
|
||||
"Initializes `intero-mode' in haskell-mode, unless stack isn't installed.
|
||||
This is necessary because `intero-mode' doesn't do its own error checks."
|
||||
(when (derived-mode-p 'haskell-mode)
|
||||
(if (executable-find "stack")
|
||||
(intero-mode +1)
|
||||
(message "Couldn't find stack. Refusing to enable intero-mode."))))
|
||||
(add-hook 'haskell-mode-local-vars-hook #'+haskell|init-intero)
|
||||
(when (derived-mode-p 'haskell-mode)
|
||||
(if (executable-find "stack")
|
||||
(intero-mode +1)
|
||||
(message "Couldn't find stack. Refusing to enable intero-mode.")))))
|
||||
:config
|
||||
(setq haskell-compile-cabal-build-command "stack build --fast")
|
||||
(set-lookup-handlers! 'intero-mode :definition #'intero-goto-definition)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; lang/haskell/+lsp.el -*- lexical-binding: t; -*-
|
||||
|
||||
(def-package! lsp-haskell
|
||||
(use-package! lsp-haskell
|
||||
:after haskell-mode
|
||||
:init (add-hook 'haskell-mode-hook #'lsp!)
|
||||
:config
|
||||
|
|
|
@ -13,13 +13,19 @@
|
|||
haskell-process-auto-import-loaded-modules t
|
||||
haskell-process-show-overlays (not (featurep! :tools flycheck))) ; redundant with flycheck
|
||||
|
||||
(set-lookup-handlers! 'haskell-mode :definition #'haskell-mode-jump-to-def-or-tag)
|
||||
(set-file-template! 'haskell-mode :trigger #'haskell-auto-insert-module-template :project t)
|
||||
(set-repl-handler! '(haskell-mode haskell-cabal-mode literate-haskell-mode) #'+haskell/open-repl)
|
||||
(set-lookup-handlers! 'haskell-mode
|
||||
:definition #'haskell-mode-jump-to-def-or-tag)
|
||||
(set-file-template! 'haskell-mode
|
||||
:trigger #'haskell-auto-insert-module-template
|
||||
:project t)
|
||||
(set-repl-handler! '(haskell-mode
|
||||
haskell-cabal-mode
|
||||
literate-haskell-mode)
|
||||
#'+haskell/open-repl)
|
||||
|
||||
(add-hook! 'haskell-mode-hook
|
||||
#'(haskell-collapse-mode ; support folding haskell code blocks
|
||||
interactive-haskell-mode))
|
||||
#'haskell-collapse-mode ; support folding haskell code blocks
|
||||
#'interactive-haskell-mode)
|
||||
|
||||
(add-to-list 'completion-ignored-extensions ".hi")
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; lang/hy/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(def-package! hy-mode
|
||||
(use-package! hy-mode
|
||||
:mode "\\.hy\\'"
|
||||
:interpreter "hy"
|
||||
:config
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; lang/idris/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
(after! idris-mode
|
||||
(add-hook! 'idris-mode-hook 'turn-on-idris-simple-indent)
|
||||
(add-hook 'idris-mode-hook #'turn-on-idris-simple-indent)
|
||||
(set-repl-handler! 'idris-mode 'idris-pop-to-repl)
|
||||
(set-lookup-handlers! 'idris-mode
|
||||
:documentation #'idris-docs-at-point
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
;; NOTE This submodule is incomplete
|
||||
|
||||
(def-package! eclim
|
||||
(use-package! eclim
|
||||
:hook (java-mode . eclim-mode)
|
||||
:config
|
||||
(set-lookup-handlers! 'java-mode
|
||||
|
@ -43,7 +43,7 @@
|
|||
"u" #'eclim-project-update)))
|
||||
|
||||
|
||||
(def-package! company-emacs-eclim
|
||||
(use-package! company-emacs-eclim
|
||||
:when (featurep! :completion company)
|
||||
:after java-mode
|
||||
:config
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; lang/java/+lsp.el -*- lexical-binding: t; -*-
|
||||
;;;###if (featurep! +lsp)
|
||||
|
||||
(def-package! lsp-java
|
||||
(use-package! lsp-java
|
||||
:after-call java-mode
|
||||
:init (add-hook 'java-mode-local-vars-hook #'lsp!)
|
||||
:config
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue