dotfiles/home/.config/zsh/.zshrc

75 lines
3.3 KiB
Bash
Raw Normal View History

2021-03-23 20:17:43 +00:00
#!/usr/bin/zsh
# ZSH Options
setopt auto_cd # cd by typing directory name if it's not a command
setopt auto_list # automatically list choices on ambiguous completion
setopt auto_menu # automatically use menu completion
setopt always_to_end # move cursor to end if word had one match
setopt interactivecomments # allow comments in interactive mode
setopt magicequalsubst # enable filename expansion for arguments of form `x=expression`
setopt notify # report the status of background jobs immediately
setopt numericglobsort # sort filenames numerically when it makes sense
2021-08-06 00:11:37 +00:00
setopt auto_pushd # Make cd act as pushd
#setopt correct_all # autocorrect commands
2021-03-23 20:17:43 +00:00
2021-07-23 16:06:44 +00:00
# oh-my-zsh configuration (DISABLED by default, if you want oh-my-zsh, uncomment these)
#export ZSH="/usr/share/oh-my-zsh"
#ZSH_THEME="af-magic"
#UPDATE_ZSH_DAYS=8
#ENABLE_CORRECTION="false"
#source $ZSH/oh-my-zsh.sh # Run oh-my-zsh
2022-08-23 08:54:03 +00:00
# ZSH files setup (don't clutter home)
2021-01-28 12:55:28 +00:00
export ZSH_CACHE="$HOME/.cache/zsh"
2022-08-23 08:54:48 +00:00
export HISTFILE="$ZSH_CACHE/history"
2021-07-23 16:06:44 +00:00
export ZSH_COMPDUMP="$ZSH_CACHE/zcompdump-$ZSH_VERSION"
2021-01-28 22:43:33 +00:00
2021-07-23 16:06:44 +00:00
# Auto-remove home clutter
2021-07-14 12:45:25 +00:00
[ -f ~/.zsh-update ] && mv ~/.zsh-update $ZSH_CACHE/.zsh-update
[ -f ~/.sudo_as_admin_sucessful ] && rm ~/.sudo_as_admin_successful
[ -f ~/.bash_history ] && rm ~/.bash_history
2021-01-28 22:43:33 +00:00
# History configuration
2022-08-23 08:54:48 +00:00
export HISTSIZE=10000
export SAVEHIST=10000
-setopt appendhistory # save history entries as soon as they are entered
2021-03-23 20:17:43 +00:00
setopt hist_ignore_space # ignore commands that start with space
setopt hist_verify # show commands with history expansion to user before running it
2022-08-23 08:53:33 +00:00
setopt extended_history # record command start time
2021-03-23 20:17:43 +00:00
#setopt hist_ignore_dups # ignore duplicated commands history list
#setopt hist_expire_dups_first # delete duplicates first when HISTFILE size exceeds HISTFILE
#setopt share_history # share command history data between terminals
2020-10-22 16:00:38 +00:00
2021-03-23 20:17:43 +00:00
# Completion features (tab)
2021-01-28 22:43:33 +00:00
autoload -Uz compinit
2021-07-23 16:06:44 +00:00
zmodload -i zsh/complist # load completion list
compinit -d $ZSH_COMPDUMP # Specify compdump file
comp_options+=(globdots) # Enable completion on hidden files.
zstyle ':completion:*' menu select # select completions with arrow keys
zstyle ':completion:*' group-name '' # group results by category
zstyle ':completion:::::' completer _expand _complete _ignored _approximate #enable approximate matches for completion
2021-01-28 22:43:33 +00:00
2021-03-23 20:17:43 +00:00
# Color support
#autoload -U colors && colors
2021-01-28 12:55:28 +00:00
2020-10-22 16:00:38 +00:00
# Setup aliases
[ -f ~/.config/shell/aliases ] && source ~/.config/shell/aliases
2021-01-14 12:38:43 +00:00
# Load handlers
[ -f ~/.config/shell/handlers ] && source ~/.config/shell/handlers
2021-01-28 22:43:33 +00:00
# Load key bindings
[ -f ~/.config/shell/keybinds ] && source ~/.config/shell/keybinds
# Load prompt
[ -f ~/.config/shell/prompt ] && source ~/.config/shell/prompt
2020-10-22 16:00:38 +00:00
2021-08-01 22:43:02 +00:00
# Define TMOUT timeout for TTY and root
[ -z "$DISPLAY" ] && export TMOUT=800
[ $UID -eq 0 ] && export TMOUT=600
2021-01-14 12:38:43 +00:00
# Load extensions (should be last)
2021-07-20 21:50:19 +00:00
. /usr/share/zsh/site-functions/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null
. /usr/share/zsh/site-functions/zsh-autosuggestions/zsh-autosuggestions.zsh 2>/dev/null
2021-07-23 00:00:56 +00:00
eval "$(lua /usr/local/src/z.lua/z.lua --init zsh enhanced)"
2022-05-28 23:15:19 +00:00
if command -v pyenv >/dev/null 2>&1; then
eval "$(pyenv init -)"
fi