From a3d5e844173fa57e84d1013b4dd06a8279c1a86f Mon Sep 17 00:00:00 2001 From: Kyle Holzinger Date: Fri, 22 Dec 2017 12:13:22 -0500 Subject: [PATCH] Add formatter for js files --- .../extensions/tabline/formatters/jsformatter.vim | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 autoload/airline/extensions/tabline/formatters/jsformatter.vim diff --git a/autoload/airline/extensions/tabline/formatters/jsformatter.vim b/autoload/airline/extensions/tabline/formatters/jsformatter.vim new file mode 100644 index 00000000..4fd7f45f --- /dev/null +++ b/autoload/airline/extensions/tabline/formatters/jsformatter.vim @@ -0,0 +1,10 @@ +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 airline#extensions#tabline#formatters#unique_tail_improved#format(a:bufnr, a:buffers) + endif +endfunction