Skip to content

Instantly share code, notes, and snippets.

@jordonbiondo
Created February 13, 2015 15:31
Show Gist options
  • Select an option

  • Save jordonbiondo/622eef7d6bdf07137a81 to your computer and use it in GitHub Desktop.

Select an option

Save jordonbiondo/622eef7d6bdf07137a81 to your computer and use it in GitHub Desktop.
automatically swith rubies when changing buffer to a ruby buffer outside the current project.
;; automatically swith rubies when changing buffer to a ruby buffer outside the current project.
;; requires rvm.el and projectile
(defvar jorbi/-last-active-ruby-project nil)
(defun jorbi/maybe-activate-new-ruby ()
(when (and (equal major-mode 'ruby-mode)
(not (equal jorbi/-last-active-ruby-project
(setq jorbi/-last-active-ruby-project
(projectile-project-name)))))
(rvm-activate-corresponding-ruby)))
(add-hook 'buffer-list-update-hook 'jorbi/maybe-activate-new-ruby))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment