eventmap MODEL {
    key       [F3_G-Down]   { WinNext }
    key       [F3_G-Up]     { WinPrev }
    key       [F3_G-Left]   { FilePrev }
    key       [F3_G-Right]  { FileNext }
    key       [F3_=]      { WinHSplit }
    key       [F3_-]      { WinClose }
    key       [F3_S-X]    { FileLast }
    
    key       [F3_S-N]    { FileOpen }
    key       [F3_S-Q]    { FileClose }

    key       [F6_S-V]    { ShowVersion }

    key       [F9]        { RunProgram "" }
    key       [F10]       { MainMenu }

    key     [A+X]         { ExitEditor }
    
    key   [C+S+G-Up]    { WinResize -1 }
    key   [C+S+G-Down]  { WinResize +1 }
}
# List Viewers
eventmap MLIST: MODEL {
    key     [G-Left]    { MoveLeft }
    key     [G-Right]   { MoveRight }
    key     [G-Up]      { MoveUp }
    key     [G-Down]    { MoveDown }
    key     [G-Home]    { MoveLineStart }
    key   [C+G-Home]    { MovePageStart }
    key     [G-End]     { MoveLineEnd }
    key   [C+G-End]     { MovePageEnd }
    key     [G-PgUp]    { MovePageUp }
    key   [C+G-PgUp]    { MoveFileStart }
    key     [G-PgDn]    { MovePageDown }
    key   [C+G-PgDn]    { MoveFileEnd }
#    key   [A+G-Up]     { ScrollUp }
#    key   [A+G-Down]   { ScrollDown }
    key   [C+Left]      { ScrollRight }
    key   [C+Right]     { ScrollLeft }
    
    key     [G-Enter]   { Activate }
    key     [Space]     { ActivateInOtherWindow }
    key     [S+Enter]   { CloseActivate }

    key     [C+R]       { Rescan }
}

eventmap CVSDIFF: MLIST {
    key     [C+G-Ins]   { BlockCopy }
    key         [Esc]   { FileClose }
}

eventmap CVS: MLIST {
    LocalMenu = "MCvs";
}

eventmap SVNDIFF: MLIST {
    key     [C+G-Ins]   { BlockCopy }
    key         [Esc]   { FileClose }
}

eventmap SVN: MLIST {
    LocalMenu = "MSvn";
}

eventmap DIRECTORY: MLIST {
    MainMenu = 'DirectoryMain';
    LocalMenu = 'DirectoryLocal';
    
    key [C+G-PgUp]      { DirGoUp }
    key [C+G-PgDn]      { DirGoDown }
    key [C+\\]          { DirGoRoot }
    key [/]             { DirGoto }
    key [\\]            { DirGoto }
    key [C+D]           { DeleteFile }
    key [Esc]           { FileClose 0 }
    
    key     [A+D]       { MainMenu 'D' }
    key     [A+N]       { MainMenu 'N' }
    key     [A+W]       { MainMenu 'W' }
}
# Buffer List
eventmap BUFFERS: MLIST {
    MainMenu = "BufferListMain";
    LocalMenu = "BufferListLocal";
    
    key  [Esc]   { FileClose 0 } # 0 = do not open directory when last closed, overrides OpenAfterClose default.

    key  [C+C]   { BufListFileClose }
    key  [F2]    { BufListFileSave }
}

# Routine List
eventmap ROUTINES: MLIST {
    MainMenu = "RoutinesMain";
    LocalMenu = "RoutinesLocal";
    key  [Esc]   { FileClose }
}

eventmap MESSAGES: MLIST {
    MainMenu = "MessagesMain";
    LocalMenu = "MessagesLocal";
    
    key     [A+M]       { MainMenu 'M' }
    key     [A+T]       { MainMenu 'T' }
    key     [A+W]       { MainMenu 'W' }

    key     [C+C]       { ChildClose } # does NOT kill, just closes pipe
}

eventmap EVENTMAPVIEW: MLIST {
    MainMenu = "EventMapViewMain";
    LocalMenu = "EventMapViewLocal";
    
    key [Esc] { FileClose 0 }
}

eventmap PLAIN: MODEL {
# keymap for plaintext mode
    MainMenu   = 'Main';    # menu for menubar
    LocalMenu  = 'Local';   # local menu

    key       [F3_S-S]    { FileSave }
    key       [F3_S-E]    { FileSave; FileClose }
    key       [F3_S-I]    { BlockRead }
    key       [F3_S-B]    { BlockWrite }

    key       [F4_S-S]    { BlockMarkStream }
    key       [F4_S-U]    { BlockUnmark }
    key       [F4_S-D]    { BlockCut }
    key       [F4_S-C]    { BlockCopy; BlockPaste }
    key       [F4_S-M]    { BlockCut; BlockPaste }
    key       [F4_S-L]    { BlockSelectLine }
    key       [F4_S-E]    { BlockBegin; MoveLineEnd; BlockEnd; }
    key       [F4_S-F]    { MoveBlockStart }

    key       [F5_S-L]    { ChangeRightMargin }
    key       [F5_S-W]    { ToggleWordWrap } # tri-state !
    key       [F5_S-F]    { WrapPara }
    key       [F5_S-T]    { ChangeTabSize }
    key       [F5_S-I]    { ToggleAutoIndent }

    key       [F6_S-G]    { MoveToLine }
    key       [F6_S-M]    { MatchBracket }

    key       [F7_S-P]    { FilePrint }
    key       [F7_S-B]    { BlockPrint }

    key     [G-Left]    { MoveLeft }
    key   [C+G-Left]    { MoveWordPrev }
    key     [G-Right]   { MoveRight }
    key   [C+G-Right]   { MoveWordNext }
    key     [G-Up]      { MoveUp }
    key     [G-Down]    { MoveDown }
    key     [G-Home]    { MoveLineStart }
    key   [C+G-Home]    { MovePageStart }
    key     [G-End]     { MoveLineEnd }
    key   [C+G-End]     { MovePageEnd }
    key     [G-PgUp]    { MovePageUp }
    key   [C+G-PgUp]    { MoveFileStart }
    key     [G-PgDn]    { MovePageDown }
    key   [C+G-PgDn]    { MoveFileEnd }
    key   [A+G-Up]      { ScrollUp }
    key   [A+G-Down]    { ScrollDown }
    key   [A+G-Left]    { ScrollLeft }
    key   [A+G-Right]   { ScrollRight }
    
    key   [S+G-Left]    { BlockExtendBegin; MoveLeft;     BlockExtendEnd }
    key   [S+G-Right]   { BlockExtendBegin; MoveRight;    BlockExtendEnd }
    key [C+G-S+Left]    { BlockExtendBegin; MoveWordPrev;  BlockExtendEnd }
    key [C+G-S+Right]   { BlockExtendBegin; MoveWordNext;  BlockExtendEnd }
    key   [G-S+Up]      { BlockExtendBegin; MoveUp;        BlockExtendEnd }
    key   [G-S+Down]    { BlockExtendBegin; MoveDown;      BlockExtendEnd }
    key   [G-S+Home]    { BlockExtendBegin; MoveLineStart; BlockExtendEnd }
    key   [G-S+End]     { BlockExtendBegin; MoveLineEnd;   BlockExtendEnd }
    key [C+G-S+Home]    { BlockExtendBegin; MovePageStart; BlockExtendEnd }
    key [C+G-S+End]     { BlockExtendBegin; MovePageEnd;   BlockExtendEnd }
    key   [G-S+PgUp]    { BlockExtendBegin; MovePageUp;    BlockExtendEnd }
    key   [G-S+PgDn]    { BlockExtendBegin; MovePageDown;  BlockExtendEnd }
    key [C+G-S+PgUp]    { BlockExtendBegin; MoveFileStart; BlockExtendEnd }
    key [C+G-S+PgDn]    { BlockExtendBegin; MoveFileEnd;   BlockExtendEnd }
    key [A+G-S+Up]      { BlockExtendBegin; ScrollUp;      BlockExtendEnd }
    key [A+G-S+Down]    { BlockExtendBegin; ScrollDown;    BlockExtendEnd }
    key [A+G-S+Left]    { BlockExtendBegin; ScrollLeft;    BlockExtendEnd }
    key [A+G-S+Right]   { BlockExtendBegin; ScrollRight;   BlockExtendEnd }

    key   [C+G-Ins]     { BlockCopy }
    key   [C+G-Del]     { BlockKill }
    key   [S+G-Ins]     { BlockPasteStream }
    key   [S+G-Del]     { BlockCut }
    key   [A+G-Ins]     { BlockPasteColumn }
    key [A+G-S+Ins]     { BlockPasteLine }
    key     [G-Enter]   { LineNew }
    key     [G-Ins]     { ToggleInsert }
    key       [Tab]     { InsertTab }
    key     [S+Tab]     { InsertSpacesToTab 10 }
    key     [C+Tab]     { CompleteWord }
    key     [C+BackSp]  { KillWordPrev }
    key   [C+S+BackSp]  { KillToLineStart }
    key   [C+G-Enter]   { LineSplit }
    key   [G-S+Enter]   { LineInsert }
    key   [A+G-Enter]   { LineAdd }
    key   [A+G-Del]     { KillWord }
    key   [A+G-End]     { KillToLineEnd }
    key     [A+BackSp]  { Undo }
    key   [A+S+BackSp]  { Redo }

    key       [BackSp]  { BackSpace }
    key     [G-Del]     { Delete }
    key     [C+W]       { KillWordPrev }
    key     [A+W]       { KillWord }
    key     [C+L]       { KillToLineStart }
    key     [A+L]       { KillToLineEnd }
    key     [A+K]       { KillLine }

    key     [C+V]       { BlockEnd; MoveLineStart; BlockBegin; BlockCaseToggle; MoveBlockEnd; BlockUnmark; }
    key     [A+V]       { BlockEnd; MoveLineEnd; BlockBegin; BlockCaseToggle; MoveBlockEnd; BlockUnmark; }

    key     [A+U]       { Undo }
    key     [C+U]       { Redo }

    key     [C+P]       { InsertChar }

#    key     [G++]       { DumpFold } 
    key     [A+G++]     { FoldCreate }
    key     [A+G+-]     { FoldDestroy }
    key     [G+S++]     { FoldPromote }
    key     [G+S+-]     { FoldDemote }
    key     [C+G++]     { FoldOpen }
    key     [C+G+-]     { FoldClose }
    key     [C+G+*]     { FoldOpenNested }
    key     [C+G+/]     { FoldToggleOpenClose }
    key     [A+G+*]     { FoldOpenAll }
    key     [A+G+/]     { FoldCloseAll }
   
}
