You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| `enter` | Edit the selected gist (see `gh gist edit --help`) | `GH_FZF_GIST_EDIT_KEY` |
316
+
| `alt-c` | Clone the selected gist to the current directory (see `gh gist clone --help`) | `GH_FZF_GIST_CLONE_KEY` |
317
+
| `alt-X` | Delete the selected gist (see `gh gist delete --help`) | `GH_FZF_GIST_DELETE_KEY` |
318
+
| `alt-p` | Filter the list, showing only public gists | `GH_FZF_GIST_PUBLIC_FILTER_KEY` |
319
+
| `alt-s` | Filter the list, showing only secret gists | `GH_FZF_GIST_SECRET_FILTER_KEY` |
320
+
321
+
#### Examples
322
+
323
+
- Filter the initial list to only show public gists (excluding secret ones):
324
+
325
+
```sh
326
+
gh fzf gist --public
327
+
```
328
+
329
+
### Command: `search`
330
+
331
+
`gh fzf search <subcommand> [flags]`
332
+
333
+
> [!WARNING]
334
+
> The `search` command is **experimental**, which means it is subject to breaking changes without a major version bump. Please report any bugs you find!
335
+
336
+
The `search` command works differently than the others. There are two different search modes:
337
+
338
+
1. **gh:** This is the initial mode and nothing is displayed until you type a query. The mode uses GitHub's search syntax, which you can read about in their documentation:
2. **fzf:** This is the mode used by the rest of the commands, which uses `fzf` search syntax.
345
+
346
+
The mode is displayed in the bottom left corner. Start by searching with GitHub syntax. For example, you may type `author:@me` when using the `issues` or `prs` subcommands. When you switch modes from `gh` to `fzf`, the list remains the same and the GitHub query is saved to state and cleared from the search bar. You can then use `fzf` syntax to filter the list further. When you switch modes from `fzf` to `gh`, the GitHub query is restored and the list is reloaded.
347
+
348
+
#### Aliases
349
+
350
+
`s`, `-s`, `--search`
351
+
352
+
#### Subcommands
353
+
354
+
`issues`, `prs`, `repos`, `commits`, `code`
355
+
356
+
#### Flags
357
+
358
+
See `gh search <subcommand> --help` for available options
| `GH_FZF_DEFAULT_LIMIT` | The initial number of items to request from GitHub. The number of items can be changed at runtime with the `alt-1` to `alt-9` commands, see the [Usage](#usage) section for more info. | 75 |
399
+
| `GH_FZF_TRUNCATE_FIELDS` | Set the variable to any value to make `gh` truncate text to ensure all fields fit on the screen. When set, truncated text is **not** fuzzy findable. When unset, fields may be cut off, but all text is still fuzzy findable. | unset |
400
+
| `GH_FZF_HIDE_HINTS` | Set the variable to any value to hide the header (where the keybinding hints are) on startup. The header can still be toggled with the `alt-H` keybinding. | unset |
401
+
| `GH_FZF_BRANCH_PREFIX` | A string to prepend to the branch name entered for the `pr` command's `alt-o` keybinding. Spaces are replaced with hyphens. See the feature's [commit message] for examples. | unset |
402
+
| `GH_FZF_BRANCH_ADD_ISSUE_NUMBER` | When set, the issue number is added after the prefix (if specified) for the `pr` command's `alt-o` keybinding. The variable's value is added after the number, unless it is a space. See the feature's [commit message] for examples. | unset |
403
+
| `GH_FZF_NOTIFY_ICON` | A path to an icon for the desktop notification displayed by the `run` command's `alt-n` keybinding. Only supported by `dunstify` and `notify-send` for now. | unset |
404
+
| `GH_FZF_COPY_CMD` | The command used by your operating system to copy an item's URL to the clipboard. Expects the URL from stdin. This only needs to be set if the default doesn't work on your machine. | [see code] |
You can also set the [`FZF_DEFAULT_OPTS`](https://github.com/junegunn/fzf/blob/master/README.md#environment-variables) environment variable to add/change `fzf` options used by `gh-fzf` commands.
410
+
411
+
For example, create aliases in the `gh` config file that add new keybindings to the [`issue`](#command-issue), [`pr`](#command-pr), [`run`](#command-run), and [`milestone`](#command-milestone) commands:
gh api --silent --method DELETE /repos/{owner}/{repo}/milestones/{-1}
443
+
)+reload(eval \"\$FZF_DEFAULT_COMMAND\")'
444
+
" gh fzf milestone
445
+
```
446
+
447
+
When adding or modifying fzf keybindings:
448
+
449
+
- Use `{1}` in place of:
450
+
- the `<number>` for the [`issue`](#command-issue) and [`pr`](#command-pr) commands
451
+
- the `<tag>` for the [`release`](#command-release) command
452
+
- the `<id>` for the [`gist`](#command-gist) command
453
+
- the `<name>` for the [`label`](#command-label) command
454
+
- Use `{-1}` in place of:
455
+
- the `<run-id>` for the [`run`](#command-run) command
456
+
- the `<workflow-id>` for the [`workflow`](#command-workflow) command
457
+
- the `<number>` for the [`milestone`](#command-milestone) command
458
+
459
+
Check out the `gh-fzf` author's [`~/.config/gh/config.yml`](https://github.com/benelan/dotfiles/blob/master/.config/gh/config.yml) for more inspiration.
460
+
461
+
See the [code](https://github.com/benelan/gh-fzf/blob/65bfdb81a30fc55878e04758e5cbcec68a242a18/gh-fzf#L157-L179) for the list of fzf options shared by all `gh-fzf` commands.
462
+
463
+
> [!WARNING]
464
+
> If any of the shared keybindings set by `gh-fzf` don't work, you may be overriding them in your shell's start up scripts (e.g. `~/.bashrc`) by setting the `$FZF_DEFAULT_OPTS` environment variable.
465
+
466
+
## Related projects
467
+
468
+
There is another `fzf` wrapper around `gh` that also provides some `git` functionality. However, it doesn't provide as many `gh` commands, keybindings, or configuration options.
The main focus of `gh-fzf` is providing keybindings to run `gh` subcommands on the selected item, so `git` functionality is left to other tools. The following `fzf` wrappers around `git` are good options to bridge that gap.
0 commit comments