selectrum: improve bindings

- add missing emacs bindings
- properly feature guard swiper related bindings
- for selectrum, unbind `SPC s B` and temporarily bind `SPC s s` to
  isearch to prevent don't get errors until we decide what to do there.
- update readme to reflect that
This commit is contained in:
Itai Y. Efrat 2021-05-17 15:44:39 +03:00
parent c349a0a046
commit ed922a62cb
5 changed files with 33 additions and 18 deletions

View file

@ -105,17 +105,15 @@ users).
https://assets.doomemacs.org/completion/selectrum/search-replace.png
** TODO In-buffer searching
The =swiper= package provides an interactive buffer search powered by ivy. It
can be invoked with:
This module provides some in buffer searching bindings:
+ =SPC s s= (~swiper-isearch~)
+ =SPC s S= (~swiper-isearch-thing-at-point~)
+ =SPC s s= (~isearch~)
+ =SPC s S= (~+selectrum/search-symbol-at-point~ via ~consult-line~)
+ =SPC s b= (~consult-line~)
+ ~:sw[iper] [QUERY]~
https://assets.doomemacs.org/completion/selectrum/buffer-search.png
A wgrep buffer can be opened from swiper with =C-c C-e=.
A wgrep buffer can be opened from ~consult-line~ with =C-c C-e= (not yet).
** Selectrum integration for various completing commands
*** General

View file

@ -5,9 +5,10 @@
** TODO consider dropping prescient flag
** TODO =SPC s s= and =SPC s S= ~:sw~ ?
There isn't really a selectrum analogue to ~swiper-isearch~, ~consult-isearch~
does something else (give you previously used isearch search terms).
does something else (give you previously used isearch search terms). Bound to
regular isearch for now.
** TODO =SPC s B=
Selectrum/Consult don't have a ~swiper-all~ analogue either.
Selectrum/Consult don't have a ~swiper-all~ analogue either. Unbound for now.
* PROJ Bugs
** TODO =C-SPC= and live previews

View file

@ -113,8 +113,13 @@
;;; <leader> s --- search
(:prefix-map ("s" . "search")
:desc "Search project for symbol" "." #'+default/search-project-for-symbol-at-point
:desc "Search buffer" "b" #'swiper
:desc "Search all open buffers" "B" #'swiper-all
:desc "Search buffer" "b"
(cond ((featurep! :completion helm) #'swiper)
((featurep! :completion ivy) #'swiper)
((featurep! :completion selectrum) #'consult-line))
:desc "Search all open buffers" "B"
(cond ((featurep! :completion helm) #'swiper-all)
((featurep! :completion ivy) #'swiper-all))
:desc "Search current directory" "d" #'+default/search-cwd
:desc "Search other directory" "D" #'+default/search-other-cwd
:desc "Locate file" "f" #'+lookup/file
@ -129,7 +134,10 @@
:desc "Search project" "p" #'+default/search-project
:desc "Search other project" "P" #'+default/search-other-project
:desc "Search buffer" "s" #'+default/search-buffer
:desc "Search buffer for thing at point" "S" #'swiper-isearch-thing-at-point
:desc "Search buffer for thing at point" "S"
(cond ((featurep! :completion helm) #'swiper-isearch-thing-at-point)
((featurep! :completion ivy) #'swiper-isearch-thing-at-point)
((featurep! :completion selectrum) #'+selectrum/search-symbol-at-point))
:desc "Dictionary" "t" #'+lookup/dictionary-definition
:desc "Thesaurus" "T" #'+lookup/synonyms)
@ -425,7 +433,9 @@
:desc "Reconnect all" "r" #'circe-reconnect-all
:desc "Send message" "s" #'+irc/send-message
(:when (featurep! :completion ivy)
:desc "Jump to channel" "j" #'+irc/ivy-jump-to-channel)))
:desc "Jump to channel" "j" #'+irc/ivy-jump-to-channel)
(:when (featurep! :completion selectrum)
:desc "Jump to channel" "j" #'+irc/selectrum-jump-to-channel)))
;;; <leader> T --- twitter
(:when (featurep! :app twitter)

View file

@ -678,9 +678,12 @@
;;; <leader> s --- search
(:prefix-map ("s" . "search")
:desc "Search buffer" "b"
(cond ((featurep! :completion ivy) #'swiper)
(cond ((featurep! :completion helm) #'swiper)
((featurep! :completion ivy) #'swiper)
((featurep! :completion selectrum) #'consult-line))
:desc "Search all open buffers" "B" #'swiper-all
:desc "Search all open buffers" "B"
(cond ((featurep! :completion helm) #'swiper-all)
((featurep! :completion ivy) #'swiper-all))
:desc "Search current directory" "d" #'+default/search-cwd
:desc "Search other directory" "D" #'+default/search-other-cwd
:desc "Locate file" "f" #'locate
@ -698,7 +701,8 @@
:desc "Jump to mark" "r" #'evil-show-marks
:desc "Search buffer" "s" #'+default/search-buffer
:desc "Search buffer for thing at point" "S"
(cond ((featurep! :completion ivy) #'swiper-isearch-thing-at-point)
(cond ((featurep! :completion helm) #'swiper-isearch-thing-at-point)
((featurep! :completion ivy) #'swiper-isearch-thing-at-point)
((featurep! :completion selectrum) #'+selectrum/search-symbol-at-point))
:desc "Dictionary" "t" #'+lookup/dictionary-definition
:desc "Thesaurus" "T" #'+lookup/synonyms)

View file

@ -27,9 +27,11 @@ If prefix ARG is set, prompt for a directory to search from."
If a selection is active, pre-fill the prompt with it."
(interactive)
(call-interactively
(cond ((or (featurep! :completion helm) (featurep! :completion ivy))
(if (region-active-p)
#'swiper-isearch-thing-at-point
#'swiper-isearch)))
#'swiper-isearch))
((featurep! :completion selectrum) #'isearch-forward))))
;;;###autoload
(defun +default/search-project (&optional arg)