Questions tagged [zsh-completion]

Questions about command completion in the zsh Unix shell.

Questions about command completion in the Unix shell.

Resources

243 questions
0
votes
0 answers

zsh: Complete `mgit` like `git`

I have written a little shell script called mgit that executes the same git command in multiple repositories. I would like to tell zsh that arguments to mgit should be completed like git arguments. For example, I can type git st and hit tab, and…
hibbelig
  • 510
  • 6
  • 15
0
votes
1 answer

How to complete a variable number of arguments containing spaces

I've build a command line tool and I need to complete arguments with zsh. I never wrote a zsh completion function so I looked in the scripts provided with zsh but I missed something so that it could work properly. So, mytool can take a variable…
matt
  • 384
  • 2
  • 11
0
votes
1 answer

bad set of key/value pairs for associative array for custom completion

I am trying to follow Make zsh complete arguments from a file but with a command. Shouldn't matter much. In /usr/local/share/zsh/site-functions/_foo I have #compdef foo aliases=($(a complicated command here printing everything twice)) _describe…
chx
  • 11,270
  • 7
  • 55
  • 129
0
votes
1 answer

Generate an associative array from command output

I am writing a zsh completion function to complete IDs from a database. There is a program listnotes which outputs a list like this: bf848bf6-63d2-474b-a2c0-e7e3c4865ce8 Note Title aba21e55-22c6-4c50-8bf6-bf3b337468e2 Another…
fqxp
  • 7,680
  • 3
  • 24
  • 41
0
votes
0 answers

zsh !! expands to the last but one command in history instead of the last one

I would expect that !! in zsh should expand to the last command executed. The same as !-1. But in my zsh, it always expands to the last but one. Example ~$ echo 1 ~$ echo 2 ~$ !! The last !! simply expands to echo 1. Is there any option that…
doraemon
  • 2,296
  • 1
  • 17
  • 36
0
votes
1 answer

zsh errors in dotfiles

I am trying to set up a new work environment, using zsh and an old set of dotfiles. I have this error with git information and I do not know how to solve it. Here is the error from iTerm2 as soon as I cd into my dotfiles repo: ~ ✔ cd…
jb_9122
  • 298
  • 3
  • 6
0
votes
1 answer

How can I write a shell completion hook for a multi-word prefix?

Let's say I want to write a custom shell completion function that fires only on git checkout . I can write a custom hook for git completion like this: complete -f -F _custom_completion_function git # bash compctl -f -K…
Sasgorilla
  • 2,403
  • 2
  • 29
  • 56
0
votes
1 answer

history expansion in zsh

according to the doc, !! should expand to the last command when hit after it. However, this is not the case for my setup (I used default oh-my-zsh). Here is an example: $ echo 1 1 $ echo 2 2 $ !! $ echo 1 Moreover, !# does not expand to…
doraemon
  • 2,296
  • 1
  • 17
  • 36
0
votes
1 answer

Reuse options in _arguments for Zsh completion

I have a python program that utilizes action='append' of python. For example, I can use the command like this mod_db -i $HOME -i $PWD -i /usr/local foo bar How can I use _arguments or anything else to implement the Zsh completion?
zijuexiansheng
  • 337
  • 3
  • 14
0
votes
1 answer

Display progress indication while custom ZSH completer is running

I have a custom ZSH tab-completion function for one of my tools. It works well, however sometimes it takes a long time for the tool to answer; is there a way to display some sort of indication that something is happening while the tool is running…
Whyte
  • 3
  • 1
0
votes
1 answer

Zsh Shell Smart Completion (ala PhpStorm)

While I'm familiar with a few of the options Zsh provides for autocompletions (i.e. the standard Tab menu-complete and the Ctrl+i completion option), but I've been spoiled with the type of search/completion you can get out of PhpStorm. For example,…
0
votes
1 answer

How to add "" to paths in zsh

Basically, I want to make it so that if I run a command, say cd ~/Library/Application Support/ it will replace that path with "~/Library/Application Support/" Is this at all possible? I would also like it to apply to paths in my .zshrc. Thanks
willyb321
  • 310
  • 3
  • 9
0
votes
1 answer

Auto complete commands with "windows like" options (starting with slash)

I'm trying to write a custom auto-complete script for zsh (or bash) for a command that has options starting with a slash. For instance: MyCommand /foo=bar.txt /yolo=test /final=4 I've been trying to use the zsh helper _arguments but it did not…
magnetik
  • 4,351
  • 41
  • 58
0
votes
0 answers

zsh completion ignored list?

I have my .zshrc set up like: CASE_SENSITIVE="true" HYPHEN_INSENSITIVE="true" COMPLETION_WAITING_DOTS="true" In a directory, I have two files: C.c and C_1.c. If I do ls C I get ls C.c If I do a again, it completes as ls C.c…
BetterWang
  • 243
  • 1
  • 4
0
votes
1 answer

How to make zsh autocomplete failover to compdef _files

I needed to get the fingerprint of a ssh key using: $ ssh-keygen -lf ~/.ssh/id_rsa_user.pub after typing:ssh-keygen -lf ~/.ss TAB It was not giving any options. I had to do: $ compdef _files ssh-keygen After that I was available to autocomplete…
nbari
  • 25,603
  • 10
  • 76
  • 131