2

I would like configure my vim to automatically insert spaces after characters like commas, brackets, braces and parens. This is purely for aesthetics. Does anyone know how I could do this or point me towards a resource?

Of course I would need to escape these insertions when writing regex.

Thanks in advance.

4
  • 3
    Aesthethics aside, this is a bad idea. Nov 23, 2013 at 23:47
  • Would you mind elaborating?
    – Dan Baker
    Nov 24, 2013 at 17:27
  • 4
    A mapping might be fine if you only have spaces after those characters all the time, without exceptions. (But think of how hard it would be then when in another editor / a Vim without your config.) But as there are exceptions, you'll need an escaping mechanism, And all of this for avoiding to press Space, the largest key by far on most keyboards! Nov 24, 2013 at 19:50
  • 1
    Valid point probably not worth it.
    – Dan Baker
    Nov 24, 2013 at 20:07

1 Answer 1

4

There may be a neater way of doing this, but

inoremap , ,<space>

Will give you the behaviour you want within insert mode.

You must log in to answer this question.

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