Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'runtime/tutor')
| -rw-r--r-- | runtime/tutor | 622 |
1 files changed, 78 insertions, 544 deletions
diff --git a/runtime/tutor b/runtime/tutor index 30c0f102..418c4195 100644 --- a/runtime/tutor +++ b/runtime/tutor @@ -1,28 +1,12 @@ + _ _ __ __ + | | | | _ \ \ / / + | |_| | ___ | | (_) \ \/ / + | _ | / _ \ | | _ ) ( + | | | | | __/ | | | | / /\ \ + |_| |_| \___| |_| |_| /_/ \_\ - - . - ###x. .| - d#####x, ,v|| - '+#####v|||||| - ,v|||||+'. _ _ _ - ,v|||||^'>#### | | | | ___ | | (_) __ __ - |||||^' .v#### | |___| | / \ | | _ \ \/ / - ||||=..v#####P' | ___ | / ^ | | | | | \ / - ''v'>#####P' | | | | | --- | | | | / \ - ,######/P||x. |_| |_| \___/ |_| |_| /_/\_\ - ####P' "x|||||, - |/' 'x||| A post-modern modal text editor. - ' '| - - - Welcome to the Helix tutorial! - Press the j key until you reach the introduction. - - - -================================================================= -= INTRODUCTION = -================================================================= + 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 @@ -36,12 +20,6 @@ the first lesson. - - - - - - ================================================================= = 1.1 BASIC CURSOR MOVEMENT = ================================================================= @@ -70,13 +48,13 @@ 1. Type : to enter Command mode. Your cursor will move to the bottom of the screen. - 2. Type q or quit and press Enter to exit Helix. + 2. Type q or quit and type Enter to exit Helix. Note: The quit command will fail if there are unsaved changes. To force quit and DISCARD these changes, type q! or quit!. You will learn how to save files later. - To exit Command mode without entering a command, press Escape. + To exit Command mode without entering a command, type Escape. Now, move on to the next lesson. @@ -118,7 +96,7 @@ 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. 3. Enter the missing text. - 4. Press Escape to exit Insert mode and return to Normal mode. + 4. Type Escape to exit Insert mode and return to Normal mode. 5. Repeat until the line matches the line below it. --> Th stce misg so. @@ -141,11 +119,11 @@ 2. Open a file in Helix by running: hx FILENAME 3. Make some edits to the file. 4. Type : to enter Command mode. - 5. Type w or write, and press Enter to save the file. + 5. Type w or write, and type Enter to save the file. You can also type wq or write-quit to save and exit. - Note: You can optionally enter a file path after the w / write + 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. @@ -167,7 +145,7 @@ * Type d to delete the character at the cursor. - * Type i to enter Insert mode and type text. Press Escape to + * Type i to enter Insert mode and type text. Type Escape to return to Normal mode. @@ -263,7 +241,7 @@ ================================================================= -= 3.2 MORE MOTIONS = += 3.2 MORE ON MOTIONS = ================================================================= As you saw, typing w moves the cursor forward until the start @@ -275,39 +253,17 @@ e - Move forward to the end of the current word. b - Move backward to the beginning of the current word. - To select the word under cursor, combine e and b. - - 1. Move the cursor to the line marked '-->' below. - 2. Move to a 'd' letter. - 3. Type e to select a half of the word. - 4. Type b to select the rest. - ---> The Middle Kingdom. - -================================================================= -= 3.3 WORDS AND words = -================================================================= - 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. - 1. Move the cursor to the beginning of the line marked with '-->'. - 2. Type w repeatedly to select individual words until you - reach the end of the line. - 3. Note that 'one-of-a-kind' required 7 keystrokes to be - traversed. '"modal"' required 3 keystrokes. - 4. Move the cursor back to beginning of the line marked '-->'. - 5. Type W repeatedly to select individual WORDS. - 6. Note that 'one-of-a-kind' and '"modal"' have been selected - both with one keystroke each. + All of these motions select the text they traverse. ---> Helix is a one-of-a-kind "modal" text editor ================================================================= -= 3.4 THE CHANGE COMMAND = += 3.3 THE CHANGE COMMAND = ================================================================= Type c to change the current selection. @@ -316,7 +272,7 @@ Insert mode, so it is a very common shorthand for di. 1. Move the cursor to the line marked '-->' below. - 2. Move to the start of an incorrect word and type e to + 2. Move to the start of an incorrect word and type w to select it. 3. Type c to delete the word and enter Insert mode. 4. Type the correct word. @@ -329,7 +285,7 @@ ================================================================= -= 3.5 COUNTS WITH MOTIONS = += 3.4 COUNTS WITH MOTIONS = ================================================================= Type a number before a motion to repeat it that many times. @@ -337,7 +293,7 @@ 1. Move the cursor to the line marked '-->' below. 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. + 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. @@ -351,7 +307,7 @@ ================================================================= -= 3.6 SELECT / EXTEND MODE = += 3.5 SELECT / EXTEND MODE = ================================================================= Type v to enter Select mode. @@ -373,7 +329,7 @@ ================================================================= -= 3.7 SELECTING LINES = += 3.6 SELECTING LINES = ================================================================= Type x to select a whole line. Type x again to select the next. @@ -391,11 +347,11 @@ --> 6) Sugar is sweet, --> 7) And so are you. - Note: X works similarly to x although it doesn't extend to - subsequent lines. X on an empty line does nothing. + Note : X works similarly to x although it doesn't extend to + subsequent lines. X on an empty line does nothing. ================================================================= -= 3.8 COLLAPSING SELECTIONS = += 3.7 COLLAPSING SELECTIONS = ================================================================= Type ; to collapse selections to single cursors. @@ -411,8 +367,8 @@ --> This is an error-free line with words to move around in. Note: This works the same in Select mode. - Note: Another related command is Alt-; which flips the direction - of the selection (flips the selection's cursor and anchor). + Note: Another related command is Alt-; which flips selections. + @@ -491,7 +447,7 @@ Type N to go to the previous search match. 1. Type / and type in a common word, like 'banana'. - 2. Press Enter to confirm the search. + 2. Type Enter to confirm the search. 3. Use n and N to cycle through the matches. Searching uses regular expressions, allowing you to target more @@ -539,14 +495,14 @@ will now affect both cursors. 3. Use Insert mode to correct the lines. The two cursors will fix both lines simultaneously. - 4. Type , to remove the first cursor. + 4. Type , to remove the second cursor. --> Fix th two nes at same ime. --> --> Fix th two nes at same ime. Fix these two lines at the same time. - Note: Press Alt-C to do the same above the cursor. + Note: Type Alt-C to do the same above the cursor. ================================================================= = 5.2 THE SELECT COMMAND = @@ -557,11 +513,11 @@ 1. Move the cursor to the line marked '-->' below. 2. Type x to select the line. 3. Type s. A prompt will appear. - 4. Type 'apples' and press Enter. Both occurrences of + 4. Type 'apples' and type Enter. Both occurrences of 'apples' in the line will be selected. 5. You can now type c and change 'apples' to something else, like 'oranges'. - 6. Press Escape to exit Insert mode. + 6. Type Escape to exit Insert mode. 7. Type , to remove the second cursor. --> I like to eat apples since my favorite fruit is apples. @@ -580,7 +536,7 @@ 1. Move the cursor to the line marked '-->' below. 2. Select the line with x and then type s. 3. Type ' +' to select any amount of consecutive spaces >1, - then press Enter. + then type Enter. 4. Type c and change the matches to single spaces. --> This sentence has some extra spaces. @@ -618,11 +574,11 @@ = 5.5 SPLIT SELECTION INTO LINES = ================================================================= - Press Alt-s to split the selection(s) on newlines. + Type Alt-s to split the selection(s) on newlines. 1. Move the cursor to the first row of the table below. 2. Select the entire table with 6x. - 3. Press Alt-s to split into selections at each line. + 3. Type Alt-s to split into selections at each line. 4. Align the table with &. | FRUIT | AMOUNT | @@ -648,7 +604,7 @@ * Type & to align selections. - * Press Alt-s to split the selection into lines. + * Type Alt-s to split the selection into lines. @@ -707,7 +663,7 @@ ================================================================= Type . to repeat the last insert command. - Press Alt-. to repeat the last f / t selection. + Type Alt-. to repeat the last f / t selection. 1. Move the cursor to the line marked '-->' below. 2. Make a change, insertion or appendage and repeat it with . . @@ -734,7 +690,7 @@ * Type r to replace selected characters. * Type . to repeat the last insertion. - * Press Alt-. to repeat the last f / t selection. + * Type Alt-. to repeat the last f / t selection. @@ -755,7 +711,7 @@ 1. Move the cursor to the line marked '-->' below. 2. Type w to select "watermelons" and then y to yank it. 3. Select "oranges" with w. - 4. Type R to replace "oranges" with "watermelons". + 4. Type R to replace "oranges" with "watermelons" --> I like watermelons because oranges are refreshing. @@ -794,11 +750,11 @@ lines. = 7.3 INDENTING LINES = ================================================================= - Type > to indent a line and < to unindent it. + Type > to indent a line and < to outdent it. 1. Move the cursor to the line marked '-->' below. 2. Move down to the second line and type > to indent it. - 3. Move to the third line and type < to unindent it. + 3. Move to the third line and type < to outdent it. --> These lines are indented @@ -816,13 +772,13 @@ lines. = 7.4 INCREMENTING AND DECREMENTING = ================================================================= - Press Ctrl-a to increment the number under selection. - Press Ctrl-x to decrement the number under selection. + Type Ctrl-a to increment the number under selection. + Type Ctrl-x to decrement the number under selection. 1. Move the cursor to the third line marked '-->' below. - 2. Press Ctrl-a to increment the second point marked 2. + 2. Type Ctrl-a to increment the second point marked 2. 3. Repeat for the point marked 3. - 4. Move to the last point and press Ctrl-x to decrement the 6. + 4. Move to the last point and type Ctrl-x to decrement the 6. --> 1) First point. --> 2) Added point. @@ -830,8 +786,8 @@ lines. --> 3) Another point. --> 6) Last point. - - + Note: If there isn't a number under the selection the cursor + will jump to the next number in the line and act on it. ================================================================= @@ -842,10 +798,10 @@ lines. * Type J to join lines in selection. - * Type > and < to indent / unindent lines. + * Type < and > to indent / outdent lines. - * Press Ctrl-a to increment the selected number. - * Press Ctrl-x to decrement the selected number. + * Type Ctrl-a to increment the selected number. + * Type Ctrl-x to decrement the selected number. @@ -892,13 +848,13 @@ lines. 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. + 4. Exit insert and Type Q again to stop recording. 5. Move to the line below and put your cursor on '>' again. 6. Type q to repeat the macro. - --> ... sentence doesn't have its first and last ... . - --> ... sentence doesn't have its first and last ... . - This sentence doesn't have its first and last word. + --> ... 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. ================================================================= = CHAPTER 8 RECAP = @@ -941,7 +897,7 @@ lines. --> A horse is a horse, of course, of course, --> And no one can talk to a horse of course. - Note: * is like a shorthand for "/y as all it really does is + Note: * is like a shorthand for "/ y as all it really does is copy the selection into the / register. ================================================================= @@ -974,57 +930,35 @@ lines. searching or jumping to the definition of a function in code. It stores these in what's called the jumplist. - Press Ctrl-s to manually save your current position to + Type Ctrl-s to manually save your current position to the jumplist. - Press Ctrl-i ("in") and Ctrl-o ("out") to move forward and + Type Ctrl-i ("in") and Ctrl-o ("out") to move forward and backwards in the jumplist respectively. - 1. Press Ctrl-s somewhere. + 1. Type Ctrl-s somewhere. 2. Move far away in the file. - 3. Press Ctrl-o (just once!) to come back to where you saved. + 3. Type Ctrl-o (just once!) to come back to where you saved. ================================================================= -= 9.4 JUMP WITH TWO-CHARACTER LABELS = -================================================================= - - Type gw to enable the 2-character labels. The start of each word - will be replaced by 2 highlighted characters. Type any sequence - of 2 highlighted characters to jump to the corresponding label, - or use ESC to drop the labels. - - The 2-character labels allow you to quickly jump to any location - in the viewable selection. - - 1. Move the cursor to the start of the line marked '-->' below. - 2. Press gw to enable the 2-character labels, and then the two - characters that replace the two letters he at the start of - here to jump to the corresponding word. - - --> This is just a simple line of text. - There may be many such lines - But you really want to jump here! - This is fast with the 2-character labels. - -================================================================= = CHAPTER 9 RECAP = ================================================================= * Type * to set the search register to the primary selection. - * Type n / N in Select mode to add selections on each search + * Type n / N in Visual mode to add selections on each search match. - * Press Ctrl-s to save position to the jumplist. - * Press Ctrl-i and Ctrl-o to go forward and backward in the + * Type Ctrl-s to save position to the jumplist. + * Type Ctrl-i and Ctrl-o to go forward and backward in the jumplist. - * Type gw to enable 2-character labels, and any 2 characters to - jump to the corresponding label, or ESC to drop the labels. + + @@ -1039,50 +973,28 @@ lines. Type ) and ( to cycle the primary selection forward and backward through selections respectively. - Press Alt-, to remove the primary selection. + Type Alt-, to remove the primary selection. 1. Move the cursor to the line marked '-->' below. 2. Select both lines with xx or 2x. 3. Type s to select, type "would" and enter. - 4. Use ( and ) to cycle the primary selection and deselect - the second "would" with Alt-, . + 4. Use ( and ) to cycle the primary selection and remove the + very second "would" with Alt-, . 5. Type c "wood" to change the remaining "would"s to "wood". --> How much would would a wouldchuck chuck --> if a wouldchuck could chuck would? - - - -================================================================= -= 10.2 CYCLING THE CONTENT OF SELECTIONS = -================================================================= - - Press Alt-) and Alt-( to cycle the content of the selections - forward and backward respectively. - - 1. Move the cursor to the line marked '-->' below. - 2. Select both lines with xx or 2x. - 3. Type s to select, type "through|water|know" and enter. - 4. Use Alt-( and Alt-) to cycle the content of the selections. - - --> Jumping through the water, - --> daring to know. - - - - - - - + Note: Additionally, Alt-( and Alt-) cycle the *contents* of the + selections as well. ================================================================= -= 10.3 CHANGING CASE = += 10.2 CHANGING CASE = ================================================================= Type ~ to switch the case of all selected letters. Type ` to set all selected letters to lowercase. - Press Alt-` to set all selected letters to uppercase. + Type Alt-` to set all selected letters to uppercase. 1. Move the cursor to the first line marked '-->' below. 2. Select each wrongly capitalised or lowercase letter @@ -1092,14 +1004,14 @@ lines. 5. Type ` to change the line to lowercase. 6. Move to the third line marked '-->'. 7. Type x to select the line. - 8. Press Alt-` to change the line to uppercase. + 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! ================================================================= -= 10.4 SPLITTING SELECTIONS = += 10.3 SPLITTING SELECTIONS = ================================================================= Type S to split each selection on a regex pattern. @@ -1109,10 +1021,10 @@ lines. 3. Type S then \. |! Enter (note the spaces after . and !). This effectively splits the selection into sentences at each dot or exclamation mark. - 4. Press Alt-; to reverse the selections. + 4. Type Alt-; to reverse the selections. 5. Type ; to reduce selections to a single character - the first letter of each sentence. - 6. Press Alt-` to convert all selected letters to uppercase. + 6. Type Alt-` to convert all selected letters to uppercase. --- these are sentences. some sentences don't start with uppercase @@ -1126,12 +1038,11 @@ letters! that is not good grammar. you can fix this. * Use ) and ( to cycle the primary selection back and forward through selections respectively. - * Press Alt-, to remove the primary selection. - * Press Alt-) and Alt-( to cycle the content of the selections. + * Type Alt-, to remove the primary selection. * Type ~ to alternate case of selected letters. * Use ` and Alt-` to set the case of selected letters to - lower and upper respectively. + upper and lower respectively. * Type S to split selections on regex. @@ -1142,396 +1053,19 @@ letters! that is not good grammar. you can fix this. -================================================================= -= 11.1 COMMENTING A LINE = -================================================================= - - Press Ctrl-c to comment the line under your cursor. - To uncomment the line, press Ctrl-c again. - - 1. Move your cursor to the line marked '-->' below. - 2. Now comment the line marked with '-->'. - 3. Now try uncommenting the line. - - --> Comment me please - - - - - - - - - - -================================================================= -= 11.2 COMMENTING MULTIPLE LINES = -================================================================= - - Using the selections and multi-cursor functionality, you can - comment multiple lines as long as they are under the selection or - cursors. - - 1. Move your cursor to the line marked with '-->' below. - 2. Now try to select or add more cursors to the other lines marked - with '-->'. - 3. Comment those lines. - - --> How many are you going to comment? - --> Is this enough for a comment? - --> What are you doing?! - --> Stop commenting me! - --> AAAAaargh!!! - - Note: If there are already commented lines under selections or - multiple cursors, they won't be uncommented but commented again. - -================================================================= -= CHAPTER 11 RECAP = -================================================================= - - * Use Ctrl-c to comment a line under your cursor. Press Ctrl-c - again to uncomment. - * To comment multiple lines, use the selections - and multi-cursors before typing Ctrl-c. - * Commented lines cannot be uncommented but commented again. - - - - - - - - - - - - - -================================================================= -= 12.1 USING MATCH MODE JUMP = -================================================================= - - To switch to match mode from normal mode, type m. This feature - is particularly useful for handling bracket pairs and their - contents. - - There are several actions that can be performed in match mode, - as indicated by the help pop-up. To jump to a matching bracket pair, - simply press mm. For example on the lines below (starting with - -->), move the cursor in normal mode to (, and then press mm to jump - to the matching ). You can do the same on the line below: for example - move to ], and press mm to jump to [ . - - --> you can (jump between matching parentheses) - --> or between matching [ square brackets ] - --> now { you know the drill: this works with brackets too } - - - - -================================================================= -= 12.2 USING MATCH MODE SELECT INSIDE = -================================================================= - - Match mode also lets you select the "inside" content between a - pair of brackets or other delimiters. In the lines below: - - - move to the --> line, put your cursor in normal mode at any - location between the parentheses, for example at 'x', and press - mi( or mi) to select the whole content inside the parentheses - (parentheses excluded). As usual, you can then do anything you want - with the selection (for example, press c to change it) - - --> outside and (inside x parentheses) - and outside again - - Test below that you can do the same with [], or {}, or with - nested combinations of these (this will act on the immediately - surrounding matching pair). This also works with "" and similar - - --> test [ with square brackets ] ! - --> try ( with nested [ pairs of ( parentheses) and "brackets" ]) - -================================================================= -= 12.3 USING MATCH MODE SELECT AROUND = -================================================================= - - You can also select the "around" content, i.e. both the inside - content and the delimiters themselves, by using the ma select. - For example, move to the line under, move your cursor in normal - mode to any position between the (), and select the content of - the (), including the surrounding (), by typing ma( or ma). As - usual, you can do anything you want with the selection, for - example delete it all with ma(d . - - --> you ( select x around ) to include delimiters in the select - - This naturally works with other delimiters too: - - --> try [ with 'square' brackets ] too! - - - - - -================================================================= -= 12.4 USING MATCH MODE SURROUND = -================================================================= - - The match mode can also be used to add surrounding around the - current selection. For example, move to the line below, then: - * i) select the "select all of this" line segment (for example, - move in normal mode the cursor to the start of select, then enter - selection mode with v , then select the 4 next words with 4e ), - * ii) press ms( or ms) to surround the selection with a pair of - parentheses. - - --> so, select all of this, and surround it with () - - You can do the same with other delimiters: for example, ms' on - WORD below to surround it with a pair of ''. You can try also - with adding a surrounding pair of "", or {}, or []. - - --> surround this WORD ! - - - -================================================================= -= 12.5 USING MATCH MODE DELETE SURROUND = -================================================================= - - You can delete surrounding pair of delimiters with the md - command. On the line below, move the cursor anywhere - within the pair of (), for example to the 'x', then from there, - in normal mode, press md( or md) to delete the surrounding - pair of parentheses. - - --> delete (the x pair of parentheses) from within! - - You can naturally delete other kinds of surroundings: - - --> delete (nested [delimiters]): "this" will delete the nearest - matching surrounding pair. - --> delete "layers "of" quote marks" too: this will delete the - nearest previous and following quote marks - - Trying to delete nonexistent surrounding delimiters prints an error - at the bottom bar and does nothing. - -================================================================= -= 12.6 USING MATCH MODE REPLACE SURROUND = -================================================================= - - You can replace surrounding pairs of delimiters with the mr - command. On the line below, move the cursor to - anywhere within the pair of (), for example on the 'x', then in - normal mode, press mr([ to replace the pair of () with a pair - of []. - - --> replace the (pair from x within), with something else - - This command will act on the closest enclosing pair, so you - can try replacing different surrounding in the following: - - --> some (nested surroundings [can be replaced]) - --> this "works with 'other surroundings' too" - - You can try to replace a nonexistent pair: this will show - an error warning at the bottom bar and do nothing. - - -================================================================= -= CHAPTER 12 RECAP = -================================================================= - - You can enter the match mode with the m key; this will show the - actions available in a popup. This will allow you to: - * jump to matching pair of delimiters with mm (you must have a - delimiter belonging to a pair under your cursor) - * select inside a pair of delimiters surrounding your cursor - (i.e. select the content but not the delimiters) with mi( - and similar - * select around a pair of delimiters surrounding your cursor - (i.e. select the content and the delimiters) with ma( and - similar - * delete surrounding delimiters with md( and similar - * add surrounding delimiters around the selection with ms( - * replace a pair of delimiters surrounding your selection with - mr([ to replace for example surrounding () with [] - - - - -================================================================= -= CHAPTER 13.1 CREATE NEW SPLIT = -================================================================= - - In Normal mode, press Ctrl-w to open the Window menu, which displays - a list of available commands. - - To open a new empty buffer in a vertical split on the right half - of your current window, use Ctrl-w nv (i.e., press Ctrl - and w simultaneously, then press n, followed by v). Your current - window will now split in 2 vertically. A new empty buffer split - will appear on the right half and your cursor will jump to the - new vertical split. - - To create a new empty buffer in a horizontal split, press - Ctrl-w ns. This action divides your current window into two - horizontally, creates a new buffer, and moves your cursor to the - new horizontal split. - - - - -================================================================= -= CHAPTER 13.2 MOVE BETWEEN SPLITS = -================================================================= - - Use Ctrl-w k to move to the split above your current split. Use - Ctrl-w j to move to the split below. Use Ctrl-w h to move to - the split on the left and Ctrl-w l to move to the split on the - right. To navigate to the next split (in the order they were - opened), press Ctrl-w w. - - You can now do whatever you want in your new buffers and splits. - Once you are done with using your new buffer split, - you can close it with Ctrl-w q . Move to the bottom right split - with Ctrl-w l then Ctrl-w j, then press Ctrl-w q to close this - specific split. - - You can also close all splits except the current one with Ctrl-w o . - Open a third vertical split with Ctrl-w nv , then move to the - leftmost split with Ctrl-w h twice, then from inside the split on - the left press Ctrl-w o to close all except this split. - ================================================================= -= CHAPTER 13.3 SPLIT CURRENT BUFFER = += = ================================================================= - Use Ctrl-w s to split the view of the current buffer horizontally - and Ctrl-w v to split it vertically with the buffer opened in both - splits. - - Close extra splits with Ctrl-w o to return to a single window view. - - - - - - - - -================================================================= -= CHAPTER 13.4 USE COMMANDS TO SPLIT = -================================================================= - - The :vsplit (or :vs for short) and :hsplit (or :hs) commands can - also be used to split a specific buffer vertically or horizontally. - For example, enter the command: - - :vs something - - to open a new vertical split named "something" to the right. Here, - "something" is not an existing file, so a new buffer with this name - will open; however, you can replace "something" with any file name - to open it in a new buffer. Similarly, you can enter the command: - - :hs some_more - - to open a new buffer named "some_more" in the lower half. - "some_more" could be any file or path to open this specific file - or path instead of a new empty buffer. - - -================================================================= -= CHAPTER 13.5 SWAPPING SPLITS = -================================================================= - - Open a split on the left with :vs hello1 and then a split below - with :hs hello2. - - From hello2, press Ctrl-w K to swap it with the split above. Now - hello2 is at the top while hello1 is at the bottom. - - Still from hello2, press Ctrl-w H to swap with the split on the - left: now hello2 is on the left and the tutor is on the top - right. After Ctrl-w you can use HJKL to swap with the buffer - on the left / below / above / on the right. - - Move back to the tutor split, and press Ctrl-w o to only keep - this split. - - - - - -================================================================= -= CHAPTER 13.6 TRANSPOSE SPLITS = -================================================================= - - Open a split on the left with :vs hello1 and then a split below - with :hs hello2. - - Move to the tutor split, then press Ctrl-w t to transpose the - vertical split opened from this window: now, hello1 and - hello2 are below, rather than to the right of, the tutor. Press - Ctrl-w t again to transpose back. - - Move to the hello1 split, then press Ctrl-w t to transpose the - horizontal split that was opened from this window: now hello2 - is on the right, rather than below, hello1. Press Ctrl-w t to - transpose back. - - Move back to the tutor split and press Ctrl-w o to close all but - the tutor window. - - - -================================================================= -= CHAPTER 13.7 OPEN SPLIT FROM FILEPICKER = -================================================================= - - Splits can also be opened directly from the file picker. Press - space f to open the file picker. From there, you can type in text - to perform file lookup with fuzzy matching, and use the arrows - up and down to move the selected file (indicated by the > symbol). - If you want to exit the file picker, press Escape. - - Select any file you like in the file picker. You could open it in - the current view by pressing enter (do not do this at present). - But you can also open it in a new split. Press Ctrl-v to open - the selected file in a new vertical split. Press space f again, - select any file you want, and press Ctrl-s to open it in a - horizontal split. - - Move back to the tutor split, and press Ctrl-w o to close all - splits except this one. - - - -================================================================= -= CHAPTER 13 RECAP = -================================================================= - Splits can be used to display either the same buffer several times - or several buffers. To access the main windows and splits commands, - press Ctrl-w . You can move between splits with Ctrl-w hjkl , - you can close a split with Ctrl-w q , and you can close all but - the present split with Ctrl-w o . - Splits can also be opened by using the :vs FILENAME and - :hs FILENAME commands. - Splits can also be used directly from the file pickers, by using - Ctrl-v to open the file selected in a new vertical split, and - Ctrl-s in a horizontal split. |