Skip to content

Instantly share code, notes, and snippets.

@toland
Created October 26, 2020 20:46
Show Gist options
  • Save toland/082a2dd163958437e56ff5abd0b21484 to your computer and use it in GitHub Desktop.
Save toland/082a2dd163958437e56ff5abd0b21484 to your computer and use it in GitHub Desktop.
Elixir dev with Vim
" Plugins {{{
call plug#begin()
Plug '/usr/local/opt/fzf' | Plug 'junegunn/fzf.vim'
Plug 'elixir-editors/vim-elixir'
Plug 'slashmili/alchemist.vim'
Plug 'amiralies/coc-elixir', {'do': 'yarn install && yarn prepack'}
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'antoinemadec/coc-fzf'
Plug 'kassio/neoterm'
Plug 'vim-test/vim-test'
Plug 'voldikss/vim-floaterm'
call plug#end()
" }}}
" Plugin config {{{
"" coc/elixir-ls
let g:coc_global_extensions = ['coc-elixir', 'coc-diagnostic', 'coc-snippets']
"" vim-test
let test#strategy = 'neoterm' " 'floaterm'
augroup test
autocmd!
autocmd BufWrite * if test#exists() |
\ TestFile |
\ endif
augroup END
"" neoterm
let g:neoterm_autoinsert = 1
let g:neoterm_autoscroll = 1
let g:neoterm_use_relative_path = 1
let g:neoterm_default_mod = 'vert botright'
" let g:neoterm_size = '20'
"" FZF
"let g:fzf_command_prefix = 'Fzf'
let g:fzf_layout = { 'down': '~30%' }
let g:fzf_buffers_jump = 1
let g:fzf_layout = { 'window': { 'width': 0.9, 'height': 0.6 } }
let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(blue)%C(bold)%cr%C(white)"'
let $FZF_DEFAULT_OPTS='--layout=reverse --bind ctrl-a:select-all'
autocmd! FileType fzf
autocmd FileType fzf set nonu nornu
"" Floaterm
command! FZF FloatermNew fzf
"" CoC
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gr <Plug>(coc-references)
" nnoremap <silent> K :call <SID>show_documentation()<CR>
" coc-fzf
nnoremap <silent> <leader>ca :<C-u>CocFzfList diagnostics<CR>
nnoremap <silent> <leader>cb :<C-u>CocFzfList diagnostics --current-buf<CR>
nnoremap <silent> <leader>cc :<C-u>CocFzfList commands<CR>
nnoremap <silent> <leader>ce :<C-u>CocFzfList extensions<CR>
nnoremap <silent> <leader>cl :<C-u>CocFzfList location<CR>
nnoremap <silent> <leader>co :<C-u>CocFzfList outline<CR>
nnoremap <silent> <leader>cs :<C-u>CocFzfList symbols<CR>
nnoremap <silent> <leader>cS :<C-u>CocFzfList services<CR>
nnoremap <silent> <leader>cp :<C-u>CocFzfListResume<CR>
" these "Ctrl mappings" work well when Caps Lock is mapped to Ctrl
nmap <silent> t<C-n> :TestNearest<CR>
nmap <silent> t<C-f> :TestFile<CR>
nmap <silent> t<C-s> :TestSuite<CR>
nmap <silent> t<C-l> :TestLast<CR>
nmap <silent> t<C-g> :TestVisit<CR>
" }}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment