Dev Environment Stack
Dev Environment Stack
Modern terminal-based development environments are built on multiple layers working together. Understanding these layers helps you customize your workflow and troubleshoot issues effectively.
The Four-Layer Architecture
Your development environment operates on four distinct layers, each with specific responsibilities:
βββββββββββββββββββββββββββββββββββββββ
β Layer 4: Editor (Neovim/LazyVim) β β File editing, IDE features
βββββββββββββββββββββββββββββββββββββββ€
β Layer 3: Shell (zsh/bash) β β Command execution, line editing
βββββββββββββββββββββββββββββββββββββββ€
β Layer 2: Multiplexer (tmux) β β Session management, panes
βββββββββββββββββββββββββββββββββββββββ€
β Layer 1: Terminal (Ghostty/iTerm) β β Window management, rendering
βββββββββββββββββββββββββββββββββββββββ
Layer 1: Terminal Emulator
Examples: Ghostty, iTerm2, Alacritty, Warp, Kitty
Responsibilities:
- Rendering text and colors on screen
- Tab and window management (Cmd+T for new tabs)
- Font rendering and ligature support
- GPU acceleration for smooth scrolling
- Color scheme configuration
What it does NOT do:
- Persistent sessions (sessions die when you close the terminal)
- Advanced pane splitting and management
- Command-line editing
Key insight: The terminal is just the display layer. Closing it kills everything inside.
Layer 2: Terminal Multiplexer (tmux)
See: tmux - Terminal Multiplexer
Responsibilities:
- Session persistence (survives terminal closure)
- Advanced pane splitting and layout management
- Multiple windows within a session
- Session attach/detach workflows
- Scriptable preset layouts
Why you need it:
- Create development environments with preset layouts
- Detach from work, close laptop, reattach later without losing state
- Work on remote servers and maintain persistent sessions
- Better pane management than terminal-native splits
Example workflow:
bash# Create a dev session with 3 panes tmux new -s dev \; \ split-window -h \; \ split-window -v \; \ send-keys -t 0 'nvim' C-m \; \ send-keys -t 1 'npm run dev' C-m \; \ send-keys -t 2 'git status' C-m
This creates:
βββββββββββββββ¬ββββββββββββββ
β β Server β
β Editor β Running β
β (nvim) βββββββββββββββ€
β β Git β
βββββββββββββββ΄ββββββββββββββ
Layer 3: Shell (zsh/bash)
See: Shell Line Editing with Zsh, Terminal Keyboard Shortcuts
Responsibilities:
- Command execution and environment variables
- Command-line editing (Ctrl+W, Option+arrows, etc.)
- Command history and search
- Tab completion
- Aliases and functions
- Prompt customization (via Starship, Oh My Zsh, etc.)
Key features most people don't know:
- Readline/emacs keybindings for fast line editing
- Reverse search with Ctrl+R
- History expansion with
!!,!$, etc. - Directory navigation with
cd -,pushd,popd
Keyboard shortcuts you use every day:
- Ctrl+W: Delete word backward
- Ctrl+U: Delete to start of line
- Ctrl+A/E: Jump to start/end of line
- Option+β/β: Move by word
- Ctrl+R: Reverse history search
Layer 4: Editor (Neovim/LazyVim)
See: Neovim/Neovim - The Vim Ecosystem, Neovim/LazyVim Setup
Responsibilities:
- File editing with modal editing (insert mode vs normal mode)
- LSP integration for code intelligence
- Git integration
- Fuzzy finding files and text
- Terminal emulation within the editor
Why Neovim over VS Code in terminal:
- Extremely fast, even on remote servers
- Modal editing is faster once you learn it
- Scriptable with Lua
- Works over SSH without lag
- Composable with tmux and shell workflows
The LazyVim advantage:
- Pre-configured with sane defaults
- Modern IDE features out of the box
- Easy plugin management
- Still pure Neovim underneath
How the Layers Work Together
Scenario 1: Opening a new project
- Terminal layer: Press Cmd+T to open new tab in Ghostty
- Multiplexer layer: Run
tmux new -s myprojectto create persistent session - Shell layer: Run
cd ~/Code/myprojectto navigate - Editor layer: Run
nvim .to open Neovim in project directory
Scenario 2: Editing a command before running it
- Shell layer: Type long command
- Shell layer: Use Ctrl+A to jump to start, Ctrl+W to delete words
- Shell layer: Use Option+β to navigate by word
- Shell layer: Press Enter to execute
Scenario 3: Persistent development session
- Multiplexer layer: Create tmux session with preset layout
- Editor layer: Open Neovim in first pane
- Shell layer: Run dev server in second pane
- Multiplexer layer: Detach with Ctrl+B D, close laptop
- Terminal layer: Later, reopen terminal
- Multiplexer layer: Reattach with
tmux attach -t dev- everything still running!
Common Confusion Points
"Why isn't my session persistent when I close the terminal?" β You need tmux (Layer 2). The terminal emulator alone doesn't persist sessions.
"Why don't Vim keybindings work in my shell?"
β Shell (Layer 3) and Editor (Layer 4) are separate. Use set -o vi in shell for vi-mode, or learn emacs keybindings (Ctrl+W, etc.).
"How do I split panes?" β Use tmux (Layer 2) for persistent splits, not terminal-native splits. Tmux splits survive terminal closure.
"Why is my text rendering weird?" β Terminal emulator (Layer 1) issue. Check font configuration and ligature support.
Recommended Setup for Maximum Productivity
- Terminal: Ghostty or Alacritty (fast, GPU-accelerated)
- Multiplexer: tmux with custom keybindings and preset layouts
- Shell: zsh with Starship prompt and custom aliases
- Editor: LazyVim (Neovim with modern IDE features)
Further reading:
- tmux - Terminal Multiplexer - Session management and layouts
- Terminal Keyboard Shortcuts - Master shell line editing
- Neovim/Neovim - The Vim Ecosystem - Understanding Vim/Neovim/LazyVim
- Neovim/LazyVim Workflows/File Navigation in LazyVim - Efficient file management