jake-stewart / multicursor.nvim

multiple cursors in neovim
MIT License
123 stars 2 forks source link

Lua style #16

Open ajvondrak opened 4 hours ago

ajvondrak commented 4 hours ago

I realize that this project has gone through some flux since its initial version as Lua generated from TypeScript, but I want to commend you on the port to plain old Lua, and for making the API a first class citizen by way of #7. 🙂 Your plugin appears to be the easiest to hack on of all the multicursor implementations I've seen for neovim:

At any rate, having a Lua-based API of primitive functions goes a long way to making this plugin friendlier to shape into the form I want. I'm still tinkering with it, but it's quite promising!

While I was bashing away, I kept being distracted by a minor style thing. I'm no Lua expert, but I'm used to seeing snake_case rather than the camelCase that I assume this plugin inherited from its TS roots. For example, see the conventions used by:

Just thought I'd drop the idea that it's perhaps worth incorporating a Lua linter/formatter stack sooner than later and settling on a fixed style (whether that means keeping the camelCase or not). Not that I've ever done this for a Lua project, so I don't know if it's the linters enforcing that or the authors themselves. 😅

Thanks for the work thus far, and happy hacking!

jake-stewart commented 3 hours ago

Thanks.

I think the best approach is to update 1.0 branch to have snake case variations which simply wrap the camel case ones. Remove the camel case variations from a 1.1 branch. This way nothing breaks.

Three downsides:

  1. Users have to update their configs if they want to update to 1.1.
  2. More work releasing bug fixes since I have two branches.
  3. Users on 1.0 who print a cursor will see a metatable of duplicate functions.

Consistency is nice, but is it worth the hassle?