zsh-workers
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Wayne Davison <wayned@users.sourceforge.net>,
	Zsh Workers <zsh-workers@sunsite.auc.dk>
Subject: Re: Another keep-prefix problem
Date: Tue, 24 Apr 2001 16:50:25 +0000	[thread overview]
Message-ID: <1010424165026.ZM5732@candle.brasslantern.com> (raw)
In-Reply-To: <Pine.LNX.4.30.0104231732080.26875-100000@phong.blorf.net>

On Apr 23,  5:46pm, Wayne Davison wrote:
} Subject: Another keep-prefix problem
}
} I noticed one other problem with the current zsh (in CVS) and how it
} handles keeping the prefix.  After Bart's last set of tweaks, this
} works:
} 
}    % ls $var1/foo/$var2/bar<TAB>
} 
} But leaving off the leading variable results in a useless expansion:
} 
}    % ls /full/path/foo/$var/bar<TAB>
} 
} When the filename only has an embedded variable, it is expanded.

I suspect this is because of the `suffix' style:

suffix
     This is used by the _expand completer if the word starts with a
     tilde or parameter expansion. If it is set to `true', the word will
     only be expanded if it doesn't have a suffix, i.e. if it is
     something like `~foo' or `$foo', but not if it is `~foo/' or
     `$foo/bar', unless that suffix itself contains characters eligible
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     for expansion.  The default for this style is `true'.

In your example, $var2 is in the suffix and eligible for expansion, so
expansion is tried, and keep-prefix only preserves the leading $var1 in
that case.

} Here's a (completely usless) failure case:
} 
}    zsh -f
}    % autoload -U compinit
}    % compinit
}    % zstyle ':completion:*' completer _expand _complete
}    % zstyle ':completion:*:expand:*' keep-prefix true
}    % bindkey '\t' complete-word
}    % www=/var/www/html
}    % mkdir $www/subdir
}    % echo ~
}    /home/wayne
}    % ls -l ~/../..$www/sub<TAB>
} 
} ... properly expands to 'subdir' ...

You don't mean "expands", you mean "completes", right?

}    % ls -l /home/wayne/../..$www/sub<TAB>
} 
} ... does not.

Exactly how does it not work?  For me, it expands (not completes) to
`/home/wayne/../../var/www/html/sub' and completion can continue from
there.  keep-prefix only applies to words that begin with `~' or `$',
not to words that have a `$' anywhere in the prefix; the `suffix' style
is for the words with a `$' somewhere else (which is a slight misnomer,
as it means the file-path-suffix of the completion-prefix, and not the
completion-suffix (which is the stuff to the right of the cursor)).

Maybe you want to look at the `subst-globs-only' and/or `substitute'
styles, if you haven't already done so.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


  reply	other threads:[~2001-04-24 16:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-24  0:46 Wayne Davison
2001-04-24 16:50 ` Bart Schaefer [this message]
2001-04-24 19:18   ` Wayne Davison
2001-04-25 13:25     ` Sven Wischnowsky
2001-04-26  4:33       ` Bart Schaefer
2001-04-26 14:27 Oliver Kiddle
2001-04-26 15:43 ` Wayne Davison
2001-04-26 17:18   ` Bart Schaefer
2001-04-26 23:38     ` Wayne Davison
2001-04-27  9:03 ` Sven Wischnowsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1010424165026.ZM5732@candle.brasslantern.com \
    --to=schaefer@candle.brasslantern.com \
    --cc=wayned@users.sourceforge.net \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).