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.

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