Hi,

It may happen that something (possibly quite long) inserted by IMAP was
not desired. Either because one mistyped or because the LHS pattern
was supposed to stay as is. In the second case one could avoid this by
typing the characters in a way that does not trigger IMAP. But this is quite
inconvenient.
So one could think, just doing <Esc>ua would do the trick. But no, this
often undoes a lot of previously written text and is thus not usable.
The only other solution is to manually delete all the insertions from
IMAP and try again.
Because of this annoying behaviour, some people even disable IMAP
completely, although I feel it is a vital part of vim-latex and is
really helpful especially for those longer replacement texts.

So in order to circumvent the described problem, I modified the
imaps.vim script and inserted an undo point "^Gu" before doing any IMAP
replacements. I'm not sure whether this is the best way to do it or if
the insert of a:char could make new problems with abbreviations. But
please take a look at the appended patch.

Also just fyi, I'm using the following, to make undoing easily possible
in input mode:

imap <Undo> <Esc>ua

best regards,
Bodo

PS:
is there a reason, that the following patch is not applied?

https://sourceforge.net/tracker/?func=detail&aid=3057689&group_id=52322&atid=466458
--- imaps.vim	2012-07-15 09:18:47.279926002 +0200
+++ imaps.vim.new	2012-07-15 09:18:56.151926001 +0200
@@ -285,7 +285,7 @@
 	" enough back-spaces to erase the left-hand side; -1 for the last
 	" character typed:
 	let bs = substitute(strpart(lhs, 1), ".", "\<bs>", "g")
-	return bs . IMAP_PutTextWithMovement(rhs, phs, phe)
+	return a:char . "u\<bs>" . bs . IMAP_PutTextWithMovement(rhs, phs, phe)
 endfunction
 
 " }}}

Attachment: signature.asc
Description: PGP signature

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Vim-latex-devel mailing list
Vim-latex-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vim-latex-devel

Reply via email to