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.

119 lines
4.3 KiB

4 years ago
5 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. setopt HIST_FIND_NO_DUPS # ignores duplicates in history when ctrl+r
  48. # setopt HIST_IGNORE_ALL_DUPS # dont write dups in history
  49. # --------------------------------------
  50. # Keybindings
  51. # --------------------------------------
  52. # create a zkbd compatible hash
  53. # to add other keys to this hash, see: man 5 terminfo
  54. typeset -A key
  55. key[Home]="$terminfo[khome]"
  56. key[End]="$terminfo[kend]"
  57. key[Insert]="$terminfo[kich1]"
  58. key[Backspace]="$terminfo[kbs]"
  59. key[Delete]="$terminfo[kdch1]"
  60. key[Up]="$terminfu[kcuu1]"
  61. key[Down]="$terminfo[kcud1]"
  62. key[Left]="$terminfo[kcub1]"
  63. key[Right]="$terminfo[kcuf1]"
  64. key[PageUp]="$terminfo[kpp]"
  65. key[PageDown]="$terminfo[knp]"
  66. key[Control-Left]="$terminfo[kLFT5]}"
  67. key[Control-Right]="$terminfo[kRIT5]}"
  68. # setup key accordingly
  69. [[ -n "${key[Home]}" ]] && bindkey "${key[Home]}" beginning-of-line
  70. [[ -n "${key[End]}" ]] && bindkey "${key[End]}" end-of-line
  71. [[ -n "${key[Insert]}" ]] && bindkey "$key[Insert]}" overwrite-mode
  72. [[ -n "${key[Delete]}" ]] && bindkey "${key[Delete]}" delete-char
  73. [[ -n "${key[Up]}" ]] && bindkey "${key[Up]}" up-line-or-history
  74. [[ -n "${key[Down]}" ]] && bindkey "${key[Down]}" down-line-or-history
  75. [[ -n "${key[Left]}" ]] && bindkey "${key[Left]}" backward-char
  76. [[ -n "${key[Right]}" ]] && bindkey "${key[Right]}" forward-char
  77. [[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" beginning-of-buffer-or-history
  78. [[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" end-of-buffer-or-history
  79. [[ -n "${key[Control-Left]}" ]] && bindkey "${key[Control-Left]}" backward-word
  80. [[ -n "${key[Control-Right]}" ]] && bindkey "${key[Control-Right]}" forward-word
  81. bindkey "^R" history-incremental-search-backward
  82. # Finally, make sure the terminal is in application mode, when zle is
  83. # active. Only then are the values from $terminfo valid.
  84. if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
  85. function zle-line-init () {
  86. echoti smkx
  87. }
  88. function zle-line-finish () {
  89. echoti rmkx
  90. }
  91. zle -N zle-line-init
  92. zle -N zle-line-finish
  93. fi