Re: Searching for selected text
Bram Moolenaar wrote: Matt Mzyzik wrote: I don't like this one more, but it's a good alternative: g/ g? Also, I feel that one day "&" might do something in visual; at least visual line mode. "g?" is already used for rot13 encoding. "g/" is scheduled to be used to search inside the selected area Hmm -- g/ sounds a lot like vis.vim's :S command for searching a visual block for a pattern. It works with V, v, and ctrl-v type visual blocks. Regards, Chip Campbell
Re: Searching for selected text
Yakov Lerner wrote: > On 9/30/06, Bram Moolenaar <[EMAIL PROTECTED]> wrote: > > > > Sometimes people ask me for a command to search for the text that is > > currently visually selected. You could add a mapping for the '/' key, > > but then you lose the possibility to extend the visual area by > > searching for a pattern. > > > > Since we might need more commands in Visual mode later, and we only have > > a few keys left to be used, we need to use two key combinations for > > new commands in Visual mode. > > > > I think we can start using the '&' key. Currently it doesn't do > > anything. For now we could add the commands: > > > > &/ search for the Visually selected text forward > > &? same, backward > > Do Ctrl-K/ Ctrl-K? do something in visual mode ? No, but CTRL-K is also unused in Normal mode. Thus it's better used for something that works both in Visual and Normal mode. -- Back off man, I'm a scientist. -- Peter, Ghostbusters /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\download, build and distribute -- http://www.A-A-P.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org///
Re: Searching for selected text
Tony Mechelynck wrote: > Bram Moolenaar wrote: > > Sometimes people ask me for a command to search for the text that is > > currently visually selected. You could add a mapping for the '/' key, > > but then you lose the possibility to extend the visual area by > > searching for a pattern. > > > > Since we might need more commands in Visual mode later, and we only have > > a few keys left to be used, we need to use two key combinations for > > new commands in Visual mode. > > > > I think we can start using the '&' key. Currently it doesn't do > > anything. For now we could add the commands: > > > > &/ search for the Visually selected text forward > > &? same, backward > > > > Is there a good alternative? > > > > & does do something, but maybe we can do without that, since ":s//~/" > does the same (repeat last substitute without the flags) -- it needs > six keystrokes instead of one though. "&" currently only does something in Normal mode, not in Visual mode. -- BEDEVERE:And what do you burn, apart from witches? FOURTH VILLAGER: ... Wood? BEDEVERE:So why do witches burn? SECOND VILLAGER: (pianissimo) ... Because they're made of wood...? "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\download, build and distribute -- http://www.A-A-P.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org///
Re: Searching for selected text
On 9/30/06, Bram Moolenaar <[EMAIL PROTECTED]> wrote: Sometimes people ask me for a command to search for the text that is currently visually selected. You could add a mapping for the '/' key, but then you lose the possibility to extend the visual area by searching for a pattern. Since we might need more commands in Visual mode later, and we only have a few keys left to be used, we need to use two key combinations for new commands in Visual mode. I think we can start using the '&' key. Currently it doesn't do anything. For now we could add the commands: &/ search for the Visually selected text forward &? same, backward Do Ctrl-K/ Ctrl-K? do something in visual mode ? Yakov
Re: Searching for selected text
Bram Moolenaar wrote: Sometimes people ask me for a command to search for the text that is currently visually selected. You could add a mapping for the '/' key, but then you lose the possibility to extend the visual area by searching for a pattern. Since we might need more commands in Visual mode later, and we only have a few keys left to be used, we need to use two key combinations for new commands in Visual mode. I think we can start using the '&' key. Currently it doesn't do anything. For now we could add the commands: &/ search for the Visually selected text forward &? same, backward Is there a good alternative? & does do something, but maybe we can do without that, since ":s//~/" does the same (repeat last substitute without the flags) -- it needs six keystrokes instead of one though. Best regards, Tony.
Re: Searching for selected text
Yakov Lerner wrote: > On 9/30/06, Bram Moolenaar <[EMAIL PROTECTED]> wrote: > > > > Sometimes people ask me for a command to search for the text that is > > currently visually selected. You could add a mapping for the '/' key, > > but then you lose the possibility to extend the visual area by > > searching for a pattern. > > > > Since we might need more commands in Visual mode later, and we only have > > a few keys left to be used, we need to use two key combinations for > > new commands in Visual mode. > > > > I think we can start using the '&' key. Currently it doesn't do > > anything. For now we could add the commands: > > > > &/ search for the Visually selected text forward > > &? same, backward > > > > Do you plan to treat visual selection as pattern, or a literal text-to > search ? Literal text would be most useful. For a pattern I would expect it to be more useful to copy it from one file (e.g., help text or a Vim scrip) and search for it in another file. -- CRONE: Who sent you? ARTHUR: The Knights Who Say GNU! CRONE: Aaaagh! (she looks around in rear) No! We have no licenses here. "Monty Python and the Holy editor wars" PYTHON (MONTY) SOFTWARE LTD /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\download, build and distribute -- http://www.A-A-P.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org///
Re: Searching for selected text
On 9/30/06, Bram Moolenaar <[EMAIL PROTECTED]> wrote: Sometimes people ask me for a command to search for the text that is currently visually selected. You could add a mapping for the '/' key, but then you lose the possibility to extend the visual area by searching for a pattern. Since we might need more commands in Visual mode later, and we only have a few keys left to be used, we need to use two key combinations for new commands in Visual mode. I think we can start using the '&' key. Currently it doesn't do anything. For now we could add the commands: &/ search for the Visually selected text forward &? same, backward Do you plan to treat visual selection as pattern, or a literal text-to search ? Yakov
Re: Searching for selected text
On 9/30/06, Georg Dahn <[EMAIL PROTECTED]> scribbled: Hi! Bram Moolenaar wrote: > &/ search for the Visually selected text forward > &? same, backward > > Is there a good alternative? I think, this is ok. For the moment I have the following lines ... vnoremap * VisualSearch('*') vnoremap # VisualSearch('#') I also use 'vmap * ...' and 'vmap # ...' to search for text that is visual selection.In my mapping, all special chars in visual selection are quoted to make them literal. I think there can be two variants for search for visual selection: 1) treat visual selection as pattern 2) treat visual selection as literal text Yakov
Re: Searching for selected text
On 9/30/06, Bram Moolenaar <[EMAIL PROTECTED]> wrote: "g/" is scheduled to be used to search inside the selected area Hehe, I was just about to ask if such a command wouldn't be useful :-) nikolai
Re: Searching for selected text
Matt Mzyzik wrote: > I don't like this one more, but it's a good alternative: > g/ > g? > > Also, I feel that one day "&" might do something in visual; at least > visual line mode. "g?" is already used for rot13 encoding. "g/" is scheduled to be used to search inside the selected area -- Eye have a spelling checker, it came with my PC; It plainly marks four my revue mistakes I cannot sea. I've run this poem threw it, I'm sure your please to no, It's letter perfect in it's weigh, my checker tolled me sew! /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\download, build and distribute -- http://www.A-A-P.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org///
Re: Searching for selected text
I don't like this one more, but it's a good alternative: g/ g? Also, I feel that one day "&" might do something in visual; at least visual line mode. --Matt On Sat, Sep 30, 2006 at 01:37:59PM +0200, Bram Moolenaar wrote: > > Sometimes people ask me for a command to search for the text that is > currently visually selected. You could add a mapping for the '/' key, > but then you lose the possibility to extend the visual area by > searching for a pattern. > > Since we might need more commands in Visual mode later, and we only have > a few keys left to be used, we need to use two key combinations for > new commands in Visual mode. > > I think we can start using the '&' key. Currently it doesn't do > anything. For now we could add the commands: > > &/ search for the Visually selected text forward > &? same, backward > > Is there a good alternative? > > -- > Any resemblance between the above views and those of my employer, my terminal, > or the view out my window are purely coincidental. Any resemblance between > the above and my own views is non-deterministic. The question of the > existence of views in the absence of anyone to hold them is left as an > exercise for the reader. The question of the existence of the reader is left > as an exercise for the second god coefficient. (A discussion of > non-orthogonal, non-integral polytheism is beyond the scope of this article.) > (Ralph Jennings) > > /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ > ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ > \\\download, build and distribute -- http://www.A-A-P.org/// > \\\help me help AIDS victims -- http://ICCF-Holland.org///
Re: Searching for selected text
Hi! Bram Moolenaar wrote: &/ search for the Visually selected text forward &? same, backward Is there a good alternative? I think, this is ok. For the moment I have the following lines in my vimrc file (I found the original code in a vim tip): --- 8< --- " Search in Visual and Selection modes with '*' and '#' function MakeSearchString(str) return substitute(escape(@", '\\/.*$^~[]'), '\n', '\\n', 'g') endfunction function! VisualSearch(direction) if a:direction == '#' let l:rhs = "y?" else let l:rhs = "y/" endif let l:rhs = l:rhs . "^RMakeSearchString(@\")^M^MgV" return l:rhs endfunction vnoremap * VisualSearch('*') vnoremap # VisualSearch('#') --- 8< --- (The ^R and ^M are special chars) This does the job for me and I think, that these mappings are rather consistent with the rest of Vim, since they just expand the behavior of * and #. What exactly do you plan? Which new features shall we expect? Best wishes, Georg ___ Copy addresses and emails from any email account to Yahoo! Mail - quick, easy and free. http://uk.docs.yahoo.com/trueswitch2.html
Searching for selected text
Sometimes people ask me for a command to search for the text that is currently visually selected. You could add a mapping for the '/' key, but then you lose the possibility to extend the visual area by searching for a pattern. Since we might need more commands in Visual mode later, and we only have a few keys left to be used, we need to use two key combinations for new commands in Visual mode. I think we can start using the '&' key. Currently it doesn't do anything. For now we could add the commands: &/ search for the Visually selected text forward &? same, backward Is there a good alternative? -- Any resemblance between the above views and those of my employer, my terminal, or the view out my window are purely coincidental. Any resemblance between the above and my own views is non-deterministic. The question of the existence of views in the absence of anyone to hold them is left as an exercise for the reader. The question of the existence of the reader is left as an exercise for the second god coefficient. (A discussion of non-orthogonal, non-integral polytheism is beyond the scope of this article.) (Ralph Jennings) /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net \\\ ///sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\download, build and distribute -- http://www.A-A-P.org/// \\\help me help AIDS victims -- http://ICCF-Holland.org///