如何使编辑器在所选文本中由单个字符垂直对齐?

问题描述 投票:0回答:1

假设我有一个文档(它恰好是一个BibTeX文件),里面有数以千计的条目,如下所示:

@article{hierarchy_problem_1,
    title = {Dynamics of spontaneous symmetry breaking in the Weinberg-Salam theory},
    author = {Susskind, Leonard},
    journal = {Physical Review D},
    volume = {20},
    number = {10},
    pages = {2619--2625},
    year = {1979},
    month = {November},
    publisher = {American Physical Society}
}

我希望能够选择其中一个,或者可能是一堆,并让它们更改为由一个字符垂直对齐,在本例中为“=”字符,因此它变为如下所示:

@article{hierarchy_problem_1,
    title                = {Dynamics of spontaneous symmetry breaking in the Weinberg-Salam theory},
    author               = {Susskind, Leonard},
    journal              = {Physical Review D},
    volume               = {20},
    number               = {10},
    pages                = {2619--2625},
    year                 = {1979},
    month                = {November},
    publisher            = {American Physical Society}
}

我现在选择的编辑器是Geany(它具有将所选文本发送到一些外部自定义命令 - 上下文菜单>格式>发送选择到的功能)但我会接受任何东西。请记住,论文的某些标题可以包含“=”字符,这可能是一个好方法吗?我怀疑至少在一些文本之后的行中的“=”字符如“journal”,将是该字符的第一个实例,然后它会在它之前添加空格(我更愿意避免使用制表符)因为它最终会出现在第30列。有什么办法可以做到这一点?

alignment edit geany
1个回答
0
投票

也许shell / regex专家可以构建自定义命令中使用的脚本。

就个人而言,在我的情况下,我会:

  1. 在文档中将制表设置为<tab>
  2. 通过=搜索并替换<tab><tab><tab><…>=
  3. vertical selection调整距离(需要插件Extra Selection)。
© www.soinside.com 2019 - 2024. All rights reserved.