How to insert spaces up to column X to line up things in columns?

前端 未结 7 2066
鱼传尺愫
鱼传尺愫 2020-12-04 09:45

I have my source code for copy operators written as follows.

foo = rhs.foo;
foobar = rhs.foobar;
bar = rhs.bar;
toto = rhs.toto;

I\'d like

7条回答
  •  长情又很酷
    2020-12-04 10:30

    There is a nice plugin which does exactly that and more, called Align.vim

    For you case, you would need to select your expression and then type :Align =. It will align everything, using = as a separator and reference.

    (There is a lots of options to align, left, right, cyclically, etc)

    You can also check Tabular.vim which provides similar features. See the screencast there for a demo.

提交回复
热议问题