From 04013cf7f0818e10b6400cc4217494add6dacbde Mon Sep 17 00:00:00 2001 From: Yiyang Wu Date: Tue, 27 Jan 2026 17:23:13 +0800 Subject: [PATCH 1/3] Fix ipython 8 indentation issue: add backspace like version <7.1 MWE: def a(b): if b > 0: return 10 else : return 5 Similar-to: https://github.com/sillybun/vim-repl/issues/156 --- pythonx/formatpythoncode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pythonx/formatpythoncode.py b/pythonx/formatpythoncode.py index 1230127..d920609 100644 --- a/pythonx/formatpythoncode.py +++ b/pythonx/formatpythoncode.py @@ -266,7 +266,7 @@ def AutoStop(line): elif self.replprogram == "ipython": version = Version(self.version) # print(f'{version=}, {self.version=}') - if version >= Version('7.1'): + if version >= Version('7.1') or version <= Version('8.0'): return False if line.startswith("pass ") or line.startswith("return ") or line.startswith("raise ") or line.startswith("continue ") or line.startswith("break "): return True From ff58efe2c59f4e50c4244d0f706999fa822fb4d3 Mon Sep 17 00:00:00 2001 From: Yiyang Wu Date: Fri, 30 Jan 2026 14:54:12 +0800 Subject: [PATCH 2/3] Fix repl sending if-else block in visual selection But line-by-line send is still not working Generated by chatgpt-5.2-codex high --- autoload/repl.vim | 3 ++- pythonx/formatpythoncode.py | 9 ++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/autoload/repl.vim b/autoload/repl.vim index 01aa878..388e879 100644 --- a/autoload/repl.vim +++ b/autoload/repl.vim @@ -554,7 +554,8 @@ function! repl#SendCurrentLine() endif endif if repl#REPLGetShortName() ==# "ipython" - call repl#Sends(repl#ToREPLPythonCode([l:code_tobe_sent], 'ipython'), ['\.\.\.', 'In']) + let l:code_line = substitute(l:code_tobe_sent, '\r\?\n$', '', '') + call repl#Sends([l:code_line], ['\.\.\.', 'In']) else call term_sendkeys(repl#GetConsoleName(), l:code_tobe_sent) endif diff --git a/pythonx/formatpythoncode.py b/pythonx/formatpythoncode.py index d920609..a4008a9 100644 --- a/pythonx/formatpythoncode.py +++ b/pythonx/formatpythoncode.py @@ -222,13 +222,12 @@ def canbestartofblock(self, index): if not self.isstartofline(index): return False line = self.rawcontents[index].strip() - if line.startswith("else:"): + compact = "".join(line.split()) + if line.startswith("else") and compact.startswith("else:"): return False - elif line.startswith("except "): + elif line.startswith("except ") or (line.startswith("except") and compact.startswith("except:")): return False - elif line.startswith("except:"): - return False - elif line.startswith("elif "): + elif line.startswith("elif ") or (line.startswith("elif") and compact.startswith("elif:")): return False else: return True From f733dba45f9eaa4e58b2d930c8adfd6765b8befd Mon Sep 17 00:00:00 2001 From: Yiyang Wu Date: Wed, 11 Feb 2026 10:34:55 +0800 Subject: [PATCH 3/3] Recognize jupyter console as corresponding name --- autoload/repl.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/autoload/repl.vim b/autoload/repl.vim index 388e879..2327473 100644 --- a/autoload/repl.vim +++ b/autoload/repl.vim @@ -142,6 +142,12 @@ function! repl#REPLGetShortName() return 'ipython' elseif l:temp ==# 'ipython3' return 'ipython' + elseif stridx(l:name, '--kernel=') != -1 + if stridx(l:name, '--kernel=python') != -1 + return 'ipython' + else + return 'R' + endif elseif l:temp =~# '.*python.*' return 'python' else