.zshrc
· 2.8 KiB · Bash
原始檔案
# ~/.zshrc - macOS Tahoe / Zsh
# Hanya jalankan konfigurasi ini pada shell interaktif.
[[ -o interactive ]] || return
# -----------------------------------------------------------------------------
# Homebrew (Apple Silicon)
# -----------------------------------------------------------------------------
if [[ -x /opt/homebrew/bin/brew ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi
# -----------------------------------------------------------------------------
# History
# -----------------------------------------------------------------------------
HISTFILE="$HOME/.zsh_history"
HISTSIZE=100000
SAVEHIST=500000
setopt APPEND_HISTORY
setopt INC_APPEND_HISTORY
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_SAVE_NO_DUPS
setopt HIST_REDUCE_BLANKS
setopt HIST_IGNORE_SPACE
setopt EXTENDED_HISTORY
# -----------------------------------------------------------------------------
# Aliases
# -----------------------------------------------------------------------------
alias sudo='sudo '
# GNU ls dari Homebrew + vivid bila tersedia.
if command -v gls >/dev/null 2>&1; then
alias ls='gls -lah --color=auto'
else
# Fallback ke BSD ls bawaan macOS.
alias ls='ls -lahG'
fi
if command -v tree >/dev/null 2>&1; then
alias treeall='tree -ugsh --du'
fi
# File alias tambahan per-user.
[[ -f "$HOME/.zsh_aliases" ]] && source "$HOME/.zsh_aliases"
# -----------------------------------------------------------------------------
# Completion Zsh
# -----------------------------------------------------------------------------
autoload -Uz compinit
compinit -d "$HOME/.zcompdump"
# -----------------------------------------------------------------------------
# Custom prompt
# -----------------------------------------------------------------------------
[[ -f /usr/local/etc/shell-prompt.zsh ]] && source /usr/local/etc/shell-prompt.zsh
# -----------------------------------------------------------------------------
# LS_COLORS dengan tema vivid yang berubah berdasarkan tanggal
# -----------------------------------------------------------------------------
if command -v vivid >/dev/null 2>&1; then
themes=(
alabaster_dark ayu catppuccin-frappe catppuccin-latte dracula
iceberg-dark jellybeans lava molokai nord one-dark one-light
rose-pine rose-pine-dawn snazzy solarized-dark tokyonight-moon zenburn
)
current_date=$(date +%Y%m%d)
random_index=$(( 10#$current_date % ${#themes[@]} + 1 ))
theme_now=${themes[$random_index]}
export LS_COLORS="$(vivid generate "$theme_now")"
fi
# -----------------------------------------------------------------------------
# Fastfetch
# -----------------------------------------------------------------------------
if command -v fastfetch >/dev/null 2>&1; then
fastfetch --config "$HOME/.config/fastfetch/config.jsonc"
fi
| 1 | # ~/.zshrc - macOS Tahoe / Zsh |
| 2 | |
| 3 | # Hanya jalankan konfigurasi ini pada shell interaktif. |
| 4 | [[ -o interactive ]] || return |
| 5 | |
| 6 | # ----------------------------------------------------------------------------- |
| 7 | # Homebrew (Apple Silicon) |
| 8 | # ----------------------------------------------------------------------------- |
| 9 | if [[ -x /opt/homebrew/bin/brew ]]; then |
| 10 | eval "$(/opt/homebrew/bin/brew shellenv)" |
| 11 | fi |
| 12 | |
| 13 | # ----------------------------------------------------------------------------- |
| 14 | # History |
| 15 | # ----------------------------------------------------------------------------- |
| 16 | HISTFILE="$HOME/.zsh_history" |
| 17 | HISTSIZE=100000 |
| 18 | SAVEHIST=500000 |
| 19 | |
| 20 | setopt APPEND_HISTORY |
| 21 | setopt INC_APPEND_HISTORY |
| 22 | setopt HIST_IGNORE_ALL_DUPS |
| 23 | setopt HIST_SAVE_NO_DUPS |
| 24 | setopt HIST_REDUCE_BLANKS |
| 25 | setopt HIST_IGNORE_SPACE |
| 26 | setopt EXTENDED_HISTORY |
| 27 | |
| 28 | # ----------------------------------------------------------------------------- |
| 29 | # Aliases |
| 30 | # ----------------------------------------------------------------------------- |
| 31 | alias sudo='sudo ' |
| 32 | |
| 33 | # GNU ls dari Homebrew + vivid bila tersedia. |
| 34 | if command -v gls >/dev/null 2>&1; then |
| 35 | alias ls='gls -lah --color=auto' |
| 36 | else |
| 37 | # Fallback ke BSD ls bawaan macOS. |
| 38 | alias ls='ls -lahG' |
| 39 | fi |
| 40 | |
| 41 | if command -v tree >/dev/null 2>&1; then |
| 42 | alias treeall='tree -ugsh --du' |
| 43 | fi |
| 44 | |
| 45 | # File alias tambahan per-user. |
| 46 | [[ -f "$HOME/.zsh_aliases" ]] && source "$HOME/.zsh_aliases" |
| 47 | |
| 48 | # ----------------------------------------------------------------------------- |
| 49 | # Completion Zsh |
| 50 | # ----------------------------------------------------------------------------- |
| 51 | autoload -Uz compinit |
| 52 | compinit -d "$HOME/.zcompdump" |
| 53 | |
| 54 | # ----------------------------------------------------------------------------- |
| 55 | # Custom prompt |
| 56 | # ----------------------------------------------------------------------------- |
| 57 | [[ -f /usr/local/etc/shell-prompt.zsh ]] && source /usr/local/etc/shell-prompt.zsh |
| 58 | |
| 59 | # ----------------------------------------------------------------------------- |
| 60 | # LS_COLORS dengan tema vivid yang berubah berdasarkan tanggal |
| 61 | # ----------------------------------------------------------------------------- |
| 62 | if command -v vivid >/dev/null 2>&1; then |
| 63 | themes=( |
| 64 | alabaster_dark ayu catppuccin-frappe catppuccin-latte dracula |
| 65 | iceberg-dark jellybeans lava molokai nord one-dark one-light |
| 66 | rose-pine rose-pine-dawn snazzy solarized-dark tokyonight-moon zenburn |
| 67 | ) |
| 68 | |
| 69 | current_date=$(date +%Y%m%d) |
| 70 | random_index=$(( 10#$current_date % ${#themes[@]} + 1 )) |
| 71 | theme_now=${themes[$random_index]} |
| 72 | export LS_COLORS="$(vivid generate "$theme_now")" |
| 73 | fi |
| 74 | |
| 75 | # ----------------------------------------------------------------------------- |
| 76 | # Fastfetch |
| 77 | # ----------------------------------------------------------------------------- |
| 78 | if command -v fastfetch >/dev/null 2>&1; then |
| 79 | fastfetch --config "$HOME/.config/fastfetch/config.jsonc" |
| 80 | fi |
| 81 |