phi-editor > phi; fix toml config

This commit is contained in:
Felix Angell 2018-04-22 18:56:47 +01:00
parent 57a53bae05
commit 898092f5ce
10 changed files with 26 additions and 7 deletions

View File

@ -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"

View File

@ -46,6 +46,9 @@ draw = true
flash = true
[commands]
[commands.exit]
shortcut = "ctrl+q"
[commands.save]
shortcut = "ctrl+s"

View File

@ -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"

View File

@ -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 {

View File

@ -24,7 +24,7 @@ colouring = 0xf0a400
pattern = '\b([a-z]|[A-Z])+(_|([a-z]|[A-Z])+)*\b'
[syntax.symbol]
match = "="
match = ["="]
colouring = 0xf8f273
`)

View File

@ -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"
)

View File

@ -1,7 +1,7 @@
package gui
import (
"github.com/felixangell/phi-editor/cfg"
"github.com/felixangell/phi/cfg"
"github.com/felixangell/strife"
)

View File

@ -1,7 +1,7 @@
package gui
import (
"github.com/felixangell/phi-editor/cfg"
"github.com/felixangell/phi/cfg"
"github.com/felixangell/strife"
)

View File

@ -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"
)

BIN
phi Executable file

Binary file not shown.