Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
长ipython命令:提交/导航_Ipython - Fatal编程技术网

长ipython命令:提交/导航

长ipython命令:提交/导航,ipython,Ipython,有时我会在ipython中输入一个长语句 In [4]: def foo(): ...: a ...: bery # here's the error ...: long ...: function ...: definition ...: that ...: has ...: some ...: error ...: at ...: the

有时我会在ipython中输入一个长语句

In [4]: def foo():
   ...:     a
   ...:     bery  # here's the error
   ...:     long
   ...:     function
   ...:     definition
   ...:     that
   ...:     has
   ...:     some
   ...:     error
   ...:     at
   ...:     the
   ...:     top
   ...:
我希望能够修复错误并提交函数,但我的工作流是这样的

In [7]: def foo():
   ...:     a
   ...:     very  # 2) FIXED - I want to be able to ENTER from this line
   ...:     # 3) but instead I get a newline
   ...:     long
   ...:     function
   ...:     definition
   ...:     that
   ...:     has
   ...:     some
   ...:     error
   ...:     at
   ...:     the
   ...:     top
   ...:     # 1) I have to start here and scroll all the way to the top
   ...:     # 4) so now I have  to scroll all the way down here to ENTER the fixed function
   ...:
有什么建议吗

  • 更有效地导航到我要编辑的代码的顶部
  • 能够从不是结尾的行提交

要从块中的任何位置提交单元格,请按ESC+return

我不确定是否要导航到代码的顶部(我自己也在想同样的问题,这就是我如何找到您的问题的)。我发现当滚动历史记录,然后遇到一个很长的块时,这个问题尤其严重


编辑:如果有帮助,另一个有用的技巧是Ctrl+O在同一单元格中输入新行,而不管iPython是否愿意。与ESC+返回相反。

谢谢!如果您找到了快速导航的解决方案,请务必告诉我。这里似乎有更多文档:我们还可以使用此选项进入vim命令模式--TerminalInteractiveShell.editing_mode=vi请参阅