diff --git a/layers/+lang/ruby/README.org b/layers/+lang/ruby/README.org index 0b26ff2a9755..bfc32136f11a 100644 --- a/layers/+lang/ruby/README.org +++ b/layers/+lang/ruby/README.org @@ -11,7 +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]] + - [[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]]. @@ -97,10 +97,13 @@ a couple of useful keybindings: | ~SPC m t b~ | run test file | | ~SPC m t t~ | run test at pointer | -** rubocop +** 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 | +| Key binding | Description | +|---------------+------------------------------------------------------| +| ~SPC m r r f~ | Runs RuboCop on the currently visited file | +| ~SPC m r r F~ | Runs auto-correct on the currently visited file | +| ~SPC m r r d~ | Prompts from a directory on which to run RuboCop | +| ~SPC m r r D~ | Prompts for a directory on which to run auto-correct | +| ~SPC m r r p~ | Runs RuboCop on the entire project | +| ~SPC m r r P~ | Runs auto-correct on the project | diff --git a/layers/+lang/ruby/packages.el b/layers/+lang/ruby/packages.el index 2b409ca7fe42..ba36e6b84d0a 100644 --- a/layers/+lang/ruby/packages.el +++ b/layers/+lang/ruby/packages.el @@ -156,19 +156,27 @@ (spacemacs|hide-lighter ruby-test-mode) (dolist (mode '(ruby-mode enh-ruby-mode)) (spacemacs/declare-prefix-for-mode mode "mt" "ruby/test") - (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))))) + (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) + :init (spacemacs/add-to-hooks 'rubocop-mode '(ruby-mode-hook + enh-ruby-mode-hook)) :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) - ))) + (dolist (mode '(ruby-mode enh-ruby-mode)) + (spacemacs/declare-prefix-for-mode mode "mr" "ruby/refactor") + (spacemacs/set-leader-keys-for-major-mode mode + "rrd" 'rubocop-check-directory + "rrD" 'rubocop-autocorrect-directory + "rrf" 'rubocop-check-current-file + "rrF" 'rubocop-autocorrect-current-file + "rrp" 'rubocop-check-project + "rrP" 'rubocop-autocorrect-project))))) (when (configuration-layer/layer-usedp 'auto-completion) (defun ruby/post-init-company ()