Swiper

For some reason I had it in my mind that swiper depended on Lispy, or Spacemacs, or some other Vim-derived Emacs mode so I never really looked at it. Then I read Mike Zamansky's post on swiper and had my eyes were opened. At a minimum, swiper is a much improved replacement for Emacs's incremental search. You can take a look at Zamansky's post to see how it improves on the default incremental search behavior1, but the TL;DR is that you get a sort of simplified regex search with all the candidates shown in the minibuffer. You can navigate this list with the usual 【Ctrl+n】 and 【Ctrl+p】 and then select the match you want.

It turns out, though, that once you have the underlying ivy mode installed everything gets better. You can get rid of ido-mode and smex and let ivy take care of the things they do. All the things you loved about ido-mode are done better with ivy. There's a very nice manual to explains everything ivy2 can do

Watch Zamansky's video on swiper—and the rest of his videos if you haven't already—to see why this is a worthwhile upgrade. I'm still cautiously feeling my way with swiper and have started small. Here's my current configuration:

(use-package swiper
  :ensure t
  :config
  (ivy-mode 1)
  (setq ivy-use-virtual-buffers t)
  (global-set-key "\C-s" 'swiper)
  (global-set-key (kbd "C-c C-r") 'ivy-resume)
  (global-set-key (kbd "M-x") 'counsel-M-x)
  (global-set-key (kbd "C-x C-f") 'counsel-find-file))

As you can see, I'm using it for find-file and execute-extended-command as well as isearch. Again, I'm starting cautiously but so far I think it's a definite win.

Footnotes:

1

One small annoyance is that there's a slight delay (a small fraction of a second) before the point moves to place selected. That may because the screen isn't scrolled until you choose a match.

2

Ivy is the library that does much of the heavy lifting for swiper.

This entry was posted in General and tagged . Bookmark the permalink.
  • Please keep us posted; we are all happy with ido-mode and smex.

    • jcs

      I'm liking it so far but it works subtly different from smex so it takes a bit getting used to. As you say, we all like ido and smex so if I find I don't really like swiper I can always come home to them.

  • agumonkey

    I remember when swiper was a cute alpha thing; it seems to be a very potent piece of contemporary emacsening now.