きゃまメモ

(自分用のメモであったり、何かしらアップしたり)

vimでvim-plugを使う

2018.04.16
vim

インストール

# インストール
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

# vimrc設定
vim ~/.vimrc

# プラグインインストール
# vim中に
:PlugInstall

使っているvimrc

call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle'] }
Plug 'w0ng/vim-hybrid'
Plug 'Shougo/unite.vim'
Plug 'mattn/emmet-vim'
Plug 'digitaltoad/vim-pug'
Plug 'nathanaelkane/vim-indent-guides'
call plug#end()

syntax on
set nu
set tabstop=2
set expandtab
set shiftwidth=2
set background=dark
colorscheme hybrid
set backspace=indent,eol,start

set statusline=%F
set statusline+=%=
set statusline+=[enc=%{&fileencoding}]
set laststatus=2

nmap <Tab> gt
nmap <S-Tab> gT

autocmd BufNewFile,BufRead *.js setlocal ft=javascript
autocmd BufNewFile,BufRead *.ejs setlocal ft=html
autocmd BufNewFile,BufRead *.pug setlocal ft=pug
autocmd BufNewFile,BufRead *.eex setlocal ft=html
autocmd BufNewFile,BufRead *.py setlocal ft=python
autocmd BufNewFile,BufRead *.rb setlocal ft=ruby
autocmd BufNewFile,BufRead Gemfile setlocal ft=ruby
autocmd BufNewFile,BufRead *.coffee setlocal ft=coffee
autocmd BufNewFile,BufRead *.ts setlocal ft=typescript
autocmd BufNewFile,BufRead *.md setlocal ft=markdown
autocmd BufNewFile,BufRead *.jade setlocal ft=markdown
autocmd BufNewFile,BufRead *.gyp setlocal ft=json

let g:user_emmet_mode = 'iv'
autocmd FileType html imap <buffer><expr><C-E> emmet#isExpandable() ? "\<plug>(emmet-expand-abbr)" : "\<C-E>"

let g:indent_guides_enable_on_vim_startup = 1