Last active
June 10, 2019 16:13
-
-
Save ossan-pg/de2572427454a9ea7ae2e25fa5aab862 to your computer and use it in GitHub Desktop.
.vimrc と CocConfig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set vb t_vb= | |
set number | |
set nobackup | |
set noundofile | |
set tabstop=4 | |
set expandtab | |
set autoindent | |
set smarttab | |
set shiftwidth=4 | |
set smartindent | |
set backspace=indent,eol,start | |
set wrapscan | |
set showmatch | |
set encoding=utf-8 | |
set fileencodings=utf-8,cp932,sjis,euc-jp | |
set fileencoding=utf-8 | |
set fileformats=unix,dos | |
set fileformat=unix | |
"""""""""""""""""""""""""""""""""""""""" | |
" plug.vim | |
call plug#begin('~/.vim/plugged') | |
Plug 'elmcast/elm-vim', { 'for': 'elm' } | |
let g:elm_format_autosave = 0 | |
let g:elm_setup_keybindings = 0 | |
Plug 'antew/vim-elm-language-server' | |
Plug 'neoclide/coc.nvim', {'do': { -> coc#util#install()}} | |
call plug#end() | |
"""""""""""""""""""""""""""""""""""""""" | |
" coc.nvim | |
" refs - https://drumato.hatenablog.com/entry/2019/04/01/121139 | |
set updatetime=300 | |
" use <tab> for trigger completion and navigate to next complete item | |
function! s:check_back_space() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~ '\s' | |
endfunction | |
inoremap <silent><expr> <TAB> | |
\ pumvisible() ? "\<C-n>" : | |
\ <SID>check_back_space() ? "\<TAB>" : | |
\ coc#refresh() | |
" use <c-space>for trigger completion | |
inoremap <silent><expr> <c-space> coc#refresh() | |
" Remap keys for gotos | |
nmap <silent> gd <Plug>(coc-definition) | |
nmap <silent> gy <Plug>(coc-type-definition) | |
nmap <silent> gi <Plug>(coc-implementation) | |
nmap <silent> gr <Plug>(coc-references) | |
" Highlight symbol under cursor on CursorHold | |
autocmd CursorHold * silent call CocActionAsync('highlight') | |
" Remap for rename current word | |
nmap <leader>rn <Plug>(coc-rename) | |
" Remap for format selected region | |
vmap <leader>f <Plug>(coc-format-selected) | |
nmap <leader>f <Plug>(coc-format-selected) | |
augroup mygroup | |
autocmd! | |
" Setup formatexpr specified filetype(s). | |
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') | |
" Update signature help on jump placeholder | |
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') | |
augroup end | |
autocmd FileType json syntax match Comment +\/\/.\+$+ | |
" Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph | |
vmap <leader>a <Plug>(coc-codeaction-selected) | |
nmap <leader>a <Plug>(coc-codeaction-selected) | |
" Remap for do codeAction of current line | |
nmap <leader>ac <Plug>(coc-codeaction) | |
" Fix autofix problem of current line | |
nmap <leader>qf <Plug>(coc-fix-current) | |
" Use `:Format` for format current buffer | |
command! -nargs=0 Format :call CocAction('format') | |
autocmd BufWritePre *.elm Format | |
" Use `:Fold` for fold current buffer | |
command! -nargs=? Fold :call CocAction('fold', <f-args>) | |
"""""""""""""""""""""""""""""""""""""""" | |
" ウィンドウ位置とサイズの保存 | |
let g:save_window_file = expand('~/.vimwinpos') | |
augroup SaveWindow | |
autocmd! | |
autocmd VimLeavePre * call s:save_window() | |
function! s:save_window() | |
let options = [ | |
\ 'set columns=' . &columns, | |
\ 'set lines=' . &lines, | |
\ 'winpos ' . getwinposx() . ' ' . getwinposy(), | |
\ ] | |
call writefile(options, g:save_window_file) | |
endfunction | |
augroup END | |
if filereadable(g:save_window_file) | |
execute 'source' g:save_window_file | |
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"languageserver": { | |
"elmLS": { | |
"command": "elm-language-server.cmd", | |
"args": ["--stdio"], | |
"filetypes": ["elm"], | |
"rootPatterns": ["elm.json"], | |
"initializationOptions": { | |
"runtime": "node", | |
"elmPath": "elm", | |
"elmFormatPath": "elm-format", | |
"elmTestPath": "elm-test" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment