cosmetix
[sxed.git] / config / keybinds / default.skb
blob795065e1e2e829dbc2303e9bb72fb8912c5452b5
1 /*
2  * SXED -- sexy text editor engine, 2022
3  *
4  * coded by Ketmar // Invisible Vector <ketmar@ketmar.no-ip.org>
5  * Understanding is not required. Only obedience.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, version 3 of the License ONLY.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 // action prefixes:
20 //   !: must have selected and finalized block
21 //   *: must have a block (either finalized, or in process)
22 //   m: only for minibuffers
23 //   t: only for text frames
24 //   p: only for popups
25 //   h: any frame that can host minibuffers
26 //   w: only mutable frames
27 // prefixes are enclosed in '|'
28 // i.e. "|!|sxed_frame_block_move"
30 // no, i won't tell you about available actions. deal with it.
33 //ignore-it;
34 //stop-here;
35 //unbind-section "secname";
37 unbind-all;
40 // ////////////////////////////////////////////////////////////////////////// //
41 section "cursor movement" {
42   {
43     keys = "home";
44     action = "sxed_frame_move_home";
45     help = "move cursor to the beginning of the line";
46   }
47   {
48     keys = "end";
49     action = "sxed_frame_move_end";
50     help = "move cursor to the end of the line";
51   }
52   /*
53   {
54     keys = "C-a";
55     action = "sxed_frame_move_home_ca";
56     help = "move cursor to the first non-blank character of the line";
57   }
58   {
59     keys = "C-e";
60     action = "sxed_frame_move_end_ce";
61     help = "move cursor to the last non-blank character of the line";
62   }
63   */
64   {
65     keys = "left";
66     action = "sxed_frame_cursor_left";
67     help = "move cursor left by one character";
68   }
69   {
70     keys = "right";
71     action = "sxed_frame_cursor_right";
72     help = "move cursor right by one character";
73   }
74   {
75     keys = "S-left";
76     action = "sxed_frame_view_shift_left";
77     help = "shift view left";
78   }
79   {
80     keys = "S-right";
81     action = "sxed_frame_view_shift_right";
82     help = "shift view right";
83   }
84   {
85     keys = "C-left";
86     action = "sxed_frame_word_left";
87     help = "move cursor back by one word";
88   }
89   {
90     keys = "C-right";
91     action = "sxed_frame_word_right";
92     help = "move cursor forward by one word";
93   }
94   {
95     keys = "up";
96     action = "sxed_frame_cursor_up";
97     help = "move cursor to the previous line";
98   }
99   {
100     keys = "down";
101     action = "sxed_frame_cursor_down";
102     help = "move cursor to the next line";
103   }
104   {
105     keys = "C-up";
106     action = "sxed_frame_scroll_up";
107     help = "scroll view up";
108   }
109   {
110     keys = "C-down";
111     action = "sxed_frame_scroll_down";
112     help = "scroll view down";
113   }
114   {
115     keys = "pageup";
116     action = "sxed_frame_page_up";
117     help = "move one page up";
118   }
119   {
120     keys = "pagedown";
121     action = "sxed_frame_page_down";
122     help = "move one page down";
123   }
124   {
125     keys = "C-pageup";
126     action = "sxed_frame_text_top";
127     help = "move to the top of the text";
128   }
129   {
130     keys = "C-pagedown";
131     action = "sxed_frame_text_bottom";
132     help = "move to the bottom of the text";
133   }
134   {
135     keys = "C-home";
136     action = "sxed_frame_page_top";
137     help = "move to the top of the current page";
138   }
139   {
140     keys = "C-end";
141     action = "sxed_frame_page_bottom";
142     help = "move to the bottom of the current page";
143   }
144   {
145     keys = "C-l | M-l";
146     action = "sxed_frame_query_line_number";
147     help = "ask for the line number, and jump there";
148   }
149   {
150     keys = "M-S-l";
151     action = "sxed_frame_cursor_vcenter";
152     help = "center current line vertically";
153   }
154   {
155     keys = "M-S-; | M-S-'";
156     action = "sxed_frame_ensure_better_cursor_visibility";
157     help = "scroll view a little if the cursor is near the edge of the view";
158   }
159   {
160     keys = "M-[";
161     action = "sxed_frame_paren_jump_left";
162     help = "jump to the matching paren, or string start";
163   }
164   {
165     keys = "M-]";
166     action = "sxed_frame_paren_jump_right";
167     help = "jump to the matching paren, or string end";
168   }
169   {
170     keys = "M-\\";
171     action = "sxed_frame_paren_jump_guess";
172     help = "try to guess the paren, and jump to the matching one";
173   }
174   {
175     keys = "C-M-[";
176     action = "sxed_frame_paren_jump_left_force";
177     help = "jump to the matching paren, or string start (skip invalid parens)";
178   }
179   {
180     keys = "C-M-]";
181     action = "sxed_frame_paren_jump_right_force";
182     help = "jump to the matching paren, or string end (skip invalid parens)";
183   }
187 // ////////////////////////////////////////////////////////////////////////// //
188 section "incremental search" {
189   {
190     keys = "esc";
191     action = "|h|sxed_frame_clear_extra_highlight";
192     help = "remove all temporary highlights";
193   }
194   {
195     keys = "C-/";
196     action = "|h|sxed_frame_incsearch_set_mode_plain";
197     help = "show incremental search prompt (plain mode)";
198   }
199   {
200     keys = "M-/";
201     action = "|h|sxed_frame_incsearch_set_mode_regexp";
202     help = "show incremental search prompt (regexp mode)";
203   }
204   {
205     keys = "M-S-/";
206     action = "|h|sxed_frame_incsearch_set_mode_word";
207     help = "show incremental search prompt (plain word mode)";
208   }
209   {
210     keys = "C-v";
211     action = "|h|sxed_frame_mb_incsearch_repeat";
212     help = "repeat last incremental search";
213   }
217 // ////////////////////////////////////////////////////////////////////////// //
218 section "bookmarks" {
219   {
220     keys = "M-i";
221     action = "|h|sxed_frame_jump_to_prev_bookmark";
222     help = "jump to the previous bookmark";
223   }
224   {
225     keys = "M-j";
226     action = "|h|sxed_frame_jump_to_next_bookmark";
227     help = "jump to the next bookmark";
228   }
229   {
230     keys = "M-m";
231     action = "|h|sxed_frame_toggle_bookmark";
232     help = "toggle bookmark on the current line";
233   }
234   {
235     keys = "C-k C?-<digit>"; // hack!
236     action = "|h|sxed_frame_set_byteofs_bookmark";
237     help = "set invisible bookmark at the current cursor position";
238   }
239   {
240     keys = "C-q C?-<digit>"; // hack!
241     action = "|h|sxed_frame_goto_byteofs_bookmark";
242     help = "go to invisible bookmark";
243   }
247 // ////////////////////////////////////////////////////////////////////////// //
248 section "block operations" {
249   {
250     keys = "C-spc | f3";
251     action = "sxed_frame_mark_start_stop";
252     help = "start or finish marking a block";
253   }
254   {
255     keys = "M-spc | C-f3 | C-S-f3";
256     action = "sxed_frame_mark_reset";
257     help = "reset (unmark) marked block";
258   }
259   {
260     keys = "S-f3";
261     action = "sxed_frame_mark_expand";
262     help = "expand marked block";
263   }
264   {
265     keys = "C-ins";
266     action = "sxed_frame_block_clipcopy";
267     help = "copy marked block to the internal clipboard";
268   }
269   /*
270   {
271     keys = "S-del";
272     action = "sxed_frame_block_clipcut";
273     help = "move marked block to the internal clipboard";
274   }
275   */
276   {
277     keys = "M-S-c";
278     action = "sxed_frame_block_clipcopyx11";
279     help = "move marked block to the X11 clipboard (via 'xsel' external command)";
280   }
281   {
282     keys = "f8";
283     action = "|w|sxed_frame_block_delete";
284     help = "delete marked block";
285   }
286   {
287     keys = "S-ins";
288     action = "|w|sxed_frame_block_clippaste";
289     help = "insert internal clipboard as a new marked block";
290   }
291   {
292     keys = "f6";
293     action = "|w|sxed_frame_block_move";
294     help = "move marked block";
295   }
296   {
297     keys = "f5";
298     action = "|w|sxed_frame_block_copy";
299     help = "copy marked block";
300   }
301   {
302     keys = "C-tab";
303     action = "|wt*|sxed_frame_block_indent";
304     help = "indent current block";
305   }
309 // ////////////////////////////////////////////////////////////////////////// //
310 section "WordStar-like block operations" {
311   {
312     keys = "C-k C?-w";
313     action = "|*|sxed_frame_block_write_to_temp";
314     help = "write block to temporary file";
315   }
316   {
317     keys = "C-k C?-r";
318     action = "|w|sxed_frame_block_read_from_temp";
319     help = "read block from temporary file";
320   }
321   {
322     keys = "C-k C?-h";
323     action = "sxed_frame_mark_hide_toggle";
324     help = "remove block mark";
325   }
326   {
327     keys = "C-k C?-b";
328     action = "sxed_frame_mark_start";
329     help = "start block marking";
330   }
331   {
332     keys = "C-k C?-k";
333     action = "sxed_frame_mark_stop";
334     help = "stop block marking";
335   }
336   {
337     keys = "C-k C?-i";
338     action = "|wt*|sxed_frame_block_indent";
339     help = "indent current block";
340   }
341   {
342     keys = "C-k C?-M-u";
343     action = "|wt*|sxed_frame_block_to_move_source";
344     help = "move to the place where the last block was moved";
345   }
346   {
347     keys = "C-k C?-u";
348     action = "|wt*|sxed_frame_block_unindent";
349     help = "indent current block";
350   }
351   {
352     keys = "C-k C?-y";
353     action = "|w|sxed_frame_block_delete";
354     help = "delete marked block";
355   }
356   {
357     keys = "C-k C?-m";
358     action = "|w|sxed_frame_block_move";
359     help = "move marked block";
360   }
361   {
362     keys = "C-k C?-c";
363     action = "|w|sxed_frame_block_copy_cursor_at_end";
364     help = "copy marked block";
365   }
366   {
367     keys = "C-k C?-v";
368     action = "|w|sxed_frame_block_clippaste";
369     help = "insert internal clipboard as a new marked block";
370   }
371   {
372     keys = "C-k C?-x";
373     action = "sxed_frame_block_clipcut";
374     help = "move marked block to the internal clipboard";
375   }
376   /*
377   {
378     keys = "C-k C?-[";
379     action = "|w|sxed_frame_block_clippaste";
380     help = "insert internal clipboard as a new marked block";
381   }
382   {
383     keys = "C-k C?-]";
384     action = "sxed_frame_block_clipcopy";
385     help = "copy marked block to the internal clipboard";
386   }
387   */
389   {
390     keys = "C-q C?-b";
391     action = "sxed_frame_block_goto_start";
392     help = "go to the start of the block";
393   }
394   {
395     keys = "C-q C?-k";
396     action = "sxed_frame_block_goto_end";
397     help = "go to the end of the block";
398   }
402 // ////////////////////////////////////////////////////////////////////////// //
403 section "tabulation setup" {
404   {
405     keys = "C-q C?-t";
406     action = "|t|sxed_frame_query_tab_size";
407     help = "set tab size";
408   }
409   {
410     keys = "C-k C?-t";
411     action = "|t|sxed_frame_keybind_script";
412     help = "toggle visual tabs mode";
413     arg0str = "self.visual_tabs = !self.visual_tabs; self.dirty = true;";
414   }
415   {
416     keys = "C-q C?-i";
417     action = "|t|sxed_frame_keybind_script";
418     help = "toggle autoindent mode";
419     arg0str = "self.autoindent = !self.autoindent;";
420   }
421   {
422     keys = "C-q tab";
423     action = "|t|sxed_frame_keybind_script";
424     help = "insert tab char";
425     arg0str = "self.insert_utf8(\"\\t\");";
426   }
429 // ////////////////////////////////////////////////////////////////////////// //
430 section "undo/redo" {
431   {
432     keys = "C-z";
433     action = "|w|sxed_frame_undo";
434     help = "perform \"undo\" action";
435   }
436   {
437     keys = "C-S-z";
438     action = "|w|sxed_frame_redo";
439     help = "perform \"redo\" action";
440   }
442   {
443     keys = "M-u";
444     action = "|w|sxed_frame_undo";
445     help = "perform \"undo\" action";
446   }
447   {
448     keys = "M-r";
449     action = "|w|sxed_frame_redo";
450     help = "perform \"redo\" action";
451   }
453   {
454     keys = "C-M-S-u";
455     action = "sxed_frame_clear_undo";
456     help = "wipe undo/redo history";
457   }
460 // ////////////////////////////////////////////////////////////////////////// //
461 section "text modification" {
462   {
463     keys = "ent";
464     action = "|wh|sxed_frame_autoindent_electro";
465     help = "insert new line with smart autoindent";
466   }
467   {
468     keys = "M-ent";
469     action = "|wh|sxed_frame_autoindent_simple";
470     help = "insert new line with simple autoindent";
471   }
472   {
473     keys = "S-ent";
474     action = "|wh|sxed_frame_autoindent_forced";
475     help = "insert new line with forced autoindent";
476   }
477   {
478     keys = "C-ent";
479     action = "|wh|sxed_frame_autoindent_none";
480     help = "insert new line without autoindent";
481   }
482   {
483     keys = "del | C-g";
484     action = "|w|sxed_frame_delete_char";
485     help = "delete characted under cursor";
486   }
487   {
488     keys = "bs | C-h";
489     action = "|w|sxed_frame_delete_char_back";
490     help = "delete characted before the cursor";
491   }
492   {
493     keys = "C-bs | C-w";
494     action = "|w|sxed_frame_delete_word_back";
495     help = "delete word before the cursor";
496   }
497   {
498     keys = "M-bs";
499     action = "|w|sxed_frame_delete_word_back_unindent";
500     help = "delete word before the cursor, or unindent";
501   }
502   {
503     keys = "C-y | C-S-y";
504     action = "|w|sxed_frame_delete_line";
505     help = "delete current line";
506   }
507   {
508     keys = "tab";
509     action = "|wt|sxed_frame_tab_indent";
510     help = "insert indenting spaces";
511   }
512   {
513     keys = "M-tab";
514     action = "|wh|sxed_frame_do_autocompletion";
515     help = "autocomplete current word for text frame";
516   }
517   {
518     keys = "M-tab";
519     action = "|wm|sxed_frame_do_autocompletion_filename";
520     help = "autocomplete filename for minibuffer";
521   }
522   {
523     keys = "C-k C?-e | C-q C?-y";
524     action = "|w|sxed_frame_delete_to_end_of_line";
525     help = "delete text to the end of the current line";
526   }
529 // ////////////////////////////////////////////////////////////////////////// //
530 section "miscelaneous" {
531   {
532     keys = "C-k S-1";
533     action = "|t|sxed_frame_toggle_readonly";
534     help = "toggle read-only flag for the current buffer (NOT FRAME!)";
535   }
536   {
537     keys = "C-k S-0";
538     action = "|t|sxed_frame_toggle_line_highlight";
539     help = "toggle line highlighting flag for the current frame";
540   }
541   {
542     keys = "C-k M-0";
543     action = "sxed_frame_toggle_global_line_highlight";
544     help = "toggle global line highlighting option";
545   }
546   {
547     keys = "C-q C?-h | M-q M?-h";
548     action = "|wt|sxed_frame_insert_function_header";
549     help = "insert function header comment";
550   }
551   {
552     keys = "C-q C?-j | M-q M?-j";
553     action = "|wt|sxed_frame_insert_tearline_comment";
554     help = "insert tearline comment";
555   }
556   {
557     keys = "C-q C?-f";
558     action = "|h|sxed_frame_incsearch_cursor_word";
559     help = "incremental search word under cursor";
560   }
562   {
563     keys = "M-e";
564     action = "sxed_frame_show_encoding_popup";
565     help = "select text encoding";
566   }
568   {
569     keys = "f2";
570     action = "|t|sxed_frame_save";
571     help = "save text frame";
572   }
574   {
575     keys = "S-f2";
576     action = "|t|sxed_frame_save_all";
577     help = "save all modified text frames";
578   }
580   {
581     keys = "C-k C-s";
582     action = "|t|sxed_frame_save_new_name";
583     help = "save current frame with name prompt";
584   }
586   {
587     keys = "M-S-f12";
588     action = "|t|sxed_frame_force_save";
589     //.help = "save text frame state";
590     help = "<hidden>";
591   }
593   {
594     keys = "f4 | M-r";
595     action = "|t|sxed_frame_show_replace_prompt";
596     help = "show search-and-replace prompt";
597   }
599   {
600     keys = "M-x M?-n";
601     action = "|h|sxed_frame_toggle_line_numbers";
602     help = "toggle line numbers";
603   }
606 // ////////////////////////////////////////////////////////////////////////// //
607 section "application keybinds" {
608   // M-x
609   {
610     keys = "M-x M?-c";
611     action = "sxed_app_command";
612     help = "quit application";
613     arg0 = XACT_Quit;
614   }
615   {
616     keys = "M-x M?-q";
617     action = "sxed_app_command";
618     help = "quit application";
619     arg0 = XACT_Quit;
620   }
622   {
623     keys = "M-x M-d";
624     action = "|t|sxed_app_command";
625     help = "duplicate frame";
626     arg0 = XACT_DupFrame;
627   }
628   {
629     keys = "M-x C-del";
630     action = "|h|sxed_app_command";
631     help = "close frame";
632     arg0 = XACT_CloseFrame;
633   }
634   {
635     keys = "M-x M?-m";
636     action = "|t|sxed_app_command";
637     help = "maximize/unmaximize frame";
638     arg0 = XACT_ToggleMaximize;
639   }
640   /*
641   {
642     keys = "M-x M?-/ | M-x M?-f1";
643     action = "|t|sxed_app_command";
644     help = "show help";
645     arg0 = XACT_ShowKeybinds;
646   }
647   */
649   // M-x
650   /*
651   {
652     keys = "M-x M-u";
653     action = "sxed_app_command";
654     //.help = "(debug) show undo log";
655     help = "<hidden>";
656     arg0 = XACT_ShowUndoLog;
657   }
658   */
659   {
660     keys = "M-x M-l";
661     action = "sxed_app_command";
662     help = "show message log";
663     arg0 = XACT_ShowMessageLog;
664   }
666   // no prefixes
667   {
668     keys = "M-S-ins";
669     action = "sxed_app_command";
670     help = "paste primary X11 selection";
671     arg0 = XACT_SelPastePrimary;
672   }
673   {
674     keys = "M-S-v";
675     action = "sxed_app_command";
676     help = "paste X11 clipboard selection";
677     arg0 = XACT_SelPasteClipboard;
678   }
679   {
680     keys = "M-0 | M-ins | M-grave";
681     action = "|h|sxed_app_command";
682     help = "show frame list popup";
683     arg0 = XACT_FrameList;
684   }
687 // ////////////////////////////////////////////////////////////////////////// //
688 section "project commands" {
689   {
690     keys = "M-f9";
691     action = "|t|sxed_app_command";
692     help = "compile project";
693     arg0 = XACT_RunCompile;
694   }
695   {
696     keys = "C-f9";
697     action = "|t|sxed_app_command";
698     help = "run project";
699     arg0 = XACT_RunProject;
700   }
701   {
702     keys = "S-f9";
703     action = "|t|sxed_app_command";
704     help = "build project";
705     arg0 = XACT_RunBuild;
706   }
708   // C-q
709   {
710     keys = "C-q M-f9";
711     action = "|t|sxed_app_command";
712     help = "edit project compile command";
713     arg0 = XACT_QueryRunCompile;
714   }
715   {
716     keys = "C-q C-f9";
717     action = "|t|sxed_app_command";
718     help = "edit project run command";
719     arg0 = XACT_QueryRunProject;
720   }
721   {
722     keys = "C-q S-f9";
723     action = "|t|sxed_app_command";
724     help = "edit project build command";
725     arg0 = XACT_QueryRunBuild;
726   }
730 // ////////////////////////////////////////////////////////////////////////// //
731 section "project grep" {
732   {
733     keys = "M-q f";
734     action = "|t|sxed_app_command";
735     help = "grep last used pattern";
736     arg0 = XACT_ProjectFindAgain;
737   }
738   {
739     keys = "M-q C-f";
740     action = "|t|sxed_app_command";
741     help = "grep word under cursor";
742     arg0 = XACT_ProjectFindWord;
743   }
744   {
745     keys = "M-q M-f";
746     action = "|t|sxed_app_command";
747     help = "grep declaration under cursor";
748     arg0 = XACT_ProjectFindDecl;
749   }
750   {
751     keys = "M-q S-f";
752     action = "|t|sxed_app_command";
753     help = "grep prompt";
754     arg0 = XACT_ProjectFindQuery;
755   }
759 // ////////////////////////////////////////////////////////////////////////// //
760 section "dvcs commits" {
761   {
762     keys = "C-k C?-ent";
763     action = "|t|sxed_app_command";
764     help = "commit project";
765     arg0 = XACT_Commit;
766   }
767   {
768     keys = "C-k C?-M-ent";
769     action = "|t|sxed_app_command";
770     help = "commit and push project";
771     arg0 = XACT_CommitPush;
772   }
776 // ////////////////////////////////////////////////////////////////////////// //
777 section "frame switching" {
778   {
779     keys = "M-x M-p";
780     action = "sxed_app_command";
781     help = "previous frame";
782     arg0 = XACT_PrevFrame;
783   }
784   {
785     keys = "M-x M-n";
786     action = "sxed_app_command";
787     help = "next frame";
788     arg0 = XACT_NextFrame;
789   }
790   /*
791   {
792     keys = "S-M-up";
793     action = "sxed_app_command";
794     help = "prevous frame";
795     arg0 = XACT_PrevFrame;
796   }
797   {
798     keys = "S-M-down";
799     action = "sxed_app_command";
800     help = "next frame";
801     arg0 = XACT_NextFrame;
802   }
803   */
807 // ////////////////////////////////////////////////////////////////////////// //
808 section "track switching" {
809   {
810     keys = "M-x M-b";
811     action = "sxed_app_command";
812     help = "previous track";
813     arg0 = XACT_PrevTrack;
814   }
815   {
816     keys = "M-x M-f";
817     action = "sxed_app_command";
818     help = "next track";
819     arg0 = XACT_NextTrack;
820   }
821   {
822     keys = "C-M-up";
823     action = "sxed_app_command";
824     help = "prevous track";
825     arg0 = XACT_PrevTrack;
826   }
827   {
828     keys = "C-M-down";
829     action = "sxed_app_command";
830     help = "next track";
831     arg0 = XACT_NextTrack;
832   }
836 // ////////////////////////////////////////////////////////////////////////// //
837 section "newbie commands" {
838   {
839     keys = "f1";
840     action = "|t|sxed_app_command";
841     help = "show help";
842     arg0 = XACT_ShowKeybinds;
843   }
847 // ////////////////////////////////////////////////////////////////////////// //
848 section "just blockers" {
849   // stop it to send '\x7f'
850   {
851     keys = "S-del";
852     action = "sxed_action_noop";
853     help = "<hidden>";
854   }
858 section "miscelaneous" [backend:tty] {
859   {
860     keys = "M-9";
861     action = "sxed_force_screen_repaint";
862     help = "<hidden>";
863   }
867 // ////////////////////////////////////////////////////////////////////////// //
869 section "script test" {
870   {
871     keys = "M-f10";
872     action = "|t|sxed_frame_keybind_script";
873     help = "script test";
874     arg0str = "self.buffer.insert(self.cursor_byteofs, \"!TEST!\\n\");";
875   }