Search code examples
vim

Is it possible to format text with vim


is it possible to format text with vim like here. If it is possible how to do that.

Thanks!


Solution

  • You can use word wrapping, if that is what you want.

    :set wm=2
    :set textwidth=72
    

    To apply these settings to existing text, use the gq command. To apply it to all the text, just hit the following sequence:

    <ESC>
    gg
    gq
    G
    

    Or first select a portion of the text followed by gq.