Is it possible to make a custom zsh completion file,so when hitting tab for filenames it avoids completing the binaries? For example,I have 2 files , myprogram.c and myprogram,the binary,is it possible so when I do vim myprog(tab) it automagically completes it to myprogram.c,not myprogram? Thanks in advance!
|
You can ignore some patterns in completions by tuning completion styles with the For example, to ignore
This won't work to exclude executables in a useful way. You can exclude |
|||
|
|
|
You could of course tinker with this so that it worked for any given folder or set of files, but first you should understand the reason it doesn't do that now. On linux, file extensions don't matter, the only thing that matters is the execute bit. Things can be executed whether they are really binary or just text in the form of a script. Your criteria of "not binaries" does not match up well with the distinctions made by Linux about what a file is or isn't. That being said it wouldn't be too hard to write a custom completion function to replace the file name glob completion for a given command that would list all files but exclude the ones that have '.c' versions. It would require some overhead that would slow the tab completion down a little. |
|||
|
|