Questions tagged [zsh-completion]

Questions about command completion in the zsh Unix shell.

Questions about command completion in the Unix shell.

Resources

243 questions
3
votes
1 answer

How can I move the cursor after a Zsh abbreviation?

I'm using this excellent script in my .zshrc file to accomplish zsh abbreviations: http://zshwiki.org/home/examples/zleiab The above works great. Here's my question: How can I modify these abbreviations or the script to have the cursor end up in…
Jamis Charles
  • 5,827
  • 8
  • 32
  • 42
3
votes
1 answer

Zsh underline common completion prefix

I've seen things like this zsh.org thread and this Reddit thread that shows how to highlight the common prefix of the completions with a color. Unfortunately, this overrides the LS_COLORS that I've set. I derive a lot of information from my…
PythonNut
  • 6,182
  • 1
  • 25
  • 41
3
votes
1 answer

How to pass the contents of a file using `cat` to `_values` (zsh completion)

Is it possible to pass the contents of a file using cat to _values (zsh completion)? If I uncomment the line _values cat .test_tasks~ and comment _values below, it doesn't work, I get: _values:compvalues:10: invalid value definition:…
Pablo Cantero
  • 6,239
  • 4
  • 33
  • 44
3
votes
1 answer

standard zsh completion for arguments of a zsh function

if I type the following where record is a zsh function record ls how do I write a zsh completion for record such that if I write record ls - it will use zsh's completion for ls e.g. -1 -- single column output -A -- list…
Bilal Syed Hussain
  • 8,664
  • 11
  • 38
  • 44
3
votes
1 answer

Writing a ZSH autocomplete function

I recently wrote a handy Zsh function that creates a new tmux session with no arguments. If an argument is provided and the session already exists, it's attached. Otherwise, a new session is created with the provided name. # If the session is in the…
LandonSchropp
  • 10,084
  • 22
  • 86
  • 149
3
votes
0 answers

Completion for Hadoop command in zsh

I love the tab completion feature in zsh. But when I use hadoop command, it seems do not work anymore. So is there any idea to auto-completion for hadoop command in zsh? Many thanks.
shao
  • 31
  • 3
3
votes
1 answer

How do I dynamically select a completion function in zsh?

Say I have a script foo which can be called as: foo git clone http://example.com or as: foo print 12 etc. How can I make a compdef that delegates to $argv[0] here to allow it to handle completion?
Julian
  • 3,375
  • 16
  • 27
2
votes
1 answer

Complete a command (with arguments) like another command (with other arguments)

compdef cmd1=service can be used to define a completion alias, however, that works only when the arguments are going to be the same. For example, consider a helper script which rewrites some arguments before executing another command: | What is…
Vladimir Panteleev
  • 24,651
  • 6
  • 70
  • 114
2
votes
1 answer

How to make right arrow key in zsh behave like fish's forward-single-char

I've just got into zsh recently, mainly to use it for git on vscode only (cause it looked superr goood) I've been using fish for a very long time, and even now I'm using it as my default shell So I'm trying to configure zsh to behave more like fish…
Cleff
  • 23
  • 1
  • 4
2
votes
5 answers

Can zsh or bash expand history expressions referring to directories?

For example, let's suppose I just copied something: mv foo_file.txt ~/to/some/long/path/that/i/do/not/want/to/retype and I'd like to use history substitution like so: mv bar_file.txt !!:2 I'm surprised that zsh is not expanding the !!:2 for me…
iconoclast
  • 21,213
  • 15
  • 102
  • 138
2
votes
1 answer

zsh completion script with globbing

I'd like to write a zsh-completion script, which completes with files in a directory different from the current working directory. (I can archieve this, see below.) Additionally the user shall be able to use globbing on the completed command. How…
Lord Bo
  • 3,152
  • 3
  • 15
  • 22
2
votes
0 answers

Configure ZSH to always fall back to path completion

I'm using zsh, and the completions mostly just work. But when I use various commands where an arbitrary command follows a command with specialized zsh handling, file path completions don't work. # completes to 'npm run build' for a package.json…
Marvin
  • 2,537
  • 24
  • 35
2
votes
1 answer

How do I configure zsh for completion of partial words, but case-insensitive?

Currently I have this in my ~/.zshrc: zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' AFAIU 'm:{a-z}={A-Za-z}' means that I will get case-insensitive tab completion, e.g. foo will tab-complete to Foobar (if…
shahn
  • 577
  • 2
  • 13
2
votes
1 answer

zsh autocompletion for sudo-like command

I have a tool that runs other tools, that I would like to enable completion from the commands it runs. For example: mytool git grep -- Should autocomplete for git grep. This works fine with e.g. sudo: sudo git grep -- Shows the…
Zach Riggle
  • 2,975
  • 19
  • 26
2
votes
2 answers

How to enable tab completion + arrow keys selection for the kill command in zsh?

Is there any way to enable arrow keys selection for the kill command in zsh? E.g. $ kill gives me a list of all currently running processes, and I can then use arrow keys to select a specific one. However, when I do: $ kill foo I get a…
rtur
  • 165
  • 9