-
Notifications
You must be signed in to change notification settings - Fork 20
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: Ability to switch between loaded scopes #133
Comments
I was referring to the second picture of So, for example, if I open the first picture, I'm able to enable 2 scopes for a buffer by pressing So just an API like |
Thank you for this clarification. I wasn't aware of this, but just tried it and observed the behavior you're describing. Now I understand better the resolution of ID that happens behind the scenes. With that in mind, I believe it would be good if you documented the example you provided in your previous post about the resolution of IDs. That way it falls to the user to make sure to differentiate between different IDs in the loaded scopes window. I really don't know what the best way to do it would be. I just saw that you enabled in loaded scopes window to show with The purpose of the initial post (and after you clarified about how ID resolution happens) is something like the following workflow to be achieved (if possible of course, you're the one who maintains the code and I won't be expecting all users' requested features to be catered to): |
Will make sure to update!
Yup. And if you're curious it's right here 🙂
I've made a few improvements recently to managing save files and the Loaded Scopes window (see: new keymaps in Loaded Scopes window and ---@param type "tags" | "scopes" | "loaded"
---@param direction "next" | "prev"
---@param opts? grapple.options | { name: string } | { id: string }
function Grapple.cycle(type, direction, opts)
...
end Then you could add your keybinds like: vim.keymap.set("n", "", "<cmd>Grapple cycle loaded next<cr>")
vim.keymap.set("n", "", "<cmd>Grapple cycle loaded prev<cr>") |
Thank you very much for taking time to implement this. I look forward to its completion. |
@dpetka2001 With 6c88bfd, Grapple now supports cycling through scopes. While you cannot cycle through scope IDs quite yet, you can accomplish the above workflow by hiding the scopes you do not use. For example, Hide all scopes but require("grapple").setup({
default_scopes = {
git = { shown = true },
git_branch = { shown = true },
global = { shown = true },
}
}) Cycle through the above three scopes with require("grapple").cycle_scopes("next")
require("grapple").cycle_scopes("prev") |
I know you can currently can do something like
Grapple cycle forward scope=name_of_scope
, but it would be really nice if some kind of API would be made available to the user to cycle through the loaded scopes. Maybe something likeGrapple cycle_loaded next/previous
. This way I can just set specific keymaps that cycle through my loaded scopes instead of having to specify the scope that I want to cycle through.The text was updated successfully, but these errors were encountered: