Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
285 changes: 285 additions & 0 deletions DOTFILES_IMPROVEMENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,285 @@
# Dotfiles Repository Improvements

## Overview
Your dotfiles repository has a solid foundation with support for multiple tools (zsh, vim, tmux, git) and cross-platform compatibility (macOS and Linux). Here are suggested improvements organized by category.

## 🚀 Quick Wins

### 1. **Fix Duplicate Vim Settings**
In `vim/vimrc.symlink`, lines 88-89 and 108-109 duplicate the same settings:
```vim
" Allow per directory .vimrc configurations.
set exrc
set secure
```
Remove the second occurrence.

### 2. **Consolidate PATH Exports in zshrc**
You have many individual PATH exports that could be consolidated. Consider using an array approach:
```bash
# Define all paths in an array
typeset -U path_additions=(
"$HOME/bin"
"$HOME/.dotfiles/bin"
"$HOME/.composer/vendor/bin"
"$HOME/.config/composer/vendor/bin"
"$HOME/.yarn/bin"
"$HOME/.nvm"
"$HOME/.pub-cache/bin"
"$HOME/bin/google-cloud-sdk/bin"
)

# Add them to PATH in one go
for p in $path_additions; do
[[ -d "$p" ]] && PATH="$p:$PATH"
done
export PATH
```

### 3. **Add Missing Git Configurations**
Consider adding these useful git settings:
```gitconfig
[pull]
rebase = true
[fetch]
prune = true
[init]
defaultBranch = main
[rebase]
autoStash = true
```

## 📁 Structure & Organization

### 4. **Create a Proper Installation System**
Instead of a single bootstrap script, consider a modular approach:
```
script/
├── bootstrap # Main entry point
├── install/
│ ├── common.sh # Common functions
│ ├── macos.sh # macOS-specific
│ ├── linux.sh # Linux-specific
│ ├── node.sh # Node.js setup
│ ├── php.sh # PHP setup
│ └── vim.sh # Vim plugins
└── uninstall # Cleanup script
```

### 5. **Add Configuration for Modern Tools**
Create configurations for tools you're already installing:
- `starship/starship.toml` - Consider migrating from spaceship to Starship (faster, more features)
- `gh/config.yml` - GitHub CLI configuration
- `fzf/` - FZF configuration and key bindings

## 🔧 Functionality Improvements

### 6. **Enhance ZSH Configuration**
```bash
# Add these useful options to zshrc
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_VERIFY
setopt SHARE_HISTORY
setopt APPEND_HISTORY

# Better history settings
HISTSIZE=50000
SAVEHIST=50000

# Add useful functions
mkcd() { mkdir -p "$@" && cd "$_"; }
```

### 7. **Improve Vim Configuration**
```vim
" Add persistent undo
set undofile
set undodir=~/.vim/undo

" Better search settings
set ignorecase
set smartcase

" Modern clipboard integration
set clipboard=unnamedplus

" Consider migrating to vim-plug's on-demand loading
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
```

### 8. **Enhance Tmux Configuration**
```tmux
# Add mouse support (modern tmux)
set -g mouse on

# Better status bar
set -g status-interval 1
set -g status-position top

# Automatic window renaming
set-option -g automatic-rename on
set-option -g automatic-rename-format '#{b:pane_current_path}'

# Plugin manager (TPM)
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
```

## 🛡️ Security & Best Practices

### 9. **Add Security Checks**
```bash
# In bootstrap script
check_command() {
if ! command -v "$1" &> /dev/null; then
echo "❌ $1 is required but not installed."
return 1
fi
return 0
}

# Verify checksums for downloaded files
verify_checksum() {
local file=$1
local expected=$2
local actual=$(sha256sum "$file" | cut -d' ' -f1)
[[ "$actual" == "$expected" ]]
}
```

### 10. **Environment Variable Management**
Create an `env/` directory for environment-specific configs:
```
env/
├── exports.zsh # Common exports
├── path.zsh # PATH management
├── aliases.zsh # All aliases
└── functions.zsh # Custom functions
```

## 🎯 Platform-Specific Improvements

### 11. **Better Cross-Platform Support**
```bash
# In zshrc
case "$OSTYPE" in
darwin*)
source "$HOME/.dotfiles/zsh/macos.zsh"
;;
linux*)
source "$HOME/.dotfiles/zsh/linux.zsh"
;;
esac
```

### 12. **Conditional Tool Loading**
```bash
# Only load tool configs if they exist
[[ -f "$HOME/.cargo/env" ]] && source "$HOME/.cargo/env"
[[ -d "$HOME/.pyenv" ]] && eval "$(pyenv init -)"
command -v direnv &>/dev/null && eval "$(direnv hook zsh)"
```

## 📚 Documentation

### 13. **Improve README**
- Add installation instructions
- Document available commands/aliases
- Add screenshots of the setup
- Include troubleshooting section
- Add requirements/dependencies table

### 14. **Add Tool-Specific Documentation**
Create README files in each tool directory explaining:
- What the configuration does
- Key bindings/shortcuts
- Customization options

## 🔄 Maintenance

### 15. **Add Update Mechanism**
```bash
# script/update
#!/bin/bash
echo "🔄 Updating dotfiles..."
git pull origin main

# Update submodules
git submodule update --init --recursive

# Update Oh My Zsh
$ZSH/tools/upgrade.sh

# Update vim plugins
vim +PlugUpdate +qall

# Update global npm packages
npm update -g
```

### 16. **Version Management**
- Pin specific versions in bootstrap script
- Use `.tool-versions` for asdf/mise
- Document minimum version requirements

## 🎨 Modern Alternatives

Consider these modern alternatives to current tools:
- **zsh-autosuggestions** → Better command completion
- **zsh-completions** → More completions
- **exa/eza** → Modern replacement for ls
- **bat** → Cat with syntax highlighting
- **ripgrep** → Faster than ag
- **fd** → Faster find
- **delta** → Better git diff
- **lazygit** → Terminal UI for git

## 🔍 Additional Suggestions

### 17. **Add Debugging Support**
```bash
# Add to zshrc
export DOTFILES_DEBUG="${DOTFILES_DEBUG:-0}"
debug() {
[[ "$DOTFILES_DEBUG" == "1" ]] && echo "DEBUG: $*"
}
```

### 18. **Create Backup System**
Before making changes, backup existing configs:
```bash
backup_file() {
local file=$1
if [[ -e "$file" ]]; then
cp "$file" "$file.backup.$(date +%Y%m%d_%H%M%S)"
fi
}
```

### 19. **Add Health Check**
```bash
# script/doctor
#!/bin/bash
echo "🏥 Checking dotfiles health..."
# Check symlinks
# Verify installations
# Test configurations
```

### 20. **Performance Optimization**
- Lazy load NVM (it's slow to initialize)
- Use `zsh-defer` for non-critical sourcing
- Profile zsh startup with `zprof`

## 📝 Next Steps

1. Start with quick wins (1-3)
2. Gradually implement structural improvements
3. Add documentation as you go
4. Test changes on both macOS and Linux
5. Consider using GNU Stow for symlink management

This improvement plan balances immediate fixes with long-term enhancements while maintaining your existing workflow.
Loading