-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add basic ruby contrib layer #228
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Ruby contribution layer for Spacemacs | ||
|
||
## Description | ||
|
||
This layer aims at providing support for the Ruby language using | ||
[enh-ruby-mode][] and [robe-mode][]. | ||
|
||
## Install | ||
|
||
To use this contribution add it to your `~/.spacemacs` | ||
|
||
```elisp | ||
(defvar dotspacemacs-configuration-layers '(ruby) | ||
"List of contribution to load." | ||
) | ||
``` | ||
|
||
In order to take advantage of `robe-mode` you will probably need to | ||
install the `pry` gem. | ||
You can do that via your Gemfile: | ||
|
||
```ruby | ||
gem 'pry' | ||
``` | ||
|
||
or on the command line: | ||
|
||
```shell | ||
$ gem install pry | ||
``` | ||
|
||
## Key bindings | ||
|
||
### enh-ruby-mode | ||
|
||
<kbd>SPC m i</kbd> start REPL | ||
<kbd>SPC m g</kbd> go to definition (robe-jump) | ||
<kbd>SPC m d</kbd> go to Documentation | ||
<kbd>SPC m R</kbd> reload environment (Rails) | ||
|
||
### ruby-test-mode | ||
|
||
ruby-test-mode comes bundled with spacemacs, but this contribution adds | ||
a couple of useful keybindings: | ||
|
||
<kbd>SPC m t f</kbd> run test file | ||
<kbd>SPC m t p</kbd> run test at pointer | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated the conventions for key bindings, it gives us:
|
||
|
||
[enh-ruby-mode]: https://github.com/zenspider/enhanced-ruby-mode | ||
[robe-mode]: https://github.com/dgutov/robe |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
(defvar ruby-packages | ||
'( | ||
;; package rubys go here | ||
rbenv | ||
enh-ruby-mode | ||
ruby-test-mode | ||
robe | ||
yaml-mode | ||
) | ||
"List of all packages to install and/or initialize. Built-in packages | ||
which require an initialization must be listed explicitly in the list.") | ||
|
||
(defvar ruby-excluded-packages '(ruby-mode)) | ||
|
||
(defun ruby/init-rbenv () | ||
"Initialize RBENV mode" | ||
(use-package rbenv | ||
:init (global-rbenv-mode) | ||
:defer t | ||
:config (add-hook 'enh-ruby-mode-hook | ||
(lambda () (rbenv-use-corresponding))))) | ||
|
||
(defun ruby/init-enh-ruby-mode () | ||
"Initialize Enhanced Ruby Mode" | ||
(use-package enh-ruby-mode | ||
:defer t | ||
:mode (("\\(rake\\|thor\\|guard\\|gem\\|cap\\|vagrant\\)file\\'" . enh-ruby-mode) | ||
("\\.\\(rb\\|ru\\|builder\\|rake\\|thor\\|gemspec\\)\\'" . enh-ruby-mode)))) | ||
|
||
(defun ruby/init-robe () | ||
"Initialize Robe mode" | ||
(use-package robe | ||
:defer t | ||
:init (add-hook 'enh-ruby-mode-hook 'robe-mode) | ||
:config (progn (evil-leader/set-key-for-mode 'enh-ruby-mode "mg" 'robe-jump) | ||
(evil-leader/set-key-for-mode 'enh-ruby-mode "md" 'robe-doc) | ||
(evil-leader/set-key-for-mode 'enh-ruby-mode "mR" 'robe-rails-refresh) | ||
(evil-leader/set-key-for-mode 'enh-ruby-mode "mi" 'robe-start)))) | ||
|
||
(defun ruby/init-yaml-mode () | ||
"Initialize YAML mode" | ||
(use-package yaml-mode | ||
:config (add-hook 'yaml-mode-hook | ||
'(lambda () | ||
(define-key yaml-mode-map "\C-m" 'newline-and-indent))) | ||
:defer t | ||
:mode (("\\.\\(yml\\|yaml\\)\\'" . yaml-mode) | ||
("Procfile\\'" . yaml-mode)))) | ||
|
||
|
||
|
||
(defun ruby/init-ruby-test-mode () | ||
"Define keybindings for ruby test mode" | ||
(use-package ruby-test-mode | ||
:config (progn (evil-leader/set-key "mtf" 'ruby-test-run) | ||
(evil-leader/set-key "mtp" 'ruby-test-run-at-point)))) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the conventions for key bindings, it gives us: