reload.lua formatting and comments
This commit is contained in:
1 parent
b2b8e5f539
commit
456f03e4eb
1 file changed
+4
-6
@@ -3,13 +3,13 @@ local u = require 'config.utils'.load
|
|||||||
local g
|
local g
|
||||||
vim.api.nvim_create_augroup('reload', {})
|
vim.api.nvim_create_augroup('reload', {})
|
||||||
|
|
||||||
-- reload these files when written to
|
|
||||||
|
|
||||||
--- @param arg {file: string}
|
--- @param arg {file: string}
|
||||||
local reload_file = function(arg)
|
local reload_file = function(arg)
|
||||||
u.reload(u.path_for(arg.file))
|
u.reload(u.path_for(arg.file))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- reload these files when written to
|
||||||
|
|
||||||
for _, path in ipairs({
|
for _, path in ipairs({
|
||||||
'reload.lua',
|
'reload.lua',
|
||||||
'settings.lua',
|
'settings.lua',
|
||||||
@@ -18,10 +18,6 @@ for _, path in ipairs({
|
|||||||
'theme.lua',
|
'theme.lua',
|
||||||
}) do u.post_write(g, path, reload_file) end
|
}) do u.post_write(g, path, reload_file) end
|
||||||
|
|
||||||
-- allows you to install / clean / update plugins
|
|
||||||
-- after writing to the file
|
|
||||||
|
|
||||||
---
|
|
||||||
--- @param arg {file: string}
|
--- @param arg {file: string}
|
||||||
local update_plugins = function(arg)
|
local update_plugins = function(arg)
|
||||||
-- unload the file if it's not plugins.lua
|
-- unload the file if it's not plugins.lua
|
||||||
@@ -34,5 +30,7 @@ local update_plugins = function(arg)
|
|||||||
require 'packer'.compile()
|
require 'packer'.compile()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- reload plugin files when written to
|
||||||
|
|
||||||
u.post_write(g, 'plugins.lua', update_plugins)
|
u.post_write(g, 'plugins.lua', update_plugins)
|
||||||
u.post_write(g, 'plugins/*', update_plugins)
|
u.post_write(g, 'plugins/*', update_plugins)
|
||||||
Reference in new issue
Block a user