Setting custom scopes #121
-
Just found out this plugin and just experimenting with its options at the moment. I was just playing with the 2 examples provided in the Scopes API docs and tried the following configuration. return {
{
"cbochs/grapple.nvim",
cmd = "Grapple",
opts = {
scopes = {
{
name = "projects",
desc = "Project directory",
-- fallback = "cwd",
-- cache = { event = "DirChanged" },
resolver = function()
local projects_dir = vim.fs.find("projects", {
upwards = true,
stop = vim.loop.os_homedir(),
})
if #projects_dir == 0 then
return nil, nil, "Not in projects dir"
end
local path = projects_dir[1]
local id = path
return id, path, nil
end,
},
},
},
-- opts = function()
-- require("grapple").define_scope({
-- name = "projects",
-- desc = "Project directory",
-- -- fallback = "cwd",
-- -- cache = { event = "DirChanged" },
-- resolver = function()
-- local projects_dir = vim.fs.find("projects", {
-- upwards = true,
-- stop = vim.loop.os_homedir(),
-- })
--
-- if #projects_dir == 0 then
-- return nil, nil, "Not in projects dir"
-- end
--
-- local path = projects_dir[1]
-- local id = path
-- return id, path, nil
-- end,
-- })
-- end,
},
} According to the docs, I should be able to define user's custom scopes during the setup in the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hmm... I'm not entirely certain when that broke, but looks like it was a small typo in the Grapple.setup. Should be fixed in c2c6cbf Thanks! |
Beta Was this translation helpful? Give feedback.
-
Thank you very much. I have one more question regarding scopes (maybe I missed it in the docs not sure). Are users able to delete the default scopes provided by the plugin? |
Beta Was this translation helpful? Give feedback.
Hmm... I'm not entirely certain when that broke, but looks like it was a small typo in the Grapple.setup. Should be fixed in c2c6cbf
Thanks!