Home

Awesome

๐Ÿช“๐Ÿงท splitjoin.nvim

Number of users on dotfyle

Split or join list-like syntax constructs. like g, and gj from the venerable old vim-mode-plus.

looking for something more...

๐Ÿšš Installation

return { 'bennypowers/splitjoin.nvim',
  lazy = true,
  keys = {
    { 'gj', function() require'splitjoin'.join() end, desc = 'Join the object under cursor' },
    { 'g,', function() require'splitjoin'.split() end, desc = 'Split the object under cursor' },
  },
}

๐ŸŽ Options

There are currently two options, the global default_indent serves as a fallback indent when a language does not have an indent configured. The languages table lets you specify or modify language rules. Each language table contains an options key which can have the following members:

nametypedescription
default_indentstringindent to apply when splitting
nodestable<string, table>options for this node
nodes[name].paddingstringpadding to apply when joining
nodes[name].sep_firstbooleanwhether to place the separator first when splitting

Default Options

See languages/*/options.lua

split()

Separate the construct under the cursor into multiple lines

Before:

[1, 2, 3]

After:

[
  1,
  2,
  3,
]

join()

Join the construct under the cursor into a single line

Before:

[
  1,
  2,
  3,
]

After:

[1, 2, 3]

Support