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

27220Re: how to repl. word under the cursor with foowordbar?

Expand Messages
  • Thomas Köhler
    Apr 2 7:49 AM
    • 0 Attachment
      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?

      yiwi\texttt{<ESC>ea}<ESC>

      (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
      mode
      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>

      Ciao,
      Thomas

      --
      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