Changing a file type
Add a kind of file of your own, or change what a key does for one that ships, on the File types screen. A kind is a name, the rules that say which files it is, and what each of the five keys does with them.
The File types screen
File types… opens it — from the application menu, the Options menu, ⌘K, or the button on the File types page of the settings.
- The list is every kind in the order it is checked: your own first, in red, then the ones that ship. A dot, •, before a kind says you added, changed or moved it and have not yet applied that. Beside each is what Enter, F3 and F4 do with it, in a word or two, under the keys they are on now.
- Under the list, the kind chosen is spelled out: all five keys, the two alternatives included, and its language. While a kind that ships is chosen, a note beside that says editing it adds a copy of your own.
The buttons under the list act on the kind chosen:
- Add…
- A new kind, at the top of the list.
- Edit…
- The kind chosen — Enter, or a second click, does the same. Your own is changed where it is. A kind that ships cannot change: you edit a copy, which goes at the top of the list.
- Remove
- Your own kind, chosen. A kind that ships cannot be removed.
- Move up · Move down
- Your own kind, among your own, which changes which is checked first. The ones that ship always stay under yours.
Nothing you change is in force until you choose OK or Apply, the screen’s own buttons:
- OK
- Puts what you changed in force, and closes the screen. ⌥O does the same.
- Apply
- Puts what you changed in force, and keeps the screen open. ⌥Y does the same.
- Cancel
- Closes the screen with nothing changed since the last Apply. Esc does the same, and with changes not applied both ask first.
With Write settings at as they change, the default, what OK and Apply put in force also
reaches settings.json then.
A kind of file
Add… and Edit… open the form for one kind: its name at the top, and down the side a page for its rules, one for each key, and one for its language. Each line of that list says what is set there now; move through it to show each page.
- Name
- What the list calls it.
Save is grayed until the form is complete, with the reason under it: a name, at least one rule, an app wherever a key is set to Open with app, and a command wherever one is set to Run command.
Rules
A file is this kind if any one rule matches it. The rules are listed by kind, then alphabetically, so alike rules sit together.
- To add one, choose its kind under Add rule, type the pattern or pick from the list beside it, and Add. A rule already there is not added twice.
- Remove takes away the rule chosen in the list.
- An extension rule, chosen, is shown whole in a field that changes it; in the list, one too long for its line ends with how many more it holds.
- Extension
- The name ends in a dot and one of these endings. Separate them with commas; a leading dot and the
case do not matter, and an ending with a dot of its own, such as
tar.gz, is one ending. - Name (wildcard)
- The whole name, with
*for any run of characters and?for one. Several patterns are separated by;, and anything after a|is left out:*.txt|notes*. Case does not matter. - Name (regular expression)
- A regular expression found anywhere in the name — anchor it with
^and$. Case does not matter. Backreferences and lookaround are not supported; an expression that cannot be used says so and cannot be added. - System type
- What macOS says the name is: picture, film, sound, archive, source code, plain text, program or application. Nothing is read.
- Contents
- What the first 4 KB say the file is: text; binary; script, text that starts with
#!; XML or HTML, text that starts with<?xml,<!doctypeor<html; JSON, text that starts with{or[; archive, a zip, gzip, 7z, RAR, bzip2 or xz one; program, a Mac, Linux or Windows one; Mach-O binary, a Mac program or library. Never a folder. - Is a folder
- Any folder.
- Is runnable
- A file with permission to be run.
- Is part of a split archive
- A name such as
photos.7z.001, or one such asphotos.z01orphotos.r00with another part of that archive beside it. Nothing is read.
Rules on the name are asked before the others, and Contents, the one that reads the file, last — see how a file’s kind is decided.
What each key does
One page for each key — Open, View, Alternate view, Edit, Alternate edit — headed with the key it is on now. Action is what the key does, the line under it says what that means, and under that is whatever the choice needs.
| Action | The key |
|---|---|
| Not set | Passes to the next kind that matches. A new kind starts with every key not set |
| Do nothing | Does nothing |
| Go inside | Goes into it, as into a folder: a folder, or an archive. Anything the pane cannot go into says so: an .arj archive, for one, is not supported yet |
| Open with system default | Opens it in the app macOS opens it with |
| Ask: open or look inside | Asks, in a small menu that opens on Look inside with Launch under it. What an application starts with |
| Open with app | Opens it in the app chosen in the list under it |
| Ask which app | Opens Open with…, every time |
| View here | Shows it in the viewer chosen under it |
| View as text or hex | Shows it in the text-and-bytes viewer |
| Edit here | Opens it in the editor chosen under it |
| Edit as text | Opens it in the built-in text editor |
| Edit with system default | Opens it in the app macOS edits it with — which macOS can set apart from the one it opens it with |
| Show menu | Shows the context menu, to choose from |
| Run | Runs it in a new tab of the built-in terminal, asking the first time — below |
| Run the search in it | Runs the kept search the file holds, from the folder the pane is in |
| Open the search form | Opens the find form on the kept search, to change, run or save back |
| Run command | Runs a command of yours on it — below |
- App
- Every app installed. An app the kind already names that is no longer installed stays at the top of the list.
- Viewer · Editor
- Automatic is the viewer, or the editor, made for the file’s kind, and the text viewer or text editor where there is none. Choosing one gives it the file whatever the file is called — a recording with an extension the player does not know, say.
Running a file
Run runs the file itself — a script or a program — in a new tab of the built-in terminal, started in the pane’s folder, and its output stays there. Nothing is set to run unless you set it.
- The first time, it asks: “Run deploy.sh? It can change anything you can.”
Enterthere runs nothing; choose Run. After thatEnterruns it at once — until the file changes, when it asks again. Two boxes under the question, reached withTaband ticked withSpace, change that:- Don’t ask again until this file changes is ticked to begin with. Untick it, and the file asks again the next time it runs.
- Don’t ask for any file set to Run stops the question for every such file. It is a setting, on the File types page of the settings, where you can turn it back off.
- Only a file with permission to run is run, a script included. One without it says so; Files › Info › Permissions… can give it one.
- Only a file in a folder on your Mac is run. Inside an archive, on the clipboard or in the bin, copy it out first.
When it ends you are told how it went, and the terminal shows its output — as for a command typed on the command line.
Running a command
Run command runs a line of shell on the file, with the same placeholders as the user menu:
{path}is the file in full and{name}its name;{paths}and{names}are the file too, since these keys never act on marked rows.{here}and{there}are the active pane’s folder and the other’s.- Each is quoted for the shell where it needs to be. A command whose placeholder has nothing to stand
for —
{there}with the terminal in the other pane’s place — says so and runs nothing.
It runs in your own terminal app, in the active pane’s folder. Which app, and whether in a new tab or a new window, are the settings Your own terminal and Commands open a new. Where no terminal installed can be given a command, it says so. A terminal that could not be opened says why on a notice: the folder or the terminal is not there any more, or the system refused access.
In background (not supported yet) says what it is: ticked, the key says so and runs nothing. In settings.json a
command can also run in the built-in terminal.
Language
- Color as
- What the text viewer and the editor color this kind of file as. Automatic is what the file’s name says, then what its start says; None is no coloring; or a language by name.
A kind that names a language and sets no key changes only the coloring: every key passes on.