A Small Swiper Trick

Over at the Emacs reddit, g00eykabl00ey shares a “swiper trick.” He gives an example of the trick where he wants to check the spelling of “Dostoyevsky,” which appears elsewhere in the buffer. To find the previous use—and its correct spelling—he starts a Swiper search with “dos.” That will bring up every occurrence of “dos” in the minibuffer. You can move up in down in the minibuffer (scrolling if necessary) and as each line is highlighted, the buffer being searched scrolls to that instance of the search term. If you type Return, the point is moved to the instance that is highlighted in the minibuffer. But if you quit Swiper (with Ctrl+g, say) the buffer is unchanged but you’ve seen the correct spelling. Notice that this same trick is useful anytime you want to see some term in context, a variable definition say.

I would have thought that this was pretty obvious but judging from the comments maybe not. I don’t keep track but I wouldn’t be surprised if half of my uses of Swiper are like this. I quit out of it as often as I complete the search by moving to the target. Tricks like this are why I say that Swiper and the associated Ivy library are my most useful package.

This entry was posted in General and tagged . Bookmark the permalink.