translated

This commit is contained in:
geekpi 2018-06-12 07:09:16 +08:00
parent b76653991c
commit 7b02fdaad8
2 changed files with 132 additions and 135 deletions

View File

@ -1,135 +0,0 @@
translating---geekpi
A CLI Game To Learn Vim Commands
======
![](https://www.ostechnix.com/wp-content/uploads/2018/05/PacVim-720x340.png)
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. PacVim is inspired by the classic game [**PacMan**][1] 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**][2] (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 perfectly.
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.
![][4]
To begin the game, just press **ENTER**.
![][5]
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 is 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:**
And, thats all for now. Hope this was useful. Playing PacVim is fun, interesting and keep you occupied. At the same time, you should be able to thoroughly learn the enough Vim commands. Give it a try, you wont be disappointed.
More good stuffs to come. Stay tuned!
Cheers!
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/pacvim-a-cli-game-to-learn-vim-commands/
作者:[SK][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.ostechnix.com/author/sk/
[1]:https://en.wikipedia.org/wiki/Pac-Man
[2]:https://www.ostechnix.com/getting-started-pacman/
[4]:http://www.ostechnix.com/wp-content/uploads/2018/05/pacvim-1.png
[5]:http://www.ostechnix.com/wp-content/uploads/2018/05/pacvim-2.png

View File

@ -0,0 +1,132 @@
一个学习 vim 命令的命令行游戏
======
![](https://www.ostechnix.com/wp-content/uploads/2018/05/PacVim-720x340.png)
你好Vim用户今天我偶然发现了一个很酷的程序来提高 Vim 的使用技巧。Vim 是编写和编辑代码的绝佳编辑器。然而,你们中的一些人(包括我)仍陡峭的学习曲线中挣扎。再也不用了!来见 **PacVim**,一款可帮助你学习 Vim 命令的命令行游戏。PacVim 的灵感来源于经典游戏 [**PacMan**][1],它以一种好玩有趣的方式为你提供了大量的 Vim 命令练习。简而言之PacVim 是一种有趣而自由的方式来深入了解 vim 命令。请不要将 PacMan 与 [**pacman**][2] arch Linux 包管理器)混淆。 PacMan 是 20 世纪 80 年代发布的经典流行街机游戏。
在本简要指南中,我们将看到如何在 Linux 中安装和使用 PacVim。
### 安装 PacVim
首先按如下链接安装 **Ncurses** 库和**开发工具**。
请注意如果没有gcc 4.8.X 或更高版本,这款游戏可能无法正确编译和安装。我在 Ubuntu 18.04 LTS 上测试了 PacVim并且完美运行。
安装 Ncurses 和 gcc 后,运行以下命令来安装 PacVim。
```
$ git clone https://github.com/jmoon018/PacVim.git
$ cd PacVim
$ sudo make install
```
## 使用 PacVim 学习 Vim 命令
### 启动 PacVim 游戏
要玩这个游戏,只需运行:
```
$ pacvim [LEVEL_NUMER] [MODE]
```
例如,以下命令以普通模式启动游戏第 5 关。
```
$ pacvim 5 n
```
这里,**“5”** 表示等级,**“n”**表示模式。有两种模式:
* **n** 普通模式。
* **h** 困难模式。
默认模式是 h这很难
要从头开始0 级),请运行:
```
$ pacvim
```
以下是我 Ubuntu 18.04 LTS 的示例输出。
![][4]
要开始游戏,只需按下 **ENTER**.。
![][5]
现在开始游戏。阅读下一章了解如何玩。
要退出,请按下 **ESC****q**
以下命令以困难模式启动游戏第 5 关。
```
$ pacvim 5 h
```
或者,
```
$ pacvim 5
```
### 如何玩 PacVim
PacVim 的使用与 PacMan 非常相似。
你必须跑过屏幕上所有的字符,同时避免鬼魂(红色字符)。
PacVim有两个特殊的障碍
1. 你不能移动到墙壁中(黄色)。你必须使用 vim 动作来跳过它们。
2. 如果你踩着波浪字符(青色的 `~`),你就输了!
你有三条生命。每次打赢 0、3、6、9 关时你都会获得生命。总共有 10 关,从 0 到 9打赢第 9 关后,游戏重置为第 0 关,但是鬼魂速度变快。
**获胜条件**
使用 vim 命令将光标移动到字母上并高亮显示它们。所有字母都高亮显示后,你就会获胜并进入下一关。
**失败条件**
如果你碰到鬼魂(用**红色 G** 表示)或者**波浪字符**,你就会失去一条命。如果命小于 0 条,你将会输掉整个游戏。
这是实现的命令列表:
q 退出游戏h 向左移动j 向下移动k 向上移动l 向右移动w 向前移动到下一个 word 开始, W 向前移动到下一个 WORD 开始e 向前移动到下一个 word 结束, E 向前移动到下一个 WORD 结束, b 向后移动到下一个 word 开始, B 向后移动到下一个 WORD 开始,$ 移动到行的末尾0 移动到行的开始gg/1G 移动到第一行的开始,数字加 G 移动到由数字给出的行的开始G 移到最后一行的开头, ^ 移到当前行的第一个 word 1337 cheatz打赢当前关
玩过几关之后,你可能会注意到 vim 的使用有改善。一段时间后继续玩这个游戏,直到你掌握 Vim 的使用。
**建议阅读:**
今天就是这些。希望这篇文章有用。PacVim 好玩又有趣并且让你有事做。同时,你应该能够彻底学习足够的 Vim 命令。试试看,你不会感到失望。
还有更多的好东西。敬请关注!
干杯!
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/pacvim-a-cli-game-to-learn-vim-commands/
作者:[SK][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.ostechnix.com/author/sk/
[1]:https://en.wikipedia.org/wiki/Pac-Man
[2]:https://www.ostechnix.com/getting-started-pacman/
[4]:http://www.ostechnix.com/wp-content/uploads/2018/05/pacvim-1.png
[5]:http://www.ostechnix.com/wp-content/uploads/2018/05/pacvim-2.png