Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Name of buffer to only filename instead of path

Tags:

vim

I am using the vim-airline plug-in to improve my status line at the bottom of a vim session.

In my vimrc I have,

let g:airline#extensions#tabline#enabled = 1

What this does is, it assigns a tab at the top of each buffer with the file that is open in that buffer.

My problem is that, the text in that tab has the entire path of the file that is open in the buffer. Whereas I only want the name of the file in the tab of the buffer.

For example if I open the file ~/abcd/bcd/cd/d.txt in a buffer, then the tab for the corresponding buffer has the text ~/a/b/c/d.txt whereas I would like it to simply be d.txt.

Could someone please tell me if there is a way to accomplish this?

like image 495
Jay Avatar asked Sep 13 '13 08:09

Jay


1 Answers

add the following to your vimrc:

let g:airline#extensions#tabline#fnamemod = ':t'

it takes anything from :help filename-modifiers.

like image 147
bling Avatar answered Oct 24 '22 23:10

bling