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

[Feature] Specify per-request hooks #47

Closed
williamboman opened this issue Apr 11, 2023 · 1 comment · Fixed by #48
Closed

[Feature] Specify per-request hooks #47

williamboman opened this issue Apr 11, 2023 · 1 comment · Fixed by #48

Comments

@williamboman
Copy link
Contributor

Hey! I'd like to be able to provide custom hooks on a per-request basis. An example of this would be to create a keymap to only view references within the current buffer, for which I'd exclude any items whose bufnr != current_bufnr. I was not able to find a way to make this work currently.

What I had in mind was adding a 2nd parameter to .open(method, opts), like so:

require("glance").open("references", {
  hooks = {
     before_open = function (results, open, jump, method)
         -- filter results and open()
     end,
  }
})

I'd be happy to contribute with a PR if you think the above approach would make sense.

williamboman added a commit to williamboman/glance.nvim that referenced this issue Apr 11, 2023
@williamboman
Copy link
Contributor Author

I decided to take a stab at implementing this for local use, see #48.

williamboman added a commit to williamboman/glance.nvim that referenced this issue Apr 11, 2023
@DNLHC DNLHC closed this as completed in #48 Apr 13, 2023
DNLHC pushed a commit that referenced this issue Apr 13, 2023
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 a pull request may close this issue.

1 participant