nvim-lua / wishlist

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

Heuristically set buffer options #19

Open Shatur opened 3 years ago

Shatur commented 3 years ago

What? This plugin automatically adjusts 'shiftwidth' and 'expandtab' heuristically based on the current file.

Why? When you work with several projects, it is not very convenient to manually set formatting parameters. It would be nice to be able to define these options automatically.

Potential existing implementations: This functionality is provided by default in VSCode. There is also a great plugin https://github.com/tpope/vim-sleuth, but it is written in Vimscript and can slow down the editor.

*Potential pitfalls:* It would be nice to implement this feature async.

matu3ba commented 3 years ago

~~I disagree to make a heuristic to fix missing code formatting settings. If the language or project has none, it is already unfriendly to contributors.~~

Please change title to something like "plugin that extracts and conditionally sets options from code formatters (per buffer)".

After thinking more about various formatter config formats (lol), I get convinced about the idea. However I still think languages settings should be hardcoded and used, if the language formatter enforces them.

Shatur commented 3 years ago

Please change title to something like "plugin that extracts and conditionally sets options from code formatters (per buffer)".

Sorry, but personally would like to see the plugin exactly as I described. The implementation will be much simpler (no need to handle configuration reading for every possible formatter) and it will work for projects without formatting settings just for free.

matu3ba commented 2 years ago

@Shatur Does https://github.com/NMAC427/guess-indent.nvim satisfy all your wishes?