Ⅰ. 插件描述
Snake game written in VimscriptⅡ. 基本信息
|
Ⅲ. 安装方法
使用Vundle管理器安装
在你的.vimrc下添加:Plugin 'zyedidia/vim-snake'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall
对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。
使用NeoBundle管理器安装
在你的.vimrc下添加:NeoBundle 'zyedidia/vim-snake'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall
使用VimPlug管理器安装
在你的.vimrc下添加:Plug 'zyedidia/vim-snake'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall
使用Pathogen管理器安装
在终端中运行以下命令:cd ~/.vim/bundle
git clone https://github.com/zyedidia/vim-snake
Ⅳ. 文档说明
# Vim Snake
Play ascii snake without leaving Vim! This game is written in Vimscript and allows
you to play snake from the comfort of your editor.
Control the snake with the hjkl keys (so that you can hone your vim movement
skills). Eat the apples and don't run into the wall or yourself.

Installation
You can install this plugin with your favorite plugin manager.
Vundle (for example):
Plugin 'zyedidia/vim-snake'Start the game by running :Snake.
Options
You can choose different options for the width/height of the play area:
let g:snake_rows = 20
let g:snake_cols = 50You can also choose the update time (millisecond delay between frame updates):
let g:snake_update = 125How does it work?
The game loop is run by abusing the CursorHold autocommand. If no keys are
pressed for a certain amount of time, the autocommand will be triggered. Notice
that if you hold down a key during the game, the loop stops.
You can read about this trick here.