File associations
File associations decide what Enter does with a file or directory, what Browse Into browses a file as, the mode the viewer (F3 and Quick View) opens it in, and the language the editor (F4) highlights it as. Newt ships built-in associations for archives, disc images, and the editor’s languages; your own entries take precedence.
The Associations tab
Section titled “The Associations tab”Open Settings with Mod + , and choose the Associations tab, or run Change Association… from the file context menu or the Command Palette to open it at the row that applies to the focused entry. Each row is a name pattern, with your patterns under Yours above the built-ins. The Enter, View (F3), and Syntax highlighting (F4) columns show what happens to a matching file; F4 always opens Newt’s editor, and the column only chooses its language. Folder rows have only an Enter column.
Values the row sets itself are shown with an accent dot. Inherited values are
muted; hover one to see where it comes from, such as a built-in or another of
your patterns (*.gz showing through on *.tar.gz). Because the viewer
normally chooses its mode from a file’s content, the View (F3) column shows
what files of that name usually open as, or By contents when that varies.
Click a cell, or focus it and press Enter or Space, to choose a value. Default removes the row’s own setting so the inherited value applies again. Enter can be set to the default app, the viewer, the editor, browsing as an archive or disc image, or any user command. A Browse Into submenu sets the format for files that Enter does not browse.
To add a pattern, type it into the add row at the top: .rtf is read as
*.rtf, and globs and exact names such as Makefile also work. Choose
Files or Folders, then set any cell to add the pattern.
To remove a pattern, click its Delete button or press Delete on its row. Arrow keys, Home, and End move between cells.
The search box filters patterns by text or by file name: release.tar.gz
lists *.tar.gz and *.gz and sums up what happens to that file.
Edit associations in settings.toml
Section titled “Edit associations in settings.toml”Changes made on the tab are written to [[association]] entries in
settings.toml, keeping comments and entry order. You can also edit the
entries directly:
[[association]]match = ["*.nupkg", "*.vsix"] # name globs, case-insensitive; one string or a listenter = "browse" # open, browse, view, edit, or commandformat = "zip" # zip, 7z, tar, compressed, or disc
[[association]]match = "*.log"viewer = "text" # text, hex, dissect (Structure), table, markdown, image, audio, video, or pdflanguage = "plaintext" # an editor language id, as in the editor's Language menu
[[association]]match = "build"kind = "directory" # file (default) or directoryenter = "command"command = "Build" # the title of a [[command]]Every key except match is optional. The enter values are:
| Value | Effect |
|---|---|
open | Hand the file to the system’s default application. |
browse | Go into a directory, or into a file as format. |
view | Open Newt’s viewer. |
edit | Open Newt’s editor. |
command | Run the user command named by command. |
format = "tar" covers tar, cpio, and ar containers, plain or compressed;
compressed is a single gzip, bzip2, xz, or zstd file; disc is an ISO 9660
or UDF image. For a directory, only open and command change what Enter
does, and open works only on this computer’s own filesystem; otherwise Enter
goes into it.
An entry that cannot be read, or that names a missing command or language, is ignored and reported; see Settings.
How matches are resolved
Section titled “How matches are resolved”When several patterns match a name, the one with the most literal characters
wins: *.tar.gz before *.gz, Dockerfile before *. At equal
specificity, your entries come before the built-ins, then file order decides.
Each property is resolved separately, from the first matching entry that sets
it, so an entry that sets only viewer leaves Enter to the next match. A
viewer mode no entry sets comes from the file’s content (see
Viewer); a language no entry sets comes
from the detected file type, then plain text.
The built-in associations cover the archive and disc formats Newt can browse and the editor’s languages. Office and OpenDocument files, EPUB, Python wheels, NuGet and VS Code packages, and Rust crates open in their own applications but can be browsed into from the context menu.
Packages on macOS
Section titled “Packages on macOS”App bundles, frameworks, Xcode projects, .rtfd documents, photo libraries,
and other packages are directories that Finder shows as files. Newt asks macOS
which directories are packages, so they are recognized only where a Mac serves
the files: locally on a Mac, or in a remote session to one. A folder named
Tool.app on Linux, in S3, or in an archive is an ordinary folder.
Enter goes into a package by default. Turn on Behavior → Open Packages
(behavior.open_packages) to open packages in their application instead. A
kind = "directory" association that sets enter still decides what Enter
does for the names it matches.
Browse Into and Open in Default App
Section titled “Browse Into and Open in Default App”Two context-menu commands bypass what Enter would do. Neither has a default shortcut.
- Browse Into goes into the focused directory or package, or browses a file as its association’s format. Without an association, Newt detects ZIP, 7z, tar, cpio, ar, gzip, bzip2, xz, zstd, ISO 9660, and UDF from the file’s contents. The context menu offers it only for files with an associated format, so for a renamed ZIP, run Browse Into from the Command Palette.
- Open in Default App always hands the entry to the system’s default application. A file that is not on this computer is downloaded to a temporary directory first.
To pick a different application for one file, use Open With.