projectmgr.nvim
projectmgr.nvim copied to clipboard
Question: Startup/Shutdown Confusion
hello, I'm using projectmgr under AstroVim as a recent emacs convert. I'm trying to configure such that whatever buffers I have open are first saved and then closed before switching to the new project, which will open whatever files had been open in that session before. Then, if I switch back to the previous project, current state is saved, cleared and state from old project is restored.
Is this possible? I'm trying to simulate the concept of emacs "workspaces" essentially and would appreciate any help you can provide for how to do this. Thank you.
Hi! Just to make sure I'm understanding correctly, the idea is that
- you have project A open and there are unsaved files
- you open project B through projectmgr, which should
- save all open buffers from project A
- close all open buffers from project A
- open the buffers that were left open the last time you exited project B
correct?
If so, then apart from saving the buffers, this is exactly what projectmgr does. As for saving, it wouldn't be hard to add the functionality to projectmgr (feel free to open a PR or let me know of you need help with that!), or alternatively, use something like pocco81/auto-save.nvim which will autosave your buffer any time you leave insert mode (can recommend).
Thank you for your reply and sorry for not noticing you had replied earlier. I don't mind having to remember to save files in project A before switching out to project B. The behavior I see, though, is that after switching to project B, the buffers from project A are still open and show in tabs across the top. I must be missing something. Is there any config you can share with me to put in my lua/users/plugins folder to override whatever I have in there now so that this behavior works? Thanks again for your help and hope not too much trouble.
Thank you for your reply and sorry for not noticing you had replied earlier. I don't mind having to remember to save files in project A before switching out to project B. The behavior I see, though, is that after switching to project B, the buffers from project A are still open and show in tabs across the top. I must be missing something. Is there any config you can share with me to put in my lua/users/plugins folder to override whatever I have in there now so that this behavior works? Thanks again for your help and hope not too much trouble.
I see, that is strange indeed!
Quick question, do you happen to cd
out of your project directory at some point before closing the project / opening another project? If so that is the reason. If not - are you perhaps on WIndows? I have not been able to test this on Windows, and it could be that the path comparison projectmgr does fails there.
Hello, I am on Mac, and I see the same behavior as described by @mrjbj. I use Neovide, but I see the same behavior with Neovim in the terminal.
Hello, I am on Mac, and I see the same behavior as described by @mrjbj. I use Neovide, but I see the same behavior with Neovim in the terminal.
Alright, thanks for chiming in, I guess I have some bug hunting to do 😄
I'm quite the beginner, so there is a high likelyhood of my config being incorrectly set to be honest. If you could provide a detailed install procedure on lazy.nvim (nvChad) I'd be happy to reset and see if that helps. Good luck. Tell me if I can do anything.
I'm quite the beginner, so there is a high likelyhood of my config being incorrectly set to be honest. If you could provide a detailed install procedure on lazy.nvim (nvChad) I'd be happy to reset and see if that helps. Good luck. Tell me if I can do anything.
{
"charludo/projectmgr.nvim",
lazy = false,
config = function()
require("projectmgr").setup {
autogit = {
enabled = false,
},
reopen = true,
}
end,
},
This is the relevant excerpt from my plugins.lua
, also using NvChad
😄 It's probably not a config thing though, since opening/closing is not configurable AFAIK.
Well that fixed my issues nicely. ^^ Thank you very much.
Well that fixed my issues nicely. ^^ Thank you very much.
It did? Great to hear, but could you post your previous config so I can take a look what might have gone wrong? 😅
I actually didn’t configured anything more than :
{ "charludo/projectmgr.nvim", lazy = false, -- important! },
I'm guessing the reopen = true
is what helped.
I still get this error:
"fuzz.py" 116L, 3720B Error detected while processing VimEnter Autocommands for E5108: Error executing Lua ... hare/nvim/Lazy/projectmgr.nvim/Lua/projectmgr/manage.Lua:25: VimEnter Autocommands for "*"… script /Users/Haller/projects/fuzz/Session.vim, line 21: Vim(edit): E325: ATTEN TION stack traceback: [C]: in function 'nvim_command' … hare/nvim/Lazy/projectmgr.nvim/Lua/projectmgr/manage.Lua:25: in function 'open_project' …/share/nvim/lazy/projectmgr.nvim/Lua/projectmgr/init.lua:47: in function'startup' [string ":tua"]:1: in main chunk Press ENTER or tvDe command to continue
I actually didn’t configured anything more than :
{ "charludo/projectmgr.nvim", lazy = false, -- important! },
I'm guessing the
reopen = true
is what helped.I still get this error:
"fuzz.py" 116L, 3720B Error detected while processing VimEnter Autocommands for E5108: Error executing Lua ... hare/nvim/Lazy/projectmgr.nvim/Lua/projectmgr/manage.Lua:25: VimEnter Autocommands for "*"… script /Users/Haller/projects/fuzz/Session.vim, line 21: Vim(edit): E325: ATTEN TION stack traceback: [C]: in function 'nvim_command' … hare/nvim/Lazy/projectmgr.nvim/Lua/projectmgr/manage.Lua:25: in function 'open_project' …/share/nvim/lazy/projectmgr.nvim/Lua/projectmgr/init.lua:47: in function'startup' [string ":tua"]:1: in main chunk Press ENTER or tvDe command to continue
Thanks for letting me know! I'll have a look into both issues.