7
7

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.

mac mini (macOS Mojave)にてNeovim環境の構築

Posted at

1. はじめに

プログラミングでコードを書くときに使用するエディタ。私はコンピュータのアプリケーションの中で最も使用頻度の高いのはテキストエディタであり、そこに対する環境整備が業務を行う上で最も重要であると考えます。
最近Visual Studio Codeを使う方が多いですね。gitと連動するし、Microsoftが出しているだけあって、色々と連携機能が充実しているんでしょうか。

しかしながら、私はvimを多用しております。理由は、リモートで作業することが多く、GUI環境に慣れてしまうと作業効率が落ちてしまうと感じているからです。(実際にはどうかわかりませんが。)

今回は、vimにおける環境の構築を行っていきます。

2. 目次

1. はじめに
2. 目次
3. vimとは
4. deinとは
5. Neovimのインストール(Homebrew編)
6. 環境ファイルの整備(vim.initとか)
7. deinのインストール
8. エラーの確認
9. coc extensionsについて
10. おわりに

3. vimとは

(ほぼWikipedia抜粋)

 vi から派生し、発展した高機能なテキストエディタです。vi(ヴィーアイ)は、Emacsと共にUNIX環境で人気があるテキストエディタで、ビル・ジョイによって開発されたものですが、Vimはオランダ人のプログラマーBram MoolenaarによってAmiga向けに開発され、のちにWindowsを含むさまざまな環境に移植されました。特にUnix系オペレーティングシステム (OS) ではEmacsと並んで広く使用されているテキストエディタとなっています。

3.1. VimはCUIで動作するテキストエディタ

 VimはGUIを必要とせずCUIでも動くため、Unix系OSに標準のエディタとして搭載されているケースが多いです。コンピュータの大容量化と高速化にともない、2000年以降のOSでは viに代わってより高機能な Vim、あるいはその機能劣化版が標準装備されるようになってきております。このため、コマンドライン上でviを実行すると代わりにVimが起動するディストリビューションが一般的となりました。

3.2. Vimは操作性が特殊

 Windows系エディタ(メモ帳など)などの他のエディタとは操作方法がまるで異なるため、一通りのテキスト編集作業ができるようになるまで慣れが必要です。しかしながら、一旦慣れてしまえばメモ帳などとは比較にならないほどのテキスト編集速度を得ることができるため、数多くのVim愛好家が存在しております。Vimの他の機能と併せて、プログラムコードやシステム設定ファイルを編集するのに特化しているため、特にプログラマーやシステム管理者に多く利用されています。

3.3. Vimの特徴はカスタマイズ性

 Vimの大きな特徴の一つとして高いカスタマイズ性を挙げられます。オリジナルのviがどんな環境でも設定なしですべての機能が利用できる万人向けのエディタだったのに対し、Vimでは設定ファイルを用いることでより個人の好みにあったエディタにカスタマイズすることができるようになっています。

3.4. Neovimにするか本家のVimにするか

 現在、派生物の中で最も精力的に開発されているプロジェクトはNeovimであり、Vimのリファクタリングプロジェクトであることから、機能的にはVimとほぼ変わらないものの、新機能の追加やもはや使われなくなった機能の削除などが行われています。GUIアーキテクチャの改善や、スクリプトの高速化、他アプリケーションへの埋め込みが容易になることが謳われているようです。

今回、私は長年使用してきた本家のVimではなく、Neovimにチャレンジしてみようと思います。

4. deinとは

プラグインマネージャです。
昔のvimのプラグインマネージャといえば、vundleかneobundleだったと思います。deinはこれらに比べると非常に高速に動作します。

今回は、環境構築にdeinを採用いたします。

5. Neovimのインストール(Homebrew編)

ではNeovimのインストールを始めていきましょう。

5.1. 事前準備

Neovimを使用する場合、環境変数の設定が必要となるようです。
以下の行を.bash_profileに追加します。
(これは各ユーザにて実行が必要です。)

~/.bash_profile
$ echo 'export XDG_CONFIG_HOME="$HOME/.config"' >> ~/.bash_profile

現在実行しているシェルに反映させましょう。

$ exec $SHELL -l

環境変数が設定されているか確認します。

$ printenv XDG_CONFIG_HOME
/Users/${USER}/.config

今回使用するプラグインcoc.nvimでは、node.jsを使用するため、node.jsをインストールします。
(anyenvをインストールしている事を前提で書きます。)

$ anyenv install nodenv
/var/folders/41/zgvgyyr923l_y69p_mv7qdsm0000gn/T/nodenv.20190914004742.37425 ~
Cloning https://github.com/nodenv/nodenv.git master to nodenv...
Cloning into 'nodenv'...
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 3731 (delta 1), reused 2 (delta 0), pack-reused 3725
Receiving objects: 100% (3731/3731), 660.01 KiB | 482.00 KiB/s, done.
Resolving deltas: 100% (2484/2484), done.
~
/opt/anyenv/envs/nodenv/plugins ~
Cloning https://github.com/nodenv/node-build.git master to node-build...
Cloning into 'node-build'...
remote: Enumerating objects: 97, done.
remote: Counting objects: 100% (97/97), done.
remote: Compressing objects: 100% (69/69), done.
remote: Total 17389 (delta 44), reused 41 (delta 13), pack-reused 17292
Receiving objects: 100% (17389/17389), 3.02 MiB | 333.00 KiB/s, done.
Resolving deltas: 100% (11205/11205), done.
~
/opt/anyenv/envs/nodenv/plugins ~
Cloning https://github.com/nodenv/nodenv-default-packages.git master to nodenv-default-packages...
Cloning into 'nodenv-default-packages'...
remote: Enumerating objects: 249, done.
remote: Counting objects: 100% (249/249), done.
remote: Compressing objects: 100% (133/133), done.
remote: Total 513 (delta 139), reused 202 (delta 105), pack-reused 264
Receiving objects: 100% (513/513), 110.34 KiB | 318.00 KiB/s, done.
Resolving deltas: 100% (260/260), done.
~
/opt/anyenv/envs/nodenv/plugins ~
Cloning https://github.com/nodenv/nodenv-vars.git master to nodenv-vars...
Cloning into 'nodenv-vars'...
remote: Enumerating objects: 211, done.
remote: Total 211 (delta 0), reused 0 (delta 0), pack-reused 211
Receiving objects: 100% (211/211), 31.82 KiB | 392.00 KiB/s, done.
Resolving deltas: 100% (76/76), done.
~

Install nodenv succeeded!
Please reload your profile (exec $SHELL -l) or open a new session.

$ exec $SHELL -l
$ nodenv install 12.10.0
Downloading node-v12.10.0-darwin-x64.tar.gz...
-> https://nodejs.org/dist/v12.10.0/node-v12.10.0-darwin-x64.tar.gz
Installing node-v12.10.0-darwin-x64...
Installed node-v12.10.0-darwin-x64 to /opt/anyenv/envs/nodenv/versions/12.10.0

nodenv: default-packages file not found
$ nodenv global 12.10.0
$ nodenv versions
* 12.10.0 (set by /opt/anyenv/envs/nodenv/version)
$ nodenv rehash
$ which node
/opt/anyenv/envs/nodenv/shims/node

さらに、ruby、pythonの各モジュールでneovimをインストールします。

ruby
$ gem install neovim
Fetching neovim-0.8.1.gem
Fetching msgpack-1.3.1.gem
Fetching multi_json-1.13.1.gem
Building native extensions. This could take a while...
Successfully installed msgpack-1.3.1
Successfully installed multi_json-1.13.1
Successfully installed neovim-0.8.1
Parsing documentation for msgpack-1.3.1
Installing ri documentation for msgpack-1.3.1
Parsing documentation for multi_json-1.13.1
Installing ri documentation for multi_json-1.13.1
Parsing documentation for neovim-0.8.1
Installing ri documentation for neovim-0.8.1
Done installing documentation for msgpack, multi_json, neovim after 0 seconds
3 gems installed
python
$ pip install neovim
Collecting neovim
  Downloading https://files.pythonhosted.org/packages/78/ec/ac9905ccab8774b64c37cdff9e08db320c349eda0ae3161aebcac83e5590/neovim-0.3.1.tar.gz
Collecting pynvim>=0.3.1 (from neovim)
  Downloading https://files.pythonhosted.org/packages/a7/53/96efef2d4ca3a031d750ff6089ec8335371a840231b76225ae5a3d9ec936/pynvim-0.3.2.tar.gz
Requirement already satisfied: msgpack>=0.5.0 in /opt/anyenv/envs/pyenv/versions/anaconda3-2019.07/lib/python3.7/site-packages (from pynvim>=0.3.1->neovim) (0.6.1)
Requirement already satisfied: greenlet in /opt/anyenv/envs/pyenv/versions/anaconda3-2019.07/lib/python3.7/site-packages (from pynvim>=0.3.1->neovim) (0.4.15)
Building wheels for collected packages: neovim, pynvim
  Building wheel for neovim (setup.py) ... done
  Stored in directory: /Users/takerulocal/Library/Caches/pip/wheels/c5/5d/ff/fd1783c0b0171c71a215b850251e36f3a70d97cead8cd86de8
  Building wheel for pynvim (setup.py) ... done
  Stored in directory: /Users/takerulocal/Library/Caches/pip/wheels/bf/06/58/afea0715f78d05dcba8fd0ff34495db97aa77ba8f46f36e069
Successfully built neovim pynvim
Installing collected packages: pynvim, neovim
Successfully installed neovim-0.3.1 pynvim-0.3.2

5.2. インストール

インストールします。Homebrewを用います。

$ brew install neovim
==> Installing dependencies for neovim: unibilium, libtermkey, libuv, libvterm, luajit and msgpack
==> Installing neovim dependency: unibilium
==> Downloading https://homebrew.bintray.com/bottles/unibilium-2.0.0.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring unibilium-2.0.0.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/unibilium/2.0.0: 63 files, 248.4KB
==> Installing neovim dependency: libtermkey
==> Downloading https://homebrew.bintray.com/bottles/libtermkey-0.22.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libtermkey-0.22.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/libtermkey/0.22: 33 files, 104.8KB
==> Installing neovim dependency: libuv
==> Downloading https://homebrew.bintray.com/bottles/libuv-1.31.0.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/d9/d99c68a335354839700616c87cdfea6635025965be5728a974ec866838d403ae?__gda__=exp=15683851
######################################################################## 100.0%
==> Pouring libuv-1.31.0.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/libuv/1.31.0: 48 files, 2.9MB
==> Installing neovim dependency: libvterm
==> Downloading https://homebrew.bintray.com/bottles/libvterm-726.mojave.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libvterm-726.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/libvterm/726: 12 files, 171.5KB
==> Installing neovim dependency: luajit
==> Downloading https://homebrew.bintray.com/bottles/luajit-2.0.5.mojave.bottle.1.tar.gz
==> Downloading from https://akamai.bintray.com/90/9093866c951b8ec11c896fa2508043081322fcd6a336e6f7710f20b39e535561?__gda__=exp=15683852
######################################################################## 100.0%
==> Pouring luajit-2.0.5.mojave.bottle.1.tar.gz
🍺  /usr/local/Cellar/luajit/2.0.5: 31 files, 1.9MB
==> Installing neovim dependency: msgpack
==> Downloading https://homebrew.bintray.com/bottles/msgpack-3.2.0.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/ab/ab771d78cc52a6cf537744a44277fdf669132fe14efa05c7772454657e0bf37d?__gda__=exp=15683852
######################################################################## 100.0%
==> Pouring msgpack-3.2.0.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/msgpack/3.2.0: 757 files, 5.2MB
==> Installing neovim
==> Downloading https://homebrew.bintray.com/bottles/neovim-0.3.8.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/6c/6cfd2fa392a29729a4bf46764efddc5462189d555d5c4910f960af2438ecf4a4?__gda__=exp=15683852
######################################################################## 100.0%
==> Pouring neovim-0.3.8.mojave.bottle.tar.gz
🍺  /usr/local/Cellar/neovim/0.3.8: 1,398 files, 19MB

確認します。

$ which nvim
/usr/local/bin/nvim

6. 環境ファイルの整備(vim.initとか)

@ShoutaWATANABE さんのdein.vimでプラグイン管理[toml] - Qiitaを参考にさせていただきました。(というかほぼそのまま。。。)

ファイルの置き場所は以下の通りです。

~/
.config/nvim
├── coc-settings.json
└── init.vim
.vim/userautoload
├── dein
│   ├── lazy.toml
│   └── plugins.toml
└── init
    ├── basic.vim
    └── mapping.vim
.vim/colors
└── Benokai.vim
~/.config/nvim/init.vim
if $compatible
  set nocompatible " Be iMproved
endif

set rtp+=~/.vim/
runtime! userautoload/init/*.vim
runtime! userautoload/dein/*.vim

let s:dein_dir = expand('~/.vim/dein')

"コマンド実行する $ git clone https://github.com/Shougo/dein.vim.git ~/.vim/dein/repos/github.com/Shougo/dein.vim
set rtp+=~/.vim/dein/repos/github.com/Shougo/dein.vim

" dein.vim がなければ github から落としてくる
if &runtimepath !~# '/dein.vim'
  if !isdirectory(s:dein_repo_dir)
    execute '!git clone https://github.com/Shougo/dein.vim' s:dein_repo_dir
  endif
  execute 'set runtimepath^=' . fnamemodify(s:dein_repo_dir, ':p')
endif

if dein#load_state(s:dein_dir)
  call dein#begin(s:dein_dir)

  call dein#load_toml('~/.vim/userautoload/dein/plugins.toml', {'lazy': 0})
  call dein#load_toml('~/.vim/userautoload/dein/lazy.toml', {'lazy': 1})

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

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

"シンタックスハイライト
syntax on

"配色設定
set t_Co=256
autocmd ColorScheme * highlight Normal ctermbg=none
autocmd ColorScheme * highlight LineNr ctermbg=none

"カラースキーマ
"http://pyoonn.hatenablog.com/entry/2014/10/04/225321
"https://github.com/benjaminwhite/Benokai
colorscheme Benokai

"配色・ハイライト設定
highlight Comment ctermfg=239
highlight Number ctermfg=09
highlight LineNr ctermfg=07
highlight Directory ctermfg=118
highlight RubyInstanceVariable ctermfg=208
highlight htmlTag ctermfg=15
highlight htmlEndTag ctermfg=15
highlight Search term=reverse ctermfg=black ctermbg=248
"補完の配色
highlight Pmenu ctermbg=239
highlight PmenuSel ctermbg=6
highlight PMenuSbar ctermbg=239

" gitgutterの色
set updatetime=250
let g:gitgutter_max_signs = 500
let g:gitgutter_map_keys = 0
let g:gitgutter_override_sign_column_highlight = 0
highlight clear SignColumn
highlight GitGutterAdd ctermfg=2
highlight GitGutterChange ctermfg=3
highlight GitGutterDelete ctermfg=1
highlight GitGutterChangeDelete ctermfg=4

"シンタックスハイライト(syntax onより前に書かない)
autocmd User Rails.view*                 NeoSnippetSource ~/.vim/snippet/ruby.rails.view.snip
autocmd User Rails.controller*           NeoSnippetSource ~/.vim/snippet/ruby.rails.controller.snip
autocmd User Rails/db/migrate/*          NeoSnippetSource ~/.vim/snippet/ruby.rails.migrate.snip
autocmd User Rails/config/routes.rb      NeoSnippetSource ~/.vim/snippet/ruby.rails.route.snip

" 奇数インデントのカラー
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd  guibg=#333333 ctermbg=235
" 偶数インデントのカラー
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=#2c2c2c ctermbg=240

"全角スペースをハイライト表示
function! ZenkakuSpace()
  highlight ZenkakuSpace cterm=reverse ctermfg=DarkMagenta gui=reverse guifg=DarkMagenta
endfunction
if has('syntax')
  augroup ZenkakuSpace
  autocmd!
  autocmd ColorScheme       * call ZenkakuSpace()
  autocmd VimEnter,WinEnter * match ZenkakuSpace / /
  augroup END
  call ZenkakuSpace()
endif
~/.vim/userautoload/dein/lazy.toml
[[plugins]]
repo = 'Shougo/denite.nvim'

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

[[plugins]]
repo = 'ujihisa/unite-colorscheme'
on_source = ['unite.vim']

[[plugins]]
repo = 'Shougo/deoplete.nvim'
hook_add = '''
  let g:deoplete#enable_at_startup = 1
  set completeopt+=noinsert
'''

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

[[plugins]]
repo = 'Shougo/neosnippet-snippets'
on_source = ['neosnippet.vim']

[[plugins]]
repo = 'othree/html5.vim'
on_ft = ['html','vue']
hook_add = '''
  let g:html5_event_handler_attributes_complete = 1
  let g:html5_rdfa_attributes_complete = 1
  let g:html5_microdata_attributes_complete = 1
  let g:html5_aria_attributes_complete = 1
'''

[[plugins]]
repo = 'vim-ruby/vim-ruby'
on_ft = ['ruby']

[[plugins]]
repo = 'tpope/vim-rails'
on_ft = ['ruby']

[[plugins]]
repo = 'alpaca-tc/vim-endwise.git'
on_ft = ['ruby']
hook_add = '''
  let g:endwise_no_mappings=1
'''

[[plugins]]
repo = 'jelera/vim-javascript-syntax'
on_ft = ['javascript']

[[plugins]]
repo = 'digitaltoad/vim-pug'
on_ft = ['pug']

[[plugins]]
repo = 'hail2u/vim-css3-syntax'
on_ft = ['css','scss','sass']

[[plugins]]
repo = 'cakebaker/scss-syntax.vim'
on_ft = ['css','scss','sass']

[[plugins]]
repo = 'slim-template/vim-slim'
on_ft = ['slim']

[[plugins]]
repo = 'posva/vim-vue'
on_ft = ['vue']

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

[[plugins]]
repo = 'plasticboy/vim-markdown'
on_ft = ['markdown']

[[plugins]]
repo = 'elzr/vim-json'
hook_add = '''
  let g:vim_json_syntax_conceal = 0
'''
on_ft = ['json']
~/.vim/userautoload/dein/plugins.toml
dfunction

  let g:vimfiler_as_default_explorer=1
  let g:vimfiler_safe_mode_by_default = 0
  let g:vimfiler_tree_leaf_icon = " "
  let g:vimfiler_tree_opened_icon = ' '
  let g:vimfiler_tree_closed_icon = ' '
  let g:vimfiler_file_icon = '- '
  let g:vimfiler_marked_file_icon = '✓ '
  let g:vimfiler_readonly_file_icon = '✗ '
  let g:vimfiler_ignore_pattern = '^\%(.git\|.DS_Store\)$'

  nnoremap fi :VimFilerBufferDir<CR>
  nnoremap fe :VimFilerExplorer  -split -winwidth=35 -toggle -no-quit<CR>
'''

[[plugins]]
repo = 'ryanoasis/vim-devicons'
hook_add = '''
  let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {}
  let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['html'] = ''
  let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['css'] = ''
  let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['md'] = ''
  let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['txt'] = ''
  let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['erb'] = ''
  let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['slim'] = ''
  let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['scss'] = ''
  let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['sass'] = ''
  let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['js'] = ''
  let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['coffee'] = ''
  let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['rb'] = ''
'''

[[plugins]]
repo = 'terryma/vim-multiple-cursors'
hook_add = '''
function! Multiple_cursors_before()
  if exists(':NeoCompleteLock')==2
    exe 'NeoCompleteLock'
  endif
endfunction
function! Multiple_cursors_after()
  if exists(':NeoCompleteUnlock')==2
    exe 'NeoCompleteUnlock'
  endif
endfunction
'''

[[plugins]]
repo = 'tpope/vim-fugitive'
hook_add = '''
  let g:airline#extensions#branch#enabled = 1
  nnoremap [fugitive]  <Nop>
  nmap <space>g [fugitive]
  nnoremap <silent> [fugitive]s :Gstatus<CR><C-w>T
  nnoremap <silent> [fugitive]a :Gwrite<CR>
  nnoremap <silent> [fugitive]c :Gcommit-v<CR>
  nnoremap <silent> [fugitive]b :Gblame<CR>
  nnoremap <silent> [fugitive]p :Gpull<CR>
  nnoremap <silent> [fugitive]d :Gdiff<CR>
  nnoremap <silent> [fugitive]m :Gmerge<CR>
'''

[[plugins]]
repo = 'airblade/vim-gitgutter'

[[plugins]]
repo = 'cohama/agit.vim'

[[plugins]]
repo = 'itchyny/vim-parenmatch'

[[plugins]]
repo = 'itchyny/vim-cursorword'


[[plugins]]
repo = 'tomtom/tcomment_vim'
hook_add = '''
  nmap ww gcc
  vmap ww gcc
  if !exists('g:tcomment_types')
      let g:tcomment_types = {}
  endif
  let g:tcomment_types['eruby'] = '<%# %s %>'
  let g:tcomment_types['erb'] = '<%# %s %>'
  let g:tcomment_types['scss'] = '/* %s */'
  let g:tcomment_types['pug'] = '// %s'
  let g:tcomment_types['toml'] = '# %s'
'''

[[plugins]]
repo = 'alvan/vim-closetag'
hook_add = '''
  let g:closetag_filenames = '*.html,*.xhtml,*.phtml,*.erb,*.php,*.vue'
'''

[[plugins]]
repo = 'mikoto2000/buffer_selector.vim'
hook_add = '''
  noremap <Space><Space> <Esc>:call buffer_selector#OpenBufferSelector()<Enter>
'''

[[plugins]]
repo = 'lilydjwg/colorizer'

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

[[plugins]]
repo = 'osyo-manga/vim-precious'

[[plugins]]
repo = 'nathanaelkane/vim-indent-guides'
hook_add = '''
  let g:indent_guides_enable_on_vim_startup=1
  let g:indent_guides_auto_colors = 0
  let g:indent_guides_exclude_filetypes = ['help', 'vimfiler']
'''

[[plugins]]
repo = 'machakann/vim-highlightedyank'
hook_add = '''
  let g:highlightedyank_highlight_duration = 200
'''

[[plugins]]
repo = 'bfredl/nvim-miniyank'
hook_add = '''
  map p <Plug>(miniyank-autoput)
  map P <Plug>(miniyank-autoPut)
'''

[[plugins]]
repo = 'junegunn/fzf'
build = './install --bin'
merged = '0'

[[plugins]]
repo = 'junegunn/fzf.vim'
depends = 'fzf'
hook_add = '''
  command! -bang -nargs=* Rg
    \ call fzf#vim#grep(
    \   'rg --line-number --no-heading '.shellescape(<q-args>), 0,
    \   fzf#vim#with_preview({'options': '--exact --reverse'}, 'right:50%:wrap'))
'''

[[plugins]]
repo = 'wakatime/vim-wakatime'

[[plugins]]
repo = 'neoclide/coc.nvim'
build = './install.sh nightly'
#hook_add = 'source ~/.config/nvim/coc-settings.json'
~/.vim/userautoload/init/basic.vim
"エンコード系
set encoding=utf-8
set fileencoding=utf-8
set termencoding=utf-8

"ファイルフォーマット
set fileformat=unix

"ビープ音を消す
set belloff=all

"スクロール時に一番下までカーソルが移動しない
set scrolloff=5

"行番号表示
set number

"行の相対表示をやめる
set norelativenumber

"backspaceの機能設定(字下げ、行末、挿入の開始点を超えて削除)
set backspace=2

"カーソルがある行をハイライト表示
set cursorline

"カーソル位置のカラムをハイライト表示しない
set nocursorcolumn

"左右のカーソル移動で行移動
set whichwrap=b,s,h,l,<,>,[,]

"swapfileを生成しない
set noswapfile

"Always display the statusline in all windows
set laststatus=2

"Always display the tabline, even if there is only one tab
set showtabline=2

"検索したワードをハイライト
set hlsearch

"モード表示をOFF
set noshowmode

" クリップボード
set clipboard&
set clipboard^=unnamedplus

"Don't autofold anything
set foldlevel=100

"対応括弧に<>を追加
set matchpairs& matchpairs+=<:>

"対応括弧をハイライト表示する
set showmatch

"対応括弧の表示秒数を3秒にする
set matchtime=3

"改行時に前の行のインデントを計測
set autoindent

"改行時に入力された行の末尾に合わせて次の行のインデントを増減する
set smartindent

"新しい行を作った時に高度な自動インデントを行う
set smarttab

"タブをスペースに変換
set expandtab

"ファイル上のタブ文字の見た目の幅
set tabstop=4

"自動インデント時に挿入されるスペース量
set shiftwidth=2

"tabを押した時に挿入されるスペース量
set softtabstop=2

"高速ターミナル接続を行う
set ttyfast

"マクロなどの途中経過を描写しない
set lazyredraw

"カーソルの形指定
set guicursor=v:block-Cursor/lCursor-blinkon0,n-i-c-ci:ver50-Cursor/lCursor,r-cr:hor20-Cursor/lCursor

"タブ、空白、改行の可視化
set list
set listchars=tab:>.,trail:_,eol:,extends:>,precedes:<,nbsp:%

"ファイルを開いたときにタブ文字があったらスペースに変換
autocmd BufNewFile,BufRead * set expandtab
autocmd BufNewFile,BufRead * retab

"ファイルタイプ
autocmd FileType vue syntax sync fromstart
autocmd FileType eruby syntax sync fromstart
autocmd BufNewFile,BufRead *.{html,htm} set filetype=html
autocmd BufNewFile,BufRead *.html.erb set filetype=html.eruby
autocmd BufNewFile,BufRead *.{pug*} set filetype=pug
autocmd BufNewFile,BufRead *.{jade*} set filetype=pug
autocmd BufRead,BufNewFile *.scss set filetype=sass
autocmd BufRead,BufNewFile *.json set filetype=json
autocmd BufRead,BufNewFile *.md set filetype=markdown
autocmd BufRead,BufNewFile *.rb set filetype=ruby
autocmd BufRead,BufNewFile *.slim set filetype=slim
autocmd BufRead,BufNewFile *.js set filetype=javascript
autocmd BufRead,BufNewFile jquery.*.js set filetype=javascript syntax=jquery
autocmd BufRead,BufNewFile *.vue setlocal filetype=vue.pug.javascript.css
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\""
~/.vim/userautoload/init/mapping.vim
"prefix
nnoremap FF <C-w>

"Escape
inoremap ff <Esc>
vnoremap ff <Esc>

"ノーマルモードで行のどこにいても改行
nnoremap <CR> A<CR><Esc>

"上スライド
nnoremap MM ddkkp

"下スライド
nnoremap mm ddp

"行複製
nnoremap tt Yp
vnoremap tt yP

"shift+dでvisualモードで単語選択
nnoremap D viw

"閉じ括弧自動保管
inoremap { {}<LEFT>
inoremap [ []<LEFT>
inoremap ( ()<LEFT>
" inoremap < <><LEFT>
inoremap " ""<LEFT>
inoremap ' ''<LEFT>

"カーソル上の単語検索
nnoremap <C-j> g*:noh<Enter>
nnoremap <C-k> g#:noh<Enter>

"ウインドウサイズ変更
"カレントウインドウの幅を増やす
nnoremap > <C-w>5>
"カレントウインドウの幅を減らす
nnoremap < <C-w>5<

"ハイライト切り替え
nnoremap <F3> :set hlsearch!<CR>

"ハイライト消す
nnoremap noh :noh<CR>

"タブリファクタリング
nnoremap tab :set expandtab<Enter>:retab<Enter>:w<Enter>

"設定ファイル読み込み
nnoremap <F5> :source ~/.config/nvim/init.vim<Enter>
nnoremap sou :source ~/.config/nvim/init.vim<Enter>


"文頭・文末
nnoremap H ^
vnoremap H ^
nnoremap L $
vnoremap L $

" fzfショートカット
nnoremap gr :Ag<CR>
~/.vim/colors/Benokai.vim
" Vim color file
" A Modified Monokai by Ben White

set background=dark
highlight clear

if exists("syntax_on")
  syntax reset
endif

let g:colors_name = "Benokai"

hi Cursor ctermfg=235 ctermbg=231 cterm=NONE guifg=#272822 guibg=#f8f8f0 gui=NONE
hi Visual ctermfg=NONE ctermbg=59 cterm=NONE guifg=NONE guibg=#49483e gui=NONE
hi CursorLine ctermfg=NONE ctermbg=237 cterm=NONE guifg=NONE guibg=#3c3d37 gui=NONE
hi CursorColumn ctermfg=NONE ctermbg=237 cterm=NONE guifg=NONE guibg=#3c3d37 gui=NONE
hi ColorColumn ctermfg=NONE ctermbg=237 cterm=NONE guifg=NONE guibg=#3c3d37 gui=NONE
hi LineNr ctermfg=102 ctermbg=237 cterm=NONE guifg=#90908a guibg=#3c3d37 gui=NONE
hi VertSplit ctermfg=241 ctermbg=241 cterm=NONE guifg=#64645e guibg=#64645e gui=NONE
hi MatchParen ctermfg=197 ctermbg=NONE cterm=underline guifg=#f92672 guibg=NONE gui=underline
hi StatusLine ctermfg=231 ctermbg=241 cterm=bold guifg=#f8f8f2 guibg=#64645e gui=bold
hi StatusLineNC ctermfg=231 ctermbg=241 cterm=NONE guifg=#f8f8f2 guibg=#64645e gui=NONE
hi Pmenu ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
hi PmenuSel ctermfg=NONE ctermbg=59 cterm=NONE guifg=NONE guibg=#49483e gui=NONE
hi IncSearch ctermfg=235 ctermbg=186 cterm=NONE guifg=#272822 guibg=#e6db74 gui=NONE
hi Search ctermfg=NONE ctermbg=NONE cterm=underline guifg=NONE guibg=NONE gui=underline
hi Directory ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
hi Folded ctermfg=242 ctermbg=235 cterm=NONE guifg=#75715e guibg=#272822 gui=NONE
hi TabLineFill term=bold cterm=bold ctermbg=0
hi Normal ctermfg=231 ctermbg=234 cterm=NONE guifg=#f8f8f2 guibg=#272822 gui=NONE
hi Boolean ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
hi Character ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
hi Comment ctermfg=242 ctermbg=NONE cterm=NONE guifg=#75715e guibg=NONE gui=NONE
hi Conditional ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
hi Constant ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
hi Define ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
hi DiffAdd ctermfg=231 ctermbg=64 cterm=bold guifg=#f8f8f2 guibg=#46830c gui=bold
hi DiffDelete ctermfg=88 ctermbg=NONE cterm=NONE guifg=#8b0807 guibg=NONE gui=NONE
hi DiffChange ctermfg=231 ctermbg=23 cterm=NONE guifg=#f8f8f2 guibg=#243955 gui=NONE
hi DiffText ctermfg=231 ctermbg=24 cterm=bold guifg=#f8f8f2 guibg=#204a87 gui=bold
hi ErrorMsg ctermfg=231 ctermbg=197 cterm=NONE guifg=#f8f8f0 guibg=#f92672 gui=NONE
hi WarningMsg ctermfg=231 ctermbg=197 cterm=NONE guifg=#f8f8f0 guibg=#f92672 gui=NONE
hi Float ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
hi Function ctermfg=148 ctermbg=NONE cterm=NONE guifg=#a6e22e guibg=NONE gui=NONE
hi Identifier ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic
hi Keyword ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
hi Label ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE
hi NonText ctermfg=238 ctermbg=NONE cterm=NONE guifg=#49483e guibg=NONE gui=NONE
hi Number ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
hi Structure ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
hi Operator ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
hi PreProc ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
hi Special ctermfg=231 ctermbg=NONE cterm=NONE guifg=#f8f8f2 guibg=NONE gui=NONE
hi SpecialKey ctermfg=236 ctermbg=None cterm=NONE guifg=#49483e guibg=#3c3d37 gui=NONE
hi Statement ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
hi StorageClass ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic
hi String ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE
hi Tag ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
hi Title ctermfg=231 ctermbg=NONE cterm=bold guifg=#f8f8f2 guibg=NONE gui=bold
hi Todo ctermfg=95 ctermbg=NONE cterm=inverse,bold guifg=#75715e guibg=NONE gui=inverse,bold
hi Type ctermfg=148 ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
hi Underlined ctermfg=NONE ctermbg=NONE cterm=underline guifg=NONE guibg=NONE gui=underline
hi rubyClass ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
hi rubyFunction ctermfg=148 ctermbg=NONE cterm=NONE guifg=#a6e22e guibg=NONE gui=NONE
hi rubyInterpolationDelimiter ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
hi rubySymbol ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
hi rubyConstant ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic
hi rubyStringDelimiter ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE
hi rubyBlockParameter ctermfg=208 ctermbg=NONE cterm=NONE guifg=#fd971f guibg=NONE gui=italic
hi rubyInstanceVariable ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
hi rubyInclude ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
hi rubyGlobalVariable ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
hi rubyRegexp ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE
hi rubyRegexpDelimiter ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE
hi rubyEscape ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
hi rubyControl ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
hi rubyClassVariable ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
hi rubyOperator ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
hi rubyException ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
hi rubyPseudoVariable ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
hi rubyRailsUserClass ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic
hi rubyRailsARAssociationMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
hi rubyRailsARMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
hi rubyRailsRenderMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
hi rubyRailsMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
hi erubyDelimiter ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
hi erubyComment ctermfg=95 ctermbg=NONE cterm=NONE guifg=#75715e guibg=NONE gui=NONE
hi erubyRailsMethod ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
hi htmlH1 ctermfg=197 ctermbg=NONE cterm=NONE guifg=#67930f guibg=NONE gui=NONE
hi htmlH2 ctermfg=148 ctermbg=NONE cterm=NONE guifg=#67930f guibg=NONE gui=NONE
hi htmlH3 ctermfg=81 ctermbg=NONE cterm=NONE guifg=#67930f guibg=NONE gui=NONE
hi htmlH4 ctermfg=81 ctermbg=NONE cterm=NONE guifg=#67930f guibg=NONE gui=NONE
hi htmlH5 ctermfg=81 ctermbg=NONE cterm=NONE guifg=#67930f guibg=NONE gui=NONE
hi htmlH6 ctermfg=81 ctermbg=NONE cterm=NONE guifg=#67930f guibg=NONE gui=NONE
hi htmlTag ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
hi htmlEndTag ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
hi htmlTagName ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
hi htmlArg ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
hi htmlSpecialChar ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
hi javaScriptFunction ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=italic
hi javaScriptRailsFunction ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
hi javaScriptBraces ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
hi yamlKey ctermfg=197 ctermbg=NONE cterm=NONE guifg=#f92672 guibg=NONE gui=NONE
hi yamlAnchor ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
hi yamlAlias ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
hi yamlDocumentHeader ctermfg=186 ctermbg=NONE cterm=NONE guifg=#e6db74 guibg=NONE gui=NONE
hi cssURL ctermfg=208 ctermbg=NONE cterm=NONE guifg=#fd971f guibg=NONE gui=italic
hi cssFunctionName ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
hi cssColor ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
hi cssPseudoClassId ctermfg=148 ctermbg=NONE cterm=NONE guifg=#a6e22e guibg=NONE gui=NONE
hi cssClassName ctermfg=148 ctermbg=NONE cterm=NONE guifg=#a6e22e guibg=NONE gui=NONE
hi cssValueLength ctermfg=141 ctermbg=NONE cterm=NONE guifg=#ae81ff guibg=NONE gui=NONE
hi cssCommonAttr ctermfg=81 ctermbg=NONE cterm=NONE guifg=#66d9ef guibg=NONE gui=NONE
hi cssBraces ctermfg=NONE ctermbg=NONE cterm=NONE guifg=NONE guibg=NONE gui=NONE
~/.config/nvim/coc-settins.json
{
  /* "coc.preferences.hoverTarget": "echo", */
  /* "coc.preferences.enableFloatHighlight": false, */
  "coc.preferences.formatOnType": true,
  "coc.preferences.formatOnSaveFiletypes": ["go", "typescript", "json", "jsonc"],
  "suggest.timeout": 5000,
  "prettier.printWidth": 160,
  "prettier.singleQuote": true,
  "codeLens.enable": true,
  "diagnostic.virtualText": true,
  "diagnostic.checkCurrentLine": true,
  "git.addGlameToVirtualText": true,
  "signature.target": "echo",
  "snippets.extends": {
    "javascriptreact": ["javascript"],
    "typescript": ["javascript"]
  },
  "list.normalMappings": {
    "<C-c>": "do:exit"
  },
  "list.insertMappings": {
    "<C-c>": "do:exit"
  },
  "languageserver": {
    "efm": {
      /* go get github.com/mattn/efm-langserver */
      /* yarn global add markdownlint-cli */
      /* pip3 install yamllint */
      "command": "efm-langserver",
      "filetypes": ["markdown", "yaml"]
    },
    "dart": {
      "command": "dart",
      "args": ["/usr/local/opt/dart/libexec/bin/snapshots/analysis_server.dart.snapshot", "--lsp"],
      "filetypes": ["dart"]
    },
    "ccls": {
      "command": "ccls",
      "filetypes": ["c", "cpp", "cuda", "objc", "objcpp"],
      "rootPatterns": ["compile_commands.json", ".ccls", ".root", ".git/"],
      "initializationOptions": {
        "cacheDirectory": "/tmp/ccls"
      }
    },
    "bash": {
      "command": "bash-language-server",
      "filetypes": ["sh"],
      "args": ["start"],
      "ignoredRootPaths": ["~"]
    }
  }
}

7. deinのインストール

以下のコマンドを実行します。

$ curl https://raw.githubusercontent.com/Shougo/dein.vim/master/bin/installer.sh > installer.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2233  100  2233    0     0   5247      0 --:--:-- --:--:-- --:--:--  5254

$ bash ./installer.sh ~/.vim/dein
Install to "/Users/takerulocal/.vim/dein/repos/github.com/Shougo/dein.vim"...

git is /usr/bin/git

Begin fetching dein...
Cloning into '/Users/takerulocal/.vim/dein/repos/github.com/Shougo/dein.vim'...
remote: Enumerating objects: 43, done.
remote: Counting objects: 100% (43/43), done.
remote: Compressing objects: 100% (29/29), done.
remote: Total 5368 (delta 18), reused 33 (delta 12), pack-reused 5325
Receiving objects: 100% (5368/5368), 1.07 MiB | 781.00 KiB/s, done.
Resolving deltas: 100% (3062/3062), done.
Done.

Please add the following settings for dein to the top of your vimrc (Vim) or init.vim (NeoVim) file:


"dein Scripts-----------------------------
if &compatible
  set nocompatible               " Be iMproved
endif

" Required:
set runtimepath+=/Users/takerulocal/.vim/dein/repos/github.com/Shougo/dein.vim

" Required:
if dein#load_state('/Users/takerulocal/.vim/dein')
  call dein#begin('/Users/takerulocal/.vim/dein')

  " Let dein manage dein
  " Required:
  call dein#add('/Users/takerulocal/.vim/dein/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')

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


Done.
Complete setup dein!

8. エラーの確認

ではNeovimを実行してエラーの確認をしていきましょう。

$ nvim
[dein] Error occurred while executing hook: coc.nvim
[dein] Vim(source):E484: ファイル "/Users/takerulocal/.config/nvim/coc-settings.json" を開けません
[dein] Not installed plugins: ['vim-markdown', 'denite.nvim', 'unite-colorscheme', 'context_filetype.vim', 'vim-css3-syntax', 'buffer_selector.vim', 'vim-airline', 'nvim-miniyank', 'unite.vim', 'vim-gitgutter', 'vim-vue', 'vim-closetag', 'vim-airline-themes', 'vim-multiple-cursors', 'agit.vim', 'colorizer', 'vim-parenmatch', 'vim-javascript-syntax', 'tcomment_vim', 'vim-cursorword', 'vim-fugitive', 'neosnippet-snippets', 'deoplete.nvim', 'vim-endwise', 'vimfiler.vim', 'vim-toml', 'vim-indent-guides', 'vim-wakatime', 'neosnippet.vim', 'vim-rails', 'coc.nvim', 'vim-precious', 'vim-json', 'fzf.vim', 'vim-highlightedyank', 'vim-ruby', 'html5.vim', 'vim-pug', 'vim-devicons', 'vim-slim', 'fzf', 'scss-syntax.vim']
[dein] Update started: (2019/09/14 00:45:08)
[dein] ( 8/42) [+++-----------------] unite.vim
[dein] (11/42) [+++++---------------] vim-closetag
[dein] (12/42) [+++++---------------] vim-airline-themes
[dein] (14/42) [++++++--------------] agit.vim
[dein] (15/42) [+++++++-------------] colorizer
[dein] (16/42) [+++++++-------------] vim-parenmatch
[dein] (17/42) [++++++++------------] vim-javascript-syntax
[dein] (18/42) [++++++++------------] tcomment_vim
[dein] (19/42) [+++++++++-----------] vim-cursorword
[dein] (20/42) [+++++++++-----------] vim-fugitive
[dein] (21/42) [++++++++++----------] neosnippet-snippets
[dein] (22/42) [++++++++++----------] deoplete.nvim
[dein] (23/42) [++++++++++----------] vim-endwise
[dein] (24/42) [+++++++++++---------] vimfiler.vim
[dein] (25/42) [+++++++++++---------] vim-toml
[dein] (26/42) [++++++++++++--------] vim-indent-guides
[dein] (27/42) [++++++++++++--------] vim-wakatime
[dein] (28/42) [+++++++++++++-------] neosnippet.vim
[dein] (29/42) [+++++++++++++-------] vim-rails
[dein] (30/42) [++++++++++++++------] coc.nvim
[dein] (31/42) [++++++++++++++------] vim-precious
[dein] (32/42) [+++++++++++++++-----] vim-json
[dein] (33/42) [+++++++++++++++-----] fzf.vim
[dein] (34/42) [++++++++++++++++----] vim-highlightedyank
[dein] (35/42) [++++++++++++++++----] vim-ruby
[dein] (36/42) [+++++++++++++++++---] html5.vim
[dein] (37/42) [+++++++++++++++++---] vim-pug
[dein] (38/42) [++++++++++++++++++--] vim-devicons
[dein] (39/42) [++++++++++++++++++--] vim-slim
[dein] (40/42) [+++++++++++++++++++-] fzf
[dein] (41/42) [+++++++++++++++++++-] scss-syntax.vim
[dein] Building: fzf
Downloading bin/fzf ...
  - Checking fzf executable ... 
0.18.0
[dein] Building: coc.nvim
[dein] Updated plugins:
[dein]   unite-colorscheme(1 change)
[dein]   buffer_selector.vim(1 change)
[dein]   nvim-miniyank(1 change)
[dein]   context_filetype.vim(1 change)
[dein]   vim-markdown(1 change)
[dein]   vim-css3-syntax(1 change)
[dein]   vim-closetag(1 change)
[dein]   vim-vue(1 change)
[dein]   vim-gitgutter(1 change)
[dein]   agit.vim(1 change)
[dein]   vim-parenmatch(1 change)
[dein]   colorizer(1 change)
[dein]   vim-multiple-cursors(1 change)
[dein]   vim-cursorword(1 change)
[dein]   vim-javascript-syntax(1 change)
[dein]   vim-airline-themes(1 change)
[dein]   denite.nvim(1 change)
[dein]   tcomment_vim(1 change)
[dein]   vim-airline(1 change)
[dein]   vim-endwise(1 change)
[dein]   neosnippet-snippets(1 change)
[dein]   vim-toml(1 change)
[dein]   vim-indent-guides(1 change)
[dein]   vim-fugitive(1 change)
[dein]   deoplete.nvim(1 change)
[dein]   vim-json(1 change)
[dein]   neosnippet.vim(1 change)
[dein]   vimfiler.vim(1 change)
[dein]   vim-highlightedyank(1 change)
[dein]   fzf.vim(1 change)
[dein]   html5.vim(1 change)
[dein]   vim-pug(1 change)
[dein]   vim-slim(1 change)
[dein]   vim-ruby(1 change)
[dein]   vim-rails(1 change)
[dein]   scss-syntax.vim(1 change)
[dein]   vim-devicons(1 change)
[dein]   fzf(1 change)
[dein]   vim-wakatime(1 change)
[dein]   vim-precious(1 change)
[dein]   unite.vim(1 change)
[dein]   coc.nvim(1 change)
[dein] Done: (2019/09/14 

起動します。

$ nvim

image.png

ここで、以下を実行します。

:CheckHealth

image.png

実行結果はこうなります。

image.png

ここで、python2については、pyenvで切り替えているため、ないのは当然です。(同居させていません。)

もし必要であれば、pyenvでpython2に切り替え、pip install neovimを実行してneovimモジュールをインストールしてください。

また、node.jsでもWARNINGが出ていますね。
こちらはメッセージに書いてある通り、npm install -g negvimを実行しましょう。

一度nvimを抜けてコンソールから以下を実行します。

$ npm install -g neovim
/opt/anyenv/envs/nodenv/versions/12.10.0/bin/neovim-node-host -> /opt/anyenv/envs/nodenv/versions/12.10.0/lib/node_modules/neovim/bin/cli.js
+ neovim@4.5.0
added 18 packages from 24 contributors in 1.117s

もう一度:CheckHealthしたら

image.png

エラーはpython2のみになりました。

9. coc extensionsについて

補完機能を担うcoc.nvimをインストールしましたが、pythonなど、さらに拡張ができるextensionファイルを導入できます。

nvim起動中に操作モードにて:CocInstall <対象名>で追加ができます。
:CocList extensionsで現在インストールされている拡張も確認することができます。

ちなみに、私が導入しているcoc extensionsは以下の通りです。

  * coc-prettier 1.1.6 ~/.config/coc/extensions/node_modules/coc-prettier                                                               
  * coc-eslint 1.2.2 ~/.config/coc/extensions/node_modules/coc-eslint
  + coc-tslint 1.0.17 ~/.config/coc/extensions/node_modules/coc-tslint
  + coc-json 1.2.3 ~/.config/coc/extensions/node_modules/coc-json
  + coc-rls 1.1.2 ~/.config/coc/extensions/node_modules/coc-rls
  + coc-tsserver 1.4.0 ~/.config/coc/extensions/node_modules/coc-tsserver
  + coc-python 1.2.6 ~/.config/coc/extensions/node_modules/coc-python

10. さいごに

実際にこれから使用してみるので、使用感とかはまだわかりません。nvimの設定や見た目など、まだまだカスタマイズしたいものがたくさんあるので、色々勉強してより良い環境を作っていきたいと思います。

また、その際にはまた環境ファイルなどを公開していきますので、どうぞよろしくお願いいたします。

11. 参考サイト

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?