Need help with splitjoin.vim?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

1.4K Stars 80 Forks MIT License 830 Commits 16 Opened issues


Switch between single-line and multiline forms of code

Services available


Need anything else?

Contributors list

GitHub version Build Status


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. It offers the following default keybindings, which can be customized:

  • gS
    to split a one-liner into multiple lines
  • gJ
    (with the cursor on the first line of a block) to join a block into a single-line statement.


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"

The idea of this plugin is to introduce a single key binding (default:

) for transforming a line like this:

Into this:


And another binding (default:

) for the opposite transformation.

This currently works for various constructs in the following languages:

  • C
  • CSS
  • Coffeescript
  • Elixir
  • Elm
  • Eruby
  • Go
  • HAML
  • HTML (and HTML-like markup)
  • Handlebars
  • Javascript (within JSX, TSX, Vue.js templates as well)
  • JSON
  • Lua
  • PHP
  • Perl
  • Python
  • Ruby
  • Rust
  • SCSS and Less
  • Shell (sh, bash, zsh)
  • Tex
  • Vimscript
  • YAML

For more information, including examples for all of those languages, try

, or take a look at the full help file online at doc/splitjoin.txt


The easiest way to install the plugin is with a plugin manager:

  • vim-plug:
  • Vundle:

If you use one, just follow the instructions in its documentation.

You can install the plugin yourself using Vim's "packages" functionality by cloning the project (or adding it as a submodule) under

. For example:
git clone ~/.vim/pack/_/start/splitjoin

This should automatically load the plugin for you on Vim start. Alternatively, you can add it to

instead and load it in your .vimrc manually with:
packadd splitjoin

If you'd rather not use git, you can download the files from the "releases" tab and unzip them in the relevant directory:


If you'd like to hack on the plugin, please see first.


Any issues and suggestions are very welcome on the github bugtracker.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.