それマグで!

知識はカップより、マグでゆっくり頂きます。 takuya_1stのブログ

習慣に早くから配慮した者は、 おそらく人生の実りも大きい。

neobundle から dein に乗り換えた

neobundle のメンテが面倒になったので

ここらで、マルっと dein に乗り換えようと思って dein に乗り換えました。

特徴

dein 乗換てよかったこと。

速い

起動速いんですね。

toml ファイルがいい

toml ファイルに設定がまとまるので、gitによる差分管理が楽になった。

インストールと初期設定

vim のインストール

macOS X

brew install vim --with-lua

debian

sudo apt install vim-nox
sudo update-alternatives --config editor

dein の準備

mkdir ~/.vim 
cd ~/.vim
curl -LJO  https://raw.githubusercontent.com/Shougo/dein.vim/master/bin/installer.sh > installer.sh
bash installer.sh ~/.cache/dein

.vimrc から dein の起動

" dein の設定とインストール
" $> cd .vimrc
" $> bash installer.sh  ~/.cache/dein
"
if isdirectory( expand('~/.cache/dein')  )
    if &compatible
        set nocompatible               " Be iMproved
    endif
    set runtimepath+=~/.cache/dein/repos/github.com/Shougo/dein.vim

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

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

       " Add or remove your plugins here:
                call dein#load_toml(expand('~/.vim/dein.plugins.toml'),       {'lazy': 0} ) "  main 
        call dein#load_toml(expand('~/.vim/dein.plugins.colors.toml'),{'lazy': 0} ) " colorscheme
        call dein#load_toml(expand('~/.vim/dein.plugins-lazy.toml'),  {'lazy': 1} ) " others for lazy 

       " You can specify revision/branch/tag.
        call dein#add('Shougo/vimshell', { 'rev': '3787e5' })

       " 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
endif

toml ファイルを書く

ぱぱっと移動させたのがこんな感じ。メモ程度にする。

[[plugins]]
repo = 'Shougo/dein.vim'

[[plugins]]
repo = 'cespare/vim-toml'
on_ft = 'toml'

[[plugins]]
repo =  'itchyny/lightline.vim'
[[plugins]]
repo = 'Shougo/neosnippet.vim'

[[plugins]]
repo = 'Shougo/neosnippet-snippets'

[[plugins]]
repo = 'Shougo/neocomplete'
hook_add = '  let g:neocomplete#enable_at_startup = 1'

[[plugins]]
repo = 'tomtom/tcomment_vim'
[[plugins]]
repo = 'Shougo/vimfiler'

[[plugins]]
repo = 'scrooloose/nerdtree'

[[plugins]]
## vim のコマンド入力でEmacsのように option で1単語ずつ移動できるように
repo = 'houtsnip/vim-emacscommandline'

[[plugins]]
repo = 'xolox/vim-misc'
[[plugins]]
repo = 'xolox/vim-colorscheme-switcher'
depends = ['misc.vim']

[[plugins]]
# カーソル位置のコンテキストに合わせてftを切り替える
repo = 'osyo-manga/vim-precious'
depends = ['context_filetype.vim']

[[plugins]]
repo = 'Shougo/context_filetype.vim'
[[plugins]]
repo = 'Shougo/neco-syntax'

#[[plugins]]
### python
repo = 'davidhalter/jedi-vim'
on_ft = 'python'

[[plugins]]
## C言語用
repo =  'Rip-Rip/clang_complete'
on_ft = ["c", "cpp"]
hook_add = '''
let g:clang_library_path="/usr/local/opt/llvm/lib"
'''

[[plugins]]
repo = 'pangloss/vim-javascript'
on_ft = ['js','javascript']

[[plugins]]
repo = 'tpope/vim-endwise'
on_ft = ['ruby']
[[plugins]]
repo = 'plasticboy/vim-markdown'
on_ft = ['md']

vim-precious 強い

toml 中にvim script 書いたら、ハイライトを切り替えてくれる vim-precious。これHTMLでも使えたりするので強い。

参考資料

https://qiita.com/delphinus/items/00ff2c0ba972c6e41542