From 7efd4ad8f3c6e8f42d690580482c13aea4728585 Mon Sep 17 00:00:00 2001 From: long-910 <7323488+long-910@users.noreply.github.com> Date: Sun, 1 Mar 2026 22:11:26 +0900 Subject: [PATCH 1/4] Chore: remove duplicates and fix maintenance issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - dotfiles/.zshrc: remove duplicate tmux auto-attach block (lines 166-169); superseded by .zshrc.d/tmux.zsh which uses exec and also skips VSCode terminal - uninstall.sh: add tmux.zsh to ZSHRC_D_FILES so it is cleaned up on uninstall - tests/test_configs.sh: add tmux.zsh to .zshrc.d file existence check - README.md/ja/zh: fix tmux description — remove incorrect "named main" session reference to match actual tmux.zsh behavior - CLAUDE.md: add tmux.zsh to .zshrc.d structure listing; annotate core.sh with tmux.zsh deployment - CHANGELOG.md: add [0.5.0] entry covering kali-style prompt, tmux auto-attach, CI/ShellCheck fixes, and this maintenance cleanup Co-Authored-By: Claude Sonnet 4.6 --- CHANGELOG.md | 15 +++++++++++++++ CLAUDE.md | 3 ++- README.ja.md | 2 +- README.md | 2 +- README.zh.md | 2 +- dotfiles/.zshrc | 5 ----- tests/test_configs.sh | 2 +- uninstall.sh | 1 + 8 files changed, 22 insertions(+), 10 deletions(-) mode change 100755 => 100644 uninstall.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index a62860e..f74a025 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ## [Unreleased] +--- + +## [0.5.0] - 2026-03-01 + +### Added +- **Kali Linux style starship prompt** (`config/starship.toml`): two-line prompt with `┌──(user@host)─[dir git]` / `└─$` layout; always shows username and hostname; git branch/status, Node/Python/Rust/Go version indicators +- **tmux auto-attach** (`dotfiles/.zshrc.d/tmux.zsh`): attaches to the most recent existing session on shell start, or creates a new one; uses `exec` so closing tmux exits the shell; skips VSCode terminal + ### Fixed - ShellCheck CI: add `# shellcheck shell=bash` directive to all `dotfiles/.zshrc.d/*.zsh` files (SC2148, SC1103) - ShellCheck CI: add `# shellcheck disable=SC1090` for non-constant `source` in `fzf.zsh` (SC1090) @@ -18,6 +26,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - Linux CI: make `yazi` cargo build failure non-fatal in `modules/core.sh` - Linux CI: pre-install `yazi` binary from GitHub releases in workflow to avoid `cargo` compile failure +### Maintenance +- `dotfiles/.zshrc`: remove duplicate tmux auto-attach block (superseded by `tmux.zsh`) +- `uninstall.sh`: add `tmux.zsh` to `ZSHRC_D_FILES` so it is removed on uninstall +- `tests/test_configs.sh`: add `tmux.zsh` to `.zshrc.d` file existence check +- `README.md/ja/zh`: fix tmux session description (removed incorrect "named `main`" reference) +- `CLAUDE.md`: add `tmux.zsh` to `.zshrc.d/` structure listing + --- ## [0.4.0] - 2026-03-01 diff --git a/CLAUDE.md b/CLAUDE.md index 84eccec..52e3816 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -15,7 +15,7 @@ dotfiles/ ├── 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 +│ ├── core.sh ← existing tools: zsh/tmux/lsd/emacs/htop/neofetch/yazi + tmux.zsh │ ├── shell.sh ← starship, fzf, zoxide, atuin │ ├── dev.sh ← gh, ripgrep, direnv, bat, delta, fd, jq, lazygit │ ├── node.sh ← fnm + Node LTS + commitizen @@ -27,6 +27,7 @@ dotfiles/ │ ├── .gitmessage ← conventional commit template │ ├── .zshrc.local.example ← secrets/local config template (copy to ~/.zshrc.local) │ └── .zshrc.d/ +│ ├── tmux.zsh ← auto-attach to tmux session on shell start │ ├── fzf.zsh ← fzf keybindings + rg integration + helpers │ ├── zoxide.zsh ← eval "$(zoxide init zsh)" │ ├── starship.zsh ← eval "$(starship init zsh)" diff --git a/README.ja.md b/README.ja.md index 77d9dd4..2d5733d 100644 --- a/README.ja.md +++ b/README.ja.md @@ -110,7 +110,7 @@ bash bootstrap.sh --list # モジュール一覧表示 |-------|------| | [tmux](https://github.com/tmux/tmux) | ターミナルマルチプレクサ。ログイン時に自動起動し、tmux 終了でシェルも終了 | -新しいターミナルを開くと tmux が自動的に起動し、`main` という名前のセッションにアタッチ(なければ作成)します。tmux を終了するとシェルも終了します。無効にするには `~/.zshrc.d/tmux.zsh` を削除してください。 +新しいターミナルを開くと tmux が自動的に起動し、既存のセッションがあればアタッチし、なければ新しいセッションを作成します。tmux を終了するとシェルも終了します。無効にするには `~/.zshrc.d/tmux.zsh` を削除してください。 ### ファイル管理 diff --git a/README.md b/README.md index 6dcb2cf..7defac9 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ bash bootstrap.sh --list # List modules |------|-------------| | [tmux](https://github.com/tmux/tmux) | Terminal multiplexer. Auto-starts on login; exit tmux to close the shell | -tmux starts automatically when you open a new terminal and attaches to (or creates) a session named `main`. Closing tmux also exits the shell. To disable, remove `~/.zshrc.d/tmux.zsh`. +tmux starts automatically when you open a new terminal and attaches to the most recent existing session, or creates a new one. Closing tmux also exits the shell. To disable, remove `~/.zshrc.d/tmux.zsh`. ### File Management diff --git a/README.zh.md b/README.zh.md index 20e5905..2a70336 100644 --- a/README.zh.md +++ b/README.zh.md @@ -109,7 +109,7 @@ bash bootstrap.sh --list # 列出所有模块 |------|------| | [tmux](https://github.com/tmux/tmux) | 终端复用器。登录时自动启动;退出 tmux 同时退出 Shell | -打开新终端时 tmux 会自动启动,并附加到名为 `main` 的会话(不存在则创建)。关闭 tmux 时 Shell 也会一并退出。如需禁用,请删除 `~/.zshrc.d/tmux.zsh`。 +打开新终端时 tmux 会自动启动,并附加到最近的现有会话(不存在则创建新会话)。关闭 tmux 时 Shell 也会一并退出。如需禁用,请删除 `~/.zshrc.d/tmux.zsh`。 ### 文件管理 diff --git a/dotfiles/.zshrc b/dotfiles/.zshrc index ee65ce5..a906ec2 100644 --- a/dotfiles/.zshrc +++ b/dotfiles/.zshrc @@ -162,8 +162,3 @@ if [ -d "$HOME/.zshrc.d" ]; then fi # Load machine-specific / secret config (never committed) [ -f "$HOME/.zshrc.local" ] && . "$HOME/.zshrc.local" - -# tmux auto-attach: attach to 'tmux-dev' session (create if missing) -if command -v tmux &>/dev/null && [ -z "$TMUX" ] && [[ $- == *i* ]]; then - tmux new-session -As tmux-dev -fi diff --git a/tests/test_configs.sh b/tests/test_configs.sh index 9275dd0..995d22a 100644 --- a/tests/test_configs.sh +++ b/tests/test_configs.sh @@ -14,7 +14,7 @@ run_tests() { done # ── .zshrc.d files ────────────────────────────────────────────────────────── - for _f in fzf.zsh zoxide.zsh starship.zsh atuin.zsh direnv.zsh node.zsh docker.zsh commit.zsh; do + for _f in tmux.zsh fzf.zsh zoxide.zsh starship.zsh atuin.zsh direnv.zsh node.zsh docker.zsh commit.zsh; do assert_file_exists ".zshrc.d/${_f}" "${r}/dotfiles/.zshrc.d/${_f}" done diff --git a/uninstall.sh b/uninstall.sh old mode 100755 new mode 100644 index e15fe64..7ce6855 --- a/uninstall.sh +++ b/uninstall.sh @@ -10,6 +10,7 @@ export DOTFILES_ROOT # ── Files we own in ~/.zshrc.d ───────────────────────────────────────────────── ZSHRC_D_FILES=( + tmux.zsh fzf.zsh zoxide.zsh starship.zsh From 9cb988d67002e7b3769ee1558e7a15c7ab44bf55 Mon Sep 17 00:00:00 2001 From: long-910 <7323488+long-910@users.noreply.github.com> Date: Sun, 1 Mar 2026 22:18:53 +0900 Subject: [PATCH 2/4] Fix: restore executable bit on uninstall.sh The previous commit inadvertently changed uninstall.sh from 100755 to 100644 (non-executable) due to Windows/WSL filesystem mode handling. Co-Authored-By: Claude Sonnet 4.6 --- uninstall.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 uninstall.sh diff --git a/uninstall.sh b/uninstall.sh old mode 100644 new mode 100755 From ea3f7e84f1dc3e074a308e960eab50c981316668 Mon Sep 17 00:00:00 2001 From: long-910 <7323488+long-910@users.noreply.github.com> Date: Sun, 8 Mar 2026 15:37:24 +0900 Subject: [PATCH 3/4] Fix: move lang/duration modules to first prompt line; document WSL Nerd Fonts setup - starship.toml: move $nodejs/$python/$rust/$golang and $cmd_duration before \n so they appear on the first line instead of between the two prompt lines - README.md/ja/zh: add WSL2 note under lsd explaining Nerd Fonts must be installed on the Windows side for icons to render correctly Co-Authored-By: Claude Sonnet 4.6 --- README.ja.md | 416 ++++++++++++++++++++++--------------------- README.md | 416 ++++++++++++++++++++++--------------------- README.zh.md | 414 +++++++++++++++++++++--------------------- config/starship.toml | 4 +- 4 files changed, 637 insertions(+), 613 deletions(-) diff --git a/README.ja.md b/README.ja.md index 2d5733d..6c80f6f 100644 --- a/README.ja.md +++ b/README.ja.md @@ -1,204 +1,212 @@ -[![Linux](https://github.com/long-910/dotfiles/actions/workflows/linux.yml/badge.svg)](https://github.com/long-910/dotfiles/actions/workflows/linux.yml) -[![macOS](https://github.com/long-910/dotfiles/actions/workflows/macos.yml/badge.svg)](https://github.com/long-910/dotfiles/actions/workflows/macos.yml) -[![ShellCheck](https://github.com/long-910/dotfiles/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/long-910/dotfiles/actions/workflows/shellcheck.yml) -[![License](https://img.shields.io/github/license/long-910/dotfiles)](https://github.com/long-910/dotfiles/blob/main/LICENSE) -[![Sponsor](https://img.shields.io/badge/Sponsor-GitHub-pink?logo=github)](https://github.com/sponsors/long-910) - -[English](README.md) | [日本語](README.ja.md) | [中文](README.zh.md) - -# dotfiles - -macOS・Ubuntu・WSL 向け開発環境セットアップスクリプト集です。 -インタラクティブメニューで必要な機能ブロックだけを選択してインストールできます。 - ---- - -## クイックスタート - -### ワンライナーインストール(curl) - -1コマンドでクローンしてインタラクティブインストーラーを起動: - -```bash -curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash -``` - -すべてを非インタラクティブにインストールする場合: - -```bash -curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash -s -- --all -``` - -リポジトリは `~/.dotfiles` にクローンされます。`DOTFILES_DIR` で変更可能: - -```bash -DOTFILES_DIR=~/my-dotfiles curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash -``` - -### bootstrap.sh(git clone) - -インタラクティブメニューで機能ブロックを選択してインストール。 - -```bash -git clone https://github.com/long-910/dotfiles.git -cd dotfiles -bash bootstrap.sh -``` - -### install_and_configure.sh(従来版) - -一括インストール。`bootstrap.sh` が使用できない環境向け。 - -```bash -git clone https://github.com/long-910/dotfiles.git -cd dotfiles -chmod +x install_and_configure.sh -./install_and_configure.sh -``` - ---- - -## 機能ブロック - -| ブロック | 含まれるツール | デフォルト | -|---------|--------------|-----------| -| **Core** | zsh, tmux, lsd, emacs, htop, neofetch, yazi | ON | -| **Shell** | starship, fzf, zoxide, atuin | ON | -| **Dev** | gh, ripgrep, direnv, bat, delta, fd, jq, lazygit | ON | -| **Node.js** | fnm + Node LTS + commitizen | OFF | -| **Docker** | Docker CE + Docker Compose | OFF | - -`bootstrap.sh` 起動時に番号を入力して ON/OFF を切り替えられます。 -非インタラクティブ実行も可能です: - -```bash -bash bootstrap.sh --all # 全ブロック -bash bootstrap.sh --module shell # 特定モジュールのみ -bash bootstrap.sh --non-interactive # デフォルト設定で自動実行 -bash bootstrap.sh --list # モジュール一覧表示 -``` - ---- - -## ツール詳細 - -### プロンプト・シェル強化 - -| ツール | 説明 | -|-------|------| -| [starship](https://starship.rs/) | 高速・カスタマイズ可能なクロスシェルプロンプト | -| [fzf](https://github.com/junegunn/fzf) | ファジーファインダー。Ctrl-R でヒストリ検索、Ctrl-T でファイル検索 | -| [zoxide](https://github.com/ajeetdsouza/zoxide) | `cd` の賢い代替。`z proj` で頻繁に使うディレクトリへジャンプ | -| [atuin](https://atuin.sh/) | SQLite ベースのシェルヒストリ。Ctrl-R でファジー検索 | - -### 開発ツール - -| ツール | 説明 | -|-------|------| -| [gh](https://cli.github.com/) | GitHub CLI。PR・Issue をターミナルから操作 | -| [ripgrep](https://github.com/BurntSushi/ripgrep) | 高速 grep 代替。`.gitignore` を自動的に尊重 | -| [direnv](https://direnv.net/) | ディレクトリごとの環境変数自動ロード | -| [bat](https://github.com/sharkdp/bat) | シンタックスハイライト付き `cat` 代替 | -| [delta](https://github.com/dandavison/delta) | シンタックスハイライト付き git diff ページャ | -| [fd](https://github.com/sharkdp/fd) | 高速 `find` 代替 | -| [jq](https://jqlang.github.io/jq/) | コマンドライン JSON プロセッサ | -| [lazygit](https://github.com/jesseduffield/lazygit) | git のターミナル UI | - -### ターミナルマルチプレクサ - -| ツール | 説明 | -|-------|------| -| [tmux](https://github.com/tmux/tmux) | ターミナルマルチプレクサ。ログイン時に自動起動し、tmux 終了でシェルも終了 | - -新しいターミナルを開くと tmux が自動的に起動し、既存のセッションがあればアタッチし、なければ新しいセッションを作成します。tmux を終了するとシェルも終了します。無効にするには `~/.zshrc.d/tmux.zsh` を削除してください。 - -### ファイル管理 - -| ツール | 説明 | -|-------|------| -| [lsd](https://github.com/lsd-rs/lsd) | アイコン付き `ls` 代替 | -| [yazi](https://yazi-rs.github.io/) | ターミナルファイルマネージャ。`yy` コマンドで起動し、終了後そのディレクトリに移動 | - ---- - -## カスタマイズ - -### プロンプト (starship) - -`config/starship.toml` を編集してカスタマイズできます。 -インストール後は `~/.config/starship.toml` に配置されます。 - -### ディレクトリ別環境変数 (direnv) - -プロジェクトルートに `.envrc` を作成: - -```bash -export DATABASE_URL="postgresql://localhost/myapp" -export NODE_ENV="development" -``` - -```bash -direnv allow # 初回のみ許可 -``` - -### プロジェクトテンプレート - -`newproject` 関数でプロジェクトを素早く作成できます: - -```bash -newproject node my-app # Node.js プロジェクト -newproject python my-script # Python プロジェクト -``` - ---- - -## 秘密情報の管理 - -API キーや環境固有の設定は **`~/.zshrc.local`** に記載します(git に含まれません)。 - -```bash -cp dotfiles/.zshrc.local.example ~/.zshrc.local -# エディタで ~/.zshrc.local を編集 -``` - -詳細は [Doc/ja/secrets.md](Doc/ja/secrets.md) を参照してください。 - ---- - -## アンインストール - -```bash -bash uninstall.sh -``` - -- `~/.zshrc.d/` 内の配置ファイルを削除 -- `.zshrc`、`.tmux.conf`、`.emacs.el` のバックアップを復元 -- `~/.config/starship.toml`、`~/.config/atuin/config.toml` を削除 -- git の `commit.template` 設定を削除 -- 任意でインストールしたパッケージを削除 - ---- - -## ドキュメント - -- [tmux 設定](Doc/ja/Tmux.md) -- [zsh 設定](Doc/ja/zsh.md) -- [ツール詳細](Doc/ja/tools.md) -- [秘密情報の管理](Doc/ja/secrets.md) -- [emacs](Doc/ja/emacs.md) | [htop](Doc/ja/htop.md) | [neofetch](Doc/ja/neofetch.md) | [yazi](Doc/ja/yazi.md) - ---- - -## 対応環境 - -| 環境 | 状態 | -|------|------| -| macOS (Apple Silicon / Intel) | ✅ | -| Ubuntu 22.04 / 24.04 | ✅ | -| WSL2 (Ubuntu) | ✅ | - ---- - -## ライセンス - -MIT — 詳細は [LICENSE](LICENSE) を参照してください。 +[![Linux](https://github.com/long-910/dotfiles/actions/workflows/linux.yml/badge.svg)](https://github.com/long-910/dotfiles/actions/workflows/linux.yml) +[![macOS](https://github.com/long-910/dotfiles/actions/workflows/macos.yml/badge.svg)](https://github.com/long-910/dotfiles/actions/workflows/macos.yml) +[![ShellCheck](https://github.com/long-910/dotfiles/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/long-910/dotfiles/actions/workflows/shellcheck.yml) +[![License](https://img.shields.io/github/license/long-910/dotfiles)](https://github.com/long-910/dotfiles/blob/main/LICENSE) +[![Sponsor](https://img.shields.io/badge/Sponsor-GitHub-pink?logo=github)](https://github.com/sponsors/long-910) + +[English](README.md) | [日本語](README.ja.md) | [中文](README.zh.md) + +# dotfiles + +macOS・Ubuntu・WSL 向け開発環境セットアップスクリプト集です。 +インタラクティブメニューで必要な機能ブロックだけを選択してインストールできます。 + +--- + +## クイックスタート + +### ワンライナーインストール(curl) + +1コマンドでクローンしてインタラクティブインストーラーを起動: + +```bash +curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash +``` + +すべてを非インタラクティブにインストールする場合: + +```bash +curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash -s -- --all +``` + +リポジトリは `~/.dotfiles` にクローンされます。`DOTFILES_DIR` で変更可能: + +```bash +DOTFILES_DIR=~/my-dotfiles curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash +``` + +### bootstrap.sh(git clone) + +インタラクティブメニューで機能ブロックを選択してインストール。 + +```bash +git clone https://github.com/long-910/dotfiles.git +cd dotfiles +bash bootstrap.sh +``` + +### install_and_configure.sh(従来版) + +一括インストール。`bootstrap.sh` が使用できない環境向け。 + +```bash +git clone https://github.com/long-910/dotfiles.git +cd dotfiles +chmod +x install_and_configure.sh +./install_and_configure.sh +``` + +--- + +## 機能ブロック + +| ブロック | 含まれるツール | デフォルト | +|---------|--------------|-----------| +| **Core** | zsh, tmux, lsd, emacs, htop, neofetch, yazi | ON | +| **Shell** | starship, fzf, zoxide, atuin | ON | +| **Dev** | gh, ripgrep, direnv, bat, delta, fd, jq, lazygit | ON | +| **Node.js** | fnm + Node LTS + commitizen | OFF | +| **Docker** | Docker CE + Docker Compose | OFF | + +`bootstrap.sh` 起動時に番号を入力して ON/OFF を切り替えられます。 +非インタラクティブ実行も可能です: + +```bash +bash bootstrap.sh --all # 全ブロック +bash bootstrap.sh --module shell # 特定モジュールのみ +bash bootstrap.sh --non-interactive # デフォルト設定で自動実行 +bash bootstrap.sh --list # モジュール一覧表示 +``` + +--- + +## ツール詳細 + +### プロンプト・シェル強化 + +| ツール | 説明 | +|-------|------| +| [starship](https://starship.rs/) | 高速・カスタマイズ可能なクロスシェルプロンプト | +| [fzf](https://github.com/junegunn/fzf) | ファジーファインダー。Ctrl-R でヒストリ検索、Ctrl-T でファイル検索 | +| [zoxide](https://github.com/ajeetdsouza/zoxide) | `cd` の賢い代替。`z proj` で頻繁に使うディレクトリへジャンプ | +| [atuin](https://atuin.sh/) | SQLite ベースのシェルヒストリ。Ctrl-R でファジー検索 | + +### 開発ツール + +| ツール | 説明 | +|-------|------| +| [gh](https://cli.github.com/) | GitHub CLI。PR・Issue をターミナルから操作 | +| [ripgrep](https://github.com/BurntSushi/ripgrep) | 高速 grep 代替。`.gitignore` を自動的に尊重 | +| [direnv](https://direnv.net/) | ディレクトリごとの環境変数自動ロード | +| [bat](https://github.com/sharkdp/bat) | シンタックスハイライト付き `cat` 代替 | +| [delta](https://github.com/dandavison/delta) | シンタックスハイライト付き git diff ページャ | +| [fd](https://github.com/sharkdp/fd) | 高速 `find` 代替 | +| [jq](https://jqlang.github.io/jq/) | コマンドライン JSON プロセッサ | +| [lazygit](https://github.com/jesseduffield/lazygit) | git のターミナル UI | + +### ターミナルマルチプレクサ + +| ツール | 説明 | +|-------|------| +| [tmux](https://github.com/tmux/tmux) | ターミナルマルチプレクサ。ログイン時に自動起動し、tmux 終了でシェルも終了 | + +新しいターミナルを開くと tmux が自動的に起動し、既存のセッションがあればアタッチし、なければ新しいセッションを作成します。tmux を終了するとシェルも終了します。無効にするには `~/.zshrc.d/tmux.zsh` を削除してください。 + +### ファイル管理 + +| ツール | 説明 | +|-------|------| +| [lsd](https://github.com/lsd-rs/lsd) | アイコン付き `ls` 代替 | +| [yazi](https://yazi-rs.github.io/) | ターミナルファイルマネージャ。`yy` コマンドで起動し、終了後そのディレクトリに移動 | + +> **WSL2 でアイコンが表示されない場合** +> lsd のアイコン表示には [Nerd Fonts](https://www.nerdfonts.com/) が必要です。WSL2 ではターミナルが Windows 側で動作するため、フォントは **Windows 側にインストール** する必要があります。 +> +> 1. [nerdfonts.com](https://www.nerdfonts.com/font-downloads) から Nerd Font をダウンロード(例:**CaskaydiaCove Nerd Font**、**JetBrainsMono Nerd Font**) +> 2. `.ttf` ファイルを右クリック → **「すべてのユーザーのためにインストール」** +> 3. Windows Terminal:**設定 → Ubuntu プロファイル → 外観 → フォントフェイス** → インストールしたフォントを選択(例:`CaskaydiaCove Nerd Font Mono`) +> 4. ターミナルを再起動 + +--- + +## カスタマイズ + +### プロンプト (starship) + +`config/starship.toml` を編集してカスタマイズできます。 +インストール後は `~/.config/starship.toml` に配置されます。 + +### ディレクトリ別環境変数 (direnv) + +プロジェクトルートに `.envrc` を作成: + +```bash +export DATABASE_URL="postgresql://localhost/myapp" +export NODE_ENV="development" +``` + +```bash +direnv allow # 初回のみ許可 +``` + +### プロジェクトテンプレート + +`newproject` 関数でプロジェクトを素早く作成できます: + +```bash +newproject node my-app # Node.js プロジェクト +newproject python my-script # Python プロジェクト +``` + +--- + +## 秘密情報の管理 + +API キーや環境固有の設定は **`~/.zshrc.local`** に記載します(git に含まれません)。 + +```bash +cp dotfiles/.zshrc.local.example ~/.zshrc.local +# エディタで ~/.zshrc.local を編集 +``` + +詳細は [Doc/ja/secrets.md](Doc/ja/secrets.md) を参照してください。 + +--- + +## アンインストール + +```bash +bash uninstall.sh +``` + +- `~/.zshrc.d/` 内の配置ファイルを削除 +- `.zshrc`、`.tmux.conf`、`.emacs.el` のバックアップを復元 +- `~/.config/starship.toml`、`~/.config/atuin/config.toml` を削除 +- git の `commit.template` 設定を削除 +- 任意でインストールしたパッケージを削除 + +--- + +## ドキュメント + +- [tmux 設定](Doc/ja/Tmux.md) +- [zsh 設定](Doc/ja/zsh.md) +- [ツール詳細](Doc/ja/tools.md) +- [秘密情報の管理](Doc/ja/secrets.md) +- [emacs](Doc/ja/emacs.md) | [htop](Doc/ja/htop.md) | [neofetch](Doc/ja/neofetch.md) | [yazi](Doc/ja/yazi.md) + +--- + +## 対応環境 + +| 環境 | 状態 | +|------|------| +| macOS (Apple Silicon / Intel) | ✅ | +| Ubuntu 22.04 / 24.04 | ✅ | +| WSL2 (Ubuntu) | ✅ | + +--- + +## ライセンス + +MIT — 詳細は [LICENSE](LICENSE) を参照してください。 diff --git a/README.md b/README.md index 7defac9..6ee0168 100644 --- a/README.md +++ b/README.md @@ -1,204 +1,212 @@ -[![Linux](https://github.com/long-910/dotfiles/actions/workflows/linux.yml/badge.svg)](https://github.com/long-910/dotfiles/actions/workflows/linux.yml) -[![macOS](https://github.com/long-910/dotfiles/actions/workflows/macos.yml/badge.svg)](https://github.com/long-910/dotfiles/actions/workflows/macos.yml) -[![ShellCheck](https://github.com/long-910/dotfiles/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/long-910/dotfiles/actions/workflows/shellcheck.yml) -[![License](https://img.shields.io/github/license/long-910/dotfiles)](https://github.com/long-910/dotfiles/blob/main/LICENSE) -[![Sponsor](https://img.shields.io/badge/Sponsor-GitHub-pink?logo=github)](https://github.com/sponsors/long-910) - -[English](README.md) | [日本語](README.ja.md) | [中文](README.zh.md) - -# dotfiles - -Development environment setup scripts for macOS, Ubuntu, and WSL. -Select and install only the feature blocks you need via an interactive menu. - ---- - -## Quick Start - -### One-line install (curl) - -Clone and run the interactive installer in one command: - -```bash -curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash -``` - -To install everything non-interactively: - -```bash -curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash -s -- --all -``` - -The repository is cloned to `~/.dotfiles`. Set `DOTFILES_DIR` to override the location: - -```bash -DOTFILES_DIR=~/my-dotfiles curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash -``` - -### bootstrap.sh (git clone) - -Select feature blocks from an interactive menu. - -```bash -git clone https://github.com/long-910/dotfiles.git -cd dotfiles -bash bootstrap.sh -``` - -### install_and_configure.sh (Legacy) - -All-in-one installer. For environments where `bootstrap.sh` is unavailable. - -```bash -git clone https://github.com/long-910/dotfiles.git -cd dotfiles -chmod +x install_and_configure.sh -./install_and_configure.sh -``` - ---- - -## Feature Blocks - -| Block | Tools | Default | -|-------|-------|---------| -| **Core** | zsh, tmux, lsd, emacs, htop, neofetch, yazi | ON | -| **Shell** | starship, fzf, zoxide, atuin | ON | -| **Dev** | gh, ripgrep, direnv, bat, delta, fd, jq, lazygit | ON | -| **Node.js** | fnm + Node LTS + commitizen | OFF | -| **Docker** | Docker CE + Docker Compose | OFF | - -Toggle ON/OFF by entering numbers when `bootstrap.sh` starts. -Non-interactive execution is also available: - -```bash -bash bootstrap.sh --all # All blocks -bash bootstrap.sh --module shell # Single module -bash bootstrap.sh --non-interactive # Auto with defaults -bash bootstrap.sh --list # List modules -``` - ---- - -## Tools - -### Prompt & Shell Enhancement - -| Tool | Description | -|------|-------------| -| [starship](https://starship.rs/) | Fast, customizable cross-shell prompt | -| [fzf](https://github.com/junegunn/fzf) | Fuzzy finder. `Ctrl-R` for history, `Ctrl-T` for files | -| [zoxide](https://github.com/ajeetdsouza/zoxide) | Smart `cd` replacement. `z proj` jumps to frequent dirs | -| [atuin](https://atuin.sh/) | SQLite-based shell history. `Ctrl-R` for fuzzy search | - -### Development Tools - -| Tool | Description | -|------|-------------| -| [gh](https://cli.github.com/) | GitHub CLI. Manage PRs and Issues from the terminal | -| [ripgrep](https://github.com/BurntSushi/ripgrep) | Fast grep alternative. Respects `.gitignore` | -| [direnv](https://direnv.net/) | Auto-load per-directory environment variables | -| [bat](https://github.com/sharkdp/bat) | `cat` alternative with syntax highlighting | -| [delta](https://github.com/dandavison/delta) | Git diff pager with syntax highlighting | -| [fd](https://github.com/sharkdp/fd) | Fast `find` alternative | -| [jq](https://jqlang.github.io/jq/) | Command-line JSON processor | -| [lazygit](https://github.com/jesseduffield/lazygit) | Terminal UI for git | - -### Terminal Multiplexer - -| Tool | Description | -|------|-------------| -| [tmux](https://github.com/tmux/tmux) | Terminal multiplexer. Auto-starts on login; exit tmux to close the shell | - -tmux starts automatically when you open a new terminal and attaches to the most recent existing session, or creates a new one. Closing tmux also exits the shell. To disable, remove `~/.zshrc.d/tmux.zsh`. - -### File Management - -| Tool | Description | -|------|-------------| -| [lsd](https://github.com/lsd-rs/lsd) | `ls` alternative with icons | -| [yazi](https://yazi-rs.github.io/) | Terminal file manager. Launch with `yy`, cd to exit dir | - ---- - -## Customization - -### Prompt (starship) - -Edit `config/starship.toml` to customize. -After installation, it is placed at `~/.config/starship.toml`. - -### Per-directory Environment Variables (direnv) - -Create `.envrc` in your project root: - -```bash -export DATABASE_URL="postgresql://localhost/myapp" -export NODE_ENV="development" -``` - -```bash -direnv allow # Required on first use -``` - -### Project Templates - -Quickly scaffold projects with the `newproject` function: - -```bash -newproject node my-app # Node.js project -newproject python my-script # Python project -``` - ---- - -## Secrets Management - -Store API keys and environment-specific settings in **`~/.zshrc.local`** (not committed to git). - -```bash -cp dotfiles/.zshrc.local.example ~/.zshrc.local -# Edit ~/.zshrc.local with your editor -``` - -See [Doc/en/secrets.md](Doc/en/secrets.md) for details. - ---- - -## Uninstall - -```bash -bash uninstall.sh -``` - -- Removes deployed files from `~/.zshrc.d/` -- Restores backups of `.zshrc`, `.tmux.conf`, `.emacs.el` -- Removes `~/.config/starship.toml` and `~/.config/atuin/config.toml` -- Removes git `commit.template` setting -- Optionally removes installed packages - ---- - -## Documentation - -- [tmux](Doc/en/Tmux.md) -- [zsh](Doc/en/zsh.md) -- [Tools](Doc/en/tools.md) -- [Secrets Management](Doc/en/secrets.md) -- [emacs](Doc/en/emacs.md) | [htop](Doc/en/htop.md) | [neofetch](Doc/en/neofetch.md) | [yazi](Doc/en/yazi.md) - ---- - -## Supported Environments - -| Environment | Status | -|-------------|--------| -| macOS (Apple Silicon / Intel) | ✅ | -| Ubuntu 22.04 / 24.04 | ✅ | -| WSL2 (Ubuntu) | ✅ | - ---- - -## License - -MIT — See [LICENSE](LICENSE) for details. +[![Linux](https://github.com/long-910/dotfiles/actions/workflows/linux.yml/badge.svg)](https://github.com/long-910/dotfiles/actions/workflows/linux.yml) +[![macOS](https://github.com/long-910/dotfiles/actions/workflows/macos.yml/badge.svg)](https://github.com/long-910/dotfiles/actions/workflows/macos.yml) +[![ShellCheck](https://github.com/long-910/dotfiles/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/long-910/dotfiles/actions/workflows/shellcheck.yml) +[![License](https://img.shields.io/github/license/long-910/dotfiles)](https://github.com/long-910/dotfiles/blob/main/LICENSE) +[![Sponsor](https://img.shields.io/badge/Sponsor-GitHub-pink?logo=github)](https://github.com/sponsors/long-910) + +[English](README.md) | [日本語](README.ja.md) | [中文](README.zh.md) + +# dotfiles + +Development environment setup scripts for macOS, Ubuntu, and WSL. +Select and install only the feature blocks you need via an interactive menu. + +--- + +## Quick Start + +### One-line install (curl) + +Clone and run the interactive installer in one command: + +```bash +curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash +``` + +To install everything non-interactively: + +```bash +curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash -s -- --all +``` + +The repository is cloned to `~/.dotfiles`. Set `DOTFILES_DIR` to override the location: + +```bash +DOTFILES_DIR=~/my-dotfiles curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash +``` + +### bootstrap.sh (git clone) + +Select feature blocks from an interactive menu. + +```bash +git clone https://github.com/long-910/dotfiles.git +cd dotfiles +bash bootstrap.sh +``` + +### install_and_configure.sh (Legacy) + +All-in-one installer. For environments where `bootstrap.sh` is unavailable. + +```bash +git clone https://github.com/long-910/dotfiles.git +cd dotfiles +chmod +x install_and_configure.sh +./install_and_configure.sh +``` + +--- + +## Feature Blocks + +| Block | Tools | Default | +|-------|-------|---------| +| **Core** | zsh, tmux, lsd, emacs, htop, neofetch, yazi | ON | +| **Shell** | starship, fzf, zoxide, atuin | ON | +| **Dev** | gh, ripgrep, direnv, bat, delta, fd, jq, lazygit | ON | +| **Node.js** | fnm + Node LTS + commitizen | OFF | +| **Docker** | Docker CE + Docker Compose | OFF | + +Toggle ON/OFF by entering numbers when `bootstrap.sh` starts. +Non-interactive execution is also available: + +```bash +bash bootstrap.sh --all # All blocks +bash bootstrap.sh --module shell # Single module +bash bootstrap.sh --non-interactive # Auto with defaults +bash bootstrap.sh --list # List modules +``` + +--- + +## Tools + +### Prompt & Shell Enhancement + +| Tool | Description | +|------|-------------| +| [starship](https://starship.rs/) | Fast, customizable cross-shell prompt | +| [fzf](https://github.com/junegunn/fzf) | Fuzzy finder. `Ctrl-R` for history, `Ctrl-T` for files | +| [zoxide](https://github.com/ajeetdsouza/zoxide) | Smart `cd` replacement. `z proj` jumps to frequent dirs | +| [atuin](https://atuin.sh/) | SQLite-based shell history. `Ctrl-R` for fuzzy search | + +### Development Tools + +| Tool | Description | +|------|-------------| +| [gh](https://cli.github.com/) | GitHub CLI. Manage PRs and Issues from the terminal | +| [ripgrep](https://github.com/BurntSushi/ripgrep) | Fast grep alternative. Respects `.gitignore` | +| [direnv](https://direnv.net/) | Auto-load per-directory environment variables | +| [bat](https://github.com/sharkdp/bat) | `cat` alternative with syntax highlighting | +| [delta](https://github.com/dandavison/delta) | Git diff pager with syntax highlighting | +| [fd](https://github.com/sharkdp/fd) | Fast `find` alternative | +| [jq](https://jqlang.github.io/jq/) | Command-line JSON processor | +| [lazygit](https://github.com/jesseduffield/lazygit) | Terminal UI for git | + +### Terminal Multiplexer + +| Tool | Description | +|------|-------------| +| [tmux](https://github.com/tmux/tmux) | Terminal multiplexer. Auto-starts on login; exit tmux to close the shell | + +tmux starts automatically when you open a new terminal and attaches to the most recent existing session, or creates a new one. Closing tmux also exits the shell. To disable, remove `~/.zshrc.d/tmux.zsh`. + +### File Management + +| Tool | Description | +|------|-------------| +| [lsd](https://github.com/lsd-rs/lsd) | `ls` alternative with icons | +| [yazi](https://yazi-rs.github.io/) | Terminal file manager. Launch with `yy`, cd to exit dir | + +> **WSL2 — icons not displaying?** +> lsd uses [Nerd Fonts](https://www.nerdfonts.com/) for file-type icons. On WSL2 the terminal runs on Windows, so the font must be installed on the **Windows** side: +> +> 1. Download a Nerd Font (e.g. **CaskaydiaCove Nerd Font**, **JetBrainsMono Nerd Font**) from [nerdfonts.com](https://www.nerdfonts.com/font-downloads) +> 2. Right-click the `.ttf` file → **Install for all users** +> 3. In Windows Terminal: **Settings → your Ubuntu profile → Appearance → Font face** → select the installed font (e.g. `CaskaydiaCove Nerd Font Mono`) +> 4. Restart the terminal + +--- + +## Customization + +### Prompt (starship) + +Edit `config/starship.toml` to customize. +After installation, it is placed at `~/.config/starship.toml`. + +### Per-directory Environment Variables (direnv) + +Create `.envrc` in your project root: + +```bash +export DATABASE_URL="postgresql://localhost/myapp" +export NODE_ENV="development" +``` + +```bash +direnv allow # Required on first use +``` + +### Project Templates + +Quickly scaffold projects with the `newproject` function: + +```bash +newproject node my-app # Node.js project +newproject python my-script # Python project +``` + +--- + +## Secrets Management + +Store API keys and environment-specific settings in **`~/.zshrc.local`** (not committed to git). + +```bash +cp dotfiles/.zshrc.local.example ~/.zshrc.local +# Edit ~/.zshrc.local with your editor +``` + +See [Doc/en/secrets.md](Doc/en/secrets.md) for details. + +--- + +## Uninstall + +```bash +bash uninstall.sh +``` + +- Removes deployed files from `~/.zshrc.d/` +- Restores backups of `.zshrc`, `.tmux.conf`, `.emacs.el` +- Removes `~/.config/starship.toml` and `~/.config/atuin/config.toml` +- Removes git `commit.template` setting +- Optionally removes installed packages + +--- + +## Documentation + +- [tmux](Doc/en/Tmux.md) +- [zsh](Doc/en/zsh.md) +- [Tools](Doc/en/tools.md) +- [Secrets Management](Doc/en/secrets.md) +- [emacs](Doc/en/emacs.md) | [htop](Doc/en/htop.md) | [neofetch](Doc/en/neofetch.md) | [yazi](Doc/en/yazi.md) + +--- + +## Supported Environments + +| Environment | Status | +|-------------|--------| +| macOS (Apple Silicon / Intel) | ✅ | +| Ubuntu 22.04 / 24.04 | ✅ | +| WSL2 (Ubuntu) | ✅ | + +--- + +## License + +MIT — See [LICENSE](LICENSE) for details. diff --git a/README.zh.md b/README.zh.md index 2a70336..49b46a3 100644 --- a/README.zh.md +++ b/README.zh.md @@ -1,203 +1,211 @@ -[![Linux](https://github.com/long-910/dotfiles/actions/workflows/linux.yml/badge.svg)](https://github.com/long-910/dotfiles/actions/workflows/linux.yml) -[![macOS](https://github.com/long-910/dotfiles/actions/workflows/macos.yml/badge.svg)](https://github.com/long-910/dotfiles/actions/workflows/macos.yml) -[![ShellCheck](https://github.com/long-910/dotfiles/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/long-910/dotfiles/actions/workflows/shellcheck.yml) -[![License](https://img.shields.io/github/license/long-910/dotfiles)](https://github.com/long-910/dotfiles/blob/main/LICENSE) -[![Sponsor](https://img.shields.io/badge/Sponsor-GitHub-pink?logo=github)](https://github.com/sponsors/long-910) - -[English](README.md) | [日本語](README.ja.md) | [中文](README.zh.md) - -# dotfiles - -适用于 macOS、Ubuntu 和 WSL 的开发环境搭建脚本。 -通过交互式菜单选择并安装所需的功能模块。 - ---- - -## 快速开始 - -### 一键安装(curl) - -用一条命令克隆并启动交互式安装程序: - -```bash -curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash -``` - -非交互式安装所有模块: - -```bash -curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash -s -- --all -``` - -仓库将克隆到 `~/.dotfiles`,可通过 `DOTFILES_DIR` 自定义路径: - -```bash -DOTFILES_DIR=~/my-dotfiles curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash -``` - -### bootstrap.sh(git clone) - -通过交互式菜单选择功能模块进行安装。 - -```bash -git clone https://github.com/long-910/dotfiles.git -cd dotfiles -bash bootstrap.sh -``` - -### install_and_configure.sh(传统方式) - -一键安装。适用于 `bootstrap.sh` 无法使用的环境。 - -```bash -git clone https://github.com/long-910/dotfiles.git -cd dotfiles -chmod +x install_and_configure.sh -./install_and_configure.sh -``` - ---- - -## 功能模块 - -| 模块 | 包含工具 | 默认 | -|------|---------|------| -| **Core** | zsh, tmux, lsd, emacs, htop, neofetch, yazi | ON | -| **Shell** | starship, fzf, zoxide, atuin | ON | -| **Dev** | gh, ripgrep, direnv, bat, delta, fd, jq, lazygit | ON | -| **Node.js** | fnm + Node LTS + commitizen | OFF | -| **Docker** | Docker CE + Docker Compose | OFF | - -启动 `bootstrap.sh` 时输入数字来切换 ON/OFF。也支持非交互式执行: - -```bash -bash bootstrap.sh --all # 安装所有模块 -bash bootstrap.sh --module shell # 仅安装指定模块 -bash bootstrap.sh --non-interactive # 使用默认配置自动运行 -bash bootstrap.sh --list # 列出所有模块 -``` - ---- - -## 工具详情 - -### 提示符与 Shell 增强 - -| 工具 | 说明 | -|------|------| -| [starship](https://starship.rs/) | 快速、可定制的跨 Shell 提示符 | -| [fzf](https://github.com/junegunn/fzf) | 模糊查找器。`Ctrl-R` 搜索历史记录,`Ctrl-T` 搜索文件 | -| [zoxide](https://github.com/ajeetdsouza/zoxide) | 智能 `cd` 替代。`z proj` 跳转到常用目录 | -| [atuin](https://atuin.sh/) | 基于 SQLite 的 Shell 历史记录。`Ctrl-R` 模糊搜索 | - -### 开发工具 - -| 工具 | 说明 | -|------|------| -| [gh](https://cli.github.com/) | GitHub CLI。在终端管理 PR 和 Issue | -| [ripgrep](https://github.com/BurntSushi/ripgrep) | 高速 grep 替代。自动遵循 `.gitignore` | -| [direnv](https://direnv.net/) | 按目录自动加载环境变量 | -| [bat](https://github.com/sharkdp/bat) | 带语法高亮的 `cat` 替代 | -| [delta](https://github.com/dandavison/delta) | 带语法高亮的 git diff 分页器 | -| [fd](https://github.com/sharkdp/fd) | 高速 `find` 替代 | -| [jq](https://jqlang.github.io/jq/) | 命令行 JSON 处理器 | -| [lazygit](https://github.com/jesseduffield/lazygit) | git 的终端 UI | - -### 终端复用器 - -| 工具 | 说明 | -|------|------| -| [tmux](https://github.com/tmux/tmux) | 终端复用器。登录时自动启动;退出 tmux 同时退出 Shell | - -打开新终端时 tmux 会自动启动,并附加到最近的现有会话(不存在则创建新会话)。关闭 tmux 时 Shell 也会一并退出。如需禁用,请删除 `~/.zshrc.d/tmux.zsh`。 - -### 文件管理 - -| 工具 | 说明 | -|------|------| -| [lsd](https://github.com/lsd-rs/lsd) | 带图标的 `ls` 替代 | -| [yazi](https://yazi-rs.github.io/) | 终端文件管理器。用 `yy` 启动,退出后自动切换目录 | - ---- - -## 自定义 - -### 提示符(starship) - -编辑 `config/starship.toml` 进行自定义。 -安装后文件位于 `~/.config/starship.toml`。 - -### 按目录加载环境变量(direnv) - -在项目根目录创建 `.envrc`: - -```bash -export DATABASE_URL="postgresql://localhost/myapp" -export NODE_ENV="development" -``` - -```bash -direnv allow # 首次使用时需要授权 -``` - -### 项目模板 - -使用 `newproject` 函数快速创建项目: - -```bash -newproject node my-app # Node.js 项目 -newproject python my-script # Python 项目 -``` - ---- - -## 密钥管理 - -API 密钥和特定于机器的配置请写入 **`~/.zshrc.local`**(不会提交到 git)。 - -```bash -cp dotfiles/.zshrc.local.example ~/.zshrc.local -# 用编辑器修改 ~/.zshrc.local -``` - -详情请参阅 [Doc/zh/secrets.md](Doc/zh/secrets.md)。 - ---- - -## 卸载 - -```bash -bash uninstall.sh -``` - -- 删除 `~/.zshrc.d/` 中部署的文件 -- 恢复 `.zshrc`、`.tmux.conf`、`.emacs.el` 的备份 -- 删除 `~/.config/starship.toml` 和 `~/.config/atuin/config.toml` -- 删除 git `commit.template` 配置 -- 可选择性地卸载已安装的软件包 - ---- - -## 文档 - -- [tmux 配置](Doc/zh/Tmux.md) -- [zsh 配置](Doc/zh/zsh.md) -- [工具详情](Doc/zh/tools.md) -- [密钥管理](Doc/zh/secrets.md) -- [emacs](Doc/zh/emacs.md) | [htop](Doc/zh/htop.md) | [neofetch](Doc/zh/neofetch.md) | [yazi](Doc/zh/yazi.md) - ---- - -## 支持环境 - -| 环境 | 状态 | -|------|------| -| macOS (Apple Silicon / Intel) | ✅ | -| Ubuntu 22.04 / 24.04 | ✅ | -| WSL2 (Ubuntu) | ✅ | - ---- - -## 许可证 - -MIT — 详情请参阅 [LICENSE](LICENSE)。 +[![Linux](https://github.com/long-910/dotfiles/actions/workflows/linux.yml/badge.svg)](https://github.com/long-910/dotfiles/actions/workflows/linux.yml) +[![macOS](https://github.com/long-910/dotfiles/actions/workflows/macos.yml/badge.svg)](https://github.com/long-910/dotfiles/actions/workflows/macos.yml) +[![ShellCheck](https://github.com/long-910/dotfiles/actions/workflows/shellcheck.yml/badge.svg)](https://github.com/long-910/dotfiles/actions/workflows/shellcheck.yml) +[![License](https://img.shields.io/github/license/long-910/dotfiles)](https://github.com/long-910/dotfiles/blob/main/LICENSE) +[![Sponsor](https://img.shields.io/badge/Sponsor-GitHub-pink?logo=github)](https://github.com/sponsors/long-910) + +[English](README.md) | [日本語](README.ja.md) | [中文](README.zh.md) + +# dotfiles + +适用于 macOS、Ubuntu 和 WSL 的开发环境搭建脚本。 +通过交互式菜单选择并安装所需的功能模块。 + +--- + +## 快速开始 + +### 一键安装(curl) + +用一条命令克隆并启动交互式安装程序: + +```bash +curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash +``` + +非交互式安装所有模块: + +```bash +curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash -s -- --all +``` + +仓库将克隆到 `~/.dotfiles`,可通过 `DOTFILES_DIR` 自定义路径: + +```bash +DOTFILES_DIR=~/my-dotfiles curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash +``` + +### bootstrap.sh(git clone) + +通过交互式菜单选择功能模块进行安装。 + +```bash +git clone https://github.com/long-910/dotfiles.git +cd dotfiles +bash bootstrap.sh +``` + +### install_and_configure.sh(传统方式) + +一键安装。适用于 `bootstrap.sh` 无法使用的环境。 + +```bash +git clone https://github.com/long-910/dotfiles.git +cd dotfiles +chmod +x install_and_configure.sh +./install_and_configure.sh +``` + +--- + +## 功能模块 + +| 模块 | 包含工具 | 默认 | +|------|---------|------| +| **Core** | zsh, tmux, lsd, emacs, htop, neofetch, yazi | ON | +| **Shell** | starship, fzf, zoxide, atuin | ON | +| **Dev** | gh, ripgrep, direnv, bat, delta, fd, jq, lazygit | ON | +| **Node.js** | fnm + Node LTS + commitizen | OFF | +| **Docker** | Docker CE + Docker Compose | OFF | + +启动 `bootstrap.sh` 时输入数字来切换 ON/OFF。也支持非交互式执行: + +```bash +bash bootstrap.sh --all # 安装所有模块 +bash bootstrap.sh --module shell # 仅安装指定模块 +bash bootstrap.sh --non-interactive # 使用默认配置自动运行 +bash bootstrap.sh --list # 列出所有模块 +``` + +--- + +## 工具详情 + +### 提示符与 Shell 增强 + +| 工具 | 说明 | +|------|------| +| [starship](https://starship.rs/) | 快速、可定制的跨 Shell 提示符 | +| [fzf](https://github.com/junegunn/fzf) | 模糊查找器。`Ctrl-R` 搜索历史记录,`Ctrl-T` 搜索文件 | +| [zoxide](https://github.com/ajeetdsouza/zoxide) | 智能 `cd` 替代。`z proj` 跳转到常用目录 | +| [atuin](https://atuin.sh/) | 基于 SQLite 的 Shell 历史记录。`Ctrl-R` 模糊搜索 | + +### 开发工具 + +| 工具 | 说明 | +|------|------| +| [gh](https://cli.github.com/) | GitHub CLI。在终端管理 PR 和 Issue | +| [ripgrep](https://github.com/BurntSushi/ripgrep) | 高速 grep 替代。自动遵循 `.gitignore` | +| [direnv](https://direnv.net/) | 按目录自动加载环境变量 | +| [bat](https://github.com/sharkdp/bat) | 带语法高亮的 `cat` 替代 | +| [delta](https://github.com/dandavison/delta) | 带语法高亮的 git diff 分页器 | +| [fd](https://github.com/sharkdp/fd) | 高速 `find` 替代 | +| [jq](https://jqlang.github.io/jq/) | 命令行 JSON 处理器 | +| [lazygit](https://github.com/jesseduffield/lazygit) | git 的终端 UI | + +### 终端复用器 + +| 工具 | 说明 | +|------|------| +| [tmux](https://github.com/tmux/tmux) | 终端复用器。登录时自动启动;退出 tmux 同时退出 Shell | + +打开新终端时 tmux 会自动启动,并附加到最近的现有会话(不存在则创建新会话)。关闭 tmux 时 Shell 也会一并退出。如需禁用,请删除 `~/.zshrc.d/tmux.zsh`。 + +### 文件管理 + +| 工具 | 说明 | +|------|------| +| [lsd](https://github.com/lsd-rs/lsd) | 带图标的 `ls` 替代 | +| [yazi](https://yazi-rs.github.io/) | 终端文件管理器。用 `yy` 启动,退出后自动切换目录 | + +> **WSL2 图标无法显示?** +> lsd 的图标依赖 [Nerd Fonts](https://www.nerdfonts.com/)。在 WSL2 中,终端在 Windows 侧运行,因此字体必须安装在 **Windows 侧**: +> +> 1. 从 [nerdfonts.com](https://www.nerdfonts.com/font-downloads) 下载 Nerd Font(推荐:**CaskaydiaCove Nerd Font**、**JetBrainsMono Nerd Font**) +> 2. 右键点击 `.ttf` 文件 → **"为所有用户安装"** +> 3. Windows Terminal:**设置 → Ubuntu 配置文件 → 外观 → 字体**,选择已安装的字体(如 `CaskaydiaCove Nerd Font Mono`) +> 4. 重启终端 + +--- + +## 自定义 + +### 提示符(starship) + +编辑 `config/starship.toml` 进行自定义。 +安装后文件位于 `~/.config/starship.toml`。 + +### 按目录加载环境变量(direnv) + +在项目根目录创建 `.envrc`: + +```bash +export DATABASE_URL="postgresql://localhost/myapp" +export NODE_ENV="development" +``` + +```bash +direnv allow # 首次使用时需要授权 +``` + +### 项目模板 + +使用 `newproject` 函数快速创建项目: + +```bash +newproject node my-app # Node.js 项目 +newproject python my-script # Python 项目 +``` + +--- + +## 密钥管理 + +API 密钥和特定于机器的配置请写入 **`~/.zshrc.local`**(不会提交到 git)。 + +```bash +cp dotfiles/.zshrc.local.example ~/.zshrc.local +# 用编辑器修改 ~/.zshrc.local +``` + +详情请参阅 [Doc/zh/secrets.md](Doc/zh/secrets.md)。 + +--- + +## 卸载 + +```bash +bash uninstall.sh +``` + +- 删除 `~/.zshrc.d/` 中部署的文件 +- 恢复 `.zshrc`、`.tmux.conf`、`.emacs.el` 的备份 +- 删除 `~/.config/starship.toml` 和 `~/.config/atuin/config.toml` +- 删除 git `commit.template` 配置 +- 可选择性地卸载已安装的软件包 + +--- + +## 文档 + +- [tmux 配置](Doc/zh/Tmux.md) +- [zsh 配置](Doc/zh/zsh.md) +- [工具详情](Doc/zh/tools.md) +- [密钥管理](Doc/zh/secrets.md) +- [emacs](Doc/zh/emacs.md) | [htop](Doc/zh/htop.md) | [neofetch](Doc/zh/neofetch.md) | [yazi](Doc/zh/yazi.md) + +--- + +## 支持环境 + +| 环境 | 状态 | +|------|------| +| macOS (Apple Silicon / Intel) | ✅ | +| Ubuntu 22.04 / 24.04 | ✅ | +| WSL2 (Ubuntu) | ✅ | + +--- + +## 许可证 + +MIT — 详情请参阅 [LICENSE](LICENSE)。 diff --git a/config/starship.toml b/config/starship.toml index 1e6857a..ce2bd72 100644 --- a/config/starship.toml +++ b/config/starship.toml @@ -2,10 +2,10 @@ # Kali Linux style: ┌──(user@host)-[dir git]\n└─$ format = """ -[┌──\\(](bold green)$username[@](bold green)$hostname[\\)─\\[](bold green)$directory[$git_branch$git_status](bold green)[\\]](bold green)\n\ -$git_state\ +[┌──\\(](bold green)$username[@](bold green)$hostname[\\)─\\[](bold green)$directory[$git_branch$git_status](bold green)[\\]](bold green)\ $nodejs$python$rust$golang\ $cmd_duration\ +\n$git_state\ [└─](bold green)$character""" # Prompt character — $ for user, # for root (Kali style) From 499e1b19c751f1d5e6b81c6f6b4bee038868c2f0 Mon Sep 17 00:00:00 2001 From: long-910 <7323488+long-910@users.noreply.github.com> Date: Sun, 8 Mar 2026 15:51:32 +0900 Subject: [PATCH 4/4] Fix: move git_state to first prompt line; fix fnm XDG_RUNTIME_DIR on WSL2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - starship.toml: move $git_state to first line so MERGING/REBASING state appears inline instead of on the same line as └─$ - node.zsh: fall back to XDG_RUNTIME_DIR=/tmp when runtime dir does not exist (WSL2 without systemd), preventing fnm multishell symlink errors Co-Authored-By: Claude Sonnet 4.6 --- config/starship.toml | 4 ++-- dotfiles/.zshrc.d/node.zsh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/starship.toml b/config/starship.toml index ce2bd72..05b8faf 100644 --- a/config/starship.toml +++ b/config/starship.toml @@ -3,10 +3,10 @@ format = """ [┌──\\(](bold green)$username[@](bold green)$hostname[\\)─\\[](bold green)$directory[$git_branch$git_status](bold green)[\\]](bold green)\ +$git_state\ $nodejs$python$rust$golang\ $cmd_duration\ -\n$git_state\ -[└─](bold green)$character""" +\n[└─](bold green)$character""" # Prompt character — $ for user, # for root (Kali style) [character] diff --git a/dotfiles/.zshrc.d/node.zsh b/dotfiles/.zshrc.d/node.zsh index 575d17e..ef71461 100644 --- a/dotfiles/.zshrc.d/node.zsh +++ b/dotfiles/.zshrc.d/node.zsh @@ -2,5 +2,6 @@ # ~/.zshrc.d/node.zsh — fnm Node.js version manager (lazy-load) if command -v fnm >/dev/null 2>&1; then + [ ! -d "${XDG_RUNTIME_DIR:-}" ] && export XDG_RUNTIME_DIR=/tmp eval "$(fnm env --use-on-cd)" fi