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