70 lines
2.3 KiB
Bash
70 lines
2.3 KiB
Bash
setopt INC_APPEND_HISTORY
|
|
setopt EXTENDED_HISTORY # Write the history file in the ':start:elapsed;command' format.
|
|
setopt HIST_EXPIRE_DUPS_FIRST # Expire a duplicate event first when trimming history.
|
|
setopt HIST_FIND_NO_DUPS # Do not display a previously found event.
|
|
setopt HIST_IGNORE_ALL_DUPS # Delete an old recorded event if a new event is a duplicate.
|
|
setopt HIST_IGNORE_DUPS # Do not record an event that was just recorded again.
|
|
setopt HIST_IGNORE_SPACE # Do not record an event starting with a space.
|
|
unsetopt HIST_SAVE_NO_DUPS # Do not write a duplicate event to the history file.
|
|
setopt SHARE_HISTORY # Share history between all sessions.
|
|
|
|
bindkey '^R' history-incremental-search-backward
|
|
|
|
setopt AUTO_PUSHD # Push the current directory visited on the stack.
|
|
setopt PUSHD_IGNORE_DUPS # Do not store duplicates in the stack.
|
|
setopt PUSHD_SILENT # Do not print the directory stack after pushd or popd.
|
|
|
|
# install zsh-syntax-highlighting
|
|
case "$(uname -s)" in
|
|
Linux* ) {
|
|
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
|
};;
|
|
Darwin* ) {
|
|
source $(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
|
};;
|
|
* ) ;;
|
|
esac
|
|
|
|
bindkey "^[[1;5C" forward-word
|
|
bindkey "^[[1;5D" backward-word
|
|
|
|
source $DOTFILES/zsh/completion.zsh
|
|
fpath=($DOTFILES/zsh/zsh-completions/src $fpath)
|
|
|
|
# make less more friendly for non-text input files, see lesspipe(1)
|
|
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
|
|
|
|
function start_ssh_agent {
|
|
echo "Initialising new SSH agent..."
|
|
/usr/bin/ssh-agent | sed 's/^echo/#echo/' >"${SSH_ENV}"
|
|
echo succeeded
|
|
chmod 600 "${SSH_ENV}"
|
|
. "${SSH_ENV}" >/dev/null
|
|
/usr/bin/ssh-add
|
|
}
|
|
|
|
# Source SSH settings, if applicable
|
|
|
|
#if [ -f "${SSH_ENV}" ]; then
|
|
# SSH_AGENT_PID="$(echo $(($(cat /proc/sys/kernel/pid_max) + 1)))"
|
|
# . "${SSH_ENV}" > /dev/null
|
|
# ps -ef | grep ${SSH_AGENT_PID} | grep 'ssh-agent$' > /dev/null || {
|
|
# start_ssh_agent;
|
|
# }
|
|
#else
|
|
# start_ssh_agent;
|
|
#fi
|
|
|
|
if [ -f ~/.zsh_aliases ]; then
|
|
. ~/.zsh_aliases
|
|
fi
|
|
|
|
function set_win_title(){
|
|
echo -ne "\033]0; $(basename "$PWD") \007"
|
|
}
|
|
starship_precmd_user_func="set_win_title"
|
|
|
|
|
|
eval "$(starship init zsh)"
|
|
|