cfg

package
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2018 License: MIT Imports: 14 Imported by: 4

Documentation

Index

Constants

View Source
const (
	CONFIG_DIR_PATH  = "/.phi-editor/"
	CONFIG_TOML_FILE = "config.toml"
)

Variables

View Source
var CONFIG_FULL_PATH string = ""

this is the absolute path to the config.toml file. todo rename/refactor

View Source
var DEFUALT_TOML_CONFIG = `` /* 1600-byte string literal not displayed */
View Source
var DefaultSyntaxSet = DefaultSyntax{}
View Source
var FONT_FOLDER string = ""
View Source
var ICON_DIR_PATH string = ""
View Source
var Shortcuts = &shortcutRegister{
	Supers:   map[string]string{},
	Controls: map[string]string{},
}

Functions

func RegisterSyntax

func RegisterSyntax(name string, s string)

Types

type Command

type Command struct {
	Shortcut string
}

type CursorConfig

type CursorConfig struct {
	Flash_Rate  int64
	Reset_Delay int64
	Draw        bool
	Flash       bool
	Block_Width string
}

func (CursorConfig) GetCaretWidth

func (c CursorConfig) GetCaretWidth() int

type DefaultSyntax

type DefaultSyntax map[string]string

type EditorConfig

type EditorConfig struct {
	Tab_Size             int
	Hungry_Backspace     bool
	Tabs_Are_Spaces      bool
	Match_Braces         bool
	Maintain_Indentation bool
	Highlight_Line       bool
	Font_Path            string
	Font_Face            string
	Font_Size            int
	Show_Line_Numbers    bool
	Loaded_Font          *strife.Font
}

type FileAssociations

type FileAssociations struct {
	Extensions []string
}

type LanguageSyntaxConfig

type LanguageSyntaxConfig struct {
	Syntax map[string]*SyntaxCriteria `toml:"syntax"`
}

type PaletteConfig added in v0.1.1

type PaletteConfig struct {
	Background    uint32
	Foreground    uint32
	Cursor        uint32
	Outline       uint32
	Render_Shadow bool
	Shadow_Color  uint32
	Suggestion    struct {
		Background          uint32
		Foreground          uint32
		Selected_Background uint32
		Selected_Foreground uint32
	}
}

type RenderConfig

type RenderConfig struct {
	Aliased             bool
	Accelerated         bool
	Throttle_Cpu_Usage  bool
	Always_Render       bool
	Vertical_Sync       bool
	Syntax_Highlighting bool
}

type SyntaxCriteria

type SyntaxCriteria struct {
	Foreground uint32   `toml:"foreground"`
	Background uint32   `toml:"background"`
	Match      []string `toml:"match"`
	Pattern    string   `toml:"pattern"`

	CompiledPattern *regexp.Regexp
	MatchList       map[string]bool
}

type ThemeConfig

type ThemeConfig struct {
	Background                uint32
	Foreground                uint32
	Cursor                    uint32
	Cursor_Invert             uint32
	Palette                   PaletteConfig
	Gutter_Background         uint32
	Gutter_Foreground         uint32
	Highlight_Line_Background uint32
}

todo make this more extendable... e.g. .phi-editor/themes with TOML themes in them and we can select the default theme in the EditorConfig instead.

type TomlConfig

type TomlConfig struct {
	Editor       EditorConfig                `toml:"editor"`
	Cursor       CursorConfig                `toml:"cursor"`
	Render       RenderConfig                `toml:"render"`
	Theme        ThemeConfig                 `toml:"theme"`
	Associations map[string]FileAssociations `toml:"file_associations"`
	Commands     map[string]Command          `toml:"commands"`
	// contains filtered or unexported fields
}

func NewDefaultConfig

func NewDefaultConfig() *TomlConfig

func Setup

func Setup() TomlConfig

func (*TomlConfig) GetSyntaxConfig

func (t *TomlConfig) GetSyntaxConfig(ext string) (*LanguageSyntaxConfig, error)

GetSyntaxConfig returns a pointer to the parsed syntax language file for the given file extension e.g. what syntax def we need for a .cpp file or a .h file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL