6e5924014c
... rename layer variable `ruby-use-built-in-ruby-mode` to `ruby-enable-enh-ruby-mode` |
||
---|---|---|
.. | ||
img | ||
config.el | ||
packages.el | ||
README.org |
Ruby contribution layer for Spacemacs
Table of Contents TOC@4
Description
This layer provides support for the Ruby language with enh-ruby-mode and robe-mode. Optionally Enh Ruby Mode can be replaced with the built-in Emacs Ruby Mode.
Install
To use this contribution add it to your ~/.spacemacs
(setq-default dotspacemacs-configuration-layers '(ruby))
This layer supports two different Ruby modes: Emacs' built-in Ruby Mode and
enh-ruby-mode. By default the built-in Ruby mode is enabled. To switch to the
enh-ruby-mode
set ruby-enable-enh-ruby-mode
to t:
(defun dotspacemacs-configuration-layers ()
'((ruby :variables ruby-enable-enh-ruby-mode t)))
Prerequisites
Some of the advanced features supported by this layer depend on external gems that need to be installed in the context of your project (see below for guidance based on your version manager):
pry
andpry-doc
are required for jump to definition and code documentation (robe-mode
)ruby_parser
is required for goto-step_definition infeature-mode
You can install the gems in the context of your current project by
adding them to the Gemfile
, e.g.:
gem 'pry'
or on the command line (please refer to your ruby version manager specific documentation for details and caveats):
gem install pry
Key bindings
Ruby (enh-ruby-mode, robe, inf-ruby, ruby-tools)
Key binding | Description |
---|---|
SPC m ' |
toggle quotes of current string (only built-in mode) |
SPC m { |
toggle style of current block (only built-in mode) |
SPC m g g |
go to definition (robe-jump) |
SPC m h d |
go to Documentation |
SPC m s f |
send function definition |
SPC m s F |
send function definition and switch to REPL |
SPC m s i |
start REPL |
SPC m s r |
send region |
SPC m s R |
send region and switch to REPL |
SPC m s s |
switch to REPL |
SPC m x ' |
Change symbol or " string to ' |
SPC m x " |
Change symbol or ' string to " |
SPC m x : |
Change string to symbol |
% |
evil-matchit jumps between blocks |
ruby-test-mode
ruby-test-mode comes bundled with spacemacs, but this contribution adds a couple of useful keybindings:
Key binding | Description |
---|---|
SPC m t b |
run test file |
SPC m t t |
run test at pointer |