Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm creating a custom statusline in vim with the following so far:

set statusline=%t
set laststatus=2

It's VERY simple but the problem is the filename shows up like so:


Is there a way to get it to show without "[Rails]"? I want just this

share|improve this question
Hello, what version of vim are you using? – Benoit Oct 18 '10 at 7:51
I'm using MacVim. I thought I figured out a way to do it but it's not working. I'm not sure what's causing the [Rails] part to show up. – MakeM Oct 18 '10 at 7:59
up vote 1 down vote accepted

The [Rails] bit is probably coming from the vim-rails plugin. The plugin will set a modified, local value for statusline when editing a Rails file (:set statusline? after seeing [Rails] in your status line to see that it has added %{rails#statusline()} to the end of the statusline value you set in your .vimrc). You can disable its statusline modifications by putting something like the following in your .vimrc:

let g:rails_statusline = 0

Incidentally, the [Rails] bit does not represent the value of the filetype option (which you can get with the %y statusline item, if you want it). It is mostly just a static string (there is some code to make it look like [Rails-controller] (also -model, -helper, etc.), but it looks like you would have to manually enable it).

share|improve this answer
Thank you so much, this was exactly what it was. It was killing me trying to figure this out! – MakeM Oct 18 '10 at 11:02


set statusline=%{fnamemodify(bufname('%'),':t')}
share|improve this answer

This does the trick

set statusline=%{expand(\"\%\%\")}
share|improve this answer
actually the [Rails] text still shows up – MakeM Oct 18 '10 at 9:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .