Scite 将制表符转换为空格并遵守制表位 |
|
脚本(您将其添加到 ext.lua.startup.script 中)
function tabs_to_spaces_obey_tabstop() -- replace one tab tab followed by one or more (space or tab) -- but obey tabstops (preserves alignment) for m in editor:match("[\\t][\\t ]*", SCFIND_REGEXP) do local posColumn = ( scite.SendEditor(SCI_GETCOLUMN, (m.pos ) ) ) local poslenColumn = ( scite.SendEditor(SCI_GETCOLUMN, (m.pos + m.len) ) ) m:replace(string.rep(' ', poslenColumn - posColumn )) end end
配置
ext.lua.startup.script=$(SciteUserHome)/test.lua command.name.17.*=tabs_to_spaces_obey_tabstop command.17.*=tabs_to_spaces_obey_tabstop command.subsystem.17.*=3 command.mode.17.*=subsystem:lua,savebefore:no,groupundo
示例输入
Age Pull-Ups Crunches 3-Mile Run 17-26 3 50 28:00 27-39 3 45 29:00 40-45 3 45 30:00 46+ 3 40 33:00
将所有制表符转换为空格会将输入转换为
Age Pull-Ups Crunches 3-Mile Run 17-26 3 50 28:00 27-39 3 45 29:00 40-45 3 45 30:00 46+ 3 40 33:00
注意对齐方式发生了变化。使用 tabs_to_spaces_obey_tabstop,我们使用您当前的 Scite 设置来遵守制表位
Age Pull-Ups Crunches 3-Mile Run 17-26 3 50 28:00 27-39 3 45 29:00 40-45 3 45 30:00 46+ 3 40 33:00