You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Vim中无法禁用‘Press ENTER or type command to continue’提示的解决方法

关于Vim外部命令执行后"Press ENTER"提示的禁用问题

问题场景

我定义了如下Vim命令:

command! FilesUpdateMRU :execute '!${MYSCRIPTS}/file -m'

执行该命令后,Vim会弹出提示:

Press ENTER or type command to continue

这是Vim的默认行为,但我希望彻底禁用这个提示。

已尝试的无效配置

我试过以下配置,但都无法消除这个等待按键的提示:

  • set cmdheight=2
  • set shortmess+=F、set shortmess=F、set shortmess= 以及 set shortmess=a set syntax=on

唯一有效的方案

只有在命令中加入silent和redraw!能解决问题:

command! FilesUpdateMRU2 :silent execute '!${MYSCRIPTS}/file -m' | redraw!

核心疑问

我想搞清楚这个提示出现的根本原因,以及有没有办法彻底禁用它,而不是每次都要给命令加silent和redraw!。感觉我遗漏了某个关键配置点。

我的.vimrc配置

set cmdheight=2
set shortmess=
set nomore
set formatoptions-=cro

command! FilesUpdateMRU :execute '!${MYSCRIPTS}/file -m'
command! FilesUpdateMRU2 :silent execute '!${MYSCRIPTS}/file -m' | redraw!

环境信息

VIM - Vi IMproved 8.1 (2018 May 18, compiled Dec 10 2020 20:32:49)
macOS version
Included patches: 1-503, 505-680, 682-2292

内容的提问来源于stack exchange,提问作者KarlsD

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.23 04:36:17