Vim,表格和Ruby 1.9哈希

问题描述 投票:8回答:2

假设我有以下选项哈希作为Ruby 1.9.x中方法的参数:

my_method :arg1,
  some_option: "value 1"
  some_other_option:true
  option_three: 123

使用Tabular VIM插件,正则表达式将是什么,以使Hash对齐,如下所示:

my_method :arg1,
  some_option:       "value 1"
  some_other_option: true
  option_three:      123

[C0必须与密钥保持连接,与JSON不同,]。>

也许是一种更具视觉吸引力的样式,看起来更加对齐:

:

任何人都有机会知道如何使用Tabular完成这两种对齐方式吗?

谢谢!

假设我有以下选项哈希作为Ruby 1.9.x中方法的参数:my_method:arg1,some_option:“ value 1” some_other_option:true option_three:123使用表格VIM ...

vim hash alignment tabular ruby-1.9
2个回答
13
投票

为了获得第一个对齐,可以使用命令


1
投票

我经常使用Tabular,但是我从来没有找到尝试其“高级”功能的机会。 :Tab/\w:\zs/r0l1l0 中出现了与您的示例类似的情况:

© www.soinside.com 2019 - 2024. All rights reserved.