A Treesitter-based, Turbo Console Log-inspired, lua-written, NeoVim plugin.
Makes debugging easier by automating the process of writting log messages.
With packer:
use {"gaelph/logsitter", requires = {"nvim-treesitter/nvim-treesitter"}}
* Javascript/Typescript (`console.log()`)
* Golang (`fmt.Println("... %+v\n", ...)`)
* Lua (`print()`)
lua:
vim.api.nvim_create_augroup("LogSitter", { clear = true })
vim.api.nvim_create_autocmd("FileType", {
group = "Logsitter",
pattern = "javascript,go,lua",
callback = function()
vim.keymap.set("n", "<localleader>lg", function()
require("logsitter").log()
end)
end,
})
There is also a lua function:
require("logsitter").log()
To use Logsitter with other file types:
-- This can go in after/ftplugin/svelte.lua
local logsitter = require("logsitter")
local javascript_logger = require("logsitter.lang.javascript")
-- tell logsitter to use the javascript_logger when the filetype is svelte
logsitter.register(javascript_logger, { "svelte" })
vim.keymap.set("n", "<localleader>lg", function()
logsitter.log()
end)
MIT