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

Re: single and double quotes in a string

Expand Messages
  • Karthick
    ... Also check :help visual-search though what you might be attempting could be different ... I m not sure how you access the contents of the visual
    Message 1 of 3 , Jul 30, 2009
    • 0 Attachment
      On Jul 30, 4:05 pm, "J. Manuel Picaza" <JMPic...@...> wrote:
      > Hello everybody,
      >
      > I am trying to write a function for searching all text marked in a
      > visual block.
      Also check :help visual-search though what you might be attempting
      could be different

      > the problem is when in the visual block there is something like:
      > variable="some text's function"
      > The block contains both " and ' so any attempt to assign the block to
      > a variable fails.
      I'm not sure how you access the contents of the visual selection.. one
      way is to yank it. If you are doing that, you can assign the block to
      a variable by doing:
      :let var=@"

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • J. Manuel Picaza
      ... Thanks a lot! Now I can find any kind of text just selecting with the mouse and pressing // (in the line of yy or dd) The code for it is: snoremap //
      Message 2 of 3 , Jul 31, 2009
      • 0 Attachment
        On Jul 31, 8:07 am, Karthick <karthick.guru...@...> wrote:
        > On Jul 30, 4:05 pm, "J. Manuel Picaza" <JMPic...@...> wrote:> Hello everybody,
        >
        > > I am trying to write a function for searching all text marked in a
        > > visual block.
        >
        > Also check :help visual-search though what you might be attempting
        > could be different
        >
        > > the problem is when in the visual block there is something like:
        > > variable="some text's function"
        > > The block contains both " and ' so any attempt to assign the block to
        > > a variable fails.
        >
        > I'm not sure how you access the contents of the visual selection.. one
        > way is to yank it. If you are doing that, you can assign the block to
        > a variable by doing:
        > :let var=@"

        Thanks a lot!

        Now I can find any kind of text just selecting with the mouse and
        pressing // (in the line of yy or dd)
        The code for it is:
        snoremap // <esc>gvy:let @/=escape(@",'\/$')<cr>
        vnoremap // y:let @/=escape(@",'\/$')<cr>

        """"""""" Before asking here (not fully functional)
        "snoremap // <ESC>gvy:execute ':let @/ = "\\V\\c' . substitute
        (substitute('<C-R>"','\\','\\\\\\\\','g'),'"','\\"','g') . '"'<cr>:set
        hlsearch<cr>
        "vnoremap // <ESC>gvy:execute ':let @/ = "\\V\\c' . substitute
        (substitute('<C-R>"','\\','\\\\\\\\','g'),'"','\\"','g') . '"'<cr>:set
        hlsearch<cr>

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      Your message has been successfully submitted and would be delivered to recipients shortly.