dotfiles/zsh/.zshrc
2024-08-14 16:19:33 +02:00

102 lines
2.9 KiB
Bash

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block, everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="powerlevel10k/powerlevel10k"
# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"
HIST_STAMPS="yyyy-mm-dd"
plugins=(git git-flow zsh-z composer cp extract zsh-autosuggestions)
# git - git aliases https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git
# git-flow - git-flow aliases and autocomplete https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git-flow
# zsh-z - f/z fast browsing
# composer - composer aliases and completion
# cp - cpv alias that uses rsync
# extract - easy extraction tool for different archives
# zsh-autosuggestions - gives auto suggestion for previous used commands
source $ZSH/oh-my-zsh.sh
# Autocomplete ssh from .ssh/config and .ssh/known_hosts
h=()
if [[ -r ~/.ssh/config ]]; then
h=($h ${${${(@M)${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*})
fi
if [[ -r ~/.ssh/known_hosts ]]; then
h=($h ${${${(f)"$(cat ~/.ssh/known_hosts{,2} || true)"}%%\ *}%%,*}) 2>/dev/null
fi
if [[ $#h -gt 0 ]]; then
zstyle ':completion:*:ssh:*' hosts $h
zstyle ':completion:*:slogin:*' hosts $h
fi
# User configuration
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='nano'
else
export EDITOR='code --wait'
fi
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
# Path additions
export PATH=$HOME/.local/bin:$PATH
export PATH=$HOME/bin:$PATH
export PATH=$PATH:/snap/bin
if command -v composer &> /dev/null
then
export PATH=$PATH:$HOME/.composer/vendor/bin
export PATH=$PATH:$(composer global config bin-dir --absolute --quiet)
fi
export PATH=$PATH:$HOME/.symfony/bin
# Go
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
# Nvidia gpu from WSL
#export LD_LIBRARY_PATH=/usr/lib/wsl/lib:$LD_LIBRARY_PATH
# Autocomplete kubectx/kubens
#autoload -U compinit && compinit
# Kube
#KUBECONFIG=""
#for kubeconfig in $HOME/.kube/config*; do
# if [ -z $KUBECONFIG ]
# then
# KUBECONFIG=$kubeconfig
# else
# KUBECONFIG=$KUBECONFIG:$kubeconfig
# fi
#done
#export KUBECONFIG
#if [ $commands[kubectl] ]; then source <(kubectl completion zsh); fi
[ -f $HOME/.aliases ] && source $HOME/.aliases
# fnm
if [ -d $HOME/.local/share/fnm ]
then
export PATH=$HOME/.local/share/fnm:$PATH
eval "`fnm env`"
fi
_fix_cursor() {
echo -ne '\e[5 q'
}
precmd_functions+=(_fix_cursor)