LoginSignup
4
4

More than 5 years have passed since last update.

Vimのプラグインマネージャを乗り換えた

Posted at

はじめに

今年の年末はやや慌ただしくなる事が想定されているので、早めにvimrcの大掃除をしようと思ったのがきっかけ。
IT企業に新卒でエンジニアとして入社して以降、ずっとNeoBundleを愛用させていただいていたが、後継であるdein.vimへの移行は昨年見送っていた。自分はミニマルな機能だけで十分かなと感じていたので、この機会に"A minimalist Vim plugin manager."と銘打っているvim-plugに乗り換えてみる事にした。

vim-plugの導入

vim-plugのREADME.mdを参考に。

インストール

plug.vimを~/.vim/autoload/に配置するだけ。

installation
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

使い方

.vimrcは、以下のようにcall plug#begin()call plug#end()の間に使いたいプラグインを羅列するだけ。

.vimrc
call plug#begin('~/.vim/plugged')
Plug 'Yggdroot/indentLine'
Plug 'bronson/vim-trailing-whitespace'
call plug#end()

.vimrcを上書き保存して閉じたら、vimを起動して:PlugInstallと打てば記述したプラグインがインストールされる。
なお、vim-plugによれば、

Automatically executes filetype plugin indent on and syntax enable. You can revert the settings after the call. e.g. filetype indent off, syntax off, etc.

とのことなので、NeoBundleでは以下のように書いていたが、filetype plugin indent onsyntax enableの2行が不要になる。

.vimrc
call neobundle#begin(expand('~/.vim/bundle/'))
NeoBundle 'Yggdroot/indentLine'
NeoBundle 'bronson/vim-trailing-whitespace'
call neobundle#end()
filetype plugin indent on
syntax enable

その他

その他コマンドやオプションなど。
:PlugStatus プラグインの状態確認
:PlugUpdate プラグインの更新
:PlugUpgrade vim-plug自身の更新

プラグインの更新後に追加操作の必要なものは、下記のようにオプションを添えておけば良いとの事。ミニマルと銘打つ割にはケアが行き届いていて便利だ。

.vimrc
Plug 'Shougo/vimproc.vim', { 'do': 'make' }
Plug 'Valloric/YouCompleteMe', { 'do': './install.py' }
Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
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