-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
Unable to send a cell to repl #333
Comments
I just test the setting and it works fine. Maybe can need to figure out what is your problem. The textobj and the ]x command just works fine. I guess you may miss the lua config of iron.nvim, you need use that config instead of the default config. Or you can change the mapping of ]x. |
Hi Meicale,
|
I think you use this to run python code, so that you need using command = {"ipython"} and install ipython in your machine. I recommend that you just double check the blog related to your config. |
I implemented my own function to send code chunk to REPL and it works fine. |
@weiyshay use :help text-objects *v_at* *at*
at "a tag block", select [count] tag blocks, from the
[count]'th unmatched "<aaa>" backwards to the matching
"</aaa>", including the "<aaa>" and "</aaa>".
See |tag-blocks| about the details.
When used in Visual mode it is made charwise.
*v_it* *it*
it "inner tag block", select [count] tag blocks, from the
[count]'th unmatched "<aaa>" backwards to the matching
"</aaa>", excluding the "<aaa>" and "</aaa>".
See |tag-blocks| about the details.
When used in Visual mode it is made charwise.
Tag blocks *tag-blocks*
For the "it" and "at" text objects an attempt is done to select blocks between
matching tags for HTML and XML. But since these are not completely compatible
there are a few restrictions.
The normal method is to select a <tag> until the matching </tag>. For "at"
the tags are included, for "it" they are excluded. But when "it" is repeated
the tags will be included (otherwise nothing would change). Also, "it" used
on a tag block with no contents will select the leading tag. you can remap : e.g.: # <cell>
a = 10
b = 20
c = 30
# </cell> |
My take using vimscript to achieve something similar. I mapped in visual mode to send code and move down. and let g:CodeFence = "###"
function! IsLineIndented()
let lineContent = getline('.')
if match(lineContent, ' ') == 0
return 1
else
return 0
endif
endfunction
function! IsFence()
return getline('.') == g:CodeFence
endfunction!
function! BuildFence()
exe "normal Go".g:CodeFence
if IsLineIndented()
normal 0dt#
endif
endfunction
function! OpenCell() abort
let cmd = 'normal *kV``jo'
execute cmd
endfunction
function! CloseCell() abort
let cmd = 'normal #jV``'
execute cmd
normal -
endfunction
" nnoremap <leader>cc :call CloseCell()<cr>
function! BetweenCell() abort
let Start = line(".")
let End = search('^'.g:CodeFence, 'Wbs')
normal +
if Start - End == 1
normal V
else
normal V''
endif
endfunction
function! SelectVisual() abort
if search('^'.g:CodeFence, 'W') == 0
call BuildFence()
call CloseCell()
else
normal -
call BetweenCell()
endif
endfunction
nmap \\ :call SelectVisual()<cr><cr>
keymap in lua vim.keymap.set("v", "<CR>", function()
iron.visual_send()
vim.cmd("norm! j")
end, { buffer = args.buf, desc = "repl_v_send" }) |
Hi,
Thanks for this awesome plugin and I am really enjoying it.
Current I am able to send code to the repl via motion command(j,k, etc) which is very convenient.
It will be nice if I can send a cell to repl and jump to the next automatically. I searched around and found that these plugins
which seems good for me but failed to make it.
I am able to jump between cells using the shortcuts defined in vim-textobj-hydrogen .
The problem is that I am not able to send the cell to repl with shortcuts defined in the below config:
I am using nvim stable 0.8.3 and all the latest plugins by today(2023/4/17). Appreciate your feedback on if it is a configuration issue or how I can debug it.
The text was updated successfully, but these errors were encountered: