keymap

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: BSD-3-Clause Imports: 10 Imported by: 6

Documentation

Overview

Package keymap implements maps from keyboard shortcuts to semantic GUI keyboard functions.

Index

Constants

This section is empty.

Variables

View Source
var StandardMaps = Maps{
	{"MacStandard", "Standard Mac KeyMap", Map{
		"UpArrow":              MoveUp,
		"Shift+UpArrow":        MoveUp,
		"Meta+UpArrow":         MoveUp,
		"Control+P":            MoveUp,
		"Control+Shift+P":      MoveUp,
		"Control+Meta+P":       MoveUp,
		"DownArrow":            MoveDown,
		"Shift+DownArrow":      MoveDown,
		"Meta+DownArrow":       MoveDown,
		"Control+N":            MoveDown,
		"Control+Shift+N":      MoveDown,
		"Control+Meta+N":       MoveDown,
		"RightArrow":           MoveRight,
		"Shift+RightArrow":     MoveRight,
		"Meta+RightArrow":      End,
		"Control+F":            MoveRight,
		"Control+Shift+F":      MoveRight,
		"Control+Meta+F":       MoveRight,
		"LeftArrow":            MoveLeft,
		"Shift+LeftArrow":      MoveLeft,
		"Meta+LeftArrow":       Home,
		"Control+B":            MoveLeft,
		"Control+Shift+B":      MoveLeft,
		"Control+Meta+B":       MoveLeft,
		"PageUp":               PageUp,
		"Shift+PageUp":         PageUp,
		"Control+UpArrow":      PageUp,
		"Control+U":            PageUp,
		"PageDown":             PageDown,
		"Shift+PageDown":       PageDown,
		"Control+DownArrow":    PageDown,
		"Control+Shift+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,
		"Alt+Shift+RightArrow": WordRight,
		"Alt+LeftArrow":        WordLeft,
		"Alt+Shift+LeftArrow":  WordLeft,
		"Home":                 Home,
		"Control+A":            Home,
		"Control+Shift+A":      Home,
		"End":                  End,
		"Control+E":            End,
		"Control+Shift+E":      End,
		"Tab":                  FocusNext,
		"Shift+Tab":            FocusPrev,
		"ReturnEnter":          Enter,
		"KeypadEnter":          Enter,
		"Meta+A":               SelectAll,
		"Control+G":            CancelSelect,
		"Control+Spacebar":     SelectMode,
		"Control+ReturnEnter":  Accept,
		"Meta+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,
		"Meta+Shift+V":         PasteHist,
		"Alt+D":                Duplicate,
		"Control+T":            Transpose,
		"Alt+T":                TransposeWord,
		"Control+Z":            Undo,
		"Meta+Z":               Undo,
		"Control+Shift+Z":      Redo,
		"Meta+Shift+Z":         Redo,
		"Control+I":            Insert,
		"Control+O":            InsertAfter,
		"Meta+Shift+=":         ZoomIn,
		"Meta+=":               ZoomIn,
		"Meta+-":               ZoomOut,
		"Control+=":            ZoomIn,
		"Control+Shift++":      ZoomIn,
		"Meta+Shift+-":         ZoomOut,
		"Control+-":            ZoomOut,
		"Control+Shift+_":      ZoomOut,
		"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,
		"Control+Shift+G":      WinSnapshot,
		"Meta+N":               New,
		"Meta+Shift+N":         NewAlt1,
		"Meta+Alt+N":           NewAlt2,
		"Meta+O":               Open,
		"Meta+Shift+O":         OpenAlt1,
		"Meta+Alt+O":           OpenAlt2,
		"Meta+S":               Save,
		"Meta+Shift+S":         SaveAs,
		"Meta+Alt+S":           SaveAlt,
		"Meta+Shift+W":         CloseAlt1,
		"Meta+Alt+W":           CloseAlt2,
	}},
	{"MacEmacs", "Mac with emacs-style navigation -- emacs wins in conflicts", Map{
		"UpArrow":              MoveUp,
		"Shift+UpArrow":        MoveUp,
		"Meta+UpArrow":         MoveUp,
		"Control+P":            MoveUp,
		"Control+Shift+P":      MoveUp,
		"Control+Meta+P":       MoveUp,
		"DownArrow":            MoveDown,
		"Shift+DownArrow":      MoveDown,
		"Meta+DownArrow":       MoveDown,
		"Control+N":            MoveDown,
		"Control+Shift+N":      MoveDown,
		"Control+Meta+N":       MoveDown,
		"RightArrow":           MoveRight,
		"Shift+RightArrow":     MoveRight,
		"Meta+RightArrow":      End,
		"Control+F":            MoveRight,
		"Control+Shift+F":      MoveRight,
		"Control+Meta+F":       MoveRight,
		"LeftArrow":            MoveLeft,
		"Shift+LeftArrow":      MoveLeft,
		"Meta+LeftArrow":       Home,
		"Control+B":            MoveLeft,
		"Control+Shift+B":      MoveLeft,
		"Control+Meta+B":       MoveLeft,
		"PageUp":               PageUp,
		"Shift+PageUp":         PageUp,
		"Control+UpArrow":      PageUp,
		"Control+U":            PageUp,
		"PageDown":             PageDown,
		"Shift+PageDown":       PageDown,
		"Control+DownArrow":    PageDown,
		"Control+Shift+V":      PageDown,
		"Alt+√":                PageDown,
		"Alt+V":                PageDown,
		"Control+V":            PageDown,
		"Control+RightArrow":   WordRight,
		"Control+LeftArrow":    WordLeft,
		"Alt+RightArrow":       WordRight,
		"Alt+Shift+RightArrow": WordRight,
		"Alt+LeftArrow":        WordLeft,
		"Alt+Shift+LeftArrow":  WordLeft,
		"Home":                 Home,
		"Control+A":            Home,
		"Control+Shift+A":      Home,
		"End":                  End,
		"Control+E":            End,
		"Control+Shift+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,
		"Meta+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,
		"Meta+Shift+V":         PasteHist,
		"Control+Shift+Y":      PasteHist,
		"Alt+∂":                Duplicate,
		"Alt+D":                Duplicate,
		"Control+T":            Transpose,
		"Alt+T":                TransposeWord,
		"Control+Z":            Undo,
		"Meta+Z":               Undo,
		"Control+/":            Undo,
		"Control+Shift+Z":      Redo,
		"Meta+Shift+Z":         Redo,
		"Control+I":            Insert,
		"Control+O":            InsertAfter,
		"Meta+Shift+=":         ZoomIn,
		"Meta+=":               ZoomIn,
		"Meta+-":               ZoomOut,
		"Control+=":            ZoomIn,
		"Control+Shift++":      ZoomIn,
		"Meta+Shift+-":         ZoomOut,
		"Control+-":            ZoomOut,
		"Control+Shift+_":      ZoomOut,
		"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,
		"Control+Shift+G":      WinSnapshot,
		"Meta+N":               New,
		"Meta+Shift+N":         NewAlt1,
		"Meta+Alt+N":           NewAlt2,
		"Meta+O":               Open,
		"Meta+Shift+O":         OpenAlt1,
		"Meta+Alt+O":           OpenAlt2,
		"Meta+S":               Save,
		"Meta+Shift+S":         SaveAs,
		"Meta+Alt+S":           SaveAlt,
		"Meta+Shift+W":         CloseAlt1,
		"Meta+Alt+W":           CloseAlt2,
	}},
	{"LinuxEmacs", "Linux with emacs-style navigation -- emacs wins in conflicts", Map{
		"UpArrow":             MoveUp,
		"Shift+UpArrow":       MoveUp,
		"Alt+UpArrow":         MoveUp,
		"Control+P":           MoveUp,
		"Control+Shift+P":     MoveUp,
		"Control+Alt+P":       MoveUp,
		"DownArrow":           MoveDown,
		"Shift+DownArrow":     MoveDown,
		"Alt+DownArrow":       MoveDown,
		"Control+N":           MoveDown,
		"Control+Shift+N":     MoveDown,
		"Control+Alt+N":       MoveDown,
		"RightArrow":          MoveRight,
		"Shift+RightArrow":    MoveRight,
		"Alt+RightArrow":      End,
		"Control+F":           MoveRight,
		"Control+Shift+F":     MoveRight,
		"Control+Alt+F":       MoveRight,
		"LeftArrow":           MoveLeft,
		"Shift+LeftArrow":     MoveLeft,
		"Alt+LeftArrow":       Home,
		"Control+B":           MoveLeft,
		"Control+Shift+B":     MoveLeft,
		"Control+Alt+B":       MoveLeft,
		"PageUp":              PageUp,
		"Shift+PageUp":        PageUp,
		"Control+UpArrow":     PageUp,
		"Control+U":           PageUp,
		"Control+Shift+U":     PageUp,
		"Control+Alt+U":       PageUp,
		"PageDown":            PageDown,
		"Shift+PageDown":      PageDown,
		"Control+DownArrow":   PageDown,
		"Control+V":           PageDown,
		"Control+Shift+V":     PageDown,
		"Control+Alt+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,
		"Control+Shift+A":     Home,
		"End":                 End,
		"Control+E":           End,
		"Control+Shift+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,
		"Alt+Shift+V":         PasteHist,
		"Control+Shift+Y":     PasteHist,
		"Alt+D":               Duplicate,
		"Control+T":           Transpose,
		"Alt+T":               TransposeWord,
		"Control+Z":           Undo,
		"Control+/":           Undo,
		"Control+Shift+Z":     Redo,
		"Control+I":           Insert,
		"Control+O":           InsertAfter,
		"Control+=":           ZoomIn,
		"Control+Shift++":     ZoomIn,
		"Control+-":           ZoomOut,
		"Control+Shift+_":     ZoomOut,
		"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,
		"Control+Shift+W":     WinClose,
		"Control+Alt+G":       WinSnapshot,
		"Control+Shift+G":     WinSnapshot,
		"Alt+N":               New,
		"Alt+Shift+N":         NewAlt1,
		"Alt+O":               Open,
		"Alt+Shift+O":         OpenAlt1,
		"Control+Alt+O":       OpenAlt2,
		"Alt+S":               Save,
		"Alt+Shift+S":         SaveAs,
		"Control+Alt+S":       SaveAlt,
		"Alt+Shift+W":         CloseAlt1,
		"Control+Alt+W":       CloseAlt2,
	}},
	{"LinuxStandard", "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,
		"Control+Shift+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,
		"Control+Shift+V":     PasteHist,
		"Alt+D":               Duplicate,
		"Control+T":           Transpose,
		"Alt+T":               TransposeWord,
		"Control+Z":           Undo,
		"Control+Y":           Redo,
		"Control+Shift+Z":     Redo,
		"Control+Alt+I":       Insert,
		"Control+Alt+O":       InsertAfter,
		"Control+=":           ZoomIn,
		"Control+Shift++":     ZoomIn,
		"Control+-":           ZoomOut,
		"Control+Shift+_":     ZoomOut,
		"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,
		"Control+Shift+G":     WinSnapshot,
		"Control+Shift+N":     NewAlt1,
		"Control+Alt+N":       NewAlt2,
		"Control+O":           Open,
		"Control+Shift+O":     OpenAlt1,
		"Alt+Shift+O":         OpenAlt2,
		"Control+S":           Save,
		"Control+Shift+S":     SaveAs,
		"Control+Alt+S":       SaveAlt,
		"Control+Shift+W":     CloseAlt1,
		"Control+Alt+W":       CloseAlt2,
	}},
	{"WindowsStandard", "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,
		"Control+Shift+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,
		"Control+Shift+V":     PasteHist,
		"Alt+D":               Duplicate,
		"Control+T":           Transpose,
		"Alt+T":               TransposeWord,
		"Control+Z":           Undo,
		"Control+Y":           Redo,
		"Control+Shift+Z":     Redo,
		"Control+Alt+I":       Insert,
		"Control+Alt+O":       InsertAfter,
		"Control+=":           ZoomIn,
		"Control+Shift++":     ZoomIn,
		"Control+-":           ZoomOut,
		"Control+Shift+_":     ZoomOut,
		"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,
		"Control+Shift+G":     WinSnapshot,
		"Control+N":           New,
		"Control+Shift+N":     NewAlt1,
		"Control+Alt+N":       NewAlt2,
		"Control+O":           Open,
		"Control+Shift+O":     OpenAlt1,
		"Alt+Shift+O":         OpenAlt2,
		"Control+S":           Save,
		"Control+Shift+S":     SaveAs,
		"Control+Alt+S":       SaveAlt,
		"Control+Shift+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,
		"Control+Shift+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,
		"Control+Shift+V":     PasteHist,
		"Alt+D":               Duplicate,
		"Control+T":           Transpose,
		"Alt+T":               TransposeWord,
		"Control+Z":           Undo,
		"Control+Y":           Redo,
		"Control+Shift+Z":     Redo,
		"Control+Alt+I":       Insert,
		"Control+Alt+O":       InsertAfter,
		"Control+=":           ZoomIn,
		"Control+Shift++":     ZoomIn,
		"Control+-":           ZoomOut,
		"Control+Shift+_":     ZoomOut,
		"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,
		"Control+Shift+G":     WinSnapshot,
		"Control+N":           New,
		"Control+Shift+N":     NewAlt1,
		"Control+Alt+N":       NewAlt2,
		"Control+O":           Open,
		"Control+Shift+O":     OpenAlt1,
		"Alt+Shift+O":         OpenAlt2,
		"Control+S":           Save,
		"Control+Shift+S":     SaveAs,
		"Control+Alt+S":       SaveAlt,
		"Control+Shift+W":     CloseAlt1,
		"Control+Alt+W":       CloseAlt2,
	}},
}

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

Functions

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

Types

type Functions

type Functions int32 //enums:enum

Functions are semantic functions that keyboard events can perform in the GUI.

const (
	None Functions = 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
	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
	// 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 FunctionsN Functions = 64

FunctionsN is the highest valid value for type Functions, plus one.

func FunctionsValues

func FunctionsValues() []Functions

FunctionsValues returns all possible values for the type Functions.

func Of

func Of(chord key.Chord) Functions

Of converts the given key.Chord into a keyboard function.

func (Functions) Chord

func (kf Functions) Chord() key.Chord

Chord returns all of the key chord triggers for this key function in the current active map, separating them with newlines.

func (Functions) Desc

func (i Functions) Desc() string

Desc returns the description of the Functions value.

func (Functions) Int64

func (i Functions) Int64() int64

Int64 returns the Functions value as an int64.

func (Functions) Label

func (kf Functions) Label() string

Label transforms the key function into a string representing its underlying key chord(s) in a form suitable for display to users.

func (Functions) MarshalText

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

MarshalText implements the encoding.TextMarshaler interface.

func (*Functions) SetInt64

func (i *Functions) SetInt64(in int64)

SetInt64 sets the Functions value from an int64.

func (*Functions) SetString

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

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

func (Functions) String

func (i Functions) String() string

String returns the string representation of this Functions value.

func (*Functions) UnmarshalText

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

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (Functions) Values

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

Values returns all possible values for the type Functions.

type Map

type Map map[key.Chord]Functions

Map is a map between a key sequence (chord) and a specific key function. This mapping must be unique, in that each chord has a unique function, 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 Settings

func (*Map) ChordFor

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

ChordFor returns all of the key chord triggers for the given key function in the map, separating them with newlines.

func (*Map) ToSlice

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

ToSlice copies this keymap to a slice of [MapItem]s.

func (*Map) Update

func (km *Map) Update(kmName MapName)

Update ensures that the given keymap has at least one entry for every defined key function, grabbing ones from the default map if not, and also eliminates any None 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 Functions
}

MapItem records one element of the key map, which is 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

var DefaultMap MapName = "LinuxStandard"

DefaultMap is the overall default keymap, which is set in init depending on the platform

type Maps

type Maps []MapsItem //types:add

Maps is a list of [MapsItem]s; users can edit these in their settings.

var AvailableMaps Maps

AvailableMaps is the current list of available keymaps for use. This can be loaded / saved / edited in user settings. This is set to StandardMaps 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 Map and index by name. It returns false and prints an error message if not found.

func (*Maps) MarkdownDoc

func (km *Maps) MarkdownDoc() string

MarkdownDoc generates a markdown table of all the key mappings

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