]> Git — Sourcephile - julm/julm-nix.git/blob - home-manager/profiles/vim/ale.vim
git: install git-absorb
[julm/julm-nix.git] / home-manager / profiles / 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 nmap gd :ALEGoToDefinition<CR>
40 nmap gm :ALECodeAction<CR>
41 "nmap <silent> <C-k> <Plug>(ale_previous_wrap)
42 "nmap <silent> <C-l> <Plug>(ale_next_wrap)
43
44 function! LinterStatus() abort
45 let l:counts = ale#statusline#Count(bufnr(''))
46 let l:all_errors = l:counts.error + l:counts.style_error
47 let l:all_non_errors = l:counts.total - l:all_errors
48 if !get(g:, 'ale_enabled', 0)
49 return ''
50 elseif index(g:ale_filetype_blacklist, &filetype) != -1
51 return ''
52 elseif ale#engine#IsCheckingBuffer(bufnr('')) == 1
53 return '...'
54 elseif l:counts.total == 0
55 return 'OK'
56 else
57 return printf('%dW %dE', all_non_errors, all_errors)
58 fi
59 endfunction
60 " Refresh the statusline
61 augroup RefreshStatusline
62 autocmd!
63 autocmd CursorHold,BufWritePost * :redrawstatus
64 autocmd User ALEJobStarted,ALELintPost :redrawstatus
65 augroup END
66
67 " Close the loclist window automatically when the buffer is closed
68 augroup CloseLoclistWindowGroup
69 autocmd!
70 autocmd QuitPre * if empty(&buftype) | lclose | endif
71 augroup END
72
73 hi ALEWarningSign ctermbg=darkyellow ctermfg=black
74 hi ALEVirtualTextError ctermfg=red
75 hi ALEVirtualTextWarning ctermfg=yellow
76 hi ALEVirtualTextInfo ctermfg=blue
77 "hi clear ALEWarning
78
79 let g:ale_completion_enabled = 0
80 "set omnifunc=ale#completion#OmniFunc
81 "au FileType haskell set omnifunc=ale#completion#OmniFunc
82
83 imap <C-p> <C-x><C-o>
84 imap <silent><expr> <TAB>
85 \ pumvisible() ? "\<C-n>" :
86 \ <SID>check_back_space() ? "\<TAB>" :
87 \ "\<C-p>"
88 function! s:check_back_space() abort
89 let col = col('.') - 1
90 return !col || getline('.')[col - 1] =~# '\s'
91 endfunction
92 let g:ale_completion_symbols = {
93 \ 'text': '',
94 \ 'method': '',
95 \ 'function': 'fun',
96 \ 'constructor': 'cons',
97 \ 'field': '',
98 \ 'variable': 'var',
99 \ 'class': 'type',
100 \ 'interface': '',
101 \ 'module': 'mod',
102 \ 'property': 'prop',
103 \ 'unit': 'unit',
104 \ 'value': 'val',
105 \ 'enum': '',
106 \ 'keyword': 'keyword',
107 \ 'snippet': '',
108 \ 'color': 'color',
109 \ 'file': '',
110 \ 'reference': 'ref',
111 \ 'folder': '',
112 \ 'enum member': '',
113 \ 'constant': '',
114 \ 'struct': '',
115 \ 'event': 'event',
116 \ 'operator': '',
117 \ 'type_parameter': 'type param',
118 \ '<default>': 'v'
119 \ }