mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-11 23:22:41 +09:00
Add default ftoptions plugin to override settings
The ftoptions plugin will override values in settings.json based on language requirements (e.g. using tabs in makefiles).
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
// runtime/help/plugins.md
|
||||
// runtime/help/tutorial.md
|
||||
// runtime/plugins/autoclose/autoclose.lua
|
||||
// runtime/plugins/ftoptions/ftoptions.lua
|
||||
// runtime/plugins/linter/linter.lua
|
||||
// runtime/syntax/Dockerfile.micro
|
||||
// runtime/syntax/LICENSE
|
||||
@@ -541,6 +542,26 @@ func runtimePluginsAutocloseAutocloseLua() (*asset, error) {
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _runtimePluginsFtoptionsFtoptionsLua = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x94\x8e\xb1\x0a\xc2\x40\x0c\x86\xf7\x3e\x45\xc8\x54\x41\xfa\x06\x5d\x7c\x81\x0e\x05\x17\x71\x38\x6b\xd2\x06\xcf\xe4\xf0\x52\x4b\xdf\x5e\xae\x52\x9c\x0d\x64\xf9\xf3\xf1\xe5\xe7\x59\x07\x17\x53\x30\x3d\x0b\x2d\x5d\x22\xad\xdf\x42\xcb\xa1\x02\x00\x88\x36\x84\x08\xec\xd0\x42\x09\x9b\xd3\xcc\x4d\x4f\xee\xa2\x63\xbe\x20\x4b\x24\x5f\x13\xe1\xb5\xda\x68\xe1\x0d\x6d\x01\x9f\xe1\x41\xe5\x8a\x60\xaf\x3d\x1b\x0d\xc1\x27\xd2\x0d\x2d\xd3\x93\x77\xa9\xfc\xae\xd1\xc3\x2d\xbb\xe5\x14\x06\xca\x78\x04\x34\x66\xfc\x36\xa0\x98\xe9\xe7\x4d\xab\x4f\xa6\x7f\x78\x74\xd7\xe8\xbd\x2a\xfb\x09\x00\x00\xff\xff\xf6\x91\x6e\x48\xef\x00\x00\x00")
|
||||
|
||||
func runtimePluginsFtoptionsFtoptionsLuaBytes() ([]byte, error) {
|
||||
return bindataRead(
|
||||
_runtimePluginsFtoptionsFtoptionsLua,
|
||||
"runtime/plugins/ftoptions/ftoptions.lua",
|
||||
)
|
||||
}
|
||||
|
||||
func runtimePluginsFtoptionsFtoptionsLua() (*asset, error) {
|
||||
bytes, err := runtimePluginsFtoptionsFtoptionsLuaBytes()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := bindataFileInfo{name: "runtime/plugins/ftoptions/ftoptions.lua", size: 0, mode: os.FileMode(0), modTime: time.Unix(0, 0)}
|
||||
a := &asset{bytes: bytes, info: info}
|
||||
return a, nil
|
||||
}
|
||||
|
||||
var _runtimePluginsLinterLinterLua = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x8c\x55\x51\x8b\xe3\x36\x10\x7e\xcf\xaf\x18\x44\x0d\xf2\xae\xe5\x2d\xf7\x18\x08\xe5\xba\xb4\x07\xe5\xae\x57\xd8\x6b\xef\xa1\xed\x15\xc5\x1a\x25\xea\xca\x92\x91\xe4\x64\x43\xe9\x7f\x2f\x92\x9c\xc4\xf6\x3a\x47\x17\x16\x2b\x9a\x99\xef\x9b\xf9\x66\x3c\x56\x12\xde\x61\xf8\xd8\x05\x65\x0d\x25\x5a\x99\x80\x8e\x94\xb0\xd9\x80\x51\x1a\xc2\x1e\xcd\x0a\x00\xe0\xad\x10\x33\x9f\x0a\x82\xeb\xb1\x5c\xa1\x11\xab\xd5\x07\xfe\x8c\x8f\xb6\x6d\xb9\x11\xd9\x81\x54\x30\x38\xd6\xf1\x31\xd8\x48\x05\xdf\x96\xab\x95\xec\x4d\x13\xb1\x60\x64\xa2\x65\xe2\x79\xec\xdd\x6f\x0a\x8f\xb4\x5c\x3f\xf1\x03\x52\xc9\xb5\xc7\x6c\x71\xbd\x79\x9f\x00\xe9\xc0\x79\x41\x19\x5b\xa2\xa7\xb6\x0d\xd7\x20\x03\x6c\xae\x70\xf5\xf7\xbd\x5c\xff\xa8\x34\x7e\x3a\x75\x38\xf5\x53\x1a\xe7\x9e\xf5\x2f\x3c\xec\x47\x3e\x02\x0f\xa6\xd7\x1a\x36\x40\x1e\x04\x1e\x1e\xe2\x0f\x92\xec\x4a\xc2\xc7\xa7\xa8\x16\x39\x2a\x23\xec\xd1\x93\xab\x66\xf1\x6f\x14\xf9\xf3\xaf\xef\x73\x4c\xcc\x7e\x88\x8d\x49\x6e\x80\xec\xec\x2c\x2c\x0a\x43\xc9\xce\x6e\x7b\xa5\xa3\x6a\x64\x67\x21\x9d\x81\x59\x20\x50\xd7\x67\xe0\x0a\x48\x21\xd7\x85\x5e\x43\xd1\x92\xf2\x55\xfc\xb9\x15\xf9\x94\x23\x5f\x57\x7a\x01\x29\xc4\xfd\x08\x08\xb5\xc7\x6b\x8e\xba\xe7\x8b\x49\xea\x9e\x37\x7b\x6c\x9e\x53\xc7\x87\x33\x30\x66\x2c\x6b\xac\xb6\x2e\x73\x46\x91\xff\x17\x4b\x77\x0a\x7b\x6b\x16\x89\xba\x93\xd4\xfc\x19\x7d\x24\x3a\x9f\x17\xd0\x6b\xb6\xfe\xee\x16\x7a\xb3\x2c\x73\xd3\x24\x8d\x9a\x06\x98\xf4\x27\x13\xf8\x0b\xb3\x46\x9f\x80\x7d\xe6\x5a\x03\xfb\x8c\x2f\xc1\xf1\x1b\x85\xd4\xb7\x6b\x11\x8b\x6c\xa2\x4d\x0d\x15\xad\x80\xac\xd0\xc6\x4a\x09\xcc\x32\x60\x47\x60\x47\x05\xac\x99\x51\x15\xb4\xd0\x45\xf9\x35\xa6\xbf\xf9\x61\xb9\x39\xd1\x90\x8a\x4b\x87\x85\x12\x00\x9d\xb3\xee\xab\xc0\xbe\x71\xaa\x0b\xcb\xf0\x7e\x3f\x0c\x58\x3e\xcd\x09\xa2\x1b\x42\xa1\xab\xfa\xbe\x1a\x51\x18\x31\x7b\x83\xad\x49\x6f\xfb\x41\xe1\xb1\x3c\xbf\x1a\x4b\x5b\x69\x92\xc2\xfc\xb5\x8f\x99\x5f\x8c\xd7\x3d\xf2\xa8\x91\xbb\xb7\x5a\xbf\xeb\x43\x40\xf7\x01\xbd\xe7\x3b\xf4\xf4\x56\x2a\xa9\xb0\x4c\x58\x41\xd3\x8a\x2a\x2b\x24\xad\x6b\x79\x98\xef\xa8\x84\x3d\x03\xce\xb1\xe5\x2a\xb9\xfe\x64\xb7\x4f\x81\xbb\x40\x13\x12\x21\xc3\xff\xb0\x19\xad\xf9\xe1\x45\x45\xf9\xce\x7c\x13\xaa\xb9\x44\xd1\x97\xda\x3e\x74\x7d\xb8\x11\x71\x5d\x58\x51\x77\x0f\x1b\xf0\x9d\x1e\x05\x91\x3f\x0c\x19\x12\xcb\x6e\x0e\x77\xf8\x02\x9b\x31\xca\x7a\xe7\xfb\x2d\x25\x45\x21\x63\xa2\xb4\xae\x59\x49\xca\xcb\xa5\x4e\x97\x85\xb8\x1f\x5f\xb6\xd9\x33\xde\x25\x6c\x69\x1d\xfc\x55\xa5\xd6\x2b\x03\xaa\xe3\xca\x25\x59\xd0\x97\x20\xec\xa5\x45\x8c\xc1\x27\xa7\x5a\x38\xee\x55\x40\xdf\xf1\x06\xc7\xd3\x15\x77\x72\x7c\xac\x5b\x1e\x9a\x3d\x25\x5f\x0a\x7f\x17\x39\x0a\x7f\xf7\xcd\x68\xd1\x29\x09\x3e\x38\x65\x76\xb5\x54\x46\x24\x96\x2a\x97\x35\x9b\x96\xe9\xc2\x4f\x02\x62\x05\xad\xdf\x45\x95\x32\x42\x66\x1a\x43\x4c\xa2\x95\x84\x2d\xf7\x68\x78\x8b\xf4\xf5\x0e\x4d\x9f\xcc\x8b\x3d\x72\x2c\x24\x30\x9d\x9e\xc9\xe0\x5c\x66\x2e\x58\xd3\xb7\x5b\x74\x29\x91\x32\xa5\x58\xc1\x9b\x69\x2a\xe7\x2f\xc8\xf8\xfc\x7a\x94\x73\xf3\x7d\x70\x15\x78\xec\xca\x49\xdf\x7d\xaf\xe3\xf7\xf1\x9f\x7f\x17\xa6\x81\x12\xfa\xfb\x97\xc2\xff\x99\x9a\x9c\xa7\x82\x5e\x00\x62\x73\x91\x37\xfb\xd8\x5a\x1f\xdc\x7a\x97\x55\x1b\x24\x1f\xb5\x37\xf0\xad\xc6\x5a\x19\x8f\x2e\xd0\x4c\x58\xa5\xc8\x72\xf2\x11\x74\x18\x7a\x67\x86\x8c\x66\x05\x4c\xe5\x1c\x65\x1a\x2f\xaf\x7d\x4b\x73\x38\x2c\x1d\x5a\xdf\x3d\x94\xb4\xbe\x2b\xe3\x4c\x16\x6f\x86\x49\x19\x48\x62\x58\xa2\xf8\x2f\x00\x00\xff\xff\xbe\xc7\x70\x79\xf5\x08\x00\x00")
|
||||
|
||||
func runtimePluginsLinterLinterLuaBytes() ([]byte, error) {
|
||||
@@ -2531,6 +2552,7 @@ var _bindata = map[string]func() (*asset, error){
|
||||
"runtime/help/plugins.md": runtimeHelpPluginsMd,
|
||||
"runtime/help/tutorial.md": runtimeHelpTutorialMd,
|
||||
"runtime/plugins/autoclose/autoclose.lua": runtimePluginsAutocloseAutocloseLua,
|
||||
"runtime/plugins/ftoptions/ftoptions.lua": runtimePluginsFtoptionsFtoptionsLua,
|
||||
"runtime/plugins/linter/linter.lua": runtimePluginsLinterLinterLua,
|
||||
"runtime/syntax/Dockerfile.micro": runtimeSyntaxDockerfileMicro,
|
||||
"runtime/syntax/LICENSE": runtimeSyntaxLicense,
|
||||
@@ -2695,6 +2717,9 @@ var _bintree = &bintree{nil, map[string]*bintree{
|
||||
"autoclose": &bintree{nil, map[string]*bintree{
|
||||
"autoclose.lua": &bintree{runtimePluginsAutocloseAutocloseLua, map[string]*bintree{}},
|
||||
}},
|
||||
"ftoptions": &bintree{nil, map[string]*bintree{
|
||||
"ftoptions.lua": &bintree{runtimePluginsFtoptionsFtoptionsLua, map[string]*bintree{}},
|
||||
}},
|
||||
"linter": &bintree{nil, map[string]*bintree{
|
||||
"linter.lua": &bintree{runtimePluginsLinterLinterLua, map[string]*bintree{}},
|
||||
}},
|
||||
|
||||
9
runtime/plugins/ftoptions/ftoptions.lua
Normal file
9
runtime/plugins/ftoptions/ftoptions.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
function onViewOpen(view)
|
||||
local ft = view.Buf.Settings["filetype"]
|
||||
|
||||
if ft == "makefile" or ft == "go" then
|
||||
SetOption("tabstospaces", "off")
|
||||
elseif ft == "python" then
|
||||
SetOption("tabstospaces", "on")
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user