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