Vim 不显示带有“:!command”的终端输出

Vim not displaing the terminal output with ":!command"

我有一个领导键映射到执行 python 脚本,但它只在我最后有 'CR' 时闪烁终端输出。

这会闪烁终端输出,但我看不到输出是什么。

noremap <leader>x :!clear<bar>./chart.py<cr>

这适用于 enter 但 clear 命令不执行仅执行 chart.py 然后我可以看到输出显示 'Press ENTER or type command to continue'.

noremap <leader>x :!clear<bar>./chart.py

<bar> 是 Vimscript 命令分隔符而不是 shell 命令分隔符。你真正需要的是 ;.

这应该有效:

noremap <leader>x :!clear; ./chart.py<cr>