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
34 changes: 19 additions & 15 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
# This is a basic workflow to help you get started with Actions

name: Linux

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: ["main"]
pull_request:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
linux-test:
# The type of runner that the job will run on
install-legacy:
name: Install Legacy (Linux)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run install_and_configure.sh
run: bash install_and_configure.sh

# Steps represent a sequence of tasks that will be executed as part of the job
install-bootstrap:
name: Install Bootstrap (Linux)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run bootstrap.sh --non-interactive
run: bash bootstrap.sh --non-interactive

# Runs install script
- name: Run install_and_configure.sh
run: ${GITHUB_WORKSPACE}/install_and_configure.sh
test:
name: Tests (Linux)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run test suite
run: bash tests/run_tests.sh
40 changes: 22 additions & 18 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
# This is a basic workflow to help you get started with Actions
name: macOS

name: MacOS

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]

# Allows you to run this workflow manually from the Actions tab
branches: ["main"]
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
macos-test:
# The type of runner that the job will run on
install-legacy:
name: Install Legacy (macOS)
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Run install_and_configure.sh
run: bash install_and_configure.sh

# Steps represent a sequence of tasks that will be executed as part of the job
install-bootstrap:
name: Install Bootstrap (macOS)
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Run bootstrap.sh --non-interactive
run: bash bootstrap.sh --non-interactive

# Runs install script
- name: Run install_and_configure.sh
run: ${GITHUB_WORKSPACE}/install_and_configure.sh
test:
name: Tests (macOS)
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Run test suite
run: bash tests/run_tests.sh
121 changes: 121 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Overview

This is a dotfiles repository for setting up a development environment on macOS, Ubuntu/Debian, and WSL2. It includes configuration files for zsh, tmux, emacs, lsd, htop, neofetch, and yazi, along with an automated install script and a modular bootstrap system.

## Repository Structure

```
dotfiles/
├── bootstrap.sh ← NEW: interactive setup with feature selection
├── uninstall.sh ← NEW: one-command uninstall
├── install_and_configure.sh ← ORIGINAL: monolithic installer (DO NOT MODIFY — CI uses it)
├── modules/
│ ├── lib.sh ← shared helpers (colors, OS detect, pkg_install, backup)
│ ├── core.sh ← existing tools: zsh/tmux/lsd/emacs/htop/neofetch/yazi
│ ├── shell.sh ← starship, fzf, zoxide, atuin
│ ├── dev.sh ← gh, ripgrep, direnv, bat, delta, fd, jq, lazygit
│ ├── node.sh ← fnm + Node LTS + commitizen
│ └── docker.sh ← Docker CE + docker compose
├── dotfiles/
│ ├── .zshrc ← deployed to $HOME; has modular sourcing block appended
│ ├── .tmux.conf ← UNCHANGED
│ ├── .emacs.el ← UNCHANGED
│ ├── .gitmessage ← conventional commit template
│ ├── .zshrc.local.example ← secrets/local config template (copy to ~/.zshrc.local)
│ └── .zshrc.d/
│ ├── fzf.zsh ← fzf keybindings + rg integration + helpers
│ ├── zoxide.zsh ← eval "$(zoxide init zsh)"
│ ├── starship.zsh ← eval "$(starship init zsh)"
│ ├── atuin.zsh ← eval "$(atuin init zsh --disable-up-arrow)"
│ ├── direnv.zsh ← eval "$(direnv hook zsh)"
│ ├── node.zsh ← fnm env initialization
│ ├── docker.zsh ← docker/compose aliases and helpers
│ └── commit.zsh ← git aliases + gcommit() + newproject()
├── config/
│ ├── starship.toml ← two-line prompt with git/node/python info
│ └── atuin/
│ └── config.toml ← fuzzy search, emacs keybindings, no auto-sync
├── templates/
│ ├── node/ ← package.json, .gitignore stubs
│ └── python/ ← pyproject.toml, .gitignore stubs
├── Doc/
│ ├── en/ ← English documentation (default)
│ │ ├── Tmux.md, zsh.md, tools.md, secrets.md
│ │ ├── emacs.md, htop.md, neofetch.md, yazi.md
│ ├── ja/ ← Japanese documentation
│ │ └── (same files as en/)
│ └── zh/ ← Simplified Chinese documentation
│ └── (same files as en/)
└── tmux-mem-cpu-load/ ← git submodule / local clone
```

## Running the Install Script (original, CI-tested)

```bash
chmod +x install_and_configure.sh
./install_and_configure.sh
```

## Running bootstrap.sh (new modular system)

```bash
bash bootstrap.sh # interactive menu
bash bootstrap.sh --all # install everything
bash bootstrap.sh --module shell # single module
bash bootstrap.sh --non-interactive # defaults (core+shell+dev)
bash bootstrap.sh --list # list modules
```

The bootstrap system:
1. Sources all `modules/*.sh` files
2. Shows an interactive feature selection menu
3. Calls the appropriate `install_<module>()` function for each selected block
4. Calls `setup_zshrc_sourcing()` to append the `.zshrc.d` sourcing block to `~/.zshrc`

## CI / Linting

Three GitHub Actions workflows run on push/PR to `main`:
- **Linux**: runs `install_and_configure.sh` on `ubuntu-latest`
- **MacOS**: runs `install_and_configure.sh` on `macos-latest`
- **ShellCheck**: lints all shell scripts (`.zshrc` is excluded)

To lint locally:
```bash
shellcheck install_and_configure.sh
shellcheck bootstrap.sh uninstall.sh modules/*.sh
```

## Key Configuration Details

### Tmux (`dotfiles/.tmux.conf`)
- Prefix key is `Ctrl-t` (not the default `Ctrl-b`)
- Status bar displays memory/CPU via `tmux-mem-cpu-load`
- Custom pane splits: `prefix+2` = vertical, `prefix+3` = horizontal (both preserve current path)

### Zsh (`dotfiles/.zshrc`)
- `ls` is aliased to `lsd`
- `yy` function wraps yazi to cd to the directory yazi exits in
- History: 1,000,000 entries, shared across sessions, deduplication enabled
- Modular sourcing block at the end loads `~/.zshrc.d/*.zsh` and `~/.zshrc.local`

### .zshrc.d pattern
All per-tool zsh configuration lives in `dotfiles/.zshrc.d/*.zsh`. Each file:
- Guards its `eval` call with `command -v <tool>` so it's a no-op if the tool is not installed
- Is deployed to `~/.zshrc.d/` by the corresponding module's `install_*()` function
- Is sourced automatically by the block appended to `~/.zshrc`

### Secrets
Machine-specific config and secrets go in `~/.zshrc.local` (never committed).
Template: `dotfiles/.zshrc.local.example`

### Adding a New Tool
1. Add installation logic to `modules/dev.sh` or a new `modules/<name>.sh`
2. Create `dotfiles/.zshrc.d/<tool>.zsh` with guarded `eval`/aliases
3. Register in `bootstrap.sh` FEATURE_NAMES/FEATURE_LABELS arrays
4. Add a `deploy_zshrc_d "<tool>.zsh"` call in the module's deploy function
5. Add documentation to `Doc/en/tools.md`, `Doc/ja/tools.md`, `Doc/zh/tools.md`
6. For a core tool: also add `check_and_install "toolname"` to `install_and_configure.sh`
1 change: 0 additions & 1 deletion Doc/emacs.md

This file was deleted.

34 changes: 34 additions & 0 deletions Doc/en/Tmux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Tmux

## Key Bindings

| Action | Key Binding | Description |
|--------|-------------|-------------|
| New session | `tmux` | Start a new tmux session |
| Attach to session | `tmux attach-session -t <name>` | Attach to an existing tmux session |
| List sessions | `tmux list-sessions` | Show all current sessions |
| Detach from session | `Ctrl-t` + d | Detach from the current session |
| Switch session | `tmux switch-client -n` | Switch to the next session |
| Kill session | `tmux kill-session -t <name>` | Terminate the specified session |
| New window | `Ctrl-t` + c | Create a new window |
| List windows | `Ctrl-t` + w | Show windows in the session |
| Rename window | `Ctrl-t` + , | Rename the current window |
| Kill window | `Ctrl-t` + & | Close the current window |
| Split horizontally | `Ctrl-t` + % | Split the current pane horizontally |
| Split vertically | `Ctrl-t` + " | Split the current pane vertically |
| List panes | `Ctrl-t` + q | Show pane numbers in the current window |
| Switch pane | `Ctrl-t` + arrow keys | Move to the adjacent pane |
| Join pane | `Ctrl-t` + : → `join-pane -s <n>` | Join the specified pane into the current one |
| Resize pane | `Ctrl-t` + : → `resize-pane -D 5` | Resize the current pane downward by 5 units |
| Command mode | `Ctrl-t` + : | Enter command input mode |
| Help | `Ctrl-t` + ? | Show tmux help |
| Zoom pane | `Ctrl-t` + 1 | Toggle zoom for the current pane |
| Split vertically (cwd) | `Ctrl-t` + 2 | Split vertically, preserving current path |
| Split horizontally (cwd) | `Ctrl-t` + 3 | Split horizontally, preserving current path |
| Resize left | `Ctrl-t` + C-h | Resize pane left by 5 units |
| Resize right | `Ctrl-t` + C-l | Resize pane right by 5 units |
| Resize down | `Ctrl-t` + C-j | Resize pane down by 5 units |
| Resize up | `Ctrl-t` + C-k | Resize pane up by 5 units |
| Swap pane up | `Ctrl-t` + s | Swap the current pane with the one above |
| Kill pane | `Ctrl-t` + k | Close the current pane |
| Show all panes | `Ctrl-t` + i | Temporarily show all panes |
63 changes: 63 additions & 0 deletions Doc/en/emacs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# emacs Configuration

Summary of `dotfiles/.emacs.el` settings.
Installed to: `~/.emacs.el`

---

## Package Setup

MELPA and Marmalade are added as package archives and `package-initialize` is called.

```elisp
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
```

---

## Key Binding Customization

| Key | Action |
|-----|--------|
| `Ctrl-Z` | Undo (overrides the default `suspend-frame`) |

---

## Auto-complete

Uses `auto-complete-config`.

- `TAB` triggers completion
- Use `Ctrl-N` / `Ctrl-P` to navigate the completion menu
- Fuzzy matching enabled
- Enabled modes: `text-mode`, `fundamental-mode`, `org-mode`, `yatex-mode`

---

## Python Completion (jedi)

`jedi.el` provides Python code completion.

- Auto-triggers on `.` (dot) with `jedi:complete-on-dot`
- `<C-tab>` unbound from jedi to use for window navigation
- Completion sources: filenames + jedi direct (word completion from same-mode buffers removed)

---

## Display Settings

| Setting | Effect |
|---------|--------|
| `show-paren-mode` | Highlight matching parentheses |
| `global-linum-mode` | Show line numbers in all buffers (3-digit width) |

---

## Load Path

```elisp
(setq load-path (cons "~/.emacs.d/elisp" load-path))
```

Place local Emacs Lisp files in `~/.emacs.d/elisp/`.
Loading
Loading