Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Mappings, no idea how to use.
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
stosss  
View profile  
 More options Nov 17 2012, 11:33 pm
From: stosss <sto...@gmail.com>
Date: Sat, 17 Nov 2012 23:33:37 -0500
Local: Sat, Nov 17 2012 11:33 pm
Subject: Mappings, no idea how to use.
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Beckett  
View profile  
 More options Nov 18 2012, 12:09 am
From: "John Beckett" <johnb.beck...@gmail.com>
Date: Sun, 18 Nov 2012 16:09:42 +1100
Local: Sun, Nov 18 2012 12:09 am
Subject: RE: Mappings, no idea how to use.

stosss wrote:
> 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?

The first extract you posted comes from:
http://vim.wikia.com/wiki/Search_for_visually_selected_text

which was mentioned along with your second extract here:
http://groups.google.com/group/vim_use/browse_thread/thread/6f7b894aa...

In the latter, I mentioned that the code is from my vimrc, and
included some usage examples.

John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »