search highlighting (spacemacs/counsel-search) with ivy--regex-plus
spacemacs//ivy--regex-plus is a replacement for ivy--regex-plus in user configurations.
This commit is contained in:
parent
e63a9c05bd
commit
d2dab66724
|
@ -47,6 +47,10 @@ You can customize ivy with the following variables:
|
|||
- =ivy-height= The height of the minibuffer. The Spacemacs default is 15.
|
||||
- =ivy-use-selectable-prompt= When non-nil, make the prompt line selectable like
|
||||
a candidate. The Spacemacs default value is =t=.
|
||||
- =ivy-re-builders-alist= An alist of regex building functions for each collection function.
|
||||
See ivy documentation for possible choices.
|
||||
Use =spacemacs/ivy--regex-plus= instead of =ivy--regex-plus= to get correct highlighting
|
||||
in the search results
|
||||
|
||||
** Advanced buffer information
|
||||
To display more information about buffers set the layer variable
|
||||
|
|
|
@ -122,6 +122,16 @@
|
|||
(define-key map (kbd "C-c C-e") 'spacemacs//counsel-edit)
|
||||
map))
|
||||
|
||||
(defun spacemacs/ivy--regex-plus (str)
|
||||
"spacemacs/ivy--regex-plus allows users to set ivy-re-builders-alist
|
||||
to ((t . spacemacs/ivy--regex-plus)), to build the search pattern and
|
||||
get correct highlighting in the search results with using
|
||||
spacemacs/counsel-search"
|
||||
(if (and (eq (ivy-state-caller ivy-last) 'spacemacs/counsel-search)
|
||||
(string-match-p " -- " str))
|
||||
(ivy--regex-plus (car (last (split-string str " -- "))))
|
||||
(ivy--regex-plus str)))
|
||||
|
||||
;; see `counsel-ag'
|
||||
(defun spacemacs/counsel-search
|
||||
(&optional tools use-initial-input initial-directory)
|
||||
|
|
|
@ -194,6 +194,9 @@
|
|||
'counsel-recentf
|
||||
spacemacs--ivy-file-actions)
|
||||
|
||||
;; add spacemacs/counsel-search command to ivy-highlight-grep-commands
|
||||
(add-to-list 'ivy-highlight-grep-commands 'spacemacs/counsel-search)
|
||||
|
||||
;; mappings to quit minibuffer or enter transient state
|
||||
(define-key ivy-minibuffer-map [escape] 'minibuffer-keyboard-quit)
|
||||
(define-key ivy-minibuffer-map (kbd "M-SPC") 'hydra-ivy/body)
|
||||
|
|
Loading…
Reference in New Issue