Last active
December 26, 2015 00:59
-
-
Save slava-sh/7068414 to your computer and use it in GitHub Desktop.
.zshrc
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
#!/bin/zsh | |
# If not running interactively, don't do anything | |
[[ $- != *i* ]] && return | |
# tmux on VT | |
[[ $TERM == linux ]] && test -z "$TMUX" && (tmux attach || tmux new-session) | |
# for autocomplete | |
alias sudo='sudo ' | |
alias netstat='grc netstat' | |
alias ping='grc ping' | |
alias traceroute='grc traceroute' | |
alias last='grc last' | |
alias diff='colordiff' | |
alias ls='ls --color=auto' | |
alias hlint='hlint --color --hint Default --hint Dollar' | |
eval $(dircolors -b) | |
export GREP_OPTIONS='--color=auto' | |
export GREP_COLOR='1;33' | |
alias rm='rm -I' | |
alias mv='mv -i' | |
alias cp='cp -i' | |
alias ln='ln -i' | |
alias chown='chown --preserve-root' | |
alias chmod='chmod --preserve-root' | |
alias chgrp='chgrp --preserve-root' | |
alias ghc='ghc -Wall -fno-warn-type-defaults' | |
# alias ghc='ghc -Wall -fno-warn-type-defaults -fno-warn-missing-signatures' | |
alias clang='clang -Wall' | |
alias clang++='clang++ -Wall' | |
alias gcc='gcc -Wall' | |
alias g++='g++ -Wall' | |
alias vim='vim -p' | |
alias gvim='gvim -p' | |
alias rsync='rsync --progress' | |
alias pager='$PAGER' | |
alias l='ls -lah' | |
alias a='ls -A' | |
alias from1251='iconv -f cp1251' | |
alias open='mimeopen' | |
alias histgrep='history 0 | grep' | |
alias clear_colors='sed -r "s:\x1B\[[0-9;]*[mK]::g"' | |
alias :w='echo "Ha-ha, you'\''re not in vim"' | |
alias :q=:w | |
export EDITOR='vim' | |
export PAGER='vim-pager' | |
export SYSTEMD_PAGER='cat' | |
export GIT_PAGER='cat' | |
if [ "$TERM" = "xterm" ] ; then | |
if [ -z "$COLORTERM" ] ; then | |
if [ -z "$XTERM_VERSION" ] ; then | |
echo "Warning: Terminal wrongly calling itself 'xterm'." | |
else | |
case "$XTERM_VERSION" in | |
"XTerm(256)") TERM="xterm-256color" ;; | |
"XTerm(88)") TERM="xterm-88color" ;; | |
"XTerm") ;; | |
*) echo "Warning: Unrecognized XTERM_VERSION: $XTERM_VERSION" ;; | |
esac | |
fi | |
else | |
case "$COLORTERM" in | |
xfce4-terminal) TERM="xterm-256color" ;; | |
gnome-terminal) TERM="gnome-256color" ;; | |
*) echo "Warning: Unrecognized COLORTERM: $COLORTERM" ;; | |
esac | |
fi | |
fi | |
if [ -n "$DISPLAY" ]; then | |
export BROWSER='firefox' | |
else | |
export BROWSER='w3m' | |
fi | |
export PATH="$PATH:/home/slava/.gem/ruby/2.0.0/bin" | |
export HISTFILE=~/.zsh_history | |
export SAVEHIST=10000 | |
export HISTSIZE=10000 | |
zstyle :compinstall filename '/home/slava/.zshrc' | |
autoload -U compinit && compinit | |
autoload -U colors && colors | |
autoload -U edit-command-line | |
zle -N edit-command-line | |
bindkey '^E' edit-command-line # with $EDITOR | |
PROMPT="%{$fg[cyan]%}%?%{$reset_color%} " | |
RPROMPT="%{$fg_bold[green]%}%~%{$reset_color%}" | |
setopt no_auto_menu | |
setopt auto_pushd | |
setopt no_bang_hist | |
setopt clobber | |
setopt check_jobs | |
setopt complete_aliases | |
setopt correct | |
setopt extended_glob | |
setopt glob_dots | |
setopt hist_find_no_dups | |
setopt hist_ignore_all_dups | |
setopt hist_ignore_space | |
setopt hist_reduce_blanks | |
setopt ignore_eof | |
setopt interactive_comments | |
setopt hup | |
setopt list_packed | |
setopt no_list_types | |
setopt no_notify | |
setopt pushd_minus | |
setopt pushd_silent | |
setopt pushd_to_home | |
zstyle ':completion:*' completer _complete _match _approximate _expand _ignored | |
zstyle ':completion:*' force-list always | |
zstyle ':completion:*' group-name '' | |
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} | |
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' | |
zstyle ':completion:*' menu select=long-list select=0 | |
zstyle ':completion:*' verbose true | |
zstyle ':completion:*:match:*' original only | |
zstyle ':completion:*:cd:*' ignore-parents parent pwd | |
zstyle -e ':completion:*:approximate:*' max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)' | |
bindkey -v | |
bindkey "^[[1~" beginning-of-line | |
bindkey "^[[4~" end-of-line | |
bindkey "^[[5~" beginning-of-history | |
bindkey "^[[6~" end-of-history | |
bindkey "^[[7~" beginning-of-line | |
bindkey "^[[8~" end-of-line | |
bindkey "^[[3~" delete-char | |
bindkey "^[[2~" quoted-insert | |
bindkey "^[[5C" forward-word | |
bindkey "^[[5D" backward-word | |
bindkey "^[^[[C" forward-word | |
bindkey "^[^[[D" backward-word | |
bindkey "^[[1;5C" forward-word | |
bindkey "^[[1;5D" backward-word | |
bindkey "^[OH" beginning-of-line | |
bindkey "^[OF" end-of-line | |
bindkey "^[[H" beginning-of-line | |
bindkey "^[[F" end-of-line | |
bindkey "^[[A" history-beginning-search-backward | |
bindkey "^[[B" history-beginning-search-forward | |
case $TERM in | |
xterm*) | |
precmd() { print -Pn "\e]0;%~\a" } | |
preexec() { print -Pn "\e]0;$1\a" } | |
;; | |
esac | |
cd /tmp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment