From a96e7b8e4070c5d532d39ed074eca9d5d6541985 Mon Sep 17 00:00:00 2001 From: oxpoe Date: Thu, 15 Oct 2026 03:54:21 +0700 Subject: [PATCH] tmux: config Catppuccin Mocha + catppuccin/tmux v2.3.1, TPM, README & installer --- .config/tmux/apply-palette.sh | 18 ++ .config/tmux/palette.conf | 32 ++++ .config/tmux/tmux.conf | 352 ++++++++++++++++++++++++++++++++++ .gitignore | 2 + README.md | 40 ++++ install.sh | 27 +++ 6 files changed, 471 insertions(+) create mode 100755 .config/tmux/apply-palette.sh create mode 100644 .config/tmux/palette.conf create mode 100644 .config/tmux/tmux.conf create mode 100644 .gitignore create mode 100644 README.md create mode 100755 install.sh diff --git a/.config/tmux/apply-palette.sh b/.config/tmux/apply-palette.sh new file mode 100755 index 0000000..edc71cf --- /dev/null +++ b/.config/tmux/apply-palette.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# ========================================================== +# Terapkan palet Tokyo Night ke SEMUA pane yang sedang hidup. +# +# Kenapa perlu: "pane-colours" itu pane option, dan hook +# (session-created / after-new-window / after-split-window) +# hanya jalan untuk pane yang baru dibuat. Pane yang sudah +# ada sebelum config di-reload tidak ikut berubah. +# +# Dipanggil otomatis dari: bind r di tmux.conf +# Bisa juga dipanggil manual: sh ~/.config/tmux/apply-palette.sh +# ========================================================== + +tmux list-panes -a -F '#{session_name}:#{window_index}.#{pane_index}' 2>/dev/null | +while read -r pane; do + [ -n "$pane" ] || continue + tmux source-file -t "$pane" "$HOME/.config/tmux/palette.conf" 2>/dev/null +done diff --git a/.config/tmux/palette.conf b/.config/tmux/palette.conf new file mode 100644 index 0000000..ff35b4b --- /dev/null +++ b/.config/tmux/palette.conf @@ -0,0 +1,32 @@ +# ========================================================== +# Palet Catppuccin Mocha untuk tmux +# +# WAJIB di-source dengan target pane: +# tmux source-file -t :. palette.conf +# +# Dipanggil dari tiga tempat: +# - hook session-created / after-new-window / after-split-window +# di tmux.conf (pane yang baru lahir) +# - apply-palette.sh (semua pane yang sudah hidup) +# +# Jangan dipakai tanpa -t: "set -g pane-colours" tanpa -p +# tidak berefek sama sekali, dan -p tanpa target hanya kena +# satu pane. Opsi ini tidak diwariskan ke pane baru. +# ========================================================== + +set -g -p pane-colours[0] "#11111b" # black +set -g -p pane-colours[1] "#f38ba8" # red +set -g -p pane-colours[2] "#a6e3a1" # green +set -g -p pane-colours[3] "#f9e2af" # yellow +set -g -p pane-colours[4] "#89b4fa" # blue +set -g -p pane-colours[5] "#cba6f7" # magenta +set -g -p pane-colours[6] "#89dceb" # cyan +set -g -p pane-colours[7] "#bac2de" # white +set -g -p pane-colours[8] "#313244" # bright black +set -g -p pane-colours[9] "#f38ba8" # bright red +set -g -p pane-colours[10] "#a6e3a1" # bright green +set -g -p pane-colours[11] "#f9e2af" # bright yellow +set -g -p pane-colours[12] "#89b4fa" # bright blue +set -g -p pane-colours[13] "#cba6f7" # bright magenta +set -g -p pane-colours[14] "#89dceb" # bright cyan +set -g -p pane-colours[15] "#cdd6f4" # bright white diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf new file mode 100644 index 0000000..68180dd --- /dev/null +++ b/.config/tmux/tmux.conf @@ -0,0 +1,352 @@ +# ========================================================== +# tmux — Catppuccin Mocha +# CachyOS + Ghostty + fish +# Muat ulang: prefix + r +# ========================================================== + +# ---------------------------------------------------------- +# TERMINAL +# ---------------------------------------------------------- +set -g default-terminal "tmux-256color" + +# Catatan: koma di depan ",xterm-..." itu habitsaya orang, bukan +# sintaks tmux. tmux membuang koma itu lalu MENYAPPEND entri, jadi +# nilainya tidak prepend. Semua entri yang cocok digabung (OR), +# jadi urutan tidak berpengaruh. + +# Penting: default bawaan tmux hanya punya xterm*, screen*, rxvt*. +# Tidak ada satupun yang cocok dengan "tmux-256color", jadi tanpa +# baris di bawah pane di dalam tmux TIDAK dapat RGB / clipboard / +# extkeys -- cuma Colors 256. +set -as terminal-features "tmux*:clipboard:ccolour:cstyle:focus:title:RGB:extkeys" +set -as terminal-features "xterm-ghosty:RGB" +set -as terminal-features "xterm-256color:RGB" +# Tombol modifier ikut terkirim (Shift+Up, Ctrl+Left, ...) +set -s extended-keys on +set -as terminal-features "xterm*:extkeys" + +# ---------------------------------------------------------- +# PALET CATPPUCCIN MOCHA +# +# tmux >= 3.3 memakai "pane-colours" (opsi lama "palette" sudah +# dihapus) dan itu sebuah *pane option*. +# +# Dua akibatnya, keduanya sudah diverifikasi di tmux 3.7: +# 1. "set -g pane-colours[...]" (tanpa -p) DIABAIKAN total — +# tidak masuk ke pane yang sudah ada maupun pane baru. +# 2. "set -g -p ..." hanya berlaku untuk SATU pane, dan pane +# baru TIDAK mewarisi palet dari pane induknya. +# Jadi palet wajib di-apply per-pane, lewat hook di bawah +# (pane pertama = session-created, pane berikutnya = after-*). +# +# Palet untuk pane yang SUDAH hidup sebelum reload config +# ditangani oleh apply-palette.sh (dijalankan dari bind r). +# ---------------------------------------------------------- +set-hook -g session-created 'source-file ~/.config/tmux/palette.conf' +set-hook -g after-new-window 'source-file ~/.config/tmux/palette.conf' +set-hook -g after-split-window 'source-file ~/.config/tmux/palette.conf' + +# ---------------------------------------------------------- +# PESAN & PROMPT +# ---------------------------------------------------------- +set -g message-style "fg=#1e1e2e,bg=#89b4fa,bold" +set -g message-command-style "fg=#cdd6f4,bg=#313244" + +# ---------------------------------------------------------- +# PREFIX +# ---------------------------------------------------------- +# Default C-b. Ingin ganti? ubah baris ini + unbind-nya. +set -g prefix C-b +unbind C-b +bind C-b send-prefix +# Tekan C-b dua kali = kirim prefix ke aplikasi +bind -n C-b send-prefix +# Muat ulang konfigurasi + terapkan palet ke pane yang sudah ada +# (hook hanya berlaku untuk pane yang lahir SESUDAH reload) +bind r source-file ~/.config/tmux/tmux.conf \; run-shell -b "sh ~/.config/tmux/apply-palette.sh" \; display-message "tmux.conf dimuat ulang" + +# ---------------------------------------------------------- +# DASAR +# ---------------------------------------------------------- +set -g base-index 1 +setw -g pane-base-index 1 +set -g renumber-windows on +set -g automatic-rename on +set -g allow-rename off +set -g set-titles on +set -g set-titles-string " #S | #W " + +# ---------------------------------------------------------- +# SCROLLBACK, MOUSE, INPUT +# ---------------------------------------------------------- +set -g history-limit 100000 +set -g mouse on +set -g mode-keys vi +set -g status-keys vi +set -g set-clipboard on +# Penting: memberitahu fish/aplikasi kalau window tmux aktif, +# supaya ikon lock, progress bar, dan prompt bisa akurat +set -g focus-events on +set -g escape-time 10 +set -g repeat-time 500 +set -g display-time 3000 +set -g focus-follows-mouse off + +# ---------------------------------------------------------- +# SPLIT +# ---------------------------------------------------------- +bind | split-window -h -c "#{pane_current_path}" +bind - split-window -v -c "#{pane_current_path}" + +# !!! JANGAN pakai "bind -n ". +# +# "bind -n" menaruh binding di ROOT table, yang dicek tmux SEBELUM +# key dikirim ke aplikasi. Efeknya key tersebut hilang total. +# Sudah diuji lewat pty (bukan send-keys, yang bypass key table): +# +# bind -n Space -> SPASI tidak bisa diketik sama sekali +# bind -n 1..9 -> semua angka tidak bisa diketik +# bind -n f -> huruf f tidak bisa diketik +# bind -n h j k l-> tidak bisa mengetik hjkl +# bind -n n p -> huruf n dan p tidak bisa diketik +# bind -n H K -> huruf H dan K tidak bisa diketik +# bind -n C-h -> C-h = backspace di fish/readline ikut hilang +# +# Semua yang biasa "tanpa prefix" sekarang dipindah ke prefix table. +# Kalau memang mau jalan tanpa prefix, pakai modifier yang tidak +# dipakai aplikasi: M- (Alt), C-M, atau S- (Shift), bukan huruf polos. +# +# PENTING: menghapus baris "bind" dari file ini TIDAK cukup untuk +# melepas binding yang sudah terlanjur aktif di server yang jalan. +# "source-file" hanya menambahkan/menimpa, tidak pernah unbound. +# Semua binding yang sengaja dibuang WAJIB di-unbind di sini, kalau +# tidak binding lama tetap hidup sampai server di-restart. + +unbind-key -T root Space +unbind-key -T root f +unbind-key -T root h +unbind-key -T root j +unbind-key -T root k +unbind-key -T root l +unbind-key -T root n +unbind-key -T root p +unbind-key -T root H +unbind-key -T root K +unbind-key -T root 0 +unbind-key -T root 1 +unbind-key -T root 2 +unbind-key -T root 3 +unbind-key -T root 4 +unbind-key -T root 5 +unbind-key -T root 6 +unbind-key -T root 7 +unbind-key -T root 8 +unbind-key -T root 9 +unbind-key -T root C-h +unbind-key -T root C-j +unbind-key -T root C-k +unbind-key -T root C-l + +# Pindah pane +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R +# Geser pane +bind H swap-pane -U +bind K swap-pane -D +# Pindah pane tanpa prefix tapi dengan modifier (tidak menabrak teks) +bind -n M-h select-pane -L +bind -n M-j select-pane -D +bind -n M-k select-pane -U +bind -n M-l select-pane -R +# Resize tanpa prefix, pakai Alt+Shift+panah (Ctrl+Shift dipakai KDE) +bind -n M-H resize-pane -L 5 +bind -n M-J resize-pane -D 5 +bind -n M-K resize-pane -U 5 +bind -n M-L resize-pane -R 5 + +# Resize dengan prefix +bind -r h resize-pane -L 5 +bind -r j resize-pane -D 5 +bind -r k resize-pane -U 5 +bind -r l resize-pane -R 5 +bind -r H resize-pane -L 15 +bind -r J resize-pane -D 15 +bind -r K resize-pane -U 15 +bind -r L resize-pane -R 15 + +bind z resize-pane -Z +bind f resize-pane -Z +bind w kill-pane +bind = select-layout -t: even-horizontal +bind Space select-layout -t: tiled +bind s select-layout -t: tiled +# Copy mode tanpa prefix, pakai Shift+Space (tidak dipakai editor) +bind -n S-Space copy-mode + +# ---------------------------------------------------------- +# WINDOW +# ---------------------------------------------------------- +bind c new-window -c "#{pane_current_path}" +bind n new-window -c "#{pane_current_path}" +# Rename manual sekaligus mematikan auto-rename utk window itu, +# supaya nama tidak ditimpa jadi "~" atau path lain. +bind , command-prompt -p "Rename window: " "rename-window '%%' ; set-window-option automatic-rename off" +# Kembalikan auto-rename utk window aktif +bind M-, set-window-option automatic-rename on \; display-message "auto-rename ON untuk window ini" +bind & kill-window +bind W kill-window +bind -r p previous-window +bind -r n next-window +# Pindah window tanpa prefix, tapi pakai modifier supaya tidak +# memblokir pengetikan angka di shell/editor. +# Alt+1..9 = pindah window, Alt+Shift+1..9 = window ke-10..18 +bind -n M-1 select-window -t :1 +bind -n M-2 select-window -t :2 +bind -n M-3 select-window -t :3 +bind -n M-4 select-window -t :4 +bind -n M-5 select-window -t :5 +bind -n M-6 select-window -t :6 +bind -n M-7 select-window -t :7 +bind -n M-8 select-window -t :8 +bind -n M-9 select-window -t :9 +bind -n M-p previous-window +bind -n M-n next-window +bind -r 1 select-window -t :1 +bind -r 2 select-window -t :2 +bind -r 3 select-window -t :3 +bind -r 4 select-window -t :4 +bind -r 5 select-window -t :5 +bind -r 6 select-window -t :6 +bind -r 7 select-window -t :7 +bind -r 8 select-window -t :8 +bind -r 9 select-window -t :9 + +# ---------------------------------------------------------- +# SESSION +# ---------------------------------------------------------- +bind s choose-tree +bind S choose-tree -Zs +bind d detach-client +bind x kill-server +bind C-x kill-server +bind e new-session + +# ---------------------------------------------------------- +# COPY MODE (vi) +# ---------------------------------------------------------- +bind -T copy-mode-vi v send -X begin-selection +bind -T copy-mode-vi C-v send -X rectangle-toggle +bind -T copy-mode-vi y send -X copy-selection-and-cancel +bind -T copy-mode-vi Y send -X copy-line +bind -T copy-mode-vi w send -X copy-selection-and-cancel +bind -T copy-mode-vi Escape send -X cancel +bind -T copy-mode-vi q send -X cancel +bind -T copy-mode-vi h send -X cursor-left +bind -T copy-mode-vi j send -X cursor-down +bind -T copy-mode-vi k send -X cursor-up +bind -T copy-mode-vi l send -X cursor-right +bind -T copy-mode-vi 0 send -X cursor-leftmost +bind -T copy-mode-vi 4 send -X cursor-rightmost +bind -T copy-mode-vi ^ send -X history-top +bind -T copy-mode-vi $ send -X history-bottom +bind -T copy-mode-vi g send -X history-top +bind -T copy-mode-vi G send -X history-bottom +bind -T copy-mode-vi d send -X half-page-down +bind -T copy-mode-vi u send -X half-page-up +bind -T copy-mode-vi f send -X page-down +bind -T copy-mode-vi b send -X page-up +bind -T copy-mode-vi / send -X begin-search-forward +bind -T copy-mode-vi ? send -X begin-search-backward +bind -T copy-mode-vi n send -X search-again +bind -T copy-mode-vi N send -X search-again +# (baris "bind -T copy-mode-vi C-e copy-mode -e" dihapus: "copy-mode" +# bukan command yang valid di copy-mode table, selalu error saat ditekan) +# +# "bind -n S-Space copy-mode" sudah didefinisikan di bagian SPLIT. + +# ---------------------------------------------------------- +# (digantikan oleh catppuccin/tmux — lihat blok TEMA di akhir file) +# # STATUS BAR — Catppuccin Mocha +# # Font: MesloLGS Nerd Font Mono (glyph powerline tersedia) +# # ---------------------------------------------------------- +# set -g status on +# set -g status-position bottom +# set -g status-interval 2 +# set -g status-justify left +# set -g status-style "bg=#1e1e2e,fg=#bac2de" +# set -g status-left-length 30 +# set -g status-right-length 45 + +# # Sesi aktif +# set -g status-left "#[fg=#1e1e2e,bg=#89b4fa,bold] #S #[default]" +# # Jam + info window di kanan +# set -g status-right "#[fg=#89dceb,bg=#1e1e2e]%H:%M #[fg=#313244]#[bg=#1e1e2e] #S:#I #W #[default]" + +# # Warna tiap window +# setw -g window-status-style "bg=#1e1e2e,fg=#313244" +# setw -g window-status-current-style "bg=#89b4fa,fg=#1e1e2e,bold" +# setw -g window-status-activity-style "bg=#f9e2af,fg=#1e1e2e" +# setw -g window-status-bell-style "bg=#f38ba8,fg=#1e1e2e" +# setw -g window-status-separator "#[fg=#313244,bg=#1e1e2e] #( #[default]" +# setw -g window-status-format " #I:#W#{?window_zoomed_flag,(Z),} " +# setw -g window-status-current-format "#[bg=#89b4fa,fg=#1e1e2e,bold] #I:#W#{?window_zoomed_flag, ,} #[default]" + +# ---------------------------------------------------------- +# PANE +# ---------------------------------------------------------- +setw -g pane-border-style "fg=#313244" +setw -g pane-active-border-style "fg=#89b4fa" +setw -g pane-border-format " #{pane_index} " + +# ---------------------------------------------------------- +# MODE (copy mode, dll) +# ---------------------------------------------------------- +setw -g mode-style "bg=#89b4fa,fg=#1e1e2e,bold" + +# ---------------------------------------------------------- +# HOOK +# ---------------------------------------------------------- +set-hook -g alert-bell "display-message 'Ada aktivitas di #S:#I'" + +# ---------------------------------------------------------- +# PLUGIN (TPM) — Catppuccin Mocha +# Pasang: prefix + I | Update: prefix + U | Hapus: prefix + alt + u +# ---------------------------------------------------------- +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 @plugin 'tmux-plugins/tmux-yank' + +# resurrect / continuum +set -g @resurrect-capture-pane-contents 'on' +set -g @continuum-restore 'on' +set -g @continuum-save-interval '15' +# yank +set -g @yank_selection_mouse 'clipboard' + +# ---------------------------------------------------------- +# TEMA RESMI: catppuccin/tmux v2.3.1 +# ---------------------------------------------------------- +set -g @catppuccin_flavor "mocha" +set -g @catppuccin_window_status_style "rounded" + +run ~/.config/tmux/plugins/catppuccin/tmux/catppuccin.tmux + +# Status line: modul +set -g status-right-length 100 +set -g status-left-length 100 +set -g status-left "" +set -g status-right "#{E:@catppuccin_status_application}" +set -agF status-right "#{E:@catppuccin_status_cpu}" +set -agF status-right "#{E:@catppuccin_status_ram}" +set -ag status-right "#{E:@catppuccin_status_session}" +set -ag status-right "#{E:@catppuccin_status_uptime}" +set -agF status-right "#{E:@catppuccin_status_battery}" + +set -g @plugin 'tmux-plugins/tmux-cpu' +set -g @plugin 'tmux-plugins/tmux-battery' + +run '~/.config/tmux/plugins/tpm/tpm' diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8f57227 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.bak +*.bak-* diff --git a/README.md b/README.md new file mode 100644 index 0000000..8b84d01 --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# dotfiles + +Kumpulan konfigurasi terminal saya. + +## tmux — Catppuccin Mocha + +Konfigurasi tmux (tmux 3.8) dengan tema resmi **catppuccin/tmux v2.3.1 (mocha)**. + +- prefix: `C-b` +- keybind vim-style: `h/j/k/l` pindah pane, `H/K` geser pane, `|`/`-` split, + `M-h/j/k/l` pindah pane tanpa prefix, `M-1..9` pindah window +- copy-mode vi (`v` mulai seleksi, `y` copy), `S-Space` masuk copy-mode +- rename window: `prefix + ,` (otomatis mematikan auto-rename window itu); + `prefix + M-,` mengembalikan auto-rename +- reload config: `prefix + r` +- palet per-pane (`pane-colours`) di-apply lewat hook + `apply-palette.sh` + +### Pasang + +Butuh: `tmux`, `git`, **Nerd Font** (ikon & powerline). + +```sh +sh install.sh +``` + +Lalu buka tmux dan tekan **`prefix + I`** untuk memasang plugin TPM +(sensible, resurrect, continuum, yank, cpu, battery). + +### Struktur + +``` +.config/tmux/ +├── tmux.conf # konfigurasi utama +├── palette.conf # palet ANSI per-pane (Catppuccin Mocha) +└── apply-palette.sh # terapkan palet ke pane yang sudah hidup +``` + +## Lisensi + +MIT diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..502c5d0 --- /dev/null +++ b/install.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env sh +# Pasang config tmux (+ plugin) ke ~/.config/tmux +set -eu + +DEST="${XDG_CONFIG_HOME:-$HOME/.config}/tmux" +HERE="$(cd "$(dirname "$0")" && pwd)" + +command -v tmux >/dev/null 2>&1 || { echo "tmux belum terpasang"; exit 1; } +command -v git >/dev/null 2>&1 || { echo "git belum terpasang"; exit 1; } + +mkdir -p "$DEST" +cp -f "$HERE/.config/tmux/tmux.conf" "$DEST/tmux.conf" +cp -f "$HERE/.config/tmux/palette.conf" "$DEST/palette.conf" +cp -f "$HERE/.config/tmux/apply-palette.sh" "$DEST/apply-palette.sh" +chmod 0755 "$DEST/apply-palette.sh" + +PLUG="$DEST/plugins" +mkdir -p "$PLUG/catppuccin" + +[ -d "$PLUG/tpm" ] || git clone --depth 1 https://github.com/tmux-plugins/tpm "$PLUG/tpm" + +# catppuccin/tmux dipasang manual (rekomendasi resmi repo-nya) +[ -d "$PLUG/catppuccin/tmux" ] || \ + git clone --depth 1 -b v2.3.1 https://github.com/catppuccin/tmux.git "$PLUG/catppuccin/tmux" + +echo "Config terpasang di $DEST" +echo "Buka tmux, lalu tekan prefix + I untuk memasang plugin TPM lainnya."