-
Notifications
You must be signed in to change notification settings - Fork 100
/
vimrc.haskell
79 lines (58 loc) · 2.15 KB
/
vimrc.haskell
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
" HVN paths {{{
" stack bin path symlink
let hvn_stack_bin = expand(resolve(hvn_config_dir . "/.stack-bin"))
" Find custom built hasktags, codex etc
let $PATH = expand(hvn_stack_bin) . ':' . $PATH
" }}}
" Conceal {{{
" Use same color behind concealed unicode characters
hi clear Conceal
" Pretty unicode haskell symbols
let g:haskell_conceal_wide = 1
let g:haskell_conceal_enumerations = 1
let hscoptions="𝐒𝐓𝐄𝐌xRtB𝔻w"
" }}}
" Hoogle {{{
" Hoogle the word under the cursor
nnoremap <silent> <leader>hh :Hoogle<CR>
" Hoogle and prompt for input
nnoremap <leader>hH :Hoogle
" Hoogle for detailed documentation (e.g. "Functor")
nnoremap <silent> <leader>hi :HoogleInfo<CR>
" Hoogle for detailed documentation and prompt for input
nnoremap <leader>hI :HoogleInfo
" Hoogle, close the Hoogle window
nnoremap <silent> <leader>hz :HoogleClose<CR>
" }}}
" Formatting {{{
" Use hindent instead of par for haskell buffers
autocmd FileType haskell let &formatprg="hindent --tab-size 2 -XQuasiQuotes"
" Enable some tabular presets for Haskell
let g:haskell_tabular = 1
" Delete trailing white space on save
augroup whitespace
autocmd!
autocmd BufWrite *.hs :call DeleteTrailingWS()
augroup END
" }}}
"Completion, Syntax check, Lint & Refactor {{{
" Disable hlint-refactor-vim's default keybindings
let g:hlintRefactor#disableDefaultKeybindings = 1
" hlint-refactor-vim keybindings
map <silent> <leader>hr :call ApplyOneSuggestion()<CR>
map <silent> <leader>hR :call ApplyAllSuggestions()<CR>
" Fix path issues from vim.wikia.com/wiki/Set_working_directory_to_the_current_file
let s:default_path = escape(&path, '\ ') " store default value of 'path'
" Always add the current file's directory to the path and tags list if not
" already there. Add it to the beginning to speed up searches.
autocmd BufRead *
\ let s:tempPath=escape(escape(expand("%:p:h"), ' '), '\ ') |
\ exec "set path-=".s:tempPath |
\ exec "set path-=".s:default_path |
\ exec "set path^=".s:tempPath |
\ exec "set path^=".s:default_path
" Haskell Lint
nmap <silent> <leader>hl :Neomake hlint<CR>
" GHC errors and warnings
noremap <silent> <leader>hc :make<CR><CR>:copen<CR>
" }}}