Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

remove file from zsh autocomplete

Tags:

zsh

if I type

vim pack

and hit tab zsh autocompletes to package-lock.json, but 10 times out of 10 I would rather it complete to package.json as the first option.

How can I either:

  • make it autocomplete to package.json first
  • stop it completing package-lock.json at all

1 Answers

If you are using Zsh's "new" completion system (that is, the one released in the year 🛸2000🛸, which you need to initialize with autoload -Uz compinit; compinit) —and you should— then the following will work:

zstyle ':completion:*' ignored-patterns 'package-lock.json'

Documentation: http://zsh.sourceforge.net/Doc/Release/Completion-System.html#index-ignored_002dpatterns_002c-completion-style

like image 66
Marlon Richert Avatar answered Dec 05 '25 23:12

Marlon Richert



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!