Abo Abo Swiper Versions Save

Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!

0.13.0

4 years ago

The Changelog for version 0.13.0 (and previous versions) is available here

0.12.0

4 years ago

The Changelog for version 0.12.0 (and previous versions) is available here

0.11.0

5 years ago

The Changelog for version 0.11.0 (and previous versions) is available here

0.10.0

6 years ago

The Changelog for version 0.10.0 (and previous versions) is available here.

0.9.0

7 years ago

The Changelog for version 0.9.0 (and previous versions) is available here

0.8.0

8 years ago

The Changelog for version 0.8.0 (and previous versions) is available here

0.7.0

8 years ago

Table of Contents

  • Fixes
    • Fix :dynamic-collection not being sorted
    • When :initial-input contains a plus, escape it
    • Set line-spacing to 0 in the minibuffer
    • Enlarge the minibuffer window if the candidate list doesn't fit
    • Fix minibuffer collapsing to one line
    • Use minibuffer-allow-text-properties
    • Improve C-g out of a long-running async process
    • Don't regexp-quote :preselect
    • Fix ivy-partial for fuzzy completion
    • ivy-resume should pass :caller
    • Fix the regression in perfect match logic
    • Fix pasting file paths on Windows
    • C-j should no stop completion for a pasted file path
    • C-M-j should use ivy--directory
    • Use a specific blend method for dark themes
    • Fix one-off bug in ivy-scroll-up-command and ivy-scroll-down-command
    • M-o shouldn't set the action permanently
    • Fix swiper preselect issue with similar or identical lines
    • Make ivy-completing-read handle history as cons
    • Perform string-match in the original buffer
  • New Features
    • swiper
      • Make line numbers into display properties
      • Extend swiper-font-lock-ensure
      • Add support for evil-jumper/backward
      • Make compatible with visual-line-mode
      • Add swiper-toggle-face-matching
      • push-mark only if exited the minibuffer
      • ivy-resume should restore the buffer for swiper
      • Enable recursive swiper calls
      • Fix for twittering-mode
    • ivy
      • Add manual
      • Make <left> and <right> behave as in fundamental-mode
      • Truncate minibuffer prompts longer than window-width
      • C-M-n should not leave the minibuffer
      • Add flx sorting
      • Support hash tables
      • Improve documentation of ivy-count-format
      • Add ivy-index-functions-alist
      • Add ivy-virtual-abbreviate
      • Add ivy-case-fold-search
      • Add feedback for long-running async processes
      • Promote ivy-extra-directories to defcustom
      • Promote ivy-sort-function-alist to defcustom
      • M-n should prefer url at point to symbol at point
      • C-x C-f M-n calls ffap-url-fetcher when at URL
      • Highlight modified file buffers with ivy-modified-buffer face
      • Work with enable-recursive-minibuffers
      • Allow user-specified matched candidate sorting
      • ivy-display-style
    • ivy-hydra
      • Bind t to toggle-truncate-lines
      • Bind a to ivy-read-action
    • ivy-switch-buffer
      • Make M-o r rename the buffer instead of switching.
    • counsel-locate
      • Allow customizing locate options
      • Support OSX
      • Use single quotes for the regex
      • Add initial-input argument
    • counsel-org-tag
      • Now works in agenda
    • counsel-unicode-char
      • Add own history
    • counsel-M-x
      • Add "definition" action
      • Show current-prefix-arg in the prompt
    • counsel-find-file
      • Input '/sudo::' goes to current directory instead of root's home
      • Fix directory validity check
      • Improve TRAMP support
    • counsel-git-grep
      • Use prefix arg to specify the shell command.
      • Allow counsel-git-grep -> ivy-occur -> wgrep
      • ivy-occur gives full candidates
    • counsel--find-symbol
      • Allow to jump back with pop-tag-mark
      • Resolve the name clash better
    • counsel-ag
      • Add initial-directory
      • Fix on Windows
  • New Commands
    • ivy-occur
    • ivy-avy
    • ivy-kill-ring-save
    • ivy-dispatching-call
    • ivy-read-action
    • swiper-multi
    • swiper-mc
    • swiper-all
    • counsel-grep
    • counsel-git-grep-query-replace
    • counsel-jedi
    • counsel-cl
    • counsel-yank-pop

0.7.0

Fixes

Fix :dynamic-collection not being sorted

When :initial-input contains a plus, escape it

See #195.

Set line-spacing to 0 in the minibuffer

See #198.

Enlarge the minibuffer window if the candidate list doesn't fit

See #198 and #161 and #220.

Fix minibuffer collapsing to one line

See #237, #229 and #77.

Use minibuffer-allow-text-properties

Allows ivy-read to return a propertized string.

Improve C-g out of a long-running async process

Use counsel-delete-process as :unwind.

Don't regexp-quote :preselect

See #245.

Fix ivy-partial for fuzzy completion

See #266.

ivy-resume should pass :caller

See #245.

Fix the regression in perfect match logic

See #270.

Fix pasting file paths on Windows

C-j should no stop completion for a pasted file path

C-M-j should use ivy--directory

When completing file names, expand the file name properly. See #275.

Use a specific blend method for dark themes

See #278.

Fix one-off bug in ivy-scroll-up-command and ivy-scroll-down-command

M-o shouldn't set the action permanently

So now it's possible to e.g. counsel-describe-function -> M-o d -> ivy-resume -> M-o o -> ivy-resume -> M-o i.

Fix swiper preselect issue with similar or identical lines

See #290.

Make ivy-completing-read handle history as cons

See #295.

Perform string-match in the original buffer

The syntax for whitespace, separators etc. is different for modes. See #298.

New Features

swiper

Make line numbers into display properties

Each candidate is now a single space plus the original string. The display property of the single space holds the line number. This means that it's no longer possible to match line numbers in queries, which is a good thing if you're searching for numbers.

Extend swiper-font-lock-ensure

Add mu4e-view-mode, mu4e-headers-mode, help-mode, elfeed-show-mode, emms-stream-mode, debbugs-gnu-mode, occur-mode, occur-edit-mode, bongo-mode, eww-mode, vc-dir-mode.

Add support for evil-jumper/backward

See #268.

Make compatible with visual-line-mode

swiper will split the lines when visual-line-mode is on. This is convenient for small buffers. For large buffers, it can be very slow, since visual-line-mode is slow. See #227.

Add swiper-toggle-face-matching

Bound to C-c C-f. At each start of swiper, the face at point will be stored. Use this command to toggle matching only the candidates with that face. See #288.

push-mark only if exited the minibuffer

C-M-n and C-M-p will no longer push mark and annoy with messages.

ivy-resume should restore the buffer for swiper

See #302.

Enable recursive swiper calls

While you swiper buffer-1, you can switch out of the minibuffer into buffer-2 and call swiper again. Exiting the second minibuffer will restore the first minibuffer.

To use this, you need to enable recursive minibuffers.

(setq enable-recursive-minibuffers t)

It's also useful to indicate the current depth:

(minibuffer-depth-indicate-mode 1)

See #309.

Fix for twittering-mode

The field text property is now removed before inserting text into the minibuffer. This fixes the swiper problems with twittering-mode. See #310.

ivy

Add manual

In the current state, the manual covers the most basic topics, like the minibuffer key bindings and the regexp builders.

Make <left> and <right> behave as in fundamental-mode

Truncate minibuffer prompts longer than window-width

See #240.

C-M-n should not leave the minibuffer

Make sure that the minibuffer window remains selected as long as the completion hasn't finished. For example, <f1> f to call counsel-describe-function, input "forward" and spam C-M-n to read the doc for each function that starts with "forward". The *Help* window popup would move the window focus, but this change moves it back to the minibuffer.

Add flx sorting

See #207. Since flx is costly, move the caching to an earlier point. This means immediate return for when the input hasn't changed, i.e. for C-n or C-p. When flx is installed, and (eq ivy--regex-function 'ivy--regex-fuzzy) for current function (through ivy-re-builders-alist), then sort the final candidates with ivy--flx-sort.

In the worst case, when some error pops up, return the same list. In the best case sort the cands that all match name by closeness to name.

How to use:

  1. Have flx installed - (require 'flx) should succeed.
  2. Configure ivy-re-builders-alist appropriately to use ivy--regex-fuzzy.

For example:

(setq ivy-re-builders-alist
      '((t . ivy--regex-fuzzy)))

Support hash tables

Since all-completions also works for hash tables, no reason not to support them.

Improve documentation of ivy-count-format

Now possible to set it with Customize.

Add ivy-index-functions-alist

Customize this to decide how the index, i.e. the currently selected candidate, is updated with new input. For example, one strategy is not reset it to 0 after each change.

Another strategy, used for swiper, is to try to select the first appropriate candidate after (inclusive) the first previously selected candidate. This way, if you're typing something that matches what is currently selected, the selection won't change.

See #253.

Add ivy-virtual-abbreviate

The mode of abbreviation for virtual buffer names.

Add ivy-case-fold-search

Used to override case-fold-search. See #259.

Add feedback for long-running async processes

Each time 0.5s pass after the last input, if the external process hasn't finished yet, update minibuffer with the amount of candidates collected so far. This is useful to see that long running commands like counsel-locate or counsel-ag (when in a very large directory) aren't stuck.

Promote ivy-extra-directories to defcustom

Promote ivy-sort-function-alist to defcustom

M-n should prefer url at point to symbol at point

C-x C-f M-n calls ffap-url-fetcher when at URL

Highlight modified file buffers with ivy-modified-buffer face

This new face is blank by default, but you can use e.g.:

(custom-set-faces
 '(ivy-modified-buffer ((t (:background "#ff7777")))))

Work with enable-recursive-minibuffers

Store the old ivy-last in case ivy-read is called while inside the minibuffer. Restore it after ivy-call.

Allow user-specified matched candidate sorting

New defcustom ivy-sort-matches-functions-alist. See #269 #265 #213.

By default, Ivy doesn't sort the matched candidates, they remain in the same order as in the original collection. This option is the default, since it's fast and simple.

A small problem with this approach is that we usually want prefix matches to be displayed first. One solution to this is to input "^" to see only the prefix matches.

Now, another solution is to can set:

(setq ivy-sort-matches-functions-alist
      '((t . ivy--prefix-sort)))

Here's another example of using this defcustom:

(add-to-list
     'ivy-sort-matches-functions-alist
     '(read-file-name-internal . ivy--sort-files-by-date))

After this, during file name completion, most recently changed files will be ahead.

ivy-display-style

Adds fancy highlighting to the minibuffer. See #212, #217, .

ivy-hydra

Bind t to toggle-truncate-lines

See #214.

Bind a to ivy-read-action

ivy-switch-buffer

Make M-o r rename the buffer instead of switching.

See #233.

counsel-locate

Allow customizing locate options

See counsel-locate-options. The current setting is:

(setq counsel-locate-options '("-i" "--regex"))

Support OSX

Use open instead of xdg-open. Modify counsel-locate-options for OSX, since there locate doesn't support --regex.

Use single quotes for the regex

See #194.

Add initial-input argument

See #289.

counsel-org-tag

Now works in agenda

See #200.

counsel-unicode-char

Add own history

counsel-M-x

Add "definition" action

Use M-o d to jump to definition.

Show current-prefix-arg in the prompt

See #287.

counsel-find-file

Input '/sudo::' goes to current directory instead of root's home

See #283.

Fix directory validity check

See #283 #284.

Improve TRAMP support

Selecting items after // now works properly.

counsel-git-grep

Use prefix arg to specify the shell command.

Remember to use M-i to insert the current candidate into the minibuffer.

See #244.

Allow counsel-git-grep -> ivy-occur -> wgrep

Using C-c C-o (ivy-occur) while in counsel-git-grep will produce a wgrep-compatible buffer.

ivy-occur gives full candidates

This means that the =" | head -n 200"= speed-up isn't used and full candidates are returned.

counsel--find-symbol

Allow to jump back with pop-tag-mark

Using C-. in:

  • counsel-describe-function
  • counsel-describe-variable
  • counsel-load-library

will change the current buffer. The buffer and point can be restored with M-* (pop-tag-mark).

I also recommend this binding:

(global-set-key (kbd "M-,") 'pop-tag-mark)

Resolve the name clash better

When the symbol is both bound and fbound, prefer the fbound one, unless the :caller is counsel-describe-variable.

counsel-ag

Add initial-directory

Support alternative initial directory which helps other packages call this function with their unique starting directory.

Fix on Windows

Using the "--vimgrep" argument improves things.

New Commands

ivy-occur

Bound to C-c C-o. Store the current completion session to its own buffer. You can have an unlimited amount of these buffers.

ivy-avy

Bound to C-'.

Speeds up selecting a candidate that's currently visible in the minibuffer.

ivy-kill-ring-save

Bound to M-w.

When the region is active, call kill-ring-save. Otherwise, store all selected candidates to the kill ring.

ivy-dispatching-call

Bound to C-M-o.

This is a non-exiting version of M-o (ivy-dispatching-done).

ivy-read-action

Bound to C-M-a. Select the current action. Don't call it yet.

swiper-multi

Use swiper in multiple buffers. See #182.

Basic usage tips for selecting multiple buffers:

  • Use C-M-m (ivy-call) to add or remove one more buffer without exiting.
  • Use C-m (ivy-done) to add one last buffer.
  • Or use C-M-j (ivy-immediate-done) to finish without adding more buffers.
  • Hold C-M-n (ivy-next-line-and-call) to add a lot of buffers at once.

swiper-mc

Open multiple cursors at all selected candidates.

swiper-all

New command to launch swiper for all open file buffers. Note that this can be excruciatingly slow if you don't clean up your buffer list often.

counsel-grep

This is essentially swiper for huge files. It's not as smooth as swiper for small files, but has a faster startup and faster matching for files that measure in megabytes.

counsel-git-grep-query-replace

Bound to M-q. Perform query-replace on all matches in all buffers.

counsel-jedi

Complete Python symbols using Jedi.

counsel-cl

Complete Common Lisp symbols using SLIME.

counsel-yank-pop

Give completion for inserting from the kill ring. See counsel-yank-pop-truncate defcustom and #218.

0.6.0

8 years ago

0.6.0

Fixes

swiper-avy should use only the current window

Not all windows. See #117.

fix wrap-around for ivy-next-line

See #118.

swiper-avy should do nothing for empty input

See #50.

ivy-alt-done should require TRAMP if necessary

See #145.

swiper-query-replace shouldn't miss the first occurrence

See #144.

swiper should not deactivate mark

ivy-mode should not switch to TRAMP for certain input

See #145.

counsel-find-file should work better with TRAMP

"/ssh:foo" should not be cut off See #145.

counsel-find-file supports Windows drive letters

See #155.

counsel-file-file should work better with files that contain "~"

See #157.

counsel-M-x should respect ivy-format-function

See #150.

counsel-git-grep should position better on exit

See #153.

ivy-mode should re-scale text to minibuffer height

See #151.

counsel-unicode-char should use action-style call

See #160.

ivy-read should allow % in prompt string

See #171.

ivy-call should execute in proper window

See #176.

New Features

ivy-mode

  1. Open an Info file on the file system

When in Info-mode, press g and select either "(./)" or "(../)" to switch to file name completion. That file will be opened with Info. 2. Account for minibuffer-depth-indication-mode

If you have minibuffer-depth-indication-mode on, the minibuffer prompt will indicate the current depth. See #134. 3. Add fuzzy matching function

To enable fuzzy matching, set your ivy-re-builders-alist accordingly:

(setq ivy-re-builders-alist
      '((t . ivy--regex-fuzzy)))

See #136.

See also #142 for toggling fuzzy matching with C-o m. 4. case-fold-search optimization

Bind case-fold-search to t when the input is all lower-case:

  • input "the" matches both "the" and "The".
  • input "The" matches only "The".

See #166. 5. Allow to see the candidate index a la anzu via ivy-count-format

To have this feature, use something like this:

(setq ivy-count-format "(%d/%d) ")

See #167.

You can also set this to nil, if you don't want any count, see #188. 6. Allow to add additional exit points for any command

Example for ivy-switch-to-buffer:

(ivy-set-actions
 'ivy-switch-buffer
 '(("k"
    (lambda (x)
      (kill-buffer x)
      (ivy--reset-state ivy-last))
    "kill")
   ("j"
    ivy--switch-buffer-other-window-action
    "other")))

After this:

  • use M-o k to kill a buffer
  • use M-o j to switch to a buffer in other window

You can always use M-o o to access the default action. When there is only one action, M-o does the same as C-m.

See #164.

counsel-describe-function and counsel-decribe-variable

  1. Add a binding to look up the symbol in info

Press C-, to look up the symbol in info, instead of the default describe action. See #121. 2. Handle symbol-at-point better in non-Elisp buffers

See #126.

ivy-switch-buffer

  1. New face ivy-virtual

See #129. 2. Deal better with invisible buffers

See #135. 3. Add custom keymap

You can customize ivy-switch-buffer-map.

See #164. 4. Add extra actions

Add a kill-buffer action, and switch-to-buffer-other-window action.

counsel-git-grep

  1. Add Async

Make it fully async: the process git grep will be killed and restarted on new input. This results in almost no keyboard delay. 2. Own history variable

swiper

  1. Own history variable

Having own history variable allows to get more use of M-p, M-n and C-r.

counsel-el

  1. Switch to action-style call

This allows to make use of C-M-n and C-M-p.

counsel-locate

  1. Add Async
  2. Add extra actions

In addition to the default action of opening a file add:

  • xdg-open action
  • dired action

Press M-o or C-o to access these actions. 3. Add own history

API

  1. Add :matcher

A matcher is a function that accepts a regexp and a list of candidates and returns the filtered list of candidates.

The default matcher is basically cl-remove-if-not + string-match. If you'd like to customize this, pass your own matcher.

See counsel-git-grep-matcher for an example. 2. Allow to customize the initial input for all commands

Customize ivy-initial-inputs-alist for this. See #140. 3. ivy-sort-functions-alist should also examine this-command 4. :dynamic-collection is now a boolean

Pass the collection function as the second var instead.

New Commands

ivy-call

Execute the current action for the current candidate without exiting the minibuffer. Bound to C-M-m or M-RET or C-o g.

counsel-find-file

Forward to find-file with Ivy completion.

ivy-next-line-and-call as well as ivy-resume should work for this command.

The variable counsel-find-file-ignore-regexp allows to ignore certain files, like dot files. Input a leading dot to see all files.

The variable counsel-find-file-at-point allows to automatically use ffap. You also can do it manually with M-n when the point is on a file name.

The variable counsel-find-file-map allows to customize the minibuffer key bindings for this command.

Recommended binding:

(global-set-key (kbd "C-x C-f") 'counsel-find-file)

You can peek at files with C-M-n and C-M-p.

See #122 and #123.

See #152 about M-n, M-p and M-i switching directories when necessary.

ivy-recentf

Find a file on recentf-list.

Note that if your set ivy-use-virtual-buffers, recentf-list is merged into candidates list for ivy-switch-buffer. But if you want it separately, you can use this command.

See #124.

ivy-yank-word

Add word at point to minibuffer input.

This is similar to what C-w does for isearch. However it's bound to M-j instead of C-w, since C-w is bound to kill-region - a useful command.

See #125.

counsel-M-x

Forward to execute-extended-command with Ivy completion. The candidate list will also display the key binding for each bound command.

This command will piggyback on smex for sorting, if smex is installed.

Use counsel-M-x-initial-input to customize the initial input for this command. By default, it's "^" - the regex character that indicates beginning of string. This results in much faster matching, since you usually type the command name from the start.

See #136 and #138.

hydra-ivy

Press C-o to toggle the Hydra for Ivy. It gives access to shorter bindings and many customizable options.

Use C-o > to grow the minibuffer. Use C-o < to shrink the minibuffer.

See #151.

ivy-toggle-calling

Toggle executing the current action each time a new candidate is selected.

This command is bound to C-o c.

To explain how this is useful: C-M-m C-M-f C-M-f C-M-f is equivalent to C-o cjjj.

ivy-insert-current

Inserts the current candidate into the minibuffer.

Press M-i if you want something close to the current candidate. You can follow up with an edit and select.

I find this very useful when creating new files with a similar name to the existing file: C-x C-f M-i + a bit of editing is very fast.

See #141.

counsel-load-theme

Forward to load-theme with Ivy completion. Allows to rapidly try themes (e.g. with C-M-n).

ivy-reverse-i-search

Allow to recursively match history with C-r.

I like this command from bash shell. The usual way to search through history is with M-p and M-n. Using ivy-reverse-i-search will open a recursive completion session with the current history as the candidates.

counsel-rhythmbox

Control Rhythmbox from Emacs.

ivy-dispatching-done

Select an action for the current candidate and execute it. Bound to M-o.

Some commands that support M-o:

  • counsel-rhythmbox
  • counsel-describe-function
  • counsel-describe-variable
  • ivy-switch-buffer
  • counsel-locate

counsel-org-tag

Forward to org-set-tags with Ivy completion.

Selecting any tag each time will toggle it on/off. The current list of selected tags will be displayed in the prompt.

See #177 and #91.

counsel-org-tag-agenda

Forward to org-agenda-set-tags with Ivy completion. See #177.

counsel-ag

Interactively ag using Ivy completion.

counsel-recoll

Use recoll with Ivy completion. See Using Recoll desktop search database with Emacs.

Install recoll with sudo apt-get install recoll.

swiper-from-isearch

Start swiper from the current isearch input.

ivy-immediate-done

Use this command to exit the minibuffer choosing not the current candidate, but the current text. Bound to C-M-j or C-u C-j.

See #183.

0.5.0

8 years ago

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-x rgrep 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-select other-buffer just like switch-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:

counsel-load-library

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.

0.4.0

9 years ago

Fixes

Glob expansion in rgrep

While completing file names, ivy expands the file name to full. Unfortunately, rgrep uses read-file-name-internal and isn't receptive to globs being expanded with the current directory. A work-around this is to use the generic strategy when ivy is in trouble:

  • enter the input text as if there was no completion.
  • exit with C-u C-j (forwards to ivy-immediate-done).

ivy-immediate-done is currently unbound by default. If you want, you can bind it in your config like this:

(define-key ivy-minibuffer-map (kbd "C-c C-d") 'ivy-immediate-done)

Exclude a couple more modes from font-lock

This time, they are jabber-chat-mode and elfeed-search-mode.

Fix a flag in swiper-query-replace

You can launch a query replace with M-q from swiper.

Avoid sorting org-refile candidates

By default, ivy completion candidates are sorted with string-lessp. The sorting can be customized with ivy-sort-functions-alist. While refiling, the natural order is actually best, so the sorting is turned off in that case.

Reset to the first candidate when switching directories

With ivy-mode you can select a file anywhere on your file system by switching directories repeatedly with C-j (ivy-alt-done). After moving to a new directory, the point should be on the first candidate.

Fixup the face order

All this time there was an issue with the face order swapping between 1 and 2 groups. This is now fixed. Also, I've made swiper-match-face-4 inherit from isearch-fail. It's important to have all 4 faces be different.

Don't error on bad regex

When the current input is a bad regex, just display no candidates and continue. Don't throw an error.

New Features

Use // instead of / to move to root

While completing file names, you can enter // to move to the root directory. This change was necessary in order to make it possible to enter e.g. /sudo: or /ssh:.

Host completion for /sudo: and /ssh:

This feature is a bit flaky for now. But it works well on my machine. It should get better after a few bug reports. You can start the completion right after the method, e.g. /ssh: RET, or after method+user, e.g. /ssh:oleh@ RET.

Respect confirm-nonexistent-file-or-buffer

If you set confirm-nonexistent-file-or-buffer to t (it's nil by default), you'll have to confirm when you create a new file or buffer with ivy.

confirm.png

Highlight remote buffers with ivy-remote face

Just some extra polish to make things look nicer. The buffers to which you're connected through TRAMP will be highlighted with the new ivy-remote face.

Change the prompt for match-required interactions

Sometimes, the Emacs functions that call completion specify to it that a match is required, i.e. you can't just type in some random stuff - you have to select one of the candidates given to you. In that case ivy will appropriately change the prompt like this:

match-required.png

Improve the candidate selection while using history

While completing, you press M-p to select the previous input. This update tries to select not just the first candidates that matches, but the actual previous candidate that you selected before.

Use alpha compositing to add ivy-current-match-face

This is only relevant for when the completion candidates have custom face backgrounds. But in that case, the minibuffer looks a lot nicer.

Add partial completion

Press TAB to do call ivy-partial-or-done to complete the current thing to the largest possible prefix. When called twice in a row, it's the same as C-j, i.e. it will finish the completion.

Improve completion of hidden buffers

In Emacs, hidden buffer names start with a space. To see them all, press a single space while completing buffers in ivy-mode. You can toggle between hidden and non-hidden buffers by editing the first space in your input query. Remember that with ivy-mode the minibuffer is a proper editable area, so C-a works properly (unlike in isearch or ido-mode).

Allow to quote spaces while matching

Spaces are wild while matching - they serve as group boundaries. However, sometimes it would be useful to quote them. From now on, you can quote N consecutive spaces by inputting N+1 consecutive spaces.

Add multi-tier regex matching

This is actually a really cool feature, so if you're paying attention to any section, let it be this one.

User side

For example, I cloned boost_1_58_0 and called counsel-git, which is like a find-file for all files in a git repository at once.

  • Initially, it gives 45919 candidate files.
  • With input "utility", there are 234 candidates.
  • With input "utility hpp", there are 139 candidates.

Now, the interesting part. If I want to exclude anything with "hpp" in it, I change the input to "utility !hpp" (with M-b !) to get 95 candidates (95=234-139, it checks out). I could exclude some more:

  • with input "utility !hpp cpp" there are 57 candidates.
  • with input "utility !hpp cpp ipp" there are 46 candidates.
  • I can unify the regex to "utility ![hic]pp" and also get 46 candidates.
  • exclude htm with "utility ![hic]pp htm" to get only 17 candidates.

You can use this strategy anywhere, not just for git file. For example, in describe-function or swiper.

Elisp side

You can customize ivy-re-builders-alist to make ivy-mode complete in the way that you like. The alist dispatches on the collection type, so you can have one completion strategy for buffers, another for files and still another for everything else.

Each function on the alist should turn the string input into a string regex. So the simplest one would be regexp-quote. If you want to use multi-tier matching, the function should instead return a list of regexps of two types:

  • the ones that should match (will be joined by and).
  • the ones that should not match (will be joined by or).

Add ivy-resume

This feature is still a bit of a work-in-progress. But it allows you to resume the last completion to the point before you entered RET or C-g etc. It only works for features that specifically passed :action to ivy-read. You could resume other features, but nothing would be done when you select the candidate, since ivy-completing-read has no idea what the function that called it was going to do with the result.

Currently, you can resume:

  • counsel-describe-variable
  • counsel-describe-function
  • lispy-goto
  • swiper

Here's how I've bound it in my config:

(global-set-key (kbd "C-c C-r") 'ivy-resume)
(global-set-key [f6] 'ivy-resume)

The ivy-resume feature adds occur-like functionality to swiper. Calling ivy-resume is like switching to the *Occur* buffer.