config.zsh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. if [ -f ~/.dircolors ]; then
  2. eval $(dircolors ~/.dircolors)
  3. fi
  4. alias ls="ls --color=auto --group-directories-first -F --quoting-style literal"
  5. alias config='git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME'
  6. autoload -U compinit && compinit
  7. zstyle ':completion:*' menu select
  8. zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
  9. zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
  10. REPORTTIME=5
  11. HISTFILE="${HOME}/.zhistory"
  12. HISTSIZE=1000
  13. SAVEHIST=10000
  14. setopt inc_append_history
  15. setopt share_history
  16. setopt extended_history
  17. setopt histignorealldups
  18. setopt histignorespace
  19. setopt autocd
  20. setopt autopushd
  21. setopt longlistjobs
  22. setopt nohup
  23. setopt extended_glob
  24. setopt noglobdots
  25. setopt noshwordsplit
  26. bindkey -e
  27. # https://bbs.archlinux.org/viewtopic.php?id=151738
  28. # ensures terminfo is setup properly
  29. if [[ -n ${terminfo[smkx]} ]] && [[ -n ${terminfo[rmkx]} ]]; then
  30. function zle-line-init () {echoti smkx}
  31. function zle-line-finish () {echoti rmkx}
  32. zle -N zle-line-init
  33. zle -N zle-line-finish
  34. fi
  35. # https://bbs.archlinux.org/viewtopic.php?pid=1170080#p1170080
  36. autoload up-line-or-beginning-search
  37. autoload down-line-or-beginning-search
  38. zle -N up-line-or-beginning-search
  39. zle -N down-line-or-beginning-search
  40. bindkey "${terminfo[kcuu1]}" up-line-or-beginning-search
  41. bindkey "${terminfo[kcud1]}" down-line-or-beginning-search
  42. bindkey "^P" up-line-or-beginning-search
  43. bindkey "^N" down-line-or-beginning-search
  44. autoload -z edit-command-line
  45. zle -N edit-command-line
  46. bindkey "^X^E" edit-command-line
  47. bindkey '^R' zaw-history
  48. bindkey "${terminfo[khome]}" beginning-of-line
  49. bindkey "${terminfo[kend]}" end-of-line
  50. bindkey "${terminfo[kdch1]}" delete-char # Del
  51. bindkey "${terminfo[kpp]}" backward-word # PageUp
  52. bindkey "${terminfo[knp]}" forward-word # PageDown
  53. alias l="k -h"
  54. alias ssh="TERM=xterm-256color ssh"
  55. export EDITOR=vim