Skip to content
Draft
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
16 changes: 16 additions & 0 deletions docs/ghostty.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# ghostty

Linux-only Home Manager keybinds are defined in `nix/modules/ghostty.nix` under `programs.ghostty.settings`.

macOS-like bindings enabled on Linux:

- `cmd+t` new tab, `cmd+w` close surface
- `cmd+shift+[` previous tab, `cmd+shift+]` next tab
- `cmd+d` split right, `cmd+shift+d` split down
- `cmd+alt+arrow` move focus across splits
- `cmd+c` copy, `cmd+v` paste
- `alt+left/right` word movement
- `cmd+left/right` line start/end
- `alt+backspace` delete previous word
- `cmd+backspace` delete to line start
- `cmd+delete` delete next word
25 changes: 24 additions & 1 deletion nix/modules/ghostty.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,34 @@
homebrew.casks = [ "ghostty" ];
};
modules.homeManager.rafiq =
{ pkgs, ... }:
{ lib, pkgs, ... }:
{
programs.ghostty = {
enable = true;
package = if pkgs.stdenv.isDarwin then null else pkgs.ghostty; # ghostty broken on darwin
settings = lib.mkIf pkgs.stdenv.isLinux {
keybind = [
"cmd+t=new_tab"
"cmd+w=close_surface"
"cmd+shift+[=previous_tab"
"cmd+shift+]=next_tab"
"cmd+d=new_split:right"
"cmd+shift+d=new_split:down"
"cmd+alt+left=goto_split:left"
"cmd+alt+right=goto_split:right"
"cmd+alt+up=goto_split:up"
"cmd+alt+down=goto_split:down"
"cmd+c=copy_to_clipboard"
"cmd+v=paste_from_clipboard"
"alt+left=esc:b"
"alt+right=esc:f"
"alt+backspace=text:\\x17"
"cmd+left=text:\\x01"
"cmd+right=text:\\x05"
"cmd+backspace=text:\\x15"
"cmd+delete=esc:d"
];
};
};
};
};
Expand Down
28 changes: 28 additions & 0 deletions sessions/2026-02-20-ghostty-linux-macos-keybinds.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Ghostty Linux macOS-like Keybinds

Date: 2026-02-20
Task: Add Linux-only Home Manager Ghostty keybindings that mimic macOS defaults for tab/split management, clipboard actions, and text navigation/editing.

## Work Breakdown

1. Reviewed project Nix conventions in `.agents/skills/nix/SKILL.md`.
2. Located existing Ghostty module in `nix/modules/ghostty.nix`.
3. Retrieved Ghostty keybinding docs and action reference from ghostty.org to verify syntax and action names.
4. Added Linux-gated keybindings under `programs.ghostty.settings` using `lib.mkIf pkgs.stdenv.isLinux`.

## Decisions and Reasoning

- Kept configuration in the existing Ghostty Home Manager module to preserve one-file responsibility.
- Scoped keybindings to Linux only so Darwin behavior remains native/unmodified.
- Used `cmd` modifier in bindings to mirror macOS muscle memory on Linux (mapped to Super).
- Included tab traversal mappings (`cmd+shift+[`, `cmd+shift+]`) alongside tab creation/close.
- Used terminal-safe escape/control sequences for word and line navigation/editing:
- `alt+left/right` -> `esc:b` / `esc:f`
- `cmd+left/right` -> `Ctrl-A` / `Ctrl-E`
- `alt+backspace`, `cmd+backspace`, `cmd+delete` for common shell text edits.

## Notes

- Existing package gating (`package = if pkgs.stdenv.isDarwin then null else pkgs.ghostty`) remains unchanged.
- Added concise documentation at `docs/ghostty.md`.
- No formatting/lint/test command run in this step.