HomePhorge

feat: split out register backend so it can be used as an external API
eb71e6bcfa29Unpublished

Unpublished Commit ยท Learn More

  • Repository Importing: This repository is still importing.
  • Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

feat: split out register backend so it can be used as an external API

Summary:

Split out the register backend function from being a private function. A
backend is a table that will define all of the attributes for a run function.
The attributes are as follows:

  • command The name of the command that will be registered as a vim user command.
  • items The callback function that will be passed to the run function that will gather the items for selection
  • callback The callback function run when an item is selected

The following are optional:

  • keymap The string passed to nvim_set_keymap, this will always be registered in normal mode
  • description The text description that will be used in the user command
  • name The name of the backend, this will fallback to the command if its not set

It will also allow to register a backend in a couple of different ways:

  • With a backend module table
  • With a backend module name
  • With a backend module name and override options

This will look for for a lua module ivy.backends.files. The module will be
required and registered as a backend.

register_backend "ivy.backends.files"

This will do the same with the module string however, before the backend is
registered the keymap will be overridden

register_backend({ "ivy.backends.file", { keymap = "<C-p>" } })

Test Plan:

CI / Manual testing locally

Details

Provenance
AdeAttwoodAuthored on Jun 16 2024, 8:44 PM
Parents
R1:4803045d4ed0: test: remove all the old tests
Branches
Unknown
Tags
Unknown

Event Timeline