1

Better reload logic

This commit is contained in:
Alex Yatskov 2024-04-20 12:03:24 -07:00
parent 84669de981
commit c0f5d2dfeb
3 changed files with 7 additions and 6 deletions

View File

@ -1,4 +1,4 @@
local config = require('config') local config = require('argonaut.config')
local function setup(opts, filetypes) local function setup(opts, filetypes)
config.set_filetype_opts(opts, filetypes) config.set_filetype_opts(opts, filetypes)

View File

@ -1,14 +1,15 @@
if not vim.g.argonaut then if not vim.g.argonaut then
local argonaut = require('argonaut')
local function argonaut_reload() local function argonaut_reload()
package.loaded.argonaut = nil for name, _ in pairs(package.loaded) do
argonaut = require('argonaut') if vim.startswith(name, 'argonaut') then
package.loaded[name] = nil
end
end
end end
local function argonaut_reflow() local function argonaut_reflow()
argonaut_reload() argonaut_reload()
argonaut.reflow() require('argonaut').reflow()
end end
vim.api.nvim_create_user_command('ArgonautReload', argonaut_reload, {}) vim.api.nvim_create_user_command('ArgonautReload', argonaut_reload, {})