mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-04-24 04:29:25 +02:00
Merge remote-tracking branch 'upstream/master'
# Conflicts: # templates/zshrc.zsh-template
This commit is contained in:
commit
c97f1d133d
37 changed files with 760 additions and 209 deletions
|
|
@ -22,7 +22,7 @@ fi
|
|||
# Set ZSH_CACHE_DIR to the path where cache files should be created
|
||||
# or else we will use the default cache/
|
||||
if [[ -z "$ZSH_CACHE_DIR" ]]; then
|
||||
ZSH_CACHE_DIR="$ZSH/cache/"
|
||||
ZSH_CACHE_DIR="$ZSH/cache"
|
||||
fi
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,64 +1,69 @@
|
|||
## ARCHLINUX PLUGIN
|
||||
# Archlinux plugin
|
||||
|
||||
## Features
|
||||
|
||||
#### YAOURT
|
||||
|
||||
| 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 && sudo abs && sudo aur | Update and refresh local package, ABS and AUR databases |
|
||||
| yaupd | yaourt -Sy && sudo abs | Update and refresh the local package and ABS databases |
|
||||
| yaupd | yaourt -Sy && sudo aur | Update and refresh the local package and AUR databases |
|
||||
| yaupd | yaourt -Sy | Update and refresh the local package database |
|
||||
| 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 | yaourt -Syu | Sync with repositories before upgrading packages |
|
||||
|
||||
#### PACMAN
|
||||
|
||||
| Alias | Command | Description |
|
||||
|--------------|-----------------------------------------|--------------------------------------------------------------|
|
||||
| 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 |
|
||||
| pacloc | pacman -Qi | Display information about a package in the local database |
|
||||
| paclocs | pacman -Qs | Search for packages in the local database |
|
||||
| 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 |
|
||||
| pacrem | sudo pacman -Rns | Remove packages, including its settings and dependencies |
|
||||
| pacrep | pacman -Si | Display information about a package in the repositories |
|
||||
| pacreps | pacman -Ss | Search for packages in the repositories |
|
||||
| pacrmorphans | sudo pacman -Rs $(pacman -Qtdq) | Delete all orphaned packages |
|
||||
| pacupd | sudo pacman -Sy && sudo abs && sudo aur | Update and refresh the local package, ABS and AUR databases |
|
||||
| pacupd | sudo pacman -Sy && sudo abs | Update and refresh the local package and ABS databases |
|
||||
| pacupd | sudo pacman -Sy && sudo aur | Update and refresh the local package and AUR databases |
|
||||
| pacupd | sudo pacman -Sy | Update and refresh the local package database |
|
||||
| pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages |
|
||||
| upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages |
|
||||
|
||||
| Function | Description |
|
||||
|----------------|------------------------------------------------------|
|
||||
| pacdisowned | List all disowned files in your system |
|
||||
| paclist | List all installed packages with a short description |
|
||||
| pacmanallkeys | Get all keys for developers and trusted users |
|
||||
| pacmansignkeys | Locally trust all keys passed as parameters |
|
||||
|
||||
---
|
||||
|
||||
### FEATURES
|
||||
## Contributors
|
||||
|
||||
| Alias | Function | Description |
|
||||
|:------------:|-----------------------------------------|:--------------------------------------------------------------------------------------------------------------------|
|
||||
| pacin | sudo pacman -S | Install specific package(s) from the repositories |
|
||||
| pacins | sudo pacman -U | Install specific package not from the repositories but from a file |
|
||||
| pacinsd | sudo pacman -S --asdeps | Install given package(s) as dependencies of another package |
|
||||
| pacloc | pacman -Qi | Display information about a given package in the local database |
|
||||
| paclocs | pacman -Qs | Search for package(s) in the local database |
|
||||
| paclsorphans | sudo pacman -Qdt' | List all orphaned packages |
|
||||
| pacmir | sudo pacman -Syy | Force refresh of all package lists after updating /etc/pacman.d/mirrorlist |
|
||||
| pacre | sudo pacman -R | Remove the specified package(s), retaining its configuration(s) and required dependencies |
|
||||
| pacrem | sudo pacman -Rns | Remove the specified package(s), its configuration(s) and unneeded dependencies |
|
||||
| pacrep | pacman -Si | Display information about a given package in the repositories |
|
||||
| pacreps | pacman -Ss | Search for package(s) in the repositories |
|
||||
| pacrmorphans | sudo pacman -Rs $(pacman -Qtdq)' | Delete all orphaned packages |
|
||||
| pacupd | sudo pacman -Sy && sudo abs && sudo aur | Update and refresh the local package, ABS and AUR databases against repositories |
|
||||
| pacupd | sudo pacman -Sy && sudo abs | Update and refresh the local package and ABS databases against repositories |
|
||||
| pacupd | sudo pacman -Sy && sudo aur | Update and refresh the local package and AUR databases against repositories |
|
||||
| pacupd | sudo pacman -Sy | Update and refresh the local package database against repositories |
|
||||
| pacupg | sudo pacman -Syu | Synchronize with repositories before upgrading packages that are out of date on the local system. |
|
||||
| yaconf | yaourt -C | Fix all configuration files with vimdiff |
|
||||
| yain | yaourt -S | Install specific package(s) from the repositories |
|
||||
| yains | yaourt -U | Install specific package not from the repositories but from a file |
|
||||
| yainsd | yaourt -S --asdeps | Install given package(s) as dependencies of another package |
|
||||
| yaloc | yaourt -Qi | Display information about a given package in the local database |
|
||||
| yalocs | yaourt -Qs | Search for package(s) in the local database |
|
||||
| yalst | yaourt -Qe | List installed packages, even those installed from AUR (they're tagged as "local") |
|
||||
| yamir | yaourt -Syy | Force refresh of all package lists after updating /etc/pacman.d/mirrorlist |
|
||||
| yaorph | yaourt -Qtd | Remove orphans using yaourt |
|
||||
| yare | yaourt -R | Remove the specified package(s), retaining its configuration(s) and required dependencies |
|
||||
| yarem | yaourt -Rns | Remove the specified package(s), its configuration(s) and unneeded dependencies |
|
||||
| yarep | yaourt -Si | Display information about a given package in the repositories |
|
||||
| yareps | yaourt -Ss | Search for package(s) in the repositories |
|
||||
| yasu | yaourt --sucre | Same as yaupg, but without confirmation |
|
||||
| yaupd | yaourt -Sy && sudo abs && sudo aur | Update and refresh the local package, ABS and AUR databases against repositories |
|
||||
| yaupd | yaourt -Sy && sudo abs | Update and refresh the local package and ABS databases against repositories |
|
||||
| yaupd | yaourt -Sy && sudo aur | Update and refresh the local package and AUR databases against repositories |
|
||||
| yaupd | yaourt -Sy | Update and refresh the local package database against repositories |
|
||||
| yaupg | yaourt -Syua | Synchronize with repositories before upgrading packages (AUR packages too) that are out of date on the local system |
|
||||
|
||||
| Function | Description |
|
||||
|----------------|:------------------------------------------------------------------------------------------------------------------|
|
||||
| pacdisowned | List all disowned files in your system |
|
||||
| paclist | List all installed packages with a short description - [Source](https://bbs.archlinux.org/viewtopic.php?id=93683) |
|
||||
| pacmanallkeys | Get all keys for developers and trusted users |
|
||||
| pacmansignkeys | |
|
||||
|
||||
---
|
||||
|
||||
### CONTRIBUTORS
|
||||
- Benjamin Boudreau - dreurmail@gmail.com
|
||||
- Celso Miranda - contacto@celsomiranda.net
|
||||
- KhasMek - Boushh@gmail.com
|
||||
- Martin Putniorz - mputniorz@gmail.com
|
||||
- MatthR3D - matthr3d@gmail.com
|
||||
- ornicar - thibault.duplessis@gmail.com
|
||||
|
||||
---
|
||||
- Benjamin Boudreau - dreurmail@gmail.com
|
||||
- Celso Miranda - contacto@celsomiranda.net
|
||||
- KhasMek - Boushh@gmail.com
|
||||
- Martin Putniorz - mputniorz@gmail.com
|
||||
- MatthR3D - matthr3d@gmail.com
|
||||
- ornicar - thibault.duplessis@gmail.com
|
||||
|
|
|
|||
|
|
@ -1,75 +1,75 @@
|
|||
# Archlinux zsh aliases and functions
|
||||
# Usage is also described at https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins
|
||||
|
||||
# Look for yaourt, and add some useful functions if we have it.
|
||||
if (( $+commands[yaourt] )); then
|
||||
if ! (( $+commands[yaourt] )); then
|
||||
upgrade() {
|
||||
sudo pacman -Syu
|
||||
}
|
||||
else
|
||||
upgrade () {
|
||||
yaourt -Syu
|
||||
}
|
||||
alias yaconf='yaourt -C' # Fix all configuration files with vimdiff
|
||||
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
|
||||
alias yaupg='yaourt -Syua' # Synchronize with repositories before upgrading packages (AUR packages too) that are out of date on the local system.
|
||||
alias yasu='yaourt --sucre' # Same as yaupg, but without confirmation
|
||||
alias yain='yaourt -S' # Install specific package(s) from the repositories
|
||||
alias yains='yaourt -U' # Install specific package not from the repositories but from a file
|
||||
alias yare='yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
|
||||
alias yarem='yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
|
||||
alias yarep='yaourt -Si' # Display information about a given package in the repositories
|
||||
alias yareps='yaourt -Ss' # Search for package(s) in the repositories
|
||||
alias yaloc='yaourt -Qi' # Display information about a given package in the local database
|
||||
alias yalocs='yaourt -Qs' # Search for package(s) in the local database
|
||||
alias yalst='yaourt -Qe' # List installed packages, even those installed from AUR (they're tagged as "local")
|
||||
alias yaorph='yaourt -Qtd' # Remove orphans using yaourt
|
||||
# Additional yaourt alias examples
|
||||
|
||||
alias yaconf='yaourt -C'
|
||||
alias yaupg='yaourt -Syua'
|
||||
alias yasu='yaourt --Syua --no-confirm'
|
||||
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'
|
||||
|
||||
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
alias yaupd='yaourt -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
|
||||
alias yaupd='yaourt -Sy && sudo abs && sudo aur'
|
||||
elif (( $+commands[abs] )); then
|
||||
alias yaupd='yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
|
||||
alias yaupd='yaourt -Sy && sudo abs'
|
||||
elif (( $+commands[aur] )); then
|
||||
alias yaupd='yaourt -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
|
||||
alias yaupd='yaourt -Sy && sudo aur'
|
||||
else
|
||||
alias yaupd='yaourt -Sy' # Update and refresh the local package database against repositories
|
||||
alias yaupd='yaourt -Sy'
|
||||
fi
|
||||
alias yainsd='yaourt -S --asdeps' # Install given package(s) as dependencies of another package
|
||||
alias yamir='yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
|
||||
else
|
||||
upgrade() {
|
||||
sudo pacman -Syu
|
||||
}
|
||||
fi
|
||||
|
||||
# Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
|
||||
alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
|
||||
alias pacin='sudo pacman -S' # Install specific package(s) from the repositories
|
||||
alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file
|
||||
alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
|
||||
alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
|
||||
alias pacrep='pacman -Si' # Display information about a given package in the repositories
|
||||
alias pacreps='pacman -Ss' # Search for package(s) in the repositories
|
||||
alias pacloc='pacman -Qi' # Display information about a given package in the local database
|
||||
alias paclocs='pacman -Qs' # Search for package(s) in the local database
|
||||
# Additional pacman alias examples
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs && sudo aur' # Update and refresh the local package, ABS and AUR databases against repositories
|
||||
elif (( $+commands[abs] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
|
||||
elif (( $+commands[aur] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo aur' # Update and refresh the local package and AUR databases against repositories
|
||||
else
|
||||
alias pacupd='sudo pacman -Sy' # Update and refresh the local package database against repositories
|
||||
fi
|
||||
alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package
|
||||
alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
|
||||
|
||||
# https://bbs.archlinux.org/viewtopic.php?id=93683
|
||||
paclist() {
|
||||
LC_ALL=C pacman -Qei $(pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}'
|
||||
}
|
||||
|
||||
alias pacupg='sudo pacman -Syu'
|
||||
alias pacin='sudo pacman -S'
|
||||
alias pacins='sudo pacman -U'
|
||||
alias pacre='sudo pacman -R'
|
||||
alias pacrem='sudo pacman -Rns'
|
||||
alias pacrep='pacman -Si'
|
||||
alias pacreps='pacman -Ss'
|
||||
alias pacloc='pacman -Qi'
|
||||
alias paclocs='pacman -Qs'
|
||||
alias pacinsd='sudo pacman -S --asdeps'
|
||||
alias pacmir='sudo pacman -Syy'
|
||||
alias paclsorphans='sudo pacman -Qdt'
|
||||
alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
|
||||
|
||||
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs && sudo aur'
|
||||
elif (( $+commands[abs] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo abs'
|
||||
elif (( $+commands[aur] )); then
|
||||
alias pacupd='sudo pacman -Sy && sudo aur'
|
||||
else
|
||||
alias pacupd='sudo pacman -Sy'
|
||||
fi
|
||||
|
||||
paclist() {
|
||||
# Source: https://bbs.archlinux.org/viewtopic.php?id=93683
|
||||
LC_ALL=C pacman -Qei $(pacman -Qu | cut -d " " -f 1) | \
|
||||
awk 'BEGIN {FS=":"} /^Name/{printf("\033[1;36m%s\033[1;37m", $2)} /^Description/{print $2}'
|
||||
}
|
||||
|
||||
pacdisowned() {
|
||||
emulate -L zsh
|
||||
|
||||
tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
|
||||
db=$tmp/db
|
||||
fs=$tmp/fs
|
||||
|
|
@ -79,21 +79,21 @@ pacdisowned() {
|
|||
|
||||
pacman -Qlq | sort -u > "$db"
|
||||
|
||||
find /bin /etc /lib /sbin /usr \
|
||||
! -name lost+found \
|
||||
\( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
|
||||
find /bin /etc /lib /sbin /usr ! -name lost+found \
|
||||
\( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
|
||||
|
||||
comm -23 "$fs" "$db"
|
||||
}
|
||||
|
||||
pacmanallkeys() {
|
||||
# Get all keys for developers and trusted users
|
||||
curl https://www.archlinux.org/{developers,trustedusers}/ |
|
||||
awk -F\" '(/pgp.mit.edu/) {sub(/.*search=0x/,"");print $1}' |
|
||||
xargs sudo pacman-key --recv-keys
|
||||
emulate -L zsh
|
||||
curl -s https://www.archlinux.org/people/{developers,trustedusers}/ | \
|
||||
awk -F\" '(/pgp.mit.edu/) { sub(/.*search=0x/,""); print $1}' | \
|
||||
xargs sudo pacman-key --recv-keys
|
||||
}
|
||||
|
||||
pacmansignkeys() {
|
||||
emulate -L zsh
|
||||
for key in $*; do
|
||||
sudo pacman-key --recv-keys $key
|
||||
sudo pacman-key --lsign-key $key
|
||||
|
|
|
|||
11
plugins/cask/README.md
Normal file
11
plugins/cask/README.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# cask plugin
|
||||
|
||||
Loads `cask` completion from non-standard locations, such as if installed
|
||||
via Homebrew or others. To enable it, add `cask` to your plugins array:
|
||||
|
||||
```zsh
|
||||
plugins=(... cask)
|
||||
```
|
||||
|
||||
Make sure you have the `cask` directory in your `$PATH` before loading
|
||||
Oh My Zsh, otherwise you'll get the "command not found" error.
|
||||
|
|
@ -1,5 +1,26 @@
|
|||
if which cask &> /dev/null; then
|
||||
source $(dirname $(which cask))/../etc/cask_completion.zsh
|
||||
else
|
||||
print "zsh cask plugin: cask not found"
|
||||
fi
|
||||
() {
|
||||
emulate -L zsh
|
||||
|
||||
if ! (( $+commands[cask] )); then
|
||||
print "zsh cask plugin: cask command not found" >&2
|
||||
return
|
||||
fi
|
||||
|
||||
cask_base=${commands[cask]:h:h}
|
||||
|
||||
# Plain cask installation location (for Cask 0.7.2 and earlier)
|
||||
comp_files=($cask_base/etc/cask_completion.zsh)
|
||||
|
||||
# Mac Homebrew installs the completion in a different location
|
||||
if (( $+commands[brew] )); then
|
||||
comp_files+=($(brew --prefix)/share/zsh/site-functions/cask_completion.zsh)
|
||||
fi
|
||||
|
||||
# Load first found file
|
||||
for f in $comp_files; do
|
||||
if [[ -f "$f" ]]; then
|
||||
source "$f"
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,11 +8,21 @@
|
|||
# pushd +N: start counting from left of `dirs' output
|
||||
# pushd -N: start counting from right of `dirs' output
|
||||
|
||||
switch-to-dir () {
|
||||
while ! builtin pushd -q $1 &>/dev/null; do
|
||||
# We found a missing directory: pop it out of the dir stack
|
||||
builtin popd -q $1
|
||||
|
||||
# Stop trying if there are no more directories in the dir stack
|
||||
[[ ${#dirstack} -eq 0 ]] && break
|
||||
done
|
||||
}
|
||||
|
||||
insert-cycledleft () {
|
||||
emulate -L zsh
|
||||
setopt nopushdminus
|
||||
|
||||
builtin pushd -q +1 &>/dev/null || true
|
||||
switch-to-dir +1
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N insert-cycledleft
|
||||
|
|
@ -21,7 +31,7 @@ insert-cycledright () {
|
|||
emulate -L zsh
|
||||
setopt nopushdminus
|
||||
|
||||
builtin pushd -q -0 &>/dev/null || true
|
||||
switch-to-dir -0
|
||||
zle reset-prompt
|
||||
}
|
||||
zle -N insert-cycledright
|
||||
|
|
|
|||
31
plugins/git-flow/README.md
Normal file
31
plugins/git-flow/README.md
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Git-Flow plugin
|
||||
|
||||
This plugin adds completion and aliases for the `git-flow` command. More information
|
||||
at https://github.com/nvie/gitflow.
|
||||
|
||||
Enable git-flow plugin in your zshrc file:
|
||||
```
|
||||
plugins=(... git-flow)
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
More information about `git-flow` commands:
|
||||
https://github.com/nvie/gitflow/wiki/Command-Line-Arguments
|
||||
|
||||
| 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>` |
|
||||
| `gflhf` | `git flow hotfix finish` | Finish hotfix: `gflhf <version>` |
|
||||
| `gflrf` | `git flow release finish` | Finish release: `gflrf <version>` |
|
||||
|
|
@ -22,9 +22,19 @@
|
|||
|
||||
#Alias
|
||||
alias gfl='git flow'
|
||||
alias gfli='git flow init'
|
||||
alias gcd='git checkout develop'
|
||||
alias gch='git checkout hotfix'
|
||||
alias gcr='git checkout release'
|
||||
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 gflhf='git flow hotfix finish'
|
||||
alias gflrf='git flow release finish'
|
||||
|
||||
_git-flow ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -70,11 +70,14 @@ alias gcl='git clone --recursive'
|
|||
alias gclean='git clean -fd'
|
||||
alias gpristine='git reset --hard && git clean -dfx'
|
||||
alias gcm='git checkout master'
|
||||
alias gcd='git checkout develop'
|
||||
alias gcmsg='git commit -m'
|
||||
alias gco='git checkout'
|
||||
alias gcount='git shortlog -sn'
|
||||
compdef gcount=git
|
||||
alias gcp='git cherry-pick'
|
||||
alias gcpa='git cherry-pick --abort'
|
||||
alias gcpc='git cherry-pick --continue'
|
||||
alias gcs='git commit -S'
|
||||
|
||||
alias gd='git diff'
|
||||
|
|
@ -147,6 +150,9 @@ alias ggpush='git push origin $(git_current_branch)'
|
|||
compdef _git ggpush=git-checkout
|
||||
|
||||
alias ggsup='git branch --set-upstream-to=origin/$(git_current_branch)'
|
||||
alias gpsup='git push --set-upstream origin $(git_current_branch)'
|
||||
|
||||
alias ghh='git help'
|
||||
|
||||
alias gignore='git update-index --assume-unchanged'
|
||||
alias gignored='git ls-files -v | grep "^[[:lower:]]"'
|
||||
|
|
@ -212,6 +218,7 @@ alias gss='git status -s'
|
|||
alias gst='git status'
|
||||
alias gsta='git stash save'
|
||||
alias gstaa='git stash apply'
|
||||
alias gstc='git stash clear'
|
||||
alias gstd='git stash drop'
|
||||
alias gstl='git stash list'
|
||||
alias gstp='git stash pop'
|
||||
|
|
|
|||
|
|
@ -179,5 +179,15 @@ __go_tool_complete() {
|
|||
|
||||
compdef __go_tool_complete go
|
||||
|
||||
# aliases
|
||||
alias gfa='go fmt . ./...'
|
||||
# aliases: go<~>
|
||||
alias gob='go build'
|
||||
alias goc='go clean'
|
||||
alias god='go doc'
|
||||
alias gof='go fmt'
|
||||
alias gofa='go fmt . ./...'
|
||||
alias gog='go get'
|
||||
alias goi='go install'
|
||||
alias gol='go list'
|
||||
alias gor='go run'
|
||||
alias got='go test'
|
||||
alias gov='go vet'
|
||||
|
|
|
|||
7
plugins/kubectl/kubectl.plugin.zsh
Normal file
7
plugins/kubectl/kubectl.plugin.zsh
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Autocompletion for kubectl, the command line interface for Kubernetes
|
||||
#
|
||||
# Author: https://github.com/pstadler
|
||||
|
||||
if [ $commands[kubectl] ]; then
|
||||
source <(kubectl completion zsh)
|
||||
fi
|
||||
|
|
@ -38,6 +38,15 @@ _1st_arguments=(
|
|||
'local.hex:Install hex locally'
|
||||
'local.rebar:Install rebar locally'
|
||||
'new:Create a new Elixir project'
|
||||
'phoenix.digest:Digests and compress static files'
|
||||
'phoenix.gen.channel:Generates a Phoenix channel'
|
||||
'phoenix.gen.html:Generates controller, model and views for an HTML based resource'
|
||||
'phoenix.gen.json:Generates a controller and model for a JSON based resource'
|
||||
'phoenix.gen.model:Generates an Ecto model'
|
||||
'phoenix.gen.secret:Generates a secret'
|
||||
'phoenix.new:Create a new Phoenix application'
|
||||
'phoenix.routes:Prints all routes'
|
||||
'phoenix.server:Starts applications and their servers'
|
||||
'run:Run the given file or expression'
|
||||
"test:Run a project's tests"
|
||||
'--help:Describe available tasks'
|
||||
|
|
@ -49,7 +58,7 @@ __task_list ()
|
|||
local expl
|
||||
declare -a tasks
|
||||
|
||||
tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new run test)
|
||||
tasks=(app.start archive archive.build archive.install archive.uninstall clean cmd compile compile.protocols deps deps.clean deps.compile deps.get deps.unlock deps.update do escript.build help hex hex.config hex.docs hex.info hex.key hex.outdated hex.owner hex.publish hex.search hex.user loadconfig local local.hex local.rebar new phoenix.digest phoenix.gen.channel phoenix.gen.html phoenix.gen.json phoenix.gen.model phoenix.gen.secret phoenix.new phoenix.routes phoenix.server run test)
|
||||
|
||||
_wanted tasks expl 'help' compadd $tasks
|
||||
}
|
||||
|
|
@ -80,4 +89,3 @@ case $state in
|
|||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,12 @@
|
|||
eval "$(npm completion 2>/dev/null)"
|
||||
(( $+commands[npm] )) && {
|
||||
__NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion"
|
||||
|
||||
if [[ ! -f $__NPM_COMPLETION_FILE ]]; then
|
||||
npm completion >! $__NPM_COMPLETION_FILE || rm -f $__NPM_COMPLETION_FILE
|
||||
fi
|
||||
|
||||
source $__NPM_COMPLETION_FILE
|
||||
}
|
||||
|
||||
# Install dependencies globally
|
||||
alias npmg="npm i -g "
|
||||
|
|
@ -20,3 +28,9 @@ alias npmE='PATH="$(npm bin)":"$PATH"'
|
|||
|
||||
# Check which npm modules are outdated
|
||||
alias npmO="npm outdated"
|
||||
|
||||
# Run npm start
|
||||
alias npmst="npm start"
|
||||
|
||||
# Run npm test
|
||||
alias npmt="npm test"
|
||||
|
|
|
|||
|
|
@ -15,13 +15,18 @@ Original author: [Sorin Ionescu](https://github.com/sorin-ionescu)
|
|||
|
||||
## Commands
|
||||
|
||||
| Command | Description |
|
||||
|:--------------|:-----------------------------------------------|
|
||||
| `tab` | Open the current directory in a new tab |
|
||||
| `ofd` | Open the current directory in a Finder window |
|
||||
| `pfd` | Return the path of the frontmost Finder window |
|
||||
| `pfs` | Return the current Finder selection |
|
||||
| `cdf` | `cd` to the current Finder directory |
|
||||
| `pushdf` | `pushd` to the current Finder directory |
|
||||
| `quick-look` | Quick-Look a specified file |
|
||||
| `man-preview` | Open a specified man page in Preview app |
|
||||
| Command | Description |
|
||||
| :-------------- | :----------------------------------------------- |
|
||||
| `tab` | Open the current directory in a new tab |
|
||||
| `split_tab` | Split the current terminal tab horizontally |
|
||||
| `vsplit_tab` | Split the current terminal tab vertically |
|
||||
| `ofd` | Open the current directory in a Finder window |
|
||||
| `pfd` | Return the path of the frontmost Finder window |
|
||||
| `pfs` | Return the current Finder selection |
|
||||
| `cdf` | `cd` to the current Finder directory |
|
||||
| `pushdf` | `pushd` to the current Finder directory |
|
||||
| `quick-look` | Quick-Look a specified file |
|
||||
| `man-preview` | Open a specified man page in Preview app |
|
||||
| `showfiles` | Show hidden files |
|
||||
| `hidefiles` | Hide the hidden files |
|
||||
| `itunes` | Control iTunes. User `itunes -h` for usage details |
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ EOF
|
|||
|
||||
elif [[ "$the_app" == 'iTerm2' ]]; then
|
||||
osascript <<EOF
|
||||
tell application "iTerm"
|
||||
tell application "iTerm2"
|
||||
tell current window
|
||||
create tab with default profile
|
||||
tell current session to write text "${command}"
|
||||
|
|
@ -81,7 +81,7 @@ EOF
|
|||
|
||||
elif [[ "$the_app" == 'iTerm2' ]]; then
|
||||
osascript <<EOF
|
||||
tell application "iTerm"
|
||||
tell application "iTerm2"
|
||||
tell current session of first window
|
||||
set newSession to (split vertically with same profile)
|
||||
tell newSession
|
||||
|
|
@ -121,7 +121,7 @@ EOF
|
|||
|
||||
elif [[ "$the_app" == 'iTerm2' ]]; then
|
||||
osascript <<EOF
|
||||
tell application "iTerm"
|
||||
tell application "iTerm2"
|
||||
tell current session of first window
|
||||
set newSession to (split horizontally with same profile)
|
||||
tell newSession
|
||||
|
|
@ -260,3 +260,7 @@ EOF
|
|||
esac
|
||||
osascript -e "tell application \"iTunes\" to $opt"
|
||||
}
|
||||
|
||||
# Show/hide hidden files in the Finder
|
||||
alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
|
||||
alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
|
||||
|
|
|
|||
9
plugins/perms/README.md
Normal file
9
plugins/perms/README.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
## Perms
|
||||
|
||||
Plugin to handle some unix filesystem permissions quickly
|
||||
|
||||
### Usage
|
||||
|
||||
* `set755` recursively sets all directories located within the current working directory and sub directories to octal 755.
|
||||
* `set644` recursively sets all files located within the current working directory and sub directories to octal 644.
|
||||
* `fixperms` is a wrapper around `set755` and `set644` applied to a specified directory or the current directory otherwise. It also prompts prior to execution unlike the other two aliases.
|
||||
78
plugins/perms/perms.plugin.zsh
Normal file
78
plugins/perms/perms.plugin.zsh
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
# Some useful commands for setting permissions.
|
||||
#
|
||||
# Rory Hardy [GneatGeek]
|
||||
# Andrew Janke [apjanke]
|
||||
|
||||
### Aliases
|
||||
|
||||
# Set all files' permissions to 644 recursively in a directory
|
||||
alias set644='find . -type f -print0 | xargs -0 chmod 644'
|
||||
|
||||
# Set all directories' permissions to 755 recursively in a directory
|
||||
alias set755='find . -type d -print0 | xargs -0 chmod 755'
|
||||
|
||||
### Functions
|
||||
|
||||
# fixperms - fix permissions on files and directories, with confirmation
|
||||
# Returns 0 on success, nonzero if any errors occurred
|
||||
fixperms () {
|
||||
local opts confirm target exit_status chmod_opts use_slow_mode
|
||||
zparseopts -E -D -a opts -help -slow v+=chmod_opts
|
||||
if [[ $# > 1 || -n "${opts[(r)--help]}" ]]; then
|
||||
cat <<EOF
|
||||
Usage: fixperms [-v] [--help] [--slow] [target]
|
||||
|
||||
target is the file or directory to change permissions on. If omitted,
|
||||
the current directory is taken to be the target.
|
||||
|
||||
-v enables verbose output (may be supplied multiple times)
|
||||
|
||||
--slow will use a slower but more robust mode, which is effective if
|
||||
directories themselves have permissions that forbid you from
|
||||
traversing them.
|
||||
|
||||
EOF
|
||||
exit_status=$(( $# > 1 ))
|
||||
return $exit_status
|
||||
fi
|
||||
|
||||
if [[ $# == 0 ]]; then
|
||||
target="."
|
||||
else
|
||||
target="$1"
|
||||
fi
|
||||
if [[ -n ${opts[(r)--slow]} ]]; then use_slow=true; else use_slow=false; fi
|
||||
|
||||
# Because this requires confirmation, bail in noninteractive shells
|
||||
if [[ ! -o interactive ]]; then
|
||||
echo "fixperms: cannot run in noninteractive shell"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "Fixing perms on $target?"
|
||||
printf '%s' "Proceed? (y|n) "
|
||||
read confirm
|
||||
if [[ "$confirm" != y ]]; then
|
||||
# User aborted
|
||||
return 1
|
||||
fi
|
||||
|
||||
# This xargs form is faster than -exec chmod <N> {} \; but will encounter
|
||||
# issues if the directories themselves have permissions such that you can't
|
||||
# recurse in to them. If that happens, just rerun this a few times.
|
||||
exit_status=0;
|
||||
if [[ $use_slow == true ]]; then
|
||||
# Process directories first so non-traversable ones are fixed as we go
|
||||
find "$target" -type d -exec chmod $chmod_opts 755 {} \;
|
||||
if [[ $? != 0 ]]; then exit_status=$?; fi
|
||||
find "$target" -type f -exec chmod $chmod_opts 644 {} \;
|
||||
if [[ $? != 0 ]]; then exit_status=$?; fi
|
||||
else
|
||||
find "$target" -type d -print0 | xargs -0 chmod $chmod_opts 755
|
||||
if [[ $? != 0 ]]; then exit_status=$?; fi
|
||||
find "$target" -type f -print0 | xargs -0 chmod $chmod_opts 644
|
||||
if [[ $? != 0 ]]; then exit_status=$?; fi
|
||||
fi
|
||||
echo "Complete"
|
||||
return $exit_status
|
||||
}
|
||||
|
|
@ -76,3 +76,5 @@ zsh-pip-test-clean-packages() {
|
|||
echo "the djangopypi2 index is fine"
|
||||
fi
|
||||
}
|
||||
|
||||
alias pip="noglob pip" # allows square brackets for pip command invocation
|
||||
|
|
|
|||
45
plugins/pj/README.md
Normal file
45
plugins/pj/README.md
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# pj
|
||||
|
||||
The `pj` plugin (short for `Project Jump`) allows you to define several
|
||||
folders where you store your projects, so that you can jump there directly
|
||||
by just using the name of the project directory.
|
||||
|
||||
Original idea and code by Jan De Poorter ([@DefV](https://github.com/DefV))
|
||||
Source: https://gist.github.com/pjaspers/368394#gistcomment-1016
|
||||
|
||||
## Usage
|
||||
|
||||
1. Enable the `pj` plugin:
|
||||
|
||||
```zsh
|
||||
plugins=(... pj)
|
||||
```
|
||||
|
||||
2. Set `$PROJECT_PATHS` in your ~/.zshrc:
|
||||
|
||||
```zsh
|
||||
PROJECT_PATHS=(~/src ~/work ~/"dir with spaces")
|
||||
```
|
||||
|
||||
You can now use one of the following commands:
|
||||
|
||||
##### `pj my-project`:
|
||||
|
||||
`cd` to the directory named "my-project" found in one of the `$PROJECT_PATHS`
|
||||
directories. If there are several directories named the same, the first one
|
||||
to appear in `$PROJECT_PATHS` has preference.
|
||||
|
||||
For example:
|
||||
```zsh
|
||||
PROJECT_PATHS=(~/code ~/work)
|
||||
$ ls ~/code # ~/code/blog ~/code/react
|
||||
$ ls ~/work # ~/work/blog ~/work/project
|
||||
$ pj blog # <-- will cd to ~/code/blog
|
||||
```
|
||||
|
||||
##### `pjo my-project`
|
||||
|
||||
Open the project directory with your defined `$EDITOR`. This follows the same
|
||||
directory rules as the `pj` command above.
|
||||
|
||||
Note: `pjo` is an alias of `pj open`.
|
||||
|
|
@ -1,49 +1,37 @@
|
|||
#!/bin/zsh
|
||||
alias pjo="pj open"
|
||||
|
||||
#
|
||||
# Original idea by DefV (Jan De Poorter)
|
||||
# Source: https://gist.github.com/pjaspers/368394#comment-1016
|
||||
#
|
||||
# Usage:
|
||||
# - Set `$PROJECT_PATHS` in your ~/.zshrc
|
||||
# e.g.: PROJECT_PATHS=(~/src ~/work)
|
||||
# - In ZSH you now can open a project directory with the command: `pj my-project`
|
||||
# the plugin will locate the `my-project` directory in one of the $PROJECT_PATHS
|
||||
# Also tab completion is supported.
|
||||
# - `pjo my-project` will open the directory in $EDITOR
|
||||
#
|
||||
pj () {
|
||||
emulate -L zsh
|
||||
|
||||
function pj() {
|
||||
cmd="cd"
|
||||
file=$1
|
||||
project=$1
|
||||
|
||||
if [[ "open" == "$file" ]] then
|
||||
if [[ "open" == "$project" ]]; then
|
||||
shift
|
||||
file=$*
|
||||
cmd=(${(s: :)EDITOR})
|
||||
project=$*
|
||||
cmd=${=EDITOR}
|
||||
else
|
||||
file=$*
|
||||
project=$*
|
||||
fi
|
||||
|
||||
for project in $PROJECT_PATHS; do
|
||||
if [[ -d $project/$file ]] then
|
||||
$cmd "$project/$file"
|
||||
unset project # Unset project var
|
||||
for basedir ($PROJECT_PATHS); do
|
||||
if [[ -d "$basedir/$project" ]]; then
|
||||
$cmd "$basedir/$project"
|
||||
return
|
||||
fi
|
||||
done
|
||||
|
||||
echo "No such project $1"
|
||||
echo "No such project '${project}'."
|
||||
}
|
||||
|
||||
alias pjo="pj open"
|
||||
_pj () {
|
||||
emulate -L zsh
|
||||
|
||||
function _pj () {
|
||||
# might be possible to improve this using glob, without the basename trick
|
||||
typeset -a projects
|
||||
projects=($PROJECT_PATHS/*)
|
||||
projects=$projects:t
|
||||
_arguments "*:file:($projects)"
|
||||
}
|
||||
for basedir ($PROJECT_PATHS); do
|
||||
projects+=(${basedir}/*(/N))
|
||||
done
|
||||
|
||||
compadd ${projects:t}
|
||||
}
|
||||
compdef _pj pj
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ alias rdrs='rake db:reset'
|
|||
alias rdtc='rake db:test:clone'
|
||||
alias rdtp='rake db:test:prepare'
|
||||
alias rdmtc='rake db:migrate db:test:clone'
|
||||
alias rdsl='rake db:schema:load'
|
||||
alias rlc='rake log:clear'
|
||||
alias rn='rake notes'
|
||||
alias rr='rake routes'
|
||||
|
|
|
|||
|
|
@ -2,22 +2,34 @@
|
|||
|
||||
Fast rake autocompletion plugin.
|
||||
|
||||
This script caches the output for later usage and significantly speeds it up. It generates a .rake_tasks cache file in parallel to the Rakefile. It also checks the file modification dates to see if it needs to regenerate the cache file.
|
||||
This plugin caches the output for later usage and significantly speeds it up.
|
||||
It generates a `.rake_tasks` cache file in parallel to the Rakefile. It also
|
||||
checks the file modification time to see if it needs to regenerate the cache
|
||||
file.
|
||||
|
||||
This is entirely based on [this pull request by Ullrich Schäfer](https://github.com/robb/.dotfiles/pull/10/), which is inspired by [this Ruby on Rails trick from 2006](http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh/).
|
||||
This is entirely based on [this pull request by Ullrich Schäfer](https://github.com/robb/.dotfiles/pull/10/),
|
||||
which is inspired by [this Ruby on Rails trick from 2006](http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh/).
|
||||
|
||||
Think about that. 2006.
|
||||
|
||||
----------
|
||||
|
||||
Since August of 2016, it also checks if it's in a Rails project and looks at
|
||||
rake files inside `lib/tasks` and their modification time to know if the
|
||||
cache file needs to be regenerated.
|
||||
|
||||
## Installation
|
||||
|
||||
Just add the plugin to your `.zshrc`:
|
||||
|
||||
```bash
|
||||
plugins=(foo bar rake-fast)
|
||||
```zsh
|
||||
plugins=(... rake-fast)
|
||||
```
|
||||
|
||||
You might consider adding `.rake_tasks` to your [global .gitignore](https://help.github.com/articles/ignoring-files#global-gitignore)
|
||||
|
||||
## Usage
|
||||
|
||||
`rake`, then press tab
|
||||
Type `rake`, then press tab.
|
||||
|
||||
If you want to force the regeneration of the `.rake_tasks` file, run `rake_refresh`.
|
||||
|
|
|
|||
|
|
@ -1,14 +1,22 @@
|
|||
_rake_refresh () {
|
||||
if [ -f .rake_tasks ]; then
|
||||
rm .rake_tasks
|
||||
fi
|
||||
echo "Generating .rake_tasks..." > /dev/stderr
|
||||
_rake_generate
|
||||
cat .rake_tasks
|
||||
_rake_does_task_list_need_generating () {
|
||||
[[ ! -f .rake_tasks ]] || [[ Rakefile -nt .rake_tasks ]] || { _is_rails_app && _tasks_changed }
|
||||
}
|
||||
|
||||
_rake_does_task_list_need_generating () {
|
||||
[[ ! -f .rake_tasks ]] || [[ Rakefile -nt .rake_tasks ]]
|
||||
_is_rails_app () {
|
||||
[[ -e "bin/rails" ]] || [[ -e "script/rails" ]]
|
||||
}
|
||||
|
||||
_tasks_changed () {
|
||||
local -a files
|
||||
files=(lib/tasks lib/tasks/**/*(N))
|
||||
|
||||
for file in $files; do
|
||||
if [[ "$file" -nt .rake_tasks ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
_rake_generate () {
|
||||
|
|
@ -16,14 +24,20 @@ _rake_generate () {
|
|||
}
|
||||
|
||||
_rake () {
|
||||
if [ -f Rakefile ]; then
|
||||
if [[ -f Rakefile ]]; then
|
||||
if _rake_does_task_list_need_generating; then
|
||||
echo "\nGenerating .rake_tasks..." > /dev/stderr
|
||||
echo "\nGenerating .rake_tasks..." >&2
|
||||
_rake_generate
|
||||
fi
|
||||
compadd `cat .rake_tasks`
|
||||
compadd $(cat .rake_tasks)
|
||||
fi
|
||||
}
|
||||
|
||||
compdef _rake rake
|
||||
alias rake_refresh='_rake_refresh'
|
||||
|
||||
rake_refresh () {
|
||||
[[ -f .rake_tasks ]] && rm -f .rake_tasks
|
||||
|
||||
echo "Generating .rake_tasks..." >&2
|
||||
_rake_generate
|
||||
cat .rake_tasks
|
||||
}
|
||||
|
|
|
|||
68
plugins/shrink-path/README.md
Normal file
68
plugins/shrink-path/README.md
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
# A plugin to shrink directory paths for brevity and pretty-printing
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
For this directory tree:
|
||||
```
|
||||
/home/
|
||||
me/
|
||||
foo/
|
||||
bar/
|
||||
quux/
|
||||
biz/ # The prefix b is ambiguous between bar and biz.
|
||||
```
|
||||
here are the results of calling `shrink_path <option> /home/me/foo/bar/quux`:
|
||||
```
|
||||
Option Result
|
||||
<none> /h/m/f/ba/q
|
||||
-l|--last /h/m/f/ba/quux
|
||||
-s|--short /h/m/f/b/q
|
||||
-t|--tilde ~/f/ba/q
|
||||
-f|--fish ~/f/b/quux
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
For a fish-style working directory in your command prompt, add the following to
|
||||
your theme or zshrc:
|
||||
|
||||
```
|
||||
setopt prompt_subst
|
||||
PS1='%n@%m $(shrink_path -f)>'
|
||||
```
|
||||
|
||||
The following options are available:
|
||||
|
||||
```
|
||||
-f, --fish fish simulation, equivalent to -l -s -t.
|
||||
-l, --last Print the last directory's full name.
|
||||
-s, --short Truncate directory names to the first character. Without
|
||||
-s, names are truncated without making them ambiguous.
|
||||
-t, --tilde Substitute ~ for the home directory.
|
||||
-T, --nameddirs Substitute named directories as well.
|
||||
```
|
||||
|
||||
The long options can also be set via zstyle, like
|
||||
```
|
||||
zstyle :prompt:shrink_path fish yes
|
||||
```
|
||||
|
||||
Note: Directory names containing two or more consecutive spaces are not yet
|
||||
supported.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Copyright (C) 2008 by Daniel Friesel <derf@xxxxxxxxxxxxxxxxxx>
|
||||
|
||||
License: WTFPL <http://sam.zoy.org/wtfpl>
|
||||
|
||||
Ref: http://www.zsh.org/mla/workers/2009/msg00415.html
|
||||
http://www.zsh.org/mla/workers/2009/msg00419.html
|
||||
|
||||
|
||||
## Misc
|
||||
|
||||
Keywords: prompt directory truncate shrink collapse fish
|
||||
127
plugins/shrink-path/shrink-path.plugin.zsh
Normal file
127
plugins/shrink-path/shrink-path.plugin.zsh
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
# Shrink directory paths, e.g. /home/me/foo/bar/quux -> ~/f/b/quux.
|
||||
#
|
||||
# For a fish-style working directory in your command prompt, add the following
|
||||
# to your theme or zshrc:
|
||||
#
|
||||
# setopt prompt_subst
|
||||
# PS1='%n@%m $(shrink_path -f)>'
|
||||
#
|
||||
# The following options are available:
|
||||
#
|
||||
# -f, --fish fish simulation, equivalent to -l -s -t.
|
||||
# -l, --last Print the last directory's full name.
|
||||
# -s, --short Truncate directory names to the first character. Without
|
||||
# -s, names are truncated without making them ambiguous.
|
||||
# -t, --tilde Substitute ~ for the home directory.
|
||||
# -T, --nameddirs Substitute named directories as well.
|
||||
#
|
||||
# The long options can also be set via zstyle, like
|
||||
# zstyle :prompt:shrink_path fish yes
|
||||
#
|
||||
# Note: Directory names containing two or more consecutive spaces are not yet
|
||||
# supported.
|
||||
#
|
||||
# Keywords: prompt directory truncate shrink collapse fish
|
||||
#
|
||||
# Copyright (C) 2008 by Daniel Friesel <derf@xxxxxxxxxxxxxxxxxx>
|
||||
# License: WTFPL <http://sam.zoy.org/wtfpl>
|
||||
#
|
||||
# Ref: http://www.zsh.org/mla/workers/2009/msg00415.html
|
||||
# http://www.zsh.org/mla/workers/2009/msg00419.html
|
||||
|
||||
shrink_path () {
|
||||
setopt localoptions
|
||||
setopt rc_quotes null_glob
|
||||
|
||||
typeset -i lastfull=0
|
||||
typeset -i short=0
|
||||
typeset -i tilde=0
|
||||
typeset -i named=0
|
||||
|
||||
if zstyle -t ':prompt:shrink_path' fish; then
|
||||
lastfull=1
|
||||
short=1
|
||||
tilde=1
|
||||
fi
|
||||
if zstyle -t ':prompt:shrink_path' nameddirs; then
|
||||
tilde=1
|
||||
named=1
|
||||
fi
|
||||
zstyle -t ':prompt:shrink_path' last && lastfull=1
|
||||
zstyle -t ':prompt:shrink_path' short && short=1
|
||||
zstyle -t ':prompt:shrink_path' tilde && tilde=1
|
||||
|
||||
while [[ $1 == -* ]]; do
|
||||
case $1 in
|
||||
-f|--fish)
|
||||
lastfull=1
|
||||
short=1
|
||||
tilde=1
|
||||
;;
|
||||
-h|--help)
|
||||
print 'Usage: shrink_path [-f -l -s -t] [directory]'
|
||||
print ' -f, --fish fish-simulation, like -l -s -t'
|
||||
print ' -l, --last Print the last directory''s full name'
|
||||
print ' -s, --short Truncate directory names to the first character'
|
||||
print ' -t, --tilde Substitute ~ for the home directory'
|
||||
print ' -T, --nameddirs Substitute named directories as well'
|
||||
print 'The long options can also be set via zstyle, like'
|
||||
print ' zstyle :prompt:shrink_path fish yes'
|
||||
return 0
|
||||
;;
|
||||
-l|--last) lastfull=1 ;;
|
||||
-s|--short) short=1 ;;
|
||||
-t|--tilde) tilde=1 ;;
|
||||
-T|--nameddirs)
|
||||
tilde=1
|
||||
named=1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
typeset -a tree expn
|
||||
typeset result part dir=${1-$PWD}
|
||||
typeset -i i
|
||||
|
||||
[[ -d $dir ]] || return 0
|
||||
|
||||
if (( named )) {
|
||||
for part in ${(k)nameddirs}; {
|
||||
[[ $dir == ${nameddirs[$part]}(/*|) ]] && dir=${dir/${nameddirs[$part]}/\~$part}
|
||||
}
|
||||
}
|
||||
(( tilde )) && dir=${dir/$HOME/\~}
|
||||
tree=(${(s:/:)dir})
|
||||
(
|
||||
unfunction chpwd 2> /dev/null
|
||||
if [[ $tree[1] == \~* ]] {
|
||||
cd ${~tree[1]}
|
||||
result=$tree[1]
|
||||
shift tree
|
||||
} else {
|
||||
cd /
|
||||
}
|
||||
for dir in $tree; {
|
||||
if (( lastfull && $#tree == 1 )) {
|
||||
result+="/$tree"
|
||||
break
|
||||
}
|
||||
expn=(a b)
|
||||
part=''
|
||||
i=0
|
||||
until [[ (( ${#expn} == 1 )) || $dir = $expn || $i -gt 99 ]] do
|
||||
(( i++ ))
|
||||
part+=$dir[$i]
|
||||
expn=($(echo ${part}*(-/)))
|
||||
(( short )) && break
|
||||
done
|
||||
result+="/$part"
|
||||
cd $dir
|
||||
shift tree
|
||||
}
|
||||
echo ${result:-/}
|
||||
)
|
||||
}
|
||||
|
||||
## vim:ft=zsh
|
||||
|
|
@ -37,7 +37,7 @@ function _plugin__start_agent()
|
|||
zstyle -s :omz:plugins:ssh-agent lifetime lifetime
|
||||
|
||||
# start ssh-agent and setup environment
|
||||
/usr/bin/env ssh-agent ${lifetime:+-t} ${lifetime} | sed 's/^echo/#echo/' > ${_plugin__ssh_env}
|
||||
/usr/bin/env ssh-agent ${lifetime:+-t} ${lifetime} | sed 's/^echo/#echo/' >! ${_plugin__ssh_env}
|
||||
chmod 600 ${_plugin__ssh_env}
|
||||
. ${_plugin__ssh_env} > /dev/null
|
||||
|
||||
|
|
|
|||
|
|
@ -15,5 +15,7 @@ Plugin for Sublime Text, a cross platform text and code editor, available for Li
|
|||
* If `st` is passed a file, open it in Sublime Text
|
||||
|
||||
* If `stt` command is called, it is equivalent to `st .`, opening the current folder in Sublime Text
|
||||
|
||||
* If `sst` command is called, it is like `sudo st`, opening the file or folder in Sublime Text. Useful for editing system protected files.
|
||||
|
||||
* If `sst` command is called, it is like `sudo st`, opening the file or folder in Sublime Text. Useful for editing system protected files.
|
||||
|
||||
* If `stp` command is called, it find a `.sublime-project` file by traversing up the directory structure. If there is no `.sublime-project` file, but if the current folder is a Git repo, opens up the root directory of the repo. If the current folder is not a Git repo, then opens up the current directory.
|
||||
|
|
|
|||
|
|
@ -56,3 +56,32 @@ elif [[ "$OSTYPE" = 'cygwin' ]]; then
|
|||
fi
|
||||
|
||||
alias stt='st .'
|
||||
|
||||
find_project()
|
||||
{
|
||||
local PROJECT_ROOT="${PWD}"
|
||||
local FINAL_DEST="."
|
||||
|
||||
while [[ $PROJECT_ROOT != "/" && ! -d "$PROJECT_ROOT/.git" ]]; do
|
||||
PROJECT_ROOT=$(dirname $PROJECT_ROOT)
|
||||
done
|
||||
|
||||
if [[ $PROJECT_ROOT != "/" ]]; then
|
||||
local PROJECT_NAME="${PROJECT_ROOT##*/}"
|
||||
|
||||
local SUBL_DIR=$PROJECT_ROOT
|
||||
while [[ $SUBL_DIR != "/" && ! -f "$SUBL_DIR/$PROJECT_NAME.sublime-project" ]]; do
|
||||
SUBL_DIR=$(dirname $SUBL_DIR)
|
||||
done
|
||||
|
||||
if [[ $SUBL_DIR != "/" ]]; then
|
||||
FINAL_DEST="$SUBL_DIR/$PROJECT_NAME.sublime-project"
|
||||
else
|
||||
FINAL_DEST=$PROJECT_ROOT
|
||||
fi
|
||||
fi
|
||||
|
||||
st $FINAL_DEST
|
||||
}
|
||||
|
||||
alias stp=find_project
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# Description
|
||||
# -----------
|
||||
#
|
||||
# sudo will be inserted before the command
|
||||
# sudo or sudoedit will be inserted before the command
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
|
|
@ -16,6 +16,12 @@ sudo-command-line() {
|
|||
[[ -z $BUFFER ]] && zle up-history
|
||||
if [[ $BUFFER == sudo\ * ]]; then
|
||||
LBUFFER="${LBUFFER#sudo }"
|
||||
elif [[ $BUFFER == $EDITOR\ * ]]; then
|
||||
LBUFFER="${LBUFFER#$EDITOR }"
|
||||
LBUFFER="sudoedit $LBUFFER"
|
||||
elif [[ $BUFFER == sudoedit\ * ]]; then
|
||||
LBUFFER="${LBUFFER#sudoedit }"
|
||||
LBUFFER="$EDITOR $LBUFFER"
|
||||
else
|
||||
LBUFFER="sudo $LBUFFER"
|
||||
fi
|
||||
|
|
|
|||
16
plugins/tig/README.md
Normal file
16
plugins/tig/README.md
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# `tig` plugin
|
||||
|
||||
This plugin adds some aliases for people who work with `tig` in
|
||||
a regular basis. To use it, add `tig` to your plugins array:
|
||||
|
||||
```zsh
|
||||
plugins=(... tig)
|
||||
```
|
||||
|
||||
## Features
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|----------------|-------------------------------------------------|
|
||||
| `tis` | `tig status` | Show git status |
|
||||
| `til` | `tig log` | Show git log |
|
||||
| `tib` | `tig blame -C` | `git-blame` a file detecting copies and renames |
|
||||
3
plugins/tig/tig.plugin.zsh
Normal file
3
plugins/tig/tig.plugin.zsh
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
alias tis='tig status'
|
||||
alias til='tig log'
|
||||
alias tib='tig blame -C'
|
||||
|
|
@ -3,6 +3,7 @@
|
|||
#
|
||||
|
||||
alias ta='tmux attach -t'
|
||||
alias tad='tmux attach -d -t'
|
||||
alias ts='tmux new-session -s'
|
||||
alias tl='tmux list-sessions'
|
||||
alias tksv='tmux kill-server'
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \
|
|||
|
||||
# Misc. #####################################################################
|
||||
# print all installed packages
|
||||
alias allpkgs='aptitude search -F "%p" --disable-columns ~i'
|
||||
alias allpkgs='dpkg --get-selections | grep -v deinstall'
|
||||
|
||||
# Create a basic .deb package
|
||||
alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
|
||||
|
|
|
|||
|
|
@ -11,9 +11,12 @@ fi
|
|||
if [[ $(whence node) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xnode" ) ]]; then
|
||||
alias urlencode='node -e "console.log(encodeURIComponent(process.argv[1]))"'
|
||||
alias urldecode='node -e "console.log(decodeURIComponent(process.argv[1]))"'
|
||||
elif [[ $(whence python) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then
|
||||
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
|
||||
alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'
|
||||
elif [[ $(whence python3) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then
|
||||
alias urlencode='python3 -c "import sys, urllib.parse as up; print(up.quote_plus(sys.argv[1]))"'
|
||||
alias urldecode='python3 -c "import sys, urllib.parse as up; print(up.unquote_plus(sys.argv[1]))"'
|
||||
elif [[ $(whence python2) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xpython" ) ]]; then
|
||||
alias urlencode='python2 -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'
|
||||
alias urldecode='python2 -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'
|
||||
elif [[ $(whence xxd) != "" && ( "x$URLTOOLS_METHOD" = "x" || "x$URLTOOLS_METHOD" = "xshell" ) ]]; then
|
||||
function urlencode() {echo $@ | tr -d "\n" | xxd -plain | sed "s/\(..\)/%\1/g"}
|
||||
function urldecode() {printf $(echo -n $@ | sed 's/\\/\\\\/g;s/\(%\)\([0-9a-fA-F][0-9a-fA-F]\)/\\x\2/g')"\n"}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
# If you come from bash you might have to change your $PATH.
|
||||
# export PATH=$HOME/bin:/usr/local/bin:$PATH
|
||||
|
||||
# Path to your oh-my-zsh installation.
|
||||
export ZSH=$HOME/.oh-my-zsh
|
||||
|
||||
# Set name of the theme to load.
|
||||
# Look in ~/.oh-my-zsh/themes/ (show features by tools/list_theme.sh)
|
||||
# Optionally, if you set this to "random", it'll load a random theme each
|
||||
# time that oh-my-zsh is loaded.
|
||||
# Set name of the theme to load. Optionally, if you set this to "random"
|
||||
# it'll load a random theme each time that oh-my-zsh is loaded.
|
||||
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
|
||||
ZSH_THEME="stibbons"
|
||||
|
||||
# Uncomment the following line to use case-sensitive completion.
|
||||
|
|
@ -52,13 +54,12 @@ DISABLE_AUTO_UPDATE="true"
|
|||
plugins=(git)
|
||||
|
||||
zstyle ':completion:*:descriptions' format '%B%d%b'
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# User configuration
|
||||
|
||||
# export PATH="/usr/bin:/bin:/usr/sbin:/sbin:$PATH"
|
||||
# export MANPATH="/usr/local/man:$MANPATH"
|
||||
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# You may need to manually set your language environment
|
||||
# export LANG=en_US.UTF-8
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
|
|||
function git_time_since_commit() {
|
||||
if git rev-parse --git-dir > /dev/null 2>&1; then
|
||||
# Only proceed if there is actually a commit.
|
||||
if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then
|
||||
if git log -n 1 > /dev/null 2>&1; then
|
||||
# Get the last commit.
|
||||
last_commit=`git log --pretty=format:'%at' -1 2> /dev/null`
|
||||
now=`date +%s`
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ GIT_DIRTY_COLOR=$FG[133]
|
|||
GIT_CLEAN_COLOR=$FG[118]
|
||||
GIT_PROMPT_INFO=$FG[012]
|
||||
|
||||
PROMPT='%{$PROMPT_SUCCESS_COLOR%}%~%{$reset_color%} %{$GIT_PROMPT_INFO%}$(git_prompt_info) $(virtualenv_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ%{$reset_color%} '
|
||||
PROMPT='%{$PROMPT_SUCCESS_COLOR%}%~%{$reset_color%}%{$GIT_PROMPT_INFO%}$(git_prompt_info)$(virtualenv_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ%{$reset_color%} '
|
||||
|
||||
#RPS1="${return_code}"
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="("
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" ("
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO%})"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔"
|
||||
|
|
@ -28,3 +28,6 @@ ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[160]%}✖%{$reset_color%}"
|
|||
ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[220]%}➜%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$FG[082]%}═%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$FG[190]%}✭%{$reset_color%}"
|
||||
|
||||
ZSH_THEME_VIRTUALENV_PREFIX=" ["
|
||||
ZSH_THEME_VIRTUALENV_SUFFIX="]"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue