【发布时间】:2015-03-30 17:08:15
【问题描述】:
这里有很多关于如何在从 vim 运行外部命令时禁用“按 ENTER 或键入命令继续”文本的问题。但我想知道如何启用它。正如您在下面看到的,我没有使用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
【问题讨论】:
-
我不知道它们是否真的在你的 vimrc 中,但内联 cmets 是禁止映射的。
-
你一针见血。谢谢!
标签: vim