Skip to content

Instantly share code, notes, and snippets.

@hem-brahmbhatt
Created October 22, 2022 17:27
Show Gist options
  • Save hem-brahmbhatt/7f8f946554e9ae28e7273505873af537 to your computer and use it in GitHub Desktop.
Save hem-brahmbhatt/7f8f946554e9ae28e7273505873af537 to your computer and use it in GitHub Desktop.
Print or log to a file in lua using standard lib
-- Log the pattern matching result to a file
logfile = io.open("/tmp/nvim.log", "a")
io.output(logfile)
for _, ignored_buffer in ipairs(config.buffers.ignored_buffers or {}) do
io.write("bufname: "..bufname.."\n")
io.write("ignored-buffer-regex: "..ignored_buffer.."\n")
io.write("match: ", string.match(bufname, ignored_buffer) and "yes" or "no", "\n")
io.write("\n")
if string.match(bufname, ignored_buffer) then
ignored = true
end
end
io.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment