ziontee113 / syntax-tree-surfer

A plugin for Neovim that helps you surf through your document and move elements around using the nvim-treesitter API.
MIT License
469 stars 9 forks source link

Surfing/Moving nodes in visual mode creates newlines #8

Closed bjornevik closed 2 years ago

bjornevik commented 2 years ago

Neovim version: NVIM v0.8.0-dev-2225-gb8dcbcc73

Minimal init.lua

require("syntax-tree-surfer").setup()
local opts = { noremap = true, silent = true }

-- Select Nodes in Visual Mode
vim.keymap.set("x", "J", "<cmd>STSSelectNextSiblingNode<cr>", opts)
vim.keymap.set("x", "K", "<cmd>STSSelectPrevSiblingNode<cr>", opts)
vim.keymap.set("x", "H", "<cmd>STSSelectParentNode<cr>", opts)
vim.keymap.set("x", "L", "<cmd>STSSelectChildNode<cr>", opts)

-- Swapping Nodes in Visual Mode
vim.keymap.set("x", "<A-j>", "<cmd>STSSwapNextVisual<cr>", opts)
vim.keymap.set("x", "<A-k>", "<cmd>STSSwapPrevVisual<cr>", opts)

t-rec

ziontee113 commented 2 years ago

Thank you @bjornevik for opening the issue. This was caused by a recent change in nvim-treesitter utils module. The issue should be fixed by now. Please update your plugin.

If any other issues show up, please let me know. Thank you :)

bjornevik commented 2 years ago

Updated plugin and works as expected 😄 Thanks.