3

When I open a file with gvim with the following command line option,

gvim file +5

I would like the current line (the 5th line) be scrolled to the center of gVIM's window, Is that possible?

--=--=----=--=----=--=----=--=--
|                            |
|                            |
|                            |
|                            |
|  this line was selected    |
|                            |
--=--=----=--=----=--=----=--=--

By default, it wasn't centered

4

2 Answers 2

4

You can use

gvim file +5 -c "normal zz"

The -c option allows you to specify an editor command to run when starting vim. zz, as others have mentioned, centers the screen on the cursor line.

0

Use an autocommand.

au VimEnter * normal zz
1
  • 2
    And if he does not want to do this by default?
    – Bernhard
    Oct 22, 2012 at 15:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .