nvim: init.vim: Update neovim config for Haskell

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
Sanchayan Maity 2019-07-04 21:43:19 +05:30
parent b714662d2a
commit 5f46b47c93
1 changed files with 56 additions and 1 deletions

View File

@ -42,6 +42,8 @@ Plug 'eraserhd/parinfer-rust', { 'do': 'cargo build --release' }
Plug 'l04m33/vlime', { 'rtp': '~/.config/nvim/plugged' }
" Haskell
Plug 'neovimhaskell/haskell-vim', { 'for': [ 'haskell', 'cabal' ] }
Plug 'parsonsmatt/intero-neovim'
Plug 'neomake/neomake'
" For autocompletion
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
" Autocomplete for Python
@ -53,7 +55,6 @@ Plug 'rust-lang/rust.vim'
Plug 'tpope/vim-surround'
Plug 'editorconfig/editorconfig-vim'
Plug 'tpope/vim-eunuch'
Plug 'azadkuh/vim-cmus'
" Initialize plugin system
call plug#end()
@ -202,11 +203,65 @@ let g:haskell_indent_guard = 2
let g:haskell_indent_case_alternative = 1
let g:cabal_indent_section = 2
augroup interoMaps
au!
" Maps for intero. Restrict to Haskell buffers so the bindings don't collide.
" Background process and window management
au FileType haskell nnoremap <silent> <leader>is :InteroStart<CR>
au FileType haskell nnoremap <silent> <leader>ik :InteroKill<CR>
" Open intero/GHCi split horizontally
au FileType haskell nnoremap <silent> <leader>io :InteroOpen<CR>
" Open intero/GHCi split vertically
au FileType haskell nnoremap <silent> <leader>iov :InteroOpen<CR><C-W>H
au FileType haskell nnoremap <silent> <leader>ih :InteroHide<CR>
" Reloading (pick one)
" Automatically reload on save
au BufWritePost *.hs InteroReload
" Manually save and reload
au FileType haskell nnoremap <silent> <leader>wr :w \| :InteroReload<CR>
" Load individual modules
au FileType haskell nnoremap <silent> <leader>il :InteroLoadCurrentModule<CR>
au FileType haskell nnoremap <silent> <leader>if :InteroLoadCurrentFile<CR>
" Type-related information
" Heads up! These next two differ from the rest.
au FileType haskell map <silent> <leader>it <Plug>InteroGenericType
au FileType haskell map <silent> <leader>T <Plug>InteroType
au FileType haskell nnoremap <silent> <leader>iit :InteroTypeInsert<CR>
" Navigation
au FileType haskell nnoremap <silent> <leader>jd :InteroGoToDef<CR>
" Managing targets
" Prompts you to enter targets (no silent):
au FileType haskell nnoremap <leader>ist :InteroSetTargets<SPACE>
augroup END
" Intero starts automatically. Set this if you'd like to prevent that.
let g:intero_start_immediately = 0
" Enable type information on hover (when holding cursor at point for ~1 second).
let g:intero_type_on_hover = 1
" Change the intero window size; default is 10.
let g:intero_window_size = 15
" Sets the intero window to split vertically; default is horizontal
let g:intero_vertical_split = 1
" OPTIONAL: Make the update time shorter, so the type info will trigger faster.
set updatetime=1000
" Use deoplete
let g:deoplete#enable_at_startup = 1
let g:deoplete#sources#rust#racer_binary='$HOME/.cargo/bin/racer'
let g:deoplete#sources#rust#rust_source_path='$HOME/GitSources/rust/src'
" Use airline
let g:airline#extensions#tabline#enabled = 2
let g:airline#extensions#tabline#fnamemod = ':t'
let g:airline#extensions#tabline#left_sep = ' '