fork/helix
git clone https://git.julia.blue/fork/helix
efd09b6c
23.05
1 2 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 ' '| 16 17 18 Welcome to the Helix tutorial! 19 Press the j key until you reach the introduction. 20 21 22 23================================================================= 24= INTRODUCTION = 25================================================================= 26 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. 37 38 39 40 41 42 43 44 45================================================================= 46= 1.1 BASIC CURSOR MOVEMENT = 47================================================================= 48 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 ↓ 54 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. 60 61 62 63 64 65 66 67================================================================= 68= 1.2 EXITING HELIX = 69================================================================= 70 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. 74 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. 78 79 To exit Command mode without entering a command, press Escape. 80 81 Now, move on to the next lesson. 82 83 84 85 86 87 88 89================================================================= 90= 1.3 DELETION = 91================================================================= 92 93 Type the d key to delete the character under the cursor. 94 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. 98 99 --> Thhiss senttencee haass exxtra charracterss. 100 This sentence has extra characters. 101 102 Once the sentence is correct, move on to the next lesson. 103 104 105 106 107 108 109 110 111================================================================= 112= 1.4 INSERT MODE = 113================================================================= 114 115 Type the i key to enter Insert mode. 116 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. 123 124 --> Th stce misg so. 125 This sentence is missing some text. 126 127 Note: The status bar will display your current mode. 128 Notice that when you type i, 'NOR' changes to 'INS'. 129 130 131 132 133================================================================= 134= 1.5 SAVING A FILE = 135================================================================= 136 137 Type :w / :write to save a file. 138 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. 145 146 You can also type wq or write-quit to save and exit. 147 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. 152 153 154 155================================================================= 156= CHAPTER 1 RECAP = 157================================================================= 158 159 * Use the h,j,k,l keys to move the cursor. 160 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. 167 168 * Type d to delete the character at the cursor. 169 170 * Type i to enter Insert mode and type text. Press Escape to 171 return to Normal mode. 172 173 174 175 176 177================================================================= 178= 2.1 MORE INSERT COMMANDS = 179================================================================= 180 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. 184 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. 190 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. 195 196 --> This sentence is miss 197 This sentence is missing some text. 198 199================================================================= 200= 2.2 OPENING LINES = 201================================================================= 202 203 Type o to add a newline and insert below the cursor. 204 Type O to add a newline and insert above the cursor. 205 206 1. Move the cursor to the line marked '-->' below. 207 2. Type o to open a line below and type your answer. 208 209 --> What is the best editor? 210 211 212 213 214 215 216 217 218 219 220 221================================================================= 222= CHAPTER 2 RECAP = 223================================================================= 224 225 * Type a to append to the selection. 226 227 * Type I to enter Insert mode at the first non-whitespace 228 character at the start of a line. 229 230 * Type A to enter Insert mode at the end of a line. 231 232 * Use o and O to open lines below and above the cursor respectively. 233 234 235 236 237 238 239 240 241 242 243================================================================= 244= 3.1 MOTIONS AND SELECTIONS = 245================================================================= 246 247 Type w to select forward until the next word. 248 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. 252 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. 258 259 --> This sentence pencil has vacuum extra words in the it. 260 This sentence has extra words in it. 261 262 263 264 265================================================================= 266= 3.2 MORE MOTIONS = 267================================================================= 268 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. 272 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. 277 278 To select the word under cursor, combine e and b. 279 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. 284 285--> The Middle Kingdom. 286 287================================================================= 288= 3.3 WORDS AND words = 289================================================================= 290 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. 295 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. 305 306--> Helix is a one-of-a-kind "modal" text editor 307 308 309================================================================= 310= 3.4 THE CHANGE COMMAND = 311================================================================= 312 313 Type c to change the current selection. 314 315 The change command deletes the current selection and enters 316 Insert mode, so it is a very common shorthand for di. 317 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. 324 325 --> This paper has heavy words behind it. 326 This sentence has incorrect words in it. 327 328 329 330 331================================================================= 332= 3.5 COUNTS WITH MOTIONS = 333================================================================= 334 335 Type a number before a motion to repeat it that many times. 336 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. 342 343 --> This is just a line with words you can move around in. 344 345 346 347 348 349 350 351 352 353================================================================= 354= 3.6 SELECT / EXTEND MODE = 355================================================================= 356 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. 361 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. 367 368 --> Remove the FOO BAR distracting words BAZ BIZ from this line. 369 370 371 372 373 374 375================================================================= 376= 3.7 SELECTING LINES = 377================================================================= 378 379 Type x to select a whole line. Type x again to select the next. 380 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. 385 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. 393 394 Note : X works similarly to x although it doesn't extend to 395 subsequent lines. X on an empty line does nothing. 396 397================================================================= 398= 3.8 COLLAPSING SELECTIONS = 399================================================================= 400 401 Type ; to collapse selections to single cursors. 402 403 Sometimes, you want to deselect without having to move the 404 cursor(s). This can be done using the ; key. 405 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. 410 411 --> This is an error-free line with words to move around in. 412 413 Note: This works the same in Select mode. 414 Note: Another related command is Alt-; which flips selections. 415 416 417 418 419================================================================= 420= CHAPTER 3 RECAP = 421================================================================= 422 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. 427 428 * Type d to delete the entire selection. 429 * Type c to delete the selection and enter Insert mode. 430 431 * Type a number before a motion to repeat it that many times. 432 433 * Type v to enter Select mode, where all motions extend the 434 selection. 435 436 * Type x to select the entire current line. Type x again to 437 select the next line. 438 439 * Type semicolon ( ; ) to collapse selection. 440 441================================================================= 442= 4.1 UNDOING = 443================================================================= 444 445 Type u to undo. Type U to redo. 446 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. 453 454 --> Fiix the errors on thhis line and reeplace them witth undo. 455 456 457 458 459 460 461 462 463================================================================= 464= 4.2 COPYING AND PASTING TEXT = 465================================================================= 466 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. 470 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". 476 477 --> 1 banana 2 3 4 478 1 banana 2 banana 3 banana 4 479 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. 484 485================================================================= 486= 4.3 SEARCHING IN FILE = 487================================================================= 488 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. 492 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. 496 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. 500 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. 504 505 506 507================================================================= 508= CHAPTER 4 RECAP = 509================================================================= 510 511 * Type u to undo. Type U to redo. 512 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. 516 517 * Type / to search forward in file, and ? to search backwards. 518 * Use n and N to cycle through search matches. 519 520 521 522 523 524 525 526 527 528 529================================================================= 530= 5.1 MULTIPLE CURSORS = 531================================================================= 532 533 Type C to duplicate the cursor to the next suitable line. 534 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. 543 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. 548 549 Note: Press Alt-C to do the same above the cursor. 550 551================================================================= 552= 5.2 THE SELECT COMMAND = 553================================================================= 554 555 Type s to select matches in the selection. 556 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. 566 567 --> I like to eat apples since my favorite fruit is apples. 568 I like to eat oranges since my favorite fruit is oranges. 569 570 571 572 573================================================================= 574= 5.3 SELECTING VIA REGEX = 575================================================================= 576 577 Like searching, the select command selects regular expressions, 578 not just exact matches. 579 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. 585 586 --> This sentence has some extra spaces. 587 This sentence has some extra spaces. 588 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. 593 594 595================================================================= 596= 5.4 ALIGN SELECTIONS = 597================================================================= 598 599 Type & to align the contents of the selections. 600 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. 606 607 --> 97) lorem 608 --> 98) ipsum 609 --> 99) dolor 610 --> 100) sit 611 --> 101) amet 612 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". 616 617================================================================= 618= 5.5 SPLIT SELECTION INTO LINES = 619================================================================= 620 621 Press Alt-s to split the selection(s) on newlines. 622 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 &. 627 628 | FRUIT | AMOUNT | 629 |---------|--------| 630 | Apples | 8 | 631 | Bananas | 6 | 632 | Oranges | 3 | 633 | Donuts | 4 | 634 635 636 637 638 639================================================================= 640= CHAPTER 5 RECAP = 641================================================================= 642 643 * Type C to duplicate the cursor to the next suitable line 644 and Alt-C for previous suitable line. 645 646 * Type s to select all instances of a regex pattern inside 647 the current selection. 648 649 * Type & to align selections. 650 651 * Press Alt-s to split the selection into lines. 652 653 654 655 656 657 658 659 660 661================================================================= 662= 6.1 SELECTING TO A CHARACTER = 663================================================================= 664 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. 668 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. 676 677 --> -----[Free this sentence of its brackets!]----- 678 --> ------Free this sentence of its dashes!------ 679 680 Note: Unlike Vim, Helix doesn't limit these commands to the 681 current line. It searches for the character in the file. 682 683================================================================= 684= 6.2 THE REPLACE COMMAND = 685================================================================= 686 687 Type r<ch> to replace all selected characters with <ch>. 688 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. 693 694 695 | Month | Days | 696 |=======|------| 697 | Jan | 31 | 698 | Feb | 28 | 699 | Mar | 31 | 700 | ... | ... | 701 702 703 704 705================================================================= 706= 6.3 REPETITION = 707================================================================= 708 709 Type . to repeat the last insert command. 710 Press Alt-. to repeat the last f / t selection. 711 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. 716 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. 720 721 722 723 724 725 726 727================================================================= 728= CHAPTER 6 RECAP = 729================================================================= 730 731 * Type f / F to extend selection up to & including a character. 732 * Type t / T to extend selection until a character. 733 734 * Type r to replace selected characters. 735 736 * Type . to repeat the last insertion. 737 * Press Alt-. to repeat the last f / t selection. 738 739 740 741 742 743 744 745 746 747 748 749================================================================= 750= 7.1 REPLACE WITH YANKED TEXT = 751================================================================= 752 753 Type R to replace the selection with previously yanked text. 754 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" 759 760 761 --> I like watermelons because oranges are refreshing. 762 I like watermelons because watermelons are refreshing. 763 764 765 766 767 768 769 770 771================================================================= 772= 7.2 JOINING LINES = 773================================================================= 774 775 Type J to join together lines in selection. 776 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. 780 781 --> This sentence 782is spilling over 783onto other 784lines. 785 786 This sentence is spilling over onto other lines. 787 788 789 790 791 792 793================================================================= 794= 7.3 INDENTING LINES = 795================================================================= 796 797 Type > to indent a line and < to outdent it. 798 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. 802 803 --> These lines 804 are indented 805 very poorly. 806 807 These lines 808 are indented 809 much better. 810 811 812 813 814 815================================================================= 816= 7.4 INCREMENTING AND DECREMENTING = 817================================================================= 818 819 Press Ctrl-a to increment the number under selection. 820 Press Ctrl-x to decrement the number under selection. 821 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. 826 827 --> 1) First point. 828 --> 2) Added point. 829 --> 2) Next point. 830 --> 3) Another point. 831 --> 6) Last point. 832 833 834 835 836 837================================================================= 838= CHAPTER 7 RECAP = 839================================================================= 840 841 * Type R to replace the selection with yanked text. 842 843 * Type J to join lines in selection. 844 845 * Type < and > to indent / outdent lines. 846 847 * Press Ctrl-a to increment the selected number. 848 * Press Ctrl-x to decrement the selected number. 849 850 851 852 853 854 855 856 857 858 859================================================================= 860= 8.1 REGISTERS = 861================================================================= 862 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. 867 868 Type "<ch> to select register <ch>. 869 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". 876 877 --> I like watermelons and bananas because my favorite fruits 878 are mangoes and pineapples. 879 880 881================================================================= 882= 8.2 MACROS = 883================================================================= 884 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). 890 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. 898 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. 902 903================================================================= 904= CHAPTER 8 RECAP = 905================================================================= 906 907 * Type " to select a different register. 908 909 * Type Q to start and stop recording a macro to a register, 910 the default being @. 911 912 * Type q to replay a macro from @ or the selected register. 913 914 915 916 917 918 919 920 921 922 923 924 925================================================================= 926= 9.1 SEARCHING FOR SELECTIONS = 927================================================================= 928 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. 932 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. 936 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". 940 941 --> A horse is a horse, of course, of course, 942 --> And no one can talk to a horse of course. 943 944 Note: * is like a shorthand for "/y as all it really does is 945 copy the selection into the / register. 946 947================================================================= 948= 9.2 ADDING SELECTION ON NEXT SEARCH MATCH = 949================================================================= 950 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. 954 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". 960 961 --> Everybody wants to be a bat, 962 --> because a cat's the only bat 963 --> who knows where it's at. 964 965 966 967 968 969================================================================= 970= 9.3 USING THE JUMPLIST = 971================================================================= 972 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. 976 977 Press Ctrl-s to manually save your current position to 978 the jumplist. 979 980 Press Ctrl-i ("in") and Ctrl-o ("out") to move forward and 981 backwards in the jumplist respectively. 982 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. 986 987 988 989 990 991================================================================= 992= CHAPTER 9 RECAP = 993================================================================= 994 995 * Type * to set the search register to the primary selection. 996 997 * Type n / N in Select mode to add selections on each search 998 match. 999 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. 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013================================================================= 1014= 10.1 CYCLING AND REMOVING SELECTIONS = 1015================================================================= 1016 1017 Type ) and ( to cycle the primary selection forward and backward 1018 through selections respectively. 1019 1020 Press Alt-, to remove the primary selection. 1021 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". 1028 1029 --> How much would would a wouldchuck chuck 1030 --> if a wouldchuck could chuck would? 1031 1032 1033 1034 1035================================================================= 1036= 10.2 CYCLING THE CONTENT OF SELECTIONS = 1037================================================================= 1038 1039 Press Alt-) and Alt-( to cycle the content of the selections 1040 forward and backward respectively. 1041 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. 1046 1047 --> Jumping through the water, 1048 --> daring to know. 1049 1050 1051 1052 1053 1054 1055 1056 1057================================================================= 1058= 10.3 CHANGING CASE = 1059================================================================= 1060 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. 1064 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. 1074 1075 --> thIs sENtencE hAs MIS-cApitalIsed leTTerS. 1076 --> this SENTENCE SHOULD all be in LOWERCASE. 1077 --> THIS sentence should ALL BE IN uppercase! 1078 1079================================================================= 1080= 10.4 SPLITTING SELECTIONS = 1081================================================================= 1082 1083 Type S to split each selection on a regex pattern. 1084 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. 1094 1095--- 1096these are sentences. some sentences don't start with uppercase 1097letters! that is not good grammar. you can fix this. 1098 1099 1100 1101================================================================= 1102= CHAPTER 10 RECAP = 1103================================================================= 1104 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. 1109 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. 1113 1114 * Type S to split selections on regex. 1115 1116 1117 1118 1119 1120 1121 1122 1123================================================================= 1124= 11.1 COMMENTING A LINE = 1125================================================================= 1126 1127Press Ctrl-c to comment the line under your cursor. 1128To uncomment the line, press Ctrl-c again. 1129 11301. Move your cursor to the line marked '-->' below. 11312. Now comment the line marked with '-->'. 11323. Now try uncommenting the line. 1133 1134--> Comment me please 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145================================================================= 1146= 11.2 COMMENTING MULTIPLE LINES = 1147================================================================= 1148 1149Using the selections and multi-cursor functionality, you can 1150comment multiple lines as long as it is under the selection or 1151cursors. 1152 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. 1157 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!!! 1163 1164Note: If there are already commented lines under selections or 1165multiple cursors, they won't be uncommented but commented again. 1166 1167================================================================= 1168= CHAPTER 11 RECAP = 1169================================================================= 1170 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. 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189================================================================= 1190 This tutorial is still a work-in-progress. 1191 More sections are planned.