LoginSignup
5
1

More than 5 years have passed since last update.

Vimを使ってapiaryのapibファイルを快適に編集できるようにする

Last updated at Posted at 2016-12-21

今回はじめてapiaryを使ってAPIドキュメントの作成をやっています。
API Blueprint 記法を学びながらわりと快適に作業していたのですが、問題発生。

発生した問題

  • 途中からapiraryのオンラインエディタのvalidationが遅すぎて死んだ
  • apiaryの一時的な接続問題か、ブラウザの問題かはわからないが
  • しかし、編集するたびにvalidateされるのはうっとうしい
  • apiaryのvalidationをdisableする手段が現状ない
  • ので、ローカルで編集してpushする方法に切り替えることにした

apiblueprint.vim導入

API Blueprintのシンタックスハイライトとlintチェックをやってくださるプラグイン。

依存関係のsyntasticをインスコ

Vim周りのいろんなシンタックスチェックをがんばってくれるプラグイン。

call dein#add('vim-syntastic/syntastic')

set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*

let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0

依存関係のdrafterをインスコ

API Blueprintのvalidationを手伝ってくれるコマンドラインツール。

$ brew install --HEAD \
  https://raw.github.com/apiaryio/drafter/master/tools/homebrew/drafter.rb

おまちかねのapiblueprint.vimをインスコ

call dein#add('kylef/apiblueprint.vim')

便利なTagbarもインスコ

クラスとか関数のoutlineを表示してくれるプラグイン。

依存関係のExuberant ctags 5.5をインスコ

$ brew install ctags-exuberant
call dein#add('majutsushi/tagbar')

nmap <F8> :TagbarToggle<CR>
nmap <F9> :TagbarShowTag<CR>

apiblueprint.vimはjsonの構文チェックしてくれないのでvim-jsonもインスコ

jsonのシンタックスハイライト、構文チェックしてくれる。jsonの可読性をあげるconcealing機能が超いい。

call dein#add('elzr/vim-json')

以上。

ごにょごにょ作業に時間食ったが、快適に過ごせそう〜

5
1
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
5
1