2013-05-26 62 views
1

我想使用一組短鍵,每個鍵在我輸入後會擴展爲一段文本。如何使用短鍵在VIM中鍵入文本塊?

例如,假設兩個短鍵是 「:問候」, 「:lalist」,然後

  • 打字 「問候+ TAB」(或 「:問候」)應擴大到

    Hi, dear user: We are very glad that you have submitted your paper to XXX. 
    XXX is a world renowned conference in the field of YYY. This year, we have 
    about BLABLA. 
    
  • 打字 「lalist + TAB」(或 「:lalist」)應擴大到

    \begine{list} 
        \item 
    \end{list} 
    

儘管「snipMate」能很好地擴展一些關鍵字,例如對於c程序,它不能擴展像上面的「問候語」那樣的定製關鍵字。

我該怎麼做?


謝謝!我不知道snipMate和vim縮寫的自定義擴展功能。問題解決了。

+5

SnipMate _can_展開自定義關鍵字,您只需在.vim/snippets中自行定義塊。但它也可以用':abbreviate'完成 –

回答

2

這看起來像縮寫的工作。請參閱:help abbr下的廣泛vim幫助。總之,把這個在您的.vimrc

iabbr :greeting Hi, dear user: We are very glad that you have submitted your paper to XXX.<CR>XXX is a world renowned conference in the field of YYY. This year, we have<CR>about BLABLA. 

在這種情況下,提供了在插入模式的縮寫。

相關問題