Skip to content

Instantly share code, notes, and snippets.

@gerep
Created June 27, 2016 11:26
Show Gist options
  • Save gerep/8f95b52645be2de4b1944cfd75e5b8f6 to your computer and use it in GitHub Desktop.
Save gerep/8f95b52645be2de4b1944cfd75e5b8f6 to your computer and use it in GitHub Desktop.
[ -r /etc/profile.d/cnf.sh ] && . /etc/profile.d/cnf.sh
#source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
export BROWSER=/usr/bin/google-chrome-stable
export EDITOR=/usr/local/bin/vim
TERM=xterm
case $TERM in
xterm*)
precmd () {print -Pn "\e]0;%n@%m: %~\a"}
;;
esac
# preexec is called just before any command line is executed
#function preexec() {
# title "$1" "%m(%35<...<%~)"
#}
#
#function title() {
# # escape '%' chars in $1, make nonprintables visible
# a=${(V)1//\%/\%\%}
#
# # Truncate command, and join lines.
# a=$(print -Pn "%40>...>$a" | tr -d "\n")
#
# case $TERM in
# screen)
# print -n "\e]2;$a@$2\a" # plain xterm title
# print -n "\ek$a\e\\" # screen title (in ^A")
# print -n "\e_$2 \e\\" # screen location
# ;;
# xterm*|rxvt)
# print -n "\e]2;$a@$2\a" # plain xterm title
# ;;
# esac
#}
# load ssh-agent
. ~/.ssh-find-agent.sh
ssh-find-agent -a
if [ -z "$SSH_AUTH_SOCK" ]
then
eval $(ssh-agent) > /dev/null
ssh-add -l >/dev/null || alias ssh='ssh-add -l >/dev/null || ssh-add && unalias ssh; ssh'
fi
#zmodload zsh/terminfo
autoload -U compinit colors zcalc
compinit
colors
setopt correct # Auto correct mistakes
setopt extendedglob # Extended globbing
setopt nocaseglob # Case insensitive globbing
setopt rcexpandparam # Array expension with parameters
setopt nocheckjobs # Don't warn about running processes when exiting
setopt numericglobsort # Sort filenames numerically when it makes sense
setopt nohup # Don't kill processes when exiting
setopt nobeep # No beep
setopt appendhistory # Immediately append history instead of overwriting
setopt histignorealldups #If a new command is a duplicate, remove the older one
setopt autocd
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # Case insensitive tab completion
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # Colored completion (different colors for dirs/files/etc)
bindkey -e
bindkey '^[[7~' beginning-of-line # Home key
bindkey '^[[8~' end-of-line # End key
bindkey '^[[2~' overwrite-mode # Insert key
bindkey '^[[3~' delete-char # Delete key
# bind UP and DOWN arrow keys
zmodload zsh/terminfo
bindkey "$terminfo[kcuu1]" history-substring-search-up
bindkey "$terminfo[kcud1]" history-substring-search-down
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
bindkey '^[[C' forward-char # Right key
bindkey '^[[D' backward-char # Left key
bindkey '^[[5~' history-beginning-search-backward # Page up key
bindkey '^[[6~' history-beginning-search-forward # Page down key
bindkey '^[Oc' forward-word
bindkey '^[Od' backward-word
bindkey '^[[1;5D' backward-word
bindkey '^[[1;5C' forward-word
bindkey '^H' backward-kill-word
HISTFILE=~/.zhistory
HISTSIZE=10000
SAVEHIST=10000
alias sudo='sudo '
alias ls='ls --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F'
alias ll='ls -l --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F'
alias la='ls -la --group-directories-first --time-style=+"%d.%m.%Y %H:%M" --color=auto -F'
alias grep='grep --color=tty -d skip'
alias cp="cp -i" # Confirm before overwriting something
alias df='df -h' # Human-readable sizes
alias free='free -m' # Show sizes in MB
alias fixit='sudo rm -f /var/lib/pacman/db.lck && sudo pacman-mirrors -g && sudo pacman -Syyuu && sudo pacman -Suu'
alias bspwmrc='nano ~/.config/bspwm/bspwmrc'
alias sxhkdrc='nano ~/.config/sxhkd/sxhkdrc'
alias x='startx ~/.xinitrc' # Type name of desired desktop after x, xinitrc is configured for it
alias autostart='nano ~/.config/bspwm/autostart'
alias repoup='repo-add local-repo.db.tar.gz *.pkg.tar.*'
# ex - archive extractor
# usage: ex <file>
ex() {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via ex()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
##Single line, simple prompt.
#PROMPT="%{$fg[green]%}[%n:%4~]-%(?.%{$fg[green]%}>>> %{$reset_color%}.>>%{$fg[red]%}> %{$reset_color%})"
PROMPT="%{$fg[green]%}[%n:%4~]-%(?.%{$fg[green]%}>>> %{$reset_color%}.>>%{$fg[red]%}> %{$reset_color%})"
##Multiline, fancy prompt.
#PROMPT="%{$fg[green]%}┌─[%4~]-[%n@%M]%(!.#.$)
#└─%(?.%{$fg[green]%}>> %{$reset_color%}.%{$fg[red]%}>> %{$reset_color%})"
#RPROMPT="%(?.%{$fg[green]%}✓ %{$reset_color%}.%{$fg[red]%}✗ %{$reset_color%})"
## Base16 Shell color themes.
#possible themes: 3024, apathy, ashes, atelierdune, atelierforest, atelierhearth,
#atelierseaside, bespin, brewer, chalk, codeschool, colors, default, eighties,
#embers, flat, google, grayscale, greenscreen, harmonic16, isotope, londontube,
#marrakesh, mocha, monokai, ocean, paraiso, pop (dark only), railscasts, shapesifter,
#solarized, summerfruit, tomorrow, twilight
theme="eighties"
# Possible variants: dark and light
shade="dark"
BASE16_SHELL="$HOME/.config/base16-shell/base16-$theme.$shade.sh"
[[ -s $BASE16_SHELL ]] && source $BASE16_SHELL
# Go installation folder
PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/Code/go
PATH=$GOPATH/bin:$PATH
# Elixir
export PATH="$PATH:/path/to/elixir/bin"
# RVM
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment