1
0

config.zsh 2.3 KB

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