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.

147 lines
4.6 KiB

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