Source A File Every Time It's Saved In Neovim
This is what I'm using when I'm working on Lua script for Neovim. It sources/reloads the file every time I save it.
NOTE: THIS ISN"T CURRNET WORKING
Code
function start_source_buffer_on_save()
print("Activated start_source_buffer_on_save")
vim.api.nvim_create_autocmd("BufWritePost", {
group = vim.api.nvim_create_augroup("AutoRunCurrentFile", { clear = true }),
pattern = vim.api.nvim_buf_get_name(0),
callback = function()
vim.cmd("so %")
-- print("got save")
end,
})
end
start_source_buffer_on_save()
Super handy little chunk of code