Update 30.01.2022
This commit is contained in:
46
zsh/plugins/1password/1password.plugin.zsh
Normal file
46
zsh/plugins/1password/1password.plugin.zsh
Normal 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
|
||||
35
zsh/plugins/1password/README.md
Normal file
35
zsh/plugins/1password/README.md
Normal 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
zsh/plugins/aliases/.gitignore
vendored
Normal file
1
zsh/plugins/aliases/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
__pycache__
|
||||
@@ -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.
|
||||
|
||||

|
||||
|
||||
@@ -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 $@
|
||||
}
|
||||
|
||||
@@ -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]))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
zsh/plugins/ant/_ant
Normal file
22
zsh/plugins/ant/_ant
Normal 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 "$@"
|
||||
@@ -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'
|
||||
|
||||
@@ -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` |
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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 |
|
||||
@@ -32,7 +34,7 @@ plugins=(... archlinux)
|
||||
| pacfiles | `pacman -F` | Search package file names for matching strings |
|
||||
| pacls | `pacman -Ql` | List files in a package |
|
||||
| pacown | `pacman -Qo` | Show which package owns a file |
|
||||
| upgrade[²](#f2) | `sudo pacman -Syu` | Sync with repositories before upgrading packages |
|
||||
| upgrade[¹](#f1) | `sudo pacman -Syu` | Sync with repositories before upgrading packages |
|
||||
|
||||
| Function | Description |
|
||||
|----------------|-----------------------------------------------------------|
|
||||
@@ -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 |
|
||||
@@ -73,7 +77,7 @@ upgrades were available. Use `pacman -Que` instead.
|
||||
| auupd | `sudo aura -Sy` | Update and refresh local package, ABS and AUR databases |
|
||||
| auupg | `sudo sh -c "aura -Syu && aura -Au"` | Sync with repositories before upgrading all packages (from AUR too) |
|
||||
| ausu | `sudo sh -c "aura -Syu --no-confirm && aura -Au --no-confirm"` | Same as `auupg`, but without confirmation |
|
||||
| upgrade[²](#f2) | `sudo aura -Syu` | Sync with repositories before upgrading packages |
|
||||
| upgrade[¹](#f1) | `sudo aura -Syu` | Sync with repositories before upgrading packages |
|
||||
|
||||
| Function | Description |
|
||||
|-----------------|---------------------------------------------------------------------|
|
||||
@@ -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 |
|
||||
@@ -99,13 +105,15 @@ upgrades were available. Use `pacman -Que` instead.
|
||||
| paupd | `pacaur -Sy` | Update and refresh local package, ABS and AUR databases |
|
||||
| paupg | `pacaur -Syua` | Sync with repositories before upgrading all packages (from AUR too) |
|
||||
| pasu | `pacaur -Syua --no-confirm` | Same as `paupg`, but without confirmation |
|
||||
| upgrade[²](#f2) | `pacaur -Syu` | Sync with repositories before upgrading packages |
|
||||
| upgrade[¹](#f1) | `pacaur -Syu` | Sync with repositories before upgrading packages |
|
||||
|
||||
#### Trizen
|
||||
|
||||
| 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 |
|
||||
@@ -121,35 +129,15 @@ upgrades were available. Use `pacman -Que` instead.
|
||||
| trupd | `trizen -Sy` | Update and refresh local package, ABS and AUR databases |
|
||||
| trupg | `trizen -Syua` | Sync with repositories before upgrading all packages (from AUR too) |
|
||||
| trsu | `trizen -Syua --no-confirm` | Same as `trupg`, but without confirmation |
|
||||
| upgrade[²](#f2) | `trizen -Syu` | Sync with repositories before upgrading packages |
|
||||
| upgrade[¹](#f1) | `trizen -Syu` | Sync with repositories before upgrading packages |
|
||||
|
||||
#### Yaourt[¹](#f1)
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|-----------------------------------|---------------------------------------------------------------------|
|
||||
| yaconf | `yaourt -C` | Fix all configuration files with vimdiff |
|
||||
| yain | `yaourt -S` | Install packages from the repositories |
|
||||
| yains | `yaourt -U` | Install a package from a local file |
|
||||
| yainsd | `yaourt -S --asdeps` | Install packages as dependencies of another package |
|
||||
| yaloc | `yaourt -Qi` | Display information about a package in the local database |
|
||||
| yalocs | `yaourt -Qs` | Search for packages in the local database |
|
||||
| yalst | `yaourt -Qe` | List installed packages including from AUR (tagged as "local") |
|
||||
| yamir | `yaourt -Syy` | Force refresh of all package lists after updating mirrorlist |
|
||||
| yaorph | `yaourt -Qtd` | Remove orphans using yaourt |
|
||||
| yare | `yaourt -R` | Remove packages, keeping its settings and dependencies |
|
||||
| yarem | `yaourt -Rns` | Remove packages, including its settings and unneeded dependencies |
|
||||
| yarep | `yaourt -Si` | Display information about a package in the repositories |
|
||||
| yareps | `yaourt -Ss` | Search for packages in the repositories |
|
||||
| yaupd | `yaourt -Sy` | Update and refresh local package, ABS and AUR databases |
|
||||
| yaupg | `yaourt -Syua` | Sync with repositories before upgrading all packages (from AUR too) |
|
||||
| yasu | `yaourt -Syua --no-confirm` | Same as `yaupg`, but without confirmation |
|
||||
| upgrade[²](#f2) | `yaourt -Syu` | Sync with repositories before upgrading packages |
|
||||
|
||||
#### Yay[¹](#f1)
|
||||
#### Yay
|
||||
|
||||
| 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 |
|
||||
@@ -165,23 +153,19 @@ upgrades were available. Use `pacman -Que` instead.
|
||||
| yaupd | `yay -Sy` | Update and refresh local package, ABS and AUR databases |
|
||||
| yaupg | `yay -Syu` | Sync with repositories before upgrading packages |
|
||||
| yasu | `yay -Syu --no-confirm` | Same as `yaupg`, but without confirmation |
|
||||
| upgrade[²](#f2) | `yay -Syu` | Sync with repositories before upgrading packages |
|
||||
| upgrade[¹](#f1) | `yay -Syu` | Sync with repositories before upgrading packages |
|
||||
|
||||
---
|
||||
|
||||
<span id="f1">¹</span>
|
||||
Yay and Yaourt aliases overlap. If both are installed, yay will take precedence.
|
||||
|
||||
<span id="f2">²</span>
|
||||
The `upgrade` alias is set for all package managers. Its value will depend on
|
||||
whether the package manager is installed, checked in the following order:
|
||||
|
||||
1. `yay`
|
||||
2. `yaourt`
|
||||
3. `trizen`
|
||||
4. `pacaur`
|
||||
5. `aura`
|
||||
6. `pacman`
|
||||
2. `trizen`
|
||||
3. `pacaur`
|
||||
4. `aura`
|
||||
5. `pacman`
|
||||
|
||||
## Contributors
|
||||
|
||||
@@ -196,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
|
||||
|
||||
@@ -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'
|
||||
@@ -104,7 +108,7 @@ if (( $+commands[aura] )); then
|
||||
alias auras='aura -As --both'
|
||||
alias auupd="sudo aura -Sy"
|
||||
alias auupg='sudo sh -c "aura -Syu && aura -Au"'
|
||||
alias ausu='sudo sh -c "aura -Syu --no-confirm && aura -Au --no-confirm"'
|
||||
alias ausu='sudo sh -c "aura -Syu --no-confirm && aura -Au --no-confirm"'
|
||||
alias upgrade='sudo aura -Syu'
|
||||
|
||||
# extra bonus specially for aura
|
||||
@@ -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'
|
||||
@@ -153,28 +161,10 @@ if (( $+commands[trizen] )); then
|
||||
alias upgrade='trizen -Syu'
|
||||
fi
|
||||
|
||||
if (( $+commands[yaourt] )); then
|
||||
alias yaconf='yaourt -C'
|
||||
alias yaupg='yaourt -Syua'
|
||||
alias yasu='yaourt -Syua --noconfirm'
|
||||
alias yain='yaourt -S'
|
||||
alias yains='yaourt -U'
|
||||
alias yare='yaourt -R'
|
||||
alias yarem='yaourt -Rns'
|
||||
alias yarep='yaourt -Si'
|
||||
alias yareps='yaourt -Ss'
|
||||
alias yaloc='yaourt -Qi'
|
||||
alias yalocs='yaourt -Qs'
|
||||
alias yalst='yaourt -Qe'
|
||||
alias yaorph='yaourt -Qtd'
|
||||
alias yainsd='yaourt -S --asdeps'
|
||||
alias yamir='yaourt -Syy'
|
||||
alias yaupd="yaourt -Sy"
|
||||
alias upgrade='yaourt -Syu'
|
||||
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'
|
||||
@@ -192,4 +182,3 @@ if (( $+commands[yay] )); then
|
||||
alias yaupd="yay -Sy"
|
||||
alias upgrade='yay -Syu'
|
||||
fi
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -8,15 +8,22 @@ To use, add `battery` to the list of plugins in your `.zshrc` file:
|
||||
|
||||
Then, add the `battery_pct_prompt` function to your custom theme. For example:
|
||||
|
||||
```
|
||||
```zsh
|
||||
RPROMPT='$(battery_pct_prompt) ...'
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
On Linux, you must have the `acpi` tool installed on your operating system.
|
||||
- On Linux, you must have the `acpi` or `acpitool` commands installed on your operating system.
|
||||
On Debian/Ubuntu, you can do that with `sudo apt install acpi` or `sudo apt install acpitool`.
|
||||
|
||||
Here's an example of how to install with apt:
|
||||
```
|
||||
sudo apt-get install acpi
|
||||
```
|
||||
- On Android (via [Termux](https://play.google.com/store/apps/details?id=com.termux)), you must have:
|
||||
|
||||
1. The `Termux:API` addon app installed:
|
||||
[Google Play](https://play.google.com/store/apps/details?id=com.termux.api) | [F-Droid](https://f-droid.org/packages/com.termux.api/)
|
||||
|
||||
2. The `termux-api` package installed within termux:
|
||||
|
||||
```sh
|
||||
pkg install termux-api
|
||||
```
|
||||
|
||||
@@ -10,17 +10,17 @@
|
||||
# Author: J (927589452) #
|
||||
# Modified to add support for FreeBSD #
|
||||
###########################################
|
||||
# Author: Avneet Singh (kalsi-avneet) #
|
||||
# Modified to add support for Android #
|
||||
###########################################
|
||||
|
||||
if [[ "$OSTYPE" = darwin* ]]; then
|
||||
|
||||
function battery_is_charging() {
|
||||
ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ Yes'
|
||||
}
|
||||
|
||||
function battery_pct() {
|
||||
pmset -g batt | grep -Eo "\d+%" | cut -d% -f1
|
||||
}
|
||||
|
||||
function battery_pct_remaining() {
|
||||
if battery_is_charging; then
|
||||
echo "External Power"
|
||||
@@ -28,7 +28,6 @@ if [[ "$OSTYPE" = darwin* ]]; then
|
||||
battery_pct
|
||||
fi
|
||||
}
|
||||
|
||||
function battery_time_remaining() {
|
||||
local smart_battery_status="$(ioreg -rc "AppleSmartBattery")"
|
||||
if [[ $(echo $smart_battery_status | command grep -c '^.*"ExternalConnected"\ =\ No') -eq 1 ]]; then
|
||||
@@ -42,7 +41,6 @@ if [[ "$OSTYPE" = darwin* ]]; then
|
||||
echo "∞"
|
||||
fi
|
||||
}
|
||||
|
||||
function battery_pct_prompt () {
|
||||
local battery_pct color
|
||||
if ioreg -rc AppleSmartBattery | command grep -q '^.*"ExternalConnected"\ =\ No'; then
|
||||
@@ -61,17 +59,14 @@ if [[ "$OSTYPE" = darwin* ]]; then
|
||||
}
|
||||
|
||||
elif [[ "$OSTYPE" = freebsd* ]]; then
|
||||
|
||||
function battery_is_charging() {
|
||||
[[ $(sysctl -n hw.acpi.battery.state) -eq 2 ]]
|
||||
}
|
||||
|
||||
function battery_pct() {
|
||||
if (( $+commands[sysctl] )); then
|
||||
sysctl -n hw.acpi.battery.life
|
||||
fi
|
||||
}
|
||||
|
||||
function battery_pct_remaining() {
|
||||
if ! battery_is_charging; then
|
||||
battery_pct
|
||||
@@ -79,7 +74,6 @@ elif [[ "$OSTYPE" = freebsd* ]]; then
|
||||
echo "External Power"
|
||||
fi
|
||||
}
|
||||
|
||||
function battery_time_remaining() {
|
||||
local remaining_time
|
||||
remaining_time=$(sysctl -n hw.acpi.battery.time)
|
||||
@@ -89,7 +83,6 @@ elif [[ "$OSTYPE" = freebsd* ]]; then
|
||||
printf %02d:%02d $hour $minute
|
||||
fi
|
||||
}
|
||||
|
||||
function battery_pct_prompt() {
|
||||
local battery_pct color
|
||||
battery_pct=$(battery_pct_remaining)
|
||||
@@ -106,19 +99,22 @@ elif [[ "$OSTYPE" = freebsd* ]]; then
|
||||
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
|
||||
elif [[ "$OSTYPE" = linux* ]]; then
|
||||
|
||||
elif [[ "$OSTYPE" = linux-android ]] && (( ${+commands[termux-battery-status]} )); then
|
||||
function battery_is_charging() {
|
||||
! acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -q '^Battery.*Discharging'
|
||||
termux-battery-status 2>/dev/null | command awk '/status/ { exit ($0 ~ /DISCHARGING/) }'
|
||||
}
|
||||
|
||||
function battery_pct() {
|
||||
if (( $+commands[acpi] )); then
|
||||
acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -E '^Battery.*(Full|(Disc|C)harging)' | cut -f2 -d ',' | tr -cd '[:digit:]'
|
||||
fi
|
||||
# Sample output:
|
||||
# {
|
||||
# "health": "GOOD",
|
||||
# "percentage": 93,
|
||||
# "plugged": "UNPLUGGED",
|
||||
# "status": "DISCHARGING",
|
||||
# "temperature": 29.0,
|
||||
# "current": 361816
|
||||
# }
|
||||
termux-battery-status 2>/dev/null | command awk '/percentage/ { gsub(/[,]/,""); print $2}'
|
||||
}
|
||||
|
||||
function battery_pct_remaining() {
|
||||
if ! battery_is_charging; then
|
||||
battery_pct
|
||||
@@ -126,13 +122,72 @@ elif [[ "$OSTYPE" = linux* ]]; then
|
||||
echo "External Power"
|
||||
fi
|
||||
}
|
||||
|
||||
function battery_time_remaining() {
|
||||
if ! battery_is_charging; then
|
||||
acpi 2>/dev/null | command grep -v "rate information unavailable" | cut -f3 -d ','
|
||||
fi
|
||||
}
|
||||
|
||||
function battery_time_remaining() { } # Not available on android
|
||||
function battery_pct_prompt() {
|
||||
local battery_pct color
|
||||
battery_pct=$(battery_pct_remaining)
|
||||
if battery_is_charging; then
|
||||
echo "∞"
|
||||
else
|
||||
if [[ $battery_pct -gt 50 ]]; then
|
||||
color='green'
|
||||
elif [[ $battery_pct -gt 20 ]]; then
|
||||
color='yellow'
|
||||
else
|
||||
color='red'
|
||||
fi
|
||||
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
elif [[ "$OSTYPE" = linux* ]]; then
|
||||
function battery_is_charging() {
|
||||
if (( $+commands[acpitool] )); then
|
||||
! acpitool 2>/dev/null | command grep -qE '^\s+Battery.*Discharging'
|
||||
elif (( $+commands[acpi] )); then
|
||||
! acpi 2>/dev/null | command grep -v "rate information unavailable" | command grep -q '^Battery.*Discharging'
|
||||
fi
|
||||
}
|
||||
function battery_pct() {
|
||||
if (( $+commands[acpitool] )); then
|
||||
# Sample output:
|
||||
# Battery #1 : Unknown, 99.55%
|
||||
# Battery #2 : Discharging, 49.58%, 01:12:05
|
||||
# All batteries : 62.60%, 02:03:03
|
||||
local -i pct=$(acpitool 2>/dev/null | command awk -F, '
|
||||
/^\s+All batteries/ {
|
||||
gsub(/[^0-9.]/, "", $1)
|
||||
pct=$1
|
||||
exit
|
||||
}
|
||||
!pct && /^\s+Battery/ {
|
||||
gsub(/[^0-9.]/, "", $2)
|
||||
pct=$2
|
||||
}
|
||||
END { print pct }
|
||||
')
|
||||
echo $pct
|
||||
elif (( $+commands[acpi] )); then
|
||||
# Sample output:
|
||||
# Battery 0: Discharging, 0%, rate information unavailable
|
||||
# Battery 1: Full, 100%
|
||||
acpi 2>/dev/null | command awk -F, '
|
||||
/rate information unavailable/ { next }
|
||||
/^Battery.*: /{ gsub(/[^0-9]/, "", $2); print $2; exit }
|
||||
'
|
||||
fi
|
||||
}
|
||||
function battery_pct_remaining() {
|
||||
if ! battery_is_charging; then
|
||||
battery_pct
|
||||
else
|
||||
echo "External Power"
|
||||
fi
|
||||
}
|
||||
function battery_time_remaining() {
|
||||
if ! battery_is_charging; then
|
||||
acpi 2>/dev/null | command grep -v "rate information unavailable" | cut -f3 -d ','
|
||||
fi
|
||||
}
|
||||
function battery_pct_prompt() {
|
||||
local battery_pct color
|
||||
battery_pct=$(battery_pct_remaining)
|
||||
@@ -149,7 +204,6 @@ elif [[ "$OSTYPE" = linux* ]]; then
|
||||
echo "%{$fg[$color]%}${battery_pct}%%%{$reset_color%}"
|
||||
fi
|
||||
}
|
||||
|
||||
else
|
||||
# Empty functions so we don't cause errors in prompts
|
||||
function battery_is_charging { false }
|
||||
@@ -174,7 +228,7 @@ function battery_level_gauge() {
|
||||
local charging_color=${BATTERY_CHARGING_COLOR:-$color_yellow}
|
||||
local charging_symbol=${BATTERY_CHARGING_SYMBOL:-'⚡'}
|
||||
|
||||
local battery_remaining_percentage=$(battery_pct)
|
||||
local -i battery_remaining_percentage=$(battery_pct)
|
||||
local filled empty gauge_color
|
||||
|
||||
if [[ $battery_remaining_percentage =~ [0-9]+ ]]; then
|
||||
|
||||
@@ -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[*]}
|
||||
|
||||
@@ -20,6 +20,12 @@ if ! (type bgnotify_formatted | grep -q 'function'); then ## allow custom functi
|
||||
}
|
||||
fi
|
||||
|
||||
currentAppId () {
|
||||
if (( $+commands[osascript] )); then
|
||||
osascript -e 'tell application (path to frontmost application as text) to id' 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
currentWindowId () {
|
||||
if hash osascript 2>/dev/null; then #osx
|
||||
osascript -e 'tell application (path to frontmost application as text) to id of front window' 2&> /dev/null || echo "0"
|
||||
@@ -32,11 +38,20 @@ currentWindowId () {
|
||||
|
||||
bgnotify () { ## args: (title, subtitle)
|
||||
if hash terminal-notifier 2>/dev/null; then #osx
|
||||
[[ "$TERM_PROGRAM" == 'iTerm.app' ]] && term_id='com.googlecode.iterm2';
|
||||
[[ "$TERM_PROGRAM" == 'Apple_Terminal' ]] && term_id='com.apple.terminal';
|
||||
local term_id="$bgnotify_appid"
|
||||
if [[ -z "$term_id" ]]; then
|
||||
case "$TERM_PROGRAM" in
|
||||
iTerm.app) term_id='com.googlecode.iterm2' ;;
|
||||
Apple_Terminal) term_id='com.apple.terminal' ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
## now call terminal-notifier, (hopefully with $term_id!)
|
||||
[ -z "$term_id" ] && terminal-notifier -message "$2" -title "$1" >/dev/null ||
|
||||
terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" >/dev/null
|
||||
if [[ -z "$term_id" ]]; then
|
||||
terminal-notifier -message "$2" -title "$1" >/dev/null
|
||||
else
|
||||
terminal-notifier -message "$2" -title "$1" -activate "$term_id" -sender "$term_id" >/dev/null
|
||||
fi
|
||||
elif hash growlnotify 2>/dev/null; then #osx growl
|
||||
growlnotify -m "$1" "$2"
|
||||
elif hash notify-send 2>/dev/null; then #ubuntu gnome!
|
||||
@@ -54,6 +69,7 @@ bgnotify () { ## args: (title, subtitle)
|
||||
bgnotify_begin() {
|
||||
bgnotify_timestamp=$EPOCHSECONDS
|
||||
bgnotify_lastcmd="${1:-$2}"
|
||||
bgnotify_appid="$(currentAppId)"
|
||||
bgnotify_windowid=$(currentWindowId)
|
||||
}
|
||||
|
||||
@@ -62,7 +78,7 @@ bgnotify_end() {
|
||||
elapsed=$(( EPOCHSECONDS - bgnotify_timestamp ))
|
||||
past_threshold=$(( elapsed >= bgnotify_threshold ))
|
||||
if (( bgnotify_timestamp > 0 )) && (( past_threshold )); then
|
||||
if [ $(currentWindowId) != "$bgnotify_windowid" ]; then
|
||||
if [[ $(currentAppId) != "$bgnotify_appid" || $(currentWindowId) != "$bgnotify_windowid" ]]; then
|
||||
print -n "\a"
|
||||
bgnotify_formatted "$didexit" "$bgnotify_lastcmd" "$elapsed"
|
||||
fi
|
||||
|
||||
@@ -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)
|
||||
;;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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}"
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -40,7 +40,7 @@ bundle_install() {
|
||||
else
|
||||
local cores_num="$(nproc)"
|
||||
fi
|
||||
bundle install --jobs="$cores_num" "$@"
|
||||
BUNDLE_JOBS="$cores_num" bundle install "$@"
|
||||
}
|
||||
|
||||
## Gem wrapper
|
||||
@@ -81,14 +81,12 @@ bundled_commands=(
|
||||
)
|
||||
|
||||
# Remove $UNBUNDLED_COMMANDS from the bundled_commands list
|
||||
for cmd in $UNBUNDLED_COMMANDS; do
|
||||
bundled_commands=(${bundled_commands#$cmd});
|
||||
done
|
||||
bundled_commands=(${bundled_commands:|UNBUNDLED_COMMANDS})
|
||||
unset UNBUNDLED_COMMANDS
|
||||
|
||||
# Add $BUNDLED_COMMANDS to the bundled_commands list
|
||||
for cmd in $BUNDLED_COMMANDS; do
|
||||
bundled_commands+=($cmd);
|
||||
done
|
||||
bundled_commands+=($BUNDLED_COMMANDS)
|
||||
unset BUNDLED_COMMANDS
|
||||
|
||||
# Check if in the root or a subdirectory of a bundled project
|
||||
_within-bundled-project() {
|
||||
@@ -126,5 +124,4 @@ for cmd in $bundled_commands; do
|
||||
compdef "_$cmd" "bundled_$cmd"="$cmd"
|
||||
fi
|
||||
done
|
||||
|
||||
unset cmd bundled_commands
|
||||
|
||||
@@ -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.**
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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 #
|
||||
################################################################################
|
||||
|
||||
@@ -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 #
|
||||
################################################################################
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# chucknorris
|
||||
|
||||
Chuck Norris fortunes plugin for oh-my-zsh. Perfectly suitable as MOTD.
|
||||
|
||||
**Maintainers**: [apjanke](https://github.com/apjanke) [maff](https://github.com/maff)
|
||||
Chuck Norris fortunes plugin for Oh My Zsh. Perfectly suitable as MOTD.
|
||||
|
||||
To use it add `chucknorris` to the plugins array in you zshrc file.
|
||||
|
||||
|
||||
@@ -1,28 +1,24 @@
|
||||
# chucknorris: Chuck Norris fortunes
|
||||
|
||||
# Automatically generate or update Chuck's compiled fortune data file
|
||||
# $0 must be used outside a local function. This variable name is unlikly to collide.
|
||||
CHUCKNORRIS_PLUGIN_DIR=${0:h}
|
||||
|
||||
() {
|
||||
local DIR=$CHUCKNORRIS_PLUGIN_DIR/fortunes
|
||||
if [[ ! -f $DIR/chucknorris.dat ]] || [[ $DIR/chucknorris.dat -ot $DIR/chucknorris ]]; then
|
||||
# For some reason, Cygwin puts strfile in /usr/sbin, which is not on the path by default
|
||||
local strfile=strfile
|
||||
if ! which strfile &>/dev/null && [[ -f /usr/sbin/strfile ]]; then
|
||||
strfile=/usr/sbin/strfile
|
||||
# %x: name of file containing code being executed
|
||||
local fortunes_dir="${${(%):-%x}:h}/fortunes"
|
||||
|
||||
# Aliases
|
||||
alias chuck="fortune -a $fortunes_dir"
|
||||
alias chuck_cow="chuck | cowthink"
|
||||
|
||||
# Automatically generate or update Chuck's compiled fortune data file
|
||||
if [[ "$fortunes_dir/chucknorris" -ot "$fortunes_dir/chucknorris.dat" ]]; then
|
||||
return
|
||||
fi
|
||||
if which $strfile &> /dev/null; then
|
||||
$strfile $DIR/chucknorris $DIR/chucknorris.dat >/dev/null
|
||||
else
|
||||
|
||||
# For some reason, Cygwin puts strfile in /usr/sbin, which is not on the path by default
|
||||
local strfile="${commands[strfile]:-/usr/sbin/strfile}"
|
||||
if [[ ! -x "$strfile" ]]; then
|
||||
echo "[oh-my-zsh] chucknorris depends on strfile, which is not installed" >&2
|
||||
echo "[oh-my-zsh] strfile is often provided as part of the 'fortune' package" >&2
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
# Aliases
|
||||
alias chuck="fortune -a $DIR"
|
||||
alias chuck_cow="chuck | cowthink"
|
||||
# Generate the compiled fortune data file
|
||||
$strfile "$fortunes_dir/chucknorris" "$fortunes_dir/chucknorris.dat" >/dev/null
|
||||
}
|
||||
|
||||
unset CHUCKNORRIS_PLUGIN_DIR
|
||||
|
||||
@@ -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.
|
||||
%
|
||||
@@ -558,3 +558,11 @@ You know Chuck Norris' pet lizard, right? Last I heard, he was in the movie "God
|
||||
%
|
||||
http://chucknorrisfacts.com/ is built in Drupal because Chuck Norris knows a good CMS when he sees one.
|
||||
%
|
||||
Chuck Norris made the first Giraffe by uppercutting a horse.
|
||||
%
|
||||
Chuck Norris can hear sign language.
|
||||
%
|
||||
Chuck Norris make onions cry.
|
||||
%
|
||||
Chuck Norris doesn't shake hands, he makes them tremble.
|
||||
%
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -50,13 +50,20 @@ fi
|
||||
# NixOS: https://github.com/NixOS/nixpkgs/tree/master/nixos/modules/programs/command-not-found
|
||||
if [[ -x /run/current-system/sw/bin/command-not-found ]]; then
|
||||
command_not_found_handler() {
|
||||
/run/current-system/sw/bin/command-not-found -- "$@"
|
||||
/run/current-system/sw/bin/command-not-found "$@"
|
||||
}
|
||||
fi
|
||||
|
||||
# Termux: https://github.com/termux/command-not-found
|
||||
if [[ -x /data/data/com.termux/files/usr/libexec/termux/command-not-found ]]; then
|
||||
command_not_found_handler() {
|
||||
/data/data/com.termux/files/usr/libexec/termux/command-not-found -- "$1"
|
||||
/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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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 |
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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]'
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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. #####################################################################
|
||||
|
||||
@@ -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 |
|
||||
|
||||
@@ -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" &|
|
||||
|
||||
@@ -12,19 +12,27 @@ plugins=(... dirhistory)
|
||||
|
||||
| Shortcut | Description |
|
||||
|-----------------------------------|-----------------------------------------------------------|
|
||||
| <kbd>alt</kbd> + <kbd>left</kbd> | Go to previous directory |
|
||||
| <kbd>alt</kbd> + <kbd>right</kbd> | Undo <kbd>alt</kbd> + <kbd>left</kbd> |
|
||||
| <kbd>alt</kbd> + <kbd>up</kbd> | Move into the parent directory |
|
||||
| <kbd>alt</kbd> + <kbd>down</kbd> | Move into the first child directory by alphabetical order |
|
||||
| <kbd>Alt</kbd> + <kbd>Left</kbd> | Go to previous directory |
|
||||
| <kbd>Alt</kbd> + <kbd>Right</kbd> | Go to next directory |
|
||||
| <kbd>Alt</kbd> + <kbd>Up</kbd> | Move into the parent directory |
|
||||
| <kbd>Alt</kbd> + <kbd>Down</kbd> | Move into the first child directory by alphabetical order |
|
||||
|
||||
NOTE: some terminals might override the ALT+Arrows key bindings (Windows Terminal, for example).
|
||||
If these don't work check your terminal settings and change them to a different keyboard shortcut.
|
||||
**For macOS: use the Option key (<kbd>⌥</kbd>) instead of <kbd>Alt</kbd>**.
|
||||
|
||||
> NOTE: some terminals might override the <kbd>Alt</kbd> + Arrows key bindings (e.g. Windows Terminal).
|
||||
> If these don't work check your terminal settings and change them to a different keyboard shortcut.
|
||||
|
||||
## Usage
|
||||
|
||||
This plugin allows you to navigate the history of previous current-working-directories using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT. MAC users may alternately use OPT-LEFT and OPT-RIGHT.
|
||||
This plugin allows you to navigate the history of previous working directories using <kbd>Alt</kbd> + <kbd>Left</kbd>
|
||||
and <kbd>Alt</kbd> + <kbd>Right</kbd>. <kbd>Alt</kbd> + <kbd>Left</kbd> moves to past directories, and
|
||||
<kbd>Alt</kbd> + <kbd>Right</kbd> goes back to recent directories.
|
||||
|
||||
Also, navigate directory **hierarchy** using ALT-UP and ALT-DOWN. (mac keybindings not yet implemented). ALT-UP moves to higher hierarchy (shortcut for 'cd ..'). ALT-DOWN moves into the first directory found in alphabetical order (useful to navigate long empty directories e.g. java packages)
|
||||
**NOTE: the maximum directory history size is 30.**
|
||||
|
||||
You can also navigate **directory hierarchies** using <kbd>Alt</kbd> + <kbd>Up</kbd> and <kbd>Alt</kbd> + <kbd>Down</kbd>.
|
||||
<kbd>Alt</kbd> + <kbd>Up</kbd> moves to the parent directory, while <kbd>Alt</kbd> + <kbd>Down</kbd> moves into the first
|
||||
child directory found in alphabetical order (useful to navigate long empty directories, e.g. Java packages).
|
||||
|
||||
For example, if the shell was started, and the following commands were entered:
|
||||
|
||||
@@ -35,8 +43,20 @@ cd share
|
||||
cd doc
|
||||
```
|
||||
|
||||
Then entering ALT-LEFT at the prompt would change directory from /usr/share/doc to /usr/share, then if pressed again to /usr/, then ~. If ALT-RIGHT were pressed the directory would be changed to /usr/ again.
|
||||
the directory stack (`dirs -v`) would look like this:
|
||||
|
||||
After that, ALT-DOWN will probably go to /usr/bin (depends on your /usr structure), ALT-UP will return to /usr, then ALT-UP will get you to /
|
||||
```console
|
||||
$ dirs -v
|
||||
0 /usr/share/doc
|
||||
1 /usr/share
|
||||
2 /usr
|
||||
3 ~
|
||||
```
|
||||
|
||||
**Currently the max history size is 30**. The navigation should work for xterm, PuTTY xterm mode, GNU screen, and on MAC with alternate keys as mentioned above.
|
||||
then entering <kbd>Alt</kbd> + <kbd>Left</kbd> at the prompt would change directory from `/usr/share/doc` to `/usr/share`,
|
||||
then if pressed again to `/usr`, then `~`. If <kbd>Alt</kbd> + <kbd>Right</kbd> were pressed the directory would be changed
|
||||
to `/usr` again.
|
||||
|
||||
After that, <kbd>Alt</kbd> + <kbd>Down</kbd> will probably go to `/usr/bin` if `bin` is the first directory in alphabetical
|
||||
order (depends on your `/usr` folder structure). <kbd>Alt</kbd> + <kbd>Up</kbd> will return to `/usr`, and once more will get
|
||||
you to the root folder (`/`).
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
##
|
||||
# Navigate directory history using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories
|
||||
##
|
||||
# Navigate directory history using ALT-LEFT and ALT-RIGHT. ALT-LEFT moves back to directories
|
||||
# that the user has changed to in the past, and ALT-RIGHT undoes ALT-LEFT.
|
||||
#
|
||||
#
|
||||
# Navigate directory hierarchy using ALT-UP and ALT-DOWN.
|
||||
# ALT-UP moves to higher hierarchy (cd ..)
|
||||
# ALT-DOWN moves into the first directory found in alphabetical order
|
||||
@@ -14,25 +14,25 @@ export dirhistory_future
|
||||
|
||||
export DIRHISTORY_SIZE=30
|
||||
|
||||
# Pop the last element of dirhistory_past.
|
||||
# Pass the name of the variable to return the result in.
|
||||
# Pop the last element of dirhistory_past.
|
||||
# Pass the name of the variable to return the result in.
|
||||
# Returns the element if the array was not empty,
|
||||
# otherwise returns empty string.
|
||||
function pop_past() {
|
||||
eval "$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() {
|
||||
eval "$1='$dirhistory_future[$#dirhistory_future]'"
|
||||
typeset -g $1="${dirhistory_future[$#dirhistory_future]}"
|
||||
if [[ $#dirhistory_future -gt 0 ]]; then
|
||||
dirhistory_future[$#dirhistory_future]=()
|
||||
fi
|
||||
}
|
||||
|
||||
# Push a new element onto the end of dirhistory_past. If the size of the array
|
||||
# Push a new element onto the end of dirhistory_past. If the size of the array
|
||||
# is >= DIRHISTORY_SIZE, the array is shifted
|
||||
function push_past() {
|
||||
if [[ $#dirhistory_past -ge $DIRHISTORY_SIZE ]]; then
|
||||
@@ -76,7 +76,7 @@ function dirhistory_back() {
|
||||
local d=""
|
||||
# Last element in dirhistory_past is the cwd.
|
||||
|
||||
pop_past cw
|
||||
pop_past cw
|
||||
if [[ "" == "$cw" ]]; then
|
||||
# Someone overwrote our variable. Recover it.
|
||||
dirhistory_past=($PWD)
|
||||
@@ -121,40 +121,43 @@ function dirhistory_zle_dirhistory_future() {
|
||||
}
|
||||
|
||||
zle -N dirhistory_zle_dirhistory_back
|
||||
# xterm in normal mode
|
||||
bindkey "\e[3D" dirhistory_zle_dirhistory_back
|
||||
bindkey "\e[1;3D" dirhistory_zle_dirhistory_back
|
||||
# Terminal.app
|
||||
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
|
||||
bindkey "^[b" dirhistory_zle_dirhistory_back
|
||||
fi
|
||||
# iTerm2
|
||||
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||
bindkey "^[^[[D" dirhistory_zle_dirhistory_back
|
||||
fi
|
||||
# Putty:
|
||||
bindkey "\e\e[D" dirhistory_zle_dirhistory_back
|
||||
# GNU screen:
|
||||
bindkey "\eO3D" dirhistory_zle_dirhistory_back
|
||||
|
||||
zle -N dirhistory_zle_dirhistory_future
|
||||
bindkey "\e[3C" dirhistory_zle_dirhistory_future
|
||||
bindkey "\e[1;3C" dirhistory_zle_dirhistory_future
|
||||
# Terminal.app
|
||||
if [[ "$TERM_PROGRAM" == "Apple_Terminal" ]]; then
|
||||
bindkey "^[f" dirhistory_zle_dirhistory_future
|
||||
fi
|
||||
# iTerm2
|
||||
if [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||
bindkey "^[^[[C" dirhistory_zle_dirhistory_future
|
||||
fi
|
||||
bindkey "\e\e[C" dirhistory_zle_dirhistory_future
|
||||
bindkey "\eO3C" dirhistory_zle_dirhistory_future
|
||||
|
||||
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
|
||||
#
|
||||
#
|
||||
|
||||
# Move up in hierarchy
|
||||
function dirhistory_up() {
|
||||
@@ -181,22 +184,38 @@ function dirhistory_zle_dirhistory_down() {
|
||||
}
|
||||
|
||||
zle -N dirhistory_zle_dirhistory_up
|
||||
# xterm in normal mode
|
||||
bindkey "\e[3A" dirhistory_zle_dirhistory_up
|
||||
bindkey "\e[1;3A" dirhistory_zle_dirhistory_up
|
||||
if [[ "$TERM_PROGRAM" == "Apple_Terminal" || "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||
bindkey "^[[A" dirhistory_zle_dirhistory_up
|
||||
fi
|
||||
# Putty:
|
||||
bindkey "\e\e[A" dirhistory_zle_dirhistory_up
|
||||
# GNU screen:
|
||||
bindkey "\eO3A" dirhistory_zle_dirhistory_up
|
||||
|
||||
zle -N dirhistory_zle_dirhistory_down
|
||||
bindkey "\e[3B" dirhistory_zle_dirhistory_down
|
||||
bindkey "\e[1;3B" dirhistory_zle_dirhistory_down
|
||||
if [[ "$TERM_PROGRAM" == "Apple_Terminal" || "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||
bindkey "^[[B" dirhistory_zle_dirhistory_down
|
||||
fi
|
||||
bindkey "\e\e[B" dirhistory_zle_dirhistory_down
|
||||
bindkey "\eO3B" dirhistory_zle_dirhistory_down
|
||||
|
||||
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
|
||||
|
||||
@@ -121,12 +121,6 @@ __docker-compose_subcommand() {
|
||||
'--parallel[Build images in parallel.]' \
|
||||
'*:services:__docker-compose_services_from_build' && ret=0
|
||||
;;
|
||||
(bundle)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'--push-images[Automatically push images for any services which have a `build` option specified.]' \
|
||||
'(--output -o)'{--output,-o}'[Path to write the bundle file to. Defaults to "<project name>.dab".]:file:_files' && ret=0
|
||||
;;
|
||||
(config)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
@@ -290,7 +284,7 @@ __docker-compose_subcommand() {
|
||||
(up)
|
||||
_arguments \
|
||||
$opts_help \
|
||||
'(--abort-on-container-exit)-d[Detached mode: Run containers in the background, print new container names. Incompatible with --abort-on-container-exit.]' \
|
||||
'(--abort-on-container-exit)-d[Detached mode: Run containers in the background, print new container names. Incompatible with --abort-on-container-exit and --attach-dependencies.]' \
|
||||
$opts_no_color \
|
||||
$opts_no_deps \
|
||||
$opts_force_recreate \
|
||||
@@ -298,6 +292,7 @@ __docker-compose_subcommand() {
|
||||
$opts_no_build \
|
||||
"(--no-build)--build[Build images before starting containers.]" \
|
||||
"(-d)--abort-on-container-exit[Stops all containers if any container was stopped. Incompatible with -d.]" \
|
||||
"(-d)--attach-dependencies[Attach to dependent containers. Incompatible with -d.]" \
|
||||
'(-t --timeout)'{-t,--timeout}"[Use this timeout in seconds for container shutdown when attached or when containers are already running. (default: 10)]:seconds: " \
|
||||
'--scale[SERVICE=NUM Scale SERVICE to NUM instances. Overrides the `scale` setting in the Compose file if present.]:service scale SERVICE=NUM: ' \
|
||||
'--exit-code-from=[Return the exit code of the selected service container. Implies --abort-on-container-exit]:service:__docker-compose_services' \
|
||||
@@ -341,11 +336,13 @@ _docker-compose() {
|
||||
'(- :)'{-h,--help}'[Get help]' \
|
||||
'*'{-f,--file}"[${file_description}]:file:_files -g '*.yml'" \
|
||||
'(-p --project-name)'{-p,--project-name}'[Specify an alternate project name (default: directory name)]:project name:' \
|
||||
'--env-file[Specify an alternate environment file (default: .env)]:env-file:_files' \
|
||||
"--compatibility[If set, Compose will attempt to convert keys in v3 files to their non-Swarm equivalent]" \
|
||||
'(- :)'{-v,--version}'[Print version and exit]' \
|
||||
'--verbose[Show more output]' \
|
||||
'--log-level=[Set log level]:level:(DEBUG INFO WARNING ERROR CRITICAL)' \
|
||||
'--no-ansi[Do not print ANSI control characters]' \
|
||||
'--ansi=[Control when to print ANSI control characters]:when:(never always auto)' \
|
||||
'(-H --host)'{-H,--host}'[Daemon socket to connect to]:host:' \
|
||||
'--tls[Use TLS; implied by --tlsverify]' \
|
||||
'--tlscacert=[Trust certs signed only by this CA]:ca path:' \
|
||||
@@ -359,6 +356,7 @@ _docker-compose() {
|
||||
local -a relevant_compose_flags relevant_compose_repeatable_flags relevant_docker_flags compose_options docker_options
|
||||
|
||||
relevant_compose_flags=(
|
||||
"--env-file"
|
||||
"--file" "-f"
|
||||
"--host" "-H"
|
||||
"--project-name" "-p"
|
||||
|
||||
@@ -1,28 +1,22 @@
|
||||
# Authors:
|
||||
# https://github.com/tristola
|
||||
#
|
||||
# Docker-compose related zsh aliases
|
||||
# support Compose v2 as docker CLI plugin
|
||||
(( ${+commands[docker-compose]} )) && dccmd='docker-compose' || dccmd='docker compose'
|
||||
|
||||
# Aliases ###################################################################
|
||||
alias dco="$dccmd"
|
||||
alias dcb="$dccmd build"
|
||||
alias dce="$dccmd exec"
|
||||
alias dcps="$dccmd ps"
|
||||
alias dcrestart="$dccmd restart"
|
||||
alias dcrm="$dccmd rm"
|
||||
alias dcr="$dccmd run"
|
||||
alias dcstop="$dccmd stop"
|
||||
alias dcup="$dccmd up"
|
||||
alias dcupb="$dccmd up --build"
|
||||
alias dcupd="$dccmd up -d"
|
||||
alias dcdn="$dccmd down"
|
||||
alias dcl="$dccmd logs"
|
||||
alias dclf="$dccmd logs -f"
|
||||
alias dcpull="$dccmd pull"
|
||||
alias dcstart="$dccmd start"
|
||||
alias dck="$dccmd kill"
|
||||
|
||||
# Use dco as alias for docker-compose, since dc on *nix is 'dc - an arbitrary precision calculator'
|
||||
# https://www.gnu.org/software/bc/manual/dc-1.05/html_mono/dc.html
|
||||
|
||||
alias dco='docker-compose'
|
||||
|
||||
alias dcb='docker-compose build'
|
||||
alias dce='docker-compose exec'
|
||||
alias dcps='docker-compose ps'
|
||||
alias dcrestart='docker-compose restart'
|
||||
alias dcrm='docker-compose rm'
|
||||
alias dcr='docker-compose run'
|
||||
alias dcstop='docker-compose stop'
|
||||
alias dcup='docker-compose up'
|
||||
alias dcupb='docker-compose up --build'
|
||||
alias dcupd='docker-compose up -d'
|
||||
alias dcdn='docker-compose down'
|
||||
alias dcl='docker-compose logs'
|
||||
alias dclf='docker-compose logs -f'
|
||||
alias dcpull='docker-compose pull'
|
||||
alias dcstart='docker-compose start'
|
||||
alias dck='docker-compose kill'
|
||||
unset dccmd
|
||||
|
||||
@@ -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' \
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 |
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,57 +9,60 @@
|
||||
# - You can share opened buffered across opened frames.
|
||||
# - Configuration changes made at runtime are applied to all frames.
|
||||
|
||||
# Require emacs version to be minimum 24
|
||||
autoload -Uz is-at-least
|
||||
is-at-least 24 "${${(Az)"$(emacsclient --version 2>/dev/null)"}[2]}" || return 0
|
||||
|
||||
if "$ZSH/tools/require_tool.sh" emacsclient 24 2>/dev/null ; then
|
||||
export EMACS_PLUGIN_LAUNCHER="$ZSH/plugins/emacs/emacsclient.sh"
|
||||
# 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}"
|
||||
|
||||
# set EDITOR if not already defined.
|
||||
export EDITOR="${EDITOR:-${EMACS_PLUGIN_LAUNCHER}}"
|
||||
# Path to custom emacsclient launcher
|
||||
export EMACS_PLUGIN_LAUNCHER="${0:A:h}/emacsclient.sh"
|
||||
|
||||
alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait"
|
||||
alias e=emacs
|
||||
# open terminal emacsclient
|
||||
alias te="$EMACS_PLUGIN_LAUNCHER -nw"
|
||||
# set EDITOR if not already defined.
|
||||
export EDITOR="${EDITOR:-${EMACS_PLUGIN_LAUNCHER}}"
|
||||
|
||||
# same than M-x eval but from outside Emacs.
|
||||
alias eeval="$EMACS_PLUGIN_LAUNCHER --eval"
|
||||
# create a new X frame
|
||||
alias eframe='emacsclient --alternate-editor "" --create-frame'
|
||||
alias emacs="$EMACS_PLUGIN_LAUNCHER --no-wait"
|
||||
alias e=emacs
|
||||
# open terminal emacsclient
|
||||
alias te="$EMACS_PLUGIN_LAUNCHER -nw"
|
||||
|
||||
# Emacs ANSI Term tracking
|
||||
if [[ -n "$INSIDE_EMACS" ]]; then
|
||||
chpwd_emacs() { print -P "\033AnSiTc %d"; }
|
||||
print -P "\033AnSiTc %d" # Track current working directory
|
||||
print -P "\033AnSiTu %n" # Track username
|
||||
# same than M-x eval but from outside Emacs.
|
||||
alias eeval="$EMACS_PLUGIN_LAUNCHER --eval"
|
||||
# create a new X frame
|
||||
alias eframe='emacsclient --alternate-editor "" --create-frame'
|
||||
|
||||
# add chpwd hook
|
||||
autoload -Uz add-zsh-hook
|
||||
add-zsh-hook chpwd chpwd_emacs
|
||||
fi
|
||||
# Emacs ANSI Term tracking
|
||||
if [[ -n "$INSIDE_EMACS" ]]; then
|
||||
chpwd_emacs() { print -P "\033AnSiTc %d"; }
|
||||
print -P "\033AnSiTc %d" # Track current working directory
|
||||
print -P "\033AnSiTu %n" # Track username
|
||||
|
||||
# Write to standard output the path to the file
|
||||
# opened in the current buffer.
|
||||
function efile {
|
||||
local cmd="(buffer-file-name (window-buffer))"
|
||||
"$EMACS_PLUGIN_LAUNCHER" --eval "$cmd" | tr -d \"
|
||||
}
|
||||
|
||||
# Write to standard output the directory of the file
|
||||
# opened in the the current buffer
|
||||
function ecd {
|
||||
local cmd="(let ((buf-name (buffer-file-name (window-buffer))))
|
||||
(if buf-name (file-name-directory buf-name)))"
|
||||
|
||||
local dir="$($EMACS_PLUGIN_LAUNCHER --eval $cmd | tr -d \")"
|
||||
if [ -n "$dir" ] ;then
|
||||
echo "$dir"
|
||||
else
|
||||
echo "can not deduce current buffer filename." >/dev/stderr
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
# add chpwd hook
|
||||
autoload -Uz add-zsh-hook
|
||||
add-zsh-hook chpwd chpwd_emacs
|
||||
fi
|
||||
|
||||
## Local Variables:
|
||||
## mode: sh
|
||||
## End:
|
||||
# Write to standard output the path to the file
|
||||
# opened in the current buffer.
|
||||
function efile {
|
||||
local cmd="(buffer-file-name (window-buffer))"
|
||||
local file="$("$EMACS_PLUGIN_LAUNCHER" --eval "$cmd" | tr -d \")"
|
||||
|
||||
if [[ -z "$file" ]]; then
|
||||
echo "Can't deduce current buffer filename." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "$file"
|
||||
}
|
||||
|
||||
# Write to standard output the directory of the file
|
||||
# opened in the the current buffer
|
||||
function ecd {
|
||||
local file
|
||||
file="$(efile)" || return $?
|
||||
echo "${file:h}"
|
||||
}
|
||||
|
||||
@@ -1,29 +1,38 @@
|
||||
#!/bin/sh
|
||||
|
||||
_emacsfun()
|
||||
{
|
||||
# get list of emacs frames.
|
||||
frameslist=`emacsclient --alternate-editor '' --eval '(frame-list)' 2>/dev/null | egrep -o '(frame)+'`
|
||||
emacsfun() {
|
||||
local cmd frames
|
||||
|
||||
if [ "$(echo "$frameslist" | sed -n '$=')" -ge 2 ] ;then
|
||||
# prevent creating another X frame if there is at least one present.
|
||||
emacsclient --alternate-editor "" "$@"
|
||||
else
|
||||
# Create one if there is no X window yet.
|
||||
emacsclient --alternate-editor "" --create-frame "$@"
|
||||
fi
|
||||
# Build the Emacs Lisp command to check for suitable frames
|
||||
# See https://www.gnu.org/software/emacs/manual/html_node/elisp/Frames.html#index-framep
|
||||
case "$*" in
|
||||
*-t*|*--tty*|*-nw*) cmd="(memq 't (mapcar 'framep (frame-list)))" ;; # if != nil, there are tty frames
|
||||
*) cmd="(delete 't (mapcar 'framep (frame-list)))" ;; # if != nil, there are graphical terminals (x, w32, ns)
|
||||
esac
|
||||
|
||||
# Check if there are suitable frames
|
||||
frames="$(emacsclient -a '' -n -e "$cmd" 2>/dev/null)"
|
||||
|
||||
# Only create another X frame if there isn't one present
|
||||
if [ -z "$frames" -o "$frames" = nil ]; then
|
||||
emacsclient --alternate-editor "" --create-frame "$@"
|
||||
return $?
|
||||
fi
|
||||
|
||||
emacsclient --alternate-editor "" "$@"
|
||||
}
|
||||
|
||||
|
||||
# adopted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh
|
||||
# Adapted from https://github.com/davidshepherd7/emacs-read-stdin/blob/master/emacs-read-stdin.sh
|
||||
# If the second argument is - then write stdin to a tempfile and open the
|
||||
# tempfile. (first argument will be `--no-wait` passed in by the plugin.zsh)
|
||||
if [ "$#" -ge "2" -a "$2" = "-" ]
|
||||
then
|
||||
tempfile="$(mktemp --tmpdir emacs-stdin-$USERNAME.XXXXXXX 2>/dev/null \
|
||||
|| mktemp -t emacs-stdin-$USERNAME)" # support BSD mktemp
|
||||
cat - > "$tempfile"
|
||||
_emacsfun --no-wait $tempfile
|
||||
else
|
||||
_emacsfun "$@"
|
||||
if [ $# -ge 2 -a "$2" = "-" ]; then
|
||||
# Create a tempfile to hold stdin
|
||||
tempfile="$(mktemp --tmpdir emacs-stdin-$USERNAME.XXXXXXX 2>/dev/null \
|
||||
|| mktemp -t emacs-stdin-$USERNAME)" # support BSD mktemp
|
||||
# Redirect stdin to the tempfile
|
||||
cat - > "$tempfile"
|
||||
# Reset $2 to the tempfile so that "$@" works as expected
|
||||
set -- "$1" "$tempfile" "${@:3}"
|
||||
fi
|
||||
|
||||
emacsfun "$@"
|
||||
|
||||
@@ -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)
|
||||
|
||||
189
zsh/plugins/ember-cli/_ember-cli
Normal file
189
zsh/plugins/ember-cli/_ember-cli
Normal 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
|
||||
@@ -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'
|
||||
|
||||
@@ -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
@@ -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
zsh/plugins/emoji/gemoji_db.json
Normal file
21538
zsh/plugins/emoji/gemoji_db.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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";
|
||||
|
||||
|
||||
|
||||
213
zsh/plugins/emoji/update_emoji.py
Normal file
213
zsh/plugins/emoji/update_emoji.py
Normal 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()
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
zsh/plugins/fig/README.md
Normal file
9
zsh/plugins/fig/README.md
Normal 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)
|
||||
```
|
||||
13
zsh/plugins/fig/fig.plugin.zsh
Normal file
13
zsh/plugins/fig/fig.plugin.zsh
Normal 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" &|
|
||||
@@ -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 |
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
zsh/plugins/fossil/_fossil
Normal file
32
zsh/plugins/fossil/_fossil
Normal 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 "$@"
|
||||
@@ -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
|
||||
|
||||
@@ -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:"
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -1,174 +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[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
|
||||
|
||||
@@ -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" &|
|
||||
|
||||
@@ -10,22 +10,31 @@ plugins=(... git-flow)
|
||||
|
||||
## Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|----------------------------|----------------------------------------|
|
||||
| `gfl` | `git flow` | Git-Flow command |
|
||||
| `gfli` | `git flow init` | Initialize git-flow repository |
|
||||
| `gcd` | `git checkout develop` | Check out develop branch |
|
||||
| `gch` | `git checkout hotfix` | Check out hotfix branch |
|
||||
| `gcr` | `git checkout release` | Check out release branch |
|
||||
| `gflf` | `git flow feature` | List existing feature branches |
|
||||
| `gflh` | `git flow hotfix` | List existing hotfix branches |
|
||||
| `gflr` | `git flow release` | List existing release branches |
|
||||
| `gflfs` | `git flow feature start` | Start a new feature: `gflfs <name>` |
|
||||
| `gflhs` | `git flow hotfix start` | Start a new hotfix: `gflhs <version>` |
|
||||
| `gflrs` | `git flow release start` | Start a new release: `gflrs <version>` |
|
||||
| `gflff` | `git flow feature finish` | Finish feature: `gflff <name>` |
|
||||
| `gflfp` | `git flow feature publish` | Publish feature: `gflfp <name>` |
|
||||
| `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` |
|
||||
| `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` |
|
||||
| Alias | Command | Description |
|
||||
| --------- | ----------------------------------------- | ---------------------------------------------- |
|
||||
| `gcd` | `git checkout develop` | Check out develop branch |
|
||||
| `gch` | `git checkout hotfix` | Check out hotfix branch |
|
||||
| `gcr` | `git checkout release` | Check out release branch |
|
||||
| `gfl` | `git flow` | Git-Flow command |
|
||||
| `gflf` | `git flow feature` | List existing feature branches |
|
||||
| `gflff` | `git flow feature finish` | Finish feature: `gflff <name>` |
|
||||
| `gflffc` | `gflff ${$(git_current_branch)#feature/}` | Finish current feature |
|
||||
| `gflfp` | `git flow feature publish` | Publish feature: `gflfp <name>` |
|
||||
| `gflfpc` | `gflfp ${$(git_current_branch)#feature/}` | Publish current feature |
|
||||
| `gflfpll` | `git flow feature pull` | Pull remote feature: `gflfpll <remote> <name>` |
|
||||
| `gflfs` | `git flow feature start` | Start a new feature: `gflfs <name>` |
|
||||
| `gflh` | `git flow hotfix` | List existing hotfix branches |
|
||||
| `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` |
|
||||
| `gflhfc` | `gflhf ${$(git_current_branch)#hotfix/}` | Finish current hotfix |
|
||||
| `gflhp` | `git flow hotfix publish` | Publish hostfix: `gflhp <version>` |
|
||||
| `gflhpc` | `gflhp ${$(git_current_branch)#hotfix/}` | Finish current hotfix |
|
||||
| `gflhs` | `git flow hotfix start` | Start a new hotfix: `gflhs <version>` |
|
||||
| `gfli` | `git flow init` | Initialize git-flow repository |
|
||||
| `gflr` | `git flow release` | List existing release branches |
|
||||
| `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` |
|
||||
| `gflrfc` | `gflrf ${$(git_current_branch)#release/}` | Finish current release |
|
||||
| `gflrp` | `git flow release publish` | Publish release: `gflrp <version>` |
|
||||
| `gflrpc` | `gflrp ${$(git_current_branch)#release/}` | Publish current release |
|
||||
| `gflrs` | `git flow release start` | Start a new release: `gflrs <version>` |
|
||||
|
||||
[More information about `git-flow` commands](https://github.com/nvie/gitflow/wiki/Command-Line-Arguments).
|
||||
|
||||
327
zsh/plugins/git-flow/_git-flow
Normal file
327
zsh/plugins/git-flow/_git-flow
Normal file
@@ -0,0 +1,327 @@
|
||||
#compdef git-flow
|
||||
|
||||
_git-flow () {
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
'init:Initialize a new git repo with support for the branching model.'
|
||||
'feature:Manage your feature branches.'
|
||||
'release:Manage your release branches.'
|
||||
'hotfix:Manage your hotfix branches.'
|
||||
'support:Manage your support branches.'
|
||||
'version:Shows version information.'
|
||||
)
|
||||
_describe -t commands 'git flow' subcommands
|
||||
;;
|
||||
|
||||
(options)
|
||||
case $line[1] in
|
||||
|
||||
(init)
|
||||
_arguments \
|
||||
-f'[Force setting of gitflow branches, even if already configured]'
|
||||
;;
|
||||
|
||||
(version)
|
||||
;;
|
||||
|
||||
(hotfix)
|
||||
__git-flow-hotfix
|
||||
;;
|
||||
|
||||
(release)
|
||||
__git-flow-release
|
||||
;;
|
||||
|
||||
(feature)
|
||||
__git-flow-feature
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
__git-flow-release () {
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
'start:Start a new release branch.'
|
||||
'finish:Finish a release branch.'
|
||||
'list:List all your release branches. (Alias to `git flow release`)'
|
||||
'publish: public'
|
||||
'track: track'
|
||||
)
|
||||
_describe -t commands 'git flow release' subcommands
|
||||
_arguments \
|
||||
-v'[Verbose (more) output]'
|
||||
;;
|
||||
|
||||
(options)
|
||||
case $line[1] in
|
||||
|
||||
(start)
|
||||
_arguments \
|
||||
-F'[Fetch from origin before performing finish]'\
|
||||
':version:__git_flow_version_list'
|
||||
;;
|
||||
|
||||
(finish)
|
||||
_arguments \
|
||||
-F'[Fetch from origin before performing finish]' \
|
||||
-s'[Sign the release tag cryptographically]'\
|
||||
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
|
||||
-m'[Use the given tag message]'\
|
||||
-p'[Push to $ORIGIN after performing finish]'\
|
||||
-k'[Keep branch after performing finish]'\
|
||||
-n"[Don't tag this release]"\
|
||||
':version:__git_flow_version_list'
|
||||
;;
|
||||
|
||||
(publish)
|
||||
_arguments \
|
||||
':version:__git_flow_version_list'\
|
||||
;;
|
||||
|
||||
(track)
|
||||
_arguments \
|
||||
':version:__git_flow_version_list'\
|
||||
;;
|
||||
|
||||
*)
|
||||
_arguments \
|
||||
-v'[Verbose (more) output]'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
__git-flow-hotfix () {
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
'start:Start a new hotfix branch.'
|
||||
'finish:Finish a hotfix branch.'
|
||||
'list:List all your hotfix branches. (Alias to `git flow hotfix`)'
|
||||
)
|
||||
_describe -t commands 'git flow hotfix' subcommands
|
||||
_arguments \
|
||||
-v'[Verbose (more) output]'
|
||||
;;
|
||||
|
||||
(options)
|
||||
case $line[1] in
|
||||
|
||||
(start)
|
||||
_arguments \
|
||||
-F'[Fetch from origin before performing finish]'\
|
||||
':hotfix:__git_flow_version_list'\
|
||||
':branch-name:__git_branch_names'
|
||||
;;
|
||||
|
||||
(finish)
|
||||
_arguments \
|
||||
-F'[Fetch from origin before performing finish]' \
|
||||
-s'[Sign the release tag cryptographically]'\
|
||||
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
|
||||
-m'[Use the given tag message]'\
|
||||
-p'[Push to $ORIGIN after performing finish]'\
|
||||
-k'[Keep branch after performing finish]'\
|
||||
-n"[Don't tag this release]"\
|
||||
':hotfix:__git_flow_hotfix_list'
|
||||
;;
|
||||
|
||||
*)
|
||||
_arguments \
|
||||
-v'[Verbose (more) output]'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
__git-flow-feature () {
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
'start:Start a new feature branch.'
|
||||
'finish:Finish a feature branch.'
|
||||
'list:List all your feature branches. (Alias to `git flow feature`)'
|
||||
'publish: publish'
|
||||
'track: track'
|
||||
'diff: diff'
|
||||
'rebase: rebase'
|
||||
'checkout: checkout'
|
||||
'pull: pull'
|
||||
)
|
||||
_describe -t commands 'git flow feature' subcommands
|
||||
_arguments \
|
||||
-v'[Verbose (more) output]'
|
||||
;;
|
||||
|
||||
(options)
|
||||
case $line[1] in
|
||||
|
||||
(start)
|
||||
_arguments \
|
||||
-F'[Fetch from origin before performing finish]'\
|
||||
':feature:__git_flow_feature_list'\
|
||||
':branch-name:__git_branch_names'
|
||||
;;
|
||||
|
||||
(finish)
|
||||
_arguments \
|
||||
-F'[Fetch from origin before performing finish]' \
|
||||
-r'[Rebase instead of merge]'\
|
||||
-k'[Keep branch after performing finish]'\
|
||||
':feature:__git_flow_feature_list'
|
||||
;;
|
||||
|
||||
(publish)
|
||||
_arguments \
|
||||
':feature:__git_flow_feature_list'\
|
||||
;;
|
||||
|
||||
(track)
|
||||
_arguments \
|
||||
':feature:__git_flow_feature_list'\
|
||||
;;
|
||||
|
||||
(diff)
|
||||
_arguments \
|
||||
':branch:__git_flow_feature_list'\
|
||||
;;
|
||||
|
||||
(rebase)
|
||||
_arguments \
|
||||
-i'[Do an interactive rebase]' \
|
||||
':branch:__git_flow_feature_list'
|
||||
;;
|
||||
|
||||
(checkout)
|
||||
_arguments \
|
||||
':branch:__git_flow_feature_list'\
|
||||
;;
|
||||
|
||||
(pull)
|
||||
_arguments \
|
||||
':remote:__git_remotes'\
|
||||
':branch:__git_flow_feature_list'
|
||||
;;
|
||||
|
||||
*)
|
||||
_arguments \
|
||||
-v'[Verbose (more) output]'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
__git_flow_version_list () {
|
||||
local expl
|
||||
declare -a versions
|
||||
|
||||
versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}})
|
||||
__git_command_successful || return
|
||||
|
||||
_wanted versions expl 'version' compadd $versions
|
||||
}
|
||||
|
||||
__git_flow_feature_list () {
|
||||
local expl
|
||||
declare -a features
|
||||
|
||||
features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}})
|
||||
__git_command_successful || return
|
||||
|
||||
_wanted features expl 'feature' compadd $features
|
||||
}
|
||||
|
||||
__git_remotes () {
|
||||
local expl gitdir remotes
|
||||
|
||||
gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
|
||||
__git_command_successful || return
|
||||
|
||||
remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]})
|
||||
__git_command_successful || return
|
||||
|
||||
# TODO: Should combine the two instead of either or.
|
||||
if (( $#remotes > 0 )); then
|
||||
_wanted remotes expl remote compadd $* - $remotes
|
||||
else
|
||||
_wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*"
|
||||
fi
|
||||
}
|
||||
|
||||
__git_flow_hotfix_list () {
|
||||
local expl
|
||||
declare -a hotfixes
|
||||
|
||||
hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}})
|
||||
__git_command_successful || return
|
||||
|
||||
_wanted hotfixes expl 'hotfix' compadd $hotfixes
|
||||
}
|
||||
|
||||
__git_branch_names () {
|
||||
local expl
|
||||
declare -a branch_names
|
||||
|
||||
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
|
||||
__git_command_successful || return
|
||||
|
||||
_wanted branch-names expl branch-name compadd $* - $branch_names
|
||||
}
|
||||
|
||||
__git_command_successful () {
|
||||
if (( ${#pipestatus:#0} > 0 )); then
|
||||
_message 'not a git repository'
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
zstyle ':completion:*:*:git:*' user-commands flow:'description for foo'
|
||||
|
||||
# Detect if script is sourced or called via autoload
|
||||
[[ "$ZSH_EVAL_CONTEXT" != *:file ]] || return
|
||||
|
||||
_git-flow "$@"
|
||||
@@ -1,369 +1,32 @@
|
||||
#!zsh
|
||||
#
|
||||
# Installation
|
||||
# ------------
|
||||
#
|
||||
# To achieve git-flow completion nirvana:
|
||||
#
|
||||
# 0. Update your zsh's git-completion module to the newest version.
|
||||
# From here. https://raw.githubusercontent.com/zsh-users/zsh/master/Completion/Unix/Command/_git
|
||||
#
|
||||
# 1. Install this file. Either:
|
||||
#
|
||||
# a. Place it in your .zshrc:
|
||||
#
|
||||
# b. Or, copy it somewhere (e.g. ~/.git-flow-completion.zsh) and put the following line in
|
||||
# your .zshrc:
|
||||
#
|
||||
# source ~/.git-flow-completion.zsh
|
||||
#
|
||||
# c. Or, use this file as an oh-my-zsh plugin.
|
||||
#
|
||||
|
||||
#Alias
|
||||
alias gfl='git flow'
|
||||
alias gfli='git flow init'
|
||||
# Aliases
|
||||
alias gcd='git checkout $(git config gitflow.branch.develop)'
|
||||
alias gch='git checkout $(git config gitflow.prefix.hotfix)'
|
||||
alias gcr='git checkout $(git config gitflow.prefix.release)'
|
||||
alias gfl='git flow'
|
||||
alias gflf='git flow feature'
|
||||
alias gflh='git flow hotfix'
|
||||
alias gflr='git flow release'
|
||||
alias gflfs='git flow feature start'
|
||||
alias gflhs='git flow hotfix start'
|
||||
alias gflrs='git flow release start'
|
||||
alias gflff='git flow feature finish'
|
||||
alias gflffc='git flow feature finish ${$(git_current_branch)#feature/}'
|
||||
alias gflfp='git flow feature publish'
|
||||
alias gflhf='git flow hotfix finish'
|
||||
alias gflrf='git flow release finish'
|
||||
alias gflhp='git flow hotfix publish'
|
||||
alias gflrp='git flow release publish'
|
||||
alias gflfpc='git flow feature publish ${$(git_current_branch)#feature/}'
|
||||
alias gflfpll='git flow feature pull'
|
||||
alias gflfs='git flow feature start'
|
||||
alias gflh='git flow hotfix'
|
||||
alias gflhf='git flow hotfix finish'
|
||||
alias gflhfc='git flow hotfix finish ${$(git_current_branch)#hotfix/}'
|
||||
alias gflhp='git flow hotfix publish'
|
||||
alias gflhpc='git flow hotfix publish ${$(git_current_branch)#hotfix/}'
|
||||
alias gflhs='git flow hotfix start'
|
||||
alias gfli='git flow init'
|
||||
alias gflr='git flow release'
|
||||
alias gflrf='git flow release finish'
|
||||
alias gflrfc='git flow release finish ${$(git_current_branch)#release/}'
|
||||
alias gflrp='git flow release publish'
|
||||
alias gflrpc='git flow release publish ${$(git_current_branch)#release/}'
|
||||
alias gflrs='git flow release start'
|
||||
|
||||
_git-flow ()
|
||||
{
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
'init:Initialize a new git repo with support for the branching model.'
|
||||
'feature:Manage your feature branches.'
|
||||
'release:Manage your release branches.'
|
||||
'hotfix:Manage your hotfix branches.'
|
||||
'support:Manage your support branches.'
|
||||
'version:Shows version information.'
|
||||
)
|
||||
_describe -t commands 'git flow' subcommands
|
||||
;;
|
||||
|
||||
(options)
|
||||
case $line[1] in
|
||||
|
||||
(init)
|
||||
_arguments \
|
||||
-f'[Force setting of gitflow branches, even if already configured]'
|
||||
;;
|
||||
|
||||
(version)
|
||||
;;
|
||||
|
||||
(hotfix)
|
||||
__git-flow-hotfix
|
||||
;;
|
||||
|
||||
(release)
|
||||
__git-flow-release
|
||||
;;
|
||||
|
||||
(feature)
|
||||
__git-flow-feature
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
__git-flow-release ()
|
||||
{
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
'start:Start a new release branch.'
|
||||
'finish:Finish a release branch.'
|
||||
'list:List all your release branches. (Alias to `git flow release`)'
|
||||
'publish: public'
|
||||
'track: track'
|
||||
)
|
||||
_describe -t commands 'git flow release' subcommands
|
||||
_arguments \
|
||||
-v'[Verbose (more) output]'
|
||||
;;
|
||||
|
||||
(options)
|
||||
case $line[1] in
|
||||
|
||||
(start)
|
||||
_arguments \
|
||||
-F'[Fetch from origin before performing finish]'\
|
||||
':version:__git_flow_version_list'
|
||||
;;
|
||||
|
||||
(finish)
|
||||
_arguments \
|
||||
-F'[Fetch from origin before performing finish]' \
|
||||
-s'[Sign the release tag cryptographically]'\
|
||||
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
|
||||
-m'[Use the given tag message]'\
|
||||
-p'[Push to $ORIGIN after performing finish]'\
|
||||
-k'[Keep branch after performing finish]'\
|
||||
-n"[Don't tag this release]"\
|
||||
':version:__git_flow_version_list'
|
||||
;;
|
||||
|
||||
(publish)
|
||||
_arguments \
|
||||
':version:__git_flow_version_list'\
|
||||
;;
|
||||
|
||||
(track)
|
||||
_arguments \
|
||||
':version:__git_flow_version_list'\
|
||||
;;
|
||||
|
||||
*)
|
||||
_arguments \
|
||||
-v'[Verbose (more) output]'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
__git-flow-hotfix ()
|
||||
{
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
'start:Start a new hotfix branch.'
|
||||
'finish:Finish a hotfix branch.'
|
||||
'list:List all your hotfix branches. (Alias to `git flow hotfix`)'
|
||||
)
|
||||
_describe -t commands 'git flow hotfix' subcommands
|
||||
_arguments \
|
||||
-v'[Verbose (more) output]'
|
||||
;;
|
||||
|
||||
(options)
|
||||
case $line[1] in
|
||||
|
||||
(start)
|
||||
_arguments \
|
||||
-F'[Fetch from origin before performing finish]'\
|
||||
':hotfix:__git_flow_version_list'\
|
||||
':branch-name:__git_branch_names'
|
||||
;;
|
||||
|
||||
(finish)
|
||||
_arguments \
|
||||
-F'[Fetch from origin before performing finish]' \
|
||||
-s'[Sign the release tag cryptographically]'\
|
||||
-u'[Use the given GPG-key for the digital signature (implies -s)]'\
|
||||
-m'[Use the given tag message]'\
|
||||
-p'[Push to $ORIGIN after performing finish]'\
|
||||
-k'[Keep branch after performing finish]'\
|
||||
-n"[Don't tag this release]"\
|
||||
':hotfix:__git_flow_hotfix_list'
|
||||
;;
|
||||
|
||||
*)
|
||||
_arguments \
|
||||
-v'[Verbose (more) output]'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
__git-flow-feature ()
|
||||
{
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
|
||||
_arguments -C \
|
||||
':command:->command' \
|
||||
'*::options:->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
|
||||
local -a subcommands
|
||||
subcommands=(
|
||||
'start:Start a new feature branch.'
|
||||
'finish:Finish a feature branch.'
|
||||
'list:List all your feature branches. (Alias to `git flow feature`)'
|
||||
'publish: publish'
|
||||
'track: track'
|
||||
'diff: diff'
|
||||
'rebase: rebase'
|
||||
'checkout: checkout'
|
||||
'pull: pull'
|
||||
)
|
||||
_describe -t commands 'git flow feature' subcommands
|
||||
_arguments \
|
||||
-v'[Verbose (more) output]'
|
||||
;;
|
||||
|
||||
(options)
|
||||
case $line[1] in
|
||||
|
||||
(start)
|
||||
_arguments \
|
||||
-F'[Fetch from origin before performing finish]'\
|
||||
':feature:__git_flow_feature_list'\
|
||||
':branch-name:__git_branch_names'
|
||||
;;
|
||||
|
||||
(finish)
|
||||
_arguments \
|
||||
-F'[Fetch from origin before performing finish]' \
|
||||
-r'[Rebase instead of merge]'\
|
||||
-k'[Keep branch after performing finish]'\
|
||||
':feature:__git_flow_feature_list'
|
||||
;;
|
||||
|
||||
(publish)
|
||||
_arguments \
|
||||
':feature:__git_flow_feature_list'\
|
||||
;;
|
||||
|
||||
(track)
|
||||
_arguments \
|
||||
':feature:__git_flow_feature_list'\
|
||||
;;
|
||||
|
||||
(diff)
|
||||
_arguments \
|
||||
':branch:__git_flow_feature_list'\
|
||||
;;
|
||||
|
||||
(rebase)
|
||||
_arguments \
|
||||
-i'[Do an interactive rebase]' \
|
||||
':branch:__git_flow_feature_list'
|
||||
;;
|
||||
|
||||
(checkout)
|
||||
_arguments \
|
||||
':branch:__git_flow_feature_list'\
|
||||
;;
|
||||
|
||||
(pull)
|
||||
_arguments \
|
||||
':remote:__git_remotes'\
|
||||
':branch:__git_flow_feature_list'
|
||||
;;
|
||||
|
||||
*)
|
||||
_arguments \
|
||||
-v'[Verbose (more) output]'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
__git_flow_version_list ()
|
||||
{
|
||||
local expl
|
||||
declare -a versions
|
||||
|
||||
versions=(${${(f)"$(_call_program versions git flow release list 2> /dev/null | tr -d ' |*')"}})
|
||||
__git_command_successful || return
|
||||
|
||||
_wanted versions expl 'version' compadd $versions
|
||||
}
|
||||
|
||||
__git_flow_feature_list ()
|
||||
{
|
||||
local expl
|
||||
declare -a features
|
||||
|
||||
features=(${${(f)"$(_call_program features git flow feature list 2> /dev/null | tr -d ' |*')"}})
|
||||
__git_command_successful || return
|
||||
|
||||
_wanted features expl 'feature' compadd $features
|
||||
}
|
||||
|
||||
__git_remotes () {
|
||||
local expl gitdir remotes
|
||||
|
||||
gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null)
|
||||
__git_command_successful || return
|
||||
|
||||
remotes=(${${(f)"$(_call_program remotes git config --get-regexp '"^remote\..*\.url$"')"}//#(#b)remote.(*).url */$match[1]})
|
||||
__git_command_successful || return
|
||||
|
||||
# TODO: Should combine the two instead of either or.
|
||||
if (( $#remotes > 0 )); then
|
||||
_wanted remotes expl remote compadd $* - $remotes
|
||||
else
|
||||
_wanted remotes expl remote _files $* - -W "($gitdir/remotes)" -g "$gitdir/remotes/*"
|
||||
fi
|
||||
}
|
||||
|
||||
__git_flow_hotfix_list ()
|
||||
{
|
||||
local expl
|
||||
declare -a hotfixes
|
||||
|
||||
hotfixes=(${${(f)"$(_call_program hotfixes git flow hotfix list 2> /dev/null | tr -d ' |*')"}})
|
||||
__git_command_successful || return
|
||||
|
||||
_wanted hotfixes expl 'hotfix' compadd $hotfixes
|
||||
}
|
||||
|
||||
__git_branch_names () {
|
||||
local expl
|
||||
declare -a branch_names
|
||||
|
||||
branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
|
||||
__git_command_successful || return
|
||||
|
||||
_wanted branch-names expl branch-name compadd $* - $branch_names
|
||||
}
|
||||
|
||||
__git_command_successful () {
|
||||
if (( ${#pipestatus:#0} > 0 )); then
|
||||
_message 'not a git repository'
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
zstyle ':completion:*:*:git:*' user-commands flow:'description for foo'
|
||||
# Source completion script
|
||||
# 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}"
|
||||
source "${0:A:h}/_git-flow"
|
||||
|
||||
@@ -11,7 +11,8 @@ plugins=(... git-prompt)
|
||||
|
||||
See the [original repository](https://github.com/olivierverdier/zsh-git-prompt).
|
||||
|
||||
## Prerequisites
|
||||
## Requirements
|
||||
|
||||
This plugin uses `python`, so your host needs to have it installed
|
||||
|
||||
## Examples
|
||||
@@ -30,7 +31,7 @@ The prompt may look like the following:
|
||||
|
||||
By default, the general appearance of the prompt is:
|
||||
|
||||
```
|
||||
```text
|
||||
(<branch><branch tracking>|<local status>)
|
||||
```
|
||||
|
||||
@@ -58,9 +59,8 @@ The symbols are as follows:
|
||||
## Customisation
|
||||
|
||||
- Set the variable `ZSH_THEME_GIT_PROMPT_CACHE` to any value in order to enable caching.
|
||||
- You may also change a number of variables (whose name start with `ZSH_THEME_GIT_PROMPT_`)
|
||||
- You may also change a number of variables (whose name start with `ZSH_THEME_GIT_PROMPT_`)
|
||||
to change the appearance of the prompt. Take a look at the bottom of the [plugin file](git-prompt.plugin.zsh)`
|
||||
to see what variables are available.
|
||||
|
||||
|
||||
**Enjoy!**
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
# 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}"
|
||||
|
||||
__GIT_PROMPT_DIR="${0:A:h}"
|
||||
|
||||
## Hook function definitions
|
||||
|
||||
@@ -81,7 +81,7 @@ for st in status:
|
||||
staged.append(st)
|
||||
|
||||
stashed = get_stash()
|
||||
if not changed and not staged and not conflicts and not untracked and not stashed:
|
||||
if not changed and not staged and not conflicts and not untracked:
|
||||
clean = 1
|
||||
else:
|
||||
clean = 0
|
||||
|
||||
@@ -47,6 +47,7 @@ plugins=(... git)
|
||||
| gcb | git checkout -b |
|
||||
| gcf | git config --list |
|
||||
| gcl | git clone --recurse-submodules |
|
||||
| gccd | git clone --recurse-submodules "$@" && cd "$(basename $_ .git)" |
|
||||
| gclean | git clean -id |
|
||||
| gpristine | git reset --hard && git clean -dffx |
|
||||
| gcm | git checkout $(git_main_branch) |
|
||||
@@ -66,7 +67,7 @@ plugins=(... git)
|
||||
| gds | git diff --staged |
|
||||
| gdt | git diff-tree --no-commit-id --name-only -r |
|
||||
| gdnolock | git diff $@ ":(exclude)package-lock.json" ":(exclude)*.lock" |
|
||||
| gdu | git diff @{u} |
|
||||
| gdup | git diff @{upstream} |
|
||||
| gdv | git diff -w $@ \| view - |
|
||||
| gdw | git diff --word-diff |
|
||||
| gf | git fetch |
|
||||
@@ -90,8 +91,8 @@ plugins=(... git)
|
||||
| gignore | git update-index --assume-unchanged |
|
||||
| gignored | git ls-files -v \| grep "^[[:lower:]]" |
|
||||
| git-svn-dcommit-push | git svn dcommit && git push github $(git_main_branch):svntrunk |
|
||||
| gk | gitk --all --branches |
|
||||
| gke | gitk --all $(git log -g --pretty=%h) |
|
||||
| gk | gitk --all --branches &! |
|
||||
| gke | gitk --all $(git log -g --pretty=%h) &! |
|
||||
| gl | git pull |
|
||||
| glg | git log --stat |
|
||||
| glgp | git log --stat -p |
|
||||
@@ -129,6 +130,7 @@ plugins=(... git)
|
||||
| grbd | git rebase $(git_develop_branch) |
|
||||
| grbi | git rebase -i |
|
||||
| grbm | git rebase $(git_main_branch) |
|
||||
| grbom | git rebase origin/$(git_main_branch) |
|
||||
| grbo | git rebase --onto |
|
||||
| grbs | git rebase --skip |
|
||||
| grev | git revert |
|
||||
@@ -168,6 +170,8 @@ plugins=(... git)
|
||||
| gsu | git submodule update |
|
||||
| gsw | git switch |
|
||||
| gswc | git switch -c |
|
||||
| gswm | git switch $(git_main_branch) |
|
||||
| gswd | git switch $(git_develop_branch) |
|
||||
| gts | git tag -s |
|
||||
| gtv | git tag \| sort -V |
|
||||
| gtl | gtl(){ git tag --sort=-v:refname -n -l ${1}* }; noglob gtl |
|
||||
|
||||
@@ -24,9 +24,7 @@ compdef _git _git_log_prettily=git-log
|
||||
|
||||
# Warn if the current branch is a WIP
|
||||
function work_in_progress() {
|
||||
if $(git log -n 1 2>/dev/null | grep -q -c "\-\-wip\-\-"); then
|
||||
echo "WIP!!"
|
||||
fi
|
||||
command git -c log.showSignature=false log -n 1 2>/dev/null | grep -q -- "--wip--" && echo "WIP!!"
|
||||
}
|
||||
|
||||
# Check if main exists and use instead of master
|
||||
@@ -97,6 +95,13 @@ alias gcas='git commit -a -s'
|
||||
alias gcasm='git commit -a -s -m'
|
||||
alias gcb='git checkout -b'
|
||||
alias gcf='git config --list'
|
||||
|
||||
function gccd() {
|
||||
command git clone --recurse-submodules "$@"
|
||||
[[ -d "$_" ]] && cd "$_" || cd "${${_:t}%.git}"
|
||||
}
|
||||
compdef _git gccd=git-clone
|
||||
|
||||
alias gcl='git clone --recurse-submodules'
|
||||
alias gclean='git clean -id'
|
||||
alias gpristine='git reset --hard && git clean -dffx'
|
||||
@@ -119,7 +124,7 @@ alias gdcw='git diff --cached --word-diff'
|
||||
alias gdct='git describe --tags $(git rev-list --tags --max-count=1)'
|
||||
alias gds='git diff --staged'
|
||||
alias gdt='git diff-tree --no-commit-id --name-only -r'
|
||||
alias gdu='git diff @{u}'
|
||||
alias gdup='git diff @{upstream}'
|
||||
alias gdw='git diff --word-diff'
|
||||
|
||||
function gdnolock() {
|
||||
@@ -201,8 +206,8 @@ alias gignore='git update-index --assume-unchanged'
|
||||
alias gignored='git ls-files -v | grep "^[[:lower:]]"'
|
||||
alias git-svn-dcommit-push='git svn dcommit && git push github $(git_main_branch):svntrunk'
|
||||
|
||||
alias gk='\gitk --all --branches'
|
||||
alias gke='\gitk --all $(git log -g --pretty=%h)'
|
||||
alias gk='\gitk --all --branches &!'
|
||||
alias gke='\gitk --all $(git log -g --pretty=%h) &!'
|
||||
|
||||
alias gl='git pull'
|
||||
alias glg='git log --stat'
|
||||
@@ -244,6 +249,7 @@ alias grbc='git rebase --continue'
|
||||
alias grbd='git rebase $(git_develop_branch)'
|
||||
alias grbi='git rebase -i'
|
||||
alias grbm='git rebase $(git_main_branch)'
|
||||
alias grbom='git rebase origin/$(git_main_branch)'
|
||||
alias grbo='git rebase --onto'
|
||||
alias grbs='git rebase --skip'
|
||||
alias grev='git revert'
|
||||
@@ -288,6 +294,8 @@ alias gstall='git stash --all'
|
||||
alias gsu='git submodule update'
|
||||
alias gsw='git switch'
|
||||
alias gswc='git switch -c'
|
||||
alias gswm='git switch $(git_main_branch)'
|
||||
alias gswd='git switch $(git_develop_branch)'
|
||||
|
||||
alias gts='git tag -s'
|
||||
alias gtv='git tag | sort -V'
|
||||
|
||||
@@ -3383,7 +3383,7 @@ _git_worktree ()
|
||||
# Here we are not completing an --option, it's either the
|
||||
# path or a ref.
|
||||
case "$prev" in
|
||||
-b|-B) # Complete refs for branch to be created/reseted.
|
||||
-b|-B) # Complete refs for branch to be created/reset.
|
||||
__git_complete_refs
|
||||
;;
|
||||
-*) # The previous word is an -o|--option without an
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
# 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}"
|
||||
|
||||
source "${0:A:h}/git-prompt.sh"
|
||||
|
||||
function git_prompt_info() {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user