.dotfiles/.zshrc

151 lines
3.7 KiB
Bash
Raw Normal View History

# Update Repo
2023-01-14 03:02:20 +01:00
# source $HOME/.dotfiles/configs/zsh/update-repo.zsh
2020-11-07 14:03:30 +01:00
# p10k
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
2021-08-23 18:47:23 +02:00
2022-12-13 11:30:23 +01:00
2023-08-21 14:43:53 +02:00
# This should fix up arrow autocompletion with the zsh-vi-mode plugin
function zvm_before_init() {
zvm_bindkey viins '^[[A' history-beginning-search-backward
zvm_bindkey viins '^[[B' history-beginning-search-forward
zvm_bindkey vicmd '^[[A' history-beginning-search-backward
zvm_bindkey vicmd '^[[B' history-beginning-search-forward
2023-08-21 14:43:53 +02:00
export ZVM_VI_EDITOR=nvim
export ZVM_INIT_MODE=sourcing
}
if [ -f "$HOME/.config/zsh/antigen.zsh" ] ; then
source $HOME/.config/zsh/antigen.zsh
antigen use oh-my-zsh
antigen bundle git
antigen bundle docker
2023-05-03 09:23:13 +02:00
antigen bundle sudo
antigen bundle asdf
2023-08-21 14:43:53 +02:00
# antigen bundle jeffreytse/zsh-vi-mode
antigen theme romkatv/powerlevel10k
antigen bundle zsh-users/zsh-autosuggestions
antigen bundle zsh-users/zsh-syntax-highlighting
antigen apply
fi
2022-10-24 15:24:37 +02:00
# Enable vim mode in zsh
2023-08-21 14:43:53 +02:00
# bindkey -v
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
if [ -d "$HOME/.asdf" ] ; then
. "$HOME/.asdf/asdf.sh"
fi
2022-10-24 15:24:37 +02:00
2022-11-21 15:27:39 +01:00
if [[ -z "$XDG_RUNTIME_DIR" ]]; then
export XDG_RUNTIME_DIR=/run/user/$UID
if [[ ! -d "$XDG_RUNTIME_DIR" ]]; then
export XDG_RUNTIME_DIR=/tmp/$USER-runtime
if [[ ! -d "$XDG_RUNTIME_DIR" ]]; then
mkdir -m 0700 "$XDG_RUNTIME_DIR"
fi
fi
fi
# ZSH_THEME="powerlevel10k/powerlevel10k"
2022-08-23 14:58:15 +02:00
# ZSH_TMUX_AUTOSTART=true
# ZSH_TMUX_AUTOCONNECT=false
2020-11-07 14:03:30 +01:00
eval `dircolors ~/.dircolors`
2021-07-04 15:54:39 +02:00
export FPATH=$FPATH:~/.dotfiles/completions
2022-03-01 23:25:44 +01:00
export NVIM_HOME=$HOME/.config/nvim
2022-04-23 03:41:04 +02:00
export NVIM_LISTEN_ADDRESS=/tmp/nvimsocket
export NVR_CMD=""
2021-07-04 15:54:39 +02:00
2020-11-07 14:03:30 +01:00
# Load oh my zsh
export ZSH=~/.oh-my-zsh
source $ZSH/oh-my-zsh.sh
## FUNCTIONS ##
2023-10-11 15:55:27 +02:00
source $HOME/.config/zsh/functions.zsh
2020-11-07 14:03:30 +01:00
2023-02-25 17:12:20 +01:00
## WEZTERM INTEGRATIONS ##
2023-10-11 15:55:27 +02:00
source $HOME/.config/zsh/wezterm.sh
2023-02-25 17:12:20 +01:00
2020-11-07 14:03:30 +01:00
## LOADING PROGRAMS
export PATH="$PATH:$HOME/bin"
2023-08-08 20:56:29 +02:00
export PATH="$PATH:$HOME/.local/bin"
2021-10-25 19:44:21 +02:00
export PATH="$PATH:/usr/sbin"
2021-04-23 15:23:37 +02:00
2021-03-18 14:10:17 +01:00
## Setup VIM
export EDITOR="nvim"
# Automatically load direnv if found
2020-11-08 21:55:05 +01:00
[[ -s $(which direnv) ]] && eval "$(direnv hook zsh)"
2020-11-07 14:03:30 +01:00
2022-04-15 14:52:17 +02:00
if [ type open &> /dev/null ]; then
else
alias open=xdg-open
fi
2021-08-01 16:09:28 +02:00
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
2021-10-11 16:49:55 +02:00
2022-01-04 15:49:57 +01:00
if type go &> /dev/null ; then
2021-12-18 14:41:37 +01:00
export PATH="$PATH:$(go env GOPATH)/bin"
fi
2021-08-01 16:09:28 +02:00
#If fdfind is installed force fzf to use it
2021-09-06 13:29:42 +02:00
if type fdfind &> /dev/null ; then
2021-08-23 18:47:23 +02:00
export FZF_DEFAULT_COMMAND='fdfind --type f'
2021-08-01 16:09:28 +02:00
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
fi
2021-09-06 13:29:42 +02:00
#If ripgrep is installed prefer it over fdfind
if type rg &> /dev/null; then
export FZF_DEFAULT_COMMAND='rg --files'
export FZF_DEFAULT_OPTS='-m --height 50% --border'
fi
2022-04-23 03:41:04 +02:00
if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
export MOZ_ENABLE_WAYLAND=1
fi
2022-09-19 20:32:50 +02:00
# If podman is installed load the autocompletion
if type podman &> /dev/null; then
source <(podman completion zsh)
fi
2022-12-13 11:30:23 +01:00
if type podman-compose &> /dev/null; then
alias pc=podman-compose
fi
2021-06-14 18:28:53 +02:00
2022-01-31 15:13:23 +01:00
# Auto connect to tmux session of ssh
2022-02-02 12:23:55 +01:00
if [[ -n "$PS1" ]] && [[ -z "$TMUX" ]] && [[ -n "$SSH_CONNECTION" ]]; then
2022-08-23 14:58:15 +02:00
# tmux attach-session -t $USER || tmux new-session -s $USER
2022-01-31 15:13:23 +01:00
fi
2023-02-25 17:12:20 +01:00
source "$HOME/."
2022-12-13 11:30:23 +01:00
2021-08-23 18:47:23 +02:00
export PNPM_HOME="$HOME/.local/share/pnpm"
2021-08-10 21:50:49 +02:00
export PATH="$PNPM_HOME:$PATH"
2022-03-28 14:12:36 +02:00
2023-02-07 17:50:26 +01:00
[ -n "$TMUX" ] && export TERM=tmux-256color
2022-12-13 11:30:23 +01:00
2023-01-17 00:20:41 +01:00
# pnpm
export PNPM_HOME="/home/max/.local/share/pnpm"
export PATH="$PNPM_HOME:$PATH"
2023-02-07 17:50:26 +01:00
# pnpm end
2023-04-04 12:08:06 +02:00
2023-08-21 14:43:53 +02:00
zvm_after_init_commands+=("bindkey '^[[A' up-line-or-search" "bindkey '^[[B' down-line-or-search")