Skip to content
Merged
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
31 changes: 31 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# OS files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

# Backup files
*.swp
*.swo
*~
.*.swp
.*.swo

# Local customizations (user-specific files that shouldn't be shared)
*.local
*local.sh
*local.bash
*local.zsh

# vim
.vim/plugged/
.vim/.netrwhist
.vim/autoload/

# secrets
*.secret
*.key
*.pem
21 changes: 21 additions & 0 deletions .stow-local-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Stow will ignore these files/patterns when creating symlinks

# Git files
\.git
\.gitignore
\.gitmodules
\.gitkeep

# README and documentation
^/README.*
^/LICENSE.*
^/COPYING

# Scripts
^/install\.sh
^/Makefile

# Comments and temporary files
~$
\.swp$
\.swo$
218 changes: 217 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,218 @@
# dotfiles
dotfiles stored in stow for easy sync across laptop and desktop

Personal dotfiles managed with [GNU Stow](https://www.gnu.org/software/stow/) for easy synchronization across multiple machines.

## Overview

This repository contains configuration files (dotfiles) for various tools and applications. Using GNU Stow, these dotfiles can be easily installed and managed through symbolic links.

## Prerequisites

- Git
- [GNU Stow](https://www.gnu.org/software/stow/)

### Installing GNU Stow

**Ubuntu/Debian:**
```bash
sudo apt-get install stow
```

**macOS:**
```bash
brew install stow
```

**Arch Linux:**
```bash
sudo pacman -S stow
```

## Repository Structure

Each directory represents a "package" that can be independently installed:

```
dotfiles/
├── bash/ # Bash configuration (.bashrc, .bash_profile)
├── git/ # Git configuration (.gitconfig)
├── vim/ # Vim configuration (.vimrc)
├── zsh/ # Zsh configuration (.zshrc)
├── tmux/ # Tmux configuration (.tmux.conf)
└── install.sh # Installation script
```

Each package contains files organized as they would appear in your home directory. For example:
- `bash/.bashrc` will be linked to `~/.bashrc`
- `git/.gitconfig` will be linked to `~/.gitconfig`

## Installation

### Clone the Repository

First, clone this repository to your home directory or any preferred location:

```bash
git clone https://github.com/zoro11031/dotfiles.git ~/dotfiles
cd ~/dotfiles
```

### Install All Packages

To install all dotfiles at once:

```bash
./install.sh
```

### Install Specific Packages

To install only specific packages:

```bash
./install.sh bash git vim
```

### Manual Installation (without script)

You can also manually install packages using stow:

```bash
cd ~/dotfiles
stow bash # Install bash configuration
stow git # Install git configuration
stow vim # Install vim configuration
```

## Uninstalling

To uninstall packages, use the uninstall flag:

```bash
./install.sh --uninstall bash git
```

Or manually with stow:

```bash
cd ~/dotfiles
stow -D bash # Remove bash configuration
```

## Updating

To update your dotfiles:

1. Pull the latest changes:
```bash
cd ~/dotfiles
git pull
```

2. Reinstall the packages:
```bash
./install.sh --reinstall
```

## Customization

### Local Overrides

To add machine-specific customizations without modifying the repository:

- For bash: Create `~/.bashrc.local`
- For zsh: Create `~/.zshrc.local`

These files will be automatically sourced if they exist and are ignored by git.

### Modifying Dotfiles

1. Edit the files in the dotfiles repository
2. Commit your changes:
```bash
git add .
git commit -m "Update configuration"
git push
```

## Available Configurations

### Bash
- Command history settings
- Colorized prompt
- Common aliases (ll, la, grep)
- Bash completion support

### Git
- User configuration (name, email)
- Color output
- Useful aliases (st, co, br, ci, lg)
- Default branch settings

### Vim
- Syntax highlighting
- Line numbers
- Smart indentation
- Search settings
- No backup files

### Zsh
- Command history
- Colorized prompt
- Completion system
- Common aliases

### Tmux
- Custom prefix (Ctrl-a)
- Mouse support
- Better pane splitting
- Status bar customization

## Syncing Across Machines

To sync dotfiles across multiple machines:

1. **First machine (initial setup):**
```bash
cd ~/dotfiles
# Make your changes
git add .
git commit -m "Your changes"
git push
```

2. **Other machines (sync):**
```bash
cd ~/dotfiles
git pull
./install.sh --reinstall
```

## Troubleshooting

### Conflicts with Existing Files

If you have existing dotfiles, stow will warn you about conflicts. You can:

1. Backup your existing files:
```bash
mv ~/.bashrc ~/.bashrc.backup
```

2. Then run the installation again

### Checking What Will Be Linked

To see what stow will do without actually doing it:

```bash
stow -n -v bash # Dry run with verbose output
```

## License

This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.

## Contributing

Feel free to fork this repository and customize it for your own use. If you have suggestions for improvements, please open an issue or pull request.
9 changes: 9 additions & 0 deletions bash/.bash_profile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ~/.bash_profile - Bash login configuration

# Source .bashrc if it exists
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs
export PATH="$HOME/bin:$HOME/.local/bin:$PATH"
49 changes: 49 additions & 0 deletions bash/.bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# ~/.bashrc - Bash configuration file

# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac

# History settings
HISTCONTROL=ignoreboth
HISTSIZE=1000
HISTFILESIZE=2000
shopt -s histappend

# Window size check
shopt -s checkwinsize

# Colorized prompt
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='\u@\h:\w\$ '
fi

# Enable color support for ls
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
fi

# Common aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Enable bash completion
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi

# Load local customizations if present
if [ -f ~/.bashrc.local ]; then
. ~/.bashrc.local
fi
Empty file added bash/.config/bash/.gitkeep
Empty file.
Empty file added git/.config/git/.gitkeep
Empty file.
28 changes: 28 additions & 0 deletions git/.gitconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[user]
name = Your Name
email = your.email@example.com

[core]
editor = vim
autocrlf = input

[color]
ui = auto

[alias]
st = status
co = checkout
br = branch
ci = commit
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
last = log -1 HEAD
unstage = reset HEAD --

[pull]
rebase = false

[init]
defaultBranch = main

[push]
default = simple
Loading
Loading