Use Ruby PP and RuboCop Autocorrect to indent, format and prettify your Ruby code.
gem install rubocop
Pretty Ruby: Format pretty_ruby_format
- Linux: ctrl + shift + r + p
["ctrl+shift+r", "ctrl+shift+p"] - Mac: shift + super + r + p
["shift+super+r", "shift+super+p"] - Windows: ctrl + shift + r + p
["ctrl+shift+r", "ctrl+shift+p"]
User/Default (Linux).sublime-keymap:
{ "keys": ["ctrl+shift+h"], "command": "pretty_ruby_format" }User/Preferences.sublime-settings:
// which ruby
"ruby_path": "/home/user/.rvm/rubies/ruby-2.2.2/bin/ruby",
// which rubocop
"rubocop_path": "/home/user/.rvm/gems/ruby-2.2.2/bin/rubocop"/usr/bin/env: ruby_executable_hooks: No such file or directory
Use wrappers instead of bin:
User/Preferences.sublime-settings:
// which rubocop
// "rubocop_path": "/home/user/.rvm/gems/ruby-2.2.2/bin/rubocop" // wrong
"rubocop_path": "/home/user/.rvm/gems/ruby-2.2.2/wrappers/rubocop" // correct/bin/sh: 1: /home/user/.rvm/rubies/ruby-2.2.2/wrappers/ruby: not found
Don't use wrappers for ruby bin.
User/Preferences.sublime-settings:
// which rubocop
// "ruby_path": "/home/user/.rvm/rubies/ruby-2.2.2/wrappers/ruby" // wrong
"ruby_path": "/home/user/.rvm/rubies/ruby-2.2.2/bin/ruby" // correct