{"id":17334370,"url":"https://github.com/3v1n0/zsh-bash-completions-fallback","last_synced_at":"2025-04-14T16:33:40.453Z","repository":{"id":146571150,"uuid":"265559863","full_name":"3v1n0/zsh-bash-completions-fallback","owner":"3v1n0","description":"Simple zsh plugin to support bash completions for a command if no native one is available","archived":false,"fork":false,"pushed_at":"2024-01-19T15:21:50.000Z","size":67,"stargazers_count":63,"open_issues_count":6,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T06:03:36.297Z","etag":null,"topics":["bash","bash-completion","bash-completions","bash-scripting","bash-zsh-migration","oh-my-zsh","oh-my-zsh-plugin","zinit","zinit-plugin","zsh","zsh-completions","zsh-plugin"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/3v1n0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-05-20T12:34:35.000Z","updated_at":"2025-03-23T11:02:11.000Z","dependencies_parsed_at":"2024-04-16T14:36:55.891Z","dependency_job_id":"46f15f5f-6422-46ae-975c-8d7d0f1cc66b","html_url":"https://github.com/3v1n0/zsh-bash-completions-fallback","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3v1n0%2Fzsh-bash-completions-fallback","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3v1n0%2Fzsh-bash-completions-fallback/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3v1n0%2Fzsh-bash-completions-fallback/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3v1n0%2Fzsh-bash-completions-fallback/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/3v1n0","download_url":"https://codeload.github.com/3v1n0/zsh-bash-completions-fallback/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248916978,"owners_count":21182903,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","bash-completion","bash-completions","bash-scripting","bash-zsh-migration","oh-my-zsh","oh-my-zsh-plugin","zinit","zinit-plugin","zsh","zsh-completions","zsh-plugin"],"created_at":"2024-10-15T15:05:52.213Z","updated_at":"2025-04-14T16:33:40.152Z","avatar_url":"https://github.com/3v1n0.png","language":"Shell","funding_links":[],"categories":["Completions"],"sub_categories":["ZSH on Windows"],"readme":"# zsh-bash-completions-fallback\n\nThis plugin is intended to use the bash completions when a zsh completion is not\navailable.\n\nWhile this could be supported natively via `bashcompinit`, this doesn't\nactually work most of the times, as completion scripts may use syntax not\nsupported by zsh, and so it's just better to implement this querying the bash\nitself, using a bash script called at completion time (based on [Brian Baffa\nimplementation](https://brbsix.github.io/2015/11/29/accessing-tab-completion-programmatically-in-bash/)\nand including various fixes to support commands and completion parameters).\n\nMake sure you load this after other plugins to prevent their completions to be\nreplaced by the (simpler) bash ones.\n\nMost of all bash completions can now work as they precisely do in bash, as per\nthe `compopt` simulation that is added here. It may be used to control the\noutput or avoid adding spaces or limit the results.\n\nThe plugin by default works by lazy-loading the completions the first time you\nhit TAB to complete a command, however this can be controlled using the\n`$ZSH_BASH_COMPLETIONS_FALLBACK_LAZYLOAD_DISABLE` parameter, to load them all\non startup.\n\nIf a new bash completion has been installed in the system, you can just restart\nzsh or call `_bash_completions_load`, if instead you want this to be handled\nautomatically, you can use `$ZSH_BASH_COMPLETIONS_FALLBACK_LAZYLOAD_AUTO_UPDATE`\nto update all the the available completions at every TAB-completion.\nThis is disabled by default, to avoid IO operations at each completion, but it\nis still very fast in most of the platforms.\n\nOnce loaded you can see all the completions available via bash (through this\nscript) using:\n\n    _bash_completions_fallback_list_handled_completions\n\n\nRequirements\n------------------------------------------------------------------------------\n\n* [ZSH](http://zsh.sourceforge.net) 4.3 or newer\n* [GNU Bash](https://www.gnu.org/software/bash/) 4 or newer\n\nInstall\n------------------------------------------------------------------------------\n\nUsing [Oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh):\n\n1. Clone this repository in oh-my-zsh's plugins directory:\n\n        git clone https://github.com/3v1n0/zsh-bash-completions-fallback ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-bash-completions-fallback\n\n2. Activate the plugin in `~/.zshrc` (make sure it's set as the last one not to\n   replace completions provided by other plugins):\n\n        plugins=( [plugins...] zsh-bash-completions-fallback)\n\n3. Source `~/.zshrc` (or restart zsh) to take changes into account\n\n        source ~/.zshrc\n\nUsing [Zinit](https://github.com/zdharma/zinit):\n\n- If you're using normal loading mode:\n\n        # Replace `light` with `load` if you want some more debugging\n        zinit ice depth=1 # optional, but avoids downloading the full history\n        zinit light 3v1n0/zsh-bash-completions-fallback\n\n- If you're using turbo mode, you can avoid using the internal lazy mode:\n\n        zinit wait lucid nocd depth=1 \\\n          atinit='ZSH_BASH_COMPLETIONS_FALLBACK_LAZYLOAD_DISABLE=true' \\\n            for 3v1n0/zsh-bash-completions-fallback\n\n- Add those to your `~/.zshrc` to keep the changes persistent\n\nUsing other plugins manager:\n\n        # Depending on the tool the syntax may vary but it's generally just\n        $your_plugin_manager 3v1n0/zsh-bash-completions-fallback\n\nManual installation:\n\n1. Clone this repository in a folder (like ~/.zsh-bash-completions-fallback):\n\n        git clone https://github.com/3v1n0/zsh-bash-completions-fallback $HOME/.zsh-bash-completions-fallback\n\n2. Add to your `~/.zshrc`:\n\n        source $HOME/.zsh-bash-completions-fallback/zsh-bash-completions-fallback.plugin.zsh\n\n3. Source `~/.zshrc` (or restart zsh) to start using the plugin\n\n        # This plugin requires compinit, so make sure that your ~/.zshrc or\n        # your package manager loads it before, otherwise this is needed\n        #autoload -U compinit \u0026\u0026 compinit\n        source ~/.zshrc\n\n4. Of course in case you want to test it temporary you just have to `source` the plugin file (`zsh-bash-completions-fallback.plugin.zsh`)\n\nConfiguration\n------------------------------------------------------------------------------\n\nThis script defines the following global variables. You may override their\ndefault values only after having loaded this script into your ZSH session.\n\n* `ZSH_BASH_COMPLETIONS_FALLBACK_PATH` overrides the default bash completions\n  path that is set to `/usr/share/bash-completion` by default.\n\n* `ZSH_BASH_COMPLETIONS_FALLBACK_REPLACE_ALL` set (to any value) to allow to\n  replace all the zsh completions, even if we already have one for the given\n  command.\n\n* `ZSH_BASH_COMPLETIONS_FALLBACK_WHITELIST` an array of commands for which we\n  want to enable the bash completions, this allow to filter the commands to use\n  a bash completion for. Set it to a value such as `(gdbus zramctl)` to enable\n  it only for the `gdbus` and `zramctl` commands.\n  This also can be used with `$ZSH_BASH_COMPLETIONS_FALLBACK_REPLACE_ALL` to\n  only use a subset of completions from bash only.\n\n* `ZSH_BASH_COMPLETIONS_FALLBACK_BLACKLIST` an array of commands for which we\n  want to disable the bash completions.\n\n* `ZSH_BASH_COMPLETIONS_FALLBACK_REPLACE_LIST` an array of commands for which we\n  want to give priority to the bash completions over the zsh ones.\n  So, in case a zsh completion for such commands is available, we just ignore it\n  and replace it with the bash ones.\n  This has no effect if `$ZSH_BASH_COMPLETIONS_FALLBACK_REPLACE_ALL` is set.\n\n* `ZSH_BASH_COMPLETIONS_FALLBACK_PRELOAD_ALL` set this variable (to any value)\n  to always preload completions even for non-available commands. We don't do it\n  by default and if any command is added at later times, the user can manually\n  call `_bash_completions_load` (or source this file again)\n\n* `ZSH_BASH_COMPLETIONS_FALLBACK_LAZYLOAD_DISABLE` set this variable (to any\n  value) in order to disable the lazy loading of the completions at the fist\n  time the tab-completion is triggered. By setting this the completions are\n  loaded instead at startup.\n\n* `ZSH_BASH_COMPLETIONS_FALLBACK_LOAD_NATIVE_COMPLETIONS` set this variable to\n  a value that is different from `true` not to ask the bash for all its suported\n  completions, but only relying in the provided completion files.\n\n* `ZSH_BASH_COMPLETIONS_FALLBACK_LAZYLOAD_AUTO_UPDATE` set this variable (to any\n  value) to automatically check for new completions and to install them at every\n  tab-completion if the threshold from the last update set in\n  `$ZSH_BASH_COMPLETIONS_FALLBACK_AUTO_UPDATE_THRESHOLD` has passed.\n  This is not affected by the value of\n  `$ZSH_BASH_COMPLETIONS_FALLBACK_LAZYLOAD_DISABLE` and it will work both in\n  case lazy loading is enabled or not.\n\n* `ZSH_BASH_COMPLETIONS_FALLBACK_AUTO_UPDATE_THRESHOLD`: Sets a threshold (in\n  seconds) to check if the completions have been changed in case the lazy load\n  update is enabled. This is set by default at 300 seconds.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3v1n0%2Fzsh-bash-completions-fallback","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F3v1n0%2Fzsh-bash-completions-fallback","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3v1n0%2Fzsh-bash-completions-fallback/lists"}