vile
[Top][All Lists]
Advanced

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

Re: [vile] under-cursor


From: Thomas Dickey
Subject: Re: [vile] under-cursor
Date: Thu, 21 Mar 2013 19:08:52 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

On Thu, Mar 21, 2013 at 04:16:46PM -0400, Wayne Cuddy wrote:
> What defines the word delimiters for the under-cursor functions. I ask
> because sometimes I have functions named like so
> my_namespace::my_function and I'd like to set the search string to that
> string using ^X-/.

well, describe-key ^X-/
give

"screen-search-forward"         ^X-/
  ( motion:  search forward for $identifier pattern under cursor )

grep'ing for "screen-search-forward" leads to

int
scrforwsearch(int f, int n)
{
    return fsearch(f, n, FALSE, TRUE);
                                ^^^^
}

...and in readpattern that is

    if (fromscreen) {
        if ((status = screen_to_ident(temp, sizeof(temp))) == TRUE) {
            if (tb_init(apat, EOS) == 0
                || tb_bappend(apat, temp, strlen(temp)) == 0) {
                status = FALSE;
            }
        }

...and then to:

int
screen_to_ident(char *buf, size_t bufn)
{
    int rc = FALSE;
    CHARTYPE mask = vl_ident;
    int whole_line = adjust_chartype(&mask);

    TRACE((T_CALLED "screen_to_ident\n"));
    rc = read_by_regex(buf, bufn, b_val_rexp(curbp, VAL_IDENTIFIER_EXPR), 
whole_line);
    if (rc == FALSE)
        rc = read_by_ctype(buf, bufn, mask, whole_line);
    returnCode(rc);
}

...which agrees with the $identifier mention in the help-message (have to
check that, since it's not generated...).  The b_val_rexp() tells me it is
a buffer mode.  Using :setall, I see

 noautosave                  identifier-expr=\w\+      tabinsert

so... what it does is (starting from the current position) pick up one or
more "word" characters.  In the help message it says of "\w":

   \w \W  [:ident:], alphanumeric (plus '_')

which means that the \w\+ could be rewritten as [[:ident:]]\+

Since it's a writable mode, you could in principle redefine it.  The only
gotcha is that it starts from the current position, so you would get
interesting matches.

-- 
Thomas E. Dickey <address@hidden>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature


reply via email to

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