2016-01-29 13:32 GMT+03:00 Csaba Hoch <[email protected]>: > Hi, > > I'm the maintainer of the Erlang indentation, which is developed in a > separate repository (https://github.com/vim-erlang/vim-erlang-runtime), > and when it is modified, I send the updated file to Bram. > >> 1. I've changed `&shiftwidth` to `shiftwidth()`. >> 2. Removed a checking code / a wrapper function for shiftwidth() >> for some specific indent plugins. > > I agree with the change, except that when I change from &sw to > shiftwidth() in my repository, I would also add the "*shiftwidth" check. > That is because this repo can be used with any version of Vim, and many > systems still have Vim versions without the shiftwidth() feature > (including the newest OS X, which comes with Vim 7.3). So it's fine by > me to simply replace &sw with shiftwidth() in the main Git repo as you > did it; but allow me to add the check in my repo (a change which will > eventually creep back into Vim). > >> 3. Some indent plugins change `shiftwidth` and `softtabstop`. >> Is it evil? What do you think? > > My opinion is that most programming languages let their users decide > these, so Vim indentation scripts for those languages shouldn't modify > these settings. There may be exceptions though, e.g. AFAIK the Go > programming language recommends that all code is formatted with the > "gofmt" program; so if gofmt uses sw=4 ts=4, then it can be OK for the > indentation script to modify these (as long as they provide an option to > the user to override these by e.g. setting a variable like > "g:go_indent_keep_sw").
I think that the only thing that justifies overriding user setting is syntax error on invalid indentation. E.g. Makefile must have &expandtab unset, Zimbu must have it set (control characters including tab are an error according to the specification), but recommendations like PEP8 or gofmt (is not there some named document in place of tool?) should not. But I think it makes sense to introduce configuration variable `g:coding_standard`+`b:coding_standard` which may set to `'own'` (default, keep user settings always), `'recommended'` (alternative default, use recommended language settings for languages which have something like PEP8), something filetype-specific (e.g. `'pep8'`, intended to be used only in buffer-local variable value). The main advantage here is that if I do not want indent script override my settings I set *one* variable, and not *one per filetype*. Since there will be a single variable like this it does not matter whether default will be `'own'` or `'recommended'` for me. > > Csaba > > On Mon, Jan 25, 2016 at 3:58 PM, tyru <[email protected]> wrote: >> Hi, Vimmers. >> >> I'm sending this email to Vim indent plugins maintainers and vim_dev. >> I suppose all of you maintain `$VIMRUNTIME/runtime/indent/*.vim`. >> I want you to review and merge my modifications. >> >> Now I'm working on the issue about Vim indent plugins. >> (See details below) >> https://github.com/vim/vim/pull/578 >> >> Please see my detailed commits for above link. >> In brief: >> 1. I've changed `&shiftwidth` to `shiftwidth()`. >> 2. Removed a checking code / a wrapper function for shiftwidth() >> for some specific indent plugins. >> 3. Some indent plugins change `shiftwidth` and `softtabstop`. >> Is it evil? What do you think? >> >> 1. I've changed `&shiftwidth` to `shiftwidth()`. >> >> This allows user to `set shiftwidth=0` in .vimrc. >> This feature is added in 7.3.629 (more than 3 years ago, >> but it makes no sense because indent plugins do not support this yet) >> >> 2. Removed a checking code / a wrapper function for shiftwidth() >> for some specific indent plugins. >> >> I removed a checking code / a wrapper function for shiftwidth(). >> * bzl.vim >> * go.vim >> * html.vim >> * teraterm.vim >> * yaml.vim >> >> 3. Some indent plugins change `shiftwidth` and `softtabstop`. >> Is it evil? What do you think? >> >> Nowadays, Vim supports syncing `shiftwidth` and `softtabstop` values >> with `tabstop`, like this. >> >> set tabstop=2 shiftwidth=0 softtabstop=-1 >> >> shiftwidth: 7.3.629 or later >> softtabstop: 7.3.692 or later >> >> This makes it easy to change indent behavior at once. >> A user can change it only changing `tabstop` value. >> But, some indent plugins seem to change `shiftwidth` or `softtabstop` values. >> As a result, a user must set all 3 options by him or herself. >> >> >> I'm waiting for your feedbacks about my modification. >> >> Thanks > > -- > -- > You received this message from the "vim_dev" maillist. > Do not top-post! Type your reply below the text you are replying to. > For more information, visit http://www.vim.org/maillist.php > > --- > You received this message because you are subscribed to the Google Groups > "vim_dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
