on 7dddbca help sign in
helix/runtime/tutor
1191 lines 37 kB history raw
3 .
4 ###x. .|
5 d#####x, ,v||
6 '+#####v||||||
7 ,v|||||+'. _ _ _
8 ,v|||||^'>#### | | | | ___ | | (_) __ __
9 |||||^' .v#### | |___| | / \ | | _ \ \/ /
10 ||||=..v#####P' | ___ | / ^ | | | | | \ /
11 ''v'>#####P' | | | | | --- | | | | / \
12 ,######/P||x. |_| |_| \___/ |_| |_| /_/\_\
13 ####P' "x|||||,
14 |/' 'x||| A post-modern modal text editor.
15 ' '|
18 Welcome to the Helix tutorial!
19 Press the j key until you reach the introduction.
23=================================================================
24= INTRODUCTION =
25=================================================================
27 Welcome to the Helix editor! Helix is different from editors
28 you might be used to in that it is modal, meaning that it has
29 different modes for editing text. The primary modes you will
30 use are Normal mode and Insert mode. While in Normal mode, the
31 keys you type won't actually type text. Instead, they will
32 perform various actions with the text. This allows for more
33 efficient editing. This tutor will teach you how you can make
34 use of Helix's modal editing features. To begin, ensure your
35 CapsLock key is not pressed and hold the j key until you reach
36 the first lesson.
45=================================================================
46= 1.1 BASIC CURSOR MOVEMENT =
47=================================================================
49 ↑
50 k * h is on the left
51 ← h l → * l is on the right
52 j * j looks like a down arrow
53 ↓
55 The cursor can be moved using the h, j, k, l keys, as shown
56 above. The cursor / arrow keys will also work, but it is faster
57 to use the hjkl keys as they are closer to the other keys you
58 will be using. Try moving around to get a feel for hjkl.
59 Once you're ready, hold j to continue to the next lesson.
67=================================================================
68= 1.2 EXITING HELIX =
69=================================================================
71 1. Type : to enter Command mode. Your cursor will
72 move to the bottom of the screen.
73 2. Type q or quit and press Enter to exit Helix.
75 Note: The quit command will fail if there are unsaved changes.
76 To force quit and DISCARD these changes, type q! or quit!.
77 You will learn how to save files later.
79 To exit Command mode without entering a command, press Escape.
81 Now, move on to the next lesson.
89=================================================================
90= 1.3 DELETION =
91=================================================================
93 Type the d key to delete the character under the cursor.
95 1. Move the cursor to the line marked '-->' below.
96 2. Move the cursor to each extra character, and type d to
97 delete it.
99 --> Thhiss senttencee haass exxtra charracterss.
100 This sentence has extra characters.
102 Once the sentence is correct, move on to the next lesson.
111=================================================================
112= 1.4 INSERT MODE =
113=================================================================
115 Type the i key to enter Insert mode.
117 1. Move the cursor to the line marked '-->' below.
118 2. Move to a place in the line which is missing text and type
119 i to enter Insert mode. Keys you type will now type text.
120 3. Enter the missing text.
121 4. Press Escape to exit Insert mode and return to Normal mode.
122 5. Repeat until the line matches the line below it.
124 --> Th stce misg so.
125 This sentence is missing some text.
127 Note: The status bar will display your current mode.
128 Notice that when you type i, 'NOR' changes to 'INS'.
133=================================================================
134= 1.5 SAVING A FILE =
135=================================================================
137 Type :w / :write to save a file.
139 1. Exit Helix using :q! as explained before, or open a new
140 terminal.
141 2. Open a file in Helix by running: hx FILENAME
142 3. Make some edits to the file.
143 4. Type : to enter Command mode.
144 5. Type w or write, and press Enter to save the file.
146 You can also type wq or write-quit to save and exit.
148 Note: You can optionally enter a filepath after the w / write
149 command in order to save to that path.
150 Note: If there are any unsaved changes to a file, a plus [+]
151 will appear next to the file name in the status bar.
155=================================================================
156= CHAPTER 1 RECAP =
157=================================================================
159 * Use the h,j,k,l keys to move the cursor.
161 * Type : to enter Command mode.
162 * The q / quit and q! / quit! commands will exit Helix. The
163 former fails when there are unsaved changes. The latter
164 discards them.
165 * The w / write command will save the file.
166 * The wq / write-quit command will do both.
168 * Type d to delete the character at the cursor.
170 * Type i to enter Insert mode and type text. Press Escape to
171 return to Normal mode.
177=================================================================
178= 2.1 MORE INSERT COMMANDS =
179=================================================================
181 As you saw, you can type i to enter Insert mode at the current
182 position of the cursor. There are a few other ways you can
183 enter Insert mode at different locations.
185 Common examples of insertion commands include:
186 i - Insert before the selection.
187 a - Insert after the selection. (a means 'append')
188 I - Insert at the start of the line.
189 A - Insert at the end of the line.
191 1. Move to anywhere in the line marked '-->' below.
192 2. Type A (Shift-a), your cursor will move to the end of
193 the line and you will be able to type.
194 3. Type the text necessary to match the line below.
196 --> This sentence is miss
197 This sentence is missing some text.
199=================================================================
200= 2.2 OPENING LINES =
201=================================================================
203 Type o to add a newline and insert below the cursor.
204 Type O to add a newline and insert above the cursor.
206 1. Move the cursor to the line marked '-->' below.
207 2. Type o to open a line below and type your answer.
209 --> What is the best editor?
221=================================================================
222= CHAPTER 2 RECAP =
223=================================================================
225 * Type a to append to the selection.
227 * Type I to enter Insert mode at the first non-whitespace
228 character at the start of a line.
230 * Type A to enter Insert mode at the end of a line.
232 * Use o and O to open lines below and above the cursor respectively.
243=================================================================
244= 3.1 MOTIONS AND SELECTIONS =
245=================================================================
247 Type w to select forward until the next word.
249 The d key doesn't actually delete the character at the cursor,
250 it deletes all selected text. Your cursor is like a
251 single-character selection.
253 1. Move the cursor to the line marked '-->' below.
254 2. Move to the beginning of a word that needs to be deleted.
255 3. Type w to select until the beginning of the next word.
256 4. Type d to delete the selection.
257 5. Repeat for all extra words in the line.
259 --> This sentence pencil has vacuum extra words in the it.
260 This sentence has extra words in it.
265=================================================================
266= 3.2 MORE MOTIONS =
267=================================================================
269 As you saw, typing w moves the cursor forward until the start
270 of the next word, selecting the text traversed. This is useful
271 for moving around text and for selecting text to operate on.
273 Some common motions include:
274 w - Move forward to before the beginning of the next word.
275 e - Move forward to the end of the current word.
276 b - Move backward to the beginning of the current word.
278 To select the word under cursor, combine e and b.
280 1. Move the cursor to the line marked '-->' below.
281 2. Move to a 'd' letter.
282 3. Type e to select a half of the word.
283 4. Type b to select the rest.
285--> The Middle Kingdom.
287=================================================================
288= 3.3 WORDS AND words =
289=================================================================
291 The w,e,b motions also have counterparts - W,E,B - which
292 traverse WORDS instead of words. WORDS are only separated by
293 whitespace, whereas words can be separated by other characters
294 in addition to whitespace.
296 1. Move the cursor to the beginning of the line marked with '-->'.
297 2. Type w repeatedly to select individual words until you
298 reach the end of the line.
299 3. Note that 'one-of-a-kind' required 7 keystrokes to be
300 traversed. '"modal"' required 3 keystrokes.
301 4. Move the cursor back to beginning of the line marked '-->'.
302 5. Type W repeatedly to select individual WORDS.
303 6. Note that 'one-of-a-kind' and '"modal"' have been selected
304 both with one keystroke each.
306--> Helix is a one-of-a-kind "modal" text editor
309=================================================================
310= 3.4 THE CHANGE COMMAND =
311=================================================================
313 Type c to change the current selection.
315 The change command deletes the current selection and enters
316 Insert mode, so it is a very common shorthand for di.
318 1. Move the cursor to the line marked '-->' below.
319 2. Move to the start of an incorrect word and type w to
320 select it.
321 3. Type c to delete the word and enter Insert mode.
322 4. Type the correct word.
323 5. Repeat until the line matches the line below it.
325 --> This paper has heavy words behind it.
326 This sentence has incorrect words in it.
331=================================================================
332= 3.5 COUNTS WITH MOTIONS =
333=================================================================
335 Type a number before a motion to repeat it that many times.
337 1. Move the cursor to the line marked '-->' below.
338 2. Type 2w to move 2 words forward.
339 3. Type 3e to move to the end of the third word forward.
340 4. Type 2b to move 2 words backwards
341 5. Try the above with different numbers.
343 --> This is just a line with words you can move around in.
353=================================================================
354= 3.6 SELECT / EXTEND MODE =
355=================================================================
357 Type v to enter Select mode.
358 Type v again or Escape to return to Normal mode
359 In Select mode every movement will extend the selection, as
360 opposed to replacing it.
362 1. Move the cursor to the line marked '-->' below.
363 2. Move to the F of FOO and type v2w to select the two words.
364 3. Type d to remove the two words. Notice d returns you to
365 Normal mode.
366 4. Move to the B of BAZ and repeat the sequence to delete them.
368 --> Remove the FOO BAR distracting words BAZ BIZ from this line.
375=================================================================
376= 3.7 SELECTING LINES =
377=================================================================
379 Type x to select a whole line. Type x again to select the next.
381 1. Move the cursor to the second line marked '-->' below.
382 2. Type x to select the line, and d to delete it.
383 3. Move to the fourth line.
384 4. Type x twice or type 2x to select 2 lines, and d to delete.
386 --> 1) Roses are red,
387 --> 2) Mud is fun,
388 --> 3) Violets are blue,
389 --> 4) I have a car,
390 --> 5) Clocks tell time,
391 --> 6) Sugar is sweet,
392 --> 7) And so are you.
394 Note : X works similarly to x although it doesn't extend to
395 subsequent lines. X on an empty line does nothing.
397=================================================================
398= 3.8 COLLAPSING SELECTIONS =
399=================================================================
401 Type ; to collapse selections to single cursors.
403 Sometimes, you want to deselect without having to move the
404 cursor(s). This can be done using the ; key.
406 1. Move the cursor to the line marked '-->' below.
407 2. Use the motions you have learned to move around the line,
408 and try using ; to deselect the text after it is selected
409 by the motions.
411 --> This is an error-free line with words to move around in.
413 Note: This works the same in Select mode.
414 Note: Another related command is Alt-; which flips selections.
419=================================================================
420= CHAPTER 3 RECAP =
421=================================================================
423 * Type w to select forward until the next word.
424 * Type e to select to the end of the current word.
425 * Type b to select backward to the start of the current word.
426 * Use uppercase counterparts, W,E,B, to traverse WORDS.
428 * Type d to delete the entire selection.
429 * Type c to delete the selection and enter Insert mode.
431 * Type a number before a motion to repeat it that many times.
433 * Type v to enter Select mode, where all motions extend the
434 selection.
436 * Type x to select the entire current line. Type x again to
437 select the next line.
439 * Type semicolon ( ; ) to collapse selection.
441=================================================================
442= 4.1 UNDOING =
443=================================================================
445 Type u to undo. Type U to redo.
447 1. Move the cursor to the line marked '-->' below.
448 2. Move to the first error, and type d to delete it.
449 3. Type u to undo your deletion.
450 4. Fix all the errors on the line.
451 5. Type u several times to undo your fixes.
452 6. Type U (Shift-u) several times to redo your fixes.
454 --> Fiix the errors on thhis line and reeplace them witth undo.
463=================================================================
464= 4.2 COPYING AND PASTING TEXT =
465=================================================================
467 Type y to yank (copy) the selection.
468 Type p to paste the yanked selection after the cursor.
469 Type P to paste the yanked text before the cursor.
471 1. Move the cursor to the line marked '-->' below.
472 Make sure your cursor is on the "b" of banana.
473 2. Type w to select "banana" and y to yank it.
474 3. Move to the space between "2" and "3" and type p to paste.
475 4. Repeat between "3" and "4".
477 --> 1 banana 2 3 4
478 1 banana 2 banana 3 banana 4
480 Note: Whenever you delete or change text, Helix will copy the
481 altered text. Use Alt-d / Alt-c instead to avoid this.
482 Note: Helix doesn't share the system clipboard by default. Type
483 Space + y / p to yank / paste on the system's clipboard.
485=================================================================
486= 4.3 SEARCHING IN FILE =
487=================================================================
489 Type / to search forward in file, Enter to confirm search.
490 Type n to go to the next search match.
491 Type N to go to the previous search match.
493 1. Type / and type in a common word, like 'banana'.
494 2. Press Enter to confirm the search.
495 3. Use n and N to cycle through the matches.
497 Searching uses regular expressions, allowing you to target more
498 complex expressions, which you'll learn about in the lesson on
499 the select command.
501 Note: To search backwards, type ? (Shift-/).
502 Note: Unlike Vim, ? doesn't change the search direction.
503 N always goes backwards and n always goes forwards.
507=================================================================
508= CHAPTER 4 RECAP =
509=================================================================
511 * Type u to undo. Type U to redo.
513 * Type y to yank (copy) text and p to paste.
514 * Use Space + y and Space + p to yank / paste on the system
515 clipboard.
517 * Type / to search forward in file, and ? to search backwards.
518 * Use n and N to cycle through search matches.
529=================================================================
530= 5.1 MULTIPLE CURSORS =
531=================================================================
533 Type C to duplicate the cursor to the next suitable line.
535 1. Move the cursor to the first line marked '-->' below. Place
536 the cursor somewhere past the '-->'.
537 2. Type C to duplicate the cursor to the next suitable line.
538 Notice how it skips the line in the middle. Keys you type
539 will now affect both cursors.
540 3. Use Insert mode to correct the lines. The two cursors will
541 fix both lines simultaneously.
542 4. Type , to remove the second cursor.
544 --> Fix th two nes at same ime.
545 -->
546 --> Fix th two nes at same ime.
547 Fix these two lines at the same time.
549 Note: Press Alt-C to do the same above the cursor.
551=================================================================
552= 5.2 THE SELECT COMMAND =
553=================================================================
555 Type s to select matches in the selection.
557 1. Move the cursor to the line marked '-->' below.
558 2. Type x to select the line.
559 3. Type s. A prompt will appear.
560 4. Type 'apples' and press Enter. Both occurrences of
561 'apples' in the line will be selected.
562 5. You can now type c and change 'apples' to something else,
563 like 'oranges'.
564 6. Press Escape to exit Insert mode.
565 7. Type , to remove the second cursor.
567 --> I like to eat apples since my favorite fruit is apples.
568 I like to eat oranges since my favorite fruit is oranges.
573=================================================================
574= 5.3 SELECTING VIA REGEX =
575=================================================================
577 Like searching, the select command selects regular expressions,
578 not just exact matches.
580 1. Move the cursor to the line marked '-->' below.
581 2. Select the line with x and then type s.
582 3. Type ' +' to select any amount of consecutive spaces >1,
583 then press Enter.
584 4. Type c and change the matches to single spaces.
586 --> This sentence has some extra spaces.
587 This sentence has some extra spaces.
589 Note: If you want to perform find-and-replace, the select
590 command is the way to do it. Select the text you want
591 to replace in — type % to select the whole file — and
592 then perform the steps explained above.
595=================================================================
596= 5.4 ALIGN SELECTIONS =
597=================================================================
599 Type & to align the contents of the selections.
601 1. Move the cursor to the first line marked '-->' below. Place
602 the cursor on the whitespace just after the arrow.
603 2. Type C four times or 4C.
604 3. Type W to select the numbers and brackets.
605 4. Type & to align the words.
607 --> 97) lorem
608 --> 98) ipsum
609 --> 99) dolor
610 --> 100) sit
611 --> 101) amet
613 Note: & only cares about the alignment of the "head" of the
614 selections - the end that moves. The other end is called
615 the "anchor".
617=================================================================
618= 5.5 SPLIT SELECTION INTO LINES =
619=================================================================
621 Press Alt-s to split the selection(s) on newlines.
623 1. Move the cursor to the first row of the table below.
624 2. Select the entire table with 6x.
625 3. Press Alt-s to split into selections at each line.
626 4. Align the table with &.
628 | FRUIT | AMOUNT |
629 |---------|--------|
630 | Apples | 8 |
631 | Bananas | 6 |
632 | Oranges | 3 |
633 | Donuts | 4 |
639=================================================================
640= CHAPTER 5 RECAP =
641=================================================================
643 * Type C to duplicate the cursor to the next suitable line
644 and Alt-C for previous suitable line.
646 * Type s to select all instances of a regex pattern inside
647 the current selection.
649 * Type & to align selections.
651 * Press Alt-s to split the selection into lines.
661=================================================================
662= 6.1 SELECTING TO A CHARACTER =
663=================================================================
665 Type f<ch> to select up to and including (find) a character.
666 Type t<ch> to do the same, but not including (till) a character.
667 Type uppercase F / T to do the same backwards.
669 1. Move the cursor to the line marked '-->' below. Place the
670 cursor on the first dash.
671 2. Type f[ to select to the square bracket.
672 3. Type d to delete your selection.
673 4. Go to the end of the line and repeat with F].
674 5. Move to the second line marked '-->', just after the arrow.
675 6. Use t and T to delete the dashes around the sentence.
677 --> -----[Free this sentence of its brackets!]-----
678 --> ------Free this sentence of its dashes!------
680 Note: Unlike Vim, Helix doesn't limit these commands to the
681 current line. It searches for the character in the file.
683=================================================================
684= 6.2 THE REPLACE COMMAND =
685=================================================================
687 Type r<ch> to replace all selected characters with <ch>.
689 1. Move to the second line of the table, place the cursor on the
690 first =.
691 2. Type t| (Shift-\) to select the = separator.
692 3. Type r- to replace the separator with dashes.
695 | Month | Days |
696 |=======|------|
697 | Jan | 31 |
698 | Feb | 28 |
699 | Mar | 31 |
700 | ... | ... |
705=================================================================
706= 6.3 REPETITION =
707=================================================================
709 Type . to repeat the last insert command.
710 Press Alt-. to repeat the last f / t selection.
712 1. Move the cursor to the line marked '-->' below.
713 2. Make a change, insertion or appendage and repeat it with . .
714 3. Try using Alt-. with f and t, to select multiple sentences
715 for instance.
717 --> This is some text for you to repeat things. You can repeat
718 insertions like changing words, or repeat selections like
719 f / t.
727=================================================================
728= CHAPTER 6 RECAP =
729=================================================================
731 * Type f / F to extend selection up to & including a character.
732 * Type t / T to extend selection until a character.
734 * Type r to replace selected characters.
736 * Type . to repeat the last insertion.
737 * Press Alt-. to repeat the last f / t selection.
749=================================================================
750= 7.1 REPLACE WITH YANKED TEXT =
751=================================================================
753 Type R to replace the selection with previously yanked text.
755 1. Move the cursor to the line marked '-->' below.
756 2. Type w to select "watermelons" and then y to yank it.
757 3. Select "oranges" with w.
758 4. Type R to replace "oranges" with "watermelons"
761 --> I like watermelons because oranges are refreshing.
762 I like watermelons because watermelons are refreshing.
771=================================================================
772= 7.2 JOINING LINES =
773=================================================================
775 Type J to join together lines in selection.
777 1. Move the cursor to the line marked '-->' below.
778 2. Type x four times or 4x to select all four lines.
779 3. Type J to join the lines together.
781 --> This sentence
782is spilling over
783onto other
784lines.
786 This sentence is spilling over onto other lines.
793=================================================================
794= 7.3 INDENTING LINES =
795=================================================================
797 Type > to indent a line and < to outdent it.
799 1. Move the cursor to the line marked '-->' below.
800 2. Move down to the second line and type > to indent it.
801 3. Move to the third line and type < to outdent it.
803 --> These lines
804 are indented
805 very poorly.
807 These lines
808 are indented
809 much better.
815=================================================================
816= 7.4 INCREMENTING AND DECREMENTING =
817=================================================================
819 Press Ctrl-a to increment the number under selection.
820 Press Ctrl-x to decrement the number under selection.
822 1. Move the cursor to the third line marked '-->' below.
823 2. Press Ctrl-a to increment the second point marked 2.
824 3. Repeat for the point marked 3.
825 4. Move to the last point and press Ctrl-x to decrement the 6.
827 --> 1) First point.
828 --> 2) Added point.
829 --> 2) Next point.
830 --> 3) Another point.
831 --> 6) Last point.
837=================================================================
838= CHAPTER 7 RECAP =
839=================================================================
841 * Type R to replace the selection with yanked text.
843 * Type J to join lines in selection.
845 * Type < and > to indent / outdent lines.
847 * Press Ctrl-a to increment the selected number.
848 * Press Ctrl-x to decrement the selected number.
859=================================================================
860= 8.1 REGISTERS =
861=================================================================
863 Registers are containers identified by a character for storing
864 things like yanked text. Registers are also used to store the
865 most recent search term as well as macros, which you'll learn
866 about in the next section.
868 Type "<ch> to select register <ch>.
870 1. Move the cursor to the line marked '-->' below.
871 2. Type w to select "watermelons" and yank with y.
872 3. Type w to select "bananas".
873 4. Change to register b with "b and yank with y.
874 5. Select "mangoes" and type R to replace it with "watermelons".
875 6. Select "pineapples" then type "b R to replace with "bananas".
877 --> I like watermelons and bananas because my favorite fruits
878 are mangoes and pineapples.
881=================================================================
882= 8.2 MACROS =
883=================================================================
885 Macros are a way to record a set of actions you want to repeat.
886 You can also record macros to a specific register (default @).
887 Type Q to start recording a macro - you should see a popup at
888 the bottom of your screen. Type Q again to stop recording.
889 Type q to repeat the macro from register @ (the default).
891 1. Move the cursor to the first line marked '-->' below.
892 Ensure your cursor is on the '>' of the arrow.
893 2. Type Q to start recording.
894 3. Edit the line to look like the bottom one.
895 4. Exit insert and type Q again to stop recording.
896 5. Move to the line below and put your cursor on '>' again.
897 6. Type q to repeat the macro.
899 --> ... sentence doesn't have its first and last ... .
900 --> ... sentence doesn't have its first and last ... .
901 This sentence doesn't have its first and last word.
903=================================================================
904= CHAPTER 8 RECAP =
905=================================================================
907 * Type " to select a different register.
909 * Type Q to start and stop recording a macro to a register,
910 the default being @.
912 * Type q to replay a macro from @ or the selected register.
925=================================================================
926= 9.1 SEARCHING FOR SELECTIONS =
927=================================================================
929 The most recent search with / is stored in register /.
930 n and N both refer to register /, this means we can set that
931 register without having to type in a search.
933 Type * to copy the selection into register /, setting the search
934 term to the selection. This copies the primary selection, which
935 you will learn about in the section on cycling selections.
937 1. Move the cursor to the line marked '-->' below.
938 2. Select "horse" with e and type *.
939 3. Use n and N to jump between the instances of "horse".
941 --> A horse is a horse, of course, of course,
942 --> And no one can talk to a horse of course.
944 Note: * is like a shorthand for "/y as all it really does is
945 copy the selection into the / register.
947=================================================================
948= 9.2 ADDING SELECTION ON NEXT SEARCH MATCH =
949=================================================================
951 A property of Select mode (v) when using n and N is that instead
952 of moving the selection to the next match, it adds a new
953 selection on each match.
955 1. Move the cursor to the line marked '-->' below.
956 2. Select the first "bat" and type * to set it to search.
957 3. Type v to enter Select mode.
958 4. Type n to select the other "bat".
959 5. Use c or r to change the "bat"s to "cat".
961 --> Everybody wants to be a bat,
962 --> because a cat's the only bat
963 --> who knows where it's at.
969=================================================================
970= 9.3 USING THE JUMPLIST =
971=================================================================
973 Helix can keep track of "jumps" which are big movements, like
974 searching or jumping to the definition of a function in code. It
975 stores these in what's called the jumplist.
977 Press Ctrl-s to manually save your current position to
978 the jumplist.
980 Press Ctrl-i ("in") and Ctrl-o ("out") to move forward and
981 backwards in the jumplist respectively.
983 1. Press Ctrl-s somewhere.
984 2. Move far away in the file.
985 3. Press Ctrl-o (just once!) to come back to where you saved.
991=================================================================
992= CHAPTER 9 RECAP =
993=================================================================
995 * Type * to set the search register to the primary selection.
997 * Type n / N in Select mode to add selections on each search
998 match.
1000 * Press Ctrl-s to save position to the jumplist.
1001 * Press Ctrl-i and Ctrl-o to go forward and backward in the
1002 jumplist.
1013=================================================================
1014= 10.1 CYCLING AND REMOVING SELECTIONS =
1015=================================================================
1017 Type ) and ( to cycle the primary selection forward and backward
1018 through selections respectively.
1020 Press Alt-, to remove the primary selection.
1022 1. Move the cursor to the line marked '-->' below.
1023 2. Select both lines with xx or 2x.
1024 3. Type s to select, type "would" and enter.
1025 4. Use ( and ) to cycle the primary selection and remove the
1026 very second "would" with Alt-, .
1027 5. Type c "wood" to change the remaining "would"s to "wood".
1029 --> How much would would a wouldchuck chuck
1030 --> if a wouldchuck could chuck would?
1035=================================================================
1036= 10.2 CYCLING THE CONTENT OF SELECTIONS =
1037=================================================================
1039 Press Alt-) and Alt-( to cycle the content of the selections
1040 forward and backward respectively.
1042 1. Move the cursor to the line marked '-->' below.
1043 2. Select both lines with xx or 2x.
1044 3. Type s to select, type "through|water|know" and enter.
1045 4. Use Alt-( and Alt-) to cycle the content of the selections.
1047 --> Jumping through the water,
1048 --> daring to know.
1057=================================================================
1058= 10.3 CHANGING CASE =
1059=================================================================
1061 Type ~ to switch the case of all selected letters.
1062 Type ` to set all selected letters to lowercase.
1063 Press Alt-` to set all selected letters to uppercase.
1065 1. Move the cursor to the first line marked '-->' below.
1066 2. Select each wrongly capitalised or lowercase letter
1067 and type ~ over them.
1068 3. Move to the second line marked '-->'.
1069 4. Type x to select the line.
1070 5. Type ` to change the line to lowercase.
1071 6. Move to the third line marked '-->'.
1072 7. Type x to select the line.
1073 8. Press Alt-` to change the line to uppercase.
1075 --> thIs sENtencE hAs MIS-cApitalIsed leTTerS.
1076 --> this SENTENCE SHOULD all be in LOWERCASE.
1077 --> THIS sentence should ALL BE IN uppercase!
1079=================================================================
1080= 10.4 SPLITTING SELECTIONS =
1081=================================================================
1083 Type S to split each selection on a regex pattern.
1085 1. Move the cursor to the line under ---.
1086 2. Type xx / 2x to select the lines.
1087 3. Type S then \. |! Enter (note the spaces after . and !).
1088 This effectively splits the selection into sentences at each
1089 dot or exclamation mark.
1090 4. Press Alt-; to reverse the selections.
1091 5. Type ; to reduce selections to a single character - the first
1092 letter of each sentence.
1093 6. Press Alt-` to convert all selected letters to uppercase.
1095---
1096these are sentences. some sentences don't start with uppercase
1097letters! that is not good grammar. you can fix this.
1101=================================================================
1102= CHAPTER 10 RECAP =
1103=================================================================
1105 * Use ) and ( to cycle the primary selection back and forward
1106 through selections respectively.
1107 * Press Alt-, to remove the primary selection.
1108 * Press Alt-) and Alt-( to cycle the content of the selections.
1110 * Type ~ to alternate case of selected letters.
1111 * Use ` and Alt-` to set the case of selected letters to
1112 lower and upper respectively.
1114 * Type S to split selections on regex.
1123=================================================================
1124= 11.1 COMMENTING A LINE =
1125=================================================================
1127Press Ctrl-c to comment the line under your cursor.
1128To uncomment the line, press Ctrl-c again.
11301. Move your cursor to the line marked '-->' below.
11312. Now comment the line marked with '-->'.
11323. Now try uncommenting the line.
1134--> Comment me please
1145=================================================================
1146= 11.2 COMMENTING MULTIPLE LINES =
1147=================================================================
1149Using the selections and multi-cursor functionality, you can
1150comment multiple lines as long as it is under the selection or
1151cursors.
11531. Move your cursor to the line marked with '-->' below.
11542. Now try to select or add more cursors the other lines marked
1155 with '-->'.
11563. Comment those lines.
1158--> How many are you going to comment?
1159--> Is this enough for a comment?
1160--> What are you doing?!
1161--> Stop commenting me!
1162--> AAAAaargh!!!
1164Note: If there are already commented lines under selections or
1165multiple cursors, they won't be uncommented but commented again.
1167=================================================================
1168= CHAPTER 11 RECAP =
1169=================================================================
1171 * Use Ctrl-c to comment a line under your cursor. Press Ctrl-c
1172 again to uncomment.
1173 * To comment multiple lines, use the selections
1174 and multi-cursors before typing Ctrl-c.
1175 * Commented lines cannot be uncommented but commented again.
1189=================================================================
1190 This tutorial is still a work-in-progress.
1191 More sections are planned.