Home Vim PacVim – A CLI Game To Learn Vim Commands

PacVim – A CLI Game To Learn Vim Commands

By sk
Published: Updated: 7.4K views

Howdy, Vim users! Today, I stumbled upon a cool utility to sharpen your Vim usage skills. Undoubtedly, Vim is a great editor to write and edit code. However, some of you might be struggling with the steep learning curve. Not anymore! Meet PacVim, a CLI game that helps you to learn Vim commands.

PacVim 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.

Without further ado, let us see how to install and use PacVim in Linux.

Install PacVim in Linux

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

PacVim game teaches you vim commands in fun and engaging way. You must move pacman (the green cursor) to highlight each word on the gameboard while avoiding the ghosts (in red).

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 currently two modes. They are:

  • 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.

Play PacVim
Play PacVim

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:

Keyboard shortcutWhat it does
qquit the game
hmove left
jmove down
kmove up
lmove right
wmove forward to next word beginning
Wmove forward to next WORD beginning
emove forward to next word ending
Emove forward to next WORD ending
bmove backward to next word beginning
Bmove backward to next WORD beginning
$move to the end of the line
0move to the beginning of the line
gg/1Gmove to the beginning of the first line
numberGmove to the beginning of the line given by number
Gmove to the beginning of the last line
^move to the first word at the current line
&1337 cheatz (beat current level)
PacVim keyboard shortcuts

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

Conclusion

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.

Resource:

You May Also Like

4 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
Jonathan M. Billingsley November 29, 2020 - 9:02 pm

Thanks for the useful info!

Reply
Isaac Ruthven December 11, 2020 - 11:33 pm

thx u

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. By using this site, we will assume that you're OK with it. Accept Read More