From 5cab8db12efd3d3d7a0c07c955561215e565707b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Oct 2025 16:29:07 +0000 Subject: [PATCH 1/3] Initial plan From 7eb3e15ed6731428d8250d7390e9a6c26f4551ef Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Oct 2025 16:34:33 +0000 Subject: [PATCH 2/3] Add dotfiles structure with bash, git, vim, zsh, and tmux configurations Co-authored-by: zoro11031 <57109577+zoro11031@users.noreply.github.com> --- .gitignore | 29 ++++++ README.md | 218 ++++++++++++++++++++++++++++++++++++++++++++- bash/.bash_profile | 9 ++ bash/.bashrc | 49 ++++++++++ git/.gitconfig | 28 ++++++ install.sh | 156 ++++++++++++++++++++++++++++++++ tmux/.tmux.conf | 42 +++++++++ vim/.vimrc | 43 +++++++++ zsh/.zshrc | 40 +++++++++ 9 files changed, 613 insertions(+), 1 deletion(-) create mode 100644 .gitignore create mode 100644 bash/.bash_profile create mode 100644 bash/.bashrc create mode 100644 git/.gitconfig create mode 100755 install.sh create mode 100644 tmux/.tmux.conf create mode 100644 vim/.vimrc create mode 100644 zsh/.zshrc diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..82b5fd9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +# 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 + +# vim +.vim/plugged/ +.vim/.netrwhist +.vim/autoload/ + +# secrets +*.secret +*.key +*.pem diff --git a/README.md b/README.md index 7e23f11..8e74659 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/bash/.bash_profile b/bash/.bash_profile new file mode 100644 index 0000000..ff908fe --- /dev/null +++ b/bash/.bash_profile @@ -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" diff --git a/bash/.bashrc b/bash/.bashrc new file mode 100644 index 0000000..1b7721c --- /dev/null +++ b/bash/.bashrc @@ -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 diff --git a/git/.gitconfig b/git/.gitconfig new file mode 100644 index 0000000..3a3fc76 --- /dev/null +++ b/git/.gitconfig @@ -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 diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..763dfa5 --- /dev/null +++ b/install.sh @@ -0,0 +1,156 @@ +#!/usr/bin/env bash +# +# Install dotfiles using GNU Stow +# +# Usage: ./install.sh [package1] [package2] ... +# If no packages are specified, all packages will be installed. + +set -e + +DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +STOW_DIR="$DOTFILES_DIR" +TARGET_DIR="$HOME" + +# Color codes +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# Check if stow is installed +if ! command -v stow &> /dev/null; then + echo -e "${RED}Error: GNU Stow is not installed.${NC}" + echo "Please install it using your package manager:" + echo " - Ubuntu/Debian: sudo apt-get install stow" + echo " - macOS: brew install stow" + echo " - Arch: sudo pacman -S stow" + exit 1 +fi + +# Get all package directories (directories that don't start with .) +get_packages() { + find "$STOW_DIR" -maxdepth 1 -type d ! -path "$STOW_DIR" ! -name ".*" -exec basename {} \; +} + +# Install a single package +install_package() { + local package=$1 + echo -e "${GREEN}Installing $package...${NC}" + + if [ ! -d "$STOW_DIR/$package" ]; then + echo -e "${RED}Error: Package '$package' does not exist${NC}" + return 1 + fi + + cd "$STOW_DIR" + stow -v -t "$TARGET_DIR" "$package" + + if [ $? -eq 0 ]; then + echo -e "${GREEN}✓ $package installed successfully${NC}" + else + echo -e "${RED}✗ Failed to install $package${NC}" + return 1 + fi +} + +# Uninstall a single package +uninstall_package() { + local package=$1 + echo -e "${YELLOW}Uninstalling $package...${NC}" + + cd "$STOW_DIR" + stow -v -D -t "$TARGET_DIR" "$package" + + if [ $? -eq 0 ]; then + echo -e "${GREEN}✓ $package uninstalled successfully${NC}" + else + echo -e "${RED}✗ Failed to uninstall $package${NC}" + return 1 + fi +} + +# Reinstall a single package +reinstall_package() { + local package=$1 + echo -e "${YELLOW}Reinstalling $package...${NC}" + uninstall_package "$package" 2>/dev/null || true + install_package "$package" +} + +# Main installation logic +main() { + echo "=== Dotfiles Installation ===" + echo "Directory: $DOTFILES_DIR" + echo "Target: $TARGET_DIR" + echo "" + + # Parse command line arguments + local mode="install" + local packages=() + + for arg in "$@"; do + case $arg in + -u|--uninstall) + mode="uninstall" + ;; + -r|--reinstall) + mode="reinstall" + ;; + -h|--help) + echo "Usage: $0 [OPTIONS] [PACKAGES...]" + echo "" + echo "Options:" + echo " -u, --uninstall Uninstall the specified packages" + echo " -r, --reinstall Reinstall the specified packages" + echo " -h, --help Show this help message" + echo "" + echo "If no packages are specified, all packages will be processed." + echo "" + echo "Available packages:" + get_packages | sed 's/^/ - /' + exit 0 + ;; + *) + packages+=("$arg") + ;; + esac + done + + # If no packages specified, use all packages + if [ ${#packages[@]} -eq 0 ]; then + echo "No packages specified, processing all packages..." + mapfile -t packages < <(get_packages) + fi + + echo "Packages to $mode:" + printf ' - %s\n' "${packages[@]}" + echo "" + + # Process each package + local failed=0 + for package in "${packages[@]}"; do + case $mode in + install) + install_package "$package" || failed=$((failed + 1)) + ;; + uninstall) + uninstall_package "$package" || failed=$((failed + 1)) + ;; + reinstall) + reinstall_package "$package" || failed=$((failed + 1)) + ;; + esac + echo "" + done + + # Summary + echo "=== Summary ===" + if [ $failed -eq 0 ]; then + echo -e "${GREEN}All packages processed successfully!${NC}" + else + echo -e "${RED}$failed package(s) failed to process${NC}" + exit 1 + fi +} + +main "$@" diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf new file mode 100644 index 0000000..525e7d4 --- /dev/null +++ b/tmux/.tmux.conf @@ -0,0 +1,42 @@ +# ~/.tmux.conf - Tmux configuration file + +# Set prefix to Ctrl-a instead of Ctrl-b +unbind C-b +set-option -g prefix C-a +bind-key C-a send-prefix + +# Enable mouse support +set -g mouse on + +# Set window and pane index to start at 1 +set -g base-index 1 +setw -g pane-base-index 1 + +# Increase scrollback buffer size +set -g history-limit 10000 + +# Split panes using | and - +bind | split-window -h +bind - split-window -v +unbind '"' +unbind % + +# Reload config file +bind r source-file ~/.tmux.conf \; display "Config reloaded!" + +# Fast pane switching with Alt-arrow +bind -n M-Left select-pane -L +bind -n M-Right select-pane -R +bind -n M-Up select-pane -U +bind -n M-Down select-pane -D + +# Status bar customization +set -g status-style bg=black,fg=white +set -g status-left '[#S] ' +set -g status-right '%Y-%m-%d %H:%M' + +# Highlight active window +setw -g window-status-current-style bg=blue,fg=white,bold + +# Enable true colors +set -g default-terminal "screen-256color" diff --git a/vim/.vimrc b/vim/.vimrc new file mode 100644 index 0000000..03cb549 --- /dev/null +++ b/vim/.vimrc @@ -0,0 +1,43 @@ +" ~/.vimrc - Vim configuration file + +" Basic settings +set nocompatible " Use Vim settings, not Vi +syntax on " Enable syntax highlighting +filetype plugin indent on " Enable filetype detection + +" Display settings +set number " Show line numbers +set ruler " Show cursor position +set showcmd " Show command in bottom bar +set showmatch " Highlight matching brackets +set cursorline " Highlight current line + +" Indentation +set tabstop=4 " Number of spaces per tab +set softtabstop=4 " Number of spaces per tab when editing +set shiftwidth=4 " Number of spaces for autoindent +set expandtab " Convert tabs to spaces +set autoindent " Auto-indent new lines + +" Search settings +set incsearch " Search as characters are entered +set hlsearch " Highlight search matches +set ignorecase " Ignore case when searching +set smartcase " Override ignorecase if search has uppercase + +" Behavior +set backspace=indent,eol,start " Make backspace work as expected +set wildmenu " Visual autocomplete for command menu +set laststatus=2 " Always show status line +set encoding=utf-8 " Use UTF-8 encoding + +" Disable backup files +set nobackup +set nowritebackup +set noswapfile + +" Performance +set lazyredraw " Don't redraw while executing macros + +" Color scheme (uncomment if you have a preferred theme) +" colorscheme desert diff --git a/zsh/.zshrc b/zsh/.zshrc new file mode 100644 index 0000000..54e95ab --- /dev/null +++ b/zsh/.zshrc @@ -0,0 +1,40 @@ +# ~/.zshrc - Zsh configuration file + +# History settings +HISTFILE=~/.zsh_history +HISTSIZE=1000 +SAVEHIST=2000 +setopt SHARE_HISTORY +setopt HIST_IGNORE_ALL_DUPS +setopt HIST_FIND_NO_DUPS + +# Enable colors +autoload -U colors && colors + +# Prompt +PS1="%{$fg[green]%}%n@%m%{$reset_color%}:%{$fg[blue]%}%~%{$reset_color%}$ " + +# Completion system +autoload -Uz compinit +compinit + +# Enable color support for ls +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + alias ls='ls --color=auto' +elif [[ "$OSTYPE" == "darwin"* ]]; then + alias ls='ls -G' +fi + +# Common aliases +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' +alias grep='grep --color=auto' + +# Key bindings +bindkey -e # Use emacs key bindings + +# Load local customizations if present +if [ -f ~/.zshrc.local ]; then + source ~/.zshrc.local +fi From cce13ad92f3e98bd9f4b753e447df6688ba1489f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Oct 2025 16:37:39 +0000 Subject: [PATCH 3/3] Add .gitkeep files and .stow-local-ignore, fix .gitignore pattern Co-authored-by: zoro11031 <57109577+zoro11031@users.noreply.github.com> --- .gitignore | 4 +++- .stow-local-ignore | 21 +++++++++++++++++++++ bash/.config/bash/.gitkeep | 0 git/.config/git/.gitkeep | 0 tmux/.config/tmux/.gitkeep | 0 vim/.vim/.gitkeep | 0 zsh/.config/zsh/.gitkeep | 0 7 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 .stow-local-ignore create mode 100644 bash/.config/bash/.gitkeep create mode 100644 git/.config/git/.gitkeep create mode 100644 tmux/.config/tmux/.gitkeep create mode 100644 vim/.vim/.gitkeep create mode 100644 zsh/.config/zsh/.gitkeep diff --git a/.gitignore b/.gitignore index 82b5fd9..7b9a215 100644 --- a/.gitignore +++ b/.gitignore @@ -15,8 +15,10 @@ Thumbs.db .*.swo # Local customizations (user-specific files that shouldn't be shared) -*local* *.local +*local.sh +*local.bash +*local.zsh # vim .vim/plugged/ diff --git a/.stow-local-ignore b/.stow-local-ignore new file mode 100644 index 0000000..633f0aa --- /dev/null +++ b/.stow-local-ignore @@ -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$ diff --git a/bash/.config/bash/.gitkeep b/bash/.config/bash/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/git/.config/git/.gitkeep b/git/.config/git/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tmux/.config/tmux/.gitkeep b/tmux/.config/tmux/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/vim/.vim/.gitkeep b/vim/.vim/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/zsh/.config/zsh/.gitkeep b/zsh/.config/zsh/.gitkeep new file mode 100644 index 0000000..e69de29