X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=runtime%2Fplugins%2Fftoptions%2Fftoptions.lua;h=03a824d4c1ff342b4e3a194f773b79481d9bece6;hb=6957e83cdbb57e590709a0392d5854aed00206ea;hp=a0170b942f3cee844f73d4224d34e6234155ce81;hpb=e071209add3b3f68460aec7aaea2c92daa5610c6;p=micro.git diff --git a/runtime/plugins/ftoptions/ftoptions.lua b/runtime/plugins/ftoptions/ftoptions.lua index a0170b94..03a824d4 100644 --- a/runtime/plugins/ftoptions/ftoptions.lua +++ b/runtime/plugins/ftoptions/ftoptions.lua @@ -1,17 +1,17 @@ -if GetOption("ftoptions") == nil then - AddOption("ftoptions", true) -end - -function onViewOpen(view) - if not GetOption("ftoptions") then - return - end +VERSION = "1.0.0" - 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" or ft =="nim" 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