2018年1月28日日曜日

dein.vimのインストール

ネットにも、もう十分に情報は転がっているが、忘備録的な意味も含めて書いておく。

まず新しいディレクトリを作成するため
$hiroshi-no-MacBook-Air:~ hiroshi$ mkdir ~/.cache/dein
と打ってreturnを押す。(見た目上はなにも起こらない)

で、そのあとディレクトリを移動する。
$hiroshi-no-MacBook-Air:~ hiroshi$ cd ~/.cache/dein
そこで、以下のようなコマンドを打つ。
$curl https://raw.githubusercontent.com/Shougo/dein.vim/master/bin/installer.sh > installer.sh
そうすると、こんな処理が走る。
 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2355  100  2355    0     0   6722      0 --:--:-- --:--:-- --:--:--  6747
続いて、こう打つ。
$ sh ./installer.sh ~/.cache/dein
そうすると、次のような処理が走って完了となる。
Install to "/Users/hiroshi/.cache/dein/repos/github.com/Shougo/dein.vim"...

git is /usr/bin/git

Begin fetching dein...
Cloning into '/Users/hiroshi/.cache/dein/repos/github.com/Shougo/dein.vim'...
remote: Counting objects: 4752, done.
remote: Compressing objects: 100% (78/78), done.
remote: Total 4752 (delta 51), reused 126 (delta 42), pack-reused 4607
Receiving objects: 100% (4752/4752), 934.74 KiB | 1.48 MiB/s, done.
Resolving deltas: 100% (2699/2699), done.
Done.

Please add the following settings for dein to the top of your vimrc (Vim) or init.vim (NeoVim) file:


"dein Scripts-----------------------------
if &compatible
  set nocompatible               " Be iMproved
endif

" Required:
set runtimepath+=/Users/hiroshi/.cache/dein/repos/github.com/Shougo/dein.vim

" Required:
if dein#load_state('/Users/hiroshi/.cache/dein')
  call dein#begin('/Users/hiroshi/.cache/dein')

  " Let dein manage dein
  " Required:
  call dein#add('/Users/hiroshi/.cache/dein/repos/github.com/Shougo/dein.vim')

  " Add or remove your plugins here:
  call dein#add('Shougo/neosnippet.vim')
  call dein#add('Shougo/neosnippet-snippets')

  " You can specify revision/branch/tag.
  call dein#add('Shougo/deol.nvim', { 'rev': 'a1b5108fd' })

  " Required:
  call dein#end()
  call dein#save_state()
endif

" Required:
filetype plugin indent on
syntax enable

" If you want to install not installed plugins on startup.
"if dein#check_install()
"  call dein#install()
"endif

"End dein Scripts-------------------------


Done.
Complete setup dein!

最後のコマンドを打ったあとに処理される上記の"dein Scripts-----------------------------のところから"End dein Scripts-------------------------をコピーする。
それをvimrcに貼り付けるので、以下のコマンドをうってvimrcを起動する。
$vim .vimrc
でそこにコピーした内容を貼り付け。

vimrcのほうは一度上書き保存して終了。

vimを起動したあと、ノーマルモードで

:call dein#install()
とすればインストールらしき処理が始まりcompleteという感じになる。。

で、試しに挿入モードで
div
とか打って、[control+y],と打つと
<div>
みたいに展開される。

[control+y]だけじゃなくて、そのあとに,必要!を打ち忘れてて、「展開されないなー」と少し悩んでしましまったので注意!

「control+y」を、例えば[contorol+e]とかに変更するには、.vimrcとかに
let g:user_emmet_leader_key = '< c-e >'< /c-e >
とか記述すれば、キーの対応が変わる。
参考にしたところ(主なものだけ)

0 件のコメント:

コメントを投稿