Skip to content

Instantly share code, notes, and snippets.

@1d10t
Last active March 5, 2026 22:51
Show Gist options
  • Select an option

  • Save 1d10t/64b0e23843ccaa82ad85577e1ee78fcf to your computer and use it in GitHub Desktop.

Select an option

Save 1d10t/64b0e23843ccaa82ad85577e1ee78fcf to your computer and use it in GitHub Desktop.
Kitty + tmux config for SSH/mosh clipboard (OSC 52) and Cyrillic keyboard layout support
# OSC 52 clipboard — ДО плагинов, чтобы не перезаписались
set -g set-clipboard on
set -g allow-passthrough on
set-option -sg terminal-overrides ",xterm-256color:Ms=\\E]52;c;%p2%s\\7"
# Copy-mode: при копировании отправлять через OSC 52 напрямую в клиентский TTY
set -g copy-command 'bash -c "printf \"\\033]52;c;%s\\007\" \"$(base64|tr -d \\\\n)\" > #{client_tty}"'
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel 'bash -c "printf \"\\033]52;c;%s\\007\" \"$(base64|tr -d \\\\n)\" > #{client_tty}"'
bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel 'bash -c "printf \"\\033]52;c;%s\\007\" \"$(base64|tr -d \\\\n)\" > #{client_tty}"'
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'bash -c "printf \"\\033]52;c;%s\\007\" \"$(base64|tr -d \\\\n)\" > #{client_tty}"'
# Кириллические дубли tmux-команд (ЙЦУКЕН)
bind с new-window # c
bind в detach-client # d
bind ъ paste-buffer # ]
bind х copy-mode # [
bind Ж command-prompt # :
# Плагины
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'
run '~/.tmux/plugins/tpm/tpm'
# =============================================================
# Kitty Terminal — конфиг для работы через SSH/mosh → tmux
# Клиент: Ubuntu Wayland/GNOME
# =============================================================
# --- Clipboard (OSC 52) ---
# Разрешить приложениям внутри терминала читать и писать
# в системный буфер обмена через escape-последовательности.
# Без этого /copy в Claude Code через SSH не работает.
clipboard_control write-clipboard write-primary read-clipboard read-primary
# --- Шрифт ---
# Тот же шрифт что в GNOME Terminal по умолчанию
font_family Ubuntu Sans Mono
font_size 13
# Шаг изменения размера шрифта: 1pt вместо стандартных 2pt
map ctrl+shift+equal change_font_size all +1.0
map ctrl+shift+minus change_font_size all -1.0
# --- Кириллическая раскладка (ЙЦУКЕН) ---
# Ctrl+И = Ctrl+B (tmux prefix), чтобы не переключать раскладку
map ctrl+и send_text all \x02
# Ctrl+Shift+С/М = Copy/Paste (с/м — это c/v на ЙЦУКЕН)
map ctrl+shift+с copy_to_clipboard
map ctrl+shift+м paste_from_clipboard
# --- Тема ---
# BEGIN_KITTY_THEME
# Gnome-ish gray-on-black
include current-theme.conf
# END_KITTY_THEME
#!/bin/bash
# Strip ANSI escape codes, encode to base64, send OSC 52 to client TTY
clean=$(cat | sed -E 's/\x1b\[[0-9;?]*[a-zA-Z]//g; s/\x1b\]//g; s/\x07//g; s/\x0f//g; s/\x1b\(B//g')
buf=$(printf '%s' "$clean" | base64 | tr -d '\n')
if [ -n "$TMUX" ]; then
printf '\033]52;c;%s\007' "$buf" > "$(tmux display -p '#{client_tty}')"
else
printf '\033]52;c;%s\007' "$buf"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment