akinsho/toggleterm.nvim

Copying and pasting visual selection to REPL

Open

#425 创建于 2023年4月5日

在 GitHub 查看
 (9 评论) (2 反应) (0 负责人)Lua (203 fork)batch import
REPLhelp wanted

仓库指标

Star
 (5,501 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

Currently :ToggleTermSendVisualSelection sends lines to the REPL line-by-line, which in many cases breaks the behavior of code blocks. For example, when sending the following code to ipython

def hi():
    print("hi")

    return "message sent"

we get a SyntaxError: 'return' outside function because, being sent line-by-line, the line break above starts a new execution cell (actually, you first get an indentation error because the print command is sent by default without indentation; #243 provides a quick fix). These errors would be fixed by literally copying and pasting the above code into the REPL, rather than sending it line-by-line. Could you consider implementing this behavior (or suggesting how to do so)?

贡献者指南