Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
avoiding duplications when using _path_files in completion function
- X-seq: zsh-users 22122
- From: Paul Seyfert <pseyfert@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: avoiding duplications when using _path_files in completion function
- Date: Sat, 19 Nov 2016 13:26:13 +0100
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Hi,
I'm writing a zsh tab completion function for a program which should get
started as:
PROGRAM INPUTFILE1 INPUTFILE2 [possibly more input files]
Typically one doesn't want to provide a file twice, so in a directory
with two files
cumbersome_long_5_filename.extension
cumbersome_long_X_filename.extension
i want to only suggest files which don't occur in the current line
already:
PROGRAM cumbersome_lone_5_filename.extension <TAB>
- -> suggest only cumbersome_lone_X_filename.extension
I imagine this is desired in other places as well and solutions exist.
So far I'm using (after some if for other use cases and non-filename
suggestions)
_path_files -g '*(/) *.extension'
which does suggest files several times.
I tried the -F option (for testing when suggesting the second filename,
providing the first filename to -F):
_path_files -F "$words[2]" -g '*(/) *.extension'
but this keeps suggesting the first file a second time (in zsh 5.2).
Any suggestions?
Thanks in advance,
Paul
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAEBCAAGBQJYMETlAAoJEPOmP9OjPXmrOXMP+wSrMkmWaQGOqgAKo3sTBq5W
DgLJBOgqYVfYXgDn5hx98sIuytVigI2rjHBOn6AnZhNqgFhIjIy6YmshJ6bHsLX6
2y23BuBlkuiNUW95WmMK4KAG9Ucov7oYIPPKZE9OTFzODnE75SJjZCSi+R57DusA
9L5pd/Rd0W6quy3qTcZsCVutroiRImf/LG8IHBXKnHWekidZAkrZdLakObDEkiX/
wwFrAhvCskxS4z6UfayUebnKUKsV20hRl4KzIG5BGbjXkuo+DIv7hfnkA5beJic9
6JObYdoc/j1RROddAOQkNeWUP4pJwjoOM3nOxQu7XkjSnozoH2mqIBlSXn6vIzsi
6W82DP+KGuOkHmHu/HuR5vYt3HtejPltP8NOJFbjiMp4thFlRE67xLmOPVjA92Uy
kfN1L5aZDzgaMDENg9moxmnsGmeYzfvh5Cw+gwGVLPoamT11/RjUC1NsjwLnfAjn
PrNQzL5cUZUhFfr6t2bLeIXeATPm24WuSy7XDy3pY1TvohPEEvacakmfybgQbJ+/
oOg7NDFPW8jPy1XyvuBdEP596ORqANzPm6iHiyPGXIl788qWbe0usLw58yZ23ZSd
Fv+wQhNziqBYdKqlu1Zx/Hg9XJ+1x0ALeswJkOtIbpO9gPE/r9R6YA14kAIuPfI4
pXaLucrse+5Nu+0QeY2r
=OMx6
-----END PGP SIGNATURE-----
Messages sorted by:
Reverse Date,
Date,
Thread,
Author