Vim Tabular插件:在Ruby Symbol之后对齐不同的字符(例如<%=,TRUE,FALSE等)

时间:2018-11-12 14:35:15

标签: vim vim-tabular

我要列出以下Ruby代码片段:

这是一个YAML文件:

<% 4.upto(100) do |i| %>
importtask_<%= i %>:
  scheduled_start: DateTime.now
  repetition_interval: <%= ['days', 'months', 'weeks'].sample %>
  num_repetition_intervals: <%= [*1..10].sample %>
  status: <%= [0..4].sample %>
  created_at: <%= Date.today.prev_month - i.days %>
  user_id: 1
  publish_after_import: TRUE
  ili_agg_config_id: 1
  replace_all: TRUE
  force_import: FALSE
  repeat_until: <%= Date.today.next_month + i*100.days %>
<% end %>

使用

  

:标签/ <%=

我得到所有以<%=开头的值,但其余的(日期时间,TRUE,FALSE)当然不是:

    <% 4.upto(100) do |i| %>
    importtask_<%= i %>:
      scheduled_start: DateTime.now
      repetition_interval:          <%= ['days', 'months', 'weeks'].sample %>
      num_repetition_intervals:     <%= [*1..10].sample %>
      status:                       <%= [0..4].sample %>
      created_at:                   <%= Date.today.prev_month - i.days %>
      user_id: 1
      publish_after_import: TRUE
      ili_agg_config_id: 1
      replace_all: TRUE
      force_import: FALSE
      repeat_until:                 <%= Date.today.next_month + i*100.days %>
    <% end %>

我要如何获得

<% 4.upto(100) do |i| %>
importtask_<%= i %>:
  scheduled_start:              DateTime.now
  repetition_interval:          <%= ['days', 'months', 'weeks'].sample %>
  num_repetition_intervals:     <%= [*1..10].sample %>
  status:                       <%= [0..4].sample %>
  created_at:                   <%= Date.today.prev_month - i.days %>
  user_id:                      1
  publish_after_import:         TRUE
  ili_agg_config_id:            1
  replace_all:                  TRUE
  force_import:                 FALSE
  repeat_until:                 <%= Date.today.next_month + i*100.days %>
<% end %>

使用Vim Tabular吗?也许有一个“之后对齐:”正则表达式吗?

1 个答案:

答案 0 :(得分:0)

找到了

  

:标签/:\ zs

做到了!

只需将\ zs附加到“:之后的所有内容”。