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.

113 lines
3.8 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 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. # setup key accordingly
  64. [[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
  65. [[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
  66. [[ -n "${key[Insert]}" ]] && bindkey "$key[Insert]}" overwrite-mode
  67. [[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
  68. [[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history
  69. [[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history
  70. [[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
  71. [[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
  72. [[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history
  73. [[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history
  74. bindkey "^R" history-incremental-search-backward
  75. # Finally, make sure the terminal is in application mode, when zle is
  76. # active. Only then are the values from $erminfo valid.
  77. if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
  78. function zle-line-init () {
  79. echoti smkx
  80. }
  81. function zle-line-finish () {
  82. echoti rmkx
  83. }
  84. zle -N zle-line-init
  85. zle -N zle-line-finish
  86. fi