Use splitjoin.vim to split and join lines
mainThe plugin simplifies switching between single-line statements and multi-line blocks. It uses the following default keybindings:
gS: Splits a one-liner into multiple lines (e.g., transforming<div id="foo">bar</div>into a multi-line block).gJ: Joins a block into a single-line statement (ensure the cursor is on the first line of the block).
Supported languages include C, CSS, Clojure, Coffeescript, Elixir, Elm, Eruby, Go, HAML, Hare, HTML, Handlebars, JSON, Java, Javascript (including JSX, TSX, and Vue.js templates), Lua, PHP, Perl, Python, R, Ruby, Rust, SCSS, Less, Shell (sh, bash, zsh), Tex, Vimscript, and YAML.