1
0

zshrc 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. eval "$(dircolors -b ~/.dircolors)"
  2. autoload -Uz compinit
  3. compinit
  4. zmodload -a complist
  5. zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
  6. zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
  7. zstyle ':completion:*' use-compctl false
  8. zstyle ':completion:*' use-cache on
  9. zstyle ':completion:*' cache-path ~/.zshcache
  10. __git_files () {
  11. _wanted files expl 'local files' _files
  12. }
  13. zstyle :compinstall filename "$HOME/.zshrc"
  14. HISTFILE=~/.histfile
  15. HISTSIZE=10000
  16. SAVEHIST=10000
  17. setopt no_beep
  18. setopt extendedglob
  19. #setopt print_exit_value
  20. setopt prompt_subst
  21. setopt complete_in_word
  22. setopt no_auto_menu
  23. setopt no_always_last_prompt
  24. setopt share_history
  25. setopt hist_ignore_all_dups
  26. setopt hist_ignore_space
  27. setopt extended_history
  28. setopt promptsubst
  29. setopt autopushd
  30. setopt pushdignoredups
  31. setopt nomatch
  32. autoload -U edit-command-line
  33. zle -N edit-command-line
  34. bindkey -e
  35. bindkey '^[[3~' delete-char
  36. bindkey '^[[1;5C' forward-word
  37. bindkey '^[[1;5D' backward-word
  38. bindkey '\C-v' edit-command-line
  39. bindkey '\Ea' push-line
  40. local WORDCHARS=${WORDCHARS//\//}\| # remove forward slash, add pipe
  41. autoload colors
  42. colors
  43. bright_cyan='%{%}' # not provided by colors
  44. autoload -Uz vcs_info
  45. zstyle ':vcs_info:*' unstagedstr "%{$fg[red]%}*"
  46. zstyle ':vcs_info:*' stagedstr "%{$fg[red]%}+"
  47. zstyle ':vcs_info:*' formats "$bright_cyan%b%u%c"
  48. zstyle ':vcs_info:*' actionformats "$bright_cyan%b%u%c|%a"
  49. zstyle ':vcs_info:git:*' check-for-changes true
  50. zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b:%r'
  51. zstyle ':vcs_info:bzr:*' use-simple true
  52. zstyle ':vcs_info:*' enable git hg bzr svn cvs
  53. zstyle ':vcs_info:*' disable-patterns '/google/src/cloud/*|/prodfs/raylu/*'
  54. precmd () { vcs_info }
  55. PROMPT="%{$fg_bold[grey]%}%* " # time
  56. #PROMPT+='$(__hi_prompt_large)'
  57. PROMPT+="%{${fg_bold[green]}%}%m%{${reset_color}%}:" # host
  58. PROMPT+="%{${fg_bold[blue]}%}%50<...<%~%<<%{${reset_color}%} " # path
  59. PROMPT+='${vcs_info_msg_0_} '
  60. PROMPT+="%(?..%{$fg_bold[red]%}%? %{$reset_color%})" # exit status
  61. PROMPT+="%1(j.%{$fg[green]%}%j .)" # suspended jobs
  62. PROMPT+=$'%{$reset_color%} \n%(!.#.\$) '
  63. autoload -U url-quote-magic
  64. zle -N self-insert url-quote-magic
  65. source $HOME/.zsh_paste
  66. export EDITOR=vi
  67. export MANPAGER="/bin/sh -c \"col -bx | vim -c 'set ft=man' -\""
  68. export GREP_COLORS='ms=01;36:mc=01;31:sl=:cx=:fn=35:ln=33:bn=33:se=01;34'
  69. alias ls='ls --color=auto -hv --group-directories-first'
  70. alias ll='ls -l'
  71. alias l.='ls -Ad .*'
  72. alias la='ls -A'
  73. alias llr='lr -1AGl -ov'
  74. alias grep='grep --color -s'
  75. alias df='df -hx tmpfs'
  76. alias du='du --max-depth=1'
  77. alias sr='screen -r'
  78. alias gip='git pull --ff-only'
  79. alias gil='git log --graph --abbrev-commit --stat --summary -C --decorate --date=local'
  80. alias gib='git branch -a'
  81. alias gis='git status'
  82. alias gid='git diff -C --date=local'
  83. alias giw='git show -C --date=local --decorate'
  84. alias gic='git checkout'
  85. alias giu='git reset HEAD\^'
  86. alias gn='git number'
  87. alias hgw='hg diff --change .'
  88. alias class='xprop -notype WM_CLASS'
  89. alias tree='tree -AvL 10'
  90. alias vi='vi -p'
  91. alias vil='vi *(.om[1])'
  92. alias dt='gnome-terminal --hide-menubar'
  93. alias sudovi="sudo vi -N -u $HOME/.vimrc"
  94. alias shrug="echo -n '¯\\(°_o)/¯' | xclip -selection clipboard"
  95. alias fd='fdfind'
  96. alias hg='chg'
  97. function https() {
  98. openssl s_client -connect $1:443 -servername $1 < /dev/null | \
  99. openssl x509 -noout -text -certopt no_header,no_version,no_serial,no_signame,no_pubkey,no_sigdump
  100. }
  101. function cl() {
  102. if [ $# = 0 ]; then
  103. cd && ls
  104. else
  105. cd "$*" && ls
  106. fi
  107. }
  108. function pdf() {
  109. atril "$*" &> /dev/null &!
  110. }
  111. function revdeps() {
  112. stubby call blade:blaze-skygraph-depserver-qa-no-sla \
  113. DependencyService.Query \
  114. "target: \"$1\"
  115. direct: true
  116. forward: false"
  117. }
  118. export GOPATH=$HOME/go
  119. export PYTHONSTARTUP=$HOME/.pystartup.py
  120. export VIRTUAL_ENV="/home/raylu/venv"
  121. #NPM_PACKAGES="$HOME/npm-packages"
  122. #export NODE_PATH="$NPM_PACKAGES/lib/node_modules:$NODE_PATH"
  123. PATH=$VIRTUAL_ENV/bin:$NPM_PACKAGES/bin:$PATH
  124. if [ -d $HOME/bin ]; then
  125. PATH=$HOME/bin:$PATH
  126. fi
  127. if [ -e /usr/share/doc/fzf/examples/key-bindings.zsh ]; then
  128. source /usr/share/doc/fzf/examples/key-bindings.zsh
  129. fi
  130. if [ -e /etc/bash_completion.d/g4d ]; then
  131. source /etc/bash_completion.d/g4d
  132. fi
  133. if [ -e /etc/bash_completion.d/hgd ]; then
  134. source /etc/bash_completion.d/hgd
  135. fi
  136. if [ -e /etc/bash.bashrc.d/shell_history_forwarder.sh ]; then
  137. source /etc/bash.bashrc.d/shell_history_forwarder.sh
  138. fi
  139. stty stop undef