It is simple.
Open some C/C++ code in vim (after patch 461), then
:set cinoptions=:0(0+2s "this does not really matter, just my settings
:set cindent
:autocmd InsertCharPre * let a = 1
write something like
int a()
{
Now after you insert <CR> '{' must move to the left as you use cindent.
After patch 461 it will stay.
Further, if you use cvim, a closing brace after <CR> will be inserted.
After patch 461 this will look this way:
int a()
{
<CURSOR>
}
<<< MUST BE
int a()
{
<CURSOR>
}
>>>
The problem is that in case if InsertCharPre is defined for '*' it will
always trigger and prevent autoindent of cindent! I am not sure that the
patch that i sent is completely correct: it just fixes the problem for me.
Cheers, Alexey.
2012/5/28 Bram Moolenaar <[email protected]>
>
> Alexey Radkov wrote:
>
> > Recently i updated vim from patch 444 to 515 as official Fedora package
> > update. After that i found that autoindent for {} is brogen. After some
> > research i found that it got broken in patch 461
> >
> > 6734 7.3.461 InsertCharPre event not always triggered
> >
> >
> > This patch, as it says, was introduced for better dealing with
> > InsertCharPre (by the way there is no link to this in :help database!)
> and
> > i made a search inside my plugins. I found the command that breaks the
> > autoindent in plugin RegImap, here it is:
> >
> > autocmd InsertCharPre * let s:useTrigger = 1
> >
> > Very simple, but it breaks autoindent!
> >
> > Here is a patch that fixes the problem for me (against latest vim patch
> > 531):
>
> To be able to understand what you are fixing, how can we reproduce the
> problem? A simple example would be best.
>
> > Probably it can be made better: i did not completely understand details
> of
> > in_cinkeys() and stop_arrow() (which is missed here but present in
> similar
> > checks in other lines).
> >
> > I also included this in attachment.
>
> --
> All good vision statements are created by groups of people with bloated
> bladders who would rather be doing anything else.
> (Scott Adams - The Dilbert principle)
>
> /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net
> \\\
> /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/\\\
> \\\ an exciting new programming language -- http://www.Zimbu.org
> ///
> \\\ help me help AIDS victims -- http://ICCF-Holland.org
> ///
>
--
You received this message from the "vim_dev" 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