Skip to content

Instantly share code, notes, and snippets.

@cheriimoya
Created May 8, 2018 12:31
Show Gist options
  • Save cheriimoya/51a61cc78298ea2a8a7fe27d07ab8d73 to your computer and use it in GitHub Desktop.
Save cheriimoya/51a61cc78298ea2a8a7fe27d07ab8d73 to your computer and use it in GitHub Desktop.
# Init Prompt and completion
autoload -U compinit promptinit
compinit
promptinit
export EDITOR=nano
#aliases
source ~/.zsh_aliases
# we don't need a history in less #############################################
export LESSHISTFILE=-
#autocorrect
setopt correctall
#history
HISTFILE=~/.zsh_history
HISTSIZE=1000000
SAVEHIST=1000000
setopt hist_ignore_all_dups
setopt hist_ignore_space
#style options
zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BSorry, no matches for: %d%b'
zstyle ':completion:*' menu select
# Disable BEEEEP
setopt NOBEEP
#keybindings
#jump words forward/backward
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey '^R' history-incremental-search-backward
bindkey '^A' beginning-of-line
bindkey '^E' end-of-line
#autocd /etc instead of cd /etc
setopt autocd
setopt AUTO_CD
#regex files
setopt extendedglob
# Enable Colors
COLOR_BLACK=$'\033'"[${color[black]}m"
COLOR_RED=$'\033'"[${color[red]}m"
COLOR_GREEN=$'\033'"[${color[green]}m"
COLOR_YELLOW=$'\033'"[${color[yellow]}m"
COLOR_BLUE=$'\033'"[${color[blue]}m"
COLOR_MAGENTA=$'\033'"[${color[magenta]}m"
COLOR_CYAN=$'\033'"[${color[cyan]}m"
COLOR_WHITE=$'\033'"[${color[white]}m"
COLOR_BG_BLACK=$'\033'"[${color[bg-black]}m"
COLOR_BG_RED=$'\033'"[${color[bg-red]}m"
COLOR_BG_GREEN=$'\033'"[${color[bg-green]}m"
COLOR_BG_YELLOW=$'\033'"[${color[bg-yellow]}m"
COLOR_BG_BLUE=$'\033'"[${color[bg-blue]}m"
COLOR_BG_MAGENTA=$'\033'"[${color[bg-magenta]}m"
COLOR_BG_CYAN=$'\033'"[${color[bg-cyan]}m"
COLOR_BG_WHITE=$'\033'"[${color[bg-white]}m"
COLOR_BOLD=$'\033'"[${color[bold]}m"
COLOR_RESET=$'\033'"[${color[none]}m"
#colors
autoload -U colors && colors
# Color for Manpages #########################################################
#export LESS_TERMCAP_md=$COLOR_YELLOW$COLOR_BOLD
export LESS_TERMCAP_md=$COLOR_YELLOW
export LESS_TERMCAP_me=$COLOR_RESET
export LESS_TERMCAP_so=$COLOR_WHITE$COLOR_BG_BLUE
export LESS_TERMCAP_se=$COLOR_RESET
export LESS_TERMCAP_us=$COLOR_RED
export LESS_TERMCAP_ue=$COLOR_RESET
#key[Home]=${terminfo[khome]}
#key[End]=${terminfo[kend]}
#key[Insert]=${terminfo[kich1]}
#key[Delete]=${terminfo[kdch1]}
#key[Up]=${terminfo[kcuu1]}
#key[Down]=${terminfo[kcud1]}
#key[Left]=${terminfo[kcub1]}
#key[Right]=${terminfo[kcuf1]}
#key[PageUp]=${terminfo[kpp]}
#key[PageDown]=${terminfo[knp]}
# setup key accordingly
[[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
[[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
[[ -n "${key[Insert]}" ]] && bindkey "${key[Insert]}" overwrite-mode
[[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
[[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history
[[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history
[[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
[[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" history-beginning-search-backward
[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" history-beginning-search-forward
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
#prompt
PROMPT="%{$fg[green]%}%n%{$reset_color%}%{$reset_color%} %{$fg_no_bold[cyan]%}%3~ %{$reset_color%}\$ "
RPROMPT="[%{$fg_no_bold[green]%}%?%{$reset_color%}]"
#extractor
extr()
{
if [[ -f $1 ]]; then
case $1 in
(*.tar.gz | *.tgz) tar -xvzf $1;;
(*.tar.bz2 | *.tbz2) tar -xvjf $1;;
(*.gz) gunzip -v $1;;
(*.bz2) bunzip2 -v $1;;
(*.zip) unzip $1;;
esac
fi
}
#cd sachen
OLDPROMPT=$PROMPT
DIRDEPTH="="
PENISDIR=0
function penisdir()
{
PENISDIR=$(($((${PENISDIR}+1))%2))
}
chpwd_functions=(dir_in_title)
function chpwd()
{
if [ $PENISDIR -eq 1 ]
then
DIRDEPTH+="="
PROMPT="8=${DIRDEPTH}=D~~ "
else
DIRDEPTH="="
PROMPT=$OLDPROMPT
fi
if [ "$PWD" != "$HOME" ]
then
ls --color=always
fi
}
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt:/usr/local/go/bin
#start X at boot
if [ -z "$DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -le 2 ];then
exec startx
fi
eval $(thefuck --alias)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment