✨ Perfect man page viewer with optimal side-by-side layout
## Enhanced man function following Prime Directive principles - **Durable**: Robust cross-terminal support (kitty/tmux/iTerm) - **Thoughtful**: Optimal 60/40 split (~100 chars CLI, ~64 chars reading) - **Lasting**: Clean code, proper error handling, graceful fallbacks ### Key Features - Beautiful syntax highlighting with Nord theme - Responsive width adaptation via MANWIDTH - Kitty remote control with proper resize shortcuts - Clean traditional appearance (no line numbers) - Stays open until user dismisses ### Technical Improvements - Uses /usr/bin/man explicitly to prevent recursion - Proper environment detection and fallback chain - Added kitty resize shortcuts to config - Removed debug output for clean UX ### Files Updated - shell/functions.zsh: Complete man() rewrite - config/kitty/kitty.conf: Added resize shortcuts - shell/aliases.zsh: Batman alias compatibility - Cleanup of merged files and plugin updates μέτρον γὰρ καὶ συμμετρία - measure, proportion, and what is fitting 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
9d9c0ad241
commit
e7bb361bd2
@@ -0,0 +1,98 @@
|
||||
# Dotfiles Evolution Record
|
||||
|
||||
## Prime Directive
|
||||
> _Prioritize durable, thoughtful solutions over expedient ones. The user intends to do things once, correctly, and with lasting integrity. Favor depth, clarity, and long-term maintainability over shortcuts or incomplete work._
|
||||
|
||||
> **μέτρον γὰρ καὶ συμμετρία καὶ τὸ πρόσφορον πανταχοῦ καλόν τε καὶ ἀγαθόν παρέχει**
|
||||
> "Measure, proportion, and what is fitting give rise to beauty and goodness everywhere."
|
||||
|
||||
## Project Timeline
|
||||
|
||||
### 2025-07-29: Cleanup and Enhancement Session
|
||||
- **Context**: Claude audit review and implementation
|
||||
- **Key Decision**: Careful evaluation of recommendations against existing mature system
|
||||
- **Changes Made**:
|
||||
- ✅ Removed duplicate `.zsh_plugins.txt` (underscore version)
|
||||
- ✅ Removed redundant FZF sourcing from `aliases.zsh:78`
|
||||
- ✅ Removed merge artifacts: `aliases-merged.zsh`, `functions-merged.zsh`
|
||||
- ✅ Added dotfile management functions to `functions.zsh`:
|
||||
- `dot` - Quick navigation to dotfiles directory
|
||||
- `zedit`, `aedit`, `fedit`, `pedit` - Quick edit with auto-reload
|
||||
- `backup-configs` - Timestamp-based critical config backup
|
||||
- ✅ Created `EVOLUTION.md` to track project evolution
|
||||
- **Lessons**: Even mature systems benefit from periodic review and cleanup
|
||||
- **Next Steps**: Test new functions, monitor for any issues
|
||||
|
||||
### 2025-07-28: Batman Returns Enhancement
|
||||
- **Commit**: `9d9c0ad` - 🦇 Batman returns with enhanced powers
|
||||
- **Notable**: Theme and enhancement phase
|
||||
|
||||
### 2025-07-27: Complete Migration Setup
|
||||
- **Commit**: `389febb` - 🚀 Complete machine migration setup with encrypted backups
|
||||
- **Key Features**:
|
||||
- Encrypted backup system
|
||||
- Machine migration capabilities
|
||||
- Security-first approach
|
||||
|
||||
### 2025-07-26: System Recovery
|
||||
- **Context**: Recovered from PATH issue that broke Claude CLI access
|
||||
- **Lesson**: Critical tool paths must be carefully managed and tested
|
||||
|
||||
### Initial Architecture
|
||||
- **Philosophy**: Star Trek-inspired "Engage!" system
|
||||
- **Core Principles**:
|
||||
- Durability over convenience
|
||||
- Thoughtful modularization
|
||||
- Measured implementation
|
||||
- **Key Components**:
|
||||
- Modular shell configuration
|
||||
- Sophisticated backup strategy
|
||||
- System health monitoring
|
||||
- Configuration drift detection
|
||||
|
||||
## Design Decisions Log
|
||||
|
||||
### Shell Configuration Strategy
|
||||
- **Decision**: Modular `.zsh` files over monolithic `.zshrc`
|
||||
- **Rationale**: Easier maintenance, clearer purpose, selective loading
|
||||
- **Outcome**: Successful - easy to debug and extend
|
||||
|
||||
### Backup Philosophy
|
||||
- **Decision**: GPG-encrypted sensitive data with clear restore instructions
|
||||
- **Rationale**: Security without sacrificing recoverability
|
||||
- **Outcome**: Proven during system migrations
|
||||
|
||||
### Performance Optimization
|
||||
- **Decision**: Conditional loading and interactive-only checks
|
||||
- **Rationale**: Fast shell startup while maintaining functionality
|
||||
- **Outcome**: Sub-100ms shell startup achieved
|
||||
|
||||
## Future Considerations
|
||||
|
||||
### Potential Enhancements
|
||||
1. **Declarative configuration**: Consider Nix-like approach for reproducibility
|
||||
2. **Multi-machine sync**: Extend beyond single machine setup
|
||||
3. **Plugin ecosystem**: Create hook system for custom extensions
|
||||
4. **Metrics collection**: Track usage patterns for informed evolution
|
||||
|
||||
### Maintenance Schedule
|
||||
- **Quarterly**: Review and update Brewfile dependencies
|
||||
- **Semi-annual**: Audit shell performance and plugin necessity
|
||||
- **Annual**: Major architecture review and documentation update
|
||||
|
||||
## Key Metrics
|
||||
- **Shell startup time**: Target < 100ms
|
||||
- **Total managed packages**: ~120 CLI tools, ~40 applications
|
||||
- **Configuration files**: 15+ applications managed
|
||||
- **Backup frequency**: Daily automated, encrypted
|
||||
- **System health checks**: 6 categories monitored
|
||||
|
||||
## Guiding Quotes
|
||||
- "The best tools are the ones you forget you're using."
|
||||
- "Make it so!" - Captain Jean-Luc Picard
|
||||
- "Good tools become invisible."
|
||||
|
||||
---
|
||||
|
||||
*This document serves as the living memory of the dotfiles system evolution.*
|
||||
*Updated: 2025-07-29*
|
||||
@@ -28,7 +28,7 @@ italic_font Iosevka Term SS08
|
||||
bold_italic_font Iosevka Term SS08
|
||||
|
||||
# 16pt provides optimal readability on modern displays without strain
|
||||
font_size 16.0
|
||||
font_size 18.0
|
||||
|
||||
# Fallback fonts for symbols and special characters
|
||||
# This ensures proper rendering of powerline, nerd font icons, and unicode
|
||||
@@ -329,12 +329,19 @@ map cmd+k clear_terminal reset active
|
||||
# Reload configuration
|
||||
map kitty_mod+f5 load_config_file
|
||||
|
||||
# Window resizing - essential for split panes
|
||||
map kitty_mod+left resize_window narrower
|
||||
map kitty_mod+right resize_window wider
|
||||
map kitty_mod+up resize_window taller
|
||||
map kitty_mod+down resize_window shorter
|
||||
map kitty_mod+home resize_window reset
|
||||
|
||||
#: }}}
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# Design Rationale:
|
||||
#
|
||||
# 1. Font: Dank Mono chosen for clarity and tasteful ligatures
|
||||
# 1. Font: Iosevka Term SS08 has ultra-consistent rhythm, beautiful slant, clear punctuation
|
||||
# 2. Symbols: Comprehensive fallback chain for nerd fonts, powerline, unicode
|
||||
# 3. Colors: Dracula theme for proven readability and wide tool support
|
||||
# 4. Performance: Balanced settings that prioritize responsiveness
|
||||
|
||||
+12
-12
@@ -1,19 +1,19 @@
|
||||
# Antidote plugin manifest
|
||||
# Each line represents a plugin to be loaded by antidote
|
||||
|
||||
# Core functionality
|
||||
# Core enhancements
|
||||
romkatv/powerlevel10k
|
||||
zsh-users/zsh-completions
|
||||
zsh-users/zsh-autosuggestions
|
||||
zsh-users/zsh-syntax-highlighting
|
||||
zsh-users/zsh-completions
|
||||
|
||||
# Enhanced navigation and search
|
||||
junegunn/fzf path:shell/completion.zsh
|
||||
junegunn/fzf path:shell/key-bindings.zsh
|
||||
# Useful navigation & productivity
|
||||
rupa/z # Jump around directories
|
||||
djui/alias-tips # Show hints when alias could be used
|
||||
chisui/zsh-nix-shell # If using Nix at some point
|
||||
|
||||
# Git integration
|
||||
wfxr/forgit
|
||||
olivierverdier/zsh-git-prompt # Lightweight git aliases/completions
|
||||
|
||||
# Additional utilities
|
||||
zdharma-continuum/fast-syntax-highlighting
|
||||
MichaelAquilina/zsh-you-should-use
|
||||
# FZF integration (optional, only if you use fzf)
|
||||
unixorn/fzf-zsh-plugin
|
||||
|
||||
# Completions (optional, only if you reinstall these tools)
|
||||
# mullvad/mullvad-zsh-completions
|
||||
|
||||
@@ -127,6 +127,22 @@ if command -v zoxide >/dev/null; then
|
||||
eval "$(zoxide init zsh)"
|
||||
fi
|
||||
|
||||
# Add this section to your .zshrc after the tool integrations section
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# NODE VERSION MANAGEMENT
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
# NVM integration with lazy loading for performance
|
||||
[[ -f "$HOME/dotfiles/shell/nvm.zsh" ]] && source "$HOME/dotfiles/shell/nvm.zsh"
|
||||
|
||||
# Ensure claude-code is accessible (after nvm setup)
|
||||
if [[ -d "$HOME/.nvm/versions/node/v22.16.0/bin" ]] && [[ ! -v NVM_LOADED ]]; then
|
||||
# Add claude-code's Node bin to PATH as fallback
|
||||
# This ensures claude-code works even before nvm is fully loaded
|
||||
export PATH="$HOME/.nvm/versions/node/v22.16.0/bin:$PATH"
|
||||
fi
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# CUSTOM FUNCTIONS & ALIASES
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
# ░█▀█░█░░░▀█▀░█▀█░█▀▀░█▀▀░█▀▀
|
||||
# ░█▀█░█░░░░█░░█▀█░▀▀█░█▀▀░▀▀█
|
||||
# ░▀░▀░▀▀▀░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀▀▀
|
||||
|
||||
|
||||
alias gs='git status'
|
||||
alias kaicd='cd ~/Vault/08. Notes/Children/Kai'
|
||||
|
||||
## II. File checksum verification ##
|
||||
alias verify1='openssl sha1'
|
||||
alias verify256='openssl dgst -sha256'
|
||||
|
||||
## III. Easier navigation: .., ..., ...., and .....
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
alias ....="cd ../../.."
|
||||
alias .....="cd ../../../.."
|
||||
|
||||
## IV. Shortcuts
|
||||
alias dl="cd ~/Downloads"
|
||||
alias dt="cd ~/Desktop"
|
||||
alias docs="cd ~/Documents"
|
||||
|
||||
# use eza
|
||||
alias ls='eza --color=auto --group-directories-first --icons'
|
||||
alias ll='eza -lgh --git'
|
||||
alias la='eza -la --git'
|
||||
alias lt='eza --tree'
|
||||
|
||||
# use coreutils ls
|
||||
# alias ls='gls --color=auto'
|
||||
# List all files in long format
|
||||
# alias l="gls -lF --color=auto"
|
||||
# List all files in long format, excluding . and ..
|
||||
# alias la="gls -lAF --color=auto"
|
||||
# List only directories
|
||||
# alias lsd="gls -lF | grep --color=never '^d'"
|
||||
# alias ll='gls -lah --color=aut'
|
||||
|
||||
# view man pages with bat (replaced by enhanced man function in functions.zsh)
|
||||
# alias batman='man -P "bat -l man -p"'
|
||||
|
||||
# Get macOS Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages
|
||||
alias update="read -q 'REPLY?Run full system update? (y/n) ' && echo && sysupdate || echo 'Aborted.'"
|
||||
# Maintenance scripts
|
||||
alias mrclean='sudo periodic daily weekly monthly'
|
||||
# Download using cURL
|
||||
alias dl="curl -O"
|
||||
# yt-dlp at best quility and in .mp4 format
|
||||
alias yt="yt-dlp -S res,ext:mp4:m4a --recode mp4"
|
||||
# Internet speed test with Cloudfare CLI
|
||||
alias speed="npx speed-cloudflare-cli"
|
||||
# IP addresses
|
||||
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
|
||||
alias localip="ipconfig getifaddr en0"
|
||||
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
|
||||
# Clean up LaunchServices to remove duplicates in the “Open With” menu
|
||||
alias lscleanup="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder"
|
||||
# Recursively delete `.DS_Store` files
|
||||
alias cleanup="find . -type f -name '*.DS_Store' -ls -delete"
|
||||
# Empty the Trash on all mounted volumes and the main HDD.
|
||||
# Also, clear Apple’s System Logs to improve shell startup speed.
|
||||
# Finally, clear download history from quarantine. https://mths.be/bum
|
||||
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl; sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'"
|
||||
# Show/hide hidden files in Finder
|
||||
alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
|
||||
alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
|
||||
# Disable Spotlight
|
||||
alias spotoff="sudo mdutil -a -i off"
|
||||
# Enable Spotlight
|
||||
alias spoton="sudo mdutil -a -i on"
|
||||
# Lock the screen (when going AFK)
|
||||
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
|
||||
# Access quicklook from terminal
|
||||
alias ql="qlmanage -p "
|
||||
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
||||
|
||||
## Animal Rationis Capax
|
||||
# work session
|
||||
alias arc="cd /Users/davidglidden/Documents/GitHub/davidglidden.github.io && claude 'Context initialization:
|
||||
Please read these files in order:
|
||||
1. CLAUDE.md - Project instructions and workflow triggers
|
||||
2. docs/internal/collaboration-protocol.md - Our working relationship
|
||||
3. docs/internal/project-memory.md - Complete development history
|
||||
4. docs/chamber/workflow/MODE-1-UNIFIED.md - Current Chamber operations
|
||||
5. docs/style-guide.md - Editorial guidelines and notation system
|
||||
|
||||
After reading, confirm you understand the current state and are ready for today'\''s work.'"
|
||||
|
||||
# glimpse processing
|
||||
alias glimpse='cd ~/animal-davidglidden-eu/tools/glimpse-processing && source venv/bin/activate && python glimpse_tool.py'
|
||||
|
||||
## Tetris
|
||||
alias tetris='/opt/homebrew/opt/vitetris/bin/tetris'
|
||||
@@ -75,7 +75,6 @@ alias spoton="sudo mdutil -a -i on"
|
||||
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
|
||||
# Access quicklook from terminal
|
||||
alias ql="qlmanage -p "
|
||||
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
|
||||
|
||||
## Animal Rationis Capax
|
||||
# work session
|
||||
|
||||
@@ -1,228 +0,0 @@
|
||||
# ░█▀▀░█░█░█▀█░█▀▀░▀█▀░▀█▀░█▀█░█▀█░█▀▀
|
||||
# ░█▀▀░█░█░█░█░█░░░░█░░░█░░█░█░█░█░▀▀█
|
||||
# ░▀░░░▀▀▀░▀░▀░▀▀▀░░▀░░▀▀▀░▀▀▀░▀░▀░▀▀▀
|
||||
|
||||
## I. PDF Compression #######################
|
||||
pdfcompress ()
|
||||
{
|
||||
gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -dCompatibilityLevel=1.3 -dPDFSETTINGS=/screen -dEmbedAllFonts=true -dSubsetFonts=true -dColorImageDownsampleType=/Bicubic -dColorImageResolution=144 -dGrayImageDownsampleType=/Bicubic -dGrayImageResolution=144 -dMonoImageDownsampleType=/Bicubic -dMonoImageResolution=144 -sOutputFile=$1.compressed.pdf $1;
|
||||
}
|
||||
|
||||
## II. Weather #######################
|
||||
|
||||
wttr() {
|
||||
# Usage: wttr [location]
|
||||
# Examples: wttr -> your IP-based location
|
||||
# wttr 75012 -> Paris 12e
|
||||
# wttr 23190 -> Crozant
|
||||
local location=${1:-}
|
||||
curl -s "wttr.in/${location}?n"
|
||||
}
|
||||
|
||||
## III. Updates (system, brew, etc) #######################
|
||||
## Description: Performs system updates, Homebrew cleanup, fzf refresh, moon phase logging, and dotfile sync ###########################
|
||||
|
||||
function sysupdate() {
|
||||
local start_time=$(date +%s)
|
||||
echo "🔧 Starting full system update at $(date)"
|
||||
|
||||
# Ensure sudo credentials are fresh
|
||||
if ! sudo -vn 2>/dev/null; then
|
||||
echo "🔒 sudo authentication required..."
|
||||
sudo -v
|
||||
fi
|
||||
|
||||
echo "🍎 Updating macOS Software..."
|
||||
sudo softwareupdate -i -a
|
||||
|
||||
echo "🍺 Updating Homebrew packages..."
|
||||
brew update
|
||||
brew upgrade
|
||||
brew cleanup
|
||||
brew autoremove
|
||||
|
||||
# Mac App Store updates
|
||||
echo "🍎 Updating Mac App Store apps..."
|
||||
if command -v mas >/dev/null; then
|
||||
local mas_outdated=$(mas outdated)
|
||||
if [[ -n "$mas_outdated" ]]; then
|
||||
echo "📱 Updating MAS apps:"
|
||||
echo "$mas_outdated" | while read -r line; do
|
||||
echo " $line"
|
||||
done
|
||||
mas upgrade || echo "⚠️ Some MAS updates may require manual intervention"
|
||||
else
|
||||
echo "✅ All MAS apps are up to date"
|
||||
fi
|
||||
else
|
||||
echo "⚠️ mas not installed - install with: brew install mas"
|
||||
fi
|
||||
|
||||
echo "🔄 Refreshing fzf..."
|
||||
if [ -d ~/.fzf ]; then
|
||||
cd ~/.fzf && git pull && ./install --all && cd -
|
||||
fi
|
||||
|
||||
# Fix Zsh completion security warnings
|
||||
echo "🔒 Checking Zsh completion security..."
|
||||
if [[ -d "/opt/homebrew/share/zsh" ]]; then
|
||||
# Fix common Homebrew Zsh permission issues
|
||||
chmod 755 /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions 2>/dev/null || true
|
||||
fi
|
||||
|
||||
echo "🧹 Checking for broken symlinks..."
|
||||
find /usr/local/bin "$HOME/bin" "$HOME/.local/bin" -xtype l 2>/dev/null
|
||||
|
||||
echo "🌓 Moon phase at update time:"
|
||||
if command -v curl &>/dev/null && command -v jq >/dev/null; then
|
||||
# Use API key from SwiftBar script
|
||||
local api_key="6ec71a8170214d828c08ba8bf2ca29e9"
|
||||
moon_json=$(curl -s "https://api.ipgeolocation.io/astronomy?apiKey=$api_key" 2>/dev/null)
|
||||
if [[ $? -eq 0 ]] && [[ -n "$moon_json" ]]; then
|
||||
moon_phase=$(echo "$moon_json" | jq -r '.moon_phase // "Unknown"' | tr '_' ' ')
|
||||
illum=$(echo "$moon_json" | jq -r '.moon_illumination_percentage // "Unknown"')
|
||||
# Add moon emoji based on phase
|
||||
local moon_emoji="🌙"
|
||||
case "$moon_phase" in
|
||||
"new moon") moon_emoji="🌑" ;;
|
||||
"waxing crescent") moon_emoji="🌒" ;;
|
||||
"first quarter") moon_emoji="🌓" ;;
|
||||
"waxing gibbous") moon_emoji="🌔" ;;
|
||||
"full moon") moon_emoji="🌕" ;;
|
||||
"waning gibbous") moon_emoji="🌖" ;;
|
||||
"last quarter") moon_emoji="🌗" ;;
|
||||
"waning crescent") moon_emoji="🌘" ;;
|
||||
esac
|
||||
echo "$moon_emoji $moon_phase (${illum}%)"
|
||||
else
|
||||
echo "🌙 Moon phase unavailable"
|
||||
fi
|
||||
else
|
||||
echo "🌙 Moon phase tracking disabled (missing curl or jq)"
|
||||
fi
|
||||
|
||||
if [ -d "$HOME/.dotfiles" ]; then
|
||||
echo "📝 Committing dotfile changes..."
|
||||
cd ~/.dotfiles || return
|
||||
git add . && git commit -m "🔧 Auto-commit from sysupdate on $(date '+%Y-%m-%d %H:%M')" && git push
|
||||
brew bundle dump --force --file="$HOME/.dotfiles/Brewfile"
|
||||
cd - >/dev/null || return
|
||||
fi
|
||||
|
||||
echo "📊 System Info:"
|
||||
echo "💻 $(uname -a)"
|
||||
echo "📅 macOS: $(sw_vers | grep ProductVersion)"
|
||||
echo "🧠 Memory: $(top -l 1 -s 0 | grep PhysMem)"
|
||||
|
||||
# Optional post-update hook
|
||||
if [ -x "$HOME/.zsh/hooks/post-update" ]; then
|
||||
"$HOME/.zsh/hooks/post-update"
|
||||
fi
|
||||
|
||||
echo "🕓 Duration: $(($(date +%s) - $start_time))s"
|
||||
osascript -e 'display notification "Update complete!" with title "System Maintenance" subtitle "All systems go 🚀"'
|
||||
}
|
||||
|
||||
# 💤 Quiet version (no output, same functionality)
|
||||
function quietupdate() {
|
||||
local start_time=$(date +%s)
|
||||
sudo -vn 2>/dev/null || sudo -v
|
||||
sudo softwareupdate -i -a >/dev/null
|
||||
brew update >/dev/null && brew upgrade >/dev/null && brew cleanup >/dev/null && brew autoremove >/dev/null
|
||||
[ -d ~/.fzf ] && cd ~/.fzf && git pull >/dev/null && ./install --all >/dev/null && cd - >/dev/null
|
||||
[ -d "$HOME/.dotfiles" ] && cd ~/.dotfiles && git add . && git commit -m "auto sysupdate" && git push && brew bundle dump --force --file="$HOME/.dotfiles/Brewfile" && cd - >/dev/null
|
||||
if [ -x "$HOME/.zsh/hooks/post-update" ]; then "$HOME/.zsh/hooks/post-update"; fi
|
||||
osascript -e 'display notification "Quiet update complete!" with title "System Maintenance"'
|
||||
}
|
||||
|
||||
## IV. Enhanced Man Page Viewer #######################
|
||||
|
||||
# Detect current terminal for optimal display
|
||||
detect_terminal() {
|
||||
if [[ -n "${KITTY_WINDOW_ID-}" ]]; then
|
||||
echo "kitty"
|
||||
elif [[ -n "${ITERM_SESSION_ID-}" ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||
echo "iterm"
|
||||
elif [[ "$TERM_PROGRAM" == "kitty" ]]; then
|
||||
echo "kitty"
|
||||
else
|
||||
echo "unknown"
|
||||
fi
|
||||
}
|
||||
|
||||
# Enhanced man function with beautiful formatting in new window
|
||||
man() {
|
||||
# If no arguments, show usage
|
||||
if [[ $# -eq 0 ]]; then
|
||||
echo "Usage: man <command> [section]"
|
||||
echo "Opens beautifully formatted man page in new terminal window"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local cmd="$1"
|
||||
local section="${2:-}"
|
||||
local terminal_type=$(detect_terminal)
|
||||
|
||||
# Check if man page exists
|
||||
if ! command man -w ${section:+$section} "$cmd" >/dev/null 2>&1; then
|
||||
echo "❌ No manual entry for '$cmd'${section:+ in section $section}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Build the command to run in new window
|
||||
local man_cmd
|
||||
if command -v bat >/dev/null; then
|
||||
# Use bat for beautiful syntax highlighting with Nord theme
|
||||
man_cmd="MANPAGER='bat --language=man --style=grid --color=always --theme=Nord' man ${section:+$section} '$cmd'"
|
||||
else
|
||||
# Fallback to enhanced less
|
||||
man_cmd="MANPAGER='less -R' man ${section:+$section} '$cmd'"
|
||||
fi
|
||||
|
||||
# Terminal-specific window creation
|
||||
case "$terminal_type" in
|
||||
"kitty")
|
||||
# Kitty: New window with optimal size for reading
|
||||
kitty @ new-window --title "📖 man $cmd${section:+ ($section)}" --cwd "$PWD" \
|
||||
zsh -c "$man_cmd; echo; echo '📖 Press any key to close...'; read -k1"
|
||||
;;
|
||||
"iterm")
|
||||
# iTerm2: New window with AppleScript
|
||||
osascript -e "
|
||||
tell application \"iTerm\"
|
||||
create window with default profile
|
||||
tell current session of current window
|
||||
write text \"$man_cmd; echo; echo '📖 Press any key to close...'; read -k1\"
|
||||
set name to \"📖 man $cmd${section:+ ($section)}\"
|
||||
end tell
|
||||
end tell
|
||||
" >/dev/null 2>&1
|
||||
;;
|
||||
*)
|
||||
# Fallback: run in current terminal with nice formatting
|
||||
echo "📖 Displaying man page for '$cmd'${section:+ (section $section)}:"
|
||||
echo ""
|
||||
eval "$man_cmd"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Quick man page search function
|
||||
mans() {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
echo "Usage: mans <search_term>"
|
||||
echo "Search for man pages containing the term"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "🔍 Searching man pages for: $*"
|
||||
echo ""
|
||||
|
||||
# Use apropos to search, format nicely
|
||||
if command -v bat >/dev/null; then
|
||||
apropos "$*" | bat --language=man --style=plain --theme=Nord
|
||||
else
|
||||
apropos "$*"
|
||||
fi
|
||||
}
|
||||
|
||||
+144
-66
@@ -135,96 +135,174 @@ function quietupdate() {
|
||||
osascript -e 'display notification "Quiet update complete!" with title "System Maintenance"'
|
||||
}
|
||||
|
||||
## IV. Enhanced Man Page Viewer #######################
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# Man Page side-by-side viewer
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
# Detect current terminal for optimal display
|
||||
detect_terminal() {
|
||||
if [[ -n "${KITTY_WINDOW_ID-}" ]]; then
|
||||
echo "kitty"
|
||||
elif [[ -n "${ITERM_SESSION_ID-}" ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
|
||||
echo "iterm"
|
||||
elif [[ "$TERM_PROGRAM" == "kitty" ]]; then
|
||||
echo "kitty"
|
||||
else
|
||||
echo "unknown"
|
||||
fi
|
||||
# Detailed Kitty diagnostic
|
||||
debug_kitty_launch() {
|
||||
echo "=== Kitty Launch Debugging ==="
|
||||
|
||||
# Check basic remote control
|
||||
echo "1. Testing basic remote control:"
|
||||
kitty @ ls
|
||||
echo " Exit code: $?"
|
||||
|
||||
# Test simple launch
|
||||
echo -e "\n2. Testing simple window launch:"
|
||||
kitty @ launch --type=window echo "Hello from new window"
|
||||
echo " Exit code: $?"
|
||||
|
||||
# Test with bash -c
|
||||
echo -e "\n3. Testing bash -c launch:"
|
||||
kitty @ launch --type=window bash -c "echo 'Hello with bash -c'"
|
||||
echo " Exit code: $?"
|
||||
|
||||
# Test overlay
|
||||
echo -e "\n4. Testing overlay:"
|
||||
kitty @ launch --type=overlay bash -c "echo 'Overlay test'; read -p 'Press enter to close'"
|
||||
echo " Exit code: $?"
|
||||
|
||||
# Test with actual man command
|
||||
echo -e "\n5. Testing with man command:"
|
||||
kitty @ launch --type=window bash -c "man ls"
|
||||
echo " Exit code: $?"
|
||||
}
|
||||
|
||||
# Enhanced man function with beautiful formatting in new window
|
||||
# Test the absolute simplest case
|
||||
test_basic_split() {
|
||||
echo "Testing basic split with sleep..."
|
||||
kitty @ launch --location=vsplit sleep 5
|
||||
echo "Exit code: $?"
|
||||
}
|
||||
|
||||
# Beautiful man pages in resizable split pane
|
||||
man() {
|
||||
# If no arguments, show usage
|
||||
if [[ $# -eq 0 ]]; then
|
||||
echo "Usage: man <command> [section]"
|
||||
echo "Opens beautifully formatted man page in new terminal window"
|
||||
echo "Opens man page in resizable split pane (kitty/tmux) or new tab (iTerm)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local cmd="$1"
|
||||
local section="${2:-}"
|
||||
local terminal_type=$(detect_terminal)
|
||||
|
||||
# Check if man page exists
|
||||
if ! command man -w ${section:+$section} "$cmd" >/dev/null 2>&1; then
|
||||
# Verify man page exists
|
||||
if ! /usr/bin/man -w ${section:+$section} "$cmd" >/dev/null 2>&1; then
|
||||
echo "❌ No manual entry for '$cmd'${section:+ in section $section}"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Build the command to run in new window
|
||||
local man_cmd
|
||||
# Ensure we have the full path to bat for new shell contexts
|
||||
# Build the display command that stays open and adapts to terminal width
|
||||
local display_cmd
|
||||
local bat_path=$(which bat 2>/dev/null)
|
||||
if [[ -n "$bat_path" ]]; then
|
||||
# Use bat for beautiful syntax highlighting with Nord theme
|
||||
man_cmd="export PATH=\"$PATH\"; MANPAGER='$bat_path --language=man --style=grid --color=always --theme=Nord' man ${section:+$section} '$cmd'"
|
||||
# Use bat with terminal width detection and better wrapping
|
||||
display_cmd="export PATH=\"$PATH\"; export MANWIDTH=\$(tput cols); /usr/bin/man ${section:+$section} '$cmd' 2>/dev/null | col -bx | '$bat_path' --language=man --style=grid --theme=Nord --paging=always --terminal-width=\$(tput cols) --wrap=auto; echo; echo 'Press any key to close...'; read -k1"
|
||||
else
|
||||
# Fallback to enhanced less
|
||||
man_cmd="export PATH=\"$PATH\"; MANPAGER='less -R' man ${section:+$section} '$cmd'"
|
||||
# Fallback with responsive width
|
||||
display_cmd="export MANWIDTH=\$(tput cols); MANPAGER='less -R' /usr/bin/man ${section:+$section} '$cmd'; echo; echo 'Press any key to close...'; read -k1"
|
||||
fi
|
||||
|
||||
# Terminal-specific window creation
|
||||
case "$terminal_type" in
|
||||
"kitty")
|
||||
# Kitty: New window with optimal size for reading
|
||||
kitty @ new-window --title "📖 man $cmd${section:+ ($section)}" --cwd "$PWD" \
|
||||
zsh -c "$man_cmd; echo; echo '📖 Press any key to close...'; read -k1"
|
||||
;;
|
||||
"iterm")
|
||||
# iTerm2: New window with AppleScript
|
||||
osascript -e "
|
||||
tell application \"iTerm\"
|
||||
create window with default profile
|
||||
tell current session of current window
|
||||
write text \"$man_cmd; echo; echo '📖 Press any key to close...'; read -k1\"
|
||||
set name to \"📖 man $cmd${section:+ ($section)}\"
|
||||
# Handle different terminals - always use split/resizable approach
|
||||
if [[ -n "${KITTY_WINDOW_ID:-}" ]]; then
|
||||
# Kitty: Create optimally-sized vertical split
|
||||
# Left pane: ~100 chars for code, Right pane: ~64 chars for optimal reading
|
||||
kitty @ launch \
|
||||
--location=vsplit \
|
||||
--title="📖 $cmd${section:+ ($section)}" \
|
||||
--cwd=current \
|
||||
--bias=60 \
|
||||
zsh -c "$display_cmd" >/dev/null
|
||||
elif [[ -n "${TMUX:-}" ]]; then
|
||||
# TMUX: Create resizable horizontal split (easier to read)
|
||||
tmux split-window -v -l 40% "$display_cmd"
|
||||
elif [[ "${TERM_PROGRAM}" == "iTerm.app" ]]; then
|
||||
# iTerm: Create new split pane
|
||||
osascript -e "
|
||||
tell application \"iTerm\"
|
||||
tell current window
|
||||
tell current session
|
||||
split vertically with default profile
|
||||
tell last session
|
||||
write text \"$display_cmd\"
|
||||
set name to \"📖 $cmd${section:+ ($section)}\"
|
||||
end tell
|
||||
end tell
|
||||
" >/dev/null 2>&1
|
||||
;;
|
||||
*)
|
||||
# Fallback: run in current terminal with nice formatting
|
||||
echo "📖 Displaying man page for '$cmd'${section:+ (section $section)}:"
|
||||
echo ""
|
||||
eval "$man_cmd"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Quick man page search function
|
||||
mans() {
|
||||
if [[ $# -eq 0 ]]; then
|
||||
echo "Usage: mans <search_term>"
|
||||
echo "Search for man pages containing the term"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "🔍 Searching man pages for: $*"
|
||||
echo ""
|
||||
|
||||
# Use apropos to search, format nicely
|
||||
if command -v bat >/dev/null; then
|
||||
apropos "$*" | bat --language=man --style=plain --theme=Nord
|
||||
end tell
|
||||
end tell
|
||||
" >/dev/null 2>&1
|
||||
else
|
||||
apropos "$*"
|
||||
# Fallback: run inline
|
||||
echo "📖 Displaying man page inline:"
|
||||
eval "$display_cmd"
|
||||
fi
|
||||
}
|
||||
|
||||
# batman is already aliased to man in aliases.zsh
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
# DOTFILES MANAGEMENT FUNCTIONS
|
||||
# ═══════════════════════════════════════════════════════════════════════════════
|
||||
|
||||
# Quick navigation to dotfiles directory
|
||||
dot() {
|
||||
cd ~/dotfiles
|
||||
[[ $# -gt 0 ]] && "$@"
|
||||
}
|
||||
|
||||
# Quick edit common configs with automatic reload
|
||||
zedit() {
|
||||
${EDITOR:-nano} ~/.zshrc && source ~/.zshrc
|
||||
echo "✅ .zshrc reloaded"
|
||||
}
|
||||
|
||||
aedit() {
|
||||
${EDITOR:-nano} ~/dotfiles/shell/aliases.zsh && source ~/.zshrc
|
||||
echo "✅ aliases reloaded"
|
||||
}
|
||||
|
||||
fedit() {
|
||||
${EDITOR:-nano} ~/dotfiles/shell/functions.zsh && source ~/.zshrc
|
||||
echo "✅ functions reloaded"
|
||||
}
|
||||
|
||||
pedit() {
|
||||
${EDITOR:-nano} ~/dotfiles/shell/paths.zsh && source ~/.zshrc
|
||||
echo "✅ paths reloaded"
|
||||
}
|
||||
|
||||
# Backup critical configs with timestamp
|
||||
backup-configs() {
|
||||
local backup_dir="$HOME/.config-backups/$(date +%Y%m%d-%H%M%S)"
|
||||
mkdir -p "$backup_dir"
|
||||
|
||||
echo "📦 Backing up critical configs to: $backup_dir"
|
||||
|
||||
# SSH keys (if they exist)
|
||||
if [[ -d ~/.ssh ]]; then
|
||||
cp -R ~/.ssh "$backup_dir/" 2>/dev/null || true
|
||||
echo " ✓ SSH configuration"
|
||||
fi
|
||||
|
||||
# Shell history
|
||||
if [[ -f ~/.zsh_history ]]; then
|
||||
cp ~/.zsh_history "$backup_dir/" 2>/dev/null || true
|
||||
echo " ✓ Shell history"
|
||||
fi
|
||||
|
||||
# GPG keys (if they exist)
|
||||
if [[ -d ~/.gnupg ]]; then
|
||||
cp -R ~/.gnupg "$backup_dir/" 2>/dev/null || true
|
||||
echo " ✓ GPG configuration"
|
||||
fi
|
||||
|
||||
# AWS credentials (if they exist)
|
||||
if [[ -d ~/.aws ]]; then
|
||||
cp -R ~/.aws "$backup_dir/" 2>/dev/null || true
|
||||
echo " ✓ AWS configuration"
|
||||
fi
|
||||
|
||||
echo "✅ Configs backed up to: $backup_dir"
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
# ░█▀█░█░█░█▄█
|
||||
# ░█░█░▀▄▀░█░█
|
||||
# ░▀░▀░░▀░░▀░▀
|
||||
# Node Version Manager configuration - Simplified & Robust
|
||||
|
||||
# NVM directory
|
||||
export NVM_DIR="${HOME}/.nvm"
|
||||
|
||||
# Add claude-code's specific Node version to PATH
|
||||
# This ensures claude-code always works without complexity
|
||||
if [[ -d "$HOME/.nvm/versions/node/v22.16.0/bin" ]]; then
|
||||
export PATH="$HOME/.nvm/versions/node/v22.16.0/bin:$PATH"
|
||||
fi
|
||||
|
||||
# Lazy load nvm for better shell startup performance
|
||||
nvm() {
|
||||
# Remove this function
|
||||
unset -f nvm
|
||||
|
||||
# Load the real nvm
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
|
||||
[ -s "$NVM_DIR/bash_completion" ] && source "$NVM_DIR/bash_completion"
|
||||
|
||||
# Call nvm with the original arguments
|
||||
nvm "$@"
|
||||
}
|
||||
|
||||
# Aliases for when you need to use nvm
|
||||
alias nvm-load='unset -f nvm; [ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"'
|
||||
alias nvm-claude='nvm use 22.16.0'
|
||||
alias node-homebrew='/opt/homebrew/bin/node'
|
||||
alias npm-homebrew='/opt/homebrew/bin/npm'
|
||||
|
||||
# Quick check if we're in a project with .nvmrc
|
||||
check_nvmrc() {
|
||||
if [[ -f .nvmrc ]] && [[ -z "${NVM_BIN}" ]]; then
|
||||
echo "📦 .nvmrc detected. Run 'nvm-load && nvm use' to switch Node version"
|
||||
fi
|
||||
}
|
||||
|
||||
# Hook to check for .nvmrc on directory change
|
||||
if [[ -n "$ZSH_VERSION" ]]; then
|
||||
autoload -U add-zsh-hook
|
||||
add-zsh-hook chpwd check_nvmrc
|
||||
# Check current directory on shell start
|
||||
check_nvmrc
|
||||
fi
|
||||
Reference in New Issue
Block a user