Vim 键映射以执行 python 脚本 [英] Vim key mapping to execute a python script

查看:23
本文介绍了Vim 键映射以执行 python 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我第一次尝试在 Vim 中映射命令.我想让它执行当前的 python 脚本,所以我把以下内容放在我的 .vimrc 中:

I'm trying to map a command in Vim for the first time. I want it to execute the current python script, so I put the following in my .vimrc:

noremap <silent><F5> :wall | !clear && echo "% is running..." && python %<CR>

当我启动 Vim 时出现以下错误:

When I start Vim I get the following error:

/bin/bash: -c: line 0: syntax error near unexpected token `newline'
/bin/bash: -c: line 0: `clear && echo "/home/ekirstein/.vimrc is running..." && python /home/ekirstein/CR>'

谁能告诉我我做错了什么?

Can someone please tell me what I'm doing wrong?

推荐答案

谢谢 glts.我忘了逃出管道...

Thanks glts. I forgot to escape the pipe...

noremap <silent><F5> :wall \| !clear && echo "% is running..." && python %<CR>

这篇关于Vim 键映射以执行 python 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆