-
Notifications
You must be signed in to change notification settings - Fork 4
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
[feature request] send within treesitter node #1
Comments
This is a cool feature I would be excited to see! However, instead of making it a dedicated feature such that it can only be used with Example of using treesitter to get text objects: nvim-treesitter-textobjects I also have a hard coded, non intelligent implementation for I would be excited to see that we can use treesitter to create a syntax aware code cell text object! |
Is there a function to directly give the text that should be send to |
Could you please check if #2 works for you? |
I just made a change to the function signature ---@param id number the id of the repl,
---@param name string|nil the name of the closest repl that will try to find
---@param bufnr number|nil the buffer number from which to find the attached REPL.
---@param strings table[string] a list of strings
---@param use_formatter boolean|nil whether use formatter (e.g. bracketed_pasting)? Default: true
-- Send a list of strings to the repl specified by `id` and `name` and `bufnr`.
-- If `id` is 0, then will try to find the REPL that `bufnr` is attached to, if
-- not find, will use `id = 1`. If `name` is not nil or not an empty string,
-- then will try to find the REPL with `name` relative to `id`. If `bufnr` is
-- nil or `bufnr` = 0, will find the REPL that current buffer is attached to.
M._send_strings = function(id, name, bufnr, strings, use_formatter) |
Very cool plugin! I would love to integrate this further with quarto-nvim such as using it for QuartoSendAbove etc. instead of the current
vim-slime
plugin.I'm about to merge a cool addition to otter.nvim to use treesitter injections to query code chunks, meaning there won't be a need to define a custom query for every filetype (jmbuhr/otter.nvim#39).
What I found there might be usefull here as well. In
injections.scm
the captures that belong to file types with code chunks (such as markdown, quarto, orgmode) always have a caputure_lang
that contains the code language and@content
that contains the code of the chunk. That means getting the@content
capture in which the cursor is will always get the code that should be send to the REPL and could be made even cooler if the type of REPL to send to would depend on_lang
i.e. send R code to R REPL and python code to ipython.I still have to do some cleaning up on the otter.nvim PR, but the code of this function might be helpful here:
https://github.com/jmbuhr/otter.nvim/blob/79632759085aa1f3165454811767f4717ab04114/lua/otter/keeper.lua#L26 as well as https://github.com/jmbuhr/otter.nvim/blob/79632759085aa1f3165454811767f4717ab04114/lua/otter/tools/functions.lua#L70
The text was updated successfully, but these errors were encountered: