Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Nov 9, 2023

Conversation

benelan
Copy link
Contributor

@benelan benelan commented Nov 6, 2023

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!

Copy link
Owner

@pwntester pwntester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Can you please apply similar changes to fzf-lua picker provider?

@benelan
Copy link
Contributor Author

benelan commented Nov 9, 2023

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!

@benelan benelan requested a review from pwntester November 9, 2023 07:01
@pwntester
Copy link
Owner

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

@benelan
Copy link
Contributor Author

benelan commented Nov 9, 2023

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 pwntester merged commit 154721c into pwntester:master Nov 9, 2023
2 checks passed
@pwntester
Copy link
Owner

Thanks a lot!

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.

Feature Request: add config options to change picker mappings
2 participants