Skip to content

Instantly share code, notes, and snippets.

@pkdiv
Last active June 2, 2026 14:33
Show Gist options
  • Select an option

  • Save pkdiv/b1514e3e6cc79b43f9188d6f1f88cd54 to your computer and use it in GitHub Desktop.

Select an option

Save pkdiv/b1514e3e6cc79b43f9188d6f1f88cd54 to your computer and use it in GitHub Desktop.
Zsh Files
# Intuitive split keys (v=vertical, h=horizontal)
# -h creates horizontal split (side-by-side)
bind v split-window -h
# -v creates vertical split (top-bottom)
bind h split-window -v
# Alternative: keep the original keys too
# Ctrl+b % still works
bind % split-window -h
# Ctrl+b " still works
bind '"' split-window -v
# Gray status bar (242 is medium gray, 255 is off-white)
set -g status-style bg=colour242,fg=colour255
# Active window - subtle cyan instead of bright
set -g window-status-current-style bg=colour240,fg=colour117,bold
# Other windows - subtle gray
set -g window-status-style bg=colour242,fg=colour250
# Activity notification - subtle yellow
set -g window-status-activity-style bg=colour242,fg=colour228
# Pane borders - subtle gray lines
set -g pane-border-style fg=colour240
set -g pane-active-border-style fg=colour248
# Status left (session name)
set -g status-left-style bg=colour242,fg=colour255,bold
set -g status-left "#S "
# Status right (time, etc.)
set -g status-right-style bg=colour242,fg=colour250
set -g status-right "#[fg=black,bg=cyan]#{?client_prefix, WAITING , #S }#[default]  #(TZ=\"Asia/Kolkata\" date +\"%%H:%%M\")"
# ~/.zshrc for Fedora - Cleaned & Optimized
# Command execution time printed RIGHT-ALIGNED between prompts (seconds with ms precision)
# -------------------------------------------------
# 0. REQUIRED MODULES
# -------------------------------------------------
# Needed for $EPOCHREALTIME
zmodload zsh/datetime
# -------------------------------------------------
# 1. OPTIONS & SHELL BEHAVIOR
# -------------------------------------------------
setopt autocd
setopt interactivecomments
setopt magicequalsubst
setopt nonomatch
setopt notify
setopt numericglobsort
setopt promptsubst
WORDCHARS='_-'
PROMPT_EOL_MARK=""
# -------------------------------------------------
# 2. KEYBINDINGS
# -------------------------------------------------
bindkey -e
bindkey ' ' magic-space
bindkey '^U' backward-kill-line
bindkey '^[[3;5~' kill-word
bindkey '^[[3~' delete-char
bindkey '^[[1;5C' forward-word
bindkey '^[[1;5D' backward-word
bindkey '^[[H' beginning-of-line
bindkey '^[[F' end-of-line
bindkey '^[[Z' undo
# -------------------------------------------------
# 3. COMPLETION SYSTEM
# -------------------------------------------------
autoload -Uz compinit
compinit -d ~/.cache/zcompdump
zstyle ':completion:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
# -------------------------------------------------
# 4. HISTORY
# -------------------------------------------------
HISTFILE=~/.zsh_history
HISTSIZE=1000
SAVEHIST=2000
setopt hist_expire_dups_first
setopt hist_ignore_dups
setopt hist_ignore_space
setopt hist_verify
alias history="history 0"
# -------------------------------------------------
# 5. EXECUTION TIMER (seconds, ms precision)
# -------------------------------------------------
preexec() {
_cmd_start_time=$EPOCHREALTIME
# full command line is in $1
case "$1" in
clear|reset)
_skip_timer=1
;;
*)
_skip_timer=0
;;
esac
}
# -------------------------------------------------
# 6. TERMINAL TITLE
# -------------------------------------------------
case "$TERM" in
xterm*|rxvt*|gnome*|alacritty)
TERM_TITLE=$'\e]0;%n: %~\a'
;;
esac
# -------------------------------------------------
# 7. PRECMD (RIGHT-ALIGNED TIMER OUTPUT)
# -------------------------------------------------
precmd() {
print -Pnr -- "$TERM_TITLE"
[[ -n "$_cmd_start_time" ]] || return
(( _skip_timer )) && { unset _cmd_start_time _skip_timer; return; }
local elapsed=$(( EPOCHREALTIME - _cmd_start_time ))
unset _cmd_start_time _skip_timer
# Format: x.xxx s
local msg
printf -v msg "⏱ %.3f s" "$elapsed"
local cols=${COLUMNS:-$(tput cols 2>/dev/null)}
local pad=$(( cols - ${#msg} ))
(( pad < 1 )) && pad=1
printf "%*s" "$pad" ""
print -P "%F{240}${msg}%f"
}
# -------------------------------------------------
# 8. PROMPT CONFIGURATION
# -------------------------------------------------
configure_prompt() {
local prompt_symbol=":"
case "$PROMPT_ALTERNATIVE" in
twoline)
PROMPT=$'%F{%(#.blue.green)}┌──(%B%F{%(#.red.blue)}%n%b%F{%(#.blue.green)}%F{%(#.blue.green)})-[%B%F{reset}%(6~.%-1~/…/%4~.%5~)%b%F{%(#.blue.green)}]\n└─%B%(#.%F{red}#.%F{blue}$)%b%F{reset} '
;;
oneline)
PROMPT=$'%B%F{%(#.red.blue)}%n%b%F{reset}:%B%F{%(#.blue.green)}%~%b%F{reset}%(#.#.$) '
;;
esac
}
PROMPT_ALTERNATIVE=twoline
NEWLINE_BEFORE_PROMPT=no
VIRTUAL_ENV_DISABLE_PROMPT=1
configure_prompt
# -------------------------------------------------
# 9. EXTERNAL PLUGINS
# -------------------------------------------------
if [[ -f /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]]; then
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
fi
if [[ -f /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]]; then
source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#999'
fi
# -------------------------------------------------
# 10. ALIASES
# -------------------------------------------------
alias ls='ls --color=auto'
alias ll='ls -l'
alias la='ls -A'
alias grep='grep --color=auto'
# -------------------------------------------------
# 11. PROMPT TOGGLE (Ctrl+P)
# -------------------------------------------------
toggle_oneline_prompt() {
if [[ "$PROMPT_ALTERNATIVE" = oneline ]]; then
PROMPT_ALTERNATIVE=twoline
else
PROMPT_ALTERNATIVE=oneline
fi
configure_prompt
zle reset-prompt
}
zle -N toggle_oneline_prompt
bindkey ^P toggle_oneline_prompt
# --- ASCII TIME & DATE BANNER (wave animated) ---
if [[ -o interactive ]]; then
# Colors
local GRAY=$'\e[38;5;242m'
local NC=$'\e[0m'
# Get data
local current_time="$(date +"%I:%M %p")"
local current_date="$(date +"%A, %B %d")"
# Generate figlet output into an array (line by line)
local figlet_lines
figlet_lines=("${(@f)$(figlet -f small "$current_time")}")
# Determine max width
local max_width=0
for line in "${figlet_lines[@]}"; do
(( ${#line} > max_width )) && max_width=${#line}
done
local delay=0.012
# Wave animation (left → right)
for ((col=1; col<=max_width; col++)); do
print -n "\e[H"
for line in "${figlet_lines[@]}"; do
local left="${line[1,col]}"
local right="${line[col+1,-1]}"
print -P "%F{242}${left}%F{255}${mid}%F{238}${right}%f"
done
sleep $delay
done
# Print date below (static, subtle)
print -P "%F{242} ${current_date}%f"
print ""
fi
sudo dnf install figlet zsh-syntax-highlighting zsh-autosuggestions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment