LaTeX Auto Sync
Git-backed, Overleaf-style autosave for LaTeX — right inside VS Code.
Keep a local LaTeX folder in sync with GitHub without thinking about Git. It pulls
the latest changes when you open the project, commits and pushes shortly after you
save (debounced), and makes a best-effort push when you close the window. Built for
researchers who want versioned, collaborative LaTeX without leaving their editor or
paying for a hosted service.
📦 Installed manually as a .vsix — not on the VS Code Marketplace.
Download the latest .vsix from the Releases page and install
it from inside VS Code (see Install below). It is not published to
the Marketplace, so you won't find it by searching Extensions.
Features
- Pull on open — grabs collaborators' changes when the workspace loads.
- Background pull — periodically pulls remote changes while you write.
- Auto-push on save — debounced commit + push so you don't spam commits.
- Conflict-safe — pulls with
--autostash and aborts cleanly on conflict, so
a .tex file is never left with <<<<<<< markers; you're prompted to resolve.
- LaTeX-aware .gitignore — maintains a managed block of build artifacts
(
.aux, .log, .synctex.gz, …) so only source is synced.
- Smart commit messages — derived from the changed file names.
- Compile-before-push (optional) — runs
latexmk and skips the push if the
document doesn't build.
- Push on close — best-effort sync when VS Code shuts down.
- Manual commands —
Sync Now, Pull, Commit & Push, Toggle Auto-Push.
- Status bar + output channel — state at a glance and a full log.
Install
This extension is distributed as a .vsix (not on the Marketplace). To install:
- Download
latex-auto-sync-0.2.1.vsix from the
Releases page (or build it yourself — see below).
- In VS Code: open the Extensions panel (
Cmd/Ctrl+Shift+X) → click the
... menu → Install from VSIX… → pick the file.
- Reload VS Code when prompted.
Command-line alternative:
code --install-extension latex-auto-sync-0.2.1.vsix
Usage
- Open a LaTeX folder that is a Git repository with a remote (see First-time
setup below if it isn't one yet).
- The extension activates automatically and pulls the latest changes. You'll
see a LaTeX item in the status bar (bottom-right).
- Edit and save as usual. A few seconds after your last save it commits and
pushes automatically.
- While you work, it pulls in the background every few minutes so a
co-author's changes appear without reopening.
- Click the status-bar item any time to Sync Now.
Watch View → Output → LaTeX Auto Sync to see exactly what it's doing.
Commands
Open the Command Palette (Cmd/Ctrl+Shift+P) and type "LaTeX Auto Sync":
| Command |
What it does |
Sync Now (pull + commit + push) |
Full sync on demand. |
Pull |
Pull remote changes only. |
Commit & Push |
Commit and push local changes only. |
Toggle Auto-Push on Save |
Turn the on-save autosave on/off. |
Requirements
- Git installed and on your
PATH.
- The folder is a Git repository with a configured remote (e.g.
origin).
- You can already
git push from the terminal (credentials/SSH set up).
First-time setup (no GitHub repo yet)
The extension never creates a repository for you — this is deliberate, so it can't
accidentally push a private draft to the wrong place. If you open a folder that
isn't a Git repo, or has no configured remote, the extension does nothing: it
logs a line to Output → LaTeX Auto Sync ("Not a git repository — skipping" or
"Remote 'origin' not found — skipping") and stays quiet. No error popups, no failed
pushes, no half-committed state.
To connect a folder, create an empty repo on GitHub (no README/license, so the
first push is clean) at https://github.com/new, then run inside your LaTeX folder:
git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/<your-username>/<repo-name>.git
git push -u origin main
Or, with the GitHub CLI, do it all in one command from inside the folder:
gh repo create <repo-name> --private --source=. --remote=origin --push
After the first push, reopen the folder (or click the LaTeX status item →
Sync Now) and the extension takes over. It uses whatever Git credentials your
machine already has, so make sure git push works from the terminal first.
Settings
| Setting |
Default |
Description |
latexAutoSync.remote |
origin |
Remote to sync with. |
latexAutoSync.branch |
(current) |
Branch to sync; empty = current branch. |
latexAutoSync.pullOnOpen |
true |
Pull when the workspace opens. |
latexAutoSync.autoPushOnSave |
true |
Commit + push after a save. |
latexAutoSync.pushOnClose |
true |
Best-effort push on close. |
latexAutoSync.debounceSeconds |
10 |
Wait after the last save before committing. |
latexAutoSync.commitMessage |
Update ${files} |
Template; ${files} and ${date}. |
latexAutoSync.pullStrategy |
rebase |
rebase (autostash) or merge. |
latexAutoSync.manageGitignore |
true |
Maintain the LaTeX ignore block. |
latexAutoSync.backgroundPullMinutes |
5 |
Pull every N minutes; 0 disables. |
latexAutoSync.compileBeforePush |
false |
Build before pushing; skip push on failure. |
latexAutoSync.compileCommand |
latexmk -pdf |
Command used for the build check. |
Caveats
- Close window (~5s limit): VS Code allows roughly 5 seconds for shutdown work.
A large repo or slow connection can be cut off mid-push, so the debounced
auto-push on save is the reliable path; push-on-close is a backstop.
- Merge conflicts are not auto-resolved. If a pull conflicts, the status bar
shows an error and you resolve it in the SCM view as usual.
Build from source
npm install
npm run compile
# Press F5 in VS Code to launch the Extension Development Host.
Package a .vsix yourself with npx @vscode/vsce package. See
PUBLISHING.md to publish to the Marketplace.
Contributing
Issues and pull requests are welcome. If you hit a sync edge case, please include
the relevant lines from the LaTeX Auto Sync output channel.
License
MIT — free to use, modify, and share.