@@ -67,15 +67,16 @@ public override void Main ()
6767 ConfigurationManager . Enable ( ConfigLocations . All ) ;
6868 using IApplication app = Application . Create ( ) ;
6969 app . Init ( ) ;
70+ app . Keyboard . KeyBindings . Remove ( Key . Esc ) ;
7071
7172 using Window window = new ( )
7273 {
73- Title = GetQuitKeyAndName ( )
74+ Title = "Key Sequences - :q to Quit"
7475 } ;
7576
7677 Label title = new ( )
7778 {
78- Text = "Command mode: ; enters, i exits" ,
79+ Text = "Command mode: Esc enters, i exits, :q quits " ,
7980 X = 0 ,
8081 Y = 0
8182 } ;
@@ -115,23 +116,24 @@ public override void Main ()
115116 window . Add ( title , commands , editor , logView ) ;
116117
117118 AddLog ( "Focus is on the editor." ) ;
118- AddLog ( "Press ; once to enter command mode." ) ;
119+ AddLog ( "Press Esc once to enter command mode." ) ;
119120 AddLog ( "Motions: h/j/k/l, 4 j, w, b, 0, $, g g, G, Ctrl+B/F" ) ;
120121 AddLog ( "Selection: v h/j/k/l/w/b/0/$/g g/G/Ctrl+B/Ctrl+F" ) ;
121122 AddLog ( "Edit: d d, 3 d d, y y, v y, v c, p, x, X, u, Ctrl+R" ) ;
122- AddLog ( "Press i to return to normal editing." ) ;
123+ AddLog ( "Press i to return to normal editing. Press : q to quit. " ) ;
123124
124125 using IDisposable registration = editor . UseKeySequences (
125126 bindings =>
126127 {
127128 bindings . Mode = KeySequenceMode . Persistent ;
128- bindings . EnterModeKey = ';' ;
129+ bindings . EnterModeKey = Key . Esc ;
129130 bindings . ExitModeKey = 'i' ;
130131 bindings . Timeout = TimeSpan . FromSeconds ( 5 ) ;
131132
132133 AddMotionBindings ( bindings , editor ) ;
133134 AddSelectionBindings ( bindings , editor ) ;
134135 AddEditingBindings ( bindings , editor ) ;
136+ AddQuitBinding ( bindings , app ) ;
135137
136138 bindings . StateChanged += ( _ , e ) =>
137139 {
@@ -224,6 +226,16 @@ private void AddEditingBindings (KeySequenceBindings bindings, Editor editor)
224226 AddCountedLineCommand ( bindings , editor , "<count> y y" , Command . Copy , "y y" ) ;
225227 }
226228
229+ private void AddQuitBinding ( KeySequenceBindings bindings , IApplication app )
230+ {
231+ bindings . AddMode ( ": q" , context =>
232+ {
233+ AddLog ( $ "{ FormatSequence ( context ) } -> quit") ;
234+ app . RequestStop ( ) ;
235+ return true ;
236+ } ) ;
237+ }
238+
227239 private void AddRepeatedCommand ( KeySequenceBindings bindings , Editor editor , string pattern , Command command , string display )
228240 {
229241 bindings . AddMode ( pattern , context =>
0 commit comments