Skip to content

Instantly share code, notes, and snippets.

@negiboudu
Created June 10, 2019 16:21
Show Gist options
  • Save negiboudu/035e7704a59bfa800bef777ade071bda to your computer and use it in GitHub Desktop.
Save negiboudu/035e7704a59bfa800bef777ade071bda to your computer and use it in GitHub Desktop.
init.vim & CocConfig
{
"suggest.enablePreview": true,
"coc.preferences.hoverTarget": "float",
"coc.preferences.diagnostic.displayByAle": true,
"languageserver": {
"elmLS": {
"command": "elm-language-server",
"args": ["--stdio"],
"filetypes": ["elm"],
"rootPatterns": ["elm.json"],
"initializationOptions": {
"runtime": "node",
"elmPath": "elm",
"elmFormatPath": "elm-format",
"elmTestPath": "elm-test"
}
}
}
}
all plug#begin()
Plug 'elmcast/elm-vim', { 'for': 'elm' }
Plug 'neoclide/coc.nvim', {'do': './install.sh nightly'}
Plug 'w0rp/ale'
call plug#end()
" elm-vim
let g:elm_format_autosave = 0
let g:elm_setup_keybinding = 0
let g:elm_jump_to_error = 0
" ale
let g:ale_fix_on_save = 1
let g:ale_set_quickfix = 1
let g:ale_sign_error = '🔥'
let g:ale_sign_warning = '⚡️'
let g:ale_echo_msg_error_str = '🔥'
let g:ale_echo_msg_warning_str = '⚡️'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
let g:ale_disable_lsp = 1
let g:ale_fixers = {
\ 'elm': ['elm-format'],
\}
let g:ale_elm_format_executable = 'elm-format'
let g:ale_elm_format_options = '--yes --elm-version=0.19'
" coc.nvim
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)
nmap <silent> gt <Plug>(coc-rename)
nnoremap <silent> gk :call <SID>show_documentation()<CR>
function! s:show_documentation()
if &filetype ==# 'vim'
execute 'h '.expand('<cword>')
else
if coc#util#has_float()
pc
else
call CocActionAsync('doHover')
endif
endif
endfunction
" use <tab> for trigger completion and navigate to the 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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment