binding

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2018 License: MIT Imports: 10 Imported by: 1

README

HOW TO: Custom Configuration

.fac.yml

You can configure fac by creating a .fac.yml in your $HOME directory. With the file in place, the following paramters can be tweaked:

select_local: a
select_incoming: b
toggle_view: c
show_up: d
show_down: e 
scroll_up: f
scroll_down: g
edit: h
next: i
previous: j
quit: k
help: l

# Set to `true` to skip having to press enter when entering commands
cont_eval: true

👨‍⚖️👩‍⚖️ Rules

When parsing .fac.yml, fac enforces three rules.

1. Invalid key-binding keys
# WRONG
# Warning: Invalid key: "foobar" will be ignored
foobar: f
2. Multi-character key-mappings
# WRONG
# Warning: Illegal multi-character mapping: "local" will be interpreted as 'l'  
select_local: local

# CORRECT
select_local: l
3. Duplicate key-mappings
# WRONG
# Fatal: Duplicate key-mapping: "scroll_up, show_up" are all represented by 'u'
show_up: u
scroll_up: u

# CORRECT
show_up: u
scroll_up: k
4. Mapping keys
# WRONG
# Warning: yaml: mapping keys are not allowed in this context
help: ?

# CORRECT
help: "?"

Documentation

Index

Constants

View Source
const (
	SelectLocal           = "select_local"
	SelectIncoming        = "select_incoming"
	ToggleViewOrientation = "toggle_view"
	ShowLinesUp           = "show_up"
	ShowLinesDown         = "show_down"
	ScrollUp              = "scroll_up"
	ScrollDown            = "scroll_down"
	EditCode              = "edit"
	NextConflict          = "next"
	PreviousConflict      = "previous"
	QuitApplication       = "quit"
	ShowHelp              = "help"
	ContinuousEvaluation  = "cont_eval"
)

Following constants represent all the actions available to the user The string literals are used to retrieve values from `Binding` and when writing/reading from .fac.yml

Variables

This section is empty.

Functions

This section is empty.

Types

type Binding

type Binding map[string]string

Binding represents the user's key binding configuration

func LoadSettings

func LoadSettings() (b Binding, err error)

LoadSettings looks for a user specified key-binding settings file - `$HOME/.fac.yml` and returns a map representation of the file It also looks for errors, and ambiguities within the file and notifies the user of them

func (Binding) Help

func (b Binding) Help() string

Help returns a help string that is displayed on the right panel of the UI It should provided an overall summary of all available key options

func (Binding) Summary

func (b Binding) Summary() string

Summary returns a short summary of the provided `Binding` and is used as the helpful string displayed by the user's input field e.g. "[w,a,s,d,e,?] >>"

Jump to

Keyboard shortcuts

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