Bug#531647: Vim filters through indent when -cindent and equalprg unset

Bram Moolenaar Bram at Moolenaar.net
Wed Jun 3 09:53:37 UTC 2009

James -

> Using = when Vim was built with -cindent and the user hasn't set
> 'equalprg' filters the text through the external command `indent'.  As
> this behavior isn't documented, it's a surprise to the user and can
> cause the text-to-be-indented to be deleted or replaced with error
> messages from the shell.

This is old Vi behavior, AFAIK.

> The attached patch is a proposed solution which instead emits an error
> telling the user that 'equalprg' needs to be set.  I've added the
> explanation to ='s help as well, with a help tag for the new error
> number.

I don't think changing the behavior is a good idea.  I'll add a comment
at 'equalprg' about what happens when it's empty.  And in change.txt:

={motion}		Filter {motion} lines through the external program
			given with the 'equalprg' option.  When the 'equalprg'
			option is empty (this is the default), use the
			internal formatting function |C-indenting|.  But when
			'indentexpr' is not empty, it will be used instead
			|indent-expression|.  When Vim was compiled without
			internal formatting then the "indent" program is used
			as a last resort.

- Bram

For society, it's probably a good thing that engineers value function over
appearance.  For example, you wouldn't want engineers to build nuclear power
plants that only _look_ like they would keep all the radiation inside.
				(Scott Adams - The Dilbert principle)

 /// Bram Moolenaar -- Bram at Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

More information about the pkg-vim-maintainers mailing list