Closed damca closed 4 months ago
A few things. First, it seems the ignore_blank_lines
from the config is being ignored during setup, if I set the default to be 'false' in the source core.lua
, then the blank lines are included, and the pasting into the python repl works since the new lines are interpreted literally.
More importantly, things work fine with ipython
.
I did some reading, and it seems that there is a lot of discussion about whether the default python repl should include "bracketed paste" as a feature:
I don't know exactly what to make of all this. But perhaps the specific version of python (either built or downloaded) may or may not include bracketed paste.
If there is a simple solution I am not seeing please let me know.
@damca I was having this same issue. By using some of your links to bug reports as jumping off points, I was able to find this question (question is about Mac, but I'm on linux) which implicates newer bash readline versions with having bracketed paste on by default.
I was able to fix the issue in my Iron REPL (python v3.10.12) by adding set enable-bracketed-paste off
to my .inputrc
and restarting the REPL. I hope this helps fix your problem!
I have the same issue.
ignore_blank_lines = false
in any of the following doesn't change the behaviour:
init.lua
site/pack/packer/start/iron.nvim/lua/iron/core.lua
For example this code:
def my_func():
matches = [1, 2, 3]
for match in matches:
print(match)
Gives the following output:
In [1]:
In [1]:
In [1]: def my_func():
...: matches = [1, 2, 3]
...: for match in matches:
...: print(match)
Cell In[1], line 3
for match in matches:
^
IndentationError: unexpected indent
In [2]:
On my other laptop (Void Linux), this works with iPython not Python, on this machine (SUSE Aeon) neither works.
The following is an example that doesn't work on either machine regardless of ipython
:
I haven't been able to figure this out, for the moment, I'm using Fterm and Tmux / Zellij.
@RyanGreenup I had the same issue, got the answer from this post
So the config starts with this. The key difference being the format = require("iron.fts.common").bracketed_paste
.
That groups together the whole selected block and pastes it in in one go instead of line by line.
iron.setup {
config = {
ignore_blank_lines = true, -- ignore blank lines when sending visual select lines
-- Whether a repl should be discarded or not
scratch_repl = true,
-- Your repl definitions come here
repl_definition = {
python = {
command = "ipython",
format = require("iron.fts.common").bracketed_paste,
}
},
-- How the repl window will be displayed
-- See below for more information
repl_open_cmd = require('iron.view').bottom(40),
},
I tried slime in the interim but I was having a similar issue.
I tried the solution by @gnsiva and that seems to have solved it, although when I comment it back out the problem is entirely solved so :shrug: .
hey @damca and @RyanGreenup , I believe this issue is fixed now. Could you try updating the plugin on your end to use the latest commit to master. I was having the same issue and the last PR for this plugin addressed it. This problem no longer exists on my end.
I believe this is solved now, if this problem continues, please make another issue with an example that causes the same error.
Behavior
Sending the following with visual send command (
<space>sc
):Leads to the following error:
This error persists even if
ignore_blank_lines = false
Setup
Using NVIM v0.9.1
I placed the
iron
directory in the runtime path~/.config/nvim/lua
, for simple testing.nvim -u NORC
:lua require('mytest')