Skip to content

ouchinao/tmux-setting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tmux-setting

My personal tmux configuration and a helper script that opens a nano-centric "lightweight IDE" 6-pane workspace in one command. No Vim/LazyVim required — editing is done with plain nano.

Contents

  • .tmux.conf — tmux configuration (prefix, status bar, mouse, clipboard, key bindings, nano as default editor)
  • .tmux-6pane.sh — script that creates a work session laid out as a nano-centric IDE workspace
  • .tmux-claude.sh — script that creates a 4-pane layout for running Claude Code. Run outside tmux it creates a claude session; run inside tmux (e.g. via prefix + Enter) it opens a new window in the current session
  • .nanorc — handy nano defaults (line numbers, syntax highlighting, mouse, auto-indent, …)

Layout

+-------------------------+---------------+
|                         | git (lazygit) |
|                         +---------------+
|     editor (nano)       | def jump      |
|                         +---------------+
|                         | search rg/fzf |
+------------+------------+---------------+
| run / test |   shell    |               |
+------------+------------+---------------+
Pane Purpose
editor Main editing pane — nano <file> to edit
run / test Run your build / tests
shell Free shell
git lazygit (auto-started if installed)
def jump Jump to definitions with rg (rg -n "def <symbol>")
search Search the project with rg / rg --files | fzf

Claude Code layout (.tmux-claude.sh)

A layout for running Claude Code — Claude already handles editing and search internally, so it gets a big top-left pane, with lazygit, a free shell, and a nano diff viewer alongside.

+-----------------+-----------------+
| claude code     | lazygit         |
+-----------------+-----------------+
| shell           | nano (diff)     |
+-----------------+-----------------+
Pane Purpose
claude code Run claude here (not auto-started — a hint is printed)
lazygit lazygit TUI (auto-started)
shell Free shell for dev server / tests / logs
nano (diff) Review Claude's changes in nano (see below)

Review Claude's diffs in nano (no extra tools needed — nano - reads stdin and patch.nanorc colorizes the diff):

git diff | nano -v -        # unstaged changes, read-only (-v = view mode)
git diff HEAD | nano -v -   # all changes incl. staged

Start it with ~/.tmux-claude.sh [project-dir]. Outside tmux it creates a separate claude session (independent of work) and attaches; inside tmux it opens the layout as a new window in the current session (this is what prefix + Enter does).

Requirements

  • macOS (uses pbcopy, pmset, ifconfig — all built-in)
  • tmux (3.0+ recommended)
  • zsh at /bin/zsh (default on modern macOS)
  • nano (default editor for the workspace)

Optional (the workspace degrades gracefully without them):

  • lazygit — git pane (brew install lazygit)
  • ripgrep (rg) — def-jump & search panes (brew install ripgrep)
  • fzf — fuzzy file picking (brew install fzf)

SSID and battery percentage in the status bar are derived from macOS built-in commands (ifconfig, pmset -g batt).

Install

Place the files directly in your home directory:

git clone https://github.com/<you>/tmux-setting.git
cp tmux-setting/.tmux.conf ~/.tmux.conf
cp tmux-setting/.tmux-6pane.sh ~/.tmux-6pane.sh
cp tmux-setting/.tmux-claude.sh ~/.tmux-claude.sh
cp tmux-setting/.nanorc ~/.nanorc
chmod +x ~/.tmux-6pane.sh ~/.tmux-claude.sh

Reload the config inside an existing tmux session:

tmux source-file ~/.tmux.conf

Usage

Start a normal session

tmux

Start the 6-pane workspace

~/.tmux-6pane.sh            # use the current directory as the project
~/.tmux-6pane.sh ~/code/app # or pass a project directory

This kills any existing work session, creates a fresh nano-centric workspace (see Layout) rooted at the given project directory, and attaches to it. The git pane auto-starts lazygit if it is installed; the def-jump and search panes print rg/fzf hints.

Optional: add a shell shortcut

For convenience, add the following function to your ~/.zshrc so you can launch the 6-pane workspace by simply typing tmux-dev:

tmux-dev() {
  ~/.tmux-6pane.sh
}

Reload your shell (source ~/.zshrc) and run:

tmux-dev

Key bindings

The prefix is remapped from the tmux default C-b to C-q.

Binding Action
C-q Prefix
prefix + Enter New window with the Claude Code 4-pane layout
prefix + c New blank window (tmux default behavior)
prefix + | Split pane horizontally (left/right)
prefix + - Split pane vertically (top/bottom)
Mouse drag Select text; copies to macOS clipboard on release
Mouse wheel Enter copy mode and scroll

prefix + Enter opens a new window laid out for Claude Code via .tmux-claude.sh, in the current pane's directory. prefix + c keeps its default behavior (new blank window).

Editing with nano

The workspace is built around nano instead of Vim/LazyVim, so there are no modes to learn — just start typing. EDITOR/VISUAL are set to nano in .tmux.conf, and .nanorc enables line numbers, syntax highlighting, mouse support and auto-indent.

Common nano commands (all use Ctrl, shown as ^):

Key Action
^O Save (write Out)
^X Exit
^K Cut current line
^U Paste (Uncut)
^W Search (Where Is) — ^W ^W next
^\ Search & replace
^G Help (full command list)
^_ Go to line/column
M-U Undo (M- = Alt/Option)
M-E Redo

Status bar

  • Positioned at the top of the screen, centered window list.
  • Left: hostname:[pane-index]
  • Right: Wi-Fi status (📶/❌) battery% [YYYY-MM-DD(Day) HH:MM] (via ifconfig and pmset)
  • Refreshes every 1 second.

Clipboard

set-clipboard on is enabled and the copy command is set to pbcopy, so anything you select with the mouse (or yank in copy mode) lands in the macOS system clipboard.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages