2017-06-08 11:47:56 +02:00
|
|
|
;;; completion/ivy/config.el -*- lexical-binding: t; -*-
|
2017-02-13 04:54:12 -05:00
|
|
|
|
2019-03-07 11:07:45 +10:00
|
|
|
(defvar +ivy-buffer-preview nil
|
|
|
|
"If non-nil, preview buffers while switching, à la `counsel-switch-buffer'.
|
|
|
|
|
|
|
|
When nil, don't preview anything.
|
|
|
|
When non-nil, preview non-virtual buffers.
|
|
|
|
When 'everything, also preview virtual buffers")
|
|
|
|
|
2019-04-07 15:54:03 -04:00
|
|
|
(defvar +ivy-buffer-unreal-face 'font-lock-comment-face
|
|
|
|
"The face for unreal buffers in `ivy-switch-to-buffer'.")
|
|
|
|
|
2019-05-20 21:06:06 -04:00
|
|
|
(defvar +ivy-edit-functions nil
|
|
|
|
"A plist mapping ivy/counsel commands to commands that generate an editable
|
|
|
|
results buffer.")
|
|
|
|
|
2019-10-25 20:24:36 -04:00
|
|
|
(defvar +ivy-standard-search-fn
|
|
|
|
(if (featurep! +prescient)
|
|
|
|
#'+ivy-prescient-non-fuzzy
|
|
|
|
#'ivy--regex-plus)
|
|
|
|
"Function to use for non-fuzzy search commands.")
|
|
|
|
|
|
|
|
(defvar +ivy-alternative-search-fn
|
|
|
|
(cond ((featurep! +prescient) #'ivy-prescient-re-builder)
|
|
|
|
((featurep! +fuzzy) #'ivy--regex-fuzzy)
|
|
|
|
(#'ivy--regex-ignore-order))
|
|
|
|
"Function to use for fuzzy search commands.")
|
2017-02-13 04:54:12 -05:00
|
|
|
|
2017-02-13 21:11:54 -05:00
|
|
|
|
|
|
|
;;
|
2019-04-06 01:31:59 -04:00
|
|
|
;;; Packages
|
2017-02-13 21:11:54 -05:00
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! ivy
|
2018-05-25 00:46:11 +02:00
|
|
|
:after-call pre-command-hook
|
2019-06-11 18:11:51 +02:00
|
|
|
:init
|
2019-07-02 13:12:04 +02:00
|
|
|
(setq ivy-re-builders-alist
|
2019-12-13 23:00:01 -05:00
|
|
|
`(,@(cl-loop for cmd in '(counsel-rg
|
2019-10-25 20:24:36 -04:00
|
|
|
swiper
|
|
|
|
swiper-isearch)
|
2019-12-13 22:49:26 -05:00
|
|
|
collect (cons cmd #'+ivy-alternative-search))
|
2019-07-02 13:12:04 +02:00
|
|
|
;; Ignore order for non-fuzzy searches by default
|
2019-12-13 22:49:26 -05:00
|
|
|
(t . +ivy-standard-search)))
|
2019-10-25 20:24:36 -04:00
|
|
|
|
|
|
|
(define-key!
|
|
|
|
[remap switch-to-buffer] #'+ivy/switch-buffer
|
|
|
|
[remap switch-to-buffer-other-window] #'+ivy/switch-buffer-other-window
|
|
|
|
[remap persp-switch-to-buffer] #'+ivy/switch-workspace-buffer
|
|
|
|
[remap evil-show-jumps] #'+ivy/jump-list)
|
2017-02-22 04:27:23 -05:00
|
|
|
:config
|
2019-11-17 17:56:25 -05:00
|
|
|
;; Counsel changes a lot of ivy's state at startup; to control for that, we
|
|
|
|
;; need to load it as early as possible. Some packages (like `ivy-prescient')
|
|
|
|
;; require this.
|
|
|
|
(require 'counsel nil t)
|
|
|
|
|
2019-10-26 04:06:10 -04:00
|
|
|
(setq ivy-height 17
|
2017-02-13 04:54:12 -05:00
|
|
|
ivy-wrap t
|
|
|
|
ivy-fixed-height-minibuffer t
|
2017-02-22 04:27:23 -05:00
|
|
|
projectile-completion-system 'ivy
|
2017-05-19 05:45:11 -04:00
|
|
|
;; disable magic slash on non-match
|
2018-01-08 14:41:41 -05:00
|
|
|
ivy-magic-slash-non-match-action nil
|
|
|
|
;; don't show recent files in switch-buffer
|
|
|
|
ivy-use-virtual-buffers nil
|
|
|
|
;; ...but if that ever changes, show their full path
|
2018-03-23 02:23:57 -04:00
|
|
|
ivy-virtual-abbreviate 'full
|
|
|
|
;; don't quit minibuffer on delete-error
|
2019-12-13 23:00:01 -05:00
|
|
|
ivy-on-del-error-function #'ignore
|
2018-05-14 20:03:36 +02:00
|
|
|
;; enable ability to select prompt (alternative to `ivy-immediate-done')
|
2019-06-11 18:11:51 +02:00
|
|
|
ivy-use-selectable-prompt t)
|
2017-02-13 04:54:12 -05:00
|
|
|
|
2019-10-25 20:24:36 -04:00
|
|
|
;; Highlight each ivy candidate including the following newline, so that it
|
|
|
|
;; extends to the right edge of the window
|
2019-09-20 23:10:53 -04:00
|
|
|
(setf (alist-get 't ivy-format-functions-alist)
|
|
|
|
#'ivy-format-function-line)
|
|
|
|
|
2019-10-18 17:42:37 -04:00
|
|
|
;; Integrate `ivy' with `better-jumper'; ensure a jump point is registered
|
|
|
|
;; before jumping to new locations with ivy
|
2019-10-25 20:24:36 -04:00
|
|
|
(setf (alist-get 't ivy-hooks-alist)
|
|
|
|
(lambda ()
|
|
|
|
(with-ivy-window
|
|
|
|
(setq +ivy--origin (point-marker)))))
|
2019-05-19 02:13:20 -04:00
|
|
|
|
2019-07-28 14:52:59 +02:00
|
|
|
(add-hook! 'minibuffer-exit-hook
|
2019-07-18 15:27:20 +02:00
|
|
|
(defun +ivy--set-jump-point-maybe-h ()
|
2019-10-25 20:24:36 -04:00
|
|
|
(and (markerp (bound-and-true-p +ivy--origin))
|
|
|
|
(not (equal (ignore-errors (with-ivy-window (point-marker)))
|
|
|
|
+ivy--origin))
|
|
|
|
(with-current-buffer (marker-buffer +ivy--origin)
|
|
|
|
(better-jumper-set-jump +ivy--origin)))
|
|
|
|
(setq +ivy--origin nil)))
|
2019-05-19 02:13:20 -04:00
|
|
|
|
2018-07-28 12:33:27 +02:00
|
|
|
(after! yasnippet
|
2019-10-17 01:47:58 -04:00
|
|
|
(add-hook 'yas-prompt-functions #'+ivy-yas-prompt))
|
2017-02-22 04:27:23 -05:00
|
|
|
|
2019-10-18 17:42:37 -04:00
|
|
|
(defadvice! +ivy--inhibit-completion-in-region-a (orig-fn &rest args)
|
2019-06-07 23:08:23 +02:00
|
|
|
"`ivy-completion-in-region' struggles with completing certain
|
|
|
|
evil-ex-specific constructs, so we disable it solely in evil-ex."
|
:boom: revise advice naming convention (1/2)
This is first of three big naming convention updates that have been a
long time coming. With 2.1 on the horizon, all the breaking updates will
batched together in preparation for the long haul.
In this commit, we do away with the asterix to communicate that a
function is an advice function, and we replace it with the '-a' suffix.
e.g.
doom*shut-up -> doom-shut-up-a
doom*recenter -> doom-recenter-a
+evil*static-reindent -> +evil--static-reindent-a
The rationale behind this change is:
1. Elisp's own formatting/indenting tools would occasionally struggle
with | and * (particularly pp and cl-prettyprint). They have no
problem with / and :, fortunately.
2. External syntax highlighters (like pygmentize, discord markdown or
github markdown) struggle with it, sometimes refusing to highlight
code beyond these symbols.
3. * and | are less expressive than - and -- in communicating the
intended visibility, versatility and stability of a function.
4. It complicated the regexps we must use to search for them.
5. They were arbitrary and over-complicated to begin with, decided
on haphazardly way back when Doom was simply "my private config".
Anyhow, like how predicate functions have the -p suffix, we'll adopt the
-a suffix for advice functions, -h for hook functions and -fn for
variable functions.
Other noteable changes:
- Replaces advice-{add,remove}! macro with new def-advice!
macro. The old pair weren't as useful. The new def-advice! saves on a
lot of space.
- Removed "stage" assertions to make sure you were using the right
macros in the right place. Turned out to not be necessary, we'll
employ better checks later.
2019-07-18 15:42:52 +02:00
|
|
|
:around #'evil-ex
|
2019-06-07 23:08:23 +02:00
|
|
|
(let ((completion-in-region-function #'completion--in-region))
|
|
|
|
(apply orig-fn args)))
|
|
|
|
|
2019-05-20 21:06:06 -04:00
|
|
|
(define-key ivy-minibuffer-map (kbd "C-c C-e") #'+ivy/woccur)
|
|
|
|
|
2018-08-03 16:12:27 +02:00
|
|
|
(ivy-mode +1)
|
2017-02-13 04:54:12 -05:00
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! ivy-hydra
|
2019-10-18 12:51:50 -04:00
|
|
|
:commands (ivy-dispatching-done ivy--matcher-desc ivy-hydra/body)
|
2018-08-03 16:12:27 +02:00
|
|
|
:init
|
|
|
|
(define-key! ivy-minibuffer-map
|
2019-10-18 12:51:50 -04:00
|
|
|
"C-o" #'ivy-dispatching-done
|
2019-04-20 02:15:14 -04:00
|
|
|
"M-o" #'hydra-ivy/body)
|
|
|
|
:config
|
|
|
|
;; ivy-hydra rebinds this, so we have to do so again
|
|
|
|
(define-key ivy-minibuffer-map (kbd "M-o") #'hydra-ivy/body)))
|
2018-01-08 14:41:41 -05:00
|
|
|
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! ivy-rich
|
2019-04-25 22:18:17 -04:00
|
|
|
:after ivy
|
2018-09-19 23:34:00 -04:00
|
|
|
:config
|
2019-12-06 17:16:34 -05:00
|
|
|
(setq ivy-rich-parse-remote-buffer nil)
|
|
|
|
|
2019-04-25 22:18:17 -04:00
|
|
|
(when (featurep! +icons)
|
2019-04-26 23:48:49 +10:00
|
|
|
(cl-pushnew '(+ivy-rich-buffer-icon)
|
2019-04-06 01:31:59 -04:00
|
|
|
(cadr (plist-get ivy-rich-display-transformers-list
|
2019-04-25 22:18:17 -04:00
|
|
|
'ivy-switch-buffer))))
|
2019-04-06 01:31:59 -04:00
|
|
|
|
2019-05-14 10:06:36 -04:00
|
|
|
;; Include variable value in `counsel-describe-variable'
|
2019-10-18 17:42:37 -04:00
|
|
|
(plist-put! ivy-rich-display-transformers-list
|
|
|
|
'counsel-describe-variable
|
|
|
|
'(:columns
|
|
|
|
((counsel-describe-variable-transformer (:width 40)) ; the original transformer
|
|
|
|
(+ivy-rich-describe-variable-transformer (:width 50))
|
|
|
|
(ivy-rich-counsel-variable-docstring (:face font-lock-doc-face)))))
|
2019-05-14 10:06:36 -04:00
|
|
|
|
2019-04-10 19:22:29 -04:00
|
|
|
;; Remove built-in coloring of buffer list; we do our own
|
|
|
|
(setq ivy-switch-buffer-faces-alist nil)
|
|
|
|
(ivy-set-display-transformer 'internal-complete-buffer nil)
|
|
|
|
|
2019-04-06 01:31:59 -04:00
|
|
|
;; Highlight buffers differently based on whether they're in the same project
|
|
|
|
;; as the current project or not.
|
2019-04-05 23:52:29 -04:00
|
|
|
(let* ((plist (plist-get ivy-rich-display-transformers-list 'ivy-switch-buffer))
|
2019-04-06 01:31:59 -04:00
|
|
|
(switch-buffer-alist (assq 'ivy-rich-candidate (plist-get plist :columns))))
|
2018-10-17 14:34:43 -04:00
|
|
|
(when switch-buffer-alist
|
2019-04-06 01:31:59 -04:00
|
|
|
(setcar switch-buffer-alist '+ivy-rich-buffer-name)))
|
|
|
|
|
2019-05-14 10:12:12 -04:00
|
|
|
;; Apply switch buffer transformers to `counsel-projectile-switch-to-buffer' as well
|
2019-10-18 17:42:37 -04:00
|
|
|
(plist-put! ivy-rich-display-transformers-list
|
|
|
|
'counsel-projectile-switch-to-buffer
|
|
|
|
(plist-get ivy-rich-display-transformers-list 'ivy-switch-buffer))
|
2019-04-25 22:18:17 -04:00
|
|
|
|
|
|
|
(ivy-rich-mode +1))
|
|
|
|
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! all-the-icons-ivy
|
2019-04-25 22:18:17 -04:00
|
|
|
:when (featurep! +icons)
|
|
|
|
:after ivy
|
|
|
|
:config
|
|
|
|
;; `all-the-icons-ivy' is incompatible with ivy-rich's switch-buffer
|
|
|
|
;; modifications, so we disable them and merge them ourselves
|
|
|
|
(setq all-the-icons-ivy-buffer-commands nil)
|
|
|
|
|
|
|
|
(all-the-icons-ivy-setup)
|
|
|
|
(after! counsel-projectile
|
|
|
|
(let ((all-the-icons-ivy-file-commands '(counsel-projectile
|
|
|
|
counsel-projectile-find-file
|
|
|
|
counsel-projectile-find-dir)))
|
|
|
|
(all-the-icons-ivy-setup))))
|
2018-09-19 23:34:00 -04:00
|
|
|
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! counsel
|
2019-11-17 17:56:25 -05:00
|
|
|
:defer t
|
2018-01-27 20:57:02 -05:00
|
|
|
:init
|
2019-10-18 17:42:37 -04:00
|
|
|
(define-key!
|
|
|
|
[remap apropos] #'counsel-apropos
|
|
|
|
[remap bookmark-jump] #'counsel-bookmark
|
|
|
|
[remap describe-face] #'counsel-faces
|
|
|
|
[remap describe-function] #'counsel-describe-function
|
|
|
|
[remap describe-variable] #'counsel-describe-variable
|
|
|
|
[remap describe-bindings] #'counsel-descbinds
|
|
|
|
[remap set-variable] #'counsel-set-variable
|
|
|
|
[remap execute-extended-command] #'counsel-M-x
|
|
|
|
[remap find-file] #'counsel-find-file
|
|
|
|
[remap find-library] #'counsel-find-library
|
|
|
|
[remap info-lookup-symbol] #'counsel-info-lookup-symbol
|
|
|
|
[remap imenu] #'counsel-imenu
|
|
|
|
[remap recentf-open-files] #'counsel-recentf
|
|
|
|
[remap swiper] #'counsel-grep-or-swiper
|
|
|
|
[remap evil-ex-registers] #'counsel-evil-registers
|
2019-10-27 13:31:17 -04:00
|
|
|
[remap evil-show-marks] #'counsel-mark-ring
|
2019-10-18 17:42:37 -04:00
|
|
|
[remap yank-pop] #'counsel-yank-pop
|
2019-11-21 14:42:37 -05:00
|
|
|
[remap load-theme] #'counsel-load-theme
|
2019-10-18 17:42:37 -04:00
|
|
|
[remap locate] #'counsel-locate
|
2019-10-20 19:00:15 -04:00
|
|
|
[remap unicode-chars-list-chars] #'counsel-unicode-char
|
2019-10-18 17:42:37 -04:00
|
|
|
[remap compile] #'+ivy/compile
|
|
|
|
[remap projectile-compile-project] #'+ivy/project-compile)
|
2017-02-13 21:11:54 -05:00
|
|
|
:config
|
2018-06-18 02:26:05 +02:00
|
|
|
(set-popup-rule! "^\\*ivy-occur" :size 0.35 :ttl 0 :quit nil)
|
2018-01-28 22:24:45 -05:00
|
|
|
|
2019-10-18 17:42:37 -04:00
|
|
|
;; Don't use ^ as initial input. Set this here because `counsel' defines more
|
|
|
|
;; of its own, on top of the defaults.
|
|
|
|
(setq ivy-initial-inputs-alist nil)
|
|
|
|
|
|
|
|
;; 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))))))
|
|
|
|
|
|
|
|
;; Integrate with `helpful'
|
|
|
|
(setq counsel-describe-function-function #'helpful-callable
|
|
|
|
counsel-describe-variable-function #'helpful-variable)
|
|
|
|
|
2019-10-17 01:45:04 -04:00
|
|
|
;; Make `counsel-compile' projectile-aware (if you prefer it over
|
|
|
|
;; `+ivy/compile' and `+ivy/project-compile')
|
|
|
|
(add-to-list 'counsel-compile-root-functions #'projectile-project-root)
|
2019-10-17 01:43:37 -04:00
|
|
|
(after! savehist
|
|
|
|
;; Persist `counsel-compile' history
|
|
|
|
(add-to-list 'savehist-additional-variables 'counsel-compile-history))
|
|
|
|
|
2019-10-18 17:42:37 -04:00
|
|
|
;; Use spotlight on mac for `counsel-locate' by default
|
2019-09-23 00:35:57 +09:00
|
|
|
(when IS-MAC
|
|
|
|
(setq counsel-locate-cmd #'counsel-locate-cmd-mdfind))
|
2017-02-13 04:54:12 -05:00
|
|
|
|
2019-10-18 17:42:37 -04:00
|
|
|
;; Don't mess with font-locking on the dashboard; it causes breakages
|
|
|
|
(add-to-list 'swiper-font-lock-exclude #'+doom-dashboard-mode)
|
2018-09-08 18:40:11 -04:00
|
|
|
|
2019-04-21 23:22:06 -04:00
|
|
|
;; Record in jumplist when opening files via counsel-{ag,rg,pt,git-grep}
|
|
|
|
(add-hook 'counsel-grep-post-action-hook #'better-jumper-set-jump)
|
|
|
|
|
2018-07-05 14:05:09 +02:00
|
|
|
;; Factories
|
|
|
|
(defun +ivy-action-reloading (cmd)
|
|
|
|
(lambda (x)
|
|
|
|
(funcall cmd x)
|
|
|
|
(ivy--reset-state ivy-last)))
|
|
|
|
|
|
|
|
(defun +ivy-action-given-file (cmd prompt)
|
|
|
|
(lambda (source)
|
|
|
|
(let* ((enable-recursive-minibuffers t)
|
|
|
|
(target (read-file-name (format "%s %s to:" prompt source))))
|
|
|
|
(funcall cmd source target 1))))
|
|
|
|
|
2018-07-04 23:59:18 +08:00
|
|
|
;; Configure `counsel-find-file'
|
2019-10-19 17:10:03 -04:00
|
|
|
(setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)")
|
2018-07-04 23:59:18 +08:00
|
|
|
(ivy-add-actions
|
|
|
|
'counsel-find-file
|
2018-07-05 00:38:41 +08:00
|
|
|
`(("b" counsel-find-file-cd-bookmark-action "cd bookmark")
|
|
|
|
("s" counsel-find-file-as-root "open as root")
|
|
|
|
("m" counsel-find-file-mkdir-action "mkdir")
|
2018-07-05 14:05:09 +02:00
|
|
|
("c" ,(+ivy-action-given-file #'copy-file "Copy file") "copy file")
|
|
|
|
("d" ,(+ivy-action-reloading #'+ivy-confirm-delete-file) "delete")
|
2018-07-05 00:38:41 +08:00
|
|
|
("r" (lambda (path) (rename-file path (read-string "New name: "))) "rename")
|
2018-07-05 14:05:09 +02:00
|
|
|
("R" ,(+ivy-action-reloading (+ivy-action-given-file #'rename-file "Move")) "move")
|
2018-07-04 23:59:18 +08:00
|
|
|
("f" find-file-other-window "other window")
|
2018-07-05 00:38:41 +08:00
|
|
|
("F" find-file-other-frame "other frame")
|
|
|
|
("p" (lambda (path) (with-ivy-window (insert (file-relative-name path default-directory)))) "insert relative path")
|
|
|
|
("P" (lambda (path) (with-ivy-window (insert path))) "insert absolute path")
|
2018-07-04 23:59:18 +08:00
|
|
|
("l" (lambda (path) "Insert org-link with relative path"
|
2018-07-05 00:38:41 +08:00
|
|
|
(with-ivy-window (insert (format "[[./%s]]" (file-relative-name path default-directory))))) "insert org-link (rel. path)")
|
2018-07-04 23:59:18 +08:00
|
|
|
("L" (lambda (path) "Insert org-link with absolute path"
|
2018-07-05 00:38:41 +08:00
|
|
|
(with-ivy-window (insert (format "[[%s]]" path)))) "insert org-link (abs. path)")))
|
2018-07-04 23:59:18 +08:00
|
|
|
|
2018-08-03 16:12:27 +02:00
|
|
|
(ivy-add-actions
|
2019-10-10 22:02:18 -04:00
|
|
|
'counsel-ag ; also applies to `counsel-rg'
|
2018-08-03 16:12:27 +02:00
|
|
|
'(("O" +ivy-git-grep-other-window-action "open in other window"))))
|
2017-02-13 04:54:12 -05:00
|
|
|
|
2019-04-06 01:31:59 -04:00
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! counsel-projectile
|
2019-07-06 13:31:19 +02:00
|
|
|
:defer t
|
2018-01-27 20:57:02 -05:00
|
|
|
:init
|
2019-10-18 17:42:37 -04:00
|
|
|
(define-key!
|
|
|
|
[remap projectile-find-file] #'+ivy/projectile-find-file
|
|
|
|
[remap projectile-find-dir] #'counsel-projectile-find-dir
|
|
|
|
[remap projectile-switch-to-buffer] #'counsel-projectile-switch-to-buffer
|
|
|
|
[remap projectile-grep] #'counsel-projectile-grep
|
|
|
|
[remap projectile-ag] #'counsel-projectile-ag
|
|
|
|
[remap projectile-switch-project] #'counsel-projectile-switch-project)
|
2018-01-27 20:57:02 -05:00
|
|
|
:config
|
2019-10-18 17:42:37 -04:00
|
|
|
;; A more sensible `counsel-projectile-find-file' that reverts to
|
|
|
|
;; `counsel-find-file' if invoked from $HOME, `counsel-file-jump' if invoked
|
|
|
|
;; from a non-project, `projectile-find-file' if in a big project (more than
|
|
|
|
;; `ivy-sort-max-size' files), or `counsel-projectile-find-file' otherwise.
|
|
|
|
(setf (alist-get 'projectile-find-file counsel-projectile-key-bindings)
|
|
|
|
#'+ivy/projectile-find-file)
|
|
|
|
|
2018-08-04 02:30:26 +02:00
|
|
|
;; no highlighting visited files; slows down the filtering
|
2019-04-06 01:31:59 -04:00
|
|
|
(ivy-set-display-transformer #'counsel-projectile-find-file nil))
|
2018-01-27 20:57:02 -05:00
|
|
|
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! wgrep
|
2018-05-25 00:46:11 +02:00
|
|
|
:commands wgrep-change-to-wgrep-mode
|
2018-01-14 02:04:30 -05:00
|
|
|
:config (setq wgrep-auto-save-buffer t))
|
2018-05-08 21:47:40 +02:00
|
|
|
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! ivy-posframe
|
2019-11-07 12:49:30 -05:00
|
|
|
:when (featurep! +childframe)
|
2019-06-04 00:01:28 +02:00
|
|
|
:hook (ivy-mode . ivy-posframe-mode)
|
2018-05-08 21:47:40 +02:00
|
|
|
:config
|
2018-06-05 11:20:39 +02:00
|
|
|
(setq ivy-fixed-height-minibuffer nil
|
2019-07-10 21:27:12 +02:00
|
|
|
ivy-posframe-border-width 10
|
2018-06-26 01:47:32 +02:00
|
|
|
ivy-posframe-parameters
|
|
|
|
`((min-width . 90)
|
2019-07-10 21:27:12 +02:00
|
|
|
(min-height . ,ivy-height)))
|
2018-05-18 01:21:09 +02:00
|
|
|
|
2018-06-25 14:48:30 +02:00
|
|
|
;; default to posframe display function
|
2019-07-18 15:27:20 +02:00
|
|
|
(setf (alist-get t ivy-posframe-display-functions-alist)
|
|
|
|
#'+ivy-display-at-frame-center-near-bottom-fn)
|
2018-05-08 21:47:40 +02:00
|
|
|
|
2019-12-05 14:56:16 -05:00
|
|
|
;; posframe doesn't work well with async sources (the posframe will
|
|
|
|
;; occasionally stop responding/redrawing), and causes violent resizing of the
|
|
|
|
;; posframe.
|
2019-11-19 13:24:54 +01:00
|
|
|
(dolist (fn '(swiper counsel-rg counsel-grep counsel-git-grep))
|
2019-07-18 15:27:20 +02:00
|
|
|
(setf (alist-get fn ivy-posframe-display-functions-alist)
|
|
|
|
#'ivy-display-function-fallback)))
|
2018-05-30 11:25:41 +02:00
|
|
|
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! flx
|
2019-10-18 17:42:37 -04:00
|
|
|
:when (featurep! +fuzzy)
|
|
|
|
:unless (featurep! +prescient)
|
2018-08-04 13:47:19 +02:00
|
|
|
:defer t ; is loaded by ivy
|
2019-10-25 20:24:36 -04:00
|
|
|
:init (setq ivy-flx-limit 10000))
|
2018-08-04 13:47:19 +02:00
|
|
|
|
|
|
|
|
2019-07-23 12:44:03 +02:00
|
|
|
(use-package! ivy-prescient
|
2019-05-29 00:01:45 +10:00
|
|
|
:hook (ivy-mode . ivy-prescient-mode)
|
|
|
|
:when (featurep! +prescient)
|
|
|
|
:init
|
2019-07-11 17:23:20 +02:00
|
|
|
(setq prescient-filter-method
|
|
|
|
(if (featurep! +fuzzy)
|
|
|
|
'(literal regexp initialism fuzzy)
|
|
|
|
'(literal regexp initialism))
|
|
|
|
ivy-prescient-enable-filtering nil ; we do this ourselves
|
2019-10-25 20:24:36 -04:00
|
|
|
ivy-prescient-retain-classic-highlighting t)
|
2019-05-29 00:01:45 +10:00
|
|
|
|
|
|
|
:config
|
|
|
|
(defun +ivy-prescient-non-fuzzy (str)
|
|
|
|
(let ((prescient-filter-method '(literal regexp)))
|
|
|
|
(ivy-prescient-re-builder str)))
|
|
|
|
|
|
|
|
;; NOTE prescient config duplicated with `company'
|
|
|
|
(setq prescient-save-file (concat doom-cache-dir "prescient-save.el"))
|
|
|
|
(prescient-persist-mode +1))
|
|
|
|
|
|
|
|
|
2019-10-18 19:46:53 -04:00
|
|
|
;;;###package swiper
|
|
|
|
(setq swiper-action-recenter t)
|
|
|
|
|
|
|
|
|
2019-07-21 23:31:42 +02:00
|
|
|
;;;###package amx
|
|
|
|
(setq amx-save-file (concat doom-cache-dir "amx-items")) ; used by `counsel-M-x'
|