Another copy of my dotfiles. Because I don't completely trust GitHub.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

136 lines
4.2 KiB

  1. eval "$(direnv hook zsh)" >> $XDG_RUNTIME_DIR/direnv
  2. paleofetch
  3. if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  4. source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
  5. fi
  6. source ~/.profile
  7. # Created by kuro for 5.8
  8. source <(antibody init)
  9. #Autocompletion
  10. autoload -Uz compinit
  11. compinit
  12. compinit -d $XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION
  13. [[ ! -d "$XDG_DATA_HOME"/zsh/history ]] || source "$XDG_DATA_HOME"/zsh/history
  14. HISTSIZE=100000
  15. SAVEHIST=100000
  16. setopt appendhistory
  17. antibody bundle < ~/.config/antibody/zsh_plugins.txt
  18. [[ ! -f ~/.config/antibody/p10k.zsh ]] || source ~/.config/antibody/p10k.zsh
  19. fpath=("$XDG_CONFIG_HOME"/zsh/completions $fpath)
  20. autoload -Uz compinit
  21. compinit
  22. source "$XDG_CONFIG_HOME"/zsh/aliases
  23. if [ -f "$XDG_CONFIG_HOME"/zsh/local_aliases ]; then
  24. source "$XDG_CONFIG_HOME"/zsh/local_aliases
  25. fi
  26. if [ -f "$XDG_CONFIG_HOME"/zsh/secret ]; then
  27. source "$XDG_CONFIG_HOME"/zsh/secret
  28. fi
  29. source "$XDG_CONFIG_HOME"/zsh/cmds
  30. source "/usr/share/fzf/completion.zsh" 2> /dev/null
  31. source "/usr/share/fzf/key-bindings.zsh"
  32. export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=241,bold'
  33. export KEYTIMEOUT=5
  34. function x11-clip-wrap-widgets() {
  35. local copy_or_paste=$1
  36. shift
  37. for widget in $@; do
  38. if [[ $copy_or_paste == "copy" ]]; then
  39. eval "
  40. function _x11-clip-wrapped-$widget() {
  41. zle .$widget
  42. xclip -in -selection clipboard <<<\$CUTBUFFER
  43. }
  44. "
  45. else
  46. eval "
  47. function _x11-clip-wrapped-$widget() {
  48. CUTBUFFER=\$(xclip -out -selection clipboard)
  49. zle .$widget
  50. }
  51. "
  52. fi
  53. zle -N $widget _x11-clip-wrapped-$widget
  54. done
  55. }
  56. # Del, End & Home keys
  57. bindkey "^[[1;5C" forward-word
  58. bindkey "^[[1;5D" backward-word
  59. bindkey "^A" vi-beginning-of-line
  60. # Better completion
  61. zstyle ':completion:*' matcher-list '' \
  62. 'm:{a-z\-}={A-Z\_}' \
  63. 'r:[^[:alpha:]]||[[:alpha:]]=** r:|=* m:{a-z\-}={A-Z\_}' \
  64. 'r:|?=** m:{a-z\-}={A-Z\_}'
  65. local copy_widgets=(
  66. vi-yank vi-yank-eol vi-delete vi-backward-kill-word vi-change-whole-line
  67. )
  68. local paste_widgets=(
  69. vi-put-{before,after}
  70. )
  71. # Use X11 Clipboard
  72. x11-clip-wrap-widgets copy $copy_widgets
  73. x11-clip-wrap-widgets paste $paste_widgets
  74. # create a zkbd compatible hash;
  75. # to add other keys to this hash, see: man 5 terminfo
  76. typeset -g -A key
  77. key[Home]="${terminfo[khome]}"
  78. key[End]="${terminfo[kend]}"
  79. key[Insert]="${terminfo[kich1]}"
  80. key[Backspace]="${terminfo[kbs]}"
  81. key[Delete]="${terminfo[kdch1]}"
  82. key[Up]="${terminfo[kcuu1]}"
  83. key[Down]="${terminfo[kcud1]}"
  84. key[Left]="${terminfo[kcub1]}"
  85. key[Right]="${terminfo[kcuf1]}"
  86. key[PageUp]="${terminfo[kpp]}"
  87. key[PageDown]="${terminfo[knp]}"
  88. key[Shift-Tab]="${terminfo[kcbt]}"
  89. # setup key accordingly
  90. [[ -n "${key[Home]}" ]] && bindkey -- "${key[Home]}" beginning-of-line
  91. [[ -n "${key[End]}" ]] && bindkey -- "${key[End]}" end-of-line
  92. [[ -n "${key[Insert]}" ]] && bindkey -- "${key[Insert]}" overwrite-mode
  93. [[ -n "${key[Backspace]}" ]] && bindkey -- "${key[Backspace]}" backward-delete-char
  94. [[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char
  95. [[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-history
  96. [[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-history
  97. [[ -n "${key[Left]}" ]] && bindkey -- "${key[Left]}" backward-char
  98. [[ -n "${key[Right]}" ]] && bindkey -- "${key[Right]}" forward-char
  99. [[ -n "${key[PageUp]}" ]] && bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history
  100. [[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history
  101. [[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete
  102. # Finally, make sure the terminal is in application mode, when zle is
  103. # active. Only then are the values from $terminfo valid.
  104. if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
  105. autoload -Uz add-zle-hook-widget
  106. function zle_application_mode_start { echoti smkx }
  107. function zle_application_mode_stop { echoti rmkx }
  108. add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
  109. add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
  110. fi