config.zsh 1.9 KB

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