Search for Symbol at Point

Artur Malabarba has another excellent bit of Elisp for us to improve our workflow. This time it’s a quick and easy way to search for the symbol at point. He binds his code to 【Ctrl+u Ctrl+s】 but remarks that that sequence is already used for isearch-forward-regexp. He doesn’t care about that because he’s never used isearch-forward-regexp. There is, though, no need to worry about 【Ctrl+u Ctrl+s】 because 【Ctrl+Meta+s】 is also bound to isearch-forward-regexp and easier to remember because it’s like the 【Ctrl+Meta+%】 that query-replace-regexp uses.

More to the point, isearch-forward-symbol-at-point is bound to 【Meta+s .】, which I find just as easy to type as 【Ctrl+u Ctrl+s】 so unless you, like Malabarba, find the latter easier to type and remember than the former you may not need to add his code to your configuration.

On the other hand, Emacs is all about having it your way and Malabarba’s code shows how easy it is to adjust its behavior to be more how you like it. In my case, I don’t use isearch-forward-symbol-at-point often enough to bother giving it a special key sequence. Of course, 【Meta+s .is unintuitive and hard to remember. Since I don’t use it often, it’s not worth building a hydra for it; instead I use the excellent guide-key package to remind me of the proper sequence. Again, Emacs letting me have it my way. Instead of forcing Malabarba and me to use the same work flow, Emacs lets us each optimize it to suit our own way of working.

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