Highlighting

This week there were two excellent posts on highlighting in Emacs. The first was Marcin Borkowski’s post, Highlighting and de-highlighting things. He covers most of highlighting commands but not their default keybindings.

When I first saw Borkowski’s post I thought I’d write about it if only to have a handy guide to the commands. Before I could do that, Mickey Petersen published his post on the same subject matter. That post, Highlighting by Word, Line and Regexp covers a few more commands and includes their bindings. Mickey also explains how to make a set of highlightings persist in a file.

It turns out that even Irreal has plowed this ground but it was so long ago (over a decade) that I’d forgotten all about it. One nice thing about that post is that I provided a table of keybindings at the end but I didn’t cover all the commands. Below is a new table based on Mickey’s list of bindings. The purpose of many of them is obvious from the command name but take a look at Mickey’s post for what all these commands do. If you can remember the Meta+s h part, the commands are pretty mnemonic but, of course, if you use them regularly they’ll get burned into your muscle memory.

Key Sequence Command
Meta+s h . highlight-symbol-at point
Meta+s h l highlight-lines-matching-regexp
Meta+s h p highlight-phrase
Meta+s h r highlight-regexp
Meta+s h u unhighlight-regexp
Meta+s h w hi-lock-write-interactive-patterns
Meta+s h f hi-lock-find-patterns
This entry was posted in General and tagged . Bookmark the permalink.