可以格式化以下文本,以便文本之后:是否在特定列中(如70)?
body:
X width: 100%
// This is comment
min->
X width: 960px
a:
&:hoover:
X family: $main_fonts
background->
X image: url('img/image.png')
X position: top center
X repeat: repeat
X color: #000
字符串
但是只针对包含X的行(前面的X只是为了显示要格式化的行,它不在真实的的文件中)。我试着用查尔斯·坎贝尔的Align,但没有运气:(
生成的文本应该如下所示:
body:
width: 100%
// This is comment
min->
width: 960px
a:
&:hoover:
family: $main_fonts
background->
image: url('img/image.png')
position: top center
repeat: repeat
color: #000
型
2条答案
按热度按时间g0czyy6m1#
在带有Tabular插件的vim中,使用V逐行直观地选择要格式化的区域,然后:'<,'> Tabular /:\s+\zs/l0 l70(spiiph是正确的:)
toiithl62#
使用以下正则表达式:
第一个月
或
:%s/^.*:\zs/ /g
* 以确保匹配最后的:
字符 *然后:
:%s/\%>25c\s\{2,}//g
最好的问候!