2011-09-02 22 views
8

在vim中,我可以設置textwidth選項,然後格式化新文本以包裝。我也可以使用「gq」命令來顯式地包裝文本。但是,帶有項目符號列表的行爲對我來說有點意外。 vim文檔討論使用帶連字符的項目符號作爲項目符號。當我嘗試這樣做,它開始好嗎:如何讓vim格式化符號正確的列表

- This is a bulleted list item that 
    has been wrapped. It looks good. 

但是,如果我繼續到第三行,它放棄這個縮進:

- This is a bulleted list item that 
    has been wrapped over more than 
two lines. The indentation for lines 
after the second is unexpected. 

這種情況與:

formatoptions=tcq 
comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:- 

只是要清楚,我想縮進這樣的:

- This is a bulleted list item that 
    has been wrapped over more than 
    two lines. I want every line after 
    the first to get the same indent. 

回答

6

經過進一步調查,看起來我只是需要「設置autoindent」來獲得預期的行爲。這似乎很好地工作,因爲它包裝的文本,因爲它鍵入和「gq」命令包裝。

相關問題