Created
July 18, 2014 12:58
-
-
Save tjweir/3f326170e0632d3bb76d to your computer and use it in GitHub Desktop.
My imenu config for scala.
This file contains hidden or 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
| ;; M-x package-install imenu-anywhere | |
| (add-hook 'scala-mode-hook | |
| (lambda () | |
| (setq imenu-generic-expression | |
| '( | |
| ("var" "\\(var +\\)\\([^(): ]+\\)" 2) | |
| ("val" "\\(val +\\)\\([^(): ]+\\)" 2) | |
| ("override def" "^[ \\t]*\\(override\\) +\\(def +\\)\\([^(): ]+\\)" 3) | |
| ("private def" "^[ \\t]*\\(private\\(\\[.*?\\]+\\)*\\) +\\(def +\\)\\([^(): ]+\\)" 4) | |
| ("protected def" "^[ \\t]*\\(protected\\(\\[.*?\\]+\\)*\\) +\\(def +\\)\\([^(): ]+\\)" 4) | |
| ("implicit def" "^[ \\t]*\\(implicit\\) +\\(def +\\)\\([^(): ]+\\)" 3) | |
| ("def" "^[ \\t]*\\(def +\\)\\([^(): ]+\\)" 2) | |
| ("trait" "\\(trait +\\)\\([^(): ]+\\)" 2) | |
| ("class" "^[ \\t]*\\(class +\\)\\([^(): ]+\\)" 2) | |
| ("case class" "^[ \\t]*\\(case class +\\)\\([^(): ]+\\)" 2) | |
| ("abstract class" "^[ \\t]*\\(abstract class +\\)\\([^(): ]+\\)" 2) | |
| ("object" "\\(object +\\)\\([^(): ]+\\)" 2) | |
| )))) | |
| ;; add Control-. so you can find stuff via imenu-anywhere | |
| (global-set-key (kbd "C-.") 'imenu-anywhere) | |
| ;; Puts the current imenu thing in top line of the buffer. | |
| (which-function-mode) | |
| (setq-default header-line-format | |
| '((which-func-mode ("" which-func-format " ")))) | |
| (setq mode-line-misc-info | |
| ;; We remove Which Function Mode from the mode line, because it's mostly | |
| ;; invisible here anyway. | |
| (assq-delete-all 'which-func-mode mode-line-misc-info)) | |
| (setq which-func-unknown "n/a") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment