🚶
neovim 2023年5月
方針
あまり、難しいプラグイン等は入っていません。
見やすいこととと自分が使いやすいようにしています。
イメージ
影響を受けた人・サイト
- https://zenn.dev/takuya/articles/4472285edbc132
- https://dev.classmethod.jp/articles/cocnvim-adventcalendar-day01/
- https://github.com/tomasiser/vim-code-dark
諦めたこと
- LSP設定難しすぎ。。cocです。
init.vim
"""""""""""""""""""""""
" plugin
"""""""""""""""""""""""
call plug#begin('~/.local/share/nvim/plugged')
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'nvim-lualine/lualine.nvim'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'lukas-reineke/indent-blankline.nvim'
Plug 'skanehira/translate.vim'
"Plug 'Yggdroot/indentLine'
"Plug 'anuvyklack/pretty-fold.nvim'
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
call plug#end()
""""""""""""""""""""""""
" filetype
""""""""""""""""""""""""
":set runtimepath+=~/.deno/bin
:set encoding=utf-8
:set fileencodings=utf-8,iso-2022-jp,euc-jp,sjis
:set fileformats=unix,dos,mac
:set nu
":set expandtab
:set ts=4
:set shiftwidth=4
:set noswapfile
:set cursorline
""""""""""""""""""""""""
" alias
""""""""""""""""""""""""
" vimrc
:command Source source ~/.config/nvim/init.vim
""""""""""""""""""""""""
" keymaps
""""""""""""""""""""""""
let g:mapleader = "\<Space>"
noremap <S-Left> <C-w><<CR>
noremap <S-Right> <C-w>><CR>
noremap <S-Up> <C-w>-<CR>
noremap <S-Down> <C-w>+<CR>
nmap te :tabedit
nmap ss :split<Return><C-w>w
nmap sv :vsplit<Return><C-w>w
map sh <C-w>h
map sk <C-w>k
map sj <C-w>j
map sl <C-w>l
nmap <C-w><left> <C-w><
nmap <C-w><right> <C-w>>
nmap <C-w><up> <C-w>+
nmap <C-w><down> <C-w>-
nmap <S-Tab> :tabprev<Return>
nmap <Tab> :tabnext<Return>
vmap t <Plug>(VTranslate)
nnoremap <F3> :cnext<Return>
nnoremap <F4> :cprev<Return>
nnoremap <Esc><Esc> :nohlsearch<CR>
""""""""""""""""""""""""
" netrw
""""""""""""""""""""""""
map sf :e.<Return>
let g:netrw_liststyle=1
" tree
"let g:netrw_liststyle = 3
" open newtab
"let g:netrw_browse_split = 3
let g:netrw_sizestyle="H"
let g:netrw_timefmt="%Y/%m/%d %H:%M:%S"
let g:netrw_banner=0
let g:netrw_preview=1
let g:netrw_altv = 1
"let g:netrw_winsize = 80
""""""""""""""""""""""
" cursor
""""""""""""""""""""""
let &t_SI .= "\e[5 q"
let &t_SR .= "\e[3 q"
let &t_EI .= "\e[1 q"
""""""""""""""""""""""
" coc snippets keymap
""""""""""""""""""""""
imap <C-l> <Plug>(coc-snippets-expand)
vmap <C-j> <Plug>(coc-snippets-select)
let g:coc_snippet_next = '<c-j>'
let g:coc_snippet_prev = '<c-k>'
imap <C-j> <Plug>(coc-snippets-expand-jump)
xmap <leader>x <Plug>(coc-convert-snippet)
inoremap <silent><expr> <TAB>
\ coc#pum#visible() ? coc#_select_confirm() :
\ coc#expandableOrJumpable() ? "\<C-r>=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\<CR>" :
\ CheckBackspace() ? "\<TAB>" :
\ coc#refresh()
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
let g:coc_snippet_next = '<tab>'
""""""""""""""""""""""
" keymap leader
""""""""""""""""""""""
" config
nnoremap <leader>. :vs ~/.config/nvim/init.vim<CR>
nnoremap <leader>/ :source ~/.config/nvim/init.vim<CR>
nnoremap <leader>+ :CocCommand snippets.editSnippets<Return>
nnoremap <leader>* :CocList snippets<Return>
" fuzzy
nnoremap <leader>zf :Files<CR>
nnoremap <leader>zl :Lines<CR>
nnoremap <leader>zb :Buffers<CR>
nnoremap <leader>zm :Marks<CR>
""""""""""""""""""""""
" terminal option
""""""""""""""""""""""
:tnoremap <Esc> <C-\><C-n>
command! -nargs=* T split | wincmd k | resize 20 | terminal <args>
autocmd TermOpen * startinsert
autocmd TermOpen * setlocal norelativenumber
autocmd TermOpen * setlocal nonumber
" debug shortcut !!
nnoremap <leader>w :T /usr/local/bin/debug /%
nnoremap <leader>W :T /usr/local/bin/debug %
":set listchars=tab:».,trail:.,space:.,extends:»,precedes:«,nbsp:%
":set list
"nnoremap <leader>li :set list<CR>
"nnoremap <leader>lI :set nolist<CR>
""""""""""""""""""""""
" colors
""""""""""""""""""""""
:colorscheme codedark
highlight Normal ctermbg=none
highlight NonText ctermbg=none
highlight LineNr ctermbg=none
highlight Folded ctermbg=none
highlight EndOfBuffer ctermbg=none
"ensure_installed = "maintained",
"
lua << END
require('lualine').setup{
options = { theme = 'powerline' }
}
require'nvim-treesitter.configs'.setup {
highlight = {
enable = true,
disable = {},
},
}
require("indent_blankline").setup {
show_current_context = true,
show_current_context_start = true,
}
END
Discussion