quickrun.vim


Ⅰ. 插件描述

Yet, just another quickrun plugin for vim.

Ⅱ. 基本信息

创建日期:  2017-07-21
使用用户:  2
Github星:  1
插件作者:  Mike

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'mikecoder/quickrun-vim'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'mikecoder/quickrun-vim'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'mikecoder/quickrun-vim'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/mikecoder/quickrun.vim

Ⅳ. 文档说明

quickrun.vim

GitHub version
license

Yet, just another quickrun plugin for vim.

Installation

Take Vundle as an example:

  • Add Plugin 'MikeCoder/quickrun.vim' to your vimrc file.
  • Then use Vundle Install to install this plugin.

Config

In this plugin, the default run config has been set as following:

let g:quickrun_known_file_types = {
        \"cpp": ["!g++ %", "./a.out"],
        \"c": ["!gcc %", "./a.out"],
        \"php": ["!php %"],
        \"vim": ["source %"],
        \"py": ["!python %"],
    \}

These configuration means, when you edit a file with ".cpp". You will use !g++ % && ./a.out to run this file.

So, you can add your customize configuration here. If you want to use :go test command when you edit go files. You can add your config like this:

let g:quickrun_known_file_types = {
        \"cpp": ["!g++ %", "./a.out"],
        \"c": ["!gcc %", "./a.out"],
        \"php": ["!php %"],
        \"vim": ["source %"],
        \"py": ["!python %"],
        \"go": ["!go test"],
    \}

Here we use % to represent the file you currently edit.

This configuration you can write in your vimrc file.

Config with config file

You can add .quickrun file into your project folder and write your shell there. The plugin will find that file and run commands there.

For example, you can write the following commands in .quickrun

hexo clean && hexo generate && hexo server

Then, run QuickRun, you will run the command in your vim.

Usage

  1. Auto detect the filetype.
  • When you editing your file, You can run :QuickRun to run your current file.
  • If you are editting main.c file, the command will be :!gcc main.c && ./a.out.
  1. Run with spec filetype.
  • When you editing your file, you can run :QuickRunWithType go to run your current file.
  • If you are editting main.md, the command will be :!go test to test the whole go project.
  1. You can bind your key with nnoremap <F5> :QuickRun<cr> to enjoy the plugin.

License

See @LICENSE

TODO

See @TODO.md

添加新评论