如何-启用- vim 的 "Press ENTER or type command to continue"
How to -enable- vim's "Press ENTER or type command to continue"
这里有很多关于如何在 运行 来自 vim 的外部命令时禁用 "Press ENTER or type command to continue" 文本的问题。但我想知道如何启用它。正如您在下面看到的,我没有使用 silent
或任何其他方式来禁用它。
这是我的 .vimrc:
的相关部分
nmap <leader>r :call NoFrills()<CR> "(r)eveal hidden chars
nmap <leader>i :set paste!<CR> "(i)ndenting on/off
nmap <leader>h :set nohlsearch!<CR> "(h)ighlighting of search terms on/off
nmap <leader>w :call SudoWrite()<CR> "(w)rite file, sudoing first
nmap <leader>a :! sudo service httpd restart<CR>"(a)pache restart
nmap <leader>p :! perl -c %<CR> "(p)erl -c
当我执行一个应该有输出的命令时,比如使用键序列 \ p
,命令执行但任何输出都很快从屏幕上消失,没有暂停或提示我继续。这是为什么?
如果我从 vim 的命令模式执行 :! perl -c %
,它会显示输出并提示我继续,正如预期的那样。
:version
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Feb 17 2012 10:23:31)
:set
--- Options ---
background=dark filetype=perl incsearch scrolloff=3 ttyfast
comments=:# helplang=en list shiftwidth=4 ttymouse=xterm
commentstring=#%s history=50 number syntax=perl viminfo='20,"50
define=[^A-Za-z_] hlsearch ruler tabstop=4 wildmenu
backspace=indent,eol,start
complete=.,w,b,u,t,i,k
fileencoding=utf-8
fileencodings=ucs-bom,utf-8,latin1
formatoptions=tcrq
guicursor=n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block,a:blinkon0
include=\<\(use\|require\)\>
includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.pm','')
indentexpr=GetPerlIndent()
indentkeys=0{,0},:,0#,!^F,o,O,e,0=,0),0=or,0=and
isfname=@,48-57,/,.,-,_,+,,,#,$,%,~,=,:
keywordprg=perldoc -f
listchars=tab:>-,trail:o
path=/usr/local/lib64/perl5,/usr/local/share/perl5,/usr/lib64/perl5/vendor_perl,/usr/share/perl5/vendor_perl,/usr/lib64/perl
5,/usr/share/perl5,,
wildmode=longest,list,full
正如@romainl 已经在评论中指出的那样,附加的评论是映射的一部分,其中一个字符(例如 <Space>
)消除了点击输入提示。您 可以 通过在映射中用 |
分隔(必须转义或写成 <Bar>
)来包含尾随注释:
nnoremap <leader>p :! perl -c %<CR>| "(p)erl -c
但我建议将评论放在单独的行中:
" (p)erl -c
nnoremap <leader>p :! perl -c %<CR>
PS: You should use :noremap
;它使映射不受重新映射和递归的影响。
这里有很多关于如何在 运行 来自 vim 的外部命令时禁用 "Press ENTER or type command to continue" 文本的问题。但我想知道如何启用它。正如您在下面看到的,我没有使用 silent
或任何其他方式来禁用它。
这是我的 .vimrc:
的相关部分nmap <leader>r :call NoFrills()<CR> "(r)eveal hidden chars
nmap <leader>i :set paste!<CR> "(i)ndenting on/off
nmap <leader>h :set nohlsearch!<CR> "(h)ighlighting of search terms on/off
nmap <leader>w :call SudoWrite()<CR> "(w)rite file, sudoing first
nmap <leader>a :! sudo service httpd restart<CR>"(a)pache restart
nmap <leader>p :! perl -c %<CR> "(p)erl -c
当我执行一个应该有输出的命令时,比如使用键序列 \ p
,命令执行但任何输出都很快从屏幕上消失,没有暂停或提示我继续。这是为什么?
如果我从 vim 的命令模式执行 :! perl -c %
,它会显示输出并提示我继续,正如预期的那样。
:version
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Feb 17 2012 10:23:31)
:set
--- Options ---
background=dark filetype=perl incsearch scrolloff=3 ttyfast
comments=:# helplang=en list shiftwidth=4 ttymouse=xterm
commentstring=#%s history=50 number syntax=perl viminfo='20,"50
define=[^A-Za-z_] hlsearch ruler tabstop=4 wildmenu
backspace=indent,eol,start
complete=.,w,b,u,t,i,k
fileencoding=utf-8
fileencodings=ucs-bom,utf-8,latin1
formatoptions=tcrq
guicursor=n-v-c:block,o:hor50,i-ci:hor15,r-cr:hor30,sm:block,a:blinkon0
include=\<\(use\|require\)\>
includeexpr=substitute(substitute(v:fname,'::','/','g'),'$','.pm','')
indentexpr=GetPerlIndent()
indentkeys=0{,0},:,0#,!^F,o,O,e,0=,0),0=or,0=and
isfname=@,48-57,/,.,-,_,+,,,#,$,%,~,=,:
keywordprg=perldoc -f
listchars=tab:>-,trail:o
path=/usr/local/lib64/perl5,/usr/local/share/perl5,/usr/lib64/perl5/vendor_perl,/usr/share/perl5/vendor_perl,/usr/lib64/perl
5,/usr/share/perl5,,
wildmode=longest,list,full
正如@romainl 已经在评论中指出的那样,附加的评论是映射的一部分,其中一个字符(例如 <Space>
)消除了点击输入提示。您 可以 通过在映射中用 |
分隔(必须转义或写成 <Bar>
)来包含尾随注释:
nnoremap <leader>p :! perl -c %<CR>| "(p)erl -c
但我建议将评论放在单独的行中:
" (p)erl -c
nnoremap <leader>p :! perl -c %<CR>
PS: You should use :noremap
;它使映射不受重新映射和递归的影响。