" vim-airline settings
"""""""""""""""""""
set laststatus=2
nmap <tab> :bn<CR>
nmap <leader>x :bdelete<CR>
let g:airline_theme="luna"
let g:airline_powerline_fonts=1
let g:airline#extensions#syntastic#enabled=1
let g:airline#extensions#tabline#enabled=1
let g:airline#extensions#tagbar#enabled=1
let g:airline#extensions#ycm#enabled=1
let g:airline#extensions#capslock#enabled = 1
let g:airline#extensions#tabline#buffer_idx_mode=1
nmap <leader>1 <Plug>AirlineSelectTab1
nmap <leader>2 <Plug>AirlineSelectTab2
nmap <leader>3 <Plug>AirlineSelectTab3
nmap <leader>4 <Plug>AirlineSelectTab4
nmap <leader>5 <Plug>AirlineSelectTab5
nmap <leader>6 <Plug>AirlineSelectTab6
nmap <leader>7 <Plug>AirlineSelectTab7
nmap <leader>8 <Plug>AirlineSelectTab8
nmap <leader>9 <Plug>AirlineSelectTab9
nmap <leader>0 <Plug>AirlineSelectTab0
"""""""""""""""""""
if you are using terminal:
dosen't show the Error line number , only get E:X
but it act correctly on tag v0.8
what is the error function, that creates those?
@chrisbra Sor dude , Seems this is the plugin's bug not the airline.
not necessarily. that's why I need to know, whether you are using syntastic, or ale or neomake
@chrisbra Oh no! I got confused! This is the vim-airline BUG!!
Yesterday I pulled the lasted airline code on master branch. But it doesn't show the error line number which always shown on the left corner of vim.
U know , if there get something wrong in my code ,and syntastic will show me the error line number on the corner just like this
[Syntax: line:49 (1)]
But code on master show this
E:1
But I checkout the tag v0.8 , this can be shown correctly.
so you are using syntastic.
Does this patch work?
diff --git a/autoload/airline/extensions/syntastic.vim b/autoload/airline/extensions/syntastic.vim
index 9608ce0..01c01d2 100644
--- a/autoload/airline/extensions/syntastic.vim
+++ b/autoload/airline/extensions/syntastic.vim
@@ -22,9 +22,9 @@ function! airline#extensions#syntastic#get(type)
let _backup = get(g:, 'syntastic_stl_format', '')
let is_err = (a:type is# 'error')
if is_err
- let g:syntastic_stl_format = '%E{%e}'
+ let g:syntastic_stl_format = '%E{%e(%fe)}'
else
- let g:syntastic_stl_format = '%W{%w}'
+ let g:syntastic_stl_format = '%W{%w(%fw)}'
endif
let cnt = SyntasticStatuslineFlag()
if !empty(_backup)
@chrisbra
See this
https://github.com/vim-syntastic/syntastic/issues/2056#event-1196966285
@chrisbra Still not work
did you restart Vim?
Yes
Have you checked locally?
Yes, it took me a bit to setup Vim, but it now displays correctly E:2(L19)
No, because this is getting too wide. (You would get the same for the warning section). And when you have more vertical splits, you won't have enough space.
@chrisbra Awesome , but I guess there should have ways to personalize out put
A little ugly looks to me... LOL
I am open for suggestions ;)
I am open for suggestions ;)
How about reverting 2e30555, and messing with g:syntastic_stl_format only if it isn't already set? Something along the lines of:
let _backup = get(g:, 'syntastic_stl_format', '')
let g:syntastic_stl_format = get(g:, 'syntastic_stl_format', '%E{%e}')
let errors = SyntasticStatuslineFlag()
let g:syntastic_stl_format = _backup
return strlen(errors) ? errors : ''
(not tested).


I choose the original one.
At least, there should lay a blank space between L and 121 @chrisbra
Before commit 2e30555 the format used to be controlled by g:syntastic_stl_format. Whoever cared about syntastic statusline flag could just set g:syntastic_stl_format, and the result would be the same with or without airline. After commit 2e30555 the format is no longer configurable, regardless of how much you'd hate the defaults. _shrug_
LOL
How about reverting 2e30555, and messing with
g:syntastic_stl_formatonly if it isn't already set?
Actually that wouldn't work because syntastic sets g:syntastic_stl_format at start. So perhaps just revert 2e30555, and tell people to set g:syntastic_stl_format if they are unhappy with the defaults?
that commit was mainly done, to distinguish between errors and warnings and there didn't seem to be a pragmatic method to get only warnings/errors from syntastic. So I needed to mess with g:syntastic_stl_format to work around that.
I might have missed something, since I don't usually use syntastic.
And I'd like to have a nice short format string for the errors/warning sections
@chrisbra How about this:
At least, there should lay a blank space between L and 121
before I commit this, let's just see what follows this discussion :)
(and yes, the format of the sections should be configurable and shown in the help).
there didn't seem to be a pragmatic method to get only warnings/errors from syntastic.
Personally I use g:syntastic_stl_format = '[%E{E:%e(#%fe)}%B{,}%W{W:%w(#%fw)}]'. This gives me [E:11(#30),W:872(#1)].
Something like %E{E:%e}%B{,}%W{W:%w}]' would give you [E:11,W:872], which would turn to [E:11] if there are no warnings, and to [W:872] if there are no errors.
It's true however that there is no way to get just [E:11] if there are both errors and warnings, while still get [W:872] if there are warnings but no errors. For that some kind of negative %B{...} would be needed.
Yeah, however those sections should be in different airline-highlighting groups. Therefore we have the syntastic-warn and syntastic-err section, which each only need to get the each respective item.
So let's use [%E{E:%e(#%fe)}] for the error section and [%W{W:%w(#%fw)}] and make it configurable.
You're killing format flexibility for the sake of changing colors. _shrug_
I don't see how using different sections make the format less flexible
Because airline no longer pays attention to g:syntastic_stl_format. How do I get back the effect of g:syntastic_stl_format = '[%E{E:%e(#%fe)}%B{,}%W{W:%w(#%fw)}]'? What if I want to use, say, %ne?
if you don't care, put that into :let g:airline#extensions#syntastic#stl_format_err="<whatever>" and simply don't care ;)
That won't work if there are warnings but no errors.
Sorry, I am missing something. Why wouldn't that work? You would get an error symbol in front of it, but nevertheless, you should see the whole output as SyntasticStatuslineFlag() returns it.
Most helpful comment
How about reverting 2e30555, and messing with
g:syntastic_stl_formatonly if it isn't already set? Something along the lines of:(not tested).