Vim statusline examples with screenshots?

2,350 views
Skip to first unread message

Jason Timrod

unread,
Jul 6, 2011, 6:15:01 PM7/6/11
to vim...@googlegroups.com
Hi all,

I'm curious to know how people pimp their Vim statusline perhaps with useful information?  So far, the only thing I've added to it is the current git branch I'm on.  Yet I know there's probably other really cool bits of information I'm missing, besides the default..

So, anyone prepared to show their statusline, preferably with a screenshot as well as the config for it?

TIA!
Jason

Jason Timrod

unread,
Jul 6, 2011, 7:03:02 PM7/6/11
to vim...@googlegroups.com
Oh - should this matter, I'd prefer this in console Vim and not gvim.  Thanks.  :)

Hi all,

TIA!
Jason

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Ivan S. Freitas

unread,
Jul 6, 2011, 7:16:54 PM7/6/11
to vim...@googlegroups.com
On Wed, Jul 6, 2011 at 8:03 PM, Jason Timrod <jti...@yahoo.com> wrote:
> Oh - should this matter, I'd prefer this in console Vim and not gvim.  Thanks.  :)

Here's mine. Config is also in the screenshot.
http://imagebin.org/161837

--
Ivan Sichmann Freitas
GNU/Linux user #509059

Bee

unread,
Jul 6, 2011, 7:43:46 PM7/6/11
to vim_use
Not a screen shot, copied the text on Mac terminal vim 7.3.237 along
with the statusline source from my .vimrc

102 set showmode showcmd cmdheight=2
103 set laststatus=2 " always show statusline
104
105 highlight StatusLine NONE ctermbg=DarkGreen ctermfg=White
cterm=NONE
106 if has("statusline")
107 set statusline = " clear
108 set statusline+=%02n " leading zero 2 digit buffer number
109 "xset statusline+=\ %<%F " file full path, truncate
110 set statusline+=\ %t " file tail
111 set statusline+=[%{&ff}] " [fileformat]
112 set statusline+=%r " read only flag '[RO]'
113 set statusline+=%m " modified flag '[+]' if modifiable
114 set statusline+=%h " help flag '[Help]'
115 set statusline+=%= " left/right separation point
116 set statusline+=[%b " decimal byte
117 set statusline+=\ x%02B] " hex byte ' \x62'
118 set statusline+=\ %{(line('.')-1)%16} " line
119 set statusline+=:%{(line('.')-1)/16} " block
120 set statusline+=\/%{line('$')/16} " max block
121 set statusline+=\ %c " column number
122 set statusline+=%V " virtual column '-{n}'
123 set statusline+=:%l/%L " line/lines
124 set statusline+=\ %p%% " percent of file
125 "xset statusline+=\ %P " percent of file{4} Top | n% | Bot
126 set statusline+=%{&hlsearch?'+':'-'}
127 set statusline+=%{&paste?'=':'\ '}
128 set statusline+=%{&wrap?'<':'>'}
129 endif

01 .vimrc[unix] [83 x53]
8:6/55 11:105/890 11%- >

buffer number
file name
fileformat
[char in decimal and hex]
line:block/blocks -- blocks of 16 lines
char:line/lines -- position in file
n% -- percentage of file
[+/-] -- hlsearch on/off
[=/ ] -- paste on/off
[</>] -- wrap on/off

-Bill

Tony Mechelynck

unread,
Jul 6, 2011, 7:56:45 PM7/6/11
to vim...@googlegroups.com, Jason Timrod
On 07/07/11 01:03, Jason Timrod wrote:
> Oh - should this matter, I'd prefer this in console Vim and not gvim. Thanks. :)
>
>
> ----- Original Message -----
> From: Jason Timrod<jti...@yahoo.com>
> To: "vim...@googlegroups.com"<vim...@googlegroups.com>
> Cc:
> Sent: Wednesday, July 6, 2011 10:15 PM
> Subject: Vim statusline examples with screenshots?
>
> Hi all,
>
> I'm curious to know how people pimp their Vim statusline perhaps with useful information? So far, the only thing I've added to it is the current git branch I'm on. Yet I know there's probably other really cool bits of information I'm missing, besides the default..
>
> So, anyone prepared to show their statusline, preferably with a screenshot as well as the config for it?
>
> TIA!
> Jason
>

http://users.skynet.be/antoine.mechelynck/vim/vim-konsole.png

This is not gvim, it is Vim in a konsole terminal (the titlebar and menu
of the konsole terminal are omitted), but resized to lines=47
columns=128, which is what I use, I didn't resize it for the occasion,
and with the CSApprox plugin which gives me a very similar look and feel
in an xterm128 as in gvim. I use it together with my homemade
colorscheme, almost-default.vim

The code for my statusline is as follows:

" custom status line, see :help 'statusline' for details
if has("statusline")
set statusline=%<%f\ %h%m%r%=%k[%{(&fenc\ ==\
\"\"?&enc:&fenc).(&bomb?\",BOM\":\"\")}][U+%04B]\ %-12.(%l,%c%V%)\ %P
endif

In case your mailer (or mine) tried to "beautify" the important line,
there are four lines here, beginning respectively with ", if, set, endif

<lang> near bottom right of the screenshot is what you get with
'iminsert' set to 1 but no keymap; with a keymap active it would be the
"short" keymapname.

The fact that a 7-bit ASCII file is detected as UTF-8 without BOM is
normal: characters U+0000 to U+007F are represented identically for the
same meanings in 7-bit US-ASCII, in most of the ISO 8859 encodings
including Latin1, and in UTF-8; so for such a file it makes no practical
difference which of these is used.

See also
:help 'statusline'
:help option-backslash
http://vim.wikia.com/wiki/Show_fileencoding_and_bomb_in_the_status_line

-- the wiki page above shows an earlier version of this same
'statusline' setting.


Best regards,
Tony.
--
It's lucky you're going so slowly, because you're going in the wrong
direction.

Steve Hall

unread,
Jul 6, 2011, 11:11:03 PM7/6/11
to vim...@googlegroups.com
On Wed, 2011-07-06 at 15:15 -0700, Jason Timrod wrote:
>
> So, anyone prepared to show their statusline, preferably with a
> screenshot as well as the config for it?

Mine shows 21 items in logical groupings that are still easily
readable. A number of these features are particular to our
customization, but all are extrapolations of basic Vim capabilities:

http://cream.sourceforge.net/statusline.html

What I like most is that fields and lengths don't change. All the
indicators stay in the same spot, respective states are indicated by
highlight. (Like lights on a dashboard.)

--
Steve Hall [ digitect dancingpaper com ]


Magnus Woldrich

unread,
Jul 7, 2011, 12:14:43 AM7/7/11
to vim...@googlegroups.com
On 2011-07-06 15:15, Jason Timrod wrote:
>So, anyone prepared to show their statusline, preferably with a
>screenshot as well as the config for it?

Here's [0] mine. Note the different statuslines for active/inactive windows.
Code on github [1].

[0]: http://i.japh.se/vim.png
[1]: http://github.com/trapd00r/configs/blob/master/vim/after/plugin/statusline.vim

--
│ Magnus Woldrich
m...@japh.se
http://japh.se

Jacky Liu

unread,
Jul 7, 2011, 2:06:57 PM7/7/11
to v...@vim.org

I've done a completion mode indicator with the statusline, it indicates
which one of the 15 completion modes you're in when you type, here's the
link: http://bluegene8210.is-programmer.com/posts/27873.html text was in
Chinese but there are several screenshots where you can see what I'm talking
about. It's the most complex and funny thing I've done so far with the
statusline.

As for the vim/gvim issue, I believe they differ only when the coloring
features are concerned, e.g you can't use custom color like '#233b5a' in the
statusline with console vim, as I used in my codes.

--
View this message in context: http://vim.1045645.n5.nabble.com/Vim-statusline-examples-with-screenshots-tp4559125p4561904.html
Sent from the Vim - General mailing list archive at Nabble.com.

Jeffrey 'jf' Lim

unread,
Jul 8, 2011, 12:33:55 AM7/8/11
to vim...@googlegroups.com
On Thu, Jul 7, 2011 at 11:11 AM, Steve Hall <digi...@dancingpaper.com> wrote:

Mine shows 21 items in logical groupings that are still easily
readable. A number of these features are particular to our
customization, but all are extrapolations of basic Vim capabilities:

http://cream.sourceforge.net/statusline.html

What I like most is that fields and lengths don't change. All the
indicators stay in the same spot, respective states are indicated by
highlight. (Like lights on a dashboard.)


do you have the relevant (and only the relevant) code for this?

-jf


--
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."
    --Richard Stallman

"It's so hard to write a graphics driver that open-sourcing it would not help."
    -- Andrew Fear, Software Product Manager, NVIDIA Corporation
http://kerneltrap.org/node/7228

François Ingelrest

unread,
Jul 8, 2011, 2:13:39 AM7/8/11
to vim...@googlegroups.com
Hi,

On Thu, Jul 7, 2011 at 05:11, Steve Hall wrote:
> Mine shows 21 items in logical groupings that are still easily
> readable. A number of these features are particular to our
> customization, but all are extrapolations of basic Vim capabilities:
>
> http://cream.sourceforge.net/statusline.html

How do you get the file size? That's a useful information I could add
to my own status line.

Bee

unread,
Jul 8, 2011, 2:45:32 AM7/8/11
to vim_use


On Jul 7, 11:13 pm, François Ingelrest <francois.ingelr...@gmail.com>
wrote:
:help line2byte()

-Bill

François Ingelrest

unread,
Jul 8, 2011, 2:52:52 AM7/8/11
to vim...@googlegroups.com
On Fri, Jul 8, 2011 at 08:45, Bee wrote:
>> How do you get the file size? That's a useful information I could add
>> to my own status line.
>
> :help line2byte()

Cool thanks, I didn't know about that one.

Steve Hall

unread,
Jul 8, 2011, 10:46:17 AM7/8/11
to vim...@googlegroups.com
From: "Jeffrey 'jf' Lim", Fri, July 08, 2011 12:33 am

> On Thu, Jul 7, 2011 at 11:11 AM, Steve Hall wrote:
> >
> > Mine shows 21 items in logical groupings that are still easily
> > readable. A number of these features are particular to our
> > customization, but all are extrapolations of basic Vim
> > capabilities:
> >
> > http://cream.sourceforge.net/statusline.html
> >
> > What I like most is that fields and lengths don't change. All the
> > indicators stay in the same spot, respective states are indicated
> > by highlight. (Like lights on a dashboard.)
>
> do you have the relevant (and only the relevant) code for this?

We keep our code here:

http://cream.cvs.sourceforge.net/viewvc/cream/cream/cream-statusline.vim?view=log

I believe it is modular enough to function by itself (just source the
file). A few of the items require Cream environment-specific globals,
but these should fail quietly.

Steve Hall

unread,
Jul 8, 2011, 11:05:51 AM7/8/11
to vim...@googlegroups.com
From: François_Ingelrest, Fri, July 08, 2011 2:52 am

You can tweak it a little to handle empty buffers and group numbers
(below
with US commas, change to taste).

1:function! Cream_statusline_bufsize()
2: let bufsize = line2byte(line("$") + 1) - 1
3: " prevent negative numbers (non-existant buffers)
4: if bufsize < 0
5: let bufsize = 0
6: endif
7: " add commas
8: let remain = bufsize
9: let bufsize = ""
10: while strlen(remain) > 3
11: let bufsize = ",".strpart(remain, strlen(remain) - 3).bufsize
12: let remain = strpart(remain, 0, strlen(remain) - 3)
13: endwhile
14: let bufsize = remain . bufsize
15: " too bad we can't use (nr2char(1068)) :)
16: let char = "b"
17: return bufsize . char
18:endfunction

We use an incorrect "b" to indicate bytes to better distinguish it
from numbers.

Dominique Pellé

unread,
Jul 8, 2011, 4:48:04 PM7/8/11
to vim...@googlegroups.com
Jason Timrod wrote:

Here is mine:

Screenshot: http://dominique.pelle.free.fr/pic/vim-statusline.png
vimrc: http://dominique.pelle.free.fr/.vimrc.html

Status line shows:
- buffer number/buffer count
- file name
- flags ([RO], etc.)
- file type
- file encoding + BOM
- file format (dos, unix, mac)
- spell language
- current function name
- name of syntax group under cursor
- utf-8 sequence under cursor (displayed for non ascii char only)
- Unicode code point of character under cursor (U+xxxx)
- cursor position (current line / total line count, column, % in file)

-- Dominique

Marcin Szamotulski

unread,
Jul 8, 2011, 6:05:15 PM7/8/11
to vim...@googlegroups.com
Hi all,

I have a video :) the ATP plugin (which I'm maintaining) has a statusline with
progress bar info, here's the link
http://atp-vim.sourceforge.net/videos.shtml
(look at the PROGRESS BAR video)

Best,
Marcin Szamotulski

Jason Timrod

unread,
Jul 9, 2011, 8:12:51 AM7/9/11
to vim...@googlegroups.com
Hi all,

Thank you to every one who's replied -- it's been really useful.  When I put something together which suits me, based on all these wonderful suggestions, I'll let people know!

Thanks!

Jason


----- Original Message -----
From: Marcin Szamotulski <msz...@gmail.com>
To: vim...@googlegroups.com
Cc:
Sent: Friday, July 8, 2011 10:05 PM
Subject: Re: Vim statusline examples with screenshots?

Hi all,

I have a video :) the ATP plugin (which I'm maintaining) has a statusline with
progress bar info, here's the link
http://atp-vim.sourceforge.net/videos.shtml
(look at the PROGRESS BAR video)

Best,
Marcin Szamotulski

Reply all
Reply to author
Forward
0 new messages