Loading ...
Sorry, an error occurred while loading the content.

Re: Delete word under cursor in insert mode

Expand Messages
  • Adam 'Vonlia' Seyfarth
    ... Look before you leap :-) Try this: imap hx it will move the cursor left, then insert an x. That isn t what I want, I want to delete the char to
    Message 1 of 12 , Aug 31, 2001
    • 0 Attachment
      On Fri, 31 Aug 2001, Bohdan Vlasyuk wrote:

      > On Fri, Aug 31, 2001 at 12:53:33PM -0500, Adam 'Vonlia' Seyfarth wrote:
      >
      > >>> ---that won't work, it needs the <Esc>tx treatment.
      > >> I don't undertand how <Esc>tx is supposed to work...
      > > Sorry, typo, I meant "t<Esc>x". That puts the cursor in normal mode
      > > on the char the cursor was on in insert mode.
      > same does <C-O>..

      Look before you leap :-) Try this:

      imap <BS> <C-O>hx

      it will move the cursor left, then insert an x. That isn't what I want,
      I want to delete the char to the left. Which is two normal mode
      commands. So, if I were to do it in normal mode, I would have to stay
      in normal mode after the first command.

      > I still don't understand what you want to win with <esc>, considering
      > that it behaves differently at the beginnig of the line.
      (it isn't a battle, just a discussion :-)

      <Esc>, by itself, will behave differently at beginning of line. That is
      the problem I was fixing in the first place. That is why I would do
      this:

      imap <BS> t<Esc>xhx
      " ===================
      " t temperary. so we are NOT at beginning of line
      " <Esc> to normal mode, on the 't'
      " x delete the 't' we just put
      " hx delete char to left

      ---it behaves same for any position of line, except for this example is
      bad, it needs an 'h' which does behave differently on beginning of line,
      but the "t<Esc>x" should work.


      --
      Hunter with gun: ``I love animals. That's why I love to kill
      them.''
      -- Monty Python::sketch

      /|| Adam Seyfarth <http://members.home.net/adam.seyfarth/> ||\
      /«|| <mailto:cloud@...> Geekcode, version 3.12 ||»\
      \«|| GU d-- s+: a---- C++ UL+>++ P-- L++ E-- W++ N++ o K- w-- ||»/
      \|| O M- V- PE- Y PGP- t 5 X R tv+ b+ DI+ D+ G e-- h! !r !y+ ||/
    • Bohdan Vlasyuk
      ... You may consider using :normal hx ... that is the problem that solves. If you still beliebe method is better, well, i have nothing
      Message 2 of 12 , Sep 3, 2001
      • 0 Attachment
        On Fri, Aug 31, 2001 at 04:55:53PM -0500, Adam 'Vonlia' Seyfarth wrote:

        > > same does <C-O>..
        > Look before you leap :-) Try this:
        > imap <BS> <C-O>hx
        You may consider using <C-o>:normal hx<cr>


        >> I still don't understand what you want to win with <esc>,
        >> considering that it behaves differently at the beginnig of the
        >> line.
        > <Esc>, by itself, will behave differently at beginning of line.
        > That is the problem I was fixing in the first place.
        that is the problem that <C-o> solves. If you still beliebe <esc>
        method is better, well, i have nothing else to say.


        --
        Life's too short to dance with ugly women.
      Your message has been successfully submitted and would be delivered to recipients shortly.