mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-26 11:14:08 +00:00
129 lines
3.5 KiB
Bash
Executable File
129 lines
3.5 KiB
Bash
Executable File
# this is my zsh config. there are many like it, but this one is mine.
|
|
# shellcheck shell=bash
|
|
|
|
# export VERBOSE=1
|
|
# export DEBUG=1
|
|
|
|
export DOTFILES="$HOME/.dotfiles"
|
|
|
|
source "$DOTFILES/config/shared.sh"
|
|
|
|
x-path-prepend "/usr/local/bin"
|
|
x-path-prepend "/opt/homebrew/bin"
|
|
x-path-prepend "$HOME/.local/share/cargo/bin"
|
|
x-path-prepend "$HOME/.local/share/bob/nvim-bin"
|
|
x-path-prepend "$HOME/.local/bin"
|
|
x-path-prepend "$DOTFILES/local/bin"
|
|
|
|
eval "$(oh-my-posh init zsh --config "$DOTFILES/config/omp/own.toml")"
|
|
|
|
# Load asdf
|
|
export ASDF_DIR="$XDG_BIN_HOME/asdf"
|
|
if [[ -d $ASDF_DIR ]]; then
|
|
[[ -d $ASDF_DIR/bin ]] && x-path-prepend "$ASDF_DIR/bin"
|
|
[[ -d $ASDF_DIR/shims ]] && x-path-prepend "$ASDF_DIR/shims"
|
|
[[ -d $ASDF_DIR/completions ]] && fpath=("$ASDF_DIR/completions" $fpath)
|
|
[[ -d $ASDF_DIR/plugins ]] && fpath=("$ASDF_DIR/plugins" $fpath)
|
|
source "$ASDF_DIR/asdf.sh"
|
|
fi
|
|
|
|
# Function to load antigen if available
|
|
load_antigen()
|
|
{
|
|
local antigen_zsh_path="$XDG_BIN_HOME/antigen.zsh"
|
|
# shellcheck source=../../.local/bin/antigen.zsh
|
|
if [[ -f "$antigen_zsh_path" ]]; then
|
|
source "$antigen_zsh_path"
|
|
|
|
antigen use oh-my-zsh
|
|
|
|
export ZSH_TMUX_AUTOSTART=true
|
|
export ZSH_TMUX_CONFIG="$DOTFILES/config/tmux/tmux.conf"
|
|
export ZSH_TMUX_UNICODE=true
|
|
export ZSH_TMUX_AUTOQUIT=false
|
|
export ZSH_TMUX_DEFAULT_SESSION_NAME=main
|
|
|
|
# z, the zsh version
|
|
export ZSHZ_DATA="$XDG_STATE_HOME/z"
|
|
antigen bundle z
|
|
|
|
# these should be always available
|
|
antigen bundle brew
|
|
antigen bundle tmux
|
|
antigen bundle colored-man-pages
|
|
antigen bundle ssh-agent
|
|
antigen bundle jreese/zsh-titles
|
|
antigen bundle zsh-users/zsh-completions
|
|
|
|
x-have python && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv
|
|
|
|
# this needs to be the last item
|
|
antigen bundle zsh-users/zsh-syntax-highlighting
|
|
antigen apply
|
|
fi
|
|
}
|
|
|
|
# Function to source FZF configuration
|
|
source_fzf_config()
|
|
{
|
|
local fzf_config="${DOTFILES}/config/fzf/fzf.zsh"
|
|
if [[ -f "$fzf_config" ]]; then
|
|
# shellcheck source=config/fzf/fzf.zsh
|
|
source "$fzf_config"
|
|
fi
|
|
}
|
|
|
|
# Function to initialize pyenv if available
|
|
initialize_pyenv()
|
|
{
|
|
if x-have pyenv; then
|
|
[[ -d $PYENV_ROOT/bin ]] && x-path-append "$PYENV_ROOT/bin"
|
|
[[ -d $PYENV_ROOT/shims ]] && x-path-append "$PYENV_ROOT/shims"
|
|
eval "$(pyenv init -)"
|
|
eval "$(pyenv virtualenv-init -)"
|
|
fi
|
|
}
|
|
|
|
# Function to set up tmux window name plugin if tmux is active
|
|
setup_tmux_window_name_plugin()
|
|
{
|
|
if [[ -n "$TMUX" ]]; then
|
|
local tmux_window_name_plugin="$DOTFILES/config/tmux/plugins/tmux-window-name/scripts/rename_session_windows.py"
|
|
if [[ -f "$tmux_window_name_plugin" ]]; then
|
|
tmux_window_name()
|
|
{
|
|
($tmux_window_name_plugin &)
|
|
}
|
|
add-zsh-hook chpwd tmux_window_name
|
|
tmux_window_name
|
|
fi
|
|
fi
|
|
}
|
|
|
|
# Function to initialize antidot if available
|
|
initialize_antidot()
|
|
{
|
|
if x-have antidot; then
|
|
eval "$(antidot init)"
|
|
fi
|
|
}
|
|
|
|
main()
|
|
{
|
|
load_antigen
|
|
source_fzf_config
|
|
initialize_pyenv
|
|
setup_tmux_window_name_plugin
|
|
initialize_antidot
|
|
}
|
|
|
|
main "$@"
|
|
|
|
# Herd checks for a few environment variables to inject PHP binaries and configurations.
|
|
# Herd injected PHP binary.
|
|
# export PATH="/Users/ivuorinen/Library/Application\ Support/Herd/bin/":$PATH
|
|
# Herd injected PHP 8.3 configuration.
|
|
# export HERD_PHP_83_INI_SCAN_DIR="/Users/ivuorinen/Library/Application\ Support/Herd/config/php/83/"
|
|
# Herd injected PHP 7.4 configuration.
|
|
# export HERD_PHP_74_INI_SCAN_DIR="/Users/ivuorinen/Library/Application\ Support/Herd/config/php/74/"
|