diff --git a/.chezmoiignore b/.chezmoiignore index 1322cbdb5..3696fe9fc 100644 --- a/.chezmoiignore +++ b/.chezmoiignore @@ -9,6 +9,8 @@ **/*brew* {{- end }} _* +plan* + .config/claude* .config/dbeaver* .config/memo* diff --git a/CLAUDE.md b/CLAUDE.md index 3f991f903..04320c9f6 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -107,9 +107,8 @@ Scoop (Windows/WSL2) **Terminal:** -- Alacritty with tmux as terminal multiplexer -- Rio terminal as alternative -- Auto-launch tmux in Alacritty/Rio terminals +- Alacritty, Ghostty, Rio, and WezTerm with tmux as terminal multiplexer +- Auto-launch tmux in supported terminal emulators **Shell:** @@ -197,10 +196,12 @@ The repository uses [zabrze](https://github.com/orhun/zabrze) for shell abbrevia This repository manages 46+ tool configurations in `dot_config/`: -### Terminal & Shell (7 tools) +### Terminal & Shell (9 tools) - `alacritty/` - Alacritty terminal emulator (TOML config with keybindings) +- `ghostty/` - Ghostty terminal emulator - `rio/` - Rio terminal emulator +- `wezterm/` - WezTerm terminal emulator (Lua config with tmux-oriented keybindings) - `tmux/` - tmux terminal multiplexer (custom keybindings, status bar) - `tig/` - Tig Git TUI - `zsh/` - Zsh shell (modularized with lazy loading) @@ -275,7 +276,7 @@ This repository manages 46+ tool configurations in `dot_config/`: ## Template System -Chezmoi templates (6 files with `.tmpl` extension) enable platform-specific configurations: +Chezmoi templates (7 files with `.tmpl` extension) enable platform-specific configurations: **Template Features:** @@ -289,9 +290,10 @@ Chezmoi templates (6 files with `.tmpl` extension) enable platform-specific conf 1. `dot_config/zsh/dot_zshenv.tmpl` - Zsh environment variables (XDG, PATH) 2. `dot_config/git/config.tmpl` - Git config (platform-specific, Delta integration) 3. `dot_config/alacritty/alacritty.toml.tmpl` - Alacritty terminal config -4. `dot_config/rio/private_config.toml.tmpl` - Rio terminal config -5. `dot_config/zsh/lazy/work.zsh.tmpl` - Work-specific zsh config -6. `dot_config/dot_czrc.tmpl` - commitizen configuration +4. `dot_config/ghostty/config.tmpl` - Ghostty terminal config +5. `dot_config/rio/private_config.toml.tmpl` - Rio terminal config +6. `dot_config/zsh/lazy/work.zsh.tmpl` - Work-specific zsh config +7. `dot_config/dot_czrc.tmpl` - commitizen configuration ## Platform Support diff --git a/README.md b/README.md index f86b0d680..ab8c8aeb6 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ - OS: MacOS/Windows(WSL2) - shell: zsh - plugin manager: [zinit](https://github.com/zdharma-continuum/zinit) -- Terminal: [Alacritty](https://github.com/alacritty/alacritty) +- Terminal: [Alacritty](https://github.com/alacritty/alacritty), [Ghostty](https://ghostty.org/), [Rio](https://raphamorim.io/rio/), [WezTerm](https://wezfurlong.org/wezterm/) - Terminal Multiplexer: [tmux](https://github.com/tmux/tmux) - Editor: VSCode,NeoVim diff --git a/dot_config/brew/brew_cask.json b/dot_config/brew/brew_cask.json index 1d5fc7a32..a91d6308a 100644 --- a/dot_config/brew/brew_cask.json +++ b/dot_config/brew/brew_cask.json @@ -10,6 +10,7 @@ "dbeaver-community": "26.0.0", "docker-desktop": "4.63.0,220185", "firefox": "148.0", + "ghostty": "latest", "font-hackgen": "2.10.0", "font-hackgen-nerd": "2.10.0", "google-drive": "121.0.1", diff --git a/dot_config/ghostty/config.tmpl b/dot_config/ghostty/config.tmpl new file mode 100644 index 000000000..d57e18102 --- /dev/null +++ b/dot_config/ghostty/config.tmpl @@ -0,0 +1,88 @@ +# Ghostty is configured to match the existing tmux-first setup as closely as +# possible without depending on manual host-local tweaks. + +term = xterm-ghostty + +font-family = "HackGen35 Console NF" +font-size = 12 + +background = #191724 +foreground = #ffffff +cursor-color = #ffffff +cursor-text = #E0DEF4 +background-opacity = 0.95 + +window-padding-x = 0 +window-padding-y = 0 + +confirm-close-surface = false +window-decoration = false +maximize = true + +palette = 0=#000000 +palette = 1=#fe0100 +palette = 2=#33ff00 +palette = 3=#feff00 +palette = 4=#0066ff +palette = 5=#cc00ff +palette = 6=#00ffff +palette = 7=#d0d0d0 +palette = 8=#808080 +palette = 9=#fe0100 +palette = 10=#33ff00 +palette = 11=#feff00 +palette = 12=#0066ff +palette = 13=#cc00ff +palette = 14=#00ffff +palette = 15=#ffffff + +{{ if eq .chezmoi.os "darwin" -}} +macos-option-as-alt = true + +keybind = super+d=text:\x02% +keybind = super+shift+d=text:\x02" +keybind = super+c=text:\x02[ +keybind = super+e=text:\x02\x20 +keybind = super+shift+e=text:\x02Q +keybind = super+f=text:\x02\x06 +keybind = super+l=text:\x02s +keybind = super+shift+l=text:\x02w +keybind = super+o=text:\x02R +keybind = super+p=text:\x02\x10 +keybind = super+shift+p=text:\x02\x14 +keybind = super+r=text:\x02r +keybind = super+s=text:\x02e +keybind = super+shift+r=text:\x02\x12 +keybind = super+shift+s=text:\x02\x13 +keybind = super+t=text:\x02c +keybind = super+w=text:\x02x +keybind = super+x=text:\x02x +keybind = super+shift+w=text:\x02d +keybind = super+z=text:\x02z +keybind = super+left=text:\x02h +keybind = super+down=text:\x02j +keybind = super+up=text:\x02k +keybind = super+right=text:\x02l +keybind = super+shift+left=text:\x02\x08 +keybind = super+shift+down=text:\x02\x09 +keybind = super+shift+up=text:\x02\x0b +keybind = super+shift+right=text:\x02\x0c +keybind = super+shift+alt+up=text:\x02{ +keybind = super+shift+alt+down=text:\x02} +keybind = super+[=text:\x02\x09 +keybind = super+]=text:\x02\x1d +keybind = super+shift+[=text:\x02p +keybind = super+shift+]=text:\x02n +keybind = super+shift+alt+[=text:\x02\x18 +keybind = super+shift+alt+]=text:\x02\x19 +keybind = super+space=text:\x02\x20 +keybind = super+1=text:\x021 +keybind = super+2=text:\x022 +keybind = super+3=text:\x023 +keybind = super+4=text:\x024 +keybind = super+5=text:\x025 +keybind = super+6=text:\x026 +keybind = super+7=text:\x027 +keybind = super+8=text:\x028 +keybind = super+9=text:\x029 +{{- end }} diff --git a/dot_config/tmux/tmux.conf b/dot_config/tmux/tmux.conf index 40c2888d4..7272f7ea8 100644 --- a/dot_config/tmux/tmux.conf +++ b/dot_config/tmux/tmux.conf @@ -20,7 +20,7 @@ set -g status-interval 1 # True color化対応 set -g default-terminal "screen-256color" # set -g default-terminal "tmux-256color" # tmux-256colorではMacOSでは表示崩れがあったため -set -ag terminal-overrides ",alacritty:RGB,rio:Tc" +set -ag terminal-overrides ",alacritty:RGB,rio:Tc,wezterm:RGB,xterm-256color:RGB,xterm-ghostty:RGB,ghostty:RGB" # tmuxを経由して実際のターミナルに直接エスケープシーケンスを送信できるようにする set -g allow-passthrough on diff --git a/dot_config/wezterm/wezterm.lua b/dot_config/wezterm/wezterm.lua new file mode 100644 index 000000000..b46e04920 --- /dev/null +++ b/dot_config/wezterm/wezterm.lua @@ -0,0 +1,135 @@ +local wezterm = require "wezterm" + +local config = wezterm.config_builder and wezterm.config_builder() or {} +local is_darwin = wezterm.target_triple:find("darwin") ~= nil + +wezterm.on("gui-startup", function(cmd) + local tab, pane, window = wezterm.mux.spawn_window(cmd or {}) + window:gui_window():maximize() +end) + +local keys = {} + +local function send_string_binding(key, mods, value) + table.insert(keys, { + key = key, + mods = mods, + action = wezterm.action.SendString(value), + }) +end + +config.term = "xterm-256color" +config.front_end = "WebGpu" +config.webgpu_power_preference = "HighPerformance" +config.font = wezterm.font("HackGen35 Console NF") +config.font_size = 11.0 +config.window_background_opacity = 0.95 +config.window_decorations = "RESIZE" +config.window_close_confirmation = "NeverPrompt" +config.window_padding = { + left = 0, + right = 0, + top = 0, + bottom = 0, +} +config.hide_tab_bar_if_only_one_tab = true +config.use_fancy_tab_bar = false +config.disable_default_key_bindings = true +config.colors = { + foreground = "#ffffff", + background = "#191724", + cursor_bg = "#ffffff", + cursor_fg = "#E0DEF4", + ansi = { + "#000000", + "#fe0100", + "#33ff00", + "#feff00", + "#0066ff", + "#cc00ff", + "#00ffff", + "#d0d0d0", + }, + brights = { + "#808080", + "#fe0100", + "#33ff00", + "#feff00", + "#0066ff", + "#cc00ff", + "#00ffff", + "#ffffff", + }, +} + +if is_darwin then + config.default_prog = { "/bin/zsh", "--login" } + config.send_composed_key_when_left_alt_is_pressed = false + config.send_composed_key_when_right_alt_is_pressed = false + + send_string_binding("d", "CMD", "\x02%") + send_string_binding("d", "CMD|SHIFT", '\x02"') + send_string_binding("c", "CMD", "\x02[") + send_string_binding("e", "CMD", "\x02 ") + send_string_binding("e", "CMD|SHIFT", "\x02Q") + send_string_binding("f", "CMD", "\x02\x06") + send_string_binding("l", "CMD", "\x02s") + send_string_binding("l", "CMD|SHIFT", "\x02w") + send_string_binding("o", "CMD", "\x02R") + send_string_binding("p", "CMD", "\x02\x10") + send_string_binding("r", "CMD", "\x02r") + send_string_binding("s", "CMD", "\x02e") + send_string_binding("r", "CMD|SHIFT", "\x02\x12") + send_string_binding("s", "CMD|SHIFT", "\x02\x13") + send_string_binding("t", "CMD", "\x02c") + send_string_binding("w", "CMD", "\x02x") + send_string_binding("w", "CMD|SHIFT", "\x02d") + send_string_binding("z", "CMD", "\x02z") + send_string_binding("LeftArrow", "CMD", "\x02h") + send_string_binding("DownArrow", "CMD", "\x02j") + send_string_binding("UpArrow", "CMD", "\x02k") + send_string_binding("RightArrow", "CMD", "\x02l") + send_string_binding("LeftArrow", "CMD|SHIFT", "\x02\x08") + send_string_binding("DownArrow", "CMD|SHIFT", "\x02\x09") + send_string_binding("UpArrow", "CMD|SHIFT", "\x02\x0b") + send_string_binding("RightArrow", "CMD|SHIFT", "\x02\x0c") + send_string_binding("UpArrow", "CMD|SHIFT|OPT", "\x02{") + send_string_binding("DownArrow", "CMD|SHIFT|OPT", "\x02}") + send_string_binding("[", "CMD", "\x02\x09") + send_string_binding("]", "CMD", "\x02\x1d") + send_string_binding("{", "CMD|SHIFT", "\x02p") + send_string_binding("}", "CMD|SHIFT", "\x02n") + send_string_binding("{", "CMD|SHIFT|OPT", "\x02\x18") + send_string_binding("}", "CMD|SHIFT|OPT", "\x02\x19") + send_string_binding("Space", "CMD", "\x02 ") + send_string_binding("1", "CMD", "\x021") + send_string_binding("2", "CMD", "\x022") + send_string_binding("3", "CMD", "\x023") + send_string_binding("4", "CMD", "\x024") + send_string_binding("5", "CMD", "\x025") + send_string_binding("6", "CMD", "\x026") + send_string_binding("7", "CMD", "\x027") + send_string_binding("8", "CMD", "\x028") + send_string_binding("9", "CMD", "\x029") + table.insert(keys, { + key = "v", + mods = "CMD", + action = wezterm.action.PasteFrom("Clipboard"), + }) + table.insert(keys, { + key = "p", + mods = "CMD|SHIFT", + action = wezterm.action.ActivateCommandPalette, + }) + table.insert(keys, { + key = "q", + mods = "CMD", + action = wezterm.action.QuitApplication, + }) +else + config.default_prog = { "wsl.exe", "~", "-d", "Ubuntu-20.04" } +end + +config.keys = keys + +return config diff --git a/dot_config/zsh/dot_zshrc b/dot_config/zsh/dot_zshrc index 0b7cbb7b3..caca02526 100644 --- a/dot_config/zsh/dot_zshrc +++ b/dot_config/zsh/dot_zshrc @@ -1,7 +1,22 @@ # cSpell:disable # launch tmux when start zsh -if { [ "$TERM" = "alacritty" ] || [ "$TERM" = "rio" ] } && command -v tmux &> /dev/null && [ -z "$TMUX" ]; then +should_auto_attach_tmux=0 + +case "${TERM:-}" in + alacritty|rio|ghostty|xterm-ghostty) + should_auto_attach_tmux=1 + ;; + *) + case "${TERM_PROGRAM:-}" in + WezTerm|ghostty|Ghostty) + should_auto_attach_tmux=1 + ;; + esac + ;; +esac + +if [ "$should_auto_attach_tmux" -eq 1 ] && command -v tmux &> /dev/null && [ -z "$TMUX" ]; then tmux attach || tmux fi diff --git a/run_once_install-packages_mac.sh b/run_once_install-packages_mac.sh index 578d97f49..1242eb368 100644 --- a/run_once_install-packages_mac.sh +++ b/run_once_install-packages_mac.sh @@ -50,6 +50,7 @@ install_cask_package() { dbeaver-community docker firefox + ghostty google-chrome google-japanese-ime karabiner-elements @@ -59,6 +60,7 @@ install_cask_package() { thock thebrowsercompany-dia visual-studio-code + wezterm@nightly zoom )