Create ftoptions option to disable auto settings

Closes #662
This commit is contained in:
Zachary Yedidia 2017-05-19 18:17:38 -04:00
parent e7ee194acf
commit f364965ac0
3 changed files with 20 additions and 6 deletions

File diff suppressed because one or more lines are too long

View file

@ -167,6 +167,12 @@ Default plugin options:
default value: `on`
* `ftoptions`: by default, micro will set some options based on the filetype. At the moment, micro will
use tabs for makefiles and spaces for python files regardless of your settings. If you would like to
disable this behavior turn this option off.
default value: `on`
Any option you set in the editor will be saved to the file
~/.config/micro/settings.json so, in effect, your configuration file will be
created for you. If you'd like to take your configuration with you to another

View file

@ -1,9 +1,17 @@
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"]
if ft == "makefile" or ft == "go" then
SetOption("tabstospaces", "off")
elseif ft == "python" then
elseif ft == "python" or ft == "python2" or ft == "python3" then
SetOption("tabstospaces", "on")
end
end