Last active
March 28, 2025 17:23
-
-
Save markgarrigan/962fed02662d8d226746698f266b1be8 to your computer and use it in GitHub Desktop.
Kitty Tabs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dev() { | |
local dir="${1:-$PWD}" | |
dir="$(realpath "$dir")" | |
if [[ ! -d "$dir" ]]; then | |
echo "Directory does not exist: $dir" | |
return 1 | |
fi | |
local session_file | |
session_file="$(mktemp)" | |
# Create a temporary session file with %d replaced by the actual dir | |
sed "s|%d|$dir|g" ~/.config/kitty/dev-session.conf > "$session_file" | |
# Launch kitty with the custom session | |
kitty --session "$session_file" | |
# Optional: clean up the temp file later if you want | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DISABLE_AUTO_TITLE="true" | |
function set_terminal_title() { | |
local current_dir="$PWD" | |
local tab_title="${current_dir##*/}" | |
if [[ -n "$1" ]]; then | |
# When a command is running, set terminal title to: path | command | |
print -Pn "\e]0;$current_dir | $1\a" | |
else | |
# When idle, just show the directory | |
print -Pn "\e]0;$current_dir\a" | |
fi | |
# Always set tab title to just the current directory | |
print -Pn "\e]1;$tab_title\a" | |
} | |
# Zsh hooks | |
function preexec() { | |
set_terminal_title "$1" | |
} | |
function precmd() { | |
set_terminal_title | |
} | |
autoload -Uz add-zsh-hook | |
add-zsh-hook preexec preexec | |
add-zsh-hook precmd precmd | |
# Initial set | |
set_terminal_title |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First, split vertically (top-bottom) | |
layout splith | |
# Launch Neovim in top split (will be the first pane) | |
launch --cwd %d --title nvim nvim | |
# Split from the first window (nvim) — this creates the bottom pane | |
launch --cwd %d --title shell --stdin-source=pty --location=hsplit zsh | |
# Resize layout: 5 total units → nvim = 4, shell = 1 | |
match title nvim | |
focus | |
set_layout splits horizontal 4 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allow_remote_control yes | |
clear_all_shortcuts yes | |
tab_title_template "{title}" | |
tab_title_template "{shell_path}" # just something predictable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment