{"id":5340,"date":"2016-06-22T11:56:00","date_gmt":"2016-06-22T15:56:00","guid":{"rendered":"http:\/\/irreal.org\/blog\/?p=5340"},"modified":"2016-06-22T11:56:55","modified_gmt":"2016-06-22T15:56:55","slug":"swiper","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=5340","title":{"rendered":"Swiper"},"content":{"rendered":"<p> For some reason I had it in my mind that <a href=\"https:\/\/github.com\/abo-abo\/swiper\">swiper<\/a> depended on <a href=\"https:\/\/github.com\/abo-abo\/lispy\">Lispy<\/a>, or <a href=\"https:\/\/github.com\/syl20bnr\/spacemacs\">Spacemacs<\/a>, or some other Vim-derived Emacs mode so I never really looked at it. Then I read Mike Zamansky&#8217;s <a href=\"http:\/\/cestlaz.github.io\/posts\/using-emacs-6-swiper\/#.V2nPJleMCYU\">post on swiper<\/a> and had my eyes were opened. At a minimum, <code>swiper<\/code> is a much improved replacement for Emacs&#8217;s incremental search. You can take a look at Zamansky&#8217;s post to see how it improves on the default incremental search behavior<sup><a id=\"fnr.1\" class=\"footref\" href=\"#fn.1\">1<\/a><\/sup>, 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 \u3010<kbd>Ctrl<\/kbd>+<kbd>n<\/kbd>\u3011 and \u3010<kbd>Ctrl<\/kbd>+<kbd>p<\/kbd>\u3011 and then select the match you want. <\/p>\n<p> It turns out, though, that once you have the underlying <a href=\"http:\/\/oremacs.com\/2015\/04\/16\/ivy-mode\/\">ivy<\/a> mode installed everything gets better. You can get rid of <a href=\"https:\/\/www.emacswiki.org\/emacs\/InteractivelyDoThings\">ido-mode<\/a> and <a href=\"https:\/\/www.emacswiki.org\/emacs\/Smex\">smex<\/a> and let ivy take care of the things they do. All the things you loved about ido-mode are done better with ivy. There&#8217;s a very nice <a href=\"http:\/\/oremacs.com\/swiper\/\">manual<\/a> to explains everything <code>ivy<\/code><sup><a id=\"fnr.2\" class=\"footref\" href=\"#fn.2\">2<\/a><\/sup> can do <\/p>\n<p> Watch Zamansky&#8217;s video on swiper\u2014and the rest of his videos if you haven&#8217;t already\u2014to see why this is a worthwhile upgrade. I&#8217;m still cautiously feeling my way with swiper and have started small. Here&#8217;s my current configuration: <\/p>\n<div class=\"org-src-container\">\n<pre class=\"src src-emacs-lisp\">(<span style=\"color: #a020f0;\">use-package<\/span> <span style=\"color: #008b8b;\">swiper<\/span>\n  <span style=\"color: #483d8b;\">:ensure<\/span> t\n  <span style=\"color: #483d8b;\">:config<\/span>\n  (ivy-mode 1)\n  (<span style=\"color: #a020f0;\">setq<\/span> ivy-use-virtual-buffers t)\n  (global-set-key <span style=\"color: #8b2252;\">\"\\C-s\"<\/span> 'swiper)\n  (global-set-key (kbd <span style=\"color: #8b2252;\">\"C-c C-r\"<\/span>) 'ivy-resume)\n  (global-set-key (kbd <span style=\"color: #8b2252;\">\"M-x\"<\/span>) 'counsel-M-x)\n  (global-set-key (kbd <span style=\"color: #8b2252;\">\"C-x C-f\"<\/span>) 'counsel-find-file))\n<\/pre>\n<\/div>\n<p> As you can see, I&#8217;m using it for <code>find-file<\/code> and <code>execute-extended-command<\/code> as well as <code>isearch<\/code>. Again, I&#8217;m starting cautiously but so far I think it&#8217;s a definite win. <\/p>\n<div id=\"footnotes\">\n<h2 class=\"footnotes\">Footnotes: <\/h2>\n<div id=\"text-footnotes\">\n<div class=\"footdef\"><sup><a id=\"fn.1\" class=\"footnum\" href=\"#fnr.1\">1<\/a><\/sup> <\/p>\n<div class=\"footpara\">\n<p class=\"footpara\"> One small annoyance is that there&#8217;s a slight delay (a small fraction of a second) before the point moves to place selected. That may because the screen isn&#8217;t scrolled until you choose a match. <\/p>\n<\/div>\n<\/div>\n<div class=\"footdef\"><sup><a id=\"fn.2\" class=\"footnum\" href=\"#fnr.2\">2<\/a><\/sup> <\/p>\n<div class=\"footpara\">\n<p class=\"footpara\"> <code>Ivy<\/code> is the library that does much of the heavy lifting for <code>swiper<\/code>. <\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;s post on swiper and had my &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=5340\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[18],"class_list":["post-5340","post","type-post","status-publish","format-standard","hentry","category-general","tag-emacs"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5340","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5340"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5340\/revisions"}],"predecessor-version":[{"id":5341,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5340\/revisions\/5341"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}