dein.vimとは
vimのプラグイン管理ツール.NEOBUNDLEの後継版(?)
プラグインを入れようと思って色々と調べていたら,これからはdeinらしいので使ってみることにした.
Dein.vim is a dark powered Vim/Neovim plugin manager.
インストール
installer.sh
の実行権限を自分に与えたほうがいい場合も.
# インストール先は任意.ここでは~/.vim/bundlesとする
$ mkdir ~/.vim/bundles
$ cd ~/.vim/bundles
$ curl https://raw.githubusercontent.com/Shougo/dein.vim/master/bin/installer.sh > installer.sh
$ sh ./installer.sh ~/.vim/bundle
最後のコマンド後に表示される内容を~/.vimrc
に追記する.
~/.vimrc
"dein Scripts-----------------------------
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath+=~/.vim/bundles/repos/github.com/Shougo/dein.vim
" Required:
if dein#load_state('~/.vim/bundles')
call dein#begin('~/.vim/bundles')
" Let dein manage dein
" Required:
call dein#add('~/.vim/bundles/repos/github.com/Shougo/dein.vim')
" Add or remove your plugins here like this:
"call dein#add('Shougo/neosnippet.vim')
"call dein#add('Shougo/neosnippet-snippets')
" NERDTreeを使用するために以下を追記
call dein#add('scrooloose/nerdtree')
" 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-------------------------
使用方法
vimを開くと,必要なプラグインがインストールされる(?)
ノーマルモードで:NERDTreeToggle
と入力することでファイルツリーを展開できる
より使いやすく
~/.vimrc
nnoremap <C-t> :NERDTreeToggle<CR>
などと書いておくと,vimを開いているときにわざわざ:NERDTreeToggle
を入力せずともCtrl + t
で代用できる.
mapの種類
-
map a b
- aをbにマッピング.入れ子可能.
-
noremap a b
- aをbにマッピング.入れ子不可.再帰的にコマンドを実行.
-
nnoremap a b
- aをbにマッピング.入れ子不可.再帰的にコマンドを実行しない.
普通に使う分にはnnoremap
を使っておこう.
参考