I use vim
to edit text files. My screen is too wide and it's cumbersome to always look near left border of screen when editing. If you open a document in MS Office, the page is "centered" instead of left-aligned, and has non-active area borders on RHS and LHS. How do I get similar behavior from vim
?
Here are a couple approaches that won't work too well:
First, if you read VIM: Show a 3 character border on left of window or MacVim: how do I set a left gutter (margin) for my buffers?, you might try this:
:set foldcolumn=50
This won't work, because the maximum value of foldcolumn
is limited to 12.
Second, if you read How to create a border between the line numbers and text in Vim, you might try using numberwidth
instead of foldcolumn
:
:set numberwidth=50
But this won't work either, because the maximum value of numberwidth
is limited to 10.
The best approach that will work, as far as I've been able to find, is https://superuser.com/q/537584/376367. See that question's answer for more details, but the summary is: create two vertical splits, and edit your file in the middle. If the vertical divider lines and tildes bother you, you could hide them with:
:highlight VertSplit guifg=bg guibg=bg
:highlight NonText guifg=bg
Caution: if you use listchars
, they also use NonText
highlighting and will also be hidden by this trick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With