# Custom commands, web search and snippets

> Create Lightspot custom commands that open URLs, run Terminal or shell commands or AppleScript, with {query} arguments and prefixes. Web search prefixes (gh, npm, so, mdn…), search engines and text snippets.

- URL: https://afixer.app/lightspot/custom-commands
- Part of: Projects › Lightspot
- Language: en

Teach Lightspot your own shortcuts: a URL with your search text in it, a Terminal command, a background shell script or an AppleScript, each with an optional prefix. Built-in search prefixes and text snippets work the same way.

## Custom commands

Press ⌘⇧C, or choose **Custom Commands…** in the menu, to open the manager. A new install comes with three commands: _Open GitHub_ (prefix `gh`), _System Info_ (`uname -a && sw_vers` in Terminal) and _Show Notification_ (an AppleScript that shows a notification).

![The Custom Commands manager: five commands with their type, prefix and target, and buttons to reorder, edit, run and delete](https://afixer.app/lightspot/shots/custom.webp)

Each row shows the name, the runner, the prefix and the target, with buttons to move it, edit it, run it or delete it. **New** opens the editor, and **Presets** adds a ready-made command. You can keep up to 100 commands; new ones are added at the top.

### Creating a command

The editor asks for:

- **Command Type**: Open URL, Terminal, AppleScript or Shell Script (see the table below).
- **Icon**: The runner’s icon (your default browser, your terminal or Script Editor), an image or app you choose with **Choose File…**, or the type’s symbol. Chosen images are scaled down to 128 pixels and stored inside the command, so they survive an export.
- **Name**: What you search for and what the row shows, for example _Open GitHub_.
- **Prefix Shortcut (optional)**: A word that starts the query, such as `gh`, `yt` or `npm`.
- **Target**: The URL, Terminal command, AppleScript code or shell command to run.
- **Keywords (optional, comma-separated)**: Extra words that should find the command.

| Type         | How it runs                                                                                                                                                                                       |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Open URL     | Opens the URL in your default browser. A URL without `://` gets `https://` in front.                                                                                                              |
| Terminal     | Runs the command in your [chosen terminal](https://afixer.app/lightspot/terminal#terminals) (Apple’s Terminal when Warp is chosen), where you see the output.                                     |
| AppleScript  | Runs the code with `osascript`, in the background.                                                                                                                                                |
| Shell Script | Runs the command with `/bin/sh -c` in the background, with no window. A command containing `sudo` goes through [Touch ID or the password dialog](https://afixer.app/lightspot/terminal#touch-id). |

### Passing what you type

Put `{query}` (or `%s`, or `%@`) in the target where your text should go:

- **URL:** the text is URL-encoded. Without a placeholder, it is added as `?q=…` (or `&q=…`).
- **Terminal and shell:** the text is inserted exactly as typed, without quoting, so `ping -c 4 {query}` becomes `ping -c 4 example.com`. Without a placeholder it is added at the end after a space. Only use commands you would type yourself.
- **AppleScript:** quotes and backslashes in the text are escaped. Without a placeholder, the text is not used.
- With nothing typed, the placeholders are removed.

### Prefixes

Type the prefix, a space and your text. The command becomes the Top Hit with your text filled in, and ↵ runs it:

![png example.com shows Ping Host for 'example.com' with the command ping -c 4 example.com](https://afixer.app/lightspot/shots/custom-ping.webp)

![c example.com shows Curl Headers for 'example.com', running curl -IL example.com](https://afixer.app/lightspot/shots/custom-curl.webp)

Typing only the prefix shows the command with its target. Without a prefix, a command is found by its name, its keywords or its target text, like any other result. A command whose name starts with “Open” is shown as “Search …” when used with a prefix, so _Open GitHub_ reads _Search GitHub for 'lightspot'_.

### Presets

**Presets** in the manager (and **Fill from Preset** in the editor) add these commands. When the list is empty, **Load Default Presets** adds the first three.

| Prefix | Name           | Type     | Target                                                  |
| ------ | -------------- | -------- | ------------------------------------------------------- |
| `gh`   | GitHub         | URL      | `https://github.com/search?q={query}&type=repositories` |
| `g`    | Google         | URL      | `https://www.google.com/search?q={query}`               |
| `yt`   | YouTube        | URL      | `https://www.youtube.com/results?search_query={query}`  |
| `so`   | Stack Overflow | URL      | `https://stackoverflow.com/search?q={query}`            |
| `ddg`  | DuckDuckGo     | URL      | `https://duckduckgo.com/?q={query}`                     |
| `wiki` | Wikipedia      | URL      | `https://en.wikipedia.org/w/index.php?search={query}`   |
| `npm`  | npm            | URL      | `https://www.npmjs.com/search?q={query}`                |
| `png`  | Ping Host      | Terminal | `ping -c 4 {query}`                                     |
| `c`    | Curl Headers   | Terminal | `curl -IL {query}`                                      |

Custom commands are saved with your settings and included when you [export them](https://afixer.app/lightspot/settings#backup), with your home folder written as `~` so the file works on another Mac.

## Web search

Every query ends with a _Web Search_ row, so ↵ on a query with no other results searches the web in your default browser.

![A query with no other matches shows only Search Google for it](https://afixer.app/lightspot/shots/web.webp)

Choose the engine in the menu bar icon: **Search Engine**.

| Engine           | URL                                   |
| ---------------- | ------------------------------------- |
| Google (default) | `https://www.google.com/search?q=…`   |
| DuckDuckGo       | `https://duckduckgo.com/?q=…`         |
| Kagi             | `https://kagi.com/search?q=…`         |
| Bing             | `https://www.bing.com/search?q=…`     |
| Brave Search     | `https://search.brave.com/search?q=…` |
| Ecosia           | `https://www.ecosia.org/search?q=…`   |

### Search prefixes

These prefixes are built in, whatever engine you chose. Type the prefix, a space and your text:

| Prefix   | Searches                          | Opens                                |
| -------- | --------------------------------- | ------------------------------------ |
| `g`      | Google                            | `google.com/search`                  |
| `ddg`    | DuckDuckGo                        | `duckduckgo.com`                     |
| `gh`     | GitHub (repositories)             | `github.com/search`                  |
| `yt`     | YouTube                           | `youtube.com/results`                |
| `so`     | Stack Overflow                    | `stackoverflow.com/search`           |
| `npm`    | npm                               | `npmjs.com/search`                   |
| `crates` | crates.io                         | `crates.io/search`                   |
| `wiki`   | Wikipedia                         | `en.wikipedia.org`                   |
| `mdn`    | MDN Web Docs                      | `developer.mozilla.org/en-US/search` |
| `brew`   | Homebrew (opens the formula page) | `formulae.brew.sh/formula/…`         |

![npm astro shows Search npm for 'astro'](https://afixer.app/lightspot/shots/web-npm.webp)

A custom command with the same prefix appears too. With the default _Open GitHub_ command, `gh lightspot` shows both, the custom command first:

![gh lightspot shows the Open GitHub custom command as Top Hit and the built-in GitHub prefix under Web Search](https://afixer.app/lightspot/shots/web-gh.webp)

### Addresses

Type an address and Lightspot offers to open it directly: `https://…` links, `localhost:3000`, an IPv4 address with an optional port, or a domain such as `example.com`. Names that look like files (`notes.txt`, `main.swift`) are not treated as domains.

![localhost:3000 shows Open localhost:3000 as the Top Hit](https://afixer.app/lightspot/shots/url.webp)

## Text snippets

Snippets are short texts that ↵ copies to the clipboard, with a few placeholders filled in when you search. Type the keyword:

| Keyword | Name             | Copies                                          |
| ------- | ---------------- | ----------------------------------------------- |
| `date`  | Current Date     | Today as `2026-10-16`                           |
| `iso`   | ISO Timestamp    | The time in UTC, such as `2026-10-16T07:30:00Z` |
| `uuid`  | New UUID         | A new lowercase UUID                            |
| `shrug` | Shrug Emoji      | `¯\_(ツ)_/¯`                                     |
| `flip`  | Table Flip Emoji | `(╯°□°)╯︵ ┻━┻`                                  |

![shrug shows the Shrug Emoji snippet](https://afixer.app/lightspot/shots/snippet.webp)

A snippet appears when its keyword equals or starts with what you typed, or when its name contains it. The placeholders a snippet can use are `{{date}}` (`yyyy-MM-dd`), `{{time}}` (`HH:mm:ss`), `{{iso}}` (ISO 8601 in UTC), `{{uuid}}` and `{{clipboard}}` (the current clipboard text).

![date shows the Current Date snippet as Top Hit, followed by apps and the Date & Time settings pane](https://afixer.app/lightspot/shots/snippet-date.webp)

Lightspot has no editor for snippets yet: the five above are the ones you get, and they are not part of the settings export.
