Am 24.05.2011 18:19, schrieb Daniel Fishman:
Hello,
In documentation about insert mode (':he insert.txt') there is a following
example:
---------------------------------------------
An example for using CTRL-G u:
:inoremap<C-H> <C-G>u<C-H>
This redefines the backspace key to start a new undo sequence. You can now
undo the effect of the backspace key, without changing what you typed before
that, with CTRL-O u.
---------------------------------------------
When I tested this example, I didn't get the expected behaviour - the result
was as though backspace wasn't redefined. The example started working only
when I defined the mapping as follows:
':inoremap<BS> <C-G>u<BS>'
Also, according to the documentation (':he keycodes'), I expected that
typing ':<ctrl-k><ctrl-h>' will result in string'<BS>' written on the
command line, similarly to ':<ctrl-k><ctrl-@>', which results in string
'<Nul>' written on the command line (I should note that in the last case
most of the keys don't work as I expected, for example ':<ctrl-k><ctrl-[>'
doesn't write the string '<Esc>' etc.).
I see that<ctrl-h> is equivalent to backspace in the sense that in insert
mode<ctrl-h> deletes character before the cursor, similarly to the
backspace.
Why in the cases above I don't get the expected behaviour?
<C-G>u starts a new change and with 'backspace' option left at the default,
you cannot backspace of the start of the change.
try
:h 'bs
you can insert a literal <C-H> with <C-V><C-H>
--
Andy
--
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