jpalardy / vim-slime

A vim plugin to give you some slime. (Emacs)
http://technotales.wordpress.com/2007/10/03/like-slime-for-vim/
MIT License
1.83k stars 223 forks source link

IndentationError: unindent does not match any outer indentation level #358

Open lispercat opened 1 year ago

lispercat commented 1 year ago

I am having this issue in neovim v0.8.1 using neovim terminal using jupyter-console (Jupyter console 6.4.4, IPython 8.8.0 with Python 3.11.1).

The function is:

def test(arr):
    result = 0
    for i in range(6):
        for j in range(6):
            print(arr[i][j])
    return result

The error is:

In [121]:         for j in range(6):                                                            
     ...:                 print(arr[i][j])                                                        
     ...:             return result
  File <tokenize>:3
    return result
    ^
_IndentationError: unindent does not match any outer indentation level_

What I tried: If I just copy/paste the text to the console, it works.

Enabling let g:slime_python_ipython = 1 doesn't work because jupyter-console responds: "UsageError: Line magic function %cpaste not found"

Same as trying to toggle %autoindent resluts in: UsageError: Line magic function %autoindent not found.

lispercat commented 1 year ago

Looks like it may have to do with the neovim terminal. I installed a newer neovim v0.8.2 and it doesn't give me that error, but it correctly sends the text to the buffer without adding the final "Enter". So to fully evaluate the function I need to switch to the terminal and press the Return button to get input evaluated.

jpalardy commented 1 year ago

hi @lispercat

The tmux bracketed_paste mode has a workaround for a similar situation.

I'm neither a neovim, nor a ipython user … if you think this is the right way, send me a PR

You can git blame and cc the relevant users for help too.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.