alignment - 如何将文本与 Sublime 3 中的 Alignment 包对齐,并在“=”周围有空格?
问题描述
我想在 Sublime Text 3 中使用 Alignment 包来对齐一些变量分配,并且我想在=
字符周围留出空格。这是一个例子:
bar = 'cherry'
bar_baz = 'tomato'
f = 'carrot'
结果是这样的:
bar = 'cherry'
bar_baz= 'tomato'
f = 'carrot'
应该是这样的:
bar = 'cherry'
bar_baz = 'tomato'
f = 'carrot'
我对 Alignment 包的设置如下:
{
"alignment_chars": [
"=", ":"
]
}
解决方案
默认设置显示:
:
:
// The mid-line characters to align in a multi-line selection, changing
// this to an empty array will disable mid-line alignment
"alignment_chars": ["="],
// If the following character is matched for alignment, insert a space
// before it in the final alignment
"alignment_space_chars": ["="],
:
:
确认你的没有以某种方式被破坏。
使用您的输入,如果我选择文本,或者我在 前面使用多个光标=
,并运行命令,它将按照您指定的方式对齐,周围有空格=
,例如:
bar = 'cherry'
bar_baz = 'tomato'
f = 'carrot'
如果我使用了多个游标,运行后,游标放在=
静止的前面:
bar |= 'cherry'
bar_baz |= 'tomato'
f |= 'carrot'
因此,要点是,无论我是否更改,我都无法复制您的问题alignment_chars
。
我建议将AlignTab包作为 Alignment 的替代品,因为“实时预览模式”很棒。
推荐阅读
- java - 在java中将.properties文件字符串转换为整数
- javascript - 如何使用特定字母对字符串数组进行排序?
- shell - 当 Maven 在 shell 脚本中构建失败时,在 Groovy 函数中返回布尔值
- web - 是否可能的产品被选中“订阅产品”字段自动创建订阅?
- c# - 如何在 C# 中传递变量的名称?
- php - 字符串到嵌套数组
- php - 允许访问 www/html 文件夹之外的文件
- python - max 和 np.max 的区别
- javascript - 遍历 json 对象,同时将其键值与 javascript 中的模式匹配
- c# - Dotvvm 运行时绑定到“对象”类型