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

27222RE: how to repl. word under the cursor with foowordbar?

Expand Messages
  • HALIM,SALMAN (HP-NewJersey,ex2)
    Apr 2, 2002
    • 0 Attachment
      perhaps i'm missing something, but why mess up the yank register by hitting
      yiw? why not just use 'b'? (is it because the cursor might be at the first
      character of the word?)

      i think the 'viw' version is:

      viwo<esc> or <c-v>iwo<esc>

      (character-wise or block-wise; either one works.)


      -----Original Message-----
      From: Thomas Köhler [mailto:jean-luc@...]
      Sent: Tuesday, April 02, 2002 10:49 AM
      To: vim@...
      Subject: Re: how to repl. word under the cursor with foowordbar?

      M K Saravanan wrote [020402 17:36]:
      > hi,
      > How to replace a word under the cursor (say: junk) with another
      > foojunkbar? when i am reading a paragraph, some of the word i
      > want to change as \texttt{word}. i.e. the word under the
      > cursor should come inside { }. how to do that in vim?


      (which you might want to map on a shorter key).

      yiw yank inner word. This puts the cursor
      on the first character in the word,
      that's why I use this little trick. If
      you don't want to fiddle around with
      the unnamed register, use some funny
      viw game instead...
      i\texttt{<ESC> insert \texttt{ and get back to normal
      e go to end of word
      a}<ESC> append } and go back to normal mode.

      Now map it to a key, say F2:
      :nmap <F2> yiwi\texttt{<ESC>ea}<ESC>


      Thomas Köhler Email: jean-luc@... | LCARS - Linux
      <>< WWW: http://jeanluc-picard.de | for Computers
      IRC: jeanluc | on All Real
      PGP public key available from Homepage! | Starships
    • Show all 6 messages in this topic