In the vim editor, the buffers look like l/t/l/c/admin.py for loanwolf/test/loanwolf/customers/admin.py. My point is I want to see something like admin.py (cus). How could I modify the .vimrc config to obtain something similar?

Thanks in advance!

enter image description here

| improve this question | | | | |
  • Offhand that looks more like a modify the source code issue than a .vimrc setting. – Herb Wolfe Mar 18 '17 at 16:08
  • 3
    Where do you see that? in status line, in tab line? A screenshot maybe? or/and link to your .vimrc – grodzik Mar 18 '17 at 22:25


This question relates more to the vim-airline plugin than to vim itself. I only mention that because it is easier to answer a question that is well-defined :P.

The vim-airline docs describe how to format buffer names.

Step by Step

Basically create a file named

<vim-airline directory>/autoload/airline/extensions/tabline/formatters/foo.vim.

that contains the following:

function! airline#extensions#tabline#formatters#foo#format(bufnr, buffers)
    return bufname(a:bufnr)

The function above would return the full file path I believe, but you can modify it to return any string you want. Once that is done, add this next line to your .vimrc:

let g:airline#extensions#tabline#formatter = 'foo'

And you should be good to go from there.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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