Adding rubocop to ruby layer
This commit is contained in:
parent
3624ff2eb8
commit
3d64532047
|
@ -11,6 +11,7 @@
|
|||
- [[Key bindings][Key bindings]]
|
||||
- [[Ruby (enh-ruby-mode, robe, inf-ruby, ruby-tools)][Ruby (enh-ruby-mode, robe, inf-ruby, ruby-tools)]]
|
||||
- [[ruby-test-mode][ruby-test-mode]]
|
||||
- [[rubocop][rubocop]]
|
||||
|
||||
* Description
|
||||
This layer provides support for the Ruby language with [[https://github.com/zenspider/enhanced-ruby-mode][enh-ruby-mode]] and [[https://github.com/dgutov/robe][robe-mode]].
|
||||
|
@ -39,6 +40,7 @@ based on your version manager):
|
|||
|
||||
- =pry= and =pry-doc= are required for *jump to definition* and *code documentation* (=robe-mode=)
|
||||
- =ruby_parser= is required for *goto-step_definition* in =feature-mode=
|
||||
- =rubocop= is required for rubocop integration
|
||||
|
||||
You can install the gems in the context of your current project by
|
||||
adding them to the =Gemfile=, e.g.:
|
||||
|
@ -94,3 +96,11 @@ a couple of useful keybindings:
|
|||
|-------------+---------------------|
|
||||
| ~SPC m t b~ | run test file |
|
||||
| ~SPC m t t~ | run test at pointer |
|
||||
|
||||
** rubocop
|
||||
|
||||
| Key binding | Description |
|
||||
|---------------+-------------------------------|
|
||||
| ~SPC m r a F~ | autocorrect current file |
|
||||
| ~SPC m r a D~ | autocorrect current directory |
|
||||
| ~SPC m r a P~ | autocorrect current project |
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
flycheck
|
||||
robe
|
||||
ruby-test-mode
|
||||
ruby-tools))
|
||||
ruby-tools
|
||||
rubocop
|
||||
))
|
||||
|
||||
(if ruby-enable-enh-ruby-mode
|
||||
(add-to-list 'ruby-packages 'enh-ruby-mode)
|
||||
|
@ -157,6 +159,17 @@
|
|||
(spacemacs/set-leader-keys-for-major-mode mode "tb" 'ruby-test-run)
|
||||
(spacemacs/set-leader-keys-for-major-mode mode "tt" 'ruby-test-run-at-point)))))
|
||||
|
||||
(defun ruby/init-rubocop ()
|
||||
(use-package rubocop
|
||||
:defer t
|
||||
:init (add-hook 'enh-ruby-mode-hook 'rubocop-mode)
|
||||
:config
|
||||
(progn
|
||||
(evil-leader/set-key-for-mode 'enh-ruby-mode "mraD" 'rubocop-autocorrect-directory)
|
||||
(evil-leader/set-key-for-mode 'enh-ruby-mode "mraP" 'rubocop-autocorrect-project)
|
||||
(evil-leader/set-key-for-mode 'enh-ruby-mode "mraF" 'rubocop-autocorrect-current-file)
|
||||
)))
|
||||
|
||||
(when (configuration-layer/layer-usedp 'auto-completion)
|
||||
(defun ruby/post-init-company ()
|
||||
(spacemacs|add-company-hook ruby-mode)
|
||||
|
|
Loading…
Reference in New Issue