Created
August 5, 2010 03:46
-
-
Save squarehimself/509195 to your computer and use it in GitHub Desktop.
My zshrc. The .sh extension is just for pretty colors.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################# | |
# Ugly Ass Code # | |
################# | |
autoload colors zsh/terminfo | |
if [[ "$terminfo[colors]" -ge 8 ]]; then | |
colors | |
fi | |
for color in red green yellow blue magenta cyan white; do | |
eval col_$color='%{$terminfo[bold]$fg[${(L)color}]%}' | |
eval col2_$color='%{$fg[${(L)color}]%}' | |
(( count = $count + 1 )) | |
done | |
nocolor="%{$terminfo[sgr0]%}" | |
######################### | |
# Linux Terminal Colors # | |
######################### | |
if [ "$TERM" = "linux" ]; then | |
echo -en "\e]P01A1A1A" #black | |
echo -en "\e]P8554444" #darkgrey | |
echo -en "\e]P1EA6868" #darkred | |
echo -en "\e]P9FF7272" #red | |
echo -en "\e]P2B6E77D" #darkgreen | |
echo -en "\e]PA9EAD72" #green | |
echo -en "\e]P3DBBB4B" #brown | |
echo -en "\e]PBDD7D33" #yellow | |
echo -en "\e]P44385EE" #darkblue | |
echo -en "\e]PC66D9EF" #blue | |
echo -en "\e]P575507B" #darkmagenta | |
echo -en "\e]PDAD7FA8" #magenta | |
echo -en "\e]P65E7175" #darkcyan | |
echo -en "\e]PEA3BABF" #cyan | |
echo -en "\e]P7F2F2F2" #lightgrey | |
echo -en "\e]PFACACAB" #white | |
clear #for background artifacting | |
fi | |
########### | |
# Exports # | |
########### | |
export LESS_TERMCAP_mb=$'\E[01;31m' | |
export LESS_TERMCAP_md=$'\E[01;31m' | |
export LESS_TERMCAP_me=$'\E[0m' | |
export LESS_TERMCAP_se=$'\E[0m' | |
export LESS_TERMCAP_so=$'\E[01;44;30m' | |
export LESS_TERMCAP_ue=$'\E[0m' | |
export LESS_TERMCAP_us=$'\E[01;32m' | |
export EDITOR=vim | |
export MOZ_DISABLE_PANGO=1 | |
export XDG_DESKTOP_DIR="/home/square" | |
############ | |
# Keybinds # | |
############ | |
bindkey "\e[1~" beginning-of-line | |
bindkey "\e[4~" end-of-line | |
bindkey "\e[5~" beginning-of-history | |
bindkey "\e[6~" end-of-history | |
bindkey "\e[3~" delete-char | |
bindkey "\e[2~" quoted-insert | |
bindkey "\e[5C" forward-word | |
bindkey "\e[5D" backward-word | |
bindkey "\e\e[C" forward-word | |
bindkey "\e\e[D" backward-word | |
bindkey "^H" backward-delete-word | |
############## | |
# Completion # | |
############## | |
zstyle ':completion:*' group-name '' | |
zstyle ':completion:*' insert-unambiguous true | |
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s | |
zstyle :compinstall filename '/home/square/.zshrc' | |
autoload -Uz compinit | |
compinit | |
################# | |
# Misc Settings # | |
################# | |
HISTFILE=~/.histfile | |
HISTSIZE=1000 | |
SAVEHIST=3000 | |
bindkey -e | |
eval "`dircolors -b ~/.dirColorsJES`" | |
setopt prompt_subst | |
########## | |
# PROMPT # | |
########## | |
# | |
#PROMPT='${PR_LIGHT_BLUE}┌$(battery)${PR_LIGHT_BLUE} | |
#${PR_LIGHT_BLUE}└< ${col_white}%~${nocolor} ${PR_LIGHT_BLUE}> ${nocolor}' | |
#RPROMPT='$(battery)' | |
function precmd { | |
PR_PWD=$(pwd | sed 's/\/home\/square/~/g') | |
(( PR_PWDSIZE=${#PR_PWD} + 26 )) | |
(( TERMWIDTH = ${COLUMNS} - 1 )) | |
PR_FILLER=${(l.(($TERMWIDTH - $PR_PWDSIZE))..─.)} | |
if [[ $PR_PWDSIZE -gt $TERMWIDTH ]]; then | |
ENDER=$(battery) | |
else | |
ENDER=$col_blue$PR_FILLER$(battery) | |
fi | |
} | |
prompty () { | |
PROMPT=' | |
$col2_red}╼ $col_white%~$nocolor $col_red╾$nocolor$ENDER$col_red╼ | |
└$col2_red╼$nocolor ' | |
} | |
#prompty | |
PROMPT='$col_red┌╼[ $col_white%~$nocolor $col_red] | |
$col_red└╼>$nocolor ' | |
PS2="$col_red─╼$nocolor" | |
PS3="$col_red──╼$nocolor" | |
########### | |
# Aliases # | |
########### | |
alias ls='ls -F --color=auto --group-directories-first' | |
alias ll='ls -gGFh --time-style=+"│" --color=auto --group-directories-first' | |
alias la='ls -lGAFh --color=auto --group-directories-first' | |
alias pacS='pacman -S' | |
alias pacSyu='pacman -Syu' | |
alias pacSs='pacman -Ss' | |
alias pacU='pacman -U' | |
alias pacR='pacman -R' | |
alias pacQ='pacman -Q' | |
#alias pacS='sudo pacman -S' | |
#alias pacSyu='sudo pacman -Syu' | |
#alias pacSs='pacman -Ss' | |
#alias pacU='sudo pacman -U' | |
#alias pacR='sudo pacman -R' | |
alias clyS='clyde -S' | |
alias clySyu='clyde -Syu' | |
alias clySs='clyde -Ss --repos' | |
alias clySsa='clyde -Ss' | |
alias clyU='clyde -U' | |
alias clyR='clyde -R' | |
alias clyQ='clyde -Q' | |
alias gist="pygist" | |
alias tmuxn='tmux' | |
alias tmux='tmux -2u' | |
alias batterypower='sudo /root/lowcpu.sh' | |
alias plugpower='sudo /root/maxcpu.sh' | |
alias mountiso='sudo mount -t iso9660 -o loop' | |
alias slurpy='slurpy -c' | |
alias cower='cower -c' | |
alias NAO='telnet nethack.alt.org -l Squareee:PASSWORD' | |
# Weird behavior when done all at once consecutively. :/ | |
alias 19inch='xrandr --output VGA1 --mode 1024x768 --rate 75.1' | |
alias 19inch2='xrandr --output LVDS1 --off && xrandr --output VGA1 --primary' | |
alias 19inchoff='xrandr --output LVDS1 --auto && xrandr --output VGA1 --off' | |
alias less="~/.vim/macros/less.sh" | |
############# | |
# Functions # | |
############# | |
extract () { | |
if [[ "$#" == "1" ]]; then | |
if [[ -f $1 ]]; then | |
case $1 in | |
*.tar.bz2) tar xvjf $1 ;; | |
*.tar.gz) tar xvzf $1 ;; | |
*.bz2) bunzip2 $1 ;; | |
*.rar) unrar x $1 ;; | |
*.gz) gunzip $1 ;; | |
*.tar) tar xvf $1 ;; | |
*.tbz2) tar xvjf $1 ;; | |
*.tgz) tar xvzf $1 ;; | |
*.zip) unzip $1 ;; | |
*.Z) uncompress $1 ;; | |
*.7z) 7z x $1 ;; | |
*) echo "don't know how to extract '$1'..." ;; | |
esac | |
else | |
echo "'$1' is not a valid file!" | |
fi | |
else | |
echo "Must provide only one argument!" | |
fi | |
} | |
pastie () { | |
if [[ "$#" == "1" ]]; then | |
if [[ -f $1 ]]; then | |
case $1 in | |
*.py) wgetpaste -l "Python" $1 ;; | |
*.rb) wgetpaste -l "Ruby" $1 ;; | |
*.sh) wgetpaste -l "Bash" $1 ;; | |
*.patch) wgetpaste -l "Diff" $1 ;; | |
*.hs) wgetpaste -l "Haskell" $1 ;; | |
*.xml) wgetpaste -l "XML" $1 ;; | |
*) wgetpaste $1 ;; | |
esac | |
else | |
echo "Failed to do anything with '$1'" | |
fi | |
else | |
echo "Need one and only one argument." | |
fi | |
} | |
# I don't even use clyde, but wtf :D | |
clyde() { | |
case $1 in | |
(-Ss | -Si | -Q* | -T | -G) | |
/usr/bin/clyde "$@" ;; | |
(-S* | -R* | -U | *) | |
/usr/bin/sudo /usr/bin/clyde "$@" ;; | |
esac | |
} | |
pacman() { | |
case $1 in | |
(-Ss | -Si | -Q* | -T | -V | --version) | |
/usr/bin/pacman "$@" ;; | |
(-S* | -R* | -U | *) | |
/usr/bin/sudo /usr/bin/pacman "$@" ;; | |
esac | |
} | |
quickaur() { | |
if [[ "$#" == "1" ]]; then | |
cd ~/abs | |
if [[ -d $1 ]]; then | |
echo "Directory already exists." | |
else | |
cower -d $1 | |
if [[ -d $1 ]]; then | |
builtin cd $1 | |
makepkg -sic | |
fi | |
fi | |
else | |
echo "Need one and only one argument." | |
fi | |
} | |
wiki() { dig +short txt $1.wp.dg.cx } | |
# vim: shiftwidth=4 | |
# EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment