Skip to content

Enable hints for custom commands - #6084

Open
jamielife wants to merge 1 commit into
jesseduffield:masterfrom
jamielife:display-hint-custom-commands
Open

jamielife wants to merge 1 commit into
jesseduffield:masterfrom
jamielife:display-hint-custom-commands

Conversation

@jamielife

Copy link
Copy Markdown

PR Description

Custom commands can now opt into a keybinding hint in the panel footer, like built-in keybindings:

customCommands:
  - key: 'x'
    command: 'git fetch'
    context: 'global'
    description: 'Fetch'
    displayHint: true    # new: shows this command's hint in the panel footer

When displayHint is true, a hint labelled with the command's description (falling back to the command itself) is shown in the footer of the panels where the command's context is active.

The hint logic mirrors dispatch:

  • View-scoped commands show their hint in their own view, ahead of the view's built-in hints; on a key conflict the view-scoped hint wins.
  • Global commands show their hint in every view, except when the key is claimed by an enabled view-scoped binding there (that binding wins in dispatch), and they shadow a built-in global binding on the same key.
  • Hints are hidden while the search input is focused, since custom commands aren't dispatched there either.

Notes:

  • Config validation rejects displayHint on command menu entries. Only standalone commands that do not have a commandMenu may carry a hint.
  • Custom command bindings are now built once per keybinding reset instead of on every footer render.
  • Integration test custom_commands/global_context covers both scopes, the shadowing case, and search suppression; config validation has unit tests for the new rejection.

Please check if the PR fulfills these requirements

  • Cheatsheets are up-to-date (run go generate ./...)
  • Code has been formatted (see here)
  • Tests have been added/updated (see here for the integration test guide)
  • Text is internationalised (see here)
  • If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
  • Docs have been updated if necessary
  • You've read through your own file changes for silly mistakes etc.

Opening this for visibility per the contributing guide, happy for anyone to pull it into their fork.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant