Nathan Ormond dotfiles env set up. Should be cross-platform. Currently supports:
- macOS
- Linux (WSL Ubuntu)
environments.
This dotfiles repository provides a consistent development environment across different operating systems. It features:
- Modular configuration with platform-specific settings
- Cross-platform clipboard support
- Unified package management approach
- Automatic installation and configuration
- Enhanced terminal experience with tmux and ZSH
# 1. Clone the repository
# (a)
git clone git@github.com:NathOrmond/dotfiles.git ~/Dev/dotfiles
# (b)
git clone https://github.com/NathOrmond/dotfiles.git ~/Dev/dotfiles
# 2. Make the install script executable
chmod +x ~/Dev/dotfiles/install.sh
# 3. Run the installation script
cd ~/Dev/dotfiles && ./install.sh
The installation script will:
- Detect your platform (macOS or Linux)
- Create necessary symbolic links
- Install required packages and dependencies
- Configure your shell environment
- Set up tmux with custom keybindings
- Create a secrets directory at
~/afterzsh
(not tracked by git) - Install ZSH plugins and tmux plugins automatically
To manually update your configurations:
cd ~/Dev/dotfiles
git pull
chmod +x ./install.sh # Ensure script is executable
./install.sh
~/Dev/dotfiles/
├── .config/ # Configuration files for various tools
│ ├── nvim/ # Neovim configuration
│ ├── alacritty/ # Alacritty terminal configuration
│ ├── lazygit/ # Lazygit configuration
│ └── starship/ # Starship prompt configuration
├── zsh/ # ZSH configurations
│ ├── common.zsh # Common ZSH settings
│ ├── mac.zsh # macOS-specific settings
│ └── linux.zsh # Linux-specific settings
├── packages/ # Package management
│ └── packages.zsh # Cross-platform package installer
├── scripts/ # Helper scripts
│ ├── backup-dotfiles.sh # Backup dotfiles
│ ├── conda-setup.sh # Conda installation and setup
│ ├── debug-info.sh # Print debugging information
│ ├── fix-permissions.sh # Fix script permissions
│ ├── install-tmux-plugins.sh # Automate tmux plugin installation
│ ├── jupyter-aliases.sh # Jupyter notebook helpers
│ ├── restore-commit.sh # Restore dotfiles to a specific commit
│ ├── setup-plugins.sh # Install ZSH plugins
│ └── test-dotfiles.sh # Test dotfiles functionality
├── backup/ # Backup directory for original files
├── .zshrc # Main ZSH configuration (sources modular files)
├── .tmux.conf # TMUX configuration
├── .gitconfig # Git configuration
├── .vimrc # Vim configuration
└── install.sh # Installation script
The system automatically detects your platform and applies the appropriate settings:
if [[ "$(uname)" == "Darwin" ]]; then
export PLATFORM="mac"
source "$DOTFILES/zsh/mac.zsh"
elif [[ "$(uname)" == "Linux" ]]; then
export PLATFORM="linux"
source "$DOTFILES/zsh/linux.zsh"
fi
The dotfiles include a collection of helper scripts in the scripts/
directory:
-
backup-dotfiles.sh: Creates a timestamped backup of your dotfiles
-
conda-setup.sh: Installs and configures Conda for your platform
-
debug-info.sh: Prints debugging information about your setup
-
fix-permissions.sh: Ensures all scripts have proper executable permissions
-
install-tmux-plugins.sh: Automatically installs tmux plugins without user interaction
- jupyter-aliases.sh: Provides helper functions for Jupyter notebooks
- restore-commit.sh: Restores dotfiles to a specific Git commit
- setup-plugins.sh: Installs and updates ZSH plugins
- test-dotfiles.sh: Comprehensive test suite for dotfiles functionality
Run any of these scripts directly:
~/Dev/dotfiles/scripts/test-dotfiles.sh
~/Dev/dotfiles/scripts/fix-permissions.sh
### Anaconda/Conda Setup
The dotfiles provide automated cross-platform Conda installation:
- **macOS**: Installs via Homebrew
- **Linux/WSL**: Downloads and installs the latest Anaconda distribution
During installation, you'll be prompted to install Conda if it's not already
present. You can also manually run the Conda setup script:
```bash
~/Dev/dotfiles/scripts/conda-setup.sh --install
This will:
- Check if Conda is already installed
- Install Conda using the appropriate method for your platform
- Configure channels and base environments
- Optionally create a fastai environment
To use Jupyter notebooks in WSL, several helper functions are provided:
# Start Jupyter notebook without browser on default port 8888
jup
# Start Jupyter with custom port
jup 9999
# Start Jupyter in specific directory
jup 8888 ~/projects/data-science
# Create symlink to Windows Documents folder
jup-link
# Setup a complete Jupyter environment with common packages
jup-setup
Additional aliases:
jnb
: Start Jupyter notebook (no browser in WSL)jlab
: Start Jupyter lab (no browser in WSL)notebooks-link
: Create symlink to Windows documents
For convenient access to Windows files, the jup-link
command will create
a symlink to your Windows Documents folder:
# This creates a symlink from your Windows Documents to ~/notebooks
jup-link
# Then start Jupyter with access to these files
jup 8888 ~/notebooks
The dotfiles include a comprehensive vim configuration with cross-platform support:
- Modern UI: Line numbers, syntax highlighting, cursor line
- Enhanced Navigation: Window navigation with Ctrl+h/j/k/l
- Smart Search: Case-insensitive, highlighting, incremental
- Code Friendly: Auto-indent, smart tab handling
- Cross-Platform Clipboard: Works on macOS, Linux, and WSL
,<space>
: Clear search highlighting,w
: Quick save,q
: Quick quit,x
: Save and quit,r
: Reload vimrc,y
: Copy to system clipboard,p
: Paste from system clipboard
Use copy
and paste
commands consistently across platforms:
- macOS: Uses native
pbcopy
andpbpaste
- Linux: Uses
xclip
(installed automatically if missing) - WSL: Falls back to
clip.exe
and PowerShell for clipboard access
Example usage:
# Copy directory listing to clipboard
ls -la | copy
# Paste clipboard content
paste > output.txt
# Copy a string to clipboard
echo "test string" | copy
The system provides unified package installation across platforms:
- macOS: Uses Homebrew via
brew install
- Linux: Uses apt via
apt-get install
Use the install-pkg
function for cross-platform installation:
install-pkg git
install-pkg tmux
cdev # cd to $HOME/Dev
cdev-vivacity # cd to $DEV_VIVACITY
cdotfiles # cd to $DEV/dotfiles
cd-secrets # cd to $HOME/afterzsh
notes # cd to $NOTES
gs # git status
ga # git add
gc # git commit
gp # git push
gl # git pull
c # clear terminal
hgrep # history | grep
please # sudo (alias for politeness)
notes-push # quick command to commit and push notes
The tmux configuration includes several customisations:
- Prefix:
Ctrl+Space
(instead of defaultCtrl+b
) - Pane Navigation:
Prefix + h/j/k/l
: Navigate panes (left/down/up/right)Prefix + "
: Split pane verticallyPrefix + %
: Split pane horizontally
- Window Management:
Prefix + c
: Create new windowPrefix + n/p
: Next/previous windowPrefix + ,
: Rename window
- Special Features:
- Focus tracking changes pane borders (green when focused, red when unfocused)
tmux-all [command]
: Run a command in all tmux panes
The dotfiles include a comprehensive test script that verifies your setup is working correctly:
# Run the test script
~/Dev/dotfiles/scripts/test-dotfiles.sh
This will check:
- Directory structure and file permissions
- Symlink configuration
- Platform detection
- ZSH plugins and tmux setup
- Vim clipboard support
- Conda installation
- Clipboard functionality
The test provides clear feedback on what's working and what might need attention.
Run commands in all tmux panes simultaneously:
tmux-all ls -la # Run ls -la in all panes
tmux-all cd ~/Dev # Change directory in all panes
Cross-platform package installation:
install-pkg python3 # Installs python3 using the appropriate package manager
- Git (required for initial installation)
- ZSH shell
- Administrative privileges for package installation
- Homebrew will be installed if not present
- XCode Command Line Tools are required (will be prompted to install if missing)
- Ubuntu-based distribution assumed
apt
package managersudo
access required for package installation
The system expects:
$HOME/Dev/dotfiles
: Location of this repository$HOME/afterzsh
: Location for custom, machine-specific aliases and secrets$HOME/Documents/obsidian-vault
: Default location for notes (customize as needed)
The dotfiles use a dedicated directory structure for secrets and machine-specific configurations:
$HOME/afterzsh/ # Directory for secrets and local configurations
├── aliases.sh # Machine-specific aliases
├── secrets.sh # API keys, tokens, and other secrets
├── work.sh # Work-specific settings
├── jupyter-aliases.sh # Jupyter notebook helpers
└── ... # Other local configuration files
Key benefits of this approach:
- Keeps sensitive information out of the git repository
- Allows for machine-specific customisations
- Automatically sourced by .zshrc
at startup
The main .zshrc
sources these files at the end of its execution:
# Source secrets and custom configurations
export LOCAL_SECRETS="$HOME/afterzsh"
if [[ -f "$LOCAL_SECRETS/aliases.sh" ]]; then
source "$LOCAL_SECRETS/aliases.sh"
print_status "Custom Aliases" "enabled"
fi
Important Notes:
- The install.sh
script automatically creates the
~/afterzsh
directory if it doesn't exist
- It also creates a template secrets.sh
file for you
to add your sensitive information
- The full path is displayed during installation so
you know exactly where to put your secrets
- NEVER commit the contents of the ~/afterzsh
directory to git
Best practices for using afterzsh:
- Store API keys, tokens, and passwords in
secrets.sh
- Add machine-specific PATH adjustments in
aliases.sh
- Keep work-specific configurations separate
in their own files
- Use secrets.sh
for information that
shouldn't be in a public repository
Add machine-specific configurations without modifying the repository:
- Create or edit
$HOME/afterzsh/aliases.sh
- Add your custom aliases, functions, or environment variables
- These will be automatically sourced when you start a new shell
To add support for new tools:
- Add configuration files to the appropriate directory within
.config/
- Update the
install.sh
script to create the necessary symlinks - If needed, add package installation to platform-specific scripts
If a tool is reported as "not found" during startup:
- Check if the package is installed using your package manager
- Verify that the package is in your PATH
- For manual installation:
install-pkg [package-name]
If you encounter issues during installation:
- Make sure the install script is executable:
chmod +x ~/Dev/dotfiles/install.sh
- If you get "Permission denied" errors:
# Fix permissions for all scripts
~/Dev/dotfiles/scripts/fix-permissions.sh
- If you're on WSL and can't execute the script, check file permissions:
# Convert Windows line endings to Unix
dos2unix ~/Dev/dotfiles/install.sh
If your configuration isn't working as expected:
# Re-run the install script
cd ~/Dev/dotfiles
./install.sh
The .vimrc
includes special configuration to ensure clipboard functionality
works correctly across platforms:
- macOS: Uses the system clipboard automatically
- Linux: Uses
xclip
for system clipboard integration - WSL: Uses Windows clipboard commands (
clip.exe
and PowerShell)
<leader>y - Yank (copy) to system clipboard
<leader>p - Paste from system clipboard
- In Vim, run
:CheckClipboard
to verify clipboard support - On Ubuntu/Linux, ensure you have a clipboard-enabled version of Vim:
sudo apt-get update
sudo apt-get install vim-gtk3
- Make sure
xclip
is installed (installed automatically by the setup script) - Check the vim version with
vim --version | grep clipboard
- Look for
+clipboard
and+xterm_clipboard
- Look for
If encountering permission issues in WSL:
- Check that files are owned by your user:
ls -la ~/Dev/dotfiles
- Fix ownership if needed:
sudo chown -R $USER:$USER ~/Dev/dotfiles
- Fix permissions:
chmod +x ~/Dev/dotfiles/install.sh
If you're having issues with your dotfiles setup, run the debug info script:
~/Dev/dotfiles/scripts/debug-info.sh
This will provide detailed information about your configuration, including:
- ZSH version
- Installed plugins
- TMux configuration
- Platform detection
- Defined aliases
- Focus tracking settings
To contribute to these dotfiles:
- Fork the repository
- Create a feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.