Default modeline

Martin Krischik krischik at macports.org
Mon Feb 23 05:20:45 PST 2009


Rainer Müller schrieb:
> Martin Krischik wrote:
>> Am 01.02.2009 um 22:34 schrieb Ryan Schmidt:
> [...]
>>>> +############################################################ {{{1  
>>>> ###########
>>>> +# vim: set nowrap tabstop=4 shiftwidth=4 softtabstop=4 noexpandtab :
>>>> +# vim: set textwidth=0 filetype=tcl foldmethod=marker nospell :
>>> We already have the modeline in the first line of the portfile. If  
>>> these lines are adding things that we don't have in the modeline,  
>>> what are they and would they be useful to consider adding to our  
>>> recommended modeline?
>> First and foremost they use the full names of the settings instead of
>> abbreviations. So lets compare:
>>
>> 1)	fenc=utf-8	fileencoding
>> 2)	ft=tcl		filetype
>> 3)	et		expandtab
>> 4)	sw=4		shiftwidth
>> 5)	ts=4		tabstop
>> 6)	sts=4		softtabstop
>>
>> No. 3 and 5 contradict each other - if tabs are expanded to spaces you
>> don't need to set the physical tab stops. My Suggestion is tabstop=8
>> noexpandtab - most terminals set the tabstop to 8.

> I agree. Usually when using vim tabstop should not be changed, only
> shiftwidth. I am not sure if using softtabstop is "compatible" with
> other editors. Most other editors are not able to make a difference
> between tabs at indentation level and somewhere else in the file. This
> could be the reason why our default modeline is changing tabstop.

Out of the top of my head: Vim can do it, Emacs can do it, IBMs LXPM can
do it, the Microsofts Programmers-Workbench can do it. Most editors I
have used over time could distinguish between softtabstops (what happens
when you press TAB) and hardtabstops (what happens when you save the file).

>> I also have foldmethod=marker which might be helpful for very large
>> Portfiles - you can then fold parts of the source with {{{ and }}}.
> 
> Useless if not also using foldenable. I would leave this for everyone to
> add in their .vim/filetype.vim. Some people do not like folding.

foldmakers won't activate foldenable - it only tells which fold method
the author used inside the file. Note that I don't set foldenable itself.

> For example:
>   au BufRead,BufNewFile Portfile setlocal foldenable foldmethod=marker

That suggest that you think that marker is the only possible options an
no one will ever create syntax or expression folding for tcl?

>> textwidth=0 is actually wrong - better would be textwidth=78 - one can
>> then format comments with the "gq" command.
> 
> I have that set for all text/code files anyway. I don't think we should
> enforce a specific textwidth for Portfiles. For example commands in
> destroot phases or variant lines with descriptions are often longer than
> 80 characters.

True, in addition to "gq" you also get unwanted new lines. And with
Portfile you do need long lines most of the time.

Martin
-- 
Martin Krischik
krischik at users.sourceforge.net


More information about the macports-dev mailing list