diff --git a/cmd/micro/buffer.go b/cmd/micro/buffer.go index 7a98754e..e019b424 100644 --- a/cmd/micro/buffer.go +++ b/cmd/micro/buffer.go @@ -93,6 +93,8 @@ func NewBuffer(txt []byte, path string) *Buffer { buf: b, } + InitLocalSettings(b) + if b.Settings["savecursor"].(bool) || b.Settings["saveundo"].(bool) { // If either savecursor or saveundo is turned on, we need to load the serialized information // from ~/.config/micro/buffers diff --git a/cmd/micro/micro.go b/cmd/micro/micro.go index 3713457b..1d6202ca 100644 --- a/cmd/micro/micro.go +++ b/cmd/micro/micro.go @@ -210,7 +210,7 @@ func main() { InitConfigDir() // Load the user's settings - InitSettings() + InitGlobalSettings() InitCommands() InitBindings() diff --git a/cmd/micro/runtime.go b/cmd/micro/runtime.go index 40c5ecea..cacd9fdf 100644 --- a/cmd/micro/runtime.go +++ b/cmd/micro/runtime.go @@ -392,7 +392,7 @@ func runtimeHelpKeybindingsMd() (*asset, error) { return a, nil } -var _runtimeHelpOptionsMd = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x9c\x57\x5f\x8f\xdb\xb8\x11\x7f\x36\x3f\xc5\x20\x39\x60\x77\x0f\x5a\x07\xbd\xfe\x79\xf0\x5b\x90\xbd\xee\xa5\x48\x6e\x8b\x74\x0b\xdc\xa1\x28\x42\x4a\x1a\xd9\xbc\xa5\x38\x2a\x39\xb4\xcf\x29\xda\xcf\x5e\x0c\x29\xd9\xb2\xd7\x59\x14\xf7\x26\x91\xc3\x99\xdf\xfc\xe6\x0f\x87\xaf\x5f\xbf\x86\x87\x81\x2d\xf9\xa8\xd4\x47\xdb\x04\x82\xc8\x14\x30\x82\x71\x0e\xa8\x03\xde\x20\xa4\x88\x01\x1a\xf2\x9d\x5d\xa7\x60\x44\x18\xac\x07\xcb\xf1\x6c\xb1\xb5\x01\x1b\xa6\xb0\x5f\x4e\xba\x52\xc4\x98\x55\xe8\x6f\x7e\xba\xbb\xff\xfc\xee\xe1\xc7\x3f\xbf\xbf\xff\xfc\xc3\xc3\xc7\xef\xdf\xf4\x22\xa0\xc1\x94\xfd\xaf\x29\x82\xb7\x11\x06\x0c\x4a\x64\x7e\xba\xbb\x87\x38\x60\x53\x81\xed\x9e\x2b\xd4\x60\x23\x78\x62\x88\xc8\x15\xe8\xff\xbe\x59\x16\x9d\x93\x21\x1b\x05\x4d\x2b\x06\xd5\xd1\xe2\x09\xe6\x1f\x30\x20\x98\x80\x19\x11\x15\x56\x80\x37\x86\x61\x4f\x09\x1a\xe3\x45\xf7\x4a\xa9\x6f\x41\x37\xe4\x28\xc4\x66\x83\x3d\xea\x15\x38\x32\xed\xe4\xc7\x61\xbd\x10\xd9\x0a\x55\x0a\x00\xbe\xb9\x2e\x16\xef\x6c\xb8\x79\x33\x13\x8b\x6f\x74\x31\xa5\x97\x19\xa9\xc8\x3e\x6e\x6c\x14\x5b\x6c\xfd\x5a\x80\xeb\xb5\xa3\xda\x38\x20\xef\xf6\x7a\xa9\xd4\xa2\xc5\xce\x24\xc7\xb0\x35\x2e\xe1\x0a\xf4\xf8\xaf\xd5\xe2\x47\x62\x2c\x98\x05\xce\x24\x37\xb7\x07\xd7\xe3\x6a\x05\x91\x9c\x09\xf6\x0b\xb6\x15\x18\xdf\x1e\x7f\x6f\xb9\xb9\x51\x0b\x61\x42\x08\x75\xd4\x18\x2e\x8e\x1c\x5c\xa8\xa0\xc6\xc6\xa4\x98\xb9\xda\x67\xd2\xb0\xaf\xb1\x6d\x8b\x9c\xd8\xce\xde\x40\x6d\xbd\x09\x7b\xa5\x16\x8f\x67\xec\x08\x9d\x35\x42\x44\x87\x8d\x68\xef\x02\xf5\x39\xe9\xe4\x6c\x67\x1d\xc6\x49\x91\x5a\x9c\x05\xf3\x94\xbe\x79\xb6\x94\xac\x6b\x48\xdc\xac\xf7\x07\xf7\x77\x96\x37\xc0\x9b\x80\xa8\x16\xf3\xb3\x2b\xa5\x16\xdf\x4e\x52\x2b\x60\xa1\xdd\xc6\xaf\x31\xb7\xcc\xd2\x07\x92\x4e\xe5\x0f\xcb\x27\x4e\x5e\xe7\x94\x1b\xfd\x88\x4d\x40\xf4\x71\x43\x7c\xb3\x04\xb5\x00\xf8\x99\x12\xc4\x0d\x25\xd7\xc2\xc6\x6c\xf1\x92\x1e\x18\x8c\x43\x66\x14\x1d\x7b\x4a\x01\x18\x43\x6f\xbd\x71\xc0\xb9\xba\xc0\xf2\x19\xac\x5b\x6e\xfe\x1f\x64\x1d\x05\xe0\x90\xc6\x98\x54\xf0\x4b\x8a\x9c\x41\xf5\xe6\x09\x21\xa6\x80\x67\xf6\x62\x1a\x06\x0a\x1c\x67\xa7\xa0\xc6\x8e\x82\xf4\x87\x9c\xa7\x9c\x93\xe8\x90\x7b\xa2\xec\xe3\xfb\x77\x9f\x1e\x3e\x3f\x7e\xfa\xfb\xf7\xef\x1e\x3e\x3c\x7c\x02\xf4\x5b\x1b\xc8\xf7\xe8\x25\x77\x83\x35\xb5\x43\x28\xb9\x2e\x0e\xfd\x6e\xd2\x18\xd9\x84\x9c\xfc\x39\xde\xc5\xc3\x9e\x3c\x3d\x19\xfb\xcc\xbf\x71\xfd\x24\x52\xf0\x9e\x21\xe0\xbf\x92\x95\x4e\x36\x03\xcc\x24\xa8\x1c\xd1\x93\x74\x95\x0e\x1b\xae\xa0\x4e\x05\xef\x77\x7f\xfc\xd3\x28\x65\x86\x21\xd0\xaf\xb6\x2f\xcd\x48\xa4\x23\xac\x89\x72\xef\xd8\xa1\x73\x05\x8f\x61\xea\x6f\x5b\x13\x9e\x8e\x88\xe6\x04\xdb\x08\xb5\x91\xe8\x53\xd7\x49\x23\x7d\xcb\xd4\x5f\x45\x78\x25\x27\x5e\x9d\xa6\xd5\x02\xbe\x8e\xb7\x80\x15\xeb\x4b\x95\x3b\x0f\x9b\x3a\xda\x2f\xd2\x75\x22\x72\x61\x80\x4d\x0d\xb2\x26\xe2\x53\x33\xb9\xd0\x24\xfe\xa0\xb3\x02\xeb\x5b\xf4\xdc\x6c\x4c\x98\xeb\x28\xab\xc5\x63\xd9\x33\x0d\x63\xb8\xa0\x04\x8a\x12\x29\x50\xde\x0f\x27\x30\xa6\xb5\x92\x5b\x52\xee\x29\x04\x89\x74\x9d\xba\x0e\xc3\xf2\x79\x5b\x93\xce\x32\x76\x35\x25\x7d\x0f\xce\xac\x65\x52\x77\xd6\x39\xe9\x14\x26\x31\x49\x48\x1a\xe3\xdc\x3e\x67\x4c\x8b\x03\xfa\x56\x94\x91\x3f\x20\xc8\xbd\x3a\x97\x13\x0d\xe8\x8b\xc7\x6b\x4f\x01\x1b\x13\x05\xae\xc4\x9d\x42\x0f\xf2\x7b\x6b\x7d\x44\x1f\x2d\xdb\xad\x74\x22\x13\x9a\x0d\xc6\x0b\x4e\x53\xd7\x15\xb7\xe3\xde\xb3\xf9\x55\xaf\x80\x53\xf0\x11\xca\xaf\x58\xa7\x20\x71\xbe\x74\xd4\xeb\x43\xd8\x98\xe2\x60\x1a\x8c\x7a\x95\x4b\xb7\xfc\x80\xf5\x91\xd1\xb4\xf9\xb2\x35\xf5\x8b\xe6\x85\x82\x12\x28\xbd\x82\xdd\x06\x3d\x34\x01\x4d\xa6\xd3\x80\xc7\x1d\x38\xeb\xf3\x75\x5d\x0a\xdf\xf4\xa7\x71\x1d\xef\x5a\x61\x7a\x08\xb8\xb5\x94\x62\x3e\xf1\x02\xec\x26\x85\x48\x41\x84\xf4\x0a\x36\x76\xbd\x71\x76\xbd\x29\xf5\x92\x6d\x1d\xaa\xbd\x08\x4a\x54\xcb\x74\x60\xa0\xb5\x12\x75\x89\x7f\xce\x65\xb1\x7a\x7d\xb8\x22\x45\xb0\xc5\xce\x7a\x6c\xa5\x51\x9f\x5f\x9d\x12\x43\x33\x75\x96\x9b\x97\x28\x09\xc9\xa1\x24\x72\x6b\xe3\xe0\xcc\xbe\xa0\xf2\xa9\xaf\x31\x5c\xa4\x72\xf4\x2b\xb2\xe1\x14\x47\xbf\xa6\xb3\x99\xb4\xbc\x51\xd4\x8c\xae\xd5\xc4\x4c\xfd\x34\x0c\x95\x2e\xfe\x92\x6a\xb3\xc5\xc2\x86\x5e\x41\xc0\x5e\xee\xc5\x20\xd1\x1a\x07\x8b\x91\xa9\x9d\x89\xe0\x4c\x64\x60\xdb\xe3\x31\x7b\x65\x59\x12\x57\x26\x15\xdf\xe6\x50\x25\x96\xde\xca\x59\x41\x0e\xba\xb0\x23\x32\xc7\x53\x66\x6d\xec\x45\x4c\x87\xc4\x35\x5b\x4c\xbe\xa5\x29\x6f\x72\x65\x95\x56\x51\x62\x56\x81\x6c\xe7\x5e\x6c\xb6\xd8\x02\x6e\xd1\x83\xe9\x18\x43\x19\x7e\x1c\x45\x04\x93\xad\x09\xa8\x48\x32\x84\xcd\x76\x7c\x0b\x01\x33\xa8\x22\x54\x1d\x66\xa6\x27\xc4\x21\x2b\xb7\x7e\xfd\x22\xc4\x26\x90\x73\xbd\x09\x6b\xeb\xf5\x0a\x4c\x4f\xc9\xb3\xb0\x2e\xb1\x88\x59\xdd\x2e\xdf\x95\xce\x3e\xe5\x56\x17\x11\xc1\xd4\xb4\x2d\xd6\x6b\x74\xb4\x9b\x11\x7c\xc1\xd4\xef\xe7\x86\xe2\x80\xd8\x5e\xb0\x23\x8a\xb3\x40\x6e\x63\xe4\x71\xfa\x15\x46\xf8\x82\xd6\xef\xb4\x52\xb7\xb7\xb7\x4a\xdd\x8d\x1b\x83\x4b\x6b\xeb\xa7\x01\xb2\xcc\x8b\xce\x7a\xce\x79\x2a\x1f\xe0\x8c\x5f\x27\xb3\xc6\x5c\x2c\xc2\x37\x5c\x8f\xd7\x2b\xb6\xb3\x4d\xa9\x80\x77\x15\xdc\x55\x70\x4f\x15\xfc\xc5\x6c\x4d\x25\xdc\xcb\x47\x6c\x82\x1d\xb8\x82\x0f\xc9\xdc\x2c\xe1\xaf\x81\xb6\xb6\x3d\x96\xd2\x64\x6e\x84\x72\x69\x62\x9c\xb2\x55\x5a\x4a\x0e\xa1\x5e\xc1\xdb\x93\x0e\x5b\x02\xab\xff\xfd\x1f\x0d\xfa\xfa\x46\x83\xfe\xc7\x3f\x35\xe8\x57\xaf\x34\xe8\xab\x2b\xfd\xdc\xe8\x41\xd3\x68\xf5\x05\xa3\x6b\xb2\x7d\x1e\x26\xf4\x0a\x3e\x25\x0f\x87\xff\x89\x8f\x0b\x2e\xad\xe9\x45\x77\xa6\x2c\x5a\x53\xd7\xf3\x41\x6d\xd7\xf3\x6f\x57\x29\x60\xdf\xfa\xfd\x54\x26\x92\x80\x72\xeb\x8c\xd3\x1c\xb6\x96\xa5\x8c\xc7\xdb\xa9\x54\x0d\xd3\xb1\x26\xd5\xf9\xd4\x3a\xde\x7c\x71\xf9\x4b\x14\x4c\x54\x89\x2a\xec\xca\x14\x92\x87\xad\xd3\x57\x50\xe9\x07\xa3\x7e\x95\x3b\xbd\xcc\xc9\x94\x2b\x72\x09\xef\x73\xfd\x5d\x1d\xeb\x81\x65\x72\xbb\xa0\x27\x4f\xbf\x82\x9e\x09\x8c\x27\x69\x24\xaa\x37\xcd\xc6\x7a\xac\x20\xda\x7e\x90\x60\xd3\x30\xf6\xbf\x13\x90\xa3\x3f\xf9\x0c\x8c\x67\x96\x4a\xbd\x86\xfb\xf2\x20\x91\xc2\x2b\x97\xf8\x74\x4e\xa9\x9f\x8f\x6f\x25\x39\x1c\x8f\x3a\x01\x6d\x56\x54\x5e\x33\x6e\x2f\xb7\x66\x3e\xed\xf6\x4b\xf8\x50\x3e\xa0\x47\x33\xbd\xba\x66\x78\xd4\x8e\xfc\x15\x9f\x10\x7d\xfe\xc4\x3b\xe5\x57\x1f\x87\x51\xcb\x85\x45\x99\x33\xca\x93\x43\x82\xa8\x2e\x4d\x28\x7f\x1b\x87\x13\x33\x95\xef\x11\xeb\xe9\xbb\xa0\x3c\x98\xb2\xda\xd1\xcf\xf1\x80\x92\xbb\x4f\x42\x96\x35\xc6\xa5\x52\xf2\xf0\x39\x79\x2f\xce\xfa\xee\xec\x5d\x57\x8d\x80\x71\x36\x5c\xcd\x24\x8f\xa3\xd2\x12\x1e\x49\x89\xd1\x23\xc8\x91\xc4\x2a\x5f\xfd\x3a\x22\xe7\x05\x3d\x1f\x2d\x64\x55\x2f\xd5\xff\x02\x00\x00\xff\xff\x78\x5d\x9a\x45\xf0\x0f\x00\x00") +var _runtimeHelpOptionsMd = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x9c\x58\xdf\x6f\x1b\xb9\xf1\x7f\x36\xff\x8a\x81\x73\x80\xed\x60\xad\xe0\x9b\x6f\xda\x07\xbd\x19\xf1\xd5\xe7\x22\x39\x17\x6e\x0a\xdc\xa1\x28\xc2\xd9\xdd\x59\x2d\xcf\x5c\xce\x1e\xc9\x95\xa2\x1c\xd2\xbf\xbd\x18\x72\x57\x5a\xc9\x8a\x51\xf4\x4d\xe4\x0e\x67\x3e\xf3\x99\x1f\x1c\xea\xd5\xab\x57\xf0\xd0\x47\xc3\x2e\x28\xf5\xd1\x54\x9e\x21\x44\xf6\x14\x00\xad\x05\x6e\x20\xb6\x04\x43\x20\x0f\x15\xbb\xc6\xac\x06\x8f\x22\x0c\xc6\x81\x89\xe1\x68\xb3\x36\x9e\xaa\xc8\x7e\xbb\x98\x74\x0d\x81\x42\x52\xa1\x7f\xf8\xe5\xf6\xee\xf3\xfb\x87\x9f\xff\x72\x7f\xf7\xf9\xa7\x87\x8f\x3f\xbe\xe9\x44\x40\x03\xe6\xef\xdf\x53\x04\x37\x01\x7a\xf2\x4a\x64\x7e\xb9\xbd\x83\xd0\x53\x55\x80\x69\x9e\x2b\xd4\x60\x02\x38\x8e\x10\x28\x16\xa0\xff\xfd\x66\x91\x75\x4e\x86\x4c\x10\x34\xb5\x18\x54\x7b\x8b\x07\x98\x7f\x22\x4f\x80\x9e\x12\x22\xce\xac\x40\x6c\x31\xc2\x96\x07\xa8\xd0\x89\xee\xa5\x52\xaf\x41\x57\x6c\xd9\x87\xaa\xa5\x8e\xf4\x12\x2c\x63\x3d\xf9\xb1\xdb\xcf\x44\xd6\x42\x95\x02\x80\x1f\x2e\xb3\xc5\x5b\xe3\xaf\xde\xcc\xc4\xc2\x1b\x9d\x4d\xe9\x45\x42\x2a\xb2\x9f\x5a\x13\xc4\x56\x34\x6e\x25\xc0\xf5\xca\x72\x89\x16\xd8\xd9\xad\x5e\x28\x75\x56\x53\x83\x83\x8d\xb0\x46\x3b\xd0\x12\xf4\xb8\xd6\xea\xec\x67\x8e\x94\x31\x0b\x9c\x49\x6e\x6e\x0f\x2e\xc7\xdd\x02\x02\x5b\xf4\xe6\x2b\xd5\x05\xa0\xab\xf7\xcb\xeb\x58\x5d\xa9\x33\x61\x42\x08\xb5\x5c\x61\xcc\x8e\xec\x5c\x28\xa0\xa4\x0a\x87\x90\xb8\xda\x26\xd2\xa8\x2b\xa9\xae\xb3\x9c\xd8\x4e\xde\x40\x69\x1c\xfa\xad\x52\x67\x9f\x8e\xd8\x11\x3a\x4b\x82\x40\x96\x2a\xd1\xde\x78\xee\x52\xd2\xc9\xd9\xc6\x58\x0a\x93\x22\x75\x76\x14\xcc\x43\xfa\xe6\xd9\x92\xb3\xae\x62\x71\xb3\xdc\xee\xdc\xdf\x98\xd8\x42\x6c\x3d\x91\x3a\x9b\x9f\x5d\x2a\x75\xf6\x7a\x92\x5a\x42\x14\xda\x4d\xf8\x1e\x73\x8b\x24\xbd\x23\xe9\x50\x7e\xb7\x7d\xe0\xe4\x65\x4a\xb9\xd1\x8f\x50\x79\x22\x17\x5a\x8e\x57\x0b\x50\x67\x00\xbf\xf2\x00\xa1\xe5\xc1\xd6\xd0\xe2\x9a\x4e\xe9\x81\x1e\x2d\xc5\x48\xa2\x63\xcb\x83\x87\x48\xbe\x33\x0e\x2d\xc4\x54\x5d\x60\xe2\x11\xac\xeb\x58\xfd\x37\xc8\x1a\xf6\x10\xfd\x30\xc6\xa4\x80\xdf\x86\x10\x13\xa8\x0e\x9f\x08\xc2\xe0\xe9\xc8\x5e\x18\xfa\x9e\x7d\x0c\xb3\x53\x50\x52\xc3\x5e\xfa\x43\xca\xd3\x98\x92\x68\x97\x7b\xa2\xec\xe3\xfd\xfb\xc7\x87\xcf\x9f\x1e\xff\xf1\xe3\xfb\x87\x0f\x0f\x8f\x40\x6e\x6d\x3c\xbb\x8e\x9c\xe4\xae\x37\x58\x5a\x82\x9c\xeb\xe2\xd0\xff\x4d\x1a\x43\x44\x9f\x92\x3f\xc5\x3b\x7b\xd8\xb1\xe3\x27\x34\xcf\xfc\x1b\xf7\x0f\x22\x05\xf7\x11\x3c\xfd\x3e\x18\xe9\x64\x33\xc0\x91\x05\x95\x65\x7e\x92\xae\xd2\x50\x15\x0b\x28\x87\x8c\xf7\xed\x9f\xfe\x3c\x4a\x61\xdf\x7b\xfe\x62\xba\xdc\x8c\x44\x3a\xc0\x8a\x39\xf5\x8e\x0d\x59\x9b\xf1\x60\xe4\xee\xba\x46\xff\xb4\x47\x34\x27\xd8\x04\x28\x51\xa2\xcf\x4d\x23\x8d\xf4\x26\x72\x77\x11\xe0\x5c\x4e\x9c\x1f\xa6\xd5\x19\x7c\x1f\x6f\x06\x2b\xd6\x17\x2a\x75\x9e\x88\x65\x30\x5f\xa5\xeb\x04\x8a\x99\x81\x88\x25\xc8\x9e\x88\x4f\xcd\xe4\x44\x93\x78\xa7\x93\x02\xe3\x6a\x72\xb1\x6a\xd1\xcf\x75\xe4\xdd\xec\xb1\x7c\xc3\x2a\x92\x3f\xa1\x04\xb2\x12\x29\xd0\xb8\xed\x0f\x60\x4c\x7b\x39\xb7\xa4\xdc\x07\xef\x25\xd2\xe5\xd0\x34\xe4\x17\xcf\xdb\x9a\x74\x96\xb1\xab\x29\xe9\x7b\x70\x64\x2d\x91\xba\x31\xd6\x4a\xa7\xc0\x21\xb2\x84\xa4\x42\x6b\xb7\x29\x63\x6a\xea\xc9\xd5\xa2\x8c\xdd\x0e\x41\xea\xd5\xa9\x9c\xb8\x27\x97\x3d\x5e\x39\xf6\x54\x61\x10\xb8\x12\x77\xf6\x1d\xc8\xf2\xda\xb8\x40\x2e\x98\x68\xd6\xd2\x89\xd0\x57\x2d\x85\x13\x4e\x73\xd3\x64\xb7\xc3\xd6\x45\xfc\xa2\x97\x10\x07\xef\x02\xe4\xa5\x58\x67\x2f\x71\x3e\x75\xd4\xe9\x5d\xd8\x22\x87\x1e\x2b\x0a\x7a\x99\x4a\x37\x2f\xc0\xb8\x10\x09\xeb\x74\xd9\x62\xf9\xa2\x79\xa1\x20\x07\x4a\x2f\x61\xd3\x92\x83\xca\x13\x26\x3a\x11\x1c\x6d\xc0\x1a\x97\xae\xeb\x5c\xf8\xd8\x1d\xc6\x75\xbc\x6b\x85\xe9\xde\xd3\xda\xf0\x10\xd2\x89\x17\x60\x57\x83\x0f\xec\x45\x48\x2f\xa1\x35\xab\xd6\x9a\x55\x9b\xeb\x25\xd9\xda\x55\x7b\x16\x94\xa8\xe6\xe9\x00\xa1\x36\x12\x75\x89\x7f\xca\x65\xb1\x7a\xb9\xbb\x22\x45\xb0\xa6\xc6\x38\xaa\xa5\x51\x1f\x5f\x9d\x12\x43\x9c\x3a\xcb\xd5\x4b\x94\xf8\xc1\x92\x24\x72\x6d\x42\x6f\x71\x9b\x51\xb9\xa1\x2b\xc9\x9f\xa4\x72\xf4\x2b\x44\x8c\x43\x18\xfd\x9a\xce\x26\xd2\xd2\x87\xac\x66\x74\xad\xe4\x18\xb9\x9b\x86\xa1\xdc\xc5\x5f\x52\x8d\x6b\xca\x6c\xe8\x25\x78\xea\xe4\x5e\xf4\x12\xad\x71\xb0\x18\x99\xda\x60\x00\x8b\x21\x42\x34\x1d\xed\xb3\x57\xb6\x25\x71\x65\x52\x71\x75\x0a\xd5\x10\xa5\xb7\xc6\xa4\x20\x05\x5d\xd8\x11\x99\xfd\x29\x5c\xa1\x39\x89\x69\x97\xb8\xb8\xa6\xc1\xd5\x3c\xe5\x4d\xaa\xac\xdc\x2a\x72\xcc\x0a\x90\xcf\xa9\x17\xe3\x9a\x6a\xa0\x35\x39\xc0\x26\x92\xcf\xc3\x8f\xe5\x40\x80\xc9\x9a\x80\x0a\x2c\x43\xd8\xec\x8b\xab\xc1\x53\x02\x95\x85\x8a\xdd\xcc\xf4\x44\xd4\x27\xe5\xc6\xad\x5e\x84\x58\x79\xb6\xb6\x43\xbf\x32\x4e\x2f\x01\x3b\x1e\x5c\x14\xd6\x25\x16\x21\xa9\xdb\xa4\xbb\xd2\x9a\xa7\xd4\xea\x02\x11\x60\xc9\xeb\x6c\xbd\x24\xcb\x9b\x19\xc1\x27\x4c\xfd\xff\xdc\x50\xe8\x89\xea\x13\x76\x44\x71\x12\x48\x6d\x8c\x1d\x4d\x4b\x61\x24\x9e\xd0\xfa\x56\x2b\x75\x7d\x7d\xad\xd4\xed\xf8\xa1\xb7\xc3\xca\xb8\x69\x80\xcc\xf3\xa2\x35\x2e\xa6\x3c\x95\x1f\x60\xd1\xad\x06\x5c\x51\x2a\x16\xe1\x1b\x2e\xc7\xeb\x95\xea\xd9\x47\xa9\x80\xf7\x05\xdc\x16\x70\xc7\x05\xfc\x15\xd7\x58\x08\xf7\xf2\x23\x54\xde\xf4\xb1\x80\x0f\x03\x5e\x2d\xe0\x6f\x9e\xd7\xa6\xde\x97\xd2\x64\x6e\x84\x72\x6a\x62\x9c\xb2\x55\x5a\x4a\x0a\xa1\x5e\xc2\xcd\x41\x87\xcd\x81\xd5\x7f\x7c\xd3\xa0\x2f\xaf\x34\xe8\x7f\xfe\x4b\x83\x3e\x3f\xd7\xa0\x2f\x2e\xf4\x73\xa3\x3b\x4d\xa3\xd5\x17\x8c\xae\xd8\x74\x69\x98\xd0\x4b\x78\x1c\x1c\xec\xd6\x13\x1f\x27\x5c\x5a\xf1\x8b\xee\x4c\x59\xb4\xe2\xa6\x8b\x3b\xb5\x4d\x17\xff\x77\x95\x02\xf6\xc6\x6d\xa7\x32\x91\x04\x94\x5b\x67\x9c\xe6\xa8\x36\x51\xca\x78\xbc\x9d\x72\xd5\x44\xde\xd7\xa4\x3a\x9e\x5a\xc7\x9b\x2f\x2c\x7e\x0b\x82\x89\x0b\x51\x45\x4d\x9e\x42\xd2\xb0\x75\xf8\x0a\xca\xfd\x60\xd4\xaf\x52\xa7\x97\x39\x99\x53\x45\x2e\xe0\x3e\xd5\xdf\xc5\xbe\x1e\xa2\x4c\x6e\x27\xf4\xa4\xe9\x57\xd0\x47\x06\x74\x2c\x8d\x44\x75\x58\xb5\xc6\x51\x01\xc1\x74\xbd\x04\x9b\xfb\xb1\xff\x1d\x80\x1c\xfd\x49\x67\x60\x3c\xb3\x50\xea\x15\xdc\xe5\x07\x89\x14\x5e\xbe\xc4\xa7\x73\x4a\xfd\xba\x7f\x2b\xc9\xe1\xb0\xd7\x09\x64\x92\xa2\xfc\x9a\xb1\x5b\xb9\x35\xd3\x69\xbb\x5d\xc0\x87\xfc\x03\x3a\xc2\xe9\xd5\x35\xc3\xa3\x36\xec\x2e\xe2\x01\xd1\xc7\x4f\xbc\x43\x7e\xf5\x7e\x18\x35\x31\xb3\x28\x73\x46\x7e\x72\x48\x10\xd5\xa9\x09\xe5\xef\xe3\x70\x82\x53\xf9\xee\xb1\x1e\xbe\x0b\xf2\x83\x29\xa9\x1d\xfd\x1c\x0f\x28\xb9\xfb\x24\x64\x49\x63\x58\x28\x25\x0f\x9f\x83\xf7\xe2\xac\xef\xce\xde\x75\xc5\x08\x98\x66\xc3\xd5\x4c\x72\x3f\x2a\x2d\xe0\x13\x2b\x31\xba\x07\x39\x92\x58\xa4\xab\x5f\x07\x8a\x69\x43\xcf\x47\x0b\xd9\x95\xa7\xe3\x7d\xce\x5e\x7d\x44\xd6\x6e\x72\x92\xc8\xa1\x0d\x9c\xae\x1d\xb1\x32\xbd\x83\x47\x1b\x52\x3c\xf2\x08\x37\xcd\x36\x8f\x1d\xe2\xc2\x22\x3f\x9d\x4d\x10\x4c\xf4\x05\xbb\x5e\x32\xb7\x35\x55\x0b\x2d\x86\xa3\xe1\x47\x0a\x52\x92\x58\x58\xca\xef\x3c\xfa\x52\x51\x1f\xe1\x8e\xf3\x3a\x31\xa1\x76\x83\x2e\xbc\x3b\x2d\xfe\x38\x94\xdb\xbc\xb3\x54\x4a\x6b\xad\xfe\x48\x23\xe4\xf9\xeb\xc5\x8a\xcf\x97\x90\x57\x69\x67\x6e\xfe\x7c\x09\x0d\xda\x90\x2e\x31\xf8\x56\x4c\x47\x7c\xf9\xfc\x88\xf9\x4a\xe7\x4b\x78\x9b\x25\xd5\x29\x4d\x32\xa9\x17\xea\xe8\xc0\xbb\x42\x7d\x4b\x78\xd4\x4d\x98\xfd\x71\x20\x4f\x35\x61\xe8\xf7\xc1\x44\x02\xc2\xb0\xcd\x77\xd8\x73\x86\xf3\x73\xea\x7b\x51\x5a\xa8\xff\x04\x00\x00\xff\xff\xcd\xef\x09\xbc\xb4\x11\x00\x00") func runtimeHelpOptionsMdBytes() ([]byte, error) { return bindataRead( @@ -407,7 +407,7 @@ func runtimeHelpOptionsMd() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "runtime/help/options.md", size: 4080, mode: os.FileMode(420), modTime: time.Unix(1472159931, 0)} + info := bindataFileInfo{name: "runtime/help/options.md", size: 4532, mode: os.FileMode(420), modTime: time.Unix(1472170515, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/cmd/micro/settings.go b/cmd/micro/settings.go index 16d390df..15a1658f 100644 --- a/cmd/micro/settings.go +++ b/cmd/micro/settings.go @@ -7,13 +7,16 @@ import ( "os" "reflect" "strconv" + "strings" + + "github.com/zyedidia/glob" ) // The options that the user can set var globalSettings map[string]interface{} -// InitSettings initializes the options map and sets all options to their default values -func InitSettings() { +// InitGlobalSettings initializes the options map and sets all options to their default values +func InitGlobalSettings() { defaults := DefaultGlobalSettings() var parsed map[string]interface{} @@ -36,12 +39,52 @@ func InitSettings() { globalSettings[k] = v } for k, v := range parsed { - globalSettings[k] = v + if !strings.HasPrefix(reflect.TypeOf(v).String(), "map") { + globalSettings[k] = v + } } - err := WriteSettings(filename) - if err != nil { - TermMessage("Error writing settings.json file: " + err.Error()) + if _, err := os.Stat(filename); os.IsNotExist(err) { + err := WriteSettings(filename) + if err != nil { + TermMessage("Error writing settings.json file: " + err.Error()) + } + } +} + +// InitLocalSettings scans the json in settings.json and sets the options locally based +// on whether the buffer matches the glob +func InitLocalSettings(buf *Buffer) { + var parsed map[string]interface{} + + filename := configDir + "/settings.json" + if _, e := os.Stat(filename); e == nil { + input, err := ioutil.ReadFile(filename) + if err != nil { + TermMessage("Error reading settings.json file: " + err.Error()) + return + } + + err = json.Unmarshal(input, &parsed) + if err != nil { + TermMessage("Error reading settings.json:", err.Error()) + } + } + + for k, v := range parsed { + if strings.HasPrefix(reflect.TypeOf(v).String(), "map") { + g, err := glob.Compile(k) + if err != nil { + TermMessage("Error with glob setting ", k, ": ", err) + continue + } + + if g.MatchString(buf.Path) { + for k1, v1 := range v.(map[string]interface{}) { + buf.Settings[k1] = v1 + } + } + } } } @@ -49,7 +92,30 @@ func InitSettings() { func WriteSettings(filename string) error { var err error if _, e := os.Stat(configDir); e == nil { - txt, _ := json.MarshalIndent(globalSettings, "", " ") + var parsed map[string]interface{} + + filename := configDir + "/settings.json" + if _, e := os.Stat(filename); e == nil { + input, err := ioutil.ReadFile(filename) + if err != nil { + return err + } + + err = json.Unmarshal(input, &parsed) + if err != nil { + TermMessage("Error reading settings.json:", err.Error()) + } + } + + for k, v := range parsed { + if !strings.HasPrefix(reflect.TypeOf(v).String(), "map") { + if _, ok := globalSettings[k]; ok { + parsed[k] = globalSettings[k] + } + } + } + + txt, _ := json.MarshalIndent(parsed, "", " ") err = ioutil.WriteFile(filename, txt, 0644) } return err diff --git a/runtime/help/options.md b/runtime/help/options.md index 1a413f8b..94e020f6 100644 --- a/runtime/help/options.md +++ b/runtime/help/options.md @@ -131,3 +131,22 @@ in all buffers. The `colorscheme` option is global only, and the `filetype` option is local only. To set an option locally, use `setlocal` instead of `set`. + +In the `settings.json` file you can also put set options locally by specifying a glob. +Here is an example which has `tabstospaces` on for all files except Go files, and +`tabsize` 4 for all files except Ruby files: + +``` +{ + "*.go": { + "tabstospaces": false + }, + "*.rb": { + "tabsize": 2 + } + "tabstospaces": true, + "tabsize": 4, +} +``` + +As you can see it is quite easy to set options locally using the `settings.json` file.