splitjoin.vim Documentation

repository·main·Indexed 24 days ago

https://github.com/andrewradev/splitjoin.vim

A Vim plugin to quickly toggle between single-line and multi-line versions of code constructs using gS to split and gJ to join. Supports a wide range of languages including HTML, JSON, JavaScript, Python, Ruby, and Rust.

Tokens
352
Snippets
1
Records
2
Agent score
34%

What's inside splitjoin.vim

  1. Use splitjoin.vim to split and join lines

    main

    The 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.

  2. Install splitjoin.vim

    main

    You can install the plugin using a plugin manager or Vim's native package system.

    Using a Plugin Manager

    Follow the standard instructions for your manager:

    • vim-plug
    • Vundle

    Using Vim Packages

    Clone the repository into your start/ directory to load it automatically:

    git clone https://github.com/AndrewRadev/splitjoin.vim ~/.vim/pack/_/start/splitjoin

    Alternatively, clone it into the opt/ directory and load it manually in your .vimrc:

    packadd splitjoin

    Manual Installation

    Download the files from the releases tab and unzip them into your desired directory.