Skip to content

Instantly share code, notes, and snippets.

@jrichter
Created February 9, 2013 05:02
Show Gist options
  • Save jrichter/4743908 to your computer and use it in GitHub Desktop.
Save jrichter/4743908 to your computer and use it in GitHub Desktop.
Search any open css buffers for searchTerm
;; CSS search if there are open buffers
(defun search-open-css-buffers-for-region-or-word ()
"Use the current region/point and search open css buffers"
(interactive)
(let (searchTerm)
(setq searchTerm
(if (region-active-p)
(buffer-substring-no-properties (region-beginning) (region-end))
(thing-at-point 'symbol)))
(multi-occur (mapcar (lambda (buf)
(if (string-match "\w*.css" (buffer-name buf))
buf)) (buffer-list))
searchTerm 5)))
(global-set-key (kbd "M-s-.") 'search-open-css-buffers-for-region-or-word)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment