【问题标题】:Loops and tests in sublime text崇高文本中的循环和测试
【发布时间】:2021-06-18 15:40:25
【问题描述】:

我习惯于在 Ultraedit 中创建宏来将 cmets 组织在某个列中,例如第 90 列。 为此,我创建了一个宏来搜索行尾,如果存在则清除结尾空格,并将空格添加到行尾,直到它到达第 90 列。 我找不到任何关于 Sublime 文本的参考: 如何检查光标位置,
如何检查光标位置上的字符, 如何创建循环。 这个想法是创建一个宏来做类似的事情

go to the end of line
while the column is not the first {
  return one character
  if the character under cursor is space or tab {
    delete the character
  }
  else {
    break
  }
}
if column is before or on column 90 { 
  while the column is before 90 {
    insert space 
  } 
  insert "//" 
}

【问题讨论】:

    标签: loops conditional-statements sublimetext3


    【解决方案1】:

    这种逻辑在 Python plugins 中可用,使用 Sublime API 编写。特别是,您将继承 sublime_plugin.TextCommandPackage Control 中有数千个包,其中许多是插件,您可以查看示例。前面的文档链接也很有帮助。您可以在此处、Sublime Text ForumDiscord server 上获得有关特定问题的帮助。 Youtube 上也有很多视频 - OdatNurd's channel 特别棒。

    【讨论】:

      猜你喜欢
      • 2014-08-24
      • 2012-05-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多