-
Notifications
You must be signed in to change notification settings - Fork 4
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: Make it toggle to the last used repo on nvim open #11
Comments
Hey! Unfortunately this doesn't exist yet but I'm open to PRs :) |
You can make this work with vim-prosession. This automatically tracks starts and opens your sessions. However, this doesn't work out of the box. The For me the following works. I've modified the I think it would be nice to have this -- Modify change_monorepo so that it will always pick a git directory.
M.change_monorepo = function(path)
local git_repo = vim.fn.finddir(".git/..", vim.fn.fnamemodify(path, ":p:h") .. ";")
M.currentMonorepo = git_repo
utils.load()
end I've overridden the method like so, using Lazy as package manager (warning, hacky solution ;-)): return {
{
"imNel/monorepo.nvim",
config = function()
local monorepo = require("monorepo")
local utils = require("monorepo.utils")
-- Modify change_monorepo so that it will always pick a git directory.
monorepo.change_monorepo = function(path)
local git_repo = vim.fn.finddir(".git/..", vim.fn.fnamemodify(path, ":p:h") .. ";")
monorepo.currentMonorepo = git_repo
utils.load()
end
monorepo.setup()
end,
-- Required to allow the change_monorepo method to be overwritten in time.
lazy = false,
dependencies = { "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim"},
keys = {
{ "<leader>m", function() require("telescope").extensions.monorepo.monorepo() end },
{ "<leader>n", function() require("monorepo").toggle_project() end },
},
}, {
-- Open previous session
"dhruvasagar/vim-prosession",
lazy = false,
dependencies = {
"tpope/vim-obsession",
}
}
} Hope this helps! |
Is there a way to make it open in the last repo use on opening nvim? Currently it defaults to root when I open nvim. If there's no way to change that then I can offer to implement it myself and make a PR.
The text was updated successfully, but these errors were encountered: