ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Beautify​Ruby

by CraigWilliams ALL

Sublime Text 2 & 3 Plugin to Beautify Ruby

Details

  • 2020.08.07.01.43.58
  • github.​com
  • github.​com
  • 5 years ago
  • 2 hours ago
  • 13 years ago

Installs

  • Total 70K
  • Win 17K
  • Mac 34K
  • Linux 19K
Jun 14 Jun 13 Jun 12 Jun 11 Jun 10 Jun 9 Jun 8 Jun 7 Jun 6 Jun 5 Jun 4 Jun 3 Jun 2 Jun 1 May 31 May 30 May 29 May 28 May 27 May 26 May 25 May 24 May 23 May 22 May 21 May 20 May 19 May 18 May 17 May 16 May 15 May 14 May 13 May 12 May 11 May 10 May 9 May 8 May 7 May 6 May 5 May 4 May 3 May 2 May 1 Apr 30
Windows 0 2 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 0 0 1
Mac 1 1 0 0 1 2 0 0 0 0 1 0 0 0 0 1 1 0 2 2 0 0 0 2 0 3 0 0 1 0 0 0 1 1 0 0 0 1 0 0 3 0 2 0 1 0
Linux 0 0 2 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 1 0 2 0 0 0 0 1 0 0 0 0 0 0 0 0
01234Jun 14Jun 11Jun 8Jun 5Jun 2May 30May 27May 24May 21May 18May 15May 12May 9May 6May 3Apr 30Jun 14 Linux: 0 Mac: 1 Windows: 0Jun 13 Linux: 0 Mac: 1 Windows: 2Jun 12 Linux: 2 Mac: 0 Windows: 0Jun 11 Linux: 1 Mac: 0 Windows: 0Jun 10 Linux: 0 Mac: 1 Windows: 0Jun 9 Linux: 0 Mac: 2 Windows: 0Jun 8 Linux: 0 Mac: 0 Windows: 0Jun 7 Linux: 0 Mac: 0 Windows: 0Jun 6 Linux: 0 Mac: 0 Windows: 0Jun 5 Linux: 1 Mac: 0 Windows: 0Jun 4 Linux: 0 Mac: 1 Windows: 1Jun 3 Linux: 0 Mac: 0 Windows: 0Jun 2 Linux: 0 Mac: 0 Windows: 0Jun 1 Linux: 0 Mac: 0 Windows: 0May 31 Linux: 0 Mac: 0 Windows: 0May 30 Linux: 0 Mac: 1 Windows: 0May 29 Linux: 0 Mac: 1 Windows: 0May 28 Linux: 0 Mac: 0 Windows: 0May 27 Linux: 1 Mac: 2 Windows: 0May 26 Linux: 1 Mac: 2 Windows: 0May 25 Linux: 0 Mac: 0 Windows: 0May 24 Linux: 0 Mac: 0 Windows: 0May 23 Linux: 0 Mac: 0 Windows: 1May 22 Linux: 0 Mac: 2 Windows: 0May 21 Linux: 1 Mac: 0 Windows: 0May 20 Linux: 0 Mac: 3 Windows: 0May 19 Linux: 0 Mac: 0 Windows: 0May 18 Linux: 0 Mac: 0 Windows: 0May 17 Linux: 0 Mac: 1 Windows: 0May 16 Linux: 0 Mac: 0 Windows: 0May 15 Linux: 1 Mac: 0 Windows: 0May 14 Linux: 0 Mac: 0 Windows: 1May 13 Linux: 2 Mac: 1 Windows: 0May 12 Linux: 0 Mac: 1 Windows: 0May 11 Linux: 0 Mac: 0 Windows: 0May 10 Linux: 0 Mac: 0 Windows: 1May 9 Linux: 0 Mac: 0 Windows: 0May 8 Linux: 1 Mac: 1 Windows: 1May 7 Linux: 0 Mac: 0 Windows: 1May 6 Linux: 0 Mac: 0 Windows: 0May 5 Linux: 0 Mac: 3 Windows: 0May 4 Linux: 0 Mac: 0 Windows: 0May 3 Linux: 0 Mac: 2 Windows: 0May 2 Linux: 0 Mac: 0 Windows: 0May 1 Linux: 0 Mac: 1 Windows: 0Apr 30 Linux: 0 Mac: 0 Windows: 1Jun 14 Linux: 0 Mac: 1 Windows: 0Jun 13 Linux: 0 Mac: 1 Windows: 2Jun 12 Linux: 2 Mac: 0 Windows: 0Jun 11 Linux: 1 Mac: 0 Windows: 0Jun 10 Linux: 0 Mac: 1 Windows: 0Jun 9 Linux: 0 Mac: 2 Windows: 0Jun 8 Linux: 0 Mac: 0 Windows: 0Jun 7 Linux: 0 Mac: 0 Windows: 0Jun 6 Linux: 0 Mac: 0 Windows: 0Jun 5 Linux: 1 Mac: 0 Windows: 0Jun 4 Linux: 0 Mac: 1 Windows: 1Jun 3 Linux: 0 Mac: 0 Windows: 0Jun 2 Linux: 0 Mac: 0 Windows: 0Jun 1 Linux: 0 Mac: 0 Windows: 0May 31 Linux: 0 Mac: 0 Windows: 0May 30 Linux: 0 Mac: 1 Windows: 0May 29 Linux: 0 Mac: 1 Windows: 0May 28 Linux: 0 Mac: 0 Windows: 0May 27 Linux: 1 Mac: 2 Windows: 0May 26 Linux: 1 Mac: 2 Windows: 0May 25 Linux: 0 Mac: 0 Windows: 0May 24 Linux: 0 Mac: 0 Windows: 0May 23 Linux: 0 Mac: 0 Windows: 1May 22 Linux: 0 Mac: 2 Windows: 0May 21 Linux: 1 Mac: 0 Windows: 0May 20 Linux: 0 Mac: 3 Windows: 0May 19 Linux: 0 Mac: 0 Windows: 0May 18 Linux: 0 Mac: 0 Windows: 0May 17 Linux: 0 Mac: 1 Windows: 0May 16 Linux: 0 Mac: 0 Windows: 0May 15 Linux: 1 Mac: 0 Windows: 0May 14 Linux: 0 Mac: 0 Windows: 1May 13 Linux: 2 Mac: 1 Windows: 0May 12 Linux: 0 Mac: 1 Windows: 0May 11 Linux: 0 Mac: 0 Windows: 0May 10 Linux: 0 Mac: 0 Windows: 1May 9 Linux: 0 Mac: 0 Windows: 0May 8 Linux: 1 Mac: 1 Windows: 1May 7 Linux: 0 Mac: 0 Windows: 1May 6 Linux: 0 Mac: 0 Windows: 0May 5 Linux: 0 Mac: 3 Windows: 0May 4 Linux: 0 Mac: 0 Windows: 0May 3 Linux: 0 Mac: 2 Windows: 0May 2 Linux: 0 Mac: 0 Windows: 0May 1 Linux: 0 Mac: 1 Windows: 0Apr 30 Linux: 0 Mac: 0 Windows: 1Jun 14 Linux: 0 Mac: 1 Windows: 0Jun 13 Linux: 0 Mac: 1 Windows: 2Jun 12 Linux: 2 Mac: 0 Windows: 0Jun 11 Linux: 1 Mac: 0 Windows: 0Jun 10 Linux: 0 Mac: 1 Windows: 0Jun 9 Linux: 0 Mac: 2 Windows: 0Jun 8 Linux: 0 Mac: 0 Windows: 0Jun 7 Linux: 0 Mac: 0 Windows: 0Jun 6 Linux: 0 Mac: 0 Windows: 0Jun 5 Linux: 1 Mac: 0 Windows: 0Jun 4 Linux: 0 Mac: 1 Windows: 1Jun 3 Linux: 0 Mac: 0 Windows: 0Jun 2 Linux: 0 Mac: 0 Windows: 0Jun 1 Linux: 0 Mac: 0 Windows: 0May 31 Linux: 0 Mac: 0 Windows: 0May 30 Linux: 0 Mac: 1 Windows: 0May 29 Linux: 0 Mac: 1 Windows: 0May 28 Linux: 0 Mac: 0 Windows: 0May 27 Linux: 1 Mac: 2 Windows: 0May 26 Linux: 1 Mac: 2 Windows: 0May 25 Linux: 0 Mac: 0 Windows: 0May 24 Linux: 0 Mac: 0 Windows: 0May 23 Linux: 0 Mac: 0 Windows: 1May 22 Linux: 0 Mac: 2 Windows: 0May 21 Linux: 1 Mac: 0 Windows: 0May 20 Linux: 0 Mac: 3 Windows: 0May 19 Linux: 0 Mac: 0 Windows: 0May 18 Linux: 0 Mac: 0 Windows: 0May 17 Linux: 0 Mac: 1 Windows: 0May 16 Linux: 0 Mac: 0 Windows: 0May 15 Linux: 1 Mac: 0 Windows: 0May 14 Linux: 0 Mac: 0 Windows: 1May 13 Linux: 2 Mac: 1 Windows: 0May 12 Linux: 0 Mac: 1 Windows: 0May 11 Linux: 0 Mac: 0 Windows: 0May 10 Linux: 0 Mac: 0 Windows: 1May 9 Linux: 0 Mac: 0 Windows: 0May 8 Linux: 1 Mac: 1 Windows: 1May 7 Linux: 0 Mac: 0 Windows: 1May 6 Linux: 0 Mac: 0 Windows: 0May 5 Linux: 0 Mac: 3 Windows: 0May 4 Linux: 0 Mac: 0 Windows: 0May 3 Linux: 0 Mac: 2 Windows: 0May 2 Linux: 0 Mac: 0 Windows: 0May 1 Linux: 0 Mac: 1 Windows: 0Apr 30 Linux: 0 Mac: 0 Windows: 1

Readme

Source
raw.​githubusercontent.​com

Codeship Status for CraigWilliams/BeautifyRuby

BeautifyRuby

Erb html templates uses Paul Battley's htmlbeautifier gem. This (as well as rubygems) is assumed to be installed as seen by the ruby interpreter. Note that if you beautify an erb file but htmlbeautifier is not found, the error message is 'check your ruby interpreter settings', do not be misled.

Interpreter settings

If an error is encountered while processing the file, Python receives an empty string and the following message is displayed but may have nothing to do with your Ruby settings.

check your ruby interpreter settings

Hooks

This package offers a pre-save hook, i.e., your ruby and erb files will be reformatted automatically before saving. To activate this feature, set:

"run_on_save": true,

The sublime command “beautify_ruby” performs a save after formatting. You can disable this default by setting:

"save_on_beautify": false

You can change the file patterns handled by this plugin in the settings:

"file_patterns": [ "\\.html\\.erb", "\\.rb", "\\.rake", "Rakefile", "Gemfile" ],
"html_erb_patterns": ["\\.html\\.erb"],

This plugin uses ruby scripts to beautify your buffer, so it needs ruby installed. You can configure your ruby interpreter under Preferences -> Package Settings -> BeautifyRuby -> Settings Default/User click here for a screenshot. Although the default should work on linux and osx, not setting this right is a common problem.

If you do not use the system ruby, type in your favourite shell:

which ruby

and place that in the ruby setting.

On windows, set Preferences -> Package Settings -> BeautifyRuby -> Settings Default

"ruby": "ruby"

If you use project-specific rubies and gem sets managed with rvm, then simply set

"ruby": "~/.rvm/bin/rvm-auto-ruby",

and then the htmlbeautifier gem is found even if it is only installed for this project.

If you are using ruby on the Windows Subsystem for Linux, use:

"ruby": "wsl ruby"

Tabs or Spaces

By default, Sublime does not translate tabs to spaces. If you wish to use tabs you will not need to change your settings. If you wish to use spaces, add the following setting.

"translate_tabs_to_spaces": true

Or if you wish to force the use of tabs use:

"translate_tabs_to_spaces": false

Tab size

Sublime's default tab_size is set to 4. Override this setting to change the number of spaces to use when using spaces instead of tabs.

"tab_size": 2

Key Binding

ctrl + cmd + k on OS X, or ctrl + alt + k on Windows

Installation

Package Control

Using Package Control, a package manager for Sublime Text 2.

In ST2, press “cmd + shift + p” and then type “install”.

Once you see “Package Control: Install Package”, enter.

When the packages load, another selection window will appear. Type

BeautifyRuby and enter. All done!

Manual Installation

cd "~/Library/Application Support/Sublime Text 2/Packages/"
  git clone git://github.com/CraigWilliams/BeautifyRuby.git