search

Home  >  Q&A  >  body text

How to quickly align comments when writing vim code?

example:

def a_func():
    a = 0  # a的说明
    bc = 1  # b的说明
    ...

It should be arranged like this:

def a_func():
    a = 0   # a的说明
    bc = 1  # b的说明
    ...

Is there any shortcut to do it in one step?

伊谢尔伦伊谢尔伦2743 days ago750

reply all(1)I'll reply

  • 黄舟

    黄舟2017-05-16 16:44:31

    Plug-in Tabular https://github.com/godlygeek/tabular
    http://linuxtoy.org/archives/tabular....

    Select lines 2 and 3 of the big V and enter:Tab /# 如果要已等号对起就输入:Tab /=

    reply
    0
  • Cancelreply