On Mon, 12 Jun 2006, A.J.Mechelynck wrote:

Benji Fisher wrote:
On Sat, Jun 10, 2006 at 03:50:52PM +0200, A.J.Mechelynck wrote:

Marc Weber wrote:

Yakov

How would you implement bash Ctrl-k behaviour ? Delete from cursor till
the end of line?

noremap : q:i

? ;-)

In Normal mode, D (shift-d) deletes from cursor to end-of-line (with a count: on <count> lines including the current one).

See
:help D


     If you want to do the same thing in Insert mode, try

:imap <C-k> <Esc>lC

It is not perfect, since it dumps you into Normal mode if you use it
when you are already at the end of the line.  If you set 'insertmode',
then use CTRL-\ CTRL-N instead of ESC:

:imap <C-k> <C-\><C\N>lC

(This will work whether or not 'insertmode' is set.)

HTH                                     --Benji Fisher



In Insert mode, <C-O>D should do it, and <S-End><Del> may. (The latter may depend on your 'keymodel' setting.) (Ctrl-O works regardless of 'insertmode' and <S-End><Del> doesn't take you out of Insert mode.)

The only (negligible?) downside to <C-o>D is when the insert cursor is
at the end of the line vs. one character before the end of the line.
They both delete the last character (if 'virtualedit' option left as
default).

  "cursor to start/end of line deletion
  nmap <C-S-Del> "_D
  imap <C-S-Del> _<Left><C-o>"_D

See

  :help "_

HTH.
--
Gerald

Reply via email to