My personal dotfiles
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. ##
  2. ## S E T T I N G S
  3. ##
  4. # Vi mode
  5. bindkey -v
  6. # Enable colors
  7. autoload -U colors && colors
  8. # enable colored output from ls, etc. on FreeBSD-based systems
  9. export CLICOLOR=1
  10. # awesome cd movements from zshkit
  11. setopt autocd autopushd pushdminus pushdsilent pushdtohome cdablevars
  12. DIRSTACKSIZE=5
  13. # Enable extended globbing
  14. setopt extendedglob
  15. # Allow [ or ] whereever you want
  16. unsetopt nomatch
  17. # Setup zsh path
  18. fpath=(
  19. ~/.zsh/completion/
  20. ~/.zsh/prompt/
  21. $fpath)
  22. autoload -Uz compinit
  23. compinit
  24. # Set emacs as default editor
  25. export EDITOR='emacs -nw'
  26. export VISUAL='emacs -nw'
  27. ## History
  28. HISTFILE=$HOME/.zhistory # enable history saving on shell exit
  29. setopt APPEND_HISTORY # append rather than overwrite history file.
  30. HISTSIZE=1200 # lines of history to maintain memory
  31. SAVEHIST=1000 # lines of history to maintain in history file.
  32. setopt HIST_EXPIRE_DUPS_FIRST # allow dups, but expire old ones when I hit HISTSIZE
  33. setopt EXTENDED_HISTORY # save timestamp and runtime information
  34. # Adds case insensitivity
  35. zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
  36. # Color completion folders
  37. zstyle -e ':completion:*:default' list-colors 'reply=("${PREFIX:+=(#bi)($PREFIX:t)(?)*==34=34}:${(s.:.)LS_COLORS}")';
  38. # Kill colors
  39. zstyle ':completion:*:*:kill:*' list-colors '=(#b) #([0-9]#)*( *[a-z])*=34=31=33'
  40. # Option colors
  41. zstyle ':completion:*:options' list-colors '=^(-- *)=34'
  42. # Highlights current option
  43. zstyle ':completion:*' menu select
  44. # Colorify man
  45. function man() {
  46. env \
  47. LESS_TERMCAP_mb=$(printf "\e[1;31m") \
  48. LESS_TERMCAP_md=$(printf "\e[1;31m") \
  49. LESS_TERMCAP_me=$(printf "\e[0m") \
  50. LESS_TERMCAP_se=$(printf "\e[0m") \
  51. LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
  52. LESS_TERMCAP_ue=$(printf "\e[0m") \
  53. LESS_TERMCAP_us=$(printf "\e[1;32m") \
  54. man "$@"
  55. }
  56. ##
  57. ## T W E A K S
  58. ##
  59. fancy-ctrl-z () {
  60. if [[ $#BUFFER -eq 0 ]]; then
  61. BUFFER="fg"
  62. zle accept-line
  63. else
  64. zle push-input
  65. zle clear-screen
  66. fi
  67. }
  68. zle -N fancy-ctrl-z
  69. bindkey '^Z' fancy-ctrl-z
  70. ##
  71. ## K E Y B I N D I N G S
  72. ##
  73. bindkey '^P' up-history
  74. bindkey '^N' down-history
  75. # backspace and ^h working even after
  76. # returning from command mode
  77. bindkey '^?' backward-delete-char
  78. bindkey '^h' backward-delete-char
  79. # ctrl-w removed word backwards
  80. bindkey '^w' backward-kill-word
  81. backward-kill-dir () {
  82. local WORDCHARS=${WORDCHARS/\/}
  83. zle backward-kill-word
  84. }
  85. zle -N backward-kill-dir
  86. bindkey '^[^?' backward-kill-dir
  87. # ctrl-r starts searching history backward
  88. bindkey '^r' history-incremental-search-backward
  89. # VI MODE KEYBINDINGS (ins mode)
  90. bindkey -M viins '^a' beginning-of-line
  91. bindkey -M viins '^e' end-of-line
  92. bindkey -M viins '^k' kill-line
  93. bindkey -M viins '^w' backward-kill-word
  94. bindkey -M viins '^u' backward-kill-line
  95. ##
  96. ## A L I A S E S
  97. ##
  98. # Misc
  99. alias :q='exit'
  100. alias less='less -R'
  101. alias grep='grep --color=always'
  102. # List directory contents
  103. alias lsa='ls -lah --color'
  104. alias l='ls --color'
  105. alias ll='ls -lh --color'
  106. alias la='ls -A --color'
  107. alias ls='ls --color'
  108. # Push and pop directories on directory stack
  109. alias md='mkdir -p'
  110. alias rd=rmdir
  111. alias d='dirs -v | head -10'
  112. alias -g ...='../..'
  113. alias -g ....='../../..'
  114. alias -g .....='../../../..'
  115. alias -g ......='../../../../..'
  116. # Emacs clients
  117. alias e='emacs -nw'
  118. alias et='emacsclient -t'
  119. alias ec='emacsclient -c'
  120. ##
  121. ## P R O M P T
  122. ##
  123. PROMPT_STATUS="\`$SMILE\`"
  124. _newline=$'\n'
  125. _lineup=$'\e[1A'
  126. _linedown=$'\e[1B'
  127. # * There are uncommitted changes.
  128. # ? There are files git doesn't know about.
  129. # ➚ There are commits that haven't been pushed yet.
  130. # ☰ There are stashed files.
  131. # ⌥ There are branches other than master.
  132. # ® There are remote repositories other than origin configured.
  133. source ~/.zsh/git-prompt.zsh
  134. function preexec() {
  135. echo
  136. }
  137. function precmd() {
  138. echo
  139. PSVAR=`git_prompt_precmd`
  140. }
  141. PROMPT="%F{red}%n%F{white}@%F{green}%m %F{blue}%~ ${_newline}%F{white}$ "
  142. RPROMPT='%{${_lineup}%}%F{red}%(?..%? )%F{yellow}%v%F{white}`jobs %% 2> /dev/null | cut -d " " -f6` [`date +%H:%M:%S`]%{${_linedown}%}'
  143. setopt promptsubst
  144. # Delay of 0.1 seconds
  145. export KEYTIMEOUT=1
  146. source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh