Skip to content

Commit

Permalink
Add Syntastic statusline
Browse files Browse the repository at this point in the history
Refs #376, #639.
Closes #451.
  • Loading branch information
Lokaltog committed Aug 20, 2013
1 parent 7aee4c1 commit 6baf1f8
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
5 changes: 5 additions & 0 deletions powerline/config_files/themes/vim/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@
"name": "modified_indicator",
"before": " "
},
{
"exclude_modes": ["nc"],
"module": "powerline.segments.plugin.syntastic",
"name": "syntastic"
},
{
"type": "string",
"highlight_group": ["background"],
Expand Down
28 changes: 28 additions & 0 deletions powerline/segments/plugin/syntastic.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 6baf1f8

Please sign in to comment.