0
0
Fork 0
mirror of https://github.com/ohmyzsh/ohmyzsh.git synced 2024-09-19 04:01:21 +02:00

Merge branch 'ohmyzsh:master' into master

This commit is contained in:
Vigneshwar Ravichandar 2022-01-26 22:31:23 +05:30 committed by GitHub
commit 1e7692b094
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
266 changed files with 42782 additions and 5850 deletions

1
.github/CODEOWNERS vendored
View file

@ -5,6 +5,7 @@ plugins/genpass/ @atoponce
plugins/git-lfs/ @hellovietduc
plugins/gitfast/ @felipec
plugins/sdk/ @rgoldberg
plugins/shell-proxy/ @septs
plugins/universalarchive/ @Konfekt
plugins/wp-cli/ @joshmedeski
plugins/zoxide/ @ajeetdsouza

2
.github/FUNDING.yml vendored
View file

@ -1,2 +1,2 @@
github: [robbyrussell, mcornella, larson-carter]
github: [ohmyzsh, robbyrussell, mcornella, larson-carter]
open_collective: ohmyzsh

View file

@ -1,12 +1,11 @@
name: Bug report
description: Create a report to help us improve Oh My Zsh
labels: 'Bug'
name: Report a bug
description: Report a bug that isn't caused by Oh My Zsh. If unsure, use this form
body:
- type: markdown
attributes:
value: |
## Self Check
- Try searching existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=is%3Aissue) (open or closed) for similar issues.
- Look for similar errors in existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=is%3Aissue) (open or closed).
- Try reaching out on the [Discord server](https://discord.gg/ohmyzsh) for help.
- type: textarea
validations:
@ -41,21 +40,21 @@ body:
validations:
required: true
attributes:
label: OS / Distro
placeholder: e.g. Windows 10, Ubuntu 20.04, Arch Linux, macOS 10.15...
label: OS / Linux distribution
placeholder: Windows 10, Ubuntu 20.04, Arch Linux, macOS 10.15...
- type: input
validations:
required: true
attributes:
label: Zsh version
description: Run `echo $ZSH_VERSION` to check.
placeholder: e.g. 5.6
placeholder: "5.6"
- type: input
validations:
required: true
attributes:
label: Terminal emulator
placeholder: e.g. iTerm2, Gnome Terminal...
placeholder: iTerm2, GNOME Terminal, Terminal.app...
- type: dropdown
attributes:
label: If using WSL on Windows, which version of WSL

View file

@ -0,0 +1,77 @@
name: Report a bug in Oh My Zsh
description: Create a report to help us improve Oh My Zsh
labels: ['Bug']
body:
- type: markdown
attributes:
value: |
## Self Check
- **Make sure this bug only happens with Oh My Zsh enabled**.
- Look for similar errors in existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=is%3Aissue) (open or closed).
- Try reaching out on the [Discord server](https://discord.gg/ohmyzsh) for help.
- type: textarea
validations:
required: true
attributes:
label: Describe the bug
description: A clear description of what the bug is.
- type: textarea
validations:
required: true
attributes:
label: Steps to reproduce
description: |
Steps to reproduce the problem.
placeholder: |
For example:
1. Enable plugin '...'
2. Run command '...' or try to complete command '...'
3. See error
- type: textarea
validations:
required: true
attributes:
label: Expected behavior
description: A brief description of what should happen.
- type: textarea
attributes:
label: Screenshots and recordings
description: |
If applicable, add screenshots to help explain your problem. You can also record an asciinema session: https://asciinema.org/
- type: input
validations:
required: true
attributes:
label: OS / Linux distribution
placeholder: Windows 10, Ubuntu 20.04, Arch Linux, macOS 10.15...
- type: input
validations:
required: true
attributes:
label: Zsh version
description: Run `echo $ZSH_VERSION` to check.
placeholder: "5.6"
- type: input
validations:
required: true
attributes:
label: Oh My Zsh version
description: Run `omz version` to check.
placeholder: master (bf303965)
- type: input
validations:
required: true
attributes:
label: Terminal emulator
placeholder: iTerm2, GNOME Terminal, Terminal.app...
- type: dropdown
attributes:
label: If using WSL on Windows, which version of WSL
description: Run `wsl -l -v` to check.
options:
- WSL1
- WSL2
- type: textarea
attributes:
label: Additional context
description: Add any other context about the problem here. This can be themes, plugins, custom settings...

View file

@ -1,7 +1,12 @@
name: Feature request
description: Suggest a feature for Oh My Zsh
labels: 'Feature'
labels: ["Feature"]
body:
- type: markdown
attributes:
value: |
## Self Check
- Look for similar features in existing [GitHub Issues](https://github.com/ohmyzsh/ohmyzsh/issues?q=is%3Aissue) (open or closed).
- type: input
attributes:
label: If the feature request is for a plugin or theme, specify it here.

15
.github/actions/spelling/README.md vendored Normal file
View file

@ -0,0 +1,15 @@
# check-spelling/check-spelling configuration
File | Purpose | Format | Info
-|-|-|-
[dictionary.txt](dictionary.txt) | Replacement dictionary (creating this file will override the default dictionary) | one word per line | [dictionary](https://github.com/check-spelling/check-spelling/wiki/Configuration#dictionary)
[allow.txt](allow.txt) | Add words to the dictionary | one word per line (only letters and `'`s allowed) | [allow](https://github.com/check-spelling/check-spelling/wiki/Configuration#allow)
[reject.txt](reject.txt) | Remove words from the dictionary (after allow) | grep pattern matching whole dictionary words | [reject](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-reject)
[excludes.txt](excludes.txt) | Files to ignore entirely | perl regular expression | [excludes](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-excludes)
[only.txt](only.txt) | Only check matching files (applied after excludes) | perl regular expression | [only](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-only)
[patterns.txt](patterns.txt) | Patterns to ignore from checked lines | perl regular expression (order matters, first match wins) | [patterns](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-patterns)
[expect.txt](expect.txt) | Expected words that aren't in the dictionary | one word per line (sorted, alphabetically) | [expect](https://github.com/check-spelling/check-spelling/wiki/Configuration#expect)
[advice.md](advice.md) | Supplement for GitHub comment when unrecognized words are found | GitHub Markdown | [advice](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-advice)
Note: you can replace any of these files with a directory by the same name (minus the suffix)
and then include multiple files inside that directory (with that suffix) to merge multiple files together.

25
.github/actions/spelling/advice.md vendored Normal file
View file

@ -0,0 +1,25 @@
<!-- See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples%3A-advice --> <!-- markdownlint-disable MD033 MD041 -->
<details><summary>If the flagged items do not appear to be text</summary>
If items relate to a ...
* well-formed pattern.
If you can write a [pattern](https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns) that would match it,
try adding it to the `patterns.txt` file.
Patterns are Perl 5 Regular Expressions - you can [test](
https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.
* binary file.
Please add a file path to the `excludes.txt` file matching the containing file.
File paths are Perl 5 Regular Expressions - you can [test](
https://www.regexplanet.com/advanced/perl/) yours before committing to verify it will match your files.
`^` refers to the file's path from the root of the repository, so `^README\.md$` would exclude [README.md](
../tree/HEAD/README.md) (on whichever branch you're using).
</details>

0
.github/actions/spelling/allow.txt vendored Normal file
View file

41
.github/actions/spelling/excludes.txt vendored Normal file
View file

@ -0,0 +1,41 @@
# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-excludes
(?:^|/)(?i)COPYRIGHT
(?:^|/)(?i)LICEN[CS]E
(?:^|/)package(?:-lock|)\.json$
(?:^|/)vendor/
ignore$
\.avi$
\.ico$
\.jpe?g$
\.lock$
\.map$
\.min\..
\.mod$
\.mp[34]$
\.png$
\.wav$
^\.github/
^\Qplugins/archlinux/archlinux.plugin.zsh\E$
^\Qplugins/cp/cp.plugin.zsh\E$
^\Qplugins/extract/_extract\E$
^\Qplugins/genpass/genpass.plugin.zsh\E$
^\Qplugins/gitignore/gitignore.plugin.zsh\E$
^\Qplugins/gnu-utils/gnu-utils.plugin.zsh\E$
^\Qplugins/hitchhiker/fortunes/hitchhiker\E$
^\Qplugins/jhbuild/jhbuild.plugin.zsh\E$
^\Qplugins/jhbuild/README.md\E$
^\Qplugins/jruby/jruby.plugin.zsh\E$
^\Qplugins/kubectl/kubectl.plugin.zsh\E$
^\Qplugins/lol/lol.plugin.zsh\E$
^\Qplugins/mosh/mosh.plugin.zsh\E$
^\Qplugins/npx/npx.plugin.zsh\E$
^\Qplugins/powder/_powder\E$
^\Qplugins/suse/suse.plugin.zsh\E$
^\Qplugins/thor/_thor\E$
^\Qplugins/universalarchive/_universalarchive\E$
^\Qplugins/vagrant/vagrant.plugin.zsh\E$
^\Qplugins/wp-cli/README.md\E$
^\Qplugins/wp-cli/wp-cli.plugin.zsh\E$
^\Qthemes/clean.zsh-theme\E$
^\Qthemes/philips.zsh-theme\E$
^\Qthemes/tonotdo.zsh-theme\E$

4494
.github/actions/spelling/expect.txt vendored Normal file

File diff suppressed because it is too large Load diff

73
.github/actions/spelling/patterns.txt vendored Normal file
View file

@ -0,0 +1,73 @@
# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns
# YouTube
https?://(?:(?:www\.|)youtube\.com|youtu.be)/(?:channel/|embed/|playlist\?list=|watch\?v=|v/|)[-a-zA-Z0-9?&=_]*
<\s*youtube\s+id=['"][-a-zA-Z0-9?_]*['"]
\bimg\.youtube\.com/vi/[-a-zA-Z0-9?&=_]*
# Google Analytics
\bgoogle-analytics\.com/collect.[-0-9a-zA-Z?%=&_.~]*
# Google APIs
\bgoogleapis\.com/[a-z]+/v\d+/[a-z]+/[@./?=\w]+
\b[-a-zA-Z0-9.]*\bstorage\d*\.googleapis\.com(?:/\S*|)
# Google Calendar
\bcalendar\.google\.com/calendar(?:/u/\d+|)/embed\?src=[@./?=\w&%]+
\w+\@group\.calendar\.google\.com\b
# Google DataStudio
\bdatastudio\.google\.com/(?:(?:c/|)u/\d+/|)(?:embed/|)(?:open|reporting|datasources|s)/[-0-9a-zA-Z]+(?:/page/[-0-9a-zA-Z]+|)
# The leading `/` here is as opposed to the `\b` above
# ... a short way to match `https://` or `http://` since most urls have one of those prefixes
# Google Docs
/docs\.google\.com/[a-z]+/d/(?:e/|)[0-9a-zA-Z_-]+/?
# Google Drive
\bdrive\.google\.com/file/d/[0-9a-zA-Z_?=]*
# Google Groups
\bgroups\.google\.com/(?:forum/#!|d/)(?:msg|topic)/[^/]+/[a-zA-Z0-9]+(?:/[a-zA-Z0-9]+|)
# Google themes
themes\.googleusercontent\.com/static/fonts/[^/]+/v\d+/[^.]+.
# Google CDN
\bclients2\.google(?:usercontent|)\.com[-0-9a-zA-Z/.]*
# Goo.gl
/goo\.gl/[a-zA-Z0-9]+
# Google Chrome Store
\bchrome\.google\.com/webstore/detail/\w*(?:/\w*|)
# Google Books
\bbooks\.google\.(?:\w{2,4})/books\?[-\w\d=&#.]*
# Google Fonts
\bfonts\.(?:googleapis|gstatic)\.com/[-/?=:;+&0-9a-zA-Z]*
# GitHub SHAs
\bapi.github\.com/repos/[^/]+/[^/]+/[^/]+/[0-9a-f]+\b
(?:\[[0-9a-f]+\]\(https:/|)/(?:www\.|)github\.com/[^/]+/[^/]+(?:/[^/]+/[0-9a-f]+(?:[-0-9a-zA-Z/#.]*|)\b|)
\bgithub\.com/[^/]+/[^/]+[@#][0-9a-f]+\b
# githubusercontent
/[-a-z0-9]+\.githubusercontent\.com/[-a-zA-Z0-9?&=_\/.]*
# gist github
/gist\.github\.com/[^/]+/[0-9a-f]+
# git.io
\bgit\.io/[0-9a-zA-Z]+
# GitHub JSON
"node_id": "[-a-zA-Z=;:/0-9+]*"
# Contributor
\[[^\]]+]\(https://github\.com/[^/]+\)
# GHSA
GHSA(?:-[0-9a-z]{4}){3}
LS_COLORS=(["']).*?\g{-1}
(\\?)%[a-zA-Z]+\g{-1}(?!%)
# URL escaped characters
\%[0-9A-F]{2}
# hex digits including css/html color classes:
(?:[\\0][xX]|\\u|[uU]\+|#x?|\%23)[0-9a-fA-FgGrR_]{2,}(?:[uU]?[lL]{0,2}|u\d+)\b
# https://www.gnu.org/software/groff/manual/groff.html
# man troff content
\\f[BCIPR]
# Compiler flags
[\t "'`=]-[LPWXY]
[\t "'`=]-D(?!ebian)
# ignore long runs of a single character:
\b([A-Za-z])\g{-1}{3,}\b

7
.github/actions/spelling/reject.txt vendored Normal file
View file

@ -0,0 +1,7 @@
^attache$
benefitting
occurence
Sorce
^[Ss]pae
^untill
^wether

View file

@ -14,6 +14,7 @@ jobs:
tests:
name: Run tests
runs-on: ${{ matrix.os }}
if: github.repository == 'ohmyzsh/ohmyzsh'
strategy:
matrix:
os: [ubuntu-latest, macos-latest]

131
.github/workflows/project.yml vendored Normal file
View file

@ -0,0 +1,131 @@
name: Project tracking
on:
issues:
types: [opened]
pull_request_target:
types: [opened, synchronize]
jobs:
add-to-project:
name: Add to project
runs-on: ubuntu-latest
if: github.repository == 'ohmyzsh/ohmyzsh'
env:
GITHUB_TOKEN: ${{ secrets.PROJECT_TOKEN }}
steps:
- name: Read project data
env:
ORGANIZATION: ohmyzsh
PROJECT_NUMBER: "1"
run: |
# Get Project data
gh api graphql -f query='
query($org: String!, $number: Int!) {
organization(login: $org){
projectNext(number: $number) {
id
fields(first:20) {
nodes {
id
name
}
}
}
}
}
' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json
# Parse project data
cat >> $GITHUB_ENV <<EOF
PROJECT_ID=$(jq '.data.organization.projectNext.id' project_data.json)
PLUGIN_FIELD_ID=$(jq '.data.organization.projectNext.fields.nodes[] | select(.name == "Plugin") | .id' project_data.json)
THEME_FIELD_ID=$(jq '.data.organization.projectNext.fields.nodes[] | select(.name == "Theme") | .id' project_data.json)
EOF
- name: Add to project
env:
ISSUE_OR_PR_ID: ${{ github.event.issue.node_id || github.event.pull_request.node_id }}
run: |
item_id="$(gh api graphql -f query='
mutation($project: ID!, $content: ID!) {
addProjectNextItem(input: {projectId: $project, contentId: $content}) {
projectNextItem {
id
}
}
}
' -f project=$PROJECT_ID -f content=$ISSUE_OR_PR_ID --jq '.data.addProjectNextItem.projectNextItem.id')"
echo "ITEM_ID=$item_id" >> $GITHUB_ENV
- name: Classify Pull Request
if: github.event_name == 'pull_request_target'
run: |
touch plugins.list themes.list
gh pr view ${{ github.event.pull_request.number }} \
--repo ${{ github.repository }} \
--json files --jq '.files.[].path' | awk -F/ '
/^plugins\// {
plugins[$2] = 1
}
/^themes\// {
gsub(/\.zsh-theme$/, "", $2)
themes[$2] = 1
}
END {
for (plugin in plugins) {
print plugin >> "plugins.list"
}
for (theme in themes) {
print theme >> "themes.list"
}
}
'
# If only one plugin is modified, add it to the plugin field
if [[ $(wc -l < plugins.list) = 1 ]]; then
echo "PLUGIN=$(cat plugins.list)" >> $GITHUB_ENV
fi
# If only one theme is modified, add it to the theme field
if [[ $(wc -l < themes.list) = 1 ]]; then
echo "THEME=$(cat themes.list)" >> $GITHUB_ENV
fi
- name: Fill Pull Request fields in project
if: github.event_name == 'pull_request_target'
run: |
gh api graphql -f query='
mutation (
$project: ID!
$item: ID!
$plugin_field: ID!
$plugin_value: String!
$theme_field: ID!
$theme_value: String!
) {
set_plugin: updateProjectNextItemField(input: {
projectId: $project
itemId: $item
fieldId: $plugin_field
value: $plugin_value
}) {
projectNextItem {
id
}
}
set_theme: updateProjectNextItemField(input: {
projectId: $project
itemId: $item
fieldId: $theme_field
value: $theme_value
}) {
projectNextItem {
id
}
}
}
' -f project=$PROJECT_ID -f item=$ITEM_ID \
-f plugin_field=$PLUGIN_FIELD_ID -f plugin_value=$PLUGIN \
-f theme_field=$THEME_FIELD_ID -f theme_value=$THEME \
--silent

View file

@ -16,6 +16,7 @@ To learn more, visit [ohmyz.sh](https://ohmyz.sh), follow [@ohmyzsh](https://twi
[![Follow @ohmyzsh](https://img.shields.io/twitter/follow/ohmyzsh?label=Follow+@ohmyzsh&style=flat)](https://twitter.com/intent/follow?screen_name=ohmyzsh)
[![Discord server](https://img.shields.io/discord/642496866407284746)](https://discord.gg/ohmyzsh)
[![Gitpod ready](https://img.shields.io/badge/Gitpod-ready-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ohmyzsh/ohmyzsh)
[![huntr.dev](https://cdn.huntr.dev/huntr_security_badge_mono.svg)](https://huntr.dev/bounties/disclose/?utm_campaign=ohmyzsh%2Fohmyzsh&utm_medium=social&utm_source=github&target=https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh)
## Getting Started
@ -36,6 +37,8 @@ Oh My Zsh is installed by running one of the following commands in your terminal
| **wget** | `sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
| **fetch** | `sh -c "$(fetch -o - https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"` |
_Note that previous configuration in `.zshrc` will be placed in `.pre-oh-my-zsh`. After installation you can move configuration you want to preserve into `.zshrc`._
#### Manual inspection
It's a good idea to inspect the install script from projects you don't yet know. You can do

View file

@ -3,7 +3,8 @@
## Supported Versions
At the moment Oh My Zsh only considers the very latest commit to be supported.
We combine that with our fast response to incidents, so risk is minimized.
We combine that with our fast response to incidents and the automated updates
to minimize the time between vulnerability publication and patch release.
| Version | Supported |
|:-------------- |:------------------ |
@ -14,9 +15,10 @@ In the near future we will introduce versioning, so expect this section to chang
## Reporting a Vulnerability
If you find a vulnerability, email all the maintainers directly at:
**Do not submit an issue or pull request**: this might reveal the vulnerability.
- Robby: robby [at] planetargon.com
- Marc: hello [at] mcornella.com
Instead, you should email the maintainers directly at: [**security@ohmyz.sh**](mailto:security@ohmyz.sh).
**Do not open an issue or Pull Request directly**, because it might reveal the vulnerability.
We will deal with the vulnerability privately and submit a patch as soon as possible.
You can also submit your vulnerability report to [huntr.dev](https://huntr.dev/bounties/disclose/?utm_campaign=ohmyzsh%2Fohmyzsh&utm_medium=social&utm_source=github&target=https%3A%2F%2Fgithub.com%2Fohmyzsh%2Fohmyzsh) and see if you can get a bounty reward.

View file

@ -29,6 +29,7 @@ function _omz {
'reload:Reload the current zsh session'
'theme:Manage themes'
'update:Update Oh My Zsh'
'version:Show the version'
)
if (( CURRENT == 2 )); then
@ -36,7 +37,7 @@ function _omz {
elif (( CURRENT == 3 )); then
case "$words[2]" in
changelog) local -a refs
refs=("${(@f)$(cd "$ZSH"; command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}")
refs=("${(@f)$(builtin cd -q "$ZSH"; command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}")
_describe 'command' refs ;;
plugin) subcmds=(
'disable:Disable plugin(s)'
@ -60,17 +61,19 @@ function _omz {
# if command is "disable", only offer already enabled plugins
valid_plugins=($plugins)
else
valid_plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t))
valid_plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t))
# if command is "enable", remove already enabled plugins
[[ "${words[3]}" = enable ]] && valid_plugins=(${valid_plugins:|plugins})
fi
_describe 'plugin' valid_plugins ;;
plugin::info)
local -aU plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t))
local -aU plugins
plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t))
_describe 'plugin' plugins ;;
theme::(set|use))
local -aU themes=("$ZSH"/themes/*.zsh-theme(.N:t:r) "$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::))
local -aU themes
themes=("$ZSH"/themes/*.zsh-theme(-.N:t:r) "$ZSH_CUSTOM"/**/*.zsh-theme(-.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::))
_describe 'theme' themes ;;
esac
elif (( CURRENT > 4 )); then
@ -82,7 +85,7 @@ function _omz {
# if command is "disable", only offer already enabled plugins
valid_plugins=($plugins)
else
valid_plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(.N:h:t))
valid_plugins=("$ZSH"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t) "$ZSH_CUSTOM"/plugins/*/{_*,*.plugin.zsh}(-.N:h:t))
# if command is "enable", remove already enabled plugins
[[ "${words[3]}" = enable ]] && valid_plugins=(${valid_plugins:|plugins})
fi
@ -164,6 +167,7 @@ Available commands:
reload Reload the current zsh session
theme <command> Manage themes
update Update Oh My Zsh
version Show the version
EOF
}
@ -172,13 +176,13 @@ function _omz::changelog {
local version=${1:-HEAD} format=${3:-"--text"}
if (
cd "$ZSH"
builtin cd -q "$ZSH"
! command git show-ref --verify refs/heads/$version && \
! command git show-ref --verify refs/tags/$version && \
! command git rev-parse --verify "${version}^{commit}"
) &>/dev/null; then
cat >&2 <<EOF
Usage: omz changelog [version]
Usage: ${(j: :)${(s.::.)0#_}} [version]
NOTE: <version> must be a valid branch, tag or commit.
EOF
@ -189,9 +193,9 @@ EOF
}
function _omz::plugin {
(( $# > 0 && $+functions[_omz::plugin::$1] )) || {
(( $# > 0 && $+functions[$0::$1] )) || {
cat >&2 <<EOF
Usage: omz plugin <command> [options]
Usage: ${(j: :)${(s.::.)0#_}} <command> [options]
Available commands:
@ -208,12 +212,12 @@ EOF
local command="$1"
shift
_omz::plugin::$command "$@"
$0::$command "$@"
}
function _omz::plugin::disable {
if [[ -z "$1" ]]; then
echo >&2 "Usage: omz plugin disable <plugin> [...]"
echo >&2 "Usage: ${(j: :)${(s.::.)0#_}} <plugin> [...]"
return 1
fi
@ -272,9 +276,10 @@ multi == 1 && length(\$0) > 0 {
{ print \$0 }
"
awk "$awk_script" ~/.zshrc > ~/.zshrc.new \
&& command mv -f ~/.zshrc ~/.zshrc.bck \
&& command mv -f ~/.zshrc.new ~/.zshrc
local zdot="${ZDOTDIR:-$HOME}"
awk "$awk_script" "$zdot/.zshrc" > "$zdot/.zshrc.new" \
&& command mv -f "$zdot/.zshrc" "$zdot/.zshrc.bck" \
&& command mv -f "$zdot/.zshrc.new" "$zdot/.zshrc"
# Exit if the new .zshrc file wasn't created correctly
[[ $? -eq 0 ]] || {
@ -284,10 +289,10 @@ multi == 1 && length(\$0) > 0 {
}
# Exit if the new .zshrc file has syntax errors
if ! zsh -n ~/.zshrc; then
_omz::log error "broken syntax in ~/.zshrc. Rolling back changes..."
command mv -f ~/.zshrc ~/.zshrc.new
command mv -f ~/.zshrc.bck ~/.zshrc
if ! command zsh -n "$zdot/.zshrc"; then
_omz::log error "broken syntax in '"${zdot/#$HOME/\~}/.zshrc"'. Rolling back changes..."
command mv -f "$zdot/.zshrc" "$zdot/.zshrc.new"
command mv -f "$zdot/.zshrc.bck" "$zdot/.zshrc"
return 1
fi
@ -302,7 +307,7 @@ multi == 1 && length(\$0) > 0 {
function _omz::plugin::enable {
if [[ -z "$1" ]]; then
echo >&2 "Usage: omz plugin enable <plugin> [...]"
echo >&2 "Usage: ${(j: :)${(s.::.)0#_}} <plugin> [...]"
return 1
fi
@ -347,9 +352,10 @@ multi == 1 && /^[^#]*\)/ {
{ print \$0 }
"
awk "$awk_script" ~/.zshrc > ~/.zshrc.new \
&& command mv -f ~/.zshrc ~/.zshrc.bck \
&& command mv -f ~/.zshrc.new ~/.zshrc
local zdot="${ZDOTDIR:-$HOME}"
awk "$awk_script" "$zdot/.zshrc" > "$zdot/.zshrc.new" \
&& command mv -f "$zdot/.zshrc" "$zdot/.zshrc.bck" \
&& command mv -f "$zdot/.zshrc.new" "$zdot/.zshrc"
# Exit if the new .zshrc file wasn't created correctly
[[ $? -eq 0 ]] || {
@ -359,10 +365,10 @@ multi == 1 && /^[^#]*\)/ {
}
# Exit if the new .zshrc file has syntax errors
if ! zsh -n ~/.zshrc; then
_omz::log error "broken syntax in ~/.zshrc. Rolling back changes..."
command mv -f ~/.zshrc ~/.zshrc.new
command mv -f ~/.zshrc.bck ~/.zshrc
if ! command zsh -n "$zdot/.zshrc"; then
_omz::log error "broken syntax in '"${zdot/#$HOME/\~}/.zshrc"'. Rolling back changes..."
command mv -f "$zdot/.zshrc" "$zdot/.zshrc.new"
command mv -f "$zdot/.zshrc.bck" "$zdot/.zshrc"
return 1
fi
@ -377,7 +383,7 @@ multi == 1 && /^[^#]*\)/ {
function _omz::plugin::info {
if [[ -z "$1" ]]; then
echo >&2 "Usage: omz plugin info <plugin>"
echo >&2 "Usage: ${(j: :)${(s.::.)0#_}} <plugin>"
return 1
fi
@ -424,7 +430,7 @@ function _omz::plugin::list {
function _omz::plugin::load {
if [[ -z "$1" ]]; then
echo >&2 "Usage: omz plugin load <plugin> [...]"
echo >&2 "Usage: ${(j: :)${(s.::.)0#_}} <plugin> [...]"
return 1
fi
@ -471,9 +477,9 @@ function _omz::plugin::load {
}
function _omz::pr {
(( $# > 0 && $+functions[_omz::pr::$1] )) || {
(( $# > 0 && $+functions[$0::$1] )) || {
cat >&2 <<EOF
Usage: omz pr <command> [options]
Usage: ${(j: :)${(s.::.)0#_}} <command> [options]
Available commands:
@ -487,7 +493,7 @@ EOF
local command="$1"
shift
_omz::pr::$command "$@"
$0::$command "$@"
}
function _omz::pr::clean {
@ -528,7 +534,7 @@ function _omz::pr::test {
# Check the input
if ! [[ -n "$1" && "$1" =~ ^[[:digit:]]+$ ]]; then
echo >&2 "Usage: omz pr test <PR_NUMBER_or_URL>"
echo >&2 "Usage: ${(j: :)${(s.::.)0#_}} <PR_NUMBER_or_URL>"
return 1
fi
@ -613,9 +619,9 @@ function _omz::reload {
}
function _omz::theme {
(( $# > 0 && $+functions[_omz::theme::$1] )) || {
(( $# > 0 && $+functions[$0::$1] )) || {
cat >&2 <<EOF
Usage: omz theme <command> [options]
Usage: ${(j: :)${(s.::.)0#_}} <command> [options]
Available commands:
@ -630,7 +636,7 @@ EOF
local command="$1"
shift
_omz::theme::$command "$@"
$0::$command "$@"
}
function _omz::theme::list {
@ -665,7 +671,7 @@ function _omz::theme::list {
function _omz::theme::set {
if [[ -z "$1" ]]; then
echo >&2 "Usage: omz theme set <theme>"
echo >&2 "Usage: ${(j: :)${(s.::.)0#_}} <theme>"
return 1
fi
@ -694,17 +700,18 @@ END {
}
'
awk "$awk_script" ~/.zshrc > ~/.zshrc.new \
local zdot="${ZDOTDIR:-$HOME}"
awk "$awk_script" "$zdot/.zshrc" > "$zdot/.zshrc.new" \
|| {
# Prepend ZSH_THEME= line to .zshrc if it doesn't exist
cat <<EOF
ZSH_THEME="$1" # set by \`omz\`
EOF
cat ~/.zshrc
} > ~/.zshrc.new \
&& command mv -f ~/.zshrc ~/.zshrc.bck \
&& command mv -f ~/.zshrc.new ~/.zshrc
cat "$zdot/.zshrc"
} > "$zdot/.zshrc.new" \
&& command mv -f "$zdot/.zshrc" "$zdot/.zshrc.bck" \
&& command mv -f "$zdot/.zshrc.new" "$zdot/.zshrc"
# Exit if the new .zshrc file wasn't created correctly
[[ $? -eq 0 ]] || {
@ -714,10 +721,10 @@ EOF
}
# Exit if the new .zshrc file has syntax errors
if ! zsh -n ~/.zshrc; then
_omz::log error "broken syntax in ~/.zshrc. Rolling back changes..."
command mv -f ~/.zshrc ~/.zshrc.new
command mv -f ~/.zshrc.bck ~/.zshrc
if ! command zsh -n "$zdot/.zshrc"; then
_omz::log error "broken syntax in '"${zdot/#$HOME/\~}/.zshrc"'. Rolling back changes..."
command mv -f "$zdot/.zshrc" "$zdot/.zshrc.new"
command mv -f "$zdot/.zshrc.bck" "$zdot/.zshrc"
return 1
fi
@ -732,7 +739,7 @@ EOF
function _omz::theme::use {
if [[ -z "$1" ]]; then
echo >&2 "Usage: omz theme use <theme>"
echo >&2 "Usage: ${(j: :)${(s.::.)0#_}} <theme>"
return 1
fi
@ -754,13 +761,13 @@ function _omz::theme::use {
}
function _omz::update {
local last_commit=$(cd "$ZSH"; git rev-parse HEAD)
local last_commit=$(builtin cd -q "$ZSH"; git rev-parse HEAD)
# Run update script
if [[ "$1" != --unattended ]]; then
ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" --interactive || return $?
ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" --interactive || return $?
else
ZSH="$ZSH" zsh -f "$ZSH/tools/upgrade.sh" || return $?
ZSH="$ZSH" command zsh -f "$ZSH/tools/upgrade.sh" || return $?
fi
# Update last updated file
@ -770,10 +777,32 @@ function _omz::update {
command rm -rf "$ZSH/log/update.lock"
# Restart the zsh session if there were changes
if [[ "$1" != --unattended && "$(cd "$ZSH"; git rev-parse HEAD)" != "$last_commit" ]]; then
if [[ "$1" != --unattended && "$(builtin cd -q "$ZSH"; git rev-parse HEAD)" != "$last_commit" ]]; then
# Old zsh versions don't have ZSH_ARGZERO
local zsh="${ZSH_ARGZERO:-${functrace[-1]%:*}}"
# Check whether to run a login shell
[[ "$zsh" = -* || -o login ]] && exec -l "${zsh#-}" || exec "$zsh"
fi
}
function _omz::version {
(
builtin cd -q "$ZSH"
# Get the version name:
# 1) try tag-like version
# 2) try branch name
# 3) try name-rev (tag~<rev> or branch~<rev>)
local version
version=$(command git describe --tags HEAD 2>/dev/null) \
|| version=$(command git symbolic-ref --quiet --short HEAD 2>/dev/null) \
|| version=$(command git name-rev --no-undefined --name-only --exclude="remotes/*" HEAD 2>/dev/null) \
|| version="<detached>"
# Get short hash for the current HEAD
local commit=$(command git rev-parse --short HEAD 2>/dev/null)
# Show version and commit hash
printf "%s (%s)\n" "$version" "$commit"
)
}

View file

@ -29,7 +29,7 @@ function git_prompt_info() {
&& upstream=" -> ${upstream}"
fi
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref}${upstream}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
echo "${ZSH_THEME_GIT_PROMPT_PREFIX}${ref:gs/%/%%}${upstream:gs/%/%%}$(parse_git_dirty)${ZSH_THEME_GIT_PROMPT_SUFFIX}"
}
# Checks if working tree is dirty
@ -82,7 +82,7 @@ function git_remote_status() {
fi
if [[ -n $ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_DETAILED ]]; then
git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX$remote$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX"
git_remote_status="$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_PREFIX${remote:gs/%/%%}$git_remote_status_detailed$ZSH_THEME_GIT_PROMPT_REMOTE_STATUS_SUFFIX"
fi
echo $git_remote_status

View file

@ -2,5 +2,5 @@
function nvm_prompt_info() {
which nvm &>/dev/null || return
local nvm_prompt=${$(nvm current)#v}
echo "${ZSH_THEME_NVM_PROMPT_PREFIX}${nvm_prompt}${ZSH_THEME_NVM_PROMPT_SUFFIX}"
echo "${ZSH_THEME_NVM_PROMPT_PREFIX}${nvm_prompt:gs/%/%%}${ZSH_THEME_NVM_PROMPT_SUFFIX}"
}

View file

@ -30,7 +30,7 @@ function rvm_prompt_info() {
local rvm_prompt
rvm_prompt=$($HOME/.rvm/bin/rvm-prompt ${=ZSH_THEME_RVM_PROMPT_OPTIONS} 2>/dev/null)
[[ -z "${rvm_prompt}" ]] && return 1
echo "${ZSH_THEME_RUBY_PROMPT_PREFIX}${rvm_prompt}${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
echo "${ZSH_THEME_RUBY_PROMPT_PREFIX}${rvm_prompt:gs/%/%%}${ZSH_THEME_RUBY_PROMPT_SUFFIX}"
}
ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"

View file

@ -10,7 +10,7 @@ function title {
setopt localoptions nopromptsubst
# Don't set the title if inside emacs, unless using vterm
[[ -n "$INSIDE_EMACS" && "$INSIDE_EMACS" != vterm ]] && return
[[ -n "${INSIDE_EMACS:-}" && "$INSIDE_EMACS" != vterm ]] && return
# if $2 is unset use $1 as default
# if it is set and empty, leave it as is

View file

@ -0,0 +1,46 @@
if (( ${+commands[op]} )); then
eval "$(op completion zsh)"
compdef _op op
fi
# opswd puts the password of the named service into the clipboard. If there's a
# one time password, it will be copied into the clipboard after 5 seconds. The
# clipboard is cleared after another 10 seconds.
function opswd() {
if [[ $# -lt 1 ]]; then
echo "Usage: opswd <service>"
return 1
fi
local service=$1
# If not logged in, print error and return
op list users > /dev/null || return
local password
# Copy the password to the clipboard
if ! password=$(op get item "$service" --fields password 2>/dev/null); then
echo "error: could not obtain password for $service"
return 1
fi
echo -n "$password" | clipcopy
echo "✔ password for $service copied to clipboard"
# If there's a one time password, copy it to the clipboard after 5 seconds
local totp
if totp=$(op get totp "$service" 2>/dev/null) && [[ -n "$totp" ]]; then
sleep 10 && echo -n "$totp" | clipcopy
echo "✔ TOTP for $service copied to clipboard"
fi
(sleep 20 && clipcopy </dev/null 2>/dev/null) &!
}
function _opswd() {
local -a services
services=("${(@f)$(op list items --categories Login 2>/dev/null | op get item - --fields title 2>/dev/null)}")
[[ -z "$services" ]] || compadd -a -- services
}
compdef _opswd opswd

View file

@ -0,0 +1,35 @@
# 1Password
This plugin adds 1Password functionality to oh-my-zsh.
To use, add `1password` to the list of plugins in your `.zshrc` file:
```zsh
plugins=(... 1password)
```
Then, you can use the command `opswd` to copy passwords for services into your
clipboard.
## `opswd`
The `opswd` command is a wrapper around the `op` command. It takes a service
name as an argument and copies the password for that service to the clipboard.
If the service also contains a TOTP, it is copied to the clipboard after 10 seconds.
Finally, after 20 seconds, the clipboard is cleared.
The function has completion support, so you can use tab completion to select
which service you want to get.
For example, `opswd github.com` will put your GitHub password into your clipboard, and if
a TOTP is available, it will be copied to the clipboard after 10 seconds.
> NOTE: you need to be logged in for `opswd` to work. See:
>
> - [Sign in or out](https://support.1password.com/command-line/#sign-in-or-out)
> - [Session management](https://support.1password.com/command-line/#appendix-session-management)
## Requirements
- [1Password's command line utility](https://1password.com/downloads/command-line/).

1
plugins/aliases/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
__pycache__

View file

@ -1,21 +1,22 @@
## Aliases Cheatsheet
# Aliases cheatsheet
**Maintainer:** [@hqingyi](https://github.com/hqingyi)
With lots of 3rd-party amazing aliases installed, this plugin helps list the shortcuts
that are currently available based on the plugins you have enabled.
Enable this plugin by adding it to your `plugins` definition in `~/.zshrc`.
To use it, add `aliases` to the plugins array in your zshrc file:
```
plugins=(aliases)
```
```zsh
plugins=(aliases)
```
Requirements: Python needs to be installed.
### Usage
## Usage
```
acs: group all alias
acs $keywordquickly filter alias & highlight
```
- `acs`: show all aliases by group.
- `acs <keyword>`: filter aliases by `<keyword>` and highlight.
![screenshot](https://cloud.githubusercontent.com/assets/3602957/11581913/cb54fb8a-9a82-11e5-846b-5a67f67ad9ad.png)

View file

@ -2,9 +2,10 @@
#
# - acs: alias cheatsheet
# group alias by command, pass addition argv to grep.
ALIASES_PLUGIN_ROOT=$(cd `dirname $0` && pwd)
function acs(){
which python >>/dev/null
[[ $? -eq 1 ]] && echo "[error]no python executable detected!" && return
alias | python $ALIASES_PLUGIN_ROOT/cheatsheet.py $@
(( $+commands[python] )) || {
echo "[error] No python executable detected"
return
}
alias | python ${functions_source[$0]:h}/cheatsheet.py $@
}

View file

@ -26,16 +26,16 @@ def cheatsheet(lines):
target_aliases.extend(group_list)
return cheatsheet
def pretty_print_group(key, aliases, hightlight=None):
def pretty_print_group(key, aliases, highlight=None):
if len(aliases) == 0:
return
group_hl_formatter = lambda g, hl: termcolor.colored(hl, 'yellow').join([termcolor.colored(part, 'red') for part in ('[%s]' % g).split(hl)])
alias_hl_formatter = lambda alias, hl: termcolor.colored(hl, 'yellow').join([termcolor.colored(part, 'green') for part in ('\t%s = %s' % alias[0:2]).split(hl)])
group_formatter = lambda g: termcolor.colored('[%s]' % g, 'red')
alias_formatter = lambda alias: termcolor.colored('\t%s = %s' % alias[0:2], 'green')
if hightlight and len(hightlight)>0:
print (group_hl_formatter(key, hightlight))
print ('\n'.join([alias_hl_formatter(alias, hightlight) for alias in aliases]))
if highlight and len(highlight)>0:
print (group_hl_formatter(key, highlight))
print ('\n'.join([alias_hl_formatter(alias, highlight) for alias in aliases]))
else:
print (group_formatter(key))
print ('\n'.join([alias_formatter(alias) for alias in aliases]))

View file

@ -21,7 +21,7 @@
#
# Author: Konstantin Lepa <konstantin.lepa@gmail.com>
"""ANSII Color formatting for output in terminal."""
"""ANSI Color formatting for output in terminal."""
from __future__ import print_function
import os

View file

@ -2,9 +2,9 @@
This plugin provides completion for [Ant](https://ant.apache.org/).
To use it add ant to the plugins array in your zshrc file.
To use it, add `ant` to the plugins array in your zshrc file:
```bash
```zsh
plugins=(... ant)
```

22
plugins/ant/_ant Normal file
View file

@ -0,0 +1,22 @@
#compdef ant
_ant_does_target_list_need_generating () {
[[ ! -f .ant_targets ]] && return 0
[[ build.xml -nt .ant_targets ]] && return 0
return 1
}
_ant () {
if [[ ! -f build.xml ]]; then
return
fi
if ! _ant_does_target_list_need_generating; then
return
fi
ant -p | awk -F " " 'NR > 5 { print lastTarget } { lastTarget = $1 }' >| .ant_targets
compadd -- "$(cat .ant_targets)"
}
_ant "$@"

View file

@ -1,16 +1,2 @@
_ant_does_target_list_need_generating () {
[ ! -f .ant_targets ] && return 0;
[ build.xml -nt .ant_targets ] && return 0;
return 1;
}
_ant () {
if [ -f build.xml ]; then
if _ant_does_target_list_need_generating; then
ant -p | awk -F " " 'NR > 5 { print lastTarget }{lastTarget = $1}' > .ant_targets
fi
compadd -- `cat .ant_targets`
fi
}
compdef _ant ant
# Default to colored output
export ANT_ARGS='-logger org.apache.tools.ant.listener.AnsiColorLogger'

View file

@ -14,6 +14,7 @@ plugins=(... arcanist)
| ------- | ---------------------------------- |
| ara | `arc amend` |
| arb | `arc branch` |
| arbl | `arc bland` |
| arco | `arc cover` |
| arci | `arc commit` |
| ard | `arc diff` |
@ -24,6 +25,7 @@ plugins=(... arcanist)
| ardpc | `arc diff --plan-changes` |
| are | `arc export` |
| arh | `arc help` |
| arho | `arc hotfix` |
| arl | `arc land` |
| arli | `arc lint` |
| arls | `arc list` |

View file

@ -5,6 +5,7 @@
alias ara='arc amend'
alias arb='arc branch'
alias arbl='arc bland'
alias arco='arc cover'
alias arci='arc commit'
@ -17,6 +18,7 @@ alias ardp='arc diff --preview' # creates a new diff in the phab interface
alias are='arc export'
alias arh='arc help'
alias arho='arc hotfix'
alias arl='arc land'
alias arli='arc lint'
alias arls='arc list'

View file

@ -17,8 +17,10 @@ plugins=(... archlinux)
| pacin | `sudo pacman -S` | Install packages from the repositories |
| pacins | `sudo pacman -U` | Install a package from a local file |
| pacinsd | `sudo pacman -S --asdeps` | Install packages as dependencies of another package |
| paclean | `sudo pacman -Sc` | Clean out old and unused caches and packages |
| pacloc | `pacman -Qi` | Display information about a package in the local database |
| paclocs | `pacman -Qs` | Search for packages in the local database |
| paclr | `sudo pacman -Scc` | Remove all files from the cache |
| paclsorphans | `sudo pacman -Qdt` | List all orphaned packages |
| pacmir | `sudo pacman -Syy` | Force refresh of all package lists after updating mirrorlist |
| pacre | `sudo pacman -R` | Remove packages, keeping its settings and dependencies |
@ -52,6 +54,8 @@ upgrades were available. Use `pacman -Que` instead.
| Alias | Command | Description |
|---------|-------------------------------------------------|-------------------------------------------------------------------------|
| auclean | `sudo aura -Sc` | Clean out old and unused caches and packages |
| auclr | `sudo aura -Scc` | Remove all files from the cache |
| auin | `sudo aura -S` | Install packages from the repositories |
| aurin | `sudo aura -A` | Install packages from the repositories |
| auins | `sudo aura -U` | Install a package from a local file |
@ -84,6 +88,8 @@ upgrades were available. Use `pacman -Que` instead.
| Alias | Command | Description |
|---------|-----------------------------------|---------------------------------------------------------------------|
| pacclean| `pacaur -Sc` | Clean out old and unused caches and packages |
| pacclr | `pacaur -Scc` | Remove all files from the cache |
| pain | `pacaur -S` | Install packages from the repositories |
| pains | `pacaur -U` | Install a package from a local file |
| painsd | `pacaur -S --asdeps` | Install packages as dependencies of another package |
@ -106,6 +112,8 @@ upgrades were available. Use `pacman -Que` instead.
| Alias | Command | Description |
|---------|-----------------------------------|---------------------------------------------------------------------|
| trconf | `trizen -C` | Fix all configuration files with vimdiff |
| trclean | `trizen -Sc` | Clean out old and unused caches and packages |
| trclr | `trizen -Scc` | Remove all files from the cache |
| trin | `trizen -S` | Install packages from the repositories |
| trins | `trizen -U` | Install a package from a local file |
| trinsd | `trizen -S --asdeps` | Install packages as dependencies of another package |
@ -128,6 +136,8 @@ upgrades were available. Use `pacman -Que` instead.
| Alias | Command | Description |
|---------|--------------------------------|-------------------------------------------------------------------|
| yaconf | `yay -Pg` | Print current configuration |
| yaclean | `yay -Sc` | Clean out old and unused caches and packages |
| yaclr | `yay -Scc` | Remove all files from the cache |
| yain | `yay -S` | Install packages from the repositories |
| yains | `yay -U` | Install a package from a local file |
| yainsd | `yay -S --asdeps` | Install packages as dependencies of another package |
@ -170,3 +180,4 @@ whether the package manager is installed, checked in the following order:
- ornicar - thibault.duplessis@gmail.com
- Ybalrid (Arthur Brainville) - ybalrid@ybalrid.info
- Jeff M. Hubbard - jeffmhubbard@gmail.com
- K. Harishankar(harishnkr) - hari2menon1234@gmail.com

View file

@ -5,7 +5,9 @@
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
alias pacupg='sudo pacman -Syu'
alias pacin='sudo pacman -S'
alias paclean='sudo pacman -Sc'
alias pacins='sudo pacman -U'
alias paclr='sudo pacman -Scc'
alias pacre='sudo pacman -R'
alias pacrem='sudo pacman -Rns'
alias pacrep='pacman -Si'
@ -88,6 +90,8 @@ fi
if (( $+commands[aura] )); then
alias auin='sudo aura -S'
alias aurin='sudo aura -A'
alias auclean='sudo aura -Sc'
alias auclr='sudo aura -Scc'
alias auins='sudo aura -U'
alias auinsd='sudo aura -S --asdeps'
alias aurinsd='sudo aura -A --asdeps'
@ -115,6 +119,8 @@ if (( $+commands[aura] )); then
fi
if (( $+commands[pacaur] )); then
alias pacclean='pacaur -Sc'
alias pacclr='pacaur -Scc'
alias paupg='pacaur -Syu'
alias pasu='pacaur -Syu --noconfirm'
alias pain='pacaur -S'
@ -138,6 +144,8 @@ if (( $+commands[trizen] )); then
alias trupg='trizen -Syua'
alias trsu='trizen -Syua --noconfirm'
alias trin='trizen -S'
alias trclean='trizen -Sc'
alias trclr='trizen -Scc'
alias trins='trizen -U'
alias trre='trizen -R'
alias trrem='trizen -Rns'
@ -155,6 +163,8 @@ fi
if (( $+commands[yay] )); then
alias yaconf='yay -Pg'
alias yaclean='yay -Sc'
alias yaclr='yay -Scc'
alias yaupg='yay -Syu'
alias yasu='yay -Syu --noconfirm'
alias yain='yay -S'

View file

@ -2,18 +2,26 @@
ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
ASDF_COMPLETIONS="$ASDF_DIR/completions"
# If not found, check for archlinux/AUR package (/opt/asdf-vm/)
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && [[ -f "/opt/asdf-vm/asdf.sh" ]]; then
ASDF_DIR="/opt/asdf-vm"
ASDF_COMPLETIONS="$ASDF_DIR"
fi
# If not found, check for Homebrew package
if [[ ! -f "$ASDF_DIR/asdf.sh" || ! -f "$ASDF_COMPLETIONS/asdf.bash" ]] && (( $+commands[brew] )); then
ASDF_DIR="$(brew --prefix asdf)"
ASDF_COMPLETIONS="$ASDF_DIR/etc/bash_completion.d"
brew_prefix="$(brew --prefix asdf)"
ASDF_DIR="${brew_prefix}/libexec"
ASDF_COMPLETIONS="${brew_prefix}/etc/bash_completion.d"
unset brew_prefix
fi
# Load command
if [[ -f "$ASDF_DIR/asdf.sh" ]]; then
. "$ASDF_DIR/asdf.sh"
. "$ASDF_DIR/asdf.sh"
# Load completions
if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then
. "$ASDF_COMPLETIONS/asdf.bash"
fi
# Load completions
if [[ -f "$ASDF_COMPLETIONS/asdf.bash" ]]; then
. "$ASDF_COMPLETIONS/asdf.bash"
fi
fi

View file

@ -8,6 +8,7 @@ autojump_paths=(
/etc/profile.d/autojump.zsh # manual installation
/etc/profile.d/autojump.sh # Gentoo installation
/usr/local/share/autojump/autojump.zsh # FreeBSD installation
/usr/pkg/share/autojump/autojump.zsh # NetBSD installation
/opt/local/etc/profile.d/autojump.sh # macOS with MacPorts
/usr/local/etc/profile.d/autojump.sh # macOS with Homebrew (default)
/opt/homebrew/etc/profile.d/autojump.sh # macOS with Homebrew (default on M1 macs)

View file

@ -14,11 +14,12 @@ plugins=(... aws)
* `asp [<profile>]`: sets `$AWS_PROFILE` and `$AWS_DEFAULT_PROFILE` (legacy) to `<profile>`.
It also sets `$AWS_EB_PROFILE` to `<profile>` for the Elastic Beanstalk CLI.
Run `asp` without arguments to clear the profile.
* `asp [<profile>] login`: If AWS SSO has been configured in your aws profile, it will run the `aws sso login` command following profile selection.
* `acp [<profile>]`: in addition to `asp` functionality, it actually changes the profile by
assuming the role specified in the `<profile>` configuration. It supports MFA and sets
`$AWS_ACCESS_KEY_ID`, `$AWS_SECRET_ACCESS_KEY` and `$AWS_SESSION_TOKEN`, if obtained. It
requires the roles to be configured as per the
* `acp [<profile>] [<mfa_token>]`: in addition to `asp` functionality, it actually changes
the profile by assuming the role specified in the `<profile>` configuration. It supports
MFA and sets `$AWS_ACCESS_KEY_ID`, `$AWS_SECRET_ACCESS_KEY` and `$AWS_SESSION_TOKEN`, if
obtained. It requires the roles to be configured as per the
[official guide](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html).
Run `acp` without arguments to clear the profile.

View file

@ -21,6 +21,10 @@ function asp() {
export AWS_DEFAULT_PROFILE=$1
export AWS_PROFILE=$1
export AWS_EB_PROFILE=$1
if [[ "$2" == "login" ]]; then
aws sso login
fi
}
# AWS profile switch
@ -41,6 +45,7 @@ function acp() {
fi
local profile="$1"
local mfa_token="$2"
# Get fallback credentials for if the aws command fails or no command is run
local aws_access_key_id="$(aws configure get aws_access_key_id --profile $profile)"
@ -54,9 +59,10 @@ function acp() {
if [[ -n "$mfa_serial" ]]; then
local -a mfa_opt
local mfa_token
echo -n "Please enter your MFA token for $mfa_serial: "
read -r mfa_token
if [[ -z "$mfa_token" ]]; then
echo -n "Please enter your MFA token for $mfa_serial: "
read -r mfa_token
fi
if [[ -z "$sess_duration" ]]; then
echo -n "Please enter the session duration in seconds (900-43200; default: 3600, which is the default maximum for a role): "
read -r sess_duration
@ -151,8 +157,8 @@ compctl -K _aws_profiles asp acp aws_change_access_key
# AWS prompt
function aws_prompt_info() {
[[ -z $AWS_PROFILE ]] && return
echo "${ZSH_THEME_AWS_PREFIX:=<aws:}${AWS_PROFILE}${ZSH_THEME_AWS_SUFFIX:=>}"
[[ -n "$AWS_PROFILE" ]] || return
echo "${ZSH_THEME_AWS_PREFIX:=<aws:}${AWS_PROFILE:gs/%/%%}${ZSH_THEME_AWS_SUFFIX:=>}"
}
if [[ "$SHOW_AWS_PROMPT" != false && "$RPROMPT" != *'$(aws_prompt_info)'* ]]; then

View file

@ -164,7 +164,7 @@ _get_build_targets() {
;;
esac
completions=(${$(_bazel_b query "kind(\"${rule_re}\", ${pkg}:all)" 2>/dev/null)##*:})
if ( (( ${#completions} > 0 )) && [[ $target_type != run ]] ); then
if ( (( ${#completions} > 0 )) && [[ $target_type != bin ]] ); then
completions+=(all)
fi
echo ${completions[*]}

View file

@ -9,7 +9,7 @@ _bower_installed_packages () {
}
_bower ()
{
local -a _1st_arguments _no_color _dopts _save_dev _force_lastest _production
local -a _1st_arguments _no_color _dopts _save_dev _force_latest _production
local expl
typeset -A opt_args
@ -22,7 +22,7 @@ _bower ()
_save_dev=('(--save-dev)--save-dev[Save installed packages into the project"s bower.json devDependencies]')
_force_lastest=('(--force-latest)--force-latest[Force latest version on conflict]')
_force_latest=('(--force-latest)--force-latest[Force latest version on conflict]')
_production=('(--production)--production[Do not install project devDependencies]')
@ -54,7 +54,7 @@ _bower ()
_arguments \
$_dopts \
$_save_dev \
$_force_lastest \
$_force_latest \
$_no_color \
$_production
;;
@ -62,7 +62,7 @@ _bower ()
_arguments \
$_dopts \
$_no_color \
$_force_lastest
$_force_latest
_bower_installed_packages
compadd "$@" $(echo $bower_package_list)
;;

View file

@ -1,31 +1,47 @@
# Branch
# Branch plugin
Displays the current Git or Mercurial branch fast.
This plugin displays the current Git or Mercurial branch, fast. If in a Mercurial repository,
also display the current bookmark, if present.
To use it, add `branch` to the plugins array in your zshrc file:
```zsh
plugins=(... branch)
```
## Speed test
### Mercurial
- `hg branch`:
```shell
$ time hg branch
0.11s user 0.14s system 70% cpu 0.355 total
```
```console
$ time hg branch
0.11s user 0.14s system 70% cpu 0.355 total
```
### Branch plugin
- branch plugin:
```shell
$ time zsh /tmp/branch_prompt_info_test.zsh
0.00s user 0.01s system 78% cpu 0.014 total
```
```console
$ time zsh /tmp/branch_prompt_info_test.zsh
0.00s user 0.01s system 78% cpu 0.014 total
```
## Usage
Edit your theme file (eg.: `~/.oh-my-zsh/theme/robbyrussell.zsh-theme`)
adding `$(branch_prompt_info)` in your prompt like this:
Copy your theme to `$ZSH_CUSTOM/themes/` and modify it to add `$(branch_prompt_info)` in your prompt.
This example is for the `robbyrussell` theme:
```diff
- PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
+ PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)$(branch_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme
index 2fd5f2cd..9d89a464 100644
--- a/themes/robbyrussell.zsh-theme
+++ b/themes/robbyrussell.zsh-theme
@@ -1,5 +1,5 @@
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
-PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
+PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(branch_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
```
## Maintainer

View file

@ -3,29 +3,33 @@
# Oct 2, 2015
function branch_prompt_info() {
# Defines path as current directory
local current_dir=$PWD
# While current path is not root path
while [[ $current_dir != '/' ]]
do
# Git repository
if [[ -d "${current_dir}/.git" ]]
then
echo '±' ${"$(<"$current_dir/.git/HEAD")"##*/}
return;
# Start checking in current working directory
local branch="" dir="$PWD"
while [[ "$dir" != '/' ]]; do
# Found .git directory
if [[ -d "${dir}/.git" ]]; then
branch="${"$(<"${dir}/.git/HEAD")"##*/}"
echo '±' "${branch:gs/%/%%}"
return
fi
# Mercurial repository
if [[ -d "${current_dir}/.hg" ]]
then
if [[ -f "$current_dir/.hg/branch" ]]
then
echo '☿' $(<"$current_dir/.hg/branch")
# Found .hg directory
if [[ -d "${dir}/.hg" ]]; then
if [[ -f "${dir}/.hg/branch" ]]; then
branch="$(<"${dir}/.hg/branch")"
else
echo '☿ default'
branch="default"
fi
return;
if [[ -f "${dir}/.hg/bookmarks.current" ]]; then
branch="${branch}/$(<"${dir}/.hg/bookmarks.current")"
fi
echo '☿' "${branch:gs/%/%%}"
return
fi
# Defines path as parent directory and keeps looking for :)
current_dir="${current_dir:h}"
# Check parent directory
dir="${dir:h}"
done
}

View file

@ -1,5 +1,4 @@
alias brewp='brew pin'
alias brews='brew list -1'
alias brewsp='brew list --pinned'
alias bubo='brew update && brew outdated'
alias bubc='brew upgrade && brew cleanup'
@ -7,3 +6,16 @@ alias bubu='bubo && bubc'
alias buf='brew upgrade --formula'
alias bcubo='brew update && brew outdated --cask'
alias bcubc='brew upgrade --cask && brew cleanup'
function brews() {
local formulae="$(brew leaves | xargs brew deps --installed --for-each)"
local casks="$(brew list --cask)"
local blue="$(tput setaf 4)"
local bold="$(tput bold)"
local off="$(tput sgr0)"
echo "${blue}==>${off} ${bold}Formulae${off}"
echo "${formulae}" | sed "s/^\(.*\):\(.*\)$/\1${blue}\2${off}/"
echo "\n${blue}==>${off} ${bold}Casks${off}\n${casks}"
}

View file

@ -18,6 +18,7 @@ case $state in
"check[Determine whether the requirements for your application are installed]" \
"list[Show all of the gems in the current bundle]" \
"show[Show the source location of a particular gem in the bundle]" \
"info[Show details of a particular gem in the bundle]" \
"outdated[Show all of the outdated gems in the current bundle]" \
"console[Start an IRB session in the context of the current bundle]" \
"open[Open an installed gem in the editor]" \
@ -84,7 +85,7 @@ case $state in
'(--verbose)--verbose[Enable verbose output mode]'
ret=0
;;
(open|show)
(open|show|info)
_gems=( $(bundle show 2> /dev/null | sed -e '/^ \*/!d; s/^ \* \([^ ]*\) .*/\1/') )
if [[ $_gems != "" ]]; then
_values 'gems' $_gems && ret=0

View file

@ -1,11 +1,3 @@
# cargo
This plugin adds completion for the Rust build tool [`Cargo`](https://github.com/rust-lang/cargo).
To use it, add `cargo` to the plugins array in your zshrc file:
```zsh
plugins=(... cargo)
```
Updated on March 3rd, 2019, from [Cargo 0.34.0](https://github.com/rust-lang/cargo/releases/tag/0.34.0).
**Deprecated: use the [`rust`](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/rust) plugin instead.**

View file

@ -1,23 +1,15 @@
if (( $+commands[rustup] && $+commands[cargo] )); then
# remove old generated completion file
command rm -f "${0:A:h}/_cargo"
print ${(%):-'%F{yellow}The `cargo` plugin is deprecated and has been moved to the `rust` plugin.'}
print ${(%):-'Please update your .zshrc to use the `%Brust%b` plugin instead.%f'}
# generate new completion file
ver="$(cargo --version)"
ver_file="$ZSH_CACHE_DIR/cargo_version"
comp_file="$ZSH_CACHE_DIR/completions/_cargo"
# TODO: 2021-12-28: remove this block
# Handle $0 according to the standard:
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
# Remove old generated completion file
command rm -f "${0:A:h}/_cargo" "$ZSH_CACHE_DIR/cargo_version"
mkdir -p "${comp_file:h}"
(( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath)
if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then
rustup completions zsh cargo >| "$comp_file"
echo "$ver" >| "$ver_file"
fi
declare -A _comps
autoload -Uz _cargo
_comps[cargo]=_cargo
unset ver ver_file comp_file
fi
(( ${fpath[(Ie)$ZSH/plugins/rust]} )) || {
fpath=("$ZSH/plugins/rust" $fpath)
source "$ZSH/plugins/rust/rust.plugin.zsh"
}

View file

@ -2,7 +2,7 @@
# catimg script by Eduardo San Martin Morote aka Posva #
# https://posva.net #
# #
# Ouput the content of an image to the stdout using the 256 colors of the #
# Output the content of an image to the stdout using the 256 colors of the #
# terminal. #
# GitHub: https://github.com/posva/catimg #
################################################################################

View file

@ -2,7 +2,7 @@
# catimg script by Eduardo San Martin Morote aka Posva #
# https://posva.net #
# #
# Ouput the content of an image to the stdout using the 256 colors of the #
# Output the content of an image to the stdout using the 256 colors of the #
# terminal. #
# GitHub: https://github.com/posva/catimg #
################################################################################

View file

@ -5,6 +5,7 @@ current Ruby version, and completion and a prompt function to display the Ruby v
Supports brew and manual installation of chruby.
To use it, add `chruby` to the plugins array in your zshrc file:
```zsh
plugins=(... chruby)
```
@ -14,7 +15,7 @@ plugins=(... chruby)
If you'd prefer to specify an explicit path to load chruby from
you can set variables like so:
```
```zsh
zstyle :omz:plugins:chruby path /local/path/to/chruby.sh
zstyle :omz:plugins:chruby auto /local/path/to/auto.sh
```

View file

@ -1,121 +1,94 @@
#
# INSTRUCTIONS
#
# With either a manual or brew installed chruby things should just work.
#
# If you'd prefer to specify an explicit path to load chruby from
# you can set variables like so:
#
# zstyle :omz:plugins:chruby path /local/path/to/chruby.sh
# zstyle :omz:plugins:chruby auto /local/path/to/auto.sh
#
# TODO
# - autodetermine correct source path on non OS X systems
# - completion if ruby-install exists
## load chruby from different locations
_source-from-omz-settings() {
local _chruby_path _chruby_auto
zstyle -s :omz:plugins:chruby path _chruby_path || return 1
zstyle -s :omz:plugins:chruby auto _chruby_auto || return 1
if [[ -r ${_chruby_path} ]]; then
source ${_chruby_path}
fi
if [[ -r ${_chruby_auto} ]]; then
source ${_chruby_auto}
fi
}
_source-from-homebrew() {
(( $+commands[brew] )) || return 1
local _brew_prefix
# check default brew prefix
if [[ -h /usr/local/opt/chruby ]];then
_brew_prefix="/usr/local/opt/chruby"
else
# ok , it is not default prefix
# this call to brew is expensive ( about 400 ms ), so at least let's make it only once
_brew_prefix=$(brew --prefix chruby)
fi
[[ -r "$_brew_prefix" ]] || return 1
source $_brew_prefix/share/chruby/chruby.sh
source $_brew_prefix/share/chruby/auto.sh
}
_load-chruby-dirs() {
local dir
for dir in "$HOME/.rubies" "$PREFIX/opt/rubies"; do
if [[ -d "$dir" ]]; then
RUBIES+=("$dir")
fi
done
}
# Load chruby
if _source-from-omz-settings; then
_load-chruby-dirs
elif [[ -r "/usr/local/share/chruby/chruby.sh" ]] ; then
source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh
_load-chruby-dirs
elif _source-from-homebrew; then
_load-chruby-dirs
fi
unfunction _source-from-homebrew _source-from-omz-settings _load-chruby-dirs
## chruby utility functions and aliases
# rvm and rbenv plugins also provide this alias
alias rubies='chruby'
_homebrew-installed() {
whence brew &> /dev/null
_xit=$?
if [ $_xit -eq 0 ];then
# ok , we have brew installed
# speculatively we check default brew prefix
if [ -h /usr/local/opt/chruby ];then
_brew_prefix="/usr/local/opt/chruby"
else
# ok , it is not default prefix
# this call to brew is expensive ( about 400 ms ), so at least let's make it only once
_brew_prefix=$(brew --prefix chruby)
fi
return 0
else
return $_xit
fi
}
_chruby-from-homebrew-installed() {
[ -r $_brew_prefix ] &> /dev/null
}
_ruby-build_installed() {
whence ruby-build &> /dev/null
}
_ruby-install-installed() {
whence ruby-install &> /dev/null
}
# Simple definition completer for ruby-build
if _ruby-build_installed; then
_ruby-build() { compadd $(ruby-build --definitions) }
compdef _ruby-build ruby-build
fi
_source_from_omz_settings() {
local _chruby_path
local _chruby_auto
zstyle -s :omz:plugins:chruby path _chruby_path
zstyle -s :omz:plugins:chruby auto _chruby_auto
if [[ -r ${_chruby_path} ]]; then
source ${_chruby_path}
fi
if [[ -r ${_chruby_auto} ]]; then
source ${_chruby_auto}
fi
}
_chruby_dirs() {
chrubydirs=($HOME/.rubies/ $PREFIX/opt/rubies)
for dir in chrubydirs; do
if [[ -d $dir ]]; then
RUBIES+=$dir
fi
done
}
if _homebrew-installed && _chruby-from-homebrew-installed ; then
source $_brew_prefix/share/chruby/chruby.sh
source $_brew_prefix/share/chruby/auto.sh
_chruby_dirs
elif [[ -r "/usr/local/share/chruby/chruby.sh" ]] ; then
source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh
_chruby_dirs
else
_source_from_omz_settings
_chruby_dirs
fi
function ensure_chruby() {
$(whence chruby)
}
function current_ruby() {
local _ruby
_ruby="$(chruby |grep \* |tr -d '* ')"
if [[ $(chruby |grep -c \*) -eq 1 ]]; then
echo ${_ruby}
else
echo "system"
fi
local ruby
ruby="$(chruby | grep \* | tr -d '* ')"
if [[ $(chruby | grep -c \*) -eq 1 ]]; then
echo ${ruby}
else
echo "system"
fi
}
function chruby_prompt_info() {
echo "$(current_ruby)"
echo "${$(current_ruby):gs/%/%%}"
}
# complete on installed rubies
# Complete chruby command with installed rubies
_chruby() {
compadd $(chruby | tr -d '* ')
local default_path='/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'
if PATH=${default_path} type ruby &> /dev/null; then
compadd system
fi
compadd $(chruby | tr -d '* ')
if PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin" command ruby &>/dev/null; then
compadd system
fi
}
compdef _chruby chruby
# Simple definition completer for ruby-build
if command ruby-build &> /dev/null; then
_ruby-build() { compadd $(ruby-build --definitions) }
compdef _ruby-build ruby-build
fi

View file

@ -228,7 +228,7 @@ Chuck Norris once punched the ground to stop an earthquake. The resulting afters
%
Chuck Norris once round-house kicked a salesman. Over the phone.
%
Chuck Norris once rounhouse kicked a football. The astronomical society now considers it a planet.
Chuck Norris once roundhouse kicked a football. The astronomical society now considers it a planet.
%
Chuck Norris once thought he was wrong. He was, however, mistaken.
%
@ -342,7 +342,7 @@ Every time there's an earthquake, you know Chuck Norris is hungry. The earthquak
%
Evolution's driving mechanism is nature's desperate attempt to escape Chuck Norris.
%
Fear of spiders is arachnaphobia. Fear of tight spaces is claustrophobia. Fear of Chuck Norris is called Logic.
Fear of spiders is arachnophobia. Fear of tight spaces is claustrophobia. Fear of Chuck Norris is called Logic.
%
Fool me once, shame on you. Fool Chuck Norris once and he will roundhouse you in the face.
%
@ -426,7 +426,7 @@ Some people ask for a Kleenex when they sneeze, Chuck Norris asks for a body bag
%
Someone once videotaped Chuck Norris getting pissed off. It was called Walker: Texas Chain Saw Massacre.
%
Staring at Chuck Norris for extended periods of time without proper eye protection will cause blindess, and possibly foot sized brusies on the face.
Staring at Chuck Norris for extended periods of time without proper eye protection will cause blindness, and possibly foot sized bruises on the face.
%
Taking Karate Lessons = $100, Buying MMA DVD's = $150, Subscribing to a UFC event = $50, Getting a Roundhouse Kick from Chuck Norris = PRICELESS.
%
@ -452,7 +452,7 @@ The best part of waking up is not Folgers in your cup. it's knowing that Chuck N
%
The chief export of Chuck Norris is pain.
%
The dictionary references Chuck Norris several times, he is metioned under Fear, Law, Order and Chucktatorship.
The dictionary references Chuck Norris several times, he is mentioned under Fear, Law, Order and Chucktatorship.
%
The leading causes of death in the United States are: 1. Heart Disease 2. Chuck Norris 3. Cancer.
%
@ -468,7 +468,7 @@ The only way sharks will come near CN underwater is when CN is inside of a cage.
%
The only word that rhymes with orange is Chuck Norris.
%
The producers of the movie "The Last Airbender" are now in talks with Chuck Norris in Order to star him in their next sequal "The Last Skull Bender".
The producers of the movie "The Last Airbender" are now in talks with Chuck Norris in Order to star him in their next sequel "The Last Skull Bender".
%
The quickest way to a man's heart is with Chuck Norris' fist.
%

View file

@ -19,6 +19,11 @@ bindkey -a 'N' vi-join
bindkey -a 'j' vi-forward-word-end
bindkey -a 'J' vi-forward-blank-word-end
# Handle $0 according to the standard:
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
# New less versions will read this file directly
export LESSKEYIN="${0:h:A}/colemak-less"

View file

@ -16,8 +16,13 @@ less_termcap[se]="${reset_color}"
less_termcap[us]="${fg_bold[green]}"
less_termcap[ue]="${reset_color}"
# Handle $0 according to the standard:
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
# Absolute path to this file's directory.
typeset __colored_man_pages_dir="${0:A:h}"
typeset -g __colored_man_pages_dir="${0:A:h}"
function colored() {
local -a environment

View file

@ -82,7 +82,7 @@ colorize_less() {
# This variable tells less to pipe every file through the specified command
# (see the man page of less INPUT PREPROCESSOR).
# 'zsh -ic "colorize_cat %s 2> /dev/null"' would not work for huge files like
# the ~/.zsh_history. For such files the tty of the preprocessor will be supended.
# the ~/.zsh_history. For such files the tty of the preprocessor will be suspended.
# Therefore we must source this file to make colorize_cat available in the
# preprocessor without the interactive mode.
# `2>/dev/null` will suppress the error for large files 'broken pipe' of the python

View file

@ -29,5 +29,6 @@ It works out of the box with the command-not-found packages for:
- [Fedora](https://fedoraproject.org/wiki/Features/PackageKitCommandNotFound)
- [NixOS](https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found)
- [Termux](https://github.com/termux/command-not-found)
- [SUSE](https://www.unix.com/man-page/suse/1/command-not-found/)
You can add support for other platforms by submitting a Pull Request.

View file

@ -60,3 +60,10 @@ if [[ -x /data/data/com.termux/files/usr/libexec/termux/command-not-found ]]; th
/data/data/com.termux/files/usr/libexec/termux/command-not-found "$1"
}
fi
# SUSE and derivates: https://www.unix.com/man-page/suse/1/command-not-found/
if [[ -x /usr/bin/command-not-found ]]; then
command_not_found_handler() {
/usr/bin/command-not-found "$1"
}
fi

View file

@ -12,51 +12,53 @@ plugins=(... common-aliases)
### ls command
| Alias | Command | Description |
|-------|---------------|--------------------------------------------------------------------------------|
| l | `ls -lFh` | List files as a long list, show size, type, human-readable |
| la | `ls -lAFh` | List almost all files as a long list show size, type, human-readable |
| lr | `ls -tRFh` | List files recursively sorted by date, show type, human-readable |
| lt | `ls -ltFh` | List files as a long list sorted by date, show type, human-readable |
| ll | `ls -l` | List files as a long list |
| ldot | `ls -ld .*` | List dot files as a long list |
| lS | `ls -1FSsh` | List files showing only size and name sorted by size |
| lart | `ls -1Fcart` | List all files sorted in reverse of create/modification time (oldest first) |
| lrt | `ls -1Fcrt` | List files sorted in reverse of create/modification time(oldest first) |
| Alias | Command | Description |
| ----- | ------------ | --------------------------------------------------------------------------- |
| l | `ls -lFh` | List files as a long list, show size, type, human-readable |
| la | `ls -lAFh` | List almost all files as a long list show size, type, human-readable |
| lr | `ls -tRFh` | List files recursively sorted by date, show type, human-readable |
| lt | `ls -ltFh` | List files as a long list sorted by date, show type, human-readable |
| ll | `ls -l` | List files as a long list |
| ldot | `ls -ld .*` | List dot files as a long list |
| lS | `ls -1FSsh` | List files showing only size and name sorted by size |
| lart | `ls -1Fcart` | List all files sorted in reverse of create/modification time (oldest first) |
| lrt | `ls -1Fcrt` | List files sorted in reverse of create/modification time(oldest first) |
| lsr | `ls -lARFh` | List all files and directories recursively |
| lsn | `ls -1` | List files and directories in a single column |
### File handling
| Alias | Command | Description |
|-------|-----------------------|------------------------------------------------------------------------------------|
| rm | `rm -i` | Remove a file |
| cp | `cp -i` | Copy a file |
| mv | `mv -i` | Move a file |
| zshrc | `${=EDITOR} ~/.zshrc` | Quickly access the ~/.zshrc file |
| dud | `du -d 1 -h` | Display the size of files at depth 1 in current location in human-readable form |
| duf | `du -sh` | Display the size of files in current location in human-readable form |
| t | `tail -f` | Shorthand for tail which outputs the last part of a file |
| Alias | Command | Description |
| ----- | --------------------- | ------------------------------------------------------------------------------- |
| rm | `rm -i` | Remove a file |
| cp | `cp -i` | Copy a file |
| mv | `mv -i` | Move a file |
| zshrc | `${=EDITOR} ~/.zshrc` | Quickly access the ~/.zshrc file |
| dud | `du -d 1 -h` | Display the size of files at depth 1 in current location in human-readable form |
| duf | `du -sh` | Display the size of files in current location in human-readable form |
| t | `tail -f` | Shorthand for tail which outputs the last part of a file |
### find and grep
| Alias | Command | Description |
|-------|-----------------------------------------------------|-----------------------------------------|
| fd\* | `find . -type d -name` | Find a directory with the given name |
| ff | `find . -type f -name` | Find a file with the given name |
| grep | `grep --color` | Searches for a query string |
| sgrep | `grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS}` | Useful for searching within files |
| Alias | Command | Description |
| ----- | -------------------------------------------------- | ------------------------------------ |
| fd\* | `find . -type d -name` | Find a directory with the given name |
| ff | `find . -type f -name` | Find a file with the given name |
| grep | `grep --color` | Searches for a query string |
| sgrep | `grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS}` | Useful for searching within files |
\* Only if the [`fd`](https://github.com/sharkdp/fd) command isn't installed.
### Other Aliases
| Alias | Command | Description |
|-----------|---------------------|-------------------------------------------------------------|
| h | `history` | Lists all recently used commands |
| hgrep | `fc -El 0 \| grep` | Searches for a word in the list of previously used commands |
| help | `man` | Opens up the man page for a command |
| p | `ps -f` | Displays currently executing processes |
| sortnr | `sort -n -r` | Used to sort the lines of a text file |
| unexport | `unset` | Used to unset an environment variable |
| Alias | Command | Description |
| -------- | ------------------ | ----------------------------------------------------------- |
| h | `history` | Lists all recently used commands |
| hgrep | `fc -El 0 \| grep` | Searches for a word in the list of previously used commands |
| help | `man` | Opens up the man page for a command |
| p | `ps -f` | Displays currently executing processes |
| sortnr | `sort -n -r` | Used to sort the lines of a text file |
| unexport | `unset` | Used to unset an environment variable |
## Global aliases
@ -77,7 +79,7 @@ $ find . -type f 2>/dev/null
```
| Alias | Command | Description |
|-------|-----------------------------|-------------------------------------------------------------|
| ----- | --------------------------- | ----------------------------------------------------------- |
| H | `\| head` | Pipes output to head which outputs the first part of a file |
| T | `\| tail` | Pipes output to tail which outputs the last part of a file |
| G | `\| grep` | Pipes output to grep to search for some word |
@ -97,23 +99,23 @@ that file will be open with `acroread`.
### Reading Docs
| Alias | Command | Description |
|-------|-------------|-------------------------------------|
| pdf | `acroread` | Opens up a document using acroread |
| ps | `gv` | Opens up a .ps file using gv |
| dvi | `xdvi` | Opens up a .dvi file using xdvi |
| chm | `xchm` | Opens up a .chm file using xchm |
| djvu | `djview` | Opens up a .djvu file using djview |
| Alias | Command | Description |
| ----- | ---------- | ---------------------------------- |
| pdf | `acroread` | Opens up a document using acroread |
| ps | `gv` | Opens up a .ps file using gv |
| dvi | `xdvi` | Opens up a .dvi file using xdvi |
| chm | `xchm` | Opens up a .chm file using xchm |
| djvu | `djview` | Opens up a .djvu file using djview |
### Listing files inside a packed file
| Alias | Command | Description |
|---------|-------------|-------------------------------------|
| zip | `unzip -l` | Lists files inside a .zip file |
| rar | `unrar l` | Lists files inside a .rar file |
| tar | `tar tf` | Lists files inside a .tar file |
| tar.gz | `echo` | Lists files inside a .tar.gz file |
| ace | `unace l` | Lists files inside a .ace file |
| Alias | Command | Description |
| ------ | ---------- | --------------------------------- |
| zip | `unzip -l` | Lists files inside a .zip file |
| rar | `unrar l` | Lists files inside a .rar file |
| tar | `tar tf` | Lists files inside a .tar file |
| tar.gz | `echo` | Lists files inside a .tar.gz file |
| ace | `unace l` | Lists files inside a .ace file |
### Some other features

View file

@ -12,6 +12,8 @@ alias ldot='ls -ld .*'
alias lS='ls -1FSsh'
alias lart='ls -1Fcart'
alias lrt='ls -1Fcrt'
alias lsr='ls -lARFh' #Recursive list of files and directories
alias lsn='ls -1' #A column contains name of files and directories
alias zshrc='${=EDITOR} ${ZDOTDIR:-$HOME}/.zshrc' # Quick access to the .zshrc file

View file

@ -10,22 +10,26 @@ To use it add `composer` to the plugins array in your zshrc file.
plugins=(... composer)
```
Original author: Daniel Gomes <me@danielcsgomes.com>
## Aliases
| Alias | Command | Description |
| ------ | ------------------------------------------- | --------------------------------------------------------------------------------------- |
| `c` | `composer` | Starts composer |
| `csu` | `composer self-update` | Updates composer to the latest version |
| `cu` | `composer update` | Updates composer dependencies and `composer.lock` file |
| `cr` | `composer require` | Adds new packages to `composer.json` |
| `crm` | `composer remove` | Removes packages from `composer.json` |
| `ci` | `composer install` | Resolves and installs dependencies from `composer.json` |
| `ccp` | `composer create-project` | Create new project from an existing package |
| `cdu` | `composer dump-autoload` | Updates the autoloader |
| `cdo` | `composer dump-autoload -o` | Converts PSR-0/4 autoloading to classmap for a faster autoloader (good for production) |
| `cgu` | `composer global update` | Allows update command to run on COMPOSER_HOME directory |
| `cgr` | `composer global require` | Allows require command to run on COMPOSER_HOME directory |
| `cgrm` | `composer global remove` | Allows remove command to run on COMPOSER_HOME directory |
| `cget` | `curl -s https://getcomposer.org/installer` | Installs composer in the current directory |
| `co` | `composer outdated` | Shows a list of installed packages with available updates |
| `cod` | `composer outdated --direct` | Shows a list of installed packages with available updates which are direct dependencies |
| Alias | Command | Description |
| ------ | ---------------------------------- | --------------------------------------------------------------------------------------- |
| `c` | `composer` | Starts composer |
| `ccp` | `composer create-project` | Create new project from an existing package |
| `cdo` | `composer dump-autoload -o` | Converts PSR-0/4 autoloading to classmap for a faster autoloader (good for production) |
| `cdu` | `composer dump-autoload` | Updates the autoloader |
| `cget` | `curl -s <installer> \| php` | Installs composer in the current directory |
| `cgr` | `composer global require` | Allows require command to run on COMPOSER_HOME directory |
| `cgrm` | `composer global remove` | Allows remove command to run on COMPOSER_HOME directory |
| `cgu` | `composer global update` | Allows update command to run on COMPOSER_HOME directory |
| `ci` | `composer install` | Resolves and installs dependencies from `composer.json` |
| `co` | `composer outdated` | Shows a list of installed packages with available updates |
| `cod` | `composer outdated --direct` | Shows a list of installed packages with available updates which are direct dependencies |
| `cr` | `composer require` | Adds new packages to `composer.json` |
| `crm` | `composer remove` | Removes packages from `composer.json` |
| `cs` | `composer show` | Lists available packages, with optional filtering |
| `csu` | `composer self-update` | Updates composer to the latest version |
| `cu` | `composer update` | Updates composer dependencies and `composer.lock` file |
| `cuh` | `composer update -d <config-home>` | Updates globally installed packages |

View file

@ -1,70 +1,76 @@
# ------------------------------------------------------------------------------
# FILE: composer.plugin.zsh
# DESCRIPTION: oh-my-zsh composer plugin file.
# AUTHOR: Daniel Gomes (me@danielcsgomes.com)
# VERSION: 1.0.0
# ------------------------------------------------------------------------------
# Composer basic command completion
_composer_get_command_list () {
$_comp_command1 --no-ansi 2>/dev/null | sed "1,/Available commands/d" | awk '/^[ \t]*[a-z]+/ { print $1 }'
}
_composer_get_required_list () {
$_comp_command1 show -s --no-ansi 2>/dev/null | sed '1,/requires/d' | awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }'
}
_composer () {
## Basic Composer command completion
# Since Zsh 5.7, an improved composer command completion is provided
if ! is-at-least 5.7; then
_composer () {
local curcontext="$curcontext" state line
typeset -A opt_args
_arguments \
'*:: :->subcmds'
_arguments '*:: :->subcmds'
if (( CURRENT == 1 )) || ( ((CURRENT == 2)) && [ "$words[1]" = "global" ] ) ; then
compadd $(_composer_get_command_list)
if (( CURRENT == 1 )) || ( (( CURRENT == 2 )) && [[ "$words[1]" = "global" ]] ); then
# Command list
local -a subcmds
subcmds=("${(@f)"$($_comp_command1 --no-ansi 2>/dev/null | awk '
/Available commands/{ r=1 }
r == 1 && /^[ \t]*[a-z]+/{
gsub(/^[ \t]+/, "")
gsub(/ +/, ":")
print $0
}
')"}")
_describe -t commands 'composer command' subcmds
else
compadd $(_composer_get_required_list)
# Required list
compadd $($_comp_command1 show -s --no-ansi 2>/dev/null \
| sed '1,/requires/d' \
| awk 'NF > 0 && !/^requires \(dev\)/{ print $1 }')
fi
}
}
compdef _composer composer
compdef _composer composer.phar
compdef _composer composer
compdef _composer composer.phar
fi
# Aliases
## Aliases
alias c='composer'
alias csu='composer self-update'
alias cu='composer update'
alias cr='composer require'
alias crm='composer remove'
alias ci='composer install'
alias ccp='composer create-project'
alias cdu='composer dump-autoload'
alias cdo='composer dump-autoload -o'
alias cgu='composer global update'
alias cdu='composer dump-autoload'
alias cget='curl -s https://getcomposer.org/installer | php'
alias cgr='composer global require'
alias cgrm='composer global remove'
alias cgu='composer global update'
alias ci='composer install'
alias co='composer outdated'
alias cod='composer outdated --direct'
alias cr='composer require'
alias crm='composer remove'
alias cs='composer show'
alias csu='composer self-update'
alias cu='composer update'
alias cuh='composer update --working-dir=$(composer config -g home)'
# install composer in the current directory
alias cget='curl -s https://getcomposer.org/installer | php'
# Add Composer's global binaries to PATH, using Composer if available.
if (( $+commands[composer] )); then
autoload -Uz _store_cache _retrieve_cache _cache_invalid
## If Composer not found, try to add known directories to $PATH
if (( ! $+commands[composer] )); then
[[ -d "$HOME/.composer/vendor/bin" ]] && export PATH="$PATH:$HOME/.composer/vendor/bin"
[[ -d "$HOME/.config/composer/vendor/bin" ]] && export PATH="$PATH:$HOME/.config/composer/vendor/bin"
_retrieve_cache composer
if [[ -z $__composer_bin_dir ]]; then
__composer_bin_dir=$(composer global config bin-dir --absolute 2>/dev/null)
_store_cache composer __composer_bin_dir
fi
# Add Composer's global binaries to PATH
export PATH="$PATH:$__composer_bin_dir"
unset __composer_bin_dir
else
[ -d $HOME/.composer/vendor/bin ] && export PATH=$PATH:$HOME/.composer/vendor/bin
[ -d $HOME/.config/composer/vendor/bin ] && export PATH=$PATH:$HOME/.config/composer/vendor/bin
# If still not found, don't do the rest of the script
(( $+commands[composer] )) || return 0
fi
## Add Composer's global binaries to PATH
autoload -Uz _store_cache _retrieve_cache _cache_invalid
_retrieve_cache composer
if [[ -z $__composer_bin_dir ]]; then
__composer_bin_dir=$(composer global config bin-dir --absolute 2>/dev/null)
_store_cache composer __composer_bin_dir
fi
# Add Composer's global binaries to PATH
export PATH="$PATH:$__composer_bin_dir"
unset __composer_bin_dir

View file

@ -36,7 +36,7 @@ arguments=(
'--reinstall[Reinstall the distribution even if you already have the latest version installed]'
'--interactive[Turn on interactive configure]'
'--scandeps[Scan the depencencies of given modules and output the tree in a text format]'
'--scandeps[Scan the dependencies of given modules and output the tree in a text format]'
'--format[Specify what format to display the scanned dependency tree]:scandeps format:(tree json yaml dists)'
'--save-dists[Specify the optional directory path to copy downloaded tarballs]'

View file

@ -33,20 +33,22 @@ Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh
| Alias | Command | Description |
| -------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| `aac` | `sudo $apt_pref autoclean` | Clears out the local repository of retrieved package files |
| `aar` | `sudo $apt_pref autoremove` | Removes packages installed automatically that are no longer needed |
| `abd` | `sudo $apt_pref build-dep` | Installs all dependencies for building packages |
| `ac` | `sudo $apt_pref clean` | Clears out the local repository of retrieved package files except lock files |
| `ad` | `sudo $apt_pref update` | Updates the package lists for upgrades for packages |
| `adg` | `sudo $apt_pref update && sudo $apt_pref $apt_upgr` | Update and upgrade packages |
| `ads` | `sudo apt-get dselect-upgrade` | Installs packages from list and removes all not in the list |
| `adu` | `sudo $apt_pref update && sudo $apt_pref dist-upgrade` | Smart upgrade that handles dependencies |
| `afu` | `sudo apt-file update` | Update the files in packages |
| `au` | `sudo $apt_pref $apt_upgr` | Install package upgrades |
| `ai` | `sudo $apt_pref install` | Command-line tool to install package |
| `ail` | `sed -e 's/ */ /g' -e 's/ *//' \| cut -s -d ' ' -f 1 \| xargs sudo $apt_pref install` | Install all packages given on the command line while using only the first word of each line |
| `alu` | `sudo apt update && apt list -u && sudo apt upgrade` | Update, list and upgrade packages |
| `ap` | `sudo $apt_pref purge` | Removes packages along with configuration files |
| `ar` | `sudo $apt_pref remove` | Removes packages, keeps the configuration files |
| `ads` | `sudo apt-get dselect-upgrade` | Installs packages from list and removes all not in the list |
| `dia` | `sudo dpkg -i ./*.deb` | Install all .deb files in the current directory |
| `au` | `sudo $apt_pref $apt_upgr` | Install package upgrades |
| `di` | `sudo dpkg -i` | Install all .deb files in the current directory |
| `dia` | `sudo dpkg -i ./*.deb` | Install all .deb files in the current directory |
| `kclean` | `sudo aptitude remove -P ?and(~i~nlinux-(ima\|hea) ?not(~n$(uname -r)))` | Remove ALL kernel images and headers EXCEPT the one in use |
## Aliases - Commands using `su`
@ -54,6 +56,7 @@ Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh
| Alias | Command |
| ----- | --------------------------------------------------------- |
| `aac` | `su -ls "$apt_pref autoclean" root` |
| `aar` | `su -ls "$apt_pref autoremove" root` |
| `ac` | `su -ls "$apt_pref clean" root` |
| `ad` | `su -lc "$apt_pref update" root` |
| `adg` | `su -lc "$apt_pref update && aptitude $apt_upgr" root` |
@ -75,8 +78,8 @@ Set `$apt_pref` and `$apt_upgr` to whatever command you want (before sourcing Oh
| ------------------- | --------------------------------------------------------------- |
| `apt-copy` | Create a simple script that can be used to 'duplicate' a system |
| `apt-history` | Displays apt history for a command |
| `kerndeb` | Builds kernel packages |
| `apt-list-packages` | List packages by size |
| `kerndeb` | Builds kernel packages |
## Authors

View file

@ -52,13 +52,18 @@ if [[ $use_sudo -eq 1 ]]; then
alias ai="sudo $apt_pref install"
# Install all packages given on the command line while using only the first word of each line:
# acs ... | ail
alias ail="sed -e 's/ */ /g' -e 's/ *//' | cut -s -d ' ' -f 1 | xargs sudo $apt_pref install"
alias ap="sudo $apt_pref purge"
alias ar="sudo $apt_pref remove"
alias aar="sudo $apt_pref autoremove"
# apt-get only
alias ads="sudo apt-get dselect-upgrade"
# apt only
alias alu="sudo apt update && apt list -u && sudo apt upgrade"
# Install all .deb files in the current directory.
# Warning: you will need to put the glob in single quotes if you use:
# glob_subst
@ -98,7 +103,11 @@ else
print "$cmd"
eval "$cmd"
}
function aar() {
cmd="su -lc '$apt_pref -P autoremove $@' root"
print "$cmd"
eval "$cmd"
}
# Install all .deb files in the current directory
# Assumes glob_subst is off
alias dia='su -lc "dpkg -i ./*.deb" root'
@ -139,6 +148,7 @@ apt_pref_compdef ai "install"
apt_pref_compdef ail "install"
apt_pref_compdef ap "purge"
apt_pref_compdef ar "remove"
apt_pref_compdef aar "autoremove"
apt_pref_compdef ads "dselect-upgrade"
# Misc. #####################################################################

View file

@ -13,6 +13,7 @@ This plugin sets up completion and aliases for [Deno](https://deno.land).
| dh | deno help |
| dli | deno lint |
| drn | deno run |
| drA | deno run -A |
| drw | deno run --watch |
| dts | deno test |
| dup | deno upgrade |

View file

@ -6,30 +6,35 @@ alias dfmt='deno fmt'
alias dh='deno help'
alias dli='deno lint'
alias drn='deno run'
alias drA='deno run -A'
alias drw='deno run --watch'
alias dts='deno test'
alias dup='deno upgrade'
# COMPLETION FUNCTION
if (( $+commands[deno] )); then
# remove old generated completion file
command rm -f "${0:A:h}/_deno"
if (( ! $+commands[deno] )); then
return
fi
ver="$(deno --version)"
ver_file="$ZSH_CACHE_DIR/deno_version"
comp_file="$ZSH_CACHE_DIR/completions/_deno"
# TODO: 2021-12-28: remove this block
# Handle $0 according to the standard:
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
# Remove old generated files
command rm -f "${0:A:h}/_deno" "$ZSH_CACHE_DIR/deno_version"
mkdir -p "${comp_file:h}"
(( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath)
# TODO: 2021-12-28: remove this bit of code as it exists in oh-my-zsh.sh
# Add completions folder in $ZSH_CACHE_DIR
command mkdir -p "$ZSH_CACHE_DIR/completions"
(( ${fpath[(Ie)"$ZSH_CACHE_DIR/completions"]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath)
if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then
deno completions zsh >| "$comp_file"
echo "$ver" >| "$ver_file"
fi
declare -A _comps
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `deno`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_deno" ]]; then
typeset -g -A _comps
autoload -Uz _deno
_comps[deno]=_deno
unset ver ver_file comp_file
fi
deno completions zsh >| "$ZSH_CACHE_DIR/completions/_deno" &|

View file

@ -19,14 +19,14 @@ export DIRHISTORY_SIZE=30
# Returns the element if the array was not empty,
# otherwise returns empty string.
function pop_past() {
print -v $1 "${dirhistory_past[$#dirhistory_past]}"
typeset -g $1="${dirhistory_past[$#dirhistory_past]}"
if [[ $#dirhistory_past -gt 0 ]]; then
dirhistory_past[$#dirhistory_past]=()
fi
}
function pop_future() {
print -v $1 "${dirhistory_future[$#dirhistory_future]}"
typeset -g $1="${dirhistory_future[$#dirhistory_future]}"
if [[ $#dirhistory_future -gt 0 ]]; then
dirhistory_future[$#dirhistory_future]=()
fi
@ -121,31 +121,39 @@ function dirhistory_zle_dirhistory_future() {
}
zle -N dirhistory_zle_dirhistory_back
bindkey "\e[3D" dirhistory_zle_dirhistory_back # xterm in normal mode
bindkey "\e[1;3D" dirhistory_zle_dirhistory_back # xterm in normal mode
bindkey "\e\e[D" dirhistory_zle_dirhistory_back # Putty
bindkey "\eO3D" dirhistory_zle_dirhistory_back # GNU screen
case "$TERM_PROGRAM" in
iTerm.app) bindkey "^[^[[D" dirhistory_zle_dirhistory_back ;; # iTerm2
Apple_Terminal) bindkey "^[b" dirhistory_zle_dirhistory_back ;; # Terminal.app
esac
if (( ${+terminfo[kcub1]} )); then
bindkey "^[${terminfo[kcub1]}" dirhistory_zle_dirhistory_back # urxvt
fi
zle -N dirhistory_zle_dirhistory_future
bindkey "\e[3C" dirhistory_zle_dirhistory_future # xterm in normal mode
bindkey "\e[1;3C" dirhistory_zle_dirhistory_future # xterm in normal mode
bindkey "\e\e[C" dirhistory_zle_dirhistory_future # Putty
bindkey "\eO3C" dirhistory_zle_dirhistory_future # GNU screen
case "$TERM_PROGRAM" in
iTerm.app) bindkey "^[^[[C" dirhistory_zle_dirhistory_future ;; # iTerm2
Apple_Terminal) bindkey "^[f" dirhistory_zle_dirhistory_future ;; # Terminal.app
esac
if (( ${+terminfo[kcuf1]} )); then
bindkey "^[${terminfo[kcuf1]}" dirhistory_zle_dirhistory_future # urxvt
fi
for keymap in emacs vicmd viins; do
# dirhistory_back
bindkey -M $keymap "\e[3D" dirhistory_zle_dirhistory_back # xterm in normal mode
bindkey -M $keymap "\e[1;3D" dirhistory_zle_dirhistory_back # xterm in normal mode
bindkey -M $keymap "\e\e[D" dirhistory_zle_dirhistory_back # Putty
bindkey -M $keymap "\eO3D" dirhistory_zle_dirhistory_back # GNU screen
case "$TERM_PROGRAM" in
Apple_Terminal) bindkey -M $keymap "^[b" dirhistory_zle_dirhistory_back ;; # Terminal.app
iTerm.app) bindkey -M $keymap "^[^[[D" dirhistory_zle_dirhistory_back ;; # iTerm2
esac
if (( ${+terminfo[kcub1]} )); then
bindkey -M $keymap "^[${terminfo[kcub1]}" dirhistory_zle_dirhistory_back # urxvt
fi
# dirhistory_future
bindkey -M $keymap "\e[3C" dirhistory_zle_dirhistory_future # xterm in normal mode
bindkey -M $keymap "\e[1;3C" dirhistory_zle_dirhistory_future # xterm in normal mode
bindkey -M $keymap "\e\e[C" dirhistory_zle_dirhistory_future # Putty
bindkey -M $keymap "\eO3C" dirhistory_zle_dirhistory_future # GNU screen
case "$TERM_PROGRAM" in
Apple_Terminal) bindkey -M $keymap "^[f" dirhistory_zle_dirhistory_future ;; # Terminal.app
iTerm.app) bindkey -M $keymap "^[^[[C" dirhistory_zle_dirhistory_future ;; # iTerm2
esac
if (( ${+terminfo[kcuf1]} )); then
bindkey -M $keymap "^[${terminfo[kcuf1]}" dirhistory_zle_dirhistory_future # urxvt
fi
done
#
# HIERARCHY Implemented in this section, in case someone wants to split it to another plugin if it clashes bindings
@ -176,27 +184,38 @@ function dirhistory_zle_dirhistory_down() {
}
zle -N dirhistory_zle_dirhistory_up
bindkey "\e[3A" dirhistory_zle_dirhistory_up # xterm in normal mode
bindkey "\e[1;3A" dirhistory_zle_dirhistory_up # xterm in normal mode
bindkey "\e\e[A" dirhistory_zle_dirhistory_up # Putty
bindkey "\eO3A" dirhistory_zle_dirhistory_up # GNU screen
case "$TERM_PROGRAM" in
iTerm.app) bindkey "^[^[[A" dirhistory_zle_dirhistory_up ;; # iTerm2
Apple_Terminal) bindkey "^[[A" dirhistory_zle_dirhistory_up ;; # Terminal.app
esac
if (( ${+terminfo[kcuu1]} )); then
bindkey "^[${terminfo[kcuu1]}" dirhistory_zle_dirhistory_up # urxvt
fi
zle -N dirhistory_zle_dirhistory_down
bindkey "\e[3B" dirhistory_zle_dirhistory_down # xterm in normal mode
bindkey "\e[1;3B" dirhistory_zle_dirhistory_down # xterm in normal mode
bindkey "\e\e[B" dirhistory_zle_dirhistory_down # Putty
bindkey "\eO3B" dirhistory_zle_dirhistory_down # GNU screen
case "$TERM_PROGRAM" in
iTerm.app) bindkey "^[^[[B" dirhistory_zle_dirhistory_down ;; # iTerm2
Apple_Terminal) bindkey "^[[B" dirhistory_zle_dirhistory_down ;; # Terminal.app
esac
if (( ${+terminfo[kcud1]} )); then
bindkey "^[${terminfo[kcud1]}" dirhistory_zle_dirhistory_down # urxvt
fi
for keymap in emacs vicmd viins; do
# dirhistory_up
bindkey -M $keymap "\e[3A" dirhistory_zle_dirhistory_up # xterm in normal mode
bindkey -M $keymap "\e[1;3A" dirhistory_zle_dirhistory_up # xterm in normal mode
bindkey -M $keymap "\e\e[A" dirhistory_zle_dirhistory_up # Putty
bindkey -M $keymap "\eO3A" dirhistory_zle_dirhistory_up # GNU screen
case "$TERM_PROGRAM" in
Apple_Terminal) bindkey -M $keymap "^[[A" dirhistory_zle_dirhistory_up ;; # Terminal.app
iTerm.app) bindkey -M $keymap "^[^[[A" dirhistory_zle_dirhistory_up ;; # iTerm2
esac
if (( ${+terminfo[kcuu1]} )); then
bindkey -M $keymap "^[${terminfo[kcuu1]}" dirhistory_zle_dirhistory_up # urxvt
fi
# dirhistory_down
bindkey -M $keymap "\e[3B" dirhistory_zle_dirhistory_down # xterm in normal mode
bindkey -M $keymap "\e[1;3B" dirhistory_zle_dirhistory_down # xterm in normal mode
bindkey -M $keymap "\e\e[B" dirhistory_zle_dirhistory_down # Putty
bindkey -M $keymap "\eO3B" dirhistory_zle_dirhistory_down # GNU screen
case "$TERM_PROGRAM" in
Apple_Terminal) bindkey -M $keymap "^[[B" dirhistory_zle_dirhistory_down ;; # Terminal.app
iTerm.app) bindkey -M $keymap "^[^[[B" dirhistory_zle_dirhistory_down ;; # iTerm2
esac
if (( ${+terminfo[kcud1]} )); then
bindkey -M $keymap "^[${terminfo[kcud1]}" dirhistory_zle_dirhistory_down # urxvt
fi
done
unset keymap

View file

@ -90,7 +90,7 @@ __docker-machine_filters() {
}
__get_swarm_discovery() {
declare -a masters serivces
declare -a masters services
local service
services=()
masters=($(docker-machine ls -f {{.Swarm}} |grep '(master)' |awk '{print $1}'))
@ -169,7 +169,7 @@ __get_create_argument() {
__docker-machine_subcommand() {
local -a opts_help
opts_help=("(- :)--help[Print usage]")
local -a opts_only_host opts_driver opts_storage_driver opts_stragery
local -a opts_only_host opts_driver opts_storage_driver opts_state
opts_only_host=(
"$opts_help"
"*:host:__docker-machine_hosts_all"
@ -330,7 +330,7 @@ _docker-machine() {
_arguments -C \
"(- :)"{-h,--help}"[Show help]" \
"(-D --debug)"{-D,--debug}"[Enable debug mode]" \
'(-s --stroage-path)'{-s,--storage-path}'[Configures storage path]:file:_files' \
'(-s --storage-path)'{-s,--storage-path}'[Configures storage path]:file:_files' \
'--tls-ca-cert[CA to verify remotes against]:file:_files' \
'--tls-ca-key[Private key to generate certificates]:file:_files' \
'--tls-client-cert[Client cert to use for TLS]:file:_files' \

View file

@ -23,12 +23,12 @@ source_env() {
touch "$ZSH_DOTENV_DISALLOWED_LIST"
# early return if disallowed
if command grep -q "$dirpath" "$ZSH_DOTENV_DISALLOWED_LIST" &>/dev/null; then
if command grep -Fx -q "$dirpath" "$ZSH_DOTENV_DISALLOWED_LIST" &>/dev/null; then
return
fi
# check if current directory's .env file is allowed or ask for confirmation
if ! command grep -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then
if ! command grep -Fx -q "$dirpath" "$ZSH_DOTENV_ALLOWED_LIST" &>/dev/null; then
# get cursor column and print new line before prompt if not at line beginning
local column
echo -ne "\e[6n" > /dev/tty

View file

@ -21,3 +21,4 @@ plugins=(... dotnet)
| da | dotnet add | Add a package or reference to a .NET project. |
| dp | dotnet pack | Create a NuGet package. |
| dng | dotnet nuget | Provides additional NuGet commands. |
| db | dotnet build | Build a .NET project |

View file

@ -12,7 +12,7 @@ _dotnet_zsh_complete()
return
fi
# This is not a variable assigment, don't remove spaces!
# This is not a variable assignment, don't remove spaces!
_values = "${(ps:\n:)completions}"
}
@ -30,3 +30,4 @@ alias ds='dotnet sln'
alias da='dotnet add'
alias dp='dotnet pack'
alias dng='dotnet nuget'
alias db='dotnet build'

View file

@ -1,83 +1,66 @@
# Drush
## Description
This plugin offers aliases and functions to make the work with drush easier and more productive.
This plugin adds aliases and functions for [Drush](https://www.drush.org), a command-line shell
and Unix scripting interface for Drupal. It also adds completion for the `drush` command.
To enable it, add the `drush` to your `plugins` array in `~/.zshrc`:
To enable it, add `drush` to the plugins array in zshrc file:
```
```zsh
plugins=(... drush)
```
## Aliases
| Alias | Description | Command |
|-------|-----------------------------------------------------------------------|-----------------------------|
| dr | Display drush help | drush |
| drca | Clear all drupal caches. | drush cc all |
| drcb | Clear block cache. | drush cc block |
| drcg | Clear registry cache. | drush cc registry |
| drcj | Clear css-js cache. | drush cc css-js |
| drcm | Clear menu cache. | drush cc menu |
| drcml | Clear module-list cache. | drush cc module-list |
| drcr | Run all cron hooks in all active modules for specified site. | drush core-cron |
| drct | Clear theme-registry cache. | drush cc theme-registry |
| drcv | Clear views cache. (Make sure that the views module is enabled) | drush cc views |
| drdmp | Backup database in a new dump.sql file | drush drush sql-dump --ordered-dump --result-file=dump.sql|
| drf | Display features status | drush features |
| drfr | Revert a feature module on your site. | drush features-revert -y |
| drfu | Update a feature module on your site. | drush features-update -y |
| drfra | Revert all enabled feature module on your site. | drush features-revert-all |
| drif | Flush all derived images. | drush image-flush --all |
| drpm | Show a list of available modules. | drush pm-list --type=module |
| drst | Provides a birds-eye view of the current Drupal installation, if any. | drush core-status |
| drup | Apply any database updates required (as with running update.php). | drush updatedb |
| drups | List any pending database updates. | drush updatedb-status |
| drv | Show drush version. | drush version |
| drvd | Delete a variable. | drush variable-del |
| drvg | Get a list of some or all site variables and values. | drush variable-get |
| drvs | Set a variable. | drush variable-set |
| Alias | Command | Description |
| ------- | ----------------------------------------------------------- | -------------------------------------------------------------------- |
| `dr` | `drush` | Display drush help |
| `drca` | `drush cc all` | _(Deprecated in Drush 8)_ Clear all drupal caches |
| `drcb` | `drush cc block` | _(Deprecated in Drush 8)_ Clear block cache |
| `drcex` | `drush config:export -y` | Export Drupal configuration to a directory |
| `drcg` | `drush cc registry` | _(Deprecated in Drush 8)_ Clear registry cache |
| `drcim` | `drush config:import -y` | Import config from a config directory |
| `drcj` | `drush cc css-js` | Clear css-js cache |
| `drcm` | `drush cc menu` | Clear menu cache |
| `drcml` | `drush cc module-list` | Clear module-list cache |
| `drcr` | `drush core-cron` | Run all cron hooks in all active modules for specified site |
| `drct` | `drush cc theme-registry` | Clear theme-registry cache |
| `drcv` | `drush cc views` | Clear views cache _(make sure that the views module is enabled)_ |
| `drdmp` | `drush drush sql-dump --ordered-dump --result-file=dumpsql` | Backup database in a new dump.sql file |
| `drf` | `drush features` | Display features status |
| `drfr` | `drush features-revert -y` | Revert a feature module on your site |
| `drfra` | `drush features-revert-all` | Revert all enabled feature module on your site |
| `drfu` | `drush features-update -y` | Update a feature module on your site |
| `drif` | `drush image-flush --all` | Flush all derived images |
| `drpm` | `drush pm-list --type=module` | Show a list of available modules |
| `drst` | `drush core-status` | Provides a birds-eye view of the current Drupal installation, if any |
| `druli` | `drush user:login` | Display a one time login link for user ID 1, or another user |
| `drup` | `drush updatedb` | Apply any database updates required (as with running update.php) |
| `drups` | `drush updatedb-status` | List any pending database updates |
| `drv` | `drush version` | Show drush version |
| `drvd` | `drush variable-del` | Delete a variable |
| `drvg` | `drush variable-get` | Get a list of some or all site variables and values |
| `drvs` | `drush variable-set` | Set a variable |
| `drws` | `drush watchdog:show` | Show watchdog messages |
| `drwse` | `drush watchdog:show --extended` | Show watchdog messages with extended information |
| `drwst` | `drush watchdog:tail` | Tail watchdog messages |
## Functions
### dren
Download and enable one or more extensions (modules or themes).
Must be invoked with one or more parameters. e.g.:
`dren devel` or `dren devel module_filter views`
- `dren`: download and enable one or more extensions (modules or themes). Must be
invoked with one or more parameters, e.g.: `dren devel` or `dren devel module_filter views`.
### drf
Edit drushrc, site alias, and Drupal settings.php files.
Can be invoked with one or without parameters. e.g.:
`drf 1`
- `drf`: edit drushrc, site alias, and Drupal settings.php files.
Can be invoked with one or without parameters, e.g.: `drf 1`.
### dris
Disable one or more extensions (modules or themes)
Must be invoked with one or more parameters. e.g.:
`dris devel` or `dris devel module_filter views`
- `dris`: disable one or more extensions (modules or themes). Must be invoked with
one or more parameters, e.g.: `dris devel` or `dris devel module_filter views`.
### drpu
Uninstall one or more modules.
Must be invoked with one or more parameters. e.g.:
`drpu devel` or `drpu devel module_filter views`
- `drpu`: uninstall one or more modules. Must be invoked with one or more
parameters, e.g.: `drpu devel` or `drpu devel module_filter views`.
### drnew
Creates a brand new drupal website.
Note: As soon as the installation is complete, drush will print a username and a random password into the terminal:
```
Installation complete. User name: admin User password: cf7t8yqNEm
```
- `drnew`: creates a brand new drupal website. Note: as soon as the installation
is complete, `drush` will print a username and a random password into the terminal:
## Additional features
### Autocomplete
The [completion script for drush](https://github.com/drush-ops/drush/blob/8.0.1/drush.complete.sh) comes enabled with this plugin.
So, it is possible to type a command:
```
drush sql
```
And as soon as the tab key is pressed, the script will display the available commands:
```
drush sql
sqlc sql-conf sql-create sql-dump sql-query sql-sanitize
sql-cli sql-connect sql-drop sqlq sqlsan sql-sync
```
```text
Installation complete. User name: admin User password: cf7t8yqNEm
```

View file

@ -1,19 +1,18 @@
# Drush support.
# Functions
function dren() {
drush en $@ -y
drush en "$@" -y
}
function dris() {
drush pm-disable $@ -y
drush pm-disable "$@" -y
}
function drpu() {
drush pm-uninstall $@ -y
drush pm-uninstall "$@" -y
}
function drf() {
if [[ $1 == "" ]] then
if [[ -z "$1" ]] then
drush core-config
else
drush core-config --choice=$1
@ -21,62 +20,62 @@ function drf() {
}
function drfi() {
if [[ $1 == "fields" ]]; then
drush field-info fields
elif [[ $1 == "types" ]]; then
drush field-info types
else
drush field-info
fi
case "$1" in
fields) drush field-info fields ;;
types) drush field-info types ;;
*) drush field-info ;;
esac
}
function drnew() {
(
cd
echo "Website's name: "
read WEBSITE_NAME
cd ~
echo "Website's name: "
read WEBSITE_NAME
HOST=http://$(hostname -i)/
HOST=http://$(hostname -i)/
if [[ $WEBSITE_NAME == "" ]] then
MINUTES=$(date +%M:%S)
WEBSITE_NAME="Drupal-$MINUTES"
echo "Your website will be named: $WEBSITE_NAME"
fi
if [[ $WEBSITE_NAME == "" ]] then
MINUTES=$(date +%M:%S)
WEBSITE_NAME="Drupal-$MINUTES"
echo "Your website will be named: $WEBSITE_NAME"
fi
drush dl drupal --drupal-project-rename=$WEBSITE_NAME
drush dl drupal --drupal-project-rename=$WEBSITE_NAME
echo "Type your localhost directory: (Leave empty for /var/www/html/)"
read DIRECTORY
echo "Type your localhost directory: (Leave empty for /var/www/html/)"
read DIRECTORY
if [[ $DIRECTORY == "" ]] then
DIRECTORY="/var/www/html/"
fi
if [[ $DIRECTORY == "" ]] then
DIRECTORY="/var/www/html/"
fi
echo "Moving to $DIRECTORY$WEBSITE_NAME"
sudo mv $WEBSITE_NAME $DIRECTORY
cd $DIRECTORY$WEBSITE_NAME
echo "Moving to $DIRECTORY$WEBSITE_NAME"
sudo mv $WEBSITE_NAME $DIRECTORY
cd $DIRECTORY$WEBSITE_NAME
echo "Database's user: "
read DATABASE_USR
echo "Database's password: "
read -s DATABASE_PWD
echo "Database's name for your project: "
read DATABASE
echo "Database's user: "
read DATABASE_USR
echo "Database's password: "
read -s DATABASE_PWD
echo "Database's name for your project: "
read DATABASE
DB_URL="mysql://$DATABASE_USR:$DATABASE_PWD@localhost/$DATABASE"
drush site-install standard --db-url=$DB_URL --site-name=$WEBSITE_NAME
open_command $HOST$WEBSITE_NAME
echo "Done"
DB_URL="mysql://$DATABASE_USR:$DATABASE_PWD@localhost/$DATABASE"
drush site-install standard --db-url=$DB_URL --site-name=$WEBSITE_NAME
open_command $HOST$WEBSITE_NAME
echo "Done"
)
}
# Aliases, sorted alphabetically.
# Aliases
alias dr="drush"
alias drca="drush cc all" # Deprecated for Drush 8
alias drcb="drush cc block" # Deprecated for Drush 8
alias drcex="drush config:export -y"
alias drcg="drush cc registry" # Deprecated for Drush 8
alias drcim="drush config:import -y"
alias drcj="drush cc css-js"
alias drcm="drush cc menu"
alias drcml="drush cc module-list"
@ -86,17 +85,21 @@ alias drcv="drush cc views"
alias drdmp="drush sql-dump --ordered-dump --result-file=dump.sql"
alias drf="drush features"
alias drfr="drush features-revert -y"
alias drfu="drush features-update -y"
alias drfra="drush features-revert-all"
alias drfu="drush features-update -y"
alias drif="drush image-flush --all"
alias drpm="drush pm-list --type=module"
alias drst="drush core-status"
alias druli="drush user:login"
alias drup="drush updatedb"
alias drups="drush updatedb-status"
alias drv="drush version"
alias drvd="drush variable-del"
alias drvg="drush variable-get"
alias drvs="drush variable-set"
alias drws="drush watchdog:show"
alias drwse="drush watchdog:show --extended"
alias drwst="drush watchdog:tail"
# Enable drush autocomplete support
autoload bashcompinit

View file

@ -13,6 +13,11 @@
autoload -Uz is-at-least
is-at-least 24 "${${(Az)"$(emacsclient --version 2>/dev/null)"}[2]}" || return 0
# Handle $0 according to the standard:
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
# Path to custom emacsclient launcher
export EMACS_PLUGIN_LAUNCHER="${0:A:h}/emacsclient.sh"

View file

@ -1,22 +1,33 @@
# Ember CLI
**Maintainers:** [BilalBudhani](https://github.com/BilalBudhani), [eubenesa](https://github.com/eubenesa), [scottkidder](https://github.com/scottkidder]
This plugin adds completion and aliases for using [`ember-cli`](https://cli.emberjs.com/).
Ember CLI (https://www.ember-cli.com/)
To use it, add `ember-cli` to the plugins array in your zshrc file:
### List of Aliases
```zsh
plugins=(... ember-cli)
```
Alias | Ember-CLI command
----- | -----------------
**es** | *ember serve*
**ea** | *ember addon*
**eb** | *ember build*
**ed** | *ember destroy*
**eg** | *ember generate*
**eh** | *ember help*
**ein** | *ember init*
**ei** | *ember install*
**et** | *ember test*
**ets** | *ember test --serve*
**eu** | *ember update*
**ev** | *ember version*
## Aliases
| Alias | Command |
| ----- | -------------------- |
| `ea` | `ember addon` |
| `eb` | `ember build` |
| `ed` | `ember destroy` |
| `eg` | `ember generate` |
| `eh` | `ember help` |
| `ei` | `ember install` |
| `ein` | `ember init` |
| `es` | `ember serve` |
| `et` | `ember test` |
| `ets` | `ember test --serve` |
| `eu` | `ember update` |
| `ev` | `ember version` |
## Maintainers
- [BilalBudhani](https://github.com/BilalBudhani)
- [eubenesa](https://github.com/eubenesa)
- [scottkidder](https://github.com/scottkidder]
- [t-sauer](https://www.github.com/t-sauer)

View file

@ -0,0 +1,189 @@
#compdef ember
local curcontext="$curcontext" state line ret=1
_arguments -C -A "--version" -A "--help" \
'(- 1 *)--help' \
'(- 1 *)--version' \
'1: :->cmds' \
'*:: :->args' && ret=0
case $state in
cmds)
_values "ember command" \
"addon[Generates a new folder structure for building an addon, complete with test harness]" \
"asset-sizes[Shows the sizes of your asset files]" \
"build[Builds your app and places it into the output path (dist/ by default)]" \
"destroy[Destroys code generated by generate command]" \
"generate[Generates new code from blueprints]" \
"help[Outputs the usage instructions for all commands or the provided command]" \
"init[Creates a new ember-cli project in the current folder]" \
"install[Installs an ember-cli addon from npm]" \
"new[Creates a new directory and runs ember init in it]" \
"serve[Builds and serves your app, rebuilding on file changes]" \
"test[Runs your app's test suite]" \
"version[outputs ember-cli version]"
ret=0
;;
args)
case $line[1] in
help)
_values 'commands' \
'addon' \
'asset-sizes' \
'build' \
'destroy' \
'generate' \
'help' \
'init' \
'install' \
'new' \
'serve' \
'test' \
'vesion' && ret=0
;;
addon)
_arguments \
'(--blueprint)--blueprint=-' \
'(--directory)--directory=-' \
'(--dry-run)--dry-run' \
'(--skip-bower)--skip-bower' \
'(--skip-git)--skip-git' \
'(--skip-npm)--skip-npm' \
'(--verbose)--verbose'
;;
asset-sizes)
_arguments \
'(--output-path)--output-path=-'
;;
build)
_arguments \
'(--environment)--environment=-' \
'(--output-path)--output-path=-' \
'(--output-path)--suppress-sizes' \
'(--watch)--watch' \
'(--watcher)--watcher=-' \
'(-dev)-dev' \
'(-prod)-prod'
;;
destroy|generate)
_values 'arguments' \
'(--classic)--classic' \
'(--dry-run)--dry-run' \
'(--dummy)--dummy' \
'(--in-repo-addon)--in-repo-addon-=' \
'(--pod)--pod' \
'(--verbose)--verbose' && ret=0
_values 'blueprints' \
'acceptance-test' \
'adapter' \
'adapter-test' \
'component' \
'component-addon' \
'component-test' \
'controller' \
'controller-test' \
'helper' \
'helper-addon' \
'helper-test' \
'initializer' \
'initializer-addon' \
'initializer-test' \
'instance-initializer' \
'instance-initializer-addon' \
'instance-initializer-test' \
'mixin' \
'mixin-test' \
'model' \
'model-test' \
'resource' \
'route' \
'route-addon' \
'route-test' \
'serializer' \
'serializer-test' \
'service' \
'service-test' \
'template' \
'test-helper' \
'transform' \
'transform-test' \
'util' \
'util-test' \
'view' \
'view-test' \
'addon' \
'addon-import' \
'app' \
'blueprint' \
'http-mock' \
'http-proxy' \
'in-repo-addon' \
'lib' \
'server' \
'vendor-shim' && ret=0
;;
init)
_arguments \
'(--blueprint)--blueprint=-' \
'(--name)--name=-' \
'(--dry-run)--dry-run' \
'(--skip-bower)--skip-bower' \
'(--skip-npm)--skip-npm' \
'(--verbose)--verbose'
;;
install)
_arguments \
'(--save-dev)--save-dev' \
'(--save)--save'
;;
new)
_arguments \
'(--blueprint)--blueprint=-' \
'(--directory)--directory=-' \
'(--dry-run)--dry-run' \
'(--skip-bower)--skip-bower' \
'(--skip-git)--skip-git' \
'(--skip-npm)--skip-npm' \
'(--verbose)--verbose'
;;
serve)
_arguments \
'(--port)--port=-[To use a port different than 4200. Pass 0 to automatically pick an available port.]' \
'(--host)--host=-[Listens on all interfaces by default]' \
'(--proxy)--proxy=-' \
'(--secure-proxy)--secure-proxy[Set to false to proxy self-signed SSL certificates]' \
'(--transparent-proxy)--transparent-proxy[Set to false to omit x-forwarded-* headers when proxying]' \
'(--watcher)--watcher=-' \
'(--live-reload)--live-reload' \
'(--live-reload-host)--live-reload-host=-[Defaults to host]' \
'(--live-reload-base-url)--live-reload-base-url=-[Defaults to baseURL]' \
'(--live-reload-port)--live-reload-port=-[Defaults to port number within \[49152...65535\]]' \
'(--environment)--environment=-' \
'(--output-path)--output-path=-' \
'(--ssl)--ssl' \
'(--ssl-key)--ssl-key=-' \
'(--ssl-cert)--ssl-cert=-'
;;
test)
_arguments \
'(--environment)--environment=-' \
'(--config-file)--config-file=-' \
'(--server)--server' \
'(--host)--host=-' \
'(--test-port)--test-port=-[The test port to use when running with --server.]' \
'(--filter)--filter=-[A string to filter tests to run]' \
'(--module)--module=-[The name of a test module to run]' \
'(--watcher)--watcher=-' \
'(--launch)--launch=-[A comma separated list of browsers to launch for tests.]' \
'(--reporter)--reporter=-[Test reporter to use \[tap|dot|xunit\] (default: tap)]' \
'(--silent)--silent[Suppress any output except for the test report]' \
'(--test-page)--test-page=-[Test page to invoke]' \
'(--path)--path=-[Reuse an existing build at given path.]' \
'(--query)--query=-[A query string to append to the test page URL.]'
;;
esac
;;
esac
return ret

View file

@ -1,17 +1,12 @@
# Ember CLI
# Visit https://www.ember-cli.com/ to view user guide
alias es='ember serve'
alias ea='ember addon'
alias eb='ember build'
alias ed='ember destroy'
alias eg='ember generate'
alias eh='ember help'
alias ein='ember init'
alias ei='ember install'
alias ein='ember init'
alias es='ember serve'
alias et='ember test'
alias ets='ember test --serve'
alias eu='ember update'
# version
alias ev='ember version'

View file

@ -10,7 +10,7 @@ This plugin provides support for working with Unicode emoji characters in `zsh`
Variable | Description
----------------- | --------------------------------
$emoji | Maps emoji names to characters
$emoji | Maps emoji names to characters (except flags)
$emoji_flags | Maps country names to flag characters (using region indicators)
$emoji_groups | Named groups of emoji. Keys are group names; values are whitespace-separated lists of character names
@ -55,10 +55,8 @@ The defined group names can be found with `echo ${(k)emoji_groups}`.
To list all available emoji with their names, use:
```
$> display_emoji
$> display_emoji fruits
$> display_emoji animals
$> display_emoji vehicles
$> display_emoji faces
$> display_emoji people
```
To use emoji in a prompt:
@ -73,13 +71,13 @@ PROMPT="$surfer > "
The emoji names and codes are sourced from Unicode Technical Report \#51, which provides information on emoji support in Unicode. It can be found at https://www.unicode.org/reports/tr51/index.html.
The group definitions are added by this OMZ plugin. They are not based on external definitions. (As far as I can tell. -apjanke)
The group definitions are added by this OMZ plugin. They are not based on external definitions.
The values in the `$emoji*` maps are the emoji characters themselves, not escape sequences or other forms that require interpretation. They can be used in any context and do not require escape sequence support from commands like `echo` or `print`.
The emoji in the main `$emoji` map are standalone character sequences which can all be output on their own, without worrying about combining characters. The values may actually be multi-code-point sequences, instead of a single code point, and may include combining characters in those sequences. But they're arranged so their effects do not extend beyond that sequence.
The exception to this is the skin tone variation selectors. These are included in the main `$emoji` map because they can be displayed on their own, as well as used as combining characters. (If they follow a character that is not one of the emoji characters they combine with, they are displayed as color swatches.)
The exception to this is the skin tone / hair style variation selectors. These are included in the main `$emoji` map because they can be displayed on their own, as well as used as combining characters. (If they follow a character that is not one of the emoji characters they combine with, they are displayed as color swatches.)
## Experimental Features
@ -90,7 +88,6 @@ Variables:
Variable | Description
----------------- | --------------------------------
$emoji2 | Auxiliary and combining characters
$emoji_skintone | Skin tone modifiers (from Unicode 8.0)
@ -105,31 +102,26 @@ The "variation selectors" are combining characters which change the appearance o
The `$emoji_skintone` associative array maps skin tone IDs to the variation selector characters. To use one, output it immediately following a smiley or other human emoji.
```
echo "$emoji[smiling_face_with_open_mouth]$emoji_skintone[4]"
echo $emoji[waving_hand]$emoji_skintone[5]
```
Note that `$emoji_skintone` is an associative array, and its keys are the *names* of "Fitzpatrick Skin Type" groups, not linear indexes into a normal array. The names are `1_2`, `3`, `4`, `5`, and `6`. (Types 1 and 2 are combined into a single color.) See the [Diversity section in Unicode TR 51](https://www.unicode.org/reports/tr51/index.html#Diversity) for details.
#### Gemoji support
The [gemoji project](https://github.com/github/gemoji) seems to be the de facto main source for short names and other emoji-related metadata that isn't included in the official Unicode reports. So, our list of emojis incorporates some of their aliases to make your life more convenient:
```
echo $emoji[grinning_face_with_smiling_eyes]
echo $emoji[smile]
```
These two commands yield the same emoji (😄). The first name is the official one, in the Unicode reference, and the second one is the alias that was in Gemoji's database.
## TODO
These are things that could be enhanced in future revisions of the plugin.
* Incorporate CLDR data for ordering and groupings
* Short :bracket: style names (from gemoji)
* Incorporate `gemoji` data
* Country codes for flags
* ZWJ combining function?
#### Gemoji support
The [gemoji project](https://github.com/github/gemoji) seems to be the de facto main source for short names and other emoji-related metadata that isn't included in the official Unicode reports. (I'm saying this just from looking at the google results for "emoji short names" and related searches. -apjanke)
If this plugin is updated to provide short names, CLDR sorting data, and similar stuff, it should probably be changed to use the Gemoji project, and the `update_emoji.pl` script be rewritten in Ruby so it can use the Gemoji library directly instead of parsing its data files.
This does *not* mean that it should use Gemoji at run time. None of the `zsh` plugin stuff should call Gemoji or Ruby code. Rather, the "build time" `update_emoji.pl` script should be rewritten to use Gemoji to generate a pure-native-`zsh` character definition file which would be checked in to the repo and can be called by OMZ users without having Gemoji installed.
#### ZWJ combining function
One of the newer features of Unicode emoji is the ability to use the "Zero-Width Joiner" character to compose multiple emoji characters in to a single "emoji ligature" glyph. For example, this is [how Apple supports "family" emoji with various genders and skin tones](https://www.unicode.org/reports/tr51/index.html#ZWJ_Sequences).
These are a pain to write out (and probably worse to read), and it might be convenient to have a couple functions for concisely composing them, if wider support for them appears.
* ZWJ combining function?

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -4,15 +4,17 @@
#
# See the README for documentation.
# Handle $0 according to the standard:
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
_omz_emoji_plugin_dir="${0:h}"
() {
local LC_ALL=en_US.UTF-8
typeset -gAH emoji_groups
typeset -gAH emoji_con
typeset -gAH emoji2
typeset -gAH emoji_skintone
source "$_omz_emoji_plugin_dir/emoji-char-definitions.zsh"
@ -20,12 +22,11 @@ unset _omz_emoji_plugin_dir
# These additional emoji are not in the definition file, but are useful in conjunction with it
# This is a combinin character that can be placed after any other character to surround
# This is a combining character that can be placed after any other character to surround
# it in a "keycap" symbol.
# The digits 0-9 are already in the emoji table as keycap_digit_<N>, keycap_ten, etc.
# It's unclear whether this should be in the $emoji array, because those characters are all ones
# which can be displayed on their own.
#emoji[combining_enclosing_keycap]="\U20E3"
emoji[regional_indicator_symbol_letter_d_regional_indicator_symbol_letter_e]=$'\xF0\x9F\x87\xA9\xF0\x9F\x87\xAA'
emoji[regional_indicator_symbol_letter_g_regional_indicator_symbol_letter_b]=$'\xF0\x9F\x87\xAC\xF0\x9F\x87\xA7'
@ -38,209 +39,12 @@ emoji[regional_indicator_symbol_letter_i_regional_indicator_symbol_letter_t]=$'\
emoji[regional_indicator_symbol_letter_u_regional_indicator_symbol_letter_s]=$'\xF0\x9F\x87\xBA\xF0\x9F\x87\xB8'
emoji[regional_indicator_symbol_letter_r_regional_indicator_symbol_letter_u]=$'\xF0\x9F\x87\xB7\xF0\x9F\x87\xBA'
# Nonstandard alias names
emoji[vulcan_salute]=$'\U1F596'
# Emoji combining and auxiliary characters
# "Variation Selectors" for controlling text vs emoji style presentation
# These apply to the immediately preceding character
emoji2[text_style]=$'\UFE0E'
emoji2[emoji_style]=$'\UFE0F'
# Joiner that indicates a single combined-form glyph (ligature) should be used
emoji2[zero_width_joiner]=$'\U200D'
# Skin tone modifiers
emoji2[emoji_modifier_fitzpatrick_type_1_2]=$'\U1F3FB'
emoji2[emoji_modifier_fitzpatrick_type_3]=$'\U1F3FC'
emoji2[emoji_modifier_fitzpatrick_type_4]=$'\U1F3FD'
emoji2[emoji_modifier_fitzpatrick_type_5]=$'\U1F3FE'
emoji2[emoji_modifier_fitzpatrick_type_6]=$'\U1F3FF'
# Various other combining characters. (Incomplete list; I selected ones that sound useful)
emoji2[combining_enclosing_circle]=$'\U20DD'
emoji2[combining_enclosing_square]=$'\U20DE'
emoji2[combining_enclosing_diamond]=$'\U20DF'
emoji2[combining_enclosing_circle_backslash]=$'\U20E0'
emoji2[combining_enclosing_screen]=$'\U20E2'
emoji2[combining_enclosing_keycap]=$'\U20E3'
emoji2[combining_enclosing_upward_pointing_triangle]=$'\U20E4'
# Easier access to skin tone modifiers
emoji_skintone[1_2]=$'\U1F3FB'
emoji_skintone[3]=$'\U1F3FC'
emoji_skintone[4]=$'\U1F3FD'
emoji_skintone[5]=$'\U1F3FE'
emoji_skintone[6]=$'\U1F3FF'
# Emoji groups
# These are stored in a single associative array, $emoji_groups, to avoid cluttering up the global
# namespace, and to allow adding additional group definitions at run time.
# The keys are the group names, and the values are whitespace-separated lists of emoji character names.
emoji_groups[fruits]="
tomato
aubergine
grapes
melon
watermelon
tangerine
banana
pineapple
red_apple
green_apple
peach
cherries
strawberry
lemon
pear
"
emoji_groups[vehicles]="
airplane
rocket
railway_car
high_speed_train
high_speed_train_with_bullet_nose
bus
ambulance
fire_engine
police_car
taxi
automobile
recreational_vehicle
delivery_truck
ship
speedboat
bicycle
helicopter
steam_locomotive
train
light_rail
tram
oncoming_bus
trolleybus
minibus
oncoming_police_car
oncoming_taxi
oncoming_automobile
articulated_lorry
tractor
monorail
mountain_railway
suspension_railway
mountain_cableway
aerial_tramway
rowboat
bicyclist
mountain_bicyclist
sailboat
"
emoji_groups[animals]="
snail
snake
horse
sheep
monkey
chicken
boar
elephant
octopus
spiral_shell
bug
ant
honeybee
lady_beetle
fish
tropical_fish
blowfish
turtle
hatching_chick
baby_chick
front_facing_baby_chick
bird
penguin
koala
poodle
bactrian_camel
dolphin
mouse_face
cow_face
tiger_face
rabbit_face
cat_face
dragon_face
spouting_whale
horse_face
monkey_face
dog_face
pig_face
frog_face
hamster_face
wolf_face
bear_face
panda_face
rat
mouse
ox
water_buffalo
cow
tiger
leopard
rabbit
cat
dragon
crocodile
whale
ram
goat
rooster
dog
pig
dromedary_camel
"
emoji_groups[faces]="
grinning_face_with_smiling_eyes
face_with_tears_of_joy
smiling_face_with_open_mouth
smiling_face_with_open_mouth_and_smiling_eyes
smiling_face_with_open_mouth_and_cold_sweat
smiling_face_with_open_mouth_and_tightly_closed_eyes
winking_face
smiling_face_with_smiling_eyes
face_savouring_delicious_food
relieved_face
smiling_face_with_heart_shaped_eyes
smirking_face
unamused_face
face_with_cold_sweat
pensive_face
confounded_face
face_throwing_a_kiss
kissing_face_with_closed_eyes
face_with_stuck_out_tongue_and_winking_eye
face_with_stuck_out_tongue_and_tightly_closed_eyes
disappointed_face
angry_face
pouting_face
crying_face
persevering_face
face_with_look_of_triumph
disappointed_but_relieved_face
fearful_face
weary_face
sleepy_face
tired_face
loudly_crying_face
face_with_open_mouth_and_cold_sweat
face_screaming_in_fear
astonished_face
flushed_face
dizzy_face
face_with_medical_mask
"
}
# Prints a random emoji character
@ -259,7 +63,11 @@ function random_emoji() {
[[ $list_size -eq 0 ]] && return 1
local random_index=$(( ( RANDOM % $list_size ) + 1 ))
local name=${names[$random_index]}
echo ${emoji[$name]}
if [[ "$group" == "flags" ]]; then
echo ${emoji_flags[$name]}
else
echo ${emoji[$name]}
fi
}
# Displays a listing of emoji with their names
@ -276,12 +84,26 @@ function display_emoji() {
fi
# The extra spaces in output here are a hack for readability, since some
# terminals treat these emoji chars as single-width.
local counter=1
for i in $names; do
printf '%s ' "$emoji[$i]"
if [[ "$group" == "flags" ]]; then
printf '%s ' "$emoji_flags[$i]"
else
printf '%s ' "$emoji[$i]"
fi
# New line every 20 emoji, to avoid weirdnesses
if (($counter % 20 == 0)); then
printf "\n"
fi
let counter=$counter+1
done
print
for i in $names; do
echo "${emoji[$i]} = $i"
if [[ "$group" == "flags" ]]; then
echo "${emoji_flags[$i]} = $i"
else
echo "${emoji[$i]} = $i"
fi
done
}

21538
plugins/emoji/gemoji_db.json Normal file

File diff suppressed because it is too large Load diff

View file

@ -1,113 +0,0 @@
#!/usr/bin/perl -w
#
# update_emoji.pl
#
# This script generates the emoji.plugin.zsh emoji definitions from the Unicode
# character data for the emoji characters.
#
# The data file can be found at https://unicode.org/Public/emoji/latest/emoji-data.txt
# as referenced in Unicode TR51 (https://www.unicode.org/reports/tr51/index.html).
#
# This is known to work with the data file from version 1.0. It may not work with later
# versions if the format changes. In particular, this reads line comments to get the
# emoji character name and unicode version.
#
# Country names have punctuation and other non-letter characters removed from their name,
# to avoid possible complications with having to escape the strings when using them as
# array subscripts. The definition file seems to use some combining characters like accents
# that get stripped during this process.
use strict;
use warnings;
use 5.010;
use autodie;
use Path::Class;
use File::Copy;
# Parse definitions out of the data file and convert
sub process_emoji_data_file {
my ( $infile, $outfilename ) = @_;
my $file = file($infile);
my $outfile = file($outfilename);
my $outfilebase = $outfile->basename();
my $tempfilename = "$outfilename.tmp";
my $tempfile = file($tempfilename);
my $outfh = $tempfile->openw();
$outfh->print("
# $outfilebase - Emoji character definitions for oh-my-zsh emoji plugin
#
# This file is auto-generated by update_emoji.pl. Do not edit it manually.
#
# This contains the definition for:
# \$emoji - which maps character names to Unicode characters
# \$emoji_flags - maps country names to Unicode flag characters using region indicators
# Main emoji
typeset -gAH emoji
# National flags
typeset -gAH emoji_flags
# Combining modifiers
typeset -gAH emoji_mod
");
my $fh = $file->openr();
my $line_num = 0;
while ( my $line = $fh->getline() ) {
$line_num++;
$_ = $line;
# Skip all-comment lines (from the header) and blank lines
# (But don't strip comments on normal lines; we need to parse those for
# the emoji names.)
next if /^\s*#/ or /^\s*$/;
if (/^(\S.*?\S)\s*;\s*(\w+)\s*;\s*(\w+)\s*;\s*(\w+)\s*;\s*(\w.*?)\s*#\s*V(\S+)\s\(.*?\)\s*(\w.*\S)\s*$/) {
my ($code, $style, $level, $modifier_status, $sources, $version, $keycap_name)
= ($1, $2, $3, $4, $5, $6, $7);
#print "code=$code style=$style level=$level modifier_status=$modifier_status sources=$sources version=$version name=$keycap_name\n";
my @code_points = split /\s+/, $code;
my @sources = split /\s+/, $sources;
my $flag_country = "";
if ( $keycap_name =~ /^flag for (\S.*?)\s*$/) {
$flag_country = $1;
}
my $zsh_code = join '', map { "\\U$_" } @code_points;
# Convert keycap names to valid associative array names that do not require any
# quoting. Works fine for most stuff, but is clumsy for flags.
my $omz_name = lc($keycap_name);
$omz_name =~ s/[^A-Za-z0-9]/_/g;
my $zsh_flag_country = $flag_country;
$zsh_flag_country =~ s/[^\p{Letter}]/_/g;
if ($flag_country) {
$outfh->print("emoji_flags[$zsh_flag_country]=\$'$zsh_code'\n");
} else {
$outfh->print("emoji[$omz_name]=\$'$zsh_code'\n");
}
# Modifiers are included in both the main set and their separate map,
# because they have a standalone representation as a color swatch.
if ( $modifier_status eq "modifier" ) {
$outfh->print("emoji_mod[$omz_name]=\$'$zsh_code'\n");
}
} else {
die "Failed parsing line $line_num: '$_'";
}
}
$fh->close();
$outfh->print("\n");
$outfh->close();
move($tempfilename, $outfilename)
or die "Failed moving temp file to $outfilename: $!";
}
my $datafile = "emoji-data.txt";
my $zsh_def_file = "emoji-char-definitions.zsh";
process_emoji_data_file($datafile, $zsh_def_file);
print "Updated definition file $zsh_def_file\n";

View file

@ -0,0 +1,213 @@
"""
Update Emoji.py
Refeshes OMZ emoji database based on the latest Unicode spec
"""
import re
import json
spec = open("emoji-data.txt", "r")
# Regexes
# regex_emoji will return, respectively:
# the code points, its type (status), the actual emoji, and its official name
regex_emoji = r"^([\w ].*?\S)\s*;\s*([\w-]+)\s*#\s*(.*?)\s(\S.*).*$"
# regex_group returns the group of subgroup that a line opens
regex_group = r"^#\s*(group|subgroup):\s*(.*)$"
headers = """
# emoji-char-definitions.zsh - Emoji definitions for oh-my-zsh emoji plugin
#
# This file is auto-generated by update_emoji.py. Do not edit it manually.
#
# This contains the definition for:
# $emoji - which maps character names to Unicode characters
# $emoji_flags - maps country names to Unicode flag characters using region
# indicators
# $emoji_mod - maps modifier components to Unicode characters
# $emoji_groups - a single associative array to avoid cluttering up the
# global namespace, and to allow adding additional group
# definitions at run time. The keys are the group names, and
# the values are whitespace-separated lists of emoji
# character names.
# Main emoji
typeset -gAH emoji
# National flags
typeset -gAH emoji_flags
# Combining modifiers
typeset -gAH emoji_mod
# Emoji groups
typeset -gAH emoji_groups
"""
#######
# Adding country codes
#######
# This is the only part of this script that relies on an external library
# (country_converter), and is hence commented out by default.
# You can uncomment it to have country codes added as aliases for flag
# emojis. (By default, when you install this extension, country codes are
# included as aliases, but not if you re-run this script without uncommenting.)
# Warning: country_converter is very verbose, and will print warnings all over
# your terminal.
# import country_converter as coco # pylint: disable=wrong-import-position
# cc = coco.CountryConverter()
# def country_iso(_all_names, _omz_name):
# """ Using the external library country_converter,
# this funciton can detect the ISO2 and ISO3 codes
# of the country. It takes as argument the array
# with all the names of the emoji, and returns that array."""
# omz_no_underscore = re.sub(r'_', r' ', _omz_name)
# iso2 = cc.convert(names=[omz_no_underscore], to='ISO2')
# if iso2 != 'not found':
# _all_names.append(iso2)
# iso3 = cc.convert(names=[omz_no_underscore], to='ISO3')
# _all_names.append(iso3)
# return _all_names
#######
# Helper functions
#######
def code_to_omz(_code_points):
""" Returns a ZSH-compatible Unicode string from the code point(s) """
return r'\U' + r'\U'.join(_code_points.split(' '))
def name_to_omz(_name, _group, _subgroup, _status):
""" Returns a reasonable snake_case name for the emoji. """
def snake_case(_string):
""" Does the regex work of snake_case """
remove_dots = re.sub(r'\.\(\)', r'', _string)
replace_ands = re.sub(r'\&', r'and', remove_dots)
remove_whitespace = re.sub(r'[^\#\*\w]', r'_', replace_ands)
return re.sub(r'__', r'_', remove_whitespace)
shortname = ""
split_at_colon = lambda s: s.split(": ")
# Special treatment by group and subgroup
# If the emoji is a flag, we strip "flag" from its name
if _group == "Flags" and len(split_at_colon(_name)) > 1:
shortname = snake_case(split_at_colon(_name)[1])
else:
shortname = snake_case(_name)
# Special treatment by status
# Enables us to have every emoji combination,
# even the one that are not officially sanctionned
# and are implemeted by, say, only one vendor
if _status == "unqualified":
shortname += "_unqualified"
elif _status == "minimally-qualified":
shortname += "_minimally"
return shortname
def increment_name(_shortname):
""" Increment the short name by 1. If you get, say,
'woman_detective_unqualified', it returns
'woman_detective_unqualified_1', and then
'woman_detective_unqualified_2', etc. """
last_char = _shortname[-1]
if last_char.isdigit():
num = int(last_char)
return _shortname[:-1] + str(num + 1)
return _shortname + "_1"
########
# Going through every line
########
group, subgroup, short_name_buffer = "", "", ""
emoji_database = []
for line in spec:
# First, test if this line opens a group or subgroup
group_match = re.findall(regex_group, line)
if group_match != []:
gr_or_sub, name = group_match[0]
if gr_or_sub == "group":
group = name
elif gr_or_sub == "subgroup":
subgroup = name
continue # Moving on...
# Second, test if this line references one emoji
emoji_match = re.findall(regex_emoji, line)
if emoji_match != []:
code_points, status, emoji, name = emoji_match[0]
omz_codes = code_to_omz(code_points)
omz_name = name_to_omz(name, group, subgroup, status)
# If this emoji has the same shortname as the preceding one
if omz_name in short_name_buffer:
omz_name = increment_name(short_name_buffer)
short_name_buffer = omz_name
emoji_database.append(
[omz_codes, status, emoji, omz_name, group, subgroup])
spec.close()
########
# Write to emoji-char-definitions.zsh
########
# Aliases for emojis are retrieved through the DB of Gemoji
# Retrieved on Aug 9 2019 from the following URL:
# https://raw.githubusercontent.com/github/gemoji/master/db/emoji.json
gemoji_db = open("gemoji_db.json")
j = json.load(gemoji_db)
aliases_map = {entry['emoji']: entry['aliases'] for entry in j}
all_omz_names = [emoji_data[3] for emoji_data in emoji_database]
# Let's begin writing to this file
output = open("emoji-char-definitions.zsh", "w")
output.write(headers)
emoji_groups = {"fruits": "\n", "vehicles": "\n", "hands": "\n",
"people": "\n", "animals": "\n", "faces": "\n",
"flags": "\n"}
# First, write every emoji down
for _omz_codes, _status, _emoji, _omz_name, _group, _subgroup in emoji_database:
# One emoji can be mapped to multiple names (aliases or country codes)
names_for_this_emoji = [_omz_name]
# Variable that indicates in which map the emoji will be located
emoji_map = "emoji"
if _status == "component":
emoji_map = "emoji_mod"
if _group == "Flags":
emoji_map = "emoji_flags"
# Adding country codes (Optional, see above)
# names_for_this_emoji = country_iso(names_for_this_emoji, _omz_name)
# Check if there is an alias available in the Gemoji DB
if _emoji in aliases_map.keys():
for alias in aliases_map[_emoji]:
if alias not in all_omz_names:
names_for_this_emoji.append(alias)
# And now we write to the definitions file
for one_name in names_for_this_emoji:
output.write(f"{emoji_map}[{one_name}]=$'{_omz_codes}'\n")
# Storing the emoji in defined subgroups for the next step
if _status == "fully-qualified":
if _subgroup == "food-fruit":
emoji_groups["fruits"] += f" {_omz_name}\n"
elif "transport-" in _subgroup:
emoji_groups["vehicles"] += f" {_omz_name}\n"
elif "hand-" in _subgroup:
emoji_groups["hands"] += f" {_omz_name}\n"
elif "person-" in _subgroup or _subgroup == "family":
emoji_groups["people"] += f" {_omz_name}\n"
elif "animal-" in _subgroup:
emoji_groups["animals"] += f" {_omz_name}\n"
elif "face-" in _subgroup:
emoji_groups["faces"] += f" {_omz_name}\n"
elif _group == "Flags":
emoji_groups["flags"] += f" {_omz_name}\n"
# Second, write the subgroups to the end of the file
for name, string in emoji_groups.items():
output.write(f'\nemoji_groups[{name}]="{string}"\n')
output.close()

View file

@ -10,6 +10,11 @@
# % export emotty_set=nature
# ------------------------------------------------------------------------------
# Handle $0 according to the standard:
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
typeset -gAH _emotty_sets
local _emotty_plugin_dir="${0:h}"
source "$_emotty_plugin_dir/emotty_stellar_set.zsh"

View file

@ -4,6 +4,7 @@ This plugin adds a way to reference certain files or folders used frequently usi
a global alias or shortcut.
To use it, add `fastfile` to the plugins array in your zshrc file:
```zsh
plugins=(... fastfile)
```
@ -13,36 +14,38 @@ plugins=(... fastfile)
Example: you access folder `/code/project/backend/database` very frequently.
First, generate a shortcut with the name `pjdb`:
```zsh
$ fastfile pjdb /code/project/backend/database
```
Next time you want to access it, use `§pjdb`. For example:
```zsh
$ cd §pjdb
$ subl §pjdb
```
where § is the fastfile prefix (see [below](#options) for how to change).
**Note:** shortcuts with spaces in the name are assigned a global alias
where the spaces have been substituted with underscores (`_`). For example:
a shortcut named `"hello world"` corresponds with `§hello_world`.
## Functions
- `fastfile <shortcut_name> <path/to/file/or/folder>`: generate a shortcut.
- `fastfile <shortcut_name> [path/to/file/or/folder]`: generate a shortcut.
If the second argument is not provided, the current directory is used.
- `fastfile_print <shortcut_name>`: prints a shortcut, with the format
`<prefix><shortcut_name> -> <shortcut_path>`.
- `fastfile_ls`: lists all shortcuts.
- `fastfile_rm <shortcut_name> `: remove a shortcut.
- `fastfile_rm <shortcut_name>`: remove a shortcut.
- `fastfile_sync`: generates the global aliases for the shortcuts.
### Internal functions
- `fastfile_resolv <shortcut_name>`: resolves the location of the shortcut
@ -51,7 +54,6 @@ a shortcut named `"hello world"` corresponds with `§hello_world`.
- `fastfile_get <shortcut_name>`: get the real path of the shortcut.
## Aliases
| Alias | Function |
@ -62,7 +64,6 @@ a shortcut named `"hello world"` corresponds with `§hello_world`.
| ffls | `fastfile_ls` |
| ffsync | `fastfile_sync` |
## Options
These are options you can set to change certain parts of the plugin. To change

View file

@ -18,7 +18,7 @@ default fastfile_var_prefix "§"
# 1. name - The name of the shortcut (default: name of the file)
# 2. file - The file or directory to make the shortcut for
# STDOUT:
# => fastfle_print
# => fastfile_print
#
function fastfile() {
test "$2" || 2="."
@ -44,7 +44,7 @@ function fastfile() {
# The path to the shortcut file
#
function fastfile_resolv() {
echo "${fastfile_dir}${1}"
echo "${fastfile_dir}/${1}"
}
#
@ -75,14 +75,14 @@ function fastfile_print() {
# List all shortcuts
#
# STDOUT:
# (=> fastfle_print) for each shortcut
# (=> fastfile_print) for each shortcut
#
function fastfile_ls() {
for f in "${fastfile_dir}"/*(NF); do
file=`basename "$f"` # To enable simpler handeling of spaces in file names
varkey=`echo "$file" | tr " " "_"`
for f in "${fastfile_dir}"/*(N); do
file=$(basename "$f") # To enable simpler handling of spaces in file names
varkey=$(echo "$file" | tr " " "_")
# Special format for colums
# Special format for columns
echo "${fastfile_var_prefix}${varkey}|->|$(fastfile_get "$file")"
done | column -t -s "|"
}
@ -93,20 +93,21 @@ function fastfile_ls() {
# Arguments:
# 1. name - The name of the shortcut (default: name of the file)
# STDOUT:
# => fastfle_print
# => fastfile_print
#
function fastfile_rm() {
fastfile_print "$1"
rm "$(fastfile_resolv "$1")"
unalias "${fastfile_var_prefix}${1}"
}
#
# Generate the aliases for the shortcuts
#
function fastfile_sync() {
for f in "${fastfile_dir}"/*(NF); do
file=`basename "$f"` # To enable simpler handeling of spaces in file names
varkey=`echo "$file" | tr " " "_"`
for f in "${fastfile_dir}"/*(N); do
file=$(basename "$f") # To enable simpler handling of spaces in file names
varkey=$(echo "$file" | tr " " "_")
alias -g "${fastfile_var_prefix}${varkey}"="'$(fastfile_get "$file")'"
done

View file

@ -8,6 +8,6 @@ To use it, add `fd` to the plugins array in your zshrc file:
plugins=(... fd)
```
Completion is taken from the fd release [`7.3.0`](https://github.com/sharkdp/fd/releases/tag/v7.3.0).
Completion is taken from the fd release [`8.2.1`](https://github.com/sharkdp/fd/releases/tag/v8.2.1).
Updated on Febrary 13th, 2019.
Updated on April 1st, 2021.

View file

@ -1,83 +1,268 @@
#compdef fd fdfind
##
# zsh completion function for fd
#
# Based on ripgrep completion function.
# Originally based on code from the zsh-users project — see copyright notice
# below.
autoload -U is-at-least
_fd() {
typeset -A opt_args
typeset -a _arguments_options
local ret=1
local curcontext="$curcontext" no='!' ret=1
local -a context line state state_descr _arguments_options fd_types fd_args
local -A opt_args
if is-at-least 5.2; then
_arguments_options=(-s -S -C)
else
_arguments_options=(-s -C)
fi
if is-at-least 5.2; then
_arguments_options=( -s -S )
else
_arguments_options=( -s )
fi
local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" \
'-d+[Set maximum search depth (default: none)]' \
'--max-depth=[Set maximum search depth (default: none)]' \
'--maxdepth=[See --max-depth]' \
'*-t+[Filter by type: file (f), directory (d), symlink (l),
executable (x), empty (e)]: :(f file d directory l symlink x executable e empty)' \
'*--type=[Filter by type: file (f), directory (d), symlink (l),
executable (x), empty (e)]: :(f file d directory l symlink x executable e empty)' \
'*-e+[Filter by file extension]' \
'*--extension=[Filter by file extension]' \
'-x+[Execute a command for each search result]' \
'--exec=[Execute a command for each search result]' \
'(-x --exec)-X+[Execute a command with all search results at once]' \
'(-x --exec)--exec-batch=[Execute a command with all search results at once]' \
'*-E+[Exclude entries that match the given glob pattern]' \
'*--exclude=[Exclude entries that match the given glob pattern]' \
'*--ignore-file=[Add a custom ignore-file in .gitignore format]' \
'-c+[When to use colors: never, *auto*, always]: :(never auto always)' \
'--color=[When to use colors: never, *auto*, always]: :(never auto always)' \
'-j+[Set number of threads to use for searching & executing]' \
'--threads=[Set number of threads to use for searching & executing]' \
'*-S+[Limit results based on the size of files.]' \
'*--size=[Limit results based on the size of files.]' \
'--max-buffer-time=[the time (in ms) to buffer, before streaming to the console]' \
'--changed-within=[Filter by file modification time (newer than)]' \
'--changed-before=[Filter by file modification time (older than)]' \
'*--search-path=[(hidden)]' \
'-H[Search hidden files and directories]' \
'--hidden[Search hidden files and directories]' \
'-I[Do not respect .(git|fd)ignore files]' \
'--no-ignore[Do not respect .(git|fd)ignore files]' \
'--no-ignore-vcs[Do not respect .gitignore files]' \
'*-u[Alias for no-ignore and/or hidden]' \
'-s[Case-sensitive search (default: smart case)]' \
'--case-sensitive[Case-sensitive search (default: smart case)]' \
'-i[Case-insensitive search (default: smart case)]' \
'--ignore-case[Case-insensitive search (default: smart case)]' \
'-F[Treat the pattern as a literal string]' \
'--fixed-strings[Treat the pattern as a literal string]' \
'-a[Show absolute instead of relative paths]' \
'--absolute-path[Show absolute instead of relative paths]' \
'-L[Follow symbolic links]' \
'--follow[Follow symbolic links]' \
'-p[Search full path (default: file-/dirname only)]' \
'--full-path[Search full path (default: file-/dirname only)]' \
'-0[Separate results by the null character]' \
'--print0[Separate results by the null character]' \
'--show-errors[Enable display of filesystem errors]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'::pattern -- the search pattern, a regular expression (optional):_files' \
'::path -- the root directory for the filesystem search (optional):_files' \
&& ret=0
fd_types=(
{f,file}'\:"regular files"'
{d,directory}'\:"directories"'
{l,symlink}'\:"symbolic links"'
{e,empty}'\:"empty files or directories"'
{x,executable}'\:"executable (files)"'
{s,socket}'\:"sockets"'
{p,pipe}'\:"named pipes (FIFOs)"'
)
}
# Do not complete rare options unless either the current prefix
# matches one of those options or the user has the `complete-all`
# style set. Note that this prefix check has to be updated manually to account
# for all of the potential negation options listed below!
if
# (--[bpsu]* => match all options marked with '$no')
[[ $PREFIX$SUFFIX == --[bopsu]* ]] ||
zstyle -t ":complete:$curcontext:*" complete-all
then
no=
fi
(( $+functions[_fd_commands] )) ||
_fd_commands() {
local commands; commands=(
# We make heavy use of argument groups here to prevent the option specs from
# growing unwieldy. These aren't supported in zsh <5.4, though, so we'll strip
# them out below if necessary. This makes the exclusions inaccurate on those
# older versions, but oh well — it's not that big a deal
fd_args=(
+ '(hidden)' # hidden files
{-H,--hidden}'[search hidden files/directories]'
)
_describe -t commands 'fd commands' commands "$@"
+ '(no-ignore-full)' # all ignore files
'(no-ignore-partial)'{-I,--no-ignore}"[don't respect .(git|fd)ignore and global ignore files]"
$no'(no-ignore-partial)*'{-u,--unrestricted}'[alias for --no-ignore, when repeated also alias for --hidden]'
+ no-ignore-partial # some ignore files
"(no-ignore-full --no-ignore-vcs)--no-ignore-vcs[don't respect .gitignore files]"
"!(no-ignore-full --no-global-ignore-file)--no-global-ignore-file[don't respect the global ignore file]"
+ '(case)' # case-sensitivity
{-s,--case-sensitive}'[perform a case-sensitive search]'
{-i,--ignore-case}'[perform a case-insensitive search]'
+ '(regex-pattern)' # regex-based search pattern
'(no-regex-pattern)--regex[perform a regex-based search (default)]'
+ '(no-regex-pattern)' # non-regex-based search pattern
{-g,--glob}'[perform a glob-based search]'
{-F,--fixed-strings}'[treat pattern as literal string instead of a regex]'
+ '(match-full)' # match against full path
{-p,--full-path}'[match the pattern against the full path instead of the basename]'
+ '(follow)' # follow symlinks
{-L,--follow}'[follow symbolic links to directories]'
+ '(abs-path)' # show absolute paths
'(long-listing)'{-a,--absolute-path}'[show absolute paths instead of relative paths]'
+ '(null-sep)' # use null separator for output
'(long-listing)'{-0,--print0}'[separate search results by the null character]'
+ '(long-listing)' # long-listing output
'(abs-path null-sep max-results exec-cmds)'{-l,--list-details}'[use a long listing format with file metadata]'
+ '(max-results)' # max number of results
'(long-listing exec-cmds)--max-results=[limit number of search results to given count and quit]:count'
'(long-listing exec-cmds)-1[limit to a single search result and quit]'
+ '(fs-errors)' # file-system errors
$no'--show-errors[enable the display of filesystem errors]'
+ '(fs-traversal)' # file-system traversal
$no"--one-file-system[don't descend into directories on other file systems]"
'!--mount'
'!--xdev'
+ dir-depth # directory depth
'(--exact-depth -d --max-depth)'{-d+,--max-depth=}'[set max directory depth to descend when searching]:depth'
'!(--exact-depth -d --max-depth)--maxdepth:depth'
'(--exact-depth --min-depth)--min-depth=[set directory depth to descend before start searching]:depth'
'(--exact-depth -d --max-depth --maxdepth --min-depth)--exact-depth=[only search at the exact given directory depth]:depth'
+ prune # pruning
"--prune[don't traverse into matching directories]"
+ filter-misc # filter search
'*'{-t+,--type=}"[filter search by type]:type:(($fd_types))"
'*'{-e+,--extension=}'[filter search by file extension]:extension'
'*'{-E+,--exclude=}'[exclude files/directories that match the given glob pattern]:glob pattern'
'*'{-S+,--size=}'[limit search by file size]:size limit:->size'
'(-o --owner)'{-o+,--owner=}'[filter by owning user and/or group]:owner and/or group:->owner'
+ ignore-file # extra ignore files
'*--ignore-file=[add a custom, low-precedence ignore-file with .gitignore format]: :_files'
+ '(filter-mtime-newer)' # filter by files modified after than
'--changed-within=[limit search to files/directories modified within the given date/duration]:date or duration'
'!--change-newer-than=:date/duration'
'!--newer=:date/duration'
+ '(filter-mtime-older)' # filter by files modified before than
'--changed-before=[limit search to files/directories modified before the given date/duration]:date or duration'
'!--change-older-than=:date/duration'
'!--older=:date/duration'
+ '(color)' # colorize output
{-c+,--color=}'[declare when to colorize search results]:when to colorize:((
auto\:"show colors if the output goes to an interactive console (default)"
never\:"do not use colorized output"
always\:"always use colorized output"
))'
+ '(threads)'
{-j+,--threads=}'[set the number of threads for searching and executing]:number of threads'
+ '(exec-cmds)' # execute command
'(long-listing max-results)'{-x+,--exec=}'[execute command for each search result]:command: _command_names -e:*\;::program arguments: _normal'
'(long-listing max-results)'{-X+,--exec-batch=}'[execute command for all search results at once]:command: _command_names -e:*\;::program arguments: _normal'
+ other
'!(--max-buffer-time)--max-buffer-time=[set amount of time to buffer before showing output]:time (ms)'
+ '(about)' # about flags
'(: * -)'{-h,--help}'[display help message]'
'(: * -)'{-v,--version}'[display version information]'
+ path-sep # set path separator for output
$no'(--path-separator)--path-separator=[set the path separator to use when printing file paths]:path separator'
+ search-path
$no'(--base-directory)--base-directory=[change the current working directory to the given path]:directory:_files -/'
$no'(*)*--search-path=[set search path (instead of positional <path> arguments)]:directory:_files -/'
+ args # positional arguments
'1: :_guard "^-*" pattern'
'(--search-path)*:directory:_files -/'
)
# Strip out argument groups where unsupported (see above)
is-at-least 5.4 ||
fd_args=( ${(@)args:#(#i)(+|[a-z0-9][a-z0-9_-]#|\([a-z0-9][a-z0-9_-]#\))} )
_arguments $_arguments_options : $fd_args && ret=0
case ${state} in
owner)
compset -P '(\\|)\!'
if compset -P '*:'; then
_groups && ret=0
else
if
compset -S ':*' ||
# Do not add the colon suffix when completing "!user<TAB>
# (with a starting double-quote) otherwise pressing tab again
# after the inserted colon "!user:<TAB> will complete history modifiers
[[ $IPREFIX == (\\|\!)* && ($QIPREFIX == \"* && -z $QISUFFIX) ]]
then
_users && ret=0
else
local q
# Since quotes are needed when using the negation prefix !,
# automatically remove the colon suffix also when closing the quote
if [[ $QIPREFIX == [\'\"]* ]]; then
q=${QIPREFIX:0:1}
fi
_users -r ": \t\n\-$q" -S : && ret=0
fi
fi
;;
size)
if compset -P '[-+][0-9]##'; then
local -a suff=(
'B:bytes'
'K:kilobytes (10^3 = 1000 bytes)'
'M:megabytes (10^6 = 1000^2 bytes)'
'G:gigabytes (10^9 = 1000^3 bytes)'
'T:terabytes (10^12 = 1000^4 bytes)'
'Ki:kibibytes ( 2^10 = 1024 bytes)'
'Mi:mebibytes ( 2^20 = 1024^2 bytes)'
'Gi:gigibytes ( 2^30 = 1024^3 bytes)'
'Ti:tebibytes ( 2^40 = 1024^4 bytes)'
)
_describe -t units 'size limit units' suff -V 'units'
elif compset -P '[-+]'; then
_message -e 'size limit number (full format: <+-><number><unit>)'
else
_values 'size limit prefix (full format: <prefix><number><unit>)' \
'\+[file size must be greater or equal to]'\
'-[file size must be less than or equal to]' && ret=0
fi
;;
esac
return ret
}
_fd "$@"
# ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for fd
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * smancill (https://github.com/smancill)
#
# ------------------------------------------------------------------------------
# Local Variables:
# mode: shell-script
# coding: utf-8-unix
# indent-tabs-mode: nil
# sh-indentation: 2
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

9
plugins/fig/README.md Normal file
View file

@ -0,0 +1,9 @@
# Fig plugin
This plugin sets up completion for [Fig](https://fig.io/).
To use it, add `fig` to the plugins array in your zshrc file:
```zsh
plugins=(... fig)
```

View file

@ -0,0 +1,13 @@
if ! (( $+commands[fig] )); then
return
fi
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `fig`. Otherwise, compinit will have already done that
if [[ ! -f "$ZSH_CACHE_DIR/completions/_fig" ]]; then
autoload -Uz _fig
typeset -g -A _comps
_comps[fig]=_fig
fi
fig completion zsh >| "$ZSH_CACHE_DIR/completions/_fig" &|

View file

@ -2,20 +2,27 @@
The Flutter plugin provides completion and useful aliases
To use it, add flutter to the plugins array of your zshrc file:
To use it, add `flutter` to the plugins array of your zshrc file:
```
```zsh
plugins=(... flutter)
```
## Aliases
| Alias | Command | Description |
| :--------- | :--------------------- | :------------------------------------------------------------------------- |
| `fl` | `flutter` | Shorthand for flutter command |
| `flr` | `flutter run` | Runs flutter app |
| `fldoc` | `flutter doctor` | Runs flutter doctor |
| `flb` | `flutter build` | Build flutter application |
| `flattach` | `flutter attach` | Attaches flutter to a running flutter application with enabled observatory |
| `flget` | `flutter packages get` | Installs dependencies |
| `flc` | `flutter clean` | Cleans flutter porject |
| Alias | Command | Description |
| :--------- | :---------------------- | :------------------------------------------------------------------------- |
| `fl` | `flutter` | Shorthand for flutter command |
| `flattach` | `flutter attach` | Attaches flutter to a running flutter application with enabled observatory |
| `flb` | `flutter build` | Build flutter application |
| `flchnl` | `flutter channel` | Switches flutter channel (requires input of desired channel) |
| `flc` | `flutter clean` | Cleans flutter project |
| `fldvcs` | `flutter devices` | List connected devices (if any) |
| `fldoc` | `flutter doctor` | Runs flutter doctor |
| `flpub` | `flutter pub` | Shorthand for flutter pub command |
| `flget` | `flutter pub get` | Installs dependencies |
| `flr` | `flutter run` | Runs flutter app |
| `flrd` | `flutter run --debug` | Runs flutter app in debug mode (default mode) |
| `flrp` | `flutter run --profile` | Runs flutter app in profile mode |
| `flrr` | `flutter run --release` | Runs flutter app in release mode |
| `flupgrd` | `flutter upgrade` | Upgrades flutter version depending on the current channel |

View file

@ -1,7 +1,14 @@
alias fl="flutter"
alias flr="flutter run"
alias fldoc="flutter doctor"
alias flb="flutter build"
alias flattach="flutter attach"
alias flget="flutter packages get"
alias flb="flutter build"
alias flchnl="flutter channel"
alias flc="flutter clean"
alias fldvcs="flutter devices"
alias fldoc="flutter doctor"
alias flpub="flutter pub"
alias flget="flutter pub get"
alias flr="flutter run"
alias flrd="flutter run --debug"
alias flrp="flutter run --profile"
alias flrr="flutter run --release"
alias flupgrd="flutter upgrade"

View file

@ -1,23 +1,26 @@
if (( $+commands[fnm] )); then
# remove old generated completion file
command rm -f "${0:A:h}/_fnm"
ver="$(fnm --version)"
ver_file="$ZSH_CACHE_DIR/fnm_version"
comp_file="$ZSH_CACHE_DIR/completions/_fnm"
mkdir -p "${comp_file:h}"
(( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath)
if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then
fnm completions --shell=zsh >| "$comp_file"
echo "$ver" >| "$ver_file"
fi
declare -A _comps
autoload -Uz _fnm
_comps[fnm]=_fnm
unset ver ver_file comp_file
if (( ! $+commands[fnm] )); then
return
fi
# TODO: 2021-12-28: remove this block
# Handle $0 according to the standard:
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
# remove old generated files
command rm -f "${0:A:h}/_fnm" "$ZSH_CACHE_DIR/fnm_version"
# TODO: 2021-12-28: remove this bit of code as it exists in oh-my-zsh.sh
# Add completions folder in $ZSH_CACHE_DIR
command mkdir -p "$ZSH_CACHE_DIR/completions"
(( ${fpath[(Ie)"$ZSH_CACHE_DIR/completions"]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath)
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `fnm`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_fnm" ]]; then
typeset -g -A _comps
autoload -Uz _fnm
_comps[fnm]=_fnm
fi
fnm completions --shell=zsh >| "$ZSH_CACHE_DIR/completions/_fnm" &|

32
plugins/fossil/_fossil Normal file
View file

@ -0,0 +1,32 @@
#compdef fossil
function _fossil_get_command_list () {
fossil help -a | grep -v "Usage|Common|This is"
}
function _fossil () {
local context state state_descr line
typeset -A opt_args
_arguments \
'1: :->command'\
'2: :->subcommand'
case $state in
command)
local _OUTPUT=$(fossil branch 2>&1 | grep "use --repo")
if [[ -z "$_OUTPUT" ]]; then
compadd "$(_fossil_get_command_list)"
else
compadd clone init import help version
fi ;;
subcommand)
case "$words[2]" in
help) compadd "$(_fossil_get_command_list)" ;;
add) compadd "$(fossil extra)" ;;
*) compcall -D ;;
esac ;;
esac
}
_fossil "$@"

View file

@ -12,55 +12,26 @@ ZSH_THEME_FOSSIL_PROMPT_DIRTY=" %{$fg_bold[red]%}✖"
# Text to display if the branch is clean
ZSH_THEME_FOSSIL_PROMPT_CLEAN=" %{$fg_bold[green]%}✔"
function fossil_prompt_info () {
local _OUTPUT=`fossil branch 2>&1`
local _STATUS=`echo $_OUTPUT | grep "use --repo"`
if [ "$_STATUS" = "" ]; then
local _EDITED=`fossil changes`
local _EDITED_SYM="$ZSH_THEME_FOSSIL_PROMPT_CLEAN"
local _BRANCH=`echo $_OUTPUT | grep "* " | sed 's/* //g'`
function fossil_prompt_info() {
local info=$(fossil branch 2>&1)
if [ "$_EDITED" != "" ]; then
_EDITED_SYM="$ZSH_THEME_FOSSIL_PROMPT_DIRTY"
fi
# if we're not in a fossil repo, don't show anything
! command grep -q "use --repo" <<< "$info" || return
echo "$ZSH_THEME_FOSSIL_PROMPT_PREFIX" \
"$_BRANCH" \
"$ZSH_THEME_FOSSIL_PROMPT_SUFFIX" \
"$_EDITED_SYM"\
"%{$reset_color%}"
local branch=$(echo $info | grep "* " | sed 's/* //g')
local changes=$(fossil changes)
local dirty="$ZSH_THEME_FOSSIL_PROMPT_CLEAN"
if [[ -n "$changes" ]]; then
dirty="$ZSH_THEME_FOSSIL_PROMPT_DIRTY"
fi
}
function _fossil_get_command_list () {
fossil help -a | grep -v "Usage|Common|This is"
}
function _fossil () {
local context state state_descr line
typeset -A opt_args
_arguments \
'1: :->command'\
'2: :->subcommand'
case $state in
command)
local _OUTPUT=`fossil branch 2>&1 | grep "use --repo"`
if [ "$_OUTPUT" = "" ]; then
compadd `_fossil_get_command_list`
else
compadd clone init import help version
fi
;;
subcommand)
if [ "$words[2]" = "help" ]; then
compadd `_fossil_get_command_list`
else
compcall -D
fi
;;
esac
printf '%s %s %s %s %s' \
"$ZSH_THEME_FOSSIL_PROMPT_PREFIX" \
"${branch:gs/%/%%}" \
"$ZSH_THEME_FOSSIL_PROMPT_SUFFIX" \
"$dirty" \
"%{$reset_color%}"
}
function _fossil_prompt () {
@ -82,8 +53,5 @@ function _fossil_prompt () {
fi
}
compdef _fossil fossil
autoload -U add-zsh-hook
add-zsh-hook precmd _fossil_prompt

View file

@ -39,7 +39,7 @@ function frontend() {
emulate -L zsh
# define search context URLS
typeset -A urls
local -A urls
urls=(
angular 'https://angular.io/?search='
angularjs $(_frontend_fallback 'angularjs.org')
@ -73,25 +73,23 @@ function frontend() {
)
# show help for command list
if [[ $# -lt 2 ]]
then
print -P "Usage: frontend %Ucontext%u %Uterm%u [...%Umore%u] (or just: %Ucontext%u %Uterm%u [...%Umore%u])"
print -P ""
print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website,"
print -P "and %Ucontext%u is one of the following:"
print -P ""
print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash,"
print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
print -P ""
print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
print -P ""
return 1
if [[ $# -lt 2 ]]; then
print -P "Usage: frontend %Ucontext%u %Uterm%u [...%Umore%u] (or just: %Ucontext%u %Uterm%u [...%Umore%u])"
print -P ""
print -P "%Uterm%u and what follows is what will be searched for in the %Ucontext%u website,"
print -P "and %Ucontext%u is one of the following:"
print -P ""
print -P " angular, angularjs, bem, bootsnipp, caniuse, codepen, compassdoc, cssflow, packagephobia"
print -P " dartlang, emberjs, fontello, flowtype, github, html5please, jestjs, jquery, lodash,"
print -P " mdn, npmjs, nodejs, qunit, reactjs, smacss, stackoverflow, unheap, vuejs, bundlephobia"
print -P ""
print -P "For example: frontend npmjs mocha (or just: npmjs mocha)."
print -P ""
return 1
fi
# check whether the search context is supported
if [[ -z "$urls[$1]" ]]
then
if [[ -z "$urls[$1]" ]]; then
echo "Search context \"$1\" currently not supported."
echo ""
echo "Valid contexts are:"

View file

@ -26,7 +26,7 @@ export FZF_BASE=/path/to/fzf/install/dir
Set default command to use when input is tty:
```zsh
export FZF_DEFAULT_COMMAND='<your fzf default commmand>'
export FZF_DEFAULT_COMMAND='<your fzf default command>'
```
If not set, the plugin will try to set it to these, in the order in which they're found:

View file

@ -1,176 +1,201 @@
function setup_using_base_dir() {
local fzf_base fzf_shell fzfdirs dir
function fzf_setup_using_base_dir() {
local fzf_base fzf_shell fzfdirs dir
test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}"
test -d "${FZF_BASE}" && fzf_base="${FZF_BASE}"
if [[ -z "${fzf_base}" ]]; then
fzfdirs=(
"${HOME}/.fzf"
"${HOME}/.nix-profile/share/fzf"
"${XDG_DATA_HOME:-$HOME/.local/share}/fzf"
"/usr/local/opt/fzf"
"/usr/share/fzf"
"/usr/local/share/examples/fzf"
)
for dir in ${fzfdirs}; do
if [[ -d "${dir}" ]]; then
fzf_base="${dir}"
break
fi
done
if [[ -z "${fzf_base}" ]]; then
fzfdirs=(
"${HOME}/.fzf"
"${HOME}/.nix-profile/share/fzf"
"${XDG_DATA_HOME:-$HOME/.local/share}/fzf"
"/usr/local/opt/fzf"
"/usr/share/fzf"
"/usr/local/share/examples/fzf"
)
for dir in ${fzfdirs}; do
if [[ -d "${dir}" ]]; then
fzf_base="${dir}"
break
fi
done
if [[ -z "${fzf_base}" ]]; then
if (( ${+commands[fzf-share]} )) && dir="$(fzf-share)" && [[ -d "${dir}" ]]; then
fzf_base="${dir}"
elif (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then
if [[ -d "${dir}" ]]; then
fzf_base="${dir}"
fi
fi
if (( ${+commands[fzf-share]} )) && dir="$(fzf-share)" && [[ -d "${dir}" ]]; then
fzf_base="${dir}"
elif (( ${+commands[brew]} )) && dir="$(brew --prefix fzf 2>/dev/null)"; then
if [[ -d "${dir}" ]]; then
fzf_base="${dir}"
fi
fi
fi
fi
if [[ ! -d "${fzf_base}" ]]; then
return 1
fi
if [[ ! -d "${fzf_base}" ]]; then
return 1
fi
# Fix fzf shell directory for Arch Linux, NixOS or Void Linux packages
if [[ ! -d "${fzf_base}/shell" ]]; then
fzf_shell="${fzf_base}"
else
fzf_shell="${fzf_base}/shell"
fi
# Fix fzf shell directory for Arch Linux, NixOS or Void Linux packages
if [[ ! -d "${fzf_base}/shell" ]]; then
fzf_shell="${fzf_base}"
else
fzf_shell="${fzf_base}/shell"
fi
# Setup fzf binary path
if (( ! ${+commands[fzf]} )) && [[ "$PATH" != *$fzf_base/bin* ]]; then
export PATH="$PATH:$fzf_base/bin"
fi
# Setup fzf binary path
if (( ! ${+commands[fzf]} )) && [[ "$PATH" != *$fzf_base/bin* ]]; then
export PATH="$PATH:$fzf_base/bin"
fi
# Auto-completion
if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
source "${fzf_shell}/completion.zsh" 2> /dev/null
fi
# Auto-completion
if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
source "${fzf_shell}/completion.zsh" 2> /dev/null
fi
# Key bindings
if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then
source "${fzf_shell}/key-bindings.zsh"
fi
# Key bindings
if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then
source "${fzf_shell}/key-bindings.zsh"
fi
}
function setup_using_debian_package() {
if (( ! $+commands[dpkg] )) || ! dpkg -s fzf &>/dev/null; then
# Either not a debian based distro, or no fzf installed
return 1
fi
function fzf_setup_using_debian() {
if (( ! $+commands[dpkg] )) || ! dpkg -s fzf &>/dev/null; then
# Either not a debian based distro, or no fzf installed
return 1
fi
# NOTE: There is no need to configure PATH for debian package, all binaries
# are installed to /usr/bin by default
# NOTE: There is no need to configure PATH for debian package, all binaries
# are installed to /usr/bin by default
local completions key_bindings
local completions key_bindings
case $PREFIX in
*com.termux*)
# Support Termux package
completions="${PREFIX}/share/fzf/completion.zsh"
key_bindings="${PREFIX}/share/fzf/key-bindings.zsh"
;;
*)
# Determine completion file path: first bullseye/sid, then buster/stretch
completions="/usr/share/doc/fzf/examples/completion.zsh"
[[ -f "$completions" ]] || completions="/usr/share/zsh/vendor-completions/_fzf"
key_bindings="/usr/share/doc/fzf/examples/key-bindings.zsh"
;;
esac
case $PREFIX in
*com.termux*)
# Support Termux package
completions="${PREFIX}/share/fzf/completion.zsh"
key_bindings="${PREFIX}/share/fzf/key-bindings.zsh"
;;
*)
# Determine completion file path: first bullseye/sid, then buster/stretch
completions="/usr/share/doc/fzf/examples/completion.zsh"
[[ -f "$completions" ]] || completions="/usr/share/zsh/vendor-completions/_fzf"
key_bindings="/usr/share/doc/fzf/examples/key-bindings.zsh"
;;
esac
# Auto-completion
if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
source $completions 2> /dev/null
fi
# Auto-completion
if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
source $completions 2> /dev/null
fi
# Key bindings
if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
source $key_bindings
fi
# Key bindings
if [[ ! "$DISABLE_FZF_KEY_BINDINGS" == "true" ]]; then
source $key_bindings
fi
return 0
return 0
}
function setup_using_opensuse_package() {
# OpenSUSE installs fzf in /usr/bin/fzf
# If the command is not found, the package isn't installed
(( $+commands[fzf] )) || return 1
function fzf_setup_using_opensuse() {
# OpenSUSE installs fzf in /usr/bin/fzf
# If the command is not found, the package isn't installed
(( $+commands[fzf] )) || return 1
# The fzf-zsh-completion package installs the auto-completion in
local completions="/usr/share/zsh/site-functions/_fzf"
# The fzf-zsh-completion package installs the key-bindings file in
local key_bindings="/etc/zsh_completion.d/fzf-key-bindings"
# The fzf-zsh-completion package installs the auto-completion in
local completions="/usr/share/zsh/site-functions/_fzf"
# The fzf-zsh-completion package installs the key-bindings file in
local key_bindings="/etc/zsh_completion.d/fzf-key-bindings"
# If these are not found: (1) maybe we're not on OpenSUSE, or
# (2) maybe the fzf-zsh-completion package isn't installed.
if [[ ! -f "$completions" || ! -f "$key_bindings" ]]; then
return 1
fi
# If these are not found: (1) maybe we're not on OpenSUSE, or
# (2) maybe the fzf-zsh-completion package isn't installed.
if [[ ! -f "$completions" || ! -f "$key_bindings" ]]; then
return 1
fi
# Auto-completion
if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
source "$completions" 2>/dev/null
fi
# Auto-completion
if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
source "$completions" 2>/dev/null
fi
# Key bindings
if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then
source "$key_bindings" 2>/dev/null
fi
# Key bindings
if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then
source "$key_bindings" 2>/dev/null
fi
return 0
return 0
}
function setup_using_openbsd_package() {
# openBSD installs fzf in /usr/local/bin/fzf
if [[ "$OSTYPE" != openbsd* ]] || (( ! $+commands[fzf] )); then
return 1
fi
function fzf_setup_using_openbsd() {
# openBSD installs fzf in /usr/local/bin/fzf
if [[ "$OSTYPE" != openbsd* ]] || (( ! $+commands[fzf] )); then
return 1
fi
# The fzf package installs the auto-completion in
local completions="/usr/local/share/zsh/site-functions/_fzf_completion"
# The fzf package installs the key-bindings file in
local key_bindings="/usr/local/share/zsh/site-functions/_fzf_key_bindings"
# The fzf package installs the auto-completion in
local completions="/usr/local/share/zsh/site-functions/_fzf_completion"
# The fzf package installs the key-bindings file in
local key_bindings="/usr/local/share/zsh/site-functions/_fzf_key_bindings"
# Auto-completion
if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
source "$completions" 2>/dev/null
fi
# Auto-completion
if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
source "$completions" 2>/dev/null
fi
# Key bindings
if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then
source "$key_bindings" 2>/dev/null
fi
# Key bindings
if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then
source "$key_bindings" 2>/dev/null
fi
return 0
return 0
}
function indicate_error() {
cat >&2 <<EOF
[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.
Please add \`export FZF_BASE=/path/to/fzf/install/dir\` to your .zshrc
EOF
function fzf_setup_using_cygwin() {
# Cygwin installs fzf in /usr/local/bin/fzf
if [[ "$OSTYPE" != cygwin* ]] || (( ! $+commands[fzf] )); then
return 1
fi
# The fzf-zsh-completion package installs the auto-completion in
local completions="/etc/profile.d/fzf-completion.zsh"
# The fzf-zsh package installs the key-bindings file in
local key_bindings="/etc/profile.d/fzf.zsh"
# Auto-completion
if [[ -o interactive && "$DISABLE_FZF_AUTO_COMPLETION" != "true" ]]; then
source "$completions" 2>/dev/null
fi
# Key bindings
if [[ "$DISABLE_FZF_KEY_BINDINGS" != "true" ]]; then
source "$key_bindings" 2>/dev/null
fi
return 0
}
# Indicate to user that fzf installation not found if nothing worked
setup_using_openbsd_package \
|| setup_using_debian_package \
|| setup_using_opensuse_package \
|| setup_using_base_dir \
|| indicate_error
function fzf_setup_error() {
cat >&2 <<'EOF'
[oh-my-zsh] fzf plugin: Cannot find fzf installation directory.
Please add `export FZF_BASE=/path/to/fzf/install/dir` to your .zshrc
EOF
}
unset -f setup_using_opensuse_package setup_using_debian_package setup_using_base_dir indicate_error
fzf_setup_using_openbsd \
|| fzf_setup_using_debian \
|| fzf_setup_using_opensuse \
|| fzf_setup_using_cygwin \
|| fzf_setup_using_base_dir \
|| fzf_setup_error
unset -f -m 'fzf_setup_*'
if [[ -z "$FZF_DEFAULT_COMMAND" ]]; then
if (( $+commands[rg] )); then
export FZF_DEFAULT_COMMAND='rg --files --hidden --glob "!.git/*"'
elif (( $+commands[fd] )); then
export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude .git'
elif (( $+commands[ag] )); then
export FZF_DEFAULT_COMMAND='ag -l --hidden -g "" --ignore .git'
fi
if (( $+commands[rg] )); then
export FZF_DEFAULT_COMMAND='rg --files --hidden --glob "!.git/*"'
elif (( $+commands[fd] )); then
export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude .git'
elif (( $+commands[ag] )); then
export FZF_DEFAULT_COMMAND='ag -l --hidden -g "" --ignore .git'
fi
fi

View file

@ -1,24 +1,27 @@
# Autocompletion for the GitHub CLI (gh).
if (( $+commands[gh] )); then
# remove old generated completion file
command rm -f "${0:A:h}/_gh"
ver="$(gh --version)"
ver_file="$ZSH_CACHE_DIR/gh_version"
comp_file="$ZSH_CACHE_DIR/completions/_gh"
mkdir -p "${comp_file:h}"
(( ${fpath[(Ie)${comp_file:h}]} )) || fpath=("${comp_file:h}" $fpath)
if [[ ! -f "$comp_file" || ! -f "$ver_file" || "$ver" != "$(< "$ver_file")" ]]; then
gh completion --shell zsh >| "$comp_file"
echo "$ver" >| "$ver_file"
fi
declare -A _comps
autoload -Uz _gh
_comps[gh]=_gh
unset ver ver_file comp_file
if (( ! $+commands[gh] )); then
return
fi
# TODO: 2021-12-28: remove this block
# Handle $0 according to the standard:
# https://zdharma-continuum.github.io/Zsh-100-Commits-Club/Zsh-Plugin-Standard.html
0="${${ZERO:-${0:#$ZSH_ARGZERO}}:-${(%):-%N}}"
0="${${(M)0:#/*}:-$PWD/$0}"
# Remove old generated files
command rm -f "${0:A:h}/_gh" "$ZSH_CACHE_DIR/gh_version"
# TODO: 2021-12-28: remove this bit of code as it exists in oh-my-zsh.sh
# Add completions folder in $ZSH_CACHE_DIR
command mkdir -p "$ZSH_CACHE_DIR/completions"
(( ${fpath[(Ie)"$ZSH_CACHE_DIR/completions"]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath)
# If the completion file doesn't exist yet, we need to autoload it and
# bind it to `gh`. Otherwise, compinit will have already done that.
if [[ ! -f "$ZSH_CACHE_DIR/completions/_gh" ]]; then
typeset -g -A _comps
autoload -Uz _gh
_comps[gh]=_gh
fi
gh completion --shell zsh >| "$ZSH_CACHE_DIR/completions/_gh" &|

Some files were not shown because too many files have changed in this diff Show more