mirror of
https://github.com/felixangell/phi.git
synced 2024-08-16 19:20:21 +03:00
phi-editor > phi; fix toml config
This commit is contained in:
parent
57a53bae05
commit
898092f5ce
@ -21,6 +21,9 @@ always_render = true
|
||||
syntax_highlighting = true
|
||||
|
||||
[file_associations]
|
||||
[file_associations.toml]
|
||||
extensions = [".toml"]
|
||||
|
||||
[file_associations.c]
|
||||
extensions = [".c", ".h", ".cc"]
|
||||
|
||||
@ -49,6 +52,9 @@ shortcut = "ctrl+s"
|
||||
[commands.paste]
|
||||
shortcut = "ctrl+v"
|
||||
|
||||
[commands.exit]
|
||||
shortcut = "ctrl+q"
|
||||
|
||||
[commands.close_buffer]
|
||||
shortcut = "ctrl+w"
|
||||
|
||||
|
@ -46,6 +46,9 @@ draw = true
|
||||
flash = true
|
||||
|
||||
[commands]
|
||||
[commands.exit]
|
||||
shortcut = "ctrl+q"
|
||||
|
||||
[commands.save]
|
||||
shortcut = "ctrl+s"
|
||||
|
||||
|
@ -21,6 +21,9 @@ always_render = true
|
||||
syntax_highlighting = true
|
||||
|
||||
[file_associations]
|
||||
[file_associations.toml]
|
||||
extensions = [".toml"]
|
||||
|
||||
[file_associations.c]
|
||||
extensions = [".c", ".h", ".cc"]
|
||||
|
||||
@ -43,6 +46,9 @@ draw = true
|
||||
flash = true
|
||||
|
||||
[commands]
|
||||
[commands.exit]
|
||||
shortcut = "super+q"
|
||||
|
||||
[commands.save]
|
||||
shortcut = "super+s"
|
||||
|
||||
|
@ -49,6 +49,8 @@ var Shortcuts = &shortcutRegister{
|
||||
|
||||
func loadSyntaxDef(lang string) *LanguageSyntaxConfig {
|
||||
languagePath := filepath.Join(configDirAbsPath, "syntax", lang+".toml")
|
||||
log.Println("Loading lang from ", languagePath)
|
||||
|
||||
syntaxTomlData, err := ioutil.ReadFile(languagePath)
|
||||
if err != nil {
|
||||
log.Println("Failed to load highlighting for language '"+lang+"' from path: ", languagePath)
|
||||
@ -128,6 +130,8 @@ func configureAndValidate(conf *TomlConfig) {
|
||||
for lang, extSet := range conf.Associations {
|
||||
log.Println(lang, "=>", extSet.Extensions)
|
||||
languageConfig := loadSyntaxDef(lang)
|
||||
// check for errors here
|
||||
|
||||
syntaxSet = append(syntaxSet, languageConfig)
|
||||
|
||||
for _, ext := range extSet.Extensions {
|
||||
|
@ -24,7 +24,7 @@ colouring = 0xf0a400
|
||||
pattern = '\b([a-z]|[A-Z])+(_|([a-z]|[A-Z])+)*\b'
|
||||
|
||||
[syntax.symbol]
|
||||
match = "="
|
||||
match = ["="]
|
||||
colouring = 0xf8f273
|
||||
`)
|
||||
|
||||
|
@ -12,8 +12,8 @@ import (
|
||||
"unicode"
|
||||
|
||||
"github.com/felixangell/go-rope"
|
||||
"github.com/felixangell/phi-editor/cfg"
|
||||
"github.com/felixangell/phi-editor/lex"
|
||||
"github.com/felixangell/phi/cfg"
|
||||
"github.com/felixangell/phi/lex"
|
||||
"github.com/felixangell/strife"
|
||||
"github.com/veandco/go-sdl2/sdl"
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
package gui
|
||||
|
||||
import (
|
||||
"github.com/felixangell/phi-editor/cfg"
|
||||
"github.com/felixangell/phi/cfg"
|
||||
"github.com/felixangell/strife"
|
||||
)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package gui
|
||||
|
||||
import (
|
||||
"github.com/felixangell/phi-editor/cfg"
|
||||
"github.com/felixangell/phi/cfg"
|
||||
"github.com/felixangell/strife"
|
||||
)
|
||||
|
||||
|
4
main.go
4
main.go
@ -8,8 +8,8 @@ import (
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/felixangell/phi-editor/cfg"
|
||||
"github.com/felixangell/phi-editor/gui"
|
||||
"github.com/felixangell/phi/cfg"
|
||||
"github.com/felixangell/phi/gui"
|
||||
"github.com/felixangell/strife"
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user