From 47d2bbcf5994f3ec2fd52d44dd5d0cfe112f4104 Mon Sep 17 00:00:00 2001 From: Ajay Mamtora <45173937+Ajaymamtora@users.noreply.github.com> Date: Mon, 5 Aug 2024 22:45:54 +0100 Subject: [PATCH 1/2] Callback on live reload --- lua/neoconf/commands.lua | 1 + lua/neoconf/config.lua | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lua/neoconf/commands.lua b/lua/neoconf/commands.lua index bb70686a..7e40d6bf 100644 --- a/lua/neoconf/commands.lua +++ b/lua/neoconf/commands.lua @@ -51,6 +51,7 @@ function M.setup() pattern = Util.file_patterns({ autocmd = true }), group = group, callback = function(event) + pcall(Config.options.on_write, event) local fname = Util.fqn(event.match) -- clear cached settings for this file Settings.clear(fname) diff --git a/lua/neoconf/config.lua b/lua/neoconf/config.lua index 11d54191..11b6d069 100644 --- a/lua/neoconf/config.lua +++ b/lua/neoconf/config.lua @@ -2,6 +2,8 @@ local M = {} ---@class Config M.defaults = { + -- on_write callback + on_write = function() end, -- name of the local settings files local_settings = ".neoconf.json", -- name of the global settings file in your Neovim config directory From 960f9526934abcd1817d34e35f164564a337147b Mon Sep 17 00:00:00 2001 From: Ajay Mamtora <45173937+Ajaymamtora@users.noreply.github.com> Date: Sat, 24 Aug 2024 17:57:45 +0100 Subject: [PATCH 2/2] Callback on live reload --- lua/neoconf/config.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/neoconf/config.lua b/lua/neoconf/config.lua index 11b6d069..701ad8dc 100644 --- a/lua/neoconf/config.lua +++ b/lua/neoconf/config.lua @@ -2,8 +2,8 @@ local M = {} ---@class Config M.defaults = { - -- on_write callback - on_write = function() end, + -- Callback for when a setting is changes in local or global settings + -- on_write = function(event) end, -- name of the local settings files local_settings = ".neoconf.json", -- name of the global settings file in your Neovim config directory