简体   繁体   English

从vim运行python时,如何在输出窗口中移动

[英]When running python from vim, how to move through the output window

It is explained in many places, how to run a python script from vim including Running Python code in Vim . 在很多地方都解释了如何从vim 运行 python脚本,包括在Vim中运行Python代码

But my output spans across pages and only I can see the last page. 但是我的输出跨越页面,只有我能看到最后一页。 I am not able to move to top of the results. 我无法移至结果顶部。

I tried :!clear;python % | 我尝试了:!clear; python%| more. 更多。 This will keep the output in more, but once more is exited, things are same. 这样可以保留更多的输出,但是一旦退出,一切都是一样的。 Any ways to move in the result pane? 有什么方法可以在结果窗格中移动?

Also I not able to add the shortcut "map :w:!python %|more". 我也无法添加快捷方式“ map:w:!python%| more”。

The output is simply printed out into your terminal, so you should use terminal's capabilities to scroll. 输出只是简单地打印到终端中,因此您应该使用终端的功能进行滚动。 Both Linux TTY and many X11 terminal emulators support Shift - PgUp / PgDown ; Linux TTY和许多X11终端仿真器都支持Shift - PgUp / PgDown in X11, you can also use scrolling wheel if that's your thing. 在X11中,您也可以使用滚轮。

If you need to process the output using Vim, you should prefix your ! 如果需要使用Vim处理输出,则应在!前面加上前缀! with read : :read !python % ; read :: :read !python % ; that will put the output into the current buffer. 它将把输出放入当前缓冲区。

Also I not able to add the shortcut "map :w:!python %|more". 我也无法添加快捷方式“ map:w:!python%| more”。

It's better to ask only one question per post. 最好每个帖子只问一个问题。 What you're missing in your command is the key you're binding the command to; 您在命令中缺少的是将命令绑定到的键; you should also escape % and | 您还应该转义%| .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM