插入模式下的vim自动对齐行末注释

插入模式下的vim自动对齐行末注释,vim,text-alignment,tabular,Vim,Text Alignment,Tabular,我不想自动将行末注释与vim对齐 我有以下代码片段: " This is a block " with some comments require 'some important lib' " important lib require 'another lib' " another lib require 'lib' "lib 这太难看了。因此,我有以下函数(in.vimrc) 相反,我希望得到以下结果: " This is a block " with some comments requ

我不想自动将行末注释与vim对齐

我有以下代码片段:

" This is a block
" with some comments
require 'some important lib' " important lib
require 'another lib' " another lib
require 'lib' "lib
这太难看了。因此,我有以下函数(in.vimrc)

相反,我希望得到以下结果:

" This is a block
" with some comments
require 'some important lib' " important lib
require 'another lib'        " another lib
require 'lib'                " lib

基本上,我只想对齐行末注释。块注释应保持不变。有没有办法打电话得到想要的结果?或者仅仅是另一个vim插件?

行末注释与块注释的区别是什么<代码>制表/[^”].\zs”/l1可能有效。假设所有块注释都从第一列开始。@FDinoff您的假设是正确的(块注释将从第一列开始)。这似乎奏效了。非常感谢。
                             " This is a block
                             " with some comments
require 'some important lib' " important lib
require 'another lib'        " another lib
require 'lib'                " lib
" This is a block
" with some comments
require 'some important lib' " important lib
require 'another lib'        " another lib
require 'lib'                " lib