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.

156 lines
4.8 KiB

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