All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Git <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>,
	Emily Shaffer <emilyshaffer@google.com>,
	"Brian M. Carlson" <sandals@crustytoothpaste.net>,
	Aaron Schrab <aaron@schrab.com>,
	Denton Liu <liu.denton@gmail.com>,
	Christian Couder <christian.couder@gmail.com>
Subject: Re: [PATCH v2 1/2] Add project-wide .vimrc configuration
Date: Wed, 9 Dec 2020 19:55:55 -0600	[thread overview]
Message-ID: <CAMP44s19FKYT5LNUxbGZP3czFmhe9t5B-FAfH+V2btNvMNW31g@mail.gmail.com> (raw)
In-Reply-To: <X9EI8c9yeX136ewm@coredump.intra.peff.net>

On Wed, Dec 9, 2020 at 11:27 AM Jeff King <peff@peff.net> wrote:
>
> On Wed, Dec 09, 2020 at 12:55:36AM -0600, Felipe Contreras wrote:
>
> > +augroup git
> > +     au BufRead,BufNewFile */Documentation/*.txt set filetype=asciidoc
> > +
> > +     au FileType c setl noexpandtab tabstop=8 shiftwidth=0 cino=(s,:0,l1,t0
>
> I had to read up on a few of these settings, and I'm still slightly
> puzzled:
>
>   - I generally leave shiftwidth=8, but reading the documentation says
>     that 0 is equivalent to "1 tabstop". So that should be equivalent.

Yes. It is.

If you read the help of tabstop [1] it says there are four main ways
of using tab, and we are using the fourth one: "always set 'tabstop'
and 'shiftwidth' to the same value, and 'noexpandtab'."

Other projects use a different tabstop, and expandtab (mode 2),
however, I have *never* found a use case where it made sense to have a
different shiftwidth than tabstop. And it gets tedious to *always* do
ts=X sw=X, when you can just do sw=0 in your ~/.vimrc, and ts=X per
project.

>   - I've been using "(0" for years for my git work (which indents to
>     align new lines with the unclosed parenthesis). I'm not quite sure
>     what "(s" means. The documentation says "1s" would be "one
>     shiftwidth". Is just "s" the same?

Yes. If you read CodingGuidelines it says there are two schools of
thought when it comes to splitting long logical lines. The first
example is "(s", the second one is "(0".

The reason why I prefer "(s" is that this is more commonly used in the
Linux kernel. However, it's not quite the same in vim (when there's
more than one parenthesis). I've planned to contact vim developers
about that, but I haven't yet. Just for that reason it might make
sense to use "(0" for the project.

>   - I also have ":0", which doesn't indent case labels. Matches our
>     style.
>
>   - I didn't have "l" set myself. I never noticed because it only
>     matters if you open a case with an extra brace, which is relatively
>     rare. For non-vim folks, it is preferring:
>
>         switch (foo) {
>         case 0: {
>                 break;
>         }
>
>     to:
>
>         switch (foo) {
>         case 0: {
>                         break;
>                 }
>
>     which seems consistent with our style. So I think that is worth
>     doing.
>
>   - t0 is specifying not to indent function return types when they
>     appear on a separate line. But our style is not to put those return
>     types on a separate line, anyway. Do we need this?

Right. I recall at some point it was annoying me that types were auto
indented magically at wrong times. Testing "ts" that doesn't seem to
happen anymore, but it also doesn't seem to be working at all.

Do you see some difference from "t0" and "ts" with:

  void
  main(void) { }

Cheers.

[1] https://vimhelp.org/options.txt.html#%27tabstop%27

-- 
Felipe Contreras

  reply	other threads:[~2020-12-10  1:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-09  6:55 [PATCH v2 0/2] vim: configuration and sharness syntax Felipe Contreras
2020-12-09  6:55 ` [PATCH v2 1/2] Add project-wide .vimrc configuration Felipe Contreras
2020-12-09  8:53   ` Christian Brabandt
2020-12-09 10:29     ` Felipe Contreras
2020-12-09 10:45       ` Christian Brabandt
2020-12-09 17:27   ` Jeff King
2020-12-10  1:55     ` Felipe Contreras [this message]
2020-12-10 15:27       ` Jeff King
2020-12-11  0:43         ` Felipe Contreras
2020-12-10  3:50   ` brian m. carlson
2020-12-11  1:08     ` Felipe Contreras
2020-12-11  2:56       ` brian m. carlson
2020-12-11  4:37         ` Felipe Contreras
2020-12-15  1:39         ` Jeff King
2020-12-15  3:03           ` Felipe Contreras
2020-12-15  5:28             ` Jeff King
2020-12-15  6:56               ` Felipe Contreras
2020-12-09  6:55 ` [PATCH v2 2/2] contrib: vim: add sharness syntax file Felipe Contreras
2020-12-09  7:05   ` Eric Sunshine
2020-12-09 10:39     ` Felipe Contreras
2020-12-09 17:11 ` [PATCH v2 0/2] vim: configuration and sharness syntax Jeff King
2020-12-10  3:25   ` Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMP44s19FKYT5LNUxbGZP3czFmhe9t5B-FAfH+V2btNvMNW31g@mail.gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=aaron@schrab.com \
    --cc=christian.couder@gmail.com \
    --cc=emilyshaffer@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=liu.denton@gmail.com \
    --cc=peff@peff.net \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.