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.

116 lines
4.1 KiB

4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
4 years ago
  1. #!/bin/zsh
  2. #zinit installation if it's not there yet
  3. ZINIT_HOME=$XDG_CONFIG_HOME/zsh/.zinit
  4. if [[ ! -f $ZINIT_HOME/bin/zinit.zsh ]]; then
  5. git clone https://github.com/zdharma/zinit $ZINIT_HOME/bin
  6. zcompile $ZINIT_HOME/bin/zinit.zsh
  7. fi
  8. source "$ZINIT_HOME/bin/zinit.zsh"
  9. autoload -Uz zinit
  10. (( ${+_comps} )) && _comps[zinit]=_zinit
  11. #end of installation
  12. # PLUGINS
  13. # usage see https://github.com/zdharma/zinit
  14. zinit light zsh-users/zsh-autosuggestions
  15. ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=7'
  16. zinit light zdharma/fast-syntax-highlighting
  17. zinit light chrissicool/zsh-256color
  18. zinit ice wait"0b" lucid blockf
  19. zinit light zsh-users/zsh-completions
  20. zstyle ':completion:*' menu select # make menu list of matches
  21. zstyle ':completion:::::' completer _expand _complete _ignored _approximate # be easy on typing errors
  22. zstyle ':completion:*:approximate:*' max-errors 2 # limit errors for matches to 2
  23. zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}' # match uppercase from lowercase
  24. zstyle ':completion:*' list-colors "${(@s.:.)LS_COLORS}" # use LS_COLORS for matches
  25. autoload -U compinit && compinit #necessary to make completion work
  26. #zinit snippet https://github.com/git/git/blob/master/contrib/completion/git-completion.zsh
  27. ## completion for kitty
  28. kitty + complete setup zsh | source /dev/stdin
  29. # THEME
  30. zinit light agnoster/agnoster-zsh-theme
  31. DEFAULT_USER=marc #für den Promot wird der user ausgeblendet, wenn default erkannt ist
  32. export EDITOR=nvim
  33. export VISUAL=nvim
  34. setopt PROMPT_SUBST # erlaubt Funktionen im Prompt
  35. setopt no_beep # no bell
  36. # --------------------------------------
  37. # History
  38. # --------------------------------------
  39. HISTFILE=$ZDOTDIR/zhistory
  40. setopt APPEND_HISTORY # append hostory instead of overwriting
  41. HISTSIZE=1200 # notwendig, damit HIST_EXPIRE_DUPS_FIRST funktioniert
  42. SAVEHIST=1000
  43. setopt HIST_EXPIRE_DUPS_FIRST # entfernt erst Duplikate, wenn SAVEHIST überläuft
  44. setopt EXTENDED_HISTORY # speichert Zeitstempel und Dauer
  45. setopt SHARE_HISTORY # share history across terms
  46. # --------------------------------------
  47. # Keybindings
  48. # --------------------------------------
  49. # create a zkbd compatible hash
  50. # to add other keys to this hash, see: man 5 terminfo
  51. typeset -A key
  52. key[Home]="$terminfo[khome]"
  53. key[End]="$terminfo[kend]"
  54. key[Insert]="$terminfo[kich1]"
  55. key[Backspace]="$terminfo[kbs]"
  56. key[Delete]="$terminfo[kdch1]"
  57. key[Up]="$terminfu[kcuu1]"
  58. key[Down]="$terminfo[kcud1]"
  59. key[Left]="$terminfo[kcub1]"
  60. key[Right]="$terminfo[kcuf1]"
  61. key[PageUp]="$terminfo[kpp]"
  62. key[PageDown]="$terminfo[knp]"
  63. key[Control-Left]="$terminfo[kLFT5]}"
  64. key[Control-Right]="$terminfo[kRIT5]}"
  65. # setup key accordingly
  66. [[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
  67. [[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
  68. [[ -n "${key[Insert]}" ]] && bindkey "$key[Insert]}" overwrite-mode
  69. [[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
  70. [[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history
  71. [[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history
  72. [[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
  73. [[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
  74. [[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history
  75. [[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history
  76. [[ -n "${key[Control-Left]}" ]] && bindkey "${key[Control-Left]}" backward-word
  77. [[ -n "${key[Control-Right]}" ]] && bindkey "${key[Control-Right]}" forward-word
  78. bindkey "^R" history-incremental-search-backward
  79. # Finally, make sure the terminal is in application mode, when zle is
  80. # active. Only then are the values from $terminfo valid.
  81. if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
  82. function zle-line-init () {
  83. echoti smkx
  84. }
  85. function zle-line-finish () {
  86. echoti rmkx
  87. }
  88. zle -N zle-line-init
  89. zle -N zle-line-finish
  90. fi