X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=runtime%2Fplugins%2Fftoptions%2Fftoptions.lua;h=7c2d519d4c949a92a47b20f484cc5d3dff0d5b45;hb=e420872a270e351653f62756cda24892dc1417c9;hp=1ffe99cb8179857a698c85529463697e006c8fc7;hpb=0a500be3ba5f29bae5f0976ac7ecbc0f80e20446;p=micro.git diff --git a/runtime/plugins/ftoptions/ftoptions.lua b/runtime/plugins/ftoptions/ftoptions.lua index 1ffe99cb..7c2d519d 100644 --- a/runtime/plugins/ftoptions/ftoptions.lua +++ b/runtime/plugins/ftoptions/ftoptions.lua @@ -1,23 +1,15 @@ -if GetOption("ftoptions") == nil then - AddOption("ftoptions", true) -end - -function onViewOpen(view) - if not GetOption("ftoptions") then - return - end - - local ft = view.Buf.Settings["filetype"] +function onBufferOpen(b) + local ft = b:FileType() if ft == "go" or ft == "makefile" then - SetOption("tabstospaces", "off") + b:SetOption("tabstospaces", "off") elseif ft == "fish" or ft == "python" or ft == "python2" or ft == "python3" or ft == "yaml" or ft == "nim" then - SetOption("tabstospaces", "on") + b:SetOption("tabstospaces", "on") end end