Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # =============
- # INIT
- # =============
- # Senstive functions which are not pushed to Github
- # It contains GOPATH, some functions, aliases etc...
- [ -r ~/.zsh_private ] && source ~/.zsh_private
- # =============
- # ALIAS
- # =============
- alias ..='cd ..'
- alias t="tig status"
- alias tigs="tig status" #old habits don't die
- alias d='git diff'
- alias vi='vim'
- case `uname` in
- Darwin)
- alias flushdns='sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder;say cache flushed'
- alias ls='ls -GpF' # Mac OSX specific
- alias ll='ls -alGpF' # Mac OSX specific
- ;;
- Linux)
- alias ll='ls -al'
- alias ls='ls --color=auto'
- ;;
- esac
- alias sq='git rebase -i $(git merge-base $(git rev-parse --abbrev-ref HEAD) master)'
- alias co='git checkout master'
- alias po='git pull origin $(git rev-parse --abbrev-ref HEAD)'
- alias b='git branch'
- alias hc='hub compare'
- alias hb='hub browse'
- alias hp='hub pull-request'
- alias -s go='go run'
- alias hs='hugo server'
- alias icloud='cd ~/Library/Mobile\ Documents/com~apple~CloudDocs/'
- export LC_ALL="en_US.UTF-8"
- export LANG="en_US.UTF-8"
- # =============
- # EXPORT
- # =============
- #
- export PATH="/usr/local/go/bin:$GOBIN:$HOME/.cargo/bin:$PATH"
- export EDITOR="vim"
- export LSCOLORS=cxBxhxDxfxhxhxhxhxcxcx
- export CLICOLOR=1
- # support colors in less
- 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;33m'
- export LESS_TERMCAP_ue=$'\E[0m'
- export LESS_TERMCAP_us=$'\E[01;32m'
- # =============
- # HISTORY
- # =============
- ## Command history configuration
- HISTFILE=$HOME/.zsh_history
- HISTSIZE=1000000
- SAVEHIST=1000000
- setopt append_history
- setopt extended_history
- setopt hist_expire_dups_first
- # ignore duplication command history list
- setopt hist_ignore_dups
- setopt hist_ignore_space
- setopt hist_verify
- setopt inc_append_history
- # share command history data
- setopt share_history
- # =============
- # PROMPT
- # =============
- autoload -U colors && colors
- setopt promptsubst
- local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[green]%}➜ )"
- PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
- ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
- ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
- ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
- ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
- # Outputs current branch info in prompt format
- function git_prompt_info() {
- local ref
- if [[ "$(command git config --get customzsh.hide-status 2>/dev/null)" != "1" ]]; then
- ref=$(command git symbolic-ref HEAD 2> /dev/null) || \
- ref=$(command git rev-parse --short HEAD 2> /dev/null) || return 0
- echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
- fi
- }
- # Checks if working tree is dirty
- function parse_git_dirty() {
- local STATUS=''
- local FLAGS
- FLAGS=('--porcelain')
- if [[ "$(command git config --get customzsh.hide-dirty)" != "1" ]]; then
- FLAGS+='--ignore-submodules=dirty'
- STATUS=$(command git status ${FLAGS} 2> /dev/null | tail -n1)
- fi
- if [[ -n $STATUS ]]; then
- echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
- else
- echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
- fi
- }
- # ===================
- # AUTOCOMPLETION
- # ===================
- # enable completion
- autoload -Uz compinit
- compinit
- autoload bashcompinit
- bashcompinit
- zmodload -i zsh/complist
- WORDCHARS=''
- unsetopt menu_complete # do not autoselect the first completion entry
- unsetopt flowcontrol
- setopt auto_menu # show completion menu on successive tab press
- setopt complete_in_word
- setopt always_to_end
- # autocompletion with an arrow-key driven interface
- zstyle ':completion:*:*:*:*:*' menu select
- zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|=*' 'l:|=* r:|=*'
- zstyle ':completion:*' list-colors ''
- zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
- zstyle ':completion:*:*:*:*:processes' command "ps -u $USER -o pid,user,comm -w -w"
- # Don't complete uninteresting users
- zstyle ':completion:*:*:*:users' ignored-patterns \
- adm amanda apache at avahi avahi-autoipd beaglidx bin cacti canna \
- clamav daemon dbus distcache dnsmasq dovecot fax ftp games gdm \
- gkrellmd gopher hacluster haldaemon halt hsqldb ident junkbust kdm \
- ldap lp mail mailman mailnull man messagebus mldonkey mysql nagios \
- named netdump news nfsnobody nobody nscd ntp nut nx obsrun openvpn \
- operator pcap polkitd postfix postgres privoxy pulse pvm quagga radvd \
- rpc rpcuser rpm rtkit scard shutdown squid sshd statd svn sync tftp \
- usbmux uucp vcsa wwwrun xfs '_*'
- zstyle '*' single-ignored show
- # Automatically update PATH entries
- zstyle ':completion:*' rehash true
- # Keep directories and files separated
- zstyle ':completion:*' list-dirs-first true
- # ===================
- # KEY BINDINGS
- # ===================
- # Use emacs-like key bindings by default:
- bindkey -e
- # [Ctrl-r] - Search backward incrementally for a specified string. The string
- # may begin with ^ to anchor the search to the beginning of the line.
- bindkey '^r' history-incremental-search-backward
- if [[ "${terminfo[kpp]}" != "" ]]; then
- bindkey "${terminfo[kpp]}" up-line-or-history # [PageUp] - Up a line of history
- fi
- if [[ "${terminfo[knp]}" != "" ]]; then
- bindkey "${terminfo[knp]}" down-line-or-history # [PageDown] - Down a line of history
- fi
- if [[ "${terminfo[khome]}" != "" ]]; then
- bindkey "${terminfo[khome]}" beginning-of-line # [Home] - Go to beginning of line
- fi
- if [[ "${terminfo[kend]}" != "" ]]; then
- bindkey "${terminfo[kend]}" end-of-line # [End] - Go to end of line
- fi
- if [[ "${terminfo[kcbt]}" != "" ]]; then
- bindkey "${terminfo[kcbt]}" reverse-menu-complete # [Shift-Tab] - move through the completion menu backwards
- fi
- bindkey '^?' backward-delete-char # [Backspace] - delete backward
- if [[ "${terminfo[kdch1]}" != "" ]]; then
- bindkey "${terminfo[kdch1]}" delete-char # [Delete] - delete forward
- else
- bindkey "^[[3~" delete-char
- bindkey "^[3;5~" delete-char
- bindkey "\e[3~" delete-char
- fi
- # ===================
- # MISC SETTINGS
- # ===================
- # automatically remove duplicates from these arrays
- typeset -U path PATH cdpath CDPATH fpath FPATH manpath MANPATH
- # only exit if we're not on the last pane
- exit() {
- if [[ -z $TMUX ]]; then
- builtin exit
- return
- fi
- panes=$(tmux list-panes | wc -l)
- wins=$(tmux list-windows | wc -l)
- count=$(($panes + $wins - 1))
- if [ $count -eq 1 ]; then
- tmux detach
- else
- builtin exit
- fi
- }
- function switchgo() {
- version=$1
- if [ -z $version ]; then
- echo "Usage: switchgo [version]"
- return
- fi
- if ! command -v "go$version" > /dev/null 2>&1; then
- echo "version does not exist, download with: "
- echo " go get golang.org/dl/go${version}"
- echo " go${version} download"
- return
- fi
- go_bin_path=$(command -v "go$version")
- ln -sf "$go_bin_path" "$GOBIN/go"
- echo "Switched to ${go_bin_path}"
- }
- # ===================
- # PLUGINS
- # ===================
- source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
- source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
- # ===================
- # THIRD PARTY
- # ===================
- # brew install jump
- # https://github.com/gsamokovarov/jump
- eval "$(jump shell)"
- # The next line updates PATH for the Google Cloud SDK.
- if [ -f '/Users/fatih/Code/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/fatih/Code/google-cloud-sdk/path.zsh.inc'; fi
- # The next line enables shell command completion for gcloud.
- if [ -f '/Users/fatih/Code/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/fatih/Code/google-cloud-sdk/completion.zsh.inc'; fi
- export PATH="/usr/local/opt/mysql-client/bin:$PATH"
- # Add programs in the bin to the path
- export PATH="/home/dowland/bin:$PATH"
- [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement