Wednesday, March 18, 2015

Re: The trailing '}' of a bash function with '|' in the line following '\' can not be indented correctly.

On 18.03.15 23:18, Peng Yu wrote:
> Hi, The '}' of function f can not be indented correctly to the
> beginning of the line. Is there a quick way to fix this? Thanks.
>
> function f {
> command1 \
> | command2 \
> | command3
> }

Looking at ":h cinoptions-values" and seeing:

*cino-}*
}N Place closing braces N characters from the matching opening
brace. (default 0).

I'd guess it'd end up in column 1 if the opening brace were also there.
If the opening brace were always in e.g. column 32, then using }-31
in cinoptions might work. (No, that's not entirely practical, though.)

You may be able to more fully customise after reading up on
:h indent-expression
I haven't had a strong enough reason to invest the time yet.

I'd test a bit here, but my vim, even when editing an xxx.c file, and
with

:set noai
:set cindent

shows

:set cinoptions?
cinoptions=

What's worse is:

:verbose set cinoptions?
cinoptions=

I.e. Nothing has meddled with it - that's the default here.
I'll have to fix that before wading into the next C file.

Erik

--
The world is spending half a trillion dollars on fossil fuel subsidies every
year, according to a new report. The Overseas Development Institute (ODI) says
rich countries are spending seven times more supporting coal, oil and gas than
they are on helping poorer nations fight climate change.
- http://www.bbc.co.uk/news/science-environment-24833153

--
--
You received this message from the "vim_use" 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_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: