zsh/zshrc

94 lines
2.2 KiB
Bash

# .zshrc [2] Used for setting user's interactive shell configuration and
# executing commands, will be sourced when starting as an interactive shell.
# Load plugin scripts
plugin-load() { source ~/.config/zsh/$1/$1.plugin.zsh }
plugin-load zsh-syntax-highlighting
plugin-load zsh-history-substring-search
# Remove duplicates from history
setopt hist_ignore_all_dups
setopt hist_reduce_blanks
setopt hist_save_no_dups
# Enable multi-terminal history
setopt inc_append_history
# Enable comments in the prompt
setopt interactive_comments
# Disable '<Ctrl>D' to logout
setopt ignore_eof
# Disable sound
unsetopt beep
# Disable tty flow control, allows vim to use '<Ctrl>S'
unsetopt flow_control
# Initialize completions
autoload -U compinit
compinit
# Enable prompt themes
autoload -Uz promptinit
promptinit
prompt fresh
# Enable vi mode line editor keymap
bindkey -v
# Enable yank, change, and delete whole line with 'Y', 'C', and 'D'
bindkey -M vicmd 'Y' vi-yank-whole-line
bindkey -M vicmd 'C' vi-change-whole-line
bindkey -M vicmd 'D' kill-whole-line
# Enable undo with 'u' and redo with 'U'
bindkey -M vicmd 'u' undo
bindkey -M vicmd 'U' redo
# Enable substring history search with 'j' and 'k'
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
# Replace '<Esc>h' with 'K' to view help
bindkey -r '^[h'
bindkey -M vicmd 'K' run-help
# Disable Ex mode with ':'
bindkey -rM vicmd ':'
# Use editor to edit command line with '<Ctrl>V'
autoload -U edit-command-line
zle -N edit-command-line
bindkey -M vicmd '^V' edit-command-line
# Remove duplicates from environment variables
typeset -U PATH
typeset -U MANPATH
typeset -U INFOPATH
# Aliases
alias grep='grep --color=always'
alias cninja='cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMNADS=ON'
alias ssh='TERM=xterm-256color ssh'
case `uname` in
Linux)
[ "$TMUX" = "" ] && \
alias cls="printf '\ec'" || alias cls="clear && printf '\e[3J'"
alias ls='ls -F --color=auto'
alias debug='cgdb --args'
;;
Darwin)
alias cls="clear && printf '\e[3J'"
alias ls='ls -GFh'
alias debug='lldb --'
;;
esac
if [ "$TMUX" != "" ]; then
alias sp='tmux split-window'
alias vs='tmux split-window -h'
fi