Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

40 lines (28 sloc) 1.257 kb

This plugin is meant to simplify a task I've found too common in my workflow: switching between a single-line statement and a multi-line one.

I usually work with ruby and a lot of expressions can be written very concisely on a single line. A good example is the "if" statement:

puts "foo" if bar?

This is a great feature of the language, but when you need to add more statements to the body of the "if", you need to rewrite it:

if bar?
  puts "foo"
  puts "baz"
end

The idea of this plugin is to introduce a single key binding for transforming a line like this:

<div id="foo">bar</div>

Into this:

<div id="foo">
  bar
</div>

And another binding for the opposite transformation. This currently works for various constructs in ruby and erb, and for tags in html/xml.

For more information, try :help splitjoin, or take a look at the help file online at doc/splitjoin.txt

For more examples and corner cases, you can explore the "examples" directory here: examples. It's not present in the downloadable zip file to avoid cluttering your vimfiles with useless stuff.

Jump to Line
Something went wrong with that request. Please try again.