diff --git a/README.ja.md b/README.ja.md index 982f2ef..77d9dd4 100644 --- a/README.ja.md +++ b/README.ja.md @@ -2,6 +2,7 @@ [![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) @@ -14,7 +15,27 @@ macOS・Ubuntu・WSL 向け開発環境セットアップスクリプト集で ## クイックスタート -### bootstrap.sh(推奨) +### ワンライナーインストール(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) インタラクティブメニューで機能ブロックを選択してインストール。 @@ -83,6 +104,14 @@ bash bootstrap.sh --list # モジュール一覧表示 | [jq](https://jqlang.github.io/jq/) | コマンドライン JSON プロセッサ | | [lazygit](https://github.com/jesseduffield/lazygit) | git のターミナル UI | +### ターミナルマルチプレクサ + +| ツール | 説明 | +|-------|------| +| [tmux](https://github.com/tmux/tmux) | ターミナルマルチプレクサ。ログイン時に自動起動し、tmux 終了でシェルも終了 | + +新しいターミナルを開くと tmux が自動的に起動し、`main` という名前のセッションにアタッチ(なければ作成)します。tmux を終了するとシェルも終了します。無効にするには `~/.zshrc.d/tmux.zsh` を削除してください。 + ### ファイル管理 | ツール | 説明 | diff --git a/README.md b/README.md index 9be7937..6dcb2cf 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![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) @@ -14,7 +15,27 @@ Select and install only the feature blocks you need via an interactive menu. ## Quick Start -### bootstrap.sh (Recommended) +### 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. @@ -83,6 +104,14 @@ bash bootstrap.sh --list # List modules | [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 (or creates) a session named `main`. Closing tmux also exits the shell. To disable, remove `~/.zshrc.d/tmux.zsh`. + ### File Management | Tool | Description | diff --git a/README.zh.md b/README.zh.md index 967cf18..20e5905 100644 --- a/README.zh.md +++ b/README.zh.md @@ -2,6 +2,7 @@ [![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) @@ -14,7 +15,27 @@ ## 快速开始 -### bootstrap.sh(推荐) +### 一键安装(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) 通过交互式菜单选择功能模块进行安装。 @@ -82,6 +103,14 @@ bash bootstrap.sh --list # 列出所有模块 | [jq](https://jqlang.github.io/jq/) | 命令行 JSON 处理器 | | [lazygit](https://github.com/jesseduffield/lazygit) | git 的终端 UI | +### 终端复用器 + +| 工具 | 说明 | +|------|------| +| [tmux](https://github.com/tmux/tmux) | 终端复用器。登录时自动启动;退出 tmux 同时退出 Shell | + +打开新终端时 tmux 会自动启动,并附加到名为 `main` 的会话(不存在则创建)。关闭 tmux 时 Shell 也会一并退出。如需禁用,请删除 `~/.zshrc.d/tmux.zsh`。 + ### 文件管理 | 工具 | 说明 | diff --git a/dotfiles/.zshrc.d/tmux.zsh b/dotfiles/.zshrc.d/tmux.zsh new file mode 100644 index 0000000..e06538d --- /dev/null +++ b/dotfiles/.zshrc.d/tmux.zsh @@ -0,0 +1,15 @@ +# shellcheck shell=bash +# Auto-start tmux when opening a new terminal. +# - If any session exists, attach to the most recent one. +# - Otherwise, create a new session. +# - When tmux exits, the shell (and terminal window) also exits. +# Skip if: already inside tmux, tmux not installed, or VSCode terminal. +if command -v tmux >/dev/null 2>&1 \ + && [ -z "${TMUX:-}" ] \ + && [ "${TERM_PROGRAM:-}" != "vscode" ]; then + if tmux list-sessions >/dev/null 2>&1; then + exec tmux attach-session + else + exec tmux new-session + fi +fi diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..4e048fa --- /dev/null +++ b/install.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# install.sh — One-line installer for long-910/dotfiles +# Usage: curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash +# curl -fsSL https://raw.githubusercontent.com/long-910/dotfiles/main/install.sh | bash -s -- --all +set -euo pipefail + +DOTFILES_DIR="${DOTFILES_DIR:-$HOME/.dotfiles}" +REPO="https://github.com/long-910/dotfiles.git" + +echo "=> Installing long-910/dotfiles into ${DOTFILES_DIR}" + +if [ -d "${DOTFILES_DIR}/.git" ]; then + echo "=> Repository already exists — pulling latest changes" + git -C "${DOTFILES_DIR}" pull --ff-only +else + echo "=> Cloning repository" + git clone --depth=1 "${REPO}" "${DOTFILES_DIR}" +fi + +# When piped from curl, stdin is the pipe (not a TTY). +# Redirect from /dev/tty so the interactive menu can read keyboard input. +if [ ! -t 0 ] && [ -c /dev/tty ]; then + exec bash "${DOTFILES_DIR}/bootstrap.sh" "$@"