Advertisement
corrosiontears

.zshrc (usuário e root)

Jan 26th, 2015
667
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.45 KB | None | 0 0
  1. ## http://dustri.org/b/my-zsh-configuration.html
  2.  
  3. autoload -U colors zsh-mime-setup select-word-style
  4. colors          # colors
  5. zsh-mime-setup  # run everything as if it's an executable
  6. select-word-style bash # ctrl+w on words
  7.  
  8. ##
  9. # Vcs info
  10. ##
  11. autoload -Uz vcs_info
  12. zstyle ':vcs_info:*' enable git svn hg
  13. zstyle ':vcs_info:*' check-for-changes true
  14. zstyle ':vcs_info:*' formats "%{$fg[yellow]%}%c%{$fg[green]%}%u%{$reset_color%} [%{$fg[cyan]%}%b%{$reset_color%}] %{$fg[yellow]%}%s%{$reset_color%}:%r"
  15. precmd() {  # run before each prompt
  16.   vcs_info
  17. }
  18.  
  19. ##
  20. # Prompt
  21. ##
  22. setopt PROMPT_SUBST     # allow funky stuff in prompt
  23. color="cyan"
  24. if [ "$USER" = "root" ]; then
  25.     color="red"         # root is red, user is blue
  26. fi;
  27. prompt="%{$fg[$color]%}%n%{$reset_color%}@%U%{$fg[yellow]%}%m%{$reset_color%}%u %T %B%~%b "
  28. RPROMPT='${vim_mode} ${vcs_info_msg_0_}'
  29.  
  30. ##
  31. # Key bindings
  32. ##
  33. # Lookup in /etc/termcap or /etc/terminfo else, you can get the right keycode
  34. # by typing ^v and then type the key or key combination you want to use.
  35. # "man zshzle" for the list of available actions
  36. bindkey -e                      # emacs keybindings
  37. bindkey '\e[1;5C' forward-word            # C-Right
  38. bindkey '\e[1;5D' backward-word           # C-Left
  39. bindkey '\e[2~'   overwrite-mode          # Insert
  40. bindkey '\e[3~'   delete-char             # Del
  41. bindkey '\e[5~'   history-search-backward # PgUp
  42. bindkey '\e[6~'   history-search-forward  # PgDn
  43. bindkey '^A'      beginning-of-line       # Home
  44. bindkey '^D'      delete-char             # Del
  45. bindkey '^E'      end-of-line             # End
  46. bindkey '^R'      history-incremental-pattern-search-backward
  47.  
  48. ##
  49. # Completion
  50. ##
  51. autoload -U compinit
  52. compinit
  53. zmodload -i zsh/complist        
  54. setopt hash_list_all            # hash everything before completion
  55. setopt completealiases          # complete alisases
  56. setopt always_to_end            # when completing from the middle of a word, move the cursor to the end of the word    
  57. setopt complete_in_word         # allow completion from within a word/phrase
  58. setopt correct                  # spelling correction for commands
  59. setopt list_ambiguous           # complete as much of a completion until it gets ambiguous.
  60.  
  61. zstyle ':completion::complete:*' use-cache on               # completion caching, use rehash to clear
  62. zstyle ':completion:*' cache-path ~/.zsh/cache              # cache path
  63. zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'   # ignore case
  64. zstyle ':completion:*' menu select=2                        # menu if nb items > 2
  65. zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}       # colorz !
  66. zstyle ':completion:*::::' completer _expand _complete _ignored _approximate # list of completers to use
  67.  
  68. # sections completion !
  69. zstyle ':completion:*' verbose yes
  70. zstyle ':completion:*:messages' format $'\e[00;31m%d'
  71. zstyle ':completion:*' group-name ''
  72. zstyle ':completion:*:manuals' separate-sections true
  73.  
  74. zstyle ':completion:*:processes' command 'ps -au$USER'
  75. zstyle ':completion:*:*:kill:*' menu yes select
  76. zstyle ':completion:*:kill:*' force-list always
  77. zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=29=34"
  78. zstyle ':completion:*:*:killall:*' menu yes select
  79. zstyle ':completion:*:killall:*' force-list always
  80. users=(jvoisin root)           # because I don't care about others
  81. zstyle ':completion:*' users $users
  82.  
  83. #generic completion with --help
  84. compdef _gnu_generic gcc
  85. compdef _gnu_generic gdb
  86.  
  87. ##
  88. # Pushd
  89. ##
  90. setopt auto_pushd               # make cd push old dir in dir stack
  91. setopt pushd_ignore_dups        # no duplicates in dir stack
  92. setopt pushd_silent             # no dir stack after pushd or popd
  93. setopt pushd_to_home            # `pushd` = `pushd $HOME`
  94. #
  95. ##
  96. # History
  97. ##
  98. HISTFILE=~/.zsh_history         # where to store zsh config
  99. HISTSIZE=1024                   # big history
  100. SAVEHIST=1024                   # big history
  101. setopt append_history           # append
  102. setopt hist_ignore_all_dups     # no duplicate
  103. unsetopt hist_ignore_space      # ignore space prefixed commands
  104. setopt hist_reduce_blanks       # trim blanks
  105. setopt hist_verify              # show before executing history commands
  106. setopt inc_append_history       # add commands as they are typed, don't wait until shell exit
  107. setopt share_history            # share hist between sessions
  108. setopt bang_hist                # !keyword
  109.  
  110. ##
  111. # Various
  112. ##
  113. setopt auto_cd                  # if command is a path, cd into it
  114. setopt auto_remove_slash        # self explicit
  115. setopt chase_links              # resolve symlinks
  116. setopt correct                  # try to correct spelling of commands
  117. setopt extended_glob            # activate complex pattern globbing
  118. setopt glob_dots                # include dotfiles in globbing
  119. setopt print_exit_value         # print return value if non-zero
  120. unsetopt beep                   # no bell on error
  121. unsetopt bg_nice                # no lower prio for background jobs
  122. unsetopt clobber                # must use >| to truncate existing files
  123. unsetopt hist_beep              # no bell on error in history
  124. unsetopt hup                    # no hup signal at shell exit
  125. unsetopt ignore_eof             # do not exit on end-of-file
  126. unsetopt list_beep              # no bell on ambiguous completion
  127. unsetopt rm_star_silent         # ask for confirmation for `rm *' or `rm path/*'
  128. setxkbmap -option compose:ralt  # compose-key
  129. print -Pn "\e]0; %n@%M: %~\a"   # terminal title
  130.  
  131. source ~/.alias                 # aliases
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement