As developers, we all use different text editors when writing code. This post isn’t meant to say VIM is better than emacs, sublime, etc. VIM is just the editor I switched to a while back, and I wanted to go through some awesome resources that I’ve use to become a better “VIMMER.” For this post, I’m going to walk through some VIM basics that I think the beginner needs. Afterwards, I’ll walk through some great resources.
Basics to Get Started
The first thing you’re going to notice when you open VIM is that you can’t start writing code. This is because VIM has many different modes and its default mode is set-up for editing rather than writing new text. I break down two of the popular modes below:
- Command Mode: Navigate the current code in your file and run keyboard commands to edit your code. I talk about some basics below, but If you’re not currently in this mode you can just press the “ESC” key and get back to it.
- Insert Mode: Pressing the “i” key will get you in this mode. This will turn VIM into a text editor that you’re probably familiar with.
“i” – Puts VIM in Insert Mode
“x” – Deletes the char under your cursor
“:wq” – Saves and quits the file
“dd” – Deletes the current line
“p” – Pastes
Resources to Learn and Practice
According to the description on their Facebook page: “VIM Adventures is an online game based on VIM’s keyboard shortcuts. It’s the ‘Zelda-meets-text-editing’ game. So come have some fun and learn some VIM!”
From my own personal experience playing the game, its fun to play and drills the concepts.
This is VIM’s built in tutorial and my personal favorite resource for upping your VIM skills. Just type in ‘vimtutor’ on the CLI.
Use the Vimulator to see what each key on your keyboard does in VIM
Over the next few weeks, I’m going to continue writing about different technologies, so check back every Monday, Wednesday, and Friday for new tech posts! You can also visit my intro post that will have an updated list of everything I’ve written.