2015-09-05 15 views
0

我經常在機器之間切換,我想提醒我啓動vim時支持的顏色數量。如何在vimrc加載後運行echo語句?

我的.vimrc被複制到所有機器上。

我曾嘗試加入一行:

echo 'Terminal t_Co: ' &t_Co 

然而,VIM顯示此消息的外殼,並要求我按回車鍵繼續:

snowch:~/.vim$ vim .vimrc 
Terminal t_Co: 8 
Press ENTER or type command to continue 

問題:我怎麼能在vim啓動後得到消息回顯?


注意:我已經看到了問題Vim pauses if echo in .vimrc file,我相信這是要求不同的事情。這個問題是問「如果可以,我該如何阻止這種暫停行爲?」而這個問題是問「我在vim啓動後如何回顯消息?」

+0

可能重複。[VIM暫停,如果回聲.vimrc文件(http://stackoverflow.com/questions/9171059/vim-pauses-if-echo- in-vimrc-file) – sidyll

+1

除了[duplicate](http://stackoverflow.com/a/9171079/557306)之外,您還可以使用如下所述的自動命令:[如何在vim中回顯自定義啓動消息] (http://stackoverflow.com/q/10803527/557306)。 – sidyll

+0

@sidyll - 謝謝。我已經標記我的問題作爲http://stackoverflow.com/questions/10803527/how-to-echo-custom-startup-message-in-vim –

回答

1

添加到您的vimrc:

" when Vim starts with no file 
if argc() == 0 
    autocmd VimEnter * echo "Nr. of Colors: " . &t_Co 
end