Skip to content

Instantly share code, notes, and snippets.

@valerybugakov
Last active July 29, 2017 00:56
Show Gist options
  • Select an option

  • Save valerybugakov/c85dcc802548f6585db3ef3060b293a7 to your computer and use it in GitHub Desktop.

Select an option

Save valerybugakov/c85dcc802548f6585db3ef3060b293a7 to your computer and use it in GitHub Desktop.
Vim-airline-tabline formatter
" Drop this file into ~/.vim_bundle/vim-airline/autoload/airline/extensions/tabline/formatters
" And add to your .vimrc:
" :let g:airline#extensions#tabline#formatter = 'jsformatter'
function! airline#extensions#tabline#formatters#jsformatter#format(bufnr, buffers)
let buf = bufname(a:bufnr)
let filename = fnamemodify(buf, ':t')
if filename == 'index.js' || filename == 'index.jsx'
return fnamemodify(buf, ':p:h:t') . '/i'
else
return filename
endif
endfunction
" ~/.vim/bundle/vundle/autoload/airline/extensions/tabline/formatters/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment