Home Command line fun PacVim – A CLI Game To Learn Vim Commands
PacVim - A CLI Game To Learn Vim Commands

PacVim – A CLI Game To Learn Vim Commands

By sk
573 Views

Howdy, Vim users! Today, I stumbled upon a cool utility to sharpen your Vim usage skills. Vim is a great editor to write and edit code. However, some of you (including me) are still struggling with the steep learning curve. Not anymore! Meet PacVim, a CLI game that helps you to learn Vim commands. It is inspired by the classic game PacMan and it gives you plenty of practice with Vim commands in a fun and interesting way. Simply put, PacVim is a fun, free way to learn about the vim commands in-depth. Please do not confuse PacMan with pacman (the Arch Linux package manager). PacMan is a classic, popular arcade game released in the 1980s.

In this brief guide, we will see how to install and use PacVim in Linux.

Install PacVim

First, install Ncurses library and development tools as described in the following links.

Please note that this game may not compile and install properly without gcc version 4.8.X or higher. I tested PacVim on Ubuntu 18.04 LTS and it worked just fine.

Once Ncurses and gcc are installed, run the following commands to install PacVim.

$ git clone https://github.com/jmoon018/PacVim.git
$ cd PacVim
$ sudo make install

Learn Vim Commands Using PacVim

Start PacVim game

To play this game, just run:

$ pacvim [LEVEL_NUMER] [MODE]

For example, the following command starts the game in 5th level with normal mode.

$ pacvim 5 n

Here, "5" represents the level and "n" represents the mode. There are two modes

  • n - normal mode.
  • h - hard mode.

The default mode is h, which is hard:

To start from the beginning (0 level), just run:

$ pacvim

Here is the sample output from my Ubuntu 18.04 LTS system.

Learn Vim Commands Using Pacvim

Learn Vim Commands Using Pacvim

To begin the game, just press ENTER.

Now start playing the game. Read the next chapter to know how to play.

To quit, press ESC or q.

The following command starts the game in 5th level with hard mode.

$ pacvim 5 h

Or,

$ pacvim 5

How to play PacVim?

The usage of PacVim is very similar to PacMan.

You must run over all the characters on the screen while avoiding the ghosts (the red color characters).

PacVim has two special obstacles:

  1. You cannot move into the walls (yellow color). You must use vim motions to jump over them.
  2. If you step on a tilde character (cyan ~), you lose!

You are given three lives. You gain a life each time you beat level 0, 3, 6, 9, etc. There are 10 levels in total, starting from 0 to 9. After beating the 9th level, the game will reset to the 0th level, but the ghosts move faster.

Winning conditions

Use vim commands to move the cursor over the letters and highlight them. After all letters are highlighted, you win and proceed to the next level.

Losing conditions

If you touch a ghost (indicated by a red G) or a tilde character, you lose a life. If you have less than 0 lives, you will lose the entire game.

Here is the list of Implemented Commands:-

key what it does
q quit the game
h move left
j move down
k move up
l move right
w move forward to next word beginning
W move forward to next WORD beginning
e move forward to next word ending
E move forward to next WORD ending
b move backward to next word beginning
B move backward to next WORD beginning
$ move to the end of the line
0 move to the beginning of the line
gg/1G move to the beginning of the first line
numberG move to the beginning of the line given by number
G move to the beginning of the last line
^ move to the first word at the current line
& 1337 cheatz (beat current level)

After playing couple levels, you may notice there is a slight improvement in Vim usage. Keep playing this game once in a while until you mastering the Vim usage.


Suggested read:


Playing PacVim is fun, interesting and keep you occupied. At the same time, you should be able to learn Vim commands thoroughly. Give it a try, you won't be disappointed.

And, that's all for now. Hope this was useful.  More good stuffs to come. Stay tuned!

Cheers!

Resource:

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

2 comments

Coolessay.net February 27, 2019 - 8:50 pm

Although Vim (short for VI Improved) is almost the most popular text editor for Linux systems, it is still difficult for users to learn, as Vim has a large variety of functions. Many Linux newbies are literally afraid to learn this powerful and highly recommended text editor. On the other hand, so much effort was directed by the sedicomm and Linux community to simplify Vim learning; from creating tutorials about Vim, sharing useful tips on using Vim, to developing interactive tutorial web applications and command line games such as PacVim.

Reply
sk February 28, 2019 - 1:54 pm

Agreed.

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

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

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More