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.

135 lines
4.2 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. eval "$(direnv hook zsh)" >> /tmp/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. HISTFILE="$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. [ -f "$XDG_CONFIG_HOME"/zsh/fzf.zsh ] && source "$XDG_CONFIG_HOME"/zsh/fzf.zsh
  31. export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=241,bold'
  32. export KEYTIMEOUT=5
  33. function x11-clip-wrap-widgets() {
  34. local copy_or_paste=$1
  35. shift
  36. for widget in $@; do
  37. if [[ $copy_or_paste == "copy" ]]; then
  38. eval "
  39. function _x11-clip-wrapped-$widget() {
  40. zle .$widget
  41. xclip -in -selection clipboard <<<\$CUTBUFFER
  42. }
  43. "
  44. else
  45. eval "
  46. function _x11-clip-wrapped-$widget() {
  47. CUTBUFFER=\$(xclip -out -selection clipboard)
  48. zle .$widget
  49. }
  50. "
  51. fi
  52. zle -N $widget _x11-clip-wrapped-$widget
  53. done
  54. }
  55. # Del, End & Home keys
  56. bindkey "^[[1;5C" forward-word
  57. bindkey "^[[1;5D" backward-word
  58. bindkey "^A" vi-beginning-of-line
  59. # Better completion
  60. zstyle ':completion:*' matcher-list '' \
  61. 'm:{a-z\-}={A-Z\_}' \
  62. 'r:[^[:alpha:]]||[[:alpha:]]=** r:|=* m:{a-z\-}={A-Z\_}' \
  63. 'r:|?=** m:{a-z\-}={A-Z\_}'
  64. local copy_widgets=(
  65. vi-yank vi-yank-eol vi-delete vi-backward-kill-word vi-change-whole-line
  66. )
  67. local paste_widgets=(
  68. vi-put-{before,after}
  69. )
  70. # Use X11 Clipboard
  71. x11-clip-wrap-widgets copy $copy_widgets
  72. x11-clip-wrap-widgets paste $paste_widgets
  73. # create a zkbd compatible hash;
  74. # to add other keys to this hash, see: man 5 terminfo
  75. typeset -g -A key
  76. key[Home]="${terminfo[khome]}"
  77. key[End]="${terminfo[kend]}"
  78. key[Insert]="${terminfo[kich1]}"
  79. key[Backspace]="${terminfo[kbs]}"
  80. key[Delete]="${terminfo[kdch1]}"
  81. key[Up]="${terminfo[kcuu1]}"
  82. key[Down]="${terminfo[kcud1]}"
  83. key[Left]="${terminfo[kcub1]}"
  84. key[Right]="${terminfo[kcuf1]}"
  85. key[PageUp]="${terminfo[kpp]}"
  86. key[PageDown]="${terminfo[knp]}"
  87. key[Shift-Tab]="${terminfo[kcbt]}"
  88. # setup key accordingly
  89. [[ -n "${key[Home]}" ]] && bindkey -- "${key[Home]}" beginning-of-line
  90. [[ -n "${key[End]}" ]] && bindkey -- "${key[End]}" end-of-line
  91. [[ -n "${key[Insert]}" ]] && bindkey -- "${key[Insert]}" overwrite-mode
  92. [[ -n "${key[Backspace]}" ]] && bindkey -- "${key[Backspace]}" backward-delete-char
  93. [[ -n "${key[Delete]}" ]] && bindkey -- "${key[Delete]}" delete-char
  94. [[ -n "${key[Up]}" ]] && bindkey -- "${key[Up]}" up-line-or-history
  95. [[ -n "${key[Down]}" ]] && bindkey -- "${key[Down]}" down-line-or-history
  96. [[ -n "${key[Left]}" ]] && bindkey -- "${key[Left]}" backward-char
  97. [[ -n "${key[Right]}" ]] && bindkey -- "${key[Right]}" forward-char
  98. [[ -n "${key[PageUp]}" ]] && bindkey -- "${key[PageUp]}" beginning-of-buffer-or-history
  99. [[ -n "${key[PageDown]}" ]] && bindkey -- "${key[PageDown]}" end-of-buffer-or-history
  100. [[ -n "${key[Shift-Tab]}" ]] && bindkey -- "${key[Shift-Tab]}" reverse-menu-complete
  101. # Finally, make sure the terminal is in application mode, when zle is
  102. # active. Only then are the values from $terminfo valid.
  103. if (( ${+terminfo[smkx]} && ${+terminfo[rmkx]} )); then
  104. autoload -Uz add-zle-hook-widget
  105. function zle_application_mode_start { echoti smkx }
  106. function zle_application_mode_stop { echoti rmkx }
  107. add-zle-hook-widget -Uz zle-line-init zle_application_mode_start
  108. add-zle-hook-widget -Uz zle-line-finish zle_application_mode_stop
  109. fi