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