-
-
Save CennoxX/f3486e8d8c9a7137ccf18d929ce3697a to your computer and use it in GitHub Desktop.
notepad++ startup.lua
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| local function indent_auto_detect() | |
| for i = 0, editor.LineCount - 1 do | |
| local pos = editor:PositionFromLine(i) | |
| local indent = editor.LineIndentPosition[i] - pos | |
| if indent > 0 then | |
| if string.byte("\t") == editor.CharAt[pos] then | |
| print("Indentation: Tabs") | |
| editor.UseTabs = true | |
| return | |
| elseif indent == 2 or indent == 3 or indent == 4 or indent == 8 then | |
| print("Indentation: " .. indent .. " spaces") | |
| editor.UseTabs = false | |
| editor.Indent = indent | |
| return | |
| end | |
| end | |
| end | |
| end | |
| npp.AddEventHandler({"OnSwitchFile", "OnReady"}, indent_auto_detect) | |
| print("Automatic indentation detection started") | |
| indent_auto_detect() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment