Skip to content

twlz0ne/shim.el

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI

shim.el

Emacs integration for Xenv.

Installation

Clone this repository, or install from MELPA. Add the following to your .emacs:

(add-to-list 'load-path (expand-file-name "~/.emacs.d/site-lisp/shim"))
(require 'shim)
(shim-init-ruby)
(shim-init-python)
(shim-init-node)
(shim-init-java)
(shim-init-go)

Usage

Basic

Invoke function manually:

  • i ) M-x shim-set input version or select from list.
  • ii) M-x shim-auto-set auto detect version.

Or add to major mode hook:

(add-hook 'js-mode-hook #'shim-mode)

If you would like specific version by file local variable (M-x shim-add-file-local-version):

...
// Local Variables:
// shim-node-version: "8.11.3"
// End:

Then you have to add following instead:

-(add-hook 'js-mode-hook #'shim-mode)
+(add-hook 'hack-local-variables-hook
+          (lambda ()
+            (when (ignore-errors (shim--guess-language))
+              (shim-mode 1))))

There is also a shim-add-dir-local-version function for user to set dir local variable.

Extended

Add support for new mode:

(shim-register-mode 'node 'js2-mode)

;; or registers all modes at initialization
(shim-init-node :major-modes
                '(js-mode
                  js2-mode
                  rjsx-mode))

Add support for new language:

(cl-defun shim-init-foo (&key (major-modes '(foo-mode)) (executable "fooenv"))
  (shim-init
   (make-shim--shim
    :language 'foo
    :major-modes major-modes
    :executable executable)))

About

Emacs integration for rbenv/pyenv/nodenv/jenv/goenv

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published