config/user/.config/nvim/lua/priv/autocmd.lua
2024-07-24 18:38:20 -04:00

11 lines
332 B
Lua

vim.api.nvim_create_autocmd("BufWritePost", {
pattern = "email-list.md",
callback = function ()
local infile = vim.fn.expand('%:p')
local outfile = os.getenv("HOME") .. '/docs/notes/harc/emails/raw-list.md'
local command = string.format("grep -o '[^ ^ ]*@[^ ^ ]*' %s > %s", infile, outfile)
os.execute(command)
end,
})