It seems that statusline doesn't properly work with whitespace.
Here is my .vimrc:
set encoding=utf-8 set guifont=Consolas:h10 colorscheme desert let separator = ' ' set laststatus=2 set statusline= set statusline+=%n set statusline+=%{separator} set statusline+=%t set statusline+=%= set statusline+=%(%l:%c%V%) set statusline+=%{separator} set statusline+=%{&expandtab?'spaces':'tab\ size'}:\ %{shiftwidth()} set statusline+=%{separator} set statusline+=%{&fileformat} set statusline+=%{separator} set statusline+=%{(strlen(&fileencoding)?&fileencoding:&encoding).((exists('+bomb')&&&bomb)?'-with-bom':'')} set statusline+=%{separator} set statusline+=%{strlen(&filetype)?&filetype:'text'}
And here is how Vim looks:
As you can see, at some places there are only 3 spaces instead of 4. and looks like a bug for me.
Then, if we use hard-coded spaces instead of separator - everything will be correct:
set encoding=utf-8 set guifont=Consolas:h10 colorscheme desert set laststatus=2 set statusline= set statusline+=%n\ \ \ \ " set statusline+=%t set statusline+=%= set statusline+=%(%l:%c%V%)\ \ \ \ " set statusline+=%{&expandtab?'spaces':'tab\ size'}:\ %{shiftwidth()}\ \ \ \ " set statusline+=%{&fileformat}\ \ \ \ " set statusline+=%{(strlen(&fileencoding)?&fileencoding:&encoding).((exists('+bomb')&&&bomb)?'-with-bom':'')}\ \ \ \ " set statusline+=%{strlen(&filetype)?&filetype:'text'}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
:version heading shows, this Vim executable was compilmed on the very first day of the 8.1 release, almost 9 months ago. The latest source as of this writing is 8.1.868. Have you tried using a more up-to-date version of Vim?Best regards,
Tony.
As your :version heading shows, this Vim executable was compiled on the very first day of the 8.1 release, almost 9 months ago.
Actually, it some kind of fresh version :-) I downloaded it January 30. It seems that Windows binary is a bit outdated.
Best regards you too :-)
I think this is a duplicate of #1431
I hesitate to change how 'statusline' deals with whitespace especially
for %{} items. There are some tricks to drop whitespace, especially if
one of the items is empty. Existing implementations depend on that.
In other words, it's some kind of bug, which is considered as feature?
A better solution would be to explicitly have an item that specifies
the amount of white space, which then would be inserted literally.
Interesting. As n00b, I don't know the way how it should be done, but
still interesting.
// There are at least 2 Monty Python fans here!
What if we allow %0{...} to disable the space eating? Zero pad is not otherwise used for { in the statusline. Implementation is very simple:
--- a/src/buffer.c +++ b/src/buffer.c @@ -4223,7 +4223,7 @@ build_stl_str_hl( break; case STL_VIM_EXPR: /* '{' */ - itemisflag = TRUE; + itemisflag = zeropad ? FALSE : TRUE; t = p; while (*s != '}' && *s != NUL && p + 1 < out + outlen) *p++ = *s++;
Although, the other behavior of %{} which one might want to disable is %{000} becomes 0 since it looks like a number. Perhaps some other symbol should be used e.g., %+{".."} which means interpret as a string without the special processing, i.e., not a flag and no conversion to number.
Does it exist a better workaround then using "?
" This line is used as separator: set statusline+=%\ \ \ \ "
I have the same problem, is there any news? Thanks
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()