Skip to content

Instantly share code, notes, and snippets.

@0rbadvent
Created December 21, 2017 02:44
Show Gist options
  • Save 0rbadvent/4a4f8731925f74893fd456a96e0dd366 to your computer and use it in GitHub Desktop.
Save 0rbadvent/4a4f8731925f74893fd456a96e0dd366 to your computer and use it in GitHub Desktop.
# ~/.zshrc
####################################
umask 077
export ZSH=/usr/share/oh-my-zsh
ZDOTDIR=${ZDOTDIR:-${HOME}}
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=200000
export TERM="xterm-256color"
####################################
# Autocompletion
autoload -Uz compinit promptinit
compinit
promptinit
############# - OR - ################
#ZSH_THEME="robbyrussell"
ZSH_THEME="powerline"
#ZSH_THEME="bullet-train"
#ZSH_THEME="af-magic" # NOT THAT BAD - SPECIAL
#ZSH_THEME="bureau" # COOL BUT TWO LINES
#ZSH_THEME="norm"
#ZSH_THEME="pygmalion" # COOL - SUITABLE
######################################
#setopt autocd # No 'cd' needed
setopt complete_in_word # Tab-completion in the middle of a word
setopt correctall # Correct typoed commands
#setopt extended_history # History with timestamps
setopt hist_ignore_all_dups # No same commands
setopt hist_ignore_space # Space in the beginning won't mismatch commands
setopt hist_reduce_blanks # Remove blanks from history
setopt incappendhistory #append lines to history immediatly instead of waiting till shell is killed
setopt histverify #reload a line into editing buffer instead of executing
setopt interactivecomments # Don't care about comments with commands
setopt noclobber # Don't overwrite existing files with >
setopt NO_HUP
setopt NO_CHECK_JOBS
setopt menu_complete
source $ZSH/oh-my-zsh.sh
# Tab completion for folders & subfolders
zstyle ':completion:*'special-dirs true
# ...with an arrow-key driven interface
zstyle ':completion:*' menu select
# Allow approximate
zstyle ':completion:*' completer _complete _match _approximate
zstyle ':completion:*:match:*' original only
zstyle ':completion:*:approximate:*' max-errors 1 numeric
#pacman
zstyle ':completion:*:*:pacman:*' menu yes select
zstyle ':completion:*:pacman:*' force-list always
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
# Tab completion for PID
zstyle ':completion:*:*:kill:*' menu yes select
zstyle ':completion:*:kill:*' force-list always
# cd won't select parent dir
zstyle ':completion:*:cd:*' ignore-parents parent pwd
#if [[ -f /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]]; then
# source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
#fi
if [[ -f /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh ]]; then
source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
fi
if [[ -f /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh ]]; then
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
fi
DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
#ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
#ZSH_CUSTOM=/usr/share/zsh/
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git archlinux colorize colored-manpages themes extract copydir copyfile cp copybuffer compleat catimg fbterm man nmap perms safe-paste sudo systemd urltools systemd torrent web-search zsh-navigation-tools zsh-reload)
export LANG=en_US.UTF-8
export EDITOR=$(which nano)
export VISUAL=$(which subl3)
##20130928-Set up alias to get colors and put them to clipboard
alias colorpick='zenity --color-selection --show-palette |xclip'
# Aliases for safe file handling
alias cp='cp -iv'
alias rcp='rsync -v --progress'
alias rmv='rsync -v --progress --remove-source-files'
alias mv='mv -iv'
alias rm='rm -iv'
alias rmdir='rmdir -v'
alias ln='ln -v'
alias chmod="chmod -c"
alias chown="chown -c"
alias mkdir="mkdir -v"
# moar colourz plz
if command -v colordiff > /dev/null 2>&1; then
alias diff="colordiff -Nuar"
else
alias diff="diff -Nuar"
fi
alias grep='grep --colour=auto'
alias egrep='egrep --colour=auto'
alias ls='ls --color=auto --human-readable --group-directories-first --classify'
alias nano='nano -cgiklmtwzSLEFOB --backupdir=${HOME}/.cache/nano/backup'
alias zshrc='${VISUAL} ${ZDOTDIR}/.zshrc'
export TERM="xterm"
# Keys arrows home and the-like.
case $TERM in
rxvt*|xterm*)
bindkey "^[[7~" beginning-of-line #Home key
bindkey "^[[8~" end-of-line #End key
bindkey "^[[3~" delete-char #Del key
bindkey "^[[A" history-beginning-search-backward #Up Arrow
bindkey "^[[B" history-beginning-search-forward #Down Arrow
bindkey "^[Oc" forward-word # control + right arrow
bindkey "^[Od" backward-word # control + left arrow
bindkey "^H" backward-kill-word # control + backspace
bindkey "^[[3^" kill-word # control + delete
;;
linux)
bindkey "^[[1~" beginning-of-line #Home key
bindkey "^[[4~" end-of-line #End key
bindkey "^[[3~" delete-char #Del key
bindkey "^[[A" history-beginning-search-backward
bindkey "^[[B" history-beginning-search-forward
;;
screen|screen-*)
bindkey "^[[1~" beginning-of-line #Home key
bindkey "^[[4~" end-of-line #End key
bindkey "^[[3~" delete-char #Del key
bindkey "^[[A" history-beginning-search-backward #Up Arrow
bindkey "^[[B" history-beginning-search-forward #Down Arrow
bindkey "^[Oc" forward-word # control + right arrow
bindkey "^[OC" forward-word # control + right arrow
bindkey "^[Od" backward-word # control + left arrow
bindkey "^[OD" backward-word # control + left arrow
bindkey "^H" backward-kill-word # control + backspace
bindkey "^[[3^" kill-word # control + delete
;;
esac
### fix yaort arrows
bindkey '\e[A' up-line-or-history
bindkey '\e[B' down-line-or-history
bindkey '\e[C' forward-char
bindkey '\e[D' backward-char
bindkey '\eOA' up-line-or-history
bindkey '\eOB' down-line-or-history
bindkey '\eOC' forward-char
bindkey '\eOD' backward-char
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment