Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bennypowers/splitjoin.nvim
๐ช๐งท Split or join list-like syntax constructs
https://github.com/bennypowers/splitjoin.nvim
neovim neovim-plugin treesitter
Last synced: 9 days ago
JSON representation
๐ช๐งท Split or join list-like syntax constructs
- Host: GitHub
- URL: https://github.com/bennypowers/splitjoin.nvim
- Owner: bennypowers
- License: mit
- Created: 2023-02-18T19:33:09.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-10T07:21:28.000Z (30 days ago)
- Last Synced: 2024-10-17T17:31:04.272Z (22 days ago)
- Topics: neovim, neovim-plugin, treesitter
- Language: Lua
- Homepage:
- Size: 76.2 KB
- Stars: 76
- Watchers: 3
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-neovim - bennypowers/splitjoin.nvim - Split and join various syntax structures. (Editing Support / Scrollbar)
README
# ๐ช๐งท splitjoin.nvim
[![Number of users on dotfyle][dotfyle-badge]][dotfyle]
Split or join list-like syntax constructs. like `g,` and `gj` from the venerable
old [vim-mode-plus][vmp].> looking for something more...
> - mature? [treesj][treesj]
> - generic? [ts-node-action][tna]
> - bramvim? [splitjoin.vim][sjv]## ๐ Installation
```lua
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:| name | type | description |
| ---- | ---- | ----------- |
| `default_indent` | string | indent to apply when splitting |
| `nodes` | table | options for this node |
| `nodes[name].padding` | string | padding to apply when joining |
| `nodes[name].sep_first` | boolean | whether to place the separator first when splitting |### Default Options
See `languages/*/options.lua`
## `split()`
Separate the construct under the cursor into multiple lines
Before:
```javascript
[1, 2, 3]
```
After:
```javascript
[
1,
2,
3,
]
```## `join()`
Join the construct under the cursor into a single line
Before:
```javascript
[
1,
2,
3,
]
```
After:
```javascript
[1, 2, 3]
```## Support
- **ecmascript**: object, array, params, arguments
- **lua**: table, params, arguments, variable_lists
- **css**: rules (blocks)[vmp]: https://github.com/t9md/atom-vim-mode-plus
[sjv]: https://github.com/AndrewRadev/splitjoin.vim
[treesj]: https://github.com/Wansmer/treesj
[tna]: https://github.com/CKolkey/ts-node-action/
[dotfyle]: https://dotfyle.com/plugins/bennypowers/splitjoin.nvim
[dotfyle-badge]: https://dotfyle.com/plugins/bennypowers/splitjoin.nvim/shield