0

I have experience this in OS X in zsh shell, man page for open.

$ type open
open is /usr/bin/open

$ man open
  OPEN(1)                   General Commands
Manual                            OPEN(1)

NAME
     open – open files and directories

When I type open and type tab I see following output:

$ open                                                                                                                          
file:      ftp://     gopher://    http://    https://

I never attempt to open any of file:, ftp://, gopher://, http://, https://, hence I just want to suppress them. Is it possible to suppress them and only see the file/folder names.

6
  • open is not a bash built-in nor is /usr/bin/open part of any package I can find. So, um, you will have to tell us what open is, where it came from, and possibly, what provides the autocompletion for it! A good start would be to tell us the output of type open! Your question is also lacking info on your platform. What's your OS/distro/…? May 7, 2022 at 9:57
  • In ubuntu manpages.ubuntu.com/manpages/focal/en/man2/open.2.html // in macOS seems like its builtin command. I am using zsh shell seems like it suggest autocompletions for it
    – alper
    May 7, 2022 at 10:02
  • You're confusing things! That's a man page for a libc call. you can use that from the C programming language, it's not something present in a shell! May 7, 2022 at 10:05
  • Wait, you#re using zsh but tagged this bash... also, still missing the output of type open! May 7, 2022 at 10:05
  • I am using open in macOS , seems like its a builtin command.
    – alper
    May 7, 2022 at 10:10

1 Answer 1

1

According to your output, open is an executable in your OS X system.

So, to modify its completion syntax, you'd need to figure out where the completion function resides and modify it (I have not been able to figure out how to remove things from completion lists in any way that is comparable in complexity to just modifying the existing function).

Use whence -v $_comps[open] to figure out where the completion function for open is defined. Copy that file somewhere you can find it, say /home/alper/bin/open_completion.zsh.

There, look for the line that calls the _urls function (which happens to be the completion argument function that offers file: ftp:// gopher:// http:// https://). It might look something like '*:URL:_urls' in a list of viable arguments.

You might to remove that statement.

Then, add that function to be loaded in your zshrc.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .