Created
February 8, 2012 06:42
-
-
Save ageekymonk/1766121 to your computer and use it in GitHub Desktop.
Highlight the current word in buffer. Similar to F8 highlight in Source Insight.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Shift F8 will highlight all the words that match underlying word in the buffer | |
(defun is-word-highlighted () | |
(interactive) | |
(let ((face (or (get-char-property (point) 'read-face-name) | |
(get-char-property (point) 'face)))) | |
(if (facep face) (if (face-equal face "hi-yellow") t nil) nil))) | |
(defun toggle-highlight-word () | |
(interactive) | |
(setq sym (concat "\\<" (current-word) "\\>")) | |
(if (is-word-highlighted) (unhighlight-regexp sym) (highlight-regexp sym)) | |
) | |
(global-set-key [S-f8] 'toggle-highlight-word) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment