Skip to content

Commit

Permalink
Add Keymap Descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
LostbBlizzard committed Aug 10, 2024
1 parent e4be84b commit 3394631
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 32 deletions.
65 changes: 33 additions & 32 deletions app/Keymap.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,47 +46,48 @@ func (c KeymapSystem) Resolve(event *tcell.EventKey) cmd.Command {
// Define a global KeymapSystem object with default keybinds
var Keymaps = KeymapSystem{
Global: Map{
Bind{Key: Key{Char: 'L'}, Cmd: cmd.MoveRight},
Bind{Key: Key{Char: 'H'}, Cmd: cmd.MoveLeft},
Bind{Key: Key{Code: tcell.KeyCtrlE}, Cmd: cmd.SwitchToEditorView},
Bind{Key: Key{Code: tcell.KeyCtrlS}, Cmd: cmd.Save},
Bind{Key: Key{Char: 'q'}, Cmd: cmd.Quit},
Bind{Key: Key{Code: tcell.KeyBackspace2}, Cmd: cmd.SwitchToConnectionsView},
Bind{Key: Key{Char: 'L'}, Cmd: cmd.MoveRight, Description: "Right"},
Bind{Key: Key{Char: 'H'}, Cmd: cmd.MoveLeft, Description: "Left"},
Bind{Key: Key{Code: tcell.KeyCtrlE}, Cmd: cmd.SwitchToEditorView, Description: "EditorView"},
Bind{Key: Key{Code: tcell.KeyCtrlS}, Cmd: cmd.Save, Description: "Save"},
Bind{Key: Key{Char: 'q'}, Cmd: cmd.Quit, Description: "Quit"},
Bind{Key: Key{Code: tcell.KeyBackspace2}, Cmd: cmd.SwitchToConnectionsView, Description: "ConnectionsView"},
Bind{Key: Key{Char: '?'}, Cmd: cmd.HelpPopup, Description: "Help"},
},
Groups: map[string]Map{
"tree": {
Bind{Key: Key{Char: 'g'}, Cmd: cmd.GotoTop},
Bind{Key: Key{Char: 'G'}, Cmd: cmd.GotoBottom},
Bind{Key: Key{Code: tcell.KeyEnter}, Cmd: cmd.Execute},
Bind{Key: Key{Char: 'j'}, Cmd: cmd.MoveDown},
Bind{Key: Key{Code: tcell.KeyDown}, Cmd: cmd.MoveDown},
Bind{Key: Key{Char: 'k'}, Cmd: cmd.MoveUp},
Bind{Key: Key{Code: tcell.KeyUp}, Cmd: cmd.MoveUp},
Bind{Key: Key{Char: 'g'}, Cmd: cmd.GotoTop, Description: "Goto Top"},
Bind{Key: Key{Char: 'G'}, Cmd: cmd.GotoBottom, Description: "Goto Bottom"},
Bind{Key: Key{Code: tcell.KeyEnter}, Cmd: cmd.Execute, Description: "Execute"},
Bind{Key: Key{Char: 'j'}, Cmd: cmd.MoveDown, Description: "Down"},
Bind{Key: Key{Code: tcell.KeyDown}, Cmd: cmd.MoveDown, Description: "Down"},
Bind{Key: Key{Char: 'k'}, Cmd: cmd.MoveUp, Description: "Up"},
Bind{Key: Key{Code: tcell.KeyUp}, Cmd: cmd.MoveUp, Description: "Up"},
},
"table": {
Bind{Key: Key{Char: '/'}, Cmd: cmd.Search},
Bind{Key: Key{Char: 'c'}, Cmd: cmd.Edit},
Bind{Key: Key{Char: 'd'}, Cmd: cmd.Delete},
Bind{Key: Key{Char: 'w'}, Cmd: cmd.GotoNext},
Bind{Key: Key{Char: 'b'}, Cmd: cmd.GotoPrev},
Bind{Key: Key{Char: '$'}, Cmd: cmd.GotoEnd},
Bind{Key: Key{Char: '0'}, Cmd: cmd.GotoStart},
Bind{Key: Key{Char: 'y'}, Cmd: cmd.Copy},
Bind{Key: Key{Char: 'o'}, Cmd: cmd.AppendNewRow},
Bind{Key: Key{Char: '/'}, Cmd: cmd.Search, Description: "Search"},
Bind{Key: Key{Char: 'c'}, Cmd: cmd.Edit, Description: "Goto Edit"},
Bind{Key: Key{Char: 'd'}, Cmd: cmd.Delete, Description: "Goto Delete"},
Bind{Key: Key{Char: 'w'}, Cmd: cmd.GotoNext, Description: "Goto Next"},
Bind{Key: Key{Char: 'b'}, Cmd: cmd.GotoPrev, Description: "Goto Prev"},
Bind{Key: Key{Char: '$'}, Cmd: cmd.GotoEnd, Description: "Goto End"},
Bind{Key: Key{Char: '0'}, Cmd: cmd.GotoStart, Description: "Goto Start"},
Bind{Key: Key{Char: 'y'}, Cmd: cmd.Copy, Description: "Copy"},
Bind{Key: Key{Char: 'o'}, Cmd: cmd.AppendNewRow, Description: "New Row"},
// Tabs
Bind{Key: Key{Char: '['}, Cmd: cmd.TabPrev},
Bind{Key: Key{Char: ']'}, Cmd: cmd.TabNext},
Bind{Key: Key{Char: '{'}, Cmd: cmd.TabFirst},
Bind{Key: Key{Char: '}'}, Cmd: cmd.TabLast},
Bind{Key: Key{Char: 'X'}, Cmd: cmd.TabClose},
Bind{Key: Key{Char: '['}, Cmd: cmd.TabPrev, Description: "Tab Prev"},
Bind{Key: Key{Char: ']'}, Cmd: cmd.TabNext, Description: "Tab Next"},
Bind{Key: Key{Char: '{'}, Cmd: cmd.TabFirst, Description: "Tab First"},
Bind{Key: Key{Char: '}'}, Cmd: cmd.TabLast, Description: "Tab Last"},
Bind{Key: Key{Char: 'X'}, Cmd: cmd.TabClose, Description: "Close"},
// Pages
Bind{Key: Key{Char: '>'}, Cmd: cmd.PageNext},
Bind{Key: Key{Char: '<'}, Cmd: cmd.PagePrev},
Bind{Key: Key{Char: '>'}, Cmd: cmd.PageNext, Description: "Page Next"},
Bind{Key: Key{Char: '<'}, Cmd: cmd.PagePrev, Description: "Page Prev"},
},
"editor": {
Bind{Key: Key{Code: tcell.KeyCtrlR}, Cmd: cmd.Execute},
Bind{Key: Key{Code: tcell.KeyEscape}, Cmd: cmd.Quit},
Bind{Key: Key{Code: tcell.KeyCtrlSpace}, Cmd: cmd.OpenInExternalEditor},
Bind{Key: Key{Code: tcell.KeyCtrlR}, Cmd: cmd.Execute, Description: "Execute"},
Bind{Key: Key{Code: tcell.KeyEscape}, Cmd: cmd.Quit, Description: "Quit"},
Bind{Key: Key{Code: tcell.KeyCtrlSpace}, Cmd: cmd.OpenInExternalEditor, Description: "ExternalEditor"},
},
},
}
3 changes: 3 additions & 0 deletions commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const (
// Views
SwitchToEditorView
SwitchToConnectionsView
HelpPopup

// Movement: Basic
MoveUp
Expand Down Expand Up @@ -54,6 +55,8 @@ func (c Command) String() string {
return "SwitchToEditorView"
case SwitchToConnectionsView:
return "SwitchToConnectionsView"
case HelpPopup:
return "HelpPopup"

// Movement: Basic
case MoveUp:
Expand Down

0 comments on commit 3394631

Please sign in to comment.