← Otto User GuideCommand Palette

The command palette is a keyboard way into everything a Files window can do. Press Ctrl+P, type a few letters of what you want, press Return. You do not need to know which menu a command lives in or what shortcut it has.

It finds commands, not files. To find a file, use type-ahead, Ctrl+L or Ctrl+F — see Files.

The command palette over a Files window with “mo” typed, listing Move to Folder, Move to Trash and other matches, each with its menu and shortcut on the right

Opening and closing

The command palette is only in the Files window. It is not in the file picker that opens when another application asks you to choose a file.

Finding a command

With nothing typed, the command palette lists every command you can use right now, grouped under Go, File, Edit and View. Once you start typing, the groups go away and the list is sorted by how well each command matches. Each row shows its group as a small badge.

Matching is loose on purpose:

↑ and ↓ move the highlight, Home and End jump to either end, and Return runs the highlighted command. You can also use the mouse: the row under the pointer is highlighted, and a click runs it.

If a row has a keyboard shortcut, it is shown on the right. That makes the command palette an easy way to learn the shortcuts you use most.

Commands that can’t run are not listed. You won’t see Paste when the clipboard is empty, Move to Trash when nothing is selected, or Put Back outside the Trash. If you can’t find a command, that is usually why.

Commands that ask a question

Some commands need more from you: a path, a name or a pattern. These rows show what they need after the title, dimmed, as in Go to Path › path.

Return or Tab on one of them does not run it straight away. The field changes to a prompt instead:

Go to path: ~/Documents

The part before the colon is fixed. What you type after it is your answer.

For choice lists such as Sort By or Change View, the current setting is already highlighted.

What is in it

The command palette doesn’t add anything the window can’t already do. Each command behaves exactly as its menu item or shortcut does, with the same undo entry.

GroupCommands
GoBack, Forward, Up, Home, Go to Path, Go to Place, Open
FileGet Info, Rename, New Folder, Move to Trash, Move to Folder, New Folder with Selection, Rename N Items, Run text recognition (pictures, with a recogniser installed)
File (in the Trash)Put Back, Delete Immediately, Empty Trash
EditCut, Copy, Paste, Select All, Select Matching, Undo
ViewList, Icon and Column view, Change View, Sort By, Show or Hide Hidden Files, Quick Look, Search

The commands in bold ask you something. Where the menus name what a command will affect, so does the command palette: you’ll see “Move 3 Items to Trash”, not just “Move to Trash”.

A few of them work a little differently from their menu versions:

Select Matching

Select Matching takes a pattern like *.png and selects the matching files. The selection updates as you type, and a note under the field says how many files match, for example “3 of 61 selected”.

Renaming several files at once

Select two or more files and choose Rename 3 Items. You type a single name pattern, and each file’s name is filled in from it. The field starts as {name}, so pressing Return without typing anything changes nothing.

As you type, the list shows a preview of every rename, for example IMG_001.jpg → Holiday 1.jpg.

WriteGets
{name}The original name, without its extension
{ext}The extension, without its dot
{n}The file’s number in the selection, starting at 1
{n:3}That number padded to three digits: 001
{n@10}The number, counting from 10 (combine with padding: {n:3@10})
{1}, {2}, {-1}Words of the original name. Words are split at spaces, _, - and .; negative numbers count from the end
{2..}, {1..3}, {..-2}A run of words, joined with spaces
{name:1..4}, {name:-3..}Characters of the original name, by position

Positions start at 1, and ranges include both ends. So for IMG_2024_Paris.jpg, {3} is Paris and {2..} is 2024 Paris.

If the pattern has no {ext} and no dot, each file keeps its own extension. Holiday {n} turns IMG_001.jpg into Holiday 1.jpg.

If two files would get the same name, or a name belongs to another file in the folder, that line turns red. Return then won’t run until you fix it. Swaps are fine: renaming 1 to 2 while 2 becomes 3 works.

Leaving a file out. Press ↓ to move from the field into the preview, then press Space on a file to skip it; press Space again to include it. Clicking a line does the same. A skipped file is shown struck through, and the numbering closes up without it. Type again to go back to the field. Skipped files stay skipped.

The whole rename is one undo step.

Adding your own commands

Any script you put in ~/.config/otto/files-scripts/ can add commands to the command palette. They also appear in the right-click menu when they apply to the selection. Script commands work like the built-in ones: they have previews and undo, and they run in the background. If a command asks a question, the right-click menu opens the command palette at its prompt.

Custom Commands in Files walks through writing one and describes everything a script can do, and PDF from Pictures builds a longer one that turns a selection of pictures into a document.

Not there yet