swiper 0.5.0
Fixes
- TAB shouldn't delete input when there's no candidate.
- TAB should switch directories properly.
- require
dired
when completing file names, so that the directory face is loaded. - TAB should work with
confirm-nonexistent-file-or-buffer
. - TAB should handle empty input.
- work around
grep-read-files
: it should be possible to simply M-xrgrep
RET RET RET. - Fix the transition from a bad regex to a good one - you can input a bad regex to get 0 candidates, the candidates come back once the regex is fixed.
ivy-switch-buffer
should pre-selectother-buffer
just likeswitch-buffer
does it.- Fix selecting "C:" on Windows.
counsel-git-grep
should warn if not in a repository.- C-M-n shouldn't try to call action if there isn't one.
- Turn on sorting for
counsel-info-lookup-symbol
. ivy-read
should check for an outdated cons initial-input.
New Features
Out of order matching
I actually like in-order matching, meaning the input "in ma" will match "in-order matching", but not "made in". But the users can switch to out-of-order matching if they use this code:
(setq ivy-re-builders-alist
'((t . ivy--regex-ignore-order)))
ivy-re-builders-alist
is the flexible way to customize the regex builders per-collection. Using t
here, means to use this regex builder for everything. You could choose to have in-order for files, and out-of-order for buffers and so on.
New defcustom: ivy-tab-space
Use this to have a space inserted each time you press TAB:
(setq ivy-tab-space t)
ignore case for TAB
"pub" can expand to "Public License".
New command: counsel-load-library
This command is much better than the standard load-libary
that it upgrades. It applies a sort of uniquify
effect to all your libraries, which is very useful:
In this case, I have avy
installed both from the package manager and manually. I can easily distinguish them.
Another cool feature is that instead of using find-library
(which is also bad, since it would report two versions of avy
with the same name and no way to distinguish them), you can simply use counsel-load-library
and type C-. instead of RET to finalize.
Here's another scenario: first load the library, then call ivy-resume
and immediately open the library file.
New command: ivy-partial
Does a partial complete without exiting. Use this to replace ivy-partial-or-done
with this command:
(define-key ivy-minibuffer-map (kbd "TAB") 'ivy-partial)
Allow to use ^
in swiper
In regex terms, ^
is the beginning of line. You can now use this in swiper
to filter your matches.
New command: swiper-avy
This command is crazy good: it combines the best features of swiper
(all matches an once, flexible input length) and avy
(quickly select one candidate once you've narrowed to about 10-20 candidates).
For instance, I can enter "to" into swiper
to get around 10 matches. Instead of using C-n a bunch of times to select the one of 10 that I want, I just press C-', followed by a or s or d ... to select one of the matches visible on screen.
So both packages use their best feature to cover up the others worst drawback.
Add support for virtual buffers
I was never a fan of recentf
until now. The virtual buffers feature works in the same way as ido-use-virtual-buffers
: when you call ivy-switch-buffer
, your recently visited files as well as all your bookmarks are appended to the end of the buffer list.
Suppose you killed a buffer and want to bring it back: now you do it as if you didn't kill the buffer and instead buried it. The bookmarks access is also nice.
Here's how to configure it, along with some customization of recentf
:
(setq ivy-use-virtual-buffers t)
(use-package recentf
:config
(setq recentf-exclude '("COMMIT_MSG" "COMMIT_EDITMSG" "github.*txt$"
".*png$"))
(setq recentf-max-saved-items 60))
Add a few wrapper commands for minibuffer
All these commands just forward to their built-in counterparts, only trying not to exit the first line of the minibuffer.
- M-DEL calls
ivy-backward-kill-word
- C-d calls
ivy-delete-char
- M-d calls
ivy-kill-word
- C-f calls
ivy-forward-char
Allow to customize the minibuffer formatter
See the wiki on how to customize
the minibuffer display to look like this:
100 Find file: ~/
file1
file2
> file3
file4
When completing file names, TAB should defer to minibuffer-complete
Thanks to this, you can TAB-complete your ssh hosts, e.g.:
/ss
TAB ->/ssh
/ssh:ol
TAB ->/ssh:oleh@
More commands work with ivy-resume
I've added:
counsel-git-grep
counsel-git
Others (that start with counsel-
) should work fine as well. Also don't forget that you can use C-M-n and C-M-p to:
- switch candidate
- call the action for the candidate
- stay in the minibuffer
This is especially powerful for counsel-git-grep
: you can easily check the whole repository for something with just typing in the query and holding C-M-n. The matches will be highlighted swiper
-style, of course.
Allow to recenter during counsel-git-grep
Use C-l to recenter.
Update the quoting of spaces
Split only on single spaces, from all other space groups, remove one space.
As you might know, a space is used in place of .*
in ivy
. In case you want an actual space, you can now quote them even easier.