*! version 2.0.0 26may2026 Eric A. Booth and Elizabeth Teas

Help file for editanything

Title

editanything -- Open any text file in Stata's Do-file Editor, Viewer, or your OS default app

Syntax

editanything filename [, options]

Open mode (pick at most one; default is the Do-file Editor)
editor open in the Do-file Editor (default)

view open read-only in the Viewer (renders SMCL for .sthlp/.hlp/.smcl)

external hand off to the OS default application for that file type

showpath print a clickable file path; do not open anything

clipboard copy the file's contents to the system clipboard

File resolution
extension(str) default extension to try when filename has none (default: ado)

personal look in c(sysdir_personal) first when searching

new create a new empty file at filename and open it

Safety / behavior
replace copy a Stata-supplied (base/updates) ado into PERSONAL, then open the copy

force edit a Stata-supplied file in place anyway, or bypass the 32 KB size guard

quietly suppress the file-info banner

Description

editanything is a one-command replacement for SSC's adoedit
that works on any text file — not just .ado. Point it at a filename
(with or without an extension) and it will:

1. Search the current directory, the full ado-path
(adopath), and PERSONAL for the file.

2. Optionally fall back to common extensions (.ado, .sthlp,
.hlp, .do) when none is given.

3. Show a clickable path plus the file's size and detected
extension.

4. Dispatch to the requested viewer/editor/external app.

Supported text formats (this is just the tested list — anything plain-text
will open):

Stata — .ado .sthlp .hlp .smcl .do .mata .gph

Markup / docs — .md .markdown .html .htm .tex .bib .xml .rst

Data — .csv .tsv .txt .raw .log

Code — .R .r .py .js .css .sql .sh .bat .ps1

Config — .json .yaml .yml .toml .ini .cfg .conf .env

Non-text files (e.g. .dta, .xlsx, .pdf, .png) cannot be
opened in the Do-file Editor, but external will hand them off to your
OS default app.

Options

Open mode

editor (default) opens the resolved file in Stata's Do-file Editor with
doedit. Files larger than 32 KB cannot be opened on Stata < 11 — see
force and external below.

view opens the file read-only in the Viewer. For .sthlp, .hlp,
and .smcl files the SMCL is rendered; for everything else the raw text is
shown verbatim (view "file", asis). Handy for skimming long help
files or logs without risking edits.

external delegates to your OS default app via winexec
(open on macOS, start on Windows, xdg-open on Linux). Use
this for files that exceed the Do-file Editor's size limit or that are not
plain text (e.g. .pdf, .xlsx, .dta, images).

showpath skips opening the file entirely and just prints the clickable
browse link. Useful in scripts where you want the path returned in
r(file) without launching the editor.

clipboard copies the raw contents of the resolved file to the system
clipboard (uses pbcopy on macOS, clip on Windows, xclip on
Linux). Great for pasting a snippet into a Slack message or an email.

File resolution

extension(str) sets the default extension to try when filename
has none. The default is ado. Example: editanything mynotes, ext(md)
will look for mynotes.md on the ado-path.

personal looks in c(sysdir_personal) (`c(sysdir_personal)')
first when resolving the filename. Useful when you have a local override
of a community-contributed ado.

new creates a brand-new empty file at filename (in pwd
if no path is given), then opens it in the Do-file Editor. Errors if a file
already exists at that path.

Safety / behavior

replace is the recommended pattern for tweaking Stata-supplied ados:
it copies /ado/base/.../foo.ado into c(sysdir_personal) and opens
the copy, so Stata updates won't overwrite your edits.

force bypasses the two guardrails: it edits Stata-supplied files in
place and skips the 32 KB do-edit size check on Stata < 11.

quietly suppresses the file-info banner (path / size / type / flags).

Examples

Open an ado from the ado-path

. editanything regress (finds regress.ado)

. editanything regress.ado

Open a help file in the Viewer (rendered SMCL)

. editanything regress.sthlp, view

Edit any non-Stata text file from the Do-file Editor

. editanything README.md

. editanything analysis.py

. editanything pipeline.R

. editanything "config/settings.toml"

Peek at a CSV without importing it

. editanything raw/survey_responses.csv, view

Open a big log in the OS default text editor

. editanything analysis.log, external

Safely customize a Stata-supplied ado

. editanything ttest, replace (clones to PERSONAL, opens copy)

Start a brand-new file in the current directory

. editanything new_helper, new (makes new_helper.ado)

. editanything project_notes, new ext(md) (makes project_notes.md)

Find a file's path without opening it

. editanything regress, showpath

. display "`r(file)'"

Snag a snippet to the clipboard for pasting elsewhere

. editanything mymodel.do, clipboard

Prefer your own override over the community version

. editanything outreg2, personal

Stored results

editanything stores the following in r():

Scalars

r(size) file size in bytes (when detectable)

Macros

r(file) fully-resolved file path

r(basename) filename portion only (no directory)

r(extension) detected extension (lowercased, no dot)

Remarks

Why not just type doedit? Three reasons:

1. doedit requires the exact path — editanything searches
the ado-path so editanything regress just works.

2. editanything refuses to clobber Stata-supplied ados and offers
replace to copy them into PERSONAL first.

3. editanything extends the workflow to any text file, not just
.ado — same muscle memory for .py, .md, .csv, etc.

What about huge files? Stata's Do-file Editor cannot open files >
32 KB on Stata < 11, and very large files can be slow even on current Stata.
Use external to delegate to your OS editor (BBEdit, VS Code, Notepad++,
etc.) or view to skim read-only.

Cross-platform path handling. Backslashes are normalized to forward
slashes for display, leading ~ is expanded to $HOME, and the
clipboard / external-app calls dispatch to the right OS-native tool.

Authors

Eric A. Booth

Texas 2036

Email: eric.a.booth@gmail.com

GitHub: www.github.com/ericabooth

Elizabeth Teas

Sr Research Scientist, Far Harbor, LLC

Email: elizabeth@farharbor.com

Issues and pull requests welcome at
github.com/ericabooth/EditAnything-stata-public.