nvim/lua/plugins/treesj.lua

20 lines
593 B
Lua

return {
"Wansmer/treesj",
dependencies = { "nvim-treesitter/nvim-treesitter" },
cmd = { "TSJToggle", "TSJJoin", "TSJSplit" },
keys = {
{ "J", "<cmd>TSJToggle<cr>", desc = "Toggle Treesitter Join" },
{ "<space>tj", "<cmd>TSJJoin<cr>", desc = "Treesitter Join" },
{ "<space>ts", "<cmd>TSJSplit<cr>", desc = "Treesitter Split" },
},
config = function()
require("treesj").setup({
use_default_keymaps = false,
on_error = function(err_text, level)
if not err_text:find("splitted") then
vim.cmd.join()
end
end,
})
end,
}