refactor: use vim.g config and lazy loading

Replace setup() with vim.g.live_server configuration. Add plugin/ file
with load guard and user commands for proper lazy loading.
This commit is contained in:
Barrett Ruth 2026-02-03 20:13:12 -05:00
parent 58f2e30e02
commit af7255b0a0
2 changed files with 124 additions and 123 deletions

16
plugin/live-server.lua Normal file
View file

@ -0,0 +1,16 @@
if vim.g.loaded_live_server then
return
end
vim.g.loaded_live_server = 1
vim.api.nvim_create_user_command('LiveServerStart', function(opts)
require('live-server').start(opts.args)
end, { nargs = '?' })
vim.api.nvim_create_user_command('LiveServerStop', function(opts)
require('live-server').stop(opts.args)
end, { nargs = '?' })
vim.api.nvim_create_user_command('LiveServerToggle', function(opts)
require('live-server').toggle(opts.args)
end, { nargs = '?' })