{"id":13442269,"url":"https://github.com/marlonrichert/zsh-snap","last_synced_at":"2025-04-08T04:15:21.385Z","repository":{"id":37690940,"uuid":"295637956","full_name":"marlonrichert/zsh-snap","owner":"marlonrichert","description":"⚡️ Znap! Fast, easy-to-use tools for Zsh dotfiles \u0026 plugins, plus git repos","archived":false,"fork":false,"pushed_at":"2024-06-05T13:22:39.000Z","size":282,"stargazers_count":1398,"open_issues_count":17,"forks_count":40,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-01T03:35:35.355Z","etag":null,"topics":["git","plugin-manager","repo-management","shell","zsh","zsh-configuration","zsh-plugin","zsh-plugins","zshrc"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marlonrichert.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,"publiccode":null,"codemeta":null},"funding":{"github":["marlonrichert"]}},"created_at":"2020-09-15T06:40:22.000Z","updated_at":"2025-03-31T17:29:24.000Z","dependencies_parsed_at":"2024-06-12T08:37:56.493Z","dependency_job_id":null,"html_url":"https://github.com/marlonrichert/zsh-snap","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marlonrichert%2Fzsh-snap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marlonrichert%2Fzsh-snap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marlonrichert%2Fzsh-snap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marlonrichert%2Fzsh-snap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marlonrichert","download_url":"https://codeload.github.com/marlonrichert/zsh-snap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247773719,"owners_count":20993639,"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":["git","plugin-manager","repo-management","shell","zsh","zsh-configuration","zsh-plugin","zsh-plugins","zshrc"],"created_at":"2024-07-31T03:01:43.731Z","updated_at":"2025-04-08T04:15:21.351Z","avatar_url":"https://github.com/marlonrichert.png","language":"Shell","funding_links":["https://github.com/sponsors/marlonrichert"],"categories":["HarmonyOS","Shell"],"sub_categories":["Windows Manager"],"readme":"# ⚡️Znap!\n**Znap** is a fast, light-weight set of tools to ease the use of Zsh plugins \u0026\nGit repos and reduce your shell's startup time.\n\n\u003e Enjoy using this software? [Become a sponsor!](https://github.com/sponsors/marlonrichert)\n\n## Requirements\nTested with:\n* Zsh 5.8.1\n* Git 2.39.1\n\n## Installation\nPut this in your `.zshrc` file (replacing `~/Repos` with wherever you want to\nkeep your Zsh plugins and/or Git repos):\n```sh\n# Download Znap, if it's not there yet.\n[[ -r ~/Repos/znap/znap.zsh ]] ||\n    git clone --depth 1 -- \\\n        https://github.com/marlonrichert/zsh-snap.git ~/Repos/znap\nsource ~/Repos/znap/znap.zsh  # Start Znap\n```\nThen restart your shell.\n\nTo uninstall, simply remove the above from your `.zshrc` file and remove Znap's repo.\n\nZnap will automatically manage the repos found in its parent directory.  To change the directory it should manage, add\nthe following to your `.zshrc` file:\n```sh\nzstyle ':znap:*' repos-dir \u003cpath\u003e\n```\n\n### Updating\nTo update Znap and all of your plugins/repos simultaneously, run\n```sh\n% znap pull\n```\n\nNote, that if you told Znap not to manage its parent directory (see the previous section), then it will not update\nitself with this.  You will have to manually `cd` to its directory and run `git pull`.\n\nIf there are repos that you do not want to be included by `znap pull`, add the following to your `.zshrc` file:\n```sh\nzstyle ':znap:pull:*' exclude \u003crepo\u003e ...\n```\n\nTo run `znap pull` on specific repos only, including ones you have set to be excluded, pass them as an arguments:\n```sh\n% znap pull \u003crepo\u003e ...\n```\n\n## `.zshrc` optimization\nUsing Znap to optimize your Zsh config can be as simple as this:\n```sh\n[[ -r ~/Repos/znap/znap.zsh ]] ||\n    git clone --depth 1 -- https://github.com/marlonrichert/zsh-snap.git ~/Repos/znap\nsource ~/Repos/znap/znap.zsh\n\n# `znap prompt` makes your prompt visible in just 15-40ms!\nznap prompt sindresorhus/pure\n\n# `znap source` starts plugins.\nznap source marlonrichert/zsh-autocomplete\n\n# `znap eval` makes evaluating generated command output up to 10 times faster.\nznap eval iterm2 'curl -fsSL https://iterm2.com/shell_integration/zsh'\n\n# `znap function` lets you lazy-load features you don't always need.\nznap function _pyenv pyenv \"znap eval pyenv 'pyenv init - --no-rehash'\"\ncompctl -K    _pyenv pyenv\n\n# `znap install` adds new commands and completions.\nznap install aureliojargas/clitest zsh-users/zsh-completions\n```\n\nFor more examples of what Znap can do for your dotfiles, please see [the included `.zshrc`\nfile](.zshrc).\n\nAdditionaly, Znap makes it so that you actually need to have _less_ in your `.zshrc` file, by\nautomating several tasks for you.\n\n### Faster `eval`\nUse `znap eval ... \u003ccommand\u003e` to cache the output of `\u003ccommand\u003e`, compile it, and then `source` it (instead of `eval` it):\n```sh\nznap eval \u003cname\u003e '\u003ccommand\u003e'\n```\nThis can be up 10 times faster than a regular `eval \"$( \u003ccommand\u003e )\"` statement!  If you pass a repo as the first\nargument, then Znap will `eval` the command output inside the given repo and will invalidate the cache whenever the repo\nis update.  Otherwise, the cache will be invalidated whenever `\u003ccommand\u003e` changes.  Caches are stored in\n`${XDG_CACHE_HOME:-$HOME/.cache}/zsh-snap/eval`.\n\n### Automatic `compinit` and `bashcompinit`\nNote that the above example does not include any call to\n[`complist`](http://zsh.sourceforge.net/Doc/Release/Zsh-Modules.html#The-zsh_002fcomplist-Module),\n[`compinit`, or\n`bashcompinit`](http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Initialization) in\nthe `.zshrc` file. That is because Znap will run these for you as needed.\n\nZnap also regenerates your [comp dump\nfile](http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Use-of-compinit) automatically whenever you update a\nrepo, install a repo, or change your `.zshrc` file.\n\nIf necessary, you can let Znap pass arguments to `compinit` as follows:\n```sh\nzstyle '*:compinit' arguments -D -i -u -C -w\n```\n\n### Asynchronous compilation\nZnap compiles your scripts and functions in the background. This way, your shell will start up even\nfaster next time!\n\nShould you not want this feature, you can disable it with\n```sh\nzstyle ':znap:*' auto-compile no\n```\n\nIn any case, you can compile sources manually at any time with\n`znap compile [ \u003cdir\u003e | \u003cfile\u003e ] ...`.\n\n## Automatic `git maintenance`\nWhen using `git` 2.31.0 or newer, Znap automatically enables `git maintenance` in each repo that it\nmanages. This automatically optimizes your repos in the background, so that your `git` and `znap`\ncommands will run faster.\n\nTo selectively disable this feature, add\n```sh\nzstyle ':znap:*:\u003cglob pattern\u003e' git-maintenance off\n```\nto your `.zshrc` file. Next time you run `znap pull`, `git maintenance` will then be disabled for\neach repo whose name matches `\u003cglob pattern\u003e`.\n\nUse `*` as your [glob\npattern](https://zsh.sourceforge.io/Doc/Release/Expansion.html#Filename-Generation) to opt out of\nthis feature completely.\n\n## Command-Line Usage\nZnap also makes life on the command line easier.  For a full list of available commands, run\n```sh\n% znap\n```\nFor more help on a particular command, run\n```sh\n% znap help \u003ccommand\u003e\n```\nExhaustive tab completion is available, too.  For examples of the most important command-line features, see below.\n\n\u003e Note:\n\u003e * The examples below you should run on the command line, not add to your `.zshrc` file!\n\u003e * `%` represents the prompt.  You shouldn't type that part.  🙂\n\n### Check Git status of all repos\nTo check the Git status of all repos managed by Znap, run\n```sh\n% znap status\n```\n\nIf there are repos that you do not want to be included by `znap status`, add the following to your `.zshrc` file:\n```sh\nzstyle ':znap:status:*' exclude \u003crepo\u003e ...\n```\n\nTo run `znap status` on specific repos only, including ones you have set to be excluded, pass them as an arguments:\n```sh\n% znap status \u003crepo\u003e ...\n```\n\n### Removing repos\nTo remove one or more repos, use `znap uninstall`:\n```sh\n% znap uninstall asdf-vm/asdf ohmyzsh/ohmyzsh\n```\n\n### Install generated functions\nSome commands generate output that should be loaded as a function.  You can install these generated functions with\n`znap fpath \u003cfunction\u003e '\u003ccommand\u003e'`.  For example:\n```sh\n% znap fpath _kubectl 'kubectl completion  zsh'\n% znap fpath _rustup  'rustup  completions zsh'\n% znap fpath _cargo   'rustup  completions zsh cargo'\n```\n\nThis will save them to `${XDG_DATA_HOME:-$HOME/.local/share}/zsh/site-functions`.\n\n### Named dirs\nZnap makes all of the repos it manages available as [named\ndirectories](http://zsh.sourceforge.net/Doc/Release/Expansion.html#Filename-Expansion):\n```sh\n% cd ~[zsh-snap] # `cd` to a repo\n% ls ~[asdf]/completions    # `ls` a subdir in a repo\n```\n\n## Author\n© 2020-2021 [Marlon Richert](https://github.com/marlonrichert)\n\n## License\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarlonrichert%2Fzsh-snap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarlonrichert%2Fzsh-snap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarlonrichert%2Fzsh-snap/lists"}