諸行無常

IT色々お勉強中のブログ

neovim deinに再挑戦

brew install neovim/neovim/neovim
curl https://raw.githubusercontent.com/Shougo/dein.vim/master/bin/installer.sh > installer.sh
sh ./installer.sh ~/.cache/dein
call dein#install()

nvim ~/.config/nvim/init.vim

set number             "行番号を表示
set autoindent         "改行時に自動でインデントする
set tabstop=2          "タブを何文字の空白に変換するか
set shiftwidth=2       "自動インデント時に入力する空白の数
set expandtab          "タブ入力を空白に変換
set splitright         "画面を縦分割する際に右に開く
set clipboard=unnamed  "yank した文字列をクリップボードにコピー
set hls                "検索した文字をハイライトする

if &compatible
  set nocompatible               " Be iMproved
endif
set runtimepath+=/Users/t/.cache/dein/repos/github.com/Shougo/dein.vim

" Required:
if dein#load_state('/Users/t/.cache/dein')
  call dein#begin('/Users/t/.cache/dein')
  call dein#load_toml('~/.config/nvim/dein.toml', {'lazy': 0})
  call dein#load_toml('~/.config/nvim/dein_lazy.toml', {'lazy': 1})
  call dein#end()
  call dein#save_state()
endif

if dein#check_install()
  call dein#install()
endif
filetype plugin indent on
syntax enable

nvim .config/nvim/dein.toml

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

[[plugins]]
repo = 'tpope/vim-endwise'

[[plugins]]
repo = 'Townk/vim-autoclose'

[[plugins]]
repo = 'joshdick/onedark.vim'
hook_add = '''
  colorscheme onedark
'''

[[plugins]]
repo = 'w0rp/ale'

[[plugins]]
repo = 'airblade/vim-gitgutter'
hook_add = '''
  source ~/.config/nvim/plugins/gitgutter.vim
'''

[[plugins]]
repo = 'tpope/vim-fugitive'
hook_add = '''
  source ~/.config/nvim/plugins/fugitive.vim
'''

[[plugins]]
repo = 'Shougo/denite.nvim'
hook_add = '''
  source ~/.config/nvim/plugins/denite.vim
'''

[[plugins]]
repo = 'osyo-manga/vim-anzu'
hook_add = '''
  source ~/.config/nvim/plugins/anzu.vim
'''

.config/nvim/plugins/anzu.vim

nmap n <Plug>(anzu-n-with-echo)
nmap N <Plug>(anzu-N-with-echo)
nmap * <Plug>(anzu-star)
nmap # <Plug>(anzu-sharp)

.config/nvim/plugins/denite.vim

nnoremap [denite] <Nop>
nmap <C-d> [denite]
nnoremap <silent> [denite]g :<C-u>Denite grep -buffer-name=search-buffer-denite<CR>
nnoremap <silent> [denite]r :<C-u>Denite -resume -buffer-name=search-buffer-denite<CR>
nnoremap <silent> [denite]p :<C-u>Denite file_rec<CR>

call denite#custom#option('default', 'prompt', '>')
call denite#custom#option('_', 'highlight_matched_range', 'None')
call denite#custom#option('_', 'highlight_matched_char', 'None')
call denite#custom#map('insert', "<Tab>", '<denite:move_to_next_line>')
call denite#custom#map('insert', "<S-Tab>", '<denite:move_to_previous_line>')
call denite#custom#map('insert', "<C-t>", '<denite:do_action:tabopen>')
call denite#custom#map('insert', "<C-v>", '<denite:do_action:vsplit>')
call denite#custom#map('normal', "v", '<denite:do_action:vsplit>')
call denite#custom#var('grep', 'command', ['pt', '--follow', '--nogroup', '--nocolor', '--hidden'])
call denite#custom#var('grep', 'default_opts', [])
call denite#custom#var('grep', 'recursive_opts', [])
call denite#custom#var('file_rec', 'command', ['pt', '--follow', '--nocolor', '--nogroup', '--hidden', '-g', ''])

.config/nvim/plugins/fugitive.vim

command Gst :Gstatus
command Gdf :Gdiff
command Gbl :Gblame<Paste>

.config/nvim/plugins/gitgutter.vim

set signcolumn=yes
set updatetime=1000

nnoremap [gitgutter] <Nop>
nmap <C-h> [gitgutter]
nmap [gitgutter]j <Plug>GitGutterNextHunk
nmap [gitgutter]k <Plug>GitGutterPrevHunk
nmap [gitgutter]u <Plug>GitGutterUndoHunk

.config/nvim/dein_lazy.toml

[[plugins]]
repo = 'Shougo/deoplete.nvim'
on_event = 'InsertEnter'
hook_add = '''
  source ~/.config/nvim/plugins/deoplete.vim
'''

.config/nvim/plugins/deoplete.vim

let g:deoplete#enable_at_startup = 1
inoremap <expr><Tab> pumvisible() ? "\<DOWN>" : "\<Tab>"
inoremap <expr><S-Tab> pumvisible() ? "\<UP>" : "\<S-Tab>"
  • なんかエラーになったので、、 normalモードで
:CheckHealth
:echo has('python3')

0ならダメ

brew install python3
pip3 install --upgrade neovim

新しいのを使う

:UpdateRemotePlugins

aleがまだ動いてない気がする、、、まぁとりあえずいっか