X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=runtime%2Fplugins%2Fftoptions%2Fftoptions.lua;h=7c2d519d4c949a92a47b20f484cc5d3dff0d5b45;hb=eeeb927a1dbd93386a34922a56a40a11dce81563;hp=698fc60b65d4b3a25846438246249fa930c4a9fc;hpb=d27f8f98024d913ad26e87b8849c2bf05da201f5;p=micro.git diff --git a/runtime/plugins/ftoptions/ftoptions.lua b/runtime/plugins/ftoptions/ftoptions.lua index 698fc60b..7c2d519d 100644 --- a/runtime/plugins/ftoptions/ftoptions.lua +++ b/runtime/plugins/ftoptions/ftoptions.lua @@ -1,17 +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 == "makefile" or ft == "go" then - SetOption("tabstospaces", "off") - elseif ft == "python" or ft == "python2" or ft == "python3" or ft == "yaml" then - SetOption("tabstospaces", "on") + if ft == "go" or + ft == "makefile" then + b:SetOption("tabstospaces", "off") + elseif ft == "fish" or + ft == "python" or + ft == "python2" or + ft == "python3" or + ft == "yaml" or + ft == "nim" then + b:SetOption("tabstospaces", "on") end end