timakro / vim-yadi

Yet Another Detect Indent
MIT License
15 stars 3 forks source link

maximum indentation #4

Open Konfekt opened 8 months ago

Konfekt commented 8 months ago

In a file with two lines of which one has many leading spaces, the detected indent is huge. How about a maximal indent similar to the minimal one ?

Konfekt commented 8 months ago

In the meantime

augroup DetectIndent
  autocmd!
  autocmd BufReadPost * DetectIndent |
        \ if &l:softtabstop > 4 | let &l:softtabstop = 4 | endif |
        \ if &l:shiftwidth > 4 | let &l:shiftwidth = 4 | endif
augroup END

serves as a workaround

timakro commented 8 months ago

I think this is a good idea. Do you think 8 spaces would be a good maximum? The Linux kernel uses tabs rendered as 8 spaces so I think someone using 8-space indents wouldn't be entirely unreasonable.

Konfekt commented 8 months ago

Yes, this limit is what I am using in my vimrc as well.

timakro commented 8 months ago

Would you like to open a PR?