5

Is it OK to use spaces for better readability in a .vimrc? For example, right now I have:

set number| "show line numbers
set history=1000

Would it be OK to write instead:

set number | "show line numbers
set history = 1000

I know that if a space is before the virgule in a key remapping then the space becomes part of the mapping, but in the example above the space would not seem to affect the set operation.

3
  • 6
    You might want to avoid end-of-line comments.
    – muru
    Mar 24, 2016 at 6:39
  • @muru why? putting comments on separate lines makes the config file a lot more spread out and confusing to read because some lines are code, others are comments Mar 24, 2016 at 15:13
  • Because it might cause problems in map statements. And a personal preference of vertical spread over horizontal.
    – muru
    Mar 24, 2016 at 15:16

1 Answer 1

8

From :help :set-args:

White space between {option} and '=' is allowed and will be ignored. White space between '=' and {value} is not allowed.

So:

set history=1000 " is ok.
set history =1000 " is also ok, but
set history= 1000 " is not. Neighter is
set history = 1000

If the option doesn't take a value you can put as many spaces behind it as you want.

1
  • I have confirmed this behavior. Mar 23, 2016 at 21:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.