2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

dein.vimを使ってみる

Last updated at Posted at 2020-02-02

dein.vimとは

vimのプラグイン管理ツール.NEOBUNDLEの後継版(?)
プラグインを入れようと思って色々と調べていたら,これからはdeinらしいので使ってみることにした.

dein.vim

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を使っておこう.

参考

2
3
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
2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?