Add rubocopfmt to format Ruby buffers
This commit is contained in:
parent
afa3dd0870
commit
80ff9053a3
|
@ -2167,6 +2167,7 @@ Other:
|
||||||
- ~SPC m f f b~ to find job
|
- ~SPC m f f b~ to find job
|
||||||
- ~SPC m f f w~ to find webpack config
|
- ~SPC m f f w~ to find webpack config
|
||||||
- ~SPC m f c d~ to run rails destroy
|
- ~SPC m f c d~ to run rails destroy
|
||||||
|
- Added =rubocopfmt= with the key binding ~SPC m = r~
|
||||||
**** Rust
|
**** Rust
|
||||||
- Added missing =counsel-gtags= and =smartparens= package declarations
|
- Added missing =counsel-gtags= and =smartparens= package declarations
|
||||||
(thanks to Kalle Lindqvist)
|
(thanks to Kalle Lindqvist)
|
||||||
|
|
|
@ -212,6 +212,7 @@ directory local variables.
|
||||||
|
|
||||||
| Key binding | Description |
|
| 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 RuboCop on the currently visited file |
|
||||||
| ~SPC m R r F~ | Runs auto-correct 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 from a directory on which to run RuboCop |
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
robe
|
robe
|
||||||
rspec-mode
|
rspec-mode
|
||||||
rubocop
|
rubocop
|
||||||
|
rubocopfmt
|
||||||
ruby-hash-syntax
|
ruby-hash-syntax
|
||||||
(ruby-mode :location built-in :toggle (not ruby-enable-enh-ruby-mode))
|
(ruby-mode :location built-in :toggle (not ruby-enable-enh-ruby-mode))
|
||||||
ruby-refactor
|
ruby-refactor
|
||||||
|
@ -226,10 +227,21 @@
|
||||||
"Rd" 'rubocop-check-directory
|
"Rd" 'rubocop-check-directory
|
||||||
"RD" 'rubocop-autocorrect-directory
|
"RD" 'rubocop-autocorrect-directory
|
||||||
"Rf" 'rubocop-check-current-file
|
"Rf" 'rubocop-check-current-file
|
||||||
"RF" 'rubocop-autocorrect-current-file
|
|
||||||
"Rp" 'rubocop-check-project
|
"Rp" 'rubocop-check-project
|
||||||
"RP" 'rubocop-autocorrect-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 ()
|
(defun ruby/init-ruby-mode ()
|
||||||
(use-package ruby-mode
|
(use-package ruby-mode
|
||||||
:defer t
|
:defer t
|
||||||
|
|
Loading…
Reference in a new issue