mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-06-05 05:03:16 +02:00
Merge remote-tracking branch 'upstream/master'
# Conflicts: # plugins/npm/npm.plugin.zsh
This commit is contained in:
commit
e357d762b5
37 changed files with 2399 additions and 591 deletions
|
|
@ -141,7 +141,7 @@ export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.githubus
|
|||
##### 1. Clone the repository:
|
||||
|
||||
```shell
|
||||
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
|
||||
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
|
||||
```
|
||||
|
||||
##### 2. *Optionally*, backup your existing `~/.zshrc` file:
|
||||
|
|
|
|||
1
custom/themes/example.zsh-theme
Normal file
1
custom/themes/example.zsh-theme
Normal file
|
|
@ -0,0 +1 @@
|
|||
# Put your custom themes in this folder.
|
||||
|
|
@ -25,7 +25,9 @@ function open_command() {
|
|||
case "$OSTYPE" in
|
||||
darwin*) open_cmd='open' ;;
|
||||
cygwin*) open_cmd='cygstart' ;;
|
||||
linux*) open_cmd='xdg-open' ;;
|
||||
linux*) [[ $(uname -a) =~ "Microsoft" ]] && \
|
||||
open_cmd='cmd.exe /c start' || \
|
||||
open_cmd='xdg-open' ;;
|
||||
msys*) open_cmd='start ""' ;;
|
||||
*) echo "Platform $OSTYPE not supported"
|
||||
return 1
|
||||
|
|
|
|||
|
|
@ -86,8 +86,8 @@ function git_current_branch() {
|
|||
# Gets the number of commits ahead from remote
|
||||
function git_commits_ahead() {
|
||||
if command git rev-parse --git-dir &>/dev/null; then
|
||||
local commits="$(git rev-list --count @{upstream}..HEAD)"
|
||||
if [[ "$commits" != 0 ]]; then
|
||||
local commits="$(git rev-list --count @{upstream}..HEAD 2>/dev/null)"
|
||||
if [[ -n "$commits" && "$commits" != 0 ]]; then
|
||||
echo "$ZSH_THEME_GIT_COMMITS_AHEAD_PREFIX$commits$ZSH_THEME_GIT_COMMITS_AHEAD_SUFFIX"
|
||||
fi
|
||||
fi
|
||||
|
|
@ -96,8 +96,8 @@ function git_commits_ahead() {
|
|||
# Gets the number of commits behind remote
|
||||
function git_commits_behind() {
|
||||
if command git rev-parse --git-dir &>/dev/null; then
|
||||
local commits="$(git rev-list --count HEAD..@{upstream})"
|
||||
if [[ "$commits" != 0 ]]; then
|
||||
local commits="$(git rev-list --count HEAD..@{upstream} 2>/dev/null)"
|
||||
if [[ -n "$commits" && "$commits" != 0 ]]; then
|
||||
echo "$ZSH_THEME_GIT_COMMITS_BEHIND_PREFIX$commits$ZSH_THEME_GIT_COMMITS_BEHIND_SUFFIX"
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,24 +1,41 @@
|
|||
## Command history configuration
|
||||
if [ -z "$HISTFILE" ]; then
|
||||
HISTFILE=$HOME/.zsh_history
|
||||
fi
|
||||
## History wrapper
|
||||
function omz_history {
|
||||
# Delete the history file if `-c' argument provided.
|
||||
# This won't affect the `history' command output until the next login.
|
||||
zparseopts -E c=clear l=list
|
||||
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
if [[ -n "$clear" ]]; then
|
||||
# if -c provided, clobber the history file
|
||||
echo -n >| "$HISTFILE"
|
||||
echo >&2 History file deleted. Reload the session to see its effects.
|
||||
elif [[ -n "$list" ]]; then
|
||||
# if -l provided, run as if calling `fc' directly
|
||||
builtin fc "$@"
|
||||
else
|
||||
# otherwise, call `fc -l 1` to show all available
|
||||
# history (and pass additional parameters)
|
||||
builtin fc "$@" -l 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Show history
|
||||
# Timestamp format
|
||||
case $HIST_STAMPS in
|
||||
"mm/dd/yyyy") alias history='fc -fl 1' ;;
|
||||
"dd.mm.yyyy") alias history='fc -El 1' ;;
|
||||
"yyyy-mm-dd") alias history='fc -il 1' ;;
|
||||
*) alias history='fc -l 1' ;;
|
||||
"mm/dd/yyyy") alias history='omz_history -f' ;;
|
||||
"dd.mm.yyyy") alias history='omz_history -E' ;;
|
||||
"yyyy-mm-dd") alias history='omz_history -i' ;;
|
||||
*) alias history='omz_history' ;;
|
||||
esac
|
||||
|
||||
setopt append_history
|
||||
setopt extended_history
|
||||
setopt hist_expire_dups_first
|
||||
setopt hist_ignore_dups # ignore duplication command history list
|
||||
setopt hist_ignore_space
|
||||
setopt hist_verify
|
||||
setopt inc_append_history
|
||||
setopt share_history # share command history data
|
||||
## History file configuration
|
||||
[ -z "$HISTFILE" ] && HISTFILE="$HOME/.zsh_history"
|
||||
HISTSIZE=50000
|
||||
SAVEHIST=10000
|
||||
|
||||
## History command configuration
|
||||
setopt extended_history # record timestamp of command in HISTFILE
|
||||
setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
|
||||
setopt hist_ignore_dups # ignore duplicated commands history list
|
||||
setopt hist_ignore_space # ignore commands that start with space
|
||||
setopt hist_verify # show command with history expansion to user before running it
|
||||
setopt inc_append_history # add commands to HISTFILE in order of execution
|
||||
setopt share_history # share command history data
|
||||
|
|
|
|||
|
|
@ -2,6 +2,31 @@
|
|||
|
||||
## Features
|
||||
|
||||
#### TRIZEN
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|------------------------------------|---------------------------------------------------------------------|
|
||||
| trconf | trizen -C | Fix all configuration files with vimdiff |
|
||||
| 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 |
|
||||
| trloc | trizen -Qi | Display information about a package in the local database |
|
||||
| trlocs | trizen -Qs | Search for packages in the local database |
|
||||
| trlst | trizen -Qe | List installed packages including from AUR (tagged as "local") |
|
||||
| trmir | trizen -Syy | Force refresh of all package lists after updating mirrorlist |
|
||||
| trorph | trizen -Qtd | Remove orphans using yaourt |
|
||||
| trre | trizen -R | Remove packages, keeping its settings and dependencies |
|
||||
| trrem | trizen -Rns | Remove packages, including its settings and unneeded dependencies |
|
||||
| trrep | trizen -Si | Display information about a package in the repositories |
|
||||
| trreps | trizen -Ss | Search for packages in the repositories |
|
||||
| trupd | trizen -Sy && sudo abs && sudo aur | Update and refresh local package, ABS and AUR databases |
|
||||
| trupd | trizen -Sy && sudo abs | Update and refresh the local package and ABS databases |
|
||||
| trupd | trizen -Sy && sudo aur | Update and refresh the local package and AUR databases |
|
||||
| trupd | trizen -Sy | Update and refresh the local package database |
|
||||
| trupd | trizen -Syua | Sync with repositories before upgrading all packages (from AUR too) |
|
||||
| trsu | trizen -Syua --no-confirm | Same as `trupg`, but without confirmation |
|
||||
| upgrade | trizen -Syu | Sync with repositories before upgrading packages |
|
||||
|
||||
#### YAOURT
|
||||
|
||||
| Alias | Command | Description |
|
||||
|
|
@ -27,7 +52,7 @@
|
|||
| yasu | yaourt -Syua --no-confirm | Same as `yaupg`, but without confirmation |
|
||||
| upgrade | yaourt -Syu | Sync with repositories before upgrading packages |
|
||||
|
||||
### PACAUR
|
||||
#### PACAUR
|
||||
|
||||
| Alias | Command | Description |
|
||||
|---------|------------------------------------|---------------------------------------------------------------------|
|
||||
|
|
@ -74,7 +99,9 @@
|
|||
| pacupg | sudo pacman -Syu | Sync with repositories before upgrading packages |
|
||||
| upgrade | sudo pacman -Syu | Sync with repositories before upgrading packages |
|
||||
| pacfileupg | sudo pacman -Fy | Download fresh package databases from the server |
|
||||
| pacfiles | pacman -Fs | Search package file names for matching strings. |
|
||||
| pacfiles | pacman -Fs | Search package file names for matching strings |
|
||||
| pacls | pacman -Ql | List files in a package |
|
||||
| pacown | pacman -Qo | Show which package owns a file |
|
||||
|
||||
| Function | Description |
|
||||
|----------------|------------------------------------------------------|
|
||||
|
|
@ -82,6 +109,7 @@
|
|||
| 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 |
|
||||
| pacweb | Open the website of an ArchLinux package |
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -95,3 +123,4 @@
|
|||
- ornicar - thibault.duplessis@gmail.com
|
||||
- Juraj Fiala - doctorjellyface@riseup.net
|
||||
- Majora320 (Moses Miller) - Majora320@gmail.com
|
||||
- Ybalrid (Arthur Brainville) - ybalrid@ybalrid.info
|
||||
|
|
|
|||
|
|
@ -1,3 +1,32 @@
|
|||
if (( $+commands[trizen] )); then
|
||||
alias trconf='trizen -C'
|
||||
alias trupg='trizen -Syua'
|
||||
alias trsu='trizen -Syua --noconfirm'
|
||||
alias trin='trizen -S'
|
||||
alias trins='trizen -U'
|
||||
alias trre='trizen -R'
|
||||
alias trrem='trizen -Rns'
|
||||
alias trrep='trizen -Si'
|
||||
alias trreps='trizen -Ss'
|
||||
alias trloc='trizen -Qi'
|
||||
alias trlocs='trizen -Qs'
|
||||
alias trlst='trizen -Qe'
|
||||
alias trorph='trizen -Qtd'
|
||||
alias trinsd='trizen -S --asdeps'
|
||||
alias trmir='trizen -Syy'
|
||||
|
||||
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
alias trupd='trizen -Sy && sudo abs && sudo aur'
|
||||
elif (( $+commands[abs] )); then
|
||||
alias trupd='trizen -Sy && sudo abs'
|
||||
elif (( $+commands[aur] )); then
|
||||
alias trupd='trizen -Sy && sudo aur'
|
||||
else
|
||||
alias trupd='trizen -Sy'
|
||||
fi
|
||||
fi
|
||||
|
||||
if (( $+commands[yaourt] )); then
|
||||
alias yaconf='yaourt -C'
|
||||
alias yaupg='yaourt -Syua'
|
||||
|
|
@ -54,16 +83,20 @@ if (( $+commands[pacaur] )); then
|
|||
fi
|
||||
fi
|
||||
|
||||
if (( $+commands[pacaur] )); then
|
||||
upgrade() {
|
||||
if (( $+commands[trizen] )); then
|
||||
function upgrade() {
|
||||
trizen -Syu
|
||||
}
|
||||
elif (( $+commands[pacaur] )); then
|
||||
function upgrade() {
|
||||
pacaur -Syu
|
||||
}
|
||||
elif (( $+commands[yaourt] )); then
|
||||
upgrade() {
|
||||
function upgrade() {
|
||||
yaourt -Syu
|
||||
}
|
||||
else
|
||||
upgrade() {
|
||||
function upgrade() {
|
||||
sudo pacman -Syu
|
||||
}
|
||||
fi
|
||||
|
|
@ -83,7 +116,9 @@ alias pacmir='sudo pacman -Syy'
|
|||
alias paclsorphans='sudo pacman -Qdt'
|
||||
alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
|
||||
alias pacfileupg='sudo pacman -Fy'
|
||||
alias pacfiles='pacman tFs'
|
||||
alias pacfiles='pacman -Fs'
|
||||
alias pacls='pacman -Ql'
|
||||
alias pacown='pacman -Qo'
|
||||
|
||||
|
||||
if (( $+commands[abs] && $+commands[aur] )); then
|
||||
|
|
@ -96,13 +131,13 @@ else
|
|||
alias pacupd='sudo pacman -Sy'
|
||||
fi
|
||||
|
||||
paclist() {
|
||||
function 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() {
|
||||
function pacdisowned() {
|
||||
emulate -L zsh
|
||||
|
||||
tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
|
||||
|
|
@ -120,14 +155,14 @@ pacdisowned() {
|
|||
comm -23 "$fs" "$db"
|
||||
}
|
||||
|
||||
pacmanallkeys() {
|
||||
function pacmanallkeys() {
|
||||
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() {
|
||||
function pacmansignkeys() {
|
||||
emulate -L zsh
|
||||
for key in $*; do
|
||||
sudo pacman-key --recv-keys $key
|
||||
|
|
@ -136,3 +171,16 @@ pacmansignkeys() {
|
|||
--no-permission-warning --command-fd 0 --edit-key $key
|
||||
done
|
||||
}
|
||||
|
||||
if (( $+commands[xdg-open] )); then
|
||||
function pacweb() {
|
||||
pkg="$1"
|
||||
infos="$(pacman -Si "$pkg")"
|
||||
if [[ -z "$infos" ]]; then
|
||||
return
|
||||
fi
|
||||
repo="$(grep '^Repo' <<< "$infos" | grep -oP '[^ ]+$')"
|
||||
arch="$(grep '^Arch' <<< "$infos" | grep -oP '[^ ]+$')"
|
||||
xdg-open "https://www.archlinux.org/packages/$repo/$arch/$pkg/" &>/dev/null
|
||||
}
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -5,3 +5,8 @@ ASDF_DIR="${ASDF_DIR:-$HOME/.asdf}"
|
|||
if [ -f $ASDF_DIR/asdf.sh ]; then
|
||||
. $ASDF_DIR/asdf.sh
|
||||
fi
|
||||
|
||||
# Load asdf completions, if found.
|
||||
if [ -f $ASDF_DIR/completions/asdf.bash ]; then
|
||||
. $ASDF_DIR/completions/asdf.bash
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
License: GPL v2
|
||||
Thanks to http://www.k-lug.org/~kessler/projects.html for the fortune file.
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -26,13 +26,14 @@ function emotty() {
|
|||
# Use emotty set defined by user, fallback to default
|
||||
local emotty=${_emotty_sets[${emotty_set:-$emotty_default_set}]}
|
||||
# Parse $TTY number, normalizing it to an emotty set index
|
||||
(( tty = (${TTY##/dev/ttys} % ${#${=emotty}}) + 1 ))
|
||||
(( tty = (${TTY##/dev/tty} % ${#${=emotty}}) + 1 ))
|
||||
local character_name=${${=emotty}[tty]}
|
||||
echo "${emoji[${character_name}]}${emoji2[emoji_style]}"
|
||||
}
|
||||
|
||||
function display_emotty() {
|
||||
local name=$1
|
||||
local name=${1:-$emotty_set}
|
||||
echo $name
|
||||
for i in ${=_emotty_sets[$name]}; do
|
||||
printf "${emoji[$i]}${emoji2[emoji_style]} "
|
||||
done
|
||||
|
|
|
|||
|
|
@ -180,8 +180,8 @@ alias glgg='git log --graph'
|
|||
alias glgga='git log --graph --decorate --all'
|
||||
alias glgm='git log --graph --max-count=10'
|
||||
alias glo='git log --oneline --decorate'
|
||||
alias glol="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
|
||||
alias glola="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --all"
|
||||
alias glol="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'"
|
||||
alias glola="git log --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --all"
|
||||
alias glog='git log --oneline --decorate --graph'
|
||||
alias gloga='git log --oneline --decorate --graph --all'
|
||||
alias glp="_git_log_prettily"
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ __hub_setup_zsh_fns () {
|
|||
browse:'browse the project on GitHub'
|
||||
compare:'open GitHub compare view'
|
||||
ci-status:'lookup commit in GitHub Status API'
|
||||
sync:'update local branches from upstream'
|
||||
)
|
||||
_describe -t hub-commands 'hub command' hub_commands && ret=0
|
||||
|
||||
|
|
@ -115,6 +116,7 @@ create
|
|||
browse
|
||||
compare
|
||||
ci-status
|
||||
sync
|
||||
EOF
|
||||
__git_list_all_commands_without_hub
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
# Set up hub wrapper for git, if it is available; http://github.com/github/hub
|
||||
if [ "$commands[(I)hub]" ]; then
|
||||
if hub --version &>/dev/null; then
|
||||
eval $(hub alias -s zsh)
|
||||
fi
|
||||
if (( $+commands[hub] )); then
|
||||
alias git=hub
|
||||
fi
|
||||
|
||||
# Functions #################################################################
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
function gi() { curl -sL https://www.gitignore.io/api/${(j:,:)@} }
|
||||
function gi() { curl -fL https://www.gitignore.io/api/${(j:,:)@} }
|
||||
|
||||
_gitignoreio_get_command_list() {
|
||||
curl -sL https://www.gitignore.io/api/list | tr "," "\n"
|
||||
curl -fL https://www.gitignore.io/api/list | tr "," "\n"
|
||||
}
|
||||
|
||||
_gitignoreio () {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,16 @@
|
|||
# Enable gpg-agent if it is not running
|
||||
GPG_AGENT_SOCKET="${XDG_RUNTIME_DIR}/gnupg/S.gpg-agent.ssh"
|
||||
if [ ! -S $GPG_AGENT_SOCKET ]; then
|
||||
gpg-agent --daemon >/dev/null 2>&1
|
||||
export GPG_TTY=$(tty)
|
||||
fi
|
||||
# Enable gpg-agent if it is not running-
|
||||
# --use-standard-socket will work from version 2 upwards
|
||||
|
||||
# Set SSH to use gpg-agent if it is configured to do so
|
||||
GNUPGCONFIG="${GNUPGHOME:-"$HOME/.gnupg"}/gpg-agent.conf"
|
||||
if [ -r "$GNUPGCONFIG" ] && grep -q enable-ssh-support "$GNUPGCONFIG"; then
|
||||
AGENT_SOCK=`gpgconf --list-dirs | grep agent-socket | cut -d : -f 2`
|
||||
|
||||
if [ ! -S ${AGENT_SOCK} ]; then
|
||||
gpg-agent --daemon --use-standard-socket >/dev/null 2>&1
|
||||
fi
|
||||
export GPG_TTY=$(tty)
|
||||
|
||||
# Set SSH to use gpg-agent if it's enabled
|
||||
if [ -S "${AGENT_SOCK}.ssh" ]; then
|
||||
export SSH_AUTH_SOCK="${AGENT_SOCK}.ssh"
|
||||
unset SSH_AGENT_PID
|
||||
export SSH_AUTH_SOCK=$GPG_AGENT_SOCKET
|
||||
fi
|
||||
|
||||
|
|
|
|||
32
plugins/hanami/README.md
Normal file
32
plugins/hanami/README.md
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# Hanami Plugin #
|
||||
This plugin adds convenient ways to work with [Hanami](http://hanamirb.org/) via console.
|
||||
It's inspired by Rails plugin, so if you've used it, you'll feel like home.
|
||||
|
||||
## Usage ##
|
||||
|
||||
For example, type `hc` into your console when you're within Hanami project directory to run
|
||||
the application console. Have a look at available shortcuts below. You can read more about
|
||||
these commands [on the official website](http://hanamirb.org/guides/command-line/applications/).
|
||||
|
||||
## Aliases ##
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|---------------------------|---------------------------------------------------------|
|
||||
| HED | HANAMI_ENV=development | Set environment variable HANAMI_ENV to development |
|
||||
| HEP | HANAMI_ENV=production | Set environment variable HANAMI_ENV to production |
|
||||
| HET | HANAMI_ENV=test | Set environment variable HANAMI_ENV to test |
|
||||
| hc | hanami console | Run application console |
|
||||
| hd | hanami destroy | Remove specified hanami resource |
|
||||
| hg | hanami generate | Create specified hanami resource |
|
||||
| hgm | hanami generate migration | Create migration file |
|
||||
| hs | hanami server | Launch server with hanami application |
|
||||
| hsp | hanami server -p | Launch server with specified port |
|
||||
| hr | hanami routes | List application routes |
|
||||
| hdc | hanami db create | Create application database |
|
||||
| hdd | hanami db drop | Delete application database |
|
||||
| hdp | hanami db prepare | Prepare database for the current environment |
|
||||
| hda | hanami db apply | Recreates a fresh schema after migrations (destructive) |
|
||||
| hdv | hanami db version | Print current database version |
|
||||
| hdrs | hdd && hdp | Drop and recreate application database |
|
||||
| hdtp | HET hdp | Actualize test environment database |
|
||||
| hrg | hr | grep | Grep hanami routes with specified pattern |
|
||||
19
plugins/hanami/hanami.plugin.zsh
Normal file
19
plugins/hanami/hanami.plugin.zsh
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
alias -g HED='HANAMI_ENV=development'
|
||||
alias -g HEP='HANAMI_ENV=production'
|
||||
alias -g HET='HANAMI_ENV=test'
|
||||
|
||||
alias hc='hanami console'
|
||||
alias hd='hanami destroy'
|
||||
alias hg='hanami generate'
|
||||
alias hgm='hanami generate migration'
|
||||
alias hs='hanami server'
|
||||
alias hsp='hanami server -p'
|
||||
alias hr='hanami routes'
|
||||
alias hdc='hanami db create'
|
||||
alias hdd='hanami db drop'
|
||||
alias hdp='hanami db prepare'
|
||||
alias hda='hanami db apply'
|
||||
alias hdv='hanami db version'
|
||||
alias hdrs='hdd && hdp'
|
||||
alias hdtp='HET hdp'
|
||||
alias hrg='hr | grep'
|
||||
|
|
@ -7,7 +7,7 @@ _1st_arguments=(
|
|||
'dashboard:open the dashboard'
|
||||
'reported:search for issues reported by a user'
|
||||
'assigned:search for issues assigned to a user'
|
||||
'br:open the issue named after the git branch of the current directory'
|
||||
'branch:open the issue named after the git branch of the current directory'
|
||||
'dumpconfig:display effective jira configuration'
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ _mix_does_task_list_need_generating () {
|
|||
}
|
||||
|
||||
_mix_generate () {
|
||||
mix --help | grep -v 'iex -S' | tail -n +2 | cut -d " " -f 2 > .mix_tasks
|
||||
mix help | grep -v 'iex -S' | tail -n +2 | cut -d " " -f 2 > .mix_tasks
|
||||
}
|
||||
|
||||
_mix () {
|
||||
|
|
|
|||
|
|
@ -21,6 +21,15 @@ _1st_arguments=(
|
|||
'deps.unlock:Unlock the given dependencies'
|
||||
'deps.update:Update the given dependencies'
|
||||
'do:Executes the tasks separated by comma'
|
||||
'ecto.create:Create Ecto database'
|
||||
'ecto.drop:Drop the storage for the given repository'
|
||||
'ecto.dump:Dumps the current environment’s database structure'
|
||||
'ecto.gen.migration:Generates a migration'
|
||||
'ecto.gen.repo:Generates a new repository'
|
||||
'ecto.load:Loads the current environment’s database structure'
|
||||
'ecto.migrate:Runs Ecto migration'
|
||||
'ecto.migrations:Displays the up / down migration status'
|
||||
'ecto.rollback:Reverts applied migrations'
|
||||
'escript.build:Builds an escript for the project'
|
||||
'help:Print help information for tasks'
|
||||
'hex:Print hex help information'
|
||||
|
|
|
|||
|
|
@ -47,3 +47,11 @@ alias npmst="npm start"
|
|||
# Run npm test
|
||||
alias npmt="npm test"
|
||||
|
||||
# Run npm scripts
|
||||
alias npmR="npm run"
|
||||
|
||||
# Run npm publish
|
||||
alias npmP="npm publish"
|
||||
|
||||
# Run npm init
|
||||
alias npmI="npm init"
|
||||
|
|
|
|||
|
|
@ -1,50 +1,17 @@
|
|||
_homebrew-installed() {
|
||||
type brew &> /dev/null
|
||||
}
|
||||
# This plugin loads pyenv into the current shell and provides prompt info via
|
||||
# the 'pyenv_prompt_info' function. Also loads pyenv-virtualenv if available.
|
||||
|
||||
_pyenv-from-homebrew-installed() {
|
||||
brew --prefix pyenv &> /dev/null
|
||||
}
|
||||
|
||||
FOUND_PYENV=0
|
||||
pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv")
|
||||
|
||||
for pyenvdir in "${pyenvdirs[@]}" ; do
|
||||
if [ -d $pyenvdir/bin -a $FOUND_PYENV -eq 0 ] ; then
|
||||
FOUND_PYENV=1
|
||||
export PYENV_ROOT=$pyenvdir
|
||||
export PATH=${pyenvdir}/bin:$PATH
|
||||
eval "$(pyenv init - zsh)"
|
||||
|
||||
if pyenv commands | command grep -q virtualenv-init; then
|
||||
eval "$(pyenv virtualenv-init - zsh)"
|
||||
fi
|
||||
|
||||
function pyenv_prompt_info() {
|
||||
echo "$(pyenv version-name)"
|
||||
}
|
||||
fi
|
||||
done
|
||||
unset pyenvdir
|
||||
|
||||
if [ $FOUND_PYENV -eq 0 ] ; then
|
||||
pyenvdir=$(brew --prefix pyenv 2> /dev/null)
|
||||
if [ $? -eq 0 -a -d $pyenvdir/bin ] ; then
|
||||
FOUND_PYENV=1
|
||||
export PYENV_ROOT=$pyenvdir
|
||||
export PATH=${pyenvdir}/bin:$PATH
|
||||
eval "$(pyenv init - zsh)"
|
||||
|
||||
if pyenv commands | command grep -q virtualenv-init; then
|
||||
eval "$(pyenv virtualenv-init - zsh)"
|
||||
fi
|
||||
|
||||
function pyenv_prompt_info() {
|
||||
echo "$(pyenv version-name)"
|
||||
}
|
||||
if (( $+commands[pyenv] )); then
|
||||
eval "$(pyenv init - zsh)"
|
||||
if (( $+commands[pyenv-virtualenv-init] )); then
|
||||
eval "$(pyenv virtualenv-init - zsh)"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $FOUND_PYENV -eq 0 ] ; then
|
||||
function pyenv_prompt_info() { echo "system: $(python -V 2>&1 | cut -f 2 -d ' ')" }
|
||||
function pyenv_prompt_info() {
|
||||
echo "$(pyenv version-name)"
|
||||
}
|
||||
else
|
||||
# fallback to system python
|
||||
function pyenv_prompt_info() {
|
||||
echo "system: $(python -V 2>&1 | cut -f 2 -d ' ')"
|
||||
}
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@ _arguments \
|
|||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "rails subcommand" _1st_arguments
|
||||
return
|
||||
else
|
||||
_files
|
||||
return
|
||||
fi
|
||||
|
||||
case "$words[1]" in
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
# Sublime Text Aliases
|
||||
|
||||
() {
|
||||
|
||||
if [[ "$OSTYPE" == linux* ]]; then
|
||||
local _sublime_linux_paths > /dev/null 2>&1
|
||||
local _sublime_linux_paths
|
||||
_sublime_linux_paths=(
|
||||
"$HOME/bin/sublime_text"
|
||||
"/opt/sublime_text/sublime_text"
|
||||
|
|
@ -19,9 +23,8 @@ if [[ "$OSTYPE" == linux* ]]; then
|
|||
break
|
||||
fi
|
||||
done
|
||||
|
||||
elif [[ "$OSTYPE" = darwin* ]]; then
|
||||
local _sublime_darwin_paths > /dev/null 2>&1
|
||||
local _sublime_darwin_paths
|
||||
_sublime_darwin_paths=(
|
||||
"/usr/local/bin/subl"
|
||||
"/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
|
||||
|
|
@ -38,10 +41,9 @@ elif [[ "$OSTYPE" = darwin* ]]; then
|
|||
break
|
||||
fi
|
||||
done
|
||||
|
||||
elif [[ "$OSTYPE" = 'cygwin' ]]; then
|
||||
local _sublime_cygwin_paths > /dev/null 2>&1
|
||||
_sublime_cygwin_paths=(
|
||||
local sublime_cygwin_paths
|
||||
sublime_cygwin_paths=(
|
||||
"$(cygpath $ProgramW6432/Sublime\ Text\ 2)/sublime_text.exe"
|
||||
"$(cygpath $ProgramW6432/Sublime\ Text\ 3)/sublime_text.exe"
|
||||
)
|
||||
|
|
@ -52,9 +54,10 @@ elif [[ "$OSTYPE" = 'cygwin' ]]; then
|
|||
break
|
||||
fi
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
alias stt='st .'
|
||||
|
||||
find_project()
|
||||
|
|
|
|||
|
|
@ -25,5 +25,7 @@ alias sfcw='sf cache:warmup'
|
|||
alias sfroute='sf debug:router'
|
||||
alias sfcontainer='sf debug:container'
|
||||
alias sfgb='sf generate:bundle'
|
||||
alias sfge='sf doctrine:generate:entity'
|
||||
alias sfsu='sf doctrine:schema:update'
|
||||
alias sfdev='sf --env=dev'
|
||||
alias sfprod='sf --env=prod'
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ __vagrant-box ()
|
|||
|
||||
case $state in
|
||||
(command)
|
||||
_describe -t commands "gem subcommand" _box_arguments
|
||||
_describe -t commands "vagrant subcommand" _box_arguments
|
||||
return
|
||||
;;
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ _arguments -C \
|
|||
|
||||
case $state in
|
||||
(command)
|
||||
_describe -t commands "gem subcommand" _1st_arguments
|
||||
_describe -t commands "vagrant subcommand" _1st_arguments
|
||||
return
|
||||
;;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ function web_search() {
|
|||
baidu "https://www.baidu.com/s?wd="
|
||||
ecosia "https://www.ecosia.org/search?q="
|
||||
goodreads "https://www.goodreads.com/search?q="
|
||||
qwant "https://www.qwant.com/?q="
|
||||
)
|
||||
|
||||
# check whether the search engine is supported
|
||||
|
|
@ -49,6 +50,7 @@ alias github='web_search github'
|
|||
alias baidu='web_search baidu'
|
||||
alias ecosia='web_search ecosia'
|
||||
alias goodreads='web_search goodreads'
|
||||
alias qwant='web_search qwant'
|
||||
|
||||
#add your own !bang searches here
|
||||
alias wiki='web_search duckduckgo \!w'
|
||||
|
|
|
|||
23
plugins/zsh_reload/README.md
Normal file
23
plugins/zsh_reload/README.md
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# zsh_reload plugin
|
||||
|
||||
The zsh_reload plugin defines a function to reload the zsh session with
|
||||
just a few keystrokes.
|
||||
|
||||
To use it, add `zsh_reload` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... zsh_reload)
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
To reload the zsh session, just run `src`:
|
||||
|
||||
```zsh
|
||||
$ vim ~/.zshrc # enabled a plugin
|
||||
$ src
|
||||
re-compiling /home/user/.zshrc.zwc: succeeded
|
||||
re-compiling /home/user/.oh-my-zsh/cache/zcomp-host.zwc: succeeded
|
||||
|
||||
# you now have a fresh zsh session. happy hacking!
|
||||
```
|
||||
|
|
@ -1,13 +1,12 @@
|
|||
# reload zshrc
|
||||
function src()
|
||||
{
|
||||
local cache=$ZSH_CACHE_DIR
|
||||
autoload -U compinit zrecompile
|
||||
compinit -d "$cache/zcomp-$HOST"
|
||||
src() {
|
||||
local cache="$ZSH_CACHE_DIR"
|
||||
autoload -U compinit zrecompile
|
||||
compinit -i -d "$cache/zcomp-$HOST"
|
||||
|
||||
for f in ~/.zshrc "$cache/zcomp-$HOST"; do
|
||||
zrecompile -p $f && command rm -f $f.zwc.old
|
||||
done
|
||||
for f in ~/.zshrc "$cache/zcomp-$HOST"; do
|
||||
zrecompile -p $f && command rm -f $f.zwc.old
|
||||
done
|
||||
|
||||
source ~/.zshrc
|
||||
# Use $SHELL if available; remove leading dash if login shell
|
||||
[[ -n "$SHELL" ]] && exec ${SHELL#-} || exec zsh
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,9 +50,7 @@ function _ruby_version() {
|
|||
# use a neutral color, otherwise colors will vary according to time.
|
||||
function _git_time_since_commit() {
|
||||
# Only proceed if there is actually a commit.
|
||||
if git log -1 > /dev/null 2>&1; then
|
||||
# Get the last commit.
|
||||
last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null)
|
||||
if last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null); then
|
||||
now=$(date +%s)
|
||||
seconds_since_last_commit=$((now-last_commit))
|
||||
|
||||
|
|
|
|||
|
|
@ -6,5 +6,5 @@ PROMPT='%{$fg_bold[cyan]%}$ZSH_THEME_CLOUD_PREFIX %{$fg_bold[green]%}%p %{$fg[gr
|
|||
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[%{$fg[cyan]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}] %{$fg[yellow]%}⚡%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}]"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}] %{$fg[yellow]%}⚡ %{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[green]%}]"
|
||||
|
|
|
|||
|
|
@ -68,6 +68,10 @@ prompt_glyph="%{%(#.${root_prompt}.${user_prompt}) %2G%}"
|
|||
|
||||
setopt promptsubst
|
||||
|
||||
# Workaround for zsh 5.2 release (kudos to @timothybasanov)
|
||||
autoload +X VCS_INFO_nvcsformats
|
||||
functions[VCS_INFO_nvcsformats]=${functions[VCS_INFO_nvcsformats]/local -a msgs/}
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
autoload -Uz vcs_info
|
||||
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ zstyle ':vcs_info:*:prompt:*' nvcsformats ""
|
|||
|
||||
|
||||
function steeef_preexec {
|
||||
case "$(history $HISTCMD)" in
|
||||
case "$2" in
|
||||
*git*)
|
||||
PR_GIT_UPDATE=1
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
# user, host, full path, and time/date
|
||||
# on two lines for easier vgrepping
|
||||
# entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888
|
||||
# user, host, full path, and time/date on two lines for easier vgrepping
|
||||
|
||||
function hg_prompt_info {
|
||||
if (( $+commands[hg] )) && grep -q "prompt" ~/.hgrc; then
|
||||
hg prompt --angle-brackets "\
|
||||
<hg:%{$fg[magenta]%}<branch>%{$reset_color%}><:%{$fg[magenta]%}<bookmark>%{$reset_color%}>\
|
||||
</%{$fg[yellow]%}<tags|%{$reset_color%}, %{$fg[yellow]%}>%{$reset_color%}>\
|
||||
%{$fg[red]%}<status|modified|unknown><update>%{$reset_color%}<
|
||||
patches: <patches|join( → )|pre_applied(%{$fg[yellow]%})|post_applied(%{$reset_color%})|pre_unapplied(%{$fg_bold[black]%})|post_unapplied(%{$reset_color%})>>" 2>/dev/null
|
||||
fi
|
||||
}
|
||||
|
||||
ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}+"
|
||||
|
|
@ -33,4 +33,3 @@ function retcode() {}
|
|||
PROMPT=$'%{$fg_bold[blue]%}┌─[%{$fg_bold[green]%}%n%b%{$fg[black]%}@%{$fg[cyan]%}%m%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%{$fg_bold[white]%}%~%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%b%{$fg[yellow]%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{$fg_bold[blue]%}]
|
||||
%{$fg_bold[blue]%}└─[%{$fg_bold[magenta]%}%?$(retcode)%{$fg_bold[blue]%}] <$(mygit)$(hg_prompt_info)>%{$reset_color%} '
|
||||
PS2=$' \e[0;34m%}%B>%{\e[0m%}%b '
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ zstyle ':vcs_info:*:prompt:*' nvcsformats ""
|
|||
|
||||
|
||||
function steeef_preexec {
|
||||
case "$(history $HISTCMD)" in
|
||||
case "$2" in
|
||||
*git*)
|
||||
PR_GIT_UPDATE=1
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ main() {
|
|||
umask g-w,o-w
|
||||
|
||||
printf "${BLUE}Cloning Oh My Zsh...${NORMAL}\n"
|
||||
hash git >/dev/null 2>&1 || {
|
||||
command -v git >/dev/null 2>&1 || {
|
||||
echo "Error: git is not installed"
|
||||
exit 1
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue