spacemacs/ivy--regex-plus: fix documentation

This commit is contained in:
bmag 2018-07-14 22:52:25 +03:00
parent d2dab66724
commit e109777f8b
2 changed files with 12 additions and 8 deletions

View File

@ -47,10 +47,11 @@ 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
- =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 of =spacemacs/search-project-auto= and
similar search commands provided by Spacemacs.
** Advanced buffer information
To display more information about buffers set the layer variable

View File

@ -123,10 +123,13 @@
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"
"Build a regex sequence from STR.
Same as `ivy--regex-plus', but with special consideration for
`spacemacs/counsel-search', thus providing correct highlighting
in the search results. Can be used in `ivy-re-builders-alist',
for example by setting the variable's value to:
((t . spacemacs/ivy--regex-plus))
"
(if (and (eq (ivy-state-caller ivy-last) 'spacemacs/counsel-search)
(string-match-p " -- " str))
(ivy--regex-plus (car (last (split-string str " -- "))))