pwntester / octo.nvim

Edit and review GitHub issues and pull requests from the comfort of your favorite editor
MIT License
2.25k stars 124 forks source link

feat(picker): add config options for changing mappings #448

Closed benelan closed 8 months ago

benelan commented 8 months ago

Describe what this PR does / why we need it

Adds config options to change the telescope or fzf-lua mappings.

Does this pull request fix one issue?

Fixes #447

Describe how you did it

I added the the config options and used them in the telescope and fzf-lua picker code. I added a util, along with spec tests, that converts vim style mappings to fzf ones.

Describe how to verify it

  1. Change pwntester/octo.nvim to benelan/octo.nvim in your Neovim plugin config
  2. Add the following to your Octo config

    picker_config = {
      mappings = {
        open_in_browser = { lhs = "<M-b>", desc = "open issue in browser" },
        copy_url = { lhs = "<M-y>", desc = "copy url to system clipboard" },
        checkout_pr = { lhs = "<M-o>", desc = "checkout pull request" },
        merge_pr = { lhs = "<M-r>", desc = "merge pull request" },
      },
    },
  3. Open an Octo telescope or fzf-lua picker, e.g. Octo pr list
  4. Verify that the mappings are triggered with alt instead of ctrl (which is the default)

Special notes for reviews

The desc property isn't used, but I added it to match the format of the other mappings in the config. Plus, Telescope may add the ability to use the desc for <C-/> some day.

Let me know if you'd like me to change anything about the config options I added, thanks for the review!

benelan commented 8 months ago

Thanks for the review. I added a util to convert vim style mappings to fzf ones and the spec tests I added are passing. I also installed fzf-lua and everything is working correctly. Let me know if any other changes are required!

pwntester commented 8 months ago

Thanks, that looks great! Can you please fix the linter errors?

benelan commented 8 months ago

Woops, sorry about that. I also had to move the util for converting the mappings to the main util module because fzf-lua is not installed for the tests. Everything should be passing now!

pwntester commented 8 months ago

Thanks a lot!