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.

117 lines
3.8 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. # Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.config/zsh/.zshrc.
  2. # Initialization code that may require console input (password prompts, [y/n]
  3. # confirmations, etc.) must go above this block; everything else may go below.
  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. #!/bin/zsh
  8. DEFAULT_USER=marc #für den Promot wird der user ausgeblendet, wenn default erkannt ist
  9. # --------------------------------------
  10. # Environment
  11. # --------------------------------------
  12. export EDITOR=nvim
  13. export VISUAL=nvim
  14. # --------------------------------------
  15. # Prompt
  16. # --------------------------------------
  17. setopt PROMPT_SUBST # erlaubt Funktionen im Prompt
  18. # --------------------------------------
  19. # History
  20. # --------------------------------------
  21. HISTFILE=$ZDOTDIR/zhistory
  22. setopt APPEND_HISTORY # append hostory instead of overwriting
  23. HISTSIZE=1200 # notwendig, damit HIST_EXPIRE_DUPS_FIRST funktioniert
  24. SAVEHIST=1000
  25. setopt HIST_EXPIRE_DUPS_FIRST # entfernt erst Duplikate, wenn SAVEHIST überläuft
  26. setopt EXTENDED_HISTORY # speichert Zeitstempel und Dauer
  27. setopt SHARE_HISTORY # share history across terms
  28. # --------------------------------------
  29. # Keybindings
  30. # --------------------------------------
  31. # create a zkbd compatible hash
  32. # to add other keys to this hash, see: man 5 terminfo
  33. typeset -A key
  34. key[Home]="$terminfo[khome]"
  35. key[End]="$terminfo[kend]"
  36. key[Insert]="$terminfo[kich1]"
  37. key[Backspace]="$terminfo[kbs]"
  38. key[Delete]="$terminfo[kdch1]"
  39. key[Up]="$terminfu[kcuu1]"
  40. key[Down]="$terminfo[kcud1]"
  41. key[Left]="$terminfo[kcub1]"
  42. key[Right]="$terminfo[kcuf1]"
  43. key[PageUp]="$terminfo[kpp]"
  44. key[PageDown]="$terminfo[knp]"
  45. # setup key accordingly
  46. [[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
  47. [[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
  48. [[ -n "${key[Insert]}" ]] && bindkey "$key[Insert]}" overwrite-mode
  49. [[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
  50. [[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history
  51. [[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history
  52. [[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
  53. [[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
  54. [[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history
  55. [[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history
  56. bindkey "^R" history-incremental-search-backward
  57. # Finally, make sure the terminal is in application mode, when zle is
  58. # active. Only then are the values from $erminfo valid.
  59. if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
  60. function zle-line-init () {
  61. echoti smkx
  62. }
  63. function zle-line-finish () {
  64. echoti rmkx
  65. }
  66. zle -N zle-line-init
  67. zle -N zle-line-finish
  68. fi
  69. # --------------------------------------
  70. # Completion
  71. # add completion dir to fpath
  72. fpath=($ZDOTDIR/completion $fpath)
  73. autoload -Uz compinit
  74. compinit
  75. # completion for kitty
  76. kitty + complete setup zsh | source /dev/stdin
  77. # --------------------------------------
  78. # Plugins
  79. # --------------------------------------
  80. PLUGINS=$ZDOTDIR/plugins/
  81. for plugin in $PLUGINS*.zsh
  82. do
  83. source $plugin
  84. done
  85. source $PLUGINS/zsh-autosuggestions/zsh-autosuggestions.zsh
  86. source $PLUGINS/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
  87. # --------------------------------------
  88. # Themes
  89. # --------------------------------------
  90. source $ZDOTDIR/themes/agnoster.zsh-theme
  91. #source $ZDOTDIR/themes/powerlevel10k/powerlevel10k.zsh-theme
  92. # To customize prompt, run `p10k configure` or edit ~/.config/zsh/.p10k.zsh.
  93. #[[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh