-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Treesitter textobjects #210
Comments
This would definitely be an amazing addition.. I'll have a look at it and will try to come up with something workable :) |
I use succesfully the following snippet. local is = require("nvim-treesitter.incremental_selection")
local function treesitter_selection()
is.init_selection()
is.node_incremental()
end
require("iron").core.visual_send(vim.bo.ft, treesitter_selection) |
I might be mistaken, but it seems that |
Not entirely sure this is needed at repl level given searching / selecting treesitter object is a non-trivial task and can be used beyond the scope of repl. This is actually implemented neatly by motion plugins: Some simple keymap would achieve what is requested. e..g, vim.keymap.set(
{ "n" },
"gt",
function()
vim.cmd('normal V')
require("leap.treesitter").select()
require("iron.core").visual_send()
vim.cmd("norm! j")
end,
{ desc = "send treesitter textobj" }
)
In my opinion, we could simply update the |
I was thinking about sending the output of a treesitter.textobjects command to irons REPL but I fear my lua skills aren't there yet.
I tried this
:lua require('iron').core.send(vim.bo.ft, require'nvim-treesitter.textobjects.select'.select_textobject('@function.outer', 'o'))
and this
require("iron").core.visual_send(vim.bo.ft, require'nvim-treesitter.textobjects.select'.select_textobject('@function.outer', 'o'))
without success and I dont really understand whats meant with "data" in the documentation, help about this would be appreciated.
If it is feasible it would be nice to have native support for treesitter objects :)
The text was updated successfully, but these errors were encountered: