nvim plugin written in lua to help with debugging. this is inspired by the popular vscode extension turbo console log, for javascript, lua and python.
the main functionality is to insert meaningful print statements automatically.
the print statement is formatted as
- file name -> line number -> variable
if you have nvim navic installed, breadcrumbs to your function are additionally added:
- file name -> line number -> breadcrumbs -> variable
Packer:
use 'PatschD/zippy.nvim'
vim.keymap.set("n", "<leader>lg", "<cmd>lua require('zippy').insert_print()<CR>")
if you are happy with the defaults, nothing has to be configured.
otherwise two options can be configured:
- formatting:
as lua, javascript and python are quite different (indentations, newlines), zippy.nvim focuses on creating valid code, then calls the lsp to format. this can be disabled, performed only on the affected rows or perfomed globally. Not all formatters can format only a certain range (such as black for python)
- print function: if you have a custom print function you can pass that instead.
require("zippy").setup({
["lua"] = {
language_format_behaviour = "none",
print_function = "print",
},
["typescriptreact"] = {
print_function = "console.warn",
}
})