NMAC427 / guess-indent.nvim

Automatic indentation style detection for Neovim
MIT License
405 stars 8 forks source link

Improve setting option values, and add user events #9

Closed mildred closed 4 months ago

mildred commented 2 years ago

Add user events to allow the user to customize the indentation after the detection, to fix some options that might be inherited from the initial configuration. Allows to customize via the configuration which options are set.

When tabs are detected, set shiftwidth=0 to ensure that the shifting value is the same as the tabstop. Same with softtabstop=0 to disable it. When spaces are detected, make optional setting of the tabstop and softtabstop option.

Use case: In my init.vim I set default indent options for empty files:

set sw=2 sts=0 ts=8 et

When guess-indent detects a file with tabs, it needs to be able to override these values.

Also, I prefer to always keep a tabstop of 8 characters, so I prefer not to have the value changed. And I also prefer to keep the softtabstop option disabled, but if it is enabled when spaces are detected, it needs to be disabled wen tabs are detected.

NMAC427 commented 4 months ago

Should have been adressed by #17.