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.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 - Identify keys with: sudo showkey -a
  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 "^[[1~" beginning-of-line # home
  29. bindkey "^[[4~" end-of-line # end
  30. bindkey "^[[F" end-of-line # end
  31. bindkey '^[[Z' undo # shift + tab undo last action
  32. # enable completion features
  33. autoload -Uz compinit
  34. compinit -d ~/.cache/zcompdump
  35. zstyle ':completion:*:*:*:*:*' menu select
  36. zstyle ':completion:*' auto-description 'specify: %d'
  37. zstyle ':completion:*' completer _expand _complete
  38. zstyle ':completion:*' format 'Completing %d'
  39. zstyle ':completion:*' group-name ''
  40. zstyle ':completion:*' list-colors ''
  41. zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
  42. #zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
  43. zstyle ':completion:*' rehash true
  44. zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
  45. zstyle ':completion:*' use-compctl false
  46. zstyle ':completion:*' verbose true
  47. zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
  48. zstyle ':completion:*' special-dirs true
  49. # History configurations
  50. HISTFILE=~/.zsh_history
  51. HISTSIZE=1000
  52. SAVEHIST=2000
  53. setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTSIZE
  54. setopt hist_ignore_dups # ignore duplicated commands history list
  55. setopt hist_ignore_space # ignore commands that start with space
  56. setopt hist_verify # show command with history expansion to user before running it
  57. #setopt share_history # share command history data
  58. # force zsh to show the complete history
  59. alias history="history 0"
  60. # configure `time` format
  61. TIMEFMT=$'\nreal\t%E\nuser\t%U\nsys\t%S\ncpu\t%P'
  62. # make less more friendly for non-text input files, see lesspipe(1)
  63. #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
  64. # enable color support of ls, less and man, and also add handy aliases
  65. if [ -x /usr/bin/dircolors ]; then
  66. test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
  67. export LS_COLORS="$LS_COLORS:ow=30;44:" # fix ls color for folders with 777 permissions
  68. alias ls='ls --color=auto'
  69. #alias dir='dir --color=auto'
  70. #alias vdir='vdir --color=auto'
  71. alias grep='grep --color=auto'
  72. alias fgrep='fgrep --color=auto'
  73. alias egrep='egrep --color=auto'
  74. alias diff='diff --color=auto'
  75. alias ip='ip --color=auto'
  76. #export LESS_TERMCAP_mb=$'\E[1;31m' # begin blink
  77. #export LESS_TERMCAP_md=$'\E[1;36m' # begin bold
  78. #export LESS_TERMCAP_me=$'\E[0m' # reset bold/blink
  79. #export LESS_TERMCAP_so=$'\E[01;33m' # begin reverse video
  80. #export LESS_TERMCAP_se=$'\E[0m' # reset reverse video
  81. #export LESS_TERMCAP_us=$'\E[1;32m' # begin underline
  82. #export LESS_TERMCAP_ue=$'\E[0m' # reset underline
  83. # Take advantage of $LS_COLORS for completion as well
  84. zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
  85. zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
  86. fi
  87. # some more ls aliases
  88. alias ll='ls -l'
  89. alias la='ls -A'
  90. alias l='ls -CF'
  91. # set zsh plugin base directory
  92. if [ -d /usr/share/zsh/plugins ]; then
  93. export ZSH_PLUGIN_BASE="/usr/share/zsh/plugins"
  94. else
  95. export ZSH_PLUGIN_BASE="/usr/share"
  96. fi
  97. # You may want to put all your additions into a folder file like
  98. # ~/.config_files/zshrc.d, instead of adding them here directly.
  99. for file in ~/.zshrc.d/*.zsh; do
  100. source "$file"
  101. done
  102. # enable command-not-found if installed
  103. if [ -f /etc/zsh_command_not_found ]; then
  104. . /etc/zsh_command_not_found
  105. fi
  106. compinit