Collection of configuration files
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.
dotfiles/dot_config/zsh/rc.d/10-options.zsh.tmpl

134 lines
3.1 KiB

#!/bin/zsh
# Z Shell options
#
# General
#
# Combine zero-length punctuation characters (accents) with the base character.
setopt COMBINING_CHARS
# Don't treat non-executable files in your $path as commands.
setopt HASH_EXECUTABLES_ONLY
# Allow comments to be pasted into the command line.
setopt INTERACTIVE_COMMENTS
# Don't print a warning message if a mail file has been accessed.
unsetopt MAIL_WARNING
# Don't let > and >> overwrite files. To overwrite, append | or !
unsetopt CLOBBER
#
# Globbing
#
# Enable additional glob operators. (Globbing = pattern matching)
# https://zsh.sourceforge.io/Doc/Release/Expansion.html#Filename-Generation
setopt EXTENDED_GLOB
# Enable ** and *** as shortcuts for **/* and ***, respectively.
# https://zsh.sourceforge.io/Doc/Release/Expansion.html#Recursive-Globbing
setopt GLOB_STAR_SHORT
# Sort numbers numerically, not lexicographically.
setopt NUMERIC_GLOB_SORT
# Disable globbing.
alias find='noglob find'
alias fd='noglob fd'
alias ftp='noglob ftp'
alias history='noglob history'
alias locate='noglob locate'
alias rake='noglob rake'
alias rsync='noglob rsync'
alias scp='noglob scp'
alias sftp='noglob sftp'
#
# Jobs
#
# Don't run all background jobs at a lower priority.
unsetopt BG_NICE
# Don't report on jobs when shell exit.
unsetopt CHECK_JOBS
# Don't kill jobs on shell exit.
unsetopt HUP
# List jobs in the long format by default.
setopt LONG_LIST_JOBS
# Report status of background jobs immediately.
setopt NOTIFY
#
# History
#
# Where to store history
HISTFILE=${XDG_DATA_HOME:=$HOME/{{ .xdg.data }}}/zsh/history
# Max number of entries to keep in history file and in memory
SAVEHIST=$(( 100000 )) # one hundred thousand lines
HISTSIZE=$(( 1.2 * SAVEHIST )) # Zsh recommended value
# Write the history file in the ':start:elapsed;command' format.
setopt EXTENDED_HISTORY
# Beep when accessing non-existent history.
setopt HIST_BEEP
# Expire a duplicate event first when trimming history.
setopt HIST_EXPIRE_DUPS_FIRST
# Use modern file-locking mechanisms, for better safety & performance.
setopt HIST_FCNTL_LOCK
# Do not display a previously found event.
setopt HIST_FIND_NO_DUPS
# Do not record an event that was just recorded again.
setopt HIST_IGNORE_DUPS
# Keep only the most recent copy of each duplicate entry in history.
setopt HIST_IGNORE_ALL_DUPS
# Do not record an event starting with a space.
setopt HIST_IGNORE_SPACE
# Do not write a duplicate event to the history file.
setopt HIST_SAVE_NO_DUPS
# Auto-sync history between concurrent sessions.
setopt SHARE_HISTORY
#
# Smart URLs
# Source: https://github.com/sorin-ionescu/prezto/blob/51c4ff6de4e2d1afd30e52ba19b21b1128fd1ed5/modules/environment/init.zsh#L16-L27
#
autoload -Uz is-at-least
if [[ ${ZSH_VERSION} != 5.1.1 && ${TERM} != "dumb" ]]; then
if is-at-least 5.2; then
autoload -Uz bracketed-paste-url-magic
zle -N bracketed-paste bracketed-paste-url-magic
elif is-at-least 5.1; then
autoload -Uz bracketed-paste-magic
zle -N bracketed-paste bracketed-paste-magic
fi
autoload -Uz url-quote-magic
zle -N self-insert url-quote-magic
fi