LoginSignup
5
5

More than 3 years have passed since last update.

neovim インストールから使えるようにする

Posted at

neovim インストールから使えるようにする

はじめに

再インストールついでに駆け出しさん向けに手順を残しておくことにしました。

手順

  1. neovim インストール
  2. viコマンドをaliasで置き換え
  3. 初期設定
    1. init.vim の編集
    2. dein.toml の編集
    3. dein_lazy.toml の編集

neovim インストール

brew install neovim

viコマンドをaliasで置き換え

echo alias vi=`which nvim` >> .bash_profile

vim も置き換えるなら要領は同じ

初期設定

init.vim

mkdir -p ~/.config/nvim
cd ~/.config/nvim
vi init.vim
~/.config/nvim/init.vim
set fenc=utf-8
set noswapfile
set autoread
set showcmd

set number
set cursorline
set cursorcolumn
set virtualedit=onemore
set smartindent
set showmatch
set statusline=2

set wildmode=list:longest

nnoremap j gj
nnoremap k gk

set list listchars=tab:\▸\-
set expandtab
set tabstop=2
set shiftwidth=2

set ignorecase
set smartcase
set incsearch
set wrapscan
set hlsearch
nmap <Esc><Esc> :nohlsearch<CR><Esc>

if &compatible
  set nocompatible
endif
" Add the dein installation directory into runtimepath
set runtimepath+=~/.cache/dein/repos/github.com/Shougo/dein.vim

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

  call dein#add('~/.cache/dein/repos/github.com/Shougo/dein.vim')
  call dein#add('Shougo/deoplete.nvim')
  if !has('nvim')
    call dein#add('roxma/nvim-yarp')
    call dein#add('roxma/vim-hug-neovim-rpc')
  endif

  " toml
  call dein#load_toml('~/.config/nvim/dein.toml', {'lazy':0})
  call dein#load_toml('~/.config/nvim/dein_lazy.toml', {'lazy':0})

  " auto install
  if dein#check_install()
    call dein#install()
  endif

  call dein#end()
  call dein#save_state()
endif

filetype plugin indent on
syntax enable

colorscheme molokai
  • プラグインの管理は、tomlファイルに
  • 起動時にプラグインを自動インストール

dein.toml < 起動時に読み込みたいプラグインはこっち

~/.config/nvim/dein.toml
[[plugins]]
repo = 'cespare/vim-toml'

[[plugins]]
repo = 'tomasr/molokai'

dein_lazy.toml < 条件成立時に読み込みたいプラグインはこっち

~/.config/nvim/dein_lazy.toml
[[plugins]]
repo = 'haya14busa/dein-command.vim'
on_cmd = 'Dein'

参考にさせていただいた記事

NeoVim と dein.vim を使ってみる!
https://github.com/Shougo/dein.vim
Neovim の設定を綺麗に整理してみた
何も考えず~/.vimrcにこれを書くんだ! 〜vim初心者によるvim初心者のためのvim入門〜

5
5
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
5
5