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

Re: copy a word without moving cursor

Expand Messages
  • Osho GG
    ... I am already putting this segment in much larger map that does other things on a contents. However, the way I currently do it has a disadvantage that the
    Message 1 of 8 , Oct 1, 2006
    • 0 Attachment
      On 10/1/06, Yakov Lerner <iler.ml@...> wrote:
      > On 10/1/06, Osho GG <oshogg@...> wrote:
      > > Hi All,
      > >
      > > I know this mustbe pretty simple but I can't figure this out. I want
      > > to copy a word into a buffer without moving the cursor. Currently I do
      > > something like
      > >
      > > *"ayw^O:noh<CR>
      > >
      > > to get this effect. But, this seems like such a round about way to do
      > > this. Is there a simpler way to achieve this?
      >
      > Yes :-).
      > The simpler way is to map it to single key :-), like <F2> :-)
      > I'd imagine that typing 11 keys doesn't feel the right
      > typing-to-effect ratio.
      >

      I am already putting this segment in much larger map that does other
      things on "a contents. However, the way I currently do it has a
      disadvantage that the cursor moves and then it moves back and then the
      screen flashes - all for nothing really. "ayaw or "ayiw doesn't work
      for me because it changes cursor position. So, I want a simple way to
      find the word at the current cursor position.

      thanks,
      Osho

      > Yakov
      >
    • Yakov Lerner
      ... map mzlb ayw`z ... 1) Check that your lazyredray option is set. 2) Try to add flag to your mapping Yakov
      Message 2 of 8 , Oct 1, 2006
      • 0 Attachment
        On 10/1/06, Osho GG <oshogg@...> wrote:
        > On 10/1/06, Yakov Lerner <iler.ml@...> wrote:
        > > On 10/1/06, Osho GG <oshogg@...> wrote:
        > > > I know this mustbe pretty simple but I can't figure this out. I want
        > > > to copy a word into a buffer without moving the cursor. Currently I do
        > > > something like
        > > >
        > > > *"ayw^O:noh<CR>
        >
        > I am already putting this segment in much larger map that does other
        > things on "a contents. However, the way I currently do it has a
        > disadvantage that the cursor moves and then it moves back and then the
        > screen flashes - all for nothing really. "ayaw or "ayiw doesn't work
        > for me because it changes cursor position. So, I want a simple way to
        > find the word at the current cursor position.

        map <F5> mzlb"ayw`z

        > screen flashes

        1) Check that your 'lazyredray' option is set.
        2) Try to add flag <silent> to your mapping

        Yakov
      • Charles E Campbell Jr
        ... Its not 100% clear what you want; does ... illustrate something like what you want? Regards, Chip Campbell
        Message 3 of 8 , Oct 2, 2006
        • 0 Attachment
          Osho GG wrote:

          > I am already putting this segment in much larger map that does other
          > things on "a contents. However, the way I currently do it has a
          > disadvantage that the cursor moves and then it moves back and then the
          > screen flashes - all for nothing really. "ayaw or "ayiw doesn't work
          > for me because it changes cursor position. So, I want a simple way to
          > find the word at the current cursor position.

          Its not 100% clear what you want; does
          :echo expand("<cword>")
          illustrate something like what you want?

          Regards,
          Chip Campbell
        • Osho GG
          ... Exactly what I want! Thanks!! Osho
          Message 4 of 8 , Oct 4, 2006
          • 0 Attachment
            On 10/2/06, Charles E Campbell Jr <drchip@...> wrote:
            > Osho GG wrote:
            >
            > > I am already putting this segment in much larger map that does other
            > > things on "a contents. However, the way I currently do it has a
            > > disadvantage that the cursor moves and then it moves back and then the
            > > screen flashes - all for nothing really. "ayaw or "ayiw doesn't work
            > > for me because it changes cursor position. So, I want a simple way to
            > > find the word at the current cursor position.
            >
            > Its not 100% clear what you want; does
            > :echo expand("<cword>")
            > illustrate something like what you want?
            >
            Exactly what I want! Thanks!!

            Osho

            > Regards,
            > Chip Campbell
            >
            >
          • Charles E. Campbell, Jr.
            ... Regards, Chip Campbell
            Message 5 of 8 , Oct 8, 2006
            • 0 Attachment
              Osho GG wrote:

              > Hi All,
              >
              > I know this mustbe pretty simple but I can't figure this out. I want
              > to copy a word into a buffer without moving the cursor. Currently I do
              > something like
              >
              > *"ayw^O:noh<CR>
              >
              > to get this effect. But, this seems like such a round about way to do
              > this. Is there a simpler way to achieve this?


              :let @a= expand("<cword>")

              Regards,
              Chip Campbell
            Your message has been successfully submitted and would be delivered to recipients shortly.