Tuesday, September 23, 2014

Re: How to force Vim to reconcider abbreviations?

On Mon, 22 Sep 2014 10:37:20 -0700 (PDT)
Ben Fritz <fritzophrenic@gmail.com> wrote:

> On Monday, September 22, 2014 11:11:37 AM UTC-5, gevisz wrote:
> > On Mon, 22 Sep 2014 19:05:59 +0300
> >
> > Gevisz <gevisz@gmail.com> wrote:
> >
> >
> >
> > > So, it would be nice to have a short key mapping,
> >
> > > for example with <F4>, that would force Vim to
> >
> > > reconsider just typed abbreviation and expand it
> >
> > > even it was typed in the last session.
> >
> >
> >
> > A small correction:
> >
> >
> >
> > it would be nice to have a short key mapping,
> >
> > for example with <F4>, that would force Vim to
> >
> > reconsider the abbreviation just before the cursor
> >
> > and expand it even it was typed in the last session.
>
> I was actually quite surprised to find that abbreviations don't work
> if you wait 'updatetime' milliseconds between starting and ending the
> abbreviation, triggering the CursorHoldI event. That could be due to
> specific events firing, I don't really know, but it is not documented
> anywhere I could find.
>
> This mapping seems to do what you want, as a workaround:
>
> inoremap <F4> <C-C>ciW<C-R>-<C-]>
>
> <C-C> is used to end insert mode without triggering events or
> abbreviations, ciW then deletes the unexpanded abbreviation and
> enters insert mode, <C-R>- inserts that deleted text, and then <C-]>
> expands the abbreviation.

Sorry but your suggestion does not work as <C-R> does not insert the
deleted text back. Moreover, my variation on your suggestion, namely
<C-C>"uciW<Esc>"upa<C-]>
does not work as well, as <C-]> do not want to expand the pasted text.

Any other suggestions?

Generally, I am very much frustrated with my abbreviation experience
in Vim because in addition to the problem just described above, some
abbreviation do not want to expand at all and I cannot see any reason
for that. (I have described that problem in another thread.)

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