4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

vim-quickrun-qo 書いた

Last updated at Posted at 2015-04-21

vim-quickrunとは

Vim界隈ではとても有名なプラグイン。
:Quickrun するだけであらゆるソースをVim内で実行できる神プラグイン。
各部がモジュール化されていて、とても柔軟にカスタマイズができる。

qoとは

C / C++ / Objective-C のソースファイルに特殊なコメントを追加して、
実行ファイルのビルドを補助するツール。

よく知らないけど、Goコミュニティ発祥らしい。

こんな感じで書ける:

curl.c
// #qo LIBS: curl
#include <stdio.h>
#include <curl/curl.h>

int main(int argc, char const *argv[]) {
    CURL *curl = curl_easy_init();
    // CURL を使ったプログラムが続く ...
    return 0;
}

普通ならこんな感じでコンパイルする:

> gcc curl.c -lcurl
> ./a.out

しかし、qoならこうなる:

> qo
[  0%] Beginning build
[ 50%] Compiled curl.c
[100%] Linked curl
> ./curl

vim-quickrun-qoとは

vim-quickrunのhookを利用して、qoでのビルド、実行に対応させたツール。

ソースファイルの最初の10行以内に#qoディレクティブを見つけると、
:Quickrunをフックしてqoでビルドし、その場で実行する。
qoをインストールしておけば、多少複雑なビルドが必要でもVim内で作業を完結できる。

インストール方法

Neobundle.vimなりPathegonなり、好きなプラグインマネージャを使ってインストールする。

manicmaniac/vim-quickrun-qo

使用方法

何もない。インストールして#qoディレクティブを使ったC系のソースを書いて、:QuickRunするだけ。

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?