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:

my_file.rb[Rails]

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

my_file.rb
link|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
feedback

3 Answers

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).

link|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
feedback

Try:

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

This does the trick

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

Your Answer

 
or
required, but never shown

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