## First advice or clarification The letters change their behavior depending on whether they are uppercase or lowercase. By using Shift we tell vim not to add any modifiers to the [Operator](#Operators), otherwise with lower case it will wait for a second and even a third parameter for its execution. As an example of this we have D. where pressing d with Caps Lock active or pressing d and Shift will cut the text from the pointer position to the end of the line, where doing it with lowercase d will do nothing until the same key is pressed a second time or a modifier is passed (w of word, s sentence, p of paragraph among others) > [!TIP] > If yours is not so much theory but practice, you can visit these websites and learn in a more interactive way: [Vim Snake](https://vimsnake.com/), [Vim Adventures](https://vim-adventures.com/), [Vim Genius](http://www.vimgenius.com/lessons). I also recommend this **[free Vim course](https://www.udemy.com/course/vim-aumenta-tu-velocidad-de-desarrollo/ "Vim by Nicolas Schurmann")** taught on Udemy. ### Modes | | | |--------------|---------| |Normal |is the default mode of files when opening them for the first time. this is read only, since with this we can only cut with X, C, S and D | |Insert |It is the way that allows us to edit it. Crtl + c is blocked, if we press this we will only change to normal mode. this mode is activated from Normal mode with the i key or Insert key | |Visual |this is useful to make selections of words or fragments of a phrase, it is activated from Normal mode with v| |Visual Inline |this is useful for making selections of entire paragraphs, it is activated from Normal mode with V| |Visual Block |this is useful for making Text Block selections, it is activated from Normal mode with Ctrl + v| |Replace |as its name indicates, it is to replace the text, it is activated from the normal mode with R or by pressing the Insert key from the insertion mode| ### Movement / Displacement | | | |---------------|-----| | h | allows us to move to the left. we encode the amount of characters that we will move with numbers | | 4 h | will move us 4 positions to the left | | j | it would be the same as with **h** but moving down | | k | we'll move up | | l | we'll move to the right | | g j | this would be the same as **j** | | g k | this would be the same as **k** | | g g | we move to the first line, but we can also modify the line we go to | | 8 G | positions us on line 8, if it does not exist it directs us to the last line | | G | it moves us to the last line, if it allows a numeric modifier | | [ [ | we move to the first line. does not allow numeric modifier | | ] ] | we move to the last line. does not allow numeric modifier | | H | we scroll to the visible top of the screen, it would be the same as pressing the **Page Up** key | | M | we move to the visible central part of the screen | | L | we scroll to the visible bottom of the screen, it would be the same as pressing the **Page Down** key | | 0 | moves to the first character of a line, of the line we are on | | ^ | moves to the first character of a **non-blank** line, of the line we are on | | $ | moves to the last charcacter of a line, of the line we are on | | _ | moves to the first character of a line, of the line we are on | | g _ | moves to the last character of a **non-blank** line, of the line we are on | | - | moves up positioning it self in the first character that is **non-blank** | | + | moves down to the first **non-blank** character | | w | moves to the first letter of each word, from right to the left and when finished go down to the next line | | W | moves to the first letter of each word, from right to the left and when finished go down to the next line (skip special characters) | | b | moves to the first letter of each word, from right to left and when it finishes it goes up to the previous line. the symbols are taken as separate words. | | B | moves to the first letter of each word, from right to left and when it finishes it goes up to the previous line. the symbols are taken as part of the words. | | e | moves to the last letter of each word, from left to right the and when finished go down to the next line. the symbols are taken as separate words. | | E | moves to the last letter of each word, from left to right the and when finished go down to the next line. the symbols are taken as part of the words. | | g b | select the word under the cushion and perform a similarity search, and introduce us in visual mode| | g e | moves to the last letter of each word, from left to right and when finished go up to the previous line | | g f | will open the file that has the name of the word under the cursor. If it does not exist, the process of creating a new file will be done. | | Ctrl o | jump to previous location where the cursor has recently been | | Ctrl i | jumps to the next previous location where the cursor has recently been | | ( | moves to the next sentence | | ) | moves to the previous sentence | | { | moves us one paragraph Up | | } | moves us one paragraph Down | | % | it moves between the start and end blocks of {},[], () | | z z | scroll the line with the cursor to the center of the screen | | z t | scroll the line with the cursor to the top | | z b | scroll the line with the cursor to the bottom | ### Operators operators support numeric values, [moves](#movement--displacement) such as k,w and modifiers. example 2 + c + i + " which can be translated as it will cut 2 lines from its position down everything that is inside " these do not change their function when changing from lowercase to uppercase, they only stop admitting modifiers at the end of them. | | | |----------------|--------| | c | cuts a line, but does not delete it. after this we will return to insert mode. | | c - | cut the line from the course to the next one above it, eliminating a line break.. after this we will return to insert mode.| | c + | cut the line from the course to the next one below it, eliminating a line break.. after this we will return to insert mode. | | d | performs the same function as c but without changing modes | | s | cut character and return to insert mode. only accepts numeric modifiers | | S | cut line and return to insert mode. only accepts numeric modifiers | | x | cut character below the cursor. only accepts numeric modifiers | | X | cut character before cursor. only accepts numeric modifiers | | o | inserts a blank line after the line where the cursor is positioned and returns to insert mode. only accepts numeric modifiers | | O | inserts a blank line before the line where the cursor is positioned and returns to insert mode. only accepts numeric modifiers | | y y | copy line | | y w | copy word | | p | paste the copied text | | ~ | change a character from uppercase to lowercase and vice versa. only accepts numeric modifiers | | " 0 Y | copy and save with name "0" in the register. to see the log read the [**:reg command**](#commands) | | " 0 p | Paste from 0 register. to see the log read the [**:reg command**](#commands) | | 2 p | paste the copied text twice | | g ~ ~ | is similar to ~ but this will do the whole line instead | | g u u | change the entire line to lowercase | | g U U | change the entire line to uppercase | | u | undo last change. only accepts numeric modifiers | | r | redo the last change. only accepts numerical modifiers | | . | repeat last action. only accepts numeric modifiers | | > > | tabulate the text. we can indicate the number of lines to affect| | 2 > > | will tabulate the text affecting 2 lines | | > 2 > | will tabulate the text affecting 2 lines | | < < | will remove a tab from the text | | g p | paste after cursor | | g P | paste before cursor | | g c c | make a comment in line. if it is commented, it will eliminate the comment indicators, leaving the text of this | | g C C | make a comment in blocks. if it is commented, it will eliminate the comment indicators, leaving the text of this | | g c - | comments from the current line up. we can indicate how many lines up we want to affect | | g C 2 - | here we indicate that we want to affect 2 lines | | g c + | It is very similar to the previous sentence but this one comments from the current line downwards. | | J | join the line where we are positioned with the line below with a space between both | | g J | Similar to the previous statement only this one does not add any space | | g t | allow us to move to the next tab. if we pass a numeric modifier to the tab that corresponds to the number we pass | | g T | allow us to move to the previous tab. If we pass a numeric modifier, it will move as many tabs back as we indicate. | | 2 g T | If we are in tab number 3, it will move us 2 tabs back, this positions us in the first | ### Modifiers | | | |----------------|-----| | i | represents the part inside a text, example the text that is inside " " | | a | renders the entire text object, including "", (), spaces, tabs | | s | represents the sentences | | p | represents the paragraphs | | b | represents the blocks of () | | B | represents the blocks of {} | | t | represents the tag blocks <>.for this to work we must indicate em modifier a or i before this since there is another modifier that works with the T, example: c a t cuts the content and the tag itself or text within <> | | / | represents the text from the cursor position to the appearance of the search occurrence, if it is not found it will do nothing, d / ***fire*** will delete all the text found before the word fire | | f | represents the text from to the position of the occurrence including itself, it searches for characters | | F | it is similar to the previous sentence only that it looks for the previous occurrence | | t | represents the text from to the position of the occurrence does not include itself, it searches for characters | | T | it is similar to the previous sentence only that it looks for the previous occurrence | | < | represent that character | | > | represent that character | | ( | represent that character | | ) | represent that character | | { | represent that character | | } | represent that character | | [ | represent that character | | ] | represent that character | | " | represent that character | | ' | represent that character | | ` | represent that character | ### Visual mode | | | |---------------------------|-----| | a w | select a word | | a b | select block of () | | a B | select block of {} | | a t | select tag block <> | | i b | select text inside () | | i B | select text inside {} | | i t | select text inside tags <> | | o | moves the cursor between the last letter of the selection and the first | ### Search allows us to search the current file easily. allows us to use Regular Expression (regex), which is a huge advantage over Vs Code's built-in search engine. to search for a specific word we use < /> , it is useful when we search for words that could be contained in other words, for example sensitive and insensitive, it would be done ***/