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
2 changes: 2 additions & 0 deletions .chezmoiignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
**/*brew*
{{- end }}
_*
plan*

.config/claude*
.config/dbeaver*
.config/memo*
Expand Down
18 changes: 10 additions & 8 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:**

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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:**

Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions dot_config/brew/brew_cask.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
88 changes: 88 additions & 0 deletions dot_config/ghostty/config.tmpl
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 1 addition & 1 deletion dot_config/tmux/tmux.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
135 changes: 135 additions & 0 deletions dot_config/wezterm/wezterm.lua
Original file line number Diff line number Diff line change
@@ -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")
Comment on lines +100 to +103

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

{} のようなShiftキーを伴う文字を key に指定すると、weztermが暗黙的に SHIFT 修飾子を追加します。そのため、mods にも SHIFT を指定すると冗長になり、可読性が低下する可能性があります。

より明確にするために、ベースとなるキー(例: [)を key に指定し、modsSHIFT を含める形に統一することをお勧めします。

  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
17 changes: 16 additions & 1 deletion dot_config/zsh/dot_zshrc
Original file line number Diff line number Diff line change
@@ -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
Comment on lines +6 to +17

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

現在の実装では、$TERM$TERM_PROGRAM をチェックするために2つの case 文が使用されています。これは正常に動作しますが、より簡潔で効率的に記述できます。

最初の case 文で一致しなかった場合にのみ2つ目の case 文を評価するようにネストすることで、可読性と効率を改善できます。

case "${TERM:-}" in
  alacritty|rio|wezterm|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

Expand Down
2 changes: 2 additions & 0 deletions run_once_install-packages_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ install_cask_package() {
dbeaver-community
docker
firefox
ghostty
google-chrome
google-japanese-ime
karabiner-elements
Expand All @@ -59,6 +60,7 @@ install_cask_package() {
thock
thebrowsercompany-dia
visual-studio-code
wezterm@nightly

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

ここで wezterm@nightly をインストール対象に追加していますが、このプルリクエストの変更では、バージョン管理用の dot_config/brew/brew_cask.jsonwezterm@nightly が追加されていないようです。

ghostty と同様に、Renovateなどのツールでバージョンを追跡できるよう、brew_cask.json にも wezterm@nightly を追加するのが一貫性の観点から望ましいです。

zoom
)

Expand Down