本文整理汇总了Golang中github.com/grafov/gocui.Gui.SetKeybinding方法的典型用法代码示例。如果您正苦于以下问题:Golang Gui.SetKeybinding方法的具体用法?Golang Gui.SetKeybinding怎么用?Golang Gui.SetKeybinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/grafov/gocui.Gui
的用法示例。
在下文中一共展示了Gui.SetKeybinding方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: initKeys
func initKeys(g *gocui.Gui) error {
if err := g.SetKeybinding("", gocui.KeyCtrlQ, gocui.ModNone, quit); err != nil {
return err
}
if err := g.SetKeybinding("", gocui.KeyF10, gocui.ModNone, quit); err != nil {
return err
}
if err := g.SetKeybinding("", gocui.KeyCtrlR, gocui.ModNone, refresh); err != nil {
return err
}
if err := g.SetKeybinding("", gocui.KeyCtrlO, gocui.ModNone, switchPanels); err != nil {
return err
}
if err := g.SetKeybinding("", gocui.KeyF2, gocui.ModAlt, addSource); err != nil {
return err
}
if err := g.SetKeybinding("lpanel", gocui.KeyArrowDown, gocui.ModNone, cursorDown); err != nil {
return err
}
if err := g.SetKeybinding("rpanel", gocui.KeyArrowDown, gocui.ModNone, cursorDown); err != nil {
return err
}
if err := g.SetKeybinding("lpanel", gocui.KeyArrowUp, gocui.ModNone, cursorUp); err != nil {
return err
}
if err := g.SetKeybinding("rpanel", gocui.KeyArrowUp, gocui.ModNone, cursorUp); err != nil {
return err
}
if err := g.SetKeybinding("sql", gocui.KeyArrowDown, gocui.ModNone, cursorDownInEditor); err != nil {
return err
}
if err := g.SetKeybinding("sql", gocui.KeyEnter, gocui.ModAlt, execQuery); err != nil {
return err
}
return nil
}