dotfiles/.config/zsh/.zshrc
Ahmad Ansori Palembani 3fb8c00d74
fix: Remove pyenv
Move to uv, pyenv have too much conflict with traditional venv setup
2025-06-01 09:35:28 +07:00

106 lines
3 KiB
Bash

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# colors
#autoload -U colors && colors
# ----- MOTDs
# pfetch
# echo "--------------------------------------"
# rateUSD | sed 's/^/ /g'
setopt auto_cd # auto cd if directory
__CONFIG_DIR=${XDG_CONFIG_HOME:-$HOME/.config}
# Completion
[ -f $__CONFIG_DIR/zsh/include/completion ] && source $__CONFIG_DIR/zsh/include/completion
# Alias
[ -f $__CONFIG_DIR/zsh/include/aliases ] && source $__CONFIG_DIR/zsh/include/aliases
# Theme
[ -f $__CONFIG_DIR/zsh/include/theme ] && source $__CONFIG_DIR/zsh/include/theme
# opam
test -r /home/ziro/.opam/opam-init/init.zsh && . /home/ziro/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true
# History in cache directory
HISTFILE=${XDG_CACHE_HOME:-$HOME/.cache}/zsh/zsh_history
HISTSIZE=1000
SAVEHIST=1000
# vi mode
set -o vi
bindkey -M viins "^?" backward-delete-char # fix backspace after switching from visual mode
export KEYTIMEOUT=1
# Keybindings
[ -f $__CONFIG_DIR/zsh/include/keybinds ] && source $__CONFIG_DIR/zsh/include/keybinds
# [[ Plugins
ZSH_PLUGINS="$XDG_DATA_HOME/zsh/plugins"
[ ! -d $ZSH_PLUGINS ] && mkdir -p $ZSH_PLUGINS
# >> INSTALL: #!/bin/zsh
# cd $ZSH_PLUGINS && git clone <plugin repo git url>
# << INSTALL
_install_plugin() {
_PLUGIN_DIR_NAME=${1##*/}
_PLUGIN_TARGET_NAME=${2:-$_PLUGIN_DIR_NAME}
_PLUGIN_DIR="$ZSH_PLUGINS/$_PLUGIN_TARGET_NAME"
[ -d "$_PLUGIN_DIR" ] || {
echo "Installing plugin '$_PLUGIN_DIR_NAME'..."
_PREV_PWD=$PWD
cd "$ZSH_PLUGINS"
echo "========================================"
git clone $1 "$_PLUGIN_TARGET_NAME" || echo "Failed to install plugin '$_PLUGIN_DIR_NAME', skipping..."
echo "========================================"
echo "Installing plugin '$_PLUGIN_DIR_NAME'..."
cd "$_PREV_PWD"
}
source "$_PLUGIN_DIR/$_PLUGIN_DIR_NAME.plugin.zsh" 2>/dev/null
}
# >> ENABLED: silently fail if not installed
_install_plugin https://github.com/zdharma-continuum/fast-syntax-highlighting
_install_plugin https://github.com/zsh-users/zsh-autosuggestions
# _install_plugin https://github.com/marlonrichert/zsh-autocomplete
# _install_plugin https://github.com/zsh-users/zsh-syntax-highlighting
# << ENABLED
# ]] Plugins
# Custom fpath
fpath+=( "$XDG_DATA_HOME/zsh/functions/VCS_Info" )
_command_exists() {
[ $(command -v $1 | wc -l) -gt 0 ] && return 0 || return 1
}
_command_exists zoxide && eval "$(zoxide init zsh)"
_command_exists fzf && {
source <(fzf --zsh)
FZF_ALT_C_COMMAND="" # use zoxide instead
}
case "$OSTYPE" in
"darwin"* )
test -e "${ZDOTDIR}/.iterm2_shell_integration.zsh" && source "${ZDOTDIR}/.iterm2_shell_integration.zsh"
# pnpm
export PNPM_HOME="/Users/ziro/.local/share/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
# pnpm end
export PATH=$PATH:/Users/ziro/.spicetify
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"
;;
esac