parent
7aee4c1dd7
commit
6baf1f8e90
|
@ -58,6 +58,11 @@
|
|||
"name": "modified_indicator",
|
||||
"before": " "
|
||||
},
|
||||
{
|
||||
"exclude_modes": ["nc"],
|
||||
"module": "powerline.segments.plugin.syntastic",
|
||||
"name": "syntastic"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"highlight_group": ["background"],
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
# vim:fileencoding=utf-8:noet
|
||||
|
||||
import vim
|
||||
|
||||
from powerline.segments.vim import window_cached
|
||||
|
||||
|
||||
@window_cached
|
||||
def syntastic(pl):
|
||||
if not int(vim.eval('exists("g:SyntasticLoclist")')):
|
||||
return
|
||||
has_errors = int(vim.eval('g:SyntasticLoclist.current().hasErrorsOrWarningsToDisplay()'))
|
||||
if not has_errors:
|
||||
return
|
||||
errors = vim.eval('g:SyntasticLoclist.current().errors()')
|
||||
warnings = vim.eval('g:SyntasticLoclist.current().warnings()')
|
||||
segments = []
|
||||
if errors:
|
||||
segments.append({
|
||||
'contents': 'ERR: {line} ({num}) '.format(line=errors[0]['lnum'], num=len(errors)),
|
||||
'highlight_group': ['syntastic.error', 'error', 'background'],
|
||||
})
|
||||
if warnings:
|
||||
segments.append({
|
||||
'contents': 'WARN: {line} ({num}) '.format(line=warnings[0]['lnum'], num=len(warnings)),
|
||||
'highlight_group': ['syntastic.warning', 'warning', 'background'],
|
||||
})
|
||||
return segments
|
Loading…
Reference in New Issue