Improve zsh behaviour

This commit is contained in:
Anthony Rose 2022-08-18 16:36:05 +01:00
parent 87e3fd03ca
commit 40532e1bc6

View file

@ -15,23 +15,28 @@ then
alias shopt=false alias shopt=false
fi fi
if [ -f /etc/bashrc ] if [ -n "$BASH_VERSION" ]
then then
. /etc/bashrc
fi
if [ -f /usr/share/bash-completion/bash_completion ] if [ -f /etc/bashrc ]
then then
. /usr/share/bash-completion/bash_completion . /etc/bashrc
elif [ -f /etc/bash_completion ] fi
then
. /etc/bash_completion if [ -f /usr/share/bash-completion/bash_completion ]
fi then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]
then
. /etc/bash_completion
fi
if [ -f /usr/share/bash-completion/completions/quilt ]
then
. /usr/share/bash-completion/completions/quilt
complete -F _quilt_completion -o filenames dquilt
fi
if [ -f /usr/share/bash-completion/completions/quilt ]
then
. /usr/share/bash-completion/completions/quilt
complete -F _quilt_completion -o filenames dquilt
fi fi
_acp_add_path () { _acp_add_path () {
@ -88,7 +93,7 @@ export PAPERSIZE=a4
export POWERSHELL_TELEMETRY_OPTOUT=1 export POWERSHELL_TELEMETRY_OPTOUT=1
export PYTHONWARNINGS=ignore::UserWarning export PYTHONWARNINGS=ignore::UserWarning
if [ "x$(uname -s)" = "xDarwin" ] if [ x$(uname -s) = xDarwin ]
then then
export BASH_SILENCE_DEPRECATION_WARNING=1 export BASH_SILENCE_DEPRECATION_WARNING=1
fi fi
@ -115,25 +120,32 @@ then
export QT_FONT_DPI=72 export QT_FONT_DPI=72
fi fi
shopt -s histappend if [ -n "$BASH_VERSION" ]
bind '"\e[1;5C": forward-word' then
bind '"\e[1;5D": backward-word' shopt -s histappend
bind '"\e[A": history-search-backward' bind '"\e[1;5C": forward-word'
bind '"\e[B": history-search-forward' bind '"\e[1;5D": backward-word'
bind 'set bell-style none' bind '"\e[A": history-search-backward'
bind 'set completion-ignore-case on' bind '"\e[B": history-search-forward'
bind 'set enable-bracketed-paste off' bind 'set bell-style none'
bind 'set completion-ignore-case on'
if [ -n "$ZSH_VERSION" ] bind 'set enable-bracketed-paste off'
elif [ -n "$ZSH_VERSION" ]
then then
bindkey "^[[A" history-beginning-search-backward bindkey "^[[A" history-beginning-search-backward
bindkey "^[[B" history-beginning-search-forward bindkey "^[[B" history-beginning-search-forward
fi fi
export PS1="\[\033[01m\]\u@\h\\$\[\033[00m\] " # Set the prompt for various shells. The prompt should look like "user@host$ "
if [ -n "$ZSH_VERSION" ] # or similar, except for the fallback of "$ " for anything it can't detect.
if [ -n "$BASH_VERSION" ]
then
export PS1="\[\033[01m\]\u@\h\\$\[\033[00m\] "
elif [ -n "$ZSH_VERSION" ]
then then
export PS1="%B%n@%m%#%b " export PS1="%B%n@%m%#%b "
else
export PS1="$ "
fi fi
if test $(id -u) -ne 0 && test -x /usr/bin/dnf if test $(id -u) -ne 0 && test -x /usr/bin/dnf