在 Vim 中对齐行尾注释? [英] Align End Of Line Comments in Vim?

查看:32
本文介绍了在 Vim 中对齐行尾注释?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Vim 内部,是否有一个格式化命令可以对齐行尾注释块?

Inside Vim, is there a formatting command that would align a block of end of line comments?

例如在 C++ 中,它会变成这样:

For example in C++, it would turn this:

m_varName1;   // Comment 1
m_varName1AndABit;       // Command 1 and a bit
m_varName2;     // Comment 2
m_varName3ButReally2AndABit;   // Comment 3 (but really 2 and a bit)

进入这个:

m_varName1;                   // Comment 1
m_varName1AndABit;            // Command 1 and a bit
m_varName2;                   // Comment 2
m_varName3ButReally2AndABit;  // Comment 3 (but really 2 and a bit)

推荐答案

tabular.vim 插件应该能够做到这一点.直观地选择它们,并将它们与

The tabular.vim plugin should be able to do this. Select them visually, and align them with

:Tabularize ///

这篇关于在 Vim 中对齐行尾注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆