Add rubocopfmt to format Ruby buffers

This commit is contained in:
Seong Yong-ju 2019-05-10 23:24:39 +09:00 committed by duianto
parent afa3dd0870
commit 80ff9053a3
3 changed files with 15 additions and 1 deletions

View File

@ -2167,6 +2167,7 @@ Other:
- ~SPC m f f b~ to find job
- ~SPC m f f w~ to find webpack config
- ~SPC m f c d~ to run rails destroy
- Added =rubocopfmt= with the key binding ~SPC m = r~
**** Rust
- Added missing =counsel-gtags= and =smartparens= package declarations
(thanks to Kalle Lindqvist)

View File

@ -212,6 +212,7 @@ directory local variables.
| Key binding | Description |
|---------------+------------------------------------------------------|
| ~SPC m = r~ | Format the current buffer using RuboCop |
| ~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 |

View File

@ -27,6 +27,7 @@
robe
rspec-mode
rubocop
rubocopfmt
ruby-hash-syntax
(ruby-mode :location built-in :toggle (not ruby-enable-enh-ruby-mode))
ruby-refactor
@ -226,10 +227,21 @@
"Rd" 'rubocop-check-directory
"RD" 'rubocop-autocorrect-directory
"Rf" 'rubocop-check-current-file
"RF" 'rubocop-autocorrect-current-file
"Rp" 'rubocop-check-project
"RP" 'rubocop-autocorrect-project))))
(defun ruby/init-rubocopfmt ()
(use-package rubocopfmt
:defer t
:init
(progn
(setq-default rubocopfmt-disabled-cops '())
(dolist (mode '(ruby-mode enh-ruby-mode))
(spacemacs/declare-prefix-for-mode mode "m=" "format")
(spacemacs/set-leader-keys-for-major-mode mode
"=r" #'rubocopfmt)))))
(defun ruby/init-ruby-mode ()
(use-package ruby-mode
:defer t