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

134570Mappings, no idea how to use.

Expand Messages
  • stosss
    Nov 17, 2012
    • 0 Attachment
      Greetings,

      This is one of my rear occasions to ask a question. I don't have any
      idea what to search for to try to figure it out.

      I did not create this. I have no idea how this works or what key
      strokes trigger it. Can someone help me understand how to use it? It
      looks like there are two or three mappings below. Does it go in the
      .vimrc or somewhere else?

      " Search for selected text, forwards or backwards.
      vnoremap <silent> * :<C-U>
      \let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR>
      \gvy/<C-R><C-R>=substitute(
      \escape(@", '/\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR>
      \gV:call setreg('"', old_reg, old_regtype)<CR>
      vnoremap <silent> # :<C-U>
      \let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR>
      \gvy?<C-R><C-R>=substitute(
      \escape(@", '?\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR>
      \gV:call setreg('"', old_reg, old_regtype)<CR>

      " Convert curly quotes to straight.
      " Any argument causes substitute to confirm changes.
      function! ToStraight(line1, line2, args)
      let flags = 'eg'
      let range = a:line1 . ',' . a:line2
      if empty(a:args)
      let range = 'silent ' . range
      else
      let flags .= 'c'
      endif
      let search = @/
      exe range . "s/['']/'/" . flags
      exe range . 's/[""]/"/' . flags
      nohl
      let @/ = search
      endfunction
      command! -nargs=? -range ToStraight call ToStraight(<line1>, <line2>, '<args>')

      Thanks for the help,
      Jack

      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 2 messages in this topic