X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;ds=sidebyside;f=runtime%2Fplugins%2Fftoptions%2Fftoptions.lua;h=7c2d519d4c949a92a47b20f484cc5d3dff0d5b45;hb=97665573c7f7eaccf76d1150578a0c255fb0f810;hp=1ffe99cb8179857a698c85529463697e006c8fc7;hpb=e4c2f5d25948dbea51ee94506060ef6fe44924c6;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