config.zsh 2.2 KB

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