sponsor Vim development Vim logo Vim Book Ad

vim-rubyformat : Automatically reformats/beautifies ruby source code

 script karma  Rating 134/41, Downloaded by 1858  Comments, bugs, improvements  Vim wiki

created by
Benjamin Radovsky
 
script type
utility
 
description
UNMAINTAINED

vim-rubyformat is a simple vim plugin, that automatically reformats/beautifies ruby code, either when a ruby file is saved or when ff is pressed whilst in normal mode.

Step 1. In any .rb (ruby) file, when save is called, the RubyFormat() function should automatically be called. It's as simple as that.
Step 2 (Optional). Press ff in normal mode to call the RubyFormat() function.

Settings:
For other keybindings, simply bind `:call RubyFormat()` to your chosen keybinding in your vimrc file. Example: `nnoremap fm :call RubyFormat()<CR>`

`let g:remove_extra_lines = 2` is the current default, which deletes any extra blank lines more than 2 in a row. Place in vimrc to change the value.

To disable autoformatting on file save, place `let g:rubyformat_on_save = 0` in your vimrc file.
 
install details
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
vim-rubyformat-0.4.0.tar.gz 0.4.0 2016-01-14 7.0 Benjamin Radovsky Fixed small regular expression bug causing `=` sign to be pushed over with the symbol `||=`.
vim-rubyformat-0.3.3.tar.gz 0.3.3 2016-01-01 7.0 Benjamin Radovsky Rebuilt some regular expression statements to fix auto formatting spacing issues, mainly inside of quotes such as ", ' and now even working  with ` too.
vim-rubyformat-0.2.2.tar.gz 0.2.2 2015-12-19 7.0 Benjamin Radovsky Fixed a regular expression bug.
ip used for rating: 3.144.12.205

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github