summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/archlinux/archlinux.plugin.zsh67
-rw-r--r--plugins/ssh-agent/ssh-agent.plugin.zsh65
-rw-r--r--themes/sunrise.zsh-theme96
3 files changed, 215 insertions, 13 deletions
diff --git a/plugins/archlinux/archlinux.plugin.zsh b/plugins/archlinux/archlinux.plugin.zsh
new file mode 100644
index 000000000..acb8df057
--- /dev/null
+++ b/plugins/archlinux/archlinux.plugin.zsh
@@ -0,0 +1,67 @@
+# Archlinux zsh aliases and functions for zsh
+
+# Aliases ###################################################################
+
+# Look for yaourt, and add some useful functions if we have it.
+if [[ -x `which yaourt` ]]; then
+ upgrade () {
+ yaourt -Syu -C
+ }
+ # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
+ alias yaupg='sudo yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
+ alias yain='sudo yaourt -S' # Install specific package(s) from the repositories
+ alias yains='sudo yaourt -U' # Install specific package not from the repositories but from a file
+ alias yare='sudo yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
+ alias yarem='sudo 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
+ # Additional yaourt alias examples
+ alias yaupd='sudo yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
+ alias yainsd='sudo yaourt -S --asdeps' # Install given package(s) as dependencies of another package
+ alias yamir='sudo 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
+alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
+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() {
+ sudo 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 paclsorhpans='sudo pacman -Qdt'
+alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
+
+pacdisowned() {
+ tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
+ db=$tmp/db
+ fs=$tmp/fs
+
+ mkdir "$tmp"
+ trap 'rm -rf "$tmp"' EXIT
+
+ pacman -Qlq | sort -u > "$db"
+
+ find /bin /etc /lib /sbin /usr \
+ ! -name lost+found \
+ \( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
+
+ comm -23 "$fs" "$db"
+}
diff --git a/plugins/ssh-agent/ssh-agent.plugin.zsh b/plugins/ssh-agent/ssh-agent.plugin.zsh
index 0efc4546f..c4e92a1fe 100644
--- a/plugins/ssh-agent/ssh-agent.plugin.zsh
+++ b/plugins/ssh-agent/ssh-agent.plugin.zsh
@@ -1,23 +1,62 @@
-# Based on code from Joseph M. Reagle
-# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
+#
+# INSTRUCTIONS
+#
+# To enabled agent forwarding support add the following to
+# your .zshrc file:
+#
+# zstyle :omz:plugins:ssh-agent agent-forwarding on
+#
+# To load multiple identies use the identities style, For
+# example:
+#
+# zstyle :omz:plugins:ssh-agent id_rsa id_rsa2 id_github
+#
+#
+# CREDITS
+#
+# Based on code from Joseph M. Reagle
+# http://www.cygwin.com/ml/cygwin/2001-06/msg00537.html
+#
+# Agent forwarding support based on ideas from
+# Florent Thoumie and Jonas Pfenniger
+#
-local SSH_ENV=$HOME/.ssh/environment-$HOST
+local _plugin__ssh_env=$HOME/.ssh/environment-$HOST
+local _plugin__forwarding
-function start_agent {
- /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
- chmod 600 ${SSH_ENV}
- . ${SSH_ENV} > /dev/null
- /usr/bin/ssh-add;
+function _plugin__start_agent()
+{
+ local -a identities
+
+ # start ssh-agent and setup environment
+ /usr/bin/env ssh-agent | sed 's/^echo/#echo/' > ${_plugin__ssh_env}
+ chmod 600 ${_plugin__ssh_env}
+ . ${_plugin__ssh_env} > /dev/null
+
+ # load identies
+ zstyle -a :omz:plugins:ssh-agent identities identities
+ echo starting...
+ /usr/bin/ssh-add $HOME/.ssh/${^identities}
}
-# Source SSH settings, if applicable
+# test if agent-forwarding is enabled
+zstyle -b :omz:plugins:ssh-agent agent-forwarding _plugin__forwarding
+if [[ ${_plugin__forwarding} == "yes" && -n "$SSH_AUTH_SOCK" ]]; then
+ # Add a nifty symlink for screen/tmux if agent forwarding
+ [[ -L $SSH_AUTH_SOCK ]] || ln -sf "$SSH_AUTH_SOCK" /tmp/ssh-agent-$USER-screen
-if [ -f "${SSH_ENV}" ]; then
- . ${SSH_ENV} > /dev/null
+elif [ -f "${_plugin__ssh_env}" ]; then
+ # Source SSH settings, if applicable
+ . ${_plugin__ssh_env} > /dev/null
ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
- start_agent;
+ _plugin__start_agent;
}
else
- start_agent;
+ _plugin__start_agent;
fi
+# tidy up after ourselves
+unfunction _plugin__start_agent
+unset _plugin__forwarding
+unset _plugin__ssh_env
+
diff --git a/themes/sunrise.zsh-theme b/themes/sunrise.zsh-theme
new file mode 100644
index 000000000..88b371d79
--- /dev/null
+++ b/themes/sunrise.zsh-theme
@@ -0,0 +1,96 @@
+#-------------------------------------------------------------------------------
+# Sunrise theme for oh-my-zsh by Adam Lindberg (eproxus@gmail.com)
+# Intended to be used with Solarized: http://ethanschoonover.com/solarized
+# (Needs Git plugin for current_branch method)
+#-------------------------------------------------------------------------------
+
+# Color shortcuts
+R=$fg[red]
+G=$fg[green]
+M=$fg[magenta]
+RB=$fg_bold[red]
+YB=$fg_bold[yellow]
+BB=$fg_bold[blue]
+RESET=$reset_color
+
+if [ "$(whoami)" = "root" ]; then
+ PROMPTCOLOR="%{$RB%}" PREFIX="-!-";
+else
+ PROMPTCOLOR="" PREFIX="---";
+fi
+
+local return_code="%(?..%{$R%}%? ↵%{$RESET%})"
+
+# Get the status of the working tree (copied and modified from git.zsh)
+custom_git_prompt_status() {
+ INDEX=$(git status --porcelain 2> /dev/null)
+ STATUS=""
+ # Non-staged
+ if $(echo "$INDEX" | grep '^?? ' &> /dev/null); then
+ STATUS="$ZSH_THEME_GIT_PROMPT_UNTRACKED$STATUS"
+ fi
+ if $(echo "$INDEX" | grep '^UU ' &> /dev/null); then
+ STATUS="$ZSH_THEME_GIT_PROMPT_UNMERGED$STATUS"
+ fi
+ if $(echo "$INDEX" | grep '^ D ' &> /dev/null); then
+ STATUS="$ZSH_THEME_GIT_PROMPT_DELETED$STATUS"
+ fi
+ if $(echo "$INDEX" | grep '^.M ' &> /dev/null); then
+ STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
+ elif $(echo "$INDEX" | grep '^AM ' &> /dev/null); then
+ STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
+ elif $(echo "$INDEX" | grep '^ T ' &> /dev/null); then
+ STATUS="$ZSH_THEME_GIT_PROMPT_MODIFIED$STATUS"
+ fi
+ # Staged
+ if $(echo "$INDEX" | grep '^D ' &> /dev/null); then
+ STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_DELETED$STATUS"
+ fi
+ if $(echo "$INDEX" | grep '^R' &> /dev/null); then
+ STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_RENAMED$STATUS"
+ fi
+ if $(echo "$INDEX" | grep '^M' &> /dev/null); then
+ STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_MODIFIED$STATUS"
+ fi
+ if $(echo "$INDEX" | grep '^A' &> /dev/null); then
+ STATUS="$ZSH_THEME_GIT_PROMPT_STAGED_ADDED$STATUS"
+ fi
+
+ if $(echo -n "$STATUS" | grep '.*' &> /dev/null); then
+ STATUS="$ZSH_THEME_GIT_STATUS_PREFIX$STATUS"
+ fi
+
+ echo $STATUS
+}
+
+# get the name of the branch we are on (copied and modified from git.zsh)
+function custom_git_prompt() {
+ ref=$(git symbolic-ref HEAD 2> /dev/null) || return
+ echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$(git_prompt_ahead)$(custom_git_prompt_status)$ZSH_THEME_GIT_PROMPT_SUFFIX"
+}
+
+# %B sets bold text
+PROMPT='%B$PREFIX %2~ $(custom_git_prompt)%{$M%}%B»%b%{$RESET%} '
+RPS1="${return_code}"
+
+ZSH_THEME_GIT_PROMPT_PREFIX="%{$YB%}‹"
+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$YB%}›%{$RESET%} "
+
+ZSH_THEME_GIT_PROMPT_DIRTY="%{$R%}*"
+ZSH_THEME_GIT_PROMPT_CLEAN=""
+
+ZSH_THEME_GIT_PROMPT_AHEAD="%{$BB%}➔"
+
+ZSH_THEME_GIT_STATUS_PREFIX=" "
+
+# Staged
+ZSH_THEME_GIT_PROMPT_STAGED_ADDED="%{$G%}A"
+ZSH_THEME_GIT_PROMPT_STAGED_MODIFIED="%{$G%}M"
+ZSH_THEME_GIT_PROMPT_STAGED_RENAMED="%{$G%}R"
+ZSH_THEME_GIT_PROMPT_STAGED_DELETED="%{$G%}D"
+
+# Not-staged
+ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$R%}⁇"
+ZSH_THEME_GIT_PROMPT_MODIFIED="%{$R%}M"
+ZSH_THEME_GIT_PROMPT_DELETED="%{$R%}D"
+ZSH_THEME_GIT_PROMPT_UNMERGED="%{$R%}UU"