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