Skip to content

Commit

Permalink
fix some bindings in insert mode bindings' table
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmed Yasser committed Jul 19, 2023
1 parent a5fed4e commit 5c9e207
Showing 1 changed file with 28 additions and 29 deletions.
57 changes: 28 additions & 29 deletions Editors/vim/Insert-Mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,34 @@ Vim's insert mode contains many useful features.

There are many ways to get into insert mode from the normal mode. Here are some of them:

| Key | Function|
|------|---------|
| `i ` |Insert text **before** the cursor. |
| `I ` |Insert text before the first non-blank character of the line. |
| `a ` |Append text **after** the cursor. |
| `A ` |Append text **at the end of line**. |
| `o ` |Starts a new line **below** the cursor and insert text. |
| `O ` |Starts a new line **above** the cursor and insert text. |
| `s ` |Delete the character under the cursor and insert text. |
| `S ` |Delete the current line and insert text. |
| `cw` |Delete the current word and insert text. |
| `cc` |Change line by clearing and then entering insert mode. |
| `gi` |Insert text in same position where the last insert mode was stopped.|
| `gI` |Insert text at the start of line (column 1). |
| Key | Function |
| ---- | --------------------------------------------------------------------------------------------------- |
| `i ` | Insert text **before** the cursor. |
| `I ` | Insert text before the first non-blank character of the line. |
| `a ` | Append text **after** the cursor. |
| `A ` | Append text **at the end of line**. |
| `o ` | Starts a new line **below** the cursor and enter insert mode. |
| `O ` | Starts a new line **above** the cursor and enter insert mode. |
| `s ` | Delete the character under the cursor and enter insert mode. |
| `S ` | Delete the current line and enter insert mode. |
| `cw` | Delete from the **current** cursor's position to the end of the current word and enter insert mode. |
| `cc` | Change line by deleting it and then entering insert mode. |
| `gi` | Insert text in same position where the last insert mode was stopped. |
| `I` | Insert text at the start of line (column 1). |

## Different Ways To Exit Insert Mode

There are a few different ways to return to the normal mode while in the insert mode:

| Key | Function|
|--------|---------|
|`<Esc> `|Exits insert mode and go to normal mode.|
|`Ctrl-[`|Exits insert mode and go to normal mode.|
|`Ctrl-C`|Like `Ctrl-[` and `<Esc>`, but does not check for abbreviation.|
| Key | Function |
| -------- | --------------------------------------------------------------- |
| `<Esc> ` | Exits insert mode and go to normal mode. |
| `Ctrl-[` | Exits insert mode and go to normal mode. |
| `Ctrl-C` | Like `Ctrl-[` and `<Esc>`, but does not check for abbreviation. |

## Repeating Insert Mode

You can insert text multiple times by passing a count parameter before entering insert mode.
You can insert text multiple times by passing a count parameter before entering insert mode.

**For example:** `10i`

Expand All @@ -45,22 +45,21 @@ If you type `"hello world!"` and **exit** insert mode, Vim will repeat the text

When you make a typing mistake, it can be cumbersome to type <Backspace> repeatedly. It may make more sense to go to normal mode and delete your mistake. You can also delete several characters at a time while in insert mode.

| Key | Function|
|--------|---------|
|`Ctrl-H`|Delete one character **before** the cursor.|
|`Ctrl-W`|Delete one word **before** the cursor.|
|`Ctrl-U`|Delete the entire line **before** the cursor..|
| Key | Function |
| -------- | ---------------------------------------------- |
| `Ctrl-H` | Delete one character **before** the cursor. |
| `Ctrl-W` | Delete one word **before** the cursor. |
| `Ctrl-U` | Delete the entire line **before** the cursor.. |

**Important Note**

You can't undo these deletions. However, what you've typed is still in the `.` register.


## Executing Normal Mode Command (Insert Normal Mode)

You can use `CTRL-O` to execute a **one** normal-mode command without leaving insert mode.
You can use `CTRL-O` to execute a **one** normal-mode command without leaving insert mode.

When you press `Ctrl-o`, you'll be in **insert-normal** sub-mode. If you look at mode indicator on bottom left, normally you will see `-- INSERT --`, but `Ctrl-o `will change it to `-- (insert) --`.
When you press `Ctrl-o`, you'll be in **insert-normal** sub-mode. If you look at mode indicator on bottom left, normally you will see `-- INSERT --`, but `Ctrl-o `will change it to `-- (insert) --`.

### Example 1 : Navigating while remaining in insert mode

Expand All @@ -74,4 +73,4 @@ If you're at the bottom of the screen. You can center your current position by d

If you wanted to delete a block of text from your current position to an anchor, say a comma, you can just do `Ctrl-o d t ,`

---------------------------------------------------------
---

0 comments on commit 5c9e207

Please sign in to comment.