Open niksilver opened 5 years ago
Where is this "vim standard" defined?
Anyway, such "user-preference" settings should be kept in ~/.vimrc
, and elm-format enforces 4 spaces, so elm-vim setting tabstop=2
would be quite inconsistent.
Regards "standard vim": Yes, "vim standard" is the wrong phrase - the title of the request is an error. I've corrected that now. Apologies for the confusion.
My personal experience suggests that the default tab spacing on most terminals is 8 spaces, and Wikipedia says tab has been "de facto standardized at every multiple of 8 characters horizontally". Therefore as it stands if the elm-vim plugin is installed with no other settings or preferences (user preferences or otherwise) the user can expect to find it defaults to 8-space tabs. This is what I found.
Regards elm-format: I did not suggest tabstop=2
based on elm-format. I suggested it based on looking at the Elm style guide and the code examples on the Elm website. In those examples new indents are 2 spaces, or 4 spaces. Thus I interpret 2 space indents as the base case - the lowest common denominator - and 4 spaces being "2 spaces twice".
Regards user preferences: Yes, user preference settings should indeed be put in ~/.vimrc
. However, as the Elm style guide and the examples clearly show a preference, I thought it would be beneficial to users for the Elm plugin to use the "Elm preference" by default. The user can override that if they have a different user preference.
I offer this patch simply as a benefit to the community. The maintainers of ElmCast, of course, are free to accept or reject as they wish.
AFAIK, Evan used two spaces indentation in the examples, since four spaces indentation would make them too wide to fit in the website, and elm-format is supposed to be following (or enforcing) the community preference (since the tool is maintained by members of elm).
I find it confusing, as well, that even the style guide, and the standard packages, are not consistent with regard to indentation (using both two and four spaces).
The majority of projects use elm-format
with a non configurable tab width of 4
Problem: When I use elm-vim out of the box it defaults to tab stops of 8 spaces, but the Elm standard is 2 spaces.
Workaround: As a workaround I added the following line to my
~/.vimrc
file:But that's a manual change.
Fix: The change submitted seems to fix this problem, and sets tab stops in
.elm
files to 2 spaces, regardless of the user's global settings.