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, })