vile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vile] searching for register contents


From: Wayne Cuddy
Subject: Re: [vile] searching for register contents
Date: Wed, 3 Jul 2013 23:14:35 -0400
User-agent: Mutt/1.4.2.3i

On Wed, Jul 03, 2013 at 09:14:31PM -0400, Thomas Dickey wrote:
> On Wed, Jul 03, 2013 at 05:01:34PM -0400, Wayne Cuddy wrote:
> > On Thu, Jun 27, 2013 at 08:40:21PM -0400, Thomas Dickey wrote:
> > > On Thu, Jun 27, 2013 at 03:47:57PM -0400, Wayne Cuddy wrote:
> > > > If I yank a word (or words) into a register is there a way to search
> > > > the current buffer for that registers contents?
> > > 
> > > hmm.  That puts the content into the unnamed buffer as well as 
> > > kill-buffer-1.
> > > The $kill variable gets part of that (I recall as the first chunk, which
> > > should be enough for word/words), so you could assign that to $search,
> > > and use it - provided there are no metacharacters.
> > >
> > 
> > So how do I set $search to $kill?
> > 
> > The following sequence
> > 
> > set-variable $search $kill
> 
> This seems to work as I would expect (putting it in a file and source'ing it):
> 
> setv $search=$kill
> show-register
> show-variables
> 
> ...which should work in a macro.  If using the : prompt, then there is no 
> substitution
> performed.
>  
> > assigned the literal string $kill to search and not the content of
> > the variable. Is this something I need to use a procedure along with
> > the &cat command in order to achieve?
> 
> -- 
> Thomas E. Dickey <address@hidden>
> http://invisible-island.net
> ftp://invisible-island.net

Ok, looks like I should have tried writing that to a file before mailing
the list. This is close to what I'm after, but I need to shift between
several searches. What I want is to load registers a, b and c with 3
different strings and then be able to switch between searches.

Uh... turns out all I needed was a procedure to load $search from the
named register:

store-procedure Find-Register string='Register'
    setv $search &register $1
~endm

Now what would icing on the cake would be a function that could either
escape the meta-characters in the search string or if there existed
something like literal-search-forward that would treat the search
pattern as a string instead of a regexp.

But I'm good for now :)

Very handy... Thanks for the tips Thomas.

Wayne



reply via email to

[Prev in Thread] Current Thread [Next in Thread]