packageguiimport("github.com/jesseduffield/gocui")// Binding - a keybinding mapping a key and modifier to a handler. The keypress// is only handled if the given view has focus, or handled globally if the view// is ""typeBindingstruct{ViewNamestringContexts[]stringHandlerfunc(*gocui.Gui,*gocui.View)errorKeyinterface{}// FIXME: find out how to get `gocui.Key | rune`Modifiergocui.ModifierDescriptionstringAlternativestring}// GetDisplayStrings returns the display string of a filefunc(b*Binding)GetDisplayStrings(isFocusedbool)[]string{return[]string{b.GetKey(),b.Description}}// GetKey is a function.func(b*Binding)GetKey()string{key:=0switchb.Key.(type){caserune:key=int(b.Key.(rune))casegocui.Key:ifb.Key.(gocui.Key)==gocui.KeyCtrlJ{return"ctrl+j"}ifb.Key.(gocui.Key)==gocui.KeyCtrlK{return"ctrl+k"}key=int(b.Key.(gocui.Key))}// special keysswitchkey{case27:return"esc"case13:return"enter"case32:return"space"case65514:return"►"case65515:return"◄"case65517:return"▲"case65516:return"▼"case65508:return"PgUp"case65507:return"PgDn"case9:return"tab"}returnstring(key)}// GetInitialKeybindings is a function.func(gui*Gui)GetInitialKeybindings()[]*Binding{bindings:=[]*Binding{{ViewName: