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

Re: replacing word with last yanked word?

Expand Messages
  • bps8@daimlerchrysler.com
    Peter Palm To: Steven Dodd cc: vim@vim.org 07/01/2003 05:55 Subject: Re: replacing word
    Message 1 of 7 , Jul 1, 2003
      Peter Palm
      <peterp@...> To: Steven Dodd <Steven.Dodd@...>
      cc: vim@...
      07/01/2003 05:55 Subject: Re: replacing word with last yanked word?
      AM













      >
      > Is is possible to accomplish the following in a simpler way:
      >
      > 1. Delete a word via "dw"
      > 2. Yank a replacement word from some other location by moving there and
      > then doing a "yw"
      > 3. Return to the site of the deleted word and paste the yanked word via
      > "p"
      >
      > Ideally it should work like:
      >
      > 1. Yank a replacement word from some location via "yw"
      > 2. Move to word to replace, then replace it with "?p"

      >What I normally do: cw<C-R>"<ESC>
      >which "changes the word" to the contents of register " (the default
      >copy-paste register) (:help registers)

      The above will not quite work, because the cw replaces the replacement text
      in the " register with the text you were trying to replace. Use the 0
      register instead, which holds the latest copy, and doesn't get replaced by
      a command that deletes text.

      Brett S.

      >Peter
    • Benji Fisher
      ... Try ve (or some variant) to select the word in Visual mode and then p . Alternatively, try ce 0 or de 0p or _dep . ... HTH --Benji
      Message 2 of 7 , Jul 1, 2003
        Steven Dodd wrote:
        > Is is possible to accomplish the following in a simpler way:
        >
        > 1. Delete a word via "dw"
        > 2. Yank a replacement word from some other location by moving there and
        > then doing a "yw"
        > 3. Return to the site of the deleted word and paste the yanked word via
        > "p"
        >
        > Ideally it should work like:
        >
        > 1. Yank a replacement word from some location via "yw"
        > 2. Move to word to replace, then replace it with "?p"

        Try "ve" (or some variant) to select the word in Visual mode and then "p".
        Alternatively, try "ce<C-R>0<Esc>" or 'de"0p' or '"_dep' .

        :help v_p
        :help registers

        HTH --Benji Fisher
      Your message has been successfully submitted and would be delivered to recipients shortly.