Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding initial ruby-index support.

  • Loading branch information...
commit 0edbd2a380b9709aa0b7f5b8a7b41319af154fec 1 parent cc597e8
Jordan Ritter jpr5 authored
Showing with 32 additions and 0 deletions.
  1. +3 −0  .emacs.d/keys.el
  2. +29 −0 .emacs.d/mode-ruby.el
3  .emacs.d/keys.el
View
@@ -9,6 +9,9 @@
(global-set-key (kbd "C-x C-p") 'beginning-of-buffer)
(global-set-key (kbd "M-r") 'revert-buffer)
(global-set-key (kbd "M-g") 'goto-line)
+(global-set-key (kbd "C-M-\\") 'indent-region)
+;(global-set-key (kbd "C-M-\\") 'align)
+(global-set-key (kbd "C-M-/") 'align)
;; Some settings when we're in a windowed environment.
(when window-system
29 .emacs.d/mode-ruby.el
View
@@ -58,3 +58,32 @@
;; Load up cucumber/feature-mode.
(require 'cucumber-mode nil 'noerror)
+
+;; Gank some auto-align stuff from the compuweb.
+;;
+;; TODO: find a way to "group" '=' and '=>' align targets differently.
+(defconst align-ruby-modes '(ruby-mode)
+ "align-ruby-modes is a variable defined in `align.el'.")
+
+(defconst ruby-align-rules-list
+ '((ruby-comma-delimiter
+ (regexp . ",\\(\\s-*\\)[^/ \t\n]")
+ (modes . align-ruby-modes)
+ (repeat . t))
+ (ruby-string-after-func
+ (regexp . "^\\s-*[a-zA-Z0-9.:?_]+\\(\\s-+\\)['\"]\\w+['\"]")
+ (modes . align-ruby-modes)
+ (repeat . t))
+ (ruby-symbol-after-func
+ (regexp . "^\\s-*[a-zA-Z0-9.:?_]+\\(\\s-+\\):\\w+")
+ (modes . align-ruby-modes)))
+ "Alignment rules specific to the ruby mode. See the variable `align-rules-list' for more details.")
+
+(dolist (it ruby-align-rules-list)
+ (add-to-list 'align-rules-list it))
+
+(add-to-list 'align-perl-modes 'ruby-mode)
+(add-to-list 'align-dq-string-modes 'ruby-mode)
+(add-to-list 'align-sq-string-modes 'ruby-mode)
+(add-to-list 'align-open-comment-modes 'ruby-mode)
+(setq align-indent-before-aligning t)
Please sign in to comment.
Something went wrong with that request. Please try again.