I’d like to make my statusline in vim more informative and interesting, and for that I need some ideas. How did you customize your statusline?

share|improve this question

closed as not constructive by casperOne May 7 '12 at 21:11

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

5  
@paxdiablo: Sometimes it's worth spending the time to configure the tool to your need so you can make better use of it and thus save time while working. – DarkDust Mar 21 '11 at 8:29
9  
This should be a community wiki as there is no correct answer. – Randy Morris Mar 21 '11 at 12:27
up vote 50 down vote accepted

Pretty nice stuff for statuslines here:

share|improve this answer
1  
You can check scrooloose's github vimfiles repository with a REALLY complete statusline at github.com/scrooloose/vimfiles/blob/master/vimrc#L78 – GmonC Mar 23 '11 at 3:12
    
+1 for the vim pr0n. great site – psynnott May 28 '13 at 10:32

Edit:-

Note vim-airline is gaining some traction as the new vimscript option as powerline has gone python.


Seems powerline is where it is at these days:-

Normal status line

powerline

Customised status lines for other plugins (e.g. ctrlp)

powerline

share|improve this answer
3  
@Gavin how can I change to your power line segments? could u update some default segment modification scripts? cheers – Jerry Gao May 8 '12 at 8:22
    
@Gavin I, too, would appreciate if you could share how you included things like your branch in vim-powerline – Eric Hu Sep 11 '12 at 19:12
1  
Nothing special done, from: github.com/Lokaltog/vim-powerline#troubleshooting just make sure you have "let g:Powerline_symbols = 'fancy'" in your vimrc file and have patched fonts installed. – Gavin Gilmour Sep 16 '12 at 10:20
    
this is a nice plugin. But my scrolling performance when i first open a file is very very bad because of this. – Ahmed Aeon Axan Apr 14 '13 at 20:06
1  
@AhmedAeonAxan try airline, it starts fast (pure vimscript). And takes way less effort to setup, especially with Vundle or Pathogen. And once you install powerline font it more or less look like airline. github.com/Lokaltog/powerline-fonts – snowbound Apr 23 '14 at 13:46

Here's mine:

set statusline=
set statusline +=%1*\ %n\ %*            "buffer number
set statusline +=%5*%{&ff}%*            "file format
set statusline +=%3*%y%*                "file type
set statusline +=%4*\ %<%F%*            "full path
set statusline +=%2*%m%*                "modified flag
set statusline +=%1*%=%5l%*             "current line
set statusline +=%2*/%L%*               "total lines
set statusline +=%1*%4v\ %*             "virtual column number
set statusline +=%2*0x%04B\ %*          "character under cursor

vim statusline

And here's the colors I used:

hi User1 guifg=#eea040 guibg=#222222
hi User2 guifg=#dd3333 guibg=#222222
hi User3 guifg=#ff66ff guibg=#222222
hi User4 guifg=#a0ee40 guibg=#222222
hi User5 guifg=#eeee40 guibg=#222222
share|improve this answer
    
c is actually the byte count, even if it is sometimes called column count even in vim help. You can use v to get what is usually meant by column number. – Ludwig Weinzierl Jan 3 '12 at 17:26
    
Thanks @Ludwig, I haven't noticed it. I'll edit the answer. – Tassos Jan 5 '12 at 22:35
7  
I love the clarity of the commenting each appended value on it's own line. If I had done that 7 years ago, I wouldn't have thrown it out when I did my last clean OS install. – Bruno Bronosky Mar 20 '13 at 2:32
    
Sweeet! One thing I missing using this is the line that separates the splited session – Julio Marins Nov 15 '16 at 23:32
    
How do you make the colors work? – trusktr Feb 5 at 6:03

This is the one I use:

set statusline=
set statusline+=%7*\[%n]                                  "buffernr
set statusline+=%1*\ %<%F\                                "File+path
set statusline+=%2*\ %y\                                  "FileType
set statusline+=%3*\ %{''.(&fenc!=''?&fenc:&enc).''}      "Encoding
set statusline+=%3*\ %{(&bomb?\",BOM\":\"\")}\            "Encoding2
set statusline+=%4*\ %{&ff}\                              "FileFormat (dos/unix..) 
set statusline+=%5*\ %{&spelllang}\%{HighlightSearch()}\  "Spellanguage & Highlight on?
set statusline+=%8*\ %=\ row:%l/%L\ (%03p%%)\             "Rownumber/total (%)
set statusline+=%9*\ col:%03c\                            "Colnr
set statusline+=%0*\ \ %m%r%w\ %P\ \                      "Modified? Readonly? Top/bot.

Highlight on? function:

function! HighlightSearch()
  if &hls
    return 'H'
  else
    return ''
  endif
endfunction

Colors (adapted from ligh2011.vim):

hi User1 guifg=#ffdad8  guibg=#880c0e
hi User2 guifg=#000000  guibg=#F4905C
hi User3 guifg=#292b00  guibg=#f4f597
hi User4 guifg=#112605  guibg=#aefe7B
hi User5 guifg=#051d00  guibg=#7dcc7d
hi User7 guifg=#ffffff  guibg=#880c0e gui=bold
hi User8 guifg=#ffffff  guibg=#5b7fbb
hi User9 guifg=#ffffff  guibg=#810085
hi User0 guifg=#ffffff  guibg=#094afe

My StatusLine

share|improve this answer
1  
Nice, this avoids the need to have the fancy status line plugins atleast for my use case, eye candy :) – Nishant Jun 29 '16 at 9:48
    
How do you get the colors to work? – trusktr Feb 5 at 6:05
    
I tried putting this after any colorscheme was set, but I just see a dual-tone statusline. – trusktr Feb 5 at 6:13
    
@trusktr, Not easy to explain....You need the put the first 2 blocks in your vimrc file and the colors block in your current colorscheme file. You can find your current colorscheme file with this command: :colorscheme – Reman Feb 5 at 15:54
    
@Reman I can't just stick those colors in my vimrc? I do have other colors in my vimrc that work. – trusktr Feb 6 at 2:53

What I've found useful is to know which copy/paste buffer (register) is currently active: %{v:register}. Otherwise, my complete status line looks almost exactly like the standard line.

:set statusline=%<%f\ %h%m%r\ %y%=%{v:register}\ %-14.(%l,%c%V%)\ %P
share|improve this answer
1  
My, that v:register looks very useful indeed! – progo Mar 21 '11 at 8:26

Some times less is more, do you really need to know the percentage through the file you are when coding? What about the type of file?

set statusline=%F%m%r%h%w\ 
set statusline+=%{fugitive#statusline()}\    
set statusline+=[%{strlen(&fenc)?&fenc:&enc}]
set statusline+=\ [line\ %l\/%L]          
set statusline+=%{rvm#statusline()}       

statusline

statusline

I also prefer minimal color as not to distract from the code.

Taken from: https://github.com/krisleech/vimfiles

Note: rvm#statusline is Ruby specific and fugitive#statusline is git specific.

share|improve this answer
    
+1 for git related statusline – Patrick Jan 22 '12 at 19:53

I currently use this statusbar settings:

set laststatus=2
set statusline=\ %f%m%r%h%w\ %=%({%{&ff}\|%{(&fenc==\"\"?&enc:&fenc).((exists(\"+bomb\")\ &&\ &bomb)?\",B\":\"\")}%k\|%Y}%)\ %([%l,%v][%p%%]\ %)

My complete .vimrc file: http://gabriev82.altervista.org/projects/vim-configuration/

share|improve this answer
    
+1 for the bomb indicator – Robert Gowland Apr 24 '12 at 14:48

set statusline=%<%f%m\ \[%{&ff}:%{&fenc}:%Y]\ %{getcwd()}\ \ \[%{strftime('%Y/%b/%d\ %a\ %I:%M\ %p')}\]\ %=\ Line:%l\/%L\ Column:%c%V\ %P

This is mine, give as a suggestion

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.