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
6 changes: 6 additions & 0 deletions ansible/dotfiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
tags:
- agents

- name: Include tmux setup tasks
include_tasks: tasks/tmux.yml
tags:
- tmux
- setup

- name: Include dotfile linking tasks
include_tasks: tasks/link_files.yml
tags:
Expand Down
1 change: 1 addition & 0 deletions ansible/tasks/link_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
- { src: "github/create_pr.bash", dest: ".bin/pr" }
- { src: "hammerspoon/init.lua", dest: ".hammerspoon/init.lua" }
- { src: "ghostty/config", dest: ".config/ghostty/config" }
- { src: "tmux/tmux.conf", dest: ".tmux.conf" }
- {
src: "python/scratch_python_project.sh",
dest: ".bin/scratch_python_project",
Expand Down
12 changes: 12 additions & 0 deletions ansible/tasks/tmux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: Clone TPM (Tmux Plugin Manager)
ansible.builtin.git:
repo: https://github.com/tmux-plugins/tpm
dest: "{{ ansible_user_dir }}/.tmux/plugins/tpm"
depth: 1

- name: Install tmux plugins via TPM
ansible.builtin.command:
cmd: "{{ ansible_user_dir }}/.tmux/plugins/tpm/bin/install_plugins"
environment:
TMUX_PLUGIN_MANAGER_PATH: "{{ ansible_user_dir }}/.tmux/plugins"
5 changes: 5 additions & 0 deletions fish/config.fish
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ if test "$TERM_PROGRAM" = vscode
exit 0
end

# Auto-attach to tmux in Ghostty (but not inside nvim, scripts, or existing tmux)
if test "$TERM_PROGRAM" = ghostty; and not set -q TMUX; and not set -q NVIM; and status is-interactive
tmux new-session -A -s main
end

# Initialize starship and zoxide
starship init fish | source
zoxide init fish | source
Expand Down
4 changes: 4 additions & 0 deletions ghostty/config
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ font-size = 16
shell-integration = fish
theme = Catppuccin Frappe
command = /opt/homebrew/bin/fish

# Let tmux handle all window/tab management
keybind = super+t=unbind
keybind = super+n=unbind
16 changes: 16 additions & 0 deletions nvim/lua/plugins/tmux-navigator.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
return {
"christoomey/vim-tmux-navigator",
cmd = {
"TmuxNavigateLeft",
"TmuxNavigateDown",
"TmuxNavigateUp",
"TmuxNavigateRight",
"TmuxNavigatePrevious",
},
keys = {
{ "<C-h>", "<cmd>TmuxNavigateLeft<cr>", desc = "Navigate left" },
{ "<C-j>", "<cmd>TmuxNavigateDown<cr>", desc = "Navigate down" },
{ "<C-k>", "<cmd>TmuxNavigateUp<cr>", desc = "Navigate up" },
{ "<C-l>", "<cmd>TmuxNavigateRight<cr>", desc = "Navigate right" },
},
}
8 changes: 4 additions & 4 deletions nvim/lua/plugins/toggleterm.lua
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ return {
local opts = { buffer = 0 }
vim.keymap.set("t", "<esc>", [[<C-\><C-n>]], opts)
vim.keymap.set("t", "jk", [[<C-\><C-n>]], opts)
vim.keymap.set("t", "<C-h>", [[<Cmd>wincmd h<CR>]], opts)
vim.keymap.set("t", "<C-j>", [[<Cmd>wincmd j<CR>]], opts)
vim.keymap.set("t", "<C-k>", [[<Cmd>wincmd k<CR>]], opts)
vim.keymap.set("t", "<C-l>", [[<Cmd>wincmd l<CR>]], opts)
vim.keymap.set("t", "<C-h>", [[<Cmd>TmuxNavigateLeft<CR>]], opts)
vim.keymap.set("t", "<C-j>", [[<Cmd>TmuxNavigateDown<CR>]], opts)
vim.keymap.set("t", "<C-k>", [[<Cmd>TmuxNavigateUp<CR>]], opts)
vim.keymap.set("t", "<C-l>", [[<Cmd>TmuxNavigateRight<CR>]], opts)
vim.keymap.set("t", "<C-w>", [[<C-\><C-n><C-w>]], opts)
end

Expand Down
57 changes: 57 additions & 0 deletions tmux/cheatsheet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Ghostty + tmux Cheatsheet

Prefix key: `Ctrl-a`

All window and tab management is handled by tmux. Ghostty's `Cmd-T` and
`Cmd-N` are unbound to avoid conflicts.

## tmux (prefix = Ctrl-a)

### Sessions

| Keys | Action |
| --- | --- |
| `prefix d` | Detach from session |
| `prefix s` | List / switch sessions |
| `prefix $` | Rename session |
| `tmux new -s name` | New named session |

### Windows (tabs inside tmux)

| Keys | Action |
| --- | --- |
| `prefix c` | New window |
| `prefix ,` | Rename window |
| `prefix n` / `prefix p` | Next / previous window |
| `prefix 1-9` | Jump to window by number |
| `prefix Ctrl-a` | Toggle last window |
| `prefix &` | Kill window |

### Panes (splits inside a window)

| Keys | Action |
| --- | --- |
| `prefix i` | Split horizontal |
| `prefix u` | Split vertical |
| `Ctrl-h/j/k/l` | Navigate panes (vim-tmux-navigator) |
| `prefix z` | Zoom / unzoom pane |
| `prefix x` | Kill pane |
| `prefix Space` | Enter copy mode (vi keys) |

### Copy mode (vi)

| Keys | Action |
| --- | --- |
| `/` | Search forward |
| `?` | Search backward |
| `v` | Begin selection |
| `y` | Yank selection |
| `q` | Exit copy mode |

## Ghostty

| Keys | Action |
| --- | --- |
| `Cmd-+` / `Cmd--` | Zoom in / out |
| `Cmd-Shift-,` | Open config |
| `Cmd-K` | Clear screen |
67 changes: 67 additions & 0 deletions tmux/tmux.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#{{{1 GENERAL OPTIONS

set-option -g default-shell "/opt/homebrew/bin/fish"
set-option -g default-terminal "tmux-256color"
set-option -ga terminal-overrides ",xterm-ghostty:Tc"
set-option -g history-limit 100000
set-option -g focus-events on
set-option -g escape-time 0
set-option -g mouse on

#{{{1 KEY BINDS

#{{{2 UNBINDS

unbind C-b
unbind l
unbind h
unbind k
unbind j
unbind u
unbind i
unbind Space

#{{{2 GENERAL

set -g prefix C-a
bind-key a send-prefix
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."
bind Space copy-mode
set-window-option -g mode-keys vi

#{{{2 WINDOWS

bind-key C-a last-window

#{{{2 PANES

# Splits
bind u split-window -v -c "#{pane_current_path}"
bind i split-window -h -c "#{pane_current_path}"

# Vim-tmux-navigator handles C-h/j/k/l pane switching
# See: https://github.com/christoomey/vim-tmux-navigator

#{{{1 WINDOW SETTINGS

set -g base-index 1
set-window-option -g pane-base-index 1
set -g renumber-windows on
set-window-option -g automatic-rename on
set-option -g allow-rename off
set -g set-titles on

#{{{1 PLUGINS (TPM)

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'catppuccin/tmux'

#{{{2 CATPPUCCIN

set -g @catppuccin_flavor 'frappe'

#{{{1 INITIALIZE TPM
# (keep this line at the very bottom of tmux.conf)

run '~/.tmux/plugins/tpm/tpm'
Loading