2021-08-13 05:13:17 +04:00
|
|
|
_ _ __ __
|
|
|
|
| | | | _ \ \ / /
|
|
|
|
| |_| | ___ | | (_) \ \/ /
|
|
|
|
| _ | / _ \ | | _ ) (
|
|
|
|
| | | | | __/ | | | | / /\ \
|
|
|
|
|_| |_| \___| |_| |_| /_/ \_\
|
|
|
|
|
|
|
|
A post-modern modal text editor.
|
|
|
|
_________________________________________________________________
|
|
|
|
|
|
|
|
Welcome to the Helix editor! Helix is different from editors
|
|
|
|
you might be used to in that it is modal, meaning that it has
|
|
|
|
different modes for editing text. The primary modes you will
|
|
|
|
use are Normal mode and Insert mode. While in Normal mode, the
|
2022-04-29 05:52:11 +04:00
|
|
|
keys you type won't actually type text. Instead, they will
|
2021-08-13 05:13:17 +04:00
|
|
|
perform various actions with the text. This allows for more
|
|
|
|
efficient editing. This tutor will teach you how you can make
|
|
|
|
use of Helix's modal editing features. To begin, ensure your
|
|
|
|
caps-lock key is not pressed and hold the j key until you reach
|
|
|
|
the first lesson.
|
|
|
|
|
|
|
|
|
|
|
|
=================================================================
|
2022-04-29 05:52:11 +04:00
|
|
|
= 1.1 BASIC CURSOR MOVEMENT =
|
2021-08-13 05:13:17 +04:00
|
|
|
=================================================================
|
|
|
|
|
|
|
|
↑
|
|
|
|
k * h is on the left
|
|
|
|
← h l → * l is on the right
|
|
|
|
j * j looks like a down arrow
|
|
|
|
↓
|
|
|
|
|
|
|
|
The cursor can be moved using the h, j, k, l keys, as shown
|
|
|
|
above. The cursor/arrow keys will also work, but it is faster
|
|
|
|
to use the hjkl keys as they are closer to the other keys you
|
|
|
|
will be using. Try moving around to get a feel for hjkl.
|
|
|
|
Once you're ready, hold j to continue to the next lesson.
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-17 02:28:55 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-13 05:13:17 +04:00
|
|
|
=================================================================
|
2022-04-29 05:52:11 +04:00
|
|
|
= 1.2 EXITING HELIX =
|
2021-08-13 05:13:17 +04:00
|
|
|
=================================================================
|
|
|
|
|
2022-06-16 00:31:26 +04:00
|
|
|
1. Type : to enter Command mode. Your cursor will
|
2021-08-13 05:13:17 +04:00
|
|
|
move to the bottom of the screen.
|
2022-04-29 05:52:11 +04:00
|
|
|
2. Type q or quit and type <ENTER> to exit Helix.
|
2021-08-13 05:13:17 +04:00
|
|
|
|
|
|
|
Note: The quit command will fail if there are unsaved changes.
|
2022-04-29 05:52:11 +04:00
|
|
|
To force quit and DISCARD these changes, type q! or quit!.
|
2021-08-13 05:13:17 +04:00
|
|
|
You will learn how to save files later.
|
|
|
|
|
2022-06-16 00:31:26 +04:00
|
|
|
To exit Command mode without entering a command, type <ESC>.
|
2021-08-13 05:13:17 +04:00
|
|
|
|
|
|
|
Now, move on to the next lesson.
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-17 02:28:55 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-13 05:13:17 +04:00
|
|
|
=================================================================
|
2022-04-29 05:52:11 +04:00
|
|
|
= 1.3 DELETION =
|
2021-08-13 05:13:17 +04:00
|
|
|
=================================================================
|
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
Type the d key to delete the character under the cursor.
|
2021-08-13 05:13:17 +04:00
|
|
|
|
|
|
|
1. Move the cursor to the line below marked -->.
|
2022-04-29 05:52:11 +04:00
|
|
|
2. Move the cursor to each extra character, and type d to
|
2021-08-13 05:13:17 +04:00
|
|
|
delete it.
|
|
|
|
|
|
|
|
--> Thhiss senttencee haass exxtra charracterss.
|
2022-06-16 00:31:26 +04:00
|
|
|
This sentence has extra characters.
|
2021-08-13 05:13:17 +04:00
|
|
|
|
|
|
|
Once the sentence is correct, move on to the next lesson.
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-16 00:31:26 +04:00
|
|
|
|
2022-06-17 02:28:55 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-13 05:13:17 +04:00
|
|
|
=================================================================
|
2022-04-29 05:52:11 +04:00
|
|
|
= 1.4 INSERT MODE =
|
2021-08-13 05:13:17 +04:00
|
|
|
=================================================================
|
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
Type the i key to enter Insert mode.
|
2021-08-13 05:13:17 +04:00
|
|
|
|
|
|
|
1. Move the cursor to the line below marked -->.
|
2022-04-29 05:52:11 +04:00
|
|
|
2. Move to a place in the line which is missing text and type
|
|
|
|
i to enter Insert mode. Keys you type will now type text.
|
2021-08-13 05:13:17 +04:00
|
|
|
3. Enter the missing text.
|
2022-04-29 05:52:11 +04:00
|
|
|
4. type <ESC> to exit Insert mode and return to Normal mode.
|
2021-08-13 05:13:17 +04:00
|
|
|
5. Repeat until the line matches the line below it.
|
|
|
|
|
|
|
|
--> Th stce misg so.
|
|
|
|
This sentence is missing some text.
|
|
|
|
|
|
|
|
Note: If you want to move the cursor while in Insert mode,
|
|
|
|
you may use the arrow keys instead of exiting and
|
|
|
|
reentering Insert mode.
|
|
|
|
Note: The status bar will display your current mode.
|
2022-04-29 05:52:11 +04:00
|
|
|
Notice that when you type i, 'NOR' changes to 'INS'.
|
2021-08-13 05:13:17 +04:00
|
|
|
|
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= 1.5 SAVING A FILE =
|
2021-08-13 05:13:17 +04:00
|
|
|
=================================================================
|
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
Type :w/:write to save a file.
|
2021-08-13 05:13:17 +04:00
|
|
|
|
|
|
|
1. Exit Helix using :q! as explained before, or open a new
|
|
|
|
terminal.
|
|
|
|
2. Open a file in Helix by running: hx FILENAME
|
|
|
|
3. Make some edits to the file.
|
2022-06-16 00:31:26 +04:00
|
|
|
4. Type : to enter Command mode.
|
2022-04-29 05:52:11 +04:00
|
|
|
5. Type w or write, and type <ENTER> to save the file.
|
2021-08-13 05:13:17 +04:00
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
You can also type wq or write-quit to save and exit.
|
2021-08-13 05:13:17 +04:00
|
|
|
|
|
|
|
Note: You can optionally enter a filepath after the w/write
|
|
|
|
command in order to save to that path.
|
|
|
|
Note: If there are any unsaved changes to a file, a plus [+]
|
|
|
|
will appear next to the file name in the status bar.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=================================================================
|
2022-04-29 05:52:11 +04:00
|
|
|
= CHAPTER 1 RECAP =
|
2021-08-13 05:13:17 +04:00
|
|
|
=================================================================
|
|
|
|
|
|
|
|
* Use the h,j,k,l keys to move the cursor.
|
|
|
|
|
2022-06-16 00:31:26 +04:00
|
|
|
* Type : to enter Command mode.
|
2021-08-13 05:13:17 +04:00
|
|
|
* The q/quit and q!/quit! commands will exit Helix. The
|
|
|
|
former fails when there are unsaved changes. The latter
|
|
|
|
discards them.
|
|
|
|
* The w/write command will save the file.
|
|
|
|
* The wq/write-quit command will do both.
|
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
* Type d to delete the character at the cursor.
|
2021-08-13 05:13:17 +04:00
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
* Type i to enter Insert mode and type text. Type <ESC> to
|
2021-08-13 05:13:17 +04:00
|
|
|
return to Normal mode.
|
2022-06-17 19:52:20 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-13 05:13:17 +04:00
|
|
|
|
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= 2.1 MORE INSERT COMMANDS =
|
|
|
|
=================================================================
|
|
|
|
|
|
|
|
As you saw, you can type i to enter Insert mode at the current
|
|
|
|
position of the cursor. There are a few other ways you can
|
|
|
|
enter Insert mode at different locations.
|
|
|
|
|
|
|
|
Common examples of insertion commands include:
|
|
|
|
i - Insert before the selection.
|
|
|
|
a - Insert after the selection. (a means 'append')
|
|
|
|
I - Insert at the start of the line.
|
|
|
|
A - Insert at the end of the line.
|
|
|
|
|
|
|
|
1. Move to anywhere in the line below marked -->.
|
|
|
|
2. Type A (<SHIFT> + a), your cursor will move to the end of
|
|
|
|
the line and you will be able to type.
|
|
|
|
3. Type the text necessary to match the line below.
|
|
|
|
|
|
|
|
--> This sentence is miss
|
|
|
|
This sentence is missing some text.
|
|
|
|
|
|
|
|
=================================================================
|
|
|
|
= 2.2 OPENING LINES =
|
|
|
|
=================================================================
|
|
|
|
|
|
|
|
Type o to add a newline and insert below the cursor.
|
|
|
|
Type O to add a newline and insert above the cursor.
|
|
|
|
|
|
|
|
1. Move the cursor to the line below marked -->.
|
|
|
|
2. Type o to open a line below and type your answer.
|
|
|
|
|
|
|
|
--> What is the best editor?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=================================================================
|
|
|
|
= CHAPTER 2 RECAP =
|
|
|
|
=================================================================
|
|
|
|
|
|
|
|
* Type a to append to the selection.
|
|
|
|
|
|
|
|
* Type I to enter Insert mode at the first non-whitespace
|
|
|
|
character at the start of a line.
|
|
|
|
|
|
|
|
* Type A to enter Insert mode at the end of a line.
|
|
|
|
|
|
|
|
* Use o and O to open lines below/above the cursor respectively.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=================================================================
|
|
|
|
= 3.1 MOTIONS AND SELECTIONS =
|
2021-08-13 05:13:17 +04:00
|
|
|
=================================================================
|
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
Type w to select forward until the next word.
|
2021-08-13 05:13:17 +04:00
|
|
|
|
|
|
|
The d key doesn't actually delete the character at the cursor,
|
|
|
|
it deletes all selected text. Your cursor is like a
|
|
|
|
single-character selection.
|
|
|
|
|
|
|
|
1. Move the cursor to the line below marked -->.
|
|
|
|
2. Move to the beginning of a word that needs to be deleted.
|
2022-04-29 05:52:11 +04:00
|
|
|
3. Type w to select until the beginning of the next word.
|
|
|
|
4. Type d to delete the selection.
|
2021-08-13 05:13:17 +04:00
|
|
|
5. Repeat for all extra words in the line.
|
|
|
|
|
|
|
|
--> This sentence pencil has vacuum extra words in the it.
|
2022-06-16 00:31:26 +04:00
|
|
|
This sentence has extra words in it.
|
2021-08-13 05:13:17 +04:00
|
|
|
|
|
|
|
|
2022-06-17 02:28:55 +04:00
|
|
|
|
|
|
|
|
2021-08-13 05:13:17 +04:00
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= 3.2 MORE ON MOTIONS =
|
2021-08-13 05:13:17 +04:00
|
|
|
=================================================================
|
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
As you saw, typing w moves the cursor forward until the start
|
2021-08-13 05:13:17 +04:00
|
|
|
of the next word, selecting the text traversed. This is useful
|
|
|
|
for moving around text and for selecting text to operate on.
|
|
|
|
|
|
|
|
Some common motions include:
|
|
|
|
w - Move forward to before the beginning of the next word.
|
|
|
|
e - Move forward to the end of the current word.
|
|
|
|
b - Move backward to the beginning of the current word.
|
|
|
|
|
|
|
|
The w,e,b motions also have counterparts - W,E,B - which
|
|
|
|
traverse WORDS instead of words. WORDS are only separated by
|
|
|
|
whitespace, whereas words can be separated by other characters
|
|
|
|
in addition to whitespace.
|
|
|
|
|
|
|
|
All of these motions select the text they traverse.
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-16 07:47:45 +04:00
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= 3.3 THE CHANGE COMMAND =
|
2021-10-16 07:47:45 +04:00
|
|
|
=================================================================
|
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
Type c to change the current selection.
|
2021-10-16 07:47:45 +04:00
|
|
|
|
|
|
|
The change command deletes the current selection and enters
|
|
|
|
Insert mode, so it is a very common shorthand for di.
|
|
|
|
|
|
|
|
1. Move the cursor to the line below marked -->.
|
2022-04-29 05:52:11 +04:00
|
|
|
2. Move to the start of an incorrect word and type w to
|
2021-10-16 07:47:45 +04:00
|
|
|
select it.
|
2022-04-29 05:52:11 +04:00
|
|
|
3. Type c to delete the word and enter Insert mode.
|
2021-10-16 07:47:45 +04:00
|
|
|
4. Type the correct word.
|
|
|
|
5. Repeat until the line matches the line below it.
|
|
|
|
|
|
|
|
--> This paper has heavy words behind it.
|
|
|
|
This sentence has incorrect words in it.
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-17 02:28:55 +04:00
|
|
|
|
2021-10-16 07:47:45 +04:00
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= 3.4 COUNTS WITH MOTIONS =
|
2021-10-16 07:47:45 +04:00
|
|
|
=================================================================
|
|
|
|
|
|
|
|
Type a number before a motion to repeat it that many times.
|
|
|
|
|
|
|
|
1. Move the cursor to the line below marked -->.
|
|
|
|
2. Type 2w to move 2 words forward.
|
|
|
|
3. Type 3e to move to the end of the third word forward.
|
|
|
|
4. Type 2b to move 2 words backwards
|
|
|
|
5. Try the above with different numbers.
|
|
|
|
|
|
|
|
--> This is just a line with words you can move around in.
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-17 02:28:55 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-16 07:47:45 +04:00
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= 3.5 SELECTING LINES =
|
2021-10-16 07:47:45 +04:00
|
|
|
=================================================================
|
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
Type x to select a whole line. Type x again to select the next.
|
2021-10-16 07:47:45 +04:00
|
|
|
|
|
|
|
1. Move the cursor to the second line below marked -->.
|
2022-04-29 05:52:11 +04:00
|
|
|
2. Type x to select the line, and d to delete it.
|
2021-10-16 07:47:45 +04:00
|
|
|
3. Move to the fourth line.
|
2022-04-29 05:52:11 +04:00
|
|
|
4. Type x twice or type 2x to select 2 lines, and d to delete.
|
2021-10-16 07:47:45 +04:00
|
|
|
|
|
|
|
--> 1) Roses are red,
|
|
|
|
--> 2) Mud is fun,
|
|
|
|
--> 3) Violets are blue,
|
|
|
|
--> 4) I have a car,
|
|
|
|
--> 5) Clocks tell time,
|
|
|
|
--> 6) Sugar is sweet,
|
|
|
|
--> 7) And so are you.
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-17 02:28:55 +04:00
|
|
|
|
2021-10-16 07:47:45 +04:00
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= CHAPTER 3 RECAP =
|
|
|
|
=================================================================
|
|
|
|
|
|
|
|
* Type w to select forward until the next word.
|
|
|
|
* Type e to select to the end of the current word.
|
|
|
|
* Type b to select backward to the start of the current word.
|
|
|
|
* Use uppercase counterparts, W,E,B, to traverse WORDS.
|
|
|
|
|
|
|
|
* Typing d deletes the entire selection, so you can delete a
|
|
|
|
word forward by typing wd.
|
|
|
|
|
|
|
|
* Type c to delete the selection and enter Insert mode.
|
|
|
|
|
|
|
|
* Type a number before a motion to repeat it that many times.
|
|
|
|
|
|
|
|
* Type x to select the entire current line. Type x again to
|
|
|
|
select the next line.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=================================================================
|
|
|
|
= 4.1 UNDOING =
|
2021-10-16 07:47:45 +04:00
|
|
|
=================================================================
|
|
|
|
|
|
|
|
Type u to undo. Type U to redo.
|
|
|
|
|
|
|
|
1. Move the cursor to the line below marked -->.
|
2022-04-29 05:52:11 +04:00
|
|
|
2. Move to the first error, and type d to delete it.
|
2021-10-16 07:47:45 +04:00
|
|
|
3. Type u to undo your deletion.
|
|
|
|
4. Fix all the errors on the line.
|
|
|
|
5. Type u several times to undo your fixes.
|
|
|
|
6. Type U (<SHIFT> + u) several times to redo your fixes.
|
|
|
|
|
|
|
|
--> Fiix the errors on thhis line and reeplace them witth undo.
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-17 02:28:55 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-16 07:47:45 +04:00
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= 4.2 COPYING AND PASTING TEXT =
|
2021-10-16 07:47:45 +04:00
|
|
|
=================================================================
|
|
|
|
|
2022-06-17 19:52:20 +04:00
|
|
|
Type y to yank (copy) the selection.
|
|
|
|
Type p to paste the yanked selection after the cursor.
|
|
|
|
Type P to paste the yanked text before the cursor.
|
2021-10-16 07:47:45 +04:00
|
|
|
|
2022-06-17 19:52:20 +04:00
|
|
|
1. Move the cursor to the line below marked -->.
|
|
|
|
Make sure your cursor is on the "b" of banana.
|
|
|
|
2. Type w to select "banana" and y to yank it.
|
|
|
|
3. Move to the space between "2" and "3" and type p to paste.
|
|
|
|
4. Repeat between "3" and "4".
|
2021-10-16 07:47:45 +04:00
|
|
|
|
2022-06-17 19:52:20 +04:00
|
|
|
--> 1 banana 2 3 4
|
|
|
|
1 banana 2 banana 3 banana 4
|
2021-10-16 07:47:45 +04:00
|
|
|
|
2022-06-17 19:52:20 +04:00
|
|
|
Note: Whenever you delete or change text, Helix will copy the
|
|
|
|
altered text. Use alt-d/c instead to avoid this.
|
|
|
|
Note: Helix doesn't share the system clipboard by default. Type
|
|
|
|
space-y/p to yank/paste on your computer's main clipboard.
|
2021-10-16 07:47:45 +04:00
|
|
|
|
2022-06-17 19:52:20 +04:00
|
|
|
=================================================================
|
|
|
|
= 4.3 SEARCHING IN FILE =
|
|
|
|
=================================================================
|
|
|
|
|
|
|
|
Type / to search forward in file, enter to confirm search.
|
|
|
|
Type n to go to the next search match.
|
|
|
|
Type N to go to the previous search match.
|
|
|
|
|
|
|
|
1. Type / and type in a common word, like 'banana'.
|
|
|
|
2. Type enter to confirm the search.
|
|
|
|
3. Use n and N to cycle through the matches.
|
|
|
|
|
|
|
|
Like the select command, searching also uses regex.
|
|
|
|
|
|
|
|
Note: To search backwards, type ? (shift-/).
|
|
|
|
|
|
|
|
Note: Unlike Vim, N doesn't change the search direction.
|
|
|
|
N always goes backwards and n always goes forwards.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=================================================================
|
|
|
|
= CHAPTER 4 RECAP =
|
|
|
|
=================================================================
|
2021-10-16 07:47:45 +04:00
|
|
|
|
|
|
|
* Type u to undo. Type U to redo.
|
|
|
|
|
2022-06-17 19:52:20 +04:00
|
|
|
* Type y to yank (copy) text and p to paste.
|
|
|
|
* Use space-Y and space-P to yank/paste on the system
|
|
|
|
clipboard.
|
|
|
|
|
|
|
|
* Type / to search forward in file, and ? to search backwards.
|
|
|
|
* Use n and N to cycle through search matches.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-16 07:47:45 +04:00
|
|
|
|
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= 5.1 MULTIPLE CURSORS =
|
2021-10-16 07:47:45 +04:00
|
|
|
=================================================================
|
|
|
|
|
2022-06-13 18:00:40 +04:00
|
|
|
Type C to duplicate the cursor to the next suitable line.
|
2021-10-16 07:47:45 +04:00
|
|
|
|
|
|
|
1. Move the cursor to the first line below marked -->.
|
2022-06-13 18:00:40 +04:00
|
|
|
2. Type C to duplicate the cursor to the next suitable line.
|
|
|
|
Notice how it skips the line in the middle. Keys you type
|
|
|
|
will now affect both cursors.
|
2021-10-16 07:47:45 +04:00
|
|
|
3. Use Insert mode to correct the lines. The two cursors will
|
|
|
|
fix both lines simultaneously.
|
|
|
|
4. Type , to remove the second cursor.
|
|
|
|
|
|
|
|
--> Fix th two nes at same ime.
|
2022-06-13 18:00:40 +04:00
|
|
|
-->
|
2021-10-16 07:47:45 +04:00
|
|
|
--> Fix th two nes at same ime.
|
|
|
|
|
|
|
|
Fix these two lines at the same time.
|
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
Note: Type alt-C to do the same above the cursor.
|
2021-10-16 07:47:45 +04:00
|
|
|
|
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= 5.2 THE SELECT COMMAND =
|
2021-10-16 07:47:45 +04:00
|
|
|
=================================================================
|
|
|
|
|
|
|
|
Type s to select matches in the selection.
|
|
|
|
|
|
|
|
1. Move the cursor to the line below marked -->.
|
2022-04-29 05:52:11 +04:00
|
|
|
2. Type x to select the line.
|
|
|
|
3. Type s. A prompt will appear.
|
|
|
|
4. Type 'apples' and type <ENTER>. Both occurrences of
|
2021-10-16 07:47:45 +04:00
|
|
|
'apples' in the line will be selected.
|
2022-04-29 05:52:11 +04:00
|
|
|
5. You can now type c and change 'apples' to something else,
|
2021-10-16 07:47:45 +04:00
|
|
|
like 'oranges'.
|
|
|
|
6. Type , to remove the second cursor.
|
|
|
|
|
|
|
|
--> I like to eat apples since my favorite fruit is apples.
|
2022-06-16 00:31:26 +04:00
|
|
|
I like to eat oranges since my favourite fruit is oranges.
|
2021-10-16 07:47:45 +04:00
|
|
|
|
|
|
|
|
2022-06-17 02:28:55 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
2021-10-16 07:47:45 +04:00
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= 5.3 SELECTING VIA REGEX =
|
2021-10-16 07:47:45 +04:00
|
|
|
=================================================================
|
|
|
|
|
|
|
|
The select command selects regular expressions, not just exact
|
|
|
|
matches, allowing you to target more complex patterns.
|
|
|
|
|
|
|
|
1. Move the cursor to the line below marked -->.
|
2022-04-29 05:52:11 +04:00
|
|
|
2. Select the line with x and then type s.
|
2021-10-16 07:47:45 +04:00
|
|
|
3. Enter ' +' to select any amount of consecutive spaces >1.
|
2022-04-29 05:52:11 +04:00
|
|
|
4. Type c and change the matches to single spaces.
|
2021-10-16 07:47:45 +04:00
|
|
|
|
|
|
|
--> This sentence has some extra spaces.
|
2022-06-16 00:31:26 +04:00
|
|
|
This sentence has some extra spaces.
|
2021-10-16 07:47:45 +04:00
|
|
|
|
|
|
|
Note: If you want to perform find-and-replace, the select
|
|
|
|
command is the way to do it. Select the text you want
|
|
|
|
to replace in — type % to select the whole file — and
|
|
|
|
then perform the steps explained above.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= 5.4 COLLAPSING SELECTIONS =
|
2021-10-16 07:47:45 +04:00
|
|
|
=================================================================
|
|
|
|
|
|
|
|
Type ; to collapse selections to single cursors.
|
|
|
|
|
|
|
|
Sometimes, you want to deselect without having to move the
|
|
|
|
cursor(s). This can be done using the ; key.
|
|
|
|
|
|
|
|
1. Move the cursor to the line below marked -->.
|
|
|
|
2. Use the motions you have learned to move around the line,
|
|
|
|
and try using ; to deselect the text after it is selected
|
|
|
|
by the motions.
|
|
|
|
|
|
|
|
--> This is an error-free line with words to move around in.
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-17 02:28:55 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= 5.5 SELECTING TO A CHARACTER =
|
2022-04-29 05:52:11 +04:00
|
|
|
=================================================================
|
|
|
|
|
|
|
|
Type f<ch> to select up to and including (find) a character.
|
|
|
|
Type t<ch> to do the same, but not including (till) a character.
|
|
|
|
Type uppercase F/T to do the same backwards.
|
|
|
|
|
|
|
|
1. Move the cursor to the line below marked -->. Place the
|
|
|
|
cursor on the first dash.
|
|
|
|
2. Type f[ to select to the square bracket.
|
|
|
|
3. Type d to delete your selection.
|
|
|
|
4. Go to the end of the line and repeat with F].
|
|
|
|
5. Move to the second line marked -->, just after the arrow.
|
|
|
|
6. Use t and T to delete the dashes around the sentence.
|
|
|
|
|
|
|
|
--> -----[Free this sentence of its brackets!]-----
|
|
|
|
--> ------Free this sentence of its dashes!------
|
|
|
|
|
|
|
|
Note: Unlike Vim, Helix doesn't limit these commands to the
|
|
|
|
current line. It searches for the character in the file.
|
|
|
|
|
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= CHAPTER 5 RECAP =
|
2022-04-29 05:52:11 +04:00
|
|
|
=================================================================
|
|
|
|
|
2022-06-13 18:00:40 +04:00
|
|
|
* Type C to copy the current selection to below and Alt-C for
|
2022-04-29 05:52:11 +04:00
|
|
|
above.
|
|
|
|
|
|
|
|
* Type s to select all instances of a regex pattern inside
|
|
|
|
the current selection.
|
|
|
|
|
|
|
|
* Type semicolon ( ; ) to collapse selection.
|
|
|
|
|
|
|
|
* Type f / F to extend selection up to & including a character.
|
|
|
|
|
|
|
|
* Type t / T to extend selection until a character.
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-17 02:28:55 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= 6.2 CHANGING CASE =
|
2022-04-29 05:52:11 +04:00
|
|
|
=================================================================
|
|
|
|
|
|
|
|
Type ~ to switch the case of all selected letters.
|
|
|
|
Type ` to set all selected letters to lowercase.
|
|
|
|
Type Alt-` to set all selected letters to uppercase.
|
|
|
|
|
|
|
|
1. Move the cursor to the first line below marked -->.
|
|
|
|
2. Select each wrongly capitalised or lowercase letter
|
|
|
|
and type ~ over them.
|
|
|
|
3. Move to the second line marked -->.
|
|
|
|
4. Type x to select the line.
|
|
|
|
5. Type ` to change the line to lowercase.
|
|
|
|
6. Move to the third line marked -->.
|
|
|
|
7. Type x to select the line.
|
|
|
|
8. Type Alt-` to change the line to uppercase.
|
|
|
|
|
|
|
|
--> thIs sENtencE hAs MIS-cApitalIsed leTTerS.
|
|
|
|
--> this SENTENCE SHOULD all be in LOWERCASE.
|
|
|
|
--> THIS sentence should ALL BE IN uppercase!
|
|
|
|
|
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= 6.3 MACROS =
|
2022-04-29 05:52:11 +04:00
|
|
|
=================================================================
|
|
|
|
|
|
|
|
Macros are a way to record a set of actions you want to repeat.
|
|
|
|
|
|
|
|
Type Q to start recording a macro, you should see a popup at
|
|
|
|
the bottom of your screen. Type Q again to stop recording.
|
|
|
|
Type q to repeat your recorded macro.
|
|
|
|
|
|
|
|
1. Move the cursor to the first line below marked -->.
|
|
|
|
Ensure your cursor is on the > of the arrow.
|
|
|
|
2. Type Q to start recording.
|
|
|
|
3. Edit the line to look like the bottom one.
|
|
|
|
4. Exit insert and Type Q again to stop recording.
|
|
|
|
5. Move to the line below and put your cursor on the > again.
|
|
|
|
6. Type q to repeat the macro.
|
|
|
|
|
|
|
|
--> ... sentence doesn't have it's first and last ... .
|
|
|
|
--> ... sentence doesn't have it's first and last ... .
|
|
|
|
This sentence doesn't have it's first and last word.
|
|
|
|
|
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= CHAPTER 6 RECAP =
|
2022-04-29 05:52:11 +04:00
|
|
|
=================================================================
|
|
|
|
|
|
|
|
* Type ~ to alternate case of selected letters.
|
|
|
|
* Use ` and alt-` to set the case of selected layers to
|
|
|
|
upper and lower respectively.
|
|
|
|
|
|
|
|
* Type Q to record and stop recording a macro.
|
|
|
|
* Type q to repeat the recorded macro.
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-17 02:28:55 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-17 19:52:20 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= 7.1 USING THE JUMPLIST =
|
2022-04-29 05:52:11 +04:00
|
|
|
=================================================================
|
|
|
|
|
|
|
|
Helix can keep track of "jumps" which are big movements, like
|
|
|
|
jumping to the definition of a function in code. It stores
|
|
|
|
these in what's called the jumplist.
|
|
|
|
|
|
|
|
Type C-s (ctrl-s) to manually save your current position to
|
|
|
|
the jumplist.
|
|
|
|
|
|
|
|
Type C-i and C-o to move forward and backwards in the jumplist
|
|
|
|
respectively.
|
|
|
|
|
|
|
|
1. Type C-s somewhere.
|
|
|
|
2. Move far away in the file.
|
|
|
|
3. Type C-o (just once!) to come back to where you saved.
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-17 02:28:55 +04:00
|
|
|
|
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= CHAPTER 7 RECAP =
|
2022-04-29 05:52:11 +04:00
|
|
|
=================================================================
|
|
|
|
|
|
|
|
* Type C-s to save position to the jumplist.
|
|
|
|
* Type C-i and C-o to go forward and backward in the jumplist.
|
|
|
|
|
2022-06-17 19:52:20 +04:00
|
|
|
|
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-17 02:28:55 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= 8.1 JOINING LINES =
|
2022-04-29 05:52:11 +04:00
|
|
|
=================================================================
|
|
|
|
|
|
|
|
Type J to join together lines in selection.
|
|
|
|
|
|
|
|
1. Move the cursor to the line below marked -->.
|
2022-06-16 00:31:26 +04:00
|
|
|
2. Type x four times or 4x to select all four lines.
|
|
|
|
3. Type J to join the lines together.
|
2022-04-29 05:52:11 +04:00
|
|
|
|
2022-06-16 00:31:26 +04:00
|
|
|
--> This sentence
|
2022-04-29 05:52:11 +04:00
|
|
|
is spilling over
|
|
|
|
onto other
|
|
|
|
lines.
|
2022-06-16 00:31:26 +04:00
|
|
|
This sentence is spilling over onto other lines.
|
2022-04-29 05:52:11 +04:00
|
|
|
|
|
|
|
Note: J works on all lines in selection, so typing xxx or 3x to
|
|
|
|
select the lines and then a single J will work the same.
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-17 02:28:55 +04:00
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= 8.2 INDENTING LINES =
|
2022-04-29 05:52:11 +04:00
|
|
|
=================================================================
|
|
|
|
|
|
|
|
Type > to indent a line and < to outdent it.
|
|
|
|
|
|
|
|
1. Move the cursor to the line below marked -->.
|
|
|
|
2. Move down to the second line and type > to indent it.
|
|
|
|
3. Move to the third line and type < to unindent it.
|
|
|
|
|
|
|
|
--> These lines
|
|
|
|
are indented
|
|
|
|
very poorly.
|
|
|
|
|
|
|
|
These lines
|
|
|
|
are indented
|
|
|
|
much better.
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-17 02:28:55 +04:00
|
|
|
|
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
=================================================================
|
2022-06-17 19:52:20 +04:00
|
|
|
= CHAPTER 8 RECAP =
|
2022-04-29 05:52:11 +04:00
|
|
|
=================================================================
|
|
|
|
|
|
|
|
* Type J to join lines within selection.
|
|
|
|
|
|
|
|
* Type > and < to indent and outdent selected lines.
|
|
|
|
|
2022-06-17 19:52:20 +04:00
|
|
|
|
2022-04-29 05:52:11 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-17 02:28:55 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-08-13 05:13:17 +04:00
|
|
|
=================================================================
|
|
|
|
This tutorial is still a work-in-progress.
|
|
|
|
More sections are planned.
|