summary refs log tree commit diff
path: root/.vim/after/plugin/neomake.vim
blob: 1e30a7275fac83c56fd431028a3df6bdfdbe95fe (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
finish
if !exists('g:loaded_neomake')
  finish
endif

" Neomake
cnoreabbrev neom Neomake
cnoreabbrev nm Neomake
call neomake#configure#automake('w')

" \ 'BufWritePost': {'delay': 0},
let g:neomake_error_sign = {'text': '✘', 'texthl': 'NeomakeErrorSign'}
let g:neomake_warning_sign = {'text': '‼', 'texthl': 'NeomakeWarningSign'}
let g:neomake_message_sign = {'text': '☛', 'texthl': 'NeomakeMessageSign'}
let g:neomake_info_sign = {'text': 'i', 'texthl': 'NeomakeInfoSign'}

" make diagnosis-nvim match
call sign_define("LspDiagnosticsErrorSign", {"text" : copy(g:neomake_error_sign.text), "texthl" : copy(g:neomake_error_sign.texthl)})
call sign_define("LspDiagnosticsWarningSign", {"text" : copy(g:neomake_warning_sign.text), "texthl" : copy(g:neomake_warning_sign.texthl)})
call sign_define("LspDiagnosticsHintSign", {"text" : copy(g:neomake_message_sign.text), "texthl" : copy(g:neomake_message_sign.texthl)})
call sign_define("LspDiagnosticsInformationSign", {"text" : copy(g:neomake_info_sign.text), "texthl" : copy(g:neomake_info_sign.texthl)})

" let g:neomake_serialize = 1

let g:neomake_highlight_columns = 1
let g:neomake_highlight_lines = 1
let g:neomake_open_list = 0

" function! OnNeomakeJobFinished()
"   let l:ctx = g:neomake_hook_context
"   if l:ctx.jobinfo.exit_code != 0
"     echoerr l:ctx.jobinfo.maker.name . ' failed'
"   endif
" endfunction
augroup neomake_hooks
  au!
  " au User NeomakeJobFinished call OnNeomakeJobFinished()
  au BufWritePost * Neomake
augroup END

" generic makers
let g:neomake_makeclean_maker = { 'exe': 'make', 'args': ['clean'], 'errorformat': '%f:%l:%c: %m' }
let g:neomake_make_maker = { 'exe': 'make', 'errorformat': '%f:%l:%c: %m' }

nmap <leader>nm :Neomake<space>

if exists('g:loaded_lightline')
    if exists('g:lightline')
        let g:lightline.component_function.neomake = 'LightLineNeomake'
    else
        let g:lightline = {'component_function': {'neomake': 'LightLineNeomake'}}
    endif
    function! LightLineNeomake()
    let l:msg = neomake#statusline#get(bufnr('%'), {
        \ 'format_status_disabled': '{{disabled_info}} %s',
        \ 'format_status_enabled': '%s',
        \ 'format_running': '… {{running_job_names}}',
        \ 'format_loclist_ok': ' ✔',
        \ 'format_loclist_issues': '%s',
        \ 'format_loclist_unknown': '',
        \ 'format_loclist_type_E': ' ✘ {{count}}',
        \ 'format_loclist_type_W': ' ‼ {{count}}',
        \ 'format_loclist_type_I': ' i {{count}}',
        \ 'format_quickfix_type_E': '✘ {{count}}',
        \ 'format_quickfix_type_W': '‼ {{count}}',
        \ 'format_quickfix_type_I': 'i {{count}}',
    \ })
    return l:msg ? 'nm:'.l:msg : ''
    endfunction
endif

" hightlights {{{
hi SpellBad ctermfg=red guifg=red
hi SpellCap ctermfg=yellow guifg=yellow

hi link NeomakeErrorSign NeomakeError
hi link NeomakeWarningSign NeomakeWarning
hi link NeomakeMessageSign NeomakeMessage
hi link NeomakeInfoSign NeomakeInfo

hi link NeomakeVirtualtextError NeomakeError
hi link NeomakeVirtualtextWarning NeomakeWarning
hi link NeomakeVirtualtextMessage NeomakeMessage
hi link NeomakeVirtualtextInfo NeomakeInfo
" }}}