PageSourceSearch

https://cdn4.hola.org/www/hola/pub/dna/basics/vi.js

js hola.org collected 2026-09-24 10:18:32 UTC 14,707 bytes, 946 lines download raw bytes

1;(function () {// LICENSE_CODE ZON
2  'use strict'; /*jslint browser:true, es6:true, node:true, react:true*/function _typeof(o) {"@babel/helpers - typeof";return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {return typeof o;} : function (o) {return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;}, _typeof(o);}
3  var define;
4  var is_node = (typeof module === "undefined" ? "undefined" : _typeof(module)) == 'object' && module.exports;
5  if (is_node)
6  {
7    define = require('../../../../../util/require_node.js').define(module,
8    '..');
9  } else
10
11  define = self.define;
12  define([], function () {
13    var E = {};
14    E.intro = [['div',
15    [['h1',
16    ["vi Basics"],
17    { className: "title" }],
18
19    ['p',
20    [['b',
21    ["Improvements? Suggestions?"]], " email ",
22
23
24    ['a',
25    ["[email protected]"],
26    { href: "mailto:[email protected]" }], " "]]],
27
28
29
30    { className: "head" }]];
31
32    E.data = [
33    {
34      id: 'minimal',
35      title: "Minimal",
36      tag: 'h2',
37      "short": "Minimal",
38      html: []
39    },
40    {
41      id: 'hola',
42      title: "Hola's shortcuts",
43      tag: 'h3',
44      "short": "Hola's shortcuts",
45      html: [['p',
46      [['kbd',
47      ["g"]], " - Open gvim (from bash)"]]]
48
49
50
51    },
52    {
53      id: 'minimal-files',
54      title: "Files",
55      tag: 'h3',
56      "short": "Files",
57      html: [['p',
58      [['kbd',
59      [":"]],
60
61      ['code',
62      ["q"]], " - quit",
63
64
65      ['br'],
66      ['kbd',
67      [":"]],
68
69      ['code',
70      ["w"]], " - save",
71
72
73      ['br'],
74      ['kbd',
75      [":"]],
76
77      ['code',
78      ["x"]], " - save and quit",
79
80
81      ['br'],
82      ['kbd',
83      [":"]],
84
85      ['code',
86      ["wqa"]], " - save and quit on all open windows "]]]
87
88
89
90    },
91    {
92      id: 'minimal-jump',
93      title: "Jumping to lines",
94      tag: 'h3',
95      "short": "Jumping to lines",
96      html: [['p',
97      [['code',
98      ["401gg"]], " - line 401",
99
100
101      ['br'],
102      ['code',
103      ["gg"]], " - begining of file",
104
105
106      ['br'],
107      ['kbd',
108      ["Shift"]], "+",
109
110
111      ['kbd',
112      ["G"]], " - end of file",
113
114
115      ['br']]]]
116
117    },
118    {
119      id: 'minimal-editing',
120      title: "Editing",
121      tag: 'h3',
122      "short": "Editing",
123      html: [['p',
124      [['kbd',
125      ["I"]], " - insert mode (to add the word ",
126
127
128      ['code',
129      ["hello"]], " at the possition of the cursor type ",
130
131
132      ['code',
133      ["ihello"]],
134
135      ['kbd',
136      ["ESC"]], ")",
137
138
139      ['br'],
140      ['kbd',
141      ["Shift"]], "+",
142
143
144      ['kbd',
145      ["A"]], " - add text at the end of the line (add ",
146
147
148      ['code',
149      [";"]], " at the end of this line: ",
150
151
152      ['code',
153      ["A;"]],
154
155      ['kbd',
156      ["ESC"]], ")",
157
158
159      ['br'],
160      ['kbd',
161      ["Shift"]], "+",
162
163
164      ['kbd',
165      ["I"]], " - adds at beginning of line",
166
167
168      ['br'],
169      ['kbd',
170      ["O"]], " - add a new line and goto insert mode (",
171
172
173      ['kbd',
174      ["Shift"]], "+",
175
176
177      ['code',
178      ["O"]], " add above the cursor)",
179
180
181      ['br'],
182      ['kbd',
183      ["ESC"]], " - exit edit mode",
184
185
186      ['br'],
187      ['kbd',
188      ["x"]], " - delete a char",
189
190
191      ['br'],
192      ['code',
193      ["dd"]], " - delete a line (",
194
195
196      ['code',
197      ["dw"]], " delete a word)",
198
199
200      ['br'],
201      ['code',
202      ["yy"]], " - copy a line into buffer (",
203
204
205      ['code',
206      ["yw"]], " copy a word)",
207
208
209      ['br'],
210      ['kbd',
211      ["p"]], " - paste buffer (",
212
213
214      ['kbd',
215      ["Shift"]], "+",
216
217
218      ['kbd',
219      ["P"]], " paste before cursor)",
220
221
222      ['br']]]]
223
224    },
225    {
226      id: 'basics',
227      title: "Basics",
228      tag: 'h2',
229      "short": "Basics",
230      html: []
231    },
232    {
233      id: 'basics-editing',
234      title: "Editing",
235      tag: 'h3',
236      "short": "Editing",
237      html: [['p',
238      [['code',
239      ["\"*y"]], " - copy to Windows buffer yunk",
240
241
242      ['br'],
243      ['code',
244      ["\"*p"]], " - paste from Windows buffer",
245
246
247      ['br'],
248      ['code',
249      [">>"]], " - indent section one tab (",
250
251
252      ['code',
253      ["<<"]], " unindent)",
254
255
256      ['br'],
257      ['kbd',
258      ["="]], " - automatically indent section according to language rules",
259
260
261      ['br']]]]
262
263    },
264    {
265      id: 'basics-movement',
266      title: "Movement",
267      tag: 'h3',
268      "short": "Movement",
269      html: [['p',
270      [['kbd',
271      ["W"]], " - next word (",
272
273
274      ['kbd',
275      ["Shift"]], "+",
276
277
278      ['kbd',
279      ["W"]], " search for whitespace), b and B for back word, e - end of word\n                (E search for whitespace)",
280
281
282
283      ['br'],
284      ['code',
285      ["]]"]], " - next function (",
286
287
288      ['code',
289      ["[["]], " back)",
290
291
292      ['br'],
293      ['code',
294      ["]["]], " - end of function (",
295
296
297      ['code',
298      ["[]"]], " back)",
299
300
301      ['br'],
302      ['kbd',
303      ["F"]], "+",
304
305
306      ['code',
307      ["<char>"]], " - next char (",
308
309
310      ['kbd',
311      ["Shift"]], "+",
312
313
314      ['kbd',
315      ["F"]], " back), ",
316
317
318      ['kbd',
319      ["T"]], " and ",
320
321
322      ['kbd',
323      ["Shift"]], "+",
324
325
326      ['kbd',
327      ["T"]], " to get to before next char "]]]
328
329
330
331    },
332    {
333      id: 'basics-visual',
334      title: "Visual",
335      tag: 'h3',
336      "short": "Visual",
337      html: [['p',
338      [['kbd',
339      ["V"]], " - select area",
340
341
342      ['br'],
343      ['kbd',
344      ["Ctrl"]], "+",
345
346
347      ['kbd',
348      ["V"]], " - select area in column mode",
349
350
351      ['br'],
352      ['br'], " after area is selected:",
353
354      ['br'],
355      ['kbd',
356      ["D"]], " - delete",
357
358
359      ['br'],
360      ['code',
361      [">>"]], " - indent section",
362
363
364      ['br'],
365      ['kbd',
366      ["Y"]], " - copy to buffer (yunk)",
367
368
369      ['br'],
370      ['kbd',
371      ["Ctrl"]], "+",
372
373
374      ['kbd',
375      ["C"]], " - copy to Windows Buffer (you can paste with Windows\n                applications) "]]]
376
377
378
379
380    },
381    {
382      id: 'basics-formatting',
383      title: "Formatting",
384      tag: 'h3',
385      "short": "Formatting",
386      html: [['p',
387      [['code',
388      ["gq"]], " - format (wrap text) selected area",
389
390
391      ['br'],
392      ['code',
393      ["gqq"]], " - format (wrap text) current line",
394
395
396      ['br'],
397      ['code',
398      ["gqap"]], " - format current paragraph",
399
400
401      ['br'],
402      ['kbd',
403      ["Shift"]], "+",
404
405
406      ['kbd',
407      ["J"]], " - merge current line with the following line",
408
409
410      ['br']]]]
411
412    },
413    {
414      id: 'basics-macro_misc',
415      title: "'Macro' like and\n  misc",
416
417      tag: 'h3',
418      "short": "'Macro' like and misc",
419      html: [['p',
420      [['code',
421      ["[n][operation]"]], " - perform an operation n times",
422
423
424      ['br'], " examples:",
425
426      ['br'],
427      ['code',
428      ["5dd"]], " - delete 5 lines",
429
430
431      ['br'],
432      ['code',
433      ["29[down arrow]"]], " - go down 29 lines",
434
435
436      ['br'],
437      ['kbd',
438      ["U"]], " - undo",
439
440
441      ['br'],
442      ['kbd',
443      ["Ctrl"]], "+",
444
445
446      ['kbd',
447      ["R"]], " - redo "]]]
448
449
450
451    },
452    {
453      id: 'basics-telnet',
454      title: "Using VIM from telnet",
455      tag: 'h3',
456      "short": "Using VIM from telnet",
457      html: [['p',
458      [['kbd',
459      ["H"]],
460
461      ['kbd',
462      ["J"]],
463
464      ['kbd',
465      ["K"]],
466
467      ['kbd',
468      ["L"]], " - left down up right",
469
470
471      ['br'],
472      ['kbd',
473      ["Ctrl"]], "+",
474
475
476      ['kbd',
477      ["F"]], " - page down (",
478
479
480      ['kbd',
481      ["Ctrl"]], "+",
482
483
484      ['kbd',
485      ["B"]], " - page up) "]]]
486
487
488
489    },
490    {
491      id: 'basics-search_replace',
492      title: "Search and\n  Replace",
493
494      tag: 'h3',
495      "short": "Search and Replace",
496      html: [['p',
497      [['kbd',
498      ["*"]], " - search for the current word the cursor is on (same as ",
499
500
501      ['kbd',
502      ["Ctrl"]], "+",
503
504
505      ['kbd',
506      ["F3"]], " in MSDEV)",
507
508
509      ['br'],
510      ['kbd',
511      ["N"]], " - find next (",
512
513
514      ['kbd',
515      ["Shift"]], "+",
516
517
518      ['kbd',
519      ["N"]], " back)",
520
521
522      ['br'],
523      ['kbd',
524      ["/"]],
525
526      ['code',
527      ["main"]], " - search for main (such as main_app)",
528
529
530      ['br'],
531      ['kbd',
532      ["/"]],
533
534      ['code',
535      ["\\<main\\>"]], " - search for main as whole word",
536
537
538      ['br'],
539      ['kbd',
540      ["/"]],
541
542      ['code',
543      ["\\<print"]], " - search for words starting with print (such as printf)",
544
545
546      ['br'],
547      ['kbd',
548      [":"]],
549
550      ['code',
551      ["se ic"]], " - set the option of ignorecase",
552
553
554      ['br'],
555      ['kbd',
556      ["/"]],
557
558      ['code',
559      ["main"]], " - after the set option, search for main and ignore case (such\n                as Main) (",
560
561
562
563      ['kbd',
564      [":"]],
565
566      ['code',
567      ["se noic"]], " - this option is: no ignorecase)",
568
569
570      ['br'],
571      ['kbd',
572      [":"]],
573
574      ['code',
575      ["%s/printf/kprintf/g"]], " - search in all file (",
576
577
578      ['code',
579      ["%"]], " - all the file) for printf, replace with kprintf, replace all\n                occurrences (",
580
581
582
583      ['code',
584      ["g"]], ") - without the ",
585
586
587      ['code',
588      ["g"]], " option, if there are some occurrences in the same line - only\n                the first one will be changed.",
589
590
591
592      ['br'], " other options: ignore case (",
593
594      ['code',
595      ["i"]], "), conditional - ask yes/no (",
596
597
598      ['code',
599      ["c"]], ").",
600
601
602      ['br'],
603      ['kbd',
604      [":"]],
605
606      ['code',
607      ["%s/add(a,\\([a-z]\\+\\))/add(a, \\1)/g"]], " - search in all file all occurrences of the 'add()' function\n                and make sure it's second variable has a space after the\n                comma. ",
608
609
610
611
612      ['code',
613      ["\\("]], " and ",
614
615
616      ['code',
617      ["\\)"]], " group the second variable pattern and refer to it inside the\n                replacement pattern by its special number ",
618
619
620
621      ['code',
622      ["\\1"]], ". "]]]
623
624
625
626    },
627    {
628      id: 'advanced',
629      title: "Advanced",
630      tag: 'h2',
631      "short": "Advanced",
632      html: []
633    },
634    {
635      id: 'advanced-insert_mode',
636      title: "In insert mode",
637      tag: 'h3',
638      "short": "In insert mode",
639      html: [['p',
640      [['kbd',
641      ["Ctrl"]], "+",
642
643
644      ['kbd',
645      ["X"]], " - auto completion.",
646
647
648      ['br'],
649      ['kbd',
650      ["Ctrl"]], "+",
651
652
653      ['kbd',
654      ["P"]], " - complete word from current file and included files (",
655
656
657      ['kbd',
658      ["Ctrl"]], "+",
659
660
661      ['kbd',
662      ["N"]], " same but without included files)",
663
664
665      ['br'],
666      ['kbd',
667      ["Ctrl"]], "+",
668
669
670      ['kbd',
671      ["D"]], " definition of macro",
672
673
674      ['br'],
675      ['kbd',
676      ["Ctrl"]], "+",
677
678
679      ['kbd',
680      ["F"]], " file name",
681
682
683      ['br']]]]
684
685    },
686    {
687      id: 'advanced-buffers',
688      title: "Buffers",
689      tag: 'h3',
690      "short": "Buffers",
691      html: [['p',
692      [['kbd',
693      [":"]],
694
695      ['code',
696      ["e app.c"]], " - open app.c in a new buffer",
697
698
699      ['br'],
700      ['code',
701      ["gf"]], " - when standing on a file-name, opens the file in a new\n                buffer",
702
703
704
705      ['br'],
706      ['kbd',
707      [":"]],
708
709      ['code',
710      ["b 2"]], " - goto buffer number 2",
711
712
713      ['br'],
714      ['kbd',
715      [":"]],
716
717      ['code',
718      ["buffers"]], " - list open buffers",
719
720
721      ['br'],
722      ['kbd',
723      [":"]],
724
725      ['code',
726      ["bd"]], " - close buffer",
727
728
729      ['br'],
730      ['kbd',
731      [":"]],
732
733      ['code',
734      ["b#"]], " - goto last buffer",
735
736
737      ['br'],
738      ['kbd',
739      ["Ctrl"]], "+",
740
741
742      ['code',
743      ["6"]], " - goto last buffer",
744
745
746      ['br'],
747      ['kbd',
748      [":"]],
749
750      ['code',
751      ["set hidden"]], " - Allow switching buffers without saving.",
752
753
754      ['br']]]]
755
756    },
757    {
758      id: 'advanced-compiling',
759      title: "\n  Compiling and handling errors",
760
761      tag: 'h3',
762      "short": "Compiling and handling errors (IDE like)",
763      html: [['p',
764      [['kbd',
765      ["Shift"]], "+",
766
767
768      ['kbd',
769      ["K"]], " - show the man page for current word (same as ",
770
771
772      ['kbd',
773      ["F1"]], " in Windows)",
774
775
776      ['br'],
777      ['kbd',
778      [":"]],
779
780      ['code',
781      ["make"]], " - run make (gmake), and show results",
782
783
784      ['br'],
785      ['kbd',
786      [":"]],
787
788      ['code',
789      ["cc"]], " - goto source of current error (:cn next error, :cp previous\n                error)",
790
791
792
793      ['br'],
794      ['kbd',
795      [":"]],
796
797      ['code',
798      ["cl"]], " - list the",
799
800
801      ['br']]]]
802
803    },
804    {
805      id: 'advanced-gdiff',
806      title: "Graphical diff",
807      tag: 'h3',
808      "short": "Graphical diff",
809      html: [['p',
810      [" startup:",
811      ['br'],
812      ['code',
813      ["gvim -d FILE1 unknown"]],
814
815      ['br'],
816      ['br'],
817      ['kbd',
818      ["Ctrl"]], "+",
819
820
821      ['kbd',
822      ["W"]], "+",
823
824
825      ['kbd',
826      ["W"]], " - toggle between windows",
827
828
829      ['br'],
830      ['br'], " Make the current window part of the diff windows:",
831
832      ['br'],
833      ['kbd',
834      [":"]],
835
836      ['code',
837      ["diffthis main.c~"]],
838
839      ['br'],
840      ['br'], " View the same buffer in diff mode in one window and \"normal\"\n                in another:",
841
842
843      ['br'],
844      ['kbd',
845      [":"]],
846
847      ['code',
848      [":!cp % tempfile"]],
849
850      ['br'],
851      ['kbd',
852      [":"]],
853
854      ['code',
855      [":diffsplit tempfile"]],
856
857      ['br'],
858      ['br'], " To force the differences to be updated use: ",
859
860      ['kbd',
861      [":"]],
862
863      ['code',
864      ["diffupdate"]],
865
866      ['br'],
867      ['br'], " Jumping to diffs:",
868
869      ['br'],
870      ['kbd',
871      ["["]], "+",
872
873
874      ['kbd',
875      ["C"]], " (or ",
876
877
878      ['kbd',
879      ["shift"]], "+",
880
881
882      ['kbd',
883      ["tab"]], ")- Jump backwards to the previous start of a change.",
884
885
886      ['br'],
887      ['kbd',
888      ["]"]], "+",
889
890
891      ['kbd',
892      ["C"]], " (or ",
893
894
895      ['kbd',
896      ["tab"]], ") - Jump forwards to the next start of a change.",
897
898
899      ['br'],
900      ['br'], " Diff copying:",
901
902      ['br'],
903      ['kbd',
904      [":"]],
905
906      ['code',
907      ["[range]diffget"]], " - Modify the current buffer to undo diff with another buffer.",
908
909
910      ['br'],
911      ['kbd',
912      [":"]],
913
914      ['code',
915      ["[range]diffput"]], " - Modify another buffer to undo diff with the current buffer.\n                "]]]
916
917
918
919
920    },
921    {
922      id: 'advanced-hola_spec',
923      title: "Hola specific\n  extensions (after installing vimrc_zon)",
924
925      tag: 'h3',
926      "short": "Hola specific extensions",
927      html: [['p',
928      [" bash alias gvim->g: ",
929      ['code',
930      ["$ g a_file.txt"]],
931
932      ['br'],
933      ['code',
934      ["zdiff"]], ": executing ",
935
936
937      ['code',
938      ["cvsdiff"]], " on all modified (M) files "]]]
939
940
941
942    }];
943
944    return E;
945  });})();
946//# sourceMappingURL=vi.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.