dotfiles/old/_config/zsh/configs/default/00-options.zsh

103 lines
2.4 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Treat glob chars as literals when there are no matches (like bash)
setopt no_nomatch
## History
HISTFILE="$HOME/.zsh_history"
HISTSIZE=100000
SAVEHIST=100000
# Don't record consecutive duplicates or lines starting with a space
setopt hist_ignore_dups
setopt hist_ignore_space
setopt hist_save_no_dups
setopt hist_reduce_blanks
setopt hist_expire_dups_first
setopt share_history
# Append to the history file instead of over-writing it after each session
#setopt inc_append_history
# Enable Vim mode (press esc to start)
bindkey -e
# Fancy ctrl-z (thanks, Adam Stankiewicz!)
fancy-ctrl-z () {
if [[ $#BUFFER -eq 0 ]]; then
fg
zle redisplay
else
zle push-input
zle clear-screen
fi
}
zle -N fancy-ctrl-z
bindkey '^Z' fancy-ctrl-z
bindkey '^P' up-line-or-search
bindkey '^N' down-line-or-search
autoload -Uz colors && colors
setopt prompt_subst
fish_pwd() {
echo ${${:-/${(j:/:)${(M)${(s:/:)${(D)PWD:h}}#(|.)[^.]}}/${PWD:t}}//\/~/\~}
}
sorin_pwd() {
local current_pwd="${PWD/#$HOME/~}"
local ret_directory
if [[ "$current_pwd" == "~" ]]; then
ret_directory="~"
unset MATCH
else
ret_directory=${${:-${(j:/:)${(M)${(s:/:)${(D)PWD:h}}#(|.)[^.]}}/${PWD:t}}//\/~/\~}
fi
echo $ret_directory
}
## Prompts
PROMPT=''
if [[ ! -z "$SSH_CLIENT" ]] then
PROMPT+="%B%F{blue}%m%b%f "
fi
PROMPT+="%F{blue}"
PROMPT+='$(sorin_pwd)'
PROMPT+=" "
PROMPT+="%f%s%b "
# Get LS_COLORS
if [[ -z "${LS_COLORS}" ]] && [[ -x '/usr/bin/dircolors' ]]; then
eval "$( /usr/bin/dircolors -b )"
fi
## Completion Settings
######################
(( ${fpath[(I)/usr/share/zsh/site-functions]} )) ||
fpath+=( /usr/share/zsh/site-functions )
autoload -Uz compinit && compinit
zmodload zsh/complist
# Offer to correct mispelings
setopt correct
# Always display tags separately
zstyle ':completion:*' group-name ''
# Case-insensitive matching
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}'
# Show completing ____' in the menu thing
zstyle ':completion:*:descriptions' format $'%{\e[0;35m%}completing %B%d:%b%{\e[0m%}'
# Display a selection box around the completion menu items
zstyle ':completion:*' menu select=2
# Ignore users with /bin/false or /bin/nologin as their log-in shell
zstyle ':completion:*' users ${${${(f)"$( < /etc/passwd )"}:#*/(false|nologin)}%%:*}
# Define the order and display names of groups for `ssh`
zstyle ':completion:*:ssh:*' tag-order 'hosts:hosts:host users:users:user'
zstyle ':completion:*:ssh:*' group-order 'hosts users'