-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy path.zshrc
More file actions
88 lines (73 loc) · 3.54 KB
/
.zshrc
File metadata and controls
88 lines (73 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# ===============================
# History configuration
# ===============================
# Increase the default in-memory history size (zsh defaults to ~30 commands)
# and set the same number for the saved history so it persists between sessions.
# Store history in ~/.zsh_history for consistency.
# Ignore consecutive duplicate commands to reduce clutter.
# Share history in real-time across all running zsh sessions.
# Tip: Raise HISTSIZE/SAVEHIST for larger history (e.g., 50000+).
# Remove SHARE_HISTORY if you prefer separate history per terminal.
HISTSIZE=5000
SAVEHIST=5000
HISTFILE=~/.zsh_history
setopt HIST_IGNORE_DUPS
setopt SHARE_HISTORY
# ===============================
# Completion system initialization
# ===============================
# Enable zsh's modern (compinit) completion system:
# - autoload -Uz compinit: makes the compinit function available
# - compinit: scans $fpath for completion scripts (e.g., _git, _kubectl)
# and initializes programmable, context-aware completions.
# Without this, zsh falls back to the old, limited compctl system.
autoload -Uz compinit
compinit
# ===============================
# Shell environment configuration
# ===============================
# Load shell environment settings (nvm, paths, etc.)
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/shell-config.zsh" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/shell-config.zsh"
# ===============================
# Aliases
# ===============================
# Load personal aliases from external file
[ -f "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/aliases.zsh" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/zsh/aliases.zsh"
# ===============================
# Key bindings
# ===============================
# Enable Vi-style keybindings in Zsh:
# - Normal mode (ESC) and Insert mode like in Vim.
bindkey -v
# Map Ctrl+R to an incremental reverse search through history
# (search results appear as you type, updating in real time).
bindkey '^R' history-incremental-search-backward
# ===============================
# Theme / Prompt configuration
# ===============================
# Initialize theme symlinks if they don't exist (default to light theme)
theme_state_file="${XDG_CONFIG_HOME:-$HOME/.config}/theme-mode"
config_dir="${XDG_CONFIG_HOME:-$HOME/.config}"
# Determine which theme to use
if [ -f "$theme_state_file" ]; then
theme_mode=$(cat "$theme_state_file")
else
theme_mode="light" # Default to light theme
fi
# Create symlinks if they don't exist
[ ! -L "$config_dir/alacritty/colors-active.toml" ] && ln -sf "$config_dir/alacritty/colors-$theme_mode.toml" "$config_dir/alacritty/colors-active.toml"
[ ! -L "$config_dir/zsh/theme-active.zsh" ] && ln -sf "$config_dir/zsh/theme-$theme_mode.zsh" "$config_dir/zsh/theme-active.zsh"
[ ! -L "$config_dir/tmux/theme-active.conf" ] && ln -sf "$config_dir/tmux/theme-$theme_mode.conf" "$config_dir/tmux/theme-active.conf"
# Load theme colors (theme-active.zsh is a symlink to theme-dark.zsh or theme-light.zsh)
[ -f "$config_dir/zsh/theme-active.zsh" ] && source "$config_dir/zsh/theme-active.zsh"
# Load the main Zsh theme configuration from an external file.
# Uses XDG_CONFIG_HOME if set, otherwise defaults to ~/.config/zsh/main.zsh-theme.
# This keeps theme settings separate from .zshrc for cleaner organization,
# making it easier to update or swap themes without editing core shell config.
theme_file="${XDG_CONFIG_HOME:-$HOME/.config}/zsh/main.zsh-theme"
[ -f "$theme_file" ] && source "$theme_file"
export PNPM_HOME="/Users/lucasfcosta/Library/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac