Loading...
Loading...
Compare original and translation side by side
send-keysnew-sessionundefinedsend-keysnew-sessionundefinedundefinedundefinedSESSION=$(basename $(git rev-parse --show-toplevel 2>/dev/null) || basename $PWD)SESSION=$(basename $(git rev-parse --show-toplevel 2>/dev/null) || basename $PWD)SESSION=$(basename $(git rev-parse --show-toplevel 2>/dev/null) || basename $PWD)
if ! tmux has-session -t "$SESSION" 2>/dev/null; then
tmux new-session -d -s "$SESSION" -n server
tmux send-keys -t "$SESSION:server" 'npm run dev' Enter
else
echo "Session $SESSION already exists"
fiSESSION=$(basename $(git rev-parse --show-toplevel 2>/dev/null) || basename $PWD)
if ! tmux has-session -t "$SESSION" 2>/dev/null; then
tmux new-session -d -s "$SESSION" -n server
tmux send-keys -t "$SESSION:server" 'npm run dev' Enter
else
echo "Session $SESSION already exists"
fiSESSION=$(basename $(git rev-parse --show-toplevel 2>/dev/null) || basename $PWD)
tmux new-session -d -s "$SESSION" -n server
tmux send-keys -t "$SESSION:server" 'npm run dev' Enter
tmux new-window -t "$SESSION" -n tests
tmux send-keys -t "$SESSION:tests" 'npm run test:watch' Enter
tmux new-window -t "$SESSION" -n logs
tmux send-keys -t "$SESSION:logs" 'tail -f logs/app.log' EnterSESSION=$(basename $(git rev-parse --show-toplevel 2>/dev/null) || basename $PWD)
tmux new-session -d -s "$SESSION" -n server
tmux send-keys -t "$SESSION:server" 'npm run dev' Enter
tmux new-window -t "$SESSION" -n tests
tmux send-keys -t "$SESSION:tests" 'npm run test:watch' Enter
tmux new-window -t "$SESSION" -n logs
tmux send-keys -t "$SESSION:logs" 'tail -f logs/app.log' Enterundefinedundefinedundefinedundefinedtmux ls # list sessions
tmux list-windows -t "$SESSION" # list windows
tmux kill-session -t "$SESSION" # kill session
tmux send-keys -t "$SESSION:server" C-c # send Ctrl+Ctmux ls # list sessions
tmux list-windows -t "$SESSION" # list windows
tmux kill-session -t "$SESSION" # kill session
tmux send-keys -t "$SESSION:server" C-c # send Ctrl+Ctmux kill-servertmux kill-server| Scenario | Use tmux? |
|---|---|
| Dev server / file watcher | Yes |
| Long-running background process | Yes |
One-shot build ( | No |
| Quick command (<10s) | No |
| Need stdout directly in conversation | No |
| 场景 | 是否使用tmux? |
|---|---|
| 开发服务器 / 文件监视器 | 是 |
| 长时间运行的后台进程 | 是 |
一次性构建( | 否 |
| 快速命令(<10秒) | 否 |
| 需要直接在对话中获取标准输出 | 否 |
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm~/.config/tmux/tmux.conf~/.tmux.confset -g @plugin 'tmux-plugins/tpm'
run '~/.tmux/plugins/tpm/tpm'prefix + Iprefix + rprefix + Ugit clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm~/.config/tmux/tmux.conf~/.tmux.confset -g @plugin 'tmux-plugins/tpm'
run '~/.tmux/plugins/tpm/tpm'prefix + Iprefix + rprefix + Uset-option -g default-terminal 'screen-256color'
set-option -g terminal-overrides ',xterm-256color:RGB'
set -g prefix ^A # Ctrl+A prefix (like screen)
set -g base-index 1 # windows start at 1
set -g detach-on-destroy off # don't exit tmux when closing a session
set -g escape-time 0 # zero escape time delay
set -g history-limit 1000000 # large scrollback
set -g renumber-windows on # auto-renumber after close
set -g set-clipboard on # use system clipboard
set -g status-position top # status bar at top (macOS style)
setw -g mode-keys vi # vi keys in copy mode
set -g pane-active-border-style 'fg=magenta,bg=default'
set -g pane-border-style 'fg=brightblack,bg=default'set-option -g default-terminal 'screen-256color'
set-option -g terminal-overrides ',xterm-256color:RGB'
set -g prefix ^A # Ctrl+A prefix (like screen)
set -g base-index 1 # windows start at 1
set -g detach-on-destroy off # don't exit tmux when closing a session
set -g escape-time 0 # zero escape time delay
set -g history-limit 1000000 # large scrollback
set -g renumber-windows on # auto-renumber after close
set -g set-clipboard on # use system clipboard
set -g status-position top # status bar at top (macOS style)
setw -g mode-keys vi # vi keys in copy mode
set -g pane-active-border-style 'fg=magenta,bg=default'
set -g pane-border-style 'fg=brightblack,bg=default'set -g @plugin 'omerxx/catppuccin-tmux' # omerxx fork with extrasset -g @plugin 'omerxx/catppuccin-tmux' # omerxx fork with extrasundefinedundefinedset -g @plugin 'omerxx/tmux-sessionx'
set -g @sessionx-bind 'o' # launch with prefix+o
set -g @sessionx-auto-accept 'off'
set -g @sessionx-window-height '85%'
set -g @sessionx-window-width '75%'
set -g @sessionx-zoxide-mode 'on' # requires zoxide
set -g @sessionx-filter-current 'false'
set -g @sessionx-custom-paths '~/projects' # always-visible paths
set -g @sessionx-custom-paths-subdirectories 'false'
set -g @sessionx-git-branch 'on' # show git branch next to sessionalt+backspaceCtrl-rCtrl-wCtrl-eCtrl-x~/.config?set -g @plugin 'omerxx/tmux-sessionx'
set -g @sessionx-bind 'o' # launch with prefix+o
set -g @sessionx-auto-accept 'off'
set -g @sessionx-window-height '85%'
set -g @sessionx-window-width '75%'
set -g @sessionx-zoxide-mode 'on' # requires zoxide
set -g @sessionx-filter-current 'false'
set -g @sessionx-custom-paths '~/projects' # always-visible paths
set -g @sessionx-custom-paths-subdirectories 'false'
set -g @sessionx-git-branch 'on' # show git branch next to sessionalt+backspaceCtrl-rCtrl-wCtrl-eCtrl-x~/.config?set -g @plugin 'omerxx/tmux-floax'
set -g @floax-bind 'p' # prefix+p to toggle
set -g @floax-bind-menu 'P' # prefix+P for resize/fullscreen menu
set -g @floax-width '80%'
set -g @floax-height '80%'
set -g @floax-border-color 'magenta'
set -g @floax-text-color 'blue'
set -g @floax-change-path 'true' # float follows session pathset -g @plugin 'omerxx/tmux-floax'
set -g @floax-bind 'p' # prefix+p to toggle
set -g @floax-bind-menu 'P' # prefix+P for resize/fullscreen menu
set -g @floax-width '80%'
set -g @floax-height '80%'
set -g @floax-border-color 'magenta'
set -g @floax-text-color 'blue'
set -g @floax-change-path 'true' # float follows session path
Floating pane menu options: size down/up, fullscreen, reset, embed.
浮动窗格菜单选项:缩小/放大尺寸、全屏、重置、嵌入。set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-resurrect' # save/restore sessions
set -g @plugin 'tmux-plugins/tmux-continuum' # auto-save
set -g @plugin 'fcsonline/tmux-thumbs' # hint-based copy
set -g @plugin 'sainnhe/tmux-fzf'
set -g @plugin 'wfxr/tmux-fzf-url'
set -g @plugin 'omerxx/catppuccin-tmux'
set -g @plugin 'omerxx/tmux-sessionx'
set -g @plugin 'omerxx/tmux-floax'set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-resurrect' # save/restore sessions
set -g @plugin 'tmux-plugins/tmux-continuum' # auto-save
set -g @plugin 'fcsonline/tmux-thumbs' # hint-based copy
set -g @plugin 'sainnhe/tmux-fzf'
set -g @plugin 'wfxr/tmux-fzf-url'
set -g @plugin 'omerxx/catppuccin-tmux'
set -g @plugin 'omerxx/tmux-sessionx'
set -g @plugin 'omerxx/tmux-floax'undefinedundefinedundefinedundefined
---
---