diff --git a/cfg/config_any.go b/cfg/config_any.go index a2de542..4e0081a 100644 --- a/cfg/config_any.go +++ b/cfg/config_any.go @@ -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" diff --git a/cfg/config_linux.go b/cfg/config_linux.go index 7977c7f..1e9bc37 100644 --- a/cfg/config_linux.go +++ b/cfg/config_linux.go @@ -46,6 +46,9 @@ draw = true flash = true [commands] +[commands.exit] +shortcut = "ctrl+q" + [commands.save] shortcut = "ctrl+s" diff --git a/cfg/config_mac.go b/cfg/config_mac.go index 3ac478a..17df753 100644 --- a/cfg/config_mac.go +++ b/cfg/config_mac.go @@ -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" diff --git a/cfg/loader.go b/cfg/loader.go index d34661b..974ef38 100644 --- a/cfg/loader.go +++ b/cfg/loader.go @@ -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 { diff --git a/cfg/syntax.go b/cfg/syntax.go index a2e6ea9..953d07b 100644 --- a/cfg/syntax.go +++ b/cfg/syntax.go @@ -24,7 +24,7 @@ colouring = 0xf0a400 pattern = '\b([a-z]|[A-Z])+(_|([a-z]|[A-Z])+)*\b' [syntax.symbol] -match = "=" +match = ["="] colouring = 0xf8f273 `) diff --git a/gui/buffer.go b/gui/buffer.go index 4ba66af..62ebf00 100644 --- a/gui/buffer.go +++ b/gui/buffer.go @@ -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" ) diff --git a/gui/palette.go b/gui/palette.go index 60c4509..83e190e 100644 --- a/gui/palette.go +++ b/gui/palette.go @@ -1,7 +1,7 @@ package gui import ( - "github.com/felixangell/phi-editor/cfg" + "github.com/felixangell/phi/cfg" "github.com/felixangell/strife" ) diff --git a/gui/view.go b/gui/view.go index 1e0af0e..ae88825 100644 --- a/gui/view.go +++ b/gui/view.go @@ -1,7 +1,7 @@ package gui import ( - "github.com/felixangell/phi-editor/cfg" + "github.com/felixangell/phi/cfg" "github.com/felixangell/strife" ) diff --git a/main.go b/main.go index 5dc5585..80a70a6 100644 --- a/main.go +++ b/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" ) diff --git a/phi b/phi new file mode 100755 index 0000000..e10f990 Binary files /dev/null and b/phi differ