Thursday, October 2, 2014

Re: Is there an opposite to i_CTRL-] ? [Was: How to force Vim to reconcider abbreviations?]

On Do, 02 Okt 2014, Ben Fritz wrote:

> On Thursday, October 2, 2014 5:21:37 AM UTC-5, Erik Christiansen wrote:
> > On 22.09.14 20:00, Christian Brabandt wrote:
> >
> > > Sounds like you are looking for Ctrl-] (:h i_CTRL-])
> >
> >
> > Unfortunately, CTRL-[ is not it, since that merely replicates <Esc>.
> >
>
> The suggestion was CTRL-] NOT CTRL-[. See :help i_CTRL-]

But Erik asked for something like to undo the abbreviation. To the best
of my knowledge there is not (and there is even a todo list entry :h
todo and search for abbreviation).

Perhaps it would be enough to simply drop an undo point, before
expanding an abbreviation in insert mode? Something like this patch
perhaps?

diff --git a/src/getchar.c b/src/getchar.c
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -4574,6 +4574,11 @@ check_abbr(c, ptr, col, mincol)
/* insert the last typed char */
(void)ins_typebuf(tb, 1, 0, TRUE, mp->m_silent);
}
+ if (State & INSERT)
+ {
+ u_sync(TRUE);
+ u_save(0, curbuf->b_ml.ml_line_count+1);
+ }
#ifdef FEAT_EVAL
if (mp->m_expr)
s = eval_map_expr(mp->m_str, c);


Best,
Christian
--
KNORR - Fressen mit Frust und Hiebe!

--
--
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: