Scite Tabs To Spaces 觀察 Tabstop |
|
要加入 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 設定來遵循 Tabstop
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