Navigating and Editing in Vim: A Beginner's Guide
Going into Insert Mode
------------------------
There are several ways to enter insert mode, with the most common method being typing the lowercase "I" key. This allows you to start typing before your cursor appears, making it easier to get out of insert mode once you've started typing. If you want to type after your cursor, simply press the escape key. Another way to start typing at the beginning or end of a line is by pressing the "a" or "I" keys, respectively. Typing at the beginning of a line can be useful for inserting new lines and formatting text, while capital "I" and capital "a" allow you to start typing at the end of a line.
Navigating through Vim
--------------------
Vim has several ways to navigate through different parts of your document. The "J" key brings your cursor to the beginning of the file, while pressing the "G" key takes you to the end of the file. To move to the next or previous space within a paragraph, use the "e" and "b" keys, respectively, in upward and downward directions. You can also navigate words using the "W", "w", "E", and "b" keys for moving right or left through words.
Searching for Text
------------------
Vim has several search commands that allow you to find specific text within your document. The forward slash "/" key is used to start a search, and you can use this key in conjunction with the navigation keys to move through the results. If you want to look for something throughout the file, using forward slashes can be an efficient way to search for specific words or phrases.
Using Search Commands
----------------------
The Asterisk sign (*) allows you to perform an exact match search, while the number of asterisks can be used to specify the minimum and maximum number of characters to search. For example, "*/" searches for a string starting with an asterisk, followed by one character, and then any characters up until the end of the line.
Navigation and Editing Options
------------------------------
Vim also has several other navigation and editing options that you can use to refine your search results. The "#" key is used to move to the previous search result, while pressing it twice takes you back two search results. You can also use the "%" key to repeat a command that matches the start or end of a line.
Deleting Text
----------------
Vim has several options for deleting text within your document. The "D" key deletes one character at a time, while pressing "DD" deletes multiple characters. If you want to delete an entire paragraph, using "DD" is the most efficient option. You can also use the "di" and "dI" commands to delete text within specific tags or characters.
Paste Operations
------------------
Vim has several options for pasting deleted text back into your document. The "P" key allows you to paste text after your cursor, while the capital "P" key is used to paste text before your cursor. If you want to insert multiple lines of text at once, pressing "DD" followed by "P" and then typing is a quick way to do so.
Additional Editing Options
---------------------------
Vim also has several additional editing options that can be useful for refining your document. The ":t" command allows you to type in a new line after deleting text, while the ":p" command pastes deleted text back into your document. You can also use the ":r" command to repeat a previous search or navigation operation.
Exiting Vim
-------------
To exit and save your changes, press "X" followed by semicolon (";") and then enter. If you're not ready to save and want to exit without saving, you can simply press "q" and then enter.
"WEBVTTKind: captionsLanguage: enhello I am them girl any love talking about tech this video is for those of you who are new to them if you intend to program in your career one of the best text editors to use as them it is efficient because you no longer need the mouse to move your cursor it's ubiquitous because it can be found on virtually all UNIX systems and it's very helpful because it pushes programmers to think twice before coding I'll be going over some of the commands I use frequently about how to insert navigate search edit and exit in vim so that by the end of this video you'll be ready to edit your code there are quite a few commands I'll be going over so if it gets overwhelming don't worry I have it all written down for you just sit back and enjoy the show now let's try to open my file called index is before I can start typing I have to go into insert mode you know I can't just unconsciously knock code out like an atom or sublime there are several ways of going into insert mode the most common is lowercase I it allows me to start typing before my cursor to get out of the insert mode I simply press escape if I want to type after my cursor I use a to type at the beginning of the line I use capital I and capital a will let me start typing at the end of the line lowercase o will let me type in a new line after my cursor and capital o in a new line before my cursor now that we know how to go into insert mode let's talk about the different ways you can navigate through the spot Jiji brings my cursor to the beginning of the file to get to the end of the file I'll use cap gee if I want to move my cursor to the end of this line I'll use the dollar sign and to get to the beginning of the same line I'll use 0 an opening curly bracket will take us to the next space of a paragraph in an upward Direction like so and a closing curly bracket will do the same but in a downward direction now if I want to move right words within this line W will take me to the next word lowercase W that is and capital W will take me to the next word separated by a space now if I want to move left words lowercase B will take my cursor to the last word and capital B will take my cursor to the last word separated by a space okay now let's try searching through our file lowercase F finds the closest character of your choice to the right of the cursor so say I'm looking for lowercase a F a and I found a capital F does the same thing except that it looks to the left so let's look for again capital F a and there it is to find my name in this file I can use forward slash the girl and there's a few results that are found so to move through each of them in the right words direction I can use lowercase n if I want to move left words I can use capital n so you can make the forward slash much more efficient if your cursor is on a word like so that you want to look for throughout the file you can use pound then thumb them clicking the pound again will allow you to navigate left words through each matched word like so the Asterix sign does the exact same thing except this time clicking it again will allow you to navigate right words so let's press extract and it's navigating right words okay now let's start editing lowercase D deletes something that something can be one of our navigation or search commands for example D and closing curly bracket will delete the entire paragraph over here D wasn't awesome and it's gone if you mess up on writing a function and want to delete everything up until and including this ending parenthesis you can use D F and closing parenthesis and it's gone if you wanted to keep that last parenthesis then you can use D T closing parenthesis like so and that closing parenthesis is still there all right so DW lets you delete one word if you want to delete five words or let's do two for now we can do two DW and you get the point to delete this entire line I can use D D to paste that line that I just deleted after my cursor I'll use lowercase P and there it is if I wanted to taste it before my cursor I can use capital P and there it is I can also delete within specific characters using di if I wanted to delete whatever is in it I can use di t so let's try the leading what's in this table using deit and it's gone okay similarly D I opening parenthesis will delete everything that is in a parenthesis so let's move on over took this parenthesis di and there it is say I don't want the tag that's over here what I can do is delete the entire tag by using da2 and T and it's all gone alright so if you want just to type after deleting a seat I is like di on steroids it deletes and puts you straight into insert mode for example I'm going to delete whatever is inside this single quote so I'm gonna use CI single quote and now I deleted it and I can I'm automatically on enter mode okay similarly C I T will do the same that the closest tag to I T I've not only deleted what is inside I can also type because I'm automatically and insert okay I am done with this file to save and exit you can use lower case X you're gonna have to do Co semicolon and then lower case X and enter but I actually need the original code for this I'm going to exit without saving using semicolon lowercase U and explanation mark that ends my intro to them now you know how to insert navigate search and edit in vim I encourage you to get rid of your sublime or atom and force yourself to use only them if you're really serious about switching to this awesome text editor until next timehello I am them girl any love talking about tech this video is for those of you who are new to them if you intend to program in your career one of the best text editors to use as them it is efficient because you no longer need the mouse to move your cursor it's ubiquitous because it can be found on virtually all UNIX systems and it's very helpful because it pushes programmers to think twice before coding I'll be going over some of the commands I use frequently about how to insert navigate search edit and exit in vim so that by the end of this video you'll be ready to edit your code there are quite a few commands I'll be going over so if it gets overwhelming don't worry I have it all written down for you just sit back and enjoy the show now let's try to open my file called index is before I can start typing I have to go into insert mode you know I can't just unconsciously knock code out like an atom or sublime there are several ways of going into insert mode the most common is lowercase I it allows me to start typing before my cursor to get out of the insert mode I simply press escape if I want to type after my cursor I use a to type at the beginning of the line I use capital I and capital a will let me start typing at the end of the line lowercase o will let me type in a new line after my cursor and capital o in a new line before my cursor now that we know how to go into insert mode let's talk about the different ways you can navigate through the spot Jiji brings my cursor to the beginning of the file to get to the end of the file I'll use cap gee if I want to move my cursor to the end of this line I'll use the dollar sign and to get to the beginning of the same line I'll use 0 an opening curly bracket will take us to the next space of a paragraph in an upward Direction like so and a closing curly bracket will do the same but in a downward direction now if I want to move right words within this line W will take me to the next word lowercase W that is and capital W will take me to the next word separated by a space now if I want to move left words lowercase B will take my cursor to the last word and capital B will take my cursor to the last word separated by a space okay now let's try searching through our file lowercase F finds the closest character of your choice to the right of the cursor so say I'm looking for lowercase a F a and I found a capital F does the same thing except that it looks to the left so let's look for again capital F a and there it is to find my name in this file I can use forward slash the girl and there's a few results that are found so to move through each of them in the right words direction I can use lowercase n if I want to move left words I can use capital n so you can make the forward slash much more efficient if your cursor is on a word like so that you want to look for throughout the file you can use pound then thumb them clicking the pound again will allow you to navigate left words through each matched word like so the Asterix sign does the exact same thing except this time clicking it again will allow you to navigate right words so let's press extract and it's navigating right words okay now let's start editing lowercase D deletes something that something can be one of our navigation or search commands for example D and closing curly bracket will delete the entire paragraph over here D wasn't awesome and it's gone if you mess up on writing a function and want to delete everything up until and including this ending parenthesis you can use D F and closing parenthesis and it's gone if you wanted to keep that last parenthesis then you can use D T closing parenthesis like so and that closing parenthesis is still there all right so DW lets you delete one word if you want to delete five words or let's do two for now we can do two DW and you get the point to delete this entire line I can use D D to paste that line that I just deleted after my cursor I'll use lowercase P and there it is if I wanted to taste it before my cursor I can use capital P and there it is I can also delete within specific characters using di if I wanted to delete whatever is in it I can use di t so let's try the leading what's in this table using deit and it's gone okay similarly D I opening parenthesis will delete everything that is in a parenthesis so let's move on over took this parenthesis di and there it is say I don't want the tag that's over here what I can do is delete the entire tag by using da2 and T and it's all gone alright so if you want just to type after deleting a seat I is like di on steroids it deletes and puts you straight into insert mode for example I'm going to delete whatever is inside this single quote so I'm gonna use CI single quote and now I deleted it and I can I'm automatically on enter mode okay similarly C I T will do the same that the closest tag to I T I've not only deleted what is inside I can also type because I'm automatically and insert okay I am done with this file to save and exit you can use lower case X you're gonna have to do Co semicolon and then lower case X and enter but I actually need the original code for this I'm going to exit without saving using semicolon lowercase U and explanation mark that ends my intro to them now you know how to insert navigate search and edit in vim I encourage you to get rid of your sublime or atom and force yourself to use only them if you're really serious about switching to this awesome text editor until next time\n"