keyfun

package
v2.0.0-dev0.0.28 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: BSD-3-Clause Imports: 15 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AvailMapsChanged = false

AvailMapsChanged is used to update giv.KeyMapsView toolbars via following menu, toolbar props update methods -- not accurate if editing any other map but works for now..

View Source
var DefaultMap = MapName("MacEmacs")

DefaultMap is the overall default keymap -- reinitialized in gimain init() depending on platform

View Source
var PrefsMapsFileName = "key_maps_prefs.json"

PrefsMapsFileName is the name of the preferences file in GoGi prefs directory for saving / loading the default AvailMaps key maps list

View Source
var StdMaps = Maps{
	{"MacStd", "Standard Mac KeyMap", Map{
		"UpArrow":              MoveUp,
		"Shift+UpArrow":        MoveUp,
		"Meta+UpArrow":         MoveUp,
		"Control+P":            MoveUp,
		"Shift+Control+P":      MoveUp,
		"Meta+Control+P":       MoveUp,
		"DownArrow":            MoveDown,
		"Shift+DownArrow":      MoveDown,
		"Meta+DownArrow":       MoveDown,
		"Control+N":            MoveDown,
		"Shift+Control+N":      MoveDown,
		"Meta+Control+N":       MoveDown,
		"RightArrow":           MoveRight,
		"Shift+RightArrow":     MoveRight,
		"Meta+RightArrow":      End,
		"Control+F":            MoveRight,
		"Shift+Control+F":      MoveRight,
		"Meta+Control+F":       MoveRight,
		"LeftArrow":            MoveLeft,
		"Shift+LeftArrow":      MoveLeft,
		"Meta+LeftArrow":       Home,
		"Control+B":            MoveLeft,
		"Shift+Control+B":      MoveLeft,
		"Meta+Control+B":       MoveLeft,
		"PageUp":               PageUp,
		"Shift+PageUp":         PageUp,
		"Control+UpArrow":      PageUp,
		"Control+U":            PageUp,
		"PageDown":             PageDown,
		"Shift+PageDown":       PageDown,
		"Control+DownArrow":    PageDown,
		"Shift+Control+V":      PageDown,
		"Alt+√":                PageDown,
		"Alt+V":                PageDown,
		"Meta+Home":            DocHome,
		"Shift+Home":           DocHome,
		"Meta+H":               DocHome,
		"Meta+End":             DocEnd,
		"Shift+End":            DocEnd,
		"Meta+L":               DocEnd,
		"Control+RightArrow":   WordRight,
		"Control+LeftArrow":    WordLeft,
		"Alt+RightArrow":       WordRight,
		"Shift+Alt+RightArrow": WordRight,
		"Alt+LeftArrow":        WordLeft,
		"Shift+Alt+LeftArrow":  WordLeft,
		"Home":                 Home,
		"Control+A":            Home,
		"Shift+Control+A":      Home,
		"End":                  End,
		"Control+E":            End,
		"Shift+Control+E":      End,
		"Tab":                  FocusNext,
		"Shift+Tab":            FocusPrev,
		"ReturnEnter":          Enter,
		"KeypadEnter":          Enter,
		"Meta+A":               SelectAll,
		"Control+G":            CancelSelect,
		"Control+Spacebar":     SelectMode,
		"Control+ReturnEnter":  Accept,
		"Escape":               Abort,
		"Backspace":            Backspace,
		"Control+Backspace":    BackspaceWord,
		"Alt+Backspace":        BackspaceWord,
		"Delete":               Delete,
		"Control+Delete":       DeleteWord,
		"Alt+Delete":           DeleteWord,
		"Control+D":            Delete,
		"Control+K":            Kill,
		"Alt+∑":                Copy,
		"Alt+C":                Copy,
		"Meta+C":               Copy,
		"Control+W":            Cut,
		"Meta+X":               Cut,
		"Control+Y":            Paste,
		"Control+V":            Paste,
		"Meta+V":               Paste,
		"Shift+Meta+V":         PasteHist,
		"Alt+D":                Duplicate,
		"Control+T":            Transpose,
		"Alt+T":                TransposeWord,
		"Control+Z":            Undo,
		"Meta+Z":               Undo,
		"Shift+Control+Z":      Redo,
		"Shift+Meta+Z":         Redo,
		"Control+I":            Insert,
		"Control+O":            InsertAfter,
		"Shift+Meta+=":         ZoomIn,
		"Meta+=":               ZoomIn,
		"Meta+-":               ZoomOut,
		"Control+=":            ZoomIn,
		"Shift+Control++":      ZoomIn,
		"Shift+Meta+-":         ZoomOut,
		"Control+-":            ZoomOut,
		"Shift+Control+_":      ZoomOut,
		"Control+Alt+P":        Prefs,
		"F5":                   Refresh,
		"Control+L":            Recenter,
		"Control+.":            Complete,
		"Control+,":            Lookup,
		"Control+S":            Search,
		"Meta+F":               Find,
		"Meta+R":               Replace,
		"Control+J":            Jump,
		"Control+[":            HistPrev,
		"Control+]":            HistNext,
		"Meta+[":               HistPrev,
		"Meta+]":               HistNext,
		"F10":                  Menu,
		"Control+M":            Menu,
		"Meta+`":               WinFocusNext,
		"Meta+W":               WinClose,
		"Control+Alt+G":        WinSnapshot,
		"Shift+Control+G":      WinSnapshot,
		"Control+Alt+I":        Inspector,
		"Shift+Control+I":      Inspector,
		"Meta+N":               New,
		"Shift+Meta+N":         NewAlt1,
		"Alt+Meta+N":           NewAlt2,
		"Meta+O":               Open,
		"Shift+Meta+O":         OpenAlt1,
		"Alt+Meta+O":           OpenAlt2,
		"Meta+S":               Save,
		"Shift+Meta+S":         SaveAs,
		"Alt+Meta+S":           SaveAlt,
		"Shift+Meta+W":         CloseAlt1,
		"Alt+Meta+W":           CloseAlt2,
	}},
	{"MacEmacs", "Mac with emacs-style navigation -- emacs wins in conflicts", Map{
		"UpArrow":              MoveUp,
		"Shift+UpArrow":        MoveUp,
		"Meta+UpArrow":         MoveUp,
		"Control+P":            MoveUp,
		"Shift+Control+P":      MoveUp,
		"Meta+Control+P":       MoveUp,
		"DownArrow":            MoveDown,
		"Shift+DownArrow":      MoveDown,
		"Meta+DownArrow":       MoveDown,
		"Control+N":            MoveDown,
		"Shift+Control+N":      MoveDown,
		"Meta+Control+N":       MoveDown,
		"RightArrow":           MoveRight,
		"Shift+RightArrow":     MoveRight,
		"Meta+RightArrow":      End,
		"Control+F":            MoveRight,
		"Shift+Control+F":      MoveRight,
		"Meta+Control+F":       MoveRight,
		"LeftArrow":            MoveLeft,
		"Shift+LeftArrow":      MoveLeft,
		"Meta+LeftArrow":       Home,
		"Control+B":            MoveLeft,
		"Shift+Control+B":      MoveLeft,
		"Meta+Control+B":       MoveLeft,
		"PageUp":               PageUp,
		"Shift+PageUp":         PageUp,
		"Control+UpArrow":      PageUp,
		"Control+U":            PageUp,
		"PageDown":             PageDown,
		"Shift+PageDown":       PageDown,
		"Control+DownArrow":    PageDown,
		"Shift+Control+V":      PageDown,
		"Alt+√":                PageDown,
		"Alt+V":                PageDown,
		"Control+V":            PageDown,
		"Control+RightArrow":   WordRight,
		"Control+LeftArrow":    WordLeft,
		"Alt+RightArrow":       WordRight,
		"Shift+Alt+RightArrow": WordRight,
		"Alt+LeftArrow":        WordLeft,
		"Shift+Alt+LeftArrow":  WordLeft,
		"Home":                 Home,
		"Control+A":            Home,
		"Shift+Control+A":      Home,
		"End":                  End,
		"Control+E":            End,
		"Shift+Control+E":      End,
		"Meta+Home":            DocHome,
		"Shift+Home":           DocHome,
		"Meta+H":               DocHome,
		"Control+H":            DocHome,
		"Control+Alt+A":        DocHome,
		"Meta+End":             DocEnd,
		"Shift+End":            DocEnd,
		"Meta+L":               DocEnd,
		"Control+Alt+E":        DocEnd,
		"Alt+Ƒ":                WordRight,
		"Alt+F":                WordRight,
		"Alt+∫":                WordLeft,
		"Alt+B":                WordLeft,
		"Tab":                  FocusNext,
		"Shift+Tab":            FocusPrev,
		"ReturnEnter":          Enter,
		"KeypadEnter":          Enter,
		"Meta+A":               SelectAll,
		"Control+G":            CancelSelect,
		"Control+Spacebar":     SelectMode,
		"Control+ReturnEnter":  Accept,
		"Escape":               Abort,
		"Backspace":            Backspace,
		"Control+Backspace":    BackspaceWord,
		"Alt+Backspace":        BackspaceWord,
		"Delete":               Delete,
		"Control+Delete":       DeleteWord,
		"Alt+Delete":           DeleteWord,
		"Control+D":            Delete,
		"Control+K":            Kill,
		"Alt+∑":                Copy,
		"Alt+C":                Copy,
		"Meta+C":               Copy,
		"Control+W":            Cut,
		"Meta+X":               Cut,
		"Control+Y":            Paste,
		"Meta+V":               Paste,
		"Shift+Meta+V":         PasteHist,
		"Shift+Control+Y":      PasteHist,
		"Alt+∂":                Duplicate,
		"Alt+D":                Duplicate,
		"Control+T":            Transpose,
		"Alt+T":                TransposeWord,
		"Control+Z":            Undo,
		"Meta+Z":               Undo,
		"Control+/":            Undo,
		"Shift+Control+Z":      Redo,
		"Shift+Meta+Z":         Redo,
		"Control+I":            Insert,
		"Control+O":            InsertAfter,
		"Shift+Meta+=":         ZoomIn,
		"Meta+=":               ZoomIn,
		"Meta+-":               ZoomOut,
		"Control+=":            ZoomIn,
		"Shift+Control++":      ZoomIn,
		"Shift+Meta+-":         ZoomOut,
		"Control+-":            ZoomOut,
		"Shift+Control+_":      ZoomOut,
		"Control+Alt+P":        Prefs,
		"F5":                   Refresh,
		"Control+L":            Recenter,
		"Control+.":            Complete,
		"Control+,":            Lookup,
		"Control+S":            Search,
		"Meta+F":               Find,
		"Meta+R":               Replace,
		"Control+R":            Replace,
		"Control+J":            Jump,
		"Control+[":            HistPrev,
		"Control+]":            HistNext,
		"Meta+[":               HistPrev,
		"Meta+]":               HistNext,
		"F10":                  Menu,
		"Control+M":            Menu,
		"Meta+`":               WinFocusNext,
		"Meta+W":               WinClose,
		"Control+Alt+G":        WinSnapshot,
		"Shift+Control+G":      WinSnapshot,
		"Control+Alt+I":        Inspector,
		"Shift+Control+I":      Inspector,
		"Meta+N":               New,
		"Shift+Meta+N":         NewAlt1,
		"Alt+Meta+N":           NewAlt2,
		"Meta+O":               Open,
		"Shift+Meta+O":         OpenAlt1,
		"Alt+Meta+O":           OpenAlt2,
		"Meta+S":               Save,
		"Shift+Meta+S":         SaveAs,
		"Alt+Meta+S":           SaveAlt,
		"Shift+Meta+W":         CloseAlt1,
		"Alt+Meta+W":           CloseAlt2,
	}},
	{"LinuxEmacs", "Linux with emacs-style navigation -- emacs wins in conflicts", Map{
		"UpArrow":             MoveUp,
		"Shift+UpArrow":       MoveUp,
		"Alt+UpArrow":         MoveUp,
		"Control+P":           MoveUp,
		"Shift+Control+P":     MoveUp,
		"Alt+Control+P":       MoveUp,
		"DownArrow":           MoveDown,
		"Shift+DownArrow":     MoveDown,
		"Alt+DownArrow":       MoveDown,
		"Control+N":           MoveDown,
		"Shift+Control+N":     MoveDown,
		"Alt+Control+N":       MoveDown,
		"RightArrow":          MoveRight,
		"Shift+RightArrow":    MoveRight,
		"Alt+RightArrow":      End,
		"Control+F":           MoveRight,
		"Shift+Control+F":     MoveRight,
		"Alt+Control+F":       MoveRight,
		"LeftArrow":           MoveLeft,
		"Shift+LeftArrow":     MoveLeft,
		"Alt+LeftArrow":       Home,
		"Control+B":           MoveLeft,
		"Shift+Control+B":     MoveLeft,
		"Alt+Control+B":       MoveLeft,
		"PageUp":              PageUp,
		"Shift+PageUp":        PageUp,
		"Control+UpArrow":     PageUp,
		"Control+U":           PageUp,
		"Shift+Control+U":     PageUp,
		"Alt+Control+U":       PageUp,
		"PageDown":            PageDown,
		"Shift+PageDown":      PageDown,
		"Control+DownArrow":   PageDown,
		"Control+V":           PageDown,
		"Shift+Control+V":     PageDown,
		"Alt+Control+V":       PageDown,
		"Alt+Home":            DocHome,
		"Shift+Home":          DocHome,
		"Alt+H":               DocHome,
		"Control+Alt+A":       DocHome,
		"Alt+End":             DocEnd,
		"Shift+End":           DocEnd,
		"Alt+L":               DocEnd,
		"Control+Alt+E":       DocEnd,
		"Control+RightArrow":  WordRight,
		"Control+LeftArrow":   WordLeft,
		"Home":                Home,
		"Control+A":           Home,
		"Shift+Control+A":     Home,
		"End":                 End,
		"Control+E":           End,
		"Shift+Control+E":     End,
		"Tab":                 FocusNext,
		"Shift+Tab":           FocusPrev,
		"ReturnEnter":         Enter,
		"KeypadEnter":         Enter,
		"Alt+A":               SelectAll,
		"Control+G":           CancelSelect,
		"Control+Spacebar":    SelectMode,
		"Control+ReturnEnter": Accept,
		"Escape":              Abort,
		"Backspace":           Backspace,
		"Control+Backspace":   BackspaceWord,
		"Delete":              Delete,
		"Control+D":           Delete,
		"Control+Delete":      DeleteWord,
		"Alt+Delete":          DeleteWord,
		"Control+K":           Kill,
		"Alt+W":               Copy,
		"Alt+C":               Copy,
		"Control+W":           Cut,
		"Alt+X":               Cut,
		"Control+Y":           Paste,
		"Alt+V":               Paste,
		"Shift+Alt+V":         PasteHist,
		"Shift+Control+Y":     PasteHist,
		"Alt+D":               Duplicate,
		"Control+T":           Transpose,
		"Alt+T":               TransposeWord,
		"Control+Z":           Undo,
		"Control+/":           Undo,
		"Shift+Control+Z":     Redo,
		"Control+I":           Insert,
		"Control+O":           InsertAfter,
		"Control+=":           ZoomIn,
		"Shift+Control++":     ZoomIn,
		"Control+-":           ZoomOut,
		"Shift+Control+_":     ZoomOut,
		"Control+Alt+P":       Prefs,
		"F5":                  Refresh,
		"Control+L":           Recenter,
		"Control+.":           Complete,
		"Control+,":           Lookup,
		"Control+S":           Search,
		"Alt+F":               Find,
		"Control+R":           Replace,
		"Control+J":           Jump,
		"Control+[":           HistPrev,
		"Control+]":           HistNext,
		"F10":                 Menu,
		"Control+M":           Menu,
		"Alt+F6":              WinFocusNext,
		"Shift+Control+W":     WinClose,
		"Control+Alt+G":       WinSnapshot,
		"Shift+Control+G":     WinSnapshot,
		"Control+Alt+I":       Inspector,
		"Shift+Control+I":     Inspector,
		"Alt+N":               New,
		"Shift+Alt+N":         NewAlt1,
		"Control+Alt+N":       NewAlt2,
		"Alt+O":               Open,
		"Shift+Alt+O":         OpenAlt1,
		"Control+Alt+O":       OpenAlt2,
		"Alt+S":               Save,
		"Shift+Alt+S":         SaveAs,
		"Control+Alt+S":       SaveAlt,
		"Shift+Alt+W":         CloseAlt1,
		"Control+Alt+W":       CloseAlt2,
	}},
	{"LinuxStd", "Standard Linux KeyMap", Map{
		"UpArrow":             MoveUp,
		"Shift+UpArrow":       MoveUp,
		"DownArrow":           MoveDown,
		"Shift+DownArrow":     MoveDown,
		"RightArrow":          MoveRight,
		"Shift+RightArrow":    MoveRight,
		"LeftArrow":           MoveLeft,
		"Shift+LeftArrow":     MoveLeft,
		"PageUp":              PageUp,
		"Shift+PageUp":        PageUp,
		"Control+UpArrow":     PageUp,
		"PageDown":            PageDown,
		"Shift+PageDown":      PageDown,
		"Control+DownArrow":   PageDown,
		"Home":                Home,
		"Alt+LeftArrow":       Home,
		"End":                 End,
		"Alt+Home":            DocHome,
		"Shift+Home":          DocHome,
		"Alt+End":             DocEnd,
		"Shift+End":           DocEnd,
		"Control+RightArrow":  WordRight,
		"Control+LeftArrow":   WordLeft,
		"Alt+RightArrow":      End,
		"Tab":                 FocusNext,
		"Shift+Tab":           FocusPrev,
		"ReturnEnter":         Enter,
		"KeypadEnter":         Enter,
		"Control+A":           SelectAll,
		"Shift+Control+A":     CancelSelect,
		"Control+G":           CancelSelect,
		"Control+Spacebar":    SelectMode,
		"Control+ReturnEnter": Accept,
		"Escape":              Abort,
		"Backspace":           Backspace,
		"Control+Backspace":   BackspaceWord,
		"Delete":              Delete,
		"Control+Delete":      DeleteWord,
		"Alt+Delete":          DeleteWord,
		"Control+K":           Kill,
		"Control+C":           Copy,
		"Control+X":           Cut,
		"Control+V":           Paste,
		"Shift+Control+V":     PasteHist,
		"Alt+D":               Duplicate,
		"Control+T":           Transpose,
		"Alt+T":               TransposeWord,
		"Control+Z":           Undo,
		"Control+Y":           Redo,
		"Shift+Control+Z":     Redo,
		"Control+Alt+I":       Insert,
		"Control+Alt+O":       InsertAfter,
		"Control+=":           ZoomIn,
		"Shift+Control++":     ZoomIn,
		"Control+-":           ZoomOut,
		"Shift+Control+_":     ZoomOut,
		"Shift+Control+P":     Prefs,
		"Control+Alt+P":       Prefs,
		"F5":                  Refresh,
		"Control+L":           Recenter,
		"Control+.":           Complete,
		"Control+,":           Lookup,
		"Alt+S":               Search,
		"Control+F":           Find,
		"Control+H":           Replace,
		"Control+R":           Replace,
		"Control+J":           Jump,
		"Control+[":           HistPrev,
		"Control+]":           HistNext,
		"Control+N":           New,
		"F10":                 Menu,
		"Control+M":           Menu,
		"Alt+F6":              WinFocusNext,
		"Control+W":           WinClose,
		"Control+Alt+G":       WinSnapshot,
		"Shift+Control+G":     WinSnapshot,
		"Shift+Control+I":     Inspector,
		"Shift+Control+N":     NewAlt1,
		"Control+Alt+N":       NewAlt2,
		"Control+O":           Open,
		"Shift+Control+O":     OpenAlt1,
		"Shift+Alt+O":         OpenAlt2,
		"Control+S":           Save,
		"Shift+Control+S":     SaveAs,
		"Control+Alt+S":       SaveAlt,
		"Shift+Control+W":     CloseAlt1,
		"Control+Alt+W":       CloseAlt2,
	}},
	{"WindowsStd", "Standard Windows KeyMap", Map{
		"UpArrow":             MoveUp,
		"Shift+UpArrow":       MoveUp,
		"DownArrow":           MoveDown,
		"Shift+DownArrow":     MoveDown,
		"RightArrow":          MoveRight,
		"Shift+RightArrow":    MoveRight,
		"LeftArrow":           MoveLeft,
		"Shift+LeftArrow":     MoveLeft,
		"PageUp":              PageUp,
		"Shift+PageUp":        PageUp,
		"Control+UpArrow":     PageUp,
		"PageDown":            PageDown,
		"Shift+PageDown":      PageDown,
		"Control+DownArrow":   PageDown,
		"Home":                Home,
		"Alt+LeftArrow":       Home,
		"End":                 End,
		"Alt+RightArrow":      End,
		"Alt+Home":            DocHome,
		"Shift+Home":          DocHome,
		"Alt+End":             DocEnd,
		"Shift+End":           DocEnd,
		"Control+RightArrow":  WordRight,
		"Control+LeftArrow":   WordLeft,
		"Tab":                 FocusNext,
		"Shift+Tab":           FocusPrev,
		"ReturnEnter":         Enter,
		"KeypadEnter":         Enter,
		"Control+A":           SelectAll,
		"Shift+Control+A":     CancelSelect,
		"Control+G":           CancelSelect,
		"Control+Spacebar":    SelectMode,
		"Control+ReturnEnter": Accept,
		"Escape":              Abort,
		"Backspace":           Backspace,
		"Control+Backspace":   BackspaceWord,
		"Delete":              Delete,
		"Control+Delete":      DeleteWord,
		"Alt+Delete":          DeleteWord,
		"Control+K":           Kill,
		"Control+C":           Copy,
		"Control+X":           Cut,
		"Control+V":           Paste,
		"Shift+Control+V":     PasteHist,
		"Alt+D":               Duplicate,
		"Control+T":           Transpose,
		"Alt+T":               TransposeWord,
		"Control+Z":           Undo,
		"Control+Y":           Redo,
		"Shift+Control+Z":     Redo,
		"Control+Alt+I":       Insert,
		"Control+Alt+O":       InsertAfter,
		"Control+=":           ZoomIn,
		"Shift+Control++":     ZoomIn,
		"Control+-":           ZoomOut,
		"Shift+Control+_":     ZoomOut,
		"Shift+Control+P":     Prefs,
		"Control+Alt+P":       Prefs,
		"F5":                  Refresh,
		"Control+L":           Recenter,
		"Control+.":           Complete,
		"Control+,":           Lookup,
		"Alt+S":               Search,
		"Control+F":           Find,
		"Control+H":           Replace,
		"Control+R":           Replace,
		"Control+J":           Jump,
		"Control+[":           HistPrev,
		"Control+]":           HistNext,
		"F10":                 Menu,
		"Control+M":           Menu,
		"Alt+F6":              WinFocusNext,
		"Control+W":           WinClose,
		"Control+Alt+G":       WinSnapshot,
		"Shift+Control+G":     WinSnapshot,
		"Shift+Control+I":     Inspector,
		"Control+N":           New,
		"Shift+Control+N":     NewAlt1,
		"Control+Alt+N":       NewAlt2,
		"Control+O":           Open,
		"Shift+Control+O":     OpenAlt1,
		"Shift+Alt+O":         OpenAlt2,
		"Control+S":           Save,
		"Shift+Control+S":     SaveAs,
		"Control+Alt+S":       SaveAlt,
		"Shift+Control+W":     CloseAlt1,
		"Control+Alt+W":       CloseAlt2,
	}},
	{"ChromeStd", "Standard chrome-browser and linux-under-chrome bindings", Map{
		"UpArrow":             MoveUp,
		"Shift+UpArrow":       MoveUp,
		"DownArrow":           MoveDown,
		"Shift+DownArrow":     MoveDown,
		"RightArrow":          MoveRight,
		"Shift+RightArrow":    MoveRight,
		"LeftArrow":           MoveLeft,
		"Shift+LeftArrow":     MoveLeft,
		"PageUp":              PageUp,
		"Shift+PageUp":        PageUp,
		"Control+UpArrow":     PageUp,
		"PageDown":            PageDown,
		"Shift+PageDown":      PageDown,
		"Control+DownArrow":   PageDown,
		"Home":                Home,
		"Alt+LeftArrow":       Home,
		"End":                 End,
		"Alt+Home":            DocHome,
		"Shift+Home":          DocHome,
		"Alt+End":             DocEnd,
		"Shift+End":           DocEnd,
		"Control+RightArrow":  WordRight,
		"Control+LeftArrow":   WordLeft,
		"Alt+RightArrow":      End,
		"Tab":                 FocusNext,
		"Shift+Tab":           FocusPrev,
		"ReturnEnter":         Enter,
		"KeypadEnter":         Enter,
		"Control+A":           SelectAll,
		"Shift+Control+A":     CancelSelect,
		"Control+G":           CancelSelect,
		"Control+Spacebar":    SelectMode,
		"Control+ReturnEnter": Accept,
		"Escape":              Abort,
		"Backspace":           Backspace,
		"Control+Backspace":   BackspaceWord,
		"Delete":              Delete,
		"Control+Delete":      DeleteWord,
		"Alt+Delete":          DeleteWord,
		"Control+K":           Kill,
		"Control+C":           Copy,
		"Control+X":           Cut,
		"Control+V":           Paste,
		"Shift+Control+V":     PasteHist,
		"Alt+D":               Duplicate,
		"Control+T":           Transpose,
		"Alt+T":               TransposeWord,
		"Control+Z":           Undo,
		"Control+Y":           Redo,
		"Shift+Control+Z":     Redo,
		"Control+Alt+I":       Insert,
		"Control+Alt+O":       InsertAfter,
		"Control+=":           ZoomIn,
		"Shift+Control++":     ZoomIn,
		"Control+-":           ZoomOut,
		"Shift+Control+_":     ZoomOut,
		"Shift+Control+P":     Prefs,
		"Control+Alt+P":       Prefs,
		"F5":                  Refresh,
		"Control+L":           Recenter,
		"Control+.":           Complete,
		"Control+,":           Lookup,
		"Alt+S":               Search,
		"Control+F":           Find,
		"Control+H":           Replace,
		"Control+R":           Replace,
		"Control+J":           Jump,
		"Control+[":           HistPrev,
		"Control+]":           HistNext,
		"F10":                 Menu,
		"Control+M":           Menu,
		"Alt+F6":              WinFocusNext,
		"Control+W":           WinClose,
		"Control+Alt+G":       WinSnapshot,
		"Shift+Control+G":     WinSnapshot,
		"Shift+Control+I":     Inspector,
		"Control+N":           New,
		"Shift+Control+N":     NewAlt1,
		"Control+Alt+N":       NewAlt2,
		"Control+O":           Open,
		"Shift+Control+O":     OpenAlt1,
		"Shift+Alt+O":         OpenAlt2,
		"Control+S":           Save,
		"Shift+Control+S":     SaveAs,
		"Control+Alt+S":       SaveAlt,
		"Shift+Control+W":     CloseAlt1,
		"Control+Alt+W":       CloseAlt2,
	}},
}

StdMaps is the original compiled-in set of standard keymaps that have the lastest key functions bound to standard key chords.

Functions

func ChordFor

func ChordFor(kf Funs) key.Chord

ChordForFun returns first key chord trigger for given KeyFun in the current active map

func SetActiveMap

func SetActiveMap(km *Map, kmName MapName)

SetActiveMap sets the current ActiveKeyMap, calling Update on the map prior to setting it to ensure that it is a valid, complete map

func SetActiveMapName

func SetActiveMapName(mapnm MapName)

SetActiveMapName sets the current ActiveKeyMap by name from those defined in AvailKeyMaps, calling Update on the map prior to setting it to ensure that it is a valid, complete map

func ShortcutFor

func ShortcutFor(kf Funs) key.Chord

ShortcutFor returns OS-specific formatted shortcut for first key chord trigger for given KeyFun in the current active map

Types

type Funs

type Funs int32 //enums:enum -no-line-comment

Funs are functions that keyboard events can perform in the GUI. It seems possible to keep this flat and consistent across different contexts, as long as the functions can be appropriately reinterpreted for each context.

const (
	Nil Funs = iota
	MoveUp
	MoveDown
	MoveRight
	MoveLeft
	PageUp
	PageDown
	// PageRight
	// PageLeft
	Home    // start-of-line
	End     // end-of-line
	DocHome // start-of-doc -- Control / Alt / Shift +Home
	DocEnd  // end-of-doc Control / Alt / Shift +End
	WordRight
	WordLeft
	FocusNext // Tab
	FocusPrev // Shift-Tab
	Enter     // Enter / return key -- has various special functions
	Accept    // Ctrl+Enter = accept any changes and close dialog / move to next
	CancelSelect
	SelectMode
	SelectAll
	Abort
	// EditItem
	Copy
	Cut
	Paste
	PasteHist // from history
	Backspace
	BackspaceWord
	Delete
	DeleteWord
	Kill
	Duplicate
	Transpose
	TransposeWord
	Undo
	Redo
	Insert
	InsertAfter
	ZoomOut
	ZoomIn
	Prefs
	Refresh
	Recenter // Ctrl+L in emacs
	Complete
	Lookup
	Search // Ctrl+S in emacs -- more interactive type of search
	Find   // Command+F full-dialog find
	Replace
	Jump // jump to line
	HistPrev
	HistNext
	Menu // put focus on menu
	WinFocusNext
	WinClose
	WinSnapshot
	Inspector
	// Below are menu specific functions -- use these as shortcuts for menu buttons
	// allows uniqueness of mapping and easy customization of all key buttons
	New
	NewAlt1 // alternative version (e.g., shift)
	NewAlt2 // alternative version (e.g., alt)
	Open
	OpenAlt1 // alternative version (e.g., shift)
	OpenAlt2 // alternative version (e.g., alt)
	Save
	SaveAs
	SaveAlt   // another alt (e.g., alt)
	CloseAlt1 // alternative version (e.g., shift)
	CloseAlt2 // alternative version (e.g., alt)
)
const FunsN Funs = 66

FunsN is the highest valid value for type Funs, plus one.

func FunsValues

func FunsValues() []Funs

FunsValues returns all possible values for the type Funs.

func Of

func Of(chord key.Chord) Funs

Of translates chord into keyboard function -- use goosi key.Chord to get chord

func (Funs) Desc

func (i Funs) Desc() string

Desc returns the description of the Funs value.

func (Funs) Int64

func (i Funs) Int64() int64

Int64 returns the Funs value as an int64.

func (Funs) IsValid

func (i Funs) IsValid() bool

IsValid returns whether the value is a valid option for type Funs.

func (Funs) MarshalText

func (i Funs) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*Funs) SetInt64

func (i *Funs) SetInt64(in int64)

SetInt64 sets the Funs value from an int64.

func (*Funs) SetString

func (i *Funs) SetString(s string) error

SetString sets the Funs value from its string representation, and returns an error if the string is invalid.

func (Funs) String

func (i Funs) String() string

String returns the string representation of this Funs value.

func (*Funs) UnmarshalText

func (i *Funs) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (Funs) Values

func (i Funs) Values() []enums.Enum

Values returns all possible values for the type Funs.

type Map

type Map map[key.Chord]Funs

Map is a map between a key sequence (chord) and a specific KeyFun function. This mapping must be unique, in that each chord has unique KeyFun, but multiple chords can trigger the same function.

var ActiveMap *Map

ActiveMap points to the active map -- users can set this to an alternative map in Prefs

func (*Map) ChordFor

func (km *Map) ChordFor(kf Funs) key.Chord

ChordForFun returns first key chord trigger for given KeyFun in map

func (*Map) ShortcutFor

func (km *Map) ShortcutFor(kf Funs) key.Chord

ShortcutForFun returns OS-specific formatted shortcut for first key chord trigger for given KeyFun in map

func (*Map) ToSlice

func (km *Map) ToSlice() []MapItem

ToSlice copies this keymap to a slice of KeyMapItem's

func (*Map) Update

func (km *Map) Update(kmName MapName)

Update ensures that the given keymap has at least one entry for every defined KeyFun, grabbing ones from the default map if not, and also eliminates any Nil entries which might reflect out-of-date functions

type MapItem

type MapItem struct {

	// the key chord that activates a function
	Key key.Chord

	// the function of that key
	Fun Funs
}

MapItem records one element of the key map -- used for organizing the map.

type MapName

type MapName string

MapName has an associated Value for selecting from the list of available key map names, for use in preferences etc.

var ActiveMapName MapName

ActiveMapName is the name of the active keymap

type Maps

type Maps []MapsItem //gti:add

Maps is a list of KeyMap's -- users can edit these in Prefs -- to create a custom one, just duplicate an existing map, rename, and customize

var AvailMaps Maps

AvailMaps is the current list of available keymaps for use -- can be loaded / saved / edited with preferences. This is set to StdKeyMaps at startup.

func (*Maps) CopyFrom

func (km *Maps) CopyFrom(cp Maps)

CopyFrom copies keymaps from given other map

func (*Maps) MapByName

func (km *Maps) MapByName(name MapName) (*Map, int, bool)

MapByName returns a keymap and index by name -- returns false and emits a message to stdout if not found

func (*Maps) MarkdownDoc

func (km *Maps) MarkdownDoc() string

MarkdownDoc generates a markdown table of all the key mappings

func (*Maps) Open

func (km *Maps) Open(filename string) error

Open opens keymaps from a json-formatted file. You can save and open key maps to / from files to share, experiment, transfer, etc

func (*Maps) OpenPrefs

func (km *Maps) OpenPrefs() error

OpenPrefs opens KeyMaps from GoGi standard prefs directory, in file key_maps_prefs.json. This is called automatically, so calling it manually should not be necessary in most cases.

func (*Maps) RevertToStd

func (km *Maps) RevertToStd()

RevertToStd reverts the keymaps to using the StdKeyMaps that are compiled into the program and have all the lastest key functions defined. If you have edited your maps, and are finding things not working, it is a good idea to save your current maps and try this, or at least do ViewStdMaps to see the current standards. Your current map edits will be lost if you proceed!

func (*Maps) Save

func (km *Maps) Save(filename string) error

Save saves keymaps to a json-formatted file. You can save and open key maps to / from files to share, experiment, transfer, etc

func (*Maps) SavePrefs

func (km *Maps) SavePrefs() error

SavePrefs saves KeyMaps to GoGi standard prefs directory, in file key_maps_prefs.json, which will be loaded automatically at startup if prefs SaveKeyMaps is checked (should be if you're using custom keymaps)

type MapsItem

type MapsItem struct {

	// name of keymap
	Name string `width:"20"`

	// description of keymap -- good idea to include source it was derived from
	Desc string

	// to edit key sequence click button and type new key combination; to edit function mapped to key sequence choose from menu
	Map Map
}

MapsItem is an entry in a Maps list

func (MapsItem) Label

func (km MapsItem) Label() string

Label satisfies the Labeler interface

func (*MapsItem) SetDesc

func (t *MapsItem) SetDesc(v string) *MapsItem

SetDesc sets the [MapsItem.Desc]: description of keymap -- good idea to include source it was derived from

func (*MapsItem) SetMap

func (t *MapsItem) SetMap(v Map) *MapsItem

SetMap sets the [MapsItem.Map]: to edit key sequence click button and type new key combination; to edit function mapped to key sequence choose from menu

func (*MapsItem) SetName

func (t *MapsItem) SetName(v string) *MapsItem

SetName sets the [MapsItem.Name]: name of keymap

Jump to

Keyboard shortcuts

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