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.

148 lines
4.7 KiB

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