zsh/.zshrc

79 lines
2.2 KiB
Bash
Raw Normal View History

2019-12-25 21:27:17 -05:00
if [ ! -d "$HOME/.zim" ]
then
git clone https://github.com/zimfw/zimfw $HOME/.zim -b develop
source ~/.zim/zimfw.zsh install
fi
2019-12-25 21:27:17 -05:00
# Remove older command from the history if a duplicate is to be added.
setopt HIST_IGNORE_ALL_DUPS
unsetopt SHARE_HISTORY
setopt INC_APPEND_HISTORY
2019-12-25 21:27:17 -05:00
# Set editor default keymap to emacs
bindkey -e
stty -ixon #disable XON/XOFF, which breaks C-s
2016-02-15 11:20:39 -05:00
2019-12-25 21:27:17 -05:00
# Prompt for spelling correction of commands.
setopt CORRECT
CORRECT_IGNORE="_*" # don't suggest completion functions
2016-02-15 11:20:39 -05:00
2019-12-25 21:27:17 -05:00
# Customize spelling correction prompt.
SPROMPT='zsh: correct %F{red}%R%f to %F{green}%r%f [nyae]? '
# Remove path separator from WORDCHARS.
WORDCHARS=${WORDCHARS//[\/]}
# Set window title format
zstyle ':zim:termtitle' format '%~:zsh'
# Append `../` to your input for each `.` you type after an initial `..`
zstyle ':zim:input' double-dot-expand yes
# Set what highlighters will be used.
# See https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
# Set zsh-autosuggestions highlight style
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=black,bold,underline"
2019-12-25 21:27:17 -05:00
# Initialize Zim modules
if [[ ${ZIM_HOME}/init.zsh -ot ${ZDOTDIR:-${HOME}}/.zimrc ]]; then
# Update static initialization script if it's outdated, before sourcing it
source ${ZIM_HOME}/zimfw.zsh init -q
fi
2019-12-25 21:27:17 -05:00
source ${ZIM_HOME}/init.zsh
# Source aliases
source $HOME/.aliases/general
# Various Options
unsetopt NOMATCH # turn off "no matches found" on glob failure
2019-12-25 21:27:17 -05:00
# rehashes on bin change, might cause performance issues
zstyle ':completion:*' rehash true
2016-12-02 12:50:17 -05:00
# History Substring Search bindings (PageUp and PageDown)
2016-12-02 12:50:17 -05:00
bindkey '^[[5~' history-substring-search-up
bindkey '^[[6~' history-substring-search-down
# Inserts 'sudo ' at the beginning of the line.
function prepend-sudo() {
if [[ "$BUFFER" != su(do|)\ * ]]; then
BUFFER="sudo $BUFFER"
(( CURSOR += 5 ))
fi
}
zle -N prepend-sudo
bindkey "^X^S" prepend-sudo
# Control-Backspace and Control-Delete
2016-12-02 12:50:17 -05:00
bindkey '^H' backward-kill-word
bindkey '5~' kill-word
2019-12-25 21:27:17 -05:00
# Auto start tmux if a remote connection
if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -n "$SSH_TTY" ]]
then
# Attach only to the 'auto' session
exec tmux new-session -A -s 'auto'
fi