Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add support for expanding to ruby symbols, eg. :symbol

  • Loading branch information...
commit ca212f6a185a2c56ce399944718e51991aa8e3c5 1 parent 2e889e3
@magnars magnars authored
Showing with 14 additions and 1 deletion.
  1. +14 −1 ruby-mode-expansions.el
View
15 ruby-mode-expansions.el
@@ -44,6 +44,18 @@
(end-of-line)
(exchange-point-and-mark))
+(defun er/mark-ruby-symbol ()
+ "Mark the entire symbol around or in front of point."
+ (interactive)
+ (let ((symbol-regexp ":\\|\\s_\\|\\sw"))
+ (when (or (looking-at symbol-regexp)
+ (looking-back symbol-regexp))
+ (while (looking-at symbol-regexp)
+ (forward-char))
+ (set-mark (point))
+ (while (looking-back symbol-regexp)
+ (backward-char)))))
+
(defun er/mark-ruby-function ()
"Mark the current Ruby function."
(interactive)
@@ -64,7 +76,8 @@
"Adds Ruby-specific expansions for buffers in ruby-mode"
(set (make-local-variable 'er/try-expand-list) (append
er/try-expand-list
- '(er/mark-ruby-block
+ '(er/mark-ruby-symbol
+ er/mark-ruby-block
er/mark-ruby-function))))
(add-hook 'ruby-mode-hook 'er/add-ruby-mode-expansions)
Please sign in to comment.
Something went wrong with that request. Please try again.