Skip to content

euxx/editor-tweaks

Repository files navigation

Editor Tweaks

A collection of small VS Code editor utilities packed into a single extension.

VS Code Marketplace

Features

  • Highlight Current Line — bottom border decoration on the active cursor line
  • Toggle Quotes — cycle quote characters surrounding the cursor ("'`")
  • Remove Tabs on Save — replace tab characters with spaces using the editor's tabSize on save
  • Prune Open History — remove inaccessible paths from the recently opened list and the Go-to-File (Cmd+P) history
  • Git Auto Refresh — periodically refresh git status so the SCM Changes badge stays current even when VS Code is not focused
  • File History — automatically snapshot files on save for lightweight local version history

Highlight Current Line

Original Highlight Line

Improve:

  • Adds dimmed border (70% opacity) on inactive editors in split-screen

Applies a bottom border decoration to the active cursor line.

  • Active editor: full-brightness border following the cursor
  • Other visible editors: same border at 70% opacity, pinned to their last cursor position
  • Fully configurable: border color, style (solid / dashed / dotted), and width

Settings:

Setting Default Description
editorTweaks.highlightLine.enable true Enable the feature
editorTweaks.highlightLine.borderColor #65EAB9 CSS color value; leave empty to disable
editorTweaks.highlightLine.borderStyle solid solid · dashed · dotted
editorTweaks.highlightLine.borderWidth 1px CSS length value (e.g. 2px, 0.5em)

Toggle Quotes

Original Toggle Quotes

Improve:

  • Fixes \\ before closing quote being misidentified as an escape
  • Unescapes and re-escapes content when switching delimiters (original only swaps the quote chars)
  • Deduplicates multi-cursor edits on the same string (original applies the change twice, corrupting it)

Cycles the quote character surrounding the cursor: "'`"

  • Trigger: Alt+'
  • Correctly handles \\ before a closing quote
  • Automatically unescapes/re-escapes delimiters when switching (e.g. \"" when leaving ")
  • Works with multiple cursors — each cursor cycles its own quoted string independently

Settings:

Setting Default Description
editorTweaks.toggleQuotes.enable true Enable the feature
editorTweaks.toggleQuotes.chars ["\"", "'", "\"]` Quote characters to cycle through

Remove Tabs on Save

Original Remove Tabs on Save

Improve:

  • Uses actual column position for tab stop calculation (original used string index, giving wrong expansion mid-line)
  • Unifies exclusions into excludePatterns supporting language ID, exact filename, or *-glob (original only supported extension globs and a separate ignoreMakefiles flag)

Before writing a file to disk, replaces all tab characters with spaces using the editor's tabSize setting.

  • Tab stops are computed by column position, not a flat replacement (e.g. a tab at column 2 with tabSize: 4 expands to 2 spaces)
  • Exclude files by language ID, exact filename, or *-glob (defaults exclude makefile and *.go which require tabs)

Settings:

Setting Default Description
editorTweaks.removeTabsOnSave.enable true Enable the feature
editorTweaks.removeTabsOnSave.excludePatterns ["makefile", "*.go"] Patterns to skip — language ID, exact filename, or *-glob matched against basename

Prune Open History

Original Recently Opened Sweeper

Improve:

  • Skips non-file:// entries for both workspaces and files — SSH/remote/virtual entries are never touched (original may attempt fsPath on them)
  • Single maxItems setting applied independently to each category: workspaces get maxItems slots and files get maxItems slots (original's keepCount is per-category but documented as a single shared limit)
  • Also prunes the Go-to-File (Cmd+P) editor history (not covered by the original)

Removes stale entries from both:

  • The VS Code recently opened list (File → Open Recent)
  • The Go-to-File (Cmd+P) editor history

"Stale" means the path no longer exists on disk.

  • Runs automatically on startup (configurable)
  • Also available as a manual command: Editor Tweaks: Prune Open History
  • Non-file:// entries (SSH, remote, virtual workspaces) in the recently opened list are always kept untouched
  • maxItems is applied independently to each category of the recently opened list: workspaces and files each get maxItems slots
  • Pruning the Go-to-File history requires the system sqlite3 CLI (available by default on macOS and most Linux distributions); if absent this part of the feature is silently skipped and only the recently-opened list is pruned
  • Go-to-File history pruning takes effect on the next launch (stale entries are written back to the workspace database on window close)

Settings:

Setting Default Description
editorTweaks.pruneOpenHistory.enable true Enable the feature
editorTweaks.pruneOpenHistory.runAtStartup true Prune automatically on startup
editorTweaks.pruneOpenHistory.maxItems -1 Max local entries to keep per category in the recently opened list (maxItems does not trim the Go-to-File history); -1 = no limit

Git Auto Refresh

VS Code's built-in git integration polls status only when the window is focused. All refresh paths — including file-system-change triggers and git.autofetch — go through an internal whenIdleAndFocused() gate that blocks until the window gains focus. This means the Source Control badge can show stale counts while you are in another app.

This feature works around that by running git.refresh on a background timer:

  • Only fires when VS Code is not focused (focused windows already refresh on their own)
  • Interval and enable/disable are configurable; the timer restarts automatically when settings change
  • Enabled by default

Settings:

Setting Default Description
editorTweaks.gitAutoRefresh.enable true Enable background git status refresh
editorTweaks.gitAutoRefresh.intervalSec 10 Refresh interval in seconds (minimum 1 s; default 10 s)

File History

Automatically snapshots files on every save, providing lightweight local version history independent of git.

  • Each file gets a timestamped copy stored under a configurable root directory (default ~/.file-history)
  • Content-hash deduplication: consecutive saves with identical content produce only one snapshot
  • Time gating: snapshots of the same file are throttled by a configurable minimum interval (default 60 s)
  • Per-file version cap and global age-based expiry keep storage bounded
  • Restore creates a checkpoint of the current state before overwriting (large files may skip the checkpoint after confirmation)
  • Large files and excluded patterns are skipped automatically

Commands:

Command Description
Editor Tweaks: File History — Show List snapshots for the active file and preview a selected one
Editor Tweaks: File History — Restore Pick a snapshot and restore it into the active editor
Editor Tweaks: File History — Open History Folder Reveal the snapshot directory for the current workspace in Finder/Explorer

Settings:

Setting Default Description
editorTweaks.fileHistory.enable true Enable automatic file snapshots on save
editorTweaks.fileHistory.historyPath ~/.file-history Root storage path for snapshots. Supports ~ and $ENV_VAR
editorTweaks.fileHistory.minIntervalSeconds 60 Minimum seconds between snapshots of the same file (set to 1 for near-continuous backup)
editorTweaks.fileHistory.maxVersionsPerFile 60 Maximum snapshots to keep per file; oldest are deleted first
editorTweaks.fileHistory.maxDays 30 Delete snapshots older than this many days (cleanup runs once on activation)
editorTweaks.fileHistory.maxFileSizeKB 512 Skip files larger than this size (KB)
editorTweaks.fileHistory.excludePatterns ["**/.git/**", "**/node_modules/**"] Glob patterns of files to exclude from snapshots

License

Under the MIT License.

About

A collection of small VS Code editor utilities packed into a single extension.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors