17
18

More than 5 years have passed since last update.

vim プラグイン 入れ方 (dein.vimの導入方法から)

Last updated at Posted at 2019-06-02

まえおき

なんかようやくvimのプラグインの入れ方を理解できたので、それについて書いていきます。
Unix系(Mac, Linux)を使っている前提で話が進みます。

プラグインマネージャー(dein)の導入

私は「dein」を使うことにしました。(なんか他にも色んなプラグインマネージャーがあるらしい)
早速入れていきましょう。
基本的にdein.vimに書いてある通りにやります。英語がわからん人のために、やり方をここにも書いておきます。

(1) 下のスクリプトを端末(コマンドプロンプト、ターミナル)で走らせろ

これと
curl https://raw.githubusercontent.com/Shougo/dein.vim/master/bin/installer.sh > installer.sh

これ
sh ./installer.sh ~/.cache/dein

を走らせると、deinがpcに入ります。場所は上にも書いてありますが、~/.cache/deinです。
隠しファイルも見える設定にしないと多分見えません。

(2) ~/.vimrcに下の内容を書け

vim ~/.vimrcと端末に打ち込んで、中にこれをコピペしましょう。

if &compatible
  set nocompatible
endif
" Add the dein installation directory into runtimepath
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/dein.vim

if dein#load_state('~/.cache/dein')
  call dein#begin('~/.cache/dein')

  call dein#add('~/.cache/dein/repos/github.com/Shougo/dein.vim')
  call dein#add('Shougo/deoplete.nvim')
  if !has('nvim')
    call dein#add('roxma/nvim-yarp')
    call dein#add('roxma/vim-hug-neovim-rpc')
  endif

  call dein#end()
  call dein#save_state()
endif

filetype plugin indent on
syntax enable

「えぇ〜!? もう中にちょっとした設定書いちゃっただよ〜…」って人は、その設定の上側にこれを置いてください。多分大丈夫です。僕のは動きました。僕のは。

(3) vimを開いて下のを打ってね

:call dein#install()って打ちます。これでdeinの導入、初期設定は終わりです。お疲れやまでした。

プラグインの導入

ぼくはここで引っかかりました。(アホなので)
とても簡単です。~/.vimrc をまた開いてください。そこに、

if &compatible
  set nocompatible
endif
" Add the dein installation directory into runtimepath
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/dein.vim

if dein#load_state('~/.cache/dein')
  call dein#begin('~/.cache/dein')

  call dein#add('~/.cache/dein/repos/github.com/Shougo/dein.vim')
  call dein#add('Shougo/deoplete.nvim')
  if !has('nvim')
    call dein#add('roxma/nvim-yarp')
    call dein#add('roxma/vim-hug-neovim-rpc')

   " ここに call dein#add('[入れたいプラグインのurl]') って入れてくだけ

  endif

  call dein#end()
  call dein#save_state()
endif

filetype plugin indent on
syntax enable

ね?簡単でしょう?
ちなみにdeinはGitHubのものなら、https://github.com/ は省略できます。
つまり、Hogeさんのhuga.vimってプラグインを入れたいときは、
call dein#add('Hoge/huga.vim)ってな感じで追加してあげれば良い。便利^〜

入れたいプラグインを記述したら、保存して、vimに
:call dein#install()って打ち込みましょう。これで導入されます。やったあ!!

終わりに

単純に入れ方を雑に説明しただけなので、フォルダがどうなってる〜、とか、これこれこういうプラグイン入れると良いよ〜、っていうような内容は他のサイトにお任せします。(僕には何もわからないので)
プラグイン導入に詰まってしまった、僕みたいな人が救済されるといいなって思います。
では!!

17
18
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
17
18