Add Syntastic statusline

Refs #376, #639.
Closes #451.
This commit is contained in:
Kim Silkebækken 2013-08-20 16:05:56 +02:00
parent 7aee4c1dd7
commit 6baf1f8e90
2 changed files with 33 additions and 0 deletions

View File

@ -58,6 +58,11 @@
"name": "modified_indicator",
"before": " "
},
{
"exclude_modes": ["nc"],
"module": "powerline.segments.plugin.syntastic",
"name": "syntastic"
},
{
"type": "string",
"highlight_group": ["background"],

View File

@ -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