splitjoin.vim : A plugin that helps with switching between single-line and multiline code
| script karma
Downloaded by 2514
Comments, bugs, improvements
script versions (upload new version)
|Github repo is at https://github.com/AndrewRadev/splitjoin.vim
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:
The idea of this plugin is to introduce a single key binding for transforming a line like this:
And another binding for the opposite transformation.
This currently works for:
* Various constructs in Ruby and Eruby
* Various constructs in Coffeescript
* Various constructs in Perl
* Various constructs in Python
* PHP arrays
* Tags in HTML/XML
* CSS, SCSS, LESS style declarations.
* YAML arrays
* Lua functions
* Vimscript line continuations
For more information, try :help splitjoin, or take a look at the help file online at https://github.com/AndrewRadev/splitjoin.vim/blob/master/doc/splitjoin.txt
For more examples and corner cases, you can explore the "examples" directory here: https://github.com/AndrewRadev/splitjoin.vim/tree/master/examples. It's not present in the downloadable zip file to avoid cluttering your vimfiles with useless stuff.
If you encounter any bugs or have an idea for a new feature, the issue tracker is on github, at https://github.com/AndrewRadev/splitjoin.vim/issues.
If you're using pathogen (vimscript #2332), extract it to a directory in your bundles or just clone the git repository at https://github.com/AndrewRadev/splitjoin.vim
Alternatively, extract it to your vimfiles root (~/.vim on *nix, ~/vimfiles on Windows).
Click on the package to download.
ip used for rating: 220.127.116.11