]> Git — Sourcephile - julm/julm-nix.git/blob - homes/programs/vim/ale.vim
nix: fix revamping
[julm/julm-nix.git] / homes / programs / vim / ale.vim
1 let g:ale_linters = {
2 \ 'haskell': ['hls'],
3 \}
4 let b:ale_fixers = {
5 \ 'haskell': ['hls', 'hlint']
6 \}
7 let g:ale_command_wrapper = 'nice -n5 %*'
8 let g:ale_haskell_hls_executable = 'haskell-language-server-wrapper'
9
10 let g:ale_close_preview_on_insert = 1
11 let g:ale_cursor_detail = 0
12 let g:ale_keep_list_window_open = 0
13 let g:ale_lint_delay = 200
14 let g:ale_lint_on_enter = 0
15 let g:ale_lint_on_insert_leave = 0
16 let g:ale_lint_on_save = 1
17 let g:ale_lint_on_text_changed = 'never'
18 let g:ale_list_vertical = 0
19 let g:ale_list_window_size = 5
20 let g:ale_lsp_show_message_severity = 'information'
21 let g:ale_lsp_suggestions = 1
22 let g:ale_maximum_file_size = 1000000
23 let g:ale_open_list = 1
24 let g:ale_set_balloons = 1
25 let g:ale_set_highlights = 1
26 let g:ale_set_loclist = 1
27 let g:ale_set_quickfix = 0
28 let g:ale_sign_column_always = 1
29 let g:ale_sign_error = '!!'
30 let g:ale_sign_warning = ' !'
31 let g:ale_virtualtext_cursor = 1
32 let g:ale_virtualtext_delay = 10
33
34 " Unfortunately, this does not update the loclist position
35 "nmap <silent> <C-j> :ALEPrevious<CR>
36 "nmap <silent> <C-l> :ALENext<CR>
37 nmap <silent> <C-w> :ALEPrevious -wrap -error<CR>
38 nmap <silent> <C-e> :ALENext -wrap -error<CR>
39
40 function! LinterStatus() abort
41 let l:counts = ale#statusline#Count(bufnr(''))
42 let l:all_errors = l:counts.error + l:counts.style_error
43 let l:all_non_errors = l:counts.total - l:all_errors
44 if !get(g:, 'ale_enabled', 0)
45 return ''
46 elseif index(g:ale_filetype_blacklist, &filetype) != -1
47 return ''
48 elseif ale#engine#IsCheckingBuffer(bufnr('')) == 1
49 return '...'
50 elseif l:counts.total == 0
51 return 'OK'
52 else
53 return printf('%dW %dE', all_non_errors, all_errors)
54 fi
55 endfunction
56 " Refresh the statusline
57 augroup RefreshStatusline
58 autocmd!
59 autocmd CursorHold,BufWritePost * :redrawstatus
60 autocmd User ALEJobStarted,ALELintPost :redrawstatus
61 augroup END
62
63 " Close the loclist window automatically when the buffer is closed
64 augroup CloseLoclistWindowGroup
65 autocmd!
66 autocmd QuitPre * if empty(&buftype) | lclose | endif
67 augroup END
68
69 "nmap <silent> <C-k> <Plug>(ale_previous_wrap)
70 "nmap <silent> <C-l> <Plug>(ale_next_wrap)
71
72 hi ALEWarningSign ctermbg=darkyellow ctermfg=black
73 hi ALEVirtualTextError ctermfg=red
74 hi ALEVirtualTextWarning ctermfg=yellow
75 hi ALEVirtualTextInfo ctermfg=blue
76 "hi clear ALEWarning
77
78 let g:ale_completion_enabled = 0
79 "set omnifunc=ale#completion#OmniFunc
80 "au FileType haskell set omnifunc=ale#completion#OmniFunc
81
82 imap <C-p> <C-x><C-o>
83 imap <silent><expr> <TAB>
84 \ pumvisible() ? "\<C-n>" :
85 \ <SID>check_back_space() ? "\<TAB>" :
86 \ "\<C-p>"
87 function! s:check_back_space() abort
88 let col = col('.') - 1
89 return !col || getline('.')[col - 1] =~# '\s'
90 endfunction
91 let g:ale_completion_symbols = {
92 \ 'text': '',
93 \ 'method': '',
94 \ 'function': 'fun',
95 \ 'constructor': 'cons',
96 \ 'field': '',
97 \ 'variable': 'var',
98 \ 'class': 'type',
99 \ 'interface': '',
100 \ 'module': 'mod',
101 \ 'property': 'prop',
102 \ 'unit': 'unit',
103 \ 'value': 'val',
104 \ 'enum': '',
105 \ 'keyword': 'keyword',
106 \ 'snippet': '',
107 \ 'color': 'color',
108 \ 'file': '',
109 \ 'reference': 'ref',
110 \ 'folder': '',
111 \ 'enum member': '',
112 \ 'constant': '',
113 \ 'struct': '',
114 \ 'event': 'event',
115 \ 'operator': '',
116 \ 'type_parameter': 'type param',
117 \ '<default>': 'v'
118 \ }
119
120 nmap gd :ALEGoToDefinition<CR>