Remove tmux-workspaces in favor of tmuxinator-only workflow

- Delete tmux-workspaces.zsh and .tmux-templates directory
- Remove TW_* config settings from dotfiles.conf
- Clean up tmuxinator.zsh (remove import/integration code)
- Update README, INSTALL, and REFERENCE docs
- Fix editor config: .zshrc now uses DEFAULT_EDITOR from dotfiles.conf

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Aaron D. Lee
2026-01-09 20:32:01 -05:00
parent a99cb7ae59
commit 48784c97fe
15 changed files with 12 additions and 720 deletions

View File

@@ -1,6 +0,0 @@
# Debug workspace
# Main pane (70%) + helper pane (30%)
split-window -h -p 30
select-pane -t 0

View File

@@ -1,19 +0,0 @@
# Development workspace
# Usage: tw-create myproject dev
# Split vertically (vim on left 50%, rest on right)
split-window -h -p 50
# Split right pane horizontally (terminal top, logs bottom)
split-window -v -p 50
# Select the first pane (vim)
select-pane -t 0
# Optional: Start vim in first pane
# send-keys -t 0 'vim' C-m
# Optional: Set pane titles
# select-pane -t 0 -T "Editor"
# select-pane -t 1 -T "Terminal"
# select-pane -t 2 -T "Logs"

View File

@@ -1,2 +0,0 @@
# Full workspace
# Single full-screen pane (default tmux behavior)

View File

@@ -1,16 +0,0 @@
# Operations workspace
# 4-pane layout for system monitoring
# Create 2x2 grid
split-window -h -p 50
split-window -v -p 50
select-pane -t 0
split-window -v -p 50
# Optional: Auto-start monitoring tools
# send-keys -t 0 'htop' C-m
# send-keys -t 1 'docker ps' C-m
# send-keys -t 2 '' C-m
# send-keys -t 3 'tail -f /var/log/syslog' C-m
select-pane -t 0

View File

@@ -1,6 +0,0 @@
# Code Review workspace
# Two equal panes side-by-side for comparison
split-window -h -p 50
select-pane -t 0

View File

@@ -1,13 +0,0 @@
# Multi-server SSH workspace
# 4 panes for managing multiple servers
# Create 2x2 grid
split-window -h -p 50
split-window -v -p 50
select-pane -t 0
split-window -v -p 50
# Enable pane synchronization (optional - uncomment to enable)
# set-window-option synchronize-panes on
select-pane -t 0

View File

@@ -1,7 +0,0 @@
# Custom template: system_monitoring
# Saved: Wed Dec 24 11:55:37 PM EST 2025
# Panes: 3
split-window -h -p 50
split-window -v -p 50
select-pane -t 0

View File

@@ -259,20 +259,6 @@ MOTD_STYLE="mini"
Add `.zsh` files to `~/.dotfiles/zsh/functions/` they're auto-loaded.
### Custom Tmux Templates
Add templates to `~/.dotfiles/.tmux-templates/`:
```bash
# ~/.dotfiles/.tmux-templates/mytemplate.tmux
# My custom layout
split-window -h -p 40
split-window -v -p 30
select-pane -t 0
```
Use with: `tw-create myproject mytemplate`
### Custom Bookmarks
```bash

View File

@@ -115,33 +115,9 @@ See [INSTALL.md](INSTALL.md) for detailed instructions.
## Tmux Workspaces
Dual-mode system: simple templates for quick layouts OR tmuxinator for complex projects.
Tmuxinator-based workspace management for complex projects with per-pane commands, environment variables, and startup scripts.
### Quick Commands
| Command | Alias | Description |
|---------|-------|-------------|
| `tw <name> [template]` | - | Create/attach workspace (auto-detects mode) |
| `tw-list` | `twl` | List active workspaces |
| `tw-templates` | `twt` | Show available templates |
| `tw-save <name>` | `tws` | Save current layout as template |
| `twf` | - | Fuzzy search workspaces |
| `tw-sync` | - | Toggle synchronized panes |
### Simple Templates (.tmux files)
| Template | Layout Description |
|----------|-------------------|
| `dev` | Editor (50%) + terminal (25%) + logs (25%) |
| `ops` | 4-pane monitoring grid |
| `ssh-multi` | 4 panes for multi-server management |
| `debug` | Main workspace (70%) + helper (30%) |
| `review` | Side-by-side comparison |
| `full` | Single full-screen pane |
### Tmuxinator Integration
For projects requiring per-pane commands, environment variables, and startup scripts:
### Commands
| Command | Alias | Description |
|---------|-------|-------------|
@@ -149,11 +125,10 @@ For projects requiring per-pane commands, environment variables, and startup scr
| `txi-new <n> [tmpl]` | `txin` | Create project (dev, ops, web, data, minimal) |
| `txi-edit <name>` | `txie` | Edit project YAML |
| `txi-list` | `txil` | List projects |
| `txi-delete <name>` | `txid` | Delete project |
| `txif` | - | Fuzzy search projects |
| `txi-templates` | `txit` | Show available templates |
**Smart Detection:** `tw` automatically uses tmuxinator if a project exists, otherwise creates simple workspace.
---
## Machine-Specific Configuration
@@ -473,7 +448,6 @@ DF_PLUGIN_DIR="$HOME/.dotfiles/zsh/plugins"
│ └── functions/ # Feature modules
│ ├── motd.zsh
│ ├── command-palette.zsh
│ ├── tmux-workspaces.zsh
│ ├── tmuxinator.zsh
│ ├── project-env.zsh
│ ├── notifications.zsh
@@ -495,8 +469,7 @@ DF_PLUGIN_DIR="$HOME/.dotfiles/zsh/plugins"
├── vim/.vimrc
├── tmux/.tmux.conf
├── espanso/ # Text expansion
── setup/ # Setup wizards
└── .tmux-templates/ # Workspace layouts
── setup/ # Setup wizards
```
---

View File

@@ -499,14 +499,6 @@ Systemd service management.
**Aliases:** `scs`, `scstart`, `scstop`, `screload`, `scmask`, `scunmask`, `jctl`, `jctlf`, `jctlb`, `jctlerr`
### tmux-workspaces.zsh
Tmux workspace management.
**Exported functions:** `tw`, `tw-create`, `tw-attach`, `tw-list`, `tw-delete`, `tw-save`, `tw-templates`, `tw-template-edit`, `tw-sync`, `tw-rename`, `twf`
**Aliases:** `twl`, `twc`, `twa`, `twd`, `tws`, `twt`, `twe`
---
## Color Reference

View File

@@ -110,13 +110,6 @@ BTRFS_DEFAULT_MOUNT="/"
SNAPPER_CONFIG="root"
LIMINE_CONF="/boot/limine.conf"
# ============================================================================
# Tmux Workspace Settings
# ============================================================================
TW_SESSION_PREFIX="work"
TW_DEFAULT_TEMPLATE="dev"
# ============================================================================
# Tmuxinator Settings
# ============================================================================
@@ -124,10 +117,6 @@ TW_DEFAULT_TEMPLATE="dev"
TMUXINATOR_ENABLED="auto" # auto, true, false
TMUXINATOR_CONFIG_DIR="$HOME/.config/tmuxinator"
# When both a simple template and tmuxinator project exist with the same name,
# tmuxinator takes precedence. Set to "false" to prefer simple templates.
TW_PREFER_TMUXINATOR="true"
# ============================================================================
# Python Template Settings
# ============================================================================

View File

@@ -107,13 +107,6 @@ BTRFS_DEFAULT_MOUNT="/"
SNAPPER_CONFIG="root"
LIMINE_CONF="/boot/limine.conf"
# ============================================================================
# Tmux Workspace Settings
# ============================================================================
TW_SESSION_PREFIX="work"
TW_DEFAULT_TEMPLATE="dev"
# ============================================================================
# Tmuxinator Settings
# ============================================================================
@@ -121,10 +114,6 @@ TW_DEFAULT_TEMPLATE="dev"
TMUXINATOR_ENABLED="auto" # auto, true, false
TMUXINATOR_CONFIG_DIR="$HOME/.config/tmuxinator"
# When both a simple template and tmuxinator project exist with the same name,
# tmuxinator takes precedence. Set to "false" to prefer simple templates.
TW_PREFER_TMUXINATOR="true"
# ============================================================================
# Python Template Settings
# ============================================================================

View File

@@ -254,6 +254,8 @@ _dotfiles_dir="$HOME/.dotfiles"
# Load dotfiles.conf first (sets DOTFILES_DIR and other vars)
if [[ -f "$_dotfiles_dir/dotfiles.conf" ]]; then
source "$_dotfiles_dir/dotfiles.conf"
# Apply DEFAULT_EDITOR from config if set
[[ -n "$DEFAULT_EDITOR" ]] && export EDITOR="$DEFAULT_EDITOR" VISUAL="$DEFAULT_EDITOR"
else
DOTFILES_DIR="$HOME/.dotfiles"
DOTFILES_BRANCH="main"

View File

@@ -1,471 +0,0 @@
# ============================================================================
# Tmux Workspace Manager - Project Templates & Layouts
# ============================================================================
# Enhanced with optional tmuxinator integration for complex projects.
#
# Simple templates (.tmux files) for quick layouts
# Tmuxinator (optional) for full project configurations with commands
#
# Priority: tmuxinator project > simple template > create new
# ============================================================================
source "${0:A:h}/../lib/bootstrap.zsh" 2>/dev/null || \
source "$HOME/.dotfiles/zsh/lib/bootstrap.zsh" 2>/dev/null
# ============================================================================
# Configuration
# ============================================================================
typeset -g TW_TEMPLATES="${TW_TEMPLATES:-$HOME/.dotfiles/.tmux-templates}"
typeset -g TW_PREFIX="${TW_PREFIX:-work}"
typeset -g TW_DEFAULT="${TW_DEFAULT:-dev}"
# Tmuxinator integration (auto-detect if available)
typeset -g TW_USE_TMUXINATOR="${TW_USE_TMUXINATOR:-auto}"
typeset -g TMUXINATOR_CONFIG_DIR="${TMUXINATOR_CONFIG_DIR:-$HOME/.config/tmuxinator}"
# ============================================================================
# Internal Functions
# ============================================================================
_tw_check() { df_require_cmd tmux || return 1; }
_tw_has_tmuxinator() {
[[ "$TW_USE_TMUXINATOR" == "false" ]] && return 1
command -v tmuxinator &>/dev/null
}
_tw_tmuxinator_project_exists() {
[[ -f "$TMUXINATOR_CONFIG_DIR/${1}.yml" ]]
}
_tw_init() {
df_ensure_dir "$TW_TEMPLATES"
# Create default templates if they don't exist
[[ ! -f "$TW_TEMPLATES/dev.tmux" ]] && {
cat > "$TW_TEMPLATES/dev.tmux" << 'EOF'
# Development workspace
# Layout: Editor (50%) | Terminal (25%) / Logs (25%)
split-window -h -p 50
split-window -v -p 50
select-pane -t 0
EOF
cat > "$TW_TEMPLATES/ops.tmux" << 'EOF'
# Operations workspace - 2x2 grid
split-window -h -p 50
split-window -v -p 50
select-pane -t 0
split-window -v -p 50
select-pane -t 0
EOF
cat > "$TW_TEMPLATES/full.tmux" << 'EOF'
# Full screen - single pane (default)
EOF
cat > "$TW_TEMPLATES/review.tmux" << 'EOF'
# Code review - side by side
split-window -h -p 50
select-pane -t 0
EOF
cat > "$TW_TEMPLATES/debug.tmux" << 'EOF'
# Debug workspace - main (70%) + helper (30%)
split-window -h -p 30
select-pane -t 0
EOF
cat > "$TW_TEMPLATES/ssh-multi.tmux" << 'EOF'
# Multi-server SSH - 4 panes with sync option
split-window -h -p 50
split-window -v -p 50
select-pane -t 0
split-window -v -p 50
# Uncomment to enable synchronized input:
# set-window-option synchronize-panes on
select-pane -t 0
EOF
df_print_success "Created default templates in $TW_TEMPLATES"
}
}
# ============================================================================
# Template Functions
# ============================================================================
tw-templates() {
_tw_init
df_print_func_name "Workspace Templates"
echo ""
df_print_section "Simple Templates (.tmux)"
for t in "$TW_TEMPLATES"/*.tmux(N); do
[[ -f "$t" ]] || continue
local name=$(basename "$t" .tmux)
local desc=$(head -1 "$t" | sed 's/^#[[:space:]]*//')
df_print_indent "$name"
[[ -n "$desc" ]] && df_print_indent " └─ $desc"
done
if _tw_has_tmuxinator; then
echo ""
df_print_section "Tmuxinator Projects"
local found=false
for p in "$TMUXINATOR_CONFIG_DIR"/*.yml(N); do
[[ -f "$p" ]] || continue
found=true
local name=$(basename "$p" .yml)
df_print_indent "$name (tmuxinator)"
done
[[ "$found" != true ]] && df_print_indent "(none - create with txi-new)"
fi
echo ""
df_print_info "Create workspace: tw-create <name> <template>"
}
# ============================================================================
# Workspace Management
# ============================================================================
tw-create() {
local name="$1"
local tmpl="${2:-$TW_DEFAULT}"
[[ -z "$name" ]] && { tw-templates; return 1; }
_tw_check || return 1
_tw_init
local session="${TW_PREFIX}-${name}"
# Check if session exists
if tmux has-session -t "$session" 2>/dev/null; then
df_print_warning "Workspace '$name' already exists"
df_confirm "Attach to it?" && tw-attach "$name"
return
fi
# Check for tmuxinator project first
if _tw_has_tmuxinator && _tw_tmuxinator_project_exists "$name"; then
df_print_step "Starting tmuxinator project: $name"
tmuxinator start "$name"
return
fi
# Check for simple template
local tfile="$TW_TEMPLATES/${tmpl}.tmux"
if [[ ! -f "$tfile" ]]; then
df_print_error "Template not found: $tmpl"
tw-templates
return 1
fi
df_print_step "Creating workspace: $name (template: $tmpl)"
# Create session and apply template
tmux new-session -d -s "$session"
# Source the template file in the context of the session
while IFS= read -r line; do
[[ "$line" =~ ^#.*$ ]] && continue
[[ "$line" =~ ^[[:space:]]*$ ]] && continue
tmux $line -t "$session" 2>/dev/null
done < "$tfile"
# If in a git repo, cd to root in first pane
if df_in_git_repo; then
local root=$(df_git_root)
df_print_info "Git root: $root"
tmux send-keys -t "$session:0.0" "cd '$root'" C-m
fi
df_print_success "Created: $name"
# Attach or switch
if [[ -z "$TMUX" ]]; then
tmux attach -t "$session"
else
df_print_info "Switch with: tmux switch -t $session"
fi
}
tw-list() {
_tw_check || return 1
df_print_func_name "Active Workspaces"
local found=false
tmux list-sessions -F "#{session_name}|#{session_windows}|#{session_attached}" 2>/dev/null | while IFS='|' read -r sess windows attached; do
[[ "$sess" == ${TW_PREFIX}-* ]] || continue
found=true
local name="${sess#${TW_PREFIX}-}"
local status=""
[[ "$attached" == "1" ]] && status=" (attached)"
df_print_indent "$name [${windows} window(s)]${status}"
done
[[ "$found" != true ]] && df_print_info "No active workspaces"
# Also show tmuxinator projects if available
if _tw_has_tmuxinator; then
local txi_projects=()
for p in "$TMUXINATOR_CONFIG_DIR"/*.yml(N); do
[[ -f "$p" ]] && txi_projects+=("$(basename "$p" .yml)")
done
if [[ ${#txi_projects[@]} -gt 0 ]]; then
echo ""
df_print_section "Available Tmuxinator Projects"
printf ' %s\n' "${txi_projects[@]}"
fi
fi
}
tw-attach() {
local name="$1"
[[ -z "$name" ]] && { tw-list; return 1; }
_tw_check || return 1
local session="${TW_PREFIX}-${name}"
# Check for tmuxinator project
if _tw_has_tmuxinator && _tw_tmuxinator_project_exists "$name"; then
if tmux has-session -t "$name" 2>/dev/null; then
[[ -z "$TMUX" ]] && tmux attach -t "$name" || tmux switch-client -t "$name"
else
df_print_step "Starting tmuxinator project: $name"
tmuxinator start "$name"
fi
return
fi
# Regular workspace
if ! tmux has-session -t "$session" 2>/dev/null; then
df_print_error "Workspace '$name' not found"
df_confirm "Create it?" && tw-create "$name"
return 1
fi
[[ -z "$TMUX" ]] && tmux attach -t "$session" || tmux switch-client -t "$session"
}
tw-delete() {
local name="$1"
[[ -z "$name" ]] && { tw-list; return 1; }
_tw_check || return 1
local session="${TW_PREFIX}-${name}"
# Handle tmuxinator project
if _tw_has_tmuxinator && _tw_tmuxinator_project_exists "$name"; then
tmuxinator stop "$name" 2>/dev/null
df_print_success "Stopped tmuxinator session: $name"
return
fi
if ! tmux has-session -t "$session" 2>/dev/null; then
df_print_error "Workspace '$name' not found"
return 1
fi
tmux kill-session -t "$session"
df_print_success "Deleted: $name"
}
# Main entry point - intelligent routing
tw() {
local name="$1"
local tmpl="${2:-$TW_DEFAULT}"
[[ -z "$name" ]] && { tw-list; return; }
_tw_check || return 1
local session="${TW_PREFIX}-${name}"
# Priority 1: Running tmux session
if tmux has-session -t "$session" 2>/dev/null; then
tw-attach "$name"
return
fi
# Priority 2: Tmuxinator project (if available)
if _tw_has_tmuxinator && _tw_tmuxinator_project_exists "$name"; then
if tmux has-session -t "$name" 2>/dev/null; then
tw-attach "$name"
else
df_print_step "Starting tmuxinator project: $name"
tmuxinator start "$name"
fi
return
fi
# Priority 3: Create new with template
tw-create "$name" "$tmpl"
}
# Fuzzy finder
twf() {
df_require_cmd fzf || return 1
_tw_check || return 1
local entries=()
# Add running sessions
tmux list-sessions -F "#{session_name}" 2>/dev/null | while read -r sess; do
[[ "$sess" == ${TW_PREFIX}-* ]] && entries+=("${sess#${TW_PREFIX}-}|session")
done
# Add tmuxinator projects
if _tw_has_tmuxinator; then
for p in "$TMUXINATOR_CONFIG_DIR"/*.yml(N); do
[[ -f "$p" ]] && entries+=("$(basename "$p" .yml)|tmuxinator")
done
fi
[[ ${#entries[@]} -eq 0 ]] && { df_print_info "No workspaces or projects"; return 1; }
local sel=$(printf '%s\n' "${entries[@]}" | fzf $(df_fzf_opts) --delimiter='|' --with-nth=1 --prompt='Workspace > ')
[[ -n "$sel" ]] && tw "${sel%%|*}"
}
# Save current layout as template
tw-save() {
local name="$1"
[[ -z "$name" ]] && { echo "Usage: tw-save <template-name>"; return 1; }
[[ -z "$TMUX" ]] && { df_print_error "Must be inside tmux"; return 1; }
_tw_init
local outfile="$TW_TEMPLATES/${name}.tmux"
df_print_func_name "Save Template: ${name}"
# Get current layout info
local pane_count=$(tmux list-panes | wc -l)
local layout=$(tmux display-message -p '#{window_layout}')
cat > "$outfile" << EOF
# Custom template: ${name}
# Saved: $(date)
# Panes: ${pane_count}
EOF
# Generate split commands based on pane count
# This is a simplified approach - complex layouts need manual adjustment
case $pane_count in
2)
echo "split-window -h -p 50" >> "$outfile"
;;
3)
echo "split-window -h -p 50" >> "$outfile"
echo "split-window -v -p 50" >> "$outfile"
;;
4)
echo "split-window -h -p 50" >> "$outfile"
echo "split-window -v -p 50" >> "$outfile"
echo "select-pane -t 0" >> "$outfile"
echo "split-window -v -p 50" >> "$outfile"
;;
*)
df_print_warning "Complex layout - manual adjustment may be needed"
for ((i=1; i<pane_count; i++)); do
echo "split-window -h -p 50" >> "$outfile"
done
;;
esac
echo "" >> "$outfile"
echo "select-pane -t 0" >> "$outfile"
df_print_success "Saved: $outfile"
df_print_info "Edit to refine: ${EDITOR:-vim} $outfile"
}
tw-template-edit() {
local name="$1"
[[ -z "$name" ]] && { tw-templates; return 1; }
local tfile="$TW_TEMPLATES/${name}.tmux"
[[ ! -f "$tfile" ]] && { df_print_error "Template not found: $name"; return 1; }
${EDITOR:-vim} "$tfile"
}
tw-sync() {
[[ -z "$TMUX" ]] && { df_print_error "Must be inside tmux"; return 1; }
local current=$(tmux show-window-option -v synchronize-panes 2>/dev/null)
if [[ "$current" == "on" ]]; then
tmux set-window-option synchronize-panes off
df_print_info "Pane sync: OFF"
else
tmux set-window-option synchronize-panes on
df_print_info "Pane sync: ON"
fi
}
tw-rename() {
local old="$1" new="$2"
[[ -z "$old" || -z "$new" ]] && { echo "Usage: tw-rename <old> <new>"; return 1; }
_tw_check || return 1
local old_session="${TW_PREFIX}-${old}"
local new_session="${TW_PREFIX}-${new}"
tmux has-session -t "$old_session" 2>/dev/null || { df_print_error "Not found: $old"; return 1; }
tmux rename-session -t "$old_session" "$new_session"
df_print_success "Renamed: $old$new"
}
# ============================================================================
# Help
# ============================================================================
tw-help() {
df_print_func_name "Tmux Workspace Manager"
cat << 'EOF'
Quick Commands:
tw <name> [tmpl] Create/attach to workspace
twf Fuzzy search workspaces
Workspace Management:
tw-create <n> [t] Create with template
tw-attach <n> Attach to workspace
tw-list List active workspaces
tw-delete <n> Delete workspace
tw-rename <old> <new> Rename workspace
Templates:
tw-templates Show available templates
tw-save <n> Save current layout as template
tw-template-edit <n> Edit template file
Pane Control:
tw-sync Toggle synchronized panes
Tmuxinator Integration:
If tmuxinator is installed, projects in ~/.config/tmuxinator/
are automatically detected. Use txi-* commands for management.
EOF
}
# ============================================================================
# Aliases
# ============================================================================
alias twl='tw-list'
alias twc='tw-create'
alias twa='tw-attach'
alias twd='tw-delete'
alias tws='tw-save'
alias twt='tw-templates'
alias twe='tw-template-edit'
alias twh='tw-help'
# ============================================================================
# Initialize
# ============================================================================
_tw_init

View File

@@ -1,15 +1,13 @@
# ============================================================================
# Tmuxinator Integration for Dotfiles
# Tmuxinator Workspace Management
# ============================================================================
# Extends tmux-workspaces with tmuxinator support for more powerful
# project configurations with per-pane commands, environment variables,
# and complex layouts.
# Tmux workspace management with per-pane commands, environment variables,
# and complex layouts via tmuxinator.
#
# Features:
# - Seamless integration with existing tw-* commands
# - Auto-detection: uses tmuxinator if project exists, falls back to templates
# - Project scaffolding with sensible defaults
# - Import/export between tmuxinator and simple templates
# - Multiple built-in templates (dev, ops, web, data, minimal)
# - Fuzzy search for projects
#
# Requirements:
# - tmuxinator (gem install tmuxinator or pacman -S tmuxinator)
@@ -352,98 +350,6 @@ windows:
EOF
}
# ============================================================================
# Integration with tw-* Commands
# ============================================================================
# Enhanced tw function that checks tmuxinator first
_txi_tw_enhanced() {
local name="$1"
local template="${2:-}"
[[ -z "$name" ]] && {
# List both tw workspaces and tmuxinator projects
tw-list 2>/dev/null
echo ""
txi-list 2>/dev/null
return
}
# Check if tmuxinator project exists
if _txi_check 2>/dev/null && _txi_project_exists "$name"; then
txi "$name"
return
fi
# Fall back to tw
tw "$name" "$template"
}
# ============================================================================
# Import/Export
# ============================================================================
# Import a simple .tmux template to tmuxinator format
# Usage: txi-import <template-name> [new-project-name]
txi-import() {
local tmpl_name="$1"
local project_name="${2:-$tmpl_name}"
[[ -z "$tmpl_name" ]] && { echo "Usage: txi-import <template-name> [project-name]"; return 1; }
_txi_check || return 1
local tmpl_file="${TW_TEMPLATES:-$HOME/.dotfiles/.tmux-templates}/${tmpl_name}.tmux"
if [[ ! -f "$tmpl_file" ]]; then
df_print_error "Template not found: $tmpl_name"
return 1
fi
df_print_func_name "Import Template: ${tmpl_name}"
_txi_init
local project_file="$TMUXINATOR_CONFIG_DIR/${project_name}.yml"
if _txi_project_exists "$project_name"; then
df_confirm "Overwrite existing project '$project_name'?" || return 1
fi
# Parse the simple template and convert to tmuxinator format
local pane_count=0
local panes=""
while IFS= read -r line; do
[[ "$line" =~ ^#.*$ ]] && continue
[[ "$line" =~ ^[[:space:]]*$ ]] && continue
if [[ "$line" =~ split-window ]]; then
((pane_count++))
fi
done < "$tmpl_file"
# Generate panes list
panes=" - # Pane 1"
for ((i=1; i<=pane_count; i++)); do
panes+="\n - # Pane $((i+1))"
done
# Create the project file
cat > "$project_file" << EOF
# Imported from template: ${tmpl_name}
name: ${project_name}
root: ~
windows:
- main:
layout: tiled
panes:
$(echo -e "$panes")
EOF
df_print_success "Imported: $project_file"
df_print_info "Edit to customize: txi-edit $project_name"
}
# ============================================================================
# Available Templates
# ============================================================================
@@ -479,15 +385,10 @@ txi-help() {
Templates:
txi-templates Show available templates
txi-import <t> [n] Import simple .tmux template to tmuxinator
Configuration:
Projects stored in: ~/.config/tmuxinator/
Integration:
Tmuxinator projects are automatically detected by tw commands.
If a tmuxinator project exists with the same name, it takes precedence.
EOF
}