zshrc 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. # /etc/zsh/zshrc is sourced in interactive shells. It
  2. # should contain commands to set up aliases, functions,
  3. # options, key bindings, etc.
  4. # Colors
  5. test -f /etc/DIR_COLORS && eval `dircolors /etc/DIR_COLORS`
  6. autoload -U colors
  7. colors
  8. # Default prompt
  9. if [[ "$USER" == root ]]; then
  10. PROMPT="%{$bold_color$fg[red]%}%m %{$bold_color$fg[blue]%}%1~ %# %{$reset_color%}"
  11. else
  12. PROMPT="%{$bold_color%}%n@%m %{$reset_color$fg[red]%}%1~ %# %{$reset_color%}"
  13. fi
  14. # Auto completion
  15. autoload -U compinit
  16. compinit
  17. # An accept-line wrapper, see http://bewatermyfriend.org/posts/2007/12-26.11-50-38-tooltime.html
  18. autoload -U accept-line
  19. accept-line
  20. # History
  21. export HISTFILE=~/.zsh_history
  22. export HISTSIZE=50000
  23. export SAVEHIST=50000
  24. export HISTCONTROL=ignoredups
  25. setopt SHARE_HISTORY
  26. setopt EXTENDED_HISTORY
  27. setopt EXTENDED_GLOB
  28. # Aliases
  29. alias dir='ls --color=auto'
  30. alias grep='grep --color=auto'
  31. alias la='ls --color=auto -la'
  32. alias ll='ls --color=auto -l'
  33. alias ls='ls --color=auto'
  34. alias mc='. /usr/share/mc/bin/mc-wrapper.sh'
  35. alias rm='rm -i'
  36. alias scp-resume='rsync --compress-level=3 --partial --progress --rsh=ssh'
  37. # Key bindings
  38. bindkey -e # emacs key bindings
  39. bindkey ' ' magic-space # also do history expansion on space
  40. bindkey "\e[3~" delete-char
  41. bindkey "\e[1~" beginning-of-line
  42. bindkey "\e[4~" end-of-line
  43. bindkey "\e[H" beginning-of-line
  44. bindkey "\e[F" end-of-line
  45. bindkey "\e[7~" beginning-of-line
  46. bindkey "\e[8~" end-of-line
  47. bindkey "^[[5~" up-line-or-history
  48. bindkey "^[[6~" down-line-or-history
  49. # Editor
  50. export VISUAL="nano"
  51. # Other options
  52. setopt NO_BEEP
  53. setopt CORRECT_ALL
  54. setopt AUTO_LIST
  55. setopt AUTO_PUSHD
  56. setopt PUSHD_IGNORE_DUPS
  57. setopt PUSHD_SILENT
  58. setopt INTERACTIVE_COMMENTS
  59. setopt NONOMATCH
  60. setopt NOPROMPT_SP
  61. zstyle ':completion:*' use-cache on
  62. zstyle ':completion:*' cache-path ~/.zsh_cache
  63. zstyle ':acceptline:*' rehash true
  64. case $TERM in
  65. xterm*)
  66. precmd () {print -Pn "\e]0;%n@%m: %~\a"}
  67. ;;
  68. esac
  69. if [ -f /etc/zsh/zsh_command_not_found ] && [ -x /usr/bin/command-not-found ]; then
  70. . /etc/zsh/zsh_command_not_found
  71. fi