Neovim plugin to automatically adjust git env vars when syncing dotfiles using the "bare git repo" method

feat: Pulling the commands into one with args to not pollute the global namespace

Changed files
+16 -4
lua
baredot
+2 -2
README.md
··· 40 40 41 41 ## Commands 42 42 43 - - `:BaredotInfo` - Print current status 44 - - `:BaredotToggle` - Manually toggle the env vars on / off 43 + - `:Baredot info` - Print current status 44 + - `:Baredot toggle` - Manually toggle the env vars on / off 45 45 46 46 ## Functions 47 47
+14 -2
lua/baredot/commands.lua
··· 37 37 function Commands.setup(opt) 38 38 options = opt 39 39 40 - vim.api.nvim_create_user_command("BaredotInfo", Commands.info, { desc = "BaredotInfo" }) 41 - vim.api.nvim_create_user_command("BaredotToggle", Commands.toggle, { desc = "BaredotToggle" }) 40 + vim.api.nvim_create_user_command("Baredot", function(args) 41 + local cmd = vim.trim(args.args or "") 42 + if cmd == "toggle" then 43 + Commands.toggle() 44 + else 45 + Commands.info() 46 + end 47 + end, { 48 + desc = "Baredot", 49 + nargs = "?", 50 + complete = function() 51 + return { "info", "toggle" } 52 + end 53 + }) 42 54 end 43 55 44 56 return Commands