Questions tagged [zsh-completion]

Questions about command completion in the zsh Unix shell.

Questions about command completion in the Unix shell.

Resources

243 questions
1
vote
0 answers

How do I make zsh autocompletion remove trailing slash it returns?

I have a custom script that I pass an argument into that will create a directory in a specific folder and then cd to it, unless it already exists, then it just cd to it. I added a zsh autocompletion that way if I want to use the command to just jump…
1
vote
1 answer

Why so many autosuggestions?

When I want to traverse between directories, zsh is throwing a screenfull of tab completions. It's making the experience very bad. How can I get only few suggestions?
1
vote
1 answer

Zsh: tab completion for files not in the current directory?

I'm new to zsh and I'm trying to figure out how to get tab completion to work so that when I typed part of the name of a file that's not in the current directory zsh will complete it. The idea is that I have some scripts in ~ and c:\MyStuff\bin and…
MikeTheTall
  • 3,214
  • 4
  • 31
  • 40
1
vote
0 answers

Why my zsh completion is not sourcing it?

I try to setup my zsh-completions. I also use oh-my-zsh . A lot of shell commands provide a some_command completion zsh and they often suggest sourcing it directly in .zshrc like so: source <(kubeone completion zsh) source <(tilt completion zsh) …
Jan
  • 12,992
  • 9
  • 53
  • 89
1
vote
1 answer

ZSH autocomplete option parsing: Accessing the completed value

I have an autocompletion script, with this snippet: _arguments \ '-project[project file]:project:->projects' ... case "$state" in ... projects) local -a projects projects=(*.project) _multi_parts / projects echo…
Zach Riggle
  • 2,975
  • 19
  • 26
1
vote
1 answer

git completion on zsh not listing ambiguous options (on macOS)

My machine is a M1 Mac mini running Big Sur. I am trying to get git completion to work in the default terminal which uses a zsh shell. This is what I am trying and expecting. Screenshot below. I am able to get completion to work, but not exactly as…
indojin
  • 139
  • 7
1
vote
1 answer

Zsh completion: How to find the function that is used for completions with a specific command?

I am writing a zsh completion function for a shell script/program I wrote. At some point in the completion process I want to use the completion function of another command to handle the rest of the completion. How can I find out what the completion…
Lucas
  • 685
  • 4
  • 19
1
vote
1 answer

Is there a way to check if the tab completion menu is open in ZSH

Is there a way to check if the tab completion menu is open in ZSH? I am asking this question because I want to bind the space key to accept-search so that I can accept completion with the space key, but I want to do it in a way that doesn't…
1
vote
1 answer

compadd doesn't work when called from nested functions

I have some custom completion I've been working on and am stuck. It extends existing completion scripts with some custom options. The full file can be found here https://github.com/rothgar/k/blob/zsh-completion/completions/zsh/k I have a custom…
Justin Garrison
  • 338
  • 5
  • 13
1
vote
1 answer

disable history substitution "preview" in zsh

in bash, if i enter: mkdir /tmp/foo cd !$ bash substitutes /tmp/foo for the bang-dollar, and executes the command if i do the same in zsh, zsh fills in /tmp/foo for the bang-dollar and shows me the resulting command, pausing to let me again hit …
zasu pitts
  • 23
  • 2
1
vote
0 answers

Missing branch name with zsh git prompt on MacOS Catalina

My .zshrc looks like this: source /Users/crmpicco/zsh-git-prompt/zshrc.sh PROMPT="%B%n@MBP%~%b$(git_super_status) %# " My prompt looks like this: crmpicco@MBP/var/www/belleisle/symfony(:|✔) % if I open a new tab in the Terminal the git branch is…
crmpicco
  • 16,605
  • 26
  • 134
  • 210
1
vote
0 answers

How are zsh autocompletions for commands with subcommands defined?

I am trying to write a tab-completion script for borg. So far, I have managed to define completions for borg itself, as well as borg key with its subcommands and borg benchmark with its singular subcommand. However, I am now trying to define…
SLDR
  • 19
  • 4
1
vote
2 answers

Completing command name itself in zsh

I have a bunch of ZSH functions which are pretty verbose, and I'd like to use zsh completion on them.…
Nick K9
  • 3,885
  • 1
  • 29
  • 62
1
vote
1 answer

zsh completion: _arguments with _files, but only list executable files

I would like to write a ZSH completion where one of the arguments must be an executable file. While :_files works well enough to list all files, there does not appear to be an easy way to list only executable files. The glob expression ls *(*) does…
Zach Riggle
  • 2,975
  • 19
  • 26
1
vote
0 answers

Zsh tab completions for subdirectories of an arbitrary parent

So, to better explain what I'm asking for, I am writing a zsh plugin for quickly navigating up directories and I want to offer the ability to traverse into a directory by specifying a starting directory in $PWD. For example, if I am in a directory…