Files
chezmoi/dot_zshrc
2025-06-09 10:36:53 +02:00

111 lines
2.9 KiB
Plaintext

# Set up the prompt
# 2025-04-10 test
#
autoload -Uz promptinit
promptinit
prompt adam1
setopt histignorealldups sharehistory
# Use emacs keybindings even if our EDITOR is set to vi
bindkey -e
# Keep 1000 lines of history within the shell and save it to ~/.zsh_history:
HISTSIZE=1000
SAVEHIST=1000
HISTFILE=~/.zsh_history
HISTSIZE=10000
HISTFILESIZE=50000
HISTTIMEFORMAT="[%Y-%m-%d %H:%m] "
HISTIGNORE="?:??:??:bash:zsh:clear:exit"
PROMPT_COMMAND="history -a; history -n"
# Use interactive Comments, so typing "#" in the prompt will be considered a comment
setopt interactivecomments
# Use modern completion system
autoload -Uz compinit
compinit
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2
eval "$(dircolors -b)"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
## Oh my posh
# https://ohmyposh.dev/docs/installation/prompt
eval "$(oh-my-posh init zsh --config /home/sebastian/.zsh/rudolfs-dark.omp.json)"
#
# Fuzzy File Finder
#
export FZF_TMUX_OPTS="-r 30%"
export FZF_TMUX=1
source /usr/share/doc/fzf/examples/key-bindings.zsh
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
if [ -f ~/.config/common_aliases ]; then
. ~/.config/common_aliases
fi
# Determin Termanial Type
MYTERMINAL=$(basename "/"$(ps -o cmd -f -p $(cat /proc/$(echo $$)/stat | cut -d \ -f 4) | tail -1 | sed 's/ .*$//'))
# Attach to TMUX session if not already done and only if we're in xfce4-terminal (but not e.g. PyCharm)
if [ -z "$TMUX" ] && [ ${UID} != 0 ] && [[ "$MYTERMINAL" == "xfce4-terminal" ]]
then
#tmux new-session -A -s main
tmux attach || tmux new
fi
#### for pip3 --user installed applications
export PATH=$HOME/.local/bin:$PATH
export PATH="$PATH:/home/sebastian/go/bin:/home/sebastian/.cargo/bin"
function tmux_pane(){
tmux rename-window "$(basename $PWD)"
}
PROMPT_COMMAND="$PROMPT_COMMAND; tmux_pane"