Worked on zsh + starship + confs
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
typeset -U path cdpath fpath manpath
|
||||
for profile in ${(z)NIX_PROFILES}; do
|
||||
fpath+=($profile/share/zsh/site-functions $profile/share/zsh/$ZSH_VERSION/functions $profile/share/zsh/vendor-completions)
|
||||
done
|
||||
|
||||
HELPDIR="${ZSH_HELPDIR:-${XDG_DATA_HOME:-$HOME/.local/share}/zsh/$ZSH_VERSION/help}"
|
||||
|
||||
# Source zsh-autosuggestions (use environment variable)
|
||||
if [ -n "$ZSH_AUTOSUGGESTIONS_PATH" ]; then
|
||||
source "$ZSH_AUTOSUGGESTIONS_PATH"
|
||||
ZSH_AUTOSUGGEST_STRATEGY=(history)
|
||||
fi
|
||||
|
||||
# oh-my-zsh extra settings for plugins
|
||||
plugins=(git sudo extract colored-man-pages command-not-found history docker kubectl)
|
||||
|
||||
source "$ZSH/oh-my-zsh.sh"
|
||||
|
||||
# Source zoxide (use environment variable)
|
||||
if [ -n "$ZOXIDE_INIT" ]; then
|
||||
eval "$($ZOXIDE_INIT zsh)"
|
||||
fi
|
||||
|
||||
# History options should be set in .zshrc and after oh-my-zsh sourcing.
|
||||
HISTSIZE="10000"
|
||||
SAVEHIST="10000"
|
||||
HISTFILE="${XDG_CONFIG_HOME:-$HOME/.config}/zsh/.zsh_history"
|
||||
mkdir -p "$(dirname "$HISTFILE")"
|
||||
|
||||
# Source fzf (use environment variable)
|
||||
if [[ $options[zle] = on ]] && [ -n "$FZF_ZSH" ]; then
|
||||
source <($FZF_ZSH --zsh)
|
||||
fi
|
||||
|
||||
# Source zsh-syntax-highlighting (use environment variable)
|
||||
if [ -n "$ZSH_SYNTAX_HIGHLIGHTING_PATH" ]; then
|
||||
source "$ZSH_SYNTAX_HIGHLIGHTING_PATH"
|
||||
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main)
|
||||
fi
|
||||
|
||||
# Source catppuccin zsh-syntax-highlighting (use environment variable)
|
||||
if [ -n "$CATPPUCCIN_ZSH_SYNTAX_PATH" ]; then
|
||||
source "$CATPPUCCIN_ZSH_SYNTAX_PATH"
|
||||
fi
|
||||
|
||||
# Set shell options
|
||||
set_opts=(
|
||||
HIST_FCNTL_LOCK HIST_IGNORE_DUPS HIST_IGNORE_SPACE SHARE_HISTORY autocd
|
||||
NO_APPEND_HISTORY NO_EXTENDED_HISTORY NO_HIST_EXPIRE_DUPS_FIRST
|
||||
NO_HIST_FIND_NO_DUPS NO_HIST_IGNORE_ALL_DUPS NO_HIST_SAVE_NO_DUPS
|
||||
)
|
||||
for opt in "${set_opts[@]}"; do
|
||||
setopt "$opt"
|
||||
done
|
||||
unset opt set_opts
|
||||
|
||||
# Source starship (use environment variable)
|
||||
if [[ $TERM != "dumb" ]] && [ -n "$STARSHIP_INIT" ]; then
|
||||
eval "$($STARSHIP_INIT zsh)"
|
||||
fi
|
||||
|
||||
# Kitty shell integration
|
||||
if test -n "$KITTY_INSTALLATION_DIR"; then
|
||||
export KITTY_SHELL_INTEGRATION="no-rc"
|
||||
autoload -Uz -- "$KITTY_INSTALLATION_DIR/shell-integration/zsh/kitty-integration"
|
||||
kitty-integration
|
||||
unfunction kitty-integration
|
||||
fi
|
||||
|
||||
# Source direnv (use environment variable)
|
||||
if [ -n "$DIRENV_HOOK" ]; then
|
||||
eval "$($DIRENV_HOOK zsh)"
|
||||
fi
|
||||
|
||||
# Aliases
|
||||
alias -- la='eza -a'
|
||||
alias -- ll='eza -l'
|
||||
alias -- lla='eza -la'
|
||||
alias -- ls='eza'
|
||||
alias -- lt='eza --tree'
|
||||
|
||||
# Eat shell integration
|
||||
[ -n "$EAT_SHELL_INTEGRATION_DIR" ] && source "$EAT_SHELL_INTEGRATION_DIR/zsh"
|
||||
|
||||
# Source user aliases
|
||||
if [ -f "$XDG_CONFIG_HOME/zsh/aliases.zsh" ]; then
|
||||
source "$XDG_CONFIG_HOME/zsh/aliases.zsh"
|
||||
fi
|
||||
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
# --- Environment Variables ---
|
||||
export EDITOR="nvim"
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
export PATH="$HOME/.cargo/bin:$PATH" # Example: Add Rust's cargo binaries
|
||||
|
||||
# --- Aliases ---
|
||||
# (You can move these from your Nix config to here if you prefer)
|
||||
alias gs="git status"
|
||||
alias ga="git add"
|
||||
alias gc="git commit -m"
|
||||
alias gp="git push"
|
||||
alias gco="git checkout"
|
||||
alias ll="exa --icons -la --group-directories-first"
|
||||
alias ls="exa --icons -a --group-directories-first"
|
||||
|
||||
# --- Functions ---
|
||||
# Example: Create a new directory and cd into it
|
||||
mkcd() {
|
||||
mkdir -p "$1" && cd "$1"
|
||||
}
|
||||
|
||||
# --- Shell Options ---
|
||||
setopt HIST_IGNORE_ALL_DUPS # Ignore duplicate commands in history
|
||||
setopt HIST_IGNORE_SPACE # Ignore commands starting with a space
|
||||
setopt APPEND_HISTORY # Append to history file, don't overwrite
|
||||
setopt INC_APPEND_HISTORY # Append to history file as soon as the command is entered
|
||||
|
||||
# --- Key Bindings ---
|
||||
# Example: Edit command line in $EDITOR
|
||||
autoload -U edit-command-line
|
||||
zle -N edit-command-line
|
||||
bindkey '^xe' edit-command-line # Ctrl+x, e
|
||||
|
||||
# --- Prompt Customization ---
|
||||
# (Starship usually handles this, but you can add pre-starship prompts here)
|
||||
|
||||
# --- Load other files ---
|
||||
# Source other files (e.g., secrets, local overrides)
|
||||
[[ -f "$HOME/.zshrc.local" ]] && source "$HOME/.zshrc.local"
|
||||
|
||||
# --- Fuzzy Finder (fzf) ---
|
||||
# If not already loaded in .zshrc
|
||||
[[ $- == *i* ]] && source "$(brew --prefix)/opt/fzf/shell/key-bindings.zsh" 2>/dev/null
|
||||
[[ $- == *i* ]] && source "$(brew --prefix)/opt/fzf/shell/completion.zsh" 2>/dev/null
|
||||
|
||||
# --- Conditional Loading ---
|
||||
# Only load if not already loaded
|
||||
if [[ -z "$TMUX" ]]; then
|
||||
# Example: Start tmux if not already in a session
|
||||
if command -v tmux &>/dev/null && [ -n "$PS1" ]; then
|
||||
exec tmux
|
||||
fi
|
||||
fi
|
||||
Reference in New Issue
Block a user