Skip to content

Instantly share code, notes, and snippets.

@gabrielpoca
Last active April 22, 2016 08:42
Show Gist options
  • Select an option

  • Save gabrielpoca/0dc4c1a318400dfffaa113c64e902ffd to your computer and use it in GitHub Desktop.

Select an option

Save gabrielpoca/0dc4c1a318400dfffaa113c64e902ffd to your computer and use it in GitHub Desktop.
An airline formatter for the tabline that replaces files called index.js by folder/index.js
function! airline#extensions#tabline#formatters#folder#format(bufnr, buffers)
let name = bufname(a:bufnr)
let folder = fnamemodify(name, ':p:h:t')
let file = fnamemodify(name, ':t')
if fnamemodify(name, ':t:r') == "index"
return folder . '/' . file
else
return airline#extensions#tabline#formatters#default#format(a:bufnr, a:buffers)
endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment