# claude-tab-fix

The claude-tab-fix hook helps Claude Code handle tab-indented files without confusing line-number separators with file content. It targets failed edits and accidental mixing of tabs and spaces.

- plugin · `type=plugin` · Claude Code · ★ 17 repo stars
- Author: WithHolm
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/WithHolm/claude-tab-fix
- Updated: 2026-09-06
- Security check: automated, 2026-11-16 (text and 4 script files) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/plugins/claude-tab-fix

## What it does

Claude Code's Read output places a tab between each line number and its content. In files that also use tabs for indentation, those characters can be hard to tell apart, leading Claude to construct an old_string that does not match the file. claude-tab-fix adds context to help Claude preserve the actual indentation when editing Go, Rust, Templ, Makefiles, and other tab-indented files.

The plugin registers hooks for Read, Bash, and Write. After reading a tab-indented file, it explains how to interpret the line prefix. Before shell commands that edit such files, it advises using Edit instead. Before Write overwrites a file, it checks whether the proposed indentation style differs from the existing one. The hook cannot repair an invalid old_string itself, since Claude Code validates that value before PreToolUse hooks run.

Install the Go binary first, then add the plugin through the Claude Code marketplace commands. The executable must be available on PATH for the hook command to run by name. Manual setup is also possible by adding the hook configuration to `.claude/settings.json` in a project or to `~/.claude/settings.json` for a global setup.

## Install

### Claude Code (native platform)

**Plugin marketplace**
In the agent chat (not a shell):
```text
/plugin marketplace add anthropics/claude-plugins-community
```
In the agent chat (not a shell):
```text
/plugin install claude-tab-fix@claude-community
```

## When to use it
- Recover from Edit failures caused by incorrect tab indentation
- Distinguish line-number separators from tabs inside file content
- Flag writes that would combine spaces with existing tab indentation
- Steer shell-based edits toward the Edit tool
- Enable indentation warnings across Claude Code projects

## Example prompts
- Edit this Go file while preserving its existing tab indentation.
- Change the function in this Templ file without mixing tabs and spaces.
- Investigate why Edit cannot match the old text in this tab-indented file, then retry with the correct indentation.

## Similar
- [platform-custom-tab-generate](https://affpapa.org/en/nevibecode/skills/platform-custom-tab-generate.md) — skill · 6000 installs
- [tab-accordion](https://affpapa.org/en/nevibecode/skills/tab-accordion.md) — skill · 1100 installs
- [tab-navigation](https://affpapa.org/en/nevibecode/skills/tab-navigation.md) — skill · 842 installs
- [fix-clippy](https://affpapa.org/en/nevibecode/skills/fix-clippy.md) — skill · ★ 11812 repo stars
- [core-fix-skill-docs](https://affpapa.org/en/nevibecode/skills/core-fix-skill-docs.md) — skill · 2200 installs
- [APP-4903 improve TUI tab bar keybindings](https://affpapa.org/en/nevibecode/agents/app-4903-improve-tui-tab-bar-keybindings.md) — subagent · ★ 723 repo stars

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
