diff options
author | A Farzat <a@farzat.xyz> | 2022-11-17 18:13:19 +0900 |
---|---|---|
committer | A Farzat <a@farzat.xyz> | 2022-11-17 18:13:19 +0900 |
commit | e90c03a51b7eae12cc54949ea3f818ab23701e6c (patch) | |
tree | 6f19c5d87f85e9796bc74941cb3b712e3e585b16 | |
download | my-zsh-completions-e90c03a51b7eae12cc54949ea3f818ab23701e6c.tar.gz my-zsh-completions-e90c03a51b7eae12cc54949ea3f818ab23701e6c.zip |
Initial commit as generated by `zi create`
-rw-r--r-- | .gitattributes | 1 | ||||
-rw-r--r-- | .gitignore | 89 | ||||
-rw-r--r-- | LICENSE | 21 | ||||
-rw-r--r-- | README.md | 1 | ||||
-rwxr-xr-x | example-script | 70 | ||||
-rw-r--r-- | my-zsh-completions.plugin.zsh | 17 |
6 files changed, 199 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..21b1d4a --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.md diff=markdown diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..58d8312 --- /dev/null +++ b/.gitignore @@ -0,0 +1,89 @@ +# Zsh compiled script + zrecompile backup +*.zwc +*.zwc.old + +# Zsh completion-optimization dumpfile +*zcompdump* + +# Zsh zcalc history +.zcalc_history + +# A popular plugin manager's files +._zi +._zinit +.zi_lastupd +.zinit_lastupd + +# A popular older versions plugin manager's files +._zplugin +.zplugin_lstupd + +# z-shell/zshelldoc tool's files +zsdoc/data +docs/zsdoc/data + +# ohmyzsh/ohmyzsh/plugins/per-directory-history plugin's files +# (when set-up to store the history in the local directory) +.directory_history + +# MichaelAquilina/zsh-autoswitch-virtualenv plugin's files +# (for Zsh plugins using Python) +.venv + +# Zunit tests' output +/tests/_output/* +!/tests/_output/.gitkeep + +### C +# Prerequisites +*.d + +# Object files +*.o +*.ko +*.obj +*.elf + +# Linker output +*.ilk +*.map +*.exp + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ +*.su +*.idb +*.pdb + +# Kernel Module Compile Results +*.mod* +*.cmd +.tmp_versions/ +modules.order +Module.symvers +Mkfile.old +dkms.conf @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021, Salvydas Lukosius & Z-Shell ZI Community + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..db94b3c --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# my-zsh-completions diff --git a/example-script b/example-script new file mode 100755 index 0000000..3f8ea0a --- /dev/null +++ b/example-script @@ -0,0 +1,70 @@ +#!/usr/bin/env zsh +# -*- mode: sh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# +# Copyright (c) 2022 A Farzat +# +# An example of type-agnostic script/function, i.e.: the file can be run as a +x +# script or as an autoload function. Set the base and typically useful options +builtin emulate -L zsh ${=${options[xtrace]:#off}:+-o xtrace} +builtin setopt extended_glob warn_create_global typeset_silent no_short_loops rc_quotes no_auto_pushd + +if [[ $0 != example-script || -n $ZSH_SCRIPT ]]; then +# #̶ =̶=̶=̶ =̶=̶=̶ =̶=̶=̶ #̶ +# 𝟘 - https://wiki.zshell.dev/community/zsh_plugin_standard +# Standardized $0 Handling - [ zero-handling ] +0="${ZERO:-${${0:#$ZSH_ARGZERO}:-${(%):-%N}}}" +0="${${(M)0:#/*}:-$PWD/$0}" +# #̶ =̶=̶=̶ =̶=̶=̶ =̶=̶=̶ #̶ +# 𝟙 - # https://wiki.zshell.dev/community/zsh_plugin_standard#funtions-directory +# The below snippet added to the plugin.zsh file will add the directory +# to the $fpath with the compatibility with any new plugin managers preserved. +if [[ $PMSPEC != *f* ]] { + fpath+=( "${0:h}/functions" ) +} +# #̶ =̶=̶=̶ =̶=̶=̶ =̶=̶=̶ #̶ +# 𝟚 - # https://wiki.zshell.dev/community/zsh_plugin_standard#unload-function +# If a plugin is named kalc* and is available via any-user/kalc_plugin_ID, +# then it can provide a function, kalc_plugin_unload, that can be called by a +# plugin manager to undo the effects of loading that plugin. +# #̶ =̶=̶=̶ =̶=̶=̶ =̶=̶=̶ #̶ +# 𝟛 - https://wiki.zshell.dev/community/zsh_plugin_standard#run-on-unload-call +# RUN ON UNLOAD CALL +# #̶ =̶=̶=̶ =̶=̶=̶ =̶=̶=̶ #̶ +# 𝟜 - https://wiki.zshell.dev/community/zsh_plugin_standard#run-on-update-call +# RUN ON UPDATE CALL +# #̶ =̶=̶=̶ =̶=̶=̶ =̶=̶=̶ #̶ +# 𝟝 - https://wiki.zshell.dev/community/zsh_plugin_standard#activity-indicator +# ZI will set the $zsh_loaded_plugins array to contain all previously loaded plugins +# and the plugin currently being loaded, as the last element. +if [[ ${zsh_loaded_plugins[-1]} != */kalc && -z ${fpath[(r)${0:h}]} ]] { + fpath+=( "${0:h}" ) +} +# #̶ =̶=̶=̶ =̶=̶=̶ =̶=̶=̶ #̶ +# 𝟞 - https://wiki.zshell.dev/community/zsh_plugin_standard#global-parameter-with-prefix +# Global Parameter With PREFIX For Make, Configure, Etc +# #̶ =̶=̶=̶ =̶=̶=̶ =̶=̶=̶ #̶ +# 𝟟 - https://wiki.zshell.dev/community/zsh_plugin_standard#global-parameter-with-capabilities +# PMSPEC +# #̶ =̶=̶=̶ =̶=̶=̶ =̶=̶=̶ #̶ +# 𝟠 - https://wiki.zshell.dev/community/zsh_plugin_standard#zsh-plugin-programming-best-practices +# Zsh Plugin-Programming Best practices +# #̶ =̶=̶=̶ =̶=̶=̶ =̶=̶=̶ #̶ +# Such global variable is expected to be typeset'd -g in the plugin.zsh +# file. Here it's restored in case of the function being run as a script. +typeset -gA Plugins +Plugins[MY_ZSH_COMPLETIONS_DIR]=${0:h} +# In case of the script using other scripts from the plugin, either set up +# $fpath and autoload, or add the directory to $PATH. +fpath+=( $Plugins[MY_ZSH_COMPLETIONS_DIR] ) +autoload … +# OR +path+=( $Plugins[MY_ZSH_COMPLETIONS_DIR] ) +fi +# The script/function contents possibly using $Plugins[MY_ZSH_COMPLETIONS_DIR] … +# … +# Use alternate marks [[[ and ]]] as the original ones can confuse nested +# substitutions, e.g.: ${${${VAR}}} +# +# Made with love by Z-Shell Community +# +# vim:ft=zsh:tw=120:sw=2:sts=2:et:foldmarker=[[[,]]] diff --git a/my-zsh-completions.plugin.zsh b/my-zsh-completions.plugin.zsh new file mode 100644 index 0000000..458878a --- /dev/null +++ b/my-zsh-completions.plugin.zsh @@ -0,0 +1,17 @@ +# -*- mode: sh; sh-indentation: 2; indent-tabs-mode: nil; sh-basic-offset: 2; -*- +# Copyright (c) 2022 A Farzat +# According to the Zsh Plugin Standard: +# https://wiki.zshell.dev/community/zsh_plugin_standard +0="${ZERO:-${${0:#$ZSH_ARGZERO}:-${(%):-%N}}}" +0="${${(M)0:#/*}:-$PWD/$0}" +# Then ${0:h} to get plugin's directory +if [[ ${zsh_loaded_plugins[-1]} != */my-zsh-completions && -z ${fpath[(r)${0:h}]} ]] { + fpath+=( "${0:h}" ) +} +# Standard hash for plugins, to not pollute the namespace +typeset -gA Plugins +Plugins[MY_ZSH_COMPLETIONS_DIR]="${0:h}" +autoload -Uz example-script +# Use alternate vim marks [[[ and ]]] as the original ones can +# confuse nested substitutions, e.g.: ${${${VAR}}} +# vim:ft=zsh:tw=120:sw=2:sts=2:et:foldmarker=[[[,]]] |