In Day 1, we learned how to install vim, we also learned the basic navigation shortcuts of vim. Today, we will learn a few more basic vim commands.

More Navigation

some more navigation to ease up scrolling

Page Navigation

  • ^U – Go Up Half a Page (CTRL + U)
  • ^D – Go Down Half a Page (CTRL + D)

Cursor Navigation

  • zt – Put Cursor to the top
  • zb – Put Cursor to the bottom
  • zz – Put Cursor to the middle of the screen

Introducing Help – Your best vim buddy

In Normal mode you can use a command to get help. Just type :h It will open up vim’s help text. You can even search for specific help by specifying what you need, for example:

:h navigation

Vim’s help text is rich & tidy. It will help you to get a good grasp of vim’s philosophy. I highly recommend you to read through it.

Vim Operators

Now, let’s learn a few vim operators. Operators are more like commands that you can apply to objects. Below is the list of most commonly used vim operators:

  • yYank: copy the current object in the cursor position (An object could be word, line, block, etc)
  • ddelete: deletes the current object in the cursor position
  • pPaste: paste the yanked/deleted objects from the buffer
  • xremoves the objects in the cursor position.
  • cChange: deletes the object and puts it into insert mode so that you can type.

We don’t have to memorize anything! Notice how the letter speaks the operation! For example, want to change something? use c. To delete a word we will have to use d, Make sense?

That’s it for today! Let’s practice all these commands and get used to them.

🍪 Vim Cookie #1

Try the following in normal mode! Do you see anything familiar? 😉

:set number

1 comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: