nvim-lua / wishlist

A public catalogue of Lua plugins Neovim users would like to see exist
MIT License
235 stars 0 forks source link

A version of SplitJoin that works with treesitter #30

Closed LandonSchropp closed 1 year ago

LandonSchropp commented 3 years ago

What?

I love the splitjoin.vim plugin. It's been part of my daily workflow for years. However, there are times when it doesn't get things quite right, resulting in syntax errors. I'd love to see a new Neovim version of this plugin that uses treesitter for better accuracy.

Why?

This plugin saves a ton of time for daily development, making it easy to extend code to multiple lines or condense it to one line.

Potential existing implementations:

splitjoin.vim is already really solid. However, I think it could be better with treesitter.

*Potential pitfalls:*

One of the time-consuming aspects of the original splitjoin is working around individual language issues. Hopefully, treesitter would solve those problems.

matu3ba commented 3 years ago

I really like the plugin. ThePrimeagen streams his work (on twitch) on refactor.nvim which goes into the same direction https://github.com/ThePrimeagen/refactoring.nvim and is based on the Refactoring book by Martin Fowler. Treesitter included.

kylechui commented 2 years ago

A bit late, but I've been using this for a while and have no complaints: https://github.com/AckslD/nvim-trevJ.lua

ObserverOfTime commented 2 years ago

trevJ is fine for splitting lines but it can't join them.

Sure, I can use va}J, for example, but what if I don't want the spaces? No, gJ doesn't work since it doesn't remove the existing spaces.

Wansmer commented 1 year ago

Hello. I wrote a similar plugin using trееsitter. At the moment, it is not a complete replacement for splitjoin.vim (for example, there is no arrow function conversion in it), but in my cases it's work good. https://github.com/Wansmer/treesj

searleser97 commented 1 year ago

Hello. I wrote a similar plugin using trееsitter. At the moment, it is not a complete replacement for splitjoin.vim (for example, there is no arrow function conversion in it), but in my cases it's work good. https://github.com/Wansmer/treesj

This work should be enough too close this issue I believe

LandonSchropp commented 1 year ago

@searleser97 I agree. treesj is awesome!