* avoiding duplications when using _path_files in completion function
@ 2016-11-19 12:26 Paul Seyfert
2016-11-19 17:46 ` Bart Schaefer
0 siblings, 1 reply; 2+ messages in thread
From: Paul Seyfert @ 2016-11-19 12:26 UTC (permalink / raw)
To: Zsh Users
-----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-----
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: avoiding duplications when using _path_files in completion function
2016-11-19 12:26 avoiding duplications when using _path_files in completion function Paul Seyfert
@ 2016-11-19 17:46 ` Bart Schaefer
0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2016-11-19 17:46 UTC (permalink / raw)
To: Zsh Users; +Cc: Paul Seyfert
On Nov 19, 1:26pm, Paul Seyfert wrote:
}
} i want to only suggest files which don't occur in the current line
} already:
zstyle ':completion::*:PROGRAM:*:*file*' ignore-line true
There are other possible values for ignore-line, check the doc for
the one that suits you best.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-19 17:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-19 12:26 avoiding duplications when using _path_files in completion function Paul Seyfert
2016-11-19 17:46 ` Bart Schaefer
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).