1
0
Fork 0
mirror of https://github.com/vim/vim synced 2025-03-15 22:37:52 +01:00
Commit graph

5 commits

Author SHA1 Message Date
Maxim Kim
25e833f4ec
editorconfig: set editing style for comment and hlsearch package
closes: 

Signed-off-by: Maxim Kim <habamax@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-03-06 21:14:20 +01:00
David Mandelberg
273926e5c0
editorconfig: set indent config for *.vim files
I tried to figure out what was the most common using modelines. Note
that there are 2401 vim files, and the numbers in the other command
outputs below add up to significantly less than that, so it's possible
that my estimate of what's most common is way off.

```
$ find . -name \*.vim | wc -l
2401
```

It looks like 2 is the most common value by far for shiftwidth and
softtabstop, so I used that for indent_size.

```
$ git grep -hE '(^|\s)((vi|vim|ex):|(vi|[vV]im|ex):\s*set? .*:)' -- '*.vim' |
> grep -Eo '\<(sw|shiftwidth)=[0-9]+' | cut -d = -f 2 |
> sort | uniq -c | sort -n
      2 0
     14 3
     18 8
     75 4
    610 2

$ git grep -hE '(^|\s)((vi|vim|ex):|(vi|[vV]im|ex):\s*set? .*:)' -- '*.vim' |
> grep -Eo '\<(sts|softtabstop)=[^ :]+' | cut -d = -f 2 |
> sort | uniq -c | sort -n
      2 -1
      7 8
      9 0
      9 3
     43 4
    469 2
```

Similarly, 8 is by far the most common tabstop, so I didn't adjust that.

```
$ git grep -hE '(^|\s)((vi|vim|ex):|(vi|[vV]im|ex):\s*set? .*:)' -- '*.vim' |
> grep -Eo '\<(ts|tabstop)=[0-9]+' | cut -d = -f 2 |
> sort | uniq -c | sort -n
      1 20
      1 6
      1 9
      2 10
      2 16
      2 17
      3 15
      4 3
      5 18
      9 2
     40 4
    497 8
```

And expandtab is significantly more common than noexpandtab. Taking that
in combination with the common shiftwidth and softtabstop of 2 but
tabstop of 8, I set indent_style to space.

```
$ git grep -hE '(^|\s)((vi|vim|ex):|(vi|[vV]im|ex):\s*set? .*:)' -- '*.vim' |
> grep -Eo '\<(no)?(et|expandtab)\>' | sort | uniq -c | sort -n
     15 noexpandtab
     86 noet
    115 et
    309 expandtab
```

I did try to look at a few of the less common values for those options
to see if there was any obvious pattern, like all *.vim files in one
directory having a different setting. The only real pattern I noticed
was in runtime/pack/dist/opt/netrw, but that looks like it's imported
from a separate repository? So I think it might make more sense for them
to create their own .editorconfig file rather than putting settings for
that directory in this one.

closes: 

Signed-off-by: David Mandelberg <david@mandelberg.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2025-03-05 21:07:59 +01:00
Yinzuo Jiang
3c5d782dbc
editorconfig: set trim_trailing_whitespace = false for src/testdir/test*.vim
closes: 

Signed-off-by: Yinzuo Jiang <jiangyinzuo@foxmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-12-15 10:31:19 +01:00
Luca Saccarola
54996ecda0
editorconfig: don't trim trailing whitespaces in runtime/doc
closes: 

Signed-off-by: Luca Saccarola <github.e41mv@aleeas.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-11-15 19:54:45 +01:00
Luca Saccarola
feea1b444e
Add an .editorconfig file to repository
This commit tries to use an editorconfig file to ensure the same
settings across editors while contributing to the vim repository.

The rules are based of the guidelines defined in
`runtime/doc/develop.txt`.

Signed-off-by: Luca Saccarola <github.e41mv@aleeas.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
2024-11-11 21:37:40 +01:00