Questions tagged [zsh-completion]

Questions about command completion in the zsh Unix shell.

Questions about command completion in the Unix shell.

Resources

243 questions
14
votes
1 answer

How do I defer shell completion to another command in bash and zsh?

I am attempting to write a shell script utility that wraps other shell utilities into a single CLI and am trying to get shell completion to work in zsh and bash. For example, let's say the CLI is named util: util aws [...args] #=> runs aws util…
Jacob Gillespie
  • 3,981
  • 3
  • 23
  • 33
14
votes
2 answers

How to enable git file tab completion with zsh compinit?

I have a problem with the zsh tab completion: After running: autoload -U compinit compinit Git tab completion for files does not work any more. For example if I type git add my_f to complete my_file, nothing happens. The zsh git completion only…
Ralph von der Heyden
  • 1,715
  • 1
  • 15
  • 15
11
votes
1 answer

zsh issue : have the most recents files and directories near to the prompt and suggested most recent files or directories

On MacOS Big Sur 11.3, here is my .zshrc. I would like to get the latest modified or create files and directories near to the prompt (sorted from the most recent up to the oldest ones). Here my current config in ~/.zshrc : # ZSH completion autoload…
user1773603
11
votes
4 answers

Zsh completion for custom git "bang" alias - Git branch name

I have a Git alias update that I would like to outfit with branch-name completion. The alias is defined like so: [alias] update = "!f() { git push . origin/$1:$1; }; f" (It updates a local tracking branch with its upstream version, without…
Ken Williams
  • 22,756
  • 10
  • 85
  • 147
11
votes
0 answers

zsh completion last_prompt behaviour for long lists

I currently configure my zsh tab completion with: autoload -U compinit && compinit zstyle ':completion:*:default' menu select=0 zstyle ':completion:*:default' select-scroll 0 What I like about this is: unambiguous completions get completed…
pseyfert
  • 3,263
  • 3
  • 21
  • 47
11
votes
3 answers

git add auto-complete filename

I am working on a git project. Since I have a lot of folder deepness, I would like to improve my auto-completion to work with filenames and not only paths. Here is an example: $git status …
nsvir
  • 8,781
  • 10
  • 32
  • 47
11
votes
1 answer

Can zsh do smartcase completion like vim's search?

Vim has a "smartcase" feature, which makes searching case insensitive, but only if the search contains all lowercase letters. When you search on any uppercase letters, smartcase assumes you want a case sensitive search. Is there a way to get the…
Jack O'Connor
  • 10,068
  • 4
  • 48
  • 53
10
votes
2 answers

Make zsh complete arguments from a file

zsh is great but its completion system is very diverse. And the documentation lacks good examples. Is there a template for completing for a specific application. The completion would get its match data from a file, separated by newlines? I tried…
mike3996
  • 17,047
  • 9
  • 64
  • 80
8
votes
2 answers

Git tab completion stopped working on remote branches

I've updated git to its latest version (2.29.0) and I'm using ZSH 5.8. I used to switch between branches with git checkout remote_br to quickly switch between branches, even if the branch is only a remote one atm. I've seen git has made a lot…
RobinFrcd
  • 4,439
  • 4
  • 25
  • 49
8
votes
2 answers

bind key to complete filename wherever the context is in Zsh

Sometimes I want a filename instead of what zsh guesses for me. For example, I have a PNG file without a proper .png suffix, which makes zsh think it isn't a picture and won't list it when I type Tab to complete arguments of display. I am wondering…
lilydjwg
  • 1,621
  • 20
  • 41
7
votes
1 answer

Word forward/backward delimiter difference between bash and zsh

Having been dragged into the 21st century by macOS Catalina now defaulting to zsh instead of bash for its shell, I'm trying to restore some of the bash's line editing behavior. Specifically, if I am at the end of the line: bash$ ls /foo/bar/baz and…
marcprux
  • 9,845
  • 3
  • 55
  • 72
7
votes
1 answer

Zsh function: forward completion to subfunction

Many times I end up writting wrapper function around existing ones, for instance: function gl { some_computed_stuff=... git --no-pager log --reverse $some_computed_stuff "$@" } function m { make "$@" && notify-send success || notify-send…
bagage
  • 1,094
  • 1
  • 21
  • 44
6
votes
0 answers

ZSH Autocomplete For Custom Script

I've been searching online for a lot of hours, puling an all nighter because i got so lost down this rabbit hole :D but i'm having trouble finding examples with working code. I have a bash script that is called upon like the following…
MoonMoon
  • 63
  • 5
6
votes
2 answers

Not sure where to put completions with Oh My Zsh

I'm using zsh and oh my zsh, and I'm a bit confused about where to put completion files. For example, when installing kind, I'm doing this: brew install kind kind complete zsh > ~/.oh-my-zsh/cache/completions/_kind And I expect that completions for…
Joel
  • 8,502
  • 11
  • 66
  • 115
6
votes
1 answer

ZSH Hangs on Open Application Tab Autocompletion

I frequently open applications on my Mac by using the command open -a . I also have been using tab autocompletion more recently to complete my commands. I tried to do this after writing, for example, open -a or open -a Safa, but…
Noah Wilder
  • 1,656
  • 20
  • 38
1
2
3
16 17