How to center horizontally the contents of the open file in vim?

Posted by Andrea Spadaccini on Stack Overflow See other posts from Stack Overflow or by Andrea Spadaccini
Published on 2012-10-18T10:25:01Z Indexed on 2012/10/18 11:01 UTC
Read the original article Hit count: 238

Filed under:

how do I make vim horizontally center the text of the open file?

I don't want to modify the file, just to change the way vim displays it.

To be more clear, when I open a file I currently have this situation:

|<------ textwidth=80 ------->|<-------------- padding -------------->|
|lorem ipsum dolor sit amet.. 
|dsdsda da dsa dsa 

What I'd like to have is the following:

|<--- padding/2 --->|<------ textwidth=80 ------->|<--- padding/2 --->|
|                    lorem ipsum dolor sit amet.. 
|                    dsdsda da dsa dsa 

Of course, for every value of textwidth and padding.

© Stack Overflow or respective owner

Related posts about vim