1.參考文檔
https://blog.csdn.net/MagicalProgrammer/article/details/83513148
2.實現(xiàn)效果
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.進(jìn)行函數(shù)操作
Ctrl + ~:打開控制臺
輸入:view.run_command('align_col') 颅悉,Commond命名具體查看1.插件安裝通用