dotfiles/zsh/.zshrc

103 lines
3.0 KiB
Bash
Raw Normal View History

2020-01-22 17:37:20 +01:00
# 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.
2021-03-19 15:46:53 +01:00
export ZSH="$HOME/.oh-my-zsh"
2024-09-30 14:56:01 +02:00
export ZSH_COMPDUMP=$ZSH/cache/.zcompdump-$HOST
2020-01-22 17:37:20 +01:00
ZSH_THEME="powerlevel10k/powerlevel10k"
# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="true"
2020-01-22 17:37:20 +01:00
# Uncomment the following line to display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"
2021-06-21 16:45:58 +02:00
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
2020-01-22 17:37:20 +01:00
source $ZSH/oh-my-zsh.sh
2020-01-24 16:08:38 +01:00
# 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
2020-01-22 17:37:20 +01:00
# User configuration
# Preferred editor for local and remote sessions
2021-06-21 16:45:58 +02:00
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='nano'
else
export EDITOR='code --wait'
fi
2020-01-22 17:37:20 +01:00
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
2020-01-24 16:08:38 +01:00
2021-06-21 16:45:58 +02:00
# 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
2020-03-09 15:32:52 +01:00
# Go
export GOPATH=$HOME/go
2021-06-21 16:45:58 +02:00
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
# Nvidia gpu from WSL
#export LD_LIBRARY_PATH=/usr/lib/wsl/lib:$LD_LIBRARY_PATH
2021-06-21 16:45:58 +02:00
# Autocomplete kubectx/kubens
#autoload -U compinit && compinit
2020-03-09 15:32:52 +01:00
# Kube
2021-03-07 23:31:32 +01:00
#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
2024-08-14 14:56:57 +02:00
[ -f $HOME/.aliases ] && source $HOME/.aliases
# fnm
2024-08-14 14:56:57 +02:00
if [ -d $HOME/.local/share/fnm ]
2023-06-05 15:25:58 +02:00
then
2024-08-14 14:56:57 +02:00
export PATH=$HOME/.local/share/fnm:$PATH
2023-06-05 15:25:58 +02:00
eval "`fnm env`"
fi
2024-08-14 16:15:30 +02:00
_fix_cursor() {
echo -ne '\e[5 q'
}
precmd_functions+=(_fix_cursor)