Jay
Jay

Reputation: 1101

Name of buffer to only filename instead of path

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?

Upvotes: 13

Views: 3517

Answers (1)

bling
bling

Reputation: 1161

add the following to your vimrc:

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

it takes anything from :help filename-modifiers.

Upvotes: 24

Related Questions