1.参考文档
https://blog.csdn.net/MagicalProgrammer/article/details/83513148
2.实现效果
3.插件安装
1.源码
import sublime
import sublime_plugin
class AlignColCommand(sublime_plugin.TextCommand):
def run(self, edit):
most_right_pos = max(self.get_pos(self.view.sel()))
for region in self.view.sel():
col_num = self.view.rowcol(region.a)[1]
num_of_spaces = most_right_pos - col_num
# sublime.message_dialog(str(num_of_spaces))
self.view.insert(edit, region.a, ' ' * num_of_spaces)
def get_pos(self, selection):
for region in selection:
yield self.view.rowcol(region.a)[1]
2.插件安装
参考上一篇:
4.使用
1.切换列模式
参考:1.列模式
2.选中不整齐的第一列的末尾
3.进行函数操作
Ctrl + ~:打开控制台
输入:view.run_command('align_col') ,Commond命名具体查看1.插件安装通用