Closed snoblenet closed 2 weeks ago
Maybe... I'm curious why you would want this?
The current workspace file is very dumb (simple) and uses null bytes to separate data
Thanks.
I'm currently using Telescope's default project manager and I'm finding it's too easy to create duplicate projects and delete projects by accident when commands to do both are tied to keybindings.
And it's too tedious to then go manually looking up the key bindings to delete the accidental duplicates and reinstate the accidental deletions.
If I could just set a local project_roots = { 'root/address/1', 'root/address/2', 'etc' }
in my /lua/plugins/workspace.lua
, that would be brilliant.
I might (??) just define something quick in Telescope myself and use it to read the project local justfile
etc.
But piggybacking on some else's great work is usually better.
Hmm. Well workspaces doesn't do anything automatically. And (at least to me) having to type :WorkspacesAdd
is manual enough that I don't think it would be easy to make a duplicate or delete by accident. Have you tried this plugin as-is yet?
I don't think I want to add/extend this plugin, but if you aren't satisfied with the current behavior, it wouldn't be a ton of work to remove all the commands and then make it sync the list of workspaces with a project_roots
variable
I've found I can achieve what I want by checking in the workspace data file as part of my dotfiles and then editing it manually when desired.
local path = os.getenv('HOME') .. '/code/dotfiles/workspaces/data'
return {
"natecraddock/workspaces.nvim",
config = function()
require('workspaces').setup({
path = path
})
local workspaces_group = {
{ '<leader>w', group = 'Workspaces' },
{ '<leader>wa', ':WorkspacesAdd<CR>', desc = 'Add' },
{ '<leader>we', (':vs<CR>:edit ' .. path .. '<CR>'), desc = 'Edit' },
{ '<leader>wr', ':WorkspacesRemove<CR>', desc = 'Remove' },
}
local wk = require('which-key')
wk.add(workspaces_group)
end
}
Glad to hear you found a good solution!
Would it be practical to configure workspaces.nvim to disable all
:WorkspaceAdd
etc type commands and to read its list of workspace names and root paths from a file that is maintained by hand?