#1844 Issue closed
: Strange # vim: set et ts=4 sw=4:
comments at the end of some scrips¶
Labels: discuss / RFC
, fixed / solved / done
jsmeix opened issue at 2018-06-28 09:32:¶
In current ReaR master code some scripts have a last line
# vim: set et ts=4 sw=4:
which got added by @rmetrich via
https://github.com/rear/rear/commit/b184194f37dd22a7e55655ff388579297239e73c
and
https://github.com/rear/rear/commit/84f03a4a2828ad21a1ab770b5737db9dac41074c
I.e. in current ReaR master code there is
$ find usr/sbin/rear usr/share/rear/ | xargs grep 'vim:' 2>/dev/null usr/share/rear/lib/layout-functions.sh:# vim: set et ts=4 sw=4: usr/share/rear/prep/GNU/Linux/220_include_lvm_tools.sh:# vim: set et ts=4 sw=4: usr/share/rear/layout/prepare/GNU/Linux/110_include_lvm_code.sh:# vim: set et ts=4 sw=4: usr/share/rear/layout/save/GNU/Linux/220_lvm_layout.sh:# vim: set et ts=4 sw=4:
I guess this is some special automatism by the vi
editor.
@rmetrich
could you explan the reason behind
and whether or not I should remove them
or if it makes sense to have those trailing comment lines.
rmetrich commented at 2018-06-28 09:53:¶
@jsmeix these directives tell vim to automatically adjust when editing the file:
- et : expand tabs
- ts=4 : 4 spaces when expanding a
found in the file - sw=4 : 5 spaces when hitting
on your keyboard
Since most of ReaR's code is indented using these settings, keeping that would be nice to avoid messing up the files.
jsmeix commented at 2018-06-28 13:01:¶
@rmetrich
thanks for your prompt reply!
Now I understand.
jsmeix commented at 2018-06-28 13:03:¶
@gdha @gozora @schabrolles
what do you think:
Schouldn't then such a trailing comment line
# vim: set et ts=4 sw=4:
be appended to every ReaR script?
gozora commented at 2018-06-28 15:02:¶
Honestly I didn't know about this feature, but I'd personally prefer to keep editor settings out of source code mainly because other users might appear with different editors storing another set of "meta-data" which could lead to mess...
V.
rmetrich commented at 2018-06-28 16:01:¶
As you wish, although such metadata is widely used among projects, e.g. mariadb, sos, ruby, rsyslog, gnutls, NetworkManager, ...
Even in rear, it is already used in packaging/arch/PKGBUILD.
gozora commented at 2018-06-28 17:02:¶
Don't get me wrong Renaud, I'm not going to fight to keep this away from
ReaR source code, if you guys think this is a useful idea, let's keep
it, no problem with that from my site.
My editor for example, keeps meta-data information (e.g. information
about collapsed sections etc.) in separate files (dot prefixed) directly
in source tree and I just thought that it might be disturbing for other
people to deal with them, so I've reconfigured this behavior ...
V.
jsmeix commented at 2018-06-29 08:57:¶
I hope such comments cannot cause real trouble (because they are only
comments)
and because they are useful in some cases it is o.k. for me to have
them.
I think the only real trouble that such comments could cause are the
usual
"what is the right editor" plus "what is the right indentation style"
wars ;-)
rmetrich commented at 2018-06-29 08:58:¶
I can answer to "what is the right editor" ;-)
jsmeix commented at 2018-06-29 09:00:¶
My editor is the only right one that is used by real hard men ;-)
gozora commented at 2018-06-29 09:01:¶
@jsmeix ed
?
rmetrich commented at 2018-06-29 09:05:¶
likely, at his time there was only that ;-)
rmetrich commented at 2018-06-29 09:06:¶
or even maybe his editor was a puncher, for punch cards ;-)
jsmeix commented at 2018-06-29 09:25:¶
@gozora
real Supermen use super ed
a.k.a. sed
:-))
jsmeix commented at 2018-06-29 09:47:¶
@rmetrich
in ancient times real hard men used a puncher chisel and a big
hammer...
http://www.wordinfo.info/words/images/graph-epigraph-Egyptian-Col.gif
jsmeix commented at 2018-07-30 15:47:¶
I think this issue is sufficiently discussed so that I can close it
and the consensus is that it is o.k. to have those comments
but it is not required to have such comments in every file or script.
[Export of Github issue for rear/rear.]