Wireshark-dev: Re: [Wireshark-dev] "consistent" indentation and tabstop=8

From: Bill Meier <wmeier@xxxxxxxxxxx>
Date: Wed, 28 Apr 2010 22:57:25 -0400
Bill Meier wrote:
Jakub Zawadzki wrote:
Hi,

Why there's tabstop=8, but file is indented with 2 spaces?
How should <tab> key works in these files?

If you want to mark that \t in files are bad, let at least set
softtabstop=2 to make using <tab> sane.


Without starting any new discussion, my only intent is that any tabs in a Wireshark source file are always displayed as going to a column position of 9, 17, ... (where the left-most column is numbered as 1).

In any case, there are at least 25 or 30 other Wireshark files (besides those I changed) with ex/vi modelines which have shiftwidth different than tabstop.

I presume those ex/vi modelines should also have tabstop the same as shiftwidth to allow the use of a <tab key> in ex/vi/vim to cause an indentation equivalent to shiftwidth (whether or not a <tab character> is actually inserted in the file).

(I'm not really that familiar with the ex/vi/vim editors. Is a modeline prefixed by ex: also used by vi ??)



Actually: let me ask a much simpler question:

Do the ex/vi/vim modelines as typically used in Wireshark even work ?

AFAIKT (after trying vim on two different Linix systems and reading the vi/vim documentation about modelines) they *don't* !!

(Am I missing something ??)


Wireshark typical:

/*
 * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
 *
 * Local variables:
 * c-basic-offset: 4
 * tab-width: 8
 * indent-tabs-mode: nil
 * End:
 *
 * vi: set shiftwidth=4 tabstop=8 expandtab
 * :indentSize=4:tabSize=8:noTabs=true:
 */

After reading the vi/vim documentation about modelines and doing some tests using vim on two different Linux systems (Fedora & Ubuntu) it appears that the ex/vi/vim modeline above must be changed to either of the following to actually work:

 * vi: shiftwidth=4 tabstop=8 expandtab           (note 'set ' removed)
 * vi: set shiftwidth=4 tabstop=8 expandtab:      (note trailing ':' )


So: does the ex/vi/vim modeline generated by http://www.wireshark.org/tools/modelines.html
actually work for some vim version on some OS ?

or: if as used in Wireshark, they don't really work, I'm not going spend any energy on them at this point.