Config File Collection
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.

.zshrc 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. # ~/.zshrc file for zsh interactive shells.
  2. # see /usr/share/doc/zsh/examples/zshrc for examples
  3. # You should install some packages:
  4. # sudo apt install zsh zsh-syntax-highlighting zsh-autosuggestions qterminal fonts-firacode
  5. #
  6. setopt autocd # change directory just by typing its name
  7. #setopt correct # auto correct mistakes
  8. setopt interactivecomments # allow comments in interactive mode
  9. setopt magicequalsubst # enable filename expansion for arguments of the form ‘anything=expression’
  10. setopt nonomatch # hide error message if there is no match for the pattern
  11. setopt notify # report the status of background jobs immediately
  12. setopt numericglobsort # sort filenames numerically when it makes sense
  13. setopt promptsubst # enable command substitution in prompt
  14. WORDCHARS=${WORDCHARS//\/} # Don't consider certain characters part of the word
  15. # hide EOL sign ('%')
  16. PROMPT_EOL_MARK=""
  17. # configure key keybindings
  18. bindkey -e # emacs key bindings
  19. bindkey ' ' magic-space # do history expansion on space
  20. bindkey '^U' backward-kill-line # ctrl + U
  21. bindkey '^[[3;5~' kill-word # ctrl + Supr
  22. bindkey '^[[3~' delete-char # delete
  23. bindkey '^[[1;5C' forward-word # ctrl + ->
  24. bindkey '^[[1;5D' backward-word # ctrl + <-
  25. bindkey '^[[5~' beginning-of-buffer-or-history # page up
  26. bindkey '^[[6~' end-of-buffer-or-history # page down
  27. bindkey '^[[H' beginning-of-line # home
  28. bindkey '^[[F' end-of-line # end
  29. bindkey '^[[Z' undo # shift + tab undo last action
  30. # enable completion features
  31. autoload -Uz compinit
  32. compinit -d ~/.cache/zcompdump
  33. zstyle ':completion:*:*:*:*:*' menu select
  34. zstyle ':completion:*' auto-description 'specify: %d'
  35. zstyle ':completion:*' completer _expand _complete
  36. zstyle ':completion:*' format 'Completing %d'
  37. zstyle ':completion:*' group-name ''
  38. zstyle ':completion:*' list-colors ''
  39. zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
  40. #zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
  41. zstyle ':completion:*' rehash true
  42. zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
  43. zstyle ':completion:*' use-compctl false
  44. zstyle ':completion:*' verbose true
  45. zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
  46. zstyle ':completion:*' special-dirs true
  47. # History configurations
  48. HISTFILE=~/.zsh_history
  49. HISTSIZE=1000
  50. SAVEHIST=2000
  51. setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
  52. setopt hist_ignore_dups # ignore duplicated commands history list
  53. setopt hist_ignore_space # ignore commands that start with space
  54. setopt hist_verify # show command with history expansion to user before running it
  55. #setopt share_history # share command history data
  56. # force zsh to show the complete history
  57. alias history="history 0"
  58. # configure `time` format
  59. TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'
  60. # make less more friendly for non-text input files, see lesspipe(1)
  61. #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
  62. # enable color support of ls, less and man, and also add handy aliases
  63. if [ -x /usr/bin/dircolors ]; then
  64. test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
  65. export LS_COLORS="$LS_COLORS:ow=30;44:" # fix ls color for folders with 777 permissions
  66. alias ls='ls --color=auto'
  67. #alias dir='dir --color=auto'
  68. #alias vdir='vdir --color=auto'
  69. alias grep='grep --color=auto'
  70. alias fgrep='fgrep --color=auto'
  71. alias egrep='egrep --color=auto'
  72. alias diff='diff --color=auto'
  73. alias ip='ip --color=auto'
  74. export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink
  75. export LESS_TERMCAP_md=$'\E[1;36m' # begin bold
  76. export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
  77. export LESS_TERMCAP_so=$'\E[01;33m' # begin reverse video
  78. export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
  79. export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
  80. export LESS_TERMCAP_ue=$'\E[0m' # reset underline
  81. # Take advantage of $LS_COLORS for completion as well
  82. zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
  83. zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
  84. fi
  85. # some more ls aliases
  86. alias ll='ls -l'
  87. alias la='ls -A'
  88. alias l='ls -CF'
  89. # enable auto-suggestions based on the history
  90. if [ -f /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]; then
  91. . /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
  92. # change suggestion color
  93. ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#999'
  94. fi
  95. # You may want to put all your additions into a folder file like
  96. # ~/.config_files/zshrc.d, instead of adding them here directly.
  97. for file in ~/.zshrc.d/*.zsh; do
  98. source "$file"
  99. done
  100. # enable command-not-found if installed
  101. if [ -f /etc/zsh_command_not_found ]; then
  102. . /etc/zsh_command_not_found
  103. fi
  104. compinit