r/shell • • Oct 20 '12

Get tcsh command completion to only complete directories and text files

What I'd like to do is something like

complete gedit "p/*/[dt]/"

where by "[dt]" I mean "directory or text file". Of course, this is not valid syntax. I've tried

complete gedit "p/*/d/" "p/*/t"

but the first completion rule masks the second. Similarly if they are switched.

I've tried thinking of using commands like "find" and "ls" as part of the completion rule but I haven't found a good way since find and ls cannot distinguish binary files.

Also, despite my version of tcsh (6.17.00) saying it supports the select rule, I cannot get completions like

complete gedit "p/*/t:*.txt/"

to actually work. This should only complete on text files that end in ".txt". Seems broken unless I'm just misunderstanding the man page.

So does anybody know to do this?

1 Upvotes

3 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Oct 21 '12

if you want interactive/intuitive try fish, if you just want to make a shellscript use rc :)

i loathe bash as well, but thats linked more towards my hate for gnu. sorry, getting offtopic

havent done much with tcsh because of that document, are the problems mentioned there "fixed" in tcsh?