# 📜 Neovim/Vim Cheatsheet

# **⚡ Neovim/Vim Cheatsheet: The Lazy Developer’s Guide to Ultimate Efficiency**

### **Why Should You Even Care About Vim/Neovim?** 🤔

Let’s be honest. Learning a new tool feels like extra work, especially when your IDE already does *everything*. But hear me out—**what if you could code, navigate, and edit like a machine** without ever lifting your hands from the keyboard? No more dragging your mouse around, no more clunky UI menus—just pure, uninterrupted flow.

That’s where **Vim and Neovim** come in. These aren’t just text editors; they’re **efficiency boosters** that let you do more with **less effort**.

## **🥊 Vim vs. Neovim vs. Other Editors**

| Feature | Vim | Neovim | VS Code / IntelliJ |
| --- | --- | --- | --- |
| **Blazing Fast** | ✅ | ✅ | ❌ (Gets sluggish with plugins) |
| **Highly Customizable** | ✅ | ✅✅ (More modern) | ✅ (But GUI-based) |
| **Works Everywhere** | ✅ | ✅ | ❌ (Requires UI) |
| **LSP & Modern Features** | ❌ (Needs plugins) | ✅ (Built-in) | ✅ |
| **Mouse Required?** | ❌ (Never!) | ❌ (Never!) | ✅ (Too much 😩) |
| **Best for Keyboard Lovers?** | ✅✅✅ | ✅✅✅✅ | ❌ (Mouse is your frenemy) |

Long story short:

* **Vim** is **powerful but traditional**—great for purists.
    
* **Neovim** is Vim’s **smarter, younger sibling**, built for the modern age.
    
* **VS Code & IntelliJ** are great, but **bloated and mouse-dependent**.
    

If you’re tired of your mouse slowing you down, **this cheatsheet will help you unlock Vim/Neovim superpowers**. 🦸‍♂️

---

# **🏁 Basic Navigation** (a.k.a. "Moving Around Like a Pro")

🚨 **Pro Tip:** **Vim doesn’t use arrow keys** (well, you *can* use them, but real pros don’t). Instead, use **HJKL** to move.

| Command | Description |
| --- | --- |
| `h` | Move **left** ← |
| `l` | Move **right** → |
| `j` | Move **down** ↓ |
| `k` | Move **up** ↑ |
| `0` | Jump to **beginning** of line |
| `^` | Jump to **first non-blank** character in line |
| `$` | Jump to **end** of line |
| `gg` | Go to the **top** of the file |
| `G` | Go to the **bottom** of the file |
| `5G` | Jump to **line 5** (replace `5` with any number) |

**🎯 Challenge:**  
Try navigating through a file **without using arrow keys**. Your fingers will thank you later.

---

# **📝 Editing & Inserting (a.k.a. "Actually Writing Stuff")**

Vim has **modes**, and you start in **Normal Mode**. To type something, you need to enter **Insert Mode** first.

| Command | What it does |
| --- | --- |
| `i` | Insert **before** cursor |
| `I` | Insert at **beginning** of line |
| `a` | Append **after** cursor |
| `A` | Append at **end** of line |
| `o` | Open a new line **below** cursor |
| `O` | Open a new line **above** cursor |
| `r<char>` | Replace **single** character with `<char>` |
| `u` | **Undo** last action |
| `Ctrl + r` | **Redo** last action |
| `.` | Repeat **last action** (super useful!) |

🚀 **Speed Tip:**  
Instead of pressing `Esc` every time, **map** `jk` or `jj` to escape mode in your `vimrc` or `init.lua`.

---

# **🔍 Searching & Replacing**

Finding stuff in a file is easy with these commands:

| Command | Action |
| --- | --- |
| `/word` | Search for `word` (press `n` for next, `N` for previous) |
| `?word` | Search **backwards** for `word` |
| `:%s/old/new/g` | Replace all occurrences of `old` with `new` |
| `:%s/old/new/gc` | Replace **with confirmation** |

🔥 **Pro Trick:**  
Use `*` to search for the word under your cursor automatically.

---

# **📌 Copy, Paste, and Delete**

| Command | Action |
| --- | --- |
| `yy` | Copy **current line** |
| `3yy` | Copy **3 lines** |
| `p` | Paste **after** cursor |
| `P` | Paste **before** cursor |
| `dd` | **Delete** current line |
| `3dd` | **Delete** 3 lines |
| `d$` | Delete **from cursor to end** of line |
| `x` | Delete **character under cursor** |

📌 **Tip:** Use `"0p` to paste from **the last yank**, so deletions don’t overwrite your clipboard.

---

# **📂 Working with Files**

| Command | Action |
| --- | --- |
| `:w` | Save file |
| `:q` | Quit |
| `:q!` | Quit **without saving** |
| `:wq` or `ZZ` | Save and quit |
| `:e filename` | Open a file |
| `:saveas filename` | Save as a new file |

---

# **🖥 Splits & Windows (Multitasking Like a Pro)**

| Command | Action |
| --- | --- |
| `:split` or `:sp` | Split **horizontally** |
| `:vsplit` or `:vsp` | Split **vertically** |
| `Ctrl + w + w` | Switch between splits |
| `Ctrl + w + h/j/k/l` | Move between splits |
| `Ctrl + w + q` | Close current split |

---

# **🔥 Tabs (Because You Love Having 100 Open at Once)**

| Command | Action |
| --- | --- |
| `:tabnew` | Open a new tab |
| `:tabclose` | Close current tab |
| `:tabn` | Go to next tab |
| `:tabp` | Go to previous tab |

---

# **🚀 Git Integration (via Fugitive Plugin)**

| Command | Action |
| --- | --- |
| `:Git status` | Show Git status |
| `:Git add %` | Add current file to Git |
| `:Git commit -m "message"` | Commit changes |
| `:Git push` | Push changes |
| `:Git pull` | Pull latest changes |
| `:Gdiffsplit` | View Git diff |

---

# **🎯 Final Thoughts**

Congrats! 🎉 You now have **enough Vim/Neovim knowledge to be dangerous**.

But don’t stop here—**Vim mastery is a journey**. The more you practice, the faster and more efficient you’ll become.

💡 **Your next step?** Try using Vim/Neovim exclusively for **one full day**. It’ll feel weird at first, but by the end, you’ll be **10x more productive**. 🚀

Happy coding! 🎉
