Vim+TmuxMaster

Real-World Vim + Tmux Workflows

Practical setups and configurations for everyday development tasks

Pair Programming

Share tmux sessions with teammates for real-time collaboration without screen sharing tools.

Host creates a shared session:
tmux -S /tmp/pair-session new -s pairing
Set proper permissions:
chmod 777 /tmp/pair-session
Partner connects:
tmux -S /tmp/pair-session attach -t pairing

Key Benefits:

  • Instant cursor sharing with no latency
  • Both partners can type simultaneously
  • Works over SSH - great for remote teams
  • Independent view control (scrolling)

Debugging Workflow

Efficiently debug applications with a multi-pane setup that lets you see code, logs, and interact with your program simultaneously.

Editor (Vim)
# Open source file
vim src/app.js
# Navigate to function
/function process
Logs
# Watch logs in real-time
tail -f logs/app.log
# Filter errors only
grep ERROR
Interactive Shell / Debugger
# Run with debugging enabled
node --inspect-brk app.js
# Or use language-specific debugger
pdb / gdb / lldb

Setup Command:

tmux new-session -d -s debug \; split-window -h \; split-window -v \; select-pane -t 0 \; send-keys 'vim src/app.js' C-m

Project Management

Organize large projects with named windows and sessions. Create project startup scripts to instantly launch your development environment.

Create a project session script:
#!/bin/bash
# project-start.sh
SESSION="project"

# Create session if it doesn't exist
tmux has-session -t $SESSION 2>/dev/null
if [ $? != 0 ]; then
  # Create a new session
  tmux new-session -d -s $SESSION

  # Rename first window to "editor"
  tmux rename-window -t $SESSION:0 "editor"
  tmux send-keys -t $SESSION:editor "cd ~/projects/myapp" C-m
  tmux send-keys -t $SESSION:editor "vim ." C-m

  # Create server window
  tmux new-window -t $SESSION:1 -n "server"
  tmux send-keys -t $SESSION:server "cd ~/projects/myapp" C-m
  tmux send-keys -t $SESSION:server "npm start" C-m

  # Create a tests window
  tmux new-window -t $SESSION:2 -n "tests"
  tmux send-keys -t $SESSION:tests "cd ~/projects/myapp" C-m
  tmux send-keys -t $SESSION:tests "npm test -- --watch" C-m

  # Return to editor window
  tmux select-window -t $SESSION:0
fi

# Attach to session
tmux attach-session -t $SESSION

Usage:

  • Make the script executable with chmod +x project-start.sh
  • Run ./project-start.sh to start
  • Detach with Prefix + d when needed

Full-Stack Development Workflow

Tmux Session: project-name Window 1: Editor (Vim) src/ components/ test/ fixtures/ Window 2: Server $ npm start Server running on port 3000 Window 3: Split Panes Git Status Test Runner modified: src/App.js All tests passing Editor Server Terminal

A typical development environment with an editor, server, and utility panes all in one tmux session.

Advanced Workflow Recipes

Remote Server Management

Manage multiple remote servers from a single terminal window. Keep sessions alive even when your connection drops.

#!/bin/bash
# Connect to multiple servers in one tmux session

# Create new session with window 1
tmux new-session -d -s servers -n "web-server"
tmux send-keys -t servers:web-server "ssh user@web-server" C-m

# Create window 2
tmux new-window -t servers:1 -n "db-server"
tmux send-keys -t servers:db-server "ssh user@db-server" C-m

# Create window 3
tmux new-window -t servers:2 -n "cache-server"
tmux send-keys -t servers:cache-server "ssh user@cache-server" C-m

# Select window 1 and attach to the session
tmux select-window -t servers:0
tmux attach-session -t servers

Key advantages:

  • All connections in one place
  • Persistent sessions survive network issues
  • Easy switching between servers
  • Copy/paste between server connections

Database Workbench

Create a dedicated environment for database operations with SQL queries, schema visualization, and documentation.

#!/bin/bash
# Database workspace setup

SESSION="db-work"
tmux new-session -d -s $SESSION

# Split the window horizontally
tmux split-window -h -t $SESSION:0
# Split the right pane vertically
tmux split-window -v -t $SESSION:0.1

# Left pane: SQL client
tmux send-keys -t $SESSION:0.0 "mysql -u username -p database_name" C-m

# Top right: Schema visualization
tmux send-keys -t $SESSION:0.1 "watch -n 5 'mysql -u username -p database_name -e \"SHOW TABLES;\"'" C-m

# Bottom right: Documentation/notes in Vim
tmux send-keys -t $SESSION:0.2 "vim db-notes.md" C-m

# Select the first pane and attach
tmux select-pane -t $SESSION:0.0
tmux attach-session -t $SESSION

Operations supported:

  • Interactive SQL queries
  • Auto-refreshing schema overview
  • Documentation and note-taking
  • Save/load query templates

Team Workflow Integration

Local Development

  • Vim for editing code
  • Tmux for local server
  • Git branches for features
  • Scripted environment setup

Code Review

  • Shared tmux session for paired reviews
  • Vim for navigating diffs
  • Split panes for before/after views
  • Running tests in a dedicated pane

Production Support

  • Remote session to production servers
  • Log monitoring in dedicated pane
  • Quick diagnostics with Vim
  • Multiple windows for cluster nodes

The true power of Vim + Tmux comes from integrating them into your team's daily workflows.

Try These Workflows

Ready to try these workflows yourself?