Yakov Lerner schrieb:
On 2/20/07, Tim Chase <[EMAIL PROTECTED]> wrote:
I'm trying to find a good way to remap control+U in insert-mode
so that it begins an undo-block. There are times when type
control+U in insert-mode and it doesn't do what I intend, or I
want to undo it, only to find that an "u"ndo doesn't solve the
problem. I know that transitioning out of insert-mode (via <esc>
or <c-o>) will mark a point in the undo-stack. However, I don't
really want to be in insert mode. I've tried the following:
inoremap <c-u> <c-o><esc><c-u>
This does a funky beep/flash (depending on VB settings) and
doesn't behave quite like I would have expected it to.
inoremap <c-u> <c-o><nop><c-u>
This gives me a crazy
"E486: Pattern not found: insert"
which, I haven't searched for the word "insert" so this one makes
me scratch my head. Bug perhaps? Vim-internals showing through?
Have I overlooked some setting that I couldn't find in undo.txt?
Or does anyone else have a good suggestion on how to tag a
control+U in insert-mode so that it alone can be undone?
Hello Tim,
I am not sure I understand you right, but do you mean somthing like
<c-g>u in insert mode ? (:help i_CTRL-G_u):
:imap <c-u> <c-g>u
?
:help i_CTRL-G_u
CTRL-G u>.......break undo sequence, start new change>.. *i_CTRL-G_u*
Yakov
There is another strange detail about <c-g>u
In my vimrc I have (for gVim 6.4, gVim 7.0)
:imap <cr> <cr><c-g>u
Each "u" goes back one line of text in the undo history.
Note the "imap" instead of "inoremap". This way
abbreviations still work.
For the strange part: This mapping does not result
in an endless loop! I don't know why ... just found
out by trial and error, could someone explain this?
Andy
--
EOF
___________________________________________________________
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de